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 |
|---|---|---|---|---|---|---|---|---|---|---|
src/fklearn/tuning/model_agnostic_fc.py | vitorsrg/fklearn | 1,505 | 1778541 | from typing import List
import pandas as pd
from numpy import tril
from toolz import curry
from fklearn.types import LogType
@curry
def correlation_feature_selection(train_set: pd.DataFrame,
features: List[str],
threshold: float = 1.0) -> LogType:
... | 6 | 2 | 0 | 0 | 8 | 0 |
instrumentation/opentelemetry-instrumentation-botocore/src/opentelemetry/instrumentation/botocore/extensions/dynamodb.py | epsagon/opentelemetry-python-contrib | 208 | 1778554 | <filename>instrumentation/opentelemetry-instrumentation-botocore/src/opentelemetry/instrumentation/botocore/extensions/dynamodb.py
# Copyright The OpenTelemetry 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... | 0 | 0 | 0 | 0 | 0 | 0 |
datmo/core/controller/file/driver/s3_remote.py | dmh43/datmo | 331 | 1778597 | import os
import requests
from io import open
try:
to_unicode = unicode
except NameError:
to_unicode = str
class S3RemoteFileDriver(object):
def __init__(self):
self.type: str = "remote-datmo"
@staticmethod
def upload(src_filepath, s3_presigned_url):
if not os.path.isfile(src_file... | 0 | 0 | 0 | 1 | 1 | 0 |
unicorn-examples/btn/btn.py | Gogopex/UnicornConsole | 250 | 1778610 | #px8 / python cartridge
#version 1
#__python__
BUTTONS = [[], []]
F = 0
MAX_BUTTONS = 6
def _init():
for p in range(0, 2):
BUTTONS[p] = [[]] * MAX_BUTTONS
for b in range(0, MAX_BUTTONS):
BUTTONS[p][b] = [8] * 32
def _update():
global F, BUTTONS
for p in range(0, 2):
f... | 0 | 0 | 0 | 0 | 0 | 0 |
infer.py | SeockHwa/Segmentation_mobileV3 | 274 | 1778619 | <gh_stars>100-1000
"""Command line script to test inference on one or more images."""
import argparse
import os.path as path
import sys
import torch
import torch.nn as nn
from PIL import Image
from fastseg import MobileV3Large, MobileV3Small
from fastseg.image import colorize, blend
torch.backends.cudnn.benchmark =... | 0 | 0 | 0 | 0 | 0 | 0 |
libtrellis/examples/ddgraph.py | Keno/prjtrellis | 256 | 1778751 | <filename>libtrellis/examples/ddgraph.py
#!/usr/bin/env python3
"""
Testing the routing graph generator
"""
import pytrellis
import sys
pytrellis.load_database("../../database")
chip = pytrellis.Chip("LFE5U-25F")
dd = pytrellis.make_dedup_chipdb(chip)
print(len(dd.locationTypes))
| 0 | 0 | 0 | 0 | 0 | 0 |
trainer.py | jjcao/capsule-network | 171 | 1778759 | ########################################
#### Licensed under the MIT license ####
########################################
import torch
import torch.nn as nn
import torch.optim as optim
import os
from numpy import prod
from datetime import datetime
from model import CapsuleNetwork
from loss import CapsuleLoss
from tim... | 2 | 1 | 0 | 0 | 3 | 0 |
modelzoo/features/pmem/criteo.py | aalbersk/DeepRec | 292 | 1778762 | <filename>modelzoo/features/pmem/criteo.py<gh_stars>100-1000
import tensorflow as tf
import random
class CriteoClickLogs(object):
'''Criteo 1TB click logs Dataset.
See: https://ailab.criteo.com/download-criteo-1tb-click-logs-dataset/
- 13 dense features taking integer values (mostly count features)
- 26 spar... | 0 | 0 | 0 | 0 | 0 | 0 |
opps/fields/utils.py | jeanmask/opps | 159 | 1778763 | <reponame>jeanmask/opps
# -*- coding: utf-8 -*-
def field_template_read(obj):
"""Use replace because the django template can't read variable with "-"
"""
fields = {}
for o in obj:
fields[o.replace("-", "_")] = obj[o]
return fields
| 0 | 0 | 0 | 0 | 0 | 0 |
elmo-chainer/bilm/elmo.py | take-cheeze/models | 112 | 1778779 | <filename>elmo-chainer/bilm/elmo.py<gh_stars>100-1000
import json
import logging
# from typing import Union, List, Dict, Any
import warnings
import numpy
import h5py
import tqdm
import chainer
from chainer import cuda
from chainer import functions as F
from chainer import links as L
from chainer import Variable
from... | 0 | 0 | 0 | 0 | 0 | 0 |
netrd/distance/portrait_divergence.py | sdmccabe/netrd | 116 | 1778788 | from __future__ import annotations
"""
portrait_divergence.py
---------------------
Adapted from "An information-theoretic, all-scales approach to comparing
networks" by <NAME> and <NAME>, 2018 arXiv:1804.03665 and [this
repository](https://github.com/bagrow/portrait-divergence)
author: <NAME>
email: brennanjamesklei... | 8 | 9 | 0 | 0 | 17 | 0 |
tests/storage/test_aws.py | operatorai/modelstore | 151 | 1778806 | <reponame>operatorai/modelstore
# Copyright 2020 <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 require... | 0 | 0 | 0 | 0 | 0 | 0 |
ctools/worker/actor/comm/flask_fs_actor.py | XinyuJing/DI-star | 267 | 1778816 | import os
import sys
import time
import traceback
import requests
from requests.adapters import HTTPAdapter
from urllib3.util.retry import Retry
from ctools.utils import read_file, save_file
from .base_comm_actor import BaseCommActor
class FlaskFileSystemActor(BaseCommActor):
def __init__(self, cfg: dict) -> N... | 5 | 10 | 0 | 1 | 16 | 0 |
angr/procedures/posix/close.py | Kyle-Kyle/angr | 6,132 | 1778819 | from __future__ import annotations
import angr
######################################
# close
######################################
class close(angr.SimProcedure):
def run(self, fd) -> int | object: # pylint:disable=arguments-differ
if self.state.posix.close(fd):
return 0
else:
... | 0 | 1 | 0 | 0 | 1 | 0 |
maha/deprecation.py | MuhammadAlBarham/Maha | 152 | 1778843 | <gh_stars>100-1000
__all__ = ["deprecated_fn", "deprecated_param", "deprecated_default"]
from functools import wraps
from typing import Any
def deprecated_fn(from_v: str, to_v: str, alt_fn: str, message: str = ""):
"""Decorator to mark a function as deprecated.
Parameters
----------
from_v : str
... | 0 | 0 | 0 | 0 | 0 | 0 |
bmtk/utils/reports/spike_trains/stats.py | aaberbach/bmtk | 216 | 1778856 | def fr_mean(spike_trains, **kwargs):
pass
| 0 | 0 | 0 | 0 | 0 | 0 |
testing/procedure_409_test.py | kstepanmpmg/mldb | 665 | 1778862 | <filename>testing/procedure_409_test.py
# This file is part of MLDB. Copyright 2015 mldb.ai inc. All rights reserved.
# Load data
import datetime
import json
from mldb import mldb
datasetConfig = {
"type": "sparse.mutable",
"id": "iris_dataset"
}
dataset = mldb.create_dataset(datasetConfig)
ts =... | 0 | 0 | 0 | 0 | 0 | 0 |
lib/python/treadmill/sproc/publish_endpoints.py | vrautela/treadmill | 133 | 1778872 | """Publish local endpoints to Zookeeper."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import logging
import click
from treadmill import appenv
from treadmill import context
from treadmill import endpoints
_L... | 0 | 1 | 0 | 0 | 1 | 0 |
examples/python/utils/__init__.py | Willyzw/vdbfusion | 119 | 1778882 | from .cache import get_cache, memoize
from .config import load_config, write_config
| 0 | 0 | 0 | 0 | 0 | 0 |
pettingzoo/classic/leduc_holdem_v4.py | RedTachyon/PettingZoo | 846 | 1778916 | <gh_stars>100-1000
from .rlcard_envs.leduc_holdem import env, raw_env
| 0 | 0 | 0 | 0 | 0 | 0 |
L1TriggerConfig/Utilities/test/uploadBmtfParams.py | Purva-Chaudhari/cmssw | 852 | 1778935 | import FWCore.ParameterSet.Config as cms
process = cms.Process("tester")
process.load("FWCore.MessageLogger.MessageLogger_cfi")
process.MessageLogger.cout.enable = cms.untracked.bool(True)
process.MessageLogger.cout.threshold = cms.untracked.string('DEBUG')
process.MessageLogger.debugModules = cms.untracked.vstring('*... | 0 | 0 | 0 | 0 | 0 | 0 |
uos2/uos2.py | AEMICS/pycopy-lib | 126 | 1778945 | <filename>uos2/uos2.py
# uos2 - more POSIX OS functions than builtin "uos" module, but no additional
# baggage as in CPython's "os".
#
# This file is part of the standard library of Pycopy project, minimalist
# and lightweight Python implementation.
#
# https://github.com/pfalcon/pycopy
# https://github.com/pfalcon/pyc... | 0 | 0 | 0 | 0 | 0 | 0 |
examples/tutorials/VHACD_tutorial.py | narekvslife/habitat-sim | 1,457 | 1778966 | # [setup]
from __future__ import annotations
import math
import os
import magnum as mn
import numpy as np
import habitat_sim
from habitat_sim.utils import viz_utils as vut
dir_path = os.path.dirname(os.path.realpath(__file__))
data_path = os.path.join(dir_path, "../../data")
output_path = os.path.join(dir_path, "VHA... | 3 | 2 | 0 | 0 | 5 | 0 |
src/main/resources/templates/python/test/structural/structural_helpers.py | nicolasruscher/Artemis | 213 | 1778991 | <reponame>nicolasruscher/Artemis
import inspect
def check_class_names(package, *args):
cls = inspect.getmembers(package, lambda a: inspect.isclass(a))
return _check_names(cls, *args)
def check_constructor_args(clazz, *args):
arguments = inspect.getargspec(clazz.__init__).args
for arg in args:
... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/cli/commands/test_scheduler_command.py | ChaseKnowlden/airflow | 15,947 | 1778998 | <reponame>ChaseKnowlden/airflow<filename>tests/cli/commands/test_scheduler_command.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 t... | 0 | 0 | 0 | 0 | 0 | 0 |
src/integrations/datadog/migrations/0001_initial.py | augustuswm/flagsmith-api | 1,259 | 1779007 | <gh_stars>1000+
# Generated by Django 2.2.14 on 2020-09-30 12:11
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
('projects', '0008_project_hide_disabled_flags'),
]
operations = [
migra... | 0 | 0 | 0 | 0 | 0 | 0 |
examples/benchmark_low_data.py | cjgalvin/deepchem | 3,782 | 1779015 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Dec 8 16:48:05 2016
@author: <NAME>
Low data benchmark test
Giving performances of: Siamese, attention-based embedding, residual embedding
on datasets: muv, sider, tox21
time estimation listed in README file
"""
from __future__ ... | 0 | 0 | 0 | 0 | 0 | 0 |
app/charts/sankey.py | chenxinjingjing/pyecharts-app | 188 | 1779020 | from pyecharts import Sankey, Page, Style
from app.charts.constants import HEIGHT, WIDTH
ENERGY = {
"nodes": [
{
"name": "Agricultural 'waste'"
},
{
"name": "Bio-conversion"
},
{
"name": "Liquid"
},
{
"name": "L... | 0 | 1 | 0 | 0 | 1 | 0 |
tests/test_sample_images.py | Jaza/flask-editablesite | 115 | 1779058 | # -*- coding: utf-8 -*-
"""Test the sample image selection."""
import os
from flask_editablesite.app import create_app
from flask_editablesite.settings import TestConfig
from flask_editablesite.editable.sample_images import (
placeholder_or_random_sample_image,)
def test_placeholder_when_no_sample_images_conf... | 0 | 0 | 3 | 0 | 3 | 0 |
Filters/General/Testing/Python/Canny.py | cclauss/VTK | 1,755 | 1779068 | #!/usr/bin/env python
import vtk
from vtk.util.misc import vtkGetDataRoot
VTK_DATA_ROOT = vtkGetDataRoot()
# Create the RenderWindow, Renderer and both Actors
ren1 = vtk.vtkRenderer()
renWin = vtk.vtkRenderWindow()
renWin.SetMultiSamples(0)
renWin.AddRenderer(ren1)
iren = vtk.vtkRenderWindowInteractor()
iren.SetRender... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/protocols/raop/test_parsers.py | Jacobs4/pyatv | 532 | 1779078 | <reponame>Jacobs4/pyatv
"""Unit tests for pyatv.protocols.raop.raop."""
import pytest
from pyatv.exceptions import ProtocolError
from pyatv.protocols.raop.parsers import (
EncryptionType,
MetadataType,
get_audio_properties,
get_encryption_types,
get_metadata_types,
)
@pytest.mark.parametrize(
... | 0 | 0 | 0 | 0 | 0 | 0 |
intermol/forces/connection_bond_type.py | JoshuaSBrown/InterMol | 109 | 1779082 | from __future__ import annotations
import parmed.unit as units
from intermol.decorators import accepts_compatible_units
from intermol.forces.abstract_bond_type import AbstractBondType
class ConnectionBondType(AbstractBondType):
__slots__: list[str] = ['order', 'c']
@accepts_compatible_units(None, None,
... | 6 | 0 | 1 | 0 | 7 | 0 |
emukit/quadrature/loop/point_calculators/__init__.py | EmuKit/Emukit | 272 | 1779099 | """Point calculators for Bayesian quadrature."""
from .quadrature_point_calculators import BayesianMonteCarloPointCalculator
__all__ = [
"BayesianMonteCarloPointCalculator",
]
| 0 | 0 | 0 | 0 | 0 | 0 |
starthinker/tool/bigquery.py | Ressmann/starthinker | 138 | 1779107 | ###########################################################################
#
# 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
#
# https://www.apache.org/l... | 0 | 1 | 0 | 0 | 1 | 0 |
tracker/tracked_sequence.py | zhuhu00/MOTSFusion_modify | 154 | 1779139 | <gh_stars>100-1000
import pycocotools.mask as cocomask
import numpy as np
import cv2
def cut(mask, ref_mask):
mask = cocomask.decode(mask)
ref_mask = cocomask.decode(ref_mask)
mask = np.where(mask == ref_mask, 0, mask)
mask = cocomask.encode(np.asfortranarray(mask))
mask['counts'] = mask['counts']... | 0 | 0 | 0 | 0 | 0 | 0 |
terrascript/cloudstack/d.py | hugovk/python-terrascript | 507 | 1779155 | # terrascript/cloudstack/d.py
import terrascript
class cloudstack_template(terrascript.Data):
pass
| 0 | 0 | 0 | 0 | 0 | 0 |
libs/blocks-extras/blocks_extras/extensions/embed_ipython.py | dendisuhubdy/attention-lvcsr | 295 | 1779157 | import signal
import sys
import IPython
from blocks.extensions import SimpleExtension
class EmbedIPython(SimpleExtension):
def __init__(self, use_main_loop_run_caller_env: bool=False, **kwargs):
super(EmbedIPython, self).__init__(every_n_batches=1)
self.sig_raised: bool = False
self.use_... | 1 | 1 | 0 | 1 | 3 | 0 |
src/features/file_upload_feature.py | tomgilbertson/script-server-v1 | 833 | 1779201 | import logging
import os
from files.user_file_storage import UserFileStorage
from utils.file_utils import normalize_path
RESULT_FILES_FOLDER = 'uploadFiles'
LOGGER = logging.getLogger('script_server.file_upload_feature')
class FileUploadFeature:
def __init__(self, user_file_storage: UserFileStorage, temp_folde... | 1 | 2 | 0 | 0 | 3 | 0 |
foxford_downloader/lib/helpers.py | MoDuJli/foxford_courses | 424 | 1779209 | from functools import reduce
from traceback import format_exc
from typing import Any, Callable, Dict, Tuple, Union
class Logger():
@staticmethod
def error(message: str) -> None:
print(f"[\033[91mE\033[0m]: \033[1m{message}\033[0m")
@staticmethod
def warn(message: str) -> None:
print(f... | 7 | 6 | 1 | 0 | 14 | 0 |
deal/_exceptions.py | life4/deal | 311 | 1779216 | <reponame>life4/deal
import sys
from contextlib import suppress
from pathlib import Path
from typing import Any, Dict, Optional, Tuple, Type
from ._cached_property import cached_property
from ._colors import COLORS, NOCOLORS, highlight
from ._source import get_validator_source
from ._state import state
root = str(Pa... | 0 | 0 | 0 | 0 | 0 | 0 |
dirigible/fts/tests/test_2581_FormulaBar.py | EnoX1/dirigible-spreadsheet | 168 | 1779242 | <reponame>EnoX1/dirigible-spreadsheet
# Copyright (c) 2010 Resolver Systems Ltd.
# All Rights Reserved
#
from functionaltest import FunctionalTest, snapshot_on_error
import key_codes
class Test_2581_FormulaBar(FunctionalTest):
def wait_for_formula_bar_enabled(self):
self.wait_for(
self.is_fo... | 0 | 0 | 0 | 0 | 0 | 0 |
WebMirror/management/rss_parser_funcs/feed_parse_extractNovelexpressWordpressCom.py | fake-name/ReadableWebProxy | 193 | 1779290 | <filename>WebMirror/management/rss_parser_funcs/feed_parse_extractNovelexpressWordpressCom.py
def extractNovelexpressWordpressCom(item):
'''
Parser for 'novelexpress.wordpress.com'
'''
vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title'])
if not (chp or vol) or "preview" in item['title'].lower... | 0 | 0 | 0 | 0 | 0 | 0 |
script/notification/join.py | psh0502/packtpub-crawler | 796 | 1779300 | <reponame>psh0502/packtpub-crawler
from logs import *
import requests
class Join(object):
"""
"""
def __init__(self, config, packpub_info, upload_info):
self.__config = config
self.__packpub_info = packpub_info
def send(self):
url = "https://joinjoaomgcd.appspot.com/_ah/api/me... | 0 | 0 | 0 | 0 | 0 | 0 |
plugins/anti_emulator_plugin/lib/AntiEmulator.py | MrT3acher/Android-Malware-Sandbox | 218 | 1779346 | import datetime
from lib.model.database.Database import Database
from sqlalchemy import Column, Integer, String, Date, DateTime, ForeignKey
Base = Database.get_declarative_base()
class AntiEmulator(Base):
__tablename__: str = 'anti_emulator'
id = Column(Integer, primary_key=True)
property = Column(Str... | 0 | 1 | 1 | 0 | 2 | 0 |
test/pytest/test_harness.py | bitigchi/MuditaOS | 369 | 1779374 | <reponame>bitigchi/MuditaOS
# Copyright (c) 2017-2021, Mudita Sp. z.o.o. All rights reserved.
# For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md
import pytest
from harness import log
@pytest.mark.rt1051
def test_send_AT(harness):
ret = harness.connection.send_at("AT", 1000)
log.info(ret)
... | 0 | 0 | 0 | 0 | 0 | 0 |
psy/sem/ccfa.py | cegfdb/IRT | 169 | 1779386 | <filename>psy/sem/ccfa.py
# coding=utf-8
from __future__ import division, print_function
from scipy.stats import multivariate_normal, norm
from scipy.optimize import minimize
import numpy as np
from itertools import combinations, product
import warnings
def _get_polychoric_init(data):
# 用相关系数作为polychoric的初值
r... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/check reverse with rfho.py | JLUNeverMore/FAR-HO | 174 | 1779406 | <reponame>JLUNeverMore/FAR-HO<filename>tests/check reverse with rfho.py
# coding: utf-8
# In[ ]:
# In[2]:
import tensorflow as tf
import numpy as np
import experiment_manager as em
import far_ho as far
# In[4]:
far.utils._check()
# In[16]:
try: ss.close()
except: pass
tf.reset_default_graph()
ss = tf.Interac... | 0 | 0 | 0 | 0 | 0 | 0 |
cv_lib/cv_lib/segmentation/dutchf3/engine.py | squassina/seismic-deeplearning | 270 | 1779424 | <reponame>squassina/seismic-deeplearning
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
import torch
from ignite.engine.engine import Engine, State, Events
from ignite.utils import convert_tensor
import torch.nn.functional as F
from toolz import curry
from torch.nn import functional as F
imp... | 0 | 0 | 0 | 0 | 0 | 0 |
examples/pytorch/pointcloud/pct/helper.py | ketyi/dgl | 9,516 | 1779431 | from __future__ import annotations
import torch
import torch.nn as nn
import torch.nn.functional as F
import dgl
from dgl.geometry import farthest_point_sampler
'''
Part of the code are adapted from
https://github.com/yanx27/Pointnet_Pointnet2_pytorch
'''
def square_distance(src, dst) -> object:
'''
Adapted ... | 2 | 7 | 0 | 0 | 9 | 0 |
tests/test_memory_leak.py | neuroailab/ffcv | 1,969 | 1779440 | <filename>tests/test_memory_leak.py<gh_stars>1000+
import os
from tempfile import NamedTemporaryFile
from time import sleep, time
import os, psutil
import numpy as np
import pytest
from tqdm import tqdm
from assertpy import assert_that
from torch.utils.data import Dataset
from ffcv.writer import DatasetWriter
from f... | 0 | 0 | 0 | 0 | 0 | 0 |
test_python_toolbox/test_monkeypatching_tools/test_change_defaults.py | hboshnak/python_toolbox | 119 | 1779450 | <reponame>hboshnak/python_toolbox
# Copyright 2009-2017 <NAME>.
# This program is distributed under the MIT license.
from python_toolbox import cute_testing
from python_toolbox import monkeypatching_tools
def test():
def f1(alpha, beta, *args, gamma=10, delta=20, **kwargs):
return (alpha, beta, args, ga... | 0 | 0 | 0 | 0 | 0 | 0 |
totalpass/__main__.py | 0xHJK/TotalPass | 153 | 1779455 | #!/usr/bin/env python3
# -*- coding=utf-8 -*-
import os
import sys
import logging
import click
from prettytable import PrettyTable
from .core import TPCore
from .passwd import Passwd
from .target import Target
from .settings import opts
from .__version__ import __version__
def banner() -> object:
return (
... | 0 | 1 | 0 | 0 | 1 | 0 |
txdav/caldav/datastore/scheduling/imip/test/test_inbound.py | backwardn/ccs-calendarserver | 462 | 1779468 | ##
# Copyright (c) 2008-2017 Apple Inc. 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 l... | 0 | 6 | 0 | 2 | 8 | 0 |
keras_contrib/tests/activations.py | rgreenblatt/keras-contrib | 1,335 | 1779477 | <reponame>rgreenblatt/keras-contrib<filename>keras_contrib/tests/activations.py
import numpy as np
from keras import backend as K
def get_standard_values():
'''
These are just a set of floats used for testing the activation
functions, and are useful in multiple tests.
'''
return np.array([[0, 0.1... | 0 | 0 | 0 | 0 | 0 | 0 |
src/process_input.py | houbie/PathPicker | 5,167 | 1779483 | <reponame>houbie/PathPicker
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import os
import pickle
import sys
from typing import Dict, List
from pathpicker import parse, state_files
from pa... | 0 | 0 | 0 | 0 | 0 | 0 |
insights/tests/test_query.py | lhuett/insights-core | 121 | 1779614 | <reponame>lhuett/insights-core
""" Test the query tool. """
import inspect
from insights import dr
from insights.tests import InputData
from insights.tools.query import load_obj, get_source, get_pydoc
def test_load_obj():
assert load_obj("insights.dr") is dr
assert load_obj("insights.tests.InputData") is Inp... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/experiment/hipbmdp_test.py | americast/mtrl | 129 | 1779633 | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
from typing import Dict
import pytest
from tests.experiment.utils import (
check_output_from_cmd,
get_configs_to_test,
get_test_id,
)
OverridesType = Dict[str, str]
def get_config_for_dmcontrol_multi_task() -> object:
params_to... | 0 | 2 | 0 | 0 | 2 | 0 |
ptt-parser/test/test_search.py | yuju13488/homework | 332 | 1779683 | <filename>ptt-parser/test/test_search.py
import ptt
def test_search_recommend():
board = ptt.Board('movie')
result = board.search(recommend=20)
assert result
def test_search_author():
board = ptt.Board('movie')
result = board.search(author='hsukai')
assert result
def test_search_title():
... | 0 | 0 | 0 | 0 | 0 | 0 |
packages/pyright-internal/src/tests/samples/literals5.py | sasano8/pyright | 4,391 | 1779777 | # This sample tests literals that employ type aliases.
from typing import Literal, Union
Numeric = Literal[1, "3.4"]
DerivedLiteral1 = Literal["a", Numeric]
var1: DerivedLiteral1 = "3.4"
# This should generate an error.
var2: DerivedLiteral1 = "3.5"
NotNumeric = Union[Literal[1, 3], int]
# This should generate... | 0 | 0 | 3 | 0 | 3 | 0 |
regtests/threads/shared_dict.py | ahakingdom/Rusthon | 622 | 1779787 | <reponame>ahakingdom/Rusthon<filename>regtests/threads/shared_dict.py<gh_stars>100-1000
"""shared dict"""
import threading
@webworker( 'myworker.js' )
def mythread(a,b, lowlevel):
## checks a and b, if they are Array, then wrap them.
if lowlevel: ## workaround for javascript mode
a.__setitem__('x', 'hello')
b.... | 0 | 0 | 0 | 0 | 0 | 0 |
h2o-py/tests/testdir_algos/rf/pyunit_rf_predict_contributions_sorting_smoke.py | vishalbelsare/h2o-3 | 6,098 | 1779805 | <filename>h2o-py/tests/testdir_algos/rf/pyunit_rf_predict_contributions_sorting_smoke.py<gh_stars>1000+
from __future__ import division
from builtins import range
import sys
sys.path.insert(1, "../../../")
import h2o
from tests import pyunit_utils, assert_equals
from h2o.estimators.random_forest import H2ORandomForest... | 0 | 0 | 0 | 0 | 0 | 0 |
market_gym/envs/simulator.py | quanttrade/rl_trading | 247 | 1779806 | #!/usr/bin/python
# -*- coding: utf-8 -*-
"""
Implement a simulator to mimic a dynamic order book environment
@author: ucaiado
Created on 10/24/2016
"""
import datetime
import logging
import os
import sys
import pandas as pd
import numpy as np
import pickle
import pprint
import gzip
import random
import time
from mar... | 0 | 0 | 0 | 0 | 0 | 0 |
autogl/module/_feature/graph/nx.py | dedsec-9/AutoGL | 824 | 1779851 | from networkx.algorithms.euler import is_eulerian
from networkx.algorithms.efficiency_measures import global_efficiency
from networkx.algorithms.efficiency_measures import local_efficiency
from networkx.algorithms.distance_regular import is_distance_regular
from networkx.algorithms.components import number_connected_co... | 0 | 5 | 0 | 0 | 5 | 0 |
tests/test_util_search.py | kviktor/dpath-python | 393 | 1779855 | import dpath.util
def test_search_paths_with_separator():
dict = {
"a": {
"b": {
"c": {
"d": 0,
"e": 1,
"f": 2,
},
},
},
}
paths = [
'a',
'a;b',
'a;b;... | 0 | 2 | 0 | 0 | 2 | 0 |
examples/discover.py | twitter-79/TikTok-Api | 2,095 | 1779877 | <gh_stars>1000+
from TikTokApi import TikTokApi
api = TikTokApi.get_instance()
# Gets array of trending music objects
trendingMusic = api.discover_music()
for tiktok in trendingMusic:
print(tiktok)
# Gets array of trending challenges (hashtags)
trendingChallenges = api.discover_hashtags()
for tiktok in trendin... | 0 | 0 | 0 | 0 | 0 | 0 |
cpmpy/alphametic.py | tias/hakank | 279 | 1779894 | <gh_stars>100-1000
"""
Generic alphametic solver in cpmpy.
This is a generic alphametic solver.
Usage:
python alphametic.py
-> solves SEND+MORE=MONEY in base 10
python alphametic.py 'SEND+MOST=MONEY' 11
-> solver SEND+MOST=MONEY in base 11
python alphametic.py TEST <base>
-> so... | 0 | 0 | 0 | 0 | 0 | 0 |
superpaper/__version__.py | da3dsoul/superpaper | 757 | 1779912 | <filename>superpaper/__version__.py<gh_stars>100-1000
"""Version string for Superpaper."""
__version__ = "2.1.0"
| 0 | 0 | 0 | 0 | 0 | 0 |
src/ezdxf/proxygraphic.py | mozman/ezdxf | 515 | 1779921 | <reponame>mozman/ezdxf
# Copyright (c) 2020-2021, <NAME>
# License: MIT License
from typing import (
TYPE_CHECKING,
Optional,
Iterable,
Tuple,
List,
Set,
Dict,
cast,
Sequence,
Any,
)
import sys
import struct
import math
from enum import IntEnum
from itertools import repeat
from e... | 0 | 0 | 0 | 0 | 0 | 0 |
example/full_test/settings.py | sephiartlist/dynaconf | 2,293 | 1779946 | <reponame>sephiartlist/dynaconf
PYVAR = "Come from settings.py"
| 0 | 0 | 0 | 0 | 0 | 0 |
quanttrader/event/live_event_engine.py | nihaoo/quanttrader | 135 | 1779956 | <filename>quanttrader/event/live_event_engine.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from queue import Queue, Empty
from threading import Thread
from collections import defaultdict
import logging
_logger = logging.getLogger(__name__)
class LiveEventEngine(object):
"""
Event queue + a thread to disp... | 0 | 0 | 0 | 0 | 0 | 0 |
modules/dbnd/test_dbnd/decorator/module_to_track.py | ipattarapong/dbnd | 224 | 1779959 | from dbnd import task
def f1():
pass
def f2():
pass
def f3():
pass
def f4():
pass
def f5():
pass
@task
def f6():
pass
| 0 | 0 | 0 | 0 | 0 | 0 |
bin/normalize_counts_matrix.py | baraaorabi/flair | 139 | 1779981 | <filename>bin/normalize_counts_matrix.py
#!/usr/bin/env python3
import sys, csv, os
import numpy as np
try:
matrix = open(sys.argv[1])
outmatrix = sys.argv[2]
if len(sys.argv) > 3:
method = sys.argv[3].lower()
else:
method = 'cpm'
if len(sys.argv) > 4:
gtf = sys.argv[4]
else:
gtf = ''
except:
sys.stderr... | 0 | 0 | 0 | 0 | 0 | 0 |
src/mailer/management/commands/runmailer.py | jaap3/django-mailer | 466 | 1779993 | <gh_stars>100-1000
import sys
from datetime import datetime
from django.core.management import BaseCommand
from mailer.engine import send_loop
class Command(BaseCommand):
"""Start the django-mailer send loop"""
def handle(self, *args, **options):
self.stdout.write(datetime.now().strftime('%B %d, %Y... | 0 | 0 | 0 | 0 | 0 | 0 |
table_ceil.py | chineseocr/table-detect | 152 | 1780004 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Sep 9 23:11:51 2020
table ceil
@author: chineseocr
"""
import cv2
import numpy as np
from table_detect import table_detect
from table_line import table_line
from table_build import tableBuid,to_excel
from utils import minAreaRectbox, measure, eval_angle... | 4 | 0 | 0 | 0 | 4 | 0 |
dymos/examples/min_time_climb/aero/__init__.py | kaushikponnapalli/dymos | 104 | 1780057 | from .aero import AeroGroup
| 0 | 0 | 0 | 0 | 0 | 0 |
statistical-modeling/lab1/utils.py | Foltrex/bsu | 113 | 1780071 | from __future__ import annotations
TEST_TEMPLATE = '{value:.3f} {sign} {delta:.3f} | test {result}'
def get_test_result(value, delta) -> object:
return ['<', 'passed 👌'] if value < delta else ['>=', 'failed 😭']
def format_test_result(value, delta, k: object | None=None) -> object:
template = TEST_TEMPLATE... | 1 | 2 | 0 | 0 | 3 | 0 |
torchbench/image_generation/utils.py | xperience-ai/torchbench | 143 | 1780087 | <filename>torchbench/image_generation/utils.py
import numpy as np
from scipy import linalg
from scipy.stats import entropy
import torch
import torch.utils.data
from torch import nn
from torch.autograd import Variable
from torch.nn import functional as F
from torchvision.models.inception import inception_v3
class FIDI... | 0 | 0 | 0 | 0 | 0 | 0 |
corehq/motech/repeaters/const.py | omari-funzone/commcare-hq | 471 | 1780089 | <reponame>omari-funzone/commcare-hq
from datetime import timedelta
from django.utils.translation import gettext_lazy as _
MAX_RETRY_WAIT = timedelta(days=7)
MIN_RETRY_WAIT = timedelta(minutes=60)
CHECK_REPEATERS_INTERVAL = timedelta(minutes=5)
CHECK_REPEATERS_KEY = 'check-repeaters-key'
# Number of attempts to an onli... | 0 | 0 | 0 | 0 | 0 | 0 |
esphome/components/modbus_controller/__init__.py | OttoWinter/esphomeyaml | 249 | 1780176 | <filename>esphome/components/modbus_controller/__init__.py
import binascii
import esphome.codegen as cg
import esphome.config_validation as cv
from esphome.components import modbus
from esphome.const import CONF_ADDRESS, CONF_ID, CONF_NAME, CONF_LAMBDA, CONF_OFFSET
from esphome.cpp_helpers import logging
from .const im... | 0 | 0 | 0 | 0 | 0 | 0 |
RecoMuon/TransientTrackingRecHit/python/MuonTransientTrackingRecHitBuilder_cfi.py | ckamtsikis/cmssw | 852 | 1780218 | import FWCore.ParameterSet.Config as cms
MuonTransientTrackingRecHitBuilderESProducer = cms.ESProducer("MuonTransientTrackingRecHitBuilderESProducer",
ComponentName = cms.string('MuonRecHitBuilder')
)
| 0 | 0 | 0 | 0 | 0 | 0 |
tests/regression/iql/test_iql_online.py | drib861204/rlkit | 1,662 | 1780225 | <gh_stars>1000+
import os
import sys
from examples.iql import mujoco_finetune as iql
from rlkit.core import logger
from rlkit.testing import csv_util
def test_iql():
logger.reset()
# make tests small by mutating variant
iql.variant["algo_kwargs"]["start_epoch"] = -2
iql.variant["algo_kwargs"]["num_e... | 0 | 0 | 0 | 0 | 0 | 0 |
kuryr/tests/unit/segmentation_type_drivers/test_vlan.py | openstack/kuryr | 207 | 1780251 | # Copyright 2017 Red Hat, 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, ... | 0 | 0 | 0 | 0 | 0 | 0 |
pythainlp/soundex/core.py | Gorlph/pythainlp | 569 | 1780287 | # -*- coding: utf-8 -*-
"""
Thai soundex
Has three systems to choose from: Udom83 (default), LK82, and MetaSound
"""
from pythainlp.soundex.lk82 import lk82
from pythainlp.soundex.metasound import metasound
from pythainlp.soundex.udom83 import udom83
from pythainlp.soundex import DEFAULT_SOUNDEX_ENGINE
# Other Thai s... | 2 | 1 | 0 | 0 | 3 | 0 |
thirdparty/cogapp/cogapp/makefiles.py | hughperkins/cpptemplater | 167 | 1780305 | """ Dictionary-to-filetree functions, to create test files for testing.
http://nedbatchelder.com/code/cog
Copyright 2004-2012, <NAME>.
"""
from __future__ import absolute_import
import os.path
from .whiteutils import reindentBlock
from .backward import string_types, bytes_types
__version__ = '1.0.20040126'
_... | 2 | 0 | 0 | 0 | 2 | 0 |
src/reader/_plugins/global_metadata.py | lemon24/reader | 205 | 1780316 | <reponame>lemon24/reader
"""
global_metadata
~~~~~~~~~~~~~~~
.. module:: reader
:noindex:
As of reader 2.7, only feeds can have metadata attached.
However, global metadata can be simulated
by using a fake feed with updates disabled.
This plugin adds global metadata methods
analogous to the feed metadata ones::
... | 0 | 0 | 0 | 0 | 0 | 0 |
sketchgraphs_models/graph/train/harness.py | applied-exploration/contraint-based-parametric-modelling | 204 | 1780326 | <reponame>applied-exploration/contraint-based-parametric-modelling
"""This module contains the main training harness for training graph models. """
import collections
import itertools
import os
import pickle
import numpy as np
import torch
from sketchgraphs_models import training
from sketchgraphs_models.graph impor... | 0 | 0 | 0 | 0 | 0 | 0 |
solutions/problem_165.py | ksvr444/daily-coding-problem | 1,921 | 1780358 | def get_smaller_right(arr) -> object:
smaller_right_arr = list()
for i in range(len(arr)):
smaller_count = 0
for j in range(i + 1, len(arr)):
if arr[j] < arr[i]:
smaller_count += 1
smaller_right_arr.append(smaller_count)
return smaller_right_arr
# Tests... | 0 | 1 | 0 | 0 | 1 | 0 |
modules/auxiliary/gather/mikrotik_winbox_fileread.py | OsmanDere/metasploit-framework | 26,932 | 1780363 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# standard modules
import logging
# extra modules
dependencies_missing = False
try:
import socket
import sys
import hashlib
except ImportError:
dependencies_missing = True
from metasploit import module
metadata = {
'name': 'Mikrotik Winbox Arbitrary... | 0 | 4 | 0 | 0 | 4 | 0 |
django_mfa/forms.py | juwaini/django-mfa | 172 | 1780382 | import json
from django import forms
from django.utils import timezone
from u2flib_server import u2f
class SecondFactorForm(forms.Form):
def __init__(self, *args, **kwargs) -> object:
self.user = kwargs.pop('user')
self.request = kwargs.pop('request')
self.appId = kwargs.pop('appId')
... | 0 | 2 | 0 | 0 | 2 | 0 |
houdini/python3.7libs/nodegraphhooks.py | Hengle/Houdini-Toolbox | 136 | 1780394 | """Custom network editor event handlers."""
# ==============================================================================
# IMPORTS
# ==============================================================================
from __future__ import annotations
# Standard Library
from typing import List, Tuple
# Houdini Toolb... | 2 | 1 | 0 | 0 | 3 | 0 |
sdk/python/pulumi_gcp/kms/secret_ciphertext.py | sisisin/pulumi-gcp | 121 | 1780401 | # coding=utf-8
# *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
from __future__ import annotations
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Seque... | 37 | 12 | 0 | 0 | 49 | 0 |
wouso/core/magic/utils.py | ruxandraS/wouso | 117 | 1780415 | <filename>wouso/core/magic/utils.py
from wouso.core.magic.models import ArtifactGroup
def setup_magic():
# Default artifact group
default_group = ArtifactGroup.objects.get_or_create(name='Default')[0]
| 0 | 0 | 0 | 0 | 0 | 0 |
RecoEcal/EgammaCoreTools/python/EcalMustacheSCParametersESProducer_cfi.py | ckamtsikis/cmssw | 852 | 1780422 | import FWCore.ParameterSet.Config as cms
ecalMustacheSCParametersESProducer = cms.ESProducer("EcalMustacheSCParametersESProducer",
sqrtLogClustETuning = cms.double(1.1),
# Parameters from the analysis by <NAME> [https://indico.cern.ch/event/949294/contributions/3988389/attachments/2091573/3514649/2020_08_26_C... | 0 | 0 | 0 | 0 | 0 | 0 |
examples/trivial/command_line_pb2_grpc.py | psiemens/grpcio-opentracing | 441 | 1780424 | <reponame>psiemens/grpcio-opentracing
# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
import grpc
from grpc.framework.common import cardinality
from grpc.framework.interfaces.face import utilities as face_utilities
import command_line_pb2 as command__line__pb2
class CommandLineStub(object):
... | 0 | 0 | 0 | 0 | 0 | 0 |
netapp.py | mkevenaar/SysAdminBoard | 293 | 1780426 | <filename>netapp.py<gh_stars>100-1000
#!/usr/bin/env python
"""
netapp - Uses the NetApp RestAPI to access NetApp data.
Docs: https://library.netapp.com/ecmdocs/ECMLP2856304/html/index.html
Examples: https://github.com/NetApp/ontap-rest-python/tree/master/examples/rest_api
"""
import json
import time
import logging... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/executors.py | aquamatthias/python-arango | 389 | 1780435 | <reponame>aquamatthias/python-arango
import time
from arango.executor import AsyncApiExecutor, BatchApiExecutor, TransactionApiExecutor
from arango.job import BatchJob
class TestAsyncApiExecutor(AsyncApiExecutor):
def __init__(self, connection) -> None:
super().__init__(connection=connection, return_resu... | 0 | 0 | 0 | 0 | 0 | 0 |
vega/trainer/callbacks/ddp_torch.py | This-50m/vega | 724 | 1780496 | <gh_stars>100-1000
# -*- coding:utf-8 -*-
# Copyright (C) 2020. Huawei Technologies Co., Ltd. All rights reserved.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the MIT License.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/mdtslib/setup.py | xavileon/midonet | 221 | 1780516 | #!/usr/bin/env python
# Copyright (c) 2014 Midokura Europe SARL, 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
#
# U... | 0 | 2 | 0 | 0 | 2 | 0 |
car/scripts/SoundServer.py | GNSS523/Cherry-Autonomous-Racecar | 330 | 1780541 | #! /usr/bin/python
# Author: <NAME>
# Date Created: Feb. 16, 2014
# Updated: December 20, 2016
# Note: This version was created for <NAME>
"""
Dependencies:
sudo apt-get install python-pygame
sudo apt-get install festlex-cmu
sudo apt-get install ubuntu-restricted-extras
sudo dpkg-reconfigure libdvd-pkg
# restart comp... | 0 | 0 | 0 | 0 | 0 | 0 |
setup.py | q710245300/GenerativeAdversarialUserModel | 120 | 1780559 | <gh_stars>100-1000
from setuptools import setup
import os
BASEPATH = os.path.dirname(os.path.abspath(__file__))
setup(name='ganrl',
py_modules=['ganrl'],
install_requires=[
'tensorflow'
],
)
| 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.