text stringlengths 0 1.05M | meta dict |
|---|---|
from ..exceptions import InvalidChoiceError
from .base import MarathonResource, MarathonObject, assert_valid_path
from .constraint import MarathonConstraint
from .container import MarathonContainer
from .deployment import MarathonDeployment
from .task import MarathonTask
from ..util import get_log
from ..util import to... | {
"repo_name": "thefactory/marathon-python",
"path": "marathon/models/app.py",
"copies": "1",
"size": "23324",
"license": "mit",
"hash": -7774904542181407000,
"line_mean": 45.2777777778,
"line_max": 137,
"alpha_frac": 0.6865889213,
"autogenerated": false,
"ratio": 4.008937779305604,
"config_test... |
from .exceptions import InvalidCommand
from .cmd_base import DoitCmdBase
opt_clean_dryrun = {'name': 'dryrun',
'short': 'n', # like make dry-run
'long': 'dry-run',
'type': bool,
'default': False,
'help': 'print actions ... | {
"repo_name": "swayf/doit",
"path": "doit/cmd_clean.py",
"copies": "2",
"size": "3175",
"license": "mit",
"hash": 2171747882839430000,
"line_mean": 35.4942528736,
"line_max": 81,
"alpha_frac": 0.534488189,
"autogenerated": false,
"ratio": 4.26747311827957,
"config_test": false,
"has_no_keywor... |
from .exceptions import InvalidCommand
from .dependency import Dependency
from .cmd_base import DoitCmdBase
opt_listall = {'name': 'subtasks',
'short':'',
'long': 'all',
'type': bool,
'default': False,
'help': "list include all sub-tasks from d... | {
"repo_name": "okin/doit",
"path": "doit/cmd_list.py",
"copies": "2",
"size": "4373",
"license": "mit",
"hash": -4681850037383285000,
"line_mean": 35.1404958678,
"line_max": 80,
"alpha_frac": 0.4751886577,
"autogenerated": false,
"ratio": 4.2129094412331405,
"config_test": false,
"has_no_keyw... |
from .exceptions import InvalidCredentialsException, InvalidServiceException
import requests
import logging
from requests.auth import HTTPBasicAuth
REGISTRY_URL = (
"https://access.auth.theplatform.{tld}/web/Registry/resolveDomain"
)
SIGN_IN_URL = (
"https://identity.auth.theplatform.{tld}/idm/web/Authenticati... | {
"repo_name": "blockbuster/mpxapi",
"path": "mpxapi/http.py",
"copies": "1",
"size": "4065",
"license": "mit",
"hash": -2212506942322297600,
"line_mean": 30.511627907,
"line_max": 78,
"alpha_frac": 0.5697416974,
"autogenerated": false,
"ratio": 3.9658536585365853,
"config_test": false,
"has_n... |
from .exceptions import InvalidDodoFile
from .cmdparse import TaskParse, CmdOption
from .cmd_base import DoitCmdBase
HELP_TASK = """
Task Dictionary parameters
--------------------------
Tasks are defined by functions starting with the string ``task_``. It must return a dictionary describing the task with the follo... | {
"repo_name": "pydoit/doit",
"path": "doit/cmd_help.py",
"copies": "3",
"size": "5357",
"license": "mit",
"hash": 1590386237614642000,
"line_mean": 30.3274853801,
"line_max": 141,
"alpha_frac": 0.6079895464,
"autogenerated": false,
"ratio": 3.88469905728789,
"config_test": false,
"has_no_keyw... |
from exceptions import (InvalidKeyPair, InvalidAvailabilityZone,
NoSubnetReturned, RegionDoesNotExist,
InvalidCluster, InvalidAMI, NoSecurityGroupsReturned,
MultipleSecurityGroupsReturned)
import boto.ec2
import boto.route53
import boto.ec2.network... | {
"repo_name": "hudl/Tyr",
"path": "tyr/servers/server.py",
"copies": "1",
"size": "39170",
"license": "unlicense",
"hash": 7494709995127266000,
"line_mean": 34.4168173599,
"line_max": 158,
"alpha_frac": 0.5290273168,
"autogenerated": false,
"ratio": 4.241931990470002,
"config_test": false,
"h... |
from .exceptions import InvalidOptions
class Annotate(object):
'''
with Annotate(request, {
'auth': Auth(request),
...
}, delete=['user']):
...
Helper object to help with creating and cleaning up annotations on other
objects.
'''
def __init__(self, obj, annotations,... | {
"repo_name": "dlamotte/krankshaft",
"path": "krankshaft/util.py",
"copies": "1",
"size": "2307",
"license": "mit",
"hash": 8621465684144858000,
"line_mean": 28.961038961,
"line_max": 78,
"alpha_frac": 0.5596012137,
"autogenerated": false,
"ratio": 4.344632768361582,
"config_test": false,
"ha... |
from .exceptions import InvalidProtocolException, UnsupportedOperationException, DuplicateProtocolException
class ProtocolManager(object):
def __init__(self):
self._protocols = {}
def register_protocol(self, protocol):
if protocol.prefix in self._protocols:
raise DuplicateProtoco... | {
"repo_name": "nint8835/Mercury",
"path": "mercury/protocolmanager.py",
"copies": "1",
"size": "1085",
"license": "mit",
"hash": 3623745026569102000,
"line_mean": 46.1739130435,
"line_max": 142,
"alpha_frac": 0.6940092166,
"autogenerated": false,
"ratio": 4.737991266375546,
"config_test": false... |
from .exceptions import InvalidQuery, InvalidParameterQuery, QueryError, \
ScriptFieldsError
from .facets import FacetFactory
from .filters import ANDFilter, Filter
from .highlight import HighLighter
from .scriptfields import ScriptFields
from .utils import clean_string, ESRange, EqualityComparableUsingAttributeDic... | {
"repo_name": "openlabs/pyes",
"path": "pyes/query.py",
"copies": "1",
"size": "44051",
"license": "bsd-3-clause",
"hash": -924768683172421900,
"line_mean": 32.8853846154,
"line_max": 110,
"alpha_frac": 0.5851172505,
"autogenerated": false,
"ratio": 4.051411753885772,
"config_test": false,
"h... |
from ..exceptions import InvalidTld, UnsupportedTld
import idna
from ..models import (
TopLevelDomain,
TopLevelDomainProvider,
RegisteredDomain,
Nameserver,
)
def get_domain_registry(fqdn):
"""
Fetch the registry for a given domain.
In the future there may be more than one upstream provide... | {
"repo_name": "heytrav/drs-project",
"path": "domain_api/utilities/domain.py",
"copies": "1",
"size": "3700",
"license": "mit",
"hash": -8996329309090084000,
"line_mean": 30.3559322034,
"line_max": 79,
"alpha_frac": 0.6497297297,
"autogenerated": false,
"ratio": 4.039301310043668,
"config_test"... |
from .exceptions import InvalidTransition
__all__ = ["FiniteStateMachineMixin", "BaseFiniteStateMachineMixin"]
class BaseFiniteStateMachineMixin:
"""Base Mixin to add a state_machine behavior.
Represents the state machine for the object.
The states and transitions should be specified in the following w... | {
"repo_name": "Woile/pyfsm",
"path": "fsm/fsm.py",
"copies": "1",
"size": "4425",
"license": "mit",
"hash": -2521386167720797000,
"line_mean": 30.3829787234,
"line_max": 78,
"alpha_frac": 0.6293785311,
"autogenerated": false,
"ratio": 4.372529644268774,
"config_test": false,
"has_no_keywords"... |
from .exceptions import InvalidValueState
class ValueProtocol(object):
def is_index(self, name, obj_context=None):
raise NotImplementedError()
def is_sequence(self, obj, obj_context=None):
raise NotImplementedError()
def is_mapping(self, obj, obj_context=None):
raise NotImplemen... | {
"repo_name": "szopu/datadiffs",
"path": "datadiffs/protocols.py",
"copies": "1",
"size": "3760",
"license": "mit",
"hash": -1621609704925905000,
"line_mean": 34.4716981132,
"line_max": 77,
"alpha_frac": 0.6289893617,
"autogenerated": false,
"ratio": 3.682664054848188,
"config_test": false,
"... |
from .exceptions import JobStatusError, JobTransitionError
from core.utils import getLogger
log = getLogger(__name__)
class JobStatusTransitionMixin(object):
STATUS_DRAFT = 'DRAFT'
STATUS_ACTIVE = 'ACTIVE'
STATUS_INACTIVE = 'INACTIVE'
CHOICES_STATUS = (
(STATUS_DRAFT, 'Draft'),
(STAT... | {
"repo_name": "stephanpoetschner/advanced-django-workshop",
"path": "jobzwo/jobs/mixins.py",
"copies": "1",
"size": "1310",
"license": "mit",
"hash": 498498969215746370,
"line_mean": 30.1904761905,
"line_max": 72,
"alpha_frac": 0.5648854962,
"autogenerated": false,
"ratio": 4.440677966101695,
"... |
from ..exceptions import KeyNotFoundError
from ..types import Type
class Attribute(object):
__slots__ = ['name', 'type', 'required', 'metadata']
def __init__(self, name, typ, required=True, metadata=None):
if not isinstance(name, str):
raise ValueError('String expected for attribute name... | {
"repo_name": "llambeau/finitio.py",
"path": "finitio/support/attribute.py",
"copies": "1",
"size": "2132",
"license": "isc",
"hash": 7976050902489097000,
"line_mean": 31.303030303,
"line_max": 72,
"alpha_frac": 0.5422138837,
"autogenerated": false,
"ratio": 4.386831275720165,
"config_test": fa... |
from .exceptions import KeyNotFound
class BaseKey(object):
valid_permissions = set()
def __init__(self, value, permissions=[]):
self.value = value
# make sure all permissions are valid
for p in permissions:
if p not in type(self).valid_permissions:
raise ValueError("Permission: `{}` not valid for key of... | {
"repo_name": "Melsik/evechemapi",
"path": "evechem_api/security/base.py",
"copies": "1",
"size": "3142",
"license": "mit",
"hash": -7706176279548266000,
"line_mean": 32.7849462366,
"line_max": 105,
"alpha_frac": 0.7148313176,
"autogenerated": false,
"ratio": 3.8457772337821297,
"config_test": ... |
from .exceptions import KrankshaftError
from collections import namedtuple
from cStringIO import StringIO
from datetime import datetime, date, time, timedelta
from functools import partial
import decimal
import json
import mimeparse
import urlparse
# TODO: Accept: */* dumps: no method to_urlencoded
# maybe only ... | {
"repo_name": "dlamotte/krankshaft",
"path": "krankshaft/serializer.py",
"copies": "1",
"size": "7842",
"license": "mit",
"hash": -4244221405484642000,
"line_mean": 30.2430278884,
"line_max": 80,
"alpha_frac": 0.5816118337,
"autogenerated": false,
"ratio": 4.339789706696181,
"config_test": fals... |
from exceptions import MissingCmd
from media import Media
import os
VERSION = 'v1'
class CmdBuilder(object):
def __init__(self, cmd, *param_list, **param_dict):
self.cmd = cmd
self.params = list()
self.add(*param_list, **param_dict)
def add(self, *param_list, **param_dict):
... | {
"repo_name": "wix/wixmedia-python",
"path": "wix/media/image.py",
"copies": "1",
"size": "5332",
"license": "mit",
"hash": 5965435676171760000,
"line_mean": 25.2709359606,
"line_max": 95,
"alpha_frac": 0.5543885971,
"autogenerated": false,
"ratio": 3.5978407557354926,
"config_test": false,
"... |
from ..exceptions import MissingColumnError
from .query_components import TableExpression
from .column import ColumnExpr
from .column_collection import ColumnCollection
class Table(TableExpression):
"""Represents a database table."""
def __init__(self, table_name, column_names, schema=None):
"""
... | {
"repo_name": "modimore/BreezeBlocks",
"path": "package/breezeblocks/sql/table.py",
"copies": "1",
"size": "5743",
"license": "mit",
"hash": -4296241035989912000,
"line_mean": 30.5549450549,
"line_max": 89,
"alpha_frac": 0.5831446979,
"autogenerated": false,
"ratio": 4.525610717100079,
"config_... |
from .exceptions import MissingModuleError, UnsupportedModuleError
from .pool import ConnectionPool as Pool
from .query_builder import QueryBuilder
from .dml_builders import InsertBuilder, UpdateBuilder, DeleteBuilder
class Database(object):
"""Proxies the database at the URI provided."""
def __init__(sel... | {
"repo_name": "modimore/BreezeBlocks",
"path": "package/breezeblocks/database.py",
"copies": "1",
"size": "3105",
"license": "mit",
"hash": 1654423409353689900,
"line_mean": 39.8552631579,
"line_max": 83,
"alpha_frac": 0.6273752013,
"autogenerated": false,
"ratio": 4.5196506550218345,
"config_t... |
from .exceptions import MissingParameterError, InvalidModeError, InvalidAPIKeyError
from .exceptions import InvalidAlternativeError, MissingAPIKeyError, InvalidRouteRestrictionError
import re
import json
class ParameterValidationContainer(object):
"""
The purpose of this class is to simply validate any pre-defined... | {
"repo_name": "apranav19/pydirections",
"path": "pydirections/route_requester.py",
"copies": "1",
"size": "4037",
"license": "apache-2.0",
"hash": 6262600474722308000,
"line_mean": 30.0538461538,
"line_max": 107,
"alpha_frac": 0.7322269012,
"autogenerated": false,
"ratio": 3.7036697247706423,
"... |
from .exceptions import MissingRequiredFieldError
from .endpoint import Endpoint
from .. import RequestFactory
from ...models.fileupload_item import FileuploadItem
import os.path
import logging
# For when a datasource is over 64MB, break it into 5MB(standard chunk size) chunks
CHUNK_SIZE = 1024 * 1024 * 5 # 5MB
logg... | {
"repo_name": "Talvalin/server-client-python",
"path": "tableauserverclient/server/endpoint/fileuploads_endpoint.py",
"copies": "1",
"size": "2419",
"license": "mit",
"hash": 9124391469809416000,
"line_mean": 40,
"line_max": 99,
"alpha_frac": 0.639107069,
"autogenerated": false,
"ratio": 3.933333... |
from .exceptions import MockObjectUnhashable
from .exceptions import UnexpectedEvent
class MockObject(object):
def __repr__(self):
return self.__forge__.describe()
def __getattr__(self, attr):
return self.__forge__.get_attribute(attr)
def __setattr__(self, attr, value):
if attr == '... | {
"repo_name": "vmalloc/pyforge",
"path": "forge/mock_object.py",
"copies": "1",
"size": "1948",
"license": "bsd-3-clause",
"hash": 5931345847791569000,
"line_mean": 37.96,
"line_max": 118,
"alpha_frac": 0.5539014374,
"autogenerated": false,
"ratio": 4.281318681318681,
"config_test": false,
"h... |
from .exceptions import (MutagenWrapperError, UnsupportedFormatError,
ReservedTagNameError)
from .formats.id3 import ID3Format, ID3TagsWrapper
from .formats.mp4 import MP4Format, MP4TagsWrapper
from .formats.vorbis import VorbisFormat
from .version import __version__
_formats = []
_extensions... | {
"repo_name": "clee704/mutagenwrapper",
"path": "mutagenwrapper/__init__.py",
"copies": "1",
"size": "3805",
"license": "mit",
"hash": -2027724103308994600,
"line_mean": 28.0458015267,
"line_max": 80,
"alpha_frac": 0.6052562418,
"autogenerated": false,
"ratio": 3.9968487394957983,
"config_test"... |
from Exceptions import *
def db_info(db_path):
"""
Print the API Username, Password and Permanent token
:param db_path: Path to db file
:return:
"""
import sqlite3
try:
conn = sqlite3.connect(db_path)
except sqlite3.OperationalError:
raise SQLError.SQLDBNonExist('SQL DB ... | {
"repo_name": "radioboyQ/EmpireAPIWrapper",
"path": "EmpireAPIWrapper/utils.py",
"copies": "1",
"size": "1155",
"license": "apache-2.0",
"hash": 5971598424163747000,
"line_mean": 31.1111111111,
"line_max": 83,
"alpha_frac": 0.632034632,
"autogenerated": false,
"ratio": 3.2172701949860723,
"conf... |
from exceptions import *
from .record import Part, Record
import socket
import re
BUFFER_SIZE = 1024
DEFAULT_WHOIS_PORT = 43
DEFAULT_BIND_HOST = "0.0.0.0"
class SocketHandler(object):
'''
The SocketHandler is the default query handler provided with the
Whois library. It performs the WHOIS query using a sy... | {
"repo_name": "huyphan/pyyawhois",
"path": "yawhois/adapters.py",
"copies": "1",
"size": "5212",
"license": "mit",
"hash": 5400995680022873000,
"line_mean": 27.9555555556,
"line_max": 81,
"alpha_frac": 0.5796239447,
"autogenerated": false,
"ratio": 3.9574791192103267,
"config_test": false,
"h... |
from exceptions import *
from sql_statement import SQLStatement
from where_clause_evaluation_engine import *
from boolean_expressions.tree import BooleanExpressionTree
class DataQueryEngine(object):
where_evaluation_engine = WhereClauseEvaluationEngine()
def __init__(self, data, sql_str):
self.data ... | {
"repo_name": "bheni/sql4json",
"path": "sql4json/data_query_engine.py",
"copies": "1",
"size": "4813",
"license": "apache-2.0",
"hash": 1517844961696286700,
"line_mean": 31.3020134228,
"line_max": 110,
"alpha_frac": 0.5422813214,
"autogenerated": false,
"ratio": 4.4647495361781075,
"config_tes... |
from .exceptions import *
import sys
BASE_URL = "https://blockchain.info/"
TIMEOUT = 10
py_version = sys.version_info[0]
if py_version >= 3:
# Python 3.0 and later
from urllib.request import urlopen
from urllib.error import HTTPError
from urllib.parse import urlencode
else:
# Python 2.x
from u... | {
"repo_name": "Power1974/api-v1-client-python",
"path": "blockchain/util.py",
"copies": "4",
"size": "1036",
"license": "mit",
"hash": -8760358963161847000,
"line_mean": 29.5,
"line_max": 85,
"alpha_frac": 0.6747104247,
"autogenerated": false,
"ratio": 4.078740157480315,
"config_test": false,
... |
from ..exceptions import *
class Processor:
def __init__(self):
self.outputs = []
self.files = []
def add(self, output):
self.outputs.append(output)
def get_nodes(self, str):
res = []
parts = str.split(',')
for part in parts:
entry = part.split... | {
"repo_name": "PearCoding/SpriteResourceCompiler",
"path": "src/processor/processor.py",
"copies": "1",
"size": "3321",
"license": "mit",
"hash": -6087730660524240000,
"line_mean": 32.21,
"line_max": 78,
"alpha_frac": 0.4748569708,
"autogenerated": false,
"ratio": 4.66432584269663,
"config_test... |
from exceptions import (
NodeNotFoundError, NodeTypeNotFoundError, GraphAPIError, MissingNodeTypeError, InvalidPropertyError,
MalformedUpdateDictionaryError, )
import py2neo
import cypher_utils
from py2neo_additions import CypherTransactionManager
from node_model import Attribute, Relationship, NodeModel
from d... | {
"repo_name": "TheArtOfEngineering/RibbonGraph",
"path": "ribbon/graph.py",
"copies": "1",
"size": "24597",
"license": "mit",
"hash": 278269760204999550,
"line_mean": 45.8514285714,
"line_max": 154,
"alpha_frac": 0.5753140627,
"autogenerated": false,
"ratio": 4.16545300592718,
"config_test": fa... |
from .exceptions import NodeDisconnectException
from cStringIO import StringIO
import struct
import time
import random
import socket
#: The protocol version
PROTOCOL_VERSION = 60002
#: The network magic values
MAGIC_VALUES = {
"bitcoin": 0xD9B4BEF9,
"bitcoin_testnet": 0xDAB5BFFA,
"bitcoin_testn... | {
"repo_name": "perone/protocoin",
"path": "protocoin/fields.py",
"copies": "1",
"size": "10074",
"license": "bsd-3-clause",
"hash": -2537191974232752000,
"line_mean": 27.218487395,
"line_max": 74,
"alpha_frac": 0.5968830653,
"autogenerated": false,
"ratio": 3.9536891679748822,
"config_test": fa... |
from .exceptions import NoResultsFound
from BeautifulSoup import BeautifulSoup
from blessings import Terminal
from textwrap import fill
import os
import random
import re
import requests
import sys
def beautify(soup):
"""Parse BeautifulSoup HTML and return prettified string."""
# BeautifulSoup strips out white... | {
"repo_name": "conorsch/etym",
"path": "etym/utils.py",
"copies": "1",
"size": "3049",
"license": "mit",
"hash": 6655643939062694000,
"line_mean": 31.4361702128,
"line_max": 121,
"alpha_frac": 0.6366021646,
"autogenerated": false,
"ratio": 3.6823671497584543,
"config_test": false,
"has_no_key... |
from ._exceptions import NoSchemaFoundInWildMode, WebsiteNotImplementedError
from ._factory import SchemaScraperFactory
from ._utils import get_host_name
from .abril import Abril
from .acouplecooks import ACoupleCooks
from .afghankitchenrecipes import AfghanKitchenRecipes
from .allrecipes import AllRecipes
from .alltom... | {
"repo_name": "hhursev/recipe-scraper",
"path": "recipe_scrapers/__init__.py",
"copies": "1",
"size": "12512",
"license": "mit",
"hash": 3162714940676052500,
"line_mean": 36.686746988,
"line_max": 77,
"alpha_frac": 0.7810901535,
"autogenerated": false,
"ratio": 2.7866369710467707,
"config_test"... |
from .exceptions import NoSuchLigandError, NoSuchTargetError, NoSuchInteractionError
from . import gtop
from .pdb import ask_about_molecupy
def get_interaction_by_id(self, interaction_id):
if not isinstance(interaction_id, int):
raise TypeError("interaction_id must be int, not '%s'" % str(interaction_id))
... | {
"repo_name": "samirelanduk/pygtop",
"path": "pygtop/interactions.py",
"copies": "1",
"size": "6135",
"license": "mit",
"hash": 933038254906220200,
"line_mean": 27.2718894009,
"line_max": 90,
"alpha_frac": 0.6133659332,
"autogenerated": false,
"ratio": 3.981181051265412,
"config_test": false,
... |
from .exceptions import NoSuchSystem
def translate(instance, system, src_lang, src_field, dst_lang, dst_field):
"""Translates specified field using specified system
:arg instance: A model instance with fields to be translated
:arg system: The name of the system to be used to do the translation
:arg s... | {
"repo_name": "rlr/fjord",
"path": "fjord/translations/utils.py",
"copies": "3",
"size": "1900",
"license": "bsd-3-clause",
"hash": 7153787969698531000,
"line_mean": 37,
"line_max": 78,
"alpha_frac": 0.7184210526,
"autogenerated": false,
"ratio": 4.481132075471698,
"config_test": false,
"has_... |
from exceptions import NotImplementedError, AttributeError
class Delegator(object):
def __init__(self, obj):
self.__setobj__(obj)
def __setattr__(self, name, value):
target = self.__getobj__()
if name in self.__dict__:
object.__setattr__(self, name, value)
else:
... | {
"repo_name": "hugobast/delegator",
"path": "delegator/delegator.py",
"copies": "1",
"size": "1560",
"license": "mit",
"hash": -5753823922231132000,
"line_mean": 25.8965517241,
"line_max": 74,
"alpha_frac": 0.5307692308,
"autogenerated": false,
"ratio": 4.431818181818182,
"config_test": false,
... |
from exceptions import NotImplementedError, Exception
import logging
from threading import RLock, local as thread_local
import re
class EventDispatcher(object):
def __init__(self):
self.listeners = dict()
self.listeners[None] = set()
self.lock = RLock()
def dispatch_event(self, name, ... | {
"repo_name": "prismskylabs/pycounters",
"path": "src/pycounters/base.py",
"copies": "1",
"size": "6870",
"license": "apache-2.0",
"hash": -997385192437192200,
"line_mean": 31.5592417062,
"line_max": 146,
"alpha_frac": 0.5898107715,
"autogenerated": false,
"ratio": 4.426546391752577,
"config_te... |
from exceptions import NotImplementedError, Exception
import threading
import time
from ..base import GLOBAL_REGISTRY, CounterValueCollection
from . import tcpcollection
__author__ = 'boaz'
class CounterValuesCollector(object):
"""
a utility class to retrieve Counter Values. Basic functionality is very s... | {
"repo_name": "prismskylabs/pycounters",
"path": "src/pycounters/reporters/base.py",
"copies": "1",
"size": "13755",
"license": "apache-2.0",
"hash": -3994360692348684300,
"line_mean": 41.7173913043,
"line_max": 131,
"alpha_frac": 0.6095965104,
"autogenerated": false,
"ratio": 4.483376792698826,
... |
from exceptions import NotImplementedError
import os
from PyQt4.QtCore import QEventLoop, QUrl, QObject, SIGNAL, SLOT, QVariant
from PyQt4.QtNetwork import QNetworkAccessManager, QNetworkRequest
from src.storage import storage
class backend(object):
''' The backend manages the local and remote interface to
... | {
"repo_name": "aleximplode/Show-Tracker",
"path": "src/backends/backend.py",
"copies": "1",
"size": "4582",
"license": "mit",
"hash": -3977570259996416500,
"line_mean": 27.4658385093,
"line_max": 96,
"alpha_frac": 0.5467044959,
"autogenerated": false,
"ratio": 4.384688995215311,
"config_test": ... |
from exceptions import NotImplementedError, ValueError
from numpy import add, multiply, divide
from numpy.linalg import norm
from AbstractFunction import AbstractFunction
class AbstractFeasibleDirectionsDescender:
"""
Abstract class for feasible direction descend optimization method.
"""
def __init__(self, ... | {
"repo_name": "char-lie/feasible_directions",
"path": "src/AbstractFeasibleDirectionsDescender.py",
"copies": "1",
"size": "2560",
"license": "mit",
"hash": 6023981686639330000,
"line_mean": 29.1176470588,
"line_max": 79,
"alpha_frac": 0.653515625,
"autogenerated": false,
"ratio": 4.2174629324546... |
from .exceptions import NotPersistException, LatePersistException
from .element import Element
class DynamicElement(Element):
def __init__(self, parent, selenium_element, found_by, identifier):
Element.__init__(self, parent)
# from element
self._inner_selenium_element = selenium_element
... | {
"repo_name": "KarlGong/easyium",
"path": "easyium/dynamic_element.py",
"copies": "2",
"size": "1656",
"license": "apache-2.0",
"hash": -1055704734487328100,
"line_mean": 40.4,
"line_max": 109,
"alpha_frac": 0.6123188406,
"autogenerated": false,
"ratio": 4.25706940874036,
"config_test": false,
... |
from exceptions import ObjectCubeException
from types import LongType, UnicodeType, BooleanType, NoneType, ListType
class ObjectCubeClass(object):
def __init__(self, **kwargs):
self.data = {}
for key, type_ in self.fields.items():
# Type checking is only done on the specified fields
... | {
"repo_name": "rudatalab/python-objectcube",
"path": "objectcube/data_objects.py",
"copies": "1",
"size": "4240",
"license": "bsd-2-clause",
"hash": 1651625416499178500,
"line_mean": 32.125,
"line_max": 78,
"alpha_frac": 0.5252358491,
"autogenerated": false,
"ratio": 4.181459566074951,
"config_... |
from .exceptions import OperationDeclarationException
from .memory import MEMORY, MemoryValue
TOKENS = {}
class Operation(type):
def __init__(cls, name, bases, dct):
if "TOKEN" in dct:
if dct["TOKEN"] not in TOKENS:
TOKENS[dct["TOKEN"]] = cls()
else:
... | {
"repo_name": "nint8835/InvitationASM",
"path": "InvitationASM/operations.py",
"copies": "1",
"size": "6116",
"license": "mit",
"hash": -5781025632768729000,
"line_mean": 28.6893203883,
"line_max": 101,
"alpha_frac": 0.6355461086,
"autogenerated": false,
"ratio": 3.6887816646562124,
"config_tes... |
from .exceptions import OSFException
from .models import OSFCore
from .models import Project
class OSF(OSFCore):
"""Interact with the Open Science Framework.
This is the main point of contact for interactions with the
OSF. Use the methods of this class to find projects, login
to the OSF, etc.
"""... | {
"repo_name": "betatim/osf-cli",
"path": "osfclient/api.py",
"copies": "1",
"size": "1503",
"license": "bsd-3-clause",
"hash": 3006631427303038500,
"line_mean": 34.7857142857,
"line_max": 125,
"alpha_frac": 0.6380572189,
"autogenerated": false,
"ratio": 3.986737400530504,
"config_test": false,
... |
from exceptions import PackageError
class PackageList(object):
class Remote(object):
def __init__(self, name, target):
self.name = name
self.target = target
def __str__(self):
if self.target is None:
return self.name
else:
return '{name}/{target}'.format(name=self.name, target=self.target)
... | {
"repo_name": "brianspeir/Vanilla",
"path": "vendor/bootstrap-vz/base/pkg/packagelist.py",
"copies": "1",
"size": "1905",
"license": "bsd-3-clause",
"hash": 8257976615810486000,
"line_mean": 32.4210526316,
"line_max": 102,
"alpha_frac": 0.698687664,
"autogenerated": false,
"ratio": 3.359788359788... |
from .exceptions import _ParallelBackgroundException
import threading
import multiprocessing as mp
from functools import wraps
def execute_with_context(ctx, func):
@wraps(func)
def call(*args, **kwargs):
with ctx:
return func(*args, **kwargs)
return call
class ThreadWorker:
def... | {
"repo_name": "agraubert/agutil",
"path": "agutil/parallel/src/worker.py",
"copies": "1",
"size": "4273",
"license": "mit",
"hash": 3881323691123372000,
"line_mean": 26.2165605096,
"line_max": 74,
"alpha_frac": 0.5174350573,
"autogenerated": false,
"ratio": 4.3825641025641024,
"config_test": fa... |
from ..exceptions import ParserError
from .base import BaseParser
class Bmx6Parser(BaseParser):
""" Bmx6_b6m parser """
protocol = 'BMX6_b6m'
version = '0'
metric = 'none'
def parse(self, data):
"""
Converts a BMX6 b6m JSON to a NetworkX Graph object
which is then returne... | {
"repo_name": "ninuxorg/netdiff",
"path": "netdiff/parsers/bmx6.py",
"copies": "1",
"size": "1098",
"license": "mit",
"hash": 5450621143440539000,
"line_mean": 31.2941176471,
"line_max": 82,
"alpha_frac": 0.5191256831,
"autogenerated": false,
"ratio": 4.322834645669292,
"config_test": false,
... |
from ..exceptions import ParserError
from .base import BaseParser
class NetJsonParser(BaseParser):
""" NetJSON (0.1) parser """
def parse(self, data):
"""
Converts a NetJSON 'NetworkGraph' object
to a NetworkX Graph object,which is then returned.
Additionally checks for protoc... | {
"repo_name": "ninuxorg/netdiff",
"path": "netdiff/parsers/netjson.py",
"copies": "1",
"size": "1846",
"license": "mit",
"hash": -8901144257574826000,
"line_mean": 37.4583333333,
"line_max": 88,
"alpha_frac": 0.5503791983,
"autogenerated": false,
"ratio": 4.4914841849148415,
"config_test": fals... |
from ..exceptions import ParserError
import re
class StringScanner(object):
def __init__(self, string):
self._input = string
self._offset = 0
self.results = []
@property
def buffer(self):
return buffer(self._input, self._offset)
def eos(self):
return self... | {
"repo_name": "huyphan/pyyawhois",
"path": "yawhois/scanner/base.py",
"copies": "1",
"size": "4854",
"license": "mit",
"hash": 4035937289890588000,
"line_mean": 28.2409638554,
"line_max": 87,
"alpha_frac": 0.5327564895,
"autogenerated": false,
"ratio": 4.173688736027515,
"config_test": false,
... |
from .exceptions import ParserError, ParserWarning, InvalidSynonyms
from .constants import OPERATORS, LEVELS
from .report import ReportMessage, validate_report
def empty_line(line):
'''Empty lines are ignored by Solr.'''
if len(line.strip()) == 0:
return True
def comment_line(line):
'''Comments start with a... | {
"repo_name": "prashnts/elasticsearch-synonyms",
"path": "es_synonyms/parser.py",
"copies": "1",
"size": "2999",
"license": "mit",
"hash": 7878120737378139000,
"line_mean": 28.99,
"line_max": 80,
"alpha_frac": 0.6522174058,
"autogenerated": false,
"ratio": 3.7162329615861216,
"config_test": fal... |
from .exceptions import PatcherCreationException
from .decorator import is_decorable
from .detectors import is_static_method, is_callable, is_class, get_callables
def get_patcher(decorator_factory, name, context):
attribute = getattr(context, name)
if is_class(attribute):
# In this case the attribute... | {
"repo_name": "bywires/chara",
"path": "chara/patchers.py",
"copies": "1",
"size": "2132",
"license": "mit",
"hash": -4932720858447918000,
"line_mean": 27.0526315789,
"line_max": 77,
"alpha_frac": 0.6378986867,
"autogenerated": false,
"ratio": 4.423236514522822,
"config_test": false,
"has_no_... |
from ..exceptions import PDFFieldCleaningError
class AbstractPDFField(object):
ALLOWED_VALUE_TYPES = []
def __init__(self, name, **kwargs):
self.name = name
self.kwargs = kwargs
def clean(self, value, context=None):
if not isinstance(value, self.get_allowed_value_types()):
... | {
"repo_name": "tm-kn/django-pdf-model",
"path": "django_pdf/pdf_fields/base.py",
"copies": "1",
"size": "1415",
"license": "bsd-2-clause",
"hash": 4879687402798936000,
"line_mean": 31.9069767442,
"line_max": 78,
"alpha_frac": 0.5766784452,
"autogenerated": false,
"ratio": 4.449685534591195,
"co... |
from ..exceptions import ProviderDoesNotExist, MissingParameter
from ..models import Relation, UserSocialAuth
class BaseBackend(object):
model = Relation
def get_social_auth(self, user):
model = self.get_social_model()
try:
return model.objects.get(user=user,
... | {
"repo_name": "thoas/django-fairepart",
"path": "fairepart/backends/base.py",
"copies": "1",
"size": "1440",
"license": "mit",
"hash": -1467990576225375500,
"line_mean": 29,
"line_max": 111,
"alpha_frac": 0.6125,
"autogenerated": false,
"ratio": 4.247787610619469,
"config_test": false,
"has_n... |
from .exceptions import QueryError
from .sql import Value
from .sql.column_collection import ColumnCollection
from .sql.param_store import get_param_store
from .sql.query import Query
from .sql.query_components import Referenceable
from .sql.query_components import Selectable
from .sql.query_components import TableExp... | {
"repo_name": "modimore/BreezeBlocks",
"path": "package/breezeblocks/query_builder.py",
"copies": "1",
"size": "11335",
"license": "mit",
"hash": 324054862619796160,
"line_mean": 37.5544217687,
"line_max": 93,
"alpha_frac": 0.5731804146,
"autogenerated": false,
"ratio": 4.482008699090549,
"conf... |
from .exceptions import QueryParameterError
from .utils import ESRange, EqualityComparableUsingAttributeDictionary
from .es import json
class Filter(EqualityComparableUsingAttributeDictionary):
_extra_properties = ("_cache", "cache_key", "_name")
def __init__(self, **kwargs):
self._extra_values = di... | {
"repo_name": "rookdev/pyes",
"path": "pyes/filters.py",
"copies": "1",
"size": "14460",
"license": "bsd-3-clause",
"hash": 1193894396523486000,
"line_mean": 26.9150579151,
"line_max": 125,
"alpha_frac": 0.5981327801,
"autogenerated": false,
"ratio": 4.051555057439058,
"config_test": false,
"... |
from .exceptions import RedisError
class List(object):
def __init__(self):
self._list = []
def lindex(self, index):
"""
Return the item from list at position ``index``
Negative indexes are supported and will return an item at the
end of the list
"""
t... | {
"repo_name": "sebleier/python-redis",
"path": "pyredis/list.py",
"copies": "1",
"size": "4045",
"license": "bsd-3-clause",
"hash": 2210937153912660200,
"line_mean": 30.3565891473,
"line_max": 79,
"alpha_frac": 0.5374536465,
"autogenerated": false,
"ratio": 4.484478935698448,
"config_test": fal... |
from .exceptions import ReservedTagNameError
class TagHandler(object):
def __get__(self, obj, type):
raise NotImplementedError(self._niemsg('get'))
def __set__(self, obj, value):
raise NotImplementedError(self._niemsg('set'))
def __delete__(self, obj):
raise NotImplementedError(... | {
"repo_name": "clee704/mutagenwrapper",
"path": "mutagenwrapper/bases.py",
"copies": "1",
"size": "7867",
"license": "mit",
"hash": 1460790933358485200,
"line_mean": 28.0295202952,
"line_max": 80,
"alpha_frac": 0.5605694674,
"autogenerated": false,
"ratio": 4.034358974358974,
"config_test": fal... |
from .exceptions import RideSessionException
from .tools import build_hub_files_url
class RideSessionResponseModel:
def __init__(self, data):
self._validate(data)
self.sessions = [RideSessionModel(s) for s in data['results']]
def _validate(self, response):
sessions = response['results... | {
"repo_name": "AartGoossens/wblib",
"path": "wblib/data_models.py",
"copies": "1",
"size": "1476",
"license": "mit",
"hash": 8342301471196795000,
"line_mean": 24.4482758621,
"line_max": 70,
"alpha_frac": 0.6151761518,
"autogenerated": false,
"ratio": 3.6534653465346536,
"config_test": false,
... |
from Exceptions import *
from BaseClasses import *
from pyparsing import QuotedString,ParseException
class PartitionCheckItem(ParsedElement):
def __init__(self,tokens=None):
self.containsExternalCode=None
self.isJustExternalCode=None
self.throws=False
self.addReturns=... | {
"repo_name": "nevillegrech/stdl",
"path": "src/STDL/PartitionCheckItem.py",
"copies": "1",
"size": "2389",
"license": "epl-1.0",
"hash": -3349851957030794000,
"line_mean": 36.564516129,
"line_max": 96,
"alpha_frac": 0.5604855588,
"autogenerated": false,
"ratio": 4.666015625,
"config_test": fal... |
from exceptions import ScotchException
def eval(expr, context=None):
return expr.eval(context)
class Expr(object):
def __repr__(self): return str(self)
def eval(self, context=None):
raise ScotchException('Expression type not yet implemented: %s' % self.__class__.__name__)
def generator(self):... | {
"repo_name": "bendmorris/pyscotch",
"path": "lib/expr.py",
"copies": "1",
"size": "4616",
"license": "mit",
"hash": -2662204464189633000,
"line_mean": 29.3684210526,
"line_max": 98,
"alpha_frac": 0.5561091854,
"autogenerated": false,
"ratio": 3.3522149600580975,
"config_test": false,
"has_no... |
from ...exceptions import SdkException
class ReportingException(SdkException):
def __init__(self, message, errors):
super(ReportingException, self).__init__(message)
self._errors = errors
@property
def errors(self):
""" The list of operation errors returned by the reporting servic... | {
"repo_name": "bing-ads-sdk/BingAds-Python-SDK",
"path": "bingads/v12/reporting/exceptions.py",
"copies": "2",
"size": "1993",
"license": "mit",
"hash": 8595520234959153000,
"line_mean": 22.4470588235,
"line_max": 108,
"alpha_frac": 0.5900652283,
"autogenerated": false,
"ratio": 4.678403755868545... |
from ..exceptions import SerializationError, DeserializationError
class Binary(object):
"""A sedes object for binary data of certain length.
:param min_length: the minimal length in bytes or `None` for no lower limit
:param max_length: the maximal length in bytes or `None` for no upper limit
:par... | {
"repo_name": "jnnk/pyrlp",
"path": "rlp/sedes/binary.py",
"copies": "1",
"size": "1540",
"license": "mit",
"hash": 6911023106543572000,
"line_mean": 35.6666666667,
"line_max": 79,
"alpha_frac": 0.6305194805,
"autogenerated": false,
"ratio": 4.063324538258575,
"config_test": false,
"has_no_ke... |
from .exceptions import ServerResponseError, EndpointUnavailableError
from functools import wraps
import logging
try:
from distutils2.version import NormalizedVersion as Version
except ImportError:
from distutils.version import LooseVersion as Version
logger = logging.getLogger('tableau.endpoint')
Success_c... | {
"repo_name": "Talvalin/server-client-python",
"path": "tableauserverclient/server/endpoint/endpoint.py",
"copies": "1",
"size": "4248",
"license": "mit",
"hash": 7476893922533792000,
"line_mean": 37.9724770642,
"line_max": 106,
"alpha_frac": 0.6313559322,
"autogenerated": false,
"ratio": 4.30395... |
from .exceptions import SesError
from .events import Event
from .genuuid import genuuid
from .handlers import handle_event
from collections import defaultdict
from collections import namedtuple
import cq.events
UniqueItem = namedtuple('UniqueItem', '')
class Storage:
class DuplicatedItemError(SesError):
... | {
"repo_name": "lukaszb/cq",
"path": "cq/storages.py",
"copies": "1",
"size": "3194",
"license": "mit",
"hash": 5197814818659202000,
"line_mean": 28.3027522936,
"line_max": 99,
"alpha_frac": 0.6258609894,
"autogenerated": false,
"ratio": 4.131953428201811,
"config_test": false,
"has_no_keyword... |
from ..exceptions import SessionIsAcquired, SessionIsClosed
from ..protocol import close_frame, ENCODING
from ..protocol import STATE_CLOSING, STATE_CLOSED, FRAME_CLOSE, FRAME_MESSAGE
from .. import protocol
class Transport(object):
# the direction of the transport. Used in session locking
# readable means t... | {
"repo_name": "pycodi/sockjs-flask",
"path": "sockjs_flask/transports/base.py",
"copies": "1",
"size": "3099",
"license": "mit",
"hash": -8609848741700534000,
"line_mean": 31.9680851064,
"line_max": 78,
"alpha_frac": 0.5221039045,
"autogenerated": false,
"ratio": 4.942583732057416,
"config_test... |
from exceptions import StandardError
import gzip
import logging
from operator import itemgetter
import os
from subprocess import Popen, PIPE
import urllib2
import xmlrpclib
import zlib
import chksum
from sorting import DefaultSorter
from util import map_
USER_AGENT = 'framboise v0.2'
XMLRPC_URI = 'http://api.opensubt... | {
"repo_name": "luisguilherme/framboise",
"path": "framboise/opensubtitles.py",
"copies": "1",
"size": "4545",
"license": "mit",
"hash": -7640166059350881000,
"line_mean": 33.1729323308,
"line_max": 77,
"alpha_frac": 0.5601760176,
"autogenerated": false,
"ratio": 3.8257575757575757,
"config_test... |
from .exceptions import StatementNotAllowed
from .exceptions import StatementNotFound, UnexpectedClosingFound
class Registry:
def __init__(self):
self._reg = []
def register(self, tagname, tagclass, parent, direct=False):
self._reg.append((tagname, tagclass, parent, direct))
def find(se... | {
"repo_name": "iivvoo/ate",
"path": "ate/registry.py",
"copies": "1",
"size": "1567",
"license": "bsd-3-clause",
"hash": 8015589415695523000,
"line_mean": 33.8222222222,
"line_max": 69,
"alpha_frac": 0.5456285897,
"autogenerated": false,
"ratio": 5.1716171617161715,
"config_test": false,
"has... |
from .exceptions import StorageException
class AssetInstance:
def __init__(self, url, path, abs_path, meta):
self.url = url
self.path = path
self.abs_path = abs_path
self.meta = meta
def __bool__(self):
return True
def __getattr__(self, name):
if name in s... | {
"repo_name": "neoden/lagring",
"path": "lagring/asset.py",
"copies": "1",
"size": "3461",
"license": "mit",
"hash": 803595642606766800,
"line_mean": 28.0924369748,
"line_max": 119,
"alpha_frac": 0.5573533661,
"autogenerated": false,
"ratio": 4.448586118251928,
"config_test": false,
"has_no_k... |
from exceptions import StoreException
from Phone import Phone
class Repo:
def __init__(self):
# self.repo = []
# self.doTests()
self.repo = [
Phone("Samsung", "Galaxy S1", 199),
Phone("Samsung", "Galaxy S2", 299),
Phone("Samsung", "Galaxy S3", 399),
... | {
"repo_name": "Zephyrrus/ubb",
"path": "YEAR 1/SEM1/FP/LAB/L7 - Partial/repo.py",
"copies": "1",
"size": "5135",
"license": "mit",
"hash": -5858228010131677000,
"line_mean": 32.7828947368,
"line_max": 120,
"alpha_frac": 0.5384615385,
"autogenerated": false,
"ratio": 4.226337448559671,
"config_t... |
from exceptions import StructureError
class Operations(object):
def __init__(self, request, session_name):
self.request = request
self.session = self.request.session
self.session_name = session_name
self.session_expiry = 60 * 60 * 24 * 30 * 6
def _storage_read(self):
r... | {
"repo_name": "ksk6794/django-temporary-storage",
"path": "tmp_storage/operations.py",
"copies": "1",
"size": "2128",
"license": "mit",
"hash": 8009146505691117000,
"line_mean": 34.4666666667,
"line_max": 81,
"alpha_frac": 0.5408834586,
"autogenerated": false,
"ratio": 4.084452975047984,
"confi... |
from exceptions import syntax_error
from tokens import (
IMPORT, IDENTIFIER, SEMICOLON, FUNC, OPEN_BRACE, OPEN_CURLY, CLOSE_BRACE,
CLOSE_CURLY, EQUALS, VAR, FOR, IN, NUMBER, QUOTE, WHILE
)
from pyparsing import (
LineEnd, ZeroOrMore, QuotedString, Optional,
delimitedList,
)
from grammar_declarations imp... | {
"repo_name": "Mause/sea_lang",
"path": "python/grammar_definitions.py",
"copies": "1",
"size": "2501",
"license": "mit",
"hash": 6519861374768003000,
"line_mean": 32.7972972973,
"line_max": 78,
"alpha_frac": 0.7005197921,
"autogenerated": false,
"ratio": 3.6298984034833093,
"config_test": fals... |
from .exceptions import TerminationNotice
__all__ = ['Job', 'SuicideJob', 'SimpleJob']
class Job(object):
"Interface for a Job object."
def __init__(self):
pass
def run(self):
"The actual task for the job should be implemented here."
pass
class SuicideJob(Job):
"A worker rece... | {
"repo_name": "Codeusa/Shrinkwrap-worker",
"path": "shrinkwrap-worker/jobs.py",
"copies": "1",
"size": "1161",
"license": "mit",
"hash": 766998890309216500,
"line_mean": 28.7692307692,
"line_max": 75,
"alpha_frac": 0.6037898363,
"autogenerated": false,
"ratio": 3.7451612903225806,
"config_test"... |
from .exceptions import TkStackException
from .helper import CONST, Logger
_log = None
def merge_constraint(nodes_property):
global _log
_log = Logger.get(__name__)
merged_properties = {}
errors = []
for n in nodes_property:
for p in n:
key, value = list(p.items())[0]
... | {
"repo_name": "di-unipi-socc/TosKeriser",
"path": "toskeriser/merger.py",
"copies": "1",
"size": "3602",
"license": "mit",
"hash": 1832026379240235300,
"line_mean": 30.5964912281,
"line_max": 79,
"alpha_frac": 0.4955580233,
"autogenerated": false,
"ratio": 3.594810379241517,
"config_test": fals... |
from .exceptions import TooManyDependencies
from .execution import Locker, Execution, Function
from .msg import Verbosity, print_warn
from glob import iglob
from pathlib import Path
import abc
import os
import pickle
import shutil
class CacheProvider(metaclass=abc.ABCMeta):
def __init__(self, locker=None, verbos... | {
"repo_name": "papousek/spiderpig",
"path": "spiderpig/cache.py",
"copies": "1",
"size": "11790",
"license": "mit",
"hash": -621825795104806100,
"line_mean": 33.3731778426,
"line_max": 165,
"alpha_frac": 0.617302799,
"autogenerated": false,
"ratio": 4.177888022678951,
"config_test": false,
"h... |
from exceptions import TypeError, ValueError
from django.contrib.auth.models import User
from models import PermissionModel # importing custom permission models
from djime.models import Slip as Model #importing a custom model to show princip.
import new
import inspect
# MetaClass and MetaObject is taken form the djang... | {
"repo_name": "googletorp/django-acapella",
"path": "acapella/__init__.py",
"copies": "1",
"size": "9708",
"license": "bsd-3-clause",
"hash": -798832863276068600,
"line_mean": 53.8474576271,
"line_max": 134,
"alpha_frac": 0.4981458591,
"autogenerated": false,
"ratio": 4.758823529411765,
"config... |
from ..exceptions import UnknownMethod, ShellError
from .utils import ShellParser
class Parser(ShellParser):
"""Extract text from pdf files using either the ``pdftotext`` method
(default) or the ``pdfminer`` method.
"""
def extract(self, filename, method='', **kwargs):
if method == '' or met... | {
"repo_name": "pudo/textract",
"path": "textract/parsers/pdf_parser.py",
"copies": "1",
"size": "1338",
"license": "mit",
"hash": -7919428423971132000,
"line_mean": 35.1621621622,
"line_max": 78,
"alpha_frac": 0.5844544096,
"autogenerated": false,
"ratio": 4.415841584158416,
"config_test": fals... |
from .exceptions import UnknownRequestMethodException
from urllib import urlencode
import sendgrid
class API(object):
"""Workaround for using SendGrid official API client.
Args:
endpoint: string representing a valid API endpoint, like '/campaings'
"""
def __init__(self, endpoint):
se... | {
"repo_name": "joaobarbosa/sendgrid-marketing-api",
"path": "sendgridmarketingapi/wrapper.py",
"copies": "1",
"size": "2911",
"license": "mit",
"hash": 6697406915693591000,
"line_mean": 27.8217821782,
"line_max": 77,
"alpha_frac": 0.5915492958,
"autogenerated": false,
"ratio": 4.357784431137724,
... |
from .exceptions import UnsatisfiedResourcesError
class Resource(object):
def __init__(self, cls):
self.cls = cls
self._requests = []
self._exclusive = False
def is_exclusive(self):
return self._exclusive
def is_shared(self):
return len(self._requests) > 0 and not ... | {
"repo_name": "omergertel/chords",
"path": "chords/resource.py",
"copies": "1",
"size": "2377",
"license": "mit",
"hash": -7196979360852113000,
"line_mean": 32.0138888889,
"line_max": 124,
"alpha_frac": 0.5915018931,
"autogenerated": false,
"ratio": 4.4849056603773585,
"config_test": false,
"... |
from exceptions import UnsolvableError
from types import IntVar, BoolVar
from constraints.constraint_base import Constraint
class Store(object):
def __init__(self):
self._variables = dict()
self._unnamedcount = 0
def _name_changed(self, old, new):
if new is None:
new = "_noname%d" % self._unnamedcount
... | {
"repo_name": "dolkow/PyVaP",
"path": "pyvap/store.py",
"copies": "1",
"size": "3260",
"license": "bsd-2-clause",
"hash": 3739812645059666000,
"line_mean": 27.347826087,
"line_max": 74,
"alpha_frac": 0.6588957055,
"autogenerated": false,
"ratio": 3.104761904761905,
"config_test": false,
"has_... |
from .exceptions import ValidateError
from .field import Field, BoundField
import copy
def get_declared_fields(bases, attrs, with_base_fields=True):
fields = [(field_name, attrs.pop(field_name)) for field_name, obj in list(attrs.items()) if isinstance(obj, Field)]
if with_base_fields:
for base in ba... | {
"repo_name": "niwinz/tornado-webtools",
"path": "webtools/formdata/base.py",
"copies": "1",
"size": "2645",
"license": "bsd-3-clause",
"hash": 9220597117494546000,
"line_mean": 28.0659340659,
"line_max": 119,
"alpha_frac": 0.6041587902,
"autogenerated": false,
"ratio": 3.995468277945619,
"conf... |
from exceptions import ValidationError
from .database import Team
from utils import misc
def get_team(id=None, name=None, key=None):
try:
if name:
return Team.get(Team.name == name)
elif id:
return Team.get(Team.id == id)
elif key:
return Team.get(Team.k... | {
"repo_name": "IceCTF/ColdCore",
"path": "data/team.py",
"copies": "1",
"size": "1286",
"license": "mit",
"hash": -3844136407126628400,
"line_mean": 25.7916666667,
"line_max": 74,
"alpha_frac": 0.6314152411,
"autogenerated": false,
"ratio": 3.9937888198757765,
"config_test": false,
"has_no_ke... |
from exceptions import ValidationError
from .database import User, UserAccess
from datetime import datetime, timedelta
import utils
import utils.email
import utils.misc
def get_user(username=None, id=None):
try:
if username:
return User.get(User.username == username)
elif id:
... | {
"repo_name": "IceCTF/ColdCore",
"path": "data/user.py",
"copies": "1",
"size": "4910",
"license": "mit",
"hash": -9166723403915675000,
"line_mean": 33.8226950355,
"line_max": 109,
"alpha_frac": 0.6723014257,
"autogenerated": false,
"ratio": 4.157493649449619,
"config_test": false,
"has_no_ke... |
from .exceptions import ValidationError
from flask import render_template
from datetime import date, time, datetime, timedelta
from dateutil.relativedelta import *
from functools import singledispatch
from jsonschema import validate
class Widget():
def generateHTML(self, formid):
return ''
def parseFo... | {
"repo_name": "mgriley/diva",
"path": "diva/widgets.py",
"copies": "1",
"size": "14603",
"license": "mit",
"hash": -8957245892821071000,
"line_mean": 30.8148148148,
"line_max": 156,
"alpha_frac": 0.6024104636,
"autogenerated": false,
"ratio": 4.074497767857143,
"config_test": false,
"has_no_k... |
from .exceptions import ValidationError
from .msg import Verbosity
import argparse
import os
def get_argument_parser():
p = argparse.ArgumentParser()
p.add_argument(
'--spiderpig-dir',
action='store',
dest='spiderpig_dir',
default='.spiderpig'
)
p.add_argument(
... | {
"repo_name": "papousek/spiderpig",
"path": "spiderpig/config.py",
"copies": "1",
"size": "2676",
"license": "mit",
"hash": -681029639622621600,
"line_mean": 27.4680851064,
"line_max": 135,
"alpha_frac": 0.6038863976,
"autogenerated": false,
"ratio": 4.3441558441558445,
"config_test": true,
"... |
from .exceptions import ValidationError
class NOT_PROVIDED:
pass
class Field(object):
# This counter is used to keep track of the order of declaration of fields.
creation_counter = 0
default_validators = []
def __init__(self, default=NOT_PROVIDED, optional=False, context=[],
render=... | {
"repo_name": "30loops/python-docar",
"path": "docar/fields.py",
"copies": "1",
"size": "6170",
"license": "bsd-3-clause",
"hash": 5462203201955939000,
"line_mean": 30.3197969543,
"line_max": 79,
"alpha_frac": 0.6038897893,
"autogenerated": false,
"ratio": 4.290681502086231,
"config_test": fals... |
from exceptions import ValueError
from django.template import RequestContext, loader, add_to_builtins
from django.template import TemplateSyntaxError, TemplateDoesNotExist
from django.http import HttpResponse, HttpResponseRedirect, HttpResponseNotFound
from django.contrib.contenttypes.models import ContentType
from dja... | {
"repo_name": "fragro/Open-Assembly",
"path": "ver1_0/openassembly/pirate_core/views.py",
"copies": "1",
"size": "4309",
"license": "bsd-3-clause",
"hash": 7617081873330557000,
"line_mean": 37.4732142857,
"line_max": 91,
"alpha_frac": 0.6913436992,
"autogenerated": false,
"ratio": 4.6786102062975... |
from exceptions import ValueError
from django import template
from django.db import models
from django.core.urlresolvers import reverse
from django.contrib.contenttypes.models import ContentType
from customtags.decorators import function_decorator
register = template.Library()
function = function_decorator(register)... | {
"repo_name": "fragro/Open-Assembly",
"path": "ver1_0/openassembly/pirate_core/templatetags/pp_url.py",
"copies": "1",
"size": "7232",
"license": "bsd-3-clause",
"hash": 4947879665757391000,
"line_mean": 37.8817204301,
"line_max": 107,
"alpha_frac": 0.6071626106,
"autogenerated": false,
"ratio": ... |
from ..exceptions import WouldWaitMore
import typing as tp
import time
import copy
import inspect
import warnings
from concurrent.futures import Future
from functools import wraps # import from functools to prevent circular import exception
TimeSignal = tp.Callable[[], float]
class measure:
"""
A class use... | {
"repo_name": "piotrmaslanka/satella",
"path": "satella/time/measure.py",
"copies": "1",
"size": "9705",
"license": "bsd-3-clause",
"hash": 6276488152945403000,
"line_mean": 35.6226415094,
"line_max": 100,
"alpha_frac": 0.5880473982,
"autogenerated": false,
"ratio": 4.409359382099046,
"config_t... |
from .exceptions import WysiwygFormsException
from .utils import field_type_has_choices, is_valid_field_type
from .models import Choice
__all__ = ("Transaction",)
class Transaction(object):
"""
A transaction represents an atomic change that can be applied to a form with
`apply_to`.
"""
# This dic... | {
"repo_name": "wwu-housing/django-wysiwyg-forms",
"path": "wysiwyg_forms/transactions.py",
"copies": "2",
"size": "3742",
"license": "mit",
"hash": -5781220084619723000,
"line_mean": 30.4453781513,
"line_max": 94,
"alpha_frac": 0.6368252272,
"autogenerated": false,
"ratio": 3.497196261682243,
"... |
from ..exceptions.RTMLError import SizeMismatchException
def accuracy(orig_label, pred_label):
if len(orig_label) != len(pred_label):
raise SizeMismatchException('original and predicted values are unequal in size.')
n_o = len(orig_label)
n_p = len(pred_label)
total_count = n_o
acc_count = 0
for i in range(tot... | {
"repo_name": "rapidclock/naive-bayes-classifier",
"path": "rtml/utils/analytics.py",
"copies": "1",
"size": "1408",
"license": "mit",
"hash": 2939768711137143000,
"line_mean": 28.9787234043,
"line_max": 107,
"alpha_frac": 0.6690340909,
"autogenerated": false,
"ratio": 2.8216432865731464,
"conf... |
from .exchange_functions import get_purchase_details, donation_from_POST
from .forms import ComputerRentalForm, PurchaseForm, MainPOSForm, \
BeverageSaleForm, BillForm
from .models import ExchangeInvolvement, Exchange, Pledge
from django import forms
from django.forms.formsets import formset_factory
from django.for... | {
"repo_name": "SlashRoot/WHAT",
"path": "what_apps/commerce/views.py",
"copies": "1",
"size": "7349",
"license": "mit",
"hash": -5288954010226870000,
"line_mean": 37.6789473684,
"line_max": 134,
"alpha_frac": 0.6550551095,
"autogenerated": false,
"ratio": 4.082777777777777,
"config_test": false... |
from exchange import Exchange
from bitstamp.client import Trading as TradingClient
from bitstamp.client import Public as PublicClient
class BitstampExchange(Exchange):
def __init__(self, settings):
super(BitstampExchange, self).__init__(settings)
bs = settings['BITSTAMP']
self._trading = ... | {
"repo_name": "rozap/arb",
"path": "src/exchanges/bitstamp_exchange.py",
"copies": "1",
"size": "1161",
"license": "mit",
"hash": 8029640274325117000,
"line_mean": 28.025,
"line_max": 70,
"alpha_frac": 0.5891472868,
"autogenerated": false,
"ratio": 4.088028169014085,
"config_test": false,
"ha... |
from exchangelib.errors import ErrorDeleteDistinguishedFolder, ErrorObjectTypeChanged, DoesNotExist, \
MultipleObjectsReturned, ErrorItemSave, ErrorItemNotFound
from exchangelib.extended_properties import ExtendedProperty
from exchangelib.items import Message
from exchangelib.folders import Calendar, DeletedItems, ... | {
"repo_name": "ecederstrand/exchangelib",
"path": "tests/test_folder.py",
"copies": "1",
"size": "26857",
"license": "bsd-2-clause",
"hash": -8059986812870396000,
"line_mean": 43.3184818482,
"line_max": 120,
"alpha_frac": 0.5982053096,
"autogenerated": false,
"ratio": 3.971166642022771,
"config... |
from exchangelib.errors import ErrorItemNotFound
from exchangelib.folders import Inbox
from exchangelib.items import Message
from .test_basics import BaseItemTest
class ItemHelperTest(BaseItemTest):
TEST_FOLDER = 'inbox'
FOLDER_CLASS = Inbox
ITEM_CLASS = Message
def test_save_with_update_fields(self... | {
"repo_name": "ecederstrand/exchangelib",
"path": "tests/test_items/test_helpers.py",
"copies": "1",
"size": "5407",
"license": "bsd-2-clause",
"hash": 6039527184384863000,
"line_mean": 45.2136752137,
"line_max": 118,
"alpha_frac": 0.6469391529,
"autogenerated": false,
"ratio": 3.906791907514451,... |
from exchanges import helpers
from exchanges import bitfinex
from exchanges import bitstamp
from exchanges import okcoin
from exchanges import cex
from exchanges import btce
from time import sleep
from datetime import datetime
import csv
# PREPARE OUTPUT FILE
# tell computer where to put CSV
filename = datetime.now(... | {
"repo_name": "Humantrashcan/prices",
"path": "old/request.py",
"copies": "1",
"size": "2240",
"license": "mit",
"hash": 3029217591727002600,
"line_mean": 30.5633802817,
"line_max": 240,
"alpha_frac": 0.7169642857,
"autogenerated": false,
"ratio": 3.2045779685264666,
"config_test": false,
"ha... |
from exchanges import helpers
from exchanges import hitbtc
from exchanges import kraken
from exchanges import opportunity_kraken
import opportunity
from time import sleep
from datetime import datetime
import csv
# PREPARE OUTPUT FILE
# tell computer where to put CSV and to name it
filename = datetime.now().strftime(... | {
"repo_name": "Humantrashcan/prices",
"path": "request.py",
"copies": "1",
"size": "4411",
"license": "mit",
"hash": 7240736072578383000,
"line_mean": 35.1639344262,
"line_max": 114,
"alpha_frac": 0.7338472002,
"autogenerated": false,
"ratio": 2.5321469575200917,
"config_test": false,
"has_no... |
from .exc import IntervalException
strip = lambda a: a.strip()
class IntervalStringParser(object):
def parse_string(self, value):
if ',' not in value:
return self.parse_hyphen_range(value)
else:
return self.parse_bounded_range(value)
def parse_bounded_range(self, valu... | {
"repo_name": "kvesteri/intervals",
"path": "intervals/parser.py",
"copies": "1",
"size": "2542",
"license": "bsd-3-clause",
"hash": 4302834368672802300,
"line_mean": 30.3827160494,
"line_max": 67,
"alpha_frac": 0.4968528718,
"autogenerated": false,
"ratio": 4.345299145299145,
"config_test": fa... |
from .exc import IntervalException
try:
string_types = basestring, # Python 2
except NameError:
string_types = str, # Python 3
strip = lambda a: a.strip()
class IntervalStringParser(object):
def parse_string(self, value):
if ',' not in value:
return self.parse_hyphen_range(value)
... | {
"repo_name": "harshita-gupta/Harvard-FRSEM-Catalog-2016-17",
"path": "flask/lib/python2.7/site-packages/intervals/parser.py",
"copies": "2",
"size": "2646",
"license": "mit",
"hash": 1310044929317819400,
"line_mean": 29.4137931034,
"line_max": 67,
"alpha_frac": 0.5026455026,
"autogenerated": false... |
from .exc import PermissionsError
class PermissionsMeta(type):
"""Applies permissions to class-based view methods.
Does so by looking for a ``permissions`` dict on the view class. If
it exists, the ``@permissions.require`` decorator will be applied
to the specified methods. Here's an example::
... | {
"repo_name": "PSU-OIT-ARC/django-perms",
"path": "permissions/meta.py",
"copies": "2",
"size": "2095",
"license": "mit",
"hash": -1243393805120790500,
"line_mean": 33.9166666667,
"line_max": 72,
"alpha_frac": 0.6085918854,
"autogenerated": false,
"ratio": 4.554347826086956,
"config_test": fals... |
from .exc import PluginError
class Issue(object):
# severities are:
# warning - can be ignored and still release
# error - prevents releasing, issue with source
# critical - unexpected error, might be out of our hands or program bug
def __init__(self, channel, message, severity='warning'... | {
"repo_name": "mbr/unleash",
"path": "unleash/report.py",
"copies": "1",
"size": "2241",
"license": "mit",
"hash": -2793634952251012000,
"line_mean": 32.447761194,
"line_max": 78,
"alpha_frac": 0.5684962071,
"autogenerated": false,
"ratio": 4.554878048780488,
"config_test": false,
"has_no_key... |
from .exc import StrategyError
from .strategy import guess_strategy_type
from .util import parse_file_name_and_section
class Base:
def __init__(self, file_name, section=None, registry=None, strategy_type=None):
original_file_name = file_name
file_name, section = parse_file_name_and_section(file_na... | {
"repo_name": "wylee/django-local-settings",
"path": "src/local_settings/base.py",
"copies": "1",
"size": "1036",
"license": "mit",
"hash": 6971758052547234000,
"line_mean": 42.1666666667,
"line_max": 83,
"alpha_frac": 0.6254826255,
"autogenerated": false,
"ratio": 4.2809917355371905,
"config_t... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.