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 |
|---|---|---|---|---|---|---|
core/power_status_monitor.py | kangyifei/CloudSimPy | 0 | 20100 | <gh_stars>0
import json
class PowerStateMonitor(object):
def __init__(self, simulation):
self.simulation = simulation
self.env = simulation.env
self.event_file = simulation.event_file + "_power"
self.events = []
def __cal_machine_power(self):
machines = self.simulation... | 2.71875 | 3 |
maintest.py | thorsilver/ABM-for-social-care | 0 | 20101 | <reponame>thorsilver/ABM-for-social-care
from sim import Sim
import os
import cProfile
import pylab
import math
import matplotlib.pyplot as plt
import argparse
import json
import decimal
import numpy as np
def init_params():
"""Set up the simulation parameters."""
p = {}
## The basics: starting populati... | 2.765625 | 3 |
mainapp/views.py | MelqonHovhannisyan/weather | 0 | 20102 | from django.shortcuts import render
from rest_framework.viewsets import ViewSet
from rest_framework.response import Response
from .serializers import WeatherSerializer
import requests
import json
import math
import os
import yaml
from rest_framework.decorators import action
from django.conf import settings
def api_do... | 2.109375 | 2 |
tests/test_backtrack.py | nisaruj/algorithms | 6 | 20103 | <reponame>nisaruj/algorithms
from algorithms.backtrack import (
add_operators,
permute,
permute_iter,
anagram,
array_sum_combinations,
unique_array_sum_combinations,
combination_sum,
find_words,
pattern_match,
)
import unittest
from algorithms.backtrack.generate_parenthesis import *... | 3.609375 | 4 |
syncless/wscherry.py | irr/python-labs | 4 | 20104 | import sys
sys.path.append("/usr/lib/python2.7/site-packages")
import redis
_r = redis.Redis(host='localhost', port=6379, db=0)
import cherrypy
class Test(object):
def index(self):
_r.incr("/")
return "OK!"
index.exposed = True
cherrypy.quickstart(Test())
| 2.28125 | 2 |
server.py | celinekeisja/jobmonitorservice | 0 | 20105 | <filename>server.py
from flask_script import Manager
from flask_migrate import Migrate, MigrateCommand
from config import db
import config
app = config.connex_app
app.add_api('swagger.yml')
@app.route('/')
def home():
return 'homepage here'
@app.route("/job")
@app.route("/job/<string:job_id>")
def job(job_id=""... | 2.34375 | 2 |
website/addons/figshare/views/config.py | harrismendell/osf.io | 0 | 20106 | # -*- coding: utf-8 -*-
import httplib as http
from flask import request
from framework.exceptions import HTTPError
from framework.auth.decorators import must_be_logged_in
from website.util import web_url_for
from website.project.decorators import (
must_have_addon, must_be_addon_authorizer,
must_have_permi... | 2.1875 | 2 |
orquesta/utils/dictionary.py | igcherkaev/orquesta | 85 | 20107 | <reponame>igcherkaev/orquesta
# Copyright 2019 Extreme Networks, 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... | 2.09375 | 2 |
leetcode_py.py | HuangJingGitHub/PracMakePert_py | 2 | 20108 | <filename>leetcode_py.py
class solutionLeetcode_3:
def lengthOfLongestSubstring(self, s: str) -> (int, str):
if not s:
return 0
left = 0
lookup = set()
n = len(s)
max_len = 0
cur_len = 0
for i in range(n):
cur_len += 1
while... | 3.109375 | 3 |
examples/twisted/websocket/auth_persona/server.py | rapyuta-robotics/autobahn-python | 1,670 | 20109 | ###############################################################################
#
# The MIT License (MIT)
#
# Copyright (c) Crossbar.io Technologies GmbH
#
# 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 ... | 1.53125 | 2 |
src/ggrc_risks/models/risk.py | Killswitchz/ggrc-core | 0 | 20110 | <gh_stars>0
# Copyright (C) 2017 Google Inc.
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
from sqlalchemy.ext.declarative import declared_attr
from ggrc import db
from ggrc.access_control.roleable import Roleable
from ggrc.fulltext.mixin import Indexed
from ggrc.models.associationpro... | 1.828125 | 2 |
booknlp/common/calc_coref_metrics.py | ishine/booknlp | 539 | 20111 | import subprocess, re, sys
def get_coref_score(metric, path_to_scorer, gold=None, preds=None):
output=subprocess.check_output(["perl", path_to_scorer, metric, preds, gold]).decode("utf-8")
output=output.split("\n")[-3]
matcher=re.search("Coreference: Recall: \(.*?\) (.*?)% Precision: \(.*?\) (.*?)% F1: (.*?)%", ou... | 2.296875 | 2 |
apps/core/test.py | zjjott/html | 0 | 20112 | <gh_stars>0
# coding=utf-8
from __future__ import unicode_literals
from tornado.testing import AsyncTestCase
from apps.core.models import (ModelBase,
_get_master_engine,
_get_slave_engine)
from tornado.options import options
from apps.core.urlutils import urlp... | 1.945313 | 2 |
docker/aws/update_event_mapping.py | uk-gov-mirror/nationalarchives.tdr-jenkins | 0 | 20113 | <reponame>uk-gov-mirror/nationalarchives.tdr-jenkins<filename>docker/aws/update_event_mapping.py
import sys
from sessions import get_session
account_number = sys.argv[1]
stage = sys.argv[2]
function_name = sys.argv[3]
version = sys.argv[4]
function_arn = f'arn:aws:lambda:eu-west-2:{account_number}:function:{function_... | 1.96875 | 2 |
src/python/compressao_huffman.py | willisnou/Algoritmos-e-Estruturas-de-Dados | 653 | 20114 | <reponame>willisnou/Algoritmos-e-Estruturas-de-Dados
# Árvore Huffman
class node:
def __init__(self, freq, symbol, left=None, right=None):
# Frequência do Símbolo
self.freq = freq
# Símbolo (caracter)
self.symbol = symbol
# nó à esquerda do nó atual
self.left = left... | 3.8125 | 4 |
optiga.py | boraozgen/personalize-optiga-trust | 6 | 20115 | import argparse
import json
import base64
import hashlib
import sys
import binascii
from optigatrust.util.types import *
from optigatrust.pk import *
from optigatrust.x509 import *
private_key_slot_map = {
'second': KeyId.ECC_KEY_E0F1,
'0xE0E1': KeyId.ECC_KEY_E0F1,
'0xE0F1': KeyId.ECC_KEY_E0F1... | 1.71875 | 2 |
graph_test.py | MathewMacDougall/Two-Faced-Type | 0 | 20116 | <gh_stars>0
import unittest
from graph import Graph
class TestGraph(unittest.TestCase):
def test_create_graph_simple(self):
graph = Graph()
graph.add_edge(0, 1)
graph.add_edge(1, 2)
graph.add_edge(2, 0)
graph.add_edge(2, 0) # Test double edges don't make a difference
... | 3.328125 | 3 |
cfnbootstrap/construction_errors.py | roberthutto/aws-cfn-bootstrap | 0 | 20117 | <reponame>roberthutto/aws-cfn-bootstrap
#==============================================================================
# Copyright 2011 Amazon.com, Inc. or its affiliates. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the ... | 2.21875 | 2 |
tests/test_variable.py | snc2/tequila | 1 | 20118 | import pytest
from tequila import numpy as np
from tequila.circuit.gradient import grad
from tequila.objective.objective import Objective, Variable
import operator
def test_nesting():
a = Variable(name='a')
variables = {a: 3.0}
b = a + 2 - 2
c = (b * 5) / 5
d = -(-c)
e = d ** 0.5
f = e ** ... | 2.515625 | 3 |
getnear/tseries.py | edwardspeyer/getnear | 0 | 20119 | from getnear.config import Tagged, Untagged, Ignore
from getnear.logging import info
from lxml import etree
import re
import requests
import telnetlib
def connect(hostname, *args, **kwargs):
url = f'http://{hostname}/'
html = requests.get(url).text
doc = etree.HTML(html)
for title in doc.xpath('//titl... | 2.34375 | 2 |
Tests/subset/svg_test.py | ThomasRettig/fonttools | 2,705 | 20120 | from string import ascii_letters
import textwrap
from fontTools.misc.testTools import getXML
from fontTools import subset
from fontTools.fontBuilder import FontBuilder
from fontTools.pens.ttGlyphPen import TTGlyphPen
from fontTools.ttLib import TTFont, newTable
from fontTools.subset.svg import NAMESPACES, ranges
impo... | 2.3125 | 2 |
models/dl-weights.py | diegoinacio/object-detection-flask-opencv | 16 | 20121 | <filename>models/dl-weights.py
"""
This script downloads the weight file
"""
import requests
URL = "https://pjreddie.com/media/files/yolov3.weights"
r = requests.get(URL, allow_redirects=True)
open('yolov3_t.weights', 'wb').write(r.content)
| 2.5625 | 3 |
utim-esp32/modules/utim/utilities/process_device.py | connax-utim/utim-micropython | 0 | 20122 | """
Subprocessor for device messages
"""
import logging
from ..utilities.tag import Tag
from ..workers import device_worker_forward
from ..workers import device_worker_startup
from ..utilities.address import Address
from ..utilities.status import Status
from ..utilities.data_indexes import SubprocessorIndex
_Subproces... | 2.65625 | 3 |
TrainAndTest/Fbank/LSTMs/__init__.py | Wenhao-Yang/DeepSpeaker-pytorch | 8 | 20123 | <filename>TrainAndTest/Fbank/LSTMs/__init__.py
#!/usr/bin/env python
# encoding: utf-8
"""
@Author: yangwenhao
@Contact: <EMAIL>
@Software: PyCharm
@File: __init__.py.py
@Time: 2020/3/27 10:43 AM
@Overview:
"""
| 0.882813 | 1 |
ninja/security/__init__.py | lsaavedr/django-ninja | 0 | 20124 | from ninja.security.apikey import APIKeyQuery, APIKeyCookie, APIKeyHeader
from ninja.security.http import HttpBearer, HttpBasicAuth
def django_auth(request):
if request.user.is_authenticated:
return request.user
| 1.84375 | 2 |
migrations/versions/66d4be40bced_add_attribute_to_handle_multiline_.py | eubr-bigsea/limonero | 1 | 20125 | <filename>migrations/versions/66d4be40bced_add_attribute_to_handle_multiline_.py
"""Add attribute to handle multiline information
Revision ID: 66d4be40bced
Revises: <PASSWORD>
Create Date: 2018-05-16 12:13:32.023450
"""
import sqlalchemy as sa
from alembic import op
from limonero.migration_utils import is_sqlite
# r... | 1.53125 | 2 |
config.py | kxxoling/horus | 0 | 20126 | import os
BASE_DIR = os.path.abspath(os.path.dirname(__file__))
CSRF_ENABLED = True
SECRET_KEY = 'you-will-never-guess'
SQLITE = 'db.sqlite3'
SQLALCHEMY_DATABASE_URI = 'sqlite:///' + os.path.join(BASE_DIR, SQLITE) + '?check_same_thread=False'
| 1.679688 | 2 |
tests/test_lp_problem.py | LovisAnderson/flipy | 0 | 20127 | import pytest
from flipy.lp_problem import LpProblem
from flipy.lp_objective import LpObjective, Maximize
from flipy.lp_variable import LpVariable
from flipy.lp_expression import LpExpression
from flipy.lp_constraint import LpConstraint
from io import StringIO
@pytest.fixture
def problem():
return LpProblem('te... | 2.390625 | 2 |
src/invoice_medicine/apps.py | vandana0608/Pharmacy-Managament | 0 | 20128 | from django.apps import AppConfig
class InvoiceMedicineConfig(AppConfig):
name = 'invoice_medicine'
| 1.078125 | 1 |
tests/components/tectonics/test_listric_kinematic_extender.py | amanaster2/landlab | 257 | 20129 | <reponame>amanaster2/landlab<filename>tests/components/tectonics/test_listric_kinematic_extender.py
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri Mar 5 08:42:24 2021
@author: gtucker
"""
from numpy.testing import assert_array_almost_equal, assert_array_equal, assert_raises
from landlab import He... | 2.015625 | 2 |
unbalanced_dataset/under_sampling.py | designer357/IGBB | 1 | 20130 | <reponame>designer357/IGBB
from __future__ import print_function
from __future__ import division
import numpy as np
from numpy import logical_not, ones
from numpy.random import seed, randint
from numpy import concatenate
from random import sample
from collections import Counter
from .unbalanced_dataset import Unbalance... | 2.984375 | 3 |
wikipron/extract/cmn.py | Alireza-Sampour/wikipron | 1 | 20131 | <gh_stars>1-10
"""Word and pron extraction for (Mandarin) Chinese."""
import itertools
import typing
import requests
from wikipron.extract.default import yield_pron, IPA_XPATH_SELECTOR
if typing.TYPE_CHECKING:
from wikipron.config import Config
from wikipron.typing import Iterator, Word, Pron, WordPronPair... | 2.734375 | 3 |
iis/tests/test_e2e.py | tcpatterson/integrations-core | 0 | 20132 | <filename>iis/tests/test_e2e.py
# (C) Datadog, Inc. 2022-present
# All rights reserved
# Licensed under Simplified BSD License (see LICENSE)
import pytest
from datadog_checks.dev.testing import requires_py3
from datadog_checks.iis import IIS
@pytest.mark.e2e
@requires_py3
def test_e2e_py3(dd_agent_check, aggregator... | 1.414063 | 1 |
scripts/utils/param_grid_to_files.py | bagustris/emotion | 3 | 20133 | from pathlib import Path
import click
import yaml
from sklearn.model_selection import ParameterGrid
from ertk.utils import PathlibPath, get_arg_mapping
@click.command()
@click.argument("param_grid", type=PathlibPath(exists=True, dir_okay=False))
@click.argument("output", type=Path)
@click.option("--format", help="F... | 2.84375 | 3 |
mangabee_parsers.py | ta-dachi/mangaget | 0 | 20134 | <gh_stars>0
from html.parser import HTMLParser
class mangabeeSearchParser(HTMLParser):
def __init__(self):
HTMLParser.__init__(self)
self.inLink = False
self.lastTag = None
self.lastClass = None
self.urls = [] # Where we store our results
def handle_starttag(sel... | 2.953125 | 3 |
bme280/reader.py | budrom/dht2eleasticsearch | 0 | 20135 | <gh_stars>0
#!/usr/bin/python3
import os
import threading
import sys
from Adafruit_BME280 import *
from datetime import datetime
from elasticsearch import Elasticsearch
def readSensor():
# Timestamp for report
timestamp = datetime.utcnow()
# Recursively initiate next reading in a minute
threading.Timer(60-flo... | 2.734375 | 3 |
tests/web/backend_pytest.py | brumar/eel-for-transcrypt | 1 | 20136 | <gh_stars>1-10
import eel_for_transcrypt as eel
from web.common import InventoryItem
@eel.expose
def i_return_the_same(anything):
return anything
@eel.expose
def a_generator(mn, mx):
yield from range(mn, mx)
@eel.expose
@eel.apply_factories(inputfactory=InventoryItem)
def return_a_dataclass(datac: Inve... | 2.234375 | 2 |
tests/test_polygon.py | tilezen/mapbox-vector-tile | 121 | 20137 | # -*- coding: utf-8 -*-
"""
Tests for vector_tile/polygon.py
"""
import unittest
from mapbox_vector_tile.polygon import make_it_valid
from shapely import wkt
import os
class TestPolygonMakeValid(unittest.TestCase):
def test_dev_errors(self):
test_dir = os.path.dirname(os.path.realpath(__file__))
... | 2.484375 | 2 |
snake_debug.py | xlrobotics/PPOC-balance-bot | 3 | 20138 | <gh_stars>1-10
import gym
# from stable_baselines import DQN as deepq
from stable_baselines import A2C as ac
from stable_baselines.common.policies import MlpLnLstmPolicy
import snake_bot
if __name__ == '__main__':
env = gym.make("snakebot-v0")
env.debug_mode()
exit(0) | 1.484375 | 1 |
easy/572_subtree_of_another_tree.py | niki4/leetcode_py3 | 0 | 20139 | """
Given the roots of two binary trees root and subRoot, return true if there is a subtree of root with the same structure
and node values of subRoot and false otherwise.
A subtree of a binary tree tree is a tree that consists of a node in tree and all of this node's descendants.
The tree tree could also be considere... | 3.734375 | 4 |
pyeccodes/defs/grib2/localConcepts/cnmc/name_def.py | ecmwf/pyeccodes | 7 | 20140 | <reponame>ecmwf/pyeccodes
import pyeccodes.accessors as _
def load(h):
def wrapped(h):
discipline = h.get_l('discipline')
parameterCategory = h.get_l('parameterCategory')
parameterNumber = h.get_l('parameterNumber')
instrumentType = h.get_l('instrumentType')
satelliteSeri... | 2.375 | 2 |
perspective_transform.py | shengchen-liu/CarND-Advanced_Lane_Finding | 0 | 20141 | <reponame>shengchen-liu/CarND-Advanced_Lane_Finding
import numpy as np
import cv2
import matplotlib.pyplot as plt
from calibration_utils import calibrate_camera, undistort
import glob
import matplotlib.image as mpimg
import pickle
from threshold import binarize
def perspective_transform(img, verbose=False):
"""
... | 2.6875 | 3 |
epgrefresh/src/plugin.py | builder08/enigma2-plugins_2 | 0 | 20142 | from __future__ import print_function
# for localized messages
from . import _, NOTIFICATIONDOMAIN
# Config
from Components.config import config, ConfigYesNo, ConfigNumber, ConfigSelection, \
ConfigSubsection, ConfigClock, ConfigYesNo, ConfigInteger, NoSave
from Screens.MessageBox import MessageBox
from Screens.Stan... | 1.71875 | 2 |
ongoing/prescriptors/bandit/bandit_prescriptor.py | bradyneal/covid-xprize-comp | 0 | 20143 | <reponame>bradyneal/covid-xprize-comp
import numpy as np
import pandas as pd
import os
from copy import deepcopy
import datetime
import pickle
import time
import copy
os.system('export PYTHONPATH="$(pwd):$PYTHONPATH"')
from ongoing.prescriptors.base import BasePrescriptor, PRED_CASES_COL, CASES_COL, NPI_COLUMNS, NPI_M... | 1.976563 | 2 |
examples/server.py | zaibon/tcprouter | 5 | 20144 | <reponame>zaibon/tcprouter
from gevent import monkey; monkey.patch_all()
import logging
from gevent.server import StreamServer
logging.basicConfig(level=logging.INFO)
logger = logging.getLogger(__name__)
class Receiver(object):
""" Interface for a receiver - mimics Twisted's protocols
"""
def __init__(s... | 2.4375 | 2 |
starter.py | device42/DOQL_scripts_examples | 7 | 20145 | # encoding: utf-8
import os
import ssl
import sys
import csv
import json
import time
import base64
from datetime import datetime
from datetime import timedelta
try:
import pyodbc
except ImportError:
pass
# PYTHON 2 FALLBACK #
try:
from urllib.request import urlopen, Request
from urllib.parse import... | 2.59375 | 3 |
docs/conf.py | donatelli01/donatelli_documentations | 0 | 20146 | <reponame>donatelli01/donatelli_documentations<filename>docs/conf.py
# -*- coding: utf-8 -*-
import sys, os
sys.path.insert(0, os.path.abspath('extensions'))
extensions = ['sphinx.ext.autodoc', 'sphinx.ext.doctest', 'sphinx.ext.todo',
'sphinx.ext.coverage', 'sphinx.ext.pngmath', 'sphinx.ext.ifconfig',
... | 1.601563 | 2 |
sapphire/simulation.py | alexanderzimmerman/sapphire | 10 | 20147 | <gh_stars>1-10
"""Provides a class for constructing simulations based on Firedrake.
Simulations proceed forward in time by solving
a sequence of Initial Boundary Values Problems (IBVP's).
Using the Firedrake framework,
the PDE's are discretized in space with Finite Elements (FE).
The symbolic capabilities of Fired... | 3.078125 | 3 |
lookmlint/lookmlint.py | kingfink/lookmlint | 0 | 20148 | <filename>lookmlint/lookmlint.py
from collections import Counter
import json
import os
import re
import subprocess
import attr
import yaml
@attr.s
class ExploreView(object):
data = attr.ib(repr=False)
explore = attr.ib(init=False, repr=False)
name = attr.ib(init=False, repr=True)
source_view = attr.... | 2.46875 | 2 |
book-code/numpy-ml/numpy_ml/utils/testing.py | yangninghua/code_library | 0 | 20149 | <reponame>yangninghua/code_library
"""Utilities for writing unit tests"""
import numbers
import numpy as np
#######################################################################
# Assertions #
##################################################################... | 3.71875 | 4 |
test/test_googleoauth2.py | GallopLabs/libsaas | 0 | 20150 | import unittest
from libsaas.executors import test_executor
from libsaas.services import googleoauth2
class GoogleOauth2TestCase(unittest.TestCase):
def setUp(self):
self.executor = test_executor.use()
self.executor.set_response(b'{}', 200, {})
self.service = googleoauth2.GoogleOAuth2('... | 2.59375 | 3 |
post_office/migrations/0001_initial.py | carrerasrodrigo/django-post_office | 0 | 20151 | <filename>post_office/migrations/0001_initial.py<gh_stars>0
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import jsonfield.fields
import post_office.fields
import post_office.validators
import post_office.models
class Migration(migrations.Migration):
de... | 1.882813 | 2 |
ic_gan/data_utils/store_kmeans_indexes.py | ozcelikfu/IC-GAN_fMRI_Reconstruction | 0 | 20152 | <reponame>ozcelikfu/IC-GAN_fMRI_Reconstruction
# Copyright (c) Facebook, Inc. and its affiliates.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
"""Store dataset indexes of datapoints selected by k-means algorithm."""
fro... | 2.234375 | 2 |
src/cattrs/errors.py | aha79/cattrs | 0 | 20153 | <filename>src/cattrs/errors.py
from cattr.errors import StructureHandlerNotFoundError
__all__ = ["StructureHandlerNotFoundError"]
| 1.398438 | 1 |
plugins/funcs.py | prxpostern/URLtoTG003 | 0 | 20154 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
from main import Config
from pyrogram import filters
from pyrogram import Client
#from pyrogram.types import InlineKeyboardMarkup, InlineKeyboardButton
from urllib.parse import quote_plus, unquote
import math, os, time, datetime, aiohttp, asyncio, mimetypes, loggi... | 2.046875 | 2 |
git_code_debt/repo_parser.py | cclauss/git-code-debt | 0 | 20155 | <filename>git_code_debt/repo_parser.py
from __future__ import absolute_import
from __future__ import unicode_literals
import collections
import contextlib
import shutil
import subprocess
import tempfile
from git_code_debt.util.iter import chunk_iter
from git_code_debt.util.subprocess import cmd_output
Commit = coll... | 2.40625 | 2 |
func_one.py | FoxProklya/Step-Python | 0 | 20156 | def f(x):
if x <= -2:
f = 1 - (x + 2)**2
return f
if -2 < x <= 2:
f = -(x/2)
return f
if 2 < x:
f = (x - 2)**2 + 1
return f
x = int(input())
print(f(x))
| 3.828125 | 4 |
scripts/multiprocess_tokenizer/worker.py | talolard/vampire | 0 | 20157 | import typing
from typing import Any
import json
import os
from multiprocessing import Process, Queue
from allennlp.data.tokenizers.word_splitter import SpacyWordSplitter
from spacy.tokenizer import Tokenizer
import spacy
from tqdm.auto import tqdm
import time
nlp = spacy.load("en")
class TokenizingWorker(Process):... | 2.5625 | 3 |
MC-Fisher.py | hosua/Minecraft-Fisher | 0 | 20158 | <reponame>hosua/Minecraft-Fisher<gh_stars>0
# For larger scale projects, I really should learn to use classes... lol
from PIL import ImageGrab, ImageTk, Image
import keyboard
import pyautogui
import tkinter as tk
import os
import time, datetime
import text_redirect as TR
import sys
# GUI stuff
TITLE = "Minecraft-Fish... | 2.90625 | 3 |
ModelAnalysis/biomodel_iterator.py | BioModelTools/ModelAnalysis | 0 | 20159 | <filename>ModelAnalysis/biomodel_iterator.py
"""
Iterates through a collection of BioModels
"""
from sbml_shim import SBMLShim
import sys
import os.path
################################################
# Classes that count pattern occurrences
################################################
class BiomodelIterator(obje... | 3.25 | 3 |
app/domain/company/models.py | JBizarri/fast-api-crud | 0 | 20160 | <filename>app/domain/company/models.py
from __future__ import annotations
from typing import TYPE_CHECKING, List
from sqlalchemy import Column, String
from sqlalchemy.orm import relationship
from ...database import BaseModel
if TYPE_CHECKING:
from ..user.models import User
class Company(BaseModel):
name: ... | 2.5 | 2 |
tools/captcha_image_downloader.py | metormaon/signum-py | 0 | 20161 | <reponame>metormaon/signum-py<gh_stars>0
# -*- coding: utf-8 -*-
from os import path
from google_images_download import google_images_download
for keyword in [
"dog", "cat", "bird", "elephant", "fork", "knife", "spoon", "carrot", "orange", "turnip", "tomato", "potato",
"water", "hair", "table", "chair", "hous... | 1.84375 | 2 |
modules/winrm/isodate/__init__.py | frankyrumple/smc | 0 | 20162 | ##############################################################################
# Copyright 2009, <NAME>
# 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 r... | 1.445313 | 1 |
sbvat/utils.py | thudzj/BVAT | 3 | 20163 | <gh_stars>1-10
import numpy as np
import pickle as pkl
import networkx as nx
import scipy.sparse as sp
from scipy.sparse.linalg.eigen.arpack import eigsh
import sys
import tensorflow as tf
import os
import time
import json
from networkx.readwrite import json_graph
from sklearn.metrics import f1_score
import multiproces... | 1.96875 | 2 |
tags/models.py | yuyuyuhaoshi/Blog-BE | 0 | 20164 | <filename>tags/models.py<gh_stars>0
from django.db import models
from django.utils.timezone import now
from django.contrib.auth.models import User
from utils.base_model import SoftDeletionModel
class Tag(SoftDeletionModel):
name = models.CharField('标题名', max_length=100, unique=True, blank=False, null=False)
... | 1.984375 | 2 |
validate_staging_area.py | DataBiosphere/hca-import-validation | 0 | 20165 | <reponame>DataBiosphere/hca-import-validation
"""
Runs a pre-check of a staging area to identify issues that might cause the
snapshot or indexing processes to fail.
"""
import argparse
import sys
from hca.staging_area_validator import StagingAreaValidator
def _parse_args(argv):
parser = argparse.ArgumentParser(de... | 2.703125 | 3 |
spider_service/app/spider/selenium/webdriver.py | seniortesting/python-spider | 0 | 20166 | # -*- coding:utf-8 -*-
import random
import time
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.common.keys import Keys
from app.api.util.web_request import WebRequest, USER_AGENT_PC, USER_AGENT_MOBILE
class SpiderWebDriver(object):
def __init__(sel... | 2.515625 | 3 |
Extended Programming Challenges Python/Mnozenie Macierzy/test_main.py | szachovy/School-and-Training | 0 | 20167 | <reponame>szachovy/School-and-Training
import unittest
import main
import re
class MatrixRowsVerification(unittest.TestCase):
def setUp(self):
self.matrix1 = {0: [1, 2, 3], 1: [4, 5, 6]}
self.matrix2 = {0: [1, 2], 1: [3, 4], 2: [5, 6]}
def test_getRowsType(self):
self.assertIsInstance(... | 3.078125 | 3 |
setup.py | m45t3r/livedumper | 17 | 20168 | <filename>setup.py
import os
from setuptools import setup
def read(fname):
filename = os.path.join(os.path.dirname(__file__), fname)
return open(filename).read().replace('#', '')
setup(
name="livedumper",
version="0.3.0",
author="<NAME>",
author_email="<EMAIL>",
description=("Livestreamer... | 1.859375 | 2 |
scripts/show_yolo.py | markpp/object_detectors | 2 | 20169 | import os
import argparse
import numpy as np
import csv
import cv2
img_w = 0
img_h = 0
def relativ2pixel(detection, frameHeight, frameWidth):
center_x, center_y = int(detection[0] * frameWidth), int(detection[1] * frameHeight)
width, height = int(detection[2] * frameWidth), int(detection[3] * frameHeight)
... | 2.828125 | 3 |
xp/build/scripts/gg_post_process_xcode_project.py | vladcorneci/golden-gate | 262 | 20170 | <gh_stars>100-1000
#! /urs/bin/env python
# Copyright 2017-2020 Fitbit, Inc
# SPDX-License-Identifier: Apache-2.0
#####################################################################
# This script post-processes the XCode project generated
# by CMake, so that it no longer contains absolute paths.
# It also remaps UU... | 1.554688 | 2 |
scripts/US-visa-early-appointment.py | atb00ker/scripts-lab | 2 | 20171 | <filename>scripts/US-visa-early-appointment.py
#!/bin/python3
# Application for getting early US visa interview:
# The tool will Scrape the CGI website and check
# available date before the current appointment date,
# if a date is available, the program will beep.
# NOTE: SET THESE GLOBAL VARIABLES BEFORE USE
# COOKIE... | 2.421875 | 2 |
LeetCode/lc960.py | SryImNoob/ProblemSet-1 | 0 | 20172 | <reponame>SryImNoob/ProblemSet-1<gh_stars>0
def createArray(dims) :
if len(dims) == 1:
return [0 for _ in range(dims[0])]
return [createArray(dims[1:]) for _ in range(dims[0])]
def f(A, x, y):
m = len(A)
for i in range(m):
if A[i][x] > A[i][y]:
return 0
return 1
class Solution(ob... | 3.03125 | 3 |
src/misc_utils.py | wr339988/TencentAlgo19 | 0 | 20173 | # Copyright 2017 Google Inc. 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://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... | 2.71875 | 3 |
custom/icds_reports/ucr/tests/test_infra_form_ucr.py | rochakchauhan/commcare-hq | 1 | 20174 | <filename>custom/icds_reports/ucr/tests/test_infra_form_ucr.py
from mock import patch
from custom.icds_reports.ucr.tests.test_base_form_ucr import BaseFormsTest
@patch('custom.icds_reports.ucr.expressions._get_user_location_id',
lambda user_id: 'qwe56poiuytr4xcvbnmkjfghwerffdaa')
@patch('corehq.apps.locations... | 1.804688 | 2 |
uq_benchmark_2019/imagenet/end_to_end_test.py | deepneuralmachine/google-research | 23,901 | 20175 | <gh_stars>1000+
# coding=utf-8
# Copyright 2021 The Google Research 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requ... | 1.820313 | 2 |
tests/windows/get_physicaldisk/test_getting_unique_ids_from_output.py | Abd-Elrazek/InQRy | 37 | 20176 | from inqry.system_specs import win_physical_disk
UNIQUE_ID_OUTPUT = """
UniqueId
--------
{256a2559-ce63-5434-1bee-3ff629daa3a7}
{4069d186-f178-856e-cff3-ba250c28446d}
{4da19f06-2e28-2722-a0fb-33c02696abcd}
50014EE20D887D66
eui.0025384161B6798A
5000C5007A75E216
500A07510F1A545C
ATA LITEONIT LMT-256M6M mSATA 256GB ... | 1.78125 | 2 |
app/models/link.py | aries-zhang/flask-template | 0 | 20177 | import time # NOQA
from app import db
class Link(db.Model):
id = db.Column(db.Integer, primary_key=True)
title = db.Column(db.String)
url = db.Column(db.String)
description = db.Column(db.String)
type = db.Column(db.Integer)
enabled = db.Column(db.Boolean)
createtime = db.Column(db.DateTi... | 2.515625 | 3 |
pyopenproject/business/services/command/priority/find_all.py | webu/pyopenproject | 5 | 20178 | <filename>pyopenproject/business/services/command/priority/find_all.py
from pyopenproject.api_connection.exceptions.request_exception import RequestError
from pyopenproject.api_connection.requests.get_request import GetRequest
from pyopenproject.business.exception.business_error import BusinessError
from pyopenproject.... | 2.5 | 2 |
photos/tests/test_views.py | AndreasMilants/django-photos | 0 | 20179 | from django.test import TestCase
from django.urls import reverse_lazy
from ..models import PHOTO_MODEL, UploadedPhotoModel, IMAGE_SIZES
from .model_factories import get_image_file, get_zip_file
import time
from uuid import uuid4
class UploadPhotoApiViewTest(TestCase):
def check_photo_ok_and_delete(self, photo):
... | 2.4375 | 2 |
app.py | cherishsince/PUBG_USB | 46 | 20180 | <gh_stars>10-100
import os
import time
from PIL import Image
import pyscreenshot as ImageGrab
import resource
from drive import box_drive64
from util import image_util, data_config_parser
from util.data_parser import read_data
from weapon import weapon, page_check, weapon_selection, left_right_correction
import envir... | 2.140625 | 2 |
src/dataset-dl.py | Mokuichi147/dataset-dl | 0 | 20181 | from concurrent.futures import ALL_COMPLETED, ThreadPoolExecutor, as_completed
import csv
import dearpygui.dearpygui as dpg
from os.path import isfile, isdir, join
import pyperclip
import subprocess
import sys
from tempfile import gettempdir
from traceback import print_exc
import core
import extruct
import utilio
fro... | 2.015625 | 2 |
src/robot/parsing/parser/parser.py | bhirsz/robotframework | 7,073 | 20182 | <gh_stars>1000+
# Copyright 2008-2015 Nokia Networks
# Copyright 2016- Robot Framework Foundation
#
# 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/licen... | 2.203125 | 2 |
astronomy_datamodels/tags/fixed_location.py | spacetelescope/astronomy_datamodels | 1 | 20183 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
# -*- coding: utf-8 -*-
from asdf import yamlutil
from asdf.versioning import AsdfSpec
from ..types import AstronomyDataModelType
from ..fixed_location import FixedLocation
class FixedLocationType(AstronomyDataModelType):
name = 'datamodel/fixed_loca... | 2.265625 | 2 |
app/migrations/0003_contacts.py | Joshua-Barawa/Django-IP4 | 0 | 20184 | # Generated by Django 4.0.3 on 2022-03-21 13:04
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('app', '0002_remove_profile_caption_alter_profile_profile_pic_and_more'),
]
operations = [
migrations.Create... | 1.71875 | 2 |
assessment/seeders/base_seeder.py | kenware/Assessment | 0 | 20185 | <reponame>kenware/Assessment
from .seed_assessment_type import seed_assessment
from .seed_question import seed_question
from .seed_answer import seed_answer
from .seed_user import seed_user
from .seed_score import seed_score
from .seed_assessment_name import seed_assessment_name
class Seeder(object):
def seed_... | 1.726563 | 2 |
contek_tusk/metric_data.py | contek-io/contek-tusk | 0 | 20186 | from pandas import DataFrame
from contek_tusk.table import Table
class MetricData:
def __init__(self, table: Table, df: DataFrame) -> None:
self._table = table
self._df = df
def get_table(self) -> Table:
return self._table
def get_data_frame(self) -> DataFrame:
return s... | 2.6875 | 3 |
inlinec/__init__.py | ssize-t/inlinec | 22 | 20187 | from .inlinec import inlinec | 1.148438 | 1 |
mcastropi.py | martinohanlon/MinecraftInteractiveAstroPi | 0 | 20188 | <filename>mcastropi.py
"""
SpaceCRAFT - Astro Pi competition[http://astro-pi.org/] entry
Conceived by <NAME>
Created by <NAME>[http://www.stuffaboutcode.com]
For the Raspberry Pi Foundation[https://www.raspberrypi.org]
mcastropi.py
A movable minecraft model of a Raspberry Pi with an Astro Pi on top
"""
from... | 2.609375 | 3 |
utils/pack_images.py | 1mplex/segmentation_image_augmentation | 15 | 20189 | <reponame>1mplex/segmentation_image_augmentation<filename>utils/pack_images.py
import copy
import math
import numpy as np
# import rpack
from rectpack import newPacker
from rectpack.maxrects import MaxRectsBssf
def _change_dim_order(sizes):
return [[s[1], s[0]] for s in sizes]
# def get_pack_coords(sizes):
# ... | 2.03125 | 2 |
scripts/modules/task_plan_types/date.py | vkostyanetsky/Organizer | 0 | 20190 | <filename>scripts/modules/task_plan_types/date.py
# DD.MM.YYYY (DD — номер дня, MM — номер месяца, YYYY — номер года)
import re
import datetime
def is_task_current(task, date):
result = None
groups = re.match('([0-9]{1,2}).([0-9]{1,2}).([0-9]{4})', task['condition'])
type_is_correct = groups != None
... | 3.1875 | 3 |
src/pyons/setup.py | larioandr/thesis-models | 1 | 20191 | from setuptools import setup
setup(
name='pyons',
version='1.0',
author="<NAME>",
author_email="<EMAIL>",
license="MIT",
py_modules=['pyons'],
install_requires=[
],
tests_requires=[
'pytest',
],
)
| 0.949219 | 1 |
html2markdown.py | DeusFigendi/fefebot | 4 | 20192 | #! /usr/bin/env python3.2
import re
def _subpre(text):
list=re.split('(<pre>|</pre>)',text)
for i in range(len(list)):
# begin of pre
if i%4==1:
list[i]='\n\n '
# in pre
elif i%4==2:
list[i]=re.sub('<p>|<br>|\n\n', '\n\n ',list[i])
# end of pre
elif i%4==3:
list[i]=... | 2.90625 | 3 |
Uebung10/Aufgabe29.py | B0mM3L6000/EiP | 1 | 20193 | <gh_stars>1-10
class Encoder:
def __init__(self, encoding = {}):
self.encoding = encoding
def updateEncoding(self,string1,string2):
list1 = str.split(string1)
list2 = str.split(string2)
self.encoding = {}
for i in range(len(list1)):
self.encoding[list1[i]] ... | 3.0625 | 3 |
p2p/adapters.py | baltimore-sun-data/p2p-python | 9 | 20194 | from requests.adapters import HTTPAdapter, DEFAULT_POOLBLOCK
from requests.packages.urllib3.poolmanager import PoolManager
class TribAdapter(HTTPAdapter):
def init_poolmanager(self, connections, maxsize, block=DEFAULT_POOLBLOCK):
self._pool_connections = connections
self._pool_maxsize = maxsize
... | 2.265625 | 2 |
mltk/marl/algorithms/__init__.py | lqf96/mltk | 0 | 20195 | <filename>mltk/marl/algorithms/__init__.py
from .phc import * | 1.03125 | 1 |
src/elementary_modules.py | rmldj/random-graph-nn-paper | 3 | 20196 | <filename>src/elementary_modules.py<gh_stars>1-10
import sympy as sym
import torch
import torch.nn as nn
import torch.nn.functional as F
class LambdaLayer(nn.Module):
"""
Layer that applies a given function on the input
"""
def __init__(self, lambd):
super(LambdaLayer, self).__init__()
... | 3.015625 | 3 |
actions.py | rodrigocamposdf/MovieBot | 1 | 20197 | <reponame>rodrigocamposdf/MovieBot<gh_stars>1-10
import movies
def action_handler(action, parameters, return_var):
return_values = {}
if action == 'trendings':
return_values = get_trendings(parameters, return_var)
elif action == 'search':
return_values = search_movies(parameters, return_va... | 3.109375 | 3 |
Exercicios7/percorrendoLista.py | vinihf/Prog1_ADS_2019 | 1 | 20198 | <filename>Exercicios7/percorrendoLista.py<gh_stars>1-10
lista = list(range(0,10001))
for cont in range(0,10001):
print(lista[cont])
for valor in lista:
print(valor) | 3.234375 | 3 |
core/spacy_parser.py | teodor-cotet/DiacriticsRestoration | 1 | 20199 | import spacy
from spacy.lang.ro import Romanian
from typing import Dict, List, Iterable
from nltk import sent_tokenize
import re
# JSON Example localhost:8081/spacy application/json
# {
# "lang" : "en",
# "blocks" : ["După terminarea oficială a celui de-al doilea război mondial, în conformitate cu discursul lu... | 2.859375 | 3 |