text stringlengths 0 1.05M | meta dict |
|---|---|
# Absolute Optical Flow Rotation/Scale
#
# This example shows off using your OpenMV Cam to measure
# rotation/scale by comparing the current and a previous
# image against each other. Note that only rotation/scale is
# handled - not X and Y translation in this mode.
# To run this demo effectively please mount your Ope... | {
"repo_name": "kwagyeman/openmv",
"path": "scripts/examples/Arduino/Portenta-H7/22-Optical-Flow/absolute-rotation-scale.py",
"copies": "2",
"size": "3230",
"license": "mit",
"hash": 1578007098796938200,
"line_mean": 47.2089552239,
"line_max": 97,
"alpha_frac": 0.7086687307,
"autogenerated": false,
... |
# Absolute Optical Flow Translation
#
# This example shows off using your OpenMV Cam to measure translation
# in the X and Y direction by comparing the current and a previous
# image against each other. Note that only X and Y translation is
# handled - not rotation/scale in this mode.
# To run this demo effectively pl... | {
"repo_name": "iabdalkader/openmv",
"path": "scripts/examples/22-Optical-Flow/absolute-translation.py",
"copies": "3",
"size": "2715",
"license": "mit",
"hash": 6572079657225470000,
"line_mean": 48.3636363636,
"line_max": 95,
"alpha_frac": 0.7145488029,
"autogenerated": false,
"ratio": 3.63453815... |
# Absorb linear operators into proximal operators.
from proximal.lin_ops import Variable, scale, mul_elemwise, Constant
from proximal.prox_fns import (nonneg, weighted_nonneg, norm1, weighted_norm1, poisson_norm,
weighted_poisson_norm, sum_squares, weighted_sum_squares,
... | {
"repo_name": "comp-imaging/ProxImaL",
"path": "proximal/algorithms/absorb.py",
"copies": "2",
"size": "4472",
"license": "mit",
"hash": 3865862143409765000,
"line_mean": 35.064516129,
"line_max": 92,
"alpha_frac": 0.5811717352,
"autogenerated": false,
"ratio": 3.3028064992614476,
"config_test"... |
"""Abstactions for working with excel files."""
from win32 import run
import constants as xlcharts
runexcel = lambda: run('Excel.Application')
def open_xlsx(app, path):
return app.Workbooks.Open(path)
def sheet(xlsx, index):
return xlsx.Sheets.Item(index)
def chart(sheet, reference):
return sheet.Cha... | {
"repo_name": "Intelimetrica/coati",
"path": "coati/excel.py",
"copies": "1",
"size": "1180",
"license": "mit",
"hash": 2166662391699872800,
"line_mean": 22.137254902,
"line_max": 72,
"alpha_frac": 0.6483050847,
"autogenerated": false,
"ratio": 3.4911242603550297,
"config_test": false,
"has_n... |
"""Abstact Wrapper base-class for the FieldWrapper and DataclassWrapper."""
from abc import ABC, abstractmethod
from dataclasses import dataclass
from typing import Generic, Optional, List, Type
from ..utils import T
class Wrapper(Generic[T], ABC):
def __init__(self, wrapped: T, name: str):
self.wrapped ... | {
"repo_name": "lebrice/SimpleParsing",
"path": "simple_parsing/wrappers/wrapper.py",
"copies": "1",
"size": "1432",
"license": "mit",
"hash": -4938929028845493000,
"line_mean": 26.0377358491,
"line_max": 75,
"alpha_frac": 0.5921787709,
"autogenerated": false,
"ratio": 4.249258160237389,
"config... |
"""Abstract adapter class."""
from __future__ import absolute_import
from pysnmp import error as pysnmp_error
from pysnmp.entity.rfc3413.oneliner.cmdgen import CommunityData, UsmUserData, \
UdpTransportTarget, CommandGenerator
from snmp_orm.utils import str_to_oid
from snmp_orm.adapters.base import AbstractAdapte... | {
"repo_name": "blackwithwhite666/snmp_orm",
"path": "snmp_orm/adapters/pysnmp.py",
"copies": "1",
"size": "4445",
"license": "mit",
"hash": -8753919701852876000,
"line_mean": 38.6875,
"line_max": 79,
"alpha_frac": 0.6380202475,
"autogenerated": false,
"ratio": 3.990125673249551,
"config_test": ... |
"""Abstract adapter class."""
from __future__ import absolute_import
import logging
from pprint import pformat
from functools import wraps
from six import Iterator
from pyasn1.type.univ import Null
from snmp_orm.config import DEBUG
from snmp_orm.settings import SnmpV2Settings, SnmpV3Settings
from snmp_orm.utils imp... | {
"repo_name": "blackwithwhite666/snmp_orm",
"path": "snmp_orm/adapters/base.py",
"copies": "1",
"size": "5402",
"license": "mit",
"hash": 3936374002376128500,
"line_mean": 29.6931818182,
"line_max": 87,
"alpha_frac": 0.5497963717,
"autogenerated": false,
"ratio": 3.7988748241912798,
"config_tes... |
"""Abstract API classes."""
import json
JSON_RPC_VERSION = '2.0'
class AbstractAPI:
"""Abstract interface of all children APIs.
This is repsonsible for setting the right attributes
that ``Request`` uses to build the request dict."""
def __init__(self):
with open('params.json') as f:
... | {
"repo_name": "modulus-sa/pybbix",
"path": "pybbix/api/__init__.py",
"copies": "1",
"size": "1817",
"license": "mit",
"hash": -578529627717113600,
"line_mean": 24.2361111111,
"line_max": 64,
"alpha_frac": 0.557512383,
"autogenerated": false,
"ratio": 4.215777262180975,
"config_test": false,
"... |
"""Abstract API classes."""
JSON_RPC_VERSION = '2.0'
class AbstractAPI:
"""Abstract interface of all children APIs.
This is repsonsible for setting the right attributes
that ``Request`` uses to build the request dict."""
methods = ()
def __init__(self):
self._method_cache = {}
de... | {
"repo_name": "laerus/pybbix",
"path": "pybbix/api/__init__.py",
"copies": "1",
"size": "1784",
"license": "mit",
"hash": -3548922086721326000,
"line_mean": 23.7777777778,
"line_max": 74,
"alpha_frac": 0.5543721973,
"autogenerated": false,
"ratio": 4.217494089834515,
"config_test": false,
"ha... |
""" Abstract backends that are backed by simple JSON """
from .base import IAccessBackend, IMutableAccessBackend
class IJsonAccessBackend(IAccessBackend):
"""
This backend reads the permissions from anything that can provide JSON data
Notes
-----
JSON should look like this::
{
... | {
"repo_name": "stevearc/pypicloud",
"path": "pypicloud/access/base_json.py",
"copies": "1",
"size": "8953",
"license": "mit",
"hash": -6314642195883206000,
"line_mean": 30.8612099644,
"line_max": 85,
"alpha_frac": 0.5132357869,
"autogenerated": false,
"ratio": 4.501256913021619,
"config_test": ... |
"""Abstract base class and null boundary condition class for
conveniently making compliant boundary condition classes for use in
wepy.
"""
import sys
import logging
from copy import deepcopy
from collections import defaultdict
import random
import numpy as np
from wepy.walker import Walker
class BoundaryConditions... | {
"repo_name": "ADicksonLab/wepy",
"path": "src/wepy/boundary_conditions/boundary.py",
"copies": "1",
"size": "17437",
"license": "mit",
"hash": 2876335045126917600,
"line_mean": 30.5316455696,
"line_max": 88,
"alpha_frac": 0.646441475,
"autogenerated": false,
"ratio": 4.671042057326547,
"config... |
"""Abstract base classe for vCard Properties.
"""
import warnings
from abc import abstractmethod, ABCMeta
from collections.abc import Sequence
from ..param import from_string as param_from_string
from ..tools.base import CRLF
from ..tools.lexer import escape_value, split_list
__all__ = ["Prop", "StringProp", "Tuple... | {
"repo_name": "Jorispilot/pycard",
"path": "pycard/prop/base.py",
"copies": "1",
"size": "4158",
"license": "mit",
"hash": 581164346361991600,
"line_mean": 24.6666666667,
"line_max": 74,
"alpha_frac": 0.6017316017,
"autogenerated": false,
"ratio": 3.8357933579335795,
"config_test": false,
"ha... |
"""Abstract Base Classes (ABCs) for OpenAPI renderers."""
import abc
from docutils import nodes
from docutils.statemachine import ViewList
from sphinx.util.nodes import nested_parse_with_titles
class Renderer(metaclass=abc.ABCMeta):
"""Base class for OpenAPI renderers."""
def __init__(self, state, options)... | {
"repo_name": "ikalnytskyi/sphinxcontrib-openapi",
"path": "sphinxcontrib/openapi/renderers/abc.py",
"copies": "1",
"size": "1485",
"license": "bsd-2-clause",
"hash": 8178030508618738000,
"line_mean": 31.2826086957,
"line_max": 78,
"alpha_frac": 0.698989899,
"autogenerated": false,
"ratio": 4.527... |
"""Abstract base classes for common Model functionality"""
from datetime import datetime
from django.db import models
class LicensedModel(models.Model):
"""Abstract base class for models with a license"""
# Class "constants"
# For now, we don't set a default value on the field so we
# can differentiat... | {
"repo_name": "denverfoundation/storybase",
"path": "apps/storybase/models/base.py",
"copies": "1",
"size": "3931",
"license": "mit",
"hash": -4746978225511716000,
"line_mean": 29.7109375,
"line_max": 81,
"alpha_frac": 0.6291020097,
"autogenerated": false,
"ratio": 4.300875273522976,
"config_te... |
"""Abstract base classes for Kalman filtering / smoothing."""
import abc
import collections
import re
import attrdict
import numpy as np
import numpy.ma as ma
import numpy.linalg
from .. import utils
class DTFilter(metaclass=abc.ABCMeta):
"""Discrete-time Kalman filter/smoother abstract base class."""
... | {
"repo_name": "dimasad/qwfilter",
"path": "ceacoest/kalman/base.py",
"copies": "2",
"size": "5379",
"license": "mit",
"hash": 3304569071005492000,
"line_mean": 29.5625,
"line_max": 80,
"alpha_frac": 0.4995352296,
"autogenerated": false,
"ratio": 3.5598941098610193,
"config_test": false,
"has_... |
"""Abstract base classes for kernel client channels"""
# Copyright (c) IPython Development Team.
# Distributed under the terms of the Modified BSD License.
import abc
from IPython.utils.py3compat import with_metaclass
class ChannelABC(with_metaclass(abc.ABCMeta, object)):
"""A base class for all channel ABCs.... | {
"repo_name": "mattvonrocketstein/smash",
"path": "smashlib/ipy3x/kernel/channelsabc.py",
"copies": "1",
"size": "2319",
"license": "mit",
"hash": -752498456167088000,
"line_mean": 18.6525423729,
"line_max": 82,
"alpha_frac": 0.6567485985,
"autogenerated": false,
"ratio": 4.104424778761062,
"co... |
"""Abstract base classes for kernel client channels"""
#-----------------------------------------------------------------------------
# Copyright (C) 2013 The IPython Development Team
#
# Distributed under the terms of the BSD License. The full license is in
# the file COPYING, distributed as part of this softwar... | {
"repo_name": "Lightmatter/django-inlineformfield",
"path": ".tox/py27/lib/python2.7/site-packages/IPython/kernel/channelsabc.py",
"copies": "7",
"size": "2584",
"license": "mit",
"hash": 8081757743819838000,
"line_mean": 21.0854700855,
"line_max": 82,
"alpha_frac": 0.621130031,
"autogenerated": fa... |
"""Abstract base classes for kernel manager and channels."""
#-----------------------------------------------------------------------------
# Copyright (C) 2013 The IPython Development Team
#
# Distributed under the terms of the BSD License. The full license is in
# the file COPYING, distributed as part of this s... | {
"repo_name": "noslenfa/tdjangorest",
"path": "uw/lib/python2.7/site-packages/IPython/kernel/managerabc.py",
"copies": "2",
"size": "5131",
"license": "apache-2.0",
"hash": 6771036148182945000,
"line_mean": 21.8044444444,
"line_max": 82,
"alpha_frac": 0.5264081076,
"autogenerated": false,
"ratio"... |
"""Abstract base classes for laying out a 3-tier software architecture."""
import abc
class DataTier(metaclass=abc.ABCMeta):
"""Data tier - controls storage and retrieval of data."""
@abc.abstractmethod
def __init__(self, data_store):
"""
Make a new DataTier object.
`data_stor... | {
"repo_name": "jmanuel1/patterns",
"path": "threetier.py",
"copies": "1",
"size": "2223",
"license": "mit",
"hash": -4652129841094411000,
"line_mean": 27.8701298701,
"line_max": 78,
"alpha_frac": 0.5735492578,
"autogenerated": false,
"ratio": 3.969642857142857,
"config_test": false,
"has_no_k... |
"""Abstract Base classes implementing the Runner interface.
Runner Interface
----------------
All a runner needs to implement is the 'run_segment' method which
should accept a walker and a spec for the length of the segment to run
(e.g. number of dynamics steps).
Additionally, any number of optional key word argumen... | {
"repo_name": "ADicksonLab/wepy",
"path": "src/wepy/runners/runner.py",
"copies": "1",
"size": "2645",
"license": "mit",
"hash": -3784388379808332300,
"line_mean": 28.3888888889,
"line_max": 79,
"alpha_frac": 0.6415879017,
"autogenerated": false,
"ratio": 4.632224168126094,
"config_test": false... |
"""Abstract base classes."""
from functools import wraps
class BaseModule:
"""Abstract base class for API modules."""
def __init__(self, pa):
"""Construct this object."""
self.pa = pa
def _preprocess(self, args):
"""Apply common transformations to API call arguments."""
... | {
"repo_name": "antsar/piwik-api",
"path": "piwik_api/base.py",
"copies": "1",
"size": "1646",
"license": "mit",
"hash": 3787597691753938400,
"line_mean": 31.92,
"line_max": 72,
"alpha_frac": 0.5218712029,
"autogenerated": false,
"ratio": 4.534435261707989,
"config_test": false,
"has_no_keywor... |
"""Abstract base classes.
These are necessary to avoid circular imports between core.py and fields.py.
.. warning::
This module is treated as private API.
Users should not need to use this module directly.
"""
import typing
class FieldABC:
"""Abstract base class from which all Field classes inherit."""... | {
"repo_name": "marshmallow-code/marshmallow",
"path": "src/marshmallow/base.py",
"copies": "1",
"size": "1336",
"license": "mit",
"hash": 4991475370808876000,
"line_mean": 22.8571428571,
"line_max": 85,
"alpha_frac": 0.6407185629,
"autogenerated": false,
"ratio": 4.59106529209622,
"config_test"... |
"""Abstract base classes related to import."""
from . import _bootstrap
from . import _bootstrap_external
from . import machinery
try:
import _frozen_importlib
except ImportError as exc:
if exc.name != '_frozen_importlib':
raise
_frozen_importlib = None
try:
import _frozen_importlib_external
exc... | {
"repo_name": "arju88nair/projectCulminate",
"path": "venv/lib/python3.5/importlib/abc.py",
"copies": "45",
"size": "10782",
"license": "apache-2.0",
"hash": -3831667121738100000,
"line_mean": 31.7720364742,
"line_max": 86,
"alpha_frac": 0.6634205157,
"autogenerated": false,
"ratio": 4.7041884816... |
"""Abstract base classes related to import."""
from . import _bootstrap
from . import machinery
from . import util
import abc
import imp
import io
import marshal
import os.path
import sys
import tokenize
import types
import warnings
class Loader(metaclass=abc.ABCMeta):
"""Abstract base class for import loaders."... | {
"repo_name": "zhouzhenghui/python-for-android",
"path": "python3-alpha/python3-src/Lib/importlib/abc.py",
"copies": "51",
"size": "10725",
"license": "apache-2.0",
"hash": 7020576731029976000,
"line_mean": 34.2796052632,
"line_max": 80,
"alpha_frac": 0.6335664336,
"autogenerated": false,
"ratio"... |
"""Abstract base classes related to import."""
from . import _fileloader2
from . import _bootstrap
from . import _bootstrap_external
from . import machinery
import abc
try:
from importlib.abc import _register
except ImportError:
# backporting _register (without caring about builtin or frozen modules)
def... | {
"repo_name": "asmodehn/filefinder2",
"path": "filefinder2/abc.py",
"copies": "1",
"size": "11794",
"license": "mit",
"hash": -7280925315490510000,
"line_mean": 33.6882352941,
"line_max": 84,
"alpha_frac": 0.6223503476,
"autogenerated": false,
"ratio": 5.05746140651801,
"config_test": false,
... |
"""Abstract base classes. Unfortuntaely, these are mostly useless indirections
since TIDAL is now the only supported back-end."""
from abc import ABC, abstractmethod
from typing import List, NamedTuple, Optional, Tuple, Type, Union
class ManiaException(Exception):
"""Base exception class for setting an exit code... | {
"repo_name": "evan-goode/mania",
"path": "mania/models.py",
"copies": "1",
"size": "2963",
"license": "unlicense",
"hash": -3692694958175431000,
"line_mean": 23.6916666667,
"line_max": 83,
"alpha_frac": 0.6277421532,
"autogenerated": false,
"ratio": 3.7458912768647283,
"config_test": false,
... |
"""Abstract baseclass for all distributions."""
import logging
import numpy
import chaospy
from .utils import check_dependencies
class Distribution(object):
"""Baseclass for all probability distributions."""
__array_priority__ = 9000
"""Numpy override variable."""
interpret_as_integer = False
... | {
"repo_name": "jonathf/chaospy",
"path": "chaospy/distributions/baseclass/distribution.py",
"copies": "1",
"size": "32809",
"license": "mit",
"hash": -3351955622615232500,
"line_mean": 37.7355371901,
"line_max": 102,
"alpha_frac": 0.5473498126,
"autogenerated": false,
"ratio": 4.1525123402101,
... |
"""Abstract base class for all rendering contexts
OpenGL operates with the idea of a current context
in which OpenGL calls will operate. This is something
a little bit more than a "window", as it includes
a number of (optional) off-screen buffers, and
a great deal of state which is manipulated by the
various OpenGL f... | {
"repo_name": "alexus37/AugmentedRealityChess",
"path": "pythonAnimations/pyOpenGLChess/engineDirectory/oglc-env/lib/python2.7/site-packages/OpenGLContext/context.py",
"copies": "1",
"size": "35588",
"license": "mit",
"hash": -4316208307248437000,
"line_mean": 37.0213675214,
"line_max": 131,
"alpha_f... |
"""Abstract base class for Decision classes.
See the NoDecision class and others in this module for examples.
To create your own subclass of the Decision class you must customize
the following class constants:
- ENUM
- FIELDS
- SHAPES
- DTYPE
- RECORD_FIELDS
The 'ENUM' field should be a python 'Enum' class created ... | {
"repo_name": "ADicksonLab/wepy",
"path": "src/wepy/resampling/decisions/decision.py",
"copies": "1",
"size": "9590",
"license": "mit",
"hash": 6532357942551243000,
"line_mean": 28.0606060606,
"line_max": 94,
"alpha_frac": 0.6256517205,
"autogenerated": false,
"ratio": 4.493908153701968,
"confi... |
"""Abstract base class for detectors.
"""
# standard imports
from typing import Union, Tuple, List, Any
import logging
# third party imports
import numpy as np
# toolbox imports
from ..base.data import Data
from ..base.meta import Metadata
from ..base.image import Image, Imagelike
from .tool import Tool
from .image i... | {
"repo_name": "Petr-By/qtpyvis",
"path": "dltb/tool/detector.py",
"copies": "1",
"size": "15187",
"license": "mit",
"hash": -3912227552129732600,
"line_mean": 35.7723970944,
"line_max": 78,
"alpha_frac": 0.5916902614,
"autogenerated": false,
"ratio": 4.416109334108753,
"config_test": false,
"... |
"""Abstract base class for implementing xml enum types."""
# ***** BEGIN LICENSE BLOCK *****
#
# Copyright (c) 2007-2012, Python File Format Interface
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are... | {
"repo_name": "griest024/PokyrimTools",
"path": "pyffi-develop/pyffi/object_models/xml/enum.py",
"copies": "1",
"size": "6158",
"license": "mit",
"hash": -4735618094553145000,
"line_mean": 34.5953757225,
"line_max": 75,
"alpha_frac": 0.6131860994,
"autogenerated": false,
"ratio": 4.31232492997198... |
"""Abstract base class for kernel clients"""
#-----------------------------------------------------------------------------
# Copyright (C) 2013 The IPython Development Team
#
# Distributed under the terms of the BSD License. The full license is in
# the file COPYING, distributed as part of this software.
#------... | {
"repo_name": "noslenfa/tdjangorest",
"path": "uw/lib/python2.7/site-packages/IPython/kernel/clientabc.py",
"copies": "2",
"size": "2081",
"license": "apache-2.0",
"hash": 3791017616693626000,
"line_mean": 24.6913580247,
"line_max": 79,
"alpha_frac": 0.4574723691,
"autogenerated": false,
"ratio":... |
"""Abstract base class for kernel clients"""
#-----------------------------------------------------------------------------
# Copyright (c) The Jupyter Development Team
#
# Distributed under the terms of the BSD License. The full license is in
# the file COPYING, distributed as part of this software.
#------------... | {
"repo_name": "sserrot/champion_relationships",
"path": "venv/Lib/site-packages/jupyter_client/clientabc.py",
"copies": "1",
"size": "2261",
"license": "mit",
"hash": 6259654574437254000,
"line_mean": 24.6931818182,
"line_max": 88,
"alpha_frac": 0.4781070323,
"autogenerated": false,
"ratio": 5.35... |
"""Abstract base class for kernel managers."""
#-----------------------------------------------------------------------------
# Copyright (C) 2013 The IPython Development Team
#
# Distributed under the terms of the BSD License. The full license is in
# the file COPYING, distributed as part of this software.
#----... | {
"repo_name": "omni5cience/django-inlineformfield",
"path": ".tox/py27/lib/python2.7/site-packages/IPython/kernel/managerabc.py",
"copies": "7",
"size": "2469",
"license": "mit",
"hash": 8951397862977182000,
"line_mean": 22.5142857143,
"line_max": 79,
"alpha_frac": 0.5236938032,
"autogenerated": fa... |
""" Abstract base class for overlays.
This class is primarily used so that tools can easily distinguish between
items underneath them.
"""
from traits.api import Instance
from component import Component
class AbstractOverlay(Component):
""" The base class for overlays and underlays of the area.
The only d... | {
"repo_name": "tommy-u/enable",
"path": "enable/abstract_overlay.py",
"copies": "1",
"size": "3341",
"license": "bsd-3-clause",
"hash": 7006842886356784000,
"line_mean": 34.9247311828,
"line_max": 79,
"alpha_frac": 0.5899431308,
"autogenerated": false,
"ratio": 4.927728613569322,
"config_test":... |
""" Abstract base class for plot decorators and overlays.
This class is primarily used so that tools can easily distinguish between
data-related plot items and the decorators on them.
"""
from enable.api import Component
from traits.api import Instance
from plot_component import PlotComponent
class AbstractOverlay... | {
"repo_name": "tommy-u/chaco",
"path": "chaco/abstract_overlay.py",
"copies": "3",
"size": "2206",
"license": "bsd-3-clause",
"hash": 4129242830442214000,
"line_mean": 33.46875,
"line_max": 79,
"alpha_frac": 0.6745240254,
"autogenerated": false,
"ratio": 4.492871690427698,
"config_test": false,... |
"""Abstract base class for programs.
"""
from __future__ import print_function
import os
from . import limit
import resource
import signal
import logging
from .errors import ProgramError
class Program(object):
"""Abstract base class for programs.
"""
runtime = 0
def run(self, infile='/dev/null', outf... | {
"repo_name": "jsannemo/problemtools",
"path": "problemtools/run/program.py",
"copies": "2",
"size": "4942",
"license": "mit",
"hash": 1130476951228096400,
"line_mean": 38.8548387097,
"line_max": 99,
"alpha_frac": 0.5621205989,
"autogenerated": false,
"ratio": 4.238421955403087,
"config_test": ... |
"""Abstract base class for programs.
"""
from __future__ import print_function
import os
import limit
import resource
import signal
import logging
from .errors import ProgramError
class Program(object):
"""Abstract base class for programs.
"""
runtime = 0
def run(self, infile='/dev/null', outfile='/d... | {
"repo_name": "godmar/problemtools",
"path": "problemtools/run/program.py",
"copies": "1",
"size": "3684",
"license": "mit",
"hash": -2451829991607740000,
"line_mean": 35.84,
"line_max": 99,
"alpha_frac": 0.5529315961,
"autogenerated": false,
"ratio": 4.111607142857143,
"config_test": false,
... |
"""Abstract base class for programs.
"""
import os
from . import limit
import resource
import signal
import logging
from .errors import ProgramError
class Program(object):
"""Abstract base class for programs.
"""
runtime = 0
def run(self, infile='/dev/null', outfile='/dev/null', errfile='/dev/null',
... | {
"repo_name": "Kattis/problemtools",
"path": "problemtools/run/program.py",
"copies": "1",
"size": "4904",
"license": "mit",
"hash": -2100037343985076700,
"line_mean": 38.8699186992,
"line_max": 99,
"alpha_frac": 0.5605628059,
"autogenerated": false,
"ratio": 4.238547968885047,
"config_test": f... |
"""Abstract base class for resources.
"""
# FIXME[old/todo]: there are at least 3 different Installable classes
# -> combine them into someting useful
# standard imports
from abc import ABC, abstractmethod
import os
import sys
import time
import importlib
import logging
# toolbox imports
from .busy import BusyObserv... | {
"repo_name": "Petr-By/qtpyvis",
"path": "dltb/base/install.py",
"copies": "1",
"size": "4913",
"license": "mit",
"hash": -4117381987821258000,
"line_mean": 31.9731543624,
"line_max": 78,
"alpha_frac": 0.5556686342,
"autogenerated": false,
"ratio": 4.788499025341131,
"config_test": false,
"ha... |
''' Abstract base class for subcommands that output to a file (or stdout).
'''
from __future__ import absolute_import
from abc import abstractmethod
import argparse
import io
from bokeh.util.string import decode_utf8
from ..subcommand import Subcommand
from ..util import build_single_handler_applications, die
clas... | {
"repo_name": "Karel-van-de-Plassche/bokeh",
"path": "bokeh/command/subcommands/file_output.py",
"copies": "6",
"size": "4118",
"license": "bsd-3-clause",
"hash": 3638523416311359500,
"line_mean": 26.4533333333,
"line_max": 101,
"alpha_frac": 0.5383681399,
"autogenerated": false,
"ratio": 4.64261... |
"""Abstract base class for tools.
"""
# standard imports
from typing import Any, Union, Tuple, Iterator
import time
import logging
from threading import Event
# third party imports
# toolbox imports
from ..base.data import Datalike
from ..base.register import RegisterClass
from ..base.prepare import Preparable
from ... | {
"repo_name": "Petr-By/qtpyvis",
"path": "dltb/tool/tool.py",
"copies": "1",
"size": "19427",
"license": "mit",
"hash": -877440637735791200,
"line_mean": 35.7240075614,
"line_max": 79,
"alpha_frac": 0.5772378648,
"autogenerated": false,
"ratio": 4.580759254892714,
"config_test": false,
"has_n... |
"""Abstract base class for tools working on images.
"""
# standard imports
from typing import Tuple
from threading import Thread
import logging
# third party imports
import numpy as np
# toolbox imports
from .tool import Tool
from ..base.data import Data
from ..base.image import Image, Imagelike, ImageGenerator
fro... | {
"repo_name": "Petr-By/qtpyvis",
"path": "dltb/tool/image.py",
"copies": "1",
"size": "11834",
"license": "mit",
"hash": -2509120092226646500,
"line_mean": 32.0558659218,
"line_max": 78,
"alpha_frac": 0.5562785195,
"autogenerated": false,
"ratio": 4.171307719421924,
"config_test": false,
"has... |
# Abstract Base Class from which other classes will inherit. Handles input
from abc import abstractmethod
import abc
class Sort:
def __init__(self):
self.array = []
def main(self):
"""
handles the main logic
:return:
"""
input_array = self.handle_input()
... | {
"repo_name": "tchitchikov/data_structures_and_algorithms",
"path": "sorting/base_class.py",
"copies": "1",
"size": "1282",
"license": "apache-2.0",
"hash": -2380139826011794400,
"line_mean": 28.8139534884,
"line_max": 77,
"alpha_frac": 0.5538221529,
"autogenerated": false,
"ratio": 4.81954887218... |
"""Abstract base class :py:class:`Metadata` for different kind of metadata.
"""
# standard imports
import os
# Generic imports
import numpy as np
# toolbox imports
from .image import Region
class Metadata:
"""Metadata for a datum from a Datasource.
"""
_regions = None
def __init__(self, descriptio... | {
"repo_name": "Petr-By/qtpyvis",
"path": "dltb/base/meta.py",
"copies": "1",
"size": "3303",
"license": "mit",
"hash": 5367941384248945000,
"line_mean": 28.2300884956,
"line_max": 76,
"alpha_frac": 0.565849228,
"autogenerated": false,
"ratio": 4.451482479784366,
"config_test": false,
"has_no_... |
"""Abstract base for implementing voting subsystems"""
from django.db import models
from django.db.models import Sum, Count, QuerySet, ObjectDoesNotExist, F, Q
from django.utils.translation import ugettext as __
from collective_blog import settings
from collective_blog.utils.errors import PermissionCheckFailed
clas... | {
"repo_name": "AmatanHead/collective-blog",
"path": "s_voting/models.py",
"copies": "1",
"size": "4193",
"license": "mit",
"hash": -5912701660011295000,
"line_mean": 28.5281690141,
"line_max": 80,
"alpha_frac": 0.5816837586,
"autogenerated": false,
"ratio": 4.031730769230769,
"config_test": fal... |
"""Abstract base interface for vehicle data sources."""
import threading
import logging
import string
import sys
import datetime
from openxc.formats.binary import ProtobufStreamer, ProtobufFormatter
from openxc.formats.json import JsonStreamer, JsonFormatter
LOG = logging.getLogger(__name__)
class MissingPayloadFo... | {
"repo_name": "openxc/openxc-python",
"path": "openxc/sources/base.py",
"copies": "1",
"size": "8038",
"license": "bsd-3-clause",
"hash": 8993140826312894000,
"line_mean": 32.3526970954,
"line_max": 83,
"alpha_frac": 0.5879572033,
"autogenerated": false,
"ratio": 4.638199653779573,
"config_test... |
"""Abstract base model class(es)."""
from peanuts.lib.database import db
__all__ = ['Model']
class Model(db.Model):
"""A base model class."""
__abstract__ = True
def get_dictionary(self, verbosity='all'):
"""Returns a JSON-serializable dictionary representation of the model.
This... | {
"repo_name": "astex/peanuts",
"path": "peanuts/models/base.py",
"copies": "1",
"size": "1144",
"license": "mit",
"hash": 6928335613869487000,
"line_mean": 34.75,
"line_max": 78,
"alpha_frac": 0.5865384615,
"autogenerated": false,
"ratio": 4.612903225806452,
"config_test": false,
"has_no_keyw... |
"""Abstract base model."""
from datetime import datetime
from pma_api.config import IGNORE_FIELD_PREFIX
from pma_api.models import db
from pma_api.models.string import EnglishString
def prune_ignored_fields(kwargs):
"""Prune ignored fields.
Args:
kwargs (dict): Keyword arguments.
"""
to_pop ... | {
"repo_name": "joeflack4/pma-api",
"path": "pma_api/models/api_base.py",
"copies": "1",
"size": "5645",
"license": "mit",
"hash": 1016285649859986700,
"line_mean": 32.8023952096,
"line_max": 79,
"alpha_frac": 0.5828166519,
"autogenerated": false,
"ratio": 4.379363847944143,
"config_test": false... |
"""Abstract base models used by the page management application."""
from __future__ import unicode_literals
from django.db import models
from django.shortcuts import render
from django.utils.encoding import python_2_unicode_compatible
from cms import externals
from cms.apps.media.models import ImageRefField
from cms.... | {
"repo_name": "danielsamuels/cms",
"path": "cms/models/base.py",
"copies": "1",
"size": "9777",
"license": "bsd-3-clause",
"hash": 4971717417932243000,
"line_mean": 29.0830769231,
"line_max": 111,
"alpha_frac": 0.5911833896,
"autogenerated": false,
"ratio": 4.378414688759516,
"config_test": fal... |
"""Abstract base models used by the page management application."""
from __future__ import unicode_literals
import six
from django.db import models
from django.shortcuts import render
from django.utils.encoding import python_2_unicode_compatible
from cms import externals
from cms.apps.media.models import ImageRefFiel... | {
"repo_name": "dan-gamble/cms",
"path": "cms/models/base.py",
"copies": "1",
"size": "9646",
"license": "bsd-3-clause",
"hash": 2837676956618484000,
"line_mean": 28.8637770898,
"line_max": 111,
"alpha_frac": 0.5922662243,
"autogenerated": false,
"ratio": 4.352888086642599,
"config_test": false,... |
"""Abstract base models used by the page management application."""
from django.db import models
from django.shortcuts import render
from cms import externals
from cms.models.managers import OnlineBaseManager, PublishedBaseManager, SearchMetaBaseManager, PageBaseManager
class PublishedBase(models.Model):
"... | {
"repo_name": "etianen/cms",
"path": "src/cms/models/base.py",
"copies": "2",
"size": "7140",
"license": "bsd-3-clause",
"hash": -7901820232362612000,
"line_mean": 27.4501992032,
"line_max": 111,
"alpha_frac": 0.5703081232,
"autogenerated": false,
"ratio": 4.547770700636943,
"config_test": fals... |
"""AbstractBot"""
import random
import re
# encoding=utf8
class AbstractBot(object):
"""Generic bot"""
def __init__(self, trigger_word, provider, auto_feed, meme_provider, join_every):
#Setup class props
self.chat_count = {}
self.participation_frequency = 5
self.trigger_word =... | {
"repo_name": "kblok/TelegramBotFriend",
"path": "abstract_bot.py",
"copies": "1",
"size": "1767",
"license": "mit",
"hash": -2740950448365965000,
"line_mean": 31.7222222222,
"line_max": 85,
"alpha_frac": 0.5664968874,
"autogenerated": false,
"ratio": 3.8580786026200875,
"config_test": false,
... |
"""Abstract boto-based datastore.
The boto_ library provides interfaces to both Amazon S3 and Google Storage
for Developers. This abstract base class gets most of the common work done.
.. note::
**Installation**: Use of this module requires the open source boto_
package.
.. _boto: http://code.google.com/p/bo... | {
"repo_name": "lantip/aws-filemanager",
"path": "cloud_browser/cloud/boto_base.py",
"copies": "1",
"size": "20265",
"license": "mit",
"hash": 2009144989407026000,
"line_mean": 35.3824057451,
"line_max": 79,
"alpha_frac": 0.5843079201,
"autogenerated": false,
"ratio": 4.312619706320493,
"config_... |
# Abstract Building
class Pizza:
def __init__(self, inches):
self.ingredients = ["salsa de tomate", "queso"]
self.inches = inches
def __str__(self):
message = f'Mi pizza es de {self.inches}" con los siguientes ingredientes: ' + ', '.join(self.ingredients)
# Replace the last comma with "y"
last_c... | {
"repo_name": "AnhellO/DAS_Sistemas",
"path": "Ago-Dic-2020/rodriguez-martinez-jesus-angel/primer-parcial/builder.py",
"copies": "1",
"size": "1125",
"license": "mit",
"hash": 5899140755982430000,
"line_mean": 31.1142857143,
"line_max": 110,
"alpha_frac": 0.6500445236,
"autogenerated": false,
"ra... |
"""Abstract class-based views"""
import json
from django.contrib.auth import get_user_model
from django.http import HttpResponse
from django.utils.decorators import method_decorator
from django.views.decorators.csrf import csrf_protect
from django.views.generic import View
from django.utils.translation import ugettext... | {
"repo_name": "AmatanHead/collective-blog",
"path": "s_voting/views.py",
"copies": "1",
"size": "1760",
"license": "mit",
"hash": -5200476928130725000,
"line_mean": 34.2,
"line_max": 79,
"alpha_frac": 0.6647727273,
"autogenerated": false,
"ratio": 4.200477326968974,
"config_test": false,
"has... |
"""Abstract class defining cache of e-mail messages."""
import abc
import typing as t
from .message import Message
from .folder import Folder
class EmailCache(metaclass=abc.ABCMeta):
"""An object that stores e-mail messages."""
def __init__(self):
self.folders = {} # type: t.Dict[str, Folder]
... | {
"repo_name": "mbdevpl/maildaemon",
"path": "maildaemon/email_cache.py",
"copies": "1",
"size": "1234",
"license": "apache-2.0",
"hash": -841956538512507100,
"line_mean": 27.6976744186,
"line_max": 97,
"alpha_frac": 0.6061588331,
"autogenerated": false,
"ratio": 3.7737003058103977,
"config_test... |
"""Abstract classes and utility operations for building graph representations and
data loaders (known as Sequence objects in Keras).
Most users will not need to interact with this module."""
from abc import abstractmethod
from inspect import signature
from operator import itemgetter
from typing import Union, Dict, List... | {
"repo_name": "materialsvirtuallab/megnet",
"path": "megnet/data/graph.py",
"copies": "1",
"size": "24856",
"license": "bsd-3-clause",
"hash": -2417267303900003000,
"line_mean": 36.153961136,
"line_max": 116,
"alpha_frac": 0.6013035082,
"autogenerated": false,
"ratio": 4.275197798417612,
"confi... |
"""Abstract classes."""
from __future__ import absolute_import, unicode_literals
import abc
from collections import Callable
from .five import with_metaclass
__all__ = ['Thenable']
@with_metaclass(abc.ABCMeta)
class Thenable(Callable): # pragma: no cover
"""Object that supports ``.then()``."""
__slots__... | {
"repo_name": "ammarkhann/FinalSeniorCode",
"path": "lib/python2.7/site-packages/vine/abstract.py",
"copies": "3",
"size": "1723",
"license": "mit",
"hash": -9199506627753413000,
"line_mean": 22.2837837838,
"line_max": 74,
"alpha_frac": 0.6204294835,
"autogenerated": false,
"ratio": 3.94279176201... |
"""Abstract classes."""
from __future__ import absolute_import, unicode_literals
import abc
from .five import with_metaclass, Callable
__all__ = ['Thenable']
@with_metaclass(abc.ABCMeta)
class Thenable(Callable): # pragma: no cover
"""Object that supports ``.then()``."""
__slots__ = ()
@abc.abstract... | {
"repo_name": "cloudera/hue",
"path": "desktop/core/ext-py/vine-1.2.0/vine/abstract.py",
"copies": "3",
"size": "1699",
"license": "apache-2.0",
"hash": 6656787850085339000,
"line_mean": 22.5972222222,
"line_max": 74,
"alpha_frac": 0.6168334314,
"autogenerated": false,
"ratio": 3.92378752886836,
... |
"""Abstract classes."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
import copy
import yaml
import random
import subprocess
import numpy as np
import tensorflow as tf
from tensorflow.contrib.tensorboard.plugins import projector
from tensorflo... | {
"repo_name": "mckinziebrandon/DeepChatModels",
"path": "chatbot/_models.py",
"copies": "1",
"size": "15359",
"license": "mit",
"hash": -7475259770316069000,
"line_mean": 42.143258427,
"line_max": 101,
"alpha_frac": 0.6091542418,
"autogenerated": false,
"ratio": 4.138776610078146,
"config_test"... |
# Abstract classes.
class Event(object):
def __init__(self, start_mark=None, end_mark=None):
self.start_mark = start_mark
self.end_mark = end_mark
def __repr__(self):
attributes = [key for key in ['implicit', 'value']
if hasattr(self, key)]
arguments = ', '.join(['%s=%r' % (key, getattr(self, key))
... | {
"repo_name": "keelerm84/powerline",
"path": "powerline/lint/markedjson/events.py",
"copies": "3",
"size": "2044",
"license": "mit",
"hash": 8992677476957434000,
"line_mean": 20.0721649485,
"line_max": 67,
"alpha_frac": 0.7025440313,
"autogenerated": false,
"ratio": 3.0553064275037367,
"config_... |
"""Abstract classes representing UI toolkit elements."""
from abc import ABC, abstractmethod, abstractproperty
class UIWindow(ABC):
"""Class representing a window in the user interface toolkit."""
def __init__(self, ui, line, column, n_lines, n_columns):
"""Initialize an UIWindow object.
Ar... | {
"repo_name": "AndreaOrru/Yugen",
"path": "ui.py",
"copies": "1",
"size": "3511",
"license": "bsd-2-clause",
"hash": 434861101148135500,
"line_mean": 25.2014925373,
"line_max": 77,
"alpha_frac": 0.5736257477,
"autogenerated": false,
"ratio": 4.706434316353888,
"config_test": false,
"has_no_ke... |
"""Abstract class for autoregressive decoding.
Either for the recurrent decoder, or for the transformer decoder.
The autoregressive decoder uses the while loop to get the outputs.
Descendants should only specify the initial state and the while loop body.
"""
from typing import (
NamedTuple, Callable, Tuple, cast,... | {
"repo_name": "juliakreutzer/bandit-neuralmonkey",
"path": "neuralmonkey/decoders/autoregressive.py",
"copies": "1",
"size": "16671",
"license": "bsd-3-clause",
"hash": 2624161640536853500,
"line_mean": 37.324137931,
"line_max": 79,
"alpha_frac": 0.6065023094,
"autogenerated": false,
"ratio": 4.1... |
"""Abstract class for collective groups."""
from abc import ABCMeta
from abc import abstractmethod
from ray.util.collective.types import AllReduceOptions, BarrierOptions, \
ReduceOptions, AllGatherOptions, BroadcastOptions, ReduceScatterOptions
class BaseGroup(metaclass=ABCMeta):
def __init__(self, world_siz... | {
"repo_name": "ray-project/ray",
"path": "python/ray/util/collective/collective_group/base_collective_group.py",
"copies": "1",
"size": "2378",
"license": "apache-2.0",
"hash": 954405815908585200,
"line_mean": 28,
"line_max": 75,
"alpha_frac": 0.6291000841,
"autogenerated": false,
"ratio": 4.9541... |
# abstract class for physical objects in POR
import math
import pyglet
import settings
from collections import namedtuple
from utils import Point, Vec2d, point_in_rect
class Entity(pyglet.sprite.Sprite):
# just set this to the settings image value in the subclass.
IMAGE = None
name = None
def __init... | {
"repo_name": "rozifus/TeamStrong13_4",
"path": "por/entity.py",
"copies": "1",
"size": "2793",
"license": "mit",
"hash": 1651773766294494000,
"line_mean": 30.0333333333,
"line_max": 91,
"alpha_frac": 0.589688507,
"autogenerated": false,
"ratio": 3.754032258064516,
"config_test": false,
"has_... |
"""Abstract class for writing chat clients."""
import aiohttp
import asyncio
import collections
import itertools
import json
import logging
import random
import re
import time
import datetime
import os
from hangups import (javascript, parsers, exceptions, http_utils, channel,
event, schemas)
log... | {
"repo_name": "j16sdiz/hangups",
"path": "hangups/client.py",
"copies": "1",
"size": "32734",
"license": "mit",
"hash": 7052772239694569000,
"line_mean": 37.1960326721,
"line_max": 80,
"alpha_frac": 0.5542249649,
"autogenerated": false,
"ratio": 4.503232906864768,
"config_test": false,
"has_n... |
"""Abstract class for writing chat clients."""
import aiohttp
import asyncio
import json
import logging
import random
import time
import datetime
import os
from hangups import (javascript, parsers, exceptions, http_utils, channel,
event, hangouts_pb2, pblite, __version__)
logger = logging.getLog... | {
"repo_name": "AshenDrops/hangups",
"path": "hangups/client.py",
"copies": "3",
"size": "33048",
"license": "mit",
"hash": -212136493430848320,
"line_mean": 39.6995073892,
"line_max": 79,
"alpha_frac": 0.5912914549,
"autogenerated": false,
"ratio": 4.459919028340081,
"config_test": false,
"ha... |
"""Abstract class for writing chat clients."""
import asyncio
import base64
import binascii
import collections
import json
import logging
import os
import random
import time
import google.protobuf.message
from hangups import (exceptions, http_utils, channel, event, hangouts_pb2,
pblite, version)... | {
"repo_name": "tdryer/hangups",
"path": "hangups/client.py",
"copies": "2",
"size": "28753",
"license": "mit",
"hash": 2540699604365556700,
"line_mean": 40.4906204906,
"line_max": 79,
"alpha_frac": 0.5820610023,
"autogenerated": false,
"ratio": 4.684424894102314,
"config_test": false,
"has_no... |
# Abstract class that provides functionality for the various exchange classes
import logging
import time
import pickle
import yaml
from os.path import isfile
from gi.repository import GLib
from error import Error
from downloader import DownloadCommand
CURRENCY = {
'usd': '$',
'eur': '€',
'btc': 'B',
... | {
"repo_name": "nilgradisnik/coinprice-indicator",
"path": "coin/exchange.py",
"copies": "1",
"size": "10003",
"license": "mit",
"hash": -2242239406417129500,
"line_mean": 29.006006006,
"line_max": 101,
"alpha_frac": 0.5870696557,
"autogenerated": false,
"ratio": 4.1001231021748055,
"config_test... |
//Abstract class that represents a connection to another computer
//TODO: Packet ordering
//Acks
//RTT
//Packet throttling
//We have 464 bits for UDP
//398 bits after our protocol headers
class Connection(object):
def __init__(self, ip, port, idhash=0):
self.ip = id
self.port = port
self.... | {
"repo_name": "croxis/Panda-Core-Technology",
"path": "LoginServer/connection.py",
"copies": "1",
"size": "1441",
"license": "mit",
"hash": -5264834068007468000,
"line_mean": 31.0444444444,
"line_max": 102,
"alpha_frac": 0.6405274115,
"autogenerated": false,
"ratio": 3.792105263157895,
"config_... |
"""Abstract collection for experiment and integration of all experiment types."""
import itertools
import re
from snovault import (
abstract_collection,
calculated_property,
collection,
load_schema
)
from snovault.validators import (
validate_item_content_post,
validate_item_content_put,
v... | {
"repo_name": "hms-dbmi/fourfront",
"path": "src/encoded/types/experiment.py",
"copies": "2",
"size": "43569",
"license": "mit",
"hash": 4173908480317674500,
"line_mean": 38.5004533092,
"line_max": 138,
"alpha_frac": 0.6191099176,
"autogenerated": false,
"ratio": 3.9078841151672794,
"config_tes... |
"""Abstract definition of database connections"""
import functools
import pathlib
@functools.lru_cache(maxsize=None)
def db(alias):
"""Returns a database configuration by alias"""
from . import config
databases = config.databases()
if alias not in databases:
raise KeyError(f'database alias "{... | {
"repo_name": "mara/mara-db",
"path": "mara_db/dbs.py",
"copies": "1",
"size": "5021",
"license": "mit",
"hash": -1206131181235530200,
"line_mean": 37.9224806202,
"line_max": 144,
"alpha_frac": 0.6122286397,
"autogenerated": false,
"ratio": 4.013589128697042,
"config_test": false,
"has_no_key... |
# Abstract Duck class with subclasses
from .fly_behaviours import FlyNoWay, FlyWithWings
from .quack_behaviours import Quack
# Abstract Duck class
class Duck:
def __init__(self):
self.quack_behaviour = None
self.fly_behaviour = None
def perform_quack(self):
self.quack_behaviour.... | {
"repo_name": "ajbrzoz/Head-First-Design-Patterns",
"path": "strategy/ducks.py",
"copies": "1",
"size": "1086",
"license": "mit",
"hash": 3818985126727487000,
"line_mean": 22.1063829787,
"line_max": 50,
"alpha_frac": 0.6040515654,
"autogenerated": false,
"ratio": 3.2612612612612613,
"config_tes... |
"""Abstract factory example."""
import abc
import argparse
from patterns.abstractf import AbstractFactory
class Greeting(metaclass=abc.ABCMeta):
"""Abstract greeting class."""
def __init__(self):
"""Make a Greeting object."""
pass
@abc.abstractmethod
def greet(self):
"""Pr... | {
"repo_name": "jmanuel1/patterns",
"path": "examples/abstractf.py",
"copies": "1",
"size": "1205",
"license": "mit",
"hash": 4728653018725022000,
"line_mean": 20.9090909091,
"line_max": 68,
"alpha_frac": 0.6423236515,
"autogenerated": false,
"ratio": 4.043624161073826,
"config_test": false,
"... |
"""`AbstractFactory` providers example."""
import abc
import dataclasses
import random
from typing import List
from dependency_injector import containers, providers
class AbstractCacheClient(metaclass=abc.ABCMeta):
...
@dataclasses.dataclass
class RedisCacheClient(AbstractCacheClient):
host: str
port:... | {
"repo_name": "ets-labs/python-dependency-injector",
"path": "examples/providers/abstract_factory.py",
"copies": "2",
"size": "1880",
"license": "bsd-3-clause",
"hash": -9022913677638524000,
"line_mean": 22.7974683544,
"line_max": 76,
"alpha_frac": 0.6234042553,
"autogenerated": false,
"ratio": 4... |
"""`AbstractFactory` providers example."""
import cache
import dependency_injector.providers as providers
# Define abstract cache client factory:
cache_client_factory = providers.AbstractFactory(cache.AbstractCacheClient)
if __name__ == '__main__':
# Override abstract factory with redis client factory:
cac... | {
"repo_name": "rmk135/dependency_injector",
"path": "examples/providers/abstract_factory/example.py",
"copies": "2",
"size": "1032",
"license": "bsd-3-clause",
"hash": -2189781245469923800,
"line_mean": 27.6666666667,
"line_max": 75,
"alpha_frac": 0.6346899225,
"autogenerated": false,
"ratio": 3.... |
# Abstract - Genetic Algorithm Learning
# Problem statement: Given a sequence of numbers of length n generate the best
# candidate sequence whose sum is equal to X
# # terms in genetic algorithm
# * Individual or Candidate : Each suggested solution for a genetic algorithm is referred to as individual.In our current pr... | {
"repo_name": "creativcoder/AlgorithmicProblems",
"path": "Python/genetic.py",
"copies": "1",
"size": "2003",
"license": "mit",
"hash": 2564486660046518000,
"line_mean": 23.4268292683,
"line_max": 168,
"alpha_frac": 0.7224163754,
"autogenerated": false,
"ratio": 3.179365079365079,
"config_test"... |
"""Abstract graphs in ReGraph.
This module contains abstract classes for graph objects in ReGraph. Such
graph objects represent simple graphs with dictionary-like attributes
on nodes and edges.
"""
import json
import os
import warnings
from abc import ABC, abstractmethod
from regraph.exceptions import (ReGraphError... | {
"repo_name": "Kappa-Dev/ReGraph",
"path": "regraph/graphs.py",
"copies": "1",
"size": "33284",
"license": "mit",
"hash": 3002577695356826600,
"line_mean": 30.4891201514,
"line_max": 91,
"alpha_frac": 0.4856988343,
"autogenerated": false,
"ratio": 4.416080668701075,
"config_test": false,
"has... |
"""Abstract grid representations."""
from pygame import Rect
class Grid (object):
"""A representation of a 2D grid of rectangular integer-sized tiles.
Used for aligning mouse input, graphics, etc. on a grid.
Grid(ntiles, tile_size, gap = 0)
:arg ntiles: ``(x, y)`` number of tiles in the grid, or a single numb... | {
"repo_name": "ikn/pygame-template",
"path": "game/engine/util/grid.py",
"copies": "1",
"size": "11655",
"license": "bsd-3-clause",
"hash": 5091474990720968000,
"line_mean": 31.9237288136,
"line_max": 79,
"alpha_frac": 0.5516087516,
"autogenerated": false,
"ratio": 3.6929657794676807,
"config_t... |
"""Abstract Hacker News Item
Author: Rylan Santinon
"""
from abc import ABCMeta, abstractmethod
#pylint: disable=abstract-class-not-used
class HnItem(object):
"""Abstract item"""
__metaclass__ = ABCMeta
@abstractmethod
def get_schema(self):
"""Return the item's schema"""
pass
de... | {
"repo_name": "davande/hackernews-top",
"path": "hnapi/items/hnitem.py",
"copies": "1",
"size": "1562",
"license": "apache-2.0",
"hash": 3949960647015661000,
"line_mean": 23.7936507937,
"line_max": 69,
"alpha_frac": 0.528809219,
"autogenerated": false,
"ratio": 4.233062330623306,
"config_test":... |
"""Abstract Handler with helper methods."""
from clang.cindex import CursorKind, TypeKind
from ctypeslib.codegen import typedesc
from ctypeslib.codegen.util import log_entity
import logging
log = logging.getLogger('handler')
# DEBUG
import code
class CursorKindException(TypeError):
"""When a child node of a ... | {
"repo_name": "luzfcb/ctypeslib",
"path": "ctypeslib/codegen/handler.py",
"copies": "1",
"size": "6508",
"license": "mit",
"hash": 3872297691283285500,
"line_mean": 33.6170212766,
"line_max": 80,
"alpha_frac": 0.5766748617,
"autogenerated": false,
"ratio": 4.0447482908638905,
"config_test": fal... |
"""Abstract handling of git repositories."""
# Python 2 compatability imports
try:
from pathlib import Path
except ImportError:
from pathlib2 import Path
try:
from urllib.parse import urlparse
except ImportError:
from urlparse import urlparse
import collections
import hashlib
import os
import shutil... | {
"repo_name": "jpaidoussi/columbia-git",
"path": "columbia/git.py",
"copies": "1",
"size": "10191",
"license": "cc0-1.0",
"hash": 7706432021325047000,
"line_mean": 28.625,
"line_max": 78,
"alpha_frac": 0.581787852,
"autogenerated": false,
"ratio": 4.278337531486146,
"config_test": false,
"has... |
# abstract heap, minheap, and maxheap -- implementations using Node objects
# NOTE: with Node objects, can support delete() operation with O(lg n)
class Node(object):
__slots__ = ['value', 'heap', 'idx']
def __init__(self, value):
self.value = value
def parent(i):
return (i-1)//2
def left(i):
... | {
"repo_name": "dimakuv/python-algos",
"path": "heap/nodeheap.py",
"copies": "1",
"size": "2134",
"license": "mit",
"hash": -7411420327723815000,
"line_mean": 24.7108433735,
"line_max": 80,
"alpha_frac": 0.5248359888,
"autogenerated": false,
"ratio": 3.142857142857143,
"config_test": false,
"h... |
# abstract heap
def parent(i):
return (i-1)/2
def left(i):
return i*2+1
def right(i):
return i*2+2
class AbstractHeap(object):
"""priority queue using heap (abstract parent class)"""
def __init__(self, a = None):
self.a = a[:] if a else [] # copy list if provided
def compare(self... | {
"repo_name": "dimakuv/python-algos",
"path": "heap/abstractheap.py",
"copies": "1",
"size": "1803",
"license": "mit",
"hash": -6973945221679498000,
"line_mean": 24.7571428571,
"line_max": 80,
"alpha_frac": 0.540765391,
"autogenerated": false,
"ratio": 3.202486678507993,
"config_test": false,
... |
""" **abstract_heated_cavity_phasechange_simulation.py** applies Phaseflow to benchmark problems
on the unit square with hot and cold vertical walls, and adiabatic horizontal walls.
"""
import phaseflow
import fenics
class AbstractHeatedCavityPhaseChangeSimulation(phaseflow.abstract_phasechange_simulation.AbstractP... | {
"repo_name": "geo-fluid-dynamics/phaseflow-fenics",
"path": "phaseflow/abstract_heated_cavity_phasechange_simulation.py",
"copies": "1",
"size": "3577",
"license": "mit",
"hash": -2556043628665461000,
"line_mean": 28.3278688525,
"line_max": 121,
"alpha_frac": 0.5342465753,
"autogenerated": false,
... |
"""Abstract hierarchies of graphs in ReGraph.
This module contains abstact data structures for
graph hierarchies. A graph hierarchy is a DAG, whose nodes
are graphs and whose directed edges represent
homomorphisms between graphs. In addition, hierarchies are
equipped with relations on graphs (which can be thought of a... | {
"repo_name": "Kappa-Dev/ReGraph",
"path": "regraph/hierarchies.py",
"copies": "1",
"size": "106492",
"license": "mit",
"hash": -8490334144673295000,
"line_mean": 39.6613211149,
"line_max": 91,
"alpha_frac": 0.4767963791,
"autogenerated": false,
"ratio": 4.498458159084189,
"config_test": false,... |
# Abstract image generator using random functions
# Nathan Reed, July 2012
import uuid, io
import numpy as np, optparse, random, time
from PIL import Image
# Parse command-line options
parser = optparse.OptionParser()
parser.add_option('-o', '--output', dest='outputPath', help='Write output to FILE', metavar... | {
"repo_name": "Hurence/log-island",
"path": "logisland-docker/loggen/randimg.py",
"copies": "2",
"size": "2758",
"license": "apache-2.0",
"hash": 2412504988775157000,
"line_mean": 32.475,
"line_max": 129,
"alpha_frac": 0.6682378535,
"autogenerated": false,
"ratio": 2.975188781014024,
"config_te... |
"""Abstract interface for generative models.
"""
# standard imports
from typing import Iterable, Union, Tuple
from collections.abc import Iterable as AbstractIterable
import os
import logging
# third-party imports
import numpy as np
# Toolbox imports
from dltb.base.busy import BusyObservable, busy
from dltb.base.da... | {
"repo_name": "Petr-By/qtpyvis",
"path": "dltb/tool/generator.py",
"copies": "1",
"size": "13795",
"license": "mit",
"hash": -6871520787043376000,
"line_mean": 35.4947089947,
"line_max": 85,
"alpha_frac": 0.5924610366,
"autogenerated": false,
"ratio": 4.560330578512397,
"config_test": false,
... |
"""Abstract interface for OID Storage objects"""
from __future__ import generators
from twistedsnmp import errors
__metaclass__ = type
class OIDStore:
"""Interface for the OID Storage mechanism
The role of this mechanism is to store and retrieve
OID: value pairs. Since most of the common queries
involve finding,... | {
"repo_name": "mmattice/TwistedSNMP",
"path": "oidstore.py",
"copies": "1",
"size": "2963",
"license": "bsd-3-clause",
"hash": -1011472035455966300,
"line_mean": 28.9292929293,
"line_max": 79,
"alpha_frac": 0.6962537968,
"autogenerated": false,
"ratio": 3.4858823529411764,
"config_test": false,... |
# Abstract I/O dispatcher. Defines standard dispatcher API
from pysnmp.carrier import error
class TimerCallable:
def __init__(self, cbFun, callInterval):
self.__cbFun = cbFun
self.__callInterval = callInterval
self.__nextCall = 0
def __call__(self, timeNow):
if self.__n... | {
"repo_name": "xfguo/pysnmp",
"path": "pysnmp/carrier/base.py",
"copies": "1",
"size": "5324",
"license": "bsd-3-clause",
"hash": 8024979927153124000,
"line_mean": 33.1282051282,
"line_max": 77,
"alpha_frac": 0.5848985725,
"autogenerated": false,
"ratio": 4.462699077954736,
"config_test": false... |
""" Abstract IO handler """
import os
class IOHandler(object):
"""
Abstract IO handler class
Readers/writers should handle point-cloud data with the following structure:
{'log': ['Processed by module load', 'Processed by module filter using parameters(x,y,z)'],
'pointcloud':
{'offset': {... | {
"repo_name": "eEcoLiDAR/eEcoLiDAR",
"path": "laserchicken/io/base_io_handler.py",
"copies": "1",
"size": "2198",
"license": "apache-2.0",
"hash": 7095977226915249000,
"line_mean": 35.6333333333,
"line_max": 105,
"alpha_frac": 0.5414012739,
"autogenerated": false,
"ratio": 4.062846580406655,
"c... |
"""Abstract I/O mode container.
Mode strings are used in in `~fs.base.FS.open` and
`~fs.base.FS.openbin`.
"""
from __future__ import print_function
from __future__ import unicode_literals
import typing
import six
from ._typing import Text
if typing.TYPE_CHECKING:
from typing import FrozenSet, Set, Union
_... | {
"repo_name": "PyFilesystem/pyfilesystem2",
"path": "fs/mode.py",
"copies": "1",
"size": "6243",
"license": "mit",
"hash": 5674202532995827000,
"line_mean": 25.0125,
"line_max": 82,
"alpha_frac": 0.5567835976,
"autogenerated": false,
"ratio": 3.8872976338729766,
"config_test": false,
"has_no_... |
""" Abstraction around partitionable data
Some data can be partitioned into disjoint pieces.
Examples include lists, tuples, and arrays of various flavors.
This module provides functions to abstract away the handling of such
partitions. It proposes three operations, each of these operations deals with
data (like a n... | {
"repo_name": "vitan/blaze",
"path": "blaze/partition.py",
"copies": "1",
"size": "2564",
"license": "bsd-3-clause",
"hash": 1701972865561021200,
"line_mean": 24.64,
"line_max": 80,
"alpha_frac": 0.639625585,
"autogenerated": false,
"ratio": 3.3428943937418514,
"config_test": false,
"has_no_k... |
"""Abstraction between production pusher and local test."""
import json
import logging
import os
from google.appengine.api import urlfetch
import pusher
from common import public_creds
from pi import simple_pusher
class PusherWrapper(object):
"""Wraps the pusher client library, """
def __init__(self, **kwargs)... | {
"repo_name": "tomwilkie/awesomation",
"path": "src/appengine/pusher_client.py",
"copies": "1",
"size": "1413",
"license": "mit",
"hash": -4112861670076288000,
"line_mean": 27.26,
"line_max": 74,
"alpha_frac": 0.7020523708,
"autogenerated": false,
"ratio": 3.5772151898734177,
"config_test": fal... |
"""Abstraction for Arcyd's conduit operations."""
# =============================================================================
# CONTENTS
# -----------------------------------------------------------------------------
# abdt_conduitmock
#
# Public Classes:
# ConduitMockData
# .assert_is_user
# .create_empty_... | {
"repo_name": "kjedruczyk/phabricator-tools",
"path": "py/abd/abdt_conduitmock.py",
"copies": "4",
"size": "14124",
"license": "apache-2.0",
"hash": 3132277596013437400,
"line_mean": 30.7393258427,
"line_max": 79,
"alpha_frac": 0.6118663268,
"autogenerated": false,
"ratio": 4.1688311688311686,
... |
"""Abstraction for Arcyd's git operations."""
# =============================================================================
# CONTENTS
# -----------------------------------------------------------------------------
# abdt_git
#
# Public Classes:
# Repo
# .is_identical
# .get_remote_branches
# .checkout_for... | {
"repo_name": "cs-shadow/phabricator-tools",
"path": "py/abd/abdt_git.py",
"copies": "4",
"size": "15801",
"license": "apache-2.0",
"hash": 2532396324153288700,
"line_mean": 32.2652631579,
"line_max": 79,
"alpha_frac": 0.6164799696,
"autogenerated": false,
"ratio": 3.827761627906977,
"config_te... |
"""Abstraction for communicating with i2c servo cape by Sean Ketring
"""
import time
import bot.lib.lib as lib
import smbus
class ServoCape(object):
"""Protocol:
Cape expects to recieve a 6 byte array
if the first byte is 0x00
next 5 bytes are servo angles.
otherwise the number of a demo.
... | {
"repo_name": "IEEERobotics/bot",
"path": "bot/hardware/servo_cape.py",
"copies": "1",
"size": "1152",
"license": "bsd-2-clause",
"hash": 6617001060802618000,
"line_mean": 25.1818181818,
"line_max": 68,
"alpha_frac": 0.5546875,
"autogenerated": false,
"ratio": 3.7281553398058254,
"config_test":... |
"""Abstraction for dealing with products and the files they contain."""
import os
from xml.dom.minidom import parseString
from .coda_aware import CODA_Aware
class Product(CODA_Aware):
"""A CODA product, composed mainly of NetCDF files."""
def __init__(self, uuid, work_dir=""):
self.files = []
... | {
"repo_name": "erget/Presence",
"path": "codaPresence/product.py",
"copies": "1",
"size": "1964",
"license": "mit",
"hash": -52098398387407240,
"line_mean": 37.5098039216,
"line_max": 77,
"alpha_frac": 0.5570264766,
"autogenerated": false,
"ratio": 4.278867102396514,
"config_test": false,
"ha... |
"""Abstraction for invoking a lambda function."""
import json
from typing import Any, Optional, Dict, List, Union, Tuple # noqa
from chalice.config import DeployedResources # noqa
from chalice.awsclient import TypedAWSClient # noqa
from chalice.utils import UI # noqa
from chalice.compat import StringIO
OptStr =... | {
"repo_name": "awslabs/chalice",
"path": "chalice/invoke.py",
"copies": "1",
"size": "4144",
"license": "apache-2.0",
"hash": -2818401438951032000,
"line_mean": 34.1186440678,
"line_max": 79,
"alpha_frac": 0.6213803089,
"autogenerated": false,
"ratio": 4.019398642095053,
"config_test": false,
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.