max_stars_repo_path stringlengths 4 245 | max_stars_repo_name stringlengths 7 115 | max_stars_count int64 101 368k | id stringlengths 2 8 | content stringlengths 6 1.03M |
|---|---|---|---|---|
pylatexenc/latexencode/_partial_latex_encoder.py | rohankumardubey/pylatexenc | 146 | 11005900 | <reponame>rohankumardubey/pylatexenc
# -*- coding: utf-8 -*-
#
# The MIT License (MIT)
#
# Copyright (c) 2021 <NAME>
#
# 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, i... |
lib/git/diff3.py | mrshu/stash | 1,822 | 11005902 | <gh_stars>1000+
# -*- coding: utf-8 -*-
# ============================================================================
# Copyright (C) 1988, 1989, 1992, 1993, 1994 Free Software Foundation, Inc.
# Copyright (c) 2011-2012 University of Pennsylvania
# Copyright (c) 2013-2014 <NAME>
# All rights reserved.
# ========... |
convlab2/dst/trade/multiwoz/fine_tune.py | Malavikka/ConvLab-2 | 339 | 11005907 | <gh_stars>100-1000
from convlab2.dst.trade.multiwoz.utils.config import *
from convlab2.dst.trade.multiwoz.models.TRADE import *
from copy import deepcopy
except_domain = args['except_domain']
directory = args['path'].split("/")
HDD = directory[2].split('HDD')[1].split('BSZ')[0]
BSZ = int(args['batch']) if args['batc... |
music21/common/fileTools.py | cuthbertLab/music21 | 1,449 | 11005929 | <filename>music21/common/fileTools.py
# -*- coding: utf-8 -*-
# ------------------------------------------------------------------------------
# Name: common/fileTools.py
# Purpose: Utilities for files
#
# Authors: <NAME>
# <NAME>
#
# Copyright: Copyright © 2009-2015 <NAME> and the mu... |
python_toolbox/context_management/context_manager_type_type.py | hboshnak/python_toolbox | 119 | 11005968 | <reponame>hboshnak/python_toolbox
# Copyright 2009-2017 <NAME>.
# This program is distributed under the MIT license.
class ContextManagerTypeType(type):
'''
Metaclass for `ContextManagerType`. Shouldn't be used directly.
Did I just create a metaclass for a metaclass. OH YES I DID. It's like a
double ... |
misc/update/python/requestid_threaded.py | ozhound/nZEDb | 472 | 11006007 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import print_function
import sys, os, time
import threading
import subprocess
import string
import signal
import datetime
import re
try:
import queue
except ImportError:
import Queue as queue
try:
import urllib2
except ImportError:
import urllib.reques... |
banpei/hotelling.py | gavbdheiver/Anomaly-Detection-Singular-spectrum-transformation-sst- | 274 | 11006010 | <gh_stars>100-1000
import numpy as np
from scipy import stats
from banpei.base.model import BaseModel
class Hotelling(BaseModel):
def __init__(self):
pass
def detect(self, data, threshold):
"""
Parameters
----------
data : array_like
Input array or objec... |
python/ray/ray_operator/operator_utils.py | 77loopin/ray | 21,382 | 11006015 | import copy
import logging
import os
import re
import time
from typing import Any
from typing import Dict
from typing import Iterator
from typing import List
from kubernetes.watch import Watch
from kubernetes.client.rest import ApiException
from ray import ray_constants
from ray.autoscaler._private._kubernetes import... |
code/DeepDG/alg/algs/Mixup.py | lw0517/transferlearning | 9,657 | 11006039 | # coding=utf-8
import numpy as np
import torch.nn.functional as F
from datautil.util import random_pairs_of_minibatches
from alg.algs.ERM import ERM
class Mixup(ERM):
def __init__(self, args):
super(Mixup, self).__init__(args)
self.args = args
def update(self, minibatches, opt, sch):
... |
opy/_regtest/src/build/quick_ref.py | bb010g/oil | 2,209 | 11006040 | <gh_stars>1000+
#!/usr/bin/env python
from __future__ import print_function
"""
quick_ref.py
"""
import cgi
import os
import pprint
import re
import sys
# e.g. COMMAND LANGUAGE
CAPS_RE = re.compile(r'^[A-Z ]+$')
# 1. Optional X, then a SINGLE space
# 2. lower-case or upper-case topic
# 3. Optional: A SINGLE space, ... |
Token(JWT)/main.py | Zhgx/bili | 166 | 11006051 | import time
import json
import base64
import hashlib
import hmac
salt = "<PASSWORD>"
exp = 1000
headers = {
"typ": "ygt",
"exp": int(time.time() + exp) # 过期时间戳
}
payload = {
"uid": 1,
"author": "好音宫",
"admin": 1
}
# 生产header
first = base64.urlsafe_b64encode(json.dumps(headers, separators=(','... |
lib/tests/streamlit/temporary_directory_test.py | kamito/streamlit | 19,099 | 11006076 | <reponame>kamito/streamlit
# Copyright 2018-2021 Streamlit 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 applic... |
wsgi/load.py | codio/pencilcode | 144 | 11006079 | #!/usr/bin/env python
# load.py
import sys, os, cgi, re, json, stat, time
sys.path.append(os.path.dirname(__file__))
import config
rootcachename = os.path.join(config.cachedir, 'rootcache')
def uri_without_query(uri):
return uri.split('?', 1)[0]
def uri_ext(url):
url = uri_without_query(url)
dot = url.rfind('... |
tests/misc/test_readnumbers.py | BarrensZeppelin/PyRival | 748 | 11006080 | import io
import random
import sys
from pyrival.readnumbers import *
def test_readnumbers(monkeypatch):
nums = [random.randint(-10000, 10000) for _ in range(100000)]
string = "".join(str(num) + random.choice([" ", "\n", "\r\n"]) for num in nums).rstrip()
stream = io.TextIOWrapper(io.BytesIO(string.encod... |
3DMM/util/load_mats.py | gitlabspy/hififace | 173 | 11006086 | <gh_stars>100-1000
"""This script is to load 3D face model for Deep3DFaceRecon_pytorch
"""
import numpy as np
from PIL import Image
from scipy.io import loadmat, savemat
from array import array
import os.path as osp
# load expression basis
def LoadExpBasis(bfm_folder='./model/Deep3DFaceRecon_pytorch/BFM'):
n_vert... |
SMPyBandits/Policies/RandomizedIndexPolicy.py | balbok0/SMPyBandits | 309 | 11006088 | <gh_stars>100-1000
# -*- coding: utf-8 -*-
""" Generic randomized index policy.
- Reference: [["On the Optimality of Perturbations in Stochastic and Adversarial Multi-armed Bandit Problems", by <NAME>, <NAME>, arXiv:1902.00610]](https://arxiv.org/pdf/1902.00610.pdf)
"""
from __future__ import division, print_function ... |
lazy/user_knn.py | topolphukhanh/sequence-based-recommendations | 371 | 11006091 | <filename>lazy/user_knn.py
from __future__ import print_function
import numpy as np
import scipy.sparse as ssp
import os.path
from .lazy import Lazy
from .utils import top_k, get_sparse_vector
class UserKNN(Lazy):
"""
"""
def __init__(self, similarity_measure='cosine', neighborhood_size=80, **kwargs):
super(Use... |
examples/vocabulary_pruning/measure_performance.py | zchu-hit-scir/TextPruner | 133 | 11006098 | <gh_stars>100-1000
import logging
logging.basicConfig(level = logging.INFO,format = '%(asctime)s - %(name)s - %(levelname)s - %(message)s')
logger = logging.getLogger(__name__)
from transformers import XLMRobertaForSequenceClassification,XLMRobertaTokenizer
import sys, os
sys.path.insert(0, os.path.abspath('..'))
fr... |
sonora/echotest.py | lidizheng/sonora | 178 | 11006103 | <reponame>lidizheng/sonora
from google.protobuf.duration_pb2 import Duration
import sonora.client
from echo.echo import echo_pb2_grpc, echo_pb2
c = sonora.client.insecure_web_channel("http://localhost:8888")
x = echo_pb2_grpc.EchoServiceStub(c)
d = Duration(seconds=1)
for r in x.ServerStreamingEcho(
echo_pb2.Serv... |
alipay/aop/api/domain/TradeSettleInfo.py | snowxmas/alipay-sdk-python-all | 213 | 11006120 | <gh_stars>100-1000
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.constant.ParamConstants import *
from alipay.aop.api.domain.TradeSettleDetail import TradeSettleDetail
class TradeSettleInfo(object):
def __init__(self):
self._trade_settle_detail_list = None
@property
... |
mhw_armor_edit/ftypes/wep_glan.py | nicolas43000/MHWorldData | 129 | 11006144 | # coding: utf-8
from mhw_armor_edit.ftypes import StructFile, Struct
class WepGlanEntry(Struct):
STRUCT_SIZE = 8
id: "<I"
type: "<H"
level: "<H"
class WepGlan(StructFile):
EntryFactory = WepGlanEntry
MAGIC = 0x0177
|
contrib/scripts/check-tservers.py | jlpedrosa/accumulo | 870 | 11006152 | <gh_stars>100-1000
#! /usr/bin/env python
#
# 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, ... |
basic/34_pickle.py | subshine/tutorials | 10,786 | 11006175 | # View more python learning tutorial on my Youtube and Youku channel!!!
# Youtube video tutorial: https://www.youtube.com/channel/UCdyjiB5H8Pu7aDTNVXTTpcg
# Youku video tutorial: http://i.youku.com/pythontutorial
import pickle
a_dict = {'da': 111, 2: [23,1,4], '23': {1:2,'d':'sad'}}
# pickle a variable to a file
fi... |
wasienv/wasirun.py | coolreader18/wasienv | 221 | 11006192 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import print_function
import sys
from .tools import logger, run_process, execute
def run(args):
if len(args) < 2:
# It should be wasirun x.wasm
raise Exception("You need to provide a WebAssembly file")
filename = args[1]
proc... |
neo/test/rawiotest/test_examplerawio.py | Mario-Kart-Felix/python-neo | 199 | 11006196 | <gh_stars>100-1000
"""
Tests of neo.rawio.examplerawio
Note for dev:
if you write a new RawIO class your need to put some file
to be tested at g-node portal, Ask neuralensemble list for that.
The file need to be small.
Then you have to copy/paste/renamed the TestExampleRawIO
class and a full test will be done to test... |
evalml/automl/callbacks.py | Mahesh1822/evalml | 454 | 11006210 | """Callbacks available to pass to AutoML."""
import logging
from evalml.exceptions import PipelineScoreError
logger = logging.getLogger(__name__)
def silent_error_callback(exception, traceback, automl, **kwargs):
"""No-op."""
def raise_error_callback(exception, traceback, automl, **kwargs):
"""Raises the ... |
tests/unit/test_models/test_full_battery_models/test_lead_acid/test_loqs.py | manjunathnilugal/PyBaMM | 330 | 11006230 | <filename>tests/unit/test_models/test_full_battery_models/test_lead_acid/test_loqs.py
#
# Tests for the lead-acid LOQS model
#
import pybamm
import unittest
class TestLeadAcidLOQS(unittest.TestCase):
def test_well_posed(self):
options = {"thermal": "isothermal"}
model = pybamm.lead_acid.LOQS(optio... |
supervisor/discovery/services/homematic.py | pnjongang/supervisor | 597 | 11006246 | """Discovery service for HomeMatic."""
import voluptuous as vol
from supervisor.validate import network_port
from ..const import ATTR_HOST, ATTR_PORT
SCHEMA = vol.Schema(
{
str: vol.Schema(
{
vol.Required(ATTR_HOST): str,
vol.Required(ATTR_PORT): network_port,
... |
resotolib/test/test_graph.py | someengineering/resoto | 126 | 11006268 | import pytest
from resotolib.graph import Graph, GraphContainer, GraphExportIterator
from resotolib.baseresources import BaseResource, EdgeType, GraphRoot
import resotolib.logger as logger
from dataclasses import dataclass
from typing import ClassVar
from sys import getrefcount
logger.getLogger("resoto").setLevel(logg... |
models/__init__.py | lessw2020/CSWin-Transformer | 278 | 11006295 | <filename>models/__init__.py
# ------------------------------------------
# CSWin Transformer
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
# written By <NAME>
# ------------------------------------------
from .cswin import *
|
include/vigra/promote_traits.hxx.py | burgerdev/vigra | 316 | 11006296 | t = ['bool', 'signed char', 'unsigned char', 'short', 'unsigned short',
'int', 'unsigned int', 'long', 'unsigned long', 'float', 'double',
'long double', 'long long', 'unsigned long long']
pt = '''template <>
struct PromoteTraits<%(A)s, %(B)s> : public detail::PromoteType<%(A)s, %(B)s>
{
typedef detail... |
third_party/tlslite/tlslite/basedb.py | zealoussnow/chromium | 2,151 | 11006301 | <filename>third_party/tlslite/tlslite/basedb.py
# Authors:
# <NAME>
# <NAME> - python 3 port
#
# See the LICENSE file for legal information regarding use of this file.
"""Base class for SharedKeyDB and VerifierDB."""
try:
import anydbm
except ImportError:
# Python 3
import dbm as anydbm
import thread... |
apps/statistics/models.py | Paul3MK/NewsBlur | 3,073 | 11006307 | import datetime
import mongoengine as mongo
import urllib.request, urllib.error, urllib.parse
import redis
import dateutil
from django.conf import settings
from apps.social.models import MSharedStory
from apps.profile.models import Profile
from apps.statistics.rstats import RStats, round_time
from utils.story_functions... |
src/oci/cims/models/create_ticket_details.py | Manny27nyc/oci-python-sdk | 249 | 11006323 | <filename>src/oci/cims/models/create_ticket_details.py
# 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 a... |
astroquery/vo_conesearch/validator/tstquery.py | mfisherlevine/astroquery | 577 | 11006335 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
Sub-query to obtain test parameters from service providers.
In case USVO service is unstable, it does the following:
#. Try USVO production server.
#. If SR > 0.1, force SR to be 0.1.
#. If fails, use RA=0 DEC=0 SR=0.1.
"""
# STDLIB
impo... |
test cases/failing/95 custom target install data/preproc.py | kira78/meson | 4,047 | 11006361 | <filename>test cases/failing/95 custom target install data/preproc.py
#!/usr/bin/env python3
import sys
if len(sys.argv) != 3:
print(sys.argv[0], '<input>', '<output>')
inf = sys.argv[1]
outf = sys.argv[2]
with open(outf, 'wb') as o:
with open(inf, 'rb') as i:
o.write(i.read())
|
polyvore/run_inference_vse.py | hrsma2i/polyvore | 143 | 11006387 | # Copyright 2017 <NAME>. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agree... |
Algo and DSA/LeetCode-Solutions-master/Python/design-a-file-sharing-system.py | Sourav692/FAANG-Interview-Preparation | 3,269 | 11006400 | # Time: ctor: O(1)
# join: O(logu + c), u is the number of total joined users
# leave: O(logu + c), c is the number of chunks
# request: O(u)
# Space: O(u * c)
import heapq
# "u ~= n" solution, n is the average number of users who own the chunk
class FileSharing(object):
def __init... |
tests/test_dynunet_v1.py | dylanbuchi/MONAI | 2,971 | 11006428 | <filename>tests/test_dynunet_v1.py
# Copyright 2020 - 2021 MONAI Consortium
# 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... |
ghidra_9.0/Ghidra/Features/Python/data/jython-2.7.1/Lib/_rawffi.py | ChristopherMorrison/ghidra | 577 | 11006435 | <gh_stars>100-1000
import com.sun.jna as jna
def get_libc():
return CDLL("c")
typecode_map = {'h': 2, 'H': 2}
class Array(object):
def __init__(self, typecode):
self.typecode = typecode
self.itemsize = typecode_map[typecode]
def __call__(self, size, autofree=False):
if not autofr... |
tests/models/test_vision.py | lavoiems/lightning-bolts | 822 | 11006475 | <filename>tests/models/test_vision.py
import pytest
import torch
from packaging import version
from pytorch_lightning import LightningDataModule, Trainer
from pytorch_lightning import __version__ as pl_version
from pytorch_lightning import seed_everything
from torch.utils.data import DataLoader
from pl_bolts.datamodul... |
tensorflow/python/training/basic_loops_test.py | connectthefuture/tensorflow | 680 | 11006483 | # 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... |
pre-processing/audio.py | leonheess/deepspeech-german | 268 | 11006498 | <filename>pre-processing/audio.py
# Author: Mozilla DeepSpeech v0.4.0
import numpy as np
import scipy.io.wavfile as wav
from python_speech_features import mfcc
def audiofile_to_input_vector(audio_filename, numcep, numcontext):
r"""
Given a WAV audio file at ``audio_filename``, calculates ``numcep`` MFCC fea... |
app/services/github.py | cmaccorm/mlh-hackathon-flask-starter | 747 | 11006519 | import requests, json
api_url = 'https://api.github.com'
authorize_url = 'https://github.com/login/oauth/authorize'
token_url = 'https://github.com/login/oauth/access_token'
class GitHub():
def __init__(self, client_id = '', client_secret = '', access_token = ''):
self.client_id = client_id
self.... |
alex/applications/PublicTransportInfoCS/exceptions.py | oplatek/alex | 184 | 11006524 | <filename>alex/applications/PublicTransportInfoCS/exceptions.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from alex.components.dm.exceptions import DialoguePolicyException
class PTICSHDCPolicyException(DialoguePolicyException):
pass
|
mozillians/dino_park/urls.py | divyamoncy/mozillians | 202 | 11006580 | <reponame>divyamoncy/mozillians<gh_stars>100-1000
from django.conf.urls import url
from mozillians.dino_park import views as dino_park_views
app_name = 'dino_park'
urlpatterns = [
url('^api/v3/orgchart/$',
dino_park_views.orgchart, name='dino_park_orgchart'),
url('^api/v3/orgchart/(?P<path>related|tr... |
appimagebuilder/modules/generate/recipe_generator.py | goldstar611/appimage-builder | 155 | 11006608 | <reponame>goldstar611/appimage-builder<filename>appimagebuilder/modules/generate/recipe_generator.py
# Copyright 2021 <NAME>
#
# 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 res... |
tartiflette/language/validators/query/directives_are_unique_per_location.py | matt-koevort/tartiflette | 530 | 11006647 | <gh_stars>100-1000
from tartiflette.language.validators.query.rule import (
June2018ReleaseValidationRule,
)
from tartiflette.language.validators.query.utils import find_nodes_by_name
from tartiflette.utils.errors import graphql_error_from_nodes
class DirectivesAreUniquePerLocation(June2018ReleaseValidationRule):... |
python/dgl/nn/pytorch/conv/gatv2conv.py | lfchener/dgl | 9,516 | 11006667 | """Torch modules for graph attention networks v2 (GATv2)."""
# pylint: disable= no-member, arguments-differ, invalid-name
import torch as th
from torch import nn
from .... import function as fn
from ...functional import edge_softmax
from ....base import DGLError
from ..utils import Identity
from ....utils import expan... |
code/1-development/train_softmax_not_dataloader.py | wmh02240/3D-convolutional-speaker-recognition-pytorch | 123 | 11006676 | import torch
import torchvision
import torchvision.transforms as transforms
import os
from scipy.io.wavfile import read
import scipy.io.wavfile as wav
import subprocess as sp
import numpy as np
import argparse
import random
import os
import sys
import torch.nn.init as init
from random import shuffle
import speechpy
imp... |
test/transforms/test_random_link_split.py | Kenneth-Schroeder/pytorch_geometric | 12,651 | 11006684 | import torch
from torch_geometric.utils import is_undirected
from torch_geometric.data import Data, HeteroData
from torch_geometric.transforms import RandomLinkSplit
def get_edge_index(num_src_nodes, num_dst_nodes, num_edges):
row = torch.randint(num_src_nodes, (num_edges, ), dtype=torch.long)
col = torch.ra... |
tests/test_printer.py | NickMitin/pyhttptest | 142 | 11006692 | <reponame>NickMitin/pyhttptest
from pyhttptest import printer
def test_slice_str_args():
dummy_str = '''
Lorem Ipsum is simply dummy text of the printing and typesetting industry.
Lorem Ipsum has been the industry's standard dummy text ever since the 1500s,
when an unknown printer took a galley of typ... |
insights/parsers/tests/test_gnocchi.py | mglantz/insights-core | 121 | 11006740 | <reponame>mglantz/insights-core
import doctest
from insights.parsers import gnocchi
from insights.parsers.gnocchi import GnocchiConf, GnocchiMetricdLog
from insights.tests import context_wrap
from datetime import datetime
GNOCCHI_CONF = """
[DEFAULT]
log_dir = /var/log/gnocchi
[api]
auth_mode = keystone
max_limit = 1... |
homeassistant/components/environment_canada/camera.py | learn-home-automation/core | 22,481 | 11006743 | <reponame>learn-home-automation/core
"""Support for the Environment Canada radar imagery."""
from __future__ import annotations
from homeassistant.components.camera import Camera
from homeassistant.helpers.update_coordinator import CoordinatorEntity
from .const import ATTR_OBSERVATION_TIME, DOMAIN
async def async_s... |
Concurrency/1114. Print in Order.py | beckswu/Leetcode | 138 | 11006746 | import threading
class Foo:
def __init__(self):
self.cv = threading.Condition()
self.n = 0
self.waitone = lambda : self.n == 1
self.waittwo = lambda : self.n == 2
def first(self, printFirst: 'Callable[[], None]') -> None:
with self.cv:
# printFirst(... |
src/hobbits-plugins/analyzers/KaitaiStruct/ksy_py/media/ogg.py | SabheeR/hobbits | 304 | 11006764 | # This is a generated file! Please edit source .ksy file and use kaitai-struct-compiler to rebuild
from pkg_resources import parse_version
import kaitaistruct
from kaitaistruct import KaitaiStruct, KaitaiStream, BytesIO
import collections
if parse_version(kaitaistruct.__version__) < parse_version('0.9'):
raise E... |
Chapter15/doc2vec/word2vec-sentiments/word2vec-sentiments.py | kksonge/Hands-On-Machine-Learning-for-Algorithmic-Trading | 944 | 11006782 | <reponame>kksonge/Hands-On-Machine-Learning-for-Algorithmic-Trading<filename>Chapter15/doc2vec/word2vec-sentiments/word2vec-sentiments.py
# gensim modules
from gensim import utils
from gensim.models.doc2vec import TaggedDocument
from gensim.models import Doc2Vec
# random
import random
# numpy
import numpy
# classifi... |
rlenv/StockTradingEnv0.py | cftang/RL-Stock | 2,330 | 11006787 | <reponame>cftang/RL-Stock
import random
import json
import gym
from gym import spaces
import pandas as pd
import numpy as np
MAX_ACCOUNT_BALANCE = 2147483647
MAX_NUM_SHARES = 2147483647
MAX_SHARE_PRICE = 5000
MAX_VOLUME = 1000e8
MAX_AMOUNT = 3e10
MAX_OPEN_POSITIONS = 5
MAX_STEPS = 20000
MAX_DAY_CHANGE = 1
INITIAL_ACC... |
peering/migrations/0036_auto_20190411_2209.py | schiederme/peering-manager | 173 | 11006795 | # Generated by Django 2.2 on 2019-04-11 20:09
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [("peering", "0035_auto_20190311_2334")]
operations = [
migrations.AddField(
model_name="autonomoussystem",
name="contact_email",
... |
networkx/tests/test_relabel.py | armando1793/networkx | 445 | 11006799 | <reponame>armando1793/networkx
#!/usr/bin/env python
from nose.tools import *
from networkx import *
from networkx.convert import *
from networkx.algorithms.operators import *
from networkx.generators.classic import barbell_graph, cycle_graph
from networkx.testing import *
class TestRelabel():
def test_convert_no... |
tools/cal_pos_neg.py | LinJayan/FAT_DeepFFM_Paddle | 2,739 | 11006802 | #encoding=utf-8
# 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
#
# Unl... |
tests/suite/test_v_s_route_grpc.py | Taymindis/kubernetes-ingress | 3,803 | 11006831 | import grpc
import pytest
from kubernetes.client.rest import ApiException
from settings import TEST_DATA, DEPLOYMENTS
from suite.custom_assertions import assert_event_starts_with_text_and_contains_errors, \
assert_grpc_entries_exist, assert_proxy_entries_do_not_exist, assert_proxy_entries_exist
from suite.custom_r... |
django_for_startups/errors/custom_errors.py | olifante/django_for_startups | 102 | 11006836 | <gh_stars>100-1000
# Standard Library imports
# Core Django imports
# Third-party imports
# App imports
class Error(Exception):
def __init__(self, value=""):
if not hasattr(self, "value"):
self.value = value
def __str__(self):
return repr(self.value)
###############
# User Er... |
tests/system/verbs/catkin_build/test_eclipse.py | 6RiverSystems/catkin_tools | 151 | 11006840 | <filename>tests/system/verbs/catkin_build/test_eclipse.py
import os
from ....utils import in_temporary_directory
from ....utils import assert_files_exist
from ....utils import catkin_success
from ....utils import redirected_stdio
from ....workspace_assertions import assert_workspace_initialized
from ....workspace_as... |
cutkum/ck_model.py | mrjummy/cutkum | 169 | 11006844 | #!/usr/bin/env python
#
# <NAME> (https://pucktada.github.io/)
# License: MIT
# 2017-05-01
#
# A recurrent neural network model (LSTM) for thai word segmentation
import logging
import re
import numpy as np
import tensorflow as tf
import tensorflow.contrib.layers as layers
import tensorflow.contrib.rnn as rnn
#from . i... |
hkws/model/__init__.py | tyconcps/pyhikvision | 137 | 11006893 | <filename>hkws/model/__init__.py
# -*- coding: utf-8 -*-
__version__ = '3'
from hkws.model import alarm, base, camera
|
test/connector/connector/uniswap_v3/fixture.py | BGTCapital/hummingbot | 3,027 | 11006897 | <filename>test/connector/connector/uniswap_v3/fixture.py<gh_stars>1000+
class Fixture:
BALANCES = {"balances": {"ETH": 0.02, "ZRX": 20}}
APPROVALS = {"approvals": {"ETH": 999999999, "ZRX": 999999999}}
BUY_ORDER = {"txHash": "testing", "gasPrice": 1, "gasLimit": 1, "gasCost": 1}
ADD_POSITION = {"txHash":... |
pycharm2020.1.3/script/common/component/Component.py | LaudateCorpus1/realtime-server | 465 | 11006910 | <filename>pycharm2020.1.3/script/common/component/Component.py
from __future__ import annotations
import typing
from core.util.TimerHub import TimerHub
if typing.TYPE_CHECKING:
from common.PuppetEntity import PuppetEntity
from common.PuppetEntity import RemoteEntity
from common.PuppetEntity import RemoteComp... |
tools/usb_gadget/hid_gadget.py | google-ar/chromium | 2,151 | 11006917 | <filename>tools/usb_gadget/hid_gadget.py
# Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Human Interface Device gadget module.
This gadget emulates a USB Human Interface Device. Multiple logical compon... |
tello_driver/launch/emulator_launch.py | crisdeodates/DJI-Tello_ros2_cpp | 114 | 11006933 | from launch import LaunchDescription
from launch_ros.actions import Node
from launch.actions import ExecuteProcess
# Launch an emulator for testing
def generate_launch_description():
emulator_path = 'install/tello_driver/lib/tello_driver/tello_emulator'
tello_driver_params = [{'drone_ip': '127.0.0.1'}]
... |
tests/cpydiff/types_int_subclassconv.py | sebastien-riou/micropython | 13,648 | 11006938 | """
categories: Types,int
description: No int conversion for int-derived types available
cause: Unknown
workaround: Avoid subclassing builtin types unless really needed. Prefer https://en.wikipedia.org/wiki/Composition_over_inheritance .
"""
class A(int):
__add__ = lambda self, other: A(int(self) + other)
a = A... |
datumaro/components/algorithms/rise.py | IRDonch/datumaro | 237 | 11006943 | <reponame>IRDonch/datumaro
# Copyright (C) 2019-2020 Intel Corporation
#
# SPDX-License-Identifier: MIT
# pylint: disable=unused-variable
from math import ceil
import numpy as np
from datumaro.components.annotation import AnnotationType
from datumaro.util.annotation_util import nms
def flatmatvec(mat):
return... |
test/functional/test_pubsub.py | Eternity-labs/py-ipfs-http-client | 186 | 11006954 | import uuid
import pytest
@pytest.fixture
def pubsub_topic():
"""
Creates a unique topic for testing purposes
"""
return "{}.testing".format(uuid.uuid4())
def test_publish_subscribe(client, pubsub_topic):
"""
We test both publishing and subscribing at
the same time because we cannot verify that
something... |
zipline/pipeline/data/testing.py | lv-cha/zipline-chinese | 606 | 11006955 | <reponame>lv-cha/zipline-chinese<filename>zipline/pipeline/data/testing.py
"""
Datasets for testing use.
Loaders for datasets in this file can be found in
zipline.pipeline.data.testing.
"""
from .dataset import Column, DataSet
from zipline.utils.numpy_utils import (
bool_dtype,
float64_dtype,
datetime64ns_... |
src/genie/libs/parser/nxos/tests/ShowIsis/cli/equal/golden_output_expected.py | balmasea/genieparser | 204 | 11006960 | <filename>src/genie/libs/parser/nxos/tests/ShowIsis/cli/equal/golden_output_expected.py
expected_output = {
'instance': {
'test': {
'isis_process': 'test',
'instance_number': 1,
'uuid': '1090519320',
'process_id': 1581,
'vrf': {
'... |
abandon/puppet_v0.3.5.py | songtebo/puppet | 325 | 11006980 | """puppetrader for ths client uniform"""
__author__ = '睿瞳深邃(https://github.com/Raytone-D)'
__project__ = '扯线木偶(puppetrader for ths client unity)'
__version__ = "0.3.5"
'推荐使用:anaconda3 最新版,或者Python >= 3.6'
# coding: utf-8
import ctypes
from functools import reduce
import time
import pyperclip
import json
... |
nmmo/systems/achievement.py | jsuarez5341/neural-mmo | 230 | 11006986 | <filename>nmmo/systems/achievement.py
from pdb import set_trace as T
class Tier:
EASY = 4
NORMAL = 10
HARD = 25
class Diary:
def __init__(self, config):
self.achievements = []
if config.game_system_enabled('Achievement'):
self.achievements = config.ACHIEVEMENTS
self.achiev... |
third_party/catapult/tracing/tracing_build/render_histograms_viewer.py | zipated/src | 2,151 | 11006993 | # Copyright 2016 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import cgi
import json
import logging
import re
# If you change this, please update "Fall-back to old formats."
_JSON_TAG = '<histogram-json>%s</histogram-j... |
pythonFiles/tests/unittestadapter/.data/discovery_error/file_two.py | Kelvin-Gamer/vscode-python | 1,476 | 11007021 | # Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
import unittest
class DiscoveryErrorTwo(unittest.TestCase):
"""Test class for the test_error_discovery test.
The discover_tests function should return a dictionary with an "error" status, the discovered tests, and ... |
retriever/lib/excel.py | Nageshbansal/retriever | 254 | 11007031 | """Data Retriever Excel Functions
This module contains optional functions for importing data from Excel.
"""
class Excel:
"""Excel class to handle excel values"""
@staticmethod
def empty_cell(cell):
"""Test if excel cell is empty or contains only whitespace."""
if cell.ctype == 0:
... |
tools/pot/openvino/tools/pot/graph/special_patterns.py | ryanloney/openvino-1 | 1,127 | 11007060 | <gh_stars>1000+
# Copyright (C) 2020-2022 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
from .pattern_builder import PatternBuilder
from .special_operations import OPERATIONS_WITH_WEIGHTS
IGNORED_PATTERNS = {}
def get_ignored_patterns():
return IGNORED_PATTERNS
def registry_ignore_patterns(key):
... |
pandas/tests/indexes/test_indexing.py | CJL89/pandas | 603 | 11007061 | <filename>pandas/tests/indexes/test_indexing.py<gh_stars>100-1000
"""
test_indexing tests the following Index methods:
__getitem__
get_loc
get_value
__contains__
take
where
get_indexer
slice_locs
asof_locs
The corresponding tests.indexes.[index_type].test_indexing files
contain test... |
example-glaciers.py | thomascjohnson/cdsapi | 104 | 11007076 | <reponame>thomascjohnson/cdsapi<filename>example-glaciers.py
#!/usr/bin/env python
# (C) Copyright 2018 ECMWF.
#
# This software is licensed under the terms of the Apache Licence Version 2.0
# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
# In applying this licence, ECMWF does not waive the priv... |
scenes/surfaceTurbulence.py | spockthegray/mantaflow | 158 | 11007077 | #
# Example scene with surface wave turbulence
# (corresponding paper: Surface Turbulence for Particle-Based Liquid Simulations, Mercier et al., SIGGRAPH Asia 2015)
#
from manta import *
# solver params
dim = 3
res = 32
gs = vec3(res,res,res)
if (dim==2):
gs.z=1
s = Solver(name='main', gridSize = gs, dim=dim)
s.tim... |
se3cnn/point/radial.py | mariogeiger/se3cnn | 170 | 11007084 | # pylint: disable=arguments-differ, no-member, missing-docstring, invalid-name, line-too-long
import math
from functools import partial
import torch
class ConstantRadialModel(torch.nn.Module):
def __init__(self, d):
super().__init__()
self.weight = torch.nn.Parameter(torch.randn(d))
def forw... |
Chapter12/torch_perf/t1.py | haohaoxiao/Deep-Reinforcement-Learning-Hands-On-Second-Edition | 621 | 11007093 | # reproduce of PyTorch performance regression with tensors concatenation
import torch
import time
import numpy as np
ITERS = 100
BATCH = 128
SHAPE = (4, 84, 84)
def test_1(device):
ts = time.time()
for _ in range(ITERS):
batch = []
for _ in range(BATCH):
batch.append(np.zeros(SHAP... |
dbtmetabase/parsers/dbt_manifest.py | mmmatthew/dbt-metabase | 154 | 11007097 | <filename>dbtmetabase/parsers/dbt_manifest.py<gh_stars>100-1000
import json
import os
from typing import List, Tuple, Mapping, Optional, MutableMapping
from ..models.config import DbtConfig
from ..models.metabase import METABASE_META_FIELDS, ModelType
from ..models.metabase import MetabaseModel, MetabaseColumn
from ..... |
modules/rpr.py | anoidgit/zero | 111 | 11007146 | <reponame>anoidgit/zero
# coding: utf-8
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import tensorflow as tf
def relative_attention_inner(x, y, z=None, transpose=False):
"""Relative position-aware dot-product attention inner calculation.
This b... |
批量生成手机号码/utils/addr_utils.py | liusongtao99/tools_python | 130 | 11007167 | <filename>批量生成手机号码/utils/addr_utils.py
#!/usr/bin/env python
# encoding: utf-8
"""
@version: v1.0
@author: xag
@license: Apache Licence
@contact: <EMAIL>
@site: http://www.xingag.top
@software: PyCharm
@file: addr_utils.py
@time: 2020-01-06 22:24
@description:TODO
"""
import json
import re
import reque... |
tests/test_stack.py | ju-sh/herbstluftwm | 925 | 11007172 | import re
import pytest
def strip_winids(string):
"""
Replaces all substrings that look like window IDs with a fixed string.
"""
return re.sub(r'0x([0-9a-f]+)', '<windowid>', string)
def helper_get_stack_as_list(hlwm, clients_only=True, strip_focus_layer=False):
stack_stdout = hlwm.call('stack')... |
programs/buck_repo.py | Unknoob/buck | 8,027 | 11007182 | <reponame>Unknoob/buck<gh_stars>1000+
# Copyright (c) Facebook, Inc. and its affiliates.
#
# 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
#
#... |
api/src/opentrons/protocols/__init__.py | faliester/opentrons | 235 | 11007197 | """ opentrons.protocols: functions and state for handling, executing, and
simulating protocols.
This genericizes over v1 and v2 protocols and allows for version inference
and version-independent apis for simulating and executing protocols.
"""
|
caffe2/python/operator_test/gather_ranges_op_test.py | VisualJoyce/caffe2 | 585 | 11007223 | # Copyright (c) 2016-present, Facebook, 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 agreed... |
office-plugin/windows-office/program/wizards/common/NumberFormatter.py | jerrykcode/kkFileView | 6,660 | 11007235 | <reponame>jerrykcode/kkFileView
#
# This file is part of the LibreOffice project.
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#
# This file incorporates work cover... |
tests/multi_net/tcp_accept_recv.py | iotctl/pycopy | 663 | 11007250 | <filename>tests/multi_net/tcp_accept_recv.py
# Test recv on socket that just accepted a connection
try:
import usocket as socket
except ImportError:
import socket
PORT = 8000
# Server
def instance0():
multitest.globals(IP=multitest.get_network_ip())
s = socket.socket()
s.setsockopt(socket.SOL_SO... |
rdflib_sqlalchemy/tables.py | gjhiggins/rdflib-sqlalchemy | 112 | 11007259 | from sqlalchemy import Column, Table, Index, types
from rdflib_sqlalchemy.types import TermType
MYSQL_MAX_INDEX_LENGTH = 200
TABLE_NAME_TEMPLATES = [
"{interned_id}_asserted_statements",
"{interned_id}_literal_statements",
"{interned_id}_namespace_binds",
"{interned_id}_quoted_statements",
"{int... |
alex/components/nlg/tectotpl/core/document.py | oplatek/alex | 184 | 11007265 | #!/usr/bin/env python
# coding=utf-8
#
# Classes related to Treex documents, bundles and zones
#
from __future__ import unicode_literals
from alex.components.nlg.tectotpl.core.exception import RuntimeException
import alex.components.nlg.tectotpl.core.node
__author__ = "<NAME>"
__date__ = "2012"
class Document(objec... |
fmpy/examples/coupled_clutches.py | CSchulzeTLK/FMPy | 225 | 11007307 | from __future__ import print_function
from fmpy import simulate_fmu
from fmpy.util import download_test_file
import numpy as np
def simulate_coupled_clutches(fmi_version='2.0',
fmi_type='ModelExchange',
output=['outputs[1]', 'outputs[2]', 'outputs[3]... |
synthtiger/components/__init__.py | KoryakovDmitry/synthtiger | 153 | 11007313 | """
SynthTIGER
Copyright (c) 2021-present NAVER Corp.
MIT license
"""
from synthtiger.components.color import *
from synthtiger.components.component import Component
from synthtiger.components.corpus import *
from synthtiger.components.font import *
from synthtiger.components.image_effect import *
from synthtiger.comp... |
contrib/pyln-spec/bolt1/pyln/spec/bolt1/gen_csv_version.py | Bladez1753/lightning | 2,288 | 11007362 | <filename>contrib/pyln-spec/bolt1/pyln/spec/bolt1/gen_csv_version.py<gh_stars>1000+
__csv_version__ = "1"
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.