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
pynse/pynse.py
nitinkumar4321/pynse
1
12767251
<filename>pynse/pynse.py import datetime as dt import time import enum import logging import urllib.parse import requests from bs4 import BeautifulSoup import pandas as pd import numpy as np import io import zipfile import os import shutil import pickle logger = logging.getLogger(__name__) class In...
2.5
2
experiments/vneTest.py
sri-sensors/prosthnet
0
12767252
import vne from vne.constants import nfeat, nsensors from vne.model import simpleModel, init_weights_simple from vne.persist import save_model, load_model import numpy as np import torch import os def encode_save(sig=np.random.random([1, nfeat, nsensors]), name='simpleModel_ini', dir_path="../src/vne/models"): ""...
3.125
3
finetune_vs_scratch/experiments.py
finiteautomata/finetune_vs_scratch
12
12767253
<reponame>finiteautomata/finetune_vs_scratch import os import torch import tempfile from pysentimiento.metrics import compute_metrics from transformers import Trainer, TrainingArguments, DataCollatorWithPadding class MultiLabelTrainer(Trainer): """ Multilabel and class weighted trainer """ def __init...
2.3125
2
inference.py
jmendozais/SDSSDepth
0
12767254
import os import argparse import configargparse import time import glob import numpy as np import torch from torch.utils.data import Dataset, DataLoader from torchvision.transforms import functional as VF from torch.nn import functional as F import cv2 import model import data from eval.kitti_depth_eval_utils import ...
2.21875
2
defcon/_labeling.py
kmdouglass/DEFCoN
9
12767255
<gh_stars>1-10 # © All rights reserved. ECOLE POLYTECHNIQUE FEDERALE DE LAUSANNE, # Switzerland, Laboratory of Experimental Biophysics, 2018 # See the LICENSE.txt file for more details. import os import h5py import numpy as np import pandas as pd import tifffile from scipy.stats import multivariate_normal #%% gener...
2.359375
2
GlobalSim_cluster.py
cosmo-epfl/glosim2
12
12767256
from subprocess import Popen from time import time,ctime from libmatch.utils import s2hms,print_logo import cPickle as pck from GlobalSimilarity import get_globalKernel import numpy as np from Pool.mpi_pool import MPIPool import sys,os,argparse import quippy as qp def func(command): p = Popen(command, shell=True) ...
2.265625
2
AES/test2.py
Pumpkin-NN/Cryptography
0
12767257
data_matrix = [ [2, 3, 1, 1], [1, 2, 3, 1], [1, 1, 2, 3], [3, 1, 1, 2] ] def fill_zeros(data_val): return bin(int(data_val, 16))[2:].zfill(8) input_hex = [0xd4, 0xbf, 0x5d, 0x30] input_bin = [] for i, bi...
3.25
3
ait/core/bin/ait_table_decode.py
robschneider16/AIT-Core
1
12767258
<filename>ait/core/bin/ait_table_decode.py #!/usr/bin/env python # Advanced Multi-Mission Operations System (AMMOS) Instrument Toolkit (AIT) # Bespoke Link to Instruments and Small Satellites (BLISS) # # Copyright 2016, by the California Institute of Technology. ALL RIGHTS # RESERVED. United States Government Sponsors...
2.390625
2
searchable-options/searchable_options_test.py
phpc0de/idea-android
0
12767259
import filecmp import glob import os import platform import re import shutil import unittest import zipfile import update_searchable_options class SearchableOptionTests(unittest.TestCase): """Tests searchable options to be up-to-date. This test purpose is to generate these files, so whenever a configurable or ...
2.640625
3
src/conll_to_text.py
talktovishal/biasCDA
0
12767260
<filename>src/conll_to_text.py import argparse from utils.conll import load_sentences, load_sentences_from_string from utils.data import get_sentence_text from tqdm import tqdm import os """ Program to convert a conll file to a text file """ def getTextFromConllu(conlluLines): print(f"getTextFromConllu::conllu = ...
3.515625
4
encoder3.py
dhylands/upy-examples
78
12767261
<filename>encoder3.py import pyb import stm # This script sets up a timer to do quadrature decoding # # THis script assumes that you have a jumper from X1 to X3 and X2 to X4 out_idx = 0 out_seq = [0, 1, 3, 2] pin_a2 = pyb.Pin('X3', pyb.Pin.OUT_PP) pin_b2 = pyb.Pin('X4', pyb.Pin.OUT_PP) def set_out(): print("Wri...
2.78125
3
examplecode/n_pointed_start.py
lacitrus/LC101_ThinkPython
0
12767262
<filename>examplecode/n_pointed_start.py<gh_stars>0 # creat n-pointed star import turtle def draw_star(turtle, n): for i in range(n): turtle.forward(100) turtle.right(180-180/n) def main(): tess = turtle.Turtle() draw_star(tess, 9) if __name__ == "__main__": main()
3.5625
4
databroker/tests/test_v2/test_multi_descriptor.py
ericdill/DataBroker
15
12767263
<filename>databroker/tests/test_v2/test_multi_descriptor.py from pytest import fixture import pytest import event_model import numpy as np import time from databroker.in_memory import BlueskyInMemoryCatalog data_shape = (1000, 1000) @fixture(params=[(('primary', 'baseline'), True), (('primary', 'primary'), True), ...
2.078125
2
optimus/lr_method/armijo.py
IanTayler/tao-exercises
3
12767264
"""Armijo rule.""" import numpy as np from optimus.types import LRMethod, Function class Armijo(LRMethod): """Armijo method for finding Learning Rate. This method successively reduces the learning rate until it finds the resulting change to be as good as a linear approximation of the function. """ ...
3.46875
3
esileapclient/v1/offer.py
betaredex/python-esileapclient
0
12767265
# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # d...
1.71875
2
modules/speaker/software/tcp_speaker.py
riera90/Pancho
0
12767266
#!/usr/bin/python3 from pygame import mixer import re, os, signal import paho.mqtt.client as mqtt import config class Player(): def __init__(self, path=""): self.__path = path self.__mixer = mixer self.__mixer.init() self.__vlc_pid = None self.__vlc_url = None def se...
2.59375
3
assignments/test_binary_search.py
yamaszone/software-testing
13
12767267
import unittest import binary_search class test_binary_search(unittest.TestCase): def test_binary_search_returns_true_when_search_key_found(self): self.assertTrue(binary_search.binary_search([3, 1, 2], 2)) def test_binary_search_returns_false_when_search_key_not_found(self): self.assertFalse(...
3.515625
4
tests/test_halos/test_uldm.py
DarthLazar/pyHalo
0
12767268
from astropy.cosmology.funcs import z_at_value import numpy as np from pyHalo.single_realization import SingleHalo import numpy.testing as npt import numpy as np from pyHalo.Halos.HaloModels.ULDM import ULDMFieldHalo, ULDMSubhalo from pyHalo.Halos.lens_cosmo import LensCosmo from pyHalo.Cosmology.cosmology import Cosmo...
1.9375
2
ARCIT/forms.py
s0hailAnsari/ARCIT
0
12767269
from django.contrib.auth.forms import UserCreationForm from django.contrib.auth import get_user_model class UserForm(UserCreationForm): class Meta: model = get_user_model() fields = ('username', '<PASSWORD>', '<PASSWORD>', )
2.1875
2
setup.py
zhouzaihang/jupyterlab_micropython_kernel
7
12767270
<reponame>zhouzaihang/jupyterlab_micropython_kernel<gh_stars>1-10 from pathlib import Path from setuptools import setup # Get the long description from the README file project = Path(__file__).parent with (project / 'README.md').open(encoding='utf-8') as f: long_description = f.read() setup(name="jupyterlab_micro...
1.78125
2
ladderdev/RatingSystemTester.py
fistaco/Smogon-Usage-Stats
26
12767271
<filename>ladderdev/RatingSystemTester.py #!/usr/bin/python # -*- coding: latin-1 -*- import sys import gzip import json import math import cPickle as pickle def incorrectSyntax(): sys.stderr.write('Incorrect syntax.\n') sys.stderr.write('Correct usage:\n') sys.stderr.write('\tpython RatingSystemTester.py SYSTEMS ...
2.515625
3
tests/junk/recall/train_keras.py
imandr/gradnet
0
12767272
from generator import Generator import numpy as np, random np.set_printoptions(precision=4, suppress=True, linewidth=132) from tensorflow import keras from tensorflow.keras.layers import LSTM, Dense, Input from tensorflow.keras import Model from tensorflow.keras.optimizers import Adagrad def create_net(nwords, batch...
2.859375
3
eternal/7win.py
pjturcot/eternal
0
12767273
import json import re import matplotlib.pyplot as plt import pandas as pd import scipy.stats import eternal.card import eternal.ewc import eternal.plot CARDS_DATA = eternal.card.ALL.data def imode(src): """Return a copy of a series where all case-insensitive versions have been replaced with the most common cas...
2.59375
3
InvenTree/part/migrations/0011_part_revision.py
ArakniD/InvenTree
656
12767274
# Generated by Django 2.2.2 on 2019-06-20 11:37 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('part', '0010_auto_20190620_2135'), ] operations = [ migrations.AddField( model_name='part', name='revision', ...
1.453125
1
2016_IceCTF/a_strong_feeling_for_bruteforcing.py
kenoph/WriteUps
2
12767275
<gh_stars>1-10 #!/usr/bin/env python3 import subprocess def run(txt): return subprocess.run('./a_strong_feeling', input=txt, stdout=subprocess.PIPE).stdout if __name__ == '__main__': key = b'' for n in range(500): res = dict() for l in range(1, 128): curr = key + bytes...
2.890625
3
annotate.py
mvasilkov/Makeup-Running
1
12767276
<gh_stars>1-10 #!/usr/bin/env python3 import html import pathlib import sys import webbrowser from makeup_running.parser import Makefile, LineType def print_line(f, line_number, line_t) -> str: line_type, line = line_t class_name = 'target' if line_type == LineType.TARGET else 'recipe' if line_type == LineT...
2.84375
3
scripts/generate_inputs.py
marcullo/image-renderer
0
12767277
#!/usr/bin/env python3 import argparse class Rectangle: def __init__(self, x, y, w, h): self.x = x self.y = y self.w = w self.h = h def __repr__(self): return f'DRAW_RECTANGLE {self.x},{self.y},{self.w},{self.h}' @staticmethod def spawn(start, delta_x, delta_y...
3.34375
3
final/one_time/reddit.py
Fabhi/sentiment-analysis
1
12767278
import json from emotion import ProcessEmotions f = open("reddit.json",encoding = 'utf-8') loaded = json.load(f) data = loaded["data"]["children"] text = map(lambda x: x["data"]["title"], data) res = map(ProcessEmotions, text) for item in res: if item: for i in item: if i["valid"]: ...
3.40625
3
songs/la-gran-jaime/pop.py
mathigatti/EP
1
12767279
<filename>songs/la-gran-jaime/pop.py<gh_stars>1-10 Root.default = -3 Scale.default = 'minor' Clock.bpm=100 acordes = [(2,4,6),(-1,1,3),(0,2,4)] escalera = P[5,4,3,2] p1 >> space([0,0,4,2,0,0,5,2],dur=1,amp=[0,1,1,1]) d1 >> play("X ",amp=1) pt >> play('#', dur=16,sus=4, rate=-1/2, amp=var([1,0],[16,inf],start=now)) p1...
2.234375
2
homeassistant/components/sql/sensor.py
davyike/core
3
12767280
"""Sensor from an SQL Query.""" from __future__ import annotations from datetime import date import decimal import logging import sqlalchemy from sqlalchemy.exc import SQLAlchemyError from sqlalchemy.orm import scoped_session, sessionmaker import voluptuous as vol from homeassistant.components.recorder import CONF_D...
2.078125
2
packages/w3af/w3af/core/data/kb/kb_url_extensions.py
ZooAtmosphereGroup/HelloPackages
0
12767281
<gh_stars>0 """ kb_url_extensions.py Copyright 2019 <NAME> This file is part of w3af, http://w3af.org/ . w3af is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation version 2 of the License. w3af is distributed in the...
1.773438
2
sodium/yolo/__init__.py
Keerthi001/PySodium
3
12767282
from .yolo import YoloOpenCV
1.023438
1
api/resources/video.py
melonmanchan/gachimuch.io-api
0
12767283
<gh_stars>0 __author__ = 'matti' from common.database import db import datetime from flask import jsonify from flask_restful import Resource from models.video import VideoModel class Video(Resource): def get(self, videoid): video = VideoModel.query.get_or_404(videoid) video.views += 1 db....
2.65625
3
Generate_Synthetic_Data/render_fcns.py
saeedmhz/Sarc-Graph
1
12767284
import numpy as np import matplotlib.pyplot as plt import os import cv2 from scipy.ndimage import gaussian_filter, median_filter from matplotlib.animation import FuncAnimation from perlin_noise import PerlinNoise ########################################################################################## # FUNCTIONS FOR...
2.484375
2
ex019.py
ranierelm/Python_exercise
0
12767285
import random a1 = input('Primeiro aluno: ') a2 = input('Segundo aluno: ') a3 = input('Terceiro aluno: ') a4 = input('Quarto aluno: ') sorteio = [a1,a2,a3,a4] random.shuffle(sorteio) #Shuffle (embaralha lista) #Choice (Escolhe 1 da lista) print(f'Ordem de apresentação: {sorteio}')
3.609375
4
spresso/utils/crypto.py
lujung/python-spresso
0
12767286
"""This module provides the necessary cryptographic primitives for the system. It is based on the `cryptography <https://cryptography.io/en/latest/>`_ package.""" from cryptography.hazmat.backends import default_backend from cryptography.hazmat.primitives import hashes, serialization from cryptography.hazmat.primitive...
3.203125
3
core/testIMain.py
xrami/Door-Interactive
0
12767287
#!/usr/bin/env python3 # Test Interactive import datetime from core import config,raiDB,SMSInteractive input = True doorType = 'glass' print(datetime.datetime.now()) databaseInteractive.interactive(input,doorType) #SMSInteractive.interactive(input)
2.15625
2
pandemik/Polymod.py
autonomio/pandemik
4
12767288
_url = 'https://raw.githubusercontent.com/mikkokotila/version-controlled-data/master/data/polymod_social_contact_data.csv' class Polymod: def __init__(self, data=None): import pandas as _pd self.data = _pd.read_csv(_url) def country_data(self, country_code='fi'): ...
3.453125
3
watering-plants-ii/watering-plants-ii.py
jurayev/data-structures-algorithms-solutions
0
12767289
<gh_stars>0 class Solution: def minimumRefill(self, plants: List[int], capacityA: int, capacityB: int) -> int: """ [2,2,4,3,3] A = 5, B = 5 cans = 1 1 2 [1,2,4,4,5] A = 6, B = 2 cans = 3 0,3 1,1 (c-(sum%c))...
3.234375
3
db/fixUnFormatedData.py
yankj12/interview
0
12767290
#!/usr/bin/env python # -*- coding:utf-8 -*- ''' 转换以下字段的格式 birth yyyy/MM graduateMonth yyyy/MM firstJobBeginMonth yyyy/MM firstPhoneCallTime yyyy-MM-dd HH:mm:ss firstInterviewTime yyyy-MM-dd HH:mm:ss secondInterviewTime yyyy-MM-dd HH:mm:ss ''' __author__ = 'yankj12' from pymongo import MongoClient #from bson.o...
2.890625
3
app/app/urls.py
rikkt0r/django-organiser
0
12767291
<gh_stars>0 # https://docs.djangoproject.com/en/1.8/topics/http/urls/ from django.conf.urls import include, url from django.contrib import admin handler404 = 'app.views.error404' handler500 = 'app.views.error500' urlpatterns = [ url(r'^$', 'tasks.views.index', name='index'), url(r'^admin/', include(admin.sit...
1.976563
2
CIM14/CPSM/StateVariables/StateVariables/TopologicalIsland.py
MaximeBaudette/PyCIM
58
12767292
<gh_stars>10-100 # Copyright (C) 2010-2011 <NAME> # # 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 to use, copy, modify, merge,...
1.757813
2
code/huxt_inputs.py
University-of-Reading-Space-Science/GeoModelUncertainty
0
12767293
<reponame>University-of-Reading-Space-Science/GeoModelUncertainty<gh_stars>0 import httplib2 import urllib import huxt as H import os from pyhdf.SD import SD, SDC import numpy as np import astropy.units as u from scipy.io import netcdf def get_MAS_boundary_conditions(cr=np.NaN, observatory='', runtype='', runnumber...
2.609375
3
examples/simple_models/mobilenet/model/src/func_main.py
Hydrospheredata/hydro-serving-runtime
7
12767294
<reponame>Hydrospheredata/hydro-serving-runtime<gh_stars>1-10 import numpy as np import tensorflow as tf from keras.applications import mobilenet_v2 mobile_net = mobilenet_v2.MobileNetV2( alpha=0.35, weights="/model/files/mobilenet_v2_weights_tf_dim_ordering_tf_kernels_0.35_224" ) graph = tf.get_default_graph(...
2.375
2
cohesity_management_sdk/controllers/remote_restore_controller.py
nick6655/management-sdk-python
18
12767295
<filename>cohesity_management_sdk/controllers/remote_restore_controller.py # -*- coding: utf-8 -*- # Copyright 2021 Cohesity Inc. import logging from cohesity_management_sdk.api_helper import APIHelper from cohesity_management_sdk.configuration import Configuration from cohesity_management_sdk.controllers.base_control...
2.171875
2
tests/test_common/test_crypto.py
so1n/rap
3
12767296
<gh_stars>1-10 import pytest from rap.common.crypto import Crypto class TestCrypto: def test_init_error(self) -> None: with pytest.raises(ValueError): Crypto("keyskeyskeyskey") def test_crypto_str(self) -> None: crypto: "Crypto" = Crypto("keyskeyskeyskeys") raw_str: str =...
2.4375
2
day1_1.py
SeyelentEco/AdventOfCode2018
0
12767297
def main(): totalNum = 0 totalValues = {} filename = 'day1_1_input.txt' found = False while not found: userInput = open(filename, 'r') print ("Starting from the top") for i in userInput: print (i) if i[0] == '-': totalNum -= int(i[1:]) ...
3.40625
3
Tools/Misc.py
MuZiGuYue/VideoSuperResolution
1
12767298
""" Copyright: Wenyi Tang 2017-2019 Author: <NAME> Email: <EMAIL> Created Date: Jan 7th, 2019 Misc utility tools - make TFRecords files """ # Copyright (c): <NAME> 2017-2019. # Author: <NAME> # Email: <EMAIL> # Update Date: 2019/4/3 下午5:03 import tensorflow as tf def make_tensor_label_records(tensors, labels, ...
2.609375
3
utils/dihedralAngle.py
jameswind/neuralCT
28
12767299
<reponame>jameswind/neuralCT import numpy as np import torch # Adopted from https://stackoverflow.com/questions/20305272/dihedral-torsion-angle-from-four-points-in-cartesian-coordinates-in-python def dihedralAngle(p0,p1,p2,p3): b0 = -1.0*(p1-p0) b1 = p2-p1 b2 = p3-p2 b0xb1 = torch.cross(b0,b1,dim=1) ...
2.625
3
EOC/prototype/model/__init__.py
double-fire-0/SystemNoise
8
12767300
<filename>EOC/prototype/model/__init__.py from .mobilenet_v2 import mobilenet_v2 # noqa: F401 from .regnet import ( # noqa: F401 regnetx_200m, regnetx_400m, regnetx_600m, regnetx_800m, regnetx_1600m, regnetx_3200m, regnetx_4000m, regnetx_6400m, regnety_200m, regnety_400m, regnety_600m, regnety_800m, r...
1.515625
2
tests/unit/contrib/system/conftest.py
gitter-badger/sitri
0
12767301
import pytest from sitri.contrib.system import SystemConfigProvider, SystemCredentialProvider @pytest.fixture(scope="module") def system_config() -> SystemConfigProvider: return SystemConfigProvider(prefix="test") @pytest.fixture(scope="module") def system_credential() -> SystemCredentialProvider: return S...
1.898438
2
scripts/classical/fisher_relationship.py
doubleblind666/inferring-undiscovered-species-extinctions
2
12767302
<filename>scripts/classical/fisher_relationship.py<gh_stars>1-10 # get the relationship between the omega and the total number of species infered import sys sys.path.insert(0,'../../undetected_extinctions') # so I can import the undetected extinctions package import csv import numpy as np from scipy.stats import unif...
3.0625
3
whisk/whisk.py
BookletAI/whisk
8
12767303
"""Main module.""" import whisk from whisk.cli.log_tree import PARENT_TREE_NODE_PREFIX, CHILD_TREE_NODE_PREFIX from cookiecutter.main import cookiecutter from os.path import realpath # https://docs.python.org/3/library/pathlib.html # Object-oriented filesystem paths from pathlib import Path import logging logger = log...
2.734375
3
machine_learning/anomaly/demo1.py
caserwin/daily-learning-python
1
12767304
# -*- coding: utf-8 -*- # @Time : 2019/1/8 下午8:20 # @Author : yidxue from __future__ import division import numpy import datetime import pandas as pd def get_all_file_path(path): """ 循环遍历,得到一个文件夹第一层下的文件路径 """ import os file_name_list = os.listdir(path) return [path + os.sep + file_name for...
2.3125
2
happy_birthday_drchrono/drchronoAPI/api.py
TimothyBest/Happy_Birthday_drchrono
0
12767305
<filename>happy_birthday_drchrono/drchronoAPI/api.py import requests, urllib # TODO: make generic API get function def get_patients(user, parameters={}): social = user.social_auth.get(user=user) access_token = social.extra_data['access_token'] headers = {'Authorization': 'Bearer {0}'.format(access_token)...
2.84375
3
bot/app/digest/digest.py
dziban303/SpaceLaunchNow-Server
0
12767306
<reponame>dziban303/SpaceLaunchNow-Server import logging import bot.app.digest.daily as daily_check import bot.app.digest.weekly as weekly_check from bot.utils.config import keys # import the logging library # Get an instance of a logger from spacelaunchnow import config logger = logging.getLogger('bot.digest') AU...
2.421875
2
httoop/parser.py
spaceone/httoop
13
12767307
# -*- coding: utf-8 -*- u"""Implements a state machine for the parsing process. """ # TODO: translation API from __future__ import absolute_import from httoop.exceptions import Invalid, InvalidBody, InvalidHeader, InvalidLine, InvalidURI from httoop.header import Headers from httoop.messages import Message from httoo...
2.65625
3
src/picobox/_stack.py
ikalnytskyi/picobox
35
12767308
<reponame>ikalnytskyi/picobox<gh_stars>10-100 """Picobox API to work with a box at the top of the stack.""" import contextlib import functools import threading import typing as t from ._box import Box, ChainBox def _copy_signature(method, instance=None): # This is a workaround to overcome 'sphinx.ext.autodoc' i...
1.960938
2
mtgjson5/classes/mtgjson_deck_header.py
0az/mtgjson
512
12767309
<gh_stars>100-1000 """ MTGJSON Singular Deck Header Object """ from typing import Any, Dict from ..classes.mtgjson_deck import MtgjsonDeckObject from ..utils import to_camel_case class MtgjsonDeckHeaderObject: """ MTGJSON Singular Deck Header Object """ code: str file_name: str name: str ...
2.34375
2
aikit/datasets/__init__.py
gfournier/aikit
23
12767310
# -*- coding: utf-8 -*- """ Created on Fri May 4 13:33:07 2018 @author: <NAME> """ from .datasets import ( DatasetEnum, load_dataset, load_titanic, load_imdb, load_electricity, load_housing, load_quora, load_abalone, load_pokemon, load_wikinews, ) __all__ = [ "DatasetEnu...
1.5
2
server/api/bin/api_start.py
mminamina/311-data
0
12767311
<reponame>mminamina/311-data import sys from os.path import join, dirname sys.path.append(join(dirname(__file__), '../src')) def update(): from datetime import datetime import time import db import pb time.sleep(5) last_updated = db.info.last_updated() time_since_update = datetime.utcnow...
2.296875
2
tests/preferences_test.py
CraftyChimera/nittfest-site
0
12767312
""" Tests for preferences route """ import json from fastapi.testclient import TestClient from config.settings import settings jwt_test = settings.test_jwt header = {"Authorization": f"Bearer {jwt_test}"} ROUTE = "/preferences/" body = json.dumps( { "email": "string", "preferences": ["EVENTS", "...
2.5625
3
settings.py
Eforcers/python-gae-template
1
12767313
#-*- coding: utf-8 -*- # vim: set fileencoding=utf-8 """ settings.py Configuration for Flask app Important: Place your keys in the secret_keys.py module, which should be kept out of version control. """ import logging import os import urllib from secret_keys import CSRF_SECRET_KEY, SESSION_KEY class C...
2.40625
2
sdk/consumption/azure-mgmt-consumption/tests/test_budgets.py
adewaleo/azure-sdk-for-python
1
12767314
# coding: utf-8 # ------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for # license information. # --------------------------------------------------------------------...
2.078125
2
play_chess.py
jstrassburg/cs6230-chess-player
0
12767315
import argparse from chess_player.ChessGame import ChessGame from chess_player.Player import SearchPlayer, RandomPlayer from chess_player.Scorer import SimplifiedEvaluationFunction from random import randint from time import perf_counter class Program: @staticmethod def main(): program = Program() ...
3.234375
3
bouser_simargl/message.py
hitsl/bouser_simargl
0
12767316
# -*- coding: utf-8 -*- from bouser.utils import as_json __author__ = 'viruzzz-kun' class Message(object): immediate = True # Мгновенное сообщение: будет ставиться в очередь, не пишется в лог secondary = False # Вторичное сообщение: не пишется в лог control = False # Управляющее сообщение: для упра...
2.203125
2
api/tests/test_balance_payments.py
jcuna/room-mgt
0
12767317
<gh_stars>0 from datetime import datetime, timedelta import pytest from dateutil.relativedelta import * from _decimal import Decimal from flask.testing import FlaskClient from tests import front_end_date, endpoint from tests.seeders import seed_tenant, seed_new_agreement, seed_project, seed_room def test_seeding_data...
2.28125
2
flask_cloudflare/__init__.py
BillSchumacher/Flask-CloudFlare
5
12767318
# -*- coding: utf-8 -*- # Copyright (C) 2019 by <NAME> # # Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby # granted. # # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL # IMPLIED WARRANTIE...
2.171875
2
fidimag/micro/dmi.py
computationalmodelling/fidimag
53
12767319
<reponame>computationalmodelling/fidimag import fidimag.extensions.micro_clib as micro_clib import numpy as np from .energy import Energy from fidimag.common.constant import mu_0 import fidimag.common.helper as helper # import gc class DMI(Energy): """ Compute the Dzyaloshinskii-Moriya interaction in the mi...
2.59375
3
vcfremapper/samples.py
jeremymcrae/vcfremapper
0
12767320
from collections import OrderedDict class Sample(object): ''' hold sample data for a variant (e.g. genotype call, allele depths) ''' # set up a class variable that will be shared by all Sample instances, ie, # all individuals for a given variant. That way they have a common set of # keys for the v...
3.046875
3
logstash/handler_tcp.py
MWedl/python-logstash
1
12767321
<gh_stars>1-10 from logging.handlers import DatagramHandler, SocketHandler from logstash import formatter # Derive from object to force a new-style class and thus allow super() to work # on Python 2.6 class TCPLogstashHandler(SocketHandler, object): """Python logging handler for Logstash. Sends events over TCP. ...
2.6875
3
lib/python2.7/site-packages/appionlib/apWebScript.py
leschzinerlab/myami-3.2-freeHand
0
12767322
### webscripting #python import MySQLdb #appion from appionlib import appiondata #leginon import sinedon #===================== def setJobToRun(jobid): if getJobStatus(jobid) == "R": return False return setJobStatus(jobid, "R") #===================== def setJobToDone(jobid): if getJobStatus(jobid) == "D": ret...
2.40625
2
scikits/statsmodels/examples/example_kde.py
matthew-brett/statsmodels
0
12767323
<filename>scikits/statsmodels/examples/example_kde.py from scipy import stats import numpy as np from scikits.statsmodels.sandbox.distributions.mixture_rvs import mixture_rvs from scikits.statsmodels.nonparametric.kde import (kdensity, kdensityfft) import matplotlib.pyplot as plt np.random.seed(12345) obs_dist = mixtu...
2.40625
2
couchbasekit/__init__.py
ardydedase/couchbasekit
3
12767324
#! /usr/bin/env python """ couchbasekit ~~~~~~~~~~~~ A wrapper around CouchBase Python driver for document validation and more. :website: http://github.com/kirpit/couchbasekit :copyright: Copyright 2013, <NAME> <kirpit *at* gmail.com>, see AUTHORS.txt. :license: MIT, see LICENSE.txt for details. """ from couchbasekit...
1.6875
2
tests/frontend/user/__init__.py
agdsn/pycroft
18
12767325
from flask import url_for from tests import FrontendWithAdminTestBase from tests.factories import RoomFactory, SubnetFactory, PatchPortFactory class UserLogTestBase(FrontendWithAdminTestBase): def get_logs(self, user_id=None, **kw): """Request the logs, assert validity, and return the response. ...
2.40625
2
exercises/bob/example.py
kishankj/python
1,177
12767326
<gh_stars>1000+ def response(hey_bob): hey_bob = hey_bob.strip() if _is_silence(hey_bob): return 'Fine. Be that way!' if _is_shouting(hey_bob): if _is_question(hey_bob): return "Calm down, I know what I'm doing!" else: return 'Whoa, chill out!' elif _is_q...
3.09375
3
test/test_source_base.py
macbre/Mike
6
12767327
""" Set of unit test for SourceBase class """ import pytest from mycroft_holmes.errors import MycroftSourceError from mycroft_holmes.sources.base import SourceBase from mycroft_holmes.sources import ConstSource def test_get_sources_names(): sources = SourceBase.get_sources_names() print(sources) assert ...
2.453125
2
18.py
ikramulkayes/Python_season2
0
12767328
<filename>18.py word = input("Enter a number: ") word = int(word) count =10 while True: temp = word % 10 word = word//10 if temp % 2==0: print(temp,end="") if word == 0: break
3.921875
4
pythonProject1/venv/Lib/site-packages/customtkinter/customtkinter_progressbar.py
mjtomlinson/CNE330_Python_1_Final_Project
0
12767329
import tkinter from .customtkinter_frame import CTkFrame from .appearance_mode_tracker import AppearanceModeTracker from .customtkinter_color_manager import CTkColorManager class CTkProgressBar(tkinter.Frame): def __init__(self, bg_color=None, border_color=CTkColorManager.PROGRE...
2.6875
3
KancolleConnector.py
zigoni/KancolleConnecotr
2
12767330
<filename>KancolleConnector.py import os import random from flask import Flask, request, abort, session, render_template from requests.exceptions import ReadTimeout from kcc import get_play_url, DmmTokenError, TokenError, AjaxRequestError, LoginError app = Flask(__name__) def get_random_string(length=16, allowed_cha...
1.976563
2
tests/test_vector.py
metagraph-dev/dask-grblas
3
12767331
<filename>tests/test_vector.py import inspect import grblas as gb import pytest from grblas import dtypes from pytest import raises import dask.array as da import dask_grblas as dgb from .utils import compare @pytest.fixture def vs(): v = gb.Vector.from_values([0, 1, 2, 4, 5], [0, -20, 30, 40, 50]) dv0 = d...
2.21875
2
closed/Intel/code/bert-99/mxnet/run_mxnet_server.py
wom-ai/inference_results_v1.0
0
12767332
""" This is a sample stub of loadgen with multiple processes support. Each process sets its affinity by a proc list. Loadgen is a producer, which calls issue_queries(). issue_queries() gets query from loadgen and puts query id/sample indices into an input queue. Each Consumer(process)'s run() reads input queue, calls...
2.453125
2
scripts/eval_bop19.py
MartinSmeyer/bop_toolkit
0
12767333
# Author: <NAME> (<EMAIL>) # Center for Machine Perception, Czech Technical University in Prague """Evaluation script for the BOP Challenge 2019.""" import os import time import argparse import subprocess import numpy as np from bop_toolkit_lib import config from bop_toolkit_lib import inout from bop_toolkit_lib imp...
2.125
2
python_scripts/datasets_bike_rides.py
aquinquenel/scikit-learn-mooc
1
12767334
# --- # jupyter: # kernelspec: # display_name: Python 3 # name: python3 # --- # %% [markdown] # # The bike rides dataset # # In this notebook, we will present the "Bike Ride" dataset. This dataset is # located in the directory `datasets` in a comma separated values (CSV) format. # # We open this dataset usin...
3.921875
4
nlp/tests/test_marshal.py
mobarski/sandbox
0
12767335
<filename>nlp/tests/test_marshal.py<gh_stars>0 import marshal import numpy as np a = np.array([[1,2],[3,4]],dtype=np.uint8) m = marshal.dumps(a) print(len(m))
2.28125
2
src/post/migrations/0003_auto_20161113_1742.py
pandeydivesh15/item_sharing_portal
1
12767336
<gh_stars>1-10 # -*- coding: utf-8 -*- # Generated by Django 1.10.1 on 2016-11-13 17:42 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('post', '0002_post_is_share_post'), ] operations = [ migratio...
1.570313
2
gunpowder/nodes/defect_augment.py
trivoldus28/gunpowder
43
12767337
import logging import random import numpy as np # imports for deformed slice from skimage.draw import line from scipy.ndimage.measurements import label from scipy.ndimage.interpolation import map_coordinates from scipy.ndimage.morphology import binary_dilation from gunpowder.batch_request import BatchRequest from gun...
2.09375
2
municipios/views.py
coletivoEITA/django-municipios
0
12767338
# -*- coding: utf-8 -*- from django.core.urlresolvers import reverse from django.db.models import Q from django.http import HttpResponse from django.shortcuts import render from django.apps import apps from municipios.forms import FormMunicipio def base_url_js(request): return HttpResponse(u"var __municipios_bas...
1.960938
2
myproject/cms/migrations/0002_auto_20180412_1141.py
RazvanCopaceanu/X-Serv-15.8-CmsUsersPut
0
12767339
<reponame>RazvanCopaceanu/X-Serv-15.8-CmsUsersPut<filename>myproject/cms/migrations/0002_auto_20180412_1141.py # -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('cms', '0001_initial'), ] ...
1.4375
1
src/ramachandran.py
h3nnn4n/Ramachandran-Angle-Probability.py
0
12767340
<filename>src/ramachandran.py import re import os.path import math import random import numpy as np import os class Ramachandran(): def __init__(self): self.data = {} self.parsed_data = {} self.aa = {} self.aa['g'] = 'gly' self.aa['a'] = 'ala' self.aa['p'] = 'pro' ...
2.875
3
setup.py
wjps/grass-river-extraction-tools
0
12767341
import sys import subprocess from setuptools import find_packages, setup def gdal_warning(msg=None): raise Exception(f"Unable to determine gdal version using gdal-config: {msg}") def libgdal_version(): version = None try: proc = subprocess.Popen(['gdal-config', '--version'], stdout=subprocess.PI...
2.1875
2
wgs_report.py
mgi-qc/cwl_wgs_report
0
12767342
#wgs report __author__ = '<NAME>' #TODO checks for metrics # write report # write Ssheet import csv import os import sys import glob import datetime import argparse import subprocess from string import Template parser = argparse.ArgumentParser() parser.add_argument('-nod', help='Turn off directory c...
2.484375
2
src/dizest/res/websrc/apps/kbeenuux6kdk1651928207/api.py
season-framework/dizest
2
12767343
<filename>src/dizest/res/websrc/apps/kbeenuux6kdk1651928207/api.py import os import dizest as dizest_core import season import time import builtins import urllib import requests import traceback import multiprocessing as mp host = urllib.parse.urlparse(wiz.flask.request.base_url) host = f"{host.scheme}://{host.netloc}...
2
2
python/pyproj/crs/crs.py
SamTDickinson/sciket-learn-lambda
0
12767344
<reponame>SamTDickinson/sciket-learn-lambda """ This module interfaces with PROJ to produce a pythonic interface to the coordinate reference system (CRS) information. """ # pylint: disable=too-many-lines import json import re import threading import warnings from abc import abstractmethod from typing import Any, Callab...
2.15625
2
codeforces/1469B-Red and Blue/1469B.py
hubert-wojtowicz/faang
0
12767345
<gh_stars>0 # https://codeforces.com/problemset/problem/1469/B # https://codeforces.com/problemset/submission/1469/120399560 # # Introduce two pointers i and j for red end blue position pointing. # observations # 1. whenever i o j is moved all previous elements are components of sum # 2. defining prefix sum we can see...
3.34375
3
script/inspect.py
cherrytrick/auto_ui_test
3
12767346
#!/usr/bin/env python3 # -*- coding:utf-8 -*- import os import yaml from utils.times import run_time from config.conf import cm @run_time def inspect_element(): """审查所有的元素是否正确""" for i in os.listdir(cm.ELEMENT_PATH): _path = os.path.join(cm.ELEMENT_PATH, i) if os.path.isfile(_path): ...
2.46875
2
icbc-appointment.py
FuFunG/icbc-appointment-bot
0
12767347
<reponame>FuFunG/icbc-appointment-bot import requests import json import yaml from datetime import datetime import gmail with open('./config.yml', 'r') as file: conf = yaml.safe_load(file) lastName = conf['icbc']['drvrLastName'] licenceNumber = conf['icbc']['licenceNumber'] keyword = conf['icbc']['keyword'] expac...
2.34375
2
kat_ran/kat.py
tojov/kat_ran_thru_my_keebord
0
12767348
<reponame>tojov/kat_ran_thru_my_keebord #!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Fri Oct 4 23:12:15 2019 @author: abhijithneilabraham """ import random import time c=int(input('write in number how much you love a cat \n')) def catran(): a=random.randint(97,122) print(chr(a),end="") r=...
3.109375
3
src/ec2/helpers/query.py
cc1-cloud/cc1
11
12767349
<reponame>cc1-cloud/cc1<filename>src/ec2/helpers/query.py # -*- coding: utf-8 -*- # @COPYRIGHT_begin # # Copyright [2010-2014] Institute of Nuclear Physics PAN, Krakow, Poland # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # Y...
2.625
3
src/pymor/parallel/dummy.py
mahgadalla/pymor
1
12767350
<gh_stars>1-10 # This file is part of the pyMOR project (http://www.pymor.org). # Copyright 2013-2017 pyMOR developers and contributors. All rights reserved. # License: BSD 2-Clause License (http://opensource.org/licenses/BSD-2-Clause) from copy import deepcopy from pymor.core.interfaces import ImmutableInterface fro...
2.21875
2