text stringlengths 1 927k |
|---|
#!/usr/bin/python3
"""
Created on Wed Mar 25 16:26:10 2020
@author: manfre-lorson
@work: ansteuern einer diode 10 mal blinken
"""
##########################################################################
##########################################################################
"""
def schaltplan():
'''
sh... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""Tests for `pytopocomplexity.entropy`"""
from __future__ import (absolute_import, division, print_function,
unicode_literals)
from future.builtins import (ascii, bytes, chr, dict, filter, hex, input, int,
map, next, o... |
# Generated by Django 2.0.8 on 2019-01-11 00:05
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("course_catalog", "0004_make_short_description_nullable_20190110_2018")
]
operations = [
migrations.AddField(
model_name="course"... |
import numpy as np
import itertools
from nptyping import NDArray
from typing import Iterator
from ..objective import Objective
def powerset(f: Objective) -> Iterator[NDArray[int]]:
"""
Inumerate b^n possible vectors in the integer lattice.
:param f: integer-lattice submodular function objective
"""
... |
#! /usr/bin/python
# -*- coding: utf-8 -*-
import time
import numpy as np
import tensorflow as tf
import tensorlayer as tl
from tensorlayer.layers import *
tf.logging.set_verbosity(tf.logging.DEBUG)
tl.logging.set_verbosity(tl.logging.DEBUG)
sess = tf.InteractiveSession()
X_train, y_train, X_test, y_test = tl.fil... |
import argparse
import json
import logging
import os
from censys_maltego import Censys
from maltego_trx.transform import DiscoverableTransform
log_file_path = os.path.dirname(os.path.realpath(__file__))
log_file_name = 'censys_maltego_transform.log'
logging.basicConfig(filename=os.path.join(log_file_path, log_file_n... |
#! /usr/bin/python2
#config
themes = {
'grey': ['#fff', '#c4c4c4'],
'green': ['#ffffdd', '#86a666'],
'blue': ['#dee3e6', '#8ca2ad'],
'brown': ['#f0d9b5', '#b58863']
}
blackPattern = 'body.{name} #GameBoard td.blackSquare, body.{name} #GameBoard td.highlightBlackSquare, body.{name} div.lcs.black, #top div.lcs.... |
#!/usr/bin/python3
#coding=utf-8
#author: cody
def create_reader(byte_arr, offset):
f = offset
b_arr = byte_arr
def read(count):
nonlocal f
nonlocal b_arr
b = b_arr[f:f + count]
f = f + count
return b
return read
def bytes_to_int(b):
return int.from_bytes(b,... |
#
# Copyright 2013 Quantopian, Inc.
#
# 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 law or agreed to in wr... |
from torchvision import datasets, transforms
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.utils.data import DataLoader
from argparse import ArgumentParser
from tqdm import tqdm
import time
import numpy as np
###########
# file imports / path issues
import os
import sys
from pathlib i... |
# Generated by Django 2.1.15 on 2020-09-11 20:40
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('coursedashboards', '0013_auto_20190108_2238'),
]
operations = [
migrations.CreateModel(
name='CourseGradeAverage',
... |
from google_drive_downloader import GoogleDriveDownloader as gdd
gdd.download_file_from_google_drive(file_id='16Gi1oZr3mEGMEUCsOQ3whFfDlv8IAyzG',
dest_path='./',
unzip=True) |
#! /usr/bin/env python3
n = int(input("Enter the number of rows: "))
i = 1
while i <= n:
print("*" * i)
i += 1 |
import torch
import os
import time
import json
import random
import numpy as np
from collections import defaultdict
from utils import read_vocab, write_vocab, build_vocab, padding_idx, timeSince, read_img_features, print_progress, roi_img_features
import utils
from env import R2RBatch
from agent import Seq2SeqAgent
f... |
from setuptools import setup
from setuptools.command.test import test as TestCommand
import os
import sys
import io
import re
rel_file = lambda *args: os.path.join(os.path.dirname(os.path.abspath(__file__)), *args)
def read(*filenames, **kwargs):
encoding = kwargs.get('encoding', 'utf-8')
sep = kwargs.get('s... |
"""Test for smart home alexa support."""
import pytest
from homeassistant.components.alexa import messages, smart_home
from homeassistant.components.media_player.const import (
SUPPORT_NEXT_TRACK,
SUPPORT_PAUSE,
SUPPORT_PLAY,
SUPPORT_PLAY_MEDIA,
SUPPORT_PREVIOUS_TRACK,
SUPPORT_SEEK,
SUPPORT... |
import tests.periodicities.period_test as per
per.buildModel((60 , 'W' , 25)); |
# Auto generated configuration file
# using:
# Revision: 1.19
# Source: /local/reps/CMSSW/CMSSW/Configuration/Applications/python/ConfigBuilder.py,v
# with command line options: Configuration/GenProduction/python/BTV-RunIISummer20UL17GEN-00002-fragment.py --python_filename BTV-RunIISummer20UL17GEN-00002_1_cfg.py --e... |
from extractnet.lcs import check_inclusion
def test_check_inclusion():
inc = check_inclusion(
["some", "words", "here", "the", "football"],
["he", "said", "words", "kick", "the", "football"])
assert inc == [False, True, False, True, True] |
import asyncio
import traceback
from datetime import datetime
from neo.Network.core.header import Header
from typing import TYPE_CHECKING, List
from neo.Network.flightinfo import FlightInfo
from neo.Network.requestinfo import RequestInfo
from neo.Network.payloads.inventory import InventoryType
from neo.Network.common i... |
# Natural Language Toolkit CommandLine
# understands the command line interaction
# Author: Sumukh Ghodke <sumukh dot ghodke at gmail dot com>
#
# URL: <http://nltk.sf.net>
# This software is distributed under GPL, for license information see LICENSE.TXT
from optparse import OptionParser
from nltk_contrib.classifie... |
#!/usr/bin/env python
import sys
import requests
import json
import argparse
pub_id = "***ACCOUNT ID HERE****"
client_id = "***CLIENT ID HERE****"
client_secret = "***CLIENT SECRET HERE****"
source_filename = "*** LOCAL VIDEO FILE HERE***"
access_token_url = "https://oauth.brightcove.com/v3/access_token"
profiles_bas... |
expected_output = {
"vrf": {
"VRF1": {
"address_family": {
"ipv4": {
"routes": {
"10.0.0.0/24": {
"route": "10.0.0.0/24",
"active": True,
"route_prefere... |
import binascii
import functools
from typing import Dict, List, Union
from vyper.exceptions import InvalidLiteral
try:
from Crypto.Hash import keccak # type: ignore
keccak256 = lambda x: keccak.new(digest_bits=256, data=x).digest() # noqa: E731
except ImportError:
import sha3 as _sha3
keccak256 = ... |
# Copyright 2020 Spotify AB
#
# 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 law or agreed to in writing, so... |
if 10 > 3:
print("Hello")
if 3:
print("Yes, it's 3")
if 0:
print("This won't execute")
if -1:
print("Will it print?")
if "hello":
print("interesting")
if "":
print("This will not print either")
if " ":
print("aaa")
print(bool(1)) # rzutowanie na boolean |
#
# Copyright 2014-2016 CloudVelox Inc. 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 applica... |
from metrics import MetricFunctionNYUv2, print_single_error
from model import SupervisedLossFunction
from torch.utils.data import DataLoader
from torchvision import transforms
from nyuv2 import NYUv2
from tqdm import tqdm
from general import generate_layers, load_checkpoint, tensors_to_device
import torch
from torchvis... |
import os
import numpy as np
import ndflow
from ndflow.models.mixture import MixtureModel
def list_images(imgs_dir):
import SimpleITK as sitk
for filename in os.listdir(imgs_dir):
path = os.path.join(imgs_dir, filename)
reader = sitk.ImageFileReader()
reader.SetFileName(path)
... |
# token_generator. Generate random strings.
#
# Copyright (C) 2021, Ty Gillespie. All rights reserved.
# MIT License.
import random
def generate(length = 8):
"""Generates a token of the given length. The default is 8."""
# Feel free to change this based on what you need your tokens to contain.
SYMBOLS = "... |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes ... |
from twilio.rest import Client
from credentials import account_sid, auth_token, my_cell, my_twilio
# Find these values at https://twilio.com/user/account
client = Client(account_sid, auth_token)
my_msg = "Hi this is kabir"
message = client.messages.create(to=my_cell, from_=my_twilio,
... |
import warnings
import torch.nn as nn
import torch.utils.checkpoint as cp
from mmcv.cnn import build_conv_layer, build_norm_layer, build_plugin_layer
from mmcv.runner import BaseModule
from mmcv.utils.parrots_wrapper import _BatchNorm
from ..builder import BACKBONES
from ..utils import ResLayer
class BasicBlock(Bas... |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may ... |
# Usage: `python testing_tool.py test_number`, where the argument test_number
# is either 0 (first test set), 1 (second test set) or 2 (third test set).
# This can also be run as `python3 testing_tool.py test_number`.
from __future__ import print_function
import sys
import collections
import itertools
import random
i... |
from __future__ import absolute_import, division, print_function
from .version import __version__ # noqa
from .due import due, Doi
__all__ = ["grabbids"]
due.cite(Doi("10.1038/sdata.2016.44"),
description="Brain Imaging Data Structure",
tags=["reference-implementation"],
path='bids') |
#!/usr/bin/env python
import Tkinter as tk # Python 2
class App(tk.Tk):
def __init__(self):
tk.Tk.__init__(self) # Python 2
self.title('Main Window')
self.geometry('300x300')
# def run(self):
# self.mainloop()
#app = App()
#app.run()
#App().run()
App().mainl... |
"""
Transform the parse tree produced by parser.py to a higher-level tree using
recursive descent.
"""
from magpieparsers.parser_common import *
from magpieparsers.types.evaluator import evaluate
from magpieparsers.types.infogripper import *
from magpieparsers.cplusplus.normalise import normalise_type_list
from astexp... |
# -*- coding: utf-8 -*-
from dataclasses import dataclass
from typing import Optional
@dataclass
class Season:
id: Optional[int] |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.response.AlipayResponse import AlipayResponse
class AlipayFundJointaccountOperationApproveResponse(AlipayResponse):
def __init__(self):
super(AlipayFundJointaccountOperationApproveResponse, self).__init__()
def parse_res... |
"""Implements spectral biclustering algorithms.
Authors : Kemal Eren
License: BSD 3 clause
"""
from abc import ABCMeta, abstractmethod
import numpy as np
from scipy.sparse import dia_matrix
from scipy.sparse import issparse
from sklearn.base import BaseEstimator, BiclusterMixin
from sklearn.externals import six
fr... |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.5 on 2017-11-21 21:04
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('core', '0013_auto_20171106_1017'),
]
operations = [
migrations.AlterField(
... |
'''
Since scaffolds are not directly stored and instead are assocaited with each
contig, we must extract the total length of scaffolds in each assembly, as
well as the length of any intersections.
Then, we get the maximum weighted jaccard index for each reference scaffold,
which is defined as the... |
import signal
import time
from typing import Any, Callable
import torch
from easydict import EasyDict
from .time_helper_base import TimeWrapper
from .time_helper_cuda import get_cuda_time_wrapper
def build_time_helper(cfg: EasyDict = None, wrapper_type: str = None) -> Callable[[], 'TimeWrapper']:
r"""
Overvi... |
from apiWrapper import coinAPI
from sqlalchemy import create_engine
from sqlalchemy import Table,Column,Integer,String,MetaData,ForeignKey
import sqlite3
from sqlite3 import Error
import pandas as pd
import os
def main():
path = "/CryptoDataApplication/"
for filename in os.listdir(path):
if filename.s... |
"""
Test `graph.py` module.
Author: Nikolay Lysenko
"""
from typing import List, Tuple
import pytest
import tensorflow as tf
import numpy as np
from gpn.graph import sample_multiple_fragments
@pytest.mark.parametrize(
"images, corners, fragment_size, frame_size, n_channels, expected",
[
(
... |
import logging
import boto3
import json
import aws_cdk as cdk
from aws_cdk import aws_secretsmanager
from aws_cdk.pipelines import CodePipeline, CodePipelineSource, ShellStep
from constructs import Construct
secretsmanager = boto3.client('secretsmanager')
# from pipeline_stage import WorkshopPipelineStage
class P... |
class Solution(object):
def frequencySort(self, s):
"""
:type s: str
:rtype: str
"""
# Firstly, we count frequencies
freq = {}
freq_to_chars = {}
result = []
for c in s:
if c in freq:
freq[c] += 1
else:
... |
import logging
import os
import sys
import django.core.handlers.wsgi
from django.conf import settings
# Add this file path to sys.path in order to import settings
sys.path.insert(0, os.path.join(os.path.dirname(os.path.realpath(__file__)), '../..'))
os.environ['DJANGO_SETTINGS_MODULE'] = 'wildcard.settings'
sys.stdout... |
"""
Clyde's Simple Shuffler Encryption
@Desc
This encryption algorthym is design for users to use their own keys to build
a unique encrypted output. It called shuffler as it uses the inputed key
to shuffle each character in the message, thus making it harder to crack.
I highly advise you to not use this for passwords... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time : 2019/5/19 下午2:08
# @Author : Erwin
from common.pickle_helper import read_model
import numpy as np
# noinspection PyUnresolvedReferences
from sklearn.neighbors import LocalOutlierFactor
# noinspection PyUnresolvedReferences
from sklearn.ensemble import IsolationFo... |
#!/usr/bin/env python3
import subprocess
import os
import sys
sys.path.append("../lib/")
import json_parser
import ibofos
import cli
import test_result
import MOUNT_ARRAY_BASIC_1
def clear_result():
if os.path.exists( __file__ + ".result"):
os.remove( __file__ + ".result")
def set_result(detail):
cod... |
#!/usr/bin/env python3
# Copyright (c) 2016 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
from test_framework.test_framework import BitcoinTestFramework
from test_framework.util import *
from test_fra... |
# -*- coding: utf-8 -*-
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: streamlit/proto/Slider.proto
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf import reflection as _reflection
from google.protobuf import symbol_databa... |
# script which runs the oscap command for RHEL7
# prints out one line to stdout of pass/fail/other counter
# sends fail ID's to fail.txt and syslog
# written by Alicja Gornicka
import subprocess
import sys
import socket
import syslog
import string
# runs oscap command for rhel7
test = subprocess.Popen(['/usr/bin/osca... |
from __future__ import absolute_import, division, print_function
class hydrogen_toggle(object):
def __init__(self, separator=False):
import coot # import dependency
import coot_python
import gtk
toolbar = coot_python.main_toolbar()
assert (toolbar is not None)
if (separator):
toolbar.in... |
'''
Created on 2014-01-17
@author: Vanessa Wei Feng
'''
import os
import fnmatch
import re
from operator import itemgetter
from trees.parse_tree import ParseTree
from nltk.tree import Tree
#from nltk.draw.tree import *
try:
from utils.RST_Classes import *
import utils.treebank_parser
except Exception as e:
... |
# Copyright (c) 2020-2021 The MMSegmentation Authors
# SPDX-License-Identifier: Apache-2.0
#
# Copyright (C) 2021 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
#
from .compose import Compose, ProbCompose, MaskCompose
from .formating import (Collect, ImageToTensor, ToDataContainer, ToTensor,
... |
#!/usr/bin/env python3
# Copyright (c) 2015-2016 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test block processing.
This reimplements tests from the bitcoinj/FullBlockTestGenerator used
by the pu... |
"""
This file defines cache, session, and translator T object for the app
These are fixtures that every app needs so probably you will not be editing this file
"""
import copy
import os
import sys
import logging
from py4web import Session, Cache, Translator, Flash, DAL, Field, action
from py4web.utils.mailer import Mai... |
{"fs": {"aibs_ct_an": {
"info": {
"name": "AIBS cell types - analysis",
"version": "0.9.2",
"date": "May 6, 2016",
"author": "Jeff Teeters, based on Allen Institute cell types DB HDF5 file",
"contact": "jteeters@berkeley.edu",
"description": "NWB extension for AIBS cell types data base NWB fil... |
FAR_LENGTH = 2**32
IMAGE_WIDTH = 640
IMAGE_HEIGHT = 480
FIELD_OF_VIEW = 50.0 # in degrees
BELT_VELOCITY = 0.1 |
"""A collection of Data Science helper functions"""
import pandas as pd
import numpy as np
import random
def df_cleaner(df):
"""Clean a df of nulls"""
return df.dropna()
"""Check to make sure that code works"""
print("df_cleaner is working!")
def null_count(df):
"""Check a dataframe for nulls and r... |
# AUTO-GENERATED by tools/checkspecs.py - DO NOT EDIT
from __future__ import unicode_literals
from ..preprocess import Erode
def test_Erode_inputs():
input_map = dict(
args=dict(argstr='%s', ),
debug=dict(
argstr='-debug',
position=1,
),
dilate=dict(
... |
import numpy as np
import torch
import scipy.optimize as opt
import time
from .optimizer import Optimizer
from ..ml.trainer_robot import TrainerRobot
from ..ml.models import RobotNetwork, RobotSolver
from .. import arguments
from ..graph.visualization import scalar_field_paraview
class OptimizerRobot(Optimizer):
... |
# This the basic flow for getting from a JP2 to a jpg w/ kdu_expand and Pillow
# Useful for debugging the scenario independent of the server.
from PIL import Image
from PIL.ImageFile import Parser
from os import makedirs, path, unlink
import subprocess
import sys
KDU_EXPAND='/usr/local/bin/kdu_expand'
LIB_KDU='/usr/l... |
#!/bin/env python
# Automatically translated python version of
# OpenSceneGraph example program "osgpoints"
# !!! This program will need manual tuning before it will work. !!!
import sys
from osgpypp import osg
from osgpypp import osgDB
from osgpypp import osgUtil
from osgpypp import osgViewer
# Translated from f... |
# Python standard libraries
import argparse
import glob
import json
import logging
import logging.config
import os
import sys
# Non-standard includes
import numpy as np
import tensorflow as tf
# Maybe import tqdm
show_progress = False
try:
import tqdm
show_progress = True
except ImportError:
pass
try:
... |
"""
This is a configuration file for logs from FullwavePy modules.
The engine is the 'logging' module which is a part of the Python's
standard library.
Additionally, the 'autologging' module is used as a very convienient wrapper.
It allows to define a function's logger (it contains both the module's and
function's ... |
# coding: utf-8
from __future__ import unicode_literals
from .common import InfoExtractor
from ..compat import compat_str
from ..utils import (
try_get,
urljoin,
)
class PhilharmonieDeParisIE(InfoExtractor):
IE_DESC = 'Philharmonie de Paris'
_VALID_URL = r'''(?x)
https?://
... |
from rest_framework.serializers import ModelSerializer
from profiles.models import Profile
class ProfileSerializer(ModelSerializer):
"""
Serializer for Profile.
"""
class Meta:
model = Profile
exclude = ('user',) |
"""Test ModiscoFile
"""
import pandas as pd
from bpnet.modisco.files import ModiscoFile, ModiscoFileGroup
from bpnet.modisco.core import Pattern, Seqlet
def test_modisco_file(mf, contrib_file):
# contrib_file required for `mf.get_ranges()`
assert len(mf.patterns()) > 0
p = mf.get_pattern("metacluster_0/p... |
# Generated by Django 3.2.9 on 2021-11-02 04:43
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('tweet', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name='tweet',
name='date',
field=... |
from sqlalchemy.orm import backref
from werkzeug.security import generate_password_hash,check_password_hash
from flask_login import UserMixin,current_user
from app import db
from . import login_manager
@login_manager.user_loader
def load_user(id):
return User.query.get(id)
class Pitch(db.Model):
__tablename... |
from schematics import Model
from schematics.types import ModelType, ListType, StringType, IntType, BooleanType, NumberType, DateTimeType, \
TimestampType, UTCDateTimeType, TimedeltaType, FloatType
class Tags(Model):
key = StringType(serialize_when_none=False)
value = StringType(serialize_when_none=False)... |
from b4sh import *
from sys import argv
from b4sh.utils.create import create_b4sh
if __name__ == "__main__":
if len(argv) > 1:
print("[x] Starting b4sh...")
if "-ls" in argv[1] or "--list" in argv[1]:
list_all()
elif '-c' in argv[1] or '--create' in argv[1]:
creat... |
from .. import Provider as PhoneNumberProvider
class Provider(PhoneNumberProvider):
formats = (
"+##(#)##########",
"+##(#)##########",
"0##########",
"0##########",
"###-###-####",
"(###)###-####",
"1-###-###-####",
"###.###.####",
"###-###-... |
# Command line interface for the executor package.
#
# Author: Peter Odding <peter@peterodding.com>
# Last Change: October 7, 2018
# URL: https://executor.readthedocs.io
#
# TODO Expose a clean way to interrupt the fudge factor of other processes.
# TODO Properly document command timeout / lock-timeout / TERM-timeout /... |
import urllib,sys, os, logging
import hashlib
from .waresponseparser import ResponseParser
from yowsup.env import YowsupEnv
from .httpproxy import HttpProxy
if sys.version_info < (3, 0):
import httplib
from urllib import urlencode
if sys.version_info >= (2, 7, 9):
#see https://github.com/tgalal/yo... |
import pickle
import numpy as np
from rdkit import Chem
if __name__ == '__main__':
from progress_bar import ProgressBar
else:
from utils.progress_bar import ProgressBar
from datetime import datetime
class SparseMolecularDataset():
def load(self, filename, subset=1):
with open(filename, 'rb') ... |
from .dataset import GeneExpressionDataset
import pandas as pd
import numpy as np
import os
class CsvDataset(GeneExpressionDataset):
r""" Loads a `.csv` file.
Args:
:filename: Name of the `.csv` file.
:save_path: Save path of the dataset. Default: ``'data/'``.
:url: Url of the remote ... |
# -*- coding: utf-8 -*-
import sys
import pytest
@pytest.fixture
def base_mongoop_arguments():
return {
'mongodb_host': 'localhost',
'mongodb_port': 27017,
}
@pytest.fixture
def base_mongoop_trigger_arguments():
return {
'name': 'pytest',
'params': {'threshold': 10},
... |
class NoamOptimizer:
"""
This Hook implements the optimization strategy presented in the "Attention is all you need" paper
Section 5.3.
"""
timing = "pre"
name = "NoamOptimizerHook"
call_for_each_param = False
def __init__(self, num_warmup_steps, factor, model_size):
se... |
#
"""
Tests policy nets.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import tensorflow as tf
from texar.modules.policies.policy_nets import CategoricalPolicyNet
class CategoricalPolicyNetTest(tf.test.TestCas... |
"""
Functions:
def read_image(img_path, is_resize = True, width = 224, height = 224, interpolation = cv2.INTER_AREA)
def cielab_color_space()
def view_db_info(db_root, db_files, db_name)
def compute_prior_prob(image_files, width, height, do_plot, pts_in_hull_path, prior_prob_path)
def comp... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright 1999-2020 Alibaba Group Holding Ltd.
#
# 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-... |
import os
from typing import List, Tuple, Dict, Optional, Any
from dask.delayed import Delayed, delayed
from distributed import Client
from artificial_bias_experiments.evaluation.sar_group_finding_relation_overlap import \
get_target_relation_to_filter_relation_list_map_and_create_if_non_existent
from dask_utils.... |
import sys
from collections import deque
l = deque(sys.stdin.readlines())
n, m = (int(x) for x in l[0].split())
l.popleft()
from_1, to_n = set(), set()
for a, b in deque((int(x) for x in l[i].split()) for i in range(m)):
if a == 1:
from_1.add(b)
elif b == n:
to_n.add(a)
print("POSSIBLE" if fr... |
# -*- coding: utf-8 -*-
from setuptools import setup, find_packages
github_url = ("https://guthub.com/bradfordleak/Units/bradfordleak/"
"Units")
try:
with open('README.md') as f:
readme = f.read()
except:
readme = "Please see the README.md file at {}.".format(github_url)
setup(
na... |
import submodule.appfunction as af
import tkinter.filedialog
from tkinter import *
import tkinter as tk
import numpy as np
import PIL.ImageTk
import PIL.Image
from PIL import *
import cv2
import os
class ObjectDetection_ui(tk.Tk):
def __init__(self):
self.window = tk.Tk()
self.window.title("Objec... |
from update_checker import UpdateChecker
def check_for_update(package, version):
try:
checker = UpdateChecker()
result = checker.check(package, version)
return result.available_version
except: # nosec
return None |
# Electrum - lightweight Bitcoin client
# Copyright (C) 2011 Thomas Voegtlin
#
# 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 t... |
import shutil
import numpy as np
import plyvel
import os.path
import sys
sys.path.append('../')
from bert.modeling import *
from bert.tokenization import *
import json
import os.path
import numpy as np
class TokenEmbeddings:
def __init__(self, piece, is_word_start, vector):
self.piece = piece
self... |
"""Approximation of algorithmic complexity by Block Decomposition Method.
This package provides the :py:class:`bdm.BDM` class for computing approximated
algorithmic complexity of arbitrary binary 1D and 2D arrays based
on the *Block Decomposition Method* (**BDM**). The method is descibed
`in this paper <https://www.md... |
"""
Functions for selecting a complete set of germs for a GST analysis.
"""
#***************************************************************************************************
# Copyright 2015, 2019 National Technology & Engineering Solutions of Sandia, LLC (NTESS).
# Under the terms of Contract DE-NA0003525 with NTES... |
import os
__all__ = [mod.split(".")[0] for mod in os.listdir("handlers") if mod != "__init__.py"] |
"""Helpers to execute scripts."""
from __future__ import annotations
import asyncio
from collections.abc import Callable, Sequence
from contextlib import asynccontextmanager, suppress
from contextvars import ContextVar
from copy import copy
from datetime import datetime, timedelta
from functools import partial
import ... |
"""
Article object, read in from json
"""
class Article(object):
def __init__(self, head, lead, body,
date, time, writers,
publisher, source_outlet,
additional_information, annotation_list,
feature_list, raw_article):
"""
:param h... |
import yaml
import os.path
from os import path
import tarfile
class MustGatherAccessor:
tarcache = None
tar = None
name = "must-gather accessor"
def __init__ (self,filename):
self.filename = filename
def readfile(self):
if path.isdir(self.filename):
pass... |
# -*- coding: utf-8 -*-
#
# Copyright 2019 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... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.