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 |
|---|---|---|---|---|---|---|
workbench/planning/migrations/0007_planningrequest_receivers.py | yoshson/workbench | 15 | 12770051 | <reponame>yoshson/workbench
# Generated by Django 3.2a1 on 2021-02-21 10:51
from django.conf import settings
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
("planning", "0006_auto_2021022... | 1.734375 | 2 |
optixrap/tests/interpolationTest_interpol.py | hanswenzel/opticks | 11 | 12770052 | <gh_stars>10-100
#!/usr/bin/env python
#
# Copyright (c) 2019 Opticks Team. All Rights Reserved.
#
# This file is part of Opticks
# (see https://bitbucket.org/simoncblyth/opticks).
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
#... | 1.914063 | 2 |
app/__init__.py | gabriel-esco/3.3.7.2 | 0 | 12770053 | <filename>app/__init__.py<gh_stars>0
import os
from flask import Flask, render_template, send_from_directory, request, flash
from flask_wtf import Form
from wtforms import TextField, BooleanField, TextAreaField, SubmitField, validators, ValidationError
from dotenv import load_dotenv
load_dotenv()
app = Flask(__name__)... | 2.796875 | 3 |
norimdb/db.py | meeron/norimdb | 0 | 12770054 | """Module defines NorimDb class"""
from os import path, SEEK_END
from .exceptions import *
import pybinn
from .docid import DocId
class NorimDb:
"""NorimDb class"""
def __init__(self, dir_path):
if not path.isdir(dir_path):
raise DbError(ERR_PATH, path=dir_path)
self._sys = {
... | 2.40625 | 2 |
scripts/visualstudio/__init__.py | GeneralLeeInept/inpet | 0 | 12770055 | __all__ = ["solution"]
| 0.996094 | 1 |
puavro/puavro.py | bry00/puavro | 0 | 12770056 | import io
import pulsar
import fastavro
class DictAVRO(dict):
"""``DictAVRO`` provides dictionary class compatible with the Pulsar AVRO "record" interface.
The class is based on regular Python dictionary (``dict``).
The actual "record" classes should be based on the ``DictAVRO`` and either:
- set `... | 2.9375 | 3 |
ghost/engine.py | pikulet/ghost | 1 | 12770057 | <gh_stars>1-10
from bidict import bidict
from ghost.ghost import Ghost
from typing import List, Dict
import logging
class GhostEngine:
ERR_TOO_MANY_GAMES = 'Too many ongoing games... Please wait...'
ERR_GID_ALREADY_EXISTS = 'There is already an ongoing game in this group'
ERR_GID_DOES_NOT_EXIST = 'Game ... | 2.6875 | 3 |
mspray/apps/mda/views/map.py | onaio/mspray | 0 | 12770058 | # -*- coding: utf-8 -*-
"""Map views"""
import json
from django.conf import settings
from django.views.generic import DetailView
from mspray.apps.main.mixins import SiteNameMixin
from mspray.apps.main.models import Location
from mspray.apps.main.query import get_location_qs
from mspray.apps.main.serializers.target_ar... | 2.078125 | 2 |
model/common/runway.py | mlabru/visil | 0 | 12770059 | # -*- coding: utf-8 -*-
"""
runway
revision 0.2 2015/dez mlabru
pep8 style conventions
revision 0.1 2014/nov mlabru
initial release (Linux/Python)
"""
# < imports >--------------------------------------------------------------------------------------
# model
import model.common.fix as CFix
# < class CRunway >--... | 1.882813 | 2 |
src/modules/check_email.py | Nobregaigor/Optical-Mark-Registration-PDF-Reader | 0 | 12770060 | from .functions import read_pdf, read_emails_list
def get_email_from_pdf(*args, **kwargs):
input_file = args[0]["input_file"]
emails_list_file = args[0]["emails_list"]
emails_df = read_emails_list(emails_list_file)
(u_data, conf, conf_per_n) = read_pdf(input_file)
unumber = int("".join([str(v) fo... | 2.921875 | 3 |
easy/number-of-1-bits.py | trilliwon/LeetCode | 0 | 12770061 | class Solution(object):
def hammingWeight(self, n):
"""
:type n: int
:rtype: int
"""
if n == 1:
return 1
hw = 0
while n != 0:
if n % 2 == 1:
hw += 1
n //= 2
return hw
| 3.609375 | 4 |
build/lib/ezyt/imageEditor/__init__.py | AlexBacho/ezyt | 1 | 12770062 | <gh_stars>1-10
from .editor import ImageEditor | 1 | 1 |
built-in/TensorFlow/Official/cv/image_classification/ResnetVariant_for_TensorFlow/automl/vega/algorithms/nas/jdd_ea/jdd_ea_codec.py | Huawei-Ascend/modelzoo | 12 | 12770063 | # -*- coding:utf-8 -*-
# Copyright (C) 2020. Huawei Technologies Co., Ltd. All rights reserved.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the MIT License.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the ... | 2.640625 | 3 |
test.py | csmets/CSSCrypt | 0 | 12770064 | # Testing CSSCrypt
import CSSCrypt
shiftKey = '3453465'
CSSCrypt = CSSCrypt.encryption()
encMsg = CSSCrypt.encrypt('My Secret Message', shiftKey)
print (encMsg)
print(CSSCrypt.decrypt(encMsg, shiftKey))
| 2.265625 | 2 |
credstuffer/proxy/grabber.py | bierschi/credstuffer | 0 | 12770065 | <reponame>bierschi/credstuffer
import requests
import logging
from bs4 import BeautifulSoup
from concurrent.futures import ThreadPoolExecutor, as_completed
class ProxyGrabber:
"""class ProxyGrabber to grab different kinds of proxies
USAGE:
grabber = ProxyGrabber()
grabber.collect_prox... | 2.453125 | 2 |
ravendb/serverwide/server_operation_executor.py | ravendb/RavenDB-Python-Client | 8 | 12770066 | from __future__ import annotations
import enum
from typing import Union, TYPE_CHECKING
from ravendb.http.request_executor import ClusterRequestExecutor
from ravendb.http.topology import Topology
from ravendb.serverwide.operations.common import (
GetBuildNumberOperation,
ServerOperation,
VoidServerOperatio... | 1.976563 | 2 |
app/views/login_page.py | ngocjr7/scoss_webapp | 3 | 12770067 | <gh_stars>1-10
import os
import sys
from werkzeug.utils import secure_filename
from flask import Flask, render_template, url_for, request, redirect, session, jsonify, Blueprint
from scoss import smoss
import requests
from sctokenizer import Source
from scoss import Scoss
from scoss.metrics import all_metrics
from model... | 2.15625 | 2 |
goldenmask/protect.py | youngquan/goldenmask | 6 | 12770068 | <reponame>youngquan/goldenmask
import compileall
import multiprocessing
import os
import shutil
import sys
from distutils.core import setup
from pathlib import Path
from Cython.Build import cythonize
from Cython.Compiler import Options
from goldenmask import GOLDENMASK, logger
from goldenmask.exceptions import NoPytho... | 1.898438 | 2 |
bpexts/hbp/sequential.py | f-dangel/hbp | 13 | 12770069 | <filename>bpexts/hbp/sequential.py<gh_stars>10-100
"""
Hessian backpropagation implementation of torch.nn.Sequential. and conversion
of torch.nn layers to HBP layers.
"""
from backpack.core.layers import Flatten
# torch layers
from torch.nn import (
Conv2d,
CrossEntropyLoss,
Linear,
MaxPool2d,
ReL... | 2.453125 | 2 |
tests/old_suite/interactive/pyqt5_qml_qrc.py | soleil0-0/pyinstaller | 2 | 12770070 | # -*- coding: utf-8 -*-
# Resource object code
#
# Created: Wed Sep 4 08:34:31 2013
# by: The Resource Compiler for PyQt (Qt v5.1.1)
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore
qt_resource_data = b"\
\x00\x00\x00\xf9\
\x69\
\x6d\x70\x6f\x72\x74\x20\x51\x74\x51\x75\x69\x63\x... | 1.085938 | 1 |
graph/__init__.py | mrhash101/zincbase | 1 | 12770071 | from collections import defaultdict
import networkx as nx
class Node:
"""Class representing a node in the KB.
"""
def __init__(self, kb, name, data, watches=[]):
super().__setattr__('_kb', kb)
super().__setattr__('_name', name)
nx.set_node_attributes(self._kb.G, {self._name: data})... | 2.75 | 3 |
utils.py | yxtay/text-classification-tensorflow | 9 | 12770072 | <gh_stars>1-10
import os
import re
import pandas as pd
import tensorflow as tf
###
# file system
###
PROJECT_DIR = os.path.abspath(os.path.dirname(__file__))
def make_dirs(path, empty=False):
"""
create dir and clear if required
"""
os.makedirs(path, exist_ok=True)
if empty:
files = [o... | 2.5625 | 3 |
src/scripts/m2o-analysis.py | ai-ku/upos | 4 | 12770073 | #!/usr/bin/env python
# # Sample Usage:
# # ./m2o-analysis.py enw.words.gz enw.pos.gz
# # > perp>1.75
# # dance 1.75 12
# # Crowd 1.75 8
# # meltdown 1.75 4
# # Personnel 1.75 4
# # ...
# # >
# #
from collections import defaultdict as dd
import gzip
from itertools import izip
import math
import re
import sys
def read... | 2.75 | 3 |
test/test_timer.py | vaiorabbit/python-sdl2 | 1 | 12770074 | import ctypes, ctypes.util
import sys, os, threading, time
sys.path.append(os.pardir)
import sdl2
#from sdl2 import *
def timer_callback_fn(interval, param):
print("HI")
return interval
def timer_test():
resolution = 60
cb = sdl2.SDL_TimerCallback(timer_callback_fn)
print(type(cb))
t1 = sdl2.... | 2.75 | 3 |
practice/88.py | porala/python | 1 | 12770075 | #Create a script that uses countries_by_area.txt file as data sourcea and prints out the top 5 most densely populated countries
import pandas
data = pandas.read_csv("countries_by_area.txt")
data["density"] = data["population_2013"] / data["area_sqkm"]
data = data.sort_values(by="density", ascending=False)
fo... | 3.875 | 4 |
src/vendor/configrpc/plugin.py | radomirklacza/C-BAS | 0 | 12770076 | import eisoil.core.pluginmanager as pm
from crpc.configrpc import ConfigRPC
def setup():
# setup config keys
xmlrpc = pm.getService('xmlrpc')
xmlrpc.registerXMLRPC('configrpc', ConfigRPC(), '/amconfig') # handlerObj, endpoint | 1.453125 | 1 |
utils/restful_status.py | jin-hao-chen/team_go_backend | 0 | 12770077 | <filename>utils/restful_status.py
STATUS_SUCCESS = 0
STATUS_ERROR = 1
| 1.070313 | 1 |
aglocl.py | gunnihinn/aglocl | 4 | 12770078 | #!/usr/bin/env python3
import re
import time
import sys
import requests
from bs4 import BeautifulSoup
def name_and_class(tag_name, class_name):
return lambda e: e.name == tag_name and e.has_attr('class') and class_name in e['class']
def find_search_result_pages(url):
'Return a list of URLs of the pages of s... | 3.03125 | 3 |
biolabs/core/views.py | romgar/django-biolabs | 0 | 12770079 |
# Create your views here.
from rest_framework import viewsets
from biolabs.core import models as core_models
from biolabs.core.serializers import LaboratorySerializer
class LaboratoryViewSet(viewsets.ModelViewSet):
"""
API endpoint that allows labs to be viewed or edited.
"""
queryset = core_models.... | 1.8125 | 2 |
players.py | oxrock/chess-learner | 0 | 12770080 | <filename>players.py<gh_stars>0
import random
from math import inf
import numpy as np
from chessbot_utils import fast_predict
from math import inf
import chess
import chess.engine
import cProfile, pstats
class Player:
def __init__(
self, team: int, encoder: dict, score_encoder: dict, boosted_rewards: bool... | 2.640625 | 3 |
ex04/bissextile.py | joaquim2509pedro/Day02 | 0 | 12770081 | <reponame>joaquim2509pedro/Day02
annee = int(input (f"Saisissez une année\n"))
if (annee%4 != 0):
print ("ce n'est pas une annee bissextile")
else:
if (annee%100 == 0 and annee%400 != 0):
print ("ce n'est une annee bissextile")
else :
print ("c'est une annee bissextile")
| 3.5 | 4 |
nlptasks/dephead.py | ulf1/nlptasks | 2 | 12770082 | <filename>nlptasks/dephead.py<gh_stars>1-10
from .padding import pad_merge_adjac_maskseqs
from .vocab import texttoken_to_index
from typing import List, Tuple
import warnings
import de_core_news_lg as spacy_model
import spacy
import stanza
# https://universaldependencies.org/u/dep/index.html
UD2_RELS = [
'acl', '... | 2.140625 | 2 |
smlgui/ui.py | akshaybabloo/SNNML-GUI | 0 | 12770083 | <reponame>akshaybabloo/SNNML-GUI<gh_stars>0
"""
UI class to control the visibility, usability and control of GUI.
"""
import logging
import os
import numpy as np
from PyQt5 import uic, QtWidgets, QtGui, QtCore
from smlgui import __version__
from smlgui.utility import select_folder, loading_effects_decorator, get_sml_... | 1.890625 | 2 |
noc/bouncingball/ball.py | kantel/pygamezero | 1 | 12770084 | from pvector import PVector
WIDTH = 400
HEIGHT = 400
class Ball():
def __init__(self, x, y, v_x, v_y, radius, color):
self.position = PVector(x, y)
self.radius = radius
self.color = color
self. velocity = PVector(v_x, v_y)
def show(self, screen):
screen.draw.f... | 3.515625 | 4 |
models.py | kdropps87/dotstarweb | 0 | 12770085 | <filename>models.py
from sqlalchemy import Boolean, Column, ForeignKey
from sqlalchemy.sql.schema import Index
from sqlalchemy.orm import relation, relationship
from sqlalchemy.sql.sqltypes import Float, Enum, Integer, String
from database import Base
import enum
class LightingMode(str, enum.Enum):
single_color =... | 2.5 | 2 |
History/DelayDDPG_origin_version.py | GuanShiTing/DL_RL_Zoo | 1 | 12770086 | <reponame>GuanShiTing/DL_RL_Zoo
import os
from time import time as timer
import gym
import numpy as np
import numpy.random as rd
import torch
import torch.nn as nn
import torch.nn.functional as F
"""
GitHub: https://github.com/Yonv1943/LightWeight_Stable_ReinfLearning
Origin: Zen4 Jia1Hao2(Yonv1943), 2019-07-07
Lu... | 2.15625 | 2 |
best_browsable_api/templatetags/browsable_api.py | alsur/best-browsable-api | 2 | 12770087 | from django.template import Library
from django.utils.encoding import force_text
register = Library()
def force_text_filter(obj):
return force_text(obj)
register.filter('force_text', force_text_filter)
| 1.554688 | 2 |
freenit/models/mixins.py | mekanix/fastapi-playground | 0 | 12770088 | from typing import Optional
import ormar
import pydantic
from ..config import getConfig
config = getConfig()
class AllOptional(pydantic.main.ModelMetaclass):
def __new__(self, name, bases, namespaces, **kwargs):
annotations = namespaces.get("__annotations__", {})
for base in bases:
... | 2.28125 | 2 |
src/apex/algo/shared.py | kpwhri/apex_iud_nlp | 1 | 12770089 | <reponame>kpwhri/apex_iud_nlp
from apex.algo.pattern import Pattern
# date pattern
years_ago = r'(?:\d+ (?:year|yr|week|wk|month|mon|day)s? (?:ago|before|previous))'
date_pat = r'\d+[-/]\d+[-/]\d+'
date2_pat = r'\d+[/]\d+'
month_pat = r'\b(?:jan|feb|mar|apr|may|jun|jul|aug|sept|oct|nov|dec)\w*(?:\W*\d{1,2})?\W*\d{4}'
... | 2.46875 | 2 |
day1.py | luciansmith/adventOfCode | 0 | 12770090 | import numpy
prev = numpy.inf
prev2 = numpy.inf
prev3 = numpy.inf
increases = 0
for line in open("day1_input.txt"):
# for line in open("day1_example.txt"):
next = int(line.strip())
if prev3 < next:
increases += 1
prev3 = prev2
prev2 = prev
prev = next
print(increases)
| 3.1875 | 3 |
issue_order/migrations/0015_auto_20180823_2108.py | jiejiang/courier | 0 | 12770091 | # -*- coding: utf-8 -*-
# Generated by Django 1.10.8 on 2018-08-23 20:08
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('issue_order', '0014_auto_20180819_2108'),
]
operat... | 1.617188 | 2 |
iepy/webui/corpus/migrations/0014_data_migration_move_metadata.py | francolq/iepy | 813 | 12770092 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
import logging
from django.db import models, migrations
logging.basicConfig(format="%(asctime)-15s %(message)s")
logger = logging.getLogger(__file__)
logger.setLevel(logging.INFO)
BULK_SIZE = 2500
def move_metadata(apps, schema_editor):
IEDocumen... | 2 | 2 |
ymir/command/tests/unit/test_cmd_merge.py | under-chaos/ymir | 1 | 12770093 | <gh_stars>1-10
import logging
import os
import shutil
from typing import Dict, List, Tuple
import unittest
from google.protobuf.json_format import MessageToDict, ParseDict
from mir.commands.merge import CmdMerge
from mir.protos import mir_command_pb2 as mirpb
from mir.tools.code import MirCode
import tests.utils as t... | 2.125 | 2 |
django/tests/conftest.py | fossabot/docker-django | 0 | 12770094 | import pytest
from rest_framework.test import APIClient
from tests.factories import accounts
@pytest.fixture
def api_client():
api = APIClient()
return api
@pytest.fixture
def superuser():
return accounts.superuser()
| 1.695313 | 2 |
demos/simple_pipeline/gpu-example-pipeline.py | dimara/kubeflow-examples | 6 | 12770095 | <reponame>dimara/kubeflow-examples
#!/usr/bin/env python3
import kfp.dsl as kfp
def training_op(learning_rate: float,
num_layers: int,
optimizer='ftrl',
step_name='training'):
return kfp.ContainerOp(
name=step_name,
image='katib/mxnet-mnist-example',
comma... | 2.671875 | 3 |
csvtest5.py | ivan-pi/rheology_lab | 0 | 12770096 | <filename>csvtest5.py<gh_stars>0
import csv
import numpy as np
from lmfit import minimize, Parameters, fit_report
import matplotlib.pyplot as plt
import maxwell as m
# INITIALIZE LISTS
omega = []
storG = []
lossG = []
dFactor = []
cVisc = []
# READ FROM CSV FILE
with open('1skupina.csv', 'rb') as csvfile:
for i i... | 2.671875 | 3 |
cosmosis-standard-library/shear/shear_bias/shear_m_bias.py | ktanidis2/Modified_CosmoSIS_for_galaxy_number_count_angular_power_spectra | 1 | 12770097 | """
Errors in cosmic shear measurement can lead to a multiplicative factor
scaling the observed shear spectra.
This module scales the measured C_ell to account for that difference,
assuming model values of the multplicative factor m, either per bin or for all bins.
"""
from __future__ import print_function
from buil... | 2.171875 | 2 |
SBP_SNN_pBP/train.py | lcx1997213/sbp | 6 | 12770098 | import torch
import torch.nn as nn
import torchvision.datasets as dsets
import torchvision.transforms as transforms
from torch.autograd import Variable
from SNN import SNN
import time
import os
from tensorboardX import SummaryWriter
from nettalk import Nettalk
from gesture import Gesture
import argparse
parser = argpa... | 2.21875 | 2 |
file_storage/users.py | cleac/knu-oop-module | 0 | 12770099 | <filename>file_storage/users.py
import json
from enum import IntEnum
from file_storage.utils import Deserializable
from file_storage.utils import Serializable
Roles = IntEnum("Roles", {
'user': 1,
'moderator': 2,
'admin': 3,
'superadmin': 4
})
class User(Serializable, Deserializable):
def __in... | 3.0625 | 3 |
output/models/sun_data/elem_decl/type_def/type_def01202m/type_def01202m1_xsd/__init__.py | tefra/xsdata-w3c-tests | 1 | 12770100 | <filename>output/models/sun_data/elem_decl/type_def/type_def01202m/type_def01202m1_xsd/__init__.py
from output.models.sun_data.elem_decl.type_def.type_def01202m.type_def01202m1_xsd.type_def01202m1 import Root
__all__ = [
"Root",
]
| 1.265625 | 1 |
src/models/emotion_classifier/fasttext_hypertuning.py | Neronuser/EmoCourseChat | 1 | 12770101 | import csv
import subprocess
from itertools import product
import textacy
from sklearn.metrics import accuracy_score
from sklearn.metrics import f1_score
from sklearn.model_selection import train_test_split
from sklearn.preprocessing import LabelEncoder
from textacy.text_utils import detect_language
from src.utils im... | 2.71875 | 3 |
chho2/ignore/1.py | srishtikohli99/CHHO2 | 0 | 12770102 | <filename>chho2/ignore/1.py
# -*- coding: utf-8 -*-
"""
Created on Fri Jul 5 03:41:18 2019
@author: srishti
"""
print("Hello")
| 1.28125 | 1 |
covid_stats/apps.py | cploutarchou/covid-19-tracker | 0 | 12770103 | from django.apps import AppConfig
class CovidStatsConfig(AppConfig):
name = 'covid_stats'
| 1.039063 | 1 |
toolkit/filetype.py | yufeiminds/toolkit | 0 | 12770104 | <gh_stars>0
# coding=utf8
"""
Helper function for file types.
"""
from toolkit import ToolkitException
class FiletypeException(ToolkitException):
pass
class FiledetException(FiletypeException):
pass
_file_type_map = {
'.py': 'python',
'.sh': 'bash',
}
def filedet(name, fobj=None, suffix=None):
... | 3.234375 | 3 |
scripts/ruler/measures/cwl_rbp.py | leifos/cwl | 6 | 12770105 | <reponame>leifos/cwl
import numpy as np
from ruler.measures.cwl_metrics import CWLMetric
'''
@article{Moffat:2008:RPM:1416950.1416952,
author = {<NAME> <NAME>},
title = {Rank-biased Precision for Measurement of Retrieval Effectiveness},
journal = {ACM Trans. Inf. Syst.},
volume = {27},
number = {1},
year = {200... | 2.390625 | 2 |
utils/ana_score.py | igemsoftware/HFUT-China_2015 | 0 | 12770106 | <reponame>igemsoftware/HFUT-China_2015<filename>utils/ana_score.py<gh_stars>0
import os
import django
import sys
import traceback
pro_dir = os.getcwd()
sys.path.append(pro_dir)
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "BioDesigner.settings")
from design.models import parts
if __name__ == '__main__':
django... | 1.9375 | 2 |
metrics/fid.py | iviazovetskyi/rewriting | 526 | 12770107 | from __future__ import absolute_import, division, print_function
import torch
import warnings
from tqdm import tqdm
import pathlib
from scipy import linalg
import tensorflow as tf
import numpy as np
import os
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2'
def check_or_download_inception(inception_path):
''' Checks if t... | 2.40625 | 2 |
project/apps/CI-producer/app/constants.py | Monxun/PortainerPractice | 0 | 12770108 | # import os
# BANK_URL = os.environ['BANK_URL']
# TRANSACTION_URL = os.environ['TRANSACTION_URL']
# UNDERWRITER_URL = os.environ['UNDERWRITER_URL']
# USER_URL = os.environ['USER_URL']
# applications_url = f"http://{UNDERWRITER_URL}/applications"
# registration_url = f"http://{USER_URL}/users/registration"
# login_url... | 1.890625 | 2 |
solutions/day10.py | nitekat1124/advent-of-code-2018 | 0 | 12770109 | from utils.solution_base import SolutionBase
class Solution(SolutionBase):
def solve(self, part_num: int):
self.test_runner(part_num)
func = getattr(self, f"part{part_num}")
result = func(self.data)
return result
def test_runner(self, part_num):
test_inputs = self.get... | 3.25 | 3 |
TheArtificialPoet/draw.py | shyamvalsan/BotsRevolution | 0 | 12770110 | import subprocess
import random, os, sys
from PIL import Image, ImageDraw, ImageFont, ImageFilter
cmd20 = "awk -F\"|\" '$11 == 20{print}' ../poem_db.csv | sort -R | head -n 1"
cmd40 = "awk -F\"|\" '$11 == 40{print}' ../poem_db.csv | sort -R | head -n 1"
os.chdir(sys.argv[1])
for fn in os.listdir('.'):
fnr = random.c... | 2.21875 | 2 |
myfs.py | cty12/sdbfs | 0 | 12770111 | <reponame>cty12/sdbfs
#!/usr/bin/env python
import os
from stat import S_IFDIR, S_IFLNK, S_IFREG
from sys import argv, exit
from time import time
import traceback
import errno
from fuse import FUSE, FuseOSError, Operations
import sqlite3
class DbFS(Operations):
def __init__(self):
#print os.path.abspat... | 2.28125 | 2 |
data_clean_v2.py | Jacobvs/ML-Music-Analyzer | 6 | 12770112 | import ast
import json
import pickle
import ujson
import collections
import numpy as np
from chord_labels import parse_chord
from progressbar import ProgressBar, Bar, Percentage, AdaptiveETA, Counter
print("Opening files")
with open('dataset_chords.json', 'r') as values:
formatted_chords = ujson.load(values)
wit... | 2.515625 | 3 |
dolo/misc/display.py | zhuang13atJHU/dolo | 1 | 12770113 | <filename>dolo/misc/display.py
import sys
is_python_3 = sys.version_info >= (3, 0)
def read_file_or_url(url):
if 'http' in url:
if is_python_3:
import urllib.request
txt = urllib.request.urlopen(url).read()
txt = txt.decode('utf8') # not very robust
else:
... | 3.21875 | 3 |
get_together/views/speakers.py | bheesham/GetTogether | 1 | 12770114 | <filename>get_together/views/speakers.py
from django.utils.translation import ugettext_lazy as _
from django.utils.safestring import mark_safe
from django.contrib import messages
from django.contrib.auth import logout as logout_user
from django.shortcuts import render, redirect, get_object_or_404
from django.http impor... | 2.09375 | 2 |
examples/task.py | Nostalgiaaa/dispatcher | 3 | 12770115 | <filename>examples/task.py
import logging
from dispatcher import init_dispatcher
from celery import Celery
app = Celery('tasks', broker='redis://localhost')
app.conf.update(broker_transport_options={'visibility_timeout': 5})
logger = logging.getLogger('test')
init_dispatcher('.', '.', logger)
| 1.960938 | 2 |
tableprint/printer.py | veya2ztn/mltool | 0 | 12770116 | # -*- coding: utf-8 -*-
"""
Table printing
A module to print and display formatted tables of data
Usage
-----
>>> data = np.random.randn(10, 3)
>>> headers = ['Column A', 'Column B', 'Column C']
>>> tableprint.table(data, headers)
"""
from __future__ import print_function, unicode_literals
import sys
from numbers im... | 3.265625 | 3 |
main.py | huangjien/psInstance | 0 | 12770117 | <filename>main.py
import os
from fastapi import FastAPI, Body, HTTPException, status
from fastapi.responses import JSONResponse
from fastapi.encoders import jsonable_encoder
from pydantic import BaseModel, Field, EmailStr
from bson import ObjectId
from typing import Optional, List
import motor.motor_asyncio
from cachet... | 2.28125 | 2 |
worley_noise.py | yohei-washizaki/perlin | 1 | 12770118 | #!/usr/bin/env python3
import math
def calc_sqr_distance(a, b):
vx = a[0] - b[0]
vy = a[1] - b[1]
return vx * vx + vy * vy
def find_nearest_distance(uv, max_size, random_points):
xf, xi = math.modf(uv[0])
yf, yi = math.modf(uv[1])
min_sqr_distance = float("inf")
for y_offset in [-1... | 3.0625 | 3 |
pythonUtils/TUI_tools/automatic_questioner.py | tgquintela/pythonUtils | 1 | 12770119 |
"""
automatic_questioner
--------------------
Module which serves as a interactor between the possible database with the
described structure and which contains information about functions and
variables of other packages.
Scheme of the db
----------------
# {'function_name':
# {'variables':
# {'variabl... | 2.890625 | 3 |
opencenter/backends/nova/psbk_manager.py | oolorg/opencenter | 0 | 12770120 | <reponame>oolorg/opencenter<gh_stars>0
import ool_rm_if
import pica8_if
import pfs_if
import riava_if
import centec_if
import datetime
import pslist_backup
import commands
import os
# Physical Switch Backup/Restore Manager
TST_FLAG='OFF'
DBG_FLAG='ON'
TRACE_TITLE='PSBK_MANAGER:%s'
EXCEPT_TITLE='PSBK_MANAGER:%s'
AUTH_... | 2.0625 | 2 |
env/Lib/site-packages/libarchive-0.4.7/libarchive/constants/__init__.py | dondemonz/RestApi | 94 | 12770121 | <reponame>dondemonz/RestApi
from libarchive.constants.archive import *
from libarchive.constants.archive_entry import *
| 1.0625 | 1 |
setup.py | shridarpatil/frappe_private_attachments | 4 | 12770122 | <reponame>shridarpatil/frappe_private_attachments<gh_stars>1-10
from setuptools import setup, find_packages
with open('requirements.txt') as f:
install_requires = f.read().strip().split('\n')
# get version from __version__ variable in frappe_private_attachments/__init__.py
from frappe_private_attachments import __ve... | 1.421875 | 1 |
mopidy_raspberry_gpio/__init__.py | stef-tel/mopidy-raspberry-gpio_stef | 0 | 12770123 | from __future__ import unicode_literals
import logging
import os
from mopidy import config, ext
from .pinconfig import PinConfig
__version__ = "0.0.2"
logger = logging.getLogger(__name__)
class Extension(ext.Extension):
dist_name = "Mopidy-Raspberry-GPIO"
ext_name = "raspberry-gpio"
version = __ver... | 2.1875 | 2 |
python_structure/data_structures/lists_tuples_dictionaries/list_defs.py | bangyen/pascal-triangle | 0 | 12770124 | <gh_stars>0
from python_structure.data_structures.stacks_queues.stack import Stack
star_wars_movies = ["Episode I - The Phantom Menace",
"Episode II – Attack of the Clones",
"Episode III – Revenge of the Sith",
"Episode IV – A New Hope",
"... | 3.5625 | 4 |
smart_meter/urls/user_meter_urls.py | GPXenergy/gpx_server_api | 0 | 12770125 | <reponame>GPXenergy/gpx_server_api<filename>smart_meter/urls/user_meter_urls.py
from django.urls import path, include
from smart_meter.views import UserMeterListView, UserMeterDetailView, GroupMeterDetailView, \
GroupMeterListView, MeterGroupParticipationDetailView, MeterParticipationListView, \
PowerMeasureme... | 2.09375 | 2 |
vms/cspcevents/models.py | denisemauldin/django-vms | 1 | 12770126 | from django.db import models
from schedule.models import Event, EventRelation, Calendar
from vms.locations.models import Location
# Create your models here.
class CSPCEvent(Event):
event_location = models.ForeignKey(Location, default=1)
| 1.867188 | 2 |
project/app/main.py | pombreda/tipfy | 23 | 12770127 | # -*- coding: utf-8 -*-
"""WSGI app setup."""
import os
import sys
# Add lib as primary libraries directory, with fallback to lib/dist
# and optionally to lib/dist.zip, loaded using zipimport.
lib_path = os.path.join(os.path.abspath(os.path.dirname(__file__)), 'lib')
if lib_path not in sys.path:
sys.path[0:0] = [
... | 1.960938 | 2 |
models/shapley_lstm.py | 96-Zachary/PGCD-for-ABSA | 3 | 12770128 | # -*- coding: utf-8 -*-
from layers.dynamic_rnn import DynamicLSTM
from layers.shap import Distribution_SHAP, Map_SHAP
import torch
import torch.nn as nn
import numpy as np
class SHAP_LSTM(nn.Module):
def __init__(self, embedding_matrix, opt):
super(SHAP_LSTM, self).__init__()
self.opt = opt
... | 2.390625 | 2 |
lib/solutions/SUM/sum_solution.py | DPNT-Sourcecode/CHK-rjxh01 | 0 | 12770129 | # noinspection PyShadowingBuiltins,PyUnusedLocal
def compute(x, y):
"""The problem sets the parameters as integers in the range 0-100.
We'll raise an exception if we receive a type other than int, or if the value
of that int is not in the right range"""
if type(x) != int or type(y) != int:
raise... | 3.734375 | 4 |
configs/baselines/DACN/utils.py | vivek-r-2000/BoundaryNet | 17 | 12770130 | import cv2
import numpy as np
from scipy.ndimage.morphology import distance_transform_cdt
import torch
from skimage.io import imsave
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
def get_edge_mask(poly, mask):
"""
Generate edge mask
"""
h = mask.shape[0]
w = mask.shape[1]
... | 2.265625 | 2 |
tests/utils/suite_writer/test_container.py | kbh2o/slash | 70 | 12770131 | from .element import Element
class SuiteWriterTestContainer(Element):
def __init__(self, suite):
super(SuiteWriterTestContainer, self).__init__(suite)
self._tests = []
@property
def tests(self):
return list(self._tests)
def get_num_tests(self):
return len(self._tests... | 2.5 | 2 |
jboss_pwd_hash.py | rawiriblundell/scripts | 5 | 12770132 | <filename>jboss_pwd_hash.py
#!/bin/env python
# A very simple python script to generate jboss/wildfly password hashes
# Requires a username, realm and password
#
# In jboss, these three are hashed as follows (from add-user.sh):
# "
# By default the properties realm expects the entries to be in the format: -
# use... | 2.40625 | 2 |
__scraping__/oldnavy.gap.com/main.py | whitmans-max/python-examples | 140 | 12770133 | #!/usr/bin/env python3
# date: 2016.11.24 (update: 2020.06.13)
# https://stackoverflow.com/questions/40777864/retrieving-all-information-from-page-beautifulsoup/
from selenium import webdriver
from bs4 import BeautifulSoup
import time
# --- get page ---
link = 'http://oldnavy.gap.com/browse/category.do?cid=1035712&... | 3.234375 | 3 |
olc_webportalv2/cowbat/tests/test_forms.py | OLC-Bioinformatics/olc_genomics_portal | 3 | 12770134 | <reponame>OLC-Bioinformatics/olc_genomics_portal
from django.test import TestCase, Client
from django import forms
from olc_webportalv2.cowbat.forms import RunNameForm
from olc_webportalv2.geneseekr.forms import EmailForm
class FormTest(TestCase):
def test_run_form_external_lab(self):
form = RunNameForm... | 2.234375 | 2 |
tests/unit-tests/test_settings.py | Ycallaer/schema_registry_viz | 1 | 12770135 | from schema_reg_viz.config.settings import get_settings
def test_health():
result = get_settings()
assert result.schema_registry.port == 8081
assert result.schema_registry.protocol == 'http'
assert result.schema_registry.url == 'localhost'
| 1.773438 | 2 |
test/language/templates/python/StructFullAndShortTemplateArgumentTest.py | chenpeihua/zserio | 0 | 12770136 | <reponame>chenpeihua/zserio
import unittest
import zserio
from testutils import getZserioApi
class StructFullAndShortTemplateArgumentTest(unittest.TestCase):
@classmethod
def setUpClass(cls):
cls.api = getZserioApi(__file__, "templates.zs").struct_full_and_short_template_argument
def testReadWrit... | 2.390625 | 2 |
backend/api/routes.py | haley-r/solderless-microlab | 0 | 12770137 | """
Module defining API.
"""
from api import app
from flask import jsonify
import recipes
@app.route('/list')
def list():
"""
List all available recipes
:return:
list
a list containing the names of the recipes. ex: ['recipe1',recipe2']
"""
recipes.refresh()
return jsonify(recipes.... | 3.515625 | 4 |
SingleCodeRun.py | hsspratt/Nott-Hawkeye1 | 0 | 12770138 | # %% TEst Final run
%matplotlib widget
import matplotlib.pyplot as plt
import numpy as np
import VectorFunctions as vf
import importlib as imp
import functions as f
imp.reload(vf)
angles_BA = np.array(f.import_bz2('test_photos_angles2'))
cameraA_r0 = np.array([0,0,0])
cameraB_r0 = np.array([-29,42,1])
cameras_r0 = [... | 2.640625 | 3 |
trovebot.py | Sectoidfodder/Trovebot | 0 | 12770139 | <filename>trovebot.py
import traceback
import sys
import os
import asyncio
from dotenv import load_dotenv
from configparser import ConfigParser
from discord.ext import commands
from automod.automod import AutoMod
from records.records import Records
#from utils import autoping
trovebot = commands.Bot('!')
config = Conf... | 2.21875 | 2 |
r2r_offer_utils/logging.py | Ride2Rail/r2r-offer-utils | 0 | 12770140 | <filename>r2r_offer_utils/logging.py
#!/usr/bin/env python3
import logging
def setup_logger(name=None):
# create logger
logger = logging.getLogger(name=name)
logger.setLevel(logging.DEBUG)
# add stream handler (console)
ch = logging.StreamHandler()
# create formatter
formatter = logging... | 2.484375 | 2 |
models/Transformer/utils/plot_swipe.py | Juncheng-Dong/ML_MM_Benchmark | 3 | 12770141 | import numpy as np
import torch
from utils import plotsAnalysis
import os
from utils.helper_functions import load_flags
def auto_swipe(mother_dir=None):
"""
This function swipes the parameter space of a folder and extract the varying hyper-parameters and make 2d heatmap w.r.t. all combinations of them
"""... | 2.453125 | 2 |
dictionary/views/edit.py | ankitgc1/django-sozluk-master | 248 | 12770142 | from django.contrib import messages as notifications
from django.contrib.auth.mixins import LoginRequiredMixin
from django.contrib.messages.views import SuccessMessageMixin
from django.db.models import F, Q
from django.db.models.functions import Coalesce
from django.http import Http404
from django.shortcuts import get_... | 1.96875 | 2 |
sorting/quick_sort.py | allenyummy/SortingAlgo | 0 | 12770143 | <reponame>allenyummy/SortingAlgo
# encoding=utf-8
# Author: <NAME>
# Description: Quick Sort
from __future__ import print_function
from typing import List
def quick_sort_1(arr: List[int], left, right):
def partition() -> int: | 2.140625 | 2 |
slide/snippet/list_str.py | TomohikoK/PyCat | 0 | 12770144 | <gh_stars>0
from typing import List
list_of_string: List[str] = ['a', 'b', 'c']
list_of_int: List[int] = [1, 2, 3]
| 3 | 3 |
test/test_styles.py | mat-m/odfdo | 0 | 12770145 | <gh_stars>0
#!/usr/bin/env python
# Copyright 2018 <NAME>
# Copyright (c) 2009-2010 <NAME>, Itaapy, Pierlis, Talend.
#
# 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.... | 2.15625 | 2 |
setup.py | nvie/python-drainers | 1 | 12770146 | <reponame>nvie/python-drainers<gh_stars>1-10
#!/usr/bin/env python
import os
import codecs
try:
from setuptools import setup
except ImportError:
from ez_setup import use_setuptools
use_setuptools()
from setuptools import setup
import drainers as distmeta
if os.path.exists("README.rst"):
long_descr... | 1.679688 | 2 |
Scripts/rfpy_ccp.py | wbm06/RfPy | 0 | 12770147 | #!/usr/bin/env python
# Copyright 2019 <NAME>
#
# This file is part of RfPy.
#
# 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 without restriction, including without limitation the rights
# ... | 1.820313 | 2 |
gallery/models.py | otienotimothy/art-gallery | 0 | 12770148 | <gh_stars>0
from django.db import models
from django.contrib.auth.models import User
from cloudinary.models import CloudinaryField
# Create your models here.
class Photo(models.Model):
image = CloudinaryField('image')
image_name = models.CharField(max_length=100)
image_description = models.TextField()
... | 2.3125 | 2 |
backend/webserver/db.py | Kevinwochan/Ultracast | 0 | 12770149 | from . import models
from . import schema
import re
import magic
import mimetypes
import boto3
from botocore.client import Config
from mongoengine import connect
from pydub import AudioSegment
import io
import hashlib
from base64 import urlsafe_b64encode
#MONGO_URI = f'mongodb://{MONGO_USERNAME}:{MONGO_PASSWORD}@{MON... | 1.976563 | 2 |
usaspending_api/search/v2/views/search.py | truthiswill/usaspending-api | 0 | 12770150 | import copy
from django.conf import settings
from django.db.models import Sum, Count, F
from rest_framework.response import Response
from rest_framework.views import APIView
from usaspending_api.awards.models_matviews import UniversalAwardView
from usaspending_api.awards.v2.filters.matview_filters import matview_sear... | 1.710938 | 2 |