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 |
|---|---|---|---|---|---|---|
pyjobserver/__main__.py | athewsey/pyjobserver | 0 | 32100 | """Main/example start-up script for the pyjobserver
Use this as a guide if importing pyjobserver into another app instead
"""
# Built-Ins:
import asyncio
from logging import getLogger, Logger
import os
from pathlib import Path
# External Dependencies:
from aiohttp import web
import click
from dotenv import load_dote... | 2.359375 | 2 |
dowhy/graph_learner.py | leo-ware/dowhy | 2,904 | 32101 | class GraphLearner:
"""Base class for causal discovery methods.
Subclasses implement different discovery methods. All discovery methods are in the package "dowhy.causal_discoverers"
"""
def __init__(self, data, library_class, *args, **kwargs):
self._data = data
self._labels = list(self._data.columns)
self... | 3.140625 | 3 |
ppci/wasm/_instantiate.py | jsdelivrbot/ppci-mirror | 0 | 32102 | """ Provide function to load a wasm module into the current process.
Note that for this to work, we require compiled wasm code and a runtime.
The wasm runtime contains the following:
- Implement function like sqrt, floor, bit rotations etc..
"""
import os
import abc
import shelve
import io
import struct
import logg... | 2.65625 | 3 |
easytrader/utils/stock.py | chforest/easytrader | 6,829 | 32103 | <filename>easytrader/utils/stock.py
# coding:utf-8
import datetime
import json
import random
import requests
def get_stock_type(stock_code):
"""判断股票ID对应的证券市场
匹配规则
['50', '51', '60', '90', '110'] 为 sh
['00', '13', '18', '15', '16', '18', '20', '30', '39', '115'] 为 sz
['5', '6', '9'] 开头的为 sh, 其余为 s... | 2.84375 | 3 |
IR analysis.py | jankulik/Transition-Line-Detection | 0 | 32104 | import numpy as np
import cv2
import os
from matplotlib import pyplot as plt
#### INPUT ####
# folder that contains datapoints
folderName = '2dIR'
#### SETTINGS ####
# settings listed below are suitable for 2D data
# intensity of noise filtering; higher values mean more blurring
medianKernel = 5
# bl... | 3.234375 | 3 |
aiida_crystal_dft/__init__.py | tilde-lab/aiida-crystal-dft | 2 | 32105 | <filename>aiida_crystal_dft/__init__.py
"""
aiida_crystal_dft
AiiDA plugin for running the CRYSTAL code
"""
__version__ = "0.8"
| 1.046875 | 1 |
fzzzMaskBackend/users/serializers.py | FZZZMask/backend | 0 | 32106 | <gh_stars>0
from rest_framework import serializers
| 1.0625 | 1 |
src/python/pants/backend/terraform/target_gen_test.py | bastianwegge/pants | 0 | 32107 | <filename>src/python/pants/backend/terraform/target_gen_test.py
# Copyright 2021 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import annotations
import pytest
from pants.backend.terraform import target_gen
from pants.backend.terrafo... | 1.953125 | 2 |
tkinterLearning/graphinKivyExample.py | MertEfeSevim/ECar-ABUTeam | 0 | 32108 | from kivy.garden.matplotlib.backend_kivyagg import FigureCanvasKivyAgg
from kivy.app import App
from kivy.uix.boxlayout import BoxLayout
import matplotlib.pyplot as plt
plt.plot([1, 23, 2, 4])
plt.ylabel('some numbers')
class MyApp(App):
def build(self):
box = BoxLayout()
box.add_widget(FigureCan... | 2.78125 | 3 |
data_genie/get_data.py | noveens/sampling_cf | 6 | 32109 | import os
import random
from tqdm import tqdm
from collections import defaultdict
from data_genie.data_genie_config import *
from data_genie.data_genie_utils import TRAINING_DATA_PATH, CACHED_KENDALL_TAU_PATH, load_obj, save_obj
from data_genie.data_genie_utils import count_performance_retained, get_best_results
from... | 2.015625 | 2 |
benchmark.py | cmpute/EECS558-Project | 0 | 32110 | import numpy as np
from matplotlib import pyplot as plt
from env import DrivingEnv
from solvers import GridSolver, SampleGraphSolver
def time_compare(seed=1234, min_sample=10, max_sample=50, count=10):
sample_count = np.linspace(min_sample, max_sample, count).astype(int)
grid_times = []
graph_times = []
... | 2.65625 | 3 |
pandas_market_calendars/exchange_calendars_mirror.py | matbox/pandas_market_calendars | 0 | 32111 | """
Imported calendars from the exchange_calendars project
GitHub: https://github.com/gerrymanoim/exchange_calendars
"""
from datetime import time
from .market_calendar import MarketCalendar
import exchange_calendars
class TradingCalendar(MarketCalendar):
def __init__(self, open_time=None, close_time=None):
... | 2.828125 | 3 |
util/prelude.py | sinsay/ds_define | 0 | 32112 | <filename>util/prelude.py
from .enum import EnumBase
def is_builtin_type(obj) -> bool:
"""
检查 obj 是否基础类型
"""
return isinstance(obj, (int, str, float, bool)) or obj is None
| 2.96875 | 3 |
tca_ng/server.py | wichovw/tca-gt | 1 | 32113 | import cherrypy, cherrypy_cors, os
import tca_ng.example_maps
import tca_ng.models
import random
class TCAServer(object):
@cherrypy.expose
@cherrypy.tools.json_out()
def start(self):
self.automaton = tca_ng.models.Automaton()
self.automaton.topology = tca_ng.example_maps.simple_map(10... | 2.078125 | 2 |
todo/api/views.py | devord/todo | 0 | 32114 | from rest_framework import viewsets
from api.serializers import LabelSerializer, ItemSerializer
from api.models import Label, Item
class LabelViewSet(viewsets.ModelViewSet):
"""
API endpoint that allows labels to be viewed or edited.
"""
queryset = Label.objects.all().order_by('name')
serializer_... | 2.375 | 2 |
user.py | sylvestus/passwordLocker | 0 | 32115 | <reponame>sylvestus/passwordLocker<filename>user.py
import string
import random
class User:
def __init__(self,username,password):
self.username = username
self.password = password
userList = []
def addUser(self):
'''
method saves a new user object to credentials list
... | 3.84375 | 4 |
batch/batch/public_gcr_images.py | MariusDanner/hail | 0 | 32116 | from typing import List
def public_gcr_images(project: str) -> List[str]:
# the worker cannot import batch_configuration because it does not have all the environment
# variables
return [f'gcr.io/{project}/{name}' for name in ('query', 'hail', 'python-dill', 'batch-worker')]
| 2.0625 | 2 |
django_cradmin/uicontainer/container.py | appressoas/django_cradmin | 11 | 32117 | <reponame>appressoas/django_cradmin
from django.conf import settings
from django.forms.utils import flatatt
from django_cradmin import renderable
class NotBootsrappedError(Exception):
"""
Raised when trying to use features of
:class:`.AbstractContainerRenderable`
that requires is to have been bootstra... | 1.734375 | 2 |
country_settings.py | region-spotteR/conora_chronologies | 0 | 32118 | <reponame>region-spotteR/conora_chronologies
class attributes_de:
def __init__(self,threshold_list,range_for_r):
self.country_name = 'Germany'
self.population = 83190556
self.url = 'https://opendata.arcgis.com/datasets/dd4580c810204019a7b8eb3e0b329dd6_0.geojson'
self.contains_tests=F... | 2.46875 | 2 |
src/accounts/migrations/0009_alter_protection_description.py | NikolayTls/CarRental-Fullstack | 0 | 32119 | <filename>src/accounts/migrations/0009_alter_protection_description.py
# Generated by Django 3.2.5 on 2021-11-09 18:57
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('accounts', '0008_auto_20211108_1633'),
]
operations = [
migrations.Al... | 1.21875 | 1 |
builder.py | Delivery-Klad/chat_desktop | 0 | 32120 | <gh_stars>0
import sys
from cx_Freeze import setup, Executable
base = None
if sys.platform == "win32":
base = "Win32GUI"
elif sys.platform == "win64":
base = "Win64GUI"
excludes = ['PyQt5', 'colorama', 'pandas', 'sqlalchemy', 'numpy', 'notebook', 'Django', 'schedule']
packages = ["idna", "_cffi_backend", "bc... | 1.75 | 2 |
flaviabernardes/flaviabernardes/cms/migrations/0014_auto_20160717_1414.py | rogerhil/flaviabernardes | 0 | 32121 | <gh_stars>0
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import image_cropping.fields
class Migration(migrations.Migration):
dependencies = [
('cms', '0013_auto_20151121_1602'),
]
operations = [
migrations.AddField(
... | 1.828125 | 2 |
backend/inst-selec/tree-match-burs-table/app/match_naive.py | obs145628/cle | 0 | 32122 | <gh_stars>0
'''
Tree-Matching implementation
Based on BURS (Bottom-Up Rewrite System)
Similar to tree-match-burs1 project
Inspired from:
- Instruction Selection via Tree-Pattern Matching - Enginner a Compiler p610
- An Improvement to Bottom-up Tree Pattern Matching - <NAME>
- Simple and Efficient BURS Table Generation... | 2.578125 | 3 |
gym_electric_motor/physical_systems/electric_motors.py | 54hanxiucao/gym-electric-motor | 1 | 32123 | import numpy as np
import math
from scipy.stats import truncnorm
class ElectricMotor:
"""
Base class for all technical electrical motor models.
A motor consists of the ode-state. These are the dynamic quantities of its ODE.
For example:
ODE-State of a DC-shunt motor... | 3.59375 | 4 |
tests/pyrem_tests.py | sgdxbc/PyREM | 5 | 32124 | from pyrem.task import Task, TaskStatus
class DummyTask(Task):
def _start(self):
pass
def _wait(self):
pass
def _stop(self):
pass
class TestDummyTask(object):
@classmethod
def setup_class(klass):
"""This method is run once for each class before any tests are run"... | 2.84375 | 3 |
invenio_app_ils/records/resolver/jsonresolver/document_keyword.py | lauren-d/invenio-app-ils | 0 | 32125 | <reponame>lauren-d/invenio-app-ils
# -*- coding: utf-8 -*-
#
# Copyright (C) 2019 CERN.
#
# invenio-app-ils is free software; you can redistribute it and/or modify it
# under the terms of the MIT License; see LICENSE file for more details.
"""Resolve the Keyword referenced in the Document."""
import jsonresolver
from... | 2.109375 | 2 |
Other_AIMA_Scripts/planning.py | erensezener/aima-based-irl | 12 | 32126 | <gh_stars>10-100
"""Planning (Chapters 11-12)
"""
from __future__ import generators
| 0.984375 | 1 |
Berkeley_pacman_project1/search.py | AndrewSpano/UC_Berkeley_AI_Projects | 1 | 32127 | <reponame>AndrewSpano/UC_Berkeley_AI_Projects
# search.py
# ---------
# Licensing Information: You are free to use or extend these projects for
# educational purposes provided that (1) you do not distribute or publish
# solutions, (2) you retain this notice, and (3) you provide clear
# attribution to UC Berkeley, incl... | 2.484375 | 2 |
src/python/WMCore/WMBS/Oracle/Files/GetLocation.py | hufnagel/WMCore | 21 | 32128 | <reponame>hufnagel/WMCore<filename>src/python/WMCore/WMBS/Oracle/Files/GetLocation.py
"""
Oracle implementation of GetLocationFile
"""
from WMCore.WMBS.MySQL.Files.GetLocation import GetLocation \
as GetLocationFileMySQL
class GetLocation(GetLocationFileMySQL):
"""
_GetLocation_
Oracle specific: file... | 1.429688 | 1 |
python/cohorte/vote/core.py | isandlaTech/cohorte-runtime | 6 | 32129 | #!/usr/bin/env python
# -- Content-Encoding: UTF-8 --
"""
Voting system core service
:author: <NAME>
:license: Apache Software License 2.0
:version: 1.1.0
..
Copyright 2014 isandlaTech
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the... | 1.21875 | 1 |
aether-odk-module/aether/odk/api/serializers.py | lordmallam/aether | 0 | 32130 | <reponame>lordmallam/aether<gh_stars>0
# Copyright (C) 2018 by eHealth Africa : http://www.eHealthAfrica.org
#
# See the NOTICE file distributed with this work for additional information
# regarding copyright ownership.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file exce... | 1.742188 | 2 |
client.py | Klark007/Selbstfahrendes-Auto-im-Modell | 0 | 32131 | import socket
from ast import literal_eval
import Yetiborg.Drive as Yetiborg
HEADERSIZE = 2
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect(("localhost", 12345)) # 192.168.0.11 / localhost / 192.168.0.108
# car always looks up at the beginning
car = Yetiborg.Yetiborg((0, 1))
"""
fs: finished
"... | 2.609375 | 3 |
python/DeepSeaScene/Convert/GLTFModel.py | akb825/DeepSea | 5 | 32132 | # Copyright 2020 <NAME>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... | 1.632813 | 2 |
python/sparktk/models/classification/naive_bayes.py | aayushidwivedi01/spark-tk-old | 1 | 32133 | <gh_stars>1-10
# vim: set encoding=utf-8
# Copyright (c) 2016 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# ... | 2.046875 | 2 |
matplotlib_venn/_venn2.py | TRuikes/matplotlib-venn | 306 | 32134 | <gh_stars>100-1000
'''
Venn diagram plotting routines.
Two-circle venn plotter.
Copyright 2012, <NAME>.
http://kt.era.ee/
Licensed under MIT license.
'''
# Make sure we don't try to do GUI stuff when running tests
import sys, os
if 'py.test' in os.path.basename(sys.argv[0]): # (XXX: Ugly hack)
import matplotlib
... | 3.03125 | 3 |
examples/htmltopdf/lambda_function.py | dgilmanAIDENTIFIED/juniper | 65 | 32135 | import pdfkit
import boto3
s3 = boto3.client('s3')
def lambda_handler(event, context):
pdfkit.from_url('http://google.com', '/tmp/out.pdf')
with open('/tmp/out.pdf', 'rb') as f:
response = s3.put_object(
Bucket='temp-awseabsgddev',
Key='juni/google.pdf',
Body=f.re... | 2.296875 | 2 |
test/espnet2/enh/separator/test_dc_crn_separator.py | roshansh-cmu/espnet | 0 | 32136 | import pytest
import torch
from packaging.version import parse as V
from torch_complex import ComplexTensor
from espnet2.enh.layers.complex_utils import is_complex
from espnet2.enh.separator.dc_crn_separator import DC_CRNSeparator
is_torch_1_9_plus = V(torch.__version__) >= V("1.9.0")
@pytest.mark.parametrize("inpu... | 2.234375 | 2 |
custom_model_runner/datarobot_drum/drum/description.py | cartertroy/datarobot-user-models | 0 | 32137 | version = "1.1.5rc1"
__version__ = version
project_name = "datarobot-drum"
| 1.140625 | 1 |
usaspending_api/download/v2/urls.py | truthiswill/usaspending-api | 0 | 32138 | from django.conf.urls import url
from usaspending_api.download.v2 import views
urlpatterns = [
url(r'^awards', views.RowLimitedAwardDownloadViewSet.as_view()),
url(r'^accounts', views.AccountDownloadViewSet.as_view()),
# url(r'^columns', views.DownloadColumnsViewSet.as_view()),
url(r'^status', views.... | 1.828125 | 2 |
bazel_versions.bzl | cgrindel/buildifier-prebuilt | 8 | 32139 | <filename>bazel_versions.bzl
"""
Common bazel version requirements for tests
"""
CURRENT_BAZEL_VERSION = "5.0.0"
OTHER_BAZEL_VERSIONS = [
"4.2.2",
]
SUPPORTED_BAZEL_VERSIONS = [
CURRENT_BAZEL_VERSION,
] + OTHER_BAZEL_VERSIONS
| 0.988281 | 1 |
notebooks/bqml/track_meta.py | roannav/learntools | 359 | 32140 | # See also examples/example_track/track_meta.py for a longer, commented example
track = dict(
author_username='dansbecker',
course_name='Machine Learning',
course_url='https://www.kaggle.com/learn/intro-to-machine-learning'
)
lessons = [
dict(
topic='Your First BiqQuery ML Model',
... | 1.664063 | 2 |
inv/migrations/0001_subinterface_managed_object.py | prorevizor/noc | 84 | 32141 | # ---------------------------------------------------------------------
# Initialize SubInterface.managed_object
# ---------------------------------------------------------------------
# Copyright (C) 2007-2020 The NOC Project
# See LICENSE for details
# -----------------------------------------------------------------... | 2.03125 | 2 |
Python/1013. PartitionArrayIntoThreePartsWithEqualSum.py | nizD/LeetCode-Solutions | 263 | 32142 | class Solution:
def canThreePartsEqualSum(self, A: List[int]) -> bool:
# Since all the three parts are equal, if we sum all element of arrary it should be a multiplication of 3
# so the sum of each part must be equal to sum of all element divided by 3
quotient, remainder = divmod(sum(A), 3)
... | 3.671875 | 4 |
utils/etrm_stochastic_grid_search/residual_analysis.py | NMTHydro/Recharge | 7 | 32143 | # ===============================================================================
# Copyright 2019 <NAME> and <NAME>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/... | 1.921875 | 2 |
lib/data_utils/insta_utils_imgs.py | ziniuwan/maed | 145 | 32144 | import os
import sys
sys.path.append('.')
import argparse
import numpy as np
import os.path as osp
from multiprocessing import Process, Pool
from glob import glob
from tqdm import tqdm
import tensorflow as tf
from PIL import Image
from lib.core.config import INSTA_DIR, INSTA_IMG_DIR
def process_single_record(fname,... | 2.203125 | 2 |
src/person/migrations/0004_actors_moved.py | Little-Pogchamp-Team/kinopoisk_on_django | 10 | 32145 | # Generated by Django 3.1.5 on 2021-03-22 17:30
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('movies', '0010_actors_moved'),
('person', '0003_refactoring_movie_person_m2m_rels'),
]
operations = [
migrations.AddField(
... | 1.789063 | 2 |
tests/test_oxide.py | codepainters/edalize | 1 | 32146 | <filename>tests/test_oxide.py
import os
import pytest
from edalize_common import make_edalize_test
def run_oxide_test(tf):
tf.backend.configure()
tf.compare_files(
["Makefile", "edalize_yosys_procs.tcl", "edalize_yosys_template.tcl"]
)
tf.backend.build()
tf.compare_files(["yosys.cmd", "n... | 2.0625 | 2 |
ds5-scripts/aosp_8_1/arm/time.py | rewhy/happer | 32 | 32147 | # time.py
import gc
import os
import sys
from arm_ds.debugger_v1 import Debugger
from arm_ds.debugger_v1 import DebugException
import config
import memory
import mmu
# obtain current execution state
debugger = Debugger()
execution_state = debugger.getCurrentExecutionContext()
def cleanup():
if... | 2.09375 | 2 |
unsupervised_learning/kmeans.py | toorajtaraz/computational_intelligence_mini_projects | 3 | 32148 | from pathlib import Path
import sys
path = str(Path(Path(__file__).parent.absolute()).parent.absolute())
sys.path.insert(0, path)
from mnist_utils.util import _x, _y_int
from sklearn.cluster import MiniBatchKMeans
from sklearn.metrics import accuracy_score, adjusted_rand_score
import numpy as np
from fast_pytorch_kmean... | 2.328125 | 2 |
cbbc/qapackage/OnlineCLTrainer.py | Robert-xiaoqiang/Model-Capability-Assessment | 0 | 32149 | <gh_stars>0
import os
import json
import random
random.seed(32767)
import shutil
import numpy as np
np.random.seed(32767)
import torch
from torch import nn
from torch.nn import init
from torch.nn import functional as F
from torch.optim import Adam, SGD, lr_scheduler
import torch.backends.cudnn as cudnn
from tensorboar... | 1.726563 | 2 |
fluids/consts.py | BerkeleyAutomation/FLUIDS | 26 | 32150 | STATE_CITY = "fluids_state_city"
OBS_QLIDAR = "fluids_obs_qlidar"
OBS_GRID = "fluids_obs_grid"
OBS_BIRDSEYE = "fluids_obs_birdseye"
OBS_NONE = "fluids_obs_none"
BACKGROUND_CSP = "fluids_background_csp"
BACKGROUND_NULL = "fluids_background_null"
REWARD_PATH = "fluids_reward_path"
REWARD_NONE = "fluids_rew... | 0.941406 | 1 |
src/melbviz/wsgi.py | ned2/footviz | 1 | 32151 | <filename>src/melbviz/wsgi.py
from .app import app
application = app.server
| 0.996094 | 1 |
0118.Pascal's_Triangle/solution.py | WZMJ/Algorithms | 5 | 32152 | <reponame>WZMJ/Algorithms
class Solution:
def generate(self, num_rows):
if num_rows == 0:
return []
ans = [1]
result = [ans]
for _ in range(num_rows - 1):
ans = [1] + [ans[i] + ans[i + 1] for i in range(len(ans[:-1]))] + [1]
result.append(ans)
... | 3.3125 | 3 |
ozzmeister00/AdventOfCode2021/Scripts/Python/utils/constants.py | techartorg/Advent_of_code_2021 | 0 | 32153 | <filename>ozzmeister00/AdventOfCode2021/Scripts/Python/utils/constants.py
"""
Constants and constant generators
"""
import os
INPUTS_FOLDER_NAME = "inputData"
def getInputsFolder():
"""
:return str: the absolute path on the file system to the inputData folder, which should be relative to this package
"... | 2.5625 | 3 |
bin/ADFRsuite/CCSBpckgs/Volume/Operators/trilinterp.py | AngelRuizMoreno/Jupyter_Dock_devel | 0 | 32154 | <reponame>AngelRuizMoreno/Jupyter_Dock_devel
################################################################################
##
## This library is free software; you can redistribute it and/or
## modify it under the terms of the GNU Lesser General Public
## License as published by the Free Software Foundation; either
... | 1.90625 | 2 |
telegrampy/ext/commands/help.py | Fyssion/telegram.py | 0 | 32155 | <filename>telegrampy/ext/commands/help.py<gh_stars>0
"""
MIT License
Copyright (c) 2020-2021 ilovetocode
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 Software without restriction, including without lim... | 2.046875 | 2 |
backend/farming/graphql/types/natura2000.py | PwC-FaST/fast-webapp | 7 | 32156 | import graphene
import os
from promise import Promise
from datetime import datetime
from promise.dataloader import DataLoader
import requests
from core.graphql.types import CountryType
from core.models import Country
class Natura2000FeatureType(graphene.ObjectType):
id = graphene.String()
site_code = graphene... | 2.453125 | 2 |
Lib/test/test_cmath_jy.py | weimingtom/j2mepython-midp | 1 | 32157 | <gh_stars>1-10
#! /usr/bin/env python
""" Simple test script for cmathmodule.c
<NAME>
"""
import cmath
import unittest
from test import test_support
from test.test_support import verbose
p = cmath.pi
e = cmath.e
if verbose:
print 'PI = ', abs(p)
print 'E = ', abs(e)
class CmathTestCase(unittest.TestCase)... | 2.46875 | 2 |
python/coffer/coins/impl/_segwittx.py | Steve132/wallet_standard | 0 | 32158 | from _satoshitx import *
import struct
#https://bitcoincore.org/en/segwit_wallet_dev/
class SWitnessTransaction(STransaction):
def __init__(version,flag,ins,outs,witness,locktime):
super(SWitnessTransaction,self).__init__(version,ins,outs,locktime)
self.flag=flag
self.witness=witness
def serialize(self):
tx... | 2.15625 | 2 |
tests/buffered_recorder_atexit.py | peterdemin/awsme | 15 | 32159 | <reponame>peterdemin/awsme
from __future__ import print_function
import datetime
from awsme.metric import Metric
from awsme.buffered_recorder import BufferedRecorder
from typing import List, Dict, Any # noqa
class StdoutRecorder:
def put_metric_data(self, metric_data: List[Dict[str, Any]]) -> None:
pri... | 2.4375 | 2 |
src/unity/python/turicreate/toolkits/_feature_engineering/_transformer_chain.py | shreyasvj25/turicreate | 2 | 32160 | <filename>src/unity/python/turicreate/toolkits/_feature_engineering/_transformer_chain.py
# -*- coding: utf-8 -*-
# Copyright © 2017 Apple Inc. All rights reserved.
#
# Use of this source code is governed by a BSD-3-clause license that can
# be found in the LICENSE.txt file or at https://opensource.org/licenses/BSD-3-C... | 1.835938 | 2 |
FndngTeam.py | aveepsit/SnackDown19-Qualifier | 0 | 32161 | <gh_stars>0
for testcase in range(int(input())):
n = int(input())
dict = {}
comb = 1
m = (10**9)+7
for x in input().split():
no = int(x)
try:
dict[no] = dict[no] + 1
except:
dict[no] = 1
dict = list(dict.items())
dict.sort(key=lambda x: x[0],... | 2.671875 | 3 |
ccal/read_correlate_copynumber_vs_mrnaseq.py | kberkey/ccal | 9 | 32162 | from tarfile import open as tarfile_open
from pandas import read_csv
def read_correlate_copynumber_vs_mrnaseq(tar_gz_file_path, genes):
with tarfile_open(tar_gz_file_path) as tar_gz_file:
n = read_csv(
tar_gz_file.extractfile(
tuple(file for file in tar_gz_file if file.name.... | 2.734375 | 3 |
get_ships.py | ndujar/vessel-locator | 0 | 32163 | <reponame>ndujar/vessel-locator
#module import
import urllib.request
from bs4 import BeautifulSoup
from datetime import datetime
def get_ships(imo_list):
hdr = {'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.64 Safari/537.11',
'Accept': 'text/ht... | 3.25 | 3 |
scripts/convert_0.0_to_0.1.py | codecraftingtools/hildegard | 0 | 32164 | <filename>scripts/convert_0.0_to_0.1.py
#!/usr/bin/env python3
# Copyright (c) 2020 <NAME>
import sys
f = open(sys.argv[1])
for line in f:
s = line.strip()
if s.startswith("source:"):
id = s.split(":")[-1].strip()
indent = ' '*line.index("source")
sys.stdout.write(f"{indent}source:\n"... | 2.828125 | 3 |
bin/v0eval.py | m-takeuchi/ilislife_wxp | 0 | 32165 | <filename>bin/v0eval.py
#!/usr/bin/env python3
# coding: utf-8
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from matplotlib import gridspec
import datetime, time
from scipy.signal import savgol_filter
from scipy.interpolate import interp1d, Akima1DInterpolator, PchipInterpolator
from sys impo... | 2.25 | 2 |
CoTeTo/CoTeTo/import_file.py | EnEff-BIM/EnEffBIM-Framework | 3 | 32166 | #!/usr/bin/env python3
import sys
if sys.version_info >= (3, 3):
import importlib
def import_file(module_path='', module=''):
importlib.invalidate_caches()
if module in sys.modules:
del sys.modules[module]
sys.path.insert(0, module_path)
loader = importlib.find_lo... | 2.875 | 3 |
sudeste/solicitacao/views.py | danielcamilo13/sudeste | 1 | 32167 | <reponame>danielcamilo13/sudeste
from django.shortcuts import render,get_object_or_404
from django.http import HttpResponseRedirect,HttpResponse
from cadastro.models import tipocacamba
from solicitacao.models import ordemServico
from .forms import pedidosForm,opcoesForm,textoForm,statusForm
import time
from django.util... | 2.171875 | 2 |
flows.py | Privacy-Police/Differential-Privacy | 0 | 32168 | <filename>flows.py
import math
import types
import numpy as np
import scipy as sp
import scipy.linalg
import torch
import torch.nn as nn
import torch.nn.functional as F
# The following code is adapted from the following repository
# https://github.com/ikostrikov/pytorch-flows/blob/master/flows.py
def get_mask(in_fe... | 2.78125 | 3 |
render.py | danieltes/tp_solver | 0 | 32169 | <reponame>danieltes/tp_solver
import uuid
from PIL import Image
import graphviz as gv
styles = {
'graph': {
'label': 'Discreta - Representación de AST',
'fontsize': '16',
'fontcolor': 'white',
'bgcolor': '#333333',
},
'nodes': {
'fontname': 'Helvetica',
'sh... | 2.328125 | 2 |
flask/flask_r_interpolaton/app.py | andreipreda/py-r-interpolation | 0 | 32170 | import os
from pathlib import Path
from flask import Flask, current_app, jsonify, request
from flask_cors import CORS
from mongoengine import connect, MongoEngineConnectionError
import namesgenerator
from model import Doc
from app_logic import random_df, call_r
def create_app(config=None):
app = Flask(__name__)
... | 2.515625 | 3 |
Timers.py | elegenstein-tgm/astrosim | 0 | 32171 | <gh_stars>0
class Timer:
def __init__(self, duration, ticks):
self.duration = duration
self.ticks = ticks
self.thread = None
def start(self):
pass
# start Thread here
| 2.4375 | 2 |
config_mypy_django_plugin.py | fj-fj-fj/tech-store | 0 | 32172 | import os
from configurations.importer import install
from mypy.version import __version__ # noqa: F401
from mypy_django_plugin import main
def plugin(version):
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'core.settings')
os.environ.setdefault('DJANGO_CONFIGURATION', 'Development')
install()
ret... | 1.65625 | 2 |
Florence/FunctionSpace/JacobiPolynomials/NormalisedJacobi_Deprecated.py | romeric/florence | 65 | 32173 | import numpy as np
from JacobiPolynomials import *
import math
# 1D - LINE
#------------------------------------------------------------------------------------------------------------------#
#------------------------------------------------------------------------------------------------------------------#
#---------... | 2.609375 | 3 |
Homework1.py | nicolac1999/Homework-ADM | 0 | 32174 | #Exercises of the Problem 1 (77/91)
#Say "Hello, World!" With Python
print ("Hello, World!")
#Python If-Else
import math
import os
import random
import re
import sys
if __name__ == '__main__':
n = int(raw_input().strip())
if n%2==1:
print("Weird")
else:
if n>2 and n<5 :
... | 4.125 | 4 |
oms/test/test_order.py | alphamatic/amp | 5 | 32175 | <gh_stars>1-10
import logging
import helpers.hunit_test as hunitest
import oms.order as omorder
import oms.order_example as oordexam
_LOG = logging.getLogger(__name__)
class TestOrder1(hunitest.TestCase):
def test1(self) -> None:
"""
Test building and serializing an Order.
"""
or... | 2.734375 | 3 |
mindhome_alpha/erpnext/hr/doctype/leave_type/leave_type.py | Mindhome/field_service | 1 | 32176 | # Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import calendar
import frappe
from datetime import datetime
from frappe.utils import today
from frappe import _
from frappe.model.document import Docum... | 2.34375 | 2 |
data/python/pattern_10/code.py | MKAbuMattar/grammind-api | 3 | 32177 | <filename>data/python/pattern_10/code.py
#MAIN PROGRAM STARTS HERE:
num = int(input('Enter the number of rows and columns for the square: '))
for x in range(1, num + 1):
for y in range(1, num - 2 + 1):
print ('{} {} '.format(x, y), end='')
print() | 3.953125 | 4 |
vocoder.py | tapsoft/autovc | 1 | 32178 | import os
import torch
import librosa
import pickle
import soundfile as sf
from synthesis import build_model
from synthesis import wavegen
spect_vc = pickle.load(open('results.pkl', 'rb'))
device = torch.device("cuda")
model = build_model().to(device)
checkpoint = torch.load("checkpoint_step001000000_ema.pth")
model.l... | 2.328125 | 2 |
my_drawing/bouncing_ball.py | YuanMaSa/stancode-projects | 0 | 32179 | <reponame>YuanMaSa/stancode-projects
"""
File: bouncing_ball.py
Name: <NAME>
-------------------------
TODO:
"""
from campy.graphics.gobjects import GOval
from campy.graphics.gwindow import GWindow
from campy.gui.events.timer import pause
from campy.gui.events.mouse import onmouseclicked
VX = 3
DELAY = 1... | 3.515625 | 4 |
test/py/RunClientServer.py | KirinDave/powerset_thrift | 1 | 32180 | <gh_stars>1-10
#!/usr/bin/env python
import subprocess
import sys
import os
import signal
serverproc = subprocess.Popen([sys.executable, "TestServer.py"])
try:
ret = subprocess.call([sys.executable, "TestClient.py"])
if ret != 0:
raise Exception("subprocess failed")
finally:
# fixme: should check... | 2.1875 | 2 |
scripts/parse_cluster_realign.py | maojanlin/gAIRRsuite | 3 | 32181 | <reponame>maojanlin/gAIRRsuite<gh_stars>1-10
import argparse
import pickle
import os
import numpy as np
#from parse_contig_realign import mark_edit_region, variant_link_graph, haplotyping_link_graph, output_contig_correction
from parse_contig_realign import variant_link_graph, output_contig_correction, parse_CIGAR, par... | 2.40625 | 2 |
src/huntsman/pocs/observatory.py | Physarah/huntsman-pocs | 0 | 32182 | import time
from contextlib import suppress, contextmanager
from astropy import units as u
from panoptes.utils import error
from panoptes.utils.utils import get_quantity_value
from panoptes.utils.time import current_time, wait_for_events, CountdownTimer
from panoptes.pocs.observatory import Observatory
from panoptes.... | 2.03125 | 2 |
dist/urls.py | tfmt/netboot | 0 | 32183 | from django.conf.urls import url
from dist import views
urlpatterns = [
url(r'^$', views.IndexView.as_view(), name='index'),
url(r'^add$', views.AddCategoryView.as_view(), name='add_category'),
url(r'^(?P<cat_id>\d+)/$', views.CategoryView.as_view(), name='category'),
]
| 1.742188 | 2 |
src/tensorforce/tensorforce/tests/test_optimizers.py | linus87/drl_shape_optimization | 17 | 32184 | <reponame>linus87/drl_shape_optimization
# Copyright 2018 Tensorforce Team. 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.171875 | 2 |
main.py | materoy/strobe_light_coms | 0 | 32185 | <reponame>materoy/strobe_light_coms
import cv2
import numpy
import time
import iir_filter
from scipy import signal
import math
import matplotlib.pylab as pl
# This program detects and measures the frequency of strobe lights
def main():
capture = cv2.VideoCapture(0)
prev_frame = None
point_light_threshol... | 3 | 3 |
advanced/react-django/APITestProject/api/migrations/0002_auto_20210110_0406.py | rocabrera/python-learning | 3 | 32186 | # Generated by Django 3.1.5 on 2021-01-10 04:06
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('api', '0001_initial'),
]
operations = [
migrations.RenameField(
model_name='article',
old_name='descripton',
new... | 1.671875 | 2 |
easy/array/reverse_integer/reverse_integer.py | deepshig/leetcode-solutions | 0 | 32187 | import numpy
class Solution(object):
def reverse(self, x):
"""
:type x: int
:rtype: int
"""
INTMAX32 = 2147483647
if abs(x) > INTMAX32:
return 0
negative = False
if x < 0:
negative = True
x = abs(x)
str_x... | 3.40625 | 3 |
core/dbt/perf_utils.py | dcereijodo/dbt | 1 | 32188 | <filename>core/dbt/perf_utils.py
"""A collection of performance-enhancing functions that have to know just a
little bit too much to go anywhere else.
"""
from dbt.adapters.factory import get_adapter
from dbt.parser.manifest import load_manifest
from dbt.contracts.graph.manifest import Manifest
from dbt.config import Ru... | 1.914063 | 2 |
RoadDamageGAN/utils.py | ZhangXG001/RoadDamgeDetection | 7 | 32189 | <gh_stars>1-10
import tensorflow as tf
from tensorflow.contrib import slim
from scipy import misc
import os, random
import numpy as np
from glob import glob
from keras.utils import np_utils
try:
import xml.etree.cElementTree as ET #解析xml的c语言版的模块
except ImportError:
import xml.etree.ElementTree as ET
class Ima... | 2.28125 | 2 |
release/stubs.min/System/Security/AccessControl_parts/PrivilegeNotHeldException.py | tranconbv/ironpython-stubs | 0 | 32190 | class PrivilegeNotHeldException(UnauthorizedAccessException):
"""
The exception that is thrown when a method in the System.Security.AccessControl namespace attempts to enable a privilege that it does not have.
PrivilegeNotHeldException()
PrivilegeNotHeldException(privilege: str)
PrivilegeNotHeldExcepti... | 2.796875 | 3 |
apc/apc/apc_config.py | jmsung/APC | 0 | 32191 | <filename>apc/apc/apc_config.py
# -*- coding: utf-8 -*-
"""
Created on Wed Mar 13 11:30:05 2019
@author: <NAME>
"""
# config.py
import os
from pathlib import Path
from inspect import currentframe, getframeinfo
fname = getframeinfo(currentframe()).filename # current file name
current_dir = Path(fname).resolve().... | 2.09375 | 2 |
recipes/happly/all/conanfile.py | rockandsalt/conan-center-index | 562 | 32192 | from conans import ConanFile, tools
class HapplyConan(ConanFile):
name = "happly"
url = "https://github.com/conan-io/conan-center-index"
homepage = "https://github.com/nmwsharp/happly"
topics = ("conan", "happly", "ply", "3D")
license = "MIT"
description = "A C++ header-only parser for the PLY... | 2.25 | 2 |
Weather-Data-Collector/API_key.py | Sachinsingh14/Python-Projects | 1 | 32193 | <reponame>Sachinsingh14/Python-Projects
api_key = "<KEY>"
| 0.972656 | 1 |
balsam/management/commands/balsam_service.py | hep-cce/hpc-edge-service | 0 | 32194 | <reponame>hep-cce/hpc-edge-service
import os,sys,logging,multiprocessing,Queue,traceback
logger = logging.getLogger(__name__)
from django.core.management.base import BaseCommand, CommandError
from django.conf import settings
from balsam import models,BalsamJobReceiver,QueueMessage
from common import DirCleaner,log_un... | 2.015625 | 2 |
FlightPlan_DS.py | dsimmons123/tello-flight-2021 | 0 | 32195 | from djitellopy import Tello
from time import sleep
# Initialize and Connect
tello = Tello()
tello.connect()
# Takeoff and move up to 6 feet (183cm)
tello.takeoff()
tello.move_up(101)
# Move forward (east) 5 feet (152cm)
tello.move_forward(152)
sleep(.5)
# rotate 90 degrees CCW
tello.rotate_counter_clockwise(90)
#... | 2.703125 | 3 |
dd.py | GPrathap/rrt-algorithms | 0 | 32196 | import cv2
import numpy as np
import math
# img = cv2.imread('/home/geesara/Pictures/bp8OO.jpg', 0)
# img = cv2.threshold(img, 127, 255, cv2.THRESH_BINARY)[1] # ensure binary
# ret, labels = cv2.connectedComponents(img)
#
# print("Number of labels" , len(labels))
#
# def imshow_components(labels):
# # Map componen... | 3.125 | 3 |
jts/backend/review/migrations/0003_auto_20191011_1025.py | goupaz/babylon | 1 | 32197 | # Generated by Django 2.2 on 2019-10-11 17:25
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('review', '0002_auto_20191009_1119'),
]
operations = [
migrations.RenameField(
model_name='review',
old_name='is_deleted',
... | 1.609375 | 2 |
src/148.py | cloudzfy/euler | 12 | 32198 | # We can easily verify that none of the entries in the first seven
# rows of Pascal's triangle are divisible by 7:
# 1
# 1 1
# 1 2 1
# 1 3 3 1
# 1 4 6 4 1
# 1 5 10 10 5 1
# 1 6 15 20 15 6 1
# Howeve... | 2.890625 | 3 |
algorithms_in_python/_12_sorting_and_selection/examples/quick_select.py | junteudjio/algorithms_in_python | 0 | 32199 | from random import shuffle
__author__ = '<NAME>'
def quick_select(l, k, find_largest=True):
"""
return the k_th largest/smallest element of list l
Parameters
----------
l : list
k : int
find_largest : Boolean
True if return the k_th largest element False if return the k-th smalle... | 3.90625 | 4 |