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 |
|---|---|---|---|---|---|---|
tests/routing/test_handle.py | antonrh/django-apirouter | 7 | 12781051 | import pytest
from django.http import HttpResponse
from apirouter import APIRouter
from apirouter.exceptions import APIException
pytestmark = [pytest.mark.urls(__name__)]
def exception_handler(request, exc):
return HttpResponse(str(exc), status=400)
router = APIRouter(exception_handler=exception_handler)
@r... | 2.34375 | 2 |
v2ray_stats/config.py | Ricky-Hao/V2Ray.Stats | 13 | 12781052 | <gh_stars>10-100
import json
from typing import Any
class Config(object):
_config = {
'mail_host': None,
'mail_port': None,
'mail_user': None,
'mail_pass': None,
'mail_subject': 'V2Ray Traffic Report',
'database': 'v2ray_stats.sqlite3',
'server': '127.0.0.1:2... | 2.734375 | 3 |
python/lvmpwi/pwi/__init__.py | sdss/lvmpwi | 0 | 12781053 | # -*- coding: utf-8 -*-
#
# @Author: <NAME> (<EMAIL>
# @Date: 2021-06-15
# @Filename: __init__.py
# @License: BSD 3-clause (http://www.opensource.org/licenses/BSD-3-Clause)
from .pwi4_client import PWI4
| 1.09375 | 1 |
disasm/disasmz80.py | wd5gnr/8080 | 26 | 12781054 | <gh_stars>10-100
#! /usr/bin/env python3
#
# Disassembler for Zilog Z80 microprocessor.
# Copyright (c) 2013 by <NAME> <<EMAIL>>
#
# 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://ww... | 2.453125 | 2 |
app/api/posts/migrations/0001_initial.py | Suhas-G/Melton-App-Server | 5 | 12781055 | # Generated by Django 3.0.3 on 2020-07-12 15:21
from django.db import migrations, models
import markdownx.models
import posts.models
class Migration(migrations.Migration):
initial = True
dependencies = []
operations = [
migrations.CreateModel(
name="Tag",
fields=[
... | 2.109375 | 2 |
torch/utils/data/datapipes/iter/httpreader.py | xiaohanhuang/pytorch | 60,067 | 12781056 | <reponame>xiaohanhuang/pytorch<filename>torch/utils/data/datapipes/iter/httpreader.py
from io import IOBase
from typing import Sized, Tuple
from torch.utils.data import IterDataPipe
from torch.utils.data.datapipes.utils.common import deprecation_warning_torchdata
class HTTPReaderIterDataPipe(IterDataPipe[Tuple[str, I... | 2.890625 | 3 |
FretboardGenerator.py | mdales/FretboardGenerator360 | 0 | 12781057 | <reponame>mdales/FretboardGenerator360
# Author-Digital Flapjack Ltd
# Description-Test
import math
import adsk.core, adsk.fusion, adsk.cam, traceback
# Calculates the fret positions given a scale length and the number of frets. Includes the zero fret.
# @param {number} scaleLength - The scale length in whatever un... | 2.359375 | 2 |
src/platformer.py | megamarc/TilenginePythonPlatformer | 16 | 12781058 | <gh_stars>10-100
""" Tilengine python platformer demo """
from tilengine import Engine, Window
from raster_effect import raster_effect
from world import World
from player import Player
from UI import UI
from sound import Sound
import game
# init tilengine
game.engine = Engine.create(game.WIDTH, game.HEIGHT, game.MAX_... | 2.421875 | 2 |
custom/icds_reports/migrations/0067_ccsrecordmonthly_dob.py | tobiasmcnulty/commcare-hq | 1 | 12781059 | <reponame>tobiasmcnulty/commcare-hq
# Generated by Django 1.10.7 on 2018-09-25 13:50
from corehq.sql_db.operations import RawSQLMigration
from django.db import migrations
from custom.icds_reports.const import SQL_TEMPLATES_ROOT
migrator = RawSQLMigration((SQL_TEMPLATES_ROOT,))
class Migration(migrations.Migration):... | 1.65625 | 2 |
tools/testing/tests/solo.py | trustcrypto/solo | 1 | 12781060 | from solo.client import SoloClient
from fido2.ctap1 import ApduError
from .util import shannon_entropy
from .tester import Tester, Test
class SoloTests(Tester):
def __init__(self, tester=None):
super().__init__(tester)
def run(self,):
self.test_solo()
def test_solo(self,):
"""
... | 2.25 | 2 |
scipy/stats/tests/test_crosstab.py | Ennosigaeon/scipy | 9,095 | 12781061 | <filename>scipy/stats/tests/test_crosstab.py
import pytest
import numpy as np
from numpy.testing import assert_array_equal
from scipy.stats.contingency import crosstab
@pytest.mark.parametrize('sparse', [False, True])
def test_crosstab_basic(sparse):
a = [0, 0, 9, 9, 0, 0, 9]
b = [2, 1, 3, 1, 2, 3, 3]
exp... | 2.515625 | 3 |
modules/rvorbitfitter.py | timberhill/radiant | 0 | 12781062 | <gh_stars>0
import numpy as np
import warnings
from modules.contracts import OrbitFitter
from scipy.optimize import fsolve
from scipy.optimize import curve_fit
from modules.settings import Settings
class RVOrbitFitter(OrbitFitter):
def _validatePositiveRange(self, r, name, alt=[0.0, float('inf')]):
if len(r) == 2:... | 2.328125 | 2 |
codes/quicksort.py | pedh/CLRS-Solutions | 3 | 12781063 | """
Quicksort.
"""
import random
def partition(array, left, right):
"""Quicksort partition."""
pivot = array[right]
i = left - 1
for j in range(left, right):
if array[j] < pivot:
i += 1
array[i], array[j] = array[j], array[i]
array[right], array[i + 1] = array[i + ... | 4.21875 | 4 |
models/intphys/model/tvqa.py | hucvl/craft | 9 | 12781064 | import torch
import torch.nn as nn
import torch.nn.functional as F
from intphys.extra.tvqa.tvqa_abc import ABC
from intphys.extra.tvqa_plus.stage import STAGE
from intphys.data import SimulationInput
from intphys.submodule import *
class TVQA(nn.Module):
SIMULATION_INPUT = SimulationInput.VIDEO
def __in... | 2.21875 | 2 |
predict.py | nikhil133/ASAP-TextAbstractorSummary | 1 | 12781065 | import tensorflow as tf
from attention import AttentionLayer
from tensorflow.keras.models import load_model
import numpy as np
from tensorflow.keras.preprocessing.text import Tokenizer
from keras.preprocessing.sequence import pad_sequences
from text_cleaner import text_cleaner,rareword_coverage
import pickle
tf.compat... | 2.40625 | 2 |
test/util/test_map.py | azoimide/cyk | 0 | 12781066 | <gh_stars>0
from util import map_string, map_to_string, rand_string
def main():
t_tab = {'e': 5, '+': 2, '-': 3, '.': 4, '1': 1, '0': 0}
s = rand_string(len(t_tab))
assert s == map_string(map_to_string(s, t_tab), t_tab)
if __name__ == "__main__":
main()
| 2.875 | 3 |
ML_WebApp/app.py | sergiosolmonte/ML_WebApp_easy | 0 | 12781067 | ##Tutotrial by <NAME>
from flask import Flask, request, render_template
import pandas as pd
import joblib
# Declare a Flask app
app = Flask(__name__)
@app.route('/', methods=['GET', 'POST'])
def main():
# If a form is submitted
if request.method == "POST":
# Unpickle classifier
... | 3 | 3 |
osmcal/forms.py | OSMChina/openstreetmap-calendar | 26 | 12781068 | import json
from typing import Dict, Iterable
import babel.dates
import pytz
from django import forms
from django.contrib.postgres.forms import SimpleArrayField
from django.forms import ValidationError
from django.forms.widgets import DateTimeInput, TextInput
from . import models
from .serializers import JSONEncoder
... | 2.515625 | 3 |
scripts/import_old_files.py | maxwenger/repast.github.io | 6 | 12781069 | #! /usr/bin/env python
import sys
def main(f_orig, f_new):
print("Porting {} as {}".format(f_orig, f_new))
with open(f_new, 'w') as f_out:
start = False
f_out.write("---\nlayout: site\n---\n")
with open(f_orig, 'r') as f_in:
for line in f_in:
line = line.str... | 2.828125 | 3 |
tests/models/test_hovernetplus.py | adamshephard/tiatoolbox | 0 | 12781070 | <gh_stars>0
"""Unit test package for HoVerNet+."""
import torch
from tiatoolbox.models.architecture import fetch_pretrained_weights
from tiatoolbox.models.architecture.hovernetplus import HoVerNetPlus
from tiatoolbox.utils.misc import imread
from tiatoolbox.utils.transforms import imresize
def test_functionality(re... | 2.09375 | 2 |
scrapy-package/scrapy_twrh/spiders/rental591/util.py | eala/tw-rental-house-data | 0 | 12781071 | from collections import namedtuple
SITE_URL = 'https://rent.591.com.tw'
LIST_ENDPOINT = '{}/home/search/rsList?is_new_list=1&type=1&kind=0&searchtype=1'.format(SITE_URL)
SESSION_ENDPOINT = '{}/?kind=0®ion=6'.format(SITE_URL)
ListRequestMeta = namedtuple('ListRequestMeta', ['id', 'name', 'page'])
DetailRequestMeta... | 2.484375 | 2 |
isbn-verifier/isbn_verifier.py | rdlu/exercism-python | 0 | 12781072 | <gh_stars>0
def is_valid(isbn: str) -> bool:
# filter nums, convert to list of int
l = [int(x) for x in filter(str.isnumeric, isbn)]
# handle the edge case: X
if isbn and isbn[-1] == 'X': l.append(10)
# check len and sum the product of digits x position
return len(l) == 10 and sum([l[10-i] * i f... | 3.359375 | 3 |
epicteller/bot/main.py | KawashiroNitori/epicteller | 0 | 12781073 | <gh_stars>0
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import nonebot
from nonebot.adapters.cqhttp import Bot as CQHTTPBot
from epicteller.bot import bus_init
from epicteller.core import redis
def main():
nonebot.init(command_start={'/', '!', "!"})
driver = nonebot.get_driver()
driver.register_adapte... | 1.820313 | 2 |
Python/AllRelaisOn.py | derdoktor667/FT232Raspberry2USB | 0 | 12781074 | #! /usr/bin/python
# -*- coding: utf-8 -*-
import serial
import time
ser = serial.Serial('/dev/ttyUSB0',9600)
ser.write("255\r")
print ("ALL RELAIS: ON!")
time.sleep(10)
ser.write("0\r")
print ("ALL RELAIS: OFF!")
ser.close()
print ("ALL GOOD, EXIT!")
# ...quick and dirty by "<EMAIL>"
| 2.3125 | 2 |
Testing/RawHID/send_test.py | SystemsCyber/SSS3 | 0 | 12781075 | <reponame>SystemsCyber/SSS3
import pywinusb.hid as hid
import time
def sample_handler(data):
print("Raw data: {0}".format(data))
filter = hid.HidDeviceFilter(vendor_id = 0x16c0, product_id = 0x0486)
hid_device = filter.get_devices()
print("hid_device:")
print(hid_device)
device = hid_device[0]
print("device:")
p... | 2.515625 | 3 |
app.py | coolexplorer/slackbot-buffy | 3 | 12781076 | import logging.config
import os
import re
from slack import RTMClient
from slack.errors import SlackApiError
from config.cofiguration import Configuration
from exception.invalid_command import InvalidCommand
from model.message import Message
from parser.command_parser import CommandParser
from service.service_account... | 2.125 | 2 |
src/turkey_bowl/__init__.py | loganthomas/turkey-bowl | 0 | 12781077 | <gh_stars>0
# Local libraries
from turkey_bowl import aggregate # noqa: F401
from turkey_bowl import draft # noqa: F401
from turkey_bowl import leader_board # noqa: F401
from turkey_bowl import scrape # noqa: F401
from turkey_bowl import turkey_bowl_runner # noqa: F401
from turkey_bowl import utils # noqa: F401
... | 1.171875 | 1 |
Chapter06/mypandas/operations/pandas1.py | MichaelRW/Python-for-Geeks | 31 | 12781078 | # pandas1.py
import pandas as pd
weekly_data = {'day':['Monday','Tuesday', 'Wednesday', 'Thursday',
'Friday', 'Saturday', 'Sunday'],
'temp':[40, 33, 42, 31, 41, 40, 30],
'condition':['Sunny','Cloudy','Sunny','Rain','Sunny',
'Cloudy','Rain']
... | 3.703125 | 4 |
examples/libtest/imports/allsimple.py | takipsizad/pyjs | 739 | 12781079 | """
Helper module for import * without __all__
"""
all_import2 = 3
all_import3 = 3
all_override = True
| 1.296875 | 1 |
crashreports/rest_api_heartbeats.py | FairphoneMirrors/hiccup-server | 0 | 12781080 | <reponame>FairphoneMirrors/hiccup-server
"""REST API for accessing heartbeats."""
from django.utils.decorators import method_decorator
from drf_yasg import openapi
from drf_yasg.utils import swagger_auto_schema
from rest_framework import generics, status
from rest_framework.exceptions import NotFound, ValidationError
... | 2.140625 | 2 |
torchrecipes/text/doc_classification/tests/test_doc_classification_train_app.py | hudeven/recipes | 0 | 12781081 | # Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
#!/usr/bin/env python3
# pyre-strict
import os.path
from unittest.mock import patch
import torchrecipes.text.doc_classification.con... | 2.015625 | 2 |
relational/Spatial_Temporal_Model/main_module.py | monthie/cogmods | 0 | 12781082 | <reponame>monthie/cogmods
'''
Main Module for the spatial and temporal Models, contains the high-level functions,
all examples (deduction problem-sets) and some unit-tests.
Created on 16.07.2018
@author: <NAME> <<EMAIL>>, <NAME><<EMAIL>>
'''
from copy import deepcopy
import unittest
from parser_spatia... | 2.703125 | 3 |
mealpy/utils/boundary.py | rishavpramanik/mealpy | 0 | 12781083 | <filename>mealpy/utils/boundary.py
#!/usr/bin/env python
# Created by "Thieu" at 23:42, 16/03/2022 ----------%
# Email: <EMAIL> %
# Github: https://github.com/thieu19... | 2.96875 | 3 |
src/typer_make/__init__.py | zdog234/typer-make | 0 | 12781084 | <gh_stars>0
"""typer-make."""
| 1.03125 | 1 |
examples/docs_snippets/docs_snippets/concepts/ops_jobs_graphs/jobs.py | silentsokolov/dagster | 0 | 12781085 | # isort: skip_file
# pylint: disable=unused-argument,reimported
from dagster import DependencyDefinition, GraphDefinition, job, op
@op
def my_op():
pass
# start_pipeline_example_marker
@op
def return_one(context):
return 1
@op
def add_one(context, number: int):
return number + 1
@job
def one_plus_... | 2.125 | 2 |
ConnectingToTheInternet/Client-ServerFileTransfer/Client.py | ChocolaKuma/KumasCookbook | 3 | 12781086 | import socket as socket
import time as t
import random as r
# creates socket object
def receve_MSG(IP="",port=1337,MSG_Size=1024,TEXT_Decode='ascii',ExpectedFileType="TXT"):
s = socket.socket(socket.AF_INET,socket.SOCK_STREAM)
if(IP==""):
IP = socket.gethostname()
s.connect((IP, port))
... | 2.921875 | 3 |
jasonParser.py | ibrahimsh/final-project-software-programming | 0 | 12781087 | <filename>jasonParser.py<gh_stars>0
__author__ = 'MatrixRev'
import json
import codecs
import glob
import os
import sys
#path = u"C://Users//MatrixRev//Desktop//library_5//"
path="C://Users//MatrixRev//Desktop//mainLib//" # input file
outFile='C:/Users/MatrixRev/Desktop/books/output/mainsubjects.txt' #output file
pat... | 2.71875 | 3 |
src/models/__init__.py | imhgchoi/Project-Template | 2 | 12781088 |
from models.sample import SampleModel
def build_model(args):
if args.model == 'sample':
return SampleModel(args)
else :
raise NotImplementedError(f"check model name : {args.model}") | 2.421875 | 2 |
test/test_schemas.py | SCM-NV/nano-qmflows | 4 | 12781089 | """Check the schemas."""
from assertionlib import assertion
from nanoqm.workflows.input_validation import process_input
from .utilsTest import PATH_TEST
def test_input_validation():
"""Test the input validation schema."""
schemas = ("absorption_spectrum", "derivative_couplings")
paths = [PATH_TEST / x f... | 2.3125 | 2 |
selenium_script.py | Rob0b0/Google-map-poi-extractor | 2 | 12781090 | """
selenium script to scrape google map POI with rotating IP proxy
@author: <NAME>
@date: 09/02/2019
"""
import os,time
from helper import CoordBound
from selenium import webdriver
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.common.by import By
from selenium.webdriver.support import... | 2.828125 | 3 |
step30_multiple_stacks/Python/backend/lambda.py | fullstackwebdev/full-stack-serverless-cdk | 192 | 12781091 | <reponame>fullstackwebdev/full-stack-serverless-cdk<filename>step30_multiple_stacks/Python/backend/lambda.py
import json
import random
import string
def lambda_handler(event, context):
# print(event)
# print(context)
letters = string.ascii_lowercase
value = ''.join(random.choice(letters) for i in... | 1.9375 | 2 |
drive_dump.py | Qabel/ox-drive-dump | 0 | 12781092 | <filename>drive_dump.py<gh_stars>0
#!/usr/bin/env python3.7
import argparse
import os
import os.path
import shutil
import click
import mysql.connector
from anytree import Node, LevelOrderIter
def connect(host, user, password, port, database):
return mysql.connector.connect(
host=host, user=user, password... | 2.53125 | 3 |
Exercício feitos pela primeira vez/ex001colorido.py | Claayton/pythonExerciciosLinux | 1 | 12781093 | #Ex001b
print('\033[0;35m''Olá Mundo!''\033[m')
print('xD') | 1.960938 | 2 |
cse521/hw1/p1_data/p1.py | interesting-courses/UW_coursework | 2 | 12781094 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sat Oct 6 20:17:09 2018
@author: tyler
"""
import numpy as np
import sys
#%%
def karger(G,vertex_label,vertex_degree,size_V):
size_V = len(vertex_label)
#N = int(size_V*(1-1/np.sqrt(2)))
iteration_schedule = [size_V-2]
for N in ... | 3.03125 | 3 |
des.py | ybbarng/des | 0 | 12781095 | from itertools import accumulate
# Initial Permutation
IP = [
57, 49, 41, 33, 25, 17, 9, 1,
59, 51, 43, 35, 27, 19, 11, 3,
61, 53, 45, 37, 29, 21, 13, 5,
63, 55, 47, 39, 31, 23, 15, 7,
56, 48, 40, 32, 24, 16, 8, 0,
58, 50, 42, 34, 26, 18, 10, 2,
60, 52, 44, 36, 28, 20, 12, 4,
... | 2.625 | 3 |
graphics/collidertest2.py | orrenravid1/brainn | 0 | 12781096 | <reponame>orrenravid1/brainn<gh_stars>0
import pygame
import math
import sys,os
p = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
if not (p in sys.path):
sys.path.insert(0, p)
from AML.mathlib.math2d import*
from AML.graphics.collidergraphics import*
import random
import time
from ... | 2.46875 | 2 |
myException.py | Abbion/Python-Labyrinth-Generator | 0 | 12781097 | <filename>myException.py
class WrongEntryException(Exception):
"""Klasa wyjątku -> zwracany gdy wartość wpisana do komórki jset błędna"""
def __init__(self, message, entry_id):
self.__message = message
self.__entry_id = entry_id
def __str__(self):
return "wrong entry error: {0}".f... | 3.3125 | 3 |
app/models/__init__.py | cybrnode/zkt-sdk-rest-api | 0 | 12781098 | <gh_stars>0
from typing import Optional
from pydantic.main import BaseModel
class User(BaseModel):
CardNo: int
Pin: int
Password: str
Group: int
StartTime: str
EndTime: str
SuperAuthorize: bool
class ConnectionParams(BaseModel):
protocol: Optional[str] = "TCP"
ip_address: str = ... | 2.859375 | 3 |
Python/0760_find_anagram_mappings.py | codingyen/CodeAlone | 2 | 12781099 | """
Given two lists Aand B, and B is an anagram of A. B is an anagram of A means B is made by randomizing the order of the elements in A.
We want to find an index mapping P, from A to B. A mapping P[i] = j means the ith element in A appears in B at index j.
These lists A and B may contain duplicates. If there are mul... | 3.921875 | 4 |
PART01/21_series_to_number.py | arti1117/python-machine-learning-pandas-data-analytics | 1 | 12781100 | <filename>PART01/21_series_to_number.py
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Aug 5 22:43:02 2020
@author: arti
"""
import pandas as pd
student1 = pd.Series({'Korean':100, 'English':80, 'Math':99})
print(student1); print('--')
percentage = student1 / 200
print(percentage); print('--')
... | 3.09375 | 3 |
skyblock/map/npc/gold.py | peter-hunt/skyblock | 13 | 12781101 | from ...object.object import *
from ..object import *
GOLD_NPCS = [
Npc('gold_forger',
init_dialog=[
'I love goooold!',
'Talk to me again to open the Gold Forger Shop!',
],
trades=[
(5.5, {'name': 'gold'}),
(10, {'name': 'golden_helmet'}),
... | 2.046875 | 2 |
mock/mock_patch/additional_property.py | aikrasnov/otus-examples | 8 | 12781102 | <reponame>aikrasnov/otus-examples
from unittest.mock import patch
def foo():
return input(), input(), input()
def test_function():
with patch('builtins.input', side_effect=("expected_one", "expected_two", "expected_three")) as mock:
# foo()
print('\n')
print(dir(mock))
print("m... | 3.34375 | 3 |
voxolab/xml_extract_speaker.py | voxolab/voxo-lib | 1 | 12781103 | <reponame>voxolab/voxo-lib<filename>voxolab/xml_extract_speaker.py
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from convert import xml_to_txt_speaker
import argparse
def make_xml_to_txt_speaker(xml_file, txt_file):
xml_to_txt_speaker(xml_file, txt_file)
if __name__ == '__main__':
parser = argparse.Argumen... | 3.25 | 3 |
pyramid_oereb/standard/xtf_import/office.py | openoereb/pyramid_oereb | 4 | 12781104 | <gh_stars>1-10
# -*- coding: utf-8 -*-
from pyramid_oereb.standard.xtf_import.util import parse_string, parse_multilingual_text
class Office(object):
TAG_NAME = 'Name'
TAG_OFFICE_AT_WEB = 'AmtImWeb'
TAG_UID = 'UID'
def __init__(self, session, model):
self._session = session
self._mod... | 2.3125 | 2 |
conan_package_dep_map/src/deprecated/package_analyser.py | cafesun/expython | 0 | 12781105 | #!/usr/bin/python
# -*- coding:utf8 -*-
import os, re
import collections
from pylogger import getLogger
from package_defines import PackageInfo
from deprecated.ast_pyclass_parser import ConanFileParserWarapper
class ConanPkgAnalyzer(object):
'''conan包分析器'''
def __init__(self, scanpath, type):
self._sc... | 2.703125 | 3 |
src/main_step.py | KTH-dESA/OSeMOSYS_step | 0 | 12781106 | <reponame>KTH-dESA/OSeMOSYS_step
# main script to run the step function of OSeMOSYS
#%% Importe required packages
import data_split
import os
from otoole import ReadDatapackage
from otoole import WriteDatafile
from otoole import Context
import results_to_next_step as rtns
import step_to_final as stf
import subprocess a... | 1.992188 | 2 |
tweet/__init__.py | leo0309/django-demo | 0 | 12781107 | #replace MySQLdb with pymysql
import pymysql
pymysql.install_as_MySQLdb() | 1.28125 | 1 |
nbdt/data/cub.py | lisadunlap/explainable-nbdt | 1 | 12781108 | <reponame>lisadunlap/explainable-nbdt<gh_stars>1-10
import os
import pandas as pd
from torchvision.datasets.folder import default_loader
from torchvision.datasets.utils import download_url
from torch.utils.data import Dataset
import torchvision.transforms as transforms
from PIL import Image
__all__ = names = ('CUB2011... | 3.0625 | 3 |
filer/tests/__init__.py | Wordbank/django-filer | 0 | 12781109 | <reponame>Wordbank/django-filer
#-*- coding: utf-8 -*-
from django.test import TestCase
class Mock():
pass
from filer.tests.admin import *
from filer.tests.models import *
from filer.tests.fields import *
from filer.tests.utils import *
from filer.tests.tools import *
from filer.tests.permissions import *
class ... | 1.9375 | 2 |
aoomuki_comp/app/migrations/0011_auto_20210108_0945.py | Kamelgasmi/aoomuki_competences | 0 | 12781110 | # Generated by Django 2.1 on 2021-01-08 08:45
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('app', '0010_auto_20210106_1426'),
]
operations = [
migrations.AlterField(
model_name='collaborater',
name='Society',
... | 1.523438 | 2 |
xl_data_tools.py | will-leone/xl_data_tools | 0 | 12781111 | import os
import csv
import itertools
import datetime
import string
import subprocess
from email.message import EmailMessage
import smtplib
import ssl
import zipfile
import xlwings as xw
import xlsxwriter
"""
This module provides convenient objects for pulling,
cleaning, and writing data between Excel and Python.
It ... | 2.984375 | 3 |
day_03.py | seeM/advent-of-code-2018 | 0 | 12781112 | <reponame>seeM/advent-of-code-2018
"""
Idea:
-----
Build a grid in a single pass through the data:
Grid is a dict, mapping (x, y) co-ordinates to a list of claim IDs
Grid counts is a dict, mapping (x, y) co-ordinates to length of list
Count number of elements in grid_counts with value > 1
"""
import re
from c... | 3.046875 | 3 |
eegpy/stats/tests/TestCluster.py | thorstenkranz/eegpy | 10 | 12781113 | <filename>eegpy/stats/tests/TestCluster.py
import numpy as np
from numpy.testing import (assert_array_almost_equal,
assert_array_equal)
from nose.tools import assert_true, assert_equal, assert_raises, raises
from eegpy.stats.cluster import ClusterSearch1d
from eegpy.filter.smoothing ... | 2.265625 | 2 |
optimum/onnxruntime/quantization.py | XinyuYe-Intel/optimum | 0 | 12781114 | # Copyright 2021 The HuggingFace Team. 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 app... | 1.8125 | 2 |
fomms_integrate/newton_cotes.py | mquevill/fomms_integrate | 0 | 12781115 | """
This file contains the implementation of the Newton-Cotes rules
"""
import numpy as np
def rectangle(x, f):
"""
Compute a 1D definite integral using the rectangle (midpoint) rule
Parameters
----------
f : function
User defined function.
x : numpy array
Integration domain.
... | 3.796875 | 4 |
scripts/benchmark_ecef2geo.py | wrlssqi/pymap3d | 116 | 12781116 | <filename>scripts/benchmark_ecef2geo.py
#!/usr/bin/env python3
"""
benchmark ecef2geodetic
"""
import time
from pymap3d.ecef import ecef2geodetic
import numpy as np
import argparse
ll0 = (42.0, 82.0)
def bench(N: int) -> float:
x = np.random.random(N)
y = np.random.random(N)
z = np.random.random(N)
... | 2.46875 | 2 |
alarmer/log.py | long2ice/alert | 16 | 12781117 | import logging
from alarmer import Alarmer
class LoggingHandler(logging.Handler):
def __init__(self, level: int = logging.ERROR):
super().__init__()
self.level = level
def emit(self, record: logging.LogRecord) -> None:
if record.levelno >= self.level:
exc_info = record.ex... | 2.6875 | 3 |
herethere/here/magic.py | b3b/herethere | 0 | 12781118 | <gh_stars>0
"""here.magic"""
import asyncio
from IPython.core import magic_arguments
from IPython.core.magic_arguments import parse_argstring
from IPython.core.magic import (
line_magic,
magics_class,
)
from herethere.everywhere.magic import MagicEverywhere
from herethere.here import ServerConfig, start_serv... | 2.40625 | 2 |
phoobe/resources.py | berendt/heat-vagrant | 0 | 12781119 | # based on https://github.com/stackforge/flame/blob/master/flameclient/flame.py
template_skeleton = '''
heat_template_version: 2013-05-23
description: Generated template
parameters:
resources:
'''
class Resource(object):
"""Describes an OpenStack resource."""
def __init__(self, name, type, id=None, propertie... | 2.0625 | 2 |
__init__.py | mynameismon/comp-project-grade-11 | 3 | 12781120 | <gh_stars>1-10
from os import getcwd
import os
import mdmaketoc
def __init__():
problemnumber = int(input("Enter the problem number: \n >> "))
foldername = "Problem-No-" + str(problemnumber)
path = getcwd() + "\\" + foldername
# creates directory if it does not exist
try:
os.mkdir(path)
except OSErro... | 2.8125 | 3 |
gza/gzacommon.py | ynadji/drop | 6 | 12781121 | import sys
import nfqueue
import socket
import signal
import time
import whitelist
from collections import defaultdict
class GZA(object):
def __init__(self, vmnum, opts):
self.gamestate = defaultdict(int)
self.vmnum = vmnum
self.iface = 'tap%d' % vmnum
self.opts = opts
self.... | 2.296875 | 2 |
math-and-algorithm/005.py | silphire/training-with-books | 0 | 12781122 | # https://atcoder.jp/contests/math-and-algorithm/tasks/math_and_algorithm_e
input()
print(sum(map(int, input().split())) % 100) | 2.234375 | 2 |
booking/models.py | foad-heidari/django-booking | 1 | 12781123 | from django.db import models
from django.conf import settings
BOOKING_PERIOD = (
("5","5M"),
("10","10M"),
("15","15M"),
("20","20M"),
("25","25M"),
("30","30M"),
("35","35M"),
("40","40M"),
("45","45M"),
("60","1H"),
("75","1H 15M"),
("90","1H 30M"),
("105","1H 4... | 2.046875 | 2 |
resources/site-packages/xbmctorrent/player.py | neno1978/xbmctorrent | 0 | 12781124 | import xbmc
import xbmcgui
import urllib
import os
import time
import urlparse
from xbmctorrent import plugin, torrent2http
from xbmctorrent.ga import track_event
from xbmctorrent.utils import url_get_json
from contextlib import contextmanager, closing, nested
TORRENT2HTTP_TIMEOUT = 20
TORRENT2HTTP_POLL = 200
WINDOW... | 2.25 | 2 |
ambient-poly.py | bpaauwe/AmbientWeatherNS | 0 | 12781125 | #!/usr/bin/env python3
"""
Polyglot v2 node server for Ambient Weather data.
Copyright (c) 2018 <NAME>
"""
CLOUD = False
try:
import polyinterface
except ImportError:
import pgc_interface as polyinterface
CLOUD = True
import sys
import time
import requests
import json
LOGGER = polyinterface.LOGGER
class C... | 2.515625 | 3 |
mmdeploy/codebase/mmdet3d/models/voxelnet.py | xizi/mmdeploy | 746 | 12781126 | # Copyright (c) OpenMMLab. All rights reserved.
from mmdeploy.core import FUNCTION_REWRITER
@FUNCTION_REWRITER.register_rewriter(
'mmdet3d.models.detectors.voxelnet.VoxelNet.simple_test')
def voxelnet__simple_test(ctx,
self,
voxels,
num... | 2.375 | 2 |
autopy/core/Option.py | songofhawk/autopy | 1 | 12781127 | <gh_stars>1-10
class Option:
project: str = './conf/auto_dingding.yaml'
def __init__(self, project):
self.project = project if project is not None else self.project
| 2.234375 | 2 |
pyextmod_starter.py | WarrenWeckesser/pyextmod_starter | 0 | 12781128 | # Copyright © 2021 <NAME>
# Distributed under the MIT license.
"""
This module defines the function
def generate_extmod(module_name, module_doc, funcs,
c_filename=None, setup_filename="setup.py")
It generates C code for a Python extension module, with boilerplate code
for defining functio... | 2.359375 | 2 |
bots/stocks/due_diligence/supplier.py | jbushago/GamestonkTerminal | 1 | 12781129 | import logging
import disnake
import requests
from bs4 import BeautifulSoup
from bots import imps
from gamestonk_terminal.decorators import log_start_end
logger = logging.getLogger(__name__)
@log_start_end(log=logger)
def supplier_command(ticker=""):
"""Displays suppliers of the company [CSIMarket]"""
# D... | 2.84375 | 3 |
displayingImage.py | pratyushshivam/Tesla-Car-Detector | 0 | 12781130 | import cv2
#Our Image
img_file='CarImage.jpg'
#Our pre-trained car classifier
classifier_file = 'car_detector.xml'
#create opencv image
img = cv2.imread(img_file)
# Display the image with the cars spotted
cv2.imshow('Car_detector',img) #pops a window with the image
#Don't autoclose
cv2.waitKey() ... | 3.65625 | 4 |
tests/test_grad.py | papamarkou/eeyore | 6 | 12781131 | # %% # Definition of function whose analytical and autograd gradient are compared
#
# $$
# \begin{align}
# f(x, y) & =
# x^3 y^4, \\
# \nabla (f(x, y)) & =
# \begin{pmatrix}
# 3 x^2 y^4 \\
# 4 x^3 y^3
# \end{pmatrix}.
# \end{align}
# $$
# %% Import packages
import torch
import unittest
# %% Define function f whose ... | 2.84375 | 3 |
falmer/studentgroups/migrations/0004_auto_20170703_1633.py | sussexstudent/services-api | 2 | 12781132 | <filename>falmer/studentgroups/migrations/0004_auto_20170703_1633.py
# -*- coding: utf-8 -*-
# Generated by Django 1.11.2 on 2017-07-03 16:33
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('studentgroups', '0003_a... | 1.445313 | 1 |
config.py | ufo-project/minepool-data-server | 3 | 12781133 | #!/usr/bin/env python
# encoding: utf-8
import os
basedir = os.path.abspath(os.path.dirname(__file__))
class Config(object):
SECRET_KEY = os.environ.get('SECRET_KEY') or 'SUPER-SECRET'
LOGFILE = "server.log"
class DevelopmentConfig(Config):
DEBUG = True
LOG_BACKTRACE = True
LOG_LEVEL = 'DEBUG'... | 2.046875 | 2 |
test.py | Maciejfiedler/random-flask-app | 1 | 12781134 | <filename>test.py
def readfromtxt():
with open("requests.txt", "r") as f:
return f.read()
print(readfromtxt())
| 2.640625 | 3 |
gurun/gui/io.py | gabrielguarisa/gurun | 1 | 12781135 | from typing import Any, Callable, List
import random
from gurun.node import Node, WrapperNode
try:
import pyautogui
except ImportError:
raise ImportError(
"pyautogui is not installed. Please install it with `pip install pyautogui`."
)
class Typewrite(WrapperNode):
def __init__(self, **kwarg... | 2.390625 | 2 |
images/foss-asic-tools/addons/sak/bin/delete_areaid.py | isabella232/foss-asic-tools | 9 | 12781136 |
# Enter your Python code here
import pya
from time import sleep
print("Starting...")
app = pya.Application.instance()
win = app.main_window()
# Load technology file
#tech = pya.Technology()
#tech.load(tech_file)
#layoutOptions = tech.load_layout_options
# Load def/gds file in the main window
#cell_view = win.load_... | 2.40625 | 2 |
easy/single number/solution.py | ilya-sokolov/leetcode | 4 | 12781137 | from typing import List
class Solution:
def singleNumber(self, nums: List[int]) -> int:
result = 0
for i in nums:
result ^= i
return result
s = Solution()
print(s.singleNumber([2, 2, 1]))
print(s.singleNumber([4, 1, 2, 1, 2]))
print(s.singleNumber([1]))
| 3.421875 | 3 |
vector_comparison/xi_squared.py | jensv/relative_canonical_helicity_tools | 0 | 12781138 | import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
import sys
from vector_calculus import vector_calculus as vc
def calc_and_plot_dists(field1, field2,
field1_title=None,
field2_title=None,
units=None):
r"""
"""
... | 2.765625 | 3 |
riptide_controllers/action/gateManeuver.py | tsender/riptide_software | 0 | 12781139 | #! /usr/bin/env python
import rospy
import actionlib
import dynamic_reconfigure.client
from riptide_msgs.msg import AttitudeCommand, LinearCommand, Imu
from std_msgs.msg import Float32, Float64, Int32
import riptide_controllers.msg
import time
import math
import numpy as np
def angleDiff(a, b):
return ((a-b+180... | 2.453125 | 2 |
tools/display_bemf_graph.py | tuw-cpsg/bldc-controller | 0 | 12781140 | <filename>tools/display_bemf_graph.py
import serial
import matplotlib.pyplot as plt
import numpy as np
import struct
class DataFromController:
s1 = None
s2 = None
s3 = None
def __init__(self, s1=None, s2=None, s3=None):
self.s1 = s1
self.s2 = s2
self.s3 = s3
def __str__(s... | 2.875 | 3 |
scrape_mars.py | jleibfried/web-scraping-challenge | 0 | 12781141 |
import requests
import pymongo
from splinter import Browser
from bs4 import BeautifulSoup
import pandas as pd
from flask import Flask, render_template
# Create an instance of our Flask app.
app = Flask(__name__)
# Create connection variable
conn = 'mongodb://localhost:27017'
# Pass connection to the pymongo instanc... | 3.046875 | 3 |
music_tag/wave.py | gyozaaaa/music-tag | 28 | 12781142 | #!/usr/bin/env python
# coding: utf-8
try:
import mutagen.wave
from music_tag.id3 import Id3File
class WaveId3File(Id3File):
tag_format = "Wave[Id3]"
mutagen_kls = mutagen.wave.WAVE
def __init__(self, filename, **kwargs):
super(WaveId3File, self).__init__(filename, *... | 2.03125 | 2 |
logo.py | KOLANICH/UniOpt | 1 | 12781143 | <filename>logo.py<gh_stars>1-10
import numpy as np
from funcs import logoFunc
import matplotlib
from matplotlib import pyplot as plt
import PIL.Image
import colorcet
def background(xscale=3):
return np.mean(makeLogo(xscale*10)[-1])
defaultRes=2048
def makeLogo(x=0, y=0, xscale=3, xres=defaultRes, yres=d... | 2.40625 | 2 |
utils/settings.py | alex-ortega-07/hand-writing-recognition-model | 2 | 12781144 | <filename>utils/settings.py<gh_stars>1-10
import pygame
pygame.init()
# We declare some screen constants
WIDTH, HEIGHT = 300, 360
FPS = 240
# Here are some colors
BG_COLOR = 255, 255, 255
LINE_COLOR = 120, 120, 120
PIXEL_ACTIVE_COLOR = 0, 0, 0
BLACK = 0, 0, 0
WHITE = 255, 255, 255
# Below, we declare... | 2.75 | 3 |
app/extractor/__init__.py | ken-pan/wallpaper-downloader | 2 | 12781145 | """
request(method, url, params=None, data=None, headers=None, cookies=None, files=None, auth=None, timeout=None, allow_redirects=True, proxies=None, hooks=None, stream=None, verify=None, cert=None, json=None)
参数:
method -- 请求方法
url -- 网址
params -- url中传递参数,字典类型{'key':'value'},http://www.ba... | 2.90625 | 3 |
src/ContactParticleFilter/python/twostepestimator.py | mpetersen94/spartan | 0 | 12781146 | <gh_stars>0
__author__ = 'manuelli'
# system imports
import numpy as np
from collections import namedtuple
# director imports
from director import transformUtils
import director.vtkAll as vtk
from director import lcmUtils
# CPF imports
from pythondrakemodel import PythonDrakeModel
import contactfilterutils as cfUtil... | 2.203125 | 2 |
general/update_buildnum.py | shawnj/python | 0 | 12781147 | import os
import json
import sys
file = sys.argv[1]
buildsite = sys.argv[2]
buildnum = sys.argv[3]
fileid = sys.argv[4]
with open(file, "r") as jsonFile:
data = json.load(jsonFile)
if fileid is not "":
data["default_attributes"]["Sites"][buildsite.upper()]["BUILD"] = str(buildnum) + "." + str(fileid)
else:
... | 2.84375 | 3 |
data_analysis/audiocommons_ffont/tempo_estimation/evaluation_metrics.py | aframires/freesound-loop-annotator | 18 | 12781148 | <reponame>aframires/freesound-loop-annotator
from ..ac_utils.general import vfkp
def accuracy1(data, method, sound_ids=None, tolerance=0.04, skip_zeroed_values=False):
"""
Compares estimated bpm with annotated bpm of provided data. Considers as good matches values that do not differ
more than the toleranc... | 2.75 | 3 |
templates/server.py | eatsleeplim/ansible-role-install-root-cert | 7 | 12781149 | import BaseHTTPServer, SimpleHTTPServer
import ssl
httpd = BaseHTTPServer.HTTPServer(('0.0.0.0', 443), SimpleHTTPServer.SimpleHTTPRequestHandler)
httpd.socket = ssl.wrap_socket (httpd.socket, certfile='{{ certfile_pem }}', server_side=True)
httpd.serve_forever()
| 2.328125 | 2 |
release/stubs.min/System/Windows/Forms/__init___parts/TreeNodeMouseClickEventArgs.py | YKato521/ironpython-stubs | 0 | 12781150 | class TreeNodeMouseClickEventArgs(MouseEventArgs):
"""
Provides data for the System.Windows.Forms.TreeView.NodeMouseClick and System.Windows.Forms.TreeView.NodeMouseDoubleClick events.
TreeNodeMouseClickEventArgs(node: TreeNode,button: MouseButtons,clicks: int,x: int,y: int)
"""
@staticmethod
... | 2.28125 | 2 |