text stringlengths 0 1.05M | meta dict |
|---|---|
from example import *
# !!! Link managers !!!
adaptor = Adaptor(session, FIRE_URL)
# for each model class that link to firebase, bind a manager
chat_manager = ModelManager(adaptor, Chat, firepath='chats', validator=['msg', 'who'])
# users
aaron = User(name='aaron')
bill = User(name='bill')
colin = User(name='colin')
... | {
"repo_name": "newpro/firebase-alchemy",
"path": "examples/basic.py",
"copies": "1",
"size": "1188",
"license": "mit",
"hash": 3146240360431876000,
"line_mean": 31.1081081081,
"line_max": 86,
"alpha_frac": 0.6843434343,
"autogenerated": false,
"ratio": 3.007594936708861,
"config_test": false,
... |
from example.models import Entry, Comment
from rest_framework_json_api import serializers, views
from rest_framework_json_api.renderers import JSONRenderer
# serializers
class RelatedModelSerializer(serializers.ModelSerializer):
class Meta:
model = Comment
fields = ('id',)
class DummyTestSeriali... | {
"repo_name": "Instawork/django-rest-framework-json-api",
"path": "example/tests/unit/test_renderers.py",
"copies": "1",
"size": "1218",
"license": "bsd-2-clause",
"hash": -4423592280335059500,
"line_mean": 26.0666666667,
"line_max": 80,
"alpha_frac": 0.7044334975,
"autogenerated": false,
"ratio"... |
from example_module import (file_iterator, variadic_addition,
variadic_multiplication)
import random
import unittest
class TestExample(unittest.TestCase):
def test_file_iterator_strips_newlines(self):
"""
Assert the file iterator strips \n from
yielded lines.
... | {
"repo_name": "MadPUG/Introduction-to-Testing-in-Python",
"path": "test_with_unittest.py",
"copies": "1",
"size": "2125",
"license": "mit",
"hash": -5330211677104818000,
"line_mean": 30.25,
"line_max": 72,
"alpha_frac": 0.6042352941,
"autogenerated": false,
"ratio": 4.34560327198364,
"config_te... |
from example_reader.example import Example
import random
class ExampleReader:
question_reader = None
graph_reader = None
mention_reader = None
gold_answer_reader = None
project_names = False
deplambda = None
deplambda_map = {"train": "data/webquestions/siva.train.split.deplambda.conll"}
... | {
"repo_name": "MichSchli/QuestionAnsweringGCN",
"path": "example_reader/example_reader.py",
"copies": "1",
"size": "3533",
"license": "mit",
"hash": -626862827511278800,
"line_mean": 32.3301886792,
"line_max": 160,
"alpha_frac": 0.5216529861,
"autogenerated": false,
"ratio": 4.200951248513674,
... |
from example_reader.gold_path_reader.gold_path import GoldPath
import numpy as np
class GoldPathFinder:
datasets = None
relation_index = None
def __init__(self, relation_index, dataset_map):
self.datasets = {d : self.load(f) for d,f in dataset_map.items()}
self.relation_index = relation_... | {
"repo_name": "MichSchli/QuestionAnsweringGCN",
"path": "example_reader/gold_path_reader/gold_path_finder.py",
"copies": "1",
"size": "1895",
"license": "mit",
"hash": -1187446395534275000,
"line_mean": 30.6,
"line_max": 138,
"alpha_frac": 0.5514511873,
"autogenerated": false,
"ratio": 3.79,
"c... |
from example_reader.graph_reader.database_interface.hypergraph_model import HypergraphModel
import numpy as np
class HypergraphInterface:
data_interface = None
expansion_algorithm = None
prefix = None
def __init__(self, data_interface, expansion_algorithm, prefix=""):
self.data_interface = d... | {
"repo_name": "MichSchli/QuestionAnsweringGCN",
"path": "example_reader/graph_reader/database_interface/hypergraph_interface.py",
"copies": "1",
"size": "4462",
"license": "mit",
"hash": -4556671955464044000,
"line_mean": 46.9784946237,
"line_max": 134,
"alpha_frac": 0.6196772748,
"autogenerated": ... |
from examples.argumentParser import getArguments
from examples.logUtil import configureLogger
from jiradb.analysis import getImportantAccounts
from jiradb.database import *
def waitForSearchQuota(jiradb):
if not jiradb.googleSearchEnabled:
jiradb.session.commit()
log.warn('Exhausted search quota. ... | {
"repo_name": "benmishkanian/ASF-JIRA-mine",
"path": "examples/updateEmployers.py",
"copies": "1",
"size": "1208",
"license": "mit",
"hash": -3754029812779109400,
"line_mean": 36.75,
"line_max": 80,
"alpha_frac": 0.696192053,
"autogenerated": false,
"ratio": 4.01328903654485,
"config_test": fal... |
from examples import FlatTenant, RichMultiTenant, FlatTenantUnattach, RichMultiTenantUnattach
import z3
import time
import random
import sys
import argparse
def ResetZ3 (seed):
z3._main_ctx = None
z3.main_ctx()
z3.set_param('smt.random_seed', seed)
def NonRono(tenants, internal, external, samples):
to... | {
"repo_name": "apanda/modeling",
"path": "tests/fattree_fw_test_nrono.py",
"copies": "1",
"size": "3822",
"license": "bsd-3-clause",
"hash": -7075168980071978000,
"line_mean": 38.4020618557,
"line_max": 115,
"alpha_frac": 0.583725798,
"autogenerated": false,
"ratio": 3.6193181818181817,
"config... |
from examples import IMC, IMCBad
import z3
import time
import random
import sys
def ResetZ3 ():
z3._main_ctx = None
z3.main_ctx()
z3.set_param('smt.random_seed', random.SystemRandom().randint(0, sys.maxint))
iters = 10000
print "missing_rule_time", "misconfigured_redundancy_time", "correct_time", "travers... | {
"repo_name": "apanda/modeling",
"path": "tests/imc_test.py",
"copies": "1",
"size": "1906",
"license": "bsd-3-clause",
"hash": 7154782769383662000,
"line_mean": 30.7666666667,
"line_max": 112,
"alpha_frac": 0.6983210913,
"autogenerated": false,
"ratio": 3.129720853858785,
"config_test": false,... |
from examples import IMCPlus
import z3
import time
import random
import sys
def ResetZ3 ():
z3._main_ctx = None
z3.main_ctx()
z3.set_param('smt.random_seed', random.SystemRandom().randint(0, sys.maxint))
iters = 2
slice_size = 100
# print "missing_rule_time", "misconfigured_redundancy_time", "correct_tim... | {
"repo_name": "apanda/modeling",
"path": "tests/imc_plus_test.py",
"copies": "1",
"size": "1797",
"license": "bsd-3-clause",
"hash": -3704103550232249300,
"line_mean": 34.94,
"line_max": 114,
"alpha_frac": 0.5854201447,
"autogenerated": false,
"ratio": 3.243682310469314,
"config_test": false,
... |
from examples import load_api, basic_wsgi
import pyservice
service = pyservice.Service(**load_api('echo/api.json'))
@service.operation("greet")
def greet(request, response, context):
name = request.name
city = request.city
if not name:
raise service.exceptions.InvalidName("Surely you have a name!... | {
"repo_name": "numberoverzero/pyservice",
"path": "examples/echo/service.py",
"copies": "1",
"size": "1604",
"license": "mit",
"hash": -1679544376571833600,
"line_mean": 30.4509803922,
"line_max": 79,
"alpha_frac": 0.707605985,
"autogenerated": false,
"ratio": 3.9702970297029703,
"config_test":... |
from examples import *
def batch_atari():
cf = Config()
cf.add_argument('--i', type=int, default=0)
cf.add_argument('--j', type=int, default=0)
cf.merge()
games = [
'BreakoutNoFrameskip-v4',
# 'AlienNoFrameskip-v4',
# 'DemonAttackNoFrameskip-v4',
# 'MsPacmanNoFrame... | {
"repo_name": "ShangtongZhang/DeepRL",
"path": "template_jobs.py",
"copies": "1",
"size": "3330",
"license": "mit",
"hash": 4278313854574511600,
"line_mean": 25.4285714286,
"line_max": 116,
"alpha_frac": 0.5027027027,
"autogenerated": false,
"ratio": 3.135593220338983,
"config_test": false,
"... |
from examples import NoRonoTest
import z3
import time
import random
import sys
def ResetZ3 ():
z3._main_ctx = None
z3.main_ctx()
z3.set_param('smt.random_seed', random.SystemRandom().randint(0, sys.maxint))
iters = 10
min_hosts = 200
max_hosts = 1000
print "host dmz_time q_time h_time total"
for hc in xra... | {
"repo_name": "apanda/modeling",
"path": "tests/single_fw_test_short_non_rono_large.py",
"copies": "1",
"size": "1337",
"license": "bsd-3-clause",
"hash": -1608965417602857700,
"line_mean": 26.8541666667,
"line_max": 85,
"alpha_frac": 0.6350037397,
"autogenerated": false,
"ratio": 2.8876889848812... |
from examples import NoRonoTestPath
import z3
import time
import random
import sys
def ResetZ3 ():
z3._main_ctx = None
z3.main_ctx()
z3.set_param('smt.random_seed', random.SystemRandom().randint(0, sys.maxint))
iters = 5
min_hosts = 1
max_hosts = 50
print "rtrs dmz_time q_time h_time total"
for hc in xran... | {
"repo_name": "apanda/modeling",
"path": "tests/single_fw_test_non_rono_pl.py",
"copies": "1",
"size": "1455",
"license": "bsd-3-clause",
"hash": 2225427024776870400,
"line_mean": 27.5294117647,
"line_max": 85,
"alpha_frac": 0.6357388316,
"autogenerated": false,
"ratio": 2.892644135188867,
"con... |
from examples import PFWMultiTenantUnattach
import z3
import time
import random
import sys
import argparse
def ResetZ3 (seed):
z3._main_ctx = None
z3.main_ctx()
z3.set_param('smt.random_seed', seed)
def NonRono(tenants, internal, external, samples):
topo = PFWMultiTenantUnattach(tenants, external, int... | {
"repo_name": "apanda/modeling",
"path": "tests/fattree_pfw_test_nrono.py",
"copies": "1",
"size": "4078",
"license": "bsd-3-clause",
"hash": 6111557911007665000,
"line_mean": 37.4716981132,
"line_max": 115,
"alpha_frac": 0.5769985287,
"autogenerated": false,
"ratio": 3.6410714285714287,
"confi... |
from examples import PolicyIDSShuntTopo
import z3
import time
import random
import sys
import argparse
from itertools import cycle
def ResetZ3 (seed):
z3._main_ctx = None
z3.main_ctx()
z3.set_param('smt.random_seed', seed)
def Rono(internal, external, seed, samples):
times = []
# for (pubI, ... | {
"repo_name": "apanda/modeling",
"path": "tests/rono_ids.py",
"copies": "1",
"size": "2784",
"license": "bsd-3-clause",
"hash": -8755559445098320000,
"line_mean": 32.9512195122,
"line_max": 80,
"alpha_frac": 0.6296695402,
"autogenerated": false,
"ratio": 3.2147806004618937,
"config_test": false... |
from examples import PolicyScaleWithBranch
import z3
from z3 import is_true, is_false
import time
import mcnet.components as components
import random
import sys
"""Check time as increase in nodes"""
def ResetZ3 ():
z3._main_ctx = None
z3.main_ctx()
z3.set_param('auto_config', False)
z3.set_param('smt.mb... | {
"repo_name": "apanda/modeling",
"path": "tests/policy_branch_scaling.py",
"copies": "1",
"size": "1392",
"license": "bsd-3-clause",
"hash": 5404860683877508000,
"line_mean": 32.1428571429,
"line_max": 105,
"alpha_frac": 0.5704022989,
"autogenerated": false,
"ratio": 3.3221957040572794,
"config... |
from examples import RonoDMZTest, RonoQuarantineTest, RonoHostTest
import z3
import time
import random
import sys
def ResetZ3 ():
z3._main_ctx = None
z3.main_ctx()
z3.set_param('smt.random_seed', random.SystemRandom().randint(0, sys.maxint))
iters = 10
min_hosts = 200
max_hosts = 1000
print "host dmz_time... | {
"repo_name": "apanda/modeling",
"path": "tests/single_fw_test_short_large.py",
"copies": "1",
"size": "1482",
"license": "bsd-3-clause",
"hash": -861413512842037600,
"line_mean": 29.2448979592,
"line_max": 94,
"alpha_frac": 0.6282051282,
"autogenerated": false,
"ratio": 2.9058823529411764,
"co... |
from examples_info import Features
from collections import OrderedDict
examples = OrderedDict()
examples["3d/subduction/step01"] = {
"General": {
"Dimension": 3,
"Coordinate system": Features.CS_PROJ,
"Mesh generator": Features.MESH_CUBIT,
"Cells": Features.CELL_TET,
"Probl... | {
"repo_name": "geodynamics/pylith",
"path": "doc/userguide/examples/3d_subduction.py",
"copies": "1",
"size": "10981",
"license": "mit",
"hash": -1515003510472374800,
"line_mean": 26.1135802469,
"line_max": 71,
"alpha_frac": 0.5522265732,
"autogenerated": false,
"ratio": 3.4390854995302225,
"co... |
from examples.intersections import SentenceSplitIntersection, AggregateIntersection, WordCountIntersection
from examples.ramps import WordRamp
from motorway.contrib.sql_alchemy.intersections import DatabaseInsertIntersection
from motorway.intersection import Intersection
from motorway.messages import Message
from motor... | {
"repo_name": "plecto/motorway",
"path": "examples/database.py",
"copies": "1",
"size": "2377",
"license": "apache-2.0",
"hash": 3582787090379111400,
"line_mean": 28.7125,
"line_max": 116,
"alpha_frac": 0.6028607488,
"autogenerated": false,
"ratio": 4.148342059336824,
"config_test": false,
"h... |
from examples_shared import init_parser, init_client, print_response
def list_instances(client):
"""
List all VPS instances.
"""
return client.vps.instances()
def details(client, instance_id):
"""
Get instance details.
"""
return client.vps.details(instance_id=instance_id)
def get_... | {
"repo_name": "duct-tape/resello",
"path": "examples/vps.py",
"copies": "1",
"size": "1258",
"license": "bsd-3-clause",
"hash": 6739440837421800000,
"line_mean": 23.6666666667,
"line_max": 74,
"alpha_frac": 0.6224165342,
"autogenerated": false,
"ratio": 3.7664670658682633,
"config_test": false,... |
from examples.stencil_grid.stencil_kernel import *
from examples.stencil_grid.stencil_grid import StencilGrid
from ctree.util import Timer
import sys
import numpy
import math
width = int(sys.argv[2])
height = int(sys.argv[3])
image_in = open(sys.argv[1], 'rb')
stdev_d = 3
stdev_s = 70
radius = stdev_d * 3
class Kern... | {
"repo_name": "mbdriscoll/ctree",
"path": "examples/stencil_grid/bilateral_filter.py",
"copies": "2",
"size": "3304",
"license": "bsd-2-clause",
"hash": 7032327451317327000,
"line_mean": 30.7692307692,
"line_max": 81,
"alpha_frac": 0.6234866828,
"autogenerated": false,
"ratio": 2.9342806394316163... |
from examples.stencil_grid.stencil_kernel import *
from examples.stencil_grid.stencil_grid import StencilGrid
import sys
import numpy
import math
import time
import random
width = 1600
height = 1600
time_steps = 500
class Kernel(StencilKernel):
def kernel(self, in_img, out_img):
for x in out_img.interio... | {
"repo_name": "mbdriscoll/ctree",
"path": "examples/stencil_grid/2d_heat.py",
"copies": "2",
"size": "1377",
"license": "bsd-2-clause",
"hash": -2484224370750714000,
"line_mean": 24.9811320755,
"line_max": 62,
"alpha_frac": 0.5882352941,
"autogenerated": false,
"ratio": 2.917372881355932,
"conf... |
from example_tree import letter_tree
from utils import is_word
def depth_first_search(tree, target):
"""
Exercise 1: Implement your depth first search algorithm here
"""
if tree is None:
return None
print("DFS: Checking node with value '{}'".format(tree.value))
if tree.value == target:... | {
"repo_name": "PyClass/PyClassLessons",
"path": "course/algorithms/tree-search-algorithms/solutions.py",
"copies": "3",
"size": "1662",
"license": "mit",
"hash": -3477651965509218300,
"line_mean": 26.7,
"line_max": 70,
"alpha_frac": 0.623345367,
"autogenerated": false,
"ratio": 3.803203661327231,... |
from example_tree import letter_tree
from utils import is_word
def depth_first_search(tree, target):
"""
Exercise 1: Implement your depth first search algorithm here
The 'tree' parameter contains 'tree.left' and 'tree.right'
child elements - they may be unset (None) if the node does
not have left... | {
"repo_name": "noisebridge/PythonClass",
"path": "course/algorithms/tree-search-algorithms/exercise.py",
"copies": "3",
"size": "1213",
"license": "mit",
"hash": -5580784253115495000,
"line_mean": 28.5853658537,
"line_max": 74,
"alpha_frac": 0.6776586974,
"autogenerated": false,
"ratio": 3.814465... |
from ExcelBot import *
from ..TexBot import *
from ..KasBot import *
from utils import *
import xlrd
# Known bugs -
# Doesn't tackle empty cells - currently they throw a list_index error, need to check xlrd manuals to see if there is a special case or if this can be identified before running the test - old Kasbot may ... | {
"repo_name": "AronTrask/Kaspbot",
"path": "libkasbot/ExcelBot/ExcelInternalData.py",
"copies": "1",
"size": "7137",
"license": "mit",
"hash": 377231792071254660,
"line_mean": 45.0451612903,
"line_max": 281,
"alpha_frac": 0.5974499089,
"autogenerated": false,
"ratio": 3.954016620498615,
"config... |
from excel_csv import from_csv
import pandas as pd
import random as rn
#|Data class is used to store all data, partition data when needed,
#|and convert DataFrames into numpy arrays for statistics modules
class data_manager(object):
#|Data class internal stores all external and internal DataFrames (df), all creat... | {
"repo_name": "rosspalmer/DataTools",
"path": "depr/0.1.3/dtools/data/base.py",
"copies": "1",
"size": "4445",
"license": "mit",
"hash": -2352457901193768000,
"line_mean": 32.6742424242,
"line_max": 113,
"alpha_frac": 0.5714285714,
"autogenerated": false,
"ratio": 3.547486033519553,
"config_tes... |
from excel_sync.db.models.fields import SpreadsheetMixin
class SpreadsheetModelMixin:
@staticmethod
def import_spreadsheet_data(klass):
source = get_spreadsheet_datasource(klass)
fields_with_spreadsheet_metadata = get_fields_with_spreadsheet_metadata(klass)
field_settings = build_field... | {
"repo_name": "FriedrichK/django-excel-sync",
"path": "excel_sync/db/models/mixins.py",
"copies": "1",
"size": "1270",
"license": "bsd-3-clause",
"hash": -1544804484713332200,
"line_mean": 32.4210526316,
"line_max": 86,
"alpha_frac": 0.7141732283,
"autogenerated": false,
"ratio": 4.01898734177215... |
from excepthook import uncaught_exception, install_thread_excepthook
import sys
sys.excepthook = uncaught_exception
install_thread_excepthook()
import boardgen
import getpass
from PIL import Image, ImageDraw, ImageFont
import StringIO
import urllib2, urllib
import json
import random
import traceback
impor... | {
"repo_name": "ffao/Shiro",
"path": "bot.py",
"copies": "1",
"size": "22656",
"license": "mit",
"hash": -8972417136967233000,
"line_mean": 32.3272727273,
"line_max": 240,
"alpha_frac": 0.5609110169,
"autogenerated": false,
"ratio": 3.489833641404806,
"config_test": false,
"has_no_keywords": f... |
from .exception import BadMove
class Board(object):
"""
A board that can:
place pieces
display itself
move pieces
"""
empty_square_char = '.'
def __init__(self, height, width):
self.height = height
self.width = width
# self._board is a list of lists... | {
"repo_name": "tomviner/chess",
"path": "chess/board.py",
"copies": "1",
"size": "2478",
"license": "mit",
"hash": 263879161236612450,
"line_mean": 26.8426966292,
"line_max": 76,
"alpha_frac": 0.51291364,
"autogenerated": false,
"ratio": 3.908517350157729,
"config_test": false,
"has_no_keywor... |
from .exception import ChildError, PathError
from .util import itervalues
from .util import name_to_path_name
class GuerillaNode(object):
"""Class representing a parsed Guerilla node.
:ivar id: Node id (value in parsed expression ``oid[<id>]=``).
:vartype id: int
:ivar type: Node type.
:vartype ... | {
"repo_name": "Narann/guerilla_parser",
"path": "src/guerilla_parser/node.py",
"copies": "1",
"size": "5135",
"license": "mit",
"hash": 4198227611035746300,
"line_mean": 28.5114942529,
"line_max": 80,
"alpha_frac": 0.5501460565,
"autogenerated": false,
"ratio": 4.127813504823151,
"config_test":... |
from .exception import DataTypeError
__all__ = (
'DataType',
'String',
'Integer',
'Float',
'Boolean',
'List',
'Choice',
)
class DataType(object):
def sanitize(self, value):
raise NotImplementedError()
def is_valid(self, value):
try:
self.sanitize(valu... | {
"repo_name": "jayclassless/setoptconf",
"path": "setoptconf/datatype.py",
"copies": "1",
"size": "3346",
"license": "mit",
"hash": -4422121515942864000,
"line_mean": 23.7851851852,
"line_max": 73,
"alpha_frac": 0.5158398087,
"autogenerated": false,
"ratio": 4.577291381668947,
"config_test": fa... |
from exception import Error_LinkList
class Node(object):
__slots__ = "word", "docId","count","_next"
def __init__(self,word = None,docId =None,count= None,node=None):
self.word = str(word)
self.docId = int(docId)
self.count = int(count)
self._next = node
@property
def next_node(self):
return self._next
@... | {
"repo_name": "hanhaohh/cvhelper",
"path": "app/Crawler/linkedlist.py",
"copies": "1",
"size": "2678",
"license": "apache-2.0",
"hash": 4623951406971430000,
"line_mean": 22.2869565217,
"line_max": 114,
"alpha_frac": 0.6019417476,
"autogenerated": false,
"ratio": 2.484230055658627,
"config_test"... |
from .exception import HSException
from .exception import NoAuthMethod
from .exception import HTTPError
from .exception import BadRequest
from .exception import Unauthorized
from .exception import PaymentRequired
from .exception import Forbidden
from .exception import NotFound
from .exception import MethodNotAllowed
fr... | {
"repo_name": "arshsingh/hellosign-python-sdk",
"path": "hellosign_sdk/utils/__init__.py",
"copies": "2",
"size": "2970",
"license": "mit",
"hash": -8097651198821757000,
"line_mean": 37.0769230769,
"line_max": 132,
"alpha_frac": 0.6663299663,
"autogenerated": false,
"ratio": 4.406528189910979,
... |
from .exception import InflateError, DeflateError, RequiredProperty
from datetime import datetime, date
import os
import types
import pytz
import json
import sys
import functools
import logging
logger = logging.getLogger(__name__)
if sys.version_info >= (3, 0):
unicode = lambda x: str(x)
def display_for(key):
... | {
"repo_name": "andrefsp/neomodel",
"path": "neomodel/properties.py",
"copies": "3",
"size": "9291",
"license": "mit",
"hash": -791080225607397400,
"line_mean": 30.7098976109,
"line_max": 105,
"alpha_frac": 0.6047788182,
"autogenerated": false,
"ratio": 4.279594656840166,
"config_test": false,
... |
from .exception import MissingRequiredError, ReadOnlyError
from .util import UnicodeMixin
__all__ = (
'Configuration',
)
class Configuration(UnicodeMixin):
def __init__(self, settings, parent=None):
self.__dict__['_parent'] = parent
self.__dict__['_settings'] = {}
for setting in set... | {
"repo_name": "jayclassless/setoptconf",
"path": "setoptconf/config.py",
"copies": "1",
"size": "2448",
"license": "mit",
"hash": 566680085843557950,
"line_mean": 28.1428571429,
"line_max": 66,
"alpha_frac": 0.5461601307,
"autogenerated": false,
"ratio": 4.317460317460317,
"config_test": false,... |
from exception import *
from vnc_api import vnc_api
class vncObj():
@staticmethod
def get(**kwargs):
_requiredArgs = ['username', 'tenantName', 'password', 'apiHost' ]
try:
userName = kwargs['username']
tenantName = kwargs['tenantName']
password = kwargs['p... | {
"repo_name": "madhukar32/contrail-hybrid-cloud",
"path": "src/contrail/util.py",
"copies": "1",
"size": "2427",
"license": "apache-2.0",
"hash": -1927467800435731000,
"line_mean": 32.7083333333,
"line_max": 95,
"alpha_frac": 0.6596621343,
"autogenerated": false,
"ratio": 3.7511591962905717,
"c... |
from .exception import NoConnectionError
from .helper import log
class Core(object):
def __init__(self, driver):
self._driver = driver
def emit(self, event_name, data = None, options = None, error_suppressed = True):
""" Emit a message to a particular (shared) event.
.. code-b... | {
"repo_name": "shiroyuki/vireo",
"path": "vireo/core.py",
"copies": "1",
"size": "1735",
"license": "mit",
"hash": -8093120218401463000,
"line_mean": 33.0196078431,
"line_max": 97,
"alpha_frac": 0.5648414986,
"autogenerated": false,
"ratio": 4.262899262899263,
"config_test": false,
"has_no_ke... |
from exception import ParserException
from device import Firewall, Gateway, FirewallInterface
from security import ACL, InterfaceACL, SecurityZone, SecurityConduit, ConduitFirewallArchitecture, RuleInteraction
from enums import RuleOperation, RuleInteractionType, GraphAttribute, SecurityElement, ServiceProtocol, RuleEf... | {
"repo_name": "dinesharanathunga/firewallconfigdecryptor",
"path": "firewallconfigdecryptor/config_parser.py",
"copies": "1",
"size": "172857",
"license": "mit",
"hash": -4181854804727425000,
"line_mean": 56.7923771314,
"line_max": 254,
"alpha_frac": 0.5117004229,
"autogenerated": false,
"ratio":... |
from .exception import SATOSAError
class SATOSABadContextError(SATOSAError):
"""
Raise this exception if validating the Context and failing.
"""
pass
"""
Holds methods for sending internal data through the satosa proxy
"""
class Context(object):
"""
Holds information about the current reques... | {
"repo_name": "SUNET/SATOSA",
"path": "src/satosa/context.py",
"copies": "3",
"size": "2076",
"license": "apache-2.0",
"hash": -7602112606228825000,
"line_mean": 23.7142857143,
"line_max": 80,
"alpha_frac": 0.5775529865,
"autogenerated": false,
"ratio": 4.219512195121951,
"config_test": false,
... |
from exception import SMPPException
class SMPPError:
ESME_ROK = 0x00000000
ESME_RINVMSGLEN = 0x00000001
ESME_RINVCMDLEN = 0x00000002
ESME_RINVCMDID = 0x00000003
ESME_RINVBNDSTS = 0x00000004
ESME_RALYBND = 0x00000005
ESME_RINVPRTFLG = 0x00000006
ESME_RINVREGDLVFLG = 0x00000007
ESME_RSYSERR = 0x... | {
"repo_name": "henrythor/SMPP.py",
"path": "smpp/error.py",
"copies": "1",
"size": "4474",
"license": "mit",
"hash": -722038937787363000,
"line_mean": 38.592920354,
"line_max": 110,
"alpha_frac": 0.7469825659,
"autogenerated": false,
"ratio": 2.351024697845507,
"config_test": false,
"has_no_k... |
from ..exception import SurvoxAPIRuntime, SurvoxAPINotFound
from ..base import SurvoxAPIBase
class SurvoxAPISurveyQuotaList(SurvoxAPIBase):
"""
Class to work with quota list for a survey
"""
def __init__(self, sid, base_url=None, headers=None, verbose=True):
if not sid:
raise Surv... | {
"repo_name": "cbeauvais/zAWygzxkeSjUBGGVsgMGTF56xvR",
"path": "survox_api/resources/survey/quota.py",
"copies": "1",
"size": "5547",
"license": "mit",
"hash": 4109362015928010000,
"line_mean": 35.0194805195,
"line_max": 114,
"alpha_frac": 0.5981611682,
"autogenerated": false,
"ratio": 4.03711790... |
from ..exception import ValidationException
from .candidate_factory import CandidateFactory
from ..candidate import Candidate
class ListFactory(CandidateFactory):
"""
Generates candidates with data represented by integer list.
:param random: Random number generator
:param max_value: int maximum value... | {
"repo_name": "Eyjafjallajokull/pyga",
"path": "pyga/candidate_factory/list.py",
"copies": "1",
"size": "1464",
"license": "mit",
"hash": -7161238165960802000,
"line_mean": 37.5263157895,
"line_max": 106,
"alpha_frac": 0.6536885246,
"autogenerated": false,
"ratio": 4.112359550561798,
"config_te... |
from ..exception import ValidationException
from .crossover import Crossover
class ListCrossover(Crossover):
"""
Crossover for candidates which data is represented by lists.
List items are not evaluated in any way, so it can any type of data.
:param probability: Probability of crossover occurring for... | {
"repo_name": "Eyjafjallajokull/pyga",
"path": "pyga/operator/list_crossover.py",
"copies": "1",
"size": "1803",
"license": "mit",
"hash": -7730731340633858000,
"line_mean": 31.7818181818,
"line_max": 90,
"alpha_frac": 0.615640599,
"autogenerated": false,
"ratio": 4.097727272727273,
"config_tes... |
from .exception import WimException
from .util import now
class UnknownCommand:
def __init__(self, expression, selector, obj, wnck_wrapper):
self.expression = expression
def run(self):
command = self.expression.get('command')
raise WimException("Unknown command: %s" % command)
class... | {
"repo_name": "bitptr/wim",
"path": "wim/command.py",
"copies": "1",
"size": "5899",
"license": "bsd-3-clause",
"hash": -8137598733264972000,
"line_mean": 28.6432160804,
"line_max": 75,
"alpha_frac": 0.6706221393,
"autogenerated": false,
"ratio": 3.9092113982770047,
"config_test": false,
"has... |
from ..exceptions.base import InvalidToken
from ..exceptions.invalid_request import CredentialsNotProvided
from ..models import AccessToken
from ..utils import request_error_header
class BearerHandler:
def access_token(self, value, request):
"""
Try to get the `AccessToken` associated with the pr... | {
"repo_name": "Rediker-Software/doac",
"path": "doac/handlers/bearer.py",
"copies": "1",
"size": "2066",
"license": "mit",
"hash": -7065803880772415000,
"line_mean": 30.7846153846,
"line_max": 87,
"alpha_frac": 0.6200387222,
"autogenerated": false,
"ratio": 5.0390243902439025,
"config_test": fa... |
from .exceptions.custom_exceptions import APIValidationError
from .utils import SuccessResponse, ErrorResponse
from django.utils.decorators import method_decorator
from django.views.decorators.cache import never_cache
from django.views.decorators.debug import sensitive_post_parameters
from rest_framework import status
... | {
"repo_name": "triflesoft/django-application-talos",
"path": "applications/talos_rest/views.py",
"copies": "1",
"size": "24322",
"license": "bsd-3-clause",
"hash": 8262957089727847000,
"line_mean": 37.1836734694,
"line_max": 148,
"alpha_frac": 0.6734232382,
"autogenerated": false,
"ratio": 4.6890... |
from .exceptions import AlreadyRegistered, NotRegistered
from .signals import content_required, existence_required, source_saved
from .utils import autodiscover, call_strategy_method
class GeneratorRegistry(object):
"""
An object for registering generators. This registry provides
a convenient way for a di... | {
"repo_name": "Amechi101/concepteur-market-app",
"path": "venv/lib/python2.7/site-packages/imagekit/registry.py",
"copies": "7",
"size": "6755",
"license": "mit",
"hash": 175676437806241860,
"line_mean": 32.6069651741,
"line_max": 80,
"alpha_frac": 0.6445595855,
"autogenerated": false,
"ratio": 4... |
from ._exceptions import AMQPError, AMQPChannelError
from .spec import EXCEPTIONS, CONSTANTS_INVERSE
__all__ = [
"AMQPError",
"ConnectionLostError",
"ChannelClosed",
"ConnectionClosed",
"AMQPChannelError",
"AMQPConnectionError",
"UndeliverableMessage",
"Deleted"
]
__all__.extend(EXCEPT... | {
"repo_name": "TarasLevelUp/asynqp",
"path": "src/asynqp/exceptions.py",
"copies": "1",
"size": "1360",
"license": "mit",
"hash": 3408033461120465400,
"line_mean": 21.2950819672,
"line_max": 77,
"alpha_frac": 0.6845588235,
"autogenerated": false,
"ratio": 3.8857142857142857,
"config_test": fals... |
from .exceptions import APIException
from .api_client import ApiClient
class BaseAPI(object):
"""
BaseApi class, all the other api class extends it
"""
resource_url = None
resource_cls = None
_client = None
_username = None
_password = None
_api_base_url = None
_token = None
... | {
"repo_name": "nikhiln/awaazde-api-client-sdk",
"path": "sdk-python/awaazde/base.py",
"copies": "1",
"size": "3436",
"license": "apache-2.0",
"hash": -658119222271378800,
"line_mean": 29.6785714286,
"line_max": 96,
"alpha_frac": 0.5506402794,
"autogenerated": false,
"ratio": 3.9722543352601156,
... |
# from exceptions import ApiException
from client import Client
import json
class Lexicon(Client):
"""Lexicon class"""
def __init__(self, language='hr'):
super(Lexicon, self).__init__()
self.language = language
def queryEntries(self, surface=None, lemma=None, msd=None, rhymes_with=None, n... | {
"repo_name": "clarinsi/reldi-lib",
"path": "reldi/lexicon.py",
"copies": "1",
"size": "1528",
"license": "apache-2.0",
"hash": 7368071587314618000,
"line_mean": 34.5581395349,
"line_max": 102,
"alpha_frac": 0.5890052356,
"autogenerated": false,
"ratio": 3.5045871559633026,
"config_test": false... |
# from exceptions import ApiException
from client import Client
import json
class Tagger(Client):
"""Lexicon class"""
def __init__(self, language='hr'):
super(Tagger, self).__init__()
self.language = language
def tag(self, text, format='json'):
if not self._auth.hasToken():
... | {
"repo_name": "clarinsi/reldi-lib",
"path": "reldi/tagger.py",
"copies": "1",
"size": "1160",
"license": "apache-2.0",
"hash": -5431282845500430000,
"line_mean": 24.2173913043,
"line_max": 79,
"alpha_frac": 0.5698275862,
"autogenerated": false,
"ratio": 4.478764478764479,
"config_test": false,
... |
# from exceptions import ApiException
from connection import Connection, config
from auth import Auth
import uuid
class Client(object):
def __init__(self):
self._username = None
self._password = None
self._connection = Connection.getInstance()
self._auth = Auth()
def authorize(... | {
"repo_name": "clarinsi/reldi-lib",
"path": "reldi/client.py",
"copies": "1",
"size": "1350",
"license": "apache-2.0",
"hash": -8230529245156065000,
"line_mean": 34.5263157895,
"line_max": 101,
"alpha_frac": 0.6044444444,
"autogenerated": false,
"ratio": 4.607508532423208,
"config_test": false,... |
from .exceptions import ApiKeyIncludedException
class ValidateApiKey(object):
"""Validates content to ensure SendGrid API key is not present"""
regexes = None
def __init__(self, regex_strings=None, use_default=True):
"""Create an API key validator
:param regex_strings: list of regex... | {
"repo_name": "sendgrid/sendgrid-python",
"path": "sendgrid/helpers/mail/validators.py",
"copies": "2",
"size": "2652",
"license": "mit",
"hash": -7342124775062611000,
"line_mean": 37.4347826087,
"line_max": 80,
"alpha_frac": 0.5731523379,
"autogenerated": false,
"ratio": 4.702127659574468,
"co... |
from exceptions import AttributeNotExistInModel
# reversed name of attributes in factories that will not be converted to FactoryAttribute
RESERVED_NAMES_FOR_FACTORIES = ["factory_attributes", "Meta", "MetaDefault", "factory", "factory_object_id"]
class DummyObject(object):
"""Object generated by Factory if model... | {
"repo_name": "perses76/mulish-tester",
"path": "mulishtester/core.py",
"copies": "1",
"size": "12762",
"license": "mit",
"hash": -429157868042461700,
"line_mean": 31.3934010152,
"line_max": 120,
"alpha_frac": 0.608211879,
"autogenerated": false,
"ratio": 4.3027646662171275,
"config_test": fals... |
from ..exceptions import AuthAlreadyAssociated, AuthException, AuthForbidden
def social_details(backend, details, response, *args, **kwargs):
return {'details': dict(backend.get_user_details(response), **details)}
def social_uid(backend, details, response, *args, **kwargs):
return {'uid': backend.get_user_i... | {
"repo_name": "LennonChin/Django-Practices",
"path": "MxShop/extra_apps/social_core/pipeline/social_auth.py",
"copies": "4",
"size": "3334",
"license": "apache-2.0",
"hash": 498481567109164740,
"line_mean": 36.8863636364,
"line_max": 79,
"alpha_frac": 0.6145770846,
"autogenerated": false,
"ratio"... |
from .exceptions import BaseError, ValidationError, ModelConversionError
from .transforms import import_loop
def validate(cls, instance_or_dict, partial=False, strict=False, context=None):
"""
Validate some untrusted data using a model. Trusted data can be passed in
the `context` parameter.
:param cl... | {
"repo_name": "eatfirst/schematics",
"path": "schematics/validate.py",
"copies": "1",
"size": "3655",
"license": "bsd-3-clause",
"hash": -1039961001231324300,
"line_mean": 31.3451327434,
"line_max": 79,
"alpha_frac": 0.6355677155,
"autogenerated": false,
"ratio": 4.269859813084112,
"config_test... |
from .exceptions import CardLinkError, CardValidityError
import re
import string
CARD_WHITE=0
CARD_BLACK=1
CARD_PLACEHOLDER_LENGTH=3
class Card(object):
def __init__(self, id=-1, text='', type=CARD_WHITE):
self.id=id
self.__text=text
self.type=type
self.unlinkAll()
def isValid(self, text=None):... | {
"repo_name": "Timtam/cards-against-humanity",
"path": "shared/card.py",
"copies": "1",
"size": "3595",
"license": "mit",
"hash": -1673686008464383700,
"line_mean": 30.2608695652,
"line_max": 120,
"alpha_frac": 0.6631432545,
"autogenerated": false,
"ratio": 3.687179487179487,
"config_test": fal... |
from ..exceptions import CheckError
def is_empty(check_obj):
try:
assert len(check_obj._val) == 0
return check_obj
except Exception as e:
raise CheckError('{} is not empty'.format(check_obj._val)) from e
def is_not_empty(check_obj):
try:
assert len(check_obj._val) != 0
... | {
"repo_name": "csparpa/check",
"path": "fluentcheck/assertions_check/sequences.py",
"copies": "1",
"size": "2599",
"license": "mit",
"hash": 5720590904722279000,
"line_mean": 26.0729166667,
"line_max": 101,
"alpha_frac": 0.6263947672,
"autogenerated": false,
"ratio": 3.794160583941606,
"config_... |
from exceptions import CommandError, ParameterError, InvalidCommand
def isInt(str):
try:
int(str)
return True
except ValueError:
return False
class CommandHandler:
commands = {}
def __init__(self):
self.testParse()
pass
@staticmethod
... | {
"repo_name": "Zephyrrus/ubb",
"path": "YEAR 1/SEM1/FP/LAB/l2-l5/CommandHandler.py",
"copies": "1",
"size": "3445",
"license": "mit",
"hash": 2481729231084748000,
"line_mean": 36.2777777778,
"line_max": 141,
"alpha_frac": 0.5367198839,
"autogenerated": false,
"ratio": 5.211800302571861,
"config... |
from exceptions import CommandError, ParameterError
import time
import copy # deepcopy
from CommandHandler import CommandHandler
"""
Parsers
They are used to validate every arg before sending it to the Expenses functions
"""
@CommandHandler.addCommand("add")
def parseAdd(expenseInstance, args):
"""
... | {
"repo_name": "Zephyrrus/ubb",
"path": "YEAR 1/SEM1/FP/LAB/l2-l5/Commands.py",
"copies": "1",
"size": "12221",
"license": "mit",
"hash": -7447711357056199000,
"line_mean": 42.3404255319,
"line_max": 184,
"alpha_frac": 0.5929138368,
"autogenerated": false,
"ratio": 4.17098976109215,
"config_test... |
from exceptions import CommandError, ParameterError, UnexpectedUserExit
import os
clear = lambda: os.system('clear') # little hack because I hate writing. clear() can be used anywhere to clear the current console. Works even in IDE consoles
class MenuUI:
def __init__(self, commandHandler, familyInstance):
... | {
"repo_name": "Zephyrrus/ubb",
"path": "YEAR 1/SEM1/FP/LAB/l2-l5/MenuUI.py",
"copies": "1",
"size": "12543",
"license": "mit",
"hash": 6058480336602707000,
"line_mean": 40.399339934,
"line_max": 208,
"alpha_frac": 0.5229211512,
"autogenerated": false,
"ratio": 4.7673888255416195,
"config_test":... |
from exceptions import CommandError, ParameterError, UnexpectedUserExit
from CommandLineUI import CommandLineUI
from MenuUI import MenuUI
import os
clear = lambda: os.system('clear') # little hack because I hate writing. clear() can be used anywhere to clear the current console. Works even in IDE consoles
clas... | {
"repo_name": "Zephyrrus/ubb",
"path": "YEAR 1/SEM1/FP/LAB/l2-l5/UIHandler.py",
"copies": "1",
"size": "3079",
"license": "mit",
"hash": -9210316550784937000,
"line_mean": 44.6818181818,
"line_max": 158,
"alpha_frac": 0.6027931146,
"autogenerated": false,
"ratio": 4.72239263803681,
"config_test... |
from .exceptions import ConfigurationError, GrammarError, assert_config
from .utils import get_regexp_width, Serialize
from .parsers.grammar_analysis import GrammarAnalyzer
from .lexer import LexerThread, TraditionalLexer, ContextualLexer, Lexer, Token, TerminalDef
from .parsers import earley, xearley, cyk
from .parser... | {
"repo_name": "erezsh/lark",
"path": "lark/parser_frontends.py",
"copies": "1",
"size": "8730",
"license": "mit",
"hash": 2889158800830499000,
"line_mean": 35.22406639,
"line_max": 144,
"alpha_frac": 0.6428407789,
"autogenerated": false,
"ratio": 3.7940026075619295,
"config_test": false,
"has... |
from ..exceptions import ConfigurationError
RANGE_255 = list(range(256))
class Modifier:
_submod = None
subcodes = None
code = None
submod = property()
def __init__(self, submod=None):
self.submod = submod
@classmethod
def _get_code_str(cls, src):
"""
:param s... | {
"repo_name": "idlesign/uwsgiconf",
"path": "uwsgiconf/options/routing_modifiers.py",
"copies": "1",
"size": "9018",
"license": "bsd-3-clause",
"hash": 4312361276879377000,
"line_mean": 19.8267898383,
"line_max": 104,
"alpha_frac": 0.626746507,
"autogenerated": false,
"ratio": 3.8687258687258685,... |
from .exceptions import ConnectionError, TimeoutError, PacketError
from .heartbeats import HeartbeatThread
from .logs import LoggingMixin
from .namespaces import (
EngineIONamespace, SocketIONamespace, LoggingSocketIONamespace,
find_callback)
from .parsers import (
parse_host, parse_engineIO_session,
fo... | {
"repo_name": "OzieGamma/teethris-client",
"path": "lib/socketIO_client-0.6.5/socketIO_client/__init__.py",
"copies": "6",
"size": "18043",
"license": "apache-2.0",
"hash": -9181893385682364000,
"line_mean": 34.0349514563,
"line_max": 79,
"alpha_frac": 0.5891481461,
"autogenerated": false,
"ratio... |
from ..exceptions import ConversionException, ParserError
from .base import BaseParser
class BatmanParser(BaseParser):
""" batman-adv parser """
protocol = 'batman-adv'
version = '2015.0'
metric = 'TQ'
# the default expected format
_format = 'alfred_vis'
def to_python(self, data):
... | {
"repo_name": "ninuxorg/netdiff",
"path": "netdiff/parsers/batman.py",
"copies": "1",
"size": "3981",
"license": "mit",
"hash": -2342731325358201000,
"line_mean": 33.0256410256,
"line_max": 87,
"alpha_frac": 0.5491082643,
"autogenerated": false,
"ratio": 4.443080357142857,
"config_test": false,... |
from ..exceptions import ConversionException, ParserError
from .base import BaseParser
class OlsrParser(BaseParser):
""" OLSR 1 jsoninfo parser """
protocol = 'OLSR'
version = '0.8'
metric = 'ETX'
def to_python(self, data):
"""
Adds support for txtinfo format
"""
... | {
"repo_name": "ninuxorg/netdiff",
"path": "netdiff/parsers/olsr.py",
"copies": "1",
"size": "4497",
"license": "mit",
"hash": -6753664117462428000,
"line_mean": 35.2661290323,
"line_max": 89,
"alpha_frac": 0.5245719368,
"autogenerated": false,
"ratio": 4.593462717058222,
"config_test": false,
... |
from .exceptions import CreateCaseError, CaseIdError, CloseCaseError
from jsonobject import (
DictProperty,
StringProperty,
BooleanProperty,
)
from .jsonobject_extensions import (
Base64Property,
ISO8601Property,
StrictJsonObject,
)
class IndexItem(StrictJsonObject):
case_type = StringPro... | {
"repo_name": "dannyroberts/case_parsing",
"path": "case_parsing/delta.py",
"copies": "1",
"size": "2239",
"license": "bsd-3-clause",
"hash": 2422801371064731600,
"line_mean": 29.2567567568,
"line_max": 78,
"alpha_frac": 0.6462706565,
"autogenerated": false,
"ratio": 4.248576850094877,
"config_... |
from .exceptions import CURLResponseFormatterException
from .colors import (
print_red,
print_green,
print_yellow,
print_blue,
)
from .pygments_formatter import PygmentsFormatter
class CURLResponseFormatter(object):
'''
Formats a CURL response to be nicer to read.
'''
def __init__(sel... | {
"repo_name": "drosseau/curlformat",
"path": "curlfmt/curlformatter.py",
"copies": "1",
"size": "4825",
"license": "mit",
"hash": -9085786197232629000,
"line_mean": 34.4779411765,
"line_max": 77,
"alpha_frac": 0.5092227979,
"autogenerated": false,
"ratio": 4.335130278526505,
"config_test": fals... |
from exceptions import CustomRequestFailed
from rest_framework import viewsets
from rest_framework.response import Response
from rest_framework import status
from permissions import *
from functions import run_command, check_local_path, check_hadoop_services, check_hadoop_applications
import settings
import os
class ... | {
"repo_name": "efikalti/Lambda",
"path": "backend/app/views.py",
"copies": "1",
"size": "2839",
"license": "apache-2.0",
"hash": 9045362498817155000,
"line_mean": 42.0151515152,
"line_max": 185,
"alpha_frac": 0.6128918633,
"autogenerated": false,
"ratio": 4.367692307692308,
"config_test": false... |
from Exceptions import DependencyException
class Component (object):
""" Superclass for all component objects. """
def __init__(self, name, owner=None, dependencies=[]):
self.name = name
self.owner = owner
self.dependencies = dependencies
def checkDependencies(self):
for ... | {
"repo_name": "ManickYoj/phramework",
"path": "src/component.py",
"copies": "1",
"size": "1148",
"license": "mit",
"hash": 6101636694153701000,
"line_mean": 28.4358974359,
"line_max": 75,
"alpha_frac": 0.5400696864,
"autogenerated": false,
"ratio": 4.685714285714286,
"config_test": false,
"ha... |
from ..exceptions import DeserializationError, SerializationError
from ..utils import int_to_big_endian, big_endian_to_int, is_integer, ascii_chr
class BigEndianInt(object):
"""A sedes for big endian integers.
:param l: the size of the serialized representation in bytes or `None` to
use the sho... | {
"repo_name": "pombredanne/pyrlp",
"path": "rlp/sedes/big_endian_int.py",
"copies": "4",
"size": "1594",
"license": "mit",
"hash": -337595877476601400,
"line_mean": 34.4222222222,
"line_max": 79,
"alpha_frac": 0.5633626098,
"autogenerated": false,
"ratio": 4.151041666666667,
"config_test": fals... |
from ..exceptions import DeserializationError, SerializationError
class BigEndianInt(object):
"""A sedes for big endian integers.
:param l: the size of the serialized representation in bytes or `None` to
use the shortest possible one
"""
def __init__(self, l=None):
self.l = l
... | {
"repo_name": "jnnk/pyrlp",
"path": "rlp/sedes/big_endian_int.py",
"copies": "1",
"size": "1534",
"license": "mit",
"hash": -4558037869590763500,
"line_mean": 33.8636363636,
"line_max": 79,
"alpha_frac": 0.5488917862,
"autogenerated": false,
"ratio": 4.308988764044944,
"config_test": false,
"... |
from ..exceptions import DressError, UndressError
from ..support.monad import Monad
class Type(object):
__slots__ = ['metadata']
def __init__(self, metadata):
self.metadata = metadata
@staticmethod
def factor(_from):
return _from[list(_from.keys())[0]]
def to_factor(self):
... | {
"repo_name": "llambeau/finitio.py",
"path": "finitio/types/type.py",
"copies": "1",
"size": "1893",
"license": "isc",
"hash": -508145662815048100,
"line_mean": 24.24,
"line_max": 72,
"alpha_frac": 0.5821447438,
"autogenerated": false,
"ratio": 3.6828793774319064,
"config_test": false,
"has_n... |
from .exceptions import EncodingError
def to_long(base, lookup_f, s):
"""
Convert an array to a (possibly bignum) integer, along with a prefix value
of how many prefixed zeros there are.
base:
the source base
lookup_f:
a function to convert an element of s to a value between 0 and... | {
"repo_name": "richardkiss/pycoin",
"path": "pycoin/encoding/base_conversion.py",
"copies": "1",
"size": "2356",
"license": "mit",
"hash": -3084566236604155000,
"line_mean": 32.1830985915,
"line_max": 87,
"alpha_frac": 0.6842105263,
"autogenerated": false,
"ratio": 4.245045045045045,
"config_te... |
from exceptions import Exception
import socket
import time
from thrift import Thrift
from thrift.transport import TTransport
from thrift.transport import TSocket
from thrift.protocol import TBinaryProtocol
from pycassa.cassandra.c08 import Cassandra
from pycassa.cassandra.constants import (CASSANDRA_07, CASSANDRA_08)... | {
"repo_name": "esatterly/splunk-cassandra",
"path": "bin/pycassa/connection.py",
"copies": "1",
"size": "3565",
"license": "apache-2.0",
"hash": 8877845960395859000,
"line_mean": 35.7525773196,
"line_max": 101,
"alpha_frac": 0.6375876578,
"autogenerated": false,
"ratio": 4.290012033694344,
"con... |
from exceptions import Exception
import sys
import time
import datetime
class CustomError(Exception):
def __init__(self, customMessage, statusCode, message):
self.customMessage = customMessage
self.statusCode = statusCode
self.message = message
def __str__(self):
return repr(sel... | {
"repo_name": "geonition/softgis-api",
"path": "Commons.py",
"copies": "2",
"size": "3314",
"license": "mit",
"hash": -4175229355342760000,
"line_mean": 40.4375,
"line_max": 85,
"alpha_frac": 0.461979481,
"autogenerated": false,
"ratio": 4.852122986822841,
"config_test": false,
"has_no_keywor... |
from exceptions import Exception
class JsonRpcException(Exception):
def to_json_rpc_error(self):
return {"code": self.code, "message": self.message}
def __str__(self):
return self.message
class JsonRpcExceptionWithData(JsonRpcException):
def to_json_rpc_error(self):
json = super(JsonRpcExceptionWithData, s... | {
"repo_name": "anaoum/django-json-rpc",
"path": "djangojsonrpc/errors.py",
"copies": "1",
"size": "1078",
"license": "mit",
"hash": -9215401499480222000,
"line_mean": 24.6904761905,
"line_max": 66,
"alpha_frac": 0.7207792208,
"autogenerated": false,
"ratio": 3.198813056379822,
"config_test": fa... |
from exceptions import Exception
class MultipleNodeIdException(Exception):
def __init__(self, msg):
Exception.__init__(self, msg)
class InvalidNodeIdException(Exception):
def __init__(self, msg):
Exception.__init__(self, msg)
class Event(object):
eventNames = ['click', 'touch', 'dbclick', 'hover']
def __init... | {
"repo_name": "avinassh/Python-Class-Assignments",
"path": "DOM/node.py",
"copies": "1",
"size": "3623",
"license": "mit",
"hash": -6675599247220825000,
"line_mean": 23.6462585034,
"line_max": 89,
"alpha_frac": 0.6508418438,
"autogenerated": false,
"ratio": 3.3733705772811917,
"config_test": fa... |
from exceptions import Exception
from rctk.task import Task
## "Synchronized attributes"
##
## Controls are represented both Client and Serverside. This means that their
## state needs to be synchronised on both, and possibly both ways.
## E.g. an update on a window title should actually change the title in the
## c... | {
"repo_name": "rctk/rctk",
"path": "rctk/widgets/control.py",
"copies": "1",
"size": "9389",
"license": "bsd-2-clause",
"hash": 3053378169632014000,
"line_mean": 32.8953068592,
"line_max": 94,
"alpha_frac": 0.6045372244,
"autogenerated": false,
"ratio": 4.2774487471526195,
"config_test": false,... |
from .exceptions import FetcherError
from .utils.runcmd import runcmd
class Fetcher(object):
fetch_cmd = 'curl {url} > {dst}'
def get_fetch_cmd(self, url, dst, **options):
return self.fetch_cmd.format(url=url, dst=dst)
def fetch(self, url, dst, **options):
cmd = self.get_fetch_cmd(url, d... | {
"repo_name": "lukaszb/zeusci",
"path": "zeusci/zeus/fetchers.py",
"copies": "1",
"size": "1083",
"license": "mit",
"hash": 8553880141102034000,
"line_mean": 24.7857142857,
"line_max": 68,
"alpha_frac": 0.5771006464,
"autogenerated": false,
"ratio": 3.3529411764705883,
"config_test": false,
"... |
from exceptions import FieldError
from operations import Operations
from object import Object
class Queries(Operations):
def __init__(self, request, session_name):
super(Queries, self).__init__(request, session_name)
self.query = dict()
def _add_query(self, operation, rules=None):
if ... | {
"repo_name": "ksk6794/django-temporary-storage",
"path": "tmp_storage/queries.py",
"copies": "1",
"size": "5205",
"license": "mit",
"hash": 7937378102896961000,
"line_mean": 33.0196078431,
"line_max": 92,
"alpha_frac": 0.5292987512,
"autogenerated": false,
"ratio": 4.422259983007646,
"config_t... |
from exceptions import GeneralError
from datetime import datetime
from urlparse import urlparse
import http_utils
import json
import auth
import os
AUTH_SCHEME = "MCLOUDTOKEN"
def get_auth_token(api_key, api_secret, url, auth_service=None):
if not api_key or not api_secret:
raise GeneralError('Invalid ... | {
"repo_name": "wix/wixmedia-python",
"path": "wix/media/auth_token.py",
"copies": "1",
"size": "1235",
"license": "mit",
"hash": -2793751546330635000,
"line_mean": 31.5263157895,
"line_max": 103,
"alpha_frac": 0.6396761134,
"autogenerated": false,
"ratio": 4.318181818181818,
"config_test": fals... |
from exceptions import GeneralError, UploadError
import functools
import urllib2
import json
import os
from image import Image
from video import Video
from audio import Audio
import http_utils
import auth_token
AUTH_SCHEME = "MCLOUDTOKEN"
def retry_auth(func):
@functools.wraps(func)
def _func(client, *args,... | {
"repo_name": "wix/wixmedia-python",
"path": "wix/media/client.py",
"copies": "1",
"size": "7069",
"license": "mit",
"hash": 8823102974718409000,
"line_mean": 35.8177083333,
"line_max": 154,
"alpha_frac": 0.6275286462,
"autogenerated": false,
"ratio": 3.5327336331834083,
"config_test": false,
... |
from .exceptions import GrammarError, ConfigurationError
from .lexer import Token
from .tree import Tree
from .visitors import InlineTransformer # XXX Deprecated
from .visitors import Transformer_InPlace
from .visitors import _vargs_meta, _vargs_meta_inline
###{standalone
from functools import partial, wraps
from ite... | {
"repo_name": "lark-parser/lark",
"path": "lark/parse_tree_builder.py",
"copies": "1",
"size": "14224",
"license": "mit",
"hash": -6613158540050901000,
"line_mean": 35.6597938144,
"line_max": 151,
"alpha_frac": 0.5963863892,
"autogenerated": false,
"ratio": 4.165153733528551,
"config_test": fal... |
from .exceptions import GrammarError
from .lexer import Token
from .tree import Tree
from .visitors import InlineTransformer # XXX Deprecated
from .visitors import Transformer_InPlace
from .visitors import _vargs_meta, _vargs_meta_inline
###{standalone
from functools import partial, wraps
from itertools import repeat... | {
"repo_name": "erezsh/lark",
"path": "lark/parse_tree_builder.py",
"copies": "1",
"size": "13056",
"license": "mit",
"hash": 8451039836014452000,
"line_mean": 34.4782608696,
"line_max": 151,
"alpha_frac": 0.5769761029,
"autogenerated": false,
"ratio": 4.247234873129473,
"config_test": false,
... |
from .exceptions import HierarchyError, GraphQueryError
from .query.annotations.attributes import PauseAnnotation, AnnotationNode
from datetime import datetime
class Hierarchy(object):
"""
Class containing information about how a corpus is structured.
Hierarchical data is stored in the form of a dictiona... | {
"repo_name": "MontrealCorpusTools/PolyglotDB",
"path": "polyglotdb/structure.py",
"copies": "2",
"size": "46121",
"license": "mit",
"hash": 2088734800125014000,
"line_mean": 36.8040983607,
"line_max": 224,
"alpha_frac": 0.5600052037,
"autogenerated": false,
"ratio": 4.380794072948328,
"config_... |
from .exceptions import HierarchyError, GraphQueryError
from .query.annotations.attributes import PauseAnnotation, AnnotationNode
class Hierarchy(object):
'''
Class containing information about how a corpus is structured.
Hierarchical data is stored in the form of a dictionary with keys
for linguisti... | {
"repo_name": "samihuc/PolyglotDB",
"path": "polyglotdb/structure.py",
"copies": "1",
"size": "23947",
"license": "mit",
"hash": -1521712355517244400,
"line_mean": 37.875,
"line_max": 224,
"alpha_frac": 0.5539733578,
"autogenerated": false,
"ratio": 4.03351861209365,
"config_test": false,
"ha... |
from ..exceptions import HTTPError
from ..utility import make_pushables
import sys
WAS_FACTORY = None
class corequest:
def _get_was (self):
global WAS_FACTORY
if WAS_FACTORY is None:
from skitai import was
WAS_FACTORY = was
try:
_was = WAS_FACTORY._get ... | {
"repo_name": "hansroh/skitai",
"path": "skitai/corequest/__init__.py",
"copies": "1",
"size": "3015",
"license": "mit",
"hash": 6508608675578217000,
"line_mean": 31.4193548387,
"line_max": 121,
"alpha_frac": 0.5810945274,
"autogenerated": false,
"ratio": 4.427312775330397,
"config_test": false... |
from exceptions import ImportError, ValueError
from django.contrib import admin
from django.db import models
from django.core.exceptions import SuspiciousOperation
from django.contrib.auth.models import User
from django.contrib.contenttypes.models import ContentType
from django.contrib.contenttypes import generic
from ... | {
"repo_name": "fragro/Open-Assembly",
"path": "ver1_0/openassembly/pirate_badges/models.py",
"copies": "1",
"size": "4664",
"license": "bsd-3-clause",
"hash": -3894251236292997000,
"line_mean": 37.5454545455,
"line_max": 105,
"alpha_frac": 0.637864494,
"autogenerated": false,
"ratio": 3.64375,
... |
from .exceptions import ImproperlyConfigured
from .tree import Tree
from .adapters import *
import sqlite3
import json
class TableMeta(type):
def __init__(klass, *args, **kwargs):
def getattr(self, n):
if n in self._fields:
return n
raise AttributeError('{0} not a ta... | {
"repo_name": "shabinesh/Tabject",
"path": "tabject/orm.py",
"copies": "1",
"size": "2497",
"license": "bsd-3-clause",
"hash": -2805452314352687000,
"line_mean": 25.5638297872,
"line_max": 80,
"alpha_frac": 0.540248298,
"autogenerated": false,
"ratio": 4.147840531561462,
"config_test": false,
... |
from exceptions import InjectionError
from internal import internal
from activators import ActivatorFactory
from scopes import Scope, NoScope
import inspect
#===========================================================
class InstanceBinding(object):
def __init__(self, val, scope):
self.value = val
... | {
"repo_name": "mikhtonyuk/pyhk2",
"path": "hk2/injection/bindings.py",
"copies": "1",
"size": "2591",
"license": "mit",
"hash": 6816846920011151000,
"line_mean": 32.2179487179,
"line_max": 105,
"alpha_frac": 0.548436897,
"autogenerated": false,
"ratio": 4.282644628099174,
"config_test": false,
... |
from ..exceptions import InsertError, UpdateError, DeleteError
from .expressions import Value
from .param_store import get_param_store
from .query import Query
from .statement import Statement
class Insert(Statement):
"""Represents a database insert.
This can be used to insert data either from your python... | {
"repo_name": "modimore/BreezeBlocks",
"path": "package/breezeblocks/sql/dml.py",
"copies": "1",
"size": "5741",
"license": "mit",
"hash": -8175397416698939000,
"line_mean": 33.1726190476,
"line_max": 117,
"alpha_frac": 0.577773907,
"autogenerated": false,
"ratio": 4.440061871616396,
"config_te... |
from .exceptions import InternalException
def dict_reverse_lookup(d: dict, value):
return list(d.keys())[list(d.values()).index(value)]
class LinkAttributes(dict):
"""
This class is here mainly for caching reasons. The link attributes are
the same for each Path in a packet. Therefore we can use one ... | {
"repo_name": "protocollabs/dmpr-core",
"path": "dmpr/path.py",
"copies": "1",
"size": "4040",
"license": "mit",
"hash": -7627477244109629000,
"line_mean": 30.811023622,
"line_max": 79,
"alpha_frac": 0.572029703,
"autogenerated": false,
"ratio": 4.330117899249732,
"config_test": false,
"has_n... |
from exceptions import InvalidCardSize, InvalidPlayerMove
from game.game_state_machine import GameState, PlayerAction
from game.state.game_state_play import GameStatePlay
from model.player import Player
# ------------------------------------------------------------
# Concrete game state class for bidding
# ---------... | {
"repo_name": "dkiefner/skat-buddy",
"path": "skat-buddy/game/state/game_state_bid.py",
"copies": "1",
"size": "7131",
"license": "mit",
"hash": 1913896639773028600,
"line_mean": 36.335078534,
"line_max": 120,
"alpha_frac": 0.5979526013,
"autogenerated": false,
"ratio": 3.7890541976620615,
"con... |
from ..exceptions import InvalidChoiceError
from .base import MarathonObject
class MarathonConstraint(MarathonObject):
"""Marathon placement constraint.
See https://mesosphere.github.io/marathon/docs/constraints.html
:param str field: constraint operator target
:param str operator: must be one of [U... | {
"repo_name": "vitan/marathon-python",
"path": "marathon/models/constraint.py",
"copies": "9",
"size": "2035",
"license": "mit",
"hash": -3288794636434240500,
"line_mean": 32.9166666667,
"line_max": 107,
"alpha_frac": 0.6211302211,
"autogenerated": false,
"ratio": 4.18724279835391,
"config_test... |
from ..exceptions import InvalidChoiceError
from .base import MarathonObject
class MarathonConstraint(MarathonObject):
"""Marathon placement constraint.
See https://mesosphere.github.io/marathon/docs/constraints.html
:param str field: constraint operator target
:param str operator: must be one of [... | {
"repo_name": "drewrobb/marathon-python",
"path": "marathon/models/constraint.py",
"copies": "1",
"size": "2036",
"license": "mit",
"hash": -5420109415067498000,
"line_mean": 32.3770491803,
"line_max": 107,
"alpha_frac": 0.6208251473,
"autogenerated": false,
"ratio": 4.189300411522634,
"config_... |
from ..exceptions import InvalidChoiceError
from .base import MarathonObject
class MarathonContainer(MarathonObject):
"""Marathon health check.
See https://mesosphere.github.io/marathon/docs/native-docker.html
:param docker: docker field (e.g., {"image": "mygroup/myimage"})'
:type docker: :class:`ma... | {
"repo_name": "vitan/marathon-python",
"path": "marathon/models/container.py",
"copies": "1",
"size": "3435",
"license": "mit",
"hash": 1642016929459249200,
"line_mean": 33.0099009901,
"line_max": 112,
"alpha_frac": 0.6602620087,
"autogenerated": false,
"ratio": 3.9756944444444446,
"config_test... |
from ..exceptions import InvalidChoiceError
from .base import MarathonObject
class MarathonContainer(MarathonObject):
"""Marathon health check.
See https://mesosphere.github.io/marathon/docs/native-docker.html
:param docker: docker field (e.g., {"image": "mygroup/myimage"})'
:type docker: :class:`m... | {
"repo_name": "thefactory/marathon-python",
"path": "marathon/models/container.py",
"copies": "1",
"size": "4731",
"license": "mit",
"hash": -3618838142675389000,
"line_mean": 34.5714285714,
"line_max": 119,
"alpha_frac": 0.649122807,
"autogenerated": false,
"ratio": 4.081967213114754,
"config_... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.