filename
stringlengths
13
19
text
stringlengths
134
1.04M
the-stack_0_12101
import json import sys from typing import Any, List, Mapping, Tuple from pydantic.tools import parse_obj_as from common import MethodAbs, get_metrics with open(sys.argv[1], "r") as f: dump1: Mapping[str, List[Tuple[str, Any]]] = json.load(f) with open(sys.argv[2], "r") as f: dump2: Mapping[str, List[Tuple[str...
the-stack_0_12102
# Copyright (c) 2020 PaddlePaddle 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 appl...
the-stack_0_12103
from typing import Union, Optional, Set import torch import torch.nn as nn import torch.nn.functional as F from torch.nn.modules.conv import _ConvNd from torch.nn.common_types import _size_1_t, _size_2_t, _size_3_t from torch.nn.modules.utils import _single, _pair, _triple from torch.nn.parameter import Parameter fr...
the-stack_0_12104
#!/usr/bin/env python # -*- coding: utf-8 -*- """Orbit description """ import numpy as np from textwrap import indent from ..constants import c from ..dates import timedelta from ..errors import OrbitError from .forms import get_form, Form, _cache_param_names from ..frames.frames import get_frame, orbit2frame from ....
the-stack_0_12105
from collections import OrderedDict from batchgenerators.utilities.file_and_folder_operations import * import shutil import numpy as np from numpy.random.mtrand import RandomState import subprocess from multiprocessing import pool import pandas as pd def get_mnms_data(data_root): files_raw = [] files_gt = []...
the-stack_0_12107
#!/usr/bin/env python # -*- coding: utf-8 -*- """ @Time : 2019/1/9 15:02 @Author : Zhangyu @Email : zhangycqupt@163.com @File : config.py @Software: PyCharm @Github : zhangyuo """ # train data TRAIN_DATA_PATH_NEG = '../data/rt-polaritydata/rt-polarity.neg' TRAIN_DATA_PATH_POS = '../data/rt-polaritydata/rt-po...
the-stack_0_12110
# -*- coding: utf-8 -*- """Tests for binary data format and file.""" import io import unittest from dtfabric import errors as dtfabric_errors from dtfabric.runtime import data_maps as dtfabric_data_maps from dtfabric.runtime import fabric as dtfabric_fabric from winregrc import data_format from winregrc import error...
the-stack_0_12111
#!/usr/bin/env python # # Copyright 2010-2011 The Regents of the University of California # # 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_12113
"""Process the raw EmoV-DB dataset. This assumes the file structure from the original sorted data: /.../ bea/ Angry/ *.wav Amused/ *.wav ... josh/ Angry/ *.wav ... ... """ from pathlib import Path import click from ertk.dataset ...
the-stack_0_12114
import unittest from easy_music_generator.preprocessor import preprocessor as p class TestPreprocessor(unittest.TestCase): def test_parse_scores(self): ''' Test that parse_scores() returns a score in the form of a list. Not testing for actual score accuracy as it changes every run...
the-stack_0_12116
#MenuTitle: Find and Replace in Layer Names # -*- coding: utf-8 -*- from __future__ import division, print_function, unicode_literals __doc__=""" Replaces strings in layer names of all selected glyphs. Useful for adjusting layers for the bracket trick: http://glyphsapp.com/blog/alternating-glyph-shapes/ """ import van...
the-stack_0_12119
from collections import defaultdict, deque def find_tree_diameter(g, n): """ Standard awesome problem So for each node, I want to find the maximum distance to another node :param g: :return: """ # We can approach this question in the binary tree way (or) the graph way # Tree - Post ord...
the-stack_0_12120
#MEGA SENA #pergunte qntos jogos serão gerados e sorteie 6 números entre 1 a 60. #cadastre td em uma lista composta. from random import randint print('--'*18) print(f'{"JOGO DA MEGA SENA":^36}') print('--'*18) jogo = int(input('Quantos jogos você quer que eu sorteie? ')) matriz = [[], []] for i in range(0, 6): n ...
the-stack_0_12121
fcc_sources = { "GFC": { "asset": "UMD/hansen/global_forest_change_2020_v1_8", "start": 2000, "end": 2020, }, "TMF": { "asset": "projects/JRC/TMF/v1_2021/AnnualChanges", "start": 1990, "end": 2021, }, } "source of the forest change cover dataset"
the-stack_0_12122
# removes all files created during testing import glob import os paths = [] for pattern in [ '*.actual', '*.actual-rewrite', '*.rewrite', '*.process-output' ]: paths += glob.glob('data/' + pattern) for path in paths: os.unlink(path)
the-stack_0_12123
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Created on Friday Feb 20 2020 This code was implemented by Louis Weyland, Floris Fok and Julien Fer """ # Import built-in libraries import time import math import statistics import multiprocessing # import 3th party libraries import numpy as np impor...
the-stack_0_12124
"""license: Apache License 2.0, see LICENSE for more details.""" import uuid import time from nose.tools import eq_ from kazoo.testing import KazooTestCase from kazoo.recipe.partitioner import PartitionState class KazooPartitionerTests(KazooTestCase): def setUp(self): super(KazooPartitionerTests, self)....
the-stack_0_12125
# Author: Muratcan Cicek, https://users.soe.ucsc.edu/~cicekm/ from HeadCursorMapping.MappingABC import MappingABC from InputEstimators.HeadPoseEstimators.MuratcansHeadGazer import MuratcansHeadGazer from InputEstimators.HeadPoseEstimators.HeadPoseEstimatorABC import HeadPoseEstimatorABC from abc import abstractmethod ...
the-stack_0_12126
# 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 logging import math from collections.abc import Collection from dataclasses import dataclass, field from typing import List import tor...
the-stack_0_12127
from rpython.rtyper.lltypesystem import rffi, lltype from pypy.module.cpyext.test.test_api import BaseApiTest from pypy.module.cpyext.test.test_cpyext import AppTestCpythonExtensionBase from pypy.module.cpyext.api import PyObject class AppTestStructSeq(AppTestCpythonExtensionBase): def test_StructSeq(self): ...
the-stack_0_12128
#!/usr/bin/python """ Driver for PDB2PQR This module takes a PDB file as input and performs optimizations before yielding a new PDB-style file as output. Ported to Python by Todd Dolinsky (todd@ccb.wustl.edu) Washington University in St. Louis Parsing utilities provided by Nathan A. Baker (baker@biochem.wustl.edu) W...
the-stack_0_12133
# Copyright 2018 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
the-stack_0_12135
# encoding: utf-8 import numpy as np import _interp import _remapping import pyroms def z2roms(varz, grdz, grd, Cpos='rho', irange=None, jrange=None, \ spval=1e37, flood=True, dmax=0, cdepth=0, kk=0, \ mode='linear'): """ var = z2roms(var, grdz, grd) optional switch: - Cpos='...
the-stack_0_12136
import logging from typing import Dict, Optional, Tuple from xml.etree import ElementTree as ET import requests logger = logging.getLogger('jriver.mcws') class MediaServer: def __init__(self, ip: str, auth: Optional[Tuple[str, str]] = None, secure: bool = False): self.__ip = ip self.__auth = au...
the-stack_0_12138
"""Extract the most recurrent tokens of the template text""" import json import more_itertools import mwxml import datetime from typing import Iterable, Iterator, Mapping, Optional from backports.datetime_fromisoformat import MonkeyPatch # nltk from .. import extractors, user_warnings_en, user_warnings_it, user_warnin...
the-stack_0_12139
class CompilationEngine: """ compiles a jack source file from a jack tokenizer into xml form in output_file """ TERMINAL_TOKEN_TYPES = ["STRING_CONST", "INT_CONST", "IDENTIFIER", "SYMBOL"] TERMINAL_KEYWORDS = ["boolean", "class", "void", "int"] CLASS_VAR_DEC_TOKENS = ["static", "field"] SUB...
the-stack_0_12142
import bisect import os import json from .utils import BlacklistItemsWrapper from collections import OrderedDict from utils import AutoDatabase, AutoLexicalizer from .utils import DialogDataset, DialogDatasetItem, split_name DATASETS_PATH = os.path.join(os.path.expanduser(os.environ.get('DATASETS_PATH', '~/datasets'))...
the-stack_0_12143
# Copyright 2017-present, Facebook, Inc. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. An additional grant # of patent rights can be found in the PATENTS file in the same directory. import sys, random, os impor...
the-stack_0_12144
# Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not use ...
the-stack_0_12145
# coding=utf-8 """ safety.py - Alerts about malicious URLs Copyright © 2014, Elad Alfassa, <elad@fedoraproject.org> Licensed under the Eiffel Forum License 2. This module uses virustotal.com """ import sopel.web as web from sopel.config.types import StaticSection, ValidatedAttribute, ListAttribute from sopel.formatt...
the-stack_0_12147
from __future__ import division from collections import deque import os import warnings import numpy as np import keras.backend as K import keras.optimizers as optimizers from rl.core import Agent from rl.random import OrnsteinUhlenbeckProcess from rl.util import * def mean_q(y_true, y_pred): return K.mean(K.ma...
the-stack_0_12148
#!/usr/bin/env python """ A new .py file """ __author__ = 'ccluff' from typing import List def parse_arg(arg: str) -> List[float]: """for parsing cli args from str to python objects""" arg = arg.replace('[', '').replace(']', '').replace(' ', '').split(',') return list(map(float, arg))
the-stack_0_12153
# Copyright (c) 2019 PaddlePaddle 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_12155
#!/usr/bin/env python import math import numpy from matplotlib import pyplot from mwa_pb import mwapb def plot_beam(delays=numpy.zeros(16), gains=numpy.ones(16), stokes='I'): t = numpy.mgrid[0:91,0:361] el = t[0, :, :] az = t[1, :, :] dtor = math.pi / 180.0 theta = (90 - el) * dtor ph...
the-stack_0_12156
# -*- coding: latin-1 -*- # ----------------------------------------------------------------------------- # Copyright 2009-2011 Stephen Tiedemann <stephen.tiedemann@googlemail.com> # # Licensed under the EUPL, Version 1.1 or - as soon they # will be approved by the European Commission - subsequent # versions of the EU...
the-stack_0_12157
# O(n) time | O(n) space def minRewards(scores): # Write your code here. dp = [1] * len(scores) for i in range(1, len(scores)): if scores[i] > scores[i - 1]: dp[i] = dp[i - 1] + 1 for j in reversed(range(len(scores) - 1)): if scores[j + 1] < scores[j]: dp[j] = ...
the-stack_0_12158
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. # SPDX-License-Identifier: MIT-0 import json import os from argparse import ArgumentParser from os.path import isfile from flask import Flask, jsonify, request from flask_restful import reqparse from PIL import Image from teach.utils import dynamic...
the-stack_0_12159
#! /usr/bin/env python3 """Advent of Code: Day 10 Author: Benjamin Jung """ import numpy as np from collections import Counter from itertools import combinations adapters = np.genfromtxt('test.txt') max_rated = np.max(adapters) + 3 adapters = np.array(list(adapters) + [0, max_rated]) """Part 1""" chained_adapters =...
the-stack_0_12160
#!/usr/bin/env python from setuptools import setup, find_packages config = { 'name': 'stomasimulator', 'description': 'Perform biomechanical simulations of stomata', 'long_description': open('README.md').read(), 'author': 'Hugh C. Woolfenden', 'author_email': 'hugh.woolfenden@jic.ac.uk', 'url'...
the-stack_0_12163
# Copyright (c) 2021, salesforce.com, inc. # All rights reserved. # SPDX-License-Identifier: BSD-3-Clause # For full license text, see the LICENSE file in the repo root # or https://opensource.org/licenses/BSD-3-Clause import os import numpy as np from gym.spaces import Box, Dict from ray.rllib.models import ModelCat...
the-stack_0_12164
import unittest from sample import textFile import os, fnmatch class TestTextFile(unittest.TestCase): def test_list_not_null(self): """ Test that the module textFile return a not null list """ auxTest = textFile.TextFile('ej.txt') list = auxTest.listUrls() self.asse...
the-stack_0_12166
"""@desc Parser for ask search results """ from search_engine_parser.core.base import BaseSearch, ReturnType, SearchItem class Search(BaseSearch): """ Searches Ask for string """ name = "Ask" search_url = "https://www.ask.com/web?" summary = "\t Formerly known as Ask Jeeves, Ask.com receiv...
the-stack_0_12167
import os import setuptools from pkg_resources import DistributionNotFound, get_distribution #with open("README.md", "r") as fh: # long_description = fh.read() def get_dist(package_name): try: return get_distribution(package_name) except DistributionNotFound: return None install_requires=...
the-stack_0_12168
import numpy as np def numeric_grad_array(f, x, h): """ calculating numerical differentiation 2-point formula: (f(x+h) - f(x-h))/2h source: https://en.wikipedia.org/wiki/Numerical_differentiation Arguments: f: function that receives x and computes value and gradient x: np array, initial p...
the-stack_0_12169
import os import numpy as np import tensorflow as tf from resnet101 import ResNet101 filePath = "/home/luca/PycharmProjects/deeplab_113/deeplab_resnet.ckpt" def get_filename(key): """Rename tensor name to the corresponding Keras layer weight name. # Arguments key: tensor name in TF (determined by tf...
the-stack_0_12172
from django.conf import settings from django.contrib import messages from django.contrib.auth.decorators import permission_required from django.db import transaction from django.db.models import F, Q from django.forms import modelformset_factory from django.http import HttpResponse, JsonResponse from django.shortcuts i...
the-stack_0_12173
# Copyright (c) OpenMMLab. All rights reserved. import torch import torch.nn as nn import torch.nn.functional as F from ..builder import LOSSES from .utils import weight_reduce_loss @LOSSES.register_module() class MSELoss(nn.Module): """MSE loss. Args: reduction (str): The method used to reduce the ...
the-stack_0_12177
from typing import Optional from sqlalchemy.exc import IntegrityError from app.email_utils import ( get_email_domain_part, send_cannot_create_directory_alias, send_cannot_create_domain_alias, email_belongs_to_alias_domains, ) from app.errors import AliasInTrashError from app.extensions import db from ...
the-stack_0_12178
from typing import List from tdw.output_data import Environments as Envs from magnebot.util import get_data class Room: """ Data for a room in a scene. """ def __init__(self, env: Envs, i: int): """ :param env: The environments output data. :param i: The index of this environm...
the-stack_0_12179
import logging import random import uuid import os import copy from flask import Blueprint, jsonify, session, request, current_app from datetime import datetime, timedelta from decimal import Decimal from sqlalchemy.sql.elements import Null from app.models.model import Class, Student, StuCls, User, Log, Teacher, ClsWd...
the-stack_0_12184
import logging from datetime import timedelta from typing import Dict from django.contrib.auth.mixins import PermissionRequiredMixin from django.contrib.messages.views import SuccessMessageMixin from django.core.exceptions import ( NON_FIELD_ERRORS, PermissionDenied, ValidationError, ) from django.forms.ut...
the-stack_0_12186
#@mrlokaman #@lntechnical from pyrogram import Client, filters import requests import json import os TOKEN = os.environ.get("TOKEN", "") API_ID = int(os.environ.get("API_ID",12345)) API_HASH = os.environ.get("API_HASH","") BITLY_TOKEN = os.environ.get("BITLY_TOKEN","") headers = { 'Authorization': BITLY_TOKEN,...
the-stack_0_12189
from __future__ import unicode_literals import datetime import uuid from django.conf import settings from django.core.exceptions import FieldError, ImproperlyConfigured from django.db import utils from django.db.backends import utils as backend_utils from django.db.backends.base.operations import BaseDatabaseOperatio...
the-stack_0_12190
from __future__ import unicode_literals from django.core import serializers from django.db import connection from django.test import TestCase from .models import Child, FKDataNaturalKey, NaturalKeyAnchor from .tests import register_tests class NaturalKeySerializerTests(TestCase): pass def natural_key_serializ...
the-stack_0_12194
#!/usr/bin/env python import json import pika import requests import time import websocket import servitor_utils settings = servitor_utils.make_settings("settings.yml") def send_ws_message(settings, message): websocket_server = settings['websocket_local_server'] websocket_port = settings['websocket_local_por...
the-stack_0_12196
#!/usr/bin/env python from django.test import TestCase from nose.tools import assert_false, assert_true from corehq.apps.hqcase.utils import update_case from corehq.apps.sms.mixin import apply_leniency from corehq.apps.sms.util import ( ContactNotFoundException, clean_phone_number, get_contact, is_con...
the-stack_0_12197
from pandac.PandaModules import NodePath, Plane, Vec3, Point3 from pandac.PandaModules import CollisionPlane, CollisionNode from direct.showbase.RandomNumGen import RandomNumGen from direct.showbase.DirectObject import DirectObject from direct.showbase.PythonUtil import bound as clamp from . import CogdoUtil from . imp...
the-stack_0_12199
# MIT License # # Copyright The SCons Foundation # # Permission is hereby granted, free of charge, to any person obtaining # a copy of this software and associated documentation files (the # "Software"), to deal in the Software without restriction, including # without limitation the rights to use, copy, modify, merge, ...
the-stack_0_12200
# -*- coding: utf-8 -*- # # Electrum - lightweight Bitcoin client # Copyright (C) 2011 thomasv@gitorious # # Permission is hereby granted, free of charge, to any person # obtaining a copy of this software and associated documentation files # (the "Software"), to deal in the Software without restriction, # including wit...
the-stack_0_12201
# Copyright 2017 Yahoo Inc. # Licensed under the terms of the Apache 2.0 license. # Please see LICENSE file in the project root for terms. """This module extends the TensorFlowOnSpark API to support Spark ML Pipelines. It provides a TFEstimator class to fit a TFModel using TensorFlow. The TFEstimator will actually sp...
the-stack_0_12202
#!/usr/bin/python3 import time import json import sys import random from neopixel import * from dynamic_pattern_list_builder import * # LED strip configuration: LED_COUNT = 24 # Number of LED pixels. LED_PIN = 18 # GPIO pin connected to the pixels (18 uses PWM!). #LED_PIN = 10 # GPIO pin connected to the pixels (10...
the-stack_0_12203
# # Copyright (c) 2021 Cisco Systems, Inc and its affiliates # All rights reserved # from msxswagger import DocumentationConfig, Security, Sso from config import Config from helpers.consul_helper import ConsulHelper class SwaggerHelper(object): def __init__(self, config: Config, consul_helper: ConsulHelper): ...
the-stack_0_12204
def main(): import sys import signal import argparse import json from edman import DB from scripts.action import Action # Ctrl-Cを押下された時の対策 signal.signal(signal.SIGINT, lambda sig, frame: sys.exit('\n')) # コマンドライン引数処理 parser = argparse.ArgumentParser(description='ドキュメントの項目を修正するス...
the-stack_0_12205
# Copyright 2020-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 by applicable law or agre...
the-stack_0_12207
import torchvision.transforms as transforms import torch from PIL import Image, ImageOps import random import utils.utils2.transforms as local_transforms """ As mentioned in http://pytorch.org/docs/master/torchvision/models.html All pre-trained models expect input images normalized in the same way, i.e. mini-batches ...
the-stack_0_12208
import unittest import endurox as e import exutils as u class TestTpencrypt(unittest.TestCase): # Test data encryption def test_tpencrypt_ok(self): w = u.NdrxStopwatch() while w.get_delta_sec() < u.test_duratation(): # binary data: buf=e.tpencrypt(b'\x00\x...
the-stack_0_12210
import time, datetime class Sensor(): def __init__(self, bme680): self.sensor = bme680.BME680(); def initialise(self,bme680): self.sensor.set_humidity_oversample(bme680.OS_2X) self.sensor.set_pressure_oversample(bme680.OS_4X) self.sensor.set_temperature_oversample(bme680.OS_8X) self.sensor.set_filter(bme...
the-stack_0_12212
import numpy as np import pyqtgraph as pg from scipy import signal from acconeer_utils.clients.reg.client import RegClient from acconeer_utils.clients.json.client import JSONClient from acconeer_utils.clients import configs from acconeer_utils import example_utils from acconeer_utils.pg_process import PGProcess, PGPro...
the-stack_0_12215
"""Authors: Cody Baker and Ben Dichter.""" from pathlib import Path from datetime import datetime from typing import Optional import spikeextractors as se from pynwb import NWBHDF5IO from nwb_conversion_tools import NWBConverter, CEDRecordingInterface from nwb_conversion_tools.utils.spike_interface import write_record...
the-stack_0_12216
import numpy as np import math import torch.nn as nn from .utils import unetConv2, unetUp, conv2DBatchNormRelu, conv2DBatchNorm import torch import torch.nn.functional as F from models.layers.grid_attention_layer import GridAttentionBlock2D_TORR as AttentionBlock2D from models.networks_other import init_weights class ...
the-stack_0_12218
#!/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 os import subprocess import sys from setuptools import setup, find_packages, Extension from setuptoo...
the-stack_0_12219
# Copyright (c) 2019 Ultimaker B.V. # Uranium is released under the terms of the LGPLv3 or higher. import ast import builtins # To check against functions that are built-in in Python. import math # Imported here so it can be used easily by the setting functions. import uuid # Imported here so it can be used easily ...
the-stack_0_12220
import json import unittest from linkml.generators.jsonschemagen import JsonSchemaGenerator from tests.utils.test_environment import TestEnvironmentTestCase from tests.test_issues.environment import env # reported in https://github.com/linkml/linkml/issues/726 schema_str = """ id: http://example.org name: issue-726...
the-stack_0_12225
cancerlist = ["PANCANCER"] input_file1 = [] output_file1 = [] threshold = 0.2 probe_count = 485577 for i in range(0, len(cancerlist)) : input_file1.append(open(str(threshold) + ".Cutoff.FC.Pvalue." + cancerlist[i] + ".txt", 'r')) output_file1.append(open(str(threshold) + ".MeaningfulCpGsitesByPvalue0.05.Wi...
the-stack_0_12231
import json import requests import sys import time from argparse import ArgumentParser from collections import deque from os.path import isfile from tabber import Tabber def _argparse(): arg_parse = ArgumentParser(description="Crawl last.fm for finnish users, given a seed person or a reference to a " ...
the-stack_0_12234
# Licensed under a 3-clause BSD style license - see LICENSE.rst from __future__ import print_function import json import os import tempfile import tarfile import sys from astropy.extern import six from astropy.io import fits from astropy import log import astropy.units import astropy.io.votable as votable from ..quer...
the-stack_0_12235
from django.contrib import admin from django.urls import path, include from django.contrib.staticfiles.urls import staticfiles_urlpatterns urlpatterns = [ path('admin/', admin.site.urls), path('api/', include('task.apis.urls')), # for apis path('', include('task.forms.urls')), # for forms forms path(...
the-stack_0_12236
import sys import struct import collections from . import filter_nan from .ins401_field_parser import decode_value from ...framework.utils.print import print_yellow from ...framework.context import APP_CONTEXT # input packet error_decode_packet = 0 def _format_string(data_buffer): parsed = bytearray(data_buffer)...
the-stack_0_12237
import datetime import json import os from dotenv import load_dotenv from Santander.SantanderScrapper import SantanderScrapper load_dotenv(verbose=True) from Clear.ClearScrapper import ClearScrapper from GuiaBolso.GuiaBolsoScrapper import GuiaBolsoScrapper from Rico.RicoScrapper import RicoScrapper from SmarttBot.Sm...
the-stack_0_12238
import string from spacy.lang.pl import STOP_WORDS as stop_words try: import morfeusz2 morph = morfeusz2.Morfeusz() except ImportError: print('Warning: Morfeusz couldn\'t be imported') morph = None letters = string.ascii_letters + 'ąćęłńóśźż' class Word: def __init__(self, text): self.tex...
the-stack_0_12241
""" Streaming Parallel Data Processing =================================================================== Neuraxle steps for streaming data in parallel in the pipeline .. Copyright 2019, Neuraxio Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in com...
the-stack_0_12242
"""This module contains simple helper functions """ from __future__ import print_function import torch import numpy as np from PIL import Image import os def tensor2im(input_image, index, imtype=np.uint8): """"Converts a Tensor array into a numpy image array. Parameters: input_image (tensor) -- the ...
the-stack_0_12244
import numpy as np import torch import torch.nn.functional as F from matplotlib import pyplot as plt from skimage import morphology from sklearn.metrics import roc_auc_score from sklearn.metrics import roc_curve from sklearn.metrics import precision_recall_curve def get_roc_plot_and_threshold(predictions, gt_list): ...
the-stack_0_12246
""" CEASIOMpy: Conceptual Aircraft Design Software Developed by CFS ENGINEERING, 1015 Lausanne, Switzerland Module containing the utilitary functions for the workflowcreator and optimization modules Python version: >=3.6 | Author: Aidan Jungo | Creation: 2020-02-25 | Last modifiction: 2020-04-24 TODO: * ... ...
the-stack_0_12247
from __future__ import unicode_literals import datetime import decimal from collections import defaultdict from django.contrib.auth import get_permission_codename from django.core.exceptions import FieldDoesNotExist from django.core.urlresolvers import NoReverseMatch, reverse from django.db import models from django....
the-stack_0_12248
import datetime import minerl import namesgenerator from sacred import Experiment import basalt_utils.wrappers as wrapper_utils from minerl.herobraine.wrappers.video_recording_wrapper import VideoRecordingWrapper from basalt_utils.sb3_compat.policies import SpaceFlatteningActorCriticPolicy from basalt_utils.sb3_compat....
the-stack_0_12249
import asyncio import typing import warnings from ..utils.logger import logger from .auto_reload import _auto_reload CallableAwaitable = typing.Union[typing.Callable, typing.Awaitable] class TaskManager: def __init__( self, loop: asyncio.AbstractEventLoop = None, *, on_shutdown: ...
the-stack_0_12250
from torch import nn from pytorch_widedeep.wdtypes import * # noqa: F403 from pytorch_widedeep.models.tab_mlp import MLP from pytorch_widedeep.models.transformers._encoders import SaintEncoder from pytorch_widedeep.models.transformers._embeddings_layers import ( CatAndContEmbeddings, ) class SAINT(nn.Module): ...
the-stack_0_12253
# -*- coding: utf-8 -*- # # import os # import sys # sys.path.insert(0, os.path.abspath('.')) # -- Project information ----------------------------------------------------- project = 'Sphinx-Themes template' copyright = '2018, sphinx-themes.org' author = 'sphinx-themes.org' # The short X.Y version version = '' # Th...
the-stack_0_12254
import math from fastapi import FastAPI, Request from fastapi.responses import HTMLResponse from fastapi.staticfiles import StaticFiles from fastapi.templating import Jinja2Templates app = FastAPI() app.mount("/assets", StaticFiles(directory="assets"), name="assets") templates = Jinja2Templates(directory="templates") ...
the-stack_0_12255
#!/usr/bin/env python # -*- coding: utf-8 -*- # @Time : 5/15/20 4:49 PM # @File : grover.py # qubit number=4 # total number=15 import cirq import cirq.google as cg from typing import Optional import sys from math import log2 import numpy as np class Opty(cirq.PointOptimizer): def optimization_at( ...
the-stack_0_12256
# coding: utf-8 """ Onshape REST API The Onshape REST API consumed by all clients. # noqa: E501 The version of the OpenAPI document: 1.113 Contact: api-support@onshape.zendesk.com Generated by: https://openapi-generator.tech """ from __future__ import absolute_import import re # noqa: F401 im...
the-stack_0_12257
import re from collections import Counter def unique_words_counter(file_path): with open(file_path, "r", encoding="utf-8") as file: all_words = re.findall(r"[0-9a-zA-Z-']+", file.read()) all_words = [word.upper() for word in all_words] print("Total Words: ", len(all_words)) words_...
the-stack_0_12258
# Copyright Contributors to the Amundsen project. # SPDX-License-Identifier: Apache-2.0 from typing import ( Iterator, List, Optional, Union, ) from amundsen_rds.models import RDSModel from amundsen_rds.models.table import TableFollower as RDSTableFollower from amundsen_rds.models.user import User as ...
the-stack_0_12259
#!/usr/bin/env python # coding=utf-8 import asyncio import aiohttp from .config import HEADERS, REQUEST_TIMEOUT, REQUEST_DELAY async def _get_page(url, sleep): """ 获取并返回网页内容 """ async with aiohttp.ClientSession() as session: try: await asyncio.sleep(sleep) async with...
the-stack_0_12265
# -*- coding: utf-8 -*- __title__ = 'stimson-web-scraper' __author__ = 'Lucas Ou-Yang' __license__ = 'MIT' __copyright__ = 'Copyright 2014, Lucas Ou-Yang' __maintainer__ = "The Stimson Center" __maintainer_email = "cooper@pobox.com" VIDEOS_TAGS = ['iframe', 'embed', 'object', 'video'] VIDEO_PROVIDERS = ['youtube', 'y...
the-stack_0_12266
from setuptools import setup, find_packages from os import path __version__ = "0.3.15" here = path.abspath(path.dirname(__file__)) with open(path.join(here, "README.md"), encoding="utf-8") as f: long_description = f.read() with open(path.join(here, "requirements.txt"), encoding="utf-8") as f: dependencies =...
the-stack_0_12267
# File: S (Python 2.4) from SCColorScheme import SCColorScheme from otp.otpbase import OTPLocalizer class SCSettings: def __init__(self, eventPrefix, whisperMode = 0, colorScheme = None, submenuOverlap = OTPLocalizer.SCOsubmenuOverlap, topLevelOverlap = None): self.eventPrefix = eventPrefix s...
the-stack_0_12269
import numpy as np import pytest import pandas as pd from pandas.core.internals import BlockManager, SingleBlockManager from pandas.core.internals.blocks import Block, NonConsolidatableMixIn class CustomBlock(NonConsolidatableMixIn, Block): _holder = np.ndarray def formatting_values(self): return n...
the-stack_0_12272
from typing import Optional import pytest from odmantic.field import Field from odmantic.model import EmbeddedModel, Model from odmantic.reference import Reference def test_field_defined_as_primary_key_and_custom_name(): with pytest.raises( ValueError, match="cannot specify a primary field with a custom...