max_stars_repo_path stringlengths 3 269 | max_stars_repo_name stringlengths 4 119 | max_stars_count int64 0 191k | id stringlengths 1 7 | content stringlengths 6 1.05M | score float64 0.23 5.13 | int_score int64 0 5 |
|---|---|---|---|---|---|---|
src/genie/libs/parser/junos/tests/ShowServicesAccountingErrors/cli/equal/golden_output_1_expected.py | balmasea/genieparser | 204 | 12792251 | expected_output = {
"services-accounting-information": {
"v9-error-information": [
{
"interface-name": "ms-9/0/0",
"service-set-dropped": "0",
"active-timeout-failures": "0",
"export-packet-failures": "0",
"flow-crea... | 1.179688 | 1 |
231-power-of-two.py | mvj3/leetcode | 0 | 12792252 | """
Question:
Power of Two
Given an integer, write a function to determine if it is a power of two.
Credits:
Special thanks to @jianchao.li.fighter for adding this problem and creating all test cases.
Performance:
1. Total Accepted: 31274 Total Submissions: 99121 Difficulty: Easy
2. Your runt... | 3.9375 | 4 |
module_question/api/routers.py | NicolasMuras/Lookdaluv | 1 | 12792253 | <reponame>NicolasMuras/Lookdaluv<gh_stars>1-10
from rest_framework.routers import DefaultRouter
from module_question.api.views.module_question_viewsets import QuestionModuleViewSet
from module_question.api.views.general_views import QuestionModuleStatisticsViewSet
router = DefaultRouter()
router.register(r'question_m... | 1.828125 | 2 |
model/MusicalInstrument.py | kerenren/flask-musical-instrument-api | 0 | 12792254 |
class MusicalInstrument:
def __init__(self, color, dimensions, name, manufacturer, model):
self._color = color
self._dimensions = dimensions
self._name = name
self._manufacturer = manufacturer
self._model = model
def play(self):
pass
def get_model(self):
... | 3.234375 | 3 |
tests/CarController.py | sleeyax/PyCmdRouter | 0 | 12792255 | <gh_stars>0
from core.Navigator import Navigator
from tests.car import Car
class CarController:
"""
Example class
"""
def __init__(self):
self.car = Car()
self.logged_in = False
self.nav = Navigator()
self.nav.set_end('>: ')
def show_motd(self):
print("""
+... | 2.984375 | 3 |
gigaspace/tests/fakes/__init__.py | denismakogon/gigaspace-test-task | 0 | 12792256 | __author__ = 'denis_makogon'
| 0.910156 | 1 |
CPAC/longitudinal_pipeline/longitudinal_workflow.py | radiome-lab/C-PAC | 0 | 12792257 | # -*- coding: utf-8 -*-
import os
import copy
import time
import shutil
from nipype import config
from nipype import logging
import nipype.pipeline.engine as pe
import nipype.interfaces.afni as afni
import nipype.interfaces.fsl as fsl
import nipype.interfaces.io as nio
from nipype.interfaces.utility import Merge, Iden... | 1.492188 | 1 |
app.py | herbeeg/famitracker-export-converter | 0 | 12792258 | import sys
import time
import constants
import parser.correct as correct
import parser.export as export
import parser.read as read
class App:
"""
Base container class to divert all export
file conversions and error handling to
their respective packages and
libraries.
"""
def __init__(self... | 3.0625 | 3 |
examples/python/single_bodies/example_meshes_user.py | wpumacay/tysocTerrain | 1 | 12792259 | #!/usr/bin/env python
import sys
import loco
import tinymath as tm
import numpy as np
PHYSICS_BACKEND = loco.sim.PHYSICS_NONE
RENDERING_BACKEND = loco.sim.RENDERING_GLVIZ_GLFW
COM_TETRAHEDRON = [ 1.0 / 3.0, 1.0 / 3.0, 1.0 / 3.0 ]
TETRAHEDRON_VERTICES = [ 0.0 - COM_TETRAHEDRON[0], 0.0 - COM_TETRAHEDRON[1], 0.0 - COM... | 1.820313 | 2 |
replaybuffer/utils.py | mattbev/replaybuffer | 0 | 12792260 | from typing import Iterable, Tuple
def remove_nones(*arrays: Iterable) -> Tuple[Iterable]:
"""
Take inputted arrays that may contain None values, and
return copies without Nones.
Returns:
tuple[Iterable]: New arrays with only non-None values
"""
return tuple([[i for i in array if i is... | 3.59375 | 4 |
setup.py | JudahRockLuberto/mlfinder | 0 | 12792261 | # taken from http://python-packaging.readthedocs.io/en/latest/everything.html and modified a little
from setuptools import setup, find_packages
# random values
__version__ = '0.1.0'
# this part taken from https://github.com/dr-guangtou/riker
with open('requirements.txt') as infd:
INSTALL_REQUIRES = [x.strip('\n'... | 1.65625 | 2 |
enums.py | t-bullock/kassia | 6 | 12792262 | <filename>enums.py
from enum import Enum, auto
class Line(Enum):
RIGHT = auto()
NEXT = auto()
BELOW = auto()
| 2.796875 | 3 |
server.py | nanjakorewa/MK8DRaceRecorder | 1 | 12792263 | from utils import *
import logging
import os
import time
import warnings
import subprocess
from subprocess import PIPE
formatter = '%(levelname)s : %(asctime)s : %(message)s'
logging.basicConfig(filename='mk8d.log', level=logging.INFO, format=formatter)
warnings.simplefilter('ignore')
"""##########################... | 2.21875 | 2 |
phy/cluster/tests/conftest.py | m-beau/phy | 0 | 12792264 | <gh_stars>0
# -*- coding: utf-8 -*-
"""Test fixtures."""
#------------------------------------------------------------------------------
# Imports
#------------------------------------------------------------------------------
from pytest import fixture
from phy.io.array import (get_closest_clusters,
... | 2.328125 | 2 |
accounts/models.py | akhilmaharana/history-and-bookmark-recommendation-app | 0 | 12792265 | <filename>accounts/models.py
from django.db import models
# Create your models here.
class Contact(models.Model):
firstName = models.CharField(max_length=100)
lastName = models.CharField(max_length=100)
countryName = models.CharField(max_length=100)
subject = models.CharField(max_length=100)
class Con... | 2.46875 | 2 |
Python/OS Module/Changing_Directories.py | themohitpapneja/Code_Dump | 0 | 12792266 | from os import *
print(getcwd())
print(listdir('D:\\Users\\Mohit\\PycharmProjects\\PythonLab\\venv'))
print("Current Directory is: ",getcwd())
k=input("Enter Directory Where you want to jump: ")
print("Changing Directory.......")
chdir(k)
print("Current Directory is: ",getcwd())
print("Listing )the directories in curr... | 3.546875 | 4 |
tests/co_sim_io/python/__init__.py | KratosMultiphysics/CoSimIO | 15 | 12792267 | # this is needed for the python unittest discovery | 1.03125 | 1 |
103_三门问题的验证.py | globien/life_python | 18 | 12792268 | # 作者:西岛闲鱼
# https://github.com/globien/easy-python
# https://gitee.com/globien/easy-python
# 验证三门问题(Monty Hall problem)
import random
获奖次数_不换 = 0 # 不换而获奖的计数器
获奖次数_换 = 0 # 换而获奖的计数器
试验次数 = 100000 # 换和不换各做这么多次实验
for i in range(试验次数): # 不换的实验
door_list = ["A","B","C"] # 三扇... | 3.90625 | 4 |
freefolks/migrations/0006_auto_20180602_2354.py | sivaprakashniet/blogger | 0 | 12792269 | # -*- coding: utf-8 -*-
# Generated by Django 1.11 on 2018-06-03 06:54
from __future__ import unicode_literals
from django.db import migrations, models
import django.utils.timezone
class Migration(migrations.Migration):
dependencies = [
('freefolks', '0005_auto_20180602_2334'),
]
operations = [... | 1.757813 | 2 |
tatc/tatc/__init__.py | code-lab-org/tatc | 0 | 12792270 | <reponame>code-lab-org/tatc
from . import analysis
from . import generation
from . import schemas
from . import constants
from . import utils
| 0.855469 | 1 |
project/application/models.py | vicinityh2020/vicinity-vas-energy-monitoring | 0 | 12792271 | from django.db import models
from adapter import models as adapter_models
class SensorUsage(models.Model):
value = models.FloatField()
sensor = models.ForeignKey(adapter_models.Sensor, on_delete=models.CASCADE)
datetime = models.DateTimeField()
@staticmethod
def get_usage_by_day(day, monitors):
... | 2.265625 | 2 |
pySimpleGUI/cookbook/1a_one_shot_win.py | PitPietro/pythonGUI | 1 | 12792272 | <filename>pySimpleGUI/cookbook/1a_one_shot_win.py
import PySimpleGUI as simpleGUI
'''
https://pysimplegui.readthedocs.io/en/latest/cookbook/#recipe-pattern-1a-one-shot-window-the-simplest-pattern
Recipe - Pattern 1A - "One-shot Window" - (The Simplest Pattern)
The One-shot window is one that pops up, collects some da... | 3.5625 | 4 |
game/control.py | JCKing97/Agents4Asteroids | 1 | 12792273 | <reponame>JCKing97/Agents4Asteroids<gh_stars>1-10
import pyglet
import random
from enum import Enum
from math import cos, sin, sqrt
from typing import List, Tuple
from time import time
from apscheduler.schedulers.background import BackgroundScheduler
from game.entities import Asteroid, Particle
from game.agent import... | 2.765625 | 3 |
ESI_request.py | nicoscha/PESI | 0 | 12792274 | import requests
from json import loads
def _args_to_params(kwargs):
"""
Creates a tuple of keyword, value tuples and changes parameter names for ESI
:param kwargs:
:return: ((parameter, value), (parameter, value), ...)
:rtype: tuple
"""
params = ()
for parameter, value in kwargs.items(... | 2.953125 | 3 |
gloomhaven/models/scenario.py | Softyy/gloomhaven-campaign-manager | 0 | 12792275 | <reponame>Softyy/gloomhaven-campaign-manager<filename>gloomhaven/models/scenario.py
from dash_html_components import P
from .scenario_event import ScenarioEvent
class Scenario():
def __init__(self, id, title, requirements=[], anti_requirements=[], party_achievements=[], global_achievements=[], new_locations=[],... | 2.15625 | 2 |
LeetCode/Python3/Math/29. Divide Two Integers.py | WatsonWangZh/CodingPractice | 11 | 12792276 | <reponame>WatsonWangZh/CodingPractice<filename>LeetCode/Python3/Math/29. Divide Two Integers.py
# Given two integers dividend and divisor, divide two integers
# without using multiplication, division and mod operator.
# Return the quotient after dividing dividend by divisor.
# The integer division should truncate towa... | 3.921875 | 4 |
_scripts/Iris.py | reyannlarkey/reyannlarkey.github.io | 1 | 12792277 | ''' Present an interactive function explorer with slider widgets.
Scrub the sliders to change the properties of the ``sin`` curve, or
type into the title text box to update the title of the plot.
Use the ``bokeh serve`` command to run the example by executing:
bokeh serve sliders.py
at your command prompt. Then nav... | 3.0625 | 3 |
tesseract_recognize_api.py | mauvilsa/tesseract-recognize | 34 | 12792278 | #!/usr/bin/env python3
"""Command line tool for the tesseract-recognize API server."""
"""
@version $Version: 2020.01.13$
@author <NAME> <<EMAIL>>
@copyright Copyright(c) 2017-present, <NAME> <<EMAIL>>
@requirements https://github.com/omni-us/pagexml/releases/download/2019.10.10/pagexml-2019.10.10-cp36-cp36m-linux_x8... | 1.914063 | 2 |
models/entity.py | sebastian-quintero/school-bus-router | 2 | 12792279 | <filename>models/entity.py
from typing import Dict, Any
from models.location import Location
class Entity:
"""Class that represents an abstract Entity with standard methods"""
@classmethod
def from_dict(cls, entity_dict: Dict[str, Any]):
"""Method to instantiate an Entity from a Dict (JSON)"""
... | 3.265625 | 3 |
AIO/invasion/test.py | eddiegz/Personal-C | 3 | 12792280 | <filename>AIO/invasion/test.py<gh_stars>1-10
infile=open('invin.txt','r').readlines()
r,c=map(int,infile[0].split())
line,name=infile[1:],{}
for i in range(r):
for j in range(c-1):
ce1,ce2=line[i][j],line[i][j+1]
if ce1!=ce2:
if ce1 not in name:name[ce1]=[ce2]
if ce2 not in n... | 2.578125 | 3 |
pong_game.py | LouisPlisso/lfi | 0 | 12792281 | <filename>pong_game.py
# Simple pong game - don't let the ball hit the bottom!
# KidsCanCode - Intro to Programming
from tkinter import *
import random
import time
# Define ball properties and functions
class Ball:
def __init__(self, canvas, color, size, paddle):
self.canvas = canvas
self.paddle = ... | 4.25 | 4 |
client/tests/communication/on_board_test.py | beehive-lab/DFLOW | 1 | 12792282 | import unittest
from unittest.mock import (
patch,
MagicMock
)
from client.communication.messages import MessageCommand
from client.communication.on_board import OnBoard, IncomingMessageHandler
class OnBoardTest(unittest.TestCase):
"""
A suite of tests surrounding the OnBoard class functionality.
... | 3.03125 | 3 |
lib/forms.py | plastr/extrasolar-game | 0 | 12792283 | # Copyright (c) 2010-2011 Lazy 8 Studios, LLC.
# All rights reserved.
# Contains utilities for working with HTML form data.
def fetch(request, fields, blanks=[]):
""" Extremely rudimentary validation simply checks whether the
fields are present and non-empty in the POST parameters. """
values = {}
ok =... | 2.5 | 2 |
cloudinitd/exceptions.py | buzztroll/cloudinit.d | 0 | 12792284 | <gh_stars>0
import traceback
import sys
import os
class CloudInitDException(Exception):
def __init__(self, ex):
self._base_ex = ex
exc_type, exc_value, exc_traceback = sys.exc_info()
self._base_stack = traceback.format_tb(exc_traceback)
def __str__(self):
return str(self._bas... | 2.28125 | 2 |
tests/conftest.py | MrThearMan/django-admin-data-views | 0 | 12792285 | import pytest
from django.contrib.auth.models import User
from django.test import Client
@pytest.fixture(scope="session")
def superuser(django_db_setup, django_db_blocker) -> User:
with django_db_blocker.unblock():
user: User = User.objects.get_or_create(
username="x",
em... | 2.078125 | 2 |
module2-oop-code-style-and-reviews/packaging/setup.py | llpk79/DS-Unit-3-Sprint-1-Software-Engineering | 1 | 12792286 | import setuptools
with open('README.md', 'r') as fh:
long_description = fh.read()
setuptools.setup(
name='lambdata-pkutrich',
version='0.0.4',
author='<NAME>',
author_email='<EMAIL>',
description='Some very basic DataFrame tools.',
long_description=long_description,
long_description_co... | 1.335938 | 1 |
polls/views.py | camnpr/django-polls | 0 | 12792287 | <gh_stars>0
from django.shortcuts import render
# Create your views here.
from django.http import HttpResponse, HttpResponseRedirect, Http404
# from django.template import loader
from django.shortcuts import render #, get_object_or_404
from django.urls import reverse
from django.utils import timezone
from django.view... | 2.25 | 2 |
tools/prepare_rawdata.py | Vanova/cakechat | 0 | 12792288 | import json
def check_json(line):
try:
json.loads(line.strip()[:-1])
except ValueError:
print('Skipped invalid json object: %s' % line.strip())
in_file = '../data/raw_data/TrainingFinal.txt'
dialogs = []
cnt = 0
with open(in_file) as f:
buf = []
for line in f:
line = line.st... | 2.859375 | 3 |
resources/migrations/0028_purpose_public.py | suutari-ai/respa | 1 | 12792289 | <reponame>suutari-ai/respa<filename>resources/migrations/0028_purpose_public.py
# -*- coding: utf-8 -*-
# Generated by Django 1.9 on 2016-01-07 12:18
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('resources', '00... | 1.328125 | 1 |
python-structures-presentation/code/for_else.py | iz4vve-talks/misc-training | 0 | 12792290 | #!/usr/bin/env python
# START OMIT
for i in range(4):
if i == 2:
print("Skipping: %d" % i)
# the continue keyword lets you skip an iteration
continue
print(i)
else:
print("Done...")
print("\nBreak loop")
for i in range(4):
if i == 2:
print("break")
# the break b... | 4.09375 | 4 |
open/core/betterself/views/activity_log_views.py | lawrendran/open | 105 | 12792291 | from open.core.betterself.models.activity_log import ActivityLog
from open.core.betterself.serializers.activity_log_serializers import (
ActivityLogReadSerializer,
ActivityLogCreateUpdateSerializer,
)
from open.core.betterself.views.mixins import (
BaseGetUpdateDeleteView,
BaseCreateListView,
)
class ... | 1.820313 | 2 |
telegram_bot_api/schemas/OrderInfoSchema.py | IsVir/telegram-bot-api | 0 | 12792292 | <gh_stars>0
from marshmallow import Schema, fields
class OrderInfoSchema(Schema):
name = fields.Str()
phone_number = fields.Str()
email = fields.Str()
shipping_address = fields.Nested('ShippingAddressSchema')
| 2.171875 | 2 |
profiler/app/od.py | rekords-uw/Profiler-public | 0 | 12792293 | <reponame>rekords-uw/Profiler-public<filename>profiler/app/od.py
from abc import ABCMeta, abstractmethod
from sklearn.covariance import EllipticEnvelope
from sklearn.ensemble import IsolationForest
from sklearn.neighbors import LocalOutlierFactor
from sklearn import svm
from profiler.utility import GlobalTimer
from pro... | 2.0625 | 2 |
src/mechanics/intercept.py | nrbabcock/HeartOfGold | 0 | 12792294 | from rlutilities.simulation import Car, Ball
from rlutilities.linear_algebra import *
from analysis.throttle import *
from analysis.boost import *
from analysis.jump import *
from rlbot.agents.base_agent import SimpleControllerState
from rlbot.utils.game_state_util import CarState
from util.drive import steer_toward_ta... | 2.6875 | 3 |
pytest_hc-sr04/test_hc-sr04.py | Kyokko-OB-Team/deviceDriver_HC-SR04 | 0 | 12792295 | <reponame>Kyokko-OB-Team/deviceDriver_HC-SR04<gh_stars>0
#!/usr/bin/env python3
import ctypes
import fcntl
import os
import time
import linux
TEST_HCSR04_MAJ_VER = "1"
TEST_HCSR04_MIN_VER = "0"
DEVICE_FILE = "/dev/hc_sr040"
class DATA(ctypes.Structure):
_fields_ = [
("value", ctypes.c_uint),
("status", ct... | 2.125 | 2 |
backend/pages/tests/test_site_configuration.py | draihal/main-pr | 2 | 12792296 | import pytest
from django.test import TestCase
from .. import factories
@pytest.mark.django_db
class SiteConfigurationTest(TestCase):
def setUp(self):
self.site_configuration = factories.SiteConfigurationFactory()
def test__str__(self):
assert self.site_configuration.__str__() == self.site... | 2.28125 | 2 |
simulator/ui/tempg.py | ondiiik/meteoink | 2 | 12792297 | <filename>simulator/ui/tempg.py<gh_stars>1-10
from ui import UiFrame, Vect, BLACK, WHITE, YELLOW
from micropython import const
from config import temp
class UiTempGr(UiFrame):
def __init__(self, ofs, dim):
super().__init__(ofs, dim)
self.temp_min = 273.0
def draw(self, ... | 2.890625 | 3 |
display-youtube-subscriber-count.py | akadir/my-bitbar-plugins | 2 | 12792298 | <filename>display-youtube-subscriber-count.py<gh_stars>1-10
#!/usr/bin/python
# -*- coding: utf-8 -*-
import urllib2
from bs4 import BeautifulSoup
account_name = "besiktas"
url = "https://www.youtube.com/" + account_name
req = urllib2.Request(url)
req.add_header('User-agent', 'Mozilla/5.0\
(Windows NT 6... | 3.234375 | 3 |
Code_Challenges/fizz_buzz.py | fuse999/Python_Sandbox | 0 | 12792299 | <filename>Code_Challenges/fizz_buzz.py
def fizz_buzz(num):
return "Fizz"*(num%3==0) + "Buzz"*(num%5==0) or str(num) | 3.078125 | 3 |
Day-09_Smoke-Basin/tests/test_day_09.py | richardangell/advent-of-code-2021 | 0 | 12792300 | <filename>Day-09_Smoke-Basin/tests/test_day_09.py<gh_stars>0
import numpy as np
import pytest
import puzzle_1
import puzzle_2
class TestPuzzle1:
"""Tests for puzzle 1."""
def test_low_point_heights(self, input_1):
"""Test that the heights of low points are correct."""
assert puzzle_1.find_l... | 2.515625 | 3 |
OpenGL/all.gyp | legendlee1314/GLmacia | 0 | 12792301 | <reponame>legendlee1314/GLmacia<filename>OpenGL/all.gyp
{
'variables': {
'project_name': 'GLmacia',
'version': '1.0.0',
'current_dir': '<(DEPTH)',
},
'targets': [
{
'target_name': 'All',
'type': 'none',
'dependencies': [
'<(current_dir)/app/app.gyp:app',
],
},
... | 1.148438 | 1 |
Assignment1/plot.py | 3lLobo/ReinforcementLearningAndPlanning | 0 | 12792302 | <filename>Assignment1/plot.py
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
labels = [0, 100, 200, 300, 400, 500, 600, 700, 800, 900, 1000]
runs = 10
for n in range(runs):
data = pd.read_csv('./data/Vgrid_%d.csv' % n)
ax = sns.heatmap(data, robust=True)
plt.s... | 3 | 3 |
apps/demo/migrations/0003_auto_20190810_1148.py | kagxin/toplist | 0 | 12792303 | <gh_stars>0
# Generated by Django 2.2.4 on 2019-08-10 03:48
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('demo', '0002_auto_20190718_0937'),
]
operations = [
migrations.RenameField(
model_name='article',
old_name='cont... | 1.585938 | 2 |
tsfeatures/tsfeatures_r.py | vishalbelsare/tsfeatures-1 | 57 | 12792304 | #!/usr/bin/env python
# coding: utf-8
from typing import List
import pandas as pd
import rpy2.robjects as robjects
from rpy2.robjects import pandas2ri
def tsfeatures_r(ts: pd.DataFrame,
freq: int,
features: List[str] = ["length", "acf_features", "arch_stat",
... | 2.65625 | 3 |
start.py | ClaudiuGeorgiu/PythonADB | 15 | 12792305 | #!/usr/bin/env python3
import logging
from adb.adb import ADB
if __name__ == "__main__":
# Logging configuration.
logger = logging.getLogger(__name__)
logging.basicConfig(
format="%(asctime)s> [%(levelname)s][%(name)s][%(funcName)s()] %(message)s",
datefmt="%d/%m/%Y %H:%M:%S",
le... | 3.125 | 3 |
core/letkf_utils.py | drewpendergrass/CHEEREIO | 0 | 12792306 | import numpy as np
import xarray as xr
from glob import glob
import observation_operators as obs
import tropomi_tools as tt
import scipy.linalg as la
import toolbox as tx
from datetime import date,datetime,timedelta
def getLETKFConfig(testing=False):
data = tx.getSpeciesConfig(testing)
err_config = data['OBS_ERROR_... | 2.171875 | 2 |
tests/brainview/test_util.py | dfsp-spirit/brainview | 3 | 12792307 | <reponame>dfsp-spirit/brainview<filename>tests/brainview/test_util.py
import os
import pytest
import numpy as np
import mayavi.mlab as mlab
import brainload as bl
import brainview as bv
import brainview.util as ut
import mayavi
try:
import configparser # Python 3
except:
import ConfigParser as configparser ... | 2.078125 | 2 |
apps/odoo/lib/odoo-10.0.post20170615-py2.7.egg/odoo/addons/l10n_fr_certification/models/res_company.py | gtfarng/Odoo_migrade | 1 | 12792308 | <filename>apps/odoo/lib/odoo-10.0.post20170615-py2.7.egg/odoo/addons/l10n_fr_certification/models/res_company.py<gh_stars>1-10
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from openerp import fields, models, api
class ResCompany(models.Model):
_inherit = 'res.... | 2.09375 | 2 |
packages/aiy-bt-prov-server/aiy_trigger_rpi_gpio.py | google/aiyprojects-raspbian-tools | 3 | 12792309 | <filename>packages/aiy-bt-prov-server/aiy_trigger_rpi_gpio.py
# Copyright 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/LICENSE-2.0
#... | 2.859375 | 3 |
nextcode/services/phenotype/__init__.py | Haffi/nextcode-python-sdk | 7 | 12792310 | <filename>nextcode/services/phenotype/__init__.py
"""
Service class
------------------
Service object for interfacing with the Phenotype Archive API
"""
from .phenotype import Phenotype
from .service import Service
| 1.851563 | 2 |
flaskr/__init__.py | tlplayer/Asymptomatix | 2 | 12792311 | # This is where our imports go.
from alembic.config import Config
from flask import Flask
from flask_migrate import Migrate
from flask_sqlalchemy import SQLAlchemy
from sqlalchemy import create_engine
from flask_googlemaps import GoogleMaps
from os import environ
# make key.py with API_KEY='your_api_string'
from flask... | 2.234375 | 2 |
ravel/ext/grpc/proto/__init__.py | gigaquads/pybiz | 2 | 12792312 | <reponame>gigaquads/pybiz
from .message_generator import MessageGenerator
| 1.054688 | 1 |
custom_components/ge_kitchen/devices/__init__.py | joelmoses/ha_components | 0 | 12792313 | <reponame>joelmoses/ha_components<filename>custom_components/ge_kitchen/devices/__init__.py<gh_stars>0
import logging
from typing import Type
from gekitchensdk.erd import ErdApplianceType
from .base import ApplianceApi
from .oven import OvenApi
from .fridge import FridgeApi
from .dishwasher import DishwasherApi
_LOG... | 2 | 2 |
SalesforceEinsteinAnalytics/SFDC_EA.py | geoffrothman/SalesforceEinsteinAnalytics | 0 | 12792314 | #Python wrapper / library for Einstein Analytics API
import sys
import browser_cookie3
import requests
import json
import time
import datetime
from dateutil import tz
import pandas as pd
import numpy as np
import re
from pandas import json_normalize
from decimal import Decimal
import base64
import csv
import unicodecsv... | 2.265625 | 2 |
tests/internal/ebs_optimized_support/test_ebs_optimized_support_unsupported_auto.py | frolovv/aws.ec2.compare | 0 | 12792315 | <filename>tests/internal/ebs_optimized_support/test_ebs_optimized_support_unsupported_auto.py
# Testing module ebs_optimized_support.unsupported
import pytest
import ec2_compare.internal.ebs_optimized_support.unsupported
def test_get_internal_data_ebs_optimized_support_unsupported_get_instances_list():
assert len(e... | 2.015625 | 2 |
tests/test_func.py | DerNitro/pyRegistryStore | 0 | 12792316 | """
Тестирование
"""
import sys
sys.path.append('.')
from objects import auto_type, equal_object, RegistryStore
def test_auto_type():
"""
Проверка преобразования значений
"""
assert auto_type('test') == str('test')
assert auto_type('5') == 5
for i in ['true', 'y', 'yes']:
asse... | 2.6875 | 3 |
IBRAHIM/OPENCV(gözdengeçir)/opencv13.py | vektorelpython24proje/temelbilgiler | 0 | 12792317 | <reponame>vektorelpython24proje/temelbilgiler<filename>IBRAHIM/OPENCV(gözdengeçir)/opencv13.py
import cv2,numpy as np
| 1.015625 | 1 |
philo/forms/fields.py | melinath/philo | 2 | 12792318 | from django import forms
from django.core.exceptions import ValidationError
from django.utils import simplejson as json
from philo.validators import json_validator
__all__ = ('JSONFormField',)
class JSONFormField(forms.Field):
"""A form field which is validated by :func:`philo.validators.json_validator`."""
defa... | 2.65625 | 3 |
archive/arisulolstats/arisulolstats/arisu/profilestable.py | NikhilPal2468/python-projects | 3 | 12792319 | import PyQt5.QtWidgets as W
class ProfilesTable(W.QTableWidget):
def __init__(self, parent, profiles=[]):
super(ProfilesTable, self).__init__(parent)
self.init()
self.update_profiles(profiles)
def init(self):
self.setColumnCount(2)
self.setHorizontalHeaderLabels(["Na... | 2.671875 | 3 |
parsec/commands/invocations/get_invocations.py | erasche/parsec | 8 | 12792320 | import click
from parsec.cli import pass_context, json_loads
from parsec.decorators import custom_exception, json_output
@click.command('get_invocations')
@click.option(
"--workflow_id",
help="Encoded workflow ID to filter on",
type=str
)
@click.option(
"--history_id",
help="Encoded history ID to ... | 2.265625 | 2 |
src/advent_2019/day8.py | devshawn/advent-of-code | 1 | 12792321 | def calculate_part_1(input, width, height):
n = width * height
layers = [input[i:i + n] for i in range(0, len(input), n)]
counts = [item.count("0") for item in layers]
layer = layers[counts.index(min(counts))]
return layer.count("1") * layer.count("2")
def calculate_part_2(input, width, height):
... | 3.359375 | 3 |
scripts/read_logs.py | mimno/mallet_state_tools | 0 | 12792322 | <gh_stars>0
import sys, regex, itertools
from collections import Counter
iter_pattern = regex.compile("^<(\d+)>")
topic_pattern = regex.compile("^(\d+)\t(\d+\.\d+)\t(.*)")
current_iteration = 0
topic_counters = {}
with open(sys.argv[1]) as reader:
for line in reader:
if line.startswith("<"):
... | 3.109375 | 3 |
src/preprocessing/preprocess2.py | norikinishida/coreference-resolution | 0 | 12792323 | import argparse
import json
import os
import numpy as np
import utils
import util
def main(args):
config = utils.get_hocon_config(config_path="./config/main.conf", config_name="base")
input_file = args.input_file
if args.is_training == 0:
is_training = False
else:
is_training = Tru... | 2.609375 | 3 |
route.py | HRHLALALA/Event-Management-System | 0 | 12792324 | <gh_stars>0
from init_database import db,create_db
create_db()
from server import app, valid_time
from flask import request, render_template,session,redirect,url_for,flash
from flask_login import LoginManager,UserMixin,login_required,login_user,current_user,logout_user
from all_user import *
from events import *
from d... | 2.296875 | 2 |
code/day_02a.py | martinsbruveris/advent-of-code | 0 | 12792325 | <gh_stars>0
from pathlib import Path
import click
import numpy as np
CMD_2_DIRECTION = {
"forward": np.array([1, 0]), # (horizontal pos, depth)
"down": np.array([0, 1]),
"up": np.array([0, -1]),
}
@click.command()
@click.argument("filename")
def main(filename):
filename = Path(filename)
command... | 2.828125 | 3 |
Movie_Recommendation_System.py | kunj17/Recommendation-System | 1 | 12792326 | <reponame>kunj17/Recommendation-System
"""
Created on Wed Jan 3 08:15:43 2018
@author: KUNJ
"""
"""
1.Godfather-1
2.Ted
3.Straight outta Compton
4.Godfather-2
5.Notorious
6.Get rich or die trying
7.Frozen
8.Tangled
9.Dunkirk
10.Interstellar
"""
from numpy import *
num_movies = 10
num_users = 5
ratings = random.ra... | 2.59375 | 3 |
example-django/tests/test_models.py | Watershed-Function-SFA/BASIN-3D | 5 | 12792327 |
from django.test import TestCase
from basin3d.models import DataSource, SamplingMedium, \
ObservedPropertyVariable, ObservedProperty, DataSourceObservedPropertyVariable
class DataSourceTestCase(TestCase):
def setUp(self):
DataSource.objects.create(name="Foo", plugin_module="foo.bar.plugins", plugin_... | 2.5 | 2 |
Tarefa4/noh.py | liu88620/POO-Python | 0 | 12792328 | __author__ = 'Liu'
class Noh():
def __init__(self, proximo=None):
self.proximo = proximo
def get_proximo(self): ## verifica se o proximo noh eh "nulo", se nao, vai para proximo.
if self.proximo is not None:
return self.proximo
def tem_proximo(self): ## verifica se tem o ... | 3.65625 | 4 |
apps/addons/views.py | oremj/zamboni | 0 | 12792329 | import functools
import hashlib
import json
import random
from urlparse import urlparse
import uuid
from operator import attrgetter
from django import http
from django.conf import settings
from django.db.models import Q
from django.shortcuts import get_list_or_404, get_object_or_404, redirect
from django.utils.transla... | 1.375 | 1 |
federated_learning/breast_density_challenge/code/pt/utils/preprocess_dicomdir.py | finalelement/tutorials | 15 | 12792330 | # Copyright 2022 MONAI Consortium
# 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, s... | 2.1875 | 2 |
idp_user/typing.py | CardoAI/django-idp-user | 5 | 12792331 | <filename>idp_user/typing.py
from typing import TypedDict, Union, List, Any, Optional, Type
from django.db import models
ALL = 'all'
class JwtData(TypedDict):
iat: int
nbf: int
jti: str
exp: str
type: str
fresh: str
user_id: int
email: str
username: str
class UserFeaturesPermis... | 2.109375 | 2 |
nopwned/app/addon_pwned.py | freman/hass-nopwned | 7 | 12792332 | """Helpers to check core security."""
from datetime import timedelta
from typing import List, Optional
from ...const import CoreState
from ...jobs.const import JobCondition, JobExecutionLimit
from ...jobs.decorator import Job
from ..const import ContextType, IssueType
from .base import CheckBase
class CheckAddonPwne... | 2.390625 | 2 |
setup.py | andrey-git/waqi-async | 3 | 12792333 | <gh_stars>1-10
"""A setuptools based setup module."""
from setuptools import setup, find_packages
setup(
name='waqiasync',
version='1.0.0',
description='asyncio-friendly python API for aqicn.org',
long_description='asyncio-friendly python API for World Air Quality Index (http://aqicn.org). Requires Py... | 1.273438 | 1 |
app/recipe/views.py | bdlb77/recipe-app-api | 0 | 12792334 | from rest_framework import viewsets, mixins
from rest_framework.authentication import TokenAuthentication
from rest_framework.permissions import IsAuthenticated
from core.models import Tag, Ingredient
from recipe import serializers
# tag and ingredients are attributes of a recipe
class BaseRecipeAttrViewSet(viewsets... | 2.28125 | 2 |
msg_serv.py | arti95/fast-lircd-websocket-bridge | 0 | 12792335 | #!/usr/bin/env python3
import asyncio
import sys
import os
class EchoServer(asyncio.Protocol):
clients = {}
def connection_made(self, transport):
peername = transport.get_extra_info('peername')
print('connection from {}'.format(peername))
self.transport = transport
self.clients[... | 2.890625 | 3 |
app.py | marcusvanwinden/book_scraper | 0 | 12792336 | # Import required packages
import sqlite3
import operations
import os
import time
# Establish connection with database
connection = sqlite3.connect("books.db")
# Instantiate cursor
cursor = connection.cursor()
# Create the books table
cursor.execute("""
CREATE TABLE IF NOT EXISTS books (
BookId INTEGER P... | 3.625 | 4 |
esp8266/platform.py | pythings/PythingsOS | 11 | 12792337 | <gh_stars>10-100
platform = 'esp8266'
| 0.996094 | 1 |
standalone/mlflow_handlers/mlflow_handlers.py | frburrue/tfm | 0 | 12792338 | <reponame>frburrue/tfm<gh_stars>0
import mlflow
import os
import shutil
import boto3
from datetime import datetime
S3_CLIENT = boto3.resource('s3')
mlflow.set_tracking_uri(os.getenv('MLFLOW_TRACKING_URI'))
MLFLOW_CLIENT = mlflow.tracking.MlflowClient()
REGISTERED_MODELS = ["Hands"]
CURRENT_MODEL = "Unknown"
MODELS ... | 1.960938 | 2 |
taurex/contributions/absorption.py | rychallener/TauREx3_public | 0 | 12792339 |
from .contribution import Contribution
import numpy as np
from taurex.cache import OpacityCache
class AbsorptionContribution(Contribution):
"""
Computes the contribution to the optical depth
occuring from molecular absorption.
"""
def __init__(self):
super().__init__('Absorption')
... | 2.546875 | 3 |
python_modules/models/Result.py | martijnbroekman/OfficeHeatlth | 0 | 12792340 | class Result:
def __init__(self, face_detected, emotions=None, posture=None, fatigue=None):
self.face_detected = face_detected
self.emotions = emotions
self.posture = posture
self.fatigue = fatigue
| 2.34375 | 2 |
tests/grad_test.py | sheroze1123/HROM_BIDL | 2 | 12792341 | import sys
sys.path.append('../')
import matplotlib; matplotlib.use('macosx')
import time
import numpy as np
import matplotlib.pyplot as plt
import dolfin as dl; dl.set_log_level(40)
# ROMML imports
from fom.forward_solve import Fin
from fom.thermal_fin import get_space
from rom.averaged_affine_ROM import AffineROMFi... | 2.1875 | 2 |
tests/test_roletaskmetrics.py | SODALITE-EU/iac-quality-framework | 0 | 12792342 | import json
import pytest
from ansiblemetrics.metrics_cal import MetricsCal
class TestRoleTaskMetrics:
def test_(self):
metricCal = MetricsCal()
js = json.loads(metricCal.calculate('testResources/configure.yml', 'atss'))
assert 1 == js['bloc']['count']
assert 1 == js['cloc']['cou... | 2.109375 | 2 |
mainAPI/AgentSelectionMechanism.py | noodlesz/fedclean_implementation | 2 | 12792343 | ''' VARIABLES EXPECTED:
a) Trade-Off Parameter (Alpha)
b) Weight/Reputation Score (Gamma)
c) Last Time The Agent was selected (b)
RETURNS a LIST of addresses of SAMPLED AGENTS
'''
#agents_record = {"ETH_ADDRESS":[GAMMA,B_VAL]}
from dataForAgentSelection import agents_record
from collections import defaultdict,OrderedD... | 2.765625 | 3 |
Crawlers/pig.py | sailinglove/personal-general | 0 | 12792344 | <reponame>sailinglove/personal-general
from selenium import webdriver
from selenium.webdriver.support.ui import WebDriverWait
from msedge.selenium_tools import EdgeOptions
from msedge.selenium_tools import Edge
from selenium.common import exceptions as E
import requests
import json
username = '<EMAIL>'
password = '<PA... | 2.609375 | 3 |
Levels/level04.py | SC-HARSH/Parkour-Game | 0 | 12792345 | <reponame>SC-HARSH/Parkour-Game
from ursina import *
import sys
sys.path.append('../Parkour/')
from block import *
normalSpeed = 2
boostSpeed = 5
normalJump = 0.3
# Level04
class Level04(Entity):
def __init__(self):
super().__init__()
self.is_enabled = False
self.on = False
self... | 2.40625 | 2 |
utils/files.py | devteamepic/worker | 0 | 12792346 | import urllib.request
import os
from pathlib import Path
def get_project_root() -> Path:
return Path(__file__).parent.parent
PROTOCOL = "http://"
FILES_URL_ROOT = PROTOCOL + "localhost:3000"
ROOT_DIR = get_project_root()
def download(uri):
create_dirs_from_uri(uri)
urllib.request.urlretrieve(f"{FILES_... | 3.1875 | 3 |
py_pdf_term/pdftoxml/_pdftoxml/__init__.py | kumachan-mis/pdf-slides-term | 1 | 12792347 | <gh_stars>1-10
from .converter import PDFtoXMLConverter
from .data import PDFnXMLPath, PDFnXMLElement
__all__ = [
"PDFtoXMLConverter",
"PDFnXMLPath",
"PDFnXMLElement",
]
| 1.570313 | 2 |
Exercicios/exe018.py | EmersonLCruz/Python | 0 | 12792348 | # Faça um programa que leia um ângulo qualquer e mostre na tela o valor do seno, cosseno e tangente desse ângulo.
import math
angulo = float(input('Digite o valor do angulo:'))
coseno = math.cos(math.radians(angulo))
seno = math.sin(math.radians(angulo))
tangente = math.tan(math.radians(angulo))
print('Coseno de {} é... | 4.0625 | 4 |
bakers_registry/encoding.py | baking-bad/bakers-registry-cli | 4 | 12792349 | import re
from decimal import Decimal
def decode_mutez(value):
return Decimal(value) / 10000
def decode_percent(value, decimals=2):
return Decimal(value) / 10 ** decimals
def decode_split(value):
return 1 - decode_percent(value, decimals=4)
def decode_hex(value):
return value.decode()
def deco... | 2.796875 | 3 |
jupyterlab_chameleon/db.py | super-cooper/jupyterlab-chameleon | 1 | 12792350 | from dataclasses import astuple, dataclass, fields
from importlib import resources
import os
import sqlite3
from .exception import ArtifactNotFoundError, DuplicateArtifactError
import logging
LOG = logging.getLogger(__name__)
DATABASE_NAME = 'chameleon'
@dataclass
class Artifact:
id: str
path: str
depos... | 2.484375 | 2 |