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 |
|---|---|---|---|---|---|---|
src/api/storage/smart.py | ScottDay/DFN-Maintenance-GUI-Backend | 2 | 12793051 | <filename>src/api/storage/smart.py
from time import sleep
import src.wrappers as wrappers
from src.console import console
from .partitions import disk_partitions
@wrappers.jwt
@wrappers.endpoint
@wrappers.stats
@wrappers.injector
def get(handler, log):
partitions = disk_partitions()
devices = []
log.info('Starti... | 2.125 | 2 |
link2clip.py | searchsam/link2clip | 0 | 12793052 | <reponame>searchsam/link2clip<gh_stars>0
#!/usr/bin/python3
# Import libraries
import re
import bs4
import sys
import time
import progress.bar
import requests
import pyperclip
def main(url, page):
# Connect to the URL
response = requests.get(url)
f = open(page + ".txt", "a+")
# Parse HTML and save t... | 3.328125 | 3 |
tests/conftest.py | mattip/numpy-threading-extensions | 0 | 12793053 | import numpy as np
import pytest
from packaging.utils import Version
import fast_numpy_loops
old_numpy = Version(np.__version__) < Version('1.18')
@pytest.fixture(scope='session')
def initialize_fast_numpy_loops():
fast_numpy_loops.initialize()
@pytest.fixture(scope='function')
def rng():
if old_numpy:
... | 2.140625 | 2 |
quavl/lib/expressions/rqbit.py | fabianbauermarquart/quavl | 0 | 12793054 | <reponame>fabianbauermarquart/quavl<filename>quavl/lib/expressions/rqbit.py<gh_stars>0
from typing import List
import numpy as np
from z3 import Bool, BoolRef, And, Or
from quavl.lib.expressions.qbit import QbitVal
class RQbitVal(QbitVal):
def __init__(self, z0: BoolRef = False, z1: BoolRef = False,
... | 2.703125 | 3 |
ingest/country_functions.py | csmets/travel-wish-list | 0 | 12793055 | #!/usr/bin/python3
"""
Bunch of country related function to help get extended data.
"""
import json
import requests
# Load country codes file and store into variable
countries_file = open('assets/country-codes.json')
countries = json.load(countries_file)
countries_file.close()
# Load country lat and long file and st... | 3.53125 | 4 |
python/pyarmnn/test/test_deserializer.py | Project-Xtended/external_armnn | 856 | 12793056 | <gh_stars>100-1000
# Copyright © 2020 Arm Ltd and Contributors. All rights reserved.
# SPDX-License-Identifier: MIT
import os
import pytest
import pyarmnn as ann
import numpy as np
@pytest.fixture()
def parser(shared_data_folder):
"""
Parse and setup the test network to be used for the tests below
"""
... | 1.960938 | 2 |
examples/personzju/run.py | zjuchenyuan/EasyLogin | 33 | 12793057 | <reponame>zjuchenyuan/EasyLogin<filename>examples/personzju/run.py
from EasyLogin import EasyLogin, mymd5
from mpms import MPMS
import threading
thread_data = threading.local()
import time
myprint = lambda s: print("[{showtime}] {s}".format(showtime=time.strftime("%Y-%m-%d %H:%M:%S"), s=s))
import time
a=Eas... | 2.390625 | 2 |
map-reduce with caching on HDFS/serverHDFS.py | Tianyi6679/mincemeatpy | 3 | 12793058 | <reponame>Tianyi6679/mincemeatpy
import socket
import pickle
import os
import re
class ProcessData:
messageType=""
fileName = ""
data = ""
dataNodeAddressList=[]
serv = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
serv.bind(('192.168.56.103', 12347))
serv.listen(5)
#serv.settimeout(0.0)
#serv.se... | 2.75 | 3 |
research/cv/PAMTRI/MultiTaskNet/src/loss/hard_mine_triplet_loss.py | mindspore-ai/models | 77 | 12793059 | # Copyright 2021 Huawei Technologies Co., Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to... | 2.46875 | 2 |
test/test_io.py | thomasleese/fitbod-analysis | 0 | 12793060 | from pathlib import Path
from unittest import TestCase
from gains.io import FitbodLoader
class TestFitbodLoader(TestCase):
data_filename = Path(__file__).parent / "data.csv"
def test_loading_data(self):
loader = FitbodLoader(self.data_filename)
analysis = loader.analysis
exercises ... | 2.40625 | 2 |
django_enum_choices/tests/test_form_fields.py | okapies/django-enum-choices | 73 | 12793061 | from django.test import TestCase
from django_enum_choices.forms import EnumChoiceField
from .testapp.enumerations import CharTestEnum
class FormFieldTests(TestCase):
def test_field_instance_creates_choices_correctly(self):
instance = EnumChoiceField(CharTestEnum)
choices = instance.build_choices... | 2.46875 | 2 |
secret_handshake/crypto.py | ProgVal/PySecretHandshake | 22 | 12793062 | # Copyright (c) 2017 PySecretHandshake contributors (see AUTHORS for more details)
#
# 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 righ... | 1.765625 | 2 |
thyme/trajectories.py | nw13slx/thyme | 0 | 12793063 | <reponame>nw13slx/thyme
"""
Data structure that contains a collection of trajectory objects
<NAME> (Harvard University)
2020
"""
from copy import deepcopy
import logging
import numpy as np
from .trajectory import Trajectory
from thyme.utils.atomic_symbols import species_to_order_label
from thyme.utils.savenload impo... | 2.375 | 2 |
100DaysOfDays/Dia07/ex32.py | giselemanuel/programming-challenges | 0 | 12793064 | <gh_stars>0
"""
Exercício Python 32: Faça um programa que leia um ano qualquer e mostre se ele é bissexto.
"""
print("-" * 40)
print(f'{"Ano Bissexto":^40}')
print("-" * 40)
ano = int(input("Insira um ano: "))
if ano % 4 == 0 and ano % 100 == 0 or ano % 400 == 0:
print(f"O ano {ano} é BISSEXTO !!!")
else:
pr... | 3.78125 | 4 |
scripts/tif_to_netcdf.py | giancastro/mapshader | 0 | 12793065 | import xarray as xr
from mapshader.transforms import squeeze
from mapshader.transforms import cast
from mapshader.transforms import orient_array
from mapshader.transforms import flip_coords
from mapshader.transforms import reproject_raster
def run_float(input_file, output_file, chunks=(512, 512),
name=... | 2.21875 | 2 |
deliver/functions_will/extract_feature_pixel.py | mariecpereira/Extracao-de-Caracteristicas-Corpo-Caloso | 0 | 12793066 | # -*- encoding: utf-8 -*-
def extract_feature_pixel(img, mask_1, mask_0=[], mask_2=[], mask_3=[], mask_4=[], mask_5=[], dim_prof=0):
import numpy as np
#Função de leitura da imagem e máscaras, e retorna array de pixel como atributo
n = img.shape[dim_prof]
t1 = img[mask_1].size/n
t0 = img[mask_0].... | 2.9375 | 3 |
schools/urls.py | suhailvs/stackschools | 0 | 12793067 | from django.urls import include, path, re_path
from . import views as school_views
from django.views.generic import TemplateView
app_name = 'schools'
urlpatterns = [
# if blank show districts(Thissur, palakkad...)
# path('', school_views.states, name='states'),
# if digit, view school information
re_path(r'^(?P<c... | 2.1875 | 2 |
cloudbio/deploy/plugins/galaxy.py | glebkuznetsov/cloudbiolinux | 122 | 12793068 | from cloudbio.galaxy.tools import _install_application
def install_tool(options):
version = options.get("galaxy_tool_version")
name = options.get("galaxy_tool_name")
install_dir = options.get("galaxy_tool_dir", None)
_install_application(name, version, tool_install_dir=install_dir)
configure_actions... | 1.609375 | 2 |
cli/core/path.py | morajlab/mjw-cli | 0 | 12793069 | import os
def getRootPath():
return os.path.abspath(os.path.join(os.path.dirname(__file__), "..", ".."))
def getProjectAbsPath(*path):
return os.path.join(getRootPath(), *path)
def getCachePath(*path):
return getProjectAbsPath(".cache", *path)
def getTemplatePath(*path):
return getProjectAbsPath... | 2.265625 | 2 |
django_cte/__init__.py | arogazinsky/django-more | 32 | 12793070 |
from importlib import reload, import_module
# Project imports
from patchy import patchy
default_app_config = 'django_cte.apps.DjangoCTEConfig'
def patch_cte():
""" Apply CTE monkey patches to Django.
At present these patches must be updated manually to conform with new CTE
implementations, but... | 2.34375 | 2 |
BlenderAddon/PhotonBlend/psdl/cmd.py | jasonoscar88/Photon-v2 | 88 | 12793071 | <reponame>jasonoscar88/Photon-v2
from . import cmd_base
from abc import abstractmethod
class WorldCommand(cmd_base.SdlCommand):
def __init__(self):
super(WorldCommand, self).__init__()
self.__clauses = {}
self.__data_name = ""
@abstractmethod
def get_type_category(self):
pass
@abstractmethod
def ge... | 2.5 | 2 |
python-flask/mymodel.py | jirramounikapriyanka/sample-android-python-ml-app | 0 | 12793072 | <reponame>jirramounikapriyanka/sample-android-python-ml-app<gh_stars>0
import pandas as pd
import pickle
from sklearn.ensemble import RandomForestClassifier
from sklearn.linear_model import SGDClassifier
from sklearn.metrics import confusion_matrix, classification_report
from sklearn.preprocessing import StandardS... | 2.640625 | 3 |
antlir/bzl/constants.bzl | facebookincubator/fs_image | 9 | 12793073 | <reponame>facebookincubator/fs_image
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
# This combines configurable build-time constants (documented on REPO_CFG
# below), and non-configurabl... | 1.171875 | 1 |
btstock/db/db_mysql.py | huangxl-github/base-tushare-stock | 5 | 12793074 | <reponame>huangxl-github/base-tushare-stock<filename>btstock/db/db_mysql.py<gh_stars>1-10
#!/usr/bin/python
#-*- coding: UTF-8 -*-
import os
from dbutils.pooled_db import PooledDB
import pymysql
class Mysql(object):
'Mysql element'
def __init__(self):
self.mysql_host = '127.0.0.1'
self.user = 'root'
self.passw... | 2.546875 | 3 |
test/sesqlite/avc/test.py | unibg-seclab/sesqlite | 10 | 12793075 | #!/usr/bin/env python
from subprocess import check_output
import numpy as np
from sys import argv
def get_output(command):
return map(int, check_output(command.split()).split())
tests = argv[1] if len(argv) > 1 else 1000
avc_first = get_output("./avctest/avctest %s 1" % tests)
avc_other = get_output("./avctest/... | 2.53125 | 3 |
strategies/tools.py | logpy/strategies | 13 | 12793076 | <reponame>logpy/strategies
from __future__ import print_function, division
from .core import do_one, exhaust, switch
def typed(ruletypes):
"""Apply rules based on the expression type
inputs:
ruletypes -- a dict mapping {Type: rule}
"""
return switch(type, ruletypes)
| 2.609375 | 3 |
app/pythonBackend/algorithm.py | russianambassador/durhack_team-repository | 4 | 12793077 | # Imports pickle library used to store trained model
import pickle
# Open trained model and assigned to variable
with open('property_model_Bristle.pickle', 'rb') as file:
lr = pickle.load(file)
# Predict price based on console input, use for debugging
input_distance = float(input("Please enter the distance to the... | 3.8125 | 4 |
src/offline/aws/awsscraper.py | vlab-cs-ucsb/quacky | 1 | 12793078 | # scrapes AWS resource type and action mapping from AWS docs
import json
import time
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.chrome.options... | 2.59375 | 3 |
11_Sock_Merchant.py | waditya/HackerRank_Algorithms_Implementation_Challenges | 0 | 12793079 | #!/bin/python3
#Import Libraries
import sys
def sockMerchant(n, ar):
##Sort the array
ar.sort()
br = ar
br = list(set(br))
##print(br)
no_of_pairs = 0
counter = 0
##Declare and initialize variables
for i in range(0, len(br), 1):
for j in range(0, len(ar), 1):
... | 3.796875 | 4 |
tests/util/test_requirements.py | pomes/valiant | 2 | 12793080 | <gh_stars>1-10
"""Test for valiant.util.requirements.
Copyright 2021 The Valiant Authors
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
https://www.apache.org/licenses/LICENSE-2.0
Unless re... | 1.921875 | 2 |
plot_error.py | h0uter/Sphero_SLAM_simulation | 0 | 12793081 | <filename>plot_error.py
import plotly.plotly as py
import plotly.graph_objs as go
# plotly
# import plotly
# plotly.tools.set_credentials_file(
# username='houterm', api_key='putYaOwnKey')
def plot(sphero, step_count):
if step_count == 40000:
# if step_count == 1000:
x_error_behaviour = go.Scatter... | 2.421875 | 2 |
tests/test_mc_flow_sim.py | sthagen/python-mc_flow_sim | 1 | 12793082 | # -*- coding: utf-8 -*-
# pylint: disable=missing-docstring,unused-import,reimported
import pytest # type: ignore
import mc_flow_sim.mc_flow_sim as mc
def test_walk_ok_empty_string():
empty = ''
assert mc.walk(empty) is None
def test_walk_ok_empty_list():
seq = []
assert mc.walk(seq) is None
def... | 2.46875 | 2 |
pygame_camera_module.py | Pjchardt/camera_node | 0 | 12793083 | <gh_stars>0
#simple class to grab webcam frames using pygame camera
import os
import pygame
import pygame.camera
class PygameCameraModule(object):
#def __init__(self):
def start(self):
pygame.camera.init()
cameras = pygame.camera.list_cameras() #Camera detected or not
print(cameras)
... | 3.0625 | 3 |
AppDB/cassandra/start_cassandra.py | eabyshev/appscale | 2 | 12793084 | """ A test script to start Cassandra. """
import logging
import os
import sys
import cassandra_interface
sys.path.append(os.path.join(os.path.dirname(__file__), "../../lib"))
import monit_interface
def run():
""" Starts up cassandra. """
logging.warning("Starting Cassandra.")
monit_interface.start(cassandra... | 2.3125 | 2 |
models/python_cli/commands.py | andrei-papou/horn | 2 | 12793085 | <reponame>andrei-papou/horn<filename>models/python_cli/commands.py
import os
from time import time
from typing import List, Type
from horn import save_model, save_tensor
from common import Args, SubParsers, get_model_file_path, get_data_file_path, get_model, ModelSpec
from models import model_specs
def _extract_mod... | 2.390625 | 2 |
release/stubs.min/Wms/RemotingImplementation/__init__.py | tranconbv/ironpython-stubs | 0 | 12793086 | # encoding: utf-8
# module Wms.RemotingImplementation calls itself RemotingImplementation
# from Wms.RemotingImplementation,Version=1.23.1.0,Culture=neutral,PublicKeyToken=<PASSWORD>
# by generator 1.145
# no doc
# no important
from System.Collections.Generic import *
from ..__init__ import *
# no functions
... | 1.789063 | 2 |
q4.py | cs-fullstack-2019-fall/codeassessment2-Deltonjr2 | 0 | 12793087 | <filename>q4.py<gh_stars>0
# ### Problem 4
# Write a program that allows users to compare words by their length. Implement a function called chk_strings that accepts 2 strings entered by the user and compares them by length
# The function should return true if the first string parameter has more characters (i.e. longer... | 4.03125 | 4 |
502/modes.py | kaixiang1992/python-flask | 0 | 12793088 | from sqlalchemy import create_engine, Column, Integer, String, DATETIME
from sqlalchemy.ext.declarative import declarative_base
from datetime import datetime
# TODO: db_uri
# dialect+driver://username:password@host:port/database?charset=utf8
DB_URI = 'mysql+pymysql://root:root123@127.0.0.1:3300/alembic_demo?charset=ut... | 2.953125 | 3 |
001_Snake Game/snake.py | Guilhermeasper/Tutoriais | 0 | 12793089 | <gh_stars>0
''' A biblioteca pygame é importada,
juntamente do modulo locals dela, além
disso o metodo randrange que usaremos
para gerar numeros aleatórios para as
posições da cobra e maçã '''
import pygame
import pygame.locals
from random import randrange
print("Módulos importados com sucesso")
''' Ut... | 3.0625 | 3 |
main.py | mangoprojectfactory/Bank-System | 0 | 12793090 | <filename>main.py
class bank:
def __init__(self):
self.accountDict = {}
def inputCheck(self, email, password):
if email not in self.accountDict:
return 'EmailNotFound'
if self.accountDict[email]['password'] != password:
return 'PasswrodError'
return N... | 3.734375 | 4 |
python_modules/dagster/dagster/core/definitions/mode.py | atsuhiro/dagster | 0 | 12793091 | <reponame>atsuhiro/dagster<filename>python_modules/dagster/dagster/core/definitions/mode.py
from dagster import check
from dagster.loggers import default_loggers
from .logger import LoggerDefinition
from .resource import ResourceDefinition
DEFAULT_MODE_NAME = 'default'
class ModeDefinition:
'''Defines a "mode"... | 2.375 | 2 |
56-Page-Scraper/main.py | PawelZabinski/ocr-code-challenges-files | 0 | 12793092 | import requests
import json
import ehp
# Page Scraper
# Have the programme connect to a site and pulls out all the links, or images, and save them to a list.
class PageScraper:
def __init__(self, url):
self.url = url
self.parser = ehp.Html()
self.dom = self.__dom()
def __dom(self):
req = request... | 3.375 | 3 |
fnss/adapters/__init__.py | brucespang/fnss | 114 | 12793093 | """Tools for exporting and importing FNSS data structures (topologies,
event schedules and traffic matrices) to/from other simulators or emulators
"""
from fnss.adapters.autonetkit import *
from fnss.adapters.mn import *
from fnss.adapters.ns2 import *
from fnss.adapters.omnetpp import *
from fnss.adapters.jfed import ... | 1.054688 | 1 |
examples/asyncio/basic.py | bowlofeggs/sqlalchemy | 0 | 12793094 | """Illustrates the asyncio engine / connection interface.
In this example, we have an async engine created by
:func:`_engine.create_async_engine`. We then use it using await
within a coroutine.
"""
import asyncio
from sqlalchemy import Column
from sqlalchemy import Integer
from sqlalchemy import MetaData
from sq... | 3.671875 | 4 |
scripts/generate_pkgbuild.py | zivid/arch-linux-pkgbuild-generator | 1 | 12793095 | <reponame>zivid/arch-linux-pkgbuild-generator<filename>scripts/generate_pkgbuild.py
from pathlib import Path
import hashlib
import argparse
import requests
def _sha256sum(url):
request = requests.get(url, stream=True)
sha256 = hashlib.sha256()
print(f"Calculating sha265sum of {url}", end="", flush=True)
... | 2.390625 | 2 |
definition.py | SensorDX/rainqc | 1 | 12793096 | # Root dir
import os
ROOT_DIR = os.path.dirname(os.path.abspath(__file__))
# Weather variable vocublary. This should match to the variable name used in the tahmoapi.
RAIN = "precipitation"
TEMP = "temperature"
REL = "humidity"
WINDR= "winddirection"
SRAD = "radiation"
| 2.21875 | 2 |
molo/core/migrations/0018_remove_wagtail_forms.py | Ishma59/molo | 25 | 12793097 | # -*- coding: utf-8 -*-
# Generated by Django 1.11.18 on 2019-07-23 19:11
from __future__ import unicode_literals
from django.db import migrations
import molo.core.blocks
import molo.core.models
import wagtail.core.blocks
import wagtail.core.fields
import wagtail.images.blocks
class Migration(migrations.Migration):
... | 1.585938 | 2 |
apis_server/test/test_models_controller.py | ilyde-platform/ilyde-apis | 0 | 12793098 | # coding: utf-8
#
# Copyright (c) 2020-2021 Hopenly srl.
#
# This file is part of Ilyde.
#
# 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
#
#... | 2.21875 | 2 |
oarepo_fsm/errors.py | oarepo/oarepo-fsm | 0 | 12793099 | <filename>oarepo_fsm/errors.py<gh_stars>0
#
# Copyright (C) 2020 CESNET.
#
# oarepo-fsm is free software; you can redistribute it and/or modify it under
# the terms of the MIT License; see LICENSE file for more details.
"""OArepo FSM library for record state transitions."""
import json
from flask_login import current... | 1.90625 | 2 |
flash/build.py | mikeal/windmill | 2 | 12793100 | <gh_stars>1-10
#!/usr/bin/env python
import optparse
import os
import re
import shutil
# Location of compiler
MXMLC_PATH = 'mxmlc -debug -verbose-stacktraces -incremental=true -compiler.strict -compiler.show-actionscript-warnings'
# For replacing .as with .swf
as_re = re.compile('\.as$|\.mxml$')
def windmill():
... | 2.46875 | 2 |
Mathematics/106bombyx/usage.py | 667MARTIN/Epitech | 40 | 12793101 | <filename>Mathematics/106bombyx/usage.py
#!/usr/bin/python
# -*- coding: utf-8 -*-
## usage.py for usage in /home/rodrig_1/rendu/Maths/103architecte
##
## Made by <NAME>
## Login <<EMAIL>>
##
## Started on Sun Dec 7 16:31:56 2014 <NAME>
## Last update Sun Feb 22 18:32:16 2015 <NAME>
##
print "Usage: ./106bombyx k(... | 1.9375 | 2 |
bomradarloop/__init__.py | kuchel77/bomradarloop | 0 | 12793102 | import datetime as dt
import io
import logging
import os
import time
import PIL.Image
import requests
RADARS = {
'Adelaide': {'id': '643', 'delta': 360, 'frames': 6},
'Albany': {'id': '313', 'delta': 600, 'frames': 4},
'AliceSprings': {'id': '253', 'delta': 600, 'frames': 4},
'Bairn... | 2.015625 | 2 |
guess_game/main.py | devvspaces/python_projects | 0 | 12793103 | from utils import user_game, comp_game
def play(func):
try:
print(func())
except ValueError:
# If there was a value error, the function will be called again
print('\n Try Again')
return play(func)
except KeyboardInterrupt:
# When ctrl + c is used, end the game, instead of showing errors
print('Game ... | 3.8125 | 4 |
I Coding Dojo/Solution/test_dojo.py | ComputerSocietyIFB/Dojo | 0 | 12793104 | from dojo import *
def test_valid_input():
assert entrada_valida(1) == False
assert entrada_valida('ABCDEF GHI') == True
assert entrada_valida('') == False
def test_get_indice():
assert get_indice('A') == 0
assert get_indice(' ') == 8
assert get_indice('J') == 3
def test_converte():
assert converte('PUZZLES'... | 2.671875 | 3 |
software/witnesses.py | aM3z/primality-testing | 1 | 12793105 | <gh_stars>1-10
import primality
def miller_rabin(n):
witnesses, nonwitnesses = list(), list()
for a in range(1, n):
res = primality.miller_rabin(n=n, a=a)
if res == "composite":
witnesses.append(a)
else:
nonwitnesses.append(a)
print(str(len(witnesses)) + " w... | 3.1875 | 3 |
ogr2osm/osm_data.py | HSLdevcom/ogr2osm | 0 | 12793106 | # -*- coding: utf-8 -*-
# Copyright (c) 2012-2021 <NAME>, <NAME> <<EMAIL>>,
# <NAME> <<EMAIL>>, The University of Vermont
# <<EMAIL>>, github contributors
# Released under the MIT license, as given in the file LICENSE, which must
# accompany any distribution of this code.
import logging
from osgeo import ogr
from os... | 2.59375 | 3 |
smoothfdr/smoothed_fdr.py | tansey/smoothfdr | 6 | 12793107 | <gh_stars>1-10
import itertools
import numpy as np
from scipy import sparse
from scipy.stats import norm
from scipy.optimize import minimize, minimize_scalar
from scipy.sparse import csc_matrix, linalg as sla
from functools import partial
from collections import deque
from pygfl.solver import TrailSolver
class Gaussia... | 2.1875 | 2 |
models/model.py | Jungyhuk/plotcoder | 10 | 12793108 | <reponame>Jungyhuk/plotcoder
import torch
import torch.nn as nn
from torch.autograd import Variable
from torch import cuda
import torch.optim as optim
from torch.nn.utils import clip_grad_norm
import torch.nn.functional as F
import numpy as np
from .data_utils import data_utils
from .modules import mlp
class PlotCode... | 2.125 | 2 |
src/ribo_api/models/user_activity_log.py | RinPham/RiBo-Core | 0 | 12793109 | import json
from django.db import models
from django.conf import settings
from django.utils.translation import ugettext_lazy as _
from django.utils import timezone
from ribo_api.models.usertypes import TinyIntegerField
from .usertypes import NormalTextField
class UserActivityLog(models.Model):
id = models.AutoFi... | 2.03125 | 2 |
app.py | jimzers/annotate-mock | 0 | 12793110 | <reponame>jimzers/annotate-mock
from flask import Flask
from flask_sqlalchemy import SQLAlchemy
app = Flask(__name__)
app.config['SQLALCHEMY_DATABASE_URI'] = 'mysql+pymysql://root:pAASSSJFLFDSDF@localhost/annotate_mock_db'
app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False
db = SQLAlchemy(app)
class User(db.Model)... | 2.8125 | 3 |
src/day6/day6_part1.py | LotusEcho/AdventOfCode2018 | 0 | 12793111 | import os
import re
from collections import defaultdict
input_file = open(os.path.join(os.path.dirname(__file__), 'day6_input.txt'), 'r')
min_x = -1
min_y = -1
max_x = -1
max_y = -1
points = []
for line in input_file:
matcher = re.match("(\d+),\s(\d+)", line)
if matcher is not None:
y = int(matcher.gr... | 3.203125 | 3 |
exercises/CursoemVideo/ex104.py | arthurguerra/cursoemvideo-python | 0 | 12793112 | def leiaInt(num):
while True:
teste = input(num)
if teste.isnumeric():
teste = int(teste)
return teste
break
else:
print('\033[0;31mERRO! digite um número inteiro válido.\033[m')
# PROGRAMA PRINCIPAL
n = leiaInt('Digite umm número: ')
print(f... | 3.875 | 4 |
booking_app/views.py | alikhalilica/cilinic-temp | 0 | 12793113 | <filename>booking_app/views.py
from django.http import HttpResponse,HttpResponseRedirect
from . models import HelthDepartment , Patient
from . forms import PatientForm
from django.shortcuts import render,redirect,get_object_or_404
#import requests
# Create your views here.
# Retrieve
def index(request):
#categor... | 2.28125 | 2 |
phrasebook/views/general.py | DanCatchpole/phrasebook-django | 1 | 12793114 | <filename>phrasebook/views/general.py<gh_stars>1-10
from django.contrib.auth.decorators import login_required
from django.http import JsonResponse
from django.shortcuts import render, redirect
from django.utils.decorators import decorator_from_middleware
from phrasebook.contexts import get_sidebar_args
from phrasebook... | 2.109375 | 2 |
ventanas_clases/bienvenidos.py | SilviaSanjose/Music_Project_DB_PyQt5 | 0 | 12793115 | <filename>ventanas_clases/bienvenidos.py
from ventanas.ventana_bienvenida import Ui_music_window
from PyQt5.Qt import QTime, QDate
class VentanaMusical(Ui_music_window):
def __init__(self, my_win, registro, listado, tabla, usuarios):
self.registro = registro
self.listado = listado
... | 2.5 | 2 |
qtgallery/qtscraper.py | ixjlyons/qtgallery | 0 | 12793116 | <filename>qtgallery/qtscraper.py
from sphinx_gallery import scrapers
from qtpy.QtWidgets import QApplication
__all__ = ['qtscraper', 'reset_qapp']
def qtscraper(block, block_vars, gallery_conf):
"""Basic implementation of a Qt window scraper.
Looks for any non-hidden windows in the current application insta... | 2.390625 | 2 |
dimred/models/auto/trainer.py | kulkarnisp/dim-red | 1 | 12793117 | <filename>dimred/models/auto/trainer.py
import numpy as np
import matplotlib.pyplot as plt
import torch
from torch import nn
from torch.autograd import Variable
# from model import AutoEncoder
from utils import rolling_window
class Trainer():
def __init__(self,netr,x=None,time_window=10, lr=0.01):
sel... | 2.640625 | 3 |
news/api.py | nicbou/markdown-notes | 121 | 12793118 | <reponame>nicbou/markdown-notes
from django.conf.urls import url
from django.http import HttpResponse
from tastypie.authentication import ApiKeyAuthentication
from tastypie.authorization import Authorization
from tastypie.http import HttpForbidden
from tastypie.resources import ModelResource
from news.models import Ne... | 2.5 | 2 |
SHIMON/api/api_calls.py | dosisod/SHIMON | 0 | 12793119 | <filename>SHIMON/api/api_calls.py<gh_stars>0
from SHIMON.api.external import api_recent, api_friends, api_allfor
from SHIMON.api.error import error, error_200, error_202, error_400
from SHIMON.api.unlock import ApiUnlock
from SHIMON.api.send_msg import ApiSendMsg
from SHIMON.api.delete_msg import ApiDeleteMsg
from SHIM... | 1.265625 | 1 |
tests/r/test_sparrows.py | hajime9652/observations | 199 | 12793120 | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import shutil
import sys
import tempfile
from observations.r.sparrows import sparrows
def test_sparrows():
"""Test module sparrows.py by downloading
sparrows.csv and testing shape of
extracted data h... | 2.40625 | 2 |
utils/admin.py | drx/archfinch | 1 | 12793121 | <gh_stars>1-10
from django.contrib import admin
def raw_id_fields_admin(*args):
fields = args
class cls(admin.ModelAdmin):
raw_id_fields = fields
return cls
| 1.90625 | 2 |
w3copentracing/text_propagator.py | eyjohn/w3copentracing-python | 0 | 12793122 | <filename>w3copentracing/text_propagator.py
from opentracing import SpanContextCorruptedException
from .context import SpanContext
class InvalidSpanContextException(Exception):
"""InvalidSpanContextException is used when the provided span context
instance does is not a W3C span context."""
pass
class ... | 2.203125 | 2 |
yyxutils/__init__.py | yanyuxiangToday/yyxutils | 0 | 12793123 | <reponame>yanyuxiangToday/yyxutils
# -*- coding: utf-8 -*-
'''
@Time : 2021/08/08
@Author : Yanyuxiang
@Email : <EMAIL>
@FileName: __init__.py
@Software: PyCharm
'''
from . import list
from . import video
from . import file
from .utils import *
| 1.078125 | 1 |
autonetkit/design/validation/validation.py | ZhiHaoi/autonetkit | 91 | 12793124 | <filename>autonetkit/design/validation/validation.py
import logging
from autonetkit.design.utils import filters
from autonetkit.design.utils.graph_utils import connected_components
from autonetkit.network_model.topology import Topology
from autonetkit.network_model.types import DeviceType
logger = logging.getLogger(_... | 2.578125 | 3 |
tests/data/sample/__init__.py | SD2E/python-datacatalog | 0 | 12793125 | CREATES = [
('expt1', {'sample_id': 'biofab.sample.900000', 'child_of': ['102edd93-29d6-5483-b60b-8dfd4d094b9c']}, '103dfcc6-7dd8-54a1-b5d7-c36129511173'),
('expt2', {'sample_id': 'ginkgo.sample.ABCDEFG', 'child_of': ['102d8a08-034d-5c27-8d9c-a24bfcc94858']}, '1031e39a-ac24-57b6-8fb3-b8fb65708654'),
('expt3... | 1.078125 | 1 |
scripts/lessons/Lesson11.py | njfritter/ml-mastery | 7 | 12793126 | #!/usr/bin/env python3
###################################
# Mastering ML Python Mini Course
#
# Inspired by the project here:
#
# https://s3.amazonaws.com/MLMastery/machine_learning_mastery_with_python_mini_course.pdf?__s=mxhvphowryg2sfmzus2q
#
# By <NAME>
#
# Project will soon be found at:
#
# https://www.inertia7... | 2.96875 | 3 |
legacy/regenesis/soap.py | crijke/regenesis | 16 | 12793127 |
from threading import local
from suds.client import *
from suds import *
import config
from mongo import cache_result, load_cached, EMPTY
from util import serialize_soap
def get_test_service():
d = local()
if d.__dict__.get('test') is None:
d.__dict__['test'] = Client(config.get('test_service'))
... | 2.125 | 2 |
pylimit/tests/test_pylimit.py | biplap-sarkar/pylim | 17 | 12793128 | <gh_stars>10-100
from pylimit import PyRateLimit
from pylimit import PyRateLimitException
import unittest
import time
class TestPyLimit(unittest.TestCase):
def test_exception(self):
limit = PyRateLimit(period=10, limit=10)
self.assertRaises(PyRateLimitException, limit.attempt,
... | 2.453125 | 2 |
src/wagtail_marketing/helpers.py | mikiec84/wagtail-marketing-addons | 0 | 12793129 | <filename>src/wagtail_marketing/helpers.py
from django.template.defaultfilters import truncatechars
from wagtail.contrib.modeladmin.helpers import PageAdminURLHelper as AbstractPageAdminURLHelper
from wagtail_marketing.conf import get_wagtail_marketing_setting
class PageAdminURLHelper(AbstractPageAdminURLHelper):
... | 2.109375 | 2 |
src/metric_helpers.py | florianvonunold/DYME | 5 | 12793130 | <filename>src/metric_helpers.py
import numpy as np
def cosine_similarity(a, b):
return np.sum(a * b, axis=1) / np.sqrt((np.sum(a * a, axis=1) * np.sum(b * b, axis=1)))
def _get_emojis():
# All emojis in the order returned by deepmoji
EMOJIS = ":joy: :unamused: :weary: :sob: :heart_eyes: :pensive: " + \
... | 2.859375 | 3 |
Algorithm/BasicAlgorithm/ArrayAndSort/select_sort.py | hqzhang83/Everything101 | 0 | 12793131 | def selectSort(nums):
l = len(nums)
for i in range(l):
for j in range(i + 1, l):
if nums[j] < nums[i]:
nums[i], nums[j] = nums[j], nums[i]
return nums
| 3.65625 | 4 |
valid_braces.py | guesschess/wars | 0 | 12793132 |
def validBraces(string):
braces = ["(",")","{","}","[","]"]
labels = [0,1,3,4,7,8]
dic = dict(zip(braces, labels))
valid = True
for key, value in dic.iteritems():
string = string.replace(key, str(value))
nums = [int(i) for i in string]
n = len(nums)# the length of the string
for... | 3.53125 | 4 |
Chapter14/milk.py | tongni1975/Hands-On-Machine-Learning-on-Google-Cloud-Platform | 11 | 12793133 | <gh_stars>10-100
import pandas as pd
import matplotlib.pyplot as plt
import numpy
from sklearn.linear_model import LinearRegression
from statsmodels.tsa.seasonal import seasonal_decompose
data = pd.read_csv('milk-production-pounds.csv',parse_dates=True, index_col='DateTime',
... | 2.96875 | 3 |
setup.py | afcarl/tensorcv | 1 | 12793134 | <reponame>afcarl/tensorcv<gh_stars>1-10
from distutils.core import setup
setup(
name='tensorcv',
version=0.1,
packages=['tensorcv'],
entry_points="""
[console_scripts]
tcv=tensorcv:cli
"""
)
| 1.273438 | 1 |
hdbo/exceptions.py | eric-vader/HD-BO-Additive-Models | 5 | 12793135 | # For BO early Termination
class EarlyTerminationException(Exception):
def __init__(self, message, metrics):
# Call the base class constructor with the parameters it needs
super(EarlyTerminationException, self).__init__(message)
self.metrics = metrics | 2.6875 | 3 |
038. Count and Say.py | 95subodh/Leetcode | 2 | 12793136 | #The count-and-say sequence is the sequence of integers beginning as follows:
#1, 11, 21, 1211, 111221, ...
#
#1 is read off as "one 1" or 11.
#11 is read off as "two 1s" or 21.
#21 is read off as "one 2, then one 1" or 1211.
#Given an integer n, generate the nth sequence.
class Solution(object):
def countAndSay(se... | 3.78125 | 4 |
CodeIA/venv/Lib/site-packages/coremltools/converters/mil/mil/ops/defs/random.py | Finasty-lab/IA-Python | 11,356 | 12793137 | # Copyright (c) 2020, Apple Inc. All rights reserved.
#
# Use of this source code is governed by a BSD-3-clause license that can be
# found in the LICENSE.txt file or at https://opensource.org/licenses/BSD-3-Clause
from coremltools.converters.mil.mil.types.symbolic import any_symbolic
from coremltools.converters.mi... | 1.84375 | 2 |
gimp_plugin/create_mask.py | open-dynamic-robot-initiative/trifinger_object_tracking | 6 | 12793138 | #!/usr/bin/env python
from gimpfu import *
def create_mask_from_selection(image, drawable):
# image = gimp.image_list()[0]
# drawable = pdb.gimp_image_get_active_drawable(image)
pdb.gimp_image_undo_group_start(image)
pdb.gimp_edit_bucket_fill(drawable, 1, 0, 100.0, 255.0, 0, 0.0, 0.0)
pdb.gimp_s... | 3.09375 | 3 |
solutions/Craftingtables.py | aalekhpatel07/IEEExtreme14 | 2 | 12793139 | <reponame>aalekhpatel07/IEEExtreme14
def solve(c, n, p, w):
"""
Solve the problem here.
:return: The expected output.
"""
if c > w:
return 0
leading_ps = w // p
tables = 0
zeroes_available = n - (leading_ps + 1)
if w % p == 0:
zeroes_available += 1
while zeroes... | 3.625 | 4 |
Ranking/tests/test.py | iznokill/Epit-as-Ranking | 0 | 12793140 | from Ranking.src.Ranker import Ranker, add_player
def test_update(file, update_text, expected):
res = Ranker(file, update_text)
assert res == expected, "Update failed\ngot:\n" + str(res) + "\nexpected:\n" + expected
def test_add(file, player, expected):
res = add_player(file, player)
assert res == e... | 2.640625 | 3 |
test/extract_examples.py | poponealex/files_renamer | 0 | 12793141 | <reponame>poponealex/files_renamer
from pathlib import Path
import re
import context
from src.goodies import print_warning
SECTION_PATTERN = r"""(?m)^### (.+)\n
#### Example\n
original path \| new name
---\|---
((?:.+\n)*)
#### Result\n
original path \| new path
---\|---
((?:.+\n)*)"""
def extract_rows(table):
i... | 2.84375 | 3 |
tests/test_auth_endpoint.py | ephes/django-indieweb | 9 | 12793142 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
test_django-indieweb
------------
Tests for `django-indieweb` auth endpoint.
"""
import pytz
from datetime import datetime
from datetime import timedelta
from urllib.parse import parse_qs
from urllib.parse import urlparse
from django.conf import settings
from djang... | 2.53125 | 3 |
scripts/viz/controller.py | GiorgiaAuroraAdorni/learning-relative-interactions-through-imitation | 1 | 12793143 | import numpy as np
from kinematics import to_robot_velocities
from viz.env import Viz
class ControlSignalsViz(Viz):
def __init__(self, marxbot, time_window=10):
super().__init__()
self.marxbot = marxbot
self.marxbot_max_vel = 30
self.time_window = time_window
def _show(self... | 2.515625 | 3 |
01-01. variable and constant.py | dhchoi82/mathematics-python | 3 | 12793144 | <reponame>dhchoi82/mathematics-python
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# 변수
'''
Python에서는 변수를 선언하여 사용할 수 있다.
변수 이름은 문자나 숫자로 이루어지는데,
변수 이름은 숫자나 '_' 이외의 특수문자로 시작할 수 없고,
이미 역할이 지정된 keyword는 변수 이름으로 사용할 수 없다.
'''
for a in (1, 3, 10, -2):
print('a =', a)
print('a × 3 + 1 =', a * 3 + 1, '\n')
# 상수
'''... | 3.984375 | 4 |
openapi_core/enums.py | andyceo/openapi-core | 0 | 12793145 | <gh_stars>0
from enum import Enum
class ParameterLocation(Enum):
PATH = 'path'
QUERY = 'query'
HEADER = 'header'
COOKIE = 'cookie'
@classmethod
def has_value(cls, value):
return (any(value == item.value for item in cls))
class ParameterStyle(Enum):
MATRIX = 'matrix'
LABEL ... | 2.953125 | 3 |
Session09_AWSSagemakerAndLargeScaleModelTraining/utils_cifar.py | garima-mahato/TSAI_EMLO1.0 | 0 | 12793146 | import torch
import torchvision
import torchvision.transforms as transforms
import matplotlib.pyplot as plt
import numpy as np
classes = ('beaver','dolphin','otter','seal','whale','aquarium fish','flatfish','ray','shark','trout','orchids','poppies','roses','sunflowers','tulips','bottles','bowls','cans','cups','plates'... | 2.609375 | 3 |
tests/grammpy_test/oldapi_tests/grammar_copy_tests/GrammarShallowCopyTest.py | PatrikValkovic/grammpy | 1 | 12793147 | <reponame>PatrikValkovic/grammpy<gh_stars>1-10
#!/usr/bin/env python
"""
:Author <NAME>
:Created 16.08.2017 19:16
:Licence MIT
Part of grammpy
"""
from copy import copy
from unittest import main, TestCase
from grammpy.old_api import *
class A(Nonterminal):
pass
class B(Nonterminal):
pass
class RuleAtoB... | 2.515625 | 3 |
Nduja/user_info_retriever/__init__.py | herrBez/Nduja | 2 | 12793148 | <reponame>herrBez/Nduja<gh_stars>1-10
"""This package contains the definition and implementation of the user info
retriever classes, i.e., classes that fetches from the relative APIs the
information about an account"""
| 0.964844 | 1 |
examples/ffs_config.py | textileio/pygate-gRPC | 0 | 12793149 | <filename>examples/ffs_config.py
from pygate_grpc.client import PowerGateClient
client = PowerGateClient("127.0.0.1:5002", False)
print("Creating a new FFS:")
newFfs = client.ffs.create()
tk = newFfs.token
print("Token: " + tk)
print("Using the new FFS token to request the default config:")
defaultConfig = client.ffs... | 2.421875 | 2 |
ch08/myproject_virtualenv/src/django-myproject/myproject/apps/ideas1/forms.py | PacktPublishing/Django-3-Web-Development-Cookbook | 159 | 12793150 | <reponame>PacktPublishing/Django-3-Web-Development-Cookbook
from django import forms
from django.utils.safestring import mark_safe
from django.utils.translation import ugettext_lazy as _
from django.contrib.auth import get_user_model
from crispy_forms import bootstrap, helper, layout
from mptt.forms import TreeNodeCho... | 2.015625 | 2 |