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 |
|---|---|---|---|---|---|---|
Lib/objc/MetalKit.py | kanishpatel/Pyto | 0 | 39600 | <gh_stars>0
'''
Classes from the 'MetalKit' framework.
'''
try:
from rubicon.objc import ObjCClass
except ValueError:
def ObjCClass(name):
return None
def _Class(name):
try:
return ObjCClass(name)
except NameError:
return None
MTKViewDisplayLinkTarget = _Class('MTKViewDi... | 2.015625 | 2 |
mzitu_page.py | swiftlc/python_meizi_reptile | 0 | 39601 | import requests
from bs4 import BeautifulSoup
import os
import shutil
import threading
import uuid
import time
import sys
import helper
import threadpool
import mzitu_frame
def __task(url):
#print(url)
while not mzitu_frame.DownloadImage(url):pass
def DownloadImagePage(url):
bs = helper.GetBs(url)
#... | 2.765625 | 3 |
vnpy/trader/dbHistory/historyDataFile/__init__.py | chenzj810/vnpy-stock | 2 | 39602 | # encoding: UTF-8
| 1.078125 | 1 |
eden/cli/test/interp_test.py | jmswen/eden | 0 | 39603 | <reponame>jmswen/eden<filename>eden/cli/test/interp_test.py
#!/usr/bin/env python3
#
# Copyright (c) 2016-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree. An additional grant
# of patent rig... | 2.34375 | 2 |
tests/unit/connection_test.py | ArthurKamalov/scalyr-agent-2 | 67 | 39604 | <reponame>ArthurKamalov/scalyr-agent-2<gh_stars>10-100
# Copyright 2014-2020 Scalyr 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
#
# U... | 1.65625 | 2 |
tests/oauth1/client.py | ashleysommer/sanic-oauthlib | 2 | 39605 | from inspect import isawaitable
from sanic import Sanic
from sanic.response import redirect, json, text
from sanic.exceptions import SanicException
from sanic_plugin_toolkit import SanicPluginRealm
from sanic_oauthlib.client import oauthclient
def create_oauth(app):
realm = SanicPluginRealm(app)
try:
... | 2.015625 | 2 |
lph/IntentLearner.py | PhilippeMorere/learning-to-plan-hierarchically | 6 | 39606 | <gh_stars>1-10
from functools import reduce
from operator import add
from lph.IntentPlanner import IntentPlanner
from lph.Skill import SkillBase, Skill, PrimitiveSkill
from lph.utils import SparseState, Effect
class IntentLearner:
def __init__(self, primitive_skills, planner_max_rec=3, verbose=1):
"""
... | 2.703125 | 3 |
linear_ucb.py | nizamphoenix/Bandits | 0 | 39607 | from mab import MAB
class LinUCB(MAB):
"""
Contextual multi-armed bandit (LinUCB) implenting algorithm in http://rob.schapire.net/papers/www10.pdf
Arguments
========
narms : int
number of arms
ndims : int
number of dimensions for each arm's context i.e length of context ve... | 2.9375 | 3 |
plugins_/open_package.py | calculuswhiz/PackageDev | 0 | 39608 | <gh_stars>0
import glob
import os
import sublime
import sublime_plugin
from .create_package import _open_folder_in_st, _is_override_package
__all__ = ('PackagedevOpenPackageCommand',)
OVERRIDE_SUFFIX = " [*Override*]"
def _list_normal_packages():
pkgspath = sublime.packages_path()
folders = glob.glob(os.p... | 2.609375 | 3 |
examples/demo/quiver.py | ContinuumIO/chaco | 3 | 39609 | <gh_stars>1-10
"""
Draws a vector or "quiver" plot of a set of random points.
- Left-drag pans the plot.
- Mousewheel up and down zooms the plot in and out.
- Pressing "z" brings up the Zoom Box, and you can click-drag a rectangular
region to zoom. If you use a sequence of zoom boxes, pressing alt-left-arrow
... | 3.140625 | 3 |
resolwe/flow/executors/local/run.py | JureZmrzlikar/resolwe | 0 | 39610 | <gh_stars>0
""".. Ignore pydocstyle D400.
.. autoclass:: resolwe.flow.executors.local.run.FlowExecutor
"""
import asyncio
import logging
import os
import shlex
from asyncio import subprocess
from ..run import BaseFlowExecutor
logger = logging.getLogger(__name__)
class FlowExecutor(BaseFlowExecutor):
"""Local ... | 2.234375 | 2 |
affectnet.py | orena1/DAN | 50 | 39611 | import os
import glob
from tqdm import tqdm
import argparse
from PIL import Image
import numpy as np
import pandas as pd
import torch
import torch.nn as nn
import torch.utils.data as data
from torchvision import transforms, datasets
from networks.dan import DAN
def parse_args():
parser = argparse.ArgumentParse... | 2.34375 | 2 |
main.py | Dropout1337/ComboWatermarker | 6 | 39612 | import os
import keyboard
banner = '''\u001b[34m____ ____ _ _ ___ ____ _ _ _ ____ ___ ____ ____ _ _ ____ ____ _ _
| | | |\/| |__] | | | | | |__| | |___ |__/ |\/| |__| |__/ |_/
|___ |__| | | |__] |__| |_|_| | | | |___ | \ | | | | | \ | \_ \u001b[37m'''
class Watermark():
def ... | 3.015625 | 3 |
fixtures/webui_test.py | rombie/contrail-test | 0 | 39613 | from netaddr import IPNetwork
from selenium import webdriver
from pyvirtualdisplay import Display
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.support.ui import WebDriverWait
from selenium.common.exceptions import WebDriverException
import time
import random
import fixtures
from ipam_test imp... | 2.0625 | 2 |
generate_readme.py | mlazaric/Chebyshev | 14 | 39614 | #! /bin/python
import re
from sympy import exp, ln, sin, cos
from sympy.abc import x
from chebyshev.approximation import get_best_approximation
table_of_contents = []
function_entries = []
def generate_for_readme(approximation):
function_filename = re.sub(r'( |/)', '_', str(approximation.function))
approxim... | 2.578125 | 3 |
tests/test_datasets.py | gau-nernst/CenterNet | 47 | 39615 | <reponame>gau-nernst/CenterNet
import random
import pytest
import numpy as np
import torch
from torch.utils.data import DataLoader
from centernet_lightning.datasets import COCODataset, VOCDataset, CrowdHumanDataset, MOTTrackingSequence, MOTTrackingDataset, KITTITrackingSequence, KITTITrackingDataset
from centernet_li... | 2.125 | 2 |
docs/run.py | imrehg/dash-bootstrap-components | 1 | 39616 | <reponame>imrehg/dash-bootstrap-components<filename>docs/run.py
from werkzeug.middleware.dispatcher import DispatcherMiddleware
from components_page import register_apps as register_component_apps
from examples import register_apps as register_example_apps
from markdown_to_html import convert_all_markdown_files
from s... | 1.796875 | 2 |
myia/operations/op_array_getitem_wrap.py | strint/myia | 222 | 39617 | """Implementation of the 'array_getitem_wrap' operation."""
from ..lib import Slice, core, myia_static
from ..operations import array_getitem, reshape
def _dim_explicit(dim, dim_size):
if dim < 0:
dim = dim_size + dim
assert dim >= 0
return dim
@myia_static
def _build_slices(a_shp, item):
b... | 2.65625 | 3 |
fledgling/app/entity/task.py | PracticalCleanArchitecture/fledgling | 1 | 39618 | # -*- coding: utf8 -*-
from abc import ABC, abstractmethod
from datetime import datetime
from enum import Enum
from typing import List, Optional, Tuple, Union
class TaskRepositoryError(Exception):
pass
class TaskStatus(Enum):
CREATED = 1
FINISHED = 2
class Task:
def __init__(self):
self.br... | 2.78125 | 3 |
turbustat/tests/test_vca.py | keflavich/TurbuStat | 0 | 39619 | # Licensed under an MIT open source license - see LICENSE
'''
Test functions for VCA
'''
from unittest import TestCase
import numpy as np
import numpy.testing as npt
from ..statistics import VCA, VCA_Distance
from ._testing_data import \
dataset1, dataset2, computed_data, computed_distances
class testVCA(Test... | 2.734375 | 3 |
ElectroWeakAnalysis/ZMuMu/python/ZMuMuCategoriesPlots_cff.py | SWuchterl/cmssw | 6 | 39620 | import FWCore.ParameterSet.Config as cms
from ElectroWeakAnalysis.ZMuMu.ZMuMuCategoriesSequences_cff import *
import copy
zPlots = cms.PSet(
histograms = cms.VPSet(
cms.PSet(
min = cms.untracked.double(0.0),
max = cms.untracked.double(200.0),
nbins = cms.untracked.int32(200),
name = cms.untra... | 1.632813 | 2 |
pages/index.py | cshields143/unit2project | 0 | 39621 | <gh_stars>0
# Imports from 3rd party libraries
import dash
import dash_bootstrap_components as dbc
import dash_core_components as dcc
import dash_html_components as html
from dash.dependencies import Input, Output
import plotly.express as px
# Imports from this application
from app import app
layout = dbc.Col([
... | 2.421875 | 2 |
applications/tensorflow/contrastive_divergence_vae/utils/train_utils.py | Splendon/examples | 0 | 39622 | # Copyright 2019 Graphcore Ltd.
# coding=utf-8
import tensorflow as tf
from utils.optimisers import VcdRMSPropOptimizer
def vcd_lr_schedule(base_lr, current_step, total_steps, n_epoch, iter_timescale=15000, decay_factor=0.9):
"""
Exponential LR decay: lr <- lr * 0.9 applied every 15000 iterations
"""
... | 2.34375 | 2 |
batch_jobs/ewas_predictions/python_caller_features.py | Deep-Learning-and-Aging/Scalars-based-models-and-XWAS-pipeline | 0 | 39623 |
import sys
import os
if sys.platform == 'linux':
sys.path.append('/n/groups/patel/samuel/Aging')
elif sys.platform == 'darwin':
sys.path.append('/Users/samuel/Desktop/Aging')
from aging.model.environment_predictor import EnvironmentPredictor
name = sys.argv[1]
n_iter = int(sys.argv[2])
target_dataset = sy... | 2.46875 | 2 |
packages/watchmen-pipeline-surface/src/watchmen_pipeline_surface/connectors/__init__.py | Indexical-Metrics-Measure-Advisory/watchmen | 0 | 39624 | <filename>packages/watchmen-pipeline-surface/src/watchmen_pipeline_surface/connectors/__init__.py
from .kafka import init_kafka, KafkaSettings
from .rabbitmq import init_rabbitmq, RabbitmqSettings
| 0.980469 | 1 |
test.py | KKN18/ViT-pytorch | 0 | 39625 | # coding=utf-8
from __future__ import absolute_import, division, print_function
import logging
import argparse
import os
import random
import numpy as np
from datetime import timedelta
import torch
import torch.distributed as dist
from tqdm import tqdm
from torch.utils.tensorboard import SummaryWriter
from apex imp... | 2 | 2 |
data/scons/icl12.py | mmanzi/gradientdomain-mitsuba | 92 | 39626 | <reponame>mmanzi/gradientdomain-mitsuba
import os, sys, subprocess, copy, re
def get_output(script, args = None, shellenv = None):
if sys.platform == 'win32':
cmdLine = '"%s" %s & set' % (script, (args if args else ''))
shell = False
elif sys.platform.startswith('linux'):
cmdLine = 'source "%s" %s ; set' % (sc... | 2.359375 | 2 |
src/backend/expungeservice/test/test_expunger.py | htharker42/recordExpung | 0 | 39627 | <filename>src/backend/expungeservice/test/test_expunger.py
import datetime
import copy
import unittest
from expungeservice.expunger import *
def test_statute():
tests = [
[[113, 45], '113.045'],
[[113, 45, 5], '113.045(5)'],
[[113, 45, 5, 'd'], '113.045(5)(d)'],
]
for t in tests:
... | 2.90625 | 3 |
django_tutorial/views/error_views.py | twtrubiks/django-tutorial | 431 | 39628 | <reponame>twtrubiks/django-tutorial
from django.shortcuts import render
def view_404(request):
return render(request, 'django_tutorial/error_pages/page_404.html', status=404)
def view_500(request):
return render(request, 'django_tutorial/error_pages/page_500.html', status=500)
| 2.234375 | 2 |
IMDB Sentiment Analysis using LSTMs, CNNs and BERT/main.py | lucalaringe/pytorch-examples | 1 | 39629 | <filename>IMDB Sentiment Analysis using LSTMs, CNNs and BERT/main.py<gh_stars>1-10
# importing the libraries I need
import numpy as np
import matplotlib.pyplot as plt
import pickle
import os
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.nn.utils.rnn import pack_padded_sequence, pad_packe... | 2.828125 | 3 |
pooch/tests/test_hashes.py | rabernat/pooch | 0 | 39630 | # Copyright (c) 2018 The Pooch Developers.
# Distributed under the terms of the BSD 3-Clause License.
# SPDX-License-Identifier: BSD-3-Clause
#
# This code is part of the Fatiando a Terra project (https://www.fatiando.org)
#
# pylint: disable=redefined-outer-name
"""
Test the hash calculation and checking functions.
""... | 1.75 | 2 |
TemplateEngineForRESP-F3T/RoofFunctions/trigonometric_function.py | riku-sakamoto/RESP-ProgramTips | 1 | 39631 | # -*- coding:utf-8 -*-
import numpy as np
def sin_sin(x,y):
return 1000*abs(np.sin(x/2000*np.pi) + np.sin(y/2000.0*np.pi))+100
| 3.15625 | 3 |
tidal_precession.py | ddeb32/APR_Testing | 0 | 39632 | <reponame>ddeb32/APR_Testing
#####################################################################
### Evaluating the tidal component to the precession rate ###
#####################################################################
import numpy as np
import pandas as pd
from numpy import pi
from scipy import ... | 2.578125 | 3 |
appcred.py | tamalsaha/keystone-demo | 1 | 39633 | #!/usr/bin/python
from keystoneauth1.identity import v3
from keystoneauth1 import session
from keystoneclient.v3 import client
from pprint import pprint
import os
def main():
AUTH_URL = os.getenv('OS_AUTH_URL')
USERNAME = os.getenv('OS_USERNAME')
USER_DOMAIN_NAME = os.getenv('OS_USER_DOMAIN_NAME')
PASSWD = <PASSW... | 2.109375 | 2 |
data/admin.py | FSavoy/visuo-server | 2 | 39634 | <gh_stars>1-10
from django.contrib.gis import admin
# Register your models here.
from models import SkyPicture, MeasuringDevice, WeatherMeasurement, RadiosondeMeasurement
from django.contrib.gis import forms
# Custom interface for selecting the location of devices
class MeasuringDeviceAdminForm(forms.ModelForm):
... | 1.96875 | 2 |
setup.py | ilkka/nap | 31 | 39635 | <reponame>ilkka/nap
#!/usr/bin/env python
from pip.req import parse_requirements
# parse_requirements() returns generator of pip.req.InstallRequirement objects
install_reqs = parse_requirements('requirements.txt')
# reqs is a list of requirement
# e.g. ['django==1.5.1', 'mezzanine==1.4.6']
reqs = [str(ir.req) for ir... | 1.960938 | 2 |
ivy/functional/backends/jax/statistical.py | odehDanOps/ivy | 0 | 39636 | <gh_stars>0
# global
import jax.numpy as jnp
from typing import Tuple, Union
# Array API Standard #
# -------------------#
def min(x: jnp.ndarray,
axis: Union[int, Tuple[int]] = None,
keepdims = False, device = None) \
-> jnp.ndarray:
return jnp.min(a = jnp.asarray(x), axis = axis, keepdi... | 2.421875 | 2 |
tests/generate_new_site/utilities/test_tables.py | aychen99/Excavating-Occaneechi-Town | 1 | 39637 | <gh_stars>1-10
from unittest import mock
from unittest.mock import patch
from src.generate_new_site.utilities import tables
from pathlib import Path
###############################
# PathTable integration tests #
###############################
def test_pathtable_register_and_gets():
pathtable = tables.PathTable... | 2.328125 | 2 |
tools/dnase/wellingtonAnalysis.py | globusgenomics/galaxy | 1 | 39638 | <reponame>globusgenomics/galaxy
import sys
import pyDNase
import pyDNase.footprinting as fp
import subprocess
import os
if __name__ == "__main__":
#There should be two input files:
#1. original .bam file
#2. fseq output .bed file
#3. folder needs to contain .bam.bai file for reference
input_bed_n... | 2.328125 | 2 |
idiotic/util/blocks/http.py | idiotic/idiotic | 7 | 39639 | <reponame>idiotic/idiotic
import logging
from urllib.parse import urlparse, urlunparse
from idiotic import block
from idiotic.util.resources import http
import aiohttp
import asyncio
import json
import types
log = logging.getLogger(__name__)
class HTTP(block.Block):
def __init__(self, name, url, method="GET",... | 2.65625 | 3 |
chapter9/msfrpc/msfrpc_connect.py | abbbhucho/Mastering-Python-for-Networking-and-Security | 98 | 39640 | <gh_stars>10-100
# -*- encoding: utf-8 -*-
import msfrpc
client = msfrpc.Msfrpc({'uri':'/msfrpc', 'port':'5553', 'host':'127.0.0.1', 'ssl': True})
auth = client.login('msf','password')
if auth:
print str(client.call('core.version'))+'\n'
print str(client.call('core.thread_list', []))+'\n'
print str(client.c... | 1.90625 | 2 |
examples/anagrams_demo.py | aathi2002/open-tamil | 218 | 39641 | import codecs
from solthiruthi.dictionary import *
from tamil import wordutils
TVU, TVU_size = DictionaryBuilder.create(TamilVU)
ag, ag2 = wordutils.anagrams_in_dictionary(TVU)
with codecs.open("demo.txt", "w", "utf-8") as fp:
itr = 1
for k, c in ag:
v = ag2[k]
fp.write("%03d) %s\n" % (itr, " ... | 3 | 3 |
examples/notiltangle.py | jckw/Adafruit_LSM9DS0 | 6 | 39642 | <gh_stars>1-10
# Simple example whereby the angle is calculated, assuming the magnetometer is flat,
# i.e. there is no tilt-compensation.
# Author: <NAME>
# License: Public Domain
import math
import time
# Import the LSM9DS0 module
import Adafruit_LSM9DS0
# Create new LSM9DS0 instance
imu = Adafruit_LSM9DS0.LSM9DS0()... | 3.359375 | 3 |
proj/python/opencvtest/Test/FaceCountingCCTV-master/CCTV-Code.py | joalvis777/c-through | 0 | 39643 | import numpy as np
import datetime
import smtplib
import logging
import time
import csv
import cv2
print ("======================START======================")
all_count = 0 #Checking finding count
true_count = 0 #Checking detection count
#open result CSV file
file = open('./result/res_Insert_name.csv', 'w')
#... | 2.6875 | 3 |
Scraping/Code/scraping_tools.py | Jhagrut/Sports-Bot | 0 | 39644 | """
Scraping Tools
Provides all tools for getting data onto/off the pi and submitting back to google drive.
"""
from pydrive.auth import GoogleAuth
from pydrive.drive import GoogleDrive
import requests
import time
# for twint
import twint
import nest_asyncio
def download_file_from_google_drive(id, destination):
... | 3.140625 | 3 |
tests/api/test_rest.py | oarepo/oarepo-communities | 0 | 39645 | <reponame>oarepo/oarepo-communities<gh_stars>0
# -*- coding: utf-8 -*-
#
# Copyright (C) 2021 CESNET.
#
# OARepo-Communities is free software; you can redistribute it and/or modify
# it under the terms of the MIT License; see LICENSE file for more details.
"""OArepo module that adds support for communities"""
from fla... | 1.96875 | 2 |
code/datasets/adult.py | eth-sri/lcifer | 23 | 39646 | <filename>code/datasets/adult.py
from os import path
from urllib import request
import numpy as np
import pandas as pd
import torch
from sklearn.model_selection import train_test_split
from datasets import AbstractDataset
class AdultDataset(AbstractDataset):
column_names = [
'age', 'workclass', 'fnlwgt'... | 3.09375 | 3 |
data/kitti_raw_loader.py | infinityofspace/SfmLearner-Pytorch | 908 | 39647 | from __future__ import division
import numpy as np
from path import Path
from imageio import imread
from skimage.transform import resize as imresize
from kitti_util import pose_from_oxts_packet, generate_depth_map, read_calib_file, transform_from_rot_trans
from datetime import datetime
class KittiRawLoader(object):
... | 2.125 | 2 |
process_patient_data/draw_general_samples.py | ChrisSheng97/hackauton | 1 | 39648 | import pickle
import numpy as np
import feature_extraction as fe
""" source : https://www.census.gov/quickfacts/fact/table/alleghenycountypennsylvania/PST045216 """
CURR_YEAR = 2015
# gender
FEMALE_PERCENT = 0.517 # 4327
# MALE = 0.483 # 3134
# age
# BELOW_18 = 0.189 # 0
OVER_65_PERCENT = 0.18 # 4353
# OTHER = 0.631 #... | 3.25 | 3 |
1 Semestre/Analise e Projeto de Algoritmos (Mauricio)/Aula 5 Aplicacoes com Selecao/Exercicio 8.py | LukasHeidern/Univem-Aulas | 0 | 39649 | <reponame>LukasHeidern/Univem-Aulas
'''8) Elabore um algoritmo que leia 3 valores inteiros (a,b e c) e os coloque em
ordem crescente, de modo que em a fique o menor valor, em b o valor intermediário e
em c o maior valor. '''
a = int(input("Digite o valor do primeiro valor: "))
b = int(input("Digite o valor do segun... | 3.890625 | 4 |
python_developer_tools/machinelearning/knn.py | carlsummer/python_developer_tools | 32 | 39650 | # !/usr/bin/env python
# -- coding: utf-8 --
# @Author zengxiaohui
# Datatime:8/20/2021 8:39 AM
# @File:knn
from sklearn.model_selection import train_test_split
from sklearn.neighbors import KNeighborsClassifier
from sklearn import datasets
X, y = datasets.load_iris(return_X_y=True)
X_train, X_test, y_train, y_test = t... | 3.296875 | 3 |
test/basemodule_test.py | nktankta/PytorchCNNModules | 0 | 39651 | <filename>test/basemodule_test.py
import pytest
import torch
import torch.nn as nn
from module_list import get_test_module
from PytorchCNNModules.modules.base_module import BaseModule,SEmodule
class CNN(BaseModule):
def __init__(self,in_feature,out_featue,stride=1):
super(CNN,self).__init__(in_feature,out_... | 2.34375 | 2 |
experiments/rex_example.py | aws-samples/aws-lex-retrieval-extraction-lm-pt | 1 | 39652 | <gh_stars>1-10
import os
import gc
import sys
import copy
import psutil
import torch
import gzip
import json
import glob
import random
from collections import Counter
from functools import partial
from multiprocessing import Pool
from os import listdir
from os.path import isfile, join
from tqdm import tqdm, trange
fro... | 1.867188 | 2 |
LeetcodeAlgorithms/491. Increasing Subsequences/increasing-subsequences.py | Fenghuapiao/PyLeetcode | 3 | 39653 | <gh_stars>1-10
class Solution(object):
def findSubsequences(self, nums):
"""
:type nums: List[int]
:rtype: List[List[int]]
"""
ans = []
def dfs(nums, start, path, ans):
if len(path) >= 2:
ans.append(tuple(path + []))
... | 3.4375 | 3 |
lab01/authserver/lab01_authserver/client_test.py | Boris-Barboris/rsoi | 0 | 39654 | #!/usr/bin/python3
from lab01_authserver_app.oauthclient import *
import json
import requests
import time
import requests
import logging
import http.client
http.client.HTTPConnection.debuglevel = 1
logging.basicConfig()
logging.getLogger().setLevel(logging.DEBUG)
requests_log = logging.getLogger("requests.packages... | 2.359375 | 2 |
vmware_nsx_tempest/tests/nsxv/api/test_flat_network.py | mail2nsrajesh/vmware-nsx | 0 | 39655 | # Copyright 2015 OpenStack Foundation
# 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... | 1.71875 | 2 |
tests/checkstyle.py | MattCJones/engutils | 1 | 39656 | #!/usr/bin/env python3
"""
Check that PEP8 format is followed
Author: <NAME>
Email: <EMAIL>
:copyright: 2020 by Optionset authors, see AUTHORS for more details.
:license: GPLv3, see LICENSE for more details.
"""
import subprocess
def check_format(py_file_path):
"""Check format of Python file. """
print("="*... | 2.65625 | 3 |
test/test_version.py | Tismas/bigflow | 0 | 39657 | <gh_stars>0
import re
import os
from shutil import rmtree
from uuid import uuid1
import subprocess
from pathlib import Path
import tempfile
from unittest import TestCase, mock
from bigflow.version import VERSION_PATTERN, bump_minor, release, STARTING_VERSION
from bigflow.commons import resolve
NO_REPOSITORY_VERSION_P... | 2.125 | 2 |
misc/eulerhelper.py | Hashi4/vmdgadgets | 0 | 39658 | import sys
sys.path.append('../vmdgadgets')
import vmdutil
import functools
def alt_dot_v(v1, v2):
return functools.reduce(
lambda i, j: i + j, [x * y for x, y in zip(v1, v2)])
vmdutil.vmdutil.dot_v = alt_dot_v
vmdutil.dot_v = alt_dot_v
class strexp():
def __init__(self, val):
self.val = val
... | 2.4375 | 2 |
app/api/data/service.py | nccr-itmo/FedotWeb | 1 | 39659 | from pathlib import Path
from typing import List, Optional, Tuple
from app.api.meta.service import task_type_from_id
from fedot.core.data.data import DataTypesEnum, InputData
from fedot.core.repository.tasks import Task, TaskParams, TsForecastingParams
from flask import current_app
from utils import project_root
defa... | 2.234375 | 2 |
data/strategies/bases.py | jamesrharwood/journal-guidelines | 0 | 39660 | import re
from data.scrape.link_extractors.create_extractor import create_extractor
from data.scrape.utils import clean_url
from .constants import ID
class Strategy:
def __init__(self, url_pattern, template=None, **extractor_args):
self.url_pattern = url_pattern.format(ID=ID)
self.url_regex = re.... | 2.765625 | 3 |
tests/regressiontests/get_or_create_regress/models.py | huicheese/Django-test3 | 23 | 39661 | from django.db import models
class Publisher(models.Model):
name = models.CharField(max_length=100)
class Author(models.Model):
name = models.CharField(max_length=100)
class Book(models.Model):
name = models.CharField(max_length=100)
authors = models.ManyToManyField(Author, related_name='books')
... | 3.21875 | 3 |
python_files/generate_figures/7.2_Perturbations.py | TiKeil/Masterthesis-LOD | 0 | 39662 | <filename>python_files/generate_figures/7.2_Perturbations.py<gh_stars>0
# This file is part of the master thesis "Variational crimes in the Localized orthogonal decomposition method":
# https://github.com/TiKeil/Masterthesis-LOD.git
# Copyright holder: <NAME>
# License: BSD 2-Clause License (http://opensource.org/li... | 1.8125 | 2 |
lib.py | TakuyaNoguchi/cb_lib | 0 | 39663 | import math
# 10進数 -> base進数に変換
def base10to(x: int, base: int) -> str:
s = ''
while x > 0:
s = str(x % base) + s
x = x // base
return s
# 最小公倍数
def lcm(a: int, b: int) -> int:
return int(a * b / math.gcd(a, b))
# n以下の素数の一覧
def make_primes(n: int) -> list:
is_prime = [False, Fal... | 3.84375 | 4 |
entertainment_tonight/migrations/0003_event_upload_photo.py | ashleyf1996/OOP_Web_Application_Assignment3 | 0 | 39664 | # -*- coding: utf-8 -*-
# Generated by Django 1.10.6 on 2017-04-06 20:39
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('entertainment_tonight', '0002_auto_20170321_1517'),
]
operations = [
migrat... | 1.578125 | 2 |
tests/test_models.py | epandurski/swp_accounts | 0 | 39665 | from datetime import datetime, date, timezone, timedelta
from swpt_accounts.models import Account
D_ID = -1
C_ID = 1
def test_sibnalbus_burst_count(app):
from swpt_accounts import models as m
assert isinstance(m.RejectedTransferSignal.signalbus_burst_count, int)
assert isinstance(m.PreparedTransferSignal... | 2.15625 | 2 |
examples/socket/asr_socketClient.py | marvin-nj/py-kaldi-asr | 1 | 39666 | # -*- coding: UTF-8 -*-
import socket
import pyaudio
import numpy as np
import time
import logging
address = ('127.0.0.1', 8301)
RATE = 8000
RECORD_SECONDS = 10 #录制时长,单位秒
FORMAT = pyaudio.paInt16
CHANNELS = 1
CHUNK=256
DEBUG=1
def start_client ():
#socket init
tcpClient = socket.socket(socket.AF_INET, sock... | 2.703125 | 3 |
Topic09-errors/myfunction.py | mizydorek/pands-problems-2020 | 0 | 39667 | # Calculate factorial of a number
def factorial(n):
''' Returns the factorial of n.
e.g. factorial(7) = 7x76x5x4x3x2x1 = 5040.
'''
answer = 1
for i in range(1,n+1):
answer = answer * i
return answer
if __name__ == "__main__":
assert factorial(7) == 5040 | 4.09375 | 4 |
developers_chamber/scripts/version.py | radimsuckr/developers-chamber | 0 | 39668 | import os
import click
from developers_chamber.scripts import cli
from developers_chamber.version_utils import bump_to_next_version as bump_to_next_version_func
from developers_chamber.version_utils import get_next_version, get_version
from developers_chamber.types import EnumType, ReleaseType
default_version_files... | 2.296875 | 2 |
Practice/buttons.py | ashishjayamohan/competitive-programming | 0 | 39669 | <filename>Practice/buttons.py
line = input().split()
n = int(line[0])
m = int(line[1])
print(str(abs(n-m)))
| 3.15625 | 3 |
PuTTY/putty.py | caltaojihun/Packages | 0 | 39670 | <filename>PuTTY/putty.py
# Keypirinha: a fast launcher for Windows (keypirinha.com)
import keypirinha as kp
import keypirinha_util as kpu
import os.path
import winreg
import urllib.parse
class PuTTY(kp.Plugin):
"""
Launch PuTTY sessions.
This plugin automatically detects the installed version... | 2.765625 | 3 |
tests/graphical/one_view.py | vishalbelsare/cgpm | 26 | 39671 | <filename>tests/graphical/one_view.py
# -*- coding: utf-8 -*-
# Copyright (c) 2015-2016 MIT Probabilistic Computing Project
# 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.ap... | 1.960938 | 2 |
app.py | Tokky-tane/todo_server | 0 | 39672 | <gh_stars>0
import os
import datetime
import dateutil.parser
from flask import Flask, request, Response
from flask_api import status
from database import close_db
from crud_task import get_all_tasks, delete_all_tasks, create_task, delete_user_tasks, get_user_tasks, delete_task, get_task, update_task, exist_task
import ... | 2.09375 | 2 |
BestMovies/TMDBClient.py | brunoluizcs/fiap | 0 | 39673 | import requests
class TMDBClient:
BASE_URL = "https://api.themoviedb.org/3/discover/movie"
API_KEY = ""
def request_best_movies_from_year(self, year):
params = {
'language': 'pt-BR',
'primary_release_year': year,
'sort_by': 'vote_average.desc',
'api... | 2.984375 | 3 |
segme/model/f3_net/tests/test_decoder.py | shkarupa-alex/segme | 2 | 39674 | <gh_stars>1-10
import tensorflow as tf
from keras import keras_parameterized
from ..decoder import Decoder
from ....testing_utils import layer_multi_io_test
@keras_parameterized.run_all_keras_modes
class TestDecoder(keras_parameterized.TestCase):
def test_layer(self):
layer_multi_io_test(
Deco... | 2.34375 | 2 |
PassPY0.2Win.py | IvaldiS6/PassPYWin | 0 | 39675 | import codecs
import os
import os.path
import string
import random
from random import shuffle
import csv
import time
import hashlib
import struct
import binascii
from cryptography.hazmat.primitives.ciphers import Cipher, algorithms, modes
DefaultSize = "mode con: cols=100 lines=20"
os.system(DefaultSize)
pre = "C:\Pr... | 3.21875 | 3 |
cloudtunes-server/cloudtunes/async.py | skymemoryGit/cloudtunes | 529 | 39676 | """Asynchronous MongoDB and Redis connections."""
from functools import partial
import motor
import tornadoredis
from cloudtunes import settings
RedisClient = partial(tornadoredis.Client, **settings.REDIS)
mongo = motor.MotorClient(**settings.MONGODB).cloudtunes
redis = RedisClient()
| 1.648438 | 2 |
output/models/saxon_data/id/id008_xsd/__init__.py | tefra/xsdata-w3c-tests | 1 | 39677 | from output.models.saxon_data.id.id008_xsd.id008 import (
Doc,
Node,
PseudoId,
PseudoIdref,
)
__all__ = [
"Doc",
"Node",
"PseudoId",
"PseudoIdref",
]
| 1.453125 | 1 |
scripts/convert_ts_model_to_onnx.py | SakodaShintaro/Miacis | 10 | 39678 | #!/usr/bin/env python3
import os
from generate_cnn_model import *
from generate_transformer_model import *
parser = argparse.ArgumentParser()
parser.add_argument("model_path", type=str)
parser.add_argument("--batch_size", type=int, default=128)
args = parser.parse_args()
input_channel_num = 42
board_size = 9
policy_c... | 2.203125 | 2 |
ietf/mailtrigger/migrations/0009_review_sent.py | ekr/ietfdb | 2 | 39679 | <gh_stars>1-10
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations
def forward(apps, schema_editor):
MailTrigger=apps.get_model('mailtrigger','MailTrigger')
Recipient=apps.get_model('mailtrigger','Recipient')
Recipient.objects.create(
slug='review_tea... | 1.960938 | 2 |
utils/configs.py | realeu/ImgBB-Bot | 0 | 39680 | import os
import time
class Var(object):
# Get a bot token from botfather
BOT_TOKEN = os.environ.get("BOT_TOKEN", "")
# Get from my.telegram.org
API_ID = int(os.environ.get("API_ID", 12345))
# Get from my.telegram.org
API_HASH = os.environ.get("API_HASH", "")
# To record start time of... | 2.796875 | 3 |
unsupervised_meta_learning/_nbdev.py | ojss/c3lr | 3 | 39681 | # AUTOGENERATED BY NBDEV! DO NOT EDIT!
__all__ = ["index", "modules", "custom_doc_links", "git_url"]
index = {"c_imshow": "01_nn_utils.ipynb",
"Flatten": "01_nn_utils.ipynb",
"conv3x3": "01_nn_utils.ipynb",
"get_proto_accuracy": "01_nn_utils.ipynb",
"get_accuracy": "02_maml_pl.ipyn... | 1.15625 | 1 |
code/applications/qs_predict_probablistic.py | ninamiolane/quicksilver | 126 | 39682 | # add LDDMM shooting code into path
import sys
sys.path.append('../vectormomentum/Code/Python');
sys.path.append('../library')
from subprocess import call
import argparse
import os.path
#Add deep learning related libraries
from collections import Counter
import torch
import prediction_network
import util
import numpy... | 2.125 | 2 |
exifGPSimplant.py | Bahrd/AppliedPythonology | 4 | 39683 | <reponame>Bahrd/AppliedPythonology<gh_stars>1-10
## EXIF GPS tags hand-crafted modification ('autografts')...
from exif import Image
from sys import argv as names
from math import floor
def dd_GPS_dms(coordinate):
latlonitude = float(coordinate)
degrees = floor(latlonitude)
residuum = (latlonitude - degre... | 2.453125 | 2 |
RegonAPI/converters.py | damianwasik98/RegonAPI | 10 | 39684 | <reponame>damianwasik98/RegonAPI
"""
Converters of codes
"""
from string import digits
from .exceptions import RegonConvertionError
from . import validators
REGON9_WEIGHTS = [8, 9, 2, 3, 4, 5, 6, 7]
REGON14_WEIGHTS = [2, 4, 8, 5, 0, 9, 7, 3, 6, 1, 2, 4, 8]
def regon8_to_9(regon8):
"""Convert REGON8 to REG... | 3.109375 | 3 |
analysis/time_domain_response.py | Joeltronics/audioexperiments | 1 | 39685 | #!/usr/bin/env python3
import math
from typing import Iterable, Optional, Tuple, Union
import numpy as np
from analysis import linearity
from utils import utils
from unit_test import unit_test
from processor import ProcessorBase
from generation import signal_generation
def generate_impulse(n_samp, am... | 2.96875 | 3 |
bach/bach/series/series_datetime.py | objectiv/objectiv-analytics | 23 | 39686 | """
Copyright 2021 Objectiv B.V.
"""
import datetime
import warnings
from abc import ABC
from enum import Enum
from typing import Union, cast, List, Tuple, Optional, Any
import numpy
import pandas
from sqlalchemy.engine import Dialect
from bach import DataFrame
from bach.series import Series, SeriesString, SeriesBool... | 2.359375 | 2 |
infra_validation_engine/infra_tests/components/docker.py | WLCG-Lightweight-Sites/simple_grid_infra_validation_engine | 1 | 39687 | # coding: utf-8
# 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
# dist... | 2.203125 | 2 |
examples/htlc-pyteal-ts/assets/htlc.py | stasgga/algo_builder | 1 | 39688 | # Hash Time Lock Contract Example in pyTeal
# Add parent directory to path so that algobpy can be imported
import sys
sys.path.insert(0,'..')
from algobpy.parse import parse_params
from pyteal import *
def htlc(tmpl_bob, tmpl_alice, tmpl_secret, tmpl_timeout):
common_fields = And(
Txn.type_enum() == Tx... | 2.203125 | 2 |
pyboto3/sqs.py | thecraftman/pyboto3 | 0 | 39689 | <reponame>thecraftman/pyboto3
'''
The MIT License (MIT)
Copyright (c) 2016 WavyCloud
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 limitation the rights
... | 2.03125 | 2 |
disjoint_set.py | sciatti/mazesolving | 0 | 39690 | <filename>disjoint_set.py
import numpy as np
class disjoint_set:
def __init__(self, numCells, row_size):
self.rowSize = row_size
self.numCells = numCells
self.parents = np.full(self.numCells, -1)
#Returns the highest ancestor index of cell passed to it and updates parents of things... | 3.40625 | 3 |
example/schema/tests/unittest/toys.py | donghak-shin/dp-tornado | 18 | 39691 | <reponame>donghak-shin/dp-tornado
# -*- coding: utf-8 -*-
from dp_tornado.engine.schema import Table as dpTable
from dp_tornado.engine.schema import Schema as dpSchema
from dp_tornado.engine.schema import Attribute as dpAttribute
class ToysSchema(dpTable):
__table_name__ = 'toys'
__engine__ = 'InnoDB'
... | 1.929688 | 2 |
scripts/pre_solve_path.py | xuzhiying9510/ncflow | 10 | 39692 | <filename>scripts/pre_solve_path.py<gh_stars>1-10
#! /usr/bin/env python
import os
import pickle
from pathos import multiprocessing
import sys
sys.path.append('..')
from lib.problems import get_problem
from lib.algorithms.path_formulation import PathFormulation, PATHS_DIR
from lib.path_utils import graph_copy_with_e... | 2.15625 | 2 |
YouTube-PyQt5/09_radio_button.py | dloperab/Python-GUI | 2 | 39693 | import sys
from PyQt5 import QtGui, QtCore
from PyQt5.QtWidgets import QApplication, QDialog, QGroupBox, QVBoxLayout, QHBoxLayout, QRadioButton, QLabel
class MainWindow(QDialog):
def __init__(self):
super().__init__()
self.title = "PyQt5 Radio Button"
self.top = 400
self.left = 2... | 2.71875 | 3 |
source/guides/migrations/0002_auto_20170123_1809.py | OpenNews/opennews-source | 6 | 39694 | # -*- coding: utf-8 -*-
# Generated by Django 1.10.1 on 2017-01-23 18:09
from __future__ import unicode_literals
from django.db import migrations, models
import sorl.thumbnail.fields
class Migration(migrations.Migration):
dependencies = [
('guides', '0001_initial'),
]
operations = [
mig... | 1.65625 | 2 |
NLP/TextClassfication/task1/train.py | MobtgZhang/ModelZoos | 0 | 39695 | <reponame>MobtgZhang/ModelZoos
import os
import logging
import yaml
import torch
import torch.nn as nn
import torch.optim as optim
from torch.utils.data import DataLoader
from utils import build_simplifyweibo_4_moods_dataset
from utils import LabelReviewSplitWordsDataset
from utils import bacthfy,to_device
from model... | 2.125 | 2 |
hipyelp/migrations/0014_rename_tagname_drinktag_drinktagname.py | buggydev1/Hip_yelp_Back | 0 | 39696 | # Generated by Django 3.2 on 2021-04-25 02:49
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('hipyelp', '0013_alter_drinktag_tagname'),
]
operations = [
migrations.RenameField(
model_name='drinktag',
old_name='tagName',
... | 1.710938 | 2 |
basic_YOLO/obj_vid_cuda.py | msmcs-robotics/pi-cv-vision | 0 | 39697 | <reponame>msmcs-robotics/pi-cv-vision
'''
Reference:
https://thinkinfi.com/use-opencv-with-gpu-python/
Download cfg:
> wget https://raw.githubusercontent.com/pjreddie/darknet/master/cfg/yolov3.cfg
Download weights:
> wget https://pjreddie.com/media/files/yolov3.weights
Dataset:
> wget https://raw.githubusercontent.... | 2.5 | 2 |
examples/container/tabular_benchmark_example.py | pfistfl/HPOBench | 78 | 39698 | <gh_stars>10-100
"""
Tabular benchmark
=================
This examples shows the usage of the containerized tabular benchmark.
To note: You don't have to pass the container name to the Benchmark-Constructor. It is automatically set, but for
demonstration purpose, we show how to set it.
container_source can be either ... | 2.4375 | 2 |
recip/util/Address.py | anthonybuckle/Reciprocity-Core | 0 | 39699 | from recip.util import DataType
from recip.util import Validator
def toAddressBytes(address):
if address.startswith('0x'):
address = address[2:]
return DataType.fromHex(address)
def toAddressStr(addressBytes):
return DataType.toHex(addressBytes)
def to0xAddress(addressBytes):
address = toAddr... | 3.0625 | 3 |