text stringlengths 0 1.05M | meta dict |
|---|---|
''' A collection of unit tests for the classes of xmlnode.py.
'''
import unittest
from collections import namedtuple
import xmlnode
class BufferedIterTests(unittest.TestCase):
''' Test cases for the BufferedIter class.
'''
def test_once(self):
''' Test that the BufferedIter can it... | {
"repo_name": "foldr/helpers-py",
"path": "xmlnode_tests.py",
"copies": "1",
"size": "6206",
"license": "mit",
"hash": -1920977800921125000,
"line_mean": 27.5619047619,
"line_max": 108,
"alpha_frac": 0.5659039639,
"autogenerated": false,
"ratio": 4.268225584594223,
"config_test": true,
"has_n... |
# A collection of useful functions and objects
# Creates a corpus in reverse: i.e. keys are features, values are a set of docs
def reverse_corpus(corpus):
reverse_corpus = {}
for doc,spectrum in corpus.items():
for f,_ in spectrum.items():
if not f in reverse_corpus:
reverse_corpus[f] = set()
reverse_co... | {
"repo_name": "sdrogers/ms2ldaviz",
"path": "lda/code/ms2lda_feature_extraction_utilities.py",
"copies": "2",
"size": "2826",
"license": "mit",
"hash": -1804940334618937000,
"line_mean": 28.7473684211,
"line_max": 82,
"alpha_frac": 0.6818825195,
"autogenerated": false,
"ratio": 2.869035532994924,... |
"""A collection of useful functions for LazySusan."""
import traceback
from functools import wraps
from lazysusan.plugins import CommandPlugin
def admin_required(function):
"""A command decorator that requires an admin to run.
Admin users are listed in lazysusan.ini under admin_ids, one per line.
If th... | {
"repo_name": "bboe/LazySusan",
"path": "lazysusan/helpers.py",
"copies": "1",
"size": "5504",
"license": "bsd-2-clause",
"hash": -7857479673755309000,
"line_mean": 33.835443038,
"line_max": 79,
"alpha_frac": 0.6299055233,
"autogenerated": false,
"ratio": 4.153962264150944,
"config_test": false... |
"""A collection of useful functions related to paths, ST- and non-ST-related.
Also has some ST-specific file extensions as "constants".
"""
import os
import re
import inspect
from collections import namedtuple
import sublime
__all__ = (
"FTYPE_EXT_KEYMAP",
"FTYPE_EXT_COMPLETIONS",
"FTYPE_EXT_SNIPPET",
... | {
"repo_name": "FichteFoll/CSScheme",
"path": "my_sublime_lib/path.py",
"copies": "1",
"size": "4229",
"license": "mit",
"hash": 4696471100354160000,
"line_mean": 28.3680555556,
"line_max": 95,
"alpha_frac": 0.6306455427,
"autogenerated": false,
"ratio": 3.372408293460925,
"config_test": false,
... |
"""A collection of useful functions that didn't really belong anywhere else"""
from data_interrogator.interrogators import Allowable
from django.conf import settings
from django.apps import apps
from django.db.models import Model
from typing import Tuple, Union
import logging
logger = logging.getLogger(__name__)
log... | {
"repo_name": "LegoStormtroopr/django-data-interrogator",
"path": "data_interrogator/utils.py",
"copies": "1",
"size": "3709",
"license": "mit",
"hash": 4714996468626158000,
"line_mean": 34.3238095238,
"line_max": 105,
"alpha_frac": 0.5610676732,
"autogenerated": false,
"ratio": 3.904210526315789... |
# a collection of useful helper functions for the processors
import re
import io
import csv
# derp.ext -> derp_ext_
def makeFilenameSafe(filename):
return re.sub("\.", "_", filename) + "_"
def clustersToStandardJSON(clusters, assignment, filename, helpers):
results = []
for cluster in clusters:
if cluster.hasChe... | {
"repo_name": "JonathanPierce/Algae",
"path": "helpers/common.py",
"copies": "1",
"size": "5735",
"license": "mit",
"hash": 5968645274133617000,
"line_mean": 27.2512315271,
"line_max": 147,
"alpha_frac": 0.6915431561,
"autogenerated": false,
"ratio": 3.3265661252900234,
"config_test": false,
... |
"""A Collection of useful miscellaneous functions.
misc.py:
Collection of useful miscellaneous functions.
:Author: Hannes Breytenbach (hannes@saao.ac.za)
"""
from __future__ import absolute_import, division, print_function
import collections
import itertools
import operator
from ...extern.six.moves import zip, m... | {
"repo_name": "joergdietrich/astropy",
"path": "astropy/io/ascii/misc.py",
"copies": "4",
"size": "4232",
"license": "bsd-3-clause",
"hash": 3542416152728907000,
"line_mean": 31.8062015504,
"line_max": 100,
"alpha_frac": 0.6034971645,
"autogenerated": false,
"ratio": 3.72863436123348,
"config_t... |
"""A Collection of useful miscellaneous functions.
misc.py:
Collection of useful miscellaneous functions.
:Author: Hannes Breytenbach (hannes@saao.ac.za)
"""
import collections.abc
import itertools
import operator
def first_true_index(iterable, pred=None, default=None):
"""find the first index position for ... | {
"repo_name": "pllim/astropy",
"path": "astropy/io/ascii/misc.py",
"copies": "8",
"size": "4135",
"license": "bsd-3-clause",
"hash": -8283620445521436000,
"line_mean": 31.5590551181,
"line_max": 100,
"alpha_frac": 0.5987908102,
"autogenerated": false,
"ratio": 3.725225225225225,
"config_test": ... |
"""A Collection of useful miscellaneous functions.
misc.py:
Collection of useful miscellaneous functions.
:Author: Hannes Breytenbach (hannes@saao.ac.za)
"""
import collections
import itertools
import operator
def first_true_index(iterable, pred=None, default=None):
"""find the first index position for the... | {
"repo_name": "funbaker/astropy",
"path": "astropy/io/ascii/misc.py",
"copies": "2",
"size": "4118",
"license": "bsd-3-clause",
"hash": 5931937301773830000,
"line_mean": 31.4251968504,
"line_max": 100,
"alpha_frac": 0.599077222,
"autogenerated": false,
"ratio": 3.7300724637681157,
"config_test"... |
"""A collection of utilities for dealing with Molecular Fragments"""
import itertools
import numpy as np
from typing import Any, List, Iterable, Optional, Sequence, Set, Tuple, Union
from deepchem.utils.typing import RDKitAtom, RDKitMol
from deepchem.utils.geometry_utils import compute_pairwise_distances
from deepchem... | {
"repo_name": "miaecle/deepchem",
"path": "deepchem/utils/fragment_utils.py",
"copies": "1",
"size": "11354",
"license": "mit",
"hash": 5449972734824394000,
"line_mean": 30.6267409471,
"line_max": 83,
"alpha_frac": 0.6758851506,
"autogenerated": false,
"ratio": 3.7031963470319633,
"config_test"... |
"""A collection of utilities for dealing with Molecular Fragments"""
import itertools
import numpy as np
from typing import List, Optional, Sequence, Set, Tuple, Union
import logging
from deepchem.utils.typing import RDKitAtom, RDKitMol
from deepchem.utils.geometry_utils import compute_pairwise_distances
logger = log... | {
"repo_name": "deepchem/deepchem",
"path": "deepchem/utils/fragment_utils.py",
"copies": "2",
"size": "12339",
"license": "mit",
"hash": -6616561351259699000,
"line_mean": 29.5420792079,
"line_max": 83,
"alpha_frac": 0.6761487965,
"autogenerated": false,
"ratio": 3.7109774436090226,
"config_tes... |
"""A collection of utilities for handling (mainly subsurface ocean) observations"""
import copy
import gsw
import numpy as np
def t48tot68(t48):
"""Convert from IPTS-48 to IPTS-68 temperature scales,
as specified in the CF Standard Name information for
sea_water_temperature
http://cfconventio... | {
"repo_name": "IQuOD/AutoQC",
"path": "util/obs_utils.py",
"copies": "4",
"size": "5745",
"license": "mit",
"hash": -3809380547231274500,
"line_mean": 29.7219251337,
"line_max": 92,
"alpha_frac": 0.5603133159,
"autogenerated": false,
"ratio": 2.721459024159166,
"config_test": false,
"has_no_k... |
"""A collection of utilities to make testing with ros less painful.
"""
import os
import functools
import random
import socket
import subprocess
import time
import psutil
import rosgraph
import rosnode
def my_get_node_names(namespace=None, uri='http://localhost:11311'):
"""Monkeypatches get_node_names with a no... | {
"repo_name": "gtagency/pyrostest",
"path": "pyrostest/rostest_utils.py",
"copies": "1",
"size": "3300",
"license": "mit",
"hash": -6761907423034320000,
"line_mean": 30.4285714286,
"line_max": 78,
"alpha_frac": 0.56,
"autogenerated": false,
"ratio": 4.336399474375821,
"config_test": false,
"h... |
"""A collection of utilities used across the project."""
import os
import importlib
import prettytable
from oslo_log import log as logging
from asciipic.common import exception
LOG = logging.getLogger(__name__)
def get_attribute(root, attribute):
"""Search for the received attribute name in the object tree.
... | {
"repo_name": "micumatei/asciipic",
"path": "asciipic/common/util.py",
"copies": "1",
"size": "2621",
"license": "mit",
"hash": -6946474802750318000,
"line_mean": 26.0206185567,
"line_max": 71,
"alpha_frac": 0.5860358642,
"autogenerated": false,
"ratio": 4.317957166392092,
"config_test": false,... |
"""A collection of utilities used internally by pynads. By no means are they
off limits for playing with, however, they aren't exported by pynads.
"""
from collections import Iterable, Mapping
from inspect import isfunction
__all__ = ('_iter_but_not_str_or_map', '_propagate_self',
'_single_value_iter', 'w... | {
"repo_name": "justanr/pynads",
"path": "pynads/utils/internal.py",
"copies": "1",
"size": "4931",
"license": "mit",
"hash": 5957453975872053000,
"line_mean": 32.0939597315,
"line_max": 80,
"alpha_frac": 0.6430744271,
"autogenerated": false,
"ratio": 4.171742808798647,
"config_test": false,
"... |
"""A collection of utility functions and classes related to IO streams. For internal use only."""
import io
import typing
def read_exact(stream: typing.BinaryIO, byte_count: int) -> bytes:
"""Read byte_count bytes from the stream and raise an exception if too few bytes are read (i. e. if EOF was hit prematurely).
... | {
"repo_name": "dgelessus/python-rsrcfork",
"path": "rsrcfork/_io_utils.py",
"copies": "1",
"size": "3928",
"license": "mit",
"hash": -5628069400250655000,
"line_mean": 41.2365591398,
"line_max": 356,
"alpha_frac": 0.7309063136,
"autogenerated": false,
"ratio": 3.773294908741595,
"config_test": ... |
"""A collection of utility functions for dealing with sensors and sensor data.
More sophisticated operations call for the use of a full-fledged sensor
package, such as Open3D or PCL.
Sensor transforms
=================
The :func:`get_sensor_xform`/:func:`set_sensor_xform` functions are used to
interface cleanly with... | {
"repo_name": "krishauser/Klampt",
"path": "Python/klampt/model/sensing.py",
"copies": "1",
"size": "36836",
"license": "bsd-3-clause",
"hash": -5739434249685445000,
"line_mean": 38.3967914439,
"line_max": 141,
"alpha_frac": 0.5947442719,
"autogenerated": false,
"ratio": 3.72834008097166,
"conf... |
"""A collection of utility functions for dealing with sensors and sensor data.
The get/set_sensor_xform functions are used to interface cleanly with the klampt se3 functions.
The camera_to_X functions convert raw CameraSensor outputs to Python objects that are more easily
operated upon, e.g., images and point clouds.... | {
"repo_name": "krishauser/Klampt",
"path": "Python/python2_version/klampt/model/sensing.py",
"copies": "1",
"size": "15248",
"license": "bsd-3-clause",
"hash": 2966842061521503000,
"line_mean": 40.5476839237,
"line_max": 122,
"alpha_frac": 0.6081453305,
"autogenerated": false,
"ratio": 3.80534065... |
"""A collection of utility functions for Flow."""
import csv
import errno
import os
from lxml import etree
from xml.etree import ElementTree
def makexml(name, nsl):
"""Create an xml file."""
xsi = "http://www.w3.org/2001/XMLSchema-instance"
ns = {"xsi": xsi}
attr = {"{%s}noNamespaceSchemaLocation" % ... | {
"repo_name": "cathywu/flow",
"path": "flow/core/util.py",
"copies": "1",
"size": "3706",
"license": "mit",
"hash": 7110366608710657000,
"line_mean": 36.4343434343,
"line_max": 79,
"alpha_frac": 0.5715056665,
"autogenerated": false,
"ratio": 3.7208835341365463,
"config_test": false,
"has_no_k... |
"""A collection of utility functions"""
import json
import os
def parse_quantity(q):
"""
Parse an Onshape units definition
Args:
q:an Onshape units definition... for instance:
{
'typeTag': '',
'unitToPower': [
{
'key': 'METE... | {
"repo_name": "onshape-public/onshape-clients",
"path": "python/onshape_client/utility.py",
"copies": "1",
"size": "1882",
"license": "mit",
"hash": 304836531274704060,
"line_mean": 25.5070422535,
"line_max": 108,
"alpha_frac": 0.537194474,
"autogenerated": false,
"ratio": 3.453211009174312,
"c... |
"""A collection of utility functions."""
import importlib
import logging
def string_to_class(class_string):
"""Convert a string to a python class.
The string is first split into a module and a class name. For
example, 'dummy.package.FakeClass' would be split into
'dummy.package' and 'FakeClass'. The... | {
"repo_name": "cdriehuys/django_helpcenter",
"path": "helpcenter/utils.py",
"copies": "2",
"size": "1804",
"license": "mit",
"hash": 4892123378920879000,
"line_mean": 28.5737704918,
"line_max": 75,
"alpha_frac": 0.6247228381,
"autogenerated": false,
"ratio": 4.214953271028038,
"config_test": fa... |
"""A collection of utility functions."""
import json
from os import path
import click
from docker.client import Client
from docker.utils import kwargs_from_env
_LOG_LEVEL = 0
LOG_PREFIXES = {
0: click.style('>', fg='white', bold=True),
1: click.style('>>', fg='cyan', bold=True),
2: click.style('>>>', fg=... | {
"repo_name": "FalconSocial/berth",
"path": "berth/utils.py",
"copies": "1",
"size": "3301",
"license": "mit",
"hash": 7364309166968798000,
"line_mean": 29.8504672897,
"line_max": 173,
"alpha_frac": 0.6419266889,
"autogenerated": false,
"ratio": 3.746878547105562,
"config_test": false,
"has_n... |
""" A collection of utility methods
:Authors: Sana dev team
:Version: 1.1
"""
import os, sys, traceback
import time
import logging
import cjson
from django.conf import settings
from django.http import HttpResponse
from sana import handler
from sana.mrs.models import RequestLog
LOGGING_ENABLE_ATTR = 'LOGGING_ENABLE... | {
"repo_name": "SanaMobile/middleware_mds_v1",
"path": "src/mds/mrs/util.py",
"copies": "1",
"size": "5691",
"license": "bsd-3-clause",
"hash": 8058107212505114000,
"line_mean": 30.6222222222,
"line_max": 80,
"alpha_frac": 0.58214725,
"autogenerated": false,
"ratio": 3.9658536585365853,
"config_... |
""" A collection of utility methods
:Authors: Sana dev team
:Version: 1.1
"""
import os, sys, traceback
import time
import logging
import cjson
from django.conf import settings
LOGGING_ENABLED = 'LOGGING_ENABLE'
LOGGING_START = 'LOGGING_START_TIME'
def trace(f):
"""Decorator to add traces to a method.
"""... | {
"repo_name": "dekatzenel/team-k",
"path": "mds/api/v1/util.py",
"copies": "3",
"size": "1518",
"license": "bsd-3-clause",
"hash": -4011071215848655400,
"line_mean": 23.4838709677,
"line_max": 78,
"alpha_frac": 0.628458498,
"autogenerated": false,
"ratio": 3.5886524822695036,
"config_test": fal... |
"""A collection of utility methods used by various parts of the bidon package."""
import json
import re
import sys
from contextlib import contextmanager
from uuid import UUID
from . import convert
from . import date
_JSON_DEFAULTS = []
# pylint: disable=invalid-name
try_parse_int = convert.try_wrapper(convert.to_in... | {
"repo_name": "treycucco/bidon",
"path": "bidon/util/__init__.py",
"copies": "1",
"size": "8228",
"license": "mit",
"hash": 5888479120542731000,
"line_mean": 29.8164794007,
"line_max": 98,
"alpha_frac": 0.6861934857,
"autogenerated": false,
"ratio": 3.71802982376864,
"config_test": false,
"ha... |
"""A collection of utility methods used by various parts of the idb package."""
import json
import re
import sys
from contextlib import contextmanager
from datetime import datetime, timezone
from . import convert
_JSON_DEFAULTS=[]
try_parse_int = convert.try_wrapper(convert.to_int)
try_parse_float = convert.try_wr... | {
"repo_name": "treycucco/py-utils",
"path": "idb/util/__init__.py",
"copies": "1",
"size": "3990",
"license": "bsd-3-clause",
"hash": -7418890542203724000,
"line_mean": 25.0784313725,
"line_max": 105,
"alpha_frac": 0.6691729323,
"autogenerated": false,
"ratio": 3.3277731442869056,
"config_test"... |
"""A collection of utils for ReGraph library."""
import copy
from regraph.command_parser import parser
from regraph.exceptions import ReGraphError, ParsingError, RewritingError
from regraph.attribute_sets import AttributeSet, FiniteSet
def set_attrs(old_attrs, attrs, normalize=True, update=True):
if normalize:
... | {
"repo_name": "Kappa-Dev/ReGraph",
"path": "regraph/utils.py",
"copies": "1",
"size": "53507",
"license": "mit",
"hash": 3794238635125315600,
"line_mean": 38.1992673993,
"line_max": 90,
"alpha_frac": 0.4360924739,
"autogenerated": false,
"ratio": 4.361865166707426,
"config_test": false,
"has_... |
"""A collection of utils for ReGraph library."""
import copy
from regraph.parser import parser
from regraph.exceptions import ReGraphError, ParsingError
from regraph.attribute_sets import AttributeSet, FiniteSet
def json_dict_to_attrs(d):
"""Convert json dictionary to attributes."""
attrs = {}
for k, v i... | {
"repo_name": "eugeniashurko/ReGraph",
"path": "regraph/utils.py",
"copies": "1",
"size": "37108",
"license": "mit",
"hash": 9146462481449485000,
"line_mean": 38.8154506438,
"line_max": 90,
"alpha_frac": 0.4202867306,
"autogenerated": false,
"ratio": 4.435572555582118,
"config_test": false,
"... |
"""A collection of various helper functions and utility functions."""
import asyncio
import functools
import aiohttp
import websockets
from discord.utils import maybe_coroutine
from discord.errors import HTTPException, GatewayNotFound, ConnectionClosed
def estimate_reading_time(text):
"""Estimates the time need... | {
"repo_name": "Dwarf-Community/Dwarf",
"path": "utils.py",
"copies": "1",
"size": "3222",
"license": "mit",
"hash": -5625878838442534000,
"line_mean": 35.6136363636,
"line_max": 97,
"alpha_frac": 0.6160769708,
"autogenerated": false,
"ratio": 5.034375,
"config_test": false,
"has_no_keywords":... |
""" A collection of "worlds" suitable by solution by a CSP.
Each world has a make_XXX_SCP function that creates a new
CSP object, and some auxiliary utilities.
"""
import re, math
from collections import defaultdict
from types import StringTypes
from csplib import CSP
#-------------------------------... | {
"repo_name": "sunilthorat09/code-for-blog",
"path": "2009/csp_for_euler68/csp_sample_problems.py",
"copies": "13",
"size": "12407",
"license": "unlicense",
"hash": 730510484253290400,
"line_mean": 25.6837416481,
"line_max": 102,
"alpha_frac": 0.4577254776,
"autogenerated": false,
"ratio": 3.6816... |
"""A collection of wrappers around subprocess."""
import os
import subprocess # nosec
def swallow(command):
"""Execute a command, swallow all output, and return the status code.
:param list command: command to execute
"""
if isinstance(command, str):
command = command.split()
with open(... | {
"repo_name": "Brickstertwo/git-commands",
"path": "bin/commands/utils/execute.py",
"copies": "1",
"size": "1712",
"license": "mit",
"hash": -5812327511511106000,
"line_mean": 27.5333333333,
"line_max": 97,
"alpha_frac": 0.6933411215,
"autogenerated": false,
"ratio": 4.066508313539193,
"config_... |
"""A collection of ZeroMQ servers
test_notification_service - send out notifications of test status changes
- Registers a PULL socket that model.py sends notifications of tests to.
- Registers a PUB socket that broadcasts notifications to cluster_api websocket subscribers.
console_monitor_service - monitor the cons... | {
"repo_name": "datastax/cstar_perf",
"path": "frontend/cstar_perf/frontend/server/notifications.py",
"copies": "2",
"size": "7873",
"license": "apache-2.0",
"hash": 5139459249352286000,
"line_mean": 37.0338164251,
"line_max": 122,
"alpha_frac": 0.6037088784,
"autogenerated": false,
"ratio": 4.045... |
"""A colored output console.
Example
-------
from cmt.ui.widgets.outputconsole import OutputConsole
widget = OutputConsole()
widget.add_color("^Error", 217, 83, 79)
widget.add_color("^Fail", 240, 173, 78)
widget.add_color("^Success", 92, 184, 92)
widget.show()
widget.write("And now some text\n")
widget.write("ERROR: T... | {
"repo_name": "chadmv/cmt",
"path": "scripts/cmt/ui/widgets/outputconsole.py",
"copies": "1",
"size": "1696",
"license": "mit",
"hash": -4744314602680346000,
"line_mean": 26.3548387097,
"line_max": 54,
"alpha_frac": 0.6208726415,
"autogenerated": false,
"ratio": 3.711159737417943,
"config_test"... |
"""A Column represents a deferred Tensor computation in a DataFrame."""
# Copyright 2016 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.ap... | {
"repo_name": "ivano666/tensorflow",
"path": "tensorflow/contrib/learn/python/learn/dataframe/column.py",
"copies": "2",
"size": "3187",
"license": "apache-2.0",
"hash": -333943839374474700,
"line_mean": 33.2688172043,
"line_max": 80,
"alpha_frac": 0.7053655475,
"autogenerated": false,
"ratio": 4... |
"""Acolyte models"""
from acolyte.database import db
class School(db.Model):
"""School SqlAlchemy model
"""
id = db.Column(db.Integer, primary_key=True)
name = db.Column(db.String(50))
def __init__(self, *args, **kwargs):
self.name = kwargs.get('name')
class Spell(db.Model):
"""Sp... | {
"repo_name": "rabramley/frostgrave_acolyte",
"path": "acolyte/models.py",
"copies": "1",
"size": "1392",
"license": "mit",
"hash": 7205725785750463000,
"line_mean": 25.7692307692,
"line_max": 65,
"alpha_frac": 0.5804597701,
"autogenerated": false,
"ratio": 3.5876288659793816,
"config_test": fa... |
"""Acolyte spell importer"""
import yaml
from acolyte.models import Spell, School
from acolyte.database import db
def import_spells(app, spell_path):
"""Import spells from a YAML file
Arguments:
app {obj} -- Acolyte application
spell_path {str} -- Path to spells YAML file
"""
ap... | {
"repo_name": "rabramley/frostgrave_acolyte",
"path": "acolyte/importer.py",
"copies": "1",
"size": "1676",
"license": "mit",
"hash": -7347754990143360000,
"line_mean": 29.4727272727,
"line_max": 72,
"alpha_frac": 0.5089498807,
"autogenerated": false,
"ratio": 4.097799511002445,
"config_test": ... |
# A combination of both the DHT and pihole scripts
# Requires adafruit python DHT11, DHT22 Library. See other DHT script
# Bradley Gillap 2016
import lcddriver #Driver
import socket #For host and IP
import time #For general timers. Sleep etc.
import fcntl #For host and IP
import struct
import json #For... | {
"repo_name": "bradgillap/I2C-LCD-Display",
"path": "16x2LCD/dht11pluspihole.py",
"copies": "1",
"size": "3371",
"license": "apache-2.0",
"hash": -629108071137612200,
"line_mean": 36.043956044,
"line_max": 122,
"alpha_frac": 0.6701275586,
"autogenerated": false,
"ratio": 3.050678733031674,
"con... |
"""A combined model combines multiple models."""
import itertools
import logging
from label_microservice import models
class CombinedLabelModels(models.IssueLabelModel):
"""Generate predictions with multiple models and then combine the results"""
def __init__(self, models=None):
# A list of models to genera... | {
"repo_name": "kubeflow/code-intelligence",
"path": "py/label_microservice/combined_model.py",
"copies": "1",
"size": "1511",
"license": "mit",
"hash": 4814102127452941000,
"line_mean": 26.9814814815,
"line_max": 78,
"alpha_frac": 0.6704169424,
"autogenerated": false,
"ratio": 4.497023809523809,
... |
"""A command line interface (CLI) to the main PUDL ETL functionality.
This script generates datapacakges based on the datapackage settings enumerated
in the settings_file which is given as an argument to this script. If the
settings has empty datapackage parameters (meaning there are no years or
tables included), no d... | {
"repo_name": "catalyst-cooperative/pudl",
"path": "src/pudl/cli.py",
"copies": "1",
"size": "4538",
"license": "mit",
"hash": 5877586881318611000,
"line_mean": 35.0158730159,
"line_max": 103,
"alpha_frac": 0.6729836933,
"autogenerated": false,
"ratio": 3.753515301902399,
"config_test": false,
... |
""" A command line interface to start a Flask service for classifying handwritten digits. """
import argparse
import constants
import cv2
from flask import Flask, jsonify, request, render_template, abort
import io
from keras.models import load_model
import logging
from logging import handlers
import numpy as np
import... | {
"repo_name": "thomas-legrand/mnist-classification",
"path": "app.py",
"copies": "1",
"size": "5437",
"license": "mit",
"hash": -9070020211253986000,
"line_mean": 36.2397260274,
"line_max": 115,
"alpha_frac": 0.6663601251,
"autogenerated": false,
"ratio": 3.802097902097902,
"config_test": false... |
"""A command line search utility. Command line options are flagged as '-t' for table,
'-f' for format, '-o-' for output, and '-q' for query. Enter these as arguments and
the program will output a plain text file with the relevant data."""
import MySQLdb
import optparse
opt = optparse.OptionParser()
opt.add_optio... | {
"repo_name": "EricAlanMack/MySQL-search",
"path": "searchme.py",
"copies": "1",
"size": "2204",
"license": "mit",
"hash": 6051278752320407000,
"line_mean": 21.7216494845,
"line_max": 86,
"alpha_frac": 0.6161524501,
"autogenerated": false,
"ratio": 3.010928961748634,
"config_test": false,
"ha... |
"""A command line tool for classifying tweets collected by get_twitter.py
take care, will overwrite output_filename
Run this using:
python classifier.py input_filename output_filename
(obviously replacing the last two)
If output_filename exists, this will load that file's contents and rewrite it.
Be careful!!!
Th... | {
"repo_name": "robertlayton/authorship_tutorials",
"path": "pyconau2014/classifier.py",
"copies": "1",
"size": "1644",
"license": "bsd-3-clause",
"hash": 8298524792455471000,
"line_mean": 26.8644067797,
"line_max": 78,
"alpha_frac": 0.6885644769,
"autogenerated": false,
"ratio": 3.334685598377282... |
"""A commandline tool to convert an EXR image to a .npz dictionary.
Useful when you have problems installing OpenEXR for Python 3. This uses
Python 2 and writes to disk, so that you can later load it with Python 3.
Xiuming Zhang, MIT CSAIL.
Feburary 2018.
"""
from argparse import ArgumentParser
from os import maked... | {
"repo_name": "google/neural-light-transport",
"path": "third_party/xiuminglib/cli/exr2npz.py",
"copies": "2",
"size": "1336",
"license": "apache-2.0",
"hash": 8755690576642390000,
"line_mean": 25.72,
"line_max": 73,
"alpha_frac": 0.6938622754,
"autogenerated": false,
"ratio": 3.1658767772511847,... |
"""A commandline tool to extract frames from a video.
Xiuming Zhang, MIT CSAIL.
May 2017.
"""
from argparse import ArgumentParser
from os import makedirs
from os.path import exists, join, abspath
from cv2 import imwrite, VideoCapture
from xiuminglib import log
logger, thisfile = log.create_logger(abspath(__file__))... | {
"repo_name": "google/neural-light-transport",
"path": "third_party/xiuminglib/cli/extract_frames.py",
"copies": "2",
"size": "1486",
"license": "apache-2.0",
"hash": -8378440978144276000,
"line_mean": 28.72,
"line_max": 80,
"alpha_frac": 0.6843876178,
"autogenerated": false,
"ratio": 3.496470588... |
"""A commandline tool to make annotated GIF from image-text pairs.
Xiuming Zhang, MIT CSAIL.
July 2017.
"""
from argparse import ArgumentParser
from os import makedirs
from os.path import exists, join, abspath, dirname, basename
from shutil import rmtree
from subprocess import call
from random import choice
from str... | {
"repo_name": "google/nerfactor",
"path": "third_party/xiuminglib/cli/make_gif.py",
"copies": "2",
"size": "3368",
"license": "apache-2.0",
"hash": -8794342738874370000,
"line_mean": 36.010989011,
"line_max": 115,
"alpha_frac": 0.6445961995,
"autogenerated": false,
"ratio": 3.1359404096834265,
... |
""" A command model that can be easily transformed into jobs.
author: Brian Schrader
since: 2015-12-21
"""
from .tokens import Input, Output, FileToken, PathToken, alias_pattern
class Command(object):
def __init__(self, alias, parts=[]):
self.alias = alias
self.parts = parts
if len(self... | {
"repo_name": "TorkamaniLab/metapipe",
"path": "metapipe/models/command.py",
"copies": "2",
"size": "2935",
"license": "mit",
"hash": -943302913037680500,
"line_mean": 31.2527472527,
"line_max": 79,
"alpha_frac": 0.5567291312,
"autogenerated": false,
"ratio": 4.48776758409786,
"config_test": fa... |
"""A command to generate or load a subset of data from the live
database.
The `load` operation truncates all existing data.
"""
import json
import os
import tempfile
import subprocess
from django.core.management import BaseCommand
from django.db import connection
from django.template import Context, Engine, Templat... | {
"repo_name": "annapowellsmith/openpresc",
"path": "openprescribing/frontend/management/commands/sample_data.py",
"copies": "1",
"size": "6653",
"license": "mit",
"hash": -3386556577246731300,
"line_mean": 32.601010101,
"line_max": 79,
"alpha_frac": 0.5618517962,
"autogenerated": false,
"ratio": ... |
"""A command to generate or load a subset of data from the live
database.
The `load` operation truncates all existing data.
"""
import json
import os
import tempfile
from django.apps import apps
from django.core.management import BaseCommand
from django.db import connection
# Tables for which we should copy all th... | {
"repo_name": "ebmdatalab/openprescribing",
"path": "openprescribing/frontend/management/commands/sample_data.py",
"copies": "1",
"size": "4704",
"license": "mit",
"hash": -41128886794764780,
"line_mean": 33.8444444444,
"line_max": 84,
"alpha_frac": 0.5542091837,
"autogenerated": false,
"ratio": ... |
"""A command to generate the SQL required to aggregate statistics
stashed in the JSON column for star_pus in the practice_statistics
table.
When the keys in the JSON change, replace
`views_sql/ccgstatistics.sql` with the output of running this command
"""
from django.core.management import BaseCommand
from django.te... | {
"repo_name": "annapowellsmith/openpresc",
"path": "openprescribing/frontend/management/commands/generate_ccg_statistics_sql.py",
"copies": "1",
"size": "2988",
"license": "mit",
"hash": 1791663267181318100,
"line_mean": 31.8351648352,
"line_max": 118,
"alpha_frac": 0.6064257028,
"autogenerated": f... |
"""A command to list events."""
from baseCmd import *
from baseResponse import *
class listEventsCmd (baseCmd):
typeInfo = {}
def __init__(self):
self.isAsync = "false"
"""list resources by account. Must be used with the domainId parameter."""
self.account = None
self.typeInfo... | {
"repo_name": "MissionCriticalCloud/marvin",
"path": "marvin/cloudstackAPI/listEvents.py",
"copies": "1",
"size": "4188",
"license": "apache-2.0",
"hash": 8110051326058380000,
"line_mean": 40.0588235294,
"line_max": 191,
"alpha_frac": 0.5859598854,
"autogenerated": false,
"ratio": 4.0699708454810... |
"""A command to run the tests specified in settings.TEST_APPS
Created on Aug 22, 2010
@author: jnaous
"""
import os
import pkg_resources
from django.core.management.base import NoArgsCommand
MAKEFILE = \
r"""
##
## Makefile to keep the hash symlinks in SSLCACertificatePath up to date
## Copyright (c) 1998-2001 Ral... | {
"repo_name": "dana-i2cat/felix",
"path": "expedient/src/python/expedient/clearinghouse/commands/management/commands/install_cert_makefile.py",
"copies": "8",
"size": "2388",
"license": "apache-2.0",
"hash": -5947025016118221000,
"line_mean": 28.85,
"line_max": 74,
"alpha_frac": 0.4568676717,
"auto... |
# A common base page object to be used by all the page object
import time
from selenium.common.exceptions import TimeoutException, StaleElementReferenceException, NoSuchElementException
from selenium.webdriver.support.expected_conditions import visibility_of_element_located, element_to_be_clickable
from selenium.webdri... | {
"repo_name": "aelnahas/automation-quandl",
"path": "common/page_object.py",
"copies": "1",
"size": "5827",
"license": "mit",
"hash": -303010983064721100,
"line_mean": 41.2246376812,
"line_max": 117,
"alpha_frac": 0.6349751158,
"autogenerated": false,
"ratio": 4.650438946528332,
"config_test": ... |
"""A community galerka site
Usage:
galerka [options]
Options:
-h, --help Show help
--hostname=HOSTNAME Hostname to run on [default: localhost]
-p, --port=NUM Port to listen on [default: 4000]
-d, --debug Enable debugging
--redis-url=URL Redis URL [de... | {
"repo_name": "encukou/galerka",
"path": "galerka/__main__.py",
"copies": "1",
"size": "1512",
"license": "mit",
"hash": 7548781897419135000,
"line_mean": 28.0769230769,
"line_max": 80,
"alpha_frac": 0.6223544974,
"autogenerated": false,
"ratio": 3.7241379310344827,
"config_test": false,
"has... |
"""A compact GUI application for optical distortion calibration of endoscopes.
See:
https://github.com/gift-surg/endocal
"""
from setuptools import setup
# To use a consistent encoding
from codecs import open
from os import path
doc_dir = path.abspath(path.join(path.dirname(__file__), 'doc'))
# Get the summary
summ... | {
"repo_name": "gift-surg/endocal",
"path": "setup.py",
"copies": "1",
"size": "4008",
"license": "bsd-3-clause",
"hash": -1158979411797983000,
"line_mean": 35.7706422018,
"line_max": 85,
"alpha_frac": 0.6551896208,
"autogenerated": false,
"ratio": 3.89126213592233,
"config_test": false,
"has_... |
# A complete rewrite of the CERN@school particle recognition and classification algorithm,
# for ease of integration with existing LUCID data and libraries.
# Can be imported and called from anywhere to identify particle types based on their attributes
# Author (code): Cal Hewitt, based on an algorithm from http://gith... | {
"repo_name": "calhewitt/lucid_utils",
"path": "lucid_utils/classification/old_algorithm.py",
"copies": "2",
"size": "2638",
"license": "mit",
"hash": 2514214697699761000,
"line_mean": 42.2459016393,
"line_max": 124,
"alpha_frac": 0.6595905989,
"autogenerated": false,
"ratio": 4.331691297208539,
... |
# A complete working Python program to demonstrate all
# stack operations using a doubly linked list
class Node:
def __init__(self, data):
self.data = data # Assign data
self.next = None # Initialize next as null
self.prev = None # Initialize prev as null
class Stack:
... | {
"repo_name": "TheAlgorithms/Python",
"path": "data_structures/stacks/stack_using_dll.py",
"copies": "1",
"size": "2960",
"license": "mit",
"hash": -3943922271114758000,
"line_mean": 22.0650406504,
"line_max": 66,
"alpha_frac": 0.5233108108,
"autogenerated": false,
"ratio": 4.060356652949245,
"... |
"""A component registry, similar to nlp_saft::RegisteredClass<>.
Like nlp_saft::RegisteredClass<>, one does not need to explicitly import the
module containing each subclass. It is sufficient to add subclasses as build
dependencies.
Unlike nlp_saft::RegisteredClass<>, which allows subclasses to be registered
under a... | {
"repo_name": "jmhsi/justin_tinker",
"path": "data_science/courses/learning_dl_packages/models/research/syntaxnet/syntaxnet/util/registry.py",
"copies": "15",
"size": "5847",
"license": "apache-2.0",
"hash": -8933790108381755000,
"line_mean": 30.6054054054,
"line_max": 80,
"alpha_frac": 0.7063451343,... |
"""A component that allows creates the source for the glyphs and
handle transformation.
"""
# Author: KK Rai (kk.rai [at] iitb.ac.in)
# R. Ambareesha (ambareesha [at] iitb.ac.in)
# Prabhu Ramachandran <prabhu_r@users.sf.net>
# Enthought library imports.
from traits.api import (Instance, List, Trait, Bo... | {
"repo_name": "alexandreleroux/mayavi",
"path": "mayavi/components/glyph_source.py",
"copies": "3",
"size": "9623",
"license": "bsd-3-clause",
"hash": -8443530728403129000,
"line_mean": 36.737254902,
"line_max": 84,
"alpha_frac": 0.5183414736,
"autogenerated": false,
"ratio": 4.2959821428571425,
... |
"""A component that provides a selection of implicit widgets
to be used by various modules.
"""
# Author: Suyog Dutt Jain <suyog.jain@aero.iitb.ac.in>
# Prabhu Ramachandran <prabhu at aero.iitb.ac.in>
# Copyright (c) 2009-2015, Enthought, Inc.
# License: BSD Style.
import pickle
from traits.api import (Instan... | {
"repo_name": "dmsurti/mayavi",
"path": "mayavi/components/implicit_widgets.py",
"copies": "1",
"size": "10112",
"license": "bsd-3-clause",
"hash": 3947001194242373600,
"line_mean": 36.872659176,
"line_max": 83,
"alpha_frac": 0.5146360759,
"autogenerated": false,
"ratio": 4.40994330571304,
"con... |
"""A component that provides a selection of poly data source widgets
to be used by various modules.
"""
# Author: Prabhu Ramachandran <prabhu_r@users.sf.net>
# Copyright (c) 2005, Enthought, Inc.
# License: BSD Style.
# Enthought library imports.
from traits.api import Event, Instance, List, Trait, Bool, TraitPrefixL... | {
"repo_name": "liulion/mayavi",
"path": "mayavi/components/source_widget.py",
"copies": "2",
"size": "11844",
"license": "bsd-3-clause",
"hash": -1627766990019474400,
"line_mean": 38.8787878788,
"line_max": 76,
"alpha_frac": 0.5371496116,
"autogenerated": false,
"ratio": 4.22095509622238,
"conf... |
"""A component to manage an implicit plane widget.
"""
# Author: Prabhu Ramachandran <prabhu_r@users.sf.net>
# Copyright (c) 2005, Enthought, Inc.
# License: BSD Style.
# Enthought library imports.
from traits.api import Instance, Bool, Property
from traitsui.api import View, Group, Item, InstanceEditor
from tvtk.api ... | {
"repo_name": "liulion/mayavi",
"path": "mayavi/components/implicit_plane.py",
"copies": "3",
"size": "6933",
"license": "bsd-3-clause",
"hash": -3656126923366633500,
"line_mean": 35.109375,
"line_max": 76,
"alpha_frac": 0.496610414,
"autogenerated": false,
"ratio": 4.516612377850163,
"config_t... |
"""A Composite Map class
Author: `Keith Hughitt <keith.hughitt@nasa.gov>`
"""
from __future__ import absolute_import
import matplotlib.pyplot as plt
from sunpy.map import Map
__author__ = "Keith Hughitt"
__email__ = "keith.hughitt@nasa.gov"
class CompositeMap:
"""
CompositeMap(map1 [,map2,..])
Para... | {
"repo_name": "jslhs/sunpy",
"path": "sunpy/map/compositemap.py",
"copies": "1",
"size": "9605",
"license": "bsd-2-clause",
"hash": 4316360777746123300,
"line_mean": 33.5503597122,
"line_max": 98,
"alpha_frac": 0.5626236335,
"autogenerated": false,
"ratio": 4.141871496334627,
"config_test": fal... |
"""A Composite Map class
Author: `Keith Hughitt <keith.hughitt@nasa.gov>`
"""
from __future__ import absolute_import
import matplotlib.pyplot as plt
from sunpy.map import Map
__all__ = ['CompositeMap']
__author__ = "Keith Hughitt"
__email__ = "keith.hughitt@nasa.gov"
class CompositeMap:
"""
CompositeMap(m... | {
"repo_name": "mjm159/sunpy",
"path": "sunpy/map/compositemap.py",
"copies": "1",
"size": "13808",
"license": "bsd-2-clause",
"hash": 5842915076980323000,
"line_mean": 33.0938271605,
"line_max": 103,
"alpha_frac": 0.5437427578,
"autogenerated": false,
"ratio": 4.28287841191067,
"config_test": f... |
"""A Composite Map class
Author: `Keith Hughitt <keith.hughitt@nasa.gov>`
"""
from __future__ import absolute_import, print_function, division
import matplotlib.pyplot as plt
import astropy.units as u
from sunpy.map import GenericMap
from sunpy.util import expand_list
from sunpy.extern import six
from sunpy.extern... | {
"repo_name": "Alex-Ian-Hamilton/sunpy",
"path": "sunpy/map/compositemap.py",
"copies": "1",
"size": "17540",
"license": "bsd-2-clause",
"hash": -3728552030891562500,
"line_mean": 31.4814814815,
"line_max": 103,
"alpha_frac": 0.5591790194,
"autogenerated": false,
"ratio": 4.189156914258419,
"co... |
"""A Composite Map class
Author: `Keith Hughitt <keith.hughitt@nasa.gov>`
"""
import numpy as np
import matplotlib as mpl
import matplotlib.pyplot as plt
import astropy.units as u
from sunpy.map import GenericMap
from sunpy.visualization import axis_labels_from_ctype, peek_show
from sunpy.util import expand_list
... | {
"repo_name": "dpshelio/sunpy",
"path": "sunpy/map/compositemap.py",
"copies": "1",
"size": "17464",
"license": "bsd-2-clause",
"hash": 5628462146645484000,
"line_mean": 32.3282442748,
"line_max": 110,
"alpha_frac": 0.557833257,
"autogenerated": false,
"ratio": 4.20616570327553,
"config_test": ... |
''' A CompoundStim class represents a combination of constituent Stim classes.
'''
from pliers.utils import listify
from .base import _get_stim_class
from .audio import AudioStim
from .text import ComplexTextStim
class CompoundStim:
''' A container for an arbitrary set of Stim elements.
Args:
eleme... | {
"repo_name": "tyarkoni/pliers",
"path": "pliers/stimuli/compound.py",
"copies": "2",
"size": "4463",
"license": "bsd-3-clause",
"hash": 4642588919070486000,
"line_mean": 33.5968992248,
"line_max": 93,
"alpha_frac": 0.5673313914,
"autogenerated": false,
"ratio": 4.375490196078432,
"config_test"... |
"""A COM Server which exposes the NT Performance monitor in a very rudimentary way
Usage from VB:
set ob = CreateObject("Python.PerfmonQuery")
freeBytes = ob.Query("Memory", "Available Bytes")
"""
from win32com.server import exception, register
import pythoncom, win32pdhutil, winerror
class PerfMonQuery:
_reg_verp... | {
"repo_name": "Microsoft/PTVS",
"path": "Python/Product/Miniconda/Miniconda3-x64/Lib/site-packages/win32com/servers/perfmon.py",
"copies": "11",
"size": "1050",
"license": "apache-2.0",
"hash": -4354104318837345000,
"line_mean": 37.8888888889,
"line_max": 91,
"alpha_frac": 0.7523809524,
"autogenera... |
"""A COM Server which exposes the NT Performance monitor in a very rudimentary way
Usage from VB:
set ob = CreateObject("Python.PerfmonQuery")
freeBytes = ob.Query("Memory", "Available Bytes")
"""
from win32com.server import exception, register
import pythoncom, win32pdhutil, winerror
class PerfMonQuery:
... | {
"repo_name": "ntuecon/server",
"path": "pyenv/Lib/site-packages/win32com/servers/perfmon.py",
"copies": "4",
"size": "1072",
"license": "bsd-3-clause",
"hash": 6846595764353661000,
"line_mean": 37.7037037037,
"line_max": 91,
"alpha_frac": 0.7332089552,
"autogenerated": false,
"ratio": 3.07163323... |
# The MIT License (MIT)
# Copyright (c) 2014 Emilio Daniel Gonzalez
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, c... | {
"repo_name": "aconcagua/aconcagua-python",
"path": "aconcagua/context/execution_context.py",
"copies": "1",
"size": "3935",
"license": "mit",
"hash": 1428667394615251500,
"line_mean": 35.4351851852,
"line_max": 99,
"alpha_frac": 0.5786531131,
"autogenerated": false,
"ratio": 4.758162031438936,
... |
### For practical reasons, a big part of this module was inspired (copied &
### pasted) from Tornado's ioloop module, so the credits for the goodness of
### this code goes for its team.
### You should take a look to that awesome project at:
### http://www.tornadoweb.org/ & https://github.com/facebook/tornado/
class A... | {
"repo_name": "aconcagua/aconcagua-python",
"path": "aconcagua/apoll/apoll.py",
"copies": "1",
"size": "2265",
"license": "mit",
"hash": 4915662321024771000,
"line_mean": 32.8059701493,
"line_max": 80,
"alpha_frac": 0.7090507726,
"autogenerated": false,
"ratio": 3.9528795811518322,
"config_test... |
# A configuration file for the fileprocess. We could do a .ini, but everybody
# knows python here
import logging
import os
from logging import handlers
config = {
'port': 48260,
'S3.accesskey': '17G635SNK33G1Y7NZ2R2',
'S3.secret': 'PHDzFig4NYRJoKKW/FerfhojljL+sbNyYB9bEpHs',
'S3.music_bucket': 'music.r... | {
"repo_name": "JustinTulloss/harmonize.fm",
"path": "filemq/filemq/configuration.py",
"copies": "1",
"size": "2548",
"license": "mit",
"hash": 2688927516315322400,
"line_mean": 27,
"line_max": 80,
"alpha_frac": 0.6456043956,
"autogenerated": false,
"ratio": 2.837416481069042,
"config_test": tru... |
"""A configuration management class built on top of etcd
See: http://python-etcd.readthedocs.org/
It provides a read-only access and just exposes a nested dict
"""
import functools
import time
import etcd3
from conman.conman_base import ConManBase
def thrice(delay=0.5):
"""This decorator tries failed operation... | {
"repo_name": "the-gigi/conman",
"path": "conman/conman_etcd.py",
"copies": "1",
"size": "3240",
"license": "mit",
"hash": -2054108859139198700,
"line_mean": 27.6725663717,
"line_max": 72,
"alpha_frac": 0.525617284,
"autogenerated": false,
"ratio": 4.10126582278481,
"config_test": false,
"has... |
"""A connection adapter that tries to use the best polling method for the
platform pika is running on.
"""
import abc
import collections
import errno
import heapq
import logging
import select
import time
import threading
import pika.compat
from pika.adapters.utils import nbio_interface
from pika.adapters.base_connec... | {
"repo_name": "pika/pika",
"path": "pika/adapters/select_connection.py",
"copies": "1",
"size": "45161",
"license": "bsd-3-clause",
"hash": -8919746841868658000,
"line_mean": 34.6440410418,
"line_max": 88,
"alpha_frac": 0.6040388831,
"autogenerated": false,
"ratio": 4.567253236245954,
"config_t... |
"""A connection adapter that tries to use the best polling method for the
platform pika is running on.
"""
import abc
import os
import logging
import socket
import select
import errno
import time
from collections import defaultdict
import threading
import pika.compat
from pika.compat import dictkeys
from pika.adapte... | {
"repo_name": "knowsis/pika",
"path": "pika/adapters/select_connection.py",
"copies": "1",
"size": "35777",
"license": "bsd-3-clause",
"hash": -3033070405437947000,
"line_mean": 34.9929577465,
"line_max": 85,
"alpha_frac": 0.5993515387,
"autogenerated": false,
"ratio": 4.5316022799240026,
"conf... |
"""A connection adapter that tries to use the best polling method for the
platform pika is running on.
"""
import logging
import select
import time
from pika.adapters.base_connection import BaseConnection
LOGGER = logging.getLogger(__name__)
# One of select, epoll, kqueue or poll
SELECT_TYPE = None
# Use epoll's c... | {
"repo_name": "godotgildor/Suns",
"path": "src/pika/adapters/select_connection.py",
"copies": "2",
"size": "16227",
"license": "bsd-3-clause",
"hash": 6523432751432935000,
"line_mean": 34.9800443459,
"line_max": 80,
"alpha_frac": 0.5856288901,
"autogenerated": false,
"ratio": 4.59038189533239,
... |
"""A connection adapter that tries to use the best polling method for the
platform pika is running on.
"""
import os
import logging
import socket
import select
import errno
import time
from collections import defaultdict
import threading
from servicebus.pika import compat
from servicebus.pika.compat import dictkeys
... | {
"repo_name": "blacktear23/py-servicebus",
"path": "servicebus/pika/adapters/select_connection.py",
"copies": "1",
"size": "21495",
"license": "bsd-3-clause",
"hash": -8185252918028387000,
"line_mean": 34.1800327332,
"line_max": 80,
"alpha_frac": 0.5735287276,
"autogenerated": false,
"ratio": 4.5... |
"""A connection adapter that tries to use the best polling method for the
platform pika is running on.
"""
import os
import logging
import socket
import select
import errno
import time
from operator import itemgetter
from collections import defaultdict
import threading
import pika.compat
from pika.compat import dictk... | {
"repo_name": "reddec/pika",
"path": "pika/adapters/select_connection.py",
"copies": "3",
"size": "21137",
"license": "bsd-3-clause",
"hash": 2467033644874818000,
"line_mean": 33.9950331126,
"line_max": 80,
"alpha_frac": 0.5762407153,
"autogenerated": false,
"ratio": 4.539733676975945,
"config_... |
"""A Connection is a list of links. Propagates data to and from Nodes."""
import Packet
class Connection(object):
"""Container for Link objects."""
def __init__(self, start_node, end_node, tapping_nodes=None):
self.links = [[], []]
self.start_node = start_node
self.end_node = end_node... | {
"repo_name": "SamuelDoud/tomography",
"path": "tomography/src/connection.py",
"copies": "1",
"size": "3321",
"license": "mit",
"hash": -6292368498254758000,
"line_mean": 39.5,
"line_max": 94,
"alpha_frac": 0.5916892502,
"autogenerated": false,
"ratio": 4.010869565217392,
"config_test": false,
... |
"""A connector for Facebook Messenger."""
import json
import logging
import aiohttp
from voluptuous import Required
from opsdroid.connector import Connector, register_event
from opsdroid.events import Message
_LOGGER = logging.getLogger(__name__)
_FACEBOOK_SEND_URL = "https://graph.facebook.com/v2.6/me/messages" "... | {
"repo_name": "jacobtomlinson/opsdroid",
"path": "opsdroid/connector/facebook/__init__.py",
"copies": "3",
"size": "4627",
"license": "apache-2.0",
"hash": -3694544177897171500,
"line_mean": 35.4330708661,
"line_max": 113,
"alpha_frac": 0.5856926734,
"autogenerated": false,
"ratio": 4.39411206077... |
"""A connector for Gitter."""
import logging
import aiohttp
import asyncio
import json
import urllib
from voluptuous import Required
from opsdroid.connector import Connector, register_event
from opsdroid.events import Message
_LOGGER = logging.getLogger(__name__)
GITTER_STREAM_API = "https://stream.gitter.im/v1/rooms... | {
"repo_name": "jacobtomlinson/opsdroid",
"path": "opsdroid/connector/gitter/__init__.py",
"copies": "3",
"size": "5012",
"license": "apache-2.0",
"hash": -5535807783010239000,
"line_mean": 35.8529411765,
"line_max": 85,
"alpha_frac": 0.5883878691,
"autogenerated": false,
"ratio": 4.09142857142857... |
"""A connector for Mattermost."""
import logging
import json
from mattermostdriver import Driver, Websocket
from voluptuous import Required
from opsdroid.connector import Connector, register_event
from opsdroid.events import Message
_LOGGER = logging.getLogger(__name__)
CONFIG_SCHEMA = {
Required("token"): str,
... | {
"repo_name": "jacobtomlinson/opsdroid",
"path": "opsdroid/connector/mattermost/__init__.py",
"copies": "2",
"size": "3963",
"license": "apache-2.0",
"hash": 372010124581057000,
"line_mean": 32.025,
"line_max": 80,
"alpha_frac": 0.5561443351,
"autogenerated": false,
"ratio": 4.068788501026694,
... |
"""A connector for Webex Teams."""
import json
import logging
import uuid
import os
import aiohttp
from webexteamssdk import WebexTeamsAPI
from voluptuous import Required, Url
from opsdroid.connector import Connector, register_event
from opsdroid.events import Message
_LOGGER = logging.getLogger(__name__)
CONFIG_S... | {
"repo_name": "FabioRosado/opsdroid",
"path": "opsdroid/connector/webexteams/__init__.py",
"copies": "3",
"size": "3910",
"license": "apache-2.0",
"hash": 3141325656245777400,
"line_mean": 31.8571428571,
"line_max": 86,
"alpha_frac": 0.5851662404,
"autogenerated": false,
"ratio": 4.01437371663244... |
"""A connector to send messages using the command line."""
import logging
import os
import sys
import platform
import asyncio
from opsdroid.connector import Connector, register_event
from opsdroid.events import Message
_LOGGER = logging.getLogger(__name__)
CONFIG_SCHEMA = {"bot-name": str}
class ConnectorShell(Conn... | {
"repo_name": "opsdroid/opsdroid",
"path": "opsdroid/connector/shell/__init__.py",
"copies": "3",
"size": "3948",
"license": "apache-2.0",
"hash": -8783304690829939000,
"line_mean": 29.1374045802,
"line_max": 104,
"alpha_frac": 0.5987841945,
"autogenerated": false,
"ratio": 4.258899676375404,
"... |
"""A connector which allows websocket connections."""
import logging
import json
import uuid
from datetime import datetime
import aiohttp
import aiohttp.web
from aiohttp import WSCloseCode
from opsdroid.connector import Connector, register_event
from opsdroid.events import Message
_LOGGER = logging.getLogger(__name... | {
"repo_name": "opsdroid/opsdroid",
"path": "opsdroid/connector/websocket/__init__.py",
"copies": "3",
"size": "4945",
"license": "apache-2.0",
"hash": -2900391089878215000,
"line_mean": 36.4621212121,
"line_max": 88,
"alpha_frac": 0.6107178969,
"autogenerated": false,
"ratio": 4.450945094509451,
... |
"""A console interface to the Ubuntu IRC logs using an Algolia backend."""
# pylint: disable=invalid-name
from threading import Thread
from algoliahelper import algoliahelper
from turwidal import turwidal
# Run Lola Run!
if __name__ == '__main__':
# Init with a quick sanity check.
class Ubunolia(turwidal.I... | {
"repo_name": "phrawzty/ubunolia",
"path": "ubunolia.py",
"copies": "1",
"size": "2928",
"license": "mpl-2.0",
"hash": 2609665577469510700,
"line_mean": 32.6551724138,
"line_max": 105,
"alpha_frac": 0.5338114754,
"autogenerated": false,
"ratio": 4.363636363636363,
"config_test": false,
"has_n... |
"""A container for a Pico-8 game, and routines to load and save game files."""
__all__ = [
'DEFAULT_VERSION',
'Game',
'InvalidP8HeaderError',
'InvalidP8SectionError'
]
import os
import re
import tempfile
from .. import util
from ..lua.lua import Lua
from ..lua.lua import PICO8_LUA_CHAR_LIMIT
from ..lu... | {
"repo_name": "dansanderson/picotool",
"path": "pico8/game/game.py",
"copies": "1",
"size": "26969",
"license": "mit",
"hash": -1126616443399691900,
"line_mean": 34.4388961892,
"line_max": 98,
"alpha_frac": 0.5355037265,
"autogenerated": false,
"ratio": 3.704024172503777,
"config_test": false,
... |
"""A container for a Pico-8 game, and routines to load and save game files."""
__all__ = [
'Game',
'InvalidP8HeaderError',
'InvalidP8SectionError'
]
import re
from .. import util
from ..lua.lua import Lua
from ..lua.lua import PICO8_LUA_CHAR_LIMIT
from ..lua.lua import PICO8_LUA_TOKEN_LIMIT
from ..gfx.gfx... | {
"repo_name": "andmatand/midi-to-pico8",
"path": "pico8/game/game.py",
"copies": "1",
"size": "13402",
"license": "mit",
"hash": 4676517104761051000,
"line_mean": 34.1758530184,
"line_max": 91,
"alpha_frac": 0.5248470378,
"autogenerated": false,
"ratio": 3.649782135076253,
"config_test": false,... |
"""A container for Moya code tracebacks"""
from __future__ import print_function
from .console import Console, Cell
from .template.errors import TemplateError
from .context.expression import ExpressionError
from .context.errors import SubstitutionError
from .moyaexceptions import MoyaException
from .compat import imp... | {
"repo_name": "moyaproject/moya",
"path": "moya/trace.py",
"copies": "1",
"size": "7410",
"license": "mit",
"hash": -8463510254811693000,
"line_mean": 30.2658227848,
"line_max": 107,
"alpha_frac": 0.5701754386,
"autogenerated": false,
"ratio": 4.064728469555678,
"config_test": false,
"has_no_... |
"""A container that contains information to generate documentation files"""
from __future__ import unicode_literals
from __future__ import print_function
from ..html import slugify
from ..compat import PY2
from json import dump
class Doc(object):
def __init__(self, namespace, name, doc_class="document"):
... | {
"repo_name": "moyaproject/moya",
"path": "moya/docgen/doc.py",
"copies": "1",
"size": "3022",
"license": "mit",
"hash": -4733038168351256000,
"line_mean": 29.22,
"line_max": 80,
"alpha_frac": 0.5086035738,
"autogenerated": false,
"ratio": 3.950326797385621,
"config_test": false,
"has_no_keyw... |
"""A contents manager that combine multiple content managers."""
# Copyright (c) IPython Development Team.
# Distributed under the terms of the Modified BSD License.
from .compat import JUPYTER
if JUPYTER:
from notebook.services.contents.manager import ContentsManager
from notebook.services.contents.filemanag... | {
"repo_name": "jupyter/jupyter-drive",
"path": "jupyterdrive/mixednbmanager.py",
"copies": "1",
"size": "7371",
"license": "bsd-2-clause",
"hash": -3464623326680197600,
"line_mean": 32.5045454545,
"line_max": 104,
"alpha_frac": 0.6022249356,
"autogenerated": false,
"ratio": 4.405857740585774,
"... |
"""A contents manager that uses HDFS file system for storage."""
# Copyright (c) A
# Distributed under the terms of the Modified BSD License.
from hdfs3 import HDFileSystem
from hdfscontents.hdfsio import HDFSManagerMixin
from hdfscontents.hdfscheckpoints import HDFSCheckpoints
from notebook.services.contents.manager... | {
"repo_name": "alshishtawy/hdfscontents",
"path": "hdfscontents/hdfsmanager.py",
"copies": "1",
"size": "14840",
"license": "apache-2.0",
"hash": 4596108433531908000,
"line_mean": 37.1491002571,
"line_max": 123,
"alpha_frac": 0.5573450135,
"autogenerated": false,
"ratio": 4.20873511060692,
"con... |
"""A contents manager that uses the ambry database for storage"""
import nbformat
import os
from ipython_genutils.importstring import import_item
from ipython_genutils.py3compat import getcwd, string_types
from notebook.services.contents.checkpoints import Checkpoints, GenericCheckpointsMixin
from notebook.services.co... | {
"repo_name": "CivicKnowledge/ambry-ui",
"path": "ambry_ui/jupyter.py",
"copies": "1",
"size": "16884",
"license": "bsd-3-clause",
"hash": 755308177526119300,
"line_mean": 28.9893428064,
"line_max": 98,
"alpha_frac": 0.5182421227,
"autogenerated": false,
"ratio": 4.4525316455696204,
"config_tes... |
"""A contents manager that uses the local file system for storage."""
# Copyright (c) IPython Development Team.
# Distributed under the terms of the Modified BSD License.
import base64
import errno
import io
import os
import shutil
from contextlib import contextmanager
import mimetypes
from tornado import web
from ... | {
"repo_name": "mattvonrocketstein/smash",
"path": "smashlib/ipy3x/html/services/contents/filemanager.py",
"copies": "1",
"size": "22850",
"license": "mit",
"hash": 5275885692462031000,
"line_mean": 35.0410094637,
"line_max": 89,
"alpha_frac": 0.544726477,
"autogenerated": false,
"ratio": 4.108973... |
"""A contents manager that uses the local file system for storage."""
# Copyright (c) IPython Development Team.
# Distributed under the terms of the Modified BSD License.
import io
import os
import shutil
import mimetypes
from tornado import web
from .filecheckpoints import FileCheckpoints
from .fileio import File... | {
"repo_name": "martydill/url_shortener",
"path": "code/venv/lib/python2.7/site-packages/IPython/html/services/contents/filemanager.py",
"copies": "4",
"size": "16487",
"license": "mit",
"hash": 7917994969353552000,
"line_mean": 33.8562367865,
"line_max": 97,
"alpha_frac": 0.5669921757,
"autogenerat... |
"""A contents manager that uses the local file system for storage."""
# Copyright (c) Jupyter Development Team.
# Distributed under the terms of the Modified BSD License.
from datetime import datetime
import errno
import io
import os
import shutil
import stat
import sys
import warnings
import mimetypes
import nbforma... | {
"repo_name": "sserrot/champion_relationships",
"path": "venv/Lib/site-packages/notebook/services/contents/filemanager.py",
"copies": "1",
"size": "22852",
"license": "mit",
"hash": -7042987752445893000,
"line_mean": 35.6805778491,
"line_max": 114,
"alpha_frac": 0.5625765797,
"autogenerated": false... |
"""A contents manager that uses the local file system for storage."""
# Copyright (c) Jupyter Development Team.
# Distributed under the terms of the Modified BSD License.
import errno
import io
import os
import shutil
import stat
import warnings
import mimetypes
import nbformat
from tornado import web
from .filech... | {
"repo_name": "unnikrishnankgs/va",
"path": "venv/lib/python3.5/site-packages/notebook/services/contents/filemanager.py",
"copies": "3",
"size": "17764",
"license": "bsd-2-clause",
"hash": -7572116872360113000,
"line_mean": 33.6953125,
"line_max": 114,
"alpha_frac": 0.5660887188,
"autogenerated": f... |
"""A contents manager that uses the local file system for storage."""
# Copyright (c) Jupyter Development Team.
# Distributed under the terms of the Modified BSD License.
import io
import os
import shutil
import mimetypes
import nbformat
from tornado import web
from .filecheckpoints import FileCheckpoints
from .fi... | {
"repo_name": "bdh1011/wau",
"path": "venv/lib/python2.7/site-packages/notebook/services/contents/filemanager.py",
"copies": "1",
"size": "16443",
"license": "mit",
"hash": 1926732610543299000,
"line_mean": 33.6898734177,
"line_max": 97,
"alpha_frac": 0.5661375661,
"autogenerated": false,
"ratio"... |
'''A Context Free Grammar class along with peripheral classes, data structures,
and algorithms.'''
import itertools
import cgi
from util.tree import Tree
from util.mixin import Comparable, Keyed, Subscripted, Primed
class Symbol(Comparable, Keyed):
'''A base class for symbols which appear in a grammar. Terminal ... | {
"repo_name": "bdusell/pycfg",
"path": "src/cfg/core.py",
"copies": "1",
"size": "15263",
"license": "mit",
"hash": 5842546802059050000,
"line_mean": 34.4953488372,
"line_max": 133,
"alpha_frac": 0.5860577868,
"autogenerated": false,
"ratio": 4.08866863112778,
"config_test": false,
"has_no_ke... |
"""A context is similar to a table, but doesn't have a specific name.
It is the basic container for intermediate data when evaluating a query.
"""
from __future__ import absolute_import
import collections
import itertools
import logging
import six
from tinyquery import repeated_util
from tinyquery import tq_modes
... | {
"repo_name": "Khan/tinyquery",
"path": "tinyquery/context.py",
"copies": "1",
"size": "13038",
"license": "mit",
"hash": 1012359320069804300,
"line_mean": 41.0580645161,
"line_max": 79,
"alpha_frac": 0.595413407,
"autogenerated": false,
"ratio": 4.346,
"config_test": false,
"has_no_keywords"... |
"""A context is similar to a table, but doesn't have a specific name.
It is the basic container for intermediate data when evaluating a query.
"""
import collections
import itertools
class Context(object):
"""Represents the columns accessible when evaluating an expression.
Fields:
num_rows: The num... | {
"repo_name": "burnhamup/tinyquery",
"path": "tinyquery/context.py",
"copies": "1",
"size": "8385",
"license": "mit",
"hash": -4483320483931194000,
"line_mean": 37.6405529954,
"line_max": 79,
"alpha_frac": 0.6553369112,
"autogenerated": false,
"ratio": 4.11432777232581,
"config_test": false,
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.