repo
stringlengths
7
54
path
stringlengths
4
192
url
stringlengths
87
284
code
stringlengths
78
104k
code_tokens
list
docstring
stringlengths
1
46.9k
docstring_tokens
list
language
stringclasses
1 value
partition
stringclasses
3 values
pmacosta/ptrie
ptrie/ptrie.py
https://github.com/pmacosta/ptrie/blob/c176d3ee810b7b5243c7ff2bbf2f1af0b0fff2a8/ptrie/ptrie.py#L937-L975
def get_subtree(self, name): # noqa: D302 r""" Get all node names in a sub-tree. :param name: Sub-tree root node name :type name: :ref:`NodeName` :rtype: list of :ref:`NodeName` :raises: * RuntimeError (Argument \`name\` is not valid) * RuntimeErro...
[ "def", "get_subtree", "(", "self", ",", "name", ")", ":", "# noqa: D302", "if", "self", ".", "_validate_node_name", "(", "name", ")", ":", "raise", "RuntimeError", "(", "\"Argument `name` is not valid\"", ")", "self", ".", "_node_in_tree", "(", "name", ")", "r...
r""" Get all node names in a sub-tree. :param name: Sub-tree root node name :type name: :ref:`NodeName` :rtype: list of :ref:`NodeName` :raises: * RuntimeError (Argument \`name\` is not valid) * RuntimeError (Node *[name]* not in tree) Using the sa...
[ "r", "Get", "all", "node", "names", "in", "a", "sub", "-", "tree", "." ]
python
train
saltstack/salt
salt/modules/btrfs.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/btrfs.py#L195-L212
def _usage_overall(raw): ''' Parse usage/overall. ''' data = {} for line in raw.split("\n")[1:]: keyset = [item.strip() for item in re.sub(r"\s+", " ", line).split(":", 1) if item.strip()] if len(keyset) == 2: key = re.sub(r"[()]", "", keyset[0]).replace(" ", "_").lower()...
[ "def", "_usage_overall", "(", "raw", ")", ":", "data", "=", "{", "}", "for", "line", "in", "raw", ".", "split", "(", "\"\\n\"", ")", "[", "1", ":", "]", ":", "keyset", "=", "[", "item", ".", "strip", "(", ")", "for", "item", "in", "re", ".", ...
Parse usage/overall.
[ "Parse", "usage", "/", "overall", "." ]
python
train
dustinmm80/healthy
package_utils.py
https://github.com/dustinmm80/healthy/blob/b59016c3f578ca45b6ce857a2d5c4584b8542288/package_utils.py#L14-L24
def create_sandbox(name='healthybox'): """ Create a temporary sandbox directory :param name: name of the directory to create :return: The directory created """ sandbox = tempfile.mkdtemp(prefix=name) if not os.path.isdir(sandbox): os.mkdir(sandbox) return sandbox
[ "def", "create_sandbox", "(", "name", "=", "'healthybox'", ")", ":", "sandbox", "=", "tempfile", ".", "mkdtemp", "(", "prefix", "=", "name", ")", "if", "not", "os", ".", "path", ".", "isdir", "(", "sandbox", ")", ":", "os", ".", "mkdir", "(", "sandbo...
Create a temporary sandbox directory :param name: name of the directory to create :return: The directory created
[ "Create", "a", "temporary", "sandbox", "directory", ":", "param", "name", ":", "name", "of", "the", "directory", "to", "create", ":", "return", ":", "The", "directory", "created" ]
python
train
cloudendpoints/endpoints-management-python
endpoints_management/control/distribution.py
https://github.com/cloudendpoints/endpoints-management-python/blob/ec3c4a330ae9d65738861ce6df4dd6c3cb9f7731/endpoints_management/control/distribution.py#L99-L118
def create_explicit(bounds): """Creates a new instance of distribution with explicit buckets. bounds is an iterable of ordered floats that define the explicit buckets Args: bounds (iterable[float]): initializes the bounds Return: :class:`endpoints_management.gen.servicecontrol_v1_messag...
[ "def", "create_explicit", "(", "bounds", ")", ":", "safe_bounds", "=", "sorted", "(", "float", "(", "x", ")", "for", "x", "in", "bounds", ")", "if", "len", "(", "safe_bounds", ")", "!=", "len", "(", "set", "(", "safe_bounds", ")", ")", ":", "raise", ...
Creates a new instance of distribution with explicit buckets. bounds is an iterable of ordered floats that define the explicit buckets Args: bounds (iterable[float]): initializes the bounds Return: :class:`endpoints_management.gen.servicecontrol_v1_messages.Distribution` Raises: ...
[ "Creates", "a", "new", "instance", "of", "distribution", "with", "explicit", "buckets", "." ]
python
train
aliyun/aliyun-odps-python-sdk
odps/df/expr/strings.py
https://github.com/aliyun/aliyun-odps-python-sdk/blob/4b0de18f5864386df6068f26f026e62f932c41e4/odps/df/expr/strings.py#L671-L684
def _strptime(expr, date_format): """ Return datetimes specified by date_format, which supports the same string format as the python standard library. Details of the string format can be found in python string format doc :param expr: :param date_format: date format string (e.g. “%Y-%m-%d”) ...
[ "def", "_strptime", "(", "expr", ",", "date_format", ")", ":", "return", "_string_op", "(", "expr", ",", "Strptime", ",", "_date_format", "=", "date_format", ",", "output_type", "=", "types", ".", "datetime", ")" ]
Return datetimes specified by date_format, which supports the same string format as the python standard library. Details of the string format can be found in python string format doc :param expr: :param date_format: date format string (e.g. “%Y-%m-%d”) :type date_format: str :return:
[ "Return", "datetimes", "specified", "by", "date_format", "which", "supports", "the", "same", "string", "format", "as", "the", "python", "standard", "library", ".", "Details", "of", "the", "string", "format", "can", "be", "found", "in", "python", "string", "for...
python
train
dodger487/dplython
dplython/dplython.py
https://github.com/dodger487/dplython/blob/09c2a5f4ca67221b2a59928366ca8274357f7234/dplython/dplython.py#L203-L232
def select(*args): """Select specific columns from DataFrame. Output will be DplyFrame type. Order of columns will be the same as input into select. >>> diamonds >> select(X.color, X.carat) >> head(3) Out: color carat 0 E 0.23 1 E 0.21 2 E 0.23 Grouping variables are implied...
[ "def", "select", "(", "*", "args", ")", ":", "def", "select_columns", "(", "df", ",", "args", ")", ":", "columns", "=", "[", "column", ".", "_name", "for", "column", "in", "args", "]", "if", "df", ".", "_grouped_on", ":", "for", "col", "in", "df", ...
Select specific columns from DataFrame. Output will be DplyFrame type. Order of columns will be the same as input into select. >>> diamonds >> select(X.color, X.carat) >> head(3) Out: color carat 0 E 0.23 1 E 0.21 2 E 0.23 Grouping variables are implied in selection. >>> df ...
[ "Select", "specific", "columns", "from", "DataFrame", "." ]
python
train
RPi-Distro/python-gpiozero
gpiozero/boards.py
https://github.com/RPi-Distro/python-gpiozero/blob/7b67374fd0c8c4fde5586d9bad9531f076db9c0c/gpiozero/boards.py#L1601-L1633
def forward(self, speed=1, **kwargs): """ Drive the robot forward by running both motors forward. :param float speed: Speed at which to drive the motors, as a value between 0 (stopped) and 1 (full speed). The default is 1. :param float curve_left: Th...
[ "def", "forward", "(", "self", ",", "speed", "=", "1", ",", "*", "*", "kwargs", ")", ":", "curve_left", "=", "kwargs", ".", "pop", "(", "'curve_left'", ",", "0", ")", "curve_right", "=", "kwargs", ".", "pop", "(", "'curve_right'", ",", "0", ")", "i...
Drive the robot forward by running both motors forward. :param float speed: Speed at which to drive the motors, as a value between 0 (stopped) and 1 (full speed). The default is 1. :param float curve_left: The amount to curve left while moving forwards, by driving t...
[ "Drive", "the", "robot", "forward", "by", "running", "both", "motors", "forward", "." ]
python
train
RudolfCardinal/pythonlib
cardinal_pythonlib/subproc.py
https://github.com/RudolfCardinal/pythonlib/blob/0b84cb35f38bd7d8723958dae51b480a829b7227/cardinal_pythonlib/subproc.py#L301-L454
def mimic_user_input( args: List[str], source_challenge_response: List[Tuple[SubprocSource, str, Union[str, SubprocCommand]]], line_terminators: List[str] = None, print_stdout: bool = False, ...
[ "def", "mimic_user_input", "(", "args", ":", "List", "[", "str", "]", ",", "source_challenge_response", ":", "List", "[", "Tuple", "[", "SubprocSource", ",", "str", ",", "Union", "[", "str", ",", "SubprocCommand", "]", "]", "]", ",", "line_terminators", ":...
r""" Run an external command. Pretend to be a human by sending text to the subcommand (responses) when the external command sends us triggers (challenges). This is a bit nasty. Args: args: command-line arguments source_challenge_response: list of tuples of the format ``(cha...
[ "r", "Run", "an", "external", "command", ".", "Pretend", "to", "be", "a", "human", "by", "sending", "text", "to", "the", "subcommand", "(", "responses", ")", "when", "the", "external", "command", "sends", "us", "triggers", "(", "challenges", ")", ".", "T...
python
train
python-xlib/python-xlib
Xlib/display.py
https://github.com/python-xlib/python-xlib/blob/8901e831737e79fe5645f48089d70e1d1046d2f2/Xlib/display.py#L490-L495
def get_atom_name(self, atom): """Look up the name of atom, returning it as a string. Will raise BadAtom if atom does not exist.""" r = request.GetAtomName(display = self.display, atom = atom) return r.name
[ "def", "get_atom_name", "(", "self", ",", "atom", ")", ":", "r", "=", "request", ".", "GetAtomName", "(", "display", "=", "self", ".", "display", ",", "atom", "=", "atom", ")", "return", "r", ".", "name" ]
Look up the name of atom, returning it as a string. Will raise BadAtom if atom does not exist.
[ "Look", "up", "the", "name", "of", "atom", "returning", "it", "as", "a", "string", ".", "Will", "raise", "BadAtom", "if", "atom", "does", "not", "exist", "." ]
python
train
tensorflow/tensor2tensor
tensor2tensor/models/image_transformer.py
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/models/image_transformer.py#L1147-L1157
def imagetransformer_b10l_4h_big_uncond_dr01_tpu(): """big 1d model for conditional image generation.""" hparams = imagetransformer_b12l_4h_big_uncond_dr03_tpu() # num_hidden_layers hparams.num_decoder_layers = 10 hparams.num_heads = 4 hparams.hidden_size = 1024 hparams.filter_size = 4096 hparams.batch_...
[ "def", "imagetransformer_b10l_4h_big_uncond_dr01_tpu", "(", ")", ":", "hparams", "=", "imagetransformer_b12l_4h_big_uncond_dr03_tpu", "(", ")", "# num_hidden_layers", "hparams", ".", "num_decoder_layers", "=", "10", "hparams", ".", "num_heads", "=", "4", "hparams", ".", ...
big 1d model for conditional image generation.
[ "big", "1d", "model", "for", "conditional", "image", "generation", "." ]
python
train
mozilla/amo-validator
validator/submain.py
https://github.com/mozilla/amo-validator/blob/0251bfbd7d93106e01ecdb6de5fcd1dc1a180664/validator/submain.py#L279-L354
def populate_chrome_manifest(err, xpi_package): "Loads the chrome.manifest if it's present" if 'chrome.manifest' in xpi_package: chrome_data = xpi_package.read('chrome.manifest') chrome = ChromeManifest(chrome_data, 'chrome.manifest') chrome_recursion_buster = set() # Handle t...
[ "def", "populate_chrome_manifest", "(", "err", ",", "xpi_package", ")", ":", "if", "'chrome.manifest'", "in", "xpi_package", ":", "chrome_data", "=", "xpi_package", ".", "read", "(", "'chrome.manifest'", ")", "chrome", "=", "ChromeManifest", "(", "chrome_data", ",...
Loads the chrome.manifest if it's present
[ "Loads", "the", "chrome", ".", "manifest", "if", "it", "s", "present" ]
python
train
onnx/onnxmltools
onnxmltools/convert/coreml/shape_calculators/neural_network/Upsample.py
https://github.com/onnx/onnxmltools/blob/d4e4c31990fc2d9fd1f92139f497d360914c9df2/onnxmltools/convert/coreml/shape_calculators/neural_network/Upsample.py#L13-L27
def calculate_upsample_output_shapes(operator): ''' Allowed input/output patterns are 1. [N, C, H, W] ---> [N, C, H', W'] ''' check_input_and_output_numbers(operator, input_count_range=1, output_count_range=1) check_input_and_output_types(operator, good_input_types=[FloatTensorType]) sc...
[ "def", "calculate_upsample_output_shapes", "(", "operator", ")", ":", "check_input_and_output_numbers", "(", "operator", ",", "input_count_range", "=", "1", ",", "output_count_range", "=", "1", ")", "check_input_and_output_types", "(", "operator", ",", "good_input_types",...
Allowed input/output patterns are 1. [N, C, H, W] ---> [N, C, H', W']
[ "Allowed", "input", "/", "output", "patterns", "are", "1", ".", "[", "N", "C", "H", "W", "]", "---", ">", "[", "N", "C", "H", "W", "]" ]
python
train
codelv/enaml-native
src/enamlnative/android/android_date_picker.py
https://github.com/codelv/enaml-native/blob/c33986e9eda468c508806e0a3e73c771401e5718/src/enamlnative/android/android_date_picker.py#L46-L52
def create_widget(self): """ Create the underlying widget. """ d = self.declaration self.widget = DatePicker(self.get_context(), None, d.style or "@attr/datePickerStyle")
[ "def", "create_widget", "(", "self", ")", ":", "d", "=", "self", ".", "declaration", "self", ".", "widget", "=", "DatePicker", "(", "self", ".", "get_context", "(", ")", ",", "None", ",", "d", ".", "style", "or", "\"@attr/datePickerStyle\"", ")" ]
Create the underlying widget.
[ "Create", "the", "underlying", "widget", "." ]
python
train
JdeRobot/base
src/drivers/MAVLinkServer/MAVProxy/pymavlink/dialects/v10/matrixpilot.py
https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/pymavlink/dialects/v10/matrixpilot.py#L9321-L9341
def rc_channels_raw_encode(self, time_boot_ms, port, chan1_raw, chan2_raw, chan3_raw, chan4_raw, chan5_raw, chan6_raw, chan7_raw, chan8_raw, rssi): ''' The RAW values of the RC channels received. The standard PPM modulation is as follows: 1000 microseconds: 0%, 2000 ...
[ "def", "rc_channels_raw_encode", "(", "self", ",", "time_boot_ms", ",", "port", ",", "chan1_raw", ",", "chan2_raw", ",", "chan3_raw", ",", "chan4_raw", ",", "chan5_raw", ",", "chan6_raw", ",", "chan7_raw", ",", "chan8_raw", ",", "rssi", ")", ":", "return", "...
The RAW values of the RC channels received. The standard PPM modulation is as follows: 1000 microseconds: 0%, 2000 microseconds: 100%. Individual receivers/transmitters might violate this specification. time_boot_ms : Timestamp (milliseconds ...
[ "The", "RAW", "values", "of", "the", "RC", "channels", "received", ".", "The", "standard", "PPM", "modulation", "is", "as", "follows", ":", "1000", "microseconds", ":", "0%", "2000", "microseconds", ":", "100%", ".", "Individual", "receivers", "/", "transmit...
python
train
sebp/scikit-survival
sksurv/svm/survival_svm.py
https://github.com/sebp/scikit-survival/blob/cfc99fd20454cdd6f4f20fe331b39f2191ccaabc/sksurv/svm/survival_svm.py#L702-L717
def _argsort_and_resolve_ties(time, random_state): """Like numpy.argsort, but resolves ties uniformly at random""" n_samples = len(time) order = numpy.argsort(time, kind="mergesort") i = 0 while i < n_samples - 1: inext = i + 1 while inext < n_samples and...
[ "def", "_argsort_and_resolve_ties", "(", "time", ",", "random_state", ")", ":", "n_samples", "=", "len", "(", "time", ")", "order", "=", "numpy", ".", "argsort", "(", "time", ",", "kind", "=", "\"mergesort\"", ")", "i", "=", "0", "while", "i", "<", "n_...
Like numpy.argsort, but resolves ties uniformly at random
[ "Like", "numpy", ".", "argsort", "but", "resolves", "ties", "uniformly", "at", "random" ]
python
train
lreis2415/PyGeoC
pygeoc/utils.py
https://github.com/lreis2415/PyGeoC/blob/9a92d1a229bb74298e3c57f27c97079980b5f729/pygeoc/utils.py#L494-L527
def extract_numeric_values_from_string(str_contains_values): # type: (AnyStr) -> Optional[List[Union[int, float]]] """ Find numeric values from string, e.g., 1, .7, 1.2, 4e2, 3e-3, -9, etc. Reference: `how-to-extract-a-floating-number-from-a-string-in-python`_ Examples:...
[ "def", "extract_numeric_values_from_string", "(", "str_contains_values", ")", ":", "# type: (AnyStr) -> Optional[List[Union[int, float]]]", "numeric_const_pattern", "=", "r'[-+]?(?:(?:\\d*\\.\\d+)|(?:\\d+\\.?))(?:[Ee][+-]?\\d+)?'", "rx", "=", "re", ".", "compile", "(", "numeric_const...
Find numeric values from string, e.g., 1, .7, 1.2, 4e2, 3e-3, -9, etc. Reference: `how-to-extract-a-floating-number-from-a-string-in-python`_ Examples: >>> input_str = '.1 .12 9.1 98.1 1. 12. 1 12' >>> StringClass.extract_numeric_values_from_string(input_str) ...
[ "Find", "numeric", "values", "from", "string", "e", ".", "g", ".", "1", ".", "7", "1", ".", "2", "4e2", "3e", "-", "3", "-", "9", "etc", ".", "Reference", ":", "how", "-", "to", "-", "extract", "-", "a", "-", "floating", "-", "number", "-", "...
python
train
quasipedia/swaggery
examples/async/async.py
https://github.com/quasipedia/swaggery/blob/89a2e1b2bebbc511c781c9e63972f65aef73cc2f/examples/async/async.py#L187-L195
def form_echo(cls, request, foo: (Ptypes.form, String('A form parameter'))) -> [ (200, 'Ok', String)]: '''Echo the form parameter.''' log.info('Echoing form param, value is: {}'.format(foo)) for i in range(randint(0, MAX_LOOP_DURATION)): yield ms...
[ "def", "form_echo", "(", "cls", ",", "request", ",", "foo", ":", "(", "Ptypes", ".", "form", ",", "String", "(", "'A form parameter'", ")", ")", ")", "->", "[", "(", "200", ",", "'Ok'", ",", "String", ")", "]", ":", "log", ".", "info", "(", "'Ech...
Echo the form parameter.
[ "Echo", "the", "form", "parameter", "." ]
python
train
saltstack/salt
salt/modules/boto_route53.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_route53.py#L285-L337
def create_zone(zone, private=False, vpc_id=None, vpc_region=None, region=None, key=None, keyid=None, profile=None): ''' Create a Route53 hosted zone. .. versionadded:: 2015.8.0 zone DNS zone to create private True/False if the zone will be a private zone vpc_...
[ "def", "create_zone", "(", "zone", ",", "private", "=", "False", ",", "vpc_id", "=", "None", ",", "vpc_region", "=", "None", ",", "region", "=", "None", ",", "key", "=", "None", ",", "keyid", "=", "None", ",", "profile", "=", "None", ")", ":", "if"...
Create a Route53 hosted zone. .. versionadded:: 2015.8.0 zone DNS zone to create private True/False if the zone will be a private zone vpc_id VPC ID to associate the zone to (required if private is True) vpc_region VPC Region (required if private is True) re...
[ "Create", "a", "Route53", "hosted", "zone", "." ]
python
train
sosreport/sos
sos/plugins/__init__.py
https://github.com/sosreport/sos/blob/2ebc04da53dc871c8dd5243567afa4f8592dca29/sos/plugins/__init__.py#L754-L827
def add_copy_spec(self, copyspecs, sizelimit=None, tailit=True, pred=None): """Add a file or glob but limit it to sizelimit megabytes. If fname is a single file the file will be tailed to meet sizelimit. If the first file in a glob is too large it will be tailed to meet the sizelimit. ""...
[ "def", "add_copy_spec", "(", "self", ",", "copyspecs", ",", "sizelimit", "=", "None", ",", "tailit", "=", "True", ",", "pred", "=", "None", ")", ":", "if", "not", "self", ".", "test_predicate", "(", "pred", "=", "pred", ")", ":", "self", ".", "_log_i...
Add a file or glob but limit it to sizelimit megabytes. If fname is a single file the file will be tailed to meet sizelimit. If the first file in a glob is too large it will be tailed to meet the sizelimit.
[ "Add", "a", "file", "or", "glob", "but", "limit", "it", "to", "sizelimit", "megabytes", ".", "If", "fname", "is", "a", "single", "file", "the", "file", "will", "be", "tailed", "to", "meet", "sizelimit", ".", "If", "the", "first", "file", "in", "a", "...
python
train
ewels/MultiQC
multiqc/modules/fastqc/fastqc.py
https://github.com/ewels/MultiQC/blob/2037d6322b2554146a74efbf869156ad20d4c4ec/multiqc/modules/fastqc/fastqc.py#L117-L188
def parse_fastqc_report(self, file_contents, s_name=None, f=None): """ Takes contents from a fastq_data.txt file and parses out required statistics and data. Returns a dict with keys 'stats' and 'data'. Data is for plotting graphs, stats are for top table. """ # Make the sample name fro...
[ "def", "parse_fastqc_report", "(", "self", ",", "file_contents", ",", "s_name", "=", "None", ",", "f", "=", "None", ")", ":", "# Make the sample name from the input filename if we find it", "fn_search", "=", "re", ".", "search", "(", "r\"Filename\\s+(.+)\"", ",", "f...
Takes contents from a fastq_data.txt file and parses out required statistics and data. Returns a dict with keys 'stats' and 'data'. Data is for plotting graphs, stats are for top table.
[ "Takes", "contents", "from", "a", "fastq_data", ".", "txt", "file", "and", "parses", "out", "required", "statistics", "and", "data", ".", "Returns", "a", "dict", "with", "keys", "stats", "and", "data", ".", "Data", "is", "for", "plotting", "graphs", "stats...
python
train
belbio/bel
bel/utils.py
https://github.com/belbio/bel/blob/60333e8815625b942b4836903f3b618cf44b3771/bel/utils.py#L27-L56
def get_url(url: str, params: dict = {}, timeout: float = 5.0, cache: bool = True): """Wrapper for requests.get(url) Args: url: url to retrieve params: query string parameters timeout: allow this much time for the request and time it out if over cache: Cache for up to a day unle...
[ "def", "get_url", "(", "url", ":", "str", ",", "params", ":", "dict", "=", "{", "}", ",", "timeout", ":", "float", "=", "5.0", ",", "cache", ":", "bool", "=", "True", ")", ":", "try", ":", "if", "not", "cache", ":", "with", "requests_cache", ".",...
Wrapper for requests.get(url) Args: url: url to retrieve params: query string parameters timeout: allow this much time for the request and time it out if over cache: Cache for up to a day unless this is false Returns: Requests Result obj or None if timed out
[ "Wrapper", "for", "requests", ".", "get", "(", "url", ")" ]
python
train
marcomusy/vtkplotter
vtkplotter/plotter.py
https://github.com/marcomusy/vtkplotter/blob/692c3396782722ec525bc1346a26999868c650c6/vtkplotter/plotter.py#L661-L696
def moveCamera(self, camstart, camstop, fraction): """ Takes as input two ``vtkCamera`` objects and returns a new ``vtkCamera`` that is at an intermediate position: fraction=0 -> camstart, fraction=1 -> camstop. Press ``shift-C`` key in interactive mode to dump a python snippl...
[ "def", "moveCamera", "(", "self", ",", "camstart", ",", "camstop", ",", "fraction", ")", ":", "if", "isinstance", "(", "fraction", ",", "int", ")", ":", "colors", ".", "printc", "(", "\"~lightning Warning in moveCamera(): fraction should not be an integer\"", ",", ...
Takes as input two ``vtkCamera`` objects and returns a new ``vtkCamera`` that is at an intermediate position: fraction=0 -> camstart, fraction=1 -> camstop. Press ``shift-C`` key in interactive mode to dump a python snipplet of parameters for the current camera view.
[ "Takes", "as", "input", "two", "vtkCamera", "objects", "and", "returns", "a", "new", "vtkCamera", "that", "is", "at", "an", "intermediate", "position", ":" ]
python
train
jaraco/irc
irc/server.py
https://github.com/jaraco/irc/blob/571c1f448d5d5bb92bbe2605c33148bf6e698413/irc/server.py#L346-L355
def _send_to_others(self, message, channel): """ Send the message to all clients in the specified channel except for self. """ other_clients = [ client for client in channel.clients if not client == self] for client in other_clients: cl...
[ "def", "_send_to_others", "(", "self", ",", "message", ",", "channel", ")", ":", "other_clients", "=", "[", "client", "for", "client", "in", "channel", ".", "clients", "if", "not", "client", "==", "self", "]", "for", "client", "in", "other_clients", ":", ...
Send the message to all clients in the specified channel except for self.
[ "Send", "the", "message", "to", "all", "clients", "in", "the", "specified", "channel", "except", "for", "self", "." ]
python
train
datajoint/datajoint-python
datajoint/table.py
https://github.com/datajoint/datajoint-python/blob/4f29bb154a7ed2b8b64b4d3a9c8be4c16b39621c/datajoint/table.py#L58-L74
def declare(self, context=None): """ Use self.definition to declare the table in the schema. """ try: sql, uses_external = declare(self.full_table_name, self.definition, context) if uses_external: sql = sql.format(external_table=self.external_table...
[ "def", "declare", "(", "self", ",", "context", "=", "None", ")", ":", "try", ":", "sql", ",", "uses_external", "=", "declare", "(", "self", ".", "full_table_name", ",", "self", ".", "definition", ",", "context", ")", "if", "uses_external", ":", "sql", ...
Use self.definition to declare the table in the schema.
[ "Use", "self", ".", "definition", "to", "declare", "the", "table", "in", "the", "schema", "." ]
python
train
ronaldguillen/wave
wave/views.py
https://github.com/ronaldguillen/wave/blob/20bb979c917f7634d8257992e6d449dc751256a9/wave/views.py#L343-L351
def determine_version(self, request, *args, **kwargs): """ If versioning is being used, then determine any API version for the incoming request. Returns a two-tuple of (version, versioning_scheme) """ if self.versioning_class is None: return (None, None) schem...
[ "def", "determine_version", "(", "self", ",", "request", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "if", "self", ".", "versioning_class", "is", "None", ":", "return", "(", "None", ",", "None", ")", "scheme", "=", "self", ".", "versioning_cla...
If versioning is being used, then determine any API version for the incoming request. Returns a two-tuple of (version, versioning_scheme)
[ "If", "versioning", "is", "being", "used", "then", "determine", "any", "API", "version", "for", "the", "incoming", "request", ".", "Returns", "a", "two", "-", "tuple", "of", "(", "version", "versioning_scheme", ")" ]
python
train
ishepard/pydriller
pydriller/git_repository.py
https://github.com/ishepard/pydriller/blob/71facb32afa085d5ddf0081beba34d00d57b8080/pydriller/git_repository.py#L144-L156
def files(self) -> List[str]: """ Obtain the list of the files (excluding .git directory). :return: List[str], the list of the files """ _all = [] for path, _, files in os.walk(str(self.path)): if '.git' in path: continue for name ...
[ "def", "files", "(", "self", ")", "->", "List", "[", "str", "]", ":", "_all", "=", "[", "]", "for", "path", ",", "_", ",", "files", "in", "os", ".", "walk", "(", "str", "(", "self", ".", "path", ")", ")", ":", "if", "'.git'", "in", "path", ...
Obtain the list of the files (excluding .git directory). :return: List[str], the list of the files
[ "Obtain", "the", "list", "of", "the", "files", "(", "excluding", ".", "git", "directory", ")", "." ]
python
train
apache/airflow
airflow/hooks/mysql_hook.py
https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/hooks/mysql_hook.py#L62-L105
def get_conn(self): """ Returns a mysql connection object """ conn = self.get_connection(self.mysql_conn_id) conn_config = { "user": conn.login, "passwd": conn.password or '', "host": conn.host or 'localhost', "db": self.schema or c...
[ "def", "get_conn", "(", "self", ")", ":", "conn", "=", "self", ".", "get_connection", "(", "self", ".", "mysql_conn_id", ")", "conn_config", "=", "{", "\"user\"", ":", "conn", ".", "login", ",", "\"passwd\"", ":", "conn", ".", "password", "or", "''", "...
Returns a mysql connection object
[ "Returns", "a", "mysql", "connection", "object" ]
python
test
GoogleCloudPlatform/cloud-debug-python
src/googleclouddebugger/gcp_hub_client.py
https://github.com/GoogleCloudPlatform/cloud-debug-python/blob/89ce3782c98b814838a3ecb5479ed3882368cbee/src/googleclouddebugger/gcp_hub_client.py#L303-L340
def _RegisterDebuggee(self, service): """Single attempt to register the debuggee. If the registration succeeds, sets self._debuggee_id to the registered debuggee ID. Args: service: client to use for API calls Returns: (registration_required, delay) tuple """ try: request...
[ "def", "_RegisterDebuggee", "(", "self", ",", "service", ")", ":", "try", ":", "request", "=", "{", "'debuggee'", ":", "self", ".", "_GetDebuggee", "(", ")", "}", "try", ":", "response", "=", "service", ".", "debuggees", "(", ")", ".", "register", "(",...
Single attempt to register the debuggee. If the registration succeeds, sets self._debuggee_id to the registered debuggee ID. Args: service: client to use for API calls Returns: (registration_required, delay) tuple
[ "Single", "attempt", "to", "register", "the", "debuggee", "." ]
python
train
ttinies/sc2common
sc2common/containers.py
https://github.com/ttinies/sc2common/blob/469623c319c7ab7af799551055839ea3b3f87d54/sc2common/containers.py#L270-L274
def magnitude(self, allow3d=True): """determine the magnitude of this location from the origin (presume values represent a Vector)""" ret = self.x**2 + self.y**2 if allow3d: ret += self.z**2 return ret**0.5 # square root
[ "def", "magnitude", "(", "self", ",", "allow3d", "=", "True", ")", ":", "ret", "=", "self", ".", "x", "**", "2", "+", "self", ".", "y", "**", "2", "if", "allow3d", ":", "ret", "+=", "self", ".", "z", "**", "2", "return", "ret", "**", "0.5", "...
determine the magnitude of this location from the origin (presume values represent a Vector)
[ "determine", "the", "magnitude", "of", "this", "location", "from", "the", "origin", "(", "presume", "values", "represent", "a", "Vector", ")" ]
python
train
djordon/queueing-tool
queueing_tool/graph/graph_wrapper.py
https://github.com/djordon/queueing-tool/blob/ccd418cf647ac03a54f78ba5e3725903f541b808/queueing_tool/graph/graph_wrapper.py#L73-L181
def adjacency2graph(adjacency, edge_type=None, adjust=1, **kwargs): """Takes an adjacency list, dict, or matrix and returns a graph. The purpose of this function is take an adjacency list (or matrix) and return a :class:`.QueueNetworkDiGraph` that can be used with a :class:`.QueueNetwork` instance. The...
[ "def", "adjacency2graph", "(", "adjacency", ",", "edge_type", "=", "None", ",", "adjust", "=", "1", ",", "*", "*", "kwargs", ")", ":", "if", "isinstance", "(", "adjacency", ",", "np", ".", "ndarray", ")", ":", "adjacency", "=", "_matrix2dict", "(", "ad...
Takes an adjacency list, dict, or matrix and returns a graph. The purpose of this function is take an adjacency list (or matrix) and return a :class:`.QueueNetworkDiGraph` that can be used with a :class:`.QueueNetwork` instance. The Graph returned has the ``edge_type`` edge property set for each edge. ...
[ "Takes", "an", "adjacency", "list", "dict", "or", "matrix", "and", "returns", "a", "graph", "." ]
python
valid
EventTeam/beliefs
src/beliefs/cells/lists.py
https://github.com/EventTeam/beliefs/blob/c07d22b61bebeede74a72800030dde770bf64208/src/beliefs/cells/lists.py#L304-L323
def merge(self, other): """ Merges two prefixes """ other = PrefixCell.coerce(other) if self.is_equal(other): # pick among dependencies return self elif other.is_entailed_by(self): return self elif self.is_entailed_by(other): ...
[ "def", "merge", "(", "self", ",", "other", ")", ":", "other", "=", "PrefixCell", ".", "coerce", "(", "other", ")", "if", "self", ".", "is_equal", "(", "other", ")", ":", "# pick among dependencies", "return", "self", "elif", "other", ".", "is_entailed_by",...
Merges two prefixes
[ "Merges", "two", "prefixes" ]
python
train
StackStorm/pybind
pybind/slxos/v17r_1_01a/__init__.py
https://github.com/StackStorm/pybind/blob/44c467e71b2b425be63867aba6e6fa28b2cfe7fb/pybind/slxos/v17r_1_01a/__init__.py#L13373-L13396
def _set_loam_state(self, v, load=False): """ Setter method for loam_state, mapped from YANG variable /loam_state (container) If this variable is read-only (config: false) in the source YANG file, then _set_loam_state is considered as a private method. Backends looking to populate this variable shou...
[ "def", "_set_loam_state", "(", "self", ",", "v", ",", "load", "=", "False", ")", ":", "if", "hasattr", "(", "v", ",", "\"_utype\"", ")", ":", "v", "=", "v", ".", "_utype", "(", "v", ")", "try", ":", "t", "=", "YANGDynClass", "(", "v", ",", "bas...
Setter method for loam_state, mapped from YANG variable /loam_state (container) If this variable is read-only (config: false) in the source YANG file, then _set_loam_state is considered as a private method. Backends looking to populate this variable should do so via calling thisObj._set_loam_state() dir...
[ "Setter", "method", "for", "loam_state", "mapped", "from", "YANG", "variable", "/", "loam_state", "(", "container", ")", "If", "this", "variable", "is", "read", "-", "only", "(", "config", ":", "false", ")", "in", "the", "source", "YANG", "file", "then", ...
python
train
d0c-s4vage/pfp
pfp/interp.py
https://github.com/d0c-s4vage/pfp/blob/32f2d34fdec1c70019fa83c7006d5e3be0f92fcd/pfp/interp.py#L951-L972
def _handle_file_ast(self, node, scope, ctxt, stream): """TODO: Docstring for _handle_file_ast. :node: TODO :scope: TODO :ctxt: TODO :stream: TODO :returns: TODO """ self._root = ctxt = fields.Dom(stream) ctxt._pfp__scope = scope self._ro...
[ "def", "_handle_file_ast", "(", "self", ",", "node", ",", "scope", ",", "ctxt", ",", "stream", ")", ":", "self", ".", "_root", "=", "ctxt", "=", "fields", ".", "Dom", "(", "stream", ")", "ctxt", ".", "_pfp__scope", "=", "scope", "self", ".", "_root",...
TODO: Docstring for _handle_file_ast. :node: TODO :scope: TODO :ctxt: TODO :stream: TODO :returns: TODO
[ "TODO", ":", "Docstring", "for", "_handle_file_ast", "." ]
python
train
ewiger/mlab
src/mlab/awmstools.py
https://github.com/ewiger/mlab/blob/72a98adf6499f548848ad44c604f74d68f07fe4f/src/mlab/awmstools.py#L655-L669
def unweave(iterable, n=2): r"""Divide `iterable` in `n` lists, so that every `n`th element belongs to list `n`. Example: >>> unweave((1,2,3,4,5), 3) [[1, 4], [2, 5], [3]] """ res = [[] for i in range(n)] i = 0 for x in iterable: res[i % n].append(x) i += 1 retu...
[ "def", "unweave", "(", "iterable", ",", "n", "=", "2", ")", ":", "res", "=", "[", "[", "]", "for", "i", "in", "range", "(", "n", ")", "]", "i", "=", "0", "for", "x", "in", "iterable", ":", "res", "[", "i", "%", "n", "]", ".", "append", "(...
r"""Divide `iterable` in `n` lists, so that every `n`th element belongs to list `n`. Example: >>> unweave((1,2,3,4,5), 3) [[1, 4], [2, 5], [3]]
[ "r", "Divide", "iterable", "in", "n", "lists", "so", "that", "every", "n", "th", "element", "belongs", "to", "list", "n", "." ]
python
train
blackecho/Deep-Learning-TensorFlow
yadlt/utils/tf_utils.py
https://github.com/blackecho/Deep-Learning-TensorFlow/blob/ddeb1f2848da7b7bee166ad2152b4afc46bb2086/yadlt/utils/tf_utils.py#L53-L93
def run_summaries( sess, merged_summaries, summary_writer, epoch, feed, tens): """Run the summaries and error computation on the validation set. Parameters ---------- sess : tf.Session Tensorflow session object. merged_summaries : tf obj Tensorflow merged summaries obj. ...
[ "def", "run_summaries", "(", "sess", ",", "merged_summaries", ",", "summary_writer", ",", "epoch", ",", "feed", ",", "tens", ")", ":", "try", ":", "result", "=", "sess", ".", "run", "(", "[", "merged_summaries", ",", "tens", "]", ",", "feed_dict", "=", ...
Run the summaries and error computation on the validation set. Parameters ---------- sess : tf.Session Tensorflow session object. merged_summaries : tf obj Tensorflow merged summaries obj. summary_writer : tf.summary.FileWriter Tensorflow summary writer obj. epoch : ...
[ "Run", "the", "summaries", "and", "error", "computation", "on", "the", "validation", "set", "." ]
python
train
mrstephenneal/mysql-toolkit
mysql/toolkit/components/structure/__init__.py
https://github.com/mrstephenneal/mysql-toolkit/blob/6964f718f4b72eb30f2259adfcfaf3090526c53d/mysql/toolkit/components/structure/__init__.py#L55-L58
def get_duplicate_vals(self, table, column): """Retrieve duplicate values in a column of a table.""" query = 'SELECT {0} FROM {1} GROUP BY {0} HAVING COUNT(*) > 1'.format(join_cols(column), wrap(table)) return self.fetch(query)
[ "def", "get_duplicate_vals", "(", "self", ",", "table", ",", "column", ")", ":", "query", "=", "'SELECT {0} FROM {1} GROUP BY {0} HAVING COUNT(*) > 1'", ".", "format", "(", "join_cols", "(", "column", ")", ",", "wrap", "(", "table", ")", ")", "return", "self", ...
Retrieve duplicate values in a column of a table.
[ "Retrieve", "duplicate", "values", "in", "a", "column", "of", "a", "table", "." ]
python
train
PmagPy/PmagPy
SPD/lib/lib_ptrm_statistics.py
https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/SPD/lib/lib_ptrm_statistics.py#L198-L212
def get_b_star(x_star, y_err, y_mean, y_segment): """ input: x_star, y_err, y_mean, y_segment output: b_star (corrected slope for delta_pal statistic) """ #print "x_star, should be same as Xcorr / NRM" #print x_star x_star_mean = numpy.mean(x_star) x_err = x_star - x_star_mean b_star...
[ "def", "get_b_star", "(", "x_star", ",", "y_err", ",", "y_mean", ",", "y_segment", ")", ":", "#print \"x_star, should be same as Xcorr / NRM\"", "#print x_star", "x_star_mean", "=", "numpy", ".", "mean", "(", "x_star", ")", "x_err", "=", "x_star", "-", "x_star_mea...
input: x_star, y_err, y_mean, y_segment output: b_star (corrected slope for delta_pal statistic)
[ "input", ":", "x_star", "y_err", "y_mean", "y_segment", "output", ":", "b_star", "(", "corrected", "slope", "for", "delta_pal", "statistic", ")" ]
python
train
DataBiosphere/toil
src/toil/__init__.py
https://github.com/DataBiosphere/toil/blob/a8252277ff814e7bee0971139c2344f88e44b644/src/toil/__init__.py#L384-L410
def requestCheckDockerIo(origAppliance, imageName, tag): """ Checks docker.io to see if an image exists using the requests library. URL is based on the docker v2 schema. Requires that an access token be fetched first. :param str origAppliance: The full url of the docker image originally ...
[ "def", "requestCheckDockerIo", "(", "origAppliance", ",", "imageName", ",", "tag", ")", ":", "# only official images like 'busybox' or 'ubuntu'", "if", "'/'", "not", "in", "imageName", ":", "imageName", "=", "'library/'", "+", "imageName", "token_url", "=", "'https://...
Checks docker.io to see if an image exists using the requests library. URL is based on the docker v2 schema. Requires that an access token be fetched first. :param str origAppliance: The full url of the docker image originally specified by the user (or the default). e.g. "ubunt...
[ "Checks", "docker", ".", "io", "to", "see", "if", "an", "image", "exists", "using", "the", "requests", "library", "." ]
python
train
Karaage-Cluster/karaage
karaage/datastores/slurm.py
https://github.com/Karaage-Cluster/karaage/blob/2f4c8b4e2d728b3fcbb151160c49000f1c04f5c9/karaage/datastores/slurm.py#L401-L411
def delete_project(self, project): """ Called when project is deleted. """ pid = project.pid # project deleted ds_project = self.get_project(pid) if ds_project is not None: self._call(["delete", "account", "name=%s" % pid]) return
[ "def", "delete_project", "(", "self", ",", "project", ")", ":", "pid", "=", "project", ".", "pid", "# project deleted", "ds_project", "=", "self", ".", "get_project", "(", "pid", ")", "if", "ds_project", "is", "not", "None", ":", "self", ".", "_call", "(...
Called when project is deleted.
[ "Called", "when", "project", "is", "deleted", "." ]
python
train
GNS3/gns3-server
gns3server/controller/udp_link.py
https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/controller/udp_link.py#L165-L172
def stop_capture(self): """ Stop capture on a link """ if self._capture_node: yield from self._capture_node["node"].post("/adapters/{adapter_number}/ports/{port_number}/stop_capture".format(adapter_number=self._capture_node["adapter_number"], port_number=self._capture_node["p...
[ "def", "stop_capture", "(", "self", ")", ":", "if", "self", ".", "_capture_node", ":", "yield", "from", "self", ".", "_capture_node", "[", "\"node\"", "]", ".", "post", "(", "\"/adapters/{adapter_number}/ports/{port_number}/stop_capture\"", ".", "format", "(", "ad...
Stop capture on a link
[ "Stop", "capture", "on", "a", "link" ]
python
train
seleniumbase/SeleniumBase
seleniumbase/fixtures/page_utils.py
https://github.com/seleniumbase/SeleniumBase/blob/62e5b43ee1f90a9ed923841bdd53b1b38358f43a/seleniumbase/fixtures/page_utils.py#L132-L145
def _get_link_status_code(link, allow_redirects=False, timeout=5): """ Get the status code of a link. If the timeout is exceeded, will return a 404. For a list of available status codes, see: https://en.wikipedia.org/wiki/List_of_HTTP_status_codes """ status_code = None try: ...
[ "def", "_get_link_status_code", "(", "link", ",", "allow_redirects", "=", "False", ",", "timeout", "=", "5", ")", ":", "status_code", "=", "None", "try", ":", "response", "=", "requests", ".", "get", "(", "link", ",", "allow_redirects", "=", "allow_redirects...
Get the status code of a link. If the timeout is exceeded, will return a 404. For a list of available status codes, see: https://en.wikipedia.org/wiki/List_of_HTTP_status_codes
[ "Get", "the", "status", "code", "of", "a", "link", ".", "If", "the", "timeout", "is", "exceeded", "will", "return", "a", "404", ".", "For", "a", "list", "of", "available", "status", "codes", "see", ":", "https", ":", "//", "en", ".", "wikipedia", "."...
python
train
pantsbuild/pants
src/python/pants/backend/jvm/tasks/jar_task.py
https://github.com/pantsbuild/pants/blob/b72e650da0df685824ffdcc71988b8c282d0962d/src/python/pants/backend/jvm/tasks/jar_task.py#L160-L181
def write(self, src, dest=None): """Schedules a write of the file at ``src`` to the ``dest`` path in this jar. If the ``src`` is a file, then ``dest`` must be specified. If the ``src`` is a directory then by default all descendant files will be added to the jar as entries carrying their relative path....
[ "def", "write", "(", "self", ",", "src", ",", "dest", "=", "None", ")", ":", "if", "not", "src", "or", "not", "isinstance", "(", "src", ",", "string_types", ")", ":", "raise", "ValueError", "(", "'The src path must be a non-empty string, got {} of type {}.'", ...
Schedules a write of the file at ``src`` to the ``dest`` path in this jar. If the ``src`` is a file, then ``dest`` must be specified. If the ``src`` is a directory then by default all descendant files will be added to the jar as entries carrying their relative path. If ``dest`` is specified it will be pr...
[ "Schedules", "a", "write", "of", "the", "file", "at", "src", "to", "the", "dest", "path", "in", "this", "jar", "." ]
python
train
welbornprod/colr
colr/colr.py
https://github.com/welbornprod/colr/blob/417117fdbddbc53142096685ac2af006b2bd0220/colr/colr.py#L1605-L1664
def gradient_black( self, text=None, fore=None, back=None, style=None, start=None, step=1, reverse=False, linemode=True, movefactor=2, rgb_mode=False): """ Return a black and white gradient. Arguments: text : String to colorize. ...
[ "def", "gradient_black", "(", "self", ",", "text", "=", "None", ",", "fore", "=", "None", ",", "back", "=", "None", ",", "style", "=", "None", ",", "start", "=", "None", ",", "step", "=", "1", ",", "reverse", "=", "False", ",", "linemode", "=", "...
Return a black and white gradient. Arguments: text : String to colorize. This will always be greater than 0. fore : Foreground color, background will be gradient. back : Background color, foreground will be gradie...
[ "Return", "a", "black", "and", "white", "gradient", ".", "Arguments", ":", "text", ":", "String", "to", "colorize", ".", "This", "will", "always", "be", "greater", "than", "0", ".", "fore", ":", "Foreground", "color", "background", "will", "be", "gradient"...
python
train
sdispater/orator
orator/orm/relations/has_one_or_many.py
https://github.com/sdispater/orator/blob/bd90bf198ee897751848f9a92e49d18e60a74136/orator/orm/relations/has_one_or_many.py#L297-L312
def update(self, _attributes=None, **attributes): """ Perform an update on all the related models. :param attributes: The attributes :type attributes: dict :rtype: int """ if _attributes is not None: attributes.update(_attributes) if self._r...
[ "def", "update", "(", "self", ",", "_attributes", "=", "None", ",", "*", "*", "attributes", ")", ":", "if", "_attributes", "is", "not", "None", ":", "attributes", ".", "update", "(", "_attributes", ")", "if", "self", ".", "_related", ".", "uses_timestamp...
Perform an update on all the related models. :param attributes: The attributes :type attributes: dict :rtype: int
[ "Perform", "an", "update", "on", "all", "the", "related", "models", "." ]
python
train
quantopian/zipline
zipline/data/loader.py
https://github.com/quantopian/zipline/blob/77ad15e6dc4c1cbcdc133653bac8a63fc704f7fe/zipline/data/loader.py#L78-L87
def has_data_for_dates(series_or_df, first_date, last_date): """ Does `series_or_df` have data on or before first_date and on or after last_date? """ dts = series_or_df.index if not isinstance(dts, pd.DatetimeIndex): raise TypeError("Expected a DatetimeIndex, but got %s." % type(dts)) ...
[ "def", "has_data_for_dates", "(", "series_or_df", ",", "first_date", ",", "last_date", ")", ":", "dts", "=", "series_or_df", ".", "index", "if", "not", "isinstance", "(", "dts", ",", "pd", ".", "DatetimeIndex", ")", ":", "raise", "TypeError", "(", "\"Expecte...
Does `series_or_df` have data on or before first_date and on or after last_date?
[ "Does", "series_or_df", "have", "data", "on", "or", "before", "first_date", "and", "on", "or", "after", "last_date?" ]
python
train
pystorm/pystorm
pystorm/spout.py
https://github.com/pystorm/pystorm/blob/0f853e007c79e03cefdb4a0794423f84dce4c2f3/pystorm/spout.py#L183-L206
def emit( self, tup, tup_id=None, stream=None, direct_task=None, need_task_ids=False ): """Emit a spout Tuple & add metadata about it to `unacked_tuples`. In order for this to work, `tup_id` is a required parameter. See :meth:`Bolt.emit`. """ if tup_id is None: ...
[ "def", "emit", "(", "self", ",", "tup", ",", "tup_id", "=", "None", ",", "stream", "=", "None", ",", "direct_task", "=", "None", ",", "need_task_ids", "=", "False", ")", ":", "if", "tup_id", "is", "None", ":", "raise", "ValueError", "(", "\"You must pr...
Emit a spout Tuple & add metadata about it to `unacked_tuples`. In order for this to work, `tup_id` is a required parameter. See :meth:`Bolt.emit`.
[ "Emit", "a", "spout", "Tuple", "&", "add", "metadata", "about", "it", "to", "unacked_tuples", "." ]
python
train
jcrist/skein
skein/objects.py
https://github.com/jcrist/skein/blob/16f8b1d3b3d9f79f36e2f152e45893339a1793e8/skein/objects.py#L247-L250
def to_yaml(self, skip_nulls=True): """Convert object to a yaml string""" return yaml.safe_dump(self.to_dict(skip_nulls=skip_nulls), default_flow_style=False)
[ "def", "to_yaml", "(", "self", ",", "skip_nulls", "=", "True", ")", ":", "return", "yaml", ".", "safe_dump", "(", "self", ".", "to_dict", "(", "skip_nulls", "=", "skip_nulls", ")", ",", "default_flow_style", "=", "False", ")" ]
Convert object to a yaml string
[ "Convert", "object", "to", "a", "yaml", "string" ]
python
train
ejeschke/ginga
ginga/gtkw/ImageViewGtk.py
https://github.com/ejeschke/ginga/blob/a78c893ec6f37a837de851947e9bb4625c597915/ginga/gtkw/ImageViewGtk.py#L83-L91
def save_plain_image_as_file(self, filepath, format='png', quality=90): """Used for generating thumbnails. Does not include overlaid graphics. """ pixbuf = self.get_plain_image_as_pixbuf() options = {} if format == 'jpeg': options['quality'] = str(quality) ...
[ "def", "save_plain_image_as_file", "(", "self", ",", "filepath", ",", "format", "=", "'png'", ",", "quality", "=", "90", ")", ":", "pixbuf", "=", "self", ".", "get_plain_image_as_pixbuf", "(", ")", "options", "=", "{", "}", "if", "format", "==", "'jpeg'", ...
Used for generating thumbnails. Does not include overlaid graphics.
[ "Used", "for", "generating", "thumbnails", ".", "Does", "not", "include", "overlaid", "graphics", "." ]
python
train
iotile/coretools
iotileemulate/iotile/emulate/reference/controller_features/sensor_log.py
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotileemulate/iotile/emulate/reference/controller_features/sensor_log.py#L104-L119
def clear_to_reset(self, config_vars): """Clear all volatile information across a reset.""" self._logger.info("Config vars in sensor log reset: %s", config_vars) super(SensorLogSubsystem, self).clear_to_reset(config_vars) self.storage.destroy_all_walkers() self.dump_walker = No...
[ "def", "clear_to_reset", "(", "self", ",", "config_vars", ")", ":", "self", ".", "_logger", ".", "info", "(", "\"Config vars in sensor log reset: %s\"", ",", "config_vars", ")", "super", "(", "SensorLogSubsystem", ",", "self", ")", ".", "clear_to_reset", "(", "c...
Clear all volatile information across a reset.
[ "Clear", "all", "volatile", "information", "across", "a", "reset", "." ]
python
train
nlppln/nlppln
nlppln/commands/frog_to_saf.py
https://github.com/nlppln/nlppln/blob/1155191921289a65ba2becd2bf8dfabb48eaf1f1/nlppln/commands/frog_to_saf.py#L53-L59
def _add_pos1(token): """ Adds a 'pos1' element to a frog token. """ result = token.copy() result['pos1'] = _POSMAP[token['pos'].split("(")[0]] return result
[ "def", "_add_pos1", "(", "token", ")", ":", "result", "=", "token", ".", "copy", "(", ")", "result", "[", "'pos1'", "]", "=", "_POSMAP", "[", "token", "[", "'pos'", "]", ".", "split", "(", "\"(\"", ")", "[", "0", "]", "]", "return", "result" ]
Adds a 'pos1' element to a frog token.
[ "Adds", "a", "pos1", "element", "to", "a", "frog", "token", "." ]
python
train
Yelp/kafka-utils
kafka_utils/kafka_cluster_manager/cluster_info/display.py
https://github.com/Yelp/kafka-utils/blob/cdb4d64308f3079ee0873250bf7b34d0d94eca50/kafka_utils/kafka_cluster_manager/cluster_info/display.py#L190-L254
def display_leader_imbalance(cluster_topologies): """Display leader count and weight imbalance statistics. :param cluster_topologies: A dictionary mapping a string name to a ClusterTopology object. """ broker_ids = list(next(six.itervalues(cluster_topologies)).brokers.keys()) assert all( ...
[ "def", "display_leader_imbalance", "(", "cluster_topologies", ")", ":", "broker_ids", "=", "list", "(", "next", "(", "six", ".", "itervalues", "(", "cluster_topologies", ")", ")", ".", "brokers", ".", "keys", "(", ")", ")", "assert", "all", "(", "set", "("...
Display leader count and weight imbalance statistics. :param cluster_topologies: A dictionary mapping a string name to a ClusterTopology object.
[ "Display", "leader", "count", "and", "weight", "imbalance", "statistics", "." ]
python
train
PyCQA/pylint
pylint/lint.py
https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/lint.py#L898-L905
def get_checkers(self): """return all available checkers as a list""" return [self] + [ c for _checkers in self._checkers.values() for c in _checkers if c is not self ]
[ "def", "get_checkers", "(", "self", ")", ":", "return", "[", "self", "]", "+", "[", "c", "for", "_checkers", "in", "self", ".", "_checkers", ".", "values", "(", ")", "for", "c", "in", "_checkers", "if", "c", "is", "not", "self", "]" ]
return all available checkers as a list
[ "return", "all", "available", "checkers", "as", "a", "list" ]
python
test
DarkEnergySurvey/ugali
ugali/isochrone/model.py
https://github.com/DarkEnergySurvey/ugali/blob/21e890b4117fc810afb6fb058e8055d564f03382/ugali/isochrone/model.py#L1158-L1203
def download(self,age=None,metallicity=None,outdir=None,force=False): """ Check valid parameter range and download isochrones from: http://stev.oapd.inaf.it/cgi-bin/cmd """ try: from urllib.error import URLError except ImportError: from urllib2 imp...
[ "def", "download", "(", "self", ",", "age", "=", "None", ",", "metallicity", "=", "None", ",", "outdir", "=", "None", ",", "force", "=", "False", ")", ":", "try", ":", "from", "urllib", ".", "error", "import", "URLError", "except", "ImportError", ":", ...
Check valid parameter range and download isochrones from: http://stev.oapd.inaf.it/cgi-bin/cmd
[ "Check", "valid", "parameter", "range", "and", "download", "isochrones", "from", ":", "http", ":", "//", "stev", ".", "oapd", ".", "inaf", ".", "it", "/", "cgi", "-", "bin", "/", "cmd" ]
python
train
awslabs/serverless-application-model
samtranslator/translator/translator.py
https://github.com/awslabs/serverless-application-model/blob/cccb0c96b5c91e53355ebc07e542467303a5eedd/samtranslator/translator/translator.py#L34-L122
def translate(self, sam_template, parameter_values): """Loads the SAM resources from the given SAM manifest, replaces them with their corresponding CloudFormation resources, and returns the resulting CloudFormation template. :param dict sam_template: the SAM manifest, as loaded by json.load() o...
[ "def", "translate", "(", "self", ",", "sam_template", ",", "parameter_values", ")", ":", "sam_parameter_values", "=", "SamParameterValues", "(", "parameter_values", ")", "sam_parameter_values", ".", "add_default_parameter_values", "(", "sam_template", ")", "sam_parameter_...
Loads the SAM resources from the given SAM manifest, replaces them with their corresponding CloudFormation resources, and returns the resulting CloudFormation template. :param dict sam_template: the SAM manifest, as loaded by json.load() or yaml.load(), or as provided by \ CloudFormatio...
[ "Loads", "the", "SAM", "resources", "from", "the", "given", "SAM", "manifest", "replaces", "them", "with", "their", "corresponding", "CloudFormation", "resources", "and", "returns", "the", "resulting", "CloudFormation", "template", "." ]
python
train
idlesign/django-siteprefs
siteprefs/toolbox.py
https://github.com/idlesign/django-siteprefs/blob/3d6bf5e64220fe921468a36fce68e15d7947cf92/siteprefs/toolbox.py#L249-L279
def register_prefs(*args, **kwargs): """Registers preferences that should be handled by siteprefs. Expects preferences as *args. Use keyword arguments to batch apply params supported by ``PrefProxy`` to all preferences not constructed by ``pref`` and ``pref_group``. Batch kwargs: :param ...
[ "def", "register_prefs", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "swap_settings_module", "=", "bool", "(", "kwargs", ".", "get", "(", "'swap_settings_module'", ",", "True", ")", ")", "if", "__PATCHED_LOCALS_SENTINEL", "not", "in", "get_frame_local...
Registers preferences that should be handled by siteprefs. Expects preferences as *args. Use keyword arguments to batch apply params supported by ``PrefProxy`` to all preferences not constructed by ``pref`` and ``pref_group``. Batch kwargs: :param str|unicode help_text: Field help text. ...
[ "Registers", "preferences", "that", "should", "be", "handled", "by", "siteprefs", "." ]
python
valid
boriel/zxbasic
zxbasmpplex.py
https://github.com/boriel/zxbasic/blob/23b28db10e41117805bdb3c0f78543590853b132/zxbasmpplex.py#L295-L298
def put_current_line(self, prefix=''): """ Returns line and file for include / end of include sequences. """ return '%s#line %i "%s"\n' % (prefix, self.lex.lineno, os.path.basename(self.filestack[-1][0]))
[ "def", "put_current_line", "(", "self", ",", "prefix", "=", "''", ")", ":", "return", "'%s#line %i \"%s\"\\n'", "%", "(", "prefix", ",", "self", ".", "lex", ".", "lineno", ",", "os", ".", "path", ".", "basename", "(", "self", ".", "filestack", "[", "-"...
Returns line and file for include / end of include sequences.
[ "Returns", "line", "and", "file", "for", "include", "/", "end", "of", "include", "sequences", "." ]
python
train
evandempsey/fp-growth
pyfpgrowth/pyfpgrowth.py
https://github.com/evandempsey/fp-growth/blob/6bf4503024e86c5bbea8a05560594f2f7f061c15/pyfpgrowth/pyfpgrowth.py#L135-L146
def tree_has_single_path(self, node): """ If there is a single path in the tree, return True, else return False. """ num_children = len(node.children) if num_children > 1: return False elif num_children == 0: return True else: ...
[ "def", "tree_has_single_path", "(", "self", ",", "node", ")", ":", "num_children", "=", "len", "(", "node", ".", "children", ")", "if", "num_children", ">", "1", ":", "return", "False", "elif", "num_children", "==", "0", ":", "return", "True", "else", ":...
If there is a single path in the tree, return True, else return False.
[ "If", "there", "is", "a", "single", "path", "in", "the", "tree", "return", "True", "else", "return", "False", "." ]
python
train
pandas-dev/pandas
pandas/core/groupby/groupby.py
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/groupby/groupby.py#L1474-L1505
def _fill(self, direction, limit=None): """ Shared function for `pad` and `backfill` to call Cython method. Parameters ---------- direction : {'ffill', 'bfill'} Direction passed to underlying Cython function. `bfill` will cause values to be filled backwar...
[ "def", "_fill", "(", "self", ",", "direction", ",", "limit", "=", "None", ")", ":", "# Need int value for Cython", "if", "limit", "is", "None", ":", "limit", "=", "-", "1", "return", "self", ".", "_get_cythonized_result", "(", "'group_fillna_indexer'", ",", ...
Shared function for `pad` and `backfill` to call Cython method. Parameters ---------- direction : {'ffill', 'bfill'} Direction passed to underlying Cython function. `bfill` will cause values to be filled backwards. `ffill` and any other values will default to...
[ "Shared", "function", "for", "pad", "and", "backfill", "to", "call", "Cython", "method", "." ]
python
train
saltstack/salt
salt/modules/jenkinsmod.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/jenkinsmod.py#L222-L251
def build_job(name=None, parameters=None): ''' Initiate a build for the provided job. :param name: The name of the job is check if it exists. :param parameters: Parameters to send to the job. :return: True is successful, otherwise raise an exception. CLI Example: .. code-block:: bash ...
[ "def", "build_job", "(", "name", "=", "None", ",", "parameters", "=", "None", ")", ":", "if", "not", "name", ":", "raise", "SaltInvocationError", "(", "'Required parameter \\'name\\' is missing'", ")", "server", "=", "_connect", "(", ")", "if", "not", "job_exi...
Initiate a build for the provided job. :param name: The name of the job is check if it exists. :param parameters: Parameters to send to the job. :return: True is successful, otherwise raise an exception. CLI Example: .. code-block:: bash salt '*' jenkins.build_job jobname
[ "Initiate", "a", "build", "for", "the", "provided", "job", "." ]
python
train
pybel/pybel
src/pybel/manager/models.py
https://github.com/pybel/pybel/blob/c8a7a1bdae4c475fa2a8c77f3a9a5f6d79556ca0/src/pybel/manager/models.py#L166-L184
def to_json(self, include_id: bool = False) -> Mapping[str, str]: """Describe the namespaceEntry as dictionary of Namespace-Keyword and Name. :param include_id: If true, includes the model identifier """ result = { NAMESPACE: self.namespace.keyword, } ...
[ "def", "to_json", "(", "self", ",", "include_id", ":", "bool", "=", "False", ")", "->", "Mapping", "[", "str", ",", "str", "]", ":", "result", "=", "{", "NAMESPACE", ":", "self", ".", "namespace", ".", "keyword", ",", "}", "if", "self", ".", "name"...
Describe the namespaceEntry as dictionary of Namespace-Keyword and Name. :param include_id: If true, includes the model identifier
[ "Describe", "the", "namespaceEntry", "as", "dictionary", "of", "Namespace", "-", "Keyword", "and", "Name", ".", ":", "param", "include_id", ":", "If", "true", "includes", "the", "model", "identifier" ]
python
train
manns/pyspread
pyspread/src/lib/vlc.py
https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/lib/vlc.py#L2727-L2740
def set_mrl(self, mrl, *options): """Set the MRL to play. Warning: most audio and video options, such as text renderer, have no effects on an individual media. These options must be set at the vlc.Instance or vlc.MediaPlayer instanciation. @param mrl: The MRL @param opt...
[ "def", "set_mrl", "(", "self", ",", "mrl", ",", "*", "options", ")", ":", "m", "=", "self", ".", "get_instance", "(", ")", ".", "media_new", "(", "mrl", ",", "*", "options", ")", "self", ".", "set_media", "(", "m", ")", "return", "m" ]
Set the MRL to play. Warning: most audio and video options, such as text renderer, have no effects on an individual media. These options must be set at the vlc.Instance or vlc.MediaPlayer instanciation. @param mrl: The MRL @param options: optional media option=value strings ...
[ "Set", "the", "MRL", "to", "play", "." ]
python
train
ArangoDB-Community/pyArango
pyArango/document.py
https://github.com/ArangoDB-Community/pyArango/blob/dd72e5f6c540e5e148943d615ddf7553bb78ce0b/pyArango/document.py#L214-L224
def setPrivates(self, fieldDict) : """will set self._id, self._rev and self._key field.""" for priv in self.privates : if priv in fieldDict : setattr(self, priv, fieldDict[priv]) else : setattr(self, priv, None) if self._i...
[ "def", "setPrivates", "(", "self", ",", "fieldDict", ")", ":", "for", "priv", "in", "self", ".", "privates", ":", "if", "priv", "in", "fieldDict", ":", "setattr", "(", "self", ",", "priv", ",", "fieldDict", "[", "priv", "]", ")", "else", ":", "setatt...
will set self._id, self._rev and self._key field.
[ "will", "set", "self", ".", "_id", "self", ".", "_rev", "and", "self", ".", "_key", "field", "." ]
python
train
eqcorrscan/EQcorrscan
eqcorrscan/utils/catalog_utils.py
https://github.com/eqcorrscan/EQcorrscan/blob/3121b4aca801ee5d38f56ca297ce1c0f9515d9ff/eqcorrscan/utils/catalog_utils.py#L166-L209
def spatial_clip(catalog, corners, mindepth=None, maxdepth=None): """ Clip the catalog to a spatial box, can be irregular. Can only be irregular in 2D, depth must be between bounds. :type catalog: :class:`obspy.core.catalog.Catalog` :param catalog: Catalog to clip. :type corners: :class:`matpl...
[ "def", "spatial_clip", "(", "catalog", ",", "corners", ",", "mindepth", "=", "None", ",", "maxdepth", "=", "None", ")", ":", "cat_out", "=", "catalog", ".", "copy", "(", ")", "if", "mindepth", "is", "not", "None", ":", "for", "event", "in", "cat_out", ...
Clip the catalog to a spatial box, can be irregular. Can only be irregular in 2D, depth must be between bounds. :type catalog: :class:`obspy.core.catalog.Catalog` :param catalog: Catalog to clip. :type corners: :class:`matplotlib.path.Path` :param corners: Corners to clip the catalog to :type ...
[ "Clip", "the", "catalog", "to", "a", "spatial", "box", "can", "be", "irregular", "." ]
python
train
trevisanj/a99
a99/config.py
https://github.com/trevisanj/a99/blob/193e6e3c9b3e4f4a0ba7eb3eece846fe7045c539/a99/config.py#L87-L94
def get_config_obj(filename): """Reads/creates filename at user **home** folder and returns a AAConfigObj object""" if not filename.startswith("."): a99.get_python_logger().warning("Configuration filename '{}' does not start with a '.'".format(filename)) path_ = os.path.join(os.path.expandus...
[ "def", "get_config_obj", "(", "filename", ")", ":", "if", "not", "filename", ".", "startswith", "(", "\".\"", ")", ":", "a99", ".", "get_python_logger", "(", ")", ".", "warning", "(", "\"Configuration filename '{}' does not start with a '.'\"", ".", "format", "(",...
Reads/creates filename at user **home** folder and returns a AAConfigObj object
[ "Reads", "/", "creates", "filename", "at", "user", "**", "home", "**", "folder", "and", "returns", "a", "AAConfigObj", "object" ]
python
train
biocore/burrito-fillings
bfillings/usearch.py
https://github.com/biocore/burrito-fillings/blob/02ab71a46119b40793bd56a4ae00ca15f6dc3329/bfillings/usearch.py#L991-L1036
def get_fasta_from_uc_file(fasta_filepath, uc_filepath, hit_type="H", output_fna_filepath=None, label_prefix="", output_dir=None): """ writes fasta of sequences from uc file of type...
[ "def", "get_fasta_from_uc_file", "(", "fasta_filepath", ",", "uc_filepath", ",", "hit_type", "=", "\"H\"", ",", "output_fna_filepath", "=", "None", ",", "label_prefix", "=", "\"\"", ",", "output_dir", "=", "None", ")", ":", "hit_type_index", "=", "0", "seq_label...
writes fasta of sequences from uc file of type hit_type fasta_filepath: Filepath of original query fasta file uc_filepath: Filepath of .uc file created by usearch post error filtering hit_type: type to read from first field of .uc file, "H" for hits, "N" for no hits. output_fna_filepath = fasta ...
[ "writes", "fasta", "of", "sequences", "from", "uc", "file", "of", "type", "hit_type" ]
python
train
zhanglab/psamm
psamm/lpsolver/lp.py
https://github.com/zhanglab/psamm/blob/dc427848c4f9d109ca590f0afa024c63b685b3f4/psamm/lpsolver/lp.py#L605-L612
def set(self, names): """Return a variable set of the given names in the namespace. >>> v = prob.namespace(name='v') >>> v.define([1, 2, 5], lower=0, upper=10) >>> prob.add_linear_constraints(v.set([1, 2]) >= 4) """ return self._problem.set((self, name) for name in names...
[ "def", "set", "(", "self", ",", "names", ")", ":", "return", "self", ".", "_problem", ".", "set", "(", "(", "self", ",", "name", ")", "for", "name", "in", "names", ")" ]
Return a variable set of the given names in the namespace. >>> v = prob.namespace(name='v') >>> v.define([1, 2, 5], lower=0, upper=10) >>> prob.add_linear_constraints(v.set([1, 2]) >= 4)
[ "Return", "a", "variable", "set", "of", "the", "given", "names", "in", "the", "namespace", "." ]
python
train
gwastro/pycbc
pycbc/waveform/ringdown.py
https://github.com/gwastro/pycbc/blob/7a64cdd104d263f1b6ea0b01e6841837d05a4cb3/pycbc/waveform/ringdown.py#L96-L116
def lm_freqs_taus(**kwargs): """ Take input_params and return dictionaries with frequencies and damping times of each overtone of a specific lm mode, checking that all of them are given. """ lmns = kwargs['lmns'] freqs, taus = {}, {} for lmn in lmns: l, m, nmodes = int(lmn[0]), int(...
[ "def", "lm_freqs_taus", "(", "*", "*", "kwargs", ")", ":", "lmns", "=", "kwargs", "[", "'lmns'", "]", "freqs", ",", "taus", "=", "{", "}", ",", "{", "}", "for", "lmn", "in", "lmns", ":", "l", ",", "m", ",", "nmodes", "=", "int", "(", "lmn", "...
Take input_params and return dictionaries with frequencies and damping times of each overtone of a specific lm mode, checking that all of them are given.
[ "Take", "input_params", "and", "return", "dictionaries", "with", "frequencies", "and", "damping", "times", "of", "each", "overtone", "of", "a", "specific", "lm", "mode", "checking", "that", "all", "of", "them", "are", "given", "." ]
python
train
pvlib/pvlib-python
pvlib/iotools/tmy.py
https://github.com/pvlib/pvlib-python/blob/2e844a595b820b43d1170269781fa66bd0ccc8a3/pvlib/iotools/tmy.py#L273-L420
def read_tmy2(filename): ''' Read a TMY2 file in to a DataFrame. Note that values contained in the DataFrame are unchanged from the TMY2 file (i.e. units are retained). Time/Date and location data imported from the TMY2 file have been modified to a "friendlier" form conforming to modern conven...
[ "def", "read_tmy2", "(", "filename", ")", ":", "if", "filename", "is", "None", ":", "try", ":", "filename", "=", "_interactive_load", "(", ")", "except", "ImportError", ":", "raise", "ImportError", "(", "'Interactive load failed. Tkinter not supported '", "'on this ...
Read a TMY2 file in to a DataFrame. Note that values contained in the DataFrame are unchanged from the TMY2 file (i.e. units are retained). Time/Date and location data imported from the TMY2 file have been modified to a "friendlier" form conforming to modern conventions (e.g. N latitude is postive, E ...
[ "Read", "a", "TMY2", "file", "in", "to", "a", "DataFrame", "." ]
python
train
PyCQA/astroid
astroid/node_classes.py
https://github.com/PyCQA/astroid/blob/e0a298df55b15abcb77c2a93253f5ab7be52d0fb/astroid/node_classes.py#L2966-L2979
def catch(self, exceptions): # pylint: disable=redefined-outer-name """Check if this node handles any of the given exceptions. If ``exceptions`` is empty, this will default to ``True``. :param exceptions: The name of the exceptions to check for. :type exceptions: list(str) """...
[ "def", "catch", "(", "self", ",", "exceptions", ")", ":", "# pylint: disable=redefined-outer-name", "if", "self", ".", "type", "is", "None", "or", "exceptions", "is", "None", ":", "return", "True", "for", "node", "in", "self", ".", "type", ".", "_get_name_no...
Check if this node handles any of the given exceptions. If ``exceptions`` is empty, this will default to ``True``. :param exceptions: The name of the exceptions to check for. :type exceptions: list(str)
[ "Check", "if", "this", "node", "handles", "any", "of", "the", "given", "exceptions", "." ]
python
train
dw/mitogen
ansible_mitogen/services.py
https://github.com/dw/mitogen/blob/a7fdb55e1300a7e0a5e404b09eb730cf9a525da7/ansible_mitogen/services.py#L343-L403
def _connect(self, key, spec, via=None): """ Actual connect implementation. Arranges for the Mitogen connection to be created and enqueues an asynchronous call to start the forked task parent in the remote context. :param key: Deduplication key representing the conne...
[ "def", "_connect", "(", "self", ",", "key", ",", "spec", ",", "via", "=", "None", ")", ":", "try", ":", "method", "=", "getattr", "(", "self", ".", "router", ",", "spec", "[", "'method'", "]", ")", "except", "AttributeError", ":", "raise", "Error", ...
Actual connect implementation. Arranges for the Mitogen connection to be created and enqueues an asynchronous call to start the forked task parent in the remote context. :param key: Deduplication key representing the connection configuration. :param spec: Connect...
[ "Actual", "connect", "implementation", ".", "Arranges", "for", "the", "Mitogen", "connection", "to", "be", "created", "and", "enqueues", "an", "asynchronous", "call", "to", "start", "the", "forked", "task", "parent", "in", "the", "remote", "context", "." ]
python
train
fermiPy/fermipy
fermipy/jobs/link.py
https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/jobs/link.py#L850-L860
def missing_input_files(self): """Make and return a dictionary of the missing input files. This returns a dictionary mapping filepath to list of `Link` that use the file as input. """ missing = self.check_input_files(return_found=False) ret_dict = {} for miss_fil...
[ "def", "missing_input_files", "(", "self", ")", ":", "missing", "=", "self", ".", "check_input_files", "(", "return_found", "=", "False", ")", "ret_dict", "=", "{", "}", "for", "miss_file", "in", "missing", ":", "ret_dict", "[", "miss_file", "]", "=", "[",...
Make and return a dictionary of the missing input files. This returns a dictionary mapping filepath to list of `Link` that use the file as input.
[ "Make", "and", "return", "a", "dictionary", "of", "the", "missing", "input", "files", "." ]
python
train
druids/django-chamber
chamber/utils/decorators.py
https://github.com/druids/django-chamber/blob/eef4169923557e96877a664fa254e8c0814f3f23/chamber/utils/decorators.py#L26-L44
def translation_activate_block(function=None, language=None): """ Activate language only for one method or function """ def _translation_activate_block(function): def _decorator(*args, **kwargs): tmp_language = translation.get_language() try: translation....
[ "def", "translation_activate_block", "(", "function", "=", "None", ",", "language", "=", "None", ")", ":", "def", "_translation_activate_block", "(", "function", ")", ":", "def", "_decorator", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "tmp_languag...
Activate language only for one method or function
[ "Activate", "language", "only", "for", "one", "method", "or", "function" ]
python
train
RedFantom/ttkwidgets
ttkwidgets/color/colorpicker.py
https://github.com/RedFantom/ttkwidgets/blob/02150322060f867b6e59a175522ef84b09168019/ttkwidgets/color/colorpicker.py#L332-L340
def _update_preview(self): """Update color preview.""" color = self.hexa.get() if self.alpha_channel: prev = overlay(self._transparent_bg, hexa_to_rgb(color)) self._im_color = ImageTk.PhotoImage(prev, master=self) self.color_preview.configure(image=self._im_co...
[ "def", "_update_preview", "(", "self", ")", ":", "color", "=", "self", ".", "hexa", ".", "get", "(", ")", "if", "self", ".", "alpha_channel", ":", "prev", "=", "overlay", "(", "self", ".", "_transparent_bg", ",", "hexa_to_rgb", "(", "color", ")", ")", ...
Update color preview.
[ "Update", "color", "preview", "." ]
python
train
saltstack/salt
salt/runners/cache.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/runners/cache.py#L388-L405
def store(bank, key, data, cachedir=None): ''' Lists entries stored in the specified bank. CLI Example: .. code-block:: bash salt-run cache.store mycache mykey 'The time has come the walrus said' ''' if cachedir is None: cachedir = __opts__['cachedir'] try: cache ...
[ "def", "store", "(", "bank", ",", "key", ",", "data", ",", "cachedir", "=", "None", ")", ":", "if", "cachedir", "is", "None", ":", "cachedir", "=", "__opts__", "[", "'cachedir'", "]", "try", ":", "cache", "=", "salt", ".", "cache", ".", "Cache", "(...
Lists entries stored in the specified bank. CLI Example: .. code-block:: bash salt-run cache.store mycache mykey 'The time has come the walrus said'
[ "Lists", "entries", "stored", "in", "the", "specified", "bank", "." ]
python
train
saltstack/salt
salt/modules/portage_config.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/portage_config.py#L68-L93
def _get_config_file(conf, atom): ''' Parse the given atom, allowing access to its parts Success does not mean that the atom exists, just that it is in the correct format. Returns none if the atom is invalid. ''' if '*' in atom: parts = portage.dep.Atom(atom, allow_wildcard=True) ...
[ "def", "_get_config_file", "(", "conf", ",", "atom", ")", ":", "if", "'*'", "in", "atom", ":", "parts", "=", "portage", ".", "dep", ".", "Atom", "(", "atom", ",", "allow_wildcard", "=", "True", ")", "if", "not", "parts", ":", "return", "if", "parts",...
Parse the given atom, allowing access to its parts Success does not mean that the atom exists, just that it is in the correct format. Returns none if the atom is invalid.
[ "Parse", "the", "given", "atom", "allowing", "access", "to", "its", "parts", "Success", "does", "not", "mean", "that", "the", "atom", "exists", "just", "that", "it", "is", "in", "the", "correct", "format", ".", "Returns", "none", "if", "the", "atom", "is...
python
train
ronhanson/python-tbx
tbx/code.py
https://github.com/ronhanson/python-tbx/blob/87f72ae0cadecafbcd144f1e930181fba77f6b83/tbx/code.py#L313-L327
def sort_dictionary_list(dict_list, sort_key): """ sorts a list of dictionaries based on the value of the sort_key dict_list - a list of dictionaries sort_key - a string that identifies the key to sort the dictionaries with. Test sorting a list of dictionaries: >>> sort_dictionary_list([{...
[ "def", "sort_dictionary_list", "(", "dict_list", ",", "sort_key", ")", ":", "if", "not", "dict_list", "or", "len", "(", "dict_list", ")", "==", "0", ":", "return", "dict_list", "dict_list", ".", "sort", "(", "key", "=", "itemgetter", "(", "sort_key", ")", ...
sorts a list of dictionaries based on the value of the sort_key dict_list - a list of dictionaries sort_key - a string that identifies the key to sort the dictionaries with. Test sorting a list of dictionaries: >>> sort_dictionary_list([{'b' : 1, 'value' : 2}, {'c' : 2, 'value' : 3}, {'a' : 3, 'v...
[ "sorts", "a", "list", "of", "dictionaries", "based", "on", "the", "value", "of", "the", "sort_key" ]
python
train
timkpaine/pyEX
pyEX/stocks.py
https://github.com/timkpaine/pyEX/blob/91cf751dafdb208a0c8b5377945e5808b99f94ba/pyEX/stocks.py#L12-L28
def balanceSheet(symbol, token='', version=''): '''Pulls balance sheet data. Available quarterly (4 quarters) and annually (4 years) https://iexcloud.io/docs/api/#balance-sheet Updates at 8am, 9am UTC daily Args: symbol (string); Ticker to request token (string); Access token ...
[ "def", "balanceSheet", "(", "symbol", ",", "token", "=", "''", ",", "version", "=", "''", ")", ":", "_raiseIfNotStr", "(", "symbol", ")", "return", "_getJson", "(", "'stock/'", "+", "symbol", "+", "'/balance-sheet'", ",", "token", ",", "version", ")" ]
Pulls balance sheet data. Available quarterly (4 quarters) and annually (4 years) https://iexcloud.io/docs/api/#balance-sheet Updates at 8am, 9am UTC daily Args: symbol (string); Ticker to request token (string); Access token version (string); API version Returns: dic...
[ "Pulls", "balance", "sheet", "data", ".", "Available", "quarterly", "(", "4", "quarters", ")", "and", "annually", "(", "4", "years", ")" ]
python
valid
senaite/senaite.core
bika/lims/browser/reports/selection_macros/__init__.py
https://github.com/senaite/senaite.core/blob/7602ce2ea2f9e81eb34e20ce17b98a3e70713f85/bika/lims/browser/reports/selection_macros/__init__.py#L167-L172
def _cache_key_select_sample_type(method, self, allow_blank=True, multiselect=False, style=None): """ This function returns the key used to decide if method select_sample_type has to be recomputed """ key = update_timer(), allow_blank, multiselect, style return key
[ "def", "_cache_key_select_sample_type", "(", "method", ",", "self", ",", "allow_blank", "=", "True", ",", "multiselect", "=", "False", ",", "style", "=", "None", ")", ":", "key", "=", "update_timer", "(", ")", ",", "allow_blank", ",", "multiselect", ",", "...
This function returns the key used to decide if method select_sample_type has to be recomputed
[ "This", "function", "returns", "the", "key", "used", "to", "decide", "if", "method", "select_sample_type", "has", "to", "be", "recomputed" ]
python
train
saltstack/salt
salt/states/ssh_auth.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/ssh_auth.py#L512-L605
def manage( name, ssh_keys, user, enc='ssh-rsa', comment='', source='', options=None, config='.ssh/authorized_keys', fingerprint_hash_type=None, **kwargs): ''' .. versionadded:: Neon Ensures that only the specified ssh_keys are...
[ "def", "manage", "(", "name", ",", "ssh_keys", ",", "user", ",", "enc", "=", "'ssh-rsa'", ",", "comment", "=", "''", ",", "source", "=", "''", ",", "options", "=", "None", ",", "config", "=", "'.ssh/authorized_keys'", ",", "fingerprint_hash_type", "=", "...
.. versionadded:: Neon Ensures that only the specified ssh_keys are present for the specified user ssh_keys The SSH key to manage user The user who owns the SSH authorized keys file to modify enc Defines what type of key is being used; can be ed25519, ecdsa, ssh-rsa o...
[ "..", "versionadded", "::", "Neon" ]
python
train
b3j0f/annotation
b3j0f/annotation/oop.py
https://github.com/b3j0f/annotation/blob/738035a974e4092696d9dc1bbd149faa21c8c51f/b3j0f/annotation/oop.py#L151-L194
def mixin_function_or_method(target, routine, name=None, isbound=False): """Mixin a routine into the target. :param routine: routine to mix in target. :param str name: mixin name. Routine name by default. :param bool isbound: If True (False by default), the mixin result is a ...
[ "def", "mixin_function_or_method", "(", "target", ",", "routine", ",", "name", "=", "None", ",", "isbound", "=", "False", ")", ":", "function", "=", "None", "if", "isfunction", "(", "routine", ")", ":", "function", "=", "routine", "elif", "ismethod", "(", ...
Mixin a routine into the target. :param routine: routine to mix in target. :param str name: mixin name. Routine name by default. :param bool isbound: If True (False by default), the mixin result is a bound method to target.
[ "Mixin", "a", "routine", "into", "the", "target", "." ]
python
train
Qiskit/qiskit-terra
qiskit/pulse/pulse_lib/discrete.py
https://github.com/Qiskit/qiskit-terra/blob/d4f58d903bc96341b816f7c35df936d6421267d1/qiskit/pulse/pulse_lib/discrete.py#L227-L251
def drag(duration: int, amp: complex, sigma: float, beta: float, name: str = None) -> SamplePulse: r"""Generates Y-only correction DRAG `SamplePulse` for standard nonlinear oscillator (SNO) [1]. Centered at `duration/2` and zeroed at `t=-1` to prevent large initial discontinuity. Applies `left` sampling s...
[ "def", "drag", "(", "duration", ":", "int", ",", "amp", ":", "complex", ",", "sigma", ":", "float", ",", "beta", ":", "float", ",", "name", ":", "str", "=", "None", ")", "->", "SamplePulse", ":", "center", "=", "duration", "/", "2", "zeroed_width", ...
r"""Generates Y-only correction DRAG `SamplePulse` for standard nonlinear oscillator (SNO) [1]. Centered at `duration/2` and zeroed at `t=-1` to prevent large initial discontinuity. Applies `left` sampling strategy to generate discrete pulse from continuous function. [1] Gambetta, J. M., Motzoi, F., Merk...
[ "r", "Generates", "Y", "-", "only", "correction", "DRAG", "SamplePulse", "for", "standard", "nonlinear", "oscillator", "(", "SNO", ")", "[", "1", "]", "." ]
python
test
jkitzes/macroeco
macroeco/misc/misc.py
https://github.com/jkitzes/macroeco/blob/ee5fac5560a2d64de3a64738b5bc6833e2d7ff2e/macroeco/misc/misc.py#L36-L57
def inherit_docstring_from(cls): """ This decorator modifies the decorated function's docstring by replacing occurrences of '%(super)s' with the docstring of the method of the same name from the class `cls`. If the decorated method has no docstring, it is simply given the docstring of cls metho...
[ "def", "inherit_docstring_from", "(", "cls", ")", ":", "def", "_doc", "(", "func", ")", ":", "cls_docstring", "=", "getattr", "(", "cls", ",", "func", ".", "__name__", ")", ".", "__doc__", "func_docstring", "=", "func", ".", "__doc__", "if", "func_docstrin...
This decorator modifies the decorated function's docstring by replacing occurrences of '%(super)s' with the docstring of the method of the same name from the class `cls`. If the decorated method has no docstring, it is simply given the docstring of cls method. Extracted from scipy.misc.doccer.
[ "This", "decorator", "modifies", "the", "decorated", "function", "s", "docstring", "by", "replacing", "occurrences", "of", "%", "(", "super", ")", "s", "with", "the", "docstring", "of", "the", "method", "of", "the", "same", "name", "from", "the", "class", ...
python
train
chaoss/grimoirelab-perceval
perceval/backends/core/gitlab.py
https://github.com/chaoss/grimoirelab-perceval/blob/41c908605e88b7ebc3a536c643fa0f212eaf9e0e/perceval/backends/core/gitlab.py#L533-L552
def fetch(self, url, payload=None, headers=None, method=HttpClient.GET, stream=False): """Fetch the data from a given URL. :param url: link to the resource :param payload: payload of the request :param headers: headers of the request :param method: type of request call (GET or P...
[ "def", "fetch", "(", "self", ",", "url", ",", "payload", "=", "None", ",", "headers", "=", "None", ",", "method", "=", "HttpClient", ".", "GET", ",", "stream", "=", "False", ")", ":", "if", "not", "self", ".", "from_archive", ":", "self", ".", "sle...
Fetch the data from a given URL. :param url: link to the resource :param payload: payload of the request :param headers: headers of the request :param method: type of request call (GET or POST) :param stream: defer downloading the response body until the response content is avai...
[ "Fetch", "the", "data", "from", "a", "given", "URL", "." ]
python
test
ejeschke/ginga
experimental/plugins/IRAF.py
https://github.com/ejeschke/ginga/blob/a78c893ec6f37a837de851947e9bb4625c597915/experimental/plugins/IRAF.py#L389-L410
def init_frame(self, n): """ NOTE: this is called from the IIS_RequestHandler """ self.logger.debug("initializing frame %d" % (n)) # create the frame, if needed try: fb = self.get_frame(n) except KeyError: fb = iis.framebuffer() ...
[ "def", "init_frame", "(", "self", ",", "n", ")", ":", "self", ".", "logger", ".", "debug", "(", "\"initializing frame %d\"", "%", "(", "n", ")", ")", "# create the frame, if needed", "try", ":", "fb", "=", "self", ".", "get_frame", "(", "n", ")", "except...
NOTE: this is called from the IIS_RequestHandler
[ "NOTE", ":", "this", "is", "called", "from", "the", "IIS_RequestHandler" ]
python
train
jason-weirather/py-seq-tools
seqtools/errors.py
https://github.com/jason-weirather/py-seq-tools/blob/f642c2c73ffef2acc83656a78059a476fc734ca1/seqtools/errors.py#L425-L458
def get_string(self): """ Get a string representation of this single base error. :returns: report :rtype: string """ ostr = '' ostr += 'BaseError for ['+self._type+'] base: '+self.get_base()+"\n" if self._observable.get_error_probability() > 0: ostr += ' Homopolymer set:'+"\n" ...
[ "def", "get_string", "(", "self", ")", ":", "ostr", "=", "''", "ostr", "+=", "'BaseError for ['", "+", "self", ".", "_type", "+", "'] base: '", "+", "self", ".", "get_base", "(", ")", "+", "\"\\n\"", "if", "self", ".", "_observable", ".", "get_error_prob...
Get a string representation of this single base error. :returns: report :rtype: string
[ "Get", "a", "string", "representation", "of", "this", "single", "base", "error", "." ]
python
train
twilio/twilio-python
twilio/rest/taskrouter/v1/workspace/worker/__init__.py
https://github.com/twilio/twilio-python/blob/c867895f55dcc29f522e6e8b8868d0d18483132f/twilio/rest/taskrouter/v1/workspace/worker/__init__.py#L213-L225
def statistics(self): """ Access the statistics :returns: twilio.rest.taskrouter.v1.workspace.worker.workers_statistics.WorkersStatisticsList :rtype: twilio.rest.taskrouter.v1.workspace.worker.workers_statistics.WorkersStatisticsList """ if self._statistics is None: ...
[ "def", "statistics", "(", "self", ")", ":", "if", "self", ".", "_statistics", "is", "None", ":", "self", ".", "_statistics", "=", "WorkersStatisticsList", "(", "self", ".", "_version", ",", "workspace_sid", "=", "self", ".", "_solution", "[", "'workspace_sid...
Access the statistics :returns: twilio.rest.taskrouter.v1.workspace.worker.workers_statistics.WorkersStatisticsList :rtype: twilio.rest.taskrouter.v1.workspace.worker.workers_statistics.WorkersStatisticsList
[ "Access", "the", "statistics" ]
python
train
SUSE-Enceladus/ipa
ipa/ipa_gce.py
https://github.com/SUSE-Enceladus/ipa/blob/0845eed0ea25a27dbb059ad1016105fa60002228/ipa/ipa_gce.py#L274-L286
def _set_instance_ip(self): """Retrieve and set the instance ip address.""" instance = self._get_instance() if instance.public_ips: self.instance_ip = instance.public_ips[0] elif instance.private_ips: self.instance_ip = instance.private_ips[0] else: ...
[ "def", "_set_instance_ip", "(", "self", ")", ":", "instance", "=", "self", ".", "_get_instance", "(", ")", "if", "instance", ".", "public_ips", ":", "self", ".", "instance_ip", "=", "instance", ".", "public_ips", "[", "0", "]", "elif", "instance", ".", "...
Retrieve and set the instance ip address.
[ "Retrieve", "and", "set", "the", "instance", "ip", "address", "." ]
python
train
saltstack/salt
salt/modules/parallels.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/parallels.py#L688-L742
def delete_snapshot(name, snap_name, runas=None, all=False): ''' Delete a snapshot .. note:: Deleting a snapshot from which other snapshots are dervied will not delete the derived snapshots :param str name: Name/ID of VM whose snapshot will be deleted :param str snap_name...
[ "def", "delete_snapshot", "(", "name", ",", "snap_name", ",", "runas", "=", "None", ",", "all", "=", "False", ")", ":", "# strict means raise an error if multiple snapshot IDs found for the name given", "strict", "=", "not", "all", "# Validate VM and snapshot names", "nam...
Delete a snapshot .. note:: Deleting a snapshot from which other snapshots are dervied will not delete the derived snapshots :param str name: Name/ID of VM whose snapshot will be deleted :param str snap_name: Name/ID of snapshot to delete :param str runas: Th...
[ "Delete", "a", "snapshot" ]
python
train
SergeySatskiy/cdm-pythonparser
cdmpyparser.py
https://github.com/SergeySatskiy/cdm-pythonparser/blob/7e933aca899b1853d744082313ffc3a8b1154505/cdmpyparser.py#L562-L569
def _onDecorator(self, name, line, pos, absPosition): """Memorizes a function or a class decorator""" # A class or a function must be on the top of the stack d = Decorator(name, line, pos, absPosition) if self.__lastDecorators is None: self.__lastDecorators = [d] else...
[ "def", "_onDecorator", "(", "self", ",", "name", ",", "line", ",", "pos", ",", "absPosition", ")", ":", "# A class or a function must be on the top of the stack", "d", "=", "Decorator", "(", "name", ",", "line", ",", "pos", ",", "absPosition", ")", "if", "self...
Memorizes a function or a class decorator
[ "Memorizes", "a", "function", "or", "a", "class", "decorator" ]
python
train
log2timeline/plaso
plaso/parsers/manager.py
https://github.com/log2timeline/plaso/blob/9c564698d2da3ffbe23607a3c54c0582ea18a6cc/plaso/parsers/manager.py#L283-L301
def GetParserPluginsInformation(cls, parser_filter_expression=None): """Retrieves the parser plugins information. Args: parser_filter_expression (Optional[str]): parser filter expression, where None represents all parsers and plugins. Returns: list[tuple[str, str]]: pairs of parser p...
[ "def", "GetParserPluginsInformation", "(", "cls", ",", "parser_filter_expression", "=", "None", ")", ":", "parser_plugins_information", "=", "[", "]", "for", "_", ",", "parser_class", "in", "cls", ".", "GetParsers", "(", "parser_filter_expression", "=", "parser_filt...
Retrieves the parser plugins information. Args: parser_filter_expression (Optional[str]): parser filter expression, where None represents all parsers and plugins. Returns: list[tuple[str, str]]: pairs of parser plugin names and descriptions.
[ "Retrieves", "the", "parser", "plugins", "information", "." ]
python
train
barryp/py-amqplib
amqplib/client_0_8/transport.py
https://github.com/barryp/py-amqplib/blob/2b3a47de34b4712c111d0a55d7ff109dffc2a7b2/amqplib/client_0_8/transport.py#L245-L252
def _setup_transport(self): """ Setup to _write() directly to the socket, and do our own buffered reads. """ self._write = self.sock.sendall self._read_buffer = bytes()
[ "def", "_setup_transport", "(", "self", ")", ":", "self", ".", "_write", "=", "self", ".", "sock", ".", "sendall", "self", ".", "_read_buffer", "=", "bytes", "(", ")" ]
Setup to _write() directly to the socket, and do our own buffered reads.
[ "Setup", "to", "_write", "()", "directly", "to", "the", "socket", "and", "do", "our", "own", "buffered", "reads", "." ]
python
train
kensho-technologies/graphql-compiler
graphql_compiler/compiler/ir_lowering_gremlin/ir_lowering.py
https://github.com/kensho-technologies/graphql-compiler/blob/f6079c6d10f64932f6b3af309b79bcea2123ca8f/graphql_compiler/compiler/ir_lowering_gremlin/ir_lowering.py#L319-L355
def lower_folded_outputs(ir_blocks): """Lower standard folded output fields into GremlinFoldedContextField objects.""" folds, remaining_ir_blocks = extract_folds_from_ir_blocks(ir_blocks) if not remaining_ir_blocks: raise AssertionError(u'Expected at least one non-folded block to remain: {} {} ' ...
[ "def", "lower_folded_outputs", "(", "ir_blocks", ")", ":", "folds", ",", "remaining_ir_blocks", "=", "extract_folds_from_ir_blocks", "(", "ir_blocks", ")", "if", "not", "remaining_ir_blocks", ":", "raise", "AssertionError", "(", "u'Expected at least one non-folded block to ...
Lower standard folded output fields into GremlinFoldedContextField objects.
[ "Lower", "standard", "folded", "output", "fields", "into", "GremlinFoldedContextField", "objects", "." ]
python
train
swharden/SWHLab
doc/oldcode/swhlab/core/ap.py
https://github.com/swharden/SWHLab/blob/a86c3c65323cec809a4bd4f81919644927094bf5/doc/oldcode/swhlab/core/ap.py#L323-L332
def stats_first(abf): """provide all stats on the first AP.""" msg="" for sweep in range(abf.sweeps): for AP in abf.APs[sweep]: for key in sorted(AP.keys()): if key[-1] is "I" or key[-2:] in ["I1","I2"]: continue msg+="%s = %s\n"%(key,A...
[ "def", "stats_first", "(", "abf", ")", ":", "msg", "=", "\"\"", "for", "sweep", "in", "range", "(", "abf", ".", "sweeps", ")", ":", "for", "AP", "in", "abf", ".", "APs", "[", "sweep", "]", ":", "for", "key", "in", "sorted", "(", "AP", ".", "key...
provide all stats on the first AP.
[ "provide", "all", "stats", "on", "the", "first", "AP", "." ]
python
valid
mlperf/training
reinforcement/tensorflow/minigo/bigtable_input.py
https://github.com/mlperf/training/blob/1c6ae725a81d15437a2b2df05cac0673fde5c3a4/reinforcement/tensorflow/minigo/bigtable_input.py#L331-L363
def trim_games_since(self, t, max_games=500000): """Trim off the games since the given time. Search back no more than max_games for this time point, locate the game there, and remove all games since that game, resetting the latest game counter. If `t` is a `datetime.timedelta`,...
[ "def", "trim_games_since", "(", "self", ",", "t", ",", "max_games", "=", "500000", ")", ":", "latest", "=", "self", ".", "latest_game_number", "earliest", "=", "int", "(", "latest", "-", "max_games", ")", "gbt", "=", "self", ".", "games_by_time", "(", "e...
Trim off the games since the given time. Search back no more than max_games for this time point, locate the game there, and remove all games since that game, resetting the latest game counter. If `t` is a `datetime.timedelta`, then the target time will be found by subtracting t...
[ "Trim", "off", "the", "games", "since", "the", "given", "time", "." ]
python
train
cloud9ers/gurumate
environment/share/doc/ipython/examples/parallel/rmt/rmtkernel.py
https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/share/doc/ipython/examples/parallel/rmt/rmtkernel.py#L24-L30
def ensemble_diffs(num, N): """Return num eigenvalue diffs for the NxN GOE ensemble.""" diffs = np.empty(num) for i in xrange(num): mat = GOE(N) diffs[i] = center_eigenvalue_diff(mat) return diffs
[ "def", "ensemble_diffs", "(", "num", ",", "N", ")", ":", "diffs", "=", "np", ".", "empty", "(", "num", ")", "for", "i", "in", "xrange", "(", "num", ")", ":", "mat", "=", "GOE", "(", "N", ")", "diffs", "[", "i", "]", "=", "center_eigenvalue_diff",...
Return num eigenvalue diffs for the NxN GOE ensemble.
[ "Return", "num", "eigenvalue", "diffs", "for", "the", "NxN", "GOE", "ensemble", "." ]
python
test
carpedm20/fbchat
fbchat/_client.py
https://github.com/carpedm20/fbchat/blob/f480d68b5773473e6daba7f66075ee30e8d737a8/fbchat/_client.py#L1949-L1964
def changeThreadColor(self, color, thread_id=None): """ Changes thread color :param color: New thread color :param thread_id: User/Group ID to change color of. See :ref:`intro_threads` :type color: models.ThreadColor :raises: FBchatException if request failed """...
[ "def", "changeThreadColor", "(", "self", ",", "color", ",", "thread_id", "=", "None", ")", ":", "thread_id", ",", "thread_type", "=", "self", ".", "_getThread", "(", "thread_id", ",", "None", ")", "data", "=", "{", "\"color_choice\"", ":", "color", ".", ...
Changes thread color :param color: New thread color :param thread_id: User/Group ID to change color of. See :ref:`intro_threads` :type color: models.ThreadColor :raises: FBchatException if request failed
[ "Changes", "thread", "color" ]
python
train
DLR-RM/RAFCON
share/examples/plugins/templates/gtkmvc_template_observer.py
https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/share/examples/plugins/templates/gtkmvc_template_observer.py#L36-L46
def relieve_state_machines(self, model, prop_name, info): """ The method relieves observed models before those get removed from the list of state_machines hold by observed StateMachineMangerModel. The method register as observer of observable StateMachineMangerModel.state_machines.""" if...
[ "def", "relieve_state_machines", "(", "self", ",", "model", ",", "prop_name", ",", "info", ")", ":", "if", "info", "[", "'method_name'", "]", "==", "'__setitem__'", ":", "pass", "elif", "info", "[", "'method_name'", "]", "==", "'__delitem__'", ":", "self", ...
The method relieves observed models before those get removed from the list of state_machines hold by observed StateMachineMangerModel. The method register as observer of observable StateMachineMangerModel.state_machines.
[ "The", "method", "relieves", "observed", "models", "before", "those", "get", "removed", "from", "the", "list", "of", "state_machines", "hold", "by", "observed", "StateMachineMangerModel", ".", "The", "method", "register", "as", "observer", "of", "observable", "Sta...
python
train
csparpa/pyowm
pyowm/weatherapi25/owm25.py
https://github.com/csparpa/pyowm/blob/cdd59eb72f32f7238624ceef9b2e2329a5ebd472/pyowm/weatherapi25/owm25.py#L1090-L1111
def uvindex_around_coords(self, lat, lon): """ Queries the OWM Weather API for Ultra Violet value sampled in the surroundings of the provided geocoordinates and in the specified time interval. A *UVIndex* object instance is returned, encapsulating a *Location* object and the UV i...
[ "def", "uvindex_around_coords", "(", "self", ",", "lat", ",", "lon", ")", ":", "geo", ".", "assert_is_lon", "(", "lon", ")", "geo", ".", "assert_is_lat", "(", "lat", ")", "params", "=", "{", "'lon'", ":", "lon", ",", "'lat'", ":", "lat", "}", "json_d...
Queries the OWM Weather API for Ultra Violet value sampled in the surroundings of the provided geocoordinates and in the specified time interval. A *UVIndex* object instance is returned, encapsulating a *Location* object and the UV intensity value. :param lat: the location's latitude, m...
[ "Queries", "the", "OWM", "Weather", "API", "for", "Ultra", "Violet", "value", "sampled", "in", "the", "surroundings", "of", "the", "provided", "geocoordinates", "and", "in", "the", "specified", "time", "interval", ".", "A", "*", "UVIndex", "*", "object", "in...
python
train
bwhite/hadoopy
hadoopy/thirdparty/pyinstaller/PyInstaller/loader/archive.py
https://github.com/bwhite/hadoopy/blob/ff39b4e6d4e6efaf1f571cf0f2c0e0d7ab28c2d6/hadoopy/thirdparty/pyinstaller/PyInstaller/loader/archive.py#L177-L206
def build(self, path, lTOC): """ Create an archive file of name 'path'. lTOC is a 'logical TOC' - a list of (name, path, ...) where name is the internal name, eg 'a' and path is a file to get the object from, eg './a.pyc'. """ self.path = path self.lib = o...
[ "def", "build", "(", "self", ",", "path", ",", "lTOC", ")", ":", "self", ".", "path", "=", "path", "self", ".", "lib", "=", "open", "(", "path", ",", "'wb'", ")", "#reserve space for the header", "if", "self", ".", "HDRLEN", ":", "self", ".", "lib", ...
Create an archive file of name 'path'. lTOC is a 'logical TOC' - a list of (name, path, ...) where name is the internal name, eg 'a' and path is a file to get the object from, eg './a.pyc'.
[ "Create", "an", "archive", "file", "of", "name", "path", ".", "lTOC", "is", "a", "logical", "TOC", "-", "a", "list", "of", "(", "name", "path", "...", ")", "where", "name", "is", "the", "internal", "name", "eg", "a", "and", "path", "is", "a", "file...
python
train
atlassian-api/atlassian-python-api
atlassian/jira.py
https://github.com/atlassian-api/atlassian-python-api/blob/540d269905c3e7547b666fe30c647b2d512cf358/atlassian/jira.py#L1131-L1138
def get_agile_board(self, board_id): """ Get agile board info by id :param board_id: :return: """ url = 'rest/agile/1.0/board/{}'.format(str(board_id)) return self.get(url)
[ "def", "get_agile_board", "(", "self", ",", "board_id", ")", ":", "url", "=", "'rest/agile/1.0/board/{}'", ".", "format", "(", "str", "(", "board_id", ")", ")", "return", "self", ".", "get", "(", "url", ")" ]
Get agile board info by id :param board_id: :return:
[ "Get", "agile", "board", "info", "by", "id", ":", "param", "board_id", ":", ":", "return", ":" ]
python
train