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 |
|---|---|---|---|---|---|---|
hw12/myscript.py | ranstotz/ece_3822 | 0 | 36300 | <gh_stars>0
#!/usr/bin/env python
# import required modules:
#
import os
import sys
import string
import random
from random import shuffle
from pathlib2 import Path
import linecache
import time
# This class shuffles songs without repeating and keeps track of where
# it left off. See '-help' option for more details.
#... | 3.453125 | 3 |
tests/conftest.py | RonnyPfannschmidt/python-step-series | 0 | 36301 | <filename>tests/conftest.py
"""conftest.py for stepseries."""
from threading import Event
from typing import Dict, Tuple
import pytest
from stepseries.responses import DestIP
from stepseries.step400 import STEP400
# store history of failures per test class name and per index in parametrize (if parametrize used)
_te... | 2.40625 | 2 |
scripts/run_servers.py | jeeberhardt/visualize | 4 | 36302 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
""" Start Pymol and Bokeh server """
from __future__ import print_function
import time
import shlex
import subprocess
__author__ = "<NAME>"
__copyright__ = "Copyright 2016, <NAME>"
__lience__ = "MIT"
__maintainer__ = "<NAME>"
__email__ = "<EMAIL>"
def execute_command... | 2.609375 | 3 |
django_sso_app/core/authentication/backends/app.py | paiuolo/django-sso-app | 1 | 36303 | <reponame>paiuolo/django-sso-app
import logging
from django.core.exceptions import ObjectDoesNotExist
from django.contrib.auth import get_user_model
from django.contrib.auth.backends import ModelBackend
from ...apps.users.utils import fetch_remote_user, create_local_user_from_remote_backend, \
... | 2.078125 | 2 |
tds_django/creation.py | cnanyi/tds-django | 1 | 36304 | <reponame>cnanyi/tds-django
from django.db.backends.base.creation import BaseDatabaseCreation
class DatabaseCreation(BaseDatabaseCreation):
def create_test_db(self, *args, **kwargs):
import os
db_name = super().create_test_db()
here = os.path.realpath(os.path.join(os.getcwd(), os.path.di... | 2.671875 | 3 |
mbrl-tools/tests/small_acrobot/submissions/dummy_kit/generative_regressor.py | ramp-kits/rl_simulator | 11 | 36305 | import numpy as np
from rampwf.utils import BaseGenerativeRegressor
class GenerativeRegressor(BaseGenerativeRegressor):
def __init__(self, max_dists, target_dim):
self.decomposition = 'autoregressive'
def fit(self, X_array, y_array):
pass
def predict(self, X_array):
# constant p... | 2.828125 | 3 |
fluxcompensator/image.py | koepferl/FluxCompensator | 9 | 36306 | <filename>fluxcompensator/image.py
from copy import deepcopy
import os
ROOT = os.path.dirname(os.path.abspath(__file__)) + '/'
import numpy as np
from numpy.random import normal
from astropy import log as logger
from astropy.io import fits
from astropy.wcs import WCS
from .psf import GaussianPSF, FilePSF, FunctionPSF... | 2.453125 | 2 |
generator.py | madkira/SCXML_to_FSM_for_Arduino | 1 | 36307 | #!/usr/bin/python
import argparse
from src.SCXML_Parser.Scxml_parsor import Scxml_parsor
from src.arduino_helper.generate_fsm import generate_fsm
parser = argparse.ArgumentParser()
parser.add_argument('-f', action='store', dest='file', type=str, required=False, default="fsm.xml")
inargs = parser.parse_args()
print ... | 2.96875 | 3 |
data/external/repositories/145085/kaggle_Microsoft_Malware-master/kaggle_Microsoft_malware_full/rebuild_code.py | Keesiu/meta-kaggle | 1 | 36308 | import os,array
import pickle
import numpy as np
import sys
xid=pickle.load(open(sys.argv[1]))
asm_code_path=sys.argv[2]
train_or_test=asm_code_path.split('_')[-1]
X = np.zeros((len(xid),2000))
for cc,i in enumerate(xid):
f=open(asm_code_path+'/'+i+'.asm')
ln = os.path.getsize(asm_code_path+'/'+i+'.asm') # len... | 2.078125 | 2 |
x509_3_validation_certs.py | askpatrickw/azure_iot_x509_helpers | 0 | 36309 | """
Generate Validation Certificate bases on Azure IoT Hub Verification Code
Based on sample code from the cryptography library docs:
https://cryptography.io/en/latest/x509/tutorial/#creating-a-self-signed-certificate
"""
import datetime
from pathlib import Path
from cryptography.hazmat.primitives import has... | 2.796875 | 3 |
PuThresholdTuning/python/akPu4PFJetSequence10_cff.py | mverwe/JetRecoValidation | 0 | 36310 | <gh_stars>0
import FWCore.ParameterSet.Config as cms
from HeavyIonsAnalysis.JetAnalysis.jets.akPu4PFJetSequence_PbPb_mc_cff import *
#PU jets with 10 GeV threshold for subtraction
akPu4PFmatch10 = akPu4PFmatch.clone(src = cms.InputTag("akPu4PFJets10"))
akPu4PFparton10 = akPu4PFparton.clone(src = cms.InputTag("akPu4PF... | 1.328125 | 1 |
annotationweb/urls.py | andreped/annotationweb | 0 | 36311 | <filename>annotationweb/urls.py<gh_stars>0
from django.conf.urls import include
from django.urls import path
from django.contrib import admin
from . import views
app_name = 'annotationweb'
urlpatterns = [
path('', views.index, name='index'),
path('datasets/', views.datasets, name='datasets'),
path('add-ima... | 1.921875 | 2 |
vae/decoder/vae_conv_util.py | VincentStimper/hmc-hyperparameter-tuning | 2 | 36312 | import numpy as np
import tensorflow as tf
def deconv_layer(output_shape, filter_shape, activation, strides, name):
scale = 1.0 / np.prod(filter_shape[:3])
seed = int(np.random.randint(0, 1000)) # 123
with tf.name_scope('conv_mnist/conv'):
W = tf.Variable(tf.random_uniform(filter_shape,
... | 2.8125 | 3 |
basalganglia/reinforce/networks/policy_network.py | ruanguoqing/basal-ganglia | 2 | 36313 | <reponame>ruanguoqing/basal-ganglia
import torch.nn as nn, torch.nn.functional as F, torch.distributions as D, torch.nn.init as init
from basalganglia.reinforce.util.torch_util import *
class PolicyNetwork(nn.Module):
def __init__(self, env, hidden_layer_width=128, init_log_sigma=0, min_log_sigma=-3):
su... | 2.375 | 2 |
tests/frame/test_frame_publishing.py | SimLeek/displayarray | 8 | 36314 | <reponame>SimLeek/displayarray<filename>tests/frame/test_frame_publishing.py
from displayarray.frame.frame_publishing import pub_cam_loop_opencv, pub_cam_thread
import displayarray
import mock
import pytest
import cv2
from displayarray.frame.np_to_opencv import NpCam
import numpy as np
import displayarray.frame.subscri... | 2.109375 | 2 |
execicios/ex019/sorteio.py | Israel97f/Exercicios-de-Python | 0 | 36315 | import random
a1 = str(input(' diga o nome do aluno 1 '))
a2 = str(input(' diga o nome do aluno 2 '))
a3 = str(input(' diga o nome do aluno 3 '))
a4 = str(input(' diga o nome do aluno 4 '))
lista = [a1, a2, a3, a4]
escolhido = random.choice(lista)
print('O aluno soteado é o aluno {}'.format(escolhido))
| 3.5625 | 4 |
rabbitmq/python/topic_producer.py | alovn/tutorials | 7 | 36316 | # encoding:utf-8
import pika
import time
credentials = pika.PlainCredentials('guest', 'guest')
connection = pika.BlockingConnection(pika.ConnectionParameters(
host='s1004.lab.org',
port=5672,
virtual_host='/',
credentials=credentials))
channel = connection.channel()
channel.exchange_declare(exchange='... | 1.96875 | 2 |
settings_default.py | iticus/photomap | 0 | 36317 | """
Created on Nov 1, 2015
@author: ionut
"""
import logging
DEBUG = False
LOG_LEVEL = logging.INFO
DSN = "dbname=photomap user=postgres password=<PASSWORD> host=127.0.0.1 port=5432"
TEMPLATE_PATH = "templates"
STATIC_PATH = "static"
MEDIA_PATH = "/home/ionut/nginx/media"
SECRET = "some_secret"
| 1.242188 | 1 |
tests/test_mcts_player.py | donkirkby/zero-play | 7 | 36318 | import typing
from collections import Counter
import numpy as np
from pytest import approx
from zero_play.connect4.game import Connect4State
from zero_play.game_state import GameState
from zero_play.heuristic import Heuristic
from zero_play.mcts_player import SearchNode, MctsPlayer, SearchManager
from zero_play.playo... | 2.234375 | 2 |
exercicios/ex 061 a 070/ex063.py | CarlosWillian/python | 0 | 36319 | print('Sequência de Fibonacci')
print('='*24)
t = int(input('Número de termos da sequência: '))
print('='*24)
c = 3
termo1 = 0
termo2 = 1
print('A sequência é ({}, {}, '.format(termo1, termo2), end='')
while c <= t:
termo3 = termo1 + termo2
print('{}'.format(termo3), end='')
print(', ' if c < t else '', end... | 3.921875 | 4 |
Histogram_Equalization/equalizer.py | CSEMN/FEE_Image_Processing | 0 | 36320 | <filename>Histogram_Equalization/equalizer.py
#This code is a practice on Histogram Equalization
#Coded by: CSEMN (<NAME> - Sec 4)
#Supervised by: Dr.<NAME>
__author__ = '<NAME>'
from tkinter import *
from tkinter import ttk
import cv2 as cv # if not installed please consider running : pip install opencv-python
from PI... | 3.0625 | 3 |
divineoasis/scenes/main_menu_manager.py | wsngamerz/Divine-Oasis-RPG | 1 | 36321 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# File: scenes/main_menu_manager.py
# -------------------
# Divine Oasis
# Text Based RPG Game
# By wsngamerz
# -------------------
import logging
import random
from divineoasis.assets import Assets
from divineoasis.audio_manager import AudioManager
from divineoasi... | 2.265625 | 2 |
myadsp/emails.py | kelockhart/myADSPipeline | 0 | 36322 | <filename>myadsp/emails.py<gh_stars>0
"""email templates"""
from builtins import object
class Email(object):
"""
Data structure that contains email content data
"""
msg_plain = ''
msg_html = ''
subject = u''
salt = ''
class myADSTemplate(Email):
"""
myADS email template
"""
... | 2.40625 | 2 |
getAddrFromOS.py | OpenAddressesUK/OSSpatialResearch | 1 | 36323 | <gh_stars>1-10
#
# Open addresses Spatial Research
# Display Candidate Address Components From OS Open Map & Open Roads
#
#
# Version 1.0 (Python) in progress
# Author <NAME>
# Licence MIT
#
# Purpose Display Candidate Address Components
#
import MySQLdb
import collections
import sys
# D... | 2.671875 | 3 |
ext/app/decorators.py | FNLF/fnlf-backend | 1 | 36324 | """
Custom decorators
=================
Custom decorators for various tasks and to bridge Flask with Eve
"""
from flask import current_app as app, request, Response, abort
from functools import wraps
from ext.auth.tokenauth import TokenAuth
from ext.auth.helpers import Helpers
# Because of circu... | 2.625 | 3 |
home/migrations/0046_auto_20190905_0939.py | davidjrichardson/toucans | 1 | 36325 | <reponame>davidjrichardson/toucans
# Generated by Django 2.2.5 on 2019-09-05 09:39
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('home', '0045_auto_20190409_1450'),
]
operations = [
migrations.AlterField(
model_name='league... | 1.75 | 2 |
setup.py | mzinin/s2e2.python | 0 | 36326 | <gh_stars>0
#!/bin/sh
# it's a kind of magic to run python with -B key
# https://stackoverflow.com/questions/17458528/why-does-this-snippet-with-a-shebang-bin-sh-and-exec-python-inside-4-single-q
''''exec python3 -B -- "$0" ${1+"$@"} # '''
import os
import re
import setuptools
import setuptools.command.test
import sys... | 2.234375 | 2 |
graphene_mongoengine/types.py | ramarivera/graphene-mongoengine | 0 | 36327 | from collections import OrderedDict
from graphene import Field # , annotate, ResolveInfo
from graphene.relay import Connection, Node
from graphene.types.objecttype import ObjectType, ObjectTypeOptions
from graphene.types.utils import yank_fields_from_attrs
from mongoengine import DoesNotExist
from .converter import... | 2.109375 | 2 |
apps/test/models.py | catveloper/dynamic_form_generator | 0 | 36328 | <filename>apps/test/models.py
from django.conf import settings
from django.db import models
from django.utils.translation import gettext_lazy as _
class Workspace(models.Model):
code = models.CharField(_('코드'), max_length=40, unique=True, editable=False)
name = models.CharField(_('이름'), max_length=50, unique=... | 2.15625 | 2 |
python/tvm/contrib/binutil.py | uwsampl/tvm | 2 | 36329 | # Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | 2.25 | 2 |
src/tools/__init__.py | Talengi/phase | 8 | 36330 | """Miscelanous tools."""
| 1.023438 | 1 |
setup.py | myslak71/dmt | 1 | 36331 | <gh_stars>1-10
import os
from setuptools import setup, find_packages
DIR_PATH = os.path.dirname(os.path.abspath(__file__))
with open(os.path.join(DIR_PATH, 'README.md')) as file:
long_description = file.read()
install_requires = [line.rstrip('\n') for line in open(os.path.join(DIR_PATH, 'requirements.txt'))]
s... | 1.335938 | 1 |
card_dispenser_test.py | Denexapp/mannequin | 0 | 36332 | import card_dispenser
import time
card_dispenser_object = card_dispenser.card_dispenser()
while True:
card_dispenser_object.give_card()
time.sleep(10) | 1.984375 | 2 |
brewtils/resolvers/manager.py | scott-taubman/brewtils | 0 | 36333 | # -*- coding: utf-8 -*-
import logging
from typing import Any, Dict, List, Mapping
try:
from collections import Mapping as CollectionsMapping
except ImportError:
from collections.abc import Mapping as CollectionsMapping
from brewtils.models import Parameter, Resolvable
from brewtils.resolvers.bytes import By... | 2.21875 | 2 |
python_exercises/Curso_em_video/ex011.py | Matheus-IT/lang-python-related | 0 | 36334 | b = float(input('\033[36mQual a largura da parede? \033[m'))
h = float(input('\033[32mQual a altura da parede? \033[m'))
a = b * h
print('\033[36mSua parede tem dimensão {} x {} e sua área é de {:.3f}m².\033[m'.format(b, h, a))
print('\033[32mPara pintar essa parede, você precisará de {}L de tinta.\033[m'.format(a ... | 3.90625 | 4 |
labs/tony-monday-10-jg113/exam_marks_4.py | TonyJenkins/lbu-python-code | 2 | 36335 | <reponame>TonyJenkins/lbu-python-code<filename>labs/tony-monday-10-jg113/exam_marks_4.py
#!/usr/bin/env python3
NUMBER_OF_MARKS = 5
def avg(numbers):
return sum(numbers) / len(numbers)
def valid_mark(mark):
return 0 <= mark <= 100
def read_marks(number_of_marks):
marks_read = []
for count in ran... | 4.1875 | 4 |
tests/mp.py | dmxj/icv | 5 | 36336 | <filename>tests/mp.py
from multiprocessing import Pool, Queue
import multiprocessing
import threading
import time
def test(x):
x0,x1,x2 = x
time.sleep(2)
return x0+x1+x2, x0*x1*x2
# if p==10000:
# return True
# else:
# return False
class Dog():
def __init__(self):
pass... | 3.078125 | 3 |
dudes/Util.py | rababerladuseladim/dudes | 7 | 36337 | from dudes.Ranks import Ranks
import numpy as np
import sys
def printDebug(DEBUG, l):
if DEBUG: sys.stderr.write(str(l) + "\n")
def group_max(groups, data, pre_order=None):
if pre_order is None:
order = np.lexsort((data, groups))
else:
order = pre_order
groups = groups[order] #this is only needed if grou... | 2.875 | 3 |
train.py | Raghavkumarkakar252/Pneumonia_Diagnosis | 0 | 36338 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sun Feb 3 10:27:25 2019
@author: alishbaimran
"""
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from imutils import paths
from sklearn.metrics import classification_report
from sklearn.metrics import accuracy_score
f... | 2.640625 | 3 |
core/migrations/0001_initial.py | bpotvin-bccrc/colossus | 2 | 36339 | <reponame>bpotvin-bccrc/colossus<filename>core/migrations/0001_initial.py
# -*- coding: utf-8 -*-
# Generated by Django 1.11.17 on 2019-07-12 18:40
from __future__ import unicode_literals
import core.helpers
from django.db import migrations, models
import django.db.models.deletion
import simple_history.models
class ... | 1.734375 | 2 |
GraphADT.py | J-Chaudhary/dataStructureAndAlgo | 0 | 36340 | class Vertex:
'''This class will create Vertex of Graph, include methods
add neighbours(v) and rem_neighbor(v)'''
def __init__(self, n): # To initiate instance Graph Vertex
self.name = n
self.neighbors = list()
self.color = 'black'
def add_neighbor(self, v): # To add... | 4.09375 | 4 |
sphinx_a4doc/syntax/gen/syntax/ANTLRv4Parser.py | sandrotosi/sphinx-a4doc | 4 | 36341 | # encoding: utf-8
from antlr4 import *
from io import StringIO
from typing.io import TextIO
import sys
def serializedATN():
with StringIO() as buf:
buf.write("\3\u608b\ua72a\u8133\ub9ed\u417c\u3be7\u7786\u5964\3@")
buf.write("\u027b\4\2\t\2\4\3\t\3\4\4\t\4\4\5\t\5\4\6\t\6\4\7\t\7")
buf.writ... | 2 | 2 |
PlantDetector.py | julzerinos/python-opencv-plant_detection | 10 | 36342 | import cv2 as cv # opencv
import copy # for deepcopy on images
import numpy as np # numpy
from random import randint # for random values
import threading # for deamon processing
from pathlib import Path # for directory information
import os # for directory information
from constants import constants # const... | 2.703125 | 3 |
shooter_game.py | TaseeTee/shooter_game | 0 | 36343 | <reponame>TaseeTee/shooter_game<filename>shooter_game.py
from pygame import *
from random import randint
window = display.set_mode((700, 500))
display.set_caption('Шутер')
lost = 0
c = 0
class GameSprite(sprite.Sprite):
def __init__(self, player_image, player_x, player_y, player_w, player_h, player_speed):
... | 3.015625 | 3 |
test_action40.py | gmayday1997/pytorch_CAM | 23 | 36344 | <gh_stars>10-100
import os
import numpy as np
import torch
import torch.nn as nn
import torchvision
import torch.utils.data as Data
import torchvision.transforms as transforms
import torchvision.datasets as datasets
from torch.autograd import Variable
from torch.nn import functional as F
from action40_config import con... | 2.15625 | 2 |
scripts/loggeranalyzer.py | patymori/document-store-migracao | 1 | 36345 | <filename>scripts/loggeranalyzer.py
# Coding: utf-8
"""Script para analisar, agrupar dados provenientes dos logs da ferramenta
de migração das coleções SciELO."""
import argparse
import functools
import json
import logging
import re
import sys
from enum import Enum
from io import TextIOWrapper, IOBase
from typing imp... | 2.78125 | 3 |
keepercommander/plugins/windows/windows.py | Mkn-yskz/Commandy | 151 | 36346 | # -*- coding: utf-8 -*-
# _ __
# | |/ /___ ___ _ __ ___ _ _ ®
# | ' </ -_) -_) '_ \/ -_) '_|
# |_|\_\___\___| .__/\___|_|
# |_|
#
# <NAME>
# Copyright 2015 Keeper Security Inc.
# Contact: <EMAIL>
#
import logging
import subprocess
import re
def rotate(record, newpassword):
""" Grab... | 2.8125 | 3 |
tests/twodim/test_synthetic.py | microprediction/punting | 0 | 36347 | <gh_stars>0
from punting.twodim.twosynthetic import random_harville_market
def test_synthetic():
n = 7
m = random_harville_market(n=n, scr=-1)
if __name__=='__main__':
test_synthetic() | 1.625 | 2 |
synapsesuggestor/pipelinefiles.py | clbarnes/CATMAID-synapsesuggestor | 3 | 36348 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
"""Specifies static assets (CSS, JS) required by the CATMAID front-end.
This module specifies all the static files that are required by the
synapsesuggestor front-end.
"""
from collections import OrderedDict
JAVASCRIPT = OrderedDict()
JAVASCRIPT['syna... | 1.5625 | 2 |
code/tile/tile_geojson.py | kylebarron/transit-land-dump | 21 | 36349 | from pathlib import Path
import click
import cligj
import geojson
import mercantile
from shapely.geometry import asShape, box
from shapely.ops import split
@click.command()
@cligj.features_in_arg
@click.option(
'-z',
'--min-zoom',
type=int,
required=True,
help='Min zoom level to create tiles for'... | 2.46875 | 2 |
slk/config/network.py | QCloud-DevOps/sidechain-launch-kit | 1 | 36350 | from __future__ import annotations
from typing import List, Optional
from xrpl import CryptoAlgorithm
from xrpl.core.addresscodec import encode_account_public_key, encode_node_public_key
from xrpl.core.keypairs import derive_keypair, generate_seed
from xrpl.wallet import Wallet
from slk.config.helper_classes import ... | 2.234375 | 2 |
realpyserver/server.py | MartinChristiaan/realpy | 0 | 36351 | <filename>realpyserver/server.py
from flask import Flask,Response
from flask import render_template
import os
from os import path,system
from flask import request
import json
from flask_cors import CORS
import shutil
# Model Definition
import math
import serialization
import numpy as np
import types
from enum import En... | 2.359375 | 2 |
model_lgb_hakubishin_20200317/src/models/model_lightgbm.py | wantedly/recsys2020-challenge | 35 | 36352 | <reponame>wantedly/recsys2020-challenge
import lightgbm as lgb
from .model import Base_Model
from src.utils import Pkl
class Model_LightGBM(Base_Model):
def train(self, x_trn, y_trn, x_val, y_val):
validation_flg = x_val is not None
# Setting datasets
d_trn = lgb.Dataset(x_trn, label=y_tr... | 2.40625 | 2 |
cabi/archived/ebikes.py | jmillerbrooks/capital_bikeshare | 0 | 36353 | ### DEPRECATE THESE? OLD VERSIONS OF CLEANING FUNCTIONS FOR JUST EBIKES
### NO LONGER WORKING WITH THESE
import pandas as pd
import numpy as np
from shapely.geometry import Point
import geopandas as gpd
from cabi.utils import which_anc, station_anc_dict
from cabi.get_data import anc_gdf
gdf = anc_gdf()
anc_dict = st... | 2.46875 | 2 |
build_world_clouds.py | amercer1/jebe | 1 | 36354 | <filename>build_world_clouds.py
import os
import re
import random
from scipy.misc import imread
import matplotlib.pyplot as plt
from wordcloud import WordCloud, STOPWORDS
d = os.path.dirname(__file__)
text_files = os.path.join(d, 'text_files')
images = os.path.join(d, 'images')
paths = [fn for fn in next(os.walk(te... | 2.90625 | 3 |
track.py | ahrnbom/guts | 0 | 36355 | """
Copyright (C) 2022 <NAME>
Released under MIT License. See the file LICENSE for details.
This module describes 2D/3D tracks. GUTS's output is a list of instances
of these classes.
"""
import numpy as np
from filter import filter2D, filter3D
from options import Options, Filter2DParams, Filter3DPa... | 2.71875 | 3 |
corehq/ex-submodules/casexml/apps/stock/tests/mock_consumption.py | akashkj/commcare-hq | 471 | 36356 | <gh_stars>100-1000
from datetime import datetime, timedelta
from dimagi.utils import parsing as dateparse
from casexml.apps.stock.consumption import (
ConsumptionConfiguration,
compute_daily_consumption_from_transactions,
)
to_ts = dateparse.json_format_datetime
now = datetime.utcnow()
def ago(days):
r... | 2.359375 | 2 |
multi-cluster-rescheduler/mcr.py | moule3053/mck8s | 57 | 36357 | <gh_stars>10-100
import kopf
import time
from utils import get_all_federation_clusters, rescheduleApp
# Create app rescheduler
@kopf.daemon('fogguru.eu', 'v1', 'appreschedulers', initial_delay=5)
def create_fn(stopped, **kwargs):
CHECK_PERIOD = 60
RESCHEDULE_PERIOD = 31 * 60
while not stopped:
# fo... | 2.59375 | 3 |
retuo.py | Azi-Dahaka/- | 1 | 36358 | # -*- coding:utf-8 -*-
# 1.导入拓展
from flask import Flask
from flask_restful import Api
import config
from app.api.view.auth import wx_login
from app.api.view.talk import Reply
# 2.创建flask应用实例,__name__用来确定资源所在的路径
app = Flask(__name__)
app.config.from_object(config.DevelopmentConfig)
api = Api(app)
# 3.定义全局变量
# 4.定义路由和视... | 2.5 | 2 |
PSO.py | cece95/F21BC-Coursework | 1 | 36359 | import numpy.random as rand
import numpy as np
import pandas as pd
import random
import math
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
from matplotlib.animation import FuncAnimation
from Particle import Particle
#Initialization of the plots
fig = plt.figure(figsize=(20,10))
axes = [None... | 3.28125 | 3 |
Modulos/ProvasPassadas/aux_scraping.py | gabrielfava/asap | 2 | 36360 | #ASAPY
import requests
__URL_GLOBAL = "https://www.urionlinejudge.com.br";
def printme(pagina):
body = getCorpo(__URL_GLOBAL+"/judge/pt/problems/view/"+pagina);
iInicio = find_str(body, "<iframe");
pos = (body[iInicio:]);
iFim = find_str(pos, ">")+1;
tupla = pos[:iFim];
page2 = getAttr(tupl... | 2.671875 | 3 |
picking_numbers/picking_numbers.py | pvital/4lg0rithm5 | 0 | 36361 | #!/bin/python3
import math
import os
import random
import re
import sys
#
# Generator method to buld a list containing only the elements with diff <= 1
#
def genSucessors(pivot, array):
for i in array:
if (abs(pivot - i) <= 1):
yield i
#
# Complete the 'pickingNumbers' function below.
#
# The... | 3.65625 | 4 |
toontown/safezone/DistributedButterflyAI.py | TrueBlueDogemon/Toontown | 1 | 36362 | from direct.directnotify import DirectNotifyGlobal
from direct.distributed.DistributedObjectAI import DistributedObjectAI
from direct.distributed.ClockDelta import *
import ButterflyGlobals
import random
class DistributedButterflyAI(DistributedObjectAI):
notify = DirectNotifyGlobal.directNotify.newCategory("Distri... | 2.375 | 2 |
proj01_ifelse/proj01.py | CalvinsHyper/Vanderbilt-2018 | 0 | 36363 | <gh_stars>0
# Name:
# Date:
# proj01: A Simple Program
# Part I:
# This program asks the user for his/her name and grade.
#Then, it prints out a sentence that says the number of years until they graduate.
print "Hello"
Your_Name = raw_input("What's your name?")
print "Your name is "+ Your_Name
Your_Grade = raw_input(... | 4.40625 | 4 |
app-django/departamentos/models.py | ilanaraujo/sistema-gerenciamento-empresarial | 0 | 36364 | from io import IncrementalNewlineDecoder
from django.db import models
# Classe de departamento
class Departamento(models.Model):
id = models.IntegerField(primary_key=True, editable=False)
nome = models.CharField(max_length=255, blank=False)
numero_projetos = models.IntegerField(default=0) # Quantidade de p... | 2.515625 | 3 |
leetcode/wc_count_even_dig_sum.py | sci-c0/python-misc-problems | 0 | 36365 | <reponame>sci-c0/python-misc-problems
"""
https://leetcode.com/contest/weekly-contest-281/problems/count-integers-with-even-digit-sum/
Tags: Weekly-Contest_281; Brute-Force; Easy
"""
class Solution:
def countEven(self, num: int) -> int:
ans = 0
for i in range(1, num + 1):
s =... | 3.546875 | 4 |
tools/train_dist.py | shi510/cifr-pytorch | 0 | 36366 | import argparse
import os
import torch
import matplotlib.pyplot as plt
from torch.utils.data.distributed import DistributedSampler
from torch import distributed as dist
from torch import optim
from tqdm import tqdm
from torch_ema import ExponentialMovingAverage
from cifr.core.config import Config
from cifr.models.bui... | 1.929688 | 2 |
order/models.py | divyesh1099/badboystyle | 0 | 36367 | <filename>order/models.py
from django.db import models
import uuid
from product.models import Product
from django.contrib.auth.models import User
# Create your models here.
class Order(models.Model):
generated_order_id = models.CharField(max_length=100, default=uuid.uuid4, unique=True)
products = models.Ma... | 2.234375 | 2 |
src/ctc/protocols/uniswap_v2_utils/__init__.py | fei-protocol/checkthechain | 94 | 36368 | from .uniswap_v2_deltas import *
from .uniswap_v2_events import *
from .uniswap_v2_metadata import *
from .uniswap_v2_spec import *
from .uniswap_v2_state import *
| 0.9375 | 1 |
MAX40080/src/torque_test_stand/src/torque_tester.py | MilosRasic98/Orbweaver-Rover | 1 | 36369 | <reponame>MilosRasic98/Orbweaver-Rover
#!/usr/bin/env python3
import rospy
import serial
from std_msgs.msg import Float32
tt_arduino = serial.Serial("/dev/ttyUSB0", 9600)
rospy.init_node('torque_test_stand', anonymous = False)
pub = rospy.Publisher('/test_equipment/measured_torque', Float32, queue_size=10)
r = rospy... | 2.359375 | 2 |
tenant_schemas_celery/tests.py | bufke/tenant-schemas-celery | 0 | 36370 | <filename>tenant_schemas_celery/tests.py
from django.db import connection
from django.utils.unittest import skipIf
from tenant_schemas.tests.models import Tenant, DummyModel
from tenant_schemas.tests.testcases import BaseTestCase
from tenant_schemas.utils import get_public_schema_name
try:
from .app import Celer... | 1.84375 | 2 |
flake8_pie/tests/test_pie804_no_unnecessary_dict_kwargs.py | sbdchd/flake8-pie | 23 | 36371 | from __future__ import annotations
import ast
import pytest
from flake8_pie import Flake8PieCheck
from flake8_pie.pie804_no_unnecessary_dict_kwargs import PIE804
from flake8_pie.tests.utils import Error, ex, to_errors
EXAMPLES = [
ex(
code="""
foo(**{"bar": True})
""",
errors=[PIE804(lineno=2, c... | 2.171875 | 2 |
campfire/components/models/publications/Post.py | Camper-CoolDie/campfire.py | 0 | 36372 | from ...reqs import publications
from .. import main
class Post(main._all["publication"]):
"""
Имитирует объект поста.
"""
__slots__ = (
"pages",
"best_comment",
"rubric_id",
"rubric_name"
)
def __init__(self, content):
"""
Создать класс... | 2.640625 | 3 |
thyme/parsers/lammps.py | nw13slx/thyme | 0 | 36373 | <reponame>nw13slx/thyme
import logging
import numpy as np
from glob import glob
from os.path import getmtime, isfile
from os import remove
from thyme import Trajectory
from thyme.parsers.monty import read_pattern, read_table_pattern
from thyme.routines.folders import find_folders, find_folders_matching
from thyme._ke... | 2.0625 | 2 |
quizzes/mixins.py | NeedsSoySauce/testme | 1 | 36374 | from rest_framework.mixins import CreateModelMixin
from rest_framework.viewsets import GenericViewSet
class CreateUserLinkedModelMixin(CreateModelMixin, GenericViewSet):
"""
Set the user related to an object being created to the user who made the request.
Usage:
Override the class and set the `.q... | 2.703125 | 3 |
python-algorithm/leetcode/problem_191.py | isudox/nerd-algorithm | 5 | 36375 | """191. Number of 1 Bits
https://leetcode.com/problems/number-of-1-bits/
"""
class Solution:
def hammingWeight(self, n: int) -> int:
def low_bit(x: int) -> int:
return x & -x
ans = 0
while n != 0:
n -= low_bit(n)
ans += 1
return ans
| 3.578125 | 4 |
tests/test_base/test_components.py | jlichter/pyClarion | 25 | 36376 | import pyClarion.base as clb
import pyClarion.numdicts as nd
import unittest
import unittest.mock as mock
class TestProcess(unittest.TestCase):
@mock.patch.object(clb.Process, "_serves", clb.ConstructType.chunks)
def test_check_inputs_accepts_good_input_structure(self):
process = clb.Process(
... | 2.578125 | 3 |
service_capacity_modeling/models/org/netflix/stateless_java.py | jolynch/service-capacity-modeling | 6 | 36377 | <reponame>jolynch/service-capacity-modeling
import math
from decimal import Decimal
from typing import Any
from typing import Dict
from typing import Optional
from typing import Sequence
from typing import Tuple
from service_capacity_modeling.interface import AccessConsistency
from service_capacity_modeling.interface ... | 2.453125 | 2 |
kmmi/exposure/__init__.py | Decitizen/kMMI | 0 | 36378 | <gh_stars>0
from kmmi.exposure.exposure import * | 1.101563 | 1 |
proxies_list.py | Konstantinos-Papanagnou/LFITester | 0 | 36379 | import random
import requests
def clean_proxies():
proxies = []
with open('proxies', 'r') as handle:
contents = handle.read().strip()
for proxy in contents.split('\n'):
proxies.append(proxy)
proxy2 = []
print(proxies)
for proxy in proxies:
try:
response = requests.get('https://google.com', proxies={'... | 3.078125 | 3 |
chromoSpirals.py | zubrik13/coding_intrv_prer | 0 | 36380 | <filename>chromoSpirals.py<gh_stars>0
# chromoSpirals.py
# ----------------
# Code written by <NAME>, University of Sheffield, March 2013
# Draws spiralling patterns of circles using the Golden Angle.
# ----------------
# Import from the numpy and matplotlib packages.
import numpy as np
import matplotlib.pyplot as plt... | 3.328125 | 3 |
TODO_LIST/TODO_APP/views.py | Amit89499/TODO-APP-DJANGO | 4 | 36381 | from django.shortcuts import render,redirect
from django.http import HttpResponse
from .models import *
from .forms import *
# Create your views here.
def index(request):
tasks = Task.objects.all()
form=TaskForm()
if request.method =='POST':
form = TaskForm(request.POST)
if form.... | 2.140625 | 2 |
serial/splitter.py | tf-czu/gyrorad | 0 | 36382 | <reponame>tf-czu/gyrorad
#!/usr/bin/python
"""
Split logged data into separate "channels"
usage:
./splitter.py <log file> <GPS|0..3|all>
"""
import sys
FIRST_LINE = "id,timeMs,accX,accY,accZ,temp,gyroX,gyroY,gyroZ\n"
GPS_SEPARATOR_BEGIN = chr(0x2)
GPS_SEPARATOR_END = chr(0x3)
def checksum( s ):
sum... | 2.703125 | 3 |
main.py | opengovt/openroads-geostore | 1 | 36383 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import jinja2
import webapp2
import logging
import threading
from mandrill_email import *
from webapp2_extras import routes
from cookie import *
from settings import *
from decorators import *
from functions import *
from google.appengine.api import taskqueue
from google.ap... | 1.507813 | 2 |
railrl/planner/forward_planner/planner.py | fredshentu/public_model_based_controller | 0 | 36384 | from railrl.data_management.simple_replay_pool import SimpleReplayPool
from railrl.predictors.dynamics_model import FullyConnectedEncoder, InverseModel, ForwardModel
import tensorflow as tf
import time
import numpy as np
from sandbox.rocky.tf.optimizers.penalty_lbfgs_optimizer import PenaltyLbfgsOptimizer
from railrl.m... | 2.15625 | 2 |
RobinhoodTrader/config.py | jaxbulsara/RobinhoodTrader | 1 | 36385 | <reponame>jaxbulsara/RobinhoodTrader
from configparser import ConfigParser
import re
def getConfiguration():
configParser = ConfigParser()
configParser.read("config.ini")
return configParser
def getQrCode():
config = getConfiguration()
qrCode = config.get("login", "qrCode", fallback=None)
qr... | 2.5 | 2 |
tb_api_client/test/test_auth_controller_api.py | MOSAIC-LoPoW/oss7-thingsboard-backend-example | 5 | 36386 | # coding: utf-8
"""
Thingsboard REST API
For instructions how to authorize requests please visit <a href='http://thingsboard.io/docs/reference/rest-api/'>REST API documentation page</a>.
OpenAPI spec version: 2.0
Contact: <EMAIL>
Generated by: https://github.com/swagger-api/swagger-codegen.git
""... | 1.929688 | 2 |
pylib/mps/util/push_util.py | xkmato/py77 | 0 | 36387 | <gh_stars>0
#!/usr/bin/env python
"""
A variety of push utility functions
"""
from pylib.util.git_util import GitUtil
__author__ = '<EMAIL> (<NAME>)'
__copyright__ = 'Copyright 2013 Room77, Inc.'
class PushUtil(object):
@classmethod
def get_deployspec_name(cls, cluster_name):
"""given a cluster returns the... | 1.960938 | 2 |
shardingpy/parsing/lexer/dialect/mysql.py | hongfuli/sharding-py | 1 | 36388 | <gh_stars>1-10
import enum
from shardingpy.parsing.lexer import lexer
from shardingpy.parsing.lexer import token
class MySQLKeyword(enum.IntEnum):
SHOW = 1
DUAL = 2
LIMIT = 3
OFFSET = 4
VALUE = 5
BEGIN = 6
FORCE = 7
PARTITION = 8
DISTINCTROW = 9
KILL = 10
QUICK = 11
BI... | 2.296875 | 2 |
Day6/6.py | thatguyandy27/AdventOfCode2021 | 0 | 36389 | <reponame>thatguyandy27/AdventOfCode2021
input = [1, 1, 1, 1, 1, 1, 1, 4, 1, 2, 1, 1, 4, 1, 1, 1, 5, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 5, 1, 1, 1, 1, 3, 1, 1, 2, 1, 2, 1, 3, 3, 4, 1, 4, 1, 1, 3, 1, 1, 5, 1, 1, 1, 1, 4, 1, 1, 5, 1, 1, 1, 4, 1, 5, 1, 1, 1, 3, 1, 1, 5, 3, 1, 1, 1, 1, 1, 4, 1, 1, 1, 1, 1, 2, 4, 1, 1, 1, ... | 2.015625 | 2 |
xgds_core/util.py | xgds/xgds_core | 1 | 36390 | <reponame>xgds/xgds_core
# __BEGIN_LICENSE__
# Copyright (c) 2015, United States Government, as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All rights reserved.
#
# The xGDS platform is licensed under the Apache License, Version 2.0
# (the "License"); you may not use this ... | 1.96875 | 2 |
src/pycrunchbase/__init__.py | ngzhian/pycrunchbase | 67 | 36391 | from .pycrunchbase import (
CrunchBase,
)
from .resource import (
Acquisition,
Address,
Category,
Degree,
FundingRound,
Fund,
Image,
Investment,
IPO,
Job,
Location,
News,
Organization,
Page,
PageItem,
Person,
Product,
Relationship,
StockExc... | 1.398438 | 1 |
dropconnect_tensorflow/__init__.py | AryaAftab/dropconnect-tensorflow | 2 | 36392 | <gh_stars>1-10
from dropconnect_tensorflow.dropconnect_tensorflow import DropConnectDense, DropConnectConv2D, DropConnect
| 1.09375 | 1 |
venv/Lib/site-packages/Database/es/es_utils.py | jhonniel/Queuing-python | 0 | 36393 | <gh_stars>0
def none_check(value):
if value is None:
return False
else:
return True
def is_empty(any_type_value):
if any_type_value:
return False
else:
return True
| 2.765625 | 3 |
hstrat/test/test_helpers/test_is_nonincreasing.py | mmore500/hstrat | 0 | 36394 | <reponame>mmore500/hstrat
import unittest
from hstrat.helpers import is_nonincreasing
class TestIsNondecreasing(unittest.TestCase):
# tests can run independently
_multiprocess_can_split_ = True
def test_empty(self):
assert is_nonincreasing([])
def test_singleton(self):
assert is_non... | 2.921875 | 3 |
HW1/HW1.py | hsuan81/2020spring_NTNU_IR | 0 | 36395 | import numpy as np
import matplotlib.pyplot as plt
from docx import Document
from docx.shared import Cm
import math
def split_file(file):
"""split the file by different queries into seperate list element and return one list as a whole. """
answer = [[]]
j = 0
for i in file:
if i == "\n":
... | 3.40625 | 3 |
flowder/utils.py | amir-khakshour/flowder | 3 | 36396 | import csv
import re
import netifaces as ni
from twisted.internet import defer
from twisted.names import client
from pygear.logging import log
from pygear.core.six.moves.urllib.parse import urlparse, urljoin
from .interfaces import ITaskStorage
csv.register_dialect('pipes', delimiter='|')
client_callback_schemes = ... | 2.25 | 2 |
neuralparticles/scripts/hyper_search.py | senliontec/NeuralParticles | 0 | 36397 | import os
import json
import math
from neuralparticles.tensorflow.tools.hyper_parameter import HyperParameter, ValueType, SearchType
from neuralparticles.tensorflow.tools.hyper_search import HyperSearch
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
import keras
from neuralparticles.tensor... | 2.140625 | 2 |
app.py | ranjankoirala1998/sms-with-twilio-api | 0 | 36398 | <gh_stars>0
from twilio.rest import Client
from scrapper import get_body
from os import environ
account_sid = environ['ACCOUNT_SID']
auth_token = environ['AUTH_TOKEN']
phone_num = '+9779862074364'
def send_sms():
client = Client(account_sid, auth_token)
sms = client.messages.create(
from_= '+177... | 2.4375 | 2 |
app/jwt.py | smolveau/Simple-Flask-Web-App-CI-CD | 0 | 36399 | <gh_stars>0
# app/jwt.py
from os import environ as env
from itsdangerous import (
TimedJSONWebSignatureSerializer as Serializer,
BadSignature,
SignatureExpired,
)
def generate_jwt(claims, expiration=172800):
s = Serializer(env.get("SECRET_KEY"), expires_in=expiration)
return s.dumps(claims).decod... | 2.421875 | 2 |