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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
train | MSSourceProvider.antenna1 | antenna1 data source | montblanc/impl/rime/tensorflow/sources/ms_source_provider.py | def antenna1(self, context):
""" antenna1 data source """
lrow, urow = MS.uvw_row_extents(context)
antenna1 = self._manager.ordered_uvw_table.getcol(
MS.ANTENNA1, startrow=lrow, nrow=urow-lrow)
return antenna1.reshape(context.shape).astype(context.dtype) | def antenna1(self, context):
""" antenna1 data source """
lrow, urow = MS.uvw_row_extents(context)
antenna1 = self._manager.ordered_uvw_table.getcol(
MS.ANTENNA1, startrow=lrow, nrow=urow-lrow)
return antenna1.reshape(context.shape).astype(context.dtype) | [
"antenna1",
"data",
"source"
] | ska-sa/montblanc | python | https://github.com/ska-sa/montblanc/blob/8a2e742e7500bcc6196489b735f87b233075dd2d/montblanc/impl/rime/tensorflow/sources/ms_source_provider.py#L143-L149 | [
"def",
"antenna1",
"(",
"self",
",",
"context",
")",
":",
"lrow",
",",
"urow",
"=",
"MS",
".",
"uvw_row_extents",
"(",
"context",
")",
"antenna1",
"=",
"self",
".",
"_manager",
".",
"ordered_uvw_table",
".",
"getcol",
"(",
"MS",
".",
"ANTENNA1",
",",
"... | 8a2e742e7500bcc6196489b735f87b233075dd2d |
train | MSSourceProvider.antenna2 | antenna2 data source | montblanc/impl/rime/tensorflow/sources/ms_source_provider.py | def antenna2(self, context):
""" antenna2 data source """
lrow, urow = MS.uvw_row_extents(context)
antenna2 = self._manager.ordered_uvw_table.getcol(
MS.ANTENNA2, startrow=lrow, nrow=urow-lrow)
return antenna2.reshape(context.shape).astype(context.dtype) | def antenna2(self, context):
""" antenna2 data source """
lrow, urow = MS.uvw_row_extents(context)
antenna2 = self._manager.ordered_uvw_table.getcol(
MS.ANTENNA2, startrow=lrow, nrow=urow-lrow)
return antenna2.reshape(context.shape).astype(context.dtype) | [
"antenna2",
"data",
"source"
] | ska-sa/montblanc | python | https://github.com/ska-sa/montblanc/blob/8a2e742e7500bcc6196489b735f87b233075dd2d/montblanc/impl/rime/tensorflow/sources/ms_source_provider.py#L151-L157 | [
"def",
"antenna2",
"(",
"self",
",",
"context",
")",
":",
"lrow",
",",
"urow",
"=",
"MS",
".",
"uvw_row_extents",
"(",
"context",
")",
"antenna2",
"=",
"self",
".",
"_manager",
".",
"ordered_uvw_table",
".",
"getcol",
"(",
"MS",
".",
"ANTENNA2",
",",
"... | 8a2e742e7500bcc6196489b735f87b233075dd2d |
train | MSSourceProvider.parallactic_angles | parallactic angle data source | montblanc/impl/rime/tensorflow/sources/ms_source_provider.py | def parallactic_angles(self, context):
""" parallactic angle data source """
# Time and antenna extents
(lt, ut), (la, ua) = context.dim_extents('ntime', 'na')
return (mbu.parallactic_angles(self._times[lt:ut],
self._antenna_positions[la:ua], self._phase_dir)
... | def parallactic_angles(self, context):
""" parallactic angle data source """
# Time and antenna extents
(lt, ut), (la, ua) = context.dim_extents('ntime', 'na')
return (mbu.parallactic_angles(self._times[lt:ut],
self._antenna_positions[la:ua], self._phase_dir)
... | [
"parallactic",
"angle",
"data",
"source"
] | ska-sa/montblanc | python | https://github.com/ska-sa/montblanc/blob/8a2e742e7500bcc6196489b735f87b233075dd2d/montblanc/impl/rime/tensorflow/sources/ms_source_provider.py#L159-L167 | [
"def",
"parallactic_angles",
"(",
"self",
",",
"context",
")",
":",
"# Time and antenna extents",
"(",
"lt",
",",
"ut",
")",
",",
"(",
"la",
",",
"ua",
")",
"=",
"context",
".",
"dim_extents",
"(",
"'ntime'",
",",
"'na'",
")",
"return",
"(",
"mbu",
"."... | 8a2e742e7500bcc6196489b735f87b233075dd2d |
train | MSSourceProvider.observed_vis | Observed visibility data source | montblanc/impl/rime/tensorflow/sources/ms_source_provider.py | def observed_vis(self, context):
""" Observed visibility data source """
lrow, urow = MS.row_extents(context)
data = self._manager.ordered_main_table.getcol(
self._vis_column, startrow=lrow, nrow=urow-lrow)
return data.reshape(context.shape).astype(context.dtype) | def observed_vis(self, context):
""" Observed visibility data source """
lrow, urow = MS.row_extents(context)
data = self._manager.ordered_main_table.getcol(
self._vis_column, startrow=lrow, nrow=urow-lrow)
return data.reshape(context.shape).astype(context.dtype) | [
"Observed",
"visibility",
"data",
"source"
] | ska-sa/montblanc | python | https://github.com/ska-sa/montblanc/blob/8a2e742e7500bcc6196489b735f87b233075dd2d/montblanc/impl/rime/tensorflow/sources/ms_source_provider.py#L170-L177 | [
"def",
"observed_vis",
"(",
"self",
",",
"context",
")",
":",
"lrow",
",",
"urow",
"=",
"MS",
".",
"row_extents",
"(",
"context",
")",
"data",
"=",
"self",
".",
"_manager",
".",
"ordered_main_table",
".",
"getcol",
"(",
"self",
".",
"_vis_column",
",",
... | 8a2e742e7500bcc6196489b735f87b233075dd2d |
train | MSSourceProvider.flag | Flag data source | montblanc/impl/rime/tensorflow/sources/ms_source_provider.py | def flag(self, context):
""" Flag data source """
lrow, urow = MS.row_extents(context)
flag = self._manager.ordered_main_table.getcol(
MS.FLAG, startrow=lrow, nrow=urow-lrow)
return flag.reshape(context.shape).astype(context.dtype) | def flag(self, context):
""" Flag data source """
lrow, urow = MS.row_extents(context)
flag = self._manager.ordered_main_table.getcol(
MS.FLAG, startrow=lrow, nrow=urow-lrow)
return flag.reshape(context.shape).astype(context.dtype) | [
"Flag",
"data",
"source"
] | ska-sa/montblanc | python | https://github.com/ska-sa/montblanc/blob/8a2e742e7500bcc6196489b735f87b233075dd2d/montblanc/impl/rime/tensorflow/sources/ms_source_provider.py#L179-L186 | [
"def",
"flag",
"(",
"self",
",",
"context",
")",
":",
"lrow",
",",
"urow",
"=",
"MS",
".",
"row_extents",
"(",
"context",
")",
"flag",
"=",
"self",
".",
"_manager",
".",
"ordered_main_table",
".",
"getcol",
"(",
"MS",
".",
"FLAG",
",",
"startrow",
"=... | 8a2e742e7500bcc6196489b735f87b233075dd2d |
train | MSSourceProvider.weight | Weight data source | montblanc/impl/rime/tensorflow/sources/ms_source_provider.py | def weight(self, context):
""" Weight data source """
lrow, urow = MS.row_extents(context)
weight = self._manager.ordered_main_table.getcol(
MS.WEIGHT, startrow=lrow, nrow=urow-lrow)
# WEIGHT is applied across all channels
weight = np.repeat(weight, self._manager.ch... | def weight(self, context):
""" Weight data source """
lrow, urow = MS.row_extents(context)
weight = self._manager.ordered_main_table.getcol(
MS.WEIGHT, startrow=lrow, nrow=urow-lrow)
# WEIGHT is applied across all channels
weight = np.repeat(weight, self._manager.ch... | [
"Weight",
"data",
"source"
] | ska-sa/montblanc | python | https://github.com/ska-sa/montblanc/blob/8a2e742e7500bcc6196489b735f87b233075dd2d/montblanc/impl/rime/tensorflow/sources/ms_source_provider.py#L188-L197 | [
"def",
"weight",
"(",
"self",
",",
"context",
")",
":",
"lrow",
",",
"urow",
"=",
"MS",
".",
"row_extents",
"(",
"context",
")",
"weight",
"=",
"self",
".",
"_manager",
".",
"ordered_main_table",
".",
"getcol",
"(",
"MS",
".",
"WEIGHT",
",",
"startrow"... | 8a2e742e7500bcc6196489b735f87b233075dd2d |
train | load_tf_lib | Load the tensorflow library | montblanc/impl/rime/tensorflow/__init__.py | def load_tf_lib():
""" Load the tensorflow library """
from os.path import join as pjoin
import pkg_resources
import tensorflow as tf
path = pjoin('ext', 'rime.so')
rime_lib_path = pkg_resources.resource_filename("montblanc", path)
return tf.load_op_library(rime_lib_path) | def load_tf_lib():
""" Load the tensorflow library """
from os.path import join as pjoin
import pkg_resources
import tensorflow as tf
path = pjoin('ext', 'rime.so')
rime_lib_path = pkg_resources.resource_filename("montblanc", path)
return tf.load_op_library(rime_lib_path) | [
"Load",
"the",
"tensorflow",
"library"
] | ska-sa/montblanc | python | https://github.com/ska-sa/montblanc/blob/8a2e742e7500bcc6196489b735f87b233075dd2d/montblanc/impl/rime/tensorflow/__init__.py#L21-L30 | [
"def",
"load_tf_lib",
"(",
")",
":",
"from",
"os",
".",
"path",
"import",
"join",
"as",
"pjoin",
"import",
"pkg_resources",
"import",
"tensorflow",
"as",
"tf",
"path",
"=",
"pjoin",
"(",
"'ext'",
",",
"'rime.so'",
")",
"rime_lib_path",
"=",
"pkg_resources",
... | 8a2e742e7500bcc6196489b735f87b233075dd2d |
train | raise_validator_errors | Raise any errors associated with the validator.
Parameters
----------
validator : :class:`cerberus.Validator`
Validator
Raises
------
ValueError
Raised if errors existed on `validator`.
Message describing each error and information
associated with the configurat... | montblanc/configuration.py | def raise_validator_errors(validator):
"""
Raise any errors associated with the validator.
Parameters
----------
validator : :class:`cerberus.Validator`
Validator
Raises
------
ValueError
Raised if errors existed on `validator`.
Message describing each error and... | def raise_validator_errors(validator):
"""
Raise any errors associated with the validator.
Parameters
----------
validator : :class:`cerberus.Validator`
Validator
Raises
------
ValueError
Raised if errors existed on `validator`.
Message describing each error and... | [
"Raise",
"any",
"errors",
"associated",
"with",
"the",
"validator",
"."
] | ska-sa/montblanc | python | https://github.com/ska-sa/montblanc/blob/8a2e742e7500bcc6196489b735f87b233075dd2d/montblanc/configuration.py#L10-L73 | [
"def",
"raise_validator_errors",
"(",
"validator",
")",
":",
"if",
"len",
"(",
"validator",
".",
"_errors",
")",
"==",
"0",
":",
"return",
"def",
"_path_str",
"(",
"path",
",",
"name",
"=",
"None",
")",
":",
"\"\"\" String of the document/schema path. `cfg[\"foo... | 8a2e742e7500bcc6196489b735f87b233075dd2d |
train | indented | Take a multiline text and indent it as a block | winshell.py | def indented(text, level, indent=2):
"""Take a multiline text and indent it as a block"""
return "\n".join("%s%s" % (level * indent * " ", s) for s in text.splitlines()) | def indented(text, level, indent=2):
"""Take a multiline text and indent it as a block"""
return "\n".join("%s%s" % (level * indent * " ", s) for s in text.splitlines()) | [
"Take",
"a",
"multiline",
"text",
"and",
"indent",
"it",
"as",
"a",
"block"
] | tjguk/winshell | python | https://github.com/tjguk/winshell/blob/1509d211ab3403dd1cff6113e4e13462d6dec35b/winshell.py#L83-L85 | [
"def",
"indented",
"(",
"text",
",",
"level",
",",
"indent",
"=",
"2",
")",
":",
"return",
"\"\\n\"",
".",
"join",
"(",
"\"%s%s\"",
"%",
"(",
"level",
"*",
"indent",
"*",
"\" \"",
",",
"s",
")",
"for",
"s",
"in",
"text",
".",
"splitlines",
"(",
"... | 1509d211ab3403dd1cff6113e4e13462d6dec35b |
train | dumped | Put curly brackets round an indented text | winshell.py | def dumped(text, level, indent=2):
"""Put curly brackets round an indented text"""
return indented("{\n%s\n}" % indented(text, level + 1, indent) or "None", level, indent) + "\n" | def dumped(text, level, indent=2):
"""Put curly brackets round an indented text"""
return indented("{\n%s\n}" % indented(text, level + 1, indent) or "None", level, indent) + "\n" | [
"Put",
"curly",
"brackets",
"round",
"an",
"indented",
"text"
] | tjguk/winshell | python | https://github.com/tjguk/winshell/blob/1509d211ab3403dd1cff6113e4e13462d6dec35b/winshell.py#L87-L89 | [
"def",
"dumped",
"(",
"text",
",",
"level",
",",
"indent",
"=",
"2",
")",
":",
"return",
"indented",
"(",
"\"{\\n%s\\n}\"",
"%",
"indented",
"(",
"text",
",",
"level",
"+",
"1",
",",
"indent",
")",
"or",
"\"None\"",
",",
"level",
",",
"indent",
")",
... | 1509d211ab3403dd1cff6113e4e13462d6dec35b |
train | copy_file | Perform a shell-based file copy. Copying in
this way allows the possibility of undo, auto-renaming,
and showing the "flying file" animation during the copy.
The default options allow for undo, don't automatically
clobber on a name clash, automatically rename on collision
and display the animation. | winshell.py | def copy_file(
source_path,
target_path,
allow_undo=True,
no_confirm=False,
rename_on_collision=True,
silent=False,
extra_flags=0,
hWnd=None
):
"""Perform a shell-based file copy. Copying in
this way allows the possibility of undo, auto-renaming,
and showing the "flying file"... | def copy_file(
source_path,
target_path,
allow_undo=True,
no_confirm=False,
rename_on_collision=True,
silent=False,
extra_flags=0,
hWnd=None
):
"""Perform a shell-based file copy. Copying in
this way allows the possibility of undo, auto-renaming,
and showing the "flying file"... | [
"Perform",
"a",
"shell",
"-",
"based",
"file",
"copy",
".",
"Copying",
"in",
"this",
"way",
"allows",
"the",
"possibility",
"of",
"undo",
"auto",
"-",
"renaming",
"and",
"showing",
"the",
"flying",
"file",
"animation",
"during",
"the",
"copy",
"."
] | tjguk/winshell | python | https://github.com/tjguk/winshell/blob/1509d211ab3403dd1cff6113e4e13462d6dec35b/winshell.py#L266-L294 | [
"def",
"copy_file",
"(",
"source_path",
",",
"target_path",
",",
"allow_undo",
"=",
"True",
",",
"no_confirm",
"=",
"False",
",",
"rename_on_collision",
"=",
"True",
",",
"silent",
"=",
"False",
",",
"extra_flags",
"=",
"0",
",",
"hWnd",
"=",
"None",
")",
... | 1509d211ab3403dd1cff6113e4e13462d6dec35b |
train | move_file | Perform a shell-based file move. Moving in
this way allows the possibility of undo, auto-renaming,
and showing the "flying file" animation during the copy.
The default options allow for undo, don't automatically
clobber on a name clash, automatically rename on collision
and display the animation. | winshell.py | def move_file(
source_path,
target_path,
allow_undo=True,
no_confirm=False,
rename_on_collision=True,
silent=False,
extra_flags=0,
hWnd=None
):
"""Perform a shell-based file move. Moving in
this way allows the possibility of undo, auto-renaming,
and showing the "flying file" ... | def move_file(
source_path,
target_path,
allow_undo=True,
no_confirm=False,
rename_on_collision=True,
silent=False,
extra_flags=0,
hWnd=None
):
"""Perform a shell-based file move. Moving in
this way allows the possibility of undo, auto-renaming,
and showing the "flying file" ... | [
"Perform",
"a",
"shell",
"-",
"based",
"file",
"move",
".",
"Moving",
"in",
"this",
"way",
"allows",
"the",
"possibility",
"of",
"undo",
"auto",
"-",
"renaming",
"and",
"showing",
"the",
"flying",
"file",
"animation",
"during",
"the",
"copy",
"."
] | tjguk/winshell | python | https://github.com/tjguk/winshell/blob/1509d211ab3403dd1cff6113e4e13462d6dec35b/winshell.py#L296-L324 | [
"def",
"move_file",
"(",
"source_path",
",",
"target_path",
",",
"allow_undo",
"=",
"True",
",",
"no_confirm",
"=",
"False",
",",
"rename_on_collision",
"=",
"True",
",",
"silent",
"=",
"False",
",",
"extra_flags",
"=",
"0",
",",
"hWnd",
"=",
"None",
")",
... | 1509d211ab3403dd1cff6113e4e13462d6dec35b |
train | rename_file | Perform a shell-based file rename. Renaming in
this way allows the possibility of undo, auto-renaming,
and showing the "flying file" animation during the copy.
The default options allow for undo, don't automatically
clobber on a name clash, automatically rename on collision
and display the animatio... | winshell.py | def rename_file(
source_path,
target_path,
allow_undo=True,
no_confirm=False,
rename_on_collision=True,
silent=False,
extra_flags=0,
hWnd=None
):
"""Perform a shell-based file rename. Renaming in
this way allows the possibility of undo, auto-renaming,
and showing the "flying ... | def rename_file(
source_path,
target_path,
allow_undo=True,
no_confirm=False,
rename_on_collision=True,
silent=False,
extra_flags=0,
hWnd=None
):
"""Perform a shell-based file rename. Renaming in
this way allows the possibility of undo, auto-renaming,
and showing the "flying ... | [
"Perform",
"a",
"shell",
"-",
"based",
"file",
"rename",
".",
"Renaming",
"in",
"this",
"way",
"allows",
"the",
"possibility",
"of",
"undo",
"auto",
"-",
"renaming",
"and",
"showing",
"the",
"flying",
"file",
"animation",
"during",
"the",
"copy",
"."
] | tjguk/winshell | python | https://github.com/tjguk/winshell/blob/1509d211ab3403dd1cff6113e4e13462d6dec35b/winshell.py#L326-L354 | [
"def",
"rename_file",
"(",
"source_path",
",",
"target_path",
",",
"allow_undo",
"=",
"True",
",",
"no_confirm",
"=",
"False",
",",
"rename_on_collision",
"=",
"True",
",",
"silent",
"=",
"False",
",",
"extra_flags",
"=",
"0",
",",
"hWnd",
"=",
"None",
")"... | 1509d211ab3403dd1cff6113e4e13462d6dec35b |
train | delete_file | Perform a shell-based file delete. Deleting in
this way uses the system recycle bin, allows the
possibility of undo, and showing the "flying file"
animation during the delete.
The default options allow for undo, don't automatically
clobber on a name clash and display the animation. | winshell.py | def delete_file(
source_path,
allow_undo=True,
no_confirm=False,
silent=False,
extra_flags=0,
hWnd=None
):
"""Perform a shell-based file delete. Deleting in
this way uses the system recycle bin, allows the
possibility of undo, and showing the "flying file"
animation during the de... | def delete_file(
source_path,
allow_undo=True,
no_confirm=False,
silent=False,
extra_flags=0,
hWnd=None
):
"""Perform a shell-based file delete. Deleting in
this way uses the system recycle bin, allows the
possibility of undo, and showing the "flying file"
animation during the de... | [
"Perform",
"a",
"shell",
"-",
"based",
"file",
"delete",
".",
"Deleting",
"in",
"this",
"way",
"uses",
"the",
"system",
"recycle",
"bin",
"allows",
"the",
"possibility",
"of",
"undo",
"and",
"showing",
"the",
"flying",
"file",
"animation",
"during",
"the",
... | tjguk/winshell | python | https://github.com/tjguk/winshell/blob/1509d211ab3403dd1cff6113e4e13462d6dec35b/winshell.py#L356-L382 | [
"def",
"delete_file",
"(",
"source_path",
",",
"allow_undo",
"=",
"True",
",",
"no_confirm",
"=",
"False",
",",
"silent",
"=",
"False",
",",
"extra_flags",
"=",
"0",
",",
"hWnd",
"=",
"None",
")",
":",
"return",
"_file_operation",
"(",
"shellcon",
".",
"... | 1509d211ab3403dd1cff6113e4e13462d6dec35b |
train | structured_storage | Pick out info from MS documents with embedded
structured storage(typically MS Word docs etc.)
Returns a dictionary of information found | winshell.py | def structured_storage(filename):
"""Pick out info from MS documents with embedded
structured storage(typically MS Word docs etc.)
Returns a dictionary of information found
"""
if not pythoncom.StgIsStorageFile(filename):
return {}
flags = storagecon.STGM_READ | storagecon.STGM_SHARE... | def structured_storage(filename):
"""Pick out info from MS documents with embedded
structured storage(typically MS Word docs etc.)
Returns a dictionary of information found
"""
if not pythoncom.StgIsStorageFile(filename):
return {}
flags = storagecon.STGM_READ | storagecon.STGM_SHARE... | [
"Pick",
"out",
"info",
"from",
"MS",
"documents",
"with",
"embedded",
"structured",
"storage",
"(",
"typically",
"MS",
"Word",
"docs",
"etc",
".",
")"
] | tjguk/winshell | python | https://github.com/tjguk/winshell/blob/1509d211ab3403dd1cff6113e4e13462d6dec35b/winshell.py#L586-L645 | [
"def",
"structured_storage",
"(",
"filename",
")",
":",
"if",
"not",
"pythoncom",
".",
"StgIsStorageFile",
"(",
"filename",
")",
":",
"return",
"{",
"}",
"flags",
"=",
"storagecon",
".",
"STGM_READ",
"|",
"storagecon",
".",
"STGM_SHARE_EXCLUSIVE",
"storage",
"... | 1509d211ab3403dd1cff6113e4e13462d6dec35b |
train | CreateShortcut | Create a Windows shortcut:
Path - As what file should the shortcut be created?
Target - What command should the desktop use?
Arguments - What arguments should be supplied to the command?
StartIn - What folder should the command start in?
Icon -(filename, index) What icon should be used for the shor... | winshell.py | def CreateShortcut(Path, Target, Arguments="", StartIn="", Icon=("", 0), Description=""):
"""Create a Windows shortcut:
Path - As what file should the shortcut be created?
Target - What command should the desktop use?
Arguments - What arguments should be supplied to the command?
StartIn - What fold... | def CreateShortcut(Path, Target, Arguments="", StartIn="", Icon=("", 0), Description=""):
"""Create a Windows shortcut:
Path - As what file should the shortcut be created?
Target - What command should the desktop use?
Arguments - What arguments should be supplied to the command?
StartIn - What fold... | [
"Create",
"a",
"Windows",
"shortcut",
":"
] | tjguk/winshell | python | https://github.com/tjguk/winshell/blob/1509d211ab3403dd1cff6113e4e13462d6dec35b/winshell.py#L1084-L1107 | [
"def",
"CreateShortcut",
"(",
"Path",
",",
"Target",
",",
"Arguments",
"=",
"\"\"",
",",
"StartIn",
"=",
"\"\"",
",",
"Icon",
"=",
"(",
"\"\"",
",",
"0",
")",
",",
"Description",
"=",
"\"\"",
")",
":",
"lnk",
"=",
"shortcut",
"(",
"Target",
")",
"l... | 1509d211ab3403dd1cff6113e4e13462d6dec35b |
train | ShellRecycleBin.undelete | Restore the most recent version of a filepath, returning
the filepath it was restored to(as rename-on-collision will
apply if a file already exists at that path). | winshell.py | def undelete(self, original_filepath):
"""Restore the most recent version of a filepath, returning
the filepath it was restored to(as rename-on-collision will
apply if a file already exists at that path).
"""
candidates = self.versions(original_filepath)
if not candidates... | def undelete(self, original_filepath):
"""Restore the most recent version of a filepath, returning
the filepath it was restored to(as rename-on-collision will
apply if a file already exists at that path).
"""
candidates = self.versions(original_filepath)
if not candidates... | [
"Restore",
"the",
"most",
"recent",
"version",
"of",
"a",
"filepath",
"returning",
"the",
"filepath",
"it",
"was",
"restored",
"to",
"(",
"as",
"rename",
"-",
"on",
"-",
"collision",
"will",
"apply",
"if",
"a",
"file",
"already",
"exists",
"at",
"that",
... | tjguk/winshell | python | https://github.com/tjguk/winshell/blob/1509d211ab3403dd1cff6113e4e13462d6dec35b/winshell.py#L937-L949 | [
"def",
"undelete",
"(",
"self",
",",
"original_filepath",
")",
":",
"candidates",
"=",
"self",
".",
"versions",
"(",
"original_filepath",
")",
"if",
"not",
"candidates",
":",
"raise",
"x_not_found_in_recycle_bin",
"(",
"\"%s not found in the Recycle Bin\"",
"%",
"or... | 1509d211ab3403dd1cff6113e4e13462d6dec35b |
train | _get_queue_types | Given a list of arrays to feed in fed_arrays, return
a list of associated queue types, obtained from tuples
in the data_sources dictionary | montblanc/impl/rime/tensorflow/queue_wrapper.py | def _get_queue_types(fed_arrays, data_sources):
"""
Given a list of arrays to feed in fed_arrays, return
a list of associated queue types, obtained from tuples
in the data_sources dictionary
"""
try:
return [data_sources[n].dtype for n in fed_arrays]
except KeyError as e:
rai... | def _get_queue_types(fed_arrays, data_sources):
"""
Given a list of arrays to feed in fed_arrays, return
a list of associated queue types, obtained from tuples
in the data_sources dictionary
"""
try:
return [data_sources[n].dtype for n in fed_arrays]
except KeyError as e:
rai... | [
"Given",
"a",
"list",
"of",
"arrays",
"to",
"feed",
"in",
"fed_arrays",
"return",
"a",
"list",
"of",
"associated",
"queue",
"types",
"obtained",
"from",
"tuples",
"in",
"the",
"data_sources",
"dictionary"
] | ska-sa/montblanc | python | https://github.com/ska-sa/montblanc/blob/8a2e742e7500bcc6196489b735f87b233075dd2d/montblanc/impl/rime/tensorflow/queue_wrapper.py#L8-L18 | [
"def",
"_get_queue_types",
"(",
"fed_arrays",
",",
"data_sources",
")",
":",
"try",
":",
"return",
"[",
"data_sources",
"[",
"n",
"]",
".",
"dtype",
"for",
"n",
"in",
"fed_arrays",
"]",
"except",
"KeyError",
"as",
"e",
":",
"raise",
"ValueError",
"(",
"\... | 8a2e742e7500bcc6196489b735f87b233075dd2d |
train | create_queue_wrapper | Arguments
name: string
Name of the queue
queue_size: integer
Size of the queue
fed_arrays: list
array names that will be fed by this queue
data_sources: dict
(lambda/method, dtype) tuples, keyed on array names | montblanc/impl/rime/tensorflow/queue_wrapper.py | def create_queue_wrapper(name, queue_size, fed_arrays, data_sources, *args, **kwargs):
"""
Arguments
name: string
Name of the queue
queue_size: integer
Size of the queue
fed_arrays: list
array names that will be fed by this queue
data_sources: ... | def create_queue_wrapper(name, queue_size, fed_arrays, data_sources, *args, **kwargs):
"""
Arguments
name: string
Name of the queue
queue_size: integer
Size of the queue
fed_arrays: list
array names that will be fed by this queue
data_sources: ... | [
"Arguments",
"name",
":",
"string",
"Name",
"of",
"the",
"queue",
"queue_size",
":",
"integer",
"Size",
"of",
"the",
"queue",
"fed_arrays",
":",
"list",
"array",
"names",
"that",
"will",
"be",
"fed",
"by",
"this",
"queue",
"data_sources",
":",
"dict",
"(",... | ska-sa/montblanc | python | https://github.com/ska-sa/montblanc/blob/8a2e742e7500bcc6196489b735f87b233075dd2d/montblanc/impl/rime/tensorflow/queue_wrapper.py#L152-L167 | [
"def",
"create_queue_wrapper",
"(",
"name",
",",
"queue_size",
",",
"fed_arrays",
",",
"data_sources",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"qtype",
"=",
"SingleInputMultiQueueWrapper",
"if",
"'count'",
"in",
"kwargs",
"else",
"QueueWrapper",
"... | 8a2e742e7500bcc6196489b735f87b233075dd2d |
train | parse_python_assigns | Parses a string, containing assign statements
into a dictionary.
.. code-block:: python
h5 = katdal.open('123456789.h5')
kwargs = parse_python_assigns("spw=3; scans=[1,2];"
"targets='bpcal,radec';"
"channels=slice(0,20... | montblanc/util/parsing.py | def parse_python_assigns(assign_str):
"""
Parses a string, containing assign statements
into a dictionary.
.. code-block:: python
h5 = katdal.open('123456789.h5')
kwargs = parse_python_assigns("spw=3; scans=[1,2];"
"targets='bpcal,radec';"
... | def parse_python_assigns(assign_str):
"""
Parses a string, containing assign statements
into a dictionary.
.. code-block:: python
h5 = katdal.open('123456789.h5')
kwargs = parse_python_assigns("spw=3; scans=[1,2];"
"targets='bpcal,radec';"
... | [
"Parses",
"a",
"string",
"containing",
"assign",
"statements",
"into",
"a",
"dictionary",
"."
] | ska-sa/montblanc | python | https://github.com/ska-sa/montblanc/blob/8a2e742e7500bcc6196489b735f87b233075dd2d/montblanc/util/parsing.py#L12-L122 | [
"def",
"parse_python_assigns",
"(",
"assign_str",
")",
":",
"if",
"not",
"assign_str",
":",
"return",
"{",
"}",
"def",
"_eval_value",
"(",
"stmt_value",
")",
":",
"# If the statement value is a call to a builtin, try evaluate it",
"if",
"isinstance",
"(",
"stmt_value",
... | 8a2e742e7500bcc6196489b735f87b233075dd2d |
train | find_sinks | Returns a dictionary of sink methods found on this object,
keyed on method name. Sink methods are identified by
(self, context) arguments on this object. For example:
def f(self, context):
...
is a sink method, but
def f(self, ctx):
...
is not. | montblanc/impl/rime/tensorflow/sinks/sink_provider.py | def find_sinks(obj):
"""
Returns a dictionary of sink methods found on this object,
keyed on method name. Sink methods are identified by
(self, context) arguments on this object. For example:
def f(self, context):
...
is a sink method, but
def f(self, ctx):
...
is not... | def find_sinks(obj):
"""
Returns a dictionary of sink methods found on this object,
keyed on method name. Sink methods are identified by
(self, context) arguments on this object. For example:
def f(self, context):
...
is a sink method, but
def f(self, ctx):
...
is not... | [
"Returns",
"a",
"dictionary",
"of",
"sink",
"methods",
"found",
"on",
"this",
"object",
"keyed",
"on",
"method",
"name",
".",
"Sink",
"methods",
"are",
"identified",
"by",
"(",
"self",
"context",
")",
"arguments",
"on",
"this",
"object",
".",
"For",
"examp... | ska-sa/montblanc | python | https://github.com/ska-sa/montblanc/blob/8a2e742e7500bcc6196489b735f87b233075dd2d/montblanc/impl/rime/tensorflow/sinks/sink_provider.py#L53-L73 | [
"def",
"find_sinks",
"(",
"obj",
")",
":",
"SINK_ARGSPEC",
"=",
"[",
"'self'",
",",
"'context'",
"]",
"return",
"{",
"n",
":",
"m",
"for",
"n",
",",
"m",
"in",
"inspect",
".",
"getmembers",
"(",
"obj",
",",
"inspect",
".",
"ismethod",
")",
"if",
"i... | 8a2e742e7500bcc6196489b735f87b233075dd2d |
train | SinkProvider.sinks | Returns a dictionary of sink methods found on this object,
keyed on method name. Sink methods are identified by
(self, context) arguments on this object. For example:
def f(self, context):
...
is a sink method, but
def f(self, ctx):
...
is not. | montblanc/impl/rime/tensorflow/sinks/sink_provider.py | def sinks(self):
"""
Returns a dictionary of sink methods found on this object,
keyed on method name. Sink methods are identified by
(self, context) arguments on this object. For example:
def f(self, context):
...
is a sink method, but
def f(self, c... | def sinks(self):
"""
Returns a dictionary of sink methods found on this object,
keyed on method name. Sink methods are identified by
(self, context) arguments on this object. For example:
def f(self, context):
...
is a sink method, but
def f(self, c... | [
"Returns",
"a",
"dictionary",
"of",
"sink",
"methods",
"found",
"on",
"this",
"object",
"keyed",
"on",
"method",
"name",
".",
"Sink",
"methods",
"are",
"identified",
"by",
"(",
"self",
"context",
")",
"arguments",
"on",
"this",
"object",
".",
"For",
"examp... | ska-sa/montblanc | python | https://github.com/ska-sa/montblanc/blob/8a2e742e7500bcc6196489b735f87b233075dd2d/montblanc/impl/rime/tensorflow/sinks/sink_provider.py#L97-L120 | [
"def",
"sinks",
"(",
"self",
")",
":",
"try",
":",
"return",
"self",
".",
"_sinks",
"except",
"AttributeError",
":",
"self",
".",
"_sinks",
"=",
"find_sinks",
"(",
"self",
")",
"return",
"self",
".",
"_sinks"
] | 8a2e742e7500bcc6196489b735f87b233075dd2d |
train | _antenna_uvw | numba implementation of antenna_uvw | montblanc/util/ant_uvw.py | def _antenna_uvw(uvw, antenna1, antenna2, chunks, nr_of_antenna):
""" numba implementation of antenna_uvw """
if antenna1.ndim != 1:
raise ValueError("antenna1 shape should be (row,)")
if antenna2.ndim != 1:
raise ValueError("antenna2 shape should be (row,)")
if uvw.ndim != 2 or uvw.s... | def _antenna_uvw(uvw, antenna1, antenna2, chunks, nr_of_antenna):
""" numba implementation of antenna_uvw """
if antenna1.ndim != 1:
raise ValueError("antenna1 shape should be (row,)")
if antenna2.ndim != 1:
raise ValueError("antenna2 shape should be (row,)")
if uvw.ndim != 2 or uvw.s... | [
"numba",
"implementation",
"of",
"antenna_uvw"
] | ska-sa/montblanc | python | https://github.com/ska-sa/montblanc/blob/8a2e742e7500bcc6196489b735f87b233075dd2d/montblanc/util/ant_uvw.py#L86-L121 | [
"def",
"_antenna_uvw",
"(",
"uvw",
",",
"antenna1",
",",
"antenna2",
",",
"chunks",
",",
"nr_of_antenna",
")",
":",
"if",
"antenna1",
".",
"ndim",
"!=",
"1",
":",
"raise",
"ValueError",
"(",
"\"antenna1 shape should be (row,)\"",
")",
"if",
"antenna2",
".",
... | 8a2e742e7500bcc6196489b735f87b233075dd2d |
train | _raise_decomposition_errors | Raises informative exception for an invalid decomposition | montblanc/util/ant_uvw.py | def _raise_decomposition_errors(uvw, antenna1, antenna2,
chunks, ant_uvw, max_err):
""" Raises informative exception for an invalid decomposition """
start = 0
problem_str = []
for ci, chunk in enumerate(chunks):
end = start + chunk
ant1 = antenna1[sta... | def _raise_decomposition_errors(uvw, antenna1, antenna2,
chunks, ant_uvw, max_err):
""" Raises informative exception for an invalid decomposition """
start = 0
problem_str = []
for ci, chunk in enumerate(chunks):
end = start + chunk
ant1 = antenna1[sta... | [
"Raises",
"informative",
"exception",
"for",
"an",
"invalid",
"decomposition"
] | ska-sa/montblanc | python | https://github.com/ska-sa/montblanc/blob/8a2e742e7500bcc6196489b735f87b233075dd2d/montblanc/util/ant_uvw.py#L128-L177 | [
"def",
"_raise_decomposition_errors",
"(",
"uvw",
",",
"antenna1",
",",
"antenna2",
",",
"chunks",
",",
"ant_uvw",
",",
"max_err",
")",
":",
"start",
"=",
"0",
"problem_str",
"=",
"[",
"]",
"for",
"ci",
",",
"chunk",
"in",
"enumerate",
"(",
"chunks",
")"... | 8a2e742e7500bcc6196489b735f87b233075dd2d |
train | _raise_missing_antenna_errors | Raises an informative error for missing antenna | montblanc/util/ant_uvw.py | def _raise_missing_antenna_errors(ant_uvw, max_err):
""" Raises an informative error for missing antenna """
# Find antenna uvw coordinates where any UVW component was nan
# nan + real == nan
problems = np.nonzero(np.add.reduce(np.isnan(ant_uvw), axis=2))
problem_str = []
for c, a in zip(*prob... | def _raise_missing_antenna_errors(ant_uvw, max_err):
""" Raises an informative error for missing antenna """
# Find antenna uvw coordinates where any UVW component was nan
# nan + real == nan
problems = np.nonzero(np.add.reduce(np.isnan(ant_uvw), axis=2))
problem_str = []
for c, a in zip(*prob... | [
"Raises",
"an",
"informative",
"error",
"for",
"missing",
"antenna"
] | ska-sa/montblanc | python | https://github.com/ska-sa/montblanc/blob/8a2e742e7500bcc6196489b735f87b233075dd2d/montblanc/util/ant_uvw.py#L184-L205 | [
"def",
"_raise_missing_antenna_errors",
"(",
"ant_uvw",
",",
"max_err",
")",
":",
"# Find antenna uvw coordinates where any UVW component was nan",
"# nan + real == nan",
"problems",
"=",
"np",
".",
"nonzero",
"(",
"np",
".",
"add",
".",
"reduce",
"(",
"np",
".",
"isn... | 8a2e742e7500bcc6196489b735f87b233075dd2d |
train | antenna_uvw | Computes per-antenna UVW coordinates from baseline ``uvw``,
``antenna1`` and ``antenna2`` coordinates logically grouped
into baseline chunks.
The example below illustrates two baseline chunks
of size 6 and 5, respectively.
.. code-block:: python
uvw = ...
ant1 = np.array([0, 0, 0,... | montblanc/util/ant_uvw.py | def antenna_uvw(uvw, antenna1, antenna2, chunks,
nr_of_antenna, check_missing=False,
check_decomposition=False, max_err=100):
"""
Computes per-antenna UVW coordinates from baseline ``uvw``,
``antenna1`` and ``antenna2`` coordinates logically grouped
into baseline chunks.
... | def antenna_uvw(uvw, antenna1, antenna2, chunks,
nr_of_antenna, check_missing=False,
check_decomposition=False, max_err=100):
"""
Computes per-antenna UVW coordinates from baseline ``uvw``,
``antenna1`` and ``antenna2`` coordinates logically grouped
into baseline chunks.
... | [
"Computes",
"per",
"-",
"antenna",
"UVW",
"coordinates",
"from",
"baseline",
"uvw",
"antenna1",
"and",
"antenna2",
"coordinates",
"logically",
"grouped",
"into",
"baseline",
"chunks",
"."
] | ska-sa/montblanc | python | https://github.com/ska-sa/montblanc/blob/8a2e742e7500bcc6196489b735f87b233075dd2d/montblanc/util/ant_uvw.py#L208-L279 | [
"def",
"antenna_uvw",
"(",
"uvw",
",",
"antenna1",
",",
"antenna2",
",",
"chunks",
",",
"nr_of_antenna",
",",
"check_missing",
"=",
"False",
",",
"check_decomposition",
"=",
"False",
",",
"max_err",
"=",
"100",
")",
":",
"ant_uvw",
"=",
"_antenna_uvw",
"(",
... | 8a2e742e7500bcc6196489b735f87b233075dd2d |
train | default_sources | Returns a dictionary mapping source types
to number of sources. If the number of sources
for the source type is supplied in the kwargs
these will be placed in the dictionary.
e.g. if we have 'point', 'gaussian' and 'sersic'
source types, then
default_sources(point=10, gaussian=20)
will re... | montblanc/src_types.py | def default_sources(**kwargs):
"""
Returns a dictionary mapping source types
to number of sources. If the number of sources
for the source type is supplied in the kwargs
these will be placed in the dictionary.
e.g. if we have 'point', 'gaussian' and 'sersic'
source types, then
default_... | def default_sources(**kwargs):
"""
Returns a dictionary mapping source types
to number of sources. If the number of sources
for the source type is supplied in the kwargs
these will be placed in the dictionary.
e.g. if we have 'point', 'gaussian' and 'sersic'
source types, then
default_... | [
"Returns",
"a",
"dictionary",
"mapping",
"source",
"types",
"to",
"number",
"of",
"sources",
".",
"If",
"the",
"number",
"of",
"sources",
"for",
"the",
"source",
"type",
"is",
"supplied",
"in",
"the",
"kwargs",
"these",
"will",
"be",
"placed",
"in",
"the",... | ska-sa/montblanc | python | https://github.com/ska-sa/montblanc/blob/8a2e742e7500bcc6196489b735f87b233075dd2d/montblanc/src_types.py#L61-L106 | [
"def",
"default_sources",
"(",
"*",
"*",
"kwargs",
")",
":",
"S",
"=",
"OrderedDict",
"(",
")",
"total",
"=",
"0",
"invalid_types",
"=",
"[",
"t",
"for",
"t",
"in",
"kwargs",
".",
"keys",
"(",
")",
"if",
"t",
"not",
"in",
"SOURCE_VAR_TYPES",
"]",
"... | 8a2e742e7500bcc6196489b735f87b233075dd2d |
train | sources_to_nr_vars | Converts a source type to number of sources mapping into
a source numbering variable to number of sources mapping.
If, for example, we have 'point', 'gaussian' and 'sersic'
source types, then passing the following dict as an argument
sources_to_nr_vars({'point':10, 'gaussian': 20})
will return an... | montblanc/src_types.py | def sources_to_nr_vars(sources):
"""
Converts a source type to number of sources mapping into
a source numbering variable to number of sources mapping.
If, for example, we have 'point', 'gaussian' and 'sersic'
source types, then passing the following dict as an argument
sources_to_nr_vars({'po... | def sources_to_nr_vars(sources):
"""
Converts a source type to number of sources mapping into
a source numbering variable to number of sources mapping.
If, for example, we have 'point', 'gaussian' and 'sersic'
source types, then passing the following dict as an argument
sources_to_nr_vars({'po... | [
"Converts",
"a",
"source",
"type",
"to",
"number",
"of",
"sources",
"mapping",
"into",
"a",
"source",
"numbering",
"variable",
"to",
"number",
"of",
"sources",
"mapping",
"."
] | ska-sa/montblanc | python | https://github.com/ska-sa/montblanc/blob/8a2e742e7500bcc6196489b735f87b233075dd2d/montblanc/src_types.py#L108-L132 | [
"def",
"sources_to_nr_vars",
"(",
"sources",
")",
":",
"sources",
"=",
"default_sources",
"(",
"*",
"*",
"sources",
")",
"try",
":",
"return",
"OrderedDict",
"(",
"(",
"SOURCE_VAR_TYPES",
"[",
"name",
"]",
",",
"nr",
")",
"for",
"name",
",",
"nr",
"in",
... | 8a2e742e7500bcc6196489b735f87b233075dd2d |
train | source_range_tuple | Given a range of source numbers, as well as a dictionary
containing the numbers of each source, returns a dictionary
containing tuples of the start and end index
for each source variable type. | montblanc/src_types.py | def source_range_tuple(start, end, nr_var_dict):
"""
Given a range of source numbers, as well as a dictionary
containing the numbers of each source, returns a dictionary
containing tuples of the start and end index
for each source variable type.
"""
starts = np.array([0 for nr_var in SOURCE... | def source_range_tuple(start, end, nr_var_dict):
"""
Given a range of source numbers, as well as a dictionary
containing the numbers of each source, returns a dictionary
containing tuples of the start and end index
for each source variable type.
"""
starts = np.array([0 for nr_var in SOURCE... | [
"Given",
"a",
"range",
"of",
"source",
"numbers",
"as",
"well",
"as",
"a",
"dictionary",
"containing",
"the",
"numbers",
"of",
"each",
"source",
"returns",
"a",
"dictionary",
"containing",
"tuples",
"of",
"the",
"start",
"and",
"end",
"index",
"for",
"each",... | ska-sa/montblanc | python | https://github.com/ska-sa/montblanc/blob/8a2e742e7500bcc6196489b735f87b233075dd2d/montblanc/src_types.py#L134-L174 | [
"def",
"source_range_tuple",
"(",
"start",
",",
"end",
",",
"nr_var_dict",
")",
":",
"starts",
"=",
"np",
".",
"array",
"(",
"[",
"0",
"for",
"nr_var",
"in",
"SOURCE_VAR_TYPES",
".",
"itervalues",
"(",
")",
"]",
")",
"ends",
"=",
"np",
".",
"array",
... | 8a2e742e7500bcc6196489b735f87b233075dd2d |
train | source_range | Given a range of source numbers, as well as a dictionary
containing the numbers of each source, returns a dictionary
containing tuples of the start and end index
for each source variable type. | montblanc/src_types.py | def source_range(start, end, nr_var_dict):
"""
Given a range of source numbers, as well as a dictionary
containing the numbers of each source, returns a dictionary
containing tuples of the start and end index
for each source variable type.
"""
return OrderedDict((k, e-s)
for k, (s, ... | def source_range(start, end, nr_var_dict):
"""
Given a range of source numbers, as well as a dictionary
containing the numbers of each source, returns a dictionary
containing tuples of the start and end index
for each source variable type.
"""
return OrderedDict((k, e-s)
for k, (s, ... | [
"Given",
"a",
"range",
"of",
"source",
"numbers",
"as",
"well",
"as",
"a",
"dictionary",
"containing",
"the",
"numbers",
"of",
"each",
"source",
"returns",
"a",
"dictionary",
"containing",
"tuples",
"of",
"the",
"start",
"and",
"end",
"index",
"for",
"each",... | ska-sa/montblanc | python | https://github.com/ska-sa/montblanc/blob/8a2e742e7500bcc6196489b735f87b233075dd2d/montblanc/src_types.py#L176-L186 | [
"def",
"source_range",
"(",
"start",
",",
"end",
",",
"nr_var_dict",
")",
":",
"return",
"OrderedDict",
"(",
"(",
"k",
",",
"e",
"-",
"s",
")",
"for",
"k",
",",
"(",
"s",
",",
"e",
")",
"in",
"source_range_tuple",
"(",
"start",
",",
"end",
",",
"... | 8a2e742e7500bcc6196489b735f87b233075dd2d |
train | source_range_slices | Given a range of source numbers, as well as a dictionary
containing the numbers of each source, returns a dictionary
containing slices for each source variable type. | montblanc/src_types.py | def source_range_slices(start, end, nr_var_dict):
"""
Given a range of source numbers, as well as a dictionary
containing the numbers of each source, returns a dictionary
containing slices for each source variable type.
"""
return OrderedDict((k, slice(s,e,1))
for k, (s, e)
in s... | def source_range_slices(start, end, nr_var_dict):
"""
Given a range of source numbers, as well as a dictionary
containing the numbers of each source, returns a dictionary
containing slices for each source variable type.
"""
return OrderedDict((k, slice(s,e,1))
for k, (s, e)
in s... | [
"Given",
"a",
"range",
"of",
"source",
"numbers",
"as",
"well",
"as",
"a",
"dictionary",
"containing",
"the",
"numbers",
"of",
"each",
"source",
"returns",
"a",
"dictionary",
"containing",
"slices",
"for",
"each",
"source",
"variable",
"type",
"."
] | ska-sa/montblanc | python | https://github.com/ska-sa/montblanc/blob/8a2e742e7500bcc6196489b735f87b233075dd2d/montblanc/src_types.py#L188-L197 | [
"def",
"source_range_slices",
"(",
"start",
",",
"end",
",",
"nr_var_dict",
")",
":",
"return",
"OrderedDict",
"(",
"(",
"k",
",",
"slice",
"(",
"s",
",",
"e",
",",
"1",
")",
")",
"for",
"k",
",",
"(",
"s",
",",
"e",
")",
"in",
"source_range_tuple"... | 8a2e742e7500bcc6196489b735f87b233075dd2d |
train | RadioSourceProvider.point_lm | Return a lm coordinate array to montblanc | montblanc/examples/MS_tf_example.py | def point_lm(self, context):
""" Return a lm coordinate array to montblanc """
lm = np.empty(context.shape, context.dtype)
# Print the array schema
montblanc.log.info(context.array_schema.shape)
# Print the space of iteration
montblanc.log.info(context.iter_args)
... | def point_lm(self, context):
""" Return a lm coordinate array to montblanc """
lm = np.empty(context.shape, context.dtype)
# Print the array schema
montblanc.log.info(context.array_schema.shape)
# Print the space of iteration
montblanc.log.info(context.iter_args)
... | [
"Return",
"a",
"lm",
"coordinate",
"array",
"to",
"montblanc"
] | ska-sa/montblanc | python | https://github.com/ska-sa/montblanc/blob/8a2e742e7500bcc6196489b735f87b233075dd2d/montblanc/examples/MS_tf_example.py#L44-L59 | [
"def",
"point_lm",
"(",
"self",
",",
"context",
")",
":",
"lm",
"=",
"np",
".",
"empty",
"(",
"context",
".",
"shape",
",",
"context",
".",
"dtype",
")",
"# Print the array schema",
"montblanc",
".",
"log",
".",
"info",
"(",
"context",
".",
"array_schema... | 8a2e742e7500bcc6196489b735f87b233075dd2d |
train | RadioSourceProvider.point_stokes | Return a stokes parameter array to montblanc | montblanc/examples/MS_tf_example.py | def point_stokes(self, context):
""" Return a stokes parameter array to montblanc """
stokes = np.empty(context.shape, context.dtype)
stokes[:,:,0] = 1
stokes[:,:,1:4] = 0
return stokes | def point_stokes(self, context):
""" Return a stokes parameter array to montblanc """
stokes = np.empty(context.shape, context.dtype)
stokes[:,:,0] = 1
stokes[:,:,1:4] = 0
return stokes | [
"Return",
"a",
"stokes",
"parameter",
"array",
"to",
"montblanc"
] | ska-sa/montblanc | python | https://github.com/ska-sa/montblanc/blob/8a2e742e7500bcc6196489b735f87b233075dd2d/montblanc/examples/MS_tf_example.py#L61-L66 | [
"def",
"point_stokes",
"(",
"self",
",",
"context",
")",
":",
"stokes",
"=",
"np",
".",
"empty",
"(",
"context",
".",
"shape",
",",
"context",
".",
"dtype",
")",
"stokes",
"[",
":",
",",
":",
",",
"0",
"]",
"=",
"1",
"stokes",
"[",
":",
",",
":... | 8a2e742e7500bcc6196489b735f87b233075dd2d |
train | RadioSourceProvider.ref_frequency | Return a reference frequency array to montblanc | montblanc/examples/MS_tf_example.py | def ref_frequency(self, context):
""" Return a reference frequency array to montblanc """
ref_freq = np.empty(context.shape, context.dtype)
ref_freq[:] = 1.415e9
return ref_freq | def ref_frequency(self, context):
""" Return a reference frequency array to montblanc """
ref_freq = np.empty(context.shape, context.dtype)
ref_freq[:] = 1.415e9
return ref_freq | [
"Return",
"a",
"reference",
"frequency",
"array",
"to",
"montblanc"
] | ska-sa/montblanc | python | https://github.com/ska-sa/montblanc/blob/8a2e742e7500bcc6196489b735f87b233075dd2d/montblanc/examples/MS_tf_example.py#L76-L81 | [
"def",
"ref_frequency",
"(",
"self",
",",
"context",
")",
":",
"ref_freq",
"=",
"np",
".",
"empty",
"(",
"context",
".",
"shape",
",",
"context",
".",
"dtype",
")",
"ref_freq",
"[",
":",
"]",
"=",
"1.415e9",
"return",
"ref_freq"
] | 8a2e742e7500bcc6196489b735f87b233075dd2d |
train | Authorization.update | Update this authorization.
:param list scopes: (optional), replaces the authorization scopes with
these
:param list add_scopes: (optional), scopes to be added
:param list rm_scopes: (optional), scopes to be removed
:param str note: (optional), new note about authorization
... | aegea/packages/github3/auths.py | def update(self, scopes=[], add_scopes=[], rm_scopes=[], note='',
note_url=''):
"""Update this authorization.
:param list scopes: (optional), replaces the authorization scopes with
these
:param list add_scopes: (optional), scopes to be added
:param list rm_sco... | def update(self, scopes=[], add_scopes=[], rm_scopes=[], note='',
note_url=''):
"""Update this authorization.
:param list scopes: (optional), replaces the authorization scopes with
these
:param list add_scopes: (optional), scopes to be added
:param list rm_sco... | [
"Update",
"this",
"authorization",
"."
] | kislyuk/aegea | python | https://github.com/kislyuk/aegea/blob/94957e9dba036eae3052e2662c208b259c08399a/aegea/packages/github3/auths.py#L67-L99 | [
"def",
"update",
"(",
"self",
",",
"scopes",
"=",
"[",
"]",
",",
"add_scopes",
"=",
"[",
"]",
",",
"rm_scopes",
"=",
"[",
"]",
",",
"note",
"=",
"''",
",",
"note_url",
"=",
"''",
")",
":",
"success",
"=",
"False",
"json",
"=",
"None",
"if",
"sc... | 94957e9dba036eae3052e2662c208b259c08399a |
train | Milestone.iter_labels | Iterate over the labels for every issue associated with this
milestone.
.. versionchanged:: 0.9
Add etag parameter.
:param int number: (optional), number of labels to return. Default: -1
returns all available labels.
:param str etag: (optional), ETag header fro... | aegea/packages/github3/issues/milestone.py | def iter_labels(self, number=-1, etag=None):
"""Iterate over the labels for every issue associated with this
milestone.
.. versionchanged:: 0.9
Add etag parameter.
:param int number: (optional), number of labels to return. Default: -1
returns all available labe... | def iter_labels(self, number=-1, etag=None):
"""Iterate over the labels for every issue associated with this
milestone.
.. versionchanged:: 0.9
Add etag parameter.
:param int number: (optional), number of labels to return. Default: -1
returns all available labe... | [
"Iterate",
"over",
"the",
"labels",
"for",
"every",
"issue",
"associated",
"with",
"this",
"milestone",
"."
] | kislyuk/aegea | python | https://github.com/kislyuk/aegea/blob/94957e9dba036eae3052e2662c208b259c08399a/aegea/packages/github3/issues/milestone.py#L60-L74 | [
"def",
"iter_labels",
"(",
"self",
",",
"number",
"=",
"-",
"1",
",",
"etag",
"=",
"None",
")",
":",
"url",
"=",
"self",
".",
"_build_url",
"(",
"'labels'",
",",
"base_url",
"=",
"self",
".",
"_api",
")",
"return",
"self",
".",
"_iter",
"(",
"int",... | 94957e9dba036eae3052e2662c208b259c08399a |
train | current_function | Get reference to currently running function from inspect/trace stack frame.
Parameters
----------
frame : stack frame
Stack frame obtained via trace or inspect
Returns
-------
fnc : function reference
Currently running function | jonga.py | def current_function(frame):
"""
Get reference to currently running function from inspect/trace stack frame.
Parameters
----------
frame : stack frame
Stack frame obtained via trace or inspect
Returns
-------
fnc : function reference
Currently running function
"""
... | def current_function(frame):
"""
Get reference to currently running function from inspect/trace stack frame.
Parameters
----------
frame : stack frame
Stack frame obtained via trace or inspect
Returns
-------
fnc : function reference
Currently running function
"""
... | [
"Get",
"reference",
"to",
"currently",
"running",
"function",
"from",
"inspect",
"/",
"trace",
"stack",
"frame",
"."
] | bwohlberg/jonga | python | https://github.com/bwohlberg/jonga/blob/1947d40d78d814fbdc3a973ceffec4b69b4623f2/jonga.py#L25-L62 | [
"def",
"current_function",
"(",
"frame",
")",
":",
"if",
"frame",
"is",
"None",
":",
"return",
"None",
"code",
"=",
"frame",
".",
"f_code",
"# Attempting to extract the function reference for these calls appears",
"# to be problematic",
"if",
"code",
".",
"co_name",
"... | 1947d40d78d814fbdc3a973ceffec4b69b4623f2 |
train | current_module_name | Get name of module of currently running function from inspect/trace
stack frame.
Parameters
----------
frame : stack frame
Stack frame obtained via trace or inspect
Returns
-------
modname : string
Currently running function module name | jonga.py | def current_module_name(frame):
"""
Get name of module of currently running function from inspect/trace
stack frame.
Parameters
----------
frame : stack frame
Stack frame obtained via trace or inspect
Returns
-------
modname : string
Currently running function module na... | def current_module_name(frame):
"""
Get name of module of currently running function from inspect/trace
stack frame.
Parameters
----------
frame : stack frame
Stack frame obtained via trace or inspect
Returns
-------
modname : string
Currently running function module na... | [
"Get",
"name",
"of",
"module",
"of",
"currently",
"running",
"function",
"from",
"inspect",
"/",
"trace",
"stack",
"frame",
"."
] | bwohlberg/jonga | python | https://github.com/bwohlberg/jonga/blob/1947d40d78d814fbdc3a973ceffec4b69b4623f2/jonga.py#L111-L137 | [
"def",
"current_module_name",
"(",
"frame",
")",
":",
"if",
"frame",
"is",
"None",
":",
"return",
"None",
"if",
"hasattr",
"(",
"frame",
".",
"f_globals",
",",
"'__name__'",
")",
":",
"return",
"frame",
".",
"f_globals",
"[",
"'__name__'",
"]",
"else",
"... | 1947d40d78d814fbdc3a973ceffec4b69b4623f2 |
train | CallTracer._trace | Build a record of called functions using the trace mechanism | jonga.py | def _trace(self, frame, event, arg):
"""
Build a record of called functions using the trace mechanism
"""
# Return if this is not a function call
if event != 'call':
return
# Filter calling and called functions by module names
src_mod = current_modul... | def _trace(self, frame, event, arg):
"""
Build a record of called functions using the trace mechanism
"""
# Return if this is not a function call
if event != 'call':
return
# Filter calling and called functions by module names
src_mod = current_modul... | [
"Build",
"a",
"record",
"of",
"called",
"functions",
"using",
"the",
"trace",
"mechanism"
] | bwohlberg/jonga | python | https://github.com/bwohlberg/jonga/blob/1947d40d78d814fbdc3a973ceffec4b69b4623f2/jonga.py#L232-L295 | [
"def",
"_trace",
"(",
"self",
",",
"frame",
",",
"event",
",",
"arg",
")",
":",
"# Return if this is not a function call",
"if",
"event",
"!=",
"'call'",
":",
"return",
"# Filter calling and called functions by module names",
"src_mod",
"=",
"current_module_name",
"(",
... | 1947d40d78d814fbdc3a973ceffec4b69b4623f2 |
train | CallTracer.stop | Stop tracing | jonga.py | def stop(self):
"""Stop tracing"""
# Stop tracing
sys.settrace(None)
# Build group structure if group filter is defined
if self.grpflt is not None:
# Iterate over graph nodes (functions)
for k in self.fncts:
# Construct group identity str... | def stop(self):
"""Stop tracing"""
# Stop tracing
sys.settrace(None)
# Build group structure if group filter is defined
if self.grpflt is not None:
# Iterate over graph nodes (functions)
for k in self.fncts:
# Construct group identity str... | [
"Stop",
"tracing"
] | bwohlberg/jonga | python | https://github.com/bwohlberg/jonga/blob/1947d40d78d814fbdc3a973ceffec4b69b4623f2/jonga.py#L306-L325 | [
"def",
"stop",
"(",
"self",
")",
":",
"# Stop tracing",
"sys",
".",
"settrace",
"(",
"None",
")",
"# Build group structure if group filter is defined",
"if",
"self",
".",
"grpflt",
"is",
"not",
"None",
":",
"# Iterate over graph nodes (functions)",
"for",
"k",
"in",... | 1947d40d78d814fbdc3a973ceffec4b69b4623f2 |
train | CallTracer._clrgen | Default colour generating function
Parameters
----------
n : int
Number of colours to generate
h0 : float
Initial H value in HSV colour specification
hr : float
Size of H value range to use for colour generation
(final H value is h0 + hr)... | jonga.py | def _clrgen(n, h0, hr):
"""Default colour generating function
Parameters
----------
n : int
Number of colours to generate
h0 : float
Initial H value in HSV colour specification
hr : float
Size of H value range to use for colour generation
... | def _clrgen(n, h0, hr):
"""Default colour generating function
Parameters
----------
n : int
Number of colours to generate
h0 : float
Initial H value in HSV colour specification
hr : float
Size of H value range to use for colour generation
... | [
"Default",
"colour",
"generating",
"function"
] | bwohlberg/jonga | python | https://github.com/bwohlberg/jonga/blob/1947d40d78d814fbdc3a973ceffec4b69b4623f2/jonga.py#L331-L354 | [
"def",
"_clrgen",
"(",
"n",
",",
"h0",
",",
"hr",
")",
":",
"n0",
"=",
"n",
"if",
"n",
"==",
"1",
"else",
"n",
"-",
"1",
"clst",
"=",
"[",
"'%f,%f,%f'",
"%",
"(",
"h0",
"+",
"hr",
"*",
"hi",
"/",
"n0",
",",
"0.35",
",",
"0.85",
")",
"for"... | 1947d40d78d814fbdc3a973ceffec4b69b4623f2 |
train | CallTracer.graph | Construct call graph
Parameters
----------
fnm : None or string, optional (default None)
Filename of graph file to be written. File type is determined by
the file extentions (e.g. dot for 'graph.dot' and SVG for
'graph.svg'). If None, a file is not written.
... | jonga.py | def graph(self, fnm=None, size=None, fntsz=None, fntfm=None, clrgen=None,
rmsz=False, prog='dot'):
"""
Construct call graph
Parameters
----------
fnm : None or string, optional (default None)
Filename of graph file to be written. File type is determined b... | def graph(self, fnm=None, size=None, fntsz=None, fntfm=None, clrgen=None,
rmsz=False, prog='dot'):
"""
Construct call graph
Parameters
----------
fnm : None or string, optional (default None)
Filename of graph file to be written. File type is determined b... | [
"Construct",
"call",
"graph"
] | bwohlberg/jonga | python | https://github.com/bwohlberg/jonga/blob/1947d40d78d814fbdc3a973ceffec4b69b4623f2/jonga.py#L358-L466 | [
"def",
"graph",
"(",
"self",
",",
"fnm",
"=",
"None",
",",
"size",
"=",
"None",
",",
"fntsz",
"=",
"None",
",",
"fntfm",
"=",
"None",
",",
"clrgen",
"=",
"None",
",",
"rmsz",
"=",
"False",
",",
"prog",
"=",
"'dot'",
")",
":",
"# Default colour gene... | 1947d40d78d814fbdc3a973ceffec4b69b4623f2 |
train | PullRequest.create_review_comment | Create a review comment on this pull request.
All parameters are required by the GitHub API.
:param str body: The comment text itself
:param str commit_id: The SHA of the commit to comment on
:param str path: The relative path of the file to comment on
:param int position: The ... | aegea/packages/github3/pulls.py | def create_review_comment(self, body, commit_id, path, position):
"""Create a review comment on this pull request.
All parameters are required by the GitHub API.
:param str body: The comment text itself
:param str commit_id: The SHA of the commit to comment on
:param str path: ... | def create_review_comment(self, body, commit_id, path, position):
"""Create a review comment on this pull request.
All parameters are required by the GitHub API.
:param str body: The comment text itself
:param str commit_id: The SHA of the commit to comment on
:param str path: ... | [
"Create",
"a",
"review",
"comment",
"on",
"this",
"pull",
"request",
"."
] | kislyuk/aegea | python | https://github.com/kislyuk/aegea/blob/94957e9dba036eae3052e2662c208b259c08399a/aegea/packages/github3/pulls.py#L222-L238 | [
"def",
"create_review_comment",
"(",
"self",
",",
"body",
",",
"commit_id",
",",
"path",
",",
"position",
")",
":",
"url",
"=",
"self",
".",
"_build_url",
"(",
"'comments'",
",",
"base_url",
"=",
"self",
".",
"_api",
")",
"data",
"=",
"{",
"'body'",
":... | 94957e9dba036eae3052e2662c208b259c08399a |
train | PullRequest.diff | Return the diff | aegea/packages/github3/pulls.py | def diff(self):
"""Return the diff"""
resp = self._get(self._api,
headers={'Accept': 'application/vnd.github.diff'})
return resp.content if self._boolean(resp, 200, 404) else None | def diff(self):
"""Return the diff"""
resp = self._get(self._api,
headers={'Accept': 'application/vnd.github.diff'})
return resp.content if self._boolean(resp, 200, 404) else None | [
"Return",
"the",
"diff"
] | kislyuk/aegea | python | https://github.com/kislyuk/aegea/blob/94957e9dba036eae3052e2662c208b259c08399a/aegea/packages/github3/pulls.py#L240-L244 | [
"def",
"diff",
"(",
"self",
")",
":",
"resp",
"=",
"self",
".",
"_get",
"(",
"self",
".",
"_api",
",",
"headers",
"=",
"{",
"'Accept'",
":",
"'application/vnd.github.diff'",
"}",
")",
"return",
"resp",
".",
"content",
"if",
"self",
".",
"_boolean",
"("... | 94957e9dba036eae3052e2662c208b259c08399a |
train | PullRequest.is_merged | Checks to see if the pull request was merged.
:returns: bool | aegea/packages/github3/pulls.py | def is_merged(self):
"""Checks to see if the pull request was merged.
:returns: bool
"""
url = self._build_url('merge', base_url=self._api)
return self._boolean(self._get(url), 204, 404) | def is_merged(self):
"""Checks to see if the pull request was merged.
:returns: bool
"""
url = self._build_url('merge', base_url=self._api)
return self._boolean(self._get(url), 204, 404) | [
"Checks",
"to",
"see",
"if",
"the",
"pull",
"request",
"was",
"merged",
"."
] | kislyuk/aegea | python | https://github.com/kislyuk/aegea/blob/94957e9dba036eae3052e2662c208b259c08399a/aegea/packages/github3/pulls.py#L246-L252 | [
"def",
"is_merged",
"(",
"self",
")",
":",
"url",
"=",
"self",
".",
"_build_url",
"(",
"'merge'",
",",
"base_url",
"=",
"self",
".",
"_api",
")",
"return",
"self",
".",
"_boolean",
"(",
"self",
".",
"_get",
"(",
"url",
")",
",",
"204",
",",
"404",
... | 94957e9dba036eae3052e2662c208b259c08399a |
train | PullRequest.iter_comments | Iterate over the comments on this pull request.
:param int number: (optional), number of comments to return. Default:
-1 returns all available comments.
:param str etag: (optional), ETag from a previous request to the same
endpoint
:returns: generator of :class:`ReviewCo... | aegea/packages/github3/pulls.py | def iter_comments(self, number=-1, etag=None):
"""Iterate over the comments on this pull request.
:param int number: (optional), number of comments to return. Default:
-1 returns all available comments.
:param str etag: (optional), ETag from a previous request to the same
... | def iter_comments(self, number=-1, etag=None):
"""Iterate over the comments on this pull request.
:param int number: (optional), number of comments to return. Default:
-1 returns all available comments.
:param str etag: (optional), ETag from a previous request to the same
... | [
"Iterate",
"over",
"the",
"comments",
"on",
"this",
"pull",
"request",
"."
] | kislyuk/aegea | python | https://github.com/kislyuk/aegea/blob/94957e9dba036eae3052e2662c208b259c08399a/aegea/packages/github3/pulls.py#L254-L264 | [
"def",
"iter_comments",
"(",
"self",
",",
"number",
"=",
"-",
"1",
",",
"etag",
"=",
"None",
")",
":",
"url",
"=",
"self",
".",
"_build_url",
"(",
"'comments'",
",",
"base_url",
"=",
"self",
".",
"_api",
")",
"return",
"self",
".",
"_iter",
"(",
"i... | 94957e9dba036eae3052e2662c208b259c08399a |
train | PullRequest.iter_files | Iterate over the files associated with this pull request.
:param int number: (optional), number of files to return. Default:
-1 returns all available files.
:param str etag: (optional), ETag from a previous request to the same
endpoint
:returns: generator of :class:`Pull... | aegea/packages/github3/pulls.py | def iter_files(self, number=-1, etag=None):
"""Iterate over the files associated with this pull request.
:param int number: (optional), number of files to return. Default:
-1 returns all available files.
:param str etag: (optional), ETag from a previous request to the same
... | def iter_files(self, number=-1, etag=None):
"""Iterate over the files associated with this pull request.
:param int number: (optional), number of files to return. Default:
-1 returns all available files.
:param str etag: (optional), ETag from a previous request to the same
... | [
"Iterate",
"over",
"the",
"files",
"associated",
"with",
"this",
"pull",
"request",
"."
] | kislyuk/aegea | python | https://github.com/kislyuk/aegea/blob/94957e9dba036eae3052e2662c208b259c08399a/aegea/packages/github3/pulls.py#L278-L288 | [
"def",
"iter_files",
"(",
"self",
",",
"number",
"=",
"-",
"1",
",",
"etag",
"=",
"None",
")",
":",
"url",
"=",
"self",
".",
"_build_url",
"(",
"'files'",
",",
"base_url",
"=",
"self",
".",
"_api",
")",
"return",
"self",
".",
"_iter",
"(",
"int",
... | 94957e9dba036eae3052e2662c208b259c08399a |
train | PullRequest.iter_issue_comments | Iterate over the issue comments on this pull request.
:param int number: (optional), number of comments to return. Default:
-1 returns all available comments.
:param str etag: (optional), ETag from a previous request to the same
endpoint
:returns: generator of :class:`Is... | aegea/packages/github3/pulls.py | def iter_issue_comments(self, number=-1, etag=None):
"""Iterate over the issue comments on this pull request.
:param int number: (optional), number of comments to return. Default:
-1 returns all available comments.
:param str etag: (optional), ETag from a previous request to the sam... | def iter_issue_comments(self, number=-1, etag=None):
"""Iterate over the issue comments on this pull request.
:param int number: (optional), number of comments to return. Default:
-1 returns all available comments.
:param str etag: (optional), ETag from a previous request to the sam... | [
"Iterate",
"over",
"the",
"issue",
"comments",
"on",
"this",
"pull",
"request",
"."
] | kislyuk/aegea | python | https://github.com/kislyuk/aegea/blob/94957e9dba036eae3052e2662c208b259c08399a/aegea/packages/github3/pulls.py#L290-L300 | [
"def",
"iter_issue_comments",
"(",
"self",
",",
"number",
"=",
"-",
"1",
",",
"etag",
"=",
"None",
")",
":",
"url",
"=",
"self",
".",
"_build_url",
"(",
"base_url",
"=",
"self",
".",
"links",
"[",
"'comments'",
"]",
")",
"return",
"self",
".",
"_iter... | 94957e9dba036eae3052e2662c208b259c08399a |
train | PullRequest.merge | Merge this pull request.
:param str commit_message: (optional), message to be used for the
merge commit
:returns: bool | aegea/packages/github3/pulls.py | def merge(self, commit_message='', sha=None):
"""Merge this pull request.
:param str commit_message: (optional), message to be used for the
merge commit
:returns: bool
"""
parameters = {'commit_message': commit_message}
if sha:
parameters['sha'] =... | def merge(self, commit_message='', sha=None):
"""Merge this pull request.
:param str commit_message: (optional), message to be used for the
merge commit
:returns: bool
"""
parameters = {'commit_message': commit_message}
if sha:
parameters['sha'] =... | [
"Merge",
"this",
"pull",
"request",
"."
] | kislyuk/aegea | python | https://github.com/kislyuk/aegea/blob/94957e9dba036eae3052e2662c208b259c08399a/aegea/packages/github3/pulls.py#L303-L316 | [
"def",
"merge",
"(",
"self",
",",
"commit_message",
"=",
"''",
",",
"sha",
"=",
"None",
")",
":",
"parameters",
"=",
"{",
"'commit_message'",
":",
"commit_message",
"}",
"if",
"sha",
":",
"parameters",
"[",
"'sha'",
"]",
"=",
"sha",
"url",
"=",
"self",... | 94957e9dba036eae3052e2662c208b259c08399a |
train | PullRequest.patch | Return the patch | aegea/packages/github3/pulls.py | def patch(self):
"""Return the patch"""
resp = self._get(self._api,
headers={'Accept': 'application/vnd.github.patch'})
return resp.content if self._boolean(resp, 200, 404) else None | def patch(self):
"""Return the patch"""
resp = self._get(self._api,
headers={'Accept': 'application/vnd.github.patch'})
return resp.content if self._boolean(resp, 200, 404) else None | [
"Return",
"the",
"patch"
] | kislyuk/aegea | python | https://github.com/kislyuk/aegea/blob/94957e9dba036eae3052e2662c208b259c08399a/aegea/packages/github3/pulls.py#L318-L322 | [
"def",
"patch",
"(",
"self",
")",
":",
"resp",
"=",
"self",
".",
"_get",
"(",
"self",
".",
"_api",
",",
"headers",
"=",
"{",
"'Accept'",
":",
"'application/vnd.github.patch'",
"}",
")",
"return",
"resp",
".",
"content",
"if",
"self",
".",
"_boolean",
"... | 94957e9dba036eae3052e2662c208b259c08399a |
train | PullRequest.update | Update this pull request.
:param str title: (optional), title of the pull
:param str body: (optional), body of the pull request
:param str state: (optional), ('open', 'closed')
:returns: bool | aegea/packages/github3/pulls.py | def update(self, title=None, body=None, state=None):
"""Update this pull request.
:param str title: (optional), title of the pull
:param str body: (optional), body of the pull request
:param str state: (optional), ('open', 'closed')
:returns: bool
"""
data = {'ti... | def update(self, title=None, body=None, state=None):
"""Update this pull request.
:param str title: (optional), title of the pull
:param str body: (optional), body of the pull request
:param str state: (optional), ('open', 'closed')
:returns: bool
"""
data = {'ti... | [
"Update",
"this",
"pull",
"request",
"."
] | kislyuk/aegea | python | https://github.com/kislyuk/aegea/blob/94957e9dba036eae3052e2662c208b259c08399a/aegea/packages/github3/pulls.py#L344-L362 | [
"def",
"update",
"(",
"self",
",",
"title",
"=",
"None",
",",
"body",
"=",
"None",
",",
"state",
"=",
"None",
")",
":",
"data",
"=",
"{",
"'title'",
":",
"title",
",",
"'body'",
":",
"body",
",",
"'state'",
":",
"state",
"}",
"json",
"=",
"None",... | 94957e9dba036eae3052e2662c208b259c08399a |
train | ReviewComment.reply | Reply to this review comment with a new review comment.
:param str body: The text of the comment.
:returns: The created review comment.
:rtype: :class:`~github3.pulls.ReviewComment` | aegea/packages/github3/pulls.py | def reply(self, body):
"""Reply to this review comment with a new review comment.
:param str body: The text of the comment.
:returns: The created review comment.
:rtype: :class:`~github3.pulls.ReviewComment`
"""
url = self._build_url('comments', base_url=self.pull_reques... | def reply(self, body):
"""Reply to this review comment with a new review comment.
:param str body: The text of the comment.
:returns: The created review comment.
:rtype: :class:`~github3.pulls.ReviewComment`
"""
url = self._build_url('comments', base_url=self.pull_reques... | [
"Reply",
"to",
"this",
"review",
"comment",
"with",
"a",
"new",
"review",
"comment",
"."
] | kislyuk/aegea | python | https://github.com/kislyuk/aegea/blob/94957e9dba036eae3052e2662c208b259c08399a/aegea/packages/github3/pulls.py#L414-L427 | [
"def",
"reply",
"(",
"self",
",",
"body",
")",
":",
"url",
"=",
"self",
".",
"_build_url",
"(",
"'comments'",
",",
"base_url",
"=",
"self",
".",
"pull_request_url",
")",
"index",
"=",
"self",
".",
"_api",
".",
"rfind",
"(",
"'/'",
")",
"+",
"1",
"i... | 94957e9dba036eae3052e2662c208b259c08399a |
train | Team.add_member | Add ``login`` to this team.
:returns: bool | aegea/packages/github3/orgs.py | def add_member(self, login):
"""Add ``login`` to this team.
:returns: bool
"""
warnings.warn(
'This is no longer supported by the GitHub API, see '
'https://developer.github.com/changes/2014-09-23-one-more-week'
'-before-the-add-team-member-api-breaki... | def add_member(self, login):
"""Add ``login`` to this team.
:returns: bool
"""
warnings.warn(
'This is no longer supported by the GitHub API, see '
'https://developer.github.com/changes/2014-09-23-one-more-week'
'-before-the-add-team-member-api-breaki... | [
"Add",
"login",
"to",
"this",
"team",
"."
] | kislyuk/aegea | python | https://github.com/kislyuk/aegea/blob/94957e9dba036eae3052e2662c208b259c08399a/aegea/packages/github3/orgs.py#L66-L77 | [
"def",
"add_member",
"(",
"self",
",",
"login",
")",
":",
"warnings",
".",
"warn",
"(",
"'This is no longer supported by the GitHub API, see '",
"'https://developer.github.com/changes/2014-09-23-one-more-week'",
"'-before-the-add-team-member-api-breaking-change/'",
",",
"DeprecationW... | 94957e9dba036eae3052e2662c208b259c08399a |
train | Team.add_repo | Add ``repo`` to this team.
:param str repo: (required), form: 'user/repo'
:returns: bool | aegea/packages/github3/orgs.py | def add_repo(self, repo):
"""Add ``repo`` to this team.
:param str repo: (required), form: 'user/repo'
:returns: bool
"""
url = self._build_url('repos', repo, base_url=self._api)
return self._boolean(self._put(url), 204, 404) | def add_repo(self, repo):
"""Add ``repo`` to this team.
:param str repo: (required), form: 'user/repo'
:returns: bool
"""
url = self._build_url('repos', repo, base_url=self._api)
return self._boolean(self._put(url), 204, 404) | [
"Add",
"repo",
"to",
"this",
"team",
"."
] | kislyuk/aegea | python | https://github.com/kislyuk/aegea/blob/94957e9dba036eae3052e2662c208b259c08399a/aegea/packages/github3/orgs.py#L80-L87 | [
"def",
"add_repo",
"(",
"self",
",",
"repo",
")",
":",
"url",
"=",
"self",
".",
"_build_url",
"(",
"'repos'",
",",
"repo",
",",
"base_url",
"=",
"self",
".",
"_api",
")",
"return",
"self",
".",
"_boolean",
"(",
"self",
".",
"_put",
"(",
"url",
")",... | 94957e9dba036eae3052e2662c208b259c08399a |
train | Team.edit | Edit this team.
:param str name: (required)
:param str permission: (optional), ('pull', 'push', 'admin')
:returns: bool | aegea/packages/github3/orgs.py | def edit(self, name, permission=''):
"""Edit this team.
:param str name: (required)
:param str permission: (optional), ('pull', 'push', 'admin')
:returns: bool
"""
if name:
data = {'name': name, 'permission': permission}
json = self._json(self._pa... | def edit(self, name, permission=''):
"""Edit this team.
:param str name: (required)
:param str permission: (optional), ('pull', 'push', 'admin')
:returns: bool
"""
if name:
data = {'name': name, 'permission': permission}
json = self._json(self._pa... | [
"Edit",
"this",
"team",
"."
] | kislyuk/aegea | python | https://github.com/kislyuk/aegea/blob/94957e9dba036eae3052e2662c208b259c08399a/aegea/packages/github3/orgs.py#L98-L111 | [
"def",
"edit",
"(",
"self",
",",
"name",
",",
"permission",
"=",
"''",
")",
":",
"if",
"name",
":",
"data",
"=",
"{",
"'name'",
":",
"name",
",",
"'permission'",
":",
"permission",
"}",
"json",
"=",
"self",
".",
"_json",
"(",
"self",
".",
"_patch",... | 94957e9dba036eae3052e2662c208b259c08399a |
train | Team.has_repo | Checks if this team has access to ``repo``
:param str repo: (required), form: 'user/repo'
:returns: bool | aegea/packages/github3/orgs.py | def has_repo(self, repo):
"""Checks if this team has access to ``repo``
:param str repo: (required), form: 'user/repo'
:returns: bool
"""
url = self._build_url('repos', repo, base_url=self._api)
return self._boolean(self._get(url), 204, 404) | def has_repo(self, repo):
"""Checks if this team has access to ``repo``
:param str repo: (required), form: 'user/repo'
:returns: bool
"""
url = self._build_url('repos', repo, base_url=self._api)
return self._boolean(self._get(url), 204, 404) | [
"Checks",
"if",
"this",
"team",
"has",
"access",
"to",
"repo"
] | kislyuk/aegea | python | https://github.com/kislyuk/aegea/blob/94957e9dba036eae3052e2662c208b259c08399a/aegea/packages/github3/orgs.py#L113-L120 | [
"def",
"has_repo",
"(",
"self",
",",
"repo",
")",
":",
"url",
"=",
"self",
".",
"_build_url",
"(",
"'repos'",
",",
"repo",
",",
"base_url",
"=",
"self",
".",
"_api",
")",
"return",
"self",
".",
"_boolean",
"(",
"self",
".",
"_get",
"(",
"url",
")",... | 94957e9dba036eae3052e2662c208b259c08399a |
train | Team.invite | Invite the user to join this team.
This returns a dictionary like so::
{'state': 'pending', 'url': 'https://api.github.com/teams/...'}
:param str username: (required), user to invite to join this team.
:returns: dictionary | aegea/packages/github3/orgs.py | def invite(self, username):
"""Invite the user to join this team.
This returns a dictionary like so::
{'state': 'pending', 'url': 'https://api.github.com/teams/...'}
:param str username: (required), user to invite to join this team.
:returns: dictionary
"""
... | def invite(self, username):
"""Invite the user to join this team.
This returns a dictionary like so::
{'state': 'pending', 'url': 'https://api.github.com/teams/...'}
:param str username: (required), user to invite to join this team.
:returns: dictionary
"""
... | [
"Invite",
"the",
"user",
"to",
"join",
"this",
"team",
"."
] | kislyuk/aegea | python | https://github.com/kislyuk/aegea/blob/94957e9dba036eae3052e2662c208b259c08399a/aegea/packages/github3/orgs.py#L123-L134 | [
"def",
"invite",
"(",
"self",
",",
"username",
")",
":",
"url",
"=",
"self",
".",
"_build_url",
"(",
"'memberships'",
",",
"username",
",",
"base_url",
"=",
"self",
".",
"_api",
")",
"return",
"self",
".",
"_json",
"(",
"self",
".",
"_put",
"(",
"url... | 94957e9dba036eae3052e2662c208b259c08399a |
train | Team.membership_for | Retrieve the membership information for the user.
:param str username: (required), name of the user
:returns: dictionary | aegea/packages/github3/orgs.py | def membership_for(self, username):
"""Retrieve the membership information for the user.
:param str username: (required), name of the user
:returns: dictionary
"""
url = self._build_url('memberships', username, base_url=self._api)
json = self._json(self._get(url), 200)
... | def membership_for(self, username):
"""Retrieve the membership information for the user.
:param str username: (required), name of the user
:returns: dictionary
"""
url = self._build_url('memberships', username, base_url=self._api)
json = self._json(self._get(url), 200)
... | [
"Retrieve",
"the",
"membership",
"information",
"for",
"the",
"user",
"."
] | kislyuk/aegea | python | https://github.com/kislyuk/aegea/blob/94957e9dba036eae3052e2662c208b259c08399a/aegea/packages/github3/orgs.py#L171-L179 | [
"def",
"membership_for",
"(",
"self",
",",
"username",
")",
":",
"url",
"=",
"self",
".",
"_build_url",
"(",
"'memberships'",
",",
"username",
",",
"base_url",
"=",
"self",
".",
"_api",
")",
"json",
"=",
"self",
".",
"_json",
"(",
"self",
".",
"_get",
... | 94957e9dba036eae3052e2662c208b259c08399a |
train | Team.remove_member | Remove ``login`` from this team.
:param str login: (required), login of the member to remove
:returns: bool | aegea/packages/github3/orgs.py | def remove_member(self, login):
"""Remove ``login`` from this team.
:param str login: (required), login of the member to remove
:returns: bool
"""
warnings.warn(
'This is no longer supported by the GitHub API, see '
'https://developer.github.com/changes/2... | def remove_member(self, login):
"""Remove ``login`` from this team.
:param str login: (required), login of the member to remove
:returns: bool
"""
warnings.warn(
'This is no longer supported by the GitHub API, see '
'https://developer.github.com/changes/2... | [
"Remove",
"login",
"from",
"this",
"team",
"."
] | kislyuk/aegea | python | https://github.com/kislyuk/aegea/blob/94957e9dba036eae3052e2662c208b259c08399a/aegea/packages/github3/orgs.py#L182-L194 | [
"def",
"remove_member",
"(",
"self",
",",
"login",
")",
":",
"warnings",
".",
"warn",
"(",
"'This is no longer supported by the GitHub API, see '",
"'https://developer.github.com/changes/2014-09-23-one-more-week'",
"'-before-the-add-team-member-api-breaking-change/'",
",",
"Deprecati... | 94957e9dba036eae3052e2662c208b259c08399a |
train | Team.revoke_membership | Revoke this user's team membership.
:param str username: (required), name of the team member
:returns: bool | aegea/packages/github3/orgs.py | def revoke_membership(self, username):
"""Revoke this user's team membership.
:param str username: (required), name of the team member
:returns: bool
"""
url = self._build_url('memberships', username, base_url=self._api)
return self._boolean(self._delete(url), 204, 404) | def revoke_membership(self, username):
"""Revoke this user's team membership.
:param str username: (required), name of the team member
:returns: bool
"""
url = self._build_url('memberships', username, base_url=self._api)
return self._boolean(self._delete(url), 204, 404) | [
"Revoke",
"this",
"user",
"s",
"team",
"membership",
"."
] | kislyuk/aegea | python | https://github.com/kislyuk/aegea/blob/94957e9dba036eae3052e2662c208b259c08399a/aegea/packages/github3/orgs.py#L197-L204 | [
"def",
"revoke_membership",
"(",
"self",
",",
"username",
")",
":",
"url",
"=",
"self",
".",
"_build_url",
"(",
"'memberships'",
",",
"username",
",",
"base_url",
"=",
"self",
".",
"_api",
")",
"return",
"self",
".",
"_boolean",
"(",
"self",
".",
"_delet... | 94957e9dba036eae3052e2662c208b259c08399a |
train | Team.remove_repo | Remove ``repo`` from this team.
:param str repo: (required), form: 'user/repo'
:returns: bool | aegea/packages/github3/orgs.py | def remove_repo(self, repo):
"""Remove ``repo`` from this team.
:param str repo: (required), form: 'user/repo'
:returns: bool
"""
url = self._build_url('repos', repo, base_url=self._api)
return self._boolean(self._delete(url), 204, 404) | def remove_repo(self, repo):
"""Remove ``repo`` from this team.
:param str repo: (required), form: 'user/repo'
:returns: bool
"""
url = self._build_url('repos', repo, base_url=self._api)
return self._boolean(self._delete(url), 204, 404) | [
"Remove",
"repo",
"from",
"this",
"team",
"."
] | kislyuk/aegea | python | https://github.com/kislyuk/aegea/blob/94957e9dba036eae3052e2662c208b259c08399a/aegea/packages/github3/orgs.py#L207-L214 | [
"def",
"remove_repo",
"(",
"self",
",",
"repo",
")",
":",
"url",
"=",
"self",
".",
"_build_url",
"(",
"'repos'",
",",
"repo",
",",
"base_url",
"=",
"self",
".",
"_api",
")",
"return",
"self",
".",
"_boolean",
"(",
"self",
".",
"_delete",
"(",
"url",
... | 94957e9dba036eae3052e2662c208b259c08399a |
train | Organization.add_member | Add ``login`` to ``team`` and thereby to this organization.
.. warning::
This method is no longer valid. To add a member to a team, you
must now retrieve the team directly, and use the ``invite``
method.
Any user that is to be added to an organization, must be added... | aegea/packages/github3/orgs.py | def add_member(self, login, team):
"""Add ``login`` to ``team`` and thereby to this organization.
.. warning::
This method is no longer valid. To add a member to a team, you
must now retrieve the team directly, and use the ``invite``
method.
Any user that is... | def add_member(self, login, team):
"""Add ``login`` to ``team`` and thereby to this organization.
.. warning::
This method is no longer valid. To add a member to a team, you
must now retrieve the team directly, and use the ``invite``
method.
Any user that is... | [
"Add",
"login",
"to",
"team",
"and",
"thereby",
"to",
"this",
"organization",
"."
] | kislyuk/aegea | python | https://github.com/kislyuk/aegea/blob/94957e9dba036eae3052e2662c208b259c08399a/aegea/packages/github3/orgs.py#L256-L286 | [
"def",
"add_member",
"(",
"self",
",",
"login",
",",
"team",
")",
":",
"warnings",
".",
"warn",
"(",
"'This is no longer supported by the GitHub API, see '",
"'https://developer.github.com/changes/2014-09-23-one-more-week'",
"'-before-the-add-team-member-api-breaking-change/'",
","... | 94957e9dba036eae3052e2662c208b259c08399a |
train | Organization.add_repo | Add ``repo`` to ``team``.
.. note::
This method is of complexity O(n). This iterates over all teams in
your organization and only adds the repo when the team name
matches the team parameter above. If you want constant time, you
should retrieve the team and call `... | aegea/packages/github3/orgs.py | def add_repo(self, repo, team):
"""Add ``repo`` to ``team``.
.. note::
This method is of complexity O(n). This iterates over all teams in
your organization and only adds the repo when the team name
matches the team parameter above. If you want constant time, you
... | def add_repo(self, repo, team):
"""Add ``repo`` to ``team``.
.. note::
This method is of complexity O(n). This iterates over all teams in
your organization and only adds the repo when the team name
matches the team parameter above. If you want constant time, you
... | [
"Add",
"repo",
"to",
"team",
"."
] | kislyuk/aegea | python | https://github.com/kislyuk/aegea/blob/94957e9dba036eae3052e2662c208b259c08399a/aegea/packages/github3/orgs.py#L289-L305 | [
"def",
"add_repo",
"(",
"self",
",",
"repo",
",",
"team",
")",
":",
"for",
"t",
"in",
"self",
".",
"iter_teams",
"(",
")",
":",
"if",
"team",
"==",
"t",
".",
"name",
":",
"return",
"t",
".",
"add_repo",
"(",
"repo",
")",
"return",
"False"
] | 94957e9dba036eae3052e2662c208b259c08399a |
train | Organization.create_repo | Create a repository for this organization if the authenticated user
is a member.
:param str name: (required), name of the repository
:param str description: (optional)
:param str homepage: (optional)
:param bool private: (optional), If ``True``, create a private
repo... | aegea/packages/github3/orgs.py | def create_repo(self,
name,
description='',
homepage='',
private=False,
has_issues=True,
has_wiki=True,
has_downloads=True,
team_id=0,
auto_... | def create_repo(self,
name,
description='',
homepage='',
private=False,
has_issues=True,
has_wiki=True,
has_downloads=True,
team_id=0,
auto_... | [
"Create",
"a",
"repository",
"for",
"this",
"organization",
"if",
"the",
"authenticated",
"user",
"is",
"a",
"member",
"."
] | kislyuk/aegea | python | https://github.com/kislyuk/aegea/blob/94957e9dba036eae3052e2662c208b259c08399a/aegea/packages/github3/orgs.py#L308-L351 | [
"def",
"create_repo",
"(",
"self",
",",
"name",
",",
"description",
"=",
"''",
",",
"homepage",
"=",
"''",
",",
"private",
"=",
"False",
",",
"has_issues",
"=",
"True",
",",
"has_wiki",
"=",
"True",
",",
"has_downloads",
"=",
"True",
",",
"team_id",
"=... | 94957e9dba036eae3052e2662c208b259c08399a |
train | Organization.conceal_member | Conceal ``login``'s membership in this organization.
:returns: bool | aegea/packages/github3/orgs.py | def conceal_member(self, login):
"""Conceal ``login``'s membership in this organization.
:returns: bool
"""
url = self._build_url('public_members', login, base_url=self._api)
return self._boolean(self._delete(url), 204, 404) | def conceal_member(self, login):
"""Conceal ``login``'s membership in this organization.
:returns: bool
"""
url = self._build_url('public_members', login, base_url=self._api)
return self._boolean(self._delete(url), 204, 404) | [
"Conceal",
"login",
"s",
"membership",
"in",
"this",
"organization",
"."
] | kislyuk/aegea | python | https://github.com/kislyuk/aegea/blob/94957e9dba036eae3052e2662c208b259c08399a/aegea/packages/github3/orgs.py#L354-L360 | [
"def",
"conceal_member",
"(",
"self",
",",
"login",
")",
":",
"url",
"=",
"self",
".",
"_build_url",
"(",
"'public_members'",
",",
"login",
",",
"base_url",
"=",
"self",
".",
"_api",
")",
"return",
"self",
".",
"_boolean",
"(",
"self",
".",
"_delete",
... | 94957e9dba036eae3052e2662c208b259c08399a |
train | Organization.create_team | Assuming the authenticated user owns this organization,
create and return a new team.
:param str name: (required), name to be given to the team
:param list repo_names: (optional) repositories, e.g.
['github/dotfiles']
:param str permission: (optional), options:
... | aegea/packages/github3/orgs.py | def create_team(self, name, repo_names=[], permission=''):
"""Assuming the authenticated user owns this organization,
create and return a new team.
:param str name: (required), name to be given to the team
:param list repo_names: (optional) repositories, e.g.
['github/dotfil... | def create_team(self, name, repo_names=[], permission=''):
"""Assuming the authenticated user owns this organization,
create and return a new team.
:param str name: (required), name to be given to the team
:param list repo_names: (optional) repositories, e.g.
['github/dotfil... | [
"Assuming",
"the",
"authenticated",
"user",
"owns",
"this",
"organization",
"create",
"and",
"return",
"a",
"new",
"team",
"."
] | kislyuk/aegea | python | https://github.com/kislyuk/aegea/blob/94957e9dba036eae3052e2662c208b259c08399a/aegea/packages/github3/orgs.py#L363-L385 | [
"def",
"create_team",
"(",
"self",
",",
"name",
",",
"repo_names",
"=",
"[",
"]",
",",
"permission",
"=",
"''",
")",
":",
"data",
"=",
"{",
"'name'",
":",
"name",
",",
"'repo_names'",
":",
"repo_names",
",",
"'permission'",
":",
"permission",
"}",
"url... | 94957e9dba036eae3052e2662c208b259c08399a |
train | Organization.edit | Edit this organization.
:param str billing_email: (optional) Billing email address (private)
:param str company: (optional)
:param str email: (optional) Public email address
:param str location: (optional)
:param str name: (optional)
:returns: bool | aegea/packages/github3/orgs.py | def edit(self,
billing_email=None,
company=None,
email=None,
location=None,
name=None):
"""Edit this organization.
:param str billing_email: (optional) Billing email address (private)
:param str company: (optional)
:param ... | def edit(self,
billing_email=None,
company=None,
email=None,
location=None,
name=None):
"""Edit this organization.
:param str billing_email: (optional) Billing email address (private)
:param str company: (optional)
:param ... | [
"Edit",
"this",
"organization",
"."
] | kislyuk/aegea | python | https://github.com/kislyuk/aegea/blob/94957e9dba036eae3052e2662c208b259c08399a/aegea/packages/github3/orgs.py#L388-L414 | [
"def",
"edit",
"(",
"self",
",",
"billing_email",
"=",
"None",
",",
"company",
"=",
"None",
",",
"email",
"=",
"None",
",",
"location",
"=",
"None",
",",
"name",
"=",
"None",
")",
":",
"json",
"=",
"None",
"data",
"=",
"{",
"'billing_email'",
":",
... | 94957e9dba036eae3052e2662c208b259c08399a |
train | Organization.is_public_member | Check if the user with login ``login`` is a public member.
:returns: bool | aegea/packages/github3/orgs.py | def is_public_member(self, login):
"""Check if the user with login ``login`` is a public member.
:returns: bool
"""
url = self._build_url('public_members', login, base_url=self._api)
return self._boolean(self._get(url), 204, 404) | def is_public_member(self, login):
"""Check if the user with login ``login`` is a public member.
:returns: bool
"""
url = self._build_url('public_members', login, base_url=self._api)
return self._boolean(self._get(url), 204, 404) | [
"Check",
"if",
"the",
"user",
"with",
"login",
"login",
"is",
"a",
"public",
"member",
"."
] | kislyuk/aegea | python | https://github.com/kislyuk/aegea/blob/94957e9dba036eae3052e2662c208b259c08399a/aegea/packages/github3/orgs.py#L424-L430 | [
"def",
"is_public_member",
"(",
"self",
",",
"login",
")",
":",
"url",
"=",
"self",
".",
"_build_url",
"(",
"'public_members'",
",",
"login",
",",
"base_url",
"=",
"self",
".",
"_api",
")",
"return",
"self",
".",
"_boolean",
"(",
"self",
".",
"_get",
"... | 94957e9dba036eae3052e2662c208b259c08399a |
train | Organization.iter_repos | Iterate over repos for this organization.
:param str type: (optional), accepted values:
('all', 'public', 'member', 'private', 'forks', 'sources'), API
default: 'all'
:param int number: (optional), number of members to return. Default:
-1 will return all available.
... | aegea/packages/github3/orgs.py | def iter_repos(self, type='', number=-1, etag=None):
"""Iterate over repos for this organization.
:param str type: (optional), accepted values:
('all', 'public', 'member', 'private', 'forks', 'sources'), API
default: 'all'
:param int number: (optional), number of members... | def iter_repos(self, type='', number=-1, etag=None):
"""Iterate over repos for this organization.
:param str type: (optional), accepted values:
('all', 'public', 'member', 'private', 'forks', 'sources'), API
default: 'all'
:param int number: (optional), number of members... | [
"Iterate",
"over",
"repos",
"for",
"this",
"organization",
"."
] | kislyuk/aegea | python | https://github.com/kislyuk/aegea/blob/94957e9dba036eae3052e2662c208b259c08399a/aegea/packages/github3/orgs.py#L468-L484 | [
"def",
"iter_repos",
"(",
"self",
",",
"type",
"=",
"''",
",",
"number",
"=",
"-",
"1",
",",
"etag",
"=",
"None",
")",
":",
"url",
"=",
"self",
".",
"_build_url",
"(",
"'repos'",
",",
"base_url",
"=",
"self",
".",
"_api",
")",
"params",
"=",
"{",... | 94957e9dba036eae3052e2662c208b259c08399a |
train | Organization.iter_teams | Iterate over teams that are part of this organization.
:param int number: (optional), number of teams to return. Default: -1
returns all available teams.
:param str etag: (optional), ETag from a previous request to the same
endpoint
:returns: generator of :class:`Team <T... | aegea/packages/github3/orgs.py | def iter_teams(self, number=-1, etag=None):
"""Iterate over teams that are part of this organization.
:param int number: (optional), number of teams to return. Default: -1
returns all available teams.
:param str etag: (optional), ETag from a previous request to the same
... | def iter_teams(self, number=-1, etag=None):
"""Iterate over teams that are part of this organization.
:param int number: (optional), number of teams to return. Default: -1
returns all available teams.
:param str etag: (optional), ETag from a previous request to the same
... | [
"Iterate",
"over",
"teams",
"that",
"are",
"part",
"of",
"this",
"organization",
"."
] | kislyuk/aegea | python | https://github.com/kislyuk/aegea/blob/94957e9dba036eae3052e2662c208b259c08399a/aegea/packages/github3/orgs.py#L487-L497 | [
"def",
"iter_teams",
"(",
"self",
",",
"number",
"=",
"-",
"1",
",",
"etag",
"=",
"None",
")",
":",
"url",
"=",
"self",
".",
"_build_url",
"(",
"'teams'",
",",
"base_url",
"=",
"self",
".",
"_api",
")",
"return",
"self",
".",
"_iter",
"(",
"int",
... | 94957e9dba036eae3052e2662c208b259c08399a |
train | Organization.publicize_member | Make ``login``'s membership in this organization public.
:returns: bool | aegea/packages/github3/orgs.py | def publicize_member(self, login):
"""Make ``login``'s membership in this organization public.
:returns: bool
"""
url = self._build_url('public_members', login, base_url=self._api)
return self._boolean(self._put(url), 204, 404) | def publicize_member(self, login):
"""Make ``login``'s membership in this organization public.
:returns: bool
"""
url = self._build_url('public_members', login, base_url=self._api)
return self._boolean(self._put(url), 204, 404) | [
"Make",
"login",
"s",
"membership",
"in",
"this",
"organization",
"public",
"."
] | kislyuk/aegea | python | https://github.com/kislyuk/aegea/blob/94957e9dba036eae3052e2662c208b259c08399a/aegea/packages/github3/orgs.py#L500-L506 | [
"def",
"publicize_member",
"(",
"self",
",",
"login",
")",
":",
"url",
"=",
"self",
".",
"_build_url",
"(",
"'public_members'",
",",
"login",
",",
"base_url",
"=",
"self",
".",
"_api",
")",
"return",
"self",
".",
"_boolean",
"(",
"self",
".",
"_put",
"... | 94957e9dba036eae3052e2662c208b259c08399a |
train | Organization.remove_repo | Remove ``repo`` from ``team``.
:param str repo: (required), form: 'user/repo'
:param str team: (required)
:returns: bool | aegea/packages/github3/orgs.py | def remove_repo(self, repo, team):
"""Remove ``repo`` from ``team``.
:param str repo: (required), form: 'user/repo'
:param str team: (required)
:returns: bool
"""
for t in self.iter_teams():
if team == t.name:
return t.remove_repo(repo)
... | def remove_repo(self, repo, team):
"""Remove ``repo`` from ``team``.
:param str repo: (required), form: 'user/repo'
:param str team: (required)
:returns: bool
"""
for t in self.iter_teams():
if team == t.name:
return t.remove_repo(repo)
... | [
"Remove",
"repo",
"from",
"team",
"."
] | kislyuk/aegea | python | https://github.com/kislyuk/aegea/blob/94957e9dba036eae3052e2662c208b259c08399a/aegea/packages/github3/orgs.py#L519-L529 | [
"def",
"remove_repo",
"(",
"self",
",",
"repo",
",",
"team",
")",
":",
"for",
"t",
"in",
"self",
".",
"iter_teams",
"(",
")",
":",
"if",
"team",
"==",
"t",
".",
"name",
":",
"return",
"t",
".",
"remove_repo",
"(",
"repo",
")",
"return",
"False"
] | 94957e9dba036eae3052e2662c208b259c08399a |
train | Organization.team | Returns Team object with information about team specified by
``team_id``.
:param int team_id: (required), unique id for the team
:returns: :class:`Team <Team>` | aegea/packages/github3/orgs.py | def team(self, team_id):
"""Returns Team object with information about team specified by
``team_id``.
:param int team_id: (required), unique id for the team
:returns: :class:`Team <Team>`
"""
json = None
if int(team_id) > 0:
url = self._build_url('tea... | def team(self, team_id):
"""Returns Team object with information about team specified by
``team_id``.
:param int team_id: (required), unique id for the team
:returns: :class:`Team <Team>`
"""
json = None
if int(team_id) > 0:
url = self._build_url('tea... | [
"Returns",
"Team",
"object",
"with",
"information",
"about",
"team",
"specified",
"by",
"team_id",
"."
] | kislyuk/aegea | python | https://github.com/kislyuk/aegea/blob/94957e9dba036eae3052e2662c208b259c08399a/aegea/packages/github3/orgs.py#L532-L543 | [
"def",
"team",
"(",
"self",
",",
"team_id",
")",
":",
"json",
"=",
"None",
"if",
"int",
"(",
"team_id",
")",
">",
"0",
":",
"url",
"=",
"self",
".",
"_build_url",
"(",
"'teams'",
",",
"str",
"(",
"team_id",
")",
")",
"json",
"=",
"self",
".",
"... | 94957e9dba036eae3052e2662c208b259c08399a |
train | Membership.edit | Edit the user's membership.
:param str state: (required), the state the membership should be in.
Only accepts ``"active"``.
:returns: itself | aegea/packages/github3/orgs.py | def edit(self, state):
"""Edit the user's membership.
:param str state: (required), the state the membership should be in.
Only accepts ``"active"``.
:returns: itself
"""
if state and state.lower() == 'active':
data = dumps({'state': state.lower()})
... | def edit(self, state):
"""Edit the user's membership.
:param str state: (required), the state the membership should be in.
Only accepts ``"active"``.
:returns: itself
"""
if state and state.lower() == 'active':
data = dumps({'state': state.lower()})
... | [
"Edit",
"the",
"user",
"s",
"membership",
"."
] | kislyuk/aegea | python | https://github.com/kislyuk/aegea/blob/94957e9dba036eae3052e2662c208b259c08399a/aegea/packages/github3/orgs.py#L567-L578 | [
"def",
"edit",
"(",
"self",
",",
"state",
")",
":",
"if",
"state",
"and",
"state",
".",
"lower",
"(",
")",
"==",
"'active'",
":",
"data",
"=",
"dumps",
"(",
"{",
"'state'",
":",
"state",
".",
"lower",
"(",
")",
"}",
")",
"json",
"=",
"self",
".... | 94957e9dba036eae3052e2662c208b259c08399a |
train | Release.delete | Users with push access to the repository can delete a release.
:returns: True if successful; False if not successful | aegea/packages/github3/repos/release.py | def delete(self):
"""Users with push access to the repository can delete a release.
:returns: True if successful; False if not successful
"""
url = self._api
return self._boolean(
self._delete(url, headers=Release.CUSTOM_HEADERS),
204,
404
... | def delete(self):
"""Users with push access to the repository can delete a release.
:returns: True if successful; False if not successful
"""
url = self._api
return self._boolean(
self._delete(url, headers=Release.CUSTOM_HEADERS),
204,
404
... | [
"Users",
"with",
"push",
"access",
"to",
"the",
"repository",
"can",
"delete",
"a",
"release",
"."
] | kislyuk/aegea | python | https://github.com/kislyuk/aegea/blob/94957e9dba036eae3052e2662c208b259c08399a/aegea/packages/github3/repos/release.py#L57-L67 | [
"def",
"delete",
"(",
"self",
")",
":",
"url",
"=",
"self",
".",
"_api",
"return",
"self",
".",
"_boolean",
"(",
"self",
".",
"_delete",
"(",
"url",
",",
"headers",
"=",
"Release",
".",
"CUSTOM_HEADERS",
")",
",",
"204",
",",
"404",
")"
] | 94957e9dba036eae3052e2662c208b259c08399a |
train | Release.edit | Users with push access to the repository can edit a release.
If the edit is successful, this object will update itself.
:param str tag_name: (optional), Name of the tag to use
:param str target_commitish: (optional), The "commitish" value that
determines where the Git tag is create... | aegea/packages/github3/repos/release.py | def edit(self, tag_name=None, target_commitish=None, name=None, body=None,
draft=None, prerelease=None):
"""Users with push access to the repository can edit a release.
If the edit is successful, this object will update itself.
:param str tag_name: (optional), Name of the tag to u... | def edit(self, tag_name=None, target_commitish=None, name=None, body=None,
draft=None, prerelease=None):
"""Users with push access to the repository can edit a release.
If the edit is successful, this object will update itself.
:param str tag_name: (optional), Name of the tag to u... | [
"Users",
"with",
"push",
"access",
"to",
"the",
"repository",
"can",
"edit",
"a",
"release",
"."
] | kislyuk/aegea | python | https://github.com/kislyuk/aegea/blob/94957e9dba036eae3052e2662c208b259c08399a/aegea/packages/github3/repos/release.py#L70-L106 | [
"def",
"edit",
"(",
"self",
",",
"tag_name",
"=",
"None",
",",
"target_commitish",
"=",
"None",
",",
"name",
"=",
"None",
",",
"body",
"=",
"None",
",",
"draft",
"=",
"None",
",",
"prerelease",
"=",
"None",
")",
":",
"url",
"=",
"self",
".",
"_api"... | 94957e9dba036eae3052e2662c208b259c08399a |
train | Release.iter_assets | Iterate over the assets available for this release.
:param int number: (optional), Number of assets to return
:param str etag: (optional), last ETag header sent
:returns: generator of :class:`Asset <Asset>` objects | aegea/packages/github3/repos/release.py | def iter_assets(self, number=-1, etag=None):
"""Iterate over the assets available for this release.
:param int number: (optional), Number of assets to return
:param str etag: (optional), last ETag header sent
:returns: generator of :class:`Asset <Asset>` objects
"""
url ... | def iter_assets(self, number=-1, etag=None):
"""Iterate over the assets available for this release.
:param int number: (optional), Number of assets to return
:param str etag: (optional), last ETag header sent
:returns: generator of :class:`Asset <Asset>` objects
"""
url ... | [
"Iterate",
"over",
"the",
"assets",
"available",
"for",
"this",
"release",
"."
] | kislyuk/aegea | python | https://github.com/kislyuk/aegea/blob/94957e9dba036eae3052e2662c208b259c08399a/aegea/packages/github3/repos/release.py#L108-L116 | [
"def",
"iter_assets",
"(",
"self",
",",
"number",
"=",
"-",
"1",
",",
"etag",
"=",
"None",
")",
":",
"url",
"=",
"self",
".",
"_build_url",
"(",
"'assets'",
",",
"base_url",
"=",
"self",
".",
"_api",
")",
"return",
"self",
".",
"_iter",
"(",
"numbe... | 94957e9dba036eae3052e2662c208b259c08399a |
train | Release.upload_asset | Upload an asset to this release.
All parameters are required.
:param str content_type: The content type of the asset. Wikipedia has
a list of common media types
:param str name: The name of the file
:param asset: The file or bytes object to upload.
:returns: :class:... | aegea/packages/github3/repos/release.py | def upload_asset(self, content_type, name, asset):
"""Upload an asset to this release.
All parameters are required.
:param str content_type: The content type of the asset. Wikipedia has
a list of common media types
:param str name: The name of the file
:param asset:... | def upload_asset(self, content_type, name, asset):
"""Upload an asset to this release.
All parameters are required.
:param str content_type: The content type of the asset. Wikipedia has
a list of common media types
:param str name: The name of the file
:param asset:... | [
"Upload",
"an",
"asset",
"to",
"this",
"release",
"."
] | kislyuk/aegea | python | https://github.com/kislyuk/aegea/blob/94957e9dba036eae3052e2662c208b259c08399a/aegea/packages/github3/repos/release.py#L119-L137 | [
"def",
"upload_asset",
"(",
"self",
",",
"content_type",
",",
"name",
",",
"asset",
")",
":",
"headers",
"=",
"Release",
".",
"CUSTOM_HEADERS",
".",
"copy",
"(",
")",
"headers",
".",
"update",
"(",
"{",
"'Content-Type'",
":",
"content_type",
"}",
")",
"u... | 94957e9dba036eae3052e2662c208b259c08399a |
train | Asset.download | Download the data for this asset.
:param path: (optional), path where the file should be saved
to, default is the filename provided in the headers and will be
written in the current directory.
it can take a file-like object as well
:type path: str, file
:retu... | aegea/packages/github3/repos/release.py | def download(self, path=''):
"""Download the data for this asset.
:param path: (optional), path where the file should be saved
to, default is the filename provided in the headers and will be
written in the current directory.
it can take a file-like object as well
... | def download(self, path=''):
"""Download the data for this asset.
:param path: (optional), path where the file should be saved
to, default is the filename provided in the headers and will be
written in the current directory.
it can take a file-like object as well
... | [
"Download",
"the",
"data",
"for",
"this",
"asset",
"."
] | kislyuk/aegea | python | https://github.com/kislyuk/aegea/blob/94957e9dba036eae3052e2662c208b259c08399a/aegea/packages/github3/repos/release.py#L169-L197 | [
"def",
"download",
"(",
"self",
",",
"path",
"=",
"''",
")",
":",
"headers",
"=",
"{",
"'Accept'",
":",
"'application/octet-stream'",
"}",
"resp",
"=",
"self",
".",
"_get",
"(",
"self",
".",
"_api",
",",
"allow_redirects",
"=",
"False",
",",
"stream",
... | 94957e9dba036eae3052e2662c208b259c08399a |
train | Asset.edit | Edit this asset.
:param str name: (required), The file name of the asset
:param str label: (optional), An alternate description of the asset
:returns: boolean | aegea/packages/github3/repos/release.py | def edit(self, name, label=None):
"""Edit this asset.
:param str name: (required), The file name of the asset
:param str label: (optional), An alternate description of the asset
:returns: boolean
"""
if not name:
return False
edit_data = {'name': name... | def edit(self, name, label=None):
"""Edit this asset.
:param str name: (required), The file name of the asset
:param str label: (optional), An alternate description of the asset
:returns: boolean
"""
if not name:
return False
edit_data = {'name': name... | [
"Edit",
"this",
"asset",
"."
] | kislyuk/aegea | python | https://github.com/kislyuk/aegea/blob/94957e9dba036eae3052e2662c208b259c08399a/aegea/packages/github3/repos/release.py#L199-L219 | [
"def",
"edit",
"(",
"self",
",",
"name",
",",
"label",
"=",
"None",
")",
":",
"if",
"not",
"name",
":",
"return",
"False",
"edit_data",
"=",
"{",
"'name'",
":",
"name",
",",
"'label'",
":",
"label",
"}",
"self",
".",
"_remove_none",
"(",
"edit_data",... | 94957e9dba036eae3052e2662c208b259c08399a |
train | ls | List status of all configured SNS-SQS message buses and instances subscribed to them. | aegea/deploy.py | def ls(args):
"""
List status of all configured SNS-SQS message buses and instances subscribed to them.
"""
table = []
queues = list(resources.sqs.queues.filter(QueueNamePrefix="github"))
max_age = datetime.now(tzutc()) - timedelta(days=15)
for topic in resources.sns.topics.all():
ac... | def ls(args):
"""
List status of all configured SNS-SQS message buses and instances subscribed to them.
"""
table = []
queues = list(resources.sqs.queues.filter(QueueNamePrefix="github"))
max_age = datetime.now(tzutc()) - timedelta(days=15)
for topic in resources.sns.topics.all():
ac... | [
"List",
"status",
"of",
"all",
"configured",
"SNS",
"-",
"SQS",
"message",
"buses",
"and",
"instances",
"subscribed",
"to",
"them",
"."
] | kislyuk/aegea | python | https://github.com/kislyuk/aegea/blob/94957e9dba036eae3052e2662c208b259c08399a/aegea/deploy.py#L93-L125 | [
"def",
"ls",
"(",
"args",
")",
":",
"table",
"=",
"[",
"]",
"queues",
"=",
"list",
"(",
"resources",
".",
"sqs",
".",
"queues",
".",
"filter",
"(",
"QueueNamePrefix",
"=",
"\"github\"",
")",
")",
"max_age",
"=",
"datetime",
".",
"now",
"(",
"tzutc",
... | 94957e9dba036eae3052e2662c208b259c08399a |
train | grant | Given an IAM role or instance name, attach an IAM policy granting
appropriate permissions to subscribe to deployments. Given a
GitHub repo URL, create and record deployment keys for the repo
and any of its private submodules, making the keys accessible to
the IAM role. | aegea/deploy.py | def grant(args):
"""
Given an IAM role or instance name, attach an IAM policy granting
appropriate permissions to subscribe to deployments. Given a
GitHub repo URL, create and record deployment keys for the repo
and any of its private submodules, making the keys accessible to
the IAM role.
"... | def grant(args):
"""
Given an IAM role or instance name, attach an IAM policy granting
appropriate permissions to subscribe to deployments. Given a
GitHub repo URL, create and record deployment keys for the repo
and any of its private submodules, making the keys accessible to
the IAM role.
"... | [
"Given",
"an",
"IAM",
"role",
"or",
"instance",
"name",
"attach",
"an",
"IAM",
"policy",
"granting",
"appropriate",
"permissions",
"to",
"subscribe",
"to",
"deployments",
".",
"Given",
"a",
"GitHub",
"repo",
"URL",
"create",
"and",
"record",
"deployment",
"key... | kislyuk/aegea | python | https://github.com/kislyuk/aegea/blob/94957e9dba036eae3052e2662c208b259c08399a/aegea/deploy.py#L138-L162 | [
"def",
"grant",
"(",
"args",
")",
":",
"try",
":",
"role",
"=",
"resources",
".",
"iam",
".",
"Role",
"(",
"args",
".",
"iam_role_or_instance",
")",
"role",
".",
"load",
"(",
")",
"except",
"ClientError",
":",
"role",
"=",
"get_iam_role_for_instance",
"(... | 94957e9dba036eae3052e2662c208b259c08399a |
train | Contents.delete | Delete this file.
:param str message: (required), commit message to describe the removal
:param str branch: (optional), branch where the file exists.
Defaults to the default branch of the repository.
:param dict committer: (optional), if no information is given the
authe... | aegea/packages/github3/repos/contents.py | def delete(self, message, branch=None, committer=None, author=None):
"""Delete this file.
:param str message: (required), commit message to describe the removal
:param str branch: (optional), branch where the file exists.
Defaults to the default branch of the repository.
:pa... | def delete(self, message, branch=None, committer=None, author=None):
"""Delete this file.
:param str message: (required), commit message to describe the removal
:param str branch: (optional), branch where the file exists.
Defaults to the default branch of the repository.
:pa... | [
"Delete",
"this",
"file",
"."
] | kislyuk/aegea | python | https://github.com/kislyuk/aegea/blob/94957e9dba036eae3052e2662c208b259c08399a/aegea/packages/github3/repos/contents.py#L97-L121 | [
"def",
"delete",
"(",
"self",
",",
"message",
",",
"branch",
"=",
"None",
",",
"committer",
"=",
"None",
",",
"author",
"=",
"None",
")",
":",
"json",
"=",
"None",
"if",
"message",
":",
"data",
"=",
"{",
"'message'",
":",
"message",
",",
"'sha'",
"... | 94957e9dba036eae3052e2662c208b259c08399a |
train | Contents.update | Update this file.
:param str message: (required), commit message to describe the update
:param str content: (required), content to update the file with
:param str branch: (optional), branch where the file exists.
Defaults to the default branch of the repository.
:param dict ... | aegea/packages/github3/repos/contents.py | def update(self, message, content, branch=None, committer=None,
author=None):
"""Update this file.
:param str message: (required), commit message to describe the update
:param str content: (required), content to update the file with
:param str branch: (optional), branch w... | def update(self, message, content, branch=None, committer=None,
author=None):
"""Update this file.
:param str message: (required), commit message to describe the update
:param str content: (required), content to update the file with
:param str branch: (optional), branch w... | [
"Update",
"this",
"file",
"."
] | kislyuk/aegea | python | https://github.com/kislyuk/aegea/blob/94957e9dba036eae3052e2662c208b259c08399a/aegea/packages/github3/repos/contents.py#L124-L157 | [
"def",
"update",
"(",
"self",
",",
"message",
",",
"content",
",",
"branch",
"=",
"None",
",",
"committer",
"=",
"None",
",",
"author",
"=",
"None",
")",
":",
"if",
"content",
"and",
"not",
"isinstance",
"(",
"content",
",",
"bytes",
")",
":",
"raise... | 94957e9dba036eae3052e2662c208b259c08399a |
train | Gist.edit | Edit this gist.
:param str description: (optional), description of the gist
:param dict files: (optional), files that make up this gist; the
key(s) should be the file name(s) and the values should be another
(optional) dictionary with (optional) keys: 'content' and
'... | aegea/packages/github3/gists/gist.py | def edit(self, description='', files={}):
"""Edit this gist.
:param str description: (optional), description of the gist
:param dict files: (optional), files that make up this gist; the
key(s) should be the file name(s) and the values should be another
(optional) diction... | def edit(self, description='', files={}):
"""Edit this gist.
:param str description: (optional), description of the gist
:param dict files: (optional), files that make up this gist; the
key(s) should be the file name(s) and the values should be another
(optional) diction... | [
"Edit",
"this",
"gist",
"."
] | kislyuk/aegea | python | https://github.com/kislyuk/aegea/blob/94957e9dba036eae3052e2662c208b259c08399a/aegea/packages/github3/gists/gist.py#L137-L160 | [
"def",
"edit",
"(",
"self",
",",
"description",
"=",
"''",
",",
"files",
"=",
"{",
"}",
")",
":",
"data",
"=",
"{",
"}",
"json",
"=",
"None",
"if",
"description",
":",
"data",
"[",
"'description'",
"]",
"=",
"description",
"if",
"files",
":",
"data... | 94957e9dba036eae3052e2662c208b259c08399a |
train | Gist.fork | Fork this gist.
:returns: :class:`Gist <Gist>` if successful, ``None`` otherwise | aegea/packages/github3/gists/gist.py | def fork(self):
"""Fork this gist.
:returns: :class:`Gist <Gist>` if successful, ``None`` otherwise
"""
url = self._build_url('forks', base_url=self._api)
json = self._json(self._post(url), 201)
return Gist(json, self) if json else None | def fork(self):
"""Fork this gist.
:returns: :class:`Gist <Gist>` if successful, ``None`` otherwise
"""
url = self._build_url('forks', base_url=self._api)
json = self._json(self._post(url), 201)
return Gist(json, self) if json else None | [
"Fork",
"this",
"gist",
"."
] | kislyuk/aegea | python | https://github.com/kislyuk/aegea/blob/94957e9dba036eae3052e2662c208b259c08399a/aegea/packages/github3/gists/gist.py#L163-L171 | [
"def",
"fork",
"(",
"self",
")",
":",
"url",
"=",
"self",
".",
"_build_url",
"(",
"'forks'",
",",
"base_url",
"=",
"self",
".",
"_api",
")",
"json",
"=",
"self",
".",
"_json",
"(",
"self",
".",
"_post",
"(",
"url",
")",
",",
"201",
")",
"return",... | 94957e9dba036eae3052e2662c208b259c08399a |
train | Gist.is_starred | Check to see if this gist is starred by the authenticated user.
:returns: bool -- True if it is starred, False otherwise | aegea/packages/github3/gists/gist.py | def is_starred(self):
"""Check to see if this gist is starred by the authenticated user.
:returns: bool -- True if it is starred, False otherwise
"""
url = self._build_url('star', base_url=self._api)
return self._boolean(self._get(url), 204, 404) | def is_starred(self):
"""Check to see if this gist is starred by the authenticated user.
:returns: bool -- True if it is starred, False otherwise
"""
url = self._build_url('star', base_url=self._api)
return self._boolean(self._get(url), 204, 404) | [
"Check",
"to",
"see",
"if",
"this",
"gist",
"is",
"starred",
"by",
"the",
"authenticated",
"user",
"."
] | kislyuk/aegea | python | https://github.com/kislyuk/aegea/blob/94957e9dba036eae3052e2662c208b259c08399a/aegea/packages/github3/gists/gist.py#L182-L189 | [
"def",
"is_starred",
"(",
"self",
")",
":",
"url",
"=",
"self",
".",
"_build_url",
"(",
"'star'",
",",
"base_url",
"=",
"self",
".",
"_api",
")",
"return",
"self",
".",
"_boolean",
"(",
"self",
".",
"_get",
"(",
"url",
")",
",",
"204",
",",
"404",
... | 94957e9dba036eae3052e2662c208b259c08399a |
train | Gist.iter_commits | Iter over the commits on this gist.
These commits will be requested from the API and should be the same as
what is in ``Gist.history``.
.. versionadded:: 0.6
.. versionchanged:: 0.9
Added param ``etag``.
:param int number: (optional), number of commits to iterate... | aegea/packages/github3/gists/gist.py | def iter_commits(self, number=-1, etag=None):
"""Iter over the commits on this gist.
These commits will be requested from the API and should be the same as
what is in ``Gist.history``.
.. versionadded:: 0.6
.. versionchanged:: 0.9
Added param ``etag``.
:p... | def iter_commits(self, number=-1, etag=None):
"""Iter over the commits on this gist.
These commits will be requested from the API and should be the same as
what is in ``Gist.history``.
.. versionadded:: 0.6
.. versionchanged:: 0.9
Added param ``etag``.
:p... | [
"Iter",
"over",
"the",
"commits",
"on",
"this",
"gist",
"."
] | kislyuk/aegea | python | https://github.com/kislyuk/aegea/blob/94957e9dba036eae3052e2662c208b259c08399a/aegea/packages/github3/gists/gist.py#L205-L227 | [
"def",
"iter_commits",
"(",
"self",
",",
"number",
"=",
"-",
"1",
",",
"etag",
"=",
"None",
")",
":",
"url",
"=",
"self",
".",
"_build_url",
"(",
"'commits'",
",",
"base_url",
"=",
"self",
".",
"_api",
")",
"return",
"self",
".",
"_iter",
"(",
"int... | 94957e9dba036eae3052e2662c208b259c08399a |
train | Gist.iter_forks | Iterator of forks of this gist.
.. versionchanged:: 0.9
Added params ``number`` and ``etag``.
:param int number: (optional), number of forks to iterate over.
Default: -1 will iterate over all forks of this gist.
:param str etag: (optional), ETag from a previous request... | aegea/packages/github3/gists/gist.py | def iter_forks(self, number=-1, etag=None):
"""Iterator of forks of this gist.
.. versionchanged:: 0.9
Added params ``number`` and ``etag``.
:param int number: (optional), number of forks to iterate over.
Default: -1 will iterate over all forks of this gist.
:p... | def iter_forks(self, number=-1, etag=None):
"""Iterator of forks of this gist.
.. versionchanged:: 0.9
Added params ``number`` and ``etag``.
:param int number: (optional), number of forks to iterate over.
Default: -1 will iterate over all forks of this gist.
:p... | [
"Iterator",
"of",
"forks",
"of",
"this",
"gist",
"."
] | kislyuk/aegea | python | https://github.com/kislyuk/aegea/blob/94957e9dba036eae3052e2662c208b259c08399a/aegea/packages/github3/gists/gist.py#L237-L252 | [
"def",
"iter_forks",
"(",
"self",
",",
"number",
"=",
"-",
"1",
",",
"etag",
"=",
"None",
")",
":",
"url",
"=",
"self",
".",
"_build_url",
"(",
"'forks'",
",",
"base_url",
"=",
"self",
".",
"_api",
")",
"return",
"self",
".",
"_iter",
"(",
"int",
... | 94957e9dba036eae3052e2662c208b259c08399a |
train | Gist.star | Star this gist.
:returns: bool -- True if successful, False otherwise | aegea/packages/github3/gists/gist.py | def star(self):
"""Star this gist.
:returns: bool -- True if successful, False otherwise
"""
url = self._build_url('star', base_url=self._api)
return self._boolean(self._put(url), 204, 404) | def star(self):
"""Star this gist.
:returns: bool -- True if successful, False otherwise
"""
url = self._build_url('star', base_url=self._api)
return self._boolean(self._put(url), 204, 404) | [
"Star",
"this",
"gist",
"."
] | kislyuk/aegea | python | https://github.com/kislyuk/aegea/blob/94957e9dba036eae3052e2662c208b259c08399a/aegea/packages/github3/gists/gist.py#L255-L262 | [
"def",
"star",
"(",
"self",
")",
":",
"url",
"=",
"self",
".",
"_build_url",
"(",
"'star'",
",",
"base_url",
"=",
"self",
".",
"_api",
")",
"return",
"self",
".",
"_boolean",
"(",
"self",
".",
"_put",
"(",
"url",
")",
",",
"204",
",",
"404",
")"
... | 94957e9dba036eae3052e2662c208b259c08399a |
train | Gist.unstar | Un-star this gist.
:returns: bool -- True if successful, False otherwise | aegea/packages/github3/gists/gist.py | def unstar(self):
"""Un-star this gist.
:returns: bool -- True if successful, False otherwise
"""
url = self._build_url('star', base_url=self._api)
return self._boolean(self._delete(url), 204, 404) | def unstar(self):
"""Un-star this gist.
:returns: bool -- True if successful, False otherwise
"""
url = self._build_url('star', base_url=self._api)
return self._boolean(self._delete(url), 204, 404) | [
"Un",
"-",
"star",
"this",
"gist",
"."
] | kislyuk/aegea | python | https://github.com/kislyuk/aegea/blob/94957e9dba036eae3052e2662c208b259c08399a/aegea/packages/github3/gists/gist.py#L265-L272 | [
"def",
"unstar",
"(",
"self",
")",
":",
"url",
"=",
"self",
".",
"_build_url",
"(",
"'star'",
",",
"base_url",
"=",
"self",
".",
"_api",
")",
"return",
"self",
".",
"_boolean",
"(",
"self",
".",
"_delete",
"(",
"url",
")",
",",
"204",
",",
"404",
... | 94957e9dba036eae3052e2662c208b259c08399a |
train | RepoComment.update | Update this comment.
:param str body: (required)
:returns: bool | aegea/packages/github3/repos/comment.py | def update(self, body):
"""Update this comment.
:param str body: (required)
:returns: bool
"""
json = None
if body:
json = self._json(self._post(self._api, data={'body': body}), 200)
if json:
self._update_(json)
return True
... | def update(self, body):
"""Update this comment.
:param str body: (required)
:returns: bool
"""
json = None
if body:
json = self._json(self._post(self._api, data={'body': body}), 200)
if json:
self._update_(json)
return True
... | [
"Update",
"this",
"comment",
"."
] | kislyuk/aegea | python | https://github.com/kislyuk/aegea/blob/94957e9dba036eae3052e2662c208b259c08399a/aegea/packages/github3/repos/comment.py#L60-L73 | [
"def",
"update",
"(",
"self",
",",
"body",
")",
":",
"json",
"=",
"None",
"if",
"body",
":",
"json",
"=",
"self",
".",
"_json",
"(",
"self",
".",
"_post",
"(",
"self",
".",
"_api",
",",
"data",
"=",
"{",
"'body'",
":",
"body",
"}",
")",
",",
... | 94957e9dba036eae3052e2662c208b259c08399a |
train | scp | Transfer files to or from EC2 instance.
Use "--" to separate scp args from aegea args:
aegea scp -- -r local_dir instance_name:~/remote_dir | aegea/ssh.py | def scp(args):
"""
Transfer files to or from EC2 instance.
Use "--" to separate scp args from aegea args:
aegea scp -- -r local_dir instance_name:~/remote_dir
"""
if args.scp_args[0] == "--":
del args.scp_args[0]
user_or_hostname_chars = string.ascii_letters + string.digits
... | def scp(args):
"""
Transfer files to or from EC2 instance.
Use "--" to separate scp args from aegea args:
aegea scp -- -r local_dir instance_name:~/remote_dir
"""
if args.scp_args[0] == "--":
del args.scp_args[0]
user_or_hostname_chars = string.ascii_letters + string.digits
... | [
"Transfer",
"files",
"to",
"or",
"from",
"EC2",
"instance",
"."
] | kislyuk/aegea | python | https://github.com/kislyuk/aegea/blob/94957e9dba036eae3052e2662c208b259c08399a/aegea/ssh.py#L61-L83 | [
"def",
"scp",
"(",
"args",
")",
":",
"if",
"args",
".",
"scp_args",
"[",
"0",
"]",
"==",
"\"--\"",
":",
"del",
"args",
".",
"scp_args",
"[",
"0",
"]",
"user_or_hostname_chars",
"=",
"string",
".",
"ascii_letters",
"+",
"string",
".",
"digits",
"for",
... | 94957e9dba036eae3052e2662c208b259c08399a |
train | ls | List S3 buckets. See also "aws s3 ls". Use "aws s3 ls NAME" to list bucket contents. | aegea/buckets.py | def ls(args):
"""
List S3 buckets. See also "aws s3 ls". Use "aws s3 ls NAME" to list bucket contents.
"""
table = []
for bucket in filter_collection(resources.s3.buckets, args):
bucket.LocationConstraint = clients.s3.get_bucket_location(Bucket=bucket.name)["LocationConstraint"]
clou... | def ls(args):
"""
List S3 buckets. See also "aws s3 ls". Use "aws s3 ls NAME" to list bucket contents.
"""
table = []
for bucket in filter_collection(resources.s3.buckets, args):
bucket.LocationConstraint = clients.s3.get_bucket_location(Bucket=bucket.name)["LocationConstraint"]
clou... | [
"List",
"S3",
"buckets",
".",
"See",
"also",
"aws",
"s3",
"ls",
".",
"Use",
"aws",
"s3",
"ls",
"NAME",
"to",
"list",
"bucket",
"contents",
"."
] | kislyuk/aegea | python | https://github.com/kislyuk/aegea/blob/94957e9dba036eae3052e2662c208b259c08399a/aegea/buckets.py#L21-L43 | [
"def",
"ls",
"(",
"args",
")",
":",
"table",
"=",
"[",
"]",
"for",
"bucket",
"in",
"filter_collection",
"(",
"resources",
".",
"s3",
".",
"buckets",
",",
"args",
")",
":",
"bucket",
".",
"LocationConstraint",
"=",
"clients",
".",
"s3",
".",
"get_bucket... | 94957e9dba036eae3052e2662c208b259c08399a |
train | Label.update | Update this label.
:param str name: (required), new name of the label
:param str color: (required), color code, e.g., 626262, no leading '#'
:returns: bool | aegea/packages/github3/issues/label.py | def update(self, name, color):
"""Update this label.
:param str name: (required), new name of the label
:param str color: (required), color code, e.g., 626262, no leading '#'
:returns: bool
"""
json = None
if name and color:
if color[0] == '#':
... | def update(self, name, color):
"""Update this label.
:param str name: (required), new name of the label
:param str color: (required), color code, e.g., 626262, no leading '#'
:returns: bool
"""
json = None
if name and color:
if color[0] == '#':
... | [
"Update",
"this",
"label",
"."
] | kislyuk/aegea | python | https://github.com/kislyuk/aegea/blob/94957e9dba036eae3052e2662c208b259c08399a/aegea/packages/github3/issues/label.py#L43-L62 | [
"def",
"update",
"(",
"self",
",",
"name",
",",
"color",
")",
":",
"json",
"=",
"None",
"if",
"name",
"and",
"color",
":",
"if",
"color",
"[",
"0",
"]",
"==",
"'#'",
":",
"color",
"=",
"color",
"[",
"1",
":",
"]",
"json",
"=",
"self",
".",
"_... | 94957e9dba036eae3052e2662c208b259c08399a |
train | GitHubSession.basic_auth | Set the Basic Auth credentials on this Session.
:param str username: Your GitHub username
:param str password: Your GitHub password | aegea/packages/github3/session.py | def basic_auth(self, username, password):
"""Set the Basic Auth credentials on this Session.
:param str username: Your GitHub username
:param str password: Your GitHub password
"""
if not (username and password):
return
self.auth = (username, password)
... | def basic_auth(self, username, password):
"""Set the Basic Auth credentials on this Session.
:param str username: Your GitHub username
:param str password: Your GitHub password
"""
if not (username and password):
return
self.auth = (username, password)
... | [
"Set",
"the",
"Basic",
"Auth",
"credentials",
"on",
"this",
"Session",
"."
] | kislyuk/aegea | python | https://github.com/kislyuk/aegea/blob/94957e9dba036eae3052e2662c208b259c08399a/aegea/packages/github3/session.py#L36-L48 | [
"def",
"basic_auth",
"(",
"self",
",",
"username",
",",
"password",
")",
":",
"if",
"not",
"(",
"username",
"and",
"password",
")",
":",
"return",
"self",
".",
"auth",
"=",
"(",
"username",
",",
"password",
")",
"# Disable token authentication",
"self",
".... | 94957e9dba036eae3052e2662c208b259c08399a |
train | GitHubSession.build_url | Builds a new API url from scratch. | aegea/packages/github3/session.py | def build_url(self, *args, **kwargs):
"""Builds a new API url from scratch."""
parts = [kwargs.get('base_url') or self.base_url]
parts.extend(args)
parts = [str(p) for p in parts]
key = tuple(parts)
__logs__.info('Building a url from %s', key)
if not key in __url_... | def build_url(self, *args, **kwargs):
"""Builds a new API url from scratch."""
parts = [kwargs.get('base_url') or self.base_url]
parts.extend(args)
parts = [str(p) for p in parts]
key = tuple(parts)
__logs__.info('Building a url from %s', key)
if not key in __url_... | [
"Builds",
"a",
"new",
"API",
"url",
"from",
"scratch",
"."
] | kislyuk/aegea | python | https://github.com/kislyuk/aegea/blob/94957e9dba036eae3052e2662c208b259c08399a/aegea/packages/github3/session.py#L50-L60 | [
"def",
"build_url",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"parts",
"=",
"[",
"kwargs",
".",
"get",
"(",
"'base_url'",
")",
"or",
"self",
".",
"base_url",
"]",
"parts",
".",
"extend",
"(",
"args",
")",
"parts",
"=",
"["... | 94957e9dba036eae3052e2662c208b259c08399a |
train | GitHubSession.retrieve_client_credentials | Return the client credentials.
:returns: tuple(client_id, client_secret) | aegea/packages/github3/session.py | def retrieve_client_credentials(self):
"""Return the client credentials.
:returns: tuple(client_id, client_secret)
"""
client_id = self.params.get('client_id')
client_secret = self.params.get('client_secret')
return (client_id, client_secret) | def retrieve_client_credentials(self):
"""Return the client credentials.
:returns: tuple(client_id, client_secret)
"""
client_id = self.params.get('client_id')
client_secret = self.params.get('client_secret')
return (client_id, client_secret) | [
"Return",
"the",
"client",
"credentials",
"."
] | kislyuk/aegea | python | https://github.com/kislyuk/aegea/blob/94957e9dba036eae3052e2662c208b259c08399a/aegea/packages/github3/session.py#L90-L97 | [
"def",
"retrieve_client_credentials",
"(",
"self",
")",
":",
"client_id",
"=",
"self",
".",
"params",
".",
"get",
"(",
"'client_id'",
")",
"client_secret",
"=",
"self",
".",
"params",
".",
"get",
"(",
"'client_secret'",
")",
"return",
"(",
"client_id",
",",
... | 94957e9dba036eae3052e2662c208b259c08399a |
train | GitHubSession.token_auth | Use an application token for authentication.
:param str token: Application token retrieved from GitHub's
/authorizations endpoint | aegea/packages/github3/session.py | def token_auth(self, token):
"""Use an application token for authentication.
:param str token: Application token retrieved from GitHub's
/authorizations endpoint
"""
if not token:
return
self.headers.update({
'Authorization': 'token {0}'.form... | def token_auth(self, token):
"""Use an application token for authentication.
:param str token: Application token retrieved from GitHub's
/authorizations endpoint
"""
if not token:
return
self.headers.update({
'Authorization': 'token {0}'.form... | [
"Use",
"an",
"application",
"token",
"for",
"authentication",
"."
] | kislyuk/aegea | python | https://github.com/kislyuk/aegea/blob/94957e9dba036eae3052e2662c208b259c08399a/aegea/packages/github3/session.py#L108-L121 | [
"def",
"token_auth",
"(",
"self",
",",
"token",
")",
":",
"if",
"not",
"token",
":",
"return",
"self",
".",
"headers",
".",
"update",
"(",
"{",
"'Authorization'",
":",
"'token {0}'",
".",
"format",
"(",
"token",
")",
"}",
")",
"# Unset username/password so... | 94957e9dba036eae3052e2662c208b259c08399a |
train | GitHubSession.no_auth | Unset authentication temporarily as a context manager. | aegea/packages/github3/session.py | def no_auth(self):
"""Unset authentication temporarily as a context manager."""
old_basic_auth, self.auth = self.auth, None
old_token_auth = self.headers.pop('Authorization', None)
yield
self.auth = old_basic_auth
if old_token_auth:
self.headers['Authorizati... | def no_auth(self):
"""Unset authentication temporarily as a context manager."""
old_basic_auth, self.auth = self.auth, None
old_token_auth = self.headers.pop('Authorization', None)
yield
self.auth = old_basic_auth
if old_token_auth:
self.headers['Authorizati... | [
"Unset",
"authentication",
"temporarily",
"as",
"a",
"context",
"manager",
"."
] | kislyuk/aegea | python | https://github.com/kislyuk/aegea/blob/94957e9dba036eae3052e2662c208b259c08399a/aegea/packages/github3/session.py#L136-L145 | [
"def",
"no_auth",
"(",
"self",
")",
":",
"old_basic_auth",
",",
"self",
".",
"auth",
"=",
"self",
".",
"auth",
",",
"None",
"old_token_auth",
"=",
"self",
".",
"headers",
".",
"pop",
"(",
"'Authorization'",
",",
"None",
")",
"yield",
"self",
".",
"auth... | 94957e9dba036eae3052e2662c208b259c08399a |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.