text stringlengths 0 1.05M | meta dict |
|---|---|
"""Allows the creation of a sensor that filters state property."""
from collections import Counter, deque
from copy import copy
from datetime import timedelta
from functools import partial
import logging
from numbers import Number
import statistics
from typing import Optional
import voluptuous as vol
from homeassista... | {
"repo_name": "partofthething/home-assistant",
"path": "homeassistant/components/filter/sensor.py",
"copies": "3",
"size": "20713",
"license": "mit",
"hash": 7859111957291327000,
"line_mean": 30.1942771084,
"line_max": 88,
"alpha_frac": 0.5822430358,
"autogenerated": false,
"ratio": 4.08782316952... |
"""Allows the creation of a sensor that filters state property."""
from __future__ import annotations
from collections import Counter, deque
from copy import copy
from datetime import timedelta
from functools import partial
import logging
from numbers import Number
import statistics
import voluptuous as vol
from hom... | {
"repo_name": "home-assistant/home-assistant",
"path": "homeassistant/components/filter/sensor.py",
"copies": "2",
"size": "20774",
"license": "apache-2.0",
"hash": 2504674727996988000,
"line_mean": 30.2390977444,
"line_max": 88,
"alpha_frac": 0.5823625686,
"autogenerated": false,
"ratio": 4.0885... |
"""Allows the creation of a sensor that filters state property."""
import logging
import statistics
from collections import deque, Counter
from numbers import Number
from functools import partial
from copy import copy
from datetime import timedelta
from typing import Optional
import voluptuous as vol
from homeassista... | {
"repo_name": "qedi-r/home-assistant",
"path": "homeassistant/components/filter/sensor.py",
"copies": "3",
"size": "18820",
"license": "apache-2.0",
"hash": -2815479887214064000,
"line_mean": 30.3144758735,
"line_max": 88,
"alpha_frac": 0.5774176408,
"autogenerated": false,
"ratio": 4.10917030567... |
"""Allows the creation of node networks through equation strings.
Dependency Graph Expressions (dge) is a convenience API used to simplify the creation
of Maya DG node networks. Rather than scripting out many createNode, get/setAttr,
connectAttr commands, you can specify a string equation.
No compiled plug-ins are u... | {
"repo_name": "chadmv/cmt",
"path": "scripts/cmt/dge.py",
"copies": "1",
"size": "27667",
"license": "mit",
"hash": -6001516206706798000,
"line_mean": 35.9385847797,
"line_max": 116,
"alpha_frac": 0.5332706835,
"autogenerated": false,
"ratio": 3.5810251100181207,
"config_test": false,
"has_no... |
"""Allows the execution of complex queries against postgres."""
import sqlalchemy
from cis_identity_vault.models import rds
def raw_query(conn, sql_statement):
"""[Execute a raw sql query against the database.]
Arguments:
conn {object} -- [A sqlalchemy connection object]
sql_statement {[strin... | {
"repo_name": "mozilla-iam/cis",
"path": "python-modules/cis_postgresql/cis_postgresql/execute.py",
"copies": "1",
"size": "4590",
"license": "mpl-2.0",
"hash": -2009879438213014300,
"line_mean": 37.5714285714,
"line_max": 117,
"alpha_frac": 0.5675381264,
"autogenerated": false,
"ratio": 4.508840... |
# Allows the page to be rendered
from django.http import HttpResponse, HttpResponseRedirect
# Excpetion for objects that don't exist in the database
from django.core.exceptions import ObjectDoesNotExist
# Import database model
from models import PocketKey
# Check if in debug mode
from django.conf import settings
# ... | {
"repo_name": "mjcuva/ConnectedWire",
"path": "blog/pocket.py",
"copies": "1",
"size": "4541",
"license": "apache-2.0",
"hash": -6130052415354423000,
"line_mean": 21.705,
"line_max": 184,
"alpha_frac": 0.5857740586,
"autogenerated": false,
"ratio": 4.150822669104205,
"config_test": false,
"ha... |
# Allows the page to be rendered
from django.shortcuts import render_to_response
# Allows redirects, as well as 404 pages
from django.http import HttpResponseRedirect, Http404, HttpResponse
# Allows the request to be sent to the template
from django.template import RequestContext
import util
# Calculate stats about... | {
"repo_name": "mjcuva/ConnectedWire",
"path": "blog/dashboard.py",
"copies": "1",
"size": "1908",
"license": "apache-2.0",
"hash": 7932401934721582000,
"line_mean": 23.164556962,
"line_max": 111,
"alpha_frac": 0.7059748428,
"autogenerated": false,
"ratio": 3.533333333333333,
"config_test": fals... |
# Allows the page to be rendered
from django.shortcuts import render_to_response
from django.http import HttpResponseRedirect
import util
import blogForms
import datetime
from django.core.files.storage import FileSystemStorage
import paths
import os
import subprocess
# Allows the request to be sent to the temp... | {
"repo_name": "mjcuva/ConnectedWire",
"path": "blog/podcast.py",
"copies": "1",
"size": "2910",
"license": "apache-2.0",
"hash": 7544363522170949000,
"line_mean": 22.6585365854,
"line_max": 152,
"alpha_frac": 0.6127147766,
"autogenerated": false,
"ratio": 4.330357142857143,
"config_test": false... |
"""Allows the user to draw streamlines for given vector data. This
supports various types of seed objects (line, sphere, plane and point
seeds). It also allows the user to draw ribbons or tubes and further
supports different types of interactive modes of calculating the
streamlines.
"""
# Author: Prabhu Ramachandran ... | {
"repo_name": "dmsurti/mayavi",
"path": "mayavi/modules/streamline.py",
"copies": "3",
"size": "10285",
"license": "bsd-3-clause",
"hash": 9190171937129475000,
"line_mean": 37.5205992509,
"line_max": 83,
"alpha_frac": 0.5288283909,
"autogenerated": false,
"ratio": 4.458170784568704,
"config_tes... |
# Allows the user to view the constructed HWP bacxground images. Shows all four
# HWP rotations associated with a single IPPA angle
#
import os
import sys
import glob
import numpy as np
from astropy.io import ascii
from astropy.table import Table as Table
from astropy.table import Column as Column
from astropy.convolu... | {
"repo_name": "jmontgom10/Mimir_pyPol",
"path": "06a_finalStarMasking.py",
"copies": "1",
"size": "8435",
"license": "mit",
"hash": -1945763585155443700,
"line_mean": 33.1497975709,
"line_max": 87,
"alpha_frac": 0.5950207469,
"autogenerated": false,
"ratio": 3.7224183583406885,
"config_test": f... |
# Allows the user to view the constructed HWP bacxground images. Shows all four
# HWP rotations associated with a single IPPA angle
#
import os
import sys
import numpy as np
from astropy.io import ascii
from astropy.table import Table as Table
from astropy.table import Column as Column
from astropy.convolution import ... | {
"repo_name": "jmontgom10/Mimir_pyPol",
"path": "03b_examineImagesAndMaskArtifacts.py",
"copies": "2",
"size": "15165",
"license": "mit",
"hash": -3801912826919651000,
"line_mean": 35.6304347826,
"line_max": 91,
"alpha_frac": 0.6098252555,
"autogenerated": false,
"ratio": 3.155430711610487,
"co... |
"""Allows to configuration ecoal (esterownik.pl) pumps as switches."""
from __future__ import annotations
from homeassistant.components.switch import SwitchEntity
from . import AVAILABLE_PUMPS, DATA_ECOAL_BOILER
def setup_platform(hass, config, add_entities, discovery_info=None):
"""Set up switches based on eco... | {
"repo_name": "w1ll1am23/home-assistant",
"path": "homeassistant/components/ecoal_boiler/switch.py",
"copies": "5",
"size": "2333",
"license": "apache-2.0",
"hash": -8781881000518866000,
"line_mean": 30.1066666667,
"line_max": 78,
"alpha_frac": 0.6168024003,
"autogenerated": false,
"ratio": 3.674... |
"""Allows to configuration ecoal (esterownik.pl) pumps as switches."""
from typing import Optional
from homeassistant.components.switch import SwitchEntity
from . import AVAILABLE_PUMPS, DATA_ECOAL_BOILER
def setup_platform(hass, config, add_entities, discovery_info=None):
"""Set up switches based on ecoal inte... | {
"repo_name": "partofthething/home-assistant",
"path": "homeassistant/components/ecoal_boiler/switch.py",
"copies": "9",
"size": "2329",
"license": "mit",
"hash": 971214835752747500,
"line_mean": 30.0533333333,
"line_max": 78,
"alpha_frac": 0.6182911121,
"autogenerated": false,
"ratio": 3.6793048... |
"""Allows to configuration ecoal (esterownik.pl) pumps as switches."""
import logging
from typing import Optional
from homeassistant.components.switch import SwitchDevice
from homeassistant.components.ecoal_boiler import (
DATA_ECOAL_BOILER, AVAILABLE_PUMPS, )
_LOGGER = logging.getLogger(__name__)
DEPENDENCIES =... | {
"repo_name": "HydrelioxGitHub/home-assistant",
"path": "homeassistant/components/ecoal_boiler/switch.py",
"copies": "2",
"size": "2460",
"license": "apache-2.0",
"hash": 518893972830391360,
"line_mean": 29.75,
"line_max": 78,
"alpha_frac": 0.6239837398,
"autogenerated": false,
"ratio": 3.6552748... |
"""Allows to configuration ecoal (esterownik.pl) pumps as switches."""
import logging
from typing import Optional
from homeassistant.components.switch import SwitchDevice
from . import AVAILABLE_PUMPS, DATA_ECOAL_BOILER
_LOGGER = logging.getLogger(__name__)
DEPENDENCIES = ['ecoal_boiler']
def setup_platform(hass,... | {
"repo_name": "jamespcole/home-assistant",
"path": "homeassistant/components/ecoal_boiler/switch.py",
"copies": "1",
"size": "2416",
"license": "apache-2.0",
"hash": -5015942588316477000,
"line_mean": 29.2,
"line_max": 78,
"alpha_frac": 0.6212748344,
"autogenerated": false,
"ratio": 3.65506807866... |
"""Allows to configuration ecoal (esterownik.pl) pumps as switches."""
import logging
from typing import Optional
from homeassistant.components.switch import SwitchEntity
from . import AVAILABLE_PUMPS, DATA_ECOAL_BOILER
_LOGGER = logging.getLogger(__name__)
def setup_platform(hass, config, add_entities, discovery_... | {
"repo_name": "pschmitt/home-assistant",
"path": "homeassistant/components/ecoal_boiler/switch.py",
"copies": "7",
"size": "2383",
"license": "apache-2.0",
"hash": 4496531698101095000,
"line_mean": 29.5512820513,
"line_max": 78,
"alpha_frac": 0.6206462442,
"autogenerated": false,
"ratio": 3.68315... |
"""Allows to configure a switch using BeagleBone Black GPIO."""
import logging
import voluptuous as vol
from homeassistant.components import bbb_gpio
from homeassistant.components.switch import PLATFORM_SCHEMA
from homeassistant.const import CONF_NAME, DEVICE_DEFAULT_NAME
import homeassistant.helpers.config_validatio... | {
"repo_name": "pschmitt/home-assistant",
"path": "homeassistant/components/bbb_gpio/switch.py",
"copies": "7",
"size": "2444",
"license": "apache-2.0",
"hash": -6166431733254164000,
"line_mean": 28.4457831325,
"line_max": 78,
"alpha_frac": 0.647299509,
"autogenerated": false,
"ratio": 3.675187969... |
"""Allows to configure a switch using BeagleBone Black GPIO."""
import logging
import voluptuous as vol
from homeassistant.components.switch import PLATFORM_SCHEMA
from homeassistant.components import bbb_gpio
from homeassistant.const import DEVICE_DEFAULT_NAME, CONF_NAME
from homeassistant.helpers.entity import Togg... | {
"repo_name": "Cinntax/home-assistant",
"path": "homeassistant/components/bbb_gpio/switch.py",
"copies": "4",
"size": "2460",
"license": "apache-2.0",
"hash": -993117798658789500,
"line_mean": 28.6385542169,
"line_max": 78,
"alpha_frac": 0.6479674797,
"autogenerated": false,
"ratio": 3.6552748885... |
"""Allows to configure a switch using BeagleBone Black GPIO."""
import voluptuous as vol
from homeassistant.components import bbb_gpio
from homeassistant.components.switch import PLATFORM_SCHEMA
from homeassistant.const import CONF_NAME, DEVICE_DEFAULT_NAME
import homeassistant.helpers.config_validation as cv
from hom... | {
"repo_name": "mezz64/home-assistant",
"path": "homeassistant/components/bbb_gpio/switch.py",
"copies": "14",
"size": "2389",
"license": "apache-2.0",
"hash": 2679275547850851300,
"line_mean": 29.2405063291,
"line_max": 78,
"alpha_frac": 0.645876936,
"autogenerated": false,
"ratio": 3.67538461538... |
"""Allows to configure a switch using RPi GPIO."""
import logging
import voluptuous as vol
from homeassistant.components import rpi_gpio
from homeassistant.components.switch import PLATFORM_SCHEMA
from homeassistant.const import DEVICE_DEFAULT_NAME
import homeassistant.helpers.config_validation as cv
from homeassista... | {
"repo_name": "tchellomello/home-assistant",
"path": "homeassistant/components/rpi_gpio/switch.py",
"copies": "1",
"size": "2426",
"license": "apache-2.0",
"hash": -3333757859707854300,
"line_mean": 27.880952381,
"line_max": 82,
"alpha_frac": 0.6644682605,
"autogenerated": false,
"ratio": 3.67019... |
"""Allows to configure a switch using RPi GPIO."""
import logging
import voluptuous as vol
from homeassistant.components.switch import PLATFORM_SCHEMA
from homeassistant.components import rpi_gpio
from homeassistant.const import DEVICE_DEFAULT_NAME
from homeassistant.helpers.entity import ToggleEntity
import homeassi... | {
"repo_name": "Cinntax/home-assistant",
"path": "homeassistant/components/rpi_gpio/switch.py",
"copies": "4",
"size": "2279",
"license": "apache-2.0",
"hash": -2715570998050265600,
"line_mean": 28.2179487179,
"line_max": 82,
"alpha_frac": 0.656428258,
"autogenerated": false,
"ratio": 3.6581059390... |
"""Allows to configure a switch using RPi GPIO."""
import logging
import voluptuous as vol
from homeassistant.components.switch import PLATFORM_SCHEMA, SwitchDevice
from homeassistant.const import CONF_HOST, DEVICE_DEFAULT_NAME
import homeassistant.helpers.config_validation as cv
from . import CONF_INVERT_LOGIC, DEF... | {
"repo_name": "postlund/home-assistant",
"path": "homeassistant/components/remote_rpi_gpio/switch.py",
"copies": "4",
"size": "2510",
"license": "apache-2.0",
"hash": -2112487089107797000,
"line_mean": 28.1860465116,
"line_max": 82,
"alpha_frac": 0.6438247012,
"autogenerated": false,
"ratio": 3.7... |
"""Allows to configure a switch using RPi GPIO."""
import logging
import voluptuous as vol
from homeassistant.components.switch import SwitchDevice, PLATFORM_SCHEMA
from homeassistant.const import DEVICE_DEFAULT_NAME, CONF_HOST
import homeassistant.helpers.config_validation as cv
from . import CONF_INVERT_LOGIC, DE... | {
"repo_name": "jabesq/home-assistant",
"path": "homeassistant/components/remote_rpi_gpio/switch.py",
"copies": "2",
"size": "2603",
"license": "apache-2.0",
"hash": 3783124849169205000,
"line_mean": 27.6043956044,
"line_max": 73,
"alpha_frac": 0.6208221283,
"autogenerated": false,
"ratio": 3.8908... |
"""Allows to configure a switch using RPi GPIO."""
import voluptuous as vol
from homeassistant.components import rpi_gpio
from homeassistant.components.switch import PLATFORM_SCHEMA
from homeassistant.const import DEVICE_DEFAULT_NAME
import homeassistant.helpers.config_validation as cv
from homeassistant.helpers.entit... | {
"repo_name": "adrienbrault/home-assistant",
"path": "homeassistant/components/rpi_gpio/switch.py",
"copies": "7",
"size": "2370",
"license": "mit",
"hash": 8812718546879752000,
"line_mean": 29,
"line_max": 82,
"alpha_frac": 0.6637130802,
"autogenerated": false,
"ratio": 3.668730650154799,
"con... |
"""Allows to configure a switch using RPi GPIO."""
import voluptuous as vol
from homeassistant.components.switch import PLATFORM_SCHEMA, SwitchEntity
from homeassistant.const import CONF_HOST, DEVICE_DEFAULT_NAME
import homeassistant.helpers.config_validation as cv
from . import CONF_INVERT_LOGIC, DEFAULT_INVERT_LOGI... | {
"repo_name": "tboyce021/home-assistant",
"path": "homeassistant/components/remote_rpi_gpio/switch.py",
"copies": "14",
"size": "2327",
"license": "apache-2.0",
"hash": -5825141947692338000,
"line_mean": 27.7283950617,
"line_max": 82,
"alpha_frac": 0.638160722,
"autogenerated": false,
"ratio": 3.... |
"""Allows to configure custom shell commands to turn a value for a sensor."""
from collections.abc import Mapping
from datetime import timedelta
import json
import logging
import voluptuous as vol
from homeassistant.components.sensor import PLATFORM_SCHEMA
from homeassistant.const import (
CONF_COMMAND,
CONF_... | {
"repo_name": "partofthething/home-assistant",
"path": "homeassistant/components/command_line/sensor.py",
"copies": "1",
"size": "5597",
"license": "mit",
"hash": -3998006410111912000,
"line_mean": 30.9828571429,
"line_max": 86,
"alpha_frac": 0.6074682866,
"autogenerated": false,
"ratio": 4.40361... |
"""Allows to configure custom shell commands to turn a value for a sensor."""
import collections
from datetime import timedelta
import json
import logging
import shlex
import subprocess
import voluptuous as vol
from homeassistant.components.sensor import PLATFORM_SCHEMA
from homeassistant.const import (
CONF_COMM... | {
"repo_name": "molobrakos/home-assistant",
"path": "homeassistant/components/command_line/sensor.py",
"copies": "7",
"size": "6018",
"license": "apache-2.0",
"hash": -761827776272045700,
"line_mean": 33.3885714286,
"line_max": 79,
"alpha_frac": 0.6041874377,
"autogenerated": false,
"ratio": 4.444... |
"""Allows to control the bot via REST calls."""
import json
import logging
import os
import requests
import threading
import urllib.parse
from bottle import ServerAdapter, abort, request, route, run
from jwcrypto import jwk, jws, jwt
from bot.paths import CONFIG_PATH
from bot.paths import OIDC_API, USER_ID_API
# Reg... | {
"repo_name": "ghostduck/monkalot",
"path": "bot/web.py",
"copies": "1",
"size": "11374",
"license": "mit",
"hash": -8165793029498674000,
"line_mean": 33.5623100304,
"line_max": 103,
"alpha_frac": 0.5901855598,
"autogenerated": false,
"ratio": 3.945523941707148,
"config_test": true,
"has_no_k... |
"""Allows to get all data about a given GitHub City.
This module allow to developers to get all users of GitHub that have a
given city in their profile. For example, if I want getting all users
from London,. I will get all users that have London in their
profiles (they could live in London or not)
Author: Israel Blan... | {
"repo_name": "iblancasa/GitHubCity",
"path": "src/setup.py",
"copies": "1",
"size": "2334",
"license": "mit",
"hash": 6188048988957184000,
"line_mean": 38.5593220339,
"line_max": 77,
"alpha_frac": 0.7095115681,
"autogenerated": false,
"ratio": 3.935919055649241,
"config_test": false,
"has_no... |
"""Allows treating tuples/lists as vectors"""
import math
def add(*items):
"""Adds one or more vectors."""
if len(items) == 0: return 0
n = len(items[0])
for v in items:
if n!=len(v):
raise RuntimeError('Vector dimensions not equal')
return [sum([v[i] for v in items]) for i in ... | {
"repo_name": "krishauser/Klampt",
"path": "Python/klampt/math/vectorops.py",
"copies": "1",
"size": "3273",
"license": "bsd-3-clause",
"hash": -3314224845835614700,
"line_mean": 26.5042016807,
"line_max": 76,
"alpha_frac": 0.571035747,
"autogenerated": false,
"ratio": 3.047486033519553,
"confi... |
# allows use of Python3.X print functionality
from __future__ import print_function
import re # for regex functions
import sys
import os
# need regex for N-glycosylation motif
# N{any but P}[S or T]{any but P}
# parentheses and '?=' allow for overlapping
motif = re.compile('(?=N[^P][ST][^P])')
# loop through protein... | {
"repo_name": "crf1111/Bio-Informatics-Learning",
"path": "Bio-StrongHold/src/Finding_a_Protein_Motif.py",
"copies": "1",
"size": "1375",
"license": "mit",
"hash": 7214292008074038000,
"line_mean": 29.5777777778,
"line_max": 83,
"alpha_frac": 0.6225454545,
"autogenerated": false,
"ratio": 3.34549... |
"""Allows use of some high-level git operations at GitHub."""
import base64
from collections import namedtuple
from threading import Lock
from decorator import decorator
import github
FileDescription = namedtuple('FileDescription', 'path contents executable')
def file_description(path, contents, executable=False):... | {
"repo_name": "simon-weber/the-listserve-archive",
"path": "githubx.py",
"copies": "1",
"size": "2852",
"license": "mit",
"hash": 4364341682852877300,
"line_mean": 30,
"line_max": 75,
"alpha_frac": 0.6037868163,
"autogenerated": false,
"ratio": 3.9943977591036415,
"config_test": false,
"has_n... |
"""Allows user to locate points or route segments along WA routes.
"""
from __future__ import (unicode_literals, print_function, division,
absolute_import)
import re
from os.path import split as split_path, join as join_path
import arcpy
from .route_ids import RouteIdSuffixType, standardize_rou... | {
"repo_name": "WSDOT-GIS/wsdot-route-gp",
"path": "wsdotroute/__init__.py",
"copies": "1",
"size": "27667",
"license": "unlicense",
"hash": -8275669347216432000,
"line_mean": 42.7768987342,
"line_max": 162,
"alpha_frac": 0.5975711136,
"autogenerated": false,
"ratio": 4.063298575414892,
"config_... |
"""Allows using emdp as a gym environment."""
import numpy as np
import gym
from gym import spaces
import emdp.utils as utils
def gymify(mdp, **kwargs):
return GymToMDP(mdp, **kwargs)
class GymToMDP(gym.Env):
def __init__(self, mdp, observation_one_hot=True):
"""
:param mdp: The emdp.MDP obj... | {
"repo_name": "zafarali/emdp",
"path": "emdp/emdp_gym/gym_wrap.py",
"copies": "1",
"size": "1395",
"license": "mit",
"hash": -8074689601729049000,
"line_mean": 25.8269230769,
"line_max": 79,
"alpha_frac": 0.6,
"autogenerated": false,
"ratio": 3.4875,
"config_test": false,
"has_no_keywords": f... |
#allows us to clear the console screen.
import os
import time
#the width of the display
#(the windows console is 79 characters wide).
WIDTH = 79
#the message we wish to print
message = "hello!".upper()
#the printed banner version of the message
#this is a 7-line display, stored as 7 strings
#initially, these are emp... | {
"repo_name": "dracaether/python",
"path": "random stuff/banner.py",
"copies": "1",
"size": "2842",
"license": "mit",
"hash": 9223170121400854000,
"line_mean": 29.8913043478,
"line_max": 82,
"alpha_frac": 0.3603096411,
"autogenerated": false,
"ratio": 4.525477707006369,
"config_test": false,
... |
"""Allow tabs to be closed in different ways."""
from __future__ import annotations
import tkinter
from functools import partial
from porcupine import get_tab_manager, images, tabs
def close_clicked_tab(event: tkinter.Event[tabs.TabManager], *, what2close: str = 'this') -> None:
before = event.widget.index(f'@{... | {
"repo_name": "Akuli/editor",
"path": "porcupine/plugins/tab_closing.py",
"copies": "1",
"size": "2682",
"license": "mit",
"hash": 3970756498124793300,
"line_mean": 39.6363636364,
"line_max": 112,
"alpha_frac": 0.668158091,
"autogenerated": false,
"ratio": 3.4785992217898833,
"config_test": fal... |
"""Allow the ability to connect and publish to a queue.
"""
import json
import logging
import time
import kombu
import requests
class Producer(object):
def __init__(self, dest_queue_name, rabbitmq_host, serializer=None, compression=None):
self.serializer = serializer
self.compression = compressi... | {
"repo_name": "sujaymansingh/queue_util",
"path": "queue_util/producer.py",
"copies": "1",
"size": "3114",
"license": "mit",
"hash": -8247455627727672000,
"line_mean": 36.9756097561,
"line_max": 115,
"alpha_frac": 0.6056518947,
"autogenerated": false,
"ratio": 4.044155844155844,
"config_test": ... |
# Allow the use of / operator for division to yield floats instead of integers:
# http://docs.python.org/whatsnew/2.2.html#pep-238-changing-the-division-operator
from __future__ import division
# Imports from standard libraries
from datetime import date, timedelta
import hashlib
import os
import urllib2
# Imports fro... | {
"repo_name": "albatrossandco/brubeck_cms",
"path": "brubeck/publishing/models.py",
"copies": "1",
"size": "10276",
"license": "bsd-3-clause",
"hash": 6072164684175818000,
"line_mean": 50.1243781095,
"line_max": 490,
"alpha_frac": 0.6390618918,
"autogenerated": false,
"ratio": 3.8515742128935533,... |
# Allow the use of / operator for division to yield floats instead of integers:
# http://docs.python.org/whatsnew/2.2.html#pep-238-changing-the-division-operator
from __future__ import division
# Imports from standard libraries
from datetime import date, timedelta
import hashlib
import os
import urllib2
# I... | {
"repo_name": "albatrossandco/brubeck_cms",
"path": "brubeck/articles/models.py",
"copies": "1",
"size": "11291",
"license": "bsd-3-clause",
"hash": -349507177612159800,
"line_mean": 64.0292397661,
"line_max": 456,
"alpha_frac": 0.6620317067,
"autogenerated": false,
"ratio": 3.8029639609296058,
... |
# allow to disable validations
validate_slicecount = True
validate_orientation = True
validate_orthogonal = True
validate_slice_increment = True
validate_instance_number = False
validate_multiframe_implicit = True
pydicom_read_force = False
gdcmconv_path = None
resample = False
resample_padding = 0
resample_spline_inte... | {
"repo_name": "icometrix/dicom2nifti",
"path": "dicom2nifti/settings.py",
"copies": "1",
"size": "4835",
"license": "mit",
"hash": -6410171382783045000,
"line_mean": 26.1629213483,
"line_max": 101,
"alpha_frac": 0.7154084798,
"autogenerated": false,
"ratio": 4.363718411552346,
"config_test": fa... |
"""Allow to set up simple automation rules via the config file."""
import asyncio
from functools import partial
import importlib
import logging
from typing import Any, Awaitable, Callable
import voluptuous as vol
from homeassistant.const import (
ATTR_ENTITY_ID,
ATTR_NAME,
CONF_ID,
CONF_PLATFORM,
... | {
"repo_name": "qedi-r/home-assistant",
"path": "homeassistant/components/automation/__init__.py",
"copies": "2",
"size": "14929",
"license": "apache-2.0",
"hash": 6455046691037192000,
"line_mean": 29.2819472617,
"line_max": 88,
"alpha_frac": 0.6107575859,
"autogenerated": false,
"ratio": 4.195896... |
"""Allow to set up simple automation rules via the config file."""
import asyncio
from functools import partial
import importlib
import logging
import voluptuous as vol
from homeassistant.const import (
ATTR_ENTITY_ID, ATTR_NAME, CONF_ID, CONF_PLATFORM,
EVENT_AUTOMATION_TRIGGERED, EVENT_HOMEASSISTANT_START, S... | {
"repo_name": "aequitas/home-assistant",
"path": "homeassistant/components/automation/__init__.py",
"copies": "1",
"size": "13825",
"license": "apache-2.0",
"hash": -3032927383393560600,
"line_mean": 30.6361556064,
"line_max": 79,
"alpha_frac": 0.6082459313,
"autogenerated": false,
"ratio": 4.212... |
"""Allow to set up simple automation rules via the config file."""
import asyncio
from functools import partial
import importlib
import logging
import voluptuous as vol
from homeassistant.setup import async_prepare_setup_platform
from homeassistant.core import CoreState, Context
from homeassistant.loader import bind_... | {
"repo_name": "nugget/home-assistant",
"path": "homeassistant/components/automation/__init__.py",
"copies": "1",
"size": "14008",
"license": "apache-2.0",
"hash": 397769296175093950,
"line_mean": 30.6207674944,
"line_max": 79,
"alpha_frac": 0.613078241,
"autogenerated": false,
"ratio": 4.19401197... |
# Allow transitive imports, e.g.
# `from ratelimitbackend import admin; admin.ModelAdmin`
from django.contrib.admin import * # noqa
from django.contrib.admin import site as django_site
from django.contrib.auth import REDIRECT_FIELD_NAME
from django.utils.translation import ugettext as _
from .forms import AdminAuthen... | {
"repo_name": "brutasse/django-ratelimit-backend",
"path": "ratelimitbackend/admin.py",
"copies": "1",
"size": "1299",
"license": "bsd-3-clause",
"hash": 1597461607040618000,
"line_mean": 34.1081081081,
"line_max": 78,
"alpha_frac": 0.648960739,
"autogenerated": false,
"ratio": 4.059375,
"confi... |
"""Allow users to set and activate scenes."""
from collections import namedtuple
import logging
from typing import Any, List
import voluptuous as vol
from homeassistant import config as conf_util
from homeassistant.components.light import ATTR_TRANSITION
from homeassistant.components.scene import DOMAIN as SCENE_DOMA... | {
"repo_name": "sdague/home-assistant",
"path": "homeassistant/components/homeassistant/scene.py",
"copies": "10",
"size": "9457",
"license": "apache-2.0",
"hash": 3625583014847985000,
"line_mean": 28.9272151899,
"line_max": 87,
"alpha_frac": 0.6070635508,
"autogenerated": false,
"ratio": 4.036278... |
"""Allow users to set and activate scenes."""
from collections import namedtuple
import logging
from typing import List
import voluptuous as vol
from homeassistant import config as conf_util
from homeassistant.components.scene import DOMAIN as SCENE_DOMAIN, STATES, Scene
from homeassistant.const import (
ATTR_ENT... | {
"repo_name": "Teagan42/home-assistant",
"path": "homeassistant/components/homeassistant/scene.py",
"copies": "1",
"size": "8465",
"license": "apache-2.0",
"hash": -3086675184480700000,
"line_mean": 28.8063380282,
"line_max": 88,
"alpha_frac": 0.6222090963,
"autogenerated": false,
"ratio": 4.0118... |
"""Allow users to set and activate scenes."""
from __future__ import annotations
import functools as ft
import importlib
import logging
from typing import Any
import voluptuous as vol
from homeassistant.components.light import ATTR_TRANSITION
from homeassistant.const import CONF_PLATFORM, SERVICE_TURN_ON
from homeas... | {
"repo_name": "adrienbrault/home-assistant",
"path": "homeassistant/components/scene/__init__.py",
"copies": "2",
"size": "3174",
"license": "mit",
"hash": 8033773374964815000,
"line_mean": 27.5945945946,
"line_max": 88,
"alpha_frac": 0.661310649,
"autogenerated": false,
"ratio": 4.06402048655569... |
"""Allow users to set and activate scenes."""
import asyncio
import importlib
import logging
import voluptuous as vol
from homeassistant.core import DOMAIN as HA_DOMAIN
from homeassistant.const import CONF_PLATFORM, SERVICE_TURN_ON
from homeassistant.helpers.config_validation import ENTITY_SERVICE_SCHEMA
from homeass... | {
"repo_name": "fbradyirl/home-assistant",
"path": "homeassistant/components/scene/__init__.py",
"copies": "1",
"size": "3374",
"license": "apache-2.0",
"hash": 5120263540438639000,
"line_mean": 27.3529411765,
"line_max": 81,
"alpha_frac": 0.6647895673,
"autogenerated": false,
"ratio": 4.228070175... |
#Allow us to import from parent directory, even if python isn't being run with the -m option
import os
parentdir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
os.sys.path.insert(0,parentdir)
from common import *
mt = morse_parse.morse_table
import itertools
### Constants
DOT = 1
DASH = 2
# The pause... | {
"repo_name": "nickodell/morse-code",
"path": "modulate/chars_to_elements.py",
"copies": "1",
"size": "2148",
"license": "mit",
"hash": 4935556237407366000,
"line_mean": 22.6043956044,
"line_max": 92,
"alpha_frac": 0.6568901304,
"autogenerated": false,
"ratio": 2.9384404924760603,
"config_test"... |
# Allow us to load `open_cp` without installing
import sys, os.path
sys.path.insert(0, os.path.abspath(os.path.join("..", "..")))
import matplotlib.pyplot as plt
import matplotlib
import descartes
import os
import numpy as np
import descartes
import pandas as pd
if not "GDAL_DATA" in os.environ:
try:
home... | {
"repo_name": "QuantCrimAtLeeds/PredictCode",
"path": "examples/Case Study Chicago South Side/common.py",
"copies": "1",
"size": "4492",
"license": "artistic-2.0",
"hash": -1483693975360792600,
"line_mean": 37.0508474576,
"line_max": 116,
"alpha_frac": 0.640311804,
"autogenerated": false,
"ratio"... |
"""Allow your decorations to be un-decorated.
In some cases, such as when testing, it can be useful to access the
decorated class or function directly, so as to not to use the behavior
or interface that the decorator might introduce.
Example:
>>> from functools import wraps
>>> from undecorate import unwrap, unwrapp... | {
"repo_name": "ryanhiebert/undecorate",
"path": "undecorate.py",
"copies": "1",
"size": "4722",
"license": "mit",
"hash": 552177485216485500,
"line_mean": 32.4893617021,
"line_max": 79,
"alpha_frac": 0.6692079627,
"autogenerated": false,
"ratio": 4.254054054054054,
"config_test": true,
"has_n... |
"""Allow you to run tests in an isolated container for an app or a lib.
If args are passed, default arguments are dropped
Usage:
test [options] <app_or_lib_name> [<suite_name>] [<args>...]
Options:
<suite_name> Name of the test suite you would like to run
If `all` is specified, all suites in the ... | {
"repo_name": "gamechanger/dusty",
"path": "dusty/cli/test.py",
"copies": "1",
"size": "2642",
"license": "mit",
"hash": 7794216381812545000,
"line_mean": 43.0333333333,
"line_max": 101,
"alpha_frac": 0.5878122634,
"autogenerated": false,
"ratio": 3.7475177304964538,
"config_test": true,
"has... |
__all__ = ["PackageInfo"]
from panda3d.core import Filename, DocumentSpec, Multifile, Decompressor, EUOk, EUSuccess, VirtualFileSystem, Thread, getModelPath, ExecutionEnvironment, PStatCollector, TiXmlDocument, TiXmlDeclaration, TiXmlElement
import panda3d.core as core
from direct.p3d.FileSpec import FileSpec
from dir... | {
"repo_name": "tobspr/panda3d",
"path": "direct/src/p3d/PackageInfo.py",
"copies": "12",
"size": "48231",
"license": "bsd-3-clause",
"hash": 3712609591782133000,
"line_mean": 37.9902991108,
"line_max": 215,
"alpha_frac": 0.6011486388,
"autogenerated": false,
"ratio": 4.549665125931516,
"config_... |
__all__ = ["PackageInstaller"]
from direct.showbase.DirectObject import DirectObject
from direct.stdpy.threading import Lock, RLock
from direct.showbase.MessengerGlobal import messenger
from direct.task.TaskManagerGlobal import taskMgr
from direct.p3d.PackageInfo import PackageInfo
from panda3d.core import TPLow, PSta... | {
"repo_name": "Wilee999/panda3d",
"path": "direct/src/p3d/PackageInstaller.py",
"copies": "9",
"size": "23408",
"license": "bsd-3-clause",
"hash": 7132608142070511000,
"line_mean": 35.575,
"line_max": 106,
"alpha_frac": 0.598726931,
"autogenerated": false,
"ratio": 4.780069430263427,
"config_te... |
__all__ = ["PackageMerger", "PackageMergerError"]
from direct.p3d.FileSpec import FileSpec
from direct.p3d.SeqValue import SeqValue
from direct.directnotify.DirectNotifyGlobal import *
from panda3d.core import *
import shutil
import os
class PackageMergerError(Exception):
pass
class PackageMerger:
""" This c... | {
"repo_name": "grimfang/panda3d",
"path": "direct/src/p3d/PackageMerger.py",
"copies": "10",
"size": "12061",
"license": "bsd-3-clause",
"hash": -7735742091881892000,
"line_mean": 38.4150326797,
"line_max": 127,
"alpha_frac": 0.5966337783,
"autogenerated": false,
"ratio": 4.556479032867397,
"co... |
__all__ = ["Package", "Packages"]
from .utils import pypi_api
from .utils.version import wanted_version, sort_versions
from .utils.exception import OperationException
def version_xor(v1, v2):
if v1 != "" and v2 != "":
raise("package info conflict")
return v1 or v2
class Package():
name = ""
version = ""
wanted... | {
"repo_name": "piton-package-manager/piton",
"path": "piton/package.py",
"copies": "1",
"size": "2389",
"license": "mit",
"hash": 8028725391031615000,
"line_mean": 35.196969697,
"line_max": 92,
"alpha_frac": 0.6977814985,
"autogenerated": false,
"ratio": 3.118798955613577,
"config_test": false,... |
# All Packages required
import requests
import ujson as json
import urllib
import collections
import hmac
import hashlib
from base64 import b64encode
from constants import API_ENDPOINT, API_MERCHANT_ENDPOINT, API_SERVICEABILITY_ENDPOINT, STAGING_URL_HOST, PRODUCTION_URL_HOST
from .errors import HTTPError
class Opinio... | {
"repo_name": "anistark/opiniohll",
"path": "OpinioDelivery/OpinioDelivery.py",
"copies": "1",
"size": "4752",
"license": "mit",
"hash": -4076761259631256000,
"line_mean": 38.9327731092,
"line_max": 125,
"alpha_frac": 0.611952862,
"autogenerated": false,
"ratio": 3.9272727272727272,
"config_tes... |
__all__ = ["PacketEvaluator"]
class PacketEvaluator:
r"""
An object that can be used to lazily evaluate a function.
PacketEvaluators are created by called ``TemplateFunction.make_packet``.
Their purpose is to bind a function to some specific parameters. When
called, a packet will return the result of calling the... | {
"repo_name": "Michaelfonzolo/py-template-function",
"path": "source/main/python/template-function/packet.py",
"copies": "1",
"size": "1297",
"license": "mit",
"hash": 5254582311954866000,
"line_mean": 23.9615384615,
"line_max": 73,
"alpha_frac": 0.6638396299,
"autogenerated": false,
"ratio": 3.2... |
###############################################################################
# Import needed library
import sys
###############################################################################
# Define the getPath() function
# Implements the "linear time" extra credit option with ideas from
# https://en.wikipedia... | {
"repo_name": "dixoncrews/ncsu-fall16-csc505",
"path": "all_pairs_shortest_paths/allpairs.py",
"copies": "1",
"size": "3274",
"license": "mit",
"hash": 5470844551273960000,
"line_mean": 26.0661157025,
"line_max": 81,
"alpha_frac": 0.4899205864,
"autogenerated": false,
"ratio": 3.605726872246696,
... |
__all__ = ['Parachute']
from pymavlink import mavutil
from ..connection import CommandLong
from ...connection import Message
from ...configuration import Configuration
from ...state import State
from ...specification import Specification
from ...environment import Environment
from ...command import Parameter, Command... | {
"repo_name": "squaresLab/Houston",
"path": "houston/ardu/copter/parachute.py",
"copies": "1",
"size": "1784",
"license": "mit",
"hash": 8423892688206211000,
"line_mean": 25.6268656716,
"line_max": 68,
"alpha_frac": 0.5908071749,
"autogenerated": false,
"ratio": 3.8614718614718613,
"config_test... |
__all__ = ['parse_arlequin']
import re
def parse_arlequin(entry):
"""Parse a block of Arlequin formatted text."""
if not entry.upper().startswith('[PROFILE]'):
raise TypeError("entry does not start with '[Profile]'")
parsed = {}
sections = [ x.strip() for x in RE_SECTIONS.split(entry) if len... | {
"repo_name": "ryanraaum/oldowan.arlequin",
"path": "oldowan/arlequin/parse.py",
"copies": "1",
"size": "5753",
"license": "mit",
"hash": -8430177679296048000,
"line_mean": 30.2663043478,
"line_max": 93,
"alpha_frac": 0.5991656527,
"autogenerated": false,
"ratio": 3.457331730769231,
"config_tes... |
__all__ = ['parse', 'AST', 'ParserError', 'Parser']
from spark import GenericASTBuilder, GenericASTMatcher
import string, exceptions, sys
from UserList import UserList
from Scanner import Token
class AST(UserList):
def __init__(self, type, kids=[]):
self.type = intern(type)
UserList.__init__(self, kids)
def __ge... | {
"repo_name": "evandrix/Splat",
"path": "doc/Parser.py",
"copies": "1",
"size": "14855",
"license": "mit",
"hash": -766380107425525600,
"line_mean": 27.2414448669,
"line_max": 149,
"alpha_frac": 0.6473914507,
"autogenerated": false,
"ratio": 2.8193205541848547,
"config_test": false,
"has_no_k... |
__all__ = ['parse_author']
import datetime
import collections
import re
Author = collections.namedtuple('Author', 'name email date')
PARSE_OFFSET = re.compile(r'([-+])(\d\d)(\d\d)$')
def parse_timestamp(timestamp):
timestamp = datetime.datetime.utcfromtimestamp(int(timestamp))
return timestamp.replace(tzinfo... | {
"repo_name": "depp/doublegit",
"path": "doublegit/author.py",
"copies": "1",
"size": "1604",
"license": "bsd-2-clause",
"hash": 3925079603906457000,
"line_mean": 30.4509803922,
"line_max": 70,
"alpha_frac": 0.6128428928,
"autogenerated": false,
"ratio": 3.2338709677419355,
"config_test": true,... |
__all__ = ["ParseError", "parse_nested_list"]
class ParseError(Exception):
pass
# Basic functions for parsing PDDL (Lisp) files.
def parse_nested_list(input_file):
tokens = tokenize(input_file)
next_token = tokens.next()
if next_token != "(":
raise ParseError("Expected '(', got %s." % next_token)
result... | {
"repo_name": "GKIFreiburg/gki_symbolic_planning",
"path": "tfd_modules/downward/translate/pddl/parser.py",
"copies": "1",
"size": "1784",
"license": "bsd-3-clause",
"hash": -6581535469639992000,
"line_mean": 30.8571428571,
"line_max": 79,
"alpha_frac": 0.6165919283,
"autogenerated": false,
"rati... |
__all__ = ["ParseFromValue", \
"CreateValueFrom", \
"CreateElement", \
"CallAtomsJs", \
"VerifyElementClickable", \
"FindElement", \
"IsElementEnabled", \
"IsOptionElementSelected", \
"GetElementSize", \
"IsElementDisplay... | {
"repo_name": "PeterWangIntel/crosswalk-webdriver-python",
"path": "command/element_util.py",
"copies": "1",
"size": "17371",
"license": "bsd-3-clause",
"hash": -3778442259220018700,
"line_mean": 36.1970021413,
"line_max": 135,
"alpha_frac": 0.6787749698,
"autogenerated": false,
"ratio": 3.545825... |
__all__ = ['parser']
import platform
import getpass
from collections import namedtuple
from urllib.parse import urlparse,ParseResult,parse_qsl
from .error import *
from typing import Dict,Optional,Tuple,Union,Any
Default = namedtuple('Default',['user','password','host','port'])
if platform.system() == 'Darwin':
... | {
"repo_name": "Python-Tools/aioorm",
"path": "aioorm/uri_parser.py",
"copies": "1",
"size": "2165",
"license": "mpl-2.0",
"hash": 2910644597830366700,
"line_mean": 24.7738095238,
"line_max": 118,
"alpha_frac": 0.6526558891,
"autogenerated": false,
"ratio": 3.700854700854701,
"config_test": fals... |
# All parsing functions
from collections import defaultdict
import numpy as np
import pdb
NUM_GENES = 8499
directory = 'data/'
files = ['BRCA.txt', 'COAD.txt', 'KIRC.txt', 'LUSC.txt', 'OV.txt', 'UCEC.txt']
reg_file = 'tfs.txt'
cancer = 'KIRC'
# X is in the form: Genes vs Tumor Sample
# regulators is a list of regul... | {
"repo_name": "kevintee/Predicting-Gene-Networks",
"path": "src/parse.py",
"copies": "1",
"size": "5051",
"license": "mit",
"hash": 1076532608977266700,
"line_mean": 29.7987804878,
"line_max": 83,
"alpha_frac": 0.5545436547,
"autogenerated": false,
"ratio": 3.4197698036560595,
"config_test": fa... |
__all__=["ParticipaTriplification"]
import psycopg2, rdflib as r, sys, urllib, re
class ParticipaTriplification:
def __init__(self,dbname="newdb",username="r",separator="/",filename="participaTriplestore",render=True,write_files=True,compute_networks=True,compute_bows=False):
"""Reads PostgreSQL Participabr... | {
"repo_name": "ttm/participationLegacy",
"path": "participation/triplification/participaTriplification.py",
"copies": "1",
"size": "10937",
"license": "mit",
"hash": -4268547982895012000,
"line_mean": 49.6962616822,
"line_max": 572,
"alpha_frac": 0.640612038,
"autogenerated": false,
"ratio": 3.25... |
__all__ = ['Particle']
from sympy import sympify
from sympy.physics.mechanics.point import Point
class Particle(object):
"""A particle.
Particles have a non-zero mass and lack spatial extension; they take up no
space.
Values need to be supplied on initialization, but can be changed later.
Param... | {
"repo_name": "ichuang/sympy",
"path": "sympy/physics/mechanics/particle.py",
"copies": "1",
"size": "1687",
"license": "bsd-3-clause",
"hash": 270748484759059140,
"line_mean": 23.8088235294,
"line_max": 79,
"alpha_frac": 0.5892116183,
"autogenerated": false,
"ratio": 4.104622871046229,
"config... |
__all__ = ['Particle']
from sympy import sympify
from sympy.physics.mechanics.point import Point
class Particle(object):
"""A particle.
Particles have a non-zero mass and lack spatial extension; they take up no
space.
Values need to be supplied on initialization, but can be changed later.
Para... | {
"repo_name": "amitjamadagni/sympy",
"path": "sympy/physics/mechanics/particle.py",
"copies": "3",
"size": "5890",
"license": "bsd-3-clause",
"hash": 8568144810573467000,
"line_mean": 25.5315315315,
"line_max": 79,
"alpha_frac": 0.543803056,
"autogenerated": false,
"ratio": 4.081774081774082,
"... |
__all__ = ["PatchMaker"]
from direct.p3d.FileSpec import FileSpec
from direct.p3d.SeqValue import SeqValue
from panda3d.core import *
import copy
class PatchMaker:
""" This class will operate on an existing package install
directory, as generated by the Packager, and create patchfiles
between versions as ... | {
"repo_name": "silly-wacky-3-town-toon/SOURCE-COD",
"path": "Panda3D-1.10.0/direct/p3d/PatchMaker.py",
"copies": "9",
"size": "32276",
"license": "apache-2.0",
"hash": -1788616039141211100,
"line_mean": 38.6511056511,
"line_max": 103,
"alpha_frac": 0.5851716446,
"autogenerated": false,
"ratio": 4... |
__all__ = ['path_sign_to_signed_nodes', 'signed_nodes_to_signed_edge',
'get_sorted_neighbors', 'get_subgraph', 'Node', 'Edge',
'EdgeFilter', 'SendType']
import logging
import networkx as nx
import functools
from typing import List, Tuple, Union, Optional, Callable, Set
logger = logging.getLogger... | {
"repo_name": "bgyori/indra",
"path": "indra/explanation/pathfinding/util.py",
"copies": "3",
"size": "4961",
"license": "bsd-2-clause",
"hash": -4038458236941311500,
"line_mean": 30.8012820513,
"line_max": 78,
"alpha_frac": 0.5966539004,
"autogenerated": false,
"ratio": 3.9341792228390164,
"co... |
__all__ = ['path_sign_to_signed_nodes', 'signed_nodes_to_signed_edge',
'get_sorted_neighbors']
import logging
logger = logging.getLogger(__name__)
def path_sign_to_signed_nodes(source, target, edge_sign):
"""Translates a signed edge or path to valid signed nodes
Pairs with a negative source node ... | {
"repo_name": "johnbachman/belpy",
"path": "indra/explanation/pathfinding/util.py",
"copies": "1",
"size": "3526",
"license": "mit",
"hash": -552622888989789700,
"line_mean": 29.6608695652,
"line_max": 78,
"alpha_frac": 0.5601247873,
"autogenerated": false,
"ratio": 3.979683972911964,
"config_t... |
__all__ = ["Pattern"]
from ..utils import isfunction
import lasagne.objectives
from lasagne.layers import get_all_layers
from lasagne.layers import InputLayer
from lasagne.layers import Layer
import theano.tensor as T
import numpy as np
import itertools
from collections import OrderedDict
import inspect
import co... | {
"repo_name": "tu-rbo/concarne",
"path": "concarne/patterns/base.py",
"copies": "1",
"size": "33555",
"license": "mit",
"hash": -6265479839047217000,
"line_mean": 37.1740614334,
"line_max": 92,
"alpha_frac": 0.5511846223,
"autogenerated": false,
"ratio": 4.549213665943601,
"config_test": false,... |
__all__ = ['PeriodicKernel']
import numpy as np
import sympy as sym
from functools import wraps
from gp.ext import periodic_c
from . import Kernel
DTYPE = np.float64
EPS = np.finfo(DTYPE).eps
class PeriodicKernel(Kernel):
r"""
Periodic kernel function.
Parameters
----------
h : float
O... | {
"repo_name": "jhamrick/gaussian_processes",
"path": "gp/kernels/periodic.py",
"copies": "1",
"size": "5591",
"license": "mit",
"hash": -3328763917622509600,
"line_mean": 28.4263157895,
"line_max": 99,
"alpha_frac": 0.5356823466,
"autogenerated": false,
"ratio": 2.889405684754522,
"config_test"... |
__all__ = ['period', 'Period']
def period(pstr=''):
'''Create a period object from a period string'''
return Period.make(pstr)
def find_first_of(st, possible):
possible = tuple(possible)
lowi = -1
for p in possible:
i = st.find(p)
if i != -1 and (i < lowi or lowi == -1):
... | {
"repo_name": "artisavotins/ccy",
"path": "ccy/dates/period.py",
"copies": "1",
"size": "4260",
"license": "bsd-3-clause",
"hash": -2350562769324093400,
"line_mean": 24.0588235294,
"line_max": 69,
"alpha_frac": 0.4805164319,
"autogenerated": false,
"ratio": 3.7665782493368702,
"config_test": fa... |
__all__ = ['perm_cache']
import json
import pickle
from functools import update_wrapper
from os.path import exists
def perm_cache(cache_type='pkl', cache_file=None):
class PermCache(object):
_cache_type = cache_type
_cache_file = cache_file
def __init__(self, func):
if self._... | {
"repo_name": "sorgerlab/indra",
"path": "indra/util/perm_cache.py",
"copies": "4",
"size": "2493",
"license": "bsd-2-clause",
"hash": 6183060594598028000,
"line_mean": 36.2089552239,
"line_max": 81,
"alpha_frac": 0.4540713999,
"autogenerated": false,
"ratio": 4.141196013289036,
"config_test": ... |
""" All permissions are defined here.
They are also defined in permissions.zcml.
The two files must be kept in sync.
bika.lims.__init__ imports * from this file, so
bika.lims.PermName or bika.lims.permissions.PermName are
both valid.
"""
from Products.CMFCore.permissions import AddPortalContent
#... | {
"repo_name": "hocinebendou/bika.gsoc",
"path": "bika/lims/permissions.py",
"copies": "1",
"size": "6349",
"license": "mit",
"hash": -2278182654544300300,
"line_mean": 33.693989071,
"line_max": 79,
"alpha_frac": 0.6901874311,
"autogenerated": false,
"ratio": 3.5829571106094806,
"config_test": f... |
__all__ = ['Person']
class Person(object):
searchable_fields = ['first_name', 'last_name', 'email', 'emails']
def __init__(self, first_name, last_name, addresses, phone_numbers, emails):
"""
Constructor of Person class
:param first_name: first name of the person
:type first_n... | {
"repo_name": "dizpers/python-address-book-assignment",
"path": "address_book/person.py",
"copies": "1",
"size": "3766",
"license": "mit",
"hash": 595361485026406100,
"line_mean": 32.0438596491,
"line_max": 92,
"alpha_frac": 0.5541688794,
"autogenerated": false,
"ratio": 4.615196078431373,
"con... |
__all__ = ['physics', 'shapes', 'ui', 'constants', 'util']
def go():
# Imports (DO NOT EDIT)
from visual import vector, display
from physics import BField
from shapes import Wire, Coil, Bar, Particle
from ui import Elviz
# Initial setup
e = Elviz(1600, 900) # (width, height)
d = e.scen... | {
"repo_name": "Octaplex/elviz",
"path": "elviz/__init__.py",
"copies": "1",
"size": "1267",
"license": "mit",
"hash": 7377079448483172000,
"line_mean": 32.3421052632,
"line_max": 98,
"alpha_frac": 0.5935280189,
"autogenerated": false,
"ratio": 2.8155555555555556,
"config_test": false,
"has_no... |
__all__ = ['PingProtocolCommand']
import time
import random
from print_colors import PrintColors
from contact import Contact
from protocol_command import ProtocolCommand
class PingProtocolCommand(ProtocolCommand):
def start(self):
self.req()
def stop(self):
raise NotImplementedError
def... | {
"repo_name": "mtasic85/routingtable",
"path": "ping_protocol_command.py",
"copies": "1",
"size": "9122",
"license": "mit",
"hash": -6973916327591847000,
"line_mean": 38.1502145923,
"line_max": 118,
"alpha_frac": 0.4304976979,
"autogenerated": false,
"ratio": 4.545092177379173,
"config_test": f... |
__all__ = ['Planet']
import os
import numpy as np
from pylightcurve.errors import *
from pylightcurve.models.exoplanet_lc import planet_orbit, planet_star_projected_distance, planet_phase, \
transit, transit_integrated, \
transit_duration, transit_depth, eclipse, eclipse_integrated, eclipse_mid_time, eclipse_... | {
"repo_name": "ucl-exoplanets/pylightcurve",
"path": "pylightcurve/models/exoplanet.py",
"copies": "1",
"size": "56037",
"license": "mit",
"hash": -4768177089704062000,
"line_mean": 45.6975,
"line_max": 167,
"alpha_frac": 0.5784570909,
"autogenerated": false,
"ratio": 3.704925619834711,
"config... |
__all__ = ['Players', 'Games', 'Votes']
from mongoengine import (BooleanField, Document, IntField, DictField, DateTimeField,
ListField, ReferenceField, StringField, URLField, FloatField)
class Players(Document):
guid = StringField()
guids = ListField(StringField())
name = StringF... | {
"repo_name": "aequitas/munerator",
"path": "munerator/common/models.py",
"copies": "1",
"size": "2265",
"license": "mit",
"hash": 3877534242712547300,
"line_mean": 27.6708860759,
"line_max": 106,
"alpha_frac": 0.6635761589,
"autogenerated": false,
"ratio": 3.9186851211072664,
"config_test": fa... |
__all__ = ["PlotManager"]
import os
import math
import matplotlib.pyplot as plt
import pylab
from utility.log import VLOG
#import Tkinter
""" This class helps local controller machine process
the data renderring routines besides the WebGL renderring
which is implemented by JavaScript. This helper mainly use
the matpl... | {
"repo_name": "weibohit/tools",
"path": "utility/plot_manager.py",
"copies": "1",
"size": "9691",
"license": "mit",
"hash": -5149952545558977000,
"line_mean": 30.1607717042,
"line_max": 86,
"alpha_frac": 0.5629965948,
"autogenerated": false,
"ratio": 3.220671319375208,
"config_test": false,
"... |
__all__=['plotsascurve','guinierplot','kratkyplot']
from .io import getsascurve
import matplotlib.pyplot as plt
from sastool.libconfig import qunit, dunit
def plotsascurve(samplename, *args, **kwargs):
if 'dist' not in kwargs:
kwargs['dist'] = None
data1d, dist = getsascurve(samplename, kwargs['dist'])... | {
"repo_name": "awacha/credolib",
"path": "credolib/plotting.py",
"copies": "1",
"size": "4640",
"license": "bsd-3-clause",
"hash": 2475791799067895000,
"line_mean": 32.1428571429,
"line_max": 78,
"alpha_frac": 0.5334051724,
"autogenerated": false,
"ratio": 3.4523809523809526,
"config_test": fal... |
"""All plots of paper II
"""
import os
from collections import defaultdict
import numpy as np
from energy_demand.read_write import data_loader, read_data
from energy_demand.basic import date_prop
from energy_demand.basic import lookup_tables
from energy_demand.plotting import fig_weather_variability_priod
from energy_... | {
"repo_name": "nismod/energy_demand",
"path": "energy_demand/plotting/figs_p2.py",
"copies": "1",
"size": "11623",
"license": "mit",
"hash": -3454682120800130000,
"line_mean": 43.3625954198,
"line_max": 197,
"alpha_frac": 0.5982964811,
"autogenerated": false,
"ratio": 3.724126882409484,
"config... |
__all__ = ['Plugin']
import os.path
import subprocess
from datetime import timedelta
from studip_sync.helpers import JSONConfig, ConfigError
from studip_sync.plugins import PluginBase
import pickle
from googleapiclient.discovery import build
from google_auth_oauthlib.flow import InstalledAppFlow
from google.auth.tra... | {
"repo_name": "popeye123/studip-sync",
"path": "studip_sync/plugins/google-tasks/__init__.py",
"copies": "1",
"size": "6031",
"license": "unlicense",
"hash": -6973463084569409000,
"line_mean": 32.5055555556,
"line_max": 121,
"alpha_frac": 0.6154866523,
"autogenerated": false,
"ratio": 4.226348983... |
__all__ = ['Point']
from sympy.physics.mechanics.essential import _check_frame, _check_vector
class Point(object):
"""This object represents a point in a dynamic system.
It stores the: position, velocity, and acceleration of a point.
The position is a vector defined as the vector distance from a parent
... | {
"repo_name": "flacjacket/sympy",
"path": "sympy/physics/mechanics/point.py",
"copies": "2",
"size": "13473",
"license": "bsd-3-clause",
"hash": -1133574990310438000,
"line_mean": 29.4819004525,
"line_max": 85,
"alpha_frac": 0.528315891,
"autogenerated": false,
"ratio": 3.7824256035934867,
"con... |
__all__ = ['Point']
from sympy.physics.mechanics.essential import _check_frame, _check_vector
class Point(object):
"""This object represents a point in a dynamic system.
It stores the: position, velocity, and acceleration of a point.
The position is a vector defined as the vector distance from a parent
... | {
"repo_name": "amitjamadagni/sympy",
"path": "sympy/physics/mechanics/point.py",
"copies": "3",
"size": "13472",
"license": "bsd-3-clause",
"hash": -290736466264247800,
"line_mean": 29.4108352144,
"line_max": 85,
"alpha_frac": 0.5283551069,
"autogenerated": false,
"ratio": 3.7821448624368332,
"... |
__all__ = ['Point']
from sympy.physics.mechanics.essential import Vector, ReferenceFrame
class Point(object):
"""This object represents a point in a dynamic system.
It stores the: position, velocity, and acceleration of a point.
The position is a vector defined as the vector distance from a parent
po... | {
"repo_name": "ichuang/sympy",
"path": "sympy/physics/mechanics/point.py",
"copies": "1",
"size": "13889",
"license": "bsd-3-clause",
"hash": -168008012501465060,
"line_mean": 29.5925110132,
"line_max": 85,
"alpha_frac": 0.5312117503,
"autogenerated": false,
"ratio": 3.812517156189953,
"config_... |
__all__ = ['PointType', 'PointZType', 'PointMType', 'PointZMType', 'PolylineType', 'PolygonType']
import array
import sys
from pyspark.sql.types import UserDefinedType, StructField, StructType, DoubleType, IntegerType, ArrayType
#
# Copied from Spark VectorUDT
#
if sys.version >= '3':
basestring = str
xrange ... | {
"repo_name": "mraad/spark-gdb",
"path": "src/main/python/com/esri/udt/__init__.py",
"copies": "1",
"size": "8974",
"license": "apache-2.0",
"hash": 6541661052133554000,
"line_mean": 24.7873563218,
"line_max": 106,
"alpha_frac": 0.5554936483,
"autogenerated": false,
"ratio": 3.5192156862745096,
... |
__all__ = ['polygon_clip', 'polygon_area']
import numpy as np
from matplotlib import _path, path, transforms
def polygon_clip(rp, cp, r0, c0, r1, c1):
"""Clip a polygon to the given bounding box.
Parameters
----------
rp, cp : (N,) ndarray of double
Row and column coordinates of the polygon.... | {
"repo_name": "rjeli/scikit-image",
"path": "skimage/_shared/_geometry.py",
"copies": "11",
"size": "1411",
"license": "bsd-3-clause",
"hash": 3442610144012886000,
"line_mean": 25.1296296296,
"line_max": 72,
"alpha_frac": 0.5839829908,
"autogenerated": false,
"ratio": 3.3044496487119437,
"confi... |
__all__ = ['polygon_clip', 'polygon_area']
import numpy as np
from matplotlib import path, transforms
def polygon_clip(rp, cp, r0, c0, r1, c1):
"""Clip a polygon to the given bounding box.
Parameters
----------
rp, cp : (N,) ndarray of double
Row and column coordinates of the polygon.
(r... | {
"repo_name": "paalge/scikit-image",
"path": "skimage/_shared/_geometry.py",
"copies": "1",
"size": "1404",
"license": "bsd-3-clause",
"hash": 3386516754324987400,
"line_mean": 25,
"line_max": 72,
"alpha_frac": 0.584045584,
"autogenerated": false,
"ratio": 3.311320754716981,
"config_test": fals... |
__all__ = ['polygon_clip', 'polygon_area']
import numpy as np
def polygon_clip(rp, cp, r0, c0, r1, c1):
from matplotlib import _path, path, transforms
"""Clip a polygon to the given bounding box.
Parameters
----------
rp, cp : (N,) ndarray of double
Row and column coordinates of the polyg... | {
"repo_name": "ryfeus/lambda-packs",
"path": "Skimage_numpy/source/skimage/_shared/_geometry.py",
"copies": "1",
"size": "1414",
"license": "mit",
"hash": 3824778858697641500,
"line_mean": 25.679245283,
"line_max": 72,
"alpha_frac": 0.5827439887,
"autogenerated": false,
"ratio": 3.311475409836065... |
__all__ = ['Pool']
#
# Imports
#
import threading
import Queue
import itertools
import collections
import time
import os
from pyvotune.log import logger
import multiprocessing
from multiprocessing import Process, cpu_count, TimeoutError
from multiprocessing.util import Finalize, log_to_stderr
from multiprocessing.p... | {
"repo_name": "aelaguiz/pyvotune",
"path": "pyvotune/util/timeout_pool.py",
"copies": "1",
"size": "18420",
"license": "mit",
"hash": 8076286120123463000,
"line_mean": 33.820415879,
"line_max": 130,
"alpha_frac": 0.5308903366,
"autogenerated": false,
"ratio": 4.486117876278617,
"config_test": f... |
__all__ = ["PortReservation", \
"PortManager", \
"PortServer"]
import sys
import socket
import select
import os
import re
import random
from browser.status import *
from base.log import VLOG
from base.bind import Bind
class PortReservation(object):
def __init__(self, on_free_func, port):
... | {
"repo_name": "PeterWangIntel/crosswalk-webdriver-python",
"path": "net/port_server.py",
"copies": "1",
"size": "4353",
"license": "bsd-3-clause",
"hash": 1865162224329519600,
"line_mean": 30.3165467626,
"line_max": 93,
"alpha_frac": 0.6420859178,
"autogenerated": false,
"ratio": 3.70468085106383... |
__all__ = ['Predicate']
from typing import Callable
import attr
@attr.s(frozen=True)
class Predicate(object):
"""
A predicate is used to check if a condition is met. Predicates are used
to implement preconditions, postconditions, and invariants for a variety
of purposes.
"""
name = attr.ib(t... | {
"repo_name": "squaresLab/Houston",
"path": "houston/predicate.py",
"copies": "1",
"size": "1518",
"license": "mit",
"hash": 223586114024267700,
"line_mean": 25.6315789474,
"line_max": 78,
"alpha_frac": 0.6166007905,
"autogenerated": false,
"ratio": 4.788643533123029,
"config_test": false,
"h... |
all_preferences = {}
# read a list of all_preferences from the .txt file
# this .txt file is a copy of the challenge input from Reddit
for line in open('preferences.txt').read().splitlines():
person = line[0]
prefs = line.split(', ')
prefs.pop(0)
all_preferences[person] = prefs
# not a particularly un... | {
"repo_name": "filipdanic/dailyprogrammer",
"path": "Hard/husbands_for_sisters/husbands.py",
"copies": "1",
"size": "1199",
"license": "unlicense",
"hash": -4151231244089407000,
"line_mean": 34.2647058824,
"line_max": 87,
"alpha_frac": 0.6196830692,
"autogenerated": false,
"ratio": 3.425714285714... |
__all__ = ['pretty_print_model_fields']
def _get_class_full_name(cls_):
return cls_.__module__ + '.' + cls_.__name__
class _ModelFieldRow(object):
def __init__(self, field):
self.field = field
self.name = field.name
self.type_ = _get_class_full_name(type(field))
if self.fiel... | {
"repo_name": "wwitzel3/awx",
"path": "tools/scripts/list_fields.py",
"copies": "4",
"size": "1645",
"license": "apache-2.0",
"hash": -8808457904600796000,
"line_mean": 34.7608695652,
"line_max": 84,
"alpha_frac": 0.5580547112,
"autogenerated": false,
"ratio": 3.0462962962962963,
"config_test":... |
__all__ = ['process_csv', 'process_from_web']
import csv
import logging
import requests
from hashlib import md5
from .processor import TasProcessor
from indra.util import read_unicode_csv
tas_data_url = 'https://bigmech.s3.amazonaws.com/indra-db/tas.csv'
tas_resource_md5 = '554ccba4617aae7b3b06a62893424c7f'
logger... | {
"repo_name": "johnbachman/belpy",
"path": "indra/sources/tas/api.py",
"copies": "4",
"size": "5077",
"license": "mit",
"hash": -359319698873610800,
"line_mean": 39.616,
"line_max": 79,
"alpha_frac": 0.660035454,
"autogenerated": false,
"ratio": 3.938712179984484,
"config_test": false,
"has_n... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.