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 |
|---|---|---|---|---|---|---|
app/api/utlis/models.py | jurekpawlikowski/flask-boilerplate | 3 | 22900 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from datetime import datetime
from sqlalchemy.event import listen
from app.factory import db
class BaseModel(db.Model):
"""
Base model with `created_at` and `updated_at` fields
"""
__abstract__ = True
fields_to_serialize = []
created_at = db.Col... | 2.640625 | 3 |
systest/tests/test_rm.py | devconsoft/pycred | 0 | 22901 | <filename>systest/tests/test_rm.py<gh_stars>0
def test_rm_long_opt_help(pycred):
pycred('rm --help')
def test_rm_short_opt_help(pycred):
pycred('rm -h')
def test_rm_none_existing_store_gives_exit_code_2(pycred, workspace):
with workspace():
pycred('rm non-existing-store user', expected_exit_code... | 1.835938 | 2 |
source/tweaks/cms_plugins.py | mverleg/svsite | 0 | 22902 |
"""
Raw HTML widget.
Adapted/copied from https://github.com/makukha/cmsplugin-raw-html
"""
from cms.plugin_base import CMSPluginBase
from cms.plugin_pool import plugin_pool
from django.template import Template
from django.utils.safestring import mark_safe
from .models import RawHtmlModel, CMSMember
from django.utils.... | 1.992188 | 2 |
tests/test_trackings.py | EugeneLiu/aftership-sdk-python | 0 | 22903 | from unittest import TestCase, mock
import pytest
from requests import Response
import aftership
class TrackingTestCase(TestCase):
def setUp(self):
self.slug = "4px"
self.tracking_number = "HH19260817"
self.tracking_id = "k5lh7dy7vvqeck71p5loe011"
@pytest.mark.vcr()
def test_cre... | 2.390625 | 2 |
071_caixaeletronico.py | laissilveira/python-exercises | 0 | 22904 | # Calcula a quantidade de notas de cada valor a serem sacadas em uma caixa eletrônico
print('=' * 30)
print('{:^30}'.format('CAIXA ELETRÔNICO'))
print('=' * 30)
valor = int(input('Valor a ser sacado: R$ '))
# notas de real (R$) existentes
tot200 = valor // 200
tot100 = (valor % 200) // 100
tot50 = ((valor % 200) % 100)... | 3.859375 | 4 |
2020/04/Teil 1 - V01.py | HeWeMel/adventofcode | 1 | 22905 | <reponame>HeWeMel/adventofcode
import sys
lines=[]
new=True
lc=0
with open('input.txt', 'r') as f:
for line in f:
line=line[:-1] # remove new line char
if line=='':
lc+=1
new=True
else:
if new:
lines.append(line)
new=False
... | 3.09375 | 3 |
src/falconpy/quick_scan.py | CrowdStrike/falconpy | 111 | 22906 | """Falcon Quick Scan API Interface Class
_______ __ _______ __ __ __
| _ .----.-----.--.--.--.--| | _ | |_.----|__| |--.-----.
|. 1___| _| _ | | | | _ | 1___| _| _| | <| -__|
|. |___|__| |_____|________|_____|____ |____|__| |__|__|__|_____|
|: 1 | ... | 1.109375 | 1 |
images/auth-service/settings.d/00-settings.py | ESGF/esgf-docker | 3 | 22907 | # Application definition
INSTALLED_APPS = [
'django.contrib.staticfiles',
'django.contrib.sessions',
'authenticate',
]
ROOT_URLCONF = 'auth_service.urls'
WSGI_APPLICATION = 'auth_service.wsgi.application'
# Use a non database session engine
SESSION_ENGINE = 'django.contrib.sessions.backends.signed_cookie... | 1.382813 | 1 |
tests/test_gru.py | nsuke/hyrnn | 73 | 22908 | <filename>tests/test_gru.py
import hyrnn
import torch.nn
def test_MobiusGRU_no_packed_just_works():
input_size = 4
hidden_size = 3
batch_size = 5
gru = hyrnn.nets.MobiusGRU(input_size, hidden_size, hyperbolic_input=False)
timestops = 10
sequence = torch.randn(timestops, batch_size, input_size)... | 2.1875 | 2 |
ecogvis/signal_processing/common_referencing.py | NKI-ECOG/ecogVIS | 13 | 22909 | from __future__ import division
import numpy as np
__all__ = ['subtract_CAR',
'subtract_common_median_reference']
def subtract_CAR(X, b_size=16):
"""
Compute and subtract common average reference in 16 channel blocks.
"""
channels, time_points = X.shape
s = channels // b_size
r = ... | 2.65625 | 3 |
rackspace/heat_store/catalog/tests.py | rohithkumar-rackspace/rcbops | 0 | 22910 | <reponame>rohithkumar-rackspace/rcbops<filename>rackspace/heat_store/catalog/tests.py<gh_stars>0
#!/usr/bin/env python
import unittest
import mox
import six.moves.urllib.request as urlrequest
from six import StringIO
from solution import Solution
class TestSolution(unittest.TestCase):
def setUp(self):
s... | 2.296875 | 2 |
tests/errors/semantic/ex4.py | toddrme2178/pyccel | 0 | 22911 | <filename>tests/errors/semantic/ex4.py<gh_stars>0
x is 1
y is None
| 0.921875 | 1 |
GetTopK.py | unsuthee/SemanticHashingWeekSupervision | 19 | 22912 | ################################################################################################################
# Author: <NAME>
# <EMAIL>
################################################################################################################
import numpy as np
import os
from utils import *
from tqdm import t... | 2.171875 | 2 |
migrate_from_fnordcredit.py | stratum0/Matekasse | 1 | 22913 | from matekasse import create_app, db
from matekasse.models import User, Transaction
import sqlite3
import argparse
parser = argparse.ArgumentParser(allow_abbrev=False)
parser.add_argument("-p", "--path", action='store', type=str, required=True, help="Path to fnordcredit database")
inp = parser.parse_args()
app = cre... | 2.625 | 3 |
scripts/lc/ARES/testing/run_rose_tool.py | ouankou/rose | 488 | 22914 | <gh_stars>100-1000
#!/usr/bin/env python
"""Runs a ROSE tool. If the tool does not return status 0, then runs the
corresponding non-ROSE compiler. Records whether the tool succeeded, in
passed.txt and failed.txt, but always returns status 0.
"""
import argparse
import inspect
import os
from support.local_logging im... | 2.796875 | 3 |
source/odp/migrations/0003_auto_20201121_0919.py | kssvrk/BhoonidhiODP | 0 | 22915 | <reponame>kssvrk/BhoonidhiODP
# Generated by Django 3.1.2 on 2020-11-21 09:19
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('odp', '0002_auto_20201121_0659'),
]
operations = [
migrations.CreateModel(
name='ProcessGroup',
... | 1.757813 | 2 |
test/auth/test_client_credentials.py | membranepotential/mendeley-python-sdk | 103 | 22916 | from oauthlib.oauth2 import InvalidClientError, MissingTokenError
import pytest
from test import configure_mendeley, cassette
def test_should_get_authenticated_session():
mendeley = configure_mendeley()
auth = mendeley.start_client_credentials_flow()
with cassette('fixtures/auth/client_credentials/get_a... | 2.3125 | 2 |
problem/01000~09999/06137/6137.py3.py | njw1204/BOJ-AC | 1 | 22917 | s=[]
for i in range(int(input())):
s.append(input())
cnt=0
while s:
flag=True
for i in range(len(s)//2):
if s[i]<s[-(i+1)]:
print(s[0],end='')
s.pop(0)
flag=False
break
elif s[-(i+1)]<s[i]:
print(s[-1],end='')
s.pop()
flag=False
break
if flag:
print(s[-1],end='')
s.pop()
cnt+=1
if ... | 3 | 3 |
test/test_thirty.py | jakubtuchol/dailycodingproblem | 1 | 22918 | <reponame>jakubtuchol/dailycodingproblem<filename>test/test_thirty.py
from src.thirty import edit_distance
from src.thirty import find_second_largest_node
from src.thirty import make_palindrome
from src.thirty import powerset
from src.data_structures import BinaryNode
class TestEditDistance:
"""
Problem #31
... | 3 | 3 |
src/google_music_proto/musicmanager/utils.py | ddboline/google-music-proto | 0 | 22919 | __all__ = [
'generate_client_id',
'get_album_art',
'get_transcoder',
'transcode_to_mp3',
]
import os
import shutil
import subprocess
from base64 import b64encode
from binascii import unhexlify
from hashlib import md5
import audio_metadata
# The id is found by: getting md5sum of audio, base64 encode md5sum, remo... | 2.40625 | 2 |
Other/SocialNetwork/Solver.py | lesyk/Evolife | 0 | 22920 | ## {{{ http://code.activestate.com/recipes/303396/ (r1)
'''equation solver using attributes and introspection'''
from __future__ import division
class Solver(object):
'''takes a function, named arg value (opt.) and returns a Solver object'''
def __init__(self,f,**args):
self._f=f
self._args={}
# ... | 2.421875 | 2 |
server/graph.py | Alpacron/vertex-cover | 0 | 22921 | <reponame>Alpacron/vertex-cover
import json
import random
class Graph:
"""
Graph data structure G = (V, E). Vertices contain the information about the edges.
"""
def __init__(self, graph=None):
if graph is None:
graph = {}
is_weighted = graph is not None and any(
... | 3.359375 | 3 |
ex4.py | AyeAyeZin/python_exercises | 0 | 22922 | <reponame>AyeAyeZin/python_exercises
cars=100
cars_in_space=5
drivers=20
pasengers=70
car_not_driven=cars-drivers
cars_driven=drivers
carpool_capacity=cars_driven*space_in_a_car
average_passengers_percar=passengers/cars_driven
print("There are", cars,"cars availble")
print("There are only",drivers,"drivers availble")
p... | 3.9375 | 4 |
python_docs/05Functions/01Definition.py | Matheus-IT/lang-python-related | 0 | 22923 | # Definição de função
def soma(a2, b2): # Os parâmetros aqui precisam ter outro nome
print(f'A = {a2} e B = {b2}')
s = a2 + b2
print(f'A soma vale A + B = {s}')
# Programa principal
a = int(input('Digite um valor para A: '))
b = int(input('Digite um valor para B: '))
soma(a, b)
| 3.828125 | 4 |
python/number.py | Dahercode/datalumni-test | 1 | 22924 | # Your code goes here
tab=[]
for i in range(1000) :
tab.append(i)
tab2=[]
for i in range(len(tab)):
if sum([ int(c) for c in str(tab[i]) ]) <= 10:
tab2.append(tab[i])
tab3=[]
for i in range(len(tab2)):
a=str(tab2[i])
if a[len(a)-2] == '4':
tab3.append(tab2[i])
tab4=[]
for i in range(l... | 3.15625 | 3 |
backend/src/baserow/contrib/database/migrations/0016_token_tokenpermission.py | ashishdhngr/baserow | 0 | 22925 | <gh_stars>0
# Generated by Django 2.2.11 on 2020-10-23 08:35
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
("core", "000... | 2 | 2 |
setup.py | davidharvey1986/rrg | 2 | 22926 | #!/usr/local/bin/python3
import sys,os,string,glob,subprocess
from setuptools import setup,Extension
from setuptools.command.build_ext import build_ext
from setuptools.command.install import install
import numpy
long_description = """\
This module uses the RRG ... | 1.78125 | 2 |
restbed/core/api.py | mr-tenders/restbed | 0 | 22927 | <filename>restbed/core/api.py
"""
restbed core api
"""
import pyinsane2
from typing import List
class CoreApi(object):
scanner: pyinsane2.Scanner = None
scan_session: pyinsane2.ScanSession = None
@staticmethod
def initialize():
"""
initialize SANE, don't call if unit testing
(... | 2.328125 | 2 |
secure_notes_client/thread_pool.py | rlee287/secure-notes-client | 0 | 22928 | from concurrent.futures import ThreadPoolExecutor
import time
from PySide2.QtCore import QCoreApplication
thread_pool=None
def init_thread_pool():
global thread_pool
thread_pool=ThreadPoolExecutor()
def deinit_thread_pool():
global thread_pool
thread_pool.shutdown()
def submit_task(function,*args,*... | 2.90625 | 3 |
Fairness_attack/data_utils.py | Ninarehm/attack | 8 | 22929 | from __future__ import division
from __future__ import print_function
from __future__ import absolute_import
from __future__ import unicode_literals
import json
import numpy as np
import scipy.sparse as sparse
import defenses
import upper_bounds
class NumpyEncoder(json.JSONEncoder):
def default(self, obj):
... | 2.53125 | 3 |
pytracetable/__init__.py | filwaitman/pytracetable | 1 | 22930 | from pytracetable.core import tracetable
__all__ = [
'tracetable',
]
| 1.109375 | 1 |
quandl_data_retriever/server.py | fabiomolinar/quandl-data-retriever | 0 | 22931 | """ Server module
Quandl API limits:
Authenticated users have a limit of 300 calls per 10 seconds,
2,000 calls per 10 minutes and a limit of 50,000 calls per day.
"""
import urllib
import logging
from twisted.internet import reactor
from twisted.web.client import Agent, readBody
from . import settings
from . import... | 2.609375 | 3 |
actingweb/deprecated_db_gae/db_subscription_diff.py | gregertw/actingweb | 0 | 22932 | <gh_stars>0
from builtins import object
from google.appengine.ext import ndb
import logging
"""
DbSubscriptionDiff handles all db operations for a subscription diff
DbSubscriptionDiffList handles list of subscriptions diffs
Google datastore for google is used as a backend.
"""
__all__ = [
'DbSubscrip... | 2.71875 | 3 |
azure-mgmt-iothub/azure/mgmt/iothub/models/ip_filter_rule.py | JonathanGailliez/azure-sdk-for-python | 1 | 22933 | <filename>azure-mgmt-iothub/azure/mgmt/iothub/models/ip_filter_rule.py
# 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.28125 | 2 |
4344.py | yzkim9501/Baekjoon | 0 | 22934 | # 대학생 새내기들의 90%는 자신이 반에서 평균은 넘는다고 생각한다. 당신은 그들에게 슬픈 진실을 알려줘야 한다.
# 첫째 줄에는 테스트 케이스의 개수 C가 주어진다.
# 둘째 줄부터 각 테스트 케이스마다 학생의 수 N(1 ≤ N ≤ 1000, N은 정수)이 첫 수로 주어지고, 이어서 N명의 점수가 주어진다. 점수는 0보다 크거나 같고, 100보다 작거나 같은 정수이다.
# 각 케이스마다 한 줄씩 평균을 넘는 학생들의 비율을 반올림하여 소수점 셋째 자리까지 출력한다.
def avg(l):
s=0
for i in l:
s+=i
... | 3.078125 | 3 |
tests/dualtor/test_standby_tor_upstream_mux_toggle.py | AndoniSanguesa/sonic-mgmt | 1 | 22935 | import pytest
import logging
import ipaddress
import json
import re
import time
from tests.common.dualtor.dual_tor_mock import *
from tests.common.helpers.assertions import pytest_assert as pt_assert
from tests.common.dualtor.dual_tor_utils import rand_selected_interface, verify_upstream_traffic, get_crm_nexthop_counte... | 1.84375 | 2 |
birdsong_recognition/dataset.py | YingyingF/birdsong_recognition | 0 | 22936 | # AUTOGENERATED! DO NOT EDIT! File to edit: dataset.ipynb (unless otherwise specified).
__all__ = ['load_mp3', 'get_sample_label', 'preprocess_file', 'pad_by_zeros', 'split_file_by_window_size',
'wrapper_split_file_by_window_size', 'create_dataset_fixed_size', 'get_spectrogram', 'add_channel_dim']
# Cell
d... | 2.4375 | 2 |
Lib/objc/_SplitKit.py | kanishpatel/Pyto | 0 | 22937 | '''
Classes from the 'SplitKit' framework.
'''
try:
from rubicon.objc import ObjCClass
except ValueError:
def ObjCClass(name):
return None
def _Class(name):
try:
return ObjCClass(name)
except NameError:
return None
PodsDummy_SplitKit = _Class('PodsDummy_SplitKit')
Instan... | 2.203125 | 2 |
wiki_music/gui_lib/search_and_replace.py | marian-code/wikipedia-music-tags | 5 | 22938 | """Module controling search and replace tab."""
import logging
from wiki_music.constants import GUI_HEADERS
from wiki_music.gui_lib import BaseGui, CheckableListModel
from wiki_music.gui_lib.qt_importer import QMessageBox, QPushButton, QIcon, QStyle
__all__ = ["Replacer"]
log = logging.getLogger(__name__)
log.debug(... | 2.515625 | 3 |
Dashboard with Django/updates/forms.py | reddyprasade/Data-Analysis-with-Python- | 1 | 22939 | from django.forms import ModelForm
from updates.models import Post
class Postform(ModelForm):
class Meta:
model = Post
fields = ['title','body','date']
| 1.96875 | 2 |
main.py | neuroidss/eeglstm | 21 | 22940 | #%% [markdown]
#
# We will load EEG data from the lab and attemp to build a classifier that distinguishes between learners and non-learners
#%%
import mne
import numpy as np
import os.path
import glob
import re
import pandas as pd
# try to enable cuda support to speed up filtering, make sure the MNE_USE_C... | 2.359375 | 2 |
ex066.py | dsjocimar/python | 0 | 22941 | <gh_stars>0
# Exercício 066
soma = total = 0
while True:
n = int(input('Digite um valor [999 para parar]: '))
if n == 999:
break
soma += n
total += 1
print(f'O total de números digitados foi {total} e a soma deles vale {soma}') | 3.5 | 4 |
test/test_api_data_utils.py | onap/optf-osdf | 3 | 22942 | <filename>test/test_api_data_utils.py
import json
import os
from osdf.utils import api_data_utils
from collections import defaultdict
BASE_DIR = os.path.dirname(__file__)
with open(os.path.join(BASE_DIR, "placement-tests/request.json")) as json_data:
req_json = json.load(json_data)
class TestVersioninfo():
#
# ... | 2.1875 | 2 |
Model_SIR/no.py | AP-2020-1S/covid-19-guaya-kilera | 0 | 22943 | import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from scipy import integrate, optimize
from scipy.signal import savgol_filter
from dane import population as popu
dias_restar = 4 # Los últimos días de información que no se tienen en cuenta
dias_pred = 31 # Días sobre los cuáles se hará la predic... | 2.65625 | 3 |
backend/cw_backend/views/admin_courses.py | veronikks/pyladies-courseware | 0 | 22944 | <gh_stars>0
import aiohttp
from aiohttp import web
from aiohttp_session import get_session
import asyncio
import logging
from pathlib import Path
logger = logging.getLogger(__name__)
routes = web.RouteTableDef()
@routes.get('/api/admin/course/{course_id}/reload_course')
async def reload_course(req):
session = ... | 2.234375 | 2 |
duplicate_csv.py | AronFreyr/de1-project | 0 | 22945 | #!/usr/bin/env python
# coding: utf-8
# In[7]:
import os
write_to_csv_file = 'million_song_subset.csv'
csv_file_read = open(write_to_csv_file,'r')
csv_file_write = open(write_to_csv_file,'a')
while True:
next_line = csv_file_read.readline()
if not next_line:
break
csv_file_size = os.pat... | 3.03125 | 3 |
src/main/python/graphing-scripts/utils.py | DistributedSystemsGroup/cluster-scheduler-simulator | 2 | 22946 | # Copyright (c) 2013, Regents of the University of California
# All rights reserved.
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# Redistributions of source code must retain the above copyright notice, this
# list o... | 1.757813 | 2 |
ror/CopelandVoter.py | jakub-tomczak/ror | 0 | 22947 | <reponame>jakub-tomczak/ror<filename>ror/CopelandVoter.py
from typing import List, Tuple
import numpy as np
import pandas as pd
import os
import logging
class CopelandVoter():
def __init__(self) -> None:
self.__voting_matrix: np.ndarray = None
self.__voting_sum: List[Tuple[str, float]] = []
@p... | 2.375 | 2 |
app/auth/forms/__init__.py | jg-725/IS219-FlaskAppProject | 0 | 22948 | from flask_wtf import FlaskForm
from wtforms import validators
from wtforms.fields import *
class login_form(FlaskForm):
email = EmailField('Email Address', [
validators.DataRequired(),
])
password = PasswordField('Password', [
validators.DataRequired(),
validators.length(min=6, m... | 3.28125 | 3 |
tern/analyze/default/dockerfile/lock.py | mzachar/tern | 2 | 22949 | <reponame>mzachar/tern
# -*- coding: utf-8 -*-
#
# Copyright (c) 2017-2020 VMware, Inc. All Rights Reserved.
# SPDX-License-Identifier: BSD-2-Clause
"""
Docker specific functions - used when trying to retrieve packages when
given a Dockerfile
"""
import logging
import os
import re
import sys
from tern.classes.docker_... | 2.65625 | 3 |
utils/firebase.py | YangWanjun/sales-encrypt | 0 | 22950 | import os
import firebase_admin
from firebase_admin import credentials, messaging
from django.conf import settings
from utils import common, constants
logger = common.get_system_logger()
cred = credentials.Certificate(os.path.join(
settings.BASE_DIR,
'data',
'sales-yang-firebase-adminsdk-2ga7e-17745491... | 1.953125 | 2 |
tests/settings.py | matrixorz/firefly | 247 | 22951 | <reponame>matrixorz/firefly
# coding=utf-8
DEBUG = True
TESTING = True
SECRET_KEY = 'secret_key for test'
# mongodb
MONGODB_SETTINGS = {
'db': 'firefly_test',
'username': '',
'password': '',
'host': '127.0.0.1',
'port': 27017
}
# redis cache
CACHE_TYPE = 'redis'
CACHE_REDIS_HOST = '127.0.0.1'
CAC... | 1.570313 | 2 |
pyhack/boris_stag.py | Krissmedt/runko | 0 | 22952 | import numpy as np
from pyhack.py_runko_aux import *
from pyhack.boris import *
def boris_staggered(tile,dtf=1):
c = tile.cfl
cont = tile.get_container(0)
pos = py_pos(cont)
vel = py_vel(cont)
E,B = py_em(cont)
nq = pos.shape[0]
dims = pos.shape[1]
vel = boris_rp(vel,E,B,c,cont.q,dtf... | 2.015625 | 2 |
mbed_connector_api/tests/mock_data.py | ARMmbed/mbed-connector-python | 2 | 22953 | # Copyright 2014-2015 ARM Limited
#
# Licensed under the Apache License, Version 2.0
# See LICENSE file for details.
class mockData:
"""dictionary of mocking data for the mocking tests"""
# dictionary to hold the mock data
_data={}
# function to add mock data to the _mock_data dictionary
def _add(se... | 2.34375 | 2 |
examples/demo/eager_demo/src/demo_1_pybullet.py | eager-dev/eager | 16 | 22954 | <filename>examples/demo/eager_demo/src/demo_1_pybullet.py<gh_stars>10-100
#!/usr/bin/env python3
import rospy
# Import eager packages
from eager_core.utils.file_utils import launch_roscore, load_yaml
from eager_core.eager_env import EagerEnv
from eager_core.objects import Object
from eager_core.wrappers.flatten impor... | 2.25 | 2 |
kerastuner/engine/tuner_utils.py | DL-2020-Shakespeare/keras-tuner | 1 | 22955 | # Copyright 2019 The Keras Tuner Authors
#
# 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 agreed to... | 2.1875 | 2 |
explorer/explorer.py | holarchy/Holon | 0 | 22956 | from flask import Flask, render_template, flash, abort, redirect, url_for, request
import os
import common
import json
import numbers
import urllib.parse
import pandas as pd
from datetime import datetime
from math import log10, floor
base_dir = '/home/nick/Data/_ensembles'
app = Flask(__name__)
app.config['ENV'] = 'de... | 2.140625 | 2 |
models/grammateus.py | monotasker/Online-Critical-Pseudepigrapha | 1 | 22957 | <reponame>monotasker/Online-Critical-Pseudepigrapha
#! /usr/bin/python2.7
# -*- coding: utf8 -*-
import datetime
# from plugin_ajaxselect import AjaxSelect
if 0:
from gluon import db, Field, auth, IS_EMPTY_OR, IS_IN_DB, current, URL
response = current.response
response.files.insert(5, URL('static',
... | 1.78125 | 2 |
interface.py | Kryptagora/pysum | 3 | 22958 | import tkinter as tk
from tkinter import filedialog
from urllib.request import urlopen
from pathlib import Path
from tkinter import ttk
import numpy as np
import base64
import io
import re
from src.theme import theme
from src.algorithm import blosum
from src.utils import RichText
def qopen(path:str):
'''Opens and... | 2.546875 | 3 |
view/python_core/movies/colorizer/aux_funcs.py | galizia-lab/pyview | 2 | 22959 | import numpy as np
import re
def apply_colormaps_based_on_mask(mask, data_for_inside_mask, data_for_outside_mask,
colormap_inside_mask, colormap_outside_mask):
"""
Returns the combination of applying two colormaps to two datasets on two mutually exclusive sets of pixels
a... | 3.125 | 3 |
bigml/tests/create_cluster_steps.py | javinp/python | 1 | 22960 | <reponame>javinp/python
# -*- coding: utf-8 -*-
#!/usr/bin/env python
#
# Copyright 2012-2015 BigML
#
# 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/LICE... | 2.3125 | 2 |
tests/ptp_clock_sim_time/test_ptp_clock_sim_time.py | psumesh/cocotbext-eth | 15 | 22961 | <filename>tests/ptp_clock_sim_time/test_ptp_clock_sim_time.py
#!/usr/bin/env python
"""
Copyright (c) 2021 <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 wi... | 2.0625 | 2 |
dex/section/section.py | callmejacob/dexfactory | 7 | 22962 | # -- coding: utf-8 --
from section_base import *
from section_map_item import *
from section_header import *
from section_string_id import *
from section_type_id import *
from section_proto_id import *
from section_field_id import *
from section_method_id import *
from section_class_def import *
from section_type_list... | 1.476563 | 1 |
Code coach problems/Easy/Python/Skee-Ball.py | Djivs/sololearn-code-solutions | 1 | 22963 | <reponame>Djivs/sololearn-code-solutions
a = int(input())
b = int(input())
if a >=b*12:
print("Buy it!")
else:
print("Try again")
| 3.359375 | 3 |
gsb/rest/__init__.py | pfrancois/grisbi_django | 0 | 22964 | # coding=utf-8
# init
| 1.09375 | 1 |
chris_turtlebot_dashboard/src/chris_turtlebot_dashboard/dashboard.py | xabigarde/chris_ros_turtlebot | 0 | 22965 | import roslib;roslib.load_manifest('kobuki_dashboard')
import rospy
import diagnostic_msgs
from rqt_robot_dashboard.dashboard import Dashboard
from rqt_robot_dashboard.widgets import ConsoleDashWidget, MenuDashWidget, IconToolButton
from python_qt_binding.QtWidgets import QMessageBox, QAction
from python_qt_binding.Q... | 2.109375 | 2 |
msgpack_lz4block/__init__.py | AlsidOfficial/python-msgpack-lz4block | 1 | 22966 | <reponame>AlsidOfficial/python-msgpack-lz4block<filename>msgpack_lz4block/__init__.py
import msgpack
import lz4.block
from msgpack.ext import Timestamp, ExtType
import re
def __map_obj(obj, key_map):
if not isinstance(key_map, list):
raise Exception('The key_map should be a list')
elif len(obj) != len... | 2.109375 | 2 |
scilpy/version.py | fullbat/scilpy | 0 | 22967 | from __future__ import absolute_import, division, print_function
import glob
# Format expected by setup.py and doc/source/conf.py: string of form "X.Y.Z"
_version_major = 0
_version_minor = 1
_version_micro = '' # use '' for first of series, number for 1 and above
_version_extra = 'dev'
# _version_extra = '' # Uncom... | 1.242188 | 1 |
fireflies.py | dvsd/Firefly-Synchronization | 1 | 22968 | <reponame>dvsd/Firefly-Synchronization<filename>fireflies.py<gh_stars>1-10
from graphics import *
import math
import random
windowWidth = 400
windowHeight = 400
fireflyRadius = 3
win = GraphWin("Fireflies",windowWidth,windowHeight,autoflush=False)
win.setBackground('black')
closeWindow = False
fireflies = []
flashedF... | 3.078125 | 3 |
gb/tests/test_gibbs_sampler.py | myozka/granger-busca | 5 | 22969 | # -*- coding: utf8
from gb.randomkit.random import RNG
from gb.samplers import BaseSampler
from gb.samplers import CollapsedGibbsSampler
from gb.stamps import Timestamps
from gb.sloppy import SloppyCounter
from numpy.testing import assert_equal
import numpy as np
def test_get_probability():
d = {}
d[0] = ... | 1.9375 | 2 |
python/tHome/sma/Link.py | ZigmundRat/T-Home | 18 | 22970 | <gh_stars>10-100
#===========================================================================
#
# Primary SMA API.
#
#===========================================================================
import socket
from .. import util
from . import Auth
from . import Reply
from . import Request
#============================... | 2.4375 | 2 |
src/tinerator/visualize/qt_app.py | lanl/tinerator | 2 | 22971 | <reponame>lanl/tinerator<filename>src/tinerator/visualize/qt_app.py
import sys
from PyQt5 import QtWidgets
from PyQt5.QtWidgets import QApplication
from PyQt5.QtWidgets import QMainWindow
from PyQt5.QtCore import QCoreApplication, QUrl
from PyQt5.QtWebEngineWidgets import QWebEngineView
from PyQt5.QtWebEngineWidgets im... | 2.390625 | 2 |
openstack/tests/unit/clustering/v1/test_receiver.py | anton-sidelnikov/openstacksdk | 0 | 22972 | <reponame>anton-sidelnikov/openstacksdk
# 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... | 1.726563 | 2 |
gan/kdd_utilities.py | mesarcik/Efficient-GAN-Anomaly-Detection | 408 | 22973 | import tensorflow as tf
"""Class for KDD10 percent GAN architecture.
Generator and discriminator.
"""
learning_rate = 0.00001
batch_size = 50
layer = 1
latent_dim = 32
dis_inter_layer_dim = 128
init_kernel = tf.contrib.layers.xavier_initializer()
def generator(z_inp, is_training=False, getter=None, reuse=False):
... | 2.828125 | 3 |
setup.py | jhakonen/wotdisttools | 9 | 22974 | #!/usr/bin/env python
from setuptools import setup, find_packages
setup(
name='setuptools-wotmod',
version='0.2',
packages=find_packages(),
description='setuptools integration for creating World of Tanks mods',
long_description=open('README.md').read(),
author='jhakonen',
url='https://gith... | 1.265625 | 1 |
services/prepare_snps_data.py | eliorav/Population-Genotype-Frequency | 0 | 22975 | <reponame>eliorav/Population-Genotype-Frequency
import os
from glob import glob
import pandas as pd
from tqdm import tqdm
from constants import SNPS_DATA_PATH, SNPS_DATA_FOLDER, SNPS_DATA_FILE_NAME
from services.docker_runner import Hg38dbDockerRunner
def fetch_snps_data(snps_file_path):
"""
Fetch SNPs data f... | 2.515625 | 3 |
lab1/lab1/views/home.py | ZerocksX/Service-Oriented-Computing-2019 | 0 | 22976 | from django.http import HttpResponse
from django.shortcuts import render, redirect
from lab1.views import login
def docs(request):
if not request.user.is_authenticated:
return redirect(login.login_view)
return render(request, 'docs.html')
| 1.796875 | 2 |
ssdp/socketserver.py | vintozver/ssdp | 0 | 22977 | <filename>ssdp/socketserver.py<gh_stars>0
import logging
import socket
import socketserver
import struct
import typing
from ssdp.entity import *
from ssdp.network import *
logger = logging.getLogger("ssdp.socketserver")
class RequestHandler(socketserver.BaseRequestHandler):
def handle(self):
packet_byte... | 2.46875 | 2 |
giggleliu/tba/hgen/multithreading.py | Lynn-015/Test_01 | 2 | 22978 | #!/usr/bin/python
from numpy import *
from mpi4py import MPI
from matplotlib.pyplot import *
#MPI setting
try:
COMM=MPI.COMM_WORLD
SIZE=COMM.Get_size()
RANK=COMM.Get_rank()
except:
COMM=None
SIZE=1
RANK=0
__all__=['mpido']
def mpido(func,inputlist,bcastouputmesh=True):
'''
MPI for list... | 2.515625 | 3 |
manage.py | forestmonster/flask-microservices-users | 0 | 22979 | import unittest
import coverage
from flask_script import Manager
from project import create_app, db
from project.api.models import User
COV = coverage.coverage(
branch=True,
include='project/*',
omit=[
'project/tests/*',
'project/server/config.py',
'project/server/*/__init__.py'
... | 2.71875 | 3 |
cocotb/_py_compat.py | lavanyajagan/cocotb | 350 | 22980 | # Copyright (c) cocotb contributors
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions a... | 1.164063 | 1 |
tomopal/crtomopy/demo/pjt_demo.py | robinthibaut/TomoPal | 2 | 22981 | <gh_stars>1-10
# Copyright (c) 2020. <NAME>, Ghent University
from os.path import join as jp
import numpy as np
from tomopal.crtomopy.crtomo.crc import (
Crtomo,
datread,
import_res,
mesh_geometry,
mtophase,
)
from ..parent import inventory
from ...geoview.diavatly import model_map # To plot re... | 2.484375 | 2 |
__init__.py | VASemenov/Genetica | 0 | 22982 | from genetica.dna import DNA, genify
from genetica.model import Genetica | 1.054688 | 1 |
client_code/utils/__init__.py | daviesian/anvil-extras | 0 | 22983 | # SPDX-License-Identifier: MIT
#
# Copyright (c) 2021 The Anvil Extras project team members listed at
# https://github.com/anvilistas/anvil-extras/graphs/contributors
#
# This software is published at https://github.com/anvilistas/anvil-extras
from functools import cache
__version__ = "1.4.0"
def __dir__():
ret... | 1.867188 | 2 |
evaluate/evaluate_debug.py | goodgodgd/vode-2020 | 4 | 22984 | <filename>evaluate/evaluate_debug.py
import os
import os.path as op
import numpy as np
import pandas as pd
import cv2
import tensorflow as tf
import settings
from config import opts
from tfrecords.tfrecord_reader import TfrecordReader
import utils.util_funcs as uf
import utils.convert_pose as cp
from model.synthesize.... | 2.203125 | 2 |
tests/test_utils.py | h4ck3rm1k3/requests | 0 | 22985 | <filename>tests/test_utils.py<gh_stars>0
# coding: utf-8
import os
from io import BytesIO
import pytest
from requests import compat
from requests.utils import (
address_in_network, dotted_netmask,
get_auth_from_url, get_encodings_from_content,
get_environ_proxies, guess_filename,
is_ipv4_address, is_va... | 2.234375 | 2 |
clorm/orm/factbase.py | florianfischer91/clorm | 10 | 22986 | # -----------------------------------------------------------------------------
# Clorm ORM FactBase implementation. FactBase provides a set-like container
# specifically for storing facts (Predicate instances).
# ------------------------------------------------------------------------------
import abc
import io
impor... | 2.1875 | 2 |
blender/2.79/scripts/addons/modules/extensions_framework/__init__.py | uzairakbar/bpy2.79 | 2 | 22987 | # -*- coding: utf-8 -*-
#
# ***** BEGIN GPL LICENSE BLOCK *****
#
# --------------------------------------------------------------------------
# Blender 2.5 Extensions Framework
# --------------------------------------------------------------------------
#
# Authors:
# <NAME>
#
# This program is free software; you can ... | 1.953125 | 2 |
tests/test_common.py | NOAA-GSL/adb_graphics | 2 | 22988 | # pylint: disable=invalid-name
'''
Pytests for the common utilities included in this package. Includes:
- conversions.py
- specs.py
- utils.py
To run the tests, type the following in the top level repo directory:
python -m pytest --nat-file [path/to/gribfile] --prs-file [path/to/gribfile]
'''
from... | 2.40625 | 2 |
ggpy/cruft/grammar.py | hobson/ggpy | 1 | 22989 | <filename>ggpy/cruft/grammar.py<gh_stars>1-10
#!/usr/bin/env python
# package: org.ggp.base.util.symbol.grammar
import threading
class SymbolFormatException(Exception):
source = ''
def __init__(self, message, source):
super(SymbolFormatException, self).__init__(message)
self.source = source
... | 2.375 | 2 |
cortical/models/context.py | npd15393/ResumeMiner | 0 | 22990 | <filename>cortical/models/context.py
#!/usr/bin/env python
"""
/*******************************************************************************
* Copyright (c) cortical.io GmbH. All rights reserved.
*
* This software is confidential and proprietary information.
* You shall use it only in accordance with the terms... | 2.21875 | 2 |
COMP-2080/Week-11/knapRecursive.py | kbrezinski/Candidacy-Prep | 0 | 22991 |
# [weight, value]
I = [[4, 8], [4, 7], [6, 14]]
k = 8
def knapRecursive(I, k):
return knapRecursiveAux(I, k, len(I) - 1)
def knapRecursiveAux(I, k, hi):
# final element
if hi == 0:
# too big for sack
if I[hi][0] > k:
return 0
# fits
else:
retur... | 3.171875 | 3 |
digits/inference/__init__.py | PhysicsTeacher13/Digits-NVIDIA | 111 | 22992 | <filename>digits/inference/__init__.py
# Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved.
from __future__ import absolute_import
from .images import ImageInferenceJob
from .job import InferenceJob
__all__ = [
'InferenceJob',
'ImageInferenceJob',
]
| 1.265625 | 1 |
homework/homework 21.py | CoderLoveMath/Jeju-IOSEFTGS-python | 0 | 22993 | <reponame>CoderLoveMath/Jeju-IOSEFTGS-python
# Import a library of functions called 'pygame'
import pygame
# Initialize the game engine
pygame.init()
# Define the colors we will use in RGB format
BLACK = (0, 0, 0)
WHITE = (255, 255, 255)
BLUE = (0, 0, 255)
GREEN = (0, 255, 0)
RED = (255, 0, 0)
# Set the height and w... | 3.96875 | 4 |
pyte/ops/for_.py | Fuyukai/Pyte | 2 | 22994 | from pyte import tokens, util
from pyte.superclasses import _PyteAugmentedValidator, _PyteOp
from pyte.util import PY36
class FOR_LOOP(_PyteOp):
"""
Represents a for loop.
"""
def __init__(self, iterator: _PyteAugmentedValidator, body: list):
"""
Represents a for operator.
:p... | 2.609375 | 3 |
web/hottubapi.py | pwschuurman/hottub_controller | 1 | 22995 | <filename>web/hottubapi.py
from gpioapi import GpioAPI
import rx
MAX_TEMP = 38
COOL_TEMP = 30
class HotTubAPI:
def __init__(self):
self.gpioapi = GpioAPI(None)
def transmissions(self):
return self.gpioapi.transmission_subject
def heat_up(self):
reached_max_temp = self.gpioapi.transmission_subject... | 2.828125 | 3 |
src/biocluster_pipeline.py | zocean/Norma | 1 | 22996 | <reponame>zocean/Norma
#!/usr/bin/python
# Programmer : <NAME>
# Contact: <EMAIL>
# Last-modified: 24 Jan 2019 15:20:08
import os,sys,argparse
def parse_arg():
''' This Function Parse the Argument '''
p=argparse.ArgumentParser( description = 'Example: %(prog)s -h', epilog='Library dependency :')
p.add_ar... | 2.65625 | 3 |
env/lib/python3.5/site-packages/cartopy/tests/test_shapereader.py | project-pantheon/pantheon_glob_planner | 0 | 22997 | <reponame>project-pantheon/pantheon_glob_planner
# (C) British Crown Copyright 2011 - 2018, Met Office
#
# This file is part of cartopy.
#
# cartopy is free software: you can redistribute it and/or modify it under
# the terms of the GNU Lesser General Public License as published by the
# Free Software Foundation, eithe... | 2.453125 | 2 |
inmembrane/plugins/__init__.py | pansapiens/inmembrane | 4 | 22998 | # This little bit of magic fills the __all__ list
# with every plugin name, and means that calling:
# from plugins import *
# within inmembrane.py will import every plugin
import pkgutil
__all__ = []
for p in pkgutil.iter_modules(__path__):
__all__.append(p[1])
| 1.601563 | 2 |
dvc/output/__init__.py | amjadsaadeh/dvc | 0 | 22999 | <reponame>amjadsaadeh/dvc
import schema
from dvc.exceptions import DvcException
from dvc.config import Config
from dvc.dependency import SCHEMA, urlparse
from dvc.dependency.base import DependencyBase
from dvc.output.s3 import OutputS3
from dvc.output.gs import OutputGS
from dvc.output.local import OutputLOCAL
from d... | 1.859375 | 2 |