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
Projects/Random_Quotes_Website/quotes/__init__.py
ieternalleo/AlgoCode
151
12696767
<gh_stars>100-1000 #This file may not be empty so i can easily upload it to github
wavetorch/operators.py
Kshitiz-Bansal/wavetorch
470
12696772
<filename>wavetorch/operators.py import torch from torch.nn.functional import conv2d def _laplacian(y, h): """Laplacian operator""" operator = h ** (-2) * torch.tensor([[[[0.0, 1.0, 0.0], [1.0, -4.0, 1.0], [0.0, 1.0, 0.0]]]]) y = y.unsqueeze(1) # y = pad(y,pad=(0,0,1,1), mode='circular') # y = pad...
applications/DEMApplication/tests/test_DEM_3D_contact.py
lkusch/Kratos
778
12696811
<filename>applications/DEMApplication/tests/test_DEM_3D_contact.py<gh_stars>100-1000 import os import KratosMultiphysics from KratosMultiphysics import Logger Logger.GetDefaultOutput().SetSeverity(Logger.Severity.WARNING) import KratosMultiphysics.DEMApplication as DEM import KratosMultiphysics.KratosUnittest as Kratos...
rx/core/operators/flatmap.py
mmpio/RxPY
4,342
12696840
<reponame>mmpio/RxPY<gh_stars>1000+ import collections from typing import Callable, Optional from rx import from_, from_future, operators as ops from rx.core import Observable from rx.core.typing import Mapper, MapperIndexed from rx.internal.utils import is_future def _flat_map_internal(source, mapper=None, mapper_i...
textclf/data/raw.py
lswjkllc/textclf
146
12696845
import os from tabulate import tabulate from textclf.data.dictionary import Dictionary, LabelDictionary from textclf.config import PreprocessConfig from textclf.utils.raw_data import ( tokenize_file, create_tokenizer, get_label_prob, build_label2id ) class TextClfRawData(object): """对数据进行预处理。分词、...
resources/enoki_gdb.py
njroussel/enoki
115
12696873
<gh_stars>100-1000 ############################################################################### # GDB Script to improve introspection of array types when debugging software # using Enoki. Copy this file to "~/.gdb" (creating the directory, if not # present) and then apppend the following line to the file "~/.gdbinit...
market_maker/utils/errors.py
mwithi/sample-market-maker
1,524
12696898
<gh_stars>1000+ class AuthenticationError(Exception): pass class MarketClosedError(Exception): pass class MarketEmptyError(Exception): pass
gdmix-trainer/src/gdmix/factory/driver_factory.py
Kostyansa/gdmix
130
12696926
import logging from gdmix.drivers.fixed_effect_driver import FixedEffectDriver from gdmix.drivers.random_effect_driver import RandomEffectDriver from gdmix.factory.model_factory import ModelFactory from gdmix.util import constants logger = logging.getLogger(__name__) logger.setLevel(logging.INFO) class DriverFactor...
tensor2tensor/models/video/basic_recurrent.py
jaseweir/tensor2tensor
12,921
12696955
<reponame>jaseweir/tensor2tensor<gh_stars>1000+ # coding=utf-8 # Copyright 2021 The Tensor2Tensor Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licens...
src/kubetop/_twistmain.py
TheoBrigitte/kubetop
154
12696959
<reponame>TheoBrigitte/kubetop<gh_stars>100-1000 # Copyright Least Authority Enterprises. # See LICENSE for details. """ Adapter from IServiceMaker-like interface to setuptools console-entrypoint interface. Premise ======= Given: * twist is the focus of efforts to make a good client-oriented command-line driver f...
h2o-py/tests/testdir_apis/Data_Manipulation/pyunit_h2oH2OFrame_max_mean_median_min_large.py
vishalbelsare/h2o-3
6,098
12696979
<reponame>vishalbelsare/h2o-3 from __future__ import print_function import sys sys.path.insert(1,"../../../") import h2o from tests import pyunit_utils from h2o.utils.typechecks import assert_is_type from random import randrange import numpy as np from h2o.frame import H2OFrame def h2o_H2OFrame_stats(): """ P...
3]. Competitive Programming/03]. HackerRank/1]. Practice/10]. 30 Days of Code/Python/Day_08.py
Utqrsh04/The-Complete-FAANG-Preparation
6,969
12696980
# 9th Solutions #-------------------------- n = int(input()) d = {} for i in range(n): x = input().split() d[x[0]] = x[1] while True: try: name = input() if name in d: print(name, '=', d[name], sep='') else: print('Not found') except: break
srunner/scenariomanager/actorcontrols/basic_control.py
aleallievi/scenario_runner
447
12697011
#!/usr/bin/env python # Copyright (c) 2020 Intel Corporation # # This work is licensed under the terms of the MIT license. # For a copy, see <https://opensource.org/licenses/MIT>. """ This module provides the base class for user-defined actor controllers. All user-defined controls must be derived from this class. A ...
libs/proxy_harvester.py
Mr-Anonymous002/InstaReport
109
12697024
# coding=utf-8 #!/usr/bin/env python3 import asyncio from proxybroker import Broker from requests import get from libs.utils import print_success from libs.utils import print_error from libs.utils import ask_question from libs.utils import print_status async def show(proxies, proxy_list): while (len...
data/migrations/test/test_db_config.py
giuseppe/quay
2,027
12697028
import pytest from mock import patch from data.runmigration import run_alembic_migration from alembic.script import ScriptDirectory from test.fixtures import * @pytest.mark.parametrize( "db_uri, is_valid", [ ("postgresql://devtable:password@quay-postgres/registry_database", True), ("postgresq...
src/python/responseTimeTests.py
neoremind/luceneutil
164
12697030
#!/usr/bin/env python # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to You under the Apache License, Version 2.0 # (the "Lice...
capstone/capdb/migrations/0090_auto_20200127_2030.py
rachelaus/capstone
134
12697065
<gh_stars>100-1000 # Generated by Django 2.2.9 on 2020-01-27 20:30 from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('capdb', '0089_auto_20200127_1957'), ] operations = [ migrations.RemoveField( model_name='casetext', name=...
laspy/vlrs/geotiff.py
CCInc/laspy
240
12697066
<gh_stars>100-1000 import logging from collections import namedtuple from typing import List, Optional from . import vlrlist from .known import GeoAsciiParamsVlr, GeoDoubleParamsVlr, GeoKeyDirectoryVlr GeoTiffKey = namedtuple("GeoTiffKey", ("id", "value")) logger = logging.getLogger(__name__) GTModelTypeGeoKey = 10...
bups/scheduler/systemd_user.py
emersion/bups
106
12697092
import ConfigParser import io import os base_dir = os.getenv("XDG_CONFIG_DIR", os.path.join(os.path.expanduser("~"), ".config")) config_dir = os.path.join(base_dir, "systemd/user") def is_available(): return any(os.access(os.path.join(path, "systemctl"), os.X_OK) for path in os.getenv("PATH").spl...
insights/parsers/secure.py
mglantz/insights-core
121
12697104
""" Secure - file ``/var/log/secure`` ================================== """ from .. import Syslog, parser from insights.specs import Specs @parser(Specs.secure) class Secure(Syslog): """Class for parsing the ``/var/log/secure`` file. Sample log text:: Aug 24 09:31:39 localhost polkitd[822]: Finish...
examples/pybullet/examples/getTextureUid.py
stolk/bullet3
158
12697145
import pybullet as p p.connect(p.GUI) plane = p.loadURDF("plane.urdf") visualData = p.getVisualShapeData(plane, p.VISUAL_SHAPE_DATA_TEXTURE_UNIQUE_IDS) print(visualData) curTexUid = visualData[0][8] print(curTexUid) texUid = p.loadTexture("tex256.png") print("texUid=", texUid) p.changeVisualShape(plane, -1, textureUni...
data/dataset.py
Alan-delete/I2L-MeshNet_RELEASE
544
12697147
import random import numpy as np from torch.utils.data.dataset import Dataset from config import cfg class MultipleDatasets(Dataset): def __init__(self, dbs, make_same_len=True): self.dbs = dbs self.db_num = len(self.dbs) self.max_db_data_num = max([len(db) for db in dbs]) self.db_l...
Lib/test/test_compiler/testcorpus/03_list_ex.py
diogommartins/cinder
1,886
12697149
[a, *b, *d, a, c]
covid_epidemiology/src/models/definitions/us_model_definitions_test.py
DionysisChristopoulos/google-research
23,901
12697154
<reponame>DionysisChristopoulos/google-research # coding=utf-8 # Copyright 2021 The Google Research Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/lice...
core/modules/lighttpd.py
HaonTshau/inpanel
166
12697167
<filename>core/modules/lighttpd.py<gh_stars>100-1000 # -*- coding: utf-8 -*- # # Copyright (c) 2017 - 2019, doudoudzj # All rights reserved. # # InPanel is distributed under the terms of the New BSD License. # The full license can be found in 'LICENSE'. """Module for Lighttpd configuration management.""" def web_res...
platypush/message/event/foursquare.py
RichardChiang/platypush
228
12697178
<gh_stars>100-1000 from typing import Dict, Any from platypush.message.event import Event class FoursquareCheckinEvent(Event): """ Event triggered when a new check-in occurs. """ def __init__(self, checkin: Dict[str, Any], *args, **kwargs): super().__init__(*args, checkin=checkin, **kwargs) ...
configs/baseline/faster_rcnn_r50_caffe_fpn_coco_partial_180k.py
huimlight/SoftTeacher
604
12697204
<filename>configs/baseline/faster_rcnn_r50_caffe_fpn_coco_partial_180k.py<gh_stars>100-1000 _base_ = "base.py" fold = 1 percent = 1 data = dict( samples_per_gpu=1, workers_per_gpu=1, train=dict( ann_file="data/coco/annotations/semi_supervised/instances_train2017.${fold}@${percent}.json", img...
python/cucim/src/cucim/core/operations/spatial/tests/test_rotate90.py
aasthajh/cucim
131
12697208
<reponame>aasthajh/cucim import os import cupy import numpy as np import pytest import skimage.data from PIL import Image import cucim.core.operations.spatial as spt def get_input_arr(): img = skimage.data.astronaut() arr = np.asarray(img) arr = np.transpose(arr) return arr def get_rotated_data():...
pycalphad/core/constraints.py
HUISUN24/pycalphad
162
12697215
<filename>pycalphad/core/constraints.py from pycalphad.core.constants import INTERNAL_CONSTRAINT_SCALING from pycalphad.codegen.sympydiff_utils import build_constraint_functions from collections import namedtuple ConstraintTuple = namedtuple('ConstraintTuple', ['internal_cons_func', 'internal_cons_jac', 'internal_cons...
cachebrowser/cli.py
zhenyihan/cachebrowser
1,206
12697222
<reponame>zhenyihan/cachebrowser<gh_stars>1000+ from functools import update_wrapper, partial import json import logging from cachebrowser.models import Host import click from cachebrowser.api.core import APIManager, APIRequest from cachebrowser.bootstrap import BootstrapError main_commands = ['hostcli', 'cdncli', '...
rllab/envs/mujoco/hill/walker2d_hill_env.py
RussellM2020/maml_gps
1,838
12697234
import numpy as np from rllab.envs.mujoco.hill.hill_env import HillEnv from rllab.envs.mujoco.walker2d_env import Walker2DEnv from rllab.misc.overrides import overrides import rllab.envs.mujoco.hill.terrain as terrain from rllab.spaces import Box class Walker2DHillEnv(HillEnv): MODEL_CLASS = Walker2DEnv ...
tests/python/twitter/common/contextutil/test_pushd.py
zhouyijiaren/commons
1,143
12697248
# ================================================================================================== # Copyright 2011 Twitter, Inc. # -------------------------------------------------------------------------------------------------- # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use thi...
examples/inprocess_qtconsole.py
KDAB/qtconsole
329
12697269
"""An example of embedding a RichJupyterWidget with an in-process kernel. We recommend using a kernel in a separate process as the normal option - see embed_qtconsole.py for more information. In-process kernels are not well supported. To run this example: python3 inprocess_qtconsole.py """ from qtpy import QtW...
lexos/receivers/tokenizer_receiver.py
WheatonCS/Lexos
107
12697271
<reponame>WheatonCS/Lexos """This is the receiver for the tokenizer model.""" from typing import NamedTuple, Optional from lexos.receivers.base_receiver import BaseReceiver class TokenizerOption(NamedTuple): """The typed tuple to hold tokenizer front end option.""" start: Optional[int] length: Optional[...
testing/test_standard.py
jweinraub/hippyvm
289
12697284
from testing.test_interpreter import BaseTestInterpreter class TestStandardModule(BaseTestInterpreter): def test_escapeshellarg(self): output = self.run(''' echo escapeshellarg("xyz"); echo escapeshellarg('$X'); echo escapeshellarg("'"); echo escapeshellarg("x'y\\"z"); ...
corehq/apps/hqwebapp/tests/test_custom_login_page.py
dimagilg/commcare-hq
471
12697333
from django.test import SimpleTestCase, override_settings from corehq.apps.hqwebapp.login_utils import get_custom_login_page class TestCustomLogin(SimpleTestCase): @override_settings(CUSTOM_LANDING_TEMPLATE=None) def test_nothing_configured(self): self.assertEqual(None, get_custom_login_page('exampl...
cape_privacy/coordinator/auth/api_token_test.py
vismaya-Kalaiselvan/cape-python
144
12697348
from cape_privacy.coordinator.auth.api_token import create_api_token def test_api_token(): token_id = "imatokenid" secret = "<KEY>" token = create_api_token(token_id, secret) assert token.token_id == token_id assert token.secret == bytes(secret, "utf-8") assert token.version == 1
tkinter/popup-menu-close/main.py
whitmans-max/python-examples
140
12697366
import tkinter as tk def hello(): print("hello!") def popup(event): menu.post(event.x_root, event.y_root) menu.focus() def popup_close(event): menu.unpost() root = tk.Tk() # frame frame = tk.Frame(root, width=512, height=512) frame.pack() # popup menu menu = tk.Menu(root, tearoff=0) menu.add...
DQM/CSCMonitorModule/python/test/csc_hlt_dqm_sourceclient-live.py
ckamtsikis/cmssw
852
12697370
import FWCore.ParameterSet.Config as cms process = cms.Process("CSC HLT DQM") #------------------------------------------------- # DQM Module Configuration #------------------------------------------------- process.load("DQM.CSCMonitorModule.csc_hlt_dqm_sourceclient_cfi") #---------------------------- # Event Sourc...
samples/client/wordnik-api/python/wordnik/models/AudioFile.py
OneSpan/swagger-codegen
133
12697378
#!/usr/bin/env python """ Copyright 2012 Wordnik, 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 applica...
db_migrate_manager.py
masonsxu/red-flask
161
12697393
# -*- coding: utf-8 -*- # @ Time : 2021/4/6 14:46 # @ Author : Redtree # @ File : db_manager # @ Desc : 单独将flask_migrate部分功能移出,不与flask_app本地IDE工具调试冲突。 from __init__ import manager manager.run() ''' 在工程根目录下,运行 python db_migrate_manager.py db init python db_migrate_manager.py db migrate python db_migrate_manage...
esmvaltool/cmorizers/obs/osi_common.py
cffbots/ESMValTool
148
12697418
<reponame>cffbots/ESMValTool<filename>esmvaltool/cmorizers/obs/osi_common.py """Common functionalities for OSI-450 dataset cmorization.""" import logging import os import glob from datetime import datetime, timedelta from calendar import monthrange, isleap import numpy as np import iris import iris.exceptions from ir...
tests/test_base_os.py
mattlemmone/elasticsearch-docker
866
12697467
<reponame>mattlemmone/elasticsearch-docker from .fixtures import elasticsearch def test_base_os(host): assert host.system_info.distribution == 'centos' assert host.system_info.release == '7' def test_no_core_files_exist_in_root(host): core_file_check_cmdline = 'ls -l /core*' assert host.run(core_fi...
wemake_python_styleguide/visitors/tokenize/comments.py
cdhiraj40/wemake-python-styleguide
1,931
12697480
r""" Disallows to use incorrect magic comments. That's how a basic ``comment`` type token looks like: .. code:: python TokenInfo( type=57 (COMMENT), string='# noqa: WPS100', start=(1, 4), end=(1, 16), line="u'' # noqa: WPS100\n", ) All comments have the same type. """...
sdk/storage/azure-storage-blob/tests/test_cpk_n.py
vincenttran-msft/azure-sdk-for-python
2,728
12697490
# coding: utf-8 # ------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for # license information. # --------------------------------------------------------------------...
examples/shapes_from_glsl/window.py
szabolcsdombi/zengl
116
12697511
<gh_stars>100-1000 import pyglet pyglet.options['shadow_window'] = False pyglet.options['debug_gl'] = False class Window(pyglet.window.Window): def __init__(self, width, height): self.time = 0.0 self.alive = True self.mouse = (0, 0) config = pyglet.gl.Config( major_ver...
Codeforces/324 Division 2/Problem E/gen.py
VastoLorde95/Competitive-Programming
170
12697539
<reponame>VastoLorde95/Competitive-Programming from random import * import numpy N = 10 a = numpy.random.permutation(N) b = numpy.random.permutation(N) print N for i in a: print i+1, print for i in b: print i+1, print
ghostwriter/rolodex/migrations/0021_project_timezone.py
bbhunter/Ghostwriter
601
12697608
# Generated by Django 3.1.13 on 2021-09-23 00:06 from django.db import migrations import timezone_field.fields class Migration(migrations.Migration): dependencies = [ ('rolodex', '0020_auto_20210922_2337'), ] operations = [ migrations.AddField( model_name='project', ...
contracts/utils/utils.py
andrevmatos/microraiden
417
12697618
from web3 import Web3 from populus.utils.wait import wait_for_transaction_receipt from eth_utils import keccak, is_0x_prefixed, decode_hex from web3.utils.threads import ( Timeout, ) def pack(*args) -> bytes: """ Simulates Solidity's sha3 packing. Integers can be passed as tuples where the second tuple ...
services/core/VolttronCentralPlatform/vcplatform/vcconnection.py
architpansare/volttron
406
12697640
# -*- coding: utf-8 -*- {{{ # vim: set fenc=utf-8 ft=python sw=4 ts=4 sts=4 et: # # Copyright 2020, Battelle Memorial Institute. # # 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...
modeling/__init__.py
MatthewAbugeja/agw
501
12697674
# encoding: utf-8 from .baseline import Baseline def build_model(cfg, num_classes): model = Baseline(num_classes, cfg.MODEL.LAST_STRIDE, cfg.MODEL.PRETRAIN_PATH, cfg.MODEL.NAME, cfg.MODEL.GENERALIZED_MEAN_POOL, cfg.MODEL.PRETRAIN_CHOICE) return model
CamJam Edukit 3 - RPi.GPIO/Code/7-pwm.py
vincecr0ft/EduKit3
132
12697691
# CamJam EduKit 3 - Robotics # Worksheet 7 - Controlling the motors with PWM import RPi.GPIO as GPIO # Import the GPIO Library import time # Import the Time library # Set the GPIO modes GPIO.setmode(GPIO.BCM) GPIO.setwarnings(False) # Set variables for the GPIO motor pins pinMotorAForwards = 10 pinMotorABackwards ...
examples/bulk_subinterfaces.py
haginara/pan-os-python
162
12697694
#!/usr/bin/env python # Copyright (c) 2017, Palo Alto Networks # # Permission to use, copy, modify, and/or distribute this software for any # purpose with or without fee is hereby granted, provided that the above # copyright notice and this permission notice appear in all copies. # # THE SOFTWARE IS PROVIDED "AS IS" A...
Lib/async/examples/disconnect.py
pyparallel/pyparallel
652
12697699
import time import async class Disconnect: pass server = async.server('10.211.55.3', 20019) async.register(transport=server, protocol=Disconnect) async.run()
up/models/losses/loss.py
ModelTC/EOD
196
12697705
<filename>up/models/losses/loss.py # Import from third library from torch.nn.modules.loss import _Loss def _reduce(loss, reduction, **kwargs): if reduction == 'none': ret = loss elif reduction == 'mean': normalizer = loss.numel() if kwargs.get('normalizer', None): normalize...
mmhuman3d/data/data_converters/builder.py
ykk648/mmhuman3d
472
12697711
from mmcv.utils import Registry DATA_CONVERTERS = Registry('data_converters') def build_data_converter(cfg): """Build data converter.""" return DATA_CONVERTERS.build(cfg)
tools/Sikuli/SelectStringsInText.sikuli/GoToProcedure.py
marmyshev/vanessa-automation
296
12697737
<gh_stars>100-1000 path2file = sys.argv[1] file = open(path2file, 'r') while True: line = file.readline() if not line: break stroka = unicode(line, 'utf-8') type('f', KeyModifier.CTRL) sleep(1) paste(stroka) sleep(1) type(Key.ENTER) sleep(1) break exit(0)
corehq/apps/users/management/commands/resync_location_user_data.py
dimagilg/commcare-hq
471
12697739
from django.core.management.base import BaseCommand from dimagi.utils.couch.database import iter_docs from corehq.apps.locations.models import SQLLocation from corehq.apps.users.models import CommCareUser class Command(BaseCommand): help = "Re-syncs location user data for all mobile workers in the domain." ...
examples/libtest/I18N/__init__.py
takipsizad/pyjs
739
12697748
<reponame>takipsizad/pyjs class I18N(object): def example(self): return "This is an example" def another_example(self): return "This is another example" i18n = I18N() locale = 'en' domains = [] import sys import domain domains.append('domain') import domain.subdomain domains.append('domain.s...
exercises/zh/exc_01_08_01.py
Jette16/spacy-course
2,085
12697750
<gh_stars>1000+ import spacy nlp = spacy.load("zh_core_web_sm") text = "写入历史了:苹果是美国第一家市值超过一万亿美元的上市公司。" # 处理文本 doc = ____ for token in doc: # 获取词符文本、词性标注及依存关系标签 token_text = ____.____ token_pos = ____.____ token_dep = ____.____ # 规范化打印的格式 print(f"{token_text:<12}{token_pos:<10}{token_dep:<10}...
zerver/tests/test_data_types.py
TylerPham2000/zulip
17,004
12697755
<reponame>TylerPham2000/zulip from zerver.lib.data_types import ( DictType, EnumType, Equals, ListType, NumberType, OptionalType, StringDictType, TupleType, UnionType, UrlType, schema, ) from zerver.lib.test_classes import ZulipTestCase class MiscTest(ZulipTestCase): de...
demo.py
voigta/RAFT-Stereo
172
12697793
<reponame>voigta/RAFT-Stereo import sys sys.path.append('core') import argparse import glob import numpy as np import torch from tqdm import tqdm from pathlib import Path from raft_stereo import RAFTStereo from utils.utils import InputPadder from PIL import Image from matplotlib import pyplot as plt DEVICE = 'cuda' ...
JetMETCorrections/Type1MET/python/pfMETCorrectionType0_cfi.py
ckamtsikis/cmssw
852
12697796
import FWCore.ParameterSet.Config as cms #-------------------------------------------------------------------------------- # select collection of "good" collision vertices selectedVerticesForPFMEtCorrType0 = cms.EDFilter("VertexSelector", src = cms.InputTag('offlinePrimaryVertices'), cut = cms.string("isValid...
src/zvt/recorders/sina/money_flow/__init__.py
vishalbelsare/zvt
2,032
12697817
# the __all__ is generated __all__ = [] # __init__.py structure: # common code of the package # export interface in __all__ which contains __all__ of its sub modules # import all from submodule sina_block_money_flow_recorder from .sina_block_money_flow_recorder import * from .sina_block_money_flow_recorder import __a...
examples/misc/flaskexamples/flaskcelery/flask_source/FlaskEchoApp.py
takipsizad/pyjs
739
12697822
<reponame>takipsizad/pyjs from flask import Flask from requests import JSONRPCRequest from views import json_echo, echo from method_views import JSONEchoView Flask.request_class = JSONRPCRequest def create_app(): app = Flask("FlaskEchoApp") app.config.from_pyfile("celeryconfig.py") # Register the bluepr...
exercises/crypto-square/crypto_square.py
kishankj/python
1,177
12697838
def cipher_text(plain_text): pass
actions/list_users.py
cognifloyd/stackstorm-yammer
164
12697849
<filename>actions/list_users.py from lib.actions import YammerAction __all__ = [ 'ListUsersAction' ] class ListUsersAction(YammerAction): def run(self, page=None, letter=None, sort_by=None, reverse=None): yammer = self.authenticate() users = yammer.users.all(page=page, letter=lett...
static/scripts/renew_certs.py
qbert2k/jans-setup
178
12697878
<gh_stars>100-1000 import os prop_file = '/install/community-edition-setup/setup.properties.last' prop = {} for l in open(prop_file): ls=l.strip() n = ls.find('=') if not ls.startswith('#'): key = ls[:n] val = ls[n+1:].strip() val = val.replace('\\=','=').replace('\\:',':') ...
setup.py
PingCheng-Wei/SD-MaskRCNN
183
12697966
<gh_stars>100-1000 """ Setup of SD Mask RCNN codebase Author: <NAME> """ import os from setuptools import setup root_dir = os.path.dirname(os.path.realpath(__file__)) # load __version__ version_file = 'sd_maskrcnn/version.py' exec(open(version_file).read()) # load README.md as long_description long_description = '...
test/integ/test_put_get_with_aws_token.py
jurecuhalev/snowflake-connector-python
311
12698010
<filename>test/integ/test_put_get_with_aws_token.py<gh_stars>100-1000 #!/usr/bin/env python # -*- coding: utf-8 -*- # # Copyright (c) 2012-2021 Snowflake Computing Inc. All rights reserved. # import glob import gzip import os import pytest from snowflake.connector.constants import UTF8 try: # pragma: no cover ...
tests/functional/context_methods/test_var_in_generate_name.py
tomasfarias/dbt-core
799
12698036
import pytest from dbt.tests.util import run_dbt, update_config_file from dbt.exceptions import CompilationException model_sql = """ select 1 as id """ bad_generate_macros__generate_names_sql = """ {% macro generate_schema_name(custom_schema_name, node) -%} {% do var('somevar') %} {% do return(dbt.generate_s...
pomdpy/solvers/linear_alpha_net.py
watabe951/POMDPy
210
12698040
from __future__ import absolute_import import os import numpy as np import tensorflow as tf from experiments.scripts.pickle_wrapper import save_pkl, load_pkl from .ops import simple_linear, select_action_tf, clipped_error from .alpha_vector import AlphaVector from .base_tf_solver import BaseTFSolver class LinearAlpha...
plans/management/commands/autorenew_accounts.py
feedgurus/django-plans
240
12698050
from django.core.management import BaseCommand from plans import tasks class Command(BaseCommand): help = 'Autorenew accounts and with recurring payments' def handle(self, *args, **options): # pragma: no cover self.stdout.write("Starting renewal") renewed_accounts = tasks.autorenew_account()...
NLP/EMNLP2021-SgSum/src/models/encoder.py
zhangyimi/Research
1,319
12698084
# Copyright (c) 2019 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...
test/test_training_log.py
nmonarizqa/FLAML
1,747
12698092
<filename>test/test_training_log.py import os import unittest from tempfile import TemporaryDirectory from sklearn.datasets import fetch_california_housing from flaml import AutoML from flaml.training_log import training_log_reader class TestTrainingLog(unittest.TestCase): def test_training_log(self, path="test...
awdphpspear/upload.py
hillmanyoung/AWD
146
12698100
<reponame>hillmanyoung/AWD import requests import os def trojan_implant(address,webshell,trojan,password): payload = '' payload += 'ignore_user_abort(true);set_time_limit(0);unlink(__FILE__);$file=' payload += "'" payload += trojan payload += "'" payload += ';$code=' payload += "'" payload += '<?php @eval($_PO...
src/main/resources/assets/openpython/opos/v1.1/lib/micropython/contextlib.py
fossabot/OpenPython
126
12698116
"""Utilities for with-statement contexts. See PEP 343. Original source code: https://hg.python.org/cpython/file/3.4/Lib/contextlib.py Not implemented: - redirect_stdout; """ import sys from collections import deque from ucontextlib import * class closing(object): """Context to automatically close something ...
第2章/program/String_List_Tuple.py
kingname/SourceCodeOfBook
274
12698155
example_string = '我是字符串' example_list = ['我', '是', '列', '表'] example_tuple = ('我', '是', '元', '组') print('1.取第一个元素 >', example_string[0], example_list[0], example_tuple[0]) print('2.取下标为2的元素(第三个元素)>', example_string[2], example_list[2], example_tuple[2]) print('3.取最后一个元素 >', example_string[-1], example_list[-1], example...
trainFineTuneNYU.py
Z7Gao/InverseRenderingOfIndoorScene
171
12698156
import torch import numpy as np from torch.autograd import Variable import torch.optim as optim import argparse import random import os import models import torchvision.utils as vutils import utils import nyuDataLoader as dataLoader_nyu import dataLoader as dataLoader_ours import torch.nn as nn from torch.utils.data im...
astropy/time/tests/test_pickle.py
jayvdb/astropy
445
12698163
# Licensed under a 3-clause BSD style license - see LICENSE.rst import pickle import numpy as np from astropy.time import Time class TestPickle: """Basic pickle test of time""" def test_pickle(self): times = ['1999-01-01 00:00:00.123456789', '2010-01-01 00:00:00'] t1 = Time(times, scale='u...
runtime/java9_container.py
tobegit3hub/lambda-docker
343
12698184
import basic_container class Java9Container(basic_container.BasicContainer): def __init__(self): super(self.__class__, self).__init__() self.image = "java:9" self.command = 'sh -c "javac main.java && java main"' self.file_extension = ".java"
tests/configlet/util/helpers.py
lolyu/sonic-mgmt
132
12698186
#! /usr/bin/env python from datetime import datetime import inspect import logging logger = logging.getLogger(__name__) do_print = False def log_init(name): global logger logger = logging.getLogger(name) def log_msg(lgr_fn, m): tstr = datetime.now().strftime("%H:%M:%S") msg = "{}:{}:{} {}".format...
src/ralph/reports/urls.py
DoNnMyTh/ralph
1,668
12698197
# -*- coding: utf-8 -*- from django.conf.urls import url from ralph.reports import views urlpatterns = [ url( r'^category_model_report/?$', views.CategoryModelReport.as_view(), name='category_model_report' ), url( r'^category_model__status_report/?$', views.Category...
examples/delete_user.py
chrisinmtown/PyMISP
307
12698244
#!/usr/bin/env python # -*- coding: utf-8 -*- from pymisp import ExpandedPyMISP from keys import misp_url, misp_key, misp_verifycert import argparse if __name__ == '__main__': parser = argparse.ArgumentParser(description='Delete the user with the given id. Keep in mind that disabling users (by setting the disabl...
pkg/build/lib/vtreat/transform.py
WinVector/pyvtreat
104
12698257
<filename>pkg/build/lib/vtreat/transform.py<gh_stars>100-1000 """base class for user transforms""" class UserTransform: """base class for user transforms, should express taking a set of k inputs to k outputs independently""" def __init__(self, treatment): self.y_aware_ = True self.treatment_ ...
pyquil/_memory.py
stjordanis/pyquil
677
12698293
<reponame>stjordanis/pyquil<filename>pyquil/_memory.py<gh_stars>100-1000 from dataclasses import dataclass, field import dataclasses from typing import Dict, Mapping, Sequence, Union from rpcq.messages import ParameterAref ParameterValue = Union[int, float, Sequence[int], Sequence[float]] @dataclass class Memory: ...
core/src/main/python/akdl/akdl/tests/config/test_config.py
starburst-project/Alink
3,301
12698319
import unittest import tensorflow as tf if tf.__version__ >= '2.0': tf = tf.compat.v1 from akdl.runner.config import BatchTaskConfig, StreamTaskConfig, TrainTaskConfig def print_dataset(dataset: tf.data.Dataset): next_record = dataset.make_one_shot_iterator().get_next() counter = 0 with tf.Session(...
StackApp/env/lib/python2.7/site-packages/flask_api/tests/test_settings.py
jonathanmusila/StackOverflow-Lite
555
12698324
# coding: utf8 from __future__ import unicode_literals from flask_api.settings import APISettings import unittest class SettingsTests(unittest.TestCase): def test_bad_import(self): settings = APISettings({'DEFAULT_PARSERS': 'foobarz.FailedImport'}) with self.assertRaises(ImportError) as context: ...
src/towncrier/_project.py
hawkowl/towncrier
252
12698356
<reponame>hawkowl/towncrier<filename>src/towncrier/_project.py # Copyright (c) <NAME>, 2015 # See LICENSE for details. """ Responsible for getting the version and name from a project. """ import sys from importlib import import_module from incremental import Version def _get_package(package_dir, package): t...
pytorch_ares/pytorch_ares/attack_torch/cw.py
thu-ml/realsafe
107
12698368
import numpy as np import torch from torch.autograd import Variable class CW(object): def __init__(self, model, device,norm, IsTargeted, kappa, lr, init_const, max_iter, binary_search_steps, data_name): self.net = model self.device = device self.IsTargeted = IsTargeted sel...
bindings/java/gir_parser.py
george-hopkins/pkg-openwebrtc
1,604
12698386
# Copyright (c) 2014-2015, Ericsson AB. All rights reserved. # # Redistribution and use in source and binary forms, with or without modification, # are permitted provided that the following conditions are met: # # 1. Redistributions of source code must retain the above copyright notice, this # list of conditions and th...
openfda/deploy/tests/foodevent/test_endpoint.py
hobochili/openfda
388
12698388
from openfda.tests.api_test_helpers import * from nose.tools import * def test_consumer_merge(): meta, results = fetch( '/food/event.json?search=report_number:65420') eq_(len(results), 1) event = results[0] eq_(event["consumer"]["gender"], "M") eq_(event["consumer"]["age"], "33") eq_(event["consumer"]...
libs/sqlobject/wsgi_middleware.py
scambra/HTPC-Manager
422
12698389
<reponame>scambra/HTPC-Manager from paste.deploy.converters import asbool from paste.wsgilib import catch_errors from paste.util import import_string import sqlobject import threading def make_middleware(app, global_conf, database=None, use_transaction=False, hub=None): """ WSGI middleware ...
sample/sample_get_sqlite_master.py
thombashi/SimpleSQLite
126
12698409
#!/usr/bin/env python3 import json from simplesqlite import SimpleSQLite def main(): con = SimpleSQLite("sample.sqlite", "w") data_matrix = [[1, 1.1, "aaa", 1, 1], [2, 2.2, "bbb", 2.2, 2.2], [3, 3.3, "ccc", 3, "ccc"]] con.create_table_from_data_matrix( "sample_table", ["a", "b", "c", "d", "e"], ...
common/pickleserializable.py
cganta/dbtest
130
12698426
""" Copyright (c) Microsoft Corporation. Licensed under the MIT license. """ from abc import abstractmethod, ABCMeta class PickleSerializable(): __metaclass__ = ABCMeta @abstractmethod def serialize(self): pass @abstractmethod def deserialize(self): pass
ml3d/datasets/augment/__init__.py
kylevedder/Open3D-ML
447
12698434
from .augmentation import SemsegAugmentation, ObjdetAugmentation
test/utils/test_rounding.py
SamuelMarks/botorch
2,344
12698437
<filename>test/utils/test_rounding.py<gh_stars>1000+ #!/usr/bin/env python3 # 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 torch from botorch.utils.rounding import approximate_round...
flexget/tests/test_argparse.py
Jeremiad/Flexget
1,322
12698471
<reponame>Jeremiad/Flexget<filename>flexget/tests/test_argparse.py from argparse import Action from flexget.options import ArgumentParser def test_subparser_nested_namespace(): p = ArgumentParser() p.add_argument('--outer') p.add_subparsers(nested_namespaces=True) sub = p.add_subparser('sub') sub...
app-tasks/rf/src/rf/models/image.py
pomadchin/raster-foundry
112
12698472
<filename>app-tasks/rf/src/rf/models/image.py<gh_stars>100-1000 """Python class representation of a Raster Foundry Image""" from .base import BaseModel from .band import Band class Image(BaseModel): URL_PATH = "/api/images/" def __init__( self, rawDataBytes, visibility, file...
research/carls/util/array_ops.py
srihari-humbarwadi/neural-structured-learning
939
12698473
<reponame>srihari-humbarwadi/neural-structured-learning # Copyright 2021 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/licenses/LICENSE-2.0 # # Unl...