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 |
|---|---|---|---|---|---|---|
cdc/lib/argparse.py | pastly/craps-dice-control | 0 | 42900 | from argparse import ArgumentTypeError, FileType
import sys
class BoundedInt:
def __init__(self, mini=None, maxi=None, clamp=False):
self.mini = mini
self.maxi = maxi
self.clamp = clamp
def __call__(self, str_value):
try:
i = int(str_value)
except Exception... | 3.296875 | 3 |
lume_epics/tests/test_server.py | slaclab/lume-epics | 1 | 42901 | <gh_stars>1-10
import numpy as np
import time
import pytest
import subprocess
import os
import sys
import epics
import signal
from epicscorelibs.path import get_lib
from p4p.client.thread import Context
from p4p import cleanup
from lume_model.variables import (
ScalarInputVariable,
ScalarOutputVariable,
Ima... | 1.851563 | 2 |
PythonExtensions/debug/console.py | Jakar510/PythonExtensions | 0 | 42902 | <filename>PythonExtensions/debug/console.py<gh_stars>0
import sys
import traceback
from pprint import PrettyPrinter
from threading import Lock
from types import TracebackType
from typing import *
__all__ = [
# 'getPPrintStr', 'check', 'get_func_details', 'print_signature'
'PRINT', 'Print', 'print_exception... | 2.515625 | 3 |
models/simclr_model.py | Amiiirali/SimCLR | 0 | 42903 | <gh_stars>0
import os
import torch
import torch.nn as nn
import torchvision.models as models
####################################################
out_channel = {'alexnet': 256, 'vgg16': 512, 'vgg19': 512, 'vgg16_bn': 512, 'vgg19_bn': 512,
'resnet18': 512, 'resnet34': 512, 'resnet50': 2048, 'resnext50_3... | 1.921875 | 2 |
rcsb/utils/tests-ccdc/testCcdcSearch.py | rcsb/py-rcsb_utils_ccdc | 0 | 42904 | ##
#
# File: testCcdcSearch.py
# Author: <NAME>
# Date: 13-Dec-2020
# Version: 0.001
#
# Updated:
#
##
"""
Test cases for chemical component search against the CCDC local Python API -
"""
__docformat__ = "restructuredtext en"
__author__ = "<NAME>"
__email__ = "<EMAIL>"
__license__ = "Apache 2.0"
import glob
im... | 2.046875 | 2 |
openclose-checker.py | linuxkay/python | 0 | 42905 | <reponame>linuxkay/python
# coding=utf-8
def yes_no_input():
while True:
choice = raw_input("This will read open or close information 'Type anything': ").lower()
if choice in ['運行', '全面滑走可能', '平常運転','○','● ','open','OPEN','Open','◎','◯','一部滑走可能']:
return True
elif choice in ['運... | 3.578125 | 4 |
flyingpigeon/processes/wps_kddm_bc.py | Ouranosinc/flyingpigeon | 1 | 42906 | <filename>flyingpigeon/processes/wps_kddm_bc.py
"""
KDDM Bias correction.
Author: <NAME> (KDDM algorithm), <NAME> (WPS wrapper)
"""
import logging
import flyingpigeon
import ocgis
from flyingpigeon.log import init_process_logger
from flyingpigeon.utils import archiveextract, rename_complexinputs
from pywps import Com... | 2.28125 | 2 |
cv09/cetnost.py | xtompok/uvod-do-prg_21 | 1 | 42907 | from collections import Counter
STRING = "abeceda"
# Varianta 1 - bez specialnich znalosti
cetnosti = {}
for pismeno in STRING:
if pismeno in cetnosti:
#cetnosti[pismeno] = cetnosti[pismeno] + 1
cetnosti[pismeno] += 1
else:
cetnosti[pismeno] = 1
print(cetnosti)
# Varianta 2 - vyuziti metody setdefault u slovn... | 3.453125 | 3 |
days/day13.py | bangingheads/advent-of-code-2020 | 0 | 42908 | <reponame>bangingheads/advent-of-code-2020
from functools import reduce
data = open("day13.txt").read().splitlines()
def part_one():
start = int(data[0])
buses = [int(x) for x in data[1].split(",") if x != "x"]
remainders = {}
for x in buses:
remainders[x] = (int(start/x)*x) + x
x, y = so... | 3.71875 | 4 |
lib/djpress/signals.py | hdknr/djpress | 0 | 42909 | <gh_stars>0
''' signals and handlers
'''
from django.conf import settings
from django.db.models.signals import post_save, post_delete
from django.db import transaction
from django.dispatch import receiver
from django.contrib.auth.models import User
from django.contrib.auth.signals import user_logged_in
import uuid
im... | 1.960938 | 2 |
tests/test_2_algos_comparison.py | weifanjiang/CSSPy | 3 | 42910 | # This is a comparison for the CSSP algorithms on real datasets.
# This is a test for subsampling functions:
## * Projection DPPs
## * Volume sampling
## * Pivoted QR
## * Double Phase
## * Largest leverage scores
##
import sys
sys.path.insert(0, '..')
from CSSPy.dataset_tools import *
from CSSPy.volume_sampler impor... | 2.796875 | 3 |
doubanfm/model.py | fakegit/douban.fm | 783 | 42911 | <gh_stars>100-1000
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
数据层
"""
from threading import RLock, Thread
import logging
import functools
from six.moves import queue
from doubanfm.API.api import Doubanfm
from doubanfm.API.netease_api import Netease
from doubanfm.config import db_config
logger = logging.getLog... | 2.40625 | 2 |
SCons/Tool/ninja/ninja_scons_daemon.py | brucerennie/scons | 0 | 42912 | <reponame>brucerennie/scons
#!/usr/bin/env python3
#
# MIT License
#
# Copyright The SCons Foundation
#
# 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
# withou... | 1.625 | 2 |
app.py | Waffleboy/Simple_Stock_Dashboard | 1 | 42913 | # -*- coding: utf-8 -*-
"""
Created on Sun Jun 5 15:54:03 2016
@author: waffleboy
"""
from flask import Flask, render_template
import requests
import ast
from datetime import datetime
from datetime import timedelta
import pandas as pd
import pickle,json
from pandas_highcharts.core import serialize
from collections im... | 2.734375 | 3 |
copusher/__main__.py | YuraLukashik/copusher | 3 | 42914 | from copusher import Copusher
app = Copusher()
app.run() | 1.171875 | 1 |
website/forms/views.py | chenjr0719/Django-Examples | 2 | 42915 | from django.shortcuts import render
from django.http import HttpResponseRedirect
from .models import Message, MessageForm
from .forms import QueryForm
# Create your views here.
def forms_home(request):
if request.method == 'POST':
post_form = MessageForm(request.POST)
if post_form.is_valid():
... | 2.1875 | 2 |
pyNetSocket/docs/__init__.py | DrSparky2k7/pyNetSocket | 1 | 42916 | print('The documentation for the pyNetSocket library')
print('This covers all the information you need to start')
print('')
print('Topics:',
'server',
'client',
'callbacks',
sep='\n\t')
print('To view information:',
'import pyNetSocket.docs.TOPIC',
sep='\n')
print('')
print('You can ... | 3.109375 | 3 |
pypy/lang/prolog/interpreter/arithmetic.py | camillobruni/pygirl | 12 | 42917 | <filename>pypy/lang/prolog/interpreter/arithmetic.py
import py
import math
from pypy.lang.prolog.interpreter.parsing import parse_file, TermBuilder
from pypy.lang.prolog.interpreter import engine, helper, term, error
from pypy.lang.prolog.interpreter.error import UnificationFailed, FunctionNotFound
from pypy.rlib.rarit... | 2.21875 | 2 |
big-fish/big-fish-scripts/remove_transcription_site.py | Henley13/paper_translation_factories_2020 | 2 | 42918 | # -*- coding: utf-8 -*-
"""
Remove transcription sites in the FISH image.
"""
import os
import argparse
import time
import datetime
import sys
import bigfish.stack as stack
import numpy as np
from utils import Logger
from loader import (get_metadata_directory, generate_filename_base,
images_gene... | 2.46875 | 2 |
arithmetics/calculate.py | SabeloX/Arithmetics-X | 0 | 42919 | <gh_stars>0
# Subtract numbers module
class Calculate:
def sub(a, b):
"""Substract two numbers"""
return a - b
def add(a, b):
"""Add two numbers"""
return a + b
def mult(a, b):
"""Product of two numbers"""
return a * b
def div(a, b):
"""Divide two numbers"""
return a / b
| 3.5625 | 4 |
froide/campaign/listeners.py | xenein/froide | 198 | 42920 | <gh_stars>100-1000
from .utils import connect_foirequest
def connect_campaign(sender, **kwargs):
reference = kwargs.get("reference")
if not reference:
return
if "@" in reference:
parts = reference.split("@", 1)
else:
parts = reference.split(":", 1)
if len(parts) != 2:
... | 2.296875 | 2 |
rayleigh/searchable_collection.py | mgsh/rayleigh | 185 | 42921 | """
Methods to search an ImageCollection with brute force, exhaustive search.
"""
import cgi
import abc
import cPickle
import numpy as np
from sklearn.decomposition import PCA
from sklearn.metrics.pairwise import \
manhattan_distances, euclidean_distances, additive_chi2_kernel
import pyflann
from scipy.spatial imp... | 2.6875 | 3 |
Code/coupon_collector.py | PacktPublishing/Modern-Python-Cookbook | 107 | 42922 | <reponame>PacktPublishing/Modern-Python-Cookbook<gh_stars>100-1000
"""Python Cookbook
See
http://www.brynmawr.edu/math/people/anmyers/PAPERS/SIGEST_Coupons.pdf
and
https://en.wikipedia.org/wiki/Stirling_numbers_of_the_second_kind
and
https://en.wikipedia.org/wiki/Binomial_coefficient
"""
from math import factori... | 3.3125 | 3 |
escsim/simulator.py | Edlward/foc_esc | 67 | 42923 | <reponame>Edlward/foc_esc<gh_stars>10-100
import math
import constants
class Simulator(object):
def __init__ (self):
self.bemfa = 0.0
self.bemfb = 0.0
self.va = 0.0
self.vb = 0.0
self.kp = constants.KP_EST_RPM
self.ki = constants.KI_EST_RPM
self.ls = 0.035
... | 2.25 | 2 |
src/second-lesson/neuron.py | daveomri/neural-network-tutorial | 0 | 42924 | <reponame>daveomri/neural-network-tutorial
inputs = [1, 2, 3, 2.5]
weights1 = [0.2, 0.8, -0.5, 1.0]
weights2 = [0.5, -0.91, 0.26, -0.5]
weights3 = [-0.26, -0.27, 0.17, 0.87]
bias1 = 2
bias2 = 3
bias3 = 0.5
output = [ inputs[0]*weights1[0] + inputs[1]*weights1[1] + inputs[2]*weights1[2] + inputs[3]*weights... | 3.796875 | 4 |
50/26.py | ElyKar/Euler | 0 | 42925 | #!/bin/python
from decimal import *
import re
maxi = 0
maxidx = 0
def longest(s):
cur = 0
sub = ''
for start in range(len(s)):
end = start+1
test = s[start]
while end < len(s) and len(sub) == 0:
if test == s[end:end+end-start]:
sub = test
test += s[end]
end += 1
return len(sub)
getcontext... | 3.453125 | 3 |
ghiblister.py | mcscope/NoisebrigePythonDebuggingTalk | 46 | 42926 | <filename>ghiblister.py
# <NAME> May 5, 2017
# Created for Noisebridge Python class, distribute and use freely
# This is an example program that is a client for Studio Ghibli's API.
# (https://ghibliapi.herokuapp.com/#section/Studio-Ghibli-API)
# It downloads all the resources available in the API, and cross links som... | 2.734375 | 3 |
nn/nn.py | jiangdaniel/dl-papers | 1 | 42927 | #!/usr/bin/env python3
import os
import argparse
import numpy as np
from sklearn import preprocessing
from sklearn import datasets
from tqdm import tqdm
class Network(object):
def __init__(self):
self.linear1 = Linear(64, 128)
self.relu1 = ReLU()
self.linear2 = Linear(128, 64)
se... | 2.75 | 3 |
Examples/HuginnAirCal2.py | UASLab/OpenFlightAnalysis | 7 | 42928 | """
University of Minnesota
Aerospace Engineering and Mechanics - UAV Lab
Copyright 2019 Regents of the University of Minnesota
See: LICENSE.md for complete license details
Author: <NAME>
Analysis for Huginn (mAEWing2) FLT03 and FLT04
"""
#%%
# Import Libraries
import numpy as np
import matplotlib.pyplot as plt
# H... | 1.78125 | 2 |
setup.py | jkkwoen/things3-wrapper | 0 | 42929 | from setuptools import setup, find_packages
setup_requires = [
]
install_requires = [
]
dependency_links = [
]
setup(
name='things3-wrapper',
version='0.1',
description='Things 3 app python wrapper using URL scheme',
author='jkkwoen',
author_email='<EMAIL>',
packages=find_package... | 1.203125 | 1 |
kaldi/base/__init__.py | mxmpl/pykaldi | 916 | 42930 | from ._kaldi_error import *
from ._timer import *
__all__ = [name for name in dir()
if name[0] != '_'
and not name.endswith('Base')]
| 1.734375 | 2 |
CellCycle/ChainModule/ProdCons.py | AQuadroTeam/server_cellsCycle | 3 | 42931 | #! /usr/bin/env python
import Queue
from Queue import Empty
from ListThread import ListThread
BUF_SIZE = 10
q = Queue.Queue(BUF_SIZE)
class ProducerThread(ListThread):
def __init__(self, myself, master, slave, slave_of_slave, master_of_master, logger, settings, name):
ListThread.__init__(self, myself, m... | 3 | 3 |
auto-cite/plugins/orcid.py | msuefishlab/efishlabwebsite21 | 70 | 42932 | <filename>auto-cite/plugins/orcid.py<gh_stars>10-100
from urllib.request import Request, urlopen
import json
from util import *
# orcid api
endpoint = "https://pub.orcid.org/v2.0/$ORCID/works"
headers = {"Accept": "application/json"}
def main(data):
# list of sources to return
all_sources = []
for inde... | 2.828125 | 3 |
tests/test_compute.py | cruncher/python-exoscale | 0 | 42933 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import pytest
from base64 import b64decode
from cs import CloudStackApiException
from datetime import datetime, timedelta
from time import sleep
from exoscale.api import ResourceNotFoundError
from exoscale.api.compute import *
from .conftest import _random_str
class Tes... | 2 | 2 |
contest/abc113/C.py | mola1129/atcoder | 0 | 42934 | <reponame>mola1129/atcoder
def main():
from collections import defaultdict
dd = defaultdict(str)
n, m = map(int, input().split())
keys = []
atcoder = [[] for _ in range(n)]
for i in range(m):
p, y = map(int, input().split())
# 入力を辞書キーとする
# 6桁:県番号 10桁:年 = 16桁
key_p... | 3.28125 | 3 |
pybrain/__init__.py | metabacchi/FuzzyClassificator | 28 | 42935 | <gh_stars>10-100
from pybrain.structure import *
| 0.960938 | 1 |
Classes.py | SamVarney/Robinhood | 0 | 42936 |
from Robinhood import Robinhood
import config
import pandas as pd
from datetime import time, datetime
from bokeh.plotting import figure, output_file, show
#my_trader = Robinhood()
def instrument_info(instrument):
return instrument['symbol']
class Portfolio:
def __init__(self, my_trader):
self.tra... | 3.03125 | 3 |
vendor/github.com/elastic/beats/libbeat/tests/system/test_template.py | N0mansky/countbeat | 16 | 42937 | <reponame>N0mansky/countbeat
from base import BaseTest
import os
from elasticsearch import Elasticsearch, TransportError
from nose.plugins.attrib import attr
import unittest
INTEGRATION_TESTS = os.environ.get('INTEGRATION_TESTS', False)
class Test(BaseTest):
def test_index_modified(self):
"""
Te... | 2.21875 | 2 |
corehq/apps/accounting/management/commands/generate_invoices.py | dslowikowski/commcare-hq | 1 | 42938 | from optparse import make_option
import datetime
from django.core.management import BaseCommand
from corehq.apps.accounting.tasks import generate_invoices
class Command(BaseCommand):
help = ("Generate missing invoices based on the given date in YYYY-MM-DD "
"format")
option_list = BaseCommand.opt... | 2.46875 | 2 |
src/solutions/solution_7.py | mannickutd/project_euler | 0 | 42939 | <filename>src/solutions/solution_7.py
# -*- coding: utf-8 -*-
"""
Solution to question 7
<NAME>
2014-04-15
"""
from utils.include_decorator import include_decorator
# Generator for primes.
# Not a particulary quick one but for small primes it is fine.
# If you are consistently looking for prime numbers you would pr... | 3.3125 | 3 |
scripts/plots.py | haohao11/AMENet | 4 | 42940 | <filename>scripts/plots.py
# -*- coding: utf-8 -*-
"""
Created on Mon Apr 13 15:49:28 2020
@author: cheng
"""
import numpy as np
import matplotlib.pyplot as plt
def plot_pred(xy, y_prime, N=10, groundtruth=True):
"""
This is the plot function to plot the first scene
"""
fig,ax = plt.subp... | 3.15625 | 3 |
examples/usage.py | jamesholcombe/dash-auth-external | 9 | 42941 | <filename>examples/usage.py
from dash_auth_external import DashAuthExternal
from dash import Dash, Input, Output, html, dcc
# using spotify as an example
AUTH_URL = "https://accounts.spotify.com/authorize"
TOKEN_URL = "https://accounts.spotify.com/api/token"
CLIENT_ID = "YOUR_CLIENT_ID"
# creating the instance of our... | 2.8125 | 3 |
app/main.py | PythonBiellaGroup/ModernDataEngineering | 12 | 42942 | <filename>app/main.py
# import streamlit.cli
from app.src.launch import app
if __name__ == "__main__":
# streamlit.cli._main_run_clExplicit("./src/launch.py", "streamlit run")
app.run()
| 1.6875 | 2 |
scraper/storage_spiders/diegoshoecom.py | chongiadung/choinho | 0 | 42943 | <filename>scraper/storage_spiders/diegoshoecom.py
# Auto generated by generator.py. Delete this line if you make modification.
from scrapy.spiders import Rule
from scrapy.linkextractors import LinkExtractor
XPATH = {
'name' : "//div[@class='product-info']/form/h1",
'price' : "//div[@class='price-wrap clearfix'... | 1.921875 | 2 |
form.py | KOHE11/SAProgEX-server | 1 | 42944 | <filename>form.py
#! /usr/bin/env python3
import cgi
import sys
import io
import csv
import os
import psycopg2
def select_book(query):
result = []
print("query: ", query)
# 空文字の時
if query == "" or query == None:
return result
# 入力された文字を取得
param_str_search = "%" + query + "%"
# ... | 3.375 | 3 |
fdia_simulation/filters/radar_filter_model.py | QDucasse/FDIA_simulation | 7 | 42945 | <reponame>QDucasse/FDIA_simulation<gh_stars>1-10
# -*- coding: utf-8 -*-
"""
Created on Fri Jun 28 14:50:36 2019
@author: qde
"""
import numpy as np
from math import sqrt, atan2
from abc import abstractmethod, ABC
from filterpy.kalman import... | 2.203125 | 2 |
2017/aoc_12.py | justanotherdot/advent-linguist | 0 | 42946 | from collections import defaultdict
s = """
0 <-> 2
1 <-> 1
2 <-> 0, 3, 4
3 <-> 2, 4
4 <-> 2, 3, 6
5 <-> 6
6 <-> 4, 5
"""
s = """
0 <-> 659, 737
1 <-> 1, 1433
2 <-> 982, 1869
3 <-> 306, 380, 1462, 1827
4 <-> 1076
5 <-> 794, 1451
6 <-> 146, 1055
7 <-> 834, 1557
8 <-> 1333
9 <-> 849, 906, 1863
10 <-> 362, 505
11 <-> 33... | 2.890625 | 3 |
Part-03-Understanding-Software-Crafting-Your-Own-Tools/models/edx-platform/lms/djangoapps/courseware/migrations/0015_add_courseware_stats_index.py | osoco/better-ways-of-thinking-about-software | 3 | 42947 | <filename>Part-03-Understanding-Software-Crafting-Your-Own-Tools/models/edx-platform/lms/djangoapps/courseware/migrations/0015_add_courseware_stats_index.py
# Generated by Django 2.2.18 on 2021-02-18 17:35
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
(... | 1.625 | 2 |
setup.py | AliyevH/elasticfeed | 3 | 42948 | from setuptools import setup, find_packages
setup(
name="elasticfeed",
version="0.1.1",
include_package_data=True,
packages=find_packages(),
author="<NAME>",
author_email="<EMAIL>",
description="Export csv data into Elasticsearch",
license="MIT",
url="https://github.com/AliyevH/elk_... | 1.40625 | 1 |
core/views.py | pfaion/vocabulearn-django | 0 | 42949 | <filename>core/views.py
from django.shortcuts import render, redirect
from django.contrib.auth import authenticate, login
from django.contrib.auth.decorators import login_required
from .models import Folder, CardSet, FlashCard
# Create your views here.
@login_required
def index(request, set_id=None):
if set_... | 2.1875 | 2 |
test/conftest.py | atztogo/aiida-donothing | 0 | 42950 | """pytest fixtures."""
import pytest
pytest_plugins = ["aiida.manage.tests.pytest_fixtures"]
| 1.046875 | 1 |
problem/10000~19999/11948/11948.py3.py | njw1204/BOJ-AC | 1 | 42951 | <gh_stars>1-10
x=[]
for i in range(4):
x.append(int(input()))
x.sort()
ans=sum(x[1:])
x=[]
for i in range(2):
x.append(int(input()))
ans+=max(x)
print(ans) | 2.6875 | 3 |
src/e_modelTesting/modelTesting.py | JacobSal/Generalized-Sklearn-ML-Pipeline | 0 | 42952 | # -*- coding: utf-8 -*-
"""
Created on Wed Jan 13 19:02:19 2021
@author: <NAME>
@version: 1.0.0
"""
#%% IMPORTS
import os
import sys
SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
sys.path.append(os.path.dirname(SCRIPT_DIR))
from sklearn.pipeline import Pipeline
import multiprocessing as mp
import numpy as n... | 1.929688 | 2 |
Codeforces/588A - Duff and Meat.py | a3X3k/Competitive-programing-hacktoberfest-2021 | 12 | 42953 | #https://codeforces.com/problemset/problem/588/A
n = int(input())
a, p = map(int, input().split(" "))
mm = a * p # minimum money
mp = p # minimum price
for i in range(n - 1):
a, p = map(int, input().split(" "))
if p < mp:
mp = p
mm += a * mp
print(mm)
| 3.15625 | 3 |
instagram_api/response/model/phone_verification_settings.py | Yuego/instagram_api | 13 | 42954 | <filename>instagram_api/response/model/phone_verification_settings.py<gh_stars>10-100
from ..mapper import PropertyMapper, ApiInterfaceBase
from ..mapper.types import Timestamp, AnyType
__all__ = ['PhoneVerificationSettings', 'PhoneVerificationSettingsInterface']
class PhoneVerificationSettingsInterface(ApiInterface... | 1.9375 | 2 |
tests/submodules/test_always_on_task.py | MatiCG/pyaww | 0 | 42955 | # Standard library imports
from typing import TYPE_CHECKING
# Related third party imports
import pytest
# Local application/library specific imports
if TYPE_CHECKING:
from pyaww import AlwaysOnTask, User
@pytest.mark.asyncio
async def test_restart(always_on_task: "AlwaysOnTask") -> None:
assert await alw... | 2.171875 | 2 |
mytutor/urls.py | adityapandadev/FindMyTutor | 1 | 42956 | <gh_stars>1-10
from django.contrib import admin
from django.urls import path
from django.urls.conf import include
from mytutor import views
from django.views.generic.base import RedirectView
urlpatterns = [
path('home/', views.HomeView.as_view()),
path('tutor/', views.TutorListView.as_view()),
path('contac... | 2.03125 | 2 |
django/publicmapping/publicmapping/celery.py | PublicMapping/districtbuilder-classic | 2 | 42957 | <reponame>PublicMapping/districtbuilder-classic
from __future__ import absolute_import, unicode_literals
import os
from celery import Celery
from . import REDIS_URL
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "publicmapping.settings")
# Configure Celery app to use Redis as both the results backend and the message... | 2.03125 | 2 |
CodeEntropy/FunctionCollection/EntropyFunctions.py | DonaldChung-HK/CodeEntropy | 0 | 42958 | <filename>CodeEntropy/FunctionCollection/EntropyFunctions.py
from ast import arg
import sys, os
import numpy as nmp
from CodeEntropy.ClassCollection import BeadClasses as BC
from CodeEntropy.ClassCollection import ConformationEntity as CONF
from CodeEntropy.ClassCollection import ModeClasses
from CodeEntropy.ClassColl... | 2.453125 | 2 |
src/morpheus/__init__.py | eliavw/morpheus | 0 | 42959 | from .composition.ParallelComposition import ParallelComposition
from .composition.SequentialComposition import SequentialComposition
from .core.Morpheus import Morpheus
| 0.992188 | 1 |
cgcnn/data.py | skrsna/cgcnn | 1 | 42960 | <filename>cgcnn/data.py
from __future__ import print_function, division
import os
import csv
import re
import json
import functools
import random
import warnings
import torch
import numpy as np
from torch.utils.data import Dataset, DataLoader
from torch.utils.data.dataloader import default_collate
from torch.utils.dat... | 2.328125 | 2 |
generate.py | murnanedaniel/3d-maze-generator | 0 | 42961 |
from solid import *
from math import *
from functools import reduce
from random import randint
import operator
# Copyright (c) 2017 <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 w... | 2.34375 | 2 |
speedydeploy/providers/linode.py | suvit/speedydeploy | 0 | 42962 | <gh_stars>0
from fabric import api as fab
from ..base import Ubuntu, Ubuntu104
from ..deployment import _
from ..project.cron import CronTab
from ..project import LogRotate
from .base import Provider
class Linode(Provider):
def __init__(self):
super(Linode, self).__init__()
fab.env.os = Ubuntu1... | 1.984375 | 2 |
saas/dataops/api/dataset/APP-META-PRIVATE/postrun/00_init_job.py | iuskye/SREWorks | 407 | 42963 | <filename>saas/dataops/api/dataset/APP-META-PRIVATE/postrun/00_init_job.py<gh_stars>100-1000
# coding: utf-8
from common import checker
from warehouse import entry as warehouse_entry
from pmdb import entry as pmdb_entry
from dataset import entry as dataset_entry
from health import entry as health_entry
from job impor... | 1.882813 | 2 |
CaseConverter/test.py | SylannBin/Utils | 0 | 42964 | <filename>CaseConverter/test.py<gh_stars>0
from printer import Color, danger, success, info, format_table
from converter import *
def resolve(function, value, expected):
try:
result = function(value)
except ValueError as e:
result = 'ValueError'
except NotImplementedError as e:
ret... | 2.65625 | 3 |
babilim/training/losses.py | penguinmenac3/babilim | 1 | 42965 | <reponame>penguinmenac3/babilim<gh_stars>1-10
# AUTOGENERATED FROM: babilim/training/losses.ipynb
# Cell: 0
"""doc
# babilim.training.losses
> A package containing all losses.
"""
# Cell: 1
from collections import defaultdict
from typing import Any
import json
import numpy as np
import babilim
from babilim.core.iten... | 2.75 | 3 |
robot_framework/visualization/balboa_visualization.py | abarcis/robot-framework | 0 | 42966 | <filename>robot_framework/visualization/balboa_visualization.py
#! /usr/bin/env python
import colorsys
import time
import random
from rclpy.qos import (
QoSProfile,
QoSDurabilityPolicy,
QoSHistoryPolicy,
QoSReliabilityPolicy,
)
from rclpy.node import Node
from std_msgs.msg import Header, Char, ColorRG... | 2.046875 | 2 |
AART_project/src/config/devConfig.py | ambersun1234/AART | 14 | 42967 | <reponame>ambersun1234/AART
import os
import configparser
import sys
class devConfig():
def __init__(self):
tmp = os.path.abspath(__file__)
for i in range(2):
tmp = os.path.dirname(tmp)
self.rootPath = tmp
self.config = configparser.ConfigParser()
# default path
self.extend = {
"cfg": "yolov3.cfg",... | 2.109375 | 2 |
Examples/digits/NN/runNN.py | longtengz/pyml | 4 | 42968 | import sys
# TODO
# need to normalize this path for Windows users
sys.path.insert(0, '../../../NeuralNet')
from NeuralNet import NN
from ActivationFunction.AF import *
trainingPairs = list()
testPairs = list()
with open('../data/trainingDigits.data', 'r') as trainingDigitsFile:
for line in list(trainingDigitsFi... | 2.875 | 3 |
cbcPaddingAttack.py | danielverd/crypto-projects | 0 | 42969 | from modesOfOperation import CBCCipher
import sys
BLOCK_SIZE = 16
def blocks(l, n):
for i in range(0, len(l), n):
yield l[i:i + n]
def attack(cbc,ciphertext):
message = bytearray(b'')
blockGen = blocks(ciphertext,BLOCK_SIZE)
ctextBlocks = []
for i in blockGen:
ctextBlocks.append(... | 2.921875 | 3 |
tests/util_test.py | gurpradeep/securitybot | 1,053 | 42970 | <gh_stars>1000+
from unittest2 import TestCase
from datetime import datetime, timedelta
import securitybot.util as util
class VarTest(TestCase):
def test_hours(self):
assert util.OPENING_HOUR < util.CLOSING_HOUR, 'Closing hour must be after opening hour.'
class NamedTupleTest(TestCase):
def test_empt... | 3.359375 | 3 |
examples/resummator_dipole.py | MarcelBalsiger/ngl_resum | 0 | 42971 | #! /usr/bin/env python
########################################################################
# #
# Resums the non-global logarithms, needs ngl_resum.py #
# #
# If... | 2.40625 | 2 |
candle/estimator.py | paiforsyth/candle | 0 | 42972 | import gc
from torch.autograd import Variable
import torch
import torch.autograd as ag
import torch.nn as nn
import torch.nn.functional as F
import numpy as np
from .context import Context
from .nested import *
class Function(object):
def __call__(self, *args, **kwargs):
raise NotImplementedError
class ... | 2.359375 | 2 |
observations/r/swahili.py | hajime9652/observations | 199 | 42973 | # -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import csv
import numpy as np
import os
import sys
from observations.util import maybe_download_and_extract
def swahili(path):
"""Swahili
Attitudes towards the Swahili language a... | 3.3125 | 3 |
Iconolatry.py | SystemRage/Iconolatry | 9 | 42974 | <filename>Iconolatry.py
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from struct import unpack_from, pack, calcsize
from PIL import Image, ImageCms
from tempfile import mkstemp
from os.path import isfile, splitext, abspath, isdir, join, basename
from os import listdir
from io import BytesIO
import sys
import argpars... | 2.65625 | 3 |
qubits/cl_utils.py | thespacedoctor/qubits | 3 | 42975 | #!/usr/local/bin/python
# encoding: utf-8
"""
*Documentation for qubits can be found here: https://github.com/thespacedoctor/qubits*
Usage:
qubits init <pathToWorkspace>
qubits run -s <pathToSettingsFile> -o <pathToOutputDirectory> -d <pathToSpectralDatabase>
COMMANDS
--------
init setu... | 2.359375 | 2 |
datasets/detection.py | kaylode/self-driving-car-sim | 5 | 42976 | <filename>datasets/detection.py
import os
import torch
import torch.nn as nn
import torch.utils.data as data
import random
import matplotlib.pyplot as plt
import matplotlib.patches as patches
import json
import numpy as np
from PIL import Image
from augmentations.transforms import Compose, Normalize
from utils.utils im... | 2.40625 | 2 |
safetorch/utils/instructions_converter.py | MNayer/SAFEtorch | 35 | 42977 | <reponame>MNayer/SAFEtorch
# Copyright (c) Facebook, Inc. and its affiliates.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
#
import json
class InstructionsConverter:
def __init__(self, json_i2id):
f = ope... | 2.546875 | 3 |
examples/projects/LGL/LGL-simulation.py | JamesPino/booleannet | 0 | 42978 | """
LGL simulator
It is also a demonstration on how the collector works
"""
import boolean2
from boolean2 import Model, util
from random import choice
# ocasionally randomized nodes
TARGETS = set( "PDGF IL15".split() )
def new_getvalue( state, name, p):
"""
Called every time a node value is used in an expr... | 3.046875 | 3 |
problem_042.py | arboreus/project_euler | 0 | 42979 | #42) Coded triangle numbers
#The nth term of the sequence of triangle numbers is given by, tn = (1/2)*n*(n+1); so the first ten triangle numbers are:
#1, 3, 6, 10, 15, 21, 28, 36, 45, 55, ...
#By converting each letter in a word to a number corresponding to its alphabetical position and adding these values we form a wo... | 3.75 | 4 |
idtidy.py | PdomGenomeProject/genome-annotation | 0 | 42980 | <filename>idtidy.py
import re, sys
class Entry():
"""
Very simplistic representation of a GFF3 entry: a single line of a GFF3 file
which may or may not be a complete representation of a genomic feature.
"""
def __init__(self, line):
self.fields = line.rstrip().split("\t")
if not self.is_feature():
... | 3.015625 | 3 |
imsearchtools/engines/google_old_web.py | carandraug/imsearch-tools | 57 | 42981 | #!/usr/bin/env python
import requests
import re
from hashlib import md5
from search_client import *
from api_credentials import *
## API Configuration
# --------------------------------------------
GOOGLE_WEB_ENTRY = 'http://www.google.com/'
GOOGLE_WEB_FUNC = 'images'
## Search Class
# --------------------------... | 2.515625 | 3 |
Exercises/Riemann.py | JoeyDeSmet/Algorithm-intro | 0 | 42982 | import math
def f(x):
return math.pow(x, 2) + 3 * x + 15
def riemannIntegral(interval, a):
x = interval[0]
step = (interval[1] - interval[0]) / a
x1 = x + step
integral = 0
for i in range (interval[0], a):
width = x1 - x
height = f(x1)
integral += width * height
... | 4 | 4 |
tasks/views.py | marcphilippebeaujean-abertay/recur-notion | 2 | 42983 | <reponame>marcphilippebeaujean-abertay/recur-notion
import datetime
import logging
from django.contrib import messages
from django.contrib.auth.decorators import login_required
from django.http import HttpResponse
from django.shortcuts import redirect, render
from django.urls import reverse
from django.utils.timezone ... | 2.09375 | 2 |
src/milestones.py | notprash/Bluey | 1 | 42984 | <reponame>notprash/Bluey<filename>src/milestones.py
from discord.ext import commands
from discord.ext.tasks import loop
import discord
from utilities import help_embed, read_database, update_database, has_admin_permissions
import sqlite3
class Milestones(commands.Cog):
def __init__(self, bot):
self.client ... | 2.546875 | 3 |
100 Curso aulapharos/008 BibliotecasModulos/005 Spyder scikit-learn/scikit-learn001.py | malcabaut/AprendiendoPython | 0 | 42985 | import pandas as pd
import numpy as np
USAhousing = pd.read_csv('USA_Housing.csv')
print(USAhousing.head())
print(USAhousing.tail()) | 3.09375 | 3 |
plugins/odbc_group_plugin.py | stillinsecure/acl_audit | 0 | 42986 | import pypyodbc
from group_plugin import GroupPlugin, Group
class ODBCGroupPlugin(GroupPlugin):
def __init__(self):
super(ODBCGroupPlugin, self).__init__()
self.connection_str = self.get_conf_option('connection_str')
self.groups_sql = self.get_conf_option('groups_sql')
self.change... | 2.4375 | 2 |
book/migrations/0011_auto_20170603_1526.py | pyprism/Hiren-Mail-Notify | 0 | 42987 | # -*- coding: utf-8 -*-
# Generated by Django 1.11 on 2017-06-03 09:26
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('book', '0010_auto_20170603_1441'),
]
operations = [
migrations.AlterField(
... | 1.359375 | 1 |
code_snippets/api-events-stream.py | brettlangdon/documentation | 0 | 42988 | <gh_stars>0
from datadog import initialize, api
options = {
'api_key': 'api_key',
'app_key': 'app_key'
}
initialize(**options)
start_time = 1419436850
end_time = 1419436870
api.Event.query(start=start_time, end=end_time, priority="normal", tags=["application:web"])
| 1.757813 | 2 |
bullet_op3/util/action_file_parser.py | AdvAiLab/bullet_op3 | 0 | 42989 | <gh_stars>0
import os
import time
from ctypes import *
from math import pi
from .. import __file__
module_path = os.path.dirname(__file__)
action_joints = [
'r_sho_pitch',
'l_sho_pitch',
'r_sho_roll',
'l_sho_roll',
'r_el',
'l_el',
'r_hip_yaw',
'l_hip_yaw',
'r_hip_roll',
'l_hip_r... | 2.34375 | 2 |
sandbox/python/worker_threads.py | rboman/progs | 2 | 42990 | #! /usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Copyright 2017 <NAME>
#
# 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
#
# Un... | 3.9375 | 4 |
tests/test_logging.py | dfint/changetextpy_script | 0 | 42991 | <gh_stars>0
import contextlib
import io
from changetext.logging_tools import get_logger, log_exceptions
def test_cache():
file = io.StringIO()
assert get_logger(file) is get_logger(file)
def test_double_write():
text = "text"
result = "result"
file = io.StringIO()
get_logger(file).write(te... | 2.5 | 2 |
TorchProteinLibrary/FullAtomModel/PDB2Coords/__init__.py | dendisuhubdy/TorchProteinLibrary | 0 | 42992 | <filename>TorchProteinLibrary/FullAtomModel/PDB2Coords/__init__.py<gh_stars>0
from .PDB2Coords import PDB2CoordsBiopython, PDB2CoordsOrdered, PDB2CoordsUnordered | 1.132813 | 1 |
Aula 18 – Listas (Parte 2)/pratica_01.py | Guilherme-Artigas/Python-avancado | 0 | 42993 | <filename>Aula 18 – Listas (Parte 2)/pratica_01.py
"""lista = []
lista.append('Guilherme')
lista.append(28)
#print(lista)
lista2 = []
lista2.append(lista[:])
lista[0] = 'Bryan'
lista[1] = 6
lista2.append(lista[:])
print(lista2)
"""
"""lista = [['João', 61], ['Guilherme', 28], ['Julia', 1], ['Bryan', 6]]
# [ [ 0 ]... | 3.8125 | 4 |
external_functions/pyef/template.py | josborne-noaa/PyFerret | 44 | 42994 | <reponame>josborne-noaa/PyFerret<gh_stars>10-100
'''
Template for creating a PyFerret Python External Function (PyEF).
The names of the functions provided should not be changed. By
default, PyFerret uses the name of the module as the function name.
Copy this file using a name that you would like to be the function
n... | 2.890625 | 3 |
dev/createClasses.py | h4yn0nnym0u5e/OSCAudio | 1 | 42995 | <reponame>h4yn0nnym0u5e/OSCAudio<gh_stars>1-10
import re
import fileinput
import os
import json
##############################################################################################
# User settings
dynamic = True
ftrl = ['play_wav' # files to reject
]
limit = 1000
rp = '../../Audio'
idxf = '.... | 2.28125 | 2 |
pocketthrone/managers/eventmanager.py | herrschr/pocket-throne | 4 | 42996 | from pocketthrone.entities.event import *
from weakref import WeakKeyDictionary
class EventManager:
_tag = "[EventManager] "
listeners = WeakKeyDictionary()
eventQueue= []
@classmethod
def register(self, listener, tag="untagged"):
'''registers an object for receiving game events'''
self.listeners[listener] =... | 2.515625 | 3 |
spikes/saveraw.py | 1082sqnatc/missionspacelab2019 | 0 | 42997 | import time
import picamera
import numpy as np
import cv2
with picamera.PiCamera() as camera:
camera.resolution = (3280, 2464)
camera. start_preview()
time. sleep(2)
camera.capture('image.data', 'yuv')
##################################################
fd = open('image.data', 'rb')
f=np.fromfile(fd, dty... | 2.765625 | 3 |
875. Koko Eating Bananas.py | joshlyman/Josh-LeetCode | 0 | 42998 | class Solution:
def minEatingSpeed(self, piles: List[int], H: int) -> int:
l, r = 1, max(piles)
while l < r:
m = l + (r-l) // 2
time = sum([math.ceil(i/m) for i in piles])
if time > H:
l = m + 1
else:
r = m
retur... | 3.046875 | 3 |
code/0-input/create_hdf5/pair_generation.py | AvinWangZH/3D-convolutional-speaker-recognition | 1 | 42999 | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
import sys
import numpy as np
import scipy.io.wavfile as wav
import random
import tables
import pickle
def feed_to_hdf5(feature_vector, subject_num, utterance_train_storage, utterance_test_storage, ... | 2.796875 | 3 |