filename stringlengths 13 19 | text stringlengths 134 1.04M |
|---|---|
the-stack_0_3848 | # -*- coding: utf-8 -*-
# Copyright 2017 Vector Creations 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-2.0
#
# Unless required by applica... |
the-stack_0_3849 | import numpy as np
import math
import cv2
import numpy.random as random
class Compose(object):
"""Composes several augmentations together.
Args:
transforms (List[Transform]): list of transforms to compose.
Example:
>>> augmentations.Compose([
>>> transforms.CenterCrop(10),
... |
the-stack_0_3851 | description = 'Various devices for logical motors in AMOR'
includes = ['sinq_amor_movable']
devices = dict(
controller = device('nicos_sinq.amor.devices.logical_motor.AmorLogicalMotorHandler',
description = 'Logical Motors Controller',
lowlevel = True,
loglevel = 'debug'
),
m2t = d... |
the-stack_0_3854 |
import os
import subprocess
import platform
from SetupPython import PythonConfiguration as PythonRequirements
# Make sure everything we need for the setup is installed
PythonRequirements.Validate()
from SetupPremake import PremakeConfiguration as PremakeRequirements
# from SetupVulkan import VulkanConfiguration as ... |
the-stack_0_3856 | n1 = int(input('Digite um número inteiro: '))
print('''Escolha uma das bases para conversão:
[ 1 ] converter para BINÁRIO
[ 2 ] converter para OCTAL
[ 3 ] converter para HEXADECIMAL''')
opção = int(input('Escolha uma opção: '))
if opção == 1:
print('{} convertido para BINÁRIO é igual a {}'.format(n1, bin(n1)[2:]))
... |
the-stack_0_3859 | import cv2
from Recognizer import *
# for more details on how to use this code see : https://github.com/Ahmedjellouli/FaceRecognition
Recognizer = Recognizer(Database="Database",
Tolerance=0.55,
detectFrontalFace=False,
detectLandmarks=Tr... |
the-stack_0_3860 | # -*- coding: utf-8 -*-
#
# Copyright (C) 2019 Miroslav Bauer, CESNET.
#
# oarepo-references is free software; you can redistribute it and/or modify
# it under the terms of the MIT License; see LICENSE file for more details.
"""Test OARepo references fields."""
import uuid
import pytest
from tests.test_utils import T... |
the-stack_0_3862 | #!python
from bbfreeze import Freezer
import shutil
destDir = 'dist'
def main():
#includes = ['requests', 'email.utils']
includes = ['requests', 'email.utils']
excludes = ['_gtkagg', '_tkagg', 'bsddb', 'curses', 'email', 'pywin.debugger',
'pywin.debugger.dbgcon', 'pywin.dialogs', 'tcl'... |
the-stack_0_3863 | import logging
logging.basicConfig(level=logging.DEBUG,
format='%(asctime)s - %(name)s - %(levelname)s - %(message)s')
logger = logging.getLogger(__name__)
logging.getLogger("pyrogram").setLevel(logging.WARNING)
import asyncio
import aiohttp
import json
import os
import shutil
import time
from PIL... |
the-stack_0_3865 | # Copyright 2015 - Rackspace US, 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... |
the-stack_0_3868 | # future
from __future__ import annotations
# stdlib
import functools
from functools import lru_cache
import operator
from typing import Any
from typing import Callable
from typing import Dict
from typing import List
from typing import Optional
from typing import Tuple
from typing import Union
# third party
from goog... |
the-stack_0_3870 | # qubit number=4
# total number=35
import pyquil
from pyquil.api import local_forest_runtime, QVMConnection
from pyquil import Program, get_qc
from pyquil.gates import *
import numpy as np
conn = QVMConnection()
def make_circuit()-> Program:
prog = Program() # circuit begin
prog += CNOT(0,3) # number=12
... |
the-stack_0_3874 | import mimetypes
from datetime import timedelta, datetime
from enum import Enum
from http.cookiejar import CookieJar
from time import sleep
from typing import List, Optional, AnyStr, TypeVar, TextIO, Tuple, Callable, Dict
from urllib.parse import urlparse, urljoin
from bs4 import BeautifulSoup
from loguru import logge... |
the-stack_0_3875 | import torch
import torch.nn as nn
import torch.nn.functional as F
import numpy as np
class Affine(nn.Module):
def __init__(self,
min_rot, max_rot,
min_shear_x, max_shear_x,
min_shear_y, max_shear_y,
min_scale_x, max_scale_x,
min... |
the-stack_0_3876 | import argparse
import sys
import os
import subprocess
import shlex
import glob
import irc_bot
def process_arguments(args):
parser = argparse.ArgumentParser(description='configure the irc clients')
parser.add_argument('--txts_path', action='store', help='path to folder with txt files')
parser.add_argument... |
the-stack_0_3879 | # -*- coding: utf-8 -*-
"""
Created on Mon Jun 14 14:04:34 2021
@author: mesar
"""
import numpy as np
import pandas as pd
from lib import utils
from progressbar import progressbar as pbar
from pathlib import Path
import itertools
from time import time
import csv
if __name__ == "__main__":
Path("../data/mode... |
the-stack_0_3880 | import matplotlib
import re
import custom_style
from custom_style import setup_columns,col,remove_chart_junk
import matplotlib.pyplot as plt
import sys
import numpy as np
from matplotlib.ticker import FuncFormatter
import math
from collections import defaultdict
from matplotlib.patches import Patch
import scipy.special... |
the-stack_0_3881 | #!/usr/bin/env python3
#
# Copyright (C) 2018 Bloomberg 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 applicable ... |
the-stack_0_3882 | # -*- coding: utf-8 -*-
import os
import sys
import argparse
import time
main_path = os.path.abspath(os.path.join(os.path.dirname(__file__), ".."))
sys.path.insert(0, main_path)
def call1(dataset, num_chunks, args):
call1_ = "python -m sklearnex fea.1.mmm_bopf_repr_fit.py "
call1_ += "{0} {1} --timestamp={2} ... |
the-stack_0_3888 | from matplotlib.pyplot import figure
from numpy import array, zeros
from scipy.integrate import solve_ivp
from .dynamics import Dynamics
from ..util import default_fig
class SystemDynamics(Dynamics):
"""Abstract dynamics class for simulation.
Override eval_dot.
"""
def __init__(self, n, m):
... |
the-stack_0_3889 | import os
from fnmatch import fnmatch
import pickle
# General Processing
import numpy as np
import pandas as pd
import collections
# DECOMPOSITION
from sklearn.decomposition import NMF
from scipy.linalg import svd
# NLU
from ibm_cloud_sdk_core.authenticators import IAMAuthenticator
from ibm_watson import NaturalLan... |
the-stack_0_3890 | # case where generator doesn't intercept the thrown/injected exception
def gen():
yield 123
yield 456
g = gen()
print(next(g))
try:
g.throw(KeyError)
except KeyError:
print('got KeyError from downstream!')
# case where a thrown exception is caught and stops the generator
def gen():
try:
yi... |
the-stack_0_3891 | # pyOCD debugger
# Copyright (c) 2018-2020 Arm Limited
# SPDX-License-Identifier: Apache-2.0
#
# 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... |
the-stack_0_3892 | import torch
import torch.nn as nn
import torch.nn.functional as F
# from CAPS.effiUnet_v3 import EfficientUNet
from loguru import logger
# from CAPS.effiUnet_v3_1 import EfficientUNet
from CAPS.effiUnet_v4 import EfficientUNet
class CAPSNet(nn.Module):
def __init__(self, args, device):
super(CAPSNet, sel... |
the-stack_0_3893 | # coding: utf-8
"""
Pure Storage FlashBlade REST 1.9 Python SDK
Pure Storage FlashBlade REST 1.9 Python SDK, developed by [Pure Storage, Inc](http://www.purestorage.com/). Documentations can be found at [purity-fb.readthedocs.io](http://purity-fb.readthedocs.io/).
OpenAPI spec version: 1.9
Contact: i... |
the-stack_0_3896 | import warnings
from collections import defaultdict
from itertools import chain
from typing import Dict, Iterable, Iterator, List, Optional, Set
from math import ceil
from maggma.core import Builder, Store
from maggma.utils import grouper
from monty.json import MontyDecoder
from pymatgen.analysis.phase_diagram import ... |
the-stack_0_3899 | import csv
def save_minimal_pairs(output_filename, to_output, write_header=True):
if isinstance(output_filename, str):
outf = open(output_filename, mode='w', encoding='utf-8-sig', newline='')
needs_closed = True
else:
outf = output_filename
needs_closed = False
writer = cs... |
the-stack_0_3900 | import numpy as np
import random
from collections import defaultdict
from environment import Env
class SARSAgent:
def __init__(self, actions):
self.actions = actions
self.learning_rate = 0.01
self.discount_factor = 0.9
self.epsilon = 0.1
self.q_table = defaultdict(lambda: [... |
the-stack_0_3905 | # Copyright 2014-2016 OpenMarket 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-2.0
#
# Unless required by applicable law or agreed to in w... |
the-stack_0_3907 | import unittest
from nose.plugins.attrib import attr
from jnpr.healthbot import HealthBotClient
from jnpr.healthbot import PlaybookSchema
from jnpr.healthbot import PlayBookInstanceBuilder
from mock import patch
@attr('unit')
class TestPlaybooks(unittest.TestCase):
@patch('jnpr.healthbot.healthbot.requests.Sess... |
the-stack_0_3908 | import typing
from discord_bot_eternal_dice.model.discord_command import DiscordCommand
from discord_bot_eternal_dice.model.discord_event import CommandType, DiscordEvent
class DiscordRoute:
def __init__(self, handler, command_type: CommandType, command: str, subcommand: str = None,
options: typ... |
the-stack_0_3912 | #!/usr/bin/env python
###############################################################################
#
# superimposessemap.py - Superimpose structures according to SSE mapping
#
# File: superimposessemap.py
# Author: Alex Stivala
# Created: August 2008
#
#
# Supermipose in 3D the residues in corresponding SSEs by ... |
the-stack_0_3914 | # coding: utf-8
# ----------------------------------------------------------------------------
# <copyright company="Aspose" file="djvu_properties.py">
# Copyright (c) 2018-2020 Aspose Pty Ltd. All rights reserved.
# </copyright>
# <summary>
# Permission is hereby granted, free of charge, to any person obtai... |
the-stack_0_3915 | import os
import glob
import sys
import shutil
import pysam
from bcbio.pipeline import config_utils
from bcbio.distributed.transaction import file_transaction, tx_tmpdir
from bcbio.utils import (safe_makedir, file_exists)
from bcbio.provenance import do
from bcbio import utils
from bcbio.log import logger
from bcbio.p... |
the-stack_0_3916 | # -*- coding: utf-8 -*-
"""
@Time:2020/8/20 22:25
@Auth"JunLin615
@File:example1.py
@IDE:PyCharm
@Motto:With the wind light cloud light mentality, do insatiable things
@email:ljjjun123@gmail.com
"""
from shiningspectrum import pretreatment
from shiningspectrum import database
import os
import matplotlib.pyplot as ... |
the-stack_0_3918 | # Copyright 2021, 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/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing... |
the-stack_0_3919 | # -*- coding: utf-8 -*-
#
# Copyright 2018-2022 BigML
#
# 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 ... |
the-stack_0_3921 | # -*- coding: utf-8 -*-
"""
@date: 2021/7/20 下午10:27
@file: operation.py
@author: zj
@description:
"""
import os
import torch
from zcls.config.key_word import KEY_OUTPUT
from slim.config import cfg
from slim.model.build import build_model
from slim.prune.build import build_prune
from slim.util.profile import compu... |
the-stack_0_3923 | from __future__ import division
import numpy as np
from warnings import warn
__all__ = ['img_as_float', 'img_as_int', 'img_as_uint', 'img_as_ubyte',
'img_as_bool', 'dtype_limits']
dtype_range = {np.bool_: (False, True),
np.bool8: (False, True),
np.uint8: (0, 255),
... |
the-stack_0_3925 | import atexit
import configparser
import telegram
import time
from binance.client import Client
from datetime import datetime
#Bot and config instances
config = None
telegram_bot = None
binance_bot = None
#General variables
refresh_rate = -1
chat_id = -1
time_started = -1
#Order-related variables
orders = []
send_o... |
the-stack_0_3928 | import datetime
import logging
import requests
import auditUtils
import constants
import dbUtil
import rds_config
import restUtils
import tables
logger = logging.getLogger()
logger.setLevel(logging.INFO)
SUCCESS_RESPONSE = {"statusCode": 200}
def prepUserSettings(conn, chatId, userId, app):
setting = getUserSet... |
the-stack_0_3933 | import csv
from difflib import SequenceMatcher
import re
import string
import pandas as pd
import urllib.request
from bs4 import BeautifulSoup
from googlesearch import search
from collections import OrderedDict
#import unidecode
'''
['Twenty20 Internationals', 'One-Day Internationals', 'Twenty20','Tests 1st ... |
the-stack_0_3934 | import pickle
import time
import requests
from bs4 import BeautifulSoup
from scrapers import Talk
from datetime import date, datetime
from dateutil.parser import parse as dateParser_
from scrapers import dateParse
from scrapers import removeParentheses
from scrapers import cleanSpeaker
from datetime import datetime
fro... |
the-stack_0_3936 | # QUANTCONNECT.COM - Democratizing Finance, Empowering Individuals.
# Lean Algorithmic Trading Engine v2.0. Copyright 2014 QuantConnect Corporation.
#
# 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 Licen... |
the-stack_0_3938 | import os
import sys
sys.path.append("../..")
from PyCLUE.tasks.run_classifier import my_clue_tasks, configs
import tensorflow as tf
# assign GPU devices or CPU devices
# os.environ["CUDA_VISIBLE_DEVICES"] = "4"
flags = tf.flags
FLAGS = flags.FLAGS
# os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3'
# tf.logging.set_verbosi... |
the-stack_0_3939 | # coding:utf-8
import datetime
from functools import lru_cache
import matplotlib.pyplot as plt
import matplotlib.ticker as ticker
import numpy as np
import pandas as pd
from QUANTAXIS.QAAnalysis.QAAnalysis_dataframe import QAAnalysis_stock
from QUANTAXIS.QAData.data_marketvalue import QA_data_marketvalue
... |
the-stack_0_3940 | """Provide support to Lexicon for DNS changes for Gransy sites subreg.cz, regtons.com and \
regnames.eu."""
from __future__ import absolute_import
import collections
import logging
from builtins import staticmethod
try:
import zeep # Optional dependency
except BaseException:
pass
from lexicon.providers.base... |
the-stack_0_3942 | from .package import Package
from .package import Version
def test_version_comparison():
assert Version(0, "1.2.4") < Version(10, "1.2.4")
assert Version(0, "1.2.5") < Version(10, "1.2.4")
assert Version(0, "1.2.3") == Version(0, "1.2.4")
assert Version(0, "1.2.3") == Version(0, "1.2.3")
assert ... |
the-stack_0_3944 | # 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 ... |
the-stack_0_3945 | # coding=utf-8
# Copyright 2018 The TF-Agents Authors.
#
# 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... |
the-stack_0_3946 | """
Class that exposes the leveldb through REST API, with automatic serialization
to bytes and deserialization from bytes provided by the serialization module
"""
import http
import os
import pickle
import sys
from multiprocessing import Process
from pathlib import Path
from typing import Iterable, Tuple, Union
import... |
the-stack_0_3948 | """Single slice vgg with normalised scale.
"""
import functools
import lasagne as nn
import numpy as np
import theano
import theano.tensor as T
import data_loader
import deep_learning_layers
import image_transform
import layers
import preprocess
import postprocess
import objectives
import theano_print... |
the-stack_0_3949 | import re, requests, Tools
class Utils:
@staticmethod
def current_interface_version():
return 50400
@staticmethod
def remove_colors(string):
if string is None:
return None
string = re.sub(r"\|\c........", "", string)
return string.replace("|r", "")
@staticmethod
def find_in_toc(what, toc):
return ... |
the-stack_0_3950 | # coding=utf-8
# Non-parametric Density Peak clustering:
# Automatic topography of high-dimensional data sets
#
# Author: Maria d'Errico <mariaderr@gmail.com>
#
# Licence: BSD 3 clause
import numpy as np
from sklearn.base import BaseEstimator, ClusterMixin, DensityMixin, ClassifierMixin, TransformerMixin
from sklear... |
the-stack_0_3953 | from math import log, sin, cos
import numpy as np
alt_20_ft = 6.096
alt_1000_ft = 304.8
m_to_ft = 3.28084
# Reference: MIL-F-8785C, MILITARY SPECIFICATION: FLYING QUALITIES OF PILOTED AIRPLANES (05 NOV 1980)
def wind_log(alt, speed, heading, z0=2.0, degree=True):
if degree:
heading = heading * 0.0174532... |
the-stack_0_3954 | # -*- coding: utf-8 -*-
# Copyright 2018 IBM.
#
# 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 agre... |
the-stack_0_3958 | import unittest
from os import path
from ga4stpg.binary.coder import Coder
from ga4stpg.graph import ReaderORLibrary
from ga4stpg.graph.algorithms import prim
from ga4stpg.graph.graph import UndirectedGraph as UGraph
from ga4stpg.graph.graph import UndirectedWeightedGraph as UWGraph
from ga4stpg.binary import ... |
the-stack_0_3960 | """
Performs a two-sided Kolmogorov-Smirnov test that the provided
sample comes from the given probability distribution function.
"""
from __future__ import print_function
import numpy
import pyferret
import pyferret.stats
import scipy.stats
def ferret_init(id):
"""
Initialization for the stats_kstest1 PyEF... |
the-stack_0_3961 | import unittest
import os, shutil
import subprocess
import sys
import rpy2.robjects as robjects
import glob
import pyreadr
import torch
import pickle
import re
import matplotlib.pyplot as plt
import random
import numpy as np
import warnings
import torch.optim as optim
prepath=os.getcwd()
test_input=prepath+"/test_dat... |
the-stack_0_3962 | import json
class MorseCode:
def __init__(self):
# load morse dictionary into module
with open("./morse_code.json", mode='r', encoding="utf-8") as f:
self.morse_code = json.load(f)
# convert input sentence to morse code sentence
def encrypt(self, sentence: str) -> st... |
the-stack_0_3963 | # -*- coding: utf-8 -*-
import json
import random
import time
import uuid
from datetime import datetime
import boto3
aws_profile = "eq_sanhe"
stream_name = "kinesis-practice-web-event"
n_records_per_second = 10
n_records_per_send = 10
boto_ses = boto3.session.Session(profile_name=aws_profile)
kn_client = boto_ses.c... |
the-stack_0_3964 | # Lint as: python2, python3
# Copyright 2019 Google LLC. 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 req... |
the-stack_0_3966 | #!/usr/bin/env python
"""
Copyright 2009 Richard Quirk
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 w... |
the-stack_0_3967 | # -*- coding:utf-8 -*-
from src.binary_search_tree import BST, PARENT, LEFT, RIGHT, KEY, SIZE
class SplayTree(BST):
""" Just like a simple Binary Search Tree but with the added operation of
splaying.
Complexity for most operations: O(log n), Omega(n)
TODO test and make sure this works!
See: ht... |
the-stack_0_3969 | import logging
import os
import torch as t
logger = logging.getLogger()
def save_checkpoint(epoch, arch, model, extras=None, is_best=None, name=None, output_dir='.', serialized=False):
"""Save a pyTorch training checkpoint
Args:
epoch: current epoch number
arch: name of the network architect... |
the-stack_0_3970 | # Copyright (c) 2017-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the 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.
import torch
from fairseq import ... |
the-stack_0_3972 | from mopidy.models import Album, Track
from tests.mpd import protocol
class StatusHandlerTest(protocol.BaseTestCase):
def test_clearerror(self):
self.send_request("clearerror")
self.assertEqualResponse("ACK [0@0] {clearerror} Not implemented")
def test_currentsong(self):
track = Trac... |
the-stack_0_3977 | import numpy as np
import time
import sys
from ServoMotor import *
from fns import *
import pandas as pd
import math as m
# Initialize motor control library & USB Port
filename = "/dev/ttyUSB0"
motor = ServoMotor(filename)
IO = motor.IO_Init()
if IO < 0:
print('IO exit')
sys.exit()
version= "0.2.0"
# Read v values... |
the-stack_0_3981 | from bika.lims.jsonapi.read import read
from plone.jsonapi.core import router
from plone.jsonapi.core.interfaces import IRouteProvider
from Products.CMFCore.utils import getToolByName
from zExceptions import BadRequest
from zope import interface
import json
import transaction
class doActionFor(object):
interface... |
the-stack_0_3982 | import os
import sys
from setuptools import setup
if sys.platform == 'darwin':
import py2app
elif sys.platform == 'win32':
import py2exe
sys.setrecursionlimit(100000)
VERSION = os.environ['DEEPN_VERSION']
BUNDLE_VERSION = VERSION.replace(".", "")
APP = ['gc_jm.py']
INCLUDES = ['sys', 'subprocess']
OPTIONS = {... |
the-stack_0_3986 | """
Generalized vs Standard Lomb-Scargle
------------------------------------
Figure 10.16
A comparison of the standard and generalized Lomb-Scargle periodograms for a
signal y(t) = 10 + sin(2pi t/P) with P = 0.3, corresponding to omega_0 ~ 21.
This example is, in some sense, a worst-case scenario for the standard
Lom... |
the-stack_0_3987 | import math
def mirror_numbers_graphing(n, factor, mid, width):
# https://stackoverflow.com/questions/38130895/find-middle-of-a-list/38131003
middle = math.floor(float(n) / 2)
if n % 2 != 0:
fudge_array_minus = []
fudge_array_plus = []
if middle < 1:
adj = 1
else... |
the-stack_0_3988 | """
Defines the class used for server_utils sync
"""
from time import sleep
from colorama import Back, Fore, Style
from .serverprocess import ServerProcess
from .sharedvars import SharedVariables
class ServerSync(ServerProcess):
"""
Class used for server_utils synchronization
2 modes supported : auto fo... |
the-stack_0_3991 | #
# 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, software
# distributed under t... |
the-stack_0_3995 | from flask import session, redirect, url_for, render_template, request
from flask import make_response
from . import main
from .forms import LoginForm, RequestKeyForm
import secrets
import sys
from Crypto.Cipher import AES
from Crypto import Random
from Crypto.Protocol.KDF import PBKDF2
import binascii
import uuid
from... |
the-stack_0_3997 | ''' Utils module '''
import os
import re
import json
import shutil
import subprocess
from colorama import Fore, Style, init
from lxml import etree
import __main__
from modules.utils.exceptions import NotCreatedDescribeLog
from modules.utils.models import MetadataType, MetadataTypeFromJSON
init(autoreset=True)
INFO_... |
the-stack_0_3998 | # Copyright 2019 U.C. Berkeley RISE Lab
#
# 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 agree... |
the-stack_0_4001 | # 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.org/MPL/2.0/.
#
# Copyright (c) 2014, Lars Asplund lars.anders.asplund@gmail.com
from __future__ import print_function
from os.path i... |
the-stack_0_4002 | #!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
import math
from typing import Dict, List, Optional, Tuple, Union
import torch
import torch.nn as nn
import torch.nn.functional as F
from pytext.config import ConfigBase
from pytext.config.module_config import ModuleConfig
fr... |
the-stack_0_4004 | # original: https://gist.github.com/karpitsky/29b49c3ae759a606b7db39ad3c3315ca
# This code was taken from karpitsky's gist.
# Modifications:
# --------------
# Takes a collection id obtained from a public collection
# on 'translate.yandex.ru'. Writes the collection to `dict/newdict.txt`
# under the current folder.
im... |
the-stack_0_4005 | import pandas as pd
from ggindex.IndexViz.IndexReport import IndexReport
from ggindex.IndexViz.IndexComparator import IndexComparator
import plotly.graph_objects as go
from plotly.subplots import make_subplots
import numpy as np
from ggindex.GreenGrowthStuff import GreenGrowthStuff
class IndexCrossReport(GreenGrowthS... |
the-stack_0_4008 | # coding: utf-8
from __future__ import unicode_literals
import itertools
import json
import os.path
import random
import re
import time
import traceback
from .common import InfoExtractor, SearchInfoExtractor
from ..jsinterp import JSInterpreter
from ..swfinterp import SWFInterpreter
from ..compat import (
compa... |
the-stack_0_4009 | from . import encode
import numpy
def pygame_play(data, rate=44100):
''' Send audio array to pygame for playback
'''
import pygame
pygame.mixer.init(rate, -16, 1, 1024)
sound = pygame.sndarray.numpysnd.make_sound(encode.as_int16(data))
length = sound.get_length()
sound.play()
pygame.ti... |
the-stack_0_4010 | """Functions to manipulate season data"""
import os
import logging
import pandas as pd
from pynba.config import config
from pynba.constants import WNBA, LOCAL, S3
from pynba import load_pbpstats
from pynba.parquet import load_pq_to_df, save_df_to_pq
from pynba.aws_s3 import list_objects
__all__ = [
"season_fro... |
the-stack_0_4012 | from unittest import TestCase
from scheduler.jobs_board import JobsBoard
from scheduler.match_maker import MatchMaker
from scheduler.partial_slot_scheduler import PartialSlotScheduler
from scheduler.tests.helpers import *
class TestPartialSlotScheduler(TestCase):
def setUp(self):
self.volunteers = {
... |
the-stack_0_4013 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import re
import sys
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
def get_version(*file_paths):
"""Retrieves the version from exo_changelog/__init__.py"""
filename = os.path.join(os.path.dirname(__file__... |
the-stack_0_4014 | import os
import platform
import sys
def is_active():
return True
def get_name():
return "LinuxBSD"
def can_build():
if (os.name != "posix" or sys.platform == "darwin"):
return False
# Check the minimal dependencies
x11_error = os.system("pkg-config --version > /dev/null")
if (x1... |
the-stack_0_4017 | # Copyright 2018 The Texar Authors. 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 ... |
the-stack_0_4018 | # Copyright (C) 2015 Yahoo! 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 applicable law... |
the-stack_0_4019 | # Copyright 2018 AT&T Intellectual Property. All other 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... |
the-stack_0_4020 | # ======================================================================= #
# Copyright (C) 2021 Hoverset Group. #
# ======================================================================= #
import abc
from collections import defaultdict
from formation.formats import Node
from hove... |
the-stack_0_4021 | import numpy
from ..tractography import Tractography
from . import tract_operations
from ..tensor import scalar_measures
try:
from collections import OrderedDict
except ImportError: # Python 2.6 fix
from ordereddict import OrderedDict
def compute_all_measures(tractography, desired_keys_list, scalars=None, ... |
the-stack_0_4023 | import datetime
import os
from pyhmy.logging import ControlledLogger
_config = {
"AMT_PER_TXN": [1e-9, 1e-9], # The random range for each transaction in the transaction-generation
"NUM_SRC_ACC": 32, # The number of possible source accounts for all transactions, higher = more tps
"NUM_SNK_ACC": 1, # The ... |
the-stack_0_4024 | import sys, os
import pandas as pd
from tqdm import tqdm
from Bio import SeqIO
import argparse
from multiprocessing import Pool
import pickle
import numpy as np
class QuadruplexFinder(object):
def __init__(self, fasta_file, output_path = '',
GC='G', L=7, q=4, nquadruplets=4, mdef=1, tetdef=1, len_bulge=1, max_b... |
the-stack_0_4025 | import time
import wiotp.sdk.device
def myCommandCallback(cmd):
print("Command received: %s" % cmd.data)
# Configure
myConfig = {
"identity": {
"orgId": "j4fntv",
"typeId": "Cambien",
"deviceId": "cambien001"
},
"auth": {
"token": "12345678"
},
"options": {
... |
the-stack_0_4026 | from django.db import models
from django.urls import reverse
from django.utils import timezone
from django_countries import fields
from core.dj_import import get_user_model
from core.models import IntegerRangeField
from core.utils import getReverseWithUpdatedQuery
from mode... |
the-stack_0_4027 | import argparse
import os
import shutil
import sys
from pathlib import Path
from typing import Any, Callable, Dict, Optional, Union
import pkg_resources
import yaml
from apple.util.path import mkdir
def initial_config_file(filename: Union[str, Path]) -> str:
return pkg_resources.resource_string(__name__, f"init... |
the-stack_0_4033 | # -*- test-case-name: twisted.test.test_adbapi -*-
# Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.
"""
An asynchronous mapping to U{DB-API
2.0<http://www.python.org/topics/database/DatabaseAPI-2.0.html>}.
"""
import sys
from twisted.internet import threads
from twisted.python import reflect, ... |
the-stack_0_4034 | # coding:utf-8
rarity_id = {1: 549,
2: 551,
3: 553,
4: 555,
5: 557,
6: 559,
7: 561,
8: 563,
'1': 549,
'2': 551,
'3': 553,
'4': 555,
'5': 557,
'6': 559,... |
the-stack_0_4035 | # Copyright 2013-2018 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class Channelflow(CMakePackage):
"""Channelflow is a software system for numerical analysis of t... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.