text stringlengths 0 1.05M | meta dict |
|---|---|
__author__ = 'joe krall'
from pom3_requirements_tree import *
import random
def random_cost(): return random.randint(1, 100)
def random_value(): return random.randint(1, 100)
class pom3_requirements:
def __init__(requirements, decisions):
requirements.heap = requirements_tree()
requirements.coun... | {
"repo_name": "gbtimmon/ase16GBT",
"path": "code/6/pom3/pom3_requirements.py",
"copies": "4",
"size": "3628",
"license": "unlicense",
"hash": -214456797270760300,
"line_mean": 43.256097561,
"line_max": 240,
"alpha_frac": 0.591786108,
"autogenerated": false,
"ratio": 3.871931696905016,
"config_t... |
__author__ = 'joe krall'
from pom3_team import *
import math
class pom3_teams:
def __init__(p3t, requirements, decisions):
p3t.teams = []
p3t.decisions = decisions
# Build Each Team
total_size = 0
while (total_size < requirements.count):
#specific sized teams
... | {
"repo_name": "gbtimmon/ase16GBT",
"path": "code/8/pom3/pom3_teams.py",
"copies": "3",
"size": "2436",
"license": "unlicense",
"hash": 8047755921148336000,
"line_mean": 38.3064516129,
"line_max": 146,
"alpha_frac": 0.5558292282,
"autogenerated": false,
"ratio": 3.4309859154929576,
"config_test"... |
__author__ = 'joe krall'
from pom3_teams import *
from pom3_requirements import *
import random
class pom3_decisions:
def __init__(p3d, X):
p3d.culture = X[0]
p3d.criticality = X[1]
p3d.criticality_modifier = X[2]
p3d.initial_known = X[3]
p3d.interdependency = X[4]
... | {
"repo_name": "gbtimmon/ase16GBT",
"path": "code/6/pom3/pom3.py",
"copies": "3",
"size": "2852",
"license": "unlicense",
"hash": 7168984368395335000,
"line_mean": 28.71875,
"line_max": 122,
"alpha_frac": 0.5014025245,
"autogenerated": false,
"ratio": 3.1724137931034484,
"config_test": false,
... |
__author__ = 'joe krall'
import math, random
MAX_VALUE = 1500
class Team(object):
def __init__(self, decisions):
self.decisions = decisions
self.team_size = decisions.team_size
self.plan = decisions.plan
self.size = decisions.size
self.visible = 1-decisions.initial_known... | {
"repo_name": "ase16-ta/performance",
"path": "pom3/pom3_team.py",
"copies": "4",
"size": "3322",
"license": "mit",
"hash": -2421356315619255300,
"line_mean": 33.9789473684,
"line_max": 122,
"alpha_frac": 0.6119807345,
"autogenerated": false,
"ratio": 3.670718232044199,
"config_test": false,
... |
__author__ = "Joe Kvedaras and Collin Day"
#Set up a tournament with a game and register players
from AllPlayAll import *
class TournamentService:
def __init__(self):
#Is tournament service the one to create a new tournament?
self.tournament = AllPlayAll()
self.game = None
def regist... | {
"repo_name": "PaulieC/sprint1_Council",
"path": "TournamentService.py",
"copies": "3",
"size": "1400",
"license": "apache-2.0",
"hash": -5648516623544861000,
"line_mean": 30.1111111111,
"line_max": 66,
"alpha_frac": 0.6235714286,
"autogenerated": false,
"ratio": 4.191616766467066,
"config_test... |
__author__ = 'Joel Ferrier'
import logging
from margaritashotgun._version import __version__
from margaritashotgun.client import Client
def set_stream_logger(name='margaritashotgun', level=logging.INFO,
format_string=None):
"""
Add a stream handler for the provided name and level to the... | {
"repo_name": "ThreatResponse/margaritashotgun",
"path": "margaritashotgun/__init__.py",
"copies": "1",
"size": "1697",
"license": "mit",
"hash": -3401052590678574000,
"line_mean": 28.7719298246,
"line_max": 79,
"alpha_frac": 0.6888626989,
"autogenerated": false,
"ratio": 3.713347921225383,
"co... |
__author__ = 'Joe Linn'
from .abstractdocument import AbstractDocument
class IndexDocument(AbstractDocument):
def __init__(self, document):
"""
@param document:
@type document: pylastica.document.Document
"""
super(IndexDocument, self).__init__(document)
self._op_t... | {
"repo_name": "jlinn/pylastica",
"path": "pylastica/bulk/action/indexdocument.py",
"copies": "1",
"size": "1295",
"license": "apache-2.0",
"hash": -1232194115419634700,
"line_mean": 22.9814814815,
"line_max": 57,
"alpha_frac": 0.5266409266,
"autogenerated": false,
"ratio": 4.450171821305842,
"c... |
__author__ = 'Joe Linn'
from .abstractfacet import AbstractFacet
import pylastica.exception
class GeoDistance(AbstractFacet):
"""
@see: http://www.elasticsearch.org/guide/reference/api/search/facets/geo-distance-facet/
"""
def set_ranges(self, ranges):
"""
Set all ranges for the face... | {
"repo_name": "jlinn/pylastica",
"path": "pylastica/facet/geodistance.py",
"copies": "1",
"size": "2616",
"license": "apache-2.0",
"hash": -4260385537275918000,
"line_mean": 29.4186046512,
"line_max": 110,
"alpha_frac": 0.5707186544,
"autogenerated": false,
"ratio": 3.8813056379821957,
"config_... |
__author__ = 'Joe Linn'
from .abstractfacet import AbstractFacet
import pylastica.exception
class Range(AbstractFacet):
def set_field(self, field):
"""
Set the field for the facet
@param field: field name
@type field: str
@return:
@rtype: self
"""
r... | {
"repo_name": "jlinn/pylastica",
"path": "pylastica/facet/range.py",
"copies": "1",
"size": "2886",
"license": "apache-2.0",
"hash": 7707225575467343000,
"line_mean": 30.3695652174,
"line_max": 129,
"alpha_frac": 0.5696465696,
"autogenerated": false,
"ratio": 3.8842530282637955,
"config_test": ... |
__author__ = 'Joe Linn'
from .abstractfacet import AbstractFacet
import pylastica.script
class Terms(AbstractFacet):
ORDER_COUNT = 'count'
ORDER_TERM = 'term'
ORDER_REVERSE_COUNT = 'reverse_count'
ORDER_REVERSE_TERM = 'reverse_term'
def set_field(self, field):
"""
Set the field fo... | {
"repo_name": "jlinn/pylastica",
"path": "pylastica/facet/terms.py",
"copies": "1",
"size": "2893",
"license": "apache-2.0",
"hash": -6056333321898072000,
"line_mean": 26.5523809524,
"line_max": 101,
"alpha_frac": 0.5568613896,
"autogenerated": false,
"ratio": 4.02924791086351,
"config_test": f... |
__author__ = 'Joe Linn'
from .abstractfilter import AbstractFilter
import pylastica.query.abstract
class Nested(AbstractFilter):
SCORE_MODE_AVG = 'avg'
SCORE_MODE_TOTAL = 'total'
SCORE_MODE_MAX = 'max'
SCORE_MODE_NONE = 'none'
def set_path(self, path):
"""
Set the nested document... | {
"repo_name": "jlinn/pylastica",
"path": "pylastica/filter/nested.py",
"copies": "1",
"size": "1174",
"license": "apache-2.0",
"hash": -5084385052110960000,
"line_mean": 26.3023255814,
"line_max": 78,
"alpha_frac": 0.5809199319,
"autogenerated": false,
"ratio": 3.8745874587458746,
"config_test"... |
__author__ = 'Joe Linn'
from .abstract import AbstractQuery
from pylastica.filter.abstractfilter import AbstractFilter
class FunctionScore(AbstractQuery):
"""
@see http://www.elasticsearch.org/guide/reference/query-dsl/function-score-query/
"""
BOOST_MODE_MULTIPLY = 'multiply'
BOOST_MODE_REPLACE... | {
"repo_name": "jlinn/pylastica",
"path": "pylastica/query/functionscore.py",
"copies": "1",
"size": "7840",
"license": "apache-2.0",
"hash": 1315953979941004000,
"line_mean": 34.1569506726,
"line_max": 135,
"alpha_frac": 0.5905612245,
"autogenerated": false,
"ratio": 4.139387539598733,
"config_... |
__author__ = 'Joe Linn'
from .abstract import AbstractQuery
import pylastica.doc_type
class Ids(AbstractQuery):
def __init__(self, doc_type=None, ids=None):
"""
@param doc_type: document type
@type doc_type: str or pylastica.doc_type.DocType
@param ids: document ids
@type ... | {
"repo_name": "jlinn/pylastica",
"path": "pylastica/query/ids.py",
"copies": "1",
"size": "2357",
"license": "apache-2.0",
"hash": 7973438084564383000,
"line_mean": 29.6103896104,
"line_max": 97,
"alpha_frac": 0.5498515062,
"autogenerated": false,
"ratio": 3.8576104746317514,
"config_test": fal... |
__author__ = 'Joe Linn'
from .abstract import AbstractQuery
import pylastica.exception
class Fuzzy(AbstractQuery):
def __init__(self, field_name=None, value=None):
"""
Set either both parameters or neither.
@param field_name: field name
@type field_name: str
@param value: s... | {
"repo_name": "jlinn/pylastica",
"path": "pylastica/query/fuzzy.py",
"copies": "1",
"size": "1434",
"license": "apache-2.0",
"hash": 7220946476255234000,
"line_mean": 29.5106382979,
"line_max": 102,
"alpha_frac": 0.5725244073,
"autogenerated": false,
"ratio": 4.03943661971831,
"config_test": fa... |
__author__ = 'Joe Linn'
from .abstract import AbstractQuery
import pylastica.exception
class Terms(AbstractQuery):
def __init__(self, key='', terms=None):
"""
Construct terms query
@param key: terms key
@type key: str
@param terms: terms list
@type terms: list
... | {
"repo_name": "jlinn/pylastica",
"path": "pylastica/query/terms.py",
"copies": "1",
"size": "1522",
"license": "apache-2.0",
"hash": 9063437062449149000,
"line_mean": 22.4153846154,
"line_max": 80,
"alpha_frac": 0.5098554534,
"autogenerated": false,
"ratio": 4.135869565217392,
"config_test": fa... |
__author__ = 'Joe Linn'
from .abstract import AbstractQuery
import pylastica.filter.abstractfilter
class Filtered(AbstractQuery):
def __init__(self, query, filter):
"""
@param query:
@type query: pylastica.query.AbstractQuery
@param filter:
@type filter: pylastica.filter.A... | {
"repo_name": "jlinn/pylastica",
"path": "pylastica/query/filtered.py",
"copies": "1",
"size": "1631",
"license": "apache-2.0",
"hash": -1993951384652071000,
"line_mean": 22.9852941176,
"line_max": 157,
"alpha_frac": 0.5561005518,
"autogenerated": false,
"ratio": 4.326259946949602,
"config_test... |
__author__ = 'Joe Linn'
from .abstract import AbstractQuery
import pylastica.script
class CustomScore(AbstractQuery):
def __init__(self, script=None, query=None):
"""
@param script:
@type script: str or dict or pylastica.script.Script
@param query:
@type query: str or pyla... | {
"repo_name": "jlinn/pylastica",
"path": "pylastica/query/customscore.py",
"copies": "1",
"size": "1473",
"license": "apache-2.0",
"hash": 7156394741840937000,
"line_mean": 26.7924528302,
"line_max": 82,
"alpha_frac": 0.5655125594,
"autogenerated": false,
"ratio": 4.013623978201635,
"config_tes... |
__author__ = 'Joe Linn'
from .abstract import AbstractQuery
class FuzzyLikeThis(AbstractQuery):
def __init__(self):
super(FuzzyLikeThis, self).__init__()
self._fields = []
self._like_text = ''
self._ignore_tf = False
self._max_query_terms = 25
self._min_similarity =... | {
"repo_name": "jlinn/pylastica",
"path": "pylastica/query/fuzzylikethis.py",
"copies": "1",
"size": "2717",
"license": "apache-2.0",
"hash": 2369624490136563700,
"line_mean": 23.7,
"line_max": 88,
"alpha_frac": 0.5034965035,
"autogenerated": false,
"ratio": 4.098039215686274,
"config_test": fal... |
__author__ = 'Joe Linn'
from .abstract import AbstractQuery
class MultiMatch(AbstractQuery):
def set_query(self, query=None):
"""
Set the query string
@param query:
@type query: str
@return:
@rtype: self
"""
if query is None:
query = ''
... | {
"repo_name": "jlinn/pylastica",
"path": "pylastica/query/multimatch.py",
"copies": "1",
"size": "1334",
"license": "apache-2.0",
"hash": -3042803616527522300,
"line_mean": 26.7916666667,
"line_max": 103,
"alpha_frac": 0.5472263868,
"autogenerated": false,
"ratio": 3.844380403458213,
"config_te... |
__author__ = 'Joe Linn'
from .abstract import AbstractQuery
class Common(AbstractQuery):
OPERATOR_AND = 'and'
OPERATOR_OR = 'or'
def __init__(self, field, query, cutoff_frequency):
"""
@param field: The field on which to query
@type field: str
@param query: The query stri... | {
"repo_name": "jlinn/pylastica",
"path": "pylastica/query/common.py",
"copies": "1",
"size": "3984",
"license": "apache-2.0",
"hash": -4409883161774306300,
"line_mean": 27.8695652174,
"line_max": 119,
"alpha_frac": 0.5697791165,
"autogenerated": false,
"ratio": 4.354098360655738,
"config_test":... |
__author__ = 'Joe Linn'
from .abstract import AbstractQuery
class Nested(AbstractQuery):
SCORE_MODE_AVG = 'avg'
SCORE_MODE_TOTAL = 'total'
SCORE_MODE_MAX = 'max'
SCORE_MODE_NONE = 'none'
def set_path(self, path):
"""
Set the path for the nested query
@param path:
... | {
"repo_name": "jlinn/pylastica",
"path": "pylastica/query/nested.py",
"copies": "1",
"size": "1075",
"license": "apache-2.0",
"hash": -631852661553361700,
"line_mean": 25.2195121951,
"line_max": 126,
"alpha_frac": 0.5609302326,
"autogenerated": false,
"ratio": 3.8120567375886525,
"config_test":... |
__author__ = 'Joe Linn'
from .abstract import AbstractQuery
class QueryString(AbstractQuery):
def __init__(self, query_string=''):
"""
@param query_string: optional query string
@type query_string: str
"""
super(QueryString, self).__init__()
self.set_query(query_st... | {
"repo_name": "jlinn/pylastica",
"path": "pylastica/query/querystring.py",
"copies": "1",
"size": "5120",
"license": "apache-2.0",
"hash": 5353363029984232000,
"line_mean": 26.5268817204,
"line_max": 110,
"alpha_frac": 0.5501953125,
"autogenerated": false,
"ratio": 4.200164068908942,
"config_te... |
__author__ = 'Joe Linn'
from .abstract import AbstractRiver
class RabbitMQ(AbstractRiver):
"""
@see: https://github.com/elasticsearch/elasticsearch-river-rabbitmq/blob/master/README.md
"""
river_type = 'rabbitmq'
EXCHANGE_DIRECT = 'direct'
EXCHANGE_FANOUT = 'fanout'
def __init__(self, ... | {
"repo_name": "jlinn/pylastica",
"path": "pylastica/river/rabbitmq.py",
"copies": "1",
"size": "5084",
"license": "apache-2.0",
"hash": 6680935378482521000,
"line_mean": 27.0883977901,
"line_max": 99,
"alpha_frac": 0.5570416994,
"autogenerated": false,
"ratio": 4.012628255722178,
"config_test":... |
__author__ = 'Joe Linn'
from .abstract import AbstractSuggestion
class Term(AbstractSuggestion):
"""
@see: http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-suggesters-term.html
"""
SORT_SCORE = 'score'
SORT_FREQUENCY = 'frequency'
SUGGEST_MODE_MISSING = 'missing'... | {
"repo_name": "jlinn/pylastica",
"path": "pylastica/suggest/term.py",
"copies": "1",
"size": "3443",
"license": "apache-2.0",
"hash": 9198573320334126000,
"line_mean": 28.6896551724,
"line_max": 110,
"alpha_frac": 0.5869880918,
"autogenerated": false,
"ratio": 4.022196261682243,
"config_test": ... |
__author__ = 'Joe Linn'
from .indexdocument import IndexDocument
class UpdateDocument(IndexDocument):
def __init__(self, document):
"""
@param document:
@type document: pylastica.document.Document
"""
super(UpdateDocument, self).__init__(document)
self._op_type = ... | {
"repo_name": "jlinn/pylastica",
"path": "pylastica/bulk/action/updatedocument.py",
"copies": "1",
"size": "2181",
"license": "apache-2.0",
"hash": 8356098875648754000,
"line_mean": 24.0689655172,
"line_max": 58,
"alpha_frac": 0.5263640532,
"autogenerated": false,
"ratio": 4.318811881188119,
"c... |
__author__ = 'Joe Linn'
from .index import *
from .shard import *
class Health(object):
def __init__(self, client):
"""
@param client:
@type client: pylastica.client.Client
"""
super(Health, self).__init__()
self._client = client
self.refresh()
self.... | {
"repo_name": "jlinn/pylastica",
"path": "pylastica/cluster/health/__init__.py",
"copies": "1",
"size": "3159",
"license": "apache-2.0",
"hash": 1374936515770466600,
"line_mean": 21.5642857143,
"line_max": 88,
"alpha_frac": 0.5147198481,
"autogenerated": false,
"ratio": 4.321477428180574,
"conf... |
__author__ = 'Joe Linn'
from venturocket.abstractclient import AbstractClient
class ListingClient(AbstractClient):
def create_listing(self, listing):
"""
Create a new listing
:param listing: a dictionary or listing object
:type listing: Listing or dict
:return: the id of t... | {
"repo_name": "Venturocket/venturocket-api-python",
"path": "venturocket/listing.py",
"copies": "1",
"size": "7216",
"license": "apache-2.0",
"hash": 322873537918398800,
"line_mean": 31.6561085973,
"line_max": 118,
"alpha_frac": 0.560559867,
"autogenerated": false,
"ratio": 4.149511213341,
"con... |
__author__ = 'Joe Linn'
import abc
from .action import Action
from pylastica.document import Document
from pylastica.script import Script
class AbstractDocument(Action):
__metaclass__ = abc.ABCMeta
def __init__(self, document):
"""
@param document:
@type document: pylastica.document... | {
"repo_name": "jlinn/pylastica",
"path": "pylastica/bulk/action/abstractdocument.py",
"copies": "1",
"size": "5315",
"license": "apache-2.0",
"hash": 7681600728150064000,
"line_mean": 26.1173469388,
"line_max": 123,
"alpha_frac": 0.5717779868,
"autogenerated": false,
"ratio": 4.293214862681745,
... |
__author__ = 'Joe Linn'
import abc
from pylastica.param import Param
class AbstractSuggestion(Param):
__metaclass__ = abc.ABCMeta
def __init__(self, name, field):
"""
@param name: the name of this suggestion
@type name: str
@param field: the field on which to perform this sug... | {
"repo_name": "jlinn/pylastica",
"path": "pylastica/suggest/abstract.py",
"copies": "1",
"size": "2023",
"license": "apache-2.0",
"hash": -6189212654098391000,
"line_mean": 24.2875,
"line_max": 77,
"alpha_frac": 0.5412753337,
"autogenerated": false,
"ratio": 4.267932489451477,
"config_test": fa... |
__author__ = 'Joe Linn'
import abc
import copy
import pylastica.param
import pylastica.util
class AbstractTransport(pylastica.param.Param):
__metaclass__ = abc.ABCMeta
def __init__(self, connection=None):
"""
@param connection:
@type connection: pylastica.connection.Connection
... | {
"repo_name": "jlinn/pylastica",
"path": "pylastica/transport/__init__.py",
"copies": "1",
"size": "2713",
"license": "apache-2.0",
"hash": 3049220558359982600,
"line_mean": 30.183908046,
"line_max": 129,
"alpha_frac": 0.5997051235,
"autogenerated": false,
"ratio": 4.734729493891797,
"config_te... |
__author__ = 'Joe Linn'
import abc
import pylastica
class AbstractType(pylastica.searchable.Searchable):
__metaclass__ = abc.ABCMeta
MAX_DOCS_PER_REQUEST = 1000
_index_name = None #name of index. Override this in implementing classes.
_type_name = None #name of document type. Override this in imp... | {
"repo_name": "jlinn/pylastica",
"path": "pylastica/doc_type/abstracttype.py",
"copies": "1",
"size": "3009",
"license": "apache-2.0",
"hash": -1417536402372230700,
"line_mean": 31.0106382979,
"line_max": 120,
"alpha_frac": 0.6001994018,
"autogenerated": false,
"ratio": 4.055256064690027,
"conf... |
__author__ = 'Joe Linn'
import abc
import pylastica.param
import pylastica.exception
class AbstractFilter(pylastica.param.Param):
__metaclass__ = abc.ABCMeta
def set_cached(self, cached=True):
"""
Sets the filter cache
@param cached:
@type cached: bool
@return:
... | {
"repo_name": "jlinn/pylastica",
"path": "pylastica/filter/abstractfilter.py",
"copies": "1",
"size": "5427",
"license": "apache-2.0",
"hash": 8099611884665425000,
"line_mean": 26.135,
"line_max": 145,
"alpha_frac": 0.5413672379,
"autogenerated": false,
"ratio": 4.216783216783217,
"config_test"... |
__author__ = 'Joe Linn'
import abc
import pylastica.param
class AbstractFacet(pylastica.param.Param):
__metaclass__ = abc.ABCMeta
def __init__(self, name):
"""
@param name: the name of the facet
@type name: str
"""
super(AbstractFacet, self).__init__()
self._f... | {
"repo_name": "jlinn/pylastica",
"path": "pylastica/facet/abstractfacet.py",
"copies": "1",
"size": "2558",
"license": "apache-2.0",
"hash": -1263840322016228400,
"line_mean": 24.8383838384,
"line_max": 121,
"alpha_frac": 0.5390930414,
"autogenerated": false,
"ratio": 4.0667726550079495,
"confi... |
__author__ = 'Joe Linn'
import abc
import pylastica.param
class AbstractRiver(pylastica.param.Param):
__metaclass__ = abc.ABCMeta
river_type = 'river' #override this in implementing classes
def __init__(self, client, name, index=None, doc_type=None, bulk_size=100, bulk_timeout='10ms'):
"""
... | {
"repo_name": "jlinn/pylastica",
"path": "pylastica/river/abstract.py",
"copies": "1",
"size": "3314",
"license": "apache-2.0",
"hash": 5798777701508507000,
"line_mean": 28.5892857143,
"line_max": 126,
"alpha_frac": 0.5606517803,
"autogenerated": false,
"ratio": 3.8942420681551115,
"config_test... |
__author__ = 'Joe Linn'
import abc
import pylastica.response
class AbstractException(Exception):
__metaclass__ = abc.ABCMeta
class BulkException(AbstractException):
pass
class ClientException(AbstractException):
pass
class ConnectionException(AbstractException):
def __init__(self, message, requ... | {
"repo_name": "jlinn/pylastica",
"path": "pylastica/exception/__init__.py",
"copies": "1",
"size": "2393",
"license": "apache-2.0",
"hash": -6182071576602282000,
"line_mean": 21.5849056604,
"line_max": 127,
"alpha_frac": 0.6113664856,
"autogenerated": false,
"ratio": 4.48968105065666,
"config_t... |
__author__ = 'Joe Linn'
import abc
class Searchable(object):
__metaclass__ = abc.ABCMeta
@abc.abstractmethod
def search(self, query=None, options=None):
"""
Searches results for a query
@param query: dict with all query data or a Query object
@type query: str or dict or py... | {
"repo_name": "jlinn/pylastica",
"path": "pylastica/searchable.py",
"copies": "1",
"size": "1165",
"license": "apache-2.0",
"hash": -5814970167696224000,
"line_mean": 26.0930232558,
"line_max": 81,
"alpha_frac": 0.5888412017,
"autogenerated": false,
"ratio": 4.145907473309609,
"config_test": fa... |
__author__ = 'Joe Linn'
import json
import logging
class Log(object):
def __init__(self, log=''):
"""
@param log: file name for logging
@type log: str
"""
super(Log, self).__init__()
self._log = True #log path or True if enabled
self._last_message = ''
... | {
"repo_name": "jlinn/pylastica",
"path": "pylastica/log.py",
"copies": "1",
"size": "1327",
"license": "apache-2.0",
"hash": -4852711712403131000,
"line_mean": 22.2807017544,
"line_max": 56,
"alpha_frac": 0.5094197438,
"autogenerated": false,
"ratio": 4.253205128205129,
"config_test": false,
... |
__author__ = 'Joe Linn'
import json
import pylastica.exception
import pylastica.util
class Param(object):
def __init__(self):
self._params = {}
self._rawParams = {}
def to_dict(self):
"""
Convert the params to a dict
@return:
@rtype: dict
"""
d... | {
"repo_name": "jlinn/pylastica",
"path": "pylastica/param.py",
"copies": "1",
"size": "2827",
"license": "apache-2.0",
"hash": -4529844134279438300,
"line_mean": 21.2598425197,
"line_max": 88,
"alpha_frac": 0.4888574461,
"autogenerated": false,
"ratio": 4.163475699558174,
"config_test": false,
... |
__author__ = 'Joe Linn'
import json
import pylastica.exception
class Response(object):
def __init__(self, response_string, status=None):
"""
@param response_string: response string (json)
@type response_string: str or dict
@param status: http status code
@type status: int
... | {
"repo_name": "jlinn/pylastica",
"path": "pylastica/response.py",
"copies": "1",
"size": "5205",
"license": "apache-2.0",
"hash": 113172025214110990,
"line_mean": 25.6923076923,
"line_max": 113,
"alpha_frac": 0.511623439,
"autogenerated": false,
"ratio": 4.606194690265487,
"config_test": false,... |
__author__ = 'Joe Linn'
import json
import pylastica.index
class Action(object):
OP_TYPE_CREATE = 'create'
OP_TYPE_INDEX = 'index'
OP_TYPE_DELETE = 'delete'
OP_TYPE_UPDATE = 'update'
def __init__(self, op_type=OP_TYPE_INDEX, metadata=None, source=None):
"""
@param op_type: see O... | {
"repo_name": "jlinn/pylastica",
"path": "pylastica/bulk/action/action.py",
"copies": "1",
"size": "3978",
"license": "apache-2.0",
"hash": -1719481612445723100,
"line_mean": 19.9368421053,
"line_max": 77,
"alpha_frac": 0.4901960784,
"autogenerated": false,
"ratio": 4.092592592592593,
"config_t... |
__author__ = 'Joe Linn'
import json
import pylastica.param
class Request(pylastica.param.Param):
POST = 'POST'
PUT = 'PUT'
GET = 'GET'
DELETE = 'DELETE'
def __init__(self, path, method='GET', data=None, query=None, connection=None):
"""
@param path: Request path
@type pat... | {
"repo_name": "jlinn/pylastica",
"path": "pylastica/request.py",
"copies": "1",
"size": "4507",
"license": "apache-2.0",
"hash": 3915264031387446000,
"line_mean": 21.9948979592,
"line_max": 128,
"alpha_frac": 0.5198579987,
"autogenerated": false,
"ratio": 4.304680038204394,
"config_test": false... |
__author__ = 'Joe Linn'
import json
import thrift
import thrift.transport
import thrift.transport.TSocket
import thrift.protocol
import Rest
from pylastica.transport import AbstractTransport
import pylastica.response
import pylastica.exception.connection
class ThriftTransport(AbstractTransport):
def __init__(sel... | {
"repo_name": "jlinn/pylastica",
"path": "pylastica/transport/thrifttransport/thrifttransport.py",
"copies": "1",
"size": "4217",
"license": "apache-2.0",
"hash": 1429407652143038000,
"line_mean": 36.990990991,
"line_max": 130,
"alpha_frac": 0.6231918425,
"autogenerated": false,
"ratio": 4.325128... |
__author__ = 'Joe Linn'
import pylastica.aggregation.abstractaggregation as abstract
class DateRange(abstract.AbstractAggregation):
def set_field(self, field):
"""
Set the field for this aggregation
@param field: the name of the document field on which to perform this aggregation
... | {
"repo_name": "jlinn/pylastica",
"path": "pylastica/aggregation/daterange.py",
"copies": "1",
"size": "1666",
"license": "apache-2.0",
"hash": 6638653960844240000,
"line_mean": 35.2391304348,
"line_max": 135,
"alpha_frac": 0.6170468187,
"autogenerated": false,
"ratio": 4.25,
"config_test": fals... |
__author__ = 'Joe Linn'
import pylastica.aggregation.abstractaggregation as abstract
class GeoDistance(abstract.AbstractAggregation):
def __init__(self, name, field, origin):
"""
@param name: the name of this aggregation
@type name: str
@param field: the field on which to perform ... | {
"repo_name": "jlinn/pylastica",
"path": "pylastica/aggregation/geodistance.py",
"copies": "1",
"size": "2559",
"license": "apache-2.0",
"hash": -1937658210945271600,
"line_mean": 32.6842105263,
"line_max": 115,
"alpha_frac": 0.5881203595,
"autogenerated": false,
"ratio": 4.154220779220779,
"co... |
__author__ = 'Joe Linn'
import pylastica.aggregation.abstractaggregation as abstract
class IpRange(abstract.AbstractAggregation):
def __init__(self, name, field):
"""
@param name: the name of this aggregation
@type name: str
@param field: the name of the document field on which to... | {
"repo_name": "jlinn/pylastica",
"path": "pylastica/aggregation/iprange.py",
"copies": "1",
"size": "1801",
"license": "apache-2.0",
"hash": 784719510539318700,
"line_mean": 32.3703703704,
"line_max": 96,
"alpha_frac": 0.5835646863,
"autogenerated": false,
"ratio": 4.121281464530893,
"config_te... |
__author__ = 'Joe Linn'
import pylastica.aggregation.abstractaggregation as abstract
class Range(abstract.SimpleAggregation):
def add_range(self, from_value=None, to_value=None):
"""
Add a range for this aggregation
@param from_value: low end of this range, exclusive (greater than)
... | {
"repo_name": "jlinn/pylastica",
"path": "pylastica/aggregation/range.py",
"copies": "1",
"size": "1223",
"license": "apache-2.0",
"hash": 2925475439841028600,
"line_mean": 33.9714285714,
"line_max": 112,
"alpha_frac": 0.6009811938,
"autogenerated": false,
"ratio": 4.090301003344481,
"config_te... |
__author__ = 'Joe Linn'
import pylastica.client
from .info import *
from .stats import *
class Node(object):
def __init__(self, name, client):
"""
@param name: node name
@type name: str
@param client:
@type client: pylastica.client.Client
"""
super(Node, se... | {
"repo_name": "jlinn/pylastica",
"path": "pylastica/node/__init__.py",
"copies": "1",
"size": "2054",
"license": "apache-2.0",
"hash": 7902339919338828000,
"line_mean": 24.3580246914,
"line_max": 128,
"alpha_frac": 0.5418695229,
"autogenerated": false,
"ratio": 4.191836734693878,
"config_test":... |
__author__ = 'Joe Linn'
import pylastica.client
import pylastica.query
class Search(object):
OPTION_SEARCH_TYPE = 'search_type'
OPTION_ROUTING = 'routing'
OPTION_PREFERENCE = 'preference'
OPTION_VERSION = 'version'
OPTION_TIMEOUT = 'timeout'
OPTION_FROM = 'from'
OPTION_SIZE = 'size'
O... | {
"repo_name": "jlinn/pylastica",
"path": "pylastica/search.py",
"copies": "1",
"size": "11309",
"license": "apache-2.0",
"hash": 7740559464249382000,
"line_mean": 26.1199040767,
"line_max": 133,
"alpha_frac": 0.5401892298,
"autogenerated": false,
"ratio": 4.063600431189364,
"config_test": false... |
__author__ = 'Joe Linn'
import pylastica.client
import pylastica.request
from . import health
from .settings import *
class Cluster(object):
def __init__(self, client):
"""
@param client:
@type client: pylastica.client.Client
"""
super(Cluster, self).__init__()
ass... | {
"repo_name": "jlinn/pylastica",
"path": "pylastica/cluster/__init__.py",
"copies": "1",
"size": "3493",
"license": "apache-2.0",
"hash": -4818010665230867000,
"line_mean": 25.2631578947,
"line_max": 128,
"alpha_frac": 0.5665616948,
"autogenerated": false,
"ratio": 4.3176761433868975,
"config_t... |
__author__ = 'Joe Linn'
import pylastica.client
class Settings(object):
def __init__(self, client):
"""
@param client:
@type client: pylastica.client.Client
"""
super(Settings, self).__init__()
assert isinstance(client, pylastica.client.Client), "client must be an i... | {
"repo_name": "jlinn/pylastica",
"path": "pylastica/cluster/settings.py",
"copies": "1",
"size": "3625",
"license": "apache-2.0",
"hash": -7940784021913657000,
"line_mean": 28.2338709677,
"line_max": 128,
"alpha_frac": 0.5577931034,
"autogenerated": false,
"ratio": 4.53125,
"config_test": false... |
__author__ = 'Joe Linn'
import pylastica.exception
from .abstractfilter import AbstractFilter
class Terms(AbstractFilter):
def __init__(self, key='', terms=None):
"""
@param key: document field
@type key: str
@param terms: list of term values
@type terms: list of str
... | {
"repo_name": "jlinn/pylastica",
"path": "pylastica/filter/terms.py",
"copies": "1",
"size": "2533",
"license": "apache-2.0",
"hash": -1821487579119781400,
"line_mean": 28.1149425287,
"line_max": 99,
"alpha_frac": 0.5448085274,
"autogenerated": false,
"ratio": 4.1592775041050905,
"config_test":... |
__author__ = 'Joe Linn'
import pylastica.exception
class HttpException(pylastica.exception.ConnectionException):
def __init__(self, error, request=None, response=None):
"""
@param error:
@type error: str
@param request:
@type request: pylastica.request.Request
@par... | {
"repo_name": "jlinn/pylastica",
"path": "pylastica/exception/connection.py",
"copies": "1",
"size": "1979",
"license": "apache-2.0",
"hash": -7880200666086298000,
"line_mean": 25.3866666667,
"line_max": 90,
"alpha_frac": 0.583628095,
"autogenerated": false,
"ratio": 4.339912280701754,
"config_... |
__author__ = 'Joe Linn'
import pylastica.exception
class ActionException(pylastica.exception.BulkException):
def __init__(self, response, *args, **kwargs):
"""
@param response:
@type response: pylastica.bulk.response.Response
@param args:
@type args:
@param kwargs... | {
"repo_name": "jlinn/pylastica",
"path": "pylastica/exception/bulk/response.py",
"copies": "1",
"size": "1402",
"license": "apache-2.0",
"hash": -7167334715230363000,
"line_mean": 23.1724137931,
"line_max": 96,
"alpha_frac": 0.5156918688,
"autogenerated": false,
"ratio": 4.0520231213872835,
"co... |
__author__ = 'Joe Linn'
import pylastica.exception
class ResponseException(pylastica.exception.BulkException):
def __init__(self, response_set, *args, **kwargs):
"""
@param response_set:
@type response_set: pylastica.bulk.responseset.ResponseSet
@param args:
@type args:
... | {
"repo_name": "jlinn/pylastica",
"path": "pylastica/exception/bulk/__init__.py",
"copies": "1",
"size": "2174",
"license": "apache-2.0",
"hash": -531039276341651650,
"line_mean": 26.5189873418,
"line_max": 149,
"alpha_frac": 0.5910763569,
"autogenerated": false,
"ratio": 4.15678776290631,
"conf... |
__author__ = 'Joe Linn'
#import pylastica.filter.abstractfilter
from .abstractfilter import AbstractFilter
class Prefix(AbstractFilter):
def __init__(self, field='', prefix=''):
"""
@param field: field name
@type field: str
@param prefix: prefix string
@type prefix: str
... | {
"repo_name": "jlinn/pylastica",
"path": "pylastica/filter/prefix.py",
"copies": "1",
"size": "1082",
"license": "apache-2.0",
"hash": 7849810878780825000,
"line_mean": 21.0816326531,
"line_max": 49,
"alpha_frac": 0.5194085028,
"autogenerated": false,
"ratio": 4.2265625,
"config_test": false,
... |
__author__ = 'Joe Linn'
#import pylastica.filter.abstractfilter
from .abstractfilter import AbstractFilter
class Query(AbstractFilter):
def __init__(self, query=None):
"""
@param query: query
@type query: dict or pylastica.query.abstract.AbstractQuery
"""
super(Query, self... | {
"repo_name": "jlinn/pylastica",
"path": "pylastica/filter/query.py",
"copies": "1",
"size": "1553",
"license": "apache-2.0",
"hash": 6957292880416579000,
"line_mean": 25.775862069,
"line_max": 105,
"alpha_frac": 0.5499034127,
"autogenerated": false,
"ratio": 4.086842105263158,
"config_test": f... |
__author__ = 'Joe Linn'
#import pylastica.filter.abstractfilter
from .abstractfilter import AbstractFilter
class Range(AbstractFilter):
def __init__(self, field_name=None, args=None):
"""
@param field_name: field name
@type field_name: str
@param args: field arguments
@typ... | {
"repo_name": "jlinn/pylastica",
"path": "pylastica/filter/range.py",
"copies": "1",
"size": "1090",
"license": "apache-2.0",
"hash": 827213064317292800,
"line_mean": 24.9523809524,
"line_max": 82,
"alpha_frac": 0.5596330275,
"autogenerated": false,
"ratio": 3.978102189781022,
"config_test": fa... |
__author__ = 'Joe Linn'
#import pylastica.filter.abstractfilter
import pylastica.doc_type
from .abstractfilter import AbstractFilter
class Ids(AbstractFilter):
def __init__(self, doc_type=None, ids=None):
"""
@param doc_type: document type
@type doc_type: str or pylastica.doc_type.DocType... | {
"repo_name": "jlinn/pylastica",
"path": "pylastica/filter/ids.py",
"copies": "1",
"size": "1816",
"license": "apache-2.0",
"hash": -6633412313280883000,
"line_mean": 27.375,
"line_max": 72,
"alpha_frac": 0.5561674009,
"autogenerated": false,
"ratio": 3.683569979716024,
"config_test": false,
... |
__author__ = 'Joe Linn'
import pylastica.index
class Status(object):
def __init__(self, client):
"""
@param client:
@type client: pylastica.client.Client
"""
super(Status, self).__init__()
self._client = client
self._data = None
self._response = Non... | {
"repo_name": "jlinn/pylastica",
"path": "pylastica/status.py",
"copies": "1",
"size": "3100",
"license": "apache-2.0",
"hash": 3888108726529906000,
"line_mean": 25.2711864407,
"line_max": 110,
"alpha_frac": 0.545483871,
"autogenerated": false,
"ratio": 4.384724186704385,
"config_test": false,
... |
__author__ = 'Joe Linn'
import pylastica.index
class Percolator(object):
def __init__(self, index):
"""
@param index:
@type index: pylastica.index.Index
"""
assert isinstance(index, pylastica.index.Index), "index must be an instance of Index: %r" % index
self._in... | {
"repo_name": "jlinn/pylastica",
"path": "pylastica/percolator.py",
"copies": "1",
"size": "2089",
"license": "apache-2.0",
"hash": -4886144436166045000,
"line_mean": 29.7205882353,
"line_max": 105,
"alpha_frac": 0.5825753949,
"autogenerated": false,
"ratio": 3.8190127970749543,
"config_test": ... |
__author__ = 'Joe Linn'
#import pylastica
from .abstract import AbstractQuery
class CustomFiltersScore(AbstractQuery):
SCORE_MODE_FIRST = 'first'
SCORE_MODE_MIN = 'min'
SCORE_MODE_MAX = 'max'
SCORE_MODE_TOTAL = 'total'
SCORE_MOD_AVG = 'avg'
SCORE_MODE_MULTIPLY = 'multiply'
def __init__(se... | {
"repo_name": "jlinn/pylastica",
"path": "pylastica/query/customfiltersscore.py",
"copies": "1",
"size": "2885",
"license": "apache-2.0",
"hash": -5947504466154917000,
"line_mean": 28.1414141414,
"line_max": 128,
"alpha_frac": 0.5663778163,
"autogenerated": false,
"ratio": 4.0013869625520115,
"... |
__author__ = 'Joe Linn'
#import pylastica
import pylastica.request
class Settings(object):
DEFAULT_REFRESH_INTERVAL = '1s'
def __init__(self, index):
"""
@param index:
@type index: pylastica.index.Index
"""
assert isinstance(index, pylastica.index.Index), "index must ... | {
"repo_name": "jlinn/pylastica",
"path": "pylastica/index/settings.py",
"copies": "1",
"size": "5463",
"license": "apache-2.0",
"hash": 6649502816068907000,
"line_mean": 24.7688679245,
"line_max": 98,
"alpha_frac": 0.5385319422,
"autogenerated": false,
"ratio": 4.241459627329193,
"config_test":... |
__author__ = 'Joe Linn'
#import pylastica
import pylastica.response
class ResponseSet(pylastica.response.Response):
def __init__(self, response, bulk_responses):
"""
@param response:
@type response: pylastica.response.Response
@param bulk_responses:
@type bulk_responses: l... | {
"repo_name": "jlinn/pylastica",
"path": "pylastica/bulk/responseset.py",
"copies": "1",
"size": "2017",
"license": "apache-2.0",
"hash": -6852128702837163000,
"line_mean": 20.4574468085,
"line_max": 70,
"alpha_frac": 0.4987605354,
"autogenerated": false,
"ratio": 4.394335511982571,
"config_tes... |
__author__ = 'Joe Linn'
import pylastica
class Mapping(object):
def __init__(self, doc_type=None, properties=None):
"""
@param type: optional DocType object
@type type: pylastica.doc_type.DocType
@param properties:
@type properties: dict
"""
self._mapping =... | {
"repo_name": "jlinn/pylastica",
"path": "pylastica/doc_type/mapping.py",
"copies": "1",
"size": "4705",
"license": "apache-2.0",
"hash": 9205465363536435000,
"line_mean": 25.1388888889,
"line_max": 115,
"alpha_frac": 0.5332624867,
"autogenerated": false,
"ratio": 4.174800354924579,
"config_tes... |
__author__ = 'Joe Linn'
import pylastica
class Stats(object):
def __init__(self, index):
"""
@param index:
@type index: pylastica.index.Index
"""
assert isinstance(index, pylastica.index.Index), "index must be of type Index: %r" % index
self._index = index
... | {
"repo_name": "jlinn/pylastica",
"path": "pylastica/index/stats.py",
"copies": "1",
"size": "1637",
"license": "apache-2.0",
"hash": -1640395415465310500,
"line_mean": 23.4328358209,
"line_max": 120,
"alpha_frac": 0.5241295052,
"autogenerated": false,
"ratio": 4.377005347593583,
"config_test": ... |
__author__ = 'Joe Linn'
import pylastica
class Status(object):
def __init__(self, index):
"""
@param index:
@type index: pylastica.index.Index
"""
assert isinstance(index, pylastica.index.Index), "index must be an instance of Index: %r" % index
self._index = index
... | {
"repo_name": "jlinn/pylastica",
"path": "pylastica/index/status.py",
"copies": "1",
"size": "2501",
"license": "apache-2.0",
"hash": 7398678967386184000,
"line_mean": 24.7835051546,
"line_max": 111,
"alpha_frac": 0.5349860056,
"autogenerated": false,
"ratio": 4.342013888888889,
"config_test": ... |
__author__ = 'Joe Linn'
import pylastica.param
import pylastica.scriptfields
from .abstract import AbstractQuery
from .matchall import MatchAll
from pylastica.suggest.suggest import Suggest
from pylastica.aggregation.abstractaggregation import AbstractAggregation
from pylastica.suggest.abstract import AbstractSuggesti... | {
"repo_name": "jlinn/pylastica",
"path": "pylastica/query/query.py",
"copies": "1",
"size": "8663",
"license": "apache-2.0",
"hash": -2388530740659822000,
"line_mean": 29.1846689895,
"line_max": 148,
"alpha_frac": 0.5740505599,
"autogenerated": false,
"ratio": 4.263287401574803,
"config_test": ... |
__author__ = 'Joe Linn'
import pylastica.request
import pylastica.client
import pylastica.exception
class Snapshot(object):
"""
@see http://www.elasticsearch.org/guide/en/elasticsearch/reference/master/modules-snapshots.html
"""
def __init__(self, client):
"""
@param client: a pylast... | {
"repo_name": "jlinn/pylastica",
"path": "pylastica/snapshot.py",
"copies": "1",
"size": "5715",
"license": "apache-2.0",
"hash": -3842733820612015600,
"line_mean": 36.6052631579,
"line_max": 128,
"alpha_frac": 0.6153980752,
"autogenerated": false,
"ratio": 4.43366951124903,
"config_test": fals... |
__author__ = 'Joe Linn'
import pylastica.searchable
from .settings import *
from .stats import *
from .status import *
class Index(pylastica.searchable.Searchable):
def __init__(self, client, name):
"""
@param client:
@type client: pylastica.client.Client
@param name: index name
... | {
"repo_name": "jlinn/pylastica",
"path": "pylastica/index/__init__.py",
"copies": "1",
"size": "9528",
"license": "apache-2.0",
"hash": 7473011289513981000,
"line_mean": 28.868338558,
"line_max": 125,
"alpha_frac": 0.5505877414,
"autogenerated": false,
"ratio": 4.354661791590494,
"config_test":... |
__author__ = 'Joe Linn'
import re
import dateutil.parser
import importlib
def get_param_name(name_or_object):
"""
Attempts to determine the name of the parameter based on its class
@param name_or_object: class instance or class name
@type name_or_object: str or object
@return: parameter name
@... | {
"repo_name": "jlinn/pylastica",
"path": "pylastica/util.py",
"copies": "1",
"size": "1225",
"license": "apache-2.0",
"hash": -3666697534981705700,
"line_mean": 28.1666666667,
"line_max": 96,
"alpha_frac": 0.6195918367,
"autogenerated": false,
"ratio": 3.249336870026525,
"config_test": false,
... |
__author__ = 'Joe Linn'
import requests
from pyflare import APIError
class PyflareClient(object):
CLOUDFLARE_URL = 'https://www.cloudflare.com/api_json.html'
def __init__(self, email, token):
"""
Instantiate a Pyflare client object
:param email: The email address associated with you... | {
"repo_name": "getlantern/pyflare",
"path": "pyflare/client.py",
"copies": "1",
"size": "15480",
"license": "apache-2.0",
"hash": 5715866523779764000,
"line_mean": 29.5928853755,
"line_max": 119,
"alpha_frac": 0.5144056848,
"autogenerated": false,
"ratio": 4.262114537444934,
"config_test": fals... |
__author__ = 'Joe Linn'
import requests
import json
from requests.exceptions import HTTPError
from pyflare import APIError
class PyflareClient(object):
CLOUDFLARE_URL = 'https://www.cloudflare.com/api_json.html'
def __init__(self, email, token):
"""
Instantiate a Pyflare client object
... | {
"repo_name": "jlinn/pyflare",
"path": "pyflare/client.py",
"copies": "3",
"size": "16159",
"license": "apache-2.0",
"hash": -7007849813490515000,
"line_mean": 29.7205323194,
"line_max": 119,
"alpha_frac": 0.519277183,
"autogenerated": false,
"ratio": 4.296463706461048,
"config_test": false,
... |
__author__ = 'Joe Linn'
import unittest
from pyflare import PyflareClient
from mock_responses import mock_response_client
class PyflareTest(unittest.TestCase):
def setUp(self):
self.pyflare = PyflareClient('address@example.com', 'your_api_key')
@mock_response_client
def test_stats(self):
... | {
"repo_name": "Inikup/pyflare",
"path": "tests/test_pyflare_client.py",
"copies": "3",
"size": "4810",
"license": "apache-2.0",
"hash": -7164958534977109000,
"line_mean": 34.6296296296,
"line_max": 95,
"alpha_frac": 0.6365904366,
"autogenerated": false,
"ratio": 3.5445836403831983,
"config_test... |
__author__ = 'Joe Linn'
import unittest
import pylastica
from tests.base import Base
class GeoPolygonTest(unittest.TestCase, Base):
def test_geo_point(self):
index = self._create_index('test')
doc_type = index.get_doc_type('test')
doc_type.mapping = {
'point': {
... | {
"repo_name": "jlinn/pylastica",
"path": "tests/filter/test_geopolygon.py",
"copies": "1",
"size": "1341",
"license": "apache-2.0",
"hash": -1495088952491568400,
"line_mean": 27.5319148936,
"line_max": 100,
"alpha_frac": 0.5123042506,
"autogenerated": false,
"ratio": 3.4651162790697674,
"config... |
__author__ = 'Joe Linn'
import unittest
import pylastica
from tests.base import Base
class MyTestCase(unittest.TestCase, Base):
def setUp(self):
client = self._get_client()
node = client.cluster.nodes[0]
self._has_rabbit_river = node.info.has_plugin('river-rabbitmq')
def test_to_dict... | {
"repo_name": "jlinn/pylastica",
"path": "tests/river/test_rabbitmq.py",
"copies": "1",
"size": "1528",
"license": "apache-2.0",
"hash": -8696531336156191000,
"line_mean": 30.1836734694,
"line_max": 76,
"alpha_frac": 0.5445026178,
"autogenerated": false,
"ratio": 3.800995024875622,
"config_test... |
__author__ = 'Joe Linn'
import unittest
import pylastica
from tests.base import Base
class MyTestCase(unittest.TestCase, Base):
def setUp(self):
self._index = self._create_index('test_functionscore')
self._doc_type = self._index.get_doc_type('test')
self._doc_type.mapping = {
... | {
"repo_name": "jlinn/pylastica",
"path": "tests/query/test_functionscore.py",
"copies": "1",
"size": "3680",
"license": "apache-2.0",
"hash": -8167676869063970000,
"line_mean": 36.1717171717,
"line_max": 117,
"alpha_frac": 0.4820652174,
"autogenerated": false,
"ratio": 3.728470111448835,
"confi... |
__author__ = 'Joe Linn'
import unittest
import pylastica
from tests.base import Base
class PrefixTest(unittest.TestCase, Base):
def test_different_prefixes(self):
index = self._create_index('test')
doc_type = index.get_doc_type('test')
mapping = pylastica.doc_type.Mapping(doc_type, {
... | {
"repo_name": "jlinn/pylastica",
"path": "tests/filter/test_prefix.py",
"copies": "1",
"size": "2364",
"license": "apache-2.0",
"hash": 4757463373138978000,
"line_mean": 35.9375,
"line_max": 81,
"alpha_frac": 0.6074450085,
"autogenerated": false,
"ratio": 3.3155680224403925,
"config_test": true... |
__author__ = 'Joe Linn'
import unittest
import pylastica
from tests.base import Base
class StatisticalTest(unittest.TestCase, Base):
def test_statistical_with_set_field(self):
client = self._get_client()
index = client.get_index('test')
index.create(options=True)
doc_type = index.... | {
"repo_name": "jlinn/pylastica",
"path": "tests/facet/test_statistical.py",
"copies": "1",
"size": "2926",
"license": "apache-2.0",
"hash": 9079513045397975000,
"line_mean": 37.5,
"line_max": 81,
"alpha_frac": 0.6083390294,
"autogenerated": false,
"ratio": 3.458628841607565,
"config_test": true... |
__author__ = 'Joe Linn'
import unittest
import pylastica
from tests.base import Base
class StatusTest(unittest.TestCase, Base):
def test_get_aliases(self):
index_name = 'test'
alias_name = 'test-alias'
index = self._create_index(index_name)
status = pylastica.index.Status(index)
... | {
"repo_name": "jlinn/pylastica",
"path": "tests/index/test_status.py",
"copies": "1",
"size": "1304",
"license": "apache-2.0",
"hash": 8059954414925745000,
"line_mean": 23.6037735849,
"line_max": 64,
"alpha_frac": 0.6119631902,
"autogenerated": false,
"ratio": 3.8240469208211145,
"config_test":... |
__author__ = 'Joe Linn'
import unittest
import pylastica
from tests.base import Base
class TermsTest(unittest.TestCase, Base):
def test_lookup(self):
index = self._create_index('test')
doc_type1 = index.get_doc_type('band')
doc_type2 = index.get_doc_type('members')
doc_type1.add_... | {
"repo_name": "jlinn/pylastica",
"path": "tests/filter/test_terms.py",
"copies": "1",
"size": "1059",
"license": "apache-2.0",
"hash": 814660073701157000,
"line_mean": 32.09375,
"line_max": 84,
"alpha_frac": 0.6185080264,
"autogenerated": false,
"ratio": 3.278637770897833,
"config_test": true,
... |
__author__ = 'Joe Linn'
import unittest
import pylastica
from tests.base import Base
class ThriftTest(unittest.TestCase, Base):
def setUp(self):
client = self._get_client()
node = client.cluster.nodes[0]
self._has_thrift = node.info.has_plugin('transport-thrift')
if self._has_thri... | {
"repo_name": "jlinn/pylastica",
"path": "tests/transport/test_thrift.py",
"copies": "1",
"size": "1924",
"license": "apache-2.0",
"hash": 6584483933401034000,
"line_mean": 38.2653061224,
"line_max": 108,
"alpha_frac": 0.6081081081,
"autogenerated": false,
"ratio": 3.6097560975609757,
"config_t... |
__author__ = 'Joe Linn'
import unittest
import pylastica
from tests.base import Base
class WildcardTest(unittest.TestCase, Base):
def test_search_with_analyzer(self):
client = self._get_client()
index = client.get_index('test')
index_params = {
'analysis': {
'a... | {
"repo_name": "jlinn/pylastica",
"path": "tests/query/test_wildcard.py",
"copies": "1",
"size": "1650",
"license": "apache-2.0",
"hash": -8178771479291574000,
"line_mean": 32,
"line_max": 81,
"alpha_frac": 0.5315151515,
"autogenerated": false,
"ratio": 3.658536585365854,
"config_test": true,
... |
__author__ = 'Joe Linn'
import urllib3
import json
import pylastica.transport
import pylastica.exception.connection
class Http(pylastica.transport.AbstractTransport):
_scheme = 'http'
METHOD_GET = 'GET'
METHOD_POST = 'POST'
METHOD_PUT = 'PUT'
METHOD_DELETE = 'DELETE'
def __init__(self, conn... | {
"repo_name": "jlinn/pylastica",
"path": "pylastica/transport/http.py",
"copies": "1",
"size": "4727",
"license": "apache-2.0",
"hash": -1114175608183616900,
"line_mean": 29.6948051948,
"line_max": 114,
"alpha_frac": 0.5603977153,
"autogenerated": false,
"ratio": 4.15377855887522,
"config_test"... |
__author__ = 'Joe Linn'
import urllib
from .abstracttype import *
from .mapping import *
import pylastica.searchable
class DocType(pylastica.searchable.Searchable):
def __init__(self, index, name):
"""
@param index: index object
@type index: pylastica.index.Index
@param name: docu... | {
"repo_name": "jlinn/pylastica",
"path": "pylastica/doc_type/__init__.py",
"copies": "1",
"size": "10600",
"license": "apache-2.0",
"hash": -5709351857365351000,
"line_mean": 33.4155844156,
"line_max": 127,
"alpha_frac": 0.5882075472,
"autogenerated": false,
"ratio": 4.173228346456693,
"config_... |
__author__ = 'Joe Linn'
class Info(object):
def __init__(self, node, params=None):
"""
@param node:
@type node: pylastica.node.Node
@param params: list of parameters to return. (settings, os, process, jvm, thread_pool, network, transport, http)
@type params: list of str
... | {
"repo_name": "jlinn/pylastica",
"path": "pylastica/node/info.py",
"copies": "1",
"size": "3610",
"license": "apache-2.0",
"hash": 1308002964992664000,
"line_mean": 28.5901639344,
"line_max": 127,
"alpha_frac": 0.5390581717,
"autogenerated": false,
"ratio": 4.3027413587604295,
"config_test": fa... |
__author__ = 'Joe Linn'
class Stats(object):
def __init__(self, node):
"""
@param node:
@type node: pylastica.node.Node
"""
super(Stats, self).__init__()
import pylastica.node
assert isinstance(node, pylastica.node.Node), "node must be an instance of pylasti... | {
"repo_name": "jlinn/pylastica",
"path": "pylastica/node/stats.py",
"copies": "1",
"size": "1677",
"license": "apache-2.0",
"hash": 903766897909942900,
"line_mean": 24.0298507463,
"line_max": 114,
"alpha_frac": 0.5175909362,
"autogenerated": false,
"ratio": 4.267175572519084,
"config_test": fal... |
__author__ = 'Joe Linn'
from .abstractfilter import AbstractGeoDistance
import pylastica.exception
class GeoDistanceRange(AbstractGeoDistance):
RANGE_FROM = 'from'
RANGE_TO = 'to'
RANGE_LT = 'lt'
RANGE_LTE = 'lte'
RANGE_GT = 'gt'
RANGE_GTE = 'gte'
RANGE_INCLUDE_LOWER = 'inc... | {
"repo_name": "jlinn/pylastica",
"path": "pylastica/filter/geodistancerange.py",
"copies": "1",
"size": "2334",
"license": "apache-2.0",
"hash": -720261775972621800,
"line_mean": 31.8260869565,
"line_max": 102,
"alpha_frac": 0.5801199657,
"autogenerated": false,
"ratio": 3.909547738693467,
"con... |
__author__ = 'Joe Linn'
from . import action
from .action import abstractdocument
from .response import *
from .responseset import *
import pylastica.exception.bulk
class Bulk(object):
DELIMITER = "\n"
UDP_DEFAULT_HOST = 'localhost'
UDP_DEFAULT_PORT = 9700
def __init__(self, client):
... | {
"repo_name": "jlinn/pylastica",
"path": "pylastica/bulk/__init__.py",
"copies": "1",
"size": "10252",
"license": "apache-2.0",
"hash": -7712297718069053000,
"line_mean": 29.4478527607,
"line_max": 162,
"alpha_frac": 0.5289699571,
"autogenerated": false,
"ratio": 4.364410387398893,
"config_test... |
__author__ = 'Joe Linn'
import base64
import pylastica.param
from pylastica.bulk.action import Action
class Document(pylastica.param.Param):
OP_TYPE_CREATE = Action.OP_TYPE_CREATE
def __init__(self, doc_id=None, data=None, doc_type=None, index=None):
"""
@param doc_id:
... | {
"repo_name": "jlinn/pylastica",
"path": "pylastica/document.py",
"copies": "1",
"size": "17692",
"license": "apache-2.0",
"hash": 7467414974530754000,
"line_mean": 21.2815789474,
"line_max": 117,
"alpha_frac": 0.4810083654,
"autogenerated": false,
"ratio": 4.4031856645097065,
"config_test": fa... |
__author__ = 'Joe Linn'
#import pylastica.filter.abstractfilter
from .abstractfilter import AbstractFilter
import pylastica.exception
class Bool(AbstractFilter):
def __init__(self):
self._boost = 1.0
self._must = []
self._should = []
self._must_not = []
super(Bo... | {
"repo_name": "jlinn/pylastica",
"path": "pylastica/filter/bool.py",
"copies": "1",
"size": "2355",
"license": "apache-2.0",
"hash": 7125085352341278000,
"line_mean": 26.3734939759,
"line_max": 123,
"alpha_frac": 0.5159235669,
"autogenerated": false,
"ratio": 4.220430107526882,
"config_test": f... |
__author__ = 'Joe Linn'
#import pylastica.filter.abstractfilter
from .abstractfilter import AbstractGeoDistance
class GeoDistance(AbstractGeoDistance):
DISTANCE_TYPE_ARC = 'arc'
DISTANCE_TYPE_PLANE = 'plane'
OPTIMIZE_BBOX_MEMORY = 'memory'
OPTIMIZE_BBOX_INDEXED = 'indexed'
OPTIMIZED_BB... | {
"repo_name": "jlinn/pylastica",
"path": "pylastica/filter/geodistance.py",
"copies": "1",
"size": "1498",
"license": "apache-2.0",
"hash": 5763043823082230000,
"line_mean": 25.7407407407,
"line_max": 77,
"alpha_frac": 0.5567423231,
"autogenerated": false,
"ratio": 3.994666666666667,
"config_te... |
__author__ = 'Joe Linn'
import pylastica.param
class Script(pylastica.param.Param):
LANG_MVEL = 'mvel'
LANG_JS = 'js'
LANG_GROOVY = 'groovy'
LANG_PYTHON = 'python'
LANG_NATIVE = 'native'
def __init__(self, script, params=None, lang=None, doc_id=None):
"""
@param... | {
"repo_name": "jlinn/pylastica",
"path": "pylastica/script.py",
"copies": "1",
"size": "5715",
"license": "apache-2.0",
"hash": 6540085597774645000,
"line_mean": 23.6278026906,
"line_max": 131,
"alpha_frac": 0.4885389326,
"autogenerated": false,
"ratio": 4.406322282189668,
"config_test": false,... |
__author__ = 'Joe Linn'
import pylastica.response
import pylastica.result
class ResultSet(object):
def __init__(self, response, query):
"""
@type response: pylastica.response.Response
@type query: pylastica.query.Query
"""
assert isinstance(response, pylastica.re... | {
"repo_name": "jlinn/pylastica",
"path": "pylastica/resultset.py",
"copies": "1",
"size": "4708",
"license": "apache-2.0",
"hash": -1975532750273158000,
"line_mean": 24.9028571429,
"line_max": 116,
"alpha_frac": 0.5140186916,
"autogenerated": false,
"ratio": 4.391791044776119,
"config_test": fa... |
__author__ = "Joel Pedraza"
__copyright__ = "Copyright 2014, Joel Pedraza"
__license__ = "MIT"
__all__ = ['RequestsFormatter', 'format_request', 'format_response']
from logging import Formatter
from requests import RequestException
class RequestsFormatter(Formatter):
def format(self, record):
if isinstan... | {
"repo_name": "saik0/hibget",
"path": "hibget/requests_logging.py",
"copies": "1",
"size": "1481",
"license": "mit",
"hash": 2536887734981434400,
"line_mean": 29.2448979592,
"line_max": 104,
"alpha_frac": 0.5962187711,
"autogenerated": false,
"ratio": 3.468384074941452,
"config_test": false,
... |
__author__ = "Joel Pedraza"
__copyright__ = "Copyright 2014, Joel Pedraza"
__license__ = "MIT"
from humblebundle import logger
def callback(func):
"""
A decorator to add a keyword arg 'callback' to execute a method on the
return value of a function
Used to add callbacks to the API calls
:param ... | {
"repo_name": "lutris/humblebundle-python",
"path": "humblebundle/decorators.py",
"copies": "1",
"size": "1053",
"license": "mit",
"hash": -1678038601734429000,
"line_mean": 24.0714285714,
"line_max": 76,
"alpha_frac": 0.6372269706,
"autogenerated": false,
"ratio": 4.228915662650603,
"config_te... |
__author__ = "Joel Pedraza"
__copyright__ = "Copyright 2014, Joel Pedraza"
__license__ = "MIT"
from progressbar import Widget, ProgressBar, Percentage, Bar, FileTransferSpeed
import datetime
UNITS = (
{'suffix': 'YiB', 'divider': 1024 ** 8},
{'suffix': 'ZiB', 'divider': 1024 ** 7},
{'suffix': 'EiB', 'divi... | {
"repo_name": "saik0/hibget",
"path": "hibget/widgets.py",
"copies": "1",
"size": "2503",
"license": "mit",
"hash": -4445045411057869000,
"line_mean": 32.8378378378,
"line_max": 117,
"alpha_frac": 0.5613264083,
"autogenerated": false,
"ratio": 3.3687752355316287,
"config_test": false,
"has_no... |
__author__ = "Joel Pedraza"
__copyright__ = "Copyright 2014, Joel Pedraza"
__license__ = "MIT"
from requests import RequestException
from humblebundle.exceptions import HumbleResponseException
from distutils.util import strtobool
from contextlib import contextmanager
import sys
@contextmanager
def smart_open(file, mo... | {
"repo_name": "saik0/hibget",
"path": "hibget/utils.py",
"copies": "1",
"size": "1625",
"license": "mit",
"hash": -7585356642658628000,
"line_mean": 25.2258064516,
"line_max": 86,
"alpha_frac": 0.5778461538,
"autogenerated": false,
"ratio": 3.92512077294686,
"config_test": false,
"has_no_keyw... |
__author__ = 'Joel Wright'
class FunHeap:
empty = True
data = None
rank = 0
left_heap = None
right_heap = None
def __init__(self, node_value=None):
if node_value is not None:
self.empty = False
self.data = node_value
self.rank = 1
self.le... | {
"repo_name": "joel-wright/max-heap",
"path": "max_heap/max_heap.py",
"copies": "1",
"size": "2358",
"license": "bsd-3-clause",
"hash": 2656623313691373600,
"line_mean": 27.4096385542,
"line_max": 95,
"alpha_frac": 0.5173876166,
"autogenerated": false,
"ratio": 3.821717990275527,
"config_test":... |
__author__ = 'Joel Wright'
from max_heap.max_heap import FunHeap
def values(heap):
while heap.data is not None:
v = heap.max()
heap = heap.remove()
yield v
def test_create():
heap = FunHeap()
assert heap.max() is None
def test_height():
heap = FunHeap()
heap = heap.insert... | {
"repo_name": "joel-wright/max-heap",
"path": "max_heap/test/test_fun_heap.py",
"copies": "1",
"size": "1202",
"license": "bsd-3-clause",
"hash": 7181080587247166000,
"line_mean": 20.8545454545,
"line_max": 37,
"alpha_frac": 0.5582362729,
"autogenerated": false,
"ratio": 3.163157894736842,
"con... |
__author__ = 'Joel Wright'
import gtk
import math
import cairo
import struct
import pygtk
pygtk.require('2.0')
class DrawingAreaExample(gtk.Window):
def __init__(self):
super(DrawingAreaExample, self).__init__()
self.set_title("Drawing Area Example")
self.resize(300,400)
self.set_... | {
"repo_name": "joel-wright/DDRPi",
"path": "experiments/python/gtk_drawing_area_pixels.py",
"copies": "1",
"size": "2077",
"license": "mit",
"hash": -3455044760412884500,
"line_mean": 23.7380952381,
"line_max": 71,
"alpha_frac": 0.5324987963,
"autogenerated": false,
"ratio": 3.235202492211838,
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.