text
stringlengths
957
885k
#!/usr/bin/python import serial, time modes=['DC V','AC V','DC uA','DC mA','DC A', 'AC uA','AC mA','AC A','OHM','CAP', 'Hz','Net Hz','Amp Hz','Duty','Net Duty', 'Amp Duty','Width','Net Width','Amp Width','Diode', 'Continuity','hFE','Logic','dBm','EF','Temperature'] segs={ 0x00: ' ', ...
import numpy as np def get_boxsize(num_corners, num_pixel=63): factors = np.array([0.3, 0.22, 0.16]) size = int(num_pixel * factors[num_corners - 2]) return size def select_box(rms, sensitivity=1e-6): for arr in rms: arr[arr > sensitivity] = 0 rms_boxes = rms.astype(bool).sum(axis=0) ...
#!/usr/bin/env python # coding: utf-8 import cv2 import numpy as np import matplotlib.pyplot as plt import glob import re def cameraCalibrate(img_names, board_shape, visualize=False, visualize_shape=(4, 4)): # generate object points and calibrate camera bw, bh = board_shape x = np.arange(bw) y =...
<gh_stars>1-10 import boto3 from botocore.exceptions import ClientError import json import os import datetime from email.mime.application import MIMEApplication from email.mime.multipart import MIMEMultipart from email.mime.text import MIMEText import logging logger = logging.getLogger() if os.environ['DEBUG'] == "Tr...
import pytest from django.urls import reverse from garden.formatters import WateringStationFormatter from garden.utils import build_duration_string from selenium.common.exceptions import InvalidElementStateException from tests.assertions import assert_image_files_equal from .base import Base, wait_for from .pages.gard...
# from modules import ilmodule import time import uuid import json import os import psycopg2 import psycopg2.extras from psycopg2 import pool import globals # # Module for saving data to database # class Database(ilmodule.ILModule): def __init__(self): super().__init__() minConnection = 1 ...
# -*- coding: UTF-8 -*- def transfer_image_coordinate_to_display(pt, image_size, display_size, display_orientation): """ 功能:图像坐标系到屏幕坐标系转换,屏幕坐标系的原点会随着屏幕旋转而变化 输入:目标点的图像坐标,(图像宽,图像高),(视图宽,视图高),视图方向(0,1,2,3) 输出:目标点的屏幕坐标 """ percent_x = 1.0 * pt[0] / image_size[0] percent_y = 1.0 * pt[1] / image...
import copy import logging import typing from typing import Optional, List from hearthstone.events import CombatPhaseContext, EVENTS from hearthstone.cards import CardEvent if typing.TYPE_CHECKING: from hearthstone.player import Player from hearthstone.randomizer import Randomizer from hearthstone.cards imp...
#!/usr/bin/env python3 # # Plan 1: Automated ship model download and processing # 1) Download Fleet VieweR Star Citizen Ships 3D Models - Data as csv # 2) For each "Download Model Path Remote" # 2.1) Download .ctm file # 2.2) Read MeshLab settings and determine which "original_to_LOD0.mlx" to use # 2.3) meshl...
<filename>ham_tools/cli/rig_meters.py """ Display meters from rigctl Assumes rigctld is listening on localhost """ import os import shutil import socket import sys import time from dataclasses import dataclass from colorama import Cursor, Fore, Style from colorama.ansi import clear_screen as ansi_clear_screen RIGCT...
'''build vocab from tokenized corpors''' import numpy as np from collections import defaultdict from .. import LOGGER class VocabBuilder: """ TODO: - save the vocab given the output vocab filename - prun the vacab if does not fit max_vocab_size """ def __init__(self, min_freq, subsam...
<filename>eda.py """Exploratory Data Analysis on WSDM Dataset with visualization. Author: DHSong Last Modified At: 2020.07.05 Exploratory Data Analysis on WSDM Dataset with visualization. """ import os import pandas as pd import matplotlib.font_manager as fm import matplotlib.pyplot as plt import seaborn as sns cla...
# # Copyright 2019 Altran. All rights reserved. # # 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 ...
<reponame>Phionx/quantumnetworks """ Unittests Run using: python -m unittest tests/test_multimode.py """ import os import sys import unittest sys.path.insert(0, ".." + os.sep) from quantumnetworks import SingleModeSystem, DoubleModeSystem, MultiModeSystem from scipy.integrate import odeint import numpy as np clas...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Fri Jan 24 13:24:43 2020 @author: ssli Module to calculate the m bias mcFitFunc: Shear bias function. WgQuantile1DFunc: Calculate the weighted quantile by given probabilities designed for 1D numpy array. WgBin2DFunc: Calculate the ...
######################################################################################### # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. # # SPDX-License-Identifier: MIT-0 # # ...
<reponame>helix84/activae # -*- coding: utf-8 -*- # Copyright (C) 2010 CENATIC: Centro Nacional de Referencia de # Aplicacion de las TIC basadas en Fuentes Abiertas, Spain. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are m...
#!/usr/bin/env python # -*- coding: utf-8 -*- # @Time : 2019-06-06 14:36 # @Author : Vassago # @File : common.py # @Software: PyCharm import json import logging from unittest import TestCase from app.config import base_config from app.app_runner import create_app as _create_app LOG = logging.getLogger(__name_...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Author: <NAME> Email: <EMAIL> ROC curve and AUC for Neurochaos Learning, SVM and Random Forest """ import os import numpy as np from sklearn.metrics import confusion_matrix, ConfusionMatrixDisplay import matplotlib.pyplot as plt from pretty_confusion_matrix import pp_...
<reponame>t-sagara/jageocoder from functools import lru_cache import logging import re from typing import List, Optional, Union from sqlalchemy import Column, ForeignKey, Integer, Float, String, Text from sqlalchemy import or_ from sqlalchemy.orm import deferred from sqlalchemy.orm import backref, relationship from j...
import json import network import webrepl from machine import Pin import machine import time class WIFI_UTIL: def __init__(self, AP_FLAG=27, SIGNAL=33, LED=13, silent=True): self.AP_flag = Pin(AP_FLAG, Pin.IN) time.sleep(2) self.button = None self.butpin = AP_FLAG self.ap =...
<reponame>yooceii/HardRLWithYoutube import tensorflow as tf import argparse from level_selector import * from model import Model from runner import Runner from env import * from baselines.a2c.utils import make_path from baselines.a2c.policies import CnnPolicy from baselines.common import set_global_seeds from baseli...
<filename>SlicerPlayground/playground_utils.py """ Utility fuctions for Slicer Playground. These functions are copies from notebooks where they were created to enable reuse. """ import numpy as np import vtk import slicer from emoji import UNICODE_EMOJI def create_np_text_img(text: str, size: tuple = (128, 128), ...
<reponame>mborgerson/textureatlas<filename>textureatlas.py #!/usr/bin/env python # # Copyright (c) 2014 <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...
############################################################################# ## ## Copyright (C) 2013 Riverbank Computing Limited. ## Copyright (C) 2016 The Qt Company Ltd. ## Contact: http://www.qt.io/licensing/ ## ## This file is part of the Qt for Python examples of the Qt Toolkit. ## ## $QT_BEGIN_LICENSE:BSD$ ## ...
<reponame>avchally/solitaire-python<filename>data/seed_processor.py<gh_stars>1-10 """ generates a deck of cards based on a given seed can also generate a seed with a given deck of cards """ import random from .deck_of_cards import Card, Deck chars = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ' SUITS = "HSDC"...
<filename>volumes-md.py #-*- coding: utf-8 -*- # volumes.lu # md file for each publisher and each book, kirby flavoured # config csv_filepath = 'csv/volumes-le-havre-dominant.csv' # imports import os import csv import sys from shutil import copyfile # hifi slugification sys.path.insert(0, 'libs') from slughifi impo...
__all__ = [ 'exclude_items', 'include_items', ] import functools import re from itertools import filterfalse from .utils import ( get_field, get_item_tags, normalize_value, ) def _match_field( field_value, pattern, *, ignore_case=False, normalize_values=False ): """Match an item metadata field value by ...
# pke1029 # July 2018 # google drive api library from __future__ import print_function from apiclient.discovery import build from httplib2 import Http from oauth2client import file, client, tools from apiclient.http import MediaFileUpload # camera and other library from picamera import PiCamera from picamera.array im...
<reponame>SimonKagstrom/spelly<gh_stars>0 import pyttsx3 import random import blessed import time def changeVoice(engine, language, gender='VoiceGenderFemale'): for voice in engine.getProperty('voices'): if language in voice.languages and gender == voice.gender: engine.setProperty('voice', voic...
from django.test import TestCase from data_facility_admin.models import * from data_facility_admin.helpers import LDAPHelper import mock from mockldap import MockLdap from django.conf import settings import ldap from django.utils import timezone import datetime class BaseLdapTestCase(TestCase): USER_LDAP_ID = Lda...
# -*- coding: utf-8 -*- """ Created on Thu May 27 21:13:08 2021 @author: <NAME> """ import pandas as pd import plotly.io as pio from pyvis.network import Network pio.renderers.default = 'browser' class NetworkPlot: def __init__(self, evolution_iteration): """ This class takes a whole evoluition ...
<reponame>AngleMAXIN/nomooc<gh_stars>1-10 import os import re import time from wsgiref.util import FileWrapper import xlrd import xlsxwriter from django.conf import settings from django.contrib.auth.hashers import make_password from django.db import transaction, IntegrityError from django.db.models import Q, Count, F ...
# -*- coding: utf-8 -*- # This Python file uses the following encoding: utf-8 """ Calculate SVM feature vector for various choises Normally the selected routine is called as 'SVMfeatures' """ from matchUtils import * from matchtext import matchtext def personDefault(workP=None, matchP=None, conf=None, score=None, node...
<reponame>ShubhamDiwan/elm<gh_stars>10-100 #!/usr/bin/env python # -*- coding: utf-8 -*- """ test_regression ---------------------------------- Datasets used were from sklearn.datasets import numpy as np from sklearn.datasets import load_boston, load_diabetes data = load_boston() data = ...
<gh_stars>1-10 # Python code to convert T-Stick serial port messages to OSC # Author: <NAME> (IDMIL, 2019) import sys import serial import collections import struct from apscheduler.schedulers.background import BackgroundScheduler from bitstring import BitArray import argparse # parse argument to set OSC to send/re...
<reponame>zhanghaohit/incubator-tvm # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version ...
<filename>WHI_2012_mass_concs_SP2_filter_GC.py<gh_stars>1-10 import matplotlib.pyplot as plt import matplotlib.gridspec as gridspec import numpy as np from matplotlib import dates import os import pickle from datetime import datetime from pprint import pprint import sys from datetime import timedelta import calendar im...
<filename>main.py import time from tqdm import tqdm import torch import torch.nn as nn import torch.optim as optim import torchvision import torchvision.transforms as transforms from resnet import ResNet50Base, ResNet50OneGPU, ResNet50TwoGPUs, ResNet50SixGPUs # from utils import progress_bar import copy if __name_...
import pandas import numpy import pickle import sklearn from sklearn import tree from sklearn import preprocessing from sklearn.model_selection import train_test_split from sklearn.preprocessing import LabelEncoder from sklearn.linear_model import LinearRegression from sklearn.linear_model import LogisticRegression...
<reponame>gurnitha/2022-django4-marketplace-jfu<filename>app/marketplace/models.py # app/marketplace/models.py # Django modules from django.db import models # Locals from app.accounts.models import Users # Create your models here. # NAMA MODEL/TABEL: Categories class Categories(models.Model): name_category = mo...
<reponame>germank/CommAI-env<gh_stars>0 # Copyright (c) Facebook, Inc. and its affiliates. # All rights reserved. # # This source code is licensed under the license found in the # LICENSE file in the root directory of this source tree. from pool_metrics import PoolMetrics from json_reporter import JSONReporter from co...
<gh_stars>0 """ Django settings for api project. Generated by 'django-admin startproject' using Django 2.1.7. For more information on this file, see https://docs.djangoproject.com/en/2.1/topics/settings/ For the full list of settings and their values, see https://docs.djangoproject.com/en/2.1/ref/settings/ """ from ...
<filename>expertise/models/multifacet_recommender/specter.py from allennlp.commands.predict import _PredictManager from allennlp.common import Params from allennlp.common.checks import ConfigurationError from allennlp.common.util import lazy_groups_of, import_submodules from allennlp.data import DatasetReader from alle...
# ------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for # license information. # -------------------------------------------------------------------------- import log...
<reponame>LairdCP/weblcm-python from typing import List, Optional import cherrypy import dbus import dbus.exceptions import dbus.mainloop.glib import dbus.service import weblcm_bluetooth_plugin import weblcm_def from weblcm_ble import ( find_controller, find_controllers, controller_pretty_name, find_device, find_...
<gh_stars>1-10 # -*- coding: utf-8 -*- # This file was generated import array # noqa: F401 import ctypes import datetime # noqa: F401 # Used by @ivi_synchronized from functools import wraps import niswitch._attributes as _attributes import niswitch._converters as _converters import niswitch._library_singleton as _li...
#!/usr/bin/env python # -*- Mode: Python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 4 -*- # vi: set ts=4 sw=4 expandtab: # This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.or...
<reponame>rdh1115/cog # Copyright 2018 Google LLC # # 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 # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or ...
<filename>scripts/generate.py #!/usr/bin/env python3 import os import re import json from datetime import datetime from collections import defaultdict import click import numpy as np import tensorflow as tf from src import model, sample, encoder SENTENCE_PATTERN = re.compile(r'[^.!?]+(?:[.!?]|$)') def split_sente...
<gh_stars>10-100 from datetime import datetime, date import pytz from django.urls import reverse from rest_framework import status from rest_framework.test import APITestCase from robber import expect from activity_grid.factories import ActivityCardFactory, ActivityPairCardFactory from activity_grid.models import Act...
import tensorflow as tf import numpy as np import time from models import (Autoencoder, Discriminator_x) from models_mvtec import Autoencoder as Autoencoder_MVTEC from models_mvtec import Discriminator_x as Discriminator_x_MVTEC from utils.plotting import (generate_and_save_images, ...
# # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not us...
<reponame>adamchainz/vanilla import json import gc import pytest import vanilla import vanilla.http # TODO: remove import logging logging.basicConfig() class TestHTTP(object): def test_get_body(self): h = vanilla.Hub() serve = h.http.listen() @h.spawn def _(): co...
<filename>examples/Tester_platoon.py #!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Fri Dec 4 19:01:24 2020 @author: <NAME> """ # tester platoon from asynch_rl.rl.rl_env import Multiprocess_RL_Environment from asynch_rl.rl.utilities import clear_pycache, load_train_params import sys import psuti...
import pickle from inspect import getsourcelines, getfile import numpy as np import statsmodels.api as sm from matplotlib import pyplot as plt from modelinter.models.constants import Paths def returns(a_0, a_1): """linear returns formula""" return (a_1 - a_0) / a_0 def inverse_returns(C, r): "invert t...
import os import torch import numpy as np import scipy.misc as m import re import glob from torch.utils import data class CELEBA(data.Dataset): def __init__(self, root, split="train", is_transform=False, img_size=(32, 32), augmentations=None): """__init__ :param root: :param split: ...
import pickle # remove after getting final version of code import os import numpy as np from keras.utils import np_utils from keras.layers import ( Input, Conv2D, Conv3D, Flatten, Dense, Dropout, Reshape, BatchNormalization, Concatenate ) from keras.models import Model, load_model ...
#THIS PROGRAM IS FOR SHOWING HOW BRUTE FORCE IS USED ON WEBSITES.I HAVE GIVEN EXAMPLE OF WEBSITE OF RESULTS. DO NOT MISUSE OF THIS PROGRAM USE IT FOR READING PURPOSE. I AM NOT RESPONSIBLE FOR MISUSE AND ANY DAMAGE CAUSED BY THIS PROGRAM! #THIS PROGRAM WORKS AS EXPECTED AND CAUSE DAMAGE TO SERVER. USE IT FOR READING PU...
<reponame>sohailhabib/SecurityMetrics from pathlib import Path import numpy as np import pandas as pd import os # from metrics.confusion_matrix import ConfusionMatrix # from metrics.roc_curve import RocCurve import matplotlib.pyplot as plt from joblib import dump, load import seaborn as sns import glob root_path = Pat...
<filename>pywc_modules/utils.py def stripNonAlphaNum(text): """ Delete non alphanumerical character into a string text and return a list """ import re return re.compile(r"\W+", re.UNICODE).split(text) def readfile(filepath): """ Read a text file and return the content as string """ import os, sys...
from Module import AbstractModule class Module(AbstractModule): def __init__(self): AbstractModule.__init__(self) def run( self, network, antecedents, out_attributes, user_options, num_cores, outfile): """given a database ID and GPLID, get the files""" from Betsy import...
# encoding: utf-8 import json import logging from urllib2 import urlopen from urllib import urlencode from datetime import datetime from google.appengine.api import urlfetch from google.appengine.ext import ndb import webapp2 TOKEN = open('bot.token').read() BASE_URL = 'https://api.telegram.org/bot' + TOKEN + '/' B...
<filename>source/webServer/domains/support/config.py # # # # # config.py # # University of Illinois/NCSA Open Source License # Copyright (c) 2015 Information Trust Institute # All rights reserved. # # Developed by: # # Information Trust Institute # University of Illinois # http://www.iti.illinois.edu # # Permission is ...
<filename>lib/galaxy/webapps/tool_shed/api/groups.py import logging from galaxy import util from galaxy import web from galaxy.util import pretty_print_time_interval from galaxy.exceptions import RequestParameterMissingException from galaxy.exceptions import AdminRequiredException from galaxy.exceptions import ObjectNo...
<gh_stars>100-1000 from itertools import combinations import os,sys,copy import numpy as np import time import matplotlib.pyplot as plt from GetData import * from tqdm import tqdm class Tabu(): def __init__(self,disMatrix,max_iters=50,maxTabuSize=10): """parameters definition""" self.dis...
<reponame>flexbox-nicaragua/flexbox-code # Copyright 2016 The Flexbox Authors. All rights reserved. # Licensed under the open source MIT License, which is in the LICENSE file. from bs4 import BeautifulSoup import urllib2 import re from datetime import datetime, timedelta import pandas as pd from sqlalchemy import cast,...
import numpy as np import pandas as pd from scipy import stats, optimize import patsy import prettytable class Response(object): def __init__(self, y): self.y = y self.Kmin = np.apply_along_axis(max, 1, y) class Submodel(object): def __init__(self, name, code, formula, invlink, data): ...
# -*- coding: utf-8 -*- {{{ # vim: set fenc=utf-8 ft=python sw=4 ts=4 sts=4 et: # # Copyright 2017, Battelle Memorial Institute. # # 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...
#!/usr/local/bin/python3 python = 3 try: xrange python = 2 except: pass if python == 2: raise Exception("Use python3") import base64 import codecs import hashlib import os import re import subprocess UGLIFY = True #UGLIFY = False reScript = re.compile('<script(?:[^>]+)src="([^"]*)"(?:[^>]*)>((?:.|\...
<filename>IMU/VTK-6.2.0/Examples/Infovis/Python/boost_mst_with_hgv.py<gh_stars>1-10 #!/usr/bin/env python from vtk import * source = vtkRandomGraphSource() source.DirectedOff() source.SetNumberOfVertices(100) source.SetEdgeProbability(0.1) source.SetUseEdgeProbability(True) source.AllowParallelEdgesOn() sourc...
<gh_stars>0 from dagster import check from dagster.core.errors import DagsterInvalidDefinitionError, DagsterInvariantViolationError from .pipeline import PipelineDefinition class RepositoryDefinition(object): '''Define a repository that contains a collection of pipelines. Args: name (str): The name ...
from sklearn.metrics import accuracy_score, average_precision_score, coverage_error, label_ranking_average_precision_score, pairwise, roc_curve, auc, roc_auc_score, average_precision_score,precision_recall_curve, precision_score, recall_score, f1_score, precision_recall_fscore_support, confusion_matrix, classification_...
from pathlib import Path import logging import requests import json import time import os import src.config as config logging.basicConfig(level=logging.INFO) class DnDBeyondProxy: def __init__(self, cobalt_key, output_folder=None): self._last_auth = None self._token = None self._token_deat...
<reponame>CITlabRostock/citlab-article-separation-new # -*- coding: utf-8 -*- import jpype import numpy as np import os from argparse import ArgumentParser from python_util.basic.flags import str2bool from python_util.parser.xml.page.page import Page from python_util.math.measure import f_measure from article_separat...
<filename>fast_stylize.py import functools import os from matplotlib import gridspec import matplotlib.pylab as plt import numpy as np import tensorflow as tf import tensorflow_hub as hub print("TF Version: ", tf.__version__) print("TF-Hub version: ", hub.__version__) print("Eager mode enabled: ", tf.execu...
import sys sys.path.insert(0, './../') import unittest import transforms3d import numpy as np import numpy.random as rnd import tensorflow as tf import math as m import tf_transforms3d.euler as ELR class TestEuler(unittest.TestCase): def test_euler2quat(self): batchsize = 1024 euler = (rnd.random(...
<reponame>NewRGB/lino #!/usr/bin/env python # -*- coding: utf-8 -*- # # Generated Mon Oct 03 15:32:11 2011 by generateDS.py version 2.6a. # import sys import getopt import re as re_ etree_ = None Verbose_import_ = False (XMLParser_import_none, XMLParser_import_lxml, XMLParser_import_elementtree ) = range(3) XML...
#%% import numpy as np from numpy import pi import pandas as pd import matplotlib.pyplot as plt import os root_path = os.path.dirname(os.path.abspath('__file__')) import sys sys.path.append(root_path+'/config/') from variables import train_len, dev_len,test_len from ssa import SSA station = 'Huaxian' # 'Huaxian', ...
<gh_stars>1-10 # //======================================================================= # // Copyright JobPort, IIIT Delhi 2015. # // Distributed under the MIT License. # // (See accompanying file LICENSE or copy at # // http://opensource.org/licenses/MIT) # //=======================================================...
<reponame>augustand/Jmonitor # -*- coding:utf-8 -*- import json from pony.orm import db_session, delete, select from pony.orm.serialization import to_dict from project.db.model import Template, Project class ProjectHandle(object): def add_projects(self, projects): with db_session: projects...
<reponame>Jona-Gold/PokerRL # Copyright (c) 2019 <NAME> from PokerRL.rl import rl_util from PokerRL.rl.MaybeRay import MaybeRay from PokerRL.util.file_util import do_pickle, load_pickle class EvalAgentBase: """ This baseclass should be subclassed by each agent/algorithm type. It is used to wrap the agent wi...
"""dscriptmodule helper functions""" from __future__ import annotations from typing import Final import logging import asyncio from homeassistant.core import HomeAssistant from homeassistant.config_entries import ConfigEntry from homeassistant.helpers.entity_platform import AddEntitiesCallback from .const import ( ...
<reponame>wpilibsuite/INNDiE-cli import json import tempfile import click import boto3 import os.path all_perm = { "FromPort": -1, "IpProtocol": "-1", "IpRanges": [{"CidrIp": "0.0.0.0/0"}], "Ipv6Ranges": [{"CidrIpv6": "::/0"}], "ToPort": -1 } all_http_perm = { "FromPort": 80, "IpProtocol"...
<gh_stars>0 #!/usr/bin/env python """ Discretizes a continuous variable """ from loguru import logger from mcot.core import scripts import numpy as np import colorcet as cc from mcot.core.cifti import combine def run_array(arr, nbins, bins=None, weight=None, include_zeros=False): """ Returns a discretised ver...
# Copyright (c) 2017-present, Facebook, Inc. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. An additional grant # of patent rights can be found in the PATENTS file in the same directory. from __future__ import a...
class Chars: """Unicode symbols that are useful in code and annoying to search for repeatedly.""" # punctuation nbsp = u'\u00A0' # non-breaking space zwidthspace = u'\u200B' # zero-width space thinspace = u'\u2009' hairspace = u'\u200A' emspace = u'\u2003' hyphen = '‐' # proper unicode hyphen nbhyphen = '‑...
<gh_stars>0 import logging from unittest import mock from django.contrib.auth.models import User from django.test import SimpleTestCase, TestCase from django.urls import reverse from freezegun import freeze_time from rest_framework.test import APIClient from api.service_checks import ServiceStatus from data...
import diffprivlib.mechanisms as privacyMechanisms from datetime import timedelta import datetime class AttributeAnonymizier: def __init__(self): self.__timestamp = "time:timestamp" self.__blacklist = self.__getBlacklistOfAttributes() self.__sensitivity = "sensitivity" self.__max =...
# encoding:utf-8 # date:2020-11-30 # author: x.l.eric # function: dp client import os import requests import base64 import cv2 import json import numpy as np import time import traceback import random from pupdb.core import PupDB # 数据库 from dp_utils import * def create_task_id(): d_ = [] for i in range(6): ...
<gh_stars>0 ########################### # 6.00.2x Problem Set 1: Space Cows from ps1_partition import get_partitions import time #================================ # Part A: Transporting Space Cows #================================ def load_cows(filename): """ Read the contents of the given file. Assumes th...
# -*- coding: utf-8 -*- """Converter for FlyBase Genes.""" import logging from typing import Iterable, Mapping, Optional, Set import click import pandas as pd from more_click import verbose_option from tqdm import tqdm from pyobo import Reference from pyobo.struct import Obo, Term, from_species, orthologous from py...
<reponame>bbhunter/Ghostwriter # Standard Libraries import logging from datetime import date, datetime, timedelta # Django Imports from django.conf import settings from django.test import Client, TestCase from django.urls import reverse from django.utils import timezone from django.utils.encoding import force_str # G...
<filename>models/utils.py import torch import torch.nn as nn def roll_left(x, n=1): return torch.cat([x[:, n:], x[:, :n]], 1) def roll_right(x, n=1): return torch.cat([x[:, -n:], x[:, :-n]], 1) def shift_right(x, dim=1, n=1, fill="arithmetic"): size = x.size() pre_size, pos_size = size[:dim], size...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import binascii import os import json import time import unittest from ontology.ont_sdk import OntologySdk from ontology.utils.contract_data_parser import ContractDataParser from ontology.utils.contract_event_parser import ContractEventParser from ontology.wallet.wallet_m...
from abc import ABCMeta, abstractmethod from .adt_meta import BoundMeta from .bit_vector_abc import AbstractBitVectorMeta, AbstractBitVector, AbstractBit from .util import _issubclass from hwtypes.modifiers import unwrap_modifier, wrap_modifier, is_modified from .adt import Product, Sum, Tuple, Enum, TaggedUnion from ...
# Copyright (C) 2020. Huawei Technologies Co., Ltd. All rights reserved. # # 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 # to us...
<reponame>swrobel/fhir<filename>py/google/fhir/r4/resource_validation_test.py # # Copyright 2020 Google LLC # # 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/lice...
from enum import IntEnum, auto from typing import Tuple __all__ = [ 'NodeKind', 'NK_NONE', 'NK_BOOL_EXPR', 'NK_INT8_EXPR', 'NK_INT16_EXPR', 'NK_INT32_EXPR', 'NK_INT64_EXPR', 'NK_UINT8_EXPR', 'NK_UINT16_EXPR', 'NK_UINT32_EXPR', 'NK_UINT64_EXPR', 'NK_FLOAT16_EXPR', 'NK...
<reponame>cfosco/memento_keras<filename>src/captioning_utils.py import numpy as np import os import json import i3d_config as cfg from generator import load_vids_opencv, load_hmdb_npy_rgb import keras import keras.backend as K import io def prepare_caption_data(tokenized_captions_json_path, word_embeddings=None, ...