repository_name
stringlengths
5
67
func_path_in_repository
stringlengths
4
234
func_name
stringlengths
0
314
whole_func_string
stringlengths
52
3.87M
language
stringclasses
6 values
func_code_string
stringlengths
52
3.87M
func_code_tokens
listlengths
15
672k
func_documentation_string
stringlengths
1
47.2k
func_documentation_tokens
listlengths
1
3.92k
split_name
stringclasses
1 value
func_code_url
stringlengths
85
339
CivicSpleen/ambry
ambry/bundle/bundle.py
Bundle.sync_objects_in
def sync_objects_in(self): """Synchronize from records to objects""" self.dstate = self.STATES.BUILDING self.build_source_files.record_to_objects()
python
def sync_objects_in(self): """Synchronize from records to objects""" self.dstate = self.STATES.BUILDING self.build_source_files.record_to_objects()
[ "def", "sync_objects_in", "(", "self", ")", ":", "self", ".", "dstate", "=", "self", ".", "STATES", ".", "BUILDING", "self", ".", "build_source_files", ".", "record_to_objects", "(", ")" ]
Synchronize from records to objects
[ "Synchronize", "from", "records", "to", "objects" ]
train
https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/bundle/bundle.py#L1487-L1490
CivicSpleen/ambry
ambry/bundle/bundle.py
Bundle.sync_objects_out
def sync_objects_out(self, force=False): """Synchronize from objects to records, and records to files""" self.log('---- Sync Objects Out ----') from ambry.bundle.files import BuildSourceFile self.dstate = self.STATES.BUILDING for f in self.build_source_files.list_records(): ...
python
def sync_objects_out(self, force=False): """Synchronize from objects to records, and records to files""" self.log('---- Sync Objects Out ----') from ambry.bundle.files import BuildSourceFile self.dstate = self.STATES.BUILDING for f in self.build_source_files.list_records(): ...
[ "def", "sync_objects_out", "(", "self", ",", "force", "=", "False", ")", ":", "self", ".", "log", "(", "'---- Sync Objects Out ----'", ")", "from", "ambry", ".", "bundle", ".", "files", "import", "BuildSourceFile", "self", ".", "dstate", "=", "self", ".", ...
Synchronize from objects to records, and records to files
[ "Synchronize", "from", "objects", "to", "records", "and", "records", "to", "files" ]
train
https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/bundle/bundle.py#L1492-L1504
CivicSpleen/ambry
ambry/bundle/bundle.py
Bundle.sync_code
def sync_code(self): """Sync in code files and the meta file, avoiding syncing the larger files""" from ambry.orm.file import File from ambry.bundle.files import BuildSourceFile self.dstate = self.STATES.BUILDING synced = 0 for fc in [File.BSFILE.BUILD, File.BSFILE.MET...
python
def sync_code(self): """Sync in code files and the meta file, avoiding syncing the larger files""" from ambry.orm.file import File from ambry.bundle.files import BuildSourceFile self.dstate = self.STATES.BUILDING synced = 0 for fc in [File.BSFILE.BUILD, File.BSFILE.MET...
[ "def", "sync_code", "(", "self", ")", ":", "from", "ambry", ".", "orm", ".", "file", "import", "File", "from", "ambry", ".", "bundle", ".", "files", "import", "BuildSourceFile", "self", ".", "dstate", "=", "self", ".", "STATES", ".", "BUILDING", "synced"...
Sync in code files and the meta file, avoiding syncing the larger files
[ "Sync", "in", "code", "files", "and", "the", "meta", "file", "avoiding", "syncing", "the", "larger", "files" ]
train
https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/bundle/bundle.py#L1511-L1531
CivicSpleen/ambry
ambry/bundle/bundle.py
Bundle.sync_sources
def sync_sources(self, force=False): """Sync in only the sources.csv file""" from ambry.orm.file import File self.dstate = self.STATES.BUILDING synced = 0 for fc in [File.BSFILE.SOURCES]: bsf = self.build_source_files.file(fc) if bsf.fs_is_newer or forc...
python
def sync_sources(self, force=False): """Sync in only the sources.csv file""" from ambry.orm.file import File self.dstate = self.STATES.BUILDING synced = 0 for fc in [File.BSFILE.SOURCES]: bsf = self.build_source_files.file(fc) if bsf.fs_is_newer or forc...
[ "def", "sync_sources", "(", "self", ",", "force", "=", "False", ")", ":", "from", "ambry", ".", "orm", ".", "file", "import", "File", "self", ".", "dstate", "=", "self", ".", "STATES", ".", "BUILDING", "synced", "=", "0", "for", "fc", "in", "[", "F...
Sync in only the sources.csv file
[ "Sync", "in", "only", "the", "sources", ".", "csv", "file" ]
train
https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/bundle/bundle.py#L1533-L1548
CivicSpleen/ambry
ambry/bundle/bundle.py
Bundle.sync_schema
def sync_schema(self): """Sync in code files and the meta file, avoiding syncing the larger files""" from ambry.orm.file import File from ambry.bundle.files import BuildSourceFile self.dstate = self.STATES.BUILDING synced = 0 for fc in [File.BSFILE.SCHEMA, File.BSFILE.S...
python
def sync_schema(self): """Sync in code files and the meta file, avoiding syncing the larger files""" from ambry.orm.file import File from ambry.bundle.files import BuildSourceFile self.dstate = self.STATES.BUILDING synced = 0 for fc in [File.BSFILE.SCHEMA, File.BSFILE.S...
[ "def", "sync_schema", "(", "self", ")", ":", "from", "ambry", ".", "orm", ".", "file", "import", "File", "from", "ambry", ".", "bundle", ".", "files", "import", "BuildSourceFile", "self", ".", "dstate", "=", "self", ".", "STATES", ".", "BUILDING", "synce...
Sync in code files and the meta file, avoiding syncing the larger files
[ "Sync", "in", "code", "files", "and", "the", "meta", "file", "avoiding", "syncing", "the", "larger", "files" ]
train
https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/bundle/bundle.py#L1550-L1565
CivicSpleen/ambry
ambry/bundle/bundle.py
Bundle.update_schema
def update_schema(self): """Propagate schema object changes to file records""" self.commit() self.build_source_files.schema.objects_to_record() self.commit()
python
def update_schema(self): """Propagate schema object changes to file records""" self.commit() self.build_source_files.schema.objects_to_record() self.commit()
[ "def", "update_schema", "(", "self", ")", ":", "self", ".", "commit", "(", ")", "self", ".", "build_source_files", ".", "schema", ".", "objects_to_record", "(", ")", "self", ".", "commit", "(", ")" ]
Propagate schema object changes to file records
[ "Propagate", "schema", "object", "changes", "to", "file", "records" ]
train
https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/bundle/bundle.py#L1567-L1572
CivicSpleen/ambry
ambry/bundle/bundle.py
Bundle.clean
def clean(self, force=False): """Clean generated objects from the dataset, but only if there are File contents to regenerate them""" if self.is_finalized and not force: self.warn("Can't clean; bundle is finalized") return False self.log('---- Cleaning ----') ...
python
def clean(self, force=False): """Clean generated objects from the dataset, but only if there are File contents to regenerate them""" if self.is_finalized and not force: self.warn("Can't clean; bundle is finalized") return False self.log('---- Cleaning ----') ...
[ "def", "clean", "(", "self", ",", "force", "=", "False", ")", ":", "if", "self", ".", "is_finalized", "and", "not", "force", ":", "self", ".", "warn", "(", "\"Can't clean; bundle is finalized\"", ")", "return", "False", "self", ".", "log", "(", "'---- Clea...
Clean generated objects from the dataset, but only if there are File contents to regenerate them
[ "Clean", "generated", "objects", "from", "the", "dataset", "but", "only", "if", "there", "are", "File", "contents", "to", "regenerate", "them" ]
train
https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/bundle/bundle.py#L1582-L1609
CivicSpleen/ambry
ambry/bundle/bundle.py
Bundle.clean_except_files
def clean_except_files(self): """Clean everything except the build source files""" if self.is_finalized: self.warn("Can't clean; bundle is finalized") return False self.log('---- Cleaning ----') self.state = self.STATES.CLEANING self.commit() s...
python
def clean_except_files(self): """Clean everything except the build source files""" if self.is_finalized: self.warn("Can't clean; bundle is finalized") return False self.log('---- Cleaning ----') self.state = self.STATES.CLEANING self.commit() s...
[ "def", "clean_except_files", "(", "self", ")", ":", "if", "self", ".", "is_finalized", ":", "self", ".", "warn", "(", "\"Can't clean; bundle is finalized\"", ")", "return", "False", "self", ".", "log", "(", "'---- Cleaning ----'", ")", "self", ".", "state", "=...
Clean everything except the build source files
[ "Clean", "everything", "except", "the", "build", "source", "files" ]
train
https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/bundle/bundle.py#L1611-L1636
CivicSpleen/ambry
ambry/bundle/bundle.py
Bundle.clean_sources
def clean_sources(self): """Like clean, but also clears out files. """ for src in self.dataset.sources: src.st_id = None src.t_id = None self.dataset.sources[:] = [] self.dataset.source_tables[:] = [] self.dataset.st_sequence_id = 1
python
def clean_sources(self): """Like clean, but also clears out files. """ for src in self.dataset.sources: src.st_id = None src.t_id = None self.dataset.sources[:] = [] self.dataset.source_tables[:] = [] self.dataset.st_sequence_id = 1
[ "def", "clean_sources", "(", "self", ")", ":", "for", "src", "in", "self", ".", "dataset", ".", "sources", ":", "src", ".", "st_id", "=", "None", "src", ".", "t_id", "=", "None", "self", ".", "dataset", ".", "sources", "[", ":", "]", "=", "[", "]...
Like clean, but also clears out files.
[ "Like", "clean", "but", "also", "clears", "out", "files", "." ]
train
https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/bundle/bundle.py#L1638-L1647
CivicSpleen/ambry
ambry/bundle/bundle.py
Bundle.clean_partitions
def clean_partitions(self): """Delete partition records and any built partition files. """ import shutil from ambry.orm import ColumnStat # FIXME. There is a problem with the cascades for ColumnStats that prevents them from # being deleted with the partitions. Probably, they ar...
python
def clean_partitions(self): """Delete partition records and any built partition files. """ import shutil from ambry.orm import ColumnStat # FIXME. There is a problem with the cascades for ColumnStats that prevents them from # being deleted with the partitions. Probably, they ar...
[ "def", "clean_partitions", "(", "self", ")", ":", "import", "shutil", "from", "ambry", ".", "orm", "import", "ColumnStat", "# FIXME. There is a problem with the cascades for ColumnStats that prevents them from", "# being deleted with the partitions. Probably, they are seen to be owed ...
Delete partition records and any built partition files.
[ "Delete", "partition", "records", "and", "any", "built", "partition", "files", "." ]
train
https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/bundle/bundle.py#L1657-L1675
CivicSpleen/ambry
ambry/bundle/bundle.py
Bundle.clean_build
def clean_build(self): """Delete the build directory and all ingested files """ import shutil if self.build_fs.exists: try: shutil.rmtree(self.build_fs.getsyspath('/')) except NoSysPathError: pass
python
def clean_build(self): """Delete the build directory and all ingested files """ import shutil if self.build_fs.exists: try: shutil.rmtree(self.build_fs.getsyspath('/')) except NoSysPathError: pass
[ "def", "clean_build", "(", "self", ")", ":", "import", "shutil", "if", "self", ".", "build_fs", ".", "exists", ":", "try", ":", "shutil", ".", "rmtree", "(", "self", ".", "build_fs", ".", "getsyspath", "(", "'/'", ")", ")", "except", "NoSysPathError", ...
Delete the build directory and all ingested files
[ "Delete", "the", "build", "directory", "and", "all", "ingested", "files" ]
train
https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/bundle/bundle.py#L1677-L1685
CivicSpleen/ambry
ambry/bundle/bundle.py
Bundle.clean_ingested
def clean_ingested(self): """"Clean ingested files""" for s in self.sources: df = s.datafile if df.exists and not s.is_partition: df.remove() s.state = s.STATES.NEW self.commit()
python
def clean_ingested(self): """"Clean ingested files""" for s in self.sources: df = s.datafile if df.exists and not s.is_partition: df.remove() s.state = s.STATES.NEW self.commit()
[ "def", "clean_ingested", "(", "self", ")", ":", "for", "s", "in", "self", ".", "sources", ":", "df", "=", "s", ".", "datafile", "if", "df", ".", "exists", "and", "not", "s", ".", "is_partition", ":", "df", ".", "remove", "(", ")", "s", ".", "stat...
Clean ingested files
[ "Clean", "ingested", "files" ]
train
https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/bundle/bundle.py#L1693-L1701
CivicSpleen/ambry
ambry/bundle/bundle.py
Bundle.clean_process_meta
def clean_process_meta(self): """Remove all process and build metadata""" ds = self.dataset ds.config.build.clean() ds.config.process.clean() ds.commit() self.state = self.STATES.CLEANED
python
def clean_process_meta(self): """Remove all process and build metadata""" ds = self.dataset ds.config.build.clean() ds.config.process.clean() ds.commit() self.state = self.STATES.CLEANED
[ "def", "clean_process_meta", "(", "self", ")", ":", "ds", "=", "self", ".", "dataset", "ds", ".", "config", ".", "build", ".", "clean", "(", ")", "ds", ".", "config", ".", "process", ".", "clean", "(", ")", "ds", ".", "commit", "(", ")", "self", ...
Remove all process and build metadata
[ "Remove", "all", "process", "and", "build", "metadata" ]
train
https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/bundle/bundle.py#L1708-L1714
CivicSpleen/ambry
ambry/bundle/bundle.py
Bundle.clean_source_files
def clean_source_files(self): """Remove the schema.csv and source_schema.csv files""" self.build_source_files.file(File.BSFILE.SOURCESCHEMA).remove() self.build_source_files.file(File.BSFILE.SCHEMA).remove() self.commit()
python
def clean_source_files(self): """Remove the schema.csv and source_schema.csv files""" self.build_source_files.file(File.BSFILE.SOURCESCHEMA).remove() self.build_source_files.file(File.BSFILE.SCHEMA).remove() self.commit()
[ "def", "clean_source_files", "(", "self", ")", ":", "self", ".", "build_source_files", ".", "file", "(", "File", ".", "BSFILE", ".", "SOURCESCHEMA", ")", ".", "remove", "(", ")", "self", ".", "build_source_files", ".", "file", "(", "File", ".", "BSFILE", ...
Remove the schema.csv and source_schema.csv files
[ "Remove", "the", "schema", ".", "csv", "and", "source_schema", ".", "csv", "files" ]
train
https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/bundle/bundle.py#L1716-L1721
CivicSpleen/ambry
ambry/bundle/bundle.py
Bundle.ingest
def ingest(self, sources=None, tables=None, stage=None, force=False, load_meta=False): """Ingest a set of sources, specified as source objects, source names, or destination tables. If no stage is specified, execute the sources in groups by stage. Note, however, that when this is called from run...
python
def ingest(self, sources=None, tables=None, stage=None, force=False, load_meta=False): """Ingest a set of sources, specified as source objects, source names, or destination tables. If no stage is specified, execute the sources in groups by stage. Note, however, that when this is called from run...
[ "def", "ingest", "(", "self", ",", "sources", "=", "None", ",", "tables", "=", "None", ",", "stage", "=", "None", ",", "force", "=", "False", ",", "load_meta", "=", "False", ")", ":", "from", "itertools", "import", "groupby", "from", "ambry", ".", "b...
Ingest a set of sources, specified as source objects, source names, or destination tables. If no stage is specified, execute the sources in groups by stage. Note, however, that when this is called from run_stage, all of the sources have the same stage, so they get grouped together. The result i...
[ "Ingest", "a", "set", "of", "sources", "specified", "as", "source", "objects", "source", "names", "or", "destination", "tables", ".", "If", "no", "stage", "is", "specified", "execute", "the", "sources", "in", "groups", "by", "stage", "." ]
train
https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/bundle/bundle.py#L1737-L1842
CivicSpleen/ambry
ambry/bundle/bundle.py
Bundle._ingest_sources
def _ingest_sources(self, sources, stage, force=False): """Ingest a set of sources, usually for one stage""" from concurrent import ingest_mp self.state = self.STATES.INGESTING downloadable_sources = [s for s in sources if force or (s.is_processable and ...
python
def _ingest_sources(self, sources, stage, force=False): """Ingest a set of sources, usually for one stage""" from concurrent import ingest_mp self.state = self.STATES.INGESTING downloadable_sources = [s for s in sources if force or (s.is_processable and ...
[ "def", "_ingest_sources", "(", "self", ",", "sources", ",", "stage", ",", "force", "=", "False", ")", ":", "from", "concurrent", "import", "ingest_mp", "self", ".", "state", "=", "self", ".", "STATES", ".", "INGESTING", "downloadable_sources", "=", "[", "s...
Ingest a set of sources, usually for one stage
[ "Ingest", "a", "set", "of", "sources", "usually", "for", "one", "stage" ]
train
https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/bundle/bundle.py#L1844-L1898
CivicSpleen/ambry
ambry/bundle/bundle.py
Bundle._ingest_source
def _ingest_source(self, source, ps, force=None): """Ingest a single source""" from ambry.bundle.process import call_interval try: from ambry.orm.exc import NotFoundError if not source.is_partition and source.datafile.exists: if not source.datafile.is_...
python
def _ingest_source(self, source, ps, force=None): """Ingest a single source""" from ambry.bundle.process import call_interval try: from ambry.orm.exc import NotFoundError if not source.is_partition and source.datafile.exists: if not source.datafile.is_...
[ "def", "_ingest_source", "(", "self", ",", "source", ",", "ps", ",", "force", "=", "None", ")", ":", "from", "ambry", ".", "bundle", ".", "process", "import", "call_interval", "try", ":", "from", "ambry", ".", "orm", ".", "exc", "import", "NotFoundError"...
Ingest a single source
[ "Ingest", "a", "single", "source" ]
train
https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/bundle/bundle.py#L1900-L1992
CivicSpleen/ambry
ambry/bundle/bundle.py
Bundle.source_schema
def source_schema(self, sources=None, tables=None, clean=False): """Process a collection of ingested sources to make source tables. """ sources = self._resolve_sources(sources, tables, None, predicate=lambda s: s.is_processable) for source in sources: ...
python
def source_schema(self, sources=None, tables=None, clean=False): """Process a collection of ingested sources to make source tables. """ sources = self._resolve_sources(sources, tables, None, predicate=lambda s: s.is_processable) for source in sources: ...
[ "def", "source_schema", "(", "self", ",", "sources", "=", "None", ",", "tables", "=", "None", ",", "clean", "=", "False", ")", ":", "sources", "=", "self", ".", "_resolve_sources", "(", "sources", ",", "tables", ",", "None", ",", "predicate", "=", "lam...
Process a collection of ingested sources to make source tables.
[ "Process", "a", "collection", "of", "ingested", "sources", "to", "make", "source", "tables", "." ]
train
https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/bundle/bundle.py#L2010-L2021
CivicSpleen/ambry
ambry/bundle/bundle.py
Bundle.schema
def schema(self, sources=None, tables=None, clean=False, force=False, use_pipeline=False): """ Generate destination schemas. :param sources: If specified, build only destination tables for these sources :param tables: If specified, build only these tables :param clean: Delete ta...
python
def schema(self, sources=None, tables=None, clean=False, force=False, use_pipeline=False): """ Generate destination schemas. :param sources: If specified, build only destination tables for these sources :param tables: If specified, build only these tables :param clean: Delete ta...
[ "def", "schema", "(", "self", ",", "sources", "=", "None", ",", "tables", "=", "None", ",", "clean", "=", "False", ",", "force", "=", "False", ",", "use_pipeline", "=", "False", ")", ":", "from", "itertools", "import", "groupby", "from", "operator", "i...
Generate destination schemas. :param sources: If specified, build only destination tables for these sources :param tables: If specified, build only these tables :param clean: Delete tables and partitions first :param force: Population tables even if the table isn't empty :param ...
[ "Generate", "destination", "schemas", "." ]
train
https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/bundle/bundle.py#L2024-L2129
CivicSpleen/ambry
ambry/bundle/bundle.py
Bundle._reset_build
def _reset_build(self, sources): """Remove partition datafiles and reset the datafiles to the INGESTED state""" from ambry.orm.exc import NotFoundError for p in self.dataset.partitions: if p.type == p.TYPE.SEGMENT: self.log("Removing old segment partition: {}".format...
python
def _reset_build(self, sources): """Remove partition datafiles and reset the datafiles to the INGESTED state""" from ambry.orm.exc import NotFoundError for p in self.dataset.partitions: if p.type == p.TYPE.SEGMENT: self.log("Removing old segment partition: {}".format...
[ "def", "_reset_build", "(", "self", ",", "sources", ")", ":", "from", "ambry", ".", "orm", ".", "exc", "import", "NotFoundError", "for", "p", "in", "self", ".", "dataset", ".", "partitions", ":", "if", "p", ".", "type", "==", "p", ".", "TYPE", ".", ...
Remove partition datafiles and reset the datafiles to the INGESTED state
[ "Remove", "partition", "datafiles", "and", "reset", "the", "datafiles", "to", "the", "INGESTED", "state" ]
train
https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/bundle/bundle.py#L2161-L2191
CivicSpleen/ambry
ambry/bundle/bundle.py
Bundle.build
def build(self, sources=None, tables=None, stage=None, force=False): """ :param phase: :param stage: :param sources: Source names or destination table names. :return: """ from operator import attrgetter from itertools import groupby from .concurre...
python
def build(self, sources=None, tables=None, stage=None, force=False): """ :param phase: :param stage: :param sources: Source names or destination table names. :return: """ from operator import attrgetter from itertools import groupby from .concurre...
[ "def", "build", "(", "self", ",", "sources", "=", "None", ",", "tables", "=", "None", ",", "stage", "=", "None", ",", "force", "=", "False", ")", ":", "from", "operator", "import", "attrgetter", "from", "itertools", "import", "groupby", "from", ".", "c...
:param phase: :param stage: :param sources: Source names or destination table names. :return:
[ ":", "param", "phase", ":", ":", "param", "stage", ":", ":", "param", "sources", ":", "Source", "names", "or", "destination", "table", "names", ".", ":", "return", ":" ]
train
https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/bundle/bundle.py#L2194-L2330
CivicSpleen/ambry
ambry/bundle/bundle.py
Bundle.build_table
def build_table(self, table, force=False): """Build all of the sources for a table """ sources = self._resolve_sources(None, [table]) for source in sources: self.build_source(None, source, force=force) self.unify_partitions()
python
def build_table(self, table, force=False): """Build all of the sources for a table """ sources = self._resolve_sources(None, [table]) for source in sources: self.build_source(None, source, force=force) self.unify_partitions()
[ "def", "build_table", "(", "self", ",", "table", ",", "force", "=", "False", ")", ":", "sources", "=", "self", ".", "_resolve_sources", "(", "None", ",", "[", "table", "]", ")", "for", "source", "in", "sources", ":", "self", ".", "build_source", "(", ...
Build all of the sources for a table
[ "Build", "all", "of", "the", "sources", "for", "a", "table" ]
train
https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/bundle/bundle.py#L2332-L2340
CivicSpleen/ambry
ambry/bundle/bundle.py
Bundle.build_source
def build_source(self, stage, source, ps, force=False): """Build a single source""" from ambry.bundle.process import call_interval assert source.is_processable, source.name if source.state == self.STATES.BUILT and not force: ps.update(message='Source {} already built'.forma...
python
def build_source(self, stage, source, ps, force=False): """Build a single source""" from ambry.bundle.process import call_interval assert source.is_processable, source.name if source.state == self.STATES.BUILT and not force: ps.update(message='Source {} already built'.forma...
[ "def", "build_source", "(", "self", ",", "stage", ",", "source", ",", "ps", ",", "force", "=", "False", ")", ":", "from", "ambry", ".", "bundle", ".", "process", "import", "call_interval", "assert", "source", ".", "is_processable", ",", "source", ".", "n...
Build a single source
[ "Build", "a", "single", "source" ]
train
https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/bundle/bundle.py#L2342-L2420
CivicSpleen/ambry
ambry/bundle/bundle.py
Bundle.collect_segment_partitions
def collect_segment_partitions(self): """Return a dict of segments partitions, keyed on the name of the parent partition """ from collections import defaultdict # Group the segments by their parent partition name, which is the # same name, but without the segment. partit...
python
def collect_segment_partitions(self): """Return a dict of segments partitions, keyed on the name of the parent partition """ from collections import defaultdict # Group the segments by their parent partition name, which is the # same name, but without the segment. partit...
[ "def", "collect_segment_partitions", "(", "self", ")", ":", "from", "collections", "import", "defaultdict", "# Group the segments by their parent partition name, which is the", "# same name, but without the segment.", "partitions", "=", "defaultdict", "(", "set", ")", "for", "p...
Return a dict of segments partitions, keyed on the name of the parent partition
[ "Return", "a", "dict", "of", "segments", "partitions", "keyed", "on", "the", "name", "of", "the", "parent", "partition" ]
train
https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/bundle/bundle.py#L2422-L2436
CivicSpleen/ambry
ambry/bundle/bundle.py
Bundle.unify_partitions
def unify_partitions(self): """For all of the segments for a partition, create the parent partition, combine the children into the parent, and delete the children. """ partitions = self.collect_segment_partitions() # For each group, copy the segment partitions to the parent partitions,...
python
def unify_partitions(self): """For all of the segments for a partition, create the parent partition, combine the children into the parent, and delete the children. """ partitions = self.collect_segment_partitions() # For each group, copy the segment partitions to the parent partitions,...
[ "def", "unify_partitions", "(", "self", ")", ":", "partitions", "=", "self", ".", "collect_segment_partitions", "(", ")", "# For each group, copy the segment partitions to the parent partitions, then", "# delete the segment partitions.", "with", "self", ".", "progress", ".", ...
For all of the segments for a partition, create the parent partition, combine the children into the parent, and delete the children.
[ "For", "all", "of", "the", "segments", "for", "a", "partition", "create", "the", "parent", "partition", "combine", "the", "children", "into", "the", "parent", "and", "delete", "the", "children", "." ]
train
https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/bundle/bundle.py#L2438-L2452
CivicSpleen/ambry
ambry/bundle/bundle.py
Bundle.exec_context
def exec_context(self, **kwargs): """Base environment for evals, the stuff that is the same for all evals. Primarily used in the Caster pipe""" import inspect import dateutil.parser import datetime import random from functools import partial from ambry.val...
python
def exec_context(self, **kwargs): """Base environment for evals, the stuff that is the same for all evals. Primarily used in the Caster pipe""" import inspect import dateutil.parser import datetime import random from functools import partial from ambry.val...
[ "def", "exec_context", "(", "self", ",", "*", "*", "kwargs", ")", ":", "import", "inspect", "import", "dateutil", ".", "parser", "import", "datetime", "import", "random", "from", "functools", "import", "partial", "from", "ambry", ".", "valuetype", ".", "type...
Base environment for evals, the stuff that is the same for all evals. Primarily used in the Caster pipe
[ "Base", "environment", "for", "evals", "the", "stuff", "that", "is", "the", "same", "for", "all", "evals", ".", "Primarily", "used", "in", "the", "Caster", "pipe" ]
train
https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/bundle/bundle.py#L2534-L2611
CivicSpleen/ambry
ambry/bundle/bundle.py
Bundle.post_build_time_coverage
def post_build_time_coverage(self): """Collect all of the time coverage for the bundle.""" from ambry.util.datestimes import expand_to_years years = set() # From the bundle about if self.metadata.about.time: for year in expand_to_years(self.metadata.about.time): ...
python
def post_build_time_coverage(self): """Collect all of the time coverage for the bundle.""" from ambry.util.datestimes import expand_to_years years = set() # From the bundle about if self.metadata.about.time: for year in expand_to_years(self.metadata.about.time): ...
[ "def", "post_build_time_coverage", "(", "self", ")", ":", "from", "ambry", ".", "util", ".", "datestimes", "import", "expand_to_years", "years", "=", "set", "(", ")", "# From the bundle about", "if", "self", ".", "metadata", ".", "about", ".", "time", ":", "...
Collect all of the time coverage for the bundle.
[ "Collect", "all", "of", "the", "time", "coverage", "for", "the", "bundle", "." ]
train
https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/bundle/bundle.py#L2664-L2682
CivicSpleen/ambry
ambry/bundle/bundle.py
Bundle.post_build_geo_coverage
def post_build_geo_coverage(self): """Collect all of the geocoverage for the bundle.""" spaces = set() grains = set() def resolve(term): places = list(self.library.search.search_identifiers(term)) if not places: raise BuildError( ...
python
def post_build_geo_coverage(self): """Collect all of the geocoverage for the bundle.""" spaces = set() grains = set() def resolve(term): places = list(self.library.search.search_identifiers(term)) if not places: raise BuildError( ...
[ "def", "post_build_geo_coverage", "(", "self", ")", ":", "spaces", "=", "set", "(", ")", "grains", "=", "set", "(", ")", "def", "resolve", "(", "term", ")", ":", "places", "=", "list", "(", "self", ".", "library", ".", "search", ".", "search_identifier...
Collect all of the geocoverage for the bundle.
[ "Collect", "all", "of", "the", "geocoverage", "for", "the", "bundle", "." ]
train
https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/bundle/bundle.py#L2684-L2729
CivicSpleen/ambry
ambry/bundle/bundle.py
Bundle.is_finalized
def is_finalized(self): """Return True if the bundle is installed.""" return self.state == self.STATES.FINALIZED or self.state == self.STATES.INSTALLED
python
def is_finalized(self): """Return True if the bundle is installed.""" return self.state == self.STATES.FINALIZED or self.state == self.STATES.INSTALLED
[ "def", "is_finalized", "(", "self", ")", ":", "return", "self", ".", "state", "==", "self", ".", "STATES", ".", "FINALIZED", "or", "self", ".", "state", "==", "self", ".", "STATES", ".", "INSTALLED" ]
Return True if the bundle is installed.
[ "Return", "True", "if", "the", "bundle", "is", "installed", "." ]
train
https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/bundle/bundle.py#L2736-L2739
CivicSpleen/ambry
ambry/bundle/bundle.py
Bundle._run_events
def _run_events(self, tag, stage=None): """Run tests marked with a particular tag and stage""" self._run_event_methods(tag, stage) self._run_tests(tag, stage)
python
def _run_events(self, tag, stage=None): """Run tests marked with a particular tag and stage""" self._run_event_methods(tag, stage) self._run_tests(tag, stage)
[ "def", "_run_events", "(", "self", ",", "tag", ",", "stage", "=", "None", ")", ":", "self", ".", "_run_event_methods", "(", "tag", ",", "stage", ")", "self", ".", "_run_tests", "(", "tag", ",", "stage", ")" ]
Run tests marked with a particular tag and stage
[ "Run", "tests", "marked", "with", "a", "particular", "tag", "and", "stage" ]
train
https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/bundle/bundle.py#L2792-L2796
CivicSpleen/ambry
ambry/bundle/bundle.py
Bundle._run_event_methods
def _run_event_methods(self, tag, stage=None): """Run code in the bundle that is marked with events. """ import inspect from ambry.bundle.events import _runable_for_event funcs = [] for func_name, f in inspect.getmembers(self, predicate=inspect.ismethod): if _runabl...
python
def _run_event_methods(self, tag, stage=None): """Run code in the bundle that is marked with events. """ import inspect from ambry.bundle.events import _runable_for_event funcs = [] for func_name, f in inspect.getmembers(self, predicate=inspect.ismethod): if _runabl...
[ "def", "_run_event_methods", "(", "self", ",", "tag", ",", "stage", "=", "None", ")", ":", "import", "inspect", "from", "ambry", ".", "bundle", ".", "events", "import", "_runable_for_event", "funcs", "=", "[", "]", "for", "func_name", ",", "f", "in", "in...
Run code in the bundle that is marked with events.
[ "Run", "code", "in", "the", "bundle", "that", "is", "marked", "with", "events", "." ]
train
https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/bundle/bundle.py#L2798-L2810
CivicSpleen/ambry
ambry/bundle/bundle.py
Bundle.is_installed
def is_installed(self): """Return True if the bundle is installed.""" r = self.library.resolve(self.identity.vid) return r is not None
python
def is_installed(self): """Return True if the bundle is installed.""" r = self.library.resolve(self.identity.vid) return r is not None
[ "def", "is_installed", "(", "self", ")", ":", "r", "=", "self", ".", "library", ".", "resolve", "(", "self", ".", "identity", ".", "vid", ")", "return", "r", "is", "not", "None" ]
Return True if the bundle is installed.
[ "Return", "True", "if", "the", "bundle", "is", "installed", "." ]
train
https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/bundle/bundle.py#L3029-L3034
SmartTeleMax/iktomi
iktomi/unstable/db/sqla/replication.py
include
def include(prop): '''Replicate property that is normally not replicated. Right now it's meaningful for one-to-many relations only.''' if isinstance(prop, QueryableAttribute): prop = prop.property assert isinstance(prop, (Column, ColumnProperty, RelationshipProperty)) #assert isinstance(prop...
python
def include(prop): '''Replicate property that is normally not replicated. Right now it's meaningful for one-to-many relations only.''' if isinstance(prop, QueryableAttribute): prop = prop.property assert isinstance(prop, (Column, ColumnProperty, RelationshipProperty)) #assert isinstance(prop...
[ "def", "include", "(", "prop", ")", ":", "if", "isinstance", "(", "prop", ",", "QueryableAttribute", ")", ":", "prop", "=", "prop", ".", "property", "assert", "isinstance", "(", "prop", ",", "(", "Column", ",", "ColumnProperty", ",", "RelationshipProperty", ...
Replicate property that is normally not replicated. Right now it's meaningful for one-to-many relations only.
[ "Replicate", "property", "that", "is", "normally", "not", "replicated", ".", "Right", "now", "it", "s", "meaningful", "for", "one", "-", "to", "-", "many", "relations", "only", "." ]
train
https://github.com/SmartTeleMax/iktomi/blob/80bc0f1408d63efe7f5844367d1f6efba44b35f2/iktomi/unstable/db/sqla/replication.py#L33-L40
SmartTeleMax/iktomi
iktomi/unstable/db/sqla/replication.py
exclude
def exclude(prop): '''Don't replicate property that is normally replicated: ordering column, many-to-one relation that is marked for replication from other side.''' if isinstance(prop, QueryableAttribute): prop = prop.property assert isinstance(prop, (Column, ColumnProperty, RelationshipProperty...
python
def exclude(prop): '''Don't replicate property that is normally replicated: ordering column, many-to-one relation that is marked for replication from other side.''' if isinstance(prop, QueryableAttribute): prop = prop.property assert isinstance(prop, (Column, ColumnProperty, RelationshipProperty...
[ "def", "exclude", "(", "prop", ")", ":", "if", "isinstance", "(", "prop", ",", "QueryableAttribute", ")", ":", "prop", "=", "prop", ".", "property", "assert", "isinstance", "(", "prop", ",", "(", "Column", ",", "ColumnProperty", ",", "RelationshipProperty", ...
Don't replicate property that is normally replicated: ordering column, many-to-one relation that is marked for replication from other side.
[ "Don", "t", "replicate", "property", "that", "is", "normally", "replicated", ":", "ordering", "column", "many", "-", "to", "-", "one", "relation", "that", "is", "marked", "for", "replication", "from", "other", "side", "." ]
train
https://github.com/SmartTeleMax/iktomi/blob/80bc0f1408d63efe7f5844367d1f6efba44b35f2/iktomi/unstable/db/sqla/replication.py#L42-L52
SmartTeleMax/iktomi
iktomi/unstable/db/sqla/replication.py
reflect
def reflect(source, model, cache=None): '''Finds an object of class `model` with the same identifier as the `source` object''' if source is None: return None if cache and source in cache: return cache[source] db = object_session(source) ident = identity_key(instance=source)[1] ...
python
def reflect(source, model, cache=None): '''Finds an object of class `model` with the same identifier as the `source` object''' if source is None: return None if cache and source in cache: return cache[source] db = object_session(source) ident = identity_key(instance=source)[1] ...
[ "def", "reflect", "(", "source", ",", "model", ",", "cache", "=", "None", ")", ":", "if", "source", "is", "None", ":", "return", "None", "if", "cache", "and", "source", "in", "cache", ":", "return", "cache", "[", "source", "]", "db", "=", "object_ses...
Finds an object of class `model` with the same identifier as the `source` object
[ "Finds", "an", "object", "of", "class", "model", "with", "the", "same", "identifier", "as", "the", "source", "object" ]
train
https://github.com/SmartTeleMax/iktomi/blob/80bc0f1408d63efe7f5844367d1f6efba44b35f2/iktomi/unstable/db/sqla/replication.py#L55-L65
SmartTeleMax/iktomi
iktomi/unstable/db/sqla/replication.py
replicate_attributes
def replicate_attributes(source, target, cache=None): '''Replicates common SQLAlchemy attributes from the `source` object to the `target` object.''' target_manager = manager_of_class(type(target)) column_attrs = set() relationship_attrs = set() relationship_columns = set() for attr in manage...
python
def replicate_attributes(source, target, cache=None): '''Replicates common SQLAlchemy attributes from the `source` object to the `target` object.''' target_manager = manager_of_class(type(target)) column_attrs = set() relationship_attrs = set() relationship_columns = set() for attr in manage...
[ "def", "replicate_attributes", "(", "source", ",", "target", ",", "cache", "=", "None", ")", ":", "target_manager", "=", "manager_of_class", "(", "type", "(", "target", ")", ")", "column_attrs", "=", "set", "(", ")", "relationship_attrs", "=", "set", "(", ...
Replicates common SQLAlchemy attributes from the `source` object to the `target` object.
[ "Replicates", "common", "SQLAlchemy", "attributes", "from", "the", "source", "object", "to", "the", "target", "object", "." ]
train
https://github.com/SmartTeleMax/iktomi/blob/80bc0f1408d63efe7f5844367d1f6efba44b35f2/iktomi/unstable/db/sqla/replication.py#L144-L177
SmartTeleMax/iktomi
iktomi/unstable/db/sqla/replication.py
replicate_no_merge
def replicate_no_merge(source, model, cache=None): '''Replicates the `source` object to `model` class and returns its reflection.''' # `cache` is used to break circular dependency: we need to replicate # attributes before merging target into the session, but replication of # some attributes may requ...
python
def replicate_no_merge(source, model, cache=None): '''Replicates the `source` object to `model` class and returns its reflection.''' # `cache` is used to break circular dependency: we need to replicate # attributes before merging target into the session, but replication of # some attributes may requ...
[ "def", "replicate_no_merge", "(", "source", ",", "model", ",", "cache", "=", "None", ")", ":", "# `cache` is used to break circular dependency: we need to replicate", "# attributes before merging target into the session, but replication of", "# some attributes may require target to be in...
Replicates the `source` object to `model` class and returns its reflection.
[ "Replicates", "the", "source", "object", "to", "model", "class", "and", "returns", "its", "reflection", "." ]
train
https://github.com/SmartTeleMax/iktomi/blob/80bc0f1408d63efe7f5844367d1f6efba44b35f2/iktomi/unstable/db/sqla/replication.py#L180-L204
SmartTeleMax/iktomi
iktomi/unstable/db/sqla/replication.py
replicate
def replicate(source, model, cache=None): '''Replicates the `source` object to `model` class and returns its reflection.''' target = replicate_no_merge(source, model, cache=cache) if target is not None: db = object_session(source) target = db.merge(target) return target
python
def replicate(source, model, cache=None): '''Replicates the `source` object to `model` class and returns its reflection.''' target = replicate_no_merge(source, model, cache=cache) if target is not None: db = object_session(source) target = db.merge(target) return target
[ "def", "replicate", "(", "source", ",", "model", ",", "cache", "=", "None", ")", ":", "target", "=", "replicate_no_merge", "(", "source", ",", "model", ",", "cache", "=", "cache", ")", "if", "target", "is", "not", "None", ":", "db", "=", "object_sessio...
Replicates the `source` object to `model` class and returns its reflection.
[ "Replicates", "the", "source", "object", "to", "model", "class", "and", "returns", "its", "reflection", "." ]
train
https://github.com/SmartTeleMax/iktomi/blob/80bc0f1408d63efe7f5844367d1f6efba44b35f2/iktomi/unstable/db/sqla/replication.py#L207-L214
SmartTeleMax/iktomi
iktomi/unstable/db/sqla/replication.py
replicate_filter
def replicate_filter(sources, model, cache=None): '''Replicates the list of objects to other class and returns their reflections''' targets = [replicate_no_merge(source, model, cache=cache) for source in sources] # Some objects may not be available in target DB (not published), so we ...
python
def replicate_filter(sources, model, cache=None): '''Replicates the list of objects to other class and returns their reflections''' targets = [replicate_no_merge(source, model, cache=cache) for source in sources] # Some objects may not be available in target DB (not published), so we ...
[ "def", "replicate_filter", "(", "sources", ",", "model", ",", "cache", "=", "None", ")", ":", "targets", "=", "[", "replicate_no_merge", "(", "source", ",", "model", ",", "cache", "=", "cache", ")", "for", "source", "in", "sources", "]", "# Some objects ma...
Replicates the list of objects to other class and returns their reflections
[ "Replicates", "the", "list", "of", "objects", "to", "other", "class", "and", "returns", "their", "reflections" ]
train
https://github.com/SmartTeleMax/iktomi/blob/80bc0f1408d63efe7f5844367d1f6efba44b35f2/iktomi/unstable/db/sqla/replication.py#L217-L224
SmartTeleMax/iktomi
iktomi/unstable/db/sqla/replication.py
reflect_filter
def reflect_filter(sources, model, cache=None): '''Returns the list of reflections of objects in the `source` list to other class. Objects that are not found in target table are silently discarded. ''' targets = [reflect(source, model, cache=cache) for source in sources] # Some objects may not be av...
python
def reflect_filter(sources, model, cache=None): '''Returns the list of reflections of objects in the `source` list to other class. Objects that are not found in target table are silently discarded. ''' targets = [reflect(source, model, cache=cache) for source in sources] # Some objects may not be av...
[ "def", "reflect_filter", "(", "sources", ",", "model", ",", "cache", "=", "None", ")", ":", "targets", "=", "[", "reflect", "(", "source", ",", "model", ",", "cache", "=", "cache", ")", "for", "source", "in", "sources", "]", "# Some objects may not be avai...
Returns the list of reflections of objects in the `source` list to other class. Objects that are not found in target table are silently discarded.
[ "Returns", "the", "list", "of", "reflections", "of", "objects", "in", "the", "source", "list", "to", "other", "class", ".", "Objects", "that", "are", "not", "found", "in", "target", "table", "are", "silently", "discarded", "." ]
train
https://github.com/SmartTeleMax/iktomi/blob/80bc0f1408d63efe7f5844367d1f6efba44b35f2/iktomi/unstable/db/sqla/replication.py#L227-L234
CivicSpleen/ambry
ambry/orm/column.py
Column.valuetype_class
def valuetype_class(self): """Return the valuetype class, if one is defined, or a built-in type if it isn't""" from ambry.valuetype import resolve_value_type if self.valuetype: return resolve_value_type(self.valuetype) else: return resolve_value_type(self.datat...
python
def valuetype_class(self): """Return the valuetype class, if one is defined, or a built-in type if it isn't""" from ambry.valuetype import resolve_value_type if self.valuetype: return resolve_value_type(self.valuetype) else: return resolve_value_type(self.datat...
[ "def", "valuetype_class", "(", "self", ")", ":", "from", "ambry", ".", "valuetype", "import", "resolve_value_type", "if", "self", ".", "valuetype", ":", "return", "resolve_value_type", "(", "self", ".", "valuetype", ")", "else", ":", "return", "resolve_value_typ...
Return the valuetype class, if one is defined, or a built-in type if it isn't
[ "Return", "the", "valuetype", "class", "if", "one", "is", "defined", "or", "a", "built", "-", "in", "type", "if", "it", "isn", "t" ]
train
https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/orm/column.py#L185-L194
CivicSpleen/ambry
ambry/orm/column.py
Column.python_type
def python_type(self): """Return the python type for the row, possibly getting it from a valuetype reference """ from ambry.valuetype import resolve_value_type if self.valuetype and resolve_value_type(self.valuetype): return resolve_value_type(self.valuetype)._pythontype e...
python
def python_type(self): """Return the python type for the row, possibly getting it from a valuetype reference """ from ambry.valuetype import resolve_value_type if self.valuetype and resolve_value_type(self.valuetype): return resolve_value_type(self.valuetype)._pythontype e...
[ "def", "python_type", "(", "self", ")", ":", "from", "ambry", ".", "valuetype", "import", "resolve_value_type", "if", "self", ".", "valuetype", "and", "resolve_value_type", "(", "self", ".", "valuetype", ")", ":", "return", "resolve_value_type", "(", "self", "...
Return the python type for the row, possibly getting it from a valuetype reference
[ "Return", "the", "python", "type", "for", "the", "row", "possibly", "getting", "it", "from", "a", "valuetype", "reference" ]
train
https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/orm/column.py#L205-L221
CivicSpleen/ambry
ambry/orm/column.py
Column.role
def role(self): '''Return the code for the role, measure, dimension or error''' from ambry.valuetype.core import ROLE if not self.valuetype_class: return '' role = self.valuetype_class.role if role == ROLE.UNKNOWN: vt_code = self.valuetype_class.vt_code...
python
def role(self): '''Return the code for the role, measure, dimension or error''' from ambry.valuetype.core import ROLE if not self.valuetype_class: return '' role = self.valuetype_class.role if role == ROLE.UNKNOWN: vt_code = self.valuetype_class.vt_code...
[ "def", "role", "(", "self", ")", ":", "from", "ambry", ".", "valuetype", ".", "core", "import", "ROLE", "if", "not", "self", ".", "valuetype_class", ":", "return", "''", "role", "=", "self", ".", "valuetype_class", ".", "role", "if", "role", "==", "ROL...
Return the code for the role, measure, dimension or error
[ "Return", "the", "code", "for", "the", "role", "measure", "dimension", "or", "error" ]
train
https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/orm/column.py#L224-L240
CivicSpleen/ambry
ambry/orm/column.py
Column.is_dimension
def is_dimension(self): """Return true if the colum is a dimension""" from ambry.valuetype.core import ROLE return self.role == ROLE.DIMENSION
python
def is_dimension(self): """Return true if the colum is a dimension""" from ambry.valuetype.core import ROLE return self.role == ROLE.DIMENSION
[ "def", "is_dimension", "(", "self", ")", ":", "from", "ambry", ".", "valuetype", ".", "core", "import", "ROLE", "return", "self", ".", "role", "==", "ROLE", ".", "DIMENSION" ]
Return true if the colum is a dimension
[ "Return", "true", "if", "the", "colum", "is", "a", "dimension" ]
train
https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/orm/column.py#L243-L246
CivicSpleen/ambry
ambry/orm/column.py
Column.is_measure
def is_measure(self): """Return true if the colum is a dimension""" from ambry.valuetype.core import ROLE return self.role == ROLE.MEASURE
python
def is_measure(self): """Return true if the colum is a dimension""" from ambry.valuetype.core import ROLE return self.role == ROLE.MEASURE
[ "def", "is_measure", "(", "self", ")", ":", "from", "ambry", ".", "valuetype", ".", "core", "import", "ROLE", "return", "self", ".", "role", "==", "ROLE", ".", "MEASURE" ]
Return true if the colum is a dimension
[ "Return", "true", "if", "the", "colum", "is", "a", "dimension" ]
train
https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/orm/column.py#L249-L252
CivicSpleen/ambry
ambry/orm/column.py
Column.is_label
def is_label(self): """Return true if the colum is a dimension""" from ambry.valuetype.core import ROLE return self.role == ROLE.LABEL
python
def is_label(self): """Return true if the colum is a dimension""" from ambry.valuetype.core import ROLE return self.role == ROLE.LABEL
[ "def", "is_label", "(", "self", ")", ":", "from", "ambry", ".", "valuetype", ".", "core", "import", "ROLE", "return", "self", ".", "role", "==", "ROLE", ".", "LABEL" ]
Return true if the colum is a dimension
[ "Return", "true", "if", "the", "colum", "is", "a", "dimension" ]
train
https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/orm/column.py#L255-L258
CivicSpleen/ambry
ambry/orm/column.py
Column.is_error
def is_error(self): """Return true if the colum is a dimension""" from ambry.valuetype.core import ROLE return self.role == ROLE.ERROR
python
def is_error(self): """Return true if the colum is a dimension""" from ambry.valuetype.core import ROLE return self.role == ROLE.ERROR
[ "def", "is_error", "(", "self", ")", ":", "from", "ambry", ".", "valuetype", ".", "core", "import", "ROLE", "return", "self", ".", "role", "==", "ROLE", ".", "ERROR" ]
Return true if the colum is a dimension
[ "Return", "true", "if", "the", "colum", "is", "a", "dimension" ]
train
https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/orm/column.py#L261-L264
CivicSpleen/ambry
ambry/orm/column.py
Column.children
def children(self): """"Return the table's other column that have this column as a parent, excluding labels""" for c in self.table.columns: if c.parent == self.name and not c.valuetype_class.is_label(): yield c
python
def children(self): """"Return the table's other column that have this column as a parent, excluding labels""" for c in self.table.columns: if c.parent == self.name and not c.valuetype_class.is_label(): yield c
[ "def", "children", "(", "self", ")", ":", "for", "c", "in", "self", ".", "table", ".", "columns", ":", "if", "c", ".", "parent", "==", "self", ".", "name", "and", "not", "c", ".", "valuetype_class", ".", "is_label", "(", ")", ":", "yield", "c" ]
Return the table's other column that have this column as a parent, excluding labels
[ "Return", "the", "table", "s", "other", "column", "that", "have", "this", "column", "as", "a", "parent", "excluding", "labels" ]
train
https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/orm/column.py#L278-L282
CivicSpleen/ambry
ambry/orm/column.py
Column.label
def label(self): """"Return first child of the column that is marked as a label. Returns self if the column is a label""" if self.valuetype_class.is_label(): return self for c in self.table.columns: if c.parent == self.name and c.valuetype_class.is_label(): ...
python
def label(self): """"Return first child of the column that is marked as a label. Returns self if the column is a label""" if self.valuetype_class.is_label(): return self for c in self.table.columns: if c.parent == self.name and c.valuetype_class.is_label(): ...
[ "def", "label", "(", "self", ")", ":", "if", "self", ".", "valuetype_class", ".", "is_label", "(", ")", ":", "return", "self", "for", "c", "in", "self", ".", "table", ".", "columns", ":", "if", "c", ".", "parent", "==", "self", ".", "name", "and", ...
Return first child of the column that is marked as a label. Returns self if the column is a label
[ "Return", "first", "child", "of", "the", "column", "that", "is", "marked", "as", "a", "label", ".", "Returns", "self", "if", "the", "column", "is", "a", "label" ]
train
https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/orm/column.py#L285-L295
CivicSpleen/ambry
ambry/orm/column.py
Column.geoid
def geoid(self): """"Return first child of the column, or self that is marked as a geographic identifier""" if self.valuetype_class.is_geoid(): return self for c in self.table.columns: if c.parent == self.name and c.valuetype_class.is_geoid(): return c
python
def geoid(self): """"Return first child of the column, or self that is marked as a geographic identifier""" if self.valuetype_class.is_geoid(): return self for c in self.table.columns: if c.parent == self.name and c.valuetype_class.is_geoid(): return c
[ "def", "geoid", "(", "self", ")", ":", "if", "self", ".", "valuetype_class", ".", "is_geoid", "(", ")", ":", "return", "self", "for", "c", "in", "self", ".", "table", ".", "columns", ":", "if", "c", ".", "parent", "==", "self", ".", "name", "and", ...
Return first child of the column, or self that is marked as a geographic identifier
[ "Return", "first", "child", "of", "the", "column", "or", "self", "that", "is", "marked", "as", "a", "geographic", "identifier" ]
train
https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/orm/column.py#L308-L316
CivicSpleen/ambry
ambry/orm/column.py
Column.python_cast
def python_cast(self, v): """Cast a value to the type of the column. Primarily used to check that a value is valid; it will throw an exception otherwise """ if self.type_is_time(): dt = dateutil.parser.parse(v) if self.datatype == Column.DATATYPE_TIME:...
python
def python_cast(self, v): """Cast a value to the type of the column. Primarily used to check that a value is valid; it will throw an exception otherwise """ if self.type_is_time(): dt = dateutil.parser.parse(v) if self.datatype == Column.DATATYPE_TIME:...
[ "def", "python_cast", "(", "self", ",", "v", ")", ":", "if", "self", ".", "type_is_time", "(", ")", ":", "dt", "=", "dateutil", ".", "parser", ".", "parse", "(", "v", ")", "if", "self", ".", "datatype", "==", "Column", ".", "DATATYPE_TIME", ":", "d...
Cast a value to the type of the column. Primarily used to check that a value is valid; it will throw an exception otherwise
[ "Cast", "a", "value", "to", "the", "type", "of", "the", "column", "." ]
train
https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/orm/column.py#L318-L338
CivicSpleen/ambry
ambry/orm/column.py
Column.convert_numpy_type
def convert_numpy_type(cls, dtype): """Convert a numpy dtype into a Column datatype. Only handles common types. Implemented as a function to decouple from numpy """ m = { 'int64': cls.DATATYPE_INTEGER64, 'float64': cls.DATATYPE_FLOAT, 'objec...
python
def convert_numpy_type(cls, dtype): """Convert a numpy dtype into a Column datatype. Only handles common types. Implemented as a function to decouple from numpy """ m = { 'int64': cls.DATATYPE_INTEGER64, 'float64': cls.DATATYPE_FLOAT, 'objec...
[ "def", "convert_numpy_type", "(", "cls", ",", "dtype", ")", ":", "m", "=", "{", "'int64'", ":", "cls", ".", "DATATYPE_INTEGER64", ",", "'float64'", ":", "cls", ".", "DATATYPE_FLOAT", ",", "'object'", ":", "cls", ".", "DATATYPE_TEXT", "# Hack. Pandas makes stri...
Convert a numpy dtype into a Column datatype. Only handles common types. Implemented as a function to decouple from numpy
[ "Convert", "a", "numpy", "dtype", "into", "a", "Column", "datatype", ".", "Only", "handles", "common", "types", "." ]
train
https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/orm/column.py#L352-L373
CivicSpleen/ambry
ambry/orm/column.py
Column.dict
def dict(self): """A dict that holds key/values for all of the properties in the object. :return: """ d = {p.key: getattr(self, p.key) for p in self.__mapper__.attrs if p.key not in ('table', 'stats', '_codes', 'data')} if not d: raise Exceptio...
python
def dict(self): """A dict that holds key/values for all of the properties in the object. :return: """ d = {p.key: getattr(self, p.key) for p in self.__mapper__.attrs if p.key not in ('table', 'stats', '_codes', 'data')} if not d: raise Exceptio...
[ "def", "dict", "(", "self", ")", ":", "d", "=", "{", "p", ".", "key", ":", "getattr", "(", "self", ",", "p", ".", "key", ")", "for", "p", "in", "self", ".", "__mapper__", ".", "attrs", "if", "p", ".", "key", "not", "in", "(", "'table'", ",", ...
A dict that holds key/values for all of the properties in the object. :return:
[ "A", "dict", "that", "holds", "key", "/", "values", "for", "all", "of", "the", "properties", "in", "the", "object", "." ]
train
https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/orm/column.py#L411-L432
CivicSpleen/ambry
ambry/orm/column.py
Column.nonull_dict
def nonull_dict(self): """Like dict, but does not hold any null values. :return: """ return {k: v for k, v in six.iteritems(self.dict) if v and k != '_codes'}
python
def nonull_dict(self): """Like dict, but does not hold any null values. :return: """ return {k: v for k, v in six.iteritems(self.dict) if v and k != '_codes'}
[ "def", "nonull_dict", "(", "self", ")", ":", "return", "{", "k", ":", "v", "for", "k", ",", "v", "in", "six", ".", "iteritems", "(", "self", ".", "dict", ")", "if", "v", "and", "k", "!=", "'_codes'", "}" ]
Like dict, but does not hold any null values. :return:
[ "Like", "dict", "but", "does", "not", "hold", "any", "null", "values", "." ]
train
https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/orm/column.py#L435-L441
CivicSpleen/ambry
ambry/orm/column.py
Column.mangle_name
def mangle_name(name): """Mangles a column name to a standard form, remoing illegal characters. :param name: :return: """ import re try: return re.sub('_+', '_', re.sub('[^\w_]', '_', name).lower()).rstrip('_') except TypeError: r...
python
def mangle_name(name): """Mangles a column name to a standard form, remoing illegal characters. :param name: :return: """ import re try: return re.sub('_+', '_', re.sub('[^\w_]', '_', name).lower()).rstrip('_') except TypeError: r...
[ "def", "mangle_name", "(", "name", ")", ":", "import", "re", "try", ":", "return", "re", ".", "sub", "(", "'_+'", ",", "'_'", ",", "re", ".", "sub", "(", "'[^\\w_]'", ",", "'_'", ",", "name", ")", ".", "lower", "(", ")", ")", ".", "rstrip", "("...
Mangles a column name to a standard form, remoing illegal characters. :param name: :return:
[ "Mangles", "a", "column", "name", "to", "a", "standard", "form", "remoing", "illegal", "characters", "." ]
train
https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/orm/column.py#L444-L457
CivicSpleen/ambry
ambry/orm/column.py
Column.reverse_code_map
def reverse_code_map(self): """Return a map from a code ( usually a string ) to the shorter numeric value""" return {c.value: (c.ikey if c.ikey else c.key) for c in self.codes}
python
def reverse_code_map(self): """Return a map from a code ( usually a string ) to the shorter numeric value""" return {c.value: (c.ikey if c.ikey else c.key) for c in self.codes}
[ "def", "reverse_code_map", "(", "self", ")", ":", "return", "{", "c", ".", "value", ":", "(", "c", ".", "ikey", "if", "c", ".", "ikey", "else", "c", ".", "key", ")", "for", "c", "in", "self", ".", "codes", "}" ]
Return a map from a code ( usually a string ) to the shorter numeric value
[ "Return", "a", "map", "from", "a", "code", "(", "usually", "a", "string", ")", "to", "the", "shorter", "numeric", "value" ]
train
https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/orm/column.py#L461-L464
CivicSpleen/ambry
ambry/orm/column.py
Column.expanded_transform
def expanded_transform(self): """Expands the transform string into segments """ segments = self._expand_transform(self.transform) if segments: segments[0]['datatype'] = self.valuetype_class for s in segments: s['column'] = self else: ...
python
def expanded_transform(self): """Expands the transform string into segments """ segments = self._expand_transform(self.transform) if segments: segments[0]['datatype'] = self.valuetype_class for s in segments: s['column'] = self else: ...
[ "def", "expanded_transform", "(", "self", ")", ":", "segments", "=", "self", ".", "_expand_transform", "(", "self", ".", "transform", ")", "if", "segments", ":", "segments", "[", "0", "]", "[", "'datatype'", "]", "=", "self", ".", "valuetype_class", "for",...
Expands the transform string into segments
[ "Expands", "the", "transform", "string", "into", "segments" ]
train
https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/orm/column.py#L567-L586
CivicSpleen/ambry
ambry/orm/column.py
Column.before_insert
def before_insert(mapper, conn, target): """event.listen method for Sqlalchemy to set the seqience_id for this object and create an ObjectNumber value for the id_""" # from identity import ObjectNumber # assert not target.fk_vid or not ObjectNumber.parse(target.fk_vid).revision ...
python
def before_insert(mapper, conn, target): """event.listen method for Sqlalchemy to set the seqience_id for this object and create an ObjectNumber value for the id_""" # from identity import ObjectNumber # assert not target.fk_vid or not ObjectNumber.parse(target.fk_vid).revision ...
[ "def", "before_insert", "(", "mapper", ",", "conn", ",", "target", ")", ":", "# from identity import ObjectNumber", "# assert not target.fk_vid or not ObjectNumber.parse(target.fk_vid).revision", "if", "target", ".", "sequence_id", "is", "None", ":", "from", "ambry", ".", ...
event.listen method for Sqlalchemy to set the seqience_id for this object and create an ObjectNumber value for the id_
[ "event", ".", "listen", "method", "for", "Sqlalchemy", "to", "set", "the", "seqience_id", "for", "this", "object", "and", "create", "an", "ObjectNumber", "value", "for", "the", "id_" ]
train
https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/orm/column.py#L653-L667
CivicSpleen/ambry
ambry/orm/column.py
Column.before_update
def before_update(mapper, conn, target): """Set the column id number based on the table number and the sequence id for the column.""" assert target.datatype or target.valuetype target.name = Column.mangle_name(target.name) Column.update_number(target)
python
def before_update(mapper, conn, target): """Set the column id number based on the table number and the sequence id for the column.""" assert target.datatype or target.valuetype target.name = Column.mangle_name(target.name) Column.update_number(target)
[ "def", "before_update", "(", "mapper", ",", "conn", ",", "target", ")", ":", "assert", "target", ".", "datatype", "or", "target", ".", "valuetype", "target", ".", "name", "=", "Column", ".", "mangle_name", "(", "target", ".", "name", ")", "Column", ".", ...
Set the column id number based on the table number and the sequence id for the column.
[ "Set", "the", "column", "id", "number", "based", "on", "the", "table", "number", "and", "the", "sequence", "id", "for", "the", "column", "." ]
train
https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/orm/column.py#L670-L678
twisted/epsilon
epsilon/process.py
spawnProcess
def spawnProcess(processProtocol, executable, args=(), env={}, path=None, uid=None, gid=None, usePTY=0, packages=()): """Launch a process with a particular Python environment. All arguments as to reactor.spawnProcess(), except for the addition of an optional packages itera...
python
def spawnProcess(processProtocol, executable, args=(), env={}, path=None, uid=None, gid=None, usePTY=0, packages=()): """Launch a process with a particular Python environment. All arguments as to reactor.spawnProcess(), except for the addition of an optional packages itera...
[ "def", "spawnProcess", "(", "processProtocol", ",", "executable", ",", "args", "=", "(", ")", ",", "env", "=", "{", "}", ",", "path", "=", "None", ",", "uid", "=", "None", ",", "gid", "=", "None", ",", "usePTY", "=", "0", ",", "packages", "=", "(...
Launch a process with a particular Python environment. All arguments as to reactor.spawnProcess(), except for the addition of an optional packages iterable. This should be of strings naming packages the subprocess is to be able to import.
[ "Launch", "a", "process", "with", "a", "particular", "Python", "environment", "." ]
train
https://github.com/twisted/epsilon/blob/e85fa985a41983ef06e1d3bb26639181e1f78b24/epsilon/process.py#L19-L43
twisted/epsilon
epsilon/process.py
spawnPythonProcess
def spawnPythonProcess(processProtocol, args=(), env={}, path=None, uid=None, gid=None, usePTY=0, packages=()): """Launch a Python process All arguments as to spawnProcess(), except the executable argument is omitted. """ return spawnProcess(processProt...
python
def spawnPythonProcess(processProtocol, args=(), env={}, path=None, uid=None, gid=None, usePTY=0, packages=()): """Launch a Python process All arguments as to spawnProcess(), except the executable argument is omitted. """ return spawnProcess(processProt...
[ "def", "spawnPythonProcess", "(", "processProtocol", ",", "args", "=", "(", ")", ",", "env", "=", "{", "}", ",", "path", "=", "None", ",", "uid", "=", "None", ",", "gid", "=", "None", ",", "usePTY", "=", "0", ",", "packages", "=", "(", ")", ")", ...
Launch a Python process All arguments as to spawnProcess(), except the executable argument is omitted.
[ "Launch", "a", "Python", "process" ]
train
https://github.com/twisted/epsilon/blob/e85fa985a41983ef06e1d3bb26639181e1f78b24/epsilon/process.py#L45-L55
CivicSpleen/ambry
ambry/bundle/events.py
_runable_for_event
def _runable_for_event(f, tag, stage): """Loot at the event property for a function to see if it should be run at this stage. """ if not hasattr(f, '__ambry_event__'): return False f_tag, f_stage = f.__ambry_event__ if stage is None: stage = 0 if tag != f_tag or stage != f_stage:...
python
def _runable_for_event(f, tag, stage): """Loot at the event property for a function to see if it should be run at this stage. """ if not hasattr(f, '__ambry_event__'): return False f_tag, f_stage = f.__ambry_event__ if stage is None: stage = 0 if tag != f_tag or stage != f_stage:...
[ "def", "_runable_for_event", "(", "f", ",", "tag", ",", "stage", ")", ":", "if", "not", "hasattr", "(", "f", ",", "'__ambry_event__'", ")", ":", "return", "False", "f_tag", ",", "f_stage", "=", "f", ".", "__ambry_event__", "if", "stage", "is", "None", ...
Loot at the event property for a function to see if it should be run at this stage.
[ "Loot", "at", "the", "event", "property", "for", "a", "function", "to", "see", "if", "it", "should", "be", "run", "at", "this", "stage", "." ]
train
https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/bundle/events.py#L38-L52
sailthru/relay
relay/util.py
load_obj_from_path
def load_obj_from_path(import_path, prefix=None, ld=dict()): """ import a python object from an import path `import_path` - a python import path. For instance: mypackage.module.func or mypackage.module.class `prefix` (str) - a value to prepend to the import path ...
python
def load_obj_from_path(import_path, prefix=None, ld=dict()): """ import a python object from an import path `import_path` - a python import path. For instance: mypackage.module.func or mypackage.module.class `prefix` (str) - a value to prepend to the import path ...
[ "def", "load_obj_from_path", "(", "import_path", ",", "prefix", "=", "None", ",", "ld", "=", "dict", "(", ")", ")", ":", "if", "prefix", "and", "not", "import_path", ".", "startswith", "(", "prefix", ")", ":", "import_path", "=", "'.'", ".", "join", "(...
import a python object from an import path `import_path` - a python import path. For instance: mypackage.module.func or mypackage.module.class `prefix` (str) - a value to prepend to the import path if it isn't already there. For instance: load_obj_from_path...
[ "import", "a", "python", "object", "from", "an", "import", "path" ]
train
https://github.com/sailthru/relay/blob/995209346c6663675d96d0cbff3bb67b9758c8e2/relay/util.py#L16-L67
project-ncl/pnc-cli
pnc_cli/swagger_client/models/artifact_rest.py
ArtifactRest.artifact_quality
def artifact_quality(self, artifact_quality): """ Sets the artifact_quality of this ArtifactRest. :param artifact_quality: The artifact_quality of this ArtifactRest. :type: str """ allowed_values = ["NEW", "VERIFIED", "TESTED", "DEPRECATED", "BLACKLISTED", "DELETED", "TE...
python
def artifact_quality(self, artifact_quality): """ Sets the artifact_quality of this ArtifactRest. :param artifact_quality: The artifact_quality of this ArtifactRest. :type: str """ allowed_values = ["NEW", "VERIFIED", "TESTED", "DEPRECATED", "BLACKLISTED", "DELETED", "TE...
[ "def", "artifact_quality", "(", "self", ",", "artifact_quality", ")", ":", "allowed_values", "=", "[", "\"NEW\"", ",", "\"VERIFIED\"", ",", "\"TESTED\"", ",", "\"DEPRECATED\"", ",", "\"BLACKLISTED\"", ",", "\"DELETED\"", ",", "\"TEMPORARY\"", "]", "if", "artifact_...
Sets the artifact_quality of this ArtifactRest. :param artifact_quality: The artifact_quality of this ArtifactRest. :type: str
[ "Sets", "the", "artifact_quality", "of", "this", "ArtifactRest", "." ]
train
https://github.com/project-ncl/pnc-cli/blob/3dc149bf84928f60a8044ac50b58bbaddd451902/pnc_cli/swagger_client/models/artifact_rest.py#L179-L193
CivicSpleen/ambry
ambry/orm/source.py
_get_sqlite_columns
def _get_sqlite_columns(connection, table): """ Returns list of tuple containg columns of the table. Args: connection: sqlalchemy connection to sqlite database. table (str): name of the table Returns: list of (name, datatype, position): where name is column name, datatype is ...
python
def _get_sqlite_columns(connection, table): """ Returns list of tuple containg columns of the table. Args: connection: sqlalchemy connection to sqlite database. table (str): name of the table Returns: list of (name, datatype, position): where name is column name, datatype is ...
[ "def", "_get_sqlite_columns", "(", "connection", ",", "table", ")", ":", "# TODO: Move to the sqlite wrapper.", "# TODO: Consider sqlalchemy mapping.", "SQL_TO_PYTHON_TYPES", "=", "{", "'INT'", ":", "int", ",", "'INTEGER'", ":", "int", ",", "'TINYINT'", ":", "int", ",...
Returns list of tuple containg columns of the table. Args: connection: sqlalchemy connection to sqlite database. table (str): name of the table Returns: list of (name, datatype, position): where name is column name, datatype is python type of the column, position is ordinal...
[ "Returns", "list", "of", "tuple", "containg", "columns", "of", "the", "table", "." ]
train
https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/orm/source.py#L441-L489
CivicSpleen/ambry
ambry/orm/source.py
DataSourceBase.partition
def partition(self): """For partition urltypes, return the partition specified by the ref """ if self.urltype != 'partition': return None return self._bundle.library.partition(self.url)
python
def partition(self): """For partition urltypes, return the partition specified by the ref """ if self.urltype != 'partition': return None return self._bundle.library.partition(self.url)
[ "def", "partition", "(", "self", ")", ":", "if", "self", ".", "urltype", "!=", "'partition'", ":", "return", "None", "return", "self", ".", "_bundle", ".", "library", ".", "partition", "(", "self", ".", "url", ")" ]
For partition urltypes, return the partition specified by the ref
[ "For", "partition", "urltypes", "return", "the", "partition", "specified", "by", "the", "ref" ]
train
https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/orm/source.py#L161-L167
CivicSpleen/ambry
ambry/orm/source.py
DataSourceBase.datafile
def datafile(self): """Return an MPR datafile from the /ingest directory of the build filesystem""" from ambry_sources import MPRowsFile if self._datafile is None: if self.urltype == 'partition': self._datafile = self.partition.datafile else: ...
python
def datafile(self): """Return an MPR datafile from the /ingest directory of the build filesystem""" from ambry_sources import MPRowsFile if self._datafile is None: if self.urltype == 'partition': self._datafile = self.partition.datafile else: ...
[ "def", "datafile", "(", "self", ")", ":", "from", "ambry_sources", "import", "MPRowsFile", "if", "self", ".", "_datafile", "is", "None", ":", "if", "self", ".", "urltype", "==", "'partition'", ":", "self", ".", "_datafile", "=", "self", ".", "partition", ...
Return an MPR datafile from the /ingest directory of the build filesystem
[ "Return", "an", "MPR", "datafile", "from", "the", "/", "ingest", "directory", "of", "the", "build", "filesystem" ]
train
https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/orm/source.py#L170-L180
CivicSpleen/ambry
ambry/orm/source.py
DataSourceBase.spec
def spec(self): """Return a SourceSpec to describe this source""" from ambry_sources.sources import SourceSpec d = self.dict d['url'] = self.url # Will get the URL twice; once as ref and once as URL, but the ref is ignored return SourceSpec(**d)
python
def spec(self): """Return a SourceSpec to describe this source""" from ambry_sources.sources import SourceSpec d = self.dict d['url'] = self.url # Will get the URL twice; once as ref and once as URL, but the ref is ignored return SourceSpec(**d)
[ "def", "spec", "(", "self", ")", ":", "from", "ambry_sources", ".", "sources", "import", "SourceSpec", "d", "=", "self", ".", "dict", "d", "[", "'url'", "]", "=", "self", ".", "url", "# Will get the URL twice; once as ref and once as URL, but the ref is ignored", ...
Return a SourceSpec to describe this source
[ "Return", "a", "SourceSpec", "to", "describe", "this", "source" ]
train
https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/orm/source.py#L183-L192
CivicSpleen/ambry
ambry/orm/source.py
DataSourceBase.account
def account(self): """Return an account record, based on the host in the url""" from ambry.util import parse_url_to_dict d = parse_url_to_dict(self.url) return self._bundle.library.account(d['netloc'])
python
def account(self): """Return an account record, based on the host in the url""" from ambry.util import parse_url_to_dict d = parse_url_to_dict(self.url) return self._bundle.library.account(d['netloc'])
[ "def", "account", "(", "self", ")", ":", "from", "ambry", ".", "util", "import", "parse_url_to_dict", "d", "=", "parse_url_to_dict", "(", "self", ".", "url", ")", "return", "self", ".", "_bundle", ".", "library", ".", "account", "(", "d", "[", "'netloc'"...
Return an account record, based on the host in the url
[ "Return", "an", "account", "record", "based", "on", "the", "host", "in", "the", "url" ]
train
https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/orm/source.py#L195-L201
CivicSpleen/ambry
ambry/orm/source.py
DataSourceBase.update_table
def update_table(self, unknown_type='str'): """Update the source table from the datafile""" from ambry_sources.intuit import TypeIntuiter st = self.source_table if self.reftype == 'partition': for c in self.partition.table.columns: st.add_column(c.sequence_i...
python
def update_table(self, unknown_type='str'): """Update the source table from the datafile""" from ambry_sources.intuit import TypeIntuiter st = self.source_table if self.reftype == 'partition': for c in self.partition.table.columns: st.add_column(c.sequence_i...
[ "def", "update_table", "(", "self", ",", "unknown_type", "=", "'str'", ")", ":", "from", "ambry_sources", ".", "intuit", "import", "TypeIntuiter", "st", "=", "self", ".", "source_table", "if", "self", ".", "reftype", "==", "'partition'", ":", "for", "c", "...
Update the source table from the datafile
[ "Update", "the", "source", "table", "from", "the", "datafile" ]
train
https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/orm/source.py#L271-L310
CivicSpleen/ambry
ambry/orm/source.py
DataSourceBase.update_spec
def update_spec(self): """Update the source specification with information from the row intuiter, but only if the spec values are not already set. """ if self.datafile.exists: with self.datafile.reader as r: self.header_lines = r.info['header_rows'] ...
python
def update_spec(self): """Update the source specification with information from the row intuiter, but only if the spec values are not already set. """ if self.datafile.exists: with self.datafile.reader as r: self.header_lines = r.info['header_rows'] ...
[ "def", "update_spec", "(", "self", ")", ":", "if", "self", ".", "datafile", ".", "exists", ":", "with", "self", ".", "datafile", ".", "reader", "as", "r", ":", "self", ".", "header_lines", "=", "r", ".", "info", "[", "'header_rows'", "]", "self", "."...
Update the source specification with information from the row intuiter, but only if the spec values are not already set.
[ "Update", "the", "source", "specification", "with", "information", "from", "the", "row", "intuiter", "but", "only", "if", "the", "spec", "values", "are", "not", "already", "set", "." ]
train
https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/orm/source.py#L312-L322
CivicSpleen/ambry
ambry/orm/source.py
TransientDataSource.dict
def dict(self): """A dict that holds key/values for all of the properties in the object. :return: """ SKIP_KEYS = ('_source_table', '_dest_table', 'd_vid', 't_vid', 'st_id', 'dataset', 'hash', 'process_records') return OrderedDict([(k, getattr(self,...
python
def dict(self): """A dict that holds key/values for all of the properties in the object. :return: """ SKIP_KEYS = ('_source_table', '_dest_table', 'd_vid', 't_vid', 'st_id', 'dataset', 'hash', 'process_records') return OrderedDict([(k, getattr(self,...
[ "def", "dict", "(", "self", ")", ":", "SKIP_KEYS", "=", "(", "'_source_table'", ",", "'_dest_table'", ",", "'d_vid'", ",", "'t_vid'", ",", "'st_id'", ",", "'dataset'", ",", "'hash'", ",", "'process_records'", ")", "return", "OrderedDict", "(", "[", "(", "k...
A dict that holds key/values for all of the properties in the object. :return:
[ "A", "dict", "that", "holds", "key", "/", "values", "for", "all", "of", "the", "properties", "in", "the", "object", "." ]
train
https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/orm/source.py#L429-L438
CivicSpleen/ambry
ambry/run.py
get_runconfig
def get_runconfig(path=None, root=None, db=None): """Load the main configuration files and accounts file. Debprecated. Use load() """ return load(path, root=root, db=db)
python
def get_runconfig(path=None, root=None, db=None): """Load the main configuration files and accounts file. Debprecated. Use load() """ return load(path, root=root, db=db)
[ "def", "get_runconfig", "(", "path", "=", "None", ",", "root", "=", "None", ",", "db", "=", "None", ")", ":", "return", "load", "(", "path", ",", "root", "=", "root", ",", "db", "=", "db", ")" ]
Load the main configuration files and accounts file. Debprecated. Use load()
[ "Load", "the", "main", "configuration", "files", "and", "accounts", "file", "." ]
train
https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/run.py#L16-L22
CivicSpleen/ambry
ambry/run.py
load
def load(path=None, root=None, db=None, load_user=True): "Load all of the config files. " config = load_config(path, load_user=load_user) remotes = load_remotes(path, load_user=load_user) # The external file overwrites the main config if remotes: if not 'remotes' in config: co...
python
def load(path=None, root=None, db=None, load_user=True): "Load all of the config files. " config = load_config(path, load_user=load_user) remotes = load_remotes(path, load_user=load_user) # The external file overwrites the main config if remotes: if not 'remotes' in config: co...
[ "def", "load", "(", "path", "=", "None", ",", "root", "=", "None", ",", "db", "=", "None", ",", "load_user", "=", "True", ")", ":", "config", "=", "load_config", "(", "path", ",", "load_user", "=", "load_user", ")", "remotes", "=", "load_remotes", "(...
Load all of the config files.
[ "Load", "all", "of", "the", "config", "files", "." ]
train
https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/run.py#L25-L57
CivicSpleen/ambry
ambry/run.py
find_config_file
def find_config_file(file_name, extra_path=None, load_user=True): """ Find a configuration file in one of these directories, tried in this order: - A path provided as an argument - A path specified by the AMBRY_CONFIG environmenal variable - ambry in a path specified by the VIRTUAL_ENV environmenta...
python
def find_config_file(file_name, extra_path=None, load_user=True): """ Find a configuration file in one of these directories, tried in this order: - A path provided as an argument - A path specified by the AMBRY_CONFIG environmenal variable - ambry in a path specified by the VIRTUAL_ENV environmenta...
[ "def", "find_config_file", "(", "file_name", ",", "extra_path", "=", "None", ",", "load_user", "=", "True", ")", ":", "paths", "=", "[", "]", "if", "extra_path", "is", "not", "None", ":", "paths", ".", "append", "(", "extra_path", ")", "if", "os", ".",...
Find a configuration file in one of these directories, tried in this order: - A path provided as an argument - A path specified by the AMBRY_CONFIG environmenal variable - ambry in a path specified by the VIRTUAL_ENV environmental variable - ~/ambry - /etc/ambry :param file_name: :param ex...
[ "Find", "a", "configuration", "file", "in", "one", "of", "these", "directories", "tried", "in", "this", "order", ":" ]
train
https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/run.py#L90-L129
CivicSpleen/ambry
ambry/run.py
load_accounts
def load_accounts(extra_path=None, load_user=True): """Load the yaml account files :param load_user: :return: An `AttrDict` """ from os.path import getmtime try: accts_file = find_config_file(ACCOUNTS_FILE, extra_path=extra_path, load_user=load_user) except ConfigurationError: ...
python
def load_accounts(extra_path=None, load_user=True): """Load the yaml account files :param load_user: :return: An `AttrDict` """ from os.path import getmtime try: accts_file = find_config_file(ACCOUNTS_FILE, extra_path=extra_path, load_user=load_user) except ConfigurationError: ...
[ "def", "load_accounts", "(", "extra_path", "=", "None", ",", "load_user", "=", "True", ")", ":", "from", "os", ".", "path", "import", "getmtime", "try", ":", "accts_file", "=", "find_config_file", "(", "ACCOUNTS_FILE", ",", "extra_path", "=", "extra_path", "...
Load the yaml account files :param load_user: :return: An `AttrDict`
[ "Load", "the", "yaml", "account", "files" ]
train
https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/run.py#L132-L157
CivicSpleen/ambry
ambry/run.py
load_remotes
def load_remotes(extra_path=None, load_user=True): """Load the YAML remotes file, which sort of combines the Accounts file with part of the remotes sections from the main config :return: An `AttrDict` """ from os.path import getmtime try: remotes_file = find_config_file(REMOTES_FILE, ...
python
def load_remotes(extra_path=None, load_user=True): """Load the YAML remotes file, which sort of combines the Accounts file with part of the remotes sections from the main config :return: An `AttrDict` """ from os.path import getmtime try: remotes_file = find_config_file(REMOTES_FILE, ...
[ "def", "load_remotes", "(", "extra_path", "=", "None", ",", "load_user", "=", "True", ")", ":", "from", "os", ".", "path", "import", "getmtime", "try", ":", "remotes_file", "=", "find_config_file", "(", "REMOTES_FILE", ",", "extra_path", "=", "extra_path", "...
Load the YAML remotes file, which sort of combines the Accounts file with part of the remotes sections from the main config :return: An `AttrDict`
[ "Load", "the", "YAML", "remotes", "file", "which", "sort", "of", "combines", "the", "Accounts", "file", "with", "part", "of", "the", "remotes", "sections", "from", "the", "main", "config" ]
train
https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/run.py#L160-L186
CivicSpleen/ambry
ambry/run.py
load_config
def load_config(path=None, load_user=True): """ Load configuration information from a config directory. Tries directories in this order: - A path provided as an argument - A path specified by the AMBRY_CONFIG environmenal variable - ambry in a path specified by the VIRTUAL_ENV environmental variabl...
python
def load_config(path=None, load_user=True): """ Load configuration information from a config directory. Tries directories in this order: - A path provided as an argument - A path specified by the AMBRY_CONFIG environmenal variable - ambry in a path specified by the VIRTUAL_ENV environmental variabl...
[ "def", "load_config", "(", "path", "=", "None", ",", "load_user", "=", "True", ")", ":", "from", "os", ".", "path", "import", "getmtime", "config", "=", "AttrDict", "(", ")", "if", "not", "path", ":", "path", "=", "ROOT_DIR", "config_file", "=", "find_...
Load configuration information from a config directory. Tries directories in this order: - A path provided as an argument - A path specified by the AMBRY_CONFIG environmenal variable - ambry in a path specified by the VIRTUAL_ENV environmental variable - /etc/ambry - ~/ambry :param path: An it...
[ "Load", "configuration", "information", "from", "a", "config", "directory", ".", "Tries", "directories", "in", "this", "order", ":" ]
train
https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/run.py#L189-L222
CivicSpleen/ambry
ambry/run.py
update_config
def update_config(config, use_environ=True): """Update the configuration from environmental variables. Updates: - config.library.database from the AMBRY_DB environmental variable. - config.library.filesystem_root from the AMBRY_ROOT environmental variable. - config.accounts.password from the AMBRY_PASS...
python
def update_config(config, use_environ=True): """Update the configuration from environmental variables. Updates: - config.library.database from the AMBRY_DB environmental variable. - config.library.filesystem_root from the AMBRY_ROOT environmental variable. - config.accounts.password from the AMBRY_PASS...
[ "def", "update_config", "(", "config", ",", "use_environ", "=", "True", ")", ":", "from", "ambry", ".", "util", "import", "select_from_url", "try", ":", "_", "=", "config", ".", "library", "except", "KeyError", ":", "config", ".", "library", "=", "AttrDict...
Update the configuration from environmental variables. Updates: - config.library.database from the AMBRY_DB environmental variable. - config.library.filesystem_root from the AMBRY_ROOT environmental variable. - config.accounts.password from the AMBRY_PASSWORD environmental variable. :param config: An...
[ "Update", "the", "configuration", "from", "environmental", "variables", ".", "Updates", ":" ]
train
https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/run.py#L225-L329
CivicSpleen/ambry
ambry/run.py
normalize_dsn_or_dict
def normalize_dsn_or_dict(d): """Clean up a database DSN, or dict version of a DSN, returning both the cleaned DSN and dict version""" if isinstance(d, dict): try: # Convert from an AttrDict to a real dict d = d.to_dict() except AttributeError: pass # Alread...
python
def normalize_dsn_or_dict(d): """Clean up a database DSN, or dict version of a DSN, returning both the cleaned DSN and dict version""" if isinstance(d, dict): try: # Convert from an AttrDict to a real dict d = d.to_dict() except AttributeError: pass # Alread...
[ "def", "normalize_dsn_or_dict", "(", "d", ")", ":", "if", "isinstance", "(", "d", ",", "dict", ")", ":", "try", ":", "# Convert from an AttrDict to a real dict", "d", "=", "d", ".", "to_dict", "(", ")", "except", "AttributeError", ":", "pass", "# Already a rea...
Clean up a database DSN, or dict version of a DSN, returning both the cleaned DSN and dict version
[ "Clean", "up", "a", "database", "DSN", "or", "dict", "version", "of", "a", "DSN", "returning", "both", "the", "cleaned", "DSN", "and", "dict", "version" ]
train
https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/run.py#L332-L414
project-ncl/pnc-cli
pnc_cli/swagger_client/apis/productversions_api.py
ProductversionsApi.create_new_product_version
def create_new_product_version(self, **kwargs): """ Create a new ProductVersion for a Product This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. ...
python
def create_new_product_version(self, **kwargs): """ Create a new ProductVersion for a Product This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. ...
[ "def", "create_new_product_version", "(", "self", ",", "*", "*", "kwargs", ")", ":", "kwargs", "[", "'_return_http_data_only'", "]", "=", "True", "if", "kwargs", ".", "get", "(", "'callback'", ")", ":", "return", "self", ".", "create_new_product_version_with_htt...
Create a new ProductVersion for a Product This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(res...
[ "Create", "a", "new", "ProductVersion", "for", "a", "Product", "This", "method", "makes", "a", "synchronous", "HTTP", "request", "by", "default", ".", "To", "make", "an", "asynchronous", "HTTP", "request", "please", "define", "a", "callback", "function", "to",...
train
https://github.com/project-ncl/pnc-cli/blob/3dc149bf84928f60a8044ac50b58bbaddd451902/pnc_cli/swagger_client/apis/productversions_api.py#L42-L66
project-ncl/pnc-cli
pnc_cli/swagger_client/apis/productversions_api.py
ProductversionsApi.get_build_configuration_sets
def get_build_configuration_sets(self, id, **kwargs): """ Gets build configuration sets associated with a product version This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when...
python
def get_build_configuration_sets(self, id, **kwargs): """ Gets build configuration sets associated with a product version This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when...
[ "def", "get_build_configuration_sets", "(", "self", ",", "id", ",", "*", "*", "kwargs", ")", ":", "kwargs", "[", "'_return_http_data_only'", "]", "=", "True", "if", "kwargs", ".", "get", "(", "'callback'", ")", ":", "return", "self", ".", "get_build_configur...
Gets build configuration sets associated with a product version This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): ...
[ "Gets", "build", "configuration", "sets", "associated", "with", "a", "product", "version", "This", "method", "makes", "a", "synchronous", "HTTP", "request", "by", "default", ".", "To", "make", "an", "asynchronous", "HTTP", "request", "please", "define", "a", "...
train
https://github.com/project-ncl/pnc-cli/blob/3dc149bf84928f60a8044ac50b58bbaddd451902/pnc_cli/swagger_client/apis/productversions_api.py#L260-L288
project-ncl/pnc-cli
pnc_cli/swagger_client/apis/productversions_api.py
ProductversionsApi.update_build_configuration_sets
def update_build_configuration_sets(self, id, **kwargs): """ This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): ...
python
def update_build_configuration_sets(self, id, **kwargs): """ This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): ...
[ "def", "update_build_configuration_sets", "(", "self", ",", "id", ",", "*", "*", "kwargs", ")", ":", "kwargs", "[", "'_return_http_data_only'", "]", "=", "True", "if", "kwargs", ".", "get", "(", "'callback'", ")", ":", "return", "self", ".", "update_build_co...
This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.update_build_co...
[ "This", "method", "makes", "a", "synchronous", "HTTP", "request", "by", "default", ".", "To", "make", "an", "asynchronous", "HTTP", "request", "please", "define", "a", "callback", "function", "to", "be", "invoked", "when", "receiving", "the", "response", ".", ...
train
https://github.com/project-ncl/pnc-cli/blob/3dc149bf84928f60a8044ac50b58bbaddd451902/pnc_cli/swagger_client/apis/productversions_api.py#L598-L621
project-ncl/pnc-cli
pnc_cli/tools/utils.py
execute_command
def execute_command(cmd, execute, echo=True): """Execute a command in shell or just print it if execute is False""" if execute: if echo: print("Executing: " + cmd) return os.system(cmd) else: print(cmd) return 0
python
def execute_command(cmd, execute, echo=True): """Execute a command in shell or just print it if execute is False""" if execute: if echo: print("Executing: " + cmd) return os.system(cmd) else: print(cmd) return 0
[ "def", "execute_command", "(", "cmd", ",", "execute", ",", "echo", "=", "True", ")", ":", "if", "execute", ":", "if", "echo", ":", "print", "(", "\"Executing: \"", "+", "cmd", ")", "return", "os", ".", "system", "(", "cmd", ")", "else", ":", "print",...
Execute a command in shell or just print it if execute is False
[ "Execute", "a", "command", "in", "shell", "or", "just", "print", "it", "if", "execute", "is", "False" ]
train
https://github.com/project-ncl/pnc-cli/blob/3dc149bf84928f60a8044ac50b58bbaddd451902/pnc_cli/tools/utils.py#L20-L28
project-ncl/pnc-cli
pnc_cli/tools/utils.py
set_log_level
def set_log_level(level): """Sets the desired log level.""" lLevel = level.lower() unrecognized = False if (lLevel == 'debug-all'): loglevel = logging.DEBUG elif (lLevel == 'debug'): loglevel = logging.DEBUG elif (lLevel == 'info'): loglevel = logging.INFO elif (lLeve...
python
def set_log_level(level): """Sets the desired log level.""" lLevel = level.lower() unrecognized = False if (lLevel == 'debug-all'): loglevel = logging.DEBUG elif (lLevel == 'debug'): loglevel = logging.DEBUG elif (lLevel == 'info'): loglevel = logging.INFO elif (lLeve...
[ "def", "set_log_level", "(", "level", ")", ":", "lLevel", "=", "level", ".", "lower", "(", ")", "unrecognized", "=", "False", "if", "(", "lLevel", "==", "'debug-all'", ")", ":", "loglevel", "=", "logging", ".", "DEBUG", "elif", "(", "lLevel", "==", "'d...
Sets the desired log level.
[ "Sets", "the", "desired", "log", "level", "." ]
train
https://github.com/project-ncl/pnc-cli/blob/3dc149bf84928f60a8044ac50b58bbaddd451902/pnc_cli/tools/utils.py#L30-L71
project-ncl/pnc-cli
pnc_cli/tools/utils.py
parse_conf_args
def parse_conf_args(argv): """Parse command line options into {section: (option, key)} which can be used for overlaying on top of config :param argv: list of argumets to be parsed :return: Dictionary in the following format: {section: (option, key)}""" args = {} for rarg in argv: if re...
python
def parse_conf_args(argv): """Parse command line options into {section: (option, key)} which can be used for overlaying on top of config :param argv: list of argumets to be parsed :return: Dictionary in the following format: {section: (option, key)}""" args = {} for rarg in argv: if re...
[ "def", "parse_conf_args", "(", "argv", ")", ":", "args", "=", "{", "}", "for", "rarg", "in", "argv", ":", "if", "re", ".", "match", "(", "\"^--.*\"", ",", "rarg", ")", ":", "arg", "=", "rarg", ".", "replace", "(", "'--'", ",", "''", ",", "1", "...
Parse command line options into {section: (option, key)} which can be used for overlaying on top of config :param argv: list of argumets to be parsed :return: Dictionary in the following format: {section: (option, key)}
[ "Parse", "command", "line", "options", "into", "{", "section", ":", "(", "option", "key", ")", "}", "which", "can", "be", "used", "for", "overlaying", "on", "top", "of", "config" ]
train
https://github.com/project-ncl/pnc-cli/blob/3dc149bf84928f60a8044ac50b58bbaddd451902/pnc_cli/tools/utils.py#L102-L131
project-ncl/pnc-cli
pnc_cli/tools/utils.py
required
def required(field): """Decorator that checks if return value is set, if not, raises exception. """ def wrap(f): def wrappedf(*args): result = f(*args) if result is None or result == "": raise Exception( "Config option '%s' is required." %...
python
def required(field): """Decorator that checks if return value is set, if not, raises exception. """ def wrap(f): def wrappedf(*args): result = f(*args) if result is None or result == "": raise Exception( "Config option '%s' is required." %...
[ "def", "required", "(", "field", ")", ":", "def", "wrap", "(", "f", ")", ":", "def", "wrappedf", "(", "*", "args", ")", ":", "result", "=", "f", "(", "*", "args", ")", "if", "result", "is", "None", "or", "result", "==", "\"\"", ":", "raise", "E...
Decorator that checks if return value is set, if not, raises exception.
[ "Decorator", "that", "checks", "if", "return", "value", "is", "set", "if", "not", "raises", "exception", "." ]
train
https://github.com/project-ncl/pnc-cli/blob/3dc149bf84928f60a8044ac50b58bbaddd451902/pnc_cli/tools/utils.py#L144-L157
project-ncl/pnc-cli
pnc_cli/tools/utils.py
split_unescape
def split_unescape(s, delim, escape='\\', unescape=True): """ >>> split_unescape('foo,bar', ',') ['foo', 'bar'] >>> split_unescape('foo$,bar', ',', '$') ['foo,bar'] >>> split_unescape('foo$$,bar', ',', '$', unescape=True) ['foo$', 'bar'] >>> split_unescape('fo...
python
def split_unescape(s, delim, escape='\\', unescape=True): """ >>> split_unescape('foo,bar', ',') ['foo', 'bar'] >>> split_unescape('foo$,bar', ',', '$') ['foo,bar'] >>> split_unescape('foo$$,bar', ',', '$', unescape=True) ['foo$', 'bar'] >>> split_unescape('fo...
[ "def", "split_unescape", "(", "s", ",", "delim", ",", "escape", "=", "'\\\\'", ",", "unescape", "=", "True", ")", ":", "ret", "=", "[", "]", "current", "=", "[", "]", "itr", "=", "iter", "(", "s", ")", "for", "ch", "in", "itr", ":", "if", "ch",...
>>> split_unescape('foo,bar', ',') ['foo', 'bar'] >>> split_unescape('foo$,bar', ',', '$') ['foo,bar'] >>> split_unescape('foo$$,bar', ',', '$', unescape=True) ['foo$', 'bar'] >>> split_unescape('foo$$,bar', ',', '$', unescape=False) ['foo$$', 'bar'] >>> s...
[ ">>>", "split_unescape", "(", "foo", "bar", ")", "[", "foo", "bar", "]", ">>>", "split_unescape", "(", "foo$", "bar", "$", ")", "[", "foo", "bar", "]", ">>>", "split_unescape", "(", "foo$$", "bar", "$", "unescape", "=", "True", ")", "[", "foo$", "bar...
train
https://github.com/project-ncl/pnc-cli/blob/3dc149bf84928f60a8044ac50b58bbaddd451902/pnc_cli/tools/utils.py#L164-L197
PythonRails/rails
rails/views/jinja.py
JinjaView.render
def render(self, template_name, variables=None): """ Render a template with the passed variables. """ if variables is None: variables = {} template = self._engine.get_template(template_name) return template.render(**variables)
python
def render(self, template_name, variables=None): """ Render a template with the passed variables. """ if variables is None: variables = {} template = self._engine.get_template(template_name) return template.render(**variables)
[ "def", "render", "(", "self", ",", "template_name", ",", "variables", "=", "None", ")", ":", "if", "variables", "is", "None", ":", "variables", "=", "{", "}", "template", "=", "self", ".", "_engine", ".", "get_template", "(", "template_name", ")", "retur...
Render a template with the passed variables.
[ "Render", "a", "template", "with", "the", "passed", "variables", "." ]
train
https://github.com/PythonRails/rails/blob/1e199b9da4da5b24fef39fc6212d71fc9fbb18a5/rails/views/jinja.py#L17-L24
PythonRails/rails
rails/views/jinja.py
JinjaView.render_source
def render_source(self, source, variables=None): """ Render a source with the passed variables. """ if variables is None: variables = {} template = self._engine.from_string(source) return template.render(**variables)
python
def render_source(self, source, variables=None): """ Render a source with the passed variables. """ if variables is None: variables = {} template = self._engine.from_string(source) return template.render(**variables)
[ "def", "render_source", "(", "self", ",", "source", ",", "variables", "=", "None", ")", ":", "if", "variables", "is", "None", ":", "variables", "=", "{", "}", "template", "=", "self", ".", "_engine", ".", "from_string", "(", "source", ")", "return", "t...
Render a source with the passed variables.
[ "Render", "a", "source", "with", "the", "passed", "variables", "." ]
train
https://github.com/PythonRails/rails/blob/1e199b9da4da5b24fef39fc6212d71fc9fbb18a5/rails/views/jinja.py#L26-L33
SmartTeleMax/iktomi
iktomi/web/url_templates.py
construct_re
def construct_re(url_template, match_whole_str=False, converters=None, default_converter='string', anonymous=False): ''' url_template - str or unicode representing template Constructed pattern expects urlencoded string! returns (compiled re pattern, dict {url param nam...
python
def construct_re(url_template, match_whole_str=False, converters=None, default_converter='string', anonymous=False): ''' url_template - str or unicode representing template Constructed pattern expects urlencoded string! returns (compiled re pattern, dict {url param nam...
[ "def", "construct_re", "(", "url_template", ",", "match_whole_str", "=", "False", ",", "converters", "=", "None", ",", "default_converter", "=", "'string'", ",", "anonymous", "=", "False", ")", ":", "# needed for reverse url building (or not needed?)", "builder_params",...
url_template - str or unicode representing template Constructed pattern expects urlencoded string! returns (compiled re pattern, dict {url param name: [converter name, converter args (str)]}, list of (variable name, converter name, converter args name)) If anonymous=True is ...
[ "url_template", "-", "str", "or", "unicode", "representing", "template" ]
train
https://github.com/SmartTeleMax/iktomi/blob/80bc0f1408d63efe7f5844367d1f6efba44b35f2/iktomi/web/url_templates.py#L38-L85
SmartTeleMax/iktomi
iktomi/web/url_templates.py
UrlTemplate.match
def match(self, path, **kw): ''' path - str (urlencoded) ''' m = self._pattern.match(path) if m: kwargs = m.groupdict() # convert params for url_arg_name, value_urlencoded in kwargs.items(): conv_obj = self._url_params[url_arg_n...
python
def match(self, path, **kw): ''' path - str (urlencoded) ''' m = self._pattern.match(path) if m: kwargs = m.groupdict() # convert params for url_arg_name, value_urlencoded in kwargs.items(): conv_obj = self._url_params[url_arg_n...
[ "def", "match", "(", "self", ",", "path", ",", "*", "*", "kw", ")", ":", "m", "=", "self", ".", "_pattern", ".", "match", "(", "path", ")", "if", "m", ":", "kwargs", "=", "m", ".", "groupdict", "(", ")", "# convert params", "for", "url_arg_name", ...
path - str (urlencoded)
[ "path", "-", "str", "(", "urlencoded", ")" ]
train
https://github.com/SmartTeleMax/iktomi/blob/80bc0f1408d63efe7f5844367d1f6efba44b35f2/iktomi/web/url_templates.py#L111-L135
CivicSpleen/ambry
ambry/exporters/ckan/core.py
export
def export(bundle, force=False, force_restricted=False): """ Exports bundle to ckan instance. Args: bundle (ambry.bundle.Bundle): force (bool, optional): if True, ignore existance error and continue to export. force_restricted (bool, optional): if True, then export restricted bundles as...
python
def export(bundle, force=False, force_restricted=False): """ Exports bundle to ckan instance. Args: bundle (ambry.bundle.Bundle): force (bool, optional): if True, ignore existance error and continue to export. force_restricted (bool, optional): if True, then export restricted bundles as...
[ "def", "export", "(", "bundle", ",", "force", "=", "False", ",", "force_restricted", "=", "False", ")", ":", "if", "not", "ckan", ":", "raise", "EnvironmentError", "(", "MISSING_CREDENTIALS_MSG", ")", "# publish dataset.", "try", ":", "ckan", ".", "action", ...
Exports bundle to ckan instance. Args: bundle (ambry.bundle.Bundle): force (bool, optional): if True, ignore existance error and continue to export. force_restricted (bool, optional): if True, then export restricted bundles as private (for debugging purposes). Raises: ...
[ "Exports", "bundle", "to", "ckan", "instance", "." ]
train
https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/exporters/ckan/core.py#L50-L138
CivicSpleen/ambry
ambry/exporters/ckan/core.py
is_exported
def is_exported(bundle): """ Returns True if dataset is already exported to CKAN. Otherwise returns False. """ if not ckan: raise EnvironmentError(MISSING_CREDENTIALS_MSG) params = {'q': 'name:{}'.format(bundle.dataset.vid.lower())} resp = ckan.action.package_search(**params) return len(resp...
python
def is_exported(bundle): """ Returns True if dataset is already exported to CKAN. Otherwise returns False. """ if not ckan: raise EnvironmentError(MISSING_CREDENTIALS_MSG) params = {'q': 'name:{}'.format(bundle.dataset.vid.lower())} resp = ckan.action.package_search(**params) return len(resp...
[ "def", "is_exported", "(", "bundle", ")", ":", "if", "not", "ckan", ":", "raise", "EnvironmentError", "(", "MISSING_CREDENTIALS_MSG", ")", "params", "=", "{", "'q'", ":", "'name:{}'", ".", "format", "(", "bundle", ".", "dataset", ".", "vid", ".", "lower", ...
Returns True if dataset is already exported to CKAN. Otherwise returns False.
[ "Returns", "True", "if", "dataset", "is", "already", "exported", "to", "CKAN", ".", "Otherwise", "returns", "False", "." ]
train
https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/exporters/ckan/core.py#L141-L147
CivicSpleen/ambry
ambry/exporters/ckan/core.py
_convert_bundle
def _convert_bundle(bundle): """ Converts ambry bundle to dict ready to send to CKAN API. Args: bundle (ambry.bundle.Bundle): bundle to convert. Returns: dict: dict to send to CKAN to create dataset. See http://docs.ckan.org/en/latest/api/#ckan.logic.action.create.package_creat...
python
def _convert_bundle(bundle): """ Converts ambry bundle to dict ready to send to CKAN API. Args: bundle (ambry.bundle.Bundle): bundle to convert. Returns: dict: dict to send to CKAN to create dataset. See http://docs.ckan.org/en/latest/api/#ckan.logic.action.create.package_creat...
[ "def", "_convert_bundle", "(", "bundle", ")", ":", "# shortcut for metadata", "meta", "=", "bundle", ".", "dataset", ".", "config", ".", "metadata", "notes", "=", "''", "for", "f", "in", "bundle", ".", "dataset", ".", "files", ":", "if", "f", ".", "path"...
Converts ambry bundle to dict ready to send to CKAN API. Args: bundle (ambry.bundle.Bundle): bundle to convert. Returns: dict: dict to send to CKAN to create dataset. See http://docs.ckan.org/en/latest/api/#ckan.logic.action.create.package_create
[ "Converts", "ambry", "bundle", "to", "dict", "ready", "to", "send", "to", "CKAN", "API", "." ]
train
https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/exporters/ckan/core.py#L150-L188
CivicSpleen/ambry
ambry/exporters/ckan/core.py
_convert_partition
def _convert_partition(partition): """ Converts partition to resource dict ready to save to CKAN. """ # http://docs.ckan.org/en/latest/api/#ckan.logic.action.create.resource_create # convert bundle to csv. csvfile = six.StringIO() writer = unicodecsv.writer(csvfile) headers = partition.datafile...
python
def _convert_partition(partition): """ Converts partition to resource dict ready to save to CKAN. """ # http://docs.ckan.org/en/latest/api/#ckan.logic.action.create.resource_create # convert bundle to csv. csvfile = six.StringIO() writer = unicodecsv.writer(csvfile) headers = partition.datafile...
[ "def", "_convert_partition", "(", "partition", ")", ":", "# http://docs.ckan.org/en/latest/api/#ckan.logic.action.create.resource_create", "# convert bundle to csv.", "csvfile", "=", "six", ".", "StringIO", "(", ")", "writer", "=", "unicodecsv", ".", "writer", "(", "csvfile...
Converts partition to resource dict ready to save to CKAN.
[ "Converts", "partition", "to", "resource", "dict", "ready", "to", "save", "to", "CKAN", "." ]
train
https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/exporters/ckan/core.py#L191-L222
CivicSpleen/ambry
ambry/exporters/ckan/core.py
_convert_schema
def _convert_schema(bundle): """ Converts schema of the dataset to resource dict ready to save to CKAN. """ # http://docs.ckan.org/en/latest/api/#ckan.logic.action.create.resource_create schema_csv = None for f in bundle.dataset.files: if f.path.endswith('schema.csv'): contents = f.u...
python
def _convert_schema(bundle): """ Converts schema of the dataset to resource dict ready to save to CKAN. """ # http://docs.ckan.org/en/latest/api/#ckan.logic.action.create.resource_create schema_csv = None for f in bundle.dataset.files: if f.path.endswith('schema.csv'): contents = f.u...
[ "def", "_convert_schema", "(", "bundle", ")", ":", "# http://docs.ckan.org/en/latest/api/#ckan.logic.action.create.resource_create", "schema_csv", "=", "None", "for", "f", "in", "bundle", ".", "dataset", ".", "files", ":", "if", "f", ".", "path", ".", "endswith", "(...
Converts schema of the dataset to resource dict ready to save to CKAN.
[ "Converts", "schema", "of", "the", "dataset", "to", "resource", "dict", "ready", "to", "save", "to", "CKAN", "." ]
train
https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/exporters/ckan/core.py#L225-L249
CivicSpleen/ambry
ambry/exporters/ckan/core.py
_convert_external
def _convert_external(bundle, name, external): """ Converts external documentation to resource dict ready to save to CKAN. """ # http://docs.ckan.org/en/latest/api/#ckan.logic.action.create.resource_create ret = { 'package_id': bundle.dataset.vid.lower(), 'url': external.url, 'descri...
python
def _convert_external(bundle, name, external): """ Converts external documentation to resource dict ready to save to CKAN. """ # http://docs.ckan.org/en/latest/api/#ckan.logic.action.create.resource_create ret = { 'package_id': bundle.dataset.vid.lower(), 'url': external.url, 'descri...
[ "def", "_convert_external", "(", "bundle", ",", "name", ",", "external", ")", ":", "# http://docs.ckan.org/en/latest/api/#ckan.logic.action.create.resource_create", "ret", "=", "{", "'package_id'", ":", "bundle", ".", "dataset", ".", "vid", ".", "lower", "(", ")", "...
Converts external documentation to resource dict ready to save to CKAN.
[ "Converts", "external", "documentation", "to", "resource", "dict", "ready", "to", "save", "to", "CKAN", "." ]
train
https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/exporters/ckan/core.py#L252-L262
project-ncl/pnc-cli
pnc_cli/bpmbuildconfigurations.py
create_build_configuration_process
def create_build_configuration_process(repository, revision, **kwargs): """ Create a new BuildConfiguration. BuildConfigurations represent the settings and configuration required to run a build of a specific version of the associated Project's source code. If a ProductVersion ID is provided, the BuildConfig...
python
def create_build_configuration_process(repository, revision, **kwargs): """ Create a new BuildConfiguration. BuildConfigurations represent the settings and configuration required to run a build of a specific version of the associated Project's source code. If a ProductVersion ID is provided, the BuildConfig...
[ "def", "create_build_configuration_process", "(", "repository", ",", "revision", ",", "*", "*", "kwargs", ")", ":", "if", "not", "kwargs", ".", "get", "(", "\"dependency_ids\"", ")", ":", "kwargs", "[", "\"dependency_ids\"", "]", "=", "[", "]", "if", "not", ...
Create a new BuildConfiguration. BuildConfigurations represent the settings and configuration required to run a build of a specific version of the associated Project's source code. If a ProductVersion ID is provided, the BuildConfiguration will have access to artifacts which were produced for that version, but may ...
[ "Create", "a", "new", "BuildConfiguration", ".", "BuildConfigurations", "represent", "the", "settings", "and", "configuration", "required", "to", "run", "a", "build", "of", "a", "specific", "version", "of", "the", "associated", "Project", "s", "source", "code", ...
train
https://github.com/project-ncl/pnc-cli/blob/3dc149bf84928f60a8044ac50b58bbaddd451902/pnc_cli/bpmbuildconfigurations.py#L32-L62
project-ncl/pnc-cli
pnc_cli/bpmbuildconfigurations.py
create_repository_configuration
def create_repository_configuration(repository, no_sync=False): """ Create a new RepositoryConfiguration. If the provided repository URL is for external repository, it is cloned into internal one. :return BPM Task ID of the new RepositoryConfiguration creation """ repo = create_repository_configurat...
python
def create_repository_configuration(repository, no_sync=False): """ Create a new RepositoryConfiguration. If the provided repository URL is for external repository, it is cloned into internal one. :return BPM Task ID of the new RepositoryConfiguration creation """ repo = create_repository_configurat...
[ "def", "create_repository_configuration", "(", "repository", ",", "no_sync", "=", "False", ")", ":", "repo", "=", "create_repository_configuration_raw", "(", "repository", ",", "no_sync", ")", "if", "repo", ":", "return", "utils", ".", "format_json", "(", "repo", ...
Create a new RepositoryConfiguration. If the provided repository URL is for external repository, it is cloned into internal one. :return BPM Task ID of the new RepositoryConfiguration creation
[ "Create", "a", "new", "RepositoryConfiguration", ".", "If", "the", "provided", "repository", "URL", "is", "for", "external", "repository", "it", "is", "cloned", "into", "internal", "one", ".", ":", "return", "BPM", "Task", "ID", "of", "the", "new", "Reposito...
train
https://github.com/project-ncl/pnc-cli/blob/3dc149bf84928f60a8044ac50b58bbaddd451902/pnc_cli/bpmbuildconfigurations.py#L67-L74