repo_name
stringlengths
6
97
path
stringlengths
3
341
text
stringlengths
8
1.02M
wei-tseng/branch-dqn
dqn.py
<filename>dqn.py<gh_stars>1-10 from core import BranchDuelingDQN import torch from torch.autograd import Variable import numpy as np from collections import namedtuple, deque import random import time from tensorboardX import SummaryWriter from gym.spaces import Discrete, Box Transition = namedtuple('Transition', ...
amaarora/face_detector
FakeDetector/_nbdev.py
#AUTOGENERATED BY NBDEV! DO NOT EDIT! __all__ = ["index", "modules", "custom_doc_links", "git_url"] index = {"download_file": "01_data.ipynb", "get_files": "01_data.ipynb", "num_files": "01_data.ipynb", "url": "01_data.ipynb", "get_pretrained_models": "01_data.ipynb", "xce...
amaarora/face_detector
FakeDetector/imports.py
import cv2 import torch import os from path import Path from pdb import set_trace import requests,yaml,matplotlib.pyplot as plt,numpy as np,pandas as pd,scipy from fastprogress.fastprogress import progress_bar
amaarora/face_detector
FakeDetector/data/core.py
<filename>FakeDetector/data/core.py #AUTOGENERATED! DO NOT EDIT! File to edit: dev/01_data.ipynb (unless otherwise specified). __all__ = ['download_file', 'get_files', 'num_files', 'url', 'get_pretrained_models', 'xceptionURL'] #Cell from ..imports import * import requests import urllib #Cell def download_file(url, ...
amaarora/face_detector
FakeDetector/data/preprocess.py
<reponame>amaarora/face_detector #AUTOGENERATED! DO NOT EDIT! File to edit: dev/02_preprocess.ipynb (unless otherwise specified). __all__ = [] #Cell from ..imports import * from .core import *
UbiquitousPhoton/RsyncHelper
RsyncHelper.py
#!/usr/bin/env python3 # MIT License # # Copyright (c) 2019 <NAME> # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # ...
sknadig/lhotse
test/augmentation/test_torchaudio.py
<reponame>sknadig/lhotse import math import pytest import torch torchaudio = pytest.importorskip('torchaudio', minversion='0.6') from lhotse.augmentation import SoxEffectTransform, pitch, reverb, speed, Speed from lhotse import AudioTransform SAMPLING_RATE = 16000 @pytest.fixture def audio(): return torch.sin...
MubaiHua/Symptom-Monitoring-System-Auto
main.py
#!/usr/local/bin/python3 import os.path import time import pyotp import requests import base64 import json import sys from selenium import webdriver from selenium.webdriver.chrome.service import Service from webdriver_manager.chrome import ChromeDriverManager from selenium.webdriver.common.by import By from selenium.w...
odioidentisti2/ChiwiCoin
chiwicoin.py
<gh_stars>0 from time import ctime from hashlib import sha256 import json import requests from flask import Flask, request, render_template PORT = 5000 class BlockChain: genesis_block = {'Per aspera': 'ad astra', 'proof': 0 } def __init__(self): self.node...
achievement008/followthemoney
contrib/memtest.py
<filename>contrib/memtest.py import sys import logging import balkhash from followthemoney import model from followthemoney.types import registry fmt = "%(name)s [%(levelname)s] %(message)s" logging.basicConfig(stream=sys.stderr, level=logging.INFO, format=fmt) registry.text.max_size = 1 * 1024 * 1024 dataset = balk...
achievement008/followthemoney
tests/types/test_number.py
import unittest from followthemoney.types import registry numbers = registry.number class NumberTest(unittest.TestCase): def test_cast_num(self): self.assertEqual(numbers.to_number("1,00,000"), 100000.0) self.assertEqual(numbers.to_number(" -999.0"), -999.0) self.assertEqual(numbers.to_n...
achievement008/followthemoney
followthemoney/dedupe/match.py
import json from banal import is_mapping from followthemoney.compare import compare from followthemoney.util import get_entity_id class Match(object): SAME = True DIFFERENT = False UNDECIDED = None def __init__(self, model, data): self.model = model self._data = data # Suppor...
achievement008/followthemoney
followthemoney/types/json.py
<filename>followthemoney/types/json.py import json # yay Python 3 from banal import ensure_list from followthemoney.types.common import PropertyType from followthemoney.util import sanitize_text, defer as _ class JsonType(PropertyType): name = "json" group = None label = _("Nested data") matchable =...
achievement008/followthemoney
tests/dedupe/test_match.py
<reponame>achievement008/followthemoney<filename>tests/dedupe/test_match.py from unittest import TestCase from copy import deepcopy from followthemoney import model from followthemoney.dedupe import Match SAMPLE = { "decision": True, "canonical": {"id": "can", "schema": "Person", "properties": {"name": ["Tom"...
achievement008/followthemoney
contrib/wikidata.py
<reponame>achievement008/followthemoney import sys import click import logging from rdflib import Graph, Namespace from rdflib.namespace import SKOS, RDFS from followthemoney import model SCHEMA = Namespace("http://schema.org/") PROP = Namespace("http://www.wikidata.org/prop/direct/") ENTITY = "http://www.wikidata.o...
achievement008/followthemoney
followthemoney/dedupe/__init__.py
from followthemoney.dedupe.match import Match from followthemoney.dedupe.linker import Linker __all__ = ["Match", "Linker"]
achievement008/followthemoney
tests/export/test_neo4j.py
import io import csv import shutil from tempfile import mkdtemp from unittest import TestCase from followthemoney import model from followthemoney.export.neo4j import CypherGraphExporter from followthemoney.export.neo4j import Neo4JCSVExporter from followthemoney.export.graph import edge_types ENTITIES = [ { ...
achievement008/followthemoney
followthemoney/types/iban.py
<reponame>achievement008/followthemoney<gh_stars>0 from rdflib import URIRef # type: ignore from stdnum import iban # type: ignore from stdnum.exceptions import ValidationError # type: ignore from followthemoney.types.common import PropertyType from followthemoney.util import sanitize_text, defer as _ class IbanT...
achievement008/followthemoney
followthemoney/types/common.py
<filename>followthemoney/types/common.py from itertools import product from rdflib import Literal # type: ignore from banal import ensure_list from normality import stringify from typing import Any, Optional from followthemoney.util import get_locale from followthemoney.util import gettext, sanitize_text class Prop...
achievement008/followthemoney
followthemoney/mapping/__init__.py
<reponame>achievement008/followthemoney from followthemoney.mapping.query import QueryMapping __all__ = ["QueryMapping"]
achievement008/followthemoney
followthemoney/types/url.py
from rdflib import URIRef # type: ignore from urlnormalizer import normalize_url, is_valid_url # type: ignore from followthemoney.types.common import PropertyType from followthemoney.util import defer as _ class UrlType(PropertyType): name = "url" group = "urls" label = _("URL") plural = _("URLs") ...
achievement008/followthemoney
followthemoney/types/registry.py
<filename>followthemoney/types/registry.py from banal import ensure_list from followthemoney.types.common import PropertyType class Registry(object): """This registry keeps the processing helpers for all property types in the system. It can be used to get a helper for a type, which can then clean, validat...
achievement008/followthemoney
followthemoney/cli/__init__.py
<gh_stars>100-1000 from pkg_resources import iter_entry_points for ep in iter_entry_points("followthemoney.cli"): ep.load()
achievement008/followthemoney
followthemoney/export/graph.py
import networkx as nx # type: ignore from pprint import pprint # noqa from networkx.readwrite.gexf import generate_gexf # type: ignore from followthemoney.graph import Graph from followthemoney.types import registry from followthemoney.export.common import Exporter DEFAULT_EDGE_TYPES = (registry.entity.name,) de...
achievement008/followthemoney
followthemoney/types/identifier.py
import re from followthemoney.types.common import PropertyType from followthemoney.util import dampen, shortest from followthemoney.util import defer as _ class IdentifierType(PropertyType): """Used for registration numbers, codes etc.""" COMPARE_CLEAN = re.compile(r"[\W_]+") name = "identifier" gro...
achievement008/followthemoney
followthemoney/types/date.py
import re import os import pytz import logging from rdflib import Literal # type: ignore from rdflib.namespace import XSD # type: ignore from datetime import datetime, date from followthemoney.types.common import PropertyType from followthemoney.util import defer as _ from followthemoney.util import dampen, sanitize...
achievement008/followthemoney
tests/types/test_entity.py
import unittest from followthemoney.types import registry entities = registry.entity class EntityTest(unittest.TestCase): def test_parse(self): self.assertEqual(entities.clean("888"), "888") self.assertEqual(entities.clean(888), "888") self.assertEqual(entities.clean({"id": 888}), "888")...
achievement008/followthemoney
followthemoney/types/phone.py
<filename>followthemoney/types/phone.py from rdflib import URIRef # type: ignore from phonenumbers import geocoder # type: ignore from phonenumbers import parse as parse_number # type: ignore from phonenumbers import is_valid_number, format_number # type: ignore from phonenumbers import PhoneNumberFormat # type: i...
achievement008/followthemoney
followthemoney/export/neo4j.py
<gh_stars>100-1000 import os import json import logging import stringcase # type: ignore from followthemoney.export.csv import CSVMixin from followthemoney.export.graph import GraphExporter, DEFAULT_EDGE_TYPES log = logging.getLogger(__name__) NEO4J_ADMIN_PATH = os.environ.get("NEO4J_ADMIN_PATH", "neo4j-admin") NEO4...
achievement008/followthemoney
followthemoney/property.py
<reponame>achievement008/followthemoney from rdflib import URIRef # type: ignore from banal import is_mapping from normality import stringify from followthemoney.exc import InvalidModel from followthemoney.types import registry from followthemoney.util import gettext, NS, get_entity_id class Property(object): R...
achievement008/followthemoney
followthemoney/types/address.py
import re from normality import slugify from normality.cleaning import collapse_spaces from followthemoney.types.common import PropertyType from followthemoney.util import defer as _ from followthemoney.util import dampen class AddressType(PropertyType): LINE_BREAKS = re.compile(r"(\r\n|\n|<BR/>|<BR>|\t|ESQ\.,|E...
achievement008/followthemoney
followthemoney/messages.py
import six import yaml def extract_object(data, path): for key, value in data.items(): subpath = path + [key] if isinstance(value, six.string_types): if key in ["label", "reverse", "description", "plural"]: comment = ".".join(subpath) yield (None, None, ...
achievement008/followthemoney
enrich/followthemoney_enrich/__init__.py
<filename>enrich/followthemoney_enrich/__init__.py import logging from pkg_resources import iter_entry_points from followthemoney_enrich.aleph import AlephEnricher # noqa from followthemoney_enrich.opencorporates import OpenCorporatesEnricher # noqa from followthemoney_enrich.cache import Cache, RedisCache log = lo...
achievement008/followthemoney
enrich/followthemoney_enrich/enricher.py
import logging from pprint import pprint # noqa from followthemoney import model from followthemoney.dedupe import Match from followthemoney_enrich.cache import Cache log = logging.getLogger(__name__) class Enricher(object): cache = Cache() name = None def make_match(self, canonical, entity): ...
achievement008/followthemoney
followthemoney/types/ip.py
from rdflib import URIRef # type: ignore from ipaddress import ip_address # type: ignore from followthemoney.types.common import PropertyType from followthemoney.util import defer as _ class IpType(PropertyType): name = "ip" group = "ips" label = _("IP-Address") plural = _("IP-Addresses") match...
achievement008/followthemoney
followthemoney/types/mimetype.py
<reponame>achievement008/followthemoney from rdflib import URIRef # type: ignore from pantomime import normalize_mimetype, parse_mimetype # type: ignore from pantomime import DEFAULT # type: ignore from followthemoney.types.common import PropertyType from followthemoney.util import defer as _ class MimeType(Prope...
achievement008/followthemoney
followthemoney/types/topic.py
from rdflib import URIRef # type: ignore from followthemoney.types.common import EnumType from followthemoney.util import gettext, defer as _ class TopicType(EnumType): name = "topic" group = "topics" label = _("Topic") plural = _("Topics") matchable = False _TOPICS = { "crime": _("...
achievement008/followthemoney
tests/types/test_phones.py
<reponame>achievement008/followthemoney import unittest from followthemoney import model from followthemoney.types import registry class PhonesTest(unittest.TestCase): def test_us_number(self): phones = registry.phone self.assertEqual(phones.clean("+1-800-784-2433"), "+18007842433") self....
achievement008/followthemoney
followthemoney/util.py
import os import logging from hashlib import sha1 from babel import Locale # type: ignore from gettext import translation # type: ignore from rdflib import Namespace # type: ignore from threading import local from normality import stringify from normality.cleaning import compose_nfc from normality.cleaning import re...
achievement008/followthemoney
tests/types/test_urls.py
import unittest from followthemoney.types import registry urls = registry.url class UrlsTest(unittest.TestCase): def test_is_url(self): self.assertTrue(urls.validate("http://foo.org")) self.assertFalse(urls.validate(None)) self.assertFalse(urls.validate("hello")) def test_unicode_ur...
achievement008/followthemoney
tests/test_util.py
from unittest import TestCase from followthemoney.util import merge_context class UtilTestCase(TestCase): def test_merge_value(self): old = { "foo": "bar", } new = { "foo": "quux", } result = merge_context(old, new) assert result["foo"] == ["...
achievement008/followthemoney
tests/types/test_addresses.py
import unittest from followthemoney.types import registry UK = """43 Duke Street Edinburgh EH6 8HH""" class AddressesTest(unittest.TestCase): def test_clean(self): addresses = registry.address self.assertEqual(addresses.clean(UK), "43 Duke Street, Edinburgh, EH6 8HH") self.assertEqual(ad...
achievement008/followthemoney
followthemoney/export/rdf.py
import logging from rdflib import Graph # type: ignore from followthemoney.export.common import Exporter log = logging.getLogger(__name__) class RDFExporter(Exporter): def __init__(self, fh, qualified=True): super(RDFExporter, self).__init__() self.fh = fh self.qualified = qualified ...
achievement008/followthemoney
tests/types/test_countries.py
import unittest from followthemoney.types import registry class CountriesTest(unittest.TestCase): def test_country_codes(self): countries = registry.country self.assertEqual(countries.clean("DE"), "de") self.assertTrue(countries.validate("DE")) self.assertFalse(countries.validate(...
achievement008/followthemoney
followthemoney/cli/mapping.py
<reponame>achievement008/followthemoney import click from banal import keys_values from followthemoney import model from followthemoney.namespace import Namespace from followthemoney.mapping.source import StreamSource from followthemoney.cli.cli import cli from followthemoney.cli.util import write_object, load_mapping...
achievement008/followthemoney
tests/types/test_json.py
import unittest from followthemoney.types import registry json = registry.json class JsonTest(unittest.TestCase): def test_parse(self): self.assertEqual(json.clean("88"), "88") self.assertEqual(json.clean({"id": 88}), json.pack({"id": 88})) self.assertEqual(json.clean(None), None) d...
achievement008/followthemoney
tests/export/test_csv.py
<reponame>achievement008/followthemoney import csv import shutil from tempfile import mkdtemp from unittest import TestCase from followthemoney import model from followthemoney.export.csv import CSVExporter ENTITY = { "id": "person", "schema": "Person", "properties": { "name": ["<NAME>"], ...
achievement008/followthemoney
followthemoney/types/domain.py
<reponame>achievement008/followthemoney # TODO: https://pypi.python.org/pypi/publicsuffix/ # import socket from urllib.parse import urlparse from followthemoney.types.common import PropertyType from followthemoney.util import sanitize_text, defer as _ class DomainType(PropertyType): name = "domain" group = N...
achievement008/followthemoney
followthemoney/types/string.py
<gh_stars>0 from followthemoney.types.common import PropertyType from followthemoney.util import defer as _ from followthemoney.util import MEGABYTE class StringType(PropertyType): name = "string" label = _("Label") plural = _("Labels") matchable = False def node_id(self, value): return N...
achievement008/followthemoney
tests/types/test_emails.py
<filename>tests/types/test_emails.py import unittest from followthemoney.types import registry emails = registry.email class EmailsTest(unittest.TestCase): def test_parse(self): self.assertEqual(emails.clean("<EMAIL>"), "<EMAIL>") self.assertEqual(emails.clean('"<EMAIL>"'), "<EMAIL>") se...
achievement008/followthemoney
followthemoney/types/__init__.py
<reponame>achievement008/followthemoney from followthemoney.types.registry import Registry from followthemoney.types.url import UrlType from followthemoney.types.name import NameType from followthemoney.types.domain import DomainType from followthemoney.types.email import EmailType from followthemoney.types.ip import I...
xxoolm/YYeTsBot
yyetsbot/bot.py
# coding: utf-8 # YYeTsBot - bot.py # 2019/8/15 18:27 __author__ = 'Benny <<EMAIL>>' import io import time import re import logging import json import tempfile from urllib.parse import quote_plus import telebot from telebot import types, apihelper from tgbot_ping import get_runtime from apscheduler.schedulers.backg...
Claudiu/DotFiles
dotfile.py
<reponame>Claudiu/DotFiles import shutil import os import argparse HERE = os.path.dirname(os.path.abspath(__file__)); HOME = os.path.expanduser("~") files = [".zshrc", ".vimrc", ".tmux.conf"] def installFile(fileName): shutil.copyfile(HERE + "/" + fileName, HOME + "/" + fileName) print "Copying " + fileName + " t...
zphang/saliency_investigation
casme/ext/dfnet.py
import torch from torch import nn import torch.nn.functional as F def resize_like(x, target, mode='bilinear'): return F.interpolate(x, target.shape[-2:], mode=mode, align_corners=False) def get_norm(name, out_channels): if name == 'batch': norm = nn.BatchNorm2d(out_channels) elif name == 'instan...
zphang/saliency_investigation
casme/tasks/imagenet/utils.py
import numpy as np import torch import torchvision.transforms as transforms from casme.utils.torch_utils import ImagePathDataset NORMALIZATION_MEAN = np.array([0.485, 0.456, 0.406]) NORMALIZATION_STD = np.array([0.229, 0.224, 0.225]) NORMALIZATION = transforms.Normalize( mean=NORMALIZATION_MEAN, std=NORMALIZ...
zphang/saliency_investigation
casme/tasks/imagenet/sanity_checks_drt.py
import tqdm import pandas as pd import torch import torchvision.transforms as transforms import casme.tasks.imagenet.utils as imagenet_utils from casme.utils.torch_utils import ImagePathDataset from casme.model_basics import casme_load_model import zconf from casme.tasks.imagenet.sanity_checks import get_scores, add...
zphang/saliency_investigation
casme/casme_utils.py
import cv2 import numpy as np import torch import torchvision.transforms as transforms from casme.model_basics import binarize_mask, get_mask, get_saliency_point def get_binarized_mask(input, model, use_p=None, class_ids=None): mask = get_mask(input, model, use_p=use_p, class_ids=class_ids) return binarize_...
zphang/saliency_investigation
casme/log_container.py
<filename>casme/log_container.py from casme import stats class LogContainers: def __init__(self): self.batch_time = stats.TimeMeter() self.data_time = stats.TimeMeter() self.losses = stats.AverageMeter() self.acc = stats.AverageMeter() self.losses_m = stats.AverageMeter() ...
zphang/saliency_investigation
casme/tasks/imagenet/preproc.py
from torchvision.datasets.folder import has_file_allowed_extension import glob import numpy as np import pyutils.io as io import os import casme.tasks.imagenet.export_bboxes as export_bboxes import tqdm import zconf IMG_EXTENSIONS = ('.jpg', '.jpeg', '.png', '.ppm', '.bmp', '.pgm', '.tif', '.tiff', '.webp') @zconf.r...
zphang/saliency_investigation
casme/core.py
import copy import random import tqdm import torch from casme import criterion from casme.casme_utils import per_image_normalization from casme.train_utils import accuracy from casme.stats import mask_to_stats import zproto.zlogv1 as zlog def ignore_superclass_signature(f): return f class LogData: def __...
zphang/saliency_investigation
casme/train_utils.py
import os import torch import pyutils.io as io def accuracy(output, target, topk=(1,)): with torch.no_grad(): maxk = max(topk) batch_size = target.size(0) _, pred = output.topk(maxk, 1, True, True) pred = pred.t() correct = pred.eq(target.view(1, -1).expand_as(pred)) ...
zphang/saliency_investigation
casme/tasks/imagenet/score_bboxes.py
<reponame>zphang/saliency_investigation<gh_stars>1-10 import cv2 import numpy as np import os import pandas as pd import time import torch import torch.nn as nn import torchvision.transforms as transforms from casme.stats import AverageMeter, StatisticsContainer from casme.model_basics import casme_load_model, get_ma...
zphang/saliency_investigation
casme/archs.py
import math import os import types import torch import torch.nn as nn import torch.utils.model_zoo as model_zoo import torch.nn.functional as F from casme.ext.pytorch_inpainting_with_partial_conv import PConvUNet, PCBActiv from casme.ext.torchray import imsmooth import casme.criterion as criterion import casme.tasks....
zphang/saliency_investigation
casme/utils/results_utils.py
import glob def get_all_models(base_path): return sorted(glob.glob("{}/*.chk".format(base_path))) def find_best_model(base_path): path_ls = get_all_models(base_path) if len(path_ls) == 1: path = path_ls[0] else: path = sorted(path_ls, key=lambda p: -int(p.split("_")[-1].split(".")[0]...
zphang/saliency_investigation
casme/tasks/imagenet/export_bboxes.py
import argparse import glob import json import os import tqdm from bs4 import BeautifulSoup def get_ground_truth_boxes(anno, category): boxes = [] objs = anno.findAll('object') for obj in objs: obj_names = obj.findChildren('name') for name_tag in obj_names: # None of the exampl...
zphang/saliency_investigation
casme/ext/torchray.py
import math import torch import torch.nn.functional as F EPSILON_DOUBLE = torch.tensor(2.220446049250313e-16, dtype=torch.float64) EPSILON_SINGLE = torch.tensor(1.19209290E-07, dtype=torch.float32) SQRT_TWO_DOUBLE = torch.tensor(math.sqrt(2), dtype=torch.float32) SQRT_TWO_SINGLE = SQRT_TWO_DOUBLE.to(torch.float32) ...
zphang/saliency_investigation
casme/ext/pconv_keras.py
from random import randint import numpy as np import cv2 # From https://github.com/MathiasGruber/PConv-Keras/blob/master/libs/util.py def random_mask(height, width, channels=3, min_multiplier=1, max_multiplier=1, number=20): """Generates a random irregular mask with lines, circles and elipses""" ...
zphang/saliency_investigation
casme/tasks/imagenet/wsoleval.py
<gh_stars>1-10 import os import numpy as np import zconf import pyutils.io as io from scipy.stats import rankdata from scipy.stats import multivariate_normal from tqdm import auto as tqdm_lib import torch import torch.nn as nn import torchvision.transforms as transforms import casme.model_basics import casme.tasks.im...
zphang/saliency_investigation
casme/utils/torch_utils.py
from torchvision.datasets.vision import VisionDataset from torchvision.datasets.folder import default_loader, IMG_EXTENSIONS import pyutils.io as io class ImagePathDataset(VisionDataset): def __init__(self, config, transform=None, target_transform=None, loader=default_loader, return_paths=False)...
zphang/saliency_investigation
casme/tasks/imagenet/sanity_checks.py
<gh_stars>1-10 import copy import math import os import tqdm import numpy as np import scipy.stats import pandas as pd import skimage.feature from skimage.measure import compare_ssim as ssim import matplotlib.pyplot as plt import torch import torch.optim import torch.utils.data import torchvision.transforms as transf...
zphang/saliency_investigation
casme/stats.py
<reponame>zphang/saliency_investigation import numpy as np import time import torch class AverageMeter: def __init__(self): self.val = None self.avg = None self.sum = None self.count = None self.reset() def reset(self): self.val = 0 self.avg = 0 ...
zphang/saliency_investigation
train_casme.py
import time import tqdm import torch.nn as nn import torch.backends.cudnn as cudnn import torch.optim import torch.utils.data from casme import core, archs, criterion from casme.train_utils import single_adjust_learning_rate, save_checkpoint, set_args from casme.tasks.imagenet.utils import get_data_loaders import zc...
zphang/saliency_investigation
casme/model_basics.py
import numpy as np import scipy.ndimage from scipy.ndimage.morphology import binary_dilation, binary_erosion import torch from casme import archs from casme.criterion import MaskFunc, default_infill_func from dataclasses import dataclass from typing import Union device = torch.device("cuda:0" if torch.cuda.is_availa...
zphang/saliency_investigation
casme/criterion.py
<reponame>zphang/saliency_investigation<gh_stars>1-10 import json import torch import torch.nn as nn import torch.nn.functional as F from pyutils.datastructures import combine_dicts class MaskFunc: MASK_IN = "MASK_IN" MASK_OUT = "MASK_OUT" MODES = [MASK_IN, MASK_OUT] def __init__(self, mask_mode)...
oasys/netbox-cisco-support
netbox_cisco_support/management/commands/sync_eox_data.py
import requests import json import django.utils.text from django.conf import settings from django.core.management.base import BaseCommand, CommandError from datetime import datetime from requests import api from dcim.models import Manufacturer from dcim.models import Device, DeviceType from netbox_cisco_support.models...
sivakumar-mahalingam/HDFS-S3
Download/s3_download.py
<reponame>sivakumar-mahalingam/HDFS-S3 import boto3 import os import subprocess import configparser import pymailer import tarfile from hdfs.ext.kerberos import KerberosClient from logger_setting import * from datetime import datetime, date, timedelta py_logger=logging.getLogger('py_logger') try: #Your certificat...
sivakumar-mahalingam/HDFS-S3
Download/logger_setting.py
<reponame>sivakumar-mahalingam/HDFS-S3<filename>Download/logger_setting.py import sys import logging from logging.config import dictConfig from datetime import datetime import configparser config_path = '/edgenode/s3/download/s3_config.conf' configuration_file = configparser.ConfigParser() config = configuration_file....
sivakumar-mahalingam/HDFS-S3
Download/pymailer.py
<reponame>sivakumar-mahalingam/HDFS-S3 import smtplib from email.mime.text import MIMEText from email.mime.multipart import MIMEMultipart import configparser from logger_setting import * def send_mail(ex_msg): py_logger = logging.getLogger('py_logger') try: config_path = '/edgenode/s3/download/s3_conf...
smallfount/scriptsonly
switchdb/bkup_files/test2.py
<filename>switchdb/bkup_files/test2.py from flask import Flask, request, render_template, redirect, url_for, flash, session, make_response from flask.ext.bootstrap import Bootstrap from flask_sqlalchemy import SQLAlchemy from models import db, Switches from settings import APP_STATIC import os from flask import Flask, ...
smallfount/scriptsonly
HPE IMC Real Time Locate Flask Sample App/realtimelocatesessions.py
''' Copyright 2016 Hewlett Packard Enterprise Development LP. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by appl...
smallfount/scriptsonly
dcn_scripts/dcn_scripting/deployEnterprise.py
#!/usr/bin/env python ''' Copyright 2016 wookieware. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable la...
smallfount/scriptsonly
dcn_scripts/dcn_scripting/2.py
#!/usr/bin/env python ''' Copyright 2016 wookieware. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable la...
smallfount/scriptsonly
bsn_scripts/bsn_scripting/2.py
<reponame>smallfount/scriptsonly #!/usr/bin/env python ''' Copyright 2016 wookieware. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 ...
smallfount/scriptsonly
ArubaOS-Sw_API_Scripts/python_and_rest_api_vid_scripts/get_status_f.py
import requests import os list_of_tin = ['192.168.1.29', '192.168.1.218', '192.168.1.219'] print('Home Lab Status:') def g_status(tin_list): wrong_code = [] for ip in tin_list: url = 'http://' + ip + '/rest/v1/system/status' get_status_response = requests.get(url, timeout=2) g_status...
smallfount/scriptsonly
ArubaOS-Sw_API_Scripts/pyarubaos-sw_api/video4_func_examples/adder.py
<reponame>smallfount/scriptsonly def sum(a, b): print("\n", a, "plus", b, "is", a + b) sum(5, 10) sum(7, 8) sum(40, 2)
smallfount/scriptsonly
Clearpass Generic/Meridian-ClearPass-Agenda/cgi-bin/print_header.py
<reponame>smallfount/scriptsonly #!/usr/bin/env python3 ''' Copyright 2016 Hewlett Packard Enterprise Development LP. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apa...
smallfount/scriptsonly
ArubaOS-Sw_API_Scripts/pyarubaos-sw_api/video3_yaml_example/multi_anycli_yaml.py
<reponame>smallfount/scriptsonly """A script to demonstrate using the anycli feature on multiple devices. This example utilises import of data from a local YAML file. This script is aimed at those with little python experience, the lack of functions is intentional. Example YAML file for import: multi_anycli_yaml.yaml "...
smallfount/scriptsonly
switchdb/bkup_files/switchdb.py
#!/usr/bin/env python ''' Copyright 2016 Hewlett Packard Enterprise Development LP. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 U...
smallfount/scriptsonly
Clearpass Generic/UpdateDBwithYammer/UpdateDBwithYammer_V0_2.py
#!/usr/bin/env python3.4 import cgi import cgitb; cgitb.enable() # Optional; for debugging only import re import json #import sys,getopt #from sys import argv import requests import mysql.connector as mariadb # DEBUG flag. Change to 1 to display debug info global DEBUG DEBUG = 0 # Function to search email in Yammer...
smallfount/scriptsonly
ArubaOS-Sw_API_Scripts/pyarubaos-sw_api/video4_func_examples/serial.py
import requests import json url = 'http://192.168.2.1/rest/v3/' creds = {'userName': 'admin', 'password': '<PASSWORD>'} s = requests.Session() r = s.post(url + 'login-sessions', data=json.dumps(creds), timeout=1) cookie_response = r.json()['cookie'] if r.status_code != 201: print('Login error, status ...
smallfount/scriptsonly
bsn_scripts/views2.py
<filename>bsn_scripts/views2.py dom = request.form.get('domain') fromzone = request.form.get('fromzone') tozone = request.form.get('tozone') direction = request.form.get('direction') action = request.form.get('action') descr...
smallfount/scriptsonly
ArubaOS-Sw_API_Scripts/python_and_rest_api_vid_scripts/get_cookie_create_vlan.py
<filename>ArubaOS-Sw_API_Scripts/python_and_rest_api_vid_scripts/get_cookie_create_vlan.py import requests vlan_number = input('Enter VLAN number:') vlan_name = input('Enter VLAN name:') url_login = "http://192.168.1.29/rest/v1/login-sessions" url_vlans = "http://192.168.1.29/rest/v1/vlans" payload_login = "{\"userN...
smallfount/scriptsonly
bsn_scripts/showswitch.py
<reponame>smallfount/scriptsonly<filename>bsn_scripts/showswitch.py<gh_stars>10-100 #!/usr/bin/env python ''' Copyright 2016 wookieware. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at ...
smallfount/scriptsonly
switchdb/models.py
<reponame>smallfount/scriptsonly ''' Copyright 2016 wookieware. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by a...
smallfount/scriptsonly
ArubaOS-Sw_API_Scripts/pyarubaos-sw_api/video4_func_examples/serial-func.py
import requests import json def login(): r = requests.post(url + 'login-sessions', data=json.dumps(creds), timeout=1) cookie = {'cookie': r.json()['cookie']} if r.status_code != 201: print('Login error, status code {}'.format(r.status_code)) return cookie def get_serial(c): ...
smallfount/scriptsonly
switchdb/views.bkup.py
#!/usr/bin/env python ''' Copyright 2016 wookieware. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable la...
smallfount/scriptsonly
ArubaOS-Sw_API_Scripts/pyarubaos-sw_api/video3_yaml_example/anycli_yaml.py
<filename>ArubaOS-Sw_API_Scripts/pyarubaos-sw_api/video3_yaml_example/anycli_yaml.py """A script to demonstrate using the anycli feature in ArubaOS-Switch 16.04. This example utilises import of data from a local YAML file This script is aimed at those with little python experience, the lack of functions is intentional....
smallfount/scriptsonly
bsn_scripts/bsn_scripting/x4.py
<filename>bsn_scripts/bsn_scripting/x4.py #!/usr/bin/env python ''' Copyright 2016 wookieware. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENS...
smallfount/scriptsonly
dcn_scripts/dcn_scripting/testjob.py
<reponame>smallfount/scriptsonly #!/usr/bin/env python ''' Copyright 2016 wookieware. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 ...
smallfount/scriptsonly
dcn_scripts/dcn_scripting/list-all.py
#!/usr/bin/env python ''' Copyright 2016 wookieware. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable la...