repository_name
stringlengths
5
67
func_path_in_repository
stringlengths
4
234
func_name
stringlengths
0
314
whole_func_string
stringlengths
52
3.87M
language
stringclasses
6 values
func_code_string
stringlengths
52
3.87M
func_documentation_string
stringlengths
1
47.2k
func_code_url
stringlengths
85
339
materialsproject/pymatgen-db
matgendb/builders/core.py
merge_tasks
def merge_tasks(core_collections, sandbox_collections, id_prefix, new_tasks, batch_size=100, wipe=False): """Merge core and sandbox collections into a temporary collection in the sandbox. :param core_collections: Core collection info :type core_collections: Collections :param sandbox_collections: Sandb...
python
def merge_tasks(core_collections, sandbox_collections, id_prefix, new_tasks, batch_size=100, wipe=False): """Merge core and sandbox collections into a temporary collection in the sandbox. :param core_collections: Core collection info :type core_collections: Collections :param sandbox_collections: Sandb...
Merge core and sandbox collections into a temporary collection in the sandbox. :param core_collections: Core collection info :type core_collections: Collections :param sandbox_collections: Sandbox collection info :type sandbox_collections: Collections
https://github.com/materialsproject/pymatgen-db/blob/02e4351c2cea431407644f49193e8bf43ed39b9a/matgendb/builders/core.py#L153-L186
materialsproject/pymatgen-db
matgendb/builders/core.py
alphadump
def alphadump(d, indent=2, depth=0): """Dump a dict to a str, with keys in alphabetical order. """ sep = '\n' + ' ' * depth * indent return ''.join( ("{}: {}{}".format( k, alphadump(d[k], depth=depth+1) if isinstance(d[k], dict) else str(d[k]), ...
python
def alphadump(d, indent=2, depth=0): """Dump a dict to a str, with keys in alphabetical order. """ sep = '\n' + ' ' * depth * indent return ''.join( ("{}: {}{}".format( k, alphadump(d[k], depth=depth+1) if isinstance(d[k], dict) else str(d[k]), ...
Dump a dict to a str, with keys in alphabetical order.
https://github.com/materialsproject/pymatgen-db/blob/02e4351c2cea431407644f49193e8bf43ed39b9a/matgendb/builders/core.py#L521-L533
materialsproject/pymatgen-db
matgendb/builders/core.py
HasExamples.validate_examples
def validate_examples(self, fail_fn): """Check the examples against the schema. :param fail_fn: Pass failure messages to this function :type fail_fn: function(str) """ for collection, doc in self.examples(): _log.debug("validating example in collection {}".format(col...
python
def validate_examples(self, fail_fn): """Check the examples against the schema. :param fail_fn: Pass failure messages to this function :type fail_fn: function(str) """ for collection, doc in self.examples(): _log.debug("validating example in collection {}".format(col...
Check the examples against the schema. :param fail_fn: Pass failure messages to this function :type fail_fn: function(str)
https://github.com/materialsproject/pymatgen-db/blob/02e4351c2cea431407644f49193e8bf43ed39b9a/matgendb/builders/core.py#L212-L224
materialsproject/pymatgen-db
matgendb/builders/core.py
Builder.run
def run(self, user_kw=None, build_kw=None): """Run the builder. :param user_kw: keywords from user :type user_kw: dict :param build_kw: internal settings :type build_kw: dict :return: Number of items processed :rtype: int """ user_kw = {} if user_...
python
def run(self, user_kw=None, build_kw=None): """Run the builder. :param user_kw: keywords from user :type user_kw: dict :param build_kw: internal settings :type build_kw: dict :return: Number of items processed :rtype: int """ user_kw = {} if user_...
Run the builder. :param user_kw: keywords from user :type user_kw: dict :param build_kw: internal settings :type build_kw: dict :return: Number of items processed :rtype: int
https://github.com/materialsproject/pymatgen-db/blob/02e4351c2cea431407644f49193e8bf43ed39b9a/matgendb/builders/core.py#L351-L367
materialsproject/pymatgen-db
matgendb/builders/core.py
Builder.connect
def connect(self, config): """Connect to database with given configuration, which may be a dict or a path to a pymatgen-db configuration. """ if isinstance(config, str): conn = dbutil.get_database(config_file=config) elif isinstance(config, dict): conn = d...
python
def connect(self, config): """Connect to database with given configuration, which may be a dict or a path to a pymatgen-db configuration. """ if isinstance(config, str): conn = dbutil.get_database(config_file=config) elif isinstance(config, dict): conn = d...
Connect to database with given configuration, which may be a dict or a path to a pymatgen-db configuration.
https://github.com/materialsproject/pymatgen-db/blob/02e4351c2cea431407644f49193e8bf43ed39b9a/matgendb/builders/core.py#L369-L380
materialsproject/pymatgen-db
matgendb/builders/core.py
Builder._build
def _build(self, items, chunk_size=10000): """Build the output, in chunks. :return: Number of items processed :rtype: int """ _log.debug("_build, chunk_size={:d}".format(chunk_size)) n, i = 0, 0 for i, item in enumerate(items): if i == 0: ...
python
def _build(self, items, chunk_size=10000): """Build the output, in chunks. :return: Number of items processed :rtype: int """ _log.debug("_build, chunk_size={:d}".format(chunk_size)) n, i = 0, 0 for i, item in enumerate(items): if i == 0: ...
Build the output, in chunks. :return: Number of items processed :rtype: int
https://github.com/materialsproject/pymatgen-db/blob/02e4351c2cea431407644f49193e8bf43ed39b9a/matgendb/builders/core.py#L384-L411
materialsproject/pymatgen-db
matgendb/builders/core.py
Builder._run_parallel_multiprocess
def _run_parallel_multiprocess(self): """Run processes from queue """ _log.debug("run.parallel.multiprocess.start") processes = [] ProcRunner.instance = self for i in range(self._ncores): self._status.running(i) proc = multiprocessing.Process(targe...
python
def _run_parallel_multiprocess(self): """Run processes from queue """ _log.debug("run.parallel.multiprocess.start") processes = [] ProcRunner.instance = self for i in range(self._ncores): self._status.running(i) proc = multiprocessing.Process(targe...
Run processes from queue
https://github.com/materialsproject/pymatgen-db/blob/02e4351c2cea431407644f49193e8bf43ed39b9a/matgendb/builders/core.py#L413-L428
materialsproject/pymatgen-db
matgendb/builders/core.py
Builder._run
def _run(self, index): """Run method for one thread or process Just pull an item off the queue and process it, until the queue is empty. :param index: Sequential index of this process or thread :type index: int """ while 1: try: item =...
python
def _run(self, index): """Run method for one thread or process Just pull an item off the queue and process it, until the queue is empty. :param index: Sequential index of this process or thread :type index: int """ while 1: try: item =...
Run method for one thread or process Just pull an item off the queue and process it, until the queue is empty. :param index: Sequential index of this process or thread :type index: int
https://github.com/materialsproject/pymatgen-db/blob/02e4351c2cea431407644f49193e8bf43ed39b9a/matgendb/builders/core.py#L430-L450
materialsproject/pymatgen-db
matgendb/util.py
collection_keys
def collection_keys(coll, sep='.'): """Get a list of all (including nested) keys in a collection. Examines the first document in the collection. :param sep: Separator for nested keys :return: List of str """ def _keys(x, pre=''): for k in x: yield (pre + k) if is...
python
def collection_keys(coll, sep='.'): """Get a list of all (including nested) keys in a collection. Examines the first document in the collection. :param sep: Separator for nested keys :return: List of str """ def _keys(x, pre=''): for k in x: yield (pre + k) if is...
Get a list of all (including nested) keys in a collection. Examines the first document in the collection. :param sep: Separator for nested keys :return: List of str
https://github.com/materialsproject/pymatgen-db/blob/02e4351c2cea431407644f49193e8bf43ed39b9a/matgendb/util.py#L72-L86
materialsproject/pymatgen-db
matgendb/util.py
csv_dict
def csv_dict(d): """Format dict to a string with comma-separated values. """ if len(d) == 0: return "{}" return "{" + ', '.join(["'{}': {}".format(k, quotable(v)) for k, v in d.items()]) + "}"
python
def csv_dict(d): """Format dict to a string with comma-separated values. """ if len(d) == 0: return "{}" return "{" + ', '.join(["'{}': {}".format(k, quotable(v)) for k, v in d.items()]) + "}"
Format dict to a string with comma-separated values.
https://github.com/materialsproject/pymatgen-db/blob/02e4351c2cea431407644f49193e8bf43ed39b9a/matgendb/util.py#L102-L108
materialsproject/pymatgen-db
matgendb/util.py
kvp_dict
def kvp_dict(d): """Format dict to key=value pairs. """ return ', '.join( ["{}={}".format(k, quotable(v)) for k, v in d.items()])
python
def kvp_dict(d): """Format dict to key=value pairs. """ return ', '.join( ["{}={}".format(k, quotable(v)) for k, v in d.items()])
Format dict to key=value pairs.
https://github.com/materialsproject/pymatgen-db/blob/02e4351c2cea431407644f49193e8bf43ed39b9a/matgendb/util.py#L110-L114
materialsproject/pymatgen-db
matgendb/builders/examples/maxvalue_builder.py
MaxValueBuilder.get_items
def get_items(self, source=None, target=None): """Get all records from source collection to add to target. :param source: Input collection :type source: QueryEngine :param target: Output collection :type target: QueryEngine """ self._groups = self.shared_dict() ...
python
def get_items(self, source=None, target=None): """Get all records from source collection to add to target. :param source: Input collection :type source: QueryEngine :param target: Output collection :type target: QueryEngine """ self._groups = self.shared_dict() ...
Get all records from source collection to add to target. :param source: Input collection :type source: QueryEngine :param target: Output collection :type target: QueryEngine
https://github.com/materialsproject/pymatgen-db/blob/02e4351c2cea431407644f49193e8bf43ed39b9a/matgendb/builders/examples/maxvalue_builder.py#L19-L30
materialsproject/pymatgen-db
matgendb/builders/examples/maxvalue_builder.py
MaxValueBuilder.process_item
def process_item(self, item): """Calculate new maximum value for each group, for "new" items only. """ group, value = item['group'], item['value'] if group in self._groups: cur_val = self._groups[group] self._groups[group] = max(cur_val, value) els...
python
def process_item(self, item): """Calculate new maximum value for each group, for "new" items only. """ group, value = item['group'], item['value'] if group in self._groups: cur_val = self._groups[group] self._groups[group] = max(cur_val, value) els...
Calculate new maximum value for each group, for "new" items only.
https://github.com/materialsproject/pymatgen-db/blob/02e4351c2cea431407644f49193e8bf43ed39b9a/matgendb/builders/examples/maxvalue_builder.py#L32-L51
materialsproject/pymatgen-db
matgendb/builders/examples/maxvalue_builder.py
MaxValueBuilder.finalize
def finalize(self, errs): """Update target collection with calculated maximum values. """ for group, value in self._groups.items(): doc = {'group': group, 'value': value} self._target_coll.update({'group': group}, doc, upsert=True) return True
python
def finalize(self, errs): """Update target collection with calculated maximum values. """ for group, value in self._groups.items(): doc = {'group': group, 'value': value} self._target_coll.update({'group': group}, doc, upsert=True) return True
Update target collection with calculated maximum values.
https://github.com/materialsproject/pymatgen-db/blob/02e4351c2cea431407644f49193e8bf43ed39b9a/matgendb/builders/examples/maxvalue_builder.py#L53-L59
materialsproject/pymatgen-db
matgendb/vv/validate.py
mongo_get
def mongo_get(rec, key, default=None): """ Get value from dict using MongoDB dot-separated path semantics. For example: >>> assert mongo_get({'a': {'b': 1}, 'x': 2}, 'a.b') == 1 >>> assert mongo_get({'a': {'b': 1}, 'x': 2}, 'x') == 2 >>> assert mongo_get({'a': {'b': 1}, 'x': 2}, 'a.b.c') is Non...
python
def mongo_get(rec, key, default=None): """ Get value from dict using MongoDB dot-separated path semantics. For example: >>> assert mongo_get({'a': {'b': 1}, 'x': 2}, 'a.b') == 1 >>> assert mongo_get({'a': {'b': 1}, 'x': 2}, 'x') == 2 >>> assert mongo_get({'a': {'b': 1}, 'x': 2}, 'a.b.c') is Non...
Get value from dict using MongoDB dot-separated path semantics. For example: >>> assert mongo_get({'a': {'b': 1}, 'x': 2}, 'a.b') == 1 >>> assert mongo_get({'a': {'b': 1}, 'x': 2}, 'x') == 2 >>> assert mongo_get({'a': {'b': 1}, 'x': 2}, 'a.b.c') is None :param rec: mongodb document :param key:...
https://github.com/materialsproject/pymatgen-db/blob/02e4351c2cea431407644f49193e8bf43ed39b9a/matgendb/vv/validate.py#L63-L90
materialsproject/pymatgen-db
matgendb/vv/validate.py
Projection.add
def add(self, field, op=None, val=None): """Update report fields to include new one, if it doesn't already. :param field: The field to include :type field: Field :param op: Operation :type op: ConstraintOperator :return: None """ if field.has_subfield(): ...
python
def add(self, field, op=None, val=None): """Update report fields to include new one, if it doesn't already. :param field: The field to include :type field: Field :param op: Operation :type op: ConstraintOperator :return: None """ if field.has_subfield(): ...
Update report fields to include new one, if it doesn't already. :param field: The field to include :type field: Field :param op: Operation :type op: ConstraintOperator :return: None
https://github.com/materialsproject/pymatgen-db/blob/02e4351c2cea431407644f49193e8bf43ed39b9a/matgendb/vv/validate.py#L101-L120
materialsproject/pymatgen-db
matgendb/vv/validate.py
Projection.to_mongo
def to_mongo(self): """Translate projection to MongoDB query form. :return: Dictionary to put into a MongoDB JSON query :rtype: dict """ d = copy.copy(self._fields) for k, v in self._slices.items(): d[k] = {'$slice': v} return d
python
def to_mongo(self): """Translate projection to MongoDB query form. :return: Dictionary to put into a MongoDB JSON query :rtype: dict """ d = copy.copy(self._fields) for k, v in self._slices.items(): d[k] = {'$slice': v} return d
Translate projection to MongoDB query form. :return: Dictionary to put into a MongoDB JSON query :rtype: dict
https://github.com/materialsproject/pymatgen-db/blob/02e4351c2cea431407644f49193e8bf43ed39b9a/matgendb/vv/validate.py#L122-L131
materialsproject/pymatgen-db
matgendb/vv/validate.py
ConstraintViolationGroup.add_violations
def add_violations(self, violations, record=None): """Add constraint violations and associated record. :param violations: List of violations :type violations: list(ConstraintViolation) :param record: Associated record :type record: dict :rtype: None """ r...
python
def add_violations(self, violations, record=None): """Add constraint violations and associated record. :param violations: List of violations :type violations: list(ConstraintViolation) :param record: Associated record :type record: dict :rtype: None """ r...
Add constraint violations and associated record. :param violations: List of violations :type violations: list(ConstraintViolation) :param record: Associated record :type record: dict :rtype: None
https://github.com/materialsproject/pymatgen-db/blob/02e4351c2cea431407644f49193e8bf43ed39b9a/matgendb/vv/validate.py#L187-L198
materialsproject/pymatgen-db
matgendb/vv/validate.py
ConstraintSpec._add_complex_section
def _add_complex_section(self, item): """Add a section that has a filter and set of constraints :raise: ValueError if filter or constraints is missing """ # extract filter and constraints try: fltr = item[self.FILTER_SECT] except KeyError: raise V...
python
def _add_complex_section(self, item): """Add a section that has a filter and set of constraints :raise: ValueError if filter or constraints is missing """ # extract filter and constraints try: fltr = item[self.FILTER_SECT] except KeyError: raise V...
Add a section that has a filter and set of constraints :raise: ValueError if filter or constraints is missing
https://github.com/materialsproject/pymatgen-db/blob/02e4351c2cea431407644f49193e8bf43ed39b9a/matgendb/vv/validate.py#L270-L288
materialsproject/pymatgen-db
matgendb/vv/validate.py
Validator.validate
def validate(self, coll, constraint_spec, subject='collection'): """Validation of a collection. This is a generator that yields ConstraintViolationGroups. :param coll: Mongo collection :type coll: pymongo.Collection :param constraint_spec: Constraint specification :type...
python
def validate(self, coll, constraint_spec, subject='collection'): """Validation of a collection. This is a generator that yields ConstraintViolationGroups. :param coll: Mongo collection :type coll: pymongo.Collection :param constraint_spec: Constraint specification :type...
Validation of a collection. This is a generator that yields ConstraintViolationGroups. :param coll: Mongo collection :type coll: pymongo.Collection :param constraint_spec: Constraint specification :type constraint_spec: ConstraintSpec :param subject: Name of the thing b...
https://github.com/materialsproject/pymatgen-db/blob/02e4351c2cea431407644f49193e8bf43ed39b9a/matgendb/vv/validate.py#L380-L400
materialsproject/pymatgen-db
matgendb/vv/validate.py
Validator._validate_section
def _validate_section(self, subject, coll, parts): """Validate one section of a spec. :param subject: Name of subject :type subject: str :param coll: The collection to validate :type coll: pymongo.Collection :param parts: Section parts :type parts: Validator.Sect...
python
def _validate_section(self, subject, coll, parts): """Validate one section of a spec. :param subject: Name of subject :type subject: str :param coll: The collection to validate :type coll: pymongo.Collection :param parts: Section parts :type parts: Validator.Sect...
Validate one section of a spec. :param subject: Name of subject :type subject: str :param coll: The collection to validate :type coll: pymongo.Collection :param parts: Section parts :type parts: Validator.SectionParts :return: Group of constraint violations, if a...
https://github.com/materialsproject/pymatgen-db/blob/02e4351c2cea431407644f49193e8bf43ed39b9a/matgendb/vv/validate.py#L402-L454
materialsproject/pymatgen-db
matgendb/vv/validate.py
Validator._get_violations
def _get_violations(self, query, record): """Reverse-engineer the query to figure out why a record was selected. :param query: MongoDB query :type query: MongQuery :param record: Record in question :type record: dict :return: Reasons why bad :rtype: list(Constrai...
python
def _get_violations(self, query, record): """Reverse-engineer the query to figure out why a record was selected. :param query: MongoDB query :type query: MongQuery :param record: Record in question :type record: dict :return: Reasons why bad :rtype: list(Constrai...
Reverse-engineer the query to figure out why a record was selected. :param query: MongoDB query :type query: MongQuery :param record: Record in question :type record: dict :return: Reasons why bad :rtype: list(ConstraintViolation)
https://github.com/materialsproject/pymatgen-db/blob/02e4351c2cea431407644f49193e8bf43ed39b9a/matgendb/vv/validate.py#L456-L501
materialsproject/pymatgen-db
matgendb/vv/validate.py
Validator._build
def _build(self, constraint_spec): """Generate queries to execute. Sets instance variables so that Mongo query strings, etc. can now be extracted from the object. :param constraint_spec: Constraint specification :type constraint_spec: ConstraintSpec """ self._se...
python
def _build(self, constraint_spec): """Generate queries to execute. Sets instance variables so that Mongo query strings, etc. can now be extracted from the object. :param constraint_spec: Constraint specification :type constraint_spec: ConstraintSpec """ self._se...
Generate queries to execute. Sets instance variables so that Mongo query strings, etc. can now be extracted from the object. :param constraint_spec: Constraint specification :type constraint_spec: ConstraintSpec
https://github.com/materialsproject/pymatgen-db/blob/02e4351c2cea431407644f49193e8bf43ed39b9a/matgendb/vv/validate.py#L503-L555
materialsproject/pymatgen-db
matgendb/vv/validate.py
Validator._process_constraint_expressions
def _process_constraint_expressions(self, expr_list, conflict_check=True, rev=True): """Create and return constraints from expressions in expr_list. :param expr_list: The expressions :conflict_check: If True, check for conflicting expressions within each field :return: Constraints group...
python
def _process_constraint_expressions(self, expr_list, conflict_check=True, rev=True): """Create and return constraints from expressions in expr_list. :param expr_list: The expressions :conflict_check: If True, check for conflicting expressions within each field :return: Constraints group...
Create and return constraints from expressions in expr_list. :param expr_list: The expressions :conflict_check: If True, check for conflicting expressions within each field :return: Constraints grouped by field (the key is the field name) :rtype: dict
https://github.com/materialsproject/pymatgen-db/blob/02e4351c2cea431407644f49193e8bf43ed39b9a/matgendb/vv/validate.py#L557-L585
materialsproject/pymatgen-db
matgendb/vv/validate.py
Validator._is_python
def _is_python(self, constraint_list): """Check whether constraint is an import of Python code. :param constraint_list: List of raw constraints from YAML file :type constraint_list: list(str) :return: True if this refers to an import of code, False otherwise :raises: ValidatorSy...
python
def _is_python(self, constraint_list): """Check whether constraint is an import of Python code. :param constraint_list: List of raw constraints from YAML file :type constraint_list: list(str) :return: True if this refers to an import of code, False otherwise :raises: ValidatorSy...
Check whether constraint is an import of Python code. :param constraint_list: List of raw constraints from YAML file :type constraint_list: list(str) :return: True if this refers to an import of code, False otherwise :raises: ValidatorSyntaxError
https://github.com/materialsproject/pymatgen-db/blob/02e4351c2cea431407644f49193e8bf43ed39b9a/matgendb/vv/validate.py#L587-L603
materialsproject/pymatgen-db
matgendb/vv/validate.py
Validator.set_aliases
def set_aliases(self, new_value): "Set aliases and wrap errors in ValueError" try: self.aliases = new_value except Exception as err: raise ValueError("invalid value: {}".format(err))
python
def set_aliases(self, new_value): "Set aliases and wrap errors in ValueError" try: self.aliases = new_value except Exception as err: raise ValueError("invalid value: {}".format(err))
Set aliases and wrap errors in ValueError
https://github.com/materialsproject/pymatgen-db/blob/02e4351c2cea431407644f49193e8bf43ed39b9a/matgendb/vv/validate.py#L614-L619
materialsproject/pymatgen-db
matgendb/vv/validate.py
Sampler.sample
def sample(self, cursor): """Extract records randomly from the database. Continue until the target proportion of the items have been extracted, or until `min_items` if this is larger. If `max_items` is non-negative, do not extract more than these. This function is a generator, y...
python
def sample(self, cursor): """Extract records randomly from the database. Continue until the target proportion of the items have been extracted, or until `min_items` if this is larger. If `max_items` is non-negative, do not extract more than these. This function is a generator, y...
Extract records randomly from the database. Continue until the target proportion of the items have been extracted, or until `min_items` if this is larger. If `max_items` is non-negative, do not extract more than these. This function is a generator, yielding items incrementally. ...
https://github.com/materialsproject/pymatgen-db/blob/02e4351c2cea431407644f49193e8bf43ed39b9a/matgendb/vv/validate.py#L669-L723
indico/indico-plugins
livesync/indico_livesync/cli.py
available_backends
def available_backends(): """Lists the currently available backend types""" print 'The following LiveSync agents are available:' for name, backend in current_plugin.backend_classes.iteritems(): print cformat(' - %{white!}{}%{reset}: {} ({})').format(name, backend.title, backend.description)
python
def available_backends(): """Lists the currently available backend types""" print 'The following LiveSync agents are available:' for name, backend in current_plugin.backend_classes.iteritems(): print cformat(' - %{white!}{}%{reset}: {} ({})').format(name, backend.title, backend.description)
Lists the currently available backend types
https://github.com/indico/indico-plugins/blob/fe50085cc63be9b8161b09539e662e7b04e4b38e/livesync/indico_livesync/cli.py#L37-L41
indico/indico-plugins
livesync/indico_livesync/cli.py
agents
def agents(): """Lists the currently active agents""" print 'The following LiveSync agents are active:' agent_list = LiveSyncAgent.find().order_by(LiveSyncAgent.backend_name, db.func.lower(LiveSyncAgent.name)).all() table_data = [['ID', 'Name', 'Backend', 'Initial Export', 'Queue']] for agent in age...
python
def agents(): """Lists the currently active agents""" print 'The following LiveSync agents are active:' agent_list = LiveSyncAgent.find().order_by(LiveSyncAgent.backend_name, db.func.lower(LiveSyncAgent.name)).all() table_data = [['ID', 'Name', 'Backend', 'Initial Export', 'Queue']] for agent in age...
Lists the currently active agents
https://github.com/indico/indico-plugins/blob/fe50085cc63be9b8161b09539e662e7b04e4b38e/livesync/indico_livesync/cli.py#L45-L66
indico/indico-plugins
livesync/indico_livesync/cli.py
initial_export
def initial_export(agent_id, force): """Performs the initial data export for an agent""" agent = LiveSyncAgent.find_first(id=agent_id) if agent is None: print 'No such agent' return if agent.backend is None: print cformat('Cannot run agent %{red!}{}%{reset} (backend not found)')....
python
def initial_export(agent_id, force): """Performs the initial data export for an agent""" agent = LiveSyncAgent.find_first(id=agent_id) if agent is None: print 'No such agent' return if agent.backend is None: print cformat('Cannot run agent %{red!}{}%{reset} (backend not found)')....
Performs the initial data export for an agent
https://github.com/indico/indico-plugins/blob/fe50085cc63be9b8161b09539e662e7b04e4b38e/livesync/indico_livesync/cli.py#L72-L89
indico/indico-plugins
livesync/indico_livesync/cli.py
run
def run(agent_id, force=False): """Runs the livesync agent""" if agent_id is None: agent_list = LiveSyncAgent.find_all() else: agent = LiveSyncAgent.find_first(id=agent_id) if agent is None: print 'No such agent' return agent_list = [agent] for ag...
python
def run(agent_id, force=False): """Runs the livesync agent""" if agent_id is None: agent_list = LiveSyncAgent.find_all() else: agent = LiveSyncAgent.find_first(id=agent_id) if agent is None: print 'No such agent' return agent_list = [agent] for ag...
Runs the livesync agent
https://github.com/indico/indico-plugins/blob/fe50085cc63be9b8161b09539e662e7b04e4b38e/livesync/indico_livesync/cli.py#L95-L119
sbg/sevenbridges-python
sevenbridges/models/task.py
Task.query
def query(cls, project=None, status=None, batch=None, parent=None, created_from=None, created_to=None, started_from=None, started_to=None, ended_from=None, ended_to=None, offset=None, limit=None, order_by=None, order=None, api=None): """ Query (Lis...
python
def query(cls, project=None, status=None, batch=None, parent=None, created_from=None, created_to=None, started_from=None, started_to=None, ended_from=None, ended_to=None, offset=None, limit=None, order_by=None, order=None, api=None): """ Query (Lis...
Query (List) tasks. Date parameters may be both strings and python date objects. :param project: Target project. optional. :param status: Task status. :param batch: Only batch tasks. :param parent: Parent batch task identifier. :param ended_to: All tasks that ended until ...
https://github.com/sbg/sevenbridges-python/blob/f62640d1018d959f0b686f2dbe5e183085336607/sevenbridges/models/task.py#L91-L140
sbg/sevenbridges-python
sevenbridges/models/task.py
Task.create
def create(cls, name, project, app, revision=None, batch_input=None, batch_by=None, inputs=None, description=None, run=False, disable_batch=False, interruptible=None, execution_settings=None, api=None): """ Creates a task on server. :param name: Task...
python
def create(cls, name, project, app, revision=None, batch_input=None, batch_by=None, inputs=None, description=None, run=False, disable_batch=False, interruptible=None, execution_settings=None, api=None): """ Creates a task on server. :param name: Task...
Creates a task on server. :param name: Task name. :param project: Project identifier. :param app: CWL app identifier. :param revision: CWL app revision. :param batch_input: Batch input. :param batch_by: Batch criteria. :param inputs: Input map. :param desc...
https://github.com/sbg/sevenbridges-python/blob/f62640d1018d959f0b686f2dbe5e183085336607/sevenbridges/models/task.py#L143-L217
sbg/sevenbridges-python
sevenbridges/models/task.py
Task.abort
def abort(self, inplace=True): """ Abort task :param inplace Apply action on the current object or return a new one. :return: Task object. """ extra = { 'resource': self.__class__.__name__, 'query': {'id': self.id} } logger.info('Ab...
python
def abort(self, inplace=True): """ Abort task :param inplace Apply action on the current object or return a new one. :return: Task object. """ extra = { 'resource': self.__class__.__name__, 'query': {'id': self.id} } logger.info('Ab...
Abort task :param inplace Apply action on the current object or return a new one. :return: Task object.
https://github.com/sbg/sevenbridges-python/blob/f62640d1018d959f0b686f2dbe5e183085336607/sevenbridges/models/task.py#L220-L233
sbg/sevenbridges-python
sevenbridges/models/task.py
Task.run
def run(self, batch=True, interruptible=None, inplace=True): """ Run task :param batch if False batching will be disabled. :param interruptible: If true interruptible instance will be used. :param inplace Apply action on the current object or return a new one. :re...
python
def run(self, batch=True, interruptible=None, inplace=True): """ Run task :param batch if False batching will be disabled. :param interruptible: If true interruptible instance will be used. :param inplace Apply action on the current object or return a new one. :re...
Run task :param batch if False batching will be disabled. :param interruptible: If true interruptible instance will be used. :param inplace Apply action on the current object or return a new one. :return: Task object.
https://github.com/sbg/sevenbridges-python/blob/f62640d1018d959f0b686f2dbe5e183085336607/sevenbridges/models/task.py#L236-L257
sbg/sevenbridges-python
sevenbridges/models/task.py
Task.clone
def clone(self, run=True): """ Clone task :param run: run task after cloning :return: Task object. """ params = {} if run: params.update({'action': 'run'}) extra = { 'resource': self.__class__.__name__, 'query': {'id': ...
python
def clone(self, run=True): """ Clone task :param run: run task after cloning :return: Task object. """ params = {} if run: params.update({'action': 'run'}) extra = { 'resource': self.__class__.__name__, 'query': {'id': ...
Clone task :param run: run task after cloning :return: Task object.
https://github.com/sbg/sevenbridges-python/blob/f62640d1018d959f0b686f2dbe5e183085336607/sevenbridges/models/task.py#L259-L277
sbg/sevenbridges-python
sevenbridges/models/task.py
Task.save
def save(self, inplace=True): """ Saves all modification to the task on the server. :param inplace Apply edits on the current instance or get a new one. :return: Task instance. """ modified_data = self._modified_data() if bool(modified_data): task_requ...
python
def save(self, inplace=True): """ Saves all modification to the task on the server. :param inplace Apply edits on the current instance or get a new one. :return: Task instance. """ modified_data = self._modified_data() if bool(modified_data): task_requ...
Saves all modification to the task on the server. :param inplace Apply edits on the current instance or get a new one. :return: Task instance.
https://github.com/sbg/sevenbridges-python/blob/f62640d1018d959f0b686f2dbe5e183085336607/sevenbridges/models/task.py#L280-L309
sbg/sevenbridges-python
sevenbridges/models/task.py
Task._serialize_inputs
def _serialize_inputs(inputs): """Serialize task input dictionary""" serialized_inputs = {} for input_id, input_value in inputs.items(): if isinstance(input_value, list): serialized_list = Task._serialize_input_list(input_value) serialized_inputs[input...
python
def _serialize_inputs(inputs): """Serialize task input dictionary""" serialized_inputs = {} for input_id, input_value in inputs.items(): if isinstance(input_value, list): serialized_list = Task._serialize_input_list(input_value) serialized_inputs[input...
Serialize task input dictionary
https://github.com/sbg/sevenbridges-python/blob/f62640d1018d959f0b686f2dbe5e183085336607/sevenbridges/models/task.py#L334-L345
sbg/sevenbridges-python
sevenbridges/models/task.py
Task._serialize_input_list
def _serialize_input_list(input_value): """Recursively serialize task input list""" input_list = [] for item in input_value: if isinstance(item, list): input_list.append(Task._serialize_input_list(item)) else: if isinstance(item, File): ...
python
def _serialize_input_list(input_value): """Recursively serialize task input list""" input_list = [] for item in input_value: if isinstance(item, list): input_list.append(Task._serialize_input_list(item)) else: if isinstance(item, File): ...
Recursively serialize task input list
https://github.com/sbg/sevenbridges-python/blob/f62640d1018d959f0b686f2dbe5e183085336607/sevenbridges/models/task.py#L348-L358
sbg/sevenbridges-python
sevenbridges/models/task.py
Task.get_execution_details
def get_execution_details(self): """ Retrieves execution details for a task. :return: Execution details instance. """ extra = { 'resource': self.__class__.__name__, 'query': {'id': self.id} } logger.info('Get execution details', extra=extra...
python
def get_execution_details(self): """ Retrieves execution details for a task. :return: Execution details instance. """ extra = { 'resource': self.__class__.__name__, 'query': {'id': self.id} } logger.info('Get execution details', extra=extra...
Retrieves execution details for a task. :return: Execution details instance.
https://github.com/sbg/sevenbridges-python/blob/f62640d1018d959f0b686f2dbe5e183085336607/sevenbridges/models/task.py#L367-L379
sbg/sevenbridges-python
sevenbridges/models/task.py
Task.get_batch_children
def get_batch_children(self): """ Retrieves batch child tasks for this task if its a batch task. :return: Collection instance. :raises SbError if task is not a batch task. """ if not self.batch: raise SbgError("This task is not a batch task.") return s...
python
def get_batch_children(self): """ Retrieves batch child tasks for this task if its a batch task. :return: Collection instance. :raises SbError if task is not a batch task. """ if not self.batch: raise SbgError("This task is not a batch task.") return s...
Retrieves batch child tasks for this task if its a batch task. :return: Collection instance. :raises SbError if task is not a batch task.
https://github.com/sbg/sevenbridges-python/blob/f62640d1018d959f0b686f2dbe5e183085336607/sevenbridges/models/task.py#L381-L389
sbg/sevenbridges-python
sevenbridges/models/task.py
Task.bulk_get
def bulk_get(cls, tasks, api=None): """ Retrieve tasks with specified ids in bulk :param tasks: Tasks to be retrieved. :param api: Api instance. :return: List of TaskBulkRecord objects. """ api = api or cls._API task_ids = [Transform.to_task(task) for task...
python
def bulk_get(cls, tasks, api=None): """ Retrieve tasks with specified ids in bulk :param tasks: Tasks to be retrieved. :param api: Api instance. :return: List of TaskBulkRecord objects. """ api = api or cls._API task_ids = [Transform.to_task(task) for task...
Retrieve tasks with specified ids in bulk :param tasks: Tasks to be retrieved. :param api: Api instance. :return: List of TaskBulkRecord objects.
https://github.com/sbg/sevenbridges-python/blob/f62640d1018d959f0b686f2dbe5e183085336607/sevenbridges/models/task.py#L392-L405
sbg/sevenbridges-python
sevenbridges/models/task.py
Task.wait
def wait(self=None, period=10, callback=None, *args, **kwargs): """Wait until task is complete :param period: Time in seconds between reloads :param callback: Function to call after the task has finished, arguments and keyword arguments can be provided for it :return: Return ...
python
def wait(self=None, period=10, callback=None, *args, **kwargs): """Wait until task is complete :param period: Time in seconds between reloads :param callback: Function to call after the task has finished, arguments and keyword arguments can be provided for it :return: Return ...
Wait until task is complete :param period: Time in seconds between reloads :param callback: Function to call after the task has finished, arguments and keyword arguments can be provided for it :return: Return value of provided callback function or None if a callback funct...
https://github.com/sbg/sevenbridges-python/blob/f62640d1018d959f0b686f2dbe5e183085336607/sevenbridges/models/task.py#L407-L424
indico/indico-plugins
piwik/indico_piwik/queries/graphs.py
PiwikQueryReportEventGraphBase.get_result
def get_result(self): """Perform the call and return the graph data :return: Encoded PNG graph data string to be inserted in a `src` atribute of a HTML img tag. """ png = self.call() if png is None: return if png.startswith('GD extension must...
python
def get_result(self): """Perform the call and return the graph data :return: Encoded PNG graph data string to be inserted in a `src` atribute of a HTML img tag. """ png = self.call() if png is None: return if png.startswith('GD extension must...
Perform the call and return the graph data :return: Encoded PNG graph data string to be inserted in a `src` atribute of a HTML img tag.
https://github.com/indico/indico-plugins/blob/fe50085cc63be9b8161b09539e662e7b04e4b38e/piwik/indico_piwik/queries/graphs.py#L36-L48
sbg/sevenbridges-python
sevenbridges/models/app.py
App.query
def query(cls, project=None, visibility=None, q=None, id=None, offset=None, limit=None, api=None): """ Query (List) apps. :param project: Source project. :param visibility: private|public for private or public apps. :param q: List containing search terms. :p...
python
def query(cls, project=None, visibility=None, q=None, id=None, offset=None, limit=None, api=None): """ Query (List) apps. :param project: Source project. :param visibility: private|public for private or public apps. :param q: List containing search terms. :p...
Query (List) apps. :param project: Source project. :param visibility: private|public for private or public apps. :param q: List containing search terms. :param id: List contains app ids. Fetch apps with specific ids. :param offset: Pagination offset. :param limit: Paginat...
https://github.com/sbg/sevenbridges-python/blob/f62640d1018d959f0b686f2dbe5e183085336607/sevenbridges/models/app.py#L70-L88
sbg/sevenbridges-python
sevenbridges/models/app.py
App.get_revision
def get_revision(cls, id, revision, api=None): """ Get app revision. :param id: App identifier. :param revision: App revision :param api: Api instance. :return: App object. """ api = api if api else cls._API extra = {'resource': cls.__name__, 'quer...
python
def get_revision(cls, id, revision, api=None): """ Get app revision. :param id: App identifier. :param revision: App revision :param api: Api instance. :return: App object. """ api = api if api else cls._API extra = {'resource': cls.__name__, 'quer...
Get app revision. :param id: App identifier. :param revision: App revision :param api: Api instance. :return: App object.
https://github.com/sbg/sevenbridges-python/blob/f62640d1018d959f0b686f2dbe5e183085336607/sevenbridges/models/app.py#L91-L107
sbg/sevenbridges-python
sevenbridges/models/app.py
App.install_app
def install_app(cls, id, raw, api=None, raw_format=None): """ Installs and app. :param id: App identifier. :param raw: Raw cwl data. :param api: Api instance. :param raw_format: Format of raw app data being sent, json by default :return: App object. """ ...
python
def install_app(cls, id, raw, api=None, raw_format=None): """ Installs and app. :param id: App identifier. :param raw: Raw cwl data. :param api: Api instance. :param raw_format: Format of raw app data being sent, json by default :return: App object. """ ...
Installs and app. :param id: App identifier. :param raw: Raw cwl data. :param api: Api instance. :param raw_format: Format of raw app data being sent, json by default :return: App object.
https://github.com/sbg/sevenbridges-python/blob/f62640d1018d959f0b686f2dbe5e183085336607/sevenbridges/models/app.py#L110-L144
sbg/sevenbridges-python
sevenbridges/models/app.py
App.create_revision
def create_revision(cls, id, revision, raw, api=None): """ Create a new app revision. :param id: App identifier. :param revision: App revision. :param raw: Raw cwl object. :param api: Api instance. :return: App object. """ api = api if api else c...
python
def create_revision(cls, id, revision, raw, api=None): """ Create a new app revision. :param id: App identifier. :param revision: App revision. :param raw: Raw cwl object. :param api: Api instance. :return: App object. """ api = api if api else c...
Create a new app revision. :param id: App identifier. :param revision: App revision. :param raw: Raw cwl object. :param api: Api instance. :return: App object.
https://github.com/sbg/sevenbridges-python/blob/f62640d1018d959f0b686f2dbe5e183085336607/sevenbridges/models/app.py#L147-L167
sbg/sevenbridges-python
sevenbridges/models/app.py
App.copy
def copy(self, project, name=None, strategy=None): """ Copies the current app. :param project: Destination project. :param name: Destination app name. :param strategy: App copy strategy. :return: Copied App object. :Copy strategies: clone copy all...
python
def copy(self, project, name=None, strategy=None): """ Copies the current app. :param project: Destination project. :param name: Destination app name. :param strategy: App copy strategy. :return: Copied App object. :Copy strategies: clone copy all...
Copies the current app. :param project: Destination project. :param name: Destination app name. :param strategy: App copy strategy. :return: Copied App object. :Copy strategies: clone copy all revisions and continue getting updates form the ...
https://github.com/sbg/sevenbridges-python/blob/f62640d1018d959f0b686f2dbe5e183085336607/sevenbridges/models/app.py#L169-L206
sbg/sevenbridges-python
sevenbridges/models/app.py
App.sync
def sync(self): """ Syncs the parent app changes with the current app instance. :return: Synced App object. """ app = self._api.post(url=self._URL['sync'].format(id=self.id)).json() return App(api=self._api, **app)
python
def sync(self): """ Syncs the parent app changes with the current app instance. :return: Synced App object. """ app = self._api.post(url=self._URL['sync'].format(id=self.id)).json() return App(api=self._api, **app)
Syncs the parent app changes with the current app instance. :return: Synced App object.
https://github.com/sbg/sevenbridges-python/blob/f62640d1018d959f0b686f2dbe5e183085336607/sevenbridges/models/app.py#L208-L214
indico/indico-plugins
chat/indico_chat/models/chatrooms.py
Chatroom.server
def server(self): """The server name of the chatroom. Usually the default one unless a custom one is set. """ from indico_chat.plugin import ChatPlugin return self.custom_server or ChatPlugin.settings.get('muc_server')
python
def server(self): """The server name of the chatroom. Usually the default one unless a custom one is set. """ from indico_chat.plugin import ChatPlugin return self.custom_server or ChatPlugin.settings.get('muc_server')
The server name of the chatroom. Usually the default one unless a custom one is set.
https://github.com/indico/indico-plugins/blob/fe50085cc63be9b8161b09539e662e7b04e4b38e/chat/indico_chat/models/chatrooms.py#L97-L104
indico/indico-plugins
chat/indico_chat/models/chatrooms.py
ChatroomEventAssociation.find_for_event
def find_for_event(cls, event, include_hidden=False, **kwargs): """Returns a Query that retrieves the chatrooms for an event :param event: an indico event (with a numeric ID) :param include_hidden: if hidden chatrooms should be included, too :param kwargs: extra kwargs to pass to ``find...
python
def find_for_event(cls, event, include_hidden=False, **kwargs): """Returns a Query that retrieves the chatrooms for an event :param event: an indico event (with a numeric ID) :param include_hidden: if hidden chatrooms should be included, too :param kwargs: extra kwargs to pass to ``find...
Returns a Query that retrieves the chatrooms for an event :param event: an indico event (with a numeric ID) :param include_hidden: if hidden chatrooms should be included, too :param kwargs: extra kwargs to pass to ``find()``
https://github.com/indico/indico-plugins/blob/fe50085cc63be9b8161b09539e662e7b04e4b38e/chat/indico_chat/models/chatrooms.py#L175-L185
indico/indico-plugins
chat/indico_chat/models/chatrooms.py
ChatroomEventAssociation.delete
def delete(self, reason=''): """Deletes the event chatroom and if necessary the chatroom, too. :param reason: reason for the deletion :return: True if the associated chatroom was also deleted, otherwise False """ db.session.delete(self) db.session.flush(...
python
def delete(self, reason=''): """Deletes the event chatroom and if necessary the chatroom, too. :param reason: reason for the deletion :return: True if the associated chatroom was also deleted, otherwise False """ db.session.delete(self) db.session.flush(...
Deletes the event chatroom and if necessary the chatroom, too. :param reason: reason for the deletion :return: True if the associated chatroom was also deleted, otherwise False
https://github.com/indico/indico-plugins/blob/fe50085cc63be9b8161b09539e662e7b04e4b38e/chat/indico_chat/models/chatrooms.py#L187-L201
indico/indico-plugins
livesync/indico_livesync/util.py
obj_ref
def obj_ref(obj): """Returns a tuple identifying a category/event/contrib/subcontrib""" from indico_livesync.models.queue import EntryType if isinstance(obj, Category): ref = {'type': EntryType.category, 'category_id': obj.id} elif isinstance(obj, Event): ref = {'type': EntryType.event, ...
python
def obj_ref(obj): """Returns a tuple identifying a category/event/contrib/subcontrib""" from indico_livesync.models.queue import EntryType if isinstance(obj, Category): ref = {'type': EntryType.category, 'category_id': obj.id} elif isinstance(obj, Event): ref = {'type': EntryType.event, ...
Returns a tuple identifying a category/event/contrib/subcontrib
https://github.com/indico/indico-plugins/blob/fe50085cc63be9b8161b09539e662e7b04e4b38e/livesync/indico_livesync/util.py#L32-L47
indico/indico-plugins
livesync/indico_livesync/util.py
obj_deref
def obj_deref(ref): """Returns the object identified by `ref`""" from indico_livesync.models.queue import EntryType if ref['type'] == EntryType.category: return Category.get_one(ref['category_id']) elif ref['type'] == EntryType.event: return Event.get_one(ref['event_id']) elif ref['t...
python
def obj_deref(ref): """Returns the object identified by `ref`""" from indico_livesync.models.queue import EntryType if ref['type'] == EntryType.category: return Category.get_one(ref['category_id']) elif ref['type'] == EntryType.event: return Event.get_one(ref['event_id']) elif ref['t...
Returns the object identified by `ref`
https://github.com/indico/indico-plugins/blob/fe50085cc63be9b8161b09539e662e7b04e4b38e/livesync/indico_livesync/util.py#L51-L65
indico/indico-plugins
livesync/indico_livesync/util.py
clean_old_entries
def clean_old_entries(): """Deletes obsolete entries from the queues""" from indico_livesync.plugin import LiveSyncPlugin from indico_livesync.models.queue import LiveSyncQueueEntry queue_entry_ttl = LiveSyncPlugin.settings.get('queue_entry_ttl') if not queue_entry_ttl: return expire_th...
python
def clean_old_entries(): """Deletes obsolete entries from the queues""" from indico_livesync.plugin import LiveSyncPlugin from indico_livesync.models.queue import LiveSyncQueueEntry queue_entry_ttl = LiveSyncPlugin.settings.get('queue_entry_ttl') if not queue_entry_ttl: return expire_th...
Deletes obsolete entries from the queues
https://github.com/indico/indico-plugins/blob/fe50085cc63be9b8161b09539e662e7b04e4b38e/livesync/indico_livesync/util.py#L68-L78
indico/indico-plugins
livesync/indico_livesync/util.py
get_excluded_categories
def get_excluded_categories(): """Get excluded category IDs.""" from indico_livesync.plugin import LiveSyncPlugin return {int(x['id']) for x in LiveSyncPlugin.settings.get('excluded_categories')}
python
def get_excluded_categories(): """Get excluded category IDs.""" from indico_livesync.plugin import LiveSyncPlugin return {int(x['id']) for x in LiveSyncPlugin.settings.get('excluded_categories')}
Get excluded category IDs.
https://github.com/indico/indico-plugins/blob/fe50085cc63be9b8161b09539e662e7b04e4b38e/livesync/indico_livesync/util.py#L82-L85
indico/indico-plugins
livesync/indico_livesync/util.py
compound_id
def compound_id(obj): """Generate a hierarchical compound ID, separated by dots.""" if isinstance(obj, (Category, Session)): raise TypeError('Compound IDs are not supported for this entry type') elif isinstance(obj, Event): return unicode(obj.id) elif isinstance(obj, Contribution): ...
python
def compound_id(obj): """Generate a hierarchical compound ID, separated by dots.""" if isinstance(obj, (Category, Session)): raise TypeError('Compound IDs are not supported for this entry type') elif isinstance(obj, Event): return unicode(obj.id) elif isinstance(obj, Contribution): ...
Generate a hierarchical compound ID, separated by dots.
https://github.com/indico/indico-plugins/blob/fe50085cc63be9b8161b09539e662e7b04e4b38e/livesync/indico_livesync/util.py#L88-L97
indico/indico-plugins
piwik/indico_piwik/queries/tracking.py
track_download_request
def track_download_request(download_url, download_title): """Track a download in Piwik""" from indico_piwik.plugin import PiwikPlugin if not download_url: raise ValueError("download_url can't be empty") if not download_title: raise ValueError("download_title can't be empty") reques...
python
def track_download_request(download_url, download_title): """Track a download in Piwik""" from indico_piwik.plugin import PiwikPlugin if not download_url: raise ValueError("download_url can't be empty") if not download_title: raise ValueError("download_title can't be empty") reques...
Track a download in Piwik
https://github.com/indico/indico-plugins/blob/fe50085cc63be9b8161b09539e662e7b04e4b38e/piwik/indico_piwik/queries/tracking.py#L26-L47
indico/indico-plugins
livesync/indico_livesync/models/agents.py
LiveSyncAgent.backend
def backend(self): """Returns the backend class""" from indico_livesync.plugin import LiveSyncPlugin return LiveSyncPlugin.instance.backend_classes.get(self.backend_name)
python
def backend(self): """Returns the backend class""" from indico_livesync.plugin import LiveSyncPlugin return LiveSyncPlugin.instance.backend_classes.get(self.backend_name)
Returns the backend class
https://github.com/indico/indico-plugins/blob/fe50085cc63be9b8161b09539e662e7b04e4b38e/livesync/indico_livesync/models/agents.py#L74-L77
indico/indico-plugins
chat/indico_chat/notifications.py
notify_created
def notify_created(room, event, user): """Notifies about the creation of a chatroom. :param room: the chatroom :param event: the event :param user: the user performing the action """ tpl = get_plugin_template_module('emails/created.txt', chatroom=room, event=event, user=user) _send(event, t...
python
def notify_created(room, event, user): """Notifies about the creation of a chatroom. :param room: the chatroom :param event: the event :param user: the user performing the action """ tpl = get_plugin_template_module('emails/created.txt', chatroom=room, event=event, user=user) _send(event, t...
Notifies about the creation of a chatroom. :param room: the chatroom :param event: the event :param user: the user performing the action
https://github.com/indico/indico-plugins/blob/fe50085cc63be9b8161b09539e662e7b04e4b38e/chat/indico_chat/notifications.py#L23-L31
indico/indico-plugins
chat/indico_chat/notifications.py
notify_attached
def notify_attached(room, event, user): """Notifies about an existing chatroom being attached to an event. :param room: the chatroom :param event: the event :param user: the user performing the action """ tpl = get_plugin_template_module('emails/attached.txt', chatroom=room, event=event, user=u...
python
def notify_attached(room, event, user): """Notifies about an existing chatroom being attached to an event. :param room: the chatroom :param event: the event :param user: the user performing the action """ tpl = get_plugin_template_module('emails/attached.txt', chatroom=room, event=event, user=u...
Notifies about an existing chatroom being attached to an event. :param room: the chatroom :param event: the event :param user: the user performing the action
https://github.com/indico/indico-plugins/blob/fe50085cc63be9b8161b09539e662e7b04e4b38e/chat/indico_chat/notifications.py#L34-L42
indico/indico-plugins
chat/indico_chat/notifications.py
notify_modified
def notify_modified(room, event, user): """Notifies about the modification of a chatroom. :param room: the chatroom :param event: the event :param user: the user performing the action """ tpl = get_plugin_template_module('emails/modified.txt', chatroom=room, event=event, user=user) _send(ev...
python
def notify_modified(room, event, user): """Notifies about the modification of a chatroom. :param room: the chatroom :param event: the event :param user: the user performing the action """ tpl = get_plugin_template_module('emails/modified.txt', chatroom=room, event=event, user=user) _send(ev...
Notifies about the modification of a chatroom. :param room: the chatroom :param event: the event :param user: the user performing the action
https://github.com/indico/indico-plugins/blob/fe50085cc63be9b8161b09539e662e7b04e4b38e/chat/indico_chat/notifications.py#L45-L53
indico/indico-plugins
chat/indico_chat/notifications.py
notify_deleted
def notify_deleted(room, event, user, room_deleted): """Notifies about the deletion of a chatroom. :param room: the chatroom :param event: the event :param user: the user performing the action; `None` if due to event deletion :param room_deleted: if the room has been deleted from the jabber server ...
python
def notify_deleted(room, event, user, room_deleted): """Notifies about the deletion of a chatroom. :param room: the chatroom :param event: the event :param user: the user performing the action; `None` if due to event deletion :param room_deleted: if the room has been deleted from the jabber server ...
Notifies about the deletion of a chatroom. :param room: the chatroom :param event: the event :param user: the user performing the action; `None` if due to event deletion :param room_deleted: if the room has been deleted from the jabber server
https://github.com/indico/indico-plugins/blob/fe50085cc63be9b8161b09539e662e7b04e4b38e/chat/indico_chat/notifications.py#L56-L66
sbg/sevenbridges-python
sevenbridges/models/automation.py
AutomationMember.query
def query(cls, automation=None, offset=None, limit=None, api=None): """ Query (List) apps. :param automation: Automation id. :param offset: Pagination offset. :param limit: Pagination limit. :param api: Api instance. :return: collection object """ ...
python
def query(cls, automation=None, offset=None, limit=None, api=None): """ Query (List) apps. :param automation: Automation id. :param offset: Pagination offset. :param limit: Pagination limit. :param api: Api instance. :return: collection object """ ...
Query (List) apps. :param automation: Automation id. :param offset: Pagination offset. :param limit: Pagination limit. :param api: Api instance. :return: collection object
https://github.com/sbg/sevenbridges-python/blob/f62640d1018d959f0b686f2dbe5e183085336607/sevenbridges/models/automation.py#L104-L122
sbg/sevenbridges-python
sevenbridges/models/automation.py
AutomationMember.get
def get(cls, id, automation, api=None): """ Fetches the resource from the server. :param id: Automation member username :param automation: Automation id or object :param api: sevenbridges Api instance. :return: AutomationMember object. """ username = Trans...
python
def get(cls, id, automation, api=None): """ Fetches the resource from the server. :param id: Automation member username :param automation: Automation id or object :param api: sevenbridges Api instance. :return: AutomationMember object. """ username = Trans...
Fetches the resource from the server. :param id: Automation member username :param automation: Automation id or object :param api: sevenbridges Api instance. :return: AutomationMember object.
https://github.com/sbg/sevenbridges-python/blob/f62640d1018d959f0b686f2dbe5e183085336607/sevenbridges/models/automation.py#L126-L142
sbg/sevenbridges-python
sevenbridges/models/automation.py
AutomationMember.add
def add(cls, user, permissions, automation, api=None): """ Add a member to the automation. :param user: Member username :param permissions: Permissions dictionary. :param automation: Automation object or id :param api: sevenbridges Api instance :return: Automation...
python
def add(cls, user, permissions, automation, api=None): """ Add a member to the automation. :param user: Member username :param permissions: Permissions dictionary. :param automation: Automation object or id :param api: sevenbridges Api instance :return: Automation...
Add a member to the automation. :param user: Member username :param permissions: Permissions dictionary. :param automation: Automation object or id :param api: sevenbridges Api instance :return: Automation member object.
https://github.com/sbg/sevenbridges-python/blob/f62640d1018d959f0b686f2dbe5e183085336607/sevenbridges/models/automation.py#L145-L169
sbg/sevenbridges-python
sevenbridges/models/automation.py
AutomationMember.remove
def remove(cls, user, automation, api=None): """ Remove a member from the automation. :param user: Member username :param automation: Automation id :param api: sevenbridges Api instance :return: None """ user = Transform.to_user(user) automation = ...
python
def remove(cls, user, automation, api=None): """ Remove a member from the automation. :param user: Member username :param automation: Automation id :param api: sevenbridges Api instance :return: None """ user = Transform.to_user(user) automation = ...
Remove a member from the automation. :param user: Member username :param automation: Automation id :param api: sevenbridges Api instance :return: None
https://github.com/sbg/sevenbridges-python/blob/f62640d1018d959f0b686f2dbe5e183085336607/sevenbridges/models/automation.py#L172-L186
sbg/sevenbridges-python
sevenbridges/models/automation.py
AutomationMember.save
def save(self, inplace=True): """ Saves modification to the api server. """ modified = self._modified_data() if bool(modified): new_data = self.permissions.copy() new_data.update(modified['permissions']) data = { 'permissions': ...
python
def save(self, inplace=True): """ Saves modification to the api server. """ modified = self._modified_data() if bool(modified): new_data = self.permissions.copy() new_data.update(modified['permissions']) data = { 'permissions': ...
Saves modification to the api server.
https://github.com/sbg/sevenbridges-python/blob/f62640d1018d959f0b686f2dbe5e183085336607/sevenbridges/models/automation.py#L189-L203
sbg/sevenbridges-python
sevenbridges/models/automation.py
Automation.query
def query(cls, name=None, offset=None, limit=None, api=None): """ Query (List) automations. :param name: Automation name. :param offset: Pagination offset. :param limit: Pagination limit. :param api: Api instance. :return: collection object """ ap...
python
def query(cls, name=None, offset=None, limit=None, api=None): """ Query (List) automations. :param name: Automation name. :param offset: Pagination offset. :param limit: Pagination limit. :param api: Api instance. :return: collection object """ ap...
Query (List) automations. :param name: Automation name. :param offset: Pagination offset. :param limit: Pagination limit. :param api: Api instance. :return: collection object
https://github.com/sbg/sevenbridges-python/blob/f62640d1018d959f0b686f2dbe5e183085336607/sevenbridges/models/automation.py#L245-L262
sbg/sevenbridges-python
sevenbridges/models/automation.py
Automation.get_packages
def get_packages(self, offset=None, limit=None, api=None): """ Return list of packages that belong to this automation :param offset: Pagination offset. :param limit: Pagination limit. :param api: sevenbridges Api instance. :return: AutomationPackage collection """...
python
def get_packages(self, offset=None, limit=None, api=None): """ Return list of packages that belong to this automation :param offset: Pagination offset. :param limit: Pagination limit. :param api: sevenbridges Api instance. :return: AutomationPackage collection """...
Return list of packages that belong to this automation :param offset: Pagination offset. :param limit: Pagination limit. :param api: sevenbridges Api instance. :return: AutomationPackage collection
https://github.com/sbg/sevenbridges-python/blob/f62640d1018d959f0b686f2dbe5e183085336607/sevenbridges/models/automation.py#L264-L275
sbg/sevenbridges-python
sevenbridges/models/automation.py
Automation.get_member
def get_member(self, username, api=None): """ Return specified automation member :param username: Member username :param api: sevenbridges Api instance. :return: AutomationMember object """ member = Transform.to_automation_member(username) api = api or sel...
python
def get_member(self, username, api=None): """ Return specified automation member :param username: Member username :param api: sevenbridges Api instance. :return: AutomationMember object """ member = Transform.to_automation_member(username) api = api or sel...
Return specified automation member :param username: Member username :param api: sevenbridges Api instance. :return: AutomationMember object
https://github.com/sbg/sevenbridges-python/blob/f62640d1018d959f0b686f2dbe5e183085336607/sevenbridges/models/automation.py#L277-L288
sbg/sevenbridges-python
sevenbridges/models/automation.py
Automation.get_members
def get_members(self, offset=None, limit=None, api=None): """ Return list of automation members :param offset: Pagination offset. :param limit: Pagination limit. :param api: sevenbridges Api instance. :return: AutomationMember collection """ api = api or s...
python
def get_members(self, offset=None, limit=None, api=None): """ Return list of automation members :param offset: Pagination offset. :param limit: Pagination limit. :param api: sevenbridges Api instance. :return: AutomationMember collection """ api = api or s...
Return list of automation members :param offset: Pagination offset. :param limit: Pagination limit. :param api: sevenbridges Api instance. :return: AutomationMember collection
https://github.com/sbg/sevenbridges-python/blob/f62640d1018d959f0b686f2dbe5e183085336607/sevenbridges/models/automation.py#L290-L301
sbg/sevenbridges-python
sevenbridges/models/automation.py
Automation.add_member
def add_member(self, user, permissions, api=None): """ Add member to the automation :param user: Member username :param permissions: Member permissions :param api: sevenbridges Api instance :return: AutomationMember object """ api = api or self._API ...
python
def add_member(self, user, permissions, api=None): """ Add member to the automation :param user: Member username :param permissions: Member permissions :param api: sevenbridges Api instance :return: AutomationMember object """ api = api or self._API ...
Add member to the automation :param user: Member username :param permissions: Member permissions :param api: sevenbridges Api instance :return: AutomationMember object
https://github.com/sbg/sevenbridges-python/blob/f62640d1018d959f0b686f2dbe5e183085336607/sevenbridges/models/automation.py#L303-L314
sbg/sevenbridges-python
sevenbridges/models/automation.py
Automation.remove_member
def remove_member(self, user, api=None): """ Remove a member from the automation :param user: Member username :param api: sevenbridges Api instance :return: None """ api = api or self._API AutomationMember.remove(automation=self.id, user=user, api=api)
python
def remove_member(self, user, api=None): """ Remove a member from the automation :param user: Member username :param api: sevenbridges Api instance :return: None """ api = api or self._API AutomationMember.remove(automation=self.id, user=user, api=api)
Remove a member from the automation :param user: Member username :param api: sevenbridges Api instance :return: None
https://github.com/sbg/sevenbridges-python/blob/f62640d1018d959f0b686f2dbe5e183085336607/sevenbridges/models/automation.py#L316-L324
sbg/sevenbridges-python
sevenbridges/models/automation.py
Automation.get_runs
def get_runs(self, package=None, status=None, name=None, created_by=None, created_from=None, created_to=None, order_by=None, order=None, offset=None, limit=None, api=None): """ Query automation runs that belong to this automation :param package: Package id ...
python
def get_runs(self, package=None, status=None, name=None, created_by=None, created_from=None, created_to=None, order_by=None, order=None, offset=None, limit=None, api=None): """ Query automation runs that belong to this automation :param package: Package id ...
Query automation runs that belong to this automation :param package: Package id :param status: Run status :param name: Automation run name :param created_by: Username of member that created the run :param created_from: Date the run was created after :param created_to: Dat...
https://github.com/sbg/sevenbridges-python/blob/f62640d1018d959f0b686f2dbe5e183085336607/sevenbridges/models/automation.py#L326-L350
sbg/sevenbridges-python
sevenbridges/models/automation.py
AutomationRun.query
def query(cls, automation=None, package=None, status=None, name=None, created_by=None, created_from=None, created_to=None, order_by=None, order=None, offset=None, limit=None, api=None): """ Query (List) automation runs. :param name: Automation run name :param ...
python
def query(cls, automation=None, package=None, status=None, name=None, created_by=None, created_from=None, created_to=None, order_by=None, order=None, offset=None, limit=None, api=None): """ Query (List) automation runs. :param name: Automation run name :param ...
Query (List) automation runs. :param name: Automation run name :param automation: Automation template :param package: Package :param status: Run status :param created_by: Username of user that created the run :param order_by: Property by which to order results :pa...
https://github.com/sbg/sevenbridges-python/blob/f62640d1018d959f0b686f2dbe5e183085336607/sevenbridges/models/automation.py#L395-L435
sbg/sevenbridges-python
sevenbridges/models/automation.py
AutomationRun.create
def create(cls, package, inputs=None, settings=None, resume_from=None, name=None, secret_settings=None, api=None): """ Create and start a new run. :param package: Automation package id :param inputs: Input dictionary :param settings: Settings override dictionary ...
python
def create(cls, package, inputs=None, settings=None, resume_from=None, name=None, secret_settings=None, api=None): """ Create and start a new run. :param package: Automation package id :param inputs: Input dictionary :param settings: Settings override dictionary ...
Create and start a new run. :param package: Automation package id :param inputs: Input dictionary :param settings: Settings override dictionary :param resume_from: Run to resume from :param name: Automation run name :param secret_settings: dict to override secret_settings...
https://github.com/sbg/sevenbridges-python/blob/f62640d1018d959f0b686f2dbe5e183085336607/sevenbridges/models/automation.py#L438-L471
sbg/sevenbridges-python
sevenbridges/models/automation.py
AutomationRun.stop
def stop(self, api=None): """ Stop automation run. :param api: sevenbridges Api instance. :return: AutomationRun object """ api = api or self._API return api.post( url=self._URL['actions'].format( id=self.id, action=AutomationRunAction...
python
def stop(self, api=None): """ Stop automation run. :param api: sevenbridges Api instance. :return: AutomationRun object """ api = api or self._API return api.post( url=self._URL['actions'].format( id=self.id, action=AutomationRunAction...
Stop automation run. :param api: sevenbridges Api instance. :return: AutomationRun object
https://github.com/sbg/sevenbridges-python/blob/f62640d1018d959f0b686f2dbe5e183085336607/sevenbridges/models/automation.py#L473-L485
sbg/sevenbridges-python
sevenbridges/models/automation.py
AutomationRun.get_log_file
def get_log_file(self, api=None): """ Retrieve automation run log. :param api: sevenbridges Api instance :return: Log string """ api = api or self._API log_file_data = self.execution_details.get('log_file') return File(api=api, **log_file_data) if log_file...
python
def get_log_file(self, api=None): """ Retrieve automation run log. :param api: sevenbridges Api instance :return: Log string """ api = api or self._API log_file_data = self.execution_details.get('log_file') return File(api=api, **log_file_data) if log_file...
Retrieve automation run log. :param api: sevenbridges Api instance :return: Log string
https://github.com/sbg/sevenbridges-python/blob/f62640d1018d959f0b686f2dbe5e183085336607/sevenbridges/models/automation.py#L487-L495
sbg/sevenbridges-python
sevenbridges/models/automation.py
AutomationRun.get_state
def get_state(self, api=None): """ Retrieve automation run state. :param api: sevenbridges Api instance :return: State file json contents as string """ api = api or self._API return api.get(self._URL['state'].format(id=self.id)).json()
python
def get_state(self, api=None): """ Retrieve automation run state. :param api: sevenbridges Api instance :return: State file json contents as string """ api = api or self._API return api.get(self._URL['state'].format(id=self.id)).json()
Retrieve automation run state. :param api: sevenbridges Api instance :return: State file json contents as string
https://github.com/sbg/sevenbridges-python/blob/f62640d1018d959f0b686f2dbe5e183085336607/sevenbridges/models/automation.py#L497-L504
sbg/sevenbridges-python
sevenbridges/transfer/upload.py
_get_part_url
def _get_part_url(api, url, upload, part): """ Used by the worker to fetch url for the part that is to be uploaded. :param api: Api instance. :param url: Part url. :param upload: Upload identifier. :param part: Part number. :return: Storage generated URL for the part. """ try: ...
python
def _get_part_url(api, url, upload, part): """ Used by the worker to fetch url for the part that is to be uploaded. :param api: Api instance. :param url: Part url. :param upload: Upload identifier. :param part: Part number. :return: Storage generated URL for the part. """ try: ...
Used by the worker to fetch url for the part that is to be uploaded. :param api: Api instance. :param url: Part url. :param upload: Upload identifier. :param part: Part number. :return: Storage generated URL for the part.
https://github.com/sbg/sevenbridges-python/blob/f62640d1018d959f0b686f2dbe5e183085336607/sevenbridges/transfer/upload.py#L16-L31
sbg/sevenbridges-python
sevenbridges/transfer/upload.py
_report_part
def _report_part(api, url, upload, part, e_tag): """ Used by the worker to report the completion of the part upload. :param api: Api instance. :param url: Part url. :param upload: Upload identifier. :param part: Part number. :param e_tag: ETag """ part_data = { 'part_number':...
python
def _report_part(api, url, upload, part, e_tag): """ Used by the worker to report the completion of the part upload. :param api: Api instance. :param url: Part url. :param upload: Upload identifier. :param part: Part number. :param e_tag: ETag """ part_data = { 'part_number':...
Used by the worker to report the completion of the part upload. :param api: Api instance. :param url: Part url. :param upload: Upload identifier. :param part: Part number. :param e_tag: ETag
https://github.com/sbg/sevenbridges-python/blob/f62640d1018d959f0b686f2dbe5e183085336607/sevenbridges/transfer/upload.py#L34-L60
sbg/sevenbridges-python
sevenbridges/transfer/upload.py
_submit_part
def _submit_part(session, url, part, timeout): """ Used by the worker to submit the part data to the storage service URL. :param session: Storage service session. :param url: Part url. :param part: Part data in bytes. :param timeout: Timeout for storage session. :return: ETag for the submitt...
python
def _submit_part(session, url, part, timeout): """ Used by the worker to submit the part data to the storage service URL. :param session: Storage service session. :param url: Part url. :param part: Part data in bytes. :param timeout: Timeout for storage session. :return: ETag for the submitt...
Used by the worker to submit the part data to the storage service URL. :param session: Storage service session. :param url: Part url. :param part: Part data in bytes. :param timeout: Timeout for storage session. :return: ETag for the submitted part.
https://github.com/sbg/sevenbridges-python/blob/f62640d1018d959f0b686f2dbe5e183085336607/sevenbridges/transfer/upload.py#L63-L80
sbg/sevenbridges-python
sevenbridges/transfer/upload.py
_upload_part
def _upload_part(api, session, url, upload, part_number, part, retry_count, timeout): """ Used by the worker to upload a part to the storage service. :param api: Api instance. :param session: Storage service session. :param url: Part url. :param upload: Upload identifier. :p...
python
def _upload_part(api, session, url, upload, part_number, part, retry_count, timeout): """ Used by the worker to upload a part to the storage service. :param api: Api instance. :param session: Storage service session. :param url: Part url. :param upload: Upload identifier. :p...
Used by the worker to upload a part to the storage service. :param api: Api instance. :param session: Storage service session. :param url: Part url. :param upload: Upload identifier. :param part_number: Part number. :param part: Part data. :param retry_count: Number of times to retry. :p...
https://github.com/sbg/sevenbridges-python/blob/f62640d1018d959f0b686f2dbe5e183085336607/sevenbridges/transfer/upload.py#L83-L104
sbg/sevenbridges-python
sevenbridges/transfer/upload.py
UPartedFile.submit
def submit(self): """ Partitions the file into chunks and submits them into group of 4 for upload on the api upload pool. :return: Futures """ futures = [] while self.submitted < 4 and not self.done(): part = self.parts.pop(0) part_number ...
python
def submit(self): """ Partitions the file into chunks and submits them into group of 4 for upload on the api upload pool. :return: Futures """ futures = [] while self.submitted < 4 and not self.done(): part = self.parts.pop(0) part_number ...
Partitions the file into chunks and submits them into group of 4 for upload on the api upload pool. :return: Futures
https://github.com/sbg/sevenbridges-python/blob/f62640d1018d959f0b686f2dbe5e183085336607/sevenbridges/transfer/upload.py#L142-L170
sbg/sevenbridges-python
sevenbridges/transfer/upload.py
UPartedFile.get_parts
def get_parts(self): """ Partitions the file and saves the parts to be uploaded in memory. """ parts = [] start_byte = 0 for i in range(1, self.total + 1): end_byte = start_byte + self.part_size if end_byte >= self.file_size - 1: ...
python
def get_parts(self): """ Partitions the file and saves the parts to be uploaded in memory. """ parts = [] start_byte = 0 for i in range(1, self.total + 1): end_byte = start_byte + self.part_size if end_byte >= self.file_size - 1: ...
Partitions the file and saves the parts to be uploaded in memory.
https://github.com/sbg/sevenbridges-python/blob/f62640d1018d959f0b686f2dbe5e183085336607/sevenbridges/transfer/upload.py#L184-L201
sbg/sevenbridges-python
sevenbridges/transfer/upload.py
Upload._verify_part_number
def _verify_part_number(self): """ Verifies that the total number of parts is smaller then 10^5 which is the maximum number of parts. """ total = int(math.ceil(self._file_size / self._part_size)) if total > PartSize.MAXIMUM_TOTAL_PARTS: self._status = Transfer...
python
def _verify_part_number(self): """ Verifies that the total number of parts is smaller then 10^5 which is the maximum number of parts. """ total = int(math.ceil(self._file_size / self._part_size)) if total > PartSize.MAXIMUM_TOTAL_PARTS: self._status = Transfer...
Verifies that the total number of parts is smaller then 10^5 which is the maximum number of parts.
https://github.com/sbg/sevenbridges-python/blob/f62640d1018d959f0b686f2dbe5e183085336607/sevenbridges/transfer/upload.py#L294-L305
sbg/sevenbridges-python
sevenbridges/transfer/upload.py
Upload._verify_part_size
def _verify_part_size(self): """ Verifies that the part size is smaller then the maximum part size which is 5GB. """ if self._part_size > PartSize.MAXIMUM_UPLOAD_SIZE: self._status = TransferState.FAILED raise SbgError('Part size = {}b. Maximum part size i...
python
def _verify_part_size(self): """ Verifies that the part size is smaller then the maximum part size which is 5GB. """ if self._part_size > PartSize.MAXIMUM_UPLOAD_SIZE: self._status = TransferState.FAILED raise SbgError('Part size = {}b. Maximum part size i...
Verifies that the part size is smaller then the maximum part size which is 5GB.
https://github.com/sbg/sevenbridges-python/blob/f62640d1018d959f0b686f2dbe5e183085336607/sevenbridges/transfer/upload.py#L307-L316
sbg/sevenbridges-python
sevenbridges/transfer/upload.py
Upload._verify_file_size
def _verify_file_size(self): """ Verifies that the file is smaller then 5TB which is the maximum that is allowed for upload. """ if self._file_size > PartSize.MAXIMUM_OBJECT_SIZE: self._status = TransferState.FAILED raise SbgError('File size = {}b. Maximum...
python
def _verify_file_size(self): """ Verifies that the file is smaller then 5TB which is the maximum that is allowed for upload. """ if self._file_size > PartSize.MAXIMUM_OBJECT_SIZE: self._status = TransferState.FAILED raise SbgError('File size = {}b. Maximum...
Verifies that the file is smaller then 5TB which is the maximum that is allowed for upload.
https://github.com/sbg/sevenbridges-python/blob/f62640d1018d959f0b686f2dbe5e183085336607/sevenbridges/transfer/upload.py#L318-L327
sbg/sevenbridges-python
sevenbridges/transfer/upload.py
Upload._initialize_upload
def _initialize_upload(self): """ Initialized the upload on the API server by submitting the information about the project, the file name, file size and the part size that is going to be used during multipart upload. """ init_data = { 'name': self._file_name,...
python
def _initialize_upload(self): """ Initialized the upload on the API server by submitting the information about the project, the file name, file size and the part size that is going to be used during multipart upload. """ init_data = { 'name': self._file_name,...
Initialized the upload on the API server by submitting the information about the project, the file name, file size and the part size that is going to be used during multipart upload.
https://github.com/sbg/sevenbridges-python/blob/f62640d1018d959f0b686f2dbe5e183085336607/sevenbridges/transfer/upload.py#L329-L361
sbg/sevenbridges-python
sevenbridges/transfer/upload.py
Upload._finalize_upload
def _finalize_upload(self): """ Finalizes the upload on the API server. """ from sevenbridges.models.file import File try: response = self._api.post( self._URL['upload_complete'].format(upload_id=self._upload_id) ).json() self._...
python
def _finalize_upload(self): """ Finalizes the upload on the API server. """ from sevenbridges.models.file import File try: response = self._api.post( self._URL['upload_complete'].format(upload_id=self._upload_id) ).json() self._...
Finalizes the upload on the API server.
https://github.com/sbg/sevenbridges-python/blob/f62640d1018d959f0b686f2dbe5e183085336607/sevenbridges/transfer/upload.py#L363-L379
sbg/sevenbridges-python
sevenbridges/transfer/upload.py
Upload._abort_upload
def _abort_upload(self): """ Aborts the upload on the API server. """ try: self._api.delete( self._URL['upload_info'].format(upload_id=self._upload_id) ) except SbgError as e: self._status = TransferState.FAILED rais...
python
def _abort_upload(self): """ Aborts the upload on the API server. """ try: self._api.delete( self._URL['upload_info'].format(upload_id=self._upload_id) ) except SbgError as e: self._status = TransferState.FAILED rais...
Aborts the upload on the API server.
https://github.com/sbg/sevenbridges-python/blob/f62640d1018d959f0b686f2dbe5e183085336607/sevenbridges/transfer/upload.py#L381-L393
sbg/sevenbridges-python
sevenbridges/transfer/upload.py
Upload.add_callback
def add_callback(self, callback=None, errorback=None): """ Adds a callback that will be called when the upload finishes successfully or when error is raised. """ self._callback = callback self._errorback = errorback
python
def add_callback(self, callback=None, errorback=None): """ Adds a callback that will be called when the upload finishes successfully or when error is raised. """ self._callback = callback self._errorback = errorback
Adds a callback that will be called when the upload finishes successfully or when error is raised.
https://github.com/sbg/sevenbridges-python/blob/f62640d1018d959f0b686f2dbe5e183085336607/sevenbridges/transfer/upload.py#L415-L421
sbg/sevenbridges-python
sevenbridges/transfer/upload.py
Upload.start
def start(self): """ Starts the upload. :raises SbgError: If upload is not in PREPARING state. """ if self._status == TransferState.PREPARING: super(Upload, self).start() else: raise SbgError( 'Unable to start. Upload not in PREPARI...
python
def start(self): """ Starts the upload. :raises SbgError: If upload is not in PREPARING state. """ if self._status == TransferState.PREPARING: super(Upload, self).start() else: raise SbgError( 'Unable to start. Upload not in PREPARI...
Starts the upload. :raises SbgError: If upload is not in PREPARING state.
https://github.com/sbg/sevenbridges-python/blob/f62640d1018d959f0b686f2dbe5e183085336607/sevenbridges/transfer/upload.py#L480-L490
sbg/sevenbridges-python
sevenbridges/transfer/upload.py
Upload.run
def run(self): """ Runs the thread! Should not be used use start() method instead. """ self._running.set() self._status = TransferState.RUNNING self._time_started = time.time() # Initializes the upload self._initialize_upload() # Opens the file f...
python
def run(self): """ Runs the thread! Should not be used use start() method instead. """ self._running.set() self._status = TransferState.RUNNING self._time_started = time.time() # Initializes the upload self._initialize_upload() # Opens the file f...
Runs the thread! Should not be used use start() method instead.
https://github.com/sbg/sevenbridges-python/blob/f62640d1018d959f0b686f2dbe5e183085336607/sevenbridges/transfer/upload.py#L492-L541
indico/indico-plugins
livesync/indico_livesync/simplify.py
process_records
def process_records(records): """Converts queue entries into object changes. :param records: an iterable containing `LiveSyncQueueEntry` objects :return: a dict mapping object references to `SimpleChange` bitsets """ changes = defaultdict(int) cascaded_update_records = set() cascaded_delete...
python
def process_records(records): """Converts queue entries into object changes. :param records: an iterable containing `LiveSyncQueueEntry` objects :return: a dict mapping object references to `SimpleChange` bitsets """ changes = defaultdict(int) cascaded_update_records = set() cascaded_delete...
Converts queue entries into object changes. :param records: an iterable containing `LiveSyncQueueEntry` objects :return: a dict mapping object references to `SimpleChange` bitsets
https://github.com/indico/indico-plugins/blob/fe50085cc63be9b8161b09539e662e7b04e4b38e/livesync/indico_livesync/simplify.py#L40-L73
indico/indico-plugins
livesync/indico_livesync/simplify.py
_process_cascaded_category_contents
def _process_cascaded_category_contents(records): """ Travel from categories to subcontributions, flattening the whole event structure. Yields everything that it finds (except for elements whose protection has changed but are not inheriting their protection settings from anywhere). :param records:...
python
def _process_cascaded_category_contents(records): """ Travel from categories to subcontributions, flattening the whole event structure. Yields everything that it finds (except for elements whose protection has changed but are not inheriting their protection settings from anywhere). :param records:...
Travel from categories to subcontributions, flattening the whole event structure. Yields everything that it finds (except for elements whose protection has changed but are not inheriting their protection settings from anywhere). :param records: queue records to process
https://github.com/indico/indico-plugins/blob/fe50085cc63be9b8161b09539e662e7b04e4b38e/livesync/indico_livesync/simplify.py#L76-L111
indico/indico-plugins
livesync/indico_livesync/simplify.py
_process_cascaded_event_contents
def _process_cascaded_event_contents(records, additional_events=None): """ Flatten a series of records into its most basic elements (subcontribution level). Yields results. :param records: queue records to process :param additional_events: events whose content will be included in addition to those...
python
def _process_cascaded_event_contents(records, additional_events=None): """ Flatten a series of records into its most basic elements (subcontribution level). Yields results. :param records: queue records to process :param additional_events: events whose content will be included in addition to those...
Flatten a series of records into its most basic elements (subcontribution level). Yields results. :param records: queue records to process :param additional_events: events whose content will be included in addition to those found in records
https://github.com/indico/indico-plugins/blob/fe50085cc63be9b8161b09539e662e7b04e4b38e/livesync/indico_livesync/simplify.py#L114-L160
indico/indico-plugins
vc_vidyo/indico_vc_vidyo/plugin.py
VidyoPlugin.create_room
def create_room(self, vc_room, event): """Create a new Vidyo room for an event, given a VC room. In order to create the Vidyo room, the function will try to do so with all the available identities of the user based on the authenticators defined in Vidyo plugin's settings, in that order....
python
def create_room(self, vc_room, event): """Create a new Vidyo room for an event, given a VC room. In order to create the Vidyo room, the function will try to do so with all the available identities of the user based on the authenticators defined in Vidyo plugin's settings, in that order....
Create a new Vidyo room for an event, given a VC room. In order to create the Vidyo room, the function will try to do so with all the available identities of the user based on the authenticators defined in Vidyo plugin's settings, in that order. :param vc_room: VCRoom -- The VC room fr...
https://github.com/indico/indico-plugins/blob/fe50085cc63be9b8161b09539e662e7b04e4b38e/vc_vidyo/indico_vc_vidyo/plugin.py#L146-L224