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 |
|---|---|---|---|---|---|---|
practicepython/ex3/ex3_list_less_than_10.py | drofp/pypractice | 0 | 12791251 | #!usr/bin/env python3
"""Example 3 from https://www.practicepython.org/exercise/2014/02/15/03-list-less-than-ten.html
==========================
GIVEN: A list of numbers
- Ask user for a number.
- In one line, print a new list that contains all elements from the original list that are less than
the input number
"""... | 4.46875 | 4 |
abupy/TLineBu/ABuTLGolden.py | luqin/firefly | 1 | 12791252 | <reponame>luqin/firefly
# -*- encoding:utf-8 -*-
"""
黄金分割及比例分割示例模块
"""
from __future__ import print_function
from __future__ import absolute_import
from __future__ import division
from collections import namedtuple
import matplotlib.pyplot as plt
from ..TLineBu import ABuTLExecute
from ..UtilBu.ABuDTUtil import... | 2.34375 | 2 |
model_command.py | danielcorreaeng/jarvis | 0 | 12791253 | import time
import json
import sys,os
import subprocess
import argparse
import unittest
VALUES_INPUT = {}
VALUES_OUTPUT = {}
class TestCases(unittest.TestCase):
def test_case_000(self):
self.assertEqual('foo'.upper(), 'FOO')
def test_case_001(self):
self.assertEqual('fo... | 2.5625 | 3 |
get_whitelist.py | alexliyu/fdslight | 0 | 12791254 | #!/usr/bin/env python3
"""从apnic获取中国IP范围"""
import urllib.request, os
URL = "http://ftp.apnic.net/apnic/stats/apnic/delegated-apnic-latest"
TMP_PATH = "./whitelist.tmp"
# 生成的最终白名单
RESULT_FILE_PATH = "./fdslight_etc/whitelist.txt"
def get_remote_file():
tmpfile = open(TMP_PATH, "wb")
response = urllib.reques... | 2.8125 | 3 |
Data Structures/IMP-BST.py | itsrohanvj/Data-Structures-Algorithms-in-Python | 1 | 12791255 | # Returns true if a binary tree is a binary search tree
def IsBST3(root):
if root == None:
return 1
# false if the max of the left is > than root
if (root.getLeft() != None and FindMax(root.getLeft()) > root.get_data())
return 0
# false if the min of the right is <= than root
if (r... | 3.890625 | 4 |
Chapter 2/computational_graph.py | shantam21/Deep-Learning-with-TensorFlow-2-and-Keras | 267 | 12791256 | <reponame>shantam21/Deep-Learning-with-TensorFlow-2-and-Keras<gh_stars>100-1000
import tensorflow.compat.v1 as tf
tf.disable_v2_behavior()
in_a = tf.placeholder(dtype=tf.float32, shape=(2))
def model(x):
with tf.variable_scope("matmul"):
W = tf.get_variable("W", initializer=tf.ones(shape=(2,2)))
b = tf.get_... | 3.046875 | 3 |
tests/data_interface/test_tess_transit_disposition_metadata_manager.py | golmschenk/ramjet | 3 | 12791257 | import pandas as pd
from unittest.mock import patch, Mock, PropertyMock
import ramjet.data_interface.tess_transit_metadata_manager as module
from ramjet.data_interface.tess_transit_metadata_manager import TessTransitMetadataManager, Disposition
from ramjet.data_interface.tess_toi_data_interface import ToiColumns
cla... | 2.109375 | 2 |
slurmJob.py | wckdouglas/hack_slurm | 0 | 12791258 | #!/usr/bin/env python
from __future__ import print_function
from builtins import str, bytes
import fileinput
import argparse
import os
import sys
import subprocess
python_path = subprocess.check_output(['which' ,'python']).decode('utf-8')
system_path = os.path.dirname(python_path)
def writeJob(commandlist, jobname, ... | 2.203125 | 2 |
koans/about_lists.py | uottawapython/UOPy-koans-day-1 | 0 | 12791259 | <gh_stars>0
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Based on AboutArrays in the Ruby Koans
#
from runner.koan import *
class AboutLists(Koan):
def test_accessing_list_elements(self):
noms = ['peanut', 'butter', 'and', 'jelly']
self.assertEqual(__, noms[0])
self.assertEqual(__,... | 3.703125 | 4 |
user/models.py | Hy-Oy/Swipter | 0 | 12791260 | import datetime
from django.db import models
from libs.orm import ModelToDicMiXin
SEXS = (
(0, '未知'),
(1, '男'),
(2, '女'),
)
LOCATIONS = (
('bj', '北京'),
('sh', '上海'),
('hz', '杭州'),
('sz', '深圳'),
('cd', '成都'),
('gz', '广州'),
)
class User(models.Model):
"""
... | 2.390625 | 2 |
ion-channel-models/mcmc.py | sanmitraghosh/fickleheart-method-tutorials | 0 | 12791261 | #!/usr/bin/env python3
from __future__ import print_function
import sys
sys.path.append('./method')
import os
import numpy as np
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
import pints
import pints.io
import pints.plot
import model as m
import parametertransform
import priors
"""
Run fit.... | 2.296875 | 2 |
myriad/game/shell/grammar.py | oubiwann/myriad-worlds | 3 | 12791262 | <filename>myriad/game/shell/grammar.py
import random
from pyparsing import alphas, empty, oneOf, replaceWith
from pyparsing import CaselessLiteral, OneOrMore, Optional, ParseException
from pyparsing import CaselessKeyword, LineEnd, MatchFirst, Word
from myriad.game.shell import command
from myriad.item import Item
... | 2.5625 | 3 |
src/bets/model/stats/ratio_stats.py | nachereshata/bets-cli | 0 | 12791263 | from bets.model.stats.constants import RANKS, OUTCOMES
from bets.model.stats.abstract_stats import AbstractStats
class RatioStats(AbstractStats):
KEYS = ["date", "country", "tournament", "host_team", "guest_team",
"ratio_1", "ratio_X", "ratio_2",
"rank_1", "rank_X", "rank_2",
"... | 2.53125 | 3 |
run.py | zding5/Microblog-Flask | 0 | 12791264 | #!flask/bin/python
# This file is for starting up the server!
from app import myapp
myapp.run(debug=True) | 1.75 | 2 |
nlpsc/test/test_vboard.py | BSlience/nlpsc | 4 | 12791265 | # encoding:utf-8
from nlpsc.dataset import Dataset
from nlpsc.vboard.dataset import DatasetVBoard
class TestVBoard(object):
def test_dataset_vboard(self):
# from nlpsc.vboard.dataset import index
from ..vboard import bottle
bottle.TEMPLATE_PATH.append('../vboard/views/')
dataset... | 2.09375 | 2 |
Week of Code 35/Triple Recursion-Week Of Code-35 2.py | anirudhkannanvp/HACKERRANK | 3 | 12791266 | <filename>Week of Code 35/Triple Recursion-Week Of Code-35 2.py
n,m,k=map(int,input().split())
a=[[0]*n for i in range(n)]
for i in range(n):
for j in range(n):
if(i==0 and j==0):
a[i][j]=m
elif(i==j):
a[i][j]=a[i-1][j-1]+k
elif(i>j):
a[i][j]=a[i-... | 3.140625 | 3 |
markwiki/authn/__init__.py | cabalamat/markwiki | 1 | 12791267 | <filename>markwiki/authn/__init__.py
# Copyright (c) 2016, <NAME>
'''A package to support MarkWiki authentication'''
| 1.117188 | 1 |
kitti_example.py | JarnoRalli/python_camera_library | 1 | 12791268 | <gh_stars>1-10
__author__ = "<NAME>"
__copyright__ = "Copyright, 2021, <NAME>"
__license__ = "3-Clause BSD License"
__maintainer__ = "<NAME>"
__email__ = "<EMAIL>"
__status__ = "Development"
#THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
#INCLUDING,... | 2.03125 | 2 |
docqa/triviaqa/build_complete_vocab.py | Willyoung2017/doc-qa | 422 | 12791269 | import argparse
from os.path import exists
from docqa.triviaqa.build_span_corpus import TriviaQaOpenDataset
from docqa.triviaqa.evidence_corpus import get_evidence_voc
"""
Build vocab of all words in the triviaqa dataset, including
all documents and all train questions.
"""
def main():
parser = argparse.Argume... | 3.125 | 3 |
launchkey/entities/validation.py | bgroveben/launchkey-python | 1 | 12791270 | from formencode import Schema, validators, FancyValidator, Invalid, ForEach
from dateutil.parser import parse
class ValidateISODate(FancyValidator):
@staticmethod
def _to_python(value, state):
try:
val = parse(value)
except ValueError:
raise Invalid("Date/time format i... | 2.421875 | 2 |
www.py | KirtoXX/segment | 5 | 12791271 | import tensorflow as tf
import numpy as np
input = tf.placeholder(dtype=tf.float32,shape=[5,5,3])
filter = tf.constant(value=1, shape=[3,3,3,5], dtype=tf.float32)
conv0 = tf.nn.atrous_conv2d(input,filters=filter,rate=2,padding='VALID')
with tf.Session() as sess:
img = np.array([3,5,5,3])
out = sess.run(conv0,... | 2.984375 | 3 |
snake_main.py | jprevc/SnakeGame | 0 | 12791272 | import sys
import pygame
import random
from snake_utility import Snake, Cherry, SnakeGameStatusFlags
import json
def set_new_cherry_pos(snake_lst):
"""
Sets new cherry position.
:param snake_lst: List, containing all snake instances present in the game. This is needed
to check that c... | 3.578125 | 4 |
replace_text/__init__.py | jakeogh/replace-text | 1 | 12791273 | #from .replace_text import replace_text
from .replace_text import append_unique_bytes_to_file
from .replace_text import remove_comments_from_bytes
from .replace_text import replace_text_in_file
| 1.3125 | 1 |
src/calculations_plot_obs.py | danOSU/emulator-validation | 4 | 12791274 | #!/usr/bin/env python3
import numpy as np
import matplotlib
#matplotlib.use('Agg')
import matplotlib.pyplot as plt
import sys, os, glob
import re
# Output data format
from configurations import *
design_pt_to_plot=2
#################################################################################
#### Try to figure... | 2.4375 | 2 |
testdata/PyFEM-master/install.py | Konstantin8105/py4go | 3 | 12791275 | <reponame>Konstantin8105/py4go
############################################################################
# This Python file is part of PyFEM, the code that accompanies the book: #
# #
# 'Non-Linear Finite Element Analysis of Solids and ... | 1.765625 | 2 |
hahomematic/parameter_visibility.py | SukramJ/hahomematic | 0 | 12791276 | """ Module about parameter visibility within hahomematic """
from __future__ import annotations
import logging
import os
from typing import Final
import hahomematic.central_unit as hm_central
from hahomematic.const import (
DEFAULT_ENCODING,
EVENT_CONFIG_PENDING,
EVENT_ERROR,
EVENT_STICKY_UN_REACH,
... | 2.0625 | 2 |
lazy/api/client.py | trisongz/lazycls | 2 | 12791277 | <reponame>trisongz/lazycls
from __future__ import annotations
from lazy.types import *
from lazy.models import BaseCls
from .config import *
from .types import *
from .utils import convert_to_cls
from .base_imports import _httpx_available, _ensure_api_reqs
if _httpx_available:
from httpx import Client as _Client... | 2.234375 | 2 |
faculty_sync/screens/loading.py | Matt-Haugh/faculty-sync | 6 | 12791278 | <gh_stars>1-10
SEQUENCE = ["|", "/", "-", "\\", "|", "/", "-", "\\"]
class LoadingIndicator(object):
def __init__(self):
self._index = 0
def current(self):
return SEQUENCE[self._index]
def next(self):
self._index = (self._index + 1) % len(SEQUENCE)
return self.current()
| 3.09375 | 3 |
CTF/new_file.py | mark0519/CTFplatform | 9 | 12791279 | <filename>CTF/new_file.py
# -*- coding: utf-8 -*-=
import os
from werkzeug.utils import secure_filename
from CTF import db,new,login
from CTF.models import que,user
import uuid
def random_filename(filename): #上传文件重命名
ext = os.path.splitext(filename)[1]
print(type(ext))
print(ext)
if ext... | 2.328125 | 2 |
train_frcnn_v2.py | vadisala123/tf-fasterrcnn | 0 | 12791280 | from __future__ import division
import random
import pprint
import sys
import time
import numpy as np
from optparse import OptionParser
import pickle
import os
import re
import shutil
import tensorflow as tf
from tensorflow.keras import backend as K
from tensorflow.keras.optimizers import Adam, SGD
from tensorflow.ker... | 2.078125 | 2 |
tests/conftest.py | primal100/stripe-subscriptions | 0 | 12791281 | <reponame>primal100/stripe-subscriptions
import os
import sys
import pytest
import stripe
from stripe.error import InvalidRequestError
from datetime import datetime, timedelta
import subscriptions
from subscriptions import UserProtocol, User
from typing import Optional, Any, List, Dict
api_key = ''
python_version =... | 2.078125 | 2 |
main.py | xfgryujk/blivetts | 8 | 12791282 | <gh_stars>1-10
# -*- coding: utf-8 -*-
import asyncio
import pyttsx3
import translate
import blivedm.blivedm as blivedm
class BLiveTts(blivedm.BLiveClient):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
# 翻译
self._translator = translate.Translator(from_lang='zh'... | 2.375 | 2 |
checker.py | Stefania12/Router | 0 | 12791283 | <reponame>Stefania12/Router<gh_stars>0
#!/usr/bin/env python3
import argparse
import os
import shutil
import sys
import traceback
from scapy.sendrecv import sendp, sniff
import info
import tests
def capture(interface, output_file="test"):
cap = sniff(iface=interface, timeout=info.TIMEOUT)
# FIXME
packe... | 2.515625 | 3 |
commands/dataFileComplete/entry.py | tapnair/ImportAndShare | 0 | 12791284 | <reponame>tapnair/ImportAndShare
import csv
import json
import time
import adsk.core
from ... import config
from ...lib import fusion360utils as futil
app = adsk.core.Application.get()
ui = app.userInterface
NAME1 = 'Data_Handler'
NAME2 = "Custom Import Event"
NAME3 = "Custom Save Event"
NAME4 = "Custom Close Event... | 1.84375 | 2 |
src/data/utils.py | HemuManju/integrated-gradients-weighted-ica | 0 | 12791285 | <reponame>HemuManju/integrated-gradients-weighted-ica
import collections
from pathlib import Path
import deepdish as dd
import pandas as pd
def nested_dict():
return collections.defaultdict(nested_dict)
def save_dataset(path, dataset, save):
"""save the dataset.
Parameters
----------
path : st... | 2.625 | 3 |
Exercicios/Extras/RainbowCircle.py | RicardoMart922/estudo_Python | 0 | 12791286 | <reponame>RicardoMart922/estudo_Python
import turtle
t = turtle.Turtle()
screen = turtle.Screen()
screen.bgcolor('black')
t.pensize(2)
t.speed(0)
while(True):
for i in range(6):
for colors in ['red', 'blue', 'magenta', 'green', 'yellow', 'white']:
t.color(colors)
t.circle(100)
... | 3.96875 | 4 |
autokeras/constant.py | chosungsu/autokeras | 1 | 12791287 | from collections import namedtuple
GoogleDriveFile = namedtuple('GoogleDriveFile', ['google_drive_id', 'local_name'])
class Constant:
BACKEND = 'torch'
# Data
VALIDATION_SET_SIZE = 0.08333
CUTOUT_HOLES = 1
CUTOUT_RATIO = 0.5
# Searcher
MAX_MODEL_NUM = 1000
BETA = 2.576
KERNEL_LAM... | 2.328125 | 2 |
dfvfs/vfs/file_entry.py | Defense-Cyber-Crime-Center/dfvfs | 2 | 12791288 | # -*- coding: utf-8 -*-
"""The Virtual File System (VFS) file entry object interface.
The file entry can be various file system elements like a regular file,
a directory or file system metadata.
"""
import abc
from dfvfs.resolver import resolver
class Directory(object):
"""Class that implements the VFS directory... | 3.15625 | 3 |
ca_qc_saguenay/__init__.py | tor-councilmatic/scrapers-ca | 2 | 12791289 | <filename>ca_qc_saguenay/__init__.py
from __future__ import unicode_literals
from utils import CanadianJurisdiction
class Saguenay(CanadianJurisdiction):
classification = 'legislature'
division_id = 'ocd-division/country:ca/csd:2494068'
division_name = 'Saguenay'
name = 'Conseil municipal de Saguenay'... | 1.523438 | 2 |
cellphonedb/utils/dataframe_functions.py | chapuzzo/cellphonedb | 278 | 12791290 | <gh_stars>100-1000
import pandas as pd
from cellphonedb.utils import dataframe_format
def dataframes_has_same_data(dataframe1: pd.DataFrame, dataframe2: pd.DataFrame,
round_decimals: bool = False) -> pd.DataFrame:
dataframe1 = dataframe1.copy(deep=True)
dataframe2 = dataframe2.co... | 2.671875 | 3 |
tests/components/mqtt/test_camera.py | pcaston/Open-Peer-Power | 0 | 12791291 | <reponame>pcaston/Open-Peer-Power
"""The tests for mqtt camera component."""
import json
from unittest.mock import ANY
from openpeerpower.components import camera, mqtt
from openpeerpower.components.mqtt.discovery import async_start
from openpeerpower.setup import async_setup_component
from tests.common import (
... | 2.34375 | 2 |
mil_common/ros_alarms/nodes/alarm_server.py | naveenmaan/mil | 0 | 12791292 | <reponame>naveenmaan/mil
#!/usr/bin/env python
import rospy
from ros_alarms import HandlerBase
from ros_alarms.msg import Alarm as AlarmMsg
from ros_alarms.srv import AlarmGet, AlarmSet
from ros_alarms import Alarm
import inspect
class AlarmServer(object):
def __init__(self):
# Maps alarm name to Alarm... | 2.28125 | 2 |
triphecta/phenotype_compare.py | martinghunt/triphecta | 0 | 12791293 | class PhenotypeCompare:
def __init__(self, constraints, count_unknown_as_diff=True):
self.compare_functions = {
"equal": PhenotypeCompare._compare_method_equal,
"range": PhenotypeCompare._compare_method_range,
"abs_distance": PhenotypeCompare._compare_method_abs_distance,... | 2.734375 | 3 |
lobster.py | khurtado/lobster | 1 | 12791294 | <gh_stars>1-10
#!/usr/bin/env python
from lobster.ui import boil
boil()
| 1.125 | 1 |
c2vqa-verbs/dataset/dataset-editable.py | andeeptoor/qar-qae | 0 | 12791295 | <reponame>andeeptoor/qar-qae
import pandas as pd
import os
import spacy
from spacy.symbols import VERB, NOUN
import random
from pattern.en import conjugate, PROGRESSIVE, INDICATIVE
from utils import read_json
from common import save_data
print "Loading feature extractors..."
nlp = spacy.load('en')
dataset_dir = '/sb-... | 2.4375 | 2 |
mnist_sync_sharding_greedy/model/model.py | epikjjh/DIstributed-Deep-Learning | 1 | 12791296 | <gh_stars>1-10
import tensorflow as tf
import pickle
import numpy as np
import pandas as pd
class Model:
def __init__(self):
# Data: mnist dataset
with open('data/mnist.pkl', 'rb') as f:
train_set, _, test_set = pickle.load(f, encoding='latin1')
self.x_train, y_train = train_set
... | 2.5625 | 3 |
tutorial/de.digits.mg/graph.py | matomatical/memograph | 13 | 12791297 | <filename>tutorial/de.digits.mg/graph.py
from mg.graph import Node
D = ['null','eins','zwei','drei','vier','fünf','sechs','sieben','acht','neun']
def graph():
for i, n in enumerate(D):
yield (
Node(i, speak_str=i, speak_voice="en"),
Node(n, speak_str=n, speak_voice="de"),
)
| 2.984375 | 3 |
tests/test_utils.py | audeering/audformat | 4 | 12791298 | <gh_stars>1-10
from io import StringIO
import os
import shutil
import numpy as np
import pandas as pd
import pytest
import audeer
import audformat
from audformat import utils
from audformat import define
@pytest.mark.parametrize(
'objs, overwrite, expected',
[
# empty
(
[],
... | 2.046875 | 2 |
misago/threads/api/postingendpoint/attachments.py | HenryChenV/iJiangNan | 1 | 12791299 | from rest_framework import serializers
from django.utils.translation import ugettext as _
from django.utils.translation import ungettext
from misago.acl import add_acl
from misago.conf import settings
from misago.threads.serializers import AttachmentSerializer
from . import PostingEndpoint, PostingMiddleware
class... | 1.90625 | 2 |
vida/vida/migrations/0017_form_color.py | smesdaghi/vida | 1 | 12791300 | <filename>vida/vida/migrations/0017_form_color.py
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('vida', '0016_auto_20160203_1355'),
]
operations = [
migrations.AddField(
... | 1.835938 | 2 |
tests/test_isosurface.py | TormodLandet/Ocellaris | 1 | 12791301 | # Copyright (C) 2017-2019 <NAME>
# SPDX-License-Identifier: Apache-2.0
import dolfin
import numpy
from ocellaris import Simulation, setup_simulation
import pytest
from helpers import skip_in_parallel
ISO_INPUT = """
ocellaris:
type: input
version: 1.0
mesh:
type: Rectangle
Nx: 4
Ny: 4
probes:
- ... | 2 | 2 |
DifferentialExpression/05_Volcano_Plots.py | LewisLabUCSD/CHOSecretoryKO | 1 | 12791302 | <filename>DifferentialExpression/05_Volcano_Plots.py
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import os
csv_files = os.listdir(os.getcwd())
csv_files = [f for f in csv_files if "Line" in f and ".csv" in f]
# Function to determine significance
def isSignificant(xval,yval, xthr = 1, ythr =... | 2.796875 | 3 |
S4/S4 Library/simulation/gsi_handlers/club_handlers.py | NeonOcean/Environment | 1 | 12791303 | from clubs.club_enums import ClubHangoutSetting
from sims4.gsi.dispatcher import GsiHandler
from sims4.gsi.schema import GsiGridSchema, GsiFieldVisualizers
import services
import sims4.resources
club_schema = GsiGridSchema(label='Club Info')
club_schema.add_field('name', label='Name', type=GsiFieldVisualizers.STRING)
c... | 2.03125 | 2 |
Connector/rpcutils/error.py | bridgedragon/NodeChain | 0 | 12791304 | <gh_stars>0
#!/usr/bin/python
from .constants import *
from json import JSONEncoder
from httputils import error
class RpcError(Exception):
def __init__(self, id, message, code):
self._message = message
self._code = code
self._id = id
super().__init__(self.message)
@property
... | 2.4375 | 2 |
X_airbnb_revisited/airbnb_pricer/airbnb/compile_airbnb_data.py | djsegal/metis | 1 | 12791305 | import pandas as pd
import geopandas
def compile_airbnb_data(cur_link_table):
cur_tables = []
for cur_row in cur_link_table.itertuples():
tmp_table = cur_row.table.copy()
tmp_table["month"] = cur_row.month
tmp_table["year"] = cur_row.year
tmp_table["datetime"] = cur_row.dateti... | 3.015625 | 3 |
vedastr_cstr/vedastr/models/bodies/sequences/transformer/__init__.py | bsm8734/formula-image-latex-recognition | 13 | 12791306 | <reponame>bsm8734/formula-image-latex-recognition
from .decoder import TransformerDecoder # noqa 401
from .encoder import TransformerEncoder # noqa 401
| 0.902344 | 1 |
app/main.py | cultivationdev/py-debian-conda-flask-template | 0 | 12791307 | import logging
from app.core.app import create_app
from app.core.cfg import cfg
__author__ = 'kclark'
logger = logging.getLogger(__name__)
app = create_app()
def run_app():
logger.info('App Server Initializing')
app.run(host='localhost', port=5000, threaded=True, debug=cfg.debug_mode)
logger.info('Ap... | 2.078125 | 2 |
tests/test_encoding.py | kube-HPC/python-wrapper.hkube | 1 | 12791308 | <reponame>kube-HPC/python-wrapper.hkube
import os
import random
from hkube_python_wrapper.util.encoding import Encoding
size = 1 * 1024
def test_none_encoding():
encoding = Encoding('msgpack')
decoded = encoding.decode(header=None, value=None)
assert decoded is None
def test_json_encoding():
encoding... | 2.203125 | 2 |
pubmedextract/sex_utils/subdivide_table.py | allenai/pubmedextract | 8 | 12791309 | <reponame>allenai/pubmedextract<filename>pubmedextract/sex_utils/subdivide_table.py
from itertools import groupby
import numpy as np
from pubmedextract.sex_utils.regex_utils import categorize_cell_string
def subdivide(table):
"""
- Categorize each cell as string, value, or empty
- Figure out which of th... | 2.9375 | 3 |
logic.py | rakeshr99/2048-Game-AI-Based-Solver | 0 | 12791310 | #
# CS1010FC --- Programming Methodology
#
# Mission N Solutions
#
# Note that written answers are commented out to allow us to run your
# code easily while grading your problem set.
from random import *
from copy import deepcopy
import math
import random
#######
#Task 1a#
#######
# [Marking Scheme]
# Points to note:
... | 3.625 | 4 |
archived/soc_038_monthly_asylum_requests/contents/src/__init__.py | Taufiq06/nrt-scripts | 6 | 12791311 | import os
import logging
import sys
from collections import OrderedDict, defaultdict
import datetime
import cartosql
import requests
import json
# Constants
LATEST_URL = 'http://popdata.unhcr.org/api/stats/asylum_seekers_monthly.json?year={year}'
CARTO_TABLE = 'soc_038_monthly_asylum_requests'
CARTO_SCHEMA = OrderedD... | 2.484375 | 2 |
core/domain/feedback_jobs_one_off_test.py | bching/oppia | 1 | 12791312 | <filename>core/domain/feedback_jobs_one_off_test.py
# coding: utf-8
#
# Copyright 2014 The Oppia Authors. All Rights Reserved.
#
# 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://... | 1.789063 | 2 |
web_py/server.py | ovvladimir/Servers | 0 | 12791313 | <reponame>ovvladimir/Servers<gh_stars>0
# https://webpy.org/docs/0.3/tutorial
# https://iximiuz.com/ru/posts/over-9000-ways-to-make-web-server-in-python/
# https://www.pyimagesearch.com/2019/04/15/live-video-streaming-over-network-with-opencv-and-imagezmq/
# python server.py 1234
import web
urls = (
'/', 'i... | 2.59375 | 3 |
tests/test_units.py | wiris/py-path-signature | 0 | 12791314 | import json
import os
import numpy as np
import pytest
from py_path_signature.data_models.stroke import Stroke
from py_path_signature.path_signature_extractor import PathSignatureExtractor
from .conftest import TEST_DATA_INPUT_DIR, TEST_DATA_REFERENCE_DIR
@pytest.mark.parametrize(
"input_strokes, expected_bound... | 2.3125 | 2 |
ami/gunicorn.conf.py | NCKU-CCS/energy-blockchain | 0 | 12791315 | <reponame>NCKU-CCS/energy-blockchain
# pylint: skip-file
bind = "0.0.0.0:4000"
workers = 4
timeout = 120
proc_name = "AMI-Uploader"
errorlog = "-"
loglevel = "info"
accesslog = "-"
access_log_format = '%(h)s %(l)s %(u)s %(t)s "%(r)s" %(s)s %(b)s "%(f)s" "%(a)s"'
| 1.34375 | 1 |
tests/broker/test_del_building.py | ned21/aquilon | 7 | 12791316 | #!/usr/bin/env python
# -*- cpy-indent-level: 4; indent-tabs-mode: nil -*-
# ex: set expandtab softtabstop=4 shiftwidth=4:
#
# Copyright (C) 2008,2009,2010,2011,2012,2013,2014,2015,2016,2017 Contributor
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance... | 2.25 | 2 |
ocellaris/solver_parts/bdm.py | TormodLandet/Ocellaris | 1 | 12791317 | <reponame>TormodLandet/Ocellaris
# Copyright (C) 2015-2019 <NAME>
# SPDX-License-Identifier: Apache-2.0
import dolfin
from dolfin import FiniteElement, VectorElement, MixedElement, FunctionSpace, VectorFunctionSpace
from dolfin import FacetNormal, TrialFunction, TestFunction, TestFunctions, Function
from dolfin import... | 2.1875 | 2 |
extractor_de_aspectos/tests/extractor/test_extractor_de_aspectos.py | XrossFox/maquina-de-aspectos | 0 | 12791318 | import sys
sys.path.append('../../extractor_de_aspectos')
import unittest
from extractor import extractor_de_aspectos
from cliente_corenlp import cliente_corenlp
from lematizador import lematizador
import nltk
class Test(unittest.TestCase):
def setUp(self):
self.ex = extractor_de_aspectos.ExtractorDeAsp... | 2.8125 | 3 |
rbm.py | JonasWechsler/NeuralNetsLab4 | 0 | 12791319 | <reponame>JonasWechsler/NeuralNetsLab4<gh_stars>0
import numpy as np
import csv
import plot
from sklearn.neural_network import BernoulliRBM
def error(a, b):
return (a != b).sum()
def percent_error(a, b):
return sum(error(a[i], b[i]) for i in range(len(a)))/float(len(a)*len(a[0]))
def gen_even_slices(n, n_packs, n_... | 2.75 | 3 |
play_snake.py | Disi77/Snake | 1 | 12791320 | # SNAKE GAME
import pyglet
from pyglet import gl
from pyglet.window import key
from images_load import batch
from game_state import Game_state
from field import game_field
time_to_move = [0.7]
def on_key_press(symbol, modifiers):
'''
User press key for setting snake direction.
'''
if symbol == ke... | 2.609375 | 3 |
src/test/py/ltprg/game/snli/data/annotate_sua_nlp.py | forkunited/ltprg | 11 | 12791321 | <reponame>forkunited/ltprg
import sys
import mung.nlp.corenlp
input_data_dir = sys.argv[1]
output_data_dir = sys.argv[2]
annotator = mung.nlp.corenlp.CoreNLPAnnotator('$.[state, utterance]', 'contents', 'nlp')
annotator.annotate_directory(input_data_dir, output_data_dir, id_key="id", batch=100)
| 2.03125 | 2 |
auto-brightness-service.py | sheinz/auto-brightness | 1 | 12791322 | #!/usr/bin/env python
import dbus
import dbus.service
import sys
import signal
from PyQt4 import QtCore
from dbus.mainloop.qt import DBusQtMainLoop
from notifier import Notifier
from als import AmbientLightSensor
from brightnessctrl import BrightnessCtrl
class AutoBrightnessService(dbus.service.Object):
def __... | 2.25 | 2 |
lecture_03_functional_programming/hw/task01.py | OlivkaFromHell/epam_python_autumn_2020 | 1 | 12791323 | """
In previous homework task 4, you wrote a cache function that remembers other function output value.
Modify it to be a parametrized decorator, so that the following code::
@cache(times=3)
def some_function():
pass
Would give out cached value up to `times` number only.
Example::
@c... | 4.28125 | 4 |
osc_tui/imageGrid.py | outscale-mdr/osc-tui | 5 | 12791324 | <reponame>outscale-mdr/osc-tui
import npyscreen
import pyperclip
import time
import createVm
import main
import popup
import selectableGrid
import virtualMachine
class ImageGrid(selectableGrid.SelectableGrid):
def __init__(self, screen, *args, **keywords):
super().__init__(screen, *args, **keywords)
... | 2.203125 | 2 |
test_QandT.py | Jul-Tedyputro/python-sample-vscode-flask-tutorial | 0 | 12791325 | def test_eggplantGUI():
print ('Mr Moritz is in action')
assert False
| 1.265625 | 1 |
src/04_Mokaro/register_new_user.py | UltiRequiem/Basic-Selenium-whit-Python | 3 | 12791326 | <filename>src/04_Mokaro/register_new_user.py
import unittest
from selenium import webdriver
from api_data_mock import ApiDataMock
class RegisterNewUser(unittest.TestCase):
def setUp(self):
self.driver = webdriver.Chrome(executable_path='./../chromedriver')
driver = self.driver
driver.impl... | 2.625 | 3 |
backup_pca.py | Niels-vv/Safe-RL-With-DR | 1 | 12791327 | <gh_stars>1-10
import torch
import numpy as np
from sklearn.preprocessing import StandardScaler
from sklearn.decomposition import IncrementalPCA as PCA
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
class PCACompression:
def __init__(self, scalar, latent_space):
self.fileNames = []
... | 2.46875 | 2 |
Python/Doubly Linked List/DLNode.py | ooweihanchenoo/basicPrograms | 0 | 12791328 | class DLNode:
def __init__(self, init_data):
self.data = init_data
self.next = None
self.previous = None
def get_data(self):
return self.data
def get_next(self):
return self.next
def get_previous(self):
return self.previous
def ... | 2.9375 | 3 |
popupwindow_matplotlib.py | klincke/MicroWineBar | 4 | 12791329 | <reponame>klincke/MicroWineBar<gh_stars>1-10
import os, sys
from tkinter import *
from tkinter.ttk import *
from tkinter.filedialog import asksaveasfilename
import pandas as pd
import numpy as np
import tkinter.messagebox as tmb
from skbio.diversity.alpha import shannon
from .general_functions import *
import matplo... | 2.15625 | 2 |
scanpy/datasets/__init__.py | mkmkryu/scanpy2 | 1,171 | 12791330 | """Builtin Datasets.
"""
from ._datasets import (
blobs,
burczynski06,
krumsiek11,
moignard15,
paul15,
toggleswitch,
pbmc68k_reduced,
pbmc3k,
pbmc3k_processed,
visium_sge,
)
from ._ebi_expression_atlas import ebi_expression_atlas
| 0.992188 | 1 |
tests/test_edgeql_enums.py | sfermigier/edgedb | 7,302 | 12791331 | <gh_stars>1000+
#
# This source file is part of the EdgeDB open source project.
#
# Copyright 2019-present MagicStack Inc. and the EdgeDB 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... | 2.125 | 2 |
GUI/set_memristor_parameters.py | DuttaAbhigyan/Memristor-Simulation-Using-Python | 6 | 12791332 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Mar 18 18:54:20 2019
@author: abhigyan
"""
from PyQt5.QtGui import *
from PyQt5.QtWidgets import *
from PyQt5.QtCore import *
"""Class to take in various paramters of the Memristors to be simulated"""
class set_memristor_parameters(QMainWindow):
... | 2.78125 | 3 |
web/WebView/admin.py | shinoyasan/intelli-switch | 12 | 12791333 | from django.contrib import admin
from .models import ServerInfo,SampleData,DeviceControl,UserApp
# Register your models here.
admin.site.register(ServerInfo)
admin.site.register(SampleData)
admin.site.register(DeviceControl)
admin.site.register(UserApp) | 1.375 | 1 |
tests/ut/python/pipeline/parse/test_sequence_assign.py | httpsgithu/mindspore | 1 | 12791334 | <reponame>httpsgithu/mindspore
# Copyright 2020-2022 Huawei Technologies Co., Ltd
#
# 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 req... | 2.234375 | 2 |
guitarfan/controlers/site/index.py | timgates42/GuitarFan | 48 | 12791335 | <gh_stars>10-100
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from flask import render_template, request, redirect, url_for, flash, Blueprint, jsonify, current_app
from sqlalchemy import func
from guitarfan.models import *
from guitarfan.extensions.flasksqlalchemy import db
from guitarfan.extensions.flaskcache impor... | 2.03125 | 2 |
src/utils.py | GreenRiverRUS/thatmusic-api | 3 | 12791336 | import hashlib
import re
from typing import Union, Optional, Dict
from urllib.parse import urljoin
import binascii
import logging
import eyed3
from eyed3.id3 import ID3_V1
from unidecode import unidecode
from tornado import web
from settings import LOG_LEVEL
class BasicHandler(web.RequestHandler):
logger = None... | 2.046875 | 2 |
examples/plotting/performance_plotting.py | ndangtt/LeadingOnesDAC | 11 | 12791337 | <gh_stars>10-100
from pathlib import Path
from seaborn import plotting_context
from dacbench.logger import load_logs, log2dataframe
from dacbench.plotting import plot_performance_per_instance, plot_performance
import matplotlib.pyplot as plt
def per_instance_example():
"""
Plot CMA performance for each tra... | 2.359375 | 2 |
training/Leetcode/109.py | voleking/ICPC | 68 | 12791338 | # Definition for singly-linked list.
# class ListNode(object):
# def __init__(self, x):
# self.val = x
# self.next = None
# Definition for a binary tree node.
# class TreeNode(object):
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
class ... | 3.8125 | 4 |
app/main/routes.py | mrtoronto/find-a-lab | 0 | 12791339 | <reponame>mrtoronto/find-a-lab<filename>app/main/routes.py
from app import db
from app.main.forms import LoginForm, RegistrationForm, EditProfileForm, \
ResetPasswordRequestForm, ResetPasswordForm, authorIndexQueryForm
from app.models import User, Result
from app.email import send_password_reset_email
from app.main... | 2.21875 | 2 |
auto_drive/rule_drive/ReplayRace.py | YingshuLu/self-driving-formula-racing | 0 | 12791340 | <reponame>YingshuLu/self-driving-formula-racing<filename>auto_drive/rule_drive/ReplayRace.py
import cv2
import sys
import os
from time import time, sleep
imagesFolder = sys.argv[1]
frameIntervalSec = 1.0/10
def show_image(img, name = "image", scale = 1.0, newsize = None):
if scale and scale != 1.0:
img = c... | 2.703125 | 3 |
pink/tasks/posture_task.py | tasts-robots/pink | 0 | 12791341 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Copyright 2022 <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
#
# Unless required... | 2.484375 | 2 |
software/gen_pixels.py | kbeckmann/Glasgow | 3 | 12791342 | import colorsys
import struct
import math
PIXELS = 94
# interleaved = 1
# interleaved = 2
# interleaved = 4
interleaved = 8
f = open("test_{}.bin".format(interleaved), "wb")
for n in range(1000):
for x in range(PIXELS):
# This way we get a half "rainbow", easy to find breaks/seams
hue = float(x ... | 2.359375 | 2 |
backend/contrib/newsletter_subscribe/views/unsubscribe.py | szkkteam/agrosys | 0 | 12791343 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Common Python library imports
from http import HTTPStatus
# Pip package imports
from flask import render_template, request, jsonify
# Internal package imports
from backend.utils import decode_token
from ..models import NewsletterSubscribe
from ..utils import generate_... | 2.25 | 2 |
tests/run_all_tests.py | GRV96/jazal | 0 | 12791344 | <reponame>GRV96/jazal
from os import system
system("pytest path_util_tests.py")
system("pytest path_checker_tests.py")
system("pytest reactive_path_checker_tests.py")
system("pytest missing_path_arg_warner_tests.py")
| 1.59375 | 2 |
python/cuXfilter/charts/cudatashader/__init__.py | AjayThorve/cuxfilter | 2 | 12791345 | from .cudatashader import scatter_geo, scatter, line, heatmap | 0.96875 | 1 |
src/preprocessing/minmax.py | kjhall01/xcast | 11 | 12791346 | <reponame>kjhall01/xcast
from ..core.utilities import *
class MinMax:
def __init__(self, min=-1, max=1):
self.range_min, self.range_max = min, max
self.range = max - min
self.min, self.max, self.x_range = None, None, None
def fit(self, X, x_lat_dim=None, x_lon_dim=None, x_sample_dim=None, x_feature_dim=None):... | 2.546875 | 3 |
tests/integration/test_configinventory.py | vincentbernat/lldpd | 312 | 12791347 | <filename>tests/integration/test_configinventory.py
import os
import pytest
import platform
import time
import shlex
@pytest.mark.skipif("'LLDP-MED' not in config.lldpd.features",
reason="LLDP-MED not supported")
class TestConfigInventory(object):
def test_configinventory(self, lldpd1, lldpd, ... | 2.09375 | 2 |
tests/testapp/models.py | pawnhearts/django-reactive | 21 | 12791348 | <gh_stars>10-100
from django.db import models
from django_reactive.fields import ReactJSONSchemaField
def modify_max_length(schema, ui_schema):
import random
max_length = random.randint(20, 30)
schema["properties"]["test_field"]["maxLength"] = max_length
ui_schema["test_field"]["ui:help"] = f"Max {m... | 2.0625 | 2 |
backend/application.py | RMDev97/tensorboard-extensions | 0 | 12791349 | <reponame>RMDev97/tensorboard-extensions
import os
from tensorboard.plugins import base_plugin
from tensorboard.backend.event_processing import plugin_event_accumulator
from tensorboard.backend import application
from tensorboard.backend.event_processing import plugin_event_multiplexer
from .logging import _logger
im... | 1.835938 | 2 |
pymanip/legacy_session/octmi_dat.py | ctoupoin/pymanip | 0 | 12791350 | #! /usr/bin/env python
# -*- coding: utf-8 -*-
import os
import numpy as np
def load_octmi_dat(acquisitionName, basePath="."):
# Vérification de l'existence du fichier
datFilePath = os.path.join(os.path.normpath(basePath), acquisitionName + "_MI.dat")
if not os.path.exists(datFilePath):
print("Co... | 2.375 | 2 |