repository_name
stringlengths
7
55
func_path_in_repository
stringlengths
4
223
func_name
stringlengths
1
134
whole_func_string
stringlengths
75
104k
language
stringclasses
1 value
func_code_string
stringlengths
75
104k
func_code_tokens
listlengths
19
28.4k
func_documentation_string
stringlengths
1
46.9k
func_documentation_tokens
listlengths
1
1.97k
split_name
stringclasses
1 value
func_code_url
stringlengths
87
315
MacHu-GWU/angora-project
angora/math/interp.py
rigid_linear_interpolate
def rigid_linear_interpolate(x_axis, y_axis, x_new_axis): """Interpolate a y = f(x) function using linear interpolation. Rigid means the x_new_axis has to be in x_axis's range. """ f = interp1d(x_axis, y_axis) return f(x_new_axis)
python
def rigid_linear_interpolate(x_axis, y_axis, x_new_axis): """Interpolate a y = f(x) function using linear interpolation. Rigid means the x_new_axis has to be in x_axis's range. """ f = interp1d(x_axis, y_axis) return f(x_new_axis)
[ "def", "rigid_linear_interpolate", "(", "x_axis", ",", "y_axis", ",", "x_new_axis", ")", ":", "f", "=", "interp1d", "(", "x_axis", ",", "y_axis", ")", "return", "f", "(", "x_new_axis", ")" ]
Interpolate a y = f(x) function using linear interpolation. Rigid means the x_new_axis has to be in x_axis's range.
[ "Interpolate", "a", "y", "=", "f", "(", "x", ")", "function", "using", "linear", "interpolation", "." ]
train
https://github.com/MacHu-GWU/angora-project/blob/689a60da51cd88680ddbe26e28dbe81e6b01d275/angora/math/interp.py#L137-L143
MacHu-GWU/angora-project
angora/math/interp.py
rigid_linear_interpolate_by_datetime
def rigid_linear_interpolate_by_datetime(datetime_axis, y_axis, datetime_new_axis): """A datetime-version that takes datetime object list as x_axis. """ numeric_datetime_axis = [ totimestamp(a_datetime) for a_datetime in datetime_axis ] numeric_datetime_new_axis = [ totimestamp(a_da...
python
def rigid_linear_interpolate_by_datetime(datetime_axis, y_axis, datetime_new_axis): """A datetime-version that takes datetime object list as x_axis. """ numeric_datetime_axis = [ totimestamp(a_datetime) for a_datetime in datetime_axis ] numeric_datetime_new_axis = [ totimestamp(a_da...
[ "def", "rigid_linear_interpolate_by_datetime", "(", "datetime_axis", ",", "y_axis", ",", "datetime_new_axis", ")", ":", "numeric_datetime_axis", "=", "[", "totimestamp", "(", "a_datetime", ")", "for", "a_datetime", "in", "datetime_axis", "]", "numeric_datetime_new_axis", ...
A datetime-version that takes datetime object list as x_axis.
[ "A", "datetime", "-", "version", "that", "takes", "datetime", "object", "list", "as", "x_axis", "." ]
train
https://github.com/MacHu-GWU/angora-project/blob/689a60da51cd88680ddbe26e28dbe81e6b01d275/angora/math/interp.py#L146-L158
MacHu-GWU/angora-project
angora/math/interp.py
linear_interpolate
def linear_interpolate(x_axis, y_axis, x_new_axis, enable_warning=True): """Interpolate a y = f(x) function using linear interpolation. A smart way to interpolate arbitrary-range x_new_axis. The trick is to add one more point to the original x_axis at x_new_axis[0] and x_new_axis[-1], if x_new_axis i...
python
def linear_interpolate(x_axis, y_axis, x_new_axis, enable_warning=True): """Interpolate a y = f(x) function using linear interpolation. A smart way to interpolate arbitrary-range x_new_axis. The trick is to add one more point to the original x_axis at x_new_axis[0] and x_new_axis[-1], if x_new_axis i...
[ "def", "linear_interpolate", "(", "x_axis", ",", "y_axis", ",", "x_new_axis", ",", "enable_warning", "=", "True", ")", ":", "left_pad_x", ",", "left_pad_y", "=", "list", "(", ")", ",", "list", "(", ")", "right_pad_x", ",", "right_pad_y", "=", "list", "(", ...
Interpolate a y = f(x) function using linear interpolation. A smart way to interpolate arbitrary-range x_new_axis. The trick is to add one more point to the original x_axis at x_new_axis[0] and x_new_axis[-1], if x_new_axis is out of range.
[ "Interpolate", "a", "y", "=", "f", "(", "x", ")", "function", "using", "linear", "interpolation", "." ]
train
https://github.com/MacHu-GWU/angora-project/blob/689a60da51cd88680ddbe26e28dbe81e6b01d275/angora/math/interp.py#L161-L193
MacHu-GWU/angora-project
angora/math/interp.py
linear_interpolate_by_datetime
def linear_interpolate_by_datetime(datetime_axis, y_axis, datetime_new_axis, enable_warning=True): """A datetime-version that takes datetime object list as x_axis """ numeric_datetime_axis = [ totimestamp(a_datetime) for a_datetime in datetime_axis ] numer...
python
def linear_interpolate_by_datetime(datetime_axis, y_axis, datetime_new_axis, enable_warning=True): """A datetime-version that takes datetime object list as x_axis """ numeric_datetime_axis = [ totimestamp(a_datetime) for a_datetime in datetime_axis ] numer...
[ "def", "linear_interpolate_by_datetime", "(", "datetime_axis", ",", "y_axis", ",", "datetime_new_axis", ",", "enable_warning", "=", "True", ")", ":", "numeric_datetime_axis", "=", "[", "totimestamp", "(", "a_datetime", ")", "for", "a_datetime", "in", "datetime_axis", ...
A datetime-version that takes datetime object list as x_axis
[ "A", "datetime", "-", "version", "that", "takes", "datetime", "object", "list", "as", "x_axis" ]
train
https://github.com/MacHu-GWU/angora-project/blob/689a60da51cd88680ddbe26e28dbe81e6b01d275/angora/math/interp.py#L196-L210
MacHu-GWU/angora-project
angora/math/interp.py
exam_reliability
def exam_reliability(x_axis, x_axis_new, reliable_distance, precision=0.0001): """When we do linear interpolation on x_axis and derive value for x_axis_new, we also evaluate how can we trust those interpolated data points. This is how it works: For each new x_axis point in x_axis new, let's say xi. F...
python
def exam_reliability(x_axis, x_axis_new, reliable_distance, precision=0.0001): """When we do linear interpolation on x_axis and derive value for x_axis_new, we also evaluate how can we trust those interpolated data points. This is how it works: For each new x_axis point in x_axis new, let's say xi. F...
[ "def", "exam_reliability", "(", "x_axis", ",", "x_axis_new", ",", "reliable_distance", ",", "precision", "=", "0.0001", ")", ":", "x_axis", "=", "x_axis", "[", ":", ":", "-", "1", "]", "x_axis", ".", "append", "(", "-", "2", "**", "32", ")", "distance_...
When we do linear interpolation on x_axis and derive value for x_axis_new, we also evaluate how can we trust those interpolated data points. This is how it works: For each new x_axis point in x_axis new, let's say xi. Find the closest point in x_axis, suppose the distance is #dist. Compare this to ...
[ "When", "we", "do", "linear", "interpolation", "on", "x_axis", "and", "derive", "value", "for", "x_axis_new", "we", "also", "evaluate", "how", "can", "we", "trust", "those", "interpolated", "data", "points", ".", "This", "is", "how", "it", "works", ":" ]
train
https://github.com/MacHu-GWU/angora-project/blob/689a60da51cd88680ddbe26e28dbe81e6b01d275/angora/math/interp.py#L213-L262
MacHu-GWU/angora-project
angora/math/interp.py
exam_reliability_by_datetime
def exam_reliability_by_datetime( datetime_axis, datetime_new_axis, reliable_distance): """A datetime-version that takes datetime object list as x_axis reliable_distance equals to the time difference in seconds. """ numeric_datetime_axis = [ totimestamp(a_datetime) for a_datetime in date...
python
def exam_reliability_by_datetime( datetime_axis, datetime_new_axis, reliable_distance): """A datetime-version that takes datetime object list as x_axis reliable_distance equals to the time difference in seconds. """ numeric_datetime_axis = [ totimestamp(a_datetime) for a_datetime in date...
[ "def", "exam_reliability_by_datetime", "(", "datetime_axis", ",", "datetime_new_axis", ",", "reliable_distance", ")", ":", "numeric_datetime_axis", "=", "[", "totimestamp", "(", "a_datetime", ")", "for", "a_datetime", "in", "datetime_axis", "]", "numeric_datetime_new_axis...
A datetime-version that takes datetime object list as x_axis reliable_distance equals to the time difference in seconds.
[ "A", "datetime", "-", "version", "that", "takes", "datetime", "object", "list", "as", "x_axis", "reliable_distance", "equals", "to", "the", "time", "difference", "in", "seconds", "." ]
train
https://github.com/MacHu-GWU/angora-project/blob/689a60da51cd88680ddbe26e28dbe81e6b01d275/angora/math/interp.py#L265-L279
MacHu-GWU/angora-project
angora/math/interp.py
spline_interpolate
def spline_interpolate(x_axis, y_axis, x_new_axis): """Interpolate a y = f(x) function using Spline interpolation algorithm, x_new_axis has to be in range of x_axis. `Spline interpolation <https://en.wikipedia.org/wiki/Spline_interpolation>`_ is a popular interpolation method. Way more accurate than l...
python
def spline_interpolate(x_axis, y_axis, x_new_axis): """Interpolate a y = f(x) function using Spline interpolation algorithm, x_new_axis has to be in range of x_axis. `Spline interpolation <https://en.wikipedia.org/wiki/Spline_interpolation>`_ is a popular interpolation method. Way more accurate than l...
[ "def", "spline_interpolate", "(", "x_axis", ",", "y_axis", ",", "x_new_axis", ")", ":", "f", "=", "interp1d", "(", "x_axis", ",", "y_axis", ",", "kind", "=", "\"cubic\"", ")", "return", "f", "(", "x_new_axis", ")" ]
Interpolate a y = f(x) function using Spline interpolation algorithm, x_new_axis has to be in range of x_axis. `Spline interpolation <https://en.wikipedia.org/wiki/Spline_interpolation>`_ is a popular interpolation method. Way more accurate than linear interpolate in average
[ "Interpolate", "a", "y", "=", "f", "(", "x", ")", "function", "using", "Spline", "interpolation", "algorithm", "x_new_axis", "has", "to", "be", "in", "range", "of", "x_axis", "." ]
train
https://github.com/MacHu-GWU/angora-project/blob/689a60da51cd88680ddbe26e28dbe81e6b01d275/angora/math/interp.py#L286-L295
MacHu-GWU/angora-project
angora/math/interp.py
spline_interpolate_by_datetime
def spline_interpolate_by_datetime(datetime_axis, y_axis, datetime_new_axis): """A datetime-version that takes datetime object list as x_axis """ numeric_datetime_axis = [ totimestamp(a_datetime) for a_datetime in datetime_axis ] numeric_datetime_new_axis = [ totimestamp(a_datetime)...
python
def spline_interpolate_by_datetime(datetime_axis, y_axis, datetime_new_axis): """A datetime-version that takes datetime object list as x_axis """ numeric_datetime_axis = [ totimestamp(a_datetime) for a_datetime in datetime_axis ] numeric_datetime_new_axis = [ totimestamp(a_datetime)...
[ "def", "spline_interpolate_by_datetime", "(", "datetime_axis", ",", "y_axis", ",", "datetime_new_axis", ")", ":", "numeric_datetime_axis", "=", "[", "totimestamp", "(", "a_datetime", ")", "for", "a_datetime", "in", "datetime_axis", "]", "numeric_datetime_new_axis", "=",...
A datetime-version that takes datetime object list as x_axis
[ "A", "datetime", "-", "version", "that", "takes", "datetime", "object", "list", "as", "x_axis" ]
train
https://github.com/MacHu-GWU/angora-project/blob/689a60da51cd88680ddbe26e28dbe81e6b01d275/angora/math/interp.py#L298-L310
csaez/wishlib
wishlib/qt/helpers.py
wrapinstance
def wrapinstance(ptr, base=None): """convert a pointer to a Qt class instance (PySide/PyQt compatible)""" if ptr is None: return None ptr = long(ptr) # Ensure type from wishlib.qt import active, QtCore, QtGui if active == "PySide": import shiboken if base is None: ...
python
def wrapinstance(ptr, base=None): """convert a pointer to a Qt class instance (PySide/PyQt compatible)""" if ptr is None: return None ptr = long(ptr) # Ensure type from wishlib.qt import active, QtCore, QtGui if active == "PySide": import shiboken if base is None: ...
[ "def", "wrapinstance", "(", "ptr", ",", "base", "=", "None", ")", ":", "if", "ptr", "is", "None", ":", "return", "None", "ptr", "=", "long", "(", "ptr", ")", "# Ensure type", "from", "wishlib", ".", "qt", "import", "active", ",", "QtCore", ",", "QtGu...
convert a pointer to a Qt class instance (PySide/PyQt compatible)
[ "convert", "a", "pointer", "to", "a", "Qt", "class", "instance", "(", "PySide", "/", "PyQt", "compatible", ")" ]
train
https://github.com/csaez/wishlib/blob/c212fa7875006a332a4cefbf69885ced9647bc2f/wishlib/qt/helpers.py#L98-L121
MacHu-GWU/angora-project
angora/text/rnd.py
rand_str
def rand_str(allowed, length): """Generate fixed-length random string from your allowed character pool. Usage Example:: >>> import string >>> randstr(string.ascii_letters + string.digits, 32) QE1UKzSrIw8z7EiEp94FJ3jwmuYNUw2N """ if (not isinstance(length, int)) or (leng...
python
def rand_str(allowed, length): """Generate fixed-length random string from your allowed character pool. Usage Example:: >>> import string >>> randstr(string.ascii_letters + string.digits, 32) QE1UKzSrIw8z7EiEp94FJ3jwmuYNUw2N """ if (not isinstance(length, int)) or (leng...
[ "def", "rand_str", "(", "allowed", ",", "length", ")", ":", "if", "(", "not", "isinstance", "(", "length", ",", "int", ")", ")", "or", "(", "length", "<=", "0", ")", ":", "raise", "Exception", "(", "\"length parameter has to be an integer greater than 0!\"", ...
Generate fixed-length random string from your allowed character pool. Usage Example:: >>> import string >>> randstr(string.ascii_letters + string.digits, 32) QE1UKzSrIw8z7EiEp94FJ3jwmuYNUw2N
[ "Generate", "fixed", "-", "length", "random", "string", "from", "your", "allowed", "character", "pool", ".", "Usage", "Example", "::", ">>>", "import", "string", ">>>", "randstr", "(", "string", ".", "ascii_letters", "+", "string", ".", "digits", "32", ")", ...
train
https://github.com/MacHu-GWU/angora-project/blob/689a60da51cd88680ddbe26e28dbe81e6b01d275/angora/text/rnd.py#L35-L50
MacHu-GWU/angora-project
angora/text/rnd.py
rand_email
def rand_email(): """Random email. Usage Example:: >>> rand_email() Z4Lljcbdw7m@npa.net """ name = random.choice(string.ascii_letters) + \ rand_str(string.ascii_letters + string.digits, random.randint(4, 14)) domain = rand_str(string.ascii_lowercase, random.randint(2, ...
python
def rand_email(): """Random email. Usage Example:: >>> rand_email() Z4Lljcbdw7m@npa.net """ name = random.choice(string.ascii_letters) + \ rand_str(string.ascii_letters + string.digits, random.randint(4, 14)) domain = rand_str(string.ascii_lowercase, random.randint(2, ...
[ "def", "rand_email", "(", ")", ":", "name", "=", "random", ".", "choice", "(", "string", ".", "ascii_letters", ")", "+", "rand_str", "(", "string", ".", "ascii_letters", "+", "string", ".", "digits", ",", "random", ".", "randint", "(", "4", ",", "14", ...
Random email. Usage Example:: >>> rand_email() Z4Lljcbdw7m@npa.net
[ "Random", "email", "." ]
train
https://github.com/MacHu-GWU/angora-project/blob/689a60da51cd88680ddbe26e28dbe81e6b01d275/angora/text/rnd.py#L89-L101
Apitax/Apitax
apitax/api/controllers/migrations/admins_controller.py
driver_status
def driver_status(name): # noqa: E501 """Retrieve the status of a loaded driver Retrieve the status of a loaded driver # noqa: E501 :param name: Get status of a driver with this name :type name: str :rtype: Response """ if(not hasAccess()): return redirectUnauthorized() driv...
python
def driver_status(name): # noqa: E501 """Retrieve the status of a loaded driver Retrieve the status of a loaded driver # noqa: E501 :param name: Get status of a driver with this name :type name: str :rtype: Response """ if(not hasAccess()): return redirectUnauthorized() driv...
[ "def", "driver_status", "(", "name", ")", ":", "# noqa: E501", "if", "(", "not", "hasAccess", "(", ")", ")", ":", "return", "redirectUnauthorized", "(", ")", "driver", "=", "LoadedDrivers", ".", "getDefaultDriver", "(", ")", "body", "=", "{", "\"name\"", "...
Retrieve the status of a loaded driver Retrieve the status of a loaded driver # noqa: E501 :param name: Get status of a driver with this name :type name: str :rtype: Response
[ "Retrieve", "the", "status", "of", "a", "loaded", "driver" ]
train
https://github.com/Apitax/Apitax/blob/3883e45f17e01eba4edac9d1bba42f0e7a748682/apitax/api/controllers/migrations/admins_controller.py#L34-L50
krukas/Trionyx
trionyx/utils.py
import_object_by_string
def import_object_by_string(namespace): """Import object by complete namespace""" segments = namespace.split('.') module = importlib.import_module('.'.join(segments[:-1])) return getattr(module, segments[-1])
python
def import_object_by_string(namespace): """Import object by complete namespace""" segments = namespace.split('.') module = importlib.import_module('.'.join(segments[:-1])) return getattr(module, segments[-1])
[ "def", "import_object_by_string", "(", "namespace", ")", ":", "segments", "=", "namespace", ".", "split", "(", "'.'", ")", "module", "=", "importlib", ".", "import_module", "(", "'.'", ".", "join", "(", "segments", "[", ":", "-", "1", "]", ")", ")", "r...
Import object by complete namespace
[ "Import", "object", "by", "complete", "namespace" ]
train
https://github.com/krukas/Trionyx/blob/edac132cc0797190153f2e60bc7e88cb50e80da6/trionyx/utils.py#L24-L28
krukas/Trionyx
trionyx/utils.py
create_celerybeat_schedule
def create_celerybeat_schedule(apps): """Create Celery beat schedule by get schedule from every installed app""" beat_schedule = {} for app in apps: try: config = import_object_by_string(app) module = importlib.import_module('{}.cron'.format(config.name)) except Excep...
python
def create_celerybeat_schedule(apps): """Create Celery beat schedule by get schedule from every installed app""" beat_schedule = {} for app in apps: try: config = import_object_by_string(app) module = importlib.import_module('{}.cron'.format(config.name)) except Excep...
[ "def", "create_celerybeat_schedule", "(", "apps", ")", ":", "beat_schedule", "=", "{", "}", "for", "app", "in", "apps", ":", "try", ":", "config", "=", "import_object_by_string", "(", "app", ")", "module", "=", "importlib", ".", "import_module", "(", "'{}.cr...
Create Celery beat schedule by get schedule from every installed app
[ "Create", "Celery", "beat", "schedule", "by", "get", "schedule", "from", "every", "installed", "app" ]
train
https://github.com/krukas/Trionyx/blob/edac132cc0797190153f2e60bc7e88cb50e80da6/trionyx/utils.py#L31-L57
armstrong/armstrong.hatband
armstrong/hatband/__init__.py
autodiscover
def autodiscover(): """ TODO: document """ from django.contrib.admin import autodiscover as django_autodiscover django_autodiscover() from copy import copy from django.contrib.admin import site as django_site registry = copy(django_site._registry) registry.update(site._registry) ...
python
def autodiscover(): """ TODO: document """ from django.contrib.admin import autodiscover as django_autodiscover django_autodiscover() from copy import copy from django.contrib.admin import site as django_site registry = copy(django_site._registry) registry.update(site._registry) ...
[ "def", "autodiscover", "(", ")", ":", "from", "django", ".", "contrib", ".", "admin", "import", "autodiscover", "as", "django_autodiscover", "django_autodiscover", "(", ")", "from", "copy", "import", "copy", "from", "django", ".", "contrib", ".", "admin", "imp...
TODO: document
[ "TODO", ":", "document" ]
train
https://github.com/armstrong/armstrong.hatband/blob/b34027c85a8ccfe2ee37aa9348d98e143d300082/armstrong/hatband/__init__.py#L10-L21
kqdtran/gittalk
gittalk/core.py
say
def say(text='This is so cool', rate_adjust=-50, volume_adjust=0): ''' Says an English text, with any adjust rate and/or volume ''' # Adjusts the property rate = engine.getProperty('rate') engine.setProperty('rate', rate+rate_adjust) volume = engine.getProperty('volume') engine.setProper...
python
def say(text='This is so cool', rate_adjust=-50, volume_adjust=0): ''' Says an English text, with any adjust rate and/or volume ''' # Adjusts the property rate = engine.getProperty('rate') engine.setProperty('rate', rate+rate_adjust) volume = engine.getProperty('volume') engine.setProper...
[ "def", "say", "(", "text", "=", "'This is so cool'", ",", "rate_adjust", "=", "-", "50", ",", "volume_adjust", "=", "0", ")", ":", "# Adjusts the property", "rate", "=", "engine", ".", "getProperty", "(", "'rate'", ")", "engine", ".", "setProperty", "(", "...
Says an English text, with any adjust rate and/or volume
[ "Says", "an", "English", "text", "with", "any", "adjust", "rate", "and", "/", "or", "volume" ]
train
https://github.com/kqdtran/gittalk/blob/7b055e8bbc6177001fd3d69c5ef76360c6db560b/gittalk/core.py#L12-L24
chamrc/to
to/net/resnet.py
conv3x3
def conv3x3(in_planes, out_planes, fn, stride=1): """3x3 convolution with padding""" return fn(in_planes, out_planes, kernel_size=3, stride=stride, padding=1, bias=False)
python
def conv3x3(in_planes, out_planes, fn, stride=1): """3x3 convolution with padding""" return fn(in_planes, out_planes, kernel_size=3, stride=stride, padding=1, bias=False)
[ "def", "conv3x3", "(", "in_planes", ",", "out_planes", ",", "fn", ",", "stride", "=", "1", ")", ":", "return", "fn", "(", "in_planes", ",", "out_planes", ",", "kernel_size", "=", "3", ",", "stride", "=", "stride", ",", "padding", "=", "1", ",", "bias...
3x3 convolution with padding
[ "3x3", "convolution", "with", "padding" ]
train
https://github.com/chamrc/to/blob/ea1122bef08615b6c19904dadf2608e10c20c960/to/net/resnet.py#L45-L47
asphalt-framework/asphalt-redis
asphalt/redis/component.py
RedisComponent.configure_client
def configure_client( cls, address: Union[str, Tuple[str, int], Path] = 'localhost', port: int = 6379, db: int = 0, password: str = None, ssl: Union[bool, str, SSLContext] = False, **client_args) -> Dict[str, Any]: """ Configure a Redis client. :param address...
python
def configure_client( cls, address: Union[str, Tuple[str, int], Path] = 'localhost', port: int = 6379, db: int = 0, password: str = None, ssl: Union[bool, str, SSLContext] = False, **client_args) -> Dict[str, Any]: """ Configure a Redis client. :param address...
[ "def", "configure_client", "(", "cls", ",", "address", ":", "Union", "[", "str", ",", "Tuple", "[", "str", ",", "int", "]", ",", "Path", "]", "=", "'localhost'", ",", "port", ":", "int", "=", "6379", ",", "db", ":", "int", "=", "0", ",", "passwor...
Configure a Redis client. :param address: IP address, host name or path to a UNIX socket :param port: port number to connect to (ignored for UNIX sockets) :param db: database number to connect to :param password: password used if the server requires authentication :param ssl: on...
[ "Configure", "a", "Redis", "client", "." ]
train
https://github.com/asphalt-framework/asphalt-redis/blob/ac4d01f77d55f225fb3c0e950c38bd4100916331/asphalt/redis/component.py#L46-L79
LeonardMH/namealizer
namealizer/namealizer.py
format_word_list_mixedcase
def format_word_list_mixedcase(word_list): """ Given a list of words, this function returns a new list where the words follow mixed case convention. As a reminder this is mixedCase. :param word_list: list, a list of words :return: list, a list of words where the words are mixed case """ ...
python
def format_word_list_mixedcase(word_list): """ Given a list of words, this function returns a new list where the words follow mixed case convention. As a reminder this is mixedCase. :param word_list: list, a list of words :return: list, a list of words where the words are mixed case """ ...
[ "def", "format_word_list_mixedcase", "(", "word_list", ")", ":", "to_return", ",", "first_word", "=", "list", "(", ")", ",", "True", "for", "word", "in", "word_list", ":", "if", "first_word", ":", "to_return", ".", "append", "(", "word", ".", "lower", "(",...
Given a list of words, this function returns a new list where the words follow mixed case convention. As a reminder this is mixedCase. :param word_list: list, a list of words :return: list, a list of words where the words are mixed case
[ "Given", "a", "list", "of", "words", "this", "function", "returns", "a", "new", "list", "where", "the", "words", "follow", "mixed", "case", "convention", "." ]
train
https://github.com/LeonardMH/namealizer/blob/ef09492fb4565b692fda329dc02b8c4364f1cc0a/namealizer/namealizer.py#L106-L123
LeonardMH/namealizer
namealizer/namealizer.py
format_string
def format_string(string_to_format, wordstyle="lowercase", separator=" "): """ Takes an un-formatted string and returns it in the desired format Acceptable formats are defined in the function_map dictionary. """ # first split the string up into its constituent words words = string_to_format.spli...
python
def format_string(string_to_format, wordstyle="lowercase", separator=" "): """ Takes an un-formatted string and returns it in the desired format Acceptable formats are defined in the function_map dictionary. """ # first split the string up into its constituent words words = string_to_format.spli...
[ "def", "format_string", "(", "string_to_format", ",", "wordstyle", "=", "\"lowercase\"", ",", "separator", "=", "\" \"", ")", ":", "# first split the string up into its constituent words", "words", "=", "string_to_format", ".", "split", "(", "\" \"", ")", "# format the ...
Takes an un-formatted string and returns it in the desired format Acceptable formats are defined in the function_map dictionary.
[ "Takes", "an", "un", "-", "formatted", "string", "and", "returns", "it", "in", "the", "desired", "format", "Acceptable", "formats", "are", "defined", "in", "the", "function_map", "dictionary", "." ]
train
https://github.com/LeonardMH/namealizer/blob/ef09492fb4565b692fda329dc02b8c4364f1cc0a/namealizer/namealizer.py#L126-L149
LeonardMH/namealizer
namealizer/namealizer.py
get_random_word
def get_random_word(dictionary, starting_letter=None): """ Takes the dictionary to read from and returns a random word optionally accepts a starting letter """ if starting_letter is None: starting_letter = random.choice(list(dictionary.keys())) try: to_return = random.choice(dic...
python
def get_random_word(dictionary, starting_letter=None): """ Takes the dictionary to read from and returns a random word optionally accepts a starting letter """ if starting_letter is None: starting_letter = random.choice(list(dictionary.keys())) try: to_return = random.choice(dic...
[ "def", "get_random_word", "(", "dictionary", ",", "starting_letter", "=", "None", ")", ":", "if", "starting_letter", "is", "None", ":", "starting_letter", "=", "random", ".", "choice", "(", "list", "(", "dictionary", ".", "keys", "(", ")", ")", ")", "try",...
Takes the dictionary to read from and returns a random word optionally accepts a starting letter
[ "Takes", "the", "dictionary", "to", "read", "from", "and", "returns", "a", "random", "word", "optionally", "accepts", "a", "starting", "letter" ]
train
https://github.com/LeonardMH/namealizer/blob/ef09492fb4565b692fda329dc02b8c4364f1cc0a/namealizer/namealizer.py#L152-L166
LeonardMH/namealizer
namealizer/namealizer.py
import_dictionary
def import_dictionary(dictionary): """ Function used to import the dictionary file into memory opened_file should be an already opened dictionary file :raises DictionaryNotFoundError if dictionary can't be loaded """ def load_into_dictionary(dictionary_file): """create the dictionary to...
python
def import_dictionary(dictionary): """ Function used to import the dictionary file into memory opened_file should be an already opened dictionary file :raises DictionaryNotFoundError if dictionary can't be loaded """ def load_into_dictionary(dictionary_file): """create the dictionary to...
[ "def", "import_dictionary", "(", "dictionary", ")", ":", "def", "load_into_dictionary", "(", "dictionary_file", ")", ":", "\"\"\"create the dictionary to hold the words\"\"\"", "to_return", "=", "dict", "(", ")", "for", "line", "in", "dictionary_file", ":", "try", ":"...
Function used to import the dictionary file into memory opened_file should be an already opened dictionary file :raises DictionaryNotFoundError if dictionary can't be loaded
[ "Function", "used", "to", "import", "the", "dictionary", "file", "into", "memory", "opened_file", "should", "be", "an", "already", "opened", "dictionary", "file" ]
train
https://github.com/LeonardMH/namealizer/blob/ef09492fb4565b692fda329dc02b8c4364f1cc0a/namealizer/namealizer.py#L169-L198
LeonardMH/namealizer
namealizer/namealizer.py
string_for_initials
def string_for_initials(dictionary, initials): """Create a random string of words of len(initials)""" string_to_print = "" for letter in initials: word = get_random_word(dictionary, letter.lower()) string_to_print += "{} ".format(word) return string_to_print.strip()
python
def string_for_initials(dictionary, initials): """Create a random string of words of len(initials)""" string_to_print = "" for letter in initials: word = get_random_word(dictionary, letter.lower()) string_to_print += "{} ".format(word) return string_to_print.strip()
[ "def", "string_for_initials", "(", "dictionary", ",", "initials", ")", ":", "string_to_print", "=", "\"\"", "for", "letter", "in", "initials", ":", "word", "=", "get_random_word", "(", "dictionary", ",", "letter", ".", "lower", "(", ")", ")", "string_to_print"...
Create a random string of words of len(initials)
[ "Create", "a", "random", "string", "of", "words", "of", "len", "(", "initials", ")" ]
train
https://github.com/LeonardMH/namealizer/blob/ef09492fb4565b692fda329dc02b8c4364f1cc0a/namealizer/namealizer.py#L201-L208
LeonardMH/namealizer
namealizer/namealizer.py
string_for_count
def string_for_count(dictionary, count): """Create a random string of N=`count` words""" string_to_print = "" if count is not None: if count == 0: return "" ranger = count else: ranger = 2 for index in range(ranger): string_to_print += "{} ".format(get_ran...
python
def string_for_count(dictionary, count): """Create a random string of N=`count` words""" string_to_print = "" if count is not None: if count == 0: return "" ranger = count else: ranger = 2 for index in range(ranger): string_to_print += "{} ".format(get_ran...
[ "def", "string_for_count", "(", "dictionary", ",", "count", ")", ":", "string_to_print", "=", "\"\"", "if", "count", "is", "not", "None", ":", "if", "count", "==", "0", ":", "return", "\"\"", "ranger", "=", "count", "else", ":", "ranger", "=", "2", "fo...
Create a random string of N=`count` words
[ "Create", "a", "random", "string", "of", "N", "=", "count", "words" ]
train
https://github.com/LeonardMH/namealizer/blob/ef09492fb4565b692fda329dc02b8c4364f1cc0a/namealizer/namealizer.py#L211-L223
LeonardMH/namealizer
namealizer/namealizer.py
generate_seed
def generate_seed(seed): """Generate seed for random number generator""" if seed is None: random.seed() seed = random.randint(0, sys.maxsize) random.seed(a=seed) return seed
python
def generate_seed(seed): """Generate seed for random number generator""" if seed is None: random.seed() seed = random.randint(0, sys.maxsize) random.seed(a=seed) return seed
[ "def", "generate_seed", "(", "seed", ")", ":", "if", "seed", "is", "None", ":", "random", ".", "seed", "(", ")", "seed", "=", "random", ".", "randint", "(", "0", ",", "sys", ".", "maxsize", ")", "random", ".", "seed", "(", "a", "=", "seed", ")", ...
Generate seed for random number generator
[ "Generate", "seed", "for", "random", "number", "generator" ]
train
https://github.com/LeonardMH/namealizer/blob/ef09492fb4565b692fda329dc02b8c4364f1cc0a/namealizer/namealizer.py#L226-L233
LeonardMH/namealizer
namealizer/namealizer.py
main
def main(dictionary='dictionaries/all_en_US.dict', count=None, initials=None, seed=None, wordstyle='lowercase', separator=' '): """Main processing function for namealizer""" generate_seed(seed) # attempt to read in the given dictionary dictionary = import_dictionary(dictionary) # if count...
python
def main(dictionary='dictionaries/all_en_US.dict', count=None, initials=None, seed=None, wordstyle='lowercase', separator=' '): """Main processing function for namealizer""" generate_seed(seed) # attempt to read in the given dictionary dictionary = import_dictionary(dictionary) # if count...
[ "def", "main", "(", "dictionary", "=", "'dictionaries/all_en_US.dict'", ",", "count", "=", "None", ",", "initials", "=", "None", ",", "seed", "=", "None", ",", "wordstyle", "=", "'lowercase'", ",", "separator", "=", "' '", ")", ":", "generate_seed", "(", "...
Main processing function for namealizer
[ "Main", "processing", "function", "for", "namealizer" ]
train
https://github.com/LeonardMH/namealizer/blob/ef09492fb4565b692fda329dc02b8c4364f1cc0a/namealizer/namealizer.py#L236-L254
LeonardMH/namealizer
namealizer/namealizer.py
create_parser
def create_parser(): """Creates the Namespace object to be used by the rest of the tool""" parser = argparse.ArgumentParser(description=__doc__) parser.add_argument('-d', '--dictionary', nargs='?', default='dictionaries/all_en_US.dict', ...
python
def create_parser(): """Creates the Namespace object to be used by the rest of the tool""" parser = argparse.ArgumentParser(description=__doc__) parser.add_argument('-d', '--dictionary', nargs='?', default='dictionaries/all_en_US.dict', ...
[ "def", "create_parser", "(", ")", ":", "parser", "=", "argparse", ".", "ArgumentParser", "(", "description", "=", "__doc__", ")", "parser", ".", "add_argument", "(", "'-d'", ",", "'--dictionary'", ",", "nargs", "=", "'?'", ",", "default", "=", "'dictionaries...
Creates the Namespace object to be used by the rest of the tool
[ "Creates", "the", "Namespace", "object", "to", "be", "used", "by", "the", "rest", "of", "the", "tool" ]
train
https://github.com/LeonardMH/namealizer/blob/ef09492fb4565b692fda329dc02b8c4364f1cc0a/namealizer/namealizer.py#L257-L288
Akay7/nosql2django
nosql2django/parser_mapper.py
ParserMapper.save_to_db
def save_to_db(model_text_id, parsed_values): """save to db and return saved object""" Model = apps.get_model(model_text_id) # normalise values and separate to m2m, simple simple_fields = {} many2many_fields = {} for field, value in parsed_values.items(): if ...
python
def save_to_db(model_text_id, parsed_values): """save to db and return saved object""" Model = apps.get_model(model_text_id) # normalise values and separate to m2m, simple simple_fields = {} many2many_fields = {} for field, value in parsed_values.items(): if ...
[ "def", "save_to_db", "(", "model_text_id", ",", "parsed_values", ")", ":", "Model", "=", "apps", ".", "get_model", "(", "model_text_id", ")", "# normalise values and separate to m2m, simple", "simple_fields", "=", "{", "}", "many2many_fields", "=", "{", "}", "for", ...
save to db and return saved object
[ "save", "to", "db", "and", "return", "saved", "object" ]
train
https://github.com/Akay7/nosql2django/blob/f33af832d4d0d652bd730471d1ce6a717700d1e7/nosql2django/parser_mapper.py#L27-L53
iamFIREcracker/aadbook
aadbook/storage.py
Storage.iteritems
def iteritems(self): ''' Iterate over all (key, value) pairs. All keys will be denormalized. ''' for key, value in self._dict.items(): yield self._denormalize(key), value
python
def iteritems(self): ''' Iterate over all (key, value) pairs. All keys will be denormalized. ''' for key, value in self._dict.items(): yield self._denormalize(key), value
[ "def", "iteritems", "(", "self", ")", ":", "for", "key", ",", "value", "in", "self", ".", "_dict", ".", "items", "(", ")", ":", "yield", "self", ".", "_denormalize", "(", "key", ")", ",", "value" ]
Iterate over all (key, value) pairs. All keys will be denormalized.
[ "Iterate", "over", "all", "(", "key", "value", ")", "pairs", ".", "All", "keys", "will", "be", "denormalized", "." ]
train
https://github.com/iamFIREcracker/aadbook/blob/d191e9d36a2309449ab91c1728eaf5901b7ef91c/aadbook/storage.py#L80-L85
TkTech/pytextql
pytextql/util.py
grouper
def grouper(iterable, n): """ Slice up `iterable` into iterables of `n` items. :param iterable: Iterable to splice. :param n: Number of items per slice. :returns: iterable of iterables """ it = iter(iterable) while True: chunk = itertools.islice(it, n) try: f...
python
def grouper(iterable, n): """ Slice up `iterable` into iterables of `n` items. :param iterable: Iterable to splice. :param n: Number of items per slice. :returns: iterable of iterables """ it = iter(iterable) while True: chunk = itertools.islice(it, n) try: f...
[ "def", "grouper", "(", "iterable", ",", "n", ")", ":", "it", "=", "iter", "(", "iterable", ")", "while", "True", ":", "chunk", "=", "itertools", ".", "islice", "(", "it", ",", "n", ")", "try", ":", "first", "=", "next", "(", "chunk", ")", "except...
Slice up `iterable` into iterables of `n` items. :param iterable: Iterable to splice. :param n: Number of items per slice. :returns: iterable of iterables
[ "Slice", "up", "iterable", "into", "iterables", "of", "n", "items", "." ]
train
https://github.com/TkTech/pytextql/blob/e054a7a4df7262deaca49bdbf748c00acf011b51/pytextql/util.py#L6-L22
GMadorell/abris
abris_transform/transformations/transformer.py
Transformer.prepare
def prepare(self, dataframe): """ Takes the already cleaned dataframe, splits it into train and test and returns the train and test as numpy arrays. If the problem is supervised, the target column will be that last one of the returned arrays. """ mapping = DataFra...
python
def prepare(self, dataframe): """ Takes the already cleaned dataframe, splits it into train and test and returns the train and test as numpy arrays. If the problem is supervised, the target column will be that last one of the returned arrays. """ mapping = DataFra...
[ "def", "prepare", "(", "self", ",", "dataframe", ")", ":", "mapping", "=", "DataFrameMapCreator", "(", ")", ".", "get_mapping_from_config", "(", "self", ".", "__config", ")", "self", ".", "__mapper", "=", "DataFrameMapper", "(", "mapping", ")", "train", ",",...
Takes the already cleaned dataframe, splits it into train and test and returns the train and test as numpy arrays. If the problem is supervised, the target column will be that last one of the returned arrays.
[ "Takes", "the", "already", "cleaned", "dataframe", "splits", "it", "into", "train", "and", "test", "and", "returns", "the", "train", "and", "test", "as", "numpy", "arrays", ".", "If", "the", "problem", "is", "supervised", "the", "target", "column", "will", ...
train
https://github.com/GMadorell/abris/blob/0d8ab7ec506835a45fae6935d129f5d7e6937bb2/abris_transform/transformations/transformer.py#L24-L34
GMadorell/abris
abris_transform/transformations/transformer.py
Transformer.__add_target_data
def __add_target_data(self, transformed_data, original_data): """ Picks up the target data from the original_data and appends it as a column to the transformed_data. Both arguments are expected to be np.array's. """ model = self.__config.get_data_model() target_fe...
python
def __add_target_data(self, transformed_data, original_data): """ Picks up the target data from the original_data and appends it as a column to the transformed_data. Both arguments are expected to be np.array's. """ model = self.__config.get_data_model() target_fe...
[ "def", "__add_target_data", "(", "self", ",", "transformed_data", ",", "original_data", ")", ":", "model", "=", "self", ".", "__config", ".", "get_data_model", "(", ")", "target_feature", "=", "model", ".", "find_target_feature", "(", ")", "name", "=", "target...
Picks up the target data from the original_data and appends it as a column to the transformed_data. Both arguments are expected to be np.array's.
[ "Picks", "up", "the", "target", "data", "from", "the", "original_data", "and", "appends", "it", "as", "a", "column", "to", "the", "transformed_data", ".", "Both", "arguments", "are", "expected", "to", "be", "np", ".", "array", "s", "." ]
train
https://github.com/GMadorell/abris/blob/0d8ab7ec506835a45fae6935d129f5d7e6937bb2/abris_transform/transformations/transformer.py#L48-L66
luismasuelli/python-cantrips
cantrips/entropy.py
weighted_random
def weighted_random(sequence): """ Given a sequence of pairs (element, weight) where weight is an addable/total-order-comparable (e.g. a number), it returns a random element (first item in each pair) given in a non-uniform way given by the weight of the element (second item in each pair) :param ...
python
def weighted_random(sequence): """ Given a sequence of pairs (element, weight) where weight is an addable/total-order-comparable (e.g. a number), it returns a random element (first item in each pair) given in a non-uniform way given by the weight of the element (second item in each pair) :param ...
[ "def", "weighted_random", "(", "sequence", ")", ":", "if", "isinstance", "(", "sequence", ",", "dict", ")", ":", "sequence", "=", "sequence", ".", "items", "(", ")", "accumulated", "=", "list", "(", "labeled_accumulate", "(", "sequence", ")", ")", "r", "...
Given a sequence of pairs (element, weight) where weight is an addable/total-order-comparable (e.g. a number), it returns a random element (first item in each pair) given in a non-uniform way given by the weight of the element (second item in each pair) :param sequence: sequence/iterator of pairs (eleme...
[ "Given", "a", "sequence", "of", "pairs", "(", "element", "weight", ")", "where", "weight", "is", "an", "addable", "/", "total", "-", "order", "-", "comparable", "(", "e", ".", "g", ".", "a", "number", ")", "it", "returns", "a", "random", "element", "...
train
https://github.com/luismasuelli/python-cantrips/blob/dba2742c1d1a60863bb65f4a291464f6e68eb2ee/cantrips/entropy.py#L20-L38
luismasuelli/python-cantrips
cantrips/entropy.py
nonce
def nonce(algorithm='sha1', to_hex=True): """ Generates a nonce (a pseudo-random token). It is seeded with the current date/time. :param algorithm: a string being any of the SHA hash algorithms. :param to_hex: a boolean describing whether we want a base64 digest or a hexadecimal digest :return: ...
python
def nonce(algorithm='sha1', to_hex=True): """ Generates a nonce (a pseudo-random token). It is seeded with the current date/time. :param algorithm: a string being any of the SHA hash algorithms. :param to_hex: a boolean describing whether we want a base64 digest or a hexadecimal digest :return: ...
[ "def", "nonce", "(", "algorithm", "=", "'sha1'", ",", "to_hex", "=", "True", ")", ":", "if", "algorithm", "not", "in", "_HASHES", ":", "return", "None", "result", "=", "_HASHES", "[", "algorithm", "]", "(", "datetime", ".", "datetime", ".", "now", "(",...
Generates a nonce (a pseudo-random token). It is seeded with the current date/time. :param algorithm: a string being any of the SHA hash algorithms. :param to_hex: a boolean describing whether we want a base64 digest or a hexadecimal digest :return:
[ "Generates", "a", "nonce", "(", "a", "pseudo", "-", "random", "token", ")", ".", "It", "is", "seeded", "with", "the", "current", "date", "/", "time", ".", ":", "param", "algorithm", ":", "a", "string", "being", "any", "of", "the", "SHA", "hash", "alg...
train
https://github.com/luismasuelli/python-cantrips/blob/dba2742c1d1a60863bb65f4a291464f6e68eb2ee/cantrips/entropy.py#L41-L51
zeromake/aiko
aiko/response.py
Response.status
def status(self, status: int) -> None: """ 设置响应状态 """ self._status = status self._message = STATUS_CODES[status]
python
def status(self, status: int) -> None: """ 设置响应状态 """ self._status = status self._message = STATUS_CODES[status]
[ "def", "status", "(", "self", ",", "status", ":", "int", ")", "->", "None", ":", "self", ".", "_status", "=", "status", "self", ".", "_message", "=", "STATUS_CODES", "[", "status", "]" ]
设置响应状态
[ "设置响应状态" ]
train
https://github.com/zeromake/aiko/blob/53b246fa88652466a9e38ac3d1a99a6198195b0f/aiko/response.py#L197-L202
zeromake/aiko
aiko/response.py
Response.write
def write(self, data: bytes, sync: bool = False) -> None: """ 异步写入,通过 asyncio 的原生异步 """ if sync: self.sync_write(data) else: self._transport.write(data)
python
def write(self, data: bytes, sync: bool = False) -> None: """ 异步写入,通过 asyncio 的原生异步 """ if sync: self.sync_write(data) else: self._transport.write(data)
[ "def", "write", "(", "self", ",", "data", ":", "bytes", ",", "sync", ":", "bool", "=", "False", ")", "->", "None", ":", "if", "sync", ":", "self", ".", "sync_write", "(", "data", ")", "else", ":", "self", ".", "_transport", ".", "write", "(", "da...
异步写入,通过 asyncio 的原生异步
[ "异步写入,通过", "asyncio", "的原生异步" ]
train
https://github.com/zeromake/aiko/blob/53b246fa88652466a9e38ac3d1a99a6198195b0f/aiko/response.py#L210-L217
zeromake/aiko
aiko/response.py
Response.get
def get(self, name: str) -> Union[None, str, List[str]]: """ 获取 header """ if name in self._headers: return self._headers[name] return None
python
def get(self, name: str) -> Union[None, str, List[str]]: """ 获取 header """ if name in self._headers: return self._headers[name] return None
[ "def", "get", "(", "self", ",", "name", ":", "str", ")", "->", "Union", "[", "None", ",", "str", ",", "List", "[", "str", "]", "]", ":", "if", "name", "in", "self", ".", "_headers", ":", "return", "self", ".", "_headers", "[", "name", "]", "ret...
获取 header
[ "获取", "header" ]
train
https://github.com/zeromake/aiko/blob/53b246fa88652466a9e38ac3d1a99a6198195b0f/aiko/response.py#L219-L225
zeromake/aiko
aiko/response.py
Response.set
def set(self, name: str, value: Union[str, List[str]]) -> None: """ 设置 header """ self._headers[name] = value
python
def set(self, name: str, value: Union[str, List[str]]) -> None: """ 设置 header """ self._headers[name] = value
[ "def", "set", "(", "self", ",", "name", ":", "str", ",", "value", ":", "Union", "[", "str", ",", "List", "[", "str", "]", "]", ")", "->", "None", ":", "self", ".", "_headers", "[", "name", "]", "=", "value" ]
设置 header
[ "设置", "header" ]
train
https://github.com/zeromake/aiko/blob/53b246fa88652466a9e38ac3d1a99a6198195b0f/aiko/response.py#L227-L231
zeromake/aiko
aiko/response.py
Response.body
def body(self) -> Union[bytes, str, List[Any], Dict[Any, Any], RawIOBase, None]: """ 获取body """ return self._body
python
def body(self) -> Union[bytes, str, List[Any], Dict[Any, Any], RawIOBase, None]: """ 获取body """ return self._body
[ "def", "body", "(", "self", ")", "->", "Union", "[", "bytes", ",", "str", ",", "List", "[", "Any", "]", ",", "Dict", "[", "Any", ",", "Any", "]", ",", "RawIOBase", ",", "None", "]", ":", "return", "self", ".", "_body" ]
获取body
[ "获取body" ]
train
https://github.com/zeromake/aiko/blob/53b246fa88652466a9e38ac3d1a99a6198195b0f/aiko/response.py#L248-L252
zeromake/aiko
aiko/response.py
Response.body
def body(self, body: Union[bytes, str, list, dict, RawIOBase, None]) -> None: """ 设置body """ self._body = body
python
def body(self, body: Union[bytes, str, list, dict, RawIOBase, None]) -> None: """ 设置body """ self._body = body
[ "def", "body", "(", "self", ",", "body", ":", "Union", "[", "bytes", ",", "str", ",", "list", ",", "dict", ",", "RawIOBase", ",", "None", "]", ")", "->", "None", ":", "self", ".", "_body", "=", "body" ]
设置body
[ "设置body" ]
train
https://github.com/zeromake/aiko/blob/53b246fa88652466a9e38ac3d1a99a6198195b0f/aiko/response.py#L255-L259
zeromake/aiko
aiko/response.py
Response.handel_default
def handel_default(self) -> None: """ 处理设置到body上的数据默认 headers """ raw_body = self._body body = cast(Optional[bytes], None) default_type = 2 charset = self._charset or self._default_charset if raw_body is None: pass elif isinstance(raw_b...
python
def handel_default(self) -> None: """ 处理设置到body上的数据默认 headers """ raw_body = self._body body = cast(Optional[bytes], None) default_type = 2 charset = self._charset or self._default_charset if raw_body is None: pass elif isinstance(raw_b...
[ "def", "handel_default", "(", "self", ")", "->", "None", ":", "raw_body", "=", "self", ".", "_body", "body", "=", "cast", "(", "Optional", "[", "bytes", "]", ",", "None", ")", "default_type", "=", "2", "charset", "=", "self", ".", "_charset", "or", "...
处理设置到body上的数据默认 headers
[ "处理设置到body上的数据默认", "headers" ]
train
https://github.com/zeromake/aiko/blob/53b246fa88652466a9e38ac3d1a99a6198195b0f/aiko/response.py#L261-L312
zeromake/aiko
aiko/response.py
Response.flush_headers
def flush_headers(self, sync: bool = False) -> None: """ 通过异步写入 header """ if self._headers_sent: return self._headers_sent = True self.handel_default() self.write( b"HTTP/%s %d %s\r\n" % ( encode_str(self._version), ...
python
def flush_headers(self, sync: bool = False) -> None: """ 通过异步写入 header """ if self._headers_sent: return self._headers_sent = True self.handel_default() self.write( b"HTTP/%s %d %s\r\n" % ( encode_str(self._version), ...
[ "def", "flush_headers", "(", "self", ",", "sync", ":", "bool", "=", "False", ")", "->", "None", ":", "if", "self", ".", "_headers_sent", ":", "return", "self", ".", "_headers_sent", "=", "True", "self", ".", "handel_default", "(", ")", "self", ".", "wr...
通过异步写入 header
[ "通过异步写入", "header" ]
train
https://github.com/zeromake/aiko/blob/53b246fa88652466a9e38ac3d1a99a6198195b0f/aiko/response.py#L314-L350
zeromake/aiko
aiko/response.py
Response.flush_body
def flush_body(self) -> bool: """ 发送内容体 """ if self._body is None: return False elif isinstance(self._body, bytes): self.write(self._body) return True return False
python
def flush_body(self) -> bool: """ 发送内容体 """ if self._body is None: return False elif isinstance(self._body, bytes): self.write(self._body) return True return False
[ "def", "flush_body", "(", "self", ")", "->", "bool", ":", "if", "self", ".", "_body", "is", "None", ":", "return", "False", "elif", "isinstance", "(", "self", ".", "_body", ",", "bytes", ")", ":", "self", ".", "write", "(", "self", ".", "_body", ")...
发送内容体
[ "发送内容体" ]
train
https://github.com/zeromake/aiko/blob/53b246fa88652466a9e38ac3d1a99a6198195b0f/aiko/response.py#L352-L361
fr33jc/bang
bang/deployers/__init__.py
get_stage_deployers
def get_stage_deployers(keys, stack): """ Returns a list of deployer objects that *create* cloud resources. Each member of the list is responsible for provisioning a single stack resource (e.g. a virtual server, a security group, a bucket, etc...). :param keys: A list of top-level configuration k...
python
def get_stage_deployers(keys, stack): """ Returns a list of deployer objects that *create* cloud resources. Each member of the list is responsible for provisioning a single stack resource (e.g. a virtual server, a security group, a bucket, etc...). :param keys: A list of top-level configuration k...
[ "def", "get_stage_deployers", "(", "keys", ",", "stack", ")", ":", "config", "=", "stack", ".", "config", "creds", "=", "config", "[", "A", ".", "DEPLOYER_CREDS", "]", "deployers", "=", "[", "]", "for", "res_type", "in", "keys", ":", "res_configs", "=", ...
Returns a list of deployer objects that *create* cloud resources. Each member of the list is responsible for provisioning a single stack resource (e.g. a virtual server, a security group, a bucket, etc...). :param keys: A list of top-level configuration keys for which to create deployers. :ty...
[ "Returns", "a", "list", "of", "deployer", "objects", "that", "*", "create", "*", "cloud", "resources", ".", "Each", "member", "of", "the", "list", "is", "responsible", "for", "provisioning", "a", "single", "stack", "resource", "(", "e", ".", "g", ".", "a...
train
https://github.com/fr33jc/bang/blob/8f000713f88d2a9a8c1193b63ca10a6578560c16/bang/deployers/__init__.py#L25-L56
psychopenguin/limesurvey
limesurvey/limesurvey.py
set_params
def set_params(method, params): """Set params to query limesurvey""" data = {'method': method, 'params': params, 'id': str(uuid4())} return json.dumps(data)
python
def set_params(method, params): """Set params to query limesurvey""" data = {'method': method, 'params': params, 'id': str(uuid4())} return json.dumps(data)
[ "def", "set_params", "(", "method", ",", "params", ")", ":", "data", "=", "{", "'method'", ":", "method", ",", "'params'", ":", "params", ",", "'id'", ":", "str", "(", "uuid4", "(", ")", ")", "}", "return", "json", ".", "dumps", "(", "data", ")" ]
Set params to query limesurvey
[ "Set", "params", "to", "query", "limesurvey" ]
train
https://github.com/psychopenguin/limesurvey/blob/7df459a603315198f286b160638c1a330e66fa94/limesurvey/limesurvey.py#L11-L14
psychopenguin/limesurvey
limesurvey/limesurvey.py
get_session_key
def get_session_key(limedict): """This function receive a dictionary with connection parameters. { "url": "full path for remote control", "username: "account name to be used" "password" "password for account"}""" url = limedict['url'] user = limedict['username'] password = li...
python
def get_session_key(limedict): """This function receive a dictionary with connection parameters. { "url": "full path for remote control", "username: "account name to be used" "password" "password for account"}""" url = limedict['url'] user = limedict['username'] password = li...
[ "def", "get_session_key", "(", "limedict", ")", ":", "url", "=", "limedict", "[", "'url'", "]", "user", "=", "limedict", "[", "'username'", "]", "password", "=", "limedict", "[", "'password'", "]", "params", "=", "{", "'username'", ":", "user", ",", "'pa...
This function receive a dictionary with connection parameters. { "url": "full path for remote control", "username: "account name to be used" "password" "password for account"}
[ "This", "function", "receive", "a", "dictionary", "with", "connection", "parameters", ".", "{", "url", ":", "full", "path", "for", "remote", "control", "username", ":", "account", "name", "to", "be", "used", "password", "password", "for", "account", "}" ]
train
https://github.com/psychopenguin/limesurvey/blob/7df459a603315198f286b160638c1a330e66fa94/limesurvey/limesurvey.py#L17-L28
psychopenguin/limesurvey
limesurvey/limesurvey.py
list_surveys
def list_surveys(session): """retrieve a list of surveys from current user""" params = {'sUser': session['user'], 'sSessionKey': session['token']} data = set_params('list_surveys', params) req = requests.post(session['url'], data=data, headers=headers) return req.text
python
def list_surveys(session): """retrieve a list of surveys from current user""" params = {'sUser': session['user'], 'sSessionKey': session['token']} data = set_params('list_surveys', params) req = requests.post(session['url'], data=data, headers=headers) return req.text
[ "def", "list_surveys", "(", "session", ")", ":", "params", "=", "{", "'sUser'", ":", "session", "[", "'user'", "]", ",", "'sSessionKey'", ":", "session", "[", "'token'", "]", "}", "data", "=", "set_params", "(", "'list_surveys'", ",", "params", ")", "req...
retrieve a list of surveys from current user
[ "retrieve", "a", "list", "of", "surveys", "from", "current", "user" ]
train
https://github.com/psychopenguin/limesurvey/blob/7df459a603315198f286b160638c1a330e66fa94/limesurvey/limesurvey.py#L31-L36
tBaxter/tango-articles
build/lib/articles/templatetags/linkroll_tags.py
get_linkrolls
def get_linkrolls(num='All', destination_slug=None, *args, **kwargs): """ Takes an optional number and destination slug and returns a list of LinkRolls. Given a number, return list limited to the given number. Given a destination slug, limit linkrolls to the matching destination. Usage: {% g...
python
def get_linkrolls(num='All', destination_slug=None, *args, **kwargs): """ Takes an optional number and destination slug and returns a list of LinkRolls. Given a number, return list limited to the given number. Given a destination slug, limit linkrolls to the matching destination. Usage: {% g...
[ "def", "get_linkrolls", "(", "num", "=", "'All'", ",", "destination_slug", "=", "None", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "if", "destination_slug", ":", "linkrolls", "=", "LinkRoll", ".", "objects", ".", "filter", "(", "destination__slug...
Takes an optional number and destination slug and returns a list of LinkRolls. Given a number, return list limited to the given number. Given a destination slug, limit linkrolls to the matching destination. Usage: {% get_linkrolls %} {% get_linkrolls 5 %} {% get_linkrolls 5 some_slug...
[ "Takes", "an", "optional", "number", "and", "destination", "slug", "and", "returns", "a", "list", "of", "LinkRolls", ".", "Given", "a", "number", "return", "list", "limited", "to", "the", "given", "number", ".", "Given", "a", "destination", "slug", "limit", ...
train
https://github.com/tBaxter/tango-articles/blob/93818dcca1b62042a4fc19af63474691b0fe931c/build/lib/articles/templatetags/linkroll_tags.py#L8-L28
tBaxter/tango-articles
build/lib/articles/templatetags/linkroll_tags.py
get_linkroll_details
def get_linkroll_details(destination_slug, num='All', *args, **kwargs): """ Takes an optional number and destination (by id) and returns a list of links for the given linkroll. Given a number, return list limited to the given number. Given a destination slug, limit linkrolls to the matching destination....
python
def get_linkroll_details(destination_slug, num='All', *args, **kwargs): """ Takes an optional number and destination (by id) and returns a list of links for the given linkroll. Given a number, return list limited to the given number. Given a destination slug, limit linkrolls to the matching destination....
[ "def", "get_linkroll_details", "(", "destination_slug", ",", "num", "=", "'All'", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "links", "=", "Link", ".", "objects", ".", "filter", "(", "destination__slug", "=", "destination_slug", ")", "if", "num",...
Takes an optional number and destination (by id) and returns a list of links for the given linkroll. Given a number, return list limited to the given number. Given a destination slug, limit linkrolls to the matching destination. Usage: {% get_linkroll_details some_slug %} {% get_linkroll_det...
[ "Takes", "an", "optional", "number", "and", "destination", "(", "by", "id", ")", "and", "returns", "a", "list", "of", "links", "for", "the", "given", "linkroll", ".", "Given", "a", "number", "return", "list", "limited", "to", "the", "given", "number", "....
train
https://github.com/tBaxter/tango-articles/blob/93818dcca1b62042a4fc19af63474691b0fe931c/build/lib/articles/templatetags/linkroll_tags.py#L32-L47
Huong-nt/flask-rak
flask_rak/models.py
audio.new
def new(self, sources): """Sends a Play Directive to begin playback and replace current and enqueued streams.""" self._response['shouldEndSession'] = True self._response['action']['audio']['interface'] = 'new' self._response['action']['audio']['sources'] = sources return self
python
def new(self, sources): """Sends a Play Directive to begin playback and replace current and enqueued streams.""" self._response['shouldEndSession'] = True self._response['action']['audio']['interface'] = 'new' self._response['action']['audio']['sources'] = sources return self
[ "def", "new", "(", "self", ",", "sources", ")", ":", "self", ".", "_response", "[", "'shouldEndSession'", "]", "=", "True", "self", ".", "_response", "[", "'action'", "]", "[", "'audio'", "]", "[", "'interface'", "]", "=", "'new'", "self", ".", "_respo...
Sends a Play Directive to begin playback and replace current and enqueued streams.
[ "Sends", "a", "Play", "Directive", "to", "begin", "playback", "and", "replace", "current", "and", "enqueued", "streams", "." ]
train
https://github.com/Huong-nt/flask-rak/blob/ffe16b0fc3d49e83c1d220c445ce14632219f69d/flask_rak/models.py#L156-L161
Huong-nt/flask-rak
flask_rak/models.py
audio.stop
def stop(self): """Send signal to stop the current stream playback""" self._response['shouldEndSession'] = True self._response['action']['audio']['interface'] = 'stop' self._response['action']['audio']['sources'] = [] return self
python
def stop(self): """Send signal to stop the current stream playback""" self._response['shouldEndSession'] = True self._response['action']['audio']['interface'] = 'stop' self._response['action']['audio']['sources'] = [] return self
[ "def", "stop", "(", "self", ")", ":", "self", ".", "_response", "[", "'shouldEndSession'", "]", "=", "True", "self", ".", "_response", "[", "'action'", "]", "[", "'audio'", "]", "[", "'interface'", "]", "=", "'stop'", "self", ".", "_response", "[", "'a...
Send signal to stop the current stream playback
[ "Send", "signal", "to", "stop", "the", "current", "stream", "playback" ]
train
https://github.com/Huong-nt/flask-rak/blob/ffe16b0fc3d49e83c1d220c445ce14632219f69d/flask_rak/models.py#L163-L168
Huong-nt/flask-rak
flask_rak/models.py
audio.play
def play(self): """Send signal to resume playback at the paused offset""" self._response['shouldEndSession'] = True self._response['action']['audio']['interface'] = 'play' self._response['action']['audio']['sources'] = [] return self
python
def play(self): """Send signal to resume playback at the paused offset""" self._response['shouldEndSession'] = True self._response['action']['audio']['interface'] = 'play' self._response['action']['audio']['sources'] = [] return self
[ "def", "play", "(", "self", ")", ":", "self", ".", "_response", "[", "'shouldEndSession'", "]", "=", "True", "self", ".", "_response", "[", "'action'", "]", "[", "'audio'", "]", "[", "'interface'", "]", "=", "'play'", "self", ".", "_response", "[", "'a...
Send signal to resume playback at the paused offset
[ "Send", "signal", "to", "resume", "playback", "at", "the", "paused", "offset" ]
train
https://github.com/Huong-nt/flask-rak/blob/ffe16b0fc3d49e83c1d220c445ce14632219f69d/flask_rak/models.py#L170-L175
Huong-nt/flask-rak
flask_rak/models.py
audio.pause
def pause(self): """Send signal to resume playback at the paused offset""" self._response['shouldEndSession'] = True self._response['action']['audio']['interface'] = 'pause' self._response['action']['audio']['sources'] = [] return self
python
def pause(self): """Send signal to resume playback at the paused offset""" self._response['shouldEndSession'] = True self._response['action']['audio']['interface'] = 'pause' self._response['action']['audio']['sources'] = [] return self
[ "def", "pause", "(", "self", ")", ":", "self", ".", "_response", "[", "'shouldEndSession'", "]", "=", "True", "self", ".", "_response", "[", "'action'", "]", "[", "'audio'", "]", "[", "'interface'", "]", "=", "'pause'", "self", ".", "_response", "[", "...
Send signal to resume playback at the paused offset
[ "Send", "signal", "to", "resume", "playback", "at", "the", "paused", "offset" ]
train
https://github.com/Huong-nt/flask-rak/blob/ffe16b0fc3d49e83c1d220c445ce14632219f69d/flask_rak/models.py#L177-L182
Huong-nt/flask-rak
flask_rak/models.py
audio.next
def next(self): """Send signal to resume playback at the paused offset""" self._response['shouldEndSession'] = True self._response['action']['audio']['interface'] = 'next' self._response['action']['audio']['sources'] = [] return self
python
def next(self): """Send signal to resume playback at the paused offset""" self._response['shouldEndSession'] = True self._response['action']['audio']['interface'] = 'next' self._response['action']['audio']['sources'] = [] return self
[ "def", "next", "(", "self", ")", ":", "self", ".", "_response", "[", "'shouldEndSession'", "]", "=", "True", "self", ".", "_response", "[", "'action'", "]", "[", "'audio'", "]", "[", "'interface'", "]", "=", "'next'", "self", ".", "_response", "[", "'a...
Send signal to resume playback at the paused offset
[ "Send", "signal", "to", "resume", "playback", "at", "the", "paused", "offset" ]
train
https://github.com/Huong-nt/flask-rak/blob/ffe16b0fc3d49e83c1d220c445ce14632219f69d/flask_rak/models.py#L184-L189
onespacemedia/cms-redirects
redirects/models.py
Redirect.sub_path
def sub_path(self, path): """ If this redirect is a regular expression, it will return a rewritten version of `path`; otherwise returns the `new_path`. """ if not self.regular_expression: return self.new_path return re.sub(self.old_path, self.new_path, path)
python
def sub_path(self, path): """ If this redirect is a regular expression, it will return a rewritten version of `path`; otherwise returns the `new_path`. """ if not self.regular_expression: return self.new_path return re.sub(self.old_path, self.new_path, path)
[ "def", "sub_path", "(", "self", ",", "path", ")", ":", "if", "not", "self", ".", "regular_expression", ":", "return", "self", ".", "new_path", "return", "re", ".", "sub", "(", "self", ".", "old_path", ",", "self", ".", "new_path", ",", "path", ")" ]
If this redirect is a regular expression, it will return a rewritten version of `path`; otherwise returns the `new_path`.
[ "If", "this", "redirect", "is", "a", "regular", "expression", "it", "will", "return", "a", "rewritten", "version", "of", "path", ";", "otherwise", "returns", "the", "new_path", "." ]
train
https://github.com/onespacemedia/cms-redirects/blob/9a412dbd4fdac016fbe0ac7bf6773868169cb148/redirects/models.py#L52-L57
Julian/Compares
compares.py
via
def via(fields): """ Define the fields (attributes) to use for instance comparison and repr. Creates ``__eq__``\ , ``__ne__`` and ``__repr__`` methods for the decorated class, along with a private ``_contents`` property which simply returns the fields provided with associated values on the inst...
python
def via(fields): """ Define the fields (attributes) to use for instance comparison and repr. Creates ``__eq__``\ , ``__ne__`` and ``__repr__`` methods for the decorated class, along with a private ``_contents`` property which simply returns the fields provided with associated values on the inst...
[ "def", "via", "(", "fields", ")", ":", "def", "add_methods", "(", "cls", ")", ":", "nothing", "=", "object", "(", ")", "if", "getattr", "(", "cls", ",", "\"fields\"", ",", "nothing", ")", "is", "nothing", ":", "cls", ".", "fields", "=", "tuple", "(...
Define the fields (attributes) to use for instance comparison and repr. Creates ``__eq__``\ , ``__ne__`` and ``__repr__`` methods for the decorated class, along with a private ``_contents`` property which simply returns the fields provided with associated values on the instance, and a ``fields`` attrib...
[ "Define", "the", "fields", "(", "attributes", ")", "to", "use", "for", "instance", "comparison", "and", "repr", "." ]
train
https://github.com/Julian/Compares/blob/4a848240b3bca69238fef832bdbe37059ee2ae6c/compares.py#L10-L63
konture/CloeePy
cloeepy/logger.py
Logger._set_formatter
def _set_formatter(self): """ Inspects config and sets the name of the formatter to either "json" or "text" as instance attr. If not present in config, default is "text" """ if hasattr(self._config, "formatter") and self._config.formatter == "json": self._formatter = ...
python
def _set_formatter(self): """ Inspects config and sets the name of the formatter to either "json" or "text" as instance attr. If not present in config, default is "text" """ if hasattr(self._config, "formatter") and self._config.formatter == "json": self._formatter = ...
[ "def", "_set_formatter", "(", "self", ")", ":", "if", "hasattr", "(", "self", ".", "_config", ",", "\"formatter\"", ")", "and", "self", ".", "_config", ".", "formatter", "==", "\"json\"", ":", "self", ".", "_formatter", "=", "\"json\"", "else", ":", "sel...
Inspects config and sets the name of the formatter to either "json" or "text" as instance attr. If not present in config, default is "text"
[ "Inspects", "config", "and", "sets", "the", "name", "of", "the", "formatter", "to", "either", "json", "or", "text", "as", "instance", "attr", ".", "If", "not", "present", "in", "config", "default", "is", "text" ]
train
https://github.com/konture/CloeePy/blob/dcb21284d2df405d92ac6868ea7215792c9323b9/cloeepy/logger.py#L49-L57
konture/CloeePy
cloeepy/logger.py
Logger._set_log_level
def _set_log_level(self): """ Inspects config and sets the log level as instance attr. If not present in config, default is "INFO". """ # set log level on logger log_level = "INFO" if hasattr(self._config, "level") and self._config.level.upper() in ["DEBUG", "INFO...
python
def _set_log_level(self): """ Inspects config and sets the log level as instance attr. If not present in config, default is "INFO". """ # set log level on logger log_level = "INFO" if hasattr(self._config, "level") and self._config.level.upper() in ["DEBUG", "INFO...
[ "def", "_set_log_level", "(", "self", ")", ":", "# set log level on logger", "log_level", "=", "\"INFO\"", "if", "hasattr", "(", "self", ".", "_config", ",", "\"level\"", ")", "and", "self", ".", "_config", ".", "level", ".", "upper", "(", ")", "in", "[", ...
Inspects config and sets the log level as instance attr. If not present in config, default is "INFO".
[ "Inspects", "config", "and", "sets", "the", "log", "level", "as", "instance", "attr", ".", "If", "not", "present", "in", "config", "default", "is", "INFO", "." ]
train
https://github.com/konture/CloeePy/blob/dcb21284d2df405d92ac6868ea7215792c9323b9/cloeepy/logger.py#L59-L68
konture/CloeePy
cloeepy/logger.py
Logger._set_framework_logger
def _set_framework_logger(self): """ Creates a logger with default formatting for internal use by the CloeePy framework and its plugins. User may configure customer fields on their logger, but the framework would not know how to incorporate those custom fields, and by design of t...
python
def _set_framework_logger(self): """ Creates a logger with default formatting for internal use by the CloeePy framework and its plugins. User may configure customer fields on their logger, but the framework would not know how to incorporate those custom fields, and by design of t...
[ "def", "_set_framework_logger", "(", "self", ")", ":", "formatter", "=", "None", "if", "self", ".", "_formatter", "==", "\"json\"", ":", "formatter", "=", "CustomJsonFormatter", "(", "self", ".", "default_json_fmt", ")", "else", ":", "formatter", "=", "logging...
Creates a logger with default formatting for internal use by the CloeePy framework and its plugins. User may configure customer fields on their logger, but the framework would not know how to incorporate those custom fields, and by design of the logging pkg authors, the program would error ...
[ "Creates", "a", "logger", "with", "default", "formatting", "for", "internal", "use", "by", "the", "CloeePy", "framework", "and", "its", "plugins", ".", "User", "may", "configure", "customer", "fields", "on", "their", "logger", "but", "the", "framework", "would...
train
https://github.com/konture/CloeePy/blob/dcb21284d2df405d92ac6868ea7215792c9323b9/cloeepy/logger.py#L70-L88
konture/CloeePy
cloeepy/logger.py
Logger._set_application_logger
def _set_application_logger(self): """ Creates a logger intended for use by applications using CloeePy. This logger is fully configurable by the user and can include custom fields """ formatter = None if self._formatter == "json": if hasattr(self._config, "for...
python
def _set_application_logger(self): """ Creates a logger intended for use by applications using CloeePy. This logger is fully configurable by the user and can include custom fields """ formatter = None if self._formatter == "json": if hasattr(self._config, "for...
[ "def", "_set_application_logger", "(", "self", ")", ":", "formatter", "=", "None", "if", "self", ".", "_formatter", "==", "\"json\"", ":", "if", "hasattr", "(", "self", ".", "_config", ",", "\"formatString\"", ")", ":", "formatter", "=", "CustomJsonFormatter",...
Creates a logger intended for use by applications using CloeePy. This logger is fully configurable by the user and can include custom fields
[ "Creates", "a", "logger", "intended", "for", "use", "by", "applications", "using", "CloeePy", ".", "This", "logger", "is", "fully", "configurable", "by", "the", "user", "and", "can", "include", "custom", "fields" ]
train
https://github.com/konture/CloeePy/blob/dcb21284d2df405d92ac6868ea7215792c9323b9/cloeepy/logger.py#L90-L112
PonteIneptique/collatinus-python
pycollatinus/parser.py
Parser.ajIrreguliers
def ajIrreguliers(self): """ Chargement des formes irrégulières du fichier data/irregs.la """ lignes = lignesFichier(self.path("irregs.la")) for lin in lignes: try: irr = self.parse_irreg(lin) self.lemmatiseur._irregs[deramise(irr.gr())].append...
python
def ajIrreguliers(self): """ Chargement des formes irrégulières du fichier data/irregs.la """ lignes = lignesFichier(self.path("irregs.la")) for lin in lignes: try: irr = self.parse_irreg(lin) self.lemmatiseur._irregs[deramise(irr.gr())].append...
[ "def", "ajIrreguliers", "(", "self", ")", ":", "lignes", "=", "lignesFichier", "(", "self", ".", "path", "(", "\"irregs.la\"", ")", ")", "for", "lin", "in", "lignes", ":", "try", ":", "irr", "=", "self", ".", "parse_irreg", "(", "lin", ")", "self", "...
Chargement des formes irrégulières du fichier data/irregs.la
[ "Chargement", "des", "formes", "irrégulières", "du", "fichier", "data", "/", "irregs", ".", "la" ]
train
https://github.com/PonteIneptique/collatinus-python/blob/fca37b0b77bc60f47d3c24ab42f6d0bdca6ba0f5/pycollatinus/parser.py#L74-L87
PonteIneptique/collatinus-python
pycollatinus/parser.py
Parser.ajAssims
def ajAssims(self): """ Charge et définit les débuts de mots non-assimilés, associe à chacun sa forme assimilée. """ for lin in lignesFichier(self.path("assimilations.la")): ass1, ass2 = tuple(lin.split(':')) self.lemmatiseur._assims[ass1] = ass2 self.lemmatis...
python
def ajAssims(self): """ Charge et définit les débuts de mots non-assimilés, associe à chacun sa forme assimilée. """ for lin in lignesFichier(self.path("assimilations.la")): ass1, ass2 = tuple(lin.split(':')) self.lemmatiseur._assims[ass1] = ass2 self.lemmatis...
[ "def", "ajAssims", "(", "self", ")", ":", "for", "lin", "in", "lignesFichier", "(", "self", ".", "path", "(", "\"assimilations.la\"", ")", ")", ":", "ass1", ",", "ass2", "=", "tuple", "(", "lin", ".", "split", "(", "':'", ")", ")", "self", ".", "le...
Charge et définit les débuts de mots non-assimilés, associe à chacun sa forme assimilée.
[ "Charge", "et", "définit", "les", "débuts", "de", "mots", "non", "-", "assimilés", "associe", "à", "chacun", "sa", "forme", "assimilée", "." ]
train
https://github.com/PonteIneptique/collatinus-python/blob/fca37b0b77bc60f47d3c24ab42f6d0bdca6ba0f5/pycollatinus/parser.py#L89-L95
PonteIneptique/collatinus-python
pycollatinus/parser.py
Parser.ajContractions
def ajContractions(self): """ Charge et établit une liste qui donne, chaque contraction, forme non contracte qui lui correspond. """ for lin in lignesFichier(self.path("contractions.la")): ass1, ass2 = tuple(lin.split(':')) self.lemmatiseur._contractions[ass1] = ass2
python
def ajContractions(self): """ Charge et établit une liste qui donne, chaque contraction, forme non contracte qui lui correspond. """ for lin in lignesFichier(self.path("contractions.la")): ass1, ass2 = tuple(lin.split(':')) self.lemmatiseur._contractions[ass1] = ass2
[ "def", "ajContractions", "(", "self", ")", ":", "for", "lin", "in", "lignesFichier", "(", "self", ".", "path", "(", "\"contractions.la\"", ")", ")", ":", "ass1", ",", "ass2", "=", "tuple", "(", "lin", ".", "split", "(", "':'", ")", ")", "self", ".", ...
Charge et établit une liste qui donne, chaque contraction, forme non contracte qui lui correspond.
[ "Charge", "et", "établit", "une", "liste", "qui", "donne", "chaque", "contraction", "forme", "non", "contracte", "qui", "lui", "correspond", "." ]
train
https://github.com/PonteIneptique/collatinus-python/blob/fca37b0b77bc60f47d3c24ab42f6d0bdca6ba0f5/pycollatinus/parser.py#L97-L102
PonteIneptique/collatinus-python
pycollatinus/parser.py
Parser.lisFichierLexique
def lisFichierLexique(self, filepath): """ Lecture des lemmes, et enregistrement de leurs radicaux :param filepath: Chemin du fichier à charger :type filepath: str """ orig = int(filepath.endswith("ext.la")) lignes = lignesFichier(filepath) for ligne in lignes: ...
python
def lisFichierLexique(self, filepath): """ Lecture des lemmes, et enregistrement de leurs radicaux :param filepath: Chemin du fichier à charger :type filepath: str """ orig = int(filepath.endswith("ext.la")) lignes = lignesFichier(filepath) for ligne in lignes: ...
[ "def", "lisFichierLexique", "(", "self", ",", "filepath", ")", ":", "orig", "=", "int", "(", "filepath", ".", "endswith", "(", "\"ext.la\"", ")", ")", "lignes", "=", "lignesFichier", "(", "filepath", ")", "for", "ligne", "in", "lignes", ":", "self", ".",...
Lecture des lemmes, et enregistrement de leurs radicaux :param filepath: Chemin du fichier à charger :type filepath: str
[ "Lecture", "des", "lemmes", "et", "enregistrement", "de", "leurs", "radicaux" ]
train
https://github.com/PonteIneptique/collatinus-python/blob/fca37b0b77bc60f47d3c24ab42f6d0bdca6ba0f5/pycollatinus/parser.py#L104-L113
PonteIneptique/collatinus-python
pycollatinus/parser.py
Parser.parse_lemme
def parse_lemme(self, linea: str, origin: int=0, _deramise: bool=True): """ Constructeur de la classe Lemme à partir de la ligne linea. Exemple de linea avec numéro d'éclat: # cădo|lego|cĕcĭd|cās|is, ere, cecidi, casum|687 # 0 | 1 | 2 | 3 | 4 | 5 ...
python
def parse_lemme(self, linea: str, origin: int=0, _deramise: bool=True): """ Constructeur de la classe Lemme à partir de la ligne linea. Exemple de linea avec numéro d'éclat: # cădo|lego|cĕcĭd|cās|is, ere, cecidi, casum|687 # 0 | 1 | 2 | 3 | 4 | 5 ...
[ "def", "parse_lemme", "(", "self", ",", "linea", ":", "str", ",", "origin", ":", "int", "=", "0", ",", "_deramise", ":", "bool", "=", "True", ")", ":", "eclats", "=", "linea", ".", "split", "(", "'|'", ")", "lg", "=", "eclats", "[", "0", "]", "...
Constructeur de la classe Lemme à partir de la ligne linea. Exemple de linea avec numéro d'éclat: # cădo|lego|cĕcĭd|cās|is, ere, cecidi, casum|687 # 0 | 1 | 2 | 3 | 4 | 5 :param linea: Ligne à parser :type linea: str :param origin: 0 for ...
[ "Constructeur", "de", "la", "classe", "Lemme", "à", "partir", "de", "la", "ligne", "linea", "." ]
train
https://github.com/PonteIneptique/collatinus-python/blob/fca37b0b77bc60f47d3c24ab42f6d0bdca6ba0f5/pycollatinus/parser.py#L115-L224
PonteIneptique/collatinus-python
pycollatinus/parser.py
Parser.register_modele
def register_modele(self, modele: Modele): """ Register a modele onto the lemmatizer :param modele: Modele to register """ self.lemmatiseur._modeles[modele.gr()] = modele
python
def register_modele(self, modele: Modele): """ Register a modele onto the lemmatizer :param modele: Modele to register """ self.lemmatiseur._modeles[modele.gr()] = modele
[ "def", "register_modele", "(", "self", ",", "modele", ":", "Modele", ")", ":", "self", ".", "lemmatiseur", ".", "_modeles", "[", "modele", ".", "gr", "(", ")", "]", "=", "modele" ]
Register a modele onto the lemmatizer :param modele: Modele to register
[ "Register", "a", "modele", "onto", "the", "lemmatizer" ]
train
https://github.com/PonteIneptique/collatinus-python/blob/fca37b0b77bc60f47d3c24ab42f6d0bdca6ba0f5/pycollatinus/parser.py#L226-L231
PonteIneptique/collatinus-python
pycollatinus/parser.py
Parser.parse_modele
def parse_modele(self, list_of_lines: list): """ Chaque item de la liste list_of_lines est constitué de champs séparé par le caractère ':'. Le premier champ est un mot clé. Le parent est le lemmatiseur. Pour le format du fichier data/modeles.la, la documentation utilisateur. :param list_of_line...
python
def parse_modele(self, list_of_lines: list): """ Chaque item de la liste list_of_lines est constitué de champs séparé par le caractère ':'. Le premier champ est un mot clé. Le parent est le lemmatiseur. Pour le format du fichier data/modeles.la, la documentation utilisateur. :param list_of_line...
[ "def", "parse_modele", "(", "self", ",", "list_of_lines", ":", "list", ")", ":", "grq", "=", "list_of_lines", "[", "0", "]", ".", "split", "(", "\":\"", ")", "[", "1", "]", "gr", "=", "atone", "(", "grq", ")", "modele", "=", "Modele", "(", "graphie...
Chaque item de la liste list_of_lines est constitué de champs séparé par le caractère ':'. Le premier champ est un mot clé. Le parent est le lemmatiseur. Pour le format du fichier data/modeles.la, la documentation utilisateur. :param list_of_lines: Liste de champs séparés par le caractère ":". Le premi...
[ "Chaque", "item", "de", "la", "liste", "list_of_lines", "est", "constitué", "de", "champs", "séparé", "par", "le", "caractère", ":", ".", "Le", "premier", "champ", "est", "un", "mot", "clé", ".", "Le", "parent", "est", "le", "lemmatiseur", ".", "Pour", "...
train
https://github.com/PonteIneptique/collatinus-python/blob/fca37b0b77bc60f47d3c24ab42f6d0bdca6ba0f5/pycollatinus/parser.py#L233-L360
PonteIneptique/collatinus-python
pycollatinus/parser.py
Parser._register_lemme
def _register_lemme(self, lemma): """ Register a lemma into the Lemmatiseur :param lemma: Lemma to register :return: """ if lemma.cle() not in self.lemmatiseur._lemmes: self.ajRadicaux(lemma) self.lemmatiseur._lemmes[lemma.cle()] = lemma
python
def _register_lemme(self, lemma): """ Register a lemma into the Lemmatiseur :param lemma: Lemma to register :return: """ if lemma.cle() not in self.lemmatiseur._lemmes: self.ajRadicaux(lemma) self.lemmatiseur._lemmes[lemma.cle()] = lemma
[ "def", "_register_lemme", "(", "self", ",", "lemma", ")", ":", "if", "lemma", ".", "cle", "(", ")", "not", "in", "self", ".", "lemmatiseur", ".", "_lemmes", ":", "self", ".", "ajRadicaux", "(", "lemma", ")", "self", ".", "lemmatiseur", ".", "_lemmes", ...
Register a lemma into the Lemmatiseur :param lemma: Lemma to register :return:
[ "Register", "a", "lemma", "into", "the", "Lemmatiseur" ]
train
https://github.com/PonteIneptique/collatinus-python/blob/fca37b0b77bc60f47d3c24ab42f6d0bdca6ba0f5/pycollatinus/parser.py#L362-L370
PonteIneptique/collatinus-python
pycollatinus/parser.py
Parser.ajModeles
def ajModeles(self): """ Lecture des modèles, et enregistrement de leurs désinences """ sl = [] lines = [line for line in lignesFichier(self.path("modeles.la"))] max = len(lines) - 1 for i, l in enumerate(lines): if l.startswith('$'): varname, ...
python
def ajModeles(self): """ Lecture des modèles, et enregistrement de leurs désinences """ sl = [] lines = [line for line in lignesFichier(self.path("modeles.la"))] max = len(lines) - 1 for i, l in enumerate(lines): if l.startswith('$'): varname, ...
[ "def", "ajModeles", "(", "self", ")", ":", "sl", "=", "[", "]", "lines", "=", "[", "line", "for", "line", "in", "lignesFichier", "(", "self", ".", "path", "(", "\"modeles.la\"", ")", ")", "]", "max", "=", "len", "(", "lines", ")", "-", "1", "for"...
Lecture des modèles, et enregistrement de leurs désinences
[ "Lecture", "des", "modèles", "et", "enregistrement", "de", "leurs", "désinences" ]
train
https://github.com/PonteIneptique/collatinus-python/blob/fca37b0b77bc60f47d3c24ab42f6d0bdca6ba0f5/pycollatinus/parser.py#L380-L397
PonteIneptique/collatinus-python
pycollatinus/parser.py
Parser.ajRadicaux
def ajRadicaux(self, lemme): """ Calcule tous les radicaux du lemme l, * en se servant des modèles, ajoute à ce lemme, * et ensuite à la map * des radicaux de la classe Lemmat. Ligne type de lemme # ablŭo=ā̆blŭo|lego|ā̆blŭ|ā̆blūt|is, ere, lui, lutum # 0 ...
python
def ajRadicaux(self, lemme): """ Calcule tous les radicaux du lemme l, * en se servant des modèles, ajoute à ce lemme, * et ensuite à la map * des radicaux de la classe Lemmat. Ligne type de lemme # ablŭo=ā̆blŭo|lego|ā̆blŭ|ā̆blūt|is, ere, lui, lutum # 0 ...
[ "def", "ajRadicaux", "(", "self", ",", "lemme", ")", ":", "m", "=", "self", ".", "lemmatiseur", ".", "modele", "(", "lemme", ".", "grModele", "(", ")", ")", "''' insérer d'abord les radicaux définis dans lemmes.la\n qui sont prioritaires '''", "for", "i", "in...
Calcule tous les radicaux du lemme l, * en se servant des modèles, ajoute à ce lemme, * et ensuite à la map * des radicaux de la classe Lemmat. Ligne type de lemme # ablŭo=ā̆blŭo|lego|ā̆blŭ|ā̆blūt|is, ere, lui, lutum # 0 1 2 3 4 :par...
[ "Calcule", "tous", "les", "radicaux", "du", "lemme", "l", "*", "en", "se", "servant", "des", "modèles", "ajoute", "à", "ce", "lemme", "*", "et", "ensuite", "à", "la", "map", "*", "des", "radicaux", "de", "la", "classe", "Lemmat", "." ]
train
https://github.com/PonteIneptique/collatinus-python/blob/fca37b0b77bc60f47d3c24ab42f6d0bdca6ba0f5/pycollatinus/parser.py#L399-L450
PonteIneptique/collatinus-python
pycollatinus/parser.py
Parser.ajDesinence
def ajDesinence(self, d): """ Ajoute la désinence d dans la map des désinences. """ self.lemmatiseur._desinences[deramise(d.gr())].append(d)
python
def ajDesinence(self, d): """ Ajoute la désinence d dans la map des désinences. """ self.lemmatiseur._desinences[deramise(d.gr())].append(d)
[ "def", "ajDesinence", "(", "self", ",", "d", ")", ":", "self", ".", "lemmatiseur", ".", "_desinences", "[", "deramise", "(", "d", ".", "gr", "(", ")", ")", "]", ".", "append", "(", "d", ")" ]
Ajoute la désinence d dans la map des désinences.
[ "Ajoute", "la", "désinence", "d", "dans", "la", "map", "des", "désinences", "." ]
train
https://github.com/PonteIneptique/collatinus-python/blob/fca37b0b77bc60f47d3c24ab42f6d0bdca6ba0f5/pycollatinus/parser.py#L452-L454
PonteIneptique/collatinus-python
pycollatinus/parser.py
Parser.parse_irreg
def parse_irreg(self, l): """ Constructeur de la classe Irreg. :param l: Ligne de chargement des irréguliers :type l: str """ ecl = l.split(':') grq = ecl[0] exclusif = False if grq.endswith("*"): grq = grq[:-1] exclusif = True ...
python
def parse_irreg(self, l): """ Constructeur de la classe Irreg. :param l: Ligne de chargement des irréguliers :type l: str """ ecl = l.split(':') grq = ecl[0] exclusif = False if grq.endswith("*"): grq = grq[:-1] exclusif = True ...
[ "def", "parse_irreg", "(", "self", ",", "l", ")", ":", "ecl", "=", "l", ".", "split", "(", "':'", ")", "grq", "=", "ecl", "[", "0", "]", "exclusif", "=", "False", "if", "grq", ".", "endswith", "(", "\"*\"", ")", ":", "grq", "=", "grq", "[", "...
Constructeur de la classe Irreg. :param l: Ligne de chargement des irréguliers :type l: str
[ "Constructeur", "de", "la", "classe", "Irreg", "." ]
train
https://github.com/PonteIneptique/collatinus-python/blob/fca37b0b77bc60f47d3c24ab42f6d0bdca6ba0f5/pycollatinus/parser.py#L456-L474
PonteIneptique/collatinus-python
pycollatinus/ch.py
listeI
def listeI(l): """ Fonction importante permettant de renvoyer une liste d'entiers à partir d'une chaîne. La chaîne est une liste de sections séparées par des virgules. Une section peut être soit un entier, soit un intervalle d'entiers. On donne alors les l...
python
def listeI(l): """ Fonction importante permettant de renvoyer une liste d'entiers à partir d'une chaîne. La chaîne est une liste de sections séparées par des virgules. Une section peut être soit un entier, soit un intervalle d'entiers. On donne alors les l...
[ "def", "listeI", "(", "l", ")", ":", "result", "=", "[", "]", "lvirg", "=", "l", ".", "split", "(", "','", ")", "for", "virg", "in", "lvirg", ":", "if", "\"-\"", "in", "virg", ":", "deb", ",", "fin", "=", "tuple", "(", "virg", ".", "split", "...
Fonction importante permettant de renvoyer une liste d'entiers à partir d'une chaîne. La chaîne est une liste de sections séparées par des virgules. Une section peut être soit un entier, soit un intervalle d'entiers. On donne alors les limites inférieure et su...
[ "Fonction", "importante", "permettant", "de", "renvoyer", "une", "liste", "d", "entiers", "à", "partir", "d", "une", "chaîne", ".", "La", "chaîne", "est", "une", "liste", "de", "sections", "séparées", "par", "des", "virgules", ".", "Une", "section", "peut", ...
train
https://github.com/PonteIneptique/collatinus-python/blob/fca37b0b77bc60f47d3c24ab42f6d0bdca6ba0f5/pycollatinus/ch.py#L20-L45
PonteIneptique/collatinus-python
pycollatinus/ch.py
atone
def atone(string, caps=True): """ Supprimer les diacritiques de la forme donnée :param string: Chaîne à transformer :type string: str :param caps: Transforme les majuscules :type caps: bool :return: Chaîne nettoyée :rtype: str """ # Fix for unidecode until unidecode stop replace sho...
python
def atone(string, caps=True): """ Supprimer les diacritiques de la forme donnée :param string: Chaîne à transformer :type string: str :param caps: Transforme les majuscules :type caps: bool :return: Chaîne nettoyée :rtype: str """ # Fix for unidecode until unidecode stop replace sho...
[ "def", "atone", "(", "string", ",", "caps", "=", "True", ")", ":", "# Fix for unidecode until unidecode stop replace short y by u", "string", "=", "_Y_SHORT_REPLACE", ".", "sub", "(", "\"y\"", ",", "string", ")", "if", "caps", "is", "True", ":", "return", "unide...
Supprimer les diacritiques de la forme donnée :param string: Chaîne à transformer :type string: str :param caps: Transforme les majuscules :type caps: bool :return: Chaîne nettoyée :rtype: str
[ "Supprimer", "les", "diacritiques", "de", "la", "forme", "donnée" ]
train
https://github.com/PonteIneptique/collatinus-python/blob/fca37b0b77bc60f47d3c24ab42f6d0bdca6ba0f5/pycollatinus/ch.py#L63-L83
PonteIneptique/collatinus-python
pycollatinus/ch.py
communes
def communes(g): """ Note comme communes toutes les voyelles qui ne portent pas de quantité. :param string: Chaîne à transformer :type string: str :return: Chaîne nettoyée :rtype: str """ if len(g) == 0: return g maj = g[0].isupper() g = g.lower() if _VOY_COMMUNES.match...
python
def communes(g): """ Note comme communes toutes les voyelles qui ne portent pas de quantité. :param string: Chaîne à transformer :type string: str :return: Chaîne nettoyée :rtype: str """ if len(g) == 0: return g maj = g[0].isupper() g = g.lower() if _VOY_COMMUNES.match...
[ "def", "communes", "(", "g", ")", ":", "if", "len", "(", "g", ")", "==", "0", ":", "return", "g", "maj", "=", "g", "[", "0", "]", ".", "isupper", "(", ")", "g", "=", "g", ".", "lower", "(", ")", "if", "_VOY_COMMUNES", ".", "match", "(", "g"...
Note comme communes toutes les voyelles qui ne portent pas de quantité. :param string: Chaîne à transformer :type string: str :return: Chaîne nettoyée :rtype: str
[ "Note", "comme", "communes", "toutes", "les", "voyelles", "qui", "ne", "portent", "pas", "de", "quantité", "." ]
train
https://github.com/PonteIneptique/collatinus-python/blob/fca37b0b77bc60f47d3c24ab42f6d0bdca6ba0f5/pycollatinus/ch.py#L99-L122
PonteIneptique/collatinus-python
pycollatinus/ch.py
deramise
def deramise(r): """ Déramise une chaîne :param string: Chaîne à transformer :type string: str :return: Chaîne nettoyée :rtype: str """ return r.replace('J', 'I') \ .replace('j', 'i') \ .replace('v', 'u') \ .replace("æ", "ae") \ .replace("...
python
def deramise(r): """ Déramise une chaîne :param string: Chaîne à transformer :type string: str :return: Chaîne nettoyée :rtype: str """ return r.replace('J', 'I') \ .replace('j', 'i') \ .replace('v', 'u') \ .replace("æ", "ae") \ .replace("...
[ "def", "deramise", "(", "r", ")", ":", "return", "r", ".", "replace", "(", "'J'", ",", "'I'", ")", ".", "replace", "(", "'j'", ",", "'i'", ")", ".", "replace", "(", "'v'", ",", "'u'", ")", ".", "replace", "(", "\"æ\",", " ", "ae\")", " ", ".", ...
Déramise une chaîne :param string: Chaîne à transformer :type string: str :return: Chaîne nettoyée :rtype: str
[ "Déramise", "une", "chaîne", ":", "param", "string", ":", "Chaîne", "à", "transformer", ":", "type", "string", ":", "str", ":", "return", ":", "Chaîne", "nettoyée", ":", "rtype", ":", "str" ]
train
https://github.com/PonteIneptique/collatinus-python/blob/fca37b0b77bc60f47d3c24ab42f6d0bdca6ba0f5/pycollatinus/ch.py#L139-L155
PonteIneptique/collatinus-python
pycollatinus/ch.py
allonge
def allonge(f): """ Modifie f pour que sa dernière voyelle devienne longue. :param string: Chaîne à transformer :type string: str :return: Chaîne modifiée :rtype: str """ if not f: return "" return f ## TODO : Implementer correctement la suite taille = len(f) ...
python
def allonge(f): """ Modifie f pour que sa dernière voyelle devienne longue. :param string: Chaîne à transformer :type string: str :return: Chaîne modifiée :rtype: str """ if not f: return "" return f ## TODO : Implementer correctement la suite taille = len(f) ...
[ "def", "allonge", "(", "f", ")", ":", "if", "not", "f", ":", "return", "\"\"", "return", "f", "## TODO : Implementer correctement la suite", "taille", "=", "len", "(", "f", ")", "# Je sais que le morceau à attacher commence par une consonne.", "if", "f", "[", "taill...
Modifie f pour que sa dernière voyelle devienne longue. :param string: Chaîne à transformer :type string: str :return: Chaîne modifiée :rtype: str
[ "Modifie", "f", "pour", "que", "sa", "dernière", "voyelle", "devienne", "longue", ".", ":", "param", "string", ":", "Chaîne", "à", "transformer", ":", "type", "string", ":", "str", ":", "return", ":", "Chaîne", "modifiée", ":", "rtype", ":", "str" ]
train
https://github.com/PonteIneptique/collatinus-python/blob/fca37b0b77bc60f47d3c24ab42f6d0bdca6ba0f5/pycollatinus/ch.py#L158-L188
minus7/asif
asif/commands.py
CommandSet.command
def command(self, name: str=None, hint: str=None, aliases: Sequence[str]=list()): """ Register a command handler that will be invoked when a command is detected. If your handler has a docstring, it will be shown for .help [command]. The function will be invoked with *args set to the ...
python
def command(self, name: str=None, hint: str=None, aliases: Sequence[str]=list()): """ Register a command handler that will be invoked when a command is detected. If your handler has a docstring, it will be shown for .help [command]. The function will be invoked with *args set to the ...
[ "def", "command", "(", "self", ",", "name", ":", "str", "=", "None", ",", "hint", ":", "str", "=", "None", ",", "aliases", ":", "Sequence", "[", "str", "]", "=", "list", "(", ")", ")", ":", "def", "decorator", "(", "fn", ")", ":", "_name", "=",...
Register a command handler that will be invoked when a command is detected. If your handler has a docstring, it will be shown for .help [command]. The function will be invoked with *args set to the list of parameters given (as parsed by shlex.split). You may also include any of these key...
[ "Register", "a", "command", "handler", "that", "will", "be", "invoked", "when", "a", "command", "is", "detected", ".", "If", "your", "handler", "has", "a", "docstring", "it", "will", "be", "shown", "for", ".", "help", "[", "command", "]", ".", "The", "...
train
https://github.com/minus7/asif/blob/0d8acc5306ba93386ec679f69d466b56f099b877/asif/commands.py#L102-L128
mayfield/shellish
shellish/eventing.py
Eventer.add_listener
def add_listener(self, event, callback, single=False, priority=1): """ Add a callback to an event list so it will be run at this event's firing. If single is True, the event is auto-removed after the first invocation. Priority can be used to jump ahead or behind other callback invocation...
python
def add_listener(self, event, callback, single=False, priority=1): """ Add a callback to an event list so it will be run at this event's firing. If single is True, the event is auto-removed after the first invocation. Priority can be used to jump ahead or behind other callback invocation...
[ "def", "add_listener", "(", "self", ",", "event", ",", "callback", ",", "single", "=", "False", ",", "priority", "=", "1", ")", ":", "event_stack", "=", "self", ".", "_events", "[", "event", "]", "event_stack", ".", "append", "(", "{", "\"callback\"", ...
Add a callback to an event list so it will be run at this event's firing. If single is True, the event is auto-removed after the first invocation. Priority can be used to jump ahead or behind other callback invocations.
[ "Add", "a", "callback", "to", "an", "event", "list", "so", "it", "will", "be", "run", "at", "this", "event", "s", "firing", ".", "If", "single", "is", "True", "the", "event", "is", "auto", "-", "removed", "after", "the", "first", "invocation", ".", "...
train
https://github.com/mayfield/shellish/blob/df0f0e4612d138c34d8cb99b66ab5b8e47f1414a/shellish/eventing.py#L20-L31
mayfield/shellish
shellish/eventing.py
Eventer.remove_listener
def remove_listener(self, event, callback, single=None, priority=None): """ Remove the event listener matching the same signature used for adding it. This will remove AT MOST one entry meeting the signature requirements. """ event_stack = self._events[event] for x in event_stack...
python
def remove_listener(self, event, callback, single=None, priority=None): """ Remove the event listener matching the same signature used for adding it. This will remove AT MOST one entry meeting the signature requirements. """ event_stack = self._events[event] for x in event_stack...
[ "def", "remove_listener", "(", "self", ",", "event", ",", "callback", ",", "single", "=", "None", ",", "priority", "=", "None", ")", ":", "event_stack", "=", "self", ".", "_events", "[", "event", "]", "for", "x", "in", "event_stack", ":", "if", "x", ...
Remove the event listener matching the same signature used for adding it. This will remove AT MOST one entry meeting the signature requirements.
[ "Remove", "the", "event", "listener", "matching", "the", "same", "signature", "used", "for", "adding", "it", ".", "This", "will", "remove", "AT", "MOST", "one", "entry", "meeting", "the", "signature", "requirements", "." ]
train
https://github.com/mayfield/shellish/blob/df0f0e4612d138c34d8cb99b66ab5b8e47f1414a/shellish/eventing.py#L33-L46
mayfield/shellish
shellish/eventing.py
Eventer.fire_event
def fire_event(self, event, *args, **kwargs): """ Execute the listeners for this event passing any arguments along. """ remove = [] event_stack = self._events[event] for x in event_stack: x['callback'](*args, **kwargs) if x['single']: remov...
python
def fire_event(self, event, *args, **kwargs): """ Execute the listeners for this event passing any arguments along. """ remove = [] event_stack = self._events[event] for x in event_stack: x['callback'](*args, **kwargs) if x['single']: remov...
[ "def", "fire_event", "(", "self", ",", "event", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "remove", "=", "[", "]", "event_stack", "=", "self", ".", "_events", "[", "event", "]", "for", "x", "in", "event_stack", ":", "x", "[", "'callback'...
Execute the listeners for this event passing any arguments along.
[ "Execute", "the", "listeners", "for", "this", "event", "passing", "any", "arguments", "along", "." ]
train
https://github.com/mayfield/shellish/blob/df0f0e4612d138c34d8cb99b66ab5b8e47f1414a/shellish/eventing.py#L48-L58
MacHu-GWU/angora-project
angora/gadget/pytimer.py
Timer.stop
def stop(self): """Save last elapse time to self.records. """ self.elapse = time.clock() - self.st self.records.append(self.elapse)
python
def stop(self): """Save last elapse time to self.records. """ self.elapse = time.clock() - self.st self.records.append(self.elapse)
[ "def", "stop", "(", "self", ")", ":", "self", ".", "elapse", "=", "time", ".", "clock", "(", ")", "-", "self", ".", "st", "self", ".", "records", ".", "append", "(", "self", ".", "elapse", ")" ]
Save last elapse time to self.records.
[ "Save", "last", "elapse", "time", "to", "self", ".", "records", "." ]
train
https://github.com/MacHu-GWU/angora-project/blob/689a60da51cd88680ddbe26e28dbe81e6b01d275/angora/gadget/pytimer.py#L46-L50
MacHu-GWU/angora-project
angora/gadget/pytimer.py
Timer.display_all
def display_all(self): """Print detailed information. """ print( ("total elapse %0.6f seconds, last elapse %0.6f seconds, " "took %s times measurement") % ( self.total_elapse, self.elapse, len(self.records)))
python
def display_all(self): """Print detailed information. """ print( ("total elapse %0.6f seconds, last elapse %0.6f seconds, " "took %s times measurement") % ( self.total_elapse, self.elapse, len(self.records)))
[ "def", "display_all", "(", "self", ")", ":", "print", "(", "(", "\"total elapse %0.6f seconds, last elapse %0.6f seconds, \"", "\"took %s times measurement\"", ")", "%", "(", "self", ".", "total_elapse", ",", "self", ".", "elapse", ",", "len", "(", "self", ".", "r...
Print detailed information.
[ "Print", "detailed", "information", "." ]
train
https://github.com/MacHu-GWU/angora-project/blob/689a60da51cd88680ddbe26e28dbe81e6b01d275/angora/gadget/pytimer.py#L69-L74
Vito2015/pyextend
pyextend/core/wrappers/singleton.py
singleton
def singleton(cls, *args, **kwargs): """类单例装饰器""" instance = {} def _singleton(): if cls not in instance: instance[cls] = cls(*args, **kwargs) return instance[cls] return _singleton
python
def singleton(cls, *args, **kwargs): """类单例装饰器""" instance = {} def _singleton(): if cls not in instance: instance[cls] = cls(*args, **kwargs) return instance[cls] return _singleton
[ "def", "singleton", "(", "cls", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "instance", "=", "{", "}", "def", "_singleton", "(", ")", ":", "if", "cls", "not", "in", "instance", ":", "instance", "[", "cls", "]", "=", "cls", "(", "*", "a...
类单例装饰器
[ "类单例装饰器" ]
train
https://github.com/Vito2015/pyextend/blob/36861dfe1087e437ffe9b5a1da9345c85b4fa4a1/pyextend/core/wrappers/singleton.py#L12-L20
silenc3r/dikicli
dikicli/core.py
_parse_html
def _parse_html(html_dump, native=False): """Parse html string. Parameters ---------- html_dump : str HTML content. native : bool, optional Whether to translate from native to foreign language. Returns ------- translations : list Translations list. Raises ...
python
def _parse_html(html_dump, native=False): """Parse html string. Parameters ---------- html_dump : str HTML content. native : bool, optional Whether to translate from native to foreign language. Returns ------- translations : list Translations list. Raises ...
[ "def", "_parse_html", "(", "html_dump", ",", "native", "=", "False", ")", ":", "# pylint: disable=too-many-locals", "soup", "=", "BeautifulSoup", "(", "html_dump", ",", "\"html.parser\"", ")", "translations", "=", "[", "]", "for", "entity", "in", "soup", ".", ...
Parse html string. Parameters ---------- html_dump : str HTML content. native : bool, optional Whether to translate from native to foreign language. Returns ------- translations : list Translations list. Raises ------ WordNotFound If word can't ...
[ "Parse", "html", "string", "." ]
train
https://github.com/silenc3r/dikicli/blob/53721cdf75db04e2edca5ed3f99beae7c079d980/dikicli/core.py#L133-L202
silenc3r/dikicli
dikicli/core.py
_parse_cached
def _parse_cached(html_dump): """Parse html string from cached html files. Parameters ---------- html_dump : string HTML content Returns ------- translations : list Translations list. """ soup = BeautifulSoup(html_dump, "html.parser") translations = [] for t...
python
def _parse_cached(html_dump): """Parse html string from cached html files. Parameters ---------- html_dump : string HTML content Returns ------- translations : list Translations list. """ soup = BeautifulSoup(html_dump, "html.parser") translations = [] for t...
[ "def", "_parse_cached", "(", "html_dump", ")", ":", "soup", "=", "BeautifulSoup", "(", "html_dump", ",", "\"html.parser\"", ")", "translations", "=", "[", "]", "for", "trans", "in", "soup", ".", "find_all", "(", "\"div\"", ",", "class_", "=", "\"translation\...
Parse html string from cached html files. Parameters ---------- html_dump : string HTML content Returns ------- translations : list Translations list.
[ "Parse", "html", "string", "from", "cached", "html", "files", "." ]
train
https://github.com/silenc3r/dikicli/blob/53721cdf75db04e2edca5ed3f99beae7c079d980/dikicli/core.py#L205-L236
silenc3r/dikicli
dikicli/core.py
_cache_lookup
def _cache_lookup(word, data_dir, native=False): """Checks if word is in cache. Parameters ---------- word : str Word to check in cache. data_dir : pathlib.Path Cache directory location. Returns ------- translation : str or None Translation of given word. ""...
python
def _cache_lookup(word, data_dir, native=False): """Checks if word is in cache. Parameters ---------- word : str Word to check in cache. data_dir : pathlib.Path Cache directory location. Returns ------- translation : str or None Translation of given word. ""...
[ "def", "_cache_lookup", "(", "word", ",", "data_dir", ",", "native", "=", "False", ")", ":", "trans_dir", "=", "\"translations\"", "if", "native", ":", "trans_dir", "+=", "\"_native\"", "logger", ".", "debug", "(", "\"Cache lookup: %s\"", ",", "word", ")", "...
Checks if word is in cache. Parameters ---------- word : str Word to check in cache. data_dir : pathlib.Path Cache directory location. Returns ------- translation : str or None Translation of given word.
[ "Checks", "if", "word", "is", "in", "cache", "." ]
train
https://github.com/silenc3r/dikicli/blob/53721cdf75db04e2edca5ed3f99beae7c079d980/dikicli/core.py#L239-L266
silenc3r/dikicli
dikicli/core.py
_get_words
def _get_words(data_dir): """Get list of words from history file. Parameters ---------- data_dir : pathlib.Path Directory where data is saved. Returns ------- word_list : list of str List of words. """ words_file = data_dir.joinpath("words.txt") word_list = [] ...
python
def _get_words(data_dir): """Get list of words from history file. Parameters ---------- data_dir : pathlib.Path Directory where data is saved. Returns ------- word_list : list of str List of words. """ words_file = data_dir.joinpath("words.txt") word_list = [] ...
[ "def", "_get_words", "(", "data_dir", ")", ":", "words_file", "=", "data_dir", ".", "joinpath", "(", "\"words.txt\"", ")", "word_list", "=", "[", "]", "if", "not", "words_file", ".", "is_file", "(", ")", ":", "return", "word_list", "with", "open", "(", "...
Get list of words from history file. Parameters ---------- data_dir : pathlib.Path Directory where data is saved. Returns ------- word_list : list of str List of words.
[ "Get", "list", "of", "words", "from", "history", "file", "." ]
train
https://github.com/silenc3r/dikicli/blob/53721cdf75db04e2edca5ed3f99beae7c079d980/dikicli/core.py#L269-L290
silenc3r/dikicli
dikicli/core.py
_save_to_history
def _save_to_history(word, data_dir): """Write word to history file. Parameters ---------- word : str Word to save to history. data_dir : pathlib.Path Directory where history file should be saved. data_dir and it's parent directories will be created if needed. """ if no...
python
def _save_to_history(word, data_dir): """Write word to history file. Parameters ---------- word : str Word to save to history. data_dir : pathlib.Path Directory where history file should be saved. data_dir and it's parent directories will be created if needed. """ if no...
[ "def", "_save_to_history", "(", "word", ",", "data_dir", ")", ":", "if", "not", "data_dir", ".", "exists", "(", ")", ":", "logger", ".", "debug", "(", "\"Creating DATA DIR: %s\"", ",", "data_dir", ".", "as_posix", "(", ")", ")", "data_dir", ".", "mkdir", ...
Write word to history file. Parameters ---------- word : str Word to save to history. data_dir : pathlib.Path Directory where history file should be saved. data_dir and it's parent directories will be created if needed.
[ "Write", "word", "to", "history", "file", "." ]
train
https://github.com/silenc3r/dikicli/blob/53721cdf75db04e2edca5ed3f99beae7c079d980/dikicli/core.py#L293-L311
silenc3r/dikicli
dikicli/core.py
_create_html_file_content
def _create_html_file_content(translations): """Create html string out of translation dict. Parameters ---------- tralnslations : dict Dictionary of word translations. Returns ------- str: html string of translation """ content = [] for i1, t in enumerate(transl...
python
def _create_html_file_content(translations): """Create html string out of translation dict. Parameters ---------- tralnslations : dict Dictionary of word translations. Returns ------- str: html string of translation """ content = [] for i1, t in enumerate(transl...
[ "def", "_create_html_file_content", "(", "translations", ")", ":", "content", "=", "[", "]", "for", "i1", ",", "t", "in", "enumerate", "(", "translations", ")", ":", "if", "i1", ">", "0", ":", "content", ".", "append", "(", "\"<br>\"", ")", "content", ...
Create html string out of translation dict. Parameters ---------- tralnslations : dict Dictionary of word translations. Returns ------- str: html string of translation
[ "Create", "html", "string", "out", "of", "translation", "dict", "." ]
train
https://github.com/silenc3r/dikicli/blob/53721cdf75db04e2edca5ed3f99beae7c079d980/dikicli/core.py#L314-L364
silenc3r/dikicli
dikicli/core.py
_write_html_file
def _write_html_file(word, translations, data_dir, native=False): """Create html file of word translations. Parameters ---------- word : str Word that was translated. tralnslations : dict Dictionary of word translations. data_dir : pathlib.Path Location where html files ...
python
def _write_html_file(word, translations, data_dir, native=False): """Create html file of word translations. Parameters ---------- word : str Word that was translated. tralnslations : dict Dictionary of word translations. data_dir : pathlib.Path Location where html files ...
[ "def", "_write_html_file", "(", "word", ",", "translations", ",", "data_dir", ",", "native", "=", "False", ")", ":", "content_str", "=", "_create_html_file_content", "(", "translations", ")", "html_string", "=", "HTML_TEMPLATE", ".", "replace", "(", "\"{% word %}\...
Create html file of word translations. Parameters ---------- word : str Word that was translated. tralnslations : dict Dictionary of word translations. data_dir : pathlib.Path Location where html files are saved.
[ "Create", "html", "file", "of", "word", "translations", "." ]
train
https://github.com/silenc3r/dikicli/blob/53721cdf75db04e2edca5ed3f99beae7c079d980/dikicli/core.py#L367-L388
silenc3r/dikicli
dikicli/core.py
_create_index_content
def _create_index_content(words): """Create html string of index file. Parameters ---------- words : list of str List of cached words. Returns ------- str html string. """ content = ["<h1>Index</h1>", "<ul>"] for word in words: content.append( ...
python
def _create_index_content(words): """Create html string of index file. Parameters ---------- words : list of str List of cached words. Returns ------- str html string. """ content = ["<h1>Index</h1>", "<ul>"] for word in words: content.append( ...
[ "def", "_create_index_content", "(", "words", ")", ":", "content", "=", "[", "\"<h1>Index</h1>\"", ",", "\"<ul>\"", "]", "for", "word", "in", "words", ":", "content", ".", "append", "(", "'<li><a href=\"translations/{word}.html\">{word}</a></li>'", ".", "format", "(...
Create html string of index file. Parameters ---------- words : list of str List of cached words. Returns ------- str html string.
[ "Create", "html", "string", "of", "index", "file", "." ]
train
https://github.com/silenc3r/dikicli/blob/53721cdf75db04e2edca5ed3f99beae7c079d980/dikicli/core.py#L391-L414
silenc3r/dikicli
dikicli/core.py
_write_index_file
def _write_index_file(data_dir): """Create index file of cached translations. Parameters ---------- data_dir : pathlib.Path Cache directory location. """ cached_words = [ w for w in _get_words(data_dir) if data_dir.joinpath("translations/{}.html".format(w)).is_fi...
python
def _write_index_file(data_dir): """Create index file of cached translations. Parameters ---------- data_dir : pathlib.Path Cache directory location. """ cached_words = [ w for w in _get_words(data_dir) if data_dir.joinpath("translations/{}.html".format(w)).is_fi...
[ "def", "_write_index_file", "(", "data_dir", ")", ":", "cached_words", "=", "[", "w", "for", "w", "in", "_get_words", "(", "data_dir", ")", "if", "data_dir", ".", "joinpath", "(", "\"translations/{}.html\"", ".", "format", "(", "w", ")", ")", ".", "is_file...
Create index file of cached translations. Parameters ---------- data_dir : pathlib.Path Cache directory location.
[ "Create", "index", "file", "of", "cached", "translations", "." ]
train
https://github.com/silenc3r/dikicli/blob/53721cdf75db04e2edca5ed3f99beae7c079d980/dikicli/core.py#L417-L436
silenc3r/dikicli
dikicli/core.py
save_file
def save_file(filename, data, mk_parents=True): """Save file to disk. Paramaters ---------- filename : pathlib.Path Path to the file. data : str File contents. mk_parents : bool, optional If to create parent directories. """ parent = filename.parent if not pa...
python
def save_file(filename, data, mk_parents=True): """Save file to disk. Paramaters ---------- filename : pathlib.Path Path to the file. data : str File contents. mk_parents : bool, optional If to create parent directories. """ parent = filename.parent if not pa...
[ "def", "save_file", "(", "filename", ",", "data", ",", "mk_parents", "=", "True", ")", ":", "parent", "=", "filename", ".", "parent", "if", "not", "parent", ".", "exists", "(", ")", "and", "mk_parents", ":", "logger", ".", "debug", "(", "\"Creating direc...
Save file to disk. Paramaters ---------- filename : pathlib.Path Path to the file. data : str File contents. mk_parents : bool, optional If to create parent directories.
[ "Save", "file", "to", "disk", "." ]
train
https://github.com/silenc3r/dikicli/blob/53721cdf75db04e2edca5ed3f99beae7c079d980/dikicli/core.py#L439-L457
silenc3r/dikicli
dikicli/core.py
_lookup_online
def _lookup_online(word): """Look up word on diki.pl. Parameters ---------- word : str Word too look up. Returns ------- str website HTML content. """ URL = "https://www.diki.pl/{word}" HEADERS = { "User-Agent": ( "Mozilla/5.0 (compatible, MS...
python
def _lookup_online(word): """Look up word on diki.pl. Parameters ---------- word : str Word too look up. Returns ------- str website HTML content. """ URL = "https://www.diki.pl/{word}" HEADERS = { "User-Agent": ( "Mozilla/5.0 (compatible, MS...
[ "def", "_lookup_online", "(", "word", ")", ":", "URL", "=", "\"https://www.diki.pl/{word}\"", "HEADERS", "=", "{", "\"User-Agent\"", ":", "(", "\"Mozilla/5.0 (compatible, MSIE 11, Windows NT 6.3; \"", "\"Trident/7.0; rv:11.0) like Gecko\"", ")", "}", "logger", ".", "debug"...
Look up word on diki.pl. Parameters ---------- word : str Word too look up. Returns ------- str website HTML content.
[ "Look", "up", "word", "on", "diki", ".", "pl", "." ]
train
https://github.com/silenc3r/dikicli/blob/53721cdf75db04e2edca5ed3f99beae7c079d980/dikicli/core.py#L460-L487
silenc3r/dikicli
dikicli/core.py
translate
def translate(word, config, use_cache=True, to_eng=False): """Translate a word. Parameters ---------- word : str Word to translate. config : Config Configuration settings. use_cache : bool, optional Wheter to use cache. to_eng : bool, optional Translate from ...
python
def translate(word, config, use_cache=True, to_eng=False): """Translate a word. Parameters ---------- word : str Word to translate. config : Config Configuration settings. use_cache : bool, optional Wheter to use cache. to_eng : bool, optional Translate from ...
[ "def", "translate", "(", "word", ",", "config", ",", "use_cache", "=", "True", ",", "to_eng", "=", "False", ")", ":", "translation", "=", "None", "data_dir", "=", "Path", "(", "config", "[", "\"data dir\"", "]", ")", "if", "use_cache", ":", "logger", "...
Translate a word. Parameters ---------- word : str Word to translate. config : Config Configuration settings. use_cache : bool, optional Wheter to use cache. to_eng : bool, optional Translate from Polish to English. Returns ------- translation ...
[ "Translate", "a", "word", "." ]
train
https://github.com/silenc3r/dikicli/blob/53721cdf75db04e2edca5ed3f99beae7c079d980/dikicli/core.py#L490-L537
silenc3r/dikicli
dikicli/core.py
display_index
def display_index(config): """Open index in web browser. Parameters ---------- config : Config Configuration settings. Raises ------ FileNotFoundError If index file doesn't exist. """ browser = config["web browser"].lower() data_dir = Path(config["data dir"]) ...
python
def display_index(config): """Open index in web browser. Parameters ---------- config : Config Configuration settings. Raises ------ FileNotFoundError If index file doesn't exist. """ browser = config["web browser"].lower() data_dir = Path(config["data dir"]) ...
[ "def", "display_index", "(", "config", ")", ":", "browser", "=", "config", "[", "\"web browser\"", "]", ".", "lower", "(", ")", "data_dir", "=", "Path", "(", "config", "[", "\"data dir\"", "]", ")", "if", "browser", "in", "webbrowser", ".", "_browsers", ...
Open index in web browser. Parameters ---------- config : Config Configuration settings. Raises ------ FileNotFoundError If index file doesn't exist.
[ "Open", "index", "in", "web", "browser", "." ]
train
https://github.com/silenc3r/dikicli/blob/53721cdf75db04e2edca5ed3f99beae7c079d980/dikicli/core.py#L540-L569
silenc3r/dikicli
dikicli/core.py
wrap_text
def wrap_text(translations, linewrap=0): """Pretty print translations. If linewrap is set to 0 disble line wrapping. Parameters ---------- translations : list List of word translations. linewrap : int Maximum line length before wrapping. """ # pylint: disable=too-many-l...
python
def wrap_text(translations, linewrap=0): """Pretty print translations. If linewrap is set to 0 disble line wrapping. Parameters ---------- translations : list List of word translations. linewrap : int Maximum line length before wrapping. """ # pylint: disable=too-many-l...
[ "def", "wrap_text", "(", "translations", ",", "linewrap", "=", "0", ")", ":", "# pylint: disable=too-many-locals", "def", "wrap", "(", "text", ",", "width", "=", "linewrap", ",", "findent", "=", "0", ",", "sindent", "=", "0", ",", "bold", "=", "False", "...
Pretty print translations. If linewrap is set to 0 disble line wrapping. Parameters ---------- translations : list List of word translations. linewrap : int Maximum line length before wrapping.
[ "Pretty", "print", "translations", "." ]
train
https://github.com/silenc3r/dikicli/blob/53721cdf75db04e2edca5ed3f99beae7c079d980/dikicli/core.py#L572-L626
silenc3r/dikicli
dikicli/core.py
Config.read_config
def read_config(self): """ Read config from a file. Invalid config values will be discarded and defaults used in their place. """ _config = self.config["dikicli"] # TODO: what if file doesn't exist? if self.config_file.is_file(): logger.debug(...
python
def read_config(self): """ Read config from a file. Invalid config values will be discarded and defaults used in their place. """ _config = self.config["dikicli"] # TODO: what if file doesn't exist? if self.config_file.is_file(): logger.debug(...
[ "def", "read_config", "(", "self", ")", ":", "_config", "=", "self", ".", "config", "[", "\"dikicli\"", "]", "# TODO: what if file doesn't exist?", "if", "self", ".", "config_file", ".", "is_file", "(", ")", ":", "logger", ".", "debug", "(", "\"Reading config ...
Read config from a file. Invalid config values will be discarded and defaults used in their place.
[ "Read", "config", "from", "a", "file", "." ]
train
https://github.com/silenc3r/dikicli/blob/53721cdf75db04e2edca5ed3f99beae7c079d980/dikicli/core.py#L71-L101
silenc3r/dikicli
dikicli/core.py
Config.create_default_config
def create_default_config(self): """Write default config file to disk. Backs up existing configuration file. Returns ------- filename : string Path to config file. """ filename = self.config_file.as_posix() logger.info("Creating default confi...
python
def create_default_config(self): """Write default config file to disk. Backs up existing configuration file. Returns ------- filename : string Path to config file. """ filename = self.config_file.as_posix() logger.info("Creating default confi...
[ "def", "create_default_config", "(", "self", ")", ":", "filename", "=", "self", ".", "config_file", ".", "as_posix", "(", ")", "logger", ".", "info", "(", "\"Creating default config file: %s\"", ",", "filename", ")", "config_dir", "=", "self", ".", "config_file"...
Write default config file to disk. Backs up existing configuration file. Returns ------- filename : string Path to config file.
[ "Write", "default", "config", "file", "to", "disk", "." ]
train
https://github.com/silenc3r/dikicli/blob/53721cdf75db04e2edca5ed3f99beae7c079d980/dikicli/core.py#L103-L130