filename stringlengths 13 19 | text stringlengths 134 1.04M |
|---|---|
the-stack_0_5374 | # Copyright (c) 2021 Cisco Systems, Inc. and its affiliates
# All rights reserved.
# Use of this source code is governed by a BSD 3-Clause License
# that can be found in the LICENSE file.
import pytest
from swagger_server.utils import get_simple_subject, SimpleSubjectType
from swagger_server.models import Subject, Si... |
the-stack_0_5375 | import sys, os
from dataset.image_base import *
set_names = {'all':['train','val','test'],'test':['test'],'val':['train','val','test']}
PW3D_PCsubset = {'courtyard_basketball_00':[200,280], 'courtyard_captureSelfies_00':[500,600],\
'courtyard_dancing_00':[60,370], 'courtyard_dancing_01':[60,270], 'co... |
the-stack_0_5376 | import sys
import PySimpleGUI as sg
# import os.path
import json
import os
import random
import tkinter as tk
def check_experience(s):
if (s.isdigit() == False):
return False
exp = int(s)
if (exp > 30):
return False
return True
filename = './to-grade/hs.json'
try:
with open(file... |
the-stack_0_5377 | from flask import Flask , render_template, request
from db_magazina import Kategor, Tovar, Tovar_photo, Tovar_inphoto
my_flask_app = Flask(__name__)
@my_flask_app.route('/')
def index():
return render_template('index.html')
@my_flask_app.route('/smart/harakter/')
def harakt():
t1= Tovar_inphoto()
harackter = Tov... |
the-stack_0_5378 | #!/usr/bin/env python3
# Copyright (c) 2015-2021 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 multisig RPCs"""
import decimal
import itertools
import json
import os
from test_framework.blockt... |
the-stack_0_5379 | #!/usr/bin/env python3
import string
class BracketError(Exception):
def __init__(self, value):
self.value = value
def __str__(self):
return repr(self.value)
class Machine():
def __init__(self):
self.tape = [0]
self.p = 0
def run(self, code, step=False):
pc = 0
loop_stack = []
brackets = 0
print... |
the-stack_0_5380 | from __future__ import absolute_import
from builtins import object
import future.utils as futils
import os
if futils.PY2:
try:
from cStringIO import StringIO
except ImportError:
from StringIO import StringIO
else:
from io import BytesIO as StringIO
from .compat import as_bytes, as_str
# ... |
the-stack_0_5381 | from conftest import get_metrics
from pyriemann.embedding import Embedding
import pytest
@pytest.mark.parametrize("metric", get_metrics())
@pytest.mark.parametrize("eps", [None, 0.1])
def test_embedding(metric, eps, get_covmats):
"""Test Embedding."""
n_trials, n_channels, n_comp = 6, 3, 2
covmats = get_c... |
the-stack_0_5382 | # -*- 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 o... |
the-stack_0_5383 | import cdflib
import numpy as np
import pandas as pd
import numpy as np
import sys
sys.path.insert(0, '/home/andres_munoz_j/pyCFOFiSAX')
print(sys.path)
# import importlib.util
# spec = importlib.util.spec_from_file_location('ForestISAX', '/home/andres_munoz_j/pyCFOFiSAX/pyCFOFiSAX/_forest_iSAX.py')
# ForestISAX... |
the-stack_0_5384 | #!/usr/bin/env python
# coding: utf-8
# In[1]:
import numpy as np
from flask import Flask,request, jsonify, render_template
import pickle
# In[2]:
app=Flask(__name__)
model=pickle.load(open('spam_model.pkl','rb'))
cv = pickle.load(open('cv-transform.pkl','rb'))
# In[3]:
@app.route('/')
def home():
return... |
the-stack_0_5385 | import copy
import decimal
import subprocess
import time
import os
import re
import datetime
import json
import signal
from core_symbol import CORE_SYMBOL
from testUtils import Utils
from testUtils import Account
from testUtils import EnumType
from testUtils import addEnum
from testUtils import unhandledEnumType
clas... |
the-stack_0_5386 | from flask import render_template, current_app, session, jsonify, request
from info import constants
from info.models import User, News, Category
from info.utils.response_code import RET
from . import index_blue
@index_blue.route('/news_list')
def news_list():
"""
获取首页新闻数据
:return:
"""
# 1. 获取参数
... |
the-stack_0_5388 |
import numpy as np
import matplotlib.pyplot as plt
def dbtime(x):
return (x/2-2)*(x/2-2)+2
xdbtime = np.arange(0,np.pi*4,0.1)
ydbtime = dbtime(xdbtime)
plt.grid()
plt.xlim(0,10)
plt.ylim(0,10)
plt.title("Fonction dbtime 2")
plt.plot(xdbtime,ydbtime)
plt.savefig('dbtime2.png')
|
the-stack_0_5390 | _base_ = './fovea_r50_fpn_4x4_1x_coco.py'
model = dict(
backbone=dict(
depth=101,
init_cfg=dict(type='Pretrained',
checkpoint='torchvision://resnet101')),
bbox_head=dict(
with_deform=True,
norm_cfg=dict(type='GN', num_groups=32, requires_grad=True)))
img_nor... |
the-stack_0_5391 | #------------------------------------------------------------------------------
# Copyright 2020 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/LICENS... |
the-stack_0_5392 | """
.. module:: Katna.config
:platform: Platfrom Independent
:synopsis: This module defines some helpful configuration variables
"""
import os
# # Configuration parameters for Image class
class Image:
# default value by which image size to be reduces for processing
down_sample_factor = 8
# Debug fl... |
the-stack_0_5393 | from __future__ import unicode_literals
from future import standard_library
standard_library.install_aliases()
import sys
from sumatra import commands
from io import StringIO
modes = list(commands.modes)
modes.sort()
usage = {}
sys.argv[0] = 'smt'
for mode in modes:
main = getattr(commands, mode)
usage[mode... |
the-stack_0_5394 | # Copyright (c) Facebook, Inc. and its affiliates.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
# Optional list of dependencies required by the package
dependencies = ['torch', 'torchvision']
# from torch.hub import lo... |
the-stack_0_5395 | import pytest
from app.main.forms import get_placeholder_form_instance
def test_form_class_not_mutated(app_):
with app_.test_request_context(method="POST", data={"placeholder_value": ""}):
form1 = get_placeholder_form_instance("name", {}, "sms", optional_placeholder=False)
form2 = get_placeholde... |
the-stack_0_5397 | """
Copyright (c) 2020 COTOBA DESIGN, Inc.
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, publish, distri... |
the-stack_0_5398 | from vk_bot.core.modules.basicplug import BasicPlug
from vk_bot.core.sql.vksql import *
from vk_bot.core.sql.sqlgame import *
class Admins(BasicPlug):
command = ("бан", "разбан:", "вип",)
doc = "Забанить или разбанить"
available_for = "admins"
def main(self):
requests = self.text[0]
try:... |
the-stack_0_5399 | from typing import Optional, Union
from snowflake.connector import SnowflakeConnection
from dbnd import log_duration
from dbnd._core.plugin.dbnd_plugins import is_plugin_enabled
from dbnd._core.tracking.metrics import log_data, log_target_operation
from dbnd_snowflake.extract_sql_query import TableTargetOperation
fro... |
the-stack_0_5402 | # Copyright (c) Facebook, Inc. and its affiliates.
import torch
from torch.nn import functional as F
from detectron2.structures import Instances, ROIMasks
# perhaps should rename to "resize_instance"
def detector_postprocess(
results: Instances, output_height: int, output_width: int, mask_threshold: float = 0.5
... |
the-stack_0_5403 | """Platform to present any Tuya DP as a binary sensor."""
import logging
from functools import partial
import voluptuous as vol
from homeassistant.components.binary_sensor import (
DEVICE_CLASSES_SCHEMA,
DOMAIN,
BinarySensorEntity,
)
from homeassistant.const import CONF_DEVICE_CLASS
from .common import Lo... |
the-stack_0_5404 | # -*- coding: utf-8 -*-
import argparse
import os
from pprint import pprint
import subprocess
import sys
# input
parser = argparse.ArgumentParser()
parser.add_argument('-in', dest="INPUT_FILES", default="path/to/*.mp4", help="Input media file pattern")
parser.add_argument('-width', dest="TARGET_WIDTH", default=640, t... |
the-stack_0_5407 | from typing import Dict, Callable
from optimade.models import (
DataType,
ErrorResponse,
StructureResource,
ReferenceResource,
)
from optimade.server.exceptions import POSSIBLE_ERRORS
__all__ = ("ENTRY_INFO_SCHEMAS", "ERROR_RESPONSES", "retrieve_queryable_properties")
ENTRY_INFO_SCHEMAS: Dict[str, Cal... |
the-stack_0_5409 | import sys
sys.path.insert(0, '../')
import tornado_dynamodb
extensions = [
'sphinx.ext.autodoc',
'sphinx.ext.intersphinx',
'sphinx.ext.todo',
'sphinx.ext.viewcode',
]
templates_path = ['_templates']
source_suffix = '.rst'
master_doc = 'index'
# General information about the project.
project = 'torn... |
the-stack_0_5411 | """empty message
Revision ID: aa989b9b2862
Revises: 7223a3ac4f30
Create Date: 2021-03-29 19:41:56.312406
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = 'aa989b9b2862'
down_revision = '7223a3ac4f30'
branch_labels = None
depends_on = None
def upgrade():
# ... |
the-stack_0_5412 | from setuptools import setup
install_requires = [
r.strip() for r in open('requirements.txt')
if r.strip() and not r.strip().startswith('#')
]
setup(
name="aiokafka_rpc",
version="1.3.1.3",
author='Kostiantyn Andrusenko',
author_email='kksstt@gmail.com',
description=("RPC over Apache Kafka... |
the-stack_0_5415 | import base64
import datetime
import json
import logging
import os
import time
from functools import reduce
import cv2
import gevent
import numpy as np
from flask import (Blueprint, Flask, Response, current_app, jsonify,
make_response, request)
from flask_sockets import Sockets
from peewee import Sq... |
the-stack_0_5422 | # pylint: skip-file
def main():
'''
ansible git module for committing
'''
module = AnsibleModule(
argument_spec=dict(
state=dict(default='present', type='str', choices=['present']),
msg=dict(default=None, required=True, type='str'),
path=dict(default=None, re... |
the-stack_0_5423 | from __future__ import absolute_import
from fobi.base import form_element_plugin_registry
from .base import ContentTextPlugin
__title__ = 'fobi.contrib.plugins.form_elements.content.content_text.' \
'fobi_form_elements'
__author__ = 'Artur Barseghyan <artur.barseghyan@gmail.com>'
__copyright__ = '2014-20... |
the-stack_0_5424 | import spacy
from spacy.lemmatizer import Lemmatizer
from spacy.lang.en import LEMMA_INDEX, LEMMA_EXC, LEMMA_RULES
import random
import swda
import string
class feature_extractor(object):
def __init__(self):
self.nlp = spacy.load('en_core_web_sm', disable = ['ner', 'textcat'])
self.lemmatizer = spa... |
the-stack_0_5425 | import unittest
from unittest.mock import Mock
from rastervision.augmentor import (Augmentor, AugmentorConfig,
AugmentorConfigBuilder)
from rastervision.protos.augmentor_pb2 import AugmentorConfig as AugmentorConfigMsg
from tests.mock import SupressDeepCopyMixin
MOCK_AUGMENTOR = '... |
the-stack_0_5427 | # Copyright 2012 Nebula, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agree... |
the-stack_0_5428 | import logging
import pytest
from dvc.exceptions import (
NoMetricsFoundError,
NoMetricsParsedError,
OverlappingOutputPathsError,
)
from dvc.path_info import PathInfo
from dvc.utils.fs import remove
from dvc.utils.serialize import dump_yaml, modify_yaml
from tests.func.metrics.utils import _write_json
@... |
the-stack_0_5429 | """Tests for lr_scheduler.py"""
from distutils.version import LooseVersion
from unittest.mock import Mock
import numpy as np
import pytest
import torch
from sklearn.base import clone
from torch.optim import SGD
from torch.optim.lr_scheduler import CosineAnnealingLR
from torch.optim.lr_scheduler import ExponentialLR
fr... |
the-stack_0_5430 | import os
import sys
import re
def terminal(cmd):
return os.popen(cmd).read()
def run(clauses, literals, num_vars):
terminal(f'python3 gen_random_SAT.py {clauses} {literals} {num_vars}')
output = terminal('./kissat_gb/build/kissat random_SAT.cnf | grep process-time:')
match = re.match('c process-time:\s+[^\s]+... |
the-stack_0_5431 | """
To understand why this file is here, please read:
http://cookiecutter-django.readthedocs.io/en/latest/faq.html#why-is-there-a-django-contrib-sites-directory-in-cookiecutter-django
"""
from django.conf import settings
from django.db import migrations
def update_site_forward(apps, schema_editor):
"""Set site d... |
the-stack_0_5439 | from warnings import warn
from django.conf import settings
from wagtail.utils.deprecation import RemovedInWagtail50Warning
def get_admin_base_url(context=None):
"""
Gets the base URL for the wagtail admin site. This is set in `settings.WAGTAILADMIN_BASE_URL`,
which was previously `settings.BASE_URL`.
... |
the-stack_0_5441 | # -*- coding: utf-8 -*-
"""
Class definition of YOLO_v3 style detection model on image and video
"""
import colorsys
import os
from timeit import default_timer as timer
import numpy as np
from keras import backend as K
from keras.models import load_model
from keras.layers import Input
from PIL import Image, ImageFont... |
the-stack_0_5442 | from typing import (
TYPE_CHECKING,
Any,
Callable,
Collection,
Type,
)
from requests.exceptions import (
ConnectionError,
HTTPError,
Timeout,
TooManyRedirects,
)
from web3.types import (
RPCEndpoint,
RPCResponse,
)
if TYPE_CHECKING:
from web3 import Web3 # noqa: F401
... |
the-stack_0_5443 | def hexal_to_decimal(s):
""" s in form 0X< hexal digits>
returns int in decimal"""
s = s[2:]
s = s[::-1]
s = list(s)
for i, e in enumerate(s):
if s[i] == "A": s[i] = "10"
if s[i] == "B": s[i] = "11"
if s[i] == "C": s[i] = "12"
if s[i] == "D": s[i] = "13"
if s[i] == "E": s[i] = "14"
if s[i] == "F": s[i... |
the-stack_0_5447 | from six import string_types
import numpy as np
import os
import h5py
from bmtk.simulator.core.io_tools import io
from .simulation_config import SimulationConfig
from bmtk.simulator.core.node_sets import NodeSet, NodeSetAll
from bmtk.simulator.core import sonata_reader
class SimNetwork(object):
def __init__(self... |
the-stack_0_5448 | import re
from pygments import highlight
from pygments.formatters.html import HtmlFormatter
from pygments.lexers import data
from yapf.yapflib.yapf_api import FormatCode
from ..core import format_json
from ..model.app_data import ExchangeRequest, ExchangeResponse, ApiCall, HttpExchange
internal_var_selector = re.com... |
the-stack_0_5449 | # Copyright 2021 Chuwei Chen chenchuw@bu.edu
# Copyright 2021 Zhaozhong Qi zqi5@bu.edu
# ===========START OF STUDENT'S CODE================
"2021FALL EC602 HW5"
def left_rotate(string, num):
"left rotate a string by num (CounterClockwise)"
return string[num:] + string[:num]
def right_rotate(string, num):
... |
the-stack_0_5450 | # -*- coding: utf-8 -*-
"""
Tencent is pleased to support the open source community by making 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community
Edition) available.
Copyright (C) 2017-2021 THL A29 Limited, a Tencent company. All rights reserved.
Licensed under the MIT License (the "License"); you may not use this file except in co... |
the-stack_0_5451 | # Copyright 2018 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... |
the-stack_0_5452 | config = {
"interfaces": {
"google.ads.googleads.v1.services.FeedPlaceholderViewService": {
"retry_codes": {
"idempotent": ["DEADLINE_EXCEEDED", "UNAVAILABLE"],
"non_idempotent": []
},
"retry_params": {
"default": {
... |
the-stack_0_5453 |
import os
import io
import numpy as np
import librosa
import soundfile as sf
import tensorflow as tf
from scipy.signal import butter, lfilter
from scipy import signal
import copy
def read_raw_audio(audio, sample_rate=16000):
if isinstance(audio, str):
wave, _ = librosa.load(os.path.expanduser(audio), sr=s... |
the-stack_0_5454 | import cv2 as cv
import os
i = 1
def capture(file, interval=450):
cap = cv.VideoCapture(file)
length = int(cap.get(cv.CAP_PROP_FRAME_COUNT))
global i
j = 0
while (cap.isOpened() and j < length):
cap.set(1, j)
ret, frame = cap.read()
if ret == False:
break
... |
the-stack_0_5455 | from chatnoir_api import Index
DEFAULT_START = 0
DEFAULT_SIZE = 10
DEFAULT_SLOP = 0
DEFAULT_INDEX = {
Index.ClueWeb09,
Index.ClueWeb12,
Index.CommonCrawl1511,
}
DEFAULT_MINIMAL = False
DEFAULT_EXPLAIN = False
DEFAULT_RETRIES = 5
DEFAULT_BACKOFF_SECONDS = 1
|
the-stack_0_5456 | # coding: utf-8
"""Constants used by Home Assistant components."""
MAJOR_VERSION = 0
MINOR_VERSION = 88
PATCH_VERSION = '0.dev0'
__short_version__ = '{}.{}'.format(MAJOR_VERSION, MINOR_VERSION)
__version__ = '{}.{}'.format(__short_version__, PATCH_VERSION)
REQUIRED_PYTHON_VER = (3, 5, 3)
# Format for platform files
PL... |
the-stack_0_5457 | # Copyright 2020 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_5460 | """
1249. Minimum Remove to Make Valid Parentheses
Given a string s of '(' , ')' and lowercase English characters.
Your task is to remove the minimum number of parentheses ( '(' or ')', in any positions ) so that the resulting parentheses string is valid and return any valid string.
Formally, a parentheses string is... |
the-stack_0_5462 | print('='*30)
print(' ANALISANDO VALORES')
print('='*30)
op = 0
while op!= 5:
n1 = float(input('Digite o 1º valor: '))
n2 = float(input('Digite o 2º valor: '))
op = int(input('''[1] SOMAR \n[2] MULTIPLICAR \n[3] MAIOR \n[4] NOVOS NÚMEROS \n[5] SAIR \nOpção desejada: '''))
if op == 4:
while ... |
the-stack_0_5464 | from .base_entity import BaseEntity
from psutil import net_io_counters, net_connections
class Network(BaseEntity):
""" A simple object to return network usage """
@property
def get_usage(self):
return self.__get_net_usage()
def __get_net_usage(self):
n = net_io_counte... |
the-stack_0_5466 | from datadog import initialize, api
from datadog.api.constants import CheckStatus
options = {'api_key': '<YOUR_API_KEY>',
'app_key': '<YOUR_APP_KEY>'}
initialize(**options)
check = 'app.ok'
host = 'app1'
status = CheckStatus.OK # equals 0
api.ServiceCheck.check(check=check, host_name=host, status=status... |
the-stack_0_5467 | #!/usr/bin/env python
#
# tournament.py -- implementation of a Swiss-system tournament
#
# Allows recording of tied matches.
# Matches opponents of relative standings.
# Pairs players in unique matches.
#
# TODO: implement match byes
# TODO: implement pairing for odd number of players
# TODO: implement Opponent match w... |
the-stack_0_5468 | #
# ARCADIA Mocks
#
# Copyright (C) 2017 SINTEF Digital
# All rights reserved.
#
# This software may be modified and distributed under the terms
# of the MIT license. See the LICENSE file for details.
#
from requests import Request, Session
from requests.exceptions import ConnectionError
from time import sleep
from... |
the-stack_0_5470 | # ---------------------------
# Alexander Camuto, Matthew Willetts -- 2019
# The University of Oxford, The Alan Turing Institute
# contact: acamuto@turing.ac.uk, mwilletts@turing.ac.uk
# ---------------------------
"""Functions to preprocess SVHN data
"""
import numpy as np
import tensorflow as tf
import os
import sys... |
the-stack_0_5471 |
# Write results to this file
OUTFILE = 'runs/10KB/src2-tgt1/seq-nobro-iter06000.result.csv'
# Source computers for the requests
SOURCE = ['10.0.0.1', '10.0.0.3']
# Should Bro be enabled on the source machines?
SOURCE_BRO = [False, False]
# Target machines for the requests (aka server)
TARGET = ['10.0.0.2']
# Shoul... |
the-stack_0_5474 | # Copyright (c) 2021 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_5475 | # coding=utf-8
# Copyright 2020 The Trax Authors and The HuggingFace Inc. team.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless r... |
the-stack_0_5477 | import numpy as np
import scipy.io as sio
import xarray as xr
import pkg_resources
from .nortek import read_nortek
from .nortek2 import read_signature
from .rdi import read_rdi
from .base import _create_dataset
from ..rotate.base import _set_coords
from ..time import epoch2date, date2epoch, date2matlab, matlab2date
#... |
the-stack_0_5480 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import copy
import importlib
import logging
import re
import six
from saml2_tophat import saml
from saml2_tophat import xmlenc
from saml2_tophat.attribute_converter import from_local, ac_factory
from saml2_tophat.attribute_converter import get_local_name
from saml2_tophat.... |
the-stack_0_5482 | from __future__ import absolute_import
import unittest
import yaml
from attrdict import AttrDict
from pyswitch.device import Device
class InterfaceISISTestCase(unittest.TestCase):
def __init__(self, *args, **kwargs):
super(InterfaceISISTestCase, self).__init__(*args, **kwargs)
with open('confi... |
the-stack_0_5487 | # Copyright (c) 2017 Niklas Rosenstein
#
# 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, publish, d... |
the-stack_0_5488 | import datetime
import time
import pytz
import pandas as pd
import json
import urllib.request
import requests
from tzwhere import tzwhere
from darksky import forecast
import numpy as np
from helpers import okta_to_percent, granularity_to_freq
def get_temperature_cloudcover(start_time=None, end_time=None,
... |
the-stack_0_5489 | # ========================================================================
# Copyright (C) 2019 The MITRE Corporation.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apa... |
the-stack_0_5491 | import fnmatch
import functools
from collections import OrderedDict
from datetime import datetime
import pytest
from django.db.models import F
from django.utils import timezone
from pontoon.base.models import TranslatedResource, Translation
from pontoon.tags.models import Tag
from .site import _factory
def tag_fac... |
the-stack_0_5492 | from threading import Thread
from time import sleep
from tkinter import *
def main():
global left_timer, right_timer
while True:
sleep(1)
if flag:
left_timer = left_timer - 1
m = int(left_timer / 60)
s = left_timer % 60
left['text'] = '{:02d}:{:02... |
the-stack_0_5495 | # Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT license.
"""Unit Tests for internal methods."""
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import os
import unittest
from collections import namedtuple
import graph... |
the-stack_0_5496 | #
# Copyright 2019 The FATE 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_5497 | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import argparse
import h5py
import json
import os
import scipy.misc
import sys
import cityscapesscripts.evaluation.instances2dict_with_polygons as cs
import utils.segms... |
the-stack_0_5498 | import json
from web3 import Web3
from config import NUM_TRANSACTIONS
from config import DEADBEEF
from config import SHARD_IDS
web3 = Web3()
alice_key = '0x4c0883a69102937d6231471b5dbb6204fe5129617082792ae468d01a3f362318'
alice_address = web3.eth.account.privateKeyToAccount(alice_key).address.lower()[2:]
abi = json.... |
the-stack_0_5499 | #!/usr/bin/env python
import os
import sys
import django
from django.conf import settings
from django.test.utils import get_runner
from django_mfa import totp
if __name__ == "__main__":
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
settings.configure(
DATABASES={
'default': {
... |
the-stack_0_5505 | # Copyright 2018 The Cirq Developers
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... |
the-stack_0_5506 | # Copyright 2019 U.C. Berkeley RISE Lab
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agree... |
the-stack_0_5507 | #!/usr/bin/python2.7
"""Makes dictionary file from mozc files.
How to use this tool:
$ git clone https://github.com/google/mozc.git
$ tools/make_dictionary_file.py mozc/src/data/dictionary_oss/dictionary*.txt > app/japanese_name_location_dict.txt
"""
import sys
def make_dictionary(input_file_names, output_file_... |
the-stack_0_5509 | from os import path
import torch
from torch import tensor
import numpy as np
import string
import linecache
class data:
# Assume the data is of this form: SpeakerId Text|AddresseeId Text
def __init__(self, params, voc):
self.params = params
self.voc = voc
# EOS: End of source, start of target
self.EOS = ... |
the-stack_0_5510 | #!/usr/bin/env python3
# Copyright (c) 2014-2016 The Bitcoin Core developers
# Copyright (c) 2017-2019 The Raven Core developers
# Copyright (c) 2020-2021 The Hive Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
""... |
the-stack_0_5511 | # Copyright (c) 2022, Rahib Hassan and Contributors
# See license.txt
import frappe
import unittest
def create_item(item_code):
if frappe.db.exists('Item', item_code):
return frappe.get_doc('Item', item_code)
item = frappe.get_doc({
'doctype': 'Item',
'item_code': item_code,
'item_name': item_code,
'main... |
the-stack_0_5512 | import torch
import torchvision.models
from torchvision.ops import MultiScaleRoIAlign
from torchvision.models.detection.rpn import AnchorGenerator, RPNHead, RegionProposalNetwork
from torchvision.models.detection.roi_heads import RoIHeads
from torchvision.models.detection.faster_rcnn import FastRCNNPredictor, TwoMLPHe... |
the-stack_0_5514 | # -*- coding: utf-8 -*-
#
# 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
... |
the-stack_0_5516 | import unittest
from test import support
import gc
import weakref
import operator
import copy
import pickle
from random import randrange, shuffle
import warnings
import collections
import collections.abc
import itertools
class PassThru(Exception):
pass
def check_pass_thru():
raise PassThru
... |
the-stack_0_5517 | import argparse
import errno
import os
import re
import sys
from argparse import RawDescriptionHelpFormatter
from textwrap import dedent
from urllib.parse import urlsplit
from requests.utils import get_netrc_auth
from .argtypes import (
AuthCredentials, KeyValueArgType, PARSED_DEFAULT_FORMAT_OPTIONS,
parse_au... |
the-stack_0_5520 | from __future__ import unicode_literals
from django import forms
from django.conf import settings
from django.contrib.contenttypes.models import ContentType
from django.template.defaultfilters import filesizeformat
from django.utils.translation import gettext_lazy as _
from .models import Attachment
def validate_ma... |
the-stack_0_5522 | # ex: set sts=4 ts=4 sw=4 noet:
# -*- coding: utf-8 -*-
# ## ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ##
#
# See COPYING file distributed along with the datalad package for the
# copyright and license terms.
#
# ## ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ##... |
the-stack_0_5524 | #OBSOLETE - This script has been moved to the Jupyter Notebook: OSPO_Project_Health_Data_Tableau.ipynb
from common_functions import augur_db_connect, get_dates, get_commits_by_repo
from common_functions import repo_api_call, fork_archive
from tableau_functions import sustain_prs_by_repo_tableau, contributor_risk_tabl... |
the-stack_0_5525 | examples = [
"""Josephine softens. "Yeah, okay. I probably got a little too worked up there."
A bell chimes in the house.
"Oh, wow. Is it that late? We should be headed to bed if you wanna be up early enough to dig your car out."
"Yeah, I should probably turn in."
"The night's still young. Why don't we stay up... |
the-stack_0_5527 | from zeit.cms.content.interfaces import ICommonMetadata
from zeit.cms.interfaces import CONFIG_CACHE
from zeit.cms.interfaces import ITypeDeclaration
from zeit.cms.repository.interfaces import IAutomaticallyRenameable
import collections
import grokcore.component as grok
import logging
import requests
import transaction... |
the-stack_0_5528 | """ Unit tests for visibility operations
"""
import unittest
import astropy.units as u
import numpy
from astropy.coordinates import SkyCoord
from numpy.testing import assert_allclose
from rascil.data_models.memory_data_models import Skycomponent
from rascil.data_models.polarisation import PolarisationFrame
from ra... |
the-stack_0_5530 | #-------------------------------------#
# 对数据集进行训练
#-------------------------------------#
import os
import numpy as np
import time
import torch
from torch.autograd import Variable
import torch.nn as nn
import torch.optim as optim
import torch.nn.functional as F
import torch.backends.cudnn as cudnn
from torch.uti... |
the-stack_0_5532 | import boto3
import os
import json
import datetime
from time import gmtime, strftime
from boto3.session import Session
region = boto3.session.Session().region_name
sagemaker = boto3.client('sagemaker')
code_pipeline = boto3.client('codepipeline')
def lambda_handler(event, context):
try:
print(ev... |
the-stack_0_5533 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
@version: 1.0
@author: Evan
@time: 2019/12/4 15:16
"""
import tornado.web
import tornado.ioloop
class CookieHandler(tornado.web.RequestHandler):
def get(self):
"""
cookie 在 Response Headers
Set-Cookie: hello="2|1:0|10:1575445821|5:hello|8... |
the-stack_0_5537 | from typing import Callable, Mapping
import pandas as pd
from starfish.core.intensity_table.intensity_table import IntensityTable
from starfish.core.types import (
Axes,
Features,
SpotAttributes,
SpotFindingResults,
TraceBuildingStrategies
)
from .util import _build_intensity_table, _match_spots, ... |
the-stack_0_5538 | """Useful utilities for interacting with Evergreen."""
from datetime import datetime, date
from typing import Any, Iterable, Optional
from dateutil.parser import parse
EVG_DATETIME_FORMAT = "%Y-%m-%dT%H:%M:%S.%fZ"
EVG_SHORT_DATETIME_FORMAT = "%Y-%m-%dT%H:%M:%SZ"
EVG_DATE_FORMAT = "%Y-%m-%d"
EVG_DATE_INPUT_FORMAT = '"... |
the-stack_0_5539 | import argparse
from datetime import datetime, timedelta
import praw
from prettytable import PrettyTable
from psaw import PushshiftAPI
import config_terminal as cfg
from helper_funcs import check_positive
# -------------------------------------------------------------------------------------------------------------... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.