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 |
|---|---|---|---|---|---|---|
applitools/target.py | applitools/eyes.selenium.python | 11 | 12791051 | <reponame>applitools/eyes.selenium.python
from applitools.selenium.target import * # noqa
from applitools.core import logger
| 1.148438 | 1 |
main.py | gonzalofh/travelban-notification-gcloud-function | 0 | 12791052 | import base64
import os
from datastore import DataStore
from emailsender import EmailSender
sendgrid_api_key = os.environ.get('SENDGRID_EMAIL_API_KEY', 'Specified environment variable is not set.')
travel_site_url = os.environ.get('TRAVEL_SITE_URL', 'Specified environment variable is not set.')
sender = os.environ.ge... | 2.25 | 2 |
examples/ex_toolkit.py | RI-imaging/FDTD_sinogram | 0 | 12791053 | """Tools used by the examples """
import numpy as np
import os
import sys
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__))+"/../meep_tomo")
from meep_tomo import extract, common
import ex_bpg
def compute_metrices(tomo_path, approx, autofocus=False):
"""Compute RMS and TV metrices for a MEEP-simulat... | 2.859375 | 3 |
Data Collection/DownloadHash.py | ahlashkari/AndroidAppStaticlyzer | 8 | 12791054 | <gh_stars>1-10
import pyandrozoo
import csv
def Download(inputfile):
# The list of hashs can be cerated using the VT_Labeling.py script
with open(inputfile) as csvfile:
readCSV = csv.reader(csvfile, delimiter=',')
apks = []
for row in readCSV:
apk = row[0]
apks.a... | 3.09375 | 3 |
src/apis/json_schemas/auth.py | beratakuzum/spam-detector-api | 3 | 12791055 |
REGISTER_SCHEMA = {
'$schema': 'http://json-schema.org/schema#',
'type': 'object',
'properties': {
'username': {
"type": "string",
'minLength': 3,
'maxLength': 100
},
'password': {
"type": "string",
'minLength': 5,
... | 1.5625 | 2 |
model.py | jasonjimnz/dondelotiro-api | 2 | 12791056 | <reponame>jasonjimnz/dondelotiro-api
import json
import csv
from neo4j.v1 import GraphDatabase
from neo4j.v1 import basic_auth
from bs4 import BeautifulSoup
from config import GRAPH_DATABASE as gdb
graph_driver = GraphDatabase.driver(
'bolt://%s:%s' % (
gdb['host'],
gdb['port']
), auth=basic_a... | 2.71875 | 3 |
boadata/core/data_object.py | janpipek/boadata | 2 | 12791057 | <filename>boadata/core/data_object.py
from __future__ import annotations
import weakref
from collections import OrderedDict
from typing import TYPE_CHECKING, Final
import blinker
import numexpr as ne
import numpy as np
from boadata.core.data_conversion import ConversionUnknown, DataConversion
if TYPE_CHECKING:
... | 2.46875 | 2 |
python/veles/tests/data/test_repack.py | pombredanne/veles | 918 | 12791058 | <reponame>pombredanne/veles<gh_stars>100-1000
# Copyright 2017 CodiLime
#
# 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 a... | 2.171875 | 2 |
docs/source/pyplots/loglog.py | zangobot/secml | 63 | 12791059 | from secml.array import CArray
from secml.figure import CFigure
fig = CFigure(fontsize=14)
fig.title('loglog base 4 on x')
t = CArray.arange(0.01, 20.0, 0.01)
fig.sp.loglog(t, 20 * (-t / 10.0).exp(), basex=2)
fig.sp.grid()
fig.show()
| 2.15625 | 2 |
pyradiosky/spherical_coords_transforms.py | samirchoudhuri/pyradiosky | 8 | 12791060 | <gh_stars>1-10
# -*- mode: python; coding: utf-8 -*
# Copyright (c) 2019 Radio Astronomy Software Group
# Licensed under the 3-clause BSD License
"""Methods for doing spherical coordinate transformations on vectors."""
import numpy as np
def r_hat(theta, phi):
"""
Get the r hat unit vectors in cartesian coor... | 3.578125 | 4 |
server.py | chvia223/python-networking | 0 | 12791061 | from gettext import find
import socket
import threading
import spotipy
from spotipy.oauth2 import SpotifyOAuth
HEADER = 64
PORT = 5050
SERVER = socket.gethostbyname(socket.gethostname())
ADDR = (SERVER, PORT)
FORMAT = 'utf-8'
DISCONNECT_MESSAGE = "!DISCONNECT"
server = socket.socket(socket.AF_INET, socket.SOCK_STREAM... | 3.109375 | 3 |
nome/npm_command.py | joaopalmeiro/nome | 0 | 12791062 | from http import HTTPStatus
import requests
from cleo import Command
from clikit.api.io import flags
from .constants import (
AVAILABLE_MSG,
HTTP_STATUS_CODE_MSG,
NOT_AVAILABLE_MSG,
NPM_BASE_URL,
)
class NpmCommand(Command):
"""
Check the availability of a package name in npm
npm
... | 2.5625 | 3 |
pyboto3/cloudwatchevents.py | gehad-shaat/pyboto3 | 91 | 12791063 | <reponame>gehad-shaat/pyboto3
'''
The MIT License (MIT)
Copyright (c) 2016 WavyCloud
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
... | 1.921875 | 2 |
service-configs/zabbix/partitioning/zabbix-partitioning.py | digideskio/adminscripts | 110 | 12791064 | <gh_stars>100-1000
#!/usr/bin/python
import psycopg2
from optparse import OptionParser
tables = {
'history':'daily',
'history_sync':'daily',
'history_uint':'daily',
'history_uint_sync':'daily',
'history_str':'daily',
'history_str_sync':'daily',
'history_log':'daily',
'history_text':'daily',
'trend... | 2.15625 | 2 |
aws_cost_explorer_converter/command_line.py | wilbur4321/aws-cost-explorer-converter | 0 | 12791065 | import boto3
import argparse
import json
from datetime import timedelta, date
from pprint import pprint
import aws_cost_explorer_converter
def parse_args():
parser = argparse.ArgumentParser(
description='Fetch cost explorer data from AWS and display and/or save it',
usage='%(prog)s [option... | 2.9375 | 3 |
neutron/objects/base.py | BobzhouCH/neutron-nfv-acc | 0 | 12791066 | # 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, software
# d... | 1.890625 | 2 |
setup.py | OLC-LOC-Bioinformatics/AzureStorage | 0 | 12791067 | #!/usr/bin/env python
from setuptools import setup, find_packages
setup(
name="AzureStorage",
version="0.0.2",
entry_points={
'console_scripts': [
'AzureCredentials = azure_storage.azure_credentials:cli',
'AzureAutomate = azure_storage.azure_automate:cli',
... | 1.195313 | 1 |
base/urls/order_urls.py | vishnu-sagubandi/LIAVYS_BACKEND | 0 | 12791068 | from django.urls import path
from base.views.order_views import *
urlpatterns = [
path('', getOrders, name='orders'),
path('add/', addOrderItems, name='orders-add'),
path('gettoken/', getTokenView, name='get-client-token'),
path('myorders/', getMyOrders, name='myorders'),
path('<str:pk>/', getOrder... | 1.796875 | 2 |
tests/test_workflow.py | asavpatel92/argo-python-dsl | 0 | 12791069 | import flexmock
import pytest
import requests
from argo.workflows.dsl import Workflow
from ._base import TestCase
"""Workflow test suite."""
@pytest.fixture # type: ignore
def url() -> str:
"""Fake URL fixture."""
class TestWorkflow(TestCase):
"""Test Workflow."""
_WORKFLOW_FILE = TestCase.DATA / "... | 2.40625 | 2 |
tests/tests/app_tests.py | centergy/flex_ussd | 0 | 12791070 | <reponame>centergy/flex_ussd
import pytest
from flex.ussd.core import UssdApp
xfail = pytest.mark.xfail
parametrize = pytest.mark.parametrize
# pytestmark = pytest.mark.usefixtures("db")
class AppTest(object):
def test_init(self):
app = UssdApp('test_app')
assert app.name == 'test_app'
| 2.296875 | 2 |
stacks/linkedlistnode.py | nataz77/cs-py | 0 | 12791071 | <reponame>nataz77/cs-py
class LinkedListNode:
"""Represents a linked list node"""
def __init__(self, val=None):
self.data = val
self.next = None
self.previous = None
@property
def HasNext(self) -> bool:
return self.next is not None
| 3.453125 | 3 |
DeezerIcon.py | 19po/deezer-player | 4 | 12791072 | from PyQt4 import QtGui
import webbrowser
__author__ = 'postrowski'
# -*-coding: utf-8-*-
class DeezerIcon(object):
def __init__(self, parent):
self.iconLabel = parent.iconLabel
self.timer = parent.timer
def hover_button(self):
if self.iconLabel.underMouse():
self.tim... | 3.125 | 3 |
Source/FileDataNulltest.py | apj-graham/XPS-File-Converter | 0 | 12791073 | from FileData import FileData
import pandas as pd
import numpy as np
file_data = FileData("F:\\Python Projects\\170622_MDS.txt")
print(file_data.df)
file_data.df.fillna(0)
print(file_data.df)
df = pd.DataFrame([[np.nan, 2, np.nan, 0],
[3, 4, np.nan, 1],
[np.nan, np.nan, np.nan,... | 2.921875 | 3 |
iatransfer/research/data/__init__.py | KamilPiechowiak/iatransfer | 4 | 12791074 | from .fgvc_aircraft import FGVCAircraft
from .flowers import Flowers102
from .food101 import Food101
| 0.945313 | 1 |
100-Exercises-Guanabara/Ex81-85.py | Neil-Iyer/Basic-Exercises-in-Python | 0 | 12791075 | ''' Estes exercícios fazem parte do curso de Introdução a Algoritmos, ministrado pelo prof. <NAME> e podem ser encontrados no site https://www.cursoemvideo.com/wp-content/uploads/2019/08/exercicios-algoritmos.pdf
81) Crie um programa que leia a idade de 8 pessoas e guarde-as em um vetor. No final, mostre:
... | 4.21875 | 4 |
src/olympia/versions/urls.py | dante381/addons-server | 0 | 12791076 | from django.urls import re_path
from olympia.addons.urls import ADDON_ID
from olympia.amo.views import frontend_view
from . import views
urlpatterns = [
re_path(r'^$', frontend_view, name='addons.versions'),
re_path(
r'^(?P<version_num>[^/]+)/updateinfo/$',
views.update_info,
name='a... | 1.945313 | 2 |
yukicoder/yuki087.py | knuu/competitive-programming | 1 | 12791077 | N = int(input())
def isLeap(year):
if (year % 4 == 0 and year % 100 != 0) or year % 400 == 0:
return True
else:
return False
leap400 = 0
leap400List = []
y = 0
for i in range(2015, 2415):
if isLeap(i):
y += 366
else:
y += 365
if y % 7 == 0:
leap400 += 1
l... | 3.21875 | 3 |
threeSum.py | JiJingYu/LeetCode_practice | 0 | 12791078 | <reponame>JiJingYu/LeetCode_practice<gh_stars>0
class Solution(object):
def threeSum(self, nums):
"""
:type nums: List[int]
:rtype: List[List[int]]
"""
ans = list()
nums = sorted(nums)
for i, num_0 in enumerate(nums):
if i>0 and nums[i] == nums[i-1... | 3.5625 | 4 |
hotword.py | jackoson/squeezebox-google-assistant | 0 | 12791079 | <reponame>jackoson/squeezebox-google-assistant
#!/usr/bin/env python
# Copyright (C) 2017 Google 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/L... | 2.5625 | 3 |
Text Categorisation/PreProcess.py | Bennygmate/Machine-Learning | 0 | 12791080 | <gh_stars>0
# <NAME>
import sys
import os
import glob
import sklearn.datasets
from colorama import init
from termcolor import colored
from random import sample
import random
import numpy as np
def main():
init()
# get the dataset
path = "20news-18828"
# Create new dataset for processing
cmd = "cp -... | 2.375 | 2 |
python/robomodules/__init__.py | jhol0613/pacbot2018 | 0 | 12791081 | <gh_stars>0
import os
from .server import Server
from .protoModule import ProtoModule
__path__.append(os.path.join(os.path.dirname(__file__), 'comm'))
__all__ = ['Server', 'ProtoModule']
| 1.460938 | 1 |
lib/functionality/device.py | je-c/CryptoClassifier | 0 | 12791082 | import sys, humanize, psutil, GPUtil, time, torch
import torchvision.transforms as tt
from torchvision.datasets import ImageFolder
from torch.utils.data import DataLoader
class DeviceDataLoader():
"""
DeviceDataLoader Class
----------------------
Wraps and sends a pytorch dataloader to current device
... | 2.609375 | 3 |
workflow_main/scripts/read_extractor_lite.py | a13xk13m/covidcg | 0 | 12791083 | <reponame>a13xk13m/covidcg
# coding: utf-8
"""Extract variable regions from an aligned segment, in a flexible
and SNP-tolerant manner
Modified and heavily trimmed down version of read_extractor.py (v0.1.0)
from the variant_extractor project
Author: <NAME> - Vector Engineering Team (<EMAIL>)
"""
import numpy as np
... | 2.640625 | 3 |
montapi.py | crimsonskyrem/pyNovice | 0 | 12791084 | from random import uniform
from math import hypot
n = int(input('input n:'))
m = 0
for i in range(n):
d = hypot(uniform(0,1),uniform(0,1))
if d < 1:
m+=1
print(float(m*4 /n))
| 3.25 | 3 |
test/unit/test_structures.py | mattsb42/rhodes | 1 | 12791085 | """Unit tests for ``rhodes.structures``."""
import pytest
from rhodes.structures import ContextPath, Parameters
pytestmark = [pytest.mark.local, pytest.mark.functional]
_VALID_STATIC_CONTEXT_PATHS = (
"$$",
"$$.Execution",
"$$.Execution.Id",
"$$.Execution.StartTime",
"$$.State",
"$$.State.En... | 2.640625 | 3 |
components/interface.py | thautwarm/inc_demo | 0 | 12791086 | from abc import abstractmethod
class UserParser:
@abstractmethod
def __init__(self, user):
"""
"""
@abstractmethod
def get_user_info(self):
"""
:param user:
:return: {
username: 用户名
number: 学号或工号
avatar: 头像
}
... | 3.984375 | 4 |
parsetab.py | wangxiaoying/Compiler-Project | 0 | 12791087 | <reponame>wangxiaoying/Compiler-Project
# parsetab.py
# This file is automatically generated. Do not edit.
_tabversion = '3.2'
_lr_method = 'LALR'
_lr_signature = 'q\xf5X\xfc\x8b\xfa\xfdP\xca\xd7\xc4c\xe9Bv\x05'
_lr_action_items = {'WORD':([2,3,4,5,6,7,18,],[10,10,10,10,10,10,10,]),'SPACE':([10,],[18,]),'H2':([... | 1.742188 | 2 |
.github/workflows/clang_lint/inline_comments/post_pr_review_comments.py | CarlosNihelton/WSL | 23 | 12791088 | #!/usr/bin/python3
""" Posts pull request review comments, excluding the existing ones and
the ones not affecting files modified in the current pull_request_id."""
#
# Copyright (C) 2021 Canonical Ltd
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public... | 2.546875 | 3 |
api.py | prajwalccc13/Pragmatic-Web-Framework | 0 | 12791089 | from webob import Request, Response
from parse import parse
import inspect
from requests import Session as RequestsSession
from wsgiadapter import WSGIAdapter as RequestsWSGIAdapter
import os
from jinja2 import Environment, FileSystemLoader
from whitenoise import WhiteNoise
from middleware import Middleware
from stati... | 2.21875 | 2 |
trunk/Documentacion/Memoria/trozos-codigo/codigo-9-logsources-class.py | MGautier/security-sensor | 2 | 12791090 | class LogSourcesTestCase(TestCase):
def setUp(self):
LogSources.objects.create(
Description="Firewall of gnu/linux kernel",
Type="Iptables",
Model="iptables v1.4.21",
Active=1,
Software_Class="Firewall",
Path="iptables",
)
| 1.703125 | 2 |
epcboot_gui/epcboot_gui.py | EPC-MSU/epcboot-gui | 0 | 12791091 | <gh_stars>0
"""
This .py file offers GUI for EPCboot.
It allows:
* browse firmware on PC and load it to controller
* browse key file (*.txt) and load it to controller (developer only)
* update serial and version (developer only)
"""
import argparse
import ctypes
import ntpath
import sys
import threading
im... | 2.640625 | 3 |
src/apply_cross_fade.py | maxsolomonhenry/pyphase | 0 | 12791092 | import numpy as np
def apply_cross_fade(clips, cross_fade_ms, sr):
"""Concatenate audio clips with a cross fade."""
num_clips = len(clips)
cross_fade_samples = int(np.floor(cross_fade_ms * sr / 1000))
fade_ramp = np.arange(cross_fade_samples) / cross_fade_samples
# if not is_even(cross_fade_sam... | 2.78125 | 3 |
Convolutional-Neural-Network-Python-without-machine-learning-framework/cnn.py | FrogGamesDev/Convolutional-Neural-Network-Python-without-machine-learning-framework | 1 | 12791093 | import numpy as np
import cv2
import os
from conv import *
import multiprocessing
from multiprocessing import Pool
from itertools import product
from numba import njit
from functools import partial
import math
import sklearn
from sklearn import linear_model
def load_images_from_folder(folder):
image... | 2.6875 | 3 |
HostAgent/agentSndModule.py | pupeng/hone | 5 | 12791094 | # Copyright (c) 2011-2013 <NAME>. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the COPYRIGHT file.
# agentSndModule
# Host agent send module
# send stats, hostJoin, etc to the controller
import socket
import sys
import logging
import cPickle as pickle
from u... | 2.03125 | 2 |
roda_core/monitoring/constants.py | matitalatina/roda | 0 | 12791095 | TYRE_POSITION_FRONT_LEFT = 'FL'
TYRE_POSITION_FRONT_RIGHT = 'FR'
TYRE_POSITION_REAR_LEFT = 'RL'
TYRE_POSITION_REAR_RIGHT = 'RR'
TYRE_POSITION_FRONT_LEFT_LABEL = 'Front Left'
TYRE_POSITION_FRONT_RIGHT_LABEL = 'Front Right'
TYRE_POSITION_REAR_LEFT_LABEL = 'Rear Left'
TYRE_POSITION_REAR_RIGHT_LABEL = 'Rear Right'
TYRE_P... | 1.40625 | 1 |
other/time_travel.py | SimoneABNto/My-Code-Py | 0 | 12791096 | <filename>other/time_travel.py<gh_stars>0
from datetime import datetime, timedelta
class TimeTravel:
def __init__(self):
self.now = datetime.now()
def fuck_go_back_by(self, hours=0, minutes=0):
return self.now - timedelta(hours=hours, minutes=minutes)
if __name__ == '__main__':
tt = Tim... | 3.0625 | 3 |
entrypoint.py | webmsgr/PyOneLife | 1 | 12791097 | # use after installing the client to run the client
import sys
import multiprocessing
try:
import pyOHOL
except ImportError as e:
print("Client is not installed")
raise e
def main():
multiprocessing.freeze_support()
pyOHOL.main()
if __name__ == "__main__":
main()
| 2.234375 | 2 |
Questionnaire2/Questionnaire/Api/decorators.py | riverstation/project-all | 2 | 12791098 | <reponame>riverstation/project-all
import json
from Api.utils import *
def admin_required(func):
def _wrapper(self, request, *args, **kwargs):
if request.user.is_authenticated and hasattr(request.user, 'admin'):
return func(self, request, *args, **kwargs)
else:
return not_... | 2.453125 | 2 |
airflow/migrations/versions/53bee4c621a1_create_lastdeployedtime_table.py | TriggerMail/incubator-airflow | 1 | 12791099 | #
# 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, software
# distributed under the ... | 1.515625 | 2 |
BugsApp/admin.py | safia88/BugTracker | 0 | 12791100 | from django.contrib import admin
from.models import Ticket,Customeuser
# Register your models here.
admin.site.register(Ticket)
admin.site.register(Customeuser) | 1.3125 | 1 |
start_alibaba.py | dgdell/AlibabaInternation | 0 | 12791101 | <reponame>dgdell/AlibabaInternation
# coding:utf-8
import os
import sys
from scrapy import cmdline
if __name__ == '__main__':
sys.path.append(os.path.dirname(os.path.abspath(__file__)))
cmdline.execute(['scrapy', 'crawl', 'alibaba'])
| 1.875 | 2 |
qclib/machine_learning/datasets/common.py | carstenblank/qclib | 0 | 12791102 | <reponame>carstenblank/qclib
# Copyright 2021 qclib project.
# 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 ... | 2.484375 | 2 |
tests/test_timer_dec.py | pnpnpn/timy | 300 | 12791103 | <gh_stars>100-1000
from unittest import mock
from timy import timer
from timy.settings import timy_config
@mock.patch('timy.output')
def test_timer_no_tracking(p_output):
timy_config.tracking = False
@timer()
def func():
pass
func()
p_output.assert_not_called()
@mock.patch('timy.outpu... | 2.28125 | 2 |
openprocurement/auctions/appraisal/tests/blanks/item_blanks.py | bdmbdsm/openprocurement.auctions.appraisal | 0 | 12791104 | # -*- coding: utf-8 -*-
from uuid import uuid4
from copy import deepcopy
from datetime import timedelta
from openprocurement.auctions.core.utils import calculate_business_date
from openprocurement.auctions.appraisal.models import AppraisalAuction
def check_items_listing(self):
self.app.authorization = ('Basic', ... | 2.234375 | 2 |
scrapy_proxy/spiders/run.py | cain19811028/scrapy_proxy | 0 | 12791105 | # -*- coding: utf-8 -*-
import base64
import json
import scrapy
from scrapy import Request
class ProxyList(scrapy.Spider):
name = "proxy_list"
allowed_domains = ["proxy-list.org"]
def start_requests(self):
for i in range(1, 4):
print(i)
yield Request('https://proxy-list.o... | 2.625 | 3 |
src/edit.py | PalAditya/NotePrompt | 0 | 12791106 | <gh_stars>0
import json
import colored
from colored import stylize
# from pyautogui import typewrite
def log(string, color, font="slant", figlet=False):
print(stylize(string, colored.fg(color)), end = " ")
def readtasks(task_id):
with open("tasks.json","r") as f:
tasklist = f.read()
tasklist = json.loads(task... | 2.8125 | 3 |
fractal/clib/__init__.py | pysrc/fractal | 26 | 12791107 | <gh_stars>10-100
# C 库封装
try:
from fractension import jCalc, mCalc
print("Using fractension...")
except:
import sys
import os
import ctypes
# 当前文件所处的文件夹
__curdir = os.path.split(os.path.realpath(__file__))[0]
__dll = None
if sys.platform == "win32": # Windows
if "32 bit" ... | 2.28125 | 2 |
toolbox/metrics/metrics_base.py | ML-Dashboard/ML-ToolBox | 0 | 12791108 | <filename>toolbox/metrics/metrics_base.py<gh_stars>0
from abc import ABC
from toolbox.trackable import Trackable
class Metrics(Trackable, ABC):
pass
| 1.359375 | 1 |
challenges/python-solutions/day-13.py | elifloresch/thirty-days-challenge | 0 | 12791109 | # abstract Book class is provided.
# Write just the MyBook class
from abc import ABCMeta, abstractmethod
class Book(object, metaclass=ABCMeta):
def __init__(self, title, author):
self.title = title
self.author = author
@abstractmethod
def display(self):
pass
class MyBook(Book):
... | 4.21875 | 4 |
powell_torch.py | necst/faber_biocas | 3 | 12791110 | <filename>powell_torch.py
# /******************************************
# *MIT License
# *
# *Copyright (c) [2021] [<NAME>, <NAME>, <NAME>, <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 ... | 1.609375 | 2 |
demos/json2rdf.py | houzw/knowledge-base-data | 0 | 12791111 | <gh_stars>0
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# author: houzhiwei
# time: 2018/7/11 16:37
# https://blog.csdn.net/headwind_/article/details/70234169
from pprint import pprint
import json
from rdflib import BNode, Literal, Graph, Namespace, ConjunctiveGraph, URIRef, resource
from rdflib.namespace import SKO... | 2.234375 | 2 |
test/square_matrix_multiply/test_divide_and_conquer.py | ahmadgh74/clrs | 0 | 12791112 | import unittest
import numpy as np
from src.square_matrix_multiply import square_matrix_multiply
class TestStrassenMultiply(unittest.TestCase):
def test_square_1(self):
matrix_a = np.array([[1, 3],
[7, 5]])
matrix_b = np.array([[6, 8],
[4... | 3.03125 | 3 |
setup.py | kcraley/azdevman | 0 | 12791113 | from setuptools import setup
setup(
name = 'azdevman',
version = '0.0.1',
packages = ['azdevman'],
entry_points = {
'console_scripts': [
'azdevman = azdevman.main:cli'
]
}
)
| 1 | 1 |
data-computing-giants/python-computing/src/gda/tools/database.py | zhoujiagen/giant-data-analysis | 2 | 12791114 | # -*- coding: utf-8 -*-
"""
数据库工具.
@author: zhoujiagen
Created on 03/11/2018 10:02 AM
"""
import pymysql
def connect_mysql(host='127.0.0.1',
port=3306,
user='root',
password='<PASSWORD>',
database='pci',
charset='utf8'):
""... | 2.828125 | 3 |
aleph/views/reconcile_api.py | Ueland/aleph | 0 | 12791115 | import json
import math
import logging
from pprint import pprint # noqa
from flask import Blueprint, request
from werkzeug.exceptions import BadRequest
from followthemoney import model
from followthemoney.compare import compare
from aleph.core import settings, url_for
from aleph.model import Entity
from aleph.search ... | 2.109375 | 2 |
test/test_shell.py | maxgarvey/python-ffmpeg | 0 | 12791116 | <filename>test/test_shell.py
from shell import run, join_command
def test_run_method():
return_value, output = run('echo "Hello"')
assert return_value == 0
assert output == ['Hello\n']
def test_bad_run_method():
return_value, output = run('not-a-real-binary')
assert return_value == 127
assert ... | 2.8125 | 3 |
259. 3Sum Smaller.py | rohitpatwa/leetcode | 1 | 12791117 | <filename>259. 3Sum Smaller.py
# Sort nums. Run and fix i from 1 to n-2. Run j=i+1, k=n-1. if nums[i]+nums[j]+nums[k]<target, count+= k-j, j+1; else: k-= 1.
class Solution:
def threeSumSmaller(self, nums: List[int], target: int) -> int:
nums.sort()
count = 0
for i in range(len(nums)-2):
... | 3.328125 | 3 |
transmute_core/tests/frameworks/test_flask/test_full.py | pwesthagen/transmute-core | 42 | 12791118 | <reponame>pwesthagen/transmute-core<gh_stars>10-100
import json
def test_happy_path(test_app):
r = test_app.get("/multiply?left=3&right=3")
assert json.loads(r.data.decode()) == 9
def test_headers(test_app):
r = test_app.get("/api/v1/header")
assert r.headers["x-nothing"] == "value"
def test_compl... | 2.265625 | 2 |
pyforms/terminal/Controls/ControlProgress.py | sunj1/my_pyforms | 0 | 12791119 | from pyforms.terminal.Controls.ControlBase import ControlBase
class ControlProgress(ControlBase):
_min = 0
_max = 100
def __init__(self, label = "%p%", defaultValue = 0, min = 0, max = 100, helptext=None):
self._updateSlider = True
self._min = min
self._max = max
ControlBa... | 2.859375 | 3 |
DE10.py | mipsparc/DE15 | 2 | 12791120 | <reponame>mipsparc/DE15
#coding:utf-8
import math
from Brake import BrakeStatues
# 日本国有鉄道DE10液体式ディーゼル機関車の動作を再現するライブラリ
class DE10:
def __init__(self):
# 車速(m/s)
self.speed = 0
# マスコンノッチ(0-14)
self.mascon_level = 0
# 非常ブレーキシリンダ圧力
self.BC_MAX_EB = 3.5
# 常用最大ブレー... | 2.546875 | 3 |
spherical_point_source.py | BrokenVoodooDoll/MirrorRayPath | 0 | 12791121 | import matplotlib.pyplot as plt
import numpy as np
from numpy.lib.function_base import angle
radius = 100 # curvature radius of the mirror in mm (must be positive)
angle_d = 30 # maximum angle of incidence of the incident beam in degrees
num_rays = 21 # number of rays
source_pos = 80 # source position in mm (mu... | 3.40625 | 3 |
peyotl/test/test_tokenizer.py | mtholder/peyotl | 6 | 12791122 | <filename>peyotl/test/test_tokenizer.py
#! /usr/bin/env python
from peyotl.utility.tokenizer import NewickTokenizer, NewickEvents, NewickEventFactory
from peyotl.utility.str_util import StringIO
from peyotl.utility import get_logger
import unittest
from copy import deepcopy
_LOG = get_logger(__name__)
class TestNewi... | 2.453125 | 2 |
imgprocalgs/algorithms/utilities.py | mateuszz0000/imgprocalgs | 8 | 12791123 | """ Module including utilities for main algorithms"""
from PIL import Image as PillowImage
from collections import namedtuple
ImageData = namedtuple("ImgData", 'header image')
HSV = namedtuple("HSV", 'h s v')
RGB = namedtuple("RGB", 'r g b')
class Image:
""" Wrapper for Image class for easier usage"""
def __... | 3.71875 | 4 |
d18/tokenizer.py | RuedigerLudwig/advent2020 | 2 | 12791124 | <filename>d18/tokenizer.py
import re
from typing import Optional
from common.utils import safe_get
from .token import Op, Operations, Token
class Tokenizer:
@staticmethod
def simple(line: str) -> Token:
return Simple(line).token
@staticmethod
def advanced(line: str) -> Token:
return ... | 3.0625 | 3 |
test/test_surface.py | simonpf/gprof_nn | 1 | 12791125 | """
Tests for the loading of surface maps for the GPROF-NN data processing.
"""
from datetime import datetime
import pytest
import numpy as np
from gprof_nn.data.surface import (read_land_mask,
read_autosnow,
read_emissivity_classes)
from gprof_nn.... | 2.59375 | 3 |
scripts/split_tool_yml.py | usegalaxy-no/usegalaxy-no-tools | 1 | 12791126 | #!/usr/bin/env python
import yaml
from collections import defaultdict
import re
import os
import argparse
def slugify(value):
"""
Normalizes string, converts to lowercase, removes non-alpha characters,
and converts spaces to hyphens.
"""
value = re.sub('[^\w\s-]', '', value).strip().lower()
v... | 2.953125 | 3 |
tests/test_pod.py | RecursionSpace/OpenPod | 1 | 12791127 | ''' Unit test for pod.py '''
import sys
# import unittest
sys.path.insert(0, "openpod/")
# import hub
# class TestHub(unittest.TestCase):
# '''
# General tests for the hub.py file
# '''
# def test_xbee_flag_set_true(self):
# '''
# Check if the xbee flag is set to true.
# '''
... | 2.34375 | 2 |
mantle/xilinx/mantle6/mothball/fulladder.py | splhack/mantle | 33 | 12791128 | from magma import *
from ..spartan6.CLB import CARRY
from ..spartan6.LUT import LUT5x2
__all__ = ['FullAdder']
#
# return I0, ..., In, CIN -> O, COUT
#
def FullCarry(k, expr6, expr5):
assert k <= 5
lut = LUT5x2(expr5, expr6)
args = []
if k >= 1:
args += ['input I0', lut.I0]
else:
... | 2.25 | 2 |
tests/models.py | robertvaugh/durabledict | 42 | 12791129 | <filename>tests/models.py
from django.conf import settings
if not settings.configured:
settings.configure(
DATABASES={
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': 'test.db'
}
},
INSTALLED_APPS=[
'tests',
... | 2.046875 | 2 |
src/jt/pyjava/_pyjava/_typehandler/string_handler.py | karpierz/jtypes.pyjava | 2 | 12791130 | # Copyright (c) 2015-2022 <NAME>
# Licensed under the MIT License
# https://opensource.org/licenses/MIT
from jvm.lib import public
from jvm.lib import cached
from .._constants import EJavaType
from .._constants import EMatch
from .._jvm import JVM
from ._base_handler import _ObjectHandler
@public
class Strin... | 2 | 2 |
app/resources/root.py | abdghani995/docker-falcon | 0 | 12791131 | <gh_stars>0
import os
import uuid
import json
import redis
from app.config import settings
from app.model import *
def set_cache(key, value):
rclient = redis.Redis.from_url(settings.get('REDIS_URL'))
rclient.set(key, json.dumps(value))
def get_cache(key):
rclient = redis.Redis.from_url(settings.get('REDIS_URL'))
... | 2.296875 | 2 |
sandbox/mlp.py | luiarthur/CytoPy | 1 | 12791132 | # I intend to use this as a Variational auto-encoder for the
# missing y.
# See paper: https://arxiv.org/abs/1312.6114
import torch
# Define sizes
input_size = 3
output_size = 2
hidden_size = 5
# Create multi-layer perceptron
fc1 = torch.nn.Linear(input_size, hidden_size)
act_fn = torch.nn.Tanh()
fc2 = torch.nn.Line... | 2.65625 | 3 |
pinecone/exceptions.py | amourao/pinecone-python-client | 7 | 12791133 | #
# Copyright (c) 2020-2021 Pinecone Systems Inc. All right reserved.
#
from .core.exceptions import PineconeException, PineconeProtocolError
from .core.client.exceptions import OpenApiException, ApiAttributeError, ApiTypeError, ApiValueError, \
ApiKeyError, ApiException, NotFoundException, UnauthorizedException, ... | 1.125 | 1 |
schemas/base.py | sr-vazkez/ecommerce-fastapi | 0 | 12791134 | <gh_stars>0
from pydantic import BaseModel
class UserBase(BaseModel):
email: str
class BaseComplaint(BaseModel):
title : str
description : str
photo_url : str
amount: float | 2.125 | 2 |
app.py | govle-192-21-2/govle | 0 | 12791135 | <filename>app.py
# Main application file for GoVLê
from controllers import init_api
from controllers.database import Database
from cryptography.hazmat.backends import default_backend
from cryptography.hazmat.primitives import serialization
from dotenv import load_dotenv
from firebase_admin import credentials, db
from f... | 2.21875 | 2 |
scripts/trial/turtlesim/turtlesim_motion_server.py | miroslavradojevic/agv_motion | 0 | 12791136 | <reponame>miroslavradojevic/agv_motion
#!/usr/bin/env python
import rospy
import actionlib
import math
from geometry_msgs.msg import Twist
from turtlesim.msg import Pose
from agv_motion.msg import MoveTurtlesimAction
from agv_motion.msg import MoveTurtlesimFeedback
from agv_motion.msg import MoveTurtlesimResult
class... | 2.390625 | 2 |
presenter.py | cloudRoutine/curveship | 1 | 12791137 | 'Format and display the output text.'
__author__ = '<NAME>'
__copyright__ = 'Copyright 2011 <NAME>'
__license__ = 'ISC'
__version__ = '0.5.0.0'
__status__ = 'Development'
import os
import re
import struct
def ioctl_term_size(filed):
'Attempt to find terminal dimensions using an IO Control system call.'
try:
... | 2.890625 | 3 |
app/routes/build.py | lsst-sqre/ltd-dasher | 0 | 12791138 | <filename>app/routes/build.py
"""Routes at ``/build`` that implement dashboard builds."""
from flask import jsonify, request, current_app
from . import api
from .logging import log_route
from ..worker import build_dashboard_for_product
@api.route('/build', methods=['POST'])
@log_route
def build_dashboards():
"""... | 2.328125 | 2 |
decision-trees/trees.py | HectorJuarezL/machine-learning-codes | 0 | 12791139 | from math import log
import operator
def createDataSet(): #Funcion que retorna un mequeño dataset
dataSet = [[1, 1, 'yes'],
[1, 1, 'yes'],
[1, 0, 'no'],
[0, 1, 'no'],
[0, 1, 'no']]
labels = ['no surfacing','flippers']
#change to discrete values
... | 3.546875 | 4 |
config/fitbit_webservice_config.py | PruthviKumarBK/fitbit_webservice | 11 | 12791140 | __author__ = '<NAME>'
"""
Author: <NAME>
Email: <EMAIL>
Date: February 2, 2018
This is a simple python file that holds all the configuration parameters required for fitbit webservice wrapper.
"""
class Fitbit_Webservice_Config(object):
def __init__(self):
super(Fitbit_Webservice_Config, self).__init__(... | 2.15625 | 2 |
ema.py | hvt1609/kagglebirdcall | 43 | 12791141 | <gh_stars>10-100
import time
import warnings
import numpy as np
import torch
import torch.nn as nn
import src.configuration as C
import src.models as models
import src.utils as utils
from copy import deepcopy
from pathlib import Path
from fastprogress import progress_bar
from sklearn.metrics import average_precisio... | 2.21875 | 2 |
pertpy/api/__init__.py | theislab/pertpy | 1 | 12791142 | import scanpy
pertpy_settings = scanpy.settings
from pertpy.api import data as dt
from pertpy.api import plot as pl
from pertpy.api import preprocessing as pp
from pertpy.api import tools as tl
| 1.125 | 1 |
examples/gyrodata.py | EduardoNigro/pyev3 | 0 | 12791143 | """ gyrodata.py
Run one motor with a sinusoidal speed input and an attached gyro.
This example shows how use the gyro to measure angular position and velocity
by attaching it to the motor shaft.
Setup:
Connect one large motor to port 'A'
Connect the gyro sensor to port number 1.
Notes:
1. Remember ther... | 3.546875 | 4 |
modules/may9/plug-ins/May9_Next.py | DavideAlidosi/May9 | 39 | 12791144 | <reponame>DavideAlidosi/May9
import __main__
import May9_Next
def initializePlugin(*args):
__main__.May9_Next = May9_Next
def uninitializePlugin(*args):
try:
__main__.__delattr__("May9_Next")
except AttributeError:
pass | 1.625 | 2 |
scrapqd/gql/enum/browser.py | dduraipandian/scrapqd | 0 | 12791145 | <reponame>dduraipandian/scrapqd<filename>scrapqd/gql/enum/browser.py
from graphql import GraphQLEnumType as EnumType
from scrapqd.executor.selenium_driver.factory import BrowserFactory
BrowserEnum = EnumType("Browser",
{d.upper(): d for d in BrowserFactory().mapping()},
d... | 2.21875 | 2 |
wb/main/models/dataset_augmentation_job_model.py | apaniukov/workbench | 23 | 12791146 | """
OpenVINO DL Workbench
Class for ORM model describing dataset augmentation job
Copyright (c) 2021 Intel Corporation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.... | 2.09375 | 2 |
tilenol/event.py | paulie-g/tilenol | 42 | 12791147 | <filename>tilenol/event.py
import logging
from zorro import Condition, gethub
log = logging.getLogger(__name__)
class Event(object):
def __init__(self, name=None):
self.name = name
self._listeners = []
self._worker = None
def listen(self, fun):
self._listeners.append(fun)
... | 2.4375 | 2 |
src/word_fix.py | thoppe/orthographic-pedant | 155 | 12791148 | <reponame>thoppe/orthographic-pedant<gh_stars>100-1000
import os, json, logging, glob, codecs, os, time, subprocess
from contextlib import contextmanager
import requests
logging.basicConfig(level=logging.INFO)
logging.getLogger("requests").setLevel(logging.WARNING)
FLAG_fork = True
FLAG_delete = True
fork_sleep_time ... | 2.578125 | 3 |
udatetime/_pure.py | kashnick/udatetime | 244 | 12791149 | <reponame>kashnick/udatetime
from datetime import tzinfo, timedelta, datetime as dt_datetime
from time import time, gmtime
from math import floor, ceil
DATE_TIME_FORMAT = '%Y-%m-%dT%H:%M:%S.%f'
class TZFixedOffset(tzinfo):
def __init__(self, offset):
self.offset = offset
def utcoffset(self, dt=None... | 2.75 | 3 |
utils/__init__.py | carolinscholl/SORN | 1 | 12791150 | from .bunch import *
from .backup import backup_pickle
| 1 | 1 |