text stringlengths 0 1.05M | meta dict |
|---|---|
# binary search tree
# https://www.cs.cmu.edu/~adamchik/15-121/lectures/Trees/trees.html
# http://www.openbookproject.net/thinkcs/archive/java/english/chap17.htm
import queue
import stack
class Node:
def __init__(self, data_):
self.__data = data_
self.__left = None
self.__right = None
... | {
"repo_name": "uai/VZI",
"path": "04/py/tree.py",
"copies": "1",
"size": "7218",
"license": "bsd-3-clause",
"hash": -544460325016594600,
"line_mean": 23.9238754325,
"line_max": 84,
"alpha_frac": 0.5368596418,
"autogenerated": false,
"ratio": 3.478029937228392,
"config_test": false,
"has_no_ke... |
# Binary search tree
class Node(object):
def __init__(self, val):
self.left = None
self.right = None
self.v = val
class Tree(object):
def __init__(self):
self.root = None
def getRoot(self):
return self.root
def getLeft(self):
return self.left
def get... | {
"repo_name": "mayank-agarwal-96/dsapy",
"path": "ds/bst.py",
"copies": "1",
"size": "1566",
"license": "mit",
"hash": 1653103402908594000,
"line_mean": 23.0923076923,
"line_max": 50,
"alpha_frac": 0.4897828863,
"autogenerated": false,
"ratio": 3.7197149643705463,
"config_test": false,
"has_n... |
"""Binary Search Tree."""
class Node(object):
"""Create Node class for BST."""
def __init__(self, data):
"""Initialization of node class object."""
self.data = data
self.left = None
self.right = None
self.depth = 0
self.parent = None
class BST(object):
""... | {
"repo_name": "allanliebold/data-structures",
"path": "src/bst.py",
"copies": "1",
"size": "7467",
"license": "mit",
"hash": 836200254687677300,
"line_mean": 27.9418604651,
"line_max": 69,
"alpha_frac": 0.4898888442,
"autogenerated": false,
"ratio": 4.361565420560748,
"config_test": false,
"h... |
""" Binary Search Tree """
import random
# Defining node
class Node(object):
def __init__(self,val=None):
self.val = val
self.left = None
self.right = None
# Operations performed on the tree
class Tree(object):
def insert(self,root,val):
if root == None:
... | {
"repo_name": "Cnidarias/al-go-rithms",
"path": "data_structures/b_tree/Python/binary_search_tree.py",
"copies": "3",
"size": "1735",
"license": "mit",
"hash": 3510454947408858600,
"line_mean": 20.5324675325,
"line_max": 62,
"alpha_frac": 0.5331412104,
"autogenerated": false,
"ratio": 3.261278195... |
from helper import *
ev = 0.00000001
class Q:
def __init__(self, key, value):
self.key = key
self.value = value
self.left = None
self.right = None
def find(self, key):
if self.key is None:
return False
c = compare_by_y(key, self.key)
if c==0:
return True
elif c==-1:
if self.left:
sel... | {
"repo_name": "Maplenormandy/list-62x",
"path": "python/twocamera/Q.py",
"copies": "1",
"size": "1704",
"license": "mit",
"hash": 1620199653068906500,
"line_mean": 20.037037037,
"line_max": 106,
"alpha_frac": 0.6367370892,
"autogenerated": false,
"ratio": 2.761750405186386,
"config_test": false... |
from helper import *
ev = 0.00000001
class T:
def __init__(self):
self.root = Node(None, None, None, None)
def contain_p(self, p):
if self.root.value is None:
return [[], []]
lists = [[], []]
self.root.contain_p(p, lists)
return (lists[0], lists[1])
def get_left_neighbor(self, p):
if self.root.val... | {
"repo_name": "Maplenormandy/list-62x",
"path": "python/twocamera/T.py",
"copies": "1",
"size": "8674",
"license": "mit",
"hash": 2928078827345557000,
"line_mean": 25.8544891641,
"line_max": 106,
"alpha_frac": 0.6404196449,
"autogenerated": false,
"ratio": 2.7712460063897764,
"config_test": fal... |
"""Binary Sensor for MeteoAlarm.eu."""
from datetime import timedelta
import logging
from meteoalertapi import Meteoalert
import voluptuous as vol
from homeassistant.components.binary_sensor import (
DEVICE_CLASS_SAFETY,
PLATFORM_SCHEMA,
BinarySensorEntity,
)
from homeassistant.const import ATTR_ATTRIBUTI... | {
"repo_name": "kennedyshead/home-assistant",
"path": "homeassistant/components/meteoalarm/binary_sensor.py",
"copies": "5",
"size": "2518",
"license": "apache-2.0",
"hash": -6848001799499841000,
"line_mean": 25.7872340426,
"line_max": 68,
"alpha_frac": 0.6525019857,
"autogenerated": false,
"ratio... |
"""Binary Sensor for MeteoAlarm.eu."""
from datetime import timedelta
import logging
import voluptuous as vol
from homeassistant.components.binary_sensor import (
PLATFORM_SCHEMA, BinarySensorDevice)
from homeassistant.const import ATTR_ATTRIBUTION, CONF_NAME
import homeassistant.helpers.config_validation as cv
... | {
"repo_name": "jabesq/home-assistant",
"path": "homeassistant/components/meteoalarm/binary_sensor.py",
"copies": "1",
"size": "2501",
"license": "apache-2.0",
"hash": -3619413329149899000,
"line_mean": 26.7888888889,
"line_max": 68,
"alpha_frac": 0.6605357857,
"autogenerated": false,
"ratio": 4.0... |
"""Binary Sensor for MeteoAlarm.eu."""
from datetime import timedelta
import logging
import voluptuous as vol
from homeassistant.components.binary_sensor import PLATFORM_SCHEMA, BinarySensorDevice
from homeassistant.const import ATTR_ATTRIBUTION, CONF_NAME
import homeassistant.helpers.config_validation as cv
_LOGGER... | {
"repo_name": "fbradyirl/home-assistant",
"path": "homeassistant/components/meteoalarm/binary_sensor.py",
"copies": "4",
"size": "2520",
"license": "apache-2.0",
"hash": -5357740335354504000,
"line_mean": 26.6923076923,
"line_max": 86,
"alpha_frac": 0.6555555556,
"autogenerated": false,
"ratio": ... |
"""Binary sensor for Shelly."""
from homeassistant.components.binary_sensor import (
DEVICE_CLASS_CONNECTIVITY,
DEVICE_CLASS_GAS,
DEVICE_CLASS_MOISTURE,
DEVICE_CLASS_MOTION,
DEVICE_CLASS_OPENING,
DEVICE_CLASS_POWER,
DEVICE_CLASS_PROBLEM,
DEVICE_CLASS_SMOKE,
DEVICE_CLASS_VIBRATION,
... | {
"repo_name": "turbokongen/home-assistant",
"path": "homeassistant/components/shelly/binary_sensor.py",
"copies": "1",
"size": "4770",
"license": "apache-2.0",
"hash": 6914822770531503000,
"line_mean": 30.1764705882,
"line_max": 79,
"alpha_frac": 0.6423480084,
"autogenerated": false,
"ratio": 4.0... |
"""Binary sensor for Shelly."""
from homeassistant.components.binary_sensor import (
DEVICE_CLASS_CONNECTIVITY,
DEVICE_CLASS_GAS,
DEVICE_CLASS_MOISTURE,
DEVICE_CLASS_OPENING,
DEVICE_CLASS_POWER,
DEVICE_CLASS_PROBLEM,
DEVICE_CLASS_SMOKE,
DEVICE_CLASS_VIBRATION,
BinarySensorEntity,
)
... | {
"repo_name": "tboyce021/home-assistant",
"path": "homeassistant/components/shelly/binary_sensor.py",
"copies": "1",
"size": "3891",
"license": "apache-2.0",
"hash": 921180647272024700,
"line_mean": 31.1570247934,
"line_max": 84,
"alpha_frac": 0.6576715497,
"autogenerated": false,
"ratio": 3.9263... |
"""Binary sensor for Shelly."""
from homeassistant.components.binary_sensor import (
DEVICE_CLASS_GAS,
DEVICE_CLASS_MOISTURE,
DEVICE_CLASS_OPENING,
DEVICE_CLASS_PROBLEM,
DEVICE_CLASS_SMOKE,
DEVICE_CLASS_VIBRATION,
BinarySensorEntity,
)
from .entity import (
BlockAttributeDescription,
... | {
"repo_name": "tchellomello/home-assistant",
"path": "homeassistant/components/shelly/binary_sensor.py",
"copies": "1",
"size": "2099",
"license": "apache-2.0",
"hash": 8582209367942428000,
"line_mean": 31.2923076923,
"line_max": 75,
"alpha_frac": 0.6717484516,
"autogenerated": false,
"ratio": 3.... |
"""Binary Sensor platform for Advantage Air integration."""
from homeassistant.components.binary_sensor import (
DEVICE_CLASS_MOTION,
DEVICE_CLASS_PROBLEM,
BinarySensorEntity,
)
from .const import DOMAIN as ADVANTAGE_AIR_DOMAIN
from .entity import AdvantageAirEntity
PARALLEL_UPDATES = 0
async def async... | {
"repo_name": "kennedyshead/home-assistant",
"path": "homeassistant/components/advantage_air/binary_sensor.py",
"copies": "1",
"size": "2778",
"license": "apache-2.0",
"hash": -5824941945336875000,
"line_mean": 28.8709677419,
"line_max": 95,
"alpha_frac": 0.6371490281,
"autogenerated": false,
"ra... |
"""Binary Sensor platform for FireServiceRota integration."""
from homeassistant.components.binary_sensor import BinarySensorEntity
from homeassistant.config_entries import ConfigEntry
from homeassistant.core import HomeAssistant
from homeassistant.helpers.update_coordinator import (
CoordinatorEntity,
DataUpda... | {
"repo_name": "home-assistant/home-assistant",
"path": "homeassistant/components/fireservicerota/binary_sensor.py",
"copies": "2",
"size": "2480",
"license": "apache-2.0",
"hash": 2641637794389845000,
"line_mean": 27.5057471264,
"line_max": 82,
"alpha_frac": 0.6133064516,
"autogenerated": false,
... |
"""Binary Sensor platform for FireServiceRota integration."""
import logging
from homeassistant.components.binary_sensor import BinarySensorEntity
from homeassistant.config_entries import ConfigEntry
from homeassistant.helpers.typing import HomeAssistantType
from homeassistant.helpers.update_coordinator import (
C... | {
"repo_name": "tboyce021/home-assistant",
"path": "homeassistant/components/fireservicerota/binary_sensor.py",
"copies": "2",
"size": "2554",
"license": "apache-2.0",
"hash": 766685182515348200,
"line_mean": 27.0659340659,
"line_max": 82,
"alpha_frac": 0.6178543461,
"autogenerated": false,
"ratio... |
"""Binary sensor platform for Frigate."""
from __future__ import annotations
import logging
from typing import Any, cast
from homeassistant.components.binary_sensor import (
DEVICE_CLASS_MOTION,
BinarySensorEntity,
)
from homeassistant.components.mqtt.models import Message
from homeassistant.config_entries im... | {
"repo_name": "jnewland/ha-config",
"path": "custom_components/frigate/binary_sensor.py",
"copies": "1",
"size": "3377",
"license": "mit",
"hash": -7252466871471326000,
"line_mean": 29.4234234234,
"line_max": 87,
"alpha_frac": 0.5952028428,
"autogenerated": false,
"ratio": 3.917633410672854,
"c... |
"""Binary Sensor platform for Garages Amsterdam."""
from __future__ import annotations
from typing import Any
from homeassistant.components.binary_sensor import (
DEVICE_CLASS_PROBLEM,
BinarySensorEntity,
)
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import ATTR_ATTRIBUTION
f... | {
"repo_name": "home-assistant/home-assistant",
"path": "homeassistant/components/garages_amsterdam/binary_sensor.py",
"copies": "2",
"size": "2343",
"license": "apache-2.0",
"hash": -5798238516181481000,
"line_mean": 27.9259259259,
"line_max": 86,
"alpha_frac": 0.6688006829,
"autogenerated": false,... |
"""Binary sensor platform for hvv_departures."""
from datetime import timedelta
import logging
from aiohttp import ClientConnectorError
import async_timeout
from pygti.exceptions import InvalidAuth
from homeassistant.components.binary_sensor import (
DEVICE_CLASS_PROBLEM,
BinarySensorEntity,
)
from homeassist... | {
"repo_name": "tboyce021/home-assistant",
"path": "homeassistant/components/hvv_departures/binary_sensor.py",
"copies": "8",
"size": "6593",
"license": "apache-2.0",
"hash": -1378222076935729400,
"line_mean": 31.8009950249,
"line_max": 85,
"alpha_frac": 0.5771272562,
"autogenerated": false,
"rati... |
"""Binary sensor platform for mobile_app."""
from functools import partial
from homeassistant.const import CONF_WEBHOOK_ID
from homeassistant.core import callback
from homeassistant.components.binary_sensor import BinarySensorDevice
from homeassistant.helpers.dispatcher import async_dispatcher_connect
from .const imp... | {
"repo_name": "Cinntax/home-assistant",
"path": "homeassistant/components/mobile_app/binary_sensor.py",
"copies": "1",
"size": "1949",
"license": "apache-2.0",
"hash": -8893527171438246000,
"line_mean": 28.0895522388,
"line_max": 81,
"alpha_frac": 0.6844535659,
"autogenerated": false,
"ratio": 3.... |
"""Binary sensor platform integration for Numato USB GPIO expanders."""
from functools import partial
import logging
from numato_gpio import NumatoGpioError
from homeassistant.components.binary_sensor import BinarySensorDevice
from homeassistant.const import DEVICE_DEFAULT_NAME
from homeassistant.core import callback... | {
"repo_name": "mKeRix/home-assistant",
"path": "homeassistant/components/numato/binary_sensor.py",
"copies": "5",
"size": "3716",
"license": "mit",
"hash": -5326853048757719000,
"line_mean": 29.9666666667,
"line_max": 94,
"alpha_frac": 0.5885360603,
"autogenerated": false,
"ratio": 4.083516483516... |
"""Binary sensors for the Elexa Guardian integration."""
from __future__ import annotations
from typing import Callable
from homeassistant.components.binary_sensor import (
DEVICE_CLASS_CONNECTIVITY,
DEVICE_CLASS_MOISTURE,
DEVICE_CLASS_MOVING,
BinarySensorEntity,
)
from homeassistant.config_entries im... | {
"repo_name": "w1ll1am23/home-assistant",
"path": "homeassistant/components/guardian/binary_sensor.py",
"copies": "3",
"size": "6719",
"license": "apache-2.0",
"hash": -6622981120684660000,
"line_mean": 31.1483253589,
"line_max": 88,
"alpha_frac": 0.5974103289,
"autogenerated": false,
"ratio": 3.... |
"""Binary sensors for the Elexa Guardian integration."""
from homeassistant.components.binary_sensor import BinarySensorEntity
from homeassistant.core import callback
from . import GuardianEntity
from .const import (
DATA_CLIENT,
DATA_SENSOR_STATUS,
DATA_WIFI_STATUS,
DOMAIN,
SENSOR_KIND_AP_INFO,
... | {
"repo_name": "robbiet480/home-assistant",
"path": "homeassistant/components/guardian/binary_sensor.py",
"copies": "2",
"size": "1883",
"license": "apache-2.0",
"hash": -4238208748439276500,
"line_mean": 29.3709677419,
"line_max": 82,
"alpha_frac": 0.6086032926,
"autogenerated": false,
"ratio": 3... |
"""Binary sensors for the Elexa Guardian integration."""
from typing import Callable, Dict
from aioguardian import Client
from homeassistant.components.binary_sensor import BinarySensorEntity
from homeassistant.config_entries import ConfigEntry
from homeassistant.core import HomeAssistant, callback
from homeassistant... | {
"repo_name": "mKeRix/home-assistant",
"path": "homeassistant/components/guardian/binary_sensor.py",
"copies": "3",
"size": "3344",
"license": "mit",
"hash": -6871115878135031000,
"line_mean": 31.1538461538,
"line_max": 88,
"alpha_frac": 0.6067583732,
"autogenerated": false,
"ratio": 3.8569780853... |
"""Binary sensors for the Elexa Guardian integration."""
from typing import Callable, Dict
from aioguardian import Client
from homeassistant.components.binary_sensor import (
DEVICE_CLASS_CONNECTIVITY,
DEVICE_CLASS_MOISTURE,
BinarySensorEntity,
)
from homeassistant.config_entries import ConfigEntry
from h... | {
"repo_name": "tchellomello/home-assistant",
"path": "homeassistant/components/guardian/binary_sensor.py",
"copies": "1",
"size": "3440",
"license": "apache-2.0",
"hash": 862139550654188000,
"line_mean": 30.8518518519,
"line_max": 88,
"alpha_frac": 0.6104651163,
"autogenerated": false,
"ratio": 3... |
"""Binary sensors on Zigbee Home Automation networks."""
import functools
import logging
from homeassistant.components.binary_sensor import (
DEVICE_CLASS_GAS,
DEVICE_CLASS_MOISTURE,
DEVICE_CLASS_MOTION,
DEVICE_CLASS_MOVING,
DEVICE_CLASS_OCCUPANCY,
DEVICE_CLASS_OPENING,
DEVICE_CLASS_SMOKE,
... | {
"repo_name": "postlund/home-assistant",
"path": "homeassistant/components/zha/binary_sensor.py",
"copies": "2",
"size": "5330",
"license": "apache-2.0",
"hash": -3554318783972661000,
"line_mean": 29.2840909091,
"line_max": 81,
"alpha_frac": 0.6636022514,
"autogenerated": false,
"ratio": 3.648186... |
"""Binary sensors on Zigbee Home Automation networks."""
import functools
from homeassistant.components.binary_sensor import (
DEVICE_CLASS_GAS,
DEVICE_CLASS_MOISTURE,
DEVICE_CLASS_MOTION,
DEVICE_CLASS_MOVING,
DEVICE_CLASS_OCCUPANCY,
DEVICE_CLASS_OPENING,
DEVICE_CLASS_SMOKE,
DEVICE_CLAS... | {
"repo_name": "adrienbrault/home-assistant",
"path": "homeassistant/components/zha/binary_sensor.py",
"copies": "7",
"size": "5060",
"license": "mit",
"hash": -30342233806579584,
"line_mean": 28.0804597701,
"line_max": 80,
"alpha_frac": 0.6630434783,
"autogenerated": false,
"ratio": 3.56087262491... |
"""Binary sensors on Zigbee Home Automation networks."""
import logging
from homeassistant.components.binary_sensor import DOMAIN, BinarySensorDevice
from homeassistant.const import STATE_ON
from homeassistant.core import callback
from homeassistant.helpers.dispatcher import async_dispatcher_connect
from .core.const i... | {
"repo_name": "MartinHjelmare/home-assistant",
"path": "homeassistant/components/zha/binary_sensor.py",
"copies": "6",
"size": "7047",
"license": "apache-2.0",
"hash": -1640742351896021200,
"line_mean": 36.2857142857,
"line_max": 78,
"alpha_frac": 0.6249467859,
"autogenerated": false,
"ratio": 3.... |
"""Binary sensor support for the Skybell HD Doorbell."""
from datetime import timedelta
import logging
import voluptuous as vol
from homeassistant.components.binary_sensor import (
BinarySensorDevice, PLATFORM_SCHEMA)
from homeassistant.components.skybell import (
DEFAULT_ENTITY_NAMESPACE, DOMAIN as SKYBELL_D... | {
"repo_name": "HydrelioxGitHub/home-assistant",
"path": "homeassistant/components/skybell/binary_sensor.py",
"copies": "2",
"size": "2850",
"license": "apache-2.0",
"hash": 5261431999876039000,
"line_mean": 29.9782608696,
"line_max": 78,
"alpha_frac": 0.6512280702,
"autogenerated": false,
"ratio"... |
"""Binary sensor support for the Skybell HD Doorbell."""
from datetime import timedelta
import logging
import voluptuous as vol
from homeassistant.components.binary_sensor import (
DEVICE_CLASS_MOTION,
DEVICE_CLASS_OCCUPANCY,
PLATFORM_SCHEMA,
BinarySensorEntity,
)
from homeassistant.const import CONF_... | {
"repo_name": "tchellomello/home-assistant",
"path": "homeassistant/components/skybell/binary_sensor.py",
"copies": "1",
"size": "2887",
"license": "apache-2.0",
"hash": 5772234015565779000,
"line_mean": 28.4591836735,
"line_max": 80,
"alpha_frac": 0.6456529269,
"autogenerated": false,
"ratio": 3... |
"""Binary sensor support for the Skybell HD Doorbell."""
from datetime import timedelta
import logging
import voluptuous as vol
from homeassistant.components.binary_sensor import (
PLATFORM_SCHEMA, BinarySensorDevice)
from homeassistant.const import (
CONF_ENTITY_NAMESPACE, CONF_MONITORED_CONDITIONS)
import h... | {
"repo_name": "jamespcole/home-assistant",
"path": "homeassistant/components/skybell/binary_sensor.py",
"copies": "1",
"size": "2813",
"license": "apache-2.0",
"hash": 1146875553952750800,
"line_mean": 29.5760869565,
"line_max": 79,
"alpha_frac": 0.6491290437,
"autogenerated": false,
"ratio": 3.8... |
"""Binary sensor support for the Skybell HD Doorbell."""
from datetime import timedelta
import logging
import voluptuous as vol
from homeassistant.components.binary_sensor import PLATFORM_SCHEMA, BinarySensorDevice
from homeassistant.const import CONF_ENTITY_NAMESPACE, CONF_MONITORED_CONDITIONS
import homeassistant.h... | {
"repo_name": "qedi-r/home-assistant",
"path": "homeassistant/components/skybell/binary_sensor.py",
"copies": "7",
"size": "2801",
"license": "apache-2.0",
"hash": 6153298715899156000,
"line_mean": 29.1182795699,
"line_max": 86,
"alpha_frac": 0.6451267404,
"autogenerated": false,
"ratio": 3.91748... |
"""Binary sensor support for the Skybell HD Doorbell."""
from datetime import timedelta
import voluptuous as vol
from homeassistant.components.binary_sensor import (
DEVICE_CLASS_MOTION,
DEVICE_CLASS_OCCUPANCY,
PLATFORM_SCHEMA,
BinarySensorEntity,
)
from homeassistant.const import CONF_ENTITY_NAMESPAC... | {
"repo_name": "w1ll1am23/home-assistant",
"path": "homeassistant/components/skybell/binary_sensor.py",
"copies": "5",
"size": "2832",
"license": "apache-2.0",
"hash": -8636891165730082000,
"line_mean": 28.8105263158,
"line_max": 80,
"alpha_frac": 0.6440677966,
"autogenerated": false,
"ratio": 3.8... |
"""Binary sensor support for Wireless Sensor Tags."""
import logging
import voluptuous as vol
from homeassistant.components.binary_sensor import (
PLATFORM_SCHEMA, BinarySensorDevice)
from homeassistant.const import CONF_MONITORED_CONDITIONS, STATE_OFF, STATE_ON
from homeassistant.core import callback
import home... | {
"repo_name": "jamespcole/home-assistant",
"path": "homeassistant/components/wirelesstag/binary_sensor.py",
"copies": "1",
"size": "4297",
"license": "apache-2.0",
"hash": 7219930263449291000,
"line_mean": 29.2605633803,
"line_max": 78,
"alpha_frac": 0.6572026996,
"autogenerated": false,
"ratio":... |
"""Binary sensor support for Wireless Sensor Tags."""
import logging
import voluptuous as vol
from homeassistant.components.binary_sensor import PLATFORM_SCHEMA, BinarySensorDevice
from homeassistant.const import CONF_MONITORED_CONDITIONS, STATE_OFF, STATE_ON
from homeassistant.core import callback
import homeassista... | {
"repo_name": "postlund/home-assistant",
"path": "homeassistant/components/wirelesstag/binary_sensor.py",
"copies": "6",
"size": "4197",
"license": "apache-2.0",
"hash": 2445731642924249000,
"line_mean": 28.3496503497,
"line_max": 86,
"alpha_frac": 0.665713605,
"autogenerated": false,
"ratio": 3.... |
"""Binary sensor support for Wireless Sensor Tags."""
import logging
import voluptuous as vol
from homeassistant.components.binary_sensor import PLATFORM_SCHEMA, BinarySensorEntity
from homeassistant.const import CONF_MONITORED_CONDITIONS, STATE_OFF, STATE_ON
from homeassistant.core import callback
import homeassista... | {
"repo_name": "nkgilley/home-assistant",
"path": "homeassistant/components/wirelesstag/binary_sensor.py",
"copies": "7",
"size": "4247",
"license": "apache-2.0",
"hash": -1024004823304941600,
"line_mean": 28.2896551724,
"line_max": 86,
"alpha_frac": 0.6597598305,
"autogenerated": false,
"ratio": ... |
"""Binary sensor support for Wireless Sensor Tags."""
import logging
import voluptuous as vol
from homeassistant.core import callback
from homeassistant.helpers.dispatcher import async_dispatcher_connect
from homeassistant.components.binary_sensor import (
BinarySensorDevice, PLATFORM_SCHEMA)
from homeassistant.c... | {
"repo_name": "nugget/home-assistant",
"path": "homeassistant/components/wirelesstag/binary_sensor.py",
"copies": "2",
"size": "4342",
"license": "apache-2.0",
"hash": -4225492697123470000,
"line_mean": 29.3636363636,
"line_max": 77,
"alpha_frac": 0.6582220175,
"autogenerated": false,
"ratio": 3.... |
"""Binary sensor support for Wireless Sensor Tags."""
import voluptuous as vol
from homeassistant.components.binary_sensor import PLATFORM_SCHEMA, BinarySensorEntity
from homeassistant.const import CONF_MONITORED_CONDITIONS, STATE_OFF, STATE_ON
from homeassistant.core import callback
import homeassistant.helpers.confi... | {
"repo_name": "home-assistant/home-assistant",
"path": "homeassistant/components/wirelesstag/binary_sensor.py",
"copies": "14",
"size": "4192",
"license": "apache-2.0",
"hash": -8732074646092298000,
"line_mean": 28.7304964539,
"line_max": 86,
"alpha_frac": 0.6591125954,
"autogenerated": false,
"r... |
"""Binary sensor tests."""
from zoneminder.monitor import Monitor, MonitorState
from zoneminder.zm import ZoneMinder
from homeassistant.components.switch import DOMAIN as SWITCH_DOMAIN
from homeassistant.components.zoneminder import const
from homeassistant.config import async_process_ha_core_config
from homeassistant... | {
"repo_name": "tchellomello/home-assistant",
"path": "tests/components/zoneminder/test_switch.py",
"copies": "1",
"size": "4762",
"license": "apache-2.0",
"hash": 7644800635835818000,
"line_mean": 36.7936507937,
"line_max": 85,
"alpha_frac": 0.6188576228,
"autogenerated": false,
"ratio": 3.773375... |
"""Binary sensor to read Proxmox VE data."""
from homeassistant.const import STATE_OFF, STATE_ON
from homeassistant.helpers.update_coordinator import DataUpdateCoordinator
from . import COORDINATOR, DOMAIN, ProxmoxEntity
async def async_setup_platform(hass, config, add_entities, discovery_info=None):
"""Set up b... | {
"repo_name": "partofthething/home-assistant",
"path": "homeassistant/components/proxmoxve/binary_sensor.py",
"copies": "5",
"size": "2824",
"license": "mit",
"hash": 4754015177584581000,
"line_mean": 30.032967033,
"line_max": 87,
"alpha_frac": 0.5789660057,
"autogenerated": false,
"ratio": 4.233... |
"""Binary sensor to read Proxmox VE data."""
import logging
from homeassistant.components.binary_sensor import BinarySensorDevice
from homeassistant.const import ATTR_ATTRIBUTION, CONF_HOST, CONF_PORT
from . import CONF_CONTAINERS, CONF_NODES, CONF_VMS, PROXMOX_CLIENTS, ProxmoxItemType
ATTRIBUTION = "Data provided b... | {
"repo_name": "joopert/home-assistant",
"path": "homeassistant/components/proxmoxve/binary_sensor.py",
"copies": "5",
"size": "3353",
"license": "apache-2.0",
"hash": -6637733083880803000,
"line_mean": 28.9375,
"line_max": 87,
"alpha_frac": 0.5413062929,
"autogenerated": false,
"ratio": 4.1191646... |
"""Binary sensor to read Proxmox VE data."""
import logging
from homeassistant.components.binary_sensor import BinarySensorEntity
from homeassistant.const import ATTR_ATTRIBUTION, CONF_HOST, CONF_PORT
from . import CONF_CONTAINERS, CONF_NODES, CONF_VMS, PROXMOX_CLIENTS, ProxmoxItemType
ATTRIBUTION = "Data provided b... | {
"repo_name": "pschmitt/home-assistant",
"path": "homeassistant/components/proxmoxve/binary_sensor.py",
"copies": "13",
"size": "3353",
"license": "apache-2.0",
"hash": 7501270240440064000,
"line_mean": 28.9375,
"line_max": 87,
"alpha_frac": 0.5413062929,
"autogenerated": false,
"ratio": 4.119164... |
"""Binary sensor to read Proxmox VE data."""
from homeassistant.components.binary_sensor import BinarySensorEntity
from homeassistant.helpers.update_coordinator import DataUpdateCoordinator
from . import COORDINATORS, DOMAIN, PROXMOX_CLIENTS, ProxmoxEntity
async def async_setup_platform(hass, config, add_entities, ... | {
"repo_name": "kennedyshead/home-assistant",
"path": "homeassistant/components/proxmoxve/binary_sensor.py",
"copies": "2",
"size": "3151",
"license": "apache-2.0",
"hash": -4670145897321616000,
"line_mean": 29.8921568627,
"line_max": 83,
"alpha_frac": 0.5871152015,
"autogenerated": false,
"ratio"... |
from argparse import ArgumentParser
import time
from zhelpers import zmq
STATE_PRIMARY = 1
STATE_BACKUP = 2
STATE_ACTIVE = 3
STATE_PASSIVE = 4
PEER_PRIMARY = 1
PEER_BACKUP = 2
PEER_ACTIVE = 3
PEER_PASSIVE = 4
CLIENT_REQUEST = 5
HEARTBEAT = 1000
class BStarState(object):
def __init__(self, state, event, peer_... | {
"repo_name": "soscpd/bee",
"path": "root/tests/zguide/examples/Python/bstarsrv.py",
"copies": "1",
"size": "4212",
"license": "mit",
"hash": -6772980148402623000,
"line_mean": 28.4545454545,
"line_max": 77,
"alpha_frac": 0.5695631529,
"autogenerated": false,
"ratio": 3.6216680997420463,
"confi... |
# binary tag: refers to tags that have open and close element
# eg: [a]some content[/a]
# standalone tag: refers to tags that are self contained
# eg: [b some content]
# Assuming that the text input is well formatted
# open input and output file
with open('textin.txt', 'r') as f1, open('textout.txt', 'w') as f2:
... | {
"repo_name": "julio73/scratchbook",
"path": "code/work/alu/indenter.py",
"copies": "1",
"size": "1460",
"license": "mit",
"hash": 2570256811289311000,
"line_mean": 35.5,
"line_max": 67,
"alpha_frac": 0.6301369863,
"autogenerated": false,
"ratio": 3.7435897435897436,
"config_test": false,
"ha... |
# binary tree data structure
class Node:
# Node data structure to sore Node key value, node next reference
def __init__(self,node_value):
self.value = node_value
self.next = None
def getNodeValue(self):
return self.value
def getNextNodeValue(self):
return self.next
d... | {
"repo_name": "saurabhkumar1989/programming_question_python",
"path": "questions/link-list.py",
"copies": "2",
"size": "2823",
"license": "apache-2.0",
"hash": -6417240704895535000,
"line_mean": 31.4482758621,
"line_max": 253,
"alpha_frac": 0.6202621325,
"autogenerated": false,
"ratio": 4.1091703... |
"""Binary tree implementation."""
class BinaryTree:
"""Binary Tree implementation."""
def __init__(self, rootObj):
"""Initialization of BST."""
self.key = rootObj
self.leftChild = None
self.rightChild = None
def insertLeft(self, newNode):
"""Insert node into left ... | {
"repo_name": "carlb15/Python",
"path": "bst.py",
"copies": "1",
"size": "2230",
"license": "mit",
"hash": -2052852020630571300,
"line_mean": 25.5476190476,
"line_max": 53,
"alpha_frac": 0.5869955157,
"autogenerated": false,
"ratio": 3.6497545008183305,
"config_test": false,
"has_no_keywords"... |
# Binary Tree Level Order Traversal II
#
# Total Accepted: 10832 Total Submissions: 35078 My Submissions
#
# Given a binary tree, return the bottom-up level order traversal of its nodes'
# values. (ie, from left to right, level by level from leaf to root).
#
# For example:
# Given binary tree {3,9,20,#,#,15,7},
# 3... | {
"repo_name": "feigaochn/leetcode",
"path": "p107_binary_tree_level_order_traversal_ii.py",
"copies": "2",
"size": "1336",
"license": "mit",
"hash": -3107207275682248700,
"line_mean": 24.2075471698,
"line_max": 79,
"alpha_frac": 0.5434131737,
"autogenerated": false,
"ratio": 3.461139896373057,
... |
"""Binary Tree Maximum Path Sum
Given a binary tree, find the maximum path sum.
The path may start and end at any node in the tree.
For example:
Given the below binary tree,
1
/ \
2 3
Return 6.
"""
class TreeNode:
def __init__(self, x):
self.val = x
self.left = None
... | {
"repo_name": "rcanepa/cs-fundamentals",
"path": "python/interview_questions/binary_tree_maximum_path_sum.py",
"copies": "1",
"size": "1745",
"license": "mit",
"hash": -7639888406514803000,
"line_mean": 22.5810810811,
"line_max": 93,
"alpha_frac": 0.5656160458,
"autogenerated": false,
"ratio": 3.... |
# Binary Tree:
# 1. Every node has at most two children.
# 2. Each child node is labeled as being either a left child or a right child.
# 3. A left child precedes a right child in the order of children of a node.
# proper binary tree: each node has two or zero child.
class Tree:
""" Abstract base class representin... | {
"repo_name": "XYM1988/Algorithm",
"path": "Chp8/8.2-Binary-Tree.py",
"copies": "1",
"size": "2953",
"license": "mit",
"hash": 1341557670975314700,
"line_mean": 38.3733333333,
"line_max": 83,
"alpha_frac": 0.6027768371,
"autogenerated": false,
"ratio": 4.6947535771065185,
"config_test": false,
... |
# binary tree (not necessary balanced or bst)
import copy
class Node:
def __init__(self,v,l,r):
self.value = v
self.left = l
self.right = r
def __repr__(self):
#return "Node: "+str(self.__dict__)
return 'Node: '+str(self.value)
# tree traversal
def printG(n):
if n is not None:
print n
printG(n.left... | {
"repo_name": "dramaticlly/Python4Interview",
"path": "sumupBst.py",
"copies": "1",
"size": "1859",
"license": "mit",
"hash": -8201865223862018000,
"line_mean": 19.6555555556,
"line_max": 73,
"alpha_frac": 0.6218396988,
"autogenerated": false,
"ratio": 2.5465753424657533,
"config_test": false,
... |
#binary tree python
class BinaryTree:
def __init__(self, content, left = None, right = None):
self.content = content
self.left = left
self.right = right
def __str__(self):
return "( " + str(self.content) + " ( " + str(self.left) + " | " + str(self.right) + "))"
#Given a sorted... | {
"repo_name": "aattaran/Machine-Learning-with-Python",
"path": "CTCI/Chapter 4/Question4_3/ChapQ4.3.py",
"copies": "1",
"size": "1167",
"license": "bsd-3-clause",
"hash": -185838354366751650,
"line_mean": 32.3428571429,
"line_max": 98,
"alpha_frac": 0.6572407883,
"autogenerated": false,
"ratio": ... |
#binary tree python
class BinaryTree:
def __init__(self, content):
self.content = content
self.left = None
self.right = None
def __str__(self):
return "( " + str(self.content) + " ( " + str(self.left) + " | " + str(self.right) + "))"
#implement a function if a binary tree is a... | {
"repo_name": "aattaran/Machine-Learning-with-Python",
"path": "CTCI/Chapter 4/Question4_5/ChapQ4.5.py",
"copies": "1",
"size": "2935",
"license": "bsd-3-clause",
"hash": -1355276231901999600,
"line_mean": 24.0854700855,
"line_max": 100,
"alpha_frac": 0.6626916525,
"autogenerated": false,
"ratio"... |
#binary tree python
class BinaryTree:
def __init__(self, content):
self.content = content
self.left = None
self.right = None
self.parent = None
def __str__(self):
return "( " + str(self.content) + " ( " + str(self.left) + " | " + str(self.right) + "))"
#write an algori... | {
"repo_name": "aattaran/Machine-Learning-with-Python",
"path": "CTCI/Chapter 4/Question4_6/ChapQ4.6.py",
"copies": "1",
"size": "3176",
"license": "bsd-3-clause",
"hash": 8049808164053521000,
"line_mean": 22.3529411765,
"line_max": 112,
"alpha_frac": 0.6542821159,
"autogenerated": false,
"ratio":... |
#Binary Tree related problems:
class Node(object):
def __init__(self, val):
self.val=val
self.left=None
self.right=None
class Tree(object):
def __init__(self, val):
self.root=Node(val)
# Tournament Tree:
#Second minimum element using minimum comparisons
'''
Given an a... | {
"repo_name": "allenyao0702/shuati",
"path": "BinaryTrees.py",
"copies": "1",
"size": "5293",
"license": "mit",
"hash": 5971797775554201000,
"line_mean": 26.1487179487,
"line_max": 147,
"alpha_frac": 0.5407141508,
"autogenerated": false,
"ratio": 4.275444264943457,
"config_test": false,
"has_... |
# binary tree search of data file for countrycode
#
# by Greg Hazel
import os
import mmap
import struct
import socket
import bisect
root, file = os.path.split(__file__)
addrmap = os.path.join(root, "addrmap.dat")
if not os.path.exists(addrmap):
from BTL.platform import get_module_filename
root, file = os.path... | {
"repo_name": "forkable/p2pScrapper",
"path": "BitTorrent-5.2.2/BTL/ipfreemmap.py",
"copies": "6",
"size": "1933",
"license": "mit",
"hash": 9054703647333586000,
"line_mean": 25.1216216216,
"line_max": 79,
"alpha_frac": 0.5664769788,
"autogenerated": false,
"ratio": 2.7693409742120343,
"config_... |
# Binary Tree Zigzag Level Order Traversal
#
# Total Accepted: 9332 Total Submissions: 35534 My Submissions
#
# Given a binary tree, return the zigzag level order traversal of its nodes'
# values. (ie, from left to right, then right to left for the next level and
# alternate between).
#
# For example:
#
# Given binary ... | {
"repo_name": "feigaochn/leetcode",
"path": "p103_binary_tree_zigzag_level_order_traversal.py",
"copies": "2",
"size": "1415",
"license": "mit",
"hash": 7681173777903252000,
"line_mean": 23.8245614035,
"line_max": 76,
"alpha_frac": 0.5448763251,
"autogenerated": false,
"ratio": 3.393285371702638,... |
# binascii.py from the pypy project
# Modifications for missing yield statement
# Modifications to remove dependance on KeyError
class Error(Exception):
pass
class Done(Exception):
pass
class Incomplete(Exception):
pass
def a2b_uu(s):
if not s:
return ''
length = (ord(s[0]) - 0x20) % 64... | {
"repo_name": "gpitel/pyjs",
"path": "pyjs/lib/binascii.py",
"copies": "6",
"size": "26876",
"license": "apache-2.0",
"hash": 4997105336307039000,
"line_mean": 32.8062893082,
"line_max": 82,
"alpha_frac": 0.4872748921,
"autogenerated": false,
"ratio": 2.586717998075072,
"config_test": false,
... |
#!/bin/bash -c 'env python3'
"""Tiny HTTP Proxy.
This module implements GET, HEAD, POST, PUT and DELETE methods
on BaseHTTPServer, and behaves as an HTTP proxy. The CONNECT
method is also implemented experimentally, but has not been
tested yet.
Any help will be greatly appreciated. SUZUKI Hisao
---------... | {
"repo_name": "congzhangzh/uproxy",
"path": "uproxy/UProxy.py",
"copies": "1",
"size": "5683",
"license": "bsd-3-clause",
"hash": -9099526715125732000,
"line_mean": 31.4742857143,
"line_max": 97,
"alpha_frac": 0.5213795531,
"autogenerated": false,
"ratio": 3.990870786516854,
"config_test": fals... |
#!/bin/bash env
#_*_coding:utf8_*_
import MySQLdb
import re
import sys
import json
import os
import datetime
import time
# ============================================================================
# CONFIGURATION
# ============================================================================
# Define MySQL connecti... | {
"repo_name": "l0ca1h0st/zabbix_mysql",
"path": "script/zabbix_mysql.py",
"copies": "1",
"size": "35191",
"license": "mit",
"hash": 8058052553146883000,
"line_mean": 44.6051948052,
"line_max": 140,
"alpha_frac": 0.4812473302,
"autogenerated": false,
"ratio": 3.297183098591549,
"config_test": fa... |
#!/bin/bash env
# Taken from https://leetcode.com/problems/add-two-numbers/
class Node:
def __init__(self, value, nextNode = None):
self.value = value
self.next = nextNode
def toInt(self, depth = 0):
subTotal = 0
if self.next:
subTotal += self.next.toInt(depth + 1)... | {
"repo_name": "bertrandvidal/stuff",
"path": "algo/add-two.py",
"copies": "1",
"size": "1326",
"license": "unlicense",
"hash": -4244138988701840000,
"line_mean": 22.2631578947,
"line_max": 66,
"alpha_frac": 0.5520361991,
"autogenerated": false,
"ratio": 2.734020618556701,
"config_test": false,
... |
#! /bin/bash/env python
# encoding: utf-8
# please refer to README.md for instructions
# import dependencies
import settings
from seqcurator import *
from blast import Blaster
from postmcl import PostMCL
import argparse
import time
import os
import shutil
import sys
settings.init()
header = '''\
*********************... | {
"repo_name": "jfoox/venninator",
"path": "venninator.py",
"copies": "1",
"size": "6224",
"license": "mit",
"hash": -272351058369164580,
"line_mean": 40.7718120805,
"line_max": 183,
"alpha_frac": 0.6704691517,
"autogenerated": false,
"ratio": 3.4829322887520986,
"config_test": false,
"has_no_... |
#! /bin/bash/env python
from Applications import NcbiblastpCommandline
from seqcurator import *
import gzip
import math
import random
import re
import urllib
class PostMCL(object):
def __init__(self):
pass
def matrixmaker(self, evalue):
header = False
for key in settings.species_id.keys():
key = key.stri... | {
"repo_name": "jfoox/venninator",
"path": "postmcl.py",
"copies": "1",
"size": "11158",
"license": "mit",
"hash": 3324184961389440500,
"line_mean": 42.9291338583,
"line_max": 245,
"alpha_frac": 0.6649041047,
"autogenerated": false,
"ratio": 3.158222473818285,
"config_test": false,
"has_no_key... |
#! /bin/bash/env python
from Applications import NcbiblastpCommandline
import math
import os
from decimal import *
import settings
added = []
class Blaster(object):
def __init__(self):
pass
def blast(self, evalue):
# create a database and conduct the all-vs-all BLAST search against it
print 'Creating databas... | {
"repo_name": "jfoox/venninator",
"path": "blast.py",
"copies": "1",
"size": "4357",
"license": "mit",
"hash": 4621389412597522000,
"line_mean": 48.5113636364,
"line_max": 305,
"alpha_frac": 0.6587101216,
"autogenerated": false,
"ratio": 2.9822039698836416,
"config_test": false,
"has_no_keywo... |
#!/bin/bash/env python
import math
#We want to generate n+1 equally spaced x coordinates in [a,b]. Store the coordinates in a list.
#What we want to get in our standard output is a list of numbers that correspond to where the spacing would be
def equalSpacedCoordinates(n, a, b):
"""n , a and b are integer param... | {
"repo_name": "chapman-phys220-2016f/cw-02-saktill",
"path": "coor.py",
"copies": "1",
"size": "2753",
"license": "mit",
"hash": 133184362920107330,
"line_mean": 40.7121212121,
"line_max": 269,
"alpha_frac": 0.7181256811,
"autogenerated": false,
"ratio": 3.85034965034965,
"config_test": false,
... |
#!/bin/bash env python
import os;
import sys;
import shutil;
import re;
"""
https://snipplr.com/view/70884/convert-epub-to-pdf-in-linux-command-line
Readme:
# Requires
* https://wkhtmltopdf.org/downloads.html
"""
class EpubConvertor:
source_path = None; target_path = None;
def __init__(self):
self.source_path =... | {
"repo_name": "agancsos/python",
"path": "epub_to_pdf/epub_to_pdf.py",
"copies": "1",
"size": "1865",
"license": "mit",
"hash": -1750730934664810800,
"line_mean": 34.8653846154,
"line_max": 143,
"alpha_frac": 0.6332439678,
"autogenerated": false,
"ratio": 2.706821480406386,
"config_test": false... |
#! /bin/bash/env python
import re
import os
import math
import settings
class Curate(object):
def __init__(self):
pass
def filesgetter(self):
settings.filelist = [file.split('.')[0] for file in os.listdir(os.getcwd()) if file.endswith('.fa')]
print 'FASTA files that will be analyzed: '
filenum = 1
for ... | {
"repo_name": "jfoox/venninator",
"path": "seqcurator.py",
"copies": "1",
"size": "2812",
"license": "mit",
"hash": 4470762446657581600,
"line_mean": 32.4761904762,
"line_max": 137,
"alpha_frac": 0.6166429587,
"autogenerated": false,
"ratio": 3.073224043715847,
"config_test": false,
"has_no_k... |
# Copyright: 2014 Ashish Sharma, Nextcraft
# License: MIT License, see LICENSE.txt for details.
"""
Jasper Coursera Module
The module provides data notifications and interactions sourced from Coursera's Public APIs.
"""
import json
import sys
import urllib2
import os
import bisect
from datetime import ... | {
"repo_name": "kartaa/Jasper-Coursera",
"path": "Coursera.py",
"copies": "1",
"size": "1650",
"license": "mit",
"hash": -3433453909398053000,
"line_mean": 29.5555555556,
"line_max": 151,
"alpha_frac": 0.6818181818,
"autogenerated": false,
"ratio": 3.5331905781584583,
"config_test": false,
"ha... |
# Copyright: 2014 Ashish Sharma, Nextcraft
# License: MIT License, see ./LICENSE.txt for details.
"""
Jasper Coursera Module
The module provides data notifications and interactions sourced from Coursera's Public APIs.
"""
import json
import sys
import urllib2
import os
import bisect
from datetime impor... | {
"repo_name": "nextcraft/JMP",
"path": "Jasper-Coursera/Coursera.py",
"copies": "1",
"size": "1652",
"license": "mit",
"hash": -2891292751647212000,
"line_mean": 29.5925925926,
"line_max": 151,
"alpha_frac": 0.6809927361,
"autogenerated": false,
"ratio": 3.52991452991453,
"config_test": false,
... |
#! /bin/bash/env python
from Tkinter import *
import numpy as N
import pyfits as PF
from tkFileDialog import *
from tkMessageBox import *
global lightframes
lightframes ="null"
#functions for opening
def OpenLight():
#Open if they are the light frames
global lightimages
lightimages = askopenfilenames(... | {
"repo_name": "sniemi/SamPy",
"path": "sandbox/src2/astrogui.py",
"copies": "1",
"size": "6236",
"license": "bsd-2-clause",
"hash": -720201930865157900,
"line_mean": 28.2769953052,
"line_max": 107,
"alpha_frac": 0.7108723541,
"autogenerated": false,
"ratio": 3.2683438155136266,
"config_test": f... |
"""
The MIT License
Copyright (c) 2014 Dennis Hoppe
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publi... | {
"repo_name": "Thaumaturge/uspto-patents-parsing-tools",
"path": "uspto-patent-downloader.py",
"copies": "2",
"size": "7560",
"license": "mit",
"hash": 2877440741899328000,
"line_mean": 33.0540540541,
"line_max": 109,
"alpha_frac": 0.6708994709,
"autogenerated": false,
"ratio": 3.6806231742940603... |
if [ "$#" -ge 2 ]; then
design=$1
ui=$2
else
design='untitled.ui'
ui='gui_ui.py'
fi
if [ "$#" -eq 3 ]; then
baseclass=$3
else
baseclass='QtGui.QMainWindow'
fi
#####################################
#####################################
echo "---------------------------"
echo "design=$design u... | {
"repo_name": "admica/fix_pyuic",
"path": "fix_design.py",
"copies": "1",
"size": "1619",
"license": "mit",
"hash": 923758597597793300,
"line_mean": 22.4637681159,
"line_max": 80,
"alpha_frac": 0.490426189,
"autogenerated": false,
"ratio": 3.0261682242990653,
"config_test": false,
"has_no_key... |
__author__ = 'lsamaha'
import sys, signal, time, random, uuid
from threading import Timer
from dervisher.dervisher import Dervisher
from dervisher.words import Words
from dervisher.event import Event
from dervisher.post import Post
from dervisher.stream import Stream
from boto.kinesis.layer1 import KinesisConnection
... | {
"repo_name": "lsamaha/dervisher",
"path": "dervisher/whirling.py",
"copies": "1",
"size": "2793",
"license": "bsd-3-clause",
"hash": -8081106963803373000,
"line_mean": 29.7032967033,
"line_max": 111,
"alpha_frac": 0.5875402793,
"autogenerated": false,
"ratio": 3.37726723095526,
"config_test": ... |
import sys,re,os
from optparse import OptionParser
import pandas as pd
import HTSeq
def inner_outer_pref(line, suffix):
'''
Preferences outer + suffix -> suffix -> inner + suffix
'''
prefix = ['inner_', '', 'outer_']
test = [i + suffix for i in prefix]
for i in test:
if(not pd.isnull(... | {
"repo_name": "NCBI-Hackathons/Structural_Variant_Comparison",
"path": "py/make_gvf_and_bedgraph.py",
"copies": "1",
"size": "4465",
"license": "cc0-1.0",
"hash": 483102440489157400,
"line_mean": 33.3461538462,
"line_max": 166,
"alpha_frac": 0.5764837626,
"autogenerated": false,
"ratio": 3.324646... |
import pandas as pd
import HTSeq
def inner_outer_pref(line, suffix):
'''
Preferences outer + suffix -> suffix -> inner + suffix
'''
prefix = ['inner_', '', 'outer_']
test = [i + suffix for i in prefix]
for i in test:
if(not pd.isnull(line[i])):
out = int(line[i])
retu... | {
"repo_name": "NCBI-Hackathons/Structural_Variant_Comparison",
"path": "make_dbVar_reference_2.py",
"copies": "1",
"size": "3941",
"license": "cc0-1.0",
"hash": -2269912414864371000,
"line_mean": 32.6837606838,
"line_max": 166,
"alpha_frac": 0.5759959401,
"autogenerated": false,
"ratio": 3.394487... |
#!/bin/bash
#coding:utf-8
from PIL import Image
import ImageDraw
im = Image.new('RGB', (500,500))
draw = ImageDraw.Draw(im)
first=[146,399,163,403,146,399,163,403,170,393,169,391,166,386,170,381,170,371,170,355,169,346,167,335,170,329,170,320,170,
310,171,301,173,290,178,289,182,287,188,286,190,286,192,291,194,296,195... | {
"repo_name": "zephyru5/pythonchallenge",
"path": "09/09.py",
"copies": "1",
"size": "2570",
"license": "mit",
"hash": 6899411710777681000,
"line_mean": 68.4594594595,
"line_max": 125,
"alpha_frac": 0.726459144,
"autogenerated": false,
"ratio": 2.0236220472440944,
"config_test": false,
"has_n... |
#! /bin/bash
# -*- coding: utf-8 -*
import urlparse
import os
import comm_log
import tornado.ioloop
import tornado.web
import tornado.options
from tornado.options import define, options
# 监听端口
define("port", default=8978, help="run on the given port", type=int)
# 日志输出
define("log", default=comm_log.get_logging('gohook... | {
"repo_name": "liaotup/AutoDeployer",
"path": "Tomcat Server (Git Client)/commanderService/main.py",
"copies": "1",
"size": "1639",
"license": "mit",
"hash": -2461844700018480000,
"line_mean": 32.8125,
"line_max": 134,
"alpha_frac": 0.6691312384,
"autogenerated": false,
"ratio": 3.25250501002004,... |
#!/bin/bash
# -*- coding:utf-8 -*-
class liner_reg():
def __init__(self):
#self.train_data = [((1, 1,),1), ((1, 2,),2), ((1, 3,),3), ((1, 4,),4), ((1, 5,),5)]
self.x = [(1, i) for i in range(1, 6)]
self.y = range(1, 6)
self.n = len(self.x[0])
self.m = len(self.x)
sel... | {
"repo_name": "kelly6/liner_regection_test",
"path": "liner_regection_test.py",
"copies": "1",
"size": "2360",
"license": "mit",
"hash": 7350722559464005000,
"line_mean": 31.3287671233,
"line_max": 92,
"alpha_frac": 0.4618644068,
"autogenerated": false,
"ratio": 3.172043010752688,
"config_test"... |
"""Constants shared by preprocessing and modeling scripts."""
# Define the format of your input data as present in the CSV file
CSV_COLUMNS = [
'age', 'workclass', 'fnlwgt', 'education', 'education_num',
'marital_status', 'occupation', 'relationship', 'race', 'gender',
'capital_gain', 'capital_loss', 'ho... | {
"repo_name": "GoogleCloudPlatform/cloudml-samples",
"path": "census/estimator/constants/constants.py",
"copies": "1",
"size": "1178",
"license": "apache-2.0",
"hash": -5967249875942622000,
"line_mean": 35.8125,
"line_max": 74,
"alpha_frac": 0.6570458404,
"autogenerated": false,
"ratio": 3.613496... |
# The line below is interpreted as an invalid command in bash and a string literal in
# python.
'''' &>/dev/null
set -e
# pypy is preferred since it's about 10x faster than cpython.
if which pypy &>/dev/null; then
exec pypy $0
else
exec python $0
fi
'''
'''This is a reducer for use with hadoop streaming. See data... | {
"repo_name": "ibmsoe/ImpalaPPC",
"path": "tests/comparison/data_generator_reducer.py",
"copies": "2",
"size": "2156",
"license": "apache-2.0",
"hash": -935627330902148400,
"line_mean": 36.1724137931,
"line_max": 88,
"alpha_frac": 0.7439703154,
"autogenerated": false,
"ratio": 3.6666666666666665,... |
#!/bin/bash
"exec" "python" "$0" "$@"
from os import sys
sys.path += ['/usr/texbin','', '//anaconda/lib/python27.zip', '//anaconda/lib/python2.7', '//anaconda/lib/python2.7/plat-darwin', '//anaconda/lib/python2.7/plat-mac', '//anaconda/lib/python2.7/plat-mac/lib-scriptpackages', '//anaconda/lib/python2.7/lib-tk', '//... | {
"repo_name": "18padx08/PPTex",
"path": "PPTexEnv_x86_64/bin/JinjaPPExtension.py",
"copies": "1",
"size": "18508",
"license": "mit",
"hash": 7844292120634587000,
"line_mean": 43.5975903614,
"line_max": 488,
"alpha_frac": 0.4777933866,
"autogenerated": false,
"ratio": 4.151637505607896,
"config_... |
#!/bin/bash
# Generate logic operators according to the description in the G80 opengl
# shader reference.
# http://developer.download.nvidia.com/opengl/specs/g80specs.pdf
# And compare to real output of a G80 card.
from Logic import *
tt = [[0]*16 for x in xrange(0,16)]
for x in xrange(0,16):
zf = (x&ZF)!=0
... | {
"repo_name": "laanwj/decuda",
"path": "logigen.py",
"copies": "1",
"size": "1550",
"license": "bsd-3-clause",
"hash": 2126985094086976000,
"line_mean": 23.21875,
"line_max": 88,
"alpha_frac": 0.464516129,
"autogenerated": false,
"ratio": 2.2561863173216885,
"config_test": false,
"has_no_keyw... |
#!/bin/bash
import collections
import sqlite3 as sqlite
if __debug__:
sqlite.enable_callback_tracebacks(True)
#
class SqliteAggregate:
pass
class DistributionAggregate(SqliteAggregate):
def __init__(self):
self.freq = collections.Counter()
def step(self, value):
self.freq[value] += 1
class MODE(DistributionA... | {
"repo_name": "matt-hayden/bookmark-manager",
"path": "bookmark-stream/sqlite_wrapper.py",
"copies": "1",
"size": "2008",
"license": "unlicense",
"hash": 1865022610316017000,
"line_mean": 26.5068493151,
"line_max": 69,
"alpha_frac": 0.6787848606,
"autogenerated": false,
"ratio": 2.824191279887482... |
#!/bin/bash
import os
import sys
import random
import cv2
import numpy as np
import xgboost as xgb
from sklearn import preprocessing
from sklearn.decomposition import PCA, NMF
from sklearn.model_selection import train_test_split, GridSearchCV
from sklearn.svm import SVC
from sklearn.ensemble import RandomForestClassif... | {
"repo_name": "jinified/selam",
"path": "selam/prepdata.py",
"copies": "1",
"size": "7429",
"license": "mit",
"hash": 5908614726751270000,
"line_mean": 33.8779342723,
"line_max": 98,
"alpha_frac": 0.6167721093,
"autogenerated": false,
"ratio": 3.4489322191272054,
"config_test": false,
"has_no... |
#!/bin/bash
import roomai
class RoleCardNames:
sheriff = "sheriff"
deputy_sheriff = "deputy_sheriff"
outlaw = "outlaw"
renegade = "renegade"
class RoleCard(object):
def __init__(self, role):
logger = roomai.get_logger()
if isinstance(role, str):
lo... | {
"repo_name": "roomai/RoomAI",
"path": "roomai/games/bang/CardRole.py",
"copies": "1",
"size": "2041",
"license": "mit",
"hash": 1897751770006187000,
"line_mean": 44.3777777778,
"line_max": 211,
"alpha_frac": 0.6761391475,
"autogenerated": false,
"ratio": 3.2813504823151125,
"config_test": fals... |
#!/bin/bash
import subprocess
import queue
from subprocess import Popen
def log(message):
handle = open('boop.log', 'at')
handle.write('%s\n' % message);
handle.close()
def format_message(message):
message = ('"%s"' % message)
return message
def generate_command(address, message):
return '.... | {
"repo_name": "CornerstoneLabs/ble-to-sx1272",
"path": "send.py",
"copies": "1",
"size": "1252",
"license": "mit",
"hash": 7130088180316542000,
"line_mean": 19.5245901639,
"line_max": 66,
"alpha_frac": 0.5966453674,
"autogenerated": false,
"ratio": 3.5568181818181817,
"config_test": false,
"h... |
#!/bin/bash
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); y... | {
"repo_name": "Huyuwei/tvm",
"path": "apps/vta_rpc/start_rpc_server_to_tracker.py",
"copies": "1",
"size": "1190",
"license": "apache-2.0",
"hash": -6417600637481843000,
"line_mean": 44.7692307692,
"line_max": 73,
"alpha_frac": 0.7487394958,
"autogenerated": false,
"ratio": 3.63914373088685,
"c... |
#!/bin/bash
#### Basics
import sys,traceback
_login_success = False
def import_globals():
from gobject import MainLoop
from dbus.mainloop.glib import DBusGMainLoop
from ubuntuone.platform.credentials import CredentialsManagementTool
return MainLoop,DBusGMainLoop,CredentialsManagementTool
def log_in_or_... | {
"repo_name": "bry012/Combicloud",
"path": "u1file.py",
"copies": "1",
"size": "4664",
"license": "mit",
"hash": -4397386225058226700,
"line_mean": 26.4352941176,
"line_max": 73,
"alpha_frac": 0.6374356775,
"autogenerated": false,
"ratio": 3.4471544715447155,
"config_test": false,
"has_no_key... |
# BEGIN_COPYRIGHT
#
# Copyright 2009-2015 CRS4.
#
# 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... | {
"repo_name": "mdrio/pydoop",
"path": "examples/wordcount/new_api/wordcount_full.py",
"copies": "3",
"size": "4795",
"license": "apache-2.0",
"hash": 1759865211432131600,
"line_mean": 28.0606060606,
"line_max": 77,
"alpha_frac": 0.6387904067,
"autogenerated": false,
"ratio": 3.4796806966618288,
... |
# Copyright 2018 The Servo Project Developers. See the COPYRIGHT
# file at the top-level directory of this distribution.
#
# Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
# http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
# <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
... | {
"repo_name": "danlrobertson/servo",
"path": "etc/taskcluster/mock.py",
"copies": "3",
"size": "1392",
"license": "mpl-2.0",
"hash": -1829657150871401000,
"line_mean": 24.7777777778,
"line_max": 93,
"alpha_frac": 0.7147988506,
"autogenerated": false,
"ratio": 3.36231884057971,
"config_test": fa... |
# Copyright 2019 Google LLC
# 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | {
"repo_name": "GoogleCloudPlatform/esp-v2",
"path": "scripts/release/validate_release.py",
"copies": "1",
"size": "5045",
"license": "apache-2.0",
"hash": -2818343703301404700,
"line_mean": 25.0051546392,
"line_max": 77,
"alpha_frac": 0.6529236868,
"autogenerated": false,
"ratio": 3.5830965909090... |
#!/bin/bash
echo ""
echo "=========================================================================="
echo "= Pentest Attack Machine Setup ="
echo "= Based on the setup from The Hacker Playbook ="
echo "===============================================... | {
"repo_name": "jtombre/kaliplus",
"path": "scripts/thpsetup.py",
"copies": "1",
"size": "4924",
"license": "mit",
"hash": -520482458835381950,
"line_mean": 31.3223684211,
"line_max": 111,
"alpha_frac": 0.7200732899,
"autogenerated": false,
"ratio": 2.9013585351447135,
"config_test": false,
"h... |
#!/bin/bash
from flask import Flask, render_template, request
from os import remove, rename, chmod
import re
import csv
import random
import time
import urllib
import argparse
cdr_url_template = "{}/module/kil3/cdr/{}"
call_status_types = {'OK': 159, 'NA': 106, 'SO': 717, 'ND': 16}
call_status_choices = []
for key, ... | {
"repo_name": "motech/perf",
"path": "ivr2/ivr2.py",
"copies": "1",
"size": "3076",
"license": "bsd-3-clause",
"hash": -3284454749561512400,
"line_mean": 30.7113402062,
"line_max": 107,
"alpha_frac": 0.5965539662,
"autogenerated": false,
"ratio": 3.2584745762711864,
"config_test": false,
"has... |
#!/bin/bash
from pkg_resources import require
require('numpy')
require('h5py')
import sys, os
import numpy as np
import h5py
cxifilenames = sys.argv[2:]
output_dims = tuple()
print "Using CXI file for dims: ", cxifilenames[0]
with h5py.File(cxifilenames[0], 'r') as cxi:
output_dtype = cxi['entry_1']['data_1']['... | {
"repo_name": "ulrikpedersen/benchpress",
"path": "cxi2hdf5.py",
"copies": "1",
"size": "1666",
"license": "mit",
"hash": -3170576366971456000,
"line_mean": 32.32,
"line_max": 112,
"alpha_frac": 0.6230492197,
"autogenerated": false,
"ratio": 2.776666666666667,
"config_test": false,
"has_no_ke... |
#!/bin/bash
import base64
import os
import struct
from itertools import groupby
from pprint import pprint
split_list = lambda l, n: [l[x: x+n] for x in xrange(0, len(l), n)]
def get_image_info(data):
# http://stackoverflow.com/questions/8032642/how-to-obtain-image-size
if is_png(data):
w, h = struct... | {
"repo_name": "mehulsbhatt/awesome-icons",
"path": "compile.py",
"copies": "1",
"size": "9635",
"license": "unlicense",
"hash": 278434276604545570,
"line_mean": 25.9162011173,
"line_max": 150,
"alpha_frac": 0.5020238713,
"autogenerated": false,
"ratio": 3.2245649263721554,
"config_test": false,... |
#!/bin/bash
import json
import datetime
with open("peoplebyinitials-formatted.json") as f:
data = json.load(f)
print("initials;initials-all;full-name;first-name;last-name;action-object;description;date-of-birth")
for character in data:
other = character["Persondata"]
description = ""
... | {
"repo_name": "julien-sobczak/memorio",
"path": "datasets/parse_peoplebyinitials.py",
"copies": "1",
"size": "1921",
"license": "mit",
"hash": -7749737384367200000,
"line_mean": 37.42,
"line_max": 203,
"alpha_frac": 0.5117126497,
"autogenerated": false,
"ratio": 4.010438413361169,
"config_test"... |
#!/bin/bash
import logging, Logger
import copy
class Enum(set):
def __getattr__(self, name):
if name in self:
return name
raise AttributeError
act = Enum(["sgmoid","tanh","linear","relu"])
lo = Enum(["negative_log_likelihood","least_square","weighted_approximate_rank_pairw... | {
"repo_name": "rustle1314/latent_factor_multi_label",
"path": "common.py",
"copies": "2",
"size": "4613",
"license": "mit",
"hash": 314690041961180740,
"line_mean": 35.3228346457,
"line_max": 99,
"alpha_frac": 0.5720789074,
"autogenerated": false,
"ratio": 3.3745427944403805,
"config_test": fal... |
#!/bin/bash
import sqlite3
def init_table(database):
conn = sqlite3.connect(database)
c = conn.cursor()
c.execute('''CREATE TABLE if not exists users
(name, email, status, target, assassin)''')
conn.commit()
conn.close()
def add_user(name, email, database):
conn = sqlite3.connect(database)
c = conn.cu... | {
"repo_name": "ericponce/assassin-server",
"path": "src/database.py",
"copies": "1",
"size": "1234",
"license": "mit",
"hash": 5574799538576485000,
"line_mean": 18.5873015873,
"line_max": 81,
"alpha_frac": 0.6458670989,
"autogenerated": false,
"ratio": 3.0097560975609756,
"config_test": false,
... |
#!/bin/bash
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License");... | {
"repo_name": "cloudera/Impala",
"path": "tests/comparison/data_generator_reducer.py",
"copies": "3",
"size": "2344",
"license": "apache-2.0",
"hash": 1004889235206054300,
"line_mean": 36.8064516129,
"line_max": 88,
"alpha_frac": 0.7478668942,
"autogenerated": false,
"ratio": 3.7564102564102564,
... |
#!/bin/bash
#
# 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... | {
"repo_name": "openstack/heat",
"path": "heat/cloudinit/loguserdata.py",
"copies": "1",
"size": "4198",
"license": "apache-2.0",
"hash": -7346708983669913000,
"line_mean": 28.7730496454,
"line_max": 78,
"alpha_frac": 0.6188661267,
"autogenerated": false,
"ratio": 3.688927943760984,
"config_test... |
#!/bin/bash
"""
makenpz.py DIRECTORY
Build a npz containing all data files in the directory.
"""
import os
import numpy as np
from optparse import OptionParser
def main():
p = OptionParser()
options, args = p.parse_args()
if len(args) != 1:
p.error("no valid directory given")
inp = args[0]
... | {
"repo_name": "stefanv/scipy3",
"path": "scipy/special/utils/makenpz.py",
"copies": "1",
"size": "2159",
"license": "bsd-3-clause",
"hash": -5349342530875527000,
"line_mean": 25.3292682927,
"line_max": 82,
"alpha_frac": 0.5479388606,
"autogenerated": false,
"ratio": 3.9326047358834244,
"config_... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.