text stringlengths 0 1.05M | meta dict |
|---|---|
"""Basic benchmark of a pyramid of boxes
Results with 10000 iterations (lower is better)
python 2.6: 186.8 sec
pypy-1.9: 428.9 sec
"""
import timeit
import pymunk
from pymunk import Vec2d
class PyramidDemo:
def flipyv(self, v):
return v[0], -v[1]+self.h
def __init__(self):... | {
"repo_name": "cfobel/python___pymunk",
"path": "dump/pyramid_bench.py",
"copies": "1",
"size": "2860",
"license": "mit",
"hash": 846269720503071100,
"line_mean": 27.2040816327,
"line_max": 105,
"alpha_frac": 0.4660839161,
"autogenerated": false,
"ratio": 3.634053367217281,
"config_test": false... |
"""Basic benchmark of pymunk Vec2d class.
Results with 100000 iterations, all on windows (lower is better)
python 2.6: 5.63 sec
pypy-1.9: 11.12 sec
pypy-c-jit-53293-478bc4f20cb7-win32: 11.12 sec
"""
import ctypes
import math
import operator
import timeit
#class Vec2d(): # this would be very fast in py... | {
"repo_name": "viblo/pymunk",
"path": "dump/vec2d_bench.py",
"copies": "1",
"size": "4114",
"license": "mit",
"hash": -2651580460766634000,
"line_mean": 28.0437956204,
"line_max": 86,
"alpha_frac": 0.4883325231,
"autogenerated": false,
"ratio": 3.540447504302926,
"config_test": false,
"has_no... |
# Basic bingo using zip()
words = ['apple', 'banana', 'carrot', 'danke', 'elephant', 'fruit', 'gorilla', 'horse, michael', 'ice cream', 'jack, one eye', 'kazoo', 'lollerskates', 'mango', 'noodles', 'oboe', 'porcupine', 'quill', 'rowboat', 'sailboat', 'trolley', 'umbrella', 'voltage', 'watermelon', 'xylophobe', 'yarn',... | {
"repo_name": "hannahkwarren/CLaG-Sp2016",
"path": "code-exercises-etc/section_05_(loops)/zip_bingo.py",
"copies": "6",
"size": "1566",
"license": "mit",
"hash": -3147799674477939700,
"line_mean": 40.2368421053,
"line_max": 308,
"alpha_frac": 0.7081736909,
"autogenerated": false,
"ratio": 2.95471... |
# basic block timing analysis
import utils
import msp_base as base
import msp_fr5969_model as model
import msp_elftools as elftools
from msp_isa import isa
import msp_instr as instr
class BasicBlock(object):
def __init__(self, addr, verbosity = 0):
self.addr = addr
self.instrs = []
self.ca... | {
"repo_name": "billzorn/msp-pymodel",
"path": "lib/msp_cfg.py",
"copies": "1",
"size": "22399",
"license": "mit",
"hash": -4708876207160722000,
"line_mean": 46.2552742616,
"line_max": 121,
"alpha_frac": 0.4918523148,
"autogenerated": false,
"ratio": 4.285249665199924,
"config_test": false,
"h... |
""" Basic blog using webpy 0.3 """
# -*- coding:utf-8 -*-
#import sys
import web
import model
#reload(sys)
#sys.setdefaultencoding('utf-8')
### Url mappings
urls = (
'/', 'Index',
'/view/(\d+)', 'View',
'/new', 'New',
'/delete/(\d+)', 'Delete',
'/edit/(\d+)', 'Edit',
'/blog', 'Blog',
'/abo... | {
"repo_name": "autumind/blog.python",
"path": "www/blog.py",
"copies": "1",
"size": "2375",
"license": "apache-2.0",
"hash": -5382161924719689000,
"line_mean": 19.1271186441,
"line_max": 75,
"alpha_frac": 0.5364210526,
"autogenerated": false,
"ratio": 3.4773060029282576,
"config_test": false,
... |
""" Basic blog using webpy 0.3 """
import web
import model
### Url mappings
urls = (
'/', 'Index',
'/view/(\d+)', 'View',
'/new', 'New',
'/delete/(\d+)', 'Delete',
'/edit/(\d+)', 'Edit',
)
### Templates
t_globals = {
'datestr': web.datestr
}
render = web.template.render('templates', base='ba... | {
"repo_name": "minixalpha/SourceLearning",
"path": "webpy/sample/blog/src/blog.py",
"copies": "1",
"size": "1843",
"license": "apache-2.0",
"hash": -258660782590698300,
"line_mean": 19.2527472527,
"line_max": 73,
"alpha_frac": 0.537710255,
"autogenerated": false,
"ratio": 3.451310861423221,
"co... |
#basic botNet
import pxssh
currentBot = "*"
botNet = []
class Client:
def __init__(self, host, user, password):
self.host = host
self.user = user
self.password = password
self.session = self.connect()
def connect(self):
try:
s = pxssh.pxssh()
... | {
"repo_name": "alexpell00/python-botnet",
"path": "tests/botnet-ssl.py",
"copies": "1",
"size": "3008",
"license": "mit",
"hash": 578657986024304100,
"line_mean": 27.3773584906,
"line_max": 67,
"alpha_frac": 0.5,
"autogenerated": false,
"ratio": 4.092517006802721,
"config_test": false,
"has_n... |
'basic building blocks for the system'
import requests as reqs
import re
import cPickle as pickle
import os
from settings import *
def get_all_starred( user ):
starred, links, remaining_queries = get_starred( user )
while True:
if not links:
break
try:
next_url = links['next']
except KeyError:
brea... | {
"repo_name": "zygmuntz/stardose",
"path": "github_utils.py",
"copies": "1",
"size": "4403",
"license": "artistic-2.0",
"hash": -1156742393784013300,
"line_mean": 20.9104477612,
"line_max": 90,
"alpha_frac": 0.646150352,
"autogenerated": false,
"ratio": 2.862808842652796,
"config_test": false,
... |
#basic calculator program for raspberry pi
#imports
import math
import sys
import encrypt
import data
import factorial
#function declerations
def addition(num1, num2):
return int(num1) + int(num2)
def subtraction(num1, num2):
return int(num1) + int(num2)
def multiplication(num1, num2):
return int(num1) * int(nu... | {
"repo_name": "Cgboal/Stuff",
"path": "Python/Calculator thing/main.py",
"copies": "1",
"size": "2799",
"license": "mit",
"hash": 4564737680420843000,
"line_mean": 24.9166666667,
"line_max": 100,
"alpha_frac": 0.6295105395,
"autogenerated": false,
"ratio": 3.0690789473684212,
"config_test": fal... |
# Basic calculator that can add, subtract, multiply and divide
# Define the functions
def add(x, y):
return x + y;
def subtract(x, y):
return x - y;
def multiply(x, y):
return x * y;
def divide(x, y):
if(y == 0):
return
return x / y
def terminate():
print("Thank you for using Connor Wright'... | {
"repo_name": "BasicsCoding/Calculator",
"path": "Calculator.py",
"copies": "1",
"size": "1051",
"license": "apache-2.0",
"hash": -5543079286394424000,
"line_mean": 14.9393939394,
"line_max": 74,
"alpha_frac": 0.5851569933,
"autogenerated": false,
"ratio": 2.6209476309226933,
"config_test": fal... |
# basic CAS. An extension could use multiple disks + redis and manage
# redundancy to make best effort use of all disk space.
# TODO deal with: (in base class, NotImplementedError)
# TODO scrub method could deal with one ref at a time to enable a web progress bar (be a Job)
# TODO atomic writes (not that important)
... | {
"repo_name": "naggie/crates",
"path": "cas/cas.py",
"copies": "1",
"size": "6820",
"license": "mit",
"hash": -5816180078064166000,
"line_mean": 29.0440528634,
"line_max": 93,
"alpha_frac": 0.5913489736,
"autogenerated": false,
"ratio": 4.138349514563107,
"config_test": false,
"has_no_keyword... |
"""Basic checks for entity map storage."""
from aiohomekit.model.characteristics import CharacteristicsTypes
from aiohomekit.model.services import ServicesTypes
from homeassistant import config_entries
from homeassistant.components.homekit_controller import async_remove_entry
from homeassistant.components.homekit_cont... | {
"repo_name": "home-assistant/home-assistant",
"path": "tests/components/homekit_controller/test_storage.py",
"copies": "1",
"size": "3190",
"license": "apache-2.0",
"hash": 1936502096912724500,
"line_mean": 29.380952381,
"line_max": 74,
"alpha_frac": 0.6978056426,
"autogenerated": false,
"ratio"... |
"""Basic checks for HomeKit air quality sensor."""
from aiohomekit.model.characteristics import CharacteristicsTypes
from aiohomekit.model.services import ServicesTypes
from tests.components.homekit_controller.common import setup_test_component
def create_air_quality_sensor_service(accessory):
"""Define temperat... | {
"repo_name": "pschmitt/home-assistant",
"path": "tests/components/homekit_controller/test_air_quality.py",
"copies": "21",
"size": "1783",
"license": "apache-2.0",
"hash": -3766211926282846000,
"line_mean": 36.9361702128,
"line_max": 80,
"alpha_frac": 0.7408861469,
"autogenerated": false,
"ratio... |
"""Basic checks for HomeKit air quality sensor."""
from tests.components.homekit_controller.common import FakeService, setup_test_component
def create_air_quality_sensor_service():
"""Define temperature characteristics."""
service = FakeService("public.hap.service.sensor.air-quality")
cur_state = service... | {
"repo_name": "Teagan42/home-assistant",
"path": "tests/components/homekit_controller/test_air_quality.py",
"copies": "2",
"size": "1646",
"license": "apache-2.0",
"hash": 3962781821821545500,
"line_mean": 34.0212765957,
"line_max": 88,
"alpha_frac": 0.7089914945,
"autogenerated": false,
"ratio":... |
"""Basic checks for HomeKitalarm_control_panel."""
from aiohomekit.model.characteristics import CharacteristicsTypes
from aiohomekit.model.services import ServicesTypes
from tests.components.homekit_controller.common import setup_test_component
CURRENT_STATE = ("security-system", "security-system-state.current")
TARG... | {
"repo_name": "balloob/home-assistant",
"path": "tests/components/homekit_controller/test_alarm_control_panel.py",
"copies": "21",
"size": "3251",
"license": "apache-2.0",
"hash": -7269307914063439000,
"line_mean": 35.5280898876,
"line_max": 84,
"alpha_frac": 0.698554291,
"autogenerated": false,
... |
"""Basic checks for HomeKitalarm_control_panel."""
from tests.components.homekit_controller.common import FakeService, setup_test_component
POSITION_STATE = ("window-covering", "position.state")
POSITION_CURRENT = ("window-covering", "position.current")
POSITION_TARGET = ("window-covering", "position.target")
POSITION... | {
"repo_name": "fbradyirl/home-assistant",
"path": "tests/components/homekit_controller/test_cover.py",
"copies": "1",
"size": "8092",
"license": "apache-2.0",
"hash": 816676282725656700,
"line_mean": 34.4912280702,
"line_max": 88,
"alpha_frac": 0.7014335146,
"autogenerated": false,
"ratio": 3.542... |
"""Basic checks for HomeKitalarm_control_panel."""
from tests.components.homekit_controller.common import (
FakeService, setup_test_component)
POSITION_STATE = ('window-covering', 'position.state')
POSITION_CURRENT = ('window-covering', 'position.current')
POSITION_TARGET = ('window-covering', 'position.target')
... | {
"repo_name": "PetePriority/home-assistant",
"path": "tests/components/homekit_controller/test_cover.py",
"copies": "1",
"size": "7603",
"license": "apache-2.0",
"hash": -8882346800701321000,
"line_mean": 34.6948356808,
"line_max": 79,
"alpha_frac": 0.7040641852,
"autogenerated": false,
"ratio": ... |
"""Basic checks for HomeKitclimate."""
from aiohomekit.model.characteristics import CharacteristicsTypes
from aiohomekit.model.services import ServicesTypes
from homeassistant.components.climate.const import (
DOMAIN,
HVAC_MODE_COOL,
HVAC_MODE_HEAT,
HVAC_MODE_HEAT_COOL,
HVAC_MODE_OFF,
SERVICE_S... | {
"repo_name": "robbiet480/home-assistant",
"path": "tests/components/homekit_controller/test_climate.py",
"copies": "5",
"size": "8481",
"license": "apache-2.0",
"hash": -8864640319132803000,
"line_mean": 36.1973684211,
"line_max": 83,
"alpha_frac": 0.7087607593,
"autogenerated": false,
"ratio": ... |
"""Basic checks for HomeKitclimate."""
from aiohomekit.model.characteristics import (
ActivationStateValues,
CharacteristicsTypes,
CurrentHeaterCoolerStateValues,
SwingModeValues,
TargetHeaterCoolerStateValues,
)
from aiohomekit.model.services import ServicesTypes
from homeassistant.components.clim... | {
"repo_name": "sander76/home-assistant",
"path": "tests/components/homekit_controller/test_climate.py",
"copies": "6",
"size": "26995",
"license": "apache-2.0",
"hash": 2546394150109690400,
"line_mean": 35.1378848728,
"line_max": 106,
"alpha_frac": 0.690646416,
"autogenerated": false,
"ratio": 3.... |
"""Basic checks for HomeKitclimate."""
from homeassistant.components.climate.const import (
DOMAIN,
HVAC_MODE_COOL,
HVAC_MODE_HEAT,
HVAC_MODE_HEAT_COOL,
HVAC_MODE_OFF,
SERVICE_SET_HUMIDITY,
SERVICE_SET_HVAC_MODE,
SERVICE_SET_TEMPERATURE,
)
from tests.components.homekit_controller.common... | {
"repo_name": "Teagan42/home-assistant",
"path": "tests/components/homekit_controller/test_climate.py",
"copies": "3",
"size": "8136",
"license": "apache-2.0",
"hash": -6224361642855849000,
"line_mean": 35.16,
"line_max": 88,
"alpha_frac": 0.6988692232,
"autogenerated": false,
"ratio": 3.59522757... |
"""Basic checks for HomeKitclimate."""
from homeassistant.components.climate.const import (
DOMAIN, SERVICE_SET_HVAC_MODE, SERVICE_SET_TEMPERATURE,
HVAC_MODE_HEAT_COOL, HVAC_MODE_COOL, HVAC_MODE_HEAT, HVAC_MODE_OFF,
SERVICE_SET_HUMIDITY)
from tests.components.homekit_controller.common import (
FakeServi... | {
"repo_name": "jabesq/home-assistant",
"path": "tests/components/homekit_controller/test_climate.py",
"copies": "1",
"size": "7992",
"license": "apache-2.0",
"hash": 6279713207255468000,
"line_mean": 38.1764705882,
"line_max": 76,
"alpha_frac": 0.7113363363,
"autogenerated": false,
"ratio": 3.552... |
"""Basic checks for HomeKitclimate."""
from homeassistant.components.climate.const import (
DOMAIN, SERVICE_SET_OPERATION_MODE, SERVICE_SET_TEMPERATURE,
SERVICE_SET_HUMIDITY)
from tests.components.homekit_controller.common import (
FakeService, setup_test_component)
HEATING_COOLING_TARGET = ('thermostat',... | {
"repo_name": "DavidLP/home-assistant",
"path": "tests/components/homekit_controller/test_climate.py",
"copies": "2",
"size": "5873",
"license": "apache-2.0",
"hash": -4210384267322924000,
"line_mean": 36.8903225806,
"line_max": 76,
"alpha_frac": 0.7101992168,
"autogenerated": false,
"ratio": 3.6... |
"""Basic checks for HomeKitclimate."""
from unittest.mock import patch
from aiohomekit.model.characteristics import (
ActivationStateValues,
CharacteristicsTypes,
CurrentHeaterCoolerStateValues,
SwingModeValues,
TargetHeaterCoolerStateValues,
)
from aiohomekit.model.services import ServicesTypes
f... | {
"repo_name": "kennedyshead/home-assistant",
"path": "tests/components/homekit_controller/test_climate.py",
"copies": "2",
"size": "27335",
"license": "apache-2.0",
"hash": 3545708718283996700,
"line_mean": 35.2052980132,
"line_max": 106,
"alpha_frac": 0.6913115054,
"autogenerated": false,
"ratio... |
"""Basic checks for HomeKitLock."""
from tests.components.homekit_controller.common import FakeService, setup_test_component
LOCK_CURRENT_STATE = ("lock-mechanism", "lock-mechanism.current-state")
LOCK_TARGET_STATE = ("lock-mechanism", "lock-mechanism.target-state")
def create_lock_service():
"""Define a lock ch... | {
"repo_name": "postlund/home-assistant",
"path": "tests/components/homekit_controller/test_lock.py",
"copies": "1",
"size": "2215",
"license": "apache-2.0",
"hash": 6311008319236606000,
"line_mean": 37.1896551724,
"line_max": 88,
"alpha_frac": 0.7033860045,
"autogenerated": false,
"ratio": 3.6611... |
"""Basic checks for HomeKit motion sensors and contact sensors."""
from aiohomekit.model.characteristics import CharacteristicsTypes
from aiohomekit.model.services import ServicesTypes
from homeassistant.components.binary_sensor import (
DEVICE_CLASS_GAS,
DEVICE_CLASS_MOISTURE,
DEVICE_CLASS_MOTION,
DEV... | {
"repo_name": "adrienbrault/home-assistant",
"path": "tests/components/homekit_controller/test_binary_sensor.py",
"copies": "15",
"size": "5665",
"license": "mit",
"hash": 3754536298040652000,
"line_mean": 34.6289308176,
"line_max": 84,
"alpha_frac": 0.7285083848,
"autogenerated": false,
"ratio":... |
"""Basic checks for HomeKit motion sensors and contact sensors."""
from aiohomekit.model.characteristics import CharacteristicsTypes
from aiohomekit.model.services import ServicesTypes
from tests.components.homekit_controller.common import setup_test_component
V1_ON = ("fan", "on")
V1_ROTATION_DIRECTION = ("fan", "ro... | {
"repo_name": "partofthething/home-assistant",
"path": "tests/components/homekit_controller/test_fan.py",
"copies": "2",
"size": "14261",
"license": "mit",
"hash": -3938539318663072300,
"line_mean": 30.6911111111,
"line_max": 82,
"alpha_frac": 0.6510763621,
"autogenerated": false,
"ratio": 3.5273... |
"""Basic checks for HomeKit sensor."""
from tests.components.homekit_controller.common import FakeService, setup_test_component
TEMPERATURE = ("temperature", "temperature.current")
HUMIDITY = ("humidity", "relative-humidity.current")
LIGHT_LEVEL = ("light", "light-level.current")
CARBON_DIOXIDE_LEVEL = ("carbon-dioxid... | {
"repo_name": "Cinntax/home-assistant",
"path": "tests/components/homekit_controller/test_sensor.py",
"copies": "6",
"size": "5908",
"license": "apache-2.0",
"hash": 4706958352525702000,
"line_mean": 34.1666666667,
"line_max": 88,
"alpha_frac": 0.7070074475,
"autogenerated": false,
"ratio": 3.582... |
"""Basic checks for HomeKit sensor."""
from tests.components.homekit_controller.common import (
FakeService, setup_test_component)
TEMPERATURE = ('temperature', 'temperature.current')
HUMIDITY = ('humidity', 'relative-humidity.current')
LIGHT_LEVEL = ('light', 'light-level.current')
def create_temperature_sensor... | {
"repo_name": "MartinHjelmare/home-assistant",
"path": "tests/components/homekit_controller/test_sensor.py",
"copies": "10",
"size": "2632",
"license": "apache-2.0",
"hash": -1979745519295785700,
"line_mean": 32.3164556962,
"line_max": 77,
"alpha_frac": 0.7108662614,
"autogenerated": false,
"rati... |
"""Basic checks for HomeKitSwitch."""
from aiohomekit.model.characteristics import CharacteristicsTypes
from aiohomekit.model.services import ServicesTypes
from homeassistant.components.homekit_controller.const import KNOWN_DEVICES
from tests.components.homekit_controller.common import setup_test_component
LIGHT_BUL... | {
"repo_name": "tchellomello/home-assistant",
"path": "tests/components/homekit_controller/test_light.py",
"copies": "14",
"size": "8183",
"license": "apache-2.0",
"hash": 571082576230568640,
"line_mean": 34.8903508772,
"line_max": 88,
"alpha_frac": 0.699865575,
"autogenerated": false,
"ratio": 3.... |
"""Basic checks for HomeKitSwitch."""
from tests.components.homekit_controller.common import (
FakeService, setup_test_component)
LIGHT_ON = ('lightbulb', 'on')
LIGHT_BRIGHTNESS = ('lightbulb', 'brightness')
LIGHT_HUE = ('lightbulb', 'hue')
LIGHT_SATURATION = ('lightbulb', 'saturation')
LIGHT_COLOR_TEMP = ('light... | {
"repo_name": "auduny/home-assistant",
"path": "tests/components/homekit_controller/test_light.py",
"copies": "8",
"size": "5421",
"license": "apache-2.0",
"hash": -3371546213648796700,
"line_mean": 34.2012987013,
"line_max": 79,
"alpha_frac": 0.6928610957,
"autogenerated": false,
"ratio": 3.6260... |
"""Basic checks for the server API."""
from behave import given, then, when
import requests
from src.utils import *
from src.authorization_tokens import *
from src.attribute_checks import *
from src.schema_validator import *
@when('I access {url:S}')
def access_url(context, url):
"""Access the service API using ... | {
"repo_name": "jpopelka/fabric8-analytics-common",
"path": "integration-tests/features/steps/server_api.py",
"copies": "1",
"size": "4151",
"license": "apache-2.0",
"hash": -601520835291334400,
"line_mean": 37.7943925234,
"line_max": 94,
"alpha_frac": 0.6793543724,
"autogenerated": false,
"ratio"... |
"""Basic checks for the server API."""
from behave import then, when
from urllib.parse import urljoin
import requests
import time
from src.utils import split_comma_separated_list
from src.authorization_tokens import authorization
from src.attribute_checks import check_and_get_attribute, check_timestamp, check_hash_va... | {
"repo_name": "tisnik/fabric8-analytics-common",
"path": "integration-tests/features/steps/server_api.py",
"copies": "1",
"size": "12034",
"license": "apache-2.0",
"hash": -4825163601228757000,
"line_mean": 41.5229681979,
"line_max": 94,
"alpha_frac": 0.6845604122,
"autogenerated": false,
"ratio"... |
"""Basic checks for the server API."""
from behave import when
import requests
from src.authorization_tokens import authorization
def post_data_to_user_intent_endpoint(context, payload=None):
"""Post data into the REST API endpoint for user-intent."""
url = "/api/v1/user-intent"
if payload is not None:... | {
"repo_name": "tisnik/fabric8-analytics-common",
"path": "integration-tests/features/steps/user_intent.py",
"copies": "1",
"size": "2477",
"license": "apache-2.0",
"hash": 6117823827614664000,
"line_mean": 38.9516129032,
"line_max": 93,
"alpha_frac": 0.6907549455,
"autogenerated": false,
"ratio":... |
"""Basic CIGAR manipulation and querying. """
from __future__ import print_function, absolute_import, division
import itertools
import re
import katana.util as util
class CigarUtil(object):
_QUERY_CONSUMING = set(list("MIS=X"))
_REF_CONSUMING = set(list("MDNS=X"))
_REGEX_CIGAR = re.compile("([0-9]+)([M... | {
"repo_name": "umich-brcf-bioinf/Katana",
"path": "katana/cigar.py",
"copies": "1",
"size": "7157",
"license": "apache-2.0",
"hash": 5221939323385878000,
"line_mean": 38.9832402235,
"line_max": 80,
"alpha_frac": 0.5887941875,
"autogenerated": false,
"ratio": 3.53781512605042,
"config_test": fal... |
"basic circle functionality"
from linda.Vec2D import Vec2D
from linda.Ray import Ray
from math import sqrt
class Circle(object):
"simple 2d circle class"
def __init__(self, pos=Vec2D(), radius=1.0):
self.pos = pos
self.radius = radius
def intersects(self, other):
"return if self ... | {
"repo_name": "31415us/linda-lidar-rangefinder-playground",
"path": "linda/Circle.py",
"copies": "1",
"size": "2239",
"license": "mit",
"hash": 9085949175007594000,
"line_mean": 29.2567567568,
"line_max": 79,
"alpha_frac": 0.5806163466,
"autogenerated": false,
"ratio": 3.617124394184168,
"confi... |
"""Basic classes for building classes that are selection
capable and selection aware.
"""
import numpy as np
import collections as col
import collections.abc as colabc
from copy import copy
__all__ = ['SelectionMember', 'GenericSelection', 'IndexedSelection',
'SelectionsDict', 'SelectionsList', 'CoordArra... | {
"repo_name": "salotz/mast",
"path": "mastic/selection.py",
"copies": "1",
"size": "24367",
"license": "mit",
"hash": -8097453995669775000,
"line_mean": 32.2428376535,
"line_max": 108,
"alpha_frac": 0.583165757,
"autogenerated": false,
"ratio": 4.251046755059316,
"config_test": false,
"has_no... |
"""Basic class for interacting with NAMD configuration files
This is all essentially deprecated after the addition of a (nearly) full Python
interpreter in NAMD. However, select parts of this remain useful in certain
instances, for example, this is probably the easiest way to rebuild a
configuration file from MD outp... | {
"repo_name": "radakb/pynamd",
"path": "pynamd/config.py",
"copies": "1",
"size": "13476",
"license": "mit",
"hash": -1018170575860703900,
"line_mean": 35.2258064516,
"line_max": 79,
"alpha_frac": 0.5611457406,
"autogenerated": false,
"ratio": 4.159259259259259,
"config_test": true,
"has_no_k... |
"""Basic class for interacting with NAMD standard output as a log file"""
from __future__ import division, print_function
from future.utils import iteritems
try:
from collections import OrderedDict
except ImportError:
from ordereddict import OrderedDict
from requests.structures import CaseInsensitiveDict
from m... | {
"repo_name": "radakb/pynamd",
"path": "pynamd/log.py",
"copies": "1",
"size": "36010",
"license": "mit",
"hash": -8667033501614063000,
"line_mean": 41.7672209026,
"line_max": 321,
"alpha_frac": 0.5770619272,
"autogenerated": false,
"ratio": 3.772260632725749,
"config_test": false,
"has_no_ke... |
"""Basic cleanup on lightcurves (trimming, sigma-clipping)."""
import logging
import numpy as np
import matplotlib.pyplot as plt
import k2spin.utils as utils
from k2spin import detrend
def trim(time, flux, unc_flux):
"""Remove infs, NaNs, and negative flux values.
Inputs
------
time, flux, unc_flux... | {
"repo_name": "stephtdouglas/k2spin",
"path": "clean.py",
"copies": "1",
"size": "4574",
"license": "mit",
"hash": -9168093511907298000,
"line_mean": 29.0921052632,
"line_max": 79,
"alpha_frac": 0.59838216,
"autogenerated": false,
"ratio": 3.105227427019688,
"config_test": false,
"has_no_keyw... |
""" Basic Clousmesh finctions.
.. role:: strikethrough
This file contains some very basic utility functions that must not
need any import from cloudmesh. That is no statement such as
* :strikethrough:`import cloudmesh`
must occur in the list of import. If functions are needed hat need to
be used they must be declea... | {
"repo_name": "rajpushkar83/cloudmesh",
"path": "cloudmesh_common/util.py",
"copies": "1",
"size": "8656",
"license": "apache-2.0",
"hash": 8462980781218975000,
"line_mean": 27.0129449838,
"line_max": 113,
"alpha_frac": 0.5667744917,
"autogenerated": false,
"ratio": 3.9670027497708524,
"config_... |
"""Basic coerce tests cases
Made for Jython.
"""
import unittest
from test import test_support
from javatests import Coercion
from collections import Sequence
class MySeqClass1(Sequence):
def __init__(self, l):
self.l = l
def __getitem__(self, i):
return self.l[i]
def __len__(self):
... | {
"repo_name": "tunneln/CarnotKE",
"path": "jyhton/Lib/test/test_coerce_jy.py",
"copies": "8",
"size": "1522",
"license": "apache-2.0",
"hash": 8591647706861329000,
"line_mean": 25.701754386,
"line_max": 71,
"alpha_frac": 0.6051248357,
"autogenerated": false,
"ratio": 3.4049217002237135,
"config... |
""" basic collect and runtest protocol implementations """
from __future__ import absolute_import, division, print_function
import bdb
import os
import sys
from time import time
import py
from _pytest._code.code import TerminalRepr, ExceptionInfo
from _pytest.outcomes import skip, Skipped, TEST_OUTCOME
#
# pytest pl... | {
"repo_name": "tareqalayan/pytest",
"path": "_pytest/runner.py",
"copies": "1",
"size": "16205",
"license": "mit",
"hash": 3640654704151899600,
"line_mean": 30.836935167,
"line_max": 93,
"alpha_frac": 0.600185128,
"autogenerated": false,
"ratio": 3.9572649572649574,
"config_test": true,
"has_... |
""" basic collect and runtest protocol implementations """
from __future__ import absolute_import, division, print_function
import bdb
import sys
from time import time
import py
from _pytest._code.code import TerminalRepr, ExceptionInfo
#
# pytest plugin hooks
def pytest_addoption(parser):
group = parser.getg... | {
"repo_name": "alexzoo/python",
"path": "selenium_tests/env/lib/python3.6/site-packages/_pytest/runner.py",
"copies": "2",
"size": "19302",
"license": "apache-2.0",
"hash": 3750129651592808000,
"line_mean": 32.2793103448,
"line_max": 93,
"alpha_frac": 0.6057921459,
"autogenerated": false,
"ratio"... |
""" basic collect and runtest protocol implementations """
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import bdb
import os
import sys
from time import time
import attr
import six
from .reports import CollectErrorRepr
from .reports import CollectReport... | {
"repo_name": "lmregus/Portfolio",
"path": "python/design_patterns/env/lib/python3.7/site-packages/_pytest/runner.py",
"copies": "1",
"size": "11976",
"license": "mit",
"hash": -2095491554210056200,
"line_mean": 30.936,
"line_max": 87,
"alpha_frac": 0.6160654643,
"autogenerated": false,
"ratio": ... |
"""Basic collect and runtest protocol implementations."""
import bdb
import os
import sys
from typing import Callable
from typing import cast
from typing import Dict
from typing import Generic
from typing import List
from typing import Optional
from typing import Tuple
from typing import TypeVar
from typing import Unio... | {
"repo_name": "servo/servo",
"path": "tests/wpt/web-platform-tests/tools/third_party/pytest/src/_pytest/runner.py",
"copies": "11",
"size": "15934",
"license": "mpl-2.0",
"hash": 1823688631849573000,
"line_mean": 33.5639913232,
"line_max": 96,
"alpha_frac": 0.6245763776,
"autogenerated": false,
"... |
"""Basic collect and runtest protocol implementations."""
import bdb
import os
import sys
import warnings
from typing import Callable
from typing import cast
from typing import Dict
from typing import Generic
from typing import List
from typing import Optional
from typing import Tuple
from typing import Type
from typin... | {
"repo_name": "pytest-dev/pytest",
"path": "src/_pytest/runner.py",
"copies": "3",
"size": "18354",
"license": "mit",
"hash": 2702332136469228500,
"line_mean": 32.4927007299,
"line_max": 88,
"alpha_frac": 0.6221532091,
"autogenerated": false,
"ratio": 3.97444781290602,
"config_test": true,
"h... |
""" basic collect and runtest protocol implementations """
import bdb
import sys
from time import time
from pkg_resources import parse_version
import py
import pytest
from py._code.code import TerminalRepr
def pytest_namespace():
return {
'fail' : fail,
'skip' : skip,
'imp... | {
"repo_name": "ericdill/pytest",
"path": "_pytest/runner.py",
"copies": "14",
"size": "16705",
"license": "mit",
"hash": -567407041397648700,
"line_mean": 32.2768924303,
"line_max": 79,
"alpha_frac": 0.6064651302,
"autogenerated": false,
"ratio": 3.9964114832535884,
"config_test": true,
"has_... |
""" basic collect and runtest protocol implementations """
import bdb
import sys
from time import time
import py
import pytest
from py._code.code import TerminalRepr
def pytest_namespace():
return {
'fail' : fail,
'skip' : skip,
'importorskip' : importorskip,
'exit'... | {
"repo_name": "bukzor/pytest",
"path": "_pytest/runner.py",
"copies": "10",
"size": "16933",
"license": "mit",
"hash": 8059198183671550000,
"line_mean": 32.3984220907,
"line_max": 79,
"alpha_frac": 0.6049134825,
"autogenerated": false,
"ratio": 4.010658455708195,
"config_test": true,
"has_no_... |
""" basic collect and runtest protocol implementations """
import bdb
import sys
from time import time
import py
import pytest
from _pytest._code.code import TerminalRepr, ExceptionInfo
def pytest_namespace():
return {
'fail' : fail,
'skip' : skip,
'importorskip' : importo... | {
"repo_name": "karan1276/servo",
"path": "tests/wpt/web-platform-tests/tools/pytest/_pytest/runner.py",
"copies": "173",
"size": "17105",
"license": "mpl-2.0",
"hash": -6618223384866935000,
"line_mean": 32.213592233,
"line_max": 79,
"alpha_frac": 0.6035077463,
"autogenerated": false,
"ratio": 4.0... |
""" basic collect and runtest protocol implementations """
import py, sys
from time import time
from py._code.code import TerminalRepr
def pytest_namespace():
return {
'fail' : fail,
'skip' : skip,
'importorskip' : importorskip,
'exit' : exit,
}
#
# pyt... | {
"repo_name": "ktan2020/legacy-automation",
"path": "win/Lib/site-packages/pytest-2.3.4-py2.7.egg/_pytest/runner.py",
"copies": "3",
"size": "14560",
"license": "mit",
"hash": 2396798048110394000,
"line_mean": 31.8668171558,
"line_max": 81,
"alpha_frac": 0.604739011,
"autogenerated": false,
"rati... |
# basic command line functions to use. Some of those functions can be implemented to
# scikit-beam later.
import os
import time
import json
import glob
import multiprocessing
import numpy as np
import h5py
import copy
from collections.abc import Iterable
import re
from ..core.quant_analysis import ParamQuantitativeAna... | {
"repo_name": "NSLS-II-HXN/PyXRF",
"path": "pyxrf/model/command_tools.py",
"copies": "1",
"size": "38277",
"license": "bsd-3-clause",
"hash": -5898654773194878000,
"line_mean": 43.0471806674,
"line_max": 113,
"alpha_frac": 0.5859654623,
"autogenerated": false,
"ratio": 4.216921890492453,
"confi... |
"""Basic Commands and Instructions"""
from ._core import (RuntimeInsn, SingleCommandInsn, ConstructorInsn, BasicBlock,
PreambleInsn)
from ..core_types import (CmdFunction,
Opt,
Position,
BlockType,
... | {
"repo_name": "simon816/Command-Block-Assembly",
"path": "cmd_ir/instructions/basic.py",
"copies": "1",
"size": "13906",
"license": "mit",
"hash": 6431329737783177000,
"line_mean": 32.8345498783,
"line_max": 80,
"alpha_frac": 0.6185819071,
"autogenerated": false,
"ratio": 3.745219499057366,
"co... |
# Basic commands implemented in Python
import errno, sys, os, shutil, time
from getopt import getopt, GetoptError
from pymake import errors
__all__ = ["mkdir", "rm", "sleep", "touch"]
def mkdir(args):
"""
Emulate some of the behavior of mkdir(1).
Only supports the -p (--parents) argument.
"""
try:
opt... | {
"repo_name": "mozilla/pymake",
"path": "pymake/builtins.py",
"copies": "1",
"size": "3512",
"license": "mit",
"hash": 3479786222323564000,
"line_mean": 28.2666666667,
"line_max": 121,
"alpha_frac": 0.5056947608,
"autogenerated": false,
"ratio": 3.3866923818707813,
"config_test": false,
"has_... |
# Basic Components for Polygons
class Vertex(object):
''' XPlane 10 Vertex '''
def __init__(self, x, y, z, nx, ny, nz, u, v, w=None):
self.x = x
self.y = y
self.z = z
self.nx = nx
self.ny = ny
self.nz = nz
self.u = u
self.v = v
self.w = w
... | {
"repo_name": "renderbox/xplane-maya",
"path": "component.py",
"copies": "1",
"size": "1244",
"license": "mit",
"hash": -4451620795813267000,
"line_mean": 22.9230769231,
"line_max": 81,
"alpha_frac": 0.5217041801,
"autogenerated": false,
"ratio": 3.1653944020356235,
"config_test": false,
"has... |
"""Basic contact management functions.
Contacts are linked to monitors and are used to determine where to send
alerts for monitors.
Contacts are basic name/email/phone sets.
Contacts are only stored in the database and not in memory, they are loaded
from the database each time an alert is sent.
"""
from typing impo... | {
"repo_name": "beebyte/irisett",
"path": "irisett/contact.py",
"copies": "1",
"size": "17565",
"license": "mit",
"hash": -5391340811235244000,
"line_mean": 44.7421875,
"line_max": 120,
"alpha_frac": 0.6793623683,
"autogenerated": false,
"ratio": 3.7064781599493566,
"config_test": false,
"has_... |
""" Basic core functionality.
* Setup admin interface;
* Add alembic models in admin;
"""
from flask import request, current_app
from flask_mail import Message
from logging import Handler, ERROR
from ..ext import mail
def loader_meta(app=None):
""" Configure core application.
"""
from .views i... | {
"repo_name": "klen/Flask-Foundation",
"path": "base/core/__init__.py",
"copies": "1",
"size": "1190",
"license": "bsd-3-clause",
"hash": -2464077920173051000,
"line_mean": 22.8,
"line_max": 86,
"alpha_frac": 0.6697478992,
"autogenerated": false,
"ratio": 3.742138364779874,
"config_test": false... |
"""Basic CRUD and Data Analysis of Recipes"""
import sqlite3
from time import time
from src.Recipe import Recipe, PostInfo, RefinedPost
class Database:
"""Class that handles all database operations."""
def __init__(self):
self.connection = sqlite3.connect('../DDL Files/recipes_db.sqlite')
se... | {
"repo_name": "IgorGee/Eat-Cheap-And-Healthy-Recipe-Centralizer",
"path": "src/DatabaseUtil.py",
"copies": "1",
"size": "6132",
"license": "mit",
"hash": -1452019604047180000,
"line_mean": 33.6440677966,
"line_max": 79,
"alpha_frac": 0.5195694716,
"autogenerated": false,
"ratio": 4.33663366336633... |
"""Basic CRUD operations for the server.
===============================
Imports :
sqlalchemy.orm.with_polymorphic : Load columns for inheriting classes.
Ref : http://docs.sqlalchemy.org/en/latest/orm/query.html
sqlalchemy.exists : A convenience method that turns a query into an EXISTS subquery
... | {
"repo_name": "HTTP-APIs/hydrus",
"path": "hydrus/data/crud.py",
"copies": "1",
"size": "21292",
"license": "mit",
"hash": -1398146221268041200,
"line_mean": 34.1287128713,
"line_max": 141,
"alpha_frac": 0.6614524615,
"autogenerated": false,
"ratio": 4.021915737766862,
"config_test": false,
"... |
"""Basic CRUD operations for the server.
===============================
Imports :
sqlalchemy.orm.with_polymorphic : Load columns for inheriting classes.
Ref : http://docs.sqlalchemy.org/en/latest/orm/query.html
sqlalchemy.exists : A convenience method that turns a query into an EXISTS su... | {
"repo_name": "xadahiya/hydrus",
"path": "hydrus/data/crud.py",
"copies": "1",
"size": "28034",
"license": "mit",
"hash": 6317816397527907000,
"line_mean": 37.6463932107,
"line_max": 141,
"alpha_frac": 0.5663574741,
"autogenerated": false,
"ratio": 4.412088776955769,
"config_test": false,
"ha... |
# Basic CV Routines
import cv2
import numpy as np
import sys
sys.path.append("../config/")
import color_config
#----------------------------------------------------------
def clear_noise(img):
#Clears noise from image
kernel = np.ones((10, 10), np.uint8)
clrimg = cv2.morphologyEx(img, cv2.MORPH_CLOSE, kernel)
cl... | {
"repo_name": "lepisma/AirJam",
"path": "lib/imgproc.py",
"copies": "1",
"size": "1248",
"license": "mit",
"hash": 2102854007140077300,
"line_mean": 28.7380952381,
"line_max": 84,
"alpha_frac": 0.5713141026,
"autogenerated": false,
"ratio": 3.0144927536231885,
"config_test": false,
"has_no_ke... |
"""Basic data handling mechanisms for lists of dictionaries, including alignment
(i.e., given all dictionaries in a list uniform keysets), filtering, and
string value parsing.
"""
def filter(dicts, filters):
"""Returns a subset of the given entries in dicts (a list of dictionaries)
for which the fields spec... | {
"repo_name": "Tythos/pyroclast",
"path": "basic.py",
"copies": "1",
"size": "1323",
"license": "mit",
"hash": -6974638389071523000,
"line_mean": 24.9411764706,
"line_max": 80,
"alpha_frac": 0.6900982615,
"autogenerated": false,
"ratio": 3.4097938144329896,
"config_test": false,
"has_no_keywo... |
""" Basic declaration of user type defined with class
"""
from nolang.objects.root import W_Root
class W_UserType(W_Root):
def __init__(self, allocate, name, class_elements_w, w_parent,
default_alloc=True, force_names=None):
self.name = name
self.allocate = allocate
self.... | {
"repo_name": "fijal/quill",
"path": "nolang/objects/usertype.py",
"copies": "1",
"size": "1910",
"license": "mit",
"hash": 1298488301723349200,
"line_mean": 31.3728813559,
"line_max": 74,
"alpha_frac": 0.5476439791,
"autogenerated": false,
"ratio": 3.866396761133603,
"config_test": false,
"h... |
"""Basic definitions for autodifferentiation.
Overview
========
This module defines a simple autodiff system for Klamp't objects, including
3D math, kinematics, dynamics, and geometry functions. This is useful for
all sorts of optimization functions, e.g., machine learning, calibration,
and trajectory optimization.
... | {
"repo_name": "krishauser/Klampt",
"path": "Python/klampt/math/autodiff/ad.py",
"copies": "1",
"size": "87126",
"license": "bsd-3-clause",
"hash": 5887998174144893000,
"line_mean": 35.2420965058,
"line_max": 180,
"alpha_frac": 0.5367858045,
"autogenerated": false,
"ratio": 3.7539747511741135,
"... |
# basic defs and link to ffi
from pyvips import ffi, vips_lib, gobject_lib, \
_to_string, _to_bytes, Error
def leak_set(leak):
"""Enable or disable libvips leak checking.
With this enabled, libvips will check for object and area leaks on exit.
Enabling this option will make libvips run slightly mor... | {
"repo_name": "jcupitt/pyvips",
"path": "pyvips/base.py",
"copies": "1",
"size": "2748",
"license": "mit",
"hash": 3852211547783649300,
"line_mean": 22.0924369748,
"line_max": 76,
"alpha_frac": 0.6382823872,
"autogenerated": false,
"ratio": 3.19906868451688,
"config_test": false,
"has_no_keyw... |
"""Basic demonstration tracker for the "Diffuseur" image sequences.
This tracker operates on the particle images as given by diffuseur_preproc.py.
In a given frame, it detects the particles and track them in the next frame
using a very basic cross-correlation approach.
Results are saved as a text file. Visualization ... | {
"repo_name": "pderian/whiteSmoker",
"path": "whitesmoker_track.py",
"copies": "1",
"size": "7718",
"license": "mit",
"hash": 3473296407954906600,
"line_mean": 38.9948186528,
"line_max": 248,
"alpha_frac": 0.5856439492,
"autogenerated": false,
"ratio": 3.4029982363315696,
"config_test": false,
... |
# basic dependencies
import os
import sys
import subprocess
from glob import glob
import math
# main dependencies: numpy, nibabel
import numpy as np
import nibabel as nb
# nighresjava and nighres functions
import nighresjava
from ..io import load_volume, save_volume
from ..utils import _output_dir_4saving, _fname_4sa... | {
"repo_name": "nighres/nighres",
"path": "nighres/registration/embedded_antsreg.py",
"copies": "1",
"size": "90392",
"license": "apache-2.0",
"hash": 5309019335893267000,
"line_mean": 43.1582804104,
"line_max": 105,
"alpha_frac": 0.5635454465,
"autogenerated": false,
"ratio": 3.5756329113924052,
... |
# basic dependencies
import os
import sys
# main dependencies: numpy, nibabel
import numpy as np
import nibabel as nb
# nighresjava and nighres functions
import nighresjava
from ..io import load_volume, save_volume
from ..utils import _output_dir_4saving, _fname_4saving, \
_check_topology_lut_dir, _check_atlas_fi... | {
"repo_name": "nighres/nighres",
"path": "nighres/shape/intrinsic_coordinates.py",
"copies": "1",
"size": "4912",
"license": "apache-2.0",
"hash": -9014754489157480000,
"line_mean": 32.1891891892,
"line_max": 116,
"alpha_frac": 0.588762215,
"autogenerated": false,
"ratio": 4.056151940545004,
"c... |
# basic dependencies
import os
import sys
# main dependencies: numpy, nibabel
import numpy
import nibabel
# nighresjava and nighres functions
import nighresjava
from ..io import load_volume, save_volume
from ..utils import _output_dir_4saving, _fname_4saving, \
_check_topology_lut_dir
# convenien... | {
"repo_name": "nighres/nighres",
"path": "nighres/registration/generate_coordinate_mapping.py",
"copies": "1",
"size": "5239",
"license": "apache-2.0",
"hash": -8174337634921815000,
"line_mean": 34.3986486486,
"line_max": 96,
"alpha_frac": 0.5791181523,
"autogenerated": false,
"ratio": 4.08021806... |
BASIC_DESCRIPTION_CANNOT_BE_EMPTY = 'Concept description cannot be empty'
BASIC_NAMES_CANNOT_BE_EMPTY = 'A concept must have at least one name'
OPENMRS_ONE_FULLY_SPECIFIED_NAME_PER_LOCALE = 'A concept may not have more than one fully specified name in any locale'
OPENMRS_NO_MORE_THAN_ONE_SHORT_NAME_PER_LOCALE = 'A con... | {
"repo_name": "snyaggarwal/oclapi",
"path": "ocl/concepts/validation_messages.py",
"copies": "6",
"size": "1328",
"license": "mpl-2.0",
"hash": 5041357683846038000,
"line_mean": 68.8947368421,
"line_max": 128,
"alpha_frac": 0.7906626506,
"autogenerated": false,
"ratio": 3.3535353535353534,
"con... |
BASIC_DESCRIPTION_LOCALE = 'Description locale should be valid attribute'
BASIC_NAME_LOCALE = 'Name locale should be valid attribute'
BASIC_DESCRIPTION_TYPE = 'Description type should be valid attribute'
BASIC_NAME_TYPE = 'Name type should be valid attribute'
BASIC_DATATYPE = 'Data type should be valid attribute'
BASIC... | {
"repo_name": "ayseyo/oclapi",
"path": "django-nonrel/ocl/concepts/validation_messages.py",
"copies": "1",
"size": "1366",
"license": "mpl-2.0",
"hash": 7393068874361369000,
"line_mean": 84.375,
"line_max": 128,
"alpha_frac": 0.7942898975,
"autogenerated": false,
"ratio": 3.604221635883905,
"co... |
"""Basic Device Info api.
AXIS Basic device information API can be used to retrieve simple information about the product.
This information is used to identify basic properties of the product.
"""
import attr
from .api import APIItem, APIItems, Body
URL = "/axis-cgi/basicdeviceinfo.cgi"
API_DISCOVERY_ID = "basic-de... | {
"repo_name": "Kane610/axis",
"path": "axis/basic_device_info.py",
"copies": "1",
"size": "3927",
"license": "mit",
"hash": 3567480986939620000,
"line_mean": 22.1,
"line_max": 95,
"alpha_frac": 0.547491724,
"autogenerated": false,
"ratio": 4.177659574468085,
"config_test": false,
"has_no_keyw... |
# basic dictionary
d = {}
print(d)
d[2] = 123
print(d)
d = {1:2}
d[3] = 3
print(len(d), d[1], d[3])
d[1] = 0
print(len(d), d[1], d[3])
print(str(d) == '{1: 0, 3: 3}' or str(d) == '{3: 3, 1: 0}')
x = 1
while x < 100:
d[x] = x
x += 1
print(d[50])
# equality operator on dicts of different size
print({} == {1:1}... | {
"repo_name": "kerneltask/micropython",
"path": "tests/basics/dict1.py",
"copies": "16",
"size": "1046",
"license": "mit",
"hash": -6945142382440879000,
"line_mean": 13.9428571429,
"line_max": 65,
"alpha_frac": 0.569789675,
"autogenerated": false,
"ratio": 2.3881278538812785,
"config_test": fal... |
"""Basic drawing functions to generate a shape-based graphic."""
import types
import numpy as np
import cv2
import cv2.cv as cv
from lumos.util import KeyCode
import graphics
class Drawing(object):
window_name = "Drawing"
window_width, window_height = 640, 480
window_delay = 10 # ms; determines the window u... | {
"repo_name": "napratin/nap",
"path": "nap/util/drawing.py",
"copies": "1",
"size": "8590",
"license": "mit",
"hash": -7909274241190425000,
"line_mean": 44.4497354497,
"line_max": 239,
"alpha_frac": 0.6720605355,
"autogenerated": false,
"ratio": 3.7891486546096163,
"config_test": false,
"has_... |
# basic edge detection code
from PIL import Image
import ImageFilter
import cv
import numpy as np
import sys
import math
#load greyscale image
img = cv.LoadImage("bx5.jpg",cv.CV_LOAD_IMAGE_GRAYSCALE)
#load colour image for displaying
im = cv.LoadImage("bx5.jpg");
#canny edge detector
edges= cv.CreateImage(cv.GetSize... | {
"repo_name": "rc500/ardrone_archive_aarons_laptop",
"path": "cng22_tests/feature_detection/square_detector.py",
"copies": "1",
"size": "2696",
"license": "apache-2.0",
"hash": 1993007260649560000,
"line_mean": 28.9555555556,
"line_max": 138,
"alpha_frac": 0.6847181009,
"autogenerated": false,
"r... |
# basic edge detection code
from PIL import Image
import ImageFilter
import cv
import numpy as np
import sys
#load greyscale image
img = cv.LoadImageM("s2.jpg",cv.CV_LOAD_IMAGE_GRAYSCALE)
#load colour image for displaying
im = cv.LoadImageM("s2.jpg");
#canny edge detector
edges= cv.CreateImage(cv.GetSize(img), 8, 1... | {
"repo_name": "rc500/ardrone_archive_aarons_laptop",
"path": "cng22_tests/feature_detection/Contour_detection_test.py",
"copies": "1",
"size": "2085",
"license": "apache-2.0",
"hash": 6979271420874051000,
"line_mean": 24.7407407407,
"line_max": 100,
"alpha_frac": 0.7136690647,
"autogenerated": fals... |
'''Basic, efficient interface to TAQ data using numpy
A central design goal is minimizing external dependencies
'''
from zipfile import ZipFile
from pytz import timezone
import numpy as np
from datetime import datetime
class BytesSpec(object):
'''A description of the records in raw TAQ files'''
# List of ... | {
"repo_name": "dlab-projects/python-taq",
"path": "marketflow/raw_taq.py",
"copies": "3",
"size": "14741",
"license": "bsd-2-clause",
"hash": -1424254769383645200,
"line_mean": 40.7592067989,
"line_max": 79,
"alpha_frac": 0.5220134319,
"autogenerated": false,
"ratio": 4.496949359365467,
"config... |
"""Basic encode/decode utils, taken from PyJWT."""
from __future__ import annotations
import calendar
import datetime
from typing import Dict, List, Optional, Sequence
from django.conf import settings
from jwt import decode as jwt_decode
from jwt import encode as jwt_encode
from jwt import exceptions
# verification ... | {
"repo_name": "yunojuno/django-expiring-links",
"path": "request_token/utils.py",
"copies": "1",
"size": "2131",
"license": "mit",
"hash": -6958607787839978000,
"line_mean": 29.4428571429,
"line_max": 83,
"alpha_frac": 0.6809009855,
"autogenerated": false,
"ratio": 3.6303236797274274,
"config_t... |
"""Basic Encoding Rules (BER) codec.
"""
import time
import math
import binascii
from copy import copy
import datetime
from ..errors import Error
from ..parser import EXTENSION_MARKER
from . import BaseType
from . import EncodeError
from . import DecodeError
from . import DecodeTagError
from . import OutOfDataError
... | {
"repo_name": "eerimoq/asn1tools",
"path": "asn1tools/codecs/ber.py",
"copies": "1",
"size": "54504",
"license": "mit",
"hash": -4670870622940052000,
"line_mean": 29.6719189645,
"line_max": 115,
"alpha_frac": 0.5402172318,
"autogenerated": false,
"ratio": 4.300796969936084,
"config_test": false... |
"""Basic Entity."""
# TODO: better module docstring
# pylint: disable=all
from xoinvader import constants
from xoinvader.common import Settings
if Settings.system.video_driver == constants.DRIVER_SDL:
import pygame
else:
class pygame(object):
Rect = object
@staticmethod
def Surface(*a... | {
"repo_name": "pankshok/xoinvader",
"path": "xoinvader/entity.py",
"copies": "1",
"size": "1246",
"license": "mit",
"hash": 6373892333604735000,
"line_mean": 28.6666666667,
"line_max": 102,
"alpha_frac": 0.6099518459,
"autogenerated": false,
"ratio": 3.358490566037736,
"config_test": false,
"... |
"""Basic Enum data structure.
.. moduleauthor:: Dave Zimmelman <zimmed@zimmed.io>
Exports:
:class Enum -- Basic enumerated value object.
:class EnumInt -- Enum with int values instead of str.
"""
from core.dotdict import ImmutableDotDict
class Enum(ImmutableDotDict):
""" Simple class for generating en... | {
"repo_name": "zimmed/zimmed-core",
"path": "enum.py",
"copies": "1",
"size": "2386",
"license": "mit",
"hash": -2414473493294429000,
"line_mean": 25.2197802198,
"line_max": 77,
"alpha_frac": 0.5410729254,
"autogenerated": false,
"ratio": 3.799363057324841,
"config_test": false,
"has_no_keywo... |
'''Basic event classes.'''
class Event(object):
def __init__(self, source, target):
'''Provide a Situation and a Unit for the event to occur in/to.'''
# target is usually a subclass of Unit
self._target = target
# source can be anything that includes a reference to the ga... | {
"repo_name": "theJollySin/pytextgame",
"path": "pytextgame/events.py",
"copies": "1",
"size": "1280",
"license": "mit",
"hash": 3751523454699925500,
"line_mean": 28.4761904762,
"line_max": 96,
"alpha_frac": 0.58515625,
"autogenerated": false,
"ratio": 4.571428571428571,
"config_test": false,
... |
"""Basic example of a DQN policy without any optimizations."""
from gym.spaces import Discrete
import logging
import ray
from ray.rllib.agents.dqn.simple_q_model import SimpleQModel
from ray.rllib.policy.policy import Policy
from ray.rllib.policy.sample_batch import SampleBatch
from ray.rllib.models import ModelCatal... | {
"repo_name": "stephanie-wang/ray",
"path": "rllib/agents/dqn/simple_q_policy.py",
"copies": "1",
"size": "7543",
"license": "apache-2.0",
"hash": 8022210411931934000,
"line_mean": 34.2476635514,
"line_max": 79,
"alpha_frac": 0.6388704759,
"autogenerated": false,
"ratio": 3.501857010213556,
"co... |
'''Basic example of an external stage for filtering a corpus using
string match; see http://github.com/trec-kba/streamcorpus-filter for a
more sophisticated approach to this basic concept.
.. This software is released under an MIT/X11 open source license.
Copyright 2012-2014 Diffeo, Inc.
Example YAML configuration... | {
"repo_name": "trec-kba/streamcorpus-pipeline",
"path": "examples/filter_exact_match.py",
"copies": "1",
"size": "1526",
"license": "mit",
"hash": 7888370738922117000,
"line_mean": 35.3333333333,
"line_max": 83,
"alpha_frac": 0.7064220183,
"autogenerated": false,
"ratio": 3.7586206896551726,
"c... |
"""Basic example of Bachata usage.
"""
import os
import sys
import asyncio
import tornado.ioloop
import tornado.httpserver
import tornado.web
import bachata
import bachata.tornado
import bachata.redis
APP_HOST = ('127.0.0.1', 8000)
REDIS_HOST = ('127.0.0.1', 6379)
REDIS_DB = 0
# Note 1: we have to setup Tornado-async... | {
"repo_name": "05bit/bachata",
"path": "example/server.py",
"copies": "1",
"size": "2802",
"license": "apache-2.0",
"hash": -5486317227827359000,
"line_mean": 27.303030303,
"line_max": 74,
"alpha_frac": 0.6391862955,
"autogenerated": false,
"ratio": 3.843621399176955,
"config_test": false,
"h... |
"""Basic example of hyperlinks -- show CNN news site with clickable URL's."""
# std imports
import random
# 3rd party
import requests
# local
# 3rd-party
from bs4 import BeautifulSoup
# local imports
from blessed import Terminal
def embolden(phrase):
# bold some phrases
return phrase.isdigit() or phrase[:1]... | {
"repo_name": "jquast/blessed",
"path": "bin/cnn.py",
"copies": "1",
"size": "1460",
"license": "mit",
"hash": 3024942590297906000,
"line_mean": 27.0769230769,
"line_max": 88,
"alpha_frac": 0.6130136986,
"autogenerated": false,
"ratio": 3.2882882882882885,
"config_test": false,
"has_no_keywor... |
# basic example of plotting data + time data
import svgdatashapes as s
import svgdatashapes_dt as sdt # for date/time support
def example5(): # plot some dates with times
dataset1 = [ ('2016-02-29T23:59:20', 45), ('2016-03-1T00:01:17', 33), ('2016-03-1T16:25:33', 22),
... | {
"repo_name": "grubbcode/minplot",
"path": "examples/e5.py",
"copies": "2",
"size": "1603",
"license": "mit",
"hash": 118077641441267380,
"line_mean": 38.0975609756,
"line_max": 104,
"alpha_frac": 0.5988771054,
"autogenerated": false,
"ratio": 3.0302457466918713,
"config_test": false,
"has_no... |
# basic example of plotting date data
import svgdatashapes as s
import svgdatashapes_dt as sdt # for date/time support
def example4(): # plot some date-based data
dataset1 = [ ('2015/04/10', 45), ('2015/12/2', 33), ('2015/12/7', 22),
('2015/12/28', 30... | {
"repo_name": "grubbcode/minplot",
"path": "examples/e4.py",
"copies": "2",
"size": "1726",
"license": "mit",
"hash": -3375903822307833,
"line_mean": 36.5217391304,
"line_max": 100,
"alpha_frac": 0.6037079954,
"autogenerated": false,
"ratio": 3.115523465703971,
"config_test": false,
"has_no_k... |
# Basic example of the Temporal Difference
import numpy as np
import random as rand
numberOfEpisodes = 10000
numberOfStates = 6
# elegibility table
e = np.array([0 for _ in range(numberOfStates)])
# Value Table
V = np.array([rand.random() * 0 for _ in range(numberOfStates)])
# _lambda is from the TD(lambda)
_lambda ... | {
"repo_name": "IAAAIAAIA/studyGroup",
"path": "steffen/td_test.py",
"copies": "2",
"size": "2148",
"license": "mit",
"hash": -6033092199683971000,
"line_mean": 23.4090909091,
"line_max": 93,
"alpha_frac": 0.5931098696,
"autogenerated": false,
"ratio": 3.5387149917627676,
"config_test": false,
... |
"""Basic example on how to use the functional class together with solvers.
This file shows an example of how to set up and solve an optimization problem
using the default functionals. The problem we will solve is
minimize 1/2 * ||x - g||_2^2 + lam*||x||_1,
for some vector g and some constant lam, subject to that... | {
"repo_name": "kohr-h/odl",
"path": "examples/solvers/functional_basic_example_solver.py",
"copies": "4",
"size": "1804",
"license": "mpl-2.0",
"hash": -9120966532340139000,
"line_mean": 30.1034482759,
"line_max": 78,
"alpha_frac": 0.6812638581,
"autogenerated": false,
"ratio": 3.137391304347826,... |
"""Basic example on how to write a functional.
This is an example of how to implement the functional ``||x||_2^2``. For more
information on functionals, see `the ODL functional guide
<http://odlgroup.github.io/odl/guide/in_depth/functional_guide.html>`_
"""
import numpy as np
import odl
# Here we define the functio... | {
"repo_name": "kohr-h/odl",
"path": "examples/solvers/functional_basic_example.py",
"copies": "3",
"size": "2185",
"license": "mpl-2.0",
"hash": 611395804579052400,
"line_mean": 31.6119402985,
"line_max": 78,
"alpha_frac": 0.6805491991,
"autogenerated": false,
"ratio": 3.2857142857142856,
"conf... |
# Basic example showing how to cache ipwhois RDAP results with Redis.
import argparse
import redis
from os import path
from ipwhois import IPWhois
from datetime import datetime, timedelta
import pickle
from pprint import pprint
# Setup the arg parser.
parser = argparse.ArgumentParser(
description='ipwhois RDAP re... | {
"repo_name": "secynic/ipwhois",
"path": "ipwhois/examples/redis_cache/redis_cache.py",
"copies": "1",
"size": "3757",
"license": "bsd-2-clause",
"hash": 2850327968873111600,
"line_mean": 24.9103448276,
"line_max": 74,
"alpha_frac": 0.6223050306,
"autogenerated": false,
"ratio": 3.768304914744233... |
# Basic example showing how to use ipwhois with elasticsearch/kibana.
#
# For geolite2 data, download the GeoLite2 database GeoLite2-City.mmdb and
# place in the data directory:
# https://dev.maxmind.com/geoip/geoip2/geolite2/
import argparse
import elasticsearch
from elasticsearch.helpers import scan
from ipwhois imp... | {
"repo_name": "Blue-Labs/ipwhois",
"path": "ipwhois/examples/elastic_search/elastic_search.py",
"copies": "2",
"size": "14728",
"license": "bsd-2-clause",
"hash": -4965943919849733000,
"line_mean": 26.375464684,
"line_max": 80,
"alpha_frac": 0.4469717545,
"autogenerated": false,
"ratio": 4.442835... |
# Basic exceptions
class ExtractorError(Exception):
"""Base class for custom exceptions"""
pass
class MalformedDataError(ExtractorError):
"""
Exception to be raised when something unexpected happens while
parsing the data extracted from the messages
"""
pass
class NotRecordedError(Extrac... | {
"repo_name": "hschh86/usersong-extractor",
"path": "commons/exceptions.py",
"copies": "1",
"size": "1083",
"license": "mit",
"hash": -8564100168154312000,
"line_mean": 22.5434782609,
"line_max": 77,
"alpha_frac": 0.6620498615,
"autogenerated": false,
"ratio": 4.770925110132159,
"config_test": ... |
"""Basic feedforward networks.
"""
from functools import partial, wraps;
import yaml;
import numpy as np;
import tensorflow as tf;
from .utils import get_randn_variable, get_zeros_variable, init_uninit;
__all__ = ['FullyConnectedModel', 'Model']
_IDENT_NAMES = set(['ident', 'identity', 'linear']);
def get_activat... | {
"repo_name": "nryant/tensorflow_mnist_examples",
"path": "mnist_lib/models.py",
"copies": "1",
"size": "14063",
"license": "apache-2.0",
"hash": -8348599833242053000,
"line_mean": 33.7234567901,
"line_max": 81,
"alpha_frac": 0.5039465263,
"autogenerated": false,
"ratio": 4.166814814814815,
"co... |
# Basic fields and other things required for model checking.
import z3
from . import Core, DumbNode
class Context(Core):
"""Context for all of the rest that follows. Every network needs one of
these"""
def _init (self, nodes, addresses):
self._mkTypes (nodes, addresses)
self.constraints = l... | {
"repo_name": "apanda/modeling",
"path": "mcnet/components/context.py",
"copies": "1",
"size": "7957",
"license": "bsd-3-clause",
"hash": 6822185742796762000,
"line_mean": 44.7298850575,
"line_max": 103,
"alpha_frac": 0.5185371371,
"autogenerated": false,
"ratio": 3.127751572327044,
"config_tes... |
""" Basic fields """
import pytz
import inspect
import datetime
import decimal
from pyramid.compat import NativeIO
from . import iso8601
from . import vocabulary
from .field import InputField
from .fieldset import Fieldset
from .directives import field
from .composite import CompositeField
from .interfaces import _, n... | {
"repo_name": "djedproject/djed.form",
"path": "djed/form/fields.py",
"copies": "1",
"size": "15778",
"license": "isc",
"hash": -1586625603085967400,
"line_mean": 25.3405676127,
"line_max": 79,
"alpha_frac": 0.5687032577,
"autogenerated": false,
"ratio": 4.087564766839378,
"config_test": false,... |
""" Basic filesystem operations for the `ligament` task operator """
import os
import glob
import shutil
from ligament.buildtarget import BuildTarget
from ligament.helpers import mkdir_recursive, pdebug
class Copy(BuildTarget):
def __init__(self, filemap, **kwargs):
BuildTarget.__init__(self, **kwargs)
... | {
"repo_name": "Adjective-Object/ligament",
"path": "ligament_fs/__init__.py",
"copies": "1",
"size": "1488",
"license": "apache-2.0",
"hash": -1224127657577789700,
"line_mean": 30.6595744681,
"line_max": 68,
"alpha_frac": 0.5443548387,
"autogenerated": false,
"ratio": 4.05449591280654,
"config_... |
# basic flask example
# we use some bootstrap for html but I believe any js shit can be used
from flask import Flask
from flask import request
from flask import make_response
from flask import redirect
from flask import render_template
from flask_bootstrap import Bootstrap
from flask_moment import Moment
from datetime ... | {
"repo_name": "Dr762/flaskBase",
"path": "Basics/flaskbase.py",
"copies": "1",
"size": "1273",
"license": "apache-2.0",
"hash": 2741438394646933500,
"line_mean": 21.3333333333,
"line_max": 72,
"alpha_frac": 0.6952081697,
"autogenerated": false,
"ratio": 3.4686648501362396,
"config_test": false,... |
# Basic Frame Differencing Example
#
# Note: You will need an SD card to run this example.
#
# This example demonstrates using frame differencing with your OpenMV Cam. It's
# called basic frame differencing because there's no background image update.
# So, as time passes the background image may change resulting in iss... | {
"repo_name": "openmv/openmv",
"path": "scripts/examples/Arduino/Portenta-H7/20-Frame-Differencing/on_disk_basic_frame_differencing.py",
"copies": "2",
"size": "1782",
"license": "mit",
"hash": -7923498128492659000,
"line_mean": 41.4285714286,
"line_max": 87,
"alpha_frac": 0.7300785634,
"autogenera... |
"""Basic functionality of all model parts."""
from abc import ABCMeta
from typing import MutableSet, Set, List, Tuple, Iterable
from neuralmonkey.model.parameterized import Parameterized, InitializerSpecs
from neuralmonkey.model.feedable import Feedable
class GenericModelPart(metaclass=ABCMeta):
"""Base class fo... | {
"repo_name": "ufal/neuralmonkey",
"path": "neuralmonkey/model/model_part.py",
"copies": "1",
"size": "4048",
"license": "bsd-3-clause",
"hash": -656351895634243800,
"line_mean": 38.3009708738,
"line_max": 79,
"alpha_frac": 0.6563735178,
"autogenerated": false,
"ratio": 4.482834994462902,
"conf... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.