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/test_core.py | blacktanktop/vivid | 0 | 38400 | from vivid.core import BaseBlock, network_hash
def test_network_hash():
a = BaseBlock('a')
b = BaseBlock('b')
assert network_hash(a) != network_hash(b)
assert network_hash(a) == network_hash(a)
c = BaseBlock('c', parent=[a, b])
hash1 = network_hash(c)
a._parent = [BaseBlock('z')]
hash... | 2.390625 | 2 |
app/app/services/forms.py | dtcooper/crazyarms | 15 | 38401 | <reponame>dtcooper/crazyarms
from django import forms
from .services import HarborService
class HarborCustomConfigForm(forms.Form):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
for section_number in range(1, HarborService.CUSTOM_CONFIG_NUM_SECTIONS + 1):
self... | 1.890625 | 2 |
deepmars/models/train_model_sys.py | utplanets/deepmars | 2 | 38402 | #!/usr/bin/env python
"""Convolutional Neural Network Training Functions
Functions for building and training a (UNET) Convolutional Neural Network on
images of the Mars and binary ring targets.
"""
from __future__ import absolute_import, division, print_function
import numpy as np
import pandas as pd
import h5py
fro... | 2.375 | 2 |
chainer_bcnn/functions/loss/noised_cross_entropy.py | yuta-hi/bayesian_unet | 36 | 38403 | from __future__ import absolute_import
from chainer import backend
from chainer import functions as F
from chainer.functions import sigmoid_cross_entropy
from chainer.functions import softmax_cross_entropy
from .sigmoid_soft_cross_entropy import sigmoid_soft_cross_entropy
def noised_softmax_cross_entropy(y, t, mc_it... | 2.59375 | 3 |
malib/value_functions/__init__.py | wwxFromTju/malib | 6 | 38404 | <reponame>wwxFromTju/malib<gh_stars>1-10
from malib.value_functions.value_function import (
MLPValueFunction,
CommNetValueFunction,
BiCNetValueFunction,
)
# __all__ = ["MLPValueFunction"]
| 1.132813 | 1 |
save_scummer/utils.py | JWCook/save-scummer | 2 | 38405 | <gh_stars>1-10
"""Generic utility functions that don't depend on other modules"""
from datetime import datetime, timedelta
from dateutil.parser import parse as parse_date
from os.path import getmtime
from pathlib import Path
from typing import Dict, Iterable, Union
from pytimeparse import parse as parse_time
StrOrPat... | 3.171875 | 3 |
bip_utils/bip/__init__.py | djmuratb/bip_utils | 1 | 38406 | # BIP39
from bip_utils.bip.bip39_ex import Bip39InvalidFileError, Bip39ChecksumError
from bip_utils.bip.bip39 import (
Bip39WordsNum, Bip39EntropyBitLen,
Bip39EntropyGenerator, Bip39MnemonicGenerator, Bip39MnemonicValidator, Bip39SeedGenerator
)
# BIP32
from bip_utils.bip.bip32_ex import Bip32KeyError, Bip32Pat... | 1.28125 | 1 |
simulation_supervised/python/run_script.py | kkelchte/simulation_supervised | 2 | 38407 | #!/usr/bin/python
"""
Run_long_script governs the running of long gazebo_ros_tensorflow simulations.
The core functionality lies in:
1. parsing the correct arguments at different levels (tensorflow dnn, gazebo environment, ros supervision)
2. different crash handling when for instance starting gazebo / tensorfl... | 2.234375 | 2 |
sample/rubrik_polaris/get_storage_object_ids_ebs.py | talmo77/rubrik-polaris-sdk-for-python | 2 | 38408 | from rubrik_polaris import PolarisClient
domain = 'my-company'
username = '<EMAIL>'
password = '<PASSWORD>)'
client = PolarisClient(domain, username, password, insecure=True)
print(client.get_storage_object_ids_ebs(tags = {"Class": "Management"}))
| 1.71875 | 2 |
lizardanalysis.py | JojoReikun/ClimbingLizardDLCAnalysis | 1 | 38409 | <filename>lizardanalysis.py
"""
LizardDLCAnalysis Toolbox
© <NAME>
© <NAME>
Licensed under MIT License
----------------------------------------------------------
for testing and debugging in pycharm:
---> Tools
---> Python Console
---> (with ipython installed):
IN[1]: import lizardanalysis
---> run commands:
IN[2]: li... | 2.015625 | 2 |
run/set_model.py | Debatrix/Qtrain | 0 | 38410 | import torch
from torch.utils.data import DataLoader
from src import qmodel, rmodel
from src.loss import IQALoss, PredictLoss
from src.framework import IQAnModel, RecognitionModel, TripRecognitionModel
from src.dataset import get_eye_dataset, EyePairDataset, FaceDataset
def set_r_model(config):
if 'r_model_name'... | 1.898438 | 2 |
logic/auth.py | enisimsar/watchtower-news | 2 | 38411 | import hashlib
import logging
import random
import string
import uuid
from mongoengine import DoesNotExist, NotUniqueError
from models.Invitation import Invitation
from models.User import User
__author__ = '<NAME>'
# from http://www.pythoncentral.io/hashing-strings-with-python/
def hash_password(password):
# u... | 2.765625 | 3 |
scripts/compare_spider.py | bayanistnahtc/seq2struct | 25 | 38412 | <filename>scripts/compare_spider.py
# Merge outputs of infer.py and other models for comparison.
# Outputs to a CSV file.
import argparse
import csv
import json
import os
from third_party.spider import evaluation
def main():
parser = argparse.ArgumentParser()
# Outputs of infer.py
parser.add_argument('-... | 2.734375 | 3 |
src/server.py | atomicfruitcake/colonel | 0 | 38413 | <gh_stars>0
import kore
# Handler called for /httpclient
async def server(req):
# Create an httpclient.
client = kore.httpclient("https://kore.io")
# Do a simple GET request.
print("firing off request")
status, body = await client.get()
print("status: %d, body: '%s'" % (status, body))
# R... | 3.1875 | 3 |
UCP/discussion/functions.py | BuildmLearn/University-Campus-Portal-UCP | 13 | 38414 | <filename>UCP/discussion/functions.py<gh_stars>10-100
"""
Functions file for discussion app
consists of common functions used by both api.py and views.py file
"""
from django.contrib.auth.models import User
from django.contrib.auth import authenticate, login
from django.core.mail import send_mail
from django.shortcuts... | 2.5 | 2 |
Tama/Plugins/tama_drawer/tamaframe.py | just-drive/Tama | 2 | 38415 | from win32ctypes.pywin32 import win32api
import win32.lib.win32con as win32con
import win32.win32gui as win32gui
from wx.lib.delayedresult import startWorker
import PIL
import wx
import wx.aui as aui
import wx.adv as adv
import wx.lib.newevent
import os
import threading
import datetime
import random
import mouse
from s... | 2.140625 | 2 |
examples/08_compute_shader.py | dougbrion/ModernGL | 0 | 38416 | <filename>examples/08_compute_shader.py
'''
example of using compute shader.
requirements:
- numpy
- imageio (for output)
'''
import os
import moderngl
import numpy as np
import imageio # for output
def source(uri, consts):
''' read gl code '''
with open(uri, 'r') as fp:
content... | 3.109375 | 3 |
src/third_party/pcap2har/main.py | ashumeow/pcaphar | 0 | 38417 | <reponame>ashumeow/pcaphar
# Copyright 2010 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requ... | 2.21875 | 2 |
chapter_2/name_cases.py | superbe/PythonCrashCourse | 0 | 38418 | <reponame>superbe/PythonCrashCourse
name = '<NAME>'
# Упражнение 3.
message = f'Hello {name}, would you like to learn some Python today?'
print(message)
# Упражнение 4.
message = f'Hello {name.lower()}, would you like to learn some Python today?'
print(message)
message = f'Hello {name.upper()}, would you like to lear... | 3.5 | 4 |
ccdproc/tests/test_ccdproc_logging.py | cdeil/ccdproc | 0 | 38419 | <filename>ccdproc/tests/test_ccdproc_logging.py
from astropy.extern import six
from astropy.tests.helper import pytest
import astropy.units as u
from ..ccdproc import create_variance, Keyword
@pytest.mark.parametrize('key', [
'short',
'toolongforfits'])
def test_log_... | 1.992188 | 2 |
harvester/sharekit/tests/factories.py | surfedushare/search-portal | 2 | 38420 | <gh_stars>1-10
import os
import factory
from datetime import datetime
from urllib.parse import quote
from django.conf import settings
from django.utils.timezone import make_aware
from sharekit.models import SharekitMetadataHarvest
class SharekitMetadataHarvestFactory(factory.django.DjangoModelFactory):
class M... | 2.1875 | 2 |
kunai/torch_utils/seed.py | mjun0812/kunai | 0 | 38421 | <reponame>mjun0812/kunai
import random
import numpy as np
import torch
def worker_init_fn(worker_id):
"""Reset numpy random seed in PyTorch Dataloader
Args:
worker_id (int): random seed value
"""
np.random.seed(np.random.get_state()[1][0] + worker_id)
def fix_seed(seed):
"""fix seed o... | 2.9375 | 3 |
paper/plots.py | vishakad/animate | 5 | 38422 | <filename>paper/plots.py
import matplotlib as mpl
import matplotlib.pyplot as plt
from matplotlib import rcParams
from matplotlib import cm
from matplotlib import gridspec
from matplotlib import colors as mplcolors
import CBcm
import numpy as np
import util
rcParams['svg.fonttype'] = 'none'
def makeColours( vals, cma... | 2.3125 | 2 |
tests/world/test_world.py | Finistere/antidote | 52 | 38423 | <reponame>Finistere/antidote<gh_stars>10-100
from typing import Callable
import pytest
from antidote import From, FromArg, Get, Service, factory, world
from antidote._compatibility.typing import Annotated
from antidote._internal.world import LazyDependency
from antidote._providers import FactoryProvider, ServiceProvi... | 2.078125 | 2 |
MessageBoard.py | dntoll/pycom-lora-mesh-with-ap | 1 | 38424 | #!/usr/bin/env python
#
# Copyright (c) 2019, Pycom Limited.
#
# This software is licensed under the GNU GPL version 3 or any
# later version, with permitted additional terms. For more information
# see the Pycom Licence v1.0 document supplied with this file, or
# available at https://www.pycom.io/opensource/licensing
... | 2.4375 | 2 |
datastrucutre/array/find_given_sum_in_array.py | abhishektyagi2912/python-dsa | 1 | 38425 | <gh_stars>1-10
def find_sum(arr, s):
curr_sum = arr[0]
start = 0
n = len(arr) - 1
i = 1
while i <= n:
while curr_sum > s and start < i:
curr_sum = curr_sum - arr[start]
start += 1
if curr_sum == s:
return "Found between {} and {}".f... | 3.625 | 4 |
Part_3_advanced/m08_abstract_protocol/abstract_class/homework_1_start/new_movies/rental_directory.py | Mikma03/InfoShareacademy_Python_Courses | 0 | 38426 | from new_movies.random_data_utility import random_generator
available_movies = random_generator.generate_random_movies(movies_number=15)
available_games = random_generator.generate_random_games()
def add_movie(movie):
available_movies.append(movie)
| 2.4375 | 2 |
mall/apps/goods/views.py | codedaliu/meiduo | 0 | 38427 | from django.shortcuts import render
# Create your views here.
from rest_framework.views import APIView
from contents.serializers import HotSKUListSerializer
from goods.models import SKU
class HomeAPIView(APIView):
pass
'''
列表数据
热销数据:应该是到哪个分类去获取哪个分类的热销数据中
1.获取分类id
2.根据id获取数据
3.将数据转化为字典
4返回相应
'''
from rest_f... | 2.03125 | 2 |
tests/test_winterspringbl.py | lamter/slavewg | 3 | 38428 | <reponame>lamter/slavewg
import slavewg
from threading import Event
from queue import Queue
def test_runLoop():
q = Queue()
s = Event()
s.set()
lbl = slavewg.LootBlackLotus(s, q)
lbl.do(lbl.pos_winterspring_mountain)
| 2.046875 | 2 |
src/sdk/python/TeraSdk.py | yvxiang/tera | 0 | 38429 | # -*- coding: utf-8 -*-
"""
Tera Python SDK. It needs a libtera_c.so
TODO(taocipian) __init__.py
"""
from ctypes import CFUNCTYPE, POINTER
from ctypes import byref, cdll, string_at
from ctypes import c_bool, c_char_p, c_void_p
from ctypes import c_int32, c_int64, c_ubyte, c_uint64
class ScanDescriptor(object):
... | 2.09375 | 2 |
thesis_scripts/train_probs_plot.py | jizongFox/kaggle-seizure-prediction | 55 | 38430 | import numpy as np
import json
import cPickle
import matplotlib.pyplot as plt
from theano import config
import matplotlib.cm as cmx
import matplotlib.colors as colors
from sklearn.metrics import roc_curve
from utils.loader import load_train_data
from utils.config_name_creator import *
from utils.data_scaler import sc... | 2.0625 | 2 |
tms_ts/tms_ts_smach/scripts/20141120_193027.py | SigmaHayashi/ros_tms_for_smart_previewed_reality | 0 | 38431 | #!/usr/bin/env python
import roslib; roslib.load_manifest('tms_ts_smach')
import rospy
import smach
import smach_ros
from smach_ros import ServiceState
from smach import Concurrence
from tms_msg_rp.srv import *
from tms_msg_ts.srv import *
def smc0():
smc0 = smach.Concurrence( outcomes=['succeeded', 'aborted'],... | 1.921875 | 2 |
google/cloud/bigtable_admin_v2/proto/bigtable_table_admin_pb2_grpc.py | ryanyuan/python-bigtable | 0 | 38432 | # Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
"""Client and server classes corresponding to protobuf-defined services."""
import grpc
from google.cloud.bigtable_admin_v2.proto import (
bigtable_table_admin_pb2 as google_dot_cloud_dot_bigtable__admin__v2_dot_proto_dot_bigtable__table__admin_... | 1.71875 | 2 |
jaeun.py | catubc/ensembles | 0 | 38433 | # <NAME> et al 2014 method for computing ensembles
#
#
#
import numpy as np
import matplotlib.pyplot as plt
import os
import scipy.stats
def PCA(X, n_components):
from sklearn import decomposition
#pca = decomposition.SparsePCA(n_components=3, n_jobs=1)
pca = decomposition.PCA(n_components=n_compon... | 2.921875 | 3 |
tests/test_analysis_status_response.py | s0b0lev/mythx-models | 0 | 38434 | <reponame>s0b0lev/mythx-models
import json
import pytest
from mythx_models.exceptions import ValidationError
from mythx_models.response import Analysis, AnalysisStatusResponse
from mythx_models.util import serialize_api_timestamp
from . import common as testdata
def assert_analysis_data(expected, analysis: Analysi... | 2.203125 | 2 |
pytorch_wide_n_deep/usingpytorch.py | whatbeg/Data-Analysis | 1 | 38435 | <gh_stars>1-10
from __future__ import print_function
import numpy as np
import dataprocessing as proc
import argparse
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
from torch.autograd import Variable
# Training settings
parser = argparse.ArgumentParser(description='BASE... | 2.21875 | 2 |
test1.py | penghangph/python | 0 | 38436 | # coding=utf-8
# 爬虫抓学校官网首页
import requests
import re
import urllib.request
from bs4 import BeautifulSoup
import os
import lxml
# 保存文件
def file_save(data, path):
if not os.path.exists(os.path.split(path)[0]):
os.makedirs(os.path.split(path)[0])
try:
with open(path, 'wb') as f:
f.writ... | 3.03125 | 3 |
setup.py | JimCircadian/model-ensembler | 4 | 38437 | import setuptools
from setuptools import setup
"""Setup module for model_ensembler
"""
with open("README.md", "r") as fh:
long_description = fh.read()
setup(
name="model-ensembler",
version="0.5.2",
author="<NAME>",
author_email="<EMAIL>",
description="Model Ensemble for batch workflows on ... | 1.34375 | 1 |
fun/fnotification/migrations/0001_initial.py | larryw3i/osp | 1 | 38438 | # Generated by Django 4.0 on 2022-01-13 10:17
import uuid
import ckeditor_uploader.fields
import django.db.models.deletion
from django.conf import settings
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
('funuser', '0004_alter_funuse... | 1.984375 | 2 |
flight_computer/lib/bq25883.py | stanford-ssi/sequoia-software | 4 | 38439 | """
`bq25883`
====================================================
CircuitPython driver for the BQ25883 2-cell USB boost-mode charger.
* Author(s): <NAME>
Implementation Notes
--------------------
"""
from micropython import const
from adafruit_bus_device.i2c_device import I2CDevice
from adafruit_... | 2.375 | 2 |
faced/const.py | hseguro/faced | 575 | 38440 | <filename>faced/const.py
import os
MODELS_PATH = os.path.join(os.path.dirname(__file__), "models")
YOLO_SIZE = 288
YOLO_TARGET = 9
CORRECTOR_SIZE = 50
| 1.453125 | 1 |
scripts/core/pass_types.py | evolving-dev/holo | 0 | 38441 | class HoloResponse:
def __init__(self, success, response=None):
self.success = success
if response != None:
self.response = response
| 2.515625 | 3 |
volatility/models.py | larrys54321/quant_corner | 0 | 38442 | import yfinance as yf
from datetime import datetime
import pandas as pd
import matplotlib.pyplot as plt
import numpy as np
from arch import arch_model
from volatility.utils import get_percent_chg
start = datetime(2000, 1, 1)
end = datetime(2020, 9, 11)
symbol = 'SPY'
tickerData = yf.Ticker(symbol)
df = tickerData.hist... | 2.734375 | 3 |
Bio/SeqUtils/lcc.py | barendt/biopython | 1 | 38443 | # Copyright 2003, 2007 by <NAME>. <EMAIL>
# All rights reserved. This code is part of the Biopython
# distribution and governed by its license.
# Please see the LICENSE file that should have been included as part
# of this package.
import math
def lcc_mult(seq,wsize):
"""Local Composition Complexity (LCC) value... | 3.15625 | 3 |
skippa/__init__.py | data-science-lab-amsterdam/skippa | 33 | 38444 | <filename>skippa/__init__.py
"""Top-level package for skippa.
The pipeline module defines the main Skippa methods
The transformers subpackage contains various transformers used in the pipeline.
"""
__author__ = """<NAME>"""
__email__ = '<EMAIL>'
from .pipeline import Skippa, SkippaPipeline, columns
| 1.484375 | 1 |
mini-scripts/Python_Casting_(float).txt.py | Web-Dev-Collaborative/PYTHON_PRAC | 5 | 38445 | x = float(1)
y = float(2.8)
z = float("3")
w = float("4.2")
print(x)
print(y)
print(z)
print(w)
# Author: <NAME>
| 2.421875 | 2 |
Grid.py | ivcafe413/corinthian-football | 0 | 38446 | import logging
import random
from collections import namedtuple
from typing import NamedTuple
from queue import PriorityQueue
from objects import BaseObject
from constants import NORTH, SOUTH, EAST, WEST
Space = namedtuple("Space", ["x", "y"])
# TODO: Big TODO - Re-implement space with z/t value for terrain???
# Sp... | 3.171875 | 3 |
BubbleSort.py | Jutraman/SortingProblem | 0 | 38447 | <reponame>Jutraman/SortingProblem<gh_stars>0
"""
Project name: SortingProblem
File name: BubbleSort.py
Description:
version:
Author: Jutraman
Email: <EMAIL>
Date: 04/07/2021 21:49
LastEditors: Jutraman
LastEditTime: 04/07/2021
Github: https://github.com/Jutraman
"""
def bubble_sort(array):
length = len(array)
... | 3.53125 | 4 |
indexerNew.py | philophilo/searchingReddit | 0 | 38448 | <filename>indexerNew.py
#!/home/master00/anaconda23/bin/python
from util import *
import argparse
import base64
import os
import json
from collections import defaultdict
# Two main type of indexes
# -- Forward index
# -- Inverted index
# Forward index
# doc1 -> [learning, python, how, to]
# doc2 -> [learning, c++]
# ... | 2.921875 | 3 |
main/cogs/commands.py | ParzivalEugene/Samurai | 4 | 38449 | <filename>main/cogs/commands.py
from types import SimpleNamespace
class Names(SimpleNamespace):
def __init__(self, dictionary, **kwargs):
super().__init__(**kwargs)
for key, value in dictionary.items():
if isinstance(value, dict):
self.__setattr__(key, Names(value))
... | 2.59375 | 3 |
scripts/practice/FB/NestedListWeightSum.py | bhimeshchauhan/competitive_programming | 0 | 38450 | <filename>scripts/practice/FB/NestedListWeightSum.py
"""
Nested List Weight Sum
You are given a nested list of integers nestedList. Each element is either an integer or a
list whose elements may also be integers or other lists.
The depth of an integer is the number of lists that it is inside of. For example,
the n... | 4.1875 | 4 |
torrenttv/utils/list_utils/__init__.py | AlexCovizzi/torrenttv | 0 | 38451 | from .flatten import flatten
__all__ = ["flatten"]
| 1.234375 | 1 |
metadeploy/api/migrations/0045_product_license_requirements.py | sfdc-qbranch/MetaDeploy | 33 | 38452 | # Generated by Django 2.1.5 on 2019-01-28 21:04
import sfdo_template_helpers.fields
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [("api", "0044_merge_20190125_1502")]
operations = [
migrations.AddField(
model_name="product",
name="li... | 1.570313 | 2 |
Zoom.py | NotSharwan/Zoom-Python-Bot | 0 | 38453 | <filename>Zoom.py
import webbrowser
import time
import datetime
def openLink(url):
webbrowser.register('chrome', None, webbrowser.BackgroundBrowser(
"C:\Program Files (x86)\Google\Chrome\Application\chrome.exe"))
webbrowser.get('chrome').open(url)
def zoomJoin(h, m, url):
for i in range(0, 365):... | 3.484375 | 3 |
syspy/io/pandasshp/pandaskml.py | systragroup/quetzal | 25 | 38454 | <reponame>systragroup/quetzal
import itertools
import json
import os
import zipfile
import kml2geojson
import pandas as pd
import shapely
from shapely import geometry
from syspy.io.pandasshp import pandasshp
from tqdm import tqdm
def list_files(path, patterns):
files = [
os.path.join(path, file)
... | 2.359375 | 2 |
utils/plots.py | vovamedentsiy/mpdnn | 0 | 38455 | <reponame>vovamedentsiy/mpdnn
import matplotlib
matplotlib.use('PS')
from matplotlib import pyplot as plt
import seaborn as sns
import numpy as np
import random
def autolabel(rects, ax, coeff = 1):
"""Attach a text label above each bar in *rects*, displaying its height."""
for rect in rects:
height... | 2.78125 | 3 |
conftest.py | dasap89/rest_accounts | 0 | 38456 | <gh_stars>0
"""Additional configuration for pytest"""
import datetime
import os
import pytest
from django.contrib.auth import get_user_model
from rest_framework.authtoken.models import Token
User = get_user_model()
# pylint: disable=redefined-outer-name,unused-argument,no-member
@pytest.fixture(scope='session')
de... | 2.234375 | 2 |
lib/rucio/db/sqla/migrate_repo/versions/35ef10d1e11b_change_index_on_table_requests.py | balrampariyarath/rucio | 1 | 38457 | """
Copyright European Organization for Nuclear Research (CERN)
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
Authors:
- <NAME>, <<EMAIL>>, 2014-2... | 1.390625 | 1 |
src/Connect.py | JurgenOS/net_node | 2 | 38458 | # -*- coding: utf-8 -*-
import time
import re
import os
import paramiko
import telnetlib
from subprocess import run, PIPE, DEVNULL
from socket import socket, AF_INET, SOCK_STREAM
from multiprocessing.pool import ThreadPool as Pool
from src.ResponseParser import ResponseParser
from src.helpers.names_and_regex import HO... | 2.1875 | 2 |
test/test_insert_documents.py | ShaneKilkelly/bedquilt | 288 | 38459 | <reponame>ShaneKilkelly/bedquilt
import testutils
import json
import string
import psycopg2
class TestInsertDocument(testutils.BedquiltTestCase):
def test_insert_into_non_existant_collection(self):
doc = {
"_id": "<EMAIL>",
"name": "<NAME>",
"age": 20
}
... | 2.65625 | 3 |
pywizard/PreEmphasizer.py | sintech/python_wizard | 28 | 38460 | from pywizard.userSettings import settings
import scipy as sp
class PreEmphasizer(object):
@classmethod
def processBuffer(cls, buf):
preEnergy = buf.energy()
alpha = cls.alpha()
unmodifiedPreviousSample = buf.samples[0]
tempSample = None
first_sample = buf.samples[0]
... | 2.4375 | 2 |
model_measuring/kamal/slim/distillation/data_free/zskt.py | Gouzhong1223/Dubhe | 1 | 38461 | <reponame>Gouzhong1223/Dubhe<filename>model_measuring/kamal/slim/distillation/data_free/zskt.py
"""
Copyright 2020 Tianshu AI Platform. 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 ... | 1.78125 | 2 |
crease_ga/shapes/vesicle/scatterer_generator.py | arthijayaraman-lab/crease-ga | 0 | 38462 | import numpy as np
import random
import numexpr as ne
def gen_layer(rin, rout, nsize):
R = 1.0
phi = np.random.uniform(0, 2*np.pi, size=(nsize))
costheta = np.random.uniform(-1, 1, size=(nsize))
u = np.random.uniform(rin**3, rout**3, size=(nsize))
theta = np.arccos( costheta )... | 2.328125 | 2 |
main.py | fmiju/fssg3 | 0 | 38463 | import pygame
from pygame.locals import *
gameState = 0
pygame.init()
while 1:
# print "state: ", gameState
# idle
if gameState == 0:
print pygame.event.get()
for event in pygame.event.get():
if (event.type == KEYDOWN and event.key == K_SPACE):
gameState = 1
# build ship
elif gameState == 1:
... | 3.34375 | 3 |
BikeAndBim.extension/BikeAnd.tab/View.panel/Edit_crop.pushbutton/script.py | appolimp/Revit_extensions_pyRevit | 4 | 38464 | <gh_stars>1-10
# coding=utf-8
from rpw import db, DB, UI, uidoc, doc, logger
def task_dialog(msg):
"""
For create task dialog with error and message
:param msg: Message for window
:type msg: str
"""
window = UI.TaskDialog('Edit crop')
window.TitleAutoPrefix = False
window.MainIcon =... | 2.625 | 3 |
dm_verity_make_ext4fs.py | bigb123/samsung-android_bootable_recovery_libdmverity | 1 | 38465 | #! /usr/bin/env python
# make_ext4fs -s -S /home/swei/p4/STA-ESG_SWEI_KLTE_ATT-TRUNK_DMV/android/out/target/product/klteatt/root/file_contexts -l 2654994432 -a system system.img.ext4 system
import os,posixpath,sys,getopt
reserve=1024*1024*32
def run(cmd):
print cmd
# return 0
return os.system(cmd)
def m... | 2.203125 | 2 |
rl/policies/action_selection_strategy.py | Sen-R/reinforcement-learning | 0 | 38466 | """Strategies for selecting actions for value-based policies."""
from abc import ABC, abstractmethod
from typing import List, Optional
from numpy.typing import ArrayLike
import numpy as np
from rl.action_selectors import (
ActionSelector,
DeterministicActionSelector,
UniformDiscreteActionSelector,
Nois... | 3.375 | 3 |
create_data_for_openke.py | nhutnamhcmus/KGC-Benchmark-Datasets | 0 | 38467 | <reponame>nhutnamhcmus/KGC-Benchmark-Datasets
import pandas as pd
import numpy as np
from argparse import ArgumentParser
parser = ArgumentParser("Python scirpt for OpenKE dataset initialization.")
parser.add_argument("--folder", default="WN18RR/",
help="Name of dataset folder.")
args = parser.parse... | 2.546875 | 3 |
tests/iter_version_dev/V1_0_0/demo.py | liguodongIOT/nlp-app-samples | 1 | 38468 | <reponame>liguodongIOT/nlp-app-samples<gh_stars>1-10
from nlp_app_samples.constants import APP_NAME
from tests.iter_version_dev.V1_0_0.classification_lr import TASK_DICT
print(APP_NAME)
print(TASK_DICT)
print("over....")
| 1.15625 | 1 |
airflow/dags/xcom_dag.py | KoiDev13/airflow_lab | 0 | 38469 | <reponame>KoiDev13/airflow_lab<filename>airflow/dags/xcom_dag.py
from airflow import DAG
from airflow.operators.bash import BashOperator
from airflow.operators.python import PythonOperator, BranchPythonOperator #Looking for a way to choose one task or another according to condition
# from airflow.operators.subdag impor... | 2.546875 | 3 |
v1/users/tests/user.py | buckyroberts/Website-API | 64 | 38470 | <filename>v1/users/tests/user.py
from unittest.mock import ANY, MagicMock, patch
from django.utils.encoding import force_bytes
from django.utils.http import urlsafe_base64_encode
from freezegun import freeze_time
from rest_framework import serializers, status
from rest_framework.reverse import reverse
from ..factori... | 2.109375 | 2 |
newbitcoin/newbitcoin/code-ch03/helper.py | tys-hiroshi/test_programmingbitcoin | 0 | 38471 | from unittest import TestSuite, TextTestRunner
import hashlib
def run(test):
suite = TestSuite()
suite.addTest(test)
TextTestRunner().run(suite)
def hash256(s):
'''two rounds of sha256'''
return hashlib.sha256(hashlib.sha256(s).digest()).digest()
| 2.515625 | 3 |
denoise.py | N11K6/Speech_DeNoiser_AE | 1 | 38472 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Program to denoise a short speech sample using a pre-trained autoencoder.
PATH_TO_TRAINED_MODEL : path to the pre-trained model (.h5)
PATH_TO_AUDIO : path to the noisy audio file (.wav)
PATH_TO_SAVE : path to save the denoised audio output (.wav)
@author: nk
"""
#%% ... | 3.078125 | 3 |
mcp2515.py | sifosifo/MCP2515LinuxDriver | 3 | 38473 | #!/usr/bin/python
import spidev
class mcp2515:
SPI_RESET = 0xC0
SPI_READ = 0x03
SPI_READ_RX = 0x90
SPI_WRITE = 0x02
SPI_WRITE_TX = 0x40
SPI_RTS = 0x80
SPI_READ_STATUS = 0xA0
SPI_RX_STATUS = 0xB0
SPI_BIT_MODIFY = 0x05
#/* Configuration Registers */
CANSTAT = 0x0E
CANCTRL = 0x0F
BFPCTRL ... | 1.632813 | 2 |
model/grouptrack.py | janhradek/regaudio | 0 | 38474 | import sqlalchemy
from .base import Base
from .track import Track
import model.tracktime
class GroupTrack(Base):
'''
a link between group and track (association pattern)
backrefs group and track (not listed here)
To use this first create the group, then group tracks,
then tracks and add them to ... | 2.71875 | 3 |
LeetCodeSolver/pythonSolutions/from201to300/Solution213.py | ZeromaXHe/Learning-Platform | 0 | 38475 | <reponame>ZeromaXHe/Learning-Platform
from typing import List
class Solution:
"""
213.打家劫舍II | 难度:中等 | 标签:动态规划
你是一个专业的小偷,计划偷窃沿街的房屋,每间房内都藏有一定的现金。这个地方所有的房屋都 围成一圈 ,这意味着第一个房屋和最后一个房屋是紧挨着的。同时,相邻的房屋装有相互连通的防盗系统,如果两间相邻的房屋在同一晚上被小偷闯入,系统会自动报警 。
<p>
给定一个代表每个房屋存放金额的非负整数数组,计算你 在不触动警报装置的情况下 ,能够偷窃到的最高金额。
<p>
... | 4 | 4 |
dialogs.py | 6dba/async-telegram-bot | 0 | 38476 | <gh_stars>0
from dataclasses import dataclass
from aiogram.types import ReplyKeyboardRemove, \
ReplyKeyboardMarkup, KeyboardButton, \
InlineKeyboardMarkup, InlineKeyboardButton
"""Диалоги бота"""
@dataclass(frozen=True)
class Messages:
SMILE = ['🤷♀️','🧐','🤷♂️','🤔','😐','🤨','🤯','🥱',... | 2.890625 | 3 |
reflexy/base/tests/test_reflex.py | eso/reflexy | 0 | 38477 | import unittest
from reflexy.base import reflex
class TestReflexModule(unittest.TestCase):
sof = 'datasetname|file1.fits;PRO_CATG1;PURPOSE1:PURPOSE2,file2;' \
'PRO_CAT2;PURPOSE1'
sopexp = [('long_param1', '3'), ('param2', '3'), ('param3', 'ser'),
('param_not_shown', 'none')]
sop = ... | 2.59375 | 3 |
usaspending_api/common/tests/test_limitable_serializer.py | truthiswill/usaspending-api | 0 | 38478 | <reponame>truthiswill/usaspending-api<filename>usaspending_api/common/tests/test_limitable_serializer.py
import pytest
import json
from model_mommy import mommy
from usaspending_api.awards.models import Award
@pytest.fixture
def mock_limitable_data():
mommy.make(Award, _fill_optional=True)
@pytest.mark.django... | 2.09375 | 2 |
luigi/contrib/__init__.py | Mappy/luigi | 2 | 38479 | """Package containing optional and-on functionality.""" | 0.933594 | 1 |
ronny/runner.py | ynop/ronny | 0 | 38480 | import sys
import argparse
import os
import re
import yaml
from . import workflow
class Runner(object):
tasks = [
]
out_and_cache_subfolder_with_sumatra_label = True
def run(self):
parser = argparse.ArgumentParser(description='Run workflow')
parser.add_argument('config_path', type... | 2.53125 | 3 |
src/Query/apifuzz.py | codexgigassys/codex-backend | 161 | 38481 | # Copyright (C) 2016 <NAME>.
# This file is part of CodexGigas - https://github.com/codexgigassys/
# See the file 'LICENSE' for copying permission.
import pathmagic
from pymongo import MongoClient
import ssdeep
from env import envget
def searchFuzzy(fuzz, limit, thresh):
client = MongoClient(envget('metadata.host... | 2.328125 | 2 |
sample_dmatrix.py | daimeng/py-geode | 0 | 38482 | <filename>sample_dmatrix.py
import aiohttp
import pandas as pd
import sys
import asyncio
from geode.dispatcher import AsyncDispatcher
async def main():
client = await AsyncDispatcher.init()
origins_file = sys.argv[1]
destinations_file = sys.argv[2]
origf = pd.read_csv(origins_file)[['lat', 'lon']].r... | 2.484375 | 2 |
yasql/apps/sqlorders/urls.py | Fanduzi/YaSQL | 443 | 38483 | <reponame>Fanduzi/YaSQL
# -*- coding:utf-8 -*-
# edit by fuzongfei
from django.urls import path
from sqlorders import views
urlpatterns = [
# SQL工单
path('envs', views.GetDBEnvironment.as_view(), name='v1.sqlorders.db-environment'),
path('schemas', views.GetDbSchemas.as_view(), name='v1.sqlorders.db-schem... | 1.890625 | 2 |
pandacommon/pandautils/thread_utils.py | PanDAWMS/panda-common | 1 | 38484 | <gh_stars>1-10
import os
import threading
import socket
import datetime
import random
import multiprocessing
class GenericThread(threading.Thread):
def __init__(self, **kwargs):
threading.Thread.__init__(self, **kwargs)
self.hostname = socket.gethostname()
self.os_pid = os.getpid()
d... | 2.578125 | 3 |
09WebFramework/day04/basic04.py | HaoZhang95/PythonAndMachineLearning | 937 | 38485 | <reponame>HaoZhang95/PythonAndMachineLearning
"""
ORM是django的核心思想, object-related-mapping对象-关系-映射
ORM核心就是操作数据库的时候不再直接操作sql语句,而是操作对象
定义一个类,类中有uid,username等类属型,sql语句insert修改的时候直接插入这个User对象
"""
# ORM映射实现原理,通过type修改类对象信息
# 定义这个元类metaclass
class ModelMetaclass(type):
def __new__(cls, name, bases, attrs):
... | 3.015625 | 3 |
eventi/core/admin.py | klebercode/lionsclub | 1 | 38486 | <filename>eventi/core/admin.py
# coding: utf-8
from django.contrib import admin
from eventi.core.models import Club, Info
admin.site.register(Club)
admin.site.register(Info)
| 1.117188 | 1 |
LAB/05/0530_PyMongo.py | LegenDad/KTM_Lab | 0 | 38487 | <reponame>LegenDad/KTM_Lab
# -*- coding: utf-8 -*-
"""
Created on Thu May 31 09:09:26 2018
@author: Jeon
"""
!pip search pymongo
!pip install pymongo
import pymongo
mgclient = pymongo.MongoClient("localhost", 27017)
# check start mogodb (mongod)
mgclient.database_names()
testdb = mgclient.testdb
testdb_col = testdb... | 2.484375 | 2 |
src/animasnd/image.py | N-z0/commonz | 0 | 38488 | <reponame>N-z0/commonz
#!/usr/bin/env python3
#coding: utf-8
### 1st line allows to execute this script by typing only its name in terminal, with no need to precede it with the python command
### 2nd line declaring source code charset should be not necessary but for exemple pydoc request it
__doc__ = "provide images... | 2 | 2 |
scripts/buildrpm.py | fstab50/branchdiff | 2 | 38489 | #!/usr/bin/env python3
"""
Summary:
buildrpm (python3): branchdiff binary operating system package (.rpm, Redhat, Redhat-based systems)
- Automatic determination of version to be built
- Build version can optionally be forced to a specific version
- Resulting rpm ackage produced in packagi... | 2.171875 | 2 |
agent/td3mt.py | xuzhiyuan1528/KTM-DRL | 10 | 38490 | import torch
import torch.nn.functional as F
from agent.td3 import TD3
class TD3MT(TD3):
def __init__(self,
state_dim,
action_dim,
max_action,
num_env,
discount=0.99,
tau=0.005,
policy_noise=0.2... | 2.28125 | 2 |
chrony/timespans.py | gtnx/chrony | 3 | 38491 | <filename>chrony/timespans.py
# -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function, unicode_literals
import pandas as pd
from .exceptions import BadLengthsError, BegPosteriorToEndError, OverlapError, NotSortedError, IntegrityError, HasTimezoneError
def audit_timespan(begs, ends)... | 2.609375 | 3 |
Text/TextQualityWatchdog/Watchdog/__init__.py | iii-PaulCridland/azure-search-power-skills | 128 | 38492 | # Standard libraries
import os
import json
import logging
from typing import Text
# Azure functions
import azure.functions as func
# Inference runtime
import onnxruntime as ort
from tokenizers import BertWordPieceTokenizer
# Helper scripts
from .PreprocessData import normalize_text, truncate_text
from .Predict impor... | 2.71875 | 3 |
pypy/jit/backend/x86/test/test_quasiimmut.py | benoitc/pypy | 1 | 38493 |
import py
from pypy.jit.backend.x86.test.test_basic import Jit386Mixin
from pypy.jit.metainterp.test import test_quasiimmut
class TestLoopSpec(Jit386Mixin, test_quasiimmut.QuasiImmutTests):
# for the individual tests see
# ====> ../../../metainterp/test/test_loop.py
pass
| 1.453125 | 1 |
QPC/ELMo_QPC/utils.py | tifoit/QGforQA | 95 | 38494 | import tensorflow as tf
def get_record_parser_qqp(config, is_test=False):
def parse(example):
ques_limit = config.test_ques_limit if is_test else config.ques_limit
features = tf.parse_single_example(example,
features={
... | 2.453125 | 2 |
oil.py | briwilcox/rnkr-oil | 1 | 38495 | import numpy
import requests
import Quandl
import datetime
from pyrnkr.application import App
from pyrnkr.widgets import Line
from pyrnkr.formula import Trace
def extract_date_index(ts, format='%Y-%m-%d'):
return [x.strftime(format) for x in ts.index.tolist()]
class oil(App):
# This must be consistent with c... | 2.46875 | 2 |
code_doc/migrations/0004_auto_20141110_1508.py | coordt/code_doc | 0 | 38496 | <reponame>coordt/code_doc
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [("code_doc", "0003_auto_20141107_1708")]
operations = [
migrations.RemoveField(model_name="project", name="descri... | 1.273438 | 1 |
source/piclient/camerapi/camerahandler_faker.py | rveshovda/pifog | 1 | 38497 | <reponame>rveshovda/pifog
def capture_high_res(filename):
return "./camerapi/tmp_large.jpg"
def capture_low_res(filename):
return "./camerapi/tmp_small.jpg"
def init():
return
def deinit():
return
| 1.6875 | 2 |
parallel/__init__.py | MSU-MLSys-Lab/CATE | 15 | 38498 | <gh_stars>10-100
from .parallel import DataParallelModel, DataParallelCriterion
__all__ = ["DataParallelModel", "DataParallelCriterion"] | 1.179688 | 1 |
accounts/serializers.py | aniruddha2000/foodfeeda | 0 | 38499 | from django.contrib.auth.password_validation import validate_password
from django.contrib.auth.tokens import PasswordResetTokenGenerator
from django.utils.encoding import force_str
from django.utils.http import urlsafe_base64_decode
from rest_framework.exceptions import AuthenticationFailed
from rest_framework.serializ... | 2.109375 | 2 |