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 |
|---|---|---|---|---|
atcodertools/fmtprediction/models/index.py | come2ry/atcoder-tools | 313 | 102260 | from atcodertools.fmtprediction.models.calculator import CalcNode
class Index:
"""
The model to store index information of a variable, which has a likely the minimal / maximal value and for each dimension.
Up to 2 indices are now supported.
In most cases, the minimal value is 1 and the m... |
saicinpainting/training/modules/fake_fakes.py | BishmoyPaul/lama | 2,133 | 102310 | <reponame>BishmoyPaul/lama<gh_stars>1000+
import torch
from kornia import SamplePadding
from kornia.augmentation import RandomAffine, CenterCrop
class FakeFakesGenerator:
def __init__(self, aug_proba=0.5, img_aug_degree=30, img_aug_translate=0.2):
self.grad_aug = RandomAffine(degrees=360,
... |
reference/NumpyDL-master/tests/test_activaton.py | code4bw/deep-np | 186 | 102338 | <gh_stars>100-1000
# -*- coding: utf-8 -*-
import numpy as np
import pytest
from npdl import activations
def test_activation():
from npdl.activations import Activation
act = Activation()
with pytest.raises(NotImplementedError):
act.forward((10, 10))
with pytest.raises(NotImplementedError)... |
tests/functional/features/steps/registers.py | dia38/pylink | 217 | 102350 | # Copyright 2017 Square, 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 to in writing,... |
Chapter4/ch4_naive_momentum_strategy2.py | buiksat/Learn-Algorithmic-Trading | 449 | 102369 | <filename>Chapter4/ch4_naive_momentum_strategy2.py
#!/bin/python3
import pandas as pd
import numpy as np
from pandas_datareader import data
import matplotlib.pyplot as plt
def load_financial_data(start_date, end_date,output_file):
try:
df = pd.read_pickle(output_file)
print('File data found...readi... |
web.py | Dreamsorcerer/bthidhub | 166 | 102377 | <reponame>Dreamsorcerer/bthidhub
# Copyright (c) 2020 ruundii. All rights reserved.
from aiohttp import web,WSMessage
from password import *
import json
from hid_devices import *
from bluetooth_devices import *
import asyncio
import concurrent.futures
import sys
import subprocess
from aiohttp_session import SimpleCoo... |
src/main/python/train_esitmator_distributed.py | moony320/shifu | 200 | 102403 | <filename>src/main/python/train_esitmator_distributed.py
# -*- coding: utf-8 -*-
# Copyright [2012-2018] PayPal Software Foundation
#
# 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
#
# htt... |
src/curt/curt/modules/smarthome/base_provider.py | sanyaade-teachings/cep | 108 | 102426 | """
Copyright (C) Cortic Technology Corp. - All Rights Reserved
Written by <NAME> <<EMAIL>>, 2021
"""
from abc import abstractmethod
class BaseProvider:
def __init__(self):
self.token = ""
@abstractmethod
def config_control_handler(self, params):
pass
def command(self, params):
... |
gcompiler/python/delta_infer/subgraphs/__init__.py | didichuxing/delta | 1,442 | 102466 | from .transformer import *
from .common import *
#tf.compat.v1.disable_eager_execution()
#
#batch_size = 40
#seq_length = 200
#hidden_size = 768
#num_attention_heads =12
#size_per_head = int(hidden_size / num_attention_heads)
#
#layer_input = tf.compat.v1.placeholder(tf.float32, shape=(batch_size*seq_length, hidden_si... |
calvinextras/calvinsys/io/gpiopin/raspberry_pi/PIGPIOPin.py | gabrielcercel/calvin-base | 334 | 102467 | <reponame>gabrielcercel/calvin-base<filename>calvinextras/calvinsys/io/gpiopin/raspberry_pi/PIGPIOPin.py
# -*- coding: utf-8 -*-
# Copyright (c) 2015 Ericsson AB
#
# 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 cop... |
dm_control/manipulation/shared/observations.py | h8907283/dm_control | 2,863 | 102483 | # Copyright 2018 The dm_control Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to i... |
pypy/module/pypyjit/test/test_pyframe.py | nanjekyejoannah/pypy | 381 | 102547 | import py
class TestJitTraceInteraction(object):
def test_trace_while_blackholing(self):
import sys
l = []
printed = []
def trace(frame, event, arg):
l.append((frame.f_code.co_name, event))
return trace
def g(i, x):
if i > x - 10:
... |
PyObjCTest/test_nslock.py | Khan/pyobjc-framework-Cocoa | 132 | 102633 | <reponame>Khan/pyobjc-framework-Cocoa
from Foundation import *
import objc
from PyObjCTools.TestSupport import *
class TestNSLockProtocols (TestCase):
def testLockIsLock(self):
# Test for bug #1735937
lock = NSLock.alloc().init()
self.assert_(lock.conformsToProtocol_(objc.protocolNamed("... |
compiler_opt/rl/random_net_distillation_test.py | google/ml-compiler-opt | 130 | 102657 | # 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 agreed ... |
nativedroid/nativedroid/analyses/resolver/jni/java_type/primitive.py | CherishAZ/Argus-SAF | 152 | 102666 | <filename>nativedroid/nativedroid/analyses/resolver/jni/java_type/primitive.py<gh_stars>100-1000
from nativedroid.analyses.resolver.jni.jtype import JType
__author__ = "<NAME>, <NAME>"
__copyright__ = "Copyright 2018, The Argus-SAF Project"
__license__ = "Apache v2.0"
class JBoolean(JType):
def __init__(self, pr... |
release/stubs.min/System/Runtime/InteropServices/__init___parts/FieldOffsetAttribute.py | htlcnn/ironpython-stubs | 182 | 102668 | <filename>release/stubs.min/System/Runtime/InteropServices/__init___parts/FieldOffsetAttribute.py<gh_stars>100-1000
class FieldOffsetAttribute(Attribute,_Attribute):
"""
Indicates the physical position of fields within the unmanaged representation of a class or structure.
FieldOffsetAttribute(offset: int)
... |
desktop/core/ext-py/pytidylib-0.3.2/tests/test_docs.py | kokosing/hue | 5,079 | 102682 | # -*- coding: utf-8 -*-
# Copyright 2009-2014 <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, including without limitation the rights
# to use, copy, modify, mer... |
qiskit_optimization/converters/flip_problem_sense.py | X-Libor/qiskit-optimization | 109 | 102723 | # This code is part of Qiskit.
#
# (C) Copyright IBM 2021.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
#
# Any modifications or derivative wo... |
htkupdate.py | otherbeast/hackers-tool-kit | 393 | 102730 | import os
print "UPDATING..."
os.system("cd")
os.system('cd /root/ && rm -fr hackers-tool-kit && git clone https://github.com/unkn0wnh4ckr/hackers-tool-kit && echo "[UPDATED]: Restart Your Terminal"') |
patreonmanager/apps.py | crydotsnake/djangogirls | 446 | 102731 | from django.apps import AppConfig
from django.utils.translation import gettext_lazy as _
class PatreonManagerConfig(AppConfig):
name = 'patreonmanager'
verbose_name = _("Patreon Manager")
|
cupcake2/ice2/create_seed.py | ArthurDondi/cDNA_Cupcake | 205 | 102794 | __author__ = 'lachesis'
import os, sys
from Bio import SeqIO
from cupcake.io.SeqReaders import LazyFastaReader
from cupcake2.io.FileIO import write_seqids_to_fasta
input = 'isoseq_flnc.fasta'
NUM_SEQS_PER_BATCH = 50000
d = LazyFastaReader(input)
lens = [(r.id, len(r.seq)) for r in SeqIO.parse(open(input), 'fasta')... |
buildscripts/__init__.py | EshaMaharishi/pubsub-1 | 324 | 102848 |
import os;
def findHacks( un ):
return None
|
tests/custom_cluster/test_compact_catalog_updates.py | Keendata/impala | 746 | 102864 | <filename>tests/custom_cluster/test_compact_catalog_updates.py
# 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 t... |
AutoDL Design/autodl.py | houj04/AutoDL | 155 | 102880 | <gh_stars>100-1000
#!/usr/bin/env python
# -*- coding:utf-8 -*-
# Copyright (c) 2019 PaddlePaddle Authors. All Rights Reserve.
#
# 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://ww... |
paddleslim/nas/one_shot/one_shot_nas.py | zhuguiqian/PaddleSlim | 923 | 102886 | # Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applic... |
ch06/atomic-cloud/ec2atomic.py | nhonaitran/docbook | 244 | 102890 | #!/usr/bin/env python
import os
from libcloud.compute.types import Provider
from libcloud.compute.providers import get_driver
ACCESS_ID = os.getenv('AWSAccessKeyId')
SECRET_KEY = os.getenv('AWSSecretKey')
IMAGE_ID = 'ami-05513b72'
SIZE_ID = 't2.micro'
cls = get_driver(Provider.EC2_EU_WEST)
driver = cls(ACCESS_ID, S... |
backend/src/baserow/contrib/database/formula/parser/exceptions.py | lucastm/baserow | 839 | 102902 | from baserow.contrib.database.formula.exceptions import BaserowFormulaException
class InvalidNumberOfArguments(BaserowFormulaException):
def __init__(self, function_def, num_args):
if num_args == 1:
error_prefix = "1 argument was"
else:
error_prefix = f"{num_args} arguments... |
tests/triggers_timer_based_trigger_control/test.py | JoshTDN03/knix | 167 | 102913 | # Copyright 2020 The KNIX Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agree... |
src/modules/excel_dde.py | mehrdad-shokri/macro_pack | 1,550 | 102915 | <filename>src/modules/excel_dde.py
#!/usr/bin/env python
# encoding: utf-8
# Only enabled on windows
import sys
from collections import OrderedDict
if sys.platform == "win32":
# Download and install pywin32 from https://sourceforge.net/projects/pywin32/files/pywin32/
import win32com.client # @UnresolvedImport
... |
functests/test_events.py | webfolderio/akumuli | 1,094 | 102917 | <gh_stars>1000+
from __future__ import print_function
import os
import sys
import socket
import datetime
import time
import akumulid_test_tools as att
from akumulid_test_tools import retry, api_test, on_exit
import json
try:
from urllib2 import urlopen, HTTPError, URLError
except ImportError:
from urllib import... |
nsot/api/routers.py | comerford/nsot | 387 | 102930 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from __future__ import absolute_import
from rest_framework_bulk.routes import BulkRouter
from rest_framework_nested.routers import NestedSimpleRouter
__all__ = ('BulkRouter', 'BulkNestedRouter')
# Map of HTTP verbs to rest_framework_bulk operations.
B... |
Co-Simulation/PTV-Vissim/vissim_integration/bridge_helper.py | adelbennaceur/carla | 7,883 | 102943 | #!/usr/bin/env python
# Copyright (c) 2020 Computer Vision Center (CVC) at the Universitat Autonoma de
# Barcelona (UAB).
#
# This work is licensed under the terms of the MIT license.
# For a copy, see <https://opensource.org/licenses/MIT>.
""" This module provides a helper for the co-simulation between vissim and car... |
scripts/generate_example.py | joeranbosma/nnDetection | 242 | 102945 | """
Copyright 2020 Division of Medical Image Computing, German Cancer Research Center (DKFZ), Heidelberg, Germany
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/L... |
vectorhub/encoders/text/base.py | vector-ai/vectorhub | 385 | 102966 | <reponame>vector-ai/vectorhub<filename>vectorhub/encoders/text/base.py
"""
Base Text2Vec Model
"""
import warnings
from ...base import Base2Vec
from abc import ABC, abstractmethod
from typing import Union, List, Dict
class BaseText2Vec(Base2Vec, ABC):
def read(self, text: str):
"""An abstract method to... |
quant/platform/huobi.py | vincent87lee/alphahunter | 149 | 102986 | # -*- coding:utf-8 -*-
"""
huobi Trade module.
https://huobiapi.github.io/docs/spot/v1/cn
Project: alphahunter
Author: HJQuant
Description: Asynchronous driven quantitative trading framework
"""
import json
import hmac
import copy
import gzip
import base64
import urllib
import hashlib
import datetime
from urllib imp... |
src/transformers/models/bert/modeling_flax_bert.py | manuelciosici/transformers | 8,028 | 103049 | # coding=utf-8
# Copyright 2021 The Google Flax Team 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
... |
mmflow/models/utils/estimators_link.py | hologerry/mmflow | 481 | 103051 | # Copyright (c) OpenMMLab. All rights reserved.
import torch
import torch.nn as nn
from torch import Tensor
from mmflow.ops import build_operators
class LinkOutput:
"""The link output between two estimators in FlowNet2."""
def __init__(self) -> None:
self.upsample_flow = None
self.scaled_flo... |
python/dask_cudf/dask_cudf/tests/test_applymap.py | Ahsantw/cudf | 239 | 103056 | # Copyright (c) 2022, NVIDIA CORPORATION.
import pytest
from pandas import NA
from dask import dataframe as dd
from dask_cudf.tests.utils import _make_random_frame
@pytest.mark.parametrize(
"func",
[
lambda x: x + 1,
lambda x: x - 0.5,
lambda x: 2 if x is NA else 2 + (x + 1) / 4.1,
... |
docs/examples_src/raw_query_usage/parse_with_unset_default.py | dynalz/odmantic | 486 | 103066 | from bson import ObjectId
from odmantic import Model
class Player(Model):
name: str
level: int = 1
document = {"name": "Leeroy", "_id": ObjectId("5f8352a87a733b8b18b0cb27")}
user = Player.parse_doc(document)
print(repr(user))
#> Player(
#> id=ObjectId("5f8352a87a733b8b18b0cb27"),
#> name="Leeroy",... |
core/tests/unittests/test_feature_selection.py | zhiqiangdon/autogluon | 4,462 | 103078 | from autogluon.core.utils.feature_selection import *
from autogluon.core.utils.utils import unevaluated_fi_df_template
import numpy as np
from numpy.core.fromnumeric import sort
import pandas as pd
import pytest
def evaluated_fi_df_template(features, importance=None, n=None):
rng = np.random.default_rng(0)
im... |
_compact.py | egemen61/excell | 253 | 103084 | <gh_stars>100-1000
try:
from django.http import JsonResponse
except ImportError:
from django.http import HttpResponse
import json
def JsonResponse(data):
return HttpResponse(json.dumps(data),
content_type="application/json")
|
custom_components/audiconnect/const.py | andersop91/audi_connect_ha | 103 | 103094 | DOMAIN = "audiconnect"
CONF_VIN = "vin"
CONF_CARNAME = "carname"
CONF_ACTION = "action"
MIN_UPDATE_INTERVAL = 5
DEFAULT_UPDATE_INTERVAL = 10
CONF_SPIN = "spin"
CONF_REGION = "region"
CONF_SERVICE_URL = "service_url"
CONF_MUTABLE = "mutable"
SIGNAL_STATE_UPDATED = "{}.updated".format(DOMAIN)
TRACKER_UPDATE = f"{DOMA... |
Packs/Campaign/Scripts/SendEmailToCampaignRecipients/SendEmailToCampaignRecipients_test.py | SergeBakharev/content | 799 | 103127 | <reponame>SergeBakharev/content<gh_stars>100-1000
import pytest
from SendEmailToCampaignRecipients import *
CAMPAIGN_EMAIL_TO = 'campaignemailto'
CAMPAIGN_EMAIL_SUBJECT = 'campaignemailsubject'
CAMPAIGN_EMAIL_BODY = 'campaignemailbody'
NUM_OF_INCIDENTS = 5
INCIDENT_IDS = [str(i) for i in range(NUM_OF_INCIDENTS)]
CUST... |
nni/common/version.py | Microsoft/nni | 2,305 | 103143 | # Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.
from __future__ import annotations
import logging
import sys
import warnings
import cloudpickle
import json_tricks
import numpy
import yaml
import nni
def _minor_version_tuple(version_str: str) -> tuple[int, int]:
# If not a number, retur... |
app/lib/models/webpush.py | didi9575/crackerjack | 237 | 103158 | <gh_stars>100-1000
from app import db
class WebPushSubscriptionModel(db.Model):
__tablename__ = 'webpush_subscriptions'
id = db.Column(db.Integer, primary_key=True)
user_id = db.Column(db.Integer, default=0, index=True, nullable=True)
endpoint = db.Column(db.String, default='', index=False, nullable=T... |
src/condor_tools/htcondor_cli/verb.py | datadvance/htcondor | 217 | 103169 | from abc import ABC, abstractmethod
class Verb(ABC):
"""
This docstring is used in the help message when doing
`htcondor noun verb --help`
"""
# The options class dict is a nested dict containing kwargs
# per option for the add_argument method of ArgumentParser,
# see COMMON_OPTIONS in __... |
dukpy/webassets/jsxfilter.py | Dhandarah/dukpy | 363 | 103230 | # -*- coding: utf-8 -*-
from __future__ import absolute_import, print_function
import os
from webassets.filter import Filter
import dukpy
__all__ = ('BabelJSX', )
class BabelJSX(Filter):
name = 'babeljsx'
max_debug_level = None
options = {
'loader': 'BABEL_MODULES_LOADER'
}
def input... |
code/gen_item_blend_sim.py | aister2020/KDDCUP_2020_Debiasing_1st_Place | 159 | 103235 | <gh_stars>100-1000
# -*- coding: utf-8 -*-
import numpy as np
from constants import *
import utils
import gc
item_feat = utils.load_pickle(item_feat_pkl)
feat_item_set = set(item_feat.keys())
item_vec1= np.zeros((120000,128),dtype='float32')
item_vec2= np.zeros((120000,128),dtype='float32')
for k,v in item_feat.ite... |
components/stdproc/stdproc/resamp_slc/Resamp_slc.py | vincentschut/isce2 | 1,133 | 103313 | <gh_stars>1000+
#!/usr/bin/env python3
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Copyright 2010 California Institute of Technology. ALL RIGHTS RESERVED.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with t... |
universal_computation/datasets/listops.py | jasonjewik/universal-computation | 183 | 103343 | <filename>universal_computation/datasets/listops.py
import tensorflow_datasets
import torch
from universal_computation.datasets.dataset import Dataset
from universal_computation.datasets.helpers.listops import get_datasets
class ListopsDataset(Dataset):
def __init__(self, batch_size, *args, **kwargs):
s... |
simulation/decai/simulation/data/featuremapping/tests/test_feature_index_mapper.py | boost-entropy-python/0xDeCA10B | 445 | 103385 | import unittest
import numpy as np
import scipy.sparse
from injector import Injector
from decai.simulation.data.featuremapping.feature_index_mapper import FeatureIndexMapper
from decai.simulation.logging_module import LoggingModule
class TestFeatureIndexMapper(unittest.TestCase):
@classmethod
def setUpClass... |
pyNastran/dev/bdf_vectorized/test/all_tests.py | ACea15/pyNastran | 293 | 103387 | from pyNastran.dev.bdf_vectorized.test.test_coords import *
from pyNastran.dev.bdf_vectorized.test.test_mass import *
from pyNastran.dev.bdf_vectorized.cards.elements.solid.test_solids import *
from pyNastran.dev.bdf_vectorized.cards.elements.shell.test_shell import *
from pyNastran.dev.bdf_vectorized.cards.elements.r... |
tests/bytecode/mp-tests/fun2.py | LabAixBidouille/micropython | 303 | 103404 | def f(*, b):
return b
def f(a, *, b):
return a + b
def f(a, *, b, c):
return a + b + c
def f(a, *, b=c):
return a + b
def f(a, *, b=c, c):
return a + b + c
def f(a, *, b=c, c=d):
return a + b + c
def f(a, *, b=c, c, d=e):
return a + b + c + d
def f(a=None, *, b=None):
return a + b... |
Chapter06/alice_chargen_rnn.py | Diponly/Deep-Learning-with-Keras | 1,119 | 103412 | # -*- coding: utf-8 -*-
# Adapted from lstm_text_generation.py in keras/examples
from __future__ import print_function
from keras.layers.recurrent import SimpleRNN
from keras.models import Sequential
from keras.layers import Dense, Activation
import numpy as np
INPUT_FILE = "../data/alice_in_wonderland.txt"
# extract... |
setup.py | adafruit/adafruit-beaglebone-io-python | 305 | 103450 | <gh_stars>100-1000
try:
from overlays import builder
builder.compile()
builder.copy()
except:
pass
import distribute_setup
import io
import sys
import platform
distribute_setup.use_setuptools()
from setuptools import setup, Extension, find_packages
open_as_utf8 = lambda x: io.open(x, encoding='utf-8')... |
thirdparty/his_evaluators/his_evaluators/metrics/yolov3/human_detector.py | eyaler/impersonator | 1,717 | 103467 | import torch
import torch.nn as nn
import os
from .models import Darknet
from .utils.utils import non_max_suppression, rescale_boxes
class YoLov3HumanDetector(nn.Module):
def __init__(self, weights_path="weights/yolov3.weights",
conf_thres=0.8, nms_thres=0.4, img_size=416, device=torch.device("c... |
python/django/python-hello-world/src/helloapp/views.py | davidponder/cloud-code-samples | 319 | 103514 | <gh_stars>100-1000
from django.shortcuts import render
import os
def homePageView(request):
return render(request, 'homepage.html', context={
"message": "It's running!"
}) |
dash_docs/chapters/dash_vtk/click_hover/index.py | wesleyacheng/dash-docs | 379 | 103544 | import dash_html_components as html
import dash_vtk
from dash_docs import tools
from dash_docs import styles
from dash_docs import reusable_components as rc
examples = tools.load_examples(__file__)
layout = html.Div([
rc.Markdown('''
# Click and Hover Callbacks
It's possible to create callbacks based on ... |
nikola/packages/tzlocal/__init__.py | asmeurer/nikola | 1,901 | 103547 | <filename>nikola/packages/tzlocal/__init__.py<gh_stars>1000+
"""Try to figure out what your local timezone is."""
import sys
__version__ = "2.0.0-nikola"
if sys.platform == "win32":
from .win32 import get_localzone, reload_localzone # NOQA
else:
from .unix import get_localzone, reload_localzone # NOQA
|
parsifal/apps/activities/models.py | ShivamPytho/parsifal | 342 | 103560 | <filename>parsifal/apps/activities/models.py
from django.contrib.auth.models import User
from django.db import models
from django.utils.translation import gettext_lazy as _
from parsifal.apps.activities.constants import ActivityTypes
from parsifal.apps.reviews.models import Review
class Activity(models.Model):
f... |
matchzoo/datasets/wiki_qa/__init__.py | ChrisRBXiong/MatchZoo-py | 2,209 | 103580 | <gh_stars>1000+
from .load_data import load_data
|
pmca/usb/driver/__init__.py | kubawolanin/Sony-PMCA-RE | 1,313 | 103605 | <reponame>kubawolanin/Sony-PMCA-RE<gh_stars>1000+
import abc
from collections import namedtuple
from ...util import *
USB_CLASS_PTP = 6
USB_CLASS_MSC = 8
USB_CLASS_VENDOR_SPECIFIC = 255
UsbDeviceHandle = namedtuple('UsbDeviceHandle', 'handle, idVendor, idProduct')
MSC_SENSE_OK = (0, 0, 0)
MSC_SENSE_ERROR_UNKNOWN = ... |
monitoring/parse-html.py | 2xsys/debian-server-tools | 418 | 103627 | #!/usr/bin/env python3
#
# Display download URL of a Firefox addon for Windows.
#
# Usage: ./parse-html.py adblock-plus
import sys
import urllib.request
from bs4 import BeautifulSoup
firefox_addon = 'https://addons.mozilla.org'
en_us_addons = firefox_addon + '/en-US/firefox/addon/'
page = urllib.request.urlopen(en_u... |
web/public/python/static/defaultPython.py | zonglu666/teaching-open | 119 | 103632 | <reponame>zonglu666/teaching-open
import turtle
t = turtle.Turtle()
t.forward(100)
print ("Teaching Python Editor") |
utils/xyz2obj.py | hengkaiz/Pixel2MeshPlusPlus | 260 | 103640 | # Copyright (C) 2019 <NAME>, <NAME>, <NAME>, <NAME>
# All rights reserved.
# This code is licensed under BSD 3-Clause License.
import sys
import os
import numpy as np
if __name__ == '__main__':
xyz_list_path = sys.argv[1]
xyzs = [xyz for xyz in os.listdir(xyz_list_path) if xyz.endswith('_predict_3.xyz')]
... |
dojo/engagement/urls.py | axelpavageau/django-DefectDojo | 1,772 | 103645 | from django.conf.urls import url
from dojo.engagement import views
urlpatterns = [
# engagements and calendar
url(r'^calendar$', views.engagement_calendar, name='calendar'),
url(r'^calendar/engagements$', views.engagement_calendar, name='engagement_calendar'),
url(r'^engagement$', views.engagement, n... |
runners/builder.py | zhangzhengde0225/SwinTrack | 143 | 103672 | from core.run.event_dispatcher.register import EventRegister
def build_runner(model, runner_config, data_source_context, config, event_register: EventRegister):
if runner_config['type'] == 'default':
from .training.default.builder import build_default_training_runner
return build_default_training_... |
tests/patterns/test_UnaryOpPattern.py | josiah-wolf-oberholtzer/supriya | 191 | 103688 | <filename>tests/patterns/test_UnaryOpPattern.py
import pytest
from supriya.patterns import SequencePattern, UnaryOpPattern
from supriya.patterns.testutils import run_pattern_test
@pytest.mark.parametrize(
"stop_at, operator, input_, expected, is_infinite",
[
(None, "-", 1, [-1], True),
(None,... |
monitoring/grafana/setup.py | tsehori/grr | 4,238 | 103698 | import setuptools
setup_args = dict(
name="grr-grafanalib-dashboards",
description="GRR grafanalib Monitoring Dashboards",
license="Apache License, Version 2.0",
url="https://github.com/google/grr/tree/master/monitoring/grafana",
maintainer="GRR Development Team",
maintainer_email="<EMAIL>",
packages=set... |
drl_grasping/envs/models/primitives/__init__.py | Tiamat-Tech/drl_grasping | 126 | 103702 | from .box import Box
from .cylinder import Cylinder
from .sphere import Sphere
from .random_primitive import RandomPrimitive
from .plane import Plane |
aiomisc/iterator_wrapper.py | Alviner/aiomisc | 232 | 103723 | <reponame>Alviner/aiomisc
import asyncio
import inspect
import threading
from collections import deque
from concurrent.futures import Executor
from types import TracebackType
from typing import (
Any, AsyncIterator, Awaitable, Callable, Deque, Generator, NoReturn,
Optional, Type, TypeVar,
)
from weakref import ... |
tests/grammars/CustomSubclassGenerator.py | 38b394ce01/grammarinator | 228 | 103737 | # Copyright (c) 2017-2020 <NAME>, <NAME>.
#
# Licensed under the BSD 3-Clause License
# <LICENSE.rst or https://opensource.org/licenses/BSD-3-Clause>.
# This file may not be copied, modified, or distributed except
# according to those terms.
# This custom unparser is used by Custom.g4
from grammarinator.runtime impor... |
paperbroker/adapters/quotes/QuoteAdapter.py | yutiansut/paperbroker | 227 | 103774 | <reponame>yutiansut/paperbroker
import arrow
class QuoteAdapter:
def get_quote(self, asset):
raise NotImplementedError("QuoteAdapter.get_quote: You should subclass this and create an adapter.")
def get_options(self, underlying_asset=None, expiration_date=None):
raise NotImplementedError("Quot... |
tests/active_learning/test_ScorerClassification.py | CodeGuy-007/lightly | 1,515 | 103800 | <reponame>CodeGuy-007/lightly<gh_stars>1000+
import unittest
import numpy as np
from lightly.active_learning.scorers.classification import ScorerClassification, _entropy
class TestScorerClassification(unittest.TestCase):
def test_score_calculation_random(self):
n_samples = 10000
n_classes = 10
... |
tests/components/kraken/conftest.py | MrDelik/core | 30,023 | 103823 | """Provide common pytest fixtures for kraken tests."""
from unittest.mock import patch
import pytest
@pytest.fixture(autouse=True)
def mock_call_rate_limit_sleep():
"""Patch the call rate limit sleep time."""
with patch("homeassistant.components.kraken.CALL_RATE_LIMIT_SLEEP", new=0):
yield
|
Validation/EventGenerator/python/BPhysicsValidation_cfi.py | ckamtsikis/cmssw | 852 | 103836 | <reponame>ckamtsikis/cmssw<gh_stars>100-1000
import FWCore.ParameterSet.Config as cms
from DQMServices.Core.DQMEDAnalyzer import DQMEDAnalyzer
JPsiMuMuValidation = DQMEDAnalyzer('BPhysicsValidation',
genparticleCollection = cms.InputTag("genParticles",""),
... |
pymoo/experimental/deriv/gd.py | jarreguit/pymoo | 762 | 103860 | import numpy as np
from pymoo.experimental.deriv import DerivationBasedAlgorithm
from pymoo.algorithms.base.line import LineSearchProblem
from pymoo.algorithms.soo.univariate.exp import ExponentialSearch
from pymoo.algorithms.soo.univariate.golden import GoldenSectionSearch
from pymoo.core.population import Population... |
tools/torch2onnx.py | YuxinZou/vedaseg | 438 | 103865 | import argparse
import os
import sys
sys.path.insert(0, os.path.join(os.path.dirname(__file__), '../'))
import torch
from volksdep.converters import torch2onnx
from vedaseg.runners import InferenceRunner
from vedaseg.utils import Config
def parse_args():
parser = argparse.ArgumentParser(description='Convert to... |
macarico/tasks/seq2json.py | hal3/macarico | 121 | 103896 | <filename>macarico/tasks/seq2json.py
from __future__ import division, generators, print_function
import sys
import random
import macarico
import zss
from macarico.data.vocabulary import EOS
def fold_json(f, x0, json):
if isinstance(json, int):
return f(x0, True, json)
if isinstance(json, list):
... |
tests/test_basic.py | mubashshirjamal/code | 1,582 | 103928 | import os
import shutil
from vilya.libs.permdir import get_repo_root
from vilya.models.project import CodeDoubanProject
from tests.base import TestCase
class TestBasic(TestCase):
def test_create_git_repo(self):
git_path = os.path.join(get_repo_root(), 'abc.git')
CodeDoubanProject.create_git_repo... |
imaginaire/utils/diff_aug.py | hw07216/imaginaire | 3,308 | 103958 | <reponame>hw07216/imaginaire
# Copyright (C) 2021 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
#
# This work is made available under the Nvidia Source Code License-NC.
# To view a copy of this license, check out LICENSE.md
# Differentiable Augmentation for Data-Efficient GAN Training
# <NAME>, <NAME>, <NAME>... |
scripts/typeset.py | TjWhale/set.mm | 153 | 104033 | <gh_stars>100-1000
#!/bin/python
# Process a file's `...` instructions using an mmfile's typographical commands
# Reads from stdin and sends to stdout. By default the mmfile is "set.mm".
# Use the "--help" option to see all the options.
# Sample usage:
# python scripts/typeset.py --html < demo.html.raw > demo.html
# ... |
nncf/torch/tensor_statistics/reduction.py | MaximProshin/nncf | 136 | 104037 | """
Copyright (c) 2022 Intel 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.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writin... |
tests/features/steps/all.py | jaimegildesagredo/finch | 118 | 104038 | <filename>tests/features/steps/all.py
# -*- coding: utf-8 -*-
from behave import when, then
from tornado import ioloop
@when(u'I get all the users')
def impl(context):
def on_users(users, error):
ioloop.IOLoop.instance().stop()
context.users = users
context.error = error
context.coll... |
codigo/Live148/app/database.py | cassiasamp/live-de-python | 572 | 104039 | <filename>codigo/Live148/app/database.py
import databases
import sqlalchemy
from starlette.config import Config
config = Config(".env")
TESTING = config("TESTING", cast=bool, default=False)
DATABASE_URL = config("DATABASE_URL", cast=databases.DatabaseURL)
TEST_DATABASE_URL = DATABASE_URL.replace(
database="test... |
configs/_base_/backends/tensorrt-fp16.py | zhiqwang/mmdeploy | 746 | 104064 | <filename>configs/_base_/backends/tensorrt-fp16.py
backend_config = dict(
type='tensorrt', common_config=dict(fp16_mode=True, max_workspace_size=0))
|
tenseal/tensors/abstract_tensor.py | rand0musername/TenSEAL | 410 | 104092 | <reponame>rand0musername/TenSEAL
"""Abstract tensor class that implements common tensor methods"""
from typing import List, Union
import tenseal as ts
from abc import ABC
class AbstractTensor(ABC):
@property
def data(self):
"""Get the wrapped low level tensor object"""
return self._data
@... |
lib/python/frugal/tornado/transport/transport.py | ariasheets-wk/frugal | 144 | 104196 | # Copyright 2017 Workiva
# 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
#... |
gdn-master/lib/psa/modules/__init__.py | ldrunning/segmentation | 1,137 | 104228 | <reponame>ldrunning/segmentation<filename>gdn-master/lib/psa/modules/__init__.py<gh_stars>1000+
from .psamask import *
|
tests/bench/arrayop-4-bytearray_map.py | learnforpractice/micropython-cpp | 692 | 104295 | # Array operation
# Type: list, map() call. This method requires allocation of
# the same amount of memory as original array (to hold result
# array). On the other hand, input array stays intact.
import bench
def test(num):
for i in iter(range(num//10000)):
arr = bytearray(b"\0" * 1000)
arr2 = byte... |
test/strings/prefixes2.py | kylebarron/MagicPython | 1,482 | 104307 | <gh_stars>1000+
a = U'S T R'
a = B'S T R'
a = R'S T R'
a = BR'S T R'
a = RB'S T R'
a : source.python
: source.python
= : keyword.operator.assignment.python, source.python
: source.python
U : source.python, storage.type.string.python, string.quoted.singl... |
eppy/tests/geometry_tests/test_area_zone.py | hnagda/eppy | 116 | 104366 | # Copyright (c) 2012 <NAME>
# =======================================================================
# Distributed under the MIT License.
# (See accompanying file LICENSE or copy at
# http://opensource.org/licenses/MIT)
# =======================================================================
""" pytest for area_z... |
CommonTools/RecoAlgos/python/LargestEtCaloJetSelector_cfi.py | ckamtsikis/cmssw | 852 | 104402 | <reponame>ckamtsikis/cmssw
import FWCore.ParameterSet.Config as cms
hltSelector4Jets = cms.EDFilter( "LargestEtCaloJetSelector",
src = cms.InputTag( "hltMCJetCorJetIcone5" ),
filter = cms.bool( False ),
maxNumber = cms.uint32( 4 )
)
|
run.py | 0xflotus/sandman2 | 1,899 | 104420 | <gh_stars>1000+
from sandman2 import get_app
app = get_app('sqlite+pysqlite:///tests/data/db.sqlite3')
def main():
app.run(debug=True)
if __name__ == '__main__':
main()
|
utils_cv/detection/mask.py | muminkoykiran/computervision-recipes | 7,899 | 104432 | # Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
import numpy as np
from PIL import Image
from pathlib import Path
from typing import Tuple, Union
def binarise_mask(mask: Union[np.ndarray, str, Path]) -> np.ndarray:
""" Split the mask into a set of binary masks.
... |
aries_cloudagent/protocols/issue_credential/v2_0/models/detail/tests/test_indy.py | kuraakhilesh8230/aries-cloudagent-python | 247 | 104449 | <reponame>kuraakhilesh8230/aries-cloudagent-python
from asynctest import TestCase as AsyncTestCase
from ..indy import V20CredExRecordIndy
class TestV20CredExRecordIndy(AsyncTestCase):
async def test_record(self):
same = [
V20CredExRecordIndy(
cred_ex_indy_id="dummy-0",
... |
alipay/aop/api/response/AlipayOverseasTravelRateCurrencyBatchqueryResponse.py | antopen/alipay-sdk-python-all | 213 | 104469 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.response.AlipayResponse import AlipayResponse
from alipay.aop.api.domain.RateCurrency import RateCurrency
class AlipayOverseasTravelRateCurrencyBatchqueryResponse(AlipayResponse):
def __init__(self):
super(AlipayOverseasTravel... |
tests/utils/harness.py | wx-b/cockpit | 367 | 104543 | <reponame>wx-b/cockpit<gh_stars>100-1000
"""Base class for executing and hooking into a training loop to execute checks."""
from backpack import extend
from cockpit import Cockpit
from tests.utils.rand import restore_rng_state
class SimpleTestHarness:
"""Class for running a simple test loop with the Cockpit.
... |
tests/test_complexdata_io.py | geotom/pywps | 117 | 104561 | """Test embedding different file formats and different encodings within the <Data> tag."""
import unittest
import os
from pywps import get_ElementMakerForVersion
from pywps.app.basic import get_xpath_ns
from pywps import Service, Process, ComplexInput, ComplexOutput, FORMATS
from pywps.tests import client_for, assert_... |
notebooks/utils.py | xuzhuang1996/hierarchical_loc | 143 | 104575 | import matplotlib.pyplot as plt
import cv2
import numpy as np
def plot_imgs(imgs, titles=None, cmap='brg', ylabel='', normalize=True, ax=None,
r=(0, 1), dpi=100):
n = len(imgs)
if not isinstance(cmap, list):
cmap = [cmap]*n
if ax is None:
_, ax = plt.subplots(1, n, figsize=(6... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.