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 |
|---|---|---|---|---|---|---|
trax/shapes.py | koz4k2/trax | 0 | 12780851 | # coding=utf-8
# Copyright 2019 The Trax 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... | 2.78125 | 3 |
ygo_pro_coder/koishi_coder.py | shiyinayuriko/toolbox_python | 1 | 12780852 | <reponame>shiyinayuriko/toolbox_python
import sys
import base64
if(sys.argv.__len__() == 1):
sourceFile = input("input source file\n")
else:
sourceFile = sys.argv[1]
counter = [0,0]
cardlist = []
currentCounter = 0
with open(sourceFile, "r", encoding="utf8") as f:
for line in f:
if line.strip().i... | 3.046875 | 3 |
src/microspeclib/__init__.py | microspectrometer/microspec | 0 | 12780853 | import os
__copyright__ = """Copyright 2020 Chromation, Inc"""
__license__ = """All Rights Reserved by Chromation, Inc"""
__doc__ = """
see API documentation: 'python -m pydoc microspeclib.simple'
"""
# NOTE: Sphinx ignores __init__.py files, so for generalized documentation,
# please use pydoc, or the... | 1.929688 | 2 |
appserver/neo4japp/services/annotations/lmdb_service.py | SBRG/lifelike | 8 | 12780854 | <reponame>SBRG/lifelike<gh_stars>1-10
from .lmdb_connection import LMDBConnection
class LMDBService(LMDBConnection):
def __init__(self, dirpath: str, **kwargs) -> None:
super().__init__(dirpath, **kwargs)
| 1.734375 | 2 |
User/transform.py | rvock/Sublime-Text-Preferences | 1 | 12780855 | <filename>User/transform.py
import string
import sublime
import sublime_plugin
import zlib
class GzdecodeCommand(Transformer):
transformer = lambda s: zlib.decompress(s),
| 1.703125 | 2 |
Bloomberg_codecon/General_challenger_problems/basic_encryption.py | SelvorWhim/competitive | 0 | 12780856 | <reponame>SelvorWhim/competitive<filename>Bloomberg_codecon/General_challenger_problems/basic_encryption.py<gh_stars>0
### INSTRUCTIONS ###
'''
With all the talk about cryptography and encryption, your friend has come up with the following basic encryption method:
An initial array of data (called A) is an array of ... | 4.34375 | 4 |
flask/app/views.py | nokiam9/forester | 1 | 12780857 | <reponame>nokiam9/forester
# # -*- coding: utf-8 -*-
from flask import request, render_template, abort
from mongoengine.errors import NotUniqueError
from models import BidNotice
import json, datetime
NOTICE_TYPE_CONFIG = {
'0': '全部招标公告',
'1': '单一来源采购公告',
'2': '采购公告',
'7': '中标结果公示',
'3': '资格预审公告'... | 1.992188 | 2 |
convert_ejm.py | fediskhakov/ejm2evernote | 1 | 12780858 | <filename>convert_ejm.py
#! /usr/bin/env python
# By <NAME>
# fedor.iskh.me
# The packages:
# geopy is needed for geo-locating the employers
# bleach is needed for cleaning up the content of ads for Evernote standard (ENML)
# https://dev.evernote.com/doc/articles/enml.php#prohibited
# https://pypi.python.org/pypi/ble... | 2.125 | 2 |
mqtt_handler.py | sskorol/respeaker-led | 0 | 12780859 | <filename>mqtt_handler.py
import uuid
import paho.mqtt.client as mqtt
import mraa
import time
from os import environ, geteuid
from pixel_ring import pixel_ring
from utils import read_json, current_time
class MqttHandler:
def __init__(self):
# It's required to change GPIO state on Respeaker Core V2 befor... | 2.59375 | 3 |
pdbattach/exchange/exchange.py | jschwinger233/pdbattach | 15 | 12780860 | <reponame>jschwinger233/pdbattach<filename>pdbattach/exchange/exchange.py
from ..utils import singleton
class Subscriber:
def recv(self, msg):
handle = getattr(self, "handle_msg_" + msg.__class__.__name__, None)
if handle:
handle(msg)
@singleton
class Exchange:
def __init__(self)... | 2.375 | 2 |
wave_freq.py | JonahY/AE_GUI | 2 | 12780861 | <reponame>JonahY/AE_GUI<gh_stars>1-10
"""
@version: 2.0
@author: Jonah
@file: wave_freq.py
@Created time: 2020/12/15 00:00
@Last Modified: 2021/12/18 19:07
"""
from plot_format import plot_norm
from ssqueezepy import ssq_cwt
from scipy.fftpack import fft
import array
import numpy as np
import matplotlib.pyplot as plt
... | 2.265625 | 2 |
xv_leak_tools/test_device/linux_device.py | UAEKondaya1/expressvpn_leak_testing | 219 | 12780862 | <filename>xv_leak_tools/test_device/linux_device.py
import platform
import signal
from xv_leak_tools.exception import XVEx
from xv_leak_tools.helpers import unused
from xv_leak_tools.log import L
from xv_leak_tools.test_device.desktop_device import DesktopDevice
from xv_leak_tools.test_device.connector_helper import C... | 2 | 2 |
app.py | alexwagg/SimplePaymentChannel | 7 | 12780863 | from flask import Flask, request, session, g, redirect, url_for, abort, render_template, flash, send_from_directory
import mysql.connector
from web3 import Web3, HTTPProvider
import rlp
import json
import my_connections
app = Flask(__name__)
## set this to your eth node, this is localhost default config
w3 = Web3(HT... | 2.21875 | 2 |
conv_sop1.py | tomtkg/EC-Comp2021 | 0 | 12780864 | <reponame>tomtkg/EC-Comp2021<filename>conv_sop1.py
import sys
import random
from deap import base
from deap import creator
from deap import tools
from eval import evaluator
### GAの設定
# - N_IND:個体数
# - N_GEN:世代数
# - S_TOUR: トーナメントサイズ
# - P_CROSS_1:交叉確率(交叉を行うかどうか決定する確率)
# - P_CROSS_2:交叉確率(一様交叉を行うときに,その遺伝子座が交叉する確率)
# - P... | 2.234375 | 2 |
gen_mx_traits.py | Dunkelschorsch/arrayadapt | 1 | 12780865 | #!env python
import re
def c_to_mx_typename(c_type, special_map):
m = re.search("([a-zA-Z0-9]+)_t", c_type)
if m == None:
mx_type = c_type
else:
mx_type = m.groups()[0]
if c_type in special_map:
mx_type = special_map[c_type]
return mx_type.upper()
c_type = ('void', 'bool', 'double', 'float', 'uint64_t', '... | 2.234375 | 2 |
engineer/contrib/__init__.py | tylerbutler/engineer | 6 | 12780866 | <reponame>tylerbutler/engineer<filename>engineer/contrib/__init__.py
# coding=utf-8
__author__ = '<NAME> <<EMAIL>>'
| 1.023438 | 1 |
localstack/services/cloudwatch/cloudwatch_listener.py | doytsujin/localstack | 0 | 12780867 | from moto.cloudwatch.models import cloudwatch_backends
from localstack.services.generic_proxy import ProxyListener
from localstack.utils.aws import aws_stack
# path for backdoor API to receive raw metrics
PATH_GET_RAW_METRICS = "/cloudwatch/metrics/raw"
class ProxyListenerCloudWatch(ProxyListener):
def forward_... | 2 | 2 |
10 Random Forest/02 Random Forest.py | Free-Machine-Learning/Machine-Learning-Classifiers | 10 | 12780868 | <reponame>Free-Machine-Learning/Machine-Learning-Classifiers
# Import the libararies
import math
import numpy as np
import pandas as pd
from datetime import datetime
import seaborn as sns
import matplotlib.pyplot as plt
%matplotlib inline
plt.style.use('seaborn-whitegrid')
from sklearn.ensemble import RandomForestCl... | 2.875 | 3 |
qucumber/observables/entanglement.py | silky/QuCumber | 1 | 12780869 | <reponame>silky/QuCumber
# Copyright 2018 PIQuIL - All Rights Reserved
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to yo... | 2.21875 | 2 |
galibrate/__init__.py | blakeaw/GAlibrate | 6 | 12780870 | <gh_stars>1-10
"""Initialize the galibrate package.
"""
from .gao import GAO
| 0.964844 | 1 |
examples/convert_text_to_paths.py | CatherineH/svgpathtools | 2 | 12780871 | from xml.dom.minidom import parseString
from svgpathtools import svgdoc2paths, wsvg
example_text = '<svg>' \
' <rect x="100" y="100" height="200" width="200" style="fill:#0ff;" />' \
' <line x1="200" y1="200" x2="200" y2="300" />' \
' <line x1="200" y1="200" x2="300" y2... | 2.859375 | 3 |
src/biokbase/narrative/services/invocation_tools.py | teharrison/narrative | 0 | 12780872 | """
invocation functions for all
"""
__author__ = '<NAME>'
__date__ = '6/18/14'
__version__ = '0.5'
## Imports
import re
import json
import time
import os
import base64
import urllib
import urllib2
import cStringIO
import requests
import datetime
from string import Template
from collections import defaultdict
# Local
... | 2.3125 | 2 |
face_ae_window.py | hujunchina/FaceAE | 0 | 12780873 | <filename>face_ae_window.py
import sys
from numpy import asarray
from face_ae_const import CONST_VAL
from cv2 import cvtColor, COLOR_RGB2BGR
from PIL import (ImageQt)
from PyQt5.QtWidgets import (QApplication, QWidget, QLabel, QFormLayout, QGridLayout, QLineEdit, QPushButton,QFileDialog)
from PyQt5.QtGui import (QPaint... | 2.34375 | 2 |
pmutt/statmech/vib.py | wittregr/pMuTT | 28 | 12780874 | # -*- coding: utf-8 -*-
import numpy as np
from scipy.integrate import quad
from pmutt import _ModelBase
from pmutt import constants as c
from pmutt.io.json import remove_class
class HarmonicVib(_ModelBase):
"""Vibrational modes using the harmonic approximation. Equations used
sourced from:
- <NAME... | 2.625 | 3 |
main.py | libojia-aug/compound-calculator | 0 | 12780875 |
import formula
#年利率、借款期数(月)、初始资金(元)、投资总周期(月)、坏账率
print(formula.annualIncome(22,12,10000,12,0)) | 2.0625 | 2 |
users/urls.py | BalighMehrez/share-school-books | 0 | 12780876 | <reponame>BalighMehrez/share-school-books
from django.urls import path,include
from . import views
from bookshop.views import index
from django.contrib.auth import views as auth_views
urlpatterns = [
path('account/register',views.register,name='register'),
path('account/login',views.login,name='login'),
p... | 1.84375 | 2 |
python-skylark/skylark/__init__.py | xdata-skylark/libskylark | 86 | 12780877 | # TODO I am not sure the following line should really be here, but without
# it Python just exits (complains of not initilizing MPI).
import El
__all__ = ["io", "sketch", "ml", "nla", "base", "elemhelper", "lib", "errors"]
| 1.195313 | 1 |
v0.1/membrane_solvers/FCD-2D/tests/OsmoticProperties.py | drizdar/Propmod | 3 | 12780878 | <gh_stars>1-10
import math
import formulas as f
T = 273.15 + 25
P = 1.01325
pc_wt = 0.26
print(f'Percent weight {pc_wt} kg NaCl / kg Total')
m_NaCl = f.mNaCl(pc_wt)
print(f'Mass of NaCl {m_NaCl} g')
Molal_NaCl = f.Molality(m_NaCl)
# Molal_NaCl = 6
# m_NaCl = Molal_NaCl*58.44277
print(f'Molality {Molal_NaCl} mol/kg')
D... | 2.21875 | 2 |
002. Add Two Numbers.py | yuzhangClaremont/gitbasics | 0 | 12780879 | # -*- coding: utf-8 -*-
# @Author: LC
# @Date: 2016-01-23 10:53:34
# @Last modified by: LC
# @Last Modified time: 2016-04-10 16:23:45
# @Email: <EMAIL>
#########################################
# 注意:
# 题目已经定义好了链表类
# 链表的相加进位
###########################################
# Definition for singly-linked list.
# class... | 3.875 | 4 |
dao/stock_def.py | zheng-zy/ot_root | 0 | 12780880 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
""" etf class
"""
# import math
import gevent
from pb import base_pb2
# import quotation_def_pb2
__author__ = 'qinjing'
# RF_MUST = 0
# RF_ALLOW = 1
# RF_FORBIDDEN = 2
# class StockInfo:
# # 股票代码, 数量
# __slots__ = ['code', 'md']
#
# def __init__(sel... | 2.765625 | 3 |
pydec/io/__init__.py | michaels10/pydec | 0 | 12780881 | "PyDEC mesh and array IO"
from info import __doc__
from meshio import *
from arrayio import *
__all__ = filter(lambda s:not s.startswith('_'),dir())
| 1.179688 | 1 |
codeStore/support_fun_resistance.py | pcmagic/stokes_flow | 1 | 12780882 | <gh_stars>1-10
from tqdm.notebook import tqdm as tqdm_notebook
import os
import glob
import pickle
import numpy as np
# load the resistance matrix form dir, standard version
def load_ABC_list(job_dir):
t_dir = os.path.join(job_dir, '*.pickle')
pickle_names = glob.glob(t_dir)
problem_kwarg_list = []
A_... | 2.1875 | 2 |
list/CSPdarknet53.py | PHL22/Backbone | 0 | 12780883 | <reponame>PHL22/Backbone
# -*- coding: UTF-8 -*-
"""
An unofficial implementation of CSP-DarkNet with pytorch
@<NAME> 2020_09_30
"""
import torch
import torch.nn as nn
import torch.nn.functional as F
# from torchsummary import summary
from .CSPdarknet53conv_bn import Mish, BN_Conv_Mish
from .build import BA... | 2.265625 | 2 |
starter_code/api_keys.py | goblebla/Python-APIs | 0 | 12780884 | # OpenWeatherMap API Key
weather_api_key = "40449008a54beb2007d8de8d8b5d63a4"
# Google API Key
g_key = "<KEY>"
| 1.210938 | 1 |
src/main/python/pybuilder_integration/tasks.py | rspitler/pybuilder-integration | 0 | 12780885 | <filename>src/main/python/pybuilder_integration/tasks.py
import os
import shutil
import pytest
from pybuilder.core import Project, Logger, init, RequirementsFile
from pybuilder.errors import BuildFailedException
from pybuilder.install_utils import install_dependencies
from pybuilder.reactor import Reactor
from pybuil... | 2.171875 | 2 |
Chapter24/apple_factory.py | DeeMATT/AdvancedPythonProgramming | 278 | 12780886 |
MINI14 = '1.4GHz Mac mini'
class AppleFactory:
class MacMini14:
def __init__(self):
self.memory = 4 # in gigabytes
self.hdd = 500 # in gigabytes
self.gpu = 'Intel HD Graphics 5000'
def __str__(self):
info = (f'Model: {MINI14}',
f... | 3.421875 | 3 |
examples/get_links.py | cesardeaptude/crawlerpy | 0 | 12780887 | <gh_stars>0
from crawlerpy import Get_news
from crawlerpy.resources.resources import Resources
pprint = Resources()
news = Get_news()
links = news.get_links("https://www.tehrantimes.com/page/archive.xhtml?wide=0&ms=0&pi=2&tp=697")
#links = news.get_links("https://www.tehrantimes.com/archive?tp=697",
# ... | 2.484375 | 2 |
tke_project/myapp/migrations/0003_gallery_title.py | moradia100/TKE-Website | 0 | 12780888 | # Generated by Django 2.2.6 on 2019-10-15 23:11
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('myapp', '0002_gallery'),
]
operations = [
migrations.AddField(
model_name='gallery',
name='title',
field... | 1.5625 | 2 |
nes/processors/cpu/instructions/jump/__init__.py | Hexadorsimal/pynes | 1 | 12780889 | <reponame>Hexadorsimal/pynes<gh_stars>1-10
from .jmp import Jmp
| 1.085938 | 1 |
chalice/sample_lambda_periodic.py | terratenney/aws-tools | 8 | 12780890 | <gh_stars>1-10
from chalice import Chalice, Rate
app = Chalice(app_name="helloworld")
# Automatically runs every 5 minutes
@app.schedule(Rate(5, unit=Rate.MINUTES))
def periodic_task(event):
return {"hello": "world"} | 2.671875 | 3 |
snekcord/objects/teamobject.py | asleep-cult/snakecord | 6 | 12780891 | <gh_stars>1-10
from ..enums import TeamMembershipState
from ..json import JsonField, JsonObject
from ..snowflake import Snowflake
class Team(JsonObject):
id = JsonField('id', Snowflake)
owner_id = JsonField('owner_user_id', Snowflake)
def __init__(self, *, application):
self.application = applica... | 2.390625 | 2 |
router.py | jersobh/zfs-resty | 11 | 12780892 |
from controllers import mainController
import aiohttp_cors
def routes(app):
cors = aiohttp_cors.setup(app, defaults={
"*": aiohttp_cors.ResourceOptions(
allow_methods=("*"),
allow_credentials=True,
expose_headers=("*",),
allow_headers=("*"),
max_... | 2.09375 | 2 |
env_dev/lib/python3.6/site-packages/sparsegrad/base/expr.py | icweaver/cs207_public | 0 | 12780893 | <filename>env_dev/lib/python3.6/site-packages/sparsegrad/base/expr.py<gh_stars>0
# -*- coding: utf-8; -*-
#
# sparsegrad - automatic calculation of sparse gradient
# Copyright (C) 2016-2018 <NAME> (<EMAIL>)
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero G... | 2.265625 | 2 |
_common.py | mxr/advent-of-code-2020 | 2 | 12780894 | <reponame>mxr/advent-of-code-2020
from __future__ import annotations
import sys
from argparse import ArgumentParser
from typing import Callable
def main(part1: Callable[[str], int], part2: Callable[[str], int]) -> int:
parser = ArgumentParser()
parser.add_argument("-p", "--part", type=int, default=0)
par... | 3.109375 | 3 |
exp-05/MainWindow.py | SevdanurGENC/QT-Designer-Examples | 0 | 12780895 | <gh_stars>0
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'MainWindow.ui'
#
# Created by: PyQt5 UI code generator 5.13.2
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_MainWindow(object):
def setupUi(self,... | 2.109375 | 2 |
meutils/decorators/catch.py | Jie-Yuan/MeUtils | 3 | 12780896 | <reponame>Jie-Yuan/MeUtils
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Project : MeUtils.
# @File : try
# @Time : 2021/4/2 11:03 上午
# @Author : yuanjie
# @WeChat : 313303303
# @Software : PyCharm
# @Description :
from meutils.pipe import *
from meutils.log_utils import logger4... | 2.40625 | 2 |
sandbox/src/COSFocusOutputs.py | sniemi/SamPy | 5 | 12780897 | #! /usr/bin/env python
'''
DESCRIPTION:
This short script pulls out COS data from a fits file
and outputs the data to two ascii files. The first file
contains two columns; pixels and counts, while the other
file has columns; wavelength and counts.
Dispersion solutions are given in the beginning of the script
and shoul... | 3.015625 | 3 |
test/Test_LinkSearchBase.py | shift4869/PictureGathering | 0 | 12780898 | <gh_stars>0
# coding: utf-8
import sys
import unittest
from contextlib import ExitStack
from logging import WARNING, getLogger
from mock import MagicMock, PropertyMock, mock_open, patch
from PictureGathering import LinkSearchBase
logger = getLogger("root")
logger.setLevel(WARNING)
class TestLinkSearc... | 2.578125 | 3 |
Aula1a17/Aula_1_noCreative.py | paiva-rodrigo/PythonScripts | 0 | 12780899 | <reponame>paiva-rodrigo/PythonScripts
nome=input("qual é o seu nome?")
idade= input("qual e a sua idade?")
peso=input("qual e o seu peso?")
print(nome,idade,peso)
print("seja bem vindo",nome)
dia=input("Dia de nascimento?")
mes=input("mes de nascimento?")
ano=input("ano de nascimento?")
print("voce nasceu em",dia,"... | 3.828125 | 4 |
tests/__init__.py | yangyangkiki/pytorch-lightning-bolts | 2 | 12780900 | import os
from pytorch_lightning import seed_everything
TEST_ROOT = os.path.realpath(os.path.dirname(__file__))
PACKAGE_ROOT = os.path.dirname(TEST_ROOT)
DATASETS_PATH = os.path.join(PACKAGE_ROOT, 'datasets')
# generate a list of random seeds for each test
ROOT_SEED = 1234
def reset_seed():
seed_everything()
| 2.171875 | 2 |
22_Honors_class/52_Implement_A_Producer_Consumer_Queue/Producer.py | vtkrishn/EPI | 0 | 12780901 | <gh_stars>0
from threading import Thread,Condition
import random
import time
#Producer thread
condition = Condition()
MAX_NUM = 10
class Producer(Thread):
def set(self,q, l):
self.queue = q
self.lock = l
#produce
def run(self):
nums = range(5) #creates [0,1,2,3,4]
wh... | 3.5 | 4 |
psec/secrets/restore.py | davedittrich/python_secrets | 10 | 12780902 | # -*- coding: utf-8 -*-
import argparse
import logging
import os
import tarfile
import textwrap
from cliff.command import Command
# TODO(dittrich): https://github.com/Mckinsey666/bullet/issues/2
# Workaround until bullet has Windows missing 'termios' fix.
try:
from bullet import Bullet
except ModuleNotFoundError:... | 2.234375 | 2 |
plotcollection.py | camminady/camminapy | 0 | 12780903 | <reponame>camminady/camminapy<gh_stars>0
import numpy as np
import matplotlib.pyplot as plt
from scipy.interpolate import RegularGridInterpolator, interp1d
import kitcolors as kit
from scipy.interpolate import interp1d
from scipy.interpolate import RegularGridInterpolator
from .getvalues import getcircles, getcuts
impo... | 2.3125 | 2 |
run-addon.py | chinedufn/landon | 117 | 12780904 | <reponame>chinedufn/landon
# A script to temporarily install and run the addon. Useful for running
# blender-mesh-to-json via blender CLI where you might be in a
# continuous integration environment that doesn't have the addon
# installed
#
# blender file.blend --python $(mesh2json)
# -> becomes ->
# blender file.b... | 1.773438 | 2 |
VirusVisuals.py | keklarup/VirusSpread | 0 | 12780905 | # -*- coding: utf-8 -*-
"""
ABM virus visuals
Created on Thu Apr 9 10:16:47 2020
@author: Kyle
"""
import matplotlib.pyplot as plt
from matplotlib import colors
import numpy as np
import os
import tempfile
from datetime import datetime
import imageio
class visuals():
def agentPlot(self, storageArrayList, cmap=N... | 2.421875 | 2 |
init_data/permission_data/group.py | ModifiedClass/flaskapipermission | 0 | 12780906 | <gh_stars>0
# -*- coding:utf-8 -*-
# 权限管理数据
# database:mysql base:fua user:root pwd:<PASSWORD>
from app.block.permission.model import Group
# 初始化组
def initGroup():
g1 = Group()
g1.name='管理员'
g1.remark='所有权限'
g2 = Group()
g2.name='注册用户'
g2.remark='基本权限'
return {'admin':g1,'guest':g2} | 1.945313 | 2 |
appengine_config.py | sreejithb/cows_and_bulls | 0 | 12780907 | from google.appengine.ext import vendor
vendor.add('lib')
vendor.add('lib/nltk')
vendor.add('lib/nltk-3.2.1.egg-info') | 1.414063 | 1 |
Python_MiniGame_Fighter/venv/Lib/site-packages/pygame/tests/camera_test.py | JE-Chen/je_old_repo | 1 | 12780908 | <filename>Python_MiniGame_Fighter/venv/Lib/site-packages/pygame/tests/camera_test.py
import unittest
import math
import pygame
from pygame.compat import long_
class CameraModuleTest(unittest.TestCase):
pass
| 1.414063 | 1 |
src/wifi_sensor/wifi_sensor.py | azz2k/wifi_sensor | 3 | 12780909 | <filename>src/wifi_sensor/wifi_sensor.py<gh_stars>1-10
#!/usr/bin/env python
import rospy
import time
import numpy as np
from msg import *
import thread
import subprocess
import struct
class WifiSensor():
def __init__(self):
# setup rospy and get parameters
rospy.init_node("wifisensor")
self.adapter = r... | 2.59375 | 3 |
0028-implement-strstr/solution.py | radelman/leetcode | 0 | 12780910 | <filename>0028-implement-strstr/solution.py
class Solution:
def strStr(self, haystack: str, needle: str) -> int:
if len(needle) == 0:
return 0
cumsum = [ord(c) for c in haystack]
for i in range(1, len(cumsum)):
cumsum[i] = cumsum[i - 1] + cumsum[i]
target = sum([ord(c) for c in needle])
for i... | 3.3125 | 3 |
fastapi/test/test_app.py | oslokommune/lambda-boilerplate | 0 | 12780911 | from aws_xray_sdk.core import xray_recorder
import app
xray_recorder.begin_segment("Test")
def test_read_root():
response = app.read_root()
assert response == {"hello": "world"}
| 2.359375 | 2 |
src/tools/python/payment_log_reporter.py | Justintime50/easypost-tools | 1 | 12780912 | <gh_stars>1-10
# Payment Log reporter
# Requests payment_log reports and optionally downloads ZIP files
# or the combined CSV of all data.
#
# Usage:
# python3 paymentlog_reporter.py
#
# 0.0 Initial version 05 Mar 2020 <EMAIL>
#
# Note: this script makes raw endpoint queries instead of using the easypost
# API... | 1.570313 | 2 |
Chapter 03/ch3_1_29.py | bpbpublications/TEST-YOUR-SKILLS-IN-PYTHON-LANGUAGE | 0 | 12780913 | <reponame>bpbpublications/TEST-YOUR-SKILLS-IN-PYTHON-LANGUAGE
greet="Never Criticise"
if not greet.islower():
print(greet.casefold())
else:
print("Already in lowercase")
# never criticise | 3.1875 | 3 |
master/Challenges-master/Challenges-master/level-1/swapCase/swap_case.py | AlexRogalskiy/DevArtifacts | 4 | 12780914 | import sys
def main(input_file):
with open(input_file, 'r') as data:
for line in data:
print swap_case(line.strip())
def swap_case(string):
output = ''
for char in string:
if char.islower():
output += char.upper()
else:
output += char.lower() ... | 3.8125 | 4 |
src/datasets/google_speech.py | shgoren/viewmaker | 29 | 12780915 | import os
import torch
import random
import librosa
import torchaudio
import numpy as np
from glob import glob
import nlpaug.flow as naf
import nlpaug.augmenter.audio as naa
import nlpaug.augmenter.spectrogram as nas
from torchvision.transforms import Normalize
from torch.utils.data import Dataset
from nlpaug.augmente... | 2.171875 | 2 |
ATTOM/initial_connection.py | taylor-curran/discover-realestate-data | 0 | 12780916 | import os
from dotenv import load_dotenv
import requests
import json
from xml.etree import ElementTree
# Load API Keys
load_dotenv()
ATTOM_API_KEY = os.getenv('ATTOM_API_KEY')
url = "http://api.gateway.attomdata.com/propertyapi/v1.0.0/property/detail?"
headers = {
'accept': "application/json",
'apikey': ATT... | 2.671875 | 3 |
setup_helpers.py | wildernesstechie/blackhole | 0 | 12780917 | <gh_stars>0
# -*- coding: utf-8 -*-
# Copyright (c) 2018 Kura
# Copyright (C) 2009-2015 <NAME>
#
# This file is part of setup_helpers.py
#
# setup_helpers.py is free software: you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as published by the
# Free Software Foundat... | 2.046875 | 2 |
test/test_game_cache.py | vanderh0ff/pyvtt | 8 | 12780918 | #!/usr/bin/python3
# -*- coding: utf-8 -*-
"""
https://github.com/cgloeckner/pyvtt/
Copyright (c) 2020-2021 <NAME>
License: MIT (see LICENSE for details)
"""
from pony.orm import db_session
import cache, orm
from test.utils import EngineBaseTest, SocketDummy
class GameCacheTest(EngineBaseTest):
def ... | 2.265625 | 2 |
test_maximum_rate.py | saydulk/blurt | 5 | 12780919 | <filename>test_maximum_rate.py
import time
rate = 0
length = 1500
input_octets = np.random.random_integers(0,255,length)
output = wifi.encode(input_octets, rate)
N = output.size
trials = 10
t0 = time.time(); [(None, wifi.encode(input_octets, rate))[0] for i in xrange(trials)]; t1 = time.time()
samples_encoded = trials ... | 2.859375 | 3 |
main.py | promethee/pimoroni.pirate-audio.dual-mic | 0 | 12780920 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import math
import time
import numpy
import digitalio
import board
from PIL import Image, ImageDraw, ImageFont
from fonts.ttf import RobotoMedium
import RPi.GPIO as GPIO
from ST7789 import ST7789
SPI_SPEED_MHZ = 80
display = ST7789(
rotation=90, # Needed t... | 2.765625 | 3 |
config/v1.py | shucheng-ai/WDA-web-server | 0 | 12780921 | #!/usr/bin/env python3
# coding:utf-8
import os
import sys
"""
config 1.0
"""
DEBUG = True
HOST = '0.0.0.0'
PORT = 8000
NAME = 'layout'
DEPLOY = 0 # 0: 单机部署 ; 1: 接入云服务器
HOMEPAGE = "/projects"
ERRPAGE = "/404"
TEST_ID = 0
# path
_PATH = os.path.abspath(os.path.dirname(__file__))
APP_PATH = os.path.abspath(os.path.di... | 2.140625 | 2 |
selecttotex/totex.py | M3nin0/selectToTex | 4 | 12780922 | import pandas as pd
from selecttotex.database import Database
class Totex:
"""Classe para transformar resultados de selects em Latex
"""
def __init__(self):
self.db = Database().get_connection()
def to_tex(self, command_list: list, output_file: str) -> None:
"""Função para transforma... | 3.0625 | 3 |
captioner/train.py | svaisakh/captioner | 1 | 12780923 | <gh_stars>1-10
import magnet as mag
from torch.nn import functional as F
from captioner.nlp import process_caption
def optimize(model, optimizer, history, dataloader, nlp, save_path, epochs=1, iterations=-1, save_every=5,
write_every=1):
"""
Trains the model for the specified number of epochs/iterations.
Thi... | 2.796875 | 3 |
user/managers.py | TheKiddos/StaRat | 1 | 12780924 | <reponame>TheKiddos/StaRat<filename>user/managers.py
from django.contrib.auth.base_user import BaseUserManager
class UserManager(BaseUserManager):
def create_user(self, email, password=None, **kwargs):
"""Creates and saves a new user"""
if not email:
raise ValueError("User must have a... | 2.671875 | 3 |
archive/Jamshidian/Jamshidian_cls.py | nkapchenko/HW | 2 | 12780925 | import numpy as np
from numpy import exp, sqrt
from functools import partial
from scipy import optimize
from scipy.stats import norm
import scipy.integrate as integrate
from fox_toolbox.utils import rates
"""This module price swaption under Hull White model using Jamshidian method.
Usage example:
from hw import Jams... | 2.75 | 3 |
convenient/decorators.py | ixc/glamkit-convenient | 0 | 12780926 | <gh_stars>0
from django.db.models.signals import post_save
def post_save_handler(model):
def renderer(func):
post_save.connect(func, sender=model)
return func
return renderer
| 1.890625 | 2 |
python/utils.py | wenh06/dgne | 0 | 12780927 | <reponame>wenh06/dgne
"""
"""
import re
import time
from functools import wraps
from typing import Any, MutableMapping, Optional, List, Callable, NoReturn, Tuple
import numpy as np
__all__ = [
"DEFAULTS",
"set_seed",
"ReprMixin",
"Timer",
]
class CFG(dict):
"""
this class is created in or... | 2.359375 | 2 |
news/app.py | PythonForChange/Egg | 0 | 12780928 | <reponame>PythonForChange/Egg<filename>news/app.py
#Imports
from news.news import New
from news.config import files,year
from egg.resources.console import get
from egg.resources.constants import *
def journalistConsole(condition: bool = True):
print(white+"Journalist Console is now running")
while condition:
p... | 2.75 | 3 |
website/website/apps/pronouns/tools/copy_paradigm.py | SimonGreenhill/Language5 | 1 | 12780929 | <gh_stars>1-10
from website.apps.pronouns.models import Paradigm
def copy_paradigm(pdm, language):
"""Copies the paradigm `pdm` to a new paradigm for `language`"""
# 1. create new paradigm
old = Paradigm._prefill_pronouns
Paradigm._prefill_pronouns = lambda x: x # Unhook prefill_pronouns!
newpdm ... | 2.546875 | 3 |
DTSGUI/IFLAnim.py | pchan126/Blender_DTS_30 | 0 | 12780930 | <filename>DTSGUI/IFLAnim.py
'''
IFLAnim.py
Copyright (c) 2008 <NAME>(<EMAIL>)
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, ... | 1.570313 | 2 |
supp_experiments/Toy_GMM/run_NPL_toygmm.py | edfong/npl | 6 | 12780931 | <filename>supp_experiments/Toy_GMM/run_NPL_toygmm.py
"""
Running RR-NPL for Toy GMM (set R_restarts = 0 for FI-NPL)
"""
import numpy as np
import npl.sk_gaussian_mixture as skgm
import pandas as pd
import time
import copy
from npl import bootstrap_gmm as bgmm
from npl.maximise_gmm import init_toy
from npl.maximise_... | 2.28125 | 2 |
src/mining/preprocessing.py | Youssef-Mak/covid19-datamart | 2 | 12780932 | <gh_stars>1-10
import database_connect
import psycopg2
import pandas as pd
import math
from imblearn.under_sampling import RandomUnderSampler
import numpy as np
import os
def main():
try:
database_connection = database_connect.connect()
cursor = database_connection.cursor()
# Get the data
... | 2.75 | 3 |
uwtools/__init__.py | AlexEidt/uwtools | 7 | 12780933 | <reponame>AlexEidt/uwtools<gh_stars>1-10
from .parse_courses import parse_catalogs as course_catalogs
from .parse_courses import get_departments as departments
from .parse_schedules import gather as time_schedules
from .parse_schedules import get_academic_year as academic_year
from .parse_buildings import get_build... | 1.265625 | 1 |
pyeureka/client.py | lajonss/pyeureka | 4 | 12780934 | import time
import requests
import pyeureka.validator as validator
import pyeureka.const as c
def get_timestamp():
return int(time.time())
class EurekaClientError(Exception):
pass
class EurekaInstanceDoesNotExistException(Exception):
pass
class EurekaClient:
def __init__(self, eureka_url, ins... | 2.71875 | 3 |
plot_images.py | ayush-mundra/Hair_Style_Recommendation | 2 | 12780935 |
## FUNCTIONS TO OVERLAYS ALL PICS!!
get_ipython().magic('matplotlib inline')
import cv2
from matplotlib import pyplot as plt
import numpy as np
import time as t
import glob, os
import operator
from PIL import Image
import pathlib
from pathlib import Path
image_dir = ["data/pics_for_overlaps/Sarah",
"dat... | 2.765625 | 3 |
pylib/pointprocesses/__init__.py | ManifoldFR/hawkes-process-rust | 28 | 12780936 | """
Algorithms for simulating point processes, stochastic processes used in statistical models.
Implemented in the Rust programming language.
"""
from . import temporal
from . import spatial
| 1.65625 | 2 |
deliver/dtimp/run_analysis.py | mariecpereira/Extracao-de-Caracteristicas-Corpo-Caloso | 0 | 12780937 | <filename>deliver/dtimp/run_analysis.py
# coding: utf-8
# In[ ]:
def run_analysis(rootdir):
import glob as glob
import numpy as np
t1_filename = '{}/t1.nii.gz'.format(rootdir)
print(rootdir)
minc_filename = glob('{}/*.mnc'.format(rootdir))[0]
print(minc_filename)
tagfilename = glob('{}/... | 2.390625 | 2 |
fourth-year/EGC/EGC-1230-julgomrod/decide/census/models.py | JulianGR/university | 0 | 12780938 | from django.db import models
class Census(models.Model):
voting_id = models.PositiveIntegerField()
voter_id = models.PositiveIntegerField()
class Meta:
unique_together = (('voting_id', 'voter_id'),)
| 2.234375 | 2 |
addons/event_crm/models/crm_lead.py | SHIVJITH/Odoo_Machine_Test | 0 | 12780939 | # -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import fields, models, api
class Lead(models.Model):
_inherit = 'crm.lead'
event_lead_rule_id = fields.Many2one('event.lead.rule', string="Registration Rule", help="Rule that created this lead")
... | 1.984375 | 2 |
day21.part2.py | gigs94/aoc2021 | 0 | 12780940 | from re import U
import numpy as np
from collections import Counter, defaultdict
from pprint import pprint
def moves(pos, endv, pathz, rolls=0):
if rolls==3:
pathz.append(pos); return
for i in [ 1, 2, 3 ]:
npos=(pos+i-1)%10+1
moves(npos, endv, pathz, rolls+1)
possibilities={}
for x i... | 2.8125 | 3 |
sha256cracker.py | deceptivecz/portfolio | 0 | 12780941 | <gh_stars>0
import hashlib
hash_input = input("Enter hash here : ").lower()
wordlist = "fakeyou.txt"
try:
words = open(wordlist)
except:
print("Wordlist not found.")
quit()
def crack(hash_input):
for word in words:
hs = hashlib.sha256(word.encode('utf-8')).hexdigest()
if str(hs) == has... | 3.703125 | 4 |
simulation/loader/location.py | GerardLutterop/corona | 0 | 12780942 | import datetime
import re
import time
from logging import getLogger
from random import randint, gauss, random
import pandas as pd
from .external import DataframeLoader
log = getLogger(__name__)
class PrimarySchoolClasses(DataframeLoader):
DISABLE_CACHE = False
def __init__(self, pupils, present=None):
... | 2.953125 | 3 |
DB_Treeview.py | jakobis95/ILIAS---Test-Generator | 0 | 12780943 | <gh_stars>0
from tkinter import *
import tkinter as tk
from tkinter import ttk
from Fragen_GUI import formelfrage, singlechoice, multiplechoice, zuordnungsfrage, formelfrage_permutation
from ScrolledText_Functionality import Textformatierung
class UI():
def __init__(self,table_dict , db_interface, frame, sc... | 2.453125 | 2 |
tools/infer_mot_client.py | Mr-JNP/PaddleDetection | 0 | 12780944 | #
# Hello World client in Python
# Connects REQ socket to tcp://localhost:5555
#
import zmq
def main():
context = zmq.Context()
# Socket to talk to server
print("Connecting to Paddle Server…")
socket = context.socket(zmq.REQ)
socket.connect("tcp://localhost:5555")
# Do 2 requests, waiti... | 2.953125 | 3 |
tests/conftest.py | sidhulabs/sidhulabs-py | 0 | 12780945 | import pytest
from _pytest.logging import LogCaptureFixture
from loguru import logger
@pytest.fixture
def caplog(caplog: LogCaptureFixture):
handler_id = logger.add(caplog.handler, format="{message}")
yield caplog
logger.remove(handler_id)
| 1.765625 | 2 |
letras_sao_iguais.py | rodrigolins92/exercicios-diversos | 0 | 12780946 | <reponame>rodrigolins92/exercicios-diversos
def SaoIguais(a, b, c):
if (a == b) and (b == c):
return print("São Iguais")
else:
return print("São diferentes")
x1 = input("Primeira letra: ")
x2 = input("Segunda letra: ")
x3 = input("Terceira letra: ")
resposta = SaoIguais(x1, x2, x3)
| 3.796875 | 4 |
core/callbacks.py | susemm/PyVin | 0 | 12780947 | __author__ = '<EMAIL>'
class Callbacks():
def __init__(self):
self.handler = {}
def init(self, events):
for event in events:
self.handler[event] = self.callback
def callback(self, *pros, **attrs):
pass
def bind(self, event, handler):
if self.... | 3.25 | 3 |
http_requestor/core/models.py | mscam/http_requestor | 0 | 12780948 | import sys
from django.db import models
from django.utils import timezone
from django.utils.translation import ugettext_lazy as _
from django.core.exceptions import ValidationError
from celery import states
from celery.result import AsyncResult, allow_join_result
from .fields import JSONField
def validate_schedule_... | 2.078125 | 2 |
tests/data/aws/securityhub.py | ramonpetgrave64/cartography | 2,322 | 12780949 | GET_HUB = {
'HubArn': 'arn:aws:securityhub:us-east-1:000000000000:hub/default',
'SubscribedAt': '2020-12-03T11:05:17.571Z',
'AutoEnableControls': True,
}
| 1.328125 | 1 |
PJ/20_Python.py | vedgar/ip | 5 | 12780950 | <reponame>vedgar/ip
"""Primjer kako python (interpreter) obrađuje Python (programski jezik)."""
import tokenize, io, keyword, ast, dis, warnings, textwrap
def tokeni(string):
lex = tokenize.tokenize(io.BytesIO(string.encode('utf8')).readline)
for tok in list(lex)[1:-1]:
if keyword.iskeyword(tok.string... | 3.203125 | 3 |