partition
stringclasses
3 values
func_name
stringlengths
1
134
docstring
stringlengths
1
46.9k
path
stringlengths
4
223
original_string
stringlengths
75
104k
code
stringlengths
75
104k
docstring_tokens
listlengths
1
1.97k
repo
stringlengths
7
55
language
stringclasses
1 value
url
stringlengths
87
315
code_tokens
listlengths
19
28.4k
sha
stringlengths
40
40
test
Filesystem.parent
Return parent of *index*.
source/riffle/model.py
def parent(self, index): '''Return parent of *index*.''' if not index.isValid(): return QModelIndex() item = index.internalPointer() if not item: return QModelIndex() parent = item.parent if not parent or parent == self.root: return Q...
def parent(self, index): '''Return parent of *index*.''' if not index.isValid(): return QModelIndex() item = index.internalPointer() if not item: return QModelIndex() parent = item.parent if not parent or parent == self.root: return Q...
[ "Return", "parent", "of", "*", "index", "*", "." ]
4degrees/riffle
python
https://github.com/4degrees/riffle/blob/e5a0d908df8c93ff1ee7abdda8875fd1667df53d/source/riffle/model.py#L381-L394
[ "def", "parent", "(", "self", ",", "index", ")", ":", "if", "not", "index", ".", "isValid", "(", ")", ":", "return", "QModelIndex", "(", ")", "item", "=", "index", ".", "internalPointer", "(", ")", "if", "not", "item", ":", "return", "QModelIndex", "...
e5a0d908df8c93ff1ee7abdda8875fd1667df53d
test
Filesystem.data
Return data for *index* according to *role*.
source/riffle/model.py
def data(self, index, role): '''Return data for *index* according to *role*.''' if not index.isValid(): return None column = index.column() item = index.internalPointer() if role == self.ITEM_ROLE: return item elif role == Qt.DisplayRole: ...
def data(self, index, role): '''Return data for *index* according to *role*.''' if not index.isValid(): return None column = index.column() item = index.internalPointer() if role == self.ITEM_ROLE: return item elif role == Qt.DisplayRole: ...
[ "Return", "data", "for", "*", "index", "*", "according", "to", "*", "role", "*", "." ]
4degrees/riffle
python
https://github.com/4degrees/riffle/blob/e5a0d908df8c93ff1ee7abdda8875fd1667df53d/source/riffle/model.py#L404-L438
[ "def", "data", "(", "self", ",", "index", ",", "role", ")", ":", "if", "not", "index", ".", "isValid", "(", ")", ":", "return", "None", "column", "=", "index", ".", "column", "(", ")", "item", "=", "index", ".", "internalPointer", "(", ")", "if", ...
e5a0d908df8c93ff1ee7abdda8875fd1667df53d
test
Filesystem.headerData
Return label for *section* according to *orientation* and *role*.
source/riffle/model.py
def headerData(self, section, orientation, role): '''Return label for *section* according to *orientation* and *role*.''' if orientation == Qt.Horizontal: if section < len(self.columns): column = self.columns[section] if role == Qt.DisplayRole: ...
def headerData(self, section, orientation, role): '''Return label for *section* according to *orientation* and *role*.''' if orientation == Qt.Horizontal: if section < len(self.columns): column = self.columns[section] if role == Qt.DisplayRole: ...
[ "Return", "label", "for", "*", "section", "*", "according", "to", "*", "orientation", "*", "and", "*", "role", "*", "." ]
4degrees/riffle
python
https://github.com/4degrees/riffle/blob/e5a0d908df8c93ff1ee7abdda8875fd1667df53d/source/riffle/model.py#L440-L448
[ "def", "headerData", "(", "self", ",", "section", ",", "orientation", ",", "role", ")", ":", "if", "orientation", "==", "Qt", ".", "Horizontal", ":", "if", "section", "<", "len", "(", "self", ".", "columns", ")", ":", "column", "=", "self", ".", "col...
e5a0d908df8c93ff1ee7abdda8875fd1667df53d
test
Filesystem.hasChildren
Return if *index* has children. Optimised to avoid loading children at this stage.
source/riffle/model.py
def hasChildren(self, index): '''Return if *index* has children. Optimised to avoid loading children at this stage. ''' if not index.isValid(): item = self.root else: item = index.internalPointer() if not item: return False ...
def hasChildren(self, index): '''Return if *index* has children. Optimised to avoid loading children at this stage. ''' if not index.isValid(): item = self.root else: item = index.internalPointer() if not item: return False ...
[ "Return", "if", "*", "index", "*", "has", "children", "." ]
4degrees/riffle
python
https://github.com/4degrees/riffle/blob/e5a0d908df8c93ff1ee7abdda8875fd1667df53d/source/riffle/model.py#L450-L463
[ "def", "hasChildren", "(", "self", ",", "index", ")", ":", "if", "not", "index", ".", "isValid", "(", ")", ":", "item", "=", "self", ".", "root", "else", ":", "item", "=", "index", ".", "internalPointer", "(", ")", "if", "not", "item", ":", "return...
e5a0d908df8c93ff1ee7abdda8875fd1667df53d
test
Filesystem.canFetchMore
Return if more data available for *index*.
source/riffle/model.py
def canFetchMore(self, index): '''Return if more data available for *index*.''' if not index.isValid(): item = self.root else: item = index.internalPointer() return item.canFetchMore()
def canFetchMore(self, index): '''Return if more data available for *index*.''' if not index.isValid(): item = self.root else: item = index.internalPointer() return item.canFetchMore()
[ "Return", "if", "more", "data", "available", "for", "*", "index", "*", "." ]
4degrees/riffle
python
https://github.com/4degrees/riffle/blob/e5a0d908df8c93ff1ee7abdda8875fd1667df53d/source/riffle/model.py#L465-L472
[ "def", "canFetchMore", "(", "self", ",", "index", ")", ":", "if", "not", "index", ".", "isValid", "(", ")", ":", "item", "=", "self", ".", "root", "else", ":", "item", "=", "index", ".", "internalPointer", "(", ")", "return", "item", ".", "canFetchMo...
e5a0d908df8c93ff1ee7abdda8875fd1667df53d
test
Filesystem.fetchMore
Fetch additional data under *index*.
source/riffle/model.py
def fetchMore(self, index): '''Fetch additional data under *index*.''' if not index.isValid(): item = self.root else: item = index.internalPointer() if item.canFetchMore(): startIndex = len(item.children) additionalChildren = item.fetchChi...
def fetchMore(self, index): '''Fetch additional data under *index*.''' if not index.isValid(): item = self.root else: item = index.internalPointer() if item.canFetchMore(): startIndex = len(item.children) additionalChildren = item.fetchChi...
[ "Fetch", "additional", "data", "under", "*", "index", "*", "." ]
4degrees/riffle
python
https://github.com/4degrees/riffle/blob/e5a0d908df8c93ff1ee7abdda8875fd1667df53d/source/riffle/model.py#L474-L489
[ "def", "fetchMore", "(", "self", ",", "index", ")", ":", "if", "not", "index", ".", "isValid", "(", ")", ":", "item", "=", "self", ".", "root", "else", ":", "item", "=", "index", ".", "internalPointer", "(", ")", "if", "item", ".", "canFetchMore", ...
e5a0d908df8c93ff1ee7abdda8875fd1667df53d
test
FilesystemSortProxy.lessThan
Return ordering of *left* vs *right*.
source/riffle/model.py
def lessThan(self, left, right): '''Return ordering of *left* vs *right*.''' sourceModel = self.sourceModel() if sourceModel: leftItem = sourceModel.item(left) rightItem = sourceModel.item(right) if (isinstance(leftItem, Directory) and not isi...
def lessThan(self, left, right): '''Return ordering of *left* vs *right*.''' sourceModel = self.sourceModel() if sourceModel: leftItem = sourceModel.item(left) rightItem = sourceModel.item(right) if (isinstance(leftItem, Directory) and not isi...
[ "Return", "ordering", "of", "*", "left", "*", "vs", "*", "right", "*", "." ]
4degrees/riffle
python
https://github.com/4degrees/riffle/blob/e5a0d908df8c93ff1ee7abdda8875fd1667df53d/source/riffle/model.py#L501-L516
[ "def", "lessThan", "(", "self", ",", "left", ",", "right", ")", ":", "sourceModel", "=", "self", ".", "sourceModel", "(", ")", "if", "sourceModel", ":", "leftItem", "=", "sourceModel", ".", "item", "(", "left", ")", "rightItem", "=", "sourceModel", ".", ...
e5a0d908df8c93ff1ee7abdda8875fd1667df53d
test
FilesystemSortProxy.pathIndex
Return index of item with *path*.
source/riffle/model.py
def pathIndex(self, path): '''Return index of item with *path*.''' sourceModel = self.sourceModel() if not sourceModel: return QModelIndex() return self.mapFromSource(sourceModel.pathIndex(path))
def pathIndex(self, path): '''Return index of item with *path*.''' sourceModel = self.sourceModel() if not sourceModel: return QModelIndex() return self.mapFromSource(sourceModel.pathIndex(path))
[ "Return", "index", "of", "item", "with", "*", "path", "*", "." ]
4degrees/riffle
python
https://github.com/4degrees/riffle/blob/e5a0d908df8c93ff1ee7abdda8875fd1667df53d/source/riffle/model.py#L536-L542
[ "def", "pathIndex", "(", "self", ",", "path", ")", ":", "sourceModel", "=", "self", ".", "sourceModel", "(", ")", "if", "not", "sourceModel", ":", "return", "QModelIndex", "(", ")", "return", "self", ".", "mapFromSource", "(", "sourceModel", ".", "pathInde...
e5a0d908df8c93ff1ee7abdda8875fd1667df53d
test
FilesystemSortProxy.item
Return item at *index*.
source/riffle/model.py
def item(self, index): '''Return item at *index*.''' sourceModel = self.sourceModel() if not sourceModel: return None return sourceModel.item(self.mapToSource(index))
def item(self, index): '''Return item at *index*.''' sourceModel = self.sourceModel() if not sourceModel: return None return sourceModel.item(self.mapToSource(index))
[ "Return", "item", "at", "*", "index", "*", "." ]
4degrees/riffle
python
https://github.com/4degrees/riffle/blob/e5a0d908df8c93ff1ee7abdda8875fd1667df53d/source/riffle/model.py#L544-L551
[ "def", "item", "(", "self", ",", "index", ")", ":", "sourceModel", "=", "self", ".", "sourceModel", "(", ")", "if", "not", "sourceModel", ":", "return", "None", "return", "sourceModel", ".", "item", "(", "self", ".", "mapToSource", "(", "index", ")", "...
e5a0d908df8c93ff1ee7abdda8875fd1667df53d
test
FilesystemSortProxy.icon
Return icon for index.
source/riffle/model.py
def icon(self, index): '''Return icon for index.''' sourceModel = self.sourceModel() if not sourceModel: return None return sourceModel.icon(self.mapToSource(index))
def icon(self, index): '''Return icon for index.''' sourceModel = self.sourceModel() if not sourceModel: return None return sourceModel.icon(self.mapToSource(index))
[ "Return", "icon", "for", "index", "." ]
4degrees/riffle
python
https://github.com/4degrees/riffle/blob/e5a0d908df8c93ff1ee7abdda8875fd1667df53d/source/riffle/model.py#L553-L559
[ "def", "icon", "(", "self", ",", "index", ")", ":", "sourceModel", "=", "self", ".", "sourceModel", "(", ")", "if", "not", "sourceModel", ":", "return", "None", "return", "sourceModel", ".", "icon", "(", "self", ".", "mapToSource", "(", "index", ")", "...
e5a0d908df8c93ff1ee7abdda8875fd1667df53d
test
FilesystemSortProxy.hasChildren
Return if *index* has children.
source/riffle/model.py
def hasChildren(self, index): '''Return if *index* has children.''' sourceModel = self.sourceModel() if not sourceModel: return False return sourceModel.hasChildren(self.mapToSource(index))
def hasChildren(self, index): '''Return if *index* has children.''' sourceModel = self.sourceModel() if not sourceModel: return False return sourceModel.hasChildren(self.mapToSource(index))
[ "Return", "if", "*", "index", "*", "has", "children", "." ]
4degrees/riffle
python
https://github.com/4degrees/riffle/blob/e5a0d908df8c93ff1ee7abdda8875fd1667df53d/source/riffle/model.py#L561-L568
[ "def", "hasChildren", "(", "self", ",", "index", ")", ":", "sourceModel", "=", "self", ".", "sourceModel", "(", ")", "if", "not", "sourceModel", ":", "return", "False", "return", "sourceModel", ".", "hasChildren", "(", "self", ".", "mapToSource", "(", "ind...
e5a0d908df8c93ff1ee7abdda8875fd1667df53d
test
FilesystemSortProxy.canFetchMore
Return if more data available for *index*.
source/riffle/model.py
def canFetchMore(self, index): '''Return if more data available for *index*.''' sourceModel = self.sourceModel() if not sourceModel: return False return sourceModel.canFetchMore(self.mapToSource(index))
def canFetchMore(self, index): '''Return if more data available for *index*.''' sourceModel = self.sourceModel() if not sourceModel: return False return sourceModel.canFetchMore(self.mapToSource(index))
[ "Return", "if", "more", "data", "available", "for", "*", "index", "*", "." ]
4degrees/riffle
python
https://github.com/4degrees/riffle/blob/e5a0d908df8c93ff1ee7abdda8875fd1667df53d/source/riffle/model.py#L570-L577
[ "def", "canFetchMore", "(", "self", ",", "index", ")", ":", "sourceModel", "=", "self", ".", "sourceModel", "(", ")", "if", "not", "sourceModel", ":", "return", "False", "return", "sourceModel", ".", "canFetchMore", "(", "self", ".", "mapToSource", "(", "i...
e5a0d908df8c93ff1ee7abdda8875fd1667df53d
test
FilesystemSortProxy.fetchMore
Fetch additional data under *index*.
source/riffle/model.py
def fetchMore(self, index): '''Fetch additional data under *index*.''' sourceModel = self.sourceModel() if not sourceModel: return False return sourceModel.fetchMore(self.mapToSource(index))
def fetchMore(self, index): '''Fetch additional data under *index*.''' sourceModel = self.sourceModel() if not sourceModel: return False return sourceModel.fetchMore(self.mapToSource(index))
[ "Fetch", "additional", "data", "under", "*", "index", "*", "." ]
4degrees/riffle
python
https://github.com/4degrees/riffle/blob/e5a0d908df8c93ff1ee7abdda8875fd1667df53d/source/riffle/model.py#L579-L586
[ "def", "fetchMore", "(", "self", ",", "index", ")", ":", "sourceModel", "=", "self", ".", "sourceModel", "(", ")", "if", "not", "sourceModel", ":", "return", "False", "return", "sourceModel", ".", "fetchMore", "(", "self", ".", "mapToSource", "(", "index",...
e5a0d908df8c93ff1ee7abdda8875fd1667df53d
test
IconFactory.icon
Return appropriate icon for *specification*. *specification* should be either: * An instance of :py:class:`riffle.model.Item` * One of the defined icon types (:py:class:`IconType`)
source/riffle/icon_factory.py
def icon(self, specification): '''Return appropriate icon for *specification*. *specification* should be either: * An instance of :py:class:`riffle.model.Item` * One of the defined icon types (:py:class:`IconType`) ''' if isinstance(specification, riffle.model....
def icon(self, specification): '''Return appropriate icon for *specification*. *specification* should be either: * An instance of :py:class:`riffle.model.Item` * One of the defined icon types (:py:class:`IconType`) ''' if isinstance(specification, riffle.model....
[ "Return", "appropriate", "icon", "for", "*", "specification", "*", "." ]
4degrees/riffle
python
https://github.com/4degrees/riffle/blob/e5a0d908df8c93ff1ee7abdda8875fd1667df53d/source/riffle/icon_factory.py#L25-L54
[ "def", "icon", "(", "self", ",", "specification", ")", ":", "if", "isinstance", "(", "specification", ",", "riffle", ".", "model", ".", "Item", ")", ":", "specification", "=", "self", ".", "type", "(", "specification", ")", "icon", "=", "None", "if", "...
e5a0d908df8c93ff1ee7abdda8875fd1667df53d
test
IconFactory.type
Return appropriate icon type for *item*.
source/riffle/icon_factory.py
def type(self, item): '''Return appropriate icon type for *item*.''' iconType = IconType.Unknown if isinstance(item, riffle.model.Computer): iconType = IconType.Computer elif isinstance(item, riffle.model.Mount): iconType = IconType.Mount elif isinstanc...
def type(self, item): '''Return appropriate icon type for *item*.''' iconType = IconType.Unknown if isinstance(item, riffle.model.Computer): iconType = IconType.Computer elif isinstance(item, riffle.model.Mount): iconType = IconType.Mount elif isinstanc...
[ "Return", "appropriate", "icon", "type", "for", "*", "item", "*", "." ]
4degrees/riffle
python
https://github.com/4degrees/riffle/blob/e5a0d908df8c93ff1ee7abdda8875fd1667df53d/source/riffle/icon_factory.py#L56-L75
[ "def", "type", "(", "self", ",", "item", ")", ":", "iconType", "=", "IconType", ".", "Unknown", "if", "isinstance", "(", "item", ",", "riffle", ".", "model", ".", "Computer", ")", ":", "iconType", "=", "IconType", ".", "Computer", "elif", "isinstance", ...
e5a0d908df8c93ff1ee7abdda8875fd1667df53d
test
call
Run an external command in a separate process and detach it from the current process. Excepting `stdout`, `stderr`, and `stdin` all file descriptors are closed after forking. If `daemonize` is True then the parent process exits. All stdio is redirected to `os.devnull` unless specified. The `preexec_fn`, `sh...
detach.py
def call(args, stdout=None, stderr=None, stdin=None, daemonize=False, preexec_fn=None, shell=False, cwd=None, env=None): """ Run an external command in a separate process and detach it from the current process. Excepting `stdout`, `stderr`, and `stdin` all file descriptors are closed after forking....
def call(args, stdout=None, stderr=None, stdin=None, daemonize=False, preexec_fn=None, shell=False, cwd=None, env=None): """ Run an external command in a separate process and detach it from the current process. Excepting `stdout`, `stderr`, and `stdin` all file descriptors are closed after forking....
[ "Run", "an", "external", "command", "in", "a", "separate", "process", "and", "detach", "it", "from", "the", "current", "process", ".", "Excepting", "stdout", "stderr", "and", "stdin", "all", "file", "descriptors", "are", "closed", "after", "forking", ".", "I...
BlueDragonX/detach
python
https://github.com/BlueDragonX/detach/blob/e2e5a1076e19f508baf3ffb2b586a75934fbae28/detach.py#L107-L135
[ "def", "call", "(", "args", ",", "stdout", "=", "None", ",", "stderr", "=", "None", ",", "stdin", "=", "None", ",", "daemonize", "=", "False", ",", "preexec_fn", "=", "None", ",", "shell", "=", "False", ",", "cwd", "=", "None", ",", "env", "=", "...
e2e5a1076e19f508baf3ffb2b586a75934fbae28
test
Detach._get_max_fd
Return the maximum file descriptor value.
detach.py
def _get_max_fd(self): """Return the maximum file descriptor value.""" limits = resource.getrlimit(resource.RLIMIT_NOFILE) result = limits[1] if result == resource.RLIM_INFINITY: result = maxfd return result
def _get_max_fd(self): """Return the maximum file descriptor value.""" limits = resource.getrlimit(resource.RLIMIT_NOFILE) result = limits[1] if result == resource.RLIM_INFINITY: result = maxfd return result
[ "Return", "the", "maximum", "file", "descriptor", "value", "." ]
BlueDragonX/detach
python
https://github.com/BlueDragonX/detach/blob/e2e5a1076e19f508baf3ffb2b586a75934fbae28/detach.py#L42-L48
[ "def", "_get_max_fd", "(", "self", ")", ":", "limits", "=", "resource", ".", "getrlimit", "(", "resource", ".", "RLIMIT_NOFILE", ")", "result", "=", "limits", "[", "1", "]", "if", "result", "==", "resource", ".", "RLIM_INFINITY", ":", "result", "=", "max...
e2e5a1076e19f508baf3ffb2b586a75934fbae28
test
Detach._close_fd
Close a file descriptor if it is open.
detach.py
def _close_fd(self, fd): """Close a file descriptor if it is open.""" try: os.close(fd) except OSError, exc: if exc.errno != errno.EBADF: msg = "Failed to close file descriptor {}: {}".format(fd, exc) raise Error(msg)
def _close_fd(self, fd): """Close a file descriptor if it is open.""" try: os.close(fd) except OSError, exc: if exc.errno != errno.EBADF: msg = "Failed to close file descriptor {}: {}".format(fd, exc) raise Error(msg)
[ "Close", "a", "file", "descriptor", "if", "it", "is", "open", "." ]
BlueDragonX/detach
python
https://github.com/BlueDragonX/detach/blob/e2e5a1076e19f508baf3ffb2b586a75934fbae28/detach.py#L50-L57
[ "def", "_close_fd", "(", "self", ",", "fd", ")", ":", "try", ":", "os", ".", "close", "(", "fd", ")", "except", "OSError", ",", "exc", ":", "if", "exc", ".", "errno", "!=", "errno", ".", "EBADF", ":", "msg", "=", "\"Failed to close file descriptor {}: ...
e2e5a1076e19f508baf3ffb2b586a75934fbae28
test
Detach._close_open_fds
Close open file descriptors.
detach.py
def _close_open_fds(self): """Close open file descriptors.""" maxfd = self._get_max_fd() for fd in reversed(range(maxfd)): if fd not in self.exclude_fds: self._close_fd(fd)
def _close_open_fds(self): """Close open file descriptors.""" maxfd = self._get_max_fd() for fd in reversed(range(maxfd)): if fd not in self.exclude_fds: self._close_fd(fd)
[ "Close", "open", "file", "descriptors", "." ]
BlueDragonX/detach
python
https://github.com/BlueDragonX/detach/blob/e2e5a1076e19f508baf3ffb2b586a75934fbae28/detach.py#L59-L64
[ "def", "_close_open_fds", "(", "self", ")", ":", "maxfd", "=", "self", ".", "_get_max_fd", "(", ")", "for", "fd", "in", "reversed", "(", "range", "(", "maxfd", ")", ")", ":", "if", "fd", "not", "in", "self", ".", "exclude_fds", ":", "self", ".", "_...
e2e5a1076e19f508baf3ffb2b586a75934fbae28
test
Detach._redirect
Redirect a system stream to the provided target.
detach.py
def _redirect(self, stream, target): """Redirect a system stream to the provided target.""" if target is None: target_fd = os.open(os.devnull, os.O_RDWR) else: target_fd = target.fileno() os.dup2(target_fd, stream.fileno())
def _redirect(self, stream, target): """Redirect a system stream to the provided target.""" if target is None: target_fd = os.open(os.devnull, os.O_RDWR) else: target_fd = target.fileno() os.dup2(target_fd, stream.fileno())
[ "Redirect", "a", "system", "stream", "to", "the", "provided", "target", "." ]
BlueDragonX/detach
python
https://github.com/BlueDragonX/detach/blob/e2e5a1076e19f508baf3ffb2b586a75934fbae28/detach.py#L66-L72
[ "def", "_redirect", "(", "self", ",", "stream", ",", "target", ")", ":", "if", "target", "is", "None", ":", "target_fd", "=", "os", ".", "open", "(", "os", ".", "devnull", ",", "os", ".", "O_RDWR", ")", "else", ":", "target_fd", "=", "target", ".",...
e2e5a1076e19f508baf3ffb2b586a75934fbae28
test
set_form_widgets_attrs
Applies a given HTML attributes to each field widget of a given form. Example: set_form_widgets_attrs(my_form, {'class': 'clickable'})
etc/toolbox.py
def set_form_widgets_attrs(form, attrs): """Applies a given HTML attributes to each field widget of a given form. Example: set_form_widgets_attrs(my_form, {'class': 'clickable'}) """ for _, field in form.fields.items(): attrs_ = dict(attrs) for name, val in attrs.items(): ...
def set_form_widgets_attrs(form, attrs): """Applies a given HTML attributes to each field widget of a given form. Example: set_form_widgets_attrs(my_form, {'class': 'clickable'}) """ for _, field in form.fields.items(): attrs_ = dict(attrs) for name, val in attrs.items(): ...
[ "Applies", "a", "given", "HTML", "attributes", "to", "each", "field", "widget", "of", "a", "given", "form", "." ]
idlesign/django-etc
python
https://github.com/idlesign/django-etc/blob/dbfc7e9dfc4fdfe69547f71ba4921989f9e97dbe/etc/toolbox.py#L74-L87
[ "def", "set_form_widgets_attrs", "(", "form", ",", "attrs", ")", ":", "for", "_", ",", "field", "in", "form", ".", "fields", ".", "items", "(", ")", ":", "attrs_", "=", "dict", "(", "attrs", ")", "for", "name", ",", "val", "in", "attrs", ".", "item...
dbfc7e9dfc4fdfe69547f71ba4921989f9e97dbe
test
get_model_class_from_string
Returns a certain model as defined in a string formatted `<app_name>.<model_name>`. Example: model = get_model_class_from_string('myapp.MyModel')
etc/toolbox.py
def get_model_class_from_string(model_path): """Returns a certain model as defined in a string formatted `<app_name>.<model_name>`. Example: model = get_model_class_from_string('myapp.MyModel') """ try: app_name, model_name = model_path.split('.') except ValueError: raise ...
def get_model_class_from_string(model_path): """Returns a certain model as defined in a string formatted `<app_name>.<model_name>`. Example: model = get_model_class_from_string('myapp.MyModel') """ try: app_name, model_name = model_path.split('.') except ValueError: raise ...
[ "Returns", "a", "certain", "model", "as", "defined", "in", "a", "string", "formatted", "<app_name", ">", ".", "<model_name", ">", "." ]
idlesign/django-etc
python
https://github.com/idlesign/django-etc/blob/dbfc7e9dfc4fdfe69547f71ba4921989f9e97dbe/etc/toolbox.py#L90-L114
[ "def", "get_model_class_from_string", "(", "model_path", ")", ":", "try", ":", "app_name", ",", "model_name", "=", "model_path", ".", "split", "(", "'.'", ")", "except", "ValueError", ":", "raise", "ImproperlyConfigured", "(", "'`%s` must have the following format: `a...
dbfc7e9dfc4fdfe69547f71ba4921989f9e97dbe
test
get_site_url
Tries to get a site URL from environment and settings in the following order: 1. (SITE_PROTO / SITE_SCHEME) + SITE_DOMAIN 2. SITE_URL 3. Django Sites contrib 4. Request object :param HttpRequest request: Request object to deduce URL from. :rtype: str
etc/toolbox.py
def get_site_url(request=None): """Tries to get a site URL from environment and settings in the following order: 1. (SITE_PROTO / SITE_SCHEME) + SITE_DOMAIN 2. SITE_URL 3. Django Sites contrib 4. Request object :param HttpRequest request: Request object to deduce URL from. :rtype: str ...
def get_site_url(request=None): """Tries to get a site URL from environment and settings in the following order: 1. (SITE_PROTO / SITE_SCHEME) + SITE_DOMAIN 2. SITE_URL 3. Django Sites contrib 4. Request object :param HttpRequest request: Request object to deduce URL from. :rtype: str ...
[ "Tries", "to", "get", "a", "site", "URL", "from", "environment", "and", "settings", "in", "the", "following", "order", ":" ]
idlesign/django-etc
python
https://github.com/idlesign/django-etc/blob/dbfc7e9dfc4fdfe69547f71ba4921989f9e97dbe/etc/toolbox.py#L139-L187
[ "def", "get_site_url", "(", "request", "=", "None", ")", ":", "env", "=", "partial", "(", "environ", ".", "get", ")", "settings_", "=", "partial", "(", "getattr", ",", "settings", ")", "domain", "=", "None", "scheme", "=", "None", "url", "=", "None", ...
dbfc7e9dfc4fdfe69547f71ba4921989f9e97dbe
test
import_app_module
Returns a module from a given app by its name. :param str app_name: :param str module_name: :rtype: module or None
etc/toolbox.py
def import_app_module(app_name, module_name): """Returns a module from a given app by its name. :param str app_name: :param str module_name: :rtype: module or None """ name_split = app_name.split('.') if name_split[-1][0].isupper(): # Seems that we have app config class path here. ...
def import_app_module(app_name, module_name): """Returns a module from a given app by its name. :param str app_name: :param str module_name: :rtype: module or None """ name_split = app_name.split('.') if name_split[-1][0].isupper(): # Seems that we have app config class path here. ...
[ "Returns", "a", "module", "from", "a", "given", "app", "by", "its", "name", "." ]
idlesign/django-etc
python
https://github.com/idlesign/django-etc/blob/dbfc7e9dfc4fdfe69547f71ba4921989f9e97dbe/etc/toolbox.py#L190-L214
[ "def", "import_app_module", "(", "app_name", ",", "module_name", ")", ":", "name_split", "=", "app_name", ".", "split", "(", "'.'", ")", "if", "name_split", "[", "-", "1", "]", "[", "0", "]", ".", "isupper", "(", ")", ":", "# Seems that we have app config ...
dbfc7e9dfc4fdfe69547f71ba4921989f9e97dbe
test
import_project_modules
Imports modules from registered apps using given module name and returns them as a list. :param str module_name: :rtype: list
etc/toolbox.py
def import_project_modules(module_name): """Imports modules from registered apps using given module name and returns them as a list. :param str module_name: :rtype: list """ from django.conf import settings submodules = [] for app in settings.INSTALLED_APPS: module = import_ap...
def import_project_modules(module_name): """Imports modules from registered apps using given module name and returns them as a list. :param str module_name: :rtype: list """ from django.conf import settings submodules = [] for app in settings.INSTALLED_APPS: module = import_ap...
[ "Imports", "modules", "from", "registered", "apps", "using", "given", "module", "name", "and", "returns", "them", "as", "a", "list", "." ]
idlesign/django-etc
python
https://github.com/idlesign/django-etc/blob/dbfc7e9dfc4fdfe69547f71ba4921989f9e97dbe/etc/toolbox.py#L217-L233
[ "def", "import_project_modules", "(", "module_name", ")", ":", "from", "django", ".", "conf", "import", "settings", "submodules", "=", "[", "]", "for", "app", "in", "settings", ".", "INSTALLED_APPS", ":", "module", "=", "import_app_module", "(", "app", ",", ...
dbfc7e9dfc4fdfe69547f71ba4921989f9e97dbe
test
include_
Similar to built-in ``include`` template tag, but allowing template variables to be used in template name and a fallback template, thus making the tag more dynamic. .. warning:: Requires Django 1.8+ Example: {% load etc_misc %} {% include_ "sub_{{ postfix_var }}.html" fallback "defaul...
etc/templatetags/etc_misc.py
def include_(parser, token): """Similar to built-in ``include`` template tag, but allowing template variables to be used in template name and a fallback template, thus making the tag more dynamic. .. warning:: Requires Django 1.8+ Example: {% load etc_misc %} {% include_ "sub_{{ p...
def include_(parser, token): """Similar to built-in ``include`` template tag, but allowing template variables to be used in template name and a fallback template, thus making the tag more dynamic. .. warning:: Requires Django 1.8+ Example: {% load etc_misc %} {% include_ "sub_{{ p...
[ "Similar", "to", "built", "-", "in", "include", "template", "tag", "but", "allowing", "template", "variables", "to", "be", "used", "in", "template", "name", "and", "a", "fallback", "template", "thus", "making", "the", "tag", "more", "dynamic", "." ]
idlesign/django-etc
python
https://github.com/idlesign/django-etc/blob/dbfc7e9dfc4fdfe69547f71ba4921989f9e97dbe/etc/templatetags/etc_misc.py#L105-L160
[ "def", "include_", "(", "parser", ",", "token", ")", ":", "bits", "=", "token", ".", "split_contents", "(", ")", "dynamic", "=", "False", "# We fallback to built-in `include` if a template name contains no variables.", "if", "len", "(", "bits", ")", ">=", "2", ":"...
dbfc7e9dfc4fdfe69547f71ba4921989f9e97dbe
test
RepoCollection.repositories
Return a list of all repository objects in the repofiles in the repo folder specified :return:
pyum/repo.py
def repositories(self): """ Return a list of all repository objects in the repofiles in the repo folder specified :return: """ for repo_path in self.path.glob('*.repo'): for id, repository in self._get_repo_file(repo_path).repositories: yield id, repos...
def repositories(self): """ Return a list of all repository objects in the repofiles in the repo folder specified :return: """ for repo_path in self.path.glob('*.repo'): for id, repository in self._get_repo_file(repo_path).repositories: yield id, repos...
[ "Return", "a", "list", "of", "all", "repository", "objects", "in", "the", "repofiles", "in", "the", "repo", "folder", "specified", ":", "return", ":" ]
drewsonne/pyum
python
https://github.com/drewsonne/pyum/blob/5d2955f86575c9430ab7104211b3d67bd4c0febe/pyum/repo.py#L16-L23
[ "def", "repositories", "(", "self", ")", ":", "for", "repo_path", "in", "self", ".", "path", ".", "glob", "(", "'*.repo'", ")", ":", "for", "id", ",", "repository", "in", "self", ".", "_get_repo_file", "(", "repo_path", ")", ".", "repositories", ":", "...
5d2955f86575c9430ab7104211b3d67bd4c0febe
test
RepoCollection._get_repo_file
Lazy load RepoFile objects on demand. :param repo_path: :return:
pyum/repo.py
def _get_repo_file(self, repo_path): """ Lazy load RepoFile objects on demand. :param repo_path: :return: """ if repo_path not in self._repo_files: self._repo_files[repo_path] = RepoFile(repo_path) return self._repo_files[repo_path]
def _get_repo_file(self, repo_path): """ Lazy load RepoFile objects on demand. :param repo_path: :return: """ if repo_path not in self._repo_files: self._repo_files[repo_path] = RepoFile(repo_path) return self._repo_files[repo_path]
[ "Lazy", "load", "RepoFile", "objects", "on", "demand", ".", ":", "param", "repo_path", ":", ":", "return", ":" ]
drewsonne/pyum
python
https://github.com/drewsonne/pyum/blob/5d2955f86575c9430ab7104211b3d67bd4c0febe/pyum/repo.py#L25-L33
[ "def", "_get_repo_file", "(", "self", ",", "repo_path", ")", ":", "if", "repo_path", "not", "in", "self", ".", "_repo_files", ":", "self", ".", "_repo_files", "[", "repo_path", "]", "=", "RepoFile", "(", "repo_path", ")", "return", "self", ".", "_repo_file...
5d2955f86575c9430ab7104211b3d67bd4c0febe
test
Package.from_url
Given a URL, return a package :param url: :return:
pyum/rpm.py
def from_url(url): """ Given a URL, return a package :param url: :return: """ package_data = HTTPClient().http_request(url=url, decode=None) return Package(raw_data=package_data)
def from_url(url): """ Given a URL, return a package :param url: :return: """ package_data = HTTPClient().http_request(url=url, decode=None) return Package(raw_data=package_data)
[ "Given", "a", "URL", "return", "a", "package", ":", "param", "url", ":", ":", "return", ":" ]
drewsonne/pyum
python
https://github.com/drewsonne/pyum/blob/5d2955f86575c9430ab7104211b3d67bd4c0febe/pyum/rpm.py#L101-L108
[ "def", "from_url", "(", "url", ")", ":", "package_data", "=", "HTTPClient", "(", ")", ".", "http_request", "(", "url", "=", "url", ",", "decode", "=", "None", ")", "return", "Package", "(", "raw_data", "=", "package_data", ")" ]
5d2955f86575c9430ab7104211b3d67bd4c0febe
test
Package.dependencies
Read the contents of the rpm itself :return:
pyum/rpm.py
def dependencies(self): """ Read the contents of the rpm itself :return: """ cpio = self.rpm.gzip_file.read() content = cpio.read() return []
def dependencies(self): """ Read the contents of the rpm itself :return: """ cpio = self.rpm.gzip_file.read() content = cpio.read() return []
[ "Read", "the", "contents", "of", "the", "rpm", "itself", ":", "return", ":" ]
drewsonne/pyum
python
https://github.com/drewsonne/pyum/blob/5d2955f86575c9430ab7104211b3d67bd4c0febe/pyum/rpm.py#L126-L133
[ "def", "dependencies", "(", "self", ")", ":", "cpio", "=", "self", ".", "rpm", ".", "gzip_file", ".", "read", "(", ")", "content", "=", "cpio", ".", "read", "(", ")", "return", "[", "]" ]
5d2955f86575c9430ab7104211b3d67bd4c0febe
test
gravatar_get_url
Returns Gravatar image URL for a given string or UserModel. Example: {% load gravatar %} {% gravatar_get_url user_model %} :param UserModel, str obj: :param int size: :param str default: :return:
etc/templatetags/gravatar.py
def gravatar_get_url(obj, size=65, default='identicon'): """Returns Gravatar image URL for a given string or UserModel. Example: {% load gravatar %} {% gravatar_get_url user_model %} :param UserModel, str obj: :param int size: :param str default: :return: """ return ge...
def gravatar_get_url(obj, size=65, default='identicon'): """Returns Gravatar image URL for a given string or UserModel. Example: {% load gravatar %} {% gravatar_get_url user_model %} :param UserModel, str obj: :param int size: :param str default: :return: """ return ge...
[ "Returns", "Gravatar", "image", "URL", "for", "a", "given", "string", "or", "UserModel", "." ]
idlesign/django-etc
python
https://github.com/idlesign/django-etc/blob/dbfc7e9dfc4fdfe69547f71ba4921989f9e97dbe/etc/templatetags/gravatar.py#L39-L52
[ "def", "gravatar_get_url", "(", "obj", ",", "size", "=", "65", ",", "default", "=", "'identicon'", ")", ":", "return", "get_gravatar_url", "(", "obj", ",", "size", "=", "size", ",", "default", "=", "default", ")" ]
dbfc7e9dfc4fdfe69547f71ba4921989f9e97dbe
test
gravatar_get_img
Returns Gravatar image HTML tag for a given string or UserModel. Example: {% load gravatar %} {% gravatar_get_img user_model %} :param UserModel, str obj: :param int size: :param str default: :return:
etc/templatetags/gravatar.py
def gravatar_get_img(obj, size=65, default='identicon'): """Returns Gravatar image HTML tag for a given string or UserModel. Example: {% load gravatar %} {% gravatar_get_img user_model %} :param UserModel, str obj: :param int size: :param str default: :return: """ url ...
def gravatar_get_img(obj, size=65, default='identicon'): """Returns Gravatar image HTML tag for a given string or UserModel. Example: {% load gravatar %} {% gravatar_get_img user_model %} :param UserModel, str obj: :param int size: :param str default: :return: """ url ...
[ "Returns", "Gravatar", "image", "HTML", "tag", "for", "a", "given", "string", "or", "UserModel", "." ]
idlesign/django-etc
python
https://github.com/idlesign/django-etc/blob/dbfc7e9dfc4fdfe69547f71ba4921989f9e97dbe/etc/templatetags/gravatar.py#L56-L72
[ "def", "gravatar_get_img", "(", "obj", ",", "size", "=", "65", ",", "default", "=", "'identicon'", ")", ":", "url", "=", "get_gravatar_url", "(", "obj", ",", "size", "=", "size", ",", "default", "=", "default", ")", "if", "url", ":", "return", "safe", ...
dbfc7e9dfc4fdfe69547f71ba4921989f9e97dbe
test
Data.parse
Parses an xml_path with the inherited xml parser :param xml_path: :return:
pyum/repometadata/base.py
def parse(cls, xml_path): """ Parses an xml_path with the inherited xml parser :param xml_path: :return: """ parser = etree.XMLParser(target=cls.xml_parse()) return etree.parse(xml_path, parser)
def parse(cls, xml_path): """ Parses an xml_path with the inherited xml parser :param xml_path: :return: """ parser = etree.XMLParser(target=cls.xml_parse()) return etree.parse(xml_path, parser)
[ "Parses", "an", "xml_path", "with", "the", "inherited", "xml", "parser", ":", "param", "xml_path", ":", ":", "return", ":" ]
drewsonne/pyum
python
https://github.com/drewsonne/pyum/blob/5d2955f86575c9430ab7104211b3d67bd4c0febe/pyum/repometadata/base.py#L20-L27
[ "def", "parse", "(", "cls", ",", "xml_path", ")", ":", "parser", "=", "etree", ".", "XMLParser", "(", "target", "=", "cls", ".", "xml_parse", "(", ")", ")", "return", "etree", ".", "parse", "(", "xml_path", ",", "parser", ")" ]
5d2955f86575c9430ab7104211b3d67bd4c0febe
test
Data.load
Load the repo database from the remote source, and then parse it. :return:
pyum/repometadata/base.py
def load(self): """ Load the repo database from the remote source, and then parse it. :return: """ data = self.http_request(self.location()) self._parse(data) return self
def load(self): """ Load the repo database from the remote source, and then parse it. :return: """ data = self.http_request(self.location()) self._parse(data) return self
[ "Load", "the", "repo", "database", "from", "the", "remote", "source", "and", "then", "parse", "it", ".", ":", "return", ":" ]
drewsonne/pyum
python
https://github.com/drewsonne/pyum/blob/5d2955f86575c9430ab7104211b3d67bd4c0febe/pyum/repometadata/base.py#L64-L71
[ "def", "load", "(", "self", ")", ":", "data", "=", "self", ".", "http_request", "(", "self", ".", "location", "(", ")", ")", "self", ".", "_parse", "(", "data", ")", "return", "self" ]
5d2955f86575c9430ab7104211b3d67bd4c0febe
test
TaskService.register_task
Register a task for a python dict :param task_def: dict defining gbdx task
gbdx_cloud_harness/services/task_service.py
def register_task(self, task_def): ''' Register a task for a python dict :param task_def: dict defining gbdx task ''' r = self.session.post( self.task_url, data=task_def, headers={'Content-Type': 'application/json', 'Accept': 'application/json'...
def register_task(self, task_def): ''' Register a task for a python dict :param task_def: dict defining gbdx task ''' r = self.session.post( self.task_url, data=task_def, headers={'Content-Type': 'application/json', 'Accept': 'application/json'...
[ "Register", "a", "task", "for", "a", "python", "dict", ":", "param", "task_def", ":", "dict", "defining", "gbdx", "task" ]
TDG-Platform/cloud-harness
python
https://github.com/TDG-Platform/cloud-harness/blob/1d8f972f861816b90785a484e9bec5bd4bc2f569/gbdx_cloud_harness/services/task_service.py#L17-L33
[ "def", "register_task", "(", "self", ",", "task_def", ")", ":", "r", "=", "self", ".", "session", ".", "post", "(", "self", ".", "task_url", ",", "data", "=", "task_def", ",", "headers", "=", "{", "'Content-Type'", ":", "'application/json'", ",", "'Accep...
1d8f972f861816b90785a484e9bec5bd4bc2f569
test
TaskService.delete_task
Delete a task from the platforms regoistry :param task_name: name of the task to delete
gbdx_cloud_harness/services/task_service.py
def delete_task(self, task_name): ''' Delete a task from the platforms regoistry :param task_name: name of the task to delete ''' response = self.session.delete('%s/%s' % (self.task_url, task_name)) if response.status_code == 200: return response.status_code,...
def delete_task(self, task_name): ''' Delete a task from the platforms regoistry :param task_name: name of the task to delete ''' response = self.session.delete('%s/%s' % (self.task_url, task_name)) if response.status_code == 200: return response.status_code,...
[ "Delete", "a", "task", "from", "the", "platforms", "regoistry", ":", "param", "task_name", ":", "name", "of", "the", "task", "to", "delete" ]
TDG-Platform/cloud-harness
python
https://github.com/TDG-Platform/cloud-harness/blob/1d8f972f861816b90785a484e9bec5bd4bc2f569/gbdx_cloud_harness/services/task_service.py#L35-L47
[ "def", "delete_task", "(", "self", ",", "task_name", ")", ":", "response", "=", "self", ".", "session", ".", "delete", "(", "'%s/%s'", "%", "(", "self", ".", "task_url", ",", "task_name", ")", ")", "if", "response", ".", "status_code", "==", "200", ":"...
1d8f972f861816b90785a484e9bec5bd4bc2f569
test
GbdxTaskInterface.get_input_string_port
Get input string port value :param port_name: :param default: :return: :rtype:
gbdx_task_template/gbdx_task_interface.py
def get_input_string_port(self, port_name, default=None): """ Get input string port value :param port_name: :param default: :return: :rtype: """ if self.__string_input_ports: return self.__string_input_ports.get(port_name, default) return defau...
def get_input_string_port(self, port_name, default=None): """ Get input string port value :param port_name: :param default: :return: :rtype: """ if self.__string_input_ports: return self.__string_input_ports.get(port_name, default) return defau...
[ "Get", "input", "string", "port", "value", ":", "param", "port_name", ":", ":", "param", "default", ":", ":", "return", ":", ":", "rtype", ":" ]
TDG-Platform/cloud-harness
python
https://github.com/TDG-Platform/cloud-harness/blob/1d8f972f861816b90785a484e9bec5bd4bc2f569/gbdx_task_template/gbdx_task_interface.py#L46-L55
[ "def", "get_input_string_port", "(", "self", ",", "port_name", ",", "default", "=", "None", ")", ":", "if", "self", ".", "__string_input_ports", ":", "return", "self", ".", "__string_input_ports", ".", "get", "(", "port_name", ",", "default", ")", "return", ...
1d8f972f861816b90785a484e9bec5bd4bc2f569
test
GbdxTaskInterface.set_output_string_port
Set output string port value :param port_name: :param value: :return: :rtype:
gbdx_task_template/gbdx_task_interface.py
def set_output_string_port(self, port_name, value): """ Set output string port value :param port_name: :param value: :return: :rtype: """ if not self.__string_output_ports: self.__string_output_ports = {} self.__string_output_ports[port_name] ...
def set_output_string_port(self, port_name, value): """ Set output string port value :param port_name: :param value: :return: :rtype: """ if not self.__string_output_ports: self.__string_output_ports = {} self.__string_output_ports[port_name] ...
[ "Set", "output", "string", "port", "value", ":", "param", "port_name", ":", ":", "param", "value", ":", ":", "return", ":", ":", "rtype", ":" ]
TDG-Platform/cloud-harness
python
https://github.com/TDG-Platform/cloud-harness/blob/1d8f972f861816b90785a484e9bec5bd4bc2f569/gbdx_task_template/gbdx_task_interface.py#L73-L83
[ "def", "set_output_string_port", "(", "self", ",", "port_name", ",", "value", ")", ":", "if", "not", "self", ".", "__string_output_ports", ":", "self", ".", "__string_output_ports", "=", "{", "}", "self", ".", "__string_output_ports", "[", "port_name", "]", "=...
1d8f972f861816b90785a484e9bec5bd4bc2f569
test
GbdxTaskInterface.finalize
:param success_or_fail: string that is 'success' or 'fail' :param message:
gbdx_task_template/gbdx_task_interface.py
def finalize(self, success_or_fail, message=''): """ :param success_or_fail: string that is 'success' or 'fail' :param message: """ self.logit.debug('String OutputPorts: %s' % self.__string_output_ports) if self.__string_output_ports: with open(os.path.join(se...
def finalize(self, success_or_fail, message=''): """ :param success_or_fail: string that is 'success' or 'fail' :param message: """ self.logit.debug('String OutputPorts: %s' % self.__string_output_ports) if self.__string_output_ports: with open(os.path.join(se...
[ ":", "param", "success_or_fail", ":", "string", "that", "is", "success", "or", "fail", ":", "param", "message", ":" ]
TDG-Platform/cloud-harness
python
https://github.com/TDG-Platform/cloud-harness/blob/1d8f972f861816b90785a484e9bec5bd4bc2f569/gbdx_task_template/gbdx_task_interface.py#L93-L105
[ "def", "finalize", "(", "self", ",", "success_or_fail", ",", "message", "=", "''", ")", ":", "self", ".", "logit", ".", "debug", "(", "'String OutputPorts: %s'", "%", "self", ".", "__string_output_ports", ")", "if", "self", ".", "__string_output_ports", ":", ...
1d8f972f861816b90785a484e9bec5bd4bc2f569
test
Port.list_files
List the ports contents by file type or all. :param extensions: string extensions, single string or list of extensions. :return: A list of full path names of each file.
gbdx_task_template/port.py
def list_files(self, extensions=None): """ List the ports contents by file type or all. :param extensions: string extensions, single string or list of extensions. :return: A list of full path names of each file. """ if self.type.lower() != 'directory': raise V...
def list_files(self, extensions=None): """ List the ports contents by file type or all. :param extensions: string extensions, single string or list of extensions. :return: A list of full path names of each file. """ if self.type.lower() != 'directory': raise V...
[ "List", "the", "ports", "contents", "by", "file", "type", "or", "all", ".", ":", "param", "extensions", ":", "string", "extensions", "single", "string", "or", "list", "of", "extensions", ".", ":", "return", ":", "A", "list", "of", "full", "path", "names"...
TDG-Platform/cloud-harness
python
https://github.com/TDG-Platform/cloud-harness/blob/1d8f972f861816b90785a484e9bec5bd4bc2f569/gbdx_task_template/port.py#L159-L183
[ "def", "list_files", "(", "self", ",", "extensions", "=", "None", ")", ":", "if", "self", ".", "type", ".", "lower", "(", ")", "!=", "'directory'", ":", "raise", "ValueError", "(", "\"Port type is not == directory\"", ")", "filesystem_location", "=", "self", ...
1d8f972f861816b90785a484e9bec5bd4bc2f569
test
Port.is_valid_filesys
Checks if the path is correct and exists, must be abs-> a dir -> and not a file.
gbdx_task_template/port.py
def is_valid_filesys(path): """Checks if the path is correct and exists, must be abs-> a dir -> and not a file.""" if os.path.isabs(path) and os.path.isdir(path) and \ not os.path.isfile(path): return True else: raise LocalPortValidationError( ...
def is_valid_filesys(path): """Checks if the path is correct and exists, must be abs-> a dir -> and not a file.""" if os.path.isabs(path) and os.path.isdir(path) and \ not os.path.isfile(path): return True else: raise LocalPortValidationError( ...
[ "Checks", "if", "the", "path", "is", "correct", "and", "exists", "must", "be", "abs", "-", ">", "a", "dir", "-", ">", "and", "not", "a", "file", "." ]
TDG-Platform/cloud-harness
python
https://github.com/TDG-Platform/cloud-harness/blob/1d8f972f861816b90785a484e9bec5bd4bc2f569/gbdx_task_template/port.py#L214-L222
[ "def", "is_valid_filesys", "(", "path", ")", ":", "if", "os", ".", "path", ".", "isabs", "(", "path", ")", "and", "os", ".", "path", ".", "isdir", "(", "path", ")", "and", "not", "os", ".", "path", ".", "isfile", "(", "path", ")", ":", "return", ...
1d8f972f861816b90785a484e9bec5bd4bc2f569
test
Port.is_valid_s3_url
Checks if the url contains S3. Not an accurate validation of the url
gbdx_task_template/port.py
def is_valid_s3_url(url): """Checks if the url contains S3. Not an accurate validation of the url""" # Skip if the url start with source: (gbdxtools syntax) if url.startswith('source:'): return True scheme, netloc, path, _, _, _ = urlparse(url) port_except = RemoteP...
def is_valid_s3_url(url): """Checks if the url contains S3. Not an accurate validation of the url""" # Skip if the url start with source: (gbdxtools syntax) if url.startswith('source:'): return True scheme, netloc, path, _, _, _ = urlparse(url) port_except = RemoteP...
[ "Checks", "if", "the", "url", "contains", "S3", ".", "Not", "an", "accurate", "validation", "of", "the", "url" ]
TDG-Platform/cloud-harness
python
https://github.com/TDG-Platform/cloud-harness/blob/1d8f972f861816b90785a484e9bec5bd4bc2f569/gbdx_task_template/port.py#L225-L243
[ "def", "is_valid_s3_url", "(", "url", ")", ":", "# Skip if the url start with source: (gbdxtools syntax)", "if", "url", ".", "startswith", "(", "'source:'", ")", ":", "return", "True", "scheme", ",", "netloc", ",", "path", ",", "_", ",", "_", ",", "_", "=", ...
1d8f972f861816b90785a484e9bec5bd4bc2f569
test
TaskController.invoke
Execute the command from the arguments. :return: None or Error
gbdx_cloud_harness/controller.py
def invoke(self): """ Execute the command from the arguments. :return: None or Error """ for key in self.FUNCTION_KEYS.keys(): if self._arguments[key] is True: self.FUNCTION_KEYS[key]()
def invoke(self): """ Execute the command from the arguments. :return: None or Error """ for key in self.FUNCTION_KEYS.keys(): if self._arguments[key] is True: self.FUNCTION_KEYS[key]()
[ "Execute", "the", "command", "from", "the", "arguments", ".", ":", "return", ":", "None", "or", "Error" ]
TDG-Platform/cloud-harness
python
https://github.com/TDG-Platform/cloud-harness/blob/1d8f972f861816b90785a484e9bec5bd4bc2f569/gbdx_cloud_harness/controller.py#L76-L83
[ "def", "invoke", "(", "self", ")", ":", "for", "key", "in", "self", ".", "FUNCTION_KEYS", ".", "keys", "(", ")", ":", "if", "self", ".", "_arguments", "[", "key", "]", "is", "True", ":", "self", ".", "FUNCTION_KEYS", "[", "key", "]", "(", ")" ]
1d8f972f861816b90785a484e9bec5bd4bc2f569
test
TaskController._register_anonymous_task
Register the anonymouse task or overwrite it. :return: success or fail message.
gbdx_cloud_harness/controller.py
def _register_anonymous_task(self): """ Register the anonymouse task or overwrite it. :return: success or fail message. """ is_overwrite = self._arguments.get('--overwrite') task_name = "CloudHarness_Anonymous_Task" task_srv = TaskService() if is_overwri...
def _register_anonymous_task(self): """ Register the anonymouse task or overwrite it. :return: success or fail message. """ is_overwrite = self._arguments.get('--overwrite') task_name = "CloudHarness_Anonymous_Task" task_srv = TaskService() if is_overwri...
[ "Register", "the", "anonymouse", "task", "or", "overwrite", "it", ".", ":", "return", ":", "success", "or", "fail", "message", "." ]
TDG-Platform/cloud-harness
python
https://github.com/TDG-Platform/cloud-harness/blob/1d8f972f861816b90785a484e9bec5bd4bc2f569/gbdx_cloud_harness/controller.py#L85-L114
[ "def", "_register_anonymous_task", "(", "self", ")", ":", "is_overwrite", "=", "self", ".", "_arguments", ".", "get", "(", "'--overwrite'", ")", "task_name", "=", "\"CloudHarness_Anonymous_Task\"", "task_srv", "=", "TaskService", "(", ")", "if", "is_overwrite", ":...
1d8f972f861816b90785a484e9bec5bd4bc2f569
test
TaskController._create_app
Method for creating a new Application Template. USAGE: cloud-harness create <dir_name> [--destination=<path>]
gbdx_cloud_harness/controller.py
def _create_app(self): """ Method for creating a new Application Template. USAGE: cloud-harness create <dir_name> [--destination=<path>] """ template_path = os.path.join( os.path.dirname(os.path.dirname(os.path.abspath(__file__))), self.TEMPLATE_FOLDER, self.TEMPLATE_...
def _create_app(self): """ Method for creating a new Application Template. USAGE: cloud-harness create <dir_name> [--destination=<path>] """ template_path = os.path.join( os.path.dirname(os.path.dirname(os.path.abspath(__file__))), self.TEMPLATE_FOLDER, self.TEMPLATE_...
[ "Method", "for", "creating", "a", "new", "Application", "Template", ".", "USAGE", ":", "cloud", "-", "harness", "create", "<dir_name", ">", "[", "--", "destination", "=", "<path", ">", "]" ]
TDG-Platform/cloud-harness
python
https://github.com/TDG-Platform/cloud-harness/blob/1d8f972f861816b90785a484e9bec5bd4bc2f569/gbdx_cloud_harness/controller.py#L116-L155
[ "def", "_create_app", "(", "self", ")", ":", "template_path", "=", "os", ".", "path", ".", "join", "(", "os", ".", "path", ".", "dirname", "(", "os", ".", "path", ".", "dirname", "(", "os", ".", "path", ".", "abspath", "(", "__file__", ")", ")", ...
1d8f972f861816b90785a484e9bec5bd4bc2f569
test
TaskController._run_app
Method for running a custom Application Templates. NOTES: * The default name of the application is app.py. So this function is going to look for app.py, unless the --file option is provide with a different file name. * The generated source bundle will package everything in th...
gbdx_cloud_harness/controller.py
def _run_app(self): """ Method for running a custom Application Templates. NOTES: * The default name of the application is app.py. So this function is going to look for app.py, unless the --file option is provide with a different file name. * The generated sou...
def _run_app(self): """ Method for running a custom Application Templates. NOTES: * The default name of the application is app.py. So this function is going to look for app.py, unless the --file option is provide with a different file name. * The generated sou...
[ "Method", "for", "running", "a", "custom", "Application", "Templates", ".", "NOTES", ":", "*", "The", "default", "name", "of", "the", "application", "is", "app", ".", "py", ".", "So", "this", "function", "is", "going", "to", "look", "for", "app", ".", ...
TDG-Platform/cloud-harness
python
https://github.com/TDG-Platform/cloud-harness/blob/1d8f972f861816b90785a484e9bec5bd4bc2f569/gbdx_cloud_harness/controller.py#L157-L281
[ "def", "_run_app", "(", "self", ")", ":", "is_remote_run", "=", "self", ".", "_arguments", ".", "get", "(", "'--remote'", ")", "filename", "=", "self", ".", "_arguments", ".", "get", "(", "'<file_name>'", ")", "upload_ports", "=", "self", ".", "_arguments"...
1d8f972f861816b90785a484e9bec5bd4bc2f569
test
TaskController._write_config_file
Write a config file to the source bundle location to identify the entry point. :param template_file: path to the task template subclass (executable)
gbdx_cloud_harness/controller.py
def _write_config_file(template_file): """ Write a config file to the source bundle location to identify the entry point. :param template_file: path to the task template subclass (executable) """ config_filename = '.cloud_harness_config.json' config_path = os.path.dirname...
def _write_config_file(template_file): """ Write a config file to the source bundle location to identify the entry point. :param template_file: path to the task template subclass (executable) """ config_filename = '.cloud_harness_config.json' config_path = os.path.dirname...
[ "Write", "a", "config", "file", "to", "the", "source", "bundle", "location", "to", "identify", "the", "entry", "point", ".", ":", "param", "template_file", ":", "path", "to", "the", "task", "template", "subclass", "(", "executable", ")" ]
TDG-Platform/cloud-harness
python
https://github.com/TDG-Platform/cloud-harness/blob/1d8f972f861816b90785a484e9bec5bd4bc2f569/gbdx_cloud_harness/controller.py#L285-L303
[ "def", "_write_config_file", "(", "template_file", ")", ":", "config_filename", "=", "'.cloud_harness_config.json'", "config_path", "=", "os", ".", "path", ".", "dirname", "(", "template_file", ")", "filename", "=", "os", ".", "path", ".", "split", "(", "templat...
1d8f972f861816b90785a484e9bec5bd4bc2f569
test
TaskController._get_class
Import the file and inspect for subclass of TaskTemplate. :param template_file: filename to import.
gbdx_cloud_harness/controller.py
def _get_class(template_file): """ Import the file and inspect for subclass of TaskTemplate. :param template_file: filename to import. """ with warnings.catch_warnings(): # suppress warning from importing warnings.filterwarnings("ignore", category=RuntimeW...
def _get_class(template_file): """ Import the file and inspect for subclass of TaskTemplate. :param template_file: filename to import. """ with warnings.catch_warnings(): # suppress warning from importing warnings.filterwarnings("ignore", category=RuntimeW...
[ "Import", "the", "file", "and", "inspect", "for", "subclass", "of", "TaskTemplate", ".", ":", "param", "template_file", ":", "filename", "to", "import", "." ]
TDG-Platform/cloud-harness
python
https://github.com/TDG-Platform/cloud-harness/blob/1d8f972f861816b90785a484e9bec5bd4bc2f569/gbdx_cloud_harness/controller.py#L306-L319
[ "def", "_get_class", "(", "template_file", ")", ":", "with", "warnings", ".", "catch_warnings", "(", ")", ":", "# suppress warning from importing", "warnings", ".", "filterwarnings", "(", "\"ignore\"", ",", "category", "=", "RuntimeWarning", ")", "template_module", ...
1d8f972f861816b90785a484e9bec5bd4bc2f569
test
TaskController._get_template_abs_path
Return a valid absolute path. filename can be relative or absolute.
gbdx_cloud_harness/controller.py
def _get_template_abs_path(filename): """ Return a valid absolute path. filename can be relative or absolute. """ if os.path.isabs(filename) and os.path.isfile(filename): return filename else: return os.path.join(os.getcwd(), filename)
def _get_template_abs_path(filename): """ Return a valid absolute path. filename can be relative or absolute. """ if os.path.isabs(filename) and os.path.isfile(filename): return filename else: return os.path.join(os.getcwd(), filename)
[ "Return", "a", "valid", "absolute", "path", ".", "filename", "can", "be", "relative", "or", "absolute", "." ]
TDG-Platform/cloud-harness
python
https://github.com/TDG-Platform/cloud-harness/blob/1d8f972f861816b90785a484e9bec5bd4bc2f569/gbdx_cloud_harness/controller.py#L322-L329
[ "def", "_get_template_abs_path", "(", "filename", ")", ":", "if", "os", ".", "path", ".", "isabs", "(", "filename", ")", "and", "os", ".", "path", ".", "isfile", "(", "filename", ")", ":", "return", "filename", "else", ":", "return", "os", ".", "path",...
1d8f972f861816b90785a484e9bec5bd4bc2f569
test
AccountStorageService.upload
Upload a list of files to a users account location :param source_files: list of files to upload, or single file name :param s3_folder: the user location to upload to.
gbdx_cloud_harness/services/account_storage_service.py
def upload(self, source_files, s3_folder=None): """ Upload a list of files to a users account location :param source_files: list of files to upload, or single file name :param s3_folder: the user location to upload to. """ if s3_folder is None: folder = self....
def upload(self, source_files, s3_folder=None): """ Upload a list of files to a users account location :param source_files: list of files to upload, or single file name :param s3_folder: the user location to upload to. """ if s3_folder is None: folder = self....
[ "Upload", "a", "list", "of", "files", "to", "a", "users", "account", "location", ":", "param", "source_files", ":", "list", "of", "files", "to", "upload", "or", "single", "file", "name", ":", "param", "s3_folder", ":", "the", "user", "location", "to", "u...
TDG-Platform/cloud-harness
python
https://github.com/TDG-Platform/cloud-harness/blob/1d8f972f861816b90785a484e9bec5bd4bc2f569/gbdx_cloud_harness/services/account_storage_service.py#L70-L88
[ "def", "upload", "(", "self", ",", "source_files", ",", "s3_folder", "=", "None", ")", ":", "if", "s3_folder", "is", "None", ":", "folder", "=", "self", ".", "prefix", "else", ":", "folder", "=", "'%s/%s'", "%", "(", "self", ".", "prefix", ",", "s3_f...
1d8f972f861816b90785a484e9bec5bd4bc2f569
test
AccountStorageService.download
download all files from a users account location :param local_port_path: the local path where the data is to download to :param key_name: can start with self.prefix or taken as relative to prefix. Example: local_port_path = /home/user/myworkflow/input_images/ (sync all data in this ...
gbdx_cloud_harness/services/account_storage_service.py
def download(self, local_port_path, key_names): # pragma: no cover """ download all files from a users account location :param local_port_path: the local path where the data is to download to :param key_name: can start with self.prefix or taken as relative to prefix. Example: ...
def download(self, local_port_path, key_names): # pragma: no cover """ download all files from a users account location :param local_port_path: the local path where the data is to download to :param key_name: can start with self.prefix or taken as relative to prefix. Example: ...
[ "download", "all", "files", "from", "a", "users", "account", "location", ":", "param", "local_port_path", ":", "the", "local", "path", "where", "the", "data", "is", "to", "download", "to", ":", "param", "key_name", ":", "can", "start", "with", "self", ".",...
TDG-Platform/cloud-harness
python
https://github.com/TDG-Platform/cloud-harness/blob/1d8f972f861816b90785a484e9bec5bd4bc2f569/gbdx_cloud_harness/services/account_storage_service.py#L95-L139
[ "def", "download", "(", "self", ",", "local_port_path", ",", "key_names", ")", ":", "# pragma: no cover", "if", "not", "os", ".", "path", ".", "isdir", "(", "local_port_path", ")", ":", "raise", "ValueError", "(", "\"Download path does not exist: %s\"", "%", "lo...
1d8f972f861816b90785a484e9bec5bd4bc2f569
test
AccountStorageService.list
Get a list of keys for the accounts
gbdx_cloud_harness/services/account_storage_service.py
def list(self, s3_folder='', full_key_data=False): """Get a list of keys for the accounts""" if not s3_folder.startswith('/'): s3_folder = '/' + s3_folder s3_prefix = self.prefix + s3_folder bucket_data = self.client.list_objects(Bucket=self.bucket, Prefix=s3_prefix) ...
def list(self, s3_folder='', full_key_data=False): """Get a list of keys for the accounts""" if not s3_folder.startswith('/'): s3_folder = '/' + s3_folder s3_prefix = self.prefix + s3_folder bucket_data = self.client.list_objects(Bucket=self.bucket, Prefix=s3_prefix) ...
[ "Get", "a", "list", "of", "keys", "for", "the", "accounts" ]
TDG-Platform/cloud-harness
python
https://github.com/TDG-Platform/cloud-harness/blob/1d8f972f861816b90785a484e9bec5bd4bc2f569/gbdx_cloud_harness/services/account_storage_service.py#L144-L156
[ "def", "list", "(", "self", ",", "s3_folder", "=", "''", ",", "full_key_data", "=", "False", ")", ":", "if", "not", "s3_folder", ".", "startswith", "(", "'/'", ")", ":", "s3_folder", "=", "'/'", "+", "s3_folder", "s3_prefix", "=", "self", ".", "prefix"...
1d8f972f861816b90785a484e9bec5bd4bc2f569
test
Workflow._build_worklfow_json
Build a workflow definition from the cloud_harness task.
gbdx_cloud_harness/workflow.py
def _build_worklfow_json(self): """ Build a workflow definition from the cloud_harness task. """ wf_json = {'tasks': [], 'name': 'cloud-harness_%s' % str(uuid.uuid4())} task_def = json.loads(self.task_template.json()) d = { "name": task_def['name'], ...
def _build_worklfow_json(self): """ Build a workflow definition from the cloud_harness task. """ wf_json = {'tasks': [], 'name': 'cloud-harness_%s' % str(uuid.uuid4())} task_def = json.loads(self.task_template.json()) d = { "name": task_def['name'], ...
[ "Build", "a", "workflow", "definition", "from", "the", "cloud_harness", "task", "." ]
TDG-Platform/cloud-harness
python
https://github.com/TDG-Platform/cloud-harness/blob/1d8f972f861816b90785a484e9bec5bd4bc2f569/gbdx_cloud_harness/workflow.py#L44-L98
[ "def", "_build_worklfow_json", "(", "self", ")", ":", "wf_json", "=", "{", "'tasks'", ":", "[", "]", ",", "'name'", ":", "'cloud-harness_%s'", "%", "str", "(", "uuid", ".", "uuid4", "(", ")", ")", "}", "task_def", "=", "json", ".", "loads", "(", "sel...
1d8f972f861816b90785a484e9bec5bd4bc2f569
test
Workflow.execute
Execute the cloud_harness task.
gbdx_cloud_harness/workflow.py
def execute(self, override_wf_json=None): """ Execute the cloud_harness task. """ r = self.gbdx.post( self.URL, json=self.json if override_wf_json is None else override_wf_json ) try: r.raise_for_status() except: pr...
def execute(self, override_wf_json=None): """ Execute the cloud_harness task. """ r = self.gbdx.post( self.URL, json=self.json if override_wf_json is None else override_wf_json ) try: r.raise_for_status() except: pr...
[ "Execute", "the", "cloud_harness", "task", "." ]
TDG-Platform/cloud-harness
python
https://github.com/TDG-Platform/cloud-harness/blob/1d8f972f861816b90785a484e9bec5bd4bc2f569/gbdx_cloud_harness/workflow.py#L100-L118
[ "def", "execute", "(", "self", ",", "override_wf_json", "=", "None", ")", ":", "r", "=", "self", ".", "gbdx", ".", "post", "(", "self", ".", "URL", ",", "json", "=", "self", ".", "json", "if", "override_wf_json", "is", "None", "else", "override_wf_json...
1d8f972f861816b90785a484e9bec5bd4bc2f569
test
Workflow.monitor_run
Monitor the workflows events and display spinner while running. :param workflow: the workflow object
gbdx_cloud_harness/workflow.py
def monitor_run(self): # pragma: no cover """ Monitor the workflows events and display spinner while running. :param workflow: the workflow object """ spinner = itertools.cycle(['-', '/', '|', '\\']) while not self.complete: for i in xrange(300): ...
def monitor_run(self): # pragma: no cover """ Monitor the workflows events and display spinner while running. :param workflow: the workflow object """ spinner = itertools.cycle(['-', '/', '|', '\\']) while not self.complete: for i in xrange(300): ...
[ "Monitor", "the", "workflows", "events", "and", "display", "spinner", "while", "running", ".", ":", "param", "workflow", ":", "the", "workflow", "object" ]
TDG-Platform/cloud-harness
python
https://github.com/TDG-Platform/cloud-harness/blob/1d8f972f861816b90785a484e9bec5bd4bc2f569/gbdx_cloud_harness/workflow.py#L134-L154
[ "def", "monitor_run", "(", "self", ")", ":", "# pragma: no cover", "spinner", "=", "itertools", ".", "cycle", "(", "[", "'-'", ",", "'/'", ",", "'|'", ",", "'\\\\'", "]", ")", "while", "not", "self", ".", "complete", ":", "for", "i", "in", "xrange", ...
1d8f972f861816b90785a484e9bec5bd4bc2f569
test
TaskTemplate.finalize
:param success_or_fail: string that is 'success' or 'fail' :param message:
gbdx_task_template/base.py
def finalize(self, success_or_fail, message=''): """ :param success_or_fail: string that is 'success' or 'fail' :param message: """ if not self.__remote_run: return json.dumps({'status': success_or_fail, 'reason': message}, indent=4) else: super(Ta...
def finalize(self, success_or_fail, message=''): """ :param success_or_fail: string that is 'success' or 'fail' :param message: """ if not self.__remote_run: return json.dumps({'status': success_or_fail, 'reason': message}, indent=4) else: super(Ta...
[ ":", "param", "success_or_fail", ":", "string", "that", "is", "success", "or", "fail", ":", "param", "message", ":" ]
TDG-Platform/cloud-harness
python
https://github.com/TDG-Platform/cloud-harness/blob/1d8f972f861816b90785a484e9bec5bd4bc2f569/gbdx_task_template/base.py#L45-L53
[ "def", "finalize", "(", "self", ",", "success_or_fail", ",", "message", "=", "''", ")", ":", "if", "not", "self", ".", "__remote_run", ":", "return", "json", ".", "dumps", "(", "{", "'status'", ":", "success_or_fail", ",", "'reason'", ":", "message", "}"...
1d8f972f861816b90785a484e9bec5bd4bc2f569
test
TaskTemplate.check_and_create_outputs
Iterate through the task outputs. Two scenarios: - User is running locally, check that output folders exist. - User is running remotely, when docker container runs filesystem, check that output folders exist. - Else, do nothing. :return: None
gbdx_task_template/base.py
def check_and_create_outputs(self): """ Iterate through the task outputs. Two scenarios: - User is running locally, check that output folders exist. - User is running remotely, when docker container runs filesystem, check that output folders exist. - Else, do ...
def check_and_create_outputs(self): """ Iterate through the task outputs. Two scenarios: - User is running locally, check that output folders exist. - User is running remotely, when docker container runs filesystem, check that output folders exist. - Else, do ...
[ "Iterate", "through", "the", "task", "outputs", ".", "Two", "scenarios", ":", "-", "User", "is", "running", "locally", "check", "that", "output", "folders", "exist", ".", "-", "User", "is", "running", "remotely", "when", "docker", "container", "runs", "files...
TDG-Platform/cloud-harness
python
https://github.com/TDG-Platform/cloud-harness/blob/1d8f972f861816b90785a484e9bec5bd4bc2f569/gbdx_task_template/base.py#L55-L88
[ "def", "check_and_create_outputs", "(", "self", ")", ":", "if", "self", ".", "task", "is", "None", ":", "raise", "TaskTemplateError", "(", "'A task must be initialized before running a TaskTemplate subclass.'", ")", "for", "output_port", "in", "self", ".", "task", "."...
1d8f972f861816b90785a484e9bec5bd4bc2f569
test
PortService.upload_input_ports
Takes the workflow value for each port and does the following: * If local filesystem -> Uploads locally files to s3. S3 location will be as follows: gbd-customer-data/<acct_id>/<workflow_name>/<task_name>/<port_name>/ * If S3 url -> do nothing. :return...
gbdx_cloud_harness/services/port_service.py
def upload_input_ports(self, port_list=None, exclude_list=None): """ Takes the workflow value for each port and does the following: * If local filesystem -> Uploads locally files to s3. S3 location will be as follows: gbd-customer-data/<acct_id>/<workflow_...
def upload_input_ports(self, port_list=None, exclude_list=None): """ Takes the workflow value for each port and does the following: * If local filesystem -> Uploads locally files to s3. S3 location will be as follows: gbd-customer-data/<acct_id>/<workflow_...
[ "Takes", "the", "workflow", "value", "for", "each", "port", "and", "does", "the", "following", ":", "*", "If", "local", "filesystem", "-", ">", "Uploads", "locally", "files", "to", "s3", ".", "S3", "location", "will", "be", "as", "follows", ":", "gbd", ...
TDG-Platform/cloud-harness
python
https://github.com/TDG-Platform/cloud-harness/blob/1d8f972f861816b90785a484e9bec5bd4bc2f569/gbdx_cloud_harness/services/port_service.py#L25-L69
[ "def", "upload_input_ports", "(", "self", ",", "port_list", "=", "None", ",", "exclude_list", "=", "None", ")", ":", "input_ports", "=", "self", ".", "_task", ".", "input_ports", "for", "port", "in", "input_ports", ":", "# If port list is not None, then only allow...
1d8f972f861816b90785a484e9bec5bd4bc2f569
test
PortService._get_port_files
Find files for the local_path and return tuples of filename and keynames :param local_path: the local path to search for files :param prefix: the S3 prefix for each key name on S3
gbdx_cloud_harness/services/port_service.py
def _get_port_files(local_path, prefix): """ Find files for the local_path and return tuples of filename and keynames :param local_path: the local path to search for files :param prefix: the S3 prefix for each key name on S3 """ source_files = [] for root, dirs, ...
def _get_port_files(local_path, prefix): """ Find files for the local_path and return tuples of filename and keynames :param local_path: the local path to search for files :param prefix: the S3 prefix for each key name on S3 """ source_files = [] for root, dirs, ...
[ "Find", "files", "for", "the", "local_path", "and", "return", "tuples", "of", "filename", "and", "keynames", ":", "param", "local_path", ":", "the", "local", "path", "to", "search", "for", "files", ":", "param", "prefix", ":", "the", "S3", "prefix", "for",...
TDG-Platform/cloud-harness
python
https://github.com/TDG-Platform/cloud-harness/blob/1d8f972f861816b90785a484e9bec5bd4bc2f569/gbdx_cloud_harness/services/port_service.py#L72-L89
[ "def", "_get_port_files", "(", "local_path", ",", "prefix", ")", ":", "source_files", "=", "[", "]", "for", "root", ",", "dirs", ",", "files", "in", "os", ".", "walk", "(", "local_path", ",", "topdown", "=", "False", ")", ":", "for", "name", "in", "f...
1d8f972f861816b90785a484e9bec5bd4bc2f569
test
archive
Move an active project to the archive.
proj/__init__.py
def archive(folder, dry_run=False): "Move an active project to the archive." # error handling on archive_dir already done in main() for f in folder: if not os.path.exists(f): bail('folder does not exist: ' + f) _archive_safe(folder, PROJ_ARCHIVE, dry_run=dry_run)
def archive(folder, dry_run=False): "Move an active project to the archive." # error handling on archive_dir already done in main() for f in folder: if not os.path.exists(f): bail('folder does not exist: ' + f) _archive_safe(folder, PROJ_ARCHIVE, dry_run=dry_run)
[ "Move", "an", "active", "project", "to", "the", "archive", "." ]
larsyencken/proj
python
https://github.com/larsyencken/proj/blob/44fd72aeb9bbf72046d81c4e9e4306a23335dc0a/proj/__init__.py#L55-L63
[ "def", "archive", "(", "folder", ",", "dry_run", "=", "False", ")", ":", "# error handling on archive_dir already done in main()", "for", "f", "in", "folder", ":", "if", "not", "os", ".", "path", ".", "exists", "(", "f", ")", ":", "bail", "(", "'folder does ...
44fd72aeb9bbf72046d81c4e9e4306a23335dc0a
test
_mkdir
The equivalent of 'mkdir -p' in shell.
proj/__init__.py
def _mkdir(p): "The equivalent of 'mkdir -p' in shell." isdir = os.path.isdir stack = [os.path.abspath(p)] while not isdir(stack[-1]): parent_dir = os.path.dirname(stack[-1]) stack.append(parent_dir) while stack: p = stack.pop() if not isdir(p): os.mkdir...
def _mkdir(p): "The equivalent of 'mkdir -p' in shell." isdir = os.path.isdir stack = [os.path.abspath(p)] while not isdir(stack[-1]): parent_dir = os.path.dirname(stack[-1]) stack.append(parent_dir) while stack: p = stack.pop() if not isdir(p): os.mkdir...
[ "The", "equivalent", "of", "mkdir", "-", "p", "in", "shell", "." ]
larsyencken/proj
python
https://github.com/larsyencken/proj/blob/44fd72aeb9bbf72046d81c4e9e4306a23335dc0a/proj/__init__.py#L106-L118
[ "def", "_mkdir", "(", "p", ")", ":", "isdir", "=", "os", ".", "path", ".", "isdir", "stack", "=", "[", "os", ".", "path", ".", "abspath", "(", "p", ")", "]", "while", "not", "isdir", "(", "stack", "[", "-", "1", "]", ")", ":", "parent_dir", "...
44fd72aeb9bbf72046d81c4e9e4306a23335dc0a
test
list
List the contents of the archive directory.
proj/__init__.py
def list(pattern=()): "List the contents of the archive directory." # strategy: pick the intersection of all the patterns the user provides globs = ['*{0}*'.format(p) for p in pattern] + ['*'] matches = [] offset = len(PROJ_ARCHIVE) + 1 for suffix in globs: glob_pattern = os.path.join(P...
def list(pattern=()): "List the contents of the archive directory." # strategy: pick the intersection of all the patterns the user provides globs = ['*{0}*'.format(p) for p in pattern] + ['*'] matches = [] offset = len(PROJ_ARCHIVE) + 1 for suffix in globs: glob_pattern = os.path.join(P...
[ "List", "the", "contents", "of", "the", "archive", "directory", "." ]
larsyencken/proj
python
https://github.com/larsyencken/proj/blob/44fd72aeb9bbf72046d81c4e9e4306a23335dc0a/proj/__init__.py#L123-L140
[ "def", "list", "(", "pattern", "=", "(", ")", ")", ":", "# strategy: pick the intersection of all the patterns the user provides", "globs", "=", "[", "'*{0}*'", ".", "format", "(", "p", ")", "for", "p", "in", "pattern", "]", "+", "[", "'*'", "]", "matches", ...
44fd72aeb9bbf72046d81c4e9e4306a23335dc0a
test
restore
Restore a project from the archive.
proj/__init__.py
def restore(folder): "Restore a project from the archive." if os.path.isdir(folder): bail('a folder of the same name already exists!') pattern = os.path.join(PROJ_ARCHIVE, '*', '*', folder) matches = glob.glob(pattern) if not matches: bail('no project matches: ' + folder) if le...
def restore(folder): "Restore a project from the archive." if os.path.isdir(folder): bail('a folder of the same name already exists!') pattern = os.path.join(PROJ_ARCHIVE, '*', '*', folder) matches = glob.glob(pattern) if not matches: bail('no project matches: ' + folder) if le...
[ "Restore", "a", "project", "from", "the", "archive", "." ]
larsyencken/proj
python
https://github.com/larsyencken/proj/blob/44fd72aeb9bbf72046d81c4e9e4306a23335dc0a/proj/__init__.py#L145-L161
[ "def", "restore", "(", "folder", ")", ":", "if", "os", ".", "path", ".", "isdir", "(", "folder", ")", ":", "bail", "(", "'a folder of the same name already exists!'", ")", "pattern", "=", "os", ".", "path", ".", "join", "(", "PROJ_ARCHIVE", ",", "'*'", "...
44fd72aeb9bbf72046d81c4e9e4306a23335dc0a
test
Client.new
Create new storage service client. Arguments: environment(str): The service environment to be used for the client. 'prod' or 'dev'. access_token(str): The access token used to authenticate with the service Returns: ...
hbp_service_client/storage_service/client.py
def new(cls, access_token, environment='prod'): '''Create new storage service client. Arguments: environment(str): The service environment to be used for the client. 'prod' or 'dev'. access_token(str): The access token used to authenticate with th...
def new(cls, access_token, environment='prod'): '''Create new storage service client. Arguments: environment(str): The service environment to be used for the client. 'prod' or 'dev'. access_token(str): The access token used to authenticate with th...
[ "Create", "new", "storage", "service", "client", "." ]
HumanBrainProject/hbp-service-client
python
https://github.com/HumanBrainProject/hbp-service-client/blob/b338fb41a7f0e7b9d654ff28fcf13a56d03bff4d/hbp_service_client/storage_service/client.py#L34-L48
[ "def", "new", "(", "cls", ",", "access_token", ",", "environment", "=", "'prod'", ")", ":", "api_client", "=", "ApiClient", ".", "new", "(", "access_token", ",", "environment", ")", "return", "cls", "(", "api_client", ")" ]
b338fb41a7f0e7b9d654ff28fcf13a56d03bff4d
test
Client.list
List the entities found directly under the given path. Args: path (str): The path of the entity to be listed. Must start with a '/'. Returns: The list of entity names directly under the given path: u'/12345/folder_1' Raises: StorageArgument...
hbp_service_client/storage_service/client.py
def list(self, path): '''List the entities found directly under the given path. Args: path (str): The path of the entity to be listed. Must start with a '/'. Returns: The list of entity names directly under the given path: u'/12345/folder_1' Ra...
def list(self, path): '''List the entities found directly under the given path. Args: path (str): The path of the entity to be listed. Must start with a '/'. Returns: The list of entity names directly under the given path: u'/12345/folder_1' Ra...
[ "List", "the", "entities", "found", "directly", "under", "the", "given", "path", "." ]
HumanBrainProject/hbp-service-client
python
https://github.com/HumanBrainProject/hbp-service-client/blob/b338fb41a7f0e7b9d654ff28fcf13a56d03bff4d/hbp_service_client/storage_service/client.py#L50-L88
[ "def", "list", "(", "self", ",", "path", ")", ":", "self", ".", "__validate_storage_path", "(", "path", ")", "entity", "=", "self", ".", "api_client", ".", "get_entity_by_query", "(", "path", "=", "path", ")", "if", "entity", "[", "'entity_type'", "]", "...
b338fb41a7f0e7b9d654ff28fcf13a56d03bff4d
test
Client.download_file
Download a file from storage service to local disk. Existing files on the target path will be overwritten. The download is not recursive, as it only works on files. Args: path (str): The path of the entity to be downloaded. Must start with a '/'. Returns: None ...
hbp_service_client/storage_service/client.py
def download_file(self, path, target_path): '''Download a file from storage service to local disk. Existing files on the target path will be overwritten. The download is not recursive, as it only works on files. Args: path (str): The path of the entity to be downloaded. Mus...
def download_file(self, path, target_path): '''Download a file from storage service to local disk. Existing files on the target path will be overwritten. The download is not recursive, as it only works on files. Args: path (str): The path of the entity to be downloaded. Mus...
[ "Download", "a", "file", "from", "storage", "service", "to", "local", "disk", "." ]
HumanBrainProject/hbp-service-client
python
https://github.com/HumanBrainProject/hbp-service-client/blob/b338fb41a7f0e7b9d654ff28fcf13a56d03bff4d/hbp_service_client/storage_service/client.py#L90-L119
[ "def", "download_file", "(", "self", ",", "path", ",", "target_path", ")", ":", "self", ".", "__validate_storage_path", "(", "path", ")", "entity", "=", "self", ".", "api_client", ".", "get_entity_by_query", "(", "path", "=", "path", ")", "if", "entity", "...
b338fb41a7f0e7b9d654ff28fcf13a56d03bff4d
test
Client.exists
Check if a certain path exists in the storage service. Args: path (str): The path to be checked Returns: True if the path exists, False otherwise Raises: StorageArgumentException: Invalid arguments StorageForbiddenException: Server response code...
hbp_service_client/storage_service/client.py
def exists(self, path): '''Check if a certain path exists in the storage service. Args: path (str): The path to be checked Returns: True if the path exists, False otherwise Raises: StorageArgumentException: Invalid arguments StorageForbi...
def exists(self, path): '''Check if a certain path exists in the storage service. Args: path (str): The path to be checked Returns: True if the path exists, False otherwise Raises: StorageArgumentException: Invalid arguments StorageForbi...
[ "Check", "if", "a", "certain", "path", "exists", "in", "the", "storage", "service", "." ]
HumanBrainProject/hbp-service-client
python
https://github.com/HumanBrainProject/hbp-service-client/blob/b338fb41a7f0e7b9d654ff28fcf13a56d03bff4d/hbp_service_client/storage_service/client.py#L121-L143
[ "def", "exists", "(", "self", ",", "path", ")", ":", "self", ".", "__validate_storage_path", "(", "path", ")", "try", ":", "metadata", "=", "self", ".", "api_client", ".", "get_entity_by_query", "(", "path", "=", "path", ")", "except", "StorageNotFoundExcept...
b338fb41a7f0e7b9d654ff28fcf13a56d03bff4d
test
Client.get_parent
Get the parent entity of the entity pointed by the given path. Args: path (str): The path of the entity whose parent is needed Returns: A JSON object of the parent entity if found. Raises: StorageArgumentException: Invalid arguments StorageForbi...
hbp_service_client/storage_service/client.py
def get_parent(self, path): '''Get the parent entity of the entity pointed by the given path. Args: path (str): The path of the entity whose parent is needed Returns: A JSON object of the parent entity if found. Raises: StorageArgumentException: Inv...
def get_parent(self, path): '''Get the parent entity of the entity pointed by the given path. Args: path (str): The path of the entity whose parent is needed Returns: A JSON object of the parent entity if found. Raises: StorageArgumentException: Inv...
[ "Get", "the", "parent", "entity", "of", "the", "entity", "pointed", "by", "the", "given", "path", "." ]
HumanBrainProject/hbp-service-client
python
https://github.com/HumanBrainProject/hbp-service-client/blob/b338fb41a7f0e7b9d654ff28fcf13a56d03bff4d/hbp_service_client/storage_service/client.py#L145-L165
[ "def", "get_parent", "(", "self", ",", "path", ")", ":", "self", ".", "__validate_storage_path", "(", "path", ",", "projects_allowed", "=", "False", ")", "path_steps", "=", "[", "step", "for", "step", "in", "path", ".", "split", "(", "'/'", ")", "if", ...
b338fb41a7f0e7b9d654ff28fcf13a56d03bff4d
test
Client.mkdir
Create a folder in the storage service pointed by the given path. Args: path (str): The path of the folder to be created Returns: None Raises: StorageArgumentException: Invalid arguments StorageForbiddenException: Server response code 403 ...
hbp_service_client/storage_service/client.py
def mkdir(self, path): '''Create a folder in the storage service pointed by the given path. Args: path (str): The path of the folder to be created Returns: None Raises: StorageArgumentException: Invalid arguments StorageForbiddenExceptio...
def mkdir(self, path): '''Create a folder in the storage service pointed by the given path. Args: path (str): The path of the folder to be created Returns: None Raises: StorageArgumentException: Invalid arguments StorageForbiddenExceptio...
[ "Create", "a", "folder", "in", "the", "storage", "service", "pointed", "by", "the", "given", "path", "." ]
HumanBrainProject/hbp-service-client
python
https://github.com/HumanBrainProject/hbp-service-client/blob/b338fb41a7f0e7b9d654ff28fcf13a56d03bff4d/hbp_service_client/storage_service/client.py#L167-L185
[ "def", "mkdir", "(", "self", ",", "path", ")", ":", "self", ".", "__validate_storage_path", "(", "path", ",", "projects_allowed", "=", "False", ")", "parent_metadata", "=", "self", ".", "get_parent", "(", "path", ")", "self", ".", "api_client", ".", "creat...
b338fb41a7f0e7b9d654ff28fcf13a56d03bff4d
test
Client.upload_file
Upload local file content to a storage service destination folder. Args: local_file(str) dest_path(str): absolute Storage service path '/project' prefix is essential suffix should be the name the file will have on in the destination fo...
hbp_service_client/storage_service/client.py
def upload_file(self, local_file, dest_path, mimetype): '''Upload local file content to a storage service destination folder. Args: local_file(str) dest_path(str): absolute Storage service path '/project' prefix is essential su...
def upload_file(self, local_file, dest_path, mimetype): '''Upload local file content to a storage service destination folder. Args: local_file(str) dest_path(str): absolute Storage service path '/project' prefix is essential su...
[ "Upload", "local", "file", "content", "to", "a", "storage", "service", "destination", "folder", "." ]
HumanBrainProject/hbp-service-client
python
https://github.com/HumanBrainProject/hbp-service-client/blob/b338fb41a7f0e7b9d654ff28fcf13a56d03bff4d/hbp_service_client/storage_service/client.py#L189-L228
[ "def", "upload_file", "(", "self", ",", "local_file", ",", "dest_path", ",", "mimetype", ")", ":", "self", ".", "__validate_storage_path", "(", "dest_path", ")", "# get the paths of the target dir and the target file name", "if", "dest_path", ".", "endswith", "(", "'/...
b338fb41a7f0e7b9d654ff28fcf13a56d03bff4d
test
Client.delete
Delete an entity from the storage service using its path. Args: path(str): The path of the entity to be delete Returns: The uuid of created file entity as string Raises: StorageArgumentException: Invalid arguments Sto...
hbp_service_client/storage_service/client.py
def delete(self, path): ''' Delete an entity from the storage service using its path. Args: path(str): The path of the entity to be delete Returns: The uuid of created file entity as string Raises: StorageArgumentException: I...
def delete(self, path): ''' Delete an entity from the storage service using its path. Args: path(str): The path of the entity to be delete Returns: The uuid of created file entity as string Raises: StorageArgumentException: I...
[ "Delete", "an", "entity", "from", "the", "storage", "service", "using", "its", "path", "." ]
HumanBrainProject/hbp-service-client
python
https://github.com/HumanBrainProject/hbp-service-client/blob/b338fb41a7f0e7b9d654ff28fcf13a56d03bff4d/hbp_service_client/storage_service/client.py#L230-L259
[ "def", "delete", "(", "self", ",", "path", ")", ":", "self", ".", "__validate_storage_path", "(", "path", ",", "projects_allowed", "=", "False", ")", "entity", "=", "self", ".", "api_client", ".", "get_entity_by_query", "(", "path", "=", "path", ")", "if",...
b338fb41a7f0e7b9d654ff28fcf13a56d03bff4d
test
Client.__validate_storage_path
Validate a string as a valid storage path
hbp_service_client/storage_service/client.py
def __validate_storage_path(cls, path, projects_allowed=True): '''Validate a string as a valid storage path''' if not path or not isinstance(path, str) or path[0] != '/' or path == '/': raise StorageArgumentException( 'The path must be a string, start with a slash (/), and b...
def __validate_storage_path(cls, path, projects_allowed=True): '''Validate a string as a valid storage path''' if not path or not isinstance(path, str) or path[0] != '/' or path == '/': raise StorageArgumentException( 'The path must be a string, start with a slash (/), and b...
[ "Validate", "a", "string", "as", "a", "valid", "storage", "path" ]
HumanBrainProject/hbp-service-client
python
https://github.com/HumanBrainProject/hbp-service-client/blob/b338fb41a7f0e7b9d654ff28fcf13a56d03bff4d/hbp_service_client/storage_service/client.py#L262-L271
[ "def", "__validate_storage_path", "(", "cls", ",", "path", ",", "projects_allowed", "=", "True", ")", ":", "if", "not", "path", "or", "not", "isinstance", "(", "path", ",", "str", ")", "or", "path", "[", "0", "]", "!=", "'/'", "or", "path", "==", "'/...
b338fb41a7f0e7b9d654ff28fcf13a56d03bff4d
test
Task.is_valid
Check cloud-harness code is valid. task schema validation is left to the API endpoint. :param remote: Flag indicating if the task is being ran on the platform or not. :return: is valid or not.
gbdx_task_template/task.py
def is_valid(self, remote=False): """ Check cloud-harness code is valid. task schema validation is left to the API endpoint. :param remote: Flag indicating if the task is being ran on the platform or not. :return: is valid or not. """ if len(self.input_ports) < 1...
def is_valid(self, remote=False): """ Check cloud-harness code is valid. task schema validation is left to the API endpoint. :param remote: Flag indicating if the task is being ran on the platform or not. :return: is valid or not. """ if len(self.input_ports) < 1...
[ "Check", "cloud", "-", "harness", "code", "is", "valid", ".", "task", "schema", "validation", "is", "left", "to", "the", "API", "endpoint", ".", ":", "param", "remote", ":", "Flag", "indicating", "if", "the", "task", "is", "being", "ran", "on", "the", ...
TDG-Platform/cloud-harness
python
https://github.com/TDG-Platform/cloud-harness/blob/1d8f972f861816b90785a484e9bec5bd4bc2f569/gbdx_task_template/task.py#L101-L129
[ "def", "is_valid", "(", "self", ",", "remote", "=", "False", ")", ":", "if", "len", "(", "self", ".", "input_ports", ")", "<", "1", ":", "return", "False", "if", "remote", ":", "# Ignore output ports as value will overriden.", "ports", "=", "[", "port", "f...
1d8f972f861816b90785a484e9bec5bd4bc2f569
test
median_min_distance
This function computes a graph of nearest-neighbors for each sample point in 'data' and returns the median of the distribution of distances between those nearest-neighbors, the distance metric being specified by 'metric'. Parameters ---------- data : array of shape (n_samples, n_feature...
Density_Sampling.py
def median_min_distance(data, metric): """This function computes a graph of nearest-neighbors for each sample point in 'data' and returns the median of the distribution of distances between those nearest-neighbors, the distance metric being specified by 'metric'. Parameters ---------- ...
def median_min_distance(data, metric): """This function computes a graph of nearest-neighbors for each sample point in 'data' and returns the median of the distribution of distances between those nearest-neighbors, the distance metric being specified by 'metric'. Parameters ---------- ...
[ "This", "function", "computes", "a", "graph", "of", "nearest", "-", "neighbors", "for", "each", "sample", "point", "in", "data", "and", "returns", "the", "median", "of", "the", "distribution", "of", "distances", "between", "those", "nearest", "-", "neighbors",...
GGiecold/Density_Sampling
python
https://github.com/GGiecold/Density_Sampling/blob/8c8e6c63a97fecf958238e12947e5e6542b64102/Density_Sampling.py#L116-L144
[ "def", "median_min_distance", "(", "data", ",", "metric", ")", ":", "data", "=", "np", ".", "atleast_2d", "(", "data", ")", "nearest_distances", "=", "kneighbors_graph", "(", "data", ",", "1", ",", "mode", "=", "'distance'", ",", "metric", "=", "metric", ...
8c8e6c63a97fecf958238e12947e5e6542b64102
test
get_local_densities
For each sample point of the data-set 'data', estimate a local density in feature space by counting the number of neighboring data-points within a particular region centered around that sample point. Parameters ---------- data : array of shape (n_samples, n_features) The data-se...
Density_Sampling.py
def get_local_densities(data, kernel_mult = 2.0, metric = 'manhattan'): """For each sample point of the data-set 'data', estimate a local density in feature space by counting the number of neighboring data-points within a particular region centered around that sample point. Parameters -...
def get_local_densities(data, kernel_mult = 2.0, metric = 'manhattan'): """For each sample point of the data-set 'data', estimate a local density in feature space by counting the number of neighboring data-points within a particular region centered around that sample point. Parameters -...
[ "For", "each", "sample", "point", "of", "the", "data", "-", "set", "data", "estimate", "a", "local", "density", "in", "feature", "space", "by", "counting", "the", "number", "of", "neighboring", "data", "-", "points", "within", "a", "particular", "region", ...
GGiecold/Density_Sampling
python
https://github.com/GGiecold/Density_Sampling/blob/8c8e6c63a97fecf958238e12947e5e6542b64102/Density_Sampling.py#L147-L209
[ "def", "get_local_densities", "(", "data", ",", "kernel_mult", "=", "2.0", ",", "metric", "=", "'manhattan'", ")", ":", "data", "=", "np", ".", "atleast_2d", "(", "data", ")", "assert", "isinstance", "(", "kernel_mult", ",", "numbers", ".", "Real", ")", ...
8c8e6c63a97fecf958238e12947e5e6542b64102
test
density_sampling
The i-th sample point of the data-set 'data' is selected by density sampling with a probability given by: | 0 if outlier_density > LD[i]; P(keep the i-th data-point) = | 1 if outlier_density <= LD[i] <= target_density; ...
Density_Sampling.py
def density_sampling(data, local_densities = None, metric = 'manhattan', kernel_mult = 2.0, outlier_percentile = 0.01, target_percentile = 0.05, desired_samples = None): """The i-th sample point of the data-set 'data' is selected by density sampling with a probabi...
def density_sampling(data, local_densities = None, metric = 'manhattan', kernel_mult = 2.0, outlier_percentile = 0.01, target_percentile = 0.05, desired_samples = None): """The i-th sample point of the data-set 'data' is selected by density sampling with a probabi...
[ "The", "i", "-", "th", "sample", "point", "of", "the", "data", "-", "set", "data", "is", "selected", "by", "density", "sampling", "with", "a", "probability", "given", "by", ":", "|", "0", "if", "outlier_density", ">", "LD", "[", "i", "]", ";", "P", ...
GGiecold/Density_Sampling
python
https://github.com/GGiecold/Density_Sampling/blob/8c8e6c63a97fecf958238e12947e5e6542b64102/Density_Sampling.py#L212-L323
[ "def", "density_sampling", "(", "data", ",", "local_densities", "=", "None", ",", "metric", "=", "'manhattan'", ",", "kernel_mult", "=", "2.0", ",", "outlier_percentile", "=", "0.01", ",", "target_percentile", "=", "0.05", ",", "desired_samples", "=", "None", ...
8c8e6c63a97fecf958238e12947e5e6542b64102
test
Client.new
Creates a new cross-service client.
hbp_service_client/client.py
def new(cls, access_token, environment='prod'): '''Creates a new cross-service client.''' return cls( storage_client=StorageClient.new(access_token, environment=environment))
def new(cls, access_token, environment='prod'): '''Creates a new cross-service client.''' return cls( storage_client=StorageClient.new(access_token, environment=environment))
[ "Creates", "a", "new", "cross", "-", "service", "client", "." ]
HumanBrainProject/hbp-service-client
python
https://github.com/HumanBrainProject/hbp-service-client/blob/b338fb41a7f0e7b9d654ff28fcf13a56d03bff4d/hbp_service_client/client.py#L16-L20
[ "def", "new", "(", "cls", ",", "access_token", ",", "environment", "=", "'prod'", ")", ":", "return", "cls", "(", "storage_client", "=", "StorageClient", ".", "new", "(", "access_token", ",", "environment", "=", "environment", ")", ")" ]
b338fb41a7f0e7b9d654ff28fcf13a56d03bff4d
test
ApiClient.new
Create a new storage service REST client. Arguments: environment: The service environment to be used for the client access_token: The access token used to authenticate with the service Returns: A storage_service.api.ApiClient ...
hbp_service_client/storage_service/api.py
def new(cls, access_token, environment='prod'): '''Create a new storage service REST client. Arguments: environment: The service environment to be used for the client access_token: The access token used to authenticate with the service ...
def new(cls, access_token, environment='prod'): '''Create a new storage service REST client. Arguments: environment: The service environment to be used for the client access_token: The access token used to authenticate with the service ...
[ "Create", "a", "new", "storage", "service", "REST", "client", "." ]
HumanBrainProject/hbp-service-client
python
https://github.com/HumanBrainProject/hbp-service-client/blob/b338fb41a7f0e7b9d654ff28fcf13a56d03bff4d/hbp_service_client/storage_service/api.py#L46-L82
[ "def", "new", "(", "cls", ",", "access_token", ",", "environment", "=", "'prod'", ")", ":", "request", "=", "RequestBuilder", ".", "request", "(", "environment", ")", ".", "to_service", "(", "cls", ".", "SERVICE_NAME", ",", "cls", ".", "SERVICE_VERSION", "...
b338fb41a7f0e7b9d654ff28fcf13a56d03bff4d
test
ApiClient._prep_params
Remove empty (None) valued keywords and self from function parameters
hbp_service_client/storage_service/api.py
def _prep_params(params): '''Remove empty (None) valued keywords and self from function parameters''' return {k: v for (k, v) in params.items() if v is not None and k != 'self'}
def _prep_params(params): '''Remove empty (None) valued keywords and self from function parameters''' return {k: v for (k, v) in params.items() if v is not None and k != 'self'}
[ "Remove", "empty", "(", "None", ")", "valued", "keywords", "and", "self", "from", "function", "parameters" ]
HumanBrainProject/hbp-service-client
python
https://github.com/HumanBrainProject/hbp-service-client/blob/b338fb41a7f0e7b9d654ff28fcf13a56d03bff4d/hbp_service_client/storage_service/api.py#L85-L88
[ "def", "_prep_params", "(", "params", ")", ":", "return", "{", "k", ":", "v", "for", "(", "k", ",", "v", ")", "in", "params", ".", "items", "(", ")", "if", "v", "is", "not", "None", "and", "k", "!=", "'self'", "}" ]
b338fb41a7f0e7b9d654ff28fcf13a56d03bff4d
test
ApiClient.get_entity_details
Get generic entity by UUID. Args: entity_id (str): The UUID of the requested entity. Returns: A dictionary describing the entity:: { u'collab_id': 2271, u'created_by': u'303447', u'created_on': u'20...
hbp_service_client/storage_service/api.py
def get_entity_details(self, entity_id): '''Get generic entity by UUID. Args: entity_id (str): The UUID of the requested entity. Returns: A dictionary describing the entity:: { u'collab_id': 2271, u'created_by':...
def get_entity_details(self, entity_id): '''Get generic entity by UUID. Args: entity_id (str): The UUID of the requested entity. Returns: A dictionary describing the entity:: { u'collab_id': 2271, u'created_by':...
[ "Get", "generic", "entity", "by", "UUID", "." ]
HumanBrainProject/hbp-service-client
python
https://github.com/HumanBrainProject/hbp-service-client/blob/b338fb41a7f0e7b9d654ff28fcf13a56d03bff4d/hbp_service_client/storage_service/api.py#L90-L123
[ "def", "get_entity_details", "(", "self", ",", "entity_id", ")", ":", "if", "not", "is_valid_uuid", "(", "entity_id", ")", ":", "raise", "StorageArgumentException", "(", "'Invalid UUID for entity_id: {0}'", ".", "format", "(", "entity_id", ")", ")", "return", "sel...
b338fb41a7f0e7b9d654ff28fcf13a56d03bff4d
test
ApiClient.get_entity_by_query
Retrieve entity by query param which can be either uuid/path/metadata. Args: uuid (str): The UUID of the requested entity. path (str): The path of the requested entity. metadata (dict): A dictionary of one metadata {key: value} of the requested entitity. ...
hbp_service_client/storage_service/api.py
def get_entity_by_query(self, uuid=None, path=None, metadata=None): '''Retrieve entity by query param which can be either uuid/path/metadata. Args: uuid (str): The UUID of the requested entity. path (str): The path of the requested entity. metadata (dict): A dictiona...
def get_entity_by_query(self, uuid=None, path=None, metadata=None): '''Retrieve entity by query param which can be either uuid/path/metadata. Args: uuid (str): The UUID of the requested entity. path (str): The path of the requested entity. metadata (dict): A dictiona...
[ "Retrieve", "entity", "by", "query", "param", "which", "can", "be", "either", "uuid", "/", "path", "/", "metadata", "." ]
HumanBrainProject/hbp-service-client
python
https://github.com/HumanBrainProject/hbp-service-client/blob/b338fb41a7f0e7b9d654ff28fcf13a56d03bff4d/hbp_service_client/storage_service/api.py#L175-L225
[ "def", "get_entity_by_query", "(", "self", ",", "uuid", "=", "None", ",", "path", "=", "None", ",", "metadata", "=", "None", ")", ":", "if", "not", "(", "uuid", "or", "path", "or", "metadata", ")", ":", "raise", "StorageArgumentException", "(", "'No para...
b338fb41a7f0e7b9d654ff28fcf13a56d03bff4d
test
ApiClient.set_metadata
Set metadata for an entity. Args: entity_type (str): Type of the entity. Admitted values: ['project', 'folder', 'file']. entity_id (str): The UUID of the entity to be modified. metadata (dict): A dictionary of key/value pairs to be written as ...
hbp_service_client/storage_service/api.py
def set_metadata(self, entity_type, entity_id, metadata): '''Set metadata for an entity. Args: entity_type (str): Type of the entity. Admitted values: ['project', 'folder', 'file']. entity_id (str): The UUID of the entity to be modified. metadata (dic...
def set_metadata(self, entity_type, entity_id, metadata): '''Set metadata for an entity. Args: entity_type (str): Type of the entity. Admitted values: ['project', 'folder', 'file']. entity_id (str): The UUID of the entity to be modified. metadata (dic...
[ "Set", "metadata", "for", "an", "entity", "." ]
HumanBrainProject/hbp-service-client
python
https://github.com/HumanBrainProject/hbp-service-client/blob/b338fb41a7f0e7b9d654ff28fcf13a56d03bff4d/hbp_service_client/storage_service/api.py#L231-L269
[ "def", "set_metadata", "(", "self", ",", "entity_type", ",", "entity_id", ",", "metadata", ")", ":", "if", "not", "is_valid_uuid", "(", "entity_id", ")", ":", "raise", "StorageArgumentException", "(", "'Invalid UUID for entity_id: {0}'", ".", "format", "(", "entit...
b338fb41a7f0e7b9d654ff28fcf13a56d03bff4d
test
ApiClient.get_metadata
Get metadata of an entity. Args: entity_type (str): Type of the entity. Admitted values: ['project', 'folder', 'file']. entity_id (str): The UUID of the entity to be modified. Returns: A dictionary of the metadata:: { ...
hbp_service_client/storage_service/api.py
def get_metadata(self, entity_type, entity_id): '''Get metadata of an entity. Args: entity_type (str): Type of the entity. Admitted values: ['project', 'folder', 'file']. entity_id (str): The UUID of the entity to be modified. Returns: A dict...
def get_metadata(self, entity_type, entity_id): '''Get metadata of an entity. Args: entity_type (str): Type of the entity. Admitted values: ['project', 'folder', 'file']. entity_id (str): The UUID of the entity to be modified. Returns: A dict...
[ "Get", "metadata", "of", "an", "entity", "." ]
HumanBrainProject/hbp-service-client
python
https://github.com/HumanBrainProject/hbp-service-client/blob/b338fb41a7f0e7b9d654ff28fcf13a56d03bff4d/hbp_service_client/storage_service/api.py#L271-L300
[ "def", "get_metadata", "(", "self", ",", "entity_type", ",", "entity_id", ")", ":", "if", "not", "is_valid_uuid", "(", "entity_id", ")", ":", "raise", "StorageArgumentException", "(", "'Invalid UUID for entity_id: {0}'", ".", "format", "(", "entity_id", ")", ")", ...
b338fb41a7f0e7b9d654ff28fcf13a56d03bff4d
test
ApiClient.update_metadata
Update the metadata of an entity. Existing non-modified metadata will not be affected. Args: entity_type (str): Type of the entity. Admitted values: 'project', 'folder', 'file'. entity_id (str): The UUID of the entity to be modified. metadata (dict):...
hbp_service_client/storage_service/api.py
def update_metadata(self, entity_type, entity_id, metadata): '''Update the metadata of an entity. Existing non-modified metadata will not be affected. Args: entity_type (str): Type of the entity. Admitted values: 'project', 'folder', 'file'. entity_id (s...
def update_metadata(self, entity_type, entity_id, metadata): '''Update the metadata of an entity. Existing non-modified metadata will not be affected. Args: entity_type (str): Type of the entity. Admitted values: 'project', 'folder', 'file'. entity_id (s...
[ "Update", "the", "metadata", "of", "an", "entity", "." ]
HumanBrainProject/hbp-service-client
python
https://github.com/HumanBrainProject/hbp-service-client/blob/b338fb41a7f0e7b9d654ff28fcf13a56d03bff4d/hbp_service_client/storage_service/api.py#L302-L339
[ "def", "update_metadata", "(", "self", ",", "entity_type", ",", "entity_id", ",", "metadata", ")", ":", "if", "not", "is_valid_uuid", "(", "entity_id", ")", ":", "raise", "StorageArgumentException", "(", "'Invalid UUID for entity_id: {0}'", ".", "format", "(", "en...
b338fb41a7f0e7b9d654ff28fcf13a56d03bff4d
test
ApiClient.delete_metadata
Delete the selected metadata entries of an entity. Only deletes selected metadata keys, for a complete wipe, use set_metadata. Args: entity_type (str): Type of the entity. Admitted values: ['project', 'folder', 'file']. entity_id (srt): The UUID of the entity to...
hbp_service_client/storage_service/api.py
def delete_metadata(self, entity_type, entity_id, metadata_keys): '''Delete the selected metadata entries of an entity. Only deletes selected metadata keys, for a complete wipe, use set_metadata. Args: entity_type (str): Type of the entity. Admitted values: ['project', ...
def delete_metadata(self, entity_type, entity_id, metadata_keys): '''Delete the selected metadata entries of an entity. Only deletes selected metadata keys, for a complete wipe, use set_metadata. Args: entity_type (str): Type of the entity. Admitted values: ['project', ...
[ "Delete", "the", "selected", "metadata", "entries", "of", "an", "entity", "." ]
HumanBrainProject/hbp-service-client
python
https://github.com/HumanBrainProject/hbp-service-client/blob/b338fb41a7f0e7b9d654ff28fcf13a56d03bff4d/hbp_service_client/storage_service/api.py#L341-L377
[ "def", "delete_metadata", "(", "self", ",", "entity_type", ",", "entity_id", ",", "metadata_keys", ")", ":", "if", "not", "is_valid_uuid", "(", "entity_id", ")", ":", "raise", "StorageArgumentException", "(", "'Invalid UUID for entity_id: {0}'", ".", "format", "(", ...
b338fb41a7f0e7b9d654ff28fcf13a56d03bff4d
test
ApiClient.list_projects
List all the projects the user have access to. This function does not retrieve all results, pages have to be manually retrieved by the caller. Args: hpc (bool): If 'true', the result will contain only the HPC projects (Unicore projects). access (...
hbp_service_client/storage_service/api.py
def list_projects(self, hpc=None, access=None, name=None, collab_id=None, page_size=DEFAULT_PAGE_SIZE, page=None, ordering=None): '''List all the projects the user have access to. This function does not retrieve all results, pages have to be manually retrieved by t...
def list_projects(self, hpc=None, access=None, name=None, collab_id=None, page_size=DEFAULT_PAGE_SIZE, page=None, ordering=None): '''List all the projects the user have access to. This function does not retrieve all results, pages have to be manually retrieved by t...
[ "List", "all", "the", "projects", "the", "user", "have", "access", "to", "." ]
HumanBrainProject/hbp-service-client
python
https://github.com/HumanBrainProject/hbp-service-client/blob/b338fb41a7f0e7b9d654ff28fcf13a56d03bff4d/hbp_service_client/storage_service/api.py#L383-L433
[ "def", "list_projects", "(", "self", ",", "hpc", "=", "None", ",", "access", "=", "None", ",", "name", "=", "None", ",", "collab_id", "=", "None", ",", "page_size", "=", "DEFAULT_PAGE_SIZE", ",", "page", "=", "None", ",", "ordering", "=", "None", ")", ...
b338fb41a7f0e7b9d654ff28fcf13a56d03bff4d
test
ApiClient.get_project_details
Get information on a given project Args: project_id (str): The UUID of the requested project. Returns: A dictionary describing the project:: { u'collab_id': 2271, u'created_by': u'303447', u'created_on': u'2017-03-10T...
hbp_service_client/storage_service/api.py
def get_project_details(self, project_id): '''Get information on a given project Args: project_id (str): The UUID of the requested project. Returns: A dictionary describing the project:: { u'collab_id': 2271, u'created_by': u...
def get_project_details(self, project_id): '''Get information on a given project Args: project_id (str): The UUID of the requested project. Returns: A dictionary describing the project:: { u'collab_id': 2271, u'created_by': u...
[ "Get", "information", "on", "a", "given", "project" ]
HumanBrainProject/hbp-service-client
python
https://github.com/HumanBrainProject/hbp-service-client/blob/b338fb41a7f0e7b9d654ff28fcf13a56d03bff4d/hbp_service_client/storage_service/api.py#L435-L468
[ "def", "get_project_details", "(", "self", ",", "project_id", ")", ":", "if", "not", "is_valid_uuid", "(", "project_id", ")", ":", "raise", "StorageArgumentException", "(", "'Invalid UUID for project_id: {0}'", ".", "format", "(", "project_id", ")", ")", "return", ...
b338fb41a7f0e7b9d654ff28fcf13a56d03bff4d
test
ApiClient.create_project
Create a new project. Args: collab_id (int): The id of the collab the project should be created in. Returns: A dictionary of details of the created project:: { u'collab_id': 12998, u'created_by': u'303447', ...
hbp_service_client/storage_service/api.py
def create_project(self, collab_id): '''Create a new project. Args: collab_id (int): The id of the collab the project should be created in. Returns: A dictionary of details of the created project:: { u'collab_id': 12998, ...
def create_project(self, collab_id): '''Create a new project. Args: collab_id (int): The id of the collab the project should be created in. Returns: A dictionary of details of the created project:: { u'collab_id': 12998, ...
[ "Create", "a", "new", "project", "." ]
HumanBrainProject/hbp-service-client
python
https://github.com/HumanBrainProject/hbp-service-client/blob/b338fb41a7f0e7b9d654ff28fcf13a56d03bff4d/hbp_service_client/storage_service/api.py#L527-L557
[ "def", "create_project", "(", "self", ",", "collab_id", ")", ":", "return", "self", ".", "_authenticated_request", ".", "to_endpoint", "(", "'project/'", ")", ".", "with_json_body", "(", "self", ".", "_prep_params", "(", "locals", "(", ")", ")", ")", ".", ...
b338fb41a7f0e7b9d654ff28fcf13a56d03bff4d
test
ApiClient.delete_project
Delete a project. It will recursively delete all the content. Args: project (str): The UUID of the project to be deleted. Returns: None Raises: StorageArgumentException: Invalid arguments StorageForbiddenException: 403 StorageNotFoun...
hbp_service_client/storage_service/api.py
def delete_project(self, project): '''Delete a project. It will recursively delete all the content. Args: project (str): The UUID of the project to be deleted. Returns: None Raises: StorageArgumentException: Invalid arguments StorageForb...
def delete_project(self, project): '''Delete a project. It will recursively delete all the content. Args: project (str): The UUID of the project to be deleted. Returns: None Raises: StorageArgumentException: Invalid arguments StorageForb...
[ "Delete", "a", "project", ".", "It", "will", "recursively", "delete", "all", "the", "content", "." ]
HumanBrainProject/hbp-service-client
python
https://github.com/HumanBrainProject/hbp-service-client/blob/b338fb41a7f0e7b9d654ff28fcf13a56d03bff4d/hbp_service_client/storage_service/api.py#L559-L579
[ "def", "delete_project", "(", "self", ",", "project", ")", ":", "if", "not", "is_valid_uuid", "(", "project", ")", ":", "raise", "StorageArgumentException", "(", "'Invalid UUID for project: {0}'", ".", "format", "(", "project", ")", ")", "self", ".", "_authentic...
b338fb41a7f0e7b9d654ff28fcf13a56d03bff4d
test
ApiClient.create_folder
Create a new folder. Args: name (srt): The name of the folder. parent (str): The UUID of the parent entity. The parent must be a project or a folder. Returns: A dictionary of details of the created folder:: { u'cr...
hbp_service_client/storage_service/api.py
def create_folder(self, name, parent): '''Create a new folder. Args: name (srt): The name of the folder. parent (str): The UUID of the parent entity. The parent must be a project or a folder. Returns: A dictionary of details of the created fo...
def create_folder(self, name, parent): '''Create a new folder. Args: name (srt): The name of the folder. parent (str): The UUID of the parent entity. The parent must be a project or a folder. Returns: A dictionary of details of the created fo...
[ "Create", "a", "new", "folder", "." ]
HumanBrainProject/hbp-service-client
python
https://github.com/HumanBrainProject/hbp-service-client/blob/b338fb41a7f0e7b9d654ff28fcf13a56d03bff4d/hbp_service_client/storage_service/api.py#L585-L622
[ "def", "create_folder", "(", "self", ",", "name", ",", "parent", ")", ":", "if", "not", "is_valid_uuid", "(", "parent", ")", ":", "raise", "StorageArgumentException", "(", "'Invalid UUID for parent: {0}'", ".", "format", "(", "parent", ")", ")", "return", "sel...
b338fb41a7f0e7b9d654ff28fcf13a56d03bff4d
test
ApiClient.get_folder_details
Get information on a given folder. Args: folder (str): The UUID of the requested folder. Returns: A dictionary of the folder details if found:: { u'created_by': u'303447', u'created_on': u'2017-03-21T14:06:32.293902Z', ...
hbp_service_client/storage_service/api.py
def get_folder_details(self, folder): '''Get information on a given folder. Args: folder (str): The UUID of the requested folder. Returns: A dictionary of the folder details if found:: { u'created_by': u'303447', ...
def get_folder_details(self, folder): '''Get information on a given folder. Args: folder (str): The UUID of the requested folder. Returns: A dictionary of the folder details if found:: { u'created_by': u'303447', ...
[ "Get", "information", "on", "a", "given", "folder", "." ]
HumanBrainProject/hbp-service-client
python
https://github.com/HumanBrainProject/hbp-service-client/blob/b338fb41a7f0e7b9d654ff28fcf13a56d03bff4d/hbp_service_client/storage_service/api.py#L624-L657
[ "def", "get_folder_details", "(", "self", ",", "folder", ")", ":", "if", "not", "is_valid_uuid", "(", "folder", ")", ":", "raise", "StorageArgumentException", "(", "'Invalid UUID for folder: {0}'", ".", "format", "(", "folder", ")", ")", "return", "self", ".", ...
b338fb41a7f0e7b9d654ff28fcf13a56d03bff4d
test
ApiClient.list_folder_content
List files and folders (not recursively) contained in the folder. This function does not retrieve all results, pages have to be manually retrieved by the caller. Args: folder (str): The UUID of the requested folder. name (str): Optional filter on entity name. ...
hbp_service_client/storage_service/api.py
def list_folder_content(self, folder, name=None, entity_type=None, content_type=None, page_size=DEFAULT_PAGE_SIZE, page=None, ordering=None): '''List files and folders (not recursively) contained in the folder. This function does not retrieve all ...
def list_folder_content(self, folder, name=None, entity_type=None, content_type=None, page_size=DEFAULT_PAGE_SIZE, page=None, ordering=None): '''List files and folders (not recursively) contained in the folder. This function does not retrieve all ...
[ "List", "files", "and", "folders", "(", "not", "recursively", ")", "contained", "in", "the", "folder", "." ]
HumanBrainProject/hbp-service-client
python
https://github.com/HumanBrainProject/hbp-service-client/blob/b338fb41a7f0e7b9d654ff28fcf13a56d03bff4d/hbp_service_client/storage_service/api.py#L659-L715
[ "def", "list_folder_content", "(", "self", ",", "folder", ",", "name", "=", "None", ",", "entity_type", "=", "None", ",", "content_type", "=", "None", ",", "page_size", "=", "DEFAULT_PAGE_SIZE", ",", "page", "=", "None", ",", "ordering", "=", "None", ")", ...
b338fb41a7f0e7b9d654ff28fcf13a56d03bff4d
test
ApiClient.delete_folder
Delete a folder. It will recursively delete all the content. Args: folder_id (str): The UUID of the folder to be deleted. Returns: None Raises: StorageArgumentException: Invalid arguments StorageForbiddenException: 403 StorageNotFoun...
hbp_service_client/storage_service/api.py
def delete_folder(self, folder): '''Delete a folder. It will recursively delete all the content. Args: folder_id (str): The UUID of the folder to be deleted. Returns: None Raises: StorageArgumentException: Invalid arguments StorageForbid...
def delete_folder(self, folder): '''Delete a folder. It will recursively delete all the content. Args: folder_id (str): The UUID of the folder to be deleted. Returns: None Raises: StorageArgumentException: Invalid arguments StorageForbid...
[ "Delete", "a", "folder", ".", "It", "will", "recursively", "delete", "all", "the", "content", "." ]
HumanBrainProject/hbp-service-client
python
https://github.com/HumanBrainProject/hbp-service-client/blob/b338fb41a7f0e7b9d654ff28fcf13a56d03bff4d/hbp_service_client/storage_service/api.py#L717-L737
[ "def", "delete_folder", "(", "self", ",", "folder", ")", ":", "if", "not", "is_valid_uuid", "(", "folder", ")", ":", "raise", "StorageArgumentException", "(", "'Invalid UUID for folder: {0}'", ".", "format", "(", "folder", ")", ")", "self", ".", "_authenticated_...
b338fb41a7f0e7b9d654ff28fcf13a56d03bff4d
test
ApiClient.upload_file_content
Upload a file content. The file entity must already exist. If an ETag is provided the file stored on the server is verified against it. If it does not match, StorageException is raised. This means the client needs to update its knowledge of the resource before attempting to update again...
hbp_service_client/storage_service/api.py
def upload_file_content(self, file_id, etag=None, source=None, content=None): '''Upload a file content. The file entity must already exist. If an ETag is provided the file stored on the server is verified against it. If it does not match, StorageException is raised. This means the clien...
def upload_file_content(self, file_id, etag=None, source=None, content=None): '''Upload a file content. The file entity must already exist. If an ETag is provided the file stored on the server is verified against it. If it does not match, StorageException is raised. This means the clien...
[ "Upload", "a", "file", "content", ".", "The", "file", "entity", "must", "already", "exist", "." ]
HumanBrainProject/hbp-service-client
python
https://github.com/HumanBrainProject/hbp-service-client/blob/b338fb41a7f0e7b9d654ff28fcf13a56d03bff4d/hbp_service_client/storage_service/api.py#L819-L868
[ "def", "upload_file_content", "(", "self", ",", "file_id", ",", "etag", "=", "None", ",", "source", "=", "None", ",", "content", "=", "None", ")", ":", "if", "not", "is_valid_uuid", "(", "file_id", ")", ":", "raise", "StorageArgumentException", "(", "'Inva...
b338fb41a7f0e7b9d654ff28fcf13a56d03bff4d
test
ApiClient.copy_file_content
Copy file content from source file to target file. Args: file_id (str): The UUID of the file whose content is written. source_file (str): The UUID of the file whose content is copied. Returns: None Raises: StorageArgumentException: Invalid arguments...
hbp_service_client/storage_service/api.py
def copy_file_content(self, file_id, source_file): '''Copy file content from source file to target file. Args: file_id (str): The UUID of the file whose content is written. source_file (str): The UUID of the file whose content is copied. Returns: None ...
def copy_file_content(self, file_id, source_file): '''Copy file content from source file to target file. Args: file_id (str): The UUID of the file whose content is written. source_file (str): The UUID of the file whose content is copied. Returns: None ...
[ "Copy", "file", "content", "from", "source", "file", "to", "target", "file", "." ]
HumanBrainProject/hbp-service-client
python
https://github.com/HumanBrainProject/hbp-service-client/blob/b338fb41a7f0e7b9d654ff28fcf13a56d03bff4d/hbp_service_client/storage_service/api.py#L870-L897
[ "def", "copy_file_content", "(", "self", ",", "file_id", ",", "source_file", ")", ":", "if", "not", "is_valid_uuid", "(", "file_id", ")", ":", "raise", "StorageArgumentException", "(", "'Invalid UUID for file_id: {0}'", ".", "format", "(", "file_id", ")", ")", "...
b338fb41a7f0e7b9d654ff28fcf13a56d03bff4d
test
ApiClient.download_file_content
Download file content. Args: file_id (str): The UUID of the file whose content is requested etag (str): If the content is not changed since the provided ETag, the content won't be downloaded. If the content is changed, it will be downloaded and returned w...
hbp_service_client/storage_service/api.py
def download_file_content(self, file_id, etag=None): '''Download file content. Args: file_id (str): The UUID of the file whose content is requested etag (str): If the content is not changed since the provided ETag, the content won't be downloaded. If the content ...
def download_file_content(self, file_id, etag=None): '''Download file content. Args: file_id (str): The UUID of the file whose content is requested etag (str): If the content is not changed since the provided ETag, the content won't be downloaded. If the content ...
[ "Download", "file", "content", "." ]
HumanBrainProject/hbp-service-client
python
https://github.com/HumanBrainProject/hbp-service-client/blob/b338fb41a7f0e7b9d654ff28fcf13a56d03bff4d/hbp_service_client/storage_service/api.py#L899-L946
[ "def", "download_file_content", "(", "self", ",", "file_id", ",", "etag", "=", "None", ")", ":", "if", "not", "is_valid_uuid", "(", "file_id", ")", ":", "raise", "StorageArgumentException", "(", "'Invalid UUID for file_id: {0}'", ".", "format", "(", "file_id", "...
b338fb41a7f0e7b9d654ff28fcf13a56d03bff4d
test
ApiClient.get_signed_url
Get a signed unauthenticated URL. It can be used to download the file content without the need for a token. The signed URL expires after 5 seconds. Args: file_id (str): The UUID of the file to get the link for. Returns: The signed url as a string Raise...
hbp_service_client/storage_service/api.py
def get_signed_url(self, file_id): '''Get a signed unauthenticated URL. It can be used to download the file content without the need for a token. The signed URL expires after 5 seconds. Args: file_id (str): The UUID of the file to get the link for. Returns: ...
def get_signed_url(self, file_id): '''Get a signed unauthenticated URL. It can be used to download the file content without the need for a token. The signed URL expires after 5 seconds. Args: file_id (str): The UUID of the file to get the link for. Returns: ...
[ "Get", "a", "signed", "unauthenticated", "URL", "." ]
HumanBrainProject/hbp-service-client
python
https://github.com/HumanBrainProject/hbp-service-client/blob/b338fb41a7f0e7b9d654ff28fcf13a56d03bff4d/hbp_service_client/storage_service/api.py#L948-L973
[ "def", "get_signed_url", "(", "self", ",", "file_id", ")", ":", "if", "not", "is_valid_uuid", "(", "file_id", ")", ":", "raise", "StorageArgumentException", "(", "'Invalid UUID for file_id: {0}'", ".", "format", "(", "file_id", ")", ")", "return", "self", ".", ...
b338fb41a7f0e7b9d654ff28fcf13a56d03bff4d
test
ApiClient.delete_file
Delete a file. Args: file_id (str): The UUID of the file to delete. Returns: None Raises: StorageArgumentException: Invalid arguments StorageForbiddenException: Server response code 403 StorageNotFoundException: Server response code ...
hbp_service_client/storage_service/api.py
def delete_file(self, file_id): '''Delete a file. Args: file_id (str): The UUID of the file to delete. Returns: None Raises: StorageArgumentException: Invalid arguments StorageForbiddenException: Server response code 403 Stor...
def delete_file(self, file_id): '''Delete a file. Args: file_id (str): The UUID of the file to delete. Returns: None Raises: StorageArgumentException: Invalid arguments StorageForbiddenException: Server response code 403 Stor...
[ "Delete", "a", "file", "." ]
HumanBrainProject/hbp-service-client
python
https://github.com/HumanBrainProject/hbp-service-client/blob/b338fb41a7f0e7b9d654ff28fcf13a56d03bff4d/hbp_service_client/storage_service/api.py#L975-L996
[ "def", "delete_file", "(", "self", ",", "file_id", ")", ":", "if", "not", "is_valid_uuid", "(", "file_id", ")", ":", "raise", "StorageArgumentException", "(", "'Invalid UUID for file_id: {0}'", ".", "format", "(", "file_id", ")", ")", "self", ".", "_authenticate...
b338fb41a7f0e7b9d654ff28fcf13a56d03bff4d
test
MongoDBHandler.emit
pymongo expects a dict
jsonklog/handlers/mongodbhandler.py
def emit(self, record): """ pymongo expects a dict """ msg = self.format(record) if not isinstance(msg, dict): msg = json.loads(msg) self.collection.insert(msg)
def emit(self, record): """ pymongo expects a dict """ msg = self.format(record) if not isinstance(msg, dict): msg = json.loads(msg) self.collection.insert(msg)
[ "pymongo", "expects", "a", "dict" ]
neogenix/jsonklog
python
https://github.com/neogenix/jsonklog/blob/ac4b8f5b75b4a0be60ecad9e71d624bad08c3fa1/jsonklog/handlers/mongodbhandler.py#L35-L43
[ "def", "emit", "(", "self", ",", "record", ")", ":", "msg", "=", "self", ".", "format", "(", "record", ")", "if", "not", "isinstance", "(", "msg", ",", "dict", ")", ":", "msg", "=", "json", ".", "loads", "(", "msg", ")", "self", ".", "collection"...
ac4b8f5b75b4a0be60ecad9e71d624bad08c3fa1
test
RequestBuilder.to_service
Sets the service name and version the request should target Args: service (str): The name of the service as displayed in the services.json file version (str): The version of the service as displayed in the services.json file Returns: The request builder instance in ...
hbp_service_client/request/request_builder.py
def to_service(self, service, version): '''Sets the service name and version the request should target Args: service (str): The name of the service as displayed in the services.json file version (str): The version of the service as displayed in the services.json file Re...
def to_service(self, service, version): '''Sets the service name and version the request should target Args: service (str): The name of the service as displayed in the services.json file version (str): The version of the service as displayed in the services.json file Re...
[ "Sets", "the", "service", "name", "and", "version", "the", "request", "should", "target" ]
HumanBrainProject/hbp-service-client
python
https://github.com/HumanBrainProject/hbp-service-client/blob/b338fb41a7f0e7b9d654ff28fcf13a56d03bff4d/hbp_service_client/request/request_builder.py#L85-L96
[ "def", "to_service", "(", "self", ",", "service", ",", "version", ")", ":", "service_url", "=", "self", ".", "_service_locator", ".", "get_service_url", "(", "service", ",", "version", ")", "return", "self", ".", "__copy_and_set", "(", "'service_url'", ",", ...
b338fb41a7f0e7b9d654ff28fcf13a56d03bff4d