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 |
|---|---|---|---|---|---|---|
rlkit/samplers/rollout.py | HamzaHz2/rlkit | 0 | 12789751 | import numpy as np
#
class Rollout:
def __init__(self):
self.dict_obs = []
self.dict_next_obs = []
self.actions = []
self.rewards = []
self.terminals = []
self.agent_infos = []
self.env_infos = {}
self.path_length = 0
def __len__(self):
r... | 2.53125 | 3 |
azure_config_template.py | alan-turing-institute/Pangeo-UKCP-Transfer | 2 | 12789752 | <reponame>alan-turing-institute/Pangeo-UKCP-Transfer
config = {"ACCOUNT_NAME": ACC_NAME,
"SAS_TOKEN": SAS_TOKEN}
| 1.226563 | 1 |
AutoWebBrowsing/webBrowse.py | mshahmalaki/PyAutomate | 0 | 12789753 | <filename>AutoWebBrowsing/webBrowse.py
from selenium import webdriver
driver = webdriver.Chrome()
driver.get('https://www.seleniumeasy.com/test/basic-first-form-demo.html')
message_field = driver.find_element_by_xpath('//*[@id="user-message"]')
message_field.send_keys('Hello <PASSWORD>')
show_message_button = driver.... | 3.203125 | 3 |
libs/__init__.py | ardzix/instalment-app | 1 | 12789754 | # ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#
# Author: <NAME>
# <EMAIL>
#
# File Created: Wednesday, 10th January 2018 11:35:14 pm
# Last Modified: Wednesday, 10th January 2018 11:37:28 pm
# Modified By: <NAME> (<EMAIL>)
#
# Give the best to the world
# Copyright - 2018 Ardz.Co
# ++++++++++++... | 1.546875 | 2 |
netbox/extras/api/serializers.py | team-telnyx/netbox | 3 | 12789755 | from rest_framework import serializers
from extras.models import CF_TYPE_SELECT, CustomFieldChoice, Graph
class CustomFieldSerializer(serializers.Serializer):
"""
Extends a ModelSerializer to render any CustomFields and their values associated with an object.
"""
custom_fields = serializers.Serialize... | 2.28125 | 2 |
src/sensor.py | dizzyrobin/rpi-trigger | 0 | 12789756 | import Adafruit_DHT
import requests
from time import sleep
req_url = 'http://localhost:7777/'
sensor = Adafruit_DHT.DHT22
pin = 4
def createRequestData(temperature, humidity, electricalOutlet):
json = '''{{ "temperature": {}, "humidity": {}, "electricalOutlet": {} }}'''
return json.format(temperature, humidit... | 2.9375 | 3 |
main2.py | abdoulaye2019/BokehViz | 0 | 12789757 | <reponame>abdoulaye2019/BokehViz<filename>main2.py
from tkinter import Label
from bokeh.plotting import figure, output_file,save, show, ColumnDataSource
from bokeh.models.tools import HoverTool
from bokeh.transform import factor_cmap
from bokeh.palettes import Blues8
from bokeh.embed import components
import pandas as ... | 2.96875 | 3 |
.leetcode/647.palindromic-substrings.py | KuiyuanFu/PythonLeetCode | 0 | 12789758 | # @lc app=leetcode id=647 lang=python3
#
# [647] Palindromic Substrings
#
# https://leetcode.com/problems/palindromic-substrings/description/
#
# algorithms
# Medium (63.36%)
# Likes: 5179
# Dislikes: 144
# Total Accepted: 329.3K
# Total Submissions: 518.4K
# Testcase Example: '"abc"'
#
# Given a string s, retur... | 3.796875 | 4 |
bobbot/search_node.py | TheCheapestPixels/bobbot | 1 | 12789759 | <filename>bobbot/search_node.py<gh_stars>1-10
class SearchNode:
"""Implements expansion of new nodes, and merging of instances of
nodes, which may be required after the same state has been
reached via two or more different routes of search tree
expansion.
Public methods: .expand(), .post_expansio_in... | 3.21875 | 3 |
mne/time_frequency/__init__.py | jaeilepp/eggie | 0 | 12789760 | <reponame>jaeilepp/eggie
"""Time frequency analysis tools
"""
from .tfr import induced_power, single_trial_power, morlet, tfr_morlet
from .tfr import AverageTFR
from .psd import compute_raw_psd, compute_epochs_psd
from .csd import CrossSpectralDensity, compute_epochs_csd
from .ar import yule_walker, ar_raw, iir_filter... | 1.15625 | 1 |
tests/test_pipeline.py | coralproject/atoll | 12 | 12789761 | import unittest
from atoll import Pipeline
def lowercase(x):
return x.lower()
def tokenize(x, delimiter=' '):
return x.split(delimiter)
def word_counter(x):
return len(x)
def count_per_key(value):
return len(value)
def add(x, y):
return x + y
def make_list(x):
return ['a', x]
class Pipe... | 3.15625 | 3 |
farm_management/users/views/__init__.py | alexanders0/farm-management | 1 | 12789762 | <gh_stars>1-10
from .users import UserViewSet
| 1.007813 | 1 |
projects/planetTest/planetTest.py | Aceheliflyer/Computer-Science | 0 | 12789763 | <gh_stars>0
import math
# Settings ##################
app.background = 'black'
app.stepsPerSecond = 60 # The framerate of the app.
app.steps = 0 # The default steps.
obj = {
'sun': Circle(app.centerX, app.centerY, 25, fill=gradient('darkRed', 'yellow')),
'plt': Circle(325, 200, 12.5, fill='skyblue'),
'mun'... | 2.546875 | 3 |
tests/test_app.py | wghou/BeeVeeH | 11 | 12789764 | import os
import BeeVeeH
import pytest
BVH_DIR = '%s/bvh_files' % os.path.dirname(__file__)
class TestCase():
def test_bvh_play(self):
file_path = '%s/0007_Cartwheel001.bvh' % BVH_DIR
if not BeeVeeH.start(file_path, test=True):
pytest.skip('Cannot launch the app due to SystemExit, reas... | 2.140625 | 2 |
flow-tools-analysis/gen_data_input_flows_behavior_metrics.py | spoofer-ix/spoofer-ix | 2 | 12789765 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from os import sys, path
sys.path.append(path.abspath(path.join(path.dirname(__file__), '..')))
import utils.multiprocessing_poll as mpPool
import utils.geolocation_utilities as geoutil
import utils.prefixes_utilities as putil
import utils.constants as cons
import utils.fi... | 2.203125 | 2 |
pages/urls.py | mena-hub/social_site | 0 | 12789766 | <filename>pages/urls.py
from django.urls import path
from pages.views import PageListView, PageDetailView, PageCreateView, PageDeleteView, PageUpdateView
pages_patterns = ([
path('', PageListView.as_view(), name='pages'),
path('<int:pk>/<slug:slug>/', PageDetailView.as_view(), name="page"),
path('create/',... | 2.125 | 2 |
databass/compile/scan.py | ivychen/databass-public | 6 | 12789767 | from ..ops import GroupBy
from .translator import *
class SubQueryTranslator(Translator):
def __init__(self, *args, **kwargs):
super(SubQueryTranslator, self).__init__(*args, **kwargs)
def produce(self, ctx):
self.child_translator.produce(ctx)
def consume(self, ctx):
self.parent_translator.consume(... | 2.578125 | 3 |
ptsr/data/srdata.py | Weepingchestnut/rcan-it | 0 | 12789768 | <reponame>Weepingchestnut/rcan-it
import os
import glob
import random
import pickle
from ptsr.data import common
from ptsr.utils.utility import calc_psnr_numpy
import numpy as np
import imageio
from skimage.transform import resize
import torch
import torch.utils.data as data
class SRData(data.Dataset):
def __in... | 2.125 | 2 |
primes/misc/events.py | pyrustic/primes | 0 | 12789769 | class Events:
user_submit_number = "user submit number"
user_click_stop = "user click stop"
user_click_clear = "user click clear"
user_click_exit = "user click exit"
host_send_prime = "host send prime"
core_end_computation = "core end computation"
gui_end_displaying = "gui end displaying"
| 1.515625 | 2 |
homeassistant/components/loopenergy/__init__.py | domwillcode/home-assistant | 23 | 12789770 | <gh_stars>10-100
"""The loopenergy component."""
| 0.863281 | 1 |
painterfun.py | AdamRuddGH/opencv_image_repainter | 83 | 12789771 | print('importing packages...')
import numpy as np
import cv2
import math
import random
import time
import rotate_brush as rb
import gradient
from thready import amap
import os
import threading
canvaslock = threading.Lock()
canvaslock.acquire()
canvaslock.release()
def lockgen(canvas,ym,yp,xm,xp):
# given roi, kno... | 2.453125 | 2 |
snapx/setup.py | ruth-ann/snap-python | 242 | 12789772 | from setuptools import setup, find_packages
if __name__ == "__main__":
setup(
name="snapx",
author="<EMAIL>",
version="0.0.1",
packages=find_packages(),
description="""SnapX: An experimental SNAP API with NetworkX-like interface"""
)
| 1.40625 | 1 |
WX_backend/RESTful_backend.py | StuGRua/Flask_WXAPP_SSDUTHelper | 0 | 12789773 | <filename>WX_backend/RESTful_backend.py
import datetime
from flask import jsonify, abort, request
from flask import url_for
from model.model import *
# WX_APPID = 'wx933173854a5a9ba2'
# WX_SECRET = '<KEY>'
# 具体导入配
# 根据需求导入仅供参考
@app.route('/api/what', methods=['GET'])
def what_info():
return "无内鬼"
@app.route... | 2.625 | 3 |
diff.py | yakomak/pth1 | 0 | 12789774 |
# --- dD3MA2 ---
import tkinter as tk
from tkinter import ttk
# Определение столбцов
tree=ttk.Treeview(master)
tree["columns"]=("one","two","three")
tree.column("#0", width=270, minwidth=270, stretch=tk.NO)
tree.column("one", width=150, minwidth=150, stretch=tk.NO)
tree.column("two", width=400, minwidth=200)
tree.c... | 3 | 3 |
tests/integration/test_company.py | orikalinski/python-intercom | 0 | 12789775 | # -*- coding: utf-8 -*-
import os
import unittest
from intercom.client import Client
from . import delete_company
from . import delete_user
from . import get_or_create_user
from . import get_or_create_company
from . import get_timestamp
intercom = Client(
os.environ.get('INTERCOM_PERSONAL_ACCESS_TOKEN'))
class ... | 2.625 | 3 |
webserver/contest/models.py | theSage21/judge-interface | 3 | 12789776 | from socket import create_connection
from django.db import models
from django.utils import timezone
class Slave(models.Model):
def __str__(self):
return self.ip + str(self.port)
ip = models.GenericIPAddressField()
port = models.IntegerField()
busy = models.BooleanField(default=False)
def... | 2.453125 | 2 |
Pset4_hand_in/Rep_agent_labor2.py | SkanderGar/QuantMacro | 0 | 12789777 | import numpy as np
from numpy import vectorize
import scipy.optimize as so
@vectorize
def U(c, h, kappa, nu):
if c<=0:
u = -np.inf
elif c>0:
u = np.log(c) - (kappa*h**(1+1/nu))/((1+1/nu))
return u
class rep_ag:
def __init__(self, theta, beta, delta, kappa, nu, kmin, kmax, ... | 2.515625 | 3 |
towhee/tests/engine/test_pipeline.py | NbnbZero/towhee | 1 | 12789778 | # Copyright 2021 Zilliz. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agree... | 2.046875 | 2 |
apis_core/apis_entities/views.py | sviatoplok/apis-core | 1 | 12789779 | <reponame>sviatoplok/apis-core
# -*- coding: utf-8 -*-
import json
import reversion
from reversion_compare.views import HistoryCompareDetailView
from reversion.models import Version
from django.shortcuts import render, redirect, get_object_or_404
from django.urls import reverse_lazy
from django.contrib.auth.decorators... | 1.523438 | 2 |
announcements/label.py | CMU-Robotics-Club/roboticsclub.org | 0 | 12789780 | <filename>announcements/label.py
from django.core.urlresolvers import reverse
from django.contrib.sites.models import Site
from django.utils.text import slugify
from crm.label import Label
def create_announcement_label(announcement):
label = Label()
org_start, org_end = label.add_text("#000000", (0,0), "Roboto-Thi... | 2.328125 | 2 |
lec06_class/class 03.py | SOOIN-KIM/lab-python | 0 | 12789781 | '''
클래스 작성, 객체 생성, 메소드 사용 연습
'''
class Employee:
'''
field: empno, ename, salary, deptno
method : raise salary(self, pct)
'''
def __init__(self,empno, ename, salary, deptno):
self.empno = empno
self.ename = ename
self.salary = salary
self.deptno = deptno
def rai... | 4.09375 | 4 |
pyaz/sql/mi/__init__.py | py-az-cli/py-az-cli | 0 | 12789782 | <filename>pyaz/sql/mi/__init__.py<gh_stars>0
'''
Manage SQL managed instances.
'''
from ... pyaz_utils import _call_az
from . import ad_admin, ad_only_auth, key, op, tde_key
def create(name, resource_group, subnet, admin_password=None, admin_user=None, assign_identity=None, backup_storage_redundancy=None, capacity=No... | 2.046875 | 2 |
b3j0f/sync/store/registry.py | b3j0f/sync | 1 | 12789783 | <gh_stars>1-10
# -*- coding: utf-8 -*-
# --------------------------------------------------------------------
# The MIT License (MIT)
#
# Copyright (c) 2014 <NAME> <<EMAIL>>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Soft... | 1.429688 | 1 |
deepwto/graphql.py | DeepWTO/deepwto-dataset-explore | 1 | 12789784 | <gh_stars>1-10
from typing import Union, List
import requests
import json
from deepwto.constants import available_ds, available_article, cited_by_ds
class AppSyncClient:
latest_version = "1.0.0"
available_ds_num = len(available_ds)
available_ds = available_ds
available_article_num = len(available_a... | 2.390625 | 2 |
experiments/helpers/os_utils.py | Project-Ellie/capsnet-fashion | 1 | 12789785 | import tensorflow as tf
import platform
def os_info():
return {
'machine': platform.machine(),
'node': platform.node(),
'os': platform.platform(),
'cuda': tf.test.is_built_with_cuda()
}
| 1.882813 | 2 |
utils.py | jroivas/klapi | 3 | 12789786 | <reponame>jroivas/klapi
import random
import string
import uuid
def generatePassword(characters=8):
# Disabling 0 and O to prevent misreadings
return ''.join(random.SystemRandom().choice(string.letters.replace('O','') + string.digits.replace('0','')) for _ in range(characters))
def generateID():
return st... | 2.8125 | 3 |
Run.py | austinjcheng/chatterbox | 3 | 12789787 | <filename>Run.py
import string
from Read import getUser, getMessage
from Initialize import createUsers, switchUser, startRooms
from Settings import usernames
import threading
from GUI import GUI
def refreshMessages():
from Initialize import users, currentUserIndex
readbuffer = ""
while True:
readb... | 2.71875 | 3 |
tests/test_studies.py | asteriogonzalez/pytest-study | 3 | 12789788 | <reponame>asteriogonzalez/pytest-study
import pytest
import time
# make some 'alias'
study = pytest.mark.study
pre = pytest.mark.pre
# You can put the regular tests and the studies in any order
# pytest-study will reorder later
def test_independent():
"A regular isolated test"
time.sleep(0.05)
# test marke... | 2.78125 | 3 |
examples/case1/case2_mpc.py | JavierArroyoBastida/forecast-gen | 1 | 12789789 | <filename>examples/case1/case2_mpc.py
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import logging
import os
import time
from statsmodels.tsa.stattools import acf
from scipy.stats import norm
import mshoot
from fcastgen import error
# Set up logging
logging.basicConfig(filename='mpc_case1.l... | 2.09375 | 2 |
algoritmo.py | jorgemauricio/procesamiento_he5 | 0 | 12789790 | <filename>algoritmo.py
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
#######################################
# Script que permite la generación
# automática de mapas de particulas en el
# aire
# Author: <NAME>
# Email: <EMAIL>
# Date: Created on Thu Sep 28 08:38:15 2017
# Version: 1.0
#############################... | 1.90625 | 2 |
pywps/application.py | kvold/pywps | 1 | 12789791 | <reponame>kvold/pywps
from pywps.app.Service import Service
def make_app(processes=None, cfgfiles=None):
app = Service(processes=processes, cfgfiles=cfgfiles)
return app
| 1.382813 | 1 |
tests/python/test_dataflow.py | tlemo/nwcpp_pybind11 | 0 | 12789792 |
import unittest
import nwcpp
class VariablesTestCase(unittest.TestCase):
def test_variable_declarations(self):
dag = nwcpp.Dataflow()
a = dag.declare_variable('a')
with self.assertRaises(RuntimeError):
# duplicate name
dag.declare_variable('a')
b = dag.decl... | 3 | 3 |
23_yolov3-nano/01_float32/03_weight_quantization.py | khanfarhan10/PINTO_model_zoo | 1,529 | 12789793 | ### tf-nightly-2.2.0.dev20200418
import tensorflow as tf
# Weight Quantization - Input/Output=float32
converter = tf.lite.TFLiteConverter.from_saved_model('./saved_model')
converter.optimizations = [tf.lite.Optimize.OPTIMIZE_FOR_SIZE]
converter.target_spec.supported_ops = [tf.lite.OpsSet.TFLITE_BUILTINS,tf.lite.OpsSe... | 2.453125 | 2 |
janch/components/__init__.py | taarimalta/janch | 0 | 12789794 | <reponame>taarimalta/janch<gh_stars>0
"""This modules contains code that enable the components of the Janch config file
"""
from janch.components.formatters import get_default_formatters
from janch.components.gatherers import get_default_gatherers
from janch.components.inspectors import get_default_inspectors
from jan... | 1.515625 | 2 |
dspftwplot/plot_complex.py | dspftw/dspftwplot | 0 | 12789795 | # vim: expandtab tabstop=4 shiftwidth=4
from numpy import ndarray
import matplotlib.pyplot as plt
def plot_complex(*args, **kwargs):
'''
Plots complex data in the complex plane.
Parameters
----------
args: array_like
The complex arrays to plot
kwargs: dict
Parameters passed t... | 2.71875 | 3 |
config.py | kibetrono/Blogging-Website | 0 | 12789796 | <filename>config.py
import os
class Config:
'''General configuration parent class'''
SQLALCHEMY_DATABASE_URI='postgresql+psycopg2://kibet:KibetFlask@localhost/ownblog'
SECRET_KEY ='FlSkPItchA@*ppL&iCA^$tio***n'
# email configurations
MAIL_SERVER = 'smtp.googlemail.com'
MAIL_PORT = 587
MAI... | 2.40625 | 2 |
module_06/src/pages/checkout_first.py | AngieGarciaT/2021_python_selenium | 0 | 12789797 | """Implements sauce lab login checkout first step."""
from enum import Enum
from selenium.webdriver.remote.webdriver import WebDriver
from module_06.src.elements.base_page_element import BasePageElement
from module_06.src.elements.header import Header
from module_06.src.elements.inventory_items import InventoryItems
fr... | 2.28125 | 2 |
tests/simple/test_simple.py | iklasky/timemachines | 253 | 12789798 | <gh_stars>100-1000
from timemachines.skaters.simple.movingaverage import precision_ema_ensemble, aggressive_ema_ensemble
SIMPLE_TO_TEST = [ precision_ema_ensemble, aggressive_ema_ensemble ]
from timemachines.inclusion.sklearninclusion import using_sklearn
if using_sklearn:
from timemachines.skatertools.evaluatio... | 2.015625 | 2 |
setup.py | YasielCabrera/dj-graphene | 0 | 12789799 | <filename>setup.py
from setuptools import setup
with open('README.md') as f:
long_description = f.read()
setup(
name = 'dj-graphene',
packages = ['dj_graphene'],
version = '0.0.2-b.2',
license='MIT',
description = 'A graphene-django wrapper to do stuffs in the Django way 💃🕺',... | 1.289063 | 1 |
grab/spider/base.py | mawentao007/reading_grab | 0 | 12789800 | <filename>grab/spider/base.py
#coding:utf-8
from __future__ import absolute_import
import types
import logging
import time
try:
from urlparse import urljoin
except ImportError:
from urllib.parse import urljoin
from random import randint
try:
import Queue as queue
except ImportError:
import queue
from co... | 2.078125 | 2 |
cgi-bin/request/grx_rings.py | jamayfieldjr/iem | 1 | 12789801 | #!/usr/bin/env python
"""Author: <NAME>"""
import math
import cgi
from pyiem.util import ssw
def createCircleAroundWithRadius(lat, lon, radiusMiles):
"""Create circle."""
latArray = []
lonArray = []
for brng in range(0, 360):
lat2, lon2 = getLocation(lat, lon, brng, radiusMiles)
latA... | 3.390625 | 3 |
app/database/api/test/test_with_lunar_sortie_data.py | space-logistics-org/spacenet | 1 | 12789802 | <reponame>space-logistics-org/spacenet<gh_stars>1-10
"""
This module contains tests for API routes via the lunar sortie data.
"""
import pytest
from fastapi.testclient import TestClient
from app.database.api.database import get_db
from app.database.api.main import app
from app.auth_dependencies import current_user
fro... | 2.1875 | 2 |
run.py | LeoTheBestCoder/wordle-solver | 5 | 12789803 | from random import randint as rint
from sys import stderr, exit
wordlist = []
GREEN, YELLOW, GRAY = ('0', '1', '2')
def info():
"""
Wordle Game Solver
https://www.nytimes.com/games/wordle/index.html
Created by Leo (<NAME>), 2022
Any sugg... | 3.453125 | 3 |
src/__main__.py | Nalhin/Econometrics | 0 | 12789804 | import pandas as pd
from .ols_estimator import OLSEstimator
ols = OLSEstimator(pd.read_csv("./data/listings_summary.csv"))
ols.clean_data()
ols.calculate_models()
ols.output_latex()
| 2.328125 | 2 |
cobald_tests/controller/test_relative_supply.py | maxfischer2781/cobald | 7 | 12789805 | <reponame>maxfischer2781/cobald
import pytest
from cobald.controller.relative_supply import RelativeSupplyController
from ..mock.pool import MockPool
class TestRelativeSupplyController(object):
def test_low_scale(self):
pool = MockPool()
with pytest.raises(Exception):
RelativeSupplyCo... | 2.328125 | 2 |
tests/model/test_fencer.py | zoldello/fencing | 0 | 12789806 | <filename>tests/model/test_fencer.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Tests for `model/fencing` package."""
from model.fencer import Fencer
#from __future__ import absolute_import
#import unittest
#import imp
#foo = imp.load_source('Fencer', 'fencing/model/fencer.py')
class TestFencing(unittest.Te... | 3.0625 | 3 |
lr-bbs-server/server/commands.py | scott306lr/network_programming | 0 | 12789807 | import dataparser as dp
import sqlite3
import os.path
import re
from datetime import date
'''
{
"boardName1":{
"post1_SN":[SN,board,title,author,date,content]
"post2_SN":[SN,board,title,author,date,content]
}
"boardName2":{
"post1_SN":[SN,boar... | 2.953125 | 3 |
q2_api_client/clients/v3/authentication_client.py | jcook00/q2-api-client | 0 | 12789808 | from q2_api_client.clients.base_q2_client import BaseQ2Client
from q2_api_client.endpoints.v3_endpoints import AuthenticationEndpoint
class AuthenticationClient(BaseQ2Client):
def keep_alive(self):
"""GET /v3/keepalive
:return: Response object
:rtype: requests.Response
"""
... | 2.6875 | 3 |
software/old_stuff/other/sleep_tester.py | 84ace/esp32_smart_keezer | 1 | 12789809 | <gh_stars>1-10
from machine import Pin, deepsleep, reset_cause, DEEPSLEEP_RESET
from time import sleep
print("running")
sys_ok_led = Pin(25, Pin.OUT, Pin.PULL_UP)
sys_ok_led.value(1)
sys_ok_led.PULL_HOLD
sleep(2)
sys_ok_led = Pin(25, Pin.OUT)
sys_ok_led.PULL_UP
sys_ok_led.value(1)
sys_ok_led.PULL_HOLD
print("sleeping"... | 2.484375 | 2 |
datasets/pcapframeparser.py | mihsamusev/pytrl_demo | 5 | 12789810 | <reponame>mihsamusev/pytrl_demo
from struct import unpack
import dpkt
from .dataentities import Packet,LaserFiring,Frame
import numpy as np
class PcapFrameParser:
def __init__(self, pcap_file):
# check if PCAP file is really .pcap
self.pcap_file = pcap_file
self.packetStream = dpkt.pcap.Rea... | 2.46875 | 2 |
enaml/qt/editor/qt_ace_editor.py | mmckerns/enaml | 11 | 12789811 | from PySide.QtCore import QObject, Signal, Slot
from string import Template
import os
EVENT_TEMPLATE = Template("""
py_${func} = function() {
py_ace_editor.${func}(${args});
}
editor.${target}.on("${event_name}", py_${func});
""")
BINDING_TEMPLATE = Template("""
py_ace_editor.${signal}.connect... | 2.390625 | 2 |
saulscript/syntax_tree/syntax_tree.py | lysol/saulscript | 0 | 12789812 | import logging
import nodes
from .. import exceptions
from ..lexer import tokens
import traceback
import sys
class SyntaxTree(object):
def _debug(self, text, *args):
if type(text) != str:
text = repr(text)
logging.debug(("<Line %d, Token %d> " % (self.line_num, self.token_counter)) + t... | 2.90625 | 3 |
xxmaker/gamepart/Paper.py | pijll/xxmaker | 0 | 12789813 | import Colour
import Font
import OutputFunctions
from Definitions import *
from graphics.cairo import Draw
from math import ceil
from graphics.cairo.Draw import FillStyle, TextStyle
class Paper:
def __init__(self, width=63*mm, height=39*mm, marker=None):
self.width = width
self.height = height
... | 3.15625 | 3 |
config.py | xsy2004/DH-TelegramBot | 12 | 12789814 | <filename>config.py<gh_stars>10-100
import os
ENV = bool(os.environ.get('ENV', False))
if ENV:
TOKEN = os.environ.get("TOKEN", None)
BanMeReplayAddress = os.environ.get("BanMeReplayAddress", None)
api_id = os.environ.get("api_id", None)
api_hash = os.environ.get("api_hash", None)
BOT_NAME = os.envi... | 1.828125 | 2 |
lec3.py | dbutler20/ISAT252Lab1Butler | 0 | 12789815 | """
Lecture 3 notes 5/20
"""
| 1.859375 | 2 |
core.py | Arturok/multiprocesador | 0 | 12789816 | import cacheL1
import cacheL1Controller
import clock
import threading
import random
from time import sleep
class core:
isa = ['read', 'write', 'calc']
state = 'awake'
class processor(threading.Thread):
countInstructions = 1
processTime = 1
def __init__(self, coreID, chipID, clock... | 3.09375 | 3 |
models/endstation.py | stuartcampbell/osiris-api | 0 | 12789817 | from typing import Optional
from pydantic.main import BaseModel
from models.instrument import Instrument
| 1.125 | 1 |
web/app/djrq/model/ampache/listeners.py | bmillham/djrq2 | 1 | 12789818 | from . import *
class Listeners(Base):
__tablename__ = "listeners"
id = Column(Integer, primary_key=True)
current = Column(Integer)
max = Column(Integer)
| 2.046875 | 2 |
app/business/admin.py | HenriqueLR/lawyer_business | 2 | 12789819 | <gh_stars>1-10
#coding: utf-8
from django.contrib import admin
from business.models import BusinessModel
class BusinessAdmin(admin.ModelAdmin):
list_display = ('name', 'description')
search_fields = ('name',)
admin.site.register(BusinessModel, BusinessAdmin)
| 1.539063 | 2 |
crypto/crc_forgery/crack.py | skyzh/sjtuctf-2019-writeup | 1 | 12789820 | <filename>crypto/crc_forgery/crack.py
#!/usr/bin/env python3
# coding=utf-8
import binascii
import os
import random
def b2n(b):
res = 0
for i in b:
res *= 2
res += i
return res
def n2b(n, length):
tmp = bin(n)[2:]
tmp = '0'*(length-len(tmp)) + tmp
return [int(i) for i in tmp... | 2.828125 | 3 |
obtain/database.py | dushyantkhosla/python-snippets | 6 | 12789821 | import os
import sqlite3
import pandas as pd
import numpy as np
from .pybash import get_file_info
def connect_to_db(path):
"""
Interact with a SQLite database
Parameters
----------
path: str
Location of the SQLite database
Returns
-------
conn: Connector
The SQLite co... | 3.71875 | 4 |
venv/lib/python3.8/site-packages/cffi/cparser.py | Retraces/UkraineBot | 2 | 12789822 | <reponame>Retraces/UkraineBot<gh_stars>1-10
/home/runner/.cache/pip/pool/ac/ef/f5/a442d1c35808d431359b8822da293924c7e9c68b800022d7a513e55440 | 1.023438 | 1 |
app/general/utils/json/json.py | rafiq10/rrhh_tdd_backend | 0 | 12789823 | import json
from collections import namedtuple
def _json_object_hook(d):
return namedtuple('X', d.keys())(*d.values())
def json2obj(data):
a = json.dumps(data)
return json.loads(a, object_hook=_json_object_hook) | 3.015625 | 3 |
normalization.py | jwieckowski/mcda | 0 | 12789824 | """
script to matrix normalization
"""
from functools import reduce
import math as m
import numpy as np
def minmax_normalization(x, type):
"""
:param x: column of matrix data
:param type: type of normalization
:return: min max normalized column of matrix data
"""
if min(x) == max(x):
... | 3.5 | 4 |
cvat/apps/engine/models.py | ItayHoresh/improvedCvat | 0 | 12789825 | <reponame>ItayHoresh/improvedCvat
# Copyright (C) 2018 Intel Corporation
#
# SPDX-License-Identifier: MIT
from django.db import models
from django.conf import settings
from django.contrib.auth.models import User
from django.contrib.postgres.fields import ArrayField, JSONField
from io import StringIO
from ... | 2.09375 | 2 |
epsilon/hotfixes/loopbackasync_reentrancy.py | palfrey/epsilon | 4 | 12789826 |
"""
Fix from Twisted r23970
"""
from twisted.internet.task import deferLater
from twisted.protocols.loopback import _loopbackAsyncBody
def _loopbackAsyncContinue(ignored, server, serverToClient, client, clientToServer):
# Clear the Deferred from each message queue, since it has already fired
# and cannot be ... | 2.078125 | 2 |
Utils/ContentCheck.py | eurobronydevs/Canni-AI | 1 | 12789827 | import discord
def StrContains(string: str, contains: str) -> bool:
return contains.lower() in string.lower()
def StrStartWith(string: str, startsWith: str) -> bool:
print("String: {0}, type {1}".format(startsWith, type(startsWith)))
return string.lower().startswith(startsWith.lower())
def StrContainsWor... | 3.40625 | 3 |
tests/parser_test.py | mwawrzos/schwab_parser | 0 | 12789828 | <filename>tests/parser_test.py
import pytest
import schwab_parser.parsers as p
def split_csv(txt):
return [row.split(',') for row in txt.strip().splitlines()]
@pytest.fixture
def espp_deposit_lines():
deposit_lines = '''
"Date","Action","Symbol","Description","Quantity"''' \
''',"Fees & Commissions","Disbu... | 2.9375 | 3 |
gtgs/users/migrations/0003_merge_20171204_1603.py | robertatakenaka/gtgs | 0 | 12789829 | # -*- coding: utf-8 -*-
# Generated by Django 1.10.8 on 2017-12-04 18:03
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('users', '0002_auto_20171201_1517'),
('users', '0002_auto_20171204_1549'),
]
operati... | 1.375 | 1 |
hackerearth/Algorithms/Studious Amit and His New College/solution.py | ATrain951/01.python-com_Qproject | 4 | 12789830 | <filename>hackerearth/Algorithms/Studious Amit and His New College/solution.py
"""
# Sample code to perform I/O:
name = input() # Reading input from STDIN
print('Hi, %s.' % name) # Writing output to STDOUT
# Warning: Printing unwanted or ill-formatted data to output will cause the test cases ... | 3.640625 | 4 |
scripts/scrape.py | alexbotello/concert_finder | 1 | 12789831 | <gh_stars>1-10
import json
import sys
import time
import requests
import settings
import logging
from sqlalchemy.orm import sessionmaker
from models import Concert, create_concert_table, db_connect
from utils import post_to_discord
# Initialize Database connections
engine = db_connect()
create_concert_table(engine)
... | 2.640625 | 3 |
outerspace/TransformationMethod.py | sirbiscuit/outerspace | 3 | 12789832 | from abc import ABC, abstractmethod
class TransformationMethod(ABC):
@abstractmethod
def get_widgets(self):
''' Create and return widgets for manipulating the parameters of the
transformation method.
Returns
-------
OrderedDict[str -> ipywidgets.Widget]
A d... | 3.640625 | 4 |
analyse_functions.py | kcotar/Abundance_space_dimensionality | 0 | 12789833 | import os, imp
import matplotlib
if os.environ.get('DISPLAY') is None:
# enables figure saving on clusters with ssh connection
matplotlib.use('Agg')
import matplotlib.pyplot as plt
import numpy as np
imp.load_source('helper', '../tSNE_test/helper_functions.py')
from helper import get_spectra
# ---------------... | 2.265625 | 2 |
SW_stops_amount.py | cesarborroch/Kneat_Challenge | 0 | 12789834 | # Library used to return the content of a URL
from urllib.request import Request, urlopen
# Library to decode text to JSON
import json
class SW_stops_amount:
def __init__(self):
pass
# Decodes the consumables
def calc(self, strConsumables):
intHOURS_IN_YEAR = 8760
int... | 3.890625 | 4 |
examples/Extra_Examples/PDE/Burgers1D.py | leakec/tfc | 15 | 12789835 | <filename>examples/Extra_Examples/PDE/Burgers1D.py
import tqdm
import numpy as onp
import jax.numpy as np
from tfc import mtfc
from tfc.utils import NLLS, egrad
# Constants and switches:
c = 1.
nu = 0.5
xInit = -3.
xFinal = 3.
alpha = 1.
x0 = np.array([xInit,0.])
xf = np.array([xFinal,1.])
n = 30
nTest = 100
m = ... | 2.25 | 2 |
truhanen.serobot.api/truhanen/serobot/api/hardware/gpio.py | truhanen/serobot | 1 | 12789836 | <reponame>truhanen/serobot
from enum import IntEnum, auto
import logging
from typing import Optional, List
try:
import RPi.GPIO as GPIO
except ModuleNotFoundError:
GPIO = None
from .bcm_channel import BcmChannel
class GpioDirection(IntEnum):
IN = GPIO.IN if GPIO is not None else auto()
OUT = GPIO.O... | 2.46875 | 2 |
historic/singleCOUNTYdiffMILES.py | adambreznicky/smudge_python | 1 | 12789837 | # Python 2.6.5 (r265:79096, Mar 19 2010, 21:48:26) [MSC v.1500 32 bit (Intel)] on win32
## Type "copyright", "credits" or "license()" for more information.
# ****************************************************************
# Personal firewall software may warn about the connection IDLE
# makes to its subproce... | 2.40625 | 2 |
sphinx_design/cards.py | OriolAbril/sphinx-design | 43 | 12789838 | import re
from typing import List, NamedTuple, Optional, Tuple
from docutils import nodes
from docutils.parsers.rst import directives
from docutils.statemachine import StringList
from sphinx import addnodes
from sphinx.application import Sphinx
from sphinx.util.docutils import SphinxDirective
from sphinx.util.logging ... | 2.109375 | 2 |
examples/configs_examples/convnet_cifar10.py | polyaxon/polyaxon-lib | 7 | 12789839 | <reponame>polyaxon/polyaxon-lib
# -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function
import polyaxon_lib as plx
from polyaxon_lib.polyaxonfile import local_runner
if __name__ == "__main__":
"""Creates an experiment using cnn for CIFAR-10 dataset classification task.
Refe... | 1.765625 | 2 |
nylas/util/debug.py | nylas/nylas-production-python | 19 | 12789840 | <reponame>nylas/nylas-production-python
import sys
import time
import traceback
import collections
import gevent._threading
import greenlet
from nylas.logging import get_logger
MAX_BLOCKING_TIME = 5
class Tracer(object):
"""Log if a greenlet blocks the event loop for too long, and optionally log
statistics... | 2.5 | 2 |
resqueue/matlab.py | YSanchezAraujo/slurm_handler | 4 | 12789841 | import os
from resqueue import utils
class Matlab(object):
""" very preliminary, initial matlab class
to support matlab computing
"""
def __init__(self, matfile, cmd=None):
self.matfile = matfile
self.cmd = cmd
def _file_exists(self):
if not os.path.isfile(self.matfile... | 2.875 | 3 |
test/fixtures/goldstandard/benchmark_confirm.py | nachogentile/PatentsProcessor | 53 | 12789842 | <gh_stars>10-100
import sqlite3 as sql
import os
import sys
import logging
# bmVerify(['final_r7', 'final_r8'], filepath="/home/ysun/disambig/newcode/all/", outdir = "/home/ayu/results_v2/")
# Text Files
txt_file = 'patentlist.txt'
opened_file = open(txt_file, 'U')
log_file = 'benchmark_results.log'
# Loggi... | 2.765625 | 3 |
examples/generate_soundscapes/generate_eval_var_onset.py | turpaultn/DESED | 69 | 12789843 | <reponame>turpaultn/DESED<filename>examples/generate_soundscapes/generate_eval_var_onset.py
# -*- coding: utf-8 -*-
import functools
import glob
import logging
import time
import argparse
import os.path as osp
import pandas as pd
from pprint import pformat
from desed.generate_synthetic import SoundscapesGenerator
from... | 2.203125 | 2 |
Python/easy/e308.py | tlgs/dailyprogrammer | 4 | 12789844 | <reponame>tlgs/dailyprogrammer<gh_stars>1-10
# 27/03/2017
grid = ["########=####/#",
"# | #",
"# # #",
"# # #",
"####### #",
"# _ #",
"###############"]
grid = [[c for c in grid[y]] for y in range(0, len(grid))]
coords = [(... | 3.015625 | 3 |
cgitize/git.py | egor-tensin/cgit-repos | 2 | 12789845 | # Copyright (c) 2021 <NAME> <<EMAIL>>
# This file is part of the "cgitize" project.
# For details, see https://github.com/egor-tensin/cgitize.
# Distributed under the MIT License.
from contextlib import contextmanager
import os
from cgitize import utils
GIT_ENV = os.environ.copy()
GIT_ENV['GIT_SSH_COMMAND'] = 'ssh ... | 2.390625 | 2 |
problem/nearby_zips/tsp/tsp_test.py | jhanley634/testing-tools | 0 | 12789846 | <reponame>jhanley634/testing-tools<gh_stars>0
# Copyright 2018 <NAME>.
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the "Software"),
# to deal in the Software without restriction, including without limitation
# the rights to use... | 1.960938 | 2 |
dtables/funs.py | mianos/dtables | 2 | 12789847 | <filename>dtables/funs.py
import logging
from flask import request
logger = logging.getLogger(__name__)
def vhandler(query, all_tables, dtable, manual_map=False, count=None):
# initialise the reply with the draw item from the request as datatables wants it back
reply = dict(draw=int(request.args['draw']), da... | 2.3125 | 2 |
pynfold/error_calculation.py | vincecr0ft/pynFold | 3 | 12789848 | <filename>pynfold/error_calculation.py
from scipy.linalg import svd, inv
from numpy.linalg import LinAlgError
import numpy as np
import logging
def variance_of_matrix(A):
# -------------------------------- #
# variance is diagonal of (A'A)^-1 #
# From SVD: #
# A = U.S.V' ... | 2.5625 | 3 |
compiler_gym/views/observation.py | LearnCV/CompilerGym | 0 | 12789849 | # Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
from typing import Callable, Dict, List
from gym.spaces import Space
from compiler_gym.service import observation2py, observation_t
from comp... | 2.453125 | 2 |
django_filters/__init__.py | buriy/django-filter | 0 | 12789850 | <reponame>buriy/django-filter
from filterset import FilterSet
from filters import *
| 0.996094 | 1 |