partition stringclasses 3
values | func_name stringlengths 1 134 | docstring stringlengths 1 46.9k | path stringlengths 4 223 | original_string stringlengths 75 104k | code stringlengths 75 104k | docstring_tokens listlengths 1 1.97k | repo stringlengths 7 55 | language stringclasses 1
value | url stringlengths 87 315 | code_tokens listlengths 19 28.4k | sha stringlengths 40 40 |
|---|---|---|---|---|---|---|---|---|---|---|---|
valid | Packager.package_for_editor_signavio | Adds the SVG files to the archive for this BPMN file. | SpiffWorkflow/bpmn/serializer/Packager.py | def package_for_editor_signavio(self, spec, filename):
"""
Adds the SVG files to the archive for this BPMN file.
"""
signavio_file = filename[:-len('.bpmn20.xml')] + '.signavio.xml'
if os.path.exists(signavio_file):
self.write_file_to_package_zip(
"src... | def package_for_editor_signavio(self, spec, filename):
"""
Adds the SVG files to the archive for this BPMN file.
"""
signavio_file = filename[:-len('.bpmn20.xml')] + '.signavio.xml'
if os.path.exists(signavio_file):
self.write_file_to_package_zip(
"src... | [
"Adds",
"the",
"SVG",
"files",
"to",
"the",
"archive",
"for",
"this",
"BPMN",
"file",
"."
] | knipknap/SpiffWorkflow | python | https://github.com/knipknap/SpiffWorkflow/blob/f0af7f59a332e0619e4f3c00a7d4a3d230760e00/SpiffWorkflow/bpmn/serializer/Packager.py#L322-L337 | [
"def",
"package_for_editor_signavio",
"(",
"self",
",",
"spec",
",",
"filename",
")",
":",
"signavio_file",
"=",
"filename",
"[",
":",
"-",
"len",
"(",
"'.bpmn20.xml'",
")",
"]",
"+",
"'.signavio.xml'",
"if",
"os",
".",
"path",
".",
"exists",
"(",
"signavi... | f0af7f59a332e0619e4f3c00a7d4a3d230760e00 |
valid | Packager.write_meta_data | Writes the metadata.ini file to the archive. | SpiffWorkflow/bpmn/serializer/Packager.py | def write_meta_data(self):
"""
Writes the metadata.ini file to the archive.
"""
config = configparser.ConfigParser()
config.add_section('MetaData')
config.set('MetaData', 'entry_point_process', self.wf_spec.name)
if self.editor:
config.set('MetaData',... | def write_meta_data(self):
"""
Writes the metadata.ini file to the archive.
"""
config = configparser.ConfigParser()
config.add_section('MetaData')
config.set('MetaData', 'entry_point_process', self.wf_spec.name)
if self.editor:
config.set('MetaData',... | [
"Writes",
"the",
"metadata",
".",
"ini",
"file",
"to",
"the",
"archive",
"."
] | knipknap/SpiffWorkflow | python | https://github.com/knipknap/SpiffWorkflow/blob/f0af7f59a332e0619e4f3c00a7d4a3d230760e00/SpiffWorkflow/bpmn/serializer/Packager.py#L339-L360 | [
"def",
"write_meta_data",
"(",
"self",
")",
":",
"config",
"=",
"configparser",
".",
"ConfigParser",
"(",
")",
"config",
".",
"add_section",
"(",
"'MetaData'",
")",
"config",
".",
"set",
"(",
"'MetaData'",
",",
"'entry_point_process'",
",",
"self",
".",
"wf_... | f0af7f59a332e0619e4f3c00a7d4a3d230760e00 |
valid | Packager.add_main_options | Override in subclass if required. | SpiffWorkflow/bpmn/serializer/Packager.py | def add_main_options(cls, parser):
"""
Override in subclass if required.
"""
parser.add_option("-o", "--output", dest="package_file",
help="create the BPMN package in the specified file")
parser.add_option("-p", "--process", dest="entry_point_process",
... | def add_main_options(cls, parser):
"""
Override in subclass if required.
"""
parser.add_option("-o", "--output", dest="package_file",
help="create the BPMN package in the specified file")
parser.add_option("-p", "--process", dest="entry_point_process",
... | [
"Override",
"in",
"subclass",
"if",
"required",
"."
] | knipknap/SpiffWorkflow | python | https://github.com/knipknap/SpiffWorkflow/blob/f0af7f59a332e0619e4f3c00a7d4a3d230760e00/SpiffWorkflow/bpmn/serializer/Packager.py#L389-L410 | [
"def",
"add_main_options",
"(",
"cls",
",",
"parser",
")",
":",
"parser",
".",
"add_option",
"(",
"\"-o\"",
",",
"\"--output\"",
",",
"dest",
"=",
"\"package_file\"",
",",
"help",
"=",
"\"create the BPMN package in the specified file\"",
")",
"parser",
".",
"add_o... | f0af7f59a332e0619e4f3c00a7d4a3d230760e00 |
valid | Packager.add_additional_options | Override in subclass if required. | SpiffWorkflow/bpmn/serializer/Packager.py | def add_additional_options(cls, parser):
"""
Override in subclass if required.
"""
group = OptionGroup(parser, "Target Engine Options",
"These options are not required, but may be "
"provided if a specific "
... | def add_additional_options(cls, parser):
"""
Override in subclass if required.
"""
group = OptionGroup(parser, "Target Engine Options",
"These options are not required, but may be "
"provided if a specific "
... | [
"Override",
"in",
"subclass",
"if",
"required",
"."
] | knipknap/SpiffWorkflow | python | https://github.com/knipknap/SpiffWorkflow/blob/f0af7f59a332e0619e4f3c00a7d4a3d230760e00/SpiffWorkflow/bpmn/serializer/Packager.py#L413-L426 | [
"def",
"add_additional_options",
"(",
"cls",
",",
"parser",
")",
":",
"group",
"=",
"OptionGroup",
"(",
"parser",
",",
"\"Target Engine Options\"",
",",
"\"These options are not required, but may be \"",
"\"provided if a specific \"",
"\"BPMN application engine is targeted.\"",
... | f0af7f59a332e0619e4f3c00a7d4a3d230760e00 |
valid | Packager.check_args | Override in subclass if required. | SpiffWorkflow/bpmn/serializer/Packager.py | def check_args(cls, config, options, args, parser, package_file=None):
"""
Override in subclass if required.
"""
if not args:
parser.error("no input files specified")
if not (package_file or options.package_file):
parser.error("no package file specified")
... | def check_args(cls, config, options, args, parser, package_file=None):
"""
Override in subclass if required.
"""
if not args:
parser.error("no input files specified")
if not (package_file or options.package_file):
parser.error("no package file specified")
... | [
"Override",
"in",
"subclass",
"if",
"required",
"."
] | knipknap/SpiffWorkflow | python | https://github.com/knipknap/SpiffWorkflow/blob/f0af7f59a332e0619e4f3c00a7d4a3d230760e00/SpiffWorkflow/bpmn/serializer/Packager.py#L429-L438 | [
"def",
"check_args",
"(",
"cls",
",",
"config",
",",
"options",
",",
"args",
",",
"parser",
",",
"package_file",
"=",
"None",
")",
":",
"if",
"not",
"args",
":",
"parser",
".",
"error",
"(",
"\"no input files specified\"",
")",
"if",
"not",
"(",
"package... | f0af7f59a332e0619e4f3c00a7d4a3d230760e00 |
valid | Packager.merge_options_and_config | Override in subclass if required. | SpiffWorkflow/bpmn/serializer/Packager.py | def merge_options_and_config(cls, config, options, args):
"""
Override in subclass if required.
"""
if args:
config.set(CONFIG_SECTION_NAME, 'input_files', ','.join(args))
elif config.has_option(CONFIG_SECTION_NAME, 'input_files'):
for i in config.get(CONF... | def merge_options_and_config(cls, config, options, args):
"""
Override in subclass if required.
"""
if args:
config.set(CONFIG_SECTION_NAME, 'input_files', ','.join(args))
elif config.has_option(CONFIG_SECTION_NAME, 'input_files'):
for i in config.get(CONF... | [
"Override",
"in",
"subclass",
"if",
"required",
"."
] | knipknap/SpiffWorkflow | python | https://github.com/knipknap/SpiffWorkflow/blob/f0af7f59a332e0619e4f3c00a7d4a3d230760e00/SpiffWorkflow/bpmn/serializer/Packager.py#L441-L459 | [
"def",
"merge_options_and_config",
"(",
"cls",
",",
"config",
",",
"options",
",",
"args",
")",
":",
"if",
"args",
":",
"config",
".",
"set",
"(",
"CONFIG_SECTION_NAME",
",",
"'input_files'",
",",
"','",
".",
"join",
"(",
"args",
")",
")",
"elif",
"confi... | f0af7f59a332e0619e4f3c00a7d4a3d230760e00 |
valid | Packager.merge_option_and_config_str | Utility method to merge an option and config, with the option taking "
precedence | SpiffWorkflow/bpmn/serializer/Packager.py | def merge_option_and_config_str(cls, option_name, config, options):
"""
Utility method to merge an option and config, with the option taking "
precedence
"""
opt = getattr(options, option_name, None)
if opt:
config.set(CONFIG_SECTION_NAME, option_name, opt)
... | def merge_option_and_config_str(cls, option_name, config, options):
"""
Utility method to merge an option and config, with the option taking "
precedence
"""
opt = getattr(options, option_name, None)
if opt:
config.set(CONFIG_SECTION_NAME, option_name, opt)
... | [
"Utility",
"method",
"to",
"merge",
"an",
"option",
"and",
"config",
"with",
"the",
"option",
"taking",
"precedence"
] | knipknap/SpiffWorkflow | python | https://github.com/knipknap/SpiffWorkflow/blob/f0af7f59a332e0619e4f3c00a7d4a3d230760e00/SpiffWorkflow/bpmn/serializer/Packager.py#L462-L473 | [
"def",
"merge_option_and_config_str",
"(",
"cls",
",",
"option_name",
",",
"config",
",",
"options",
")",
":",
"opt",
"=",
"getattr",
"(",
"options",
",",
"option_name",
",",
"None",
")",
"if",
"opt",
":",
"config",
".",
"set",
"(",
"CONFIG_SECTION_NAME",
... | f0af7f59a332e0619e4f3c00a7d4a3d230760e00 |
valid | Packager.create_meta_data | Override in subclass if required. | SpiffWorkflow/bpmn/serializer/Packager.py | def create_meta_data(cls, options, args, parser):
"""
Override in subclass if required.
"""
meta_data = []
meta_data.append(('spiff_version', cls.get_version()))
if options.target_engine:
meta_data.append(('target_engine', options.target_engine))
if op... | def create_meta_data(cls, options, args, parser):
"""
Override in subclass if required.
"""
meta_data = []
meta_data.append(('spiff_version', cls.get_version()))
if options.target_engine:
meta_data.append(('target_engine', options.target_engine))
if op... | [
"Override",
"in",
"subclass",
"if",
"required",
"."
] | knipknap/SpiffWorkflow | python | https://github.com/knipknap/SpiffWorkflow/blob/f0af7f59a332e0619e4f3c00a7d4a3d230760e00/SpiffWorkflow/bpmn/serializer/Packager.py#L476-L487 | [
"def",
"create_meta_data",
"(",
"cls",
",",
"options",
",",
"args",
",",
"parser",
")",
":",
"meta_data",
"=",
"[",
"]",
"meta_data",
".",
"append",
"(",
"(",
"'spiff_version'",
",",
"cls",
".",
"get_version",
"(",
")",
")",
")",
"if",
"options",
".",
... | f0af7f59a332e0619e4f3c00a7d4a3d230760e00 |
valid | ProcessParser.parse_node | Parses the specified child task node, and returns the task spec. This
can be called by a TaskParser instance, that is owned by this
ProcessParser. | SpiffWorkflow/bpmn/parser/ProcessParser.py | def parse_node(self, node):
"""
Parses the specified child task node, and returns the task spec. This
can be called by a TaskParser instance, that is owned by this
ProcessParser.
"""
if node.get('id') in self.parsed_nodes:
return self.parsed_nodes[node.get('i... | def parse_node(self, node):
"""
Parses the specified child task node, and returns the task spec. This
can be called by a TaskParser instance, that is owned by this
ProcessParser.
"""
if node.get('id') in self.parsed_nodes:
return self.parsed_nodes[node.get('i... | [
"Parses",
"the",
"specified",
"child",
"task",
"node",
"and",
"returns",
"the",
"task",
"spec",
".",
"This",
"can",
"be",
"called",
"by",
"a",
"TaskParser",
"instance",
"that",
"is",
"owned",
"by",
"this",
"ProcessParser",
"."
] | knipknap/SpiffWorkflow | python | https://github.com/knipknap/SpiffWorkflow/blob/f0af7f59a332e0619e4f3c00a7d4a3d230760e00/SpiffWorkflow/bpmn/parser/ProcessParser.py#L69-L87 | [
"def",
"parse_node",
"(",
"self",
",",
"node",
")",
":",
"if",
"node",
".",
"get",
"(",
"'id'",
")",
"in",
"self",
".",
"parsed_nodes",
":",
"return",
"self",
".",
"parsed_nodes",
"[",
"node",
".",
"get",
"(",
"'id'",
")",
"]",
"(",
"node_parser",
... | f0af7f59a332e0619e4f3c00a7d4a3d230760e00 |
valid | ProcessParser.get_spec | Parse this process (if it has not already been parsed), and return the
workflow spec. | SpiffWorkflow/bpmn/parser/ProcessParser.py | def get_spec(self):
"""
Parse this process (if it has not already been parsed), and return the
workflow spec.
"""
if self.is_parsed:
return self.spec
if self.parsing_started:
raise NotImplementedError(
'Recursive call Activities are... | def get_spec(self):
"""
Parse this process (if it has not already been parsed), and return the
workflow spec.
"""
if self.is_parsed:
return self.spec
if self.parsing_started:
raise NotImplementedError(
'Recursive call Activities are... | [
"Parse",
"this",
"process",
"(",
"if",
"it",
"has",
"not",
"already",
"been",
"parsed",
")",
"and",
"return",
"the",
"workflow",
"spec",
"."
] | knipknap/SpiffWorkflow | python | https://github.com/knipknap/SpiffWorkflow/blob/f0af7f59a332e0619e4f3c00a7d4a3d230760e00/SpiffWorkflow/bpmn/parser/ProcessParser.py#L118-L129 | [
"def",
"get_spec",
"(",
"self",
")",
":",
"if",
"self",
".",
"is_parsed",
":",
"return",
"self",
".",
"spec",
"if",
"self",
".",
"parsing_started",
":",
"raise",
"NotImplementedError",
"(",
"'Recursive call Activities are not supported.'",
")",
"self",
".",
"_pa... | f0af7f59a332e0619e4f3c00a7d4a3d230760e00 |
valid | MultiInstance._on_trigger | May be called after execute() was already completed to create an
additional outbound task. | SpiffWorkflow/specs/MultiInstance.py | def _on_trigger(self, task_spec):
"""
May be called after execute() was already completed to create an
additional outbound task.
"""
# Find a Task for this TaskSpec.
my_task = self._find_my_task(task_spec)
if my_task._has_state(Task.COMPLETED):
state =... | def _on_trigger(self, task_spec):
"""
May be called after execute() was already completed to create an
additional outbound task.
"""
# Find a Task for this TaskSpec.
my_task = self._find_my_task(task_spec)
if my_task._has_state(Task.COMPLETED):
state =... | [
"May",
"be",
"called",
"after",
"execute",
"()",
"was",
"already",
"completed",
"to",
"create",
"an",
"additional",
"outbound",
"task",
"."
] | knipknap/SpiffWorkflow | python | https://github.com/knipknap/SpiffWorkflow/blob/f0af7f59a332e0619e4f3c00a7d4a3d230760e00/SpiffWorkflow/specs/MultiInstance.py#L63-L77 | [
"def",
"_on_trigger",
"(",
"self",
",",
"task_spec",
")",
":",
"# Find a Task for this TaskSpec.",
"my_task",
"=",
"self",
".",
"_find_my_task",
"(",
"task_spec",
")",
"if",
"my_task",
".",
"_has_state",
"(",
"Task",
".",
"COMPLETED",
")",
":",
"state",
"=",
... | f0af7f59a332e0619e4f3c00a7d4a3d230760e00 |
valid | ThreadSplit.connect | Connect the *following* task to this one. In other words, the
given task is added as an output task.
task -- the task to connect to. | SpiffWorkflow/specs/ThreadSplit.py | def connect(self, task_spec):
"""
Connect the *following* task to this one. In other words, the
given task is added as an output task.
task -- the task to connect to.
"""
self.thread_starter.outputs.append(task_spec)
task_spec._connect_notify(self.thread_starter) | def connect(self, task_spec):
"""
Connect the *following* task to this one. In other words, the
given task is added as an output task.
task -- the task to connect to.
"""
self.thread_starter.outputs.append(task_spec)
task_spec._connect_notify(self.thread_starter) | [
"Connect",
"the",
"*",
"following",
"*",
"task",
"to",
"this",
"one",
".",
"In",
"other",
"words",
"the",
"given",
"task",
"is",
"added",
"as",
"an",
"output",
"task",
"."
] | knipknap/SpiffWorkflow | python | https://github.com/knipknap/SpiffWorkflow/blob/f0af7f59a332e0619e4f3c00a7d4a3d230760e00/SpiffWorkflow/specs/ThreadSplit.py#L70-L78 | [
"def",
"connect",
"(",
"self",
",",
"task_spec",
")",
":",
"self",
".",
"thread_starter",
".",
"outputs",
".",
"append",
"(",
"task_spec",
")",
"task_spec",
".",
"_connect_notify",
"(",
"self",
".",
"thread_starter",
")"
] | f0af7f59a332e0619e4f3c00a7d4a3d230760e00 |
valid | ThreadSplit._get_activated_tasks | Returns the list of tasks that were activated in the previous
call of execute(). Only returns tasks that point towards the
destination task, i.e. those which have destination as a
descendant.
my_task -- the task of this TaskSpec
destination -- the child task | SpiffWorkflow/specs/ThreadSplit.py | def _get_activated_tasks(self, my_task, destination):
"""
Returns the list of tasks that were activated in the previous
call of execute(). Only returns tasks that point towards the
destination task, i.e. those which have destination as a
descendant.
my_task -- the task o... | def _get_activated_tasks(self, my_task, destination):
"""
Returns the list of tasks that were activated in the previous
call of execute(). Only returns tasks that point towards the
destination task, i.e. those which have destination as a
descendant.
my_task -- the task o... | [
"Returns",
"the",
"list",
"of",
"tasks",
"that",
"were",
"activated",
"in",
"the",
"previous",
"call",
"of",
"execute",
"()",
".",
"Only",
"returns",
"tasks",
"that",
"point",
"towards",
"the",
"destination",
"task",
"i",
".",
"e",
".",
"those",
"which",
... | knipknap/SpiffWorkflow | python | https://github.com/knipknap/SpiffWorkflow/blob/f0af7f59a332e0619e4f3c00a7d4a3d230760e00/SpiffWorkflow/specs/ThreadSplit.py#L80-L91 | [
"def",
"_get_activated_tasks",
"(",
"self",
",",
"my_task",
",",
"destination",
")",
":",
"task",
"=",
"destination",
".",
"_find_ancestor",
"(",
"self",
".",
"thread_starter",
")",
"return",
"self",
".",
"thread_starter",
".",
"_get_activated_tasks",
"(",
"task... | f0af7f59a332e0619e4f3c00a7d4a3d230760e00 |
valid | ThreadSplit._on_trigger | May be called after execute() was already completed to create an
additional outbound task. | SpiffWorkflow/specs/ThreadSplit.py | def _on_trigger(self, my_task):
"""
May be called after execute() was already completed to create an
additional outbound task.
"""
for output in self.outputs:
new_task = my_task.add_child(output, Task.READY)
new_task.triggered = True | def _on_trigger(self, my_task):
"""
May be called after execute() was already completed to create an
additional outbound task.
"""
for output in self.outputs:
new_task = my_task.add_child(output, Task.READY)
new_task.triggered = True | [
"May",
"be",
"called",
"after",
"execute",
"()",
"was",
"already",
"completed",
"to",
"create",
"an",
"additional",
"outbound",
"task",
"."
] | knipknap/SpiffWorkflow | python | https://github.com/knipknap/SpiffWorkflow/blob/f0af7f59a332e0619e4f3c00a7d4a3d230760e00/SpiffWorkflow/specs/ThreadSplit.py#L102-L109 | [
"def",
"_on_trigger",
"(",
"self",
",",
"my_task",
")",
":",
"for",
"output",
"in",
"self",
".",
"outputs",
":",
"new_task",
"=",
"my_task",
".",
"add_child",
"(",
"output",
",",
"Task",
".",
"READY",
")",
"new_task",
".",
"triggered",
"=",
"True"
] | f0af7f59a332e0619e4f3c00a7d4a3d230760e00 |
valid | XmlSerializer.deserialize_assign | Reads the "pre-assign" or "post-assign" tag from the given node.
start_node -- the xml node (xml.dom.minidom.Node) | SpiffWorkflow/serializer/prettyxml.py | def deserialize_assign(self, workflow, start_node):
"""
Reads the "pre-assign" or "post-assign" tag from the given node.
start_node -- the xml node (xml.dom.minidom.Node)
"""
name = start_node.getAttribute('name')
attrib = start_node.getAttribute('field')
value =... | def deserialize_assign(self, workflow, start_node):
"""
Reads the "pre-assign" or "post-assign" tag from the given node.
start_node -- the xml node (xml.dom.minidom.Node)
"""
name = start_node.getAttribute('name')
attrib = start_node.getAttribute('field')
value =... | [
"Reads",
"the",
"pre",
"-",
"assign",
"or",
"post",
"-",
"assign",
"tag",
"from",
"the",
"given",
"node",
"."
] | knipknap/SpiffWorkflow | python | https://github.com/knipknap/SpiffWorkflow/blob/f0af7f59a332e0619e4f3c00a7d4a3d230760e00/SpiffWorkflow/serializer/prettyxml.py#L50-L70 | [
"def",
"deserialize_assign",
"(",
"self",
",",
"workflow",
",",
"start_node",
")",
":",
"name",
"=",
"start_node",
".",
"getAttribute",
"(",
"'name'",
")",
"attrib",
"=",
"start_node",
".",
"getAttribute",
"(",
"'field'",
")",
"value",
"=",
"start_node",
"."... | f0af7f59a332e0619e4f3c00a7d4a3d230760e00 |
valid | XmlSerializer.deserialize_data | Reads a "data" or "define" tag from the given node.
start_node -- the xml node (xml.dom.minidom.Node) | SpiffWorkflow/serializer/prettyxml.py | def deserialize_data(self, workflow, start_node):
"""
Reads a "data" or "define" tag from the given node.
start_node -- the xml node (xml.dom.minidom.Node)
"""
name = start_node.getAttribute('name')
value = start_node.getAttribute('value')
return name, value | def deserialize_data(self, workflow, start_node):
"""
Reads a "data" or "define" tag from the given node.
start_node -- the xml node (xml.dom.minidom.Node)
"""
name = start_node.getAttribute('name')
value = start_node.getAttribute('value')
return name, value | [
"Reads",
"a",
"data",
"or",
"define",
"tag",
"from",
"the",
"given",
"node",
"."
] | knipknap/SpiffWorkflow | python | https://github.com/knipknap/SpiffWorkflow/blob/f0af7f59a332e0619e4f3c00a7d4a3d230760e00/SpiffWorkflow/serializer/prettyxml.py#L72-L80 | [
"def",
"deserialize_data",
"(",
"self",
",",
"workflow",
",",
"start_node",
")",
":",
"name",
"=",
"start_node",
".",
"getAttribute",
"(",
"'name'",
")",
"value",
"=",
"start_node",
".",
"getAttribute",
"(",
"'value'",
")",
"return",
"name",
",",
"value"
] | f0af7f59a332e0619e4f3c00a7d4a3d230760e00 |
valid | XmlSerializer.deserialize_assign_list | Reads a list of assignments from the given node.
workflow -- the workflow
start_node -- the xml structure (xml.dom.minidom.Node) | SpiffWorkflow/serializer/prettyxml.py | def deserialize_assign_list(self, workflow, start_node):
"""
Reads a list of assignments from the given node.
workflow -- the workflow
start_node -- the xml structure (xml.dom.minidom.Node)
"""
# Collect all information.
assignments = []
for node in start... | def deserialize_assign_list(self, workflow, start_node):
"""
Reads a list of assignments from the given node.
workflow -- the workflow
start_node -- the xml structure (xml.dom.minidom.Node)
"""
# Collect all information.
assignments = []
for node in start... | [
"Reads",
"a",
"list",
"of",
"assignments",
"from",
"the",
"given",
"node",
"."
] | knipknap/SpiffWorkflow | python | https://github.com/knipknap/SpiffWorkflow/blob/f0af7f59a332e0619e4f3c00a7d4a3d230760e00/SpiffWorkflow/serializer/prettyxml.py#L82-L98 | [
"def",
"deserialize_assign_list",
"(",
"self",
",",
"workflow",
",",
"start_node",
")",
":",
"# Collect all information.",
"assignments",
"=",
"[",
"]",
"for",
"node",
"in",
"start_node",
".",
"childNodes",
":",
"if",
"node",
".",
"nodeType",
"!=",
"minidom",
... | f0af7f59a332e0619e4f3c00a7d4a3d230760e00 |
valid | XmlSerializer.deserialize_logical | Reads the logical tag from the given node, returns a Condition object.
node -- the xml node (xml.dom.minidom.Node) | SpiffWorkflow/serializer/prettyxml.py | def deserialize_logical(self, node):
"""
Reads the logical tag from the given node, returns a Condition object.
node -- the xml node (xml.dom.minidom.Node)
"""
term1_attrib = node.getAttribute('left-field')
term1_value = node.getAttribute('left-value')
op = node.... | def deserialize_logical(self, node):
"""
Reads the logical tag from the given node, returns a Condition object.
node -- the xml node (xml.dom.minidom.Node)
"""
term1_attrib = node.getAttribute('left-field')
term1_value = node.getAttribute('left-value')
op = node.... | [
"Reads",
"the",
"logical",
"tag",
"from",
"the",
"given",
"node",
"returns",
"a",
"Condition",
"object",
"."
] | knipknap/SpiffWorkflow | python | https://github.com/knipknap/SpiffWorkflow/blob/f0af7f59a332e0619e4f3c00a7d4a3d230760e00/SpiffWorkflow/serializer/prettyxml.py#L100-L129 | [
"def",
"deserialize_logical",
"(",
"self",
",",
"node",
")",
":",
"term1_attrib",
"=",
"node",
".",
"getAttribute",
"(",
"'left-field'",
")",
"term1_value",
"=",
"node",
".",
"getAttribute",
"(",
"'left-value'",
")",
"op",
"=",
"node",
".",
"nodeName",
".",
... | f0af7f59a332e0619e4f3c00a7d4a3d230760e00 |
valid | XmlSerializer.deserialize_condition | Reads the conditional statement from the given node.
workflow -- the workflow with which the concurrence is associated
start_node -- the xml structure (xml.dom.minidom.Node) | SpiffWorkflow/serializer/prettyxml.py | def deserialize_condition(self, workflow, start_node):
"""
Reads the conditional statement from the given node.
workflow -- the workflow with which the concurrence is associated
start_node -- the xml structure (xml.dom.minidom.Node)
"""
# Collect all information.
... | def deserialize_condition(self, workflow, start_node):
"""
Reads the conditional statement from the given node.
workflow -- the workflow with which the concurrence is associated
start_node -- the xml structure (xml.dom.minidom.Node)
"""
# Collect all information.
... | [
"Reads",
"the",
"conditional",
"statement",
"from",
"the",
"given",
"node",
"."
] | knipknap/SpiffWorkflow | python | https://github.com/knipknap/SpiffWorkflow/blob/f0af7f59a332e0619e4f3c00a7d4a3d230760e00/SpiffWorkflow/serializer/prettyxml.py#L131-L161 | [
"def",
"deserialize_condition",
"(",
"self",
",",
"workflow",
",",
"start_node",
")",
":",
"# Collect all information.",
"condition",
"=",
"None",
"spec_name",
"=",
"None",
"for",
"node",
"in",
"start_node",
".",
"childNodes",
":",
"if",
"node",
".",
"nodeType",... | f0af7f59a332e0619e4f3c00a7d4a3d230760e00 |
valid | XmlSerializer.deserialize_task_spec | Reads the task from the given node and returns a tuple
(start, end) that contains the stream of objects that model
the behavior.
workflow -- the workflow with which the task is associated
start_node -- the xml structure (xml.dom.minidom.Node) | SpiffWorkflow/serializer/prettyxml.py | def deserialize_task_spec(self, workflow, start_node, read_specs):
"""
Reads the task from the given node and returns a tuple
(start, end) that contains the stream of objects that model
the behavior.
workflow -- the workflow with which the task is associated
start_node -... | def deserialize_task_spec(self, workflow, start_node, read_specs):
"""
Reads the task from the given node and returns a tuple
(start, end) that contains the stream of objects that model
the behavior.
workflow -- the workflow with which the task is associated
start_node -... | [
"Reads",
"the",
"task",
"from",
"the",
"given",
"node",
"and",
"returns",
"a",
"tuple",
"(",
"start",
"end",
")",
"that",
"contains",
"the",
"stream",
"of",
"objects",
"that",
"model",
"the",
"behavior",
"."
] | knipknap/SpiffWorkflow | python | https://github.com/knipknap/SpiffWorkflow/blob/f0af7f59a332e0619e4f3c00a7d4a3d230760e00/SpiffWorkflow/serializer/prettyxml.py#L163-L288 | [
"def",
"deserialize_task_spec",
"(",
"self",
",",
"workflow",
",",
"start_node",
",",
"read_specs",
")",
":",
"# Extract attributes from the node.",
"nodetype",
"=",
"start_node",
".",
"nodeName",
".",
"lower",
"(",
")",
"name",
"=",
"start_node",
".",
"getAttribu... | f0af7f59a332e0619e4f3c00a7d4a3d230760e00 |
valid | XmlSerializer.deserialize_workflow_spec | Reads the workflow from the given XML structure and returns a
WorkflowSpec instance. | SpiffWorkflow/serializer/prettyxml.py | def deserialize_workflow_spec(self, s_state, filename=None):
"""
Reads the workflow from the given XML structure and returns a
WorkflowSpec instance.
"""
dom = minidom.parseString(s_state)
node = dom.getElementsByTagName('process-definition')[0]
name = node.getAtt... | def deserialize_workflow_spec(self, s_state, filename=None):
"""
Reads the workflow from the given XML structure and returns a
WorkflowSpec instance.
"""
dom = minidom.parseString(s_state)
node = dom.getElementsByTagName('process-definition')[0]
name = node.getAtt... | [
"Reads",
"the",
"workflow",
"from",
"the",
"given",
"XML",
"structure",
"and",
"returns",
"a",
"WorkflowSpec",
"instance",
"."
] | knipknap/SpiffWorkflow | python | https://github.com/knipknap/SpiffWorkflow/blob/f0af7f59a332e0619e4f3c00a7d4a3d230760e00/SpiffWorkflow/serializer/prettyxml.py#L290-L333 | [
"def",
"deserialize_workflow_spec",
"(",
"self",
",",
"s_state",
",",
"filename",
"=",
"None",
")",
":",
"dom",
"=",
"minidom",
".",
"parseString",
"(",
"s_state",
")",
"node",
"=",
"dom",
".",
"getElementsByTagName",
"(",
"'process-definition'",
")",
"[",
"... | f0af7f59a332e0619e4f3c00a7d4a3d230760e00 |
valid | TimerEventDefinition.has_fired | The Timer is considered to have fired if the evaluated dateTime
expression is before datetime.datetime.now() | SpiffWorkflow/bpmn/specs/event_definitions.py | def has_fired(self, my_task):
"""
The Timer is considered to have fired if the evaluated dateTime
expression is before datetime.datetime.now()
"""
dt = my_task.workflow.script_engine.evaluate(my_task, self.dateTime)
if dt is None:
return False
if dt.tz... | def has_fired(self, my_task):
"""
The Timer is considered to have fired if the evaluated dateTime
expression is before datetime.datetime.now()
"""
dt = my_task.workflow.script_engine.evaluate(my_task, self.dateTime)
if dt is None:
return False
if dt.tz... | [
"The",
"Timer",
"is",
"considered",
"to",
"have",
"fired",
"if",
"the",
"evaluated",
"dateTime",
"expression",
"is",
"before",
"datetime",
".",
"datetime",
".",
"now",
"()"
] | knipknap/SpiffWorkflow | python | https://github.com/knipknap/SpiffWorkflow/blob/f0af7f59a332e0619e4f3c00a7d4a3d230760e00/SpiffWorkflow/bpmn/specs/event_definitions.py#L98-L111 | [
"def",
"has_fired",
"(",
"self",
",",
"my_task",
")",
":",
"dt",
"=",
"my_task",
".",
"workflow",
".",
"script_engine",
".",
"evaluate",
"(",
"my_task",
",",
"self",
".",
"dateTime",
")",
"if",
"dt",
"is",
"None",
":",
"return",
"False",
"if",
"dt",
... | f0af7f59a332e0619e4f3c00a7d4a3d230760e00 |
valid | WorkflowSpec._add_notify | Called by a task spec when it was added into the workflow. | SpiffWorkflow/specs/WorkflowSpec.py | def _add_notify(self, task_spec):
"""
Called by a task spec when it was added into the workflow.
"""
if task_spec.name in self.task_specs:
raise KeyError('Duplicate task spec name: ' + task_spec.name)
self.task_specs[task_spec.name] = task_spec
task_spec.id = ... | def _add_notify(self, task_spec):
"""
Called by a task spec when it was added into the workflow.
"""
if task_spec.name in self.task_specs:
raise KeyError('Duplicate task spec name: ' + task_spec.name)
self.task_specs[task_spec.name] = task_spec
task_spec.id = ... | [
"Called",
"by",
"a",
"task",
"spec",
"when",
"it",
"was",
"added",
"into",
"the",
"workflow",
"."
] | knipknap/SpiffWorkflow | python | https://github.com/knipknap/SpiffWorkflow/blob/f0af7f59a332e0619e4f3c00a7d4a3d230760e00/SpiffWorkflow/specs/WorkflowSpec.py#L47-L54 | [
"def",
"_add_notify",
"(",
"self",
",",
"task_spec",
")",
":",
"if",
"task_spec",
".",
"name",
"in",
"self",
".",
"task_specs",
":",
"raise",
"KeyError",
"(",
"'Duplicate task spec name: '",
"+",
"task_spec",
".",
"name",
")",
"self",
".",
"task_specs",
"[",... | f0af7f59a332e0619e4f3c00a7d4a3d230760e00 |
valid | WorkflowSpec.validate | Checks integrity of workflow and reports any problems with it.
Detects:
- loops (tasks that wait on each other in a loop)
:returns: empty list if valid, a list of errors if not | SpiffWorkflow/specs/WorkflowSpec.py | def validate(self):
"""Checks integrity of workflow and reports any problems with it.
Detects:
- loops (tasks that wait on each other in a loop)
:returns: empty list if valid, a list of errors if not
"""
results = []
from ..specs import Join
def recursiv... | def validate(self):
"""Checks integrity of workflow and reports any problems with it.
Detects:
- loops (tasks that wait on each other in a loop)
:returns: empty list if valid, a list of errors if not
"""
results = []
from ..specs import Join
def recursiv... | [
"Checks",
"integrity",
"of",
"workflow",
"and",
"reports",
"any",
"problems",
"with",
"it",
"."
] | knipknap/SpiffWorkflow | python | https://github.com/knipknap/SpiffWorkflow/blob/f0af7f59a332e0619e4f3c00a7d4a3d230760e00/SpiffWorkflow/specs/WorkflowSpec.py#L67-L107 | [
"def",
"validate",
"(",
"self",
")",
":",
"results",
"=",
"[",
"]",
"from",
".",
".",
"specs",
"import",
"Join",
"def",
"recursive_find_loop",
"(",
"task",
",",
"history",
")",
":",
"current",
"=",
"history",
"[",
":",
"]",
"current",
".",
"append",
... | f0af7f59a332e0619e4f3c00a7d4a3d230760e00 |
valid | BpmnWorkflow.accept_message | Indicate to the workflow that a message has been received. The message
will be processed by any waiting Intermediate or Boundary Message
Events, that are waiting for the message. | SpiffWorkflow/bpmn/workflow.py | def accept_message(self, message):
"""
Indicate to the workflow that a message has been received. The message
will be processed by any waiting Intermediate or Boundary Message
Events, that are waiting for the message.
"""
assert not self.read_only
self.refresh_wai... | def accept_message(self, message):
"""
Indicate to the workflow that a message has been received. The message
will be processed by any waiting Intermediate or Boundary Message
Events, that are waiting for the message.
"""
assert not self.read_only
self.refresh_wai... | [
"Indicate",
"to",
"the",
"workflow",
"that",
"a",
"message",
"has",
"been",
"received",
".",
"The",
"message",
"will",
"be",
"processed",
"by",
"any",
"waiting",
"Intermediate",
"or",
"Boundary",
"Message",
"Events",
"that",
"are",
"waiting",
"for",
"the",
"... | knipknap/SpiffWorkflow | python | https://github.com/knipknap/SpiffWorkflow/blob/f0af7f59a332e0619e4f3c00a7d4a3d230760e00/SpiffWorkflow/bpmn/workflow.py#L51-L61 | [
"def",
"accept_message",
"(",
"self",
",",
"message",
")",
":",
"assert",
"not",
"self",
".",
"read_only",
"self",
".",
"refresh_waiting_tasks",
"(",
")",
"self",
".",
"do_engine_steps",
"(",
")",
"for",
"my_task",
"in",
"Task",
".",
"Iterator",
"(",
"self... | f0af7f59a332e0619e4f3c00a7d4a3d230760e00 |
valid | BpmnWorkflow.do_engine_steps | Execute any READY tasks that are engine specific (for example, gateways
or script tasks). This is done in a loop, so it will keep completing
those tasks until there are only READY User tasks, or WAITING tasks
left. | SpiffWorkflow/bpmn/workflow.py | def do_engine_steps(self):
"""
Execute any READY tasks that are engine specific (for example, gateways
or script tasks). This is done in a loop, so it will keep completing
those tasks until there are only READY User tasks, or WAITING tasks
left.
"""
assert not sel... | def do_engine_steps(self):
"""
Execute any READY tasks that are engine specific (for example, gateways
or script tasks). This is done in a loop, so it will keep completing
those tasks until there are only READY User tasks, or WAITING tasks
left.
"""
assert not sel... | [
"Execute",
"any",
"READY",
"tasks",
"that",
"are",
"engine",
"specific",
"(",
"for",
"example",
"gateways",
"or",
"script",
"tasks",
")",
".",
"This",
"is",
"done",
"in",
"a",
"loop",
"so",
"it",
"will",
"keep",
"completing",
"those",
"tasks",
"until",
"... | knipknap/SpiffWorkflow | python | https://github.com/knipknap/SpiffWorkflow/blob/f0af7f59a332e0619e4f3c00a7d4a3d230760e00/SpiffWorkflow/bpmn/workflow.py#L63-L79 | [
"def",
"do_engine_steps",
"(",
"self",
")",
":",
"assert",
"not",
"self",
".",
"read_only",
"engine_steps",
"=",
"list",
"(",
"[",
"t",
"for",
"t",
"in",
"self",
".",
"get_tasks",
"(",
"Task",
".",
"READY",
")",
"if",
"self",
".",
"_is_engine_task",
"(... | f0af7f59a332e0619e4f3c00a7d4a3d230760e00 |
valid | BpmnWorkflow.refresh_waiting_tasks | Refresh the state of all WAITING tasks. This will, for example, update
Catching Timer Events whose waiting time has passed. | SpiffWorkflow/bpmn/workflow.py | def refresh_waiting_tasks(self):
"""
Refresh the state of all WAITING tasks. This will, for example, update
Catching Timer Events whose waiting time has passed.
"""
assert not self.read_only
for my_task in self.get_tasks(Task.WAITING):
my_task.task_spec._updat... | def refresh_waiting_tasks(self):
"""
Refresh the state of all WAITING tasks. This will, for example, update
Catching Timer Events whose waiting time has passed.
"""
assert not self.read_only
for my_task in self.get_tasks(Task.WAITING):
my_task.task_spec._updat... | [
"Refresh",
"the",
"state",
"of",
"all",
"WAITING",
"tasks",
".",
"This",
"will",
"for",
"example",
"update",
"Catching",
"Timer",
"Events",
"whose",
"waiting",
"time",
"has",
"passed",
"."
] | knipknap/SpiffWorkflow | python | https://github.com/knipknap/SpiffWorkflow/blob/f0af7f59a332e0619e4f3c00a7d4a3d230760e00/SpiffWorkflow/bpmn/workflow.py#L81-L88 | [
"def",
"refresh_waiting_tasks",
"(",
"self",
")",
":",
"assert",
"not",
"self",
".",
"read_only",
"for",
"my_task",
"in",
"self",
".",
"get_tasks",
"(",
"Task",
".",
"WAITING",
")",
":",
"my_task",
".",
"task_spec",
".",
"_update",
"(",
"my_task",
")"
] | f0af7f59a332e0619e4f3c00a7d4a3d230760e00 |
valid | BpmnWorkflow.get_ready_user_tasks | Returns a list of User Tasks that are READY for user action | SpiffWorkflow/bpmn/workflow.py | def get_ready_user_tasks(self):
"""
Returns a list of User Tasks that are READY for user action
"""
return [t for t in self.get_tasks(Task.READY)
if not self._is_engine_task(t.task_spec)] | def get_ready_user_tasks(self):
"""
Returns a list of User Tasks that are READY for user action
"""
return [t for t in self.get_tasks(Task.READY)
if not self._is_engine_task(t.task_spec)] | [
"Returns",
"a",
"list",
"of",
"User",
"Tasks",
"that",
"are",
"READY",
"for",
"user",
"action"
] | knipknap/SpiffWorkflow | python | https://github.com/knipknap/SpiffWorkflow/blob/f0af7f59a332e0619e4f3c00a7d4a3d230760e00/SpiffWorkflow/bpmn/workflow.py#L90-L95 | [
"def",
"get_ready_user_tasks",
"(",
"self",
")",
":",
"return",
"[",
"t",
"for",
"t",
"in",
"self",
".",
"get_tasks",
"(",
"Task",
".",
"READY",
")",
"if",
"not",
"self",
".",
"_is_engine_task",
"(",
"t",
".",
"task_spec",
")",
"]"
] | f0af7f59a332e0619e4f3c00a7d4a3d230760e00 |
valid | Trigger._on_trigger | Enqueue a trigger, such that this tasks triggers multiple times later
when _on_complete() is called. | SpiffWorkflow/specs/Trigger.py | def _on_trigger(self, my_task):
"""
Enqueue a trigger, such that this tasks triggers multiple times later
when _on_complete() is called.
"""
self.queued += 1
# All tasks that have already completed need to be put back to
# READY.
for thetask in my_task.wor... | def _on_trigger(self, my_task):
"""
Enqueue a trigger, such that this tasks triggers multiple times later
when _on_complete() is called.
"""
self.queued += 1
# All tasks that have already completed need to be put back to
# READY.
for thetask in my_task.wor... | [
"Enqueue",
"a",
"trigger",
"such",
"that",
"this",
"tasks",
"triggers",
"multiple",
"times",
"later",
"when",
"_on_complete",
"()",
"is",
"called",
"."
] | knipknap/SpiffWorkflow | python | https://github.com/knipknap/SpiffWorkflow/blob/f0af7f59a332e0619e4f3c00a7d4a3d230760e00/SpiffWorkflow/specs/Trigger.py#L60-L74 | [
"def",
"_on_trigger",
"(",
"self",
",",
"my_task",
")",
":",
"self",
".",
"queued",
"+=",
"1",
"# All tasks that have already completed need to be put back to",
"# READY.",
"for",
"thetask",
"in",
"my_task",
".",
"workflow",
".",
"task_tree",
":",
"if",
"thetask",
... | f0af7f59a332e0619e4f3c00a7d4a3d230760e00 |
valid | Trigger._on_complete_hook | A hook into _on_complete() that does the task specific work.
:type my_task: Task
:param my_task: A task in which this method is executed.
:rtype: bool
:returns: True on success, False otherwise. | SpiffWorkflow/specs/Trigger.py | def _on_complete_hook(self, my_task):
"""
A hook into _on_complete() that does the task specific work.
:type my_task: Task
:param my_task: A task in which this method is executed.
:rtype: bool
:returns: True on success, False otherwise.
"""
times = int(... | def _on_complete_hook(self, my_task):
"""
A hook into _on_complete() that does the task specific work.
:type my_task: Task
:param my_task: A task in which this method is executed.
:rtype: bool
:returns: True on success, False otherwise.
"""
times = int(... | [
"A",
"hook",
"into",
"_on_complete",
"()",
"that",
"does",
"the",
"task",
"specific",
"work",
"."
] | knipknap/SpiffWorkflow | python | https://github.com/knipknap/SpiffWorkflow/blob/f0af7f59a332e0619e4f3c00a7d4a3d230760e00/SpiffWorkflow/specs/Trigger.py#L76-L91 | [
"def",
"_on_complete_hook",
"(",
"self",
",",
"my_task",
")",
":",
"times",
"=",
"int",
"(",
"valueof",
"(",
"my_task",
",",
"self",
".",
"times",
",",
"1",
")",
")",
"+",
"self",
".",
"queued",
"for",
"i",
"in",
"range",
"(",
"times",
")",
":",
... | f0af7f59a332e0619e4f3c00a7d4a3d230760e00 |
valid | Trigger.deserialize | Deserializes the trigger using the provided serializer. | SpiffWorkflow/specs/Trigger.py | def deserialize(cls, serializer, wf_spec, s_state, **kwargs):
"""
Deserializes the trigger using the provided serializer.
"""
return serializer.deserialize_trigger(wf_spec,
s_state,
**kwargs) | def deserialize(cls, serializer, wf_spec, s_state, **kwargs):
"""
Deserializes the trigger using the provided serializer.
"""
return serializer.deserialize_trigger(wf_spec,
s_state,
**kwargs) | [
"Deserializes",
"the",
"trigger",
"using",
"the",
"provided",
"serializer",
"."
] | knipknap/SpiffWorkflow | python | https://github.com/knipknap/SpiffWorkflow/blob/f0af7f59a332e0619e4f3c00a7d4a3d230760e00/SpiffWorkflow/specs/Trigger.py#L97-L103 | [
"def",
"deserialize",
"(",
"cls",
",",
"serializer",
",",
"wf_spec",
",",
"s_state",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"serializer",
".",
"deserialize_trigger",
"(",
"wf_spec",
",",
"s_state",
",",
"*",
"*",
"kwargs",
")"
] | f0af7f59a332e0619e4f3c00a7d4a3d230760e00 |
valid | BpmnScriptEngine.evaluate | Evaluate the given expression, within the context of the given task and
return the result. | SpiffWorkflow/bpmn/BpmnScriptEngine.py | def evaluate(self, task, expression):
"""
Evaluate the given expression, within the context of the given task and
return the result.
"""
if isinstance(expression, Operator):
return expression._matches(task)
else:
return self._eval(task, expression,... | def evaluate(self, task, expression):
"""
Evaluate the given expression, within the context of the given task and
return the result.
"""
if isinstance(expression, Operator):
return expression._matches(task)
else:
return self._eval(task, expression,... | [
"Evaluate",
"the",
"given",
"expression",
"within",
"the",
"context",
"of",
"the",
"given",
"task",
"and",
"return",
"the",
"result",
"."
] | knipknap/SpiffWorkflow | python | https://github.com/knipknap/SpiffWorkflow/blob/f0af7f59a332e0619e4f3c00a7d4a3d230760e00/SpiffWorkflow/bpmn/BpmnScriptEngine.py#L37-L45 | [
"def",
"evaluate",
"(",
"self",
",",
"task",
",",
"expression",
")",
":",
"if",
"isinstance",
"(",
"expression",
",",
"Operator",
")",
":",
"return",
"expression",
".",
"_matches",
"(",
"task",
")",
"else",
":",
"return",
"self",
".",
"_eval",
"(",
"ta... | f0af7f59a332e0619e4f3c00a7d4a3d230760e00 |
valid | BpmnScriptEngine.execute | Execute the script, within the context of the specified task | SpiffWorkflow/bpmn/BpmnScriptEngine.py | def execute(self, task, script, **kwargs):
"""
Execute the script, within the context of the specified task
"""
locals().update(kwargs)
exec(script) | def execute(self, task, script, **kwargs):
"""
Execute the script, within the context of the specified task
"""
locals().update(kwargs)
exec(script) | [
"Execute",
"the",
"script",
"within",
"the",
"context",
"of",
"the",
"specified",
"task"
] | knipknap/SpiffWorkflow | python | https://github.com/knipknap/SpiffWorkflow/blob/f0af7f59a332e0619e4f3c00a7d4a3d230760e00/SpiffWorkflow/bpmn/BpmnScriptEngine.py#L47-L52 | [
"def",
"execute",
"(",
"self",
",",
"task",
",",
"script",
",",
"*",
"*",
"kwargs",
")",
":",
"locals",
"(",
")",
".",
"update",
"(",
"kwargs",
")",
"exec",
"(",
"script",
")"
] | f0af7f59a332e0619e4f3c00a7d4a3d230760e00 |
valid | merge_dictionary | Recursive merge two dicts (vs .update which overwrites the hashes at the
root level)
Note: This updates dst.
Copied from checkmate.utils | SpiffWorkflow/util/__init__.py | def merge_dictionary(dst, src):
"""Recursive merge two dicts (vs .update which overwrites the hashes at the
root level)
Note: This updates dst.
Copied from checkmate.utils
"""
stack = [(dst, src)]
while stack:
current_dst, current_src = stack.pop()
for key in current_src:
... | def merge_dictionary(dst, src):
"""Recursive merge two dicts (vs .update which overwrites the hashes at the
root level)
Note: This updates dst.
Copied from checkmate.utils
"""
stack = [(dst, src)]
while stack:
current_dst, current_src = stack.pop()
for key in current_src:
... | [
"Recursive",
"merge",
"two",
"dicts",
"(",
"vs",
".",
"update",
"which",
"overwrites",
"the",
"hashes",
"at",
"the",
"root",
"level",
")"
] | knipknap/SpiffWorkflow | python | https://github.com/knipknap/SpiffWorkflow/blob/f0af7f59a332e0619e4f3c00a7d4a3d230760e00/SpiffWorkflow/util/__init__.py#L6-L46 | [
"def",
"merge_dictionary",
"(",
"dst",
",",
"src",
")",
":",
"stack",
"=",
"[",
"(",
"dst",
",",
"src",
")",
"]",
"while",
"stack",
":",
"current_dst",
",",
"current_src",
"=",
"stack",
".",
"pop",
"(",
")",
"for",
"key",
"in",
"current_src",
":",
... | f0af7f59a332e0619e4f3c00a7d4a3d230760e00 |
valid | Join._start | Checks whether the preconditions for going to READY state are met.
Returns True if the threshold was reached, False otherwise.
Also returns the list of tasks that yet need to be completed. | SpiffWorkflow/specs/Join.py | def _start(self, my_task, force=False):
"""
Checks whether the preconditions for going to READY state are met.
Returns True if the threshold was reached, False otherwise.
Also returns the list of tasks that yet need to be completed.
"""
# If the threshold was already reac... | def _start(self, my_task, force=False):
"""
Checks whether the preconditions for going to READY state are met.
Returns True if the threshold was reached, False otherwise.
Also returns the list of tasks that yet need to be completed.
"""
# If the threshold was already reac... | [
"Checks",
"whether",
"the",
"preconditions",
"for",
"going",
"to",
"READY",
"state",
"are",
"met",
".",
"Returns",
"True",
"if",
"the",
"threshold",
"was",
"reached",
"False",
"otherwise",
".",
"Also",
"returns",
"the",
"list",
"of",
"tasks",
"that",
"yet",
... | knipknap/SpiffWorkflow | python | https://github.com/knipknap/SpiffWorkflow/blob/f0af7f59a332e0619e4f3c00a7d4a3d230760e00/SpiffWorkflow/specs/Join.py#L187-L202 | [
"def",
"_start",
"(",
"self",
",",
"my_task",
",",
"force",
"=",
"False",
")",
":",
"# If the threshold was already reached, there is nothing else to do.",
"if",
"my_task",
".",
"_has_state",
"(",
"Task",
".",
"COMPLETED",
")",
":",
"return",
"True",
",",
"None",
... | f0af7f59a332e0619e4f3c00a7d4a3d230760e00 |
valid | Join._on_trigger | May be called to fire the Join before the incoming branches are
completed. | SpiffWorkflow/specs/Join.py | def _on_trigger(self, my_task):
"""
May be called to fire the Join before the incoming branches are
completed.
"""
for task in my_task.workflow.task_tree._find_any(self):
if task.thread_id != my_task.thread_id:
continue
self._do_join(task) | def _on_trigger(self, my_task):
"""
May be called to fire the Join before the incoming branches are
completed.
"""
for task in my_task.workflow.task_tree._find_any(self):
if task.thread_id != my_task.thread_id:
continue
self._do_join(task) | [
"May",
"be",
"called",
"to",
"fire",
"the",
"Join",
"before",
"the",
"incoming",
"branches",
"are",
"completed",
"."
] | knipknap/SpiffWorkflow | python | https://github.com/knipknap/SpiffWorkflow/blob/f0af7f59a332e0619e4f3c00a7d4a3d230760e00/SpiffWorkflow/specs/Join.py#L284-L292 | [
"def",
"_on_trigger",
"(",
"self",
",",
"my_task",
")",
":",
"for",
"task",
"in",
"my_task",
".",
"workflow",
".",
"task_tree",
".",
"_find_any",
"(",
"self",
")",
":",
"if",
"task",
".",
"thread_id",
"!=",
"my_task",
".",
"thread_id",
":",
"continue",
... | f0af7f59a332e0619e4f3c00a7d4a3d230760e00 |
valid | ExclusiveChoice.connect | Connects the task spec that is executed if no other condition
matches.
:type task_spec: TaskSpec
:param task_spec: The following task spec. | SpiffWorkflow/specs/ExclusiveChoice.py | def connect(self, task_spec):
"""
Connects the task spec that is executed if no other condition
matches.
:type task_spec: TaskSpec
:param task_spec: The following task spec.
"""
assert self.default_task_spec is None
self.outputs.append(task_spec)
... | def connect(self, task_spec):
"""
Connects the task spec that is executed if no other condition
matches.
:type task_spec: TaskSpec
:param task_spec: The following task spec.
"""
assert self.default_task_spec is None
self.outputs.append(task_spec)
... | [
"Connects",
"the",
"task",
"spec",
"that",
"is",
"executed",
"if",
"no",
"other",
"condition",
"matches",
"."
] | knipknap/SpiffWorkflow | python | https://github.com/knipknap/SpiffWorkflow/blob/f0af7f59a332e0619e4f3c00a7d4a3d230760e00/SpiffWorkflow/specs/ExclusiveChoice.py#L47-L58 | [
"def",
"connect",
"(",
"self",
",",
"task_spec",
")",
":",
"assert",
"self",
".",
"default_task_spec",
"is",
"None",
"self",
".",
"outputs",
".",
"append",
"(",
"task_spec",
")",
"self",
".",
"default_task_spec",
"=",
"task_spec",
".",
"name",
"task_spec",
... | f0af7f59a332e0619e4f3c00a7d4a3d230760e00 |
valid | BlockadeState.container_id | Try to find the container ID with the specified name | blockade/state.py | def container_id(self, name):
'''Try to find the container ID with the specified name'''
container = self._containers.get(name, None)
if not container is None:
return container.get('id', None)
return None | def container_id(self, name):
'''Try to find the container ID with the specified name'''
container = self._containers.get(name, None)
if not container is None:
return container.get('id', None)
return None | [
"Try",
"to",
"find",
"the",
"container",
"ID",
"with",
"the",
"specified",
"name"
] | worstcase/blockade | python | https://github.com/worstcase/blockade/blob/3dc6ad803f0b0d56586dec9542a6a06aa06cf569/blockade/state.py#L84-L89 | [
"def",
"container_id",
"(",
"self",
",",
"name",
")",
":",
"container",
"=",
"self",
".",
"_containers",
".",
"get",
"(",
"name",
",",
"None",
")",
"if",
"not",
"container",
"is",
"None",
":",
"return",
"container",
".",
"get",
"(",
"'id'",
",",
"Non... | 3dc6ad803f0b0d56586dec9542a6a06aa06cf569 |
valid | BlockadeState.initialize | Initialize a new state file with the given contents.
This function fails in case the state file already exists. | blockade/state.py | def initialize(self, containers):
'''
Initialize a new state file with the given contents.
This function fails in case the state file already exists.
'''
self._containers = deepcopy(containers)
self.__write(containers, initialize=True) | def initialize(self, containers):
'''
Initialize a new state file with the given contents.
This function fails in case the state file already exists.
'''
self._containers = deepcopy(containers)
self.__write(containers, initialize=True) | [
"Initialize",
"a",
"new",
"state",
"file",
"with",
"the",
"given",
"contents",
".",
"This",
"function",
"fails",
"in",
"case",
"the",
"state",
"file",
"already",
"exists",
"."
] | worstcase/blockade | python | https://github.com/worstcase/blockade/blob/3dc6ad803f0b0d56586dec9542a6a06aa06cf569/blockade/state.py#L91-L97 | [
"def",
"initialize",
"(",
"self",
",",
"containers",
")",
":",
"self",
".",
"_containers",
"=",
"deepcopy",
"(",
"containers",
")",
"self",
".",
"__write",
"(",
"containers",
",",
"initialize",
"=",
"True",
")"
] | 3dc6ad803f0b0d56586dec9542a6a06aa06cf569 |
valid | BlockadeState.update | Update the current state file with the specified contents | blockade/state.py | def update(self, containers):
'''Update the current state file with the specified contents'''
self._containers = deepcopy(containers)
self.__write(containers, initialize=False) | def update(self, containers):
'''Update the current state file with the specified contents'''
self._containers = deepcopy(containers)
self.__write(containers, initialize=False) | [
"Update",
"the",
"current",
"state",
"file",
"with",
"the",
"specified",
"contents"
] | worstcase/blockade | python | https://github.com/worstcase/blockade/blob/3dc6ad803f0b0d56586dec9542a6a06aa06cf569/blockade/state.py#L103-L106 | [
"def",
"update",
"(",
"self",
",",
"containers",
")",
":",
"self",
".",
"_containers",
"=",
"deepcopy",
"(",
"containers",
")",
"self",
".",
"__write",
"(",
"containers",
",",
"initialize",
"=",
"False",
")"
] | 3dc6ad803f0b0d56586dec9542a6a06aa06cf569 |
valid | BlockadeState.load | Try to load a blockade state file in the current directory | blockade/state.py | def load(self):
'''Try to load a blockade state file in the current directory'''
try:
with open(self._state_file) as f:
state = yaml.safe_load(f)
self._containers = state['containers']
except (IOError, OSError) as err:
if err.errno == errno... | def load(self):
'''Try to load a blockade state file in the current directory'''
try:
with open(self._state_file) as f:
state = yaml.safe_load(f)
self._containers = state['containers']
except (IOError, OSError) as err:
if err.errno == errno... | [
"Try",
"to",
"load",
"a",
"blockade",
"state",
"file",
"in",
"the",
"current",
"directory"
] | worstcase/blockade | python | https://github.com/worstcase/blockade/blob/3dc6ad803f0b0d56586dec9542a6a06aa06cf569/blockade/state.py#L108-L121 | [
"def",
"load",
"(",
"self",
")",
":",
"try",
":",
"with",
"open",
"(",
"self",
".",
"_state_file",
")",
"as",
"f",
":",
"state",
"=",
"yaml",
".",
"safe_load",
"(",
"f",
")",
"self",
".",
"_containers",
"=",
"state",
"[",
"'containers'",
"]",
"exce... | 3dc6ad803f0b0d56586dec9542a6a06aa06cf569 |
valid | BlockadeState._get_blockade_id_from_cwd | Generate a new blockade ID based on the CWD | blockade/state.py | def _get_blockade_id_from_cwd(self, cwd=None):
'''Generate a new blockade ID based on the CWD'''
if not cwd:
cwd = os.getcwd()
# this follows a similar pattern as docker-compose uses
parent_dir = os.path.abspath(cwd)
basename = os.path.basename(parent_dir).lower()
... | def _get_blockade_id_from_cwd(self, cwd=None):
'''Generate a new blockade ID based on the CWD'''
if not cwd:
cwd = os.getcwd()
# this follows a similar pattern as docker-compose uses
parent_dir = os.path.abspath(cwd)
basename = os.path.basename(parent_dir).lower()
... | [
"Generate",
"a",
"new",
"blockade",
"ID",
"based",
"on",
"the",
"CWD"
] | worstcase/blockade | python | https://github.com/worstcase/blockade/blob/3dc6ad803f0b0d56586dec9542a6a06aa06cf569/blockade/state.py#L127-L137 | [
"def",
"_get_blockade_id_from_cwd",
"(",
"self",
",",
"cwd",
"=",
"None",
")",
":",
"if",
"not",
"cwd",
":",
"cwd",
"=",
"os",
".",
"getcwd",
"(",
")",
"# this follows a similar pattern as docker-compose uses",
"parent_dir",
"=",
"os",
".",
"path",
".",
"abspa... | 3dc6ad803f0b0d56586dec9542a6a06aa06cf569 |
valid | BlockadeState._assure_dir | Make sure the state directory exists | blockade/state.py | def _assure_dir(self):
'''Make sure the state directory exists'''
try:
os.makedirs(self._state_dir)
except OSError as err:
if err.errno != errno.EEXIST:
raise | def _assure_dir(self):
'''Make sure the state directory exists'''
try:
os.makedirs(self._state_dir)
except OSError as err:
if err.errno != errno.EEXIST:
raise | [
"Make",
"sure",
"the",
"state",
"directory",
"exists"
] | worstcase/blockade | python | https://github.com/worstcase/blockade/blob/3dc6ad803f0b0d56586dec9542a6a06aa06cf569/blockade/state.py#L139-L145 | [
"def",
"_assure_dir",
"(",
"self",
")",
":",
"try",
":",
"os",
".",
"makedirs",
"(",
"self",
".",
"_state_dir",
")",
"except",
"OSError",
"as",
"err",
":",
"if",
"err",
".",
"errno",
"!=",
"errno",
".",
"EEXIST",
":",
"raise"
] | 3dc6ad803f0b0d56586dec9542a6a06aa06cf569 |
valid | BlockadeState._state_delete | Try to delete the state.yml file and the folder .blockade | blockade/state.py | def _state_delete(self):
'''Try to delete the state.yml file and the folder .blockade'''
try:
os.remove(self._state_file)
except OSError as err:
if err.errno not in (errno.EPERM, errno.ENOENT):
raise
try:
os.rmdir(self._state_dir)
... | def _state_delete(self):
'''Try to delete the state.yml file and the folder .blockade'''
try:
os.remove(self._state_file)
except OSError as err:
if err.errno not in (errno.EPERM, errno.ENOENT):
raise
try:
os.rmdir(self._state_dir)
... | [
"Try",
"to",
"delete",
"the",
"state",
".",
"yml",
"file",
"and",
"the",
"folder",
".",
"blockade"
] | worstcase/blockade | python | https://github.com/worstcase/blockade/blob/3dc6ad803f0b0d56586dec9542a6a06aa06cf569/blockade/state.py#L147-L159 | [
"def",
"_state_delete",
"(",
"self",
")",
":",
"try",
":",
"os",
".",
"remove",
"(",
"self",
".",
"_state_file",
")",
"except",
"OSError",
"as",
"err",
":",
"if",
"err",
".",
"errno",
"not",
"in",
"(",
"errno",
".",
"EPERM",
",",
"errno",
".",
"ENO... | 3dc6ad803f0b0d56586dec9542a6a06aa06cf569 |
valid | BlockadeState.__base_state | Convert blockade ID and container information into
a state dictionary object. | blockade/state.py | def __base_state(self, containers):
'''
Convert blockade ID and container information into
a state dictionary object.
'''
return dict(blockade_id=self._blockade_id,
containers=containers,
version=self._state_version) | def __base_state(self, containers):
'''
Convert blockade ID and container information into
a state dictionary object.
'''
return dict(blockade_id=self._blockade_id,
containers=containers,
version=self._state_version) | [
"Convert",
"blockade",
"ID",
"and",
"container",
"information",
"into",
"a",
"state",
"dictionary",
"object",
"."
] | worstcase/blockade | python | https://github.com/worstcase/blockade/blob/3dc6ad803f0b0d56586dec9542a6a06aa06cf569/blockade/state.py#L161-L168 | [
"def",
"__base_state",
"(",
"self",
",",
"containers",
")",
":",
"return",
"dict",
"(",
"blockade_id",
"=",
"self",
".",
"_blockade_id",
",",
"containers",
"=",
"containers",
",",
"version",
"=",
"self",
".",
"_state_version",
")"
] | 3dc6ad803f0b0d56586dec9542a6a06aa06cf569 |
valid | BlockadeState.__write | Write the given state information into a file | blockade/state.py | def __write(self, containers, initialize=True):
'''Write the given state information into a file'''
path = self._state_file
self._assure_dir()
try:
flags = os.O_WRONLY | os.O_CREAT
if initialize:
flags |= os.O_EXCL
with os.fdopen(os.ope... | def __write(self, containers, initialize=True):
'''Write the given state information into a file'''
path = self._state_file
self._assure_dir()
try:
flags = os.O_WRONLY | os.O_CREAT
if initialize:
flags |= os.O_EXCL
with os.fdopen(os.ope... | [
"Write",
"the",
"given",
"state",
"information",
"into",
"a",
"file"
] | worstcase/blockade | python | https://github.com/worstcase/blockade/blob/3dc6ad803f0b0d56586dec9542a6a06aa06cf569/blockade/state.py#L170-L189 | [
"def",
"__write",
"(",
"self",
",",
"containers",
",",
"initialize",
"=",
"True",
")",
":",
"path",
"=",
"self",
".",
"_state_file",
"self",
".",
"_assure_dir",
"(",
")",
"try",
":",
"flags",
"=",
"os",
".",
"O_WRONLY",
"|",
"os",
".",
"O_CREAT",
"if... | 3dc6ad803f0b0d56586dec9542a6a06aa06cf569 |
valid | expand_partitions | Validate the partitions of containers. If there are any containers
not in any partition, place them in an new partition. | blockade/core.py | def expand_partitions(containers, partitions):
'''
Validate the partitions of containers. If there are any containers
not in any partition, place them in an new partition.
'''
# filter out holy containers that don't belong
# to any partition at all
all_names = frozenset(c.name for c in cont... | def expand_partitions(containers, partitions):
'''
Validate the partitions of containers. If there are any containers
not in any partition, place them in an new partition.
'''
# filter out holy containers that don't belong
# to any partition at all
all_names = frozenset(c.name for c in cont... | [
"Validate",
"the",
"partitions",
"of",
"containers",
".",
"If",
"there",
"are",
"any",
"containers",
"not",
"in",
"any",
"partition",
"place",
"them",
"in",
"an",
"new",
"partition",
"."
] | worstcase/blockade | python | https://github.com/worstcase/blockade/blob/3dc6ad803f0b0d56586dec9542a6a06aa06cf569/blockade/core.py#L600-L640 | [
"def",
"expand_partitions",
"(",
"containers",
",",
"partitions",
")",
":",
"# filter out holy containers that don't belong",
"# to any partition at all",
"all_names",
"=",
"frozenset",
"(",
"c",
".",
"name",
"for",
"c",
"in",
"containers",
"if",
"not",
"c",
".",
"h... | 3dc6ad803f0b0d56586dec9542a6a06aa06cf569 |
valid | _IPTables.get_source_chains | Get a map of blockade chains IDs -> list of IPs targeted at them
For figuring out which container is in which partition | blockade/net.py | def get_source_chains(self, blockade_id):
"""Get a map of blockade chains IDs -> list of IPs targeted at them
For figuring out which container is in which partition
"""
result = {}
if not blockade_id:
raise ValueError("invalid blockade_id")
lines = self.get_c... | def get_source_chains(self, blockade_id):
"""Get a map of blockade chains IDs -> list of IPs targeted at them
For figuring out which container is in which partition
"""
result = {}
if not blockade_id:
raise ValueError("invalid blockade_id")
lines = self.get_c... | [
"Get",
"a",
"map",
"of",
"blockade",
"chains",
"IDs",
"-",
">",
"list",
"of",
"IPs",
"targeted",
"at",
"them"
] | worstcase/blockade | python | https://github.com/worstcase/blockade/blob/3dc6ad803f0b0d56586dec9542a6a06aa06cf569/blockade/net.py#L169-L191 | [
"def",
"get_source_chains",
"(",
"self",
",",
"blockade_id",
")",
":",
"result",
"=",
"{",
"}",
"if",
"not",
"blockade_id",
":",
"raise",
"ValueError",
"(",
"\"invalid blockade_id\"",
")",
"lines",
"=",
"self",
".",
"get_chain_rules",
"(",
"\"FORWARD\"",
")",
... | 3dc6ad803f0b0d56586dec9542a6a06aa06cf569 |
valid | _IPTables.insert_rule | Insert a new rule in the chain | blockade/net.py | def insert_rule(self, chain, src=None, dest=None, target=None):
"""Insert a new rule in the chain
"""
if not chain:
raise ValueError("Invalid chain")
if not target:
raise ValueError("Invalid target")
if not (src or dest):
raise ValueError("Need... | def insert_rule(self, chain, src=None, dest=None, target=None):
"""Insert a new rule in the chain
"""
if not chain:
raise ValueError("Invalid chain")
if not target:
raise ValueError("Invalid target")
if not (src or dest):
raise ValueError("Need... | [
"Insert",
"a",
"new",
"rule",
"in",
"the",
"chain"
] | worstcase/blockade | python | https://github.com/worstcase/blockade/blob/3dc6ad803f0b0d56586dec9542a6a06aa06cf569/blockade/net.py#L235-L251 | [
"def",
"insert_rule",
"(",
"self",
",",
"chain",
",",
"src",
"=",
"None",
",",
"dest",
"=",
"None",
",",
"target",
"=",
"None",
")",
":",
"if",
"not",
"chain",
":",
"raise",
"ValueError",
"(",
"\"Invalid chain\"",
")",
"if",
"not",
"target",
":",
"ra... | 3dc6ad803f0b0d56586dec9542a6a06aa06cf569 |
valid | BlockadeChaos._sm_start | Start the timer waiting for pain | blockade/chaos.py | def _sm_start(self, *args, **kwargs):
"""
Start the timer waiting for pain
"""
millisec = random.randint(self._start_min_delay, self._start_max_delay)
self._timer = threading.Timer(millisec / 1000.0, self.event_timeout)
self._timer.start() | def _sm_start(self, *args, **kwargs):
"""
Start the timer waiting for pain
"""
millisec = random.randint(self._start_min_delay, self._start_max_delay)
self._timer = threading.Timer(millisec / 1000.0, self.event_timeout)
self._timer.start() | [
"Start",
"the",
"timer",
"waiting",
"for",
"pain"
] | worstcase/blockade | python | https://github.com/worstcase/blockade/blob/3dc6ad803f0b0d56586dec9542a6a06aa06cf569/blockade/chaos.py#L286-L292 | [
"def",
"_sm_start",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"millisec",
"=",
"random",
".",
"randint",
"(",
"self",
".",
"_start_min_delay",
",",
"self",
".",
"_start_max_delay",
")",
"self",
".",
"_timer",
"=",
"threading",
"... | 3dc6ad803f0b0d56586dec9542a6a06aa06cf569 |
valid | BlockadeChaos._sm_to_pain | Start the blockade event | blockade/chaos.py | def _sm_to_pain(self, *args, **kwargs):
"""
Start the blockade event
"""
_logger.info("Starting chaos for blockade %s" % self._blockade_name)
self._do_blockade_event()
# start the timer to end the pain
millisec = random.randint(self._run_min_time, self._run_max_ti... | def _sm_to_pain(self, *args, **kwargs):
"""
Start the blockade event
"""
_logger.info("Starting chaos for blockade %s" % self._blockade_name)
self._do_blockade_event()
# start the timer to end the pain
millisec = random.randint(self._run_min_time, self._run_max_ti... | [
"Start",
"the",
"blockade",
"event"
] | worstcase/blockade | python | https://github.com/worstcase/blockade/blob/3dc6ad803f0b0d56586dec9542a6a06aa06cf569/blockade/chaos.py#L294-L303 | [
"def",
"_sm_to_pain",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"_logger",
".",
"info",
"(",
"\"Starting chaos for blockade %s\"",
"%",
"self",
".",
"_blockade_name",
")",
"self",
".",
"_do_blockade_event",
"(",
")",
"# start the timer ... | 3dc6ad803f0b0d56586dec9542a6a06aa06cf569 |
valid | BlockadeChaos._sm_stop_from_no_pain | Stop chaos when there is no current blockade operation | blockade/chaos.py | def _sm_stop_from_no_pain(self, *args, **kwargs):
"""
Stop chaos when there is no current blockade operation
"""
# Just stop the timer. It is possible that it was too late and the
# timer is about to run
_logger.info("Stopping chaos for blockade %s" % self._blockade_name... | def _sm_stop_from_no_pain(self, *args, **kwargs):
"""
Stop chaos when there is no current blockade operation
"""
# Just stop the timer. It is possible that it was too late and the
# timer is about to run
_logger.info("Stopping chaos for blockade %s" % self._blockade_name... | [
"Stop",
"chaos",
"when",
"there",
"is",
"no",
"current",
"blockade",
"operation"
] | worstcase/blockade | python | https://github.com/worstcase/blockade/blob/3dc6ad803f0b0d56586dec9542a6a06aa06cf569/blockade/chaos.py#L305-L312 | [
"def",
"_sm_stop_from_no_pain",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"# Just stop the timer. It is possible that it was too late and the",
"# timer is about to run",
"_logger",
".",
"info",
"(",
"\"Stopping chaos for blockade %s\"",
"%",
"self"... | 3dc6ad803f0b0d56586dec9542a6a06aa06cf569 |
valid | BlockadeChaos._sm_relieve_pain | End the blockade event and return to a steady state | blockade/chaos.py | def _sm_relieve_pain(self, *args, **kwargs):
"""
End the blockade event and return to a steady state
"""
_logger.info(
"Ending the degradation for blockade %s" % self._blockade_name)
self._do_reset_all()
# set a timer for the next pain event
millis... | def _sm_relieve_pain(self, *args, **kwargs):
"""
End the blockade event and return to a steady state
"""
_logger.info(
"Ending the degradation for blockade %s" % self._blockade_name)
self._do_reset_all()
# set a timer for the next pain event
millis... | [
"End",
"the",
"blockade",
"event",
"and",
"return",
"to",
"a",
"steady",
"state"
] | worstcase/blockade | python | https://github.com/worstcase/blockade/blob/3dc6ad803f0b0d56586dec9542a6a06aa06cf569/blockade/chaos.py#L314-L324 | [
"def",
"_sm_relieve_pain",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"_logger",
".",
"info",
"(",
"\"Ending the degradation for blockade %s\"",
"%",
"self",
".",
"_blockade_name",
")",
"self",
".",
"_do_reset_all",
"(",
")",
"# set a ti... | 3dc6ad803f0b0d56586dec9542a6a06aa06cf569 |
valid | BlockadeChaos._sm_stop_from_pain | Stop chaos while there is a blockade event in progress | blockade/chaos.py | def _sm_stop_from_pain(self, *args, **kwargs):
"""
Stop chaos while there is a blockade event in progress
"""
_logger.info("Stopping chaos for blockade %s" % self._blockade_name)
self._do_reset_all() | def _sm_stop_from_pain(self, *args, **kwargs):
"""
Stop chaos while there is a blockade event in progress
"""
_logger.info("Stopping chaos for blockade %s" % self._blockade_name)
self._do_reset_all() | [
"Stop",
"chaos",
"while",
"there",
"is",
"a",
"blockade",
"event",
"in",
"progress"
] | worstcase/blockade | python | https://github.com/worstcase/blockade/blob/3dc6ad803f0b0d56586dec9542a6a06aa06cf569/blockade/chaos.py#L326-L331 | [
"def",
"_sm_stop_from_pain",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"_logger",
".",
"info",
"(",
"\"Stopping chaos for blockade %s\"",
"%",
"self",
".",
"_blockade_name",
")",
"self",
".",
"_do_reset_all",
"(",
")"
] | 3dc6ad803f0b0d56586dec9542a6a06aa06cf569 |
valid | BlockadeChaos._sm_cleanup | Delete all state associated with the chaos session | blockade/chaos.py | def _sm_cleanup(self, *args, **kwargs):
"""
Delete all state associated with the chaos session
"""
if self._done_notification_func is not None:
self._done_notification_func()
self._timer.cancel() | def _sm_cleanup(self, *args, **kwargs):
"""
Delete all state associated with the chaos session
"""
if self._done_notification_func is not None:
self._done_notification_func()
self._timer.cancel() | [
"Delete",
"all",
"state",
"associated",
"with",
"the",
"chaos",
"session"
] | worstcase/blockade | python | https://github.com/worstcase/blockade/blob/3dc6ad803f0b0d56586dec9542a6a06aa06cf569/blockade/chaos.py#L333-L339 | [
"def",
"_sm_cleanup",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"self",
".",
"_done_notification_func",
"is",
"not",
"None",
":",
"self",
".",
"_done_notification_func",
"(",
")",
"self",
".",
"_timer",
".",
"cancel",
"(",
... | 3dc6ad803f0b0d56586dec9542a6a06aa06cf569 |
valid | dependency_sorted | Sort a dictionary or list of containers into dependency order
Returns a sequence | blockade/config.py | def dependency_sorted(containers):
"""Sort a dictionary or list of containers into dependency order
Returns a sequence
"""
if not isinstance(containers, collections.Mapping):
containers = dict((c.name, c) for c in containers)
container_links = dict((name, set(c.links.keys()))
... | def dependency_sorted(containers):
"""Sort a dictionary or list of containers into dependency order
Returns a sequence
"""
if not isinstance(containers, collections.Mapping):
containers = dict((c.name, c) for c in containers)
container_links = dict((name, set(c.links.keys()))
... | [
"Sort",
"a",
"dictionary",
"or",
"list",
"of",
"containers",
"into",
"dependency",
"order"
] | worstcase/blockade | python | https://github.com/worstcase/blockade/blob/3dc6ad803f0b0d56586dec9542a6a06aa06cf569/blockade/config.py#L206-L217 | [
"def",
"dependency_sorted",
"(",
"containers",
")",
":",
"if",
"not",
"isinstance",
"(",
"containers",
",",
"collections",
".",
"Mapping",
")",
":",
"containers",
"=",
"dict",
"(",
"(",
"c",
".",
"name",
",",
"c",
")",
"for",
"c",
"in",
"containers",
"... | 3dc6ad803f0b0d56586dec9542a6a06aa06cf569 |
valid | BlockadeContainerConfig.from_dict | Convert a dictionary of configuration values
into a sequence of BlockadeContainerConfig instances | blockade/config.py | def from_dict(name, values):
'''
Convert a dictionary of configuration values
into a sequence of BlockadeContainerConfig instances
'''
# determine the number of instances of this container
count = 1
count_value = values.get('count', 1)
if isinstance(count... | def from_dict(name, values):
'''
Convert a dictionary of configuration values
into a sequence of BlockadeContainerConfig instances
'''
# determine the number of instances of this container
count = 1
count_value = values.get('count', 1)
if isinstance(count... | [
"Convert",
"a",
"dictionary",
"of",
"configuration",
"values",
"into",
"a",
"sequence",
"of",
"BlockadeContainerConfig",
"instances"
] | worstcase/blockade | python | https://github.com/worstcase/blockade/blob/3dc6ad803f0b0d56586dec9542a6a06aa06cf569/blockade/config.py#L30-L70 | [
"def",
"from_dict",
"(",
"name",
",",
"values",
")",
":",
"# determine the number of instances of this container",
"count",
"=",
"1",
"count_value",
"=",
"values",
".",
"get",
"(",
"'count'",
",",
"1",
")",
"if",
"isinstance",
"(",
"count_value",
",",
"int",
"... | 3dc6ad803f0b0d56586dec9542a6a06aa06cf569 |
valid | BlockadeConfig.from_dict | Instantiate a BlockadeConfig instance based on
a given dictionary of configuration values | blockade/config.py | def from_dict(values):
'''
Instantiate a BlockadeConfig instance based on
a given dictionary of configuration values
'''
try:
containers = values['containers']
parsed_containers = {}
for name, container_dict in containers.items():
... | def from_dict(values):
'''
Instantiate a BlockadeConfig instance based on
a given dictionary of configuration values
'''
try:
containers = values['containers']
parsed_containers = {}
for name, container_dict in containers.items():
... | [
"Instantiate",
"a",
"BlockadeConfig",
"instance",
"based",
"on",
"a",
"given",
"dictionary",
"of",
"configuration",
"values"
] | worstcase/blockade | python | https://github.com/worstcase/blockade/blob/3dc6ad803f0b0d56586dec9542a6a06aa06cf569/blockade/config.py#L122-L161 | [
"def",
"from_dict",
"(",
"values",
")",
":",
"try",
":",
"containers",
"=",
"values",
"[",
"'containers'",
"]",
"parsed_containers",
"=",
"{",
"}",
"for",
"name",
",",
"container_dict",
"in",
"containers",
".",
"items",
"(",
")",
":",
"try",
":",
"# one ... | 3dc6ad803f0b0d56586dec9542a6a06aa06cf569 |
valid | cmd_up | Start the containers and link them together | blockade/cli.py | def cmd_up(opts):
"""Start the containers and link them together
"""
config = load_config(opts.config)
b = get_blockade(config, opts)
containers = b.create(verbose=opts.verbose, force=opts.force)
print_containers(containers, opts.json) | def cmd_up(opts):
"""Start the containers and link them together
"""
config = load_config(opts.config)
b = get_blockade(config, opts)
containers = b.create(verbose=opts.verbose, force=opts.force)
print_containers(containers, opts.json) | [
"Start",
"the",
"containers",
"and",
"link",
"them",
"together"
] | worstcase/blockade | python | https://github.com/worstcase/blockade/blob/3dc6ad803f0b0d56586dec9542a6a06aa06cf569/blockade/cli.py#L160-L166 | [
"def",
"cmd_up",
"(",
"opts",
")",
":",
"config",
"=",
"load_config",
"(",
"opts",
".",
"config",
")",
"b",
"=",
"get_blockade",
"(",
"config",
",",
"opts",
")",
"containers",
"=",
"b",
".",
"create",
"(",
"verbose",
"=",
"opts",
".",
"verbose",
",",... | 3dc6ad803f0b0d56586dec9542a6a06aa06cf569 |
valid | cmd_destroy | Destroy all containers and restore networks | blockade/cli.py | def cmd_destroy(opts):
"""Destroy all containers and restore networks
"""
config = load_config(opts.config)
b = get_blockade(config, opts)
b.destroy() | def cmd_destroy(opts):
"""Destroy all containers and restore networks
"""
config = load_config(opts.config)
b = get_blockade(config, opts)
b.destroy() | [
"Destroy",
"all",
"containers",
"and",
"restore",
"networks"
] | worstcase/blockade | python | https://github.com/worstcase/blockade/blob/3dc6ad803f0b0d56586dec9542a6a06aa06cf569/blockade/cli.py#L169-L174 | [
"def",
"cmd_destroy",
"(",
"opts",
")",
":",
"config",
"=",
"load_config",
"(",
"opts",
".",
"config",
")",
"b",
"=",
"get_blockade",
"(",
"config",
",",
"opts",
")",
"b",
".",
"destroy",
"(",
")"
] | 3dc6ad803f0b0d56586dec9542a6a06aa06cf569 |
valid | cmd_status | Print status of containers and networks | blockade/cli.py | def cmd_status(opts):
"""Print status of containers and networks
"""
config = load_config(opts.config)
b = get_blockade(config, opts)
containers = b.status()
print_containers(containers, opts.json) | def cmd_status(opts):
"""Print status of containers and networks
"""
config = load_config(opts.config)
b = get_blockade(config, opts)
containers = b.status()
print_containers(containers, opts.json) | [
"Print",
"status",
"of",
"containers",
"and",
"networks"
] | worstcase/blockade | python | https://github.com/worstcase/blockade/blob/3dc6ad803f0b0d56586dec9542a6a06aa06cf569/blockade/cli.py#L177-L183 | [
"def",
"cmd_status",
"(",
"opts",
")",
":",
"config",
"=",
"load_config",
"(",
"opts",
".",
"config",
")",
"b",
"=",
"get_blockade",
"(",
"config",
",",
"opts",
")",
"containers",
"=",
"b",
".",
"status",
"(",
")",
"print_containers",
"(",
"containers",
... | 3dc6ad803f0b0d56586dec9542a6a06aa06cf569 |
valid | cmd_kill | Kill some or all containers | blockade/cli.py | def cmd_kill(opts):
"""Kill some or all containers
"""
kill_signal = opts.signal if hasattr(opts, 'signal') else "SIGKILL"
__with_containers(opts, Blockade.kill, signal=kill_signal) | def cmd_kill(opts):
"""Kill some or all containers
"""
kill_signal = opts.signal if hasattr(opts, 'signal') else "SIGKILL"
__with_containers(opts, Blockade.kill, signal=kill_signal) | [
"Kill",
"some",
"or",
"all",
"containers"
] | worstcase/blockade | python | https://github.com/worstcase/blockade/blob/3dc6ad803f0b0d56586dec9542a6a06aa06cf569/blockade/cli.py#L210-L214 | [
"def",
"cmd_kill",
"(",
"opts",
")",
":",
"kill_signal",
"=",
"opts",
".",
"signal",
"if",
"hasattr",
"(",
"opts",
",",
"'signal'",
")",
"else",
"\"SIGKILL\"",
"__with_containers",
"(",
"opts",
",",
"Blockade",
".",
"kill",
",",
"signal",
"=",
"kill_signal... | 3dc6ad803f0b0d56586dec9542a6a06aa06cf569 |
valid | cmd_partition | Partition the network between containers
Replaces any existing partitions outright. Any containers NOT specified
in arguments will be globbed into a single implicit partition. For
example if you have three containers: c1, c2, and c3 and you run:
blockade partition c1
The result will be a part... | blockade/cli.py | def cmd_partition(opts):
"""Partition the network between containers
Replaces any existing partitions outright. Any containers NOT specified
in arguments will be globbed into a single implicit partition. For
example if you have three containers: c1, c2, and c3 and you run:
blockade partition c... | def cmd_partition(opts):
"""Partition the network between containers
Replaces any existing partitions outright. Any containers NOT specified
in arguments will be globbed into a single implicit partition. For
example if you have three containers: c1, c2, and c3 and you run:
blockade partition c... | [
"Partition",
"the",
"network",
"between",
"containers"
] | worstcase/blockade | python | https://github.com/worstcase/blockade/blob/3dc6ad803f0b0d56586dec9542a6a06aa06cf569/blockade/cli.py#L304-L340 | [
"def",
"cmd_partition",
"(",
"opts",
")",
":",
"config",
"=",
"load_config",
"(",
"opts",
".",
"config",
")",
"b",
"=",
"get_blockade",
"(",
"config",
",",
"opts",
")",
"if",
"opts",
".",
"random",
":",
"if",
"opts",
".",
"partitions",
":",
"raise",
... | 3dc6ad803f0b0d56586dec9542a6a06aa06cf569 |
valid | cmd_join | Restore full networking between containers | blockade/cli.py | def cmd_join(opts):
"""Restore full networking between containers
"""
config = load_config(opts.config)
b = get_blockade(config, opts)
b.join() | def cmd_join(opts):
"""Restore full networking between containers
"""
config = load_config(opts.config)
b = get_blockade(config, opts)
b.join() | [
"Restore",
"full",
"networking",
"between",
"containers"
] | worstcase/blockade | python | https://github.com/worstcase/blockade/blob/3dc6ad803f0b0d56586dec9542a6a06aa06cf569/blockade/cli.py#L343-L348 | [
"def",
"cmd_join",
"(",
"opts",
")",
":",
"config",
"=",
"load_config",
"(",
"opts",
".",
"config",
")",
"b",
"=",
"get_blockade",
"(",
"config",
",",
"opts",
")",
"b",
".",
"join",
"(",
")"
] | 3dc6ad803f0b0d56586dec9542a6a06aa06cf569 |
valid | cmd_logs | Fetch the logs of a container | blockade/cli.py | def cmd_logs(opts):
"""Fetch the logs of a container
"""
config = load_config(opts.config)
b = get_blockade(config, opts)
puts(b.logs(opts.container).decode(encoding='UTF-8')) | def cmd_logs(opts):
"""Fetch the logs of a container
"""
config = load_config(opts.config)
b = get_blockade(config, opts)
puts(b.logs(opts.container).decode(encoding='UTF-8')) | [
"Fetch",
"the",
"logs",
"of",
"a",
"container"
] | worstcase/blockade | python | https://github.com/worstcase/blockade/blob/3dc6ad803f0b0d56586dec9542a6a06aa06cf569/blockade/cli.py#L351-L356 | [
"def",
"cmd_logs",
"(",
"opts",
")",
":",
"config",
"=",
"load_config",
"(",
"opts",
".",
"config",
")",
"b",
"=",
"get_blockade",
"(",
"config",
",",
"opts",
")",
"puts",
"(",
"b",
".",
"logs",
"(",
"opts",
".",
"container",
")",
".",
"decode",
"(... | 3dc6ad803f0b0d56586dec9542a6a06aa06cf569 |
valid | cmd_daemon | Start the Blockade REST API | blockade/cli.py | def cmd_daemon(opts):
"""Start the Blockade REST API
"""
if opts.data_dir is None:
raise BlockadeError("You must supply a data directory for the daemon")
rest.start(data_dir=opts.data_dir, port=opts.port, debug=opts.debug,
host_exec=get_host_exec()) | def cmd_daemon(opts):
"""Start the Blockade REST API
"""
if opts.data_dir is None:
raise BlockadeError("You must supply a data directory for the daemon")
rest.start(data_dir=opts.data_dir, port=opts.port, debug=opts.debug,
host_exec=get_host_exec()) | [
"Start",
"the",
"Blockade",
"REST",
"API"
] | worstcase/blockade | python | https://github.com/worstcase/blockade/blob/3dc6ad803f0b0d56586dec9542a6a06aa06cf569/blockade/cli.py#L359-L365 | [
"def",
"cmd_daemon",
"(",
"opts",
")",
":",
"if",
"opts",
".",
"data_dir",
"is",
"None",
":",
"raise",
"BlockadeError",
"(",
"\"You must supply a data directory for the daemon\"",
")",
"rest",
".",
"start",
"(",
"data_dir",
"=",
"opts",
".",
"data_dir",
",",
"... | 3dc6ad803f0b0d56586dec9542a6a06aa06cf569 |
valid | cmd_add | Add one or more existing Docker containers to a Blockade group | blockade/cli.py | def cmd_add(opts):
"""Add one or more existing Docker containers to a Blockade group
"""
config = load_config(opts.config)
b = get_blockade(config, opts)
b.add_container(opts.containers) | def cmd_add(opts):
"""Add one or more existing Docker containers to a Blockade group
"""
config = load_config(opts.config)
b = get_blockade(config, opts)
b.add_container(opts.containers) | [
"Add",
"one",
"or",
"more",
"existing",
"Docker",
"containers",
"to",
"a",
"Blockade",
"group"
] | worstcase/blockade | python | https://github.com/worstcase/blockade/blob/3dc6ad803f0b0d56586dec9542a6a06aa06cf569/blockade/cli.py#L368-L373 | [
"def",
"cmd_add",
"(",
"opts",
")",
":",
"config",
"=",
"load_config",
"(",
"opts",
".",
"config",
")",
"b",
"=",
"get_blockade",
"(",
"config",
",",
"opts",
")",
"b",
".",
"add_container",
"(",
"opts",
".",
"containers",
")"
] | 3dc6ad803f0b0d56586dec9542a6a06aa06cf569 |
valid | cmd_events | Get the event log for a given blockade | blockade/cli.py | def cmd_events(opts):
"""Get the event log for a given blockade
"""
config = load_config(opts.config)
b = get_blockade(config, opts)
if opts.json:
outf = None
_write = puts
if opts.output is not None:
outf = open(opts.output, "w")
_write = outf.write
... | def cmd_events(opts):
"""Get the event log for a given blockade
"""
config = load_config(opts.config)
b = get_blockade(config, opts)
if opts.json:
outf = None
_write = puts
if opts.output is not None:
outf = open(opts.output, "w")
_write = outf.write
... | [
"Get",
"the",
"event",
"log",
"for",
"a",
"given",
"blockade"
] | worstcase/blockade | python | https://github.com/worstcase/blockade/blob/3dc6ad803f0b0d56586dec9542a6a06aa06cf569/blockade/cli.py#L383-L421 | [
"def",
"cmd_events",
"(",
"opts",
")",
":",
"config",
"=",
"load_config",
"(",
"opts",
".",
"config",
")",
"b",
"=",
"get_blockade",
"(",
"config",
",",
"opts",
")",
"if",
"opts",
".",
"json",
":",
"outf",
"=",
"None",
"_write",
"=",
"puts",
"if",
... | 3dc6ad803f0b0d56586dec9542a6a06aa06cf569 |
valid | set_cors_headers | Performs the actual evaluation of Flas-CORS options and actually
modifies the response object.
This function is used both in the decorator and the after_request
callback | flask_cors/core.py | def set_cors_headers(resp, options):
"""
Performs the actual evaluation of Flas-CORS options and actually
modifies the response object.
This function is used both in the decorator and the after_request
callback
"""
# If CORS has already been evaluated via the decorator, skip
if hasattr... | def set_cors_headers(resp, options):
"""
Performs the actual evaluation of Flas-CORS options and actually
modifies the response object.
This function is used both in the decorator and the after_request
callback
"""
# If CORS has already been evaluated via the decorator, skip
if hasattr... | [
"Performs",
"the",
"actual",
"evaluation",
"of",
"Flas",
"-",
"CORS",
"options",
"and",
"actually",
"modifies",
"the",
"response",
"object",
"."
] | corydolphin/flask-cors | python | https://github.com/corydolphin/flask-cors/blob/13fbb1ea4c1bb422de91a726c3c7f1038d3743a3/flask_cors/core.py#L219-L247 | [
"def",
"set_cors_headers",
"(",
"resp",
",",
"options",
")",
":",
"# If CORS has already been evaluated via the decorator, skip",
"if",
"hasattr",
"(",
"resp",
",",
"FLASK_CORS_EVALUATED",
")",
":",
"LOG",
".",
"debug",
"(",
"'CORS have been already evaluated, skipping'",
... | 13fbb1ea4c1bb422de91a726c3c7f1038d3743a3 |
valid | try_match | Safely attempts to match a pattern or string to a request origin. | flask_cors/core.py | def try_match(request_origin, maybe_regex):
"""Safely attempts to match a pattern or string to a request origin."""
if isinstance(maybe_regex, RegexObject):
return re.match(maybe_regex, request_origin)
elif probably_regex(maybe_regex):
return re.match(maybe_regex, request_origin, flags=re.IG... | def try_match(request_origin, maybe_regex):
"""Safely attempts to match a pattern or string to a request origin."""
if isinstance(maybe_regex, RegexObject):
return re.match(maybe_regex, request_origin)
elif probably_regex(maybe_regex):
return re.match(maybe_regex, request_origin, flags=re.IG... | [
"Safely",
"attempts",
"to",
"match",
"a",
"pattern",
"or",
"string",
"to",
"a",
"request",
"origin",
"."
] | corydolphin/flask-cors | python | https://github.com/corydolphin/flask-cors/blob/13fbb1ea4c1bb422de91a726c3c7f1038d3743a3/flask_cors/core.py#L270-L280 | [
"def",
"try_match",
"(",
"request_origin",
",",
"maybe_regex",
")",
":",
"if",
"isinstance",
"(",
"maybe_regex",
",",
"RegexObject",
")",
":",
"return",
"re",
".",
"match",
"(",
"maybe_regex",
",",
"request_origin",
")",
"elif",
"probably_regex",
"(",
"maybe_r... | 13fbb1ea4c1bb422de91a726c3c7f1038d3743a3 |
valid | get_cors_options | Compute CORS options for an application by combining the DEFAULT_OPTIONS,
the app's configuration-specified options and any dictionaries passed. The
last specified option wins. | flask_cors/core.py | def get_cors_options(appInstance, *dicts):
"""
Compute CORS options for an application by combining the DEFAULT_OPTIONS,
the app's configuration-specified options and any dictionaries passed. The
last specified option wins.
"""
options = DEFAULT_OPTIONS.copy()
options.update(get_app_kwarg_di... | def get_cors_options(appInstance, *dicts):
"""
Compute CORS options for an application by combining the DEFAULT_OPTIONS,
the app's configuration-specified options and any dictionaries passed. The
last specified option wins.
"""
options = DEFAULT_OPTIONS.copy()
options.update(get_app_kwarg_di... | [
"Compute",
"CORS",
"options",
"for",
"an",
"application",
"by",
"combining",
"the",
"DEFAULT_OPTIONS",
"the",
"app",
"s",
"configuration",
"-",
"specified",
"options",
"and",
"any",
"dictionaries",
"passed",
".",
"The",
"last",
"specified",
"option",
"wins",
"."... | corydolphin/flask-cors | python | https://github.com/corydolphin/flask-cors/blob/13fbb1ea4c1bb422de91a726c3c7f1038d3743a3/flask_cors/core.py#L283-L295 | [
"def",
"get_cors_options",
"(",
"appInstance",
",",
"*",
"dicts",
")",
":",
"options",
"=",
"DEFAULT_OPTIONS",
".",
"copy",
"(",
")",
"options",
".",
"update",
"(",
"get_app_kwarg_dict",
"(",
"appInstance",
")",
")",
"if",
"dicts",
":",
"for",
"d",
"in",
... | 13fbb1ea4c1bb422de91a726c3c7f1038d3743a3 |
valid | get_app_kwarg_dict | Returns the dictionary of CORS specific app configurations. | flask_cors/core.py | def get_app_kwarg_dict(appInstance=None):
"""Returns the dictionary of CORS specific app configurations."""
app = (appInstance or current_app)
# In order to support blueprints which do not have a config attribute
app_config = getattr(app, 'config', {})
return {
k.lower().replace('cors_', '... | def get_app_kwarg_dict(appInstance=None):
"""Returns the dictionary of CORS specific app configurations."""
app = (appInstance or current_app)
# In order to support blueprints which do not have a config attribute
app_config = getattr(app, 'config', {})
return {
k.lower().replace('cors_', '... | [
"Returns",
"the",
"dictionary",
"of",
"CORS",
"specific",
"app",
"configurations",
"."
] | corydolphin/flask-cors | python | https://github.com/corydolphin/flask-cors/blob/13fbb1ea4c1bb422de91a726c3c7f1038d3743a3/flask_cors/core.py#L298-L309 | [
"def",
"get_app_kwarg_dict",
"(",
"appInstance",
"=",
"None",
")",
":",
"app",
"=",
"(",
"appInstance",
"or",
"current_app",
")",
"# In order to support blueprints which do not have a config attribute",
"app_config",
"=",
"getattr",
"(",
"app",
",",
"'config'",
",",
"... | 13fbb1ea4c1bb422de91a726c3c7f1038d3743a3 |
valid | ensure_iterable | Wraps scalars or string types as a list, or returns the iterable instance. | flask_cors/core.py | def ensure_iterable(inst):
"""
Wraps scalars or string types as a list, or returns the iterable instance.
"""
if isinstance(inst, string_types):
return [inst]
elif not isinstance(inst, collections.Iterable):
return [inst]
else:
return inst | def ensure_iterable(inst):
"""
Wraps scalars or string types as a list, or returns the iterable instance.
"""
if isinstance(inst, string_types):
return [inst]
elif not isinstance(inst, collections.Iterable):
return [inst]
else:
return inst | [
"Wraps",
"scalars",
"or",
"string",
"types",
"as",
"a",
"list",
"or",
"returns",
"the",
"iterable",
"instance",
"."
] | corydolphin/flask-cors | python | https://github.com/corydolphin/flask-cors/blob/13fbb1ea4c1bb422de91a726c3c7f1038d3743a3/flask_cors/core.py#L334-L343 | [
"def",
"ensure_iterable",
"(",
"inst",
")",
":",
"if",
"isinstance",
"(",
"inst",
",",
"string_types",
")",
":",
"return",
"[",
"inst",
"]",
"elif",
"not",
"isinstance",
"(",
"inst",
",",
"collections",
".",
"Iterable",
")",
":",
"return",
"[",
"inst",
... | 13fbb1ea4c1bb422de91a726c3c7f1038d3743a3 |
valid | serialize_options | A helper method to serialize and processes the options dictionary. | flask_cors/core.py | def serialize_options(opts):
"""
A helper method to serialize and processes the options dictionary.
"""
options = (opts or {}).copy()
for key in opts.keys():
if key not in DEFAULT_OPTIONS:
LOG.warning("Unknown option passed to Flask-CORS: %s", key)
# Ensure origins is a li... | def serialize_options(opts):
"""
A helper method to serialize and processes the options dictionary.
"""
options = (opts or {}).copy()
for key in opts.keys():
if key not in DEFAULT_OPTIONS:
LOG.warning("Unknown option passed to Flask-CORS: %s", key)
# Ensure origins is a li... | [
"A",
"helper",
"method",
"to",
"serialize",
"and",
"processes",
"the",
"options",
"dictionary",
"."
] | corydolphin/flask-cors | python | https://github.com/corydolphin/flask-cors/blob/13fbb1ea4c1bb422de91a726c3c7f1038d3743a3/flask_cors/core.py#L349-L378 | [
"def",
"serialize_options",
"(",
"opts",
")",
":",
"options",
"=",
"(",
"opts",
"or",
"{",
"}",
")",
".",
"copy",
"(",
")",
"for",
"key",
"in",
"opts",
".",
"keys",
"(",
")",
":",
"if",
"key",
"not",
"in",
"DEFAULT_OPTIONS",
":",
"LOG",
".",
"war... | 13fbb1ea4c1bb422de91a726c3c7f1038d3743a3 |
valid | cross_origin | This function is the decorator which is used to wrap a Flask route with.
In the simplest case, simply use the default parameters to allow all
origins in what is the most permissive configuration. If this method
modifies state or performs authentication which may be brute-forced, you
should add some degr... | flask_cors/decorator.py | def cross_origin(*args, **kwargs):
"""
This function is the decorator which is used to wrap a Flask route with.
In the simplest case, simply use the default parameters to allow all
origins in what is the most permissive configuration. If this method
modifies state or performs authentication which ma... | def cross_origin(*args, **kwargs):
"""
This function is the decorator which is used to wrap a Flask route with.
In the simplest case, simply use the default parameters to allow all
origins in what is the most permissive configuration. If this method
modifies state or performs authentication which ma... | [
"This",
"function",
"is",
"the",
"decorator",
"which",
"is",
"used",
"to",
"wrap",
"a",
"Flask",
"route",
"with",
".",
"In",
"the",
"simplest",
"case",
"simply",
"use",
"the",
"default",
"parameters",
"to",
"allow",
"all",
"origins",
"in",
"what",
"is",
... | corydolphin/flask-cors | python | https://github.com/corydolphin/flask-cors/blob/13fbb1ea4c1bb422de91a726c3c7f1038d3743a3/flask_cors/decorator.py#L18-L135 | [
"def",
"cross_origin",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"_options",
"=",
"kwargs",
"def",
"decorator",
"(",
"f",
")",
":",
"LOG",
".",
"debug",
"(",
"\"Enabling %s for cross_origin using options:%s\"",
",",
"f",
",",
"_options",
")",
"#... | 13fbb1ea4c1bb422de91a726c3c7f1038d3743a3 |
valid | calendar | This call allows you to fetch a number of trade dates or holidays from a given date. For example, if you want the next trading day, you would call /ref-data/us/dates/trade/next/1.
https://iexcloud.io/docs/api/#u-s-exchanges
8am, 9am, 12pm, 1pm UTC daily
Args:
type (string); "holiday" or "trade"
... | pyEX/refdata.py | def calendar(type='holiday', direction='next', last=1, startDate=None, token='', version=''):
'''This call allows you to fetch a number of trade dates or holidays from a given date. For example, if you want the next trading day, you would call /ref-data/us/dates/trade/next/1.
https://iexcloud.io/docs/api/#u-s-... | def calendar(type='holiday', direction='next', last=1, startDate=None, token='', version=''):
'''This call allows you to fetch a number of trade dates or holidays from a given date. For example, if you want the next trading day, you would call /ref-data/us/dates/trade/next/1.
https://iexcloud.io/docs/api/#u-s-... | [
"This",
"call",
"allows",
"you",
"to",
"fetch",
"a",
"number",
"of",
"trade",
"dates",
"or",
"holidays",
"from",
"a",
"given",
"date",
".",
"For",
"example",
"if",
"you",
"want",
"the",
"next",
"trading",
"day",
"you",
"would",
"call",
"/",
"ref",
"-",... | timkpaine/pyEX | python | https://github.com/timkpaine/pyEX/blob/91cf751dafdb208a0c8b5377945e5808b99f94ba/pyEX/refdata.py#L38-L58 | [
"def",
"calendar",
"(",
"type",
"=",
"'holiday'",
",",
"direction",
"=",
"'next'",
",",
"last",
"=",
"1",
",",
"startDate",
"=",
"None",
",",
"token",
"=",
"''",
",",
"version",
"=",
"''",
")",
":",
"if",
"startDate",
":",
"startDate",
"=",
"_strOrDa... | 91cf751dafdb208a0c8b5377945e5808b99f94ba |
valid | calendarDF | This call allows you to fetch a number of trade dates or holidays from a given date. For example, if you want the next trading day, you would call /ref-data/us/dates/trade/next/1.
https://iexcloud.io/docs/api/#u-s-exchanges
8am, 9am, 12pm, 1pm UTC daily
Args:
type (string); "holiday" or "trade"
... | pyEX/refdata.py | def calendarDF(type='holiday', direction='next', last=1, startDate=None, token='', version=''):
'''This call allows you to fetch a number of trade dates or holidays from a given date. For example, if you want the next trading day, you would call /ref-data/us/dates/trade/next/1.
https://iexcloud.io/docs/api/#u-... | def calendarDF(type='holiday', direction='next', last=1, startDate=None, token='', version=''):
'''This call allows you to fetch a number of trade dates or holidays from a given date. For example, if you want the next trading day, you would call /ref-data/us/dates/trade/next/1.
https://iexcloud.io/docs/api/#u-... | [
"This",
"call",
"allows",
"you",
"to",
"fetch",
"a",
"number",
"of",
"trade",
"dates",
"or",
"holidays",
"from",
"a",
"given",
"date",
".",
"For",
"example",
"if",
"you",
"want",
"the",
"next",
"trading",
"day",
"you",
"would",
"call",
"/",
"ref",
"-",... | timkpaine/pyEX | python | https://github.com/timkpaine/pyEX/blob/91cf751dafdb208a0c8b5377945e5808b99f94ba/pyEX/refdata.py#L61-L80 | [
"def",
"calendarDF",
"(",
"type",
"=",
"'holiday'",
",",
"direction",
"=",
"'next'",
",",
"last",
"=",
"1",
",",
"startDate",
"=",
"None",
",",
"token",
"=",
"''",
",",
"version",
"=",
"''",
")",
":",
"dat",
"=",
"pd",
".",
"DataFrame",
"(",
"calen... | 91cf751dafdb208a0c8b5377945e5808b99f94ba |
valid | holidays | This call allows you to fetch a number of trade dates or holidays from a given date. For example, if you want the next trading day, you would call /ref-data/us/dates/trade/next/1.
https://iexcloud.io/docs/api/#u-s-exchanges
8am, 9am, 12pm, 1pm UTC daily
Args:
direction (string); "next" or "last"
... | pyEX/refdata.py | def holidays(direction='next', last=1, startDate=None, token='', version=''):
'''This call allows you to fetch a number of trade dates or holidays from a given date. For example, if you want the next trading day, you would call /ref-data/us/dates/trade/next/1.
https://iexcloud.io/docs/api/#u-s-exchanges
8a... | def holidays(direction='next', last=1, startDate=None, token='', version=''):
'''This call allows you to fetch a number of trade dates or holidays from a given date. For example, if you want the next trading day, you would call /ref-data/us/dates/trade/next/1.
https://iexcloud.io/docs/api/#u-s-exchanges
8a... | [
"This",
"call",
"allows",
"you",
"to",
"fetch",
"a",
"number",
"of",
"trade",
"dates",
"or",
"holidays",
"from",
"a",
"given",
"date",
".",
"For",
"example",
"if",
"you",
"want",
"the",
"next",
"trading",
"day",
"you",
"would",
"call",
"/",
"ref",
"-",... | timkpaine/pyEX | python | https://github.com/timkpaine/pyEX/blob/91cf751dafdb208a0c8b5377945e5808b99f94ba/pyEX/refdata.py#L83-L99 | [
"def",
"holidays",
"(",
"direction",
"=",
"'next'",
",",
"last",
"=",
"1",
",",
"startDate",
"=",
"None",
",",
"token",
"=",
"''",
",",
"version",
"=",
"''",
")",
":",
"return",
"calendar",
"(",
"'holiday'",
",",
"direction",
",",
"last",
",",
"start... | 91cf751dafdb208a0c8b5377945e5808b99f94ba |
valid | holidaysDF | This call allows you to fetch a number of trade dates or holidays from a given date. For example, if you want the next trading day, you would call /ref-data/us/dates/trade/next/1.
https://iexcloud.io/docs/api/#u-s-exchanges
8am, 9am, 12pm, 1pm UTC daily
Args:
direction (string); "next" or "last"
... | pyEX/refdata.py | def holidaysDF(direction='next', last=1, startDate=None, token='', version=''):
'''This call allows you to fetch a number of trade dates or holidays from a given date. For example, if you want the next trading day, you would call /ref-data/us/dates/trade/next/1.
https://iexcloud.io/docs/api/#u-s-exchanges
... | def holidaysDF(direction='next', last=1, startDate=None, token='', version=''):
'''This call allows you to fetch a number of trade dates or holidays from a given date. For example, if you want the next trading day, you would call /ref-data/us/dates/trade/next/1.
https://iexcloud.io/docs/api/#u-s-exchanges
... | [
"This",
"call",
"allows",
"you",
"to",
"fetch",
"a",
"number",
"of",
"trade",
"dates",
"or",
"holidays",
"from",
"a",
"given",
"date",
".",
"For",
"example",
"if",
"you",
"want",
"the",
"next",
"trading",
"day",
"you",
"would",
"call",
"/",
"ref",
"-",... | timkpaine/pyEX | python | https://github.com/timkpaine/pyEX/blob/91cf751dafdb208a0c8b5377945e5808b99f94ba/pyEX/refdata.py#L102-L118 | [
"def",
"holidaysDF",
"(",
"direction",
"=",
"'next'",
",",
"last",
"=",
"1",
",",
"startDate",
"=",
"None",
",",
"token",
"=",
"''",
",",
"version",
"=",
"''",
")",
":",
"return",
"calendarDF",
"(",
"'holiday'",
",",
"direction",
",",
"last",
",",
"s... | 91cf751dafdb208a0c8b5377945e5808b99f94ba |
valid | internationalSymbols | This call returns an array of international symbols that IEX Cloud supports for API calls.
https://iexcloud.io/docs/api/#international-symbols
8am, 9am, 12pm, 1pm UTC daily
Args:
region (string); region, 2 letter case insensitive string of country codes using ISO 3166-1 alpha-2
exchange (s... | pyEX/refdata.py | def internationalSymbols(region='', exchange='', token='', version=''):
'''This call returns an array of international symbols that IEX Cloud supports for API calls.
https://iexcloud.io/docs/api/#international-symbols
8am, 9am, 12pm, 1pm UTC daily
Args:
region (string); region, 2 letter case i... | def internationalSymbols(region='', exchange='', token='', version=''):
'''This call returns an array of international symbols that IEX Cloud supports for API calls.
https://iexcloud.io/docs/api/#international-symbols
8am, 9am, 12pm, 1pm UTC daily
Args:
region (string); region, 2 letter case i... | [
"This",
"call",
"returns",
"an",
"array",
"of",
"international",
"symbols",
"that",
"IEX",
"Cloud",
"supports",
"for",
"API",
"calls",
"."
] | timkpaine/pyEX | python | https://github.com/timkpaine/pyEX/blob/91cf751dafdb208a0c8b5377945e5808b99f94ba/pyEX/refdata.py#L186-L205 | [
"def",
"internationalSymbols",
"(",
"region",
"=",
"''",
",",
"exchange",
"=",
"''",
",",
"token",
"=",
"''",
",",
"version",
"=",
"''",
")",
":",
"if",
"region",
":",
"return",
"_getJson",
"(",
"'ref-data/region/{region}/symbols'",
".",
"format",
"(",
"re... | 91cf751dafdb208a0c8b5377945e5808b99f94ba |
valid | symbolsDF | This call returns an array of symbols that IEX Cloud supports for API calls.
https://iexcloud.io/docs/api/#symbols
8am, 9am, 12pm, 1pm UTC daily
Args:
token (string); Access token
version (string); API version
Returns:
dataframe: result | pyEX/refdata.py | def symbolsDF(token='', version=''):
'''This call returns an array of symbols that IEX Cloud supports for API calls.
https://iexcloud.io/docs/api/#symbols
8am, 9am, 12pm, 1pm UTC daily
Args:
token (string); Access token
version (string); API version
Returns:
dataframe: res... | def symbolsDF(token='', version=''):
'''This call returns an array of symbols that IEX Cloud supports for API calls.
https://iexcloud.io/docs/api/#symbols
8am, 9am, 12pm, 1pm UTC daily
Args:
token (string); Access token
version (string); API version
Returns:
dataframe: res... | [
"This",
"call",
"returns",
"an",
"array",
"of",
"symbols",
"that",
"IEX",
"Cloud",
"supports",
"for",
"API",
"calls",
"."
] | timkpaine/pyEX | python | https://github.com/timkpaine/pyEX/blob/91cf751dafdb208a0c8b5377945e5808b99f94ba/pyEX/refdata.py#L208-L224 | [
"def",
"symbolsDF",
"(",
"token",
"=",
"''",
",",
"version",
"=",
"''",
")",
":",
"df",
"=",
"pd",
".",
"DataFrame",
"(",
"symbols",
"(",
"token",
",",
"version",
")",
")",
"_toDatetime",
"(",
"df",
")",
"_reindex",
"(",
"df",
",",
"'symbol'",
")",... | 91cf751dafdb208a0c8b5377945e5808b99f94ba |
valid | iexSymbolsDF | This call returns an array of symbols the Investors Exchange supports for trading.
This list is updated daily as of 7:45 a.m. ET. Symbols may be added or removed by the Investors Exchange after the list was produced.
https://iexcloud.io/docs/api/#iex-symbols
8am, 9am, 12pm, 1pm UTC daily
Args:
... | pyEX/refdata.py | def iexSymbolsDF(token='', version=''):
'''This call returns an array of symbols the Investors Exchange supports for trading.
This list is updated daily as of 7:45 a.m. ET. Symbols may be added or removed by the Investors Exchange after the list was produced.
https://iexcloud.io/docs/api/#iex-symbols
8... | def iexSymbolsDF(token='', version=''):
'''This call returns an array of symbols the Investors Exchange supports for trading.
This list is updated daily as of 7:45 a.m. ET. Symbols may be added or removed by the Investors Exchange after the list was produced.
https://iexcloud.io/docs/api/#iex-symbols
8... | [
"This",
"call",
"returns",
"an",
"array",
"of",
"symbols",
"the",
"Investors",
"Exchange",
"supports",
"for",
"trading",
".",
"This",
"list",
"is",
"updated",
"daily",
"as",
"of",
"7",
":",
"45",
"a",
".",
"m",
".",
"ET",
".",
"Symbols",
"may",
"be",
... | timkpaine/pyEX | python | https://github.com/timkpaine/pyEX/blob/91cf751dafdb208a0c8b5377945e5808b99f94ba/pyEX/refdata.py#L227-L244 | [
"def",
"iexSymbolsDF",
"(",
"token",
"=",
"''",
",",
"version",
"=",
"''",
")",
":",
"df",
"=",
"pd",
".",
"DataFrame",
"(",
"iexSymbols",
"(",
"token",
",",
"version",
")",
")",
"_toDatetime",
"(",
"df",
")",
"_reindex",
"(",
"df",
",",
"'symbol'",
... | 91cf751dafdb208a0c8b5377945e5808b99f94ba |
valid | mutualFundSymbolsDF | This call returns an array of mutual fund symbols that IEX Cloud supports for API calls.
https://iexcloud.io/docs/api/#mutual-fund-symbols
8am, 9am, 12pm, 1pm UTC daily
Args:
token (string); Access token
version (string); API version
Returns:
DataFrame: result | pyEX/refdata.py | def mutualFundSymbolsDF(token='', version=''):
'''This call returns an array of mutual fund symbols that IEX Cloud supports for API calls.
https://iexcloud.io/docs/api/#mutual-fund-symbols
8am, 9am, 12pm, 1pm UTC daily
Args:
token (string); Access token
version (string); API version
... | def mutualFundSymbolsDF(token='', version=''):
'''This call returns an array of mutual fund symbols that IEX Cloud supports for API calls.
https://iexcloud.io/docs/api/#mutual-fund-symbols
8am, 9am, 12pm, 1pm UTC daily
Args:
token (string); Access token
version (string); API version
... | [
"This",
"call",
"returns",
"an",
"array",
"of",
"mutual",
"fund",
"symbols",
"that",
"IEX",
"Cloud",
"supports",
"for",
"API",
"calls",
"."
] | timkpaine/pyEX | python | https://github.com/timkpaine/pyEX/blob/91cf751dafdb208a0c8b5377945e5808b99f94ba/pyEX/refdata.py#L247-L263 | [
"def",
"mutualFundSymbolsDF",
"(",
"token",
"=",
"''",
",",
"version",
"=",
"''",
")",
":",
"df",
"=",
"pd",
".",
"DataFrame",
"(",
"mutualFundSymbols",
"(",
"token",
",",
"version",
")",
")",
"_toDatetime",
"(",
"df",
")",
"_reindex",
"(",
"df",
",",
... | 91cf751dafdb208a0c8b5377945e5808b99f94ba |
valid | otcSymbolsDF | This call returns an array of OTC symbols that IEX Cloud supports for API calls.
https://iexcloud.io/docs/api/#otc-symbols
8am, 9am, 12pm, 1pm UTC daily
Args:
token (string); Access token
version (string); API version
Returns:
DataFrame: result | pyEX/refdata.py | def otcSymbolsDF(token='', version=''):
'''This call returns an array of OTC symbols that IEX Cloud supports for API calls.
https://iexcloud.io/docs/api/#otc-symbols
8am, 9am, 12pm, 1pm UTC daily
Args:
token (string); Access token
version (string); API version
Returns:
Dat... | def otcSymbolsDF(token='', version=''):
'''This call returns an array of OTC symbols that IEX Cloud supports for API calls.
https://iexcloud.io/docs/api/#otc-symbols
8am, 9am, 12pm, 1pm UTC daily
Args:
token (string); Access token
version (string); API version
Returns:
Dat... | [
"This",
"call",
"returns",
"an",
"array",
"of",
"OTC",
"symbols",
"that",
"IEX",
"Cloud",
"supports",
"for",
"API",
"calls",
"."
] | timkpaine/pyEX | python | https://github.com/timkpaine/pyEX/blob/91cf751dafdb208a0c8b5377945e5808b99f94ba/pyEX/refdata.py#L266-L282 | [
"def",
"otcSymbolsDF",
"(",
"token",
"=",
"''",
",",
"version",
"=",
"''",
")",
":",
"df",
"=",
"pd",
".",
"DataFrame",
"(",
"otcSymbols",
"(",
"token",
",",
"version",
")",
")",
"_toDatetime",
"(",
"df",
")",
"_reindex",
"(",
"df",
",",
"'symbol'",
... | 91cf751dafdb208a0c8b5377945e5808b99f94ba |
valid | internationalSymbolsDF | This call returns an array of international symbols that IEX Cloud supports for API calls.
https://iexcloud.io/docs/api/#international-symbols
8am, 9am, 12pm, 1pm UTC daily
Args:
region (string); region, 2 letter case insensitive string of country codes using ISO 3166-1 alpha-2
exchange (s... | pyEX/refdata.py | def internationalSymbolsDF(region='', exchange='', token='', version=''):
'''This call returns an array of international symbols that IEX Cloud supports for API calls.
https://iexcloud.io/docs/api/#international-symbols
8am, 9am, 12pm, 1pm UTC daily
Args:
region (string); region, 2 letter case... | def internationalSymbolsDF(region='', exchange='', token='', version=''):
'''This call returns an array of international symbols that IEX Cloud supports for API calls.
https://iexcloud.io/docs/api/#international-symbols
8am, 9am, 12pm, 1pm UTC daily
Args:
region (string); region, 2 letter case... | [
"This",
"call",
"returns",
"an",
"array",
"of",
"international",
"symbols",
"that",
"IEX",
"Cloud",
"supports",
"for",
"API",
"calls",
"."
] | timkpaine/pyEX | python | https://github.com/timkpaine/pyEX/blob/91cf751dafdb208a0c8b5377945e5808b99f94ba/pyEX/refdata.py#L285-L303 | [
"def",
"internationalSymbolsDF",
"(",
"region",
"=",
"''",
",",
"exchange",
"=",
"''",
",",
"token",
"=",
"''",
",",
"version",
"=",
"''",
")",
":",
"df",
"=",
"pd",
".",
"DataFrame",
"(",
"internationalSymbols",
"(",
"region",
",",
"exchange",
",",
"t... | 91cf751dafdb208a0c8b5377945e5808b99f94ba |
valid | internationalSymbolsList | This call returns an array of international symbols that IEX Cloud supports for API calls.
https://iexcloud.io/docs/api/#international-symbols
8am, 9am, 12pm, 1pm UTC daily
Args:
region (string); region, 2 letter case insensitive string of country codes using ISO 3166-1 alpha-2
exchange (s... | pyEX/refdata.py | def internationalSymbolsList(region='', exchange='', token='', version=''):
'''This call returns an array of international symbols that IEX Cloud supports for API calls.
https://iexcloud.io/docs/api/#international-symbols
8am, 9am, 12pm, 1pm UTC daily
Args:
region (string); region, 2 letter ca... | def internationalSymbolsList(region='', exchange='', token='', version=''):
'''This call returns an array of international symbols that IEX Cloud supports for API calls.
https://iexcloud.io/docs/api/#international-symbols
8am, 9am, 12pm, 1pm UTC daily
Args:
region (string); region, 2 letter ca... | [
"This",
"call",
"returns",
"an",
"array",
"of",
"international",
"symbols",
"that",
"IEX",
"Cloud",
"supports",
"for",
"API",
"calls",
"."
] | timkpaine/pyEX | python | https://github.com/timkpaine/pyEX/blob/91cf751dafdb208a0c8b5377945e5808b99f94ba/pyEX/refdata.py#L371-L386 | [
"def",
"internationalSymbolsList",
"(",
"region",
"=",
"''",
",",
"exchange",
"=",
"''",
",",
"token",
"=",
"''",
",",
"version",
"=",
"''",
")",
":",
"return",
"internationalSymbolsDF",
"(",
"region",
",",
"exchange",
",",
"token",
",",
"version",
")",
... | 91cf751dafdb208a0c8b5377945e5808b99f94ba |
valid | marketsDF | https://iextrading.com/developer/docs/#intraday | pyEX/markets.py | def marketsDF(token='', version=''):
'''https://iextrading.com/developer/docs/#intraday'''
df = pd.DataFrame(markets(token, version))
_toDatetime(df)
return df | def marketsDF(token='', version=''):
'''https://iextrading.com/developer/docs/#intraday'''
df = pd.DataFrame(markets(token, version))
_toDatetime(df)
return df | [
"https",
":",
"//",
"iextrading",
".",
"com",
"/",
"developer",
"/",
"docs",
"/",
"#intraday"
] | timkpaine/pyEX | python | https://github.com/timkpaine/pyEX/blob/91cf751dafdb208a0c8b5377945e5808b99f94ba/pyEX/markets.py#L13-L17 | [
"def",
"marketsDF",
"(",
"token",
"=",
"''",
",",
"version",
"=",
"''",
")",
":",
"df",
"=",
"pd",
".",
"DataFrame",
"(",
"markets",
"(",
"token",
",",
"version",
")",
")",
"_toDatetime",
"(",
"df",
")",
"return",
"df"
] | 91cf751dafdb208a0c8b5377945e5808b99f94ba |
valid | _getJson | for backwards compat, accepting token and version but ignoring | pyEX/common.py | def _getJson(url, token='', version=''):
'''for backwards compat, accepting token and version but ignoring'''
if token:
return _getJsonIEXCloud(url, token, version)
return _getJsonOrig(url) | def _getJson(url, token='', version=''):
'''for backwards compat, accepting token and version but ignoring'''
if token:
return _getJsonIEXCloud(url, token, version)
return _getJsonOrig(url) | [
"for",
"backwards",
"compat",
"accepting",
"token",
"and",
"version",
"but",
"ignoring"
] | timkpaine/pyEX | python | https://github.com/timkpaine/pyEX/blob/91cf751dafdb208a0c8b5377945e5808b99f94ba/pyEX/common.py#L91-L95 | [
"def",
"_getJson",
"(",
"url",
",",
"token",
"=",
"''",
",",
"version",
"=",
"''",
")",
":",
"if",
"token",
":",
"return",
"_getJsonIEXCloud",
"(",
"url",
",",
"token",
",",
"version",
")",
"return",
"_getJsonOrig",
"(",
"url",
")"
] | 91cf751dafdb208a0c8b5377945e5808b99f94ba |
valid | _getJsonOrig | internal | pyEX/common.py | def _getJsonOrig(url):
'''internal'''
url = _URL_PREFIX + url
resp = requests.get(urlparse(url).geturl(), proxies=_PYEX_PROXIES)
if resp.status_code == 200:
return resp.json()
raise PyEXception('Response %d - ' % resp.status_code, resp.text) | def _getJsonOrig(url):
'''internal'''
url = _URL_PREFIX + url
resp = requests.get(urlparse(url).geturl(), proxies=_PYEX_PROXIES)
if resp.status_code == 200:
return resp.json()
raise PyEXception('Response %d - ' % resp.status_code, resp.text) | [
"internal"
] | timkpaine/pyEX | python | https://github.com/timkpaine/pyEX/blob/91cf751dafdb208a0c8b5377945e5808b99f94ba/pyEX/common.py#L98-L104 | [
"def",
"_getJsonOrig",
"(",
"url",
")",
":",
"url",
"=",
"_URL_PREFIX",
"+",
"url",
"resp",
"=",
"requests",
".",
"get",
"(",
"urlparse",
"(",
"url",
")",
".",
"geturl",
"(",
")",
",",
"proxies",
"=",
"_PYEX_PROXIES",
")",
"if",
"resp",
".",
"status_... | 91cf751dafdb208a0c8b5377945e5808b99f94ba |
valid | _getJsonIEXCloud | for iex cloud | pyEX/common.py | def _getJsonIEXCloud(url, token='', version='beta'):
'''for iex cloud'''
url = _URL_PREFIX2.format(version=version) + url
resp = requests.get(urlparse(url).geturl(), proxies=_PYEX_PROXIES, params={'token': token})
if resp.status_code == 200:
return resp.json()
raise PyEXception('Response %d ... | def _getJsonIEXCloud(url, token='', version='beta'):
'''for iex cloud'''
url = _URL_PREFIX2.format(version=version) + url
resp = requests.get(urlparse(url).geturl(), proxies=_PYEX_PROXIES, params={'token': token})
if resp.status_code == 200:
return resp.json()
raise PyEXception('Response %d ... | [
"for",
"iex",
"cloud"
] | timkpaine/pyEX | python | https://github.com/timkpaine/pyEX/blob/91cf751dafdb208a0c8b5377945e5808b99f94ba/pyEX/common.py#L107-L113 | [
"def",
"_getJsonIEXCloud",
"(",
"url",
",",
"token",
"=",
"''",
",",
"version",
"=",
"'beta'",
")",
":",
"url",
"=",
"_URL_PREFIX2",
".",
"format",
"(",
"version",
"=",
"version",
")",
"+",
"url",
"resp",
"=",
"requests",
".",
"get",
"(",
"urlparse",
... | 91cf751dafdb208a0c8b5377945e5808b99f94ba |
valid | _strOrDate | internal | pyEX/common.py | def _strOrDate(st):
'''internal'''
if isinstance(st, string_types):
return st
elif isinstance(st, datetime):
return st.strftime('%Y%m%d')
raise PyEXception('Not a date: %s', str(st)) | def _strOrDate(st):
'''internal'''
if isinstance(st, string_types):
return st
elif isinstance(st, datetime):
return st.strftime('%Y%m%d')
raise PyEXception('Not a date: %s', str(st)) | [
"internal"
] | timkpaine/pyEX | python | https://github.com/timkpaine/pyEX/blob/91cf751dafdb208a0c8b5377945e5808b99f94ba/pyEX/common.py#L133-L139 | [
"def",
"_strOrDate",
"(",
"st",
")",
":",
"if",
"isinstance",
"(",
"st",
",",
"string_types",
")",
":",
"return",
"st",
"elif",
"isinstance",
"(",
"st",
",",
"datetime",
")",
":",
"return",
"st",
".",
"strftime",
"(",
"'%Y%m%d'",
")",
"raise",
"PyEXcep... | 91cf751dafdb208a0c8b5377945e5808b99f94ba |
valid | _raiseIfNotStr | internal | pyEX/common.py | def _raiseIfNotStr(s):
'''internal'''
if s is not None and not isinstance(s, string_types):
raise PyEXception('Cannot use type %s' % str(type(s))) | def _raiseIfNotStr(s):
'''internal'''
if s is not None and not isinstance(s, string_types):
raise PyEXception('Cannot use type %s' % str(type(s))) | [
"internal"
] | timkpaine/pyEX | python | https://github.com/timkpaine/pyEX/blob/91cf751dafdb208a0c8b5377945e5808b99f94ba/pyEX/common.py#L142-L145 | [
"def",
"_raiseIfNotStr",
"(",
"s",
")",
":",
"if",
"s",
"is",
"not",
"None",
"and",
"not",
"isinstance",
"(",
"s",
",",
"string_types",
")",
":",
"raise",
"PyEXception",
"(",
"'Cannot use type %s'",
"%",
"str",
"(",
"type",
"(",
"s",
")",
")",
")"
] | 91cf751dafdb208a0c8b5377945e5808b99f94ba |
valid | _tryJson | internal | pyEX/common.py | def _tryJson(data, raw=True):
'''internal'''
if raw:
return data
try:
return json.loads(data)
except ValueError:
return data | def _tryJson(data, raw=True):
'''internal'''
if raw:
return data
try:
return json.loads(data)
except ValueError:
return data | [
"internal"
] | timkpaine/pyEX | python | https://github.com/timkpaine/pyEX/blob/91cf751dafdb208a0c8b5377945e5808b99f94ba/pyEX/common.py#L148-L155 | [
"def",
"_tryJson",
"(",
"data",
",",
"raw",
"=",
"True",
")",
":",
"if",
"raw",
":",
"return",
"data",
"try",
":",
"return",
"json",
".",
"loads",
"(",
"data",
")",
"except",
"ValueError",
":",
"return",
"data"
] | 91cf751dafdb208a0c8b5377945e5808b99f94ba |
valid | _stream | internal | pyEX/common.py | def _stream(url, sendinit=None, on_data=print):
'''internal'''
cl = WSClient(url, sendinit=sendinit, on_data=on_data)
return cl | def _stream(url, sendinit=None, on_data=print):
'''internal'''
cl = WSClient(url, sendinit=sendinit, on_data=on_data)
return cl | [
"internal"
] | timkpaine/pyEX | python | https://github.com/timkpaine/pyEX/blob/91cf751dafdb208a0c8b5377945e5808b99f94ba/pyEX/common.py#L192-L195 | [
"def",
"_stream",
"(",
"url",
",",
"sendinit",
"=",
"None",
",",
"on_data",
"=",
"print",
")",
":",
"cl",
"=",
"WSClient",
"(",
"url",
",",
"sendinit",
"=",
"sendinit",
",",
"on_data",
"=",
"on_data",
")",
"return",
"cl"
] | 91cf751dafdb208a0c8b5377945e5808b99f94ba |
valid | _streamSSE | internal | pyEX/common.py | def _streamSSE(url, on_data=print, accrue=False):
'''internal'''
messages = SSEClient(url)
if accrue:
ret = []
for msg in messages:
data = msg.data
on_data(json.loads(data))
if accrue:
ret.append(msg)
return ret | def _streamSSE(url, on_data=print, accrue=False):
'''internal'''
messages = SSEClient(url)
if accrue:
ret = []
for msg in messages:
data = msg.data
on_data(json.loads(data))
if accrue:
ret.append(msg)
return ret | [
"internal"
] | timkpaine/pyEX | python | https://github.com/timkpaine/pyEX/blob/91cf751dafdb208a0c8b5377945e5808b99f94ba/pyEX/common.py#L198-L210 | [
"def",
"_streamSSE",
"(",
"url",
",",
"on_data",
"=",
"print",
",",
"accrue",
"=",
"False",
")",
":",
"messages",
"=",
"SSEClient",
"(",
"url",
")",
"if",
"accrue",
":",
"ret",
"=",
"[",
"]",
"for",
"msg",
"in",
"messages",
":",
"data",
"=",
"msg",... | 91cf751dafdb208a0c8b5377945e5808b99f94ba |
valid | _reindex | internal | pyEX/common.py | def _reindex(df, col):
'''internal'''
if col in df.columns:
df.set_index(col, inplace=True) | def _reindex(df, col):
'''internal'''
if col in df.columns:
df.set_index(col, inplace=True) | [
"internal"
] | timkpaine/pyEX | python | https://github.com/timkpaine/pyEX/blob/91cf751dafdb208a0c8b5377945e5808b99f94ba/pyEX/common.py#L213-L216 | [
"def",
"_reindex",
"(",
"df",
",",
"col",
")",
":",
"if",
"col",
"in",
"df",
".",
"columns",
":",
"df",
".",
"set_index",
"(",
"col",
",",
"inplace",
"=",
"True",
")"
] | 91cf751dafdb208a0c8b5377945e5808b99f94ba |
valid | _toDatetime | internal | pyEX/common.py | def _toDatetime(df, cols=None, tcols=None):
'''internal'''
cols = cols or _STANDARD_DATE_FIELDS
tcols = tcols = _STANDARD_TIME_FIELDS
for col in cols:
if col in df:
df[col] = pd.to_datetime(df[col], infer_datetime_format=True, errors='coerce')
for tcol in tcols:
if tcol... | def _toDatetime(df, cols=None, tcols=None):
'''internal'''
cols = cols or _STANDARD_DATE_FIELDS
tcols = tcols = _STANDARD_TIME_FIELDS
for col in cols:
if col in df:
df[col] = pd.to_datetime(df[col], infer_datetime_format=True, errors='coerce')
for tcol in tcols:
if tcol... | [
"internal"
] | timkpaine/pyEX | python | https://github.com/timkpaine/pyEX/blob/91cf751dafdb208a0c8b5377945e5808b99f94ba/pyEX/common.py#L219-L230 | [
"def",
"_toDatetime",
"(",
"df",
",",
"cols",
"=",
"None",
",",
"tcols",
"=",
"None",
")",
":",
"cols",
"=",
"cols",
"or",
"_STANDARD_DATE_FIELDS",
"tcols",
"=",
"tcols",
"=",
"_STANDARD_TIME_FIELDS",
"for",
"col",
"in",
"cols",
":",
"if",
"col",
"in",
... | 91cf751dafdb208a0c8b5377945e5808b99f94ba |
valid | balanceSheet | Pulls balance sheet data. Available quarterly (4 quarters) and annually (4 years)
https://iexcloud.io/docs/api/#balance-sheet
Updates at 8am, 9am UTC daily
Args:
symbol (string); Ticker to request
token (string); Access token
version (string); API version
Returns:
dic... | pyEX/stocks.py | def balanceSheet(symbol, token='', version=''):
'''Pulls balance sheet data. Available quarterly (4 quarters) and annually (4 years)
https://iexcloud.io/docs/api/#balance-sheet
Updates at 8am, 9am UTC daily
Args:
symbol (string); Ticker to request
token (string); Access token
... | def balanceSheet(symbol, token='', version=''):
'''Pulls balance sheet data. Available quarterly (4 quarters) and annually (4 years)
https://iexcloud.io/docs/api/#balance-sheet
Updates at 8am, 9am UTC daily
Args:
symbol (string); Ticker to request
token (string); Access token
... | [
"Pulls",
"balance",
"sheet",
"data",
".",
"Available",
"quarterly",
"(",
"4",
"quarters",
")",
"and",
"annually",
"(",
"4",
"years",
")"
] | timkpaine/pyEX | python | https://github.com/timkpaine/pyEX/blob/91cf751dafdb208a0c8b5377945e5808b99f94ba/pyEX/stocks.py#L12-L28 | [
"def",
"balanceSheet",
"(",
"symbol",
",",
"token",
"=",
"''",
",",
"version",
"=",
"''",
")",
":",
"_raiseIfNotStr",
"(",
"symbol",
")",
"return",
"_getJson",
"(",
"'stock/'",
"+",
"symbol",
"+",
"'/balance-sheet'",
",",
"token",
",",
"version",
")"
] | 91cf751dafdb208a0c8b5377945e5808b99f94ba |
valid | balanceSheetDF | Pulls balance sheet data. Available quarterly (4 quarters) and annually (4 years)
https://iexcloud.io/docs/api/#balance-sheet
Updates at 8am, 9am UTC daily
Args:
symbol (string); Ticker to request
token (string); Access token
version (string); API version
Returns:
Dat... | pyEX/stocks.py | def balanceSheetDF(symbol, token='', version=''):
'''Pulls balance sheet data. Available quarterly (4 quarters) and annually (4 years)
https://iexcloud.io/docs/api/#balance-sheet
Updates at 8am, 9am UTC daily
Args:
symbol (string); Ticker to request
token (string); Access token
... | def balanceSheetDF(symbol, token='', version=''):
'''Pulls balance sheet data. Available quarterly (4 quarters) and annually (4 years)
https://iexcloud.io/docs/api/#balance-sheet
Updates at 8am, 9am UTC daily
Args:
symbol (string); Ticker to request
token (string); Access token
... | [
"Pulls",
"balance",
"sheet",
"data",
".",
"Available",
"quarterly",
"(",
"4",
"quarters",
")",
"and",
"annually",
"(",
"4",
"years",
")"
] | timkpaine/pyEX | python | https://github.com/timkpaine/pyEX/blob/91cf751dafdb208a0c8b5377945e5808b99f94ba/pyEX/stocks.py#L31-L50 | [
"def",
"balanceSheetDF",
"(",
"symbol",
",",
"token",
"=",
"''",
",",
"version",
"=",
"''",
")",
":",
"val",
"=",
"balanceSheet",
"(",
"symbol",
",",
"token",
",",
"version",
")",
"df",
"=",
"pd",
".",
"io",
".",
"json",
".",
"json_normalize",
"(",
... | 91cf751dafdb208a0c8b5377945e5808b99f94ba |
valid | batch | Batch several data requests into one invocation
https://iexcloud.io/docs/api/#batch-requests
Args:
symbols (list); List of tickers to request
fields (list); List of fields to request
range_ (string); Date range for chart
last (int);
token (string); Access token
... | pyEX/stocks.py | def batch(symbols, fields=None, range_='1m', last=10, token='', version=''):
'''Batch several data requests into one invocation
https://iexcloud.io/docs/api/#batch-requests
Args:
symbols (list); List of tickers to request
fields (list); List of fields to request
range_ (string); D... | def batch(symbols, fields=None, range_='1m', last=10, token='', version=''):
'''Batch several data requests into one invocation
https://iexcloud.io/docs/api/#batch-requests
Args:
symbols (list); List of tickers to request
fields (list); List of fields to request
range_ (string); D... | [
"Batch",
"several",
"data",
"requests",
"into",
"one",
"invocation"
] | timkpaine/pyEX | python | https://github.com/timkpaine/pyEX/blob/91cf751dafdb208a0c8b5377945e5808b99f94ba/pyEX/stocks.py#L53-L89 | [
"def",
"batch",
"(",
"symbols",
",",
"fields",
"=",
"None",
",",
"range_",
"=",
"'1m'",
",",
"last",
"=",
"10",
",",
"token",
"=",
"''",
",",
"version",
"=",
"''",
")",
":",
"fields",
"=",
"fields",
"or",
"_BATCH_TYPES",
"[",
":",
"10",
"]",
"# l... | 91cf751dafdb208a0c8b5377945e5808b99f94ba |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.