max_stars_repo_path stringlengths 3 269 | max_stars_repo_name stringlengths 4 119 | max_stars_count int64 0 191k | id stringlengths 1 7 | content stringlengths 6 1.05M | score float64 0.23 5.13 | int_score int64 0 5 |
|---|---|---|---|---|---|---|
tests/micropython/opt_level.py | sebi5361/micropython | 181 | 12788851 | <reponame>sebi5361/micropython
import micropython as micropython
# check we can get and set the level
micropython.opt_level(0)
print(micropython.opt_level())
micropython.opt_level(1)
print(micropython.opt_level())
# check that the optimisation levels actually differ
micropython.opt_level(0)
exec('print(__debug__)')
m... | 2.453125 | 2 |
60145395-perspective-transform/perspective_transform.py | nathancy/stackoverflow | 3 | 12788852 | <gh_stars>1-10
from imutils.perspective import four_point_transform
import cv2
import numpy
# Load image, grayscale, Gaussian blur, Otsu's threshold
image = cv2.imread("1.jpg")
gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)
blur = cv2.GaussianBlur(gray, (5,5), 0)
thresh = cv2.threshold(blur, 0, 255, cv2.THRESH_BINARY ... | 2.515625 | 3 |
count_sort.py | gmolnar1/Find-My-Game | 3 | 12788853 | import math
import os
import sys
import pprint
def count_sort_func(data,maxdata,index):
maxdata +=1
count_list = [0]*(maxdata)
count_dict = data
for n in data:
count_list[n[index]] +=1
i = 0
count = 0
for n in range(len(count_list)):
print(n)
while(count_list[n]>0):
for... | 3.40625 | 3 |
nesta/core/routines/datasets/crunchbase/crunchbase_root_task.py | anniyanvr/nesta | 13 | 12788854 | '''
Root task (Crunchbase)
========================
Luigi routine to collect all data from the Crunchbase data dump and load it to MySQL.
'''
import luigi
import datetime
import logging
from nesta.core.routines.datasets.crunchbase.crunchbase_parent_id_collect_task import ParentIdCollectTask
from nesta.core.routines.... | 2.265625 | 2 |
lake/attributes/control_signal_attr.py | StanfordAHA/Lake | 11 | 12788855 | <reponame>StanfordAHA/Lake
import kratos as kts
from enum import Enum
class ControlSignalAttr(kts.Attribute):
def __init__(self,
is_control=False,
ignore=False,
doc_string=""):
super().__init__()
self.value = "control_signal"
self.is_contr... | 2.5 | 2 |
pandaf/000/mc.py | cpausmit/Kraken | 0 | 12788856 | import FWCore.ParameterSet.Config as cms
import FWCore.ParameterSet.VarParsing as VarParsing
import re
import os
process = cms.Process("PandaNtupler")
cmssw_base = os.environ['CMSSW_BASE']
options = VarParsing.VarParsing ('analysis')
options.register('isData',
False,
VarParsing.VarPa... | 1.726563 | 2 |
src/server/blueprints/security.py | 1064CBread/1064Chat | 2 | 12788857 | from flask import Blueprint, Flask, render_template, request
blueprint = Blueprint(__name__, __name__, url_prefix='/auth')
@blueprint.route('/login', methods=['GET', 'POST'])
def login():
if request.method != 'POST':
return render_template("login_start.jinja")
print(request.form)
return 'You "log... | 2.71875 | 3 |
ch04/ch04_04/ch04_04.py | z2x3c4v5bz/pybook_yehnan | 0 | 12788858 | if __name__ == '__main__':
s = 'abcde'
print(s[::-1])
print(s[-1::-1])
print(s[-1:0:-1]) # failed
'''
edcba
edcba
edcb
'''
| 2.640625 | 3 |
pvlibs/data_import/__init__.py | bfw930/pvlibs | 0 | 12788859 | <filename>pvlibs/data_import/__init__.py<gh_stars>0
''' Imports '''
# core import protocols
from .core import parse_data_file
| 1.1875 | 1 |
utils.py | ondrejba/monte_carlo | 14 | 12788860 | def update_mean(value, mean, count):
"""
Update value of a streaming mean.
:param value: New value.
:param mean: Mean value.
:param count: Number of values averaged.
:return:
"""
return (value - mean) / (count + 1) | 3.265625 | 3 |
src/6/reading_nested_and_variable_sized_binary_structures/writepolys.py | tuanavu/python-gitbook | 14 | 12788861 | import struct
import itertools
polys = [
[ (1.0, 2.5), (3.5, 4.0), (2.5, 1.5) ],
[ (7.0, 1.2), (5.1, 3.0), (0.5, 7.5), (0.8, 9.0) ],
[ (3.4, 6.3), (1.2, 0.5), (4.6, 9.2) ],
]
def write_polys(filename, polys):
# Determine bounding box
flattened = list(itertools.chain(*... | 2.484375 | 2 |
src/TRAIN_MODELS/CLASSIFICATION/classificationModel_functions.py | CaT-zTools/Deep-CaT-z-software | 0 | 12788862 | <gh_stars>0
# -*- coding: utf-8 -*-
"""
@author: DeepCaT_Z
"""
#%% ############################################
######### IMPORTS: DO NOT TOUCH ##############
################################################
import torch
from torch import nn
from sklearn.metrics import f1_score
from torch import optim
from... | 2.078125 | 2 |
HW1_P4.py | ZhaoQii/Naive-Bayesian-Classifier-in-Spam-Detection | 0 | 12788863 | <reponame>ZhaoQii/Naive-Bayesian-Classifier-in-Spam-Detection
# -*- coding: utf-8 -*-
"""
Created on Sun Sep 26 15:14:51 2017
@author: <NAME>
"""
from matplotlib import style
import matplotlib.pyplot as plt
import scipy as sp
import pandas as pd
import numpy as np
import os
os.chdir('/Users/ap/Dropbox/2017FALL/EECS E... | 2.421875 | 2 |
checkout/migrations/0013_auto_20211024_1504.py | kevin-ci/janeric2 | 1 | 12788864 | <reponame>kevin-ci/janeric2<filename>checkout/migrations/0013_auto_20211024_1504.py
# Generated by Django 3.1.5 on 2021-10-24 15:04
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('checkout', '0012_auto_20211024_1453'),
]
operations = [
migratio... | 1.5625 | 2 |
joke teller.py | naitikvaru/python_joke_teller | 1 | 12788865 | <reponame>naitikvaru/python_joke_teller<gh_stars>1-10
import pyjokes
print(pyjokes.get_joke())
| 1.59375 | 2 |
vergeml/sources/mnist.py | ss18/vergeml | 324 | 12788866 | <gh_stars>100-1000
from vergeml.img import INPUT_PATTERNS, open_image, fixext, ImageType
from vergeml.io import source, SourcePlugin, Sample
from vergeml.data import Labels
from vergeml.utils import VergeMLError
from vergeml.sources.labeled_image import LabeledImageSource
import random
import numpy as np
from PIL impor... | 2.140625 | 2 |
spellChecker/spellCheckerApp/apps.py | spell-checkers/web-spell-checker | 0 | 12788867 | from django.apps import AppConfig
class SpellcheckerappConfig(AppConfig):
name = 'spellCheckerApp'
| 1.070313 | 1 |
src/RIOT/tests/gnrc_sock_ip/tests/01-run.py | ARte-team/ARte | 2 | 12788868 | <gh_stars>1-10
#!/usr/bin/env python3
# Copyright (C) 2016 <NAME> <<EMAIL>>
#
# This file is subject to the terms and conditions of the GNU Lesser
# General Public License v2.1. See the file LICENSE in the top level
# directory for more details.
import sys
from testrunner import run
def testfunc(child):
child.e... | 1.984375 | 2 |
loldib/getratings/models/NA/na_kalista/__init__.py | koliupy/loldib | 0 | 12788869 | <reponame>koliupy/loldib<filename>loldib/getratings/models/NA/na_kalista/__init__.py
from .na_kalista_top import *
from .na_kalista_jng import *
from .na_kalista_mid import *
from .na_kalista_bot import *
from .na_kalista_sup import *
| 1.078125 | 1 |
mne/tests/test_coreg.py | jdammers/mne-python | 0 | 12788870 | from glob import glob
import os
import os.path as op
from shutil import copyfile
from nose.tools import assert_raises
import numpy as np
from numpy.testing import assert_array_almost_equal
import mne
from mne.datasets import testing
from mne.transforms import (Transform, apply_trans, rotation, translation,
... | 1.90625 | 2 |
surgame/src/particles.py | anokata/pythonPetProjects | 3 | 12788871 | import util
import pygame
import math
import images
class Particles(util.Block):
lifetime = 100
def __init__(self, x, y, n=10, lifetime=10, imgname=images.particleDefault):
super().__init__(x, y, imgname)
self.particles_xyd = list() # координаты и скорости частицы (x, y, dx, dy)
spd =... | 3.109375 | 3 |
tests/test_maphash.py | MoonVision/maphash | 3 | 12788872 | <filename>tests/test_maphash.py
import json
from pathlib import Path
from maphash import maphash
def test_hashes_int():
assert (
maphash(1) == "67b176705b46206614219f47a05aee7ae6a3edbe850bbbe214c536b989aea4d2"
)
def test_hashes_float():
assert (
maphash(0.1)
== "75bd59c8426679f3... | 2.78125 | 3 |
frozenweb/__init__.py | rufrozen/frozenweb | 0 | 12788873 | <reponame>rufrozen/frozenweb
from .config import Config
from .builder import Builder
from .server import Server
| 1.0625 | 1 |
promise-types/http/http_promise_type.py | olehermanse/cfengine_basics | 0 | 12788874 | """HTTP module for CFEngine"""
import os
import urllib
import urllib.request
import ssl
import json
from cfengine import PromiseModule, ValidationError, Result
_SUPPORTED_METHODS = {"GET", "POST", "PUT", "DELETE", "PATCH"}
class HTTPPromiseModule(PromiseModule):
def __init__(self, *args, **kwargs):
su... | 2.734375 | 3 |
preprocessing/get_industry_sector.py | marwage/stock_prediction | 0 | 12788875 | <reponame>marwage/stock_prediction
import logging
import os
import pandas as pd
import sys
from pymongo import MongoClient
def get(output_path: str):
client = MongoClient()
info_db = client["companyinfodb"]
collection_names = info_db.list_collection_names()
industries = set()
sectors = set()
... | 2.59375 | 3 |
main_website/migrations/0004_auto_20201228_1649.py | kiza054/woodhall-website | 2 | 12788876 | <reponame>kiza054/woodhall-website
# Generated by Django 3.1.4 on 2020-12-28 16:49
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('main_website', '0003_auto_20201228_1456'),
]
operations = [
migrations.CreateModel(
... | 1.898438 | 2 |
src/genie/libs/parser/iosxr/tests/test_show_ethernet_yang.py | nujo/genieparser | 4 | 12788877 | <filename>src/genie/libs/parser/iosxr/tests/test_show_ethernet_yang.py<gh_stars>1-10
import re
import unittest
from unittest.mock import Mock
import xml.etree.ElementTree as ET
from pyats.topology import Device
from genie.ops.base import Context
from genie.metaparser.util.exceptions import SchemaEmptyParserError
f... | 2.234375 | 2 |
pycket/prims/hash.py | namin/pycket | 129 | 12788878 | #! /usr/bin/env python
# -*- coding: utf-8 -*-
import sys
from pycket import impersonators as imp
from pycket import values, values_string
from pycket.hash.base import W_HashTable, W_ImmutableHashTable, w_missing
from pycket.hash.simple import (
W_EqvMutableHashTable, W_EqMutableHashTa... | 2.234375 | 2 |
bootloader/waflib/Tools/bison.py | BA7JCM/pyinstaller | 0 | 12788879 | <gh_stars>0
#! /usr/bin/env python
# encoding: utf-8
# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file
from waflib import Task
from waflib.TaskGen import extension
class bison(Task.Task):
color = 'BLUE'
run_str = '${BISON} ${BISONFLAGS} ${SRC[0].abspath()} -o ${TGT[0].name}'
... | 2.140625 | 2 |
sharpen_image.py | danielskatz/parsl-example | 9 | 12788880 | import sys
try:
from PIL import Image, ImageFilter
except ImportError:
print("error:", sys.argv[0], "requires Pillow - install it via 'pip install Pillow'")
sys.exit(2)
if len(sys.argv) != 3:
print("error - usage:", sys.argv[0], "input_file output_file")
sys.exit(2)
input_filename = sys.argv[1]
... | 3.328125 | 3 |
helbing_model.py | csebastiao/helbing_clogging | 0 | 12788881 | <gh_stars>0
# -*- coding: utf-8 -*-
"""
Model based on the Helbing model of "Simulation dynamical features of
escape panic" to simulate fish going through a hole in a wall.
"""
import numpy as np
import sys
import pandas as pd
from sklearn.neighbors import NearestNeighbors
class Fish():
"""
Fish that wants... | 3.703125 | 4 |
desafiosCursoEmVideo/ex056.py | gomesGabriel/Pythonicos | 1 | 12788882 | print('\033[33m-=-\033[m' * 20)
print('\033[33m************* Analisador completo *************\033[m')
print('\033[33m-=-\033[m' * 20)
si = 0
iv = 0
nv = 0
tm = 0
for c in range(1, 4):
print('---- {}ª Pessoa ----' .format(c))
n = str(input('Nome: ')).strip()
i = int(input('Idade: '))
s = str(input('Sexo... | 3.09375 | 3 |
visualise/colormap.py | TimoWilken/scworldedit | 0 | 12788883 | #!/usr/bin/python3
"""Colormaps map data to colors for visualisation.
To use a colormap, call one of its color_* methods with data in a suitable
format.
"""
from abc import ABCMeta, abstractmethod
from array import array
from itertools import chain
class ColorMap(metaclass=ABCMeta):
"""The base color map.
... | 3.796875 | 4 |
_unittests/ut_sql/test_database_join.py | mohamedelkansouli/Ensae_py2 | 0 | 12788884 | <reponame>mohamedelkansouli/Ensae_py2<filename>_unittests/ut_sql/test_database_join.py
"""
@brief test log(time=13s)
"""
import sys
import os
import unittest
from pyquickhelper.loghelper import fLOG, unzip
from pyquickhelper.pycode import get_temp_folder
try:
import src
except ImportError:
path = os.path... | 2.0625 | 2 |
bootstrap/act-bootstrap.py | geirskjo/act-bootstrap | 0 | 12788885 | <reponame>geirskjo/act-bootstrap<gh_stars>0
#!/usr/bin/env python3
import argparse
import json
import os
import sys
from logging import critical, warning
import act
def parseargs():
""" Parse arguments """
parser = argparse.ArgumentParser(description="ACT Bootstrap data model")
parser.add_argument(
... | 2.515625 | 3 |
app/contracts/migrations/0025_auto_20180211_1442.py | snakrani/discovery | 0 | 12788886 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('vendors', '0028_auto_20180211_1350'),
('contracts', '0024_auto_20180205_0342'),
]
operations = [
migrations.RunSQL("... | 1.617188 | 2 |
setup.py | numpde/bugs | 0 | 12788887 | <reponame>numpde/bugs
import setuptools
# python setup.py sdist bdist_wheel
# twine upload dist/* && rm -rf build dist *.egg-info
setuptools.setup(
name="bugs",
version="0.0.2",
author="RA",
author_email="<EMAIL>",
keywords="python essentials",
description="Python essential imports.",
long... | 1.367188 | 1 |
library/library.py | jatinmg97/library | 0 | 12788888 | <filename>library/library.py
import pandas as pd
import uuid
import sqlite3
import os
from sklearn.model_selection import train_test_split
from sklearn.linear_model import LinearRegression
from sklearn.tree import DecisionTreeClassifier
from sklearn.neighbors import KNeighborsClassifier
from sklearn.discrimina... | 2.265625 | 2 |
Lesson_7/Task_13.py | AlexHarf/Selenium_training | 0 | 12788889 | <gh_stars>0
import pytest
from selenium import webdriver
from selenium.webdriver.support.select import Select
from selenium.webdriver.support.wait import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.by import By
@pytest.fixture
def driver(request):
w... | 2.5625 | 3 |
skills/dff_friendship_skill/dialogflows/flows/starter_states.py | oserikov/dream | 34 | 12788890 | from enum import Enum, auto
class State(Enum):
USR_START = auto()
#
# SYS_GENRE = auto()
# USR_GENRE = auto()
# SYS_WEEKDAY = auto()
USR_WHAT_FAV = auto()
SYS_CHECK_POSITIVE = auto()
SYS_CHECK_NEGATIVE = auto()
SYS_CHECK_NEUTRAL = auto()
SYS_GET_REASON = auto()
USR_REPEAT =... | 2.96875 | 3 |
common_configs/logging/stdlib.py | nigma/django-common-configs | 5 | 12788891 | <filename>common_configs/logging/stdlib.py
#-*- coding: utf-8 -*-
"""
Django logging configuration
Defined loggers:
- <catch all>
- django
- django.startup
- django.request
- django.db.backends
- django.commands
- django.security.DisallowedHost
- app.* - for project app loggers
- ... | 1.96875 | 2 |
tests/test_sia_client.py | fcoach66/pysiaalarm | 0 | 12788892 | # -*- coding: utf-8 -*-
"""Class for tests of pysiaalarm."""
import json
import logging
import random
import socket
import threading
import time
import pytest
from mock import patch
from pysiaalarm import InvalidAccountFormatError
from pysiaalarm import InvalidAccountLengthError
from pysiaalarm import InvalidKeyFormat... | 2.109375 | 2 |
third/imagelib/06_dlib.py | gottaegbert/penter | 13 | 12788893 | <filename>third/imagelib/06_dlib.py
"""
# https://github.com/vipstone/faceai
# https://www.cnblogs.com/vipstone/p/8964656.html
下载训练模型
训练模型用于是人脸识别的关键,用于查找图片的关键点。
下载地址:http://dlib.net/files/
下载文件:shape_predictor_68_face_landmarks.dat.bz2
当然你也可以训练自己的人脸关键点模型,这个功能会放在后面讲。
下载好的模型文件,我的存放地址是:C:\Python36\Lib\site-packages... | 3.296875 | 3 |
src/run.py | iWeya/palestra-web-scraping-para-cacar-pontos-na-escola | 1 | 12788894 | import json
from requests_html import HTMLSession
from helpers import compare_trees, get_content_tree
MAIN_URL = r'http://docente.ifrn.edu.br/abrahaolopes/2017.1-integrado/2.02401.1v-poo'
def main():
session = HTMLSession()
current_tree = get_content_tree(MAIN_URL, session)
with open('storage/tree.json... | 2.984375 | 3 |
linAlgVis.py | testinggg-art/Linear_Algebra_With_Python | 1,719 | 12788895 | <filename>linAlgVis.py
import matplotlib.pyplot as plt
import numpy as np
import numpy
def linearCombo(a, b, c):
'''This function is for visualizing linear combination of standard basis in 3D.
Function syntax: linearCombo(a, b, c), where a, b, c are the scalar multiplier,
also the elements of the vec... | 3.765625 | 4 |
cosmoz/joysticks.py | T-K-233/arduino-python | 2 | 12788896 | <gh_stars>1-10
'''
Adapted from Xbox-360-Controller-for-Python
https://github.com/r4dian/Xbox-360-Controller-for-Python
Modified by -T.K.- Aug 2018
'''
import ctypes
import time
import sys
from operator import itemgetter, attrgetter
from itertools import count, starmap
from pyglet import event
class XINPUT_GAMEPAD(cty... | 2.5625 | 3 |
nn/neuron.py | prabhatnagarajan/rl_lib | 1 | 12788897 | <gh_stars>1-10
from activation import *
import numpy as np
from pdb import set_trace
class Neuron:
# takes in initialized weights with the final term
def __init__(self, init_weights, init_bias, activation=Activation.sigmoid):
self.weights = init_weights
self.bias = init_bias
obj = Activation()
self.activatio... | 3.09375 | 3 |
app/models/keyword.py | Simple2B/twitter-bot | 0 | 12788898 | <reponame>Simple2B/twitter-bot<filename>app/models/keyword.py<gh_stars>0
from app import db
from app.models.utils import ModelMixin
class Keyword(db.Model, ModelMixin):
__tablename__ = 'keywords'
id = db.Column(db.Integer, primary_key=True)
word = db.Column(db.String(60), unique=True, nullable=False)
| 1.96875 | 2 |
src/upbgui/frame_button.py | SIGSEGV-666/UPBGUI | 1 | 12788899 | from .widget import Widget, BGUI_DEFAULT, BGUI_NO_THEME, BGUI_CENTERED
from .frame import Frame
from .label import Label
FBSTYLE_CLASSIC = 0
FBSTYLE_SOLID = 1
class FrameButton(Widget):
"""A clickable frame-based button."""
theme_section = 'FrameButton'
theme_options = {
'Color': (0.4, 0.4,... | 3.09375 | 3 |
pybites_tools/zen.py | Timfrazer/pybites-tools | 0 | 12788900 | import sys
from io import StringIO
def zen_of_python() -> list[str]:
"""
Dump the Zen of Python into a variable
https://stackoverflow.com/a/23794519
"""
zen = StringIO()
old_stdout = sys.stdout
sys.stdout = zen
import this # noqa F401
sys.stdout = old_stdout
return zen.getval... | 3.28125 | 3 |
betfair/exceptions.py | mkapuza/betfair.py | 94 | 12788901 | # -*- coding: utf-8 -*-
class BetfairError(Exception):
pass
class NotLoggedIn(BetfairError):
pass
class LoginError(BetfairError):
def __init__(self, response, data):
self.response = response
self.status_code = response.status_code
self.message = data.get('loginStatus', 'UNKNOW... | 2.5625 | 3 |
test/test_weight_calculator.py | canvas-gamification/canvas-weight-calculator | 0 | 12788902 | import unittest
from exceptions import RangeValidationException
from weight_calculator import calculate_weights, validate_rages, validate_grades_and_ranges
class WeightCalculatorTest(unittest.TestCase):
def range_validation_tests(self):
self.assertFalse(validate_rages({
"Final": [50, 60],
... | 3.015625 | 3 |
torchnmf/nmf.py | akashpalrecha/pytorch-NMF | 0 | 12788903 | import torch
import torch.nn.functional as F
from torch.nn import Parameter
from .metrics import Beta_divergence
from .base import Base
from tqdm import tqdm
def _mu_update(param, pos, gamma, l1_reg, l2_reg, constant_rows=None):
if param.grad is None:
return
# prevent negative term, very likely to hap... | 2.34375 | 2 |
src/utils.py | yoichi1484/sake_embedding | 2 | 12788904 | from gensim.models import KeyedVectors
import pprint
import json
PATH_DATA = '../data/sake_dataset_v1.json'
def preprocessing(sake_data):
return sake_data.strip().replace(' ', '_')
def fix_data(data):
fixed_data = []
for k, v in sorted(data.items(), key=lambda x:x[0]):
if 'mean' in v:
... | 2.921875 | 3 |
visigoth/stimuli/elementarray.py | mwaskom/visigoth | 2 | 12788905 | """Psychopy ElementArrayStim with flexible pedestal luminance.
Psychopy authors have said on record that this functionality should exist in
Psychopy itself. Future users of this code should double check as to whether
that has been implemented and if this code can be excised.
Note however that we have also added some ... | 2.046875 | 2 |
ansible-simple-exports-demo.py | j-sims/isilon-ansible-demos | 0 | 12788906 | #!/usr/bin/env python
import json
import yaml
sharesFilename = 'simple-exports.json'
with open(sharesFilename, 'r') as f:
shares = json.load(f)
### For Loop to write out playbook for each cluster
for cluster in shares['clusters']:
playbookFilename = 'playbook-simple-exports-%s.yml' % cluster['name']
wit... | 2.109375 | 2 |
app.py | eocode/Queens | 0 | 12788907 | <gh_stars>0
"""
Start app
"""
from app import queen
if __name__ == "__main__":
"""Main function for run application"""
queen.run()
| 1.46875 | 1 |
core/utils/k8s.py | kubesys/kubevm | 0 | 12788908 | <reponame>kubesys/kubevm
import socket
import time
import traceback
import operator
from json import dumps
import os, sys
from sys import exit
from kubernetes import client, config
from kubernetes.client import V1DeleteOptions
from kubernetes.client.rest import ApiException
import logging
import logging.handlers
try... | 1.679688 | 2 |
upload/views.py | travelgeezer/sasukekun-flask | 0 | 12788909 | from flask import request, Blueprint, send_file
from sasukekun_flask.utils import v1, format_response
from sasukekun_flask.config import API_IMAGE
from .models import PasteFile
ONE_MONTH = 60 * 60 * 24 * 30
upload = Blueprint('upload', __name__)
@upload.route(v1('/upload/'), methods=['GET', 'POST'])
def upload_file(... | 2.390625 | 2 |
storages/backends/s3refreshablesession.py | Techainer/django-storages | 2 | 12788910 | from uuid import uuid4
from datetime import datetime
from time import time
import boto3
from boto3 import Session
from botocore.credentials import RefreshableCredentials
from botocore.session import get_session
from botocore.credentials import InstanceMetadataFetcher
from storages.utils import setting
import logging
... | 2.34375 | 2 |
cellpainting2/reporting.py | apahl/cellpainting2 | 0 | 12788911 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
#########
Reporting
#########
*Created on Thu Jun 8 14:40 2017 by <NAME>*
Tools for creating HTML Reports."""
import time
import base64
import os
import gc
import os.path as op
from string import Template
from io import BytesIO as IO
import pandas as pd
from rdkit... | 2.1875 | 2 |
post/models.py | Yash1256/Django-Intern | 1 | 12788912 | <reponame>Yash1256/Django-Intern
from django.db import models
from registration.models import Author
# Create your models here.
class Post(models.Model):
author_id = models.IntegerField(null=False)
title = models.CharField(max_length=255, null=False)
description = models.CharField(max_length=500, null=Fal... | 2.6875 | 3 |
backend/api_v2/migrations/0008_auto_20170101_0105.py | AstroMatt/subjective-time-perception | 0 | 12788913 | # -*- coding: utf-8 -*-
# Generated by Django 1.10.4 on 2017-01-01 01:05
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('api_v2', '0007_auto_20170101_0101'),
]
operations = [
migrations.AlterField... | 1.5625 | 2 |
lib/utils/meta_manager.py | kbase/sample_search_api | 0 | 12788914 | <reponame>kbase/sample_search_api<filename>lib/utils/meta_manager.py
from utils.re_utils import execute_query
SAMPLE_NODE_COLLECTION = "samples_nodes"
SAMPLE_SAMPLE_COLLECTION = "samples_sample"
META_AQL_TEMPLATE = f"""
let version_ids = (for sample_id in @sample_ids
let doc = DOCUMENT({SAMPLE_SAM... | 2.09375 | 2 |
utils/replay.py | xuzhiyuan1528/KTM-DRL | 10 | 12788915 | import numpy as np
import torch
# https://github.com/sfujim/TD3/blob/ade6260da88864d1ab0ed592588e090d3d97d679/utils.py
class ReplayBuffer(object):
def __init__(self, state_dim, action_dim, max_size=int(1e6)):
self.max_size = max_size
self.ptr = 0
self.size = 0
self.state = np.zero... | 2.40625 | 2 |
scripts/codepost/codepostAbet.py | cbourke/ComputerScienceII | 20 | 12788916 | """
This script interfaces with the codepost.io API to produce exemplar reports
for ABET accreditation.
For a particular assignment, a report includes an assignment summary
(basic info and stats) as well as the full assessment of 3 student
examples of an A, B, and C submission. The report includes all line-by-line
g... | 2.90625 | 3 |
integrations/tensorflow/bindings/python/iree/tf/support/tf_utils_test.py | schoppmp/iree | 0 | 12788917 | # Lint as: python3
# Copyright 2020 Google LLC
#
# 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ag... | 1.914063 | 2 |
imbedding/parameter.py | bjih1999/Uhzzuda_project | 0 | 12788918 | import pandas as pd
import numpy as np
texts = []
f = open('preprocess/jull_review.csv', 'r')
for line in f.readlines():
oneline = line.replace("\n", "").split(",")
oneline = list(filter(None, oneline))
texts.append(oneline)
print(len(texts))
from gensim.models.doc2vec import Doc2Vec, TaggedDocument
doc... | 2.484375 | 2 |
run.py | iTecAI/roomdash | 0 | 12788919 | import subprocess, json, sys, time
from selenium import webdriver
from selenium.webdriver.firefox.options import Options
with open('config.json', 'r') as f:
CONFIG = json.load(f)
proc = subprocess.Popen([sys.executable, 'server.py'], stdout=sys.stdout)
print('Waiting for server to start.')
time.sleep(4)
options ... | 2.390625 | 2 |
variantgrid/settings/env/_settings_template.py | SACGF/variantgrid | 5 | 12788920 | from variantgrid.settings.components.celery_settings import * # pylint: disable=wildcard-import, unused-wildcard-import
from variantgrid.settings.components.default_settings import * # pylint: disable=wildcard-import, unused-wildcard-import
from variantgrid.settings.components.seqauto_settings import * # pylint: dis... | 1.296875 | 1 |
two_sum/two_sum_test.py | kevinzen/learning | 0 | 12788921 | import unittest
from two_sum.solution import Solution
class MyTestCase(unittest.TestCase):
def test_two_sum(self):
s = Solution()
nums = [2,7,11,15]
target = 9
result = s.twoSum(nums, target)
self.assertEqual(result, [0,1])
nums = [-1,-2,-3,-4,-5]
targe... | 3.59375 | 4 |
spyder/plugins/editor/fallback/tests/conftest.py | seryj/spyder | 0 | 12788922 | # -*- coding: utf-8 -*-
# Copyright © Spyder Project Contributors
# Licensed under the terms of the MIT License
# (see spyder/__init__.py for details)
import pytest
from spyder.plugins.editor.fallback.actor import FallbackActor
from spyder.plugins.editor.lsp.tests.conftest import qtbot_module
@pytest.fixture(scope... | 2.109375 | 2 |
resnet.py | geodekid/resnet1 | 12 | 12788923 | <reponame>geodekid/resnet1
# You will learn how to build very deep convolutional networks, using Residual Networks (ResNets)
# In theory, very deep networks can represent very complex functions; but in practice, they are hard to train. Residual Networks, introduced by He et al., allow you to train much deeper networks ... | 3.421875 | 3 |
utilities.py | tdrmk/pyklotski | 0 | 12788924 | from pygame.draw import rect as draw_rect
def darken_color(color, factor):
return tuple(int(c * factor) for c in color)
def draw_piece(surf, color, left, top, width, height, size):
padding_factor = 0.025
shadow_factor = 0.085
margin_factor = 0.05
base_color = color
margin_color = darken_colo... | 3.703125 | 4 |
{{cookiecutter.project_slug}}/src/{{cookiecutter.package_name}}/exceptions.py | pcrespov/cookiecutter-simcore-pyservice | 0 | 12788925 | <reponame>pcrespov/cookiecutter-simcore-pyservice<filename>{{cookiecutter.project_slug}}/src/{{cookiecutter.package_name}}/exceptions.py
""" All exceptions used in the {{ cookiecutter.package_name }} code base are defined here.
"""
class ServiceException(Exception):
"""
Base exception class. All service-speci... | 1.421875 | 1 |
api/reports/migrations/0001_initial.py | Egor4ik325/rankrise | 0 | 12788926 | <gh_stars>0
# Generated by Django 3.2.9 on 2022-01-02 17:46
import uuid
import django.db.models.deletion
import model_utils.fields
from django.conf import settings
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
migrations.swappable_d... | 1.820313 | 2 |
python/paddle/trainer_config_helpers/tests/configs/test_gated_unit_layer.py | shenchaohua/Paddle | 3 | 12788927 | <gh_stars>1-10
from paddle.trainer_config_helpers import *
data = data_layer(name='input', size=256)
glu = gated_unit_layer(
size=512,
input=data,
act=TanhActivation(),
gate_attr=ExtraLayerAttribute(error_clipping_threshold=100.0),
gate_param_attr=ParamAttr(initial_std=1e-4),
gate_bias_attr=Par... | 2.03125 | 2 |
ModularER_2D/gym_rem2D/morph/circular_module.py | FrankVeenstra/gym_rem2D | 27 | 12788928 |
#!/usr/bin/env python
"""
Standard BOX 2D module with single joint
"""
import gym_rem2D.morph.module_utility as mu
from gym_rem.utils import Rot
from enum import Enum
import numpy as np
from Controller import m_controller
import random
import math
from gym_rem2D.morph import abstract_module
from gym_rem2D.morph i... | 3.109375 | 3 |
level_05.py | katsukaree/chapter-weasel | 0 | 12788929 | #!/usr/bin/env python3
import requests
import base64
import re
from levels_credentials import credentials
level_url = credentials[5]["url"]
level_username = credentials[5]["level"]
level_password = credentials[5]["password"]
next_level_url = credentials[6]["url"]
next_level_username = credentials[6]["level"]
creden... | 2.71875 | 3 |
python/testData/refactoring/rename/referencesInsideFStringsNotReportedAsStringOccurrences.py | tgodzik/intellij-community | 2 | 12788930 | <filename>python/testData/refactoring/rename/referencesInsideFStringsNotReportedAsStringOccurrences.py
def func():
v<caret>ar = 42
s = f'{var}' | 1.46875 | 1 |
libs/modules/trader.py | meetri/cryptolib | 0 | 12788931 | <reponame>meetri/cryptolib
import os,sys,talib,numpy,math,time,datetime
from influxdbwrapper import InfluxDbWrapper
from coincalc import CoinCalc
from exchange import Exchange
class Trader(object):
def __init__(self, market = None, exchange=None, currency=None):
self.influxdb = InfluxDbWrapper.getInstance... | 2.53125 | 3 |
__init__.py | merialdo/research.mojito | 0 | 12788932 | <gh_stars>0
from mojito.mojito import Mojito
from mojito.chart import chart
| 1.140625 | 1 |
conf/__init__.py | FredrikM97/Medical-ROI | 0 | 12788933 | <filename>conf/__init__.py
"""This package includes all the modules related to data loading and preprocessing.
To add a custom dataset class called 'dummy', you need to add a file called 'dummy_dataset.py' and define a subclass 'DummyDataset' inherited from BaseDataset.
"""
import os
import json
from utils import l... | 2.71875 | 3 |
sharpy-sc2/sharpy/plans/require/gas.py | etzhang416/sharpy-bot-eco | 0 | 12788934 | import warnings
import sc2
from sharpy.plans.require.require_base import RequireBase
class Gas(RequireBase):
"""Require that a specific number of minerals are "in the bank"."""
def __init__(self, vespene_requirement: int):
assert vespene_requirement is not None and isinstance(vespene_requirement, i... | 2.84375 | 3 |
src/__init__.py | bkatwal/distributed-kafka-consumer-python | 2 | 12788935 | import logging
import os
# set the default logging level to info
logging.basicConfig(level=logging.INFO)
ROOT_SRC_DIR = os.path.dirname(os.path.abspath(__file__))
USERNAME = os.environ.get('APP_USERNAME', 'admin')
PASSWORD = os.environ.get('APP_PASSWORD', '<PASSWORD>')
WORKER_NUM_CPUS = os.environ.get('WORKER_NUM_CP... | 1.890625 | 2 |
ddweb/apps/images/views.py | neic/ddweb | 0 | 12788936 | <gh_stars>0
import os
from django.contrib.auth.decorators import permission_required
from django.contrib.contenttypes.models import ContentType
from django.core.urlresolvers import reverse
from django.shortcuts import render
from django.views.decorators.http import require_POST
from jfu.http import upload_receive, Uplo... | 2.125 | 2 |
mmdet/det_core/utils/mAP_utils.py | Karybdis/mmdetection-mini | 834 | 12788937 | import numpy as np
from multiprocessing import Pool
from ..bbox import bbox_overlaps
# https://zhuanlan.zhihu.com/p/34655990
def calc_PR_curve(pred, label):
pos = label[label == 1] # 正样本
threshold = np.sort(pred)[::-1] # pred是每个样本的正例预测概率值,逆序
label = label[pred.argsort()[::-1]]
precision = []
rec... | 2.140625 | 2 |
azad/utils.py | CoAxLab/azad | 6 | 12788938 | import cloudpickle
import numpy as np
import torch
from typing import List, Tuple
from scipy.linalg import eigh
def save_checkpoint(state, filename='checkpoint.pkl'):
data = cloudpickle.dumps(state)
with open(filename, 'wb') as fi:
fi.write(data)
def load_checkpoint(filename='checkpoint.pkl'):
w... | 2.34375 | 2 |
python/chapter2/sshcmd.py | xiaostar2016/KaliTest | 1 | 12788939 | <gh_stars>1-10
#!/usr/bin/env python
# coding=utf-8
import threading
import paramiko
import subprocess
def ssh_command(ip, user, passwd, command):
client = paramiko.SSHClient()
# paramiko支持用密钥认证代,实际环境推荐使用密钥认证,这里设置账号和密码认证
# client.load_host_keys('/home/justin/.ssh/known_hosts')
# 设置自动添加和保存目标SSH服务器的SS... | 2.515625 | 3 |
Interview/evenNumberList.py | dnootana/Python | 1 | 12788940 | <reponame>dnootana/Python
# Enter your code here. Read input from STDIN. Print output to STDOUT
def evenlist():
list = input("Enter numbers : ")
L = list.split()
E = []
for i in range(len(L)):
num = int(L[i],10)
if(num%2==0):
E.append(L[i])
print("Even numbers are : ",E)
| 3.734375 | 4 |
impstall/core.py | ryanniehaus/impstall | 2 | 12788941 | <reponame>ryanniehaus/impstall
#!/usr/bin/env python
'''
This module can be used to import python packages and install them if not already installed.
'''
import os
import sys
import subprocess
import tempfile
import urllib
_pipSetupUrl = 'https://bootstrap.pypa.io/get-pip.py'
PIP_OPTIONS=[]
INSTALL_PIP_OPTIONS=[]
PYT... | 2.140625 | 2 |
protopigeon/__init__.py | gregorynicholas/proto-pigeon | 0 | 12788942 | <filename>protopigeon/__init__.py<gh_stars>0
from protorpc.messages import *
from protorpc.protojson import *
from .translators import *
| 1.140625 | 1 |
src/tests/test_inference.py | Islandora-Image-Segmentation/Newspaper-Navigator-API | 0 | 12788943 | <filename>src/tests/test_inference.py
import os
from PIL import Image
from inference import predict
from . import TEST_ASSETS_DIR
def test_inference_one():
""" Test for the segmentation ML model.
This test requires the model weights `model_final.pth` to be present in src/resources.
"""
img = Image.... | 2.5 | 2 |
Python learnings/Django projects/advcbv/basic_app/admin.py | warpalatino/public | 1 | 12788944 | from django.contrib import admin
from .models import School,Student
# Register your models here.
admin.site.register(School)
admin.site.register(Student)
| 1.46875 | 1 |
mp_gui/layout/__init__.py | kerryeon/mp_python | 1 | 12788945 | <filename>mp_gui/layout/__init__.py
__all__ = ['MpGui']
from mp_gui.layout.main import MpGuiLinker as MpGui
| 1.25 | 1 |
exps/Baseline-Complement/models/model.py | Championchess/Generative-3D-Part-Assembly | 80 | 12788946 | """
B-Complement
Input:
part point clouds: B x P x N x 3
Output:
R and T: B x P x(3 + 4)
Losses:
Center L2 Loss, Rotation L2 Loss, Rotation Chamder-Distance Loss
"""
import torch
from torch import nn
import torch.nn.functional as F
import sys, os
import numpy... | 2.21875 | 2 |
tests/test_dynamo.py | FernandoGarzon/dmwmclient | 1 | 12788947 | import pytest
from dmwmclient import Client
@pytest.mark.asyncio
async def test_cycle():
client = Client()
dynamo = client.dynamo
cycle = await dynamo.latest_cycle()
assert type(cycle) is dict
assert set(cycle.keys()) == {'cycle', 'partition_id', 'timestamp', 'comment'}
@pytest.mark.asyncio
asy... | 2.109375 | 2 |
tests/cases/base.py | chop-dbhi/varify | 6 | 12788948 | <gh_stars>1-10
from django.contrib.auth.models import User
from django.core.cache import cache
from django_rq import get_queue, get_connection
from rq.queue import get_failed_queue
from django.test import TestCase, TransactionTestCase
class AuthenticatedBaseTestCase(TestCase):
def setUp(self):
self.user =... | 2.015625 | 2 |
avalonbot/cards.py | AvantiShri/avalon-bot | 0 | 12788949 | from __future__ import division, print_function, absolute_import
import random
from collections import OrderedDict
#Mimicking Enums, but having the values be strings
class CardType(object):
LOYAL_SERVANT_OF_ARTHUR="LOYAL_SERVANT_OF_ARTHUR"
MERLIN="MERLIN"
PERCIVAL="PERCIVAL"
MINION_OF_MORDRED="MINION_... | 3.46875 | 3 |
utils/__init__.py | mpi2/impc-reference-harvester | 0 | 12788950 | import configparser
import os
import logging
dirname = os.path.dirname(__file__)
filename = os.path.join(dirname, '../config.ini')
config = configparser.ConfigParser()
config.read_file(open(filename))
logger = logging.getLogger()
handler = logging.StreamHandler()
formatter = logging.Formatter(
'%(asctime)s %... | 2.265625 | 2 |