repo stringlengths 7 55 | path stringlengths 4 127 | func_name stringlengths 1 88 | original_string stringlengths 75 19.8k | language stringclasses 1
value | code stringlengths 75 19.8k | code_tokens list | docstring stringlengths 3 17.3k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 87 242 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
SFDO-Tooling/CumulusCI | cumulusci/core/config/BaseGlobalConfig.py | BaseGlobalConfig.get_project_config | def get_project_config(self, *args, **kwargs):
""" Returns a ProjectConfig for the given project """
warnings.warn(
"BaseGlobalConfig.get_project_config is pending deprecation",
DeprecationWarning,
)
return self.project_config_class(self, *args, **kwargs) | python | def get_project_config(self, *args, **kwargs):
""" Returns a ProjectConfig for the given project """
warnings.warn(
"BaseGlobalConfig.get_project_config is pending deprecation",
DeprecationWarning,
)
return self.project_config_class(self, *args, **kwargs) | [
"def",
"get_project_config",
"(",
"self",
",",
"*",
"args",
",",
"**",
"kwargs",
")",
":",
"warnings",
".",
"warn",
"(",
"\"BaseGlobalConfig.get_project_config is pending deprecation\"",
",",
"DeprecationWarning",
",",
")",
"return",
"self",
".",
"project_config_class... | Returns a ProjectConfig for the given project | [
"Returns",
"a",
"ProjectConfig",
"for",
"the",
"given",
"project"
] | e19047921ca771a297e045f22f0bb201651bb6f7 | https://github.com/SFDO-Tooling/CumulusCI/blob/e19047921ca771a297e045f22f0bb201651bb6f7/cumulusci/core/config/BaseGlobalConfig.py#L25-L31 | train |
SFDO-Tooling/CumulusCI | cumulusci/core/config/BaseGlobalConfig.py | BaseGlobalConfig._load_config | def _load_config(self):
""" Loads the local configuration """
# load the global config
with open(self.config_global_path, "r") as f_config:
config = ordered_yaml_load(f_config)
self.config_global = config
# Load the local config
if self.config_global_local_pa... | python | def _load_config(self):
""" Loads the local configuration """
# load the global config
with open(self.config_global_path, "r") as f_config:
config = ordered_yaml_load(f_config)
self.config_global = config
# Load the local config
if self.config_global_local_pa... | [
"def",
"_load_config",
"(",
"self",
")",
":",
"with",
"open",
"(",
"self",
".",
"config_global_path",
",",
"\"r\"",
")",
"as",
"f_config",
":",
"config",
"=",
"ordered_yaml_load",
"(",
"f_config",
")",
"self",
".",
"config_global",
"=",
"config",
"if",
"se... | Loads the local configuration | [
"Loads",
"the",
"local",
"configuration"
] | e19047921ca771a297e045f22f0bb201651bb6f7 | https://github.com/SFDO-Tooling/CumulusCI/blob/e19047921ca771a297e045f22f0bb201651bb6f7/cumulusci/core/config/BaseGlobalConfig.py#L51-L70 | train |
SFDO-Tooling/CumulusCI | cumulusci/core/config/OrgConfig.py | OrgConfig.username | def username(self):
""" Username for the org connection. """
username = self.config.get("username")
if not username:
username = self.userinfo__preferred_username
return username | python | def username(self):
""" Username for the org connection. """
username = self.config.get("username")
if not username:
username = self.userinfo__preferred_username
return username | [
"def",
"username",
"(",
"self",
")",
":",
"username",
"=",
"self",
".",
"config",
".",
"get",
"(",
"\"username\"",
")",
"if",
"not",
"username",
":",
"username",
"=",
"self",
".",
"userinfo__preferred_username",
"return",
"username"
] | Username for the org connection. | [
"Username",
"for",
"the",
"org",
"connection",
"."
] | e19047921ca771a297e045f22f0bb201651bb6f7 | https://github.com/SFDO-Tooling/CumulusCI/blob/e19047921ca771a297e045f22f0bb201651bb6f7/cumulusci/core/config/OrgConfig.py#L67-L72 | train |
SFDO-Tooling/CumulusCI | cumulusci/cli/cci.py | timestamp_file | def timestamp_file():
"""Opens a file for tracking the time of the last version check"""
config_dir = os.path.join(
os.path.expanduser("~"), BaseGlobalConfig.config_local_dir
)
if not os.path.exists(config_dir):
os.mkdir(config_dir)
timestamp_file = os.path.join(config_dir, "cumulu... | python | def timestamp_file():
"""Opens a file for tracking the time of the last version check"""
config_dir = os.path.join(
os.path.expanduser("~"), BaseGlobalConfig.config_local_dir
)
if not os.path.exists(config_dir):
os.mkdir(config_dir)
timestamp_file = os.path.join(config_dir, "cumulu... | [
"def",
"timestamp_file",
"(",
")",
":",
"config_dir",
"=",
"os",
".",
"path",
".",
"join",
"(",
"os",
".",
"path",
".",
"expanduser",
"(",
"\"~\"",
")",
",",
"BaseGlobalConfig",
".",
"config_local_dir",
")",
"if",
"not",
"os",
".",
"path",
".",
"exists... | Opens a file for tracking the time of the last version check | [
"Opens",
"a",
"file",
"for",
"tracking",
"the",
"time",
"of",
"the",
"last",
"version",
"check"
] | e19047921ca771a297e045f22f0bb201651bb6f7 | https://github.com/SFDO-Tooling/CumulusCI/blob/e19047921ca771a297e045f22f0bb201651bb6f7/cumulusci/cli/cci.py#L53-L69 | train |
SFDO-Tooling/CumulusCI | cumulusci/cli/cci.py | pass_config | def pass_config(func=None, **config_kw):
"""Decorator which passes the CCI config object as the first arg to a click command."""
def decorate(func):
def new_func(*args, **kw):
config = load_config(**config_kw)
func(config, *args, **kw)
return functools.update_wrapper(ne... | python | def pass_config(func=None, **config_kw):
"""Decorator which passes the CCI config object as the first arg to a click command."""
def decorate(func):
def new_func(*args, **kw):
config = load_config(**config_kw)
func(config, *args, **kw)
return functools.update_wrapper(ne... | [
"def",
"pass_config",
"(",
"func",
"=",
"None",
",",
"**",
"config_kw",
")",
":",
"def",
"decorate",
"(",
"func",
")",
":",
"def",
"new_func",
"(",
"*",
"args",
",",
"**",
"kw",
")",
":",
"config",
"=",
"load_config",
"(",
"**",
"config_kw",
")",
"... | Decorator which passes the CCI config object as the first arg to a click command. | [
"Decorator",
"which",
"passes",
"the",
"CCI",
"config",
"object",
"as",
"the",
"first",
"arg",
"to",
"a",
"click",
"command",
"."
] | e19047921ca771a297e045f22f0bb201651bb6f7 | https://github.com/SFDO-Tooling/CumulusCI/blob/e19047921ca771a297e045f22f0bb201651bb6f7/cumulusci/cli/cci.py#L213-L226 | train |
SFDO-Tooling/CumulusCI | cumulusci/cli/cci.py | ConnectServiceCommand.list_commands | def list_commands(self, ctx):
""" list the services that can be configured """
config = load_config(**self.load_config_kwargs)
services = self._get_services_config(config)
return sorted(services.keys()) | python | def list_commands(self, ctx):
""" list the services that can be configured """
config = load_config(**self.load_config_kwargs)
services = self._get_services_config(config)
return sorted(services.keys()) | [
"def",
"list_commands",
"(",
"self",
",",
"ctx",
")",
":",
"config",
"=",
"load_config",
"(",
"**",
"self",
".",
"load_config_kwargs",
")",
"services",
"=",
"self",
".",
"_get_services_config",
"(",
"config",
")",
"return",
"sorted",
"(",
"services",
".",
... | list the services that can be configured | [
"list",
"the",
"services",
"that",
"can",
"be",
"configured"
] | e19047921ca771a297e045f22f0bb201651bb6f7 | https://github.com/SFDO-Tooling/CumulusCI/blob/e19047921ca771a297e045f22f0bb201651bb6f7/cumulusci/cli/cci.py#L612-L616 | train |
SFDO-Tooling/CumulusCI | cumulusci/utils.py | parse_api_datetime | def parse_api_datetime(value):
""" parse a datetime returned from the salesforce API.
in python 3 we should just use a strptime %z, but until then we're just going
to assert that its a fixed offset of +0000 since thats the observed behavior. getting
python 2 to support fixed offset parsing is too compl... | python | def parse_api_datetime(value):
""" parse a datetime returned from the salesforce API.
in python 3 we should just use a strptime %z, but until then we're just going
to assert that its a fixed offset of +0000 since thats the observed behavior. getting
python 2 to support fixed offset parsing is too compl... | [
"def",
"parse_api_datetime",
"(",
"value",
")",
":",
"dt",
"=",
"datetime",
".",
"strptime",
"(",
"value",
"[",
"0",
":",
"DATETIME_LEN",
"]",
",",
"API_DATE_FORMAT",
")",
"offset_str",
"=",
"value",
"[",
"DATETIME_LEN",
":",
"]",
"assert",
"offset_str",
"... | parse a datetime returned from the salesforce API.
in python 3 we should just use a strptime %z, but until then we're just going
to assert that its a fixed offset of +0000 since thats the observed behavior. getting
python 2 to support fixed offset parsing is too complicated for what we need imo. | [
"parse",
"a",
"datetime",
"returned",
"from",
"the",
"salesforce",
"API",
"."
] | e19047921ca771a297e045f22f0bb201651bb6f7 | https://github.com/SFDO-Tooling/CumulusCI/blob/e19047921ca771a297e045f22f0bb201651bb6f7/cumulusci/utils.py#L38-L47 | train |
SFDO-Tooling/CumulusCI | cumulusci/utils.py | removeXmlElement | def removeXmlElement(name, directory, file_pattern, logger=None):
""" Recursively walk a directory and remove XML elements """
for path, dirs, files in os.walk(os.path.abspath(directory)):
for filename in fnmatch.filter(files, file_pattern):
filepath = os.path.join(path, filename)
... | python | def removeXmlElement(name, directory, file_pattern, logger=None):
""" Recursively walk a directory and remove XML elements """
for path, dirs, files in os.walk(os.path.abspath(directory)):
for filename in fnmatch.filter(files, file_pattern):
filepath = os.path.join(path, filename)
... | [
"def",
"removeXmlElement",
"(",
"name",
",",
"directory",
",",
"file_pattern",
",",
"logger",
"=",
"None",
")",
":",
"for",
"path",
",",
"dirs",
",",
"files",
"in",
"os",
".",
"walk",
"(",
"os",
".",
"path",
".",
"abspath",
"(",
"directory",
")",
")"... | Recursively walk a directory and remove XML elements | [
"Recursively",
"walk",
"a",
"directory",
"and",
"remove",
"XML",
"elements"
] | e19047921ca771a297e045f22f0bb201651bb6f7 | https://github.com/SFDO-Tooling/CumulusCI/blob/e19047921ca771a297e045f22f0bb201651bb6f7/cumulusci/utils.py#L100-L105 | train |
SFDO-Tooling/CumulusCI | cumulusci/utils.py | remove_xml_element_file | def remove_xml_element_file(name, path):
""" Remove XML elements from a single file """
ET.register_namespace("", "http://soap.sforce.com/2006/04/metadata")
tree = elementtree_parse_file(path)
tree = remove_xml_element(name, tree)
return tree.write(path, encoding=UTF8, xml_declaration=True) | python | def remove_xml_element_file(name, path):
""" Remove XML elements from a single file """
ET.register_namespace("", "http://soap.sforce.com/2006/04/metadata")
tree = elementtree_parse_file(path)
tree = remove_xml_element(name, tree)
return tree.write(path, encoding=UTF8, xml_declaration=True) | [
"def",
"remove_xml_element_file",
"(",
"name",
",",
"path",
")",
":",
"ET",
".",
"register_namespace",
"(",
"\"\"",
",",
"\"http://soap.sforce.com/2006/04/metadata\"",
")",
"tree",
"=",
"elementtree_parse_file",
"(",
"path",
")",
"tree",
"=",
"remove_xml_element",
"... | Remove XML elements from a single file | [
"Remove",
"XML",
"elements",
"from",
"a",
"single",
"file"
] | e19047921ca771a297e045f22f0bb201651bb6f7 | https://github.com/SFDO-Tooling/CumulusCI/blob/e19047921ca771a297e045f22f0bb201651bb6f7/cumulusci/utils.py#L108-L113 | train |
SFDO-Tooling/CumulusCI | cumulusci/utils.py | remove_xml_element_string | def remove_xml_element_string(name, content):
""" Remove XML elements from a string """
ET.register_namespace("", "http://soap.sforce.com/2006/04/metadata")
tree = ET.fromstring(content)
tree = remove_xml_element(name, tree)
clean_content = ET.tostring(tree, encoding=UTF8)
return clean_content | python | def remove_xml_element_string(name, content):
""" Remove XML elements from a string """
ET.register_namespace("", "http://soap.sforce.com/2006/04/metadata")
tree = ET.fromstring(content)
tree = remove_xml_element(name, tree)
clean_content = ET.tostring(tree, encoding=UTF8)
return clean_content | [
"def",
"remove_xml_element_string",
"(",
"name",
",",
"content",
")",
":",
"ET",
".",
"register_namespace",
"(",
"\"\"",
",",
"\"http://soap.sforce.com/2006/04/metadata\"",
")",
"tree",
"=",
"ET",
".",
"fromstring",
"(",
"content",
")",
"tree",
"=",
"remove_xml_el... | Remove XML elements from a string | [
"Remove",
"XML",
"elements",
"from",
"a",
"string"
] | e19047921ca771a297e045f22f0bb201651bb6f7 | https://github.com/SFDO-Tooling/CumulusCI/blob/e19047921ca771a297e045f22f0bb201651bb6f7/cumulusci/utils.py#L116-L122 | train |
SFDO-Tooling/CumulusCI | cumulusci/utils.py | remove_xml_element | def remove_xml_element(name, tree):
""" Removes XML elements from an ElementTree content tree """
# root = tree.getroot()
remove = tree.findall(
".//{{http://soap.sforce.com/2006/04/metadata}}{}".format(name)
)
if not remove:
return tree
parent_map = {c: p for p in tree.iter() f... | python | def remove_xml_element(name, tree):
""" Removes XML elements from an ElementTree content tree """
# root = tree.getroot()
remove = tree.findall(
".//{{http://soap.sforce.com/2006/04/metadata}}{}".format(name)
)
if not remove:
return tree
parent_map = {c: p for p in tree.iter() f... | [
"def",
"remove_xml_element",
"(",
"name",
",",
"tree",
")",
":",
"remove",
"=",
"tree",
".",
"findall",
"(",
"\".//{{http://soap.sforce.com/2006/04/metadata}}{}\"",
".",
"format",
"(",
"name",
")",
")",
"if",
"not",
"remove",
":",
"return",
"tree",
"parent_map",... | Removes XML elements from an ElementTree content tree | [
"Removes",
"XML",
"elements",
"from",
"an",
"ElementTree",
"content",
"tree"
] | e19047921ca771a297e045f22f0bb201651bb6f7 | https://github.com/SFDO-Tooling/CumulusCI/blob/e19047921ca771a297e045f22f0bb201651bb6f7/cumulusci/utils.py#L125-L140 | train |
SFDO-Tooling/CumulusCI | cumulusci/utils.py | temporary_dir | def temporary_dir():
"""Context manager that creates a temporary directory and chdirs to it.
When the context manager exits it returns to the previous cwd
and deletes the temporary directory.
"""
d = tempfile.mkdtemp()
try:
with cd(d):
yield d
finally:
if os.path... | python | def temporary_dir():
"""Context manager that creates a temporary directory and chdirs to it.
When the context manager exits it returns to the previous cwd
and deletes the temporary directory.
"""
d = tempfile.mkdtemp()
try:
with cd(d):
yield d
finally:
if os.path... | [
"def",
"temporary_dir",
"(",
")",
":",
"d",
"=",
"tempfile",
".",
"mkdtemp",
"(",
")",
"try",
":",
"with",
"cd",
"(",
"d",
")",
":",
"yield",
"d",
"finally",
":",
"if",
"os",
".",
"path",
".",
"exists",
"(",
"d",
")",
":",
"shutil",
".",
"rmtre... | Context manager that creates a temporary directory and chdirs to it.
When the context manager exits it returns to the previous cwd
and deletes the temporary directory. | [
"Context",
"manager",
"that",
"creates",
"a",
"temporary",
"directory",
"and",
"chdirs",
"to",
"it",
"."
] | e19047921ca771a297e045f22f0bb201651bb6f7 | https://github.com/SFDO-Tooling/CumulusCI/blob/e19047921ca771a297e045f22f0bb201651bb6f7/cumulusci/utils.py#L448-L460 | train |
SFDO-Tooling/CumulusCI | cumulusci/utils.py | in_directory | def in_directory(filepath, dirpath):
"""Returns a boolean for whether filepath is contained in dirpath.
Normalizes the paths (e.g. resolving symlinks and ..)
so this is the safe way to make sure a user-configured path
is located inside the user's project repo.
"""
filepath = os.path.realpath(fi... | python | def in_directory(filepath, dirpath):
"""Returns a boolean for whether filepath is contained in dirpath.
Normalizes the paths (e.g. resolving symlinks and ..)
so this is the safe way to make sure a user-configured path
is located inside the user's project repo.
"""
filepath = os.path.realpath(fi... | [
"def",
"in_directory",
"(",
"filepath",
",",
"dirpath",
")",
":",
"filepath",
"=",
"os",
".",
"path",
".",
"realpath",
"(",
"filepath",
")",
"dirpath",
"=",
"os",
".",
"path",
".",
"realpath",
"(",
"dirpath",
")",
"return",
"filepath",
"==",
"dirpath",
... | Returns a boolean for whether filepath is contained in dirpath.
Normalizes the paths (e.g. resolving symlinks and ..)
so this is the safe way to make sure a user-configured path
is located inside the user's project repo. | [
"Returns",
"a",
"boolean",
"for",
"whether",
"filepath",
"is",
"contained",
"in",
"dirpath",
"."
] | e19047921ca771a297e045f22f0bb201651bb6f7 | https://github.com/SFDO-Tooling/CumulusCI/blob/e19047921ca771a297e045f22f0bb201651bb6f7/cumulusci/utils.py#L469-L478 | train |
SFDO-Tooling/CumulusCI | cumulusci/utils.py | log_progress | def log_progress(
iterable,
logger,
batch_size=10000,
progress_message="Processing... ({})",
done_message="Done! (Total: {})",
):
"""Log progress while iterating.
"""
i = 0
for x in iterable:
yield x
i += 1
if not i % batch_size:
logger.info(progre... | python | def log_progress(
iterable,
logger,
batch_size=10000,
progress_message="Processing... ({})",
done_message="Done! (Total: {})",
):
"""Log progress while iterating.
"""
i = 0
for x in iterable:
yield x
i += 1
if not i % batch_size:
logger.info(progre... | [
"def",
"log_progress",
"(",
"iterable",
",",
"logger",
",",
"batch_size",
"=",
"10000",
",",
"progress_message",
"=",
"\"Processing... ({})\"",
",",
"done_message",
"=",
"\"Done! (Total: {})\"",
",",
")",
":",
"i",
"=",
"0",
"for",
"x",
"in",
"iterable",
":",
... | Log progress while iterating. | [
"Log",
"progress",
"while",
"iterating",
"."
] | e19047921ca771a297e045f22f0bb201651bb6f7 | https://github.com/SFDO-Tooling/CumulusCI/blob/e19047921ca771a297e045f22f0bb201651bb6f7/cumulusci/utils.py#L481-L496 | train |
SFDO-Tooling/CumulusCI | cumulusci/robotframework/CumulusCI.py | CumulusCI.login_url | def login_url(self, org=None):
""" Returns the login url which will automatically log into the target
Salesforce org. By default, the org_name passed to the library
constructor is used but this can be overridden with the org option
to log into a different org.
"""
... | python | def login_url(self, org=None):
""" Returns the login url which will automatically log into the target
Salesforce org. By default, the org_name passed to the library
constructor is used but this can be overridden with the org option
to log into a different org.
"""
... | [
"def",
"login_url",
"(",
"self",
",",
"org",
"=",
"None",
")",
":",
"if",
"org",
"is",
"None",
":",
"org",
"=",
"self",
".",
"org",
"else",
":",
"org",
"=",
"self",
".",
"keychain",
".",
"get_org",
"(",
"org",
")",
"return",
"org",
".",
"start_ur... | Returns the login url which will automatically log into the target
Salesforce org. By default, the org_name passed to the library
constructor is used but this can be overridden with the org option
to log into a different org. | [
"Returns",
"the",
"login",
"url",
"which",
"will",
"automatically",
"log",
"into",
"the",
"target",
"Salesforce",
"org",
".",
"By",
"default",
"the",
"org_name",
"passed",
"to",
"the",
"library",
"constructor",
"is",
"used",
"but",
"this",
"can",
"be",
"over... | e19047921ca771a297e045f22f0bb201651bb6f7 | https://github.com/SFDO-Tooling/CumulusCI/blob/e19047921ca771a297e045f22f0bb201651bb6f7/cumulusci/robotframework/CumulusCI.py#L105-L115 | train |
SFDO-Tooling/CumulusCI | cumulusci/robotframework/CumulusCI.py | CumulusCI.run_task | def run_task(self, task_name, **options):
""" Runs a named CumulusCI task for the current project with optional
support for overriding task options via kwargs.
Examples:
| =Keyword= | =task_name= | =task_options= | =comment= |
|... | python | def run_task(self, task_name, **options):
""" Runs a named CumulusCI task for the current project with optional
support for overriding task options via kwargs.
Examples:
| =Keyword= | =task_name= | =task_options= | =comment= |
|... | [
"def",
"run_task",
"(",
"self",
",",
"task_name",
",",
"**",
"options",
")",
":",
"task_config",
"=",
"self",
".",
"project_config",
".",
"get_task",
"(",
"task_name",
")",
"class_path",
"=",
"task_config",
".",
"class_path",
"logger",
".",
"console",
"(",
... | Runs a named CumulusCI task for the current project with optional
support for overriding task options via kwargs.
Examples:
| =Keyword= | =task_name= | =task_options= | =comment= |
| Run Task | deploy | ... | [
"Runs",
"a",
"named",
"CumulusCI",
"task",
"for",
"the",
"current",
"project",
"with",
"optional",
"support",
"for",
"overriding",
"task",
"options",
"via",
"kwargs",
"."
] | e19047921ca771a297e045f22f0bb201651bb6f7 | https://github.com/SFDO-Tooling/CumulusCI/blob/e19047921ca771a297e045f22f0bb201651bb6f7/cumulusci/robotframework/CumulusCI.py#L137-L150 | train |
SFDO-Tooling/CumulusCI | cumulusci/robotframework/CumulusCI.py | CumulusCI.run_task_class | def run_task_class(self, class_path, **options):
""" Runs a CumulusCI task class with task options via kwargs.
Use this keyword to run logic from CumulusCI tasks which have not
been configured in the project's cumulusci.yml file. This is
most useful in cases where a test ne... | python | def run_task_class(self, class_path, **options):
""" Runs a CumulusCI task class with task options via kwargs.
Use this keyword to run logic from CumulusCI tasks which have not
been configured in the project's cumulusci.yml file. This is
most useful in cases where a test ne... | [
"def",
"run_task_class",
"(",
"self",
",",
"class_path",
",",
"**",
"options",
")",
":",
"logger",
".",
"console",
"(",
"\"\\n\"",
")",
"task_class",
",",
"task_config",
"=",
"self",
".",
"_init_task",
"(",
"class_path",
",",
"options",
",",
"TaskConfig",
... | Runs a CumulusCI task class with task options via kwargs.
Use this keyword to run logic from CumulusCI tasks which have not
been configured in the project's cumulusci.yml file. This is
most useful in cases where a test needs to use task logic for
logic unique to the tes... | [
"Runs",
"a",
"CumulusCI",
"task",
"class",
"with",
"task",
"options",
"via",
"kwargs",
"."
] | e19047921ca771a297e045f22f0bb201651bb6f7 | https://github.com/SFDO-Tooling/CumulusCI/blob/e19047921ca771a297e045f22f0bb201651bb6f7/cumulusci/robotframework/CumulusCI.py#L152-L167 | train |
SFDO-Tooling/CumulusCI | cumulusci/core/config/BaseTaskFlowConfig.py | BaseTaskFlowConfig.get_task | def get_task(self, name):
""" Returns a TaskConfig """
config = getattr(self, "tasks__{}".format(name))
if not config:
raise TaskNotFoundError("Task not found: {}".format(name))
return TaskConfig(config) | python | def get_task(self, name):
""" Returns a TaskConfig """
config = getattr(self, "tasks__{}".format(name))
if not config:
raise TaskNotFoundError("Task not found: {}".format(name))
return TaskConfig(config) | [
"def",
"get_task",
"(",
"self",
",",
"name",
")",
":",
"config",
"=",
"getattr",
"(",
"self",
",",
"\"tasks__{}\"",
".",
"format",
"(",
"name",
")",
")",
"if",
"not",
"config",
":",
"raise",
"TaskNotFoundError",
"(",
"\"Task not found: {}\"",
".",
"format"... | Returns a TaskConfig | [
"Returns",
"a",
"TaskConfig"
] | e19047921ca771a297e045f22f0bb201651bb6f7 | https://github.com/SFDO-Tooling/CumulusCI/blob/e19047921ca771a297e045f22f0bb201651bb6f7/cumulusci/core/config/BaseTaskFlowConfig.py#L32-L37 | train |
SFDO-Tooling/CumulusCI | cumulusci/core/config/BaseTaskFlowConfig.py | BaseTaskFlowConfig.get_flow | def get_flow(self, name):
""" Returns a FlowConfig """
config = getattr(self, "flows__{}".format(name))
if not config:
raise FlowNotFoundError("Flow not found: {}".format(name))
return FlowConfig(config) | python | def get_flow(self, name):
""" Returns a FlowConfig """
config = getattr(self, "flows__{}".format(name))
if not config:
raise FlowNotFoundError("Flow not found: {}".format(name))
return FlowConfig(config) | [
"def",
"get_flow",
"(",
"self",
",",
"name",
")",
":",
"config",
"=",
"getattr",
"(",
"self",
",",
"\"flows__{}\"",
".",
"format",
"(",
"name",
")",
")",
"if",
"not",
"config",
":",
"raise",
"FlowNotFoundError",
"(",
"\"Flow not found: {}\"",
".",
"format"... | Returns a FlowConfig | [
"Returns",
"a",
"FlowConfig"
] | e19047921ca771a297e045f22f0bb201651bb6f7 | https://github.com/SFDO-Tooling/CumulusCI/blob/e19047921ca771a297e045f22f0bb201651bb6f7/cumulusci/core/config/BaseTaskFlowConfig.py#L43-L48 | train |
SFDO-Tooling/CumulusCI | cumulusci/tasks/release_notes/generator.py | BaseReleaseNotesGenerator.render | def render(self):
""" Returns the rendered release notes from all parsers as a string """
release_notes = []
for parser in self.parsers:
parser_content = parser.render()
if parser_content is not None:
release_notes.append(parser_content)
return u"\... | python | def render(self):
""" Returns the rendered release notes from all parsers as a string """
release_notes = []
for parser in self.parsers:
parser_content = parser.render()
if parser_content is not None:
release_notes.append(parser_content)
return u"\... | [
"def",
"render",
"(",
"self",
")",
":",
"release_notes",
"=",
"[",
"]",
"for",
"parser",
"in",
"self",
".",
"parsers",
":",
"parser_content",
"=",
"parser",
".",
"render",
"(",
")",
"if",
"parser_content",
"is",
"not",
"None",
":",
"release_notes",
".",
... | Returns the rendered release notes from all parsers as a string | [
"Returns",
"the",
"rendered",
"release",
"notes",
"from",
"all",
"parsers",
"as",
"a",
"string"
] | e19047921ca771a297e045f22f0bb201651bb6f7 | https://github.com/SFDO-Tooling/CumulusCI/blob/e19047921ca771a297e045f22f0bb201651bb6f7/cumulusci/tasks/release_notes/generator.py#L52-L59 | train |
SFDO-Tooling/CumulusCI | cumulusci/tasks/release_notes/generator.py | GithubReleaseNotesGenerator._update_release_content | def _update_release_content(self, release, content):
"""Merge existing and new release content."""
if release.body:
new_body = []
current_parser = None
is_start_line = False
for parser in self.parsers:
parser.replaced = False
#... | python | def _update_release_content(self, release, content):
"""Merge existing and new release content."""
if release.body:
new_body = []
current_parser = None
is_start_line = False
for parser in self.parsers:
parser.replaced = False
#... | [
"def",
"_update_release_content",
"(",
"self",
",",
"release",
",",
"content",
")",
":",
"if",
"release",
".",
"body",
":",
"new_body",
"=",
"[",
"]",
"current_parser",
"=",
"None",
"is_start_line",
"=",
"False",
"for",
"parser",
"in",
"self",
".",
"parser... | Merge existing and new release content. | [
"Merge",
"existing",
"and",
"new",
"release",
"content",
"."
] | e19047921ca771a297e045f22f0bb201651bb6f7 | https://github.com/SFDO-Tooling/CumulusCI/blob/e19047921ca771a297e045f22f0bb201651bb6f7/cumulusci/tasks/release_notes/generator.py#L139-L191 | train |
SFDO-Tooling/CumulusCI | cumulusci/core/runtime.py | BaseCumulusCI.get_flow | def get_flow(self, name, options=None):
""" Get a primed and readytogo flow coordinator. """
config = self.project_config.get_flow(name)
callbacks = self.callback_class()
coordinator = FlowCoordinator(
self.project_config,
config,
name=name,
... | python | def get_flow(self, name, options=None):
""" Get a primed and readytogo flow coordinator. """
config = self.project_config.get_flow(name)
callbacks = self.callback_class()
coordinator = FlowCoordinator(
self.project_config,
config,
name=name,
... | [
"def",
"get_flow",
"(",
"self",
",",
"name",
",",
"options",
"=",
"None",
")",
":",
"config",
"=",
"self",
".",
"project_config",
".",
"get_flow",
"(",
"name",
")",
"callbacks",
"=",
"self",
".",
"callback_class",
"(",
")",
"coordinator",
"=",
"FlowCoord... | Get a primed and readytogo flow coordinator. | [
"Get",
"a",
"primed",
"and",
"readytogo",
"flow",
"coordinator",
"."
] | e19047921ca771a297e045f22f0bb201651bb6f7 | https://github.com/SFDO-Tooling/CumulusCI/blob/e19047921ca771a297e045f22f0bb201651bb6f7/cumulusci/core/runtime.py#L94-L106 | train |
SFDO-Tooling/CumulusCI | cumulusci/core/keychain/EnvironmentProjectKeychain.py | EnvironmentProjectKeychain._get_env | def _get_env(self):
""" loads the environment variables as unicode if ascii """
env = {}
for k, v in os.environ.items():
k = k.decode() if isinstance(k, bytes) else k
v = v.decode() if isinstance(v, bytes) else v
env[k] = v
return list(env.items()) | python | def _get_env(self):
""" loads the environment variables as unicode if ascii """
env = {}
for k, v in os.environ.items():
k = k.decode() if isinstance(k, bytes) else k
v = v.decode() if isinstance(v, bytes) else v
env[k] = v
return list(env.items()) | [
"def",
"_get_env",
"(",
"self",
")",
":",
"env",
"=",
"{",
"}",
"for",
"k",
",",
"v",
"in",
"os",
".",
"environ",
".",
"items",
"(",
")",
":",
"k",
"=",
"k",
".",
"decode",
"(",
")",
"if",
"isinstance",
"(",
"k",
",",
"bytes",
")",
"else",
... | loads the environment variables as unicode if ascii | [
"loads",
"the",
"environment",
"variables",
"as",
"unicode",
"if",
"ascii"
] | e19047921ca771a297e045f22f0bb201651bb6f7 | https://github.com/SFDO-Tooling/CumulusCI/blob/e19047921ca771a297e045f22f0bb201651bb6f7/cumulusci/core/keychain/EnvironmentProjectKeychain.py#L20-L27 | train |
SFDO-Tooling/CumulusCI | cumulusci/core/utils.py | import_class | def import_class(path):
""" Import a class from a string module class path """
components = path.split(".")
module = components[:-1]
module = ".".join(module)
mod = __import__(module, fromlist=[native_str(components[-1])])
return getattr(mod, native_str(components[-1])) | python | def import_class(path):
""" Import a class from a string module class path """
components = path.split(".")
module = components[:-1]
module = ".".join(module)
mod = __import__(module, fromlist=[native_str(components[-1])])
return getattr(mod, native_str(components[-1])) | [
"def",
"import_class",
"(",
"path",
")",
":",
"components",
"=",
"path",
".",
"split",
"(",
"\".\"",
")",
"module",
"=",
"components",
"[",
":",
"-",
"1",
"]",
"module",
"=",
"\".\"",
".",
"join",
"(",
"module",
")",
"mod",
"=",
"__import__",
"(",
... | Import a class from a string module class path | [
"Import",
"a",
"class",
"from",
"a",
"string",
"module",
"class",
"path"
] | e19047921ca771a297e045f22f0bb201651bb6f7 | https://github.com/SFDO-Tooling/CumulusCI/blob/e19047921ca771a297e045f22f0bb201651bb6f7/cumulusci/core/utils.py#L24-L30 | train |
SFDO-Tooling/CumulusCI | cumulusci/core/utils.py | parse_datetime | def parse_datetime(dt_str, format):
"""Create a timezone-aware datetime object from a datetime string."""
t = time.strptime(dt_str, format)
return datetime(t[0], t[1], t[2], t[3], t[4], t[5], t[6], pytz.UTC) | python | def parse_datetime(dt_str, format):
"""Create a timezone-aware datetime object from a datetime string."""
t = time.strptime(dt_str, format)
return datetime(t[0], t[1], t[2], t[3], t[4], t[5], t[6], pytz.UTC) | [
"def",
"parse_datetime",
"(",
"dt_str",
",",
"format",
")",
":",
"t",
"=",
"time",
".",
"strptime",
"(",
"dt_str",
",",
"format",
")",
"return",
"datetime",
"(",
"t",
"[",
"0",
"]",
",",
"t",
"[",
"1",
"]",
",",
"t",
"[",
"2",
"]",
",",
"t",
... | Create a timezone-aware datetime object from a datetime string. | [
"Create",
"a",
"timezone",
"-",
"aware",
"datetime",
"object",
"from",
"a",
"datetime",
"string",
"."
] | e19047921ca771a297e045f22f0bb201651bb6f7 | https://github.com/SFDO-Tooling/CumulusCI/blob/e19047921ca771a297e045f22f0bb201651bb6f7/cumulusci/core/utils.py#L33-L36 | train |
SFDO-Tooling/CumulusCI | cumulusci/core/utils.py | process_list_arg | def process_list_arg(arg):
""" Parse a string into a list separated by commas with whitespace stripped """
if isinstance(arg, list):
return arg
elif isinstance(arg, basestring):
args = []
for part in arg.split(","):
args.append(part.strip())
return args | python | def process_list_arg(arg):
""" Parse a string into a list separated by commas with whitespace stripped """
if isinstance(arg, list):
return arg
elif isinstance(arg, basestring):
args = []
for part in arg.split(","):
args.append(part.strip())
return args | [
"def",
"process_list_arg",
"(",
"arg",
")",
":",
"if",
"isinstance",
"(",
"arg",
",",
"list",
")",
":",
"return",
"arg",
"elif",
"isinstance",
"(",
"arg",
",",
"basestring",
")",
":",
"args",
"=",
"[",
"]",
"for",
"part",
"in",
"arg",
".",
"split",
... | Parse a string into a list separated by commas with whitespace stripped | [
"Parse",
"a",
"string",
"into",
"a",
"list",
"separated",
"by",
"commas",
"with",
"whitespace",
"stripped"
] | e19047921ca771a297e045f22f0bb201651bb6f7 | https://github.com/SFDO-Tooling/CumulusCI/blob/e19047921ca771a297e045f22f0bb201651bb6f7/cumulusci/core/utils.py#L50-L58 | train |
SFDO-Tooling/CumulusCI | cumulusci/core/utils.py | decode_to_unicode | def decode_to_unicode(content):
""" decode ISO-8859-1 to unicode, when using sf api """
if content and not isinstance(content, str):
try:
# Try to decode ISO-8859-1 to unicode
return content.decode("ISO-8859-1")
except UnicodeEncodeError:
# Assume content is u... | python | def decode_to_unicode(content):
""" decode ISO-8859-1 to unicode, when using sf api """
if content and not isinstance(content, str):
try:
# Try to decode ISO-8859-1 to unicode
return content.decode("ISO-8859-1")
except UnicodeEncodeError:
# Assume content is u... | [
"def",
"decode_to_unicode",
"(",
"content",
")",
":",
"if",
"content",
"and",
"not",
"isinstance",
"(",
"content",
",",
"str",
")",
":",
"try",
":",
"return",
"content",
".",
"decode",
"(",
"\"ISO-8859-1\"",
")",
"except",
"UnicodeEncodeError",
":",
"return"... | decode ISO-8859-1 to unicode, when using sf api | [
"decode",
"ISO",
"-",
"8859",
"-",
"1",
"to",
"unicode",
"when",
"using",
"sf",
"api"
] | e19047921ca771a297e045f22f0bb201651bb6f7 | https://github.com/SFDO-Tooling/CumulusCI/blob/e19047921ca771a297e045f22f0bb201651bb6f7/cumulusci/core/utils.py#L61-L70 | train |
SFDO-Tooling/CumulusCI | cumulusci/tasks/metadeploy.py | Publish._find_or_create_version | def _find_or_create_version(self, product):
"""Create a Version in MetaDeploy if it doesn't already exist
"""
tag = self.options["tag"]
label = self.project_config.get_version_for_tag(tag)
result = self._call_api(
"GET", "/versions", params={"product": product["id"],... | python | def _find_or_create_version(self, product):
"""Create a Version in MetaDeploy if it doesn't already exist
"""
tag = self.options["tag"]
label = self.project_config.get_version_for_tag(tag)
result = self._call_api(
"GET", "/versions", params={"product": product["id"],... | [
"def",
"_find_or_create_version",
"(",
"self",
",",
"product",
")",
":",
"tag",
"=",
"self",
".",
"options",
"[",
"\"tag\"",
"]",
"label",
"=",
"self",
".",
"project_config",
".",
"get_version_for_tag",
"(",
"tag",
")",
"result",
"=",
"self",
".",
"_call_a... | Create a Version in MetaDeploy if it doesn't already exist | [
"Create",
"a",
"Version",
"in",
"MetaDeploy",
"if",
"it",
"doesn",
"t",
"already",
"exist"
] | e19047921ca771a297e045f22f0bb201651bb6f7 | https://github.com/SFDO-Tooling/CumulusCI/blob/e19047921ca771a297e045f22f0bb201651bb6f7/cumulusci/tasks/metadeploy.py#L168-L194 | train |
SFDO-Tooling/CumulusCI | cumulusci/tasks/robotframework/libdoc.py | RobotLibDoc._render_html | def _render_html(self, libraries):
"""Generate the html. `libraries` is a list of LibraryDocumentation objects"""
title = self.options.get("title", "Keyword Documentation")
date = time.strftime("%A %B %d, %I:%M %p")
cci_version = cumulusci.__version__
stylesheet_path = os.path.... | python | def _render_html(self, libraries):
"""Generate the html. `libraries` is a list of LibraryDocumentation objects"""
title = self.options.get("title", "Keyword Documentation")
date = time.strftime("%A %B %d, %I:%M %p")
cci_version = cumulusci.__version__
stylesheet_path = os.path.... | [
"def",
"_render_html",
"(",
"self",
",",
"libraries",
")",
":",
"title",
"=",
"self",
".",
"options",
".",
"get",
"(",
"\"title\"",
",",
"\"Keyword Documentation\"",
")",
"date",
"=",
"time",
".",
"strftime",
"(",
"\"%A %B %d, %I:%M %p\"",
")",
"cci_version",
... | Generate the html. `libraries` is a list of LibraryDocumentation objects | [
"Generate",
"the",
"html",
".",
"libraries",
"is",
"a",
"list",
"of",
"LibraryDocumentation",
"objects"
] | e19047921ca771a297e045f22f0bb201651bb6f7 | https://github.com/SFDO-Tooling/CumulusCI/blob/e19047921ca771a297e045f22f0bb201651bb6f7/cumulusci/tasks/robotframework/libdoc.py#L84-L106 | train |
SFDO-Tooling/CumulusCI | cumulusci/core/config/ScratchOrgConfig.py | ScratchOrgConfig.generate_password | def generate_password(self):
"""Generates an org password with the sfdx utility. """
if self.password_failed:
self.logger.warning("Skipping resetting password since last attempt failed")
return
# Set a random password so it's available via cci org info
command =... | python | def generate_password(self):
"""Generates an org password with the sfdx utility. """
if self.password_failed:
self.logger.warning("Skipping resetting password since last attempt failed")
return
# Set a random password so it's available via cci org info
command =... | [
"def",
"generate_password",
"(",
"self",
")",
":",
"if",
"self",
".",
"password_failed",
":",
"self",
".",
"logger",
".",
"warning",
"(",
"\"Skipping resetting password since last attempt failed\"",
")",
"return",
"command",
"=",
"sarge",
".",
"shell_format",
"(",
... | Generates an org password with the sfdx utility. | [
"Generates",
"an",
"org",
"password",
"with",
"the",
"sfdx",
"utility",
"."
] | e19047921ca771a297e045f22f0bb201651bb6f7 | https://github.com/SFDO-Tooling/CumulusCI/blob/e19047921ca771a297e045f22f0bb201651bb6f7/cumulusci/core/config/ScratchOrgConfig.py#L241-L274 | train |
SFDO-Tooling/CumulusCI | cumulusci/core/keychain/BaseProjectKeychain.py | BaseProjectKeychain._convert_connected_app | def _convert_connected_app(self):
"""Convert Connected App to service"""
if self.services and "connected_app" in self.services:
# already a service
return
connected_app = self.get_connected_app()
if not connected_app:
# not configured
retur... | python | def _convert_connected_app(self):
"""Convert Connected App to service"""
if self.services and "connected_app" in self.services:
# already a service
return
connected_app = self.get_connected_app()
if not connected_app:
# not configured
retur... | [
"def",
"_convert_connected_app",
"(",
"self",
")",
":",
"if",
"self",
".",
"services",
"and",
"\"connected_app\"",
"in",
"self",
".",
"services",
":",
"return",
"connected_app",
"=",
"self",
".",
"get_connected_app",
"(",
")",
"if",
"not",
"connected_app",
":"... | Convert Connected App to service | [
"Convert",
"Connected",
"App",
"to",
"service"
] | e19047921ca771a297e045f22f0bb201651bb6f7 | https://github.com/SFDO-Tooling/CumulusCI/blob/e19047921ca771a297e045f22f0bb201651bb6f7/cumulusci/core/keychain/BaseProjectKeychain.py#L22-L45 | train |
SFDO-Tooling/CumulusCI | cumulusci/core/keychain/BaseProjectKeychain.py | BaseProjectKeychain._load_scratch_orgs | def _load_scratch_orgs(self):
""" Creates all scratch org configs for the project in the keychain if
a keychain org doesn't already exist """
current_orgs = self.list_orgs()
if not self.project_config.orgs__scratch:
return
for config_name in self.project_config.or... | python | def _load_scratch_orgs(self):
""" Creates all scratch org configs for the project in the keychain if
a keychain org doesn't already exist """
current_orgs = self.list_orgs()
if not self.project_config.orgs__scratch:
return
for config_name in self.project_config.or... | [
"def",
"_load_scratch_orgs",
"(",
"self",
")",
":",
"current_orgs",
"=",
"self",
".",
"list_orgs",
"(",
")",
"if",
"not",
"self",
".",
"project_config",
".",
"orgs__scratch",
":",
"return",
"for",
"config_name",
"in",
"self",
".",
"project_config",
".",
"org... | Creates all scratch org configs for the project in the keychain if
a keychain org doesn't already exist | [
"Creates",
"all",
"scratch",
"org",
"configs",
"for",
"the",
"project",
"in",
"the",
"keychain",
"if",
"a",
"keychain",
"org",
"doesn",
"t",
"already",
"exist"
] | e19047921ca771a297e045f22f0bb201651bb6f7 | https://github.com/SFDO-Tooling/CumulusCI/blob/e19047921ca771a297e045f22f0bb201651bb6f7/cumulusci/core/keychain/BaseProjectKeychain.py#L59-L69 | train |
SFDO-Tooling/CumulusCI | cumulusci/core/keychain/BaseProjectKeychain.py | BaseProjectKeychain.change_key | def change_key(self, key):
""" re-encrypt stored services and orgs with the new key """
services = {}
for service_name in self.list_services():
services[service_name] = self.get_service(service_name)
orgs = {}
for org_name in self.list_orgs():
orgs[org_n... | python | def change_key(self, key):
""" re-encrypt stored services and orgs with the new key """
services = {}
for service_name in self.list_services():
services[service_name] = self.get_service(service_name)
orgs = {}
for org_name in self.list_orgs():
orgs[org_n... | [
"def",
"change_key",
"(",
"self",
",",
"key",
")",
":",
"services",
"=",
"{",
"}",
"for",
"service_name",
"in",
"self",
".",
"list_services",
"(",
")",
":",
"services",
"[",
"service_name",
"]",
"=",
"self",
".",
"get_service",
"(",
"service_name",
")",
... | re-encrypt stored services and orgs with the new key | [
"re",
"-",
"encrypt",
"stored",
"services",
"and",
"orgs",
"with",
"the",
"new",
"key"
] | e19047921ca771a297e045f22f0bb201651bb6f7 | https://github.com/SFDO-Tooling/CumulusCI/blob/e19047921ca771a297e045f22f0bb201651bb6f7/cumulusci/core/keychain/BaseProjectKeychain.py#L95-L116 | train |
SFDO-Tooling/CumulusCI | cumulusci/core/keychain/BaseProjectKeychain.py | BaseProjectKeychain.get_default_org | def get_default_org(self):
""" retrieve the name and configuration of the default org """
for org in self.list_orgs():
org_config = self.get_org(org)
if org_config.default:
return org, org_config
return None, None | python | def get_default_org(self):
""" retrieve the name and configuration of the default org """
for org in self.list_orgs():
org_config = self.get_org(org)
if org_config.default:
return org, org_config
return None, None | [
"def",
"get_default_org",
"(",
"self",
")",
":",
"for",
"org",
"in",
"self",
".",
"list_orgs",
"(",
")",
":",
"org_config",
"=",
"self",
".",
"get_org",
"(",
"org",
")",
"if",
"org_config",
".",
"default",
":",
"return",
"org",
",",
"org_config",
"retu... | retrieve the name and configuration of the default org | [
"retrieve",
"the",
"name",
"and",
"configuration",
"of",
"the",
"default",
"org"
] | e19047921ca771a297e045f22f0bb201651bb6f7 | https://github.com/SFDO-Tooling/CumulusCI/blob/e19047921ca771a297e045f22f0bb201651bb6f7/cumulusci/core/keychain/BaseProjectKeychain.py#L143-L149 | train |
SFDO-Tooling/CumulusCI | cumulusci/core/keychain/BaseProjectKeychain.py | BaseProjectKeychain.set_default_org | def set_default_org(self, name):
""" set the default org for tasks by name key """
org = self.get_org(name)
self.unset_default_org()
org.config["default"] = True
self.set_org(org) | python | def set_default_org(self, name):
""" set the default org for tasks by name key """
org = self.get_org(name)
self.unset_default_org()
org.config["default"] = True
self.set_org(org) | [
"def",
"set_default_org",
"(",
"self",
",",
"name",
")",
":",
"org",
"=",
"self",
".",
"get_org",
"(",
"name",
")",
"self",
".",
"unset_default_org",
"(",
")",
"org",
".",
"config",
"[",
"\"default\"",
"]",
"=",
"True",
"self",
".",
"set_org",
"(",
"... | set the default org for tasks by name key | [
"set",
"the",
"default",
"org",
"for",
"tasks",
"by",
"name",
"key"
] | e19047921ca771a297e045f22f0bb201651bb6f7 | https://github.com/SFDO-Tooling/CumulusCI/blob/e19047921ca771a297e045f22f0bb201651bb6f7/cumulusci/core/keychain/BaseProjectKeychain.py#L151-L156 | train |
SFDO-Tooling/CumulusCI | cumulusci/core/keychain/BaseProjectKeychain.py | BaseProjectKeychain.unset_default_org | def unset_default_org(self):
""" unset the default orgs for tasks """
for org in self.list_orgs():
org_config = self.get_org(org)
if org_config.default:
del org_config.config["default"]
self.set_org(org_config) | python | def unset_default_org(self):
""" unset the default orgs for tasks """
for org in self.list_orgs():
org_config = self.get_org(org)
if org_config.default:
del org_config.config["default"]
self.set_org(org_config) | [
"def",
"unset_default_org",
"(",
"self",
")",
":",
"for",
"org",
"in",
"self",
".",
"list_orgs",
"(",
")",
":",
"org_config",
"=",
"self",
".",
"get_org",
"(",
"org",
")",
"if",
"org_config",
".",
"default",
":",
"del",
"org_config",
".",
"config",
"["... | unset the default orgs for tasks | [
"unset",
"the",
"default",
"orgs",
"for",
"tasks"
] | e19047921ca771a297e045f22f0bb201651bb6f7 | https://github.com/SFDO-Tooling/CumulusCI/blob/e19047921ca771a297e045f22f0bb201651bb6f7/cumulusci/core/keychain/BaseProjectKeychain.py#L158-L164 | train |
SFDO-Tooling/CumulusCI | cumulusci/core/keychain/BaseProjectKeychain.py | BaseProjectKeychain.get_org | def get_org(self, name):
""" retrieve an org configuration by name key """
if name not in self.orgs:
self._raise_org_not_found(name)
return self._get_org(name) | python | def get_org(self, name):
""" retrieve an org configuration by name key """
if name not in self.orgs:
self._raise_org_not_found(name)
return self._get_org(name) | [
"def",
"get_org",
"(",
"self",
",",
"name",
")",
":",
"if",
"name",
"not",
"in",
"self",
".",
"orgs",
":",
"self",
".",
"_raise_org_not_found",
"(",
"name",
")",
"return",
"self",
".",
"_get_org",
"(",
"name",
")"
] | retrieve an org configuration by name key | [
"retrieve",
"an",
"org",
"configuration",
"by",
"name",
"key"
] | e19047921ca771a297e045f22f0bb201651bb6f7 | https://github.com/SFDO-Tooling/CumulusCI/blob/e19047921ca771a297e045f22f0bb201651bb6f7/cumulusci/core/keychain/BaseProjectKeychain.py#L166-L170 | train |
SFDO-Tooling/CumulusCI | cumulusci/core/keychain/BaseProjectKeychain.py | BaseProjectKeychain.list_orgs | def list_orgs(self):
""" list the orgs configured in the keychain """
orgs = list(self.orgs.keys())
orgs.sort()
return orgs | python | def list_orgs(self):
""" list the orgs configured in the keychain """
orgs = list(self.orgs.keys())
orgs.sort()
return orgs | [
"def",
"list_orgs",
"(",
"self",
")",
":",
"orgs",
"=",
"list",
"(",
"self",
".",
"orgs",
".",
"keys",
"(",
")",
")",
"orgs",
".",
"sort",
"(",
")",
"return",
"orgs"
] | list the orgs configured in the keychain | [
"list",
"the",
"orgs",
"configured",
"in",
"the",
"keychain"
] | e19047921ca771a297e045f22f0bb201651bb6f7 | https://github.com/SFDO-Tooling/CumulusCI/blob/e19047921ca771a297e045f22f0bb201651bb6f7/cumulusci/core/keychain/BaseProjectKeychain.py#L178-L182 | train |
SFDO-Tooling/CumulusCI | cumulusci/core/keychain/BaseProjectKeychain.py | BaseProjectKeychain.set_service | def set_service(self, name, service_config, project=False):
""" Store a ServiceConfig in the keychain """
if not self.project_config.services or name not in self.project_config.services:
self._raise_service_not_valid(name)
self._validate_service(name, service_config)
self._se... | python | def set_service(self, name, service_config, project=False):
""" Store a ServiceConfig in the keychain """
if not self.project_config.services or name not in self.project_config.services:
self._raise_service_not_valid(name)
self._validate_service(name, service_config)
self._se... | [
"def",
"set_service",
"(",
"self",
",",
"name",
",",
"service_config",
",",
"project",
"=",
"False",
")",
":",
"if",
"not",
"self",
".",
"project_config",
".",
"services",
"or",
"name",
"not",
"in",
"self",
".",
"project_config",
".",
"services",
":",
"s... | Store a ServiceConfig in the keychain | [
"Store",
"a",
"ServiceConfig",
"in",
"the",
"keychain"
] | e19047921ca771a297e045f22f0bb201651bb6f7 | https://github.com/SFDO-Tooling/CumulusCI/blob/e19047921ca771a297e045f22f0bb201651bb6f7/cumulusci/core/keychain/BaseProjectKeychain.py#L184-L190 | train |
SFDO-Tooling/CumulusCI | cumulusci/core/keychain/BaseProjectKeychain.py | BaseProjectKeychain.get_service | def get_service(self, name):
""" Retrieve a stored ServiceConfig from the keychain or exception
:param name: the service name to retrieve
:type name: str
:rtype ServiceConfig
:return the configured Service
"""
self._convert_connected_app()
if not self.pr... | python | def get_service(self, name):
""" Retrieve a stored ServiceConfig from the keychain or exception
:param name: the service name to retrieve
:type name: str
:rtype ServiceConfig
:return the configured Service
"""
self._convert_connected_app()
if not self.pr... | [
"def",
"get_service",
"(",
"self",
",",
"name",
")",
":",
"self",
".",
"_convert_connected_app",
"(",
")",
"if",
"not",
"self",
".",
"project_config",
".",
"services",
"or",
"name",
"not",
"in",
"self",
".",
"project_config",
".",
"services",
":",
"self",
... | Retrieve a stored ServiceConfig from the keychain or exception
:param name: the service name to retrieve
:type name: str
:rtype ServiceConfig
:return the configured Service | [
"Retrieve",
"a",
"stored",
"ServiceConfig",
"from",
"the",
"keychain",
"or",
"exception"
] | e19047921ca771a297e045f22f0bb201651bb6f7 | https://github.com/SFDO-Tooling/CumulusCI/blob/e19047921ca771a297e045f22f0bb201651bb6f7/cumulusci/core/keychain/BaseProjectKeychain.py#L195-L210 | train |
SFDO-Tooling/CumulusCI | cumulusci/core/keychain/BaseProjectKeychain.py | BaseProjectKeychain.list_services | def list_services(self):
""" list the services configured in the keychain """
services = list(self.services.keys())
services.sort()
return services | python | def list_services(self):
""" list the services configured in the keychain """
services = list(self.services.keys())
services.sort()
return services | [
"def",
"list_services",
"(",
"self",
")",
":",
"services",
"=",
"list",
"(",
"self",
".",
"services",
".",
"keys",
"(",
")",
")",
"services",
".",
"sort",
"(",
")",
"return",
"services"
] | list the services configured in the keychain | [
"list",
"the",
"services",
"configured",
"in",
"the",
"keychain"
] | e19047921ca771a297e045f22f0bb201651bb6f7 | https://github.com/SFDO-Tooling/CumulusCI/blob/e19047921ca771a297e045f22f0bb201651bb6f7/cumulusci/core/keychain/BaseProjectKeychain.py#L240-L244 | train |
SFDO-Tooling/CumulusCI | cumulusci/robotframework/utils.py | set_pdb_trace | def set_pdb_trace(pm=False):
"""Start the Python debugger when robotframework is running.
This makes sure that pdb can use stdin/stdout even though
robotframework has redirected I/O.
"""
import sys
import pdb
for attr in ("stdin", "stdout", "stderr"):
setattr(sys, attr, getattr(sys... | python | def set_pdb_trace(pm=False):
"""Start the Python debugger when robotframework is running.
This makes sure that pdb can use stdin/stdout even though
robotframework has redirected I/O.
"""
import sys
import pdb
for attr in ("stdin", "stdout", "stderr"):
setattr(sys, attr, getattr(sys... | [
"def",
"set_pdb_trace",
"(",
"pm",
"=",
"False",
")",
":",
"import",
"sys",
"import",
"pdb",
"for",
"attr",
"in",
"(",
"\"stdin\"",
",",
"\"stdout\"",
",",
"\"stderr\"",
")",
":",
"setattr",
"(",
"sys",
",",
"attr",
",",
"getattr",
"(",
"sys",
",",
"... | Start the Python debugger when robotframework is running.
This makes sure that pdb can use stdin/stdout even though
robotframework has redirected I/O. | [
"Start",
"the",
"Python",
"debugger",
"when",
"robotframework",
"is",
"running",
"."
] | e19047921ca771a297e045f22f0bb201651bb6f7 | https://github.com/SFDO-Tooling/CumulusCI/blob/e19047921ca771a297e045f22f0bb201651bb6f7/cumulusci/robotframework/utils.py#L10-L25 | train |
SFDO-Tooling/CumulusCI | cumulusci/robotframework/utils.py | selenium_retry | def selenium_retry(target=None, retry=True):
"""Decorator to turn on automatic retries of flaky selenium failures.
Decorate a robotframework library class to turn on retries for all
selenium calls from that library:
@selenium_retry
class MyLibrary(object):
# Decorate a method ... | python | def selenium_retry(target=None, retry=True):
"""Decorator to turn on automatic retries of flaky selenium failures.
Decorate a robotframework library class to turn on retries for all
selenium calls from that library:
@selenium_retry
class MyLibrary(object):
# Decorate a method ... | [
"def",
"selenium_retry",
"(",
"target",
"=",
"None",
",",
"retry",
"=",
"True",
")",
":",
"if",
"isinstance",
"(",
"target",
",",
"bool",
")",
":",
"retry",
"=",
"target",
"target",
"=",
"None",
"def",
"decorate",
"(",
"target",
")",
":",
"if",
"isin... | Decorator to turn on automatic retries of flaky selenium failures.
Decorate a robotframework library class to turn on retries for all
selenium calls from that library:
@selenium_retry
class MyLibrary(object):
# Decorate a method to turn it back off for that method
@sel... | [
"Decorator",
"to",
"turn",
"on",
"automatic",
"retries",
"of",
"flaky",
"selenium",
"failures",
"."
] | e19047921ca771a297e045f22f0bb201651bb6f7 | https://github.com/SFDO-Tooling/CumulusCI/blob/e19047921ca771a297e045f22f0bb201651bb6f7/cumulusci/robotframework/utils.py#L137-L202 | train |
SFDO-Tooling/CumulusCI | cumulusci/robotframework/utils.py | RetryingSeleniumLibraryMixin.selenium_execute_with_retry | def selenium_execute_with_retry(self, execute, command, params):
"""Run a single selenium command and retry once.
The retry happens for certain errors that are likely to be resolved
by retrying.
"""
try:
return execute(command, params)
except Exception as e:
... | python | def selenium_execute_with_retry(self, execute, command, params):
"""Run a single selenium command and retry once.
The retry happens for certain errors that are likely to be resolved
by retrying.
"""
try:
return execute(command, params)
except Exception as e:
... | [
"def",
"selenium_execute_with_retry",
"(",
"self",
",",
"execute",
",",
"command",
",",
"params",
")",
":",
"try",
":",
"return",
"execute",
"(",
"command",
",",
"params",
")",
"except",
"Exception",
"as",
"e",
":",
"if",
"isinstance",
"(",
"e",
",",
"AL... | Run a single selenium command and retry once.
The retry happens for certain errors that are likely to be resolved
by retrying. | [
"Run",
"a",
"single",
"selenium",
"command",
"and",
"retry",
"once",
"."
] | e19047921ca771a297e045f22f0bb201651bb6f7 | https://github.com/SFDO-Tooling/CumulusCI/blob/e19047921ca771a297e045f22f0bb201651bb6f7/cumulusci/robotframework/utils.py#L105-L123 | train |
SFDO-Tooling/CumulusCI | cumulusci/tasks/release_notes/provider.py | GithubChangeNotesProvider._get_last_tag | def _get_last_tag(self):
""" Gets the last release tag before self.current_tag """
current_version = LooseVersion(
self._get_version_from_tag(self.release_notes_generator.current_tag)
)
versions = []
for tag in self.repo.tags():
if not tag.name.startswit... | python | def _get_last_tag(self):
""" Gets the last release tag before self.current_tag """
current_version = LooseVersion(
self._get_version_from_tag(self.release_notes_generator.current_tag)
)
versions = []
for tag in self.repo.tags():
if not tag.name.startswit... | [
"def",
"_get_last_tag",
"(",
"self",
")",
":",
"current_version",
"=",
"LooseVersion",
"(",
"self",
".",
"_get_version_from_tag",
"(",
"self",
".",
"release_notes_generator",
".",
"current_tag",
")",
")",
"versions",
"=",
"[",
"]",
"for",
"tag",
"in",
"self",
... | Gets the last release tag before self.current_tag | [
"Gets",
"the",
"last",
"release",
"tag",
"before",
"self",
".",
"current_tag"
] | e19047921ca771a297e045f22f0bb201651bb6f7 | https://github.com/SFDO-Tooling/CumulusCI/blob/e19047921ca771a297e045f22f0bb201651bb6f7/cumulusci/tasks/release_notes/provider.py#L134-L151 | train |
SFDO-Tooling/CumulusCI | cumulusci/tasks/release_notes/provider.py | GithubChangeNotesProvider._get_pull_requests | def _get_pull_requests(self):
""" Gets all pull requests from the repo since we can't do a filtered
date merged search """
for pull in self.repo.pull_requests(
state="closed", base=self.github_info["master_branch"], direction="asc"
):
if self._include_pull_request... | python | def _get_pull_requests(self):
""" Gets all pull requests from the repo since we can't do a filtered
date merged search """
for pull in self.repo.pull_requests(
state="closed", base=self.github_info["master_branch"], direction="asc"
):
if self._include_pull_request... | [
"def",
"_get_pull_requests",
"(",
"self",
")",
":",
"for",
"pull",
"in",
"self",
".",
"repo",
".",
"pull_requests",
"(",
"state",
"=",
"\"closed\"",
",",
"base",
"=",
"self",
".",
"github_info",
"[",
"\"master_branch\"",
"]",
",",
"direction",
"=",
"\"asc\... | Gets all pull requests from the repo since we can't do a filtered
date merged search | [
"Gets",
"all",
"pull",
"requests",
"from",
"the",
"repo",
"since",
"we",
"can",
"t",
"do",
"a",
"filtered",
"date",
"merged",
"search"
] | e19047921ca771a297e045f22f0bb201651bb6f7 | https://github.com/SFDO-Tooling/CumulusCI/blob/e19047921ca771a297e045f22f0bb201651bb6f7/cumulusci/tasks/release_notes/provider.py#L153-L160 | train |
SFDO-Tooling/CumulusCI | cumulusci/tasks/release_notes/provider.py | GithubChangeNotesProvider._include_pull_request | def _include_pull_request(self, pull_request):
""" Checks if the given pull_request was merged to the default branch
between self.start_date and self.end_date """
merged_date = pull_request.merged_at
if not merged_date:
return False
if self.last_tag:
last... | python | def _include_pull_request(self, pull_request):
""" Checks if the given pull_request was merged to the default branch
between self.start_date and self.end_date """
merged_date = pull_request.merged_at
if not merged_date:
return False
if self.last_tag:
last... | [
"def",
"_include_pull_request",
"(",
"self",
",",
"pull_request",
")",
":",
"merged_date",
"=",
"pull_request",
".",
"merged_at",
"if",
"not",
"merged_date",
":",
"return",
"False",
"if",
"self",
".",
"last_tag",
":",
"last_tag_sha",
"=",
"self",
".",
"last_ta... | Checks if the given pull_request was merged to the default branch
between self.start_date and self.end_date | [
"Checks",
"if",
"the",
"given",
"pull_request",
"was",
"merged",
"to",
"the",
"default",
"branch",
"between",
"self",
".",
"start_date",
"and",
"self",
".",
"end_date"
] | e19047921ca771a297e045f22f0bb201651bb6f7 | https://github.com/SFDO-Tooling/CumulusCI/blob/e19047921ca771a297e045f22f0bb201651bb6f7/cumulusci/tasks/release_notes/provider.py#L162-L192 | train |
SFDO-Tooling/CumulusCI | cumulusci/tasks/robotframework/robotframework.py | patch_statusreporter | def patch_statusreporter():
"""Monkey patch robotframework to do postmortem debugging
"""
from robot.running.statusreporter import StatusReporter
orig_exit = StatusReporter.__exit__
def __exit__(self, exc_type, exc_val, exc_tb):
if exc_val and isinstance(exc_val, Exception):
se... | python | def patch_statusreporter():
"""Monkey patch robotframework to do postmortem debugging
"""
from robot.running.statusreporter import StatusReporter
orig_exit = StatusReporter.__exit__
def __exit__(self, exc_type, exc_val, exc_tb):
if exc_val and isinstance(exc_val, Exception):
se... | [
"def",
"patch_statusreporter",
"(",
")",
":",
"from",
"robot",
".",
"running",
".",
"statusreporter",
"import",
"StatusReporter",
"orig_exit",
"=",
"StatusReporter",
".",
"__exit__",
"def",
"__exit__",
"(",
"self",
",",
"exc_type",
",",
"exc_val",
",",
"exc_tb",... | Monkey patch robotframework to do postmortem debugging | [
"Monkey",
"patch",
"robotframework",
"to",
"do",
"postmortem",
"debugging"
] | e19047921ca771a297e045f22f0bb201651bb6f7 | https://github.com/SFDO-Tooling/CumulusCI/blob/e19047921ca771a297e045f22f0bb201651bb6f7/cumulusci/tasks/robotframework/robotframework.py#L92-L104 | train |
SFDO-Tooling/CumulusCI | cumulusci/tasks/metadata/package.py | MetadataXmlElementParser.get_item_name | def get_item_name(self, item, parent):
""" Returns the value of the first name element found inside of element """
names = self.get_name_elements(item)
if not names:
raise MissingNameElementError
name = names[0].text
prefix = self.item_name_prefix(parent)
if ... | python | def get_item_name(self, item, parent):
""" Returns the value of the first name element found inside of element """
names = self.get_name_elements(item)
if not names:
raise MissingNameElementError
name = names[0].text
prefix = self.item_name_prefix(parent)
if ... | [
"def",
"get_item_name",
"(",
"self",
",",
"item",
",",
"parent",
")",
":",
"names",
"=",
"self",
".",
"get_name_elements",
"(",
"item",
")",
"if",
"not",
"names",
":",
"raise",
"MissingNameElementError",
"name",
"=",
"names",
"[",
"0",
"]",
".",
"text",
... | Returns the value of the first name element found inside of element | [
"Returns",
"the",
"value",
"of",
"the",
"first",
"name",
"element",
"found",
"inside",
"of",
"element"
] | e19047921ca771a297e045f22f0bb201651bb6f7 | https://github.com/SFDO-Tooling/CumulusCI/blob/e19047921ca771a297e045f22f0bb201651bb6f7/cumulusci/tasks/metadata/package.py#L298-L309 | train |
SFDO-Tooling/CumulusCI | cumulusci/core/flowrunner.py | StepSpec.for_display | def for_display(self):
""" Step details formatted for logging output. """
skip = ""
if self.skip:
skip = " [SKIP]"
result = "{step_num}: {path}{skip}".format(
step_num=self.step_num, path=self.path, skip=skip
)
description = self.task_config.get("d... | python | def for_display(self):
""" Step details formatted for logging output. """
skip = ""
if self.skip:
skip = " [SKIP]"
result = "{step_num}: {path}{skip}".format(
step_num=self.step_num, path=self.path, skip=skip
)
description = self.task_config.get("d... | [
"def",
"for_display",
"(",
"self",
")",
":",
"skip",
"=",
"\"\"",
"if",
"self",
".",
"skip",
":",
"skip",
"=",
"\" [SKIP]\"",
"result",
"=",
"\"{step_num}: {path}{skip}\"",
".",
"format",
"(",
"step_num",
"=",
"self",
".",
"step_num",
",",
"path",
"=",
"... | Step details formatted for logging output. | [
"Step",
"details",
"formatted",
"for",
"logging",
"output",
"."
] | e19047921ca771a297e045f22f0bb201651bb6f7 | https://github.com/SFDO-Tooling/CumulusCI/blob/e19047921ca771a297e045f22f0bb201651bb6f7/cumulusci/core/flowrunner.py#L123-L134 | train |
SFDO-Tooling/CumulusCI | cumulusci/core/flowrunner.py | TaskRunner.run_step | def run_step(self):
"""
Run a step.
:return: StepResult
"""
# Resolve ^^task_name.return_value style option syntax
task_config = self.step.task_config.copy()
task_config["options"] = task_config["options"].copy()
self.flow.resolve_return_value_options(ta... | python | def run_step(self):
"""
Run a step.
:return: StepResult
"""
# Resolve ^^task_name.return_value style option syntax
task_config = self.step.task_config.copy()
task_config["options"] = task_config["options"].copy()
self.flow.resolve_return_value_options(ta... | [
"def",
"run_step",
"(",
"self",
")",
":",
"task_config",
"=",
"self",
".",
"step",
".",
"task_config",
".",
"copy",
"(",
")",
"task_config",
"[",
"\"options\"",
"]",
"=",
"task_config",
"[",
"\"options\"",
"]",
".",
"copy",
"(",
")",
"self",
".",
"flow... | Run a step.
:return: StepResult | [
"Run",
"a",
"step",
"."
] | e19047921ca771a297e045f22f0bb201651bb6f7 | https://github.com/SFDO-Tooling/CumulusCI/blob/e19047921ca771a297e045f22f0bb201651bb6f7/cumulusci/core/flowrunner.py#L187-L223 | train |
SFDO-Tooling/CumulusCI | cumulusci/core/flowrunner.py | FlowCoordinator._init_steps | def _init_steps(self,):
"""
Given the flow config and everything else, create a list of steps to run, sorted by step number.
:return: List[StepSpec]
"""
self._check_old_yaml_format()
config_steps = self.flow_config.steps
self._check_infinite_flows(config_steps)
... | python | def _init_steps(self,):
"""
Given the flow config and everything else, create a list of steps to run, sorted by step number.
:return: List[StepSpec]
"""
self._check_old_yaml_format()
config_steps = self.flow_config.steps
self._check_infinite_flows(config_steps)
... | [
"def",
"_init_steps",
"(",
"self",
",",
")",
":",
"self",
".",
"_check_old_yaml_format",
"(",
")",
"config_steps",
"=",
"self",
".",
"flow_config",
".",
"steps",
"self",
".",
"_check_infinite_flows",
"(",
"config_steps",
")",
"steps",
"=",
"[",
"]",
"for",
... | Given the flow config and everything else, create a list of steps to run, sorted by step number.
:return: List[StepSpec] | [
"Given",
"the",
"flow",
"config",
"and",
"everything",
"else",
"create",
"a",
"list",
"of",
"steps",
"to",
"run",
"sorted",
"by",
"step",
"number",
"."
] | e19047921ca771a297e045f22f0bb201651bb6f7 | https://github.com/SFDO-Tooling/CumulusCI/blob/e19047921ca771a297e045f22f0bb201651bb6f7/cumulusci/core/flowrunner.py#L346-L362 | train |
SFDO-Tooling/CumulusCI | cumulusci/core/flowrunner.py | FlowCoordinator._check_infinite_flows | def _check_infinite_flows(self, steps, flows=None):
"""
Recursively loop through the flow_config and check if there are any cycles.
:param steps: Set of step definitions to loop through
:param flows: Flows already visited.
:return: None
"""
if flows is None:
... | python | def _check_infinite_flows(self, steps, flows=None):
"""
Recursively loop through the flow_config and check if there are any cycles.
:param steps: Set of step definitions to loop through
:param flows: Flows already visited.
:return: None
"""
if flows is None:
... | [
"def",
"_check_infinite_flows",
"(",
"self",
",",
"steps",
",",
"flows",
"=",
"None",
")",
":",
"if",
"flows",
"is",
"None",
":",
"flows",
"=",
"[",
"]",
"for",
"step",
"in",
"steps",
".",
"values",
"(",
")",
":",
"if",
"\"flow\"",
"in",
"step",
":... | Recursively loop through the flow_config and check if there are any cycles.
:param steps: Set of step definitions to loop through
:param flows: Flows already visited.
:return: None | [
"Recursively",
"loop",
"through",
"the",
"flow_config",
"and",
"check",
"if",
"there",
"are",
"any",
"cycles",
"."
] | e19047921ca771a297e045f22f0bb201651bb6f7 | https://github.com/SFDO-Tooling/CumulusCI/blob/e19047921ca771a297e045f22f0bb201651bb6f7/cumulusci/core/flowrunner.py#L505-L526 | train |
SFDO-Tooling/CumulusCI | cumulusci/core/flowrunner.py | FlowCoordinator._init_org | def _init_org(self):
""" Test and refresh credentials to the org specified. """
self.logger.info(
"Verifying and refreshing credentials for the specified org: {}.".format(
self.org_config.name
)
)
orig_config = self.org_config.config.copy()
... | python | def _init_org(self):
""" Test and refresh credentials to the org specified. """
self.logger.info(
"Verifying and refreshing credentials for the specified org: {}.".format(
self.org_config.name
)
)
orig_config = self.org_config.config.copy()
... | [
"def",
"_init_org",
"(",
"self",
")",
":",
"self",
".",
"logger",
".",
"info",
"(",
"\"Verifying and refreshing credentials for the specified org: {}.\"",
".",
"format",
"(",
"self",
".",
"org_config",
".",
"name",
")",
")",
"orig_config",
"=",
"self",
".",
"org... | Test and refresh credentials to the org specified. | [
"Test",
"and",
"refresh",
"credentials",
"to",
"the",
"org",
"specified",
"."
] | e19047921ca771a297e045f22f0bb201651bb6f7 | https://github.com/SFDO-Tooling/CumulusCI/blob/e19047921ca771a297e045f22f0bb201651bb6f7/cumulusci/core/flowrunner.py#L528-L542 | train |
SFDO-Tooling/CumulusCI | cumulusci/core/flowrunner.py | FlowCoordinator.resolve_return_value_options | def resolve_return_value_options(self, options):
"""Handle dynamic option value lookups in the format ^^task_name.attr"""
for key, value in options.items():
if isinstance(value, str) and value.startswith(RETURN_VALUE_OPTION_PREFIX):
path, name = value[len(RETURN_VALUE_OPTION_... | python | def resolve_return_value_options(self, options):
"""Handle dynamic option value lookups in the format ^^task_name.attr"""
for key, value in options.items():
if isinstance(value, str) and value.startswith(RETURN_VALUE_OPTION_PREFIX):
path, name = value[len(RETURN_VALUE_OPTION_... | [
"def",
"resolve_return_value_options",
"(",
"self",
",",
"options",
")",
":",
"for",
"key",
",",
"value",
"in",
"options",
".",
"items",
"(",
")",
":",
"if",
"isinstance",
"(",
"value",
",",
"str",
")",
"and",
"value",
".",
"startswith",
"(",
"RETURN_VAL... | Handle dynamic option value lookups in the format ^^task_name.attr | [
"Handle",
"dynamic",
"option",
"value",
"lookups",
"in",
"the",
"format",
"^^task_name",
".",
"attr"
] | e19047921ca771a297e045f22f0bb201651bb6f7 | https://github.com/SFDO-Tooling/CumulusCI/blob/e19047921ca771a297e045f22f0bb201651bb6f7/cumulusci/core/flowrunner.py#L544-L550 | train |
SFDO-Tooling/CumulusCI | cumulusci/cli/logger.py | init_logger | def init_logger(log_requests=False):
""" Initialize the logger """
logger = logging.getLogger(__name__.split(".")[0])
for handler in logger.handlers: # pragma: nocover
logger.removeHandler(handler)
formatter = coloredlogs.ColoredFormatter(fmt="%(asctime)s: %(message)s")
handler = logging.... | python | def init_logger(log_requests=False):
""" Initialize the logger """
logger = logging.getLogger(__name__.split(".")[0])
for handler in logger.handlers: # pragma: nocover
logger.removeHandler(handler)
formatter = coloredlogs.ColoredFormatter(fmt="%(asctime)s: %(message)s")
handler = logging.... | [
"def",
"init_logger",
"(",
"log_requests",
"=",
"False",
")",
":",
"logger",
"=",
"logging",
".",
"getLogger",
"(",
"__name__",
".",
"split",
"(",
"\".\"",
")",
"[",
"0",
"]",
")",
"for",
"handler",
"in",
"logger",
".",
"handlers",
":",
"logger",
".",
... | Initialize the logger | [
"Initialize",
"the",
"logger"
] | e19047921ca771a297e045f22f0bb201651bb6f7 | https://github.com/SFDO-Tooling/CumulusCI/blob/e19047921ca771a297e045f22f0bb201651bb6f7/cumulusci/cli/logger.py#L10-L26 | train |
johnbywater/eventsourcing | eventsourcing/contrib/suffixtrees/domain/model/suffixtree.py | register_new_node | def register_new_node(suffix_node_id=None):
"""Factory method, registers new node.
"""
node_id = uuid4()
event = Node.Created(originator_id=node_id, suffix_node_id=suffix_node_id)
entity = Node.mutate(event=event)
publish(event)
return entity | python | def register_new_node(suffix_node_id=None):
"""Factory method, registers new node.
"""
node_id = uuid4()
event = Node.Created(originator_id=node_id, suffix_node_id=suffix_node_id)
entity = Node.mutate(event=event)
publish(event)
return entity | [
"def",
"register_new_node",
"(",
"suffix_node_id",
"=",
"None",
")",
":",
"node_id",
"=",
"uuid4",
"(",
")",
"event",
"=",
"Node",
".",
"Created",
"(",
"originator_id",
"=",
"node_id",
",",
"suffix_node_id",
"=",
"suffix_node_id",
")",
"entity",
"=",
"Node",... | Factory method, registers new node. | [
"Factory",
"method",
"registers",
"new",
"node",
"."
] | de2c22c653fdccf2f5ee96faea74453ff1847e42 | https://github.com/johnbywater/eventsourcing/blob/de2c22c653fdccf2f5ee96faea74453ff1847e42/eventsourcing/contrib/suffixtrees/domain/model/suffixtree.py#L318-L325 | train |
johnbywater/eventsourcing | eventsourcing/contrib/suffixtrees/domain/model/suffixtree.py | register_new_edge | def register_new_edge(edge_id, first_char_index, last_char_index, source_node_id, dest_node_id):
"""Factory method, registers new edge.
"""
event = Edge.Created(
originator_id=edge_id,
first_char_index=first_char_index,
last_char_index=last_char_index,
source_node_id=source_n... | python | def register_new_edge(edge_id, first_char_index, last_char_index, source_node_id, dest_node_id):
"""Factory method, registers new edge.
"""
event = Edge.Created(
originator_id=edge_id,
first_char_index=first_char_index,
last_char_index=last_char_index,
source_node_id=source_n... | [
"def",
"register_new_edge",
"(",
"edge_id",
",",
"first_char_index",
",",
"last_char_index",
",",
"source_node_id",
",",
"dest_node_id",
")",
":",
"event",
"=",
"Edge",
".",
"Created",
"(",
"originator_id",
"=",
"edge_id",
",",
"first_char_index",
"=",
"first_char... | Factory method, registers new edge. | [
"Factory",
"method",
"registers",
"new",
"edge",
"."
] | de2c22c653fdccf2f5ee96faea74453ff1847e42 | https://github.com/johnbywater/eventsourcing/blob/de2c22c653fdccf2f5ee96faea74453ff1847e42/eventsourcing/contrib/suffixtrees/domain/model/suffixtree.py#L334-L346 | train |
johnbywater/eventsourcing | eventsourcing/contrib/suffixtrees/domain/model/suffixtree.py | register_new_suffix_tree | def register_new_suffix_tree(case_insensitive=False):
"""Factory method, returns new suffix tree object.
"""
assert isinstance(case_insensitive, bool)
root_node = register_new_node()
suffix_tree_id = uuid4()
event = SuffixTree.Created(
originator_id=suffix_tree_id,
root_node_id=... | python | def register_new_suffix_tree(case_insensitive=False):
"""Factory method, returns new suffix tree object.
"""
assert isinstance(case_insensitive, bool)
root_node = register_new_node()
suffix_tree_id = uuid4()
event = SuffixTree.Created(
originator_id=suffix_tree_id,
root_node_id=... | [
"def",
"register_new_suffix_tree",
"(",
"case_insensitive",
"=",
"False",
")",
":",
"assert",
"isinstance",
"(",
"case_insensitive",
",",
"bool",
")",
"root_node",
"=",
"register_new_node",
"(",
")",
"suffix_tree_id",
"=",
"uuid4",
"(",
")",
"event",
"=",
"Suffi... | Factory method, returns new suffix tree object. | [
"Factory",
"method",
"returns",
"new",
"suffix",
"tree",
"object",
"."
] | de2c22c653fdccf2f5ee96faea74453ff1847e42 | https://github.com/johnbywater/eventsourcing/blob/de2c22c653fdccf2f5ee96faea74453ff1847e42/eventsourcing/contrib/suffixtrees/domain/model/suffixtree.py#L349-L369 | train |
johnbywater/eventsourcing | eventsourcing/contrib/suffixtrees/domain/model/suffixtree.py | find_substring | def find_substring(substring, suffix_tree, edge_repo):
"""Returns the index if substring in tree, otherwise -1.
"""
assert isinstance(substring, str)
assert isinstance(suffix_tree, SuffixTree)
assert isinstance(edge_repo, EventSourcedRepository)
if not substring:
return -1
if suffix_... | python | def find_substring(substring, suffix_tree, edge_repo):
"""Returns the index if substring in tree, otherwise -1.
"""
assert isinstance(substring, str)
assert isinstance(suffix_tree, SuffixTree)
assert isinstance(edge_repo, EventSourcedRepository)
if not substring:
return -1
if suffix_... | [
"def",
"find_substring",
"(",
"substring",
",",
"suffix_tree",
",",
"edge_repo",
")",
":",
"assert",
"isinstance",
"(",
"substring",
",",
"str",
")",
"assert",
"isinstance",
"(",
"suffix_tree",
",",
"SuffixTree",
")",
"assert",
"isinstance",
"(",
"edge_repo",
... | Returns the index if substring in tree, otherwise -1. | [
"Returns",
"the",
"index",
"if",
"substring",
"in",
"tree",
"otherwise",
"-",
"1",
"."
] | de2c22c653fdccf2f5ee96faea74453ff1847e42 | https://github.com/johnbywater/eventsourcing/blob/de2c22c653fdccf2f5ee96faea74453ff1847e42/eventsourcing/contrib/suffixtrees/domain/model/suffixtree.py#L374-L397 | train |
johnbywater/eventsourcing | eventsourcing/contrib/suffixtrees/domain/model/suffixtree.py | SuffixTree._add_prefix | def _add_prefix(self, last_char_index):
"""The core construction method.
"""
last_parent_node_id = None
while True:
parent_node_id = self.active.source_node_id
if self.active.explicit():
edge_id = make_edge_id(self.active.source_node_id, self.strin... | python | def _add_prefix(self, last_char_index):
"""The core construction method.
"""
last_parent_node_id = None
while True:
parent_node_id = self.active.source_node_id
if self.active.explicit():
edge_id = make_edge_id(self.active.source_node_id, self.strin... | [
"def",
"_add_prefix",
"(",
"self",
",",
"last_char_index",
")",
":",
"last_parent_node_id",
"=",
"None",
"while",
"True",
":",
"parent_node_id",
"=",
"self",
".",
"active",
".",
"source_node_id",
"if",
"self",
".",
"active",
".",
"explicit",
"(",
")",
":",
... | The core construction method. | [
"The",
"core",
"construction",
"method",
"."
] | de2c22c653fdccf2f5ee96faea74453ff1847e42 | https://github.com/johnbywater/eventsourcing/blob/de2c22c653fdccf2f5ee96faea74453ff1847e42/eventsourcing/contrib/suffixtrees/domain/model/suffixtree.py#L86-L129 | train |
johnbywater/eventsourcing | eventsourcing/contrib/suffixtrees/domain/model/suffixtree.py | SuffixTree._canonize_suffix | def _canonize_suffix(self, suffix):
"""This canonizes the suffix, walking along its suffix string until it
is explicit or there are no more matched nodes.
"""
if not suffix.explicit():
edge_id = make_edge_id(suffix.source_node_id, self.string[suffix.first_char_index])
... | python | def _canonize_suffix(self, suffix):
"""This canonizes the suffix, walking along its suffix string until it
is explicit or there are no more matched nodes.
"""
if not suffix.explicit():
edge_id = make_edge_id(suffix.source_node_id, self.string[suffix.first_char_index])
... | [
"def",
"_canonize_suffix",
"(",
"self",
",",
"suffix",
")",
":",
"if",
"not",
"suffix",
".",
"explicit",
"(",
")",
":",
"edge_id",
"=",
"make_edge_id",
"(",
"suffix",
".",
"source_node_id",
",",
"self",
".",
"string",
"[",
"suffix",
".",
"first_char_index"... | This canonizes the suffix, walking along its suffix string until it
is explicit or there are no more matched nodes. | [
"This",
"canonizes",
"the",
"suffix",
"walking",
"along",
"its",
"suffix",
"string",
"until",
"it",
"is",
"explicit",
"or",
"there",
"are",
"no",
"more",
"matched",
"nodes",
"."
] | de2c22c653fdccf2f5ee96faea74453ff1847e42 | https://github.com/johnbywater/eventsourcing/blob/de2c22c653fdccf2f5ee96faea74453ff1847e42/eventsourcing/contrib/suffixtrees/domain/model/suffixtree.py#L170-L180 | train |
johnbywater/eventsourcing | eventsourcing/infrastructure/snapshotting.py | entity_from_snapshot | def entity_from_snapshot(snapshot):
"""
Reconstructs domain entity from given snapshot.
"""
assert isinstance(snapshot, AbstractSnapshop), type(snapshot)
if snapshot.state is not None:
entity_class = resolve_topic(snapshot.topic)
return reconstruct_object(entity_class, snapshot.state... | python | def entity_from_snapshot(snapshot):
"""
Reconstructs domain entity from given snapshot.
"""
assert isinstance(snapshot, AbstractSnapshop), type(snapshot)
if snapshot.state is not None:
entity_class = resolve_topic(snapshot.topic)
return reconstruct_object(entity_class, snapshot.state... | [
"def",
"entity_from_snapshot",
"(",
"snapshot",
")",
":",
"assert",
"isinstance",
"(",
"snapshot",
",",
"AbstractSnapshop",
")",
",",
"type",
"(",
"snapshot",
")",
"if",
"snapshot",
".",
"state",
"is",
"not",
"None",
":",
"entity_class",
"=",
"resolve_topic",
... | Reconstructs domain entity from given snapshot. | [
"Reconstructs",
"domain",
"entity",
"from",
"given",
"snapshot",
"."
] | de2c22c653fdccf2f5ee96faea74453ff1847e42 | https://github.com/johnbywater/eventsourcing/blob/de2c22c653fdccf2f5ee96faea74453ff1847e42/eventsourcing/infrastructure/snapshotting.py#L69-L76 | train |
johnbywater/eventsourcing | eventsourcing/infrastructure/snapshotting.py | EventSourcedSnapshotStrategy.get_snapshot | def get_snapshot(self, entity_id, lt=None, lte=None):
"""
Gets the last snapshot for entity, optionally until a particular version number.
:rtype: Snapshot
"""
snapshots = self.snapshot_store.get_domain_events(entity_id, lt=lt, lte=lte, limit=1, is_ascending=False)
if le... | python | def get_snapshot(self, entity_id, lt=None, lte=None):
"""
Gets the last snapshot for entity, optionally until a particular version number.
:rtype: Snapshot
"""
snapshots = self.snapshot_store.get_domain_events(entity_id, lt=lt, lte=lte, limit=1, is_ascending=False)
if le... | [
"def",
"get_snapshot",
"(",
"self",
",",
"entity_id",
",",
"lt",
"=",
"None",
",",
"lte",
"=",
"None",
")",
":",
"snapshots",
"=",
"self",
".",
"snapshot_store",
".",
"get_domain_events",
"(",
"entity_id",
",",
"lt",
"=",
"lt",
",",
"lte",
"=",
"lte",
... | Gets the last snapshot for entity, optionally until a particular version number.
:rtype: Snapshot | [
"Gets",
"the",
"last",
"snapshot",
"for",
"entity",
"optionally",
"until",
"a",
"particular",
"version",
"number",
"."
] | de2c22c653fdccf2f5ee96faea74453ff1847e42 | https://github.com/johnbywater/eventsourcing/blob/de2c22c653fdccf2f5ee96faea74453ff1847e42/eventsourcing/infrastructure/snapshotting.py#L36-L44 | train |
johnbywater/eventsourcing | eventsourcing/infrastructure/snapshotting.py | EventSourcedSnapshotStrategy.take_snapshot | def take_snapshot(self, entity_id, entity, last_event_version):
"""
Creates a Snapshot from the given state, and appends it
to the snapshot store.
:rtype: Snapshot
"""
# Create the snapshot.
snapshot = Snapshot(
originator_id=entity_id,
o... | python | def take_snapshot(self, entity_id, entity, last_event_version):
"""
Creates a Snapshot from the given state, and appends it
to the snapshot store.
:rtype: Snapshot
"""
# Create the snapshot.
snapshot = Snapshot(
originator_id=entity_id,
o... | [
"def",
"take_snapshot",
"(",
"self",
",",
"entity_id",
",",
"entity",
",",
"last_event_version",
")",
":",
"snapshot",
"=",
"Snapshot",
"(",
"originator_id",
"=",
"entity_id",
",",
"originator_version",
"=",
"last_event_version",
",",
"topic",
"=",
"get_topic",
... | Creates a Snapshot from the given state, and appends it
to the snapshot store.
:rtype: Snapshot | [
"Creates",
"a",
"Snapshot",
"from",
"the",
"given",
"state",
"and",
"appends",
"it",
"to",
"the",
"snapshot",
"store",
"."
] | de2c22c653fdccf2f5ee96faea74453ff1847e42 | https://github.com/johnbywater/eventsourcing/blob/de2c22c653fdccf2f5ee96faea74453ff1847e42/eventsourcing/infrastructure/snapshotting.py#L47-L66 | train |
johnbywater/eventsourcing | eventsourcing/infrastructure/eventsourcedrepository.py | EventSourcedRepository.get_entity | def get_entity(self, entity_id, at=None):
"""
Returns entity with given ID, optionally until position.
"""
# Get a snapshot (None if none exist).
if self._snapshot_strategy is not None:
snapshot = self._snapshot_strategy.get_snapshot(entity_id, lte=at)
else:
... | python | def get_entity(self, entity_id, at=None):
"""
Returns entity with given ID, optionally until position.
"""
# Get a snapshot (None if none exist).
if self._snapshot_strategy is not None:
snapshot = self._snapshot_strategy.get_snapshot(entity_id, lte=at)
else:
... | [
"def",
"get_entity",
"(",
"self",
",",
"entity_id",
",",
"at",
"=",
"None",
")",
":",
"if",
"self",
".",
"_snapshot_strategy",
"is",
"not",
"None",
":",
"snapshot",
"=",
"self",
".",
"_snapshot_strategy",
".",
"get_snapshot",
"(",
"entity_id",
",",
"lte",
... | Returns entity with given ID, optionally until position. | [
"Returns",
"entity",
"with",
"given",
"ID",
"optionally",
"until",
"position",
"."
] | de2c22c653fdccf2f5ee96faea74453ff1847e42 | https://github.com/johnbywater/eventsourcing/blob/de2c22c653fdccf2f5ee96faea74453ff1847e42/eventsourcing/infrastructure/eventsourcedrepository.py#L37-L58 | train |
johnbywater/eventsourcing | eventsourcing/infrastructure/eventsourcedrepository.py | EventSourcedRepository.get_and_project_events | def get_and_project_events(self, entity_id, gt=None, gte=None, lt=None, lte=None, limit=None, initial_state=None,
query_descending=False):
"""
Reconstitutes requested domain entity from domain events found in event store.
"""
# Decide if query is in ascendi... | python | def get_and_project_events(self, entity_id, gt=None, gte=None, lt=None, lte=None, limit=None, initial_state=None,
query_descending=False):
"""
Reconstitutes requested domain entity from domain events found in event store.
"""
# Decide if query is in ascendi... | [
"def",
"get_and_project_events",
"(",
"self",
",",
"entity_id",
",",
"gt",
"=",
"None",
",",
"gte",
"=",
"None",
",",
"lt",
"=",
"None",
",",
"lte",
"=",
"None",
",",
"limit",
"=",
"None",
",",
"initial_state",
"=",
"None",
",",
"query_descending",
"="... | Reconstitutes requested domain entity from domain events found in event store. | [
"Reconstitutes",
"requested",
"domain",
"entity",
"from",
"domain",
"events",
"found",
"in",
"event",
"store",
"."
] | de2c22c653fdccf2f5ee96faea74453ff1847e42 | https://github.com/johnbywater/eventsourcing/blob/de2c22c653fdccf2f5ee96faea74453ff1847e42/eventsourcing/infrastructure/eventsourcedrepository.py#L60-L97 | train |
johnbywater/eventsourcing | eventsourcing/infrastructure/eventsourcedrepository.py | EventSourcedRepository.take_snapshot | def take_snapshot(self, entity_id, lt=None, lte=None):
"""
Takes a snapshot of the entity as it existed after the most recent
event, optionally less than, or less than or equal to, a particular position.
"""
snapshot = None
if self._snapshot_strategy:
# Get th... | python | def take_snapshot(self, entity_id, lt=None, lte=None):
"""
Takes a snapshot of the entity as it existed after the most recent
event, optionally less than, or less than or equal to, a particular position.
"""
snapshot = None
if self._snapshot_strategy:
# Get th... | [
"def",
"take_snapshot",
"(",
"self",
",",
"entity_id",
",",
"lt",
"=",
"None",
",",
"lte",
"=",
"None",
")",
":",
"snapshot",
"=",
"None",
"if",
"self",
".",
"_snapshot_strategy",
":",
"latest_event",
"=",
"self",
".",
"event_store",
".",
"get_most_recent_... | Takes a snapshot of the entity as it existed after the most recent
event, optionally less than, or less than or equal to, a particular position. | [
"Takes",
"a",
"snapshot",
"of",
"the",
"entity",
"as",
"it",
"existed",
"after",
"the",
"most",
"recent",
"event",
"optionally",
"less",
"than",
"or",
"less",
"than",
"or",
"equal",
"to",
"a",
"particular",
"position",
"."
] | de2c22c653fdccf2f5ee96faea74453ff1847e42 | https://github.com/johnbywater/eventsourcing/blob/de2c22c653fdccf2f5ee96faea74453ff1847e42/eventsourcing/infrastructure/eventsourcedrepository.py#L100-L143 | train |
johnbywater/eventsourcing | eventsourcing/example/application.py | ExampleApplication.create_new_example | def create_new_example(self, foo='', a='', b=''):
"""Entity object factory."""
return create_new_example(foo=foo, a=a, b=b) | python | def create_new_example(self, foo='', a='', b=''):
"""Entity object factory."""
return create_new_example(foo=foo, a=a, b=b) | [
"def",
"create_new_example",
"(",
"self",
",",
"foo",
"=",
"''",
",",
"a",
"=",
"''",
",",
"b",
"=",
"''",
")",
":",
"return",
"create_new_example",
"(",
"foo",
"=",
"foo",
",",
"a",
"=",
"a",
",",
"b",
"=",
"b",
")"
] | Entity object factory. | [
"Entity",
"object",
"factory",
"."
] | de2c22c653fdccf2f5ee96faea74453ff1847e42 | https://github.com/johnbywater/eventsourcing/blob/de2c22c653fdccf2f5ee96faea74453ff1847e42/eventsourcing/example/application.py#L170-L172 | train |
johnbywater/eventsourcing | eventsourcing/utils/times.py | timestamp_long_from_uuid | def timestamp_long_from_uuid(uuid_arg):
"""
Returns an integer value representing a unix timestamp in tenths of microseconds.
:param uuid_arg:
:return: Unix timestamp integer in tenths of microseconds.
:rtype: int
"""
if isinstance(uuid_arg, str):
uuid_arg = UUID(uuid_arg)
asser... | python | def timestamp_long_from_uuid(uuid_arg):
"""
Returns an integer value representing a unix timestamp in tenths of microseconds.
:param uuid_arg:
:return: Unix timestamp integer in tenths of microseconds.
:rtype: int
"""
if isinstance(uuid_arg, str):
uuid_arg = UUID(uuid_arg)
asser... | [
"def",
"timestamp_long_from_uuid",
"(",
"uuid_arg",
")",
":",
"if",
"isinstance",
"(",
"uuid_arg",
",",
"str",
")",
":",
"uuid_arg",
"=",
"UUID",
"(",
"uuid_arg",
")",
"assert",
"isinstance",
"(",
"uuid_arg",
",",
"UUID",
")",
",",
"uuid_arg",
"uuid_time",
... | Returns an integer value representing a unix timestamp in tenths of microseconds.
:param uuid_arg:
:return: Unix timestamp integer in tenths of microseconds.
:rtype: int | [
"Returns",
"an",
"integer",
"value",
"representing",
"a",
"unix",
"timestamp",
"in",
"tenths",
"of",
"microseconds",
"."
] | de2c22c653fdccf2f5ee96faea74453ff1847e42 | https://github.com/johnbywater/eventsourcing/blob/de2c22c653fdccf2f5ee96faea74453ff1847e42/eventsourcing/utils/times.py#L20-L32 | train |
johnbywater/eventsourcing | eventsourcing/domain/model/decorators.py | subscribe_to | def subscribe_to(*event_classes):
"""
Decorator for making a custom event handler function subscribe to a certain class of event.
The decorated function will be called once for each matching event that is published, and will
be given one argument, the event, when it is called. If events are published i... | python | def subscribe_to(*event_classes):
"""
Decorator for making a custom event handler function subscribe to a certain class of event.
The decorated function will be called once for each matching event that is published, and will
be given one argument, the event, when it is called. If events are published i... | [
"def",
"subscribe_to",
"(",
"*",
"event_classes",
")",
":",
"event_classes",
"=",
"list",
"(",
"event_classes",
")",
"def",
"wrap",
"(",
"func",
")",
":",
"def",
"handler",
"(",
"event",
")",
":",
"if",
"isinstance",
"(",
"event",
",",
"(",
"list",
","... | Decorator for making a custom event handler function subscribe to a certain class of event.
The decorated function will be called once for each matching event that is published, and will
be given one argument, the event, when it is called. If events are published in lists, for
example the AggregateRoot pub... | [
"Decorator",
"for",
"making",
"a",
"custom",
"event",
"handler",
"function",
"subscribe",
"to",
"a",
"certain",
"class",
"of",
"event",
"."
] | de2c22c653fdccf2f5ee96faea74453ff1847e42 | https://github.com/johnbywater/eventsourcing/blob/de2c22c653fdccf2f5ee96faea74453ff1847e42/eventsourcing/domain/model/decorators.py#L10-L54 | train |
johnbywater/eventsourcing | eventsourcing/domain/model/decorators.py | mutator | def mutator(arg=None):
"""Structures mutator functions by allowing handlers
to be registered for different types of event. When
the decorated function is called with an initial
value and an event, it will call the handler that
has been registered for that type of event.
It works like singledisp... | python | def mutator(arg=None):
"""Structures mutator functions by allowing handlers
to be registered for different types of event. When
the decorated function is called with an initial
value and an event, it will call the handler that
has been registered for that type of event.
It works like singledisp... | [
"def",
"mutator",
"(",
"arg",
"=",
"None",
")",
":",
"domain_class",
"=",
"None",
"def",
"_mutator",
"(",
"func",
")",
":",
"wrapped",
"=",
"singledispatch",
"(",
"func",
")",
"@",
"wraps",
"(",
"wrapped",
")",
"def",
"wrapper",
"(",
"initial",
",",
... | Structures mutator functions by allowing handlers
to be registered for different types of event. When
the decorated function is called with an initial
value and an event, it will call the handler that
has been registered for that type of event.
It works like singledispatch, which it uses. The
d... | [
"Structures",
"mutator",
"functions",
"by",
"allowing",
"handlers",
"to",
"be",
"registered",
"for",
"different",
"types",
"of",
"event",
".",
"When",
"the",
"decorated",
"function",
"is",
"called",
"with",
"an",
"initial",
"value",
"and",
"an",
"event",
"it",... | de2c22c653fdccf2f5ee96faea74453ff1847e42 | https://github.com/johnbywater/eventsourcing/blob/de2c22c653fdccf2f5ee96faea74453ff1847e42/eventsourcing/domain/model/decorators.py#L57-L128 | train |
johnbywater/eventsourcing | eventsourcing/utils/cipher/aes.py | AESCipher.encrypt | def encrypt(self, plaintext):
"""Return ciphertext for given plaintext."""
# String to bytes.
plainbytes = plaintext.encode('utf8')
# Compress plaintext bytes.
compressed = zlib.compress(plainbytes)
# Construct AES-GCM cipher, with 96-bit nonce.
cipher = AES.ne... | python | def encrypt(self, plaintext):
"""Return ciphertext for given plaintext."""
# String to bytes.
plainbytes = plaintext.encode('utf8')
# Compress plaintext bytes.
compressed = zlib.compress(plainbytes)
# Construct AES-GCM cipher, with 96-bit nonce.
cipher = AES.ne... | [
"def",
"encrypt",
"(",
"self",
",",
"plaintext",
")",
":",
"plainbytes",
"=",
"plaintext",
".",
"encode",
"(",
"'utf8'",
")",
"compressed",
"=",
"zlib",
".",
"compress",
"(",
"plainbytes",
")",
"cipher",
"=",
"AES",
".",
"new",
"(",
"self",
".",
"ciphe... | Return ciphertext for given plaintext. | [
"Return",
"ciphertext",
"for",
"given",
"plaintext",
"."
] | de2c22c653fdccf2f5ee96faea74453ff1847e42 | https://github.com/johnbywater/eventsourcing/blob/de2c22c653fdccf2f5ee96faea74453ff1847e42/eventsourcing/utils/cipher/aes.py#L24-L49 | train |
johnbywater/eventsourcing | eventsourcing/utils/cipher/aes.py | AESCipher.decrypt | def decrypt(self, ciphertext):
"""Return plaintext for given ciphertext."""
# String to bytes.
cipherbytes = ciphertext.encode('utf8')
# Decode from Base64.
try:
combined = base64.b64decode(cipherbytes)
except (base64.binascii.Error, TypeError) as e:
... | python | def decrypt(self, ciphertext):
"""Return plaintext for given ciphertext."""
# String to bytes.
cipherbytes = ciphertext.encode('utf8')
# Decode from Base64.
try:
combined = base64.b64decode(cipherbytes)
except (base64.binascii.Error, TypeError) as e:
... | [
"def",
"decrypt",
"(",
"self",
",",
"ciphertext",
")",
":",
"cipherbytes",
"=",
"ciphertext",
".",
"encode",
"(",
"'utf8'",
")",
"try",
":",
"combined",
"=",
"base64",
".",
"b64decode",
"(",
"cipherbytes",
")",
"except",
"(",
"base64",
".",
"binascii",
"... | Return plaintext for given ciphertext. | [
"Return",
"plaintext",
"for",
"given",
"ciphertext",
"."
] | de2c22c653fdccf2f5ee96faea74453ff1847e42 | https://github.com/johnbywater/eventsourcing/blob/de2c22c653fdccf2f5ee96faea74453ff1847e42/eventsourcing/utils/cipher/aes.py#L51-L92 | train |
johnbywater/eventsourcing | eventsourcing/infrastructure/eventstore.py | EventStore.store | def store(self, domain_event_or_events):
"""
Appends given domain event, or list of domain events, to their sequence.
:param domain_event_or_events: domain event, or list of domain events
"""
# Convert to sequenced item.
sequenced_item_or_items = self.item_from_event(do... | python | def store(self, domain_event_or_events):
"""
Appends given domain event, or list of domain events, to their sequence.
:param domain_event_or_events: domain event, or list of domain events
"""
# Convert to sequenced item.
sequenced_item_or_items = self.item_from_event(do... | [
"def",
"store",
"(",
"self",
",",
"domain_event_or_events",
")",
":",
"sequenced_item_or_items",
"=",
"self",
".",
"item_from_event",
"(",
"domain_event_or_events",
")",
"try",
":",
"self",
".",
"record_manager",
".",
"record_sequenced_items",
"(",
"sequenced_item_or_... | Appends given domain event, or list of domain events, to their sequence.
:param domain_event_or_events: domain event, or list of domain events | [
"Appends",
"given",
"domain",
"event",
"or",
"list",
"of",
"domain",
"events",
"to",
"their",
"sequence",
"."
] | de2c22c653fdccf2f5ee96faea74453ff1847e42 | https://github.com/johnbywater/eventsourcing/blob/de2c22c653fdccf2f5ee96faea74453ff1847e42/eventsourcing/infrastructure/eventstore.py#L72-L86 | train |
johnbywater/eventsourcing | eventsourcing/infrastructure/eventstore.py | EventStore.item_from_event | def item_from_event(self, domain_event_or_events):
"""
Maps domain event to sequenced item namedtuple.
:param domain_event_or_events: application-level object (or list)
:return: namedtuple: sequence item namedtuple (or list)
"""
# Convert the domain event(s) to sequenced... | python | def item_from_event(self, domain_event_or_events):
"""
Maps domain event to sequenced item namedtuple.
:param domain_event_or_events: application-level object (or list)
:return: namedtuple: sequence item namedtuple (or list)
"""
# Convert the domain event(s) to sequenced... | [
"def",
"item_from_event",
"(",
"self",
",",
"domain_event_or_events",
")",
":",
"if",
"isinstance",
"(",
"domain_event_or_events",
",",
"(",
"list",
",",
"tuple",
")",
")",
":",
"return",
"[",
"self",
".",
"item_from_event",
"(",
"e",
")",
"for",
"e",
"in"... | Maps domain event to sequenced item namedtuple.
:param domain_event_or_events: application-level object (or list)
:return: namedtuple: sequence item namedtuple (or list) | [
"Maps",
"domain",
"event",
"to",
"sequenced",
"item",
"namedtuple",
"."
] | de2c22c653fdccf2f5ee96faea74453ff1847e42 | https://github.com/johnbywater/eventsourcing/blob/de2c22c653fdccf2f5ee96faea74453ff1847e42/eventsourcing/infrastructure/eventstore.py#L88-L99 | train |
johnbywater/eventsourcing | eventsourcing/infrastructure/eventstore.py | EventStore.get_domain_events | def get_domain_events(self, originator_id, gt=None, gte=None, lt=None, lte=None, limit=None, is_ascending=True,
page_size=None):
"""
Gets domain events from the sequence identified by `originator_id`.
:param originator_id: ID of a sequence of events
:param gt: ... | python | def get_domain_events(self, originator_id, gt=None, gte=None, lt=None, lte=None, limit=None, is_ascending=True,
page_size=None):
"""
Gets domain events from the sequence identified by `originator_id`.
:param originator_id: ID of a sequence of events
:param gt: ... | [
"def",
"get_domain_events",
"(",
"self",
",",
"originator_id",
",",
"gt",
"=",
"None",
",",
"gte",
"=",
"None",
",",
"lt",
"=",
"None",
",",
"lte",
"=",
"None",
",",
"limit",
"=",
"None",
",",
"is_ascending",
"=",
"True",
",",
"page_size",
"=",
"None... | Gets domain events from the sequence identified by `originator_id`.
:param originator_id: ID of a sequence of events
:param gt: get items after this position
:param gte: get items at or after this position
:param lt: get items before this position
:param lte: get items before or... | [
"Gets",
"domain",
"events",
"from",
"the",
"sequence",
"identified",
"by",
"originator_id",
"."
] | de2c22c653fdccf2f5ee96faea74453ff1847e42 | https://github.com/johnbywater/eventsourcing/blob/de2c22c653fdccf2f5ee96faea74453ff1847e42/eventsourcing/infrastructure/eventstore.py#L101-L142 | train |
johnbywater/eventsourcing | eventsourcing/infrastructure/eventstore.py | EventStore.get_domain_event | def get_domain_event(self, originator_id, position):
"""
Gets a domain event from the sequence identified by `originator_id`
at position `eq`.
:param originator_id: ID of a sequence of events
:param position: get item at this position
:return: domain event
"""
... | python | def get_domain_event(self, originator_id, position):
"""
Gets a domain event from the sequence identified by `originator_id`
at position `eq`.
:param originator_id: ID of a sequence of events
:param position: get item at this position
:return: domain event
"""
... | [
"def",
"get_domain_event",
"(",
"self",
",",
"originator_id",
",",
"position",
")",
":",
"sequenced_item",
"=",
"self",
".",
"record_manager",
".",
"get_item",
"(",
"sequence_id",
"=",
"originator_id",
",",
"position",
"=",
"position",
",",
")",
"return",
"sel... | Gets a domain event from the sequence identified by `originator_id`
at position `eq`.
:param originator_id: ID of a sequence of events
:param position: get item at this position
:return: domain event | [
"Gets",
"a",
"domain",
"event",
"from",
"the",
"sequence",
"identified",
"by",
"originator_id",
"at",
"position",
"eq",
"."
] | de2c22c653fdccf2f5ee96faea74453ff1847e42 | https://github.com/johnbywater/eventsourcing/blob/de2c22c653fdccf2f5ee96faea74453ff1847e42/eventsourcing/infrastructure/eventstore.py#L144-L158 | train |
johnbywater/eventsourcing | eventsourcing/infrastructure/eventstore.py | EventStore.get_most_recent_event | def get_most_recent_event(self, originator_id, lt=None, lte=None):
"""
Gets a domain event from the sequence identified by `originator_id`
at the highest position.
:param originator_id: ID of a sequence of events
:param lt: get highest before this position
:param lte: ge... | python | def get_most_recent_event(self, originator_id, lt=None, lte=None):
"""
Gets a domain event from the sequence identified by `originator_id`
at the highest position.
:param originator_id: ID of a sequence of events
:param lt: get highest before this position
:param lte: ge... | [
"def",
"get_most_recent_event",
"(",
"self",
",",
"originator_id",
",",
"lt",
"=",
"None",
",",
"lte",
"=",
"None",
")",
":",
"events",
"=",
"self",
".",
"get_domain_events",
"(",
"originator_id",
"=",
"originator_id",
",",
"lt",
"=",
"lt",
",",
"lte",
"... | Gets a domain event from the sequence identified by `originator_id`
at the highest position.
:param originator_id: ID of a sequence of events
:param lt: get highest before this position
:param lte: get highest at or before this position
:return: domain event | [
"Gets",
"a",
"domain",
"event",
"from",
"the",
"sequence",
"identified",
"by",
"originator_id",
"at",
"the",
"highest",
"position",
"."
] | de2c22c653fdccf2f5ee96faea74453ff1847e42 | https://github.com/johnbywater/eventsourcing/blob/de2c22c653fdccf2f5ee96faea74453ff1847e42/eventsourcing/infrastructure/eventstore.py#L160-L175 | train |
johnbywater/eventsourcing | eventsourcing/infrastructure/eventstore.py | EventStore.all_domain_events | def all_domain_events(self):
"""
Yields all domain events in the event store.
"""
for originator_id in self.record_manager.all_sequence_ids():
for domain_event in self.get_domain_events(originator_id=originator_id, page_size=100):
yield domain_event | python | def all_domain_events(self):
"""
Yields all domain events in the event store.
"""
for originator_id in self.record_manager.all_sequence_ids():
for domain_event in self.get_domain_events(originator_id=originator_id, page_size=100):
yield domain_event | [
"def",
"all_domain_events",
"(",
"self",
")",
":",
"for",
"originator_id",
"in",
"self",
".",
"record_manager",
".",
"all_sequence_ids",
"(",
")",
":",
"for",
"domain_event",
"in",
"self",
".",
"get_domain_events",
"(",
"originator_id",
"=",
"originator_id",
","... | Yields all domain events in the event store. | [
"Yields",
"all",
"domain",
"events",
"in",
"the",
"event",
"store",
"."
] | de2c22c653fdccf2f5ee96faea74453ff1847e42 | https://github.com/johnbywater/eventsourcing/blob/de2c22c653fdccf2f5ee96faea74453ff1847e42/eventsourcing/infrastructure/eventstore.py#L177-L183 | train |
johnbywater/eventsourcing | eventsourcing/application/process.py | ProcessApplication.publish_prompt | def publish_prompt(self, event=None):
"""
Publishes prompt for a given event.
Used to prompt downstream process application when an event
is published by this application's model, which can happen
when application command methods, rather than the process policy,
are call... | python | def publish_prompt(self, event=None):
"""
Publishes prompt for a given event.
Used to prompt downstream process application when an event
is published by this application's model, which can happen
when application command methods, rather than the process policy,
are call... | [
"def",
"publish_prompt",
"(",
"self",
",",
"event",
"=",
"None",
")",
":",
"prompt",
"=",
"Prompt",
"(",
"self",
".",
"name",
",",
"self",
".",
"pipeline_id",
")",
"try",
":",
"publish",
"(",
"prompt",
")",
"except",
"PromptFailed",
":",
"raise",
"exce... | Publishes prompt for a given event.
Used to prompt downstream process application when an event
is published by this application's model, which can happen
when application command methods, rather than the process policy,
are called.
Wraps exceptions with PromptFailed, to avoid ... | [
"Publishes",
"prompt",
"for",
"a",
"given",
"event",
"."
] | de2c22c653fdccf2f5ee96faea74453ff1847e42 | https://github.com/johnbywater/eventsourcing/blob/de2c22c653fdccf2f5ee96faea74453ff1847e42/eventsourcing/application/process.py#L52-L71 | train |
johnbywater/eventsourcing | eventsourcing/infrastructure/django/manager.py | DjangoRecordManager._prepare_insert | def _prepare_insert(self, tmpl, record_class, field_names, placeholder_for_id=False):
"""
With transaction isolation level of "read committed" this should
generate records with a contiguous sequence of integer IDs, using
an indexed ID column, the database-side SQL max function, the
... | python | def _prepare_insert(self, tmpl, record_class, field_names, placeholder_for_id=False):
"""
With transaction isolation level of "read committed" this should
generate records with a contiguous sequence of integer IDs, using
an indexed ID column, the database-side SQL max function, the
... | [
"def",
"_prepare_insert",
"(",
"self",
",",
"tmpl",
",",
"record_class",
",",
"field_names",
",",
"placeholder_for_id",
"=",
"False",
")",
":",
"field_names",
"=",
"list",
"(",
"field_names",
")",
"if",
"hasattr",
"(",
"record_class",
",",
"'application_name'",
... | With transaction isolation level of "read committed" this should
generate records with a contiguous sequence of integer IDs, using
an indexed ID column, the database-side SQL max function, the
insert-select-from form, and optimistic concurrency control. | [
"With",
"transaction",
"isolation",
"level",
"of",
"read",
"committed",
"this",
"should",
"generate",
"records",
"with",
"a",
"contiguous",
"sequence",
"of",
"integer",
"IDs",
"using",
"an",
"indexed",
"ID",
"column",
"the",
"database",
"-",
"side",
"SQL",
"ma... | de2c22c653fdccf2f5ee96faea74453ff1847e42 | https://github.com/johnbywater/eventsourcing/blob/de2c22c653fdccf2f5ee96faea74453ff1847e42/eventsourcing/infrastructure/django/manager.py#L68-L93 | train |
johnbywater/eventsourcing | eventsourcing/infrastructure/django/manager.py | DjangoRecordManager.get_notifications | def get_notifications(self, start=None, stop=None, *args, **kwargs):
"""
Returns all records in the table.
"""
filter_kwargs = {}
# Todo: Also support sequencing by 'position' if items are sequenced by timestamp?
if start is not None:
filter_kwargs['%s__gte' %... | python | def get_notifications(self, start=None, stop=None, *args, **kwargs):
"""
Returns all records in the table.
"""
filter_kwargs = {}
# Todo: Also support sequencing by 'position' if items are sequenced by timestamp?
if start is not None:
filter_kwargs['%s__gte' %... | [
"def",
"get_notifications",
"(",
"self",
",",
"start",
"=",
"None",
",",
"stop",
"=",
"None",
",",
"*",
"args",
",",
"**",
"kwargs",
")",
":",
"filter_kwargs",
"=",
"{",
"}",
"if",
"start",
"is",
"not",
"None",
":",
"filter_kwargs",
"[",
"'%s__gte'",
... | Returns all records in the table. | [
"Returns",
"all",
"records",
"in",
"the",
"table",
"."
] | de2c22c653fdccf2f5ee96faea74453ff1847e42 | https://github.com/johnbywater/eventsourcing/blob/de2c22c653fdccf2f5ee96faea74453ff1847e42/eventsourcing/infrastructure/django/manager.py#L151-L169 | train |
johnbywater/eventsourcing | eventsourcing/application/actors.py | ActorModelRunner.start | def start(self):
"""
Starts all the actors to run a system of process applications.
"""
# Subscribe to broadcast prompts published by a process
# application in the parent operating system process.
subscribe(handler=self.forward_prompt, predicate=self.is_prompt)
... | python | def start(self):
"""
Starts all the actors to run a system of process applications.
"""
# Subscribe to broadcast prompts published by a process
# application in the parent operating system process.
subscribe(handler=self.forward_prompt, predicate=self.is_prompt)
... | [
"def",
"start",
"(",
"self",
")",
":",
"subscribe",
"(",
"handler",
"=",
"self",
".",
"forward_prompt",
",",
"predicate",
"=",
"self",
".",
"is_prompt",
")",
"msg",
"=",
"SystemInitRequest",
"(",
"self",
".",
"system",
".",
"process_classes",
",",
"self",
... | Starts all the actors to run a system of process applications. | [
"Starts",
"all",
"the",
"actors",
"to",
"run",
"a",
"system",
"of",
"process",
"applications",
"."
] | de2c22c653fdccf2f5ee96faea74453ff1847e42 | https://github.com/johnbywater/eventsourcing/blob/de2c22c653fdccf2f5ee96faea74453ff1847e42/eventsourcing/application/actors.py#L80-L105 | train |
johnbywater/eventsourcing | eventsourcing/application/actors.py | ActorModelRunner.close | def close(self):
"""Stops all the actors running a system of process applications."""
super(ActorModelRunner, self).close()
unsubscribe(handler=self.forward_prompt, predicate=self.is_prompt)
if self.shutdown_on_close:
self.shutdown() | python | def close(self):
"""Stops all the actors running a system of process applications."""
super(ActorModelRunner, self).close()
unsubscribe(handler=self.forward_prompt, predicate=self.is_prompt)
if self.shutdown_on_close:
self.shutdown() | [
"def",
"close",
"(",
"self",
")",
":",
"super",
"(",
"ActorModelRunner",
",",
"self",
")",
".",
"close",
"(",
")",
"unsubscribe",
"(",
"handler",
"=",
"self",
".",
"forward_prompt",
",",
"predicate",
"=",
"self",
".",
"is_prompt",
")",
"if",
"self",
".... | Stops all the actors running a system of process applications. | [
"Stops",
"all",
"the",
"actors",
"running",
"a",
"system",
"of",
"process",
"applications",
"."
] | de2c22c653fdccf2f5ee96faea74453ff1847e42 | https://github.com/johnbywater/eventsourcing/blob/de2c22c653fdccf2f5ee96faea74453ff1847e42/eventsourcing/application/actors.py#L122-L127 | train |
johnbywater/eventsourcing | eventsourcing/contrib/suffixtrees/application.py | SuffixTreeApplication.register_new_suffix_tree | def register_new_suffix_tree(self, case_insensitive=False):
"""Returns a new suffix tree entity.
"""
suffix_tree = register_new_suffix_tree(case_insensitive=case_insensitive)
suffix_tree._node_repo = self.node_repo
suffix_tree._node_child_collection_repo = self.node_child_collect... | python | def register_new_suffix_tree(self, case_insensitive=False):
"""Returns a new suffix tree entity.
"""
suffix_tree = register_new_suffix_tree(case_insensitive=case_insensitive)
suffix_tree._node_repo = self.node_repo
suffix_tree._node_child_collection_repo = self.node_child_collect... | [
"def",
"register_new_suffix_tree",
"(",
"self",
",",
"case_insensitive",
"=",
"False",
")",
":",
"suffix_tree",
"=",
"register_new_suffix_tree",
"(",
"case_insensitive",
"=",
"case_insensitive",
")",
"suffix_tree",
".",
"_node_repo",
"=",
"self",
".",
"node_repo",
"... | Returns a new suffix tree entity. | [
"Returns",
"a",
"new",
"suffix",
"tree",
"entity",
"."
] | de2c22c653fdccf2f5ee96faea74453ff1847e42 | https://github.com/johnbywater/eventsourcing/blob/de2c22c653fdccf2f5ee96faea74453ff1847e42/eventsourcing/contrib/suffixtrees/application.py#L29-L37 | train |
johnbywater/eventsourcing | eventsourcing/contrib/suffixtrees/application.py | SuffixTreeApplication.find_string_ids | def find_string_ids(self, substring, suffix_tree_id, limit=None):
"""Returns a set of IDs for strings that contain the given substring.
"""
# Find an edge for the substring.
edge, ln = self.find_substring_edge(substring=substring, suffix_tree_id=suffix_tree_id)
# If there isn't... | python | def find_string_ids(self, substring, suffix_tree_id, limit=None):
"""Returns a set of IDs for strings that contain the given substring.
"""
# Find an edge for the substring.
edge, ln = self.find_substring_edge(substring=substring, suffix_tree_id=suffix_tree_id)
# If there isn't... | [
"def",
"find_string_ids",
"(",
"self",
",",
"substring",
",",
"suffix_tree_id",
",",
"limit",
"=",
"None",
")",
":",
"edge",
",",
"ln",
"=",
"self",
".",
"find_substring_edge",
"(",
"substring",
"=",
"substring",
",",
"suffix_tree_id",
"=",
"suffix_tree_id",
... | Returns a set of IDs for strings that contain the given substring. | [
"Returns",
"a",
"set",
"of",
"IDs",
"for",
"strings",
"that",
"contain",
"the",
"given",
"substring",
"."
] | de2c22c653fdccf2f5ee96faea74453ff1847e42 | https://github.com/johnbywater/eventsourcing/blob/de2c22c653fdccf2f5ee96faea74453ff1847e42/eventsourcing/contrib/suffixtrees/application.py#L50-L72 | train |
johnbywater/eventsourcing | eventsourcing/contrib/suffixtrees/application.py | SuffixTreeApplication.find_substring_edge | def find_substring_edge(self, substring, suffix_tree_id):
"""Returns an edge that matches the given substring.
"""
suffix_tree = self.suffix_tree_repo[suffix_tree_id]
started = datetime.datetime.now()
edge, ln = find_substring_edge(substring=substring, suffix_tree=suffix_tree, ed... | python | def find_substring_edge(self, substring, suffix_tree_id):
"""Returns an edge that matches the given substring.
"""
suffix_tree = self.suffix_tree_repo[suffix_tree_id]
started = datetime.datetime.now()
edge, ln = find_substring_edge(substring=substring, suffix_tree=suffix_tree, ed... | [
"def",
"find_substring_edge",
"(",
"self",
",",
"substring",
",",
"suffix_tree_id",
")",
":",
"suffix_tree",
"=",
"self",
".",
"suffix_tree_repo",
"[",
"suffix_tree_id",
"]",
"started",
"=",
"datetime",
".",
"datetime",
".",
"now",
"(",
")",
"edge",
",",
"ln... | Returns an edge that matches the given substring. | [
"Returns",
"an",
"edge",
"that",
"matches",
"the",
"given",
"substring",
"."
] | de2c22c653fdccf2f5ee96faea74453ff1847e42 | https://github.com/johnbywater/eventsourcing/blob/de2c22c653fdccf2f5ee96faea74453ff1847e42/eventsourcing/contrib/suffixtrees/application.py#L74-L85 | train |
johnbywater/eventsourcing | eventsourcing/application/system.py | SingleThreadedRunner.run_followers | def run_followers(self, prompt):
"""
First caller adds a prompt to queue and
runs followers until there are no more
pending prompts.
Subsequent callers just add a prompt
to the queue, avoiding recursion.
"""
assert isinstance(prompt, Prompt)
# Put... | python | def run_followers(self, prompt):
"""
First caller adds a prompt to queue and
runs followers until there are no more
pending prompts.
Subsequent callers just add a prompt
to the queue, avoiding recursion.
"""
assert isinstance(prompt, Prompt)
# Put... | [
"def",
"run_followers",
"(",
"self",
",",
"prompt",
")",
":",
"assert",
"isinstance",
"(",
"prompt",
",",
"Prompt",
")",
"self",
".",
"pending_prompts",
".",
"put",
"(",
"prompt",
")",
"if",
"self",
".",
"iteration_lock",
".",
"acquire",
"(",
"False",
")... | First caller adds a prompt to queue and
runs followers until there are no more
pending prompts.
Subsequent callers just add a prompt
to the queue, avoiding recursion. | [
"First",
"caller",
"adds",
"a",
"prompt",
"to",
"queue",
"and",
"runs",
"followers",
"until",
"there",
"are",
"no",
"more",
"pending",
"prompts",
"."
] | de2c22c653fdccf2f5ee96faea74453ff1847e42 | https://github.com/johnbywater/eventsourcing/blob/de2c22c653fdccf2f5ee96faea74453ff1847e42/eventsourcing/application/system.py#L223-L255 | train |
johnbywater/eventsourcing | eventsourcing/example/domainmodel.py | create_new_example | def create_new_example(foo='', a='', b=''):
"""
Factory method for example entities.
:rtype: Example
"""
return Example.__create__(foo=foo, a=a, b=b) | python | def create_new_example(foo='', a='', b=''):
"""
Factory method for example entities.
:rtype: Example
"""
return Example.__create__(foo=foo, a=a, b=b) | [
"def",
"create_new_example",
"(",
"foo",
"=",
"''",
",",
"a",
"=",
"''",
",",
"b",
"=",
"''",
")",
":",
"return",
"Example",
".",
"__create__",
"(",
"foo",
"=",
"foo",
",",
"a",
"=",
"a",
",",
"b",
"=",
"b",
")"
] | Factory method for example entities.
:rtype: Example | [
"Factory",
"method",
"for",
"example",
"entities",
"."
] | de2c22c653fdccf2f5ee96faea74453ff1847e42 | https://github.com/johnbywater/eventsourcing/blob/de2c22c653fdccf2f5ee96faea74453ff1847e42/eventsourcing/example/domainmodel.py#L62-L68 | train |
johnbywater/eventsourcing | eventsourcing/application/decorators.py | applicationpolicy | def applicationpolicy(arg=None):
"""
Decorator for application policy method.
Allows policy to be built up from methods
registered for different event classes.
"""
def _mutator(func):
wrapped = singledispatch(func)
@wraps(wrapped)
def wrapper(*args, **kwargs):
... | python | def applicationpolicy(arg=None):
"""
Decorator for application policy method.
Allows policy to be built up from methods
registered for different event classes.
"""
def _mutator(func):
wrapped = singledispatch(func)
@wraps(wrapped)
def wrapper(*args, **kwargs):
... | [
"def",
"applicationpolicy",
"(",
"arg",
"=",
"None",
")",
":",
"def",
"_mutator",
"(",
"func",
")",
":",
"wrapped",
"=",
"singledispatch",
"(",
"func",
")",
"@",
"wraps",
"(",
"wrapped",
")",
"def",
"wrapper",
"(",
"*",
"args",
",",
"**",
"kwargs",
"... | Decorator for application policy method.
Allows policy to be built up from methods
registered for different event classes. | [
"Decorator",
"for",
"application",
"policy",
"method",
"."
] | de2c22c653fdccf2f5ee96faea74453ff1847e42 | https://github.com/johnbywater/eventsourcing/blob/de2c22c653fdccf2f5ee96faea74453ff1847e42/eventsourcing/application/decorators.py#L5-L26 | train |
johnbywater/eventsourcing | eventsourcing/infrastructure/sqlalchemy/manager.py | SQLAlchemyRecordManager._prepare_insert | def _prepare_insert(self, tmpl, record_class, field_names, placeholder_for_id=False):
"""
With transaction isolation level of "read committed" this should
generate records with a contiguous sequence of integer IDs, assumes
an indexed ID column, the database-side SQL max function, the
... | python | def _prepare_insert(self, tmpl, record_class, field_names, placeholder_for_id=False):
"""
With transaction isolation level of "read committed" this should
generate records with a contiguous sequence of integer IDs, assumes
an indexed ID column, the database-side SQL max function, the
... | [
"def",
"_prepare_insert",
"(",
"self",
",",
"tmpl",
",",
"record_class",
",",
"field_names",
",",
"placeholder_for_id",
"=",
"False",
")",
":",
"field_names",
"=",
"list",
"(",
"field_names",
")",
"if",
"hasattr",
"(",
"record_class",
",",
"'application_name'",
... | With transaction isolation level of "read committed" this should
generate records with a contiguous sequence of integer IDs, assumes
an indexed ID column, the database-side SQL max function, the
insert-select-from form, and optimistic concurrency control. | [
"With",
"transaction",
"isolation",
"level",
"of",
"read",
"committed",
"this",
"should",
"generate",
"records",
"with",
"a",
"contiguous",
"sequence",
"of",
"integer",
"IDs",
"assumes",
"an",
"indexed",
"ID",
"column",
"the",
"database",
"-",
"side",
"SQL",
"... | de2c22c653fdccf2f5ee96faea74453ff1847e42 | https://github.com/johnbywater/eventsourcing/blob/de2c22c653fdccf2f5ee96faea74453ff1847e42/eventsourcing/infrastructure/sqlalchemy/manager.py#L22-L60 | train |
johnbywater/eventsourcing | eventsourcing/infrastructure/sqlalchemy/manager.py | SQLAlchemyRecordManager.delete_record | def delete_record(self, record):
"""
Permanently removes record from table.
"""
try:
self.session.delete(record)
self.session.commit()
except Exception as e:
self.session.rollback()
raise ProgrammingError(e)
finally:
... | python | def delete_record(self, record):
"""
Permanently removes record from table.
"""
try:
self.session.delete(record)
self.session.commit()
except Exception as e:
self.session.rollback()
raise ProgrammingError(e)
finally:
... | [
"def",
"delete_record",
"(",
"self",
",",
"record",
")",
":",
"try",
":",
"self",
".",
"session",
".",
"delete",
"(",
"record",
")",
"self",
".",
"session",
".",
"commit",
"(",
")",
"except",
"Exception",
"as",
"e",
":",
"self",
".",
"session",
".",
... | Permanently removes record from table. | [
"Permanently",
"removes",
"record",
"from",
"table",
"."
] | de2c22c653fdccf2f5ee96faea74453ff1847e42 | https://github.com/johnbywater/eventsourcing/blob/de2c22c653fdccf2f5ee96faea74453ff1847e42/eventsourcing/infrastructure/sqlalchemy/manager.py#L274-L285 | train |
johnbywater/eventsourcing | eventsourcing/domain/model/timebucketedlog.py | TimebucketedlogRepository.get_or_create | def get_or_create(self, log_name, bucket_size):
"""
Gets or creates a log.
:rtype: Timebucketedlog
"""
try:
return self[log_name]
except RepositoryKeyError:
return start_new_timebucketedlog(log_name, bucket_size=bucket_size) | python | def get_or_create(self, log_name, bucket_size):
"""
Gets or creates a log.
:rtype: Timebucketedlog
"""
try:
return self[log_name]
except RepositoryKeyError:
return start_new_timebucketedlog(log_name, bucket_size=bucket_size) | [
"def",
"get_or_create",
"(",
"self",
",",
"log_name",
",",
"bucket_size",
")",
":",
"try",
":",
"return",
"self",
"[",
"log_name",
"]",
"except",
"RepositoryKeyError",
":",
"return",
"start_new_timebucketedlog",
"(",
"log_name",
",",
"bucket_size",
"=",
"bucket_... | Gets or creates a log.
:rtype: Timebucketedlog | [
"Gets",
"or",
"creates",
"a",
"log",
"."
] | de2c22c653fdccf2f5ee96faea74453ff1847e42 | https://github.com/johnbywater/eventsourcing/blob/de2c22c653fdccf2f5ee96faea74453ff1847e42/eventsourcing/domain/model/timebucketedlog.py#L70-L79 | train |
johnbywater/eventsourcing | eventsourcing/infrastructure/eventplayer.py | EventPlayer.project_events | def project_events(self, initial_state, domain_events):
"""
Evolves initial state using the sequence of domain events and a mutator function.
"""
return reduce(self._mutator_func or self.mutate, domain_events, initial_state) | python | def project_events(self, initial_state, domain_events):
"""
Evolves initial state using the sequence of domain events and a mutator function.
"""
return reduce(self._mutator_func or self.mutate, domain_events, initial_state) | [
"def",
"project_events",
"(",
"self",
",",
"initial_state",
",",
"domain_events",
")",
":",
"return",
"reduce",
"(",
"self",
".",
"_mutator_func",
"or",
"self",
".",
"mutate",
",",
"domain_events",
",",
"initial_state",
")"
] | Evolves initial state using the sequence of domain events and a mutator function. | [
"Evolves",
"initial",
"state",
"using",
"the",
"sequence",
"of",
"domain",
"events",
"and",
"a",
"mutator",
"function",
"."
] | de2c22c653fdccf2f5ee96faea74453ff1847e42 | https://github.com/johnbywater/eventsourcing/blob/de2c22c653fdccf2f5ee96faea74453ff1847e42/eventsourcing/infrastructure/eventplayer.py#L32-L36 | train |
johnbywater/eventsourcing | eventsourcing/domain/model/array.py | BigArray.get_last_array | def get_last_array(self):
"""
Returns last array in compound.
:rtype: CompoundSequenceReader
"""
# Get the root array (might not have been registered).
root = self.repo[self.id]
# Get length and last item in the root array.
apex_id, apex_height = root.ge... | python | def get_last_array(self):
"""
Returns last array in compound.
:rtype: CompoundSequenceReader
"""
# Get the root array (might not have been registered).
root = self.repo[self.id]
# Get length and last item in the root array.
apex_id, apex_height = root.ge... | [
"def",
"get_last_array",
"(",
"self",
")",
":",
"root",
"=",
"self",
".",
"repo",
"[",
"self",
".",
"id",
"]",
"apex_id",
",",
"apex_height",
"=",
"root",
".",
"get_last_item_and_next_position",
"(",
")",
"if",
"apex_id",
"is",
"None",
":",
"return",
"No... | Returns last array in compound.
:rtype: CompoundSequenceReader | [
"Returns",
"last",
"array",
"in",
"compound",
"."
] | de2c22c653fdccf2f5ee96faea74453ff1847e42 | https://github.com/johnbywater/eventsourcing/blob/de2c22c653fdccf2f5ee96faea74453ff1847e42/eventsourcing/domain/model/array.py#L213-L245 | train |
johnbywater/eventsourcing | eventsourcing/domain/model/array.py | BigArray.calc_parent | def calc_parent(self, i, j, h):
"""
Returns get_big_array and end of span of parent sequence that contains given child.
"""
N = self.repo.array_size
c_i = i
c_j = j
c_h = h
# Calculate the number of the sequence in its row (sequences
# with same he... | python | def calc_parent(self, i, j, h):
"""
Returns get_big_array and end of span of parent sequence that contains given child.
"""
N = self.repo.array_size
c_i = i
c_j = j
c_h = h
# Calculate the number of the sequence in its row (sequences
# with same he... | [
"def",
"calc_parent",
"(",
"self",
",",
"i",
",",
"j",
",",
"h",
")",
":",
"N",
"=",
"self",
".",
"repo",
".",
"array_size",
"c_i",
"=",
"i",
"c_j",
"=",
"j",
"c_h",
"=",
"h",
"c_n",
"=",
"c_i",
"//",
"(",
"N",
"**",
"c_h",
")",
"p_n",
"=",... | Returns get_big_array and end of span of parent sequence that contains given child. | [
"Returns",
"get_big_array",
"and",
"end",
"of",
"span",
"of",
"parent",
"sequence",
"that",
"contains",
"given",
"child",
"."
] | de2c22c653fdccf2f5ee96faea74453ff1847e42 | https://github.com/johnbywater/eventsourcing/blob/de2c22c653fdccf2f5ee96faea74453ff1847e42/eventsourcing/domain/model/array.py#L372-L397 | train |
johnbywater/eventsourcing | eventsourcing/infrastructure/sequenceditemmapper.py | SequencedItemMapper.item_from_event | def item_from_event(self, domain_event):
"""
Constructs a sequenced item from a domain event.
"""
item_args = self.construct_item_args(domain_event)
return self.construct_sequenced_item(item_args) | python | def item_from_event(self, domain_event):
"""
Constructs a sequenced item from a domain event.
"""
item_args = self.construct_item_args(domain_event)
return self.construct_sequenced_item(item_args) | [
"def",
"item_from_event",
"(",
"self",
",",
"domain_event",
")",
":",
"item_args",
"=",
"self",
".",
"construct_item_args",
"(",
"domain_event",
")",
"return",
"self",
".",
"construct_sequenced_item",
"(",
"item_args",
")"
] | Constructs a sequenced item from a domain event. | [
"Constructs",
"a",
"sequenced",
"item",
"from",
"a",
"domain",
"event",
"."
] | de2c22c653fdccf2f5ee96faea74453ff1847e42 | https://github.com/johnbywater/eventsourcing/blob/de2c22c653fdccf2f5ee96faea74453ff1847e42/eventsourcing/infrastructure/sequenceditemmapper.py#L41-L46 | train |
johnbywater/eventsourcing | eventsourcing/infrastructure/sequenceditemmapper.py | SequencedItemMapper.construct_item_args | def construct_item_args(self, domain_event):
"""
Constructs attributes of a sequenced item from the given domain event.
"""
# Get the sequence ID.
sequence_id = domain_event.__dict__[self.sequence_id_attr_name]
# Get the position in the sequence.
position = getat... | python | def construct_item_args(self, domain_event):
"""
Constructs attributes of a sequenced item from the given domain event.
"""
# Get the sequence ID.
sequence_id = domain_event.__dict__[self.sequence_id_attr_name]
# Get the position in the sequence.
position = getat... | [
"def",
"construct_item_args",
"(",
"self",
",",
"domain_event",
")",
":",
"sequence_id",
"=",
"domain_event",
".",
"__dict__",
"[",
"self",
".",
"sequence_id_attr_name",
"]",
"position",
"=",
"getattr",
"(",
"domain_event",
",",
"self",
".",
"position_attr_name",
... | Constructs attributes of a sequenced item from the given domain event. | [
"Constructs",
"attributes",
"of",
"a",
"sequenced",
"item",
"from",
"the",
"given",
"domain",
"event",
"."
] | de2c22c653fdccf2f5ee96faea74453ff1847e42 | https://github.com/johnbywater/eventsourcing/blob/de2c22c653fdccf2f5ee96faea74453ff1847e42/eventsourcing/infrastructure/sequenceditemmapper.py#L48-L69 | train |
johnbywater/eventsourcing | eventsourcing/infrastructure/sequenceditemmapper.py | SequencedItemMapper.event_from_item | def event_from_item(self, sequenced_item):
"""
Reconstructs domain event from stored event topic and
event attrs. Used in the event store when getting domain events.
"""
assert isinstance(sequenced_item, self.sequenced_item_class), (
self.sequenced_item_class, type(se... | python | def event_from_item(self, sequenced_item):
"""
Reconstructs domain event from stored event topic and
event attrs. Used in the event store when getting domain events.
"""
assert isinstance(sequenced_item, self.sequenced_item_class), (
self.sequenced_item_class, type(se... | [
"def",
"event_from_item",
"(",
"self",
",",
"sequenced_item",
")",
":",
"assert",
"isinstance",
"(",
"sequenced_item",
",",
"self",
".",
"sequenced_item_class",
")",
",",
"(",
"self",
".",
"sequenced_item_class",
",",
"type",
"(",
"sequenced_item",
")",
")",
"... | Reconstructs domain event from stored event topic and
event attrs. Used in the event store when getting domain events. | [
"Reconstructs",
"domain",
"event",
"from",
"stored",
"event",
"topic",
"and",
"event",
"attrs",
".",
"Used",
"in",
"the",
"event",
"store",
"when",
"getting",
"domain",
"events",
"."
] | de2c22c653fdccf2f5ee96faea74453ff1847e42 | https://github.com/johnbywater/eventsourcing/blob/de2c22c653fdccf2f5ee96faea74453ff1847e42/eventsourcing/infrastructure/sequenceditemmapper.py#L87-L100 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.