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 |
|---|---|---|---|---|---|---|
api/linkCreationHelpers.py | healthIMIS/aha-kompass | 2 | 12777951 | <reponame>healthIMIS/aha-kompass
#!/usr/bin/env python3
# Corona-Info-App
#
# © 2020 <NAME>.
# Include utilities
import urllib
import json
from sqlalchemy import or_
import bs4
import visvalingamwyatt as vw
# Include db connection
from main import db, api
# Include models
from models.districts import districts, upd... | 2.15625 | 2 |
lib/utils.py | gmelillo/registry | 0 | 12777952 | <gh_stars>0
import threading
import logging
import os
import signal
import subprocess
import shlex
class Command(object):
def __init__(self, cmd, **kwargs):
self.cmd = cmd
self.process = None
self.log = logging.getLogger(f'{__name__}.{self.__class__.__name__}')
self.timeout = kwarg... | 2.375 | 2 |
futura_ui/app/ui/wizards/regionalisation_wizard.py | pjamesjoyce/futura | 6 | 12777953 | from PySide2 import QtWidgets, QtCore
import os
from ..utils import load_ui_file
from ..widgets.filter import FilterListerWidget, parse_filter_widget
from ..widgets.geo import LocationSelectorWidget
from ...utils import findMainWindow
from futura.utils import create_filter_from_description
from futura import w
from fu... | 2.125 | 2 |
test_case_4_3.py | Alekseybykov126/autotesting | 0 | 12777954 | <filename>test_case_4_3.py
from Regress_web.page import *
time.sleep(1)
def case_4_3(self, full_screen):
self.page.loger('\n Запуск Тест кейс № 4_3 tvweb_new-4_3: Проверка работоспособности кнопок "Смотреть все" с главной страницы \n')
time.sleep(2)
## Бесплатные фильмы
self.page.loger('Шаг 1. Провер... | 2.171875 | 2 |
stacksites/sites/models.py | jasonvfang/StackSites | 0 | 12777955 | <gh_stars>0
# -*- coding: utf-8 -*-
from datetime import datetime
from stacksites.database import db, CRUDMixin
from .utils import upload_index_for_new_site, make_s3_path, get_files_data, delete_site_from_s3, transfer_landing_demo
class Site(CRUDMixin, db.Model):
__tablename__ = 'site'
name = db.Column(db.St... | 2.296875 | 2 |
mys/transpiler/infer_types_transformer.py | eerimoq/sython | 0 | 12777956 | from ..parser import ast
from .utils import BUILTIN_TYPES
from .utils import CompileError
from .utils import is_upper_snake_case
class Placeholder(ast.AST):
pass
class TypeVisitor(ast.NodeVisitor):
def __init__(self, context):
self.context = context
def visit_Constant(self, node):
if i... | 2.515625 | 3 |
itrain/ext/datasets/copa.py | qpoiPeng/efficient-task-transfer | 11 | 12777957 | <gh_stars>10-100
import os
import urllib.request
from xml.dom import minidom
import datasets
import requests
_CITATION = """\
@inproceedings{roemmele2011choice,
title={Choice of Plausible Alternatives: An Evaluation of Commonsense Causal Reasoning.},
author={<NAME> and <NAME> and <NAME>},
booktitle={AAAI sprin... | 2.640625 | 3 |
tests/api/ils/records_relations/test_records_relations_siblings.py | topless/invenio-app-ils | 0 | 12777958 | # -*- coding: utf-8 -*-
#
# Copyright (C) 2020 CERN.
#
# invenio-app-ils is free software; you can redistribute it and/or modify it
# under the terms of the MIT License; see LICENSE file for more details.
"""Test records relations siblings."""
import json
from flask import url_for
from invenio_app_ils.documents.api... | 1.898438 | 2 |
test/unit_tests_bible_yaml_downloader.py | daniel-tran/meaningless | 0 | 12777959 | <gh_stars>0
import unittest
import sys
sys.path.append('../')
from meaningless import YAMLDownloader, yaml_file_interface
# These tests just test for certain components which differ from the base downloader
class UnitTests(unittest.TestCase):
# Note: Tests will only be run if they are prefixed with test_ in the... | 3 | 3 |
exporter/constants.py | KTOmega/Slack-Exporter | 0 | 12777960 | CONVERSATIONS_EXPORT_DIR = "conversations"
CONVERSATIONS_JSON_FILE = "conversations.json"
CONVERSATIONS_TYPES = "public_channel,private_channel,mpim,im"
CONTEXT_JSON_FILE = "metadata.json"
EMOJI_EXPORT_DIR = "emoji"
EMOJI_JSON_FILE = "emoji.json"
FILES_EXPORT_DIR = "files"
FILES_JSON_FILE = "files.json"
HISTORY_JSON_DI... | 1.132813 | 1 |
Exercicios de Tuplas/ex075.py | ChristianSantos88/Python | 1 | 12777961 | '''
Desenvolva um programa que leia quatro valores pelo teclado e guarde-os em uma tupla. No final, mostre:
a) Quantas vezes apareceu o valor 9;
b) Em que posição foi digitado o primeiro valor 3;
c) Quais foram os números pares.
'''
num = tuple(int(input('Digite um valor: ')) for c in range(0, 4))
cont_nove = 0
pos_t... | 4.03125 | 4 |
detect_system_deps.py | rbrich/xcik | 11 | 12777962 | <reponame>rbrich/xcik
#!/usr/bin/env python3
import sys
import yaml
import tempfile
import textwrap
from pathlib import Path
from subprocess import run, DEVNULL
script_dir = Path(__file__).parent
def debug(_msg):
pass
def parse_args():
import argparse
ap = argparse.ArgumentParser()
ap.add_argument(... | 2.203125 | 2 |
mlrun/api/crud/__init__.py | katyakats/mlrun | 0 | 12777963 | <reponame>katyakats/mlrun<filename>mlrun/api/crud/__init__.py
from .artifacts import Artifacts # noqa: F401
from .feature_store import FeatureStore # noqa: F401
from .functions import Functions # noqa: F401
from .logs import Logs # noqa: F401
from .pipelines import Pipelines # noqa: F401
from .projects import Proj... | 1.109375 | 1 |
output/models/nist_data/list_pkg/boolean/schema_instance/nistschema_sv_iv_list_boolean_pattern_3_xsd/__init__.py | tefra/xsdata-w3c-tests | 1 | 12777964 | <reponame>tefra/xsdata-w3c-tests
from output.models.nist_data.list_pkg.boolean.schema_instance.nistschema_sv_iv_list_boolean_pattern_3_xsd.nistschema_sv_iv_list_boolean_pattern_3 import NistschemaSvIvListBooleanPattern3
__all__ = [
"NistschemaSvIvListBooleanPattern3",
]
| 0.804688 | 1 |
problems/p019.py | 10jmellott/ProjectEuler | 0 | 12777965 | <gh_stars>0
"""<a href="https://projecteuler.net/problem=19" class="title-custom-link">Counting Sundays</a>
You are given the following information, but you may prefer to do some research for yourself.
1 Jan 1900 was a Monday.
Thirty days has September,
April, June and November.
All the rest hav... | 3.921875 | 4 |
src/radiomics_extractor.py | SCAN-NRAD/DL-DiReCT | 12 | 12777966 | import argparse
import os
import sys
import radiomics
import SimpleITK as sitk
import csv
import pandas as pd
LABELS_FS = ['Left-Lateral-Ventricle', 'Left-Inf-Lat-Vent', 'Left-Thalamus-Proper', 'Left-Caudate', 'Left-Putamen', 'Left-Pallidum', '3rd-Ventricle',
'4th-Ventricle', 'Brain-Stem', 'Left-Hippocam... | 1.820313 | 2 |
New folder/project_BSW.py | bswood9321/PHYS-3210 | 0 | 12777967 | <filename>New folder/project_BSW.py
# -*- coding: utf-8 -*-
"""
Created on Mon Nov 11 22:17:26 2019
@author: Brandon
"""
import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
e0=8.8541878128e-12
echarge=1.60217662e-19
hbar=1.0545718e-34
me=9.10938356e-31
a0=5.29177210903e-11
c... | 2.015625 | 2 |
src/seedwork/infrastructure/logging.py | Ermlab/python-ddd | 308 | 12777968 | from pythonjsonlogger import jsonlogger
from datetime import datetime
import logging
from logging import Logger
from logging.config import dictConfig
from seedwork.utils.functional import SimpleLazyObject
from seedwork.infrastructure.request_context import request_context
class RequestContextFilter(logging.Filter):
... | 2.25 | 2 |
research/coefficients.py | carrino/FrisPy | 0 | 12777969 | <reponame>carrino/FrisPy<gh_stars>0
import math
from pprint import pprint
import matplotlib.pyplot as plt
from frispy import Discs
model = Discs.ultrastar
# plot coefficients from -180 to 180
deg = range(-90, 90)
#lift = [model.C_lift(x * math.pi / 180) for x in deg]
#plt.plot(deg, lift)
#drag = [model.C_y(x * mat... | 2.578125 | 3 |
Traveling Salesman/parametric.py | lbenning/Evolutionary | 0 | 12777970 | import math
import random
import numpy
from tools import *
'''
Parametric Optimizers to search for optimal TSP solution.
Method 1: Stochastic Hill Climbing search
Method 2: Random Search - Used as benchmark
'''
# Initialize the population, a collection of paths
def createPath(m):
n = numpy.arange(1,m+1)
numpy.ra... | 3.28125 | 3 |
exercicios_pyhton/leia_int_leia_fload/validar_dados.py | wcalazans81/cursoemvideo_de_python | 0 | 12777971 | <gh_stars>0
sexo = str(input('Quer continuar? [M/F] ')).strip().upper()[0]
while sexo not in 'SsNn':
sexo = str(input('Por favor digite um sexo válido! [M/F] ')).strip().upper()[0]
print(f'Sexo {sexo} registrado com sucesso.')
| 3.484375 | 3 |
2019-10-10-at1-op2.py | mpassosbr/python3 | 0 | 12777972 | <reponame>mpassosbr/python3
print("Calculadora completa")
num1 = input("Digite o primeiro número: ")
operador = input("Digite um operador matemático (+, -, *, /): ")
num2 = input("Digite o segundo número: ")
msg_op = False
try:
num1 = float(num1)
num2 = float(num2)
if operador == "+":
resultado = nu... | 4.3125 | 4 |
mysfire/processors/_array_utils.py | DavidMChan/mysfire | 3 | 12777973 | from typing import Dict, List, Optional, Union
import torch
from ..torch_utils import padded_stack
def stack_arrays_as_dict(
batch: List[Optional[torch.Tensor]], pad: bool = True
) -> Optional[
Union[
torch.Tensor,
Dict[str, Union[Optional[torch.Tensor], Optional[List[Optional[torch.Tensor]]... | 2.640625 | 3 |
0003/solution.py | rnsavinelli/project-euler | 1 | 12777974 | #!/usr/bin/python3
import math
def is_prime2(n: int) -> bool:
if n >= 2:
for i in range(2, n):
if not (n % i):
return False
else:
return False
return True
def prime_factors(n: int) -> []:
primes = []
for i in range(1, math.floor(math.sqrt(n)) + 1):
... | 3.75 | 4 |
MP3-testfiles/word_count_juice.py | dayuebai/PassionFruit | 0 | 12777975 | #!/usr/local/bin/python3
# This script counts the number of 1's in the file, and output the <key,count> pair
# argv[1] a key i.e. a word
# argv[2] a file containing a list of 1's
#
# Author: <NAME>, <NAME>
# Date: 11/23/2020
import sys
key = sys.argv[1]
filename = sys.argv[2]
count = 0
with open(filename, "r") as f... | 3.6875 | 4 |
syntax.py | piekill/pypresto | 4 | 12777976 | <filename>syntax.py
# syntax.py
from PyQt5.QtCore import QRegExp, Qt
from PyQt5.QtGui import QColor, QTextCharFormat, QFont, QSyntaxHighlighter
def format(color, style=''):
"""Return a QTextCharFormat with the given attributes.
"""
_color = QColor()
_color.setNamedColor(color)
_format = QTextCha... | 2.640625 | 3 |
function/AWS-DR-Cherry-E.py | Iviglious/deep-race-cherry | 0 | 12777977 |
def reward_function(params):
'''
Cosine reward function for heading angle
'''
# Import libraries
import math
# PARAMETERS (CONSTANTS)
# Total num of steps we want the car to finish the lap, it will vary depends on the track length
TOTAL_NUM_STEPS = 300
# Max angle thre... | 3.453125 | 3 |
matching_area/matching_area.py | neuroinformatics/bah2015_registration | 0 | 12777978 | # -*- coding: utf-8 -*-
import sys
from PIL import Image
from PIL import ImageStat
def matching_ish(labeled_filename, ish_filename, output_filename, slice):
N_AREA = 40
threshold = 10
volume_threshold = 10
volume_bias = 40
labeled_count = {}
labeled_volume = {}
result_value = {}
resu... | 2.765625 | 3 |
cilantropy/console.py | foozzi/cilantro | 49 | 12777979 | """
.. module:: console
:platform: Unix, Windows
:synopsis: Cilantropy entry-point for console commands
:mod:`console` -- Cilantropy entry-point for console commands
==================================================================
"""
from .helpers import get_shared_data
from .helpers import get_pkg_res
from .... | 2.21875 | 2 |
todo.py | puntogris/recordatorios | 0 | 12777980 | #programa de recordatorios
import pickle
import os
#crea lista vacia en un archivo llamada outfile con pickle si no exite uno
#de lo contrario abre el creado previamente
if os.path.isfile('./outfile') == False:
recordatorios = []
with open('outfile', 'wb') as fp:
pickle.dump(recordatorios, fp)
else:
... | 3.75 | 4 |
car.py | git4robot/CarGame | 0 | 12777981 | from tkinter import *
from tkinter import messagebox, colorchooser
from logging import basicConfig, warning, info, error, DEBUG
from os import getcwd, path, mkdir
from time import strftime, time, localtime
from json import dump, load
from re import findall, search
from hmac import new, compare_digest
from hashl... | 2.546875 | 3 |
convert_data_to_edf.py | Dreem-Organization/dreem-learning-open | 44 | 12777982 | import os
import pyedflib
import h5py
import pytz
import datetime as dt
import struct
psg_properties = {'digital_max': [32767],
'digital_min': [-32767],
'dimension': ['uV'],
'physical_min': [-800.0],
'physical_max': [800.0],
... | 2 | 2 |
conanfile.py | mohamedghita/conan-fcl | 0 | 12777983 | <reponame>mohamedghita/conan-fcl
from conans import ConanFile, CMake, tools
import shutil
import os.path
class FclConan(ConanFile):
name = "fcl"
version = "0.5.0"
license = "BSD"
author = "<NAME> (<EMAIL>)"
url = "https://github.com/mohamedghita/conan-fcl"
description = "conan.io package for f... | 1.742188 | 2 |
opskitcl.py | surfkansas/opskit | 0 | 12777984 | <gh_stars>0
import argparse
import importlib
import os
import sys
def build_arg_parser():
arg_parser = argparse.ArgumentParser(add_help=False)
arg_parser.add_argument('product', nargs='?', default=None)
arg_parser.add_argument('action', nargs='?', default=None)
arg_parser.add_argument('--help', ac... | 2.765625 | 3 |
rt_od_force.py | Cybernorse/credit-card-owner-verification-and-indoor-security-system-with-face-recognition-and-object-detection | 0 | 12777985 | import cv2
import numpy as np
import os
# import six.moves.urllib as urllib
import sys
import tarfile
import tensorflow as tf
import zipfile
import pathlib
from collections import defaultdict
from io import StringIO
from matplotlib import pyplot as plt
from PIL import Image
from IPython.display import display
from obje... | 2.421875 | 2 |
tests/test_pyres_tasks.py | gingerlime/remotecv | 1 | 12777986 | #!/usr/bin/python
# -*- coding: utf-8 -*-
import mock
from preggy import expect
from unittest import TestCase
from tests import read_fixture
from remotecv.pyres_tasks import DetectTask
from remotecv.utils import config
class DetectTaskTestCase(TestCase):
def test_should_run_detector_task(self):
store_m... | 2.25 | 2 |
Python/2_square(n)_sum.py | josefrank/codewars | 0 | 12777987 | <gh_stars>0
"""
Complete the square sum function so that it squares each number passed
into it and then sums the results together.
For example, for [1, 2, 2] it should return 9 because 1^2 + 2^2 + 2^2 = 9
"""
# Solution
def square_sum(numbers):
# Simple function that uses a For loop and iterates over a list.
... | 4.0625 | 4 |
src/training_managers/evolutionary_computation_trainer.py | Freitacr/ML-StockAnalysisProject | 0 | 12777988 | """
"""
from configparser import ConfigParser, SectionProxy
from os import path
import os
from typing import List, Tuple, Any, Optional, Dict
import numpy as np
import tqdm
from general_utils.config import config_util, config_parser_singleton
from general_utils.exportation import csv_exportation
from ge... | 2.03125 | 2 |
homeassistant/components/wiffi/wiffi_strings.py | domwillcode/home-assistant | 30,023 | 12777989 | """Definition of string used in wiffi json telegrams."""
# units of measurement
WIFFI_UOM_TEMP_CELSIUS = "gradC"
WIFFI_UOM_DEGREE = "grad"
WIFFI_UOM_PERCENT = "%"
WIFFI_UOM_MILLI_BAR = "mb"
WIFFI_UOM_LUX = "lux"
| 1.5 | 2 |
spark_scripts/schema.py | ChaithralakshmiS/Insight-DE-Project | 1 | 12777990 | <reponame>ChaithralakshmiS/Insight-DE-Project<gh_stars>1-10
from pyspark.sql.types import *
from pyspark.sql.types import StringType
from pyspark.sql import SparkSession
from pyspark.sql import functions as F
from pyspark.sql.types import StringType, DoubleType, IntegerType
import postgres
def get_events_schema():
... | 2.484375 | 2 |
v602/python/vorbereitung.py | chrbeckm/anfaenger-praktikum | 2 | 12777991 | <gh_stars>1-10
import numpy as np
import scipy.constants as const
planckh = const.Planck
cspeed = const.speed_of_light
charge = const.elementary_charge
d = 201.4*10**(-12)
ordnung = np.array([29, 29, 30, 32, 35, 37, 38, 40, 41])
ek = np.array([8.048, 8.905, 9.673 ,11.115 ,13.483 ,15.202 ,16.106 ,17.997 ,18.985])
ek = ... | 2.09375 | 2 |
main.py | oliversvane/Classification-With-Laplace-Approximation | 2 | 12777992 | <reponame>oliversvane/Classification-With-Laplace-Approximation<gh_stars>1-10
# module load python3/3.8.11
# module load cudnn/v8.2.0.53-prod-cuda-11.3
import warnings
import os
import torch
import torch.distributions as dists
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
from torch... | 2.375 | 2 |
pykomposter/lib.py | algoravioli/pykomposter | 0 | 12777993 | <reponame>algoravioli/pykomposter
import music21
import numpy as np
import pandas as pd
# function definitions
import actions
# behaviours:
import behaviours
# metabehaviours:
import metabehaviours
# microactions
import microactions
class pykomposter:
def __init__(self):
super(pykomposter, self).__ini... | 2.59375 | 3 |
Background_Straws.py | Zucchi43/Flappy_Turtle | 0 | 12777994 | import pygame
size = width, height = 350,500 #Screen Size
class Background(pygame.sprite.Sprite):
def __init__(self, image_file, location):
pygame.sprite.Sprite.__init__(self) #call Sprite initializer
self.image = pygame.image.load(image_file)
self.rect = self.image.get_rect()
self... | 3 | 3 |
pkg/controllers/auth.py | azupatrick0/taskmanagist | 0 | 12777995 | from flask import Flask, request, make_response
import re
from app import db, bcrypt
from pkg.models.auth_models import user
from pkg.helpers.authentication import generateToken
class Auth:
def init(self):
pass
def signup(self):
name = request.json['name']
email = request.json['email']... | 2.96875 | 3 |
Lib/site-packages/wx-3.0-msw/wx/__init__.py | jickieduan/python27 | 5 | 12777996 | <reponame>jickieduan/python27<filename>Lib/site-packages/wx-3.0-msw/wx/__init__.py
#----------------------------------------------------------------------------
# Name: __init__.py
# Purpose: The presence of this file turns this directory into a
# Python package.
#
# Author: <NAME>
#
# ... | 2.15625 | 2 |
project_generator/tool.py | aethaniel/project_generator | 1 | 12777997 | # Copyright 2014 0xc0170
#
# 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 writing, soft... | 1.851563 | 2 |
tests/core/test_project_init.py | pypipet/pypipet | 0 | 12777998 | <filename>tests/core/test_project_init.py
from unittest.mock import Mock
import pytest
from pypipet.core.project_context import PipetContext
from sqlalchemy.exc import OperationalError
import os
class TestProjectInit:
def test_init_project(self):
ctx = PipetContext()
ctx.start_project('test')
... | 2.21875 | 2 |
videodatabase.py | nsdown/Facebook-Video-Uploader | 4 | 12777999 | <filename>videodatabase.py
## this example uses sqlite
#Download sqlite browser app for dealing with your database here:
#http://sqlitebrowser.org/
#from peewee import *
import peewee
db = peewee.SqliteDatabase('VideoUploads.db')
class Video(peewee.Model):
vid_url = peewee.CharField(max_length=4096)
c... | 3.34375 | 3 |
bme280_test.py | Kuzj/Python_BME280 | 1 | 12778000 | <gh_stars>1-10
#!/usr/bin/env python
from Adafruit_BME280 import BME280
from time import sleep
DELAY_BETWEEN_SENSORS = 1
SPI_BUS = 0
for j in range(20):
for i in [1,2,3,4,5]:
bme280SensorInstance = BME280(spi_bus=SPI_BUS,spi_dev=i, speed_hz = 13)#, delay_usec = 10000)
if bme280SensorInstance.sample_ok:
print(... | 2.875 | 3 |
src/examples/reference/mousemoved.py | agarwalnaimish/pyprocessing | 3 | 12778001 | <filename>src/examples/reference/mousemoved.py
from pyprocessing import *
# Move your mouse across the
# image to change the value of the rectangle
value = 0;
def draw():
fill(value);
rect(25, 25, 50, 50);
def mouseMoved():
global value
value = value + 5;
if (value > 255):
value = 0;
run()
| 3.140625 | 3 |
app/controllers/user/widget.py | meongbego/IOT_ADRINI | 1 | 12778002 | <gh_stars>1-10
from flask_restful import Resource, reqparse, fields
from app.helpers.rest import *
from app.helpers.memcache import *
from app.models import model as db
from app import db as dbq
from app.middlewares.auth import login_required, get_jwt_identity
class WidgetResource(Resource):
@login_required
d... | 2.4375 | 2 |
python/sub-temp.py | robertrongen/smartys-rpi | 0 | 12778003 | <reponame>robertrongen/smartys-rpi<gh_stars>0
import time
import datetime
import paho.mqtt.client as mqtt
import fourletterphat as flp
import signal
import buttonshim
# set max temperature
maxtemp = 30
# Define event handlers
def on_connect(mqtt_client, obj, flags, rc):
mqtt_client.subscribe("smartys1/temp")
... | 2.84375 | 3 |
gifts_rest/router.py | brjones/gifts_rest | 0 | 12778004 | <filename>gifts_rest/router.py
"""
.. See the NOTICE file distributed with this work for additional information
regarding copyright ownership.
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 Licens... | 1.992188 | 2 |
Scripts/Search.py | TheGreymanShow/House.Viz | 0 | 12778005 | <filename>Scripts/Search.py
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import random
print("Welcome to House.Viz")
print("Please select your budget range :")
print("1. $50000-$100000")
print("2. $100000-$200000")
print("3. $200000-$300000")
print("4. $300000-$400000")
print("5. $400000-$500... | 3.78125 | 4 |
release/stubs.min/Rhino/Geometry/__init___parts/Ellipse.py | YKato521/ironpython-stubs | 0 | 12778006 | <reponame>YKato521/ironpython-stubs
class Ellipse(object, IEpsilonComparable[Ellipse]):
"""
Represents the values of a plane and the two semiaxes radii in an ellipse.
Ellipse(plane: Plane,radius1: float,radius2: float)
Ellipse(center: Point3d,second: Point3d,third: Point3d)
"""
def EpsilonE... | 3.375 | 3 |
solutions/StringSplitAndJoin.py | kaleliguray/python_hackerRank_solution | 0 | 12778007 | <gh_stars>0
def split_and_join(line):
# write your code here
tempString = line.split(" ")
print("Split version : ",tempString)
tempString = "-".join(tempString)
print("Join version : ",tempString)
return tempString
if __name__ == '__main__':
line = input()
result = split_and_join(line)
... | 3.546875 | 4 |
src/bdbd/src/bdbd/test/audio.py | rkent/BDBD | 0 | 12778008 | <reponame>rkent/BDBD<gh_stars>0
# demo of generation of wav file, manipulation with pydub, and playing through speakers
import espeakng
import pyaudio
import wave
import pydub
import sys
import io
import logging
logging.basicConfig(level='INFO')
log = logging.getLogger(__name__)
log.info('test of logging')
p = pyaudio... | 2.75 | 3 |
books/modernvim/bubba.py | argodev/learn | 0 | 12778009 | def mytest:
print('hello')
| 0.972656 | 1 |
examples/pseudo_bayesian/pb_exp_decay.py | KennedyPutraKusumo/py-DED | 2 | 12778010 | import numpy as np
from pydex.core.designer import Designer
def simulate(ti_controls, model_parameters):
return np.array([
np.exp(model_parameters[0] * ti_controls[0])
])
designer = Designer()
designer.simulate = simulate
reso = 21j
tic = np.mgrid[0:1:reso]
designer.ti_controls_candidates = np.arra... | 2.4375 | 2 |
exabel_data_sdk/scripts/load_entities_from_csv.py | Exabel/python-sdk | 1 | 12778011 | import argparse
import sys
from typing import Sequence
from exabel_data_sdk import ExabelClient
from exabel_data_sdk.client.api.bulk_insert import BulkInsertFailedError
from exabel_data_sdk.client.api.data_classes.entity import Entity
from exabel_data_sdk.scripts.csv_script import CsvScript
from exabel_data_sdk.util.r... | 2.484375 | 2 |
changeManager/views.py | karimbahgat/gbTracker_site | 0 | 12778012 | from django.http.response import HttpResponse
from django.shortcuts import render, redirect
from django.http import JsonResponse
from django.forms.models import fields_for_model, model_to_dict
from django.views.decorators.csrf import csrf_exempt
from django.db import transaction
from . import models
from . import form... | 2.015625 | 2 |
etf.py | jeff-fred/TerminalStockViewer | 0 | 12778013 | <filename>etf.py
# Functions for a ETF kind of quoteType, according to yfinance.
import yfinance as yf
## FUNCTIONS ##
# Get basic info of a ETF
def get_basic_ETF_info(ticker):
etfInfo = ticker.info
keys = [
'exchange',
'symbol',
'shortName',
'longBusinessSummary',]
# Get... | 3.078125 | 3 |
wiserHeatingAPI/__init__.py | TobyLL/wiserheatingapi | 16 | 12778014 | <gh_stars>10-100
name = "wiser-heating-api"
| 1.117188 | 1 |
numpy/csv-plot-many-y.py | jwrr/python-stuff | 0 | 12778015 | <gh_stars>0
#!/usr/bin/env python3
#
# Each column of csv is a Y sequence. All Y sequences are plotted on the same
# chart.
import numpy as np
import matplotlib.pyplot as plt
import sys
if len(sys.argv) < 2: # requires 1 arg
scriptname = sys.argv[0]
print("Example: {} filename.csv".format(scriptname))
sys.exi... | 3.875 | 4 |
main.py | Sato3114/CSV-SGFilter | 0 | 12778016 | <filename>main.py
import numpy as np
from scipy import signal
import matplotlib.pyplot as plt
# 設定
csvPath = '' # CSVファイルのパス
dt = 0.0001 # サンプリング間隔
windowLength = 55 # フィルタ窓長さ
polyOrder = 5 ... | 3.09375 | 3 |
tests/common.py | zhengyuli/addonfactory-solutions-library-python | 0 | 12778017 | # SPDX-FileCopyrightText: 2020 2020
#
# SPDX-License-Identifier: Apache-2.0
import os.path as op
import socket
import subprocess
from splunklib import binding
from splunklib import client
from splunklib.data import record
cur_dir = op.dirname(op.abspath(__file__))
# Namespace
app = "unittest"
owner = "nobody"
# Se... | 2.015625 | 2 |
test/python/app.py | lnsdeep/Android-Image-Cropper | 0 | 12778018 | import subprocess
from PIL import Image
import torchvision.transforms as transforms
import torch
import functools
import random
import math
import cv2
import numpy as np
import os
# Object annotation class:
class BodyPart:
def __init__(self, name, xmin, ymin, xmax, ymax, x, y, w, h):
self.name = name
... | 2.390625 | 2 |
timeseries/extract_info/rm-rt.py | sgagnon/lyman-tools | 0 | 12778019 | <reponame>sgagnon/lyman-tools<gh_stars>0
import os.path as op
smoothing = 'smoothed'
regspace = 'epi'
project = 'RM'
design = 'rm_rt.csv'
func_exp = 'rm'
onset_exp = 'rm-rt'
smoothing_fwhm = 0
standardize = True
tr = float(2)
tr_shift = [0, 2, 4, 6, 8, 10, 12] # in seconds
tr_integrate = [0, 2, 4, 6, 8, 10] # in secon... | 1.734375 | 2 |
stock_span.py | rhthomas/Python-Interview-Problems-for-Practice | 0 | 12778020 | # Context : The span Si of the stock’s price on a given day i
# is defined as the maximum number of consecutive days just before
# the given day, for which the price of the stock on the current
# day is less than or equal to its price on the given day.
# Problem: We have a series of n daily price quotes for a stock ... | 3.828125 | 4 |
uasyncio/test_readexactly.py | Carglglz/micropython-lib | 126 | 12778021 | <reponame>Carglglz/micropython-lib<filename>uasyncio/test_readexactly.py<gh_stars>100-1000
from uasyncio import StreamReader
class MockSock:
def __init__(self, data_list):
self.data = data_list
def read(self, sz):
try:
return self.data.pop(0)
except IndexError:
... | 2.59375 | 3 |
homepanelapi/cli.py | timmo001/python-homepanelapi | 1 | 12778022 | <filename>homepanelapi/cli.py<gh_stars>1-10
"""Enable CLI."""
import click
# pylint: disable=C0330
@click.command()
@click.option("--host", "-h", help="Home Panel's Hostname.")
@click.option("--port", "-P", help="The Home Panel Port.")
@click.option("--ssl", "-s", is_flag=True, help="Use ssl?")
@click.option("--userna... | 2.40625 | 2 |
source/levenshtein_distance.py | Asplund-Samuelsson/furee | 2 | 12778023 | <filename>source/levenshtein_distance.py
#!/usr/bin/env python3
import sys
from Levenshtein import distance as LD
# Read input arguments
fasta_a = sys.argv[1]
fasta_b = sys.argv[2]
out_file = sys.argv[3]
# Generator object to turn fasta into iterator
class fasta(object):
# Initialize fasta object
def __init... | 3.484375 | 3 |
test_layer.py | Marcel-Rodekamp/ComplexValuedNetworks | 0 | 12778024 | from layer import *
import itertools
# This file just tests the implementations in layer.py
if __name__ == "__main__":
def test_ACL(V):
# construct ACL with complex values
def amFactoryI(Nlayer, activation):
moduleList = []
for l in range(Nlayer-1):
layer = ... | 2.4375 | 2 |
{{cookiecutter.repo_name}}/{{cookiecutter.repo_name}}/models.py | JuacyWillian/cookiecutter-kivymd | 0 | 12778025 | import enum
from datetime import datetime
from functools import reduce
from sqlalchemy import (create_engine)
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import sessionmaker
database_uri = 'sqlite:///:memory:'
debug = False
db = create_engine(database_uri, echo=debug)
Base = declarati... | 2.265625 | 2 |
tools/Verify.py | Zoctan/flask-api-seed | 0 | 12778026 | <reponame>Zoctan/flask-api-seed<gh_stars>0
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import re
def email(e):
if re.match("[a-zA-Z0-9]+@+[a-zA-Z0-9]+\.+[a-zA-Z]", e) is not None:
return True
return False
| 2.109375 | 2 |
comet/plugins/eventwriter.py | shinybrar/Comet | 0 | 12778027 | <reponame>shinybrar/Comet<filename>comet/plugins/eventwriter.py
# Comet VOEvent Broker.
# Example event handler: write an event to file.
import os
import string
from contextlib import contextmanager
from zope.interface import implementer
from twisted.plugin import IPlugin
from twisted.python import lockfile
from com... | 2.34375 | 2 |
src/__init__.py | ljusto/schmoobot | 0 | 12778028 | <reponame>ljusto/schmoobot
__author__ = '<NAME>'
| 0.851563 | 1 |
utils_v2/__init__.py | lamnguyen95/pyutils_v2 | 0 | 12778029 | #!/usr/bin/env python3
from __future__ import absolute_import
from utils_v2.get_stats import *
| 1.078125 | 1 |
cauldron/session/writing/components/definitions.py | JohnnyPeng18/cauldron | 90 | 12778030 | import functools
import typing
from collections import namedtuple
COMPONENT = namedtuple('COMPONENT', ['includes', 'files'])
WEB_INCLUDE = namedtuple('WEB_INCLUDE', ['name', 'src'])
def merge_components(
*components: typing.Union[list, tuple, COMPONENT]
) -> COMPONENT:
"""
Merges multiple COMPONENT i... | 3.03125 | 3 |
Algorighms/Search/BinarySearch.py | zhangsifan/ClassicAlgorighthms | 27 | 12778031 | <reponame>zhangsifan/ClassicAlgorighthms
# -*- coding: utf-8 -*-#
'''
@Project : ClassicAlgorighthms
@File : BinarySearch.py
@USER : ZZZZZ
@TIME : 2021/4/22 10:21
'''
class BinarySearch():
'''
二分查找比较难的地方是如何确定左右边界,以及查找到元素时的左右边界的最终结果。
此处我将所有的边界全部设置为**闭区间**。只考虑这一种情况即可。
当然还有另一种... | 2.921875 | 3 |
arekit/contrib/networks/context/configurations/att_ef_pcnn.py | nicolay-r/AREk | 18 | 12778032 | <filename>arekit/contrib/networks/context/configurations/att_ef_pcnn.py
from arekit.contrib.networks.context.configurations.att_ef_cnn import AttentionEndsAndFramesCNNConfig
class AttentionEndsAndFramesPCNNConfig(AttentionEndsAndFramesCNNConfig):
pass
| 1.25 | 1 |
modernrpc/tests/testsite/rpc_methods_stub/generic.py | germancollado/django-modern-rpc | 89 | 12778033 | <reponame>germancollado/django-modern-rpc<filename>modernrpc/tests/testsite/rpc_methods_stub/generic.py<gh_stars>10-100
# coding: utf-8
import datetime
from modernrpc.core import rpc_method, PROTOCOL_KEY
from modernrpc.exceptions import RPCException, RPC_CUSTOM_ERROR_BASE
from modernrpc.helpers import get_builtin_date... | 2.515625 | 3 |
boards/esp32/libraries/legacy/projects/wifi_http/02_rtc.py | iot49/IoT49 | 0 | 12778034 | <gh_stars>0
from machine import RTC
rtc = RTC()
rtc.ntp_sync(server="hr.pool.ntp.org")
| 1.734375 | 2 |
tensorflow_estimator/python/estimator/export/function_test.py | cyc/estimator | 2 | 12778035 | # Copyright 2019 The TensorFlow Authors. 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 applica... | 1.625 | 2 |
1_beginner/chapter4/solutions/menu.py | code4tomorrow/Python | 4 | 12778036 | """
A restaurant menu has food and drink sections,
each from which the customer must choose an order.
By default, any combination of food and drink orders
are $1,000,000,000.
But if the customer enters 'french toast'
AND 'coffee', there is a discount of $1.
Otherwise, if the customer enters 'chicken soup' OR 'apple j... | 4.25 | 4 |
src/xia2/Modules/Mtzdump.py | graeme-winter/xia2 | 10 | 12778037 | <reponame>graeme-winter/xia2
# A replacement for the wrapper for the CCP4 program MTZDUMP using CCTBX
# to access the file directly.
import copy
import os
from iotbx import mtz
class Mtzdump:
"""A class to give the same functionality as the wrapper for the CCP4
MTZDUMP program."""
def __init__(self):
... | 2.453125 | 2 |
Chapter12/old_12/BankSubscriberEDA.py | amirziai/Hands-on-Artificial-Intelligence-with-TensorFlow-Book | 10 | 12778038 | '''
Created on 10-Jul-2018
@author: <NAME>
'''
# We will use seaborn to create plots
import seaborn as sns
# Matplotlib will help us to draw the plots
import matplotlib.pyplot as plt
sns.set(color_codes=True)
# Import pandas to manage data set
import pandas as pd
# Import NumPy for all mathematics operations on ... | 3.71875 | 4 |
pdsensorvis/sensors/migrations/0004_auto_20190925_0809.py | mickeykkim/masters-project-sphere | 2 | 12778039 | # Generated by Django 2.2.2 on 2019-09-25 07:09
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('sensors', '0003_auto_20190924_2227'),
]
operations = [
migrations.AlterField(
model_name='cameradata',
name='filenam... | 1.84375 | 2 |
helpingnetwork/organization/views.py | neopentane/Techathon_19 | 0 | 12778040 | from django.shortcuts import render,redirect
from .forms import OrganizationRegisterForm,CreateEventForm,AddImageForm,AddOrgImage
from .models import Organization,OrganizationImages
from django.contrib.auth.models import User
from django.contrib import messages
from evelist.models import Event,EventImages
from voluntee... | 1.953125 | 2 |
mkt/comm/authorization.py | clouserw/zamboni | 0 | 12778041 | from django.conf import settings
from django.shortcuts import get_object_or_404
from rest_framework.permissions import BasePermission
from rest_framework.exceptions import PermissionDenied
from mkt.comm.models import (CommunicationNote, CommunicationThread,
user_has_perm_note, user_has_pe... | 2.1875 | 2 |
quiz_bot/db/base.py | livestreamx/quiz-bot | 1 | 12778042 | <reponame>livestreamx/quiz-bot
from typing import Type
import sqlalchemy as sa
import sqlalchemy.orm as so
from sqlalchemy import MetaData
from sqlalchemy.ext.declarative import as_declarative, declared_attr
metadata = MetaData()
@as_declarative(metadata=metadata)
class Base:
@declared_attr
def __tablename_... | 2.140625 | 2 |
datasets/dataset.py | levtelyatnikov/graph_edge_generation | 0 | 12778043 | <filename>datasets/dataset.py
from logging import raiseExceptions
import sys
import numpy as np
import torch
import pandas as pd
import torch_cluster
from omegaconf.dictconfig import DictConfig
from sklearn.model_selection import train_test_split
from torch_geometric.data import Dataset, Data
from datasets.synthetic_gr... | 2.640625 | 3 |
tests/test_sdds_write.py | radiasoft/rsbeams | 3 | 12778044 | <gh_stars>1-10
import unittest
from rsbeams.rsdata.SDDS import writeSDDS, readSDDS
from subprocess import Popen, PIPE
import numpy as np
# Tests that use SDDS Tools Distribution
def read_file(filename, par=None, col=None):
call1 = Popen('sddscheck {}'.format(filename), shell=True, stdout=PIPE, stderr=PIPE)
c... | 2.203125 | 2 |
Task2B.py | butanone/flooddefense | 0 | 12778045 | <filename>Task2B.py
from floodsystem import station
from floodsystem import flood
from floodsystem.stationdata import build_station_list
from floodsystem import stationdata
def run():
"""Requirements for Task 2B"""
stations = build_station_list()
stationdata.update_water_levels(stations)
stations_over_... | 2.734375 | 3 |
marginTrading/tests/test_spam/test_github_api.py | sambiase/pycrypto | 3 | 12778046 | import pytest as pytest
from unittest.mock import Mock
from marginTrading import github_api
@pytest.fixture
def avatar_url(mocker):
resp_mock = Mock()
url = 'https://avatars.githubusercontent.com/u/78605825?v=4'
resp_mock.json.return_value = {'login': 'sambiase', 'id': 78605825, 'node_id': 'MDQ6VXNlcjc4N... | 2.4375 | 2 |
visualization.py | karanrampal/template_project | 0 | 12778047 | <reponame>karanrampal/template_project<filename>visualization.py
#!/usr/bin/env python3
"""Visualize the model"""
import argparse
import logging
import os
import numpy as np
import torch
from torch.utils.tensorboard import SummaryWriter
import utils
from model.net import Net
import model.data_loader as d_l
def args... | 2.546875 | 3 |
hf/mining_libs/worker_registry.py | HashFast/hashfast-tools | 1 | 12778048 | <filename>hf/mining_libs/worker_registry.py
#!/usr/bin/env python
# Copyright (c) 2014, HashFast Technologies LLC
# All rights reserved.
#
# based heavily upon:
# Stratum mining proxy (https://github.com/slush0/stratum-mining-proxy)
# Copyright (C) 2012 <NAME> <<EMAIL>>
#
# Redistribution and use in source and bi... | 1.429688 | 1 |
app.py | CrossLangNV/text_transformer | 0 | 12778049 | <reponame>CrossLangNV/text_transformer
import os
import json
import subprocess
import flask
app = flask.Flask(__name__)
TMP_FILE_FOR_INPUT = 'input.txt'
TMP_FILE_FOR_OUTPUT = 'output.txt'
@app.route('/')
def home():
return 'COMPRISE Text Transformer Service'
@app.route('/transform', methods=['POST'])
def tra... | 2.328125 | 2 |
examples/MNIST_easytorch_CNN.py | sraashis/quenn | 0 | 12778050 | <filename>examples/MNIST_easytorch_CNN.py<gh_stars>0
import torch
import torch.nn.functional as F
from torchvision import datasets, transforms
from examples.models import MNISTNet
from easytorch import EasyTorch, ETTrainer, ConfusionMatrix, ETMeter, AUCROCMetrics
transform = transforms.Compose([
transforms.ToTens... | 2.515625 | 3 |