filename
stringlengths
13
19
text
stringlengths
134
1.04M
the-stack_0_2692
import pytest from abridger.extraction_model import Relation from abridger.schema import SqliteSchema from test.unit.extractor.base import TestExtractorBase class TestExtractorSubjectRelationReProcessingIncoming(TestExtractorBase): @pytest.fixture() def schema1(self): for stmt in [ ''' ...
the-stack_0_2693
import unittest from mock import patch, call, Mock import update_data_after_sync class FakeCollection(object): def find(self): return [ {'topic_id': 'UKGOVUK_1', '_id': 'https://www.gov.uk/feed?a=b&c=d', 'created': '2013-08-01T12:53:31Z'}, {'topic_id': 'UKGOVUK_2', '_id': 'https:/...
the-stack_0_2694
#!/usr/bin/env python """mergesort.py: Program to implement merge sort""" __author__ = 'Rohit Sinha' def merge_sort(alist): if len(alist) <= 1: return alist middle = len(alist) / 2 left = alist[:middle] right = alist[middle:] left = merge_sort(left) right = merge_sort(right) r...
the-stack_0_2696
import numpy as np import paddle import paddle.nn as nn import paddle.nn.functional as F from paddle.distribution import Normal def rsample(loc, scale): shape = loc.shape normal_ = paddle.nn.initializer.Normal() eps = paddle.empty(shape, dtype=loc.dtype) normal_(eps) return loc + eps * scale clas...
the-stack_0_2701
import dash import dash_core_components as dcc import dash_html_components as html from dash.dependencies import Input, Output import plotly.graph_objects as go from plotly.subplots import make_subplots import joblib from drain3.drain import Drain import numpy as np collections = joblib.load("results/collections.jobli...
the-stack_0_2702
# Copyright 2020 The TensorFlow Quantum 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...
the-stack_0_2703
# Copyright 2018 The Cirq Developers # # 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 agreed to in ...
the-stack_0_2705
from __future__ import print_function, division import itertools try: import pathlib except ImportError: import pathlib2 as pathlib import json import os def composite_channel(target, image, color, range_min, range_max): ''' Render _image_ in pseudocolor and composite into _target_ Args: targe...
the-stack_0_2706
import errno import os import random import re import shutil import subprocess import sys import textwrap import uuid from datetime import date from distutils.core import Command import boto3 import pkg_resources import requests from botocore.handlers import disable_signing from cookiecutter.main import cookiecutter f...
the-stack_0_2707
import RPi.GPIO as GPIO import time GPIO.setwarnings(False) GPIO.setmode (GPIO.BOARD) GPIO.setup (12,GPIO.OUT) p = GPIO.PWM(12, 50) duty = 0 p.start(duty) for change_duty in range(0,101,10): p.ChangeDutyCycle(change_duty) time.sleep(0.1) for change_duty in range(100, -1, -10): p.ChangeDutyCycle(change_du...
the-stack_0_2710
''' @author:yk 基于直方图变换的风格迁移 修改os.chdir 输入python style.py xx.jpg(待变化的图片) xx.jpg(目标风格的图片) ''' import cv2 as cv import numpy as np import random import os import matplotlib.pyplot as plt import sys os.chdir("C:\\Users\\m\\Desktop\\第三次作业") def show(img,name="img"): #显示图像 cv.imshow(name,img) cv.waitK...
the-stack_0_2711
""" Divide By Mean ============== """ import logging from functools import partial import numpy as np from .fitness_normalizer import FitnessNormalizer logger = logging.getLogger(__name__) class DivideByMean(FitnessNormalizer): """ Divides fitness values by the population mean. While this function c...
the-stack_0_2712
# Copyright 2018 The TensorFlow 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 applica...
the-stack_0_2713
import numpy as np import h5py import pandas as pd from typing import Any, Callable from scipy.stats import binned_statistic from scipy.interpolate import interp1d from sklearn.utils import resample from imblearn.over_sampling import SMOTE def get_data(arg_label:str, boxsize:int=100, path_to_file:st...
the-stack_0_2714
# -*- coding: utf-8 -*- ''' Execute an unmodified puppet_node_classifier and read the output as YAML. The YAML data is then directly overlaid onto the minion's Pillar data. ''' # Don't "fix" the above docstring to put it on two lines, as the sphinx # autosummary pulls only the first line for its description. # Import...
the-stack_0_2716
from __future__ import absolute_import from __future__ import print_function from amitools.fs.block.Block import * import amitools.fs.DosType as DosType class PartitionDosEnv: valid_keys = ('max_transfer', 'mask', 'num_buffer', 'reserved', 'boot_pri', 'pre_alloc', 'boot_blocks') def __init__(self, size=16, block...
the-stack_0_2717
import DSGRN from DSGRN import * import networkx as nx import matplotlib.pyplot as plt from copy import deepcopy import os from all_networks_with_n_nodes_e_edges import * from save_files import * from GradientFun import * from get_FG import * from get_FP_Poset import * from networkx_cond import * def reduce_gradient_g...
the-stack_0_2718
from torch import Tensor from torch.autograd import Variable from torch.optim import Adam from itertools import chain from utils.misc import hard_update from utils.policies import DiscretePolicy import torch.nn.functional as F class Agent(object): """ General class for agents (policy, target policy, etc) "...
the-stack_0_2719
import logging.config import tkinter as tk from tkinter import ttk class StudentPage(tk.Frame): ''' Class creates Student Page frame. ''' def __init__(self, master, controller): ''' Initialize Student page ''' ttk.Frame.__init__(self, master) self.logger = loggi...
the-stack_0_2721
import numpy as np from PIL import Image import cv2 import matplotlib.pyplot as plt import pickle from matplotlib import style import time style.use("ggplot") SIZE = 20 HM_EPISODES = 25000 MOVE_PENALTY = 1 ENEMY_PENALTY = 300 FOOD_REWARD = 25 epsilon = 0.9 EPS_DECAY = 0.9998 SHOW_EVERY = 1000 start_q_table = None #'...
the-stack_0_2723
from typing import Dict, Iterable import sqlalchemy.sql.expression as sql from sqlalchemy.orm import selectinload from transiter.db import dbconnection, models def list_groups_and_maps_for_stops_in_route(route_pk): """ This function is used to get the service maps for a route. It returns a list of tupl...
the-stack_0_2725
# -*- coding: UTF-8 -*- # Copyright 2010-2018 Rumma & Ko Ltd # License: BSD (see file COPYING for details) import logging logger = logging.getLogger(__name__) from django.utils.translation import ugettext_lazy as _ from lino.modlib.office.roles import OfficeStaff from lino.api import dd, rt class Shortcut(dd.Choi...
the-stack_0_2726
import cv2 from PIL import Image import numpy as np from subprocess import Popen, PIPE from enum import IntEnum, auto import sys, math, os, time, argparse import threading import queue from keras.models import load_model import tensorflow as tf sys.path.append(os.path.join(os.path.dirname(__file__), 'UGATIT')) from ...
the-stack_0_2727
""" As Rigid as Possible Interpolation from a pair of Mesh structures """ from Escher.Geometry import Mesh from typing import List import numpy as np import Escher.GeometryRoutines as geom import Escher.AlgebraRoutines as alg import logging from scipy.linalg import block_diag from scipy.spatial.transform import Slerp,...
the-stack_0_2728
import abc import itertools from dataclasses import dataclass, field from typing import ( Any, ClassVar, Dict, Tuple, Iterable, Optional, List, Callable, ) from dbt.exceptions import InternalException from dbt.utils import translate_aliases from dbt.logger import GLOBAL_LOGGER as logger from typing_extensions impor...
the-stack_0_2729
#!/usr/bin/env python3 import torch from enum import Enum from inspect import signature from .approximation_methods import SUPPORTED_METHODS class ExpansionTypes(Enum): repeat = 1 repeat_interleave = 2 def safe_div(denom, quotient, default_value=None): r""" A simple utility function to perfor...
the-stack_0_2730
import unittest import matplotlib import pkmodel as pk class SolutionTest(unittest.TestCase): """ Tests the :class:`Solution` class. """ def test_create(self): """ Tests Solution creation. """ protocol = pk.Protocol("test", 3, 1.1, 2.2, 3.3, 4.4, 5.5, 6, 7, 8, False) ...
the-stack_0_2731
""" war War card game written for fun while following the 'Complete Python Developer Certification Course' by Imtiaz Ahmad, on Udemy. """ import sys from setuptools import setup, find_packages import versioneer short_description = __doc__.split("\n") # from https://github.com/pytest-dev/pytest-runner#conditional-requ...
the-stack_0_2733
from dissononce.processing.handshakepatterns.handshakepattern import HandshakePattern class IK1HandshakePattern(HandshakePattern): def __init__(self, ): super(IK1HandshakePattern, self).__init__( 'IK1', responder_pre_message_pattern=('s',), message_patterns=( ...
the-stack_0_2735
import matplotlib.pyplot as plt from .artists import kdeplot_op, kde2plot_op def kdeplot(data, ax=None): if ax is None: _, ax = plt.subplots(1, 1, squeeze=True) kdeplot_op(ax, data) return ax def kde2plot(x, y, grid=200, ax=None, **kwargs): if ax is None: _, ax = plt.subplots(1, 1, ...
the-stack_0_2736
# coding=utf-8 # Copyright 2020 The HuggingFace Inc. team. # # 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_2737
from ups_byt_test import * import time file_name = 'inout_0.4_test.txt' # time formats format_time_old = "%W %j %A %d.%m.%Y %H:%M:%S" format_time_new = "%d.%m.%Y %H:%M:%S" ups_data = {} for c in range(len(ups_member_card)): for key, value in ups_member_card.items(): ups_data[key] = { "inout_log" : [], } ...
the-stack_0_2738
#!/usr/bin/env python3 import subprocess import jinja2 num_redis_hosts = 3 # create proxy config file template = open('proxy/envoy.yaml.j2').read() config = jinja2.Template(template).render(num_redis_hosts = num_redis_hosts) envoy_yaml = open('proxy/envoy.yaml', 'w') envoy_yaml.write(config) # start containers s...
the-stack_0_2739
"""Data models.""" from attr import attrib, attrs @attrs class Card: """Card. created An ISO 8601 timestamp for when the card was created cvv Three digit cvv printed on the back of the card funding See FundingAccount exp_month Two digit (MM) expiry month exp_year Four digit (YYYY) exp...
the-stack_0_2741
# fast.py # Mission Pinball Framework # Written by Brian Madden & Gabe Knuth # Released under the MIT License. (See license info at the end of this file.) # Documentation and more info at http://missionpinball.com/framework import logging import fastpinball import time from mpf.system.timing import Timing from mpf.s...
the-stack_0_2742
from fastapi import APIRouter, Request import json from typing import List from loguru import logger from starlette.templating import _TemplateResponse from app.config import RESOURCES_DIR from app.dependencies import templates router = APIRouter() def credits_from_json() -> List: path = RESOURCES_DIR / "credi...
the-stack_0_2743
def run(line, start_panel): num_of_operands = [0, 3, 3, 1, 1, 2, 2, 3, 3, 1] program = [int(x) for x in line]+[0]*10000 i, base = 0, 0 panels, pos, outputs = {(0,0):start_panel}, (0,0), [] directions, dir_idx = [(-1,0), (0,1), (1,0), (0,-1)], 0 while program[i] != 99: modes = [int(x) for...
the-stack_0_2744
from nltk.cluster import KMeansClusterer, cosine_distance # will get nan when u v are zero? import pandas as pd from sklearn.cluster import KMeans from gensim.utils import tokenize import pyLDAvis from gensim.models import LdaModel from gensim.corpora.dictionary import Dictionary import pandas as pd import numpy as np...
the-stack_0_2746
# Copyright 2017,2018,2019,2020,2021 Sony 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 License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law...
the-stack_0_2748
""""Groups UI URLs Copyright 2015 Archive Analytics Solutions 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_2749
import warnings from collections import Counter from encodings.aliases import aliases from hashlib import sha256 from json import dumps from re import compile as re_compile, sub from typing import Any, Dict, Iterator, List, Optional, Set, Tuple, Union from .constant import TOO_BIG_SEQUENCE from .md import mess_ratio f...
the-stack_0_2750
import ast from dotmap import DotMap from typing import Union, List from .utils import visualize_1D_lcurves class MetaLog(object): meta_vars: List[str] stats_vars: List[str] time_vars: List[str] num_configs: int def __init__(self, meta_log: DotMap, non_aggregated: bool = False): """Class ...
the-stack_0_2752
# 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 logging import os import sy...
the-stack_0_2753
# Copyright 2014 PerfKitBenchmarker 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 appli...
the-stack_0_2754
#!/usr/bin/env python # -*- coding: utf-8 -*- from setuptools import setup # with open('README.rst') as readme_file: # readme = readme_file.read() # with open('HISTORY.rst') as history_file: # history = history_file.read() requirements = [ 'face_recognition_models>=0.3.0', 'Click>=6.0', 'dlib>=1...
the-stack_0_2755
import copy from engine.global_config import * from engine.update_client import Update_Client from engine.handler.input_handler import Input_Handler from engine.status_check import Status_Check from websocket_server.wswrap import WsWrap from engine.character import Character from engine.lex import Lex from engine.in...
the-stack_0_2756
"""Select and extract key frames in a video file. Key frames are defined as a set of frames where each has an appropriate number of matching points with its adjacent key frame. RANSAC is applied to reduce the number of mismatched points and outliers. """ import cv2 import numpy as np import argparse def main(videofil...
the-stack_0_2758
"""distutils.command.bdist Implements the Distutils 'bdist' command (create a built [binary] distribution).""" __revision__ = "$Id$" import os from distutils.core import Command from distutils.errors import * from distutils.util import get_platform def show_formats(): """Print list of available formats (argume...
the-stack_0_2761
import os import random from unittest import mock import requests import string import time import signal import socket import subprocess import uuid import sys import yaml import pandas as pd import pytest import mlflow import mlflow.pyfunc.scoring_server as pyfunc_scoring_server import mlflow.pyfunc from mlflow.tr...
the-stack_0_2763
"""TorchScript This module contains functionality to support the JIT's scripting frontend, notably: - torch.jit.script This is not intended to be imported directly; please use the exposed functionalities in `torch.jit`. """ import functools import collections import enum import inspect import copy import pickle i...
the-stack_0_2766
import os import re import yaml from os.path import join as pjoin def find_test_file(filename, module=None): """Looks for a test case or related file in the following order: - test_cases/module/filename (if module) - test_cases/module/filename.yml (if module) - test_cases/filename ...
the-stack_0_2767
def findDecision(obj): #obj[0]: Passanger, obj[1]: Weather, obj[2]: Time, obj[3]: Coupon, obj[4]: Coupon_validity, obj[5]: Gender, obj[6]: Age, obj[7]: Maritalstatus, obj[8]: Children, obj[9]: Education, obj[10]: Occupation, obj[11]: Income, obj[12]: Bar, obj[13]: Coffeehouse, obj[14]: Restaurant20to50, obj[15]: Direct...
the-stack_0_2768
#!/usr/bin/python import sys import json def tablevel(tbl): ret = "" if tbl < 0: return "" else: for i in xrange(tbl): ret = ret + "\t" return ret def funcstrmkr(func, funcname, type): tbl = 0 funcstr = '' # funcstr += "var "+funcname+" = function(" funcstr += "Egg.prototype." + funcname + " = functi...
the-stack_0_2770
# -*- coding: utf-8 -*- # Copyright (c) 2010-2016, MIT Probabilistic Computing Project # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENS...
the-stack_0_2771
# not working, not sure why (as parts work separately # outside of function) # (User's) Problem # We have: # a string # We need: # is that string a paindrome? yes/no # We must: # boolean output # name of function is # checkPalindrome # Solution (Product) # Strategy 1: # turn string into a list...
the-stack_0_2772
import numpy as np import cv2 import time import random from Markov import Get_Markov P = Get_Markov() TILE_SIZE = 32 OFS = 50 MARKET = """ ################## ##..............## #R..HA..ME..IB..P# #R..HA..ME..IB..P# #R..HA..ME..IB..P# #Y..HA..ME..IB..P# #Y..HA..ME..IB..P# ##...............# ##..C#..C#..C#...# ##..##...
the-stack_0_2773
from typing import Any, Dict, List, Optional import httpx from ...client import Client from ...models.suggester import Suggester from ...types import Response def _get_kwargs( project_name: str, *, client: Client, ) -> Dict[str, Any]: url = "{}/projects/{projectName}/suggesters".format(client.base_u...
the-stack_0_2775
import re import sys import uuid from collections import defaultdict from contextlib import contextmanager from io import BytesIO from hashlib import sha1 from itertools import chain from os.path import join from corehq.blobs import get_blob_db, CODES # noqa: F401 from corehq.blobs.exceptions import AmbiguousBlobStor...
the-stack_0_2780
import re from models import Landmark from utils import session_scope NORTH = 0 EAST = 1 SOUTH = 2 WEST = 3 LEFT = -1 RIGHT = 1 SIDES_OF_WORLD = {'north': NORTH, 'east': EAST, 'south': SOUTH, 'west': WEST} ALL_SIDES_OF_THE_WORLD = ['north', 'east', 'south', 'west'] LEFT_RIGHT = {'left': LEFT, 'right': RIGHT} clas...
the-stack_0_2781
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Plotting terminal based histograms """ from __future__ import print_function from __future__ import division import os import sys import math import optparse from os.path import dirname from .utils.helpers import * from .utils.commandhelp import hist def calc_bins(...
the-stack_0_2785
from flask import Flask import pytest import os import importlib import sys import traceback MODULE_NAMES = ['numpy'] modules = {} for m in MODULE_NAMES: try: modules[m] = importlib.import_module(m) except ImportError: modules[m] = None app = Flask(__name__) @app.route('/<module_name>') def...
the-stack_0_2789
from blueman.Functions import * import gettext from blueman.plugins.AppletPlugin import AppletPlugin from blueman.main.SignalTracker import SignalTracker from gi.repository import GObject from gi.repository import Gtk class DiscvManager(AppletPlugin): __depends__ = ["Menu"] __author__ = "Walmis" __icon_...
the-stack_0_2790
#!/usr/bin/env python # ***************************************************************** # (C) Copyright IBM Corp. 2021. 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...
the-stack_0_2791
import functools import operator import os from collections import OrderedDict from datetime import date, datetime, time from operator import methodcaller import numpy as np import pandas as pd import pytest import toolz import ibis import ibis.common.exceptions as com import ibis.expr.analysis as L import ibis.expr....
the-stack_0_2792
#!/usr/bin/env python # -*- coding: utf-8 -*- # vim: et sw=4 ts=4 ''' Copyright (c) 2008, Yahoo! Inc. All rights reserved. Code licensed under the BSD License: http://developer.yahoo.net/yui/license.html version: 1.0.0b1 ''' import yuidoc_parse, yuidoc_highlight, yuidoc_generate def main(): from op...
the-stack_0_2793
import ipaddress import os import re from urllib.parse import urlsplit, urlunsplit from django.core.exceptions import ValidationError from django.utils.deconstruct import deconstructible from django.utils.functional import SimpleLazyObject from django.utils.ipv6 import is_valid_ipv6_address from django.utils.translati...
the-stack_0_2794
# -*- coding: utf-8 -*- ''' The AWS Cloud Module ==================== The AWS cloud module is used to interact with the Amazon Web Services system. This module has been replaced by the EC2 cloud module, and is no longer supported. The documentation shown here is for reference only; it is highly recommended to change ...
the-stack_0_2795
# Copyright 2019 Ross Wightman # Copyright 2021 Huawei Technologies Co., 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...
the-stack_0_2796
import random import numpy as np from xgboost.sklearn import XGBClassifier action_list = [] observation_list = [] result_list = [] def i_win(me, you): return int((me - you + 4) % 3) - 1 # for i in range(3): # text = "" # for j in range(3): # text += f'{i_win(i, j)} ' # print(f'{text}') d...
the-stack_0_2798
import pytest from hiku.executors.asyncio import AsyncIOExecutor from hiku.federation.endpoint import ( FederatedGraphQLEndpoint, AsyncFederatedGraphQLEndpoint, ) from hiku.federation.engine import Engine from hiku.executors.sync import SyncExecutor from tests.test_federation.utils import ( GRAPH, ASY...
the-stack_0_2799
from setuptools import setup dependencies = ["numpy", "scipy", "numba"] def readme(): with open('README.md') as f: return f.read() setup(name='PyRADS', version='0.1.0', description='PyRADS is the "Python line-by-line RADiation model for planetary atmosphereS"',...
the-stack_0_2800
import os import time import matplotlib.pyplot as plt import numpy as np from matplotlib.patches import Rectangle from source import utils from source.constants import Constants class DataPlotBuilder(object): @staticmethod def timestamp_to_string(ts): return time.strftime('%H:%M:%S', time.localtime(...
the-stack_0_2801
"""Utility functions with no non-trivial dependencies.""" import os import pathlib import re import subprocess import sys import hashlib import io import shutil import time from typing import ( TypeVar, List, Tuple, Optional, Dict, Sequence, Iterable, Container, IO, Callable ) from typing_extensions import Final,...
the-stack_0_2802
""" Regression Template """ # Importing the libraries import numpy as np import matplotlib.pyplot as plt import pandas as pd def main(): # Importing the dataset dataset = pd.read_csv('Position_Salaries.csv') X = dataset.iloc[:, 1:2].values y = dataset.iloc[:, 2].values # Splitting the dataset in...
the-stack_0_2805
def graph_to_tree(N, edges, root): from collections import defaultdict children = defaultdict(list) parents = [None] * N root = 0 parents[root] = root stack = [root] while stack: v = stack.pop() for u in edges[v]: if parents[u] is not None: # alrea...
the-stack_0_2806
from dask import dataframe as dd import datetime def time_exe(): now = datetime.datetime.now() print (now.strftime("%Y-%m-%d %H:%M:%S")) def chunk_filtering_yearwise_data(data_): return data_[(data_[5]>1994) & (data_[5] <2006)] chunksize = 64000000*1 #64000000 is equl to 64 MB, making it as around 512...
the-stack_0_2808
from pathlib import Path import sys from selenium.common.exceptions import TimeoutException import re import subprocess import json from typing import List, Dict # pycharm complains that build_assets is an unresolved ref # don't worry about it, the script still runs from build_assets.selenium_runner.BuildSeleniumRunn...
the-stack_0_2809
import rdkit import rdkit.Chem as Chem import numpy as np import pandas as pd import os # import tensorflow as tf elem_list = ['C', 'O', 'N', 'F', 'Br', 'Cl', 'S', 'Si', 'B', 'I', 'K', 'Na', 'P', 'Mg', 'Li', 'Al', 'H'] atom_fdim_geo = len(elem_list) + 6 + 6 + 6 + 1 bond_fdim_geo = 6 bond_fdim_qm = 25 +...
the-stack_0_2811
#!/usr/bin/env python # D. Jones - 1/10/14 """This code is from the IDL Astronomy Users Library with modifications from Dan Scolnic. (adapted for IDL from DAOPHOT, then translated from IDL to Python). Subroutine of GETPSF to perform a one-star least-squares fit, part of the DAOPHOT PSF photometry sequence. This vers...
the-stack_0_2812
import tensorflow as tf data_path = 'train.tfrecord' with tf.Session() as sess: feature = {"image_raw": tf.FixedLenFeature([], tf.string), "label": tf.FixedLenFeature([], tf.int64)} # Create a list of filenames and pass it to a queue filename_queue = tf.train.string_input_producer([data_path...
the-stack_0_2815
import asyncio import json import logging import time from pathlib import Path from typing import Any, Callable, Dict, List, Optional, Tuple import traceback import aiohttp from blspy import AugSchemeMPL, G1Element, G2Element, PrivateKey import chia.server.ws_connection as ws # lgtm [py/import-and-import-from] from ...
the-stack_0_2816
import os import tensorflow as tf from datetime import datetime import sys sys.path.append('') import helper # Load the dataset (train_images, train_labels), (test_images, test_labels) = helper.load_data() # Flat and normalize train_images = train_images /255.0 test_images = test_images / 255.0 # D...
the-stack_0_2821
#!/usr/bin/env python import tensorflow as tf import math import os import numpy as np # Define parameters flags = tf.app.flags FLAGS = flags.FLAGS flags.DEFINE_float('learning_rate', 0.01, 'Initial learning rate.') flags.DEFINE_integer('epoch_number', None, 'Number of epochs to run trainer.') flags.DEFINE_integer("b...
the-stack_0_2823
import urllib import requests from appi.debugging.log_handling import setup_logger, close_log_handlers class APIController: def __init__(self, base_url, table_name, log_filename): self.base_url = base_url self.table_name = table_name self.column_url = self.base_url + f"api/v1/resources/{se...
the-stack_0_2826
import numpy as np from lazy import lazy from .cec2013lsgo import CEC2013LSGO class F7(CEC2013LSGO): """ 7-nonseparable, 1-separable Shifted and Rotated Elliptic Function """ def __init__( self, *, rng_seed: int = 42, use_shuffle: bool = False, verbose: int = ...
the-stack_0_2827
#CODE3---First concatenating the required files into one based on the specfic attribute columns from SMPDB database and protein network--- #Python 3.6.5 |Anaconda, Inc. import sys import glob import errno import csv path = '/home/16AT72P01/Excelra/SMPDB/smpdb_proteins/*.csv' files = glob.glob(path) with open("/home/...
the-stack_0_2828
#!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import math from dataclasses import dataclass import crypten import torch from ..util import ConfigBase __all__ = ...
the-stack_0_2831
#!/usr/bin/python # Copyright 2010 Google Inc. # Licensed under the Apache License, Version 2.0 # http://www.apache.org/licenses/LICENSE-2.0 # Google's Python Class # http://code.google.com/edu/languages/google-python-class/ import sys import re import os import shutil import subprocess """Copy Special exercise """ ...
the-stack_0_2833
import asyncio import logging import os from watchdog.events import FileModifiedEvent, PatternMatchingEventHandler from watchdog.observers import Observer from watchdog.utils.patterns import match_any_paths class WatcherHandler(PatternMatchingEventHandler): """Watcher class to observe changes in all specified fi...
the-stack_0_2834
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # (c) 2016, Tomoyuki Sakurai <y@trombik.org> # # This file is NOT part of Ansible # # Ansible is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of...
the-stack_0_2835
""" Author: Ce Li Tool for generator """ import copy import math import numpy as np from tensorflow.keras import utils as np_utils EPSILON = 1e-7 class Generator(np_utils.Sequence): def __init__(self, x, x_authors, y, b_size, max_papers, max_seq, max_authors): self.x, self.x_authors, self.y = x, x_auth...
the-stack_0_2836
# This code is part of Qiskit. # # (C) Copyright IBM 2017, 2019. # # This code is licensed under the Apache License, Version 2.0. You may # obtain a copy of this license in the LICENSE.txt file in the root directory # of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. # # Any modifications or derivat...
the-stack_0_2837
from argparse import Namespace import asyncio import logging import signal import sys from typing import Type from evm.chains.mainnet import ( MAINNET_NETWORK_ID, ) from evm.chains.ropsten import ( ROPSTEN_NETWORK_ID, ) from evm.db.backends.base import BaseDB from evm.db.backends.level import LevelDB from p2p...
the-stack_0_2838
# Princeton University licenses this file to You 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 writin...
the-stack_0_2840
# coding: utf-8 import pprint import re import six class Tag: """ Attributes: openapi_types (dict): The key is attribute name and the value is attribute type. attribute_map (dict): The key is attribute name and the value is json key in...
the-stack_0_2841
# coding: utf-8 """Dumb VPR model development""" import matplotlib.pyplot as plt def vpr_median(cc_r, km_above_ml=1100): """vpr diffs based on median ze above ml""" z = cc_r.data.zh.iloc[0, :] zt = cc_r.cl_data.zh.loc[:, km_above_ml] cl = cc_r.classes() mz = z.groupby(cl).median() mzt = zt.gr...
the-stack_0_2842
""" # Copyright 2021 21CN Corporation Limited # # 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_2845
#!/usr/bin/env python ############################################################################### # $Id: gdal2grd.py 18195 2009-12-06 20:24:39Z rouault $ # # Project: GDAL Python samples # Purpose: Script to write out ASCII GRD rasters (used in Golden Software # Surfer) # from any source supported b...
the-stack_0_2846
"""Test cases for AST merge (used for fine-grained incremental checking)""" import os import shutil from typing import List, Tuple, Dict, Optional from mypy import build from mypy.build import BuildResult from mypy.modulefinder import BuildSource from mypy.defaults import PYTHON3_VERSION from mypy.errors import Compi...
the-stack_0_2848
# 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 u...