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
apps/cancer_drug_response/data_gen.py
agave233/PaddleHelix
454
12700237
# Copyright (c) 2021 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by app...
pyflux/gpnarx/gpnarx.py
ThomasHoppe/pyflux
2,091
12700243
import sys if sys.version_info < (3,): range = xrange import numpy as np import pandas as pd import scipy.linalg as la import scipy.sparse as sp import scipy.stats as ss from scipy.stats import multivariate_normal from .. import arma from .. import output as op from .. import tests as tst from .. import tsm as ts...
tests/tracer/test_context.py
melancholy/dd-trace-py
308
12700249
import pytest from ddtrace.context import Context from ddtrace.span import Span @pytest.mark.parametrize( "ctx1,ctx2", [ (Context(), Context()), (Context(trace_id=123), Context(trace_id=123)), ( Context(trace_id=123, span_id=321, dd_origin="synthetics", sampling_priority=2...
test/python/tests/test_primitives.py
bh107/bohrium
236
12700257
import numpy from bohrium_api import _info import util class test_bh_opcodes: def init(self): for op in _info.op.values(): if op["name"] not in ["identity"] and op['elementwise']: for type_sig in op["type_sig"]: yield (op, type_sig) @util.add_bh107_cmd ...
chats/migrations/0006_chatlog_coder.py
horacexd/clist
166
12700259
<gh_stars>100-1000 # Generated by Django 3.1.8 on 2021-05-23 17:07 from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('true_coders', '0034_auto_20210411_1726'), ('chats', '0005_auto_20210523_1700'), ] operat...
venv/lib/python3.8/site-packages/braintree/android_pay_card.py
sakthipriya-07/BuildingConstructionMaterialsSupply
182
12700287
import braintree from braintree.resource import Resource # NEXT_MAJOR_VERSION - rename to GooglePayCard class AndroidPayCard(Resource): """ A class representing Braintree Android Pay card objects. """ def __init__(self, gateway, attributes): Resource.__init__(self, gateway, attributes) ...
interpreter/code/integration.py
choosewhatulike/500lines
26,185
12700322
<reponame>choosewhatulike/500lines # A file to test if pyvm works from the command line. def it_works(): print("Success!") it_works()
Contrib/TranslationToolkit/Convert_Language.py
buckmelanoma/MediaInfo
743
12700347
<filename>Contrib/TranslationToolkit/Convert_Language.py # Type: Python 3 script # Author: <NAME> <<EMAIL>> # Date: Feb 28, 2020 # Notes: Put "Language.csv" in this folder and run the script. # It generates "Language_parsed.csv" for translation. # Download the latest file from "MediaInfo/Source/Res...
kpm/commands/deploy.py
ericchiang/kpm
121
12700360
import kpm.platforms.kubernetes import kpm.formats from kpm.commands.command_base import CommandBase, LoadVariables class DeployCmd(CommandBase): name = 'deploy' help_message = "deploy a package on kubernetes" def __init__(self, options): super(DeployCmd, self).__init__(options) self.pack...
bsp/TC264D/PikaScript/main.py
GorgonMeducer/pikascript
228
12700391
import PikaStdLib print('hello PikaScript @TC264')
recipes/Python/52564_Curried_functions/recipe-52564.py
tdiprima/code
2,023
12700402
CO_VARARGS = 0x0004 CO_VARKEYWORDS = 0x0008 class Curry: def __init__(self, f): self.hasv = f.func_code.co_flags & CO_VARARGS self.hask = f.func_code.co_flags & CO_VARKEYWORDS self.defaults = f.func_defaults or () self.defnum = len(self.defaults) self.f = f self.argnum = f....
djangosige/apps/vendas/migrations/0001_initial.py
CTECHSUL/SG
330
12700407
<gh_stars>100-1000 # -*- coding: utf-8 -*- # Generated by Django 1.10.1 on 2017-06-25 17:50 from __future__ import unicode_literals from decimal import Decimal import django.core.validators from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): initial =...
src/tools/nuscenes-devkit/eval/tracking/mot.py
jie311/TraDeS
1,284
12700414
<reponame>jie311/TraDeS<filename>src/tools/nuscenes-devkit/eval/tracking/mot.py """ nuScenes dev-kit. Code written by <NAME>, <NAME> and <NAME>, 2019. This code is based on: py-motmetrics at: https://github.com/cheind/py-motmetrics """ from collections import OrderedDict from itertools import count import motmetrics...
tools/telemetry/telemetry/core/backends/chrome/websocket_unittest.py
iplo/Chain
231
12700419
<gh_stars>100-1000 # Copyright 2013 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. import socket import unittest from telemetry.core.backends.chrome import websocket class TestWebSocket(unittest.TestCase): def testExpo...
terrascript/resource/NetApp/netapp_cloudmanager.py
mjuenema/python-terrascript
507
12700424
# terrascript/resource/NetApp/netapp_cloudmanager.py # Automatically generated by tools/makecode.py (24-Sep-2021 15:22:08 UTC) import terrascript class netapp_cloudmanager_aggregate(terrascript.Resource): pass class netapp_cloudmanager_anf_volume(terrascript.Resource): pass class netapp_cloudmanager_aws_f...
ssseg/modules/models/backbones/fastscnn.py
zhizhangxian/sssegmentation
411
12700443
''' Function: Implementation of FastSCNN Author: <NAME> ''' import os import torch import torch.nn as nn import torch.nn.functional as F import torch.utils.model_zoo as model_zoo from .bricks import BuildNormalization, BuildActivation, DepthwiseSeparableConv2d, InvertedResidual '''model urls''' model_urls = {...
examples/plugins/js-beautify-1.7.5/python/cssbeautifier/__init__.py
ErMandeep/keditor
676
12700454
<filename>examples/plugins/js-beautify-1.7.5/python/cssbeautifier/__init__.py # # The MIT License (MIT) # Copyright (c) 2007-2017 <NAME>, <NAME>, and contributors. # Permission is hereby granted, free of charge, to any person # obtaining a copy of this software and associated documentation files # (the "Software"), t...
examples/tutorials/lesson3/dqn/algorithm.py
jkren6/PARL
3,172
12700458
<filename>examples/tutorials/lesson3/dqn/algorithm.py<gh_stars>1000+ # 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 # # ...
forge/blade/hook/__init__.py
jarbus/neural-mmo
1,450
12700476
<reponame>jarbus/neural-mmo<gh_stars>1000+ from .modules import modules
pyhealth/utils/utility.py
pyvonpyton/PyHealth
485
12700505
# -*- coding: utf-8 -*- """A set of utility functions to support outlier detection. """ # Author: <NAME> <<EMAIL>> # License: BSD 2 clause from __future__ import division from __future__ import print_function import os import numpy as np import pandas as pd from numpy import percentile import numbers import sklearn ...
examples/kde/kde_example_1d.py
michaelnowotny/cocos
101
12700518
<filename>examples/kde/kde_example_1d.py from contexttimer import Timer import matplotlib.pyplot as plt import numpy as np import scipy.stats as ss import cocos.numerics as cn import cocos.device as cd from cocos.scientific.kde import gaussian_kde n = 10000 # number of data points grid_size = n+1 # number of points...
toolbox/pcl_library.py
zekunhao1995/DualSDF
107
12700531
import numpy as np def calc_area(vertex): vec_a = vertex[:,1] - vertex[:,0] vec_b = vertex[:,2] - vertex[:,0] normal = np.cross(vec_a, vec_b) area = np.absolute(np.linalg.norm(normal, ord=2, axis=1))*0.5 return area def uniform_sample_on_triangle(triangle): while True: rn = np.random.r...
distribute/distributed_server.py
bupticybee/icyChessZero
272
12700532
import tornado.ioloop import tornado.web import argparse import os import sys currentpath = os.path.dirname(os.path.realpath(__file__)) project_basedir = os.path.join(currentpath,'..') sys.path.append(project_basedir) from config import conf datadir = conf.distributed_datadir parser = argparse.ArgumentParser(descrip...
tests/terraform/checks/resource/azure/test_SynapseWorkspaceEnablesManagedVirtualNetworks.py
jamesholland-uk/checkov
4,013
12700553
<reponame>jamesholland-uk/checkov import unittest import hcl2 from checkov.terraform.checks.resource.azure.SynapseWorkspaceEnablesManagedVirtualNetworks import check from checkov.common.models.enums import CheckResult class TestSynapseWorkspaceEnablesManagedVirtualNetworks(unittest.TestCase): def test_failure_...
tests/layer_tests/tensorflow_tests/test_tf_ELU.py
monroid/openvino
2,406
12700558
# Copyright (C) 2018-2021 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import pytest from common.layer_test_class import check_ir_version from common.tf_layer_test_class import CommonTFLayerTest from unit_tests.utils.graph import build_graph class TestELU(CommonTFLayerTest): def create_elu_net(self, s...
parsimonious/tests/test_nodes.py
andreabenini/parsimonious
1,253
12700578
# -*- coding: utf-8 -*- from nose import SkipTest from nose.tools import eq_, ok_, assert_raises, assert_in from parsimonious import Grammar, NodeVisitor, VisitationError, rule from parsimonious.expressions import Literal from parsimonious.nodes import Node class HtmlFormatter(NodeVisitor): """Visitor that turns...
TauAnalysis/MCEmbeddingTools/python/DYToMuMuGenFilter_cfi.py
ckamtsikis/cmssw
852
12700608
<filename>TauAnalysis/MCEmbeddingTools/python/DYToMuMuGenFilter_cfi.py import FWCore.ParameterSet.Config as cms dYToMuMuGenFilter = cms.EDFilter("DYToMuMuGenFilter", inputTag = cms.InputTag("prunedGenParticles"))
models/vision/detection/awsdet/utils/image/transforms/__init__.py
piyushghai/deep-learning-models
129
12700615
# Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. # SPDX-License-Identifier: Apache-2.0 # -*- coding: utf-8 -*- from .colorspace import (bgr2gray, bgr2hls, bgr2hsv, bgr2rgb, gray2bgr, gray2rgb, hls2bgr, hsv2bgr, iminvert, posterize, rgb2bgr, rgb2...
python-sdk/nuimages/utils/test_nuimages.py
bjajoh/nuscenes-devkit
1,284
12700628
# nuScenes dev-kit. # Code written by <NAME>, 2020. import os import unittest from nuimages import NuImages class TestNuImages(unittest.TestCase): def test_load(self): """ Loads up NuImages. This is intended to simply run the NuImages class to check for import errors, typos, etc. ...
deer/agent.py
jhardy0/deer
373
12700635
""" This module contains classes used to define the standard behavior of the agent. It relies on the controllers, the chosen training/test policy and the learning algorithm to specify its behavior in the environment. """ import os import numpy as np import copy import sys import joblib from warnings import warn fro...
packages/pegasus-python/src/Pegasus/service/ensembles/views.py
ahnitz/pegasus
127
12700644
import json import logging import os import re import subprocess from pathlib import Path from flask import g, make_response, request, url_for from Pegasus.db import connection from Pegasus.db.ensembles import ( EMError, Ensembles, EnsembleWorkflowStates, Triggers, TriggerType, ) from Pegasus.serv...
Alignment/APEEstimation/test/apeTreeCreateDefault_cfg.py
ckamtsikis/cmssw
852
12700661
<reponame>ckamtsikis/cmssw ######################################################################## ### ### Read out APEs from .db files and convert them to trees ### that can be read by the APE validation plot tools. ### ### Intended to provide a straightforward comparison of ### ...
samples/openapi3/server/petstore/python-flask-python2/openapi_server/models/upload_form.py
MalcolmScoffable/openapi-generator
11,868
12700673
<gh_stars>1000+ # coding: utf-8 from __future__ import absolute_import from datetime import date, datetime # noqa: F401 from typing import List, Dict # noqa: F401 from openapi_server.models.base_model_ import Model from openapi_server import util class UploadForm(Model): """NOTE: This class is auto generated...
test/kernel/integration/grub/test.py
jaeh/IncludeOS
3,673
12700731
<reponame>jaeh/IncludeOS #!/usr/bin/env python3 from builtins import str import sys import os import subprocess from vmrunner import vmrunner vm = vmrunner.vms[0]; if len(sys.argv) == 1: # Build, run and clean vm.cmake() # Cmake changes to build dir os.chdir("..") # Use grubify-script grubify = "g...
gallery/seismic/convolutional_model.py
XuesongDing/fatiando
179
12700743
<filename>gallery/seismic/convolutional_model.py<gh_stars>100-1000 r""" Synthetic seismograms using the convolutional model --------------------------------------------------- The simplest way to get a seismogram (in time x offset) is through the convolutional model .. math:: trace(t) = wavelet(t) \ast reflectiv...
tests/simple_page/test_link.py
kejkz/webium
152
12700768
from nose.tools import eq_ from tests import get_url from tests.simple_page import SimplePageTest class TestClick(SimplePageTest): def test_link(self): eq_(self.page.icon_link.get_href(), get_url('icon.gif'))
examples/api/python/quickstart.py
zyedidia/boolector
209
12700774
<filename>examples/api/python/quickstart.py import os import pyboolector from pyboolector import Boolector, BoolectorException if __name__ == "__main__": try: # Create Boolector instance btor = Boolector() # Enable model generation btor.Set_opt(pyboolector.BTOR_OPT_MODEL_GEN, True) ...
tests/unittests/test_dataloader.py
mj-kh/speechbrain
3,913
12700786
import torch import pytest def test_saveable_dataloader(tmpdir, device): from speechbrain.dataio.dataloader import SaveableDataLoader save_file = tmpdir + "/dataloader.ckpt" dataset = torch.randn(10, 1, device=device) dataloader = SaveableDataLoader(dataset, collate_fn=None) data_iterator = iter(...
flack/api/messages.py
Pythonian/flack
533
12700796
from flask import request, abort, jsonify, g from .. import db from ..auth import token_auth, token_optional_auth from ..models import Message from ..utils import timestamp, url_for from ..tasks import async_task from . import api @api.route('/messages', methods=['POST']) @token_auth.login_required @async_task def n...
tests/core/test_run_files.py
Mattlk13/dd-agent
1,172
12700805
<reponame>Mattlk13/dd-agent # stdlib import os import unittest # 3p import mock # project from checks.check_status import AgentStatus class TestRunFiles(unittest.TestCase): """ Tests that runfiles (.pid, .sock, .pickle etc.) are written to internal agent folders""" # Mac run directory expected location ...
pdaugment/midi_preprocess/steps/filter_and_merge.py
hongwen-sun/muzic
1,903
12700819
import os import subprocess from multiprocessing.pool import Pool import miditoolkit import pandas as pd import pretty_midi from tqdm import tqdm import numpy as np import pickle from copy import deepcopy from midi_preprocess.utils.hparams import hparams import midi_preprocess.steps.track_separate as tc def filter_...
challenge_4/python/bryantpq/tree.py
rchicoli/2017-challenges
271
12700832
<filename>challenge_4/python/bryantpq/tree.py class Node: def __init__(self, value): self.value = value self.l = None self.r = None class BinaryTree: def __init__(self): self.root = None def draw(self): '''Prints a preorder traversal of the tree''' self._dra...
tests/test_guard.py
tjensen/steam
727
12700853
<gh_stars>100-1000 import unittest import mock from steam import guard as g class TCguard(unittest.TestCase): def test_generate_twofactor_code_for_time(self): code = g.generate_twofactor_code_for_time(b'superdupersecret', timestamp=3000030) self.assertEqual(code, 'YRGQJ') code = g.generat...
tools/face/vis_html_det.py
AruniRC/detectron-self-train
128
12700870
mport os.path as osp from html4vision import Col, imagetable # table description cols = [ Col('id1', 'ID'), # make a column of 1-based indices Col('img', 'vgg16', 'det_vgg16_Flickr_vis-0.70/*.jpg'), # specify image content for column 2 ] imagetable(cols, outfile='det_vgg16_Flickr_vis-0.70.html', title='Flic...
tests/nlu_core_tests/component_tests/classifier_tests/question_tests.py
milyiyo/nlu
480
12700880
<filename>tests/nlu_core_tests/component_tests/classifier_tests/question_tests.py import unittest from nlu import * class TestQuestions(unittest.TestCase): def test_questions_model(self): pipe = nlu.load('questions',verbose=True) data = ['I love pancaces. I hate Mondays', 'I love Fridays'] ...
contrib/linux/actions/dig.py
momokuri-3/st2
4,920
12700895
#! /usr/bin/python # Copyright 2020 The StackStorm Authors. # Copyright 2019 Extreme Networks, 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/LIC...
tests/autoscaling/test_pause_service_autoscaler.py
sobolevn/paasta
1,711
12700901
import mock import paasta_tools.paastaapi.models as paastamodels from paasta_tools.autoscaling.pause_service_autoscaler import ( delete_service_autoscale_pause_time, ) from paasta_tools.autoscaling.pause_service_autoscaler import ( get_service_autoscale_pause_time, ) from paasta_tools.autoscaling.pause_service...
ConvKB/train.py
MedyG/kg-reeval
104
12700908
import tensorflow as tf import numpy as np np.random.seed(1234) import os import time import datetime from argparse import ArgumentParser, ArgumentDefaultsHelpFormatter from builddata import * from model import ConvKB # Parameters # ================================================== parser = ArgumentParser("ConvKB", ...
aztk/spark/models/plugins/hdfs/configuration.py
Geims83/aztk
161
12700948
import os from aztk.models.plugins.plugin_configuration import PluginConfiguration, PluginPort, PluginTargetRole from aztk.models.plugins.plugin_file import PluginFile dir_path = os.path.dirname(os.path.realpath(__file__)) class HDFSPlugin(PluginConfiguration): def __init__(self): super().__init__( ...
config/config.py
LegionChang/CoTNet
360
12700976
<gh_stars>100-1000 import os from yacs.config import CfgNode as CN from .constants import IMAGENET_DEFAULT_MEAN, IMAGENET_DEFAULT_STD, DEFAULT_CROP_PCT _C = CN() _C.root_dir = os.getcwd() # root dir _C.seed = -1.0 # random seed (default: 42) _C.logger_name = ...
tests/test_sampling/test_graph_samplers.py
Rodrigo-A-Pereira/pykeen
750
12700987
<gh_stars>100-1000 # -*- coding: utf-8 -*- """Tests for graph samplers.""" import unittest import torch from pykeen.datasets import Nations from pykeen.training.schlichtkrull_sampler import GraphSampler, _compute_compressed_adjacency_list class GraphSamplerTest(unittest.TestCase): """Test the GraphSampler."""...
mlcomp/migration/versions/009_dag_tag.py
lightforever/kaggler
166
12701015
from migrate import ForeignKeyConstraint from sqlalchemy import Table, Column, MetaData, String, Integer meta = MetaData() table = Table( 'dag_tag', meta, Column('dag', Integer, primary_key=True), Column('tag', String(100), primary_key=True), ) def upgrade(migrate_engine): conn = migrate_engine.conn...
src/base/environment.py
AbhinavGopal/ts_tutorial
290
12701037
""" Environment determines the underlying law of the system. All bandit problems should inherit from environment. """ import numpy as np ############################################################################## class Environment(object): """Base class for all bandit environments.""" def __init__(self): ...
scripts/init_markdown.py
xofolowski/atc-react
366
12701044
<filename>scripts/init_markdown.py #!/usr/bin/env python3 try: from scripts.reactutils import REACTutils except: from response.atc_react.scripts.reactutils import REACTutils from pathlib import Path def react_create_markdown_dirs(): REACTConfig = REACTutils.load_config('config.yml') base_dir = Path(...
tutorials/W3D2_HiddenDynamics/solutions/W3D2_Tutorial2_Solution_76573dcd.py
eduardojdiniz/CompNeuro
2,294
12701064
<gh_stars>1000+ def create_HMM(switch_prob=0.1, noise_level=1e-1, startprob=[1.0, 0.0]): """Create an HMM with binary state variable and 1D Gaussian measurements The probability to switch to the other state is `switch_prob`. Two measurement models have mean 1.0 and -1.0 respectively. `noise_level` specifies th...
contrib/marat/python/Residue.py
dinisAbranches/nwchem
317
12701083
<gh_stars>100-1000 ''' Created on Feb 5, 2012 @author: marat ''' import sys from ResAtom import * class Residue: ''' classdocs ''' def __init__(self,params={}): ''' Default constructor for Residue class atoms list of atoms in the residue name residue name ''' ...
common/nlp/roberta/utils.py
xiling42/VL-BERT
671
12701149
<filename>common/nlp/roberta/utils.py from __future__ import (absolute_import, division, print_function, unicode_literals) import sys import os try: from functools import lru_cache except ImportError: # Just a dummy decorator to get the checks to run on python2 # because honestly I...
tensorflow/contrib/data/python/ops/prefetching_ops.py
PaulWang1905/tensorflow
848
12701151
<reponame>PaulWang1905/tensorflow<gh_stars>100-1000 # Copyright 2017 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org...
lib/spack/external/py/_io/capture.py
kkauder/spack
2,479
12701179
import os import sys import py import tempfile try: from io import StringIO except ImportError: from StringIO import StringIO if sys.version_info < (3,0): class TextIO(StringIO): def write(self, data): if not isinstance(data, unicode): data = unicode(data, getattr(self,...
complexPyTorch/complexFunctions.py
jackhwalters/complexPyTorch
270
12701203
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ @author: spopoff """ from torch.nn.functional import relu, max_pool2d, avg_pool2d, dropout, dropout2d, interpolate, sigmoid, tanh import torch def complex_matmul(A, B): ''' Performs the matrix product between two complex matricess ''' outp_real ...
docs/conf.py
hbrodin/polytracker
304
12701206
<gh_stars>100-1000 # Configuration file for the Sphinx documentation builder. # # This file only contains a selection of the most common options. For a full # list see the documentation: # https://www.sphinx-doc.org/en/master/usage/configuration.html # -- Path setup ----------------------------------------------------...
src/modules/catalog/module.py
Ermlab/python-ddd
308
12701216
from seedwork.application.modules import BusinessModule from .domain.repositories import ListingRepository from modules.catalog.application.query.get_all_listings import ( GetAllListings, get_all_listings, ) from modules.catalog.application.query.get_listings_of_seller import ( GetListingsOfSeller, g...
fedot/sensitivity/pipeline_sensitivity.py
rozlana-g/FEDOT
358
12701231
import json from os.path import join from typing import List, Type, Optional from fedot.core.data.data import InputData from fedot.core.log import Log, default_log from fedot.core.pipelines.pipeline import Pipeline from fedot.core.utils import default_fedot_data_dir from fedot.sensitivity.operations_hp_sensitivity.mul...
examples/particles.py
DrewMQ/pygame_tutorials
544
12701256
# Particles for pygame # by KidsCanCode 2015 # For educational purposes only import pygame import random # TODO: particle rotations # TODO: test with varied particle images # TODO: more particle paths def interpolate(v1, v2, range): return pygame.math.Vector2(v1.x + (v2.x - v1.x) * range, ...
Anacoref/py/extract_anaphora.py
Koziev/NLP_Datasets
257
12701259
<reponame>Koziev/NLP_Datasets<filename>Anacoref/py/extract_anaphora.py """ Парсинг датасетов из соревнования Rucoref-2015 (раскрытие анафоры и пр.) Описание исходного датасета и задачи http://www.dialog-21.ru/evaluation/2014/anaphora/ """ import io import os import pandas as pd import csv rucoref_folder = '../../../d...
src/fava/serialisation.py
psimonyi/fava
1,224
12701264
<gh_stars>1000+ """(De)serialisation of entries. When adding entries, these are saved via the JSON API - using the functionality of this module to obtain the appropriate data structures from `beancount.core.data`. Similarly, for the full entry completion, a JSON representation of the entry is provided. This is not in...
dl/dl-python/ipython_config.py
ReDeiPirati/dockerfiles
168
12701297
<filename>dl/dl-python/ipython_config.py # Configuration file for ipython. #------------------------------------------------------------------------------ # InteractiveShellApp(Configurable) configuration #------------------------------------------------------------------------------ ## lines of code to run at IPytho...
OnlineStudy/rbac/middlewares/rbac.py
NanRenTeam-9/MongoMicroCourse
132
12701325
#! /usr/bin/env python # -*- coding:utf-8 -*- import re from django.utils.deprecation import MiddlewareMixin from django.conf import settings from django.shortcuts import HttpResponse class RbacMiddleware(MiddlewareMixin): def process_request(self, request): current_url = request.path_info # 白名单...
tests/test_tensor/test_hybrid_device.py
hpcaitech/ColossalAI
1,630
12701389
<filename>tests/test_tensor/test_hybrid_device.py<gh_stars>1000+ from colossalai.utils import free_port, get_current_device from colossalai.utils.model.colo_init_context import ColoInitContext from colossalai.testing import rerun_if_address_is_in_use from colossalai.tensor import ComputePattern, ParallelAction from fu...
train.py
mikito0011/Chainer_Mask_R-CNN
153
12701394
import chainer from chainer import training from chainer.training import extensions, ParallelUpdater from chainer.training.triggers import ManualScheduleTrigger from chainer.datasets import TransformDataset from chainercv.datasets import VOCBboxDataset, voc_bbox_label_names from chainercv import transforms from ...
clearly/server/streaming_dispatcher.py
lowercase00/clearly
344
12701397
import logging import re import signal import threading from contextlib import contextmanager from enum import Enum from queue import Empty, Queue from typing import List, Optional, Pattern, Tuple, Union, Callable from ..protos.clearly_pb2 import PatternFilter, TaskMessage, WorkerMessage from ..utils.data import accep...
tests/test_3_mac_receive_jpg.py
fjolublar/imagezmq
823
12701435
"""test_3_mac_receive_jpg.py -- receive & display jpg stream. A simple test program that uses imagezmq to receive an image jpg stream from a Raspberry Pi and display it as a video steam. 1. Run this program in its own terminal window on the mac: python test_3_mac_receive_jpg.py This "receive and display images" prog...
siteroot/settings/dev.py
voidfun/linkding
1,312
12701450
<filename>siteroot/settings/dev.py """ Development settings for linkding webapp """ # Start from development settings # noinspection PyUnresolvedReferences from .base import * # Turn on debug mode DEBUG = True # Turn on SASS compilation SASS_PROCESSOR_ENABLED = True # Enable debug toolbar INSTALLED_APPS.append('debu...
services/ui_backend_service/api/flow.py
runsascoded/metaflow-service
103
12701451
<gh_stars>100-1000 from services.utils import handle_exceptions from .utils import find_records class FlowApi(object): def __init__(self, app, db): self.db = db app.router.add_route("GET", "/flows", self.get_all_flows) app.router.add_route("GET", "/flows/{flow_id}", self.get_flow) ...
conans/test/unittests/util/files/test_dirty.py
matthiasng/conan
6,205
12701469
# coding=utf-8 import os import unittest from conans.test.utils.test_files import temp_folder from conans.util.files import set_dirty, clean_dirty, set_dirty_context_manager, _DIRTY_FOLDER class DirtyTest(unittest.TestCase): def setUp(self): """ Create temporary folder to save dirty state """...
modoboa/policyd/handlers.py
HarshCasper/modoboa
1,602
12701497
"""App related signal handlers.""" import redis from django.conf import settings from django.db.models import signals from django.dispatch import receiver from modoboa.admin import models as admin_models from . import constants def set_message_limit(instance, key): """Store message limit in Redis.""" old_...
REDSI_1160929_1161573/boost_1_67_0/tools/build/test/railsys.py
Wultyc/ISEP_1718_2A2S_REDSI_TrabalhoGrupo
198
12701518
#!/usr/bin/python # Copyright 2003 <NAME> # Distributed under the Boost Software License, Version 1.0. # (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) import BoostBuild t = BoostBuild.Tester() t.set_tree("railsys") t.run_build_system("--v2", subdir="program") t.cleanu...
examples/pxScene2d/external/libnode-v6.9.0/deps/v8/tools/testrunner/server/presence_handler.py
madanagopaltcomcast/pxCore
5,964
12701539
# Copyright 2012 the V8 project authors. All rights reserved. # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are # met: # # * Redistributions of source code must retain the above copyright # notice, this list of conditi...
atcoder/agc001/a.py
Ashindustry007/competitive-programming
506
12701549
<reponame>Ashindustry007/competitive-programming #!/usr/bin/env python3 # https://agc001.contest.atcoder.jp/tasks/agc001_a n = int(input()) l = [int(x) for x in input().split()] l.sort() print(sum(l[::2]))
tests/functional/checkout/__init__.py
QueoLda/django-oscar
4,639
12701560
from decimal import Decimal as D from http import client as http_client from unittest import mock from django.urls import reverse from oscar.apps.shipping import methods from oscar.core.loading import get_class, get_classes, get_model from oscar.test import factories Basket = get_model('basket', 'Basket') Conditiona...
lib/aws/s3/admin.py
goztrk/django-htk
206
12701568
# Django Imports from django.contrib import admin class S3MediaAssetAdmin(admin.ModelAdmin): list_display = ( 'id', )
operational_analysis/toolkits/unit_conversion.py
NREL/wp3-precon
123
12701585
<gh_stars>100-1000 """ This module provides basic methods for unit conversion and calculation of basic wind plant variables """ def convert_power_to_energy(power_col, sample_rate_min="10T"): """ Compute energy [kWh] from power [kw] and return the data column Args: df(:obj:`pandas.DataFrame`): the...
tests/resolution/check/test_check_dns_server_ipv6_error.py
janiversen/supervisor
597
12701606
"""Test check DNS Servers for IPv6 errors.""" from unittest.mock import AsyncMock, call, patch from aiodns.error import DNSError import pytest from supervisor.const import CoreState from supervisor.coresys import CoreSys from supervisor.resolution.checks.dns_server_ipv6_error import CheckDNSServerIPv6Errors from supe...
fix_old_file_list.py
hexahedria/gated-graph-transformer-network
160
12701613
import pickle import os import argparse import sys def main(task_dir, dry_run=False): with open(os.path.join(task_dir,'file_list.p'),'rb') as f: bucketed = pickle.load(f) if dry_run: print("Got {} (for example)".format(bucketed[0][0])) bucketed = [['./bucket_' + x.split('bucket_')[1] for x ...
ssseg/modules/models/segmentors/gcnet/__init__.py
zhizhangxian/sssegmentation
411
12701664
'''initialize''' from .gcnet import GCNet from .contextblock import ContextBlock
evaluation/print_scores.py
sedrickkeh/dart
107
12701699
<gh_stars>100-1000 import statistics import sys if __name__ == '__main__': print('##################### Summary ##########################') with open('bleu.txt') as f: bleu = float(f.read().strip().split()[2].replace(',','')) print("BLEU: {:.2f}".format(bleu)) with open('meteor.txt') as f: ...
tests/utils/test_field_coverage.py
zanachka/spidermon
405
12701705
from spidermon.utils.field_coverage import calculate_field_coverage def test_calculate_field_coverage_from_stats(): spider_stats = { "finish_reason": "finished", "spidermon_item_scraped_count": 100, "spidermon_item_scraped_count/dict": 100, "spidermon_item_scraped_count/dict/author...
pixielib/models/FLAME.py
YuliangXiu/PIXIE
196
12701734
# -*- coding: utf-8 -*- # # Max-Planck-Gesellschaft zur Förderung der Wissenschaften e.V. (MPG) is # holder of all proprietary rights on this computer program. # Using this computer program means that you agree to the terms # in the LICENSE file included with this software distribution. # Any use not explicitly grant...
models/BERT/utils/__init__.py
hansheng0512/LateTemporalModeling3DCNN
144
12701765
<filename>models/BERT/utils/__init__.py from .feed_forward import PositionwiseFeedForward from .layer_norm import LayerNorm from .sublayer import * from .gelu import GELU
tests/test_linked.py
allanon/hyp
105
12701776
from hyp.schematics import Responder as SchematicsResponder from fixtures import ( PostResponder, PersonResponder, PostSerializer, ) class TestLinked(object): def test_single(self): author = {'id': 1, 'name': 'John'} comments = [ {'id': 1, 'content': 'My comment'}, ...
contrib/libs/python/gen_includes.py
ZhekehZ/catboost
6,989
12701821
import sys import os import errno from os import listdir from os.path import dirname, relpath, join def ensure_dir_exists(path): try: os.makedirs(path) except OSError as e: if e.errno == errno.EEXIST and os.path.isdir(path): pass else: raise def make_dir(direc...
.github/make_index.py
rafael-santiago/LIEF
2,999
12701863
<reponame>rafael-santiago/LIEF<filename>.github/make_index.py """ Build index from directory listing From: https://stackoverflow.com/questions/39048654/how-to-enable-directory-indexing-on-github-pages make_index.py </path/to/directory> """ INDEX_TEMPLATE = r""" <html> <title>Links for lief</title> <body> <h1>Links fo...
idaes/core/util/convergence/mpi_utils.py
carldlaird/idaes-pse
112
12701881
################################################################################# # The Institute for the Design of Advanced Energy Systems Integrated Platform # Framework (IDAES IP) was produced under the DOE Institute for the # Design of Advanced Energy Systems (IDAES), and is copyright (c) 2018-2021 # by the softwar...
terrascript/data/Trois_Six/sendgrid.py
mjuenema/python-terrascript
507
12701900
<gh_stars>100-1000 # terrascript/data/Trois-Six/sendgrid.py # Automatically generated by tools/makecode.py (24-Sep-2021 15:26:45 UTC) __all__ = []
nautobot/extras/tests/dummy_jobs/test_field_order.py
psmware-ltd/nautobot
384
12701911
from nautobot.extras.jobs import Job, FileVar, StringVar class TestFieldOrder(Job): """My job demo.""" var23 = StringVar(description="I want to be second") var2 = StringVar(description="Hello") var1 = FileVar(description="Some file wants to be first") class Meta: """Metaclass attrs."""...
tools/enasearch/generate_macros.py
ic4f/tools-iuc
142
12701950
#!/usr/bin/env python import enasearch spaces = ' ' operator_names = { "=": "equal", "!=": "different", "<": "lower", "<=": "equal or lower", ">": "higher", ">=": "equal or higher", } def format_name(name, alternative_name): """ Format name to remove None name and & in name ""...
py2app_tests/test_pkg_script.py
sorphin/py2app
193
12701956
<filename>py2app_tests/test_pkg_script.py """ Test case for a project that includes a script that has the same base-name as a package used by the script. """ import sys if (sys.version_info[0] == 2 and sys.version_info[:2] >= (2,7)) or \ (sys.version_info[0] == 3 and sys.version_info[:2] >= (3,2)): import u...
src/orion/algo/evolution_es.py
nurbal/orion
177
12701962
# -*- coding: utf-8 -*- """ The Evolved Transformer and large-scale evolution of image classifiers ====================================================================== Implement evolution to exploit configurations with fixed resource efficiently """ import copy import importlib import logging import numpy as np f...
furniture/env/models/grippers/__init__.py
KejiaChen/assembly
364
12701980
<filename>furniture/env/models/grippers/__init__.py from .gripper import Gripper from .gripper_factory import gripper_factory from .two_finger_gripper import TwoFingerGripper, LeftTwoFingerGripper from .pr2_gripper import PR2Gripper from .pushing_gripper import PushingGripper from .robotiq_gripper import RobotiqGripper...
section_10_(dictionaries)/dict_get.py
hlcooll/python_lessons
425
12702024
# If you're new to dictionaries, you might want to start with dict_access.py # We create a dictionary. contacts = { 'Shannon': '202-555-1234', 'Amy': '410-515-3000', 'Jen': '301-600-5555', 'Julie': '202-333-9876' } name = raw_input("Enter the name of the person whose phone number you want: ") print ...