max_stars_repo_path string | max_stars_repo_name string | max_stars_count int64 | id string | content string | add_param_types int64 | add_return_types int64 | add_class_field_types int64 | add_instance_field_types int64 | add_total int64 | add_error int64 |
|---|---|---|---|---|---|---|---|---|---|---|
pygam/tests/test_utils.py | VerdigrisTech/pyGAM | 714 | 1643942 | # -*- coding: utf-8 -*-
from copy import deepcopy
try:
# py >= 3.3
from unittest.mock import patch
except ImportError:
# py < 3.3
from mock import patch
import numpy as np
import pytest
from pygam import *
from pygam.utils import check_X, check_y, check_X_y, sig_code, check_iterable_depth
# TODO ch... | 0 | 2 | 0 | 0 | 2 | 0 |
mythic-docker/app/api/__init__.py | xorrior/Mythic | 934 | 1643958 | from app.api import callback_api, operator_api, task_api, response_api, crypto_api
from app.api import (
payloads_api,
analytics_api,
c2profiles_api,
file_api,
operation_api,
payloadtype_api,
)
from app.api import (
command_api,
reporting_api,
credential_api,
keylog_api,
mitr... | 0 | 0 | 0 | 0 | 0 | 0 |
fast_tffm.py | kopopt/fast_tffm | 157 | 1643975 | import ConfigParser, sys
from py.fm_ops import fm_ops
from py.fm_train import local_train, dist_train
from py.fm_predict import local_predict, dist_predict
import tensorflow as tf
cmd_instruction = '''Usage:
1. Local training.
python fast_tffm.py train <cfg_file>
2. Distributed training.
python fast_tffm.p... | 0 | 0 | 0 | 0 | 0 | 0 |
scripts/61_FAA_Aligner/16_PostProcess.py | plandes/amrlib | 103 | 1643981 | #!/usr/bin/python3
import setup_run_dir # this import tricks script to run from 2 levels up
import os
from amrlib.alignments.faa_aligner.postprocess import postprocess
from amrlib.alignments.faa_aligner.proc_data import ProcData
if __name__ == '__main__':
working_dir = 'amrlib/data/train_faa_aligner'
a... | 0 | 0 | 0 | 0 | 0 | 0 |
simple_rl/planning/__init__.py | david-abel/mdps | 230 | 1643988 | <reponame>david-abel/mdps
'''
Implementations of standard planning algorithms:
PlannerClass: Abstract class for a planner
ValueIterationClass: Value Iteration.
MCTSClass: Monte Carlo Tree Search.
'''
# Grab classes.
from simple_rl.planning.PlannerClass import Planner
from simple_rl.planning.ValueIterationClass imp... | 0 | 0 | 0 | 0 | 0 | 0 |
bin/prediction_inspection.py | aglne/Conjecture | 153 | 1643990 | <reponame>aglne/Conjecture<gh_stars>100-1000
import json
import sys
from optparse import OptionParser
from math import floor
colors = ["FF0000", "FF1000", "FF2000", "FF3000", "FF4000", "FF5000", "FF6000",
"FF7000", "FF8000", "FF9000", "FFA000", "FFB000", "FFC000", "FFD000",
"FFE000", "FFF000", "FFF... | 0 | 0 | 0 | 0 | 0 | 0 |
algorithms/reduced-string.py | gajubadge11/HackerRank-1 | 340 | 1643993 | #!/usr/bin/env python3
from __future__ import annotations
import sys
def super_reduced_string(s) -> object | str:
if len(s) == 1:
return s
ind = 1
while ind < len(s):
#print("s[{}] = {} s = {}".format(ind, s[ind], s))
if s[ind] == s[ind-1]:
if len(s) == 2:
... | 0 | 1 | 0 | 0 | 1 | 0 |
examples/synthetic/discrete_euc/in_code_demo_2.py | hase1128/dragonfly | 675 | 1643999 | <reponame>hase1128/dragonfly<filename>examples/synthetic/discrete_euc/in_code_demo_2.py<gh_stars>100-1000
"""
In code demo for discrete euclidean domains
"""
import numpy as np
from dragonfly import load_config, maximise_function
def hartmann6_3(x):
""" Hartmann function in 3D. """
pt = np.array([x[1][1]/11.0,... | 0 | 0 | 0 | 0 | 0 | 0 |
swampdragon/settings_provider.py | aswinkp/swampdragon | 366 | 1644025 | <reponame>aswinkp/swampdragon<filename>swampdragon/settings_provider.py<gh_stars>100-1000
from tornado.web import RequestHandler
from swampdragon.default_settings import SwampDragonSettings
from django.conf import settings as django_settings
from .same_origin import set_origin_cookie
def get_host():
host = django... | 0 | 0 | 0 | 0 | 0 | 0 |
Lib/test/test_compiler/testcorpus/04_aug_assign_attr_sub.py | diogommartins/cinder | 1,886 | 1644036 | a.b -= 2
a[0] += 1
a[0:2] += 1
| 0 | 0 | 0 | 0 | 0 | 0 |
index.py | JixunMoe/netease-cloud-music-api | 118 | 1644060 | <reponame>JixunMoe/netease-cloud-music-api
#!/bin/env python2.7
# -*- coding: utf-8 -*-
from flask import *
from Crypto.Cipher import AES
from Crypto.PublicKey import RSA
from Crypto.Hash import SHA256
from random import randint
import binascii, os, json
import yaml, requests
from redis_session import RedisSessionI... | 0 | 0 | 0 | 0 | 0 | 0 |
textattack/metrics/metric.py | xinzhel/TextAttack | 1,980 | 1644087 | <reponame>xinzhel/TextAttack
"""
Metric Class
========================
"""
from abc import ABC, abstractmethod
class Metric(ABC):
"""A metric for evaluating Adversarial Attack candidates."""
@abstractmethod
def __init__(self, **kwargs):
"""Creates pre-built :class:`~textattack.Metric` that corr... | 0 | 0 | 0 | 0 | 0 | 0 |
sknn/backend/__init__.py | hero9968/scikit-neuralnetwork | 1,375 | 1644098 | <gh_stars>1000+
# -*- coding: utf-8 -*-
from __future__ import (absolute_import, unicode_literals, print_function)
# Once a submodule has been imported, its name will be stored here.
name = None
# This placeholder multi-layer perceptron class is replaced on importing
# a submodule from this backend module, e.g. from... | 0 | 0 | 0 | 0 | 0 | 0 |
ivy_tests/test_ivy/test_docstrings.py | chie2727/ivy | 681 | 1644105 | <filename>ivy_tests/test_ivy/test_docstrings.py
# global
import warnings
# local
import ivy
import ivy_tests.test_ivy.helpers as helpers
def test_docstrings():
failures = list()
success = True
"""
Functions that are skipped due to precision problem include:
add, cross_entropy, std
... | 0 | 0 | 0 | 0 | 0 | 0 |
src/newt/db/tests/testadapter.py | bmjjr/db | 153 | 1644116 | <filename>src/newt/db/tests/testadapter.py
import contextlib
import persistent.mapping
import os
import pickle
import relstorage.tests
from relstorage.tests import hftestbase
from relstorage.tests import hptestbase
from relstorage.tests import reltestbase
import ZODB
from ZODB.tests.util import MininalTestLayer
from ZO... | 0 | 0 | 0 | 0 | 0 | 0 |
hammer/library/aws/ebs.py | kaiboma/hammer | 385 | 1644118 | from __future__ import annotations
import logging
from botocore.exceptions import ClientError
from library.aws.utility import convert_tags
class EBSOperations:
@staticmethod
def snapshot_make_private(ec2_client, snapshot_id):
"""
Remove public permissions on EBS snapshot
:param ec2_... | 4 | 8 | 0 | 2 | 14 | 0 |
gaiadet/datasets/builder.py | zengming16/GAIA-det | 149 | 1644140 | <gh_stars>100-1000
# standard lib
import copy
import platform
import random
from functools import partial
# 3rd party lib
import numpy as np
from torch.utils.data import DataLoader
# mm lib
from mmcv.parallel import collate
from mmcv.runner import get_dist_info
from mmcv.utils import Registry, build_from_cfg
from mmd... | 0 | 0 | 0 | 0 | 0 | 0 |
twowheel.py | rossning92/rpi-robot | 106 | 1644143 | <reponame>rossning92/rpi-robot<filename>twowheel.py
from device import Motor
from time import sleep
import math
class TwoWheelController:
"""The class represents the controller for a two-wheeled robot. The controller
class must implement set_axis function.
"""
def __init__(self):
super(TwoWhe... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/fixtures/git/github.com/demo/namespace-package-one/namespace_package/one/__init__.py | rschwarzkopf/poetry | 12,347 | 1644162 | <reponame>rschwarzkopf/poetry<gh_stars>1000+
name = "one"
| 0 | 0 | 0 | 0 | 0 | 0 |
agate/computations/rank.py | andriyor/agate | 663 | 1644198 | #!/usr/bin/env python
from __future__ import annotations
from decimal import Decimal
import six
if six.PY3:
from functools import cmp_to_key
from agate.computations.base import Computation
from agate.data_types import Number
class Rank(Computation):
"""
Calculate rank order of the values in a column.
... | 2 | 2 | 0 | 0 | 4 | 0 |
tests/test_locations.py | oscgonfer/pytzwhere | 115 | 1644236 | from tzwhere import tzwhere
import datetime
import unittest
class LocationTestCase(unittest.TestCase):
TEST_LOCATIONS: tuple[tuple[float, object, str, str], tuple[float, object, str, str], tuple[float, object, str, str], tuple[float, object, str, str], tuple[float, object, str, str], tuple[float, float, str, str... | 0 | 0 | 2 | 0 | 2 | 0 |
var/spack/repos/builtin/packages/r-beachmat/package.py | LiamBindle/spack | 2,360 | 1644254 | # Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class RBeachmat(RPackage):
"""Compiling Bioconductor to Handle Each Matrix Type
Provides... | 0 | 0 | 2 | 0 | 2 | 0 |
examples/python/bufr_check_table.py | dvuckovic/eccodes | 103 | 1644257 | <gh_stars>100-1000
# (C) Copyright 2005- 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 privileges and immunities granted to it by
# virtue of its status ... | 0 | 0 | 0 | 0 | 0 | 0 |
kapture_localization/colmap/colmap_command.py | jkabalar/kapture-localization | 118 | 1644280 | # Copyright 2020-present NAVER Corp. Under BSD 3-clause license
"""
Colmap command execution in sub processes
"""
import logging
import os
import os.path as path
import subprocess
from typing import List, Optional
import kapture
from kapture.utils.paths import safe_remove_file
from kapture.converter.colmap.database_... | 61 | 13 | 0 | 0 | 74 | 0 |
DeepHash/model/dvsq/dvsq.py | imhmhm/DeepHash | 506 | 1644298 | #################################################################################
# Deep Visual-Semantic Quantization for Efficient Image Retrieval #
# Authors: <NAME>, <NAME>, <NAME>, <NAME> #
# Contact: <EMAIL> #
####################... | 3 | 12 | 0 | 0 | 15 | 0 |
lts/test/tools/test_js2c.py | Dexus/node-compiler | 1,666 | 1644304 | import unittest
import sys, os
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__),
'..', '..', 'tools')))
from js2c import NormalizeFileName
class Js2ctest(unittest.TestCase):
def testNormalizeFileName(self):
self.assertEqual(NormalizeFileNam... | 0 | 0 | 0 | 0 | 0 | 0 |
k8s/images/codalab/apps/newsletter/admin.py | abdulari/codalab-competitions | 333 | 1644310 | <filename>k8s/images/codalab/apps/newsletter/admin.py
from django.contrib import admin
from .models import NewsletterSubscription
class NewsletterAdmin(admin.ModelAdmin):
list_display = ('email', 'date_added',)
admin.site.register(NewsletterSubscription, NewsletterAdmin)
| 0 | 0 | 0 | 0 | 0 | 0 |
Lib/objc/CoreLocation.py | snazari/Pyto | 701 | 1644355 | from __future__ import annotations
"""
Classes from the 'CoreLocation' framework.
"""
try:
from rubicon.objc import ObjCClass
except ValueError:
def ObjCClass(name) -> None:
return None
def _Class(name) -> object | None:
try:
return ObjCClass(name)
except NameError:
return No... | 0 | 2 | 0 | 0 | 2 | 0 |
CalibMuon/DTCalibration/python/dtDQMMerge_cfg.py | ckamtsikis/cmssw | 852 | 1644367 | import FWCore.ParameterSet.Config as cms
process = cms.Process('MERGEDQM')
process.load('Configuration.EventContent.EventContent_cff')
process.maxEvents = cms.untracked.PSet(
input = cms.untracked.int32(-1)
)
# Input source
process.source = cms.Source("PoolSource",
processingMode = cms.untracked.string('Run... | 0 | 0 | 0 | 0 | 0 | 0 |
base/site-packages/sorl/thumbnail/base.py | edisonlz/fastor | 285 | 1644378 | from __future__ import annotations
import os
from os.path import isfile, isdir, getmtime, dirname, splitext, getsize
from tempfile import mkstemp
from shutil import copyfile
try:
from PIL import Image, ImageFilter
except:
import Image, ImageFilter
from sorl.thumbnail import defaults
from sorl.thumbnail.processors i... | 4 | 12 | 1 | 1 | 18 | 0 |
patch_distutils.py | burner/pyd | 168 | 1644441 | <reponame>burner/pyd
# The distutils.ccompiler module doesn't allow the runtime addition of compiler
# classes that live outside the distutils package, and of course it doesn't
# recognize the D language and its associated compilers by default.
#
# This module hot-patches distutils.ccompiler to overcome those limitatio... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/ptvsd/server/test_step.py | int19h/ptvsd | 349 | 1644478 | # Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See LICENSE in the project root
# for license information.
from __future__ import absolute_import, division, print_function, unicode_literals
import pytest
from tests import debug
from tests.patterns import some
def test_... | 0 | 0 | 0 | 0 | 0 | 0 |
desktop/core/ext-py/docutils-0.14/test/functional/tests/standalone_rst_manpage.py | kokosing/hue | 5,079 | 1644489 | <filename>desktop/core/ext-py/docutils-0.14/test/functional/tests/standalone_rst_manpage.py
exec(open('functional/tests/_standalone_rst_defaults.py').read())
# Source and destination file names.
test_source = "standalone_rst_manpage.txt"
test_destination = "standalone_rst_manpage.man"
# Keyword parameters passed to p... | 0 | 0 | 0 | 0 | 0 | 0 |
src/mceditlib/blocktypes/json_resources.py | elcarrion06/mcedit2 | 673 | 1644545 | """
json_resources
"""
from __future__ import absolute_import, division, print_function
import json
import logging
import os
from os.path import join
import traceback
log = logging.getLogger(__name__)
_cachedJsons = {}
def openResource(filename) -> object:
path = join(os.path.dirname(__file__), filename)
... | 0 | 2 | 0 | 0 | 2 | 0 |
pymtl3/stdlib/proc/test/elf_test.py | kevinyuan/pymtl3 | 152 | 1644557 | <gh_stars>100-1000
#=========================================================================
# elf_test.py
#=========================================================================
import random
import struct
from .. import elf
from ..SparseMemoryImage import SparseMemoryImage
#------------------------------------... | 0 | 0 | 0 | 0 | 0 | 0 |
horovod/ray/driver_service.py | Infi-zc/horovod | 7,676 | 1644561 | from horovod.runner.driver.driver_service import (_run_probe,
HorovodRunDriverService)
def _actor_launch_task_servers(*, node_actors, num_hosts, driver_addresses,
settings):
for index, w in enumerate(node_actors):
def execut... | 0 | 1 | 0 | 0 | 1 | 0 |
src/tests/v010/update_save_test.py | isaacna/FireO | 231 | 1644584 | <reponame>isaacna/FireO
from fireo.fields import TextField, IDField
from fireo.models import Model
class User(Model):
name = TextField()
address = TextField()
def test_save_update():
u = User(name="test_save_update")
u.address = 'test_save_update_address'
u.save()
u2 = User.collection.get(u... | 0 | 0 | 0 | 0 | 0 | 0 |
ceph_deploy/hosts/clear/install.py | JayjeetAtGithub/ceph-deploy | 353 | 1644644 |
def install(distro, version_kind, version, adjust_repos, **kw):
"""
Install bundle that contains ceph on the clear host.
Since clear does not have alternate channels, we will just run the command
"""
logger = distro.conn.logger
packages = ['storage-cluster']
logger.info("Installing storag... | 0 | 0 | 0 | 0 | 0 | 0 |
aps/io/utils.py | ishine/aps | 117 | 1644671 | #!/usr/bin/env python
# Copyright 2019 <NAME>
# License: Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0)
import sys
import codecs
from typing import Tuple, Any
def io_wrapper(io_str: str, mode: str) -> Tuple[bool, Any]:
"""
Wrapper for IO stream
Args:
io_str: "-" or file name
mo... | 2 | 1 | 0 | 0 | 3 | 0 |
tests/core/data/raster_transformer/test_raster_transformer.py | theoway/raster-vision | 1,577 | 1644683 | import unittest
import os
import numpy as np
from rastervision.core.data import RasterStats, StatsTransformerConfig
from rastervision.pipeline import rv_config
class TestRasterTransformer(unittest.TestCase):
def test_stats_transformer(self):
raster_stats = RasterStats()
raster_stats.means = list... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/test_ultimate_oscillator.py | dibyajyotidash/https-github.com-kylejusticemagnuson-pyti | 635 | 1644684 | <gh_stars>100-1000
from __future__ import absolute_import
import unittest
import numpy as np
from tests.sample_data import SampleData
from pyti import ultimate_oscillator
class TestUltimateOscillator(unittest.TestCase):
def setUp(self):
"""Create data to use for testing."""
self.close_data = Samp... | 0 | 0 | 0 | 0 | 0 | 0 |
phi/vis/_widgets/__init__.py | marc-gav/PhiFlow | 556 | 1644724 | from ._widgets_gui import WidgetsGui
| 0 | 0 | 0 | 0 | 0 | 0 |
test/nsfc_test.py | AMinerOpen/prediction-api | 101 | 1644799 | import sys
import json
sys.path.append('../src')
from classifier import Classifier
clf = Classifier()
f = open('nsfc_test.json', 'r', encoding='utf-8')
s = f.read()
j = json.loads(s, encoding='utf-8')
data = j['nsfc']
for level in [1, 2, 3]:
cnt = 0
top1 = 0
top5 = 0
length = level * 2 + 1
for item... | 0 | 0 | 0 | 0 | 0 | 0 |
Plugins/Aspose_Words_Java_for_Jython/asposewords/quickstart/HelloWorld.py | freedomloveme/Aspose.Words-for-Java | 274 | 1644854 | from asposewords import Settings
from com.aspose.words import Document
from com.aspose.words import DocumentBuilder
class HelloWorld:
def __init__(self):
dataDir = Settings.dataDir + 'quickstart/'
doc = Document()
builder = DocumentBuilder(doc)
builder.writeln('He... | 0 | 0 | 0 | 0 | 0 | 0 |
{{cookiecutter.project_slug}}/app/core/config.py | nunenuh/cookiecutter-fastapi | 162 | 1644880 | import logging
import sys
from typing import List
from core.logging import InterceptHandler
from loguru import logger
from starlette.config import Config
from starlette.datastructures import CommaSeparatedStrings, Secret
config = Config(".env")
API_PREFIX = "/api"
VERSION = "{{cookiecutter.version}}"
DEBUG: bool = c... | 0 | 0 | 5 | 0 | 5 | 0 |
api/api/routers/skipper.py | muraligmenon/gkipper | 162 | 1644885 | from fastapi import APIRouter
router = APIRouter()
@router.get('/', tags=['skipper'])
def skipper() -> str:
return 'Skipper API is running'
| 0 | 1 | 0 | 0 | 1 | 0 |
pybrain/structure/networks/custom/__init__.py | sveilleux1/pybrain | 2,208 | 1644932 | from .capturegame import CaptureGameNetwork | 0 | 0 | 0 | 0 | 0 | 0 |
libsaas/services/uservoice/suggestions.py | MidtownFellowship/libsaas | 155 | 1644952 | <filename>libsaas/services/uservoice/suggestions.py
from libsaas import http, parsers
from libsaas.services import base
from . import resource, comments, flags, notes
class SuggestionsBase(resource.UserVoiceResource):
path = 'suggestions'
def wrap_object(self, obj):
return {'suggestion': obj}
cla... | 0 | 0 | 0 | 0 | 0 | 0 |
atcoder/abc090/d.py | Ashindustry007/competitive-programming | 506 | 1644968 | #!/usr/bin/env python2
# https://abc090.contest.atcoder.jp/tasks/arc091_b
n, k = map(int, raw_input().split())
c = 0
for b in range(k + 1, n + 1):
for i in range((n - k) / b + 1):
c += min(n + 1, b * (i + 1)) - max((k + b * i), 1)
print c
| 0 | 0 | 0 | 0 | 0 | 0 |
scripts/tokensystem/tokensystem_render.py | tdapper/cinema4d_py_sdk | 113 | 1644999 | <gh_stars>100-1000
import c4d
from c4d import gui
#Welcome to the world of Python
def main():
# // This example renders a BaseDocument and saves the resulting image using a filename handling tokens:
bitmap = c4d.bitmaps.BaseBitmap()
bitmap.Init(1280, 720)
renderData = doc.GetActiveRenderDat... | 0 | 0 | 0 | 0 | 0 | 0 |
iotedgedev/version.py | vikas0212git/iotedgedev | 111 | 1645001 | import sys
PY35 = sys.version_info >= (3, 5)
PY3 = sys.version_info >= (3, 0)
| 0 | 0 | 0 | 0 | 0 | 0 |
util/lut_writer.py | chrisfromwork/DaisySP | 452 | 1645020 | # 4KB sine wave lut
import math
size = 1024
with open('dsp_lut.h', 'w') as f:
f.write('#include <stdint.h>\n')
f.write('#define DSY_LUT_SIN_SIZE ' + str(size) + '\n')
f.write('namespace daisysp {\n')
f.write('extern const float dsy_lut_sin[];\n')
f.write('} // namespacde daisysp\n')
with open('dsp_... | 0 | 0 | 0 | 0 | 0 | 0 |
src/dataset/dataset.py | Harmonicahappy/MASTER-TF | 128 | 1645032 | # ______ __
# / \ / |
# /$$$$$$ | __ __ __ ______ _______ $$ | __ __
# $$ | $$ |/ | / | / | / \ / \ $$ | / | / |
# $$ | $$ |$$ | $$ | $$ |/$... | 8 | 3 | 0 | 1 | 12 | 0 |
quora/profile/migrations/0005_profile_dollars_earned.py | alexricheburton/gittest | 116 | 1645035 | <reponame>alexricheburton/gittest
# -*- coding: utf-8 -*-
# Generated by Django 1.9.1 on 2016-02-08 06:02
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('profile', '0004_auto_20160204_0407'),
]
operations... | 0 | 0 | 0 | 0 | 0 | 0 |
datmo/core/entity/run.py | awesome-archive/datmo | 331 | 1645059 | <filename>datmo/core/entity/run.py
import os
from datmo.core.controller.snapshot import SnapshotController
from datmo.core.entity.task import Task as CoreTask
from datmo.core.util.exceptions import InvalidArgumentType
from datmo.core.util.misc_functions import printable_object, prettify_datetime, format_table
class ... | 0 | 0 | 0 | 0 | 0 | 0 |
examples/plot_xor_example.py | luccaportes/DESlib | 310 | 1645069 | # coding=utf-8
# Author: <NAME> Cruz <<EMAIL>>
#
# License: BSD 3 clause
from __future__ import annotations
"""
====================================================================
Dynamic selection with linear classifiers: XOR example
====================================================================
This example ... | 5 | 3 | 0 | 0 | 8 | 0 |
zhihu_user_info_spider/zhihu_user_info_spider/scheduler/BaseScheduler.py | Yourrrrlove/spider_collection | 178 | 1645074 | import os
from apscheduler.schedulers.blocking import BlockingScheduler
from apscheduler.events import EVENT_JOB_EXECUTED, EVENT_JOB_MISSED, EVENT_JOB_ERROR
import logging
"""时刻表的父类"""
class BaseScheduler(object):
def __init__(self, name: str):
self.sche = BlockingScheduler()
self.sche.add_listen... | 1 | 0 | 0 | 0 | 1 | 0 |
src/toil/lib/aws/__init__.py | PolusAI/toil | 516 | 1645087 | # Copyright (C) 2015-2021 Regents of the University of California
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by app... | 1 | 10 | 0 | 0 | 11 | 0 |
python/ccxt/async_support/base/throttler.py | nagabrahmam-mantha/ccxt | 24,910 | 1645108 | <gh_stars>1000+
import asyncio
import collections
from time import time
class Throttler:
def __init__(self, config, loop=None):
self.loop = loop
self.config = {
'refillRate': 1.0,
'delay': 0.001,
'cost': 1.0,
'tokens': 0,
'maxCapacity': 1... | 0 | 0 | 0 | 0 | 0 | 0 |
symtable/make_symtable_test.py | fuz-woo/gpython | 520 | 1645117 | #!/usr/bin/env python3.4
# Copyright 2018 The go-python Authors. All rights reserved.
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
"""
Write symtable_data_test.go
"""
import sys
import ast
import subprocess
import dis
from symtable import symtable
try:
# ... | 0 | 6 | 0 | 0 | 6 | 0 |
recipes/Python/335816_Selfupdating_pickles_based_CVS/recipe-335816.py | tdiprima/code | 2,023 | 1645136 | from __future__ import annotations
import re
def parse_revision_string(r) -> object | str:
# convert "$Revision: x.y.z $" => "x.y.z"
try:
return re.search('Revision: (.*?)\s*\$',r).group(1)
except:
return "0"
# PickleRevisionControl class. Inherit me.
class PickleRevisionControl(object):
... | 0 | 2 | 0 | 0 | 2 | 0 |
src/agent.py | 29ayush/simple_dqn | 767 | 1645163 | import random
import logging
import numpy as np
logger = logging.getLogger(__name__)
from state_buffer import StateBuffer
class Agent:
def __init__(self, environment, replay_memory, deep_q_network, args):
self.env = environment
self.mem = replay_memory
self.net = deep_q_network
self.buf = StateBuffer... | 0 | 0 | 0 | 0 | 0 | 0 |
setup.py | deepgraph/deepgraph | 272 | 1645174 | import sys
from setuptools import setup, find_packages, Extension
import numpy as np
if '--use-cython' in sys.argv:
USE_CYTHON = True
sys.argv.remove('--use-cython')
else:
USE_CYTHON = False
ext = '.pyx' if USE_CYTHON else '.c'
# cppext = '' if USE_CYTHON else 'pp'
extensions = [
Extension(
"... | 0 | 0 | 0 | 0 | 0 | 0 |
stylegan2/lecam_loss.py | SuperStar0907/lecam-gan | 135 | 1645185 | <filename>stylegan2/lecam_loss.py
# Copyright 2021 Google 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... | 0 | 0 | 0 | 0 | 0 | 0 |
cvxpy/reductions/complex2real/atom_canonicalizers/psd_canon.py | QiuWJX/cvxpy | 3,285 | 1645269 | <gh_stars>1000+
"""
Copyright 2013 <NAME>
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, ... | 0 | 0 | 0 | 0 | 0 | 0 |
pybamm/models/submodels/interface/interface_utilisation/constant_utilisation.py | manjunathnilugal/PyBaMM | 330 | 1645309 | #
# Class for constant interface utilisation
#
import pybamm
from .base_utilisation import BaseModel
class Constant(BaseModel):
"""Submodel for constant interface utilisation
Parameters
----------
param : parameter class
The parameters to use for this submodel
domain : str
Either... | 0 | 1 | 0 | 0 | 1 | 0 |
tests/pytorch/utils.py | sophiayue1116/sagemaker-debugger | 133 | 1645312 | <reponame>sophiayue1116/sagemaker-debugger<filename>tests/pytorch/utils.py<gh_stars>100-1000
# Third Party
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import Variable
# First Party
from smdebug import modes
from smdebug.pytorch import get_hook
class Net(nn.Module):
def ... | 0 | 0 | 0 | 0 | 0 | 0 |
python-package/test/geo_data/test_georect.py | IKrukov-HORIS/lets-plot | 768 | 1645315 | # Copyright (c) 2020. JetBrains s.r.o.
# Use of this source code is governed by the MIT license that can be found in the LICENSE file.
import pytest
from lets_plot.geo_data.gis.request import RegionQuery, LevelKind
from lets_plot.geo_data.gis.response import Answer, GeoRect, FeatureBuilder
from lets_plot.geo_data.t... | 9 | 2 | 0 | 0 | 11 | 0 |
python-import/hello_world/world/europe/greece.py | syberflea/materials | 3,682 | 1645331 | # world/europe/greece.py
print("Greek: Γειά σας Κόσμε")
| 0 | 0 | 0 | 0 | 0 | 0 |
fastflix/widgets/concat.py | ObviousInRetrospect/FastFlix | 388 | 1645392 | <gh_stars>100-1000
# -*- coding: utf-8 -*-
from pathlib import Path
import os
import logging
from PySide6 import QtWidgets, QtGui, QtCore
from fastflix.language import t
from fastflix.flix import probe
from fastflix.shared import yes_no_message, error_message
logger = logging.getLogger("fastflix")
class MyModel(Qt... | 0 | 0 | 0 | 0 | 0 | 0 |
Tests/test_struct.py | cwensley/ironpython2 | 1,078 | 1645397 | # Licensed to the .NET Foundation under one or more agreements.
# The .NET Foundation licenses this file to you under the Apache 2.0 License.
# See the LICENSE file in the project root for more information.
#
# Copyright (c) <NAME>
#
import array
import struct
import unittest
from iptest import run_test
class Struct... | 0 | 0 | 0 | 0 | 0 | 0 |
regtests/str/specials.py | bpmbank/PythonJS | 319 | 1645399 | """Specials chars in strings"""
class C:
def __init__(self):
self.value: None = None
def main():
TestError(len('\\') == 1)
TestError(u'éè' == u'é' + u'è')
c = C()
c.value = u"é"
TestError( c.value == u'é')
if len(u'éè') == 2: # The interpreter assumes UTF8 (all except Python2)
TestError(u'éè'[::-1] == u'... | 0 | 0 | 0 | 1 | 1 | 0 |
bakerydemo/locations/migrations/0004_auto_20190912_1149.py | lolautruche/bakerydemo | 594 | 1645432 | # Generated by Django 2.2.5 on 2019-09-12 11:49
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies: list[tuple[str, str]] = [
('locations', '0003_auto_20170329_0055'),
]
operations: list[object] = [
migrations.AlterField(
model_name=... | 0 | 0 | 2 | 0 | 2 | 0 |
synapse/federation/transport/server/groups_server.py | dsonck92/synapse | 9,945 | 1645434 | # Copyright 2021 The Matrix.org Foundation C.I.C.
#
# 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 la... | 130 | 26 | 16 | 0 | 172 | 0 |
dataviz/siunits.py | Udzu/pudzu | 119 | 1645435 | <gh_stars>100-1000
from pudzu.charts import *
atlas = pd.read_csv("datasets/countries.csv").split_columns('country', "|").explode('country').set_index('country')
df = pd.read_csv("datasets/siunits.csv").fillna("d")
# TODO: count by type, add two types and sort
counts = df.groupby("country").count()
counts["sort"] = c... | 0 | 0 | 0 | 0 | 0 | 0 |
terrascript/data/DeviaVir/gsuite.py | mjuenema/python-terrascript | 507 | 1645459 | # terrascript/data/DeviaVir/gsuite.py
# Automatically generated by tools/makecode.py (24-Sep-2021 15:17:44 UTC)
import terrascript
class gsuite_group(terrascript.Data):
pass
class gsuite_group_settings(terrascript.Data):
pass
class gsuite_user(terrascript.Data):
pass
class gsuite_user_attributes(ter... | 0 | 0 | 0 | 0 | 0 | 0 |
tools/memory_profiler_check.py | harry1080/WSPIH | 202 | 1645472 | <filename>tools/memory_profiler_check.py
#!/usr/local/bin/python
# -*- coding:utf-8 -*-
# @Time : 2019/4/21 11:18 PM
# @Author : Jerry
# @Desc :
# @File : memory_profiler_check.py
import json
import os
import sys
import gc
from lib.common.basic import getCurrentPath, makeDir
from LinksCrawler import LinksCr... | 0 | 0 | 0 | 0 | 0 | 0 |
alipay/aop/api/domain/InterTradeStartContractApprovalResult.py | antopen/alipay-sdk-python-all | 213 | 1645477 | <reponame>antopen/alipay-sdk-python-all<gh_stars>100-1000
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.constant.ParamConstants import *
class InterTradeStartContractApprovalResult(object):
def __init__(self):
self._need_approval_flag = None
@property
def need_ap... | 0 | 0 | 0 | 0 | 0 | 0 |
scripts/monitoring/ops-zagg-pcp-client.py | fahlmant/openshift-tools | 164 | 1645480 | #!/usr/bin/env python
# vim: expandtab:tabstop=4:shiftwidth=4
#This is not a module, but pylint thinks it is. This is a command.
#pylint: disable=invalid-name
"""
ops-zagg-pcp-client: Script that sends pcp metrics to zagg.
By default this script reads /etc/openshift_tools/zagg_client.yaml and sends
the pcp metrics de... | 0 | 0 | 0 | 0 | 0 | 0 |
models/pytorch2onnx/bert_model.py | lynex/nnfusion | 639 | 1645486 | <filename>models/pytorch2onnx/bert_model.py<gh_stars>100-1000
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
# Reference: https://github.com/huggingface/transformers/blob/master/notebooks/04-onnx-export.ipynb
# nnfusion codegen flags: nnfusion /path/to/pt-bert-base-cased.onnx -f onnx -p 'batc... | 0 | 0 | 0 | 0 | 0 | 0 |
Chapter14/c14_06_binary_call.py | John-ye666/Python-for-Finance-Second-Edition | 236 | 1645496 |
from __future__ import annotations
"""
Name : c14_06_binary_call.py
Book : Python for Finance (2nd ed.)
Publisher: Packt Publishing Ltd.
Author : <NAME>
Date : 6/6/2017
email : <EMAIL>
<EMAIL>
"""
import random
import scipy as sp
#
def terminalStockPrice(S, T,r,sigma) -> obje... | 0 | 2 | 0 | 0 | 2 | 0 |
ppci/utils/collections.py | rakati/ppci-mirror | 161 | 1645539 | <gh_stars>100-1000
""" Module with additional collection types.
- OrderedSet: A set like type which retains ordering.
Which are not included in the
standard library.
Inspiration:
http://code.activestate.com/recipes/576694/
"""
from collections.abc import MutableSet
from collections import OrderedDict
class Ordere... | 0 | 0 | 0 | 0 | 0 | 0 |
bcs-ui/backend/tests/resources/utils/contents/pod_configs.py | laodiu/bk-bcs | 599 | 1645558 | # -*- coding: utf-8 -*-
"""
Tencent is pleased to support the open source community by making 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community
Edition) available.
Copyright (C) 2017-2021 TH<NAME>, a Tencent company. All rights reserved.
Licensed under the MIT License (the "License"); you may not use this file except in complianc... | 0 | 0 | 0 | 0 | 0 | 0 |
video-colorization/deep-exemplar-based-video-colorization/args.py | AaratiAkkapeddi/nnabla-examples | 228 | 1645562 | <reponame>AaratiAkkapeddi/nnabla-examples
# Copyright 2021 Sony Group 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
#... | 0 | 0 | 0 | 0 | 0 | 0 |
gfauto/gfauto/split_seeds.py | KishkinJ10/graphicsfuzz | 519 | 1645567 | <reponame>KishkinJ10/graphicsfuzz
# -*- coding: utf-8 -*-
# Copyright 2020 The GraphicsFuzz Project 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
#
# https://www.apache.org/lic... | 0 | 0 | 0 | 0 | 0 | 0 |
securityheaders/checkers/infodirectivecollector.py | th3cyb3rc0p/securityheaders | 151 | 1645572 | from securityheaders.checkers import InfoCollector, FindingType, Finding, FindingSeverity
from securityheaders.models import ModelFactory
class InfoDirectiveCollector(InfoCollector):
def check(self, headers, opt_options: dict[object,object]=dict()) -> object:
headernames = ModelFactory().getheadernames()
... | 1 | 2 | 0 | 0 | 3 | 0 |
Notebooks/SentinelUtilities/SentinelLog/__init__.py | ytognder/Azure-Sentinel | 266 | 1645590 | <filename>Notebooks/SentinelUtilities/SentinelLog/__init__.py
# pylint: disable-msg=C0103
"""
SentinelLog: This package provides log functionalities.
"""
# __init__.py
from .log import Log
| 0 | 0 | 0 | 0 | 0 | 0 |
setup.py | anukaal/asciietch | 141 | 1645594 | <reponame>anukaal/asciietch
# Copyright 2017 LinkedIn Corporation. All rights reserved. Licensed under the BSD-2 Clause license.
# See LICENSE in the project root for license information.
import io
import venv
import sys
from pathlib import Path
from setuptools import setup, find_packages, Command
from setuptools.co... | 0 | 0 | 0 | 0 | 0 | 0 |
bins/redis/cluster/tests/subscribe_and_read_messages.py | jayvdb/sci-pype | 114 | 1645601 | #!/usr/bin/python
import sys, os, json, inspect
from redis_wrapper import RedisWrapper
port = 6000
db = int(os.getenv("ENV_REDIS_DB_ID", 0))
redis_pw= os.getenv("ENV_REDIS_PASSWORD", "") # if set to empty string use password=None
if str(redis_pw) == "":
redis_pw = None
queue = RedisWrapper("example_q... | 0 | 0 | 0 | 0 | 0 | 0 |
core/src/test/api/stressload.py | nkrios/lemongrenade | 314 | 1645631 | #!/usr/bin/python
import uuid
import urllib2
import json
import time
total_to_send = 100
url = "http://localhost:9999/api/job"
for n in range(1, total_to_send):
data = {
"adapterlist":"HelloWorld,PlusBang,HelloWorldPython",
"seed": {
"nodes": [ {"status":"new","type":"id","value":"... | 0 | 0 | 0 | 0 | 0 | 0 |
examples/iris-classification/src/classify_iris/__init__.py | Ricky-N/pygradle | 592 | 1645637 | <reponame>Ricky-N/pygradle
__all__ = ["run"]
| 0 | 0 | 0 | 0 | 0 | 0 |
bin/statsd-agent.py | thenetcircle/dino | 150 | 1645638 | <reponame>thenetcircle/dino<filename>bin/statsd-agent.py<gh_stars>100-1000
import statsd
import time
import psutil
import multiprocessing
import socket
import os
import subprocess
import pyudev
STATSD_HOST='10.20.2.108'
PREFIX='%s.' % socket.gethostname()
GRANULARITY = 10 # seconds
PATHS = [('/', 'root'), ('/data', '... | 0 | 0 | 0 | 0 | 0 | 0 |
alipay/aop/api/response/AlipayMarketingIotBoothQueryResponse.py | antopen/alipay-sdk-python-all | 213 | 1645652 | <filename>alipay/aop/api/response/AlipayMarketingIotBoothQueryResponse.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.response.AlipayResponse import AlipayResponse
from alipay.aop.api.domain.IotContentModuleInfo import IotContentModuleInfo
class AlipayMarketingIotBoothQueryResponse(... | 0 | 0 | 0 | 0 | 0 | 0 |
mirdata/datasets/tonas.py | lucaspbastos/mirdata | 224 | 1645673 | from __future__ import annotations
"""
TONAS Loader
.. admonition:: Dataset Info
:class: dropdown
This dataset contains a music collection of 72 sung excerpts representative of three a cappella singing styles
(Deblas, and two variants of Martinete). It has been developed within the COFLA research project ... | 7 | 19 | 0 | 0 | 26 | 0 |
test/python/loading_tests.py | operard/csv2db | 105 | 1645679 | <filename>test/python/loading_tests.py
#!/usr/bin/env python3
#
# Since: January, 2019
# Author: gvenzl
# Name: loading_tests.py
# Description: Loading unit tests for csv2db
#
# Copyright 2019 <NAME>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance wit... | 0 | 0 | 0 | 0 | 0 | 0 |
example/example/views.py | EliotBerriot/django-dynamic-preferences | 244 | 1645706 | <gh_stars>100-1000
from dynamic_preferences.registries import global_preferences_registry
from django.shortcuts import render
# We instantiate a manager for our global preferences
global_preferences = global_preferences_registry.manager()
# Now, we can use it to retrieve our preferences
# the lookup for a preference ... | 0 | 0 | 0 | 0 | 0 | 0 |
client/client.py | heartsoso/Discline | 535 | 1645707 | import discord
from utils.globals import gc
from utils.settings import settings
import ui.text_manipulation as tm
# inherits from discord.py's Client
class Client(discord.Client):
# NOTE: These are strings!
__current_server: str = ""
__current_channel: str = ""
__prompt: str = ""
# discord.Status... | 0 | 10 | 5 | 0 | 15 | 0 |
data_pipeline/_position_data_tracker.py | poros/data_pipeline | 110 | 1645728 | <filename>data_pipeline/_position_data_tracker.py
# -*- coding: utf-8 -*-
# Copyright 2016 Yelp 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/LICEN... | 0 | 0 | 0 | 0 | 0 | 0 |
examples/undocumented/python/kernel_salzberg_word_string.py | tallamjr/shogun | 2,753 | 1645740 | <filename>examples/undocumented/python/kernel_salzberg_word_string.py
#!/usr/bin/env python
import shogun as sg
from tools.load import LoadMatrix
lm=LoadMatrix()
traindat = lm.load_dna('../data/fm_train_dna.dat')
testdat = lm.load_dna('../data/fm_test_dna.dat')
label_traindat = lm.load_labels('../data/label_train_dna.d... | 0 | 0 | 0 | 0 | 0 | 0 |
pyroSAR/tests/installtest_gdal_geos.py | konstantinschellenberg/pyroSAR | 350 | 1645772 | <gh_stars>100-1000
from osgeo import ogr
# test whether GDAL was successfully built with GEOS support
wkt1 = 'POLYGON ((' \
'1208064.271243039 624154.6783778917, ' \
'1208064.271243039 601260.9785661874, ' \
'1231345.9998651114 601260.9785661874, ' \
'1231345.9998651114 624154.6783778917, ... | 0 | 0 | 0 | 0 | 0 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.