filename
stringlengths
13
19
text
stringlengths
134
1.04M
the-stack_0_7641
import argparse import os.path import re def Convert(fh): for line in fh.readlines(): #CHROM POS ID REF ALT QUAL FILTER INFO FORMAT FHS-CRS-4744.chr20.recaled chrom,pos,locus_id,ref,alt,qual,fil,info,formt,sample = line.strip().split('\t') pos = int(pos) # ...
the-stack_0_7642
from flask import Flask, request from flask_restful import Resource, Api from flask_cors import CORS import os import json import pandas as pd import datetime import time from filelock import Timeout, FileLock app = Flask(__name__) api = Api(app) CORS(app) with open("server_config.json") as f: config = json.load(...
the-stack_0_7644
from distutils.version import LooseVersion import pytest import torch from mmcls.models.utils import channel_shuffle, is_tracing, make_divisible def test_make_divisible(): # test min_value is None result = make_divisible(34, 8, None) assert result == 32 # test when new_value > min_ratio * value ...
the-stack_0_7645
# Copyright 2017 Braxton Mckee # # 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 t...
the-stack_0_7649
from discord.ext import commands from os import getenv from src.internal.bot import Bot from src.internal.context import Context from src.internal.checks import in_channel class Trivia(commands.Cog): """Trivia questions.""" def __init__(self, bot: Bot): self.bot = bot @commands.group(name="tri...
the-stack_0_7651
import cv2 class rovio: chase = None detector = None rovioConrol = None def __init__(self, chase, detector, rovioControl): self.chase = chase self.detector = detector self.rovioConrol = rovioControl def action(self): # ROVIO detect start here # keep rotat...
the-stack_0_7653
"""Various sources for providing generalized Beaver triples for the Pond protocol.""" import abc import logging import random import tensorflow as tf from ...config import get_config from ...utils import wrap_in_variables, reachable_nodes, unwrap_fetches logger = logging.getLogger('tf_encrypted') class TripleSour...
the-stack_0_7656
__AUTHOR__ = "hugsy" __VERSION__ = 0.1 import os import gdb def fastbin_index(sz): return (sz >> 4) - 2 if gef.arch.ptrsize == 8 else (sz >> 3) - 2 def nfastbins(): return fastbin_index( (80 * gef.arch.ptrsize // 4)) - 1 def get_tcache_count(): if get_libc_version() < (2, 27): return 0 co...
the-stack_0_7659
# ---------------------------------------------------------------------------- # CLASSES: nightly # # Test Case: lineout.py # # Tests: plots - Curve # operators - Lineout # # Defect ID: none # # Programmer: Brad Whitlock # Date: Fri Jan 3 14:22:41 PST 2003 # # Modifications: # K...
the-stack_0_7660
import unittest from easypysa.easypysa import EasyPysa class UnitTests(unittest.TestCase): def test_can_load_executable(self): easy = EasyPysa() self.assertTrue(easy._check_executable() == "OK") if __name__ == "__main__": unittest.main()
the-stack_0_7661
# Copyright (c) OpenMMLab. All rights reserved. import os import warnings from collections import OrderedDict import json_tricks as json import numpy as np from mmcv import Config from mmpose.core.evaluation.top_down_eval import keypoint_epe from mmpose.datasets.builder import DATASETS from ..base import Kpt3dSviewRg...
the-stack_0_7662
# Author: Niels Nuyttens <niels@nannyml.com> # # License: Apache Software License 2.0 """Statistical drift calculation using `Kolmogorov-Smirnov` and `chi2-contingency` tests.""" from typing import Any, Dict, List, cast import numpy as np import pandas as pd from scipy.stats import chi2_contingency, ks_2samp fr...
the-stack_0_7663
import discord from discord.ext import commands class ServerUtils(commands.Cog): def __init__(self, bot): self.bot = bot async def message_from_link(self, link): """Returns a Discord message given a link to the message.""" split_link = link.split("/") channel = self.bot.get_cha...
the-stack_0_7666
import numpy as np from .Composition import Composition from morpheus.utils import debug_print VERBOSITY = 1 class SequentialComposition(Composition): def __init__(self): super().__init__() self.all_desc_ids = np.array([]) return def predict(self, X, **kwargs): n_rows, n_a...
the-stack_0_7667
#!/usr/bin/python # ***************************************************************************** # # Copyright (c) 2016, EPAM SYSTEMS INC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # #...
the-stack_0_7668
# coding=utf-8 # !/usr/bin/env python """ :mod:"IKA_RET_Control_Visc" -- API for IKA RET Control Visc remote controllable hotplate stirrer =================================== .. module:: IKA_RET_Control_Visc :platform: Windows :synopsis: Control IKA RET Control Visc hotplate stirrer. .. moduleauthor:: Sebastian ...
the-stack_0_7670
# coding=utf-8 # Copyright 2022 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_7672
import biom import pandas as pd import numpy as np import tensorflow as tf from skbio import OrdinationResults from qiime2.plugin import Metadata from mmvec.multimodal import MMvec from mmvec.util import split_tables from scipy.sparse import coo_matrix from scipy.sparse.linalg import svds def paired_omics(microbes: b...
the-stack_0_7674
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Copyright 2020-2022 Francesco Di Lauro. All Rights Reserved. See Licence file for details. """ import matplotlib.pyplot as plt import numpy as np import scipy.stats as stats import sys sys.path.append('../') from Likelihood import log_likelihood_models from PDE_solve...
the-stack_0_7675
import pickle from datetime import date from pytest import raises, fixture from elasticsearch_dsl import response, Search, Document, Date, Object from elasticsearch_dsl.aggs import Terms from elasticsearch_dsl.response.aggs import AggResponse, BucketData, Bucket @fixture def agg_response(aggs_search, aggs_data): ...
the-stack_0_7676
SITEURL = "" SITENAME = "pelican-jupyter-test" PATH = "content" LOAD_CONTENT_CACHE = False TIMEZONE = "UTC" DEFAULT_LANG = "en" THEME = "notmyidea" # Plugin config MARKUP = ("md", "ipynb") from pelican_jupyter import markup as nb_markup # noqa PLUGINS = [nb_markup] IPYNB_MARKUP_USE_FIRST_CELL = True IGNORE_FILES ...
the-stack_0_7677
from app import create_app from flask_script import Manager,Server # Creating app instance app = create_app('development') manager = Manager(app) manager.add_command('server',Server) if __name__ == '__main__': manager.run()
the-stack_0_7678
import ctypes import struct # 3p import bson from bson.codec_options import CodecOptions from bson.son import SON # project from ...ext import net as netx from ...internal.compat import to_unicode from ...internal.logger import get_logger log = get_logger(__name__) # MongoDB wire protocol commands # http://docs.m...
the-stack_0_7679
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors # MIT License. See license.txt from __future__ import unicode_literals import frappe from frappe.utils import encode, cstr, cint, flt, comma_or import openpyxl import re from openpyxl.styles import Font from openpyxl import load_workbook from six im...
the-stack_0_7680
# coding: utf-8 # # Nengo Example: A Single Neuron # This demo shows you how to construct and manipulate a single leaky integrate-and-fire (LIF) neuron. The LIF neuron is a simple, standard neuron model, and here it resides inside a neural population, even though there is only one neuron. # In[ ]: import numpy as n...
the-stack_0_7682
# Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file # for details. All rights reserved. Use of this source code is governed by a # BSD-style license that can be found in the LICENSE file. """Shared front-end analyzer specific presubmit script. See http://dev.chromium.org/developers/how-tos/dep...
the-stack_0_7683
""" This file is part of the accompanying code to our manuscript: Kratzert, F., Klotz, D., Shalev, G., Klambauer, G., Hochreiter, S., Nearing, G., "Benchmarking a Catchment-Aware Long Short-Term Memory Network (LSTM) for Large-Scale Hydrological Modeling". submitted to Hydrol. Earth Syst. Sci. Discussions (2019) You ...
the-stack_0_7685
# Copyright (c) Microsoft. All rights reserved. # Licensed under the MIT license. See LICENSE file in the project root for full license information. import numpy import numba import time from MiniFramework.ConvWeightsBias import * from MiniFramework.ConvLayer import * from MiniFramework.HyperParameters_4_2 import * ...
the-stack_0_7686
#!/usr/bin/env python # -*- coding:utf-8 -*- import json import random import re import time import cv2 import numpy as np from PIL import Image from selenium import webdriver from selenium.webdriver import ActionChains from selenium.webdriver import ChromeOptions from selenium.webdriver.common.by import By from sele...
the-stack_0_7687
# -*- coding: utf-8 -*- # ------------------------------------------------------------------------- # This scaffolding model makes your app work on Google App Engine too # File is released under public domain and you can use without limitations # ------------------------------------------------------------------------...
the-stack_0_7688
# # 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 us...
the-stack_0_7689
from model import MusicTransformer from custom.layers import * from custom import callback import params as par from tensorflow.python.keras.optimizer_v2.adam import Adam from data import Data import utils import argparse import datetime import sys tf.executing_eagerly() parser = argparse.ArgumentParser() parser.add...
the-stack_0_7691
import datetime from discord import utils from discord.ext import commands class VocalSalonSystem(commands.Cog): """ VocalSalonSystem() -> Represent the creation of vocal custom with anyone ! """ def __init__(self,bot): self.bot = bot async def create_vocal(self,database,guild,member): ...
the-stack_0_7692
from django.shortcuts import render, get_object_or_404, redirect from django.core.paginator import Paginator from .choices import gender_choices, age_choices, size_choices from .logic.pets_logic import delete_pet from .models import Pet def index(request): queryset_list = Pet.objects.order_by( '-list_date...
the-stack_0_7693
# coding: utf-8 # # Copyright 2014 The Oppia 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 requi...
the-stack_0_7694
import json import uuid from pathlib import Path def load_json_template(name): script_dir = Path(__file__).parent json_path = (script_dir / "json" / f"{name}.json").resolve() with open(json_path, 'r') as json_file: template = json_file.read() return json.loads(template) def create_minio_connection(address, k...
the-stack_0_7695
import re import sys from ..specfile.helpers import detect_specfile, get_source_urls, detect_github_tag_prefix, get_current_version, get_url from urllib.parse import urlparse from typing import Optional import requests RE_GITHUB_PATH_REPO = re.compile('^/([^/]+/[^/]+)/?') RE_GIT_COMMIT = re.compile('^[a-f0-9]{40}$')...
the-stack_0_7696
# Created by Kelvin_Clark on 2/1/2022, 1:43 PM from typing import List, Optional from fastapi import APIRouter, Depends from sqlalchemy.ext.asyncio import AsyncSession from sqlalchemy.orm import Session from starlette.status import HTTP_201_CREATED from app.api.dependencies.oauth import get_admin_system_user, get_cur...
the-stack_0_7697
class Solution: """ @param A : a list of integers @param target : an integer to be inserted @return : an integer """ def searchInsert(self, A, target): if not A: return 0 lo, hi = 0, len(A)-1 while lo <= hi: mid = lo + (hi-lo)//2 val = ...
the-stack_0_7698
import os import bpy from .pbr_utils import PbrSettings from . import pman from . import operators class PandaButtonsPanel: bl_space_type = "PROPERTIES" bl_region_type = "WINDOW" COMPAT_ENGINES = {'PANDA'} @classmethod def poll(cls, context): return context.scene.render.engine in cls.COM...
the-stack_0_7700
from django.shortcuts import render from apps.utils.functions import parse_formatting # Create your views here. from .models import About, ThirdPartyLicenses def about_abstract(request, model, template, navbar_selected=False): '''Abstract function for the pages''' try: query = model.objects.all() ...
the-stack_0_7701
# Copyright 2015-2016 HyperBit developers import os from hyperbit import crypto def do_pow(payload, trials, extra, ttl): length = len(payload) + 8 + extra target = int(2**64 / (trials * (length + max(ttl, 0) * length / (2**16)))) value = target + 1 initial = crypto.sha512(payload) # Make it hard...
the-stack_0_7702
# -*- coding: utf-8 -*- ''' :codeauthor: `Anthony Shaw <anthonyshaw@apache.org>` tests.unit.cloud.clouds.dimensiondata_test ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ''' # Import Python libs from __future__ import absolute_import, print_function, unicode_literals try: import libcloud.security HAS_LIBCL...
the-stack_0_7704
#!/usr/bin/python # Copyright (c) 2018 Warren Usui, MIT License # pylint: disable=W0223 # pylint: disable=E1111 """ Get the scores and w-L-T records of all matches for a player """ from html.parser import HTMLParser from llama_slobber.ll_local_io import get_session from llama_slobber.ll_local_io import get_page_data f...
the-stack_0_7708
# pylint: disable=W0223,W0221 from tornado.web import HTTPError from codebase.web import APIRequestHandler from codebase.models import ( User, Role ) class _Base(APIRequestHandler): def get_user(self, _id): user = self.db.query(User).filter_by(uuid=_id).first() if user: retu...
the-stack_0_7709
# -*- coding: utf-8 -*- # 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 # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or...
the-stack_0_7710
import json import pandas as pd import gzip from io import BytesIO import requests import time import warnings class UnityDataImporter: ''' Class for creating and reading raw data exports from the Unity API. Manual: https://docs.unity3d.com/Manual/UnityAnalyticsRawDataExport.html Can be initialised wi...
the-stack_0_7711
# Tencent is pleased to support the open source community by making ncnn available. # # Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved. # # Licensed under the BSD 3-Clause License (the "License"); you may not use this file except # in compliance with the License. You may obtain a copy of the...
the-stack_0_7715
import pandas as pd import numpy as np import matplotlib.pyplot as plt import openpyxl ########################################################## Size ################################################################### size = pd.read_excel(r'C:\Users\Jhona\OneDrive - Grupo Marista\Projetos\Factor Investing\Factor-Inv...
the-stack_0_7719
import logging logger = logging.getLogger(__name__) import datetime from ..config import Config from pyrogram import Client, filters from pyrogram.types import InlineKeyboardButton, InlineKeyboardMarkup from pyrogram.errors import UserNotParticipant, ChatAdminRequired, UsernameNotOccupied @Client.on_message(filters....
the-stack_0_7721
#! /usr/bin/env python #========================================================================= # makefile_syntax.py #========================================================================= # Helper functions to generate Makefile syntax # # Author : Christopher Torng # Date : June 11, 2019 # import os import tex...
the-stack_0_7723
from deidentify.methods.tagging_utils import (ParsedDoc, _bio_to_biluo, _group_sentences, fix_dangling_entities) def test_group_sentences(): tags = [['O', 'O'], ['B', 'B'], ['B', 'I']] docs = [ ParsedDoc(spacy_...
the-stack_0_7725
# 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 # d...
the-stack_0_7726
# coding: utf-8 # Copyright (c) 2016, 2021, Oracle and/or its affiliates. All rights reserved. # This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may c...
the-stack_0_7727
__copyright__ = "Copyright (c) 2020 Jina AI Limited. All rights reserved." __license__ = "Apache-2.0" from functools import wraps from typing import Callable from .. import Response from ..enums import CallbackOnType from ..excepts import BadClientCallback from ..helper import colored from ..importer import ImportExt...
the-stack_0_7728
# 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 u...
the-stack_0_7729
# -*- coding: utf-8 -*- """ Created on Mon Oct 5 09:23:24 2020 Evaluate whether something is a good idea. @author: Randy Zhu """ # Ask for the user's idea. idea = input("Give me your idea: ") # Make a list of ideas. # ikea brand hashmap # nested lists > dictionary lol idea_questions = [ # Make an a...
the-stack_0_7731
from cvm.constants import ID_PERMS from cvm.models import VirtualMachineInterfaceModel def test_to_vnc(vmi_model, project, security_group): vmi_model.parent = project vmi_model.security_group = security_group vnc_vmi = vmi_model.vnc_vmi assert vnc_vmi.name == vmi_model.uuid assert vnc_vmi.parent...
the-stack_0_7733
# -*- coding: utf-8 -*- ''' Module for sending messages to hipchat :configuration: This module can be used by either passing an api key and version directly or by specifying both in a configuration profile in the salt master/minion config. For example: .. code-block:: yaml hipchat: ...
the-stack_0_7735
from __future__ import print_function from __future__ import absolute_import from __future__ import division import os import System import Eto.Drawing as drawing import Eto.Forms as forms import Rhino import compas class BrowserForm(forms.Form): def __init__(self, url=None, width=800, height=400): sel...
the-stack_0_7737
# ------------------------------------------------------------ # lex.py # # tokenizer for the language # ------------------------------------------------------------ import ply import ply.lex as lex # List of token names. This is always required tokens = ( 'NUMBER', 'PLUS', 'MINUS', 'TIMES', 'DIVIDE',...
the-stack_0_7738
import zlib try: import lzma except ImportError: lzma = None import pytest from ..compress import get_compressor, Compressor, CNONE, ZLIB, LZ4 buffer = bytes(2**16) data = b'fooooooooobaaaaaaaar' * 10 params = dict(name='zlib', level=6, buffer=buffer) def test_get_compressor(): c = get_compressor(name...
the-stack_0_7739
from django.contrib.admin.views.decorators import staff_member_required from django.shortcuts import redirect, render from .forms import MisComprobantesEmitidos_Form from .scripts import extrae, mis_comprobantes_emitidos from django.contrib import messages # Create your views here. @staff_member_required def MisCompr...
the-stack_0_7740
#!/usr/bin/python3 from http.server import HTTPServer, BaseHTTPRequestHandler import sys, os, datetime, re, urllib, shutil import socket import socketserver import threading os.chdir(os.path.dirname(__file__) or '.') # CD to this directory from helpers import * import mimeLib _statics = { 'buffer_size': 4096, ...
the-stack_0_7742
############################################################################### # # Tests for XlsxWriter. # # SPDX-License-Identifier: BSD-2-Clause # Copyright (c), 2013-2021, John McNamara, jmcnamara@cpan.org # from ..excel_comparison_test import ExcelComparisonTest from ...workbook import Workbook class TestCompar...
the-stack_0_7744
# 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_7747
def encrypt(message, key): encrypted_message = '' for char in message: if char.isalpha(): #ord() returns an integer representing the Unicode code point of the character unicode_num = ord(char) unicode_num += key if char.isupper(): ...
the-stack_0_7749
# -*- coding: utf-8 -*- from gluon import current from s3 import * from s3layouts import * try: from .layouts import * except ImportError: pass import s3menus as default # ============================================================================= class S3MainMenu(default.S3MainMenu): """ Custom Applica...
the-stack_0_7750
class Solution(object): def isSubsequence(self, s, t): """ :type s: str :type t: str :rtype: bool """ d = collections.defaultdict(list) for i, c in enumerate(t): d[c].append(i) start = 0 for c in s: idx = bisect.bisect_l...
the-stack_0_7751
import numpy as np import pandas as pd from typing import List, Optional import yaml import re def load_yaml(config_fname: str) -> dict: """Load in YAML config file. Args: config_fname (str): Filename to load. Returns: dict: Return yaml dictionary. """ loader = yaml.SafeLoader ...
the-stack_0_7752
import os, sys, signal, time, timeit import cv2 import numpy as np from multiprocessing import Process, Queue from multiprocessing.sharedctypes import Value, Array #from queue import Queue #from Queue import Queue from c_camera import ImgCap, initCamera import copy np.set_printoptions(threshold=sys.maxsize) class iTa...
the-stack_0_7753
from setuptools import setup, find_packages # To use a consistent encoding from codecs import open from os import path here = path.abspath(path.dirname(__file__)) # Get the long description from the README file with open(path.join(here, 'README.rst'), encoding='utf-8') as f: long_description = f.read() setup( n...
the-stack_0_7754
import sublime, sublime_plugin import json import re import os from os.path import dirname, realpath # Define Path to JSON Cache __FUNCTIONS_MERCHANT_PATH__ = dirname(realpath(__file__)) + os.sep + '/functions-merchant.json' class MvtDoCompletions(sublime_plugin.EventListener): """ MvtDO File / Function Attribute C...
the-stack_0_7756
import logging import re from typing import Iterator logger = logging.getLogger(__name__) def filter_platform_selectors(content: str, platform: str) -> Iterator[str]: """ """ # we support a very limited set of selectors that adhere to platform only platform_sel = { "linux-64": {"linux64", "unix...
the-stack_0_7761
with open(__file__, encoding='utf-8') as f: source = f.read() exec(source[source.find("# =L=I=B=""R=A=R=Y=@="):]) problem = extract_problem(__file__) Check.initialize(problem['parts']) # ============================================================================= # Brez naslova # # ===============================...
the-stack_0_7763
import tensorflow as tf class SumSquaredLoss(tf.keras.losses.Loss): def __init__(self, coord = 5, noobj = .5): super(SumSquaredLoss, self).__init__() self.name = "sum_squared_loss" self.lambda_coord = coord self.lambda_noobj = noobj def _neg_sqrt(self, num): if num < 0:...
the-stack_0_7764
#!/usr/bin/env python # -*- coding: utf-8 -*- # @Time : 5/15/20 4:49 PM # @File : grover.py # qubit number=4 # total number=19 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_7765
""" Generic data algorithms. This module is experimental at the moment and not intended for public consumption """ from __future__ import division from textwrap import dedent from warnings import catch_warnings, simplefilter, warn import numpy as np from pandas._libs import algos, hashtable as htable, lib from panda...
the-stack_0_7766
def biggest_palindrome(digits): """ Finds the largest palindrome from the product of numbers with `digits` digits each. :param digits: :return: the palindromic number """ bound_1 = 10 ** (digits - 1) bound_2 = 10 ** digits palindromes = [] for i in range(bound_1, bound_2): ...
the-stack_0_7767
# # Copyright (c) 2019-2021, ETH Zurich. All rights reserved. # # Please, refer to the LICENSE file in the root directory. # SPDX-License-Identifier: BSD-3-Clause # from flask import Flask, jsonify, request, g import requests from logging.handlers import TimedRotatingFileHandler import logging import multiprocessing...
the-stack_0_7769
import datetime import unittest from unittest import mock from django.contrib.auth.models import AnonymousUser, User from django.core.exceptions import ValidationError from django.core.paginator import Paginator from django.http import Http404, HttpRequest, QueryDict from django.test import ( RequestFactory, TestC...
the-stack_0_7770
#!/usr/bin/env python # -*- coding: utf-8 -*- # # imm documentation build configuration file, created by # sphinx-quickstart on Tue Jul 9 22:26:36 2013. # # This file is execfile()d with the current directory set to its # containing dir. # # Note that not all possible configuration values are present in this # autogen...
the-stack_0_7771
# Lint as: python2, python3 # Copyright 2019 Google LLC. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless req...
the-stack_0_7772
import boto3 import itertools import json import os import re from base64 import b64decode, b64encode from contextlib import contextmanager from math import ceil from subprocess import Popen from time import sleep, time from botocore.exceptions import ClientError from botocore.vendored.requests.packages import urllib...
the-stack_0_7779
from django.urls import path from . import views app_name = 'web' urlpatterns = [ path('', views.index, name='index'), path('api/roi_annotations', views.roi_annotations, name='annotations'), path('api/create_label', views.create_label, name='create_label'), path('api/roi_list', views.roi_list, name='r...
the-stack_0_7783
from itertools import zip_longest import numpy as np class ChunkedGenerator: """ Batched data generator, used for training. The sequences are split into equal-length chunks and padded as necessary. Arguments: batch_size -- the batch size to use for training cameras -- list...
the-stack_0_7784
from __future__ import division from __future__ import print_function import argparse import json import numpy as np import os.path import random import sys import torch import torch.nn as nn import torch.optim as optim import torchvision import tqdm from pathlib import Path from tensorboardX import SummaryWriter fro...
the-stack_0_7785
#Given the image distinguish between different shapes. #Like your model should be able to detect the centre and # classify these shapes in the image automatically. import cv2 from matplotlib import pyplot as plt img= cv2.imread('shapes.png') imgray = cv2.cvtColor(img,cv2.COLOR_BGR2GRAY) ret,thresh = cv2.threshold(imgr...
the-stack_0_7788
import numpy as np import pandas from swdb.util import COUNTIES presidential_xls = 'http://elections.cdn.sos.ca.gov/sov/2016-primary/csv-presidential-candidates.xls' voter_nominated_xls = 'http://elections.cdn.sos.ca.gov/sov/2016-primary/csv-voter-nominated-candidates.xls' props_xls = 'http://elections.cdn.sos.ca.gov...
the-stack_0_7791
import os from nltk import tokenize import pandas as pd from transformers import BertTokenizer tokenizer = BertTokenizer.from_pretrained("bert-large-uncased") def get_labels_vector(): # 文本 texts = [] list = os.listdir("train-articles") for i in range(0, len(list)): f = open("train-...
the-stack_0_7795
# -*- coding: utf-8 -*- # This code is part of Qiskit. # # (C) Copyright IBM 2017. # # 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 modif...
the-stack_0_7796
import functools import jaeger_client import opentracing from opentracing.propagation import Format from opentracing_instrumentation import get_current_span, span_in_context from entityservice.settings import Config as config from entityservice.utils import load_yaml_config DEFAULT_TRACER_CONFIG = {'sampler': {'typ...
the-stack_0_7797
# -*- coding: utf-8 -*- """ OCR VIEWS BLUEPRINT: ocr_bp ROUTES FUNCTIONS: ocr, uploaded_file OTHER FUNCTIONS: allowed_file, tesseract_get_text, get_img_from_url, azure_get_text """ from PIL import Image import requests from flask import request, Blueprint, render_template, redirect, flash, send_from_directory from wer...
the-stack_0_7799
from CHRLINE import * import os, hashlib, hmac, base64, time import axolotl_curve25519 as Curve25519 from Crypto.Cipher import AES from Crypto.Util.Padding import pad, unpad def getSHA256Sum(*args): instance = hashlib.sha256() for arg in args: if isinstance(arg, str): arg = arg.encode() ...
the-stack_0_7800
# # 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...
the-stack_0_7802
import scrapy class SpiderSauraus(scrapy.Spider): name = 'spidersauraus' start_urls = ['https://en.wikipedia.org/wiki/List_of_dinosaur_genera'] def parse(self, response): filename = 'dinosaurs.txt' dinos = set() count = 0 with open(filename, 'w') as f: for dino ...
the-stack_0_7803
############################################################################## # # Copyright (c) 2006 Zope Foundation and Contributors. # All Rights Reserved. # # This software is subject to the provisions of the Zope Public License, # Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. # THIS SOF...
the-stack_0_7805
""" Tests for exam models """ from unittest import TestCase from exams.models import ( ExamAuthorization, ExamProfile, ) class ExamProfileTest(TestCase): """Tests for ExamProfiles""" def test_exam_profile_str(self): """ Test method ExamProfile.__str__ prints correctly """ ...
the-stack_0_7808
# 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_7809
#!/usr/bin/python3 -OO # Copyright 2007-2019 The SABnzbd-Team <team@sabnzbd.org> # # 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 Foundation; either version 2 # of the License, or (at your option) any late...