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 |
|---|---|---|---|---|---|---|
SBEX.py | RyanTreadwell/MetaViewer | 1 | 12776851 | <reponame>RyanTreadwell/MetaViewer
# -*- coding: utf-8 -*-
"""
Created on Thu Mar 8 10:02:29 2018
@author: Ryan
"""
from tkinter import *
root=Tk()
frame=Frame(root,width=300,height=300)
frame.grid(row=0,column=0)
canvas=Canvas(frame,bg='#FFFFFF',width=300,height=300,scrollregion=(0,0,500,500))
hbar=Scrollbar(frame,... | 2.453125 | 2 |
search_insert_position/solution.py | mahimadubey/leetcode-python | 528 | 12776852 | # -*- coding: utf-8 -*-
"""
Given a sorted array and a target value, return the index if the target is
found. If not, return the index where it would be if it were inserted in
order.
You may assume no duplicates in the array.
Here are few examples.
[1,3,5,6], 5 → 2
[1,3,5,6], 2 → 1
[1,3,5,6], 7 → 4
[1,3,5,6], 0 → 0
... | 4.15625 | 4 |
h2o-py/tests/testdir_algos/modelselection/pyunit_PUBDEV_8427_modelselection_coefs.py | LongerVision/h2o-3 | 1 | 12776853 | <filename>h2o-py/tests/testdir_algos/modelselection/pyunit_PUBDEV_8427_modelselection_coefs.py
from __future__ import print_function
from __future__ import division
import sys
sys.path.insert(1, "../../../")
import h2o
from tests import pyunit_utils
from h2o.estimators.model_selection import H2OModelSelectionEstimator ... | 2.5 | 2 |
app/constants.py | trongdth/python-flask | 0 | 12776854 | # -*- coding: utf-8 -*-
USER_ROLE = {
'USER': 0,
'MODERATOR': 1,
'ADMINISTRATOR': 2,
} | 1.140625 | 1 |
goutdotcom/flareaid/tests/test_models.py | Spiewart/goutdotcom | 0 | 12776855 | <gh_stars>0
from decimal import *
import pytest
from .factories import FlareAidFactory
pytestmark = pytest.mark.django_db
class TestFlareAidMethods:
def test_get_absolute_url(self):
FlareAid = FlareAidFactory()
assert FlareAid.get_absolute_url() == f"/flareaid/{FlareAid.pk}/"
def test__str... | 2.265625 | 2 |
bodies/__init__.py | cburggie/py3D | 0 | 12776856 | <gh_stars>0
from Plane import Plane
from CheckPlane import CheckPlane
from CheckCircle import CheckCircle
from ConcCircle import ConcCircle
from Sphere import Sphere
from hmSphere import hmSphere
from TruncSphere import TruncSphere
| 1.265625 | 1 |
Project1/entertainment_center.py | Lluna89/full-stack-web-developer-nanodegree | 9 | 12776857 | <filename>Project1/entertainment_center.py
import fresh_tomatoes
import media
# Movie local variables
storyline = '''A nameless disillusioned young urban male (<NAME>) fights
insomnia by attending disease support groups until he meets a
kindred spirit -and soap salesman (<NAME>). Together they form
Fight Club, where y... | 2.609375 | 3 |
gglex.py | adityadutta/BostonHacksFall18 | 2 | 12776858 | <reponame>adityadutta/BostonHacksFall18<filename>gglex.py
from __future__ import print_function
import datetime
from googleapiclient.discovery import build
from httplib2 import Http
from oauth2client import file, client, tools
# If modifying these scopes, delete the file token.json.
SCOPES = 'https://www.google... | 3.1875 | 3 |
retrieve_tps/config.py | PedroMLF/guided-nmt | 1 | 12776859 | import os
from dotenv import find_dotenv
from dotenv import load_dotenv
# Find and load dotenv
load_dotenv(find_dotenv())
class Config:
def __init__(self):
# Source and target languages
self.SRC = os.environ.get("SRC")
self.TGT = os.environ.get("TGT")
# Dirs
self.BASE_D... | 2.40625 | 2 |
test/memcache/memcache.py | bianhaoyi/neproxy | 1 | 12776860 | # Copyright 2012 Mixpanel, 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 law or agreed to in writin... | 2.890625 | 3 |
02-basics/my_package/a_module.py | vicente-gonzalez-ruiz/python-tutorial | 4 | 12776861 | <filename>02-basics/my_package/a_module.py
a = 1
print("a_module: Hi from my_package/" + __name__ + ".py!")
if __name__ == "__main__":
print("a_module: I was invoked from a script.")
else:
print("a_module: I was invoked from a Pyton module (probably using 'import').")
print("a_module: My name is =", __name__)
| 3.109375 | 3 |
counterfeit.py | wenima/interview-questions | 0 | 12776862 | <filename>counterfeit.py
"""Tests for for https://www.codewars.com/kata/number-of-measurements-to-spot-the-counterfeit-coin/"""
from math import ceil, log
def how_many_measurements(n):
"""Return the number of measurements it would take to find the counterfeit coin within n coins."""
if n == 1: return 0
if... | 3.8125 | 4 |
tests/test_parser/test_method_statement.py | vbondarevsky/ones_analyzer | 12 | 12776863 | <filename>tests/test_parser/test_method_statement.py
from analyzer.syntax_kind import SyntaxKind
from tests.utils import TestCaseParser
class TestParserMethodStatement(TestCaseParser):
def test_procedure_with_export(self):
code = \
"""Процедура МояПроцедура() Экспорт
КонецПроцедуры... | 2.8125 | 3 |
ReceiptAutoInfoExtract.py | colorofnight86/eisms-ocr | 8 | 12776864 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import cv2
import numpy as np
from cnocr import CnOcr
# 后续生成票据图像时的大小,按照标准增值税发票版式240mmX140mm来设定
height_resize = 1400
width_resize = 2400
# 实例化不同用途CnOcr对象
ocr = CnOcr(name='') # 混合字符
ocr_numbers = CnOcr(name='numbers', cand_alphabet='0123456789.') # 纯数字
ocr_UpperSerial =... | 2.4375 | 2 |
day10/syntax_scoring.py | pranasziaukas/advent-of-code-2021 | 0 | 12776865 | from collections import deque
from dataclasses import dataclass
from enum import Enum, auto
class Type(Enum):
ERROR = auto()
INCOMPLETE = auto()
@dataclass
class SyntaxScore:
type: Type
value: int
OPENERS_CLOSERS = {
"(": ")",
"[": "]",
"{": "}",
"<": ">",
}
def get_score(entry: ... | 3.03125 | 3 |
redis_metrics/__init__.py | bradmontgomery/django-redis-metrics | 52 | 12776866 | <reponame>bradmontgomery/django-redis-metrics
__version__ = "2.0.0"
try:
from .utils import gauge, metric, set_metric # NOQA
except ImportError: # pragma: no cover
pass # pragma: no cover
default_app_config = 'redis_metrics.apps.RedisMetricsConfig'
| 1.328125 | 1 |
notion_properties/tests.py | marcphilippebeaujean-abertay/recur-notion | 2 | 12776867 | from django.test import TestCase
from .dto import NotionPropertyDto
TEST_NOTION_API_RESP_PROPERTIES_DICT = {
"Comment": {"id": "!vXu", "type": "rich_text", "rich_text": []},
"Amount": {"id": "%225%3C%7B", "type": "number", "number": 690},
"Category": {
"id": "93%3D%3E",
"type": "multi_sele... | 2.1875 | 2 |
__init__.py | tommmlij/xbmc-gamepass | 40 | 12776868 | <gh_stars>10-100
# dummy file to init the directory
| 0.941406 | 1 |
c3/utils/logging.py | thetalorian/c3 | 0 | 12776869 | <reponame>thetalorian/c3
# Copyright 2016 CityGrid Media, LLC
#
# 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 ap... | 1.898438 | 2 |
split_bill_calculator.py | lorenanda/split-the-bill | 0 | 12776870 | from tkinter import *
class BillCalculator:
def __init__(self):
window = Tk()
window.title("Bill Calculator")
# input fields
Label(window, text = "How much is the bill?").grid(row = 1,column = 1, sticky = W)
Label(window, text = "How many people?").grid(ro... | 3.96875 | 4 |
thespian/system/transport/test/test_resultcallback.py | dendron2000/Thespian | 210 | 12776871 | from thespian.system.transport import ResultCallback
from datetime import datetime, timedelta
from time import sleep
class TestUnitResultCallback(object):
def _good(self, result, value):
if not hasattr(self, 'goods'): self.goods = []
self.goods.append( (result, value) )
def _fail(self, resul... | 2.453125 | 2 |
ml/code/svm/classifiers/HpNGram.py | cyberdeception/deepdig | 5 | 12776872 |
import wekaAPI
import arffWriter
from statlib import stats
from Trace import Trace
from Packet import Packet
import math
import numpy as np
from sklearn.decomposition import PCA
import config
from Utils import Utils
from EventTrace import EventTrace
class HpNGram:
@staticmethod
def traceToInstance( event... | 2.265625 | 2 |
__main__.py | aflansburg/rchtmlreader | 0 | 12776873 | import sys
from cli_augments import arg_parser
from htmlreader import read_page
purgeFiles = False
newItem = False
weight = ''
upc = ''
video_link = None
# parse arguments
processedArgs = arg_parser(sys.argv)
if type(processedArgs) == str:
url = processedArgs
read_page(url, False)
elif type(processedArgs) ==... | 3.109375 | 3 |
webviz_core_components/wrapped_components/label.py | rubenthoms/webviz-core-components | 6 | 12776874 | from typing import Any
from dash import html
class Label(html.Label):
"""Returns a styled dcc.Label"""
def __init__(
self,
*args: Any,
**kwargs: Any,
) -> None:
super().__init__(*args, **kwargs)
self.className = "webviz-label"
| 2.625 | 3 |
verification/application/services/slack_operation.py | pratik-vii/snet-marketplace-service | 0 | 12776875 | <gh_stars>0
import json
import requests
from common.exceptions import BadRequestException
from common.logger import get_logger
from common.utils import validate_signature
from verification.application.services.verification_manager import individual_repository, VerificationManager
from verification.config import ALLOW... | 2.171875 | 2 |
pykeyvi/src/converters/__init__.py | remusao/keyvi | 147 | 12776876 | from .pykeyvi_autowrap_conversion_providers import *
from autowrap.ConversionProvider import special_converters
def register_converters():
special_converters.append(MatchIteratorPairConverter())
| 1.390625 | 1 |
ice/icalendar/doctype/caldav_account/test_caldav_account.py | canlann/ice | 1 | 12776877 | # -*- coding: utf-8 -*-
# Copyright (c) 2020, IT-Geräte und IT-Lösungen wie Server, Rechner, Netzwerke und E-Mailserver sowie auch Backups, and Contributors
# See license.txt
from __future__ import unicode_literals
# import frappe
import unittest
class TestCalDavAccount(unittest.TestCase):
pass
| 1.367188 | 1 |
usim/_basics/_resource_level.py | AndreiBarsan/usim | 10 | 12776878 | from abc import abstractmethod
from weakref import WeakValueDictionary
from typing import Iterable, Tuple, Type, Generic, TypeVar
T = TypeVar('T')
class ResourceLevels(Generic[T]):
"""
Common class for named resource levels
Representation for the levels of multiple named resources. Every set of resourc... | 2.96875 | 3 |
tracopenid/compat.py | dcnoye/TracOpenidPluggin | 1 | 12776879 | <reponame>dcnoye/TracOpenidPluggin<filename>tracopenid/compat.py<gh_stars>1-10
# -*- coding: utf-8 -*-
#
# Copyright (C) 2021 <NAME>
#
from __future__ import absolute_import
from distutils.version import LooseVersion
from trac.util.html import tag
import trac
from trac.env import Environment
from trac.util.translation... | 2.4375 | 2 |
images/bbox_cv_phy/BBoxPhysicalPairing.py | hongtaoh/iphyer.github.io | 0 | 12776880 | import numpy as np
# create array data
predict = np.array([[1,2,2,1],
[4.5,2.5,10,0.5],
[6,6,8,4],
[6.26,6.26,8.26,4.26]],np.double)
truth = np.array([[1,4,3,3],
[1.2,2.2,2.2,1.2],
[5,2,8,1],
[6.1,6.1,8.1,4.1],... | 2.46875 | 2 |
scripts/synth/sample_kb.py | issca/inferbeddings | 33 | 12776881 | from kb import KB, TRAIN_LABEL, DEV_LABEL, TEST_LABEL
import random
import numpy as np
class SampleKB:
def __init__(self, num_relations, num_entities,
arities=[0.0, 1.0, 0.0],
fb_densities=[0.0, 0.0, 0.0],
arg_densities=[0., 0.1, 0.0],
fact_prob=0... | 2.3125 | 2 |
roman/romanMin.py | mapinis/intro-to-programming-public | 0 | 12776882 | <reponame>mapinis/intro-to-programming-public<gh_stars>0
userNum = int(input("Input a number: "))
out = ""
numeralArr = [(1000, "M"), (500, "D"), (100, "C"), (50, "L"), (10, "X"), (5, "V"), (1, "I"), (0, ""), (0, "")]
def conv... | 3.765625 | 4 |
build/lib/saes/optimizer/__init__.py | Johumel/SAES | 9 | 12776883 | from .srfit import *
from .fit_sin_spec_pll import *
from .fit_sin_spec import *
from .specr_model import *
from .sinspec_model import *
| 1.070313 | 1 |
bitchstorm.py | Ollyd1gger/crawler | 0 | 12776884 | <reponame>Ollyd1gger/crawler<gh_stars>0
# -*- coding: utf-8 -*-
import urlparse
import scrapy
from items import BitchstormItem
BASE_URL="http://www.harikadiziler.com/"
class BitchStormXPath(scrapy.Spider):
name = 'bitchstorm'
start_urls = [
'http://www.harikadiziler.com/yabanci-dizi-bolumleri/',
... | 2.671875 | 3 |
primes_test.py | danhje/primes | 0 | 12776885 | '''
@author: <NAME>
'''
import time
import numpy as np
import matplotlib.pyplot as plt
from algorithms import primes1, primes2, primes3, primes4, primes5, primes6, primes7, primes8
ubounds = range(0, 10000, 100)
num = len(ubounds)
results = []
for algorithm in (primes1, primes2, primes3, primes4, primes5, primes6... | 3.265625 | 3 |
Discord/models.py | EliasEriksson/Codescord | 0 | 12776886 | <filename>Discord/models.py
from typing import *
from tortoise.models import Model
from tortoise import fields
import tortoise
class Servers(Model):
id = fields.IntField(pk=True)
server_id = fields.IntField()
auto_run = fields.BooleanField(default=False)
@classmethod
async def get_server(cls, ser... | 2.59375 | 3 |
Server/app/views/v2/mixed/post/post.py | moreal/DMS-Backend | 27 | 12776887 | <reponame>moreal/DMS-Backend
from flask import Blueprint, Response, abort
from flask_restful import Api
from flasgger import swag_from
from app.docs.v2.mixed.post.post import *
from app.views.v2 import BaseResource
from app.views.v2.admin.post import CATEGORY_MODEL_MAPPING
api = Api(Blueprint(__name__, __name__))
api... | 2.171875 | 2 |
evidently/telemetry/__init__.py | alex-zenml/evidently | 2,212 | 12776888 | <reponame>alex-zenml/evidently<filename>evidently/telemetry/__init__.py
from .sender import TelemetrySender
| 0.984375 | 1 |
experiment/resample.py | adapttech-ltd/SocketAAE | 0 | 12776889 | <reponame>adapttech-ltd/SocketAAE
import point_cloud_utils as pcu
import glob
import numpy as np
import open3d as open3d
import matplotlib.pylab as plt
import re
import os
import yaml
import sys
import argparse
parser = argparse.ArgumentParser(description='')
parser.add_argument('--dataset_path', '-dp', type=str, req... | 2.046875 | 2 |
tests/unit/test_cab.py | 2js855/symstore | 0 | 12776890 | <filename>tests/unit/test_cab.py<gh_stars>0
import mock
import importlib
import unittest
orig_import = __import__
#
# handle differences between python 2.7 and 3
#
# 'builtins' used to be named '__builtin__' in python 2.7
try:
import builtins # noqa
IMPORT_MODULE = "builtins.__import__"
except ImportError... | 2.609375 | 3 |
calibrate.py | leeasar/Advanced-Lane-Lines | 0 | 12776891 | <reponame>leeasar/Advanced-Lane-Lines
import numpy as np
import cv2
import matplotlib.pyplot as plt
import matplotlib.image as mpimg
import glob
import pickle
# Prepare object points
# Number of inside corners in a calibration chessboard
nx = 9
ny = 6
# Accessing calibration images
cal_files = glob.glob('camera_cal/c... | 2.671875 | 3 |
lib/es_request.py | chaimpeck/espp | 0 | 12776892 | <reponame>chaimpeck/espp
"""es_request.py"""
# https://www.elastic.co/guide/en/elasticsearch/reference/current/search-search.html
import requests
ES_BASE_URL = 'http://localhost:9200/'
class EsRequest:
def __init__(self, indices, types=None, query_string=None):
url = ES_BASE_URL + indices
if ty... | 2.65625 | 3 |
web_server.py | sdkskdks/assignment4 | 0 | 12776893 | from flask import Flask, render_template
from flask import request
from database import Tableone
from database import db
from database import app
from selenium import webdriver
from bs4 import BeautifulSoup
@app.route('/index')
def index():
return render_template('index.html')
@app.route('/coin', methods = ['P... | 2.765625 | 3 |
zad13_6.py | kamilhabrych/python-semestr5-lista13 | 0 | 12776894 | from graphics import *
import random
import math
max_width = 500
max_height = 500
n = int(input("Ile bokow: "))
win = GraphWin('<NAME> zadanie 6', max_width, max_height)
win.setBackground('brown')
center = (250, 250)
r = 125
for item in range(n):
start_point = Point(center[0] + r * math.cos(2 * math.pi * item ... | 3.59375 | 4 |
main.py | josconno/cellular | 1 | 12776895 | <gh_stars>1-10
import csv
import os
import os.path as path
from cellular import cellular
def do_run(csv_writer, cas_folder, i, n):
'do run i of n'
colors = ['black', 'blue', 'yellow', 'orange', 'red']
ca = cellular.TotalisticCellularAutomaton(400, colors=colors, radius=1, states=5)
base = str(ca)
... | 2.5 | 2 |
mindarmour/adv_robustness/defenses/__init__.py | hboshnak/mindarmour | 139 | 12776896 | # Copyright 2020 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 required by applicable law or agreed to... | 1.359375 | 1 |
src/settings.py | AzemaBaptiste/SoundLandscape | 1 | 12776897 | <filename>src/settings.py
# -*- coding: utf-8 -*-
import os
from pathlib import Path
from dotenv import find_dotenv, load_dotenv
load_dotenv(find_dotenv())
PROJECT_DIR = Path(__file__).resolve().parents[1]
IMAGE_STREET_PATH = os.path.join(PROJECT_DIR, "data", "raw", "streetview")
IMAGE_GPS_PATH = os.path.join(PROJE... | 1.890625 | 2 |
crawler/driver/rpc_gearman.py | dukov/simplecrawler | 0 | 12776898 | <filename>crawler/driver/rpc_gearman.py
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in... | 2.375 | 2 |
manualunload.py | peppelorum/Pianobaren | 0 | 12776899 | import rpyc
conn = rpyc.connect("localhost", 12345)
unload = rpyc.async_(conn.root.unload)
unload()
| 1.882813 | 2 |
weditor/web/handlers/page.py | crifan/weditor | 1 | 12776900 | # coding: utf-8
#
import base64
import io
import json
import os
import platform
import queue
import subprocess
import sys
import time
import traceback
from concurrent.futures import ThreadPoolExecutor
from subprocess import PIPE
from typing import Union
import six
import tornado
from logzero import logger
from PIL im... | 2 | 2 |
recipes/Python/496825_Game_theory_payoff_matrix_solver/recipe-496825.py | tdiprima/code | 2,023 | 12776901 | ''' Approximate the strategy oddments for 2 person zero-sum games of perfect information.
Applies the iterative solution method described by <NAME> in his classic
book, The Compleat Strategyst, ISBN 0-486-25101-2. See chapter 5, page 180 for details. '''
from operator import add, neg
def solve(payoff_matrix, itera... | 3.09375 | 3 |
covid_checker.py | gryffindor-guy/PERSONAL-CARE-CHATBOT | 1 | 12776902 | <gh_stars>1-10
import pyfiglet #Install this module using command --> pip install pyfiglet
import webbrowser
def symptoms():
print("Are you experiencing any of the following Symptoms")
print("1 : Cough")
print("2 : Fever")
print("3 : Difficulty in breathing")
print("4 : Loss of senses of smell and t... | 3.578125 | 4 |
echopype/model/ek60.py | cyrf0006/echopype | 0 | 12776903 | """
echopype data model inherited from based class EchoData for EK60 data.
"""
import datetime as dt
import numpy as np
import xarray as xr
from .echo_data import EchoData
class EchoDataEK60(EchoData):
"""Class for manipulating EK60 echo data that is already converted to netCDF."""
def __init__(self, file_p... | 2.75 | 3 |
samples/switch-commands/aci-show-fex.py | carterej1989/acitoolkit | 0 | 12776904 | #!/usr/bin/env python
"""
This application replicates the switch CLI command 'show fex'
It largely uses raw queries to the APIC API
"""
from acitoolkit import Credentials, Session
from tabulate import tabulate
class FexCollector(object):
def __init__(self, url, login, password):
# Login to APIC
se... | 2.34375 | 2 |
SloppyCell/lmopt.py | bcdaniels/SloppyCell | 2 | 12776905 | from __future__ import nested_scopes
# Levenberg Marquardt minimization routines
"""
fmin_lm : standard Levenberg Marquardt
fmin_lmNoJ : Levenberg Marquardt using a cost function instead of
a residual function and a gradient/J^tJ pair instead
of the derivative of the residual function. Usefu... | 2.453125 | 2 |
survey/exporter/tex/__init__.py | TheWITProject/MentorApp | 0 | 12776906 | from .configuration import Configuration
from .configuration_builder import ConfigurationBuilder
from .question2tex import Question2Tex
from .survey2tex import Survey2Tex, XelatexNotInstalled
__all__ = ["Question2Tex", "Survey2Tex", "Configuration", "ConfigurationBuilder", "XelatexNotInstalled"]
| 1.109375 | 1 |
contents/apis/default.py | williamlagos/contents-api | 0 | 12776907 | <reponame>williamlagos/contents-api
#!/usr/bin/python
#
# This file is part of django-emporio project.
#
# Copyright (C) 2011-2020 <NAME> <<EMAIL>>
#
# Emporio is free software: you can redistribute it and/or modify
# it under the terms of the Lesser GNU General Public License as published by
# the Free Software Founda... | 1.835938 | 2 |
tsammalexdata/image_providers.py | Kevin2612/TSAMMELEX | 0 | 12776908 | <reponame>Kevin2612/TSAMMELEX
import os
from xml.etree import cElementTree as et
import re
from hashlib import md5
from mimetypes import guess_extension
from bs4 import BeautifulSoup
import requests
from purl import URL
import flickrapi
from dateutil.parser import parse
class DataProvider(object):
"""Given a URL... | 2.765625 | 3 |
cap6/ex12.py | felipesch92/livroPython | 0 | 12776909 | <filename>cap6/ex12.py<gh_stars>0
d = {}
palavra = '<NAME>'
for l in palavra:
if l in d:
d[l] = d[l] + 1
else:
d[l] = 1
print(d)
| 2.546875 | 3 |
eca.py | PetarPeychev/elementary-cellular-automata | 0 | 12776910 | <reponame>PetarPeychev/elementary-cellular-automata
class ECA:
def __init__(self, id):
self.id = bin(id)[2:].zfill(8)
self.dict = {}
for i in range(8):
self.dict[bin(7 - i)[2:].zfill(3)] = self.id[i]
self.array = [0 for x in range(199)]
self.array[99] = 1
d... | 3.4375 | 3 |
fewshot/models/measure_tests.py | yuchenlichuck/prototypical-random-walk | 4 | 12776911 | <reponame>yuchenlichuck/prototypical-random-walk
# Copyright (c) 2018 <NAME>, <NAME>, <NAME>, <NAME>,
# <NAME>, <NAME>, <NAME>, <NAME>.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software ... | 2.125 | 2 |
src/genie/libs/parser/iosxe/tests/ShowEthernetServiceInstance/cli/equal/golden_output_1_expected.py | balmasea/genieparser | 204 | 12776912 | <filename>src/genie/libs/parser/iosxe/tests/ShowEthernetServiceInstance/cli/equal/golden_output_1_expected.py
expected_output = {
"service_instance": {
501: {
"interfaces": {
"TenGigabitEthernet0/3/0": {"state": "Up", "type": "Static"},
"TenGigabitEthernet0/1/0": ... | 1.398438 | 1 |
sw/chaac_rpi/flask/app/main.py | alvarop/chaac | 21 | 12776913 | import os
import time
import socket
import zipfile
from datetime import datetime, timedelta
from flask import Flask, request, g, render_template, jsonify, redirect, Response
from chaac.chaacdb import ChaacDB
app = Flask(__name__)
app.config.from_object(__name__) # load config from this file , flaskr.py
# Load defau... | 2.640625 | 3 |
munimap/model/__init__.py | MrSnyder/bielefeldGEOCLIENT | 2 | 12776914 | <filename>munimap/model/__init__.py
from .mb_group import *
from .mb_user import *
from .layer import *
from .project import *
from .draw_schema import *
from .settings import *
| 1.21875 | 1 |
clarity/CellTypeDetection/parallelProcess.py | wjguan/phenocell | 0 | 12776915 | <reponame>wjguan/phenocell<filename>clarity/CellTypeDetection/parallelProcess.py
import numpy as np
## All this does is find the adaptive threshold for each point
def kernel(marker_channel_img, searchRadius, percent, localArea, center):
# Kernel to run for parallel processing: for deciding adaptive threshold... | 2.484375 | 2 |
app/models.py | FrancisSakwa89/Pitch | 0 | 12776916 | <filename>app/models.py
from . import db
from werkzeug.security import generate_password_hash,check_password_hash
from flask_login import UserMixin
from . import login_manager
from datetime import datetime
@login_manager.user_loader
def load_user(user_id):
return User.query.get(int(user_id))
class User(UserMixin... | 2.71875 | 3 |
deeplodocus/core/project/deep_structure/modules/transforms/transform_example.py | Ahleroy/deeplodocus | 0 | 12776917 | import random
#
# RANDOM FUNCTION EXAMPLE
#
def random_example_function(data, param_min, param_max):
parameters = random.uniform(param_min, param_max)
transformed_data, _ = example_function(data, parameters)
transform = ["example_function", example_function, {"parameters": parameters}]
return transform... | 2.8125 | 3 |
liftoff/proc_info.py | tudor-berariu/liftoff | 9 | 12776918 | <filename>liftoff/proc_info.py
""" Here we implement liftoff-procs and liftoff-abort
"""
from argparse import Namespace
import os.path
import subprocess
from termcolor import colored as clr
from .common.options_parser import OptionParser
def parse_options() -> Namespace:
""" Parse command line arguments and lift... | 2.515625 | 3 |
scimitar/core/modules/HeaderModule.py | aloheac/scimitar | 0 | 12776919 | <reponame>aloheac/scimitar<filename>scimitar/core/modules/HeaderModule.py
from scimitar.core.modules.BaseModules import PreExecutionModule
class HeaderModule( PreExecutionModule ):
def __init__( self, run ):
PreExecutionModule.__init__( self, "Header Module", 1, run )
def getScriptContribution( self )... | 1.78125 | 2 |
cmake/lib/config.py | uihsnv/lapack-dsyevr-test | 1 | 12776920 |
# Copyright (c) 2015 by <NAME> and <NAME>
# See https://github.com/scisoft/autocmake/blob/master/LICENSE
import subprocess
import os
import sys
import shutil
def module_exists(module_name):
try:
__import__(module_name)
except ImportError:
return False
else:
return True
def che... | 2.484375 | 2 |
app.py | g-jindal2001/blogs | 0 | 12776921 | <filename>app.py
from flask import Flask, render_template, request, redirect, session, flash
from flask_bootstrap import Bootstrap
from flask_mysqldb import MySQL
from flask_ckeditor import CKEditor
import bcrypt
import yaml
app = Flask(__name__)
Bootstrap(app)
ckeditor = CKEditor(app)
db = yaml.load(open('db.yaml'))... | 2.59375 | 3 |
fybot/tests/timing.py | juanlazarde/financial_scanner | 2 | 12776922 | <filename>fybot/tests/timing.py
from sys import exit
from time import time as t
import core.snp as sn
def main():
forced = True
symbols = sn.GetAssets(forced).symbols # 3.6s
# 300 symbols
# sn.GetFundamental(symbols, forced) # 44.6 s
# s = t()
# sn.GetPrice(symbols, forced) # 84.7 s
#... | 2.046875 | 2 |
studies/ti/gaussian.py | SimonBoothroyd/bayesiantesting | 1 | 12776923 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Oct 31 14:42:37 2019
@author: owenmadin
"""
import numpy
from bayesiantesting.kernels.bayes import ThermodynamicIntegration
from bayesiantesting.models.continuous import GaussianModel
def main():
priors = {"uniform": ("uniform", numpy.array([-5... | 2.703125 | 3 |
pyforms_lite/gui/controls/ControlFile.py | NikhilNarayana/pyforms-lite | 0 | 12776924 | <gh_stars>0
#!/usr/bin/python
# -*- coding: utf-8 -*-
from pyforms_lite.utils.settings_manager import conf
from pyforms_lite.gui.controls.ControlText import ControlText
import pyforms_lite.utils.tools as tools
from AnyQt import uic, _api
from AnyQt.QtWidgets import QFileDialog
class ControlFile(Control... | 2.1875 | 2 |
Typer.py | kenanbit/KeyboardLayoutLearning | 0 | 12776925 | <reponame>kenanbit/KeyboardLayoutLearning
#!/usr/bin/env python3
import curses
from curses import wrapper, textpad
from time import sleep, strftime, mktime, gmtime
import subprocess
import _thread
import random
from sys import argv
from datetime import datetime
WORDS_FILE = '10000words.txt' #File to draw random words ... | 3.40625 | 3 |
landmark/utils/images/test.py | greedpejo/FER_SPRING | 1 | 12776926 | from PIL import Image
import numpy as np
img = Image.open('cifar.png')
pic = np.array(img)
noise = np.random.randint(-10,10,pic.shape[-1])
print(noise.shape)
pic = pic+noise
pic = pic.astype(np.uint8)
asd = Image.fromarray(pic) | 3.109375 | 3 |
scripts/initial/ssh_connection.py | zhaozhilong1993/demon | 0 | 12776927 | #!/usr/bin/env python
# encoding: utf-8
import paramiko, base64
import optparse
import json
def generate_options():
p = optparse.OptionParser()
p.add_option("--address", "-a")
p.add_option("--username", "-u")
p.add_option("--password", <PASSWORD>")
options, argument = p.parse_args()
return opt... | 2.28125 | 2 |
knn_classifier.py | artemnaumchuk/kNN-classifier-python | 0 | 12776928 | <filename>knn_classifier.py<gh_stars>0
class KNNClassifier(object):
def __init__(self, k=3, distance=None):
self.k = k
self.distance = distance
def fit(self, x, y):
pass
def predict(self, x):
pass
def __decision_function(self):
pass
| 2.3125 | 2 |
fwrite/config/__init__.py | fooying/fwrite | 9 | 12776929 | <gh_stars>1-10
#!/usr/bin/env python
#encoding=utf-8
#by Fooying 2013-11-17 01:49:57
'''
配置读写相关方法
'''
import os
import sys
import ConfigParser
reload(sys)
sys.setdefaultencoding('utf-8')
from ..utils import *
CONFIG = ConfigParser.ConfigParser()
FILE_PATH = os.path.join(os.path.dirname(__file__), 'config.fwrite')
d... | 2.609375 | 3 |
joecceasy/AbstractBaseClass.py | joetainment/joecceasy | 0 | 12776930 | from . import Utils
Funcs = Utils.Funcs
classproperty = Utils.classproperty
class AbstractBaseClass:
"""
This class simply has some functionality we often
want on typical classes, such as ontoDict and ontoSelf
extend this as a habit when making new classes in apps etc
for init and ... | 3.3125 | 3 |
checkerboard/checkerboard.py | lambdaloop/checkerboard | 27 | 12776931 | <reponame>lambdaloop/checkerboard
#!/usr/bin/env python3
import numpy as np
from scipy import signal
from scipy.spatial import cKDTree
from numpy import pi
from scipy.cluster.vq import kmeans
import cv2
try:
import gputools
GPUTOOLS = True
except:
GPUTOOLS = False
def create_correlation_patch(angle_1,an... | 2.5 | 2 |
24_pair_swap_ll.py | ojhaanshu87/LeetCode | 0 | 12776932 | '''
Given a linked list, swap every two adjacent nodes and return its head.
You must solve the problem without modifying the values in the list's nodes (i.e., only nodes themselves may be changed.)
'''
# Definition for singly-linked list.
# class ListNode(object):
# def __init__(self, val=0, next=None):
# s... | 3.90625 | 4 |
scattering/scattering1d/tests/test_utils.py | louity/scattering_transform | 0 | 12776933 | import torch
from torch.autograd import Variable
from scattering.scattering1d.utils import pad1D, modulus, subsample_fourier
from scattering.scattering1d.utils import compute_border_indices
import numpy as np
import pytest
def test_pad1D(random_state=42):
"""
Tests the correctness and differentiability of pad... | 2.25 | 2 |
hw2/ref/.py | kfirgirstein/DIP_HW_cs236860 | 0 | 12776934 | <reponame>kfirgirstein/DIP_HW_cs236860
import numpy as np
import matplotlib.pyplot as plt
import cv2
from scipy import fftpack,signal
import scipy.signal
import skimage.measure
class PSFManager:
def CreatePSF(self,name:str, **kwargs):
choice = name.lower()
if choice == 'sinc':
... | 2.390625 | 2 |
plugins/postgresql_alt.py | swarm64/s64-sosreport-plugins | 0 | 12776935 | # -*- coding: utf8 -*-
import os
from shlex import split as shlex_split
from sos.report.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin
from subprocess import check_output, CalledProcessError
from typing import Dict, List, Optional, Tuple
import psycopg2
DEFAULT_DSN = 'postgresql://postgres@localhos... | 2.09375 | 2 |
api/website_analysis/views.py | gpiechnik2/senter | 2 | 12776936 | from rest_framework import viewsets, status
from rest_framework.permissions import IsAuthenticated
from rest_framework.response import Response
from rest_framework.decorators import action
import json
from .serializers import SEOSerializer
from .utils import website_analysis
class SEOViewSet(viewsets.ViewSet):
""... | 2.34375 | 2 |
src/data_manager/data_file_manager.py | alliance-genome/agr_preprocess | 0 | 12776937 | import logging, yaml, os, sys, json, urllib3, requests
from cerberus import Validator
from files import JSONFile
from common import Singleton
from common import ContextInfo
from urllib.parse import urlparse
from .data_type_config import DataTypeConfig
logger = logging.getLogger(__name__)
class DataFileManager(meta... | 2.109375 | 2 |
No_11_sunPro/No_11_sunPro/pipelines.py | a904919863/Spiders_Collection | 3 | 12776938 | <reponame>a904919863/Spiders_Collection<filename>No_11_sunPro/No_11_sunPro/pipelines.py
# Define your item pipelines here
#
# Don't forget to add your pipeline to the ITEM_PIPELINES setting
# See: https://docs.scrapy.org/en/latest/topics/item-pipeline.html
# useful for handling different item types with a single inte... | 2.5 | 2 |
evobench/discrete/isg/parser.py | piotr-rarus/evobench | 6 | 12776939 | from pathlib import Path
import numpy as np
from .config import Config
from .spin import Spin
def load(path: Path) -> Config:
with path.open() as file:
lines = file.readlines()
global_optimum, best_solution = lines[0].split(' ')
global_optimum = float(global_optimum.strip())
b... | 2.71875 | 3 |
app/db/repositories/articles.py | yasudakn/fastapi-realworld-example-app | 0 | 12776940 | from typing import List, Optional, Sequence, Union
import os
from aiocache import cached, Cache
from aiocache.serializers import PickleSerializer
from asyncpg import Connection, Record
from pypika import Query
from app.db.errors import EntityDoesNotExist
from app.db.queries.queries import queries
from app.db.queries.... | 2.078125 | 2 |
tests_compiled/to_revive/test_rank1_wrapper.py | Pressio/pressio4py | 4 | 12776941 | <filename>tests_compiled/to_revive/test_rank1_wrapper.py
import pytest, math
import numpy as np
import test_rank1_wrapper_module as m
def testCnstr0():
print("testCnstr0")
a = m.construct0(5)
assert(a.shape[0] == 5)
def testCnstr1():
print("testCnstr1")
a = np.zeros(5)
a_add = a.__array_interface__['data... | 2.21875 | 2 |
pubs/server.py | WIPACrepo/publication-web-db | 0 | 12776942 | """
Server for publication db
"""
import os
import logging
import binascii
from functools import wraps
from urllib.parse import urlparse
import base64
import csv
from io import StringIO
import itertools
from tornado.web import RequestHandler, HTTPError
from rest_tools.server import RestServer, from_environment, catch... | 2.234375 | 2 |
mloop_multishot.py | zakv/analysislib-mloop | 0 | 12776943 | import lyse
import runmanager.remote as rm
import numpy as np
import mloop_config
import sys
import logging
import os
from labscript_utils.setup_logging import LOG_PATH
try:
from labscript_utils import check_version
except ImportError:
raise ImportError('Require labscript_utils > 2.1.0')
check_v... | 1.992188 | 2 |
test/on_yubikey/cli_piv/test_misc.py | timo-quinn/yubikey-manager | 0 | 12776944 | <gh_stars>0
from ..util import ykman_cli
from .util import PivTestCase
class Misc(PivTestCase):
def test_info(self):
output = ykman_cli('piv', 'info')
self.assertIn('PIV version:', output)
def test_reset(self):
output = ykman_cli('piv', 'reset', '-f')
self.assertIn('Success!'... | 2.125 | 2 |
python/ShoppingList_to_excel.py | esix2/coffee-accounting | 0 | 12776945 | import pandas as pd
import os
from openpyxl.styles import Color, Fill, Border, Alignment, Font
from openpyxl.cell import get_column_letter
import numpy as np
def ShoppingList_to_excel():
pwd = os.getcwd()
os.chdir("../..") ## it changes to the parent folder, since shopping list is there
csvFile ... | 3.21875 | 3 |
evaluate_numbering.py | koreyou/pdf-struct | 10 | 12776946 | # Copyright (c) 2021, Hitachi America Ltd. 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 appli... | 2.265625 | 2 |
docs/00.Python/demo_pacages/p1/pp1/a3.py | mheanng/PythonNote | 0 | 12776947 | from ...p1 import mm
# 导入主包边界之外的包
print('this is a2')
| 1.554688 | 2 |
beowulf/cli.py | beowulf-foundation/beowulf-python | 9 | 12776948 | import argparse
import json
import logging
import os
import pprint
import re
import sys
import click._compat
import pkg_resources
from prettytable import PrettyTable
import beowulf as bwf
from beowulfbase.account import PrivateKey
from beowulfbase.storage import configStorage
from .account import Account
from .amount i... | 1.828125 | 2 |
morphounit/scores/score_RangeCheck.py | appukuttan-shailesh/morphounit | 1 | 12776949 | import sciunit
#==============================================================================
class RangeCheck(sciunit.Score):
"""
Checks if value is within specified range
Approach: Returns True if within range, False otherwise
"""
_allowed_types = (bool,)
_description = ('Checks if value ... | 3.203125 | 3 |
multi_orbital/evaluation/gap_plots.py | nikwitt/FLEX_IR | 1 | 12776950 | <filename>multi_orbital/evaluation/gap_plots.py
# -*- encoding: latin-1 -*-
import sys
MKL_THREADS_VAR = str(sys.argv[1])
import os
os.environ["MKL_NUM_THREADS"] = MKL_THREADS_VAR
os.environ["NUMEXPR_NUM_THREADS"] = MKL_THREADS_VAR
os.environ["OMP_NUM_THREADS"] = "1"
from numpy import *
import scipy as sc
import py... | 2.015625 | 2 |