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/test_api_key.py | sodrooome/bmaclient | 0 | 33400 | <reponame>sodrooome/bmaclient
import os
import unittest
from bmaclient.utils import get_api_key_from_file
DATA_DIR = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'data')
class APIKeyTest(unittest.TestCase):
def test_get_api_key_from_file(self):
path = os.path.join(DATA_DIR, 'api_key.txt')
... | 2.59375 | 3 |
planner/forms.py | celord/mealprep | 0 | 33401 | <reponame>celord/mealprep
from django import forms
from django.forms import ModelForm
from .models import Plan
class DateInput(forms.DateInput):
input_type = "date"
class AddPlanForm(ModelForm):
class Meta:
model = Plan
# fields = fields = '__all__'
fields = [
"date",
... | 2.328125 | 2 |
lib/harm_plot.py | pnlbwh/multi-shell-dMRIharmonization | 4 | 33402 | #!/usr/bin/env python
import numpy as np
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
import pandas as pd
from conversion import read_imgs_masks
from os.path import isfile, basename
XERR=0.1
ELINEWIDTH=3
CAPSIZE=5
CAPTHICK=3
FMT='cD'
def harm_plot(ydata, labels, outPrefix, bshell_b):
'... | 2.453125 | 2 |
tests/test_preproc_badframes.py | ChrisDelaX/VIP | 2 | 33403 | <reponame>ChrisDelaX/VIP
"""
Tests for the badframes detection routines.
"""
import numpy as np
import vip_hci as vip
def test_badfr_corr():
im1 = vip.var.create_synth_psf(shape=(19, 19), fwhm=2)
im2 = vip.var.create_synth_psf(shape=(19, 19), fwhm=(2, 4))
cube = np.array([im1, im2, im1, im2])
gind, ... | 2.15625 | 2 |
DE_rpy2.py | jhonP-Li/DE_rpy2 | 6 | 33404 | """
MIT License
Copyright (c) 2021 <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 without restriction, including without limitation the rights
to use, copy, modify, merge, publish... | 1.640625 | 2 |
cgatpipelines/tools/pipeline_docs/pipeline_rnaseqdiffexpression/trackers/Results.py | kevinrue/cgat-flow | 49 | 33405 |
from CGATReport.Tracker import *
from CGATReport.Utils import PARAMS as P
from IsoformReport import *
###############################################################################
# parse params
###############################################################################
DATABASE = P.get('', P.get('sql_backend'... | 1.765625 | 2 |
semseg/datasets/celebamaskhq.py | Genevievekim/semantic-segmentation-1 | 196 | 33406 | import torch
from torch import Tensor
from torch.utils.data import Dataset
from torchvision import io
from pathlib import Path
from typing import Tuple
from torchvision import transforms as T
class CelebAMaskHQ(Dataset):
CLASSES = [
'background', 'skin', 'nose', 'eye_g', 'l_eye', 'r_eye', 'l_brow', 'r_br... | 2.484375 | 2 |
gui/py37/images_rc.py | briansune/UART2ETHERNET_MODULE | 1 | 33407 | <reponame>briansune/UART2ETHERNET_MODULE
# -*- coding: utf-8 -*-
# Resource object code
#
# Created by: The Resource Compiler for PyQt5 (Qt v5.9.6)
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore
qt_resource_data = b"\
\x00\x00\x2d\x15\
\x89\
\x50\x4e\x47\x0d\x0a\x1a\x0a\x00\x00\x00... | 1.28125 | 1 |
PYTHON/pythonDesafios/desafio062.py | Santos1000/Curso-Python | 0 | 33408 | print('Gerador de PA\n','==-'*10)
primeiro = int(input('Primeiro termo:'))
razao = int(input('Razao da PA:'))
termo = primeiro
c = 1
total = 0
mais = 10
while mais != 0:
total = total + mais
while c <= total:
print(f'{termo} ->', end='')
c += 1
termo += razao
print('PAUSA')
mais ... | 3.859375 | 4 |
codes/Lib/site-packages/RsInstrument/Internal/ConverterToScpiString.py | charlescayno/automation | 0 | 33409 | <reponame>charlescayno/automation
from enum import Enum
from .Conversions import list_to_csv_quoted_str, value_to_quoted_str, list_to_csv_str, value_to_str, enum_list_to_str, enum_scalar_to_str
from .Types import DataType
def value_to_scpi_string(data, data_type: DataType):
"""Method to be used in the driver implem... | 3.28125 | 3 |
examples/example_interactive_prefix/main.py | David-Lor/Python-DotEnv-Settings-Handler | 6 | 33410 | <filename>examples/example_interactive_prefix/main.py
"""This example read the settings and print them out, so you can check how they get loaded.
"""
# noinspection PyUnresolvedReferences,PyPackageRequirements
from settings import my_settings as settings
print("Redis Host:", settings.redis_host)
print("Redis Port:", ... | 2.359375 | 2 |
Datasets/Generator/Disaster/main.py | undraaa/m2bench | 0 | 33411 | import sys
import table_gen
import doc_gen
import graph_gen
import array_gen
import os
def main(argv):
outdir = './sf1_dataset_output/'
if os.path.exists(outdir):
os.system("rm -rf "+outdir)
os.mkdir(outdir)
earthquake_dirpath = argv[1]
shelter_dirpath = argv[2]
gps_dirpath = argv[3]
... | 2.40625 | 2 |
MultiPManager/distProc.py | sebastiantrianac/SoftTLON | 0 | 33412 | <reponame>sebastiantrianac/SoftTLON
#!/usr/bin/env python
# coding=utf-8
#
# A module for create a multi-agent system over Ad-hoc networks
# Copyright (C) 2017-2018
# <NAME> <<EMAIL>>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser Public License as publis... | 2.015625 | 2 |
setup.py | charlesthomas/testrail_reporter | 0 | 33413 | <reponame>charlesthomas/testrail_reporter<filename>setup.py
#!/usr/bin/env python
from setuptools import setup
NAME = 'testrail_reporter'
DESCRIPTION = 'Nosetests Plugin to Report Test Results to TestRail.'
VERSION = open('VERSION').read().strip()
LONG_DESC = open('README.rst').read()
LICENSE = open('LICENSE').read()
... | 1.351563 | 1 |
bleach__examples__remove_tags__clear_html/escape_protocols.py | DazEB2/SimplePyScripts | 117 | 33414 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
__author__ = 'ipetrash'
# SOURCE: https://github.com/mozilla/bleach
# SOURCE: https://bleach.readthedocs.io/en/latest/clean.html#allowed-protocols-protocols
# pip install bleach
import bleach
# List of allowed protocols
print('List of allowed protocols:', bleach.san... | 2.421875 | 2 |
test/test_entity_builder.py | ari-bou/symro | 0 | 33415 | import symro
import symro.src.handlers.metaentitybuilder as eb
from symro.src.parsing.amplparser import AMPLParser
from symro.test.test_util import *
# Scripts
# ----------------------------------------------------------------------------------------------------------------------
FIXED_DIM_SCRIPT = """
set I = {1, 2... | 2.15625 | 2 |
source/StimulationScreen.py | FelixTheoret/Ergocycle | 0 | 33416 | <reponame>FelixTheoret/Ergocycle<filename>source/StimulationScreen.py<gh_stars>0
"""
Created on Wed March 30 11::00 2022
@author: <NAME>
"""
from tracemalloc import start
from numpy import number
from Screen import Screen as Screen
from PyQt5 import QtWidgets
from PyQt5.QtWidgets import *
from PyQt5.QtGui import QFon... | 2.296875 | 2 |
src/createVocabulary.py | aws-samples/aim317-uncover-insights-customer-conversations | 0 | 33417 | import boto3
import uuid
import json
import os
def lambda_handler(event, context):
record = event['Records'][0]
s3bucket = record['s3']['bucket']['name']
s3object = record['s3']['object']['key']
print(s3object.split(".")[0].split("-")[2])
if s3object.split(".")[0].split("-")[2] ... | 2.28125 | 2 |
app/api/model/blacklist.py | ChegeBryan/politico | 1 | 33418 | <filename>app/api/model/blacklist.py
""" Blacklist_token class method and model """
import datetime
class BlacklistToken:
"""Blacklist token class
1. initializes the class with the user token and the time created
"""
def __init__(self, token):
self.token = token
self.blacklisted_on =... | 3.28125 | 3 |
matrix_procedures/load_dataset_class.py | jamiecook/AequilibraE | 0 | 33419 | <gh_stars>0
"""
-----------------------------------------------------------------------------------------------------------
Package: AequilibraE
Name: Loads datasets into AequilibraE binary files
Purpose: Implements dataset creation
Original Author: <NAME> (<EMAIL>)
Contributors:
Last edited by: <... | 2.484375 | 2 |
FastCAE_Linux/output/examples/example3/view.py | alleindrach/calculix-desktop | 23 | 33420 | <reponame>alleindrach/calculix-desktop<gh_stars>10-100
MainWindow.clearData()
MainWindow.openPreWindow()
box = CAD.Box()
box.setName('Box_1')
box.setLocation(0,0,0)
box.setPara(10,10,10)
box.create()
cylinder = CAD.Cylinder()
cylinder.setName('Cylinder_2')
cylinder.setLocation(0,0,0)
cylinder.setRadius(5)
cy... | 1.585938 | 2 |
app/api/routes/server/plot_queue.py | cPoolChia/ChiaAutoplotter-Backend | 7 | 33421 | <reponame>cPoolChia/ChiaAutoplotter-Backend<filename>app/api/routes/server/plot_queue.py
from typing import Any
from uuid import UUID, uuid4
import celery
from app import crud, models, schemas
from app.api import deps
from app.core.config import settings
from app.utils import auth
from app.core import tasks
from fasta... | 2.140625 | 2 |
mushroom_rl/utils/eligibility_trace.py | PuzeLiu/mushroom-rl | 344 | 33422 | <gh_stars>100-1000
from mushroom_rl.utils.table import Table
def EligibilityTrace(shape, name='replacing'):
"""
Factory method to create an eligibility trace of the provided type.
Args:
shape (list): shape of the eligibility trace table;
name (str, 'replacing'): type of the eligibility tr... | 2.828125 | 3 |
example_pkg/Parrots.py | TillWeinhold/EQUSWORKSHOPTill | 0 | 33423 | class Parrot():
def __init__(self, squawk, is_alive=True):
self.squawk = squawk
self.is_alive = is_alive
african_grey = Parrot('Polly want a Cracker?')
norwegian_blue = Parrot('', is_alive=False)
def squawk(self):
if self.is_alive:
return self.squawk
else:
... | 3.390625 | 3 |
Codility/python/problem2.py | rayguang/ratesbuddy | 0 | 33424 | def solution(S, K):
# write your code in Python 3.6
day_dict = {0:'Mon', 1:'Tue', 2:'Wed', 3:'Thu', 4:'Fri', 5:'Sat', 6:'Sun'}
return day_dict[list(day_dict.values()).index(S)+K]
S='Wed'
K=2
print(solution(S,K))
| 3.75 | 4 |
ex030.py | MarcelleFranca/exercicios-python | 0 | 33425 | n = int(input('Me diga um número qualquer: '))
re = n % 2
if re == 0:
print('O número {} é PAR!'.format(n))
else:
print('O número {} é ÍMPAR!'.format(n))
| 3.921875 | 4 |
pyoperant/reinf.py | arouse01/pyoperant | 1 | 33426 | <filename>pyoperant/reinf.py
from numpy import random
class BaseSchedule(object):
"""Maintains logic for deciding whether to consequate trials.
This base class provides the most basic reinforcent schedule: every
response is consequated.
Methods:
consequate(trial) -- returns a boolean value based... | 3.4375 | 3 |
Conditional/TextGAIL/model.py | mrazizi/TextGAIL | 19 | 33427 | <filename>Conditional/TextGAIL/model.py
from typing import Any, List, Dict, Iterator, Callable
import torch
import torch.nn as nn
import torch.nn.functional as F
from transformers import AutoTokenizer, RobertaForMultipleChoice
import torchfly
from torchfly.nn.transformers import GPT2LMHeadModel
from torchfly.training ... | 2.125 | 2 |
yolo_v1_inference.py | jerichosu/YOLO_V1_Pytorch | 0 | 33428 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Feb 10 14:12:28 2022
@author: 1517suj
"""
from model import Yolov1
import torch
import torch.optim as optim
import torchvision.transforms as T
import cv2
from utils import (
non_max_suppression,
mean_average_precision,
intersection_over_unio... | 2.453125 | 2 |
setup.py | sedatDemiriz/satisfy-calc | 0 | 33429 | import pathlib
from setuptools import setup
# The directory containing this file
HERE = pathlib.Path(__file__).parent
# The text of the README file
README = (HERE / "README.md").read_text()
setup(
name="satisfy-calc",
version="1.1.3",
description="Command line crafting tree visualizer for Sat... | 1.679688 | 2 |
projects/InstantTeaching/models/__init__.py | txdet/Instant-Teaching | 18 | 33430 | from .detectors import *
from .max_iou_assigner_v2 import MaxIoUAssignerV2 | 1.046875 | 1 |
components/studio/projects/migrations/0015_auto_20210301_1015.py | aitmlouk/stackn | 25 | 33431 | <reponame>aitmlouk/stackn
# Generated by Django 3.1.6 on 2021-03-01 10:15
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('projects', '0014_environment_appenv'),
]
operations = [
migrations.RemoveField(
... | 1.710938 | 2 |
tests/Auth_Test.py | PyDO-Team/PyDO-Old | 1 | 33432 | from TestOutput import LogManager
class Auth_Test:
def __init__(self):
self.logger = LogManager('AuthTest')
self.logger.writeTestEvent('AuthTest', 'Test Started')
if __name__ == "__main__":
Auth_Test() | 2.03125 | 2 |
app/models/db.py | cdlaimin/fastapi | 0 | 33433 | <filename>app/models/db.py
from sqlalchemy.ext.asyncio import create_async_engine, AsyncSession
from sqlalchemy.orm import sessionmaker
from app.core.config import settings
engine = create_async_engine(settings.ASYNC_SQLALCHEMY_DATABASE_URI)
SessionLocal = sessionmaker(engine, class_=AsyncSession, expire_on_commit=Fa... | 2.0625 | 2 |
src/globals.py | 22PoojaGaur/COMINE-Plusplus-Algorithm-for-Finding-Correlated-Patterns-from-Transactions | 0 | 33434 | MIN_SUPPORT = 2
MIN_ALL_CONF = 0.05
| 0.964844 | 1 |
1-iniciante/1038.py | marcobarone-dev/uri | 1 | 33435 | produtos = {1: 4.0, 2: 4.5, 3: 5.0, 4: 2.0, 5: 1.5}
produto, quantidade = [int(num) for num in input().split()]
total = produtos[produto] * quantidade
print('Total: R$ {:.2f}'.format(total))
| 3.515625 | 4 |
books/software-architecture-with-python/Ch04-performance-data-structures/primes.py | phiratio/lpthw | 1 | 33436 | <reponame>phiratio/lpthw
# Code Listing #3
"""
Prime number iterator class
"""
class Prime(object):
""" A prime number iterator for first 'n' primes """
def __init__(self, n):
self.n = n
self.count = 0
self.value = 0
def __iter__(self):
return self
def __next__(sel... | 3.875 | 4 |
timeblock/stopwatch.py | daustin391/timeblock | 0 | 33437 | <filename>timeblock/stopwatch.py
""" Stopwatch
A simple stopwatch for measuring time
"""
from datetime import datetime
class Stopwatch:
"""Stopwatch object for measuring time"""
def __init__(self):
self._start = None
def start(self):
"""Starts watch by setting start time to now"""
... | 3.625 | 4 |
src/data/mnist_converter.py | laurabondeholst/Mapping_high_dimensional_data | 0 | 33438 | """
Takes the MNIST dataset as input (images and labels separated)
and creates a new dataset only with 0's and 1's
"""
import numpy as np
DATA_PATH = "data/raw/"
OUTPUT_PATH = "data/processed/mnist/"
X = np.loadtxt(DATA_PATH + "mnist2500_X.txt")
labels = np.loadtxt(DATA_PATH + "mnist2500_labels.txt")
X_new = []
labe... | 2.84375 | 3 |
models/pytorch_gcn.py | SamGalanakis/FlowCompare | 5 | 33439 | <reponame>SamGalanakis/FlowCompare
import os
import sys
import copy
import math
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
from models.nets import MLP
# Original code from : https://github.com/WangYueFt/dgcnn/blob/master/pytorch/model.py
def knn(x, k):
inner = -2*torch.m... | 2.90625 | 3 |
src/weaver/models/custom/wrn28.py | Holim0711/holim-lightning | 1 | 33440 | <gh_stars>1-10
import torch.nn as nn
class BasicBlock(nn.Module):
def __init__(self, cᵢ, cₒ, s=1, dropout=0., activate_before_residual=False):
super().__init__()
self.activate_before_residual = activate_before_residual
# residual path
self.conv0 = nn.Conv2d(cᵢ, cₒ, 3, s, 1, bias=F... | 2.4375 | 2 |
trisicell/ul/__init__.py | faridrashidi/trisicell | 2 | 33441 | <reponame>faridrashidi/trisicell<filename>trisicell/ul/__init__.py
"""Utils Module."""
from trisicell.ul._hclustering import (
dist_cosine_ignore_na,
dist_dendro,
dist_l1_ignore_na,
hclustering,
)
from trisicell.ul._packages import (
import_graph_tool,
import_graphviz,
import_gurobi,
im... | 1.257813 | 1 |
utils/pktgen/sender.py | lilyhuegerich/No-hop | 0 | 33442 | <filename>utils/pktgen/sender.py<gh_stars>0
#!/usr/bin/env python
import argparse, sys, socket, random, struct, time
from scapy.all import sendp, send, get_if_list, get_if_list, get_if_hwaddr, hexdump
from scapy.all import Packet
from scapy.all import Ether, IP, IPv6, UDP, TCP
sip_port=5060
def get_if():
iface=... | 2.578125 | 3 |
lib/coloraide/spaces/hsl/__init__.py | EatBreatheCode/sublime_color_helper | 0 | 33443 | <reponame>EatBreatheCode/sublime_color_helper
"""HSL class."""
from ...spaces import Space, Cylindrical
from ...cat import WHITES
from ...gamut.bounds import GamutBound, FLG_ANGLE, FLG_PERCENT
from ... import util
from ... import algebra as alg
from ...types import Vector
from typing import Tuple
def srgb_to_hsl(rgb:... | 2.90625 | 3 |
maze/models.py | TerryHowe/pymaze | 1 | 33444 | <reponame>TerryHowe/pymaze
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models
# Create your models here.
class Passage(models.Model):
DIRECTIONS = (
('N', 'North'),
('E', 'East'),
('S', 'South'),
('W', 'West'),
('U', 'Up'),
('D', 'Down'),
)
room_x = models.Int... | 2.515625 | 3 |
tests/varints_test.py | dargueta/binobj | 2 | 33445 | <reponame>dargueta/binobj<gh_stars>1-10
"""Tests for the variable-length integers."""
import io
import pytest
from binobj import varints
@pytest.mark.parametrize(
"value,expected",
((0, b"\0"), (127, b"\x7f"), (128, b"\x81\x00"), (65535, b"\x83\xff\x7f")),
)
def test_encode_vlq_basic(value, expected):
... | 2.609375 | 3 |
src/settings/models.py | TolgaKara/prodai | 0 | 33446 | <reponame>TolgaKara/prodai
from django.db import models
from django.contrib.auth.models import User
# Create your models here.
class Setting(models.Model):
user_id = models.ForeignKey(User, on_delete=models.CASCADE)
class TimeTrackingSetting(models.Model):
user = models.ForeignKey(User, on_delete=models.CAS... | 2.140625 | 2 |
python/place_molex_conn.py | willdickson/roman_led_frame | 0 | 33447 | from __future__ import print_function
import os
import sys
import pcbnew
import numpy as np
import pprint
def inch_to_nanometer(value):
return (value*25.4)*1e6
def nanometer_to_inch(value):
return value/(25.4*1.e6)
def nm_to_mm(value):
return value*1.e-6
def mm_to_nm(value):
return value*1.e6
def... | 2.421875 | 2 |
RaspberryPi/appMasterKey.py | colindembovsky/iot-central-firmware | 136 | 33448 | # Copyright (c) Microsoft. All rights reserved.
# Licensed under the MIT license.
import sys
import iotc
from iotc import IOTConnectType, IOTLogLevel
from random import randint
import base64
import hmac
import hashlib
gIsMicroPython = ('implementation' in dir(sys)) and ('name' in dir(sys.implementation)) and (sys.imp... | 2.234375 | 2 |
genmod/annotate_models/variant_annotator.py | Varstation/genmod | 0 | 33449 | <reponame>Varstation/genmod
#!/usr/bin/env python
# encoding: utf-8
"""
variant_consumer.py
Consumes batches of variants and annotates them. Each batch is a dictionary
with variant_id:s as keys and dictionaries with variant information.
The variants will get different annotations depending on input
Created by <NAME... | 2.375 | 2 |
tests/context.py | SchluppiBobbz/DartsApp | 0 | 33450 | <gh_stars>0
import os
import sys
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))
from dartsapp import game, player, darts_helper
from dartsapp.exceptions import BullseyeHasNoTriple, FieldDoesNotExist,\
NoPlayerRegistered, OptionsNotSet,\
... | 1.414063 | 1 |
WebApps/OrgChartPortal/tests.py | yizongk/DOTAnalysis_Django | 0 | 33451 | <gh_stars>0
from .models import *
from datetime import datetime
from django.core.exceptions import ObjectDoesNotExist
import json
from WebAppsMain.settings import TEST_WINDOWS_USERNAME, TEST_PMS, TEST_SUPERVISOR_PMS, TEST_COMMISSIONER_PMS
from WebAppsMain.testing_utils import HttpPostTestCase, HttpGetTestCase
from djan... | 2 | 2 |
test_net.py | reasonsolo/mtcnn_caffe | 0 | 33452 | <filename>test_net.py
import cv2
import caffe
import tools
import sys
import os
import numpy as np
from functools import partial
import config
def gen_scales(w, h, min_imgsize, net_imgsize):
scales = []
scale = float(net_imgsize) / min_imgsize;
minhw = min(w, h) * scale;
while minhw > net_imgsize:
... | 2.28125 | 2 |
SharedData/list_all_files.py | kylemcdonald/SoundParts | 22 | 33453 | <reponame>kylemcdonald/SoundParts<filename>SharedData/list_all_files.py<gh_stars>10-100
import os
import fnmatch
# extensions can be a single tring like '.png' or '.jpg'
# or a list of extensions. they should all be lowercase
# but the . is important.
def list_all_files(directory, extensions=None):
for root, dirna... | 3.046875 | 3 |
Capitulo_02/exercise2_6.py | thiagosouzalink/my_codes-exercices-book-curso_intensivo_de_python | 0 | 33454 | <reponame>thiagosouzalink/my_codes-exercices-book-curso_intensivo_de_python
"""
2.6 – Citação famosa 2: Repita o Exercício 2.5, porém, desta vez, armazene o nome da pessoa famosa em uma variável chamada famous_person. Em seguida, componha sua mensagem e armazene-a em uma nova variável chamada message. Exiba sua mensage... | 2.734375 | 3 |
algorithm/lin_search.py | terasakisatoshi/pythonCodes | 0 | 33455 | import random
import copy
import time
from numba import jit
from array_creator import create_test_set
from measure import get_elapsed_data
@get_elapsed_data
def scratch_lin_search(test_set):
hit = False
for key, arr in test_set:
for i in arr:
if i == key:
break
@get_elaps... | 2.625 | 3 |
setup.py | cdeil/astroquery | 0 | 33456 | #!/usr/bin/env python
# Licensed under a 3-clause BSD style license - see LICENSE.rst
# Use "distribute" - the setuptools fork that supports python 3.
from distribute_setup import use_setuptools
use_setuptools()
from distutils.command import sdist
import glob
import os
import sys
from setuptools import setup, find_p... | 1.679688 | 2 |
dapr/serializers/base.py | mukundansundararajan/python-sdk | 0 | 33457 | # -*- coding: utf-8 -*-
"""
Copyright (c) Microsoft Corporation.
Licensed under the MIT License.
"""
from abc import ABC, abstractmethod
from typing import Any, Callable, Optional, Type
class Serializer(ABC):
"""Serializer base class."""
@abstractmethod
def serialize(
self, obj: object,
... | 2.8125 | 3 |
htdocs/MPM - Copy/MM/apps.py | anji-a/Apache | 0 | 33458 | from django.apps import AppConfig
class MmConfig(AppConfig):
name = 'MM'
| 1.21875 | 1 |
reto-05/eleloi/main.py | jlnc/reto-python | 18 | 33459 | import _config
import _utils
CONFIG_PATH = "config.toml"
def main():
config = _config.read(CONFIG_PATH)
for path_name in [x.in_ for x in config.directorios]:
_utils.list_jpg_files_in_dir(path_name)
if __name__ == "__main__":
main()
| 2.34375 | 2 |
ravel/utils/data.py | eykd/ravel | 1 | 33460 |
def merge_dicts(*dicts):
"""
Given any number of dicts, shallow copy and merge into a new dict,
precedence goes to key value pairs in latter dicts.
"""
result = {}
for d in dicts:
result.update(d)
return result
def evaluate_term(term, **kwargs):
return term.evaluate(**kwargs)... | 3.453125 | 3 |
skyline.py | MyrrhDev/skyline-telegramBot | 0 | 33461 | <gh_stars>0
import random
class Skyline:
area = 0
max_height = 0
xmin = 0
height = []
width = []
x_pos = []
xmax = 0
def __init__(self, xmin, height, xmax):
self.xmin = xmin
self.height = [height] * ((xmax - xmin) + 1)
self.xmax = xmax
self.x_pos = lis... | 3.203125 | 3 |
code/default/smart_router/local/socket_wrap.py | wuyongwen/XX-Net | 0 | 33462 | import time
class SocketWrap(object):
def __init__(self, sock, ip=None, port=None, host="", target=""):
self._sock = sock
self.ip = ip
self.port = port
self.host = host
self.target = target
self.recved_data = 0
self.recved_times = 0
self.create_time... | 2.859375 | 3 |
tests/unit/test_handler_marker.py | Rogdham/bigxml | 4 | 33463 | import pytest
from bigxml.handler_marker import _ATTR_MARKER, xml_handle_element, xml_handle_text
from bigxml.nodes import XMLText
def test_one_maker_element():
@xml_handle_element("abc", "def")
def fct(arg):
return arg * 6
assert getattr(fct, _ATTR_MARKER, None) == (("abc", "def"),)
assert ... | 2.53125 | 3 |
gamestonk_terminal/due_diligence/stockgrid_dd_view.py | brocki/GamestonkTerminal | 1 | 33464 | <filename>gamestonk_terminal/due_diligence/stockgrid_dd_view.py<gh_stars>1-10
"""Stockgrid DD View"""
__docformat__ = "numpy"
import argparse
from typing import List
from datetime import timedelta
import requests
import pandas as pd
import matplotlib.pyplot as plt
from tabulate import tabulate
from gamestonk_terminal.... | 3.015625 | 3 |
tests/schema/models_no_auto_create_m2m.py | Alirezaja1384/tortoise-orm | 33 | 33465 | """
This example demonstrates SQL Schema generation for each DB type supported.
"""
from tortoise import fields
from tortoise.fields import SET_NULL
from tortoise.models import Model
class Tournament(Model):
tid = fields.SmallIntField(pk=True)
name = fields.CharField(max_length=100, description="Tournament n... | 3.15625 | 3 |
tests/functional/wsgi/v1_1/test_claims.py | vkmc/zaqar-websocket | 1 | 33466 | # Copyright (c) 2014 Rackspace, 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 wr... | 1.851563 | 2 |
src/glyphs/utils/StringUtils.py | slorg1/glyphs | 1 | 33467 | <filename>src/glyphs/utils/StringUtils.py
from __future__ import unicode_literals
import six
class StringUtils(object):
"""
Utility class for handling strings.
"""
@staticmethod
def to_unicode(value):
"""
Returns the string representation of the given L{value} if it is no... | 3.078125 | 3 |
Codeforces Problems/Soldier and bananas/Soldier and Bananas.py | Social-CodePlat/Comptt-Coding-Solutions | 0 | 33468 | <filename>Codeforces Problems/Soldier and bananas/Soldier and Bananas.py
arr=[int(x) for x in input().split()]
sum=0
for i in range(1,(arr[2]+1)):
sum+=arr[0]*i
if sum<=arr[1]:
print(0)
else:
print(sum-arr[1])
| 3.484375 | 3 |
ansible/terminal_plugins/aos.py | xwjiang2021/sonic-mgmt | 2 | 33469 | <reponame>xwjiang2021/sonic-mgmt
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import re
import json
from ansible.plugins.terminal import TerminalBase
from ansible.errors import AnsibleConnectionFailure
from ansible.module_utils._text import to_bytes, to_text
class Terminal... | 2.109375 | 2 |
day_15-chiton/part_2.py | lucacerone/advent-of-code-2021 | 0 | 33470 | <reponame>lucacerone/advent-of-code-2021<gh_stars>0
from numpy.core.fromnumeric import size
import utils as u
import numpy as np
import heapq as hq
s = """\
1163751742
1381373672
2136511328
3694931569
7463417111
1319128137
1359912421
3125421639
1293138521
2311944581
"""
#cave = np.array([[int(x) for x in l] for l i... | 2.984375 | 3 |
aws-pentesting-with-python/kms/correct/updating_existing_kms.py | qodirovshohijahon/python-scripting | 0 | 33471 | from xmlrpc.client import Boolean
import boto3
import logging
from datetime import date, datetime
from botocore.exceptions import ClientError
import json
from json_datetime_serializer import json_datetime_serializer
from kms_client import kmsClient
from search_kms_using_account_id import search_kms_using_account_id
fro... | 1.8125 | 2 |
pulsar/async/consts.py | goodboy/pulsar | 1 | 33472 | <filename>pulsar/async/consts.py
'''
Constants used throughout pulsar.
'''
from pulsar.utils.structures import AttributeDictionary
# LOW LEVEL CONSTANTS - NO NEED TO CHANGE THOSE ###########################
ACTOR_STATES = AttributeDictionary(INITIAL=0X0,
INACTIVE=0X1,
... | 2.1875 | 2 |
tornado/test/twisted_test.py | dave-shawley/tornado | 1 | 33473 | # Author: <NAME>
# Date: July 2011
#
# 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 wri... | 2.078125 | 2 |
related_name/migrations/0001_initial.py | thinkAmi-sandbox/django_30-sample | 0 | 33474 | # Generated by Django 3.0.6 on 2020-06-14 05:26
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Color',
fields=[
... | 1.851563 | 2 |
architectures/utils.py | eddardd/torchDA | 0 | 33475 | <gh_stars>0
import torch
class GradReverse(torch.autograd.Function):
@staticmethod
def forward(ctx, x):
return x.view_as(x)
@staticmethod
def backward(ctx, grad_output):
return - grad_output
class LambdaLayer(torch.nn.Module):
def __init__(self, fn):
super().__init__()
... | 2.46875 | 2 |
tests/binary_search.py | jpages/twopy | 7 | 33476 | <reponame>jpages/twopy<filename>tests/binary_search.py
# Binary search of an item in a (sorted) list
def binary_search(alist, item):
first = 0
last = len(alist) - 1
found = False
while first <= last and not found:
middle = (first + last) // 2
if alist[middle] == item:
foun... | 3.734375 | 4 |
controller/modules/Logger.py | saumitraaditya/xmppSignal | 0 | 33477 | # ipop-project
# Copyright 2016, University of Florida
#
# 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
# to use, copy, modify, m... | 1.90625 | 2 |
setup.py | annieapp/annie | 4 | 33478 | <reponame>annieapp/annie<filename>setup.py
"""
Annie Modified MIT License
Copyright (c) 2019-present year <NAME> and the Annie Team
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 restric... | 1.3125 | 1 |
store/migrations/0011_watch_slug.py | StilyanMinchev/OnlineStore | 1 | 33479 | # Generated by Django 3.1.3 on 2020-12-13 08:36
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('store', '0010_auto_20201212_2058'),
]
operations = [
migrations.AddField(
model_name='watch',
name='slug',
... | 1.5625 | 2 |
main.py | SantiagoBeltranO/teenscooktoo | 0 | 33480 | <reponame>SantiagoBeltranO/teenscooktoo
# -*- encoding: utf-8 -*-
import os
import jinja2
import webapp2
from models.models import *
from google.appengine.ext import blobstore
from google.appengine.ext.webapp import blobstore_handlers
from libs import mylib
template_dir = os.path.join(os.path.dirname(__file__), 'views... | 2.21875 | 2 |
core/urls.py | pouya007RN/Voice-Changer | 0 | 33481 | <reponame>pouya007RN/Voice-Changer
from .views import index
from django.urls import path
urlpatterns = [
path('', index, name='index'),
] | 1.570313 | 2 |
shared/__init__.py | seenu-andi-rajendran/plagcomps | 2 | 33482 | <filename>shared/__init__.py
# Required to use access this directory as a "package." Could add more to this file later!
# See http://docs.python.org/2/tutorial/modules.html#packages
| 1.609375 | 2 |
mytravelblog/accounts/tests/forms/tests_EditPasswordForm.py | yetoshimo/my-travel-blog | 0 | 33483 | <reponame>yetoshimo/my-travel-blog
from django import test as django_tests
from django.contrib.auth import get_user_model
from mytravelblog.accounts.forms import UserLoginForm, EditPasswordForm
UserModel = get_user_model()
class EditPasswordFromTests(django_tests.TestCase):
def setUp(self):
self.usernam... | 2.515625 | 3 |
attic/operator/dispatch.py | matteoshen/example-code | 5,651 | 33484 | """
Experiments with infix operator dispatch
>>> kadd = KnowsAdd()
>>> kadd + 1
(<KnowsAdd object>, 1)
>>> kadd * 1
"""
class KnowsAdd:
def __add__(self, other):
return self, other
def __repr__(self):
return '<{} object>'.format(type(self).__name__)
| 3.359375 | 3 |
diary/admin.py | yokoc1322/day_has_a_name | 0 | 33485 | from django.contrib import admin
from .models import Writer, Record
admin.site.register(Writer)
admin.site.register(Record)
| 1.445313 | 1 |
cs498_positioning/kalman.py | liuzikai/UWB_Master | 1 | 33486 | from pykalman import KalmanFilter
import numpy as np
kf = KalmanFilter(transition_matrices=np.array([[1.0, 0.0, 0.0, 1.0, 0.0, 0.0],
[0.0, 1.0, 0.0, 0.0, 1.0, 0.0],
[0.0, 0.0, 1.0, 0.0, 0.0, 1.0],
... | 2.890625 | 3 |
year_3/databases_sem1/lab2/rdmslab2/api/dbmodels/payrolls.py | honchardev/KPI | 0 | 33487 | from api.models import Payroll
class Payrolls(object):
def __init__(self, cursor):
"""
:param cursor: MySQLdb.cursor.Cursor
"""
self.cursor = cursor
cursor.execute('SET NAMES utf8;')
cursor.execute('SET CHARACTER SET utf8;')
cursor.execute('SET character_set... | 2.953125 | 3 |
Python/eight_kyu/abbrev_name.py | Brokenshire/codewars-projects | 1 | 33488 | <reponame>Brokenshire/codewars-projects
# Python solution for 'Abbreviate a Two Word Name' codewars question.
# Level: 8 kyu
# Tags: FUNDAMENTALS, STRINGS, and ARRAYS.
# Author: <NAME>
# Date: 16/05/2020
import unittest
def abbrev_name(name):
"""
Converts name of two words into initials.
:param name: a s... | 3.859375 | 4 |
assets/python_scripts/cvScale.py | weiSupreme/weiSupreme.github.io | 3 | 33489 | import os
import cv2
import random
src_dir = "select2000/"
name_idx = 6000
dest_img_dir = "scale/image/"
dest_txt_dir = "scale/txt/"
img_list = os.listdir(src_dir)
def write_label(old_name, new_name, hratio_, wratio_):
old_obj = open(src_dir+old_name)
new_obj = open(dest_txt_dir+new_name, 'w')
old_txt = ... | 2.328125 | 2 |
segway_ros/src/segway/segway_system_wd.py | shengchen-liu/segway_v3 | 0 | 33490 | """--------------------------------------------------------------------
COPYRIGHT 2014 Stanley Innovation Inc.
Software License Agreement:
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions of source code m... | 1.109375 | 1 |
src/boot.py | macbury/pussificator | 3 | 33491 | <gh_stars>1-10
import logging
import os
from ruamel.yaml import YAML
LOGGER = logging.getLogger('pussy')
logging.basicConfig(
level=logging.INFO,
format="[%(asctime)s] %(levelname)s:%(name)s:%(message)s"
)
CONFIG_PATH = os.path.join('./', 'config.yaml')
LOGGER.info("Loading config: " + CONFIG_PATH)
CONFIG = YAML(... | 2.34375 | 2 |
app/helpers/response.py | trongdth/python-flask | 2 | 33492 | <filename>app/helpers/response.py
#!/usr/bin/python
# -*- coding: utf-8 -*-
from flask import jsonify
def response_ok(value=None, message='', code=-1):
result = {
'status': 1,
'message': message,
'code': code
}
if len(message) > 0:
result['message'] = message
if value is not None:
result.update({'data... | 2.5 | 2 |
utest/resources/robotdata/datagenerator.py | guojiajiaok/RIDE | 775 | 33493 | #!/usr/bin/env python
# Copyright 2008-2015 Nokia Networks
# Copyright 2016- Robot Framework Foundation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org... | 2.359375 | 2 |
pyrobolearn/policies/linear.py | Pandinosaurus/pyrobolearn | 2 | 33494 | <filename>pyrobolearn/policies/linear.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Provide the linear policy.
The linear policy uses a linear parametric approximator to predict the action vector based on the state vector.
"""
from pyrobolearn.policies.policy import Policy
from pyrobolearn.approximators import ... | 2.859375 | 3 |
C/resolve.py | staguchi0703/Nomura2020 | 0 | 33495 | <gh_stars>0
def resolve():
'''
code here
'''
N = int(input())
A_list = [int(item) for item in input().split()]
hp = sum(A_list) #leaf
is_slove = True
res = 1 # root
prev = 1
prev_add_num = 0
delete_cnt = 0
if hp > 2**N:
is_slove = False
elif A_list[0] == ... | 3.03125 | 3 |
mod_spotted_extended_light/mod_spotted_extended_light308.py | chipsi007/spoter-mods | 0 | 33496 | <gh_stars>0
# -*- coding: utf-8 -*-
import os
import re
import json
import codecs
import datetime
import threading
import urllib
import urllib2
import string
import random
import BigWorld
from constants import AUTH_REALM
from gui.Scaleform.daapi.view.lobby.hangar.Hangar import Hangar
from gui.battle_control import g_... | 1.640625 | 2 |
sahara/service/edp/oozie/engine.py | ksshanam/sahara | 161 | 33497 | <gh_stars>100-1000
# Copyright (c) 2014 OpenStack Foundation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicabl... | 1.625 | 2 |
adjutantclient/osc/v1/tokens.py | openstack/python-adjutantclient | 6 | 33498 | <reponame>openstack/python-adjutantclient<gh_stars>1-10
# Copyright (c) 2016 Catalyst IT 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/licens... | 2.09375 | 2 |
Chapter05/Low_Quality.py | PacktPublishing/Bioinformatics-with-Python-Cookbook-third-edition | 9 | 33499 | # ---
# jupyter:
# jupytext:
# text_representation:
# extension: .py
# format_name: light
# format_version: '1.5'
# jupytext_version: 1.13.4
# kernelspec:
# display_name: Python 3 (ipykernel)
# language: python
# name: python3
# ---
# +
import gzip
import numpy as np
import... | 2.125 | 2 |