repo
stringlengths
7
55
path
stringlengths
4
223
func_name
stringlengths
1
134
original_string
stringlengths
75
104k
language
stringclasses
1 value
code
stringlengths
75
104k
code_tokens
listlengths
19
28.4k
docstring
stringlengths
1
46.9k
docstring_tokens
listlengths
1
1.97k
sha
stringlengths
40
40
url
stringlengths
87
315
partition
stringclasses
3 values
summary
stringlengths
4
350
go-macaroon-bakery/py-macaroon-bakery
macaroonbakery/httpbakery/_error.py
Error.interaction_method
def interaction_method(self, kind, x): ''' Checks whether the error is an InteractionRequired error that implements the method with the given name, and JSON-unmarshals the method-specific data into x by calling its from_dict method with the deserialized JSON object. @param kind T...
python
def interaction_method(self, kind, x): ''' Checks whether the error is an InteractionRequired error that implements the method with the given name, and JSON-unmarshals the method-specific data into x by calling its from_dict method with the deserialized JSON object. @param kind T...
[ "def", "interaction_method", "(", "self", ",", "kind", ",", "x", ")", ":", "if", "self", ".", "info", "is", "None", "or", "self", ".", "code", "!=", "ERR_INTERACTION_REQUIRED", ":", "raise", "InteractionError", "(", "'not an interaction-required error (code {})'",...
Checks whether the error is an InteractionRequired error that implements the method with the given name, and JSON-unmarshals the method-specific data into x by calling its from_dict method with the deserialized JSON object. @param kind The interaction method kind (string). @param...
[ "Checks", "whether", "the", "error", "is", "an", "InteractionRequired", "error", "that", "implements", "the", "method", "with", "the", "given", "name", "and", "JSON", "-", "unmarshals", "the", "method", "-", "specific", "data", "into", "x", "by", "calling", ...
63ce1ef1dabe816eb8aaec48fbb46761c34ddf77
https://github.com/go-macaroon-bakery/py-macaroon-bakery/blob/63ce1ef1dabe816eb8aaec48fbb46761c34ddf77/macaroonbakery/httpbakery/_error.py#L120-L140
train
Checks whether the error is an InteractionRequired error with the given name and JSON - serializes the method - specific data into x by calling its from_dict method with the deserialized JSON object.
go-macaroon-bakery/py-macaroon-bakery
macaroonbakery/httpbakery/_error.py
ErrorInfo.from_dict
def from_dict(cls, serialized): '''Create a new ErrorInfo object from a JSON deserialized dictionary @param serialized The JSON object {dict} @return ErrorInfo object ''' if serialized is None: return None macaroon = serialized.get('Macaroon') ...
python
def from_dict(cls, serialized): '''Create a new ErrorInfo object from a JSON deserialized dictionary @param serialized The JSON object {dict} @return ErrorInfo object ''' if serialized is None: return None macaroon = serialized.get('Macaroon') ...
[ "def", "from_dict", "(", "cls", ",", "serialized", ")", ":", "if", "serialized", "is", "None", ":", "return", "None", "macaroon", "=", "serialized", ".", "get", "(", "'Macaroon'", ")", "if", "macaroon", "is", "not", "None", ":", "macaroon", "=", "bakery"...
Create a new ErrorInfo object from a JSON deserialized dictionary @param serialized The JSON object {dict} @return ErrorInfo object
[ "Create", "a", "new", "ErrorInfo", "object", "from", "a", "JSON", "deserialized", "dictionary" ]
63ce1ef1dabe816eb8aaec48fbb46761c34ddf77
https://github.com/go-macaroon-bakery/py-macaroon-bakery/blob/63ce1ef1dabe816eb8aaec48fbb46761c34ddf77/macaroonbakery/httpbakery/_error.py#L178-L197
train
Create a new ErrorInfo object from a JSON deserialized object.
ph4r05/monero-serialize
monero_serialize/xmrobj.py
dump_blob
async def dump_blob(elem, elem_type=None): """ Dumps blob message. Supports both blob and raw value. :param writer: :param elem: :param elem_type: :param params: :return: """ elem_is_blob = isinstance(elem, x.BlobType) data = getattr(elem, x.BlobType.DATA_ATTR) if elem_is_bl...
python
async def dump_blob(elem, elem_type=None): """ Dumps blob message. Supports both blob and raw value. :param writer: :param elem: :param elem_type: :param params: :return: """ elem_is_blob = isinstance(elem, x.BlobType) data = getattr(elem, x.BlobType.DATA_ATTR) if elem_is_bl...
[ "async", "def", "dump_blob", "(", "elem", ",", "elem_type", "=", "None", ")", ":", "elem_is_blob", "=", "isinstance", "(", "elem", ",", "x", ".", "BlobType", ")", "data", "=", "getattr", "(", "elem", ",", "x", ".", "BlobType", ".", "DATA_ATTR", ")", ...
Dumps blob message. Supports both blob and raw value. :param writer: :param elem: :param elem_type: :param params: :return:
[ "Dumps", "blob", "message", ".", "Supports", "both", "blob", "and", "raw", "value", "." ]
cebb3ba2aaf2e9211b1dcc6db2bab02946d06e42
https://github.com/ph4r05/monero-serialize/blob/cebb3ba2aaf2e9211b1dcc6db2bab02946d06e42/monero_serialize/xmrobj.py#L70-L88
train
Dumps blob message.
ph4r05/monero-serialize
monero_serialize/xmrobj.py
dump_container
async def dump_container(obj, container, container_type, params=None, field_archiver=None): """ Serializes container as popo :param obj: :param container: :param container_type: :param params: :param field_archiver: :return: """ field_archiver = field_archiver if field_archiver ...
python
async def dump_container(obj, container, container_type, params=None, field_archiver=None): """ Serializes container as popo :param obj: :param container: :param container_type: :param params: :param field_archiver: :return: """ field_archiver = field_archiver if field_archiver ...
[ "async", "def", "dump_container", "(", "obj", ",", "container", ",", "container_type", ",", "params", "=", "None", ",", "field_archiver", "=", "None", ")", ":", "field_archiver", "=", "field_archiver", "if", "field_archiver", "else", "dump_field", "elem_type", "...
Serializes container as popo :param obj: :param container: :param container_type: :param params: :param field_archiver: :return:
[ "Serializes", "container", "as", "popo" ]
cebb3ba2aaf2e9211b1dcc6db2bab02946d06e42
https://github.com/ph4r05/monero-serialize/blob/cebb3ba2aaf2e9211b1dcc6db2bab02946d06e42/monero_serialize/xmrobj.py#L102-L124
train
Serializes a container as popo
ph4r05/monero-serialize
monero_serialize/xmrobj.py
load_container
async def load_container(obj, container_type, params=None, container=None, field_archiver=None): """ Loads container of elements from the object representation. Supports the container ref. Returns loaded container. :param reader: :param container_type: :param params: :param container: :...
python
async def load_container(obj, container_type, params=None, container=None, field_archiver=None): """ Loads container of elements from the object representation. Supports the container ref. Returns loaded container. :param reader: :param container_type: :param params: :param container: :...
[ "async", "def", "load_container", "(", "obj", ",", "container_type", ",", "params", "=", "None", ",", "container", "=", "None", ",", "field_archiver", "=", "None", ")", ":", "field_archiver", "=", "field_archiver", "if", "field_archiver", "else", "load_field", ...
Loads container of elements from the object representation. Supports the container ref. Returns loaded container. :param reader: :param container_type: :param params: :param container: :param field_archiver: :return:
[ "Loads", "container", "of", "elements", "from", "the", "object", "representation", ".", "Supports", "the", "container", "ref", ".", "Returns", "loaded", "container", "." ]
cebb3ba2aaf2e9211b1dcc6db2bab02946d06e42
https://github.com/ph4r05/monero-serialize/blob/cebb3ba2aaf2e9211b1dcc6db2bab02946d06e42/monero_serialize/xmrobj.py#L127-L155
train
Load a container of elements from the object representation. Supports the container ref.
ph4r05/monero-serialize
monero_serialize/xmrobj.py
dump_message_field
async def dump_message_field(obj, msg, field, field_archiver=None): """ Dumps a message field to the object. Field is defined by the message field specification. :param obj: :param msg: :param field: :param field_archiver: :return: """ fname, ftype, params = field[0], field[1], fiel...
python
async def dump_message_field(obj, msg, field, field_archiver=None): """ Dumps a message field to the object. Field is defined by the message field specification. :param obj: :param msg: :param field: :param field_archiver: :return: """ fname, ftype, params = field[0], field[1], fiel...
[ "async", "def", "dump_message_field", "(", "obj", ",", "msg", ",", "field", ",", "field_archiver", "=", "None", ")", ":", "fname", ",", "ftype", ",", "params", "=", "field", "[", "0", "]", ",", "field", "[", "1", "]", ",", "field", "[", "2", ":", ...
Dumps a message field to the object. Field is defined by the message field specification. :param obj: :param msg: :param field: :param field_archiver: :return:
[ "Dumps", "a", "message", "field", "to", "the", "object", ".", "Field", "is", "defined", "by", "the", "message", "field", "specification", "." ]
cebb3ba2aaf2e9211b1dcc6db2bab02946d06e42
https://github.com/ph4r05/monero-serialize/blob/cebb3ba2aaf2e9211b1dcc6db2bab02946d06e42/monero_serialize/xmrobj.py#L158-L171
train
Dumps a message field to the object.
ph4r05/monero-serialize
monero_serialize/xmrobj.py
load_message_field
async def load_message_field(obj, msg, field, field_archiver=None): """ Loads message field from the object. Field is defined by the message field specification. Returns loaded value, supports field reference. :param reader: :param msg: :param field: :param field_archiver: :return: ...
python
async def load_message_field(obj, msg, field, field_archiver=None): """ Loads message field from the object. Field is defined by the message field specification. Returns loaded value, supports field reference. :param reader: :param msg: :param field: :param field_archiver: :return: ...
[ "async", "def", "load_message_field", "(", "obj", ",", "msg", ",", "field", ",", "field_archiver", "=", "None", ")", ":", "fname", ",", "ftype", ",", "params", "=", "field", "[", "0", "]", ",", "field", "[", "1", "]", ",", "field", "[", "2", ":", ...
Loads message field from the object. Field is defined by the message field specification. Returns loaded value, supports field reference. :param reader: :param msg: :param field: :param field_archiver: :return:
[ "Loads", "message", "field", "from", "the", "object", ".", "Field", "is", "defined", "by", "the", "message", "field", "specification", ".", "Returns", "loaded", "value", "supports", "field", "reference", "." ]
cebb3ba2aaf2e9211b1dcc6db2bab02946d06e42
https://github.com/ph4r05/monero-serialize/blob/cebb3ba2aaf2e9211b1dcc6db2bab02946d06e42/monero_serialize/xmrobj.py#L174-L187
train
Load message field from the object.
ph4r05/monero-serialize
monero_serialize/xmrobj.py
dump_message
async def dump_message(obj, msg, field_archiver=None): """ Dumps message to the object. Returns message popo representation. :param obj: :param msg: :param field_archiver: :return: """ mtype = msg.__class__ fields = mtype.f_specs() obj = collections.OrderedDict() if obj is ...
python
async def dump_message(obj, msg, field_archiver=None): """ Dumps message to the object. Returns message popo representation. :param obj: :param msg: :param field_archiver: :return: """ mtype = msg.__class__ fields = mtype.f_specs() obj = collections.OrderedDict() if obj is ...
[ "async", "def", "dump_message", "(", "obj", ",", "msg", ",", "field_archiver", "=", "None", ")", ":", "mtype", "=", "msg", ".", "__class__", "fields", "=", "mtype", ".", "f_specs", "(", ")", "obj", "=", "collections", ".", "OrderedDict", "(", ")", "if"...
Dumps message to the object. Returns message popo representation. :param obj: :param msg: :param field_archiver: :return:
[ "Dumps", "message", "to", "the", "object", ".", "Returns", "message", "popo", "representation", "." ]
cebb3ba2aaf2e9211b1dcc6db2bab02946d06e42
https://github.com/ph4r05/monero-serialize/blob/cebb3ba2aaf2e9211b1dcc6db2bab02946d06e42/monero_serialize/xmrobj.py#L190-L206
train
Dumps message to the object.
ph4r05/monero-serialize
monero_serialize/xmrobj.py
load_message
async def load_message(obj, msg_type, msg=None, field_archiver=None): """ Loads message if the given type from the object. Supports reading directly to existing message. :param obj: :param msg_type: :param msg: :param field_archiver: :return: """ msg = msg_type() if msg is None ...
python
async def load_message(obj, msg_type, msg=None, field_archiver=None): """ Loads message if the given type from the object. Supports reading directly to existing message. :param obj: :param msg_type: :param msg: :param field_archiver: :return: """ msg = msg_type() if msg is None ...
[ "async", "def", "load_message", "(", "obj", ",", "msg_type", ",", "msg", "=", "None", ",", "field_archiver", "=", "None", ")", ":", "msg", "=", "msg_type", "(", ")", "if", "msg", "is", "None", "else", "msg", "fields", "=", "msg_type", ".", "f_specs", ...
Loads message if the given type from the object. Supports reading directly to existing message. :param obj: :param msg_type: :param msg: :param field_archiver: :return:
[ "Loads", "message", "if", "the", "given", "type", "from", "the", "object", ".", "Supports", "reading", "directly", "to", "existing", "message", "." ]
cebb3ba2aaf2e9211b1dcc6db2bab02946d06e42
https://github.com/ph4r05/monero-serialize/blob/cebb3ba2aaf2e9211b1dcc6db2bab02946d06e42/monero_serialize/xmrobj.py#L209-L226
train
Loads a message from the given object.
ph4r05/monero-serialize
monero_serialize/xmrobj.py
dump_variant
async def dump_variant(obj, elem, elem_type=None, params=None, field_archiver=None): """ Transform variant to the popo object representation. :param obj: :param elem: :param elem_type: :param params: :param field_archiver: :return: """ field_archiver = field_archiver if field_ar...
python
async def dump_variant(obj, elem, elem_type=None, params=None, field_archiver=None): """ Transform variant to the popo object representation. :param obj: :param elem: :param elem_type: :param params: :param field_archiver: :return: """ field_archiver = field_archiver if field_ar...
[ "async", "def", "dump_variant", "(", "obj", ",", "elem", ",", "elem_type", "=", "None", ",", "params", "=", "None", ",", "field_archiver", "=", "None", ")", ":", "field_archiver", "=", "field_archiver", "if", "field_archiver", "else", "dump_field", "if", "is...
Transform variant to the popo object representation. :param obj: :param elem: :param elem_type: :param params: :param field_archiver: :return:
[ "Transform", "variant", "to", "the", "popo", "object", "representation", "." ]
cebb3ba2aaf2e9211b1dcc6db2bab02946d06e42
https://github.com/ph4r05/monero-serialize/blob/cebb3ba2aaf2e9211b1dcc6db2bab02946d06e42/monero_serialize/xmrobj.py#L229-L250
train
Transform a popo object representation.
ph4r05/monero-serialize
monero_serialize/xmrobj.py
load_variant
async def load_variant(obj, elem, elem_type=None, params=None, field_archiver=None, wrapped=None): """ Loads variant from the obj representation :param obj: :param elem: :param elem_type: :param params: :param field_archiver: :param wrapped: :return: """ field_archiver = fiel...
python
async def load_variant(obj, elem, elem_type=None, params=None, field_archiver=None, wrapped=None): """ Loads variant from the obj representation :param obj: :param elem: :param elem_type: :param params: :param field_archiver: :param wrapped: :return: """ field_archiver = fiel...
[ "async", "def", "load_variant", "(", "obj", ",", "elem", ",", "elem_type", "=", "None", ",", "params", "=", "None", ",", "field_archiver", "=", "None", ",", "wrapped", "=", "None", ")", ":", "field_archiver", "=", "field_archiver", "if", "field_archiver", ...
Loads variant from the obj representation :param obj: :param elem: :param elem_type: :param params: :param field_archiver: :param wrapped: :return:
[ "Loads", "variant", "from", "the", "obj", "representation", ":", "param", "obj", ":", ":", "param", "elem", ":", ":", "param", "elem_type", ":", ":", "param", "params", ":", ":", "param", "field_archiver", ":", ":", "param", "wrapped", ":", ":", "return"...
cebb3ba2aaf2e9211b1dcc6db2bab02946d06e42
https://github.com/ph4r05/monero-serialize/blob/cebb3ba2aaf2e9211b1dcc6db2bab02946d06e42/monero_serialize/xmrobj.py#L253-L280
train
Load a single element from the obj representation.
ph4r05/monero-serialize
monero_serialize/xmrobj.py
dump_field
async def dump_field(obj, elem, elem_type, params=None): """ Dumps generic field to the popo object representation, according to the element specification. General multiplexer. :param obj: :param elem: :param elem_type: :param params: :return: """ if isinstance(elem, (int, bool)...
python
async def dump_field(obj, elem, elem_type, params=None): """ Dumps generic field to the popo object representation, according to the element specification. General multiplexer. :param obj: :param elem: :param elem_type: :param params: :return: """ if isinstance(elem, (int, bool)...
[ "async", "def", "dump_field", "(", "obj", ",", "elem", ",", "elem_type", ",", "params", "=", "None", ")", ":", "if", "isinstance", "(", "elem", ",", "(", "int", ",", "bool", ")", ")", "or", "issubclass", "(", "elem_type", ",", "x", ".", "UVarintType"...
Dumps generic field to the popo object representation, according to the element specification. General multiplexer. :param obj: :param elem: :param elem_type: :param params: :return:
[ "Dumps", "generic", "field", "to", "the", "popo", "object", "representation", "according", "to", "the", "element", "specification", ".", "General", "multiplexer", "." ]
cebb3ba2aaf2e9211b1dcc6db2bab02946d06e42
https://github.com/ph4r05/monero-serialize/blob/cebb3ba2aaf2e9211b1dcc6db2bab02946d06e42/monero_serialize/xmrobj.py#L283-L313
train
Dumps generic field to the popo object representation according to the element specification.
ph4r05/monero-serialize
monero_serialize/xmrobj.py
load_field
async def load_field(obj, elem_type, params=None, elem=None): """ Loads a field from the reader, based on the field type specification. Demultiplexer. :param obj: :param elem_type: :param params: :param elem: :return: """ if issubclass(elem_type, x.UVarintType) or issubclass(elem_ty...
python
async def load_field(obj, elem_type, params=None, elem=None): """ Loads a field from the reader, based on the field type specification. Demultiplexer. :param obj: :param elem_type: :param params: :param elem: :return: """ if issubclass(elem_type, x.UVarintType) or issubclass(elem_ty...
[ "async", "def", "load_field", "(", "obj", ",", "elem_type", ",", "params", "=", "None", ",", "elem", "=", "None", ")", ":", "if", "issubclass", "(", "elem_type", ",", "x", ".", "UVarintType", ")", "or", "issubclass", "(", "elem_type", ",", "x", ".", ...
Loads a field from the reader, based on the field type specification. Demultiplexer. :param obj: :param elem_type: :param params: :param elem: :return:
[ "Loads", "a", "field", "from", "the", "reader", "based", "on", "the", "field", "type", "specification", ".", "Demultiplexer", "." ]
cebb3ba2aaf2e9211b1dcc6db2bab02946d06e42
https://github.com/ph4r05/monero-serialize/blob/cebb3ba2aaf2e9211b1dcc6db2bab02946d06e42/monero_serialize/xmrobj.py#L316-L349
train
Load a single field from the reader based on the field type specification.
Julian/Seep
seep/core.py
extend
def extend(validator_cls): """ Extend the given :class:`jsonschema.IValidator` with the Seep layer. """ Validator = jsonschema.validators.extend( validator_cls, { "properties": _properties_with_defaults(validator_cls), } ) class Blueprinter(Validator): def ...
python
def extend(validator_cls): """ Extend the given :class:`jsonschema.IValidator` with the Seep layer. """ Validator = jsonschema.validators.extend( validator_cls, { "properties": _properties_with_defaults(validator_cls), } ) class Blueprinter(Validator): def ...
[ "def", "extend", "(", "validator_cls", ")", ":", "Validator", "=", "jsonschema", ".", "validators", ".", "extend", "(", "validator_cls", ",", "{", "\"properties\"", ":", "_properties_with_defaults", "(", "validator_cls", ")", ",", "}", ")", "class", "Blueprinter...
Extend the given :class:`jsonschema.IValidator` with the Seep layer.
[ "Extend", "the", "given", ":", "class", ":", "jsonschema", ".", "IValidator", "with", "the", "Seep", "layer", "." ]
57b5f391d0e23afb7777293a9002125967a014ad
https://github.com/Julian/Seep/blob/57b5f391d0e23afb7777293a9002125967a014ad/seep/core.py#L15-L32
train
Extend the given validator with the Seep layer.
Julian/Seep
seep/core.py
instantiate
def instantiate(data, blueprint): """ Instantiate the given data using the blueprinter. Arguments --------- blueprint (collections.Mapping): a blueprint (JSON Schema with Seep properties) """ Validator = jsonschema.validators.validator_for(blueprint) blueprinter = ext...
python
def instantiate(data, blueprint): """ Instantiate the given data using the blueprinter. Arguments --------- blueprint (collections.Mapping): a blueprint (JSON Schema with Seep properties) """ Validator = jsonschema.validators.validator_for(blueprint) blueprinter = ext...
[ "def", "instantiate", "(", "data", ",", "blueprint", ")", ":", "Validator", "=", "jsonschema", ".", "validators", ".", "validator_for", "(", "blueprint", ")", "blueprinter", "=", "extend", "(", "Validator", ")", "(", "blueprint", ")", "return", "blueprinter", ...
Instantiate the given data using the blueprinter. Arguments --------- blueprint (collections.Mapping): a blueprint (JSON Schema with Seep properties)
[ "Instantiate", "the", "given", "data", "using", "the", "blueprinter", "." ]
57b5f391d0e23afb7777293a9002125967a014ad
https://github.com/Julian/Seep/blob/57b5f391d0e23afb7777293a9002125967a014ad/seep/core.py#L35-L49
train
Instantiate the given data using the blueprinter.
dbarsam/python-vsgen
vsgen/__main__.py
main
def main(argv=None): """ The entry point of the script. """ from vsgen import VSGSuite from vsgen import VSGLogger # Special case to use the sys.argv when main called without a list. if argv is None: argv = sys.argv # Initialize the application logger pylogger = VSGLogger()...
python
def main(argv=None): """ The entry point of the script. """ from vsgen import VSGSuite from vsgen import VSGLogger # Special case to use the sys.argv when main called without a list. if argv is None: argv = sys.argv # Initialize the application logger pylogger = VSGLogger()...
[ "def", "main", "(", "argv", "=", "None", ")", ":", "from", "vsgen", "import", "VSGSuite", "from", "vsgen", "import", "VSGLogger", "# Special case to use the sys.argv when main called without a list.", "if", "argv", "is", "None", ":", "argv", "=", "sys", ".", "argv...
The entry point of the script.
[ "The", "entry", "point", "of", "the", "script", "." ]
640191bb018a1ff7d7b7a4982e0d3c1a423ba878
https://github.com/dbarsam/python-vsgen/blob/640191bb018a1ff7d7b7a4982e0d3c1a423ba878/vsgen/__main__.py#L19-L37
train
Entry point of the script.
ets-labs/python-domain-models
domain_models/models.py
DomainModelMetaClass.parse_fields
def parse_fields(attributes): """Parse model fields.""" return tuple(field.bind_name(name) for name, field in six.iteritems(attributes) if isinstance(field, fields.Field))
python
def parse_fields(attributes): """Parse model fields.""" return tuple(field.bind_name(name) for name, field in six.iteritems(attributes) if isinstance(field, fields.Field))
[ "def", "parse_fields", "(", "attributes", ")", ":", "return", "tuple", "(", "field", ".", "bind_name", "(", "name", ")", "for", "name", ",", "field", "in", "six", ".", "iteritems", "(", "attributes", ")", "if", "isinstance", "(", "field", ",", "fields", ...
Parse model fields.
[ "Parse", "model", "fields", "." ]
7de1816ba0338f20fdb3e0f57fad0ffd5bea13f9
https://github.com/ets-labs/python-domain-models/blob/7de1816ba0338f20fdb3e0f57fad0ffd5bea13f9/domain_models/models.py#L38-L42
train
Parse model fields.
ets-labs/python-domain-models
domain_models/models.py
DomainModelMetaClass.prepare_fields_attribute
def prepare_fields_attribute(attribute_name, attributes, class_name): """Prepare model fields attribute.""" attribute = attributes.get(attribute_name) if not attribute: attribute = tuple() elif isinstance(attribute, std_collections.Iterable): attribute = tuple(att...
python
def prepare_fields_attribute(attribute_name, attributes, class_name): """Prepare model fields attribute.""" attribute = attributes.get(attribute_name) if not attribute: attribute = tuple() elif isinstance(attribute, std_collections.Iterable): attribute = tuple(att...
[ "def", "prepare_fields_attribute", "(", "attribute_name", ",", "attributes", ",", "class_name", ")", ":", "attribute", "=", "attributes", ".", "get", "(", "attribute_name", ")", "if", "not", "attribute", ":", "attribute", "=", "tuple", "(", ")", "elif", "isins...
Prepare model fields attribute.
[ "Prepare", "model", "fields", "attribute", "." ]
7de1816ba0338f20fdb3e0f57fad0ffd5bea13f9
https://github.com/ets-labs/python-domain-models/blob/7de1816ba0338f20fdb3e0f57fad0ffd5bea13f9/domain_models/models.py#L50-L61
train
Prepare model fields attribute.
ets-labs/python-domain-models
domain_models/models.py
DomainModelMetaClass.bind_fields_to_model_cls
def bind_fields_to_model_cls(cls, model_fields): """Bind fields to model class.""" return dict( (field.name, field.bind_model_cls(cls)) for field in model_fields)
python
def bind_fields_to_model_cls(cls, model_fields): """Bind fields to model class.""" return dict( (field.name, field.bind_model_cls(cls)) for field in model_fields)
[ "def", "bind_fields_to_model_cls", "(", "cls", ",", "model_fields", ")", ":", "return", "dict", "(", "(", "field", ".", "name", ",", "field", ".", "bind_model_cls", "(", "cls", ")", ")", "for", "field", "in", "model_fields", ")" ]
Bind fields to model class.
[ "Bind", "fields", "to", "model", "class", "." ]
7de1816ba0338f20fdb3e0f57fad0ffd5bea13f9
https://github.com/ets-labs/python-domain-models/blob/7de1816ba0338f20fdb3e0f57fad0ffd5bea13f9/domain_models/models.py#L64-L67
train
Bind fields to model class.
ets-labs/python-domain-models
domain_models/models.py
DomainModelMetaClass.bind_collection_to_model_cls
def bind_collection_to_model_cls(cls): """Bind collection to model's class. If collection was not specialized in process of model's declaration, subclass of collection will be created. """ cls.Collection = type('{0}.Collection'.format(cls.__name__), ...
python
def bind_collection_to_model_cls(cls): """Bind collection to model's class. If collection was not specialized in process of model's declaration, subclass of collection will be created. """ cls.Collection = type('{0}.Collection'.format(cls.__name__), ...
[ "def", "bind_collection_to_model_cls", "(", "cls", ")", ":", "cls", ".", "Collection", "=", "type", "(", "'{0}.Collection'", ".", "format", "(", "cls", ".", "__name__", ")", ",", "(", "cls", ".", "Collection", ",", ")", ",", "{", "'value_type'", ":", "cl...
Bind collection to model's class. If collection was not specialized in process of model's declaration, subclass of collection will be created.
[ "Bind", "collection", "to", "model", "s", "class", "." ]
7de1816ba0338f20fdb3e0f57fad0ffd5bea13f9
https://github.com/ets-labs/python-domain-models/blob/7de1816ba0338f20fdb3e0f57fad0ffd5bea13f9/domain_models/models.py#L70-L79
train
Bind collection to model s class.
jenisys/parse_type
tasks/release.py
checklist
def checklist(ctx): """Checklist for releasing this project.""" checklist = """PRE-RELEASE CHECKLIST: [ ] Everything is checked in [ ] All tests pass w/ tox RELEASE CHECKLIST: [{x1}] Bump version to new-version and tag repository (via bump_version) [{x2}] Build packages (sdist, bdist_wheel via prepare) [{x...
python
def checklist(ctx): """Checklist for releasing this project.""" checklist = """PRE-RELEASE CHECKLIST: [ ] Everything is checked in [ ] All tests pass w/ tox RELEASE CHECKLIST: [{x1}] Bump version to new-version and tag repository (via bump_version) [{x2}] Build packages (sdist, bdist_wheel via prepare) [{x...
[ "def", "checklist", "(", "ctx", ")", ":", "checklist", "=", "\"\"\"PRE-RELEASE CHECKLIST:\n[ ] Everything is checked in\n[ ] All tests pass w/ tox\n\nRELEASE CHECKLIST:\n[{x1}] Bump version to new-version and tag repository (via bump_version)\n[{x2}] Build packages (sdist, bdist_wheel via prepar...
Checklist for releasing this project.
[ "Checklist", "for", "releasing", "this", "project", "." ]
7cad3a67a5ca725cb786da31f656fd473084289f
https://github.com/jenisys/parse_type/blob/7cad3a67a5ca725cb786da31f656fd473084289f/tasks/release.py#L61-L84
train
Checklist for releasing this project.
jenisys/parse_type
tasks/release.py
bump_version
def bump_version(ctx, new_version, version_part=None, dry_run=False): """Bump version (to prepare a new release).""" version_part = version_part or "minor" if dry_run: ctx = DryRunContext(ctx) ctx.run("bumpversion --new-version={} {}".format(new_version, ...
python
def bump_version(ctx, new_version, version_part=None, dry_run=False): """Bump version (to prepare a new release).""" version_part = version_part or "minor" if dry_run: ctx = DryRunContext(ctx) ctx.run("bumpversion --new-version={} {}".format(new_version, ...
[ "def", "bump_version", "(", "ctx", ",", "new_version", ",", "version_part", "=", "None", ",", "dry_run", "=", "False", ")", ":", "version_part", "=", "version_part", "or", "\"minor\"", "if", "dry_run", ":", "ctx", "=", "DryRunContext", "(", "ctx", ")", "ct...
Bump version (to prepare a new release).
[ "Bump", "version", "(", "to", "prepare", "a", "new", "release", ")", "." ]
7cad3a67a5ca725cb786da31f656fd473084289f
https://github.com/jenisys/parse_type/blob/7cad3a67a5ca725cb786da31f656fd473084289f/tasks/release.py#L88-L94
train
Bump version of the current project.
jenisys/parse_type
tasks/release.py
build_packages
def build_packages(ctx, hide=False): """Build packages for this release.""" print("build_packages:") ctx.run("python setup.py sdist bdist_wheel", echo=True, hide=hide)
python
def build_packages(ctx, hide=False): """Build packages for this release.""" print("build_packages:") ctx.run("python setup.py sdist bdist_wheel", echo=True, hide=hide)
[ "def", "build_packages", "(", "ctx", ",", "hide", "=", "False", ")", ":", "print", "(", "\"build_packages:\"", ")", "ctx", ".", "run", "(", "\"python setup.py sdist bdist_wheel\"", ",", "echo", "=", "True", ",", "hide", "=", "hide", ")" ]
Build packages for this release.
[ "Build", "packages", "for", "this", "release", "." ]
7cad3a67a5ca725cb786da31f656fd473084289f
https://github.com/jenisys/parse_type/blob/7cad3a67a5ca725cb786da31f656fd473084289f/tasks/release.py#L98-L101
train
Build packages for this release.
jenisys/parse_type
tasks/release.py
prepare
def prepare(ctx, new_version=None, version_part=None, hide=True, dry_run=False): """Prepare the release: bump version, build packages, ...""" if new_version is not None: bump_version(ctx, new_version, version_part=version_part, dry_run=dry_run) build_packages(ctx, hi...
python
def prepare(ctx, new_version=None, version_part=None, hide=True, dry_run=False): """Prepare the release: bump version, build packages, ...""" if new_version is not None: bump_version(ctx, new_version, version_part=version_part, dry_run=dry_run) build_packages(ctx, hi...
[ "def", "prepare", "(", "ctx", ",", "new_version", "=", "None", ",", "version_part", "=", "None", ",", "hide", "=", "True", ",", "dry_run", "=", "False", ")", ":", "if", "new_version", "is", "not", "None", ":", "bump_version", "(", "ctx", ",", "new_vers...
Prepare the release: bump version, build packages, ...
[ "Prepare", "the", "release", ":", "bump", "version", "build", "packages", "..." ]
7cad3a67a5ca725cb786da31f656fd473084289f
https://github.com/jenisys/parse_type/blob/7cad3a67a5ca725cb786da31f656fd473084289f/tasks/release.py#L105-L113
train
Prepare the release.
jenisys/parse_type
tasks/release.py
register_packages
def register_packages(ctx, repo=None, dry_run=False): """Register release (packages) in artifact-store/repository.""" original_ctx = ctx if repo is None: repo = ctx.project.repo or "pypi" if dry_run: ctx = DryRunContext(ctx) packages = ensure_packages_exist(original_ctx) print_p...
python
def register_packages(ctx, repo=None, dry_run=False): """Register release (packages) in artifact-store/repository.""" original_ctx = ctx if repo is None: repo = ctx.project.repo or "pypi" if dry_run: ctx = DryRunContext(ctx) packages = ensure_packages_exist(original_ctx) print_p...
[ "def", "register_packages", "(", "ctx", ",", "repo", "=", "None", ",", "dry_run", "=", "False", ")", ":", "original_ctx", "=", "ctx", "if", "repo", "is", "None", ":", "repo", "=", "ctx", ".", "project", ".", "repo", "or", "\"pypi\"", "if", "dry_run", ...
Register release (packages) in artifact-store/repository.
[ "Register", "release", "(", "packages", ")", "in", "artifact", "-", "store", "/", "repository", "." ]
7cad3a67a5ca725cb786da31f656fd473084289f
https://github.com/jenisys/parse_type/blob/7cad3a67a5ca725cb786da31f656fd473084289f/tasks/release.py#L117-L129
train
Register release packages in artifact - store or repository.
useblocks/groundwork
groundwork/patterns/gw_threads_pattern.py
ThreadsListPlugin.register
def register(self, name, function, description=None): """ Register a new thread. :param function: Function, which gets called for the new thread :type function: function :param name: Unique name of the thread for documentation purposes. :param description: Short descript...
python
def register(self, name, function, description=None): """ Register a new thread. :param function: Function, which gets called for the new thread :type function: function :param name: Unique name of the thread for documentation purposes. :param description: Short descript...
[ "def", "register", "(", "self", ",", "name", ",", "function", ",", "description", "=", "None", ")", ":", "return", "self", ".", "__app", ".", "threads", ".", "register", "(", "name", ",", "function", ",", "self", ".", "_plugin", ",", "description", ")"...
Register a new thread. :param function: Function, which gets called for the new thread :type function: function :param name: Unique name of the thread for documentation purposes. :param description: Short description of the thread
[ "Register", "a", "new", "thread", "." ]
d34fce43f54246ca4db0f7b89e450dcdc847c68c
https://github.com/useblocks/groundwork/blob/d34fce43f54246ca4db0f7b89e450dcdc847c68c/groundwork/patterns/gw_threads_pattern.py#L60-L69
train
Register a new thread.
useblocks/groundwork
groundwork/patterns/gw_threads_pattern.py
ThreadsListApplication.register
def register(self, name, function, plugin, description=None): """ Registers a new document. .. warning: You can not use any relative links inside a given document. For instance, sphinx's toctree, image, figure or include statements do not work. :param function: Func...
python
def register(self, name, function, plugin, description=None): """ Registers a new document. .. warning: You can not use any relative links inside a given document. For instance, sphinx's toctree, image, figure or include statements do not work. :param function: Func...
[ "def", "register", "(", "self", ",", "name", ",", "function", ",", "plugin", ",", "description", "=", "None", ")", ":", "if", "name", "in", "self", ".", "threads", ".", "keys", "(", ")", ":", "raise", "ThreadExistsException", "(", "\"Thread %s was already ...
Registers a new document. .. warning: You can not use any relative links inside a given document. For instance, sphinx's toctree, image, figure or include statements do not work. :param function: Function, which gets called for the new thread :type function: function ...
[ "Registers", "a", "new", "document", "." ]
d34fce43f54246ca4db0f7b89e450dcdc847c68c
https://github.com/useblocks/groundwork/blob/d34fce43f54246ca4db0f7b89e450dcdc847c68c/groundwork/patterns/gw_threads_pattern.py#L89-L109
train
Registers a new thread with the given name.
useblocks/groundwork
groundwork/patterns/gw_threads_pattern.py
ThreadsListApplication.unregister
def unregister(self, thread): """ Unregisters an existing thread, so that this thread is no longer available. This function is mainly used during plugin deactivation. :param thread: Name of the thread """ if thread not in self.threads.keys(): self.log.warnin...
python
def unregister(self, thread): """ Unregisters an existing thread, so that this thread is no longer available. This function is mainly used during plugin deactivation. :param thread: Name of the thread """ if thread not in self.threads.keys(): self.log.warnin...
[ "def", "unregister", "(", "self", ",", "thread", ")", ":", "if", "thread", "not", "in", "self", ".", "threads", ".", "keys", "(", ")", ":", "self", ".", "log", ".", "warning", "(", "\"Can not unregister thread %s\"", "%", "thread", ")", "else", ":", "d...
Unregisters an existing thread, so that this thread is no longer available. This function is mainly used during plugin deactivation. :param thread: Name of the thread
[ "Unregisters", "an", "existing", "thread", "so", "that", "this", "thread", "is", "no", "longer", "available", "." ]
d34fce43f54246ca4db0f7b89e450dcdc847c68c
https://github.com/useblocks/groundwork/blob/d34fce43f54246ca4db0f7b89e450dcdc847c68c/groundwork/patterns/gw_threads_pattern.py#L111-L123
train
Unregisters an existing thread.
useblocks/groundwork
groundwork/patterns/gw_threads_pattern.py
ThreadsListApplication.get
def get(self, thread=None, plugin=None): """ Get one or more threads. :param thread: Name of the thread :type thread: str :param plugin: Plugin object, under which the thread was registered :type plugin: GwBasePattern """ if plugin is not None: ...
python
def get(self, thread=None, plugin=None): """ Get one or more threads. :param thread: Name of the thread :type thread: str :param plugin: Plugin object, under which the thread was registered :type plugin: GwBasePattern """ if plugin is not None: ...
[ "def", "get", "(", "self", ",", "thread", "=", "None", ",", "plugin", "=", "None", ")", ":", "if", "plugin", "is", "not", "None", ":", "if", "thread", "is", "None", ":", "threads_list", "=", "{", "}", "for", "key", "in", "self", ".", "threads", "...
Get one or more threads. :param thread: Name of the thread :type thread: str :param plugin: Plugin object, under which the thread was registered :type plugin: GwBasePattern
[ "Get", "one", "or", "more", "threads", "." ]
d34fce43f54246ca4db0f7b89e450dcdc847c68c
https://github.com/useblocks/groundwork/blob/d34fce43f54246ca4db0f7b89e450dcdc847c68c/groundwork/patterns/gw_threads_pattern.py#L125-L156
train
Get one or more threads.
eonpatapon/contrail-api-cli
contrail_api_cli/schema.py
create_schema_from_xsd_directory
def create_schema_from_xsd_directory(directory, version): """Create and fill the schema from a directory which contains xsd files. It calls fill_schema_from_xsd_file for each xsd file found. """ schema = Schema(version) for f in _get_xsd_from_directory(directory): logger.info("Loading s...
python
def create_schema_from_xsd_directory(directory, version): """Create and fill the schema from a directory which contains xsd files. It calls fill_schema_from_xsd_file for each xsd file found. """ schema = Schema(version) for f in _get_xsd_from_directory(directory): logger.info("Loading s...
[ "def", "create_schema_from_xsd_directory", "(", "directory", ",", "version", ")", ":", "schema", "=", "Schema", "(", "version", ")", "for", "f", "in", "_get_xsd_from_directory", "(", "directory", ")", ":", "logger", ".", "info", "(", "\"Loading schema %s\"", "%"...
Create and fill the schema from a directory which contains xsd files. It calls fill_schema_from_xsd_file for each xsd file found.
[ "Create", "and", "fill", "the", "schema", "from", "a", "directory", "which", "contains", "xsd", "files", ".", "It", "calls", "fill_schema_from_xsd_file", "for", "each", "xsd", "file", "found", "." ]
1571bf523fa054f3d6bf83dba43a224fea173a73
https://github.com/eonpatapon/contrail-api-cli/blob/1571bf523fa054f3d6bf83dba43a224fea173a73/contrail_api_cli/schema.py#L103-L113
train
Create and fill the schema from a directory which contains xsd files. It calls fill_schema_from_xsd_file for each xsd file found.
eonpatapon/contrail-api-cli
contrail_api_cli/schema.py
fill_schema_from_xsd_file
def fill_schema_from_xsd_file(filename, schema): """From an xsd file, it fills the schema by creating needed Resource. The generateds idl_parser is used to parse ifmap statements in the xsd file. """ ifmap_statements = _parse_xsd_file(filename) properties_all = [] for v in ifmap_statements...
python
def fill_schema_from_xsd_file(filename, schema): """From an xsd file, it fills the schema by creating needed Resource. The generateds idl_parser is used to parse ifmap statements in the xsd file. """ ifmap_statements = _parse_xsd_file(filename) properties_all = [] for v in ifmap_statements...
[ "def", "fill_schema_from_xsd_file", "(", "filename", ",", "schema", ")", ":", "ifmap_statements", "=", "_parse_xsd_file", "(", "filename", ")", "properties_all", "=", "[", "]", "for", "v", "in", "ifmap_statements", ".", "values", "(", ")", ":", "if", "(", "i...
From an xsd file, it fills the schema by creating needed Resource. The generateds idl_parser is used to parse ifmap statements in the xsd file.
[ "From", "an", "xsd", "file", "it", "fills", "the", "schema", "by", "creating", "needed", "Resource", ".", "The", "generateds", "idl_parser", "is", "used", "to", "parse", "ifmap", "statements", "in", "the", "xsd", "file", "." ]
1571bf523fa054f3d6bf83dba43a224fea173a73
https://github.com/eonpatapon/contrail-api-cli/blob/1571bf523fa054f3d6bf83dba43a224fea173a73/contrail_api_cli/schema.py#L116-L147
train
This function fills the schema by creating needed Resource.
theiviaxx/python-perforce
perforce/models.py
split_ls
def split_ls(func): """Decorator to split files into manageable chunks as not to exceed the windows cmd limit :param func: Function to call for each chunk :type func: :py:class:Function """ @wraps(func) def wrapper(self, files, silent=True, exclude_deleted=False): if not isinstance(file...
python
def split_ls(func): """Decorator to split files into manageable chunks as not to exceed the windows cmd limit :param func: Function to call for each chunk :type func: :py:class:Function """ @wraps(func) def wrapper(self, files, silent=True, exclude_deleted=False): if not isinstance(file...
[ "def", "split_ls", "(", "func", ")", ":", "@", "wraps", "(", "func", ")", "def", "wrapper", "(", "self", ",", "files", ",", "silent", "=", "True", ",", "exclude_deleted", "=", "False", ")", ":", "if", "not", "isinstance", "(", "files", ",", "(", "t...
Decorator to split files into manageable chunks as not to exceed the windows cmd limit :param func: Function to call for each chunk :type func: :py:class:Function
[ "Decorator", "to", "split", "files", "into", "manageable", "chunks", "as", "not", "to", "exceed", "the", "windows", "cmd", "limit" ]
01a3b01fe5949126fa0097d9a8ad386887823b5a
https://github.com/theiviaxx/python-perforce/blob/01a3b01fe5949126fa0097d9a8ad386887823b5a/perforce/models.py#L69-L105
train
Decorator to split files into manageable chunks as not to exceed the windows cmd limit Apps
theiviaxx/python-perforce
perforce/models.py
Connection.__getVariables
def __getVariables(self): """Parses the P4 env vars using 'set p4'""" try: startupinfo = None if os.name == 'nt': startupinfo = subprocess.STARTUPINFO() startupinfo.dwFlags |= subprocess.STARTF_USESHOWWINDOW output = subprocess.check_ou...
python
def __getVariables(self): """Parses the P4 env vars using 'set p4'""" try: startupinfo = None if os.name == 'nt': startupinfo = subprocess.STARTUPINFO() startupinfo.dwFlags |= subprocess.STARTF_USESHOWWINDOW output = subprocess.check_ou...
[ "def", "__getVariables", "(", "self", ")", ":", "try", ":", "startupinfo", "=", "None", "if", "os", ".", "name", "==", "'nt'", ":", "startupinfo", "=", "subprocess", ".", "STARTUPINFO", "(", ")", "startupinfo", ".", "dwFlags", "|=", "subprocess", ".", "S...
Parses the P4 env vars using 'set p4
[ "Parses", "the", "P4", "env", "vars", "using", "set", "p4" ]
01a3b01fe5949126fa0097d9a8ad386887823b5a
https://github.com/theiviaxx/python-perforce/blob/01a3b01fe5949126fa0097d9a8ad386887823b5a/perforce/models.py#L138-L166
train
Parses the P4 env vars using set p4
theiviaxx/python-perforce
perforce/models.py
Connection.client
def client(self): """The client used in perforce queries""" if isinstance(self._client, six.string_types): self._client = Client(self._client, self) return self._client
python
def client(self): """The client used in perforce queries""" if isinstance(self._client, six.string_types): self._client = Client(self._client, self) return self._client
[ "def", "client", "(", "self", ")", ":", "if", "isinstance", "(", "self", ".", "_client", ",", "six", ".", "string_types", ")", ":", "self", ".", "_client", "=", "Client", "(", "self", ".", "_client", ",", "self", ")", "return", "self", ".", "_client"...
The client used in perforce queries
[ "The", "client", "used", "in", "perforce", "queries" ]
01a3b01fe5949126fa0097d9a8ad386887823b5a
https://github.com/theiviaxx/python-perforce/blob/01a3b01fe5949126fa0097d9a8ad386887823b5a/perforce/models.py#L169-L174
train
The client used in perforce queries
theiviaxx/python-perforce
perforce/models.py
Connection.status
def status(self): """The status of the connection to perforce""" try: # -- Check client res = self.run(['info']) if res[0]['clientName'] == '*unknown*': return ConnectionStatus.INVALID_CLIENT # -- Trigger an auth error if not logged in ...
python
def status(self): """The status of the connection to perforce""" try: # -- Check client res = self.run(['info']) if res[0]['clientName'] == '*unknown*': return ConnectionStatus.INVALID_CLIENT # -- Trigger an auth error if not logged in ...
[ "def", "status", "(", "self", ")", ":", "try", ":", "# -- Check client", "res", "=", "self", ".", "run", "(", "[", "'info'", "]", ")", "if", "res", "[", "0", "]", "[", "'clientName'", "]", "==", "'*unknown*'", ":", "return", "ConnectionStatus", ".", ...
The status of the connection to perforce
[ "The", "status", "of", "the", "connection", "to", "perforce" ]
01a3b01fe5949126fa0097d9a8ad386887823b5a
https://github.com/theiviaxx/python-perforce/blob/01a3b01fe5949126fa0097d9a8ad386887823b5a/perforce/models.py#L201-L216
train
The status of the connection to perforce
theiviaxx/python-perforce
perforce/models.py
Connection.run
def run(self, cmd, stdin=None, marshal_output=True, **kwargs): """Runs a p4 command and returns a list of dictionary objects :param cmd: Command to run :type cmd: list :param stdin: Standard Input to send to the process :type stdin: str :param marshal_output: Whether or ...
python
def run(self, cmd, stdin=None, marshal_output=True, **kwargs): """Runs a p4 command and returns a list of dictionary objects :param cmd: Command to run :type cmd: list :param stdin: Standard Input to send to the process :type stdin: str :param marshal_output: Whether or ...
[ "def", "run", "(", "self", ",", "cmd", ",", "stdin", "=", "None", ",", "marshal_output", "=", "True", ",", "*", "*", "kwargs", ")", ":", "records", "=", "[", "]", "args", "=", "[", "self", ".", "_executable", ",", "\"-u\"", ",", "self", ".", "_us...
Runs a p4 command and returns a list of dictionary objects :param cmd: Command to run :type cmd: list :param stdin: Standard Input to send to the process :type stdin: str :param marshal_output: Whether or not to marshal the output from the command :type marshal_output: b...
[ "Runs", "a", "p4", "command", "and", "returns", "a", "list", "of", "dictionary", "objects" ]
01a3b01fe5949126fa0097d9a8ad386887823b5a
https://github.com/theiviaxx/python-perforce/blob/01a3b01fe5949126fa0097d9a8ad386887823b5a/perforce/models.py#L218-L287
train
Runs a p4 command and returns a list of dictionary objects.
theiviaxx/python-perforce
perforce/models.py
Connection.ls
def ls(self, files, silent=True, exclude_deleted=False): """List files :param files: Perforce file spec :type files: list :param silent: Will not raise error for invalid files or files not under the client :type silent: bool :param exclude_deleted: Exclude deleted files ...
python
def ls(self, files, silent=True, exclude_deleted=False): """List files :param files: Perforce file spec :type files: list :param silent: Will not raise error for invalid files or files not under the client :type silent: bool :param exclude_deleted: Exclude deleted files ...
[ "def", "ls", "(", "self", ",", "files", ",", "silent", "=", "True", ",", "exclude_deleted", "=", "False", ")", ":", "try", ":", "cmd", "=", "[", "'fstat'", "]", "if", "exclude_deleted", ":", "cmd", "+=", "[", "'-F'", ",", "'^headAction=delete ^headAction...
List files :param files: Perforce file spec :type files: list :param silent: Will not raise error for invalid files or files not under the client :type silent: bool :param exclude_deleted: Exclude deleted files from the query :type exclude_deleted: bool :raises: ...
[ "List", "files" ]
01a3b01fe5949126fa0097d9a8ad386887823b5a
https://github.com/theiviaxx/python-perforce/blob/01a3b01fe5949126fa0097d9a8ad386887823b5a/perforce/models.py#L290-L318
train
List files in the cluster.
theiviaxx/python-perforce
perforce/models.py
Connection.findChangelist
def findChangelist(self, description=None): """Gets or creates a Changelist object with a description :param description: The description to set or lookup :type description: str :returns: :class:`.Changelist` """ if description is None: change = Default(self)...
python
def findChangelist(self, description=None): """Gets or creates a Changelist object with a description :param description: The description to set or lookup :type description: str :returns: :class:`.Changelist` """ if description is None: change = Default(self)...
[ "def", "findChangelist", "(", "self", ",", "description", "=", "None", ")", ":", "if", "description", "is", "None", ":", "change", "=", "Default", "(", "self", ")", "else", ":", "if", "isinstance", "(", "description", ",", "six", ".", "integer_types", ")...
Gets or creates a Changelist object with a description :param description: The description to set or lookup :type description: str :returns: :class:`.Changelist`
[ "Gets", "or", "creates", "a", "Changelist", "object", "with", "a", "description" ]
01a3b01fe5949126fa0097d9a8ad386887823b5a
https://github.com/theiviaxx/python-perforce/blob/01a3b01fe5949126fa0097d9a8ad386887823b5a/perforce/models.py#L320-L345
train
Gets or creates a Changelist object with a description
theiviaxx/python-perforce
perforce/models.py
Connection.add
def add(self, filename, change=None): """Adds a new file to a changelist :param filename: File path to add :type filename: str :param change: Changelist to add the file to :type change: int :returns: :class:`.Revision` """ try: if not self.can...
python
def add(self, filename, change=None): """Adds a new file to a changelist :param filename: File path to add :type filename: str :param change: Changelist to add the file to :type change: int :returns: :class:`.Revision` """ try: if not self.can...
[ "def", "add", "(", "self", ",", "filename", ",", "change", "=", "None", ")", ":", "try", ":", "if", "not", "self", ".", "canAdd", "(", "filename", ")", ":", "raise", "errors", ".", "RevisionError", "(", "'File is not under client path'", ")", "if", "chan...
Adds a new file to a changelist :param filename: File path to add :type filename: str :param change: Changelist to add the file to :type change: int :returns: :class:`.Revision`
[ "Adds", "a", "new", "file", "to", "a", "changelist" ]
01a3b01fe5949126fa0097d9a8ad386887823b5a
https://github.com/theiviaxx/python-perforce/blob/01a3b01fe5949126fa0097d9a8ad386887823b5a/perforce/models.py#L347-L375
train
Adds a new file to a changelist.
theiviaxx/python-perforce
perforce/models.py
Connection.canAdd
def canAdd(self, filename): """Determines if a filename can be added to the depot under the current client :param filename: File path to add :type filename: str """ try: result = self.run(['add', '-n', '-t', 'text', filename])[0] except errors.CommandError as...
python
def canAdd(self, filename): """Determines if a filename can be added to the depot under the current client :param filename: File path to add :type filename: str """ try: result = self.run(['add', '-n', '-t', 'text', filename])[0] except errors.CommandError as...
[ "def", "canAdd", "(", "self", ",", "filename", ")", ":", "try", ":", "result", "=", "self", ".", "run", "(", "[", "'add'", ",", "'-n'", ",", "'-t'", ",", "'text'", ",", "filename", "]", ")", "[", "0", "]", "except", "errors", ".", "CommandError", ...
Determines if a filename can be added to the depot under the current client :param filename: File path to add :type filename: str
[ "Determines", "if", "a", "filename", "can", "be", "added", "to", "the", "depot", "under", "the", "current", "client" ]
01a3b01fe5949126fa0097d9a8ad386887823b5a
https://github.com/theiviaxx/python-perforce/blob/01a3b01fe5949126fa0097d9a8ad386887823b5a/perforce/models.py#L377-L394
train
Determines if a filename can be added to the current client s depot under the current client s depot under the current client s depot.
theiviaxx/python-perforce
perforce/models.py
FormObject.save
def save(self): """Saves the state of the changelist""" if not self._dirty: return fields = [] formdata = dict(self._p4dict) del formdata['code'] for key, value in six.iteritems(formdata): match = re.search('\d$', key) if match: ...
python
def save(self): """Saves the state of the changelist""" if not self._dirty: return fields = [] formdata = dict(self._p4dict) del formdata['code'] for key, value in six.iteritems(formdata): match = re.search('\d$', key) if match: ...
[ "def", "save", "(", "self", ")", ":", "if", "not", "self", ".", "_dirty", ":", "return", "fields", "=", "[", "]", "formdata", "=", "dict", "(", "self", ".", "_p4dict", ")", "del", "formdata", "[", "'code'", "]", "for", "key", ",", "value", "in", ...
Saves the state of the changelist
[ "Saves", "the", "state", "of", "the", "changelist" ]
01a3b01fe5949126fa0097d9a8ad386887823b5a
https://github.com/theiviaxx/python-perforce/blob/01a3b01fe5949126fa0097d9a8ad386887823b5a/perforce/models.py#L426-L444
train
Saves the state of the changelist
theiviaxx/python-perforce
perforce/models.py
Changelist.query
def query(self, files=True): """Queries the depot to get the current status of the changelist""" if self._change: cl = str(self._change) self._p4dict = {camel_case(k): v for k, v in six.iteritems(self._connection.run(['change', '-o', cl])[0])} if files: self....
python
def query(self, files=True): """Queries the depot to get the current status of the changelist""" if self._change: cl = str(self._change) self._p4dict = {camel_case(k): v for k, v in six.iteritems(self._connection.run(['change', '-o', cl])[0])} if files: self....
[ "def", "query", "(", "self", ",", "files", "=", "True", ")", ":", "if", "self", ".", "_change", ":", "cl", "=", "str", "(", "self", ".", "_change", ")", "self", ".", "_p4dict", "=", "{", "camel_case", "(", "k", ")", ":", "v", "for", "k", ",", ...
Queries the depot to get the current status of the changelist
[ "Queries", "the", "depot", "to", "get", "the", "current", "status", "of", "the", "changelist" ]
01a3b01fe5949126fa0097d9a8ad386887823b5a
https://github.com/theiviaxx/python-perforce/blob/01a3b01fe5949126fa0097d9a8ad386887823b5a/perforce/models.py#L542-L560
train
Queries the depot to get the current status of the changelist
theiviaxx/python-perforce
perforce/models.py
Changelist.append
def append(self, rev): """Adds a :py:class:Revision to this changelist and adds or checks it out if needed :param rev: Revision to add :type rev: :class:`.Revision` """ if not isinstance(rev, Revision): results = self._connection.ls(rev) if not results: ...
python
def append(self, rev): """Adds a :py:class:Revision to this changelist and adds or checks it out if needed :param rev: Revision to add :type rev: :class:`.Revision` """ if not isinstance(rev, Revision): results = self._connection.ls(rev) if not results: ...
[ "def", "append", "(", "self", ",", "rev", ")", ":", "if", "not", "isinstance", "(", "rev", ",", "Revision", ")", ":", "results", "=", "self", ".", "_connection", ".", "ls", "(", "rev", ")", "if", "not", "results", ":", "self", ".", "_connection", "...
Adds a :py:class:Revision to this changelist and adds or checks it out if needed :param rev: Revision to add :type rev: :class:`.Revision`
[ "Adds", "a", ":", "py", ":", "class", ":", "Revision", "to", "this", "changelist", "and", "adds", "or", "checks", "it", "out", "if", "needed" ]
01a3b01fe5949126fa0097d9a8ad386887823b5a
https://github.com/theiviaxx/python-perforce/blob/01a3b01fe5949126fa0097d9a8ad386887823b5a/perforce/models.py#L562-L583
train
Adds a revision to this changelist and checks it out if needed
theiviaxx/python-perforce
perforce/models.py
Changelist.remove
def remove(self, rev, permanent=False): """Removes a revision from this changelist :param rev: Revision to remove :type rev: :class:`.Revision` :param permanent: Whether or not we need to set the changelist to default :type permanent: bool """ if not isinstance(r...
python
def remove(self, rev, permanent=False): """Removes a revision from this changelist :param rev: Revision to remove :type rev: :class:`.Revision` :param permanent: Whether or not we need to set the changelist to default :type permanent: bool """ if not isinstance(r...
[ "def", "remove", "(", "self", ",", "rev", ",", "permanent", "=", "False", ")", ":", "if", "not", "isinstance", "(", "rev", ",", "Revision", ")", ":", "raise", "TypeError", "(", "'argument needs to be an instance of Revision'", ")", "if", "rev", "not", "in", ...
Removes a revision from this changelist :param rev: Revision to remove :type rev: :class:`.Revision` :param permanent: Whether or not we need to set the changelist to default :type permanent: bool
[ "Removes", "a", "revision", "from", "this", "changelist" ]
01a3b01fe5949126fa0097d9a8ad386887823b5a
https://github.com/theiviaxx/python-perforce/blob/01a3b01fe5949126fa0097d9a8ad386887823b5a/perforce/models.py#L585-L601
train
Removes a revision from the changelist.
theiviaxx/python-perforce
perforce/models.py
Changelist.revert
def revert(self, unchanged_only=False): """Revert all files in this changelist :param unchanged_only: Only revert unchanged files :type unchanged_only: bool :raises: :class:`.ChangelistError` """ if self._reverted: raise errors.ChangelistError('This changelis...
python
def revert(self, unchanged_only=False): """Revert all files in this changelist :param unchanged_only: Only revert unchanged files :type unchanged_only: bool :raises: :class:`.ChangelistError` """ if self._reverted: raise errors.ChangelistError('This changelis...
[ "def", "revert", "(", "self", ",", "unchanged_only", "=", "False", ")", ":", "if", "self", ".", "_reverted", ":", "raise", "errors", ".", "ChangelistError", "(", "'This changelist has been reverted'", ")", "change", "=", "self", ".", "_change", "if", "self", ...
Revert all files in this changelist :param unchanged_only: Only revert unchanged files :type unchanged_only: bool :raises: :class:`.ChangelistError`
[ "Revert", "all", "files", "in", "this", "changelist" ]
01a3b01fe5949126fa0097d9a8ad386887823b5a
https://github.com/theiviaxx/python-perforce/blob/01a3b01fe5949126fa0097d9a8ad386887823b5a/perforce/models.py#L603-L628
train
Revert all files in this changelist to the original state.
theiviaxx/python-perforce
perforce/models.py
Changelist.save
def save(self): """Saves the state of the changelist""" self._connection.run(['change', '-i'], stdin=format(self), marshal_output=False) self._dirty = False
python
def save(self): """Saves the state of the changelist""" self._connection.run(['change', '-i'], stdin=format(self), marshal_output=False) self._dirty = False
[ "def", "save", "(", "self", ")", ":", "self", ".", "_connection", ".", "run", "(", "[", "'change'", ",", "'-i'", "]", ",", "stdin", "=", "format", "(", "self", ")", ",", "marshal_output", "=", "False", ")", "self", ".", "_dirty", "=", "False" ]
Saves the state of the changelist
[ "Saves", "the", "state", "of", "the", "changelist" ]
01a3b01fe5949126fa0097d9a8ad386887823b5a
https://github.com/theiviaxx/python-perforce/blob/01a3b01fe5949126fa0097d9a8ad386887823b5a/perforce/models.py#L630-L633
train
Saves the state of the changelist
theiviaxx/python-perforce
perforce/models.py
Changelist.submit
def submit(self): """Submits a chagelist to the depot""" if self._dirty: self.save() self._connection.run(['submit', '-c', str(self._change)], marshal_output=False)
python
def submit(self): """Submits a chagelist to the depot""" if self._dirty: self.save() self._connection.run(['submit', '-c', str(self._change)], marshal_output=False)
[ "def", "submit", "(", "self", ")", ":", "if", "self", ".", "_dirty", ":", "self", ".", "save", "(", ")", "self", ".", "_connection", ".", "run", "(", "[", "'submit'", ",", "'-c'", ",", "str", "(", "self", ".", "_change", ")", "]", ",", "marshal_o...
Submits a chagelist to the depot
[ "Submits", "a", "chagelist", "to", "the", "depot" ]
01a3b01fe5949126fa0097d9a8ad386887823b5a
https://github.com/theiviaxx/python-perforce/blob/01a3b01fe5949126fa0097d9a8ad386887823b5a/perforce/models.py#L635-L640
train
Submits a chagelist to the depot
theiviaxx/python-perforce
perforce/models.py
Changelist.delete
def delete(self): """Reverts all files in this changelist then deletes the changelist from perforce""" try: self.revert() except errors.ChangelistError: pass self._connection.run(['change', '-d', str(self._change)])
python
def delete(self): """Reverts all files in this changelist then deletes the changelist from perforce""" try: self.revert() except errors.ChangelistError: pass self._connection.run(['change', '-d', str(self._change)])
[ "def", "delete", "(", "self", ")", ":", "try", ":", "self", ".", "revert", "(", ")", "except", "errors", ".", "ChangelistError", ":", "pass", "self", ".", "_connection", ".", "run", "(", "[", "'change'", ",", "'-d'", ",", "str", "(", "self", ".", "...
Reverts all files in this changelist then deletes the changelist from perforce
[ "Reverts", "all", "files", "in", "this", "changelist", "then", "deletes", "the", "changelist", "from", "perforce" ]
01a3b01fe5949126fa0097d9a8ad386887823b5a
https://github.com/theiviaxx/python-perforce/blob/01a3b01fe5949126fa0097d9a8ad386887823b5a/perforce/models.py#L642-L649
train
Delete all files in this changelist then deletes the changelist from perforce
theiviaxx/python-perforce
perforce/models.py
Changelist.create
def create(description='<Created by Python>', connection=None): """Creates a new changelist :param connection: Connection to use to create the changelist :type connection: :class:`.Connection` :param description: Description for new changelist :type description: str :ret...
python
def create(description='<Created by Python>', connection=None): """Creates a new changelist :param connection: Connection to use to create the changelist :type connection: :class:`.Connection` :param description: Description for new changelist :type description: str :ret...
[ "def", "create", "(", "description", "=", "'<Created by Python>'", ",", "connection", "=", "None", ")", ":", "connection", "=", "connection", "or", "Connection", "(", ")", "description", "=", "description", ".", "replace", "(", "'\\n'", ",", "'\\n\\t'", ")", ...
Creates a new changelist :param connection: Connection to use to create the changelist :type connection: :class:`.Connection` :param description: Description for new changelist :type description: str :returns: :class:`.Changelist`
[ "Creates", "a", "new", "changelist" ]
01a3b01fe5949126fa0097d9a8ad386887823b5a
https://github.com/theiviaxx/python-perforce/blob/01a3b01fe5949126fa0097d9a8ad386887823b5a/perforce/models.py#L694-L708
train
Creates a new changelist with the given description
theiviaxx/python-perforce
perforce/models.py
Default.save
def save(self): """Saves the state of the changelist""" files = [f.depotFile for f in self._files] cmd = ['reopen', '-c', 'default'] self._connection.run(cmd + files) self._dirty = False
python
def save(self): """Saves the state of the changelist""" files = [f.depotFile for f in self._files] cmd = ['reopen', '-c', 'default'] self._connection.run(cmd + files) self._dirty = False
[ "def", "save", "(", "self", ")", ":", "files", "=", "[", "f", ".", "depotFile", "for", "f", "in", "self", ".", "_files", "]", "cmd", "=", "[", "'reopen'", ",", "'-c'", ",", "'default'", "]", "self", ".", "_connection", ".", "run", "(", "cmd", "+"...
Saves the state of the changelist
[ "Saves", "the", "state", "of", "the", "changelist" ]
01a3b01fe5949126fa0097d9a8ad386887823b5a
https://github.com/theiviaxx/python-perforce/blob/01a3b01fe5949126fa0097d9a8ad386887823b5a/perforce/models.py#L730-L735
train
Saves the state of the changelist
theiviaxx/python-perforce
perforce/models.py
Revision.query
def query(self): """Runs an fstat for this file and repopulates the data""" self._p4dict = self._connection.run(['fstat', '-m', '1', self._p4dict['depotFile']])[0] self._head = HeadRevision(self._p4dict) self._filename = self.depotFile
python
def query(self): """Runs an fstat for this file and repopulates the data""" self._p4dict = self._connection.run(['fstat', '-m', '1', self._p4dict['depotFile']])[0] self._head = HeadRevision(self._p4dict) self._filename = self.depotFile
[ "def", "query", "(", "self", ")", ":", "self", ".", "_p4dict", "=", "self", ".", "_connection", ".", "run", "(", "[", "'fstat'", ",", "'-m'", ",", "'1'", ",", "self", ".", "_p4dict", "[", "'depotFile'", "]", "]", ")", "[", "0", "]", "self", ".", ...
Runs an fstat for this file and repopulates the data
[ "Runs", "an", "fstat", "for", "this", "file", "and", "repopulates", "the", "data" ]
01a3b01fe5949126fa0097d9a8ad386887823b5a
https://github.com/theiviaxx/python-perforce/blob/01a3b01fe5949126fa0097d9a8ad386887823b5a/perforce/models.py#L770-L776
train
Runs an fstat for this file and repopulates the data
theiviaxx/python-perforce
perforce/models.py
Revision.edit
def edit(self, changelist=0): """Checks out the file :param changelist: Optional changelist to checkout the file into :type changelist: :class:`.Changelist` """ command = 'reopen' if self.action in ('add', 'edit') else 'edit' if int(changelist): self._connect...
python
def edit(self, changelist=0): """Checks out the file :param changelist: Optional changelist to checkout the file into :type changelist: :class:`.Changelist` """ command = 'reopen' if self.action in ('add', 'edit') else 'edit' if int(changelist): self._connect...
[ "def", "edit", "(", "self", ",", "changelist", "=", "0", ")", ":", "command", "=", "'reopen'", "if", "self", ".", "action", "in", "(", "'add'", ",", "'edit'", ")", "else", "'edit'", "if", "int", "(", "changelist", ")", ":", "self", ".", "_connection"...
Checks out the file :param changelist: Optional changelist to checkout the file into :type changelist: :class:`.Changelist`
[ "Checks", "out", "the", "file" ]
01a3b01fe5949126fa0097d9a8ad386887823b5a
https://github.com/theiviaxx/python-perforce/blob/01a3b01fe5949126fa0097d9a8ad386887823b5a/perforce/models.py#L778-L790
train
Checks out the file and updates the changelist
theiviaxx/python-perforce
perforce/models.py
Revision.lock
def lock(self, lock=True, changelist=0): """Locks or unlocks the file :param lock: Lock or unlock the file :type lock: bool :param changelist: Optional changelist to checkout the file into :type changelist: :class:`.Changelist` """ cmd = 'lock' if lock else 'unl...
python
def lock(self, lock=True, changelist=0): """Locks or unlocks the file :param lock: Lock or unlock the file :type lock: bool :param changelist: Optional changelist to checkout the file into :type changelist: :class:`.Changelist` """ cmd = 'lock' if lock else 'unl...
[ "def", "lock", "(", "self", ",", "lock", "=", "True", ",", "changelist", "=", "0", ")", ":", "cmd", "=", "'lock'", "if", "lock", "else", "'unlock'", "if", "changelist", ":", "self", ".", "_connection", ".", "run", "(", "[", "cmd", ",", "'-c'", ",",...
Locks or unlocks the file :param lock: Lock or unlock the file :type lock: bool :param changelist: Optional changelist to checkout the file into :type changelist: :class:`.Changelist`
[ "Locks", "or", "unlocks", "the", "file" ]
01a3b01fe5949126fa0097d9a8ad386887823b5a
https://github.com/theiviaxx/python-perforce/blob/01a3b01fe5949126fa0097d9a8ad386887823b5a/perforce/models.py#L792-L807
train
Locks or unlocks the file in the changelist
theiviaxx/python-perforce
perforce/models.py
Revision.sync
def sync(self, force=False, safe=True, revision=0, changelist=0): """Syncs the file at the current revision :param force: Force the file to sync :type force: bool :param safe: Don't sync files that were changed outside perforce :type safe: bool :param revision: Sync to a...
python
def sync(self, force=False, safe=True, revision=0, changelist=0): """Syncs the file at the current revision :param force: Force the file to sync :type force: bool :param safe: Don't sync files that were changed outside perforce :type safe: bool :param revision: Sync to a...
[ "def", "sync", "(", "self", ",", "force", "=", "False", ",", "safe", "=", "True", ",", "revision", "=", "0", ",", "changelist", "=", "0", ")", ":", "cmd", "=", "[", "'sync'", "]", "if", "force", ":", "cmd", ".", "append", "(", "'-f'", ")", "if"...
Syncs the file at the current revision :param force: Force the file to sync :type force: bool :param safe: Don't sync files that were changed outside perforce :type safe: bool :param revision: Sync to a specific revision :type revision: int :param changelist: Cha...
[ "Syncs", "the", "file", "at", "the", "current", "revision" ]
01a3b01fe5949126fa0097d9a8ad386887823b5a
https://github.com/theiviaxx/python-perforce/blob/01a3b01fe5949126fa0097d9a8ad386887823b5a/perforce/models.py#L809-L837
train
Syncs the current revision with the current file.
theiviaxx/python-perforce
perforce/models.py
Revision.revert
def revert(self, unchanged=False): """Reverts any file changes :param unchanged: Only revert if the file is unchanged :type unchanged: bool """ cmd = ['revert'] if unchanged: cmd.append('-a') wasadd = self.action == 'add' cmd.append(self.dep...
python
def revert(self, unchanged=False): """Reverts any file changes :param unchanged: Only revert if the file is unchanged :type unchanged: bool """ cmd = ['revert'] if unchanged: cmd.append('-a') wasadd = self.action == 'add' cmd.append(self.dep...
[ "def", "revert", "(", "self", ",", "unchanged", "=", "False", ")", ":", "cmd", "=", "[", "'revert'", "]", "if", "unchanged", ":", "cmd", ".", "append", "(", "'-a'", ")", "wasadd", "=", "self", ".", "action", "==", "'add'", "cmd", ".", "append", "("...
Reverts any file changes :param unchanged: Only revert if the file is unchanged :type unchanged: bool
[ "Reverts", "any", "file", "changes" ]
01a3b01fe5949126fa0097d9a8ad386887823b5a
https://github.com/theiviaxx/python-perforce/blob/01a3b01fe5949126fa0097d9a8ad386887823b5a/perforce/models.py#L839-L862
train
Reverts any file changes
theiviaxx/python-perforce
perforce/models.py
Revision.shelve
def shelve(self, changelist=None): """Shelves the file if it is in a changelist :param changelist: Changelist to add the move to :type changelist: :class:`.Changelist` """ if changelist is None and self.changelist.description == 'default': raise errors.ShelveError('U...
python
def shelve(self, changelist=None): """Shelves the file if it is in a changelist :param changelist: Changelist to add the move to :type changelist: :class:`.Changelist` """ if changelist is None and self.changelist.description == 'default': raise errors.ShelveError('U...
[ "def", "shelve", "(", "self", ",", "changelist", "=", "None", ")", ":", "if", "changelist", "is", "None", "and", "self", ".", "changelist", ".", "description", "==", "'default'", ":", "raise", "errors", ".", "ShelveError", "(", "'Unabled to shelve files in the...
Shelves the file if it is in a changelist :param changelist: Changelist to add the move to :type changelist: :class:`.Changelist`
[ "Shelves", "the", "file", "if", "it", "is", "in", "a", "changelist" ]
01a3b01fe5949126fa0097d9a8ad386887823b5a
https://github.com/theiviaxx/python-perforce/blob/01a3b01fe5949126fa0097d9a8ad386887823b5a/perforce/models.py#L864-L881
train
Shelves the file if it is in a changelist
theiviaxx/python-perforce
perforce/models.py
Revision.move
def move(self, dest, changelist=0, force=False): """Renames/moves the file to dest :param dest: Destination to move the file to :type dest: str :param changelist: Changelist to add the move to :type changelist: :class:`.Changelist` :param force: Force the move to an exis...
python
def move(self, dest, changelist=0, force=False): """Renames/moves the file to dest :param dest: Destination to move the file to :type dest: str :param changelist: Changelist to add the move to :type changelist: :class:`.Changelist` :param force: Force the move to an exis...
[ "def", "move", "(", "self", ",", "dest", ",", "changelist", "=", "0", ",", "force", "=", "False", ")", ":", "cmd", "=", "[", "'move'", "]", "if", "force", ":", "cmd", ".", "append", "(", "'-f'", ")", "if", "changelist", ":", "cmd", "+=", "[", "...
Renames/moves the file to dest :param dest: Destination to move the file to :type dest: str :param changelist: Changelist to add the move to :type changelist: :class:`.Changelist` :param force: Force the move to an existing file :type force: bool
[ "Renames", "/", "moves", "the", "file", "to", "dest" ]
01a3b01fe5949126fa0097d9a8ad386887823b5a
https://github.com/theiviaxx/python-perforce/blob/01a3b01fe5949126fa0097d9a8ad386887823b5a/perforce/models.py#L883-L907
train
Renames the file to dest and moves it to changelist
theiviaxx/python-perforce
perforce/models.py
Revision.delete
def delete(self, changelist=0): """Marks the file for delete :param changelist: Changelist to add the move to :type changelist: :class:`.Changelist` """ cmd = ['delete'] if changelist: cmd += ['-c', str(changelist)] cmd.append(self.depotFile) ...
python
def delete(self, changelist=0): """Marks the file for delete :param changelist: Changelist to add the move to :type changelist: :class:`.Changelist` """ cmd = ['delete'] if changelist: cmd += ['-c', str(changelist)] cmd.append(self.depotFile) ...
[ "def", "delete", "(", "self", ",", "changelist", "=", "0", ")", ":", "cmd", "=", "[", "'delete'", "]", "if", "changelist", ":", "cmd", "+=", "[", "'-c'", ",", "str", "(", "changelist", ")", "]", "cmd", ".", "append", "(", "self", ".", "depotFile", ...
Marks the file for delete :param changelist: Changelist to add the move to :type changelist: :class:`.Changelist`
[ "Marks", "the", "file", "for", "delete" ]
01a3b01fe5949126fa0097d9a8ad386887823b5a
https://github.com/theiviaxx/python-perforce/blob/01a3b01fe5949126fa0097d9a8ad386887823b5a/perforce/models.py#L909-L923
train
Marks the file for deletion
theiviaxx/python-perforce
perforce/models.py
Revision.hash
def hash(self): """The hash value of the current revision""" if 'digest' not in self._p4dict: self._p4dict = self._connection.run(['fstat', '-m', '1', '-Ol', self.depotFile])[0] return self._p4dict['digest']
python
def hash(self): """The hash value of the current revision""" if 'digest' not in self._p4dict: self._p4dict = self._connection.run(['fstat', '-m', '1', '-Ol', self.depotFile])[0] return self._p4dict['digest']
[ "def", "hash", "(", "self", ")", ":", "if", "'digest'", "not", "in", "self", ".", "_p4dict", ":", "self", ".", "_p4dict", "=", "self", ".", "_connection", ".", "run", "(", "[", "'fstat'", ",", "'-m'", ",", "'1'", ",", "'-Ol'", ",", "self", ".", "...
The hash value of the current revision
[ "The", "hash", "value", "of", "the", "current", "revision" ]
01a3b01fe5949126fa0097d9a8ad386887823b5a
https://github.com/theiviaxx/python-perforce/blob/01a3b01fe5949126fa0097d9a8ad386887823b5a/perforce/models.py#L926-L931
train
The hash value of the current revision
theiviaxx/python-perforce
perforce/models.py
Revision.revision
def revision(self): """Revision number""" rev = self._p4dict.get('haveRev', -1) if rev == 'none': rev = 0 return int(rev)
python
def revision(self): """Revision number""" rev = self._p4dict.get('haveRev', -1) if rev == 'none': rev = 0 return int(rev)
[ "def", "revision", "(", "self", ")", ":", "rev", "=", "self", ".", "_p4dict", ".", "get", "(", "'haveRev'", ",", "-", "1", ")", "if", "rev", "==", "'none'", ":", "rev", "=", "0", "return", "int", "(", "rev", ")" ]
Revision number
[ "Revision", "number" ]
01a3b01fe5949126fa0097d9a8ad386887823b5a
https://github.com/theiviaxx/python-perforce/blob/01a3b01fe5949126fa0097d9a8ad386887823b5a/perforce/models.py#L954-L959
train
Return the revision number of the current user.
theiviaxx/python-perforce
perforce/models.py
Revision.changelist
def changelist(self): """Which :class:`.Changelist` is this revision in""" if self._changelist: return self._changelist if self._p4dict['change'] == 'default': return Default(connection=self._connection) else: return Changelist(str(self._p4dict['chang...
python
def changelist(self): """Which :class:`.Changelist` is this revision in""" if self._changelist: return self._changelist if self._p4dict['change'] == 'default': return Default(connection=self._connection) else: return Changelist(str(self._p4dict['chang...
[ "def", "changelist", "(", "self", ")", ":", "if", "self", ".", "_changelist", ":", "return", "self", ".", "_changelist", "if", "self", ".", "_p4dict", "[", "'change'", "]", "==", "'default'", ":", "return", "Default", "(", "connection", "=", "self", ".",...
Which :class:`.Changelist` is this revision in
[ "Which", ":", "class", ":", ".", "Changelist", "is", "this", "revision", "in" ]
01a3b01fe5949126fa0097d9a8ad386887823b5a
https://github.com/theiviaxx/python-perforce/blob/01a3b01fe5949126fa0097d9a8ad386887823b5a/perforce/models.py#L971-L979
train
Which Changelist is this revision in
theiviaxx/python-perforce
perforce/models.py
Client.view
def view(self): """A list of view specs""" spec = [] for k, v in six.iteritems(self._p4dict): if k.startswith('view'): match = RE_FILESPEC.search(v) if match: spec.append(FileSpec(v[:match.end() - 1], v[match.end():])) retu...
python
def view(self): """A list of view specs""" spec = [] for k, v in six.iteritems(self._p4dict): if k.startswith('view'): match = RE_FILESPEC.search(v) if match: spec.append(FileSpec(v[:match.end() - 1], v[match.end():])) retu...
[ "def", "view", "(", "self", ")", ":", "spec", "=", "[", "]", "for", "k", ",", "v", "in", "six", ".", "iteritems", "(", "self", ".", "_p4dict", ")", ":", "if", "k", ".", "startswith", "(", "'view'", ")", ":", "match", "=", "RE_FILESPEC", ".", "s...
A list of view specs
[ "A", "list", "of", "view", "specs" ]
01a3b01fe5949126fa0097d9a8ad386887823b5a
https://github.com/theiviaxx/python-perforce/blob/01a3b01fe5949126fa0097d9a8ad386887823b5a/perforce/models.py#L1145-L1154
train
A list of view specs
theiviaxx/python-perforce
perforce/models.py
Client.stream
def stream(self): """Which stream, if any, the client is under""" stream = self._p4dict.get('stream') if stream: return Stream(stream, self._connection)
python
def stream(self): """Which stream, if any, the client is under""" stream = self._p4dict.get('stream') if stream: return Stream(stream, self._connection)
[ "def", "stream", "(", "self", ")", ":", "stream", "=", "self", ".", "_p4dict", ".", "get", "(", "'stream'", ")", "if", "stream", ":", "return", "Stream", "(", "stream", ",", "self", ".", "_connection", ")" ]
Which stream, if any, the client is under
[ "Which", "stream", "if", "any", "the", "client", "is", "under" ]
01a3b01fe5949126fa0097d9a8ad386887823b5a
https://github.com/theiviaxx/python-perforce/blob/01a3b01fe5949126fa0097d9a8ad386887823b5a/perforce/models.py#L1167-L1171
train
Which stream the client is under
ph4r05/monero-serialize
monero_serialize/xmrboost.py
load_uvarint
async def load_uvarint(reader): """ Monero portable_binary_archive boost integer serialization :param reader: :return: """ buffer = _UVARINT_BUFFER await reader.areadinto(buffer) size = buffer[0] if size == 0: return 0 negative = size < 0 size = -size if negative els...
python
async def load_uvarint(reader): """ Monero portable_binary_archive boost integer serialization :param reader: :return: """ buffer = _UVARINT_BUFFER await reader.areadinto(buffer) size = buffer[0] if size == 0: return 0 negative = size < 0 size = -size if negative els...
[ "async", "def", "load_uvarint", "(", "reader", ")", ":", "buffer", "=", "_UVARINT_BUFFER", "await", "reader", ".", "areadinto", "(", "buffer", ")", "size", "=", "buffer", "[", "0", "]", "if", "size", "==", "0", ":", "return", "0", "negative", "=", "siz...
Monero portable_binary_archive boost integer serialization :param reader: :return:
[ "Monero", "portable_binary_archive", "boost", "integer", "serialization", ":", "param", "reader", ":", ":", "return", ":" ]
cebb3ba2aaf2e9211b1dcc6db2bab02946d06e42
https://github.com/ph4r05/monero-serialize/blob/cebb3ba2aaf2e9211b1dcc6db2bab02946d06e42/monero_serialize/xmrboost.py#L17-L42
train
Load Monero portable_binary_archive boost integer serialization
ph4r05/monero-serialize
monero_serialize/xmrboost.py
dump_uvarint
async def dump_uvarint(writer, n): """ Monero portable_binary_archive boost integer serialization :param writer: :param n: :return: """ buffer = _UVARINT_BUFFER if n == 0: buffer[0] = 0 return await writer.awrite(buffer) negative = n < 0 ll = -n if negative else ...
python
async def dump_uvarint(writer, n): """ Monero portable_binary_archive boost integer serialization :param writer: :param n: :return: """ buffer = _UVARINT_BUFFER if n == 0: buffer[0] = 0 return await writer.awrite(buffer) negative = n < 0 ll = -n if negative else ...
[ "async", "def", "dump_uvarint", "(", "writer", ",", "n", ")", ":", "buffer", "=", "_UVARINT_BUFFER", "if", "n", "==", "0", ":", "buffer", "[", "0", "]", "=", "0", "return", "await", "writer", ".", "awrite", "(", "buffer", ")", "negative", "=", "n", ...
Monero portable_binary_archive boost integer serialization :param writer: :param n: :return:
[ "Monero", "portable_binary_archive", "boost", "integer", "serialization", ":", "param", "writer", ":", ":", "param", "n", ":", ":", "return", ":" ]
cebb3ba2aaf2e9211b1dcc6db2bab02946d06e42
https://github.com/ph4r05/monero-serialize/blob/cebb3ba2aaf2e9211b1dcc6db2bab02946d06e42/monero_serialize/xmrboost.py#L45-L74
train
Dump n Monero portable_binary_archive boost integer serialization.
ph4r05/monero-serialize
monero_serialize/xmrboost.py
Archive.type_in_db
def type_in_db(self, tp, params): """ Determines if type is in the database :param tp: :return: """ tw = TypeWrapper(tp, params) return self.version_db.is_versioned(tw)
python
def type_in_db(self, tp, params): """ Determines if type is in the database :param tp: :return: """ tw = TypeWrapper(tp, params) return self.version_db.is_versioned(tw)
[ "def", "type_in_db", "(", "self", ",", "tp", ",", "params", ")", ":", "tw", "=", "TypeWrapper", "(", "tp", ",", "params", ")", "return", "self", ".", "version_db", ".", "is_versioned", "(", "tw", ")" ]
Determines if type is in the database :param tp: :return:
[ "Determines", "if", "type", "is", "in", "the", "database", ":", "param", "tp", ":", ":", "return", ":" ]
cebb3ba2aaf2e9211b1dcc6db2bab02946d06e42
https://github.com/ph4r05/monero-serialize/blob/cebb3ba2aaf2e9211b1dcc6db2bab02946d06e42/monero_serialize/xmrboost.py#L131-L138
train
Determines if a type is in the database.
ph4r05/monero-serialize
monero_serialize/xmrboost.py
Archive.get_version
async def get_version(self, tp, params): """ Loads version from the stream / version database # TODO: instance vs. tp. :param tp: :param params: :return: """ tw = TypeWrapper(tp, params) if not tw.is_versioned(): # self.registry.set_tr...
python
async def get_version(self, tp, params): """ Loads version from the stream / version database # TODO: instance vs. tp. :param tp: :param params: :return: """ tw = TypeWrapper(tp, params) if not tw.is_versioned(): # self.registry.set_tr...
[ "async", "def", "get_version", "(", "self", ",", "tp", ",", "params", ")", ":", "tw", "=", "TypeWrapper", "(", "tp", ",", "params", ")", "if", "not", "tw", ".", "is_versioned", "(", ")", ":", "# self.registry.set_tr()", "return", "TypeWrapper", ".", "ELE...
Loads version from the stream / version database # TODO: instance vs. tp. :param tp: :param params: :return:
[ "Loads", "version", "from", "the", "stream", "/", "version", "database", "#", "TODO", ":", "instance", "vs", ".", "tp", "." ]
cebb3ba2aaf2e9211b1dcc6db2bab02946d06e42
https://github.com/ph4r05/monero-serialize/blob/cebb3ba2aaf2e9211b1dcc6db2bab02946d06e42/monero_serialize/xmrboost.py#L179-L204
train
Loads version from the stream or version database.
ph4r05/monero-serialize
monero_serialize/xmrboost.py
Archive.set_version
async def set_version(self, tp, params, version=None, elem=None): """ Stores version to the stream if not stored yet :param tp: :param params: :param version: :param elem: :return: """ self.registry.set_tr(None) tw = TypeWrapper(tp, params...
python
async def set_version(self, tp, params, version=None, elem=None): """ Stores version to the stream if not stored yet :param tp: :param params: :param version: :param elem: :return: """ self.registry.set_tr(None) tw = TypeWrapper(tp, params...
[ "async", "def", "set_version", "(", "self", ",", "tp", ",", "params", ",", "version", "=", "None", ",", "elem", "=", "None", ")", ":", "self", ".", "registry", ".", "set_tr", "(", "None", ")", "tw", "=", "TypeWrapper", "(", "tp", ",", "params", ")"...
Stores version to the stream if not stored yet :param tp: :param params: :param version: :param elem: :return:
[ "Stores", "version", "to", "the", "stream", "if", "not", "stored", "yet" ]
cebb3ba2aaf2e9211b1dcc6db2bab02946d06e42
https://github.com/ph4r05/monero-serialize/blob/cebb3ba2aaf2e9211b1dcc6db2bab02946d06e42/monero_serialize/xmrboost.py#L206-L230
train
Sets the version of the current object to the given version.
ph4r05/monero-serialize
monero_serialize/xmrboost.py
Archive.version
async def version(self, tp, params, version=None, elem=None): """ Symmetric version management :param tp: :param params: :param version: :return: """ if self.writing: return await self.set_version(tp, params, version, elem) else: ...
python
async def version(self, tp, params, version=None, elem=None): """ Symmetric version management :param tp: :param params: :param version: :return: """ if self.writing: return await self.set_version(tp, params, version, elem) else: ...
[ "async", "def", "version", "(", "self", ",", "tp", ",", "params", ",", "version", "=", "None", ",", "elem", "=", "None", ")", ":", "if", "self", ".", "writing", ":", "return", "await", "self", ".", "set_version", "(", "tp", ",", "params", ",", "ver...
Symmetric version management :param tp: :param params: :param version: :return:
[ "Symmetric", "version", "management" ]
cebb3ba2aaf2e9211b1dcc6db2bab02946d06e42
https://github.com/ph4r05/monero-serialize/blob/cebb3ba2aaf2e9211b1dcc6db2bab02946d06e42/monero_serialize/xmrboost.py#L232-L244
train
This method is used to set or get the version of the current object.
ph4r05/monero-serialize
monero_serialize/xmrboost.py
Archive.uvarint
async def uvarint(self, elem): """ Uvarint :param elem: :return: """ if self.writing: return await dump_uvarint(self.iobj, elem) else: return await load_uvarint(self.iobj)
python
async def uvarint(self, elem): """ Uvarint :param elem: :return: """ if self.writing: return await dump_uvarint(self.iobj, elem) else: return await load_uvarint(self.iobj)
[ "async", "def", "uvarint", "(", "self", ",", "elem", ")", ":", "if", "self", ".", "writing", ":", "return", "await", "dump_uvarint", "(", "self", ".", "iobj", ",", "elem", ")", "else", ":", "return", "await", "load_uvarint", "(", "self", ".", "iobj", ...
Uvarint :param elem: :return:
[ "Uvarint", ":", "param", "elem", ":", ":", "return", ":" ]
cebb3ba2aaf2e9211b1dcc6db2bab02946d06e42
https://github.com/ph4r05/monero-serialize/blob/cebb3ba2aaf2e9211b1dcc6db2bab02946d06e42/monero_serialize/xmrboost.py#L246-L255
train
Uvarint.
ph4r05/monero-serialize
monero_serialize/xmrboost.py
Archive.uint
async def uint(self, elem, elem_type, params=None): """ Integer types :param elem: :param elem_type: :param params: :return: """ one_b_type = x.is_type(elem_type, (x.Int8, x.UInt8)) if self.writing: return (await x.dump_uint(self.iobj, ...
python
async def uint(self, elem, elem_type, params=None): """ Integer types :param elem: :param elem_type: :param params: :return: """ one_b_type = x.is_type(elem_type, (x.Int8, x.UInt8)) if self.writing: return (await x.dump_uint(self.iobj, ...
[ "async", "def", "uint", "(", "self", ",", "elem", ",", "elem_type", ",", "params", "=", "None", ")", ":", "one_b_type", "=", "x", ".", "is_type", "(", "elem_type", ",", "(", "x", ".", "Int8", ",", "x", ".", "UInt8", ")", ")", "if", "self", ".", ...
Integer types :param elem: :param elem_type: :param params: :return:
[ "Integer", "types", ":", "param", "elem", ":", ":", "param", "elem_type", ":", ":", "param", "params", ":", ":", "return", ":" ]
cebb3ba2aaf2e9211b1dcc6db2bab02946d06e42
https://github.com/ph4r05/monero-serialize/blob/cebb3ba2aaf2e9211b1dcc6db2bab02946d06e42/monero_serialize/xmrboost.py#L257-L269
train
Get the uvarint value of a tag.
ph4r05/monero-serialize
monero_serialize/xmrboost.py
Archive.unicode_type
async def unicode_type(self, elem): """ Unicode type :param elem: :return: """ if self.writing: await dump_uvarint(self.iobj, len(elem)) await self.iobj.awrite(bytes(elem, 'utf8')) else: ivalue = await load_uvarint(self.iobj) ...
python
async def unicode_type(self, elem): """ Unicode type :param elem: :return: """ if self.writing: await dump_uvarint(self.iobj, len(elem)) await self.iobj.awrite(bytes(elem, 'utf8')) else: ivalue = await load_uvarint(self.iobj) ...
[ "async", "def", "unicode_type", "(", "self", ",", "elem", ")", ":", "if", "self", ".", "writing", ":", "await", "dump_uvarint", "(", "self", ".", "iobj", ",", "len", "(", "elem", ")", ")", "await", "self", ".", "iobj", ".", "awrite", "(", "bytes", ...
Unicode type :param elem: :return:
[ "Unicode", "type", ":", "param", "elem", ":", ":", "return", ":" ]
cebb3ba2aaf2e9211b1dcc6db2bab02946d06e42
https://github.com/ph4r05/monero-serialize/blob/cebb3ba2aaf2e9211b1dcc6db2bab02946d06e42/monero_serialize/xmrboost.py#L271-L288
train
Return unicode type of the element.
ph4r05/monero-serialize
monero_serialize/xmrboost.py
Archive.blob
async def blob(self, elem=None, elem_type=None, params=None): """ Loads/dumps blob :return: """ elem_type = elem_type if elem_type else elem.__class__ version = await self.version(elem_type, params, elem=elem) if self.is_tracked(): return self.get_tra...
python
async def blob(self, elem=None, elem_type=None, params=None): """ Loads/dumps blob :return: """ elem_type = elem_type if elem_type else elem.__class__ version = await self.version(elem_type, params, elem=elem) if self.is_tracked(): return self.get_tra...
[ "async", "def", "blob", "(", "self", ",", "elem", "=", "None", ",", "elem_type", "=", "None", ",", "params", "=", "None", ")", ":", "elem_type", "=", "elem_type", "if", "elem_type", "else", "elem", ".", "__class__", "version", "=", "await", "self", "."...
Loads/dumps blob :return:
[ "Loads", "/", "dumps", "blob", ":", "return", ":" ]
cebb3ba2aaf2e9211b1dcc6db2bab02946d06e42
https://github.com/ph4r05/monero-serialize/blob/cebb3ba2aaf2e9211b1dcc6db2bab02946d06e42/monero_serialize/xmrboost.py#L290-L312
train
Load and dump a blob.
ph4r05/monero-serialize
monero_serialize/xmrboost.py
Archive.blob_dump
async def blob_dump(self, elem, elem_type, params=None): """ Dumps blob message to the writer. Supports both blob and raw value. :param writer: :param elem: :param elem_type: :param params: :return: """ elem_is_blob = isinstance(elem, x.Bl...
python
async def blob_dump(self, elem, elem_type, params=None): """ Dumps blob message to the writer. Supports both blob and raw value. :param writer: :param elem: :param elem_type: :param params: :return: """ elem_is_blob = isinstance(elem, x.Bl...
[ "async", "def", "blob_dump", "(", "self", ",", "elem", ",", "elem_type", ",", "params", "=", "None", ")", ":", "elem_is_blob", "=", "isinstance", "(", "elem", ",", "x", ".", "BlobType", ")", "elem_params", "=", "elem", "if", "elem_is_blob", "or", "elem_t...
Dumps blob message to the writer. Supports both blob and raw value. :param writer: :param elem: :param elem_type: :param params: :return:
[ "Dumps", "blob", "message", "to", "the", "writer", ".", "Supports", "both", "blob", "and", "raw", "value", "." ]
cebb3ba2aaf2e9211b1dcc6db2bab02946d06e42
https://github.com/ph4r05/monero-serialize/blob/cebb3ba2aaf2e9211b1dcc6db2bab02946d06e42/monero_serialize/xmrboost.py#L314-L333
train
Dumps blob message to the writer.
ph4r05/monero-serialize
monero_serialize/xmrboost.py
Archive.blob_load
async def blob_load(self, elem_type, params=None, elem=None): """ Loads blob from reader to the element. Returns the loaded blob. :param reader: :param elem_type: :param params: :param elem: :return: """ ivalue = await load_uvarint(self.iobj) ...
python
async def blob_load(self, elem_type, params=None, elem=None): """ Loads blob from reader to the element. Returns the loaded blob. :param reader: :param elem_type: :param params: :param elem: :return: """ ivalue = await load_uvarint(self.iobj) ...
[ "async", "def", "blob_load", "(", "self", ",", "elem_type", ",", "params", "=", "None", ",", "elem", "=", "None", ")", ":", "ivalue", "=", "await", "load_uvarint", "(", "self", ".", "iobj", ")", "fvalue", "=", "bytearray", "(", "ivalue", ")", "await", ...
Loads blob from reader to the element. Returns the loaded blob. :param reader: :param elem_type: :param params: :param elem: :return:
[ "Loads", "blob", "from", "reader", "to", "the", "element", ".", "Returns", "the", "loaded", "blob", "." ]
cebb3ba2aaf2e9211b1dcc6db2bab02946d06e42
https://github.com/ph4r05/monero-serialize/blob/cebb3ba2aaf2e9211b1dcc6db2bab02946d06e42/monero_serialize/xmrboost.py#L335-L359
train
Loads the blob from reader to the element. Returns the loaded blob.
ph4r05/monero-serialize
monero_serialize/xmrboost.py
Archive.container
async def container(self, container=None, container_type=None, params=None): """ Loads/dumps container :return: """ # Container versioning is a bit tricky, primitive type containers are not versioned. elem_type = x.container_elem_type(container_type, params) raw_c...
python
async def container(self, container=None, container_type=None, params=None): """ Loads/dumps container :return: """ # Container versioning is a bit tricky, primitive type containers are not versioned. elem_type = x.container_elem_type(container_type, params) raw_c...
[ "async", "def", "container", "(", "self", ",", "container", "=", "None", ",", "container_type", "=", "None", ",", "params", "=", "None", ")", ":", "# Container versioning is a bit tricky, primitive type containers are not versioned.", "elem_type", "=", "x", ".", "cont...
Loads/dumps container :return:
[ "Loads", "/", "dumps", "container", ":", "return", ":" ]
cebb3ba2aaf2e9211b1dcc6db2bab02946d06e42
https://github.com/ph4r05/monero-serialize/blob/cebb3ba2aaf2e9211b1dcc6db2bab02946d06e42/monero_serialize/xmrboost.py#L361-L389
train
Load and dump a container.
ph4r05/monero-serialize
monero_serialize/xmrboost.py
Archive.container_size
async def container_size(self, container_len=None, container_type=None, params=None): """ Container size :param container_len: :param container_type: :param params: :return: """ if hasattr(container_type, 'boost_serialize'): raise ValueError('n...
python
async def container_size(self, container_len=None, container_type=None, params=None): """ Container size :param container_len: :param container_type: :param params: :return: """ if hasattr(container_type, 'boost_serialize'): raise ValueError('n...
[ "async", "def", "container_size", "(", "self", ",", "container_len", "=", "None", ",", "container_type", "=", "None", ",", "params", "=", "None", ")", ":", "if", "hasattr", "(", "container_type", ",", "'boost_serialize'", ")", ":", "raise", "ValueError", "("...
Container size :param container_len: :param container_type: :param params: :return:
[ "Container", "size", ":", "param", "container_len", ":", ":", "param", "container_type", ":", ":", "param", "params", ":", ":", "return", ":" ]
cebb3ba2aaf2e9211b1dcc6db2bab02946d06e42
https://github.com/ph4r05/monero-serialize/blob/cebb3ba2aaf2e9211b1dcc6db2bab02946d06e42/monero_serialize/xmrboost.py#L391-L413
train
Get size of a container.
ph4r05/monero-serialize
monero_serialize/xmrboost.py
Archive.container_val
async def container_val(self, elem, container_type, params=None): """ Single cont value :param elem: :param container_type: :param params: :param field_archiver: :return: """ if hasattr(container_type, 'boost_serialize'): raise ValueErr...
python
async def container_val(self, elem, container_type, params=None): """ Single cont value :param elem: :param container_type: :param params: :param field_archiver: :return: """ if hasattr(container_type, 'boost_serialize'): raise ValueErr...
[ "async", "def", "container_val", "(", "self", ",", "elem", ",", "container_type", ",", "params", "=", "None", ")", ":", "if", "hasattr", "(", "container_type", ",", "'boost_serialize'", ")", ":", "raise", "ValueError", "(", "'not supported'", ")", "if", "sel...
Single cont value :param elem: :param container_type: :param params: :param field_archiver: :return:
[ "Single", "cont", "value", ":", "param", "elem", ":", ":", "param", "container_type", ":", ":", "param", "params", ":", ":", "param", "field_archiver", ":", ":", "return", ":" ]
cebb3ba2aaf2e9211b1dcc6db2bab02946d06e42
https://github.com/ph4r05/monero-serialize/blob/cebb3ba2aaf2e9211b1dcc6db2bab02946d06e42/monero_serialize/xmrboost.py#L415-L435
train
Get the value of a single element in a container.
ph4r05/monero-serialize
monero_serialize/xmrboost.py
Archive.container_dump
async def container_dump(self, container, container_type, params=None): """ Dumps container of elements to the writer. :param writer: :param container: :param container_type: :param params: :param field_archiver: :return: """ await self.co...
python
async def container_dump(self, container, container_type, params=None): """ Dumps container of elements to the writer. :param writer: :param container: :param container_type: :param params: :param field_archiver: :return: """ await self.co...
[ "async", "def", "container_dump", "(", "self", ",", "container", ",", "container_type", ",", "params", "=", "None", ")", ":", "await", "self", ".", "container_size", "(", "len", "(", "container", ")", ",", "container_type", ",", "params", ")", "elem_type", ...
Dumps container of elements to the writer. :param writer: :param container: :param container_type: :param params: :param field_archiver: :return:
[ "Dumps", "container", "of", "elements", "to", "the", "writer", "." ]
cebb3ba2aaf2e9211b1dcc6db2bab02946d06e42
https://github.com/ph4r05/monero-serialize/blob/cebb3ba2aaf2e9211b1dcc6db2bab02946d06e42/monero_serialize/xmrboost.py#L437-L457
train
Dumps a container of elements to the writer.
ph4r05/monero-serialize
monero_serialize/xmrboost.py
Archive.container_load
async def container_load(self, container_type, params=None, container=None): """ Loads container of elements from the reader. Supports the container ref. Returns loaded container. :param container_type: :param params: :param container: :param field_archiver: ...
python
async def container_load(self, container_type, params=None, container=None): """ Loads container of elements from the reader. Supports the container ref. Returns loaded container. :param container_type: :param params: :param container: :param field_archiver: ...
[ "async", "def", "container_load", "(", "self", ",", "container_type", ",", "params", "=", "None", ",", "container", "=", "None", ")", ":", "raw_container", "=", "container_is_raw", "(", "container_type", ",", "params", ")", "c_len", "=", "await", "load_uvarint...
Loads container of elements from the reader. Supports the container ref. Returns loaded container. :param container_type: :param params: :param container: :param field_archiver: :return:
[ "Loads", "container", "of", "elements", "from", "the", "reader", ".", "Supports", "the", "container", "ref", ".", "Returns", "loaded", "container", "." ]
cebb3ba2aaf2e9211b1dcc6db2bab02946d06e42
https://github.com/ph4r05/monero-serialize/blob/cebb3ba2aaf2e9211b1dcc6db2bab02946d06e42/monero_serialize/xmrboost.py#L459-L491
train
Loads the container of elements from the reader. Supports the container ref. Returns loaded container.
ph4r05/monero-serialize
monero_serialize/xmrboost.py
Archive.tuple
async def tuple(self, elem=None, elem_type=None, params=None): """ Loads/dumps tuple :return: """ version = await self.version(elem_type, params, elem=elem) if self.is_tracked(): return self.get_tracked() if hasattr(elem_type, 'boost_serialize'): ...
python
async def tuple(self, elem=None, elem_type=None, params=None): """ Loads/dumps tuple :return: """ version = await self.version(elem_type, params, elem=elem) if self.is_tracked(): return self.get_tracked() if hasattr(elem_type, 'boost_serialize'): ...
[ "async", "def", "tuple", "(", "self", ",", "elem", "=", "None", ",", "elem_type", "=", "None", ",", "params", "=", "None", ")", ":", "version", "=", "await", "self", ".", "version", "(", "elem_type", ",", "params", ",", "elem", "=", "elem", ")", "i...
Loads/dumps tuple :return:
[ "Loads", "/", "dumps", "tuple", ":", "return", ":" ]
cebb3ba2aaf2e9211b1dcc6db2bab02946d06e42
https://github.com/ph4r05/monero-serialize/blob/cebb3ba2aaf2e9211b1dcc6db2bab02946d06e42/monero_serialize/xmrboost.py#L493-L512
train
Load a tuple from the cache or dump it if writing is True.
ph4r05/monero-serialize
monero_serialize/xmrboost.py
Archive.dump_tuple
async def dump_tuple(self, elem, elem_type, params=None): """ Dumps tuple of elements to the writer. :param elem: :param elem_type: :param params: :return: """ if len(elem) != len(elem_type.f_specs()): raise ValueError('Fixed size tuple has no...
python
async def dump_tuple(self, elem, elem_type, params=None): """ Dumps tuple of elements to the writer. :param elem: :param elem_type: :param params: :return: """ if len(elem) != len(elem_type.f_specs()): raise ValueError('Fixed size tuple has no...
[ "async", "def", "dump_tuple", "(", "self", ",", "elem", ",", "elem_type", ",", "params", "=", "None", ")", ":", "if", "len", "(", "elem", ")", "!=", "len", "(", "elem_type", ".", "f_specs", "(", ")", ")", ":", "raise", "ValueError", "(", "'Fixed size...
Dumps tuple of elements to the writer. :param elem: :param elem_type: :param params: :return:
[ "Dumps", "tuple", "of", "elements", "to", "the", "writer", "." ]
cebb3ba2aaf2e9211b1dcc6db2bab02946d06e42
https://github.com/ph4r05/monero-serialize/blob/cebb3ba2aaf2e9211b1dcc6db2bab02946d06e42/monero_serialize/xmrboost.py#L514-L536
train
Dumps a tuple of elements to the writer.
ph4r05/monero-serialize
monero_serialize/xmrboost.py
Archive.variant
async def variant(self, elem=None, elem_type=None, params=None): """ Loads/dumps variant type :param elem: :param elem_type: :param params: :return: """ elem_type = elem_type if elem_type else elem.__class__ version = await self.version(elem_type, ...
python
async def variant(self, elem=None, elem_type=None, params=None): """ Loads/dumps variant type :param elem: :param elem_type: :param params: :return: """ elem_type = elem_type if elem_type else elem.__class__ version = await self.version(elem_type, ...
[ "async", "def", "variant", "(", "self", ",", "elem", "=", "None", ",", "elem_type", "=", "None", ",", "params", "=", "None", ")", ":", "elem_type", "=", "elem_type", "if", "elem_type", "else", "elem", ".", "__class__", "version", "=", "await", "self", ...
Loads/dumps variant type :param elem: :param elem_type: :param params: :return:
[ "Loads", "/", "dumps", "variant", "type", ":", "param", "elem", ":", ":", "param", "elem_type", ":", ":", "param", "params", ":", ":", "return", ":" ]
cebb3ba2aaf2e9211b1dcc6db2bab02946d06e42
https://github.com/ph4r05/monero-serialize/blob/cebb3ba2aaf2e9211b1dcc6db2bab02946d06e42/monero_serialize/xmrboost.py#L572-L598
train
Loads and dumps a single variant from the database.
ph4r05/monero-serialize
monero_serialize/xmrboost.py
Archive.dump_variant
async def dump_variant(self, elem, elem_type=None, params=None): """ Dumps variant type to the writer. Supports both wrapped and raw variant. :param writer: :param elem: :param elem_type: :param params: :return: """ if isinstance(elem, x.V...
python
async def dump_variant(self, elem, elem_type=None, params=None): """ Dumps variant type to the writer. Supports both wrapped and raw variant. :param writer: :param elem: :param elem_type: :param params: :return: """ if isinstance(elem, x.V...
[ "async", "def", "dump_variant", "(", "self", ",", "elem", ",", "elem_type", "=", "None", ",", "params", "=", "None", ")", ":", "if", "isinstance", "(", "elem", ",", "x", ".", "VariantType", ")", "or", "elem_type", ".", "WRAPS_VALUE", ":", "await", "dum...
Dumps variant type to the writer. Supports both wrapped and raw variant. :param writer: :param elem: :param elem_type: :param params: :return:
[ "Dumps", "variant", "type", "to", "the", "writer", ".", "Supports", "both", "wrapped", "and", "raw", "variant", "." ]
cebb3ba2aaf2e9211b1dcc6db2bab02946d06e42
https://github.com/ph4r05/monero-serialize/blob/cebb3ba2aaf2e9211b1dcc6db2bab02946d06e42/monero_serialize/xmrboost.py#L600-L619
train
Dumps the contents of the specified variant to the writer.
ph4r05/monero-serialize
monero_serialize/xmrboost.py
Archive.load_variant
async def load_variant(self, elem_type, params=None, elem=None, wrapped=None): """ Loads variant type from the reader. Supports both wrapped and raw variant. :param reader: :param elem_type: :param params: :param elem: :param wrapped: :return: ...
python
async def load_variant(self, elem_type, params=None, elem=None, wrapped=None): """ Loads variant type from the reader. Supports both wrapped and raw variant. :param reader: :param elem_type: :param params: :param elem: :param wrapped: :return: ...
[ "async", "def", "load_variant", "(", "self", ",", "elem_type", ",", "params", "=", "None", ",", "elem", "=", "None", ",", "wrapped", "=", "None", ")", ":", "is_wrapped", "=", "(", "isinstance", "(", "elem", ",", "x", ".", "VariantType", ")", "or", "e...
Loads variant type from the reader. Supports both wrapped and raw variant. :param reader: :param elem_type: :param params: :param elem: :param wrapped: :return:
[ "Loads", "variant", "type", "from", "the", "reader", ".", "Supports", "both", "wrapped", "and", "raw", "variant", "." ]
cebb3ba2aaf2e9211b1dcc6db2bab02946d06e42
https://github.com/ph4r05/monero-serialize/blob/cebb3ba2aaf2e9211b1dcc6db2bab02946d06e42/monero_serialize/xmrboost.py#L621-L649
train
Loads a single variant from the reader.
ph4r05/monero-serialize
monero_serialize/xmrboost.py
Archive.root
async def root(self): """ Root level init :return: """ if self.writing: await self.iobj.awrite(binascii.unhexlify(b'011673657269616c697a6174696f6e3a3a617263686976650000')) else: hdr = bytearray(2) await self.iobj.areadinto(hdr) ...
python
async def root(self): """ Root level init :return: """ if self.writing: await self.iobj.awrite(binascii.unhexlify(b'011673657269616c697a6174696f6e3a3a617263686976650000')) else: hdr = bytearray(2) await self.iobj.areadinto(hdr) ...
[ "async", "def", "root", "(", "self", ")", ":", "if", "self", ".", "writing", ":", "await", "self", ".", "iobj", ".", "awrite", "(", "binascii", ".", "unhexlify", "(", "b'011673657269616c697a6174696f6e3a3a617263686976650000'", ")", ")", "else", ":", "hdr", "=...
Root level init :return:
[ "Root", "level", "init", ":", "return", ":" ]
cebb3ba2aaf2e9211b1dcc6db2bab02946d06e42
https://github.com/ph4r05/monero-serialize/blob/cebb3ba2aaf2e9211b1dcc6db2bab02946d06e42/monero_serialize/xmrboost.py#L651-L673
train
Load the root level of the object.
ph4r05/monero-serialize
monero_serialize/xmrboost.py
Archive.root_message
async def root_message(self, msg, msg_type=None): """ Root-level message. First entry in the archive. Archive headers processing :return: """ await self.root() await self.message(msg, msg_type)
python
async def root_message(self, msg, msg_type=None): """ Root-level message. First entry in the archive. Archive headers processing :return: """ await self.root() await self.message(msg, msg_type)
[ "async", "def", "root_message", "(", "self", ",", "msg", ",", "msg_type", "=", "None", ")", ":", "await", "self", ".", "root", "(", ")", "await", "self", ".", "message", "(", "msg", ",", "msg_type", ")" ]
Root-level message. First entry in the archive. Archive headers processing :return:
[ "Root", "-", "level", "message", ".", "First", "entry", "in", "the", "archive", ".", "Archive", "headers", "processing" ]
cebb3ba2aaf2e9211b1dcc6db2bab02946d06e42
https://github.com/ph4r05/monero-serialize/blob/cebb3ba2aaf2e9211b1dcc6db2bab02946d06e42/monero_serialize/xmrboost.py#L675-L683
train
Root - level message. First entry in the archive.
ph4r05/monero-serialize
monero_serialize/xmrboost.py
Archive.message
async def message(self, msg, msg_type=None, use_version=None): """ Loads/dumps message :param msg: :param msg_type: :param use_version: :return: """ elem_type = msg_type if msg_type is not None else msg.__class__ version = await self.version(elem_t...
python
async def message(self, msg, msg_type=None, use_version=None): """ Loads/dumps message :param msg: :param msg_type: :param use_version: :return: """ elem_type = msg_type if msg_type is not None else msg.__class__ version = await self.version(elem_t...
[ "async", "def", "message", "(", "self", ",", "msg", ",", "msg_type", "=", "None", ",", "use_version", "=", "None", ")", ":", "elem_type", "=", "msg_type", "if", "msg_type", "is", "not", "None", "else", "msg", ".", "__class__", "version", "=", "await", ...
Loads/dumps message :param msg: :param msg_type: :param use_version: :return:
[ "Loads", "/", "dumps", "message", ":", "param", "msg", ":", ":", "param", "msg_type", ":", ":", "param", "use_version", ":", ":", "return", ":" ]
cebb3ba2aaf2e9211b1dcc6db2bab02946d06e42
https://github.com/ph4r05/monero-serialize/blob/cebb3ba2aaf2e9211b1dcc6db2bab02946d06e42/monero_serialize/xmrboost.py#L685-L709
train
Load a message from the database and return the object.
ph4r05/monero-serialize
monero_serialize/xmrboost.py
Archive.message_fields
async def message_fields(self, msg, fields): """ Load/dump individual message fields :param msg: :param fields: :param field_archiver: :return: """ for field in fields: try: self.tracker.push_field(field[0]) awai...
python
async def message_fields(self, msg, fields): """ Load/dump individual message fields :param msg: :param fields: :param field_archiver: :return: """ for field in fields: try: self.tracker.push_field(field[0]) awai...
[ "async", "def", "message_fields", "(", "self", ",", "msg", ",", "fields", ")", ":", "for", "field", "in", "fields", ":", "try", ":", "self", ".", "tracker", ".", "push_field", "(", "field", "[", "0", "]", ")", "await", "self", ".", "message_field", "...
Load/dump individual message fields :param msg: :param fields: :param field_archiver: :return:
[ "Load", "/", "dump", "individual", "message", "fields", ":", "param", "msg", ":", ":", "param", "fields", ":", ":", "param", "field_archiver", ":", ":", "return", ":" ]
cebb3ba2aaf2e9211b1dcc6db2bab02946d06e42
https://github.com/ph4r05/monero-serialize/blob/cebb3ba2aaf2e9211b1dcc6db2bab02946d06e42/monero_serialize/xmrboost.py#L734-L751
train
Load and dump individual message fields.
ph4r05/monero-serialize
monero_serialize/xmrboost.py
Archive.dump_message
async def dump_message(self, msg, msg_type=None): """ Dumps message to the writer. :param msg: :param msg_type: :return: """ mtype = msg.__class__ if msg_type is None else msg_type fields = mtype.f_specs() for field in fields: await se...
python
async def dump_message(self, msg, msg_type=None): """ Dumps message to the writer. :param msg: :param msg_type: :return: """ mtype = msg.__class__ if msg_type is None else msg_type fields = mtype.f_specs() for field in fields: await se...
[ "async", "def", "dump_message", "(", "self", ",", "msg", ",", "msg_type", "=", "None", ")", ":", "mtype", "=", "msg", ".", "__class__", "if", "msg_type", "is", "None", "else", "msg_type", "fields", "=", "mtype", ".", "f_specs", "(", ")", "for", "field"...
Dumps message to the writer. :param msg: :param msg_type: :return:
[ "Dumps", "message", "to", "the", "writer", "." ]
cebb3ba2aaf2e9211b1dcc6db2bab02946d06e42
https://github.com/ph4r05/monero-serialize/blob/cebb3ba2aaf2e9211b1dcc6db2bab02946d06e42/monero_serialize/xmrboost.py#L753-L764
train
Dumps a message to the writer.
ph4r05/monero-serialize
monero_serialize/xmrboost.py
Archive.load_message
async def load_message(self, msg_type, msg=None): """ Loads message if the given type from the reader. Supports reading directly to existing message. :param msg_type: :param msg: :return: """ msg = msg_type() if msg is None else msg fields = msg_t...
python
async def load_message(self, msg_type, msg=None): """ Loads message if the given type from the reader. Supports reading directly to existing message. :param msg_type: :param msg: :return: """ msg = msg_type() if msg is None else msg fields = msg_t...
[ "async", "def", "load_message", "(", "self", ",", "msg_type", ",", "msg", "=", "None", ")", ":", "msg", "=", "msg_type", "(", ")", "if", "msg", "is", "None", "else", "msg", "fields", "=", "msg_type", ".", "f_specs", "(", ")", "if", "msg_type", "else"...
Loads message if the given type from the reader. Supports reading directly to existing message. :param msg_type: :param msg: :return:
[ "Loads", "message", "if", "the", "given", "type", "from", "the", "reader", ".", "Supports", "reading", "directly", "to", "existing", "message", "." ]
cebb3ba2aaf2e9211b1dcc6db2bab02946d06e42
https://github.com/ph4r05/monero-serialize/blob/cebb3ba2aaf2e9211b1dcc6db2bab02946d06e42/monero_serialize/xmrboost.py#L766-L780
train
Loads a message of the given type from the reader.
eonpatapon/contrail-api-cli
contrail_api_cli/commands/relative.py
Relative._get_next_resource
def _get_next_resource(self, resource, next_resource_name, selectors): """ :param resource: Resource (not necessary fetched) :param next_resource_name: string :rtype: (resource_type, resource_path) """ # don't fetch twice if 'id_perms' not in resource: ...
python
def _get_next_resource(self, resource, next_resource_name, selectors): """ :param resource: Resource (not necessary fetched) :param next_resource_name: string :rtype: (resource_type, resource_path) """ # don't fetch twice if 'id_perms' not in resource: ...
[ "def", "_get_next_resource", "(", "self", ",", "resource", ",", "next_resource_name", ",", "selectors", ")", ":", "# don't fetch twice", "if", "'id_perms'", "not", "in", "resource", ":", "resource", ".", "fetch", "(", ")", "res", "=", "None", "for", "res_list"...
:param resource: Resource (not necessary fetched) :param next_resource_name: string :rtype: (resource_type, resource_path)
[ ":", "param", "resource", ":", "Resource", "(", "not", "necessary", "fetched", ")", ":", "param", "next_resource_name", ":", "string", ":", "rtype", ":", "(", "resource_type", "resource_path", ")" ]
1571bf523fa054f3d6bf83dba43a224fea173a73
https://github.com/eonpatapon/contrail-api-cli/blob/1571bf523fa054f3d6bf83dba43a224fea173a73/contrail_api_cli/commands/relative.py#L86-L108
train
Select next resource in the list of resources.
eonpatapon/contrail-api-cli
contrail_api_cli/client.py
contrail_error_handler
def contrail_error_handler(f): """Handle HTTP errors returned by the API server """ @wraps(f) def wrapper(*args, **kwargs): try: return f(*args, **kwargs) except HttpError as e: # Replace message by details to provide a # meaningful message ...
python
def contrail_error_handler(f): """Handle HTTP errors returned by the API server """ @wraps(f) def wrapper(*args, **kwargs): try: return f(*args, **kwargs) except HttpError as e: # Replace message by details to provide a # meaningful message ...
[ "def", "contrail_error_handler", "(", "f", ")", ":", "@", "wraps", "(", "f", ")", "def", "wrapper", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "try", ":", "return", "f", "(", "*", "args", ",", "*", "*", "kwargs", ")", "except", "HttpErr...
Handle HTTP errors returned by the API server
[ "Handle", "HTTP", "errors", "returned", "by", "the", "API", "server" ]
1571bf523fa054f3d6bf83dba43a224fea173a73
https://github.com/eonpatapon/contrail-api-cli/blob/1571bf523fa054f3d6bf83dba43a224fea173a73/contrail_api_cli/client.py#L15-L29
train
Handle HTTP errors returned by the API server .
eonpatapon/contrail-api-cli
contrail_api_cli/client.py
SessionLoader.make
def make(self, host="localhost", port=8082, protocol="http", base_uri="", os_auth_type="http", **kwargs): """Initialize a session to Contrail API server :param os_auth_type: auth plugin to use: - http: basic HTTP authentification - v2password: keystone v2 auth - v3pa...
python
def make(self, host="localhost", port=8082, protocol="http", base_uri="", os_auth_type="http", **kwargs): """Initialize a session to Contrail API server :param os_auth_type: auth plugin to use: - http: basic HTTP authentification - v2password: keystone v2 auth - v3pa...
[ "def", "make", "(", "self", ",", "host", "=", "\"localhost\"", ",", "port", "=", "8082", ",", "protocol", "=", "\"http\"", ",", "base_uri", "=", "\"\"", ",", "os_auth_type", "=", "\"http\"", ",", "*", "*", "kwargs", ")", ":", "loader", "=", "loading", ...
Initialize a session to Contrail API server :param os_auth_type: auth plugin to use: - http: basic HTTP authentification - v2password: keystone v2 auth - v3password: keystone v3 auth :type os_auth_type: str
[ "Initialize", "a", "session", "to", "Contrail", "API", "server" ]
1571bf523fa054f3d6bf83dba43a224fea173a73
https://github.com/eonpatapon/contrail-api-cli/blob/1571bf523fa054f3d6bf83dba43a224fea173a73/contrail_api_cli/client.py#L38-L57
train
Initialize a new session to Contrail API server
eonpatapon/contrail-api-cli
contrail_api_cli/client.py
ContrailAPISession.post_json
def post_json(self, url, data, cls=None, **kwargs): """ POST data to the api-server :param url: resource location (eg: "/type/uuid") :type url: str :param cls: JSONEncoder class :type cls: JSONEncoder """ kwargs['data'] = to_json(data, cls=cls) kw...
python
def post_json(self, url, data, cls=None, **kwargs): """ POST data to the api-server :param url: resource location (eg: "/type/uuid") :type url: str :param cls: JSONEncoder class :type cls: JSONEncoder """ kwargs['data'] = to_json(data, cls=cls) kw...
[ "def", "post_json", "(", "self", ",", "url", ",", "data", ",", "cls", "=", "None", ",", "*", "*", "kwargs", ")", ":", "kwargs", "[", "'data'", "]", "=", "to_json", "(", "data", ",", "cls", "=", "cls", ")", "kwargs", "[", "'headers'", "]", "=", ...
POST data to the api-server :param url: resource location (eg: "/type/uuid") :type url: str :param cls: JSONEncoder class :type cls: JSONEncoder
[ "POST", "data", "to", "the", "api", "-", "server" ]
1571bf523fa054f3d6bf83dba43a224fea173a73
https://github.com/eonpatapon/contrail-api-cli/blob/1571bf523fa054f3d6bf83dba43a224fea173a73/contrail_api_cli/client.py#L136-L147
train
POST data to the api - server
eonpatapon/contrail-api-cli
contrail_api_cli/client.py
ContrailAPISession.put_json
def put_json(self, url, data, cls=None, **kwargs): """ PUT data to the api-server :param url: resource location (eg: "/type/uuid") :type url: str :param cls: JSONEncoder class :type cls: JSONEncoder """ kwargs['data'] = to_json(data, cls=cls) kwar...
python
def put_json(self, url, data, cls=None, **kwargs): """ PUT data to the api-server :param url: resource location (eg: "/type/uuid") :type url: str :param cls: JSONEncoder class :type cls: JSONEncoder """ kwargs['data'] = to_json(data, cls=cls) kwar...
[ "def", "put_json", "(", "self", ",", "url", ",", "data", ",", "cls", "=", "None", ",", "*", "*", "kwargs", ")", ":", "kwargs", "[", "'data'", "]", "=", "to_json", "(", "data", ",", "cls", "=", "cls", ")", "kwargs", "[", "'headers'", "]", "=", "...
PUT data to the api-server :param url: resource location (eg: "/type/uuid") :type url: str :param cls: JSONEncoder class :type cls: JSONEncoder
[ "PUT", "data", "to", "the", "api", "-", "server" ]
1571bf523fa054f3d6bf83dba43a224fea173a73
https://github.com/eonpatapon/contrail-api-cli/blob/1571bf523fa054f3d6bf83dba43a224fea173a73/contrail_api_cli/client.py#L150-L161
train
PUT data to the api - server
eonpatapon/contrail-api-cli
contrail_api_cli/client.py
ContrailAPISession.fqname_to_id
def fqname_to_id(self, fq_name, type): """ Return uuid for fq_name :param fq_name: resource fq name :type fq_name: FQName :param type: resource type :type type: str :rtype: UUIDv4 str :raises HttpError: fq_name not found """ data = { ...
python
def fqname_to_id(self, fq_name, type): """ Return uuid for fq_name :param fq_name: resource fq name :type fq_name: FQName :param type: resource type :type type: str :rtype: UUIDv4 str :raises HttpError: fq_name not found """ data = { ...
[ "def", "fqname_to_id", "(", "self", ",", "fq_name", ",", "type", ")", ":", "data", "=", "{", "\"type\"", ":", "type", ",", "\"fq_name\"", ":", "list", "(", "fq_name", ")", "}", "return", "self", ".", "post_json", "(", "self", ".", "make_url", "(", "\...
Return uuid for fq_name :param fq_name: resource fq name :type fq_name: FQName :param type: resource type :type type: str :rtype: UUIDv4 str :raises HttpError: fq_name not found
[ "Return", "uuid", "for", "fq_name" ]
1571bf523fa054f3d6bf83dba43a224fea173a73
https://github.com/eonpatapon/contrail-api-cli/blob/1571bf523fa054f3d6bf83dba43a224fea173a73/contrail_api_cli/client.py#L163-L179
train
Return uuid for fq_name
eonpatapon/contrail-api-cli
contrail_api_cli/client.py
ContrailAPISession.id_to_fqname
def id_to_fqname(self, uuid, type=None): """ Return fq_name and type for uuid If `type` is provided check that uuid is actually a resource of type `type`. Raise HttpError if it's not the case. :param uuid: resource uuid :type uuid: UUIDv4 str :param type...
python
def id_to_fqname(self, uuid, type=None): """ Return fq_name and type for uuid If `type` is provided check that uuid is actually a resource of type `type`. Raise HttpError if it's not the case. :param uuid: resource uuid :type uuid: UUIDv4 str :param type...
[ "def", "id_to_fqname", "(", "self", ",", "uuid", ",", "type", "=", "None", ")", ":", "data", "=", "{", "\"uuid\"", ":", "uuid", "}", "result", "=", "self", ".", "post_json", "(", "self", ".", "make_url", "(", "\"/id-to-fqname\"", ")", ",", "data", ")...
Return fq_name and type for uuid If `type` is provided check that uuid is actually a resource of type `type`. Raise HttpError if it's not the case. :param uuid: resource uuid :type uuid: UUIDv4 str :param type: resource type :type type: str :rtype: dict...
[ "Return", "fq_name", "and", "type", "for", "uuid" ]
1571bf523fa054f3d6bf83dba43a224fea173a73
https://github.com/eonpatapon/contrail-api-cli/blob/1571bf523fa054f3d6bf83dba43a224fea173a73/contrail_api_cli/client.py#L181-L204
train
Return fq_name and type for uuid
eonpatapon/contrail-api-cli
contrail_api_cli/client.py
ContrailAPISession.search_kv_store
def search_kv_store(self, key): """Search for a key in the key-value store. :param key: string :rtype: string """ data = { 'operation': 'RETRIEVE', 'key': key } return self.post_json(self.make_url("/useragent-kv"), data)['value']
python
def search_kv_store(self, key): """Search for a key in the key-value store. :param key: string :rtype: string """ data = { 'operation': 'RETRIEVE', 'key': key } return self.post_json(self.make_url("/useragent-kv"), data)['value']
[ "def", "search_kv_store", "(", "self", ",", "key", ")", ":", "data", "=", "{", "'operation'", ":", "'RETRIEVE'", ",", "'key'", ":", "key", "}", "return", "self", ".", "post_json", "(", "self", ".", "make_url", "(", "\"/useragent-kv\"", ")", ",", "data", ...
Search for a key in the key-value store. :param key: string :rtype: string
[ "Search", "for", "a", "key", "in", "the", "key", "-", "value", "store", ".", ":", "param", "key", ":", "string", ":", "rtype", ":", "string" ]
1571bf523fa054f3d6bf83dba43a224fea173a73
https://github.com/eonpatapon/contrail-api-cli/blob/1571bf523fa054f3d6bf83dba43a224fea173a73/contrail_api_cli/client.py#L224-L233
train
Search for a key in the key - value store.
eonpatapon/contrail-api-cli
contrail_api_cli/client.py
ContrailAPISession.add_kv_store
def add_kv_store(self, key, value): """Add a key-value store entry. :param key: string :param value: string """ data = { 'operation': 'STORE', 'key': key, 'value': value } return self.post(self.make_url("/useragent-kv"), data=t...
python
def add_kv_store(self, key, value): """Add a key-value store entry. :param key: string :param value: string """ data = { 'operation': 'STORE', 'key': key, 'value': value } return self.post(self.make_url("/useragent-kv"), data=t...
[ "def", "add_kv_store", "(", "self", ",", "key", ",", "value", ")", ":", "data", "=", "{", "'operation'", ":", "'STORE'", ",", "'key'", ":", "key", ",", "'value'", ":", "value", "}", "return", "self", ".", "post", "(", "self", ".", "make_url", "(", ...
Add a key-value store entry. :param key: string :param value: string
[ "Add", "a", "key", "-", "value", "store", "entry", "." ]
1571bf523fa054f3d6bf83dba43a224fea173a73
https://github.com/eonpatapon/contrail-api-cli/blob/1571bf523fa054f3d6bf83dba43a224fea173a73/contrail_api_cli/client.py#L246-L258
train
Add a key - value store entry.