filename
stringlengths
13
19
text
stringlengths
134
1.04M
the-stack_0_6102
from argparse import ArgumentParser from datetime import datetime, timedelta import pytz import time import curses from attrdict import AttrDict from hydra.app import HydraApp from hydra.rpc.base import BaseRPC from hydra.test import Test COLOR_GOOD = 2 COLOR_WARN = 8 COLOR_ERROR = 4 COLOR_ETC = 10 @HydraApp.regi...
the-stack_0_6103
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ('trackbuild', '0005_release_previous'), ] operations = [ migrations.AlterField( model_name='release', ...
the-stack_0_6104
#------------------------------------------------------------------------------- # Name: apputils.py # Purpose: # # Author: wukan # # Created: 2019-01-08 # Copyright: (c) wukan 2019 # Licence: GPL-3.0 #------------------------------------------------------------------------------- from n...
the-stack_0_6105
from test.cl_node.docker_node import DockerNode from test.cl_node.casperlabs_accounts import Account def test_scala_client_balance(one_node_network): node: DockerNode = one_node_network.docker_nodes[0] # This is only in scala client, need to verify we are using correct one. node.use_docker_client() ...
the-stack_0_6107
# -*- coding: utf-8 -*- """ Created on Tue Sep 8 03:32:57 2020 @author: Jon """ import numpy as np from numpy import genfromtxt import matplotlib.pyplot as plt import pandas as pd from numba import jit def ms2_loading_coeff(kappa,W): alpha = kappa coeff = np.ones((1,W), dtype=float) alpha_ceil = np....
the-stack_0_6108
import time import win32gui import win32ui import win32con import win32api from cnocr import CnOcr import os def window_capture(filename, pofw, pofh, wpct, hpct, imgfmt): """capture specified window and specified screen area's filename.jpg image by win32gui""" # 获取指定名称进程的窗口号 hwnd = win32gui.Fi...
the-stack_0_6110
# -*- coding: utf-8 -*- # # Copyright (c) nexB Inc. and others. All rights reserved. # http://nexb.com and https://github.com/nexB/scancode-toolkit/ # The ScanCode software is licensed under the Apache License version 2.0. # Data generated with ScanCode require an acknowledgment. # ScanCode is a trademark of nexB Inc. ...
the-stack_0_6111
""" Endpoints to get the schemas """ # Import from libraries from cornflow_client.airflow.api import Airflow from flask import current_app, request from flask_apispec import marshal_with, doc import logging as log from cornflow_core.authentication import authenticate # Import from internal modules from ..models impor...
the-stack_0_6113
# Lint as: python3 # Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agr...
the-stack_0_6115
#!/usr/bin/env python ''' aaa ''' import os import urllib import zipfile import platform import sys import subprocess import tempfile import argparse from retry import retry DIR_PATH = os.path.dirname(os.path.realpath(__file__)) COCOS2D_X = os.path.abspath(os.path.join(DIR_PATH, "../..")) # ROOT_DIR/...
the-stack_0_6116
#!/usr/bin/env python # coding: utf-8 """ Plot Fig.3 from paper. """ from __future__ import print_function, unicode_literals import os import sys import matplotlib matplotlib.use('Agg') import matplotlib.gridspec as gridspec import matplotlib.pyplot as plt import numpy as np import scipy.special import progressbar s...
the-stack_0_6119
# Time complexity: O(m*n) # Approach: DP Solution (https://www.geeksforgeeks.org/count-distinct-occurrences-as-a-subsequence/) class Solution: def numDistinct(self, s: str, t: str) -> int: m, n = len(t), len(s) if m>n: return 0 dp = [[0]*(n+1) for i in range(m+1)] for i ...
the-stack_0_6120
import tensorflow as tf import grpc from tensorflow_serving.apis import prediction_service_pb2_grpc, predict_pb2 model_name = "address" host = "10.100.51.111" port = 8090 timeout = 10.0 channel = grpc.insecure_channel("%s:%d" % (host, port)) stub = prediction_service_pb2_grpc.PredictionServiceStub(channel) def sen...
the-stack_0_6121
import typing as t from . import Markup def escape(s: t.Any) -> Markup: """Replace the characters ``&``, ``<``, ``>``, ``'``, and ``"`` in the string with HTML-safe sequences. Use this if you need to display text that might contain such characters in HTML. If the object has an ``__html__`` method, i...
the-stack_0_6123
# -*- coding: utf-8 -*- """ Created on Sun Jul 5 11:00:05 2020 @author: hto_r """ import torch from torchvision import datasets, transforms , models from torch import nn, optim import torch.nn.functional as F def DL_model (HL_1, HL_2, Activation_function, dropout): """ Function to define a simple 2...
the-stack_0_6124
from django.urls import path, include from profiles_api_app import views from rest_framework.routers import DefaultRouter #definig a router router = DefaultRouter() router.register('HelloViewSet/', views.HelloViewSet, base_name='HelloViewSet') router.register('profile/', views.UserProfileViewSet) urlpatterns = [ ...
the-stack_0_6125
from __future__ import print_function import argparse import keras import os import sys from keras import models from keras.models import load_model, Model from keras.datasets import mnist from keras.layers import Input from scipy.misc import imsave from copy import deepcopy import random import matplotlib.pyplot as ...
the-stack_0_6126
import os import unittest from ate import utils, runner from ate.context import Context from ate.exception import ParamsError class VariableBindsUnittest(unittest.TestCase): def setUp(self): self.context = Context() testcase_file_path = os.path.join(os.getcwd(), 'tests/data/demo_binds.yml') ...
the-stack_0_6128
height = int(input()) for i in range(height,0,-1): for j in range(i,height): print(end=" ") for j in range(1,i+1): if(i%2 == 0): print(j,end=" ") else: c = chr(j+64) print(c,end=" ") print() # Sample Input :- 5 # Output :- ...
the-stack_0_6129
"""Contains functions to scrap the text from URLs given by Bing.""" import logging import re from typing import Tuple, List, Union from newspaper import Article from nltk.corpus.reader.wordnet import Synset from filepath_handler import get_article_dir, get_url_path logger = logging.getLogger(__name__) def grab_te...
the-stack_0_6131
from __future__ import absolute_import from __future__ import division from __future__ import print_function import numpy as np import cv2 from .ddd_utils import compute_box_3d, project_to_image, draw_box_3d class Debugger(object): def __init__(self, ipynb=False, theme='black', num_classes=-1, datas...
the-stack_0_6132
from torch2trt.torch2trt import * from torch2trt.module_test import add_module_test from .identity import * @tensorrt_converter('torch.Tensor.flatten') @tensorrt_converter('torch.flatten') def convert_flatten(ctx): input = ctx.method_args[0] start_dim = get_arg(ctx, 'start_dim', pos=1, defa...
the-stack_0_6137
#!/usr/bin/env python3 import argparse import inspect import json import os import sys from functools import partial from importlib import import_module from fan_tools.doc_utils.fan_sphinx.dyn_json import serializer_doc_info from django.core.serializers.json import DjangoJSONEncoder from rest_framework_dyn_serialize...
the-stack_0_6138
# Copyright 2018 Espressif Systems (Shanghai) PTE 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 ...
the-stack_0_6140
import csv import os import sys import datetime import matplotlib.pyplot as plt import numpy as np import json import copy sys.path.append("API_Related_Files") #import API_Related_Files.API_Call_Methods """ The default data format for audit trails is: [index, event time, document, tab, user, description, feature ref...
the-stack_0_6142
import logging from mongoengine import Document from mongoengine import StringField, IntField from django.conf import settings from crits.core.crits_mongoengine import CritsDocument, CritsSchemaDocument logger = logging.getLogger(__name__) class Sector(CritsDocument, CritsSchemaDocument, Document): """ CRI...
the-stack_0_6143
""" :mod:`redis_helpers` Helper Classes and Functions for managing BIBFrAME Organization Authorities in the Redis Library Services Platform """ __author__ = "Jeremy Nelson" import re from bibframe.models import Organization from person_authority.redis_helpers import process_name from aristotle.settings import REDIS_...
the-stack_0_6144
# -*- coding: UTF-8 -*- # vim: set expandtab sw=4 ts=4 sts=4: # # phpMyAdmin web site # # Copyright (C) 2008 - 2016 Michal Cihar <michal@cihar.com> # # This program 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 Foundati...
the-stack_0_6146
""" ;========================================== ; Title: Data Validation with Apache Spark and Python ; Author: Harshal Vasant Dhake ; Date: 15-Aug-2019 ;========================================== """ from __future__ import print_function import generateSql import math import sys from pyspark.sql import SparkSessio...
the-stack_0_6148
""" Summary module tests """ import unittest from txtai.pipeline import Textractor # pylint: disable = C0411 from utils import Utils class TestTextractor(unittest.TestCase): """ Textractor tests """ def testParagraphs(self): """ Tests extraction to paragraphs """ t...
the-stack_0_6153
# -*- coding: utf-8 -*- """ Profile: http://hl7.org/fhir/StructureDefinition/Condition Release: R4 Version: 4.0.1 Build ID: 9346c8cc45 Last updated: 2019-11-01T09:29:23.356+11:00 """ import sys from . import backboneelement, domainresource class Condition(domainresource.DomainResource): """ Detailed informatio...
the-stack_0_6154
import os from functools import reduce from itertools import count, islice, cycle import numpy as np import pandas as pd from pandas.api.types import is_string_dtype pd.set_option('display.max_columns', 70) pd.set_option('display.max_rows', 200) def plant_data(dat): """ Takes the first part of the dataframe...
the-stack_0_6157
# -*- coding: utf-8 -*- # # Copyright 2020 - Swiss Data Science Center (SDSC) # A partnership between École Polytechnique Fédérale de Lausanne (EPFL) and # Eidgenössische Technische Hochschule Zürich (ETHZ). # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compli...
the-stack_0_6158
import networkx as nx def build_graph(filename): f = open(filename) f = f.read() regex = re.compile("[ins|isa]\(i(\d+),i(\d+)\)") regex_class = re.compile("class\(i(\d+)\)") instances = frozenset(regex.findall(f)) classes = frozenset(regex_class.findall(f)) # create directed ...
the-stack_0_6159
import sys import h5py import matplotlib.pyplot as plt if __name__ == "__main__": with h5py.File(sys.argv[1], "r") as hdf: # Print the dataset names in the file datasets = list(hdf) print(datasets) # Plot the counter mean values for the 3 counters we know are captured for i...
the-stack_0_6160
import socket s = socket.socket() s.bind(("localhost", 9999)) s.listen(1) s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) sc, addr = s.accept() for i in range(3): ricevutoByte = sc.recv(4096) #ricevuto = str(ricevutoByte, "ascii") #print("Ricevuto:", ricevuto) if ricevutoByte == bytes("q","ascii") or ric...
the-stack_0_6162
import os import argparse import struct import lmdb import csv from dataset import find_inputs import time import numpy as np import pandas as pd import zlib parser = argparse.ArgumentParser(description='Process cdiscount datasets') parser.add_argument('data', metavar='DIR', help='dir of images') p...
the-stack_0_6163
from os import path from enum import Enum, unique import sys import warnings import collections import cntk from cntk import cntk_py, Value from cntk.device import DeviceDescriptor, cpu from cntk.internal import map_if_possible, typemap, sanitize_var_map,\ sanitize_batch, sanitize_dtype_cntk,...
the-stack_0_6164
# -*- coding: UTF-8 -*- """ Copyright 2018 Esri 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_6165
# Andrew Riker # CS1400 - LW2 XL # Assignment #04 # user enters name of employee name = input("Enter employee's name: ") # user enters number of hours worked in a week numberOfHours = eval(input("Enter number of hours worked in a week: ")) # user enters hourly pay payRate = eval(input("Enter hourly pay rate: ...
the-stack_0_6166
# -*- coding: utf-8 -*- # File: base.py from abc import abstractmethod, ABCMeta import tensorflow as tf import six from ..tfutils.common import get_tensors_by_names from ..tfutils.tower import PredictTowerContext from ..input_source import PlaceholderInput __all__ = ['PredictorBase', 'AsyncPredictorBase', ...
the-stack_0_6167
from __future__ import absolute_import from __future__ import division from __future__ import unicode_literals from __future__ import print_function from model import Model from data import * from args import parse_args from dp import dp import torch as th import torch.nn as nn import torch.optim as optim from torch.u...
the-stack_0_6168
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import itertools import json import os import shutil import ssl from datetime import datetime from urllib.error import HTTPError from urllib.request import Request, urlopen import boto3 from botocore.exceptions import NoCredentialsError FULL_PATH = "/tmp/" CHUNK_NAME_PR...
the-stack_0_6170
#!/usr/bin/env python # -*- coding: utf-8 -*- # # Author : Masahiro Ohmomo # DCC : Maya # Version : 2013 - Latest # Recommend: 2013 # # Description. # In this script, you can toggle the visibility of objects . # # Run command. # import toggle_visibility # toggle_visibility.main() # from maya import cmds def...
the-stack_0_6171
# encoding: utf-8 from setuptools import setup, find_packages import os, re, ast # parse version from locust/__init__.py _version_re = re.compile(r'__version__\s+=\s+(.*)') _init_file = os.path.join(os.path.abspath(os.path.dirname(__file__)), "locust", "__init__.py") with open(_init_file, 'rb') as f: version = s...
the-stack_0_6172
from setuptools import setup, find_packages with open("README.rst", "r") as fh: long_description = fh.read() # Get the version. version = {} with open("pastas/version.py") as fp: exec(fp.read(), version) setup( name='pastas', version=version['__version__'], description='Python package to perform ...
the-stack_0_6174
import codecs import os import re from setuptools import find_packages, setup ############################################################################### NAME = "attrs" PACKAGES = find_packages(where="src") META_PATH = os.path.join("src", "attr", "__init__.py") KEYWORDS = ["class", "attribute", "boilerplate"] P...
the-stack_0_6175
from __future__ import print_function import sys import os import argparse import torch import torch.nn as nn import torch.backends.cudnn as cudnn import torchvision.transforms as transforms from torch.autograd import Variable from data import VOC_ROOT, VOC_CLASSES as labelmap from PIL import Image from data import VOC...
the-stack_0_6178
#!/usr/bin/env python3 """ Copyright (c) 2021 Project CHIP 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 or a...
the-stack_0_6180
import re from pathlib import Path # Local modules try: from .checker import checker except ImportError: from checker import checker try: from .helpers import checkBrackets except ImportError: from helpers import checkBrackets ###################### REGULAR EXPRESSIONS ###################### skip_a...
the-stack_0_6181
from abc import ABCMeta import six from dagster import check from dagster.core.execution.context.system import SystemPipelineExecutionContext from dagster.core.types.dagster_type import DagsterType, resolve_dagster_type from .object_store import FilesystemObjectStore, ObjectStore from .type_storage import TypeStorag...
the-stack_0_6185
#!/usr/bin/env python3 # -*- coding: utf-8 -*- from math import ceil from typing import Dict import unittest from hwt.code import Concat from hwt.hdl.constants import WRITE, READ, NOP from hwt.hdl.types.bits import Bits from hwt.simulator.simTestCase import SimTestCase from hwtLib.examples.operators.concat import Sim...
the-stack_0_6187
"""Unit tests for matplotlib drawing functions.""" import os import itertools import pytest mpl = pytest.importorskip("matplotlib") mpl.use("PS") plt = pytest.importorskip("matplotlib.pyplot") plt.rcParams["text.usetex"] = False import networkx as nx barbell = nx.barbell_graph(4, 6) def test_draw(): try: ...
the-stack_0_6188
#!/usr/bin/env python # -*- coding:utf-8 -*- """ author: http://stackoverflow.com/users/476920/xperroni """ from HTMLParser import HTMLParser from re import sub from sys import stderr from traceback import print_exc class _DeHTMLParser(HTMLParser): def __init__(self): HTMLParser.__init__(self) s...
the-stack_0_6189
''' Created by yong.huang on 2016.11.04 ''' from hifive.api.base import RestApi class HFClearMemberSheetMusicRequest(RestApi): def __init__(self, domain=None, port=80, method=None): domain = domain or 'hifive-gateway-test.hifiveai.com'; method = method or 'POST'; RestApi.__init__(self,domain, port,method) self...
the-stack_0_6190
# coding=utf-8 # Copyright 2020 The Trax Authors and The HuggingFace Inc. team. # Copyright (c) 2018, NVIDIA CORPORATION. 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_6192
from django.contrib import admin from django.db.models import Count from django.template.defaultfilters import truncatechars from django.utils.translation import gettext_lazy as _ from guardian.admin import GuardedModelAdmin from rest_framework_api_key.admin import APIKeyModelAdmin from rest_framework_api_key.models im...
the-stack_0_6195
import datetime import functools import logging from enum import Enum from typing import AsyncGenerator, List, Union from ..smart_client import SmartClient import nuget_package_scanner.nuget import nuget_package_scanner.nuget.date_util as date_util import nuget_package_scanner.nuget.version_util as version_util from...
the-stack_0_6201
"""contains custom scrapy pipeline.""" class IndexPipeline(object): """This class renames _index field.""" def process_item(self, item, spider): """implements https://doc.scrapy.org/en/latest/topics/item-pipeline.html#process_item""" if item.get('_index'): item['self'] = item.pop...
the-stack_0_6202
#!/usr/bin/env python # -*- coding: utf-8 -*- from functools import wraps from werkzeug.exceptions import Forbidden from .models import * # from flask_jwt_extended.view_decorators import _decode_jwt_from_request from flask_jwt_extended import verify_jwt_in_request, get_jwt_claims from lgw import lxd_api_get def impor...
the-stack_0_6203
from S3utility.s3_notification_info import S3NotificationInfo from provider.execution_context import get_session from provider.article_structure import ArticleInfo import provider.lax_provider from activity.objects import Activity lookup_functions = { "article_next_version": provider.lax_provider.article_next_ver...
the-stack_0_6204
""" Custom typing extension. Classes: ConstantHolder: Base class for storing constants and avoiding to hardcode everything. SaveableBaseModel: Child class of pydantic.BaseModel which enables saving and loading that BaseModel. TypedNamedTuple: Child class of SaveableBaseModel, can be used similarly to...
the-stack_0_6205
################################################################################ # [VMLMF] Lowrank Matrix Factorization with Vector-Multiplication # Project: Starlab # # Authors: Hyojin Jeon (tarahjjeon@snu.ac.kr), Seoul National University # U Kang (ukang@snu.ac.kr), Seoul National University # # File: compres...
the-stack_0_6206
# Copyright 2016 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_6207
from datetime import date import pytest from nhlapi.endpoints import NHLAPI from nhlapi.utils import Season class MockClient: def get(self, url, params=None): self.url = url self.params = params def test_teams(): mock = MockClient() api = NHLAPI(mock) api.teams(8, expand=["foo", "ba...
the-stack_0_6208
import pygmsh as pg from params import height, width, dist_center, inlet_width, inlet_depth, line_sep, ymin1, ymin2 from params import INMOUTH1, INMOUTH2, OUTMOUTH1, OUTMOUTH2, INLET1, INLET2, OUTLET1, OUTLET2, WALLS, DOMAIN def main(): #geom = pg.built_in.Geometry() size = 0.02; geom = pg.opencascade.Geom...
the-stack_0_6209
#!/usr/bin/env python2 # Copyright (c) 2014-2015 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 resurrection of mined transactions when # the blockchain is re-organized. # from test_framework...
the-stack_0_6214
# Copyright 2020 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. """This module is for processing test results from resultdb""" import base64 import logging from collections import defaultdict from common.findit_http_clie...
the-stack_0_6216
#!/usr/bin/env python # -*- encoding: utf-8 -*- # # The MIT License (MIT) # # Copyright (c) 2012-2014 Martin Zimmermann. # # 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,...
the-stack_0_6217
# Copyright 2018 The Bazel 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 or agreed to in wr...
the-stack_0_6218
from typing import List, Optional import aiosqlite from aloe.types.blockchain_format.sized_bytes import bytes32 from aloe.types.mempool_inclusion_status import MempoolInclusionStatus from aloe.util.db_wrapper import DBWrapper from aloe.util.errors import Err from aloe.util.ints import uint8, uint32 from aloe.wallet.t...
the-stack_0_6220
from pwn import * context.arch = 'amd64' host = '5.101.72.234' port = 33074 execve_syscall_num = 59 bin_sh_addr = 0x402000 syscall = 0x40100B sigret = 0x401004 if __name__ == "__main__": #p = process( "./main" ) p = remote( host, port ) paylaod = 'a' * 72 paylaod += p64( sigret ) sigFrame = SigreturnFrame...
the-stack_0_6222
import dataclasses import typing from typing import Optional import construct from construct import ( Struct, PrefixedArray, Int64ul, Int32ul, Hex, Construct, Computed, Array, Tell, Aligned, FocusedSeq, Rebuild, Seek, Pointer, Prefixed, GreedyBytes, ) from mercury_engine_data_structures import dread_data from...
the-stack_0_6224
import numpy as np from pymoo.algorithms.genetic_algorithm import GeneticAlgorithm from pymoo.model.individual import Individual from pymoo.model.survival import Survival from pymoo.operators.crossover.simulated_binary_crossover import SimulatedBinaryCrossover from pymoo.operators.default_operators import set_if_none ...
the-stack_0_6225
#!/usr/bin/env python # -*- coding: utf-8 -*- """Discovery models.""" from __future__ import absolute_import from __future__ import division from __future__ import print_function from __future__ import unicode_literals from ralph.discovery.models_device import ( Connection, ConnectionType, Database, ...
the-stack_0_6226
import os from dotenv import find_dotenv, load_dotenv import socket from indeed import IndeedClient import re project_dir = os.path.join(os.path.dirname(__file__), os.pardir, os.pardir) def get_ip(): return socket.gethostbyname(socket.gethostname()) # Set static user parameters load_dotenv(find_dotenv()) indeed_...
the-stack_0_6229
import random import requests import shutil import logging import os from typing import List, Dict, Any, Optional from django.forms.models import model_to_dict from zerver.models import Realm, RealmEmoji, Subscription, Recipient, \ Attachment, Stream, Message from zerver.lib.actions import STREAM_ASSIGNMENT_COLOR...
the-stack_0_6232
''' Created on Jul 25, 2017 @author: Daniel Sela, Arnon Sela ''' def sixty(scalar, trailsign=False, ): ''' ;+ ; NAME: ; SIXTY() ; PURPOSE: ; Converts a decimal number to sexagesimal. ; EXPLANATION: ; Reverse of the TEN() function. ; ; CALLING SEQUENCE: ; X = SI...
the-stack_0_6233
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Thu Feb 18 22:18:27 2021 @author: galin """ import string import requests from bs4 import BeautifulSoup import pandas as pd import time from tqdm.auto import tqdm # stock exchange : # AMEX - American Stock Exchange, # LSE - London Stock Exchange, # NASD...
the-stack_0_6238
import os from click import echo from tmt.steps.provision.base import ProvisionBase from tmt.utils import SpecificationError class ProvisionLocalhost(ProvisionBase): """ Localhost provisioner """ def __init__(self, data, step): super(ProvisionLocalhost, self).__init__(data, step) self._prepa...
the-stack_0_6239
from typing import ( # isort:skip Any, Callable, Dict, Mapping, Optional, Tuple, Union # isort:skip ) # isort:skip from abc import ABC, abstractmethod from collections import OrderedDict import torch from torch import nn from torch.utils.data import DataLoader, DistributedSampler from catalyst import utils fr...
the-stack_0_6240
from sklearn import preprocessing from . import state_space_parameters as ssp import countermeasures.data_loader as data_loader import numpy as np import tensorflow as tf MODEL_NAME = 'CHES_CTF_HW' # Number of output neurons NUM_CLASSES = 9 # Number of output neurons # Input Size INPUT_SIZE = 2200 # Batch Queue p...
the-stack_0_6241
"""Copyright (c) 2018 Great Ormond Street Hospital for Children NHS Foundation Trust & Birmingham Women's and Children's NHS Foundation Trust 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 withou...
the-stack_0_6242
import argparse import json from ArticyCoreClass import ArticyCore from ArticyCoreClass import Character from ArticyCoreClass import FlowFrag from ArticyCoreClass import Episode from ArticyCoreClass import Scene from ArticyCoreClass import Dialog from ArticyCoreClass import Condition from ArticyCoreClass imp...
the-stack_0_6244
from typing import Optional from numbers import Number import numpy as np import pandas as pd import plotly.express as px import plotly.graph_objects as go __all__ = [ 'plot', ] def plot( df: pd.DataFrame, *args, zmin: Optional[Number] = None, zmax: Optional[Number] = None, ...
the-stack_0_6245
import pytest from sqlalchemy.exc import IntegrityError from blitzdb import Document from blitzdb.fields import CharField, ForeignKeyField, ManyToManyField from ..conftest import _sql_backend, get_sql_engine class DirectorAward(Document): class Meta(Document.Meta): autoregister = False name = CharF...
the-stack_0_6249
#!/usr/bin/env python import socket import sys import rospy from geometry_msgs.msg import Pose2D # Create a TCP/IP socket sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) # Bind the socket to the port server_address = ('10.103.118.91', 8000) print >>sys.stderr, 'starting up on %s port %s' % server_address sock...
the-stack_0_6250
# vim: tabstop=4 shiftwidth=4 softtabstop=4 # Copyright 2012 OpenStack Foundation # 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.apach...
the-stack_0_6251
# Copyright 2015 Google 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 or a...
the-stack_0_6253
import os import torch import numpy as np import SimpleITK as sitk import random from torch.utils.data import Dataset class BraTS(Dataset): def __init__(self, root, phase, desired_depth=128, desired_height=160, desired_width=192, normalize_flag=True, scale_intensity_flag=False, shift_intesity_...
the-stack_0_6257
# This code is part of Qiskit. # # (C) Copyright IBM 2018, 2021. # # 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_6258
# ---------------------------------------------------------------------------- # pyglet # Copyright (c) 2006-2008 Alex Holkner # Copyright (c) 2008-2020 pyglet contributors # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the follo...
the-stack_0_6259
import json from lxml import etree import unittest2 as unittest from keystone.models import User from keystone.test import utils as testutils class TestModelsUser(unittest.TestCase): '''Unit tests for keystone/models.py:User class.''' def test_user(self): user = User() self.assertEquals(str(...
the-stack_0_6260
## @file # This file is used to provide board specific image information. # # Copyright (c) 2017 - 2020, Intel Corporation. All rights reserved.<BR> # # SPDX-License-Identifier: BSD-2-Clause-Patent # ## # Import Modules # import os import sys sys.dont_write_bytecode = True sys.path.append (os.path.jo...
the-stack_0_6263
import torch import os from collections import OrderedDict try: from torch.hub import load_state_dict_from_url except ImportError: from torch.utils.model_zoo import load_url as load_state_dict_from_url def load_checkpoint(model, checkpoint_path): if checkpoint_path and os.path.isfile(checkpoint_path): ...
the-stack_0_6264
# encoding: utf-8 # BaseCoverageRecord, Timestamp, CoverageRecord, WorkCoverageRecord from . import ( Base, get_one, get_one_or_create, ) import datetime from sqlalchemy import ( Column, DateTime, Enum, ForeignKey, Index, Integer, String, Unicode, UniqueConstraint, ) f...
the-stack_0_6265
import copy import json import requests from flask import request from tranql.backplane.api.standard_api import StandardAPIResource from tranql.config import config ####################################################### ## # Automat - query Automat-KPs. ## ####################################################### cla...
the-stack_0_6269
from chainer import cuda from chainer.functions.pooling import pooling_2d from chainer.utils import conv from chainer.utils import type_check class Unpooling2D(pooling_2d.Pooling2D): """Unpooling over a set of 2d planes.""" def __init__(self, ksize, stride=None, pad=0, outsize=None, cover_a...
the-stack_0_6270
# coding=utf-8 # Copyright 2020 The Google Research 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 applicab...
the-stack_0_6271
import asyncio import time import os import requests import pytest import starlette.responses import ray from ray import serve from ray._private.test_utils import SignalActor, wait_for_condition def test_e2e(serve_instance): @serve.deployment(name="api") def function(starlette_request): return {"met...