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 |
|---|---|---|---|---|---|---|
testing/tests/001-main/002-createrepository.py | darobin/critic | 1 | 12799651 | import time
def check_repository(document):
rows = document.findAll("tr", attrs=testing.expect.with_class("repository"))
testing.expect.check(1, len(rows))
def check_cell(row, class_name, expected_string, inline_element_type=None):
cells = row.findAll("td", attrs=testing.expect.with_class(class_na... | 2.40625 | 2 |
Dataset/Leetcode/train/102/63.py | kkcookies99/UAST | 0 | 12799652 | class Solution:
def XXX(self, root: TreeNode) -> List[List[int]]:
queue = []
queue.insert(0,root)
res = []
if not root:
return []
while queue:
n = len(queue)
layer = []
for i in range(n):
temp = queue.pop()
... | 3.328125 | 3 |
src/5_expression/GSE64913.py | reemagit/flowcentrality | 2 | 12799653 | #!/usr/bin/env python3
"""
Generate GSE64913
"""
__author__ = "<NAME>"
__version__ = "0.1.0"
__license__ = "MIT"
import logging
import GEOparse
import argparse
import pandas as pd
from funcs import utils
from os.path import join
import numpy as np
#def append_postfix(filename,postfix):
# return "{0}_{2}.{1}".for... | 2.265625 | 2 |
test.py | cooool/doublejian | 0 | 12799654 | <reponame>cooool/doublejian
def main():
print ("hello")
return 0
if __name__ == '__main__':
main()
| 1.6875 | 2 |
backends/redis.py | iliadmitriev/auth-api | 3 | 12799655 | <reponame>iliadmitriev/auth-api<filename>backends/redis.py<gh_stars>1-10
import aioredis
async def init_redis(app):
app['redis'] = aioredis.from_url(
app['redis_location'],
)
async def close_redis(app):
await app['redis'].close()
def setup_redis(app, redis_location):
app['redis_location'] ... | 2.375 | 2 |
utils/BaseFlags.py | cvsubmittemp/BraVL | 0 | 12799656 | <reponame>cvsubmittemp/BraVL
import os
import argparse
import torch
import scipy.io as sio
parser = argparse.ArgumentParser()
# TRAINING
parser.add_argument('--batch_size', type=int, default=512, help="batch size for training")
parser.add_argument('--initial_learning_rate', type=float, default=0.0001, help="starting l... | 2.203125 | 2 |
mcpipy/dragoncurve.py | wangtt03/raspberryjammod | 338 | 12799657 | #
# Code by <NAME> and under the MIT license
#
from mineturtle import *
import lsystem
t = Turtle()
t.pendelay(0)
t.turtle(None)
t.penblock(block.BRICK_BLOCK)
# ensure angles are always integral multiples of 90 degrees
t.gridalign()
rules = {'X':'X+YF+', 'Y':'-FX-Y'}
def go():
# draw a wall segment... | 3.0625 | 3 |
server/app/tests/users/test_endpoints.py | josenava/meal-calendar | 0 | 12799658 | import pytest
from fastapi.testclient import TestClient
@pytest.mark.integration
@pytest.mark.usefixtures("test_db_session")
class TestSignupEndpoint:
def test_signup_returns_200(self, client: TestClient):
response = client.post(
"/users/signup",
json={
"email": "<E... | 2.484375 | 2 |
queries/charQuery.py | Kadantte/AniPy-Bot | 11 | 12799659 | def searchChar():
query = '''
query ($search: String) {
Character(search: $search) {
siteUrl
name {
full
}
media(perPage: 1) {
nodes {
title {
romaji
english
}
siteUrl
... | 1.820313 | 2 |
scripts/fitnessMutations/annotate_mutations.py | felixhorns/BCellSelection | 3 | 12799660 | <gh_stars>1-10
import sys
import numpy as np
import pandas as pd
from Bio.Seq import Seq
from Bio.Alphabet import generic_dna
from Bio import SeqIO, Align, AlignIO, Phylo
from itertools import izip
def load_tree(f):
t = Phylo.read(f, 'newick')
t.root_with_outgroup("germline")
t.get_nonterminals()[0].branch... | 2.59375 | 3 |
import/a.py | abos5/pythontutor | 0 | 12799661 | <reponame>abos5/pythontutor<gh_stars>0
print "a before b"
import b
print "a after import b"
_once = 0
def dofoo():
global _once;
_once += 1
if _once > 1:
print "what the hell are u thinking?"
print "a very important function that can only exec once"
dofoo()
print "complete a"
| 3.046875 | 3 |
src/telliot_core/queries/query.py | tellor-io/pytelliot | 2 | 12799662 | """ Oracle Query Module
"""
import json
from clamfig import Serializable
from web3 import Web3
from telliot_core.dtypes.value_type import ValueType
class OracleQuery(Serializable):
"""Oracle Query
An OracleQuery specifies how to pose a question to the
Tellor Oracle and how to format/interpret the res... | 2.9375 | 3 |
gpu_tasker/email_settings_sample.py | cnstark/awesome_gpu_scheduler | 35 | 12799663 | <reponame>cnstark/awesome_gpu_scheduler
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
EMAIL_HOST = 'smtp.163.com'
EMAIL_PORT = 465
EMAIL_HOST_USER = '<EMAIL>'
EMAIL_HOST_PASSWORD = '<PASSWORD>'
EMAIL_USE_SSL = True
EMAIL_USE_LOCALTIME = True
DEFAULT_FROM_EMAIL = 'GPUTasker<{}>'.format(EMAIL_HOST_USER)... | 1.453125 | 1 |
debug.py | Epsilon-Lee/OpenNMT-V1 | 7 | 12799664 | <filename>debug.py
import torch
import torch.nn as nn
import onmt
from onmt.BleuCal import fetch_data
import sys
if torch.cuda.is_available():
torch.cuda.set_device(3)
checkpoint = torch.load('../Models/V1_IWSLT_Models/de2en_30k_bz64_bc5_bleu_26.06_e24.pt')
opt = checkpoint['opt']
# del(checkpoint)
opt.c... | 1.90625 | 2 |
test_pytest/test_unit/test_database.py | hat-open/hat-syslog | 1 | 12799665 | <reponame>hat-open/hat-syslog<filename>test_pytest/test_unit/test_database.py
import datetime
import os
import socket
import pytest
from hat.syslog.server import common
import hat.syslog.server.database
pytestmark = pytest.mark.asyncio
@pytest.fixture
def db_path(tmp_path):
return tmp_path / 'syslog.db'
@py... | 2.09375 | 2 |
web_scraping/beautifulsoup/bs4_sample2.py | manual123/Nacho-Jupyter-Notebooks | 2 | 12799666 | <filename>web_scraping/beautifulsoup/bs4_sample2.py
from pprint import pprint
import re
from bs4 import BeautifulSoup
html_content = open('bs_sample.html') # http://dl.dropbox.com/u/49962071/blog/python/resource/bs_sample.html
soup = BeautifulSoup(html_content) # making soap
for tag in soup.find_all(re.compile("^p"))... | 3.375 | 3 |
python/busmap/fetch.py | ehabkost/busmap | 4 | 12799667 | <reponame>ehabkost/busmap<filename>python/busmap/fetch.py<gh_stars>1-10
# -*- coding: utf-8 -*
import horarios, linhas, env, dias
def get_linha_hor(idhor, nome):
c = env.db.cursor()
# look for id horario
r = c.select_onerow('linhas', ['id'], 'idhor=%s', [idhor])
if r:
c.close()
return r[0]
# not found. lo... | 2.546875 | 3 |
facenet.py | ndoo/libfreenect2-facial-recognition | 0 | 12799668 | <reponame>ndoo/libfreenect2-facial-recognition<filename>facenet.py<gh_stars>0
import argparse
import cv2
import numpy as np
import sys
from pylibfreenect2 import Freenect2, SyncMultiFrameListener
from pylibfreenect2 import FrameType, Registration, Frame
ap = argparse.ArgumentParser(formatter_class=argparse.ArgumentDef... | 2.171875 | 2 |
src/unicon/plugins/nxos/mds/statemachine.py | nielsvanhooy/unicon.plugins | 18 | 12799669 | <gh_stars>10-100
__author__ = "<NAME> <<EMAIL>>"
from unicon.plugins.nxos.statemachine import NxosSingleRpStateMachine
from unicon.plugins.nxos.mds.patterns import NxosMdsPatterns
from unicon.statemachine import State, Path
patterns = NxosMdsPatterns()
class NxosMdsSingleRpStateMachine(NxosSingleRpStateMachine):
... | 1.96875 | 2 |
cardice/__init__.py | ogrisel/cardice | 2 | 12799670 | """Compute Cloud setup with SaltStack and Apache Libcloud"""
__version__ = '0.1.0-git'
if __name__ == '__main__':
from cardice.commandline import main
main()
| 1.070313 | 1 |
boo/okved/__init__.py | vishalbelsare/boo | 14 | 12799671 | <filename>boo/okved/__init__.py
from .okved import all_codes_v2, name_v2
| 1.03125 | 1 |
genestack_client/genestack_exceptions.py | genestack/python-client | 2 | 12799672 | # -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from future import standard_library
standard_library.install_aliases()
from builtins import *
from urllib.error import URLError
MASTER_BRANCH = 'h... | 2.359375 | 2 |
roll_dice.py | sarveshbhatnagar/CompetetiveProgramming | 0 | 12799673 | <gh_stars>0
from collections import defaultdict
class Solution:
def rollDice(self, arr):
map_val = {
6: 1,
1: 6,
2: 4,
4: 2,
3: 5,
5: 3
}
count_elem = defaultdict(int)
showFace = None
max_count = 0
... | 2.984375 | 3 |
python/conversations.py | grcanosa/renfe-checker | 7 | 12799674 | """
"""
from enum import Enum
import logging
from telegram import (ReplyKeyboardMarkup, ReplyKeyboardRemove)
from telegram.ext import ConversationHandler
from telegramcalendarkeyboard import telegramcalendar
from telegramcalendarkeyboard import telegramoptions
from texts import texts as TEXTS
from texts import keyb... | 2.390625 | 2 |
FullStackTests.py | stefanos-86/Remember | 3 | 12799675 | <reponame>stefanos-86/Remember<gh_stars>1-10
# Test rig to do tests on the completed machinery.
# Runs GDB on one (or all) test core files and compare the test result with what
# is stored in the <test case name>_result.txt file(s).
# This too relies on a convention on the file names linking test cases, expected result... | 2.71875 | 3 |
models/room.py | Kaezon/BoredRPG | 0 | 12799676 | """
Module containing the Room class
"""
from collections import namedtuple
from entity import Entity
"""
Exit is a namedtuple which describes a unidirectional connection between rooms.
Properties:
direction: Short name string
destination: Room refrence
"""
Exit = namedtuple("Exit", ['direction... | 3.8125 | 4 |
main.py | jsleb333/quadboost | 1 | 12799677 | import torch
import logging
from quadboost import QuadBoostMHCR
from quadboost.label_encoder import LabelEncoder, OneHotEncoder, AllPairsEncoder
from quadboost.weak_learner import *
from quadboost.callbacks import *
from quadboost.datasets import MNISTDataset
from quadboost.utils import parse, timed
from quadboost.dat... | 2.0625 | 2 |
test/run/t418.py | timmartin/skulpt | 2,671 | 12799678 | # lists
print "\nlists"
print min([1,2,3,4])
print min([2,1],[1,2],[1,1],[1,1,0])
# tuples
print "\ntuples"
print min((1,2,3,4))
print min((2,1),(1,2),(1,1),(1,1,0))
# dictionaries
print "\ndictionaries"
print min({1:2,3:4,5:6})
print min({1:6,3:4,5:2})
| 3.359375 | 3 |
devel/.private/hector_uav_msgs/lib/python2.7/dist-packages/hector_uav_msgs/srv/__init__.py | arijitnoobstar/UAVProjectileCatcher | 10 | 12799679 | from ._EnableMotors import *
| 1.21875 | 1 |
ServiceRelationExtraction/relationExtractService.py | black938/RelationExtractionProject | 0 | 12799680 | from concurrent import futures
import grpc
import relationExtractService_pb2
import relationExtractService_pb2_grpc
import tools
class relationExtractService(relationExtractService_pb2_grpc.relationExtractServiceServicer):
def ExtractTriple(self,request,context):
sentence = request.sentence
triples ... | 2.453125 | 2 |
src/delete_network.py | chrisdxie/rice | 16 | 12799681 |
import itertools
from collections import OrderedDict
import numpy as np
import cv2
import torch
import torch.nn as nn
from torch.nn import Sequential as Seq, Linear, ReLU
import torch.nn.functional as F
from torch_geometric.data import Data, Batch
from . import base_networks
from . import graph_construction as gc
fr... | 2.359375 | 2 |
util.py | CSI-Woo-Lab/PandaSchedulingModel | 3 | 12799682 | def get_util_range(num_proc):
util = [str(x) for x in range(10, num_proc * 100, 10)]
ret = []
for x in util:
if len(x) == 2:
ret.append('0.' + x)
else:
ret.append(x[:len(x) - 2] + '.' + x[len(x) - 2:])
return ret
| 2.765625 | 3 |
rss/subreddits.py | victorchen796/reddit-submission-scraper | 0 | 12799683 | from resources import get_subreddits, update_subreddits
"""
subreddits:
{
'<subreddit name>': {
'phrases': [
'<phrases>'
],
'flairs': [
'<flairs>'
],
'include': <boolean>,
'unflaired': <boolean>
},
...
}
"""
subreddits = get_subreddit... | 2.78125 | 3 |
events/migrations/0006_auto_20150811_1213.py | Morozzzko/django-events | 0 | 12799684 | <filename>events/migrations/0006_auto_20150811_1213.py<gh_stars>0
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
from django.conf import settings
class Migration(migrations.Migration):
dependencies = [
('events', '0005_auto_20150809_0203'),
]... | 1.328125 | 1 |
tests/test_nested_sampling.py | LoLab-VU/Gleipnir | 2 | 12799685 | <filename>tests/test_nested_sampling.py
"""
Tests using an implementation of a 5-dimensional Gaussian problem and its
Nested Sampling using via Gleipnir's built-in Nested Sampler.
Adapted from the DNest4 python gaussian example:
https://github.com/eggplantbren/DNest4/blob/master/python/examples/gaussian/gaussian.py
""... | 2.546875 | 3 |
src/objects/variable.py | CameronWr/ModelTranslator | 0 | 12799686 | class Variable:
var_type_dic = {'int' : 0,
'bool' : 1,
'boolean' : 1,
'float' : 2,
'double' : 2,
'string' : 3,
'str' : 3}
def __init__(self, var_type, var_name, var_value):
self.var_type = var_type
s... | 3.4375 | 3 |
real_robots/generate_goals.py | GOAL-Robots/real_robots | 35 | 12799687 | # -*- coding: utf-8 -*-
"""Console script to generate goals for real_robots"""
import click
import numpy as np
from real_robots.envs import Goal
import gym
import math
basePosition = None
slow = False
render = False
def pairwise_distances(a):
b = a.reshape(a.shape[0], 1, a.shape[1])
return np.sqrt(np.einsu... | 2.46875 | 2 |
tools/objects/object_gen.py | andyc655/gunyah-hypervisor | 61 | 12799688 | <gh_stars>10-100
#!/usr/bin/env python3
#
# © 2021 Qualcomm Innovation Center, Inc. All rights reserved.
#
# SPDX-License-Identifier: BSD-3-Clause
from Cheetah.Template import Template
import argparse
import subprocess
import sys
class Object:
def __init__(self, name):
self.name = name
def __str__(... | 2.265625 | 2 |
main.py | bichu136/svgrasterize.py | 0 | 12799689 | import os
import argparse
from svgrasterize import *
import numpy as np
np.set_printoptions(formatter={'float': lambda x: "{0:0.3f}".format(x)})
parser = argparse.ArgumentParser()
parser.add_argument("svg", help="input SVG file")
parser.add_argument("output", help="output PNG file")
parser.add_argument("-bg", type=svg_... | 2.84375 | 3 |
bin/train_lm.py | mcharnelli/DenoiseSum | 0 | 12799690 | <gh_stars>0
import argparse
from DenoiseSum import DATA_PATH
from DenoiseSum.LanguageModel.training import train_language_model
if __name__ == '__main__':
parser = argparse.ArgumentParser()
parser.add_argument('--dataset', default='rotten', type=str)
parser.add_argument('--no_instance', default=40, type=... | 2.203125 | 2 |
test/test_head.py | zydmayday/pamda | 1 | 12799691 | import unittest
import ramda as R
"""
https://github.com/ramda/ramda/blob/master/test/head.js
"""
class TestHead(unittest.TestCase):
def test_returns_the_first_element_of_an_ordered_collection(self):
self.assertEqual(1, R.head([1, 2, 3]))
self.assertEqual(2, R.head([2, 3]))
self.assertEqual(3, R.head(... | 3.375 | 3 |
exhaust/urls.py | lewiscollard/exhaust | 0 | 12799692 | from django.conf import settings
from django.conf.urls.static import static
from django.contrib import admin
from django.contrib.sitemaps.views import sitemap
from django.urls import include, path
from django.views.generic import TemplateView
from markdownx.views import MarkdownifyView
from exhaust.posts.sitemaps impo... | 2.140625 | 2 |
Python3/tests/test_key.py | combofish/chips-get | 2 | 12799693 | <filename>Python3/tests/test_key.py<gh_stars>1-10
import unittest
class TeskKey(unittest.TestCase):
def test_key(self):
a = ['a', 'b']
b = ['b']
self.assertEqual(a,b)
| 2.765625 | 3 |
src/quakestats/system/context.py | LaudateCorpus1/quakestats | 21 | 12799694 | import logging
import pymongo
from quakestats.datasource.mongo2 import (
DataStoreMongo,
)
from quakestats.system import (
conf,
)
logger = logging.getLogger(__name__)
class SystemContext:
def __init__(self):
self.config = conf.cnf
self.ds: DataStoreMongo = None
self.ds_client: ... | 2.421875 | 2 |
keys.py | Hudson-AmalembaL/daraja_mpesa_api | 0 | 12799695 | business_shortCode = "174379"
phone_number = "254746468686"
lipa_na_mpesa_passkey = "<KEY>"
consumer_key = "ryHq5u8TIFcyps7lIYQThAP1Al0zXAcU"
consumer_secrete = "O9kOqvHmN5sGViKI " | 1.015625 | 1 |
helper.py | Ellectronx/wsb-oceny | 5 | 12799696 |
import smtplib
from email.message import EmailMessage
from credent import secret
tb_headers=["id","przedmiot","wykladowca","forma_zaliczenia","rodz_zajec","ocena1","data1","ocena2","data2"]
def sendEmail(subject,eml_from,eml_to,message):
msg = EmailMessage()
msg.set_content(message)
msg['Subject'] ... | 3.0625 | 3 |
treestruct/__init__.py | srafehi/treestruct | 0 | 12799697 | from collections import MutableSet
from . import helpers
FORWARD = 1 # used to look at Node children
BACKWARD = -1 # used to look at Node parents
class NodeSet(MutableSet):
"""
A mutable set which automatically populates parent/child node sets.
For example, if this NodeSet contains `children` no... | 3.921875 | 4 |
pyresx/__init__.py | cola314/pyresx | 3 | 12799698 | <reponame>cola314/pyresx
from pyresx.ResXWriter import ResXWriter
| 1.0625 | 1 |
tests/test_connect.py | chdean/usajobs | 2 | 12799699 | <gh_stars>1-10
import usajobs
import pytest
def test_connect():
email, apikey = 'email', 'apikey'
headers = usajobs.connect(email=email, apikey=apikey)
assert headers == {'Host': 'data.usajobs.gov',
'User-Agent': 'email',
'Authorization-Key': 'apikey'}
| 1.992188 | 2 |
indra_world/sources/__init__.py | yanzv/indra_world | 3 | 12799700 | import tqdm
import pickle
import logging
import functools
from typing import List, Mapping, Optional
from multiprocessing import Pool
from indra.statements import Statement
from indra_world.sources import eidos, hume, sofia
logger = logging.getLogger(__name__)
def _reader_wrapper(fname, reader, dart_ids=None, **kwar... | 2.265625 | 2 |
megawidget/confirmation/__init__.py | pyrustic/megawidget | 0 | 12799701 | <reponame>pyrustic/megawidget<gh_stars>0
import tkinter as tk
import tkutil
from viewable import Viewable, CustomView
from tkutil import merge_megaconfig
# parts
BODY = "body"
LABEL_HEADER = "label_header"
LABEL_MESSAGE = "label_message"
FRAME_FOOTER = "frame_footer"
BUTTON_CANCEL = "button_cancel"
BUTTON_CONFIRM = "... | 3.234375 | 3 |
utils/inter_area.py | edosedgar/mtcnnattack | 68 | 12799702 | <gh_stars>10-100
from __future__ import division, print_function, absolute_import
import tensorflow as tf
import numpy as np
def inter_area_batch(im_inp,h,w,hs,ws):
# Do INTER_AREA resize here
# h, w - input size
# hs, ws - scaled size
whole = im_inp
return tf.clip_by_value(whole,0.,1.)
def resize_area_batch(im... | 2.1875 | 2 |
output/models/ms_data/regex/re_c43_xsd/__init__.py | tefra/xsdata-w3c-tests | 1 | 12799703 | <filename>output/models/ms_data/regex/re_c43_xsd/__init__.py
from output.models.ms_data.regex.re_c43_xsd.re_c43 import (
Regex,
Doc,
)
__all__ = [
"Regex",
"Doc",
]
| 1.195313 | 1 |
monet/visualize/force.py | flo-compbio/monet | 39 | 12799704 | <gh_stars>10-100
# Author: <NAME> <<EMAIL>>
# Copyright (c) 2021 <NAME>
#
# This file is part of Monet.
from typing import Tuple
import pandas as pd
import scanpy.tl as tl
import scanpy.pp as pp
import plotly.graph_objs as go
from ..core import ExpMatrix
from ..latent import PCAModel
from .cells import plot_cells
... | 2.375 | 2 |
add_exp_to_ref.py | C2SM/clim-sanity-checker | 0 | 12799705 | # standard modules
import os
import shutil
import argparse
# aliased standard modules
import pandas as pd
# modules of sanity checker
import lib.paths as paths
import lib.utils as utils
import lib.logger_config as logger_config
# standalone imports
from lib.logger_config import log
from lib.test_config import get_co... | 2.25 | 2 |
ml_rest_api/api/health/liveness.py | jgbustos/ml-rest-api | 15 | 12799706 | <gh_stars>10-100
"""This module implements the HealthLiveness class."""
from flask_restx import Resource
from ml_rest_api.api.restx import api, FlaskApiReturnType
@api.default_namespace.route("/liveness")
class HealthLiveness(Resource):
"""Implements the /liveness GET method."""
@staticmethod
@api.doc(
... | 2.25 | 2 |
tools/Vitis-AI-Quantizer/vai_q_tensorflow2.x/tensorflow_model_optimization/python/core/quantization/keras/vitis/common/vitis_custom_wrapper.py | hito0512/Vitis-AI | 1 | 12799707 | <reponame>hito0512/Vitis-AI
# Copyright 2019 Xilinx Inc.
#
# 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 l... | 1.984375 | 2 |
crosswalk_client/methods/domain/update_domain.py | The-Politico/django-crosswalk-client | 3 | 12799708 | from urllib.parse import urljoin
import requests
from crosswalk_client.exceptions import BadResponse
from crosswalk_client.objects.domain import DomainObject
from crosswalk_client.validators.domain import validate_required_domain_arg
class UpdateDomain(object):
@validate_required_domain_arg
def update_domai... | 2.75 | 3 |
openprocurement/auctions/core/plugins/awarding/v3/tests/migration.py | EBRD-ProzorroSale/openprocurement.auctions.core | 2 | 12799709 | <filename>openprocurement/auctions/core/plugins/awarding/v3/tests/migration.py
from zope import deprecation
deprecation.moved('openprocurement.auctions.core.tests.plugins.awarding.v3.tests.migration', 'version update')
| 0.964844 | 1 |
pybetter/item.py | cjwcommuny/pybetter | 0 | 12799710 | <filename>pybetter/item.py
def item(x):
assert len(x) == 1
return x[0]
| 2.078125 | 2 |
mozdns/sshfp/views.py | jlin/inventory | 22 | 12799711 | # Create your views here.
from mozdns.views import MozdnsDeleteView
from mozdns.views import MozdnsCreateView
from mozdns.views import MozdnsDetailView
from mozdns.views import MozdnsUpdateView
from mozdns.views import MozdnsListView
from mozdns.sshfp.models import SSHFP
from mozdns.sshfp.forms import SSHFPForm
class... | 2.09375 | 2 |
pyppeteer_stealth/__init__.py | ramiezer2/pyppeteer_stealth | 1 | 12799712 | <reponame>ramiezer2/pyppeteer_stealth
from pyppeteer.page import Page
from .chrome_app import chrome_app
from .chrome_runtime import chrome_runtime
from .iframe_content_window import iframe_content_window
from .media_codecs import media_codecs
from .sourceurl import sourceurl
from .navigator_hardware_concurrency impor... | 2.125 | 2 |
1-99/10-19/10.py | dcragusa/LeetCode | 0 | 12799713 | <filename>1-99/10-19/10.py
"""
Given an input string (s) and a pattern (p), implement regular expression matching with support for '.' and '*'.
'.' Matches any single character.
'*' Matches zero or more of the preceding element.
The matching should cover the entire input string (not partial).
Note:
s could be empty ... | 4.375 | 4 |
skyutils/aircraft.py | jacob-zeiger/skyspy | 12 | 12799714 | <reponame>jacob-zeiger/skyspy
from datetime import datetime, timedelta
from shapely.geometry import Point
class Aircraft:
def __init__(self, line):
ts = datetime.now()
self.hexcode = line[0:6]
self.flight = line[7:14].replace(" ", "")
self.description = f"{self.fligh... | 2.765625 | 3 |
setup.py | espg/mortie | 0 | 12799715 | # A minimal setup.py file to make a Python project installable.
import setuptools
import yaml
with open("README.md", "r") as fh:
long_description = fh.read()
with open("environment.yml", "r") as fh:
env = yaml.safe_load(fh)
requirements = [a.split('=', 1)[0].strip() for a in env['dependencies'] ]
setuptools... | 1.734375 | 2 |
tests/test_main_return_ptr.py | jiamo/pcc | 4 | 12799716 | import os
import sys
import ctypes
this_dir = os.path.dirname(__file__)
parent_dir = os.path.dirname(this_dir)
sys.path.insert(0, parent_dir)
from pcc.evaluater.c_evaluator import CEvaluator
import unittest
class TestMainReturnPtr(unittest.TestCase):
def test_simple(self):
pcc = CEvaluator()
re... | 2.8125 | 3 |
src/gilbert/plugins/markdown.py | funkybob/gilbert | 11 | 12799717 | from pathlib import Path
from markdown import markdown
from gilbert import Site
from gilbert.content import Page
from gilbert.types import LoaderResult
from gilbert.utils import oneshot
class MarkdownPage(Page):
"""
Page type that renders its content as Markdown.
Extensions can be configured in ``confi... | 2.578125 | 3 |
lib/exutils.py | miyagaw61/old_exgdb | 27 | 12799718 | import os
import sys
EXGDBFILE = os.path.abspath(os.path.expanduser(__file__))
sys.path.insert(0, os.path.dirname(EXGDBFILE) + "/lib/")
import utils
from enert import *
def clearscreen():
"""
Customized clearscreen from https://github.com/longld/peda
"""
print("\x1b[2J\x1b[H")
utils.clearscreen = cl... | 1.914063 | 2 |
classes/player.py | mcappleman/scoresheet-selenium | 0 | 12799719 | class Player():
def __init__(self, player):
self.name = player['espn_name']
self.position = player['espn_pos']
self.mlb_team = player['mlb_team']
self.throws = player['throws']
self.bats = player['bats']
self.espn_id = str(int(player['espn_id']))
self.bref_id... | 3.0625 | 3 |
clickatell/__init__.py | Kapooral/clickatell-python | 9 | 12799720 | import httplib2
import urllib
import json
import re
import sys
class Transport:
"""
Abstract representation of a transport class. Defines
the supported API methods
"""
endpoint = "platform.clickatell.com"
def __init__(self):
"""
Construct a new transportation instance.
... | 3.625 | 4 |
pkg/yc.py | rmc8/bibliography_alert | 0 | 12799721 | import os
import yaml
class YamlConfig:
def __init__(self, file_path: str = "./settings/config.yml"):
self.file_path = file_path
def exists(self) -> bool:
return os.path.exists(self.file_path)
def load(self) -> dict:
"""
:return: Return yaml data as dictionary fo... | 3.078125 | 3 |
src/pr_Sentinel1LakeArea_Ver3_Export.py | mbonnema/SWAV | 0 | 12799722 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
*******************************************************************************
Google Earth Engine Setninel-1 Lake Area
o Purpose: Estimate surface are of lake from Sentinel-1 SAR date, using
Google Earth Engine cloud computing platform
o Inputs:
* ROI... | 2.921875 | 3 |
tests/test_error_messages.py | tberlok/psecas | 10 | 12799723 | <filename>tests/test_error_messages.py
import numpy as np
from psecas import Solver, System
from psecas import ChebyshevExtremaGrid
import pytest
"""
We set up systems with errors, and see if Psecas gives a reasonable
error, i.e., a NameError.
"""
# Create grid
N = 32
grid = ChebyshevExtremaGrid(N, -1, 1)
# Create... | 2.796875 | 3 |
deepblink/cli/_check.py | BioinfoTongLI/deepBlink | 13 | 12799724 | <reponame>BioinfoTongLI/deepBlink
"""CLI submodule for checking image shapes."""
import logging
import os
import textwrap
from ..io import load_image
from ..util import predict_shape
class HandleCheck:
"""Handle checking submodule for CLI.
Args:
arg_input: Path to image.
logger: Verbose log... | 2.625 | 3 |
pnad/transformer/economy.py | fabiommendes/pnad | 1 | 12799725 | from .base import IncomeField, FunctionField, sum_na, Field
class IncomeDataMixin:
"""
All income-related variables
"""
year: int
#
# Main job
#
income_work_main_money_fixed = IncomeField({
(1992, ...): 'V9532', (1981, 1990): 'V537', 1979: 'V2318', 1978: 'V2426',
1977:... | 2.890625 | 3 |
Macroeconomia/Argentina/IndicadoresEmpleoDesocupacion.py | alejivo/Macroeconomics | 0 | 12799726 | <reponame>alejivo/Macroeconomics
import pandas as pd
import io
import requests
import json
class IndicadoresEmpleoDesocupacion:
def __init__(self):
"""
Los indicadores de empleo y desocupacion se basan en gran medida en la
EPC (encuesta permanente de hogares) en 31 aglomeraciones urba... | 3.4375 | 3 |
cs15211/KthLargestElementinaStream.py | JulyKikuAkita/PythonPrac | 1 | 12799727 | __source__ = 'https://leetcode.com/problems/kth-largest-element-in-a-stream/'
# Time: O()
# Space: O()
#
# Description: Leetcode # 703. Kth Largest Element in a Stream
#
# Design a class to find the kth largest element in a stream.
# Note that it is the kth largest element in the sorted order, not the kth distinct ele... | 3.875 | 4 |
examples/nv-hpc-sdk_test.py | owainkenwayucl/gepy | 0 | 12799728 | <gh_stars>0
#/usr/bin/env python3
# This script does a test of a particular nvidia compiler on Myriad
import sys
import os
import copy
import time
import gepy
import gepy.executor
compiler_module = 'compilers/nvhpc/21.11'
repo = 'https://github.com/UCL-RITS/pi_examples.git'
if (len(sys.argv) > 1):
compiler_modu... | 2.140625 | 2 |
robotino_ros/src/twist_motor_omni.py | aadi-mishra/robotino | 2 | 12799729 | <filename>robotino_ros/src/twist_motor_omni.py
#!/usr/bin/env python
import rospy
import roslib
import math
from std_msgs.msg import Float32,Int32, UInt8MultiArray, Bool, String
from geometry_msgs.msg import Twist
from sensor_msgs.msg import Range
import numpy as np
from numpy import linalg as al
class TwistToMotors(... | 2.5 | 2 |
ai.py | AyushAryal/chess | 9 | 12799730 | <gh_stars>1-10
from stockfish import Stockfish
def get_best_move(board):
stockfish = Stockfish()
move_list = []
for move in board.moves:
move_list.append(move.to_long_algebraic())
stockfish.set_position(move_list)
return long_algebraic_to_coordinate(stockfish.get_best_move())
def long_al... | 2.75 | 3 |
src/service/start.py | Ellie-Yen/-Python-Tic-Tac-Toe-Game | 0 | 12799731 | <gh_stars>0
from ..gameModel import GameModel
from ..appLib.messageFormatters import msgWelcome
async def start(cls: GameModel) -> None:
return msgWelcome() | 1.554688 | 2 |
exercicio_py/ex0002_tabuada_multiplicacao/main_v2.py | danielle8farias/Exercicios-Python-3 | 0 | 12799732 | <gh_stars>0
#!/usr/bin/env python3.8
########
# autora: <EMAIL>
# repositório: https://github.com/danielle8farias
# Descrição: Usuário digita um número inteiro e programa retorna a tabuada de multiplicação desse.
########
import sys
sys.path.append('/home/danielle8farias/hello-world-python3/meus_modulos')
from mensa... | 4.0625 | 4 |
beverages/models.py | vchrisb/Kudo4Coffee | 0 | 12799733 | from django.db import models
from django.utils import timezone
# Create your models here.
class Beverage(models.Model):
"""( description)"""
created_by = models.ForeignKey('auth.User', on_delete=models.SET_NULL, null=True)
name = models.CharField(max_length=100)
key = models.CharField(max_length=100)
... | 2.578125 | 3 |
glu/cli.py | chongkong/glu | 7 | 12799734 | <reponame>chongkong/glu
import argparse
import json
import yaml
import os
import logging
from collections import OrderedDict
from glu.util import OrderedDictYamlLoader
from glu import create_scope
def load_file(path):
if path.lower().endswith('.yml') or path.lower().endswith('.yaml'):
with open(path, 'r'... | 2.328125 | 2 |
handover/evaluation/test_cases/test_58_std.py | CN-UPB/sharp | 2 | 12799735 | <gh_stars>1-10
from ._base import *
class TestCase003(TestCase):
def __init__(self):
TestCase.__init__(self,
id='003',
alt_id='fixed_pps_increasing_pps_58_bytes',
description='Fixed PPS. Increasing State Transfer Duration. 58 By... | 1.820313 | 2 |
assignments/assignment2/layers.py | INeedTractorPlz/dlcourse_ai | 1 | 12799736 | <gh_stars>1-10
import numpy as np
from math import exp, log
def l2_regularization(W, reg_strength):
"""
Computes L2 regularization loss on weights and its gradient
Arguments:
W, np array - weights
reg_strength - float value
Returns:
loss, single value - l2 regularization loss
... | 3.4375 | 3 |
senergy/fixed_assets/doctype/fixed_asset_request/fixed_asset_request.py | TridotsTech/senergy | 0 | 12799737 | <reponame>TridotsTech/senergy
# -*- coding: utf-8 -*-
# Copyright (c) 2020, TeamPRO and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
import frappe
from frappe.model.document import Document
from frappe.model.mapper import get_mapped_doc
from frappe.utils import... | 1.703125 | 2 |
learn/decorator/1.py | PuddingWalker/py_small_projects | 0 | 12799738 | <reponame>PuddingWalker/py_small_projects
#########################################################################
# File Name: 1.py
# Author: Walker
# mail:<EMAIL>
# Created Time: Tue Dec 7 14:58:24 2021
#########################################################################
# !/usr/bin/env python3
import time
imp... | 2.6875 | 3 |
cantata/elements/synapse.py | kernfel/cantata | 0 | 12799739 | <filename>cantata/elements/synapse.py
import torch
from cantata import init
import cantata.elements as ce
class Synapse(ce.Module):
'''
Synapse with optional current, short- and long-term plasticity submodules
Input: Delayed presynaptic spikes; postsynaptic spikes; postsyn voltage
Output: Synaptic cur... | 2.1875 | 2 |
runtests.py | jmoujaes/dpaste | 0 | 12799740 | #!/usr/bin/env python
import sys
import django
from django.conf import settings
from django.test.runner import DiscoverRunner as TestRunner
SETTINGS = {
'DATABASES': {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': 'dev.db',
},
# 'default': {
... | 1.953125 | 2 |
raspi_components/light/light.py | builderdev212/raspi_components | 1 | 12799741 | import RPi.GPIO as GPIO
from .light_errors import LedError
class Led:
"""
This is a class used to control LED's directly connected to the GPIO via a pin given.
See the documentation for an example of how to wire the LED.
"""
def __init__(self, pin):
"""
This initates the LED on the ... | 4.1875 | 4 |
kimura/run.py | prprhyt/pacman | 0 | 12799742 | <reponame>prprhyt/pacman
# -*- coding: utf-8 -*-
# ! /usr/bin/python
#NLPでやってみた
#参考: https://spjai.com/category-classification/#i-5
import pandas as pd
import numpy as np
from sklearn.preprocessing import LabelEncoder
from sklearn.externals import joblib
import os.path
import kimura.nlp_tasks as nlp_tasks
from sklea... | 3.1875 | 3 |
src/pynn/bin/average_state.py | enesyugan/yapay-nn | 0 | 12799743 | <reponame>enesyugan/yapay-nn<gh_stars>0
#!/usr/bin/env python3
# encoding: utf-8
# Copyright 2019 <NAME>
# Licensed under the Apache License, Version 2.0 (the "License")
import os, glob
import copy
import argparse
import torch
from pynn.util import load_object_param
parser = argparse.ArgumentParser(description='py... | 1.796875 | 2 |
integrators.py | marghetis/npde | 37 | 12799744 | <reponame>marghetis/npde
import numpy as np
import tensorflow as tf
from tensorflow.python.ops import math_ops
from tensorflow.python.ops import functional_ops
from tensorflow.python.ops import array_ops
from tensorflow.python.framework import ops
from abc import ABC, abstractmethod
float_type = tf.float64
class Int... | 2.515625 | 3 |
teamcomp/Window.py | khanfluence/team-comp | 0 | 12799745 | import os
import pickle
import re
import requests
import tkinter
from tkinter import ttk
from Hero import Hero
from SearchListbox import SearchListbox
from Team import Team
class Window(ttk.Frame):
def __init__(self, root=None):
super().__init__(root)
self.root = root
self.root.title("team... | 2.953125 | 3 |
examples/surveillance_edge_constrained.py | agmangas/wotemu | 2 | 12799746 | <gh_stars>1-10
import json
from docker.types import RestartPolicy
from wotemu.enums import NetworkConditions
from wotemu.topology.models import (Broker, BuiltinApps, Network, Node,
NodeApp, NodeResources, Service, Topology)
_ID_1 = "loc1"
_ID_2 = "loc2"
_THING_ID_DETECTOR = "urn:o... | 2.015625 | 2 |
bulletin/tools/plugins/api/job/views.py | rerb/django-bulletin | 5 | 12799747 | <gh_stars>1-10
from bulletin.api import permissions
from bulletin.api.views import PostList, PostDetail
import serializers
from bulletin.tools.plugins.models import Job
class JobList(PostList):
queryset = Job.objects.all()
serializer_class = serializers.JobSerializer
permission_classes = (permissions.IsAd... | 1.984375 | 2 |
learn_python/hexlet/lists/lessons/multiply_matrix.py | PavliukKonstantin/learn-python | 0 | 12799748 | <reponame>PavliukKonstantin/learn-python
# Операция умножения двух матриц А и В представляет собой вычисление
# результирующей матрицы С, где каждый элемент C(ij) равен сумме произведений
# элементов в соответствующей строке первой матрицы A(ik) и элементов
# в столбце второй матрицы B(kj).
#
# Две матрицы можно перемн... | 2.9375 | 3 |
generative/pix2sketch.py | judithfan/pix2svg | 3 | 12799749 | from __future__ import division
from __future__ import print_function
from __future__ import absolute_import
if __name__ == '__main__':
import os
import argparse
from PIL import Image
import torch
import torchvision.transforms as transforms
from torch.autograd import Variable
from beamse... | 2.296875 | 2 |
codes/2/4.py | BigShuang/python-introductory-exercises | 0 | 12799750 | def get_lcm(a, b):
multiple = a * b
max_v = a
if b > a:
max_v = b
for i in range(max_v, multiple):
if i % a == 0 and i % b == 0:
return i
return multiple
print(get_lcm(6, 8))
print(get_lcm(12, 15))
| 3.765625 | 4 |