partition stringclasses 3
values | func_name stringlengths 1 134 | docstring stringlengths 1 46.9k | path stringlengths 4 223 | original_string stringlengths 75 104k | code stringlengths 75 104k | docstring_tokens listlengths 1 1.97k | repo stringlengths 7 55 | language stringclasses 1
value | url stringlengths 87 315 | code_tokens listlengths 19 28.4k | sha stringlengths 40 40 |
|---|---|---|---|---|---|---|---|---|---|---|---|
valid | expand_dims | Insert a new axis, corresponding to a given position in the array shape
Args:
a (array_like): Input array.
axis (int): Position (amongst axes) where new axis is to be inserted. | distob/arrays.py | def expand_dims(a, axis):
"""Insert a new axis, corresponding to a given position in the array shape
Args:
a (array_like): Input array.
axis (int): Position (amongst axes) where new axis is to be inserted.
"""
if hasattr(a, 'expand_dims') and hasattr(type(a), '__array_interface__'):
... | def expand_dims(a, axis):
"""Insert a new axis, corresponding to a given position in the array shape
Args:
a (array_like): Input array.
axis (int): Position (amongst axes) where new axis is to be inserted.
"""
if hasattr(a, 'expand_dims') and hasattr(type(a), '__array_interface__'):
... | [
"Insert",
"a",
"new",
"axis",
"corresponding",
"to",
"a",
"given",
"position",
"in",
"the",
"array",
"shape"
] | mattja/distob | python | https://github.com/mattja/distob/blob/b0fc49e157189932c70231077ed35e1aa5717da9/distob/arrays.py#L1508-L1518 | [
"def",
"expand_dims",
"(",
"a",
",",
"axis",
")",
":",
"if",
"hasattr",
"(",
"a",
",",
"'expand_dims'",
")",
"and",
"hasattr",
"(",
"type",
"(",
"a",
")",
",",
"'__array_interface__'",
")",
":",
"return",
"a",
".",
"expand_dims",
"(",
"axis",
")",
"e... | b0fc49e157189932c70231077ed35e1aa5717da9 |
valid | concatenate | Join a sequence of arrays together.
Will aim to join `ndarray`, `RemoteArray`, and `DistArray` without moving
their data, if they happen to be on different engines.
Args:
tup (sequence of array_like): Arrays to be concatenated. They must have
the same shape, except in the dimension correspo... | distob/arrays.py | def concatenate(tup, axis=0):
"""Join a sequence of arrays together.
Will aim to join `ndarray`, `RemoteArray`, and `DistArray` without moving
their data, if they happen to be on different engines.
Args:
tup (sequence of array_like): Arrays to be concatenated. They must have
the same sh... | def concatenate(tup, axis=0):
"""Join a sequence of arrays together.
Will aim to join `ndarray`, `RemoteArray`, and `DistArray` without moving
their data, if they happen to be on different engines.
Args:
tup (sequence of array_like): Arrays to be concatenated. They must have
the same sh... | [
"Join",
"a",
"sequence",
"of",
"arrays",
"together",
".",
"Will",
"aim",
"to",
"join",
"ndarray",
"RemoteArray",
"and",
"DistArray",
"without",
"moving",
"their",
"data",
"if",
"they",
"happen",
"to",
"be",
"on",
"different",
"engines",
"."
] | mattja/distob | python | https://github.com/mattja/distob/blob/b0fc49e157189932c70231077ed35e1aa5717da9/distob/arrays.py#L1529-L1610 | [
"def",
"concatenate",
"(",
"tup",
",",
"axis",
"=",
"0",
")",
":",
"from",
"distob",
"import",
"engine",
"if",
"len",
"(",
"tup",
")",
"is",
"0",
":",
"raise",
"ValueError",
"(",
"'need at least one array to concatenate'",
")",
"first",
"=",
"tup",
"[",
... | b0fc49e157189932c70231077ed35e1aa5717da9 |
valid | vstack | Stack arrays in sequence vertically (row wise),
handling ``RemoteArray`` and ``DistArray`` without moving data.
Args:
tup (sequence of array_like)
Returns:
res: `ndarray`, if inputs were all local
`RemoteArray`, if inputs were all on the same remote engine
`DistArray`, ... | distob/arrays.py | def vstack(tup):
"""Stack arrays in sequence vertically (row wise),
handling ``RemoteArray`` and ``DistArray`` without moving data.
Args:
tup (sequence of array_like)
Returns:
res: `ndarray`, if inputs were all local
`RemoteArray`, if inputs were all on the same remote engine
... | def vstack(tup):
"""Stack arrays in sequence vertically (row wise),
handling ``RemoteArray`` and ``DistArray`` without moving data.
Args:
tup (sequence of array_like)
Returns:
res: `ndarray`, if inputs were all local
`RemoteArray`, if inputs were all on the same remote engine
... | [
"Stack",
"arrays",
"in",
"sequence",
"vertically",
"(",
"row",
"wise",
")",
"handling",
"RemoteArray",
"and",
"DistArray",
"without",
"moving",
"data",
"."
] | mattja/distob | python | https://github.com/mattja/distob/blob/b0fc49e157189932c70231077ed35e1aa5717da9/distob/arrays.py#L1613-L1630 | [
"def",
"vstack",
"(",
"tup",
")",
":",
"# Follow numpy.vstack behavior for 1D arrays:",
"arrays",
"=",
"list",
"(",
"tup",
")",
"for",
"i",
"in",
"range",
"(",
"len",
"(",
"arrays",
")",
")",
":",
"if",
"arrays",
"[",
"i",
"]",
".",
"ndim",
"is",
"1",
... | b0fc49e157189932c70231077ed35e1aa5717da9 |
valid | hstack | Stack arrays in sequence horizontally (column wise),
handling ``RemoteArray`` and ``DistArray`` without moving data.
Args:
tup (sequence of array_like)
Returns:
res: `ndarray`, if inputs were all local
`RemoteArray`, if inputs were all on the same remote engine
`DistArr... | distob/arrays.py | def hstack(tup):
"""Stack arrays in sequence horizontally (column wise),
handling ``RemoteArray`` and ``DistArray`` without moving data.
Args:
tup (sequence of array_like)
Returns:
res: `ndarray`, if inputs were all local
`RemoteArray`, if inputs were all on the same remote en... | def hstack(tup):
"""Stack arrays in sequence horizontally (column wise),
handling ``RemoteArray`` and ``DistArray`` without moving data.
Args:
tup (sequence of array_like)
Returns:
res: `ndarray`, if inputs were all local
`RemoteArray`, if inputs were all on the same remote en... | [
"Stack",
"arrays",
"in",
"sequence",
"horizontally",
"(",
"column",
"wise",
")",
"handling",
"RemoteArray",
"and",
"DistArray",
"without",
"moving",
"data",
"."
] | mattja/distob | python | https://github.com/mattja/distob/blob/b0fc49e157189932c70231077ed35e1aa5717da9/distob/arrays.py#L1633-L1649 | [
"def",
"hstack",
"(",
"tup",
")",
":",
"# Follow numpy.hstack behavior for 1D arrays:",
"if",
"all",
"(",
"ar",
".",
"ndim",
"is",
"1",
"for",
"ar",
"in",
"tup",
")",
":",
"return",
"concatenate",
"(",
"tup",
",",
"axis",
"=",
"0",
")",
"else",
":",
"r... | b0fc49e157189932c70231077ed35e1aa5717da9 |
valid | dstack | Stack arrays in sequence depth wise (along third dimension),
handling ``RemoteArray`` and ``DistArray`` without moving data.
Args:
tup (sequence of array_like)
Returns:
res: `ndarray`, if inputs were all local
`RemoteArray`, if inputs were all on the same remote engine
... | distob/arrays.py | def dstack(tup):
"""Stack arrays in sequence depth wise (along third dimension),
handling ``RemoteArray`` and ``DistArray`` without moving data.
Args:
tup (sequence of array_like)
Returns:
res: `ndarray`, if inputs were all local
`RemoteArray`, if inputs were all on the same r... | def dstack(tup):
"""Stack arrays in sequence depth wise (along third dimension),
handling ``RemoteArray`` and ``DistArray`` without moving data.
Args:
tup (sequence of array_like)
Returns:
res: `ndarray`, if inputs were all local
`RemoteArray`, if inputs were all on the same r... | [
"Stack",
"arrays",
"in",
"sequence",
"depth",
"wise",
"(",
"along",
"third",
"dimension",
")",
"handling",
"RemoteArray",
"and",
"DistArray",
"without",
"moving",
"data",
"."
] | mattja/distob | python | https://github.com/mattja/distob/blob/b0fc49e157189932c70231077ed35e1aa5717da9/distob/arrays.py#L1652-L1671 | [
"def",
"dstack",
"(",
"tup",
")",
":",
"# Follow numpy.dstack behavior for 1D and 2D arrays:",
"arrays",
"=",
"list",
"(",
"tup",
")",
"for",
"i",
"in",
"range",
"(",
"len",
"(",
"arrays",
")",
")",
":",
"if",
"arrays",
"[",
"i",
"]",
".",
"ndim",
"is",
... | b0fc49e157189932c70231077ed35e1aa5717da9 |
valid | _broadcast_shape | Return the shape that would result from broadcasting the inputs | distob/arrays.py | def _broadcast_shape(*args):
"""Return the shape that would result from broadcasting the inputs"""
#TODO: currently incorrect result if a Sequence is provided as an input
shapes = [a.shape if hasattr(type(a), '__array_interface__')
else () for a in args]
ndim = max(len(sh) for sh in shapes... | def _broadcast_shape(*args):
"""Return the shape that would result from broadcasting the inputs"""
#TODO: currently incorrect result if a Sequence is provided as an input
shapes = [a.shape if hasattr(type(a), '__array_interface__')
else () for a in args]
ndim = max(len(sh) for sh in shapes... | [
"Return",
"the",
"shape",
"that",
"would",
"result",
"from",
"broadcasting",
"the",
"inputs"
] | mattja/distob | python | https://github.com/mattja/distob/blob/b0fc49e157189932c70231077ed35e1aa5717da9/distob/arrays.py#L1708-L1717 | [
"def",
"_broadcast_shape",
"(",
"*",
"args",
")",
":",
"#TODO: currently incorrect result if a Sequence is provided as an input",
"shapes",
"=",
"[",
"a",
".",
"shape",
"if",
"hasattr",
"(",
"type",
"(",
"a",
")",
",",
"'__array_interface__'",
")",
"else",
"(",
")... | b0fc49e157189932c70231077ed35e1aa5717da9 |
valid | mean | Compute the arithmetic mean along the specified axis.
Returns the average of the array elements. The average is taken over
the flattened array by default, otherwise over the specified axis.
`float64` intermediate and return values are used for integer inputs.
Parameters
----------
a : array_l... | distob/arrays.py | def mean(a, axis=None, dtype=None, out=None, keepdims=False):
"""
Compute the arithmetic mean along the specified axis.
Returns the average of the array elements. The average is taken over
the flattened array by default, otherwise over the specified axis.
`float64` intermediate and return values a... | def mean(a, axis=None, dtype=None, out=None, keepdims=False):
"""
Compute the arithmetic mean along the specified axis.
Returns the average of the array elements. The average is taken over
the flattened array by default, otherwise over the specified axis.
`float64` intermediate and return values a... | [
"Compute",
"the",
"arithmetic",
"mean",
"along",
"the",
"specified",
"axis",
"."
] | mattja/distob | python | https://github.com/mattja/distob/blob/b0fc49e157189932c70231077ed35e1aa5717da9/distob/arrays.py#L1756-L1802 | [
"def",
"mean",
"(",
"a",
",",
"axis",
"=",
"None",
",",
"dtype",
"=",
"None",
",",
"out",
"=",
"None",
",",
"keepdims",
"=",
"False",
")",
":",
"if",
"(",
"isinstance",
"(",
"a",
",",
"np",
".",
"ndarray",
")",
"or",
"isinstance",
"(",
"a",
","... | b0fc49e157189932c70231077ed35e1aa5717da9 |
valid | DistArray._fetch | forces update of a local cached copy of the real object
(regardless of the preference setting self.cache) | distob/arrays.py | def _fetch(self):
"""forces update of a local cached copy of the real object
(regardless of the preference setting self.cache)"""
if not self._obcache_current:
from distob import engine
ax = self._distaxis
self._obcache = concatenate([ra._ob for ra in self._su... | def _fetch(self):
"""forces update of a local cached copy of the real object
(regardless of the preference setting self.cache)"""
if not self._obcache_current:
from distob import engine
ax = self._distaxis
self._obcache = concatenate([ra._ob for ra in self._su... | [
"forces",
"update",
"of",
"a",
"local",
"cached",
"copy",
"of",
"the",
"real",
"object",
"(",
"regardless",
"of",
"the",
"preference",
"setting",
"self",
".",
"cache",
")"
] | mattja/distob | python | https://github.com/mattja/distob/blob/b0fc49e157189932c70231077ed35e1aa5717da9/distob/arrays.py#L424-L439 | [
"def",
"_fetch",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"_obcache_current",
":",
"from",
"distob",
"import",
"engine",
"ax",
"=",
"self",
".",
"_distaxis",
"self",
".",
"_obcache",
"=",
"concatenate",
"(",
"[",
"ra",
".",
"_ob",
"for",
"ra",
... | b0fc49e157189932c70231077ed35e1aa5717da9 |
valid | DistArray._tosubslices | Maps a slice object for whole array to slice objects for subarrays.
Returns pair (ss, ms) where ss is a list of subarrays and ms is a list
giving the slice object that should be applied to each subarray. | distob/arrays.py | def _tosubslices(self, sl):
"""Maps a slice object for whole array to slice objects for subarrays.
Returns pair (ss, ms) where ss is a list of subarrays and ms is a list
giving the slice object that should be applied to each subarray.
"""
N = self.shape[self._distaxis]
st... | def _tosubslices(self, sl):
"""Maps a slice object for whole array to slice objects for subarrays.
Returns pair (ss, ms) where ss is a list of subarrays and ms is a list
giving the slice object that should be applied to each subarray.
"""
N = self.shape[self._distaxis]
st... | [
"Maps",
"a",
"slice",
"object",
"for",
"whole",
"array",
"to",
"slice",
"objects",
"for",
"subarrays",
".",
"Returns",
"pair",
"(",
"ss",
"ms",
")",
"where",
"ss",
"is",
"a",
"list",
"of",
"subarrays",
"and",
"ms",
"is",
"a",
"list",
"giving",
"the",
... | mattja/distob | python | https://github.com/mattja/distob/blob/b0fc49e157189932c70231077ed35e1aa5717da9/distob/arrays.py#L673-L720 | [
"def",
"_tosubslices",
"(",
"self",
",",
"sl",
")",
":",
"N",
"=",
"self",
".",
"shape",
"[",
"self",
".",
"_distaxis",
"]",
"start",
",",
"stop",
",",
"step",
"=",
"sl",
".",
"start",
",",
"sl",
".",
"stop",
",",
"sl",
".",
"step",
"if",
"step... | b0fc49e157189932c70231077ed35e1aa5717da9 |
valid | DistArray._valid_distaxis | `ax` is a valid candidate for a distributed axis if the given
subarray shapes are all the same when ignoring axis `ax` | distob/arrays.py | def _valid_distaxis(shapes, ax):
"""`ax` is a valid candidate for a distributed axis if the given
subarray shapes are all the same when ignoring axis `ax`"""
compare_shapes = np.vstack(shapes)
if ax < compare_shapes.shape[1]:
compare_shapes[:, ax] = -1
return np.count... | def _valid_distaxis(shapes, ax):
"""`ax` is a valid candidate for a distributed axis if the given
subarray shapes are all the same when ignoring axis `ax`"""
compare_shapes = np.vstack(shapes)
if ax < compare_shapes.shape[1]:
compare_shapes[:, ax] = -1
return np.count... | [
"ax",
"is",
"a",
"valid",
"candidate",
"for",
"a",
"distributed",
"axis",
"if",
"the",
"given",
"subarray",
"shapes",
"are",
"all",
"the",
"same",
"when",
"ignoring",
"axis",
"ax"
] | mattja/distob | python | https://github.com/mattja/distob/blob/b0fc49e157189932c70231077ed35e1aa5717da9/distob/arrays.py#L917-L923 | [
"def",
"_valid_distaxis",
"(",
"shapes",
",",
"ax",
")",
":",
"compare_shapes",
"=",
"np",
".",
"vstack",
"(",
"shapes",
")",
"if",
"ax",
"<",
"compare_shapes",
".",
"shape",
"[",
"1",
"]",
":",
"compare_shapes",
"[",
":",
",",
"ax",
"]",
"=",
"-",
... | b0fc49e157189932c70231077ed35e1aa5717da9 |
valid | DistArray.expand_dims | Insert a new axis, at a given position in the array shape
Args:
axis (int): Position (amongst axes) where new axis is to be inserted. | distob/arrays.py | def expand_dims(self, axis):
"""Insert a new axis, at a given position in the array shape
Args:
axis (int): Position (amongst axes) where new axis is to be inserted.
"""
if axis == -1:
axis = self.ndim
if axis <= self._distaxis:
subaxis = axis
... | def expand_dims(self, axis):
"""Insert a new axis, at a given position in the array shape
Args:
axis (int): Position (amongst axes) where new axis is to be inserted.
"""
if axis == -1:
axis = self.ndim
if axis <= self._distaxis:
subaxis = axis
... | [
"Insert",
"a",
"new",
"axis",
"at",
"a",
"given",
"position",
"in",
"the",
"array",
"shape",
"Args",
":",
"axis",
"(",
"int",
")",
":",
"Position",
"(",
"amongst",
"axes",
")",
"where",
"new",
"axis",
"is",
"to",
"be",
"inserted",
"."
] | mattja/distob | python | https://github.com/mattja/distob/blob/b0fc49e157189932c70231077ed35e1aa5717da9/distob/arrays.py#L1014-L1028 | [
"def",
"expand_dims",
"(",
"self",
",",
"axis",
")",
":",
"if",
"axis",
"==",
"-",
"1",
":",
"axis",
"=",
"self",
".",
"ndim",
"if",
"axis",
"<=",
"self",
".",
"_distaxis",
":",
"subaxis",
"=",
"axis",
"new_distaxis",
"=",
"self",
".",
"_distaxis",
... | b0fc49e157189932c70231077ed35e1aa5717da9 |
valid | DistArray.mean | Compute the arithmetic mean along the specified axis.
See np.mean() for details. | distob/arrays.py | def mean(self, axis=None, dtype=None, out=None, keepdims=False):
"""Compute the arithmetic mean along the specified axis.
See np.mean() for details."""
if axis == -1:
axis = self.ndim
if axis is None:
results = vectorize(mean)(self, axis, dtype, keepdims=False)
... | def mean(self, axis=None, dtype=None, out=None, keepdims=False):
"""Compute the arithmetic mean along the specified axis.
See np.mean() for details."""
if axis == -1:
axis = self.ndim
if axis is None:
results = vectorize(mean)(self, axis, dtype, keepdims=False)
... | [
"Compute",
"the",
"arithmetic",
"mean",
"along",
"the",
"specified",
"axis",
".",
"See",
"np",
".",
"mean",
"()",
"for",
"details",
"."
] | mattja/distob | python | https://github.com/mattja/distob/blob/b0fc49e157189932c70231077ed35e1aa5717da9/distob/arrays.py#L1030-L1062 | [
"def",
"mean",
"(",
"self",
",",
"axis",
"=",
"None",
",",
"dtype",
"=",
"None",
",",
"out",
"=",
"None",
",",
"keepdims",
"=",
"False",
")",
":",
"if",
"axis",
"==",
"-",
"1",
":",
"axis",
"=",
"self",
".",
"ndim",
"if",
"axis",
"is",
"None",
... | b0fc49e157189932c70231077ed35e1aa5717da9 |
valid | run | Returns True if successful, False if failure | cpenv/shell.py | def run(*args, **kwargs):
'''Returns True if successful, False if failure'''
kwargs.setdefault('env', os.environ)
kwargs.setdefault('shell', True)
try:
subprocess.check_call(' '.join(args), **kwargs)
return True
except subprocess.CalledProcessError:
logger.debug('Error runn... | def run(*args, **kwargs):
'''Returns True if successful, False if failure'''
kwargs.setdefault('env', os.environ)
kwargs.setdefault('shell', True)
try:
subprocess.check_call(' '.join(args), **kwargs)
return True
except subprocess.CalledProcessError:
logger.debug('Error runn... | [
"Returns",
"True",
"if",
"successful",
"False",
"if",
"failure"
] | cpenv/cpenv | python | https://github.com/cpenv/cpenv/blob/afbb569ae04002743db041d3629a5be8c290bd89/cpenv/shell.py#L9-L20 | [
"def",
"run",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"kwargs",
".",
"setdefault",
"(",
"'env'",
",",
"os",
".",
"environ",
")",
"kwargs",
".",
"setdefault",
"(",
"'shell'",
",",
"True",
")",
"try",
":",
"subprocess",
".",
"check_call",
... | afbb569ae04002743db041d3629a5be8c290bd89 |
valid | cmd | Return a command to launch a subshell | cpenv/shell.py | def cmd():
'''Return a command to launch a subshell'''
if platform == 'win':
return ['cmd.exe', '/K']
elif platform == 'linux':
ppid = os.getppid()
ppid_cmdline_file = '/proc/{0}/cmdline'.format(ppid)
try:
with open(ppid_cmdline_file) as f:
cmd =... | def cmd():
'''Return a command to launch a subshell'''
if platform == 'win':
return ['cmd.exe', '/K']
elif platform == 'linux':
ppid = os.getppid()
ppid_cmdline_file = '/proc/{0}/cmdline'.format(ppid)
try:
with open(ppid_cmdline_file) as f:
cmd =... | [
"Return",
"a",
"command",
"to",
"launch",
"a",
"subshell"
] | cpenv/cpenv | python | https://github.com/cpenv/cpenv/blob/afbb569ae04002743db041d3629a5be8c290bd89/cpenv/shell.py#L23-L45 | [
"def",
"cmd",
"(",
")",
":",
"if",
"platform",
"==",
"'win'",
":",
"return",
"[",
"'cmd.exe'",
",",
"'/K'",
"]",
"elif",
"platform",
"==",
"'linux'",
":",
"ppid",
"=",
"os",
".",
"getppid",
"(",
")",
"ppid_cmdline_file",
"=",
"'/proc/{0}/cmdline'",
".",
... | afbb569ae04002743db041d3629a5be8c290bd89 |
valid | prompt | Generate a prompt with a given prefix
linux/osx: [prefix] user@host cwd $
win: [prefix] cwd: | cpenv/shell.py | def prompt(prefix=None, colored=True):
'''Generate a prompt with a given prefix
linux/osx: [prefix] user@host cwd $
win: [prefix] cwd:
'''
if platform == 'win':
return '[{0}] $P$G'.format(prefix)
else:
if colored:
return (
'[{0}] ' # White pre... | def prompt(prefix=None, colored=True):
'''Generate a prompt with a given prefix
linux/osx: [prefix] user@host cwd $
win: [prefix] cwd:
'''
if platform == 'win':
return '[{0}] $P$G'.format(prefix)
else:
if colored:
return (
'[{0}] ' # White pre... | [
"Generate",
"a",
"prompt",
"with",
"a",
"given",
"prefix"
] | cpenv/cpenv | python | https://github.com/cpenv/cpenv/blob/afbb569ae04002743db041d3629a5be8c290bd89/cpenv/shell.py#L48-L64 | [
"def",
"prompt",
"(",
"prefix",
"=",
"None",
",",
"colored",
"=",
"True",
")",
":",
"if",
"platform",
"==",
"'win'",
":",
"return",
"'[{0}] $P$G'",
".",
"format",
"(",
"prefix",
")",
"else",
":",
"if",
"colored",
":",
"return",
"(",
"'[{0}] '",
"# Whit... | afbb569ae04002743db041d3629a5be8c290bd89 |
valid | launch | Launch a subshell | cpenv/shell.py | def launch(prompt_prefix=None):
'''Launch a subshell'''
if prompt_prefix:
os.environ['PROMPT'] = prompt(prompt_prefix)
subprocess.call(cmd(), env=os.environ.data) | def launch(prompt_prefix=None):
'''Launch a subshell'''
if prompt_prefix:
os.environ['PROMPT'] = prompt(prompt_prefix)
subprocess.call(cmd(), env=os.environ.data) | [
"Launch",
"a",
"subshell"
] | cpenv/cpenv | python | https://github.com/cpenv/cpenv/blob/afbb569ae04002743db041d3629a5be8c290bd89/cpenv/shell.py#L67-L73 | [
"def",
"launch",
"(",
"prompt_prefix",
"=",
"None",
")",
":",
"if",
"prompt_prefix",
":",
"os",
".",
"environ",
"[",
"'PROMPT'",
"]",
"=",
"prompt",
"(",
"prompt_prefix",
")",
"subprocess",
".",
"call",
"(",
"cmd",
"(",
")",
",",
"env",
"=",
"os",
".... | afbb569ae04002743db041d3629a5be8c290bd89 |
valid | FileModificationMonitor.add_file | Append a file to file repository.
For file monitoring, monitor instance needs file.
Please put the name of file to `file` argument.
:param file: the name of file you want monitor. | mdfmonitor.py | def add_file(self, file, **kwargs):
"""Append a file to file repository.
For file monitoring, monitor instance needs file.
Please put the name of file to `file` argument.
:param file: the name of file you want monitor.
"""
if os.access(file, os.F_OK):
if ... | def add_file(self, file, **kwargs):
"""Append a file to file repository.
For file monitoring, monitor instance needs file.
Please put the name of file to `file` argument.
:param file: the name of file you want monitor.
"""
if os.access(file, os.F_OK):
if ... | [
"Append",
"a",
"file",
"to",
"file",
"repository",
"."
] | alice1017/mdfmonitor | python | https://github.com/alice1017/mdfmonitor/blob/a414ed3d486b92ed31d30e23de823b05b0381f55/mdfmonitor.py#L83-L101 | [
"def",
"add_file",
"(",
"self",
",",
"file",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"os",
".",
"access",
"(",
"file",
",",
"os",
".",
"F_OK",
")",
":",
"if",
"file",
"in",
"self",
".",
"f_repository",
":",
"raise",
"DuplicationError",
"(",
"\"fil... | a414ed3d486b92ed31d30e23de823b05b0381f55 |
valid | FileModificationMonitor.add_files | Append files to file repository.
ModificationMonitor can append files to repository using this.
Please put the list of file names to `filelist` argument.
:param filelist: the list of file nmaes | mdfmonitor.py | def add_files(self, filelist, **kwargs):
"""Append files to file repository.
ModificationMonitor can append files to repository using this.
Please put the list of file names to `filelist` argument.
:param filelist: the list of file nmaes
"""
# check filelist is... | def add_files(self, filelist, **kwargs):
"""Append files to file repository.
ModificationMonitor can append files to repository using this.
Please put the list of file names to `filelist` argument.
:param filelist: the list of file nmaes
"""
# check filelist is... | [
"Append",
"files",
"to",
"file",
"repository",
".",
"ModificationMonitor",
"can",
"append",
"files",
"to",
"repository",
"using",
"this",
".",
"Please",
"put",
"the",
"list",
"of",
"file",
"names",
"to",
"filelist",
"argument",
"."
] | alice1017/mdfmonitor | python | https://github.com/alice1017/mdfmonitor/blob/a414ed3d486b92ed31d30e23de823b05b0381f55/mdfmonitor.py#L104-L118 | [
"def",
"add_files",
"(",
"self",
",",
"filelist",
",",
"*",
"*",
"kwargs",
")",
":",
"# check filelist is list type",
"if",
"not",
"isinstance",
"(",
"filelist",
",",
"list",
")",
":",
"raise",
"TypeError",
"(",
"\"request the list type.\"",
")",
"for",
"file"... | a414ed3d486b92ed31d30e23de823b05b0381f55 |
valid | FileModificationMonitor.monitor | Run file modification monitor.
The monitor can catch file modification using timestamp and file body.
Monitor has timestamp data and file body data. And insert timestamp
data and file body data before into while roop. In while roop, monitor
get new timestamp and file body, and then m... | mdfmonitor.py | def monitor(self, sleep=5):
"""Run file modification monitor.
The monitor can catch file modification using timestamp and file body.
Monitor has timestamp data and file body data. And insert timestamp
data and file body data before into while roop. In while roop, monitor
get ... | def monitor(self, sleep=5):
"""Run file modification monitor.
The monitor can catch file modification using timestamp and file body.
Monitor has timestamp data and file body data. And insert timestamp
data and file body data before into while roop. In while roop, monitor
get ... | [
"Run",
"file",
"modification",
"monitor",
"."
] | alice1017/mdfmonitor | python | https://github.com/alice1017/mdfmonitor/blob/a414ed3d486b92ed31d30e23de823b05b0381f55/mdfmonitor.py#L120-L182 | [
"def",
"monitor",
"(",
"self",
",",
"sleep",
"=",
"5",
")",
":",
"manager",
"=",
"FileModificationObjectManager",
"(",
")",
"timestamps",
"=",
"{",
"}",
"filebodies",
"=",
"{",
"}",
"# register original timestamp and filebody to dict",
"for",
"file",
"in",
"self... | a414ed3d486b92ed31d30e23de823b05b0381f55 |
valid | RestPoints.init_app | Initialize a :class:`~flask.Flask` application for use with
this extension. | flask_restpoints/base.py | def init_app(self, app):
"""Initialize a :class:`~flask.Flask` application for use with
this extension.
"""
self._jobs = []
if not hasattr(app, 'extensions'):
app.extensions = {}
app.extensions['restpoints'] = self
app.restpoints_instance = self
... | def init_app(self, app):
"""Initialize a :class:`~flask.Flask` application for use with
this extension.
"""
self._jobs = []
if not hasattr(app, 'extensions'):
app.extensions = {}
app.extensions['restpoints'] = self
app.restpoints_instance = self
... | [
"Initialize",
"a",
":",
"class",
":",
"~flask",
".",
"Flask",
"application",
"for",
"use",
"with",
"this",
"extension",
"."
] | juztin/flask-restpoints | python | https://github.com/juztin/flask-restpoints/blob/1833e1aeed6139c3b130d4e7497526c78c063a0f/flask_restpoints/base.py#L24-L37 | [
"def",
"init_app",
"(",
"self",
",",
"app",
")",
":",
"self",
".",
"_jobs",
"=",
"[",
"]",
"if",
"not",
"hasattr",
"(",
"app",
",",
"'extensions'",
")",
":",
"app",
".",
"extensions",
"=",
"{",
"}",
"app",
".",
"extensions",
"[",
"'restpoints'",
"]... | 1833e1aeed6139c3b130d4e7497526c78c063a0f |
valid | RestPoints.add_status_job | Adds a job to be included during calls to the `/status` endpoint.
:param job_func: the status function.
:param name: the name used in the JSON response for the given status
function. The name of the function is the default.
:param timeout: the time limit before the job stat... | flask_restpoints/base.py | def add_status_job(self, job_func, name=None, timeout=3):
"""Adds a job to be included during calls to the `/status` endpoint.
:param job_func: the status function.
:param name: the name used in the JSON response for the given status
function. The name of the function is th... | def add_status_job(self, job_func, name=None, timeout=3):
"""Adds a job to be included during calls to the `/status` endpoint.
:param job_func: the status function.
:param name: the name used in the JSON response for the given status
function. The name of the function is th... | [
"Adds",
"a",
"job",
"to",
"be",
"included",
"during",
"calls",
"to",
"the",
"/",
"status",
"endpoint",
"."
] | juztin/flask-restpoints | python | https://github.com/juztin/flask-restpoints/blob/1833e1aeed6139c3b130d4e7497526c78c063a0f/flask_restpoints/base.py#L39-L50 | [
"def",
"add_status_job",
"(",
"self",
",",
"job_func",
",",
"name",
"=",
"None",
",",
"timeout",
"=",
"3",
")",
":",
"job_name",
"=",
"job_func",
".",
"__name__",
"if",
"name",
"is",
"None",
"else",
"name",
"job",
"=",
"(",
"job_name",
",",
"timeout",
... | 1833e1aeed6139c3b130d4e7497526c78c063a0f |
valid | RestPoints.status_job | Decorator that invokes `add_status_job`.
::
@app.status_job
def postgresql():
# query/ping postgres
@app.status_job(name="Active Directory")
def active_directory():
# query active directory
@app.status_job(timeout=5)... | flask_restpoints/base.py | def status_job(self, fn=None, name=None, timeout=3):
"""Decorator that invokes `add_status_job`.
::
@app.status_job
def postgresql():
# query/ping postgres
@app.status_job(name="Active Directory")
def active_directory():
... | def status_job(self, fn=None, name=None, timeout=3):
"""Decorator that invokes `add_status_job`.
::
@app.status_job
def postgresql():
# query/ping postgres
@app.status_job(name="Active Directory")
def active_directory():
... | [
"Decorator",
"that",
"invokes",
"add_status_job",
"."
] | juztin/flask-restpoints | python | https://github.com/juztin/flask-restpoints/blob/1833e1aeed6139c3b130d4e7497526c78c063a0f/flask_restpoints/base.py#L52-L75 | [
"def",
"status_job",
"(",
"self",
",",
"fn",
"=",
"None",
",",
"name",
"=",
"None",
",",
"timeout",
"=",
"3",
")",
":",
"if",
"fn",
"is",
"None",
":",
"def",
"decorator",
"(",
"fn",
")",
":",
"self",
".",
"add_status_job",
"(",
"fn",
",",
"name",... | 1833e1aeed6139c3b130d4e7497526c78c063a0f |
valid | _pipepager | Page through text by feeding it to another program. Invoking a
pager through this might support colors. | cpenv/packages/click/_termui_impl.py | def _pipepager(text, cmd, color):
"""Page through text by feeding it to another program. Invoking a
pager through this might support colors.
"""
import subprocess
env = dict(os.environ)
# If we're piping to less we might support colors under the
# condition that
cmd_detail = cmd.rsplit... | def _pipepager(text, cmd, color):
"""Page through text by feeding it to another program. Invoking a
pager through this might support colors.
"""
import subprocess
env = dict(os.environ)
# If we're piping to less we might support colors under the
# condition that
cmd_detail = cmd.rsplit... | [
"Page",
"through",
"text",
"by",
"feeding",
"it",
"to",
"another",
"program",
".",
"Invoking",
"a",
"pager",
"through",
"this",
"might",
"support",
"colors",
"."
] | cpenv/cpenv | python | https://github.com/cpenv/cpenv/blob/afbb569ae04002743db041d3629a5be8c290bd89/cpenv/packages/click/_termui_impl.py#L302-L346 | [
"def",
"_pipepager",
"(",
"text",
",",
"cmd",
",",
"color",
")",
":",
"import",
"subprocess",
"env",
"=",
"dict",
"(",
"os",
".",
"environ",
")",
"# If we're piping to less we might support colors under the",
"# condition that",
"cmd_detail",
"=",
"cmd",
".",
"rsp... | afbb569ae04002743db041d3629a5be8c290bd89 |
valid | _get_funky | Renvoie une fonction numpy correspondant au nom passé en paramètre,
sinon renvoie la fonction elle-même | pyair/date.py | def _get_funky(func):
"""Renvoie une fonction numpy correspondant au nom passé en paramètre,
sinon renvoie la fonction elle-même"""
if isinstance(func, str):
try:
func = getattr(np, func)
except:
raise NameError("Nom de fonction non comprise")
return func | def _get_funky(func):
"""Renvoie une fonction numpy correspondant au nom passé en paramètre,
sinon renvoie la fonction elle-même"""
if isinstance(func, str):
try:
func = getattr(np, func)
except:
raise NameError("Nom de fonction non comprise")
return func | [
"Renvoie",
"une",
"fonction",
"numpy",
"correspondant",
"au",
"nom",
"passé",
"en",
"paramètre",
"sinon",
"renvoie",
"la",
"fonction",
"elle",
"-",
"même"
] | LionelR/pyair | python | https://github.com/LionelR/pyair/blob/467e8a843ca9f882f8bb2958805b7293591996ad/pyair/date.py#L20-L29 | [
"def",
"_get_funky",
"(",
"func",
")",
":",
"if",
"isinstance",
"(",
"func",
",",
"str",
")",
":",
"try",
":",
"func",
"=",
"getattr",
"(",
"np",
",",
"func",
")",
"except",
":",
"raise",
"NameError",
"(",
"\"Nom de fonction non comprise\"",
")",
"return... | 467e8a843ca9f882f8bb2958805b7293591996ad |
valid | profil_journalier | Calcul du profil journalier
Paramètres:
df: DataFrame de données dont l'index est une série temporelle
(cf module xair par exemple)
func: function permettant le calcul. Soit un nom de fonction numpy ('mean', 'max', ...)
soit la fonction elle-même (np.mean, np.max, ...)
Retourne:
Un ... | pyair/date.py | def profil_journalier(df, func='mean'):
"""
Calcul du profil journalier
Paramètres:
df: DataFrame de données dont l'index est une série temporelle
(cf module xair par exemple)
func: function permettant le calcul. Soit un nom de fonction numpy ('mean', 'max', ...)
soit la fonction el... | def profil_journalier(df, func='mean'):
"""
Calcul du profil journalier
Paramètres:
df: DataFrame de données dont l'index est une série temporelle
(cf module xair par exemple)
func: function permettant le calcul. Soit un nom de fonction numpy ('mean', 'max', ...)
soit la fonction el... | [
"Calcul",
"du",
"profil",
"journalier"
] | LionelR/pyair | python | https://github.com/LionelR/pyair/blob/467e8a843ca9f882f8bb2958805b7293591996ad/pyair/date.py#L32-L47 | [
"def",
"profil_journalier",
"(",
"df",
",",
"func",
"=",
"'mean'",
")",
":",
"func",
"=",
"_get_funky",
"(",
"func",
")",
"res",
"=",
"df",
".",
"groupby",
"(",
"lambda",
"x",
":",
"x",
".",
"hour",
")",
".",
"aggregate",
"(",
"func",
")",
"return"... | 467e8a843ca9f882f8bb2958805b7293591996ad |
valid | profil_hebdo | Calcul du profil journalier
Paramètres:
df: DataFrame de données dont l'index est une série temporelle
(cf module xair par exemple)
func: function permettant le calcul. Soit un nom de fonction numpy ('mean', 'max', ...)
soit la fonction elle-même (np.mean, np.max, ...)
Retourne:
Un ... | pyair/date.py | def profil_hebdo(df, func='mean'):
"""
Calcul du profil journalier
Paramètres:
df: DataFrame de données dont l'index est une série temporelle
(cf module xair par exemple)
func: function permettant le calcul. Soit un nom de fonction numpy ('mean', 'max', ...)
soit la fonction elle-mê... | def profil_hebdo(df, func='mean'):
"""
Calcul du profil journalier
Paramètres:
df: DataFrame de données dont l'index est une série temporelle
(cf module xair par exemple)
func: function permettant le calcul. Soit un nom de fonction numpy ('mean', 'max', ...)
soit la fonction elle-mê... | [
"Calcul",
"du",
"profil",
"journalier"
] | LionelR/pyair | python | https://github.com/LionelR/pyair/blob/467e8a843ca9f882f8bb2958805b7293591996ad/pyair/date.py#L50-L67 | [
"def",
"profil_hebdo",
"(",
"df",
",",
"func",
"=",
"'mean'",
")",
":",
"func",
"=",
"_get_funky",
"(",
"func",
")",
"res",
"=",
"df",
".",
"groupby",
"(",
"lambda",
"x",
":",
"x",
".",
"weekday",
")",
".",
"aggregate",
"(",
"func",
")",
"# On met ... | 467e8a843ca9f882f8bb2958805b7293591996ad |
valid | profil_annuel | Calcul du profil annuel
Paramètres:
df: DataFrame de données dont l'index est une série temporelle
(cf module xair par exemple)
func: function permettant le calcul. Soit un nom de fonction numpy ('mean', 'max', ...)
soit la fonction elle-même (np.mean, np.max, ...)
Retourne:
Un Data... | pyair/date.py | def profil_annuel(df, func='mean'):
"""
Calcul du profil annuel
Paramètres:
df: DataFrame de données dont l'index est une série temporelle
(cf module xair par exemple)
func: function permettant le calcul. Soit un nom de fonction numpy ('mean', 'max', ...)
soit la fonction elle-même ... | def profil_annuel(df, func='mean'):
"""
Calcul du profil annuel
Paramètres:
df: DataFrame de données dont l'index est une série temporelle
(cf module xair par exemple)
func: function permettant le calcul. Soit un nom de fonction numpy ('mean', 'max', ...)
soit la fonction elle-même ... | [
"Calcul",
"du",
"profil",
"annuel"
] | LionelR/pyair | python | https://github.com/LionelR/pyair/blob/467e8a843ca9f882f8bb2958805b7293591996ad/pyair/date.py#L70-L87 | [
"def",
"profil_annuel",
"(",
"df",
",",
"func",
"=",
"'mean'",
")",
":",
"func",
"=",
"_get_funky",
"(",
"func",
")",
"res",
"=",
"df",
".",
"groupby",
"(",
"lambda",
"x",
":",
"x",
".",
"month",
")",
".",
"aggregate",
"(",
"func",
")",
"# On met d... | 467e8a843ca9f882f8bb2958805b7293591996ad |
valid | to_date | Transforme un champ date vers un objet python datetime
Paramètres:
date:
- si None, renvoie la date du jour
- si de type str, renvoie un objet python datetime
- si de type datetime, le retourne sans modification
dayfirst: Si True, aide l'analyse du champ date de type str en informant... | pyair/xair.py | def to_date(date, dayfirst=False, format=None):
"""
Transforme un champ date vers un objet python datetime
Paramètres:
date:
- si None, renvoie la date du jour
- si de type str, renvoie un objet python datetime
- si de type datetime, le retourne sans modification
dayfirst: Si... | def to_date(date, dayfirst=False, format=None):
"""
Transforme un champ date vers un objet python datetime
Paramètres:
date:
- si None, renvoie la date du jour
- si de type str, renvoie un objet python datetime
- si de type datetime, le retourne sans modification
dayfirst: Si... | [
"Transforme",
"un",
"champ",
"date",
"vers",
"un",
"objet",
"python",
"datetime",
"Paramètres",
":",
"date",
":",
"-",
"si",
"None",
"renvoie",
"la",
"date",
"du",
"jour",
"-",
"si",
"de",
"type",
"str",
"renvoie",
"un",
"objet",
"python",
"datetime",
"-... | LionelR/pyair | python | https://github.com/LionelR/pyair/blob/467e8a843ca9f882f8bb2958805b7293591996ad/pyair/xair.py#L44-L70 | [
"def",
"to_date",
"(",
"date",
",",
"dayfirst",
"=",
"False",
",",
"format",
"=",
"None",
")",
":",
"## TODO: voir si pd.tseries.api ne peut pas remplacer tout ca",
"if",
"not",
"date",
":",
"return",
"dt",
".",
"datetime",
".",
"fromordinal",
"(",
"dt",
".",
... | 467e8a843ca9f882f8bb2958805b7293591996ad |
valid | _format | Formate une donnée d'entrée pour être exploitable dans les fonctions liste_*
et get_*.
Paramètres:
noms: chaîne de caractère, liste ou tuples de chaînes de caractères ou
pandas.Series de chaînes de caractères.
Retourne:
Une chaînes de caractères dont chaque élément est séparé du suivant par le... | pyair/xair.py | def _format(noms):
"""
Formate une donnée d'entrée pour être exploitable dans les fonctions liste_*
et get_*.
Paramètres:
noms: chaîne de caractère, liste ou tuples de chaînes de caractères ou
pandas.Series de chaînes de caractères.
Retourne:
Une chaînes de caractères dont chaque éléme... | def _format(noms):
"""
Formate une donnée d'entrée pour être exploitable dans les fonctions liste_*
et get_*.
Paramètres:
noms: chaîne de caractère, liste ou tuples de chaînes de caractères ou
pandas.Series de chaînes de caractères.
Retourne:
Une chaînes de caractères dont chaque éléme... | [
"Formate",
"une",
"donnée",
"d",
"entrée",
"pour",
"être",
"exploitable",
"dans",
"les",
"fonctions",
"liste_",
"*",
"et",
"get_",
"*",
"."
] | LionelR/pyair | python | https://github.com/LionelR/pyair/blob/467e8a843ca9f882f8bb2958805b7293591996ad/pyair/xair.py#L73-L90 | [
"def",
"_format",
"(",
"noms",
")",
":",
"if",
"isinstance",
"(",
"noms",
",",
"(",
"list",
",",
"tuple",
",",
"pd",
".",
"Series",
")",
")",
":",
"noms",
"=",
"','",
".",
"join",
"(",
"noms",
")",
"noms",
"=",
"noms",
".",
"replace",
"(",
"\",... | 467e8a843ca9f882f8bb2958805b7293591996ad |
valid | date_range | Génère une liste de date en tenant compte des heures de début et fin d'une journée.
La date de début sera toujours calée à 0h, et celle de fin à 23h
Paramètres:
debut: datetime représentant la date de début
fin: datetime représentant la date de fin
freq: freq de temps. Valeurs possibles : T (minute... | pyair/xair.py | def date_range(debut, fin, freq):
"""
Génère une liste de date en tenant compte des heures de début et fin d'une journée.
La date de début sera toujours calée à 0h, et celle de fin à 23h
Paramètres:
debut: datetime représentant la date de début
fin: datetime représentant la date de fin
freq... | def date_range(debut, fin, freq):
"""
Génère une liste de date en tenant compte des heures de début et fin d'une journée.
La date de début sera toujours calée à 0h, et celle de fin à 23h
Paramètres:
debut: datetime représentant la date de début
fin: datetime représentant la date de fin
freq... | [
"Génère",
"une",
"liste",
"de",
"date",
"en",
"tenant",
"compte",
"des",
"heures",
"de",
"début",
"et",
"fin",
"d",
"une",
"journée",
".",
"La",
"date",
"de",
"début",
"sera",
"toujours",
"calée",
"à",
"0h",
"et",
"celle",
"de",
"fin",
"à",
"23h"
] | LionelR/pyair | python | https://github.com/LionelR/pyair/blob/467e8a843ca9f882f8bb2958805b7293591996ad/pyair/xair.py#L93-L113 | [
"def",
"date_range",
"(",
"debut",
",",
"fin",
",",
"freq",
")",
":",
"debut_dt",
"=",
"debut",
".",
"replace",
"(",
"hour",
"=",
"0",
",",
"minute",
"=",
"0",
",",
"second",
"=",
"0",
",",
"microsecond",
"=",
"0",
")",
"fin_dt",
"=",
"fin",
".",... | 467e8a843ca9f882f8bb2958805b7293591996ad |
valid | XAIR._connect | Connexion à la base XAIR | pyair/xair.py | def _connect(self):
"""
Connexion à la base XAIR
"""
try:
# On passe par Oracle Instant Client avec le TNS ORA_FULL
self.conn = cx_Oracle.connect(self._ORA_FULL)
self.cursor = self.conn.cursor()
print('XAIR: Connexion établie')
exc... | def _connect(self):
"""
Connexion à la base XAIR
"""
try:
# On passe par Oracle Instant Client avec le TNS ORA_FULL
self.conn = cx_Oracle.connect(self._ORA_FULL)
self.cursor = self.conn.cursor()
print('XAIR: Connexion établie')
exc... | [
"Connexion",
"à",
"la",
"base",
"XAIR"
] | LionelR/pyair | python | https://github.com/LionelR/pyair/blob/467e8a843ca9f882f8bb2958805b7293591996ad/pyair/xair.py#L132-L144 | [
"def",
"_connect",
"(",
"self",
")",
":",
"try",
":",
"# On passe par Oracle Instant Client avec le TNS ORA_FULL",
"self",
".",
"conn",
"=",
"cx_Oracle",
".",
"connect",
"(",
"self",
".",
"_ORA_FULL",
")",
"self",
".",
"cursor",
"=",
"self",
".",
"conn",
".",
... | 467e8a843ca9f882f8bb2958805b7293591996ad |
valid | XAIR.liste_parametres | Liste des paramètres
Paramètres:
parametre: si fourni, retourne l'entrée pour ce parametre uniquement | pyair/xair.py | def liste_parametres(self, parametre=None):
"""
Liste des paramètres
Paramètres:
parametre: si fourni, retourne l'entrée pour ce parametre uniquement
"""
condition = ""
if parametre:
condition = "WHERE CCHIM='%s'" % parametre
_sql = """SELECT... | def liste_parametres(self, parametre=None):
"""
Liste des paramètres
Paramètres:
parametre: si fourni, retourne l'entrée pour ce parametre uniquement
"""
condition = ""
if parametre:
condition = "WHERE CCHIM='%s'" % parametre
_sql = """SELECT... | [
"Liste",
"des",
"paramètres"
] | LionelR/pyair | python | https://github.com/LionelR/pyair/blob/467e8a843ca9f882f8bb2958805b7293591996ad/pyair/xair.py#L160-L175 | [
"def",
"liste_parametres",
"(",
"self",
",",
"parametre",
"=",
"None",
")",
":",
"condition",
"=",
"\"\"",
"if",
"parametre",
":",
"condition",
"=",
"\"WHERE CCHIM='%s'\"",
"%",
"parametre",
"_sql",
"=",
"\"\"\"SELECT CCHIM AS PARAMETRE,\n NCON AS LIBELLE,\n ... | 467e8a843ca9f882f8bb2958805b7293591996ad |
valid | XAIR.liste_mesures | Décrit les mesures:
- d'un ou des reseaux,
- d'une ou des stations,
- d'un ou des parametres
ou décrit une (des) mesures suivant son (leur) identifiant(s)
Chaque attribut peut être étendu en rajoutant des noms séparés par des
virgules ou en les mettant dans une liste/tupl... | pyair/xair.py | def liste_mesures(self, reseau=None, station=None, parametre=None, mesure=None):
"""
Décrit les mesures:
- d'un ou des reseaux,
- d'une ou des stations,
- d'un ou des parametres
ou décrit une (des) mesures suivant son (leur) identifiant(s)
Chaque attribut peut êtr... | def liste_mesures(self, reseau=None, station=None, parametre=None, mesure=None):
"""
Décrit les mesures:
- d'un ou des reseaux,
- d'une ou des stations,
- d'un ou des parametres
ou décrit une (des) mesures suivant son (leur) identifiant(s)
Chaque attribut peut êtr... | [
"Décrit",
"les",
"mesures",
":",
"-",
"d",
"un",
"ou",
"des",
"reseaux",
"-",
"d",
"une",
"ou",
"des",
"stations",
"-",
"d",
"un",
"ou",
"des",
"parametres",
"ou",
"décrit",
"une",
"(",
"des",
")",
"mesures",
"suivant",
"son",
"(",
"leur",
")",
"id... | LionelR/pyair | python | https://github.com/LionelR/pyair/blob/467e8a843ca9f882f8bb2958805b7293591996ad/pyair/xair.py#L177-L235 | [
"def",
"liste_mesures",
"(",
"self",
",",
"reseau",
"=",
"None",
",",
"station",
"=",
"None",
",",
"parametre",
"=",
"None",
",",
"mesure",
"=",
"None",
")",
":",
"tbreseau",
"=",
"\"\"",
"conditions",
"=",
"[",
"]",
"if",
"reseau",
":",
"reseau",
"=... | 467e8a843ca9f882f8bb2958805b7293591996ad |
valid | XAIR.liste_stations | Liste des stations
Paramètres:
station : un nom de station valide (si vide, liste toutes les stations)
detail : si True, affiche plus de détail sur la (les) station(s). | pyair/xair.py | def liste_stations(self, station=None, detail=False):
"""
Liste des stations
Paramètres:
station : un nom de station valide (si vide, liste toutes les stations)
detail : si True, affiche plus de détail sur la (les) station(s).
"""
condition = ""
if stati... | def liste_stations(self, station=None, detail=False):
"""
Liste des stations
Paramètres:
station : un nom de station valide (si vide, liste toutes les stations)
detail : si True, affiche plus de détail sur la (les) station(s).
"""
condition = ""
if stati... | [
"Liste",
"des",
"stations"
] | LionelR/pyair | python | https://github.com/LionelR/pyair/blob/467e8a843ca9f882f8bb2958805b7293591996ad/pyair/xair.py#L249-L282 | [
"def",
"liste_stations",
"(",
"self",
",",
"station",
"=",
"None",
",",
"detail",
"=",
"False",
")",
":",
"condition",
"=",
"\"\"",
"if",
"station",
":",
"station",
"=",
"_format",
"(",
"station",
")",
"condition",
"=",
"\"WHERE IDENTIFIANT IN ('%s')\"",
"%"... | 467e8a843ca9f882f8bb2958805b7293591996ad |
valid | XAIR.liste_campagnes | Liste des campagnes de mesure et des stations associées
Paramètres:
campagne: Si définie, liste des stations que pour cette campagne | pyair/xair.py | def liste_campagnes(self, campagne=None):
"""
Liste des campagnes de mesure et des stations associées
Paramètres:
campagne: Si définie, liste des stations que pour cette campagne
"""
condition = ""
if campagne:
condition = "WHERE NOM_COURT_CM='%s' "... | def liste_campagnes(self, campagne=None):
"""
Liste des campagnes de mesure et des stations associées
Paramètres:
campagne: Si définie, liste des stations que pour cette campagne
"""
condition = ""
if campagne:
condition = "WHERE NOM_COURT_CM='%s' "... | [
"Liste",
"des",
"campagnes",
"de",
"mesure",
"et",
"des",
"stations",
"associées"
] | LionelR/pyair | python | https://github.com/LionelR/pyair/blob/467e8a843ca9f882f8bb2958805b7293591996ad/pyair/xair.py#L293-L315 | [
"def",
"liste_campagnes",
"(",
"self",
",",
"campagne",
"=",
"None",
")",
":",
"condition",
"=",
"\"\"",
"if",
"campagne",
":",
"condition",
"=",
"\"WHERE NOM_COURT_CM='%s' \"",
"\"\"",
"%",
"campagne",
"_sql",
"=",
"\"\"\"SELECT\n NOM_COURT_CM AS CAMPAGNE,\n ... | 467e8a843ca9f882f8bb2958805b7293591996ad |
valid | XAIR.get_mesures | Récupération des données de mesure.
Paramètres:
mes: Un nom de mesure ou plusieurs séparées par des virgules, une liste
(list, tuple, pandas.Series) de noms
debut: Chaine de caractère ou objet datetime décrivant la date de début.
Défaut=date du jour
fin: Chaine d... | pyair/xair.py | def get_mesures(self, mes, debut=None, fin=None, freq='H', format=None,
dayfirst=False, brut=False):
"""
Récupération des données de mesure.
Paramètres:
mes: Un nom de mesure ou plusieurs séparées par des virgules, une liste
(list, tuple, pandas.Series) d... | def get_mesures(self, mes, debut=None, fin=None, freq='H', format=None,
dayfirst=False, brut=False):
"""
Récupération des données de mesure.
Paramètres:
mes: Un nom de mesure ou plusieurs séparées par des virgules, une liste
(list, tuple, pandas.Series) d... | [
"Récupération",
"des",
"données",
"de",
"mesure",
"."
] | LionelR/pyair | python | https://github.com/LionelR/pyair/blob/467e8a843ca9f882f8bb2958805b7293591996ad/pyair/xair.py#L328-L517 | [
"def",
"get_mesures",
"(",
"self",
",",
"mes",
",",
"debut",
"=",
"None",
",",
"fin",
"=",
"None",
",",
"freq",
"=",
"'H'",
",",
"format",
"=",
"None",
",",
"dayfirst",
"=",
"False",
",",
"brut",
"=",
"False",
")",
":",
"def",
"create_index",
"(",
... | 467e8a843ca9f882f8bb2958805b7293591996ad |
valid | XAIR.get_manuelles | Recupération des mesures manuelles (labo) pour un site
site: numéro du site (voir fonction liste_sites_prelevement)
code_parametre: code ISO du paramètre à rechercher (C6H6=V4)
debut: date de début du premier prélèvement
fin: date de fin du dernier prélèvement
court: Renvoie un ... | pyair/xair.py | def get_manuelles(self, site, code_parametre, debut, fin, court=False):
"""
Recupération des mesures manuelles (labo) pour un site
site: numéro du site (voir fonction liste_sites_prelevement)
code_parametre: code ISO du paramètre à rechercher (C6H6=V4)
debut: date de début du pr... | def get_manuelles(self, site, code_parametre, debut, fin, court=False):
"""
Recupération des mesures manuelles (labo) pour un site
site: numéro du site (voir fonction liste_sites_prelevement)
code_parametre: code ISO du paramètre à rechercher (C6H6=V4)
debut: date de début du pr... | [
"Recupération",
"des",
"mesures",
"manuelles",
"(",
"labo",
")",
"pour",
"un",
"site"
] | LionelR/pyair | python | https://github.com/LionelR/pyair/blob/467e8a843ca9f882f8bb2958805b7293591996ad/pyair/xair.py#L519-L570 | [
"def",
"get_manuelles",
"(",
"self",
",",
"site",
",",
"code_parametre",
",",
"debut",
",",
"fin",
",",
"court",
"=",
"False",
")",
":",
"condition",
"=",
"\"WHERE MESLA.NOPOL='%s' \"",
"%",
"code_parametre",
"condition",
"+=",
"\"AND SITMETH.NSIT=%s \"",
"%",
"... | 467e8a843ca9f882f8bb2958805b7293591996ad |
valid | XAIR.get_indices | Récupération des indices ATMO pour un réseau donné.
Paramètres:
res : Nom du ou des réseaux à chercher (str, list, pandas.Series)
debut: date de début, format YYYY-MM-JJ (str)
fin: Date de fin, format YYYY-MM-JJ (str) | pyair/xair.py | def get_indices(self, res, debut, fin):
"""
Récupération des indices ATMO pour un réseau donné.
Paramètres:
res : Nom du ou des réseaux à chercher (str, list, pandas.Series)
debut: date de début, format YYYY-MM-JJ (str)
fin: Date de fin, format YYYY-MM-JJ (str)
... | def get_indices(self, res, debut, fin):
"""
Récupération des indices ATMO pour un réseau donné.
Paramètres:
res : Nom du ou des réseaux à chercher (str, list, pandas.Series)
debut: date de début, format YYYY-MM-JJ (str)
fin: Date de fin, format YYYY-MM-JJ (str)
... | [
"Récupération",
"des",
"indices",
"ATMO",
"pour",
"un",
"réseau",
"donné",
"."
] | LionelR/pyair | python | https://github.com/LionelR/pyair/blob/467e8a843ca9f882f8bb2958805b7293591996ad/pyair/xair.py#L572-L598 | [
"def",
"get_indices",
"(",
"self",
",",
"res",
",",
"debut",
",",
"fin",
")",
":",
"res",
"=",
"_format",
"(",
"res",
")",
"_sql",
"=",
"\"\"\"SELECT\n J_DATE AS \"date\",\n NOM_AGGLO AS \"reseau\",\n C_IND_CALCULE AS \"indice\"\n FROM RESULTAT_IND... | 467e8a843ca9f882f8bb2958805b7293591996ad |
valid | XAIR.get_indices_et_ssi | Renvoie l'indice et les sous_indices
complet: renvoyer les complets ou les prévus
reseau: nom du réseau à renvoyer
debut: date de début à renvoyer
fin: date de fin à renvoyer
Renvoi : reseau, date, Indice, sous_ind NO2,PM10,O3,SO2 | pyair/xair.py | def get_indices_et_ssi(self, reseau, debut, fin, complet=True):
"""Renvoie l'indice et les sous_indices
complet: renvoyer les complets ou les prévus
reseau: nom du réseau à renvoyer
debut: date de début à renvoyer
fin: date de fin à renvoyer
Renvoi : reseau, date, Indice... | def get_indices_et_ssi(self, reseau, debut, fin, complet=True):
"""Renvoie l'indice et les sous_indices
complet: renvoyer les complets ou les prévus
reseau: nom du réseau à renvoyer
debut: date de début à renvoyer
fin: date de fin à renvoyer
Renvoi : reseau, date, Indice... | [
"Renvoie",
"l",
"indice",
"et",
"les",
"sous_indices",
"complet",
":",
"renvoyer",
"les",
"complets",
"ou",
"les",
"prévus",
"reseau",
":",
"nom",
"du",
"réseau",
"à",
"renvoyer",
"debut",
":",
"date",
"de",
"début",
"à",
"renvoyer",
"fin",
":",
"date",
... | LionelR/pyair | python | https://github.com/LionelR/pyair/blob/467e8a843ca9f882f8bb2958805b7293591996ad/pyair/xair.py#L600-L638 | [
"def",
"get_indices_et_ssi",
"(",
"self",
",",
"reseau",
",",
"debut",
",",
"fin",
",",
"complet",
"=",
"True",
")",
":",
"if",
"complet",
":",
"i_str",
"=",
"\"c_ind_diffuse\"",
"ssi_str",
"=",
"\"c_ss_indice\"",
"else",
":",
"i_str",
"=",
"\"p_ind_diffuse\... | 467e8a843ca9f882f8bb2958805b7293591996ad |
valid | XAIR.get_sqltext | retourne les requêtes actuellement lancées sur le serveur | pyair/xair.py | def get_sqltext(self, format_=1):
"""retourne les requêtes actuellement lancées sur le serveur"""
if format_ == 1:
_sql = """SELECT u.sid, substr(u.username,1,12) user_name, s.sql_text
FROM v$sql s,v$session u
WHERE s.hash_value = u.sql_hash_value
AND sql... | def get_sqltext(self, format_=1):
"""retourne les requêtes actuellement lancées sur le serveur"""
if format_ == 1:
_sql = """SELECT u.sid, substr(u.username,1,12) user_name, s.sql_text
FROM v$sql s,v$session u
WHERE s.hash_value = u.sql_hash_value
AND sql... | [
"retourne",
"les",
"requêtes",
"actuellement",
"lancées",
"sur",
"le",
"serveur"
] | LionelR/pyair | python | https://github.com/LionelR/pyair/blob/467e8a843ca9f882f8bb2958805b7293591996ad/pyair/xair.py#L640-L659 | [
"def",
"get_sqltext",
"(",
"self",
",",
"format_",
"=",
"1",
")",
":",
"if",
"format_",
"==",
"1",
":",
"_sql",
"=",
"\"\"\"SELECT u.sid, substr(u.username,1,12) user_name, s.sql_text\n FROM v$sql s,v$session u\n WHERE s.hash_value = u.sql_hash_value\n ... | 467e8a843ca9f882f8bb2958805b7293591996ad |
valid | run_global_hook | Attempt to run a global hook by name with args | cpenv/hooks.py | def run_global_hook(hook_name, *args):
'''Attempt to run a global hook by name with args'''
hook_finder = HookFinder(get_global_hook_path())
hook = hook_finder(hook_name)
if hook:
hook.run(*args) | def run_global_hook(hook_name, *args):
'''Attempt to run a global hook by name with args'''
hook_finder = HookFinder(get_global_hook_path())
hook = hook_finder(hook_name)
if hook:
hook.run(*args) | [
"Attempt",
"to",
"run",
"a",
"global",
"hook",
"by",
"name",
"with",
"args"
] | cpenv/cpenv | python | https://github.com/cpenv/cpenv/blob/afbb569ae04002743db041d3629a5be8c290bd89/cpenv/hooks.py#L64-L70 | [
"def",
"run_global_hook",
"(",
"hook_name",
",",
"*",
"args",
")",
":",
"hook_finder",
"=",
"HookFinder",
"(",
"get_global_hook_path",
"(",
")",
")",
"hook",
"=",
"hook_finder",
"(",
"hook_name",
")",
"if",
"hook",
":",
"hook",
".",
"run",
"(",
"*",
"arg... | afbb569ae04002743db041d3629a5be8c290bd89 |
valid | status | Handler that calls each status job in a worker pool, attempting to timeout.
The resulting durations/errors are written to the response
as JSON.
eg.
`{
"endpoints": [
{ "endpoint": "Jenny's Database", "duration": 1.002556324005127 },
{ "endpoint": "Hotmail", "duration": ... | flask_restpoints/handlers.py | def status(jobs):
"""Handler that calls each status job in a worker pool, attempting to timeout.
The resulting durations/errors are written to the response
as JSON.
eg.
`{
"endpoints": [
{ "endpoint": "Jenny's Database", "duration": 1.002556324005127 },
{ "endpoint"... | def status(jobs):
"""Handler that calls each status job in a worker pool, attempting to timeout.
The resulting durations/errors are written to the response
as JSON.
eg.
`{
"endpoints": [
{ "endpoint": "Jenny's Database", "duration": 1.002556324005127 },
{ "endpoint"... | [
"Handler",
"that",
"calls",
"each",
"status",
"job",
"in",
"a",
"worker",
"pool",
"attempting",
"to",
"timeout",
".",
"The",
"resulting",
"durations",
"/",
"errors",
"are",
"written",
"to",
"the",
"response",
"as",
"JSON",
"."
] | juztin/flask-restpoints | python | https://github.com/juztin/flask-restpoints/blob/1833e1aeed6139c3b130d4e7497526c78c063a0f/flask_restpoints/handlers.py#L8-L58 | [
"def",
"status",
"(",
"jobs",
")",
":",
"def",
"status_handler",
"(",
")",
":",
"endpoints",
"=",
"[",
"]",
"stats",
"=",
"{",
"\"endpoints\"",
":",
"None",
"}",
"executor",
"=",
"concurrent",
".",
"futures",
".",
"ThreadPoolExecutor",
"(",
"max_workers",
... | 1833e1aeed6139c3b130d4e7497526c78c063a0f |
valid | moyennes_glissantes | Calcule de moyennes glissantes
Paramètres:
df: DataFrame de mesures sur lequel appliqué le calcul
sur: (int, par défaut 8) Nombre d'observations sur lequel s'appuiera le
calcul
rep: (float, défaut 0.75) Taux de réprésentativité en dessous duquel le
calcul renverra NaN
Retourne:
Un Data... | pyair/reg.py | def moyennes_glissantes(df, sur=8, rep=0.75):
"""
Calcule de moyennes glissantes
Paramètres:
df: DataFrame de mesures sur lequel appliqué le calcul
sur: (int, par défaut 8) Nombre d'observations sur lequel s'appuiera le
calcul
rep: (float, défaut 0.75) Taux de réprésentativité en dessous du... | def moyennes_glissantes(df, sur=8, rep=0.75):
"""
Calcule de moyennes glissantes
Paramètres:
df: DataFrame de mesures sur lequel appliqué le calcul
sur: (int, par défaut 8) Nombre d'observations sur lequel s'appuiera le
calcul
rep: (float, défaut 0.75) Taux de réprésentativité en dessous du... | [
"Calcule",
"de",
"moyennes",
"glissantes"
] | LionelR/pyair | python | https://github.com/LionelR/pyair/blob/467e8a843ca9f882f8bb2958805b7293591996ad/pyair/reg.py#L23-L37 | [
"def",
"moyennes_glissantes",
"(",
"df",
",",
"sur",
"=",
"8",
",",
"rep",
"=",
"0.75",
")",
":",
"return",
"pd",
".",
"rolling_mean",
"(",
"df",
",",
"window",
"=",
"sur",
",",
"min_periods",
"=",
"rep",
"*",
"sur",
")"
] | 467e8a843ca9f882f8bb2958805b7293591996ad |
valid | consecutive | Calcule si une valeur est dépassée durant une période donnée. Détecte
un dépassement de valeur sur X heures/jours/... consécutifs
Paramètres:
df: DataFrame de mesures sur lequel appliqué le calcul
valeur: (float) valeur à chercher le dépassement (strictement supérieur à)
sur: (int) Nombre d'observa... | pyair/reg.py | def consecutive(df, valeur, sur=3):
"""Calcule si une valeur est dépassée durant une période donnée. Détecte
un dépassement de valeur sur X heures/jours/... consécutifs
Paramètres:
df: DataFrame de mesures sur lequel appliqué le calcul
valeur: (float) valeur à chercher le dépassement (strictement s... | def consecutive(df, valeur, sur=3):
"""Calcule si une valeur est dépassée durant une période donnée. Détecte
un dépassement de valeur sur X heures/jours/... consécutifs
Paramètres:
df: DataFrame de mesures sur lequel appliqué le calcul
valeur: (float) valeur à chercher le dépassement (strictement s... | [
"Calcule",
"si",
"une",
"valeur",
"est",
"dépassée",
"durant",
"une",
"période",
"donnée",
".",
"Détecte",
"un",
"dépassement",
"de",
"valeur",
"sur",
"X",
"heures",
"/",
"jours",
"/",
"...",
"consécutifs"
] | LionelR/pyair | python | https://github.com/LionelR/pyair/blob/467e8a843ca9f882f8bb2958805b7293591996ad/pyair/reg.py#L40-L57 | [
"def",
"consecutive",
"(",
"df",
",",
"valeur",
",",
"sur",
"=",
"3",
")",
":",
"dep",
"=",
"pd",
".",
"rolling_max",
"(",
"df",
".",
"where",
"(",
"df",
">",
"valeur",
")",
",",
"window",
"=",
"sur",
",",
"min_periods",
"=",
"sur",
")",
"return"... | 467e8a843ca9f882f8bb2958805b7293591996ad |
valid | nombre_depassement | Calcule le nombre de dépassement d'une valeur sur l'intégralité du temps,
ou suivant un regroupement temporel.
Paramètres:
df: DataFrame de mesures sur lequel appliqué le calcul
valeur: (float) valeur à chercher le dépassement (strictement supérieur à)
freq: (str ou None): Fréquence de temps sur le... | pyair/reg.py | def nombre_depassement(df, valeur, freq=None):
"""
Calcule le nombre de dépassement d'une valeur sur l'intégralité du temps,
ou suivant un regroupement temporel.
Paramètres:
df: DataFrame de mesures sur lequel appliqué le calcul
valeur: (float) valeur à chercher le dépassement (strictement supé... | def nombre_depassement(df, valeur, freq=None):
"""
Calcule le nombre de dépassement d'une valeur sur l'intégralité du temps,
ou suivant un regroupement temporel.
Paramètres:
df: DataFrame de mesures sur lequel appliqué le calcul
valeur: (float) valeur à chercher le dépassement (strictement supé... | [
"Calcule",
"le",
"nombre",
"de",
"dépassement",
"d",
"une",
"valeur",
"sur",
"l",
"intégralité",
"du",
"temps",
"ou",
"suivant",
"un",
"regroupement",
"temporel",
"."
] | LionelR/pyair | python | https://github.com/LionelR/pyair/blob/467e8a843ca9f882f8bb2958805b7293591996ad/pyair/reg.py#L77-L98 | [
"def",
"nombre_depassement",
"(",
"df",
",",
"valeur",
",",
"freq",
"=",
"None",
")",
":",
"dep",
"=",
"depassement",
"(",
"df",
",",
"valeur",
")",
"if",
"freq",
"is",
"not",
"None",
":",
"dep",
"=",
"dep",
".",
"resample",
"(",
"freq",
",",
"how"... | 467e8a843ca9f882f8bb2958805b7293591996ad |
valid | aot40_vegetation | Calcul de l'AOT40 du 1er mai au 31 juillet
*AOT40 : AOT 40 ( exprimé en micro g/m³ par heure ) signifie la somme des
différences entre les concentrations horaires supérieures à 40 parties par
milliard ( 40 ppb soit 80 micro g/m³ ), durant une période donnée en
utilisant uniquement les valeurs sur 1 heu... | pyair/reg.py | def aot40_vegetation(df, nb_an):
"""
Calcul de l'AOT40 du 1er mai au 31 juillet
*AOT40 : AOT 40 ( exprimé en micro g/m³ par heure ) signifie la somme des
différences entre les concentrations horaires supérieures à 40 parties par
milliard ( 40 ppb soit 80 micro g/m³ ), durant une période donnée en
... | def aot40_vegetation(df, nb_an):
"""
Calcul de l'AOT40 du 1er mai au 31 juillet
*AOT40 : AOT 40 ( exprimé en micro g/m³ par heure ) signifie la somme des
différences entre les concentrations horaires supérieures à 40 parties par
milliard ( 40 ppb soit 80 micro g/m³ ), durant une période donnée en
... | [
"Calcul",
"de",
"l",
"AOT40",
"du",
"1er",
"mai",
"au",
"31",
"juillet"
] | LionelR/pyair | python | https://github.com/LionelR/pyair/blob/467e8a843ca9f882f8bb2958805b7293591996ad/pyair/reg.py#L101-L123 | [
"def",
"aot40_vegetation",
"(",
"df",
",",
"nb_an",
")",
":",
"return",
"_aot",
"(",
"df",
".",
"tshift",
"(",
"1",
")",
",",
"nb_an",
"=",
"nb_an",
",",
"limite",
"=",
"80",
",",
"mois_debut",
"=",
"5",
",",
"mois_fin",
"=",
"7",
",",
"heure_debut... | 467e8a843ca9f882f8bb2958805b7293591996ad |
valid | _aot | Calcul de l'AOT de manière paramètrable. Voir AOT40_vegetation ou
AOT40_foret pour des paramètres préalablement fixés.
Paramètres:
df: DataFrame de mesures sur lequel appliqué le calcul
nb_an: (int) Nombre d'années contenu dans le df, et servant à diviser le
résultat retourné
limite: (float) va... | pyair/reg.py | def _aot(df, nb_an=1, limite=80, mois_debut=5, mois_fin=7,
heure_debut=7, heure_fin=19):
"""
Calcul de l'AOT de manière paramètrable. Voir AOT40_vegetation ou
AOT40_foret pour des paramètres préalablement fixés.
Paramètres:
df: DataFrame de mesures sur lequel appliqué le calcul
nb_an: ... | def _aot(df, nb_an=1, limite=80, mois_debut=5, mois_fin=7,
heure_debut=7, heure_fin=19):
"""
Calcul de l'AOT de manière paramètrable. Voir AOT40_vegetation ou
AOT40_foret pour des paramètres préalablement fixés.
Paramètres:
df: DataFrame de mesures sur lequel appliqué le calcul
nb_an: ... | [
"Calcul",
"de",
"l",
"AOT",
"de",
"manière",
"paramètrable",
".",
"Voir",
"AOT40_vegetation",
"ou",
"AOT40_foret",
"pour",
"des",
"paramètres",
"préalablement",
"fixés",
"."
] | LionelR/pyair | python | https://github.com/LionelR/pyair/blob/467e8a843ca9f882f8bb2958805b7293591996ad/pyair/reg.py#L148-L188 | [
"def",
"_aot",
"(",
"df",
",",
"nb_an",
"=",
"1",
",",
"limite",
"=",
"80",
",",
"mois_debut",
"=",
"5",
",",
"mois_fin",
"=",
"7",
",",
"heure_debut",
"=",
"7",
",",
"heure_fin",
"=",
"19",
")",
":",
"res",
"=",
"df",
"[",
"(",
"df",
".",
"i... | 467e8a843ca9f882f8bb2958805b7293591996ad |
valid | no2 | Calculs réglementaires pour le dioxyde d'azote
Paramètres:
df: DataFrame contenant les mesures, avec un index temporel
(voir xair.get_mesure)
Retourne:
Une série de résultats dans un DataFrame :
******
unité (u): µg/m3 (microgramme par mètre cube)
Seuil de RI en moyenne H: 200u
Se... | pyair/reg.py | def no2(df):
"""
Calculs réglementaires pour le dioxyde d'azote
Paramètres:
df: DataFrame contenant les mesures, avec un index temporel
(voir xair.get_mesure)
Retourne:
Une série de résultats dans un DataFrame :
******
unité (u): µg/m3 (microgramme par mètre cube)
Seuil de RI ... | def no2(df):
"""
Calculs réglementaires pour le dioxyde d'azote
Paramètres:
df: DataFrame contenant les mesures, avec un index temporel
(voir xair.get_mesure)
Retourne:
Une série de résultats dans un DataFrame :
******
unité (u): µg/m3 (microgramme par mètre cube)
Seuil de RI ... | [
"Calculs",
"réglementaires",
"pour",
"le",
"dioxyde",
"d",
"azote"
] | LionelR/pyair | python | https://github.com/LionelR/pyair/blob/467e8a843ca9f882f8bb2958805b7293591996ad/pyair/reg.py#L206-L247 | [
"def",
"no2",
"(",
"df",
")",
":",
"polluant",
"=",
"\"NO2\"",
"# Le DataFrame doit être en heure",
"if",
"not",
"isinstance",
"(",
"df",
".",
"index",
".",
"freq",
",",
"pdoffset",
".",
"Hour",
")",
":",
"raise",
"FreqException",
"(",
"\"df doit être en heure... | 467e8a843ca9f882f8bb2958805b7293591996ad |
valid | pm10 | Calculs réglementaires pour les particules PM10
Paramètres:
df: DataFrame contenant les mesures, avec un index temporel
(voir xair.get_mesure)
Retourne:
Une série de résultats dans un DataFrame :
******
unité (u): µg/m3 (microgramme par mètre cube)
Seuil de RI en moyenne J: 50u
Se... | pyair/reg.py | def pm10(df):
"""
Calculs réglementaires pour les particules PM10
Paramètres:
df: DataFrame contenant les mesures, avec un index temporel
(voir xair.get_mesure)
Retourne:
Une série de résultats dans un DataFrame :
******
unité (u): µg/m3 (microgramme par mètre cube)
Seuil de R... | def pm10(df):
"""
Calculs réglementaires pour les particules PM10
Paramètres:
df: DataFrame contenant les mesures, avec un index temporel
(voir xair.get_mesure)
Retourne:
Une série de résultats dans un DataFrame :
******
unité (u): µg/m3 (microgramme par mètre cube)
Seuil de R... | [
"Calculs",
"réglementaires",
"pour",
"les",
"particules",
"PM10"
] | LionelR/pyair | python | https://github.com/LionelR/pyair/blob/467e8a843ca9f882f8bb2958805b7293591996ad/pyair/reg.py#L250-L286 | [
"def",
"pm10",
"(",
"df",
")",
":",
"polluant",
"=",
"'PM10'",
"# Le DataFrame doit être en jour",
"if",
"not",
"isinstance",
"(",
"df",
".",
"index",
".",
"freq",
",",
"pdoffset",
".",
"Day",
")",
":",
"raise",
"FreqException",
"(",
"\"df doit être en jour.\"... | 467e8a843ca9f882f8bb2958805b7293591996ad |
valid | so2 | Calculs réglementaires pour le dioxyde de soufre
Paramètres:
df: DataFrame contenant les mesures, avec un index temporel
(voir xair.get_mesure)
Retourne:
Une série de résultats dans un DataFrame :
******
unité (u): µg/m3 (microgramme par mètre cube)
Seuil de RI en moyenne H: 300u
... | pyair/reg.py | def so2(df):
"""
Calculs réglementaires pour le dioxyde de soufre
Paramètres:
df: DataFrame contenant les mesures, avec un index temporel
(voir xair.get_mesure)
Retourne:
Une série de résultats dans un DataFrame :
******
unité (u): µg/m3 (microgramme par mètre cube)
Seuil de R... | def so2(df):
"""
Calculs réglementaires pour le dioxyde de soufre
Paramètres:
df: DataFrame contenant les mesures, avec un index temporel
(voir xair.get_mesure)
Retourne:
Une série de résultats dans un DataFrame :
******
unité (u): µg/m3 (microgramme par mètre cube)
Seuil de R... | [
"Calculs",
"réglementaires",
"pour",
"le",
"dioxyde",
"de",
"soufre"
] | LionelR/pyair | python | https://github.com/LionelR/pyair/blob/467e8a843ca9f882f8bb2958805b7293591996ad/pyair/reg.py#L289-L330 | [
"def",
"so2",
"(",
"df",
")",
":",
"polluant",
"=",
"'SO2'",
"# Le DataFrame doit être en heure",
"if",
"not",
"isinstance",
"(",
"df",
".",
"index",
".",
"freq",
",",
"pdoffset",
".",
"Hour",
")",
":",
"raise",
"FreqException",
"(",
"\"df doit être en heure.\... | 467e8a843ca9f882f8bb2958805b7293591996ad |
valid | co | Calculs réglementaires pour le monoxyde de carbone
Paramètres:
df: DataFrame contenant les mesures, avec un index temporel
(voir xair.get_mesure)
Retourne:
Une série de résultats dans un DataFrame :
******
unité (u): µg/m3 (microgramme par mètre cube)
Valeur limite pour la santé humai... | pyair/reg.py | def co(df):
"""
Calculs réglementaires pour le monoxyde de carbone
Paramètres:
df: DataFrame contenant les mesures, avec un index temporel
(voir xair.get_mesure)
Retourne:
Une série de résultats dans un DataFrame :
******
unité (u): µg/m3 (microgramme par mètre cube)
Valeur li... | def co(df):
"""
Calculs réglementaires pour le monoxyde de carbone
Paramètres:
df: DataFrame contenant les mesures, avec un index temporel
(voir xair.get_mesure)
Retourne:
Une série de résultats dans un DataFrame :
******
unité (u): µg/m3 (microgramme par mètre cube)
Valeur li... | [
"Calculs",
"réglementaires",
"pour",
"le",
"monoxyde",
"de",
"carbone"
] | LionelR/pyair | python | https://github.com/LionelR/pyair/blob/467e8a843ca9f882f8bb2958805b7293591996ad/pyair/reg.py#L333-L362 | [
"def",
"co",
"(",
"df",
")",
":",
"polluant",
"=",
"'CO'",
"# Le DataFrame doit être en heure",
"if",
"not",
"isinstance",
"(",
"df",
".",
"index",
".",
"freq",
",",
"pdoffset",
".",
"Hour",
")",
":",
"raise",
"FreqException",
"(",
"\"df doit être en heure.\")... | 467e8a843ca9f882f8bb2958805b7293591996ad |
valid | o3 | Calculs réglementaires pour l'ozone
Paramètres:
df: DataFrame contenant les mesures, avec un index temporel
(voir xair.get_mesure)
Retourne:
Une série de résultats dans un DataFrame :
******
unité (u): µg/m3 (microgramme par mètre cube)
Seuil de RI sur 1H: 180u
Seuil d'Alerte sur ... | pyair/reg.py | def o3(df):
"""
Calculs réglementaires pour l'ozone
Paramètres:
df: DataFrame contenant les mesures, avec un index temporel
(voir xair.get_mesure)
Retourne:
Une série de résultats dans un DataFrame :
******
unité (u): µg/m3 (microgramme par mètre cube)
Seuil de RI sur 1H: 180u... | def o3(df):
"""
Calculs réglementaires pour l'ozone
Paramètres:
df: DataFrame contenant les mesures, avec un index temporel
(voir xair.get_mesure)
Retourne:
Une série de résultats dans un DataFrame :
******
unité (u): µg/m3 (microgramme par mètre cube)
Seuil de RI sur 1H: 180u... | [
"Calculs",
"réglementaires",
"pour",
"l",
"ozone"
] | LionelR/pyair | python | https://github.com/LionelR/pyair/blob/467e8a843ca9f882f8bb2958805b7293591996ad/pyair/reg.py#L365-L404 | [
"def",
"o3",
"(",
"df",
")",
":",
"polluant",
"=",
"'O3'",
"# Le DataFrame doit être en heure",
"if",
"not",
"isinstance",
"(",
"df",
".",
"index",
".",
"freq",
",",
"pdoffset",
".",
"Hour",
")",
":",
"raise",
"FreqException",
"(",
"\"df doit être en heure.\")... | 467e8a843ca9f882f8bb2958805b7293591996ad |
valid | c6h6 | Calculs réglementaires pour le benzène
Paramètres:
df: DataFrame contenant les mesures, avec un index temporel
(voir xair.get_mesure)
Retourne:
Une série de résultats dans un DataFrame :
******
unité (u): µg/m3 (microgramme par mètre cube)
Objectif de qualité en moyenne A: 2u
Vale... | pyair/reg.py | def c6h6(df):
"""
Calculs réglementaires pour le benzène
Paramètres:
df: DataFrame contenant les mesures, avec un index temporel
(voir xair.get_mesure)
Retourne:
Une série de résultats dans un DataFrame :
******
unité (u): µg/m3 (microgramme par mètre cube)
Objectif de qualité... | def c6h6(df):
"""
Calculs réglementaires pour le benzène
Paramètres:
df: DataFrame contenant les mesures, avec un index temporel
(voir xair.get_mesure)
Retourne:
Une série de résultats dans un DataFrame :
******
unité (u): µg/m3 (microgramme par mètre cube)
Objectif de qualité... | [
"Calculs",
"réglementaires",
"pour",
"le",
"benzène"
] | LionelR/pyair | python | https://github.com/LionelR/pyair/blob/467e8a843ca9f882f8bb2958805b7293591996ad/pyair/reg.py#L407-L437 | [
"def",
"c6h6",
"(",
"df",
")",
":",
"polluant",
"=",
"'C6H6'",
"# Le DataFrame doit être en heure",
"if",
"not",
"isinstance",
"(",
"df",
".",
"index",
".",
"freq",
",",
"pdoffset",
".",
"Hour",
")",
":",
"raise",
"FreqException",
"(",
"\"df doit être en heure... | 467e8a843ca9f882f8bb2958805b7293591996ad |
valid | arsenic | Calculs réglementaires pour l'arsenic
Paramètres:
df: DataFrame contenant les mesures, avec un index temporel
(voir xair.get_mesure)
Retourne:
Une série de résultats dans un DataFrame :
******
unité (u): ng/m3 (nanogramme par mètre cube)
Valeur cible en moyenne A: 6u
Les résultat... | pyair/reg.py | def arsenic(df):
"""
Calculs réglementaires pour l'arsenic
Paramètres:
df: DataFrame contenant les mesures, avec un index temporel
(voir xair.get_mesure)
Retourne:
Une série de résultats dans un DataFrame :
******
unité (u): ng/m3 (nanogramme par mètre cube)
Valeur cible en mo... | def arsenic(df):
"""
Calculs réglementaires pour l'arsenic
Paramètres:
df: DataFrame contenant les mesures, avec un index temporel
(voir xair.get_mesure)
Retourne:
Une série de résultats dans un DataFrame :
******
unité (u): ng/m3 (nanogramme par mètre cube)
Valeur cible en mo... | [
"Calculs",
"réglementaires",
"pour",
"l",
"arsenic"
] | LionelR/pyair | python | https://github.com/LionelR/pyair/blob/467e8a843ca9f882f8bb2958805b7293591996ad/pyair/reg.py#L474-L501 | [
"def",
"arsenic",
"(",
"df",
")",
":",
"polluant",
"=",
"'As'",
"# Le DataFrame doit être en heure",
"if",
"not",
"isinstance",
"(",
"df",
".",
"index",
".",
"freq",
",",
"pdoffset",
".",
"Hour",
")",
":",
"raise",
"FreqException",
"(",
"\"df doit être en heur... | 467e8a843ca9f882f8bb2958805b7293591996ad |
valid | print_synthese | Présente une synthèse des calculs réglementaires en fournissant les valeurs
calculées suivant les réglementations définies dans chaque fonction de calcul
et un tableau de nombre de dépassement.
Paramètres:
fct: fonction renvoyant les éléments calculées
df: DataFrame de valeurs d'entrée à fournir à ... | pyair/reg.py | def print_synthese(fct, df):
"""
Présente une synthèse des calculs réglementaires en fournissant les valeurs
calculées suivant les réglementations définies dans chaque fonction de calcul
et un tableau de nombre de dépassement.
Paramètres:
fct: fonction renvoyant les éléments calculées
df: D... | def print_synthese(fct, df):
"""
Présente une synthèse des calculs réglementaires en fournissant les valeurs
calculées suivant les réglementations définies dans chaque fonction de calcul
et un tableau de nombre de dépassement.
Paramètres:
fct: fonction renvoyant les éléments calculées
df: D... | [
"Présente",
"une",
"synthèse",
"des",
"calculs",
"réglementaires",
"en",
"fournissant",
"les",
"valeurs",
"calculées",
"suivant",
"les",
"réglementations",
"définies",
"dans",
"chaque",
"fonction",
"de",
"calcul",
"et",
"un",
"tableau",
"de",
"nombre",
"de",
"dépa... | LionelR/pyair | python | https://github.com/LionelR/pyair/blob/467e8a843ca9f882f8bb2958805b7293591996ad/pyair/reg.py#L597-L629 | [
"def",
"print_synthese",
"(",
"fct",
",",
"df",
")",
":",
"res_count",
"=",
"dict",
"(",
")",
"polluant",
",",
"res",
"=",
"fct",
"(",
"df",
")",
"print",
"(",
"\"\\nPour le polluant: %s\"",
"%",
"polluant",
")",
"print",
"(",
"\"\\nValeurs mesurées suivant ... | 467e8a843ca9f882f8bb2958805b7293591996ad |
valid | excel_synthese | Enregistre dans un fichier Excel une synthèse des calculs réglementaires en
fournissant les valeurs calculées suivant les réglementations définies dans
chaque fonction de calcul et un tableau de nombre de dépassement.
Les résultats sont enregistrés
Paramètres:
fct: fonction renvoyant les éléments c... | pyair/reg.py | def excel_synthese(fct, df, excel_file):
"""
Enregistre dans un fichier Excel une synthèse des calculs réglementaires en
fournissant les valeurs calculées suivant les réglementations définies dans
chaque fonction de calcul et un tableau de nombre de dépassement.
Les résultats sont enregistrés
P... | def excel_synthese(fct, df, excel_file):
"""
Enregistre dans un fichier Excel une synthèse des calculs réglementaires en
fournissant les valeurs calculées suivant les réglementations définies dans
chaque fonction de calcul et un tableau de nombre de dépassement.
Les résultats sont enregistrés
P... | [
"Enregistre",
"dans",
"un",
"fichier",
"Excel",
"une",
"synthèse",
"des",
"calculs",
"réglementaires",
"en",
"fournissant",
"les",
"valeurs",
"calculées",
"suivant",
"les",
"réglementations",
"définies",
"dans",
"chaque",
"fonction",
"de",
"calcul",
"et",
"un",
"t... | LionelR/pyair | python | https://github.com/LionelR/pyair/blob/467e8a843ca9f882f8bb2958805b7293591996ad/pyair/reg.py#L632-L678 | [
"def",
"excel_synthese",
"(",
"fct",
",",
"df",
",",
"excel_file",
")",
":",
"def",
"sheet_name",
"(",
"name",
")",
":",
"# formatage du nom des feuilles (suppression des guillements, :, ...)",
"name",
"=",
"unicodedata",
".",
"normalize",
"(",
"'NFKD'",
",",
"name"... | 467e8a843ca9f882f8bb2958805b7293591996ad |
valid | html_synthese | Retourne au format html une synthèse des calculs réglementaires en
fournissant les valeurs calculées suivant les réglementations définies dans
chaque fonction de calcul et un tableau de nombre de dépassement.
Paramètres:
fct: fonction renvoyant les éléments calculées
df: DataFrame de valeurs d'entr... | pyair/reg.py | def html_synthese(fct, df):
"""
Retourne au format html une synthèse des calculs réglementaires en
fournissant les valeurs calculées suivant les réglementations définies dans
chaque fonction de calcul et un tableau de nombre de dépassement.
Paramètres:
fct: fonction renvoyant les éléments calcu... | def html_synthese(fct, df):
"""
Retourne au format html une synthèse des calculs réglementaires en
fournissant les valeurs calculées suivant les réglementations définies dans
chaque fonction de calcul et un tableau de nombre de dépassement.
Paramètres:
fct: fonction renvoyant les éléments calcu... | [
"Retourne",
"au",
"format",
"html",
"une",
"synthèse",
"des",
"calculs",
"réglementaires",
"en",
"fournissant",
"les",
"valeurs",
"calculées",
"suivant",
"les",
"réglementations",
"définies",
"dans",
"chaque",
"fonction",
"de",
"calcul",
"et",
"un",
"tableau",
"de... | LionelR/pyair | python | https://github.com/LionelR/pyair/blob/467e8a843ca9f882f8bb2958805b7293591996ad/pyair/reg.py#L681-L726 | [
"def",
"html_synthese",
"(",
"fct",
",",
"df",
")",
":",
"html",
"=",
"str",
"(",
")",
"res_count",
"=",
"dict",
"(",
")",
"buf",
"=",
"StringIO",
"(",
")",
"polluant",
",",
"res",
"=",
"fct",
"(",
"df",
")",
"html",
"+=",
"'<p style=\"text-align:cen... | 467e8a843ca9f882f8bb2958805b7293591996ad |
valid | show_max | Pour chaque serie (colonne) d'un DataFrame, va rechercher la (les) valeur(s)
et la (les) date(s) du (des) max.
Paramètres:
df: DataFrame de valeurs à calculer
Retourne:
Un DataFrame montrant pour chaque serie (colonne), les valeurs maxs aux dates
d'apparition. | pyair/reg.py | def show_max(df):
"""Pour chaque serie (colonne) d'un DataFrame, va rechercher la (les) valeur(s)
et la (les) date(s) du (des) max.
Paramètres:
df: DataFrame de valeurs à calculer
Retourne:
Un DataFrame montrant pour chaque serie (colonne), les valeurs maxs aux dates
d'apparition.
"""
... | def show_max(df):
"""Pour chaque serie (colonne) d'un DataFrame, va rechercher la (les) valeur(s)
et la (les) date(s) du (des) max.
Paramètres:
df: DataFrame de valeurs à calculer
Retourne:
Un DataFrame montrant pour chaque serie (colonne), les valeurs maxs aux dates
d'apparition.
"""
... | [
"Pour",
"chaque",
"serie",
"(",
"colonne",
")",
"d",
"un",
"DataFrame",
"va",
"rechercher",
"la",
"(",
"les",
")",
"valeur",
"(",
"s",
")",
"et",
"la",
"(",
"les",
")",
"date",
"(",
"s",
")",
"du",
"(",
"des",
")",
"max",
"."
] | LionelR/pyair | python | https://github.com/LionelR/pyair/blob/467e8a843ca9f882f8bb2958805b7293591996ad/pyair/reg.py#L729-L745 | [
"def",
"show_max",
"(",
"df",
")",
":",
"df",
"=",
"df",
".",
"astype",
"(",
"pd",
".",
"np",
".",
"float",
")",
"res",
"=",
"list",
"(",
")",
"for",
"c",
"in",
"df",
".",
"columns",
":",
"serie",
"=",
"df",
"[",
"c",
"]",
"res",
".",
"appe... | 467e8a843ca9f882f8bb2958805b7293591996ad |
valid | taux_de_representativite | Calcul le taux de représentativité d'un dataframe | pyair/reg.py | def taux_de_representativite(df):
"""Calcul le taux de représentativité d'un dataframe"""
return (df.count().astype(pd.np.float) / df.shape[0] * 100).round(1) | def taux_de_representativite(df):
"""Calcul le taux de représentativité d'un dataframe"""
return (df.count().astype(pd.np.float) / df.shape[0] * 100).round(1) | [
"Calcul",
"le",
"taux",
"de",
"représentativité",
"d",
"un",
"dataframe"
] | LionelR/pyair | python | https://github.com/LionelR/pyair/blob/467e8a843ca9f882f8bb2958805b7293591996ad/pyair/reg.py#L748-L750 | [
"def",
"taux_de_representativite",
"(",
"df",
")",
":",
"return",
"(",
"df",
".",
"count",
"(",
")",
".",
"astype",
"(",
"pd",
".",
"np",
".",
"float",
")",
"/",
"df",
".",
"shape",
"[",
"0",
"]",
"*",
"100",
")",
".",
"round",
"(",
"1",
")"
] | 467e8a843ca9f882f8bb2958805b7293591996ad |
valid | EnvironmentCache.validate | Validate all the entries in the environment cache. | cpenv/cache.py | def validate(self):
'''Validate all the entries in the environment cache.'''
for env in list(self):
if not env.exists:
self.remove(env) | def validate(self):
'''Validate all the entries in the environment cache.'''
for env in list(self):
if not env.exists:
self.remove(env) | [
"Validate",
"all",
"the",
"entries",
"in",
"the",
"environment",
"cache",
"."
] | cpenv/cpenv | python | https://github.com/cpenv/cpenv/blob/afbb569ae04002743db041d3629a5be8c290bd89/cpenv/cache.py#L36-L41 | [
"def",
"validate",
"(",
"self",
")",
":",
"for",
"env",
"in",
"list",
"(",
"self",
")",
":",
"if",
"not",
"env",
".",
"exists",
":",
"self",
".",
"remove",
"(",
"env",
")"
] | afbb569ae04002743db041d3629a5be8c290bd89 |
valid | EnvironmentCache.load | Load the environment cache from disk. | cpenv/cache.py | def load(self):
'''Load the environment cache from disk.'''
if not os.path.exists(self.path):
return
with open(self.path, 'r') as f:
env_data = yaml.load(f.read())
if env_data:
for env in env_data:
self.add(VirtualEnvironment(env['ro... | def load(self):
'''Load the environment cache from disk.'''
if not os.path.exists(self.path):
return
with open(self.path, 'r') as f:
env_data = yaml.load(f.read())
if env_data:
for env in env_data:
self.add(VirtualEnvironment(env['ro... | [
"Load",
"the",
"environment",
"cache",
"from",
"disk",
"."
] | cpenv/cpenv | python | https://github.com/cpenv/cpenv/blob/afbb569ae04002743db041d3629a5be8c290bd89/cpenv/cache.py#L43-L54 | [
"def",
"load",
"(",
"self",
")",
":",
"if",
"not",
"os",
".",
"path",
".",
"exists",
"(",
"self",
".",
"path",
")",
":",
"return",
"with",
"open",
"(",
"self",
".",
"path",
",",
"'r'",
")",
"as",
"f",
":",
"env_data",
"=",
"yaml",
".",
"load",
... | afbb569ae04002743db041d3629a5be8c290bd89 |
valid | EnvironmentCache.save | Save the environment cache to disk. | cpenv/cache.py | def save(self):
'''Save the environment cache to disk.'''
env_data = [dict(name=env.name, root=env.path) for env in self]
encode = yaml.safe_dump(env_data, default_flow_style=False)
with open(self.path, 'w') as f:
f.write(encode) | def save(self):
'''Save the environment cache to disk.'''
env_data = [dict(name=env.name, root=env.path) for env in self]
encode = yaml.safe_dump(env_data, default_flow_style=False)
with open(self.path, 'w') as f:
f.write(encode) | [
"Save",
"the",
"environment",
"cache",
"to",
"disk",
"."
] | cpenv/cpenv | python | https://github.com/cpenv/cpenv/blob/afbb569ae04002743db041d3629a5be8c290bd89/cpenv/cache.py#L61-L68 | [
"def",
"save",
"(",
"self",
")",
":",
"env_data",
"=",
"[",
"dict",
"(",
"name",
"=",
"env",
".",
"name",
",",
"root",
"=",
"env",
".",
"path",
")",
"for",
"env",
"in",
"self",
"]",
"encode",
"=",
"yaml",
".",
"safe_dump",
"(",
"env_data",
",",
... | afbb569ae04002743db041d3629a5be8c290bd89 |
valid | prompt | Prompts a user for input. This is a convenience function that can
be used to prompt a user for input later.
If the user aborts the input by sending a interrupt signal, this
function will catch it and raise a :exc:`Abort` exception.
.. versionadded:: 6.0
Added unicode support for cmd.exe on Win... | cpenv/packages/click/termui.py | def prompt(text, default=None, hide_input=False,
confirmation_prompt=False, type=None,
value_proc=None, prompt_suffix=': ',
show_default=True, err=False):
"""Prompts a user for input. This is a convenience function that can
be used to prompt a user for input later.
If the ... | def prompt(text, default=None, hide_input=False,
confirmation_prompt=False, type=None,
value_proc=None, prompt_suffix=': ',
show_default=True, err=False):
"""Prompts a user for input. This is a convenience function that can
be used to prompt a user for input later.
If the ... | [
"Prompts",
"a",
"user",
"for",
"input",
".",
"This",
"is",
"a",
"convenience",
"function",
"that",
"can",
"be",
"used",
"to",
"prompt",
"a",
"user",
"for",
"input",
"later",
"."
] | cpenv/cpenv | python | https://github.com/cpenv/cpenv/blob/afbb569ae04002743db041d3629a5be8c290bd89/cpenv/packages/click/termui.py#L34-L110 | [
"def",
"prompt",
"(",
"text",
",",
"default",
"=",
"None",
",",
"hide_input",
"=",
"False",
",",
"confirmation_prompt",
"=",
"False",
",",
"type",
"=",
"None",
",",
"value_proc",
"=",
"None",
",",
"prompt_suffix",
"=",
"': '",
",",
"show_default",
"=",
"... | afbb569ae04002743db041d3629a5be8c290bd89 |
valid | echo_via_pager | This function takes a text and shows it via an environment specific
pager on stdout.
.. versionchanged:: 3.0
Added the `color` flag.
:param text: the text to page.
:param color: controls if the pager supports ANSI colors or not. The
default is autodetection. | cpenv/packages/click/termui.py | def echo_via_pager(text, color=None):
"""This function takes a text and shows it via an environment specific
pager on stdout.
.. versionchanged:: 3.0
Added the `color` flag.
:param text: the text to page.
:param color: controls if the pager supports ANSI colors or not. The
... | def echo_via_pager(text, color=None):
"""This function takes a text and shows it via an environment specific
pager on stdout.
.. versionchanged:: 3.0
Added the `color` flag.
:param text: the text to page.
:param color: controls if the pager supports ANSI colors or not. The
... | [
"This",
"function",
"takes",
"a",
"text",
"and",
"shows",
"it",
"via",
"an",
"environment",
"specific",
"pager",
"on",
"stdout",
"."
] | cpenv/cpenv | python | https://github.com/cpenv/cpenv/blob/afbb569ae04002743db041d3629a5be8c290bd89/cpenv/packages/click/termui.py#L198-L213 | [
"def",
"echo_via_pager",
"(",
"text",
",",
"color",
"=",
"None",
")",
":",
"color",
"=",
"resolve_color_default",
"(",
"color",
")",
"if",
"not",
"isinstance",
"(",
"text",
",",
"string_types",
")",
":",
"text",
"=",
"text_type",
"(",
"text",
")",
"from"... | afbb569ae04002743db041d3629a5be8c290bd89 |
valid | _remote_setup_engine | (Executed on remote engine) creates an ObjectEngine instance | distob/distob.py | def _remote_setup_engine(engine_id, nengines):
"""(Executed on remote engine) creates an ObjectEngine instance """
if distob.engine is None:
distob.engine = distob.ObjectEngine(engine_id, nengines)
# TODO these imports should be unnecessary with improved deserialization
import numpy as np
fr... | def _remote_setup_engine(engine_id, nengines):
"""(Executed on remote engine) creates an ObjectEngine instance """
if distob.engine is None:
distob.engine = distob.ObjectEngine(engine_id, nengines)
# TODO these imports should be unnecessary with improved deserialization
import numpy as np
fr... | [
"(",
"Executed",
"on",
"remote",
"engine",
")",
"creates",
"an",
"ObjectEngine",
"instance"
] | mattja/distob | python | https://github.com/mattja/distob/blob/b0fc49e157189932c70231077ed35e1aa5717da9/distob/distob.py#L315-L326 | [
"def",
"_remote_setup_engine",
"(",
"engine_id",
",",
"nengines",
")",
":",
"if",
"distob",
".",
"engine",
"is",
"None",
":",
"distob",
".",
"engine",
"=",
"distob",
".",
"ObjectEngine",
"(",
"engine_id",
",",
"nengines",
")",
"# TODO these imports should be unn... | b0fc49e157189932c70231077ed35e1aa5717da9 |
valid | setup_engines | Prepare all iPython engines for distributed object processing.
Args:
client (ipyparallel.Client, optional): If None, will create a client
using the default ipyparallel profile. | distob/distob.py | def setup_engines(client=None):
"""Prepare all iPython engines for distributed object processing.
Args:
client (ipyparallel.Client, optional): If None, will create a client
using the default ipyparallel profile.
"""
if not client:
try:
client = ipyparallel.Client()
... | def setup_engines(client=None):
"""Prepare all iPython engines for distributed object processing.
Args:
client (ipyparallel.Client, optional): If None, will create a client
using the default ipyparallel profile.
"""
if not client:
try:
client = ipyparallel.Client()
... | [
"Prepare",
"all",
"iPython",
"engines",
"for",
"distributed",
"object",
"processing",
"."
] | mattja/distob | python | https://github.com/mattja/distob/blob/b0fc49e157189932c70231077ed35e1aa5717da9/distob/distob.py#L329-L364 | [
"def",
"setup_engines",
"(",
"client",
"=",
"None",
")",
":",
"if",
"not",
"client",
":",
"try",
":",
"client",
"=",
"ipyparallel",
".",
"Client",
"(",
")",
"except",
":",
"raise",
"DistobClusterError",
"(",
"u\"\"\"Could not connect to an ipyparallel cluster. Mak... | b0fc49e157189932c70231077ed35e1aa5717da9 |
valid | _process_args | Select local or remote execution and prepare arguments accordingly.
Assumes any remote args have already been moved to a common engine.
Local execution will be chosen if:
- all args are ordinary objects or Remote instances on the local engine; or
- the local cache of all remote args is current, and pre... | distob/distob.py | def _process_args(args, kwargs, prefer_local=True, recurse=True):
"""Select local or remote execution and prepare arguments accordingly.
Assumes any remote args have already been moved to a common engine.
Local execution will be chosen if:
- all args are ordinary objects or Remote instances on the loca... | def _process_args(args, kwargs, prefer_local=True, recurse=True):
"""Select local or remote execution and prepare arguments accordingly.
Assumes any remote args have already been moved to a common engine.
Local execution will be chosen if:
- all args are ordinary objects or Remote instances on the loca... | [
"Select",
"local",
"or",
"remote",
"execution",
"and",
"prepare",
"arguments",
"accordingly",
".",
"Assumes",
"any",
"remote",
"args",
"have",
"already",
"been",
"moved",
"to",
"a",
"common",
"engine",
"."
] | mattja/distob | python | https://github.com/mattja/distob/blob/b0fc49e157189932c70231077ed35e1aa5717da9/distob/distob.py#L367-L475 | [
"def",
"_process_args",
"(",
"args",
",",
"kwargs",
",",
"prefer_local",
"=",
"True",
",",
"recurse",
"=",
"True",
")",
":",
"this_engine",
"=",
"distob",
".",
"engine",
".",
"eid",
"local_args",
"=",
"[",
"]",
"remote_args",
"=",
"[",
"]",
"execloc",
... | b0fc49e157189932c70231077ed35e1aa5717da9 |
valid | _remote_call | (Executed on remote engine) convert Ids to real objects, call f | distob/distob.py | def _remote_call(f, *args, **kwargs):
"""(Executed on remote engine) convert Ids to real objects, call f """
nargs = []
for a in args:
if isinstance(a, Id):
nargs.append(distob.engine[a])
elif (isinstance(a, collections.Sequence) and
not isinstance(a, string_types... | def _remote_call(f, *args, **kwargs):
"""(Executed on remote engine) convert Ids to real objects, call f """
nargs = []
for a in args:
if isinstance(a, Id):
nargs.append(distob.engine[a])
elif (isinstance(a, collections.Sequence) and
not isinstance(a, string_types... | [
"(",
"Executed",
"on",
"remote",
"engine",
")",
"convert",
"Ids",
"to",
"real",
"objects",
"call",
"f"
] | mattja/distob | python | https://github.com/mattja/distob/blob/b0fc49e157189932c70231077ed35e1aa5717da9/distob/distob.py#L478-L510 | [
"def",
"_remote_call",
"(",
"f",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"nargs",
"=",
"[",
"]",
"for",
"a",
"in",
"args",
":",
"if",
"isinstance",
"(",
"a",
",",
"Id",
")",
":",
"nargs",
".",
"append",
"(",
"distob",
".",
"engine"... | b0fc49e157189932c70231077ed35e1aa5717da9 |
valid | call | Execute f on the arguments, either locally or remotely as appropriate.
If there are multiple remote arguments, they must be on the same engine.
kwargs:
prefer_local (bool, optional): Whether to return cached local results if
available, in preference to returning Remote objects. Default is Tru... | distob/distob.py | def call(f, *args, **kwargs):
"""Execute f on the arguments, either locally or remotely as appropriate.
If there are multiple remote arguments, they must be on the same engine.
kwargs:
prefer_local (bool, optional): Whether to return cached local results if
available, in preference to ret... | def call(f, *args, **kwargs):
"""Execute f on the arguments, either locally or remotely as appropriate.
If there are multiple remote arguments, they must be on the same engine.
kwargs:
prefer_local (bool, optional): Whether to return cached local results if
available, in preference to ret... | [
"Execute",
"f",
"on",
"the",
"arguments",
"either",
"locally",
"or",
"remotely",
"as",
"appropriate",
".",
"If",
"there",
"are",
"multiple",
"remote",
"arguments",
"they",
"must",
"be",
"on",
"the",
"same",
"engine",
".",
"kwargs",
":",
"prefer_local",
"(",
... | mattja/distob | python | https://github.com/mattja/distob/blob/b0fc49e157189932c70231077ed35e1aa5717da9/distob/distob.py#L524-L563 | [
"def",
"call",
"(",
"f",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"this_engine",
"=",
"distob",
".",
"engine",
".",
"eid",
"prefer_local",
"=",
"kwargs",
".",
"pop",
"(",
"'prefer_local'",
",",
"True",
")",
"block",
"=",
"kwargs",
".",
... | b0fc49e157189932c70231077ed35e1aa5717da9 |
valid | convert_result | Waits for and converts any AsyncResults. Converts any Ref into a Remote.
Args:
r: can be an ordinary object, ipyparallel.AsyncResult, a Ref, or a
Sequence of objects, AsyncResults and Refs.
Returns:
either an ordinary object or a Remote instance | distob/distob.py | def convert_result(r):
"""Waits for and converts any AsyncResults. Converts any Ref into a Remote.
Args:
r: can be an ordinary object, ipyparallel.AsyncResult, a Ref, or a
Sequence of objects, AsyncResults and Refs.
Returns:
either an ordinary object or a Remote instance"""
if (isin... | def convert_result(r):
"""Waits for and converts any AsyncResults. Converts any Ref into a Remote.
Args:
r: can be an ordinary object, ipyparallel.AsyncResult, a Ref, or a
Sequence of objects, AsyncResults and Refs.
Returns:
either an ordinary object or a Remote instance"""
if (isin... | [
"Waits",
"for",
"and",
"converts",
"any",
"AsyncResults",
".",
"Converts",
"any",
"Ref",
"into",
"a",
"Remote",
".",
"Args",
":",
"r",
":",
"can",
"be",
"an",
"ordinary",
"object",
"ipyparallel",
".",
"AsyncResult",
"a",
"Ref",
"or",
"a",
"Sequence",
"of... | mattja/distob | python | https://github.com/mattja/distob/blob/b0fc49e157189932c70231077ed35e1aa5717da9/distob/distob.py#L566-L584 | [
"def",
"convert_result",
"(",
"r",
")",
":",
"if",
"(",
"isinstance",
"(",
"r",
",",
"collections",
".",
"Sequence",
")",
"and",
"not",
"isinstance",
"(",
"r",
",",
"string_types",
")",
")",
":",
"rs",
"=",
"[",
"]",
"for",
"subresult",
"in",
"r",
... | b0fc49e157189932c70231077ed35e1aa5717da9 |
valid | _remote_methodcall | (Executed on remote engine) convert Ids to real objects, call method | distob/distob.py | def _remote_methodcall(id, method_name, *args, **kwargs):
"""(Executed on remote engine) convert Ids to real objects, call method """
obj = distob.engine[id]
nargs = []
for a in args:
if isinstance(a, Id):
nargs.append(distob.engine[a])
elif (isinstance(a, collections.Sequenc... | def _remote_methodcall(id, method_name, *args, **kwargs):
"""(Executed on remote engine) convert Ids to real objects, call method """
obj = distob.engine[id]
nargs = []
for a in args:
if isinstance(a, Id):
nargs.append(distob.engine[a])
elif (isinstance(a, collections.Sequenc... | [
"(",
"Executed",
"on",
"remote",
"engine",
")",
"convert",
"Ids",
"to",
"real",
"objects",
"call",
"method"
] | mattja/distob | python | https://github.com/mattja/distob/blob/b0fc49e157189932c70231077ed35e1aa5717da9/distob/distob.py#L587-L620 | [
"def",
"_remote_methodcall",
"(",
"id",
",",
"method_name",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"obj",
"=",
"distob",
".",
"engine",
"[",
"id",
"]",
"nargs",
"=",
"[",
"]",
"for",
"a",
"in",
"args",
":",
"if",
"isinstance",
"(",
... | b0fc49e157189932c70231077ed35e1aa5717da9 |
valid | methodcall | Call a method of `obj`, either locally or remotely as appropriate.
obj may be an ordinary object, or a Remote object (or Ref or object Id)
If there are multiple remote arguments, they must be on the same engine.
kwargs:
prefer_local (bool, optional): Whether to return cached local results if
... | distob/distob.py | def methodcall(obj, method_name, *args, **kwargs):
"""Call a method of `obj`, either locally or remotely as appropriate.
obj may be an ordinary object, or a Remote object (or Ref or object Id)
If there are multiple remote arguments, they must be on the same engine.
kwargs:
prefer_local (bool,... | def methodcall(obj, method_name, *args, **kwargs):
"""Call a method of `obj`, either locally or remotely as appropriate.
obj may be an ordinary object, or a Remote object (or Ref or object Id)
If there are multiple remote arguments, they must be on the same engine.
kwargs:
prefer_local (bool,... | [
"Call",
"a",
"method",
"of",
"obj",
"either",
"locally",
"or",
"remotely",
"as",
"appropriate",
".",
"obj",
"may",
"be",
"an",
"ordinary",
"object",
"or",
"a",
"Remote",
"object",
"(",
"or",
"Ref",
"or",
"object",
"Id",
")",
"If",
"there",
"are",
"mult... | mattja/distob | python | https://github.com/mattja/distob/blob/b0fc49e157189932c70231077ed35e1aa5717da9/distob/distob.py#L631-L680 | [
"def",
"methodcall",
"(",
"obj",
",",
"method_name",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"this_engine",
"=",
"distob",
".",
"engine",
".",
"eid",
"args",
"=",
"[",
"obj",
"]",
"+",
"list",
"(",
"args",
")",
"prefer_local",
"=",
"kw... | b0fc49e157189932c70231077ed35e1aa5717da9 |
valid | _scan_instance | (Executed on remote or local engine) Examines an object and returns info
about any instance-specific methods or attributes.
(For example, any attributes that were set by __init__() )
By default, methods or attributes starting with an underscore are ignored.
Args:
obj (object): the object to scan... | distob/distob.py | def _scan_instance(obj, include_underscore, exclude):
"""(Executed on remote or local engine) Examines an object and returns info
about any instance-specific methods or attributes.
(For example, any attributes that were set by __init__() )
By default, methods or attributes starting with an underscore a... | def _scan_instance(obj, include_underscore, exclude):
"""(Executed on remote or local engine) Examines an object and returns info
about any instance-specific methods or attributes.
(For example, any attributes that were set by __init__() )
By default, methods or attributes starting with an underscore a... | [
"(",
"Executed",
"on",
"remote",
"or",
"local",
"engine",
")",
"Examines",
"an",
"object",
"and",
"returns",
"info",
"about",
"any",
"instance",
"-",
"specific",
"methods",
"or",
"attributes",
".",
"(",
"For",
"example",
"any",
"attributes",
"that",
"were",
... | mattja/distob | python | https://github.com/mattja/distob/blob/b0fc49e157189932c70231077ed35e1aa5717da9/distob/distob.py#L699-L736 | [
"def",
"_scan_instance",
"(",
"obj",
",",
"include_underscore",
",",
"exclude",
")",
":",
"from",
"sys",
"import",
"getsizeof",
"always_exclude",
"=",
"(",
"'__new__'",
",",
"'__init__'",
",",
"'__getattribute__'",
",",
"'__class__'",
",",
"'__reduce__'",
",",
"... | b0fc49e157189932c70231077ed35e1aa5717da9 |
valid | proxy_methods | class decorator. Modifies `Remote` subclasses to add proxy methods and
attributes that mimic those defined in class `base`.
Example:
@proxy_methods(Tree)
class RemoteTree(Remote, Tree)
The decorator registers the new proxy class and specifies which methods
and attributes of class `base` s... | distob/distob.py | def proxy_methods(base, include_underscore=None, exclude=None, supers=True):
"""class decorator. Modifies `Remote` subclasses to add proxy methods and
attributes that mimic those defined in class `base`.
Example:
@proxy_methods(Tree)
class RemoteTree(Remote, Tree)
The decorator registers ... | def proxy_methods(base, include_underscore=None, exclude=None, supers=True):
"""class decorator. Modifies `Remote` subclasses to add proxy methods and
attributes that mimic those defined in class `base`.
Example:
@proxy_methods(Tree)
class RemoteTree(Remote, Tree)
The decorator registers ... | [
"class",
"decorator",
".",
"Modifies",
"Remote",
"subclasses",
"to",
"add",
"proxy",
"methods",
"and",
"attributes",
"that",
"mimic",
"those",
"defined",
"in",
"class",
"base",
"."
] | mattja/distob | python | https://github.com/mattja/distob/blob/b0fc49e157189932c70231077ed35e1aa5717da9/distob/distob.py#L845-L942 | [
"def",
"proxy_methods",
"(",
"base",
",",
"include_underscore",
"=",
"None",
",",
"exclude",
"=",
"None",
",",
"supers",
"=",
"True",
")",
":",
"always_exclude",
"=",
"(",
"'__new__'",
",",
"'__init__'",
",",
"'__getattribute__'",
",",
"'__class__'",
",",
"'... | b0fc49e157189932c70231077ed35e1aa5717da9 |
valid | _async_scatter | Distribute an obj or list to remote engines.
Return an async result or (possibly nested) lists of async results,
each of which is a Ref | distob/distob.py | def _async_scatter(obj, destination=None):
"""Distribute an obj or list to remote engines.
Return an async result or (possibly nested) lists of async results,
each of which is a Ref
"""
#TODO Instead of special cases for strings and Remote, should have a
# list of types that should not be ... | def _async_scatter(obj, destination=None):
"""Distribute an obj or list to remote engines.
Return an async result or (possibly nested) lists of async results,
each of which is a Ref
"""
#TODO Instead of special cases for strings and Remote, should have a
# list of types that should not be ... | [
"Distribute",
"an",
"obj",
"or",
"list",
"to",
"remote",
"engines",
".",
"Return",
"an",
"async",
"result",
"or",
"(",
"possibly",
"nested",
")",
"lists",
"of",
"async",
"results",
"each",
"of",
"which",
"is",
"a",
"Ref"
] | mattja/distob | python | https://github.com/mattja/distob/blob/b0fc49e157189932c70231077ed35e1aa5717da9/distob/distob.py#L945-L983 | [
"def",
"_async_scatter",
"(",
"obj",
",",
"destination",
"=",
"None",
")",
":",
"#TODO Instead of special cases for strings and Remote, should have a",
"# list of types that should not be proxied, inc. strings and Remote.",
"if",
"(",
"isinstance",
"(",
"obj",
",",
"Remote",
... | b0fc49e157189932c70231077ed35e1aa5717da9 |
valid | _ars_to_proxies | wait for async results and return proxy objects
Args:
ars: AsyncResult (or sequence of AsyncResults), each result type ``Ref``.
Returns:
Remote* proxy object (or list of them) | distob/distob.py | def _ars_to_proxies(ars):
"""wait for async results and return proxy objects
Args:
ars: AsyncResult (or sequence of AsyncResults), each result type ``Ref``.
Returns:
Remote* proxy object (or list of them)
"""
if (isinstance(ars, Remote) or
isinstance(ars, numbers.Number) or
... | def _ars_to_proxies(ars):
"""wait for async results and return proxy objects
Args:
ars: AsyncResult (or sequence of AsyncResults), each result type ``Ref``.
Returns:
Remote* proxy object (or list of them)
"""
if (isinstance(ars, Remote) or
isinstance(ars, numbers.Number) or
... | [
"wait",
"for",
"async",
"results",
"and",
"return",
"proxy",
"objects",
"Args",
":",
"ars",
":",
"AsyncResult",
"(",
"or",
"sequence",
"of",
"AsyncResults",
")",
"each",
"result",
"type",
"Ref",
".",
"Returns",
":",
"Remote",
"*",
"proxy",
"object",
"(",
... | mattja/distob | python | https://github.com/mattja/distob/blob/b0fc49e157189932c70231077ed35e1aa5717da9/distob/distob.py#L988-L1016 | [
"def",
"_ars_to_proxies",
"(",
"ars",
")",
":",
"if",
"(",
"isinstance",
"(",
"ars",
",",
"Remote",
")",
"or",
"isinstance",
"(",
"ars",
",",
"numbers",
".",
"Number",
")",
"or",
"ars",
"is",
"None",
")",
":",
"return",
"ars",
"elif",
"isinstance",
"... | b0fc49e157189932c70231077ed35e1aa5717da9 |
valid | _scatter_ndarray | Turn a numpy ndarray into a DistArray or RemoteArray
Args:
ar (array_like)
axis (int, optional): specifies along which axis to split the array to
distribute it. The default is to split along the last axis. `None` means
do not distribute.
destination (int or list of int, optional): Opti... | distob/distob.py | def _scatter_ndarray(ar, axis=-1, destination=None, blocksize=None):
"""Turn a numpy ndarray into a DistArray or RemoteArray
Args:
ar (array_like)
axis (int, optional): specifies along which axis to split the array to
distribute it. The default is to split along the last axis. `None` means
... | def _scatter_ndarray(ar, axis=-1, destination=None, blocksize=None):
"""Turn a numpy ndarray into a DistArray or RemoteArray
Args:
ar (array_like)
axis (int, optional): specifies along which axis to split the array to
distribute it. The default is to split along the last axis. `None` means
... | [
"Turn",
"a",
"numpy",
"ndarray",
"into",
"a",
"DistArray",
"or",
"RemoteArray",
"Args",
":",
"ar",
"(",
"array_like",
")",
"axis",
"(",
"int",
"optional",
")",
":",
"specifies",
"along",
"which",
"axis",
"to",
"split",
"the",
"array",
"to",
"distribute",
... | mattja/distob | python | https://github.com/mattja/distob/blob/b0fc49e157189932c70231077ed35e1aa5717da9/distob/distob.py#L1019-L1078 | [
"def",
"_scatter_ndarray",
"(",
"ar",
",",
"axis",
"=",
"-",
"1",
",",
"destination",
"=",
"None",
",",
"blocksize",
"=",
"None",
")",
":",
"from",
".",
"arrays",
"import",
"DistArray",
",",
"RemoteArray",
"shape",
"=",
"ar",
".",
"shape",
"ndim",
"=",... | b0fc49e157189932c70231077ed35e1aa5717da9 |
valid | scatter | Distribute obj or list to remote engines, returning proxy objects
Args:
obj: any python object, or list of objects
axis (int, optional): Can be used if scattering a numpy array,
specifying along which axis to split the array to distribute it. The
default is to split along the last axis.... | distob/distob.py | def scatter(obj, axis=-1, blocksize=None):
"""Distribute obj or list to remote engines, returning proxy objects
Args:
obj: any python object, or list of objects
axis (int, optional): Can be used if scattering a numpy array,
specifying along which axis to split the array to distribute it. The... | def scatter(obj, axis=-1, blocksize=None):
"""Distribute obj or list to remote engines, returning proxy objects
Args:
obj: any python object, or list of objects
axis (int, optional): Can be used if scattering a numpy array,
specifying along which axis to split the array to distribute it. The... | [
"Distribute",
"obj",
"or",
"list",
"to",
"remote",
"engines",
"returning",
"proxy",
"objects",
"Args",
":",
"obj",
":",
"any",
"python",
"object",
"or",
"list",
"of",
"objects",
"axis",
"(",
"int",
"optional",
")",
":",
"Can",
"be",
"used",
"if",
"scatte... | mattja/distob | python | https://github.com/mattja/distob/blob/b0fc49e157189932c70231077ed35e1aa5717da9/distob/distob.py#L1107-L1128 | [
"def",
"scatter",
"(",
"obj",
",",
"axis",
"=",
"-",
"1",
",",
"blocksize",
"=",
"None",
")",
":",
"if",
"hasattr",
"(",
"obj",
",",
"'__distob_scatter__'",
")",
":",
"return",
"obj",
".",
"__distob_scatter__",
"(",
"axis",
",",
"None",
",",
"blocksize... | b0fc49e157189932c70231077ed35e1aa5717da9 |
valid | gather | Retrieve objects that have been distributed, making them local again | distob/distob.py | def gather(obj):
"""Retrieve objects that have been distributed, making them local again"""
if hasattr(obj, '__distob_gather__'):
return obj.__distob_gather__()
elif (isinstance(obj, collections.Sequence) and
not isinstance(obj, string_types)):
return [gather(subobj) for subobj ... | def gather(obj):
"""Retrieve objects that have been distributed, making them local again"""
if hasattr(obj, '__distob_gather__'):
return obj.__distob_gather__()
elif (isinstance(obj, collections.Sequence) and
not isinstance(obj, string_types)):
return [gather(subobj) for subobj ... | [
"Retrieve",
"objects",
"that",
"have",
"been",
"distributed",
"making",
"them",
"local",
"again"
] | mattja/distob | python | https://github.com/mattja/distob/blob/b0fc49e157189932c70231077ed35e1aa5717da9/distob/distob.py#L1131-L1139 | [
"def",
"gather",
"(",
"obj",
")",
":",
"if",
"hasattr",
"(",
"obj",
",",
"'__distob_gather__'",
")",
":",
"return",
"obj",
".",
"__distob_gather__",
"(",
")",
"elif",
"(",
"isinstance",
"(",
"obj",
",",
"collections",
".",
"Sequence",
")",
"and",
"not",
... | b0fc49e157189932c70231077ed35e1aa5717da9 |
valid | vectorize | Upgrade normal function f to act in parallel on distibuted lists/arrays
Args:
f (callable): an ordinary function which expects as its first argument a
single object, or a numpy array of N dimensions.
Returns:
vf (callable): new function that takes as its first argument a list of
ob... | distob/distob.py | def vectorize(f):
"""Upgrade normal function f to act in parallel on distibuted lists/arrays
Args:
f (callable): an ordinary function which expects as its first argument a
single object, or a numpy array of N dimensions.
Returns:
vf (callable): new function that takes as its first argu... | def vectorize(f):
"""Upgrade normal function f to act in parallel on distibuted lists/arrays
Args:
f (callable): an ordinary function which expects as its first argument a
single object, or a numpy array of N dimensions.
Returns:
vf (callable): new function that takes as its first argu... | [
"Upgrade",
"normal",
"function",
"f",
"to",
"act",
"in",
"parallel",
"on",
"distibuted",
"lists",
"/",
"arrays"
] | mattja/distob | python | https://github.com/mattja/distob/blob/b0fc49e157189932c70231077ed35e1aa5717da9/distob/distob.py#L1142-L1189 | [
"def",
"vectorize",
"(",
"f",
")",
":",
"def",
"vf",
"(",
"obj",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"# user classes can customize how to vectorize a function:",
"if",
"hasattr",
"(",
"obj",
",",
"'__distob_vectorize__'",
")",
":",
"return",
... | b0fc49e157189932c70231077ed35e1aa5717da9 |
valid | apply | Apply a function in parallel to each element of the input | distob/distob.py | def apply(f, obj, *args, **kwargs):
"""Apply a function in parallel to each element of the input"""
return vectorize(f)(obj, *args, **kwargs) | def apply(f, obj, *args, **kwargs):
"""Apply a function in parallel to each element of the input"""
return vectorize(f)(obj, *args, **kwargs) | [
"Apply",
"a",
"function",
"in",
"parallel",
"to",
"each",
"element",
"of",
"the",
"input"
] | mattja/distob | python | https://github.com/mattja/distob/blob/b0fc49e157189932c70231077ed35e1aa5717da9/distob/distob.py#L1192-L1194 | [
"def",
"apply",
"(",
"f",
",",
"obj",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"vectorize",
"(",
"f",
")",
"(",
"obj",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | b0fc49e157189932c70231077ed35e1aa5717da9 |
valid | call_all | Call a method on each element of a sequence, in parallel.
Returns:
list of results | distob/distob.py | def call_all(sequence, method_name, *args, **kwargs):
"""Call a method on each element of a sequence, in parallel.
Returns:
list of results
"""
kwargs = kwargs.copy()
kwargs['block'] = False
results = []
for obj in sequence:
results.append(methodcall(obj, method_name, *args, **... | def call_all(sequence, method_name, *args, **kwargs):
"""Call a method on each element of a sequence, in parallel.
Returns:
list of results
"""
kwargs = kwargs.copy()
kwargs['block'] = False
results = []
for obj in sequence:
results.append(methodcall(obj, method_name, *args, **... | [
"Call",
"a",
"method",
"on",
"each",
"element",
"of",
"a",
"sequence",
"in",
"parallel",
".",
"Returns",
":",
"list",
"of",
"results"
] | mattja/distob | python | https://github.com/mattja/distob/blob/b0fc49e157189932c70231077ed35e1aa5717da9/distob/distob.py#L1197-L1209 | [
"def",
"call_all",
"(",
"sequence",
",",
"method_name",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"kwargs",
"=",
"kwargs",
".",
"copy",
"(",
")",
"kwargs",
"[",
"'block'",
"]",
"=",
"False",
"results",
"=",
"[",
"]",
"for",
"obj",
"in",
... | b0fc49e157189932c70231077ed35e1aa5717da9 |
valid | ObjectHub.register_proxy_type | Configure engines so that remote methods returning values of type
`real_type` will instead return by proxy, as type `proxy_type` | distob/distob.py | def register_proxy_type(cls, real_type, proxy_type):
"""Configure engines so that remote methods returning values of type
`real_type` will instead return by proxy, as type `proxy_type`
"""
if distob.engine is None:
cls._initial_proxy_types[real_type] = proxy_type
elif... | def register_proxy_type(cls, real_type, proxy_type):
"""Configure engines so that remote methods returning values of type
`real_type` will instead return by proxy, as type `proxy_type`
"""
if distob.engine is None:
cls._initial_proxy_types[real_type] = proxy_type
elif... | [
"Configure",
"engines",
"so",
"that",
"remote",
"methods",
"returning",
"values",
"of",
"type",
"real_type",
"will",
"instead",
"return",
"by",
"proxy",
"as",
"type",
"proxy_type"
] | mattja/distob | python | https://github.com/mattja/distob/blob/b0fc49e157189932c70231077ed35e1aa5717da9/distob/distob.py#L237-L248 | [
"def",
"register_proxy_type",
"(",
"cls",
",",
"real_type",
",",
"proxy_type",
")",
":",
"if",
"distob",
".",
"engine",
"is",
"None",
":",
"cls",
".",
"_initial_proxy_types",
"[",
"real_type",
"]",
"=",
"proxy_type",
"elif",
"isinstance",
"(",
"distob",
".",... | b0fc49e157189932c70231077ed35e1aa5717da9 |
valid | Remote._fetch | forces update of a local cached copy of the real object
(regardless of the preference setting self.cache) | distob/distob.py | def _fetch(self):
"""forces update of a local cached copy of the real object
(regardless of the preference setting self.cache)"""
if not self.is_local and not self._obcache_current:
#print('fetching data from %s' % self._ref.id)
def _remote_fetch(id):
retu... | def _fetch(self):
"""forces update of a local cached copy of the real object
(regardless of the preference setting self.cache)"""
if not self.is_local and not self._obcache_current:
#print('fetching data from %s' % self._ref.id)
def _remote_fetch(id):
retu... | [
"forces",
"update",
"of",
"a",
"local",
"cached",
"copy",
"of",
"the",
"real",
"object",
"(",
"regardless",
"of",
"the",
"preference",
"setting",
"self",
".",
"cache",
")"
] | mattja/distob | python | https://github.com/mattja/distob/blob/b0fc49e157189932c70231077ed35e1aa5717da9/distob/distob.py#L804-L814 | [
"def",
"_fetch",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"is_local",
"and",
"not",
"self",
".",
"_obcache_current",
":",
"#print('fetching data from %s' % self._ref.id)",
"def",
"_remote_fetch",
"(",
"id",
")",
":",
"return",
"distob",
".",
"engine",
... | b0fc49e157189932c70231077ed35e1aa5717da9 |
valid | extract_json | Supports: gettext, ngettext. See package README or github ( https://github.com/tigrawap/pybabel-json ) for more usage info. | pybabel_json/extractor.py | def extract_json(fileobj, keywords, comment_tags, options):
"""
Supports: gettext, ngettext. See package README or github ( https://github.com/tigrawap/pybabel-json ) for more usage info.
"""
data=fileobj.read()
json_extractor=JsonExtractor(data)
strings_data=json_extractor.get_lines_data()
... | def extract_json(fileobj, keywords, comment_tags, options):
"""
Supports: gettext, ngettext. See package README or github ( https://github.com/tigrawap/pybabel-json ) for more usage info.
"""
data=fileobj.read()
json_extractor=JsonExtractor(data)
strings_data=json_extractor.get_lines_data()
... | [
"Supports",
":",
"gettext",
"ngettext",
".",
"See",
"package",
"README",
"or",
"github",
"(",
"https",
":",
"//",
"github",
".",
"com",
"/",
"tigrawap",
"/",
"pybabel",
"-",
"json",
")",
"for",
"more",
"usage",
"info",
"."
] | tigrawap/pybabel-json | python | https://github.com/tigrawap/pybabel-json/blob/432b5726c61afb906bd6892366a6b20e89dc566f/pybabel_json/extractor.py#L109-L121 | [
"def",
"extract_json",
"(",
"fileobj",
",",
"keywords",
",",
"comment_tags",
",",
"options",
")",
":",
"data",
"=",
"fileobj",
".",
"read",
"(",
")",
"json_extractor",
"=",
"JsonExtractor",
"(",
"data",
")",
"strings_data",
"=",
"json_extractor",
".",
"get_l... | 432b5726c61afb906bd6892366a6b20e89dc566f |
valid | JsonExtractor.get_lines_data | Returns string:line_numbers list
Since all strings are unique it is OK to get line numbers this way.
Since same string can occur several times inside single .json file the values should be popped(FIFO) from the list
:rtype: list | pybabel_json/extractor.py | def get_lines_data(self):
"""
Returns string:line_numbers list
Since all strings are unique it is OK to get line numbers this way.
Since same string can occur several times inside single .json file the values should be popped(FIFO) from the list
:rtype: list
"""
... | def get_lines_data(self):
"""
Returns string:line_numbers list
Since all strings are unique it is OK to get line numbers this way.
Since same string can occur several times inside single .json file the values should be popped(FIFO) from the list
:rtype: list
"""
... | [
"Returns",
"string",
":",
"line_numbers",
"list",
"Since",
"all",
"strings",
"are",
"unique",
"it",
"is",
"OK",
"to",
"get",
"line",
"numbers",
"this",
"way",
".",
"Since",
"same",
"string",
"can",
"occur",
"several",
"times",
"inside",
"single",
".",
"jso... | tigrawap/pybabel-json | python | https://github.com/tigrawap/pybabel-json/blob/432b5726c61afb906bd6892366a6b20e89dc566f/pybabel_json/extractor.py#L68-L107 | [
"def",
"get_lines_data",
"(",
"self",
")",
":",
"encoding",
"=",
"'utf-8'",
"for",
"token",
"in",
"tokenize",
"(",
"self",
".",
"data",
".",
"decode",
"(",
"encoding",
")",
")",
":",
"if",
"token",
".",
"type",
"==",
"'operator'",
":",
"if",
"token",
... | 432b5726c61afb906bd6892366a6b20e89dc566f |
valid | is_git_repo | Returns True if path is a git repository. | cpenv/utils.py | def is_git_repo(path):
'''Returns True if path is a git repository.'''
if path.startswith('git@') or path.startswith('https://'):
return True
if os.path.exists(unipath(path, '.git')):
return True
return False | def is_git_repo(path):
'''Returns True if path is a git repository.'''
if path.startswith('git@') or path.startswith('https://'):
return True
if os.path.exists(unipath(path, '.git')):
return True
return False | [
"Returns",
"True",
"if",
"path",
"is",
"a",
"git",
"repository",
"."
] | cpenv/cpenv | python | https://github.com/cpenv/cpenv/blob/afbb569ae04002743db041d3629a5be8c290bd89/cpenv/utils.py#L16-L25 | [
"def",
"is_git_repo",
"(",
"path",
")",
":",
"if",
"path",
".",
"startswith",
"(",
"'git@'",
")",
"or",
"path",
".",
"startswith",
"(",
"'https://'",
")",
":",
"return",
"True",
"if",
"os",
".",
"path",
".",
"exists",
"(",
"unipath",
"(",
"path",
","... | afbb569ae04002743db041d3629a5be8c290bd89 |
valid | is_home_environment | Returns True if path is in CPENV_HOME | cpenv/utils.py | def is_home_environment(path):
'''Returns True if path is in CPENV_HOME'''
home = unipath(os.environ.get('CPENV_HOME', '~/.cpenv'))
path = unipath(path)
return path.startswith(home) | def is_home_environment(path):
'''Returns True if path is in CPENV_HOME'''
home = unipath(os.environ.get('CPENV_HOME', '~/.cpenv'))
path = unipath(path)
return path.startswith(home) | [
"Returns",
"True",
"if",
"path",
"is",
"in",
"CPENV_HOME"
] | cpenv/cpenv | python | https://github.com/cpenv/cpenv/blob/afbb569ae04002743db041d3629a5be8c290bd89/cpenv/utils.py#L28-L34 | [
"def",
"is_home_environment",
"(",
"path",
")",
":",
"home",
"=",
"unipath",
"(",
"os",
".",
"environ",
".",
"get",
"(",
"'CPENV_HOME'",
",",
"'~/.cpenv'",
")",
")",
"path",
"=",
"unipath",
"(",
"path",
")",
"return",
"path",
".",
"startswith",
"(",
"h... | afbb569ae04002743db041d3629a5be8c290bd89 |
valid | is_redirecting | Returns True if path contains a .cpenv file | cpenv/utils.py | def is_redirecting(path):
'''Returns True if path contains a .cpenv file'''
candidate = unipath(path, '.cpenv')
return os.path.exists(candidate) and os.path.isfile(candidate) | def is_redirecting(path):
'''Returns True if path contains a .cpenv file'''
candidate = unipath(path, '.cpenv')
return os.path.exists(candidate) and os.path.isfile(candidate) | [
"Returns",
"True",
"if",
"path",
"contains",
"a",
".",
"cpenv",
"file"
] | cpenv/cpenv | python | https://github.com/cpenv/cpenv/blob/afbb569ae04002743db041d3629a5be8c290bd89/cpenv/utils.py#L55-L59 | [
"def",
"is_redirecting",
"(",
"path",
")",
":",
"candidate",
"=",
"unipath",
"(",
"path",
",",
"'.cpenv'",
")",
"return",
"os",
".",
"path",
".",
"exists",
"(",
"candidate",
")",
"and",
"os",
".",
"path",
".",
"isfile",
"(",
"candidate",
")"
] | afbb569ae04002743db041d3629a5be8c290bd89 |
valid | redirect_to_env_paths | Get environment path from redirect file | cpenv/utils.py | def redirect_to_env_paths(path):
'''Get environment path from redirect file'''
with open(path, 'r') as f:
redirected = f.read()
return shlex.split(redirected) | def redirect_to_env_paths(path):
'''Get environment path from redirect file'''
with open(path, 'r') as f:
redirected = f.read()
return shlex.split(redirected) | [
"Get",
"environment",
"path",
"from",
"redirect",
"file"
] | cpenv/cpenv | python | https://github.com/cpenv/cpenv/blob/afbb569ae04002743db041d3629a5be8c290bd89/cpenv/utils.py#L62-L68 | [
"def",
"redirect_to_env_paths",
"(",
"path",
")",
":",
"with",
"open",
"(",
"path",
",",
"'r'",
")",
"as",
"f",
":",
"redirected",
"=",
"f",
".",
"read",
"(",
")",
"return",
"shlex",
".",
"split",
"(",
"redirected",
")"
] | afbb569ae04002743db041d3629a5be8c290bd89 |
valid | expandpath | Returns an absolute expanded path | cpenv/utils.py | def expandpath(path):
'''Returns an absolute expanded path'''
return os.path.abspath(os.path.expandvars(os.path.expanduser(path))) | def expandpath(path):
'''Returns an absolute expanded path'''
return os.path.abspath(os.path.expandvars(os.path.expanduser(path))) | [
"Returns",
"an",
"absolute",
"expanded",
"path"
] | cpenv/cpenv | python | https://github.com/cpenv/cpenv/blob/afbb569ae04002743db041d3629a5be8c290bd89/cpenv/utils.py#L71-L74 | [
"def",
"expandpath",
"(",
"path",
")",
":",
"return",
"os",
".",
"path",
".",
"abspath",
"(",
"os",
".",
"path",
".",
"expandvars",
"(",
"os",
".",
"path",
".",
"expanduser",
"(",
"path",
")",
")",
")"
] | afbb569ae04002743db041d3629a5be8c290bd89 |
valid | unipath | Like os.path.join but also expands and normalizes path parts. | cpenv/utils.py | def unipath(*paths):
'''Like os.path.join but also expands and normalizes path parts.'''
return os.path.normpath(expandpath(os.path.join(*paths))) | def unipath(*paths):
'''Like os.path.join but also expands and normalizes path parts.'''
return os.path.normpath(expandpath(os.path.join(*paths))) | [
"Like",
"os",
".",
"path",
".",
"join",
"but",
"also",
"expands",
"and",
"normalizes",
"path",
"parts",
"."
] | cpenv/cpenv | python | https://github.com/cpenv/cpenv/blob/afbb569ae04002743db041d3629a5be8c290bd89/cpenv/utils.py#L77-L80 | [
"def",
"unipath",
"(",
"*",
"paths",
")",
":",
"return",
"os",
".",
"path",
".",
"normpath",
"(",
"expandpath",
"(",
"os",
".",
"path",
".",
"join",
"(",
"*",
"paths",
")",
")",
")"
] | afbb569ae04002743db041d3629a5be8c290bd89 |
valid | binpath | Like os.path.join but acts relative to this packages bin path. | cpenv/utils.py | def binpath(*paths):
'''Like os.path.join but acts relative to this packages bin path.'''
package_root = os.path.dirname(__file__)
return os.path.normpath(os.path.join(package_root, 'bin', *paths)) | def binpath(*paths):
'''Like os.path.join but acts relative to this packages bin path.'''
package_root = os.path.dirname(__file__)
return os.path.normpath(os.path.join(package_root, 'bin', *paths)) | [
"Like",
"os",
".",
"path",
".",
"join",
"but",
"acts",
"relative",
"to",
"this",
"packages",
"bin",
"path",
"."
] | cpenv/cpenv | python | https://github.com/cpenv/cpenv/blob/afbb569ae04002743db041d3629a5be8c290bd89/cpenv/utils.py#L83-L87 | [
"def",
"binpath",
"(",
"*",
"paths",
")",
":",
"package_root",
"=",
"os",
".",
"path",
".",
"dirname",
"(",
"__file__",
")",
"return",
"os",
".",
"path",
".",
"normpath",
"(",
"os",
".",
"path",
".",
"join",
"(",
"package_root",
",",
"'bin'",
",",
... | afbb569ae04002743db041d3629a5be8c290bd89 |
valid | ensure_path_exists | Like os.makedirs but keeps quiet if path already exists | cpenv/utils.py | def ensure_path_exists(path, *args):
'''Like os.makedirs but keeps quiet if path already exists'''
if os.path.exists(path):
return
os.makedirs(path, *args) | def ensure_path_exists(path, *args):
'''Like os.makedirs but keeps quiet if path already exists'''
if os.path.exists(path):
return
os.makedirs(path, *args) | [
"Like",
"os",
".",
"makedirs",
"but",
"keeps",
"quiet",
"if",
"path",
"already",
"exists"
] | cpenv/cpenv | python | https://github.com/cpenv/cpenv/blob/afbb569ae04002743db041d3629a5be8c290bd89/cpenv/utils.py#L90-L95 | [
"def",
"ensure_path_exists",
"(",
"path",
",",
"*",
"args",
")",
":",
"if",
"os",
".",
"path",
".",
"exists",
"(",
"path",
")",
":",
"return",
"os",
".",
"makedirs",
"(",
"path",
",",
"*",
"args",
")"
] | afbb569ae04002743db041d3629a5be8c290bd89 |
valid | walk_dn | Walk down a directory tree. Same as os.walk but allows for a depth limit
via depth argument | cpenv/utils.py | def walk_dn(start_dir, depth=10):
'''
Walk down a directory tree. Same as os.walk but allows for a depth limit
via depth argument
'''
start_depth = len(os.path.split(start_dir))
end_depth = start_depth + depth
for root, subdirs, files in os.walk(start_dir):
yield root, subdirs, fil... | def walk_dn(start_dir, depth=10):
'''
Walk down a directory tree. Same as os.walk but allows for a depth limit
via depth argument
'''
start_depth = len(os.path.split(start_dir))
end_depth = start_depth + depth
for root, subdirs, files in os.walk(start_dir):
yield root, subdirs, fil... | [
"Walk",
"down",
"a",
"directory",
"tree",
".",
"Same",
"as",
"os",
".",
"walk",
"but",
"allows",
"for",
"a",
"depth",
"limit",
"via",
"depth",
"argument"
] | cpenv/cpenv | python | https://github.com/cpenv/cpenv/blob/afbb569ae04002743db041d3629a5be8c290bd89/cpenv/utils.py#L98-L111 | [
"def",
"walk_dn",
"(",
"start_dir",
",",
"depth",
"=",
"10",
")",
":",
"start_depth",
"=",
"len",
"(",
"os",
".",
"path",
".",
"split",
"(",
"start_dir",
")",
")",
"end_depth",
"=",
"start_depth",
"+",
"depth",
"for",
"root",
",",
"subdirs",
",",
"fi... | afbb569ae04002743db041d3629a5be8c290bd89 |
valid | walk_up | Walk up a directory tree | cpenv/utils.py | def walk_up(start_dir, depth=20):
'''
Walk up a directory tree
'''
root = start_dir
for i in xrange(depth):
contents = os.listdir(root)
subdirs, files = [], []
for f in contents:
if os.path.isdir(os.path.join(root, f)):
subdirs.append(f)
... | def walk_up(start_dir, depth=20):
'''
Walk up a directory tree
'''
root = start_dir
for i in xrange(depth):
contents = os.listdir(root)
subdirs, files = [], []
for f in contents:
if os.path.isdir(os.path.join(root, f)):
subdirs.append(f)
... | [
"Walk",
"up",
"a",
"directory",
"tree"
] | cpenv/cpenv | python | https://github.com/cpenv/cpenv/blob/afbb569ae04002743db041d3629a5be8c290bd89/cpenv/utils.py#L122-L143 | [
"def",
"walk_up",
"(",
"start_dir",
",",
"depth",
"=",
"20",
")",
":",
"root",
"=",
"start_dir",
"for",
"i",
"in",
"xrange",
"(",
"depth",
")",
":",
"contents",
"=",
"os",
".",
"listdir",
"(",
"root",
")",
"subdirs",
",",
"files",
"=",
"[",
"]",
... | afbb569ae04002743db041d3629a5be8c290bd89 |
valid | preprocess_dict | Preprocess a dict to be used as environment variables.
:param d: dict to be processed | cpenv/utils.py | def preprocess_dict(d):
'''
Preprocess a dict to be used as environment variables.
:param d: dict to be processed
'''
out_env = {}
for k, v in d.items():
if not type(v) in PREPROCESSORS:
raise KeyError('Invalid type in dict: {}'.format(type(v)))
out_env[k] = PREPR... | def preprocess_dict(d):
'''
Preprocess a dict to be used as environment variables.
:param d: dict to be processed
'''
out_env = {}
for k, v in d.items():
if not type(v) in PREPROCESSORS:
raise KeyError('Invalid type in dict: {}'.format(type(v)))
out_env[k] = PREPR... | [
"Preprocess",
"a",
"dict",
"to",
"be",
"used",
"as",
"environment",
"variables",
"."
] | cpenv/cpenv | python | https://github.com/cpenv/cpenv/blob/afbb569ae04002743db041d3629a5be8c290bd89/cpenv/utils.py#L187-L202 | [
"def",
"preprocess_dict",
"(",
"d",
")",
":",
"out_env",
"=",
"{",
"}",
"for",
"k",
",",
"v",
"in",
"d",
".",
"items",
"(",
")",
":",
"if",
"not",
"type",
"(",
"v",
")",
"in",
"PREPROCESSORS",
":",
"raise",
"KeyError",
"(",
"'Invalid type in dict: {}... | afbb569ae04002743db041d3629a5be8c290bd89 |
valid | _join_seq | Add a sequence value to env dict | cpenv/utils.py | def _join_seq(d, k, v):
'''Add a sequence value to env dict'''
if k not in d:
d[k] = list(v)
elif isinstance(d[k], list):
for item in v:
if item not in d[k]:
d[k].insert(0, item)
elif isinstance(d[k], string_types):
v.append(d[k])
d[k] = v | def _join_seq(d, k, v):
'''Add a sequence value to env dict'''
if k not in d:
d[k] = list(v)
elif isinstance(d[k], list):
for item in v:
if item not in d[k]:
d[k].insert(0, item)
elif isinstance(d[k], string_types):
v.append(d[k])
d[k] = v | [
"Add",
"a",
"sequence",
"value",
"to",
"env",
"dict"
] | cpenv/cpenv | python | https://github.com/cpenv/cpenv/blob/afbb569ae04002743db041d3629a5be8c290bd89/cpenv/utils.py#L217-L230 | [
"def",
"_join_seq",
"(",
"d",
",",
"k",
",",
"v",
")",
":",
"if",
"k",
"not",
"in",
"d",
":",
"d",
"[",
"k",
"]",
"=",
"list",
"(",
"v",
")",
"elif",
"isinstance",
"(",
"d",
"[",
"k",
"]",
",",
"list",
")",
":",
"for",
"item",
"in",
"v",
... | afbb569ae04002743db041d3629a5be8c290bd89 |
valid | join_dicts | Join a bunch of dicts | cpenv/utils.py | def join_dicts(*dicts):
'''Join a bunch of dicts'''
out_dict = {}
for d in dicts:
for k, v in d.iteritems():
if not type(v) in JOINERS:
raise KeyError('Invalid type in dict: {}'.format(type(v)))
JOINERS[type(v)](out_dict, k, v)
return out_dict | def join_dicts(*dicts):
'''Join a bunch of dicts'''
out_dict = {}
for d in dicts:
for k, v in d.iteritems():
if not type(v) in JOINERS:
raise KeyError('Invalid type in dict: {}'.format(type(v)))
JOINERS[type(v)](out_dict, k, v)
return out_dict | [
"Join",
"a",
"bunch",
"of",
"dicts"
] | cpenv/cpenv | python | https://github.com/cpenv/cpenv/blob/afbb569ae04002743db041d3629a5be8c290bd89/cpenv/utils.py#L245-L258 | [
"def",
"join_dicts",
"(",
"*",
"dicts",
")",
":",
"out_dict",
"=",
"{",
"}",
"for",
"d",
"in",
"dicts",
":",
"for",
"k",
",",
"v",
"in",
"d",
".",
"iteritems",
"(",
")",
":",
"if",
"not",
"type",
"(",
"v",
")",
"in",
"JOINERS",
":",
"raise",
... | afbb569ae04002743db041d3629a5be8c290bd89 |
valid | env_to_dict | Convert a dict containing environment variables into a standard dict.
Variables containing multiple values will be split into a list based on
the argument passed to pathsep.
:param env: Environment dict like os.environ.data
:param pathsep: Path separator used to split variables | cpenv/utils.py | def env_to_dict(env, pathsep=os.pathsep):
'''
Convert a dict containing environment variables into a standard dict.
Variables containing multiple values will be split into a list based on
the argument passed to pathsep.
:param env: Environment dict like os.environ.data
:param pathsep: Path sepa... | def env_to_dict(env, pathsep=os.pathsep):
'''
Convert a dict containing environment variables into a standard dict.
Variables containing multiple values will be split into a list based on
the argument passed to pathsep.
:param env: Environment dict like os.environ.data
:param pathsep: Path sepa... | [
"Convert",
"a",
"dict",
"containing",
"environment",
"variables",
"into",
"a",
"standard",
"dict",
".",
"Variables",
"containing",
"multiple",
"values",
"will",
"be",
"split",
"into",
"a",
"list",
"based",
"on",
"the",
"argument",
"passed",
"to",
"pathsep",
".... | cpenv/cpenv | python | https://github.com/cpenv/cpenv/blob/afbb569ae04002743db041d3629a5be8c290bd89/cpenv/utils.py#L261-L279 | [
"def",
"env_to_dict",
"(",
"env",
",",
"pathsep",
"=",
"os",
".",
"pathsep",
")",
":",
"out_dict",
"=",
"{",
"}",
"for",
"k",
",",
"v",
"in",
"env",
".",
"iteritems",
"(",
")",
":",
"if",
"pathsep",
"in",
"v",
":",
"out_dict",
"[",
"k",
"]",
"=... | afbb569ae04002743db041d3629a5be8c290bd89 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.