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
proxy_settings_module
Replaces a settings module with a Module proxy to intercept an access to settings. :param int depth: Frame count to go backward.
siteprefs/toolbox.py
def proxy_settings_module(depth=3): """Replaces a settings module with a Module proxy to intercept an access to settings. :param int depth: Frame count to go backward. """ proxies = [] modules = sys.modules module_name = get_frame_locals(depth)['__name__'] module_real = modules[modul...
def proxy_settings_module(depth=3): """Replaces a settings module with a Module proxy to intercept an access to settings. :param int depth: Frame count to go backward. """ proxies = [] modules = sys.modules module_name = get_frame_locals(depth)['__name__'] module_real = modules[modul...
[ "Replaces", "a", "settings", "module", "with", "a", "Module", "proxy", "to", "intercept", "an", "access", "to", "settings", "." ]
idlesign/django-siteprefs
python
https://github.com/idlesign/django-siteprefs/blob/3d6bf5e64220fe921468a36fce68e15d7947cf92/siteprefs/toolbox.py#L222-L246
[ "def", "proxy_settings_module", "(", "depth", "=", "3", ")", ":", "proxies", "=", "[", "]", "modules", "=", "sys", ".", "modules", "module_name", "=", "get_frame_locals", "(", "depth", ")", "[", "'__name__'", "]", "module_real", "=", "modules", "[", "modul...
3d6bf5e64220fe921468a36fce68e15d7947cf92
valid
register_prefs
Registers preferences that should be handled by siteprefs. Expects preferences as *args. Use keyword arguments to batch apply params supported by ``PrefProxy`` to all preferences not constructed by ``pref`` and ``pref_group``. Batch kwargs: :param str|unicode help_text: Field help text. ...
siteprefs/toolbox.py
def register_prefs(*args, **kwargs): """Registers preferences that should be handled by siteprefs. Expects preferences as *args. Use keyword arguments to batch apply params supported by ``PrefProxy`` to all preferences not constructed by ``pref`` and ``pref_group``. Batch kwargs: :param ...
def register_prefs(*args, **kwargs): """Registers preferences that should be handled by siteprefs. Expects preferences as *args. Use keyword arguments to batch apply params supported by ``PrefProxy`` to all preferences not constructed by ``pref`` and ``pref_group``. Batch kwargs: :param ...
[ "Registers", "preferences", "that", "should", "be", "handled", "by", "siteprefs", "." ]
idlesign/django-siteprefs
python
https://github.com/idlesign/django-siteprefs/blob/3d6bf5e64220fe921468a36fce68e15d7947cf92/siteprefs/toolbox.py#L249-L279
[ "def", "register_prefs", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "swap_settings_module", "=", "bool", "(", "kwargs", ".", "get", "(", "'swap_settings_module'", ",", "True", ")", ")", "if", "__PATCHED_LOCALS_SENTINEL", "not", "in", "get_frame_local...
3d6bf5e64220fe921468a36fce68e15d7947cf92
valid
pref_group
Marks preferences group. :param str|unicode title: Group title :param list|tuple prefs: Preferences to group. :param str|unicode help_text: Field help text. :param bool static: Leave this preference static (do not store in DB). :param bool readonly: Make this field read only.
siteprefs/toolbox.py
def pref_group(title, prefs, help_text='', static=True, readonly=False): """Marks preferences group. :param str|unicode title: Group title :param list|tuple prefs: Preferences to group. :param str|unicode help_text: Field help text. :param bool static: Leave this preference static (do not store ...
def pref_group(title, prefs, help_text='', static=True, readonly=False): """Marks preferences group. :param str|unicode title: Group title :param list|tuple prefs: Preferences to group. :param str|unicode help_text: Field help text. :param bool static: Leave this preference static (do not store ...
[ "Marks", "preferences", "group", "." ]
idlesign/django-siteprefs
python
https://github.com/idlesign/django-siteprefs/blob/3d6bf5e64220fe921468a36fce68e15d7947cf92/siteprefs/toolbox.py#L282-L300
[ "def", "pref_group", "(", "title", ",", "prefs", ",", "help_text", "=", "''", ",", "static", "=", "True", ",", "readonly", "=", "False", ")", ":", "bind_proxy", "(", "prefs", ",", "title", ",", "help_text", "=", "help_text", ",", "static", "=", "static...
3d6bf5e64220fe921468a36fce68e15d7947cf92
valid
pref
Marks a preference. :param preference: Preference variable. :param Field field: Django model field to represent this preference. :param str|unicode verbose_name: Field verbose name. :param str|unicode help_text: Field help text. :param bool static: Leave this preference static (do not store in ...
siteprefs/toolbox.py
def pref(preference, field=None, verbose_name=None, help_text='', static=True, readonly=False): """Marks a preference. :param preference: Preference variable. :param Field field: Django model field to represent this preference. :param str|unicode verbose_name: Field verbose name. :param str|unic...
def pref(preference, field=None, verbose_name=None, help_text='', static=True, readonly=False): """Marks a preference. :param preference: Preference variable. :param Field field: Django model field to represent this preference. :param str|unicode verbose_name: Field verbose name. :param str|unic...
[ "Marks", "a", "preference", "." ]
idlesign/django-siteprefs
python
https://github.com/idlesign/django-siteprefs/blob/3d6bf5e64220fe921468a36fce68e15d7947cf92/siteprefs/toolbox.py#L303-L332
[ "def", "pref", "(", "preference", ",", "field", "=", "None", ",", "verbose_name", "=", "None", ",", "help_text", "=", "''", ",", "static", "=", "True", ",", "readonly", "=", "False", ")", ":", "try", ":", "bound", "=", "bind_proxy", "(", "(", "prefer...
3d6bf5e64220fe921468a36fce68e15d7947cf92
valid
ModuleProxy.bind
:param ModuleType module: :param list prefs: Preference names. Just to speed up __getattr__.
siteprefs/toolbox.py
def bind(self, module, prefs): """ :param ModuleType module: :param list prefs: Preference names. Just to speed up __getattr__. """ self._module = module self._prefs = set(prefs)
def bind(self, module, prefs): """ :param ModuleType module: :param list prefs: Preference names. Just to speed up __getattr__. """ self._module = module self._prefs = set(prefs)
[ ":", "param", "ModuleType", "module", ":", ":", "param", "list", "prefs", ":", "Preference", "names", ".", "Just", "to", "speed", "up", "__getattr__", "." ]
idlesign/django-siteprefs
python
https://github.com/idlesign/django-siteprefs/blob/3d6bf5e64220fe921468a36fce68e15d7947cf92/siteprefs/toolbox.py#L203-L209
[ "def", "bind", "(", "self", ",", "module", ",", "prefs", ")", ":", "self", ".", "_module", "=", "module", "self", ".", "_prefs", "=", "set", "(", "prefs", ")" ]
3d6bf5e64220fe921468a36fce68e15d7947cf92
valid
generate_versionwarning_data_json
Generate the ``versionwarning-data.json`` file. This file is included in the output and read by the AJAX request when accessing to the documentation and used to compare the live versions with the curent one. Besides, this file contains meta data about the project, the API to use and the banner its...
versionwarning/signals.py
def generate_versionwarning_data_json(app, config=None, **kwargs): """ Generate the ``versionwarning-data.json`` file. This file is included in the output and read by the AJAX request when accessing to the documentation and used to compare the live versions with the curent one. Besides, this f...
def generate_versionwarning_data_json(app, config=None, **kwargs): """ Generate the ``versionwarning-data.json`` file. This file is included in the output and read by the AJAX request when accessing to the documentation and used to compare the live versions with the curent one. Besides, this f...
[ "Generate", "the", "versionwarning", "-", "data", ".", "json", "file", "." ]
humitos/sphinx-version-warning
python
https://github.com/humitos/sphinx-version-warning/blob/fa6e48eb1dc66f8deea2328ba6f069bf6a808713/versionwarning/signals.py#L11-L73
[ "def", "generate_versionwarning_data_json", "(", "app", ",", "config", "=", "None", ",", "*", "*", "kwargs", ")", ":", "# In Sphinx >= 1.8 we use ``config-initied`` signal which comes with the", "# ``config`` object and in Sphinx < 1.8 we use ``builder-initied`` signal", "# that does...
fa6e48eb1dc66f8deea2328ba6f069bf6a808713
valid
objective
Gives objective functions a number of dimensions and parameter range Parameters ---------- param_scales : (int, int) Scale (std. dev.) for choosing each parameter xstar : array_like Optimal parameters
descent/objectives.py
def objective(param_scales=(1, 1), xstar=None, seed=None): """Gives objective functions a number of dimensions and parameter range Parameters ---------- param_scales : (int, int) Scale (std. dev.) for choosing each parameter xstar : array_like Optimal parameters """ ndim = ...
def objective(param_scales=(1, 1), xstar=None, seed=None): """Gives objective functions a number of dimensions and parameter range Parameters ---------- param_scales : (int, int) Scale (std. dev.) for choosing each parameter xstar : array_like Optimal parameters """ ndim = ...
[ "Gives", "objective", "functions", "a", "number", "of", "dimensions", "and", "parameter", "range" ]
nirum/descent
python
https://github.com/nirum/descent/blob/074c8452f15a0da638668a4fe139fde06ccfae7f/descent/objectives.py#L11-L40
[ "def", "objective", "(", "param_scales", "=", "(", "1", ",", "1", ")", ",", "xstar", "=", "None", ",", "seed", "=", "None", ")", ":", "ndim", "=", "len", "(", "param_scales", ")", "def", "decorator", "(", "func", ")", ":", "@", "wraps", "(", "fun...
074c8452f15a0da638668a4fe139fde06ccfae7f
valid
doublewell
Pointwise minimum of two quadratic bowls
descent/objectives.py
def doublewell(theta): """Pointwise minimum of two quadratic bowls""" k0, k1, depth = 0.01, 100, 0.5 shallow = 0.5 * k0 * theta ** 2 + depth deep = 0.5 * k1 * theta ** 2 obj = float(np.minimum(shallow, deep)) grad = np.where(deep < shallow, k1 * theta, k0 * theta) return obj, grad
def doublewell(theta): """Pointwise minimum of two quadratic bowls""" k0, k1, depth = 0.01, 100, 0.5 shallow = 0.5 * k0 * theta ** 2 + depth deep = 0.5 * k1 * theta ** 2 obj = float(np.minimum(shallow, deep)) grad = np.where(deep < shallow, k1 * theta, k0 * theta) return obj, grad
[ "Pointwise", "minimum", "of", "two", "quadratic", "bowls" ]
nirum/descent
python
https://github.com/nirum/descent/blob/074c8452f15a0da638668a4fe139fde06ccfae7f/descent/objectives.py#L44-L51
[ "def", "doublewell", "(", "theta", ")", ":", "k0", ",", "k1", ",", "depth", "=", "0.01", ",", "100", ",", "0.5", "shallow", "=", "0.5", "*", "k0", "*", "theta", "**", "2", "+", "depth", "deep", "=", "0.5", "*", "k1", "*", "theta", "**", "2", ...
074c8452f15a0da638668a4fe139fde06ccfae7f
valid
rosenbrock
Objective and gradient for the rosenbrock function
descent/objectives.py
def rosenbrock(theta): """Objective and gradient for the rosenbrock function""" x, y = theta obj = (1 - x)**2 + 100 * (y - x**2)**2 grad = np.zeros(2) grad[0] = 2 * x - 400 * (x * y - x**3) - 2 grad[1] = 200 * (y - x**2) return obj, grad
def rosenbrock(theta): """Objective and gradient for the rosenbrock function""" x, y = theta obj = (1 - x)**2 + 100 * (y - x**2)**2 grad = np.zeros(2) grad[0] = 2 * x - 400 * (x * y - x**3) - 2 grad[1] = 200 * (y - x**2) return obj, grad
[ "Objective", "and", "gradient", "for", "the", "rosenbrock", "function" ]
nirum/descent
python
https://github.com/nirum/descent/blob/074c8452f15a0da638668a4fe139fde06ccfae7f/descent/objectives.py#L55-L63
[ "def", "rosenbrock", "(", "theta", ")", ":", "x", ",", "y", "=", "theta", "obj", "=", "(", "1", "-", "x", ")", "**", "2", "+", "100", "*", "(", "y", "-", "x", "**", "2", ")", "**", "2", "grad", "=", "np", ".", "zeros", "(", "2", ")", "g...
074c8452f15a0da638668a4fe139fde06ccfae7f
valid
matyas
Matyas function
descent/objectives.py
def matyas(theta): """Matyas function""" x, y = theta obj = 0.26 * (x ** 2 + y ** 2) - 0.48 * x * y grad = np.array([0.52 * x - 0.48 * y, 0.52 * y - 0.48 * x]) return obj, grad
def matyas(theta): """Matyas function""" x, y = theta obj = 0.26 * (x ** 2 + y ** 2) - 0.48 * x * y grad = np.array([0.52 * x - 0.48 * y, 0.52 * y - 0.48 * x]) return obj, grad
[ "Matyas", "function" ]
nirum/descent
python
https://github.com/nirum/descent/blob/074c8452f15a0da638668a4fe139fde06ccfae7f/descent/objectives.py#L73-L78
[ "def", "matyas", "(", "theta", ")", ":", "x", ",", "y", "=", "theta", "obj", "=", "0.26", "*", "(", "x", "**", "2", "+", "y", "**", "2", ")", "-", "0.48", "*", "x", "*", "y", "grad", "=", "np", ".", "array", "(", "[", "0.52", "*", "x", ...
074c8452f15a0da638668a4fe139fde06ccfae7f
valid
beale
Beale's function
descent/objectives.py
def beale(theta): """Beale's function""" x, y = theta A = 1.5 - x + x * y B = 2.25 - x + x * y**2 C = 2.625 - x + x * y**3 obj = A ** 2 + B ** 2 + C ** 2 grad = np.array([ 2 * A * (y - 1) + 2 * B * (y ** 2 - 1) + 2 * C * (y ** 3 - 1), 2 * A * x + 4 * B * x * y + 6 * C * x * y...
def beale(theta): """Beale's function""" x, y = theta A = 1.5 - x + x * y B = 2.25 - x + x * y**2 C = 2.625 - x + x * y**3 obj = A ** 2 + B ** 2 + C ** 2 grad = np.array([ 2 * A * (y - 1) + 2 * B * (y ** 2 - 1) + 2 * C * (y ** 3 - 1), 2 * A * x + 4 * B * x * y + 6 * C * x * y...
[ "Beale", "s", "function" ]
nirum/descent
python
https://github.com/nirum/descent/blob/074c8452f15a0da638668a4fe139fde06ccfae7f/descent/objectives.py#L82-L93
[ "def", "beale", "(", "theta", ")", ":", "x", ",", "y", "=", "theta", "A", "=", "1.5", "-", "x", "+", "x", "*", "y", "B", "=", "2.25", "-", "x", "+", "x", "*", "y", "**", "2", "C", "=", "2.625", "-", "x", "+", "x", "*", "y", "**", "3",...
074c8452f15a0da638668a4fe139fde06ccfae7f
valid
booth
Booth's function
descent/objectives.py
def booth(theta): """Booth's function""" x, y = theta A = x + 2 * y - 7 B = 2 * x + y - 5 obj = A**2 + B**2 grad = np.array([2 * A + 4 * B, 4 * A + 2 * B]) return obj, grad
def booth(theta): """Booth's function""" x, y = theta A = x + 2 * y - 7 B = 2 * x + y - 5 obj = A**2 + B**2 grad = np.array([2 * A + 4 * B, 4 * A + 2 * B]) return obj, grad
[ "Booth", "s", "function" ]
nirum/descent
python
https://github.com/nirum/descent/blob/074c8452f15a0da638668a4fe139fde06ccfae7f/descent/objectives.py#L97-L105
[ "def", "booth", "(", "theta", ")", ":", "x", ",", "y", "=", "theta", "A", "=", "x", "+", "2", "*", "y", "-", "7", "B", "=", "2", "*", "x", "+", "y", "-", "5", "obj", "=", "A", "**", "2", "+", "B", "**", "2", "grad", "=", "np", ".", ...
074c8452f15a0da638668a4fe139fde06ccfae7f
valid
mccormick
McCormick function
descent/objectives.py
def mccormick(theta): """McCormick function""" x, y = theta obj = np.sin(x + y) + (x - y)**2 - 1.5 * x + 2.5 * y + 1 grad = np.array([np.cos(x + y) + 2 * (x - y) - 1.5, np.cos(x + y) - 2 * (x - y) + 2.5]) return obj, grad
def mccormick(theta): """McCormick function""" x, y = theta obj = np.sin(x + y) + (x - y)**2 - 1.5 * x + 2.5 * y + 1 grad = np.array([np.cos(x + y) + 2 * (x - y) - 1.5, np.cos(x + y) - 2 * (x - y) + 2.5]) return obj, grad
[ "McCormick", "function" ]
nirum/descent
python
https://github.com/nirum/descent/blob/074c8452f15a0da638668a4fe139fde06ccfae7f/descent/objectives.py#L109-L115
[ "def", "mccormick", "(", "theta", ")", ":", "x", ",", "y", "=", "theta", "obj", "=", "np", ".", "sin", "(", "x", "+", "y", ")", "+", "(", "x", "-", "y", ")", "**", "2", "-", "1.5", "*", "x", "+", "2.5", "*", "y", "+", "1", "grad", "=", ...
074c8452f15a0da638668a4fe139fde06ccfae7f
valid
camel
Three-hump camel function
descent/objectives.py
def camel(theta): """Three-hump camel function""" x, y = theta obj = 2 * x ** 2 - 1.05 * x ** 4 + x ** 6 / 6 + x * y + y ** 2 grad = np.array([ 4 * x - 4.2 * x ** 3 + x ** 5 + y, x + 2 * y ]) return obj, grad
def camel(theta): """Three-hump camel function""" x, y = theta obj = 2 * x ** 2 - 1.05 * x ** 4 + x ** 6 / 6 + x * y + y ** 2 grad = np.array([ 4 * x - 4.2 * x ** 3 + x ** 5 + y, x + 2 * y ]) return obj, grad
[ "Three", "-", "hump", "camel", "function" ]
nirum/descent
python
https://github.com/nirum/descent/blob/074c8452f15a0da638668a4fe139fde06ccfae7f/descent/objectives.py#L119-L127
[ "def", "camel", "(", "theta", ")", ":", "x", ",", "y", "=", "theta", "obj", "=", "2", "*", "x", "**", "2", "-", "1.05", "*", "x", "**", "4", "+", "x", "**", "6", "/", "6", "+", "x", "*", "y", "+", "y", "**", "2", "grad", "=", "np", "....
074c8452f15a0da638668a4fe139fde06ccfae7f
valid
michalewicz
Michalewicz function
descent/objectives.py
def michalewicz(theta): """Michalewicz function""" x, y = theta obj = - np.sin(x) * np.sin(x ** 2 / np.pi) ** 20 - \ np.sin(y) * np.sin(2 * y ** 2 / np.pi) ** 20 grad = np.array([ - np.cos(x) * np.sin(x ** 2 / np.pi) ** 20 - (40 / np.pi) * x * np.sin(x) * np.sin(x ** 2 / np.pi) ...
def michalewicz(theta): """Michalewicz function""" x, y = theta obj = - np.sin(x) * np.sin(x ** 2 / np.pi) ** 20 - \ np.sin(y) * np.sin(2 * y ** 2 / np.pi) ** 20 grad = np.array([ - np.cos(x) * np.sin(x ** 2 / np.pi) ** 20 - (40 / np.pi) * x * np.sin(x) * np.sin(x ** 2 / np.pi) ...
[ "Michalewicz", "function" ]
nirum/descent
python
https://github.com/nirum/descent/blob/074c8452f15a0da638668a4fe139fde06ccfae7f/descent/objectives.py#L131-L144
[ "def", "michalewicz", "(", "theta", ")", ":", "x", ",", "y", "=", "theta", "obj", "=", "-", "np", ".", "sin", "(", "x", ")", "*", "np", ".", "sin", "(", "x", "**", "2", "/", "np", ".", "pi", ")", "**", "20", "-", "np", ".", "sin", "(", ...
074c8452f15a0da638668a4fe139fde06ccfae7f
valid
bohachevsky1
One of the Bohachevsky functions
descent/objectives.py
def bohachevsky1(theta): """One of the Bohachevsky functions""" x, y = theta obj = x ** 2 + 2 * y ** 2 - 0.3 * np.cos(3 * np.pi * x) - 0.4 * np.cos(4 * np.pi * y) + 0.7 grad = np.array([ 2 * x + 0.3 * np.sin(3 * np.pi * x) * 3 * np.pi, 4 * y + 0.4 * np.sin(4 * np.pi * y) * 4 * np.pi, ...
def bohachevsky1(theta): """One of the Bohachevsky functions""" x, y = theta obj = x ** 2 + 2 * y ** 2 - 0.3 * np.cos(3 * np.pi * x) - 0.4 * np.cos(4 * np.pi * y) + 0.7 grad = np.array([ 2 * x + 0.3 * np.sin(3 * np.pi * x) * 3 * np.pi, 4 * y + 0.4 * np.sin(4 * np.pi * y) * 4 * np.pi, ...
[ "One", "of", "the", "Bohachevsky", "functions" ]
nirum/descent
python
https://github.com/nirum/descent/blob/074c8452f15a0da638668a4fe139fde06ccfae7f/descent/objectives.py#L148-L156
[ "def", "bohachevsky1", "(", "theta", ")", ":", "x", ",", "y", "=", "theta", "obj", "=", "x", "**", "2", "+", "2", "*", "y", "**", "2", "-", "0.3", "*", "np", ".", "cos", "(", "3", "*", "np", ".", "pi", "*", "x", ")", "-", "0.4", "*", "n...
074c8452f15a0da638668a4fe139fde06ccfae7f
valid
zakharov
Zakharov function
descent/objectives.py
def zakharov(theta): """Zakharov function""" x, y = theta obj = x ** 2 + y ** 2 + (0.5 * x + y) ** 2 + (0.5 * x + y) ** 4 grad = np.array([ 2.5 * x + y + 2 * (0.5 * x + y) ** 3, 4 * y + x + 4 * (0.5 * x + y) ** 3, ]) return obj, grad
def zakharov(theta): """Zakharov function""" x, y = theta obj = x ** 2 + y ** 2 + (0.5 * x + y) ** 2 + (0.5 * x + y) ** 4 grad = np.array([ 2.5 * x + y + 2 * (0.5 * x + y) ** 3, 4 * y + x + 4 * (0.5 * x + y) ** 3, ]) return obj, grad
[ "Zakharov", "function" ]
nirum/descent
python
https://github.com/nirum/descent/blob/074c8452f15a0da638668a4fe139fde06ccfae7f/descent/objectives.py#L160-L168
[ "def", "zakharov", "(", "theta", ")", ":", "x", ",", "y", "=", "theta", "obj", "=", "x", "**", "2", "+", "y", "**", "2", "+", "(", "0.5", "*", "x", "+", "y", ")", "**", "2", "+", "(", "0.5", "*", "x", "+", "y", ")", "**", "4", "grad", ...
074c8452f15a0da638668a4fe139fde06ccfae7f
valid
dixon_price
Dixon-Price function
descent/objectives.py
def dixon_price(theta): """Dixon-Price function""" x, y = theta obj = (x - 1) ** 2 + 2 * (2 * y ** 2 - x) ** 2 grad = np.array([ 2 * x - 2 - 4 * (2 * y ** 2 - x), 16 * (2 * y ** 2 - x) * y, ]) return obj, grad
def dixon_price(theta): """Dixon-Price function""" x, y = theta obj = (x - 1) ** 2 + 2 * (2 * y ** 2 - x) ** 2 grad = np.array([ 2 * x - 2 - 4 * (2 * y ** 2 - x), 16 * (2 * y ** 2 - x) * y, ]) return obj, grad
[ "Dixon", "-", "Price", "function" ]
nirum/descent
python
https://github.com/nirum/descent/blob/074c8452f15a0da638668a4fe139fde06ccfae7f/descent/objectives.py#L172-L180
[ "def", "dixon_price", "(", "theta", ")", ":", "x", ",", "y", "=", "theta", "obj", "=", "(", "x", "-", "1", ")", "**", "2", "+", "2", "*", "(", "2", "*", "y", "**", "2", "-", "x", ")", "**", "2", "grad", "=", "np", ".", "array", "(", "["...
074c8452f15a0da638668a4fe139fde06ccfae7f
valid
goldstein_price
Goldstein-Price function
descent/objectives.py
def goldstein_price(theta): """Goldstein-Price function""" x, y = theta obj = (1 + (x + y + 1) ** 2 * (19 - 14 * x + 3 * x ** 2 - 14 * y + 6 * x * y + 3 * y ** 2)) * \ (30 + (2 * x - 3 * y) ** 2 * (18 - 32 * x + 12 * x ** 2 + 48 * y - 36 * x * y + 27 * x ** 2)) grad = np.array([ ...
def goldstein_price(theta): """Goldstein-Price function""" x, y = theta obj = (1 + (x + y + 1) ** 2 * (19 - 14 * x + 3 * x ** 2 - 14 * y + 6 * x * y + 3 * y ** 2)) * \ (30 + (2 * x - 3 * y) ** 2 * (18 - 32 * x + 12 * x ** 2 + 48 * y - 36 * x * y + 27 * x ** 2)) grad = np.array([ ...
[ "Goldstein", "-", "Price", "function" ]
nirum/descent
python
https://github.com/nirum/descent/blob/074c8452f15a0da638668a4fe139fde06ccfae7f/descent/objectives.py#L184-L205
[ "def", "goldstein_price", "(", "theta", ")", ":", "x", ",", "y", "=", "theta", "obj", "=", "(", "1", "+", "(", "x", "+", "y", "+", "1", ")", "**", "2", "*", "(", "19", "-", "14", "*", "x", "+", "3", "*", "x", "**", "2", "-", "14", "*", ...
074c8452f15a0da638668a4fe139fde06ccfae7f
valid
styblinski_tang
Styblinski-Tang function
descent/objectives.py
def styblinski_tang(theta): """Styblinski-Tang function""" x, y = theta obj = 0.5 * (x ** 4 - 16 * x ** 2 + 5 * x + y ** 4 - 16 * y ** 2 + 5 * y) grad = np.array([ 2 * x ** 3 - 16 * x + 2.5, 2 * y ** 3 - 16 * y + 2.5, ]) return obj, grad
def styblinski_tang(theta): """Styblinski-Tang function""" x, y = theta obj = 0.5 * (x ** 4 - 16 * x ** 2 + 5 * x + y ** 4 - 16 * y ** 2 + 5 * y) grad = np.array([ 2 * x ** 3 - 16 * x + 2.5, 2 * y ** 3 - 16 * y + 2.5, ]) return obj, grad
[ "Styblinski", "-", "Tang", "function" ]
nirum/descent
python
https://github.com/nirum/descent/blob/074c8452f15a0da638668a4fe139fde06ccfae7f/descent/objectives.py#L209-L217
[ "def", "styblinski_tang", "(", "theta", ")", ":", "x", ",", "y", "=", "theta", "obj", "=", "0.5", "*", "(", "x", "**", "4", "-", "16", "*", "x", "**", "2", "+", "5", "*", "x", "+", "y", "**", "4", "-", "16", "*", "y", "**", "2", "+", "5...
074c8452f15a0da638668a4fe139fde06ccfae7f
valid
S3Connection.get_all_buckets
Return a list of buckets in MimicDB. :param boolean force: If true, API call is forced to S3
mimicdb/s3/connection.py
def get_all_buckets(self, *args, **kwargs): """Return a list of buckets in MimicDB. :param boolean force: If true, API call is forced to S3 """ if kwargs.pop('force', None): buckets = super(S3Connection, self).get_all_buckets(*args, **kwargs) for bucket in bucke...
def get_all_buckets(self, *args, **kwargs): """Return a list of buckets in MimicDB. :param boolean force: If true, API call is forced to S3 """ if kwargs.pop('force', None): buckets = super(S3Connection, self).get_all_buckets(*args, **kwargs) for bucket in bucke...
[ "Return", "a", "list", "of", "buckets", "in", "MimicDB", "." ]
nathancahill/mimicdb
python
https://github.com/nathancahill/mimicdb/blob/9d0e8ebcba31d937f73752f9b88e5a4fec860765/mimicdb/s3/connection.py#L20-L33
[ "def", "get_all_buckets", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "if", "kwargs", ".", "pop", "(", "'force'", ",", "None", ")", ":", "buckets", "=", "super", "(", "S3Connection", ",", "self", ")", ".", "get_all_buckets", "("...
9d0e8ebcba31d937f73752f9b88e5a4fec860765
valid
S3Connection.get_bucket
Return a bucket from MimicDB if it exists. Return a S3ResponseError if the bucket does not exist and validate is passed. :param boolean force: If true, API call is forced to S3
mimicdb/s3/connection.py
def get_bucket(self, bucket_name, validate=True, headers=None, force=None): """Return a bucket from MimicDB if it exists. Return a S3ResponseError if the bucket does not exist and validate is passed. :param boolean force: If true, API call is forced to S3 """ if force: ...
def get_bucket(self, bucket_name, validate=True, headers=None, force=None): """Return a bucket from MimicDB if it exists. Return a S3ResponseError if the bucket does not exist and validate is passed. :param boolean force: If true, API call is forced to S3 """ if force: ...
[ "Return", "a", "bucket", "from", "MimicDB", "if", "it", "exists", ".", "Return", "a", "S3ResponseError", "if", "the", "bucket", "does", "not", "exist", "and", "validate", "is", "passed", "." ]
nathancahill/mimicdb
python
https://github.com/nathancahill/mimicdb/blob/9d0e8ebcba31d937f73752f9b88e5a4fec860765/mimicdb/s3/connection.py#L35-L52
[ "def", "get_bucket", "(", "self", ",", "bucket_name", ",", "validate", "=", "True", ",", "headers", "=", "None", ",", "force", "=", "None", ")", ":", "if", "force", ":", "bucket", "=", "super", "(", "S3Connection", ",", "self", ")", ".", "get_bucket", ...
9d0e8ebcba31d937f73752f9b88e5a4fec860765
valid
S3Connection.create_bucket
Add the bucket to MimicDB after successful creation.
mimicdb/s3/connection.py
def create_bucket(self, *args, **kwargs): """Add the bucket to MimicDB after successful creation. """ bucket = super(S3Connection, self).create_bucket(*args, **kwargs) if bucket: mimicdb.backend.sadd(tpl.connection, bucket.name) return bucket
def create_bucket(self, *args, **kwargs): """Add the bucket to MimicDB after successful creation. """ bucket = super(S3Connection, self).create_bucket(*args, **kwargs) if bucket: mimicdb.backend.sadd(tpl.connection, bucket.name) return bucket
[ "Add", "the", "bucket", "to", "MimicDB", "after", "successful", "creation", "." ]
nathancahill/mimicdb
python
https://github.com/nathancahill/mimicdb/blob/9d0e8ebcba31d937f73752f9b88e5a4fec860765/mimicdb/s3/connection.py#L54-L62
[ "def", "create_bucket", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "bucket", "=", "super", "(", "S3Connection", ",", "self", ")", ".", "create_bucket", "(", "*", "args", ",", "*", "*", "kwargs", ")", "if", "bucket", ":", "mim...
9d0e8ebcba31d937f73752f9b88e5a4fec860765
valid
S3Connection.delete_bucket
Delete the bucket on S3 before removing it from MimicDB. If the delete fails (usually because the bucket is not empty), do not remove the bucket from the set.
mimicdb/s3/connection.py
def delete_bucket(self, *args, **kwargs): """Delete the bucket on S3 before removing it from MimicDB. If the delete fails (usually because the bucket is not empty), do not remove the bucket from the set. """ super(S3Connection, self).delete_bucket(*args, **kwargs) bucket...
def delete_bucket(self, *args, **kwargs): """Delete the bucket on S3 before removing it from MimicDB. If the delete fails (usually because the bucket is not empty), do not remove the bucket from the set. """ super(S3Connection, self).delete_bucket(*args, **kwargs) bucket...
[ "Delete", "the", "bucket", "on", "S3", "before", "removing", "it", "from", "MimicDB", ".", "If", "the", "delete", "fails", "(", "usually", "because", "the", "bucket", "is", "not", "empty", ")", "do", "not", "remove", "the", "bucket", "from", "the", "set"...
nathancahill/mimicdb
python
https://github.com/nathancahill/mimicdb/blob/9d0e8ebcba31d937f73752f9b88e5a4fec860765/mimicdb/s3/connection.py#L64-L74
[ "def", "delete_bucket", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "super", "(", "S3Connection", ",", "self", ")", ".", "delete_bucket", "(", "*", "args", ",", "*", "*", "kwargs", ")", "bucket", "=", "kwargs", ".", "get", "("...
9d0e8ebcba31d937f73752f9b88e5a4fec860765
valid
S3Connection.sync
Sync either a list of buckets or the entire connection. Force all API calls to S3 and populate the database with the current state of S3. :param \*string \*buckets: Buckets to sync
mimicdb/s3/connection.py
def sync(self, *buckets): """Sync either a list of buckets or the entire connection. Force all API calls to S3 and populate the database with the current state of S3. :param \*string \*buckets: Buckets to sync """ if buckets: for _bucket in buckets: ...
def sync(self, *buckets): """Sync either a list of buckets or the entire connection. Force all API calls to S3 and populate the database with the current state of S3. :param \*string \*buckets: Buckets to sync """ if buckets: for _bucket in buckets: ...
[ "Sync", "either", "a", "list", "of", "buckets", "or", "the", "entire", "connection", "." ]
nathancahill/mimicdb
python
https://github.com/nathancahill/mimicdb/blob/9d0e8ebcba31d937f73752f9b88e5a4fec860765/mimicdb/s3/connection.py#L76-L106
[ "def", "sync", "(", "self", ",", "*", "buckets", ")", ":", "if", "buckets", ":", "for", "_bucket", "in", "buckets", ":", "for", "key", "in", "mimicdb", ".", "backend", ".", "smembers", "(", "tpl", ".", "bucket", "%", "_bucket", ")", ":", "mimicdb", ...
9d0e8ebcba31d937f73752f9b88e5a4fec860765
valid
Bucket.get_key
Return the key from MimicDB. :param boolean force: If true, API call is forced to S3
mimicdb/s3/bucket.py
def get_key(self, *args, **kwargs): """Return the key from MimicDB. :param boolean force: If true, API call is forced to S3 """ if kwargs.pop('force', None): headers = kwargs.get('headers', {}) headers['force'] = True kwargs['headers'] = headers ...
def get_key(self, *args, **kwargs): """Return the key from MimicDB. :param boolean force: If true, API call is forced to S3 """ if kwargs.pop('force', None): headers = kwargs.get('headers', {}) headers['force'] = True kwargs['headers'] = headers ...
[ "Return", "the", "key", "from", "MimicDB", "." ]
nathancahill/mimicdb
python
https://github.com/nathancahill/mimicdb/blob/9d0e8ebcba31d937f73752f9b88e5a4fec860765/mimicdb/s3/bucket.py#L26-L36
[ "def", "get_key", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "if", "kwargs", ".", "pop", "(", "'force'", ",", "None", ")", ":", "headers", "=", "kwargs", ".", "get", "(", "'headers'", ",", "{", "}", ")", "headers", "[", "...
9d0e8ebcba31d937f73752f9b88e5a4fec860765
valid
Bucket._get_key_internal
Return None if key is not in the bucket set. Pass 'force' in the headers to check S3 for the key, and after fetching the key from S3, save the metadata and key to the bucket set.
mimicdb/s3/bucket.py
def _get_key_internal(self, *args, **kwargs): """Return None if key is not in the bucket set. Pass 'force' in the headers to check S3 for the key, and after fetching the key from S3, save the metadata and key to the bucket set. """ if args[1] is not None and 'force' in args[1]: ...
def _get_key_internal(self, *args, **kwargs): """Return None if key is not in the bucket set. Pass 'force' in the headers to check S3 for the key, and after fetching the key from S3, save the metadata and key to the bucket set. """ if args[1] is not None and 'force' in args[1]: ...
[ "Return", "None", "if", "key", "is", "not", "in", "the", "bucket", "set", "." ]
nathancahill/mimicdb
python
https://github.com/nathancahill/mimicdb/blob/9d0e8ebcba31d937f73752f9b88e5a4fec860765/mimicdb/s3/bucket.py#L38-L60
[ "def", "_get_key_internal", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "if", "args", "[", "1", "]", "is", "not", "None", "and", "'force'", "in", "args", "[", "1", "]", ":", "key", ",", "res", "=", "super", "(", "Bucket", ...
9d0e8ebcba31d937f73752f9b88e5a4fec860765
valid
Bucket.get_all_keys
Return a list of keys from MimicDB. :param boolean force: If true, API call is forced to S3
mimicdb/s3/bucket.py
def get_all_keys(self, *args, **kwargs): """Return a list of keys from MimicDB. :param boolean force: If true, API call is forced to S3 """ if kwargs.pop('force', None): headers = kwargs.get('headers', args[0] if len(args) else None) or dict() headers['force'] = ...
def get_all_keys(self, *args, **kwargs): """Return a list of keys from MimicDB. :param boolean force: If true, API call is forced to S3 """ if kwargs.pop('force', None): headers = kwargs.get('headers', args[0] if len(args) else None) or dict() headers['force'] = ...
[ "Return", "a", "list", "of", "keys", "from", "MimicDB", "." ]
nathancahill/mimicdb
python
https://github.com/nathancahill/mimicdb/blob/9d0e8ebcba31d937f73752f9b88e5a4fec860765/mimicdb/s3/bucket.py#L62-L72
[ "def", "get_all_keys", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "if", "kwargs", ".", "pop", "(", "'force'", ",", "None", ")", ":", "headers", "=", "kwargs", ".", "get", "(", "'headers'", ",", "args", "[", "0", "]", "if", ...
9d0e8ebcba31d937f73752f9b88e5a4fec860765
valid
Bucket.delete_keys
Remove each key or key name in an iterable from the bucket set.
mimicdb/s3/bucket.py
def delete_keys(self, *args, **kwargs): """Remove each key or key name in an iterable from the bucket set. """ ikeys = iter(kwargs.get('keys', args[0] if args else [])) while True: try: key = ikeys.next() except StopIteration: brea...
def delete_keys(self, *args, **kwargs): """Remove each key or key name in an iterable from the bucket set. """ ikeys = iter(kwargs.get('keys', args[0] if args else [])) while True: try: key = ikeys.next() except StopIteration: brea...
[ "Remove", "each", "key", "or", "key", "name", "in", "an", "iterable", "from", "the", "bucket", "set", "." ]
nathancahill/mimicdb
python
https://github.com/nathancahill/mimicdb/blob/9d0e8ebcba31d937f73752f9b88e5a4fec860765/mimicdb/s3/bucket.py#L74-L92
[ "def", "delete_keys", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "ikeys", "=", "iter", "(", "kwargs", ".", "get", "(", "'keys'", ",", "args", "[", "0", "]", "if", "args", "else", "[", "]", ")", ")", "while", "True", ":", ...
9d0e8ebcba31d937f73752f9b88e5a4fec860765
valid
Bucket._delete_key_internal
Remove key name from bucket set.
mimicdb/s3/bucket.py
def _delete_key_internal(self, *args, **kwargs): """Remove key name from bucket set. """ mimicdb.backend.srem(tpl.bucket % self.name, args[0]) mimicdb.backend.delete(tpl.key % (self.name, args[0])) return super(Bucket, self)._delete_key_internal(*args, **kwargs)
def _delete_key_internal(self, *args, **kwargs): """Remove key name from bucket set. """ mimicdb.backend.srem(tpl.bucket % self.name, args[0]) mimicdb.backend.delete(tpl.key % (self.name, args[0])) return super(Bucket, self)._delete_key_internal(*args, **kwargs)
[ "Remove", "key", "name", "from", "bucket", "set", "." ]
nathancahill/mimicdb
python
https://github.com/nathancahill/mimicdb/blob/9d0e8ebcba31d937f73752f9b88e5a4fec860765/mimicdb/s3/bucket.py#L94-L100
[ "def", "_delete_key_internal", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "mimicdb", ".", "backend", ".", "srem", "(", "tpl", ".", "bucket", "%", "self", ".", "name", ",", "args", "[", "0", "]", ")", "mimicdb", ".", "backend"...
9d0e8ebcba31d937f73752f9b88e5a4fec860765
valid
Bucket.list
Return an iterable of keys from MimicDB. :param boolean force: If true, API call is forced to S3
mimicdb/s3/bucket.py
def list(self, *args, **kwargs): """Return an iterable of keys from MimicDB. :param boolean force: If true, API call is forced to S3 """ if kwargs.pop('force', None): headers = kwargs.get('headers', args[4] if len(args) > 4 else None) or dict() headers['force'] =...
def list(self, *args, **kwargs): """Return an iterable of keys from MimicDB. :param boolean force: If true, API call is forced to S3 """ if kwargs.pop('force', None): headers = kwargs.get('headers', args[4] if len(args) > 4 else None) or dict() headers['force'] =...
[ "Return", "an", "iterable", "of", "keys", "from", "MimicDB", "." ]
nathancahill/mimicdb
python
https://github.com/nathancahill/mimicdb/blob/9d0e8ebcba31d937f73752f9b88e5a4fec860765/mimicdb/s3/bucket.py#L102-L127
[ "def", "list", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "if", "kwargs", ".", "pop", "(", "'force'", ",", "None", ")", ":", "headers", "=", "kwargs", ".", "get", "(", "'headers'", ",", "args", "[", "4", "]", "if", "len",...
9d0e8ebcba31d937f73752f9b88e5a4fec860765
valid
Bucket._get_all
If 'force' is in the headers, retrieve the list of keys from S3. Otherwise, use the list() function to retrieve the keys from MimicDB.
mimicdb/s3/bucket.py
def _get_all(self, *args, **kwargs): """If 'force' is in the headers, retrieve the list of keys from S3. Otherwise, use the list() function to retrieve the keys from MimicDB. """ headers = kwargs.get('headers', args[2] if len(args) > 2 else None) or dict() if 'force' in headers:...
def _get_all(self, *args, **kwargs): """If 'force' is in the headers, retrieve the list of keys from S3. Otherwise, use the list() function to retrieve the keys from MimicDB. """ headers = kwargs.get('headers', args[2] if len(args) > 2 else None) or dict() if 'force' in headers:...
[ "If", "force", "is", "in", "the", "headers", "retrieve", "the", "list", "of", "keys", "from", "S3", ".", "Otherwise", "use", "the", "list", "()", "function", "to", "retrieve", "the", "keys", "from", "MimicDB", "." ]
nathancahill/mimicdb
python
https://github.com/nathancahill/mimicdb/blob/9d0e8ebcba31d937f73752f9b88e5a4fec860765/mimicdb/s3/bucket.py#L129-L148
[ "def", "_get_all", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "headers", "=", "kwargs", ".", "get", "(", "'headers'", ",", "args", "[", "2", "]", "if", "len", "(", "args", ")", ">", "2", "else", "None", ")", "or", "dict",...
9d0e8ebcba31d937f73752f9b88e5a4fec860765
valid
Bucket.sync
Sync a bucket. Force all API calls to S3 and populate the database with the current state of S3.
mimicdb/s3/bucket.py
def sync(self): """Sync a bucket. Force all API calls to S3 and populate the database with the current state of S3. """ for key in mimicdb.backend.smembers(tpl.bucket % self.name): mimicdb.backend.delete(tpl.key % (self.name, key)) mimicdb.backend.delete(tpl.bucket ...
def sync(self): """Sync a bucket. Force all API calls to S3 and populate the database with the current state of S3. """ for key in mimicdb.backend.smembers(tpl.bucket % self.name): mimicdb.backend.delete(tpl.key % (self.name, key)) mimicdb.backend.delete(tpl.bucket ...
[ "Sync", "a", "bucket", "." ]
nathancahill/mimicdb
python
https://github.com/nathancahill/mimicdb/blob/9d0e8ebcba31d937f73752f9b88e5a4fec860765/mimicdb/s3/bucket.py#L150-L163
[ "def", "sync", "(", "self", ")", ":", "for", "key", "in", "mimicdb", ".", "backend", ".", "smembers", "(", "tpl", ".", "bucket", "%", "self", ".", "name", ")", ":", "mimicdb", ".", "backend", ".", "delete", "(", "tpl", ".", "key", "%", "(", "self...
9d0e8ebcba31d937f73752f9b88e5a4fec860765
valid
nucnorm
Nuclear norm Parameters ---------- penalty : float nuclear norm penalty hyperparameter newshape : tuple, optional Desired shape of the parameters to apply the nuclear norm to. The given parameters are reshaped to an array with this shape, or not reshaped if the value of...
descent/proxops.py
def nucnorm(x, rho, penalty, newshape=None): """ Nuclear norm Parameters ---------- penalty : float nuclear norm penalty hyperparameter newshape : tuple, optional Desired shape of the parameters to apply the nuclear norm to. The given parameters are reshaped to an array...
def nucnorm(x, rho, penalty, newshape=None): """ Nuclear norm Parameters ---------- penalty : float nuclear norm penalty hyperparameter newshape : tuple, optional Desired shape of the parameters to apply the nuclear norm to. The given parameters are reshaped to an array...
[ "Nuclear", "norm" ]
nirum/descent
python
https://github.com/nirum/descent/blob/074c8452f15a0da638668a4fe139fde06ccfae7f/descent/proxops.py#L62-L85
[ "def", "nucnorm", "(", "x", ",", "rho", ",", "penalty", ",", "newshape", "=", "None", ")", ":", "orig_shape", "=", "x", ".", "shape", "if", "newshape", "is", "not", "None", ":", "x", "=", "x", ".", "reshape", "(", "newshape", ")", "u", ",", "s", ...
074c8452f15a0da638668a4fe139fde06ccfae7f
valid
sparse
Proximal operator for the l1-norm: soft thresholding Parameters ---------- penalty : float Strength or weight on the l1-norm
descent/proxops.py
def sparse(x, rho, penalty): """ Proximal operator for the l1-norm: soft thresholding Parameters ---------- penalty : float Strength or weight on the l1-norm """ lmbda = penalty / rho return (x - lmbda) * (x >= lmbda) + (x + lmbda) * (x <= -lmbda)
def sparse(x, rho, penalty): """ Proximal operator for the l1-norm: soft thresholding Parameters ---------- penalty : float Strength or weight on the l1-norm """ lmbda = penalty / rho return (x - lmbda) * (x >= lmbda) + (x + lmbda) * (x <= -lmbda)
[ "Proximal", "operator", "for", "the", "l1", "-", "norm", ":", "soft", "thresholding" ]
nirum/descent
python
https://github.com/nirum/descent/blob/074c8452f15a0da638668a4fe139fde06ccfae7f/descent/proxops.py#L89-L100
[ "def", "sparse", "(", "x", ",", "rho", ",", "penalty", ")", ":", "lmbda", "=", "penalty", "/", "rho", "return", "(", "x", "-", "lmbda", ")", "*", "(", "x", ">=", "lmbda", ")", "+", "(", "x", "+", "lmbda", ")", "*", "(", "x", "<=", "-", "lmb...
074c8452f15a0da638668a4fe139fde06ccfae7f
valid
lbfgs
Minimize the proximal operator of a given objective using L-BFGS Parameters ---------- f_df : function Returns the objective and gradient of the function to minimize maxiter : int Maximum number of L-BFGS iterations
descent/proxops.py
def lbfgs(x, rho, f_df, maxiter=20): """ Minimize the proximal operator of a given objective using L-BFGS Parameters ---------- f_df : function Returns the objective and gradient of the function to minimize maxiter : int Maximum number of L-BFGS iterations """ def f_df...
def lbfgs(x, rho, f_df, maxiter=20): """ Minimize the proximal operator of a given objective using L-BFGS Parameters ---------- f_df : function Returns the objective and gradient of the function to minimize maxiter : int Maximum number of L-BFGS iterations """ def f_df...
[ "Minimize", "the", "proximal", "operator", "of", "a", "given", "objective", "using", "L", "-", "BFGS" ]
nirum/descent
python
https://github.com/nirum/descent/blob/074c8452f15a0da638668a4fe139fde06ccfae7f/descent/proxops.py#L141-L163
[ "def", "lbfgs", "(", "x", ",", "rho", ",", "f_df", ",", "maxiter", "=", "20", ")", ":", "def", "f_df_augmented", "(", "theta", ")", ":", "f", ",", "df", "=", "f_df", "(", "theta", ")", "obj", "=", "f", "+", "(", "rho", "/", "2.", ")", "*", ...
074c8452f15a0da638668a4fe139fde06ccfae7f
valid
smooth
Applies a smoothing operator along one dimension currently only accepts a matrix as input Parameters ---------- penalty : float axis : int, optional Axis along which to apply the smoothing (Default: 0) newshape : tuple, optional Desired shape of the parameters to apply the nu...
descent/proxops.py
def smooth(x, rho, penalty, axis=0, newshape=None): """ Applies a smoothing operator along one dimension currently only accepts a matrix as input Parameters ---------- penalty : float axis : int, optional Axis along which to apply the smoothing (Default: 0) newshape : tuple, ...
def smooth(x, rho, penalty, axis=0, newshape=None): """ Applies a smoothing operator along one dimension currently only accepts a matrix as input Parameters ---------- penalty : float axis : int, optional Axis along which to apply the smoothing (Default: 0) newshape : tuple, ...
[ "Applies", "a", "smoothing", "operator", "along", "one", "dimension" ]
nirum/descent
python
https://github.com/nirum/descent/blob/074c8452f15a0da638668a4fe139fde06ccfae7f/descent/proxops.py#L186-L219
[ "def", "smooth", "(", "x", ",", "rho", ",", "penalty", ",", "axis", "=", "0", ",", "newshape", "=", "None", ")", ":", "orig_shape", "=", "x", ".", "shape", "if", "newshape", "is", "not", "None", ":", "x", "=", "x", ".", "reshape", "(", "newshape"...
074c8452f15a0da638668a4fe139fde06ccfae7f
valid
sdcone
Projection onto the semidefinite cone
descent/proxops.py
def sdcone(x, rho): """Projection onto the semidefinite cone""" U, V = np.linalg.eigh(x) return V.dot(np.diag(np.maximum(U, 0)).dot(V.T))
def sdcone(x, rho): """Projection onto the semidefinite cone""" U, V = np.linalg.eigh(x) return V.dot(np.diag(np.maximum(U, 0)).dot(V.T))
[ "Projection", "onto", "the", "semidefinite", "cone" ]
nirum/descent
python
https://github.com/nirum/descent/blob/074c8452f15a0da638668a4fe139fde06ccfae7f/descent/proxops.py#L223-L226
[ "def", "sdcone", "(", "x", ",", "rho", ")", ":", "U", ",", "V", "=", "np", ".", "linalg", ".", "eigh", "(", "x", ")", "return", "V", ".", "dot", "(", "np", ".", "diag", "(", "np", ".", "maximum", "(", "U", ",", "0", ")", ")", ".", "dot", ...
074c8452f15a0da638668a4fe139fde06ccfae7f
valid
simplex
Projection onto the probability simplex http://arxiv.org/pdf/1309.1541v1.pdf
descent/proxops.py
def simplex(x, rho): """ Projection onto the probability simplex http://arxiv.org/pdf/1309.1541v1.pdf """ # sort the elements in descending order u = np.flipud(np.sort(x.ravel())) lambdas = (1 - np.cumsum(u)) / (1. + np.arange(u.size)) ix = np.where(u + lambdas > 0)[0].max() return...
def simplex(x, rho): """ Projection onto the probability simplex http://arxiv.org/pdf/1309.1541v1.pdf """ # sort the elements in descending order u = np.flipud(np.sort(x.ravel())) lambdas = (1 - np.cumsum(u)) / (1. + np.arange(u.size)) ix = np.where(u + lambdas > 0)[0].max() return...
[ "Projection", "onto", "the", "probability", "simplex" ]
nirum/descent
python
https://github.com/nirum/descent/blob/074c8452f15a0da638668a4fe139fde06ccfae7f/descent/proxops.py#L236-L247
[ "def", "simplex", "(", "x", ",", "rho", ")", ":", "# sort the elements in descending order", "u", "=", "np", ".", "flipud", "(", "np", ".", "sort", "(", "x", ".", "ravel", "(", ")", ")", ")", "lambdas", "=", "(", "1", "-", "np", ".", "cumsum", "(",...
074c8452f15a0da638668a4fe139fde06ccfae7f
valid
columns
Applies a proximal operator to the columns of a matrix
descent/proxops.py
def columns(x, rho, proxop): """Applies a proximal operator to the columns of a matrix""" xnext = np.zeros_like(x) for ix in range(x.shape[1]): xnext[:, ix] = proxop(x[:, ix], rho) return xnext
def columns(x, rho, proxop): """Applies a proximal operator to the columns of a matrix""" xnext = np.zeros_like(x) for ix in range(x.shape[1]): xnext[:, ix] = proxop(x[:, ix], rho) return xnext
[ "Applies", "a", "proximal", "operator", "to", "the", "columns", "of", "a", "matrix" ]
nirum/descent
python
https://github.com/nirum/descent/blob/074c8452f15a0da638668a4fe139fde06ccfae7f/descent/proxops.py#L251-L259
[ "def", "columns", "(", "x", ",", "rho", ",", "proxop", ")", ":", "xnext", "=", "np", ".", "zeros_like", "(", "x", ")", "for", "ix", "in", "range", "(", "x", ".", "shape", "[", "1", "]", ")", ":", "xnext", "[", ":", ",", "ix", "]", "=", "pro...
074c8452f15a0da638668a4fe139fde06ccfae7f
valid
fantope
Projection onto the fantope [1]_ .. [1] Vu, Vincent Q., et al. "Fantope projection and selection: A near-optimal convex relaxation of sparse PCA." Advances in neural information processing systems. 2013.
descent/proxops.py
def fantope(x, rho, dim, tol=1e-4): """ Projection onto the fantope [1]_ .. [1] Vu, Vincent Q., et al. "Fantope projection and selection: A near-optimal convex relaxation of sparse PCA." Advances in neural information processing systems. 2013. """ U, V = np.linalg.eigh(x) ...
def fantope(x, rho, dim, tol=1e-4): """ Projection onto the fantope [1]_ .. [1] Vu, Vincent Q., et al. "Fantope projection and selection: A near-optimal convex relaxation of sparse PCA." Advances in neural information processing systems. 2013. """ U, V = np.linalg.eigh(x) ...
[ "Projection", "onto", "the", "fantope", "[", "1", "]", "_" ]
nirum/descent
python
https://github.com/nirum/descent/blob/074c8452f15a0da638668a4fe139fde06ccfae7f/descent/proxops.py#L269-L300
[ "def", "fantope", "(", "x", ",", "rho", ",", "dim", ",", "tol", "=", "1e-4", ")", ":", "U", ",", "V", "=", "np", ".", "linalg", ".", "eigh", "(", "x", ")", "minval", ",", "maxval", "=", "np", ".", "maximum", "(", "U", ".", "min", "(", ")", ...
074c8452f15a0da638668a4fe139fde06ccfae7f
valid
gradient_optimizer
Turns a coroutine into a gradient based optimizer.
descent/main.py
def gradient_optimizer(coro): """Turns a coroutine into a gradient based optimizer.""" class GradientOptimizer(Optimizer): @wraps(coro) def __init__(self, *args, **kwargs): self.algorithm = coro(*args, **kwargs) self.algorithm.send(None) self.operators = [] ...
def gradient_optimizer(coro): """Turns a coroutine into a gradient based optimizer.""" class GradientOptimizer(Optimizer): @wraps(coro) def __init__(self, *args, **kwargs): self.algorithm = coro(*args, **kwargs) self.algorithm.send(None) self.operators = [] ...
[ "Turns", "a", "coroutine", "into", "a", "gradient", "based", "optimizer", "." ]
nirum/descent
python
https://github.com/nirum/descent/blob/074c8452f15a0da638668a4fe139fde06ccfae7f/descent/main.py#L121-L194
[ "def", "gradient_optimizer", "(", "coro", ")", ":", "class", "GradientOptimizer", "(", "Optimizer", ")", ":", "@", "wraps", "(", "coro", ")", "def", "__init__", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "self", ".", "algorithm",...
074c8452f15a0da638668a4fe139fde06ccfae7f
valid
Optimizer.add
Adds a proximal operator to the list of operators
descent/main.py
def add(self, operator, *args): """Adds a proximal operator to the list of operators""" if isinstance(operator, str): op = getattr(proxops, operator)(*args) elif isinstance(operator, proxops.ProximalOperatorBaseClass): op = operator else: raise ValueE...
def add(self, operator, *args): """Adds a proximal operator to the list of operators""" if isinstance(operator, str): op = getattr(proxops, operator)(*args) elif isinstance(operator, proxops.ProximalOperatorBaseClass): op = operator else: raise ValueE...
[ "Adds", "a", "proximal", "operator", "to", "the", "list", "of", "operators" ]
nirum/descent
python
https://github.com/nirum/descent/blob/074c8452f15a0da638668a4fe139fde06ccfae7f/descent/main.py#L29-L40
[ "def", "add", "(", "self", ",", "operator", ",", "*", "args", ")", ":", "if", "isinstance", "(", "operator", ",", "str", ")", ":", "op", "=", "getattr", "(", "proxops", ",", "operator", ")", "(", "*", "args", ")", "elif", "isinstance", "(", "operat...
074c8452f15a0da638668a4fe139fde06ccfae7f
valid
Key._load_meta
Set key attributes to retrived metadata. Might be extended in the future to support more attributes.
mimicdb/s3/key.py
def _load_meta(self, size, md5): """Set key attributes to retrived metadata. Might be extended in the future to support more attributes. """ if not hasattr(self, 'local_hashes'): self.local_hashes = {} self.size = int(size) if (re.match('^[a-fA-F0-9]{32}$', ...
def _load_meta(self, size, md5): """Set key attributes to retrived metadata. Might be extended in the future to support more attributes. """ if not hasattr(self, 'local_hashes'): self.local_hashes = {} self.size = int(size) if (re.match('^[a-fA-F0-9]{32}$', ...
[ "Set", "key", "attributes", "to", "retrived", "metadata", ".", "Might", "be", "extended", "in", "the", "future", "to", "support", "more", "attributes", "." ]
nathancahill/mimicdb
python
https://github.com/nathancahill/mimicdb/blob/9d0e8ebcba31d937f73752f9b88e5a4fec860765/mimicdb/s3/key.py#L32-L42
[ "def", "_load_meta", "(", "self", ",", "size", ",", "md5", ")", ":", "if", "not", "hasattr", "(", "self", ",", "'local_hashes'", ")", ":", "self", ".", "local_hashes", "=", "{", "}", "self", ".", "size", "=", "int", "(", "size", ")", "if", "(", "...
9d0e8ebcba31d937f73752f9b88e5a4fec860765
valid
Key.name
Key name can be set by Key.key or Key.name. Key.key sets Key.name internally, so just handle this property. When changing the key name, try to load it's metadata from MimicDB. If it's not available, the key hasn't been uploaded, downloaded or synced so don't add it to the bucket set (it ...
mimicdb/s3/key.py
def name(self, value): """Key name can be set by Key.key or Key.name. Key.key sets Key.name internally, so just handle this property. When changing the key name, try to load it's metadata from MimicDB. If it's not available, the key hasn't been uploaded, downloaded or synced so don't add...
def name(self, value): """Key name can be set by Key.key or Key.name. Key.key sets Key.name internally, so just handle this property. When changing the key name, try to load it's metadata from MimicDB. If it's not available, the key hasn't been uploaded, downloaded or synced so don't add...
[ "Key", "name", "can", "be", "set", "by", "Key", ".", "key", "or", "Key", ".", "name", ".", "Key", ".", "key", "sets", "Key", ".", "name", "internally", "so", "just", "handle", "this", "property", ".", "When", "changing", "the", "key", "name", "try", ...
nathancahill/mimicdb
python
https://github.com/nathancahill/mimicdb/blob/9d0e8ebcba31d937f73752f9b88e5a4fec860765/mimicdb/s3/key.py#L49-L64
[ "def", "name", "(", "self", ",", "value", ")", ":", "self", ".", "_name", "=", "value", "if", "value", ":", "meta", "=", "mimicdb", ".", "backend", ".", "hgetall", "(", "tpl", ".", "key", "%", "(", "self", ".", "bucket", ".", "name", ",", "value"...
9d0e8ebcba31d937f73752f9b88e5a4fec860765
valid
Key._send_file_internal
Called internally for any type of upload. After upload finishes, make sure the key is in the bucket set and save the metadata.
mimicdb/s3/key.py
def _send_file_internal(self, *args, **kwargs): """Called internally for any type of upload. After upload finishes, make sure the key is in the bucket set and save the metadata. """ super(Key, self)._send_file_internal(*args, **kwargs) mimicdb.backend.sadd(tpl.bucket % self.buck...
def _send_file_internal(self, *args, **kwargs): """Called internally for any type of upload. After upload finishes, make sure the key is in the bucket set and save the metadata. """ super(Key, self)._send_file_internal(*args, **kwargs) mimicdb.backend.sadd(tpl.bucket % self.buck...
[ "Called", "internally", "for", "any", "type", "of", "upload", ".", "After", "upload", "finishes", "make", "sure", "the", "key", "is", "in", "the", "bucket", "set", "and", "save", "the", "metadata", "." ]
nathancahill/mimicdb
python
https://github.com/nathancahill/mimicdb/blob/9d0e8ebcba31d937f73752f9b88e5a4fec860765/mimicdb/s3/key.py#L66-L74
[ "def", "_send_file_internal", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "super", "(", "Key", ",", "self", ")", ".", "_send_file_internal", "(", "*", "args", ",", "*", "*", "kwargs", ")", "mimicdb", ".", "backend", ".", "sadd",...
9d0e8ebcba31d937f73752f9b88e5a4fec860765
valid
wrap
Memoizes an objective + gradient function, and splits it into two functions that return just the objective and gradient, respectively. Parameters ---------- f_df : function Must be unary (takes a single argument) xref : list, dict, or array_like The form of the parameters size...
descent/utils.py
def wrap(f_df, xref, size=1): """ Memoizes an objective + gradient function, and splits it into two functions that return just the objective and gradient, respectively. Parameters ---------- f_df : function Must be unary (takes a single argument) xref : list, dict, or array_like ...
def wrap(f_df, xref, size=1): """ Memoizes an objective + gradient function, and splits it into two functions that return just the objective and gradient, respectively. Parameters ---------- f_df : function Must be unary (takes a single argument) xref : list, dict, or array_like ...
[ "Memoizes", "an", "objective", "+", "gradient", "function", "and", "splits", "it", "into", "two", "functions", "that", "return", "just", "the", "objective", "and", "gradient", "respectively", "." ]
nirum/descent
python
https://github.com/nirum/descent/blob/074c8452f15a0da638668a4fe139fde06ccfae7f/descent/utils.py#L17-L36
[ "def", "wrap", "(", "f_df", ",", "xref", ",", "size", "=", "1", ")", ":", "memoized_f_df", "=", "lrucache", "(", "lambda", "x", ":", "f_df", "(", "restruct", "(", "x", ",", "xref", ")", ")", ",", "size", ")", "objective", "=", "compose", "(", "fi...
074c8452f15a0da638668a4fe139fde06ccfae7f
valid
docstring
Decorates a function with the given docstring Parameters ---------- docstr : string
descent/utils.py
def docstring(docstr): """ Decorates a function with the given docstring Parameters ---------- docstr : string """ def decorator(func): @wraps(func) def wrapper(*args, **kwargs): return func(*args, **kwargs) wrapper.__doc__ = docstr return wrapper...
def docstring(docstr): """ Decorates a function with the given docstring Parameters ---------- docstr : string """ def decorator(func): @wraps(func) def wrapper(*args, **kwargs): return func(*args, **kwargs) wrapper.__doc__ = docstr return wrapper...
[ "Decorates", "a", "function", "with", "the", "given", "docstring" ]
nirum/descent
python
https://github.com/nirum/descent/blob/074c8452f15a0da638668a4fe139fde06ccfae7f/descent/utils.py#L39-L53
[ "def", "docstring", "(", "docstr", ")", ":", "def", "decorator", "(", "func", ")", ":", "@", "wraps", "(", "func", ")", "def", "wrapper", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "func", "(", "*", "args", ",", "*", "*", "k...
074c8452f15a0da638668a4fe139fde06ccfae7f
valid
lrucache
A simple implementation of a least recently used (LRU) cache. Memoizes the recent calls of a computationally intensive function. Parameters ---------- func : function Must be unary (takes a single argument) size : int The size of the cache (number of previous calls to store)
descent/utils.py
def lrucache(func, size): """ A simple implementation of a least recently used (LRU) cache. Memoizes the recent calls of a computationally intensive function. Parameters ---------- func : function Must be unary (takes a single argument) size : int The size of the cache (num...
def lrucache(func, size): """ A simple implementation of a least recently used (LRU) cache. Memoizes the recent calls of a computationally intensive function. Parameters ---------- func : function Must be unary (takes a single argument) size : int The size of the cache (num...
[ "A", "simple", "implementation", "of", "a", "least", "recently", "used", "(", "LRU", ")", "cache", ".", "Memoizes", "the", "recent", "calls", "of", "a", "computationally", "intensive", "function", "." ]
nirum/descent
python
https://github.com/nirum/descent/blob/074c8452f15a0da638668a4fe139fde06ccfae7f/descent/utils.py#L56-L104
[ "def", "lrucache", "(", "func", ",", "size", ")", ":", "if", "size", "==", "0", ":", "return", "func", "elif", "size", "<", "0", ":", "raise", "ValueError", "(", "\"size argument must be a positive integer\"", ")", "# this only works for unary functions", "if", ...
074c8452f15a0da638668a4fe139fde06ccfae7f
valid
check_grad
Compares the numerical gradient to the analytic gradient Parameters ---------- f_df : function The analytic objective and gradient function to check x0 : array_like Parameter values to check the gradient at stepsize : float, optional Stepsize for the numerical gradient. To...
descent/utils.py
def check_grad(f_df, xref, stepsize=1e-6, tol=1e-6, width=15, style='round', out=sys.stdout): """ Compares the numerical gradient to the analytic gradient Parameters ---------- f_df : function The analytic objective and gradient function to check x0 : array_like Parameter value...
def check_grad(f_df, xref, stepsize=1e-6, tol=1e-6, width=15, style='round', out=sys.stdout): """ Compares the numerical gradient to the analytic gradient Parameters ---------- f_df : function The analytic objective and gradient function to check x0 : array_like Parameter value...
[ "Compares", "the", "numerical", "gradient", "to", "the", "analytic", "gradient" ]
nirum/descent
python
https://github.com/nirum/descent/blob/074c8452f15a0da638668a4fe139fde06ccfae7f/descent/utils.py#L107-L191
[ "def", "check_grad", "(", "f_df", ",", "xref", ",", "stepsize", "=", "1e-6", ",", "tol", "=", "1e-6", ",", "width", "=", "15", ",", "style", "=", "'round'", ",", "out", "=", "sys", ".", "stdout", ")", ":", "CORRECT", "=", "u'\\x1b[32m\\N{CHECK MARK}\\x...
074c8452f15a0da638668a4fe139fde06ccfae7f
valid
RegressionQualityValidator.evaluate
Evaluate the files identified for checksum.
dgitcore/contrib/validators/regression_quality.py
def evaluate(self, repo, spec, args): """ Evaluate the files identified for checksum. """ status = [] # Do we have to any thing at all? if len(spec['files']) == 0: return status with cd(repo.rootdir): rules = None ...
def evaluate(self, repo, spec, args): """ Evaluate the files identified for checksum. """ status = [] # Do we have to any thing at all? if len(spec['files']) == 0: return status with cd(repo.rootdir): rules = None ...
[ "Evaluate", "the", "files", "identified", "for", "checksum", "." ]
pingali/dgit
python
https://github.com/pingali/dgit/blob/ecde01f40b98f0719dbcfb54452270ed2f86686d/dgitcore/contrib/validators/regression_quality.py#L54-L123
[ "def", "evaluate", "(", "self", ",", "repo", ",", "spec", ",", "args", ")", ":", "status", "=", "[", "]", "# Do we have to any thing at all? ", "if", "len", "(", "spec", "[", "'files'", "]", ")", "==", "0", ":", "return", "status", "with", "cd", "(", ...
ecde01f40b98f0719dbcfb54452270ed2f86686d
valid
MetadataValidator.evaluate
Check the integrity of the datapackage.json
dgitcore/contrib/validators/metadata_validator.py
def evaluate(self, repo, spec, args): """ Check the integrity of the datapackage.json """ status = [] with cd(repo.rootdir): files = spec.get('files', ['*']) resource_files = repo.find_matching_files(files) files = glob2.glob("**/*") ...
def evaluate(self, repo, spec, args): """ Check the integrity of the datapackage.json """ status = [] with cd(repo.rootdir): files = spec.get('files', ['*']) resource_files = repo.find_matching_files(files) files = glob2.glob("**/*") ...
[ "Check", "the", "integrity", "of", "the", "datapackage", ".", "json" ]
pingali/dgit
python
https://github.com/pingali/dgit/blob/ecde01f40b98f0719dbcfb54452270ed2f86686d/dgitcore/contrib/validators/metadata_validator.py#L48-L106
[ "def", "evaluate", "(", "self", ",", "repo", ",", "spec", ",", "args", ")", ":", "status", "=", "[", "]", "with", "cd", "(", "repo", ".", "rootdir", ")", ":", "files", "=", "spec", ".", "get", "(", "'files'", ",", "[", "'*'", "]", ")", "resourc...
ecde01f40b98f0719dbcfb54452270ed2f86686d
valid
TableRepresentation.read_file
Guess the filetype and read the file into row sets
dgitcore/contrib/representations/tableformat.py
def read_file(self, filename): """ Guess the filetype and read the file into row sets """ #print("Reading file", filename) try: fh = open(filename, 'rb') table_set = any_tableset(fh) # guess the type... except: #traceback.print_exc() ...
def read_file(self, filename): """ Guess the filetype and read the file into row sets """ #print("Reading file", filename) try: fh = open(filename, 'rb') table_set = any_tableset(fh) # guess the type... except: #traceback.print_exc() ...
[ "Guess", "the", "filetype", "and", "read", "the", "file", "into", "row", "sets" ]
pingali/dgit
python
https://github.com/pingali/dgit/blob/ecde01f40b98f0719dbcfb54452270ed2f86686d/dgitcore/contrib/representations/tableformat.py#L42-L56
[ "def", "read_file", "(", "self", ",", "filename", ")", ":", "#print(\"Reading file\", filename)", "try", ":", "fh", "=", "open", "(", "filename", ",", "'rb'", ")", "table_set", "=", "any_tableset", "(", "fh", ")", "# guess the type...", "except", ":", "#traceb...
ecde01f40b98f0719dbcfb54452270ed2f86686d
valid
TableRepresentation.get_schema
Guess schema using messytables
dgitcore/contrib/representations/tableformat.py
def get_schema(self, filename): """ Guess schema using messytables """ table_set = self.read_file(filename) # Have I been able to read the filename if table_set is None: return [] # Get the first table as rowset row_set = table_...
def get_schema(self, filename): """ Guess schema using messytables """ table_set = self.read_file(filename) # Have I been able to read the filename if table_set is None: return [] # Get the first table as rowset row_set = table_...
[ "Guess", "schema", "using", "messytables" ]
pingali/dgit
python
https://github.com/pingali/dgit/blob/ecde01f40b98f0719dbcfb54452270ed2f86686d/dgitcore/contrib/representations/tableformat.py#L58-L86
[ "def", "get_schema", "(", "self", ",", "filename", ")", ":", "table_set", "=", "self", ".", "read_file", "(", "filename", ")", "# Have I been able to read the filename", "if", "table_set", "is", "None", ":", "return", "[", "]", "# Get the first table as rowset", "...
ecde01f40b98f0719dbcfb54452270ed2f86686d
valid
int2fin_reference
Calculates a checksum for a Finnish national reference number
holviapi/utils.py
def int2fin_reference(n): """Calculates a checksum for a Finnish national reference number""" checksum = 10 - (sum([int(c) * i for c, i in zip(str(n)[::-1], it.cycle((7, 3, 1)))]) % 10) if checksum == 10: checksum = 0 return "%s%s" % (n, checksum)
def int2fin_reference(n): """Calculates a checksum for a Finnish national reference number""" checksum = 10 - (sum([int(c) * i for c, i in zip(str(n)[::-1], it.cycle((7, 3, 1)))]) % 10) if checksum == 10: checksum = 0 return "%s%s" % (n, checksum)
[ "Calculates", "a", "checksum", "for", "a", "Finnish", "national", "reference", "number" ]
rambo/python-holviapi
python
https://github.com/rambo/python-holviapi/blob/f57f44e7b0a1030786aafd6f387114abb546bb32/holviapi/utils.py#L154-L159
[ "def", "int2fin_reference", "(", "n", ")", ":", "checksum", "=", "10", "-", "(", "sum", "(", "[", "int", "(", "c", ")", "*", "i", "for", "c", ",", "i", "in", "zip", "(", "str", "(", "n", ")", "[", ":", ":", "-", "1", "]", ",", "it", ".", ...
f57f44e7b0a1030786aafd6f387114abb546bb32
valid
iso_reference_valid_char
Helper to make sure the given character is valid for a reference number
holviapi/utils.py
def iso_reference_valid_char(c, raise_error=True): """Helper to make sure the given character is valid for a reference number""" if c in ISO_REFERENCE_VALID: return True if raise_error: raise ValueError("'%s' is not in '%s'" % (c, ISO_REFERENCE_VALID)) return False
def iso_reference_valid_char(c, raise_error=True): """Helper to make sure the given character is valid for a reference number""" if c in ISO_REFERENCE_VALID: return True if raise_error: raise ValueError("'%s' is not in '%s'" % (c, ISO_REFERENCE_VALID)) return False
[ "Helper", "to", "make", "sure", "the", "given", "character", "is", "valid", "for", "a", "reference", "number" ]
rambo/python-holviapi
python
https://github.com/rambo/python-holviapi/blob/f57f44e7b0a1030786aafd6f387114abb546bb32/holviapi/utils.py#L167-L173
[ "def", "iso_reference_valid_char", "(", "c", ",", "raise_error", "=", "True", ")", ":", "if", "c", "in", "ISO_REFERENCE_VALID", ":", "return", "True", "if", "raise_error", ":", "raise", "ValueError", "(", "\"'%s' is not in '%s'\"", "%", "(", "c", ",", "ISO_REF...
f57f44e7b0a1030786aafd6f387114abb546bb32
valid
iso_reference_str2int
Creates the huge number from ISO alphanumeric ISO reference
holviapi/utils.py
def iso_reference_str2int(n): """Creates the huge number from ISO alphanumeric ISO reference""" n = n.upper() numbers = [] for c in n: iso_reference_valid_char(c) if c in ISO_REFERENCE_VALID_NUMERIC: numbers.append(c) else: numbers.append(str(iso_reference...
def iso_reference_str2int(n): """Creates the huge number from ISO alphanumeric ISO reference""" n = n.upper() numbers = [] for c in n: iso_reference_valid_char(c) if c in ISO_REFERENCE_VALID_NUMERIC: numbers.append(c) else: numbers.append(str(iso_reference...
[ "Creates", "the", "huge", "number", "from", "ISO", "alphanumeric", "ISO", "reference" ]
rambo/python-holviapi
python
https://github.com/rambo/python-holviapi/blob/f57f44e7b0a1030786aafd6f387114abb546bb32/holviapi/utils.py#L182-L192
[ "def", "iso_reference_str2int", "(", "n", ")", ":", "n", "=", "n", ".", "upper", "(", ")", "numbers", "=", "[", "]", "for", "c", "in", "n", ":", "iso_reference_valid_char", "(", "c", ")", "if", "c", "in", "ISO_REFERENCE_VALID_NUMERIC", ":", "numbers", ...
f57f44e7b0a1030786aafd6f387114abb546bb32
valid
iso_reference_isvalid
Validates ISO reference number
holviapi/utils.py
def iso_reference_isvalid(ref): """Validates ISO reference number""" ref = str(ref) cs_source = ref[4:] + ref[:4] return (iso_reference_str2int(cs_source) % 97) == 1
def iso_reference_isvalid(ref): """Validates ISO reference number""" ref = str(ref) cs_source = ref[4:] + ref[:4] return (iso_reference_str2int(cs_source) % 97) == 1
[ "Validates", "ISO", "reference", "number" ]
rambo/python-holviapi
python
https://github.com/rambo/python-holviapi/blob/f57f44e7b0a1030786aafd6f387114abb546bb32/holviapi/utils.py#L209-L213
[ "def", "iso_reference_isvalid", "(", "ref", ")", ":", "ref", "=", "str", "(", "ref", ")", "cs_source", "=", "ref", "[", "4", ":", "]", "+", "ref", "[", ":", "4", "]", "return", "(", "iso_reference_str2int", "(", "cs_source", ")", "%", "97", ")", "=...
f57f44e7b0a1030786aafd6f387114abb546bb32
valid
barcode
Calculates virtual barcode for IBAN account number and ISO reference Arguments: iban {string} -- IBAN formed account number reference {string} -- ISO 11649 creditor reference amount {decimal.Decimal} -- Amount in euros, 0.01 - 999999.99 due {datetime.date} -- due date
holviapi/utils.py
def barcode(iban, reference, amount, due=None): """Calculates virtual barcode for IBAN account number and ISO reference Arguments: iban {string} -- IBAN formed account number reference {string} -- ISO 11649 creditor reference amount {decimal.Decimal} -- Amount in euros, 0.01 - 999999.99...
def barcode(iban, reference, amount, due=None): """Calculates virtual barcode for IBAN account number and ISO reference Arguments: iban {string} -- IBAN formed account number reference {string} -- ISO 11649 creditor reference amount {decimal.Decimal} -- Amount in euros, 0.01 - 999999.99...
[ "Calculates", "virtual", "barcode", "for", "IBAN", "account", "number", "and", "ISO", "reference" ]
rambo/python-holviapi
python
https://github.com/rambo/python-holviapi/blob/f57f44e7b0a1030786aafd6f387114abb546bb32/holviapi/utils.py#L220-L263
[ "def", "barcode", "(", "iban", ",", "reference", ",", "amount", ",", "due", "=", "None", ")", ":", "iban", "=", "iban", ".", "replace", "(", "' '", ",", "''", ")", "reference", "=", "reference", ".", "replace", "(", "' '", ",", "''", ")", "if", "...
f57f44e7b0a1030786aafd6f387114abb546bb32
valid
add_file_normal
Add a normal file including its source
dgitcore/datasets/files.py
def add_file_normal(f, targetdir, generator,script, source): """ Add a normal file including its source """ basename = os.path.basename(f) if targetdir != ".": relativepath = os.path.join(targetdir, basename) else: relativepath = basename relpath = os.path.relpath(f, os.get...
def add_file_normal(f, targetdir, generator,script, source): """ Add a normal file including its source """ basename = os.path.basename(f) if targetdir != ".": relativepath = os.path.join(targetdir, basename) else: relativepath = basename relpath = os.path.relpath(f, os.get...
[ "Add", "a", "normal", "file", "including", "its", "source" ]
pingali/dgit
python
https://github.com/pingali/dgit/blob/ecde01f40b98f0719dbcfb54452270ed2f86686d/dgitcore/datasets/files.py#L66-L96
[ "def", "add_file_normal", "(", "f", ",", "targetdir", ",", "generator", ",", "script", ",", "source", ")", ":", "basename", "=", "os", ".", "path", ".", "basename", "(", "f", ")", "if", "targetdir", "!=", "\".\"", ":", "relativepath", "=", "os", ".", ...
ecde01f40b98f0719dbcfb54452270ed2f86686d
valid
extract_files
Extract the files to be added based on the includes
dgitcore/datasets/files.py
def extract_files(filename, includes): """ Extract the files to be added based on the includes """ # Load the execution strace log lines = open(filename).readlines() # Extract only open files - whether for read or write. You often # want to capture the json/ini configuration file as well ...
def extract_files(filename, includes): """ Extract the files to be added based on the includes """ # Load the execution strace log lines = open(filename).readlines() # Extract only open files - whether for read or write. You often # want to capture the json/ini configuration file as well ...
[ "Extract", "the", "files", "to", "be", "added", "based", "on", "the", "includes" ]
pingali/dgit
python
https://github.com/pingali/dgit/blob/ecde01f40b98f0719dbcfb54452270ed2f86686d/dgitcore/datasets/files.py#L132-L267
[ "def", "extract_files", "(", "filename", ",", "includes", ")", ":", "# Load the execution strace log", "lines", "=", "open", "(", "filename", ")", ".", "readlines", "(", ")", "# Extract only open files - whether for read or write. You often", "# want to capture the json/ini c...
ecde01f40b98f0719dbcfb54452270ed2f86686d
valid
run_executable
Run the executable and capture the input and output...
dgitcore/datasets/files.py
def run_executable(repo, args, includes): """ Run the executable and capture the input and output... """ # Get platform information mgr = plugins_get_mgr() repomgr = mgr.get(what='instrumentation', name='platform') platform_metadata = repomgr.get_metadata() print("Obtaining Commit Info...
def run_executable(repo, args, includes): """ Run the executable and capture the input and output... """ # Get platform information mgr = plugins_get_mgr() repomgr = mgr.get(what='instrumentation', name='platform') platform_metadata = repomgr.get_metadata() print("Obtaining Commit Info...
[ "Run", "the", "executable", "and", "capture", "the", "input", "and", "output", "..." ]
pingali/dgit
python
https://github.com/pingali/dgit/blob/ecde01f40b98f0719dbcfb54452270ed2f86686d/dgitcore/datasets/files.py#L290-L344
[ "def", "run_executable", "(", "repo", ",", "args", ",", "includes", ")", ":", "# Get platform information", "mgr", "=", "plugins_get_mgr", "(", ")", "repomgr", "=", "mgr", ".", "get", "(", "what", "=", "'instrumentation'", ",", "name", "=", "'platform'", ")"...
ecde01f40b98f0719dbcfb54452270ed2f86686d
valid
add
Add files to the repository by explicitly specifying them or by specifying a pattern over files accessed during execution of an executable. Parameters ---------- repo: Repository args: files or command line (a) If simply adding files, then the list of files that must be adde...
dgitcore/datasets/files.py
def add(repo, args, targetdir, execute=False, generator=False, includes=[], script=False, source=None): """ Add files to the repository by explicitly specifying them or by specifying a pattern over files accessed during execution of an executable. Parameters ---------- ...
def add(repo, args, targetdir, execute=False, generator=False, includes=[], script=False, source=None): """ Add files to the repository by explicitly specifying them or by specifying a pattern over files accessed during execution of an executable. Parameters ---------- ...
[ "Add", "files", "to", "the", "repository", "by", "explicitly", "specifying", "them", "or", "by", "specifying", "a", "pattern", "over", "files", "accessed", "during", "execution", "of", "an", "executable", "." ]
pingali/dgit
python
https://github.com/pingali/dgit/blob/ecde01f40b98f0719dbcfb54452270ed2f86686d/dgitcore/datasets/files.py#L349-L431
[ "def", "add", "(", "repo", ",", "args", ",", "targetdir", ",", "execute", "=", "False", ",", "generator", "=", "False", ",", "includes", "=", "[", "]", ",", "script", "=", "False", ",", "source", "=", "None", ")", ":", "# Gather the files...", "if", ...
ecde01f40b98f0719dbcfb54452270ed2f86686d
valid
Repo.find_matching_files
For various actions we need files that match patterns
dgitcore/plugins/repomanager.py
def find_matching_files(self, includes): """ For various actions we need files that match patterns """ if len(includes) == 0: return [] files = [f['relativepath'] for f in self.package['resources']] includes = r'|'.join([fnmatch.translate(x) for x in inclu...
def find_matching_files(self, includes): """ For various actions we need files that match patterns """ if len(includes) == 0: return [] files = [f['relativepath'] for f in self.package['resources']] includes = r'|'.join([fnmatch.translate(x) for x in inclu...
[ "For", "various", "actions", "we", "need", "files", "that", "match", "patterns" ]
pingali/dgit
python
https://github.com/pingali/dgit/blob/ecde01f40b98f0719dbcfb54452270ed2f86686d/dgitcore/plugins/repomanager.py#L26-L42
[ "def", "find_matching_files", "(", "self", ",", "includes", ")", ":", "if", "len", "(", "includes", ")", "==", "0", ":", "return", "[", "]", "files", "=", "[", "f", "[", "'relativepath'", "]", "for", "f", "in", "self", ".", "package", "[", "'resource...
ecde01f40b98f0719dbcfb54452270ed2f86686d
valid
Repo.run
Run a specific command using the manager
dgitcore/plugins/repomanager.py
def run(self, cmd, *args): """ Run a specific command using the manager """ if self.manager is None: raise Exception("Fatal internal error: Missing repository manager") if cmd not in dir(self.manager): raise Exception("Fatal internal error: Invalid command...
def run(self, cmd, *args): """ Run a specific command using the manager """ if self.manager is None: raise Exception("Fatal internal error: Missing repository manager") if cmd not in dir(self.manager): raise Exception("Fatal internal error: Invalid command...
[ "Run", "a", "specific", "command", "using", "the", "manager" ]
pingali/dgit
python
https://github.com/pingali/dgit/blob/ecde01f40b98f0719dbcfb54452270ed2f86686d/dgitcore/plugins/repomanager.py#L81-L91
[ "def", "run", "(", "self", ",", "cmd", ",", "*", "args", ")", ":", "if", "self", ".", "manager", "is", "None", ":", "raise", "Exception", "(", "\"Fatal internal error: Missing repository manager\"", ")", "if", "cmd", "not", "in", "dir", "(", "self", ".", ...
ecde01f40b98f0719dbcfb54452270ed2f86686d
valid
Repo.get_resource
Get metadata for a given file
dgitcore/plugins/repomanager.py
def get_resource(self, p): """ Get metadata for a given file """ for r in self.package['resources']: if r['relativepath'] == p: r['localfullpath'] = os.path.join(self.rootdir, p) return r raise Exception("Invalid path")
def get_resource(self, p): """ Get metadata for a given file """ for r in self.package['resources']: if r['relativepath'] == p: r['localfullpath'] = os.path.join(self.rootdir, p) return r raise Exception("Invalid path")
[ "Get", "metadata", "for", "a", "given", "file" ]
pingali/dgit
python
https://github.com/pingali/dgit/blob/ecde01f40b98f0719dbcfb54452270ed2f86686d/dgitcore/plugins/repomanager.py#L94-L103
[ "def", "get_resource", "(", "self", ",", "p", ")", ":", "for", "r", "in", "self", ".", "package", "[", "'resources'", "]", ":", "if", "r", "[", "'relativepath'", "]", "==", "p", ":", "r", "[", "'localfullpath'", "]", "=", "os", ".", "path", ".", ...
ecde01f40b98f0719dbcfb54452270ed2f86686d
valid
RepoManagerBase.lookup
Lookup all available repos
dgitcore/plugins/repomanager.py
def lookup(self, username=None, reponame=None, key=None): """ Lookup all available repos """ if key is None: key = self.key(username, reponame) if key not in self.repos: raise UnknownRepository() return self.repos[key]
def lookup(self, username=None, reponame=None, key=None): """ Lookup all available repos """ if key is None: key = self.key(username, reponame) if key not in self.repos: raise UnknownRepository() return self.repos[key]
[ "Lookup", "all", "available", "repos" ]
pingali/dgit
python
https://github.com/pingali/dgit/blob/ecde01f40b98f0719dbcfb54452270ed2f86686d/dgitcore/plugins/repomanager.py#L163-L172
[ "def", "lookup", "(", "self", ",", "username", "=", "None", ",", "reponame", "=", "None", ",", "key", "=", "None", ")", ":", "if", "key", "is", "None", ":", "key", "=", "self", ".", "key", "(", "username", ",", "reponame", ")", "if", "key", "not"...
ecde01f40b98f0719dbcfb54452270ed2f86686d
valid
RepoManagerBase.rootdir
Working directory for the repo
dgitcore/plugins/repomanager.py
def rootdir(self, username, reponame, create=True): """ Working directory for the repo """ path = os.path.join(self.workspace, 'datasets', username, reponame) if create: try: ...
def rootdir(self, username, reponame, create=True): """ Working directory for the repo """ path = os.path.join(self.workspace, 'datasets', username, reponame) if create: try: ...
[ "Working", "directory", "for", "the", "repo" ]
pingali/dgit
python
https://github.com/pingali/dgit/blob/ecde01f40b98f0719dbcfb54452270ed2f86686d/dgitcore/plugins/repomanager.py#L204-L218
[ "def", "rootdir", "(", "self", ",", "username", ",", "reponame", ",", "create", "=", "True", ")", ":", "path", "=", "os", ".", "path", ".", "join", "(", "self", ".", "workspace", ",", "'datasets'", ",", "username", ",", "reponame", ")", "if", "create...
ecde01f40b98f0719dbcfb54452270ed2f86686d
valid
RepoManagerBase.add
Add repo to the internal lookup table...
dgitcore/plugins/repomanager.py
def add(self, repo): """ Add repo to the internal lookup table... """ key = self.key(repo.username, repo.reponame) repo.key = key self.repos[key] = repo return key
def add(self, repo): """ Add repo to the internal lookup table... """ key = self.key(repo.username, repo.reponame) repo.key = key self.repos[key] = repo return key
[ "Add", "repo", "to", "the", "internal", "lookup", "table", "..." ]
pingali/dgit
python
https://github.com/pingali/dgit/blob/ecde01f40b98f0719dbcfb54452270ed2f86686d/dgitcore/plugins/repomanager.py#L222-L229
[ "def", "add", "(", "self", ",", "repo", ")", ":", "key", "=", "self", ".", "key", "(", "repo", ".", "username", ",", "repo", ".", "reponame", ")", "repo", ".", "key", "=", "key", "self", ".", "repos", "[", "key", "]", "=", "repo", "return", "ke...
ecde01f40b98f0719dbcfb54452270ed2f86686d
valid
lookup
Lookup a repo based on username reponame
dgitcore/datasets/common.py
def lookup(username, reponame): """ Lookup a repo based on username reponame """ mgr = plugins_get_mgr() # XXX This should be generalized to all repo managers. repomgr = mgr.get(what='repomanager', name='git') repo = repomgr.lookup(username=username, reponame=re...
def lookup(username, reponame): """ Lookup a repo based on username reponame """ mgr = plugins_get_mgr() # XXX This should be generalized to all repo managers. repomgr = mgr.get(what='repomanager', name='git') repo = repomgr.lookup(username=username, reponame=re...
[ "Lookup", "a", "repo", "based", "on", "username", "reponame" ]
pingali/dgit
python
https://github.com/pingali/dgit/blob/ecde01f40b98f0719dbcfb54452270ed2f86686d/dgitcore/datasets/common.py#L47-L58
[ "def", "lookup", "(", "username", ",", "reponame", ")", ":", "mgr", "=", "plugins_get_mgr", "(", ")", "# XXX This should be generalized to all repo managers.", "repomgr", "=", "mgr", ".", "get", "(", "what", "=", "'repomanager'", ",", "name", "=", "'git'", ")", ...
ecde01f40b98f0719dbcfb54452270ed2f86686d
valid
list_repos
List repos Parameters ---------- remote: Flag
dgitcore/datasets/common.py
def list_repos(remote=False): """ List repos Parameters ---------- remote: Flag """ mgr = plugins_get_mgr() if not remote: repomgr = mgr.get(what='repomanager', name='git') repos = repomgr.get_repo_list() repos.sort() return repos else: rais...
def list_repos(remote=False): """ List repos Parameters ---------- remote: Flag """ mgr = plugins_get_mgr() if not remote: repomgr = mgr.get(what='repomanager', name='git') repos = repomgr.get_repo_list() repos.sort() return repos else: rais...
[ "List", "repos" ]
pingali/dgit
python
https://github.com/pingali/dgit/blob/ecde01f40b98f0719dbcfb54452270ed2f86686d/dgitcore/datasets/common.py#L60-L77
[ "def", "list_repos", "(", "remote", "=", "False", ")", ":", "mgr", "=", "plugins_get_mgr", "(", ")", "if", "not", "remote", ":", "repomgr", "=", "mgr", ".", "get", "(", "what", "=", "'repomanager'", ",", "name", "=", "'git'", ")", "repos", "=", "repo...
ecde01f40b98f0719dbcfb54452270ed2f86686d
valid
shellcmd
Run a shell command within the repo's context Parameters ---------- repo: Repository object args: Shell command
dgitcore/datasets/common.py
def shellcmd(repo, args): """ Run a shell command within the repo's context Parameters ---------- repo: Repository object args: Shell command """ with cd(repo.rootdir): result = run(args) return result
def shellcmd(repo, args): """ Run a shell command within the repo's context Parameters ---------- repo: Repository object args: Shell command """ with cd(repo.rootdir): result = run(args) return result
[ "Run", "a", "shell", "command", "within", "the", "repo", "s", "context" ]
pingali/dgit
python
https://github.com/pingali/dgit/blob/ecde01f40b98f0719dbcfb54452270ed2f86686d/dgitcore/datasets/common.py#L84-L96
[ "def", "shellcmd", "(", "repo", ",", "args", ")", ":", "with", "cd", "(", "repo", ".", "rootdir", ")", ":", "result", "=", "run", "(", "args", ")", "return", "result" ]
ecde01f40b98f0719dbcfb54452270ed2f86686d
valid
datapackage_exists
Check if the datapackage exists...
dgitcore/datasets/common.py
def datapackage_exists(repo): """ Check if the datapackage exists... """ datapath = os.path.join(repo.rootdir, "datapackage.json") return os.path.exists(datapath)
def datapackage_exists(repo): """ Check if the datapackage exists... """ datapath = os.path.join(repo.rootdir, "datapackage.json") return os.path.exists(datapath)
[ "Check", "if", "the", "datapackage", "exists", "..." ]
pingali/dgit
python
https://github.com/pingali/dgit/blob/ecde01f40b98f0719dbcfb54452270ed2f86686d/dgitcore/datasets/common.py#L99-L104
[ "def", "datapackage_exists", "(", "repo", ")", ":", "datapath", "=", "os", ".", "path", ".", "join", "(", "repo", ".", "rootdir", ",", "\"datapackage.json\"", ")", "return", "os", ".", "path", ".", "exists", "(", "datapath", ")" ]
ecde01f40b98f0719dbcfb54452270ed2f86686d
valid
delete
Delete files Parameters ---------- repo: Repository object args: Arguments to git command
dgitcore/datasets/common.py
def delete(repo, args=[]): """ Delete files Parameters ---------- repo: Repository object args: Arguments to git command """ # Remove the files result = generic_repo_cmd(repo, 'delete', args) if result['status'] != 'success': return status with cd(repo.rootdir)...
def delete(repo, args=[]): """ Delete files Parameters ---------- repo: Repository object args: Arguments to git command """ # Remove the files result = generic_repo_cmd(repo, 'delete', args) if result['status'] != 'success': return status with cd(repo.rootdir)...
[ "Delete", "files" ]
pingali/dgit
python
https://github.com/pingali/dgit/blob/ecde01f40b98f0719dbcfb54452270ed2f86686d/dgitcore/datasets/common.py#L248-L289
[ "def", "delete", "(", "repo", ",", "args", "=", "[", "]", ")", ":", "# Remove the files ", "result", "=", "generic_repo_cmd", "(", "repo", ",", "'delete'", ",", "args", ")", "if", "result", "[", "'status'", "]", "!=", "'success'", ":", "return", "status"...
ecde01f40b98f0719dbcfb54452270ed2f86686d
valid
bootstrap_datapackage
Create the datapackage file..
dgitcore/datasets/common.py
def bootstrap_datapackage(repo, force=False, options=None, noinput=False): """ Create the datapackage file.. """ print("Bootstrapping datapackage") # get the directory tsprefix = datetime.now().date().isoformat() # Initial data package json package = OrderedD...
def bootstrap_datapackage(repo, force=False, options=None, noinput=False): """ Create the datapackage file.. """ print("Bootstrapping datapackage") # get the directory tsprefix = datetime.now().date().isoformat() # Initial data package json package = OrderedD...
[ "Create", "the", "datapackage", "file", ".." ]
pingali/dgit
python
https://github.com/pingali/dgit/blob/ecde01f40b98f0719dbcfb54452270ed2f86686d/dgitcore/datasets/common.py#L297-L348
[ "def", "bootstrap_datapackage", "(", "repo", ",", "force", "=", "False", ",", "options", "=", "None", ",", "noinput", "=", "False", ")", ":", "print", "(", "\"Bootstrapping datapackage\"", ")", "# get the directory", "tsprefix", "=", "datetime", ".", "now", "(...
ecde01f40b98f0719dbcfb54452270ed2f86686d
valid
init
Initialize an empty repository with datapackage.json Parameters ---------- username: Name of the user reponame: Name of the repo setup: Specify the 'configuration' (git only, git+s3 backend etc) force: Force creation of the files options: Dictionary with content of dgit.json, if available....
dgitcore/datasets/common.py
def init(username, reponame, setup, force=False, options=None, noinput=False): """ Initialize an empty repository with datapackage.json Parameters ---------- username: Name of the user reponame: Name of the repo setup: Specify the 'configuration' (git only, git+s3 backend...
def init(username, reponame, setup, force=False, options=None, noinput=False): """ Initialize an empty repository with datapackage.json Parameters ---------- username: Name of the user reponame: Name of the repo setup: Specify the 'configuration' (git only, git+s3 backend...
[ "Initialize", "an", "empty", "repository", "with", "datapackage", ".", "json" ]
pingali/dgit
python
https://github.com/pingali/dgit/blob/ecde01f40b98f0719dbcfb54452270ed2f86686d/dgitcore/datasets/common.py#L350-L412
[ "def", "init", "(", "username", ",", "reponame", ",", "setup", ",", "force", "=", "False", ",", "options", "=", "None", ",", "noinput", "=", "False", ")", ":", "mgr", "=", "plugins_get_mgr", "(", ")", "repomgr", "=", "mgr", ".", "get", "(", "what", ...
ecde01f40b98f0719dbcfb54452270ed2f86686d
valid
clone
Clone a URL. Examples include: - git@github.com:pingali/dgit.git - https://github.com:pingali/dgit.git - s3://mybucket/git/pingali/dgit.git Parameters ---------- url: URL of the repo
dgitcore/datasets/common.py
def clone(url): """ Clone a URL. Examples include: - git@github.com:pingali/dgit.git - https://github.com:pingali/dgit.git - s3://mybucket/git/pingali/dgit.git Parameters ---------- url: URL of the repo """ backend = None backendmgr = None if url.startswit...
def clone(url): """ Clone a URL. Examples include: - git@github.com:pingali/dgit.git - https://github.com:pingali/dgit.git - s3://mybucket/git/pingali/dgit.git Parameters ---------- url: URL of the repo """ backend = None backendmgr = None if url.startswit...
[ "Clone", "a", "URL", ".", "Examples", "include", ":" ]
pingali/dgit
python
https://github.com/pingali/dgit/blob/ecde01f40b98f0719dbcfb54452270ed2f86686d/dgitcore/datasets/common.py#L414-L462
[ "def", "clone", "(", "url", ")", ":", "backend", "=", "None", "backendmgr", "=", "None", "if", "url", ".", "startswith", "(", "'s3'", ")", ":", "backendtype", "=", "'s3'", "elif", "url", ".", "startswith", "(", "\"http\"", ")", "or", "url", ".", "sta...
ecde01f40b98f0719dbcfb54452270ed2f86686d
valid
annotate_metadata_data
Update metadata with the content of the files
dgitcore/datasets/common.py
def annotate_metadata_data(repo, task, patterns=["*"], size=0): """ Update metadata with the content of the files """ mgr = plugins_get_mgr() keys = mgr.search('representation')['representation'] representations = [mgr.get_by_key('representation', k) for k in keys] matching_files = repo.f...
def annotate_metadata_data(repo, task, patterns=["*"], size=0): """ Update metadata with the content of the files """ mgr = plugins_get_mgr() keys = mgr.search('representation')['representation'] representations = [mgr.get_by_key('representation', k) for k in keys] matching_files = repo.f...
[ "Update", "metadata", "with", "the", "content", "of", "the", "files" ]
pingali/dgit
python
https://github.com/pingali/dgit/blob/ecde01f40b98f0719dbcfb54452270ed2f86686d/dgitcore/datasets/common.py#L470-L495
[ "def", "annotate_metadata_data", "(", "repo", ",", "task", ",", "patterns", "=", "[", "\"*\"", "]", ",", "size", "=", "0", ")", ":", "mgr", "=", "plugins_get_mgr", "(", ")", "keys", "=", "mgr", ".", "search", "(", "'representation'", ")", "[", "'repres...
ecde01f40b98f0719dbcfb54452270ed2f86686d
valid
annotate_metadata_code
Update metadata with the commit information
dgitcore/datasets/common.py
def annotate_metadata_code(repo, files): """ Update metadata with the commit information """ package = repo.package package['code'] = [] for p in files: matching_files = glob2.glob("**/{}".format(p)) for f in matching_files: absf = os.path.abspath(f) prin...
def annotate_metadata_code(repo, files): """ Update metadata with the commit information """ package = repo.package package['code'] = [] for p in files: matching_files = glob2.glob("**/{}".format(p)) for f in matching_files: absf = os.path.abspath(f) prin...
[ "Update", "metadata", "with", "the", "commit", "information" ]
pingali/dgit
python
https://github.com/pingali/dgit/blob/ecde01f40b98f0719dbcfb54452270ed2f86686d/dgitcore/datasets/common.py#L497-L514
[ "def", "annotate_metadata_code", "(", "repo", ",", "files", ")", ":", "package", "=", "repo", ".", "package", "package", "[", "'code'", "]", "=", "[", "]", "for", "p", "in", "files", ":", "matching_files", "=", "glob2", ".", "glob", "(", "\"**/{}\"", "...
ecde01f40b98f0719dbcfb54452270ed2f86686d
valid
annotate_metadata_action
Update metadata with the action history
dgitcore/datasets/common.py
def annotate_metadata_action(repo): """ Update metadata with the action history """ package = repo.package print("Including history of actions") with cd(repo.rootdir): filename = ".dgit/log.json" if os.path.exists(filename): history = open(...
def annotate_metadata_action(repo): """ Update metadata with the action history """ package = repo.package print("Including history of actions") with cd(repo.rootdir): filename = ".dgit/log.json" if os.path.exists(filename): history = open(...
[ "Update", "metadata", "with", "the", "action", "history" ]
pingali/dgit
python
https://github.com/pingali/dgit/blob/ecde01f40b98f0719dbcfb54452270ed2f86686d/dgitcore/datasets/common.py#L517-L538
[ "def", "annotate_metadata_action", "(", "repo", ")", ":", "package", "=", "repo", ".", "package", "print", "(", "\"Including history of actions\"", ")", "with", "cd", "(", "repo", ".", "rootdir", ")", ":", "filename", "=", "\".dgit/log.json\"", "if", "os", "."...
ecde01f40b98f0719dbcfb54452270ed2f86686d
valid
annotate_metadata_platform
Update metadata host information
dgitcore/datasets/common.py
def annotate_metadata_platform(repo): """ Update metadata host information """ print("Added platform information") package = repo.package mgr = plugins_get_mgr() repomgr = mgr.get(what='instrumentation', name='platform') package['platform'] = repomgr.get_metadata()
def annotate_metadata_platform(repo): """ Update metadata host information """ print("Added platform information") package = repo.package mgr = plugins_get_mgr() repomgr = mgr.get(what='instrumentation', name='platform') package['platform'] = repomgr.get_metadata()
[ "Update", "metadata", "host", "information" ]
pingali/dgit
python
https://github.com/pingali/dgit/blob/ecde01f40b98f0719dbcfb54452270ed2f86686d/dgitcore/datasets/common.py#L540-L549
[ "def", "annotate_metadata_platform", "(", "repo", ")", ":", "print", "(", "\"Added platform information\"", ")", "package", "=", "repo", ".", "package", "mgr", "=", "plugins_get_mgr", "(", ")", "repomgr", "=", "mgr", ".", "get", "(", "what", "=", "'instrumenta...
ecde01f40b98f0719dbcfb54452270ed2f86686d
valid
annotate_metadata_dependencies
Collect information from the dependent repo's
dgitcore/datasets/common.py
def annotate_metadata_dependencies(repo): """ Collect information from the dependent repo's """ options = repo.options if 'dependencies' not in options: print("No dependencies") return [] repos = [] dependent_repos = options['dependencies'] for d in dependent_repos: ...
def annotate_metadata_dependencies(repo): """ Collect information from the dependent repo's """ options = repo.options if 'dependencies' not in options: print("No dependencies") return [] repos = [] dependent_repos = options['dependencies'] for d in dependent_repos: ...
[ "Collect", "information", "from", "the", "dependent", "repo", "s" ]
pingali/dgit
python
https://github.com/pingali/dgit/blob/ecde01f40b98f0719dbcfb54452270ed2f86686d/dgitcore/datasets/common.py#L574-L602
[ "def", "annotate_metadata_dependencies", "(", "repo", ")", ":", "options", "=", "repo", ".", "options", "if", "'dependencies'", "not", "in", "options", ":", "print", "(", "\"No dependencies\"", ")", "return", "[", "]", "repos", "=", "[", "]", "dependent_repos"...
ecde01f40b98f0719dbcfb54452270ed2f86686d
valid
post
Post to metadata server Parameters ---------- repo: Repository object (result of lookup)
dgitcore/datasets/common.py
def post(repo, args=[]): """ Post to metadata server Parameters ---------- repo: Repository object (result of lookup) """ mgr = plugins_get_mgr() keys = mgr.search(what='metadata') keys = keys['metadata'] if len(keys) == 0: return # Incorporate pipeline informati...
def post(repo, args=[]): """ Post to metadata server Parameters ---------- repo: Repository object (result of lookup) """ mgr = plugins_get_mgr() keys = mgr.search(what='metadata') keys = keys['metadata'] if len(keys) == 0: return # Incorporate pipeline informati...
[ "Post", "to", "metadata", "server" ]
pingali/dgit
python
https://github.com/pingali/dgit/blob/ecde01f40b98f0719dbcfb54452270ed2f86686d/dgitcore/datasets/common.py#L604-L700
[ "def", "post", "(", "repo", ",", "args", "=", "[", "]", ")", ":", "mgr", "=", "plugins_get_mgr", "(", ")", "keys", "=", "mgr", ".", "search", "(", "what", "=", "'metadata'", ")", "keys", "=", "keys", "[", "'metadata'", "]", "if", "len", "(", "key...
ecde01f40b98f0719dbcfb54452270ed2f86686d
valid
plugins_show
Show details of available plugins Parameters ---------- what: Class of plugins e.g., backend name: Name of the plugin e.g., s3 version: Version of the plugin details: Show details be shown?
dgitcore/plugins/common.py
def plugins_show(what=None, name=None, version=None, details=False): """ Show details of available plugins Parameters ---------- what: Class of plugins e.g., backend name: Name of the plugin e.g., s3 version: Version of the plugin details: Show details be shown? """ global plug...
def plugins_show(what=None, name=None, version=None, details=False): """ Show details of available plugins Parameters ---------- what: Class of plugins e.g., backend name: Name of the plugin e.g., s3 version: Version of the plugin details: Show details be shown? """ global plug...
[ "Show", "details", "of", "available", "plugins" ]
pingali/dgit
python
https://github.com/pingali/dgit/blob/ecde01f40b98f0719dbcfb54452270ed2f86686d/dgitcore/plugins/common.py#L252-L265
[ "def", "plugins_show", "(", "what", "=", "None", ",", "name", "=", "None", ",", "version", "=", "None", ",", "details", "=", "False", ")", ":", "global", "pluginmgr", "return", "pluginmgr", ".", "show", "(", "what", ",", "name", ",", "version", ",", ...
ecde01f40b98f0719dbcfb54452270ed2f86686d
valid
PluginManager.discover_all_plugins
Load all plugins from dgit extension
dgitcore/plugins/common.py
def discover_all_plugins(self): """ Load all plugins from dgit extension """ for v in pkg_resources.iter_entry_points('dgit.plugins'): m = v.load() m.setup(self)
def discover_all_plugins(self): """ Load all plugins from dgit extension """ for v in pkg_resources.iter_entry_points('dgit.plugins'): m = v.load() m.setup(self)
[ "Load", "all", "plugins", "from", "dgit", "extension" ]
pingali/dgit
python
https://github.com/pingali/dgit/blob/ecde01f40b98f0719dbcfb54452270ed2f86686d/dgitcore/plugins/common.py#L96-L102
[ "def", "discover_all_plugins", "(", "self", ")", ":", "for", "v", "in", "pkg_resources", ".", "iter_entry_points", "(", "'dgit.plugins'", ")", ":", "m", "=", "v", ".", "load", "(", ")", "m", ".", "setup", "(", "self", ")" ]
ecde01f40b98f0719dbcfb54452270ed2f86686d
valid
PluginManager.register
Registering a plugin Params ------ what: Nature of the plugin (backend, instrumentation, repo) obj: Instance of the plugin
dgitcore/plugins/common.py
def register(self, what, obj): """ Registering a plugin Params ------ what: Nature of the plugin (backend, instrumentation, repo) obj: Instance of the plugin """ # print("Registering pattern", name, pattern) name = obj.name version = obj.v...
def register(self, what, obj): """ Registering a plugin Params ------ what: Nature of the plugin (backend, instrumentation, repo) obj: Instance of the plugin """ # print("Registering pattern", name, pattern) name = obj.name version = obj.v...
[ "Registering", "a", "plugin" ]
pingali/dgit
python
https://github.com/pingali/dgit/blob/ecde01f40b98f0719dbcfb54452270ed2f86686d/dgitcore/plugins/common.py#L104-L121
[ "def", "register", "(", "self", ",", "what", ",", "obj", ")", ":", "# print(\"Registering pattern\", name, pattern)", "name", "=", "obj", ".", "name", "version", "=", "obj", ".", "version", "enable", "=", "obj", ".", "enable", "if", "enable", "==", "'n'", ...
ecde01f40b98f0719dbcfb54452270ed2f86686d
valid
PluginManager.search
Search for a plugin
dgitcore/plugins/common.py
def search(self, what, name=None, version=None): """ Search for a plugin """ filtered = {} # The search may for a scan (what is None) or if what is None: whats = list(self.plugins.keys()) elif what is not None: if what not in self.plugins:...
def search(self, what, name=None, version=None): """ Search for a plugin """ filtered = {} # The search may for a scan (what is None) or if what is None: whats = list(self.plugins.keys()) elif what is not None: if what not in self.plugins:...
[ "Search", "for", "a", "plugin" ]
pingali/dgit
python
https://github.com/pingali/dgit/blob/ecde01f40b98f0719dbcfb54452270ed2f86686d/dgitcore/plugins/common.py#L123-L150
[ "def", "search", "(", "self", ",", "what", ",", "name", "=", "None", ",", "version", "=", "None", ")", ":", "filtered", "=", "{", "}", "# The search may for a scan (what is None) or", "if", "what", "is", "None", ":", "whats", "=", "list", "(", "self", "....
ecde01f40b98f0719dbcfb54452270ed2f86686d
valid
PluginManager.gather_configs
Gather configuration requirements of all plugins
dgitcore/plugins/common.py
def gather_configs(self): """ Gather configuration requirements of all plugins """ configs = [] for what in self.order: for key in self.plugins[what]: mgr = self.plugins[what][key] c = mgr.config(what='get') if c is not ...
def gather_configs(self): """ Gather configuration requirements of all plugins """ configs = [] for what in self.order: for key in self.plugins[what]: mgr = self.plugins[what][key] c = mgr.config(what='get') if c is not ...
[ "Gather", "configuration", "requirements", "of", "all", "plugins" ]
pingali/dgit
python
https://github.com/pingali/dgit/blob/ecde01f40b98f0719dbcfb54452270ed2f86686d/dgitcore/plugins/common.py#L152-L167
[ "def", "gather_configs", "(", "self", ")", ":", "configs", "=", "[", "]", "for", "what", "in", "self", ".", "order", ":", "for", "key", "in", "self", ".", "plugins", "[", "what", "]", ":", "mgr", "=", "self", ".", "plugins", "[", "what", "]", "["...
ecde01f40b98f0719dbcfb54452270ed2f86686d
valid
PluginManager.update_configs
Gather configuration requirements of all plugins
dgitcore/plugins/common.py
def update_configs(self, config): """ Gather configuration requirements of all plugins """ for what in self.plugins: # backend, repo etc. for key in self.plugins[what]: # s3, filesystem etc. # print("Updating configuration of", what, key) self...
def update_configs(self, config): """ Gather configuration requirements of all plugins """ for what in self.plugins: # backend, repo etc. for key in self.plugins[what]: # s3, filesystem etc. # print("Updating configuration of", what, key) self...
[ "Gather", "configuration", "requirements", "of", "all", "plugins" ]
pingali/dgit
python
https://github.com/pingali/dgit/blob/ecde01f40b98f0719dbcfb54452270ed2f86686d/dgitcore/plugins/common.py#L169-L177
[ "def", "update_configs", "(", "self", ",", "config", ")", ":", "for", "what", "in", "self", ".", "plugins", ":", "# backend, repo etc.", "for", "key", "in", "self", ".", "plugins", "[", "what", "]", ":", "# s3, filesystem etc.", "# print(\"Updating configuration...
ecde01f40b98f0719dbcfb54452270ed2f86686d
valid
BootLoaderThread.run
Receives the serial data into the self._raw buffer :return:
booty/comm_thread.py
def run(self): """ Receives the serial data into the self._raw buffer :return: """ run_once = True while (run_once or self._threaded) and self.end is False: self.service_tx_queue() self.parse_messages() run_once = False if...
def run(self): """ Receives the serial data into the self._raw buffer :return: """ run_once = True while (run_once or self._threaded) and self.end is False: self.service_tx_queue() self.parse_messages() run_once = False if...
[ "Receives", "the", "serial", "data", "into", "the", "self", ".", "_raw", "buffer", ":", "return", ":" ]
slightlynybbled/booty
python
https://github.com/slightlynybbled/booty/blob/17f13f0bc28ad855a3fab895478c85c57f356a38/booty/comm_thread.py#L330-L346
[ "def", "run", "(", "self", ")", ":", "run_once", "=", "True", "while", "(", "run_once", "or", "self", ".", "_threaded", ")", "and", "self", ".", "end", "is", "False", ":", "self", ".", "service_tx_queue", "(", ")", "self", ".", "parse_messages", "(", ...
17f13f0bc28ad855a3fab895478c85c57f356a38
valid
instantiate
Instantiate the validation specification
dgitcore/datasets/validation.py
def instantiate(repo, validator_name=None, filename=None, rulesfiles=None): """ Instantiate the validation specification """ default_validators = repo.options.get('validator', {}) validators = {} if validator_name is not None: # Handle the case validator is specified.. if valid...
def instantiate(repo, validator_name=None, filename=None, rulesfiles=None): """ Instantiate the validation specification """ default_validators = repo.options.get('validator', {}) validators = {} if validator_name is not None: # Handle the case validator is specified.. if valid...
[ "Instantiate", "the", "validation", "specification" ]
pingali/dgit
python
https://github.com/pingali/dgit/blob/ecde01f40b98f0719dbcfb54452270ed2f86686d/dgitcore/datasets/validation.py#L17-L82
[ "def", "instantiate", "(", "repo", ",", "validator_name", "=", "None", ",", "filename", "=", "None", ",", "rulesfiles", "=", "None", ")", ":", "default_validators", "=", "repo", ".", "options", ".", "get", "(", "'validator'", ",", "{", "}", ")", "validat...
ecde01f40b98f0719dbcfb54452270ed2f86686d
valid
validate
Validate the content of the files for consistency. Validators can look as deeply as needed into the files. dgit treats them all as black boxes. Parameters ---------- repo: Repository object validator_name: Name of validator, if any. If none, then all validators specified in dgit.json will be i...
dgitcore/datasets/validation.py
def validate(repo, validator_name=None, filename=None, rulesfiles=None, args=[]): """ Validate the content of the files for consistency. Validators can look as deeply as needed into the files. dgit treats them all as black boxes. Parameters ...
def validate(repo, validator_name=None, filename=None, rulesfiles=None, args=[]): """ Validate the content of the files for consistency. Validators can look as deeply as needed into the files. dgit treats them all as black boxes. Parameters ...
[ "Validate", "the", "content", "of", "the", "files", "for", "consistency", ".", "Validators", "can", "look", "as", "deeply", "as", "needed", "into", "the", "files", ".", "dgit", "treats", "them", "all", "as", "black", "boxes", "." ]
pingali/dgit
python
https://github.com/pingali/dgit/blob/ecde01f40b98f0719dbcfb54452270ed2f86686d/dgitcore/datasets/validation.py#L85-L127
[ "def", "validate", "(", "repo", ",", "validator_name", "=", "None", ",", "filename", "=", "None", ",", "rulesfiles", "=", "None", ",", "args", "=", "[", "]", ")", ":", "mgr", "=", "plugins_get_mgr", "(", ")", "# Expand the specification. Now we have full file ...
ecde01f40b98f0719dbcfb54452270ed2f86686d
valid
LocalBackend.url_is_valid
Check if a URL exists
dgitcore/contrib/backends/local.py
def url_is_valid(self, url): """ Check if a URL exists """ # Check if the file system path exists... if url.startswith("file://"): url = url.replace("file://","") return os.path.exists(url)
def url_is_valid(self, url): """ Check if a URL exists """ # Check if the file system path exists... if url.startswith("file://"): url = url.replace("file://","") return os.path.exists(url)
[ "Check", "if", "a", "URL", "exists" ]
pingali/dgit
python
https://github.com/pingali/dgit/blob/ecde01f40b98f0719dbcfb54452270ed2f86686d/dgitcore/contrib/backends/local.py#L25-L33
[ "def", "url_is_valid", "(", "self", ",", "url", ")", ":", "# Check if the file system path exists...", "if", "url", ".", "startswith", "(", "\"file://\"", ")", ":", "url", "=", "url", ".", "replace", "(", "\"file://\"", ",", "\"\"", ")", "return", "os", ".",...
ecde01f40b98f0719dbcfb54452270ed2f86686d
valid
BasicMetadata.post
Post to the metadata server Parameters ---------- repo
dgitcore/contrib/metadata/default.py
def post(self, repo): """ Post to the metadata server Parameters ---------- repo """ datapackage = repo.package url = self.url token = self.token headers = { 'Authorization': 'Token {}'.format(token), 'Content-Ty...
def post(self, repo): """ Post to the metadata server Parameters ---------- repo """ datapackage = repo.package url = self.url token = self.token headers = { 'Authorization': 'Token {}'.format(token), 'Content-Ty...
[ "Post", "to", "the", "metadata", "server" ]
pingali/dgit
python
https://github.com/pingali/dgit/blob/ecde01f40b98f0719dbcfb54452270ed2f86686d/dgitcore/contrib/metadata/default.py#L75-L104
[ "def", "post", "(", "self", ",", "repo", ")", ":", "datapackage", "=", "repo", ".", "package", "url", "=", "self", ".", "url", "token", "=", "self", ".", "token", "headers", "=", "{", "'Authorization'", ":", "'Token {}'", ".", "format", "(", "token", ...
ecde01f40b98f0719dbcfb54452270ed2f86686d
valid
get_module_class
imports and returns module class from ``path.to.module.Class`` argument
pyems/utils.py
def get_module_class(class_path): """ imports and returns module class from ``path.to.module.Class`` argument """ mod_name, cls_name = class_path.rsplit('.', 1) try: mod = import_module(mod_name) except ImportError as ex: raise EvoStreamException('Error importing module %s: ...
def get_module_class(class_path): """ imports and returns module class from ``path.to.module.Class`` argument """ mod_name, cls_name = class_path.rsplit('.', 1) try: mod = import_module(mod_name) except ImportError as ex: raise EvoStreamException('Error importing module %s: ...
[ "imports", "and", "returns", "module", "class", "from", "path", ".", "to", ".", "module", ".", "Class", "argument" ]
tomi77/pyems
python
https://github.com/tomi77/pyems/blob/8c0748b720d389f19d5226fdcceedc26cd6284ee/pyems/utils.py#L12-L25
[ "def", "get_module_class", "(", "class_path", ")", ":", "mod_name", ",", "cls_name", "=", "class_path", ".", "rsplit", "(", "'.'", ",", "1", ")", "try", ":", "mod", "=", "import_module", "(", "mod_name", ")", "except", "ImportError", "as", "ex", ":", "ra...
8c0748b720d389f19d5226fdcceedc26cd6284ee
valid
find_executable_files
Find max 5 executables that are responsible for this repo.
dgitcore/datasets/auto.py
def find_executable_files(): """ Find max 5 executables that are responsible for this repo. """ files = glob.glob("*") + glob.glob("*/*") + glob.glob('*/*/*') files = filter(lambda f: os.path.isfile(f), files) executable = stat.S_IEXEC | stat.S_IXGRP | stat.S_IXOTH final = [] for filenam...
def find_executable_files(): """ Find max 5 executables that are responsible for this repo. """ files = glob.glob("*") + glob.glob("*/*") + glob.glob('*/*/*') files = filter(lambda f: os.path.isfile(f), files) executable = stat.S_IEXEC | stat.S_IXGRP | stat.S_IXOTH final = [] for filenam...
[ "Find", "max", "5", "executables", "that", "are", "responsible", "for", "this", "repo", "." ]
pingali/dgit
python
https://github.com/pingali/dgit/blob/ecde01f40b98f0719dbcfb54452270ed2f86686d/dgitcore/datasets/auto.py#L18-L34
[ "def", "find_executable_files", "(", ")", ":", "files", "=", "glob", ".", "glob", "(", "\"*\"", ")", "+", "glob", ".", "glob", "(", "\"*/*\"", ")", "+", "glob", ".", "glob", "(", "'*/*/*'", ")", "files", "=", "filter", "(", "lambda", "f", ":", "os"...
ecde01f40b98f0719dbcfb54452270ed2f86686d
valid
auto_init
Initialize a repo-specific configuration file to execute dgit Parameters ---------- autofile: Repo-specific configuration file (dgit.json) force_init: Flag to force to re-initialization of the configuration file
dgitcore/datasets/auto.py
def auto_init(autofile, force_init=False): """ Initialize a repo-specific configuration file to execute dgit Parameters ---------- autofile: Repo-specific configuration file (dgit.json) force_init: Flag to force to re-initialization of the configuration file """ if os.path.exists(aut...
def auto_init(autofile, force_init=False): """ Initialize a repo-specific configuration file to execute dgit Parameters ---------- autofile: Repo-specific configuration file (dgit.json) force_init: Flag to force to re-initialization of the configuration file """ if os.path.exists(aut...
[ "Initialize", "a", "repo", "-", "specific", "configuration", "file", "to", "execute", "dgit" ]
pingali/dgit
python
https://github.com/pingali/dgit/blob/ecde01f40b98f0719dbcfb54452270ed2f86686d/dgitcore/datasets/auto.py#L36-L184
[ "def", "auto_init", "(", "autofile", ",", "force_init", "=", "False", ")", ":", "if", "os", ".", "path", ".", "exists", "(", "autofile", ")", "and", "not", "force_init", ":", "try", ":", "autooptions", "=", "json", ".", "loads", "(", "open", "(", "au...
ecde01f40b98f0719dbcfb54452270ed2f86686d
valid
auto_get_repo
Automatically get repo Parameters ---------- autooptions: dgit.json content
dgitcore/datasets/auto.py
def auto_get_repo(autooptions, debug=False): """ Automatically get repo Parameters ---------- autooptions: dgit.json content """ # plugin manager pluginmgr = plugins_get_mgr() # get the repo manager repomgr = pluginmgr.get(what='repomanager', name='git') repo = None ...
def auto_get_repo(autooptions, debug=False): """ Automatically get repo Parameters ---------- autooptions: dgit.json content """ # plugin manager pluginmgr = plugins_get_mgr() # get the repo manager repomgr = pluginmgr.get(what='repomanager', name='git') repo = None ...
[ "Automatically", "get", "repo" ]
pingali/dgit
python
https://github.com/pingali/dgit/blob/ecde01f40b98f0719dbcfb54452270ed2f86686d/dgitcore/datasets/auto.py#L187-L243
[ "def", "auto_get_repo", "(", "autooptions", ",", "debug", "=", "False", ")", ":", "# plugin manager", "pluginmgr", "=", "plugins_get_mgr", "(", ")", "# get the repo manager", "repomgr", "=", "pluginmgr", ".", "get", "(", "what", "=", "'repomanager'", ",", "name"...
ecde01f40b98f0719dbcfb54452270ed2f86686d
valid
get_files_to_commit
Look through the local directory to pick up files to check
dgitcore/datasets/auto.py
def get_files_to_commit(autooptions): """ Look through the local directory to pick up files to check """ workingdir = autooptions['working-directory'] includes = autooptions['track']['includes'] excludes = autooptions['track']['excludes'] # transform glob patterns to regular expressions ...
def get_files_to_commit(autooptions): """ Look through the local directory to pick up files to check """ workingdir = autooptions['working-directory'] includes = autooptions['track']['includes'] excludes = autooptions['track']['excludes'] # transform glob patterns to regular expressions ...
[ "Look", "through", "the", "local", "directory", "to", "pick", "up", "files", "to", "check" ]
pingali/dgit
python
https://github.com/pingali/dgit/blob/ecde01f40b98f0719dbcfb54452270ed2f86686d/dgitcore/datasets/auto.py#L246-L278
[ "def", "get_files_to_commit", "(", "autooptions", ")", ":", "workingdir", "=", "autooptions", "[", "'working-directory'", "]", "includes", "=", "autooptions", "[", "'track'", "]", "[", "'includes'", "]", "excludes", "=", "autooptions", "[", "'track'", "]", "[", ...
ecde01f40b98f0719dbcfb54452270ed2f86686d
valid
auto_add
Cleanup the paths and add
dgitcore/datasets/auto.py
def auto_add(repo, autooptions, files): """ Cleanup the paths and add """ # Get the mappings and keys. mapping = { ".": "" } if (('import' in autooptions) and ('directory-mapping' in autooptions['import'])): mapping = autooptions['import']['directory-mapping'] # Apply the lo...
def auto_add(repo, autooptions, files): """ Cleanup the paths and add """ # Get the mappings and keys. mapping = { ".": "" } if (('import' in autooptions) and ('directory-mapping' in autooptions['import'])): mapping = autooptions['import']['directory-mapping'] # Apply the lo...
[ "Cleanup", "the", "paths", "and", "add" ]
pingali/dgit
python
https://github.com/pingali/dgit/blob/ecde01f40b98f0719dbcfb54452270ed2f86686d/dgitcore/datasets/auto.py#L280-L312
[ "def", "auto_add", "(", "repo", ",", "autooptions", ",", "files", ")", ":", "# Get the mappings and keys.", "mapping", "=", "{", "\".\"", ":", "\"\"", "}", "if", "(", "(", "'import'", "in", "autooptions", ")", "and", "(", "'directory-mapping'", "in", "autoop...
ecde01f40b98f0719dbcfb54452270ed2f86686d