hexsha stringlengths 40 40 | repo stringlengths 7 114 | path stringlengths 4 124 | license listlengths 1 9 | language stringclasses 1
value | identifier stringlengths 1 71 | return_type stringlengths 1 749 ⌀ | original_string stringlengths 76 22.7k | original_docstring stringlengths 16 7.61k | docstring stringlengths 16 2.47k | docstring_tokens listlengths 6 477 | code stringlengths 14 10.2k | code_tokens listlengths 6 996 | short_docstring stringlengths 2 644 | short_docstring_tokens listlengths 1 116 | comment listlengths 1 89 | parameters listlengths 0 64 | docstring_params dict |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
63577480697fc3dbcb79fc5de4d9a030c212fc13 | mrmansano/sublime-ycmd | lib/subl/settings.py | [
"MIT"
] | Python | ycmd_python_binary_path | <not_specific> | def ycmd_python_binary_path(self):
'''
Returns the path to the python executable used to start ycmd.
If set, this will be a string. If unset, it is calculated based on the
PATH environment variable. If that fails, this will be `None`.
'''
return self._ycmd_python_binary_p... |
Returns the path to the python executable used to start ycmd.
If set, this will be a string. If unset, it is calculated based on the
PATH environment variable. If that fails, this will be `None`.
| Returns the path to the python executable used to start ycmd.
If set, this will be a string. If unset, it is calculated based on the
PATH environment variable. If that fails, this will be `None`. | [
"Returns",
"the",
"path",
"to",
"the",
"python",
"executable",
"used",
"to",
"start",
"ycmd",
".",
"If",
"set",
"this",
"will",
"be",
"a",
"string",
".",
"If",
"unset",
"it",
"is",
"calculated",
"based",
"on",
"the",
"PATH",
"environment",
"variable",
".... | def ycmd_python_binary_path(self):
return self._ycmd_python_binary_path | [
"def",
"ycmd_python_binary_path",
"(",
"self",
")",
":",
"return",
"self",
".",
"_ycmd_python_binary_path"
] | Returns the path to the python executable used to start ycmd. | [
"Returns",
"the",
"path",
"to",
"the",
"python",
"executable",
"used",
"to",
"start",
"ycmd",
"."
] | [
"'''\n Returns the path to the python executable used to start ycmd.\n If set, this will be a string. If unset, it is calculated based on the\n PATH environment variable. If that fails, this will be `None`.\n '''"
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
63577480697fc3dbcb79fc5de4d9a030c212fc13 | mrmansano/sublime-ycmd | lib/subl/settings.py | [
"MIT"
] | Python | ycmd_language_whitelist | <not_specific> | def ycmd_language_whitelist(self):
'''
Returns the language/scope whitelist to perform completions on.
This will be a list of strings, but may be empty.
'''
return self._ycmd_language_whitelist |
Returns the language/scope whitelist to perform completions on.
This will be a list of strings, but may be empty.
| Returns the language/scope whitelist to perform completions on.
This will be a list of strings, but may be empty. | [
"Returns",
"the",
"language",
"/",
"scope",
"whitelist",
"to",
"perform",
"completions",
"on",
".",
"This",
"will",
"be",
"a",
"list",
"of",
"strings",
"but",
"may",
"be",
"empty",
"."
] | def ycmd_language_whitelist(self):
return self._ycmd_language_whitelist | [
"def",
"ycmd_language_whitelist",
"(",
"self",
")",
":",
"return",
"self",
".",
"_ycmd_language_whitelist"
] | Returns the language/scope whitelist to perform completions on. | [
"Returns",
"the",
"language",
"/",
"scope",
"whitelist",
"to",
"perform",
"completions",
"on",
"."
] | [
"'''\n Returns the language/scope whitelist to perform completions on.\n This will be a list of strings, but may be empty.\n '''"
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
63577480697fc3dbcb79fc5de4d9a030c212fc13 | mrmansano/sublime-ycmd | lib/subl/settings.py | [
"MIT"
] | Python | ycmd_language_blacklist | <not_specific> | def ycmd_language_blacklist(self):
'''
Returns the language/scope blacklist to prevent completions on.
This will be a list of strings, but may be empty.
'''
return self._ycmd_language_blacklist |
Returns the language/scope blacklist to prevent completions on.
This will be a list of strings, but may be empty.
| Returns the language/scope blacklist to prevent completions on.
This will be a list of strings, but may be empty. | [
"Returns",
"the",
"language",
"/",
"scope",
"blacklist",
"to",
"prevent",
"completions",
"on",
".",
"This",
"will",
"be",
"a",
"list",
"of",
"strings",
"but",
"may",
"be",
"empty",
"."
] | def ycmd_language_blacklist(self):
return self._ycmd_language_blacklist | [
"def",
"ycmd_language_blacklist",
"(",
"self",
")",
":",
"return",
"self",
".",
"_ycmd_language_blacklist"
] | Returns the language/scope blacklist to prevent completions on. | [
"Returns",
"the",
"language",
"/",
"scope",
"blacklist",
"to",
"prevent",
"completions",
"on",
"."
] | [
"'''\n Returns the language/scope blacklist to prevent completions on.\n This will be a list of strings, but may be empty.\n '''"
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
63577480697fc3dbcb79fc5de4d9a030c212fc13 | mrmansano/sublime-ycmd | lib/subl/settings.py | [
"MIT"
] | Python | ycmd_language_filetype | <not_specific> | def ycmd_language_filetype(self):
'''
Returns the mapping used to translate source scopes to filetypes.
This will be a dictionary, but may be empty.
'''
return self._ycmd_language_filetype |
Returns the mapping used to translate source scopes to filetypes.
This will be a dictionary, but may be empty.
| Returns the mapping used to translate source scopes to filetypes.
This will be a dictionary, but may be empty. | [
"Returns",
"the",
"mapping",
"used",
"to",
"translate",
"source",
"scopes",
"to",
"filetypes",
".",
"This",
"will",
"be",
"a",
"dictionary",
"but",
"may",
"be",
"empty",
"."
] | def ycmd_language_filetype(self):
return self._ycmd_language_filetype | [
"def",
"ycmd_language_filetype",
"(",
"self",
")",
":",
"return",
"self",
".",
"_ycmd_language_filetype"
] | Returns the mapping used to translate source scopes to filetypes. | [
"Returns",
"the",
"mapping",
"used",
"to",
"translate",
"source",
"scopes",
"to",
"filetypes",
"."
] | [
"'''\n Returns the mapping used to translate source scopes to filetypes.\n This will be a dictionary, but may be empty.\n '''"
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
63577480697fc3dbcb79fc5de4d9a030c212fc13 | mrmansano/sublime-ycmd | lib/subl/settings.py | [
"MIT"
] | Python | ycmd_idle_suicide_seconds | <not_specific> | def ycmd_idle_suicide_seconds(self):
'''
Returns the server idle suicide timeout in seconds.
If set, this will be an integer. If unset, this will be `None`, which
should use a default timeout.
'''
return self._ycmd_idle_suicide_seconds |
Returns the server idle suicide timeout in seconds.
If set, this will be an integer. If unset, this will be `None`, which
should use a default timeout.
| Returns the server idle suicide timeout in seconds.
If set, this will be an integer. If unset, this will be `None`, which
should use a default timeout. | [
"Returns",
"the",
"server",
"idle",
"suicide",
"timeout",
"in",
"seconds",
".",
"If",
"set",
"this",
"will",
"be",
"an",
"integer",
".",
"If",
"unset",
"this",
"will",
"be",
"`",
"None",
"`",
"which",
"should",
"use",
"a",
"default",
"timeout",
"."
] | def ycmd_idle_suicide_seconds(self):
return self._ycmd_idle_suicide_seconds | [
"def",
"ycmd_idle_suicide_seconds",
"(",
"self",
")",
":",
"return",
"self",
".",
"_ycmd_idle_suicide_seconds"
] | Returns the server idle suicide timeout in seconds. | [
"Returns",
"the",
"server",
"idle",
"suicide",
"timeout",
"in",
"seconds",
"."
] | [
"'''\n Returns the server idle suicide timeout in seconds.\n If set, this will be an integer. If unset, this will be `None`, which\n should use a default timeout.\n '''"
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
63577480697fc3dbcb79fc5de4d9a030c212fc13 | mrmansano/sublime-ycmd | lib/subl/settings.py | [
"MIT"
] | Python | ycmd_check_interval_seconds | <not_specific> | def ycmd_check_interval_seconds(self):
'''
Returns the subserver health check frequency in seconds.
If set, this will be an integer. If unset, this will be `None`, which
should use a default frequency.
'''
return self._ycmd_check_interval_seconds |
Returns the subserver health check frequency in seconds.
If set, this will be an integer. If unset, this will be `None`, which
should use a default frequency.
| Returns the subserver health check frequency in seconds.
If set, this will be an integer. If unset, this will be `None`, which
should use a default frequency. | [
"Returns",
"the",
"subserver",
"health",
"check",
"frequency",
"in",
"seconds",
".",
"If",
"set",
"this",
"will",
"be",
"an",
"integer",
".",
"If",
"unset",
"this",
"will",
"be",
"`",
"None",
"`",
"which",
"should",
"use",
"a",
"default",
"frequency",
".... | def ycmd_check_interval_seconds(self):
return self._ycmd_check_interval_seconds | [
"def",
"ycmd_check_interval_seconds",
"(",
"self",
")",
":",
"return",
"self",
".",
"_ycmd_check_interval_seconds"
] | Returns the subserver health check frequency in seconds. | [
"Returns",
"the",
"subserver",
"health",
"check",
"frequency",
"in",
"seconds",
"."
] | [
"'''\n Returns the subserver health check frequency in seconds.\n If set, this will be an integer. If unset, this will be `None`, which\n should use a default frequency.\n '''"
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
63577480697fc3dbcb79fc5de4d9a030c212fc13 | mrmansano/sublime-ycmd | lib/subl/settings.py | [
"MIT"
] | Python | ycmd_log_level | <not_specific> | def ycmd_log_level(self):
'''
Returns the log level to enable on the ycmd server.
If set, this will be a string. If unset, this will be `None`, which
should leave the log level unspecified (i.e. default ycmd logging).
'''
return self._ycmd_log_level |
Returns the log level to enable on the ycmd server.
If set, this will be a string. If unset, this will be `None`, which
should leave the log level unspecified (i.e. default ycmd logging).
| Returns the log level to enable on the ycmd server.
If set, this will be a string. If unset, this will be `None`, which
should leave the log level unspecified . | [
"Returns",
"the",
"log",
"level",
"to",
"enable",
"on",
"the",
"ycmd",
"server",
".",
"If",
"set",
"this",
"will",
"be",
"a",
"string",
".",
"If",
"unset",
"this",
"will",
"be",
"`",
"None",
"`",
"which",
"should",
"leave",
"the",
"log",
"level",
"un... | def ycmd_log_level(self):
return self._ycmd_log_level | [
"def",
"ycmd_log_level",
"(",
"self",
")",
":",
"return",
"self",
".",
"_ycmd_log_level"
] | Returns the log level to enable on the ycmd server. | [
"Returns",
"the",
"log",
"level",
"to",
"enable",
"on",
"the",
"ycmd",
"server",
"."
] | [
"'''\n Returns the log level to enable on the ycmd server.\n If set, this will be a string. If unset, this will be `None`, which\n should leave the log level unspecified (i.e. default ycmd logging).\n '''"
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
63577480697fc3dbcb79fc5de4d9a030c212fc13 | mrmansano/sublime-ycmd | lib/subl/settings.py | [
"MIT"
] | Python | ycmd_log_file | <not_specific> | def ycmd_log_file(self):
'''
Returns the log file to be used by the ycmd server for logging.
If set, it may be either a boolean, or a string. If unset, this will
be `None`. See the settings file for what these values mean.
'''
return self._ycmd_log_file |
Returns the log file to be used by the ycmd server for logging.
If set, it may be either a boolean, or a string. If unset, this will
be `None`. See the settings file for what these values mean.
| Returns the log file to be used by the ycmd server for logging.
If set, it may be either a boolean, or a string. If unset, this will
be `None`. See the settings file for what these values mean. | [
"Returns",
"the",
"log",
"file",
"to",
"be",
"used",
"by",
"the",
"ycmd",
"server",
"for",
"logging",
".",
"If",
"set",
"it",
"may",
"be",
"either",
"a",
"boolean",
"or",
"a",
"string",
".",
"If",
"unset",
"this",
"will",
"be",
"`",
"None",
"`",
".... | def ycmd_log_file(self):
return self._ycmd_log_file | [
"def",
"ycmd_log_file",
"(",
"self",
")",
":",
"return",
"self",
".",
"_ycmd_log_file"
] | Returns the log file to be used by the ycmd server for logging. | [
"Returns",
"the",
"log",
"file",
"to",
"be",
"used",
"by",
"the",
"ycmd",
"server",
"for",
"logging",
"."
] | [
"'''\n Returns the log file to be used by the ycmd server for logging.\n If set, it may be either a boolean, or a string. If unset, this will\n be `None`. See the settings file for what these values mean.\n '''"
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
63577480697fc3dbcb79fc5de4d9a030c212fc13 | mrmansano/sublime-ycmd | lib/subl/settings.py | [
"MIT"
] | Python | ycmd_keep_logs | <not_specific> | def ycmd_keep_logs(self):
'''
Returns whether or not log files should be retained when ycmd exits.
This will be a boolean. If unset, this returns a default of `False`.
'''
if self._ycmd_keep_logs is None:
return False
return self._ycmd_keep_logs |
Returns whether or not log files should be retained when ycmd exits.
This will be a boolean. If unset, this returns a default of `False`.
| Returns whether or not log files should be retained when ycmd exits.
This will be a boolean. If unset, this returns a default of `False`. | [
"Returns",
"whether",
"or",
"not",
"log",
"files",
"should",
"be",
"retained",
"when",
"ycmd",
"exits",
".",
"This",
"will",
"be",
"a",
"boolean",
".",
"If",
"unset",
"this",
"returns",
"a",
"default",
"of",
"`",
"False",
"`",
"."
] | def ycmd_keep_logs(self):
if self._ycmd_keep_logs is None:
return False
return self._ycmd_keep_logs | [
"def",
"ycmd_keep_logs",
"(",
"self",
")",
":",
"if",
"self",
".",
"_ycmd_keep_logs",
"is",
"None",
":",
"return",
"False",
"return",
"self",
".",
"_ycmd_keep_logs"
] | Returns whether or not log files should be retained when ycmd exits. | [
"Returns",
"whether",
"or",
"not",
"log",
"files",
"should",
"be",
"retained",
"when",
"ycmd",
"exits",
"."
] | [
"'''\n Returns whether or not log files should be retained when ycmd exits.\n This will be a boolean. If unset, this returns a default of `False`.\n '''"
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
63577480697fc3dbcb79fc5de4d9a030c212fc13 | mrmansano/sublime-ycmd | lib/subl/settings.py | [
"MIT"
] | Python | ycmd_force_semantic_completion | <not_specific> | def ycmd_force_semantic_completion(self):
'''
Returns whether or not semantic completion should be forced.
This will be a boolean. If unset, this returns a default of `False`.
'''
if self._ycmd_force_semantic_completion is None:
return False
return self._ycmd_... |
Returns whether or not semantic completion should be forced.
This will be a boolean. If unset, this returns a default of `False`.
| Returns whether or not semantic completion should be forced.
This will be a boolean. If unset, this returns a default of `False`. | [
"Returns",
"whether",
"or",
"not",
"semantic",
"completion",
"should",
"be",
"forced",
".",
"This",
"will",
"be",
"a",
"boolean",
".",
"If",
"unset",
"this",
"returns",
"a",
"default",
"of",
"`",
"False",
"`",
"."
] | def ycmd_force_semantic_completion(self):
if self._ycmd_force_semantic_completion is None:
return False
return self._ycmd_force_semantic_completion | [
"def",
"ycmd_force_semantic_completion",
"(",
"self",
")",
":",
"if",
"self",
".",
"_ycmd_force_semantic_completion",
"is",
"None",
":",
"return",
"False",
"return",
"self",
".",
"_ycmd_force_semantic_completion"
] | Returns whether or not semantic completion should be forced. | [
"Returns",
"whether",
"or",
"not",
"semantic",
"completion",
"should",
"be",
"forced",
"."
] | [
"'''\n Returns whether or not semantic completion should be forced.\n This will be a boolean. If unset, this returns a default of `False`.\n '''"
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
63577480697fc3dbcb79fc5de4d9a030c212fc13 | mrmansano/sublime-ycmd | lib/subl/settings.py | [
"MIT"
] | Python | sublime_ycmd_log_level | <not_specific> | def sublime_ycmd_log_level(self):
'''
Returns the log level for the plugin/client.
If set, this will be a string. If unset, this will be `None`, which
should silence all log output.
'''
return self._sublime_ycmd_log_level |
Returns the log level for the plugin/client.
If set, this will be a string. If unset, this will be `None`, which
should silence all log output.
| Returns the log level for the plugin/client.
If set, this will be a string. If unset, this will be `None`, which
should silence all log output. | [
"Returns",
"the",
"log",
"level",
"for",
"the",
"plugin",
"/",
"client",
".",
"If",
"set",
"this",
"will",
"be",
"a",
"string",
".",
"If",
"unset",
"this",
"will",
"be",
"`",
"None",
"`",
"which",
"should",
"silence",
"all",
"log",
"output",
"."
] | def sublime_ycmd_log_level(self):
return self._sublime_ycmd_log_level | [
"def",
"sublime_ycmd_log_level",
"(",
"self",
")",
":",
"return",
"self",
".",
"_sublime_ycmd_log_level"
] | Returns the log level for the plugin/client. | [
"Returns",
"the",
"log",
"level",
"for",
"the",
"plugin",
"/",
"client",
"."
] | [
"'''\n Returns the log level for the plugin/client.\n If set, this will be a string. If unset, this will be `None`, which\n should silence all log output.\n '''"
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
63577480697fc3dbcb79fc5de4d9a030c212fc13 | mrmansano/sublime-ycmd | lib/subl/settings.py | [
"MIT"
] | Python | sublime_ycmd_log_file | <not_specific> | def sublime_ycmd_log_file(self):
'''
Returns the log file to write plugin/client logs to.
If set, this will be a string. If unset, this will be `None`, which
should output to the console/terminal.
'''
return self._sublime_ycmd_log_file |
Returns the log file to write plugin/client logs to.
If set, this will be a string. If unset, this will be `None`, which
should output to the console/terminal.
| Returns the log file to write plugin/client logs to.
If set, this will be a string. If unset, this will be `None`, which
should output to the console/terminal. | [
"Returns",
"the",
"log",
"file",
"to",
"write",
"plugin",
"/",
"client",
"logs",
"to",
".",
"If",
"set",
"this",
"will",
"be",
"a",
"string",
".",
"If",
"unset",
"this",
"will",
"be",
"`",
"None",
"`",
"which",
"should",
"output",
"to",
"the",
"conso... | def sublime_ycmd_log_file(self):
return self._sublime_ycmd_log_file | [
"def",
"sublime_ycmd_log_file",
"(",
"self",
")",
":",
"return",
"self",
".",
"_sublime_ycmd_log_file"
] | Returns the log file to write plugin/client logs to. | [
"Returns",
"the",
"log",
"file",
"to",
"write",
"plugin",
"/",
"client",
"logs",
"to",
"."
] | [
"'''\n Returns the log file to write plugin/client logs to.\n If set, this will be a string. If unset, this will be `None`, which\n should output to the console/terminal.\n '''"
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
63577480697fc3dbcb79fc5de4d9a030c212fc13 | mrmansano/sublime-ycmd | lib/subl/settings.py | [
"MIT"
] | Python | sublime_ycmd_background_threads | <not_specific> | def sublime_ycmd_background_threads(self):
'''
Returns the number of background threads to use for task pools.
This will be a positive integer.
'''
return self._sublime_ycmd_background_threads |
Returns the number of background threads to use for task pools.
This will be a positive integer.
| Returns the number of background threads to use for task pools.
This will be a positive integer. | [
"Returns",
"the",
"number",
"of",
"background",
"threads",
"to",
"use",
"for",
"task",
"pools",
".",
"This",
"will",
"be",
"a",
"positive",
"integer",
"."
] | def sublime_ycmd_background_threads(self):
return self._sublime_ycmd_background_threads | [
"def",
"sublime_ycmd_background_threads",
"(",
"self",
")",
":",
"return",
"self",
".",
"_sublime_ycmd_background_threads"
] | Returns the number of background threads to use for task pools. | [
"Returns",
"the",
"number",
"of",
"background",
"threads",
"to",
"use",
"for",
"task",
"pools",
"."
] | [
"'''\n Returns the number of background threads to use for task pools.\n This will be a positive integer.\n '''"
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
63577480697fc3dbcb79fc5de4d9a030c212fc13 | mrmansano/sublime-ycmd | lib/subl/settings.py | [
"MIT"
] | Python | load_settings | <not_specific> | def load_settings(filename=SUBLIME_SETTINGS_FILENAME):
'''
Fetches the resolved settings file `filename` from sublime, and parses
it into a `Settings` instance. The file name should be the base name of
the file (i.e. not the absolute/relative path to it).
'''
logger.debug('loading settings from:... |
Fetches the resolved settings file `filename` from sublime, and parses
it into a `Settings` instance. The file name should be the base name of
the file (i.e. not the absolute/relative path to it).
| Fetches the resolved settings file `filename` from sublime, and parses
it into a `Settings` instance. The file name should be the base name of
the file . | [
"Fetches",
"the",
"resolved",
"settings",
"file",
"`",
"filename",
"`",
"from",
"sublime",
"and",
"parses",
"it",
"into",
"a",
"`",
"Settings",
"`",
"instance",
".",
"The",
"file",
"name",
"should",
"be",
"the",
"base",
"name",
"of",
"the",
"file",
"."
] | def load_settings(filename=SUBLIME_SETTINGS_FILENAME):
logger.debug('loading settings from: %s', filename)
settings = sublime.load_settings(filename)
logger.debug('parsing/extracting settings')
return Settings(settings=settings) | [
"def",
"load_settings",
"(",
"filename",
"=",
"SUBLIME_SETTINGS_FILENAME",
")",
":",
"logger",
".",
"debug",
"(",
"'loading settings from: %s'",
",",
"filename",
")",
"settings",
"=",
"sublime",
".",
"load_settings",
"(",
"filename",
")",
"logger",
".",
"debug",
... | Fetches the resolved settings file `filename` from sublime, and parses
it into a `Settings` instance. | [
"Fetches",
"the",
"resolved",
"settings",
"file",
"`",
"filename",
"`",
"from",
"sublime",
"and",
"parses",
"it",
"into",
"a",
"`",
"Settings",
"`",
"instance",
"."
] | [
"'''\n Fetches the resolved settings file `filename` from sublime, and parses\n it into a `Settings` instance. The file name should be the base name of\n the file (i.e. not the absolute/relative path to it).\n '''"
] | [
{
"param": "filename",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "filename",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
63577480697fc3dbcb79fc5de4d9a030c212fc13 | mrmansano/sublime-ycmd | lib/subl/settings.py | [
"MIT"
] | Python | bind_on_change_settings | <not_specific> | def bind_on_change_settings(callback,
filename=SUBLIME_SETTINGS_FILENAME):
'''
Binds `callback` to the on-change-settings event. The settings are loaded
from `filename`, which should be the base name of the file (i.e. not the
path to it). When loading, the settings are parsed... |
Binds `callback` to the on-change-settings event. The settings are loaded
from `filename`, which should be the base name of the file (i.e. not the
path to it). When loading, the settings are parsed into a `Settings`
instance, and this instance is supplied as an argument to the callback.
When called... | Binds `callback` to the on-change-settings event. The settings are loaded
from `filename`, which should be the base name of the file . When loading, the settings are parsed into a `Settings`
instance, and this instance is supplied as an argument to the callback.
When called, this will automatically load the settings fo... | [
"Binds",
"`",
"callback",
"`",
"to",
"the",
"on",
"-",
"change",
"-",
"settings",
"event",
".",
"The",
"settings",
"are",
"loaded",
"from",
"`",
"filename",
"`",
"which",
"should",
"be",
"the",
"base",
"name",
"of",
"the",
"file",
".",
"When",
"loading... | def bind_on_change_settings(callback,
filename=SUBLIME_SETTINGS_FILENAME):
logger.debug('loading settings from: %s', filename)
settings = sublime.load_settings(filename)
def on_change_settings():
logger.debug('settings have changed, reloading them')
settings = sub... | [
"def",
"bind_on_change_settings",
"(",
"callback",
",",
"filename",
"=",
"SUBLIME_SETTINGS_FILENAME",
")",
":",
"logger",
".",
"debug",
"(",
"'loading settings from: %s'",
",",
"filename",
")",
"settings",
"=",
"sublime",
".",
"load_settings",
"(",
"filename",
")",
... | Binds `callback` to the on-change-settings event. | [
"Binds",
"`",
"callback",
"`",
"to",
"the",
"on",
"-",
"change",
"-",
"settings",
"event",
"."
] | [
"'''\n Binds `callback` to the on-change-settings event. The settings are loaded\n from `filename`, which should be the base name of the file (i.e. not the\n path to it). When loading, the settings are parsed into a `Settings`\n instance, and this instance is supplied as an argument to the callback.\n ... | [
{
"param": "callback",
"type": null
},
{
"param": "filename",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "callback",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "filename",
"type": null,
"docstring": null,
"docstring_to... |
63577480697fc3dbcb79fc5de4d9a030c212fc13 | mrmansano/sublime-ycmd | lib/subl/settings.py | [
"MIT"
] | Python | validate_settings | <not_specific> | def validate_settings(settings):
'''
Checks `settings` for invalid/missing values. May raise `SettingsError`.
This only checks for type-mismatches and missing settings. It does not
check anything on the file system, as that could block.
If there are no issues, this returns without doing anything. Ot... |
Checks `settings` for invalid/missing values. May raise `SettingsError`.
This only checks for type-mismatches and missing settings. It does not
check anything on the file system, as that could block.
If there are no issues, this returns without doing anything. Otherwise,
this will raise an exceptio... | Checks `settings` for invalid/missing values. | [
"Checks",
"`",
"settings",
"`",
"for",
"invalid",
"/",
"missing",
"values",
"."
] | def validate_settings(settings):
if not isinstance(settings, Settings):
raise TypeError('settings must be Settings: %r' % (settings))
ycmd_root_directory = settings.ycmd_root_directory
ycmd_default_settings_path = settings.ycmd_default_settings_path
ycmd_python_binary_path = settings.ycmd_python... | [
"def",
"validate_settings",
"(",
"settings",
")",
":",
"if",
"not",
"isinstance",
"(",
"settings",
",",
"Settings",
")",
":",
"raise",
"TypeError",
"(",
"'settings must be Settings: %r'",
"%",
"(",
"settings",
")",
")",
"ycmd_root_directory",
"=",
"settings",
".... | Checks `settings` for invalid/missing values. | [
"Checks",
"`",
"settings",
"`",
"for",
"invalid",
"/",
"missing",
"values",
"."
] | [
"'''\n Checks `settings` for invalid/missing values. May raise `SettingsError`.\n This only checks for type-mismatches and missing settings. It does not\n check anything on the file system, as that could block.\n If there are no issues, this returns without doing anything. Otherwise,\n this will rais... | [
{
"param": "settings",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "settings",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
63577480697fc3dbcb79fc5de4d9a030c212fc13 | mrmansano/sublime-ycmd | lib/subl/settings.py | [
"MIT"
] | Python | has_same_ycmd_settings | <not_specific> | def has_same_ycmd_settings(settings1, settings2):
'''
Returns true if `settings1` and `settings2` have the same ycmd server
configuration, and false otherwise.
This can be used to detect when setting changes require ycmd restarts.
'''
if not isinstance(settings1, Settings):
raise TypeEr... |
Returns true if `settings1` and `settings2` have the same ycmd server
configuration, and false otherwise.
This can be used to detect when setting changes require ycmd restarts.
| Returns true if `settings1` and `settings2` have the same ycmd server
configuration, and false otherwise.
This can be used to detect when setting changes require ycmd restarts. | [
"Returns",
"true",
"if",
"`",
"settings1",
"`",
"and",
"`",
"settings2",
"`",
"have",
"the",
"same",
"ycmd",
"server",
"configuration",
"and",
"false",
"otherwise",
".",
"This",
"can",
"be",
"used",
"to",
"detect",
"when",
"setting",
"changes",
"require",
... | def has_same_ycmd_settings(settings1, settings2):
if not isinstance(settings1, Settings):
raise TypeError('settings are not Settings: %r' % (settings1))
if not isinstance(settings2, Settings):
raise TypeError('settings are not Settings: %r' % (settings2))
for ycmd_setting_key in SUBLIME_SETT... | [
"def",
"has_same_ycmd_settings",
"(",
"settings1",
",",
"settings2",
")",
":",
"if",
"not",
"isinstance",
"(",
"settings1",
",",
"Settings",
")",
":",
"raise",
"TypeError",
"(",
"'settings are not Settings: %r'",
"%",
"(",
"settings1",
")",
")",
"if",
"not",
"... | Returns true if `settings1` and `settings2` have the same ycmd server
configuration, and false otherwise. | [
"Returns",
"true",
"if",
"`",
"settings1",
"`",
"and",
"`",
"settings2",
"`",
"have",
"the",
"same",
"ycmd",
"server",
"configuration",
"and",
"false",
"otherwise",
"."
] | [
"'''\n Returns true if `settings1` and `settings2` have the same ycmd server\n configuration, and false otherwise.\n\n This can be used to detect when setting changes require ycmd restarts.\n '''",
"# else, everything matched!"
] | [
{
"param": "settings1",
"type": null
},
{
"param": "settings2",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "settings1",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "settings2",
"type": null,
"docstring": null,
"docstring_... |
63577480697fc3dbcb79fc5de4d9a030c212fc13 | mrmansano/sublime-ycmd | lib/subl/settings.py | [
"MIT"
] | Python | has_same_task_pool_settings | <not_specific> | def has_same_task_pool_settings(settings1, settings2):
'''
Returns true if `settings1` and `settings2` have the same task pool
configuration, and false otherwise.
This can be used to detect when setting changes require worker restarts.
'''
if not isinstance(settings1, Settings):
raise T... |
Returns true if `settings1` and `settings2` have the same task pool
configuration, and false otherwise.
This can be used to detect when setting changes require worker restarts.
| Returns true if `settings1` and `settings2` have the same task pool
configuration, and false otherwise.
This can be used to detect when setting changes require worker restarts. | [
"Returns",
"true",
"if",
"`",
"settings1",
"`",
"and",
"`",
"settings2",
"`",
"have",
"the",
"same",
"task",
"pool",
"configuration",
"and",
"false",
"otherwise",
".",
"This",
"can",
"be",
"used",
"to",
"detect",
"when",
"setting",
"changes",
"require",
"w... | def has_same_task_pool_settings(settings1, settings2):
if not isinstance(settings1, Settings):
raise TypeError('settings are not Settings: %r' % (settings1))
if not isinstance(settings2, Settings):
raise TypeError('settings are not Settings: %r' % (settings2))
for ycmd_setting_key in SUBLIME... | [
"def",
"has_same_task_pool_settings",
"(",
"settings1",
",",
"settings2",
")",
":",
"if",
"not",
"isinstance",
"(",
"settings1",
",",
"Settings",
")",
":",
"raise",
"TypeError",
"(",
"'settings are not Settings: %r'",
"%",
"(",
"settings1",
")",
")",
"if",
"not"... | Returns true if `settings1` and `settings2` have the same task pool
configuration, and false otherwise. | [
"Returns",
"true",
"if",
"`",
"settings1",
"`",
"and",
"`",
"settings2",
"`",
"have",
"the",
"same",
"task",
"pool",
"configuration",
"and",
"false",
"otherwise",
"."
] | [
"'''\n Returns true if `settings1` and `settings2` have the same task pool\n configuration, and false otherwise.\n\n This can be used to detect when setting changes require worker restarts.\n '''",
"# else, everything matched!"
] | [
{
"param": "settings1",
"type": null
},
{
"param": "settings2",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "settings1",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "settings2",
"type": null,
"docstring": null,
"docstring_... |
e9704be925c7c1d6639f9c2fd81703eaf839825e | mrmansano/sublime-ycmd | plugin/server.py | [
"MIT"
] | Python | shutdown | <not_specific> | def shutdown(self, hard=False, timeout=None):
'''
Shuts down all managed servers.
If `hard` is true, then the server processes will be killed via a kill
signal instead of the standard shutdown http request. If `timeout` is
omitted, this method waits indefinitely for the process ... |
Shuts down all managed servers.
If `hard` is true, then the server processes will be killed via a kill
signal instead of the standard shutdown http request. If `timeout` is
omitted, this method waits indefinitely for the process to exit.
Otherwise, each server process is given ... | Shuts down all managed servers.
If `hard` is true, then the server processes will be killed via a kill
signal instead of the standard shutdown http request. If `timeout` is
omitted, this method waits indefinitely for the process to exit.
Otherwise, each server process is given `timeout` seconds to exit. If
a process do... | [
"Shuts",
"down",
"all",
"managed",
"servers",
".",
"If",
"`",
"hard",
"`",
"is",
"true",
"then",
"the",
"server",
"processes",
"will",
"be",
"killed",
"via",
"a",
"kill",
"signal",
"instead",
"of",
"the",
"standard",
"shutdown",
"http",
"request",
".",
"... | def shutdown(self, hard=False, timeout=None):
if hard:
def shutdown_server(server):
assert isinstance(server, Server), \
'[internal] server is not a Server: %r' % (server)
server.kill()
server.wait(timeout=timeout)
r... | [
"def",
"shutdown",
"(",
"self",
",",
"hard",
"=",
"False",
",",
"timeout",
"=",
"None",
")",
":",
"if",
"hard",
":",
"def",
"shutdown_server",
"(",
"server",
")",
":",
"assert",
"isinstance",
"(",
"server",
",",
"Server",
")",
",",
"'[internal] server is... | Shuts down all managed servers. | [
"Shuts",
"down",
"all",
"managed",
"servers",
"."
] | [
"'''\n Shuts down all managed servers.\n\n If `hard` is true, then the server processes will be killed via a kill\n signal instead of the standard shutdown http request. If `timeout` is\n omitted, this method waits indefinitely for the process to exit.\n Otherwise, each server pro... | [
{
"param": "self",
"type": null
},
{
"param": "hard",
"type": null
},
{
"param": "timeout",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "hard",
"type": null,
"docstring": null,
"docstring_tokens": [... |
e9704be925c7c1d6639f9c2fd81703eaf839825e | mrmansano/sublime-ycmd | plugin/server.py | [
"MIT"
] | Python | notify_enter | <not_specific> | def notify_enter(self, view, parse_file=True):
'''
Sends a notification to the ycmd server that the file for `view` has
been activated. This will create and cache file-specific identifiers.
If `parse_file` is true, an additional notification will be sent to
indicate that the fil... |
Sends a notification to the ycmd server that the file for `view` has
been activated. This will create and cache file-specific identifiers.
If `parse_file` is true, an additional notification will be sent to
indicate that the file should be parsed for identifiers. Otherwise,
thi... | Sends a notification to the ycmd server that the file for `view` has
been activated. This will create and cache file-specific identifiers.
If `parse_file` is true, an additional notification will be sent to
indicate that the file should be parsed for identifiers. Otherwise,
this step is skipped. This is optional, but ... | [
"Sends",
"a",
"notification",
"to",
"the",
"ycmd",
"server",
"that",
"the",
"file",
"for",
"`",
"view",
"`",
"has",
"been",
"activated",
".",
"This",
"will",
"create",
"and",
"cache",
"file",
"-",
"specific",
"identifiers",
".",
"If",
"`",
"parse_file",
... | def notify_enter(self, view, parse_file=True):
if not isinstance(view, View):
raise TypeError('view must be a View: %r' % (view))
request_params = view.generate_request_parameters()
if not request_params:
logger.debug('failed to generate request params, abort')
... | [
"def",
"notify_enter",
"(",
"self",
",",
"view",
",",
"parse_file",
"=",
"True",
")",
":",
"if",
"not",
"isinstance",
"(",
"view",
",",
"View",
")",
":",
"raise",
"TypeError",
"(",
"'view must be a View: %r'",
"%",
"(",
"view",
")",
")",
"request_params",
... | Sends a notification to the ycmd server that the file for `view` has
been activated. | [
"Sends",
"a",
"notification",
"to",
"the",
"ycmd",
"server",
"that",
"the",
"file",
"for",
"`",
"view",
"`",
"has",
"been",
"activated",
"."
] | [
"'''\n Sends a notification to the ycmd server that the file for `view` has\n been activated. This will create and cache file-specific identifiers.\n\n If `parse_file` is true, an additional notification will be sent to\n indicate that the file should be parsed for identifiers. Otherwise... | [
{
"param": "self",
"type": null
},
{
"param": "view",
"type": null
},
{
"param": "parse_file",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "view",
"type": null,
"docstring": null,
"docstring_tokens": [... |
e9704be925c7c1d6639f9c2fd81703eaf839825e | mrmansano/sublime-ycmd | plugin/server.py | [
"MIT"
] | Python | notify_exit | <not_specific> | def notify_exit(self, view):
'''
Sends a notification to the ycmd server that the file for `view` has
been deactivated. This will allow the server to release caches.
The actual request is sent asynchronously via a task pool, so this
won't block the caller.
'''
if... |
Sends a notification to the ycmd server that the file for `view` has
been deactivated. This will allow the server to release caches.
The actual request is sent asynchronously via a task pool, so this
won't block the caller.
| Sends a notification to the ycmd server that the file for `view` has
been deactivated. This will allow the server to release caches.
The actual request is sent asynchronously via a task pool, so this
won't block the caller. | [
"Sends",
"a",
"notification",
"to",
"the",
"ycmd",
"server",
"that",
"the",
"file",
"for",
"`",
"view",
"`",
"has",
"been",
"deactivated",
".",
"This",
"will",
"allow",
"the",
"server",
"to",
"release",
"caches",
".",
"The",
"actual",
"request",
"is",
"s... | def notify_exit(self, view):
if not isinstance(view, View):
raise TypeError('view must be a View: %r' % (view))
request_params = view.generate_request_parameters()
if not request_params:
logger.debug('failed to generate request params, abort')
return None
... | [
"def",
"notify_exit",
"(",
"self",
",",
"view",
")",
":",
"if",
"not",
"isinstance",
"(",
"view",
",",
"View",
")",
":",
"raise",
"TypeError",
"(",
"'view must be a View: %r'",
"%",
"(",
"view",
")",
")",
"request_params",
"=",
"view",
".",
"generate_reque... | Sends a notification to the ycmd server that the file for `view` has
been deactivated. | [
"Sends",
"a",
"notification",
"to",
"the",
"ycmd",
"server",
"that",
"the",
"file",
"for",
"`",
"view",
"`",
"has",
"been",
"deactivated",
"."
] | [
"'''\n Sends a notification to the ycmd server that the file for `view` has\n been deactivated. This will allow the server to release caches.\n\n The actual request is sent asynchronously via a task pool, so this\n won't block the caller.\n '''",
"# type: concurrent.futures.Futu... | [
{
"param": "self",
"type": null
},
{
"param": "view",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "view",
"type": null,
"docstring": null,
"docstring_tokens": [... |
e9704be925c7c1d6639f9c2fd81703eaf839825e | mrmansano/sublime-ycmd | plugin/server.py | [
"MIT"
] | Python | notify_use_extra_conf | <not_specific> | def notify_use_extra_conf(self, view, extra_conf_path, load=True):
'''
Sends a notification to the ycmd server that the extra configuration
file at `extra_conf_path` may be used.
If `load` is `True`, then the extra configuration file is loaded.
Otherwise, the server is notified ... |
Sends a notification to the ycmd server that the extra configuration
file at `extra_conf_path` may be used.
If `load` is `True`, then the extra configuration file is loaded.
Otherwise, the server is notified to ignore the file instead.
| Sends a notification to the ycmd server that the extra configuration
file at `extra_conf_path` may be used.
If `load` is `True`, then the extra configuration file is loaded.
Otherwise, the server is notified to ignore the file instead. | [
"Sends",
"a",
"notification",
"to",
"the",
"ycmd",
"server",
"that",
"the",
"extra",
"configuration",
"file",
"at",
"`",
"extra_conf_path",
"`",
"may",
"be",
"used",
".",
"If",
"`",
"load",
"`",
"is",
"`",
"True",
"`",
"then",
"the",
"extra",
"configurat... | def notify_use_extra_conf(self, view, extra_conf_path, load=True):
if not isinstance(extra_conf_path, str):
raise TypeError(
'extra conf path must be a str: %r' % (extra_conf_path)
)
server = self.get(view)
if not server:
logger.warning('failed... | [
"def",
"notify_use_extra_conf",
"(",
"self",
",",
"view",
",",
"extra_conf_path",
",",
"load",
"=",
"True",
")",
":",
"if",
"not",
"isinstance",
"(",
"extra_conf_path",
",",
"str",
")",
":",
"raise",
"TypeError",
"(",
"'extra conf path must be a str: %r'",
"%",
... | Sends a notification to the ycmd server that the extra configuration
file at `extra_conf_path` may be used. | [
"Sends",
"a",
"notification",
"to",
"the",
"ycmd",
"server",
"that",
"the",
"extra",
"configuration",
"file",
"at",
"`",
"extra_conf_path",
"`",
"may",
"be",
"used",
"."
] | [
"'''\n Sends a notification to the ycmd server that the extra configuration\n file at `extra_conf_path` may be used.\n\n If `load` is `True`, then the extra configuration file is loaded.\n Otherwise, the server is notified to ignore the file instead.\n '''",
"# type: concurrent.... | [
{
"param": "self",
"type": null
},
{
"param": "view",
"type": null
},
{
"param": "extra_conf_path",
"type": null
},
{
"param": "load",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "view",
"type": null,
"docstring": null,
"docstring_tokens": [... |
e9704be925c7c1d6639f9c2fd81703eaf839825e | mrmansano/sublime-ycmd | plugin/server.py | [
"MIT"
] | Python | _lookup_server | <not_specific> | def _lookup_server(self, view):
'''
Looks up an available server for the given `view`. This calculation is
based on whether or not a server exists with a working directory
suitable for use with the underlying file.
If no server is available, this returns `None`.
'''
... |
Looks up an available server for the given `view`. This calculation is
based on whether or not a server exists with a working directory
suitable for use with the underlying file.
If no server is available, this returns `None`.
| Looks up an available server for the given `view`. This calculation is
based on whether or not a server exists with a working directory
suitable for use with the underlying file.
If no server is available, this returns `None`. | [
"Looks",
"up",
"an",
"available",
"server",
"for",
"the",
"given",
"`",
"view",
"`",
".",
"This",
"calculation",
"is",
"based",
"on",
"whether",
"or",
"not",
"a",
"server",
"exists",
"with",
"a",
"working",
"directory",
"suitable",
"for",
"use",
"with",
... | def _lookup_server(self, view):
view_id = get_view_id(view)
if view_id is None:
logger.error('failed to get view id for view: %r', view)
raise TypeError('view must be a View: %r' % (view))
if view_id in self._view_id_to_server:
server = self._view_id_to_server... | [
"def",
"_lookup_server",
"(",
"self",
",",
"view",
")",
":",
"view_id",
"=",
"get_view_id",
"(",
"view",
")",
"if",
"view_id",
"is",
"None",
":",
"logger",
".",
"error",
"(",
"'failed to get view id for view: %r'",
",",
"view",
")",
"raise",
"TypeError",
"("... | Looks up an available server for the given `view`. | [
"Looks",
"up",
"an",
"available",
"server",
"for",
"the",
"given",
"`",
"view",
"`",
"."
] | [
"'''\n Looks up an available server for the given `view`. This calculation is\n based on whether or not a server exists with a working directory\n suitable for use with the underlying file.\n\n If no server is available, this returns `None`.\n '''",
"# check each cache, from fas... | [
{
"param": "self",
"type": null
},
{
"param": "view",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "view",
"type": null,
"docstring": null,
"docstring_tokens": [... |
91bbfd6f184284538ccdd89762029397e08712ad | mrmansano/sublime-ycmd | lib/util/fs.py | [
"MIT"
] | Python | is_directory | <not_specific> | def is_directory(path):
'''
Returns true if the supplied `path` refers to a valid directory, and
false otherwise.
'''
if not isinstance(path, str):
raise TypeError('path must be a str: %r' % (path))
return os.path.exists(path) and os.path.isdir(path) |
Returns true if the supplied `path` refers to a valid directory, and
false otherwise.
| Returns true if the supplied `path` refers to a valid directory, and
false otherwise. | [
"Returns",
"true",
"if",
"the",
"supplied",
"`",
"path",
"`",
"refers",
"to",
"a",
"valid",
"directory",
"and",
"false",
"otherwise",
"."
] | def is_directory(path):
if not isinstance(path, str):
raise TypeError('path must be a str: %r' % (path))
return os.path.exists(path) and os.path.isdir(path) | [
"def",
"is_directory",
"(",
"path",
")",
":",
"if",
"not",
"isinstance",
"(",
"path",
",",
"str",
")",
":",
"raise",
"TypeError",
"(",
"'path must be a str: %r'",
"%",
"(",
"path",
")",
")",
"return",
"os",
".",
"path",
".",
"exists",
"(",
"path",
")",... | Returns true if the supplied `path` refers to a valid directory, and
false otherwise. | [
"Returns",
"true",
"if",
"the",
"supplied",
"`",
"path",
"`",
"refers",
"to",
"a",
"valid",
"directory",
"and",
"false",
"otherwise",
"."
] | [
"'''\n Returns true if the supplied `path` refers to a valid directory, and\n false otherwise.\n '''"
] | [
{
"param": "path",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "path",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
91bbfd6f184284538ccdd89762029397e08712ad | mrmansano/sublime-ycmd | lib/util/fs.py | [
"MIT"
] | Python | is_file | <not_specific> | def is_file(path):
'''
Returns true if the supplied `path` refers to a valid plain file, and
false otherwise.
'''
if not isinstance(path, str):
raise TypeError('path must be a str: %r' % (path))
return os.path.exists(path) and os.path.isfile(path) |
Returns true if the supplied `path` refers to a valid plain file, and
false otherwise.
| Returns true if the supplied `path` refers to a valid plain file, and
false otherwise. | [
"Returns",
"true",
"if",
"the",
"supplied",
"`",
"path",
"`",
"refers",
"to",
"a",
"valid",
"plain",
"file",
"and",
"false",
"otherwise",
"."
] | def is_file(path):
if not isinstance(path, str):
raise TypeError('path must be a str: %r' % (path))
return os.path.exists(path) and os.path.isfile(path) | [
"def",
"is_file",
"(",
"path",
")",
":",
"if",
"not",
"isinstance",
"(",
"path",
",",
"str",
")",
":",
"raise",
"TypeError",
"(",
"'path must be a str: %r'",
"%",
"(",
"path",
")",
")",
"return",
"os",
".",
"path",
".",
"exists",
"(",
"path",
")",
"a... | Returns true if the supplied `path` refers to a valid plain file, and
false otherwise. | [
"Returns",
"true",
"if",
"the",
"supplied",
"`",
"path",
"`",
"refers",
"to",
"a",
"valid",
"plain",
"file",
"and",
"false",
"otherwise",
"."
] | [
"'''\n Returns true if the supplied `path` refers to a valid plain file, and\n false otherwise.\n '''"
] | [
{
"param": "path",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "path",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
91bbfd6f184284538ccdd89762029397e08712ad | mrmansano/sublime-ycmd | lib/util/fs.py | [
"MIT"
] | Python | load_json_file | <not_specific> | def load_json_file(path, encoding='utf-8'):
'''
Returns a `dict` generated by reading the file at `path`, and then parsing
it as JSON. This will throw if the file does not exist, cannot be read, or
cannot be parsed as JSON.
The `encoding` parameter is used when initially reading the file.
'''
... |
Returns a `dict` generated by reading the file at `path`, and then parsing
it as JSON. This will throw if the file does not exist, cannot be read, or
cannot be parsed as JSON.
The `encoding` parameter is used when initially reading the file.
| Returns a `dict` generated by reading the file at `path`, and then parsing
it as JSON. This will throw if the file does not exist, cannot be read, or
cannot be parsed as JSON.
The `encoding` parameter is used when initially reading the file. | [
"Returns",
"a",
"`",
"dict",
"`",
"generated",
"by",
"reading",
"the",
"file",
"at",
"`",
"path",
"`",
"and",
"then",
"parsing",
"it",
"as",
"JSON",
".",
"This",
"will",
"throw",
"if",
"the",
"file",
"does",
"not",
"exist",
"cannot",
"be",
"read",
"o... | def load_json_file(path, encoding='utf-8'):
if not isinstance(path, str):
raise TypeError('path must be a str: %r' % (path))
if not isinstance(encoding, str):
raise TypeError('encoding must be a str: %r' % (encoding))
path = resolve_env(path)
if not is_file(path):
logger.warning(... | [
"def",
"load_json_file",
"(",
"path",
",",
"encoding",
"=",
"'utf-8'",
")",
":",
"if",
"not",
"isinstance",
"(",
"path",
",",
"str",
")",
":",
"raise",
"TypeError",
"(",
"'path must be a str: %r'",
"%",
"(",
"path",
")",
")",
"if",
"not",
"isinstance",
"... | Returns a `dict` generated by reading the file at `path`, and then parsing
it as JSON. | [
"Returns",
"a",
"`",
"dict",
"`",
"generated",
"by",
"reading",
"the",
"file",
"at",
"`",
"path",
"`",
"and",
"then",
"parsing",
"it",
"as",
"JSON",
"."
] | [
"'''\n Returns a `dict` generated by reading the file at `path`, and then parsing\n it as JSON. This will throw if the file does not exist, cannot be read, or\n cannot be parsed as JSON.\n The `encoding` parameter is used when initially reading the file.\n '''",
"# but fall through and try anyway"
... | [
{
"param": "path",
"type": null
},
{
"param": "encoding",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "path",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "encoding",
"type": null,
"docstring": null,
"docstring_tokens... |
91bbfd6f184284538ccdd89762029397e08712ad | mrmansano/sublime-ycmd | lib/util/fs.py | [
"MIT"
] | Python | save_json_file | null | def save_json_file(fp, data, encoding='utf-8'):
'''
Serializes and writes out `data` to `fp`. The data should be provided as
a `dict`, and will be serialized to a JSON string. The `fp` parameter
should support a `write` method.
The `encoding` parameter is used when encoding the serialized data.
... |
Serializes and writes out `data` to `fp`. The data should be provided as
a `dict`, and will be serialized to a JSON string. The `fp` parameter
should support a `write` method.
The `encoding` parameter is used when encoding the serialized data.
| Serializes and writes out `data` to `fp`. The data should be provided as
a `dict`, and will be serialized to a JSON string. The `fp` parameter
should support a `write` method.
The `encoding` parameter is used when encoding the serialized data. | [
"Serializes",
"and",
"writes",
"out",
"`",
"data",
"`",
"to",
"`",
"fp",
"`",
".",
"The",
"data",
"should",
"be",
"provided",
"as",
"a",
"`",
"dict",
"`",
"and",
"will",
"be",
"serialized",
"to",
"a",
"JSON",
"string",
".",
"The",
"`",
"fp",
"`",
... | def save_json_file(fp, data, encoding='utf-8'):
json_str = json.dumps(data)
json_bytes = json_str.encode(encoding=encoding)
fp.write(json_bytes) | [
"def",
"save_json_file",
"(",
"fp",
",",
"data",
",",
"encoding",
"=",
"'utf-8'",
")",
":",
"json_str",
"=",
"json",
".",
"dumps",
"(",
"data",
")",
"json_bytes",
"=",
"json_str",
".",
"encode",
"(",
"encoding",
"=",
"encoding",
")",
"fp",
".",
"write"... | Serializes and writes out `data` to `fp`. | [
"Serializes",
"and",
"writes",
"out",
"`",
"data",
"`",
"to",
"`",
"fp",
"`",
"."
] | [
"'''\n Serializes and writes out `data` to `fp`. The data should be provided as\n a `dict`, and will be serialized to a JSON string. The `fp` parameter\n should support a `write` method.\n The `encoding` parameter is used when encoding the serialized data.\n '''"
] | [
{
"param": "fp",
"type": null
},
{
"param": "data",
"type": null
},
{
"param": "encoding",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "fp",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "data",
"type": null,
"docstring": null,
"docstring_tokens": [],... |
91bbfd6f184284538ccdd89762029397e08712ad | mrmansano/sublime-ycmd | lib/util/fs.py | [
"MIT"
] | Python | resolve_abspath | <not_specific> | def resolve_abspath(path, start=None):
'''
Resolves `path` to an absolute path. If the path is already an absolute
path, it is returned as-is. Otherwise, it is joined to the `start` path,
which is assumed to be an absolute path.
If `start` is not provided, the current working directory is used.
... |
Resolves `path` to an absolute path. If the path is already an absolute
path, it is returned as-is. Otherwise, it is joined to the `start` path,
which is assumed to be an absolute path.
If `start` is not provided, the current working directory is used.
| Resolves `path` to an absolute path. If the path is already an absolute
path, it is returned as-is. Otherwise, it is joined to the `start` path,
which is assumed to be an absolute path.
If `start` is not provided, the current working directory is used. | [
"Resolves",
"`",
"path",
"`",
"to",
"an",
"absolute",
"path",
".",
"If",
"the",
"path",
"is",
"already",
"an",
"absolute",
"path",
"it",
"is",
"returned",
"as",
"-",
"is",
".",
"Otherwise",
"it",
"is",
"joined",
"to",
"the",
"`",
"start",
"`",
"path"... | def resolve_abspath(path, start=None):
if not isinstance(path, str):
raise TypeError('path must be a str: %r' % (path))
path = resolve_env(path)
if os.path.isabs(path):
logger.debug('path is already absolute: %s', path)
return path
logger.debug('path is not absolute, need to reso... | [
"def",
"resolve_abspath",
"(",
"path",
",",
"start",
"=",
"None",
")",
":",
"if",
"not",
"isinstance",
"(",
"path",
",",
"str",
")",
":",
"raise",
"TypeError",
"(",
"'path must be a str: %r'",
"%",
"(",
"path",
")",
")",
"path",
"=",
"resolve_env",
"(",
... | Resolves `path` to an absolute path. | [
"Resolves",
"`",
"path",
"`",
"to",
"an",
"absolute",
"path",
"."
] | [
"'''\n Resolves `path` to an absolute path. If the path is already an absolute\n path, it is returned as-is. Otherwise, it is joined to the `start` path,\n which is assumed to be an absolute path.\n If `start` is not provided, the current working directory is used.\n '''",
"# attempt to expand thin... | [
{
"param": "path",
"type": null
},
{
"param": "start",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "path",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "start",
"type": null,
"docstring": null,
"docstring_tokens": ... |
91bbfd6f184284538ccdd89762029397e08712ad | mrmansano/sublime-ycmd | lib/util/fs.py | [
"MIT"
] | Python | resolve_binary_path | <not_specific> | def resolve_binary_path(binpath, workingdir=None, *pathdirs):
'''
Resolves the binary path `binpath` to an absolute path based on the
supplied parameters. The following rules are applied until a path is found:
1. If it is already an absolute path, it is returned as-is.
2. If a file exists at the l... |
Resolves the binary path `binpath` to an absolute path based on the
supplied parameters. The following rules are applied until a path is found:
1. If it is already an absolute path, it is returned as-is.
2. If a file exists at the location relative to the working directory,
then the absolute ... | Resolves the binary path `binpath` to an absolute path based on the
supplied parameters. The following rules are applied until a path is found:
1. If it is already an absolute path, it is returned as-is.
2. If a file exists at the location relative to the working directory,
then the absolute path to that file is retu... | [
"Resolves",
"the",
"binary",
"path",
"`",
"binpath",
"`",
"to",
"an",
"absolute",
"path",
"based",
"on",
"the",
"supplied",
"parameters",
".",
"The",
"following",
"rules",
"are",
"applied",
"until",
"a",
"path",
"is",
"found",
":",
"1",
".",
"If",
"it",
... | def resolve_binary_path(binpath, workingdir=None, *pathdirs):
if not isinstance(binpath, str):
raise TypeError('binpath must be a str: %r' % binpath)
if os.path.isabs(binpath):
logger.debug(
'binpath already absolute, returning as-is: %r', binpath
)
return binpath
... | [
"def",
"resolve_binary_path",
"(",
"binpath",
",",
"workingdir",
"=",
"None",
",",
"*",
"pathdirs",
")",
":",
"if",
"not",
"isinstance",
"(",
"binpath",
",",
"str",
")",
":",
"raise",
"TypeError",
"(",
"'binpath must be a str: %r'",
"%",
"binpath",
")",
"if"... | Resolves the binary path `binpath` to an absolute path based on the
supplied parameters. | [
"Resolves",
"the",
"binary",
"path",
"`",
"binpath",
"`",
"to",
"an",
"absolute",
"path",
"based",
"on",
"the",
"supplied",
"parameters",
"."
] | [
"'''\n Resolves the binary path `binpath` to an absolute path based on the\n supplied parameters. The following rules are applied until a path is found:\n 1. If it is already an absolute path, it is returned as-is.\n 2. If a file exists at the location relative to the working directory,\n then ... | [
{
"param": "binpath",
"type": null
},
{
"param": "workingdir",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "binpath",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "workingdir",
"type": null,
"docstring": null,
"docstring_t... |
91bbfd6f184284538ccdd89762029397e08712ad | mrmansano/sublime-ycmd | lib/util/fs.py | [
"MIT"
] | Python | generate_binpaths | null | def generate_binpaths():
'''
Provides an iterator for all possible absolute locations for binpath.
Platform dependent suffixes are automatically added, if applicable.
'''
should_add_win_exts = os.name == 'nt'
win_exts = ['.exe', '.cmd', '.bat']
for pathdir in iter... |
Provides an iterator for all possible absolute locations for binpath.
Platform dependent suffixes are automatically added, if applicable.
| Provides an iterator for all possible absolute locations for binpath.
Platform dependent suffixes are automatically added, if applicable. | [
"Provides",
"an",
"iterator",
"for",
"all",
"possible",
"absolute",
"locations",
"for",
"binpath",
".",
"Platform",
"dependent",
"suffixes",
"are",
"automatically",
"added",
"if",
"applicable",
"."
] | def generate_binpaths():
should_add_win_exts = os.name == 'nt'
win_exts = ['.exe', '.cmd', '.bat']
for pathdir in itertools.chain([workingdir], pathdirs):
assert isinstance(pathdir, str), \
'[internal] pathdir is not a str: %r' % pathdir
yield os.path.join... | [
"def",
"generate_binpaths",
"(",
")",
":",
"should_add_win_exts",
"=",
"os",
".",
"name",
"==",
"'nt'",
"win_exts",
"=",
"[",
"'.exe'",
",",
"'.cmd'",
",",
"'.bat'",
"]",
"for",
"pathdir",
"in",
"itertools",
".",
"chain",
"(",
"[",
"workingdir",
"]",
","... | Provides an iterator for all possible absolute locations for binpath. | [
"Provides",
"an",
"iterator",
"for",
"all",
"possible",
"absolute",
"locations",
"for",
"binpath",
"."
] | [
"'''\n Provides an iterator for all possible absolute locations for binpath.\n Platform dependent suffixes are automatically added, if applicable.\n '''"
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
91bbfd6f184284538ccdd89762029397e08712ad | mrmansano/sublime-ycmd | lib/util/fs.py | [
"MIT"
] | Python | default_python_binary_path | <not_specific> | def default_python_binary_path():
'''
Generates and returns a path to the python executable, as resolved by
`resolve_binary_path`. This will automatically prefer pythonw in Windows.
'''
if os.name == 'nt':
pythonw_binpath = resolve_binary_path('pythonw')
if pythonw_binpath:
... |
Generates and returns a path to the python executable, as resolved by
`resolve_binary_path`. This will automatically prefer pythonw in Windows.
| Generates and returns a path to the python executable, as resolved by
`resolve_binary_path`. This will automatically prefer pythonw in Windows. | [
"Generates",
"and",
"returns",
"a",
"path",
"to",
"the",
"python",
"executable",
"as",
"resolved",
"by",
"`",
"resolve_binary_path",
"`",
".",
"This",
"will",
"automatically",
"prefer",
"pythonw",
"in",
"Windows",
"."
] | def default_python_binary_path():
if os.name == 'nt':
pythonw_binpath = resolve_binary_path('pythonw')
if pythonw_binpath:
return pythonw_binpath
python_binpath = resolve_binary_path('python')
if python_binpath:
return python_binpath
return 'python' | [
"def",
"default_python_binary_path",
"(",
")",
":",
"if",
"os",
".",
"name",
"==",
"'nt'",
":",
"pythonw_binpath",
"=",
"resolve_binary_path",
"(",
"'pythonw'",
")",
"if",
"pythonw_binpath",
":",
"return",
"pythonw_binpath",
"python_binpath",
"=",
"resolve_binary_pa... | Generates and returns a path to the python executable, as resolved by
`resolve_binary_path`. | [
"Generates",
"and",
"returns",
"a",
"path",
"to",
"the",
"python",
"executable",
"as",
"resolved",
"by",
"`",
"resolve_binary_path",
"`",
"."
] | [
"'''\n Generates and returns a path to the python executable, as resolved by\n `resolve_binary_path`. This will automatically prefer pythonw in Windows.\n '''",
"# best effort:"
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
91bbfd6f184284538ccdd89762029397e08712ad | mrmansano/sublime-ycmd | lib/util/fs.py | [
"MIT"
] | Python | _split_path_components | <not_specific> | def _split_path_components(path):
'''
Splits `path` into a list of path components. The resulting list will start
with directory names, leading up to the basename of the path.
e.g. '/usr/lib' -> ['', usr', 'lib']
'C:\\Users' -> ['C:', 'Users']
'''
if not isinstance(path, str):
... |
Splits `path` into a list of path components. The resulting list will start
with directory names, leading up to the basename of the path.
e.g. '/usr/lib' -> ['', usr', 'lib']
'C:\\Users' -> ['C:', 'Users']
| Splits `path` into a list of path components. The resulting list will start
with directory names, leading up to the basename of the path. | [
"Splits",
"`",
"path",
"`",
"into",
"a",
"list",
"of",
"path",
"components",
".",
"The",
"resulting",
"list",
"will",
"start",
"with",
"directory",
"names",
"leading",
"up",
"to",
"the",
"basename",
"of",
"the",
"path",
"."
] | def _split_path_components(path):
if not isinstance(path, str):
raise TypeError('path must be a str: %r' % (path))
primary_dirsep = os.sep
secondary_dirsep = os.altsep
if not secondary_dirsep:
return path.split(primary_dirsep)
def _iter_components(path=path):
current_path = p... | [
"def",
"_split_path_components",
"(",
"path",
")",
":",
"if",
"not",
"isinstance",
"(",
"path",
",",
"str",
")",
":",
"raise",
"TypeError",
"(",
"'path must be a str: %r'",
"%",
"(",
"path",
")",
")",
"primary_dirsep",
"=",
"os",
".",
"sep",
"secondary_dirse... | Splits `path` into a list of path components. | [
"Splits",
"`",
"path",
"`",
"into",
"a",
"list",
"of",
"path",
"components",
"."
] | [
"'''\n Splits `path` into a list of path components. The resulting list will start\n with directory names, leading up to the basename of the path.\n e.g. '/usr/lib' -> ['', usr', 'lib']\n 'C:\\\\Users' -> ['C:', 'Users']\n '''",
"# easy case, only one directory separator, so split on it"... | [
{
"param": "path",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "path",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
91bbfd6f184284538ccdd89762029397e08712ad | mrmansano/sublime-ycmd | lib/util/fs.py | [
"MIT"
] | Python | _commonpath_polyfill | <not_specific> | def _commonpath_polyfill(paths):
'''
Polyfill for `os.path.commonpath` (not available in Python 3.3).
This method returns the common ancestor between all the given `paths`.
Implementation note:
This works by splitting the paths using directory separators, and then
comparing each portion from le... |
Polyfill for `os.path.commonpath` (not available in Python 3.3).
This method returns the common ancestor between all the given `paths`.
Implementation note:
This works by splitting the paths using directory separators, and then
comparing each portion from left to right until a mismatch is found.
... |
Implementation note:
This works by splitting the paths using directory separators, and then
comparing each portion from left to right until a mismatch is found.
This calls `os.path.commonprefix`, which doesn't necessarily result in a
valid path. To get the valid path from it, we need to ensure that the
string ends in... | [
"Implementation",
"note",
":",
"This",
"works",
"by",
"splitting",
"the",
"paths",
"using",
"directory",
"separators",
"and",
"then",
"comparing",
"each",
"portion",
"from",
"left",
"to",
"right",
"until",
"a",
"mismatch",
"is",
"found",
".",
"This",
"calls",
... | def _commonpath_polyfill(paths):
if not paths:
raise ValueError('paths are invalid: %r' % (paths))
if len(paths) == 1:
first_path = paths[0]
logger.debug('only one path, returning it: %s', first_path)
return first_path
path_components = [_split_path_components(path) for path ... | [
"def",
"_commonpath_polyfill",
"(",
"paths",
")",
":",
"if",
"not",
"paths",
":",
"raise",
"ValueError",
"(",
"'paths are invalid: %r'",
"%",
"(",
"paths",
")",
")",
"if",
"len",
"(",
"paths",
")",
"==",
"1",
":",
"first_path",
"=",
"paths",
"[",
"0",
... | Polyfill for `os.path.commonpath` (not available in Python 3.3). | [
"Polyfill",
"for",
"`",
"os",
".",
"path",
".",
"commonpath",
"`",
"(",
"not",
"available",
"in",
"Python",
"3",
".",
"3",
")",
"."
] | [
"'''\n Polyfill for `os.path.commonpath` (not available in Python 3.3).\n This method returns the common ancestor between all the given `paths`.\n\n Implementation note:\n This works by splitting the paths using directory separators, and then\n comparing each portion from left to right until a mismat... | [
{
"param": "paths",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "paths",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
e570ca78aaaa1562c4045b2858791525e3b9f2b5 | mrmansano/sublime-ycmd | tests/task/simulate.py | [
"MIT"
] | Python | process_task_pool | <not_specific> | def process_task_pool(pool, max_wait_time=5, sleep_interval=1):
'''
Runs the provided task `Pool` until all tasks have finished.
The `max_wait_time` indicates the (minimum) amount of seconds that must
pass until an exception is raised. If set to `0`, no timeout will occur.
This will attempt to rec... |
Runs the provided task `Pool` until all tasks have finished.
The `max_wait_time` indicates the (minimum) amount of seconds that must
pass until an exception is raised. If set to `0`, no timeout will occur.
This will attempt to recover from potential pitfalls (i.e. unintended
behaviour), so it hop... | Runs the provided task `Pool` until all tasks have finished.
The `max_wait_time` indicates the (minimum) amount of seconds that must
pass until an exception is raised. If set to `0`, no timeout will occur.
This will attempt to recover from potential pitfalls , so it hopefully won't block indefinitely.
Raises a `Timeo... | [
"Runs",
"the",
"provided",
"task",
"`",
"Pool",
"`",
"until",
"all",
"tasks",
"have",
"finished",
".",
"The",
"`",
"max_wait_time",
"`",
"indicates",
"the",
"(",
"minimum",
")",
"amount",
"of",
"seconds",
"that",
"must",
"pass",
"until",
"an",
"exception",... | def process_task_pool(pool, max_wait_time=5, sleep_interval=1):
if not isinstance(max_wait_time, (int, float)):
raise TypeError('max wait time must be a number: %r' % (max_wait_time))
if not isinstance(pool, Pool):
raise TypeError('task pool must be a Pool: %r' % (pool))
no_timeout = (max_wa... | [
"def",
"process_task_pool",
"(",
"pool",
",",
"max_wait_time",
"=",
"5",
",",
"sleep_interval",
"=",
"1",
")",
":",
"if",
"not",
"isinstance",
"(",
"max_wait_time",
",",
"(",
"int",
",",
"float",
")",
")",
":",
"raise",
"TypeError",
"(",
"'max wait time mu... | Runs the provided task `Pool` until all tasks have finished. | [
"Runs",
"the",
"provided",
"task",
"`",
"Pool",
"`",
"until",
"all",
"tasks",
"have",
"finished",
"."
] | [
"'''\n Runs the provided task `Pool` until all tasks have finished.\n\n The `max_wait_time` indicates the (minimum) amount of seconds that must\n pass until an exception is raised. If set to `0`, no timeout will occur.\n\n This will attempt to recover from potential pitfalls (i.e. unintended\n behavi... | [
{
"param": "pool",
"type": null
},
{
"param": "max_wait_time",
"type": null
},
{
"param": "sleep_interval",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "pool",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "max_wait_time",
"type": null,
"docstring": null,
"docstring_t... |
e570ca78aaaa1562c4045b2858791525e3b9f2b5 | mrmansano/sublime-ycmd | tests/task/simulate.py | [
"MIT"
] | Python | stop_task_pool | <not_specific> | def stop_task_pool(pool, max_wait_time=5, sleep_interval=1):
'''
Shuts down the provided task `Pool` and waits for the workers to exit.
The `max_wait_time` and `sleep_interval` parameters work the same as they
do in `process_task_pool`.
'''
if not isinstance(max_wait_time, (int, float)):
... |
Shuts down the provided task `Pool` and waits for the workers to exit.
The `max_wait_time` and `sleep_interval` parameters work the same as they
do in `process_task_pool`.
| Shuts down the provided task `Pool` and waits for the workers to exit. | [
"Shuts",
"down",
"the",
"provided",
"task",
"`",
"Pool",
"`",
"and",
"waits",
"for",
"the",
"workers",
"to",
"exit",
"."
] | def stop_task_pool(pool, max_wait_time=5, sleep_interval=1):
if not isinstance(max_wait_time, (int, float)):
raise TypeError('max wait time must be a number: %r' % (max_wait_time))
if not isinstance(pool, Pool):
raise TypeError('task pool must be a Pool: %r' % (pool))
no_timeout = (max_wait_... | [
"def",
"stop_task_pool",
"(",
"pool",
",",
"max_wait_time",
"=",
"5",
",",
"sleep_interval",
"=",
"1",
")",
":",
"if",
"not",
"isinstance",
"(",
"max_wait_time",
",",
"(",
"int",
",",
"float",
")",
")",
":",
"raise",
"TypeError",
"(",
"'max wait time must ... | Shuts down the provided task `Pool` and waits for the workers to exit. | [
"Shuts",
"down",
"the",
"provided",
"task",
"`",
"Pool",
"`",
"and",
"waits",
"for",
"the",
"workers",
"to",
"exit",
"."
] | [
"'''\n Shuts down the provided task `Pool` and waits for the workers to exit.\n\n The `max_wait_time` and `sleep_interval` parameters work the same as they\n do in `process_task_pool`.\n '''",
"# not the most elegant solution, but fairly reliable"
] | [
{
"param": "pool",
"type": null
},
{
"param": "max_wait_time",
"type": null
},
{
"param": "sleep_interval",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "pool",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "max_wait_time",
"type": null,
"docstring": null,
"docstring_t... |
a2b65556a5468e97305a72eb0b6fdf673d3d55af | mrmansano/sublime-ycmd | plugin/log.py | [
"MIT"
] | Python | configure_logging | null | def configure_logging(log_level=None, log_file=None):
'''
Configures the logging module (or plugin-specific root logger) to log at
the given `log_level` and write log output to file `log_file`. Formatters,
handlers, and filters are added to prettify the logging output.
If `log_level` is not provided... |
Configures the logging module (or plugin-specific root logger) to log at
the given `log_level` and write log output to file `log_file`. Formatters,
handlers, and filters are added to prettify the logging output.
If `log_level` is not provided, logging output will be silenced. Otherwise,
it should b... | Configures the logging module (or plugin-specific root logger) to log at
the given `log_level` and write log output to file `log_file`. Formatters,
handlers, and filters are added to prettify the logging output.
If `log_level` is not provided, logging output will be silenced. Otherwise,
it should be one of the logging ... | [
"Configures",
"the",
"logging",
"module",
"(",
"or",
"plugin",
"-",
"specific",
"root",
"logger",
")",
"to",
"log",
"at",
"the",
"given",
"`",
"log_level",
"`",
"and",
"write",
"log",
"output",
"to",
"file",
"`",
"log_file",
"`",
".",
"Formatters",
"hand... | def configure_logging(log_level=None, log_file=None):
if isinstance(log_level, str):
log_level = log_level_str_to_enum(log_level)
logger_instance = logging.getLogger('sublime-ycmd')
if log_level is None:
logger_instance.setLevel(logging.NOTSET)
else:
logger_instance.setLevel(log_... | [
"def",
"configure_logging",
"(",
"log_level",
"=",
"None",
",",
"log_file",
"=",
"None",
")",
":",
"if",
"isinstance",
"(",
"log_level",
",",
"str",
")",
":",
"log_level",
"=",
"log_level_str_to_enum",
"(",
"log_level",
")",
"logger_instance",
"=",
"logging",
... | Configures the logging module (or plugin-specific root logger) to log at
the given `log_level` and write log output to file `log_file`. | [
"Configures",
"the",
"logging",
"module",
"(",
"or",
"plugin",
"-",
"specific",
"root",
"logger",
")",
"to",
"log",
"at",
"the",
"given",
"`",
"log_level",
"`",
"and",
"write",
"log",
"output",
"to",
"file",
"`",
"log_file",
"`",
"."
] | [
"'''\n Configures the logging module (or plugin-specific root logger) to log at\n the given `log_level` and write log output to file `log_file`. Formatters,\n handlers, and filters are added to prettify the logging output.\n If `log_level` is not provided, logging output will be silenced. Otherwise,\n ... | [
{
"param": "log_level",
"type": null
},
{
"param": "log_file",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "log_level",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "log_file",
"type": null,
"docstring": null,
"docstring_t... |
fe9ca5fa44f23075187fca47011f03f30a924e35 | mrmansano/sublime-ycmd | lib/ycmd/server.py | [
"MIT"
] | Python | start | <not_specific> | def start(self, ycmd_root_directory,
ycmd_settings_path=None, working_directory=None,
python_binary_path=None, server_idle_suicide_seconds=None,
server_check_interval_seconds=None):
'''
Launches a ycmd server process with the given startup parameters. The
... |
Launches a ycmd server process with the given startup parameters. The
only required startup parameter is `ycmd_root_directory`. If it is a
`str`, then all other omitted parameters will be calculated with
respect to it. If it is an instance of `StartupParameters`, then all
other ... | Launches a ycmd server process with the given startup parameters. The
only required startup parameter is `ycmd_root_directory`. If it is a
`str`, then all other omitted parameters will be calculated with
respect to it. If it is an instance of `StartupParameters`, then all
other parameters will be ignored, as that class... | [
"Launches",
"a",
"ycmd",
"server",
"process",
"with",
"the",
"given",
"startup",
"parameters",
".",
"The",
"only",
"required",
"startup",
"parameter",
"is",
"`",
"ycmd_root_directory",
"`",
".",
"If",
"it",
"is",
"a",
"`",
"str",
"`",
"then",
"all",
"other... | def start(self, ycmd_root_directory,
ycmd_settings_path=None, working_directory=None,
python_binary_path=None, server_idle_suicide_seconds=None,
server_check_interval_seconds=None):
startup_parameters = to_startup_parameters(
ycmd_root_directory,
... | [
"def",
"start",
"(",
"self",
",",
"ycmd_root_directory",
",",
"ycmd_settings_path",
"=",
"None",
",",
"working_directory",
"=",
"None",
",",
"python_binary_path",
"=",
"None",
",",
"server_idle_suicide_seconds",
"=",
"None",
",",
"server_check_interval_seconds",
"=",
... | Launches a ycmd server process with the given startup parameters. | [
"Launches",
"a",
"ycmd",
"server",
"process",
"with",
"the",
"given",
"startup",
"parameters",
"."
] | [
"'''\n Launches a ycmd server process with the given startup parameters. The\n only required startup parameter is `ycmd_root_directory`. If it is a\n `str`, then all other omitted parameters will be calculated with\n respect to it. If it is an instance of `StartupParameters`, then all\n ... | [
{
"param": "self",
"type": null
},
{
"param": "ycmd_root_directory",
"type": null
},
{
"param": "ycmd_settings_path",
"type": null
},
{
"param": "working_directory",
"type": null
},
{
"param": "python_binary_path",
"type": null
},
{
"param": "server_id... | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "ycmd_root_directory",
"type": null,
"docstring": null,
"docst... |
fe9ca5fa44f23075187fca47011f03f30a924e35 | mrmansano/sublime-ycmd | lib/ycmd/server.py | [
"MIT"
] | Python | wait_for_status | <not_specific> | def wait_for_status(self, status=None, timeout=None):
'''
Waits for the server status to change.
If `status` is omitted, any status change will cause this to return.
Otherwise, if `status` is a `Server` constant, then this will block
until that status is reached. If `status` is ... |
Waits for the server status to change.
If `status` is omitted, any status change will cause this to return.
Otherwise, if `status` is a `Server` constant, then this will block
until that status is reached. If `status` is a `list` of constants,
then any status in that list will ... | Waits for the server status to change.
If `status` is omitted, any status change will cause this to return.
Otherwise, if `status` is a `Server` constant, then this will block
until that status is reached. If `status` is a `list` of constants,
then any status in that list will be awaited.
If `timeout` is omitted, this... | [
"Waits",
"for",
"the",
"server",
"status",
"to",
"change",
".",
"If",
"`",
"status",
"`",
"is",
"omitted",
"any",
"status",
"change",
"will",
"cause",
"this",
"to",
"return",
".",
"Otherwise",
"if",
"`",
"status",
"`",
"is",
"a",
"`",
"Server",
"`",
... | def wait_for_status(self, status=None, timeout=None):
def _wait_condition(status=status):
if status is None:
return True
if isinstance(status, (tuple, list)):
return self._status in status
return self._status == status
with self._lock:
... | [
"def",
"wait_for_status",
"(",
"self",
",",
"status",
"=",
"None",
",",
"timeout",
"=",
"None",
")",
":",
"def",
"_wait_condition",
"(",
"status",
"=",
"status",
")",
":",
"if",
"status",
"is",
"None",
":",
"return",
"True",
"if",
"isinstance",
"(",
"s... | Waits for the server status to change. | [
"Waits",
"for",
"the",
"server",
"status",
"to",
"change",
"."
] | [
"'''\n Waits for the server status to change.\n\n If `status` is omitted, any status change will cause this to return.\n Otherwise, if `status` is a `Server` constant, then this will block\n until that status is reached. If `status` is a `list` of constants,\n then any status in t... | [
{
"param": "self",
"type": null
},
{
"param": "status",
"type": null
},
{
"param": "timeout",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "status",
"type": null,
"docstring": null,
"docstring_tokens":... |
fe9ca5fa44f23075187fca47011f03f30a924e35 | mrmansano/sublime-ycmd | lib/ycmd/server.py | [
"MIT"
] | Python | _send_request | <not_specific> | def _send_request(self, handler,
request_params=None, method=None, timeout=None):
'''
Sends a request to the associated ycmd server and returns the response.
The `handler` should be one of the ycmd handler constants.
If `request_params` are supplied, it should be an... |
Sends a request to the associated ycmd server and returns the response.
The `handler` should be one of the ycmd handler constants.
If `request_params` are supplied, it should be an instance of
`RequestParameters`. Most handlers require these parameters, and ycmd
will reject any ... | Sends a request to the associated ycmd server and returns the response.
The `handler` should be one of the ycmd handler constants.
If `request_params` are supplied, it should be an instance of
`RequestParameters`. Most handlers require these parameters, and ycmd
will reject any requests that are missing them.
If `metho... | [
"Sends",
"a",
"request",
"to",
"the",
"associated",
"ycmd",
"server",
"and",
"returns",
"the",
"response",
".",
"The",
"`",
"handler",
"`",
"should",
"be",
"one",
"of",
"the",
"ycmd",
"handler",
"constants",
".",
"If",
"`",
"request_params",
"`",
"are",
... | def _send_request(self, handler,
request_params=None, method=None, timeout=None):
with self._lock:
if self._status == Server.STOPPING:
self._logger.warning(
'server is shutting down, cannot send request to it',
)
... | [
"def",
"_send_request",
"(",
"self",
",",
"handler",
",",
"request_params",
"=",
"None",
",",
"method",
"=",
"None",
",",
"timeout",
"=",
"None",
")",
":",
"with",
"self",
".",
"_lock",
":",
"if",
"self",
".",
"_status",
"==",
"Server",
".",
"STOPPING"... | Sends a request to the associated ycmd server and returns the response. | [
"Sends",
"a",
"request",
"to",
"the",
"associated",
"ycmd",
"server",
"and",
"returns",
"the",
"response",
"."
] | [
"'''\n Sends a request to the associated ycmd server and returns the response.\n The `handler` should be one of the ycmd handler constants.\n If `request_params` are supplied, it should be an instance of\n `RequestParameters`. Most handlers require these parameters, and ycmd\n wil... | [
{
"param": "self",
"type": null
},
{
"param": "handler",
"type": null
},
{
"param": "request_params",
"type": null
},
{
"param": "method",
"type": null
},
{
"param": "timeout",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "handler",
"type": null,
"docstring": null,
"docstring_tokens"... |
fe9ca5fa44f23075187fca47011f03f30a924e35 | mrmansano/sublime-ycmd | lib/ycmd/server.py | [
"MIT"
] | Python | pid | <not_specific> | def pid(self):
'''
Returns the server process ID if running, or `None` otherwise.
'''
if not self._process_handle:
return None
return self._process_handle.pid() |
Returns the server process ID if running, or `None` otherwise.
| Returns the server process ID if running, or `None` otherwise. | [
"Returns",
"the",
"server",
"process",
"ID",
"if",
"running",
"or",
"`",
"None",
"`",
"otherwise",
"."
] | def pid(self):
if not self._process_handle:
return None
return self._process_handle.pid() | [
"def",
"pid",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"_process_handle",
":",
"return",
"None",
"return",
"self",
".",
"_process_handle",
".",
"pid",
"(",
")"
] | Returns the server process ID if running, or `None` otherwise. | [
"Returns",
"the",
"server",
"process",
"ID",
"if",
"running",
"or",
"`",
"None",
"`",
"otherwise",
"."
] | [
"'''\n Returns the server process ID if running, or `None` otherwise.\n '''"
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
fe9ca5fa44f23075187fca47011f03f30a924e35 | mrmansano/sublime-ycmd | lib/ycmd/server.py | [
"MIT"
] | Python | stdout | <not_specific> | def stdout(self):
'''
Returns the handle to the ycmd process stdout output.
Operations on the file handle do not need to be locked, so this handle
can be safely returned to any callers.
'''
return self._stdout_log_handle |
Returns the handle to the ycmd process stdout output.
Operations on the file handle do not need to be locked, so this handle
can be safely returned to any callers.
| Returns the handle to the ycmd process stdout output.
Operations on the file handle do not need to be locked, so this handle
can be safely returned to any callers. | [
"Returns",
"the",
"handle",
"to",
"the",
"ycmd",
"process",
"stdout",
"output",
".",
"Operations",
"on",
"the",
"file",
"handle",
"do",
"not",
"need",
"to",
"be",
"locked",
"so",
"this",
"handle",
"can",
"be",
"safely",
"returned",
"to",
"any",
"callers",
... | def stdout(self):
return self._stdout_log_handle | [
"def",
"stdout",
"(",
"self",
")",
":",
"return",
"self",
".",
"_stdout_log_handle"
] | Returns the handle to the ycmd process stdout output. | [
"Returns",
"the",
"handle",
"to",
"the",
"ycmd",
"process",
"stdout",
"output",
"."
] | [
"'''\n Returns the handle to the ycmd process stdout output.\n\n Operations on the file handle do not need to be locked, so this handle\n can be safely returned to any callers.\n '''"
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
fe9ca5fa44f23075187fca47011f03f30a924e35 | mrmansano/sublime-ycmd | lib/ycmd/server.py | [
"MIT"
] | Python | stderr | <not_specific> | def stderr(self):
'''
Returns the handle to the ycmd process stderr output.
Like the stdout output, operations on it do not require the lock.
'''
return self._stderr_log_handle |
Returns the handle to the ycmd process stderr output.
Like the stdout output, operations on it do not require the lock.
| Returns the handle to the ycmd process stderr output.
Like the stdout output, operations on it do not require the lock. | [
"Returns",
"the",
"handle",
"to",
"the",
"ycmd",
"process",
"stderr",
"output",
".",
"Like",
"the",
"stdout",
"output",
"operations",
"on",
"it",
"do",
"not",
"require",
"the",
"lock",
"."
] | def stderr(self):
return self._stderr_log_handle | [
"def",
"stderr",
"(",
"self",
")",
":",
"return",
"self",
".",
"_stderr_log_handle"
] | Returns the handle to the ycmd process stderr output. | [
"Returns",
"the",
"handle",
"to",
"the",
"ycmd",
"process",
"stderr",
"output",
"."
] | [
"'''\n Returns the handle to the ycmd process stderr output.\n\n Like the stdout output, operations on it do not require the lock.\n '''"
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
4e01fdc2eafa9b065ed4def60b0152648e7bc097 | mrmansano/sublime-ycmd | syplugin.py | [
"MIT"
] | Python | on_change_settings | null | def on_change_settings(settings):
''' Callback, triggered when settings are loaded/modified. '''
logger.info('loaded settings: %s', settings)
state = get_plugin_state()
if state is None:
logger.critical('cannot reconfigure plugin, no plugin state exists')
else:
logger.debug('reconf... | Callback, triggered when settings are loaded/modified. | Callback, triggered when settings are loaded/modified. | [
"Callback",
"triggered",
"when",
"settings",
"are",
"loaded",
"/",
"modified",
"."
] | def on_change_settings(settings):
logger.info('loaded settings: %s', settings)
state = get_plugin_state()
if state is None:
logger.critical('cannot reconfigure plugin, no plugin state exists')
else:
logger.debug('reconfiguring plugin state')
state.configure(settings) | [
"def",
"on_change_settings",
"(",
"settings",
")",
":",
"logger",
".",
"info",
"(",
"'loaded settings: %s'",
",",
"settings",
")",
"state",
"=",
"get_plugin_state",
"(",
")",
"if",
"state",
"is",
"None",
":",
"logger",
".",
"critical",
"(",
"'cannot reconfigur... | Callback, triggered when settings are loaded/modified. | [
"Callback",
"triggered",
"when",
"settings",
"are",
"loaded",
"/",
"modified",
"."
] | [
"''' Callback, triggered when settings are loaded/modified. '''"
] | [
{
"param": "settings",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "settings",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
4e01fdc2eafa9b065ed4def60b0152648e7bc097 | mrmansano/sublime-ycmd | syplugin.py | [
"MIT"
] | Python | plugin_loaded | null | def plugin_loaded():
''' Callback, triggered when the plugin is loaded. '''
logger.info('initializing sublime-ycmd')
configure_logging(log_level=logging.CRITICAL)
reset_plugin_state()
logger.info('starting sublime-ycmd')
bind_on_change_settings(on_change_settings) | Callback, triggered when the plugin is loaded. | Callback, triggered when the plugin is loaded. | [
"Callback",
"triggered",
"when",
"the",
"plugin",
"is",
"loaded",
"."
] | def plugin_loaded():
logger.info('initializing sublime-ycmd')
configure_logging(log_level=logging.CRITICAL)
reset_plugin_state()
logger.info('starting sublime-ycmd')
bind_on_change_settings(on_change_settings) | [
"def",
"plugin_loaded",
"(",
")",
":",
"logger",
".",
"info",
"(",
"'initializing sublime-ycmd'",
")",
"configure_logging",
"(",
"log_level",
"=",
"logging",
".",
"CRITICAL",
")",
"reset_plugin_state",
"(",
")",
"logger",
".",
"info",
"(",
"'starting sublime-ycmd'... | Callback, triggered when the plugin is loaded. | [
"Callback",
"triggered",
"when",
"the",
"plugin",
"is",
"loaded",
"."
] | [
"''' Callback, triggered when the plugin is loaded. '''"
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
4e01fdc2eafa9b065ed4def60b0152648e7bc097 | mrmansano/sublime-ycmd | syplugin.py | [
"MIT"
] | Python | plugin_unloaded | null | def plugin_unloaded():
''' Callback, triggered when the plugin is unloaded. '''
logger.info('unloading sublime-ycmd')
reset_plugin_state()
logging.info('stopped sublime-ycmd') | Callback, triggered when the plugin is unloaded. | Callback, triggered when the plugin is unloaded. | [
"Callback",
"triggered",
"when",
"the",
"plugin",
"is",
"unloaded",
"."
] | def plugin_unloaded():
logger.info('unloading sublime-ycmd')
reset_plugin_state()
logging.info('stopped sublime-ycmd') | [
"def",
"plugin_unloaded",
"(",
")",
":",
"logger",
".",
"info",
"(",
"'unloading sublime-ycmd'",
")",
"reset_plugin_state",
"(",
")",
"logging",
".",
"info",
"(",
"'stopped sublime-ycmd'",
")"
] | Callback, triggered when the plugin is unloaded. | [
"Callback",
"triggered",
"when",
"the",
"plugin",
"is",
"unloaded",
"."
] | [
"''' Callback, triggered when the plugin is unloaded. '''"
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
4e01fdc2eafa9b065ed4def60b0152648e7bc097 | mrmansano/sublime-ycmd | syplugin.py | [
"MIT"
] | Python | main | null | def main():
''' Main function. Executed when this script is executed directly. '''
cli_argparser = base_cli_argparser(
description='sublime-ycmd plugin loader',
)
cli_args = cli_argparser.parse_args()
configure_logging(cli_args.log_level, cli_args.log_file)
logger.info('starting main fu... | Main function. Executed when this script is executed directly. | Main function. Executed when this script is executed directly. | [
"Main",
"function",
".",
"Executed",
"when",
"this",
"script",
"is",
"executed",
"directly",
"."
] | def main():
cli_argparser = base_cli_argparser(
description='sublime-ycmd plugin loader',
)
cli_args = cli_argparser.parse_args()
configure_logging(cli_args.log_level, cli_args.log_file)
logger.info('starting main function')
if _HAS_LOADED_ST:
logger.info('running in Sublime Text... | [
"def",
"main",
"(",
")",
":",
"cli_argparser",
"=",
"base_cli_argparser",
"(",
"description",
"=",
"'sublime-ycmd plugin loader'",
",",
")",
"cli_args",
"=",
"cli_argparser",
".",
"parse_args",
"(",
")",
"configure_logging",
"(",
"cli_args",
".",
"log_level",
",",... | Main function. | [
"Main",
"function",
"."
] | [
"''' Main function. Executed when this script is executed directly. '''"
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
ad8f2c1ef6d8354d9315813542ca32120774bdc3 | mrmansano/sublime-ycmd | lib/util/id.py | [
"MIT"
] | Python | generate_id | <not_specific> | def generate_id(prefix=None):
'''
Generates and returns a `str` id.
The id is generated by appending the `prefix` to a globally unique integer
counter. The counter is not specific to the prefix.
'''
if not isinstance(prefix, str):
raise TypeError('prefix must be a str: %r' % (prefix))
... |
Generates and returns a `str` id.
The id is generated by appending the `prefix` to a globally unique integer
counter. The counter is not specific to the prefix.
| Generates and returns a `str` id.
The id is generated by appending the `prefix` to a globally unique integer
counter. The counter is not specific to the prefix. | [
"Generates",
"and",
"returns",
"a",
"`",
"str",
"`",
"id",
".",
"The",
"id",
"is",
"generated",
"by",
"appending",
"the",
"`",
"prefix",
"`",
"to",
"a",
"globally",
"unique",
"integer",
"counter",
".",
"The",
"counter",
"is",
"not",
"specific",
"to",
"... | def generate_id(prefix=None):
if not isinstance(prefix, str):
raise TypeError('prefix must be a str: %r' % (prefix))
if prefix is None:
prefix = ''
current_count = _get_counter()
_increment_counter()
return '%s%d' % (prefix, current_count) | [
"def",
"generate_id",
"(",
"prefix",
"=",
"None",
")",
":",
"if",
"not",
"isinstance",
"(",
"prefix",
",",
"str",
")",
":",
"raise",
"TypeError",
"(",
"'prefix must be a str: %r'",
"%",
"(",
"prefix",
")",
")",
"if",
"prefix",
"is",
"None",
":",
"prefix"... | Generates and returns a `str` id. | [
"Generates",
"and",
"returns",
"a",
"`",
"str",
"`",
"id",
"."
] | [
"'''\n Generates and returns a `str` id.\n\n The id is generated by appending the `prefix` to a globally unique integer\n counter. The counter is not specific to the prefix.\n '''"
] | [
{
"param": "prefix",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "prefix",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
f7001373a7204c33b024b0c7595942d17d82aa97 | mrmansano/sublime-ycmd | lib/ycmd/start.py | [
"MIT"
] | Python | copy | <not_specific> | def copy(self):
'''
Creates a shallow-copy of the startup parameters.
'''
raw_attrs = [
'_ycmd_root_directory',
'_ycmd_settings_path',
'_working_directory',
'_python_binary_path',
'_server_idle_suicide_seconds',
'_se... |
Creates a shallow-copy of the startup parameters.
| Creates a shallow-copy of the startup parameters. | [
"Creates",
"a",
"shallow",
"-",
"copy",
"of",
"the",
"startup",
"parameters",
"."
] | def copy(self):
raw_attrs = [
'_ycmd_root_directory',
'_ycmd_settings_path',
'_working_directory',
'_python_binary_path',
'_server_idle_suicide_seconds',
'_server_check_interval_seconds',
'_log_level',
'_stdout_log_p... | [
"def",
"copy",
"(",
"self",
")",
":",
"raw_attrs",
"=",
"[",
"'_ycmd_root_directory'",
",",
"'_ycmd_settings_path'",
",",
"'_working_directory'",
",",
"'_python_binary_path'",
",",
"'_server_idle_suicide_seconds'",
",",
"'_server_check_interval_seconds'",
",",
"'_log_level'... | Creates a shallow-copy of the startup parameters. | [
"Creates",
"a",
"shallow",
"-",
"copy",
"of",
"the",
"startup",
"parameters",
"."
] | [
"'''\n Creates a shallow-copy of the startup parameters.\n '''"
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
f7001373a7204c33b024b0c7595942d17d82aa97 | mrmansano/sublime-ycmd | lib/ycmd/start.py | [
"MIT"
] | Python | to_startup_parameters | <not_specific> | def to_startup_parameters(ycmd_root_directory,
ycmd_settings_path=None,
working_directory=None,
python_binary_path=None,
server_idle_suicide_seconds=None,
server_check_interval_seconds=None)... |
Internal convenience function. Receives the raw arguments to starting a
ycmd server and returns a `StartupParameters` instance from it.
If the first argument is already `StartupParameters`, it is returned as-is,
and the remaining parameters are ignored.
Otherwise, a `StartupParameters` instance i... | Internal convenience function. Receives the raw arguments to starting a
ycmd server and returns a `StartupParameters` instance from it.
If the first argument is already `StartupParameters`, it is returned as-is,
and the remaining parameters are ignored.
Otherwise, a `StartupParameters` instance is constructed with al... | [
"Internal",
"convenience",
"function",
".",
"Receives",
"the",
"raw",
"arguments",
"to",
"starting",
"a",
"ycmd",
"server",
"and",
"returns",
"a",
"`",
"StartupParameters",
"`",
"instance",
"from",
"it",
".",
"If",
"the",
"first",
"argument",
"is",
"already",
... | def to_startup_parameters(ycmd_root_directory,
ycmd_settings_path=None,
working_directory=None,
python_binary_path=None,
server_idle_suicide_seconds=None,
server_check_interval_seconds=None)... | [
"def",
"to_startup_parameters",
"(",
"ycmd_root_directory",
",",
"ycmd_settings_path",
"=",
"None",
",",
"working_directory",
"=",
"None",
",",
"python_binary_path",
"=",
"None",
",",
"server_idle_suicide_seconds",
"=",
"None",
",",
"server_check_interval_seconds",
"=",
... | Internal convenience function. | [
"Internal",
"convenience",
"function",
"."
] | [
"'''\n Internal convenience function. Receives the raw arguments to starting a\n ycmd server and returns a `StartupParameters` instance from it.\n\n If the first argument is already `StartupParameters`, it is returned as-is,\n and the remaining parameters are ignored.\n\n Otherwise, a `StartupParamet... | [
{
"param": "ycmd_root_directory",
"type": null
},
{
"param": "ycmd_settings_path",
"type": null
},
{
"param": "working_directory",
"type": null
},
{
"param": "python_binary_path",
"type": null
},
{
"param": "server_idle_suicide_seconds",
"type": null
},
{
... | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "ycmd_root_directory",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "ycmd_settings_path",
"type": null,
"docstring": null... |
f7001373a7204c33b024b0c7595942d17d82aa97 | mrmansano/sublime-ycmd | lib/ycmd/start.py | [
"MIT"
] | Python | check_startup_parameters | null | def check_startup_parameters(startup_parameters):
'''
Performs quick, non-blocking validation on startup parameters to catch type
mismatches or empty configurations. Raises an exception or returns `None`.
This is meant to be run on the main thread to catch common startup errors
before initializing ... |
Performs quick, non-blocking validation on startup parameters to catch type
mismatches or empty configurations. Raises an exception or returns `None`.
This is meant to be run on the main thread to catch common startup errors
before initializing the server off-thread. It isn't strictly necessary, but
... | Performs quick, non-blocking validation on startup parameters to catch type
mismatches or empty configurations. Raises an exception or returns `None`.
This is meant to be run on the main thread to catch common startup errors
before initializing the server off-thread. It isn't strictly necessary, but
produces nicer err... | [
"Performs",
"quick",
"non",
"-",
"blocking",
"validation",
"on",
"startup",
"parameters",
"to",
"catch",
"type",
"mismatches",
"or",
"empty",
"configurations",
".",
"Raises",
"an",
"exception",
"or",
"returns",
"`",
"None",
"`",
".",
"This",
"is",
"meant",
"... | def check_startup_parameters(startup_parameters):
if not isinstance(startup_parameters, StartupParameters):
raise TypeError(
'startup parameters must be StartupParameters: %r' %
(startup_parameters)
)
ycmd_root_directory = startup_parameters.ycmd_root_directory
if not... | [
"def",
"check_startup_parameters",
"(",
"startup_parameters",
")",
":",
"if",
"not",
"isinstance",
"(",
"startup_parameters",
",",
"StartupParameters",
")",
":",
"raise",
"TypeError",
"(",
"'startup parameters must be StartupParameters: %r'",
"%",
"(",
"startup_parameters",... | Performs quick, non-blocking validation on startup parameters to catch type
mismatches or empty configurations. | [
"Performs",
"quick",
"non",
"-",
"blocking",
"validation",
"on",
"startup",
"parameters",
"to",
"catch",
"type",
"mismatches",
"or",
"empty",
"configurations",
"."
] | [
"'''\n Performs quick, non-blocking validation on startup parameters to catch type\n mismatches or empty configurations. Raises an exception or returns `None`.\n\n This is meant to be run on the main thread to catch common startup errors\n before initializing the server off-thread. It isn't strictly nec... | [
{
"param": "startup_parameters",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "startup_parameters",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
f7001373a7204c33b024b0c7595942d17d82aa97 | mrmansano/sublime-ycmd | lib/ycmd/start.py | [
"MIT"
] | Python | write_ycmd_settings_file | <not_specific> | def write_ycmd_settings_file(ycmd_settings_path, ycmd_hmac_secret, out=None):
'''
Writes out a ycmd server settings file based on the template file
`ycmd_settings_path`. A uniquely-generated `ycmd_hmac_secret` must also be
supplied, as it needs to be written into this file.
The return value is the p... |
Writes out a ycmd server settings file based on the template file
`ycmd_settings_path`. A uniquely-generated `ycmd_hmac_secret` must also be
supplied, as it needs to be written into this file.
The return value is the path to the settings file, as a `str`.
If `out` is omitted, a secure temporary fil... | Writes out a ycmd server settings file based on the template file
`ycmd_settings_path`. A uniquely-generated `ycmd_hmac_secret` must also be
supplied, as it needs to be written into this file.
The return value is the path to the settings file, as a `str`.
If `out` is omitted, a secure temporary file is created, and the... | [
"Writes",
"out",
"a",
"ycmd",
"server",
"settings",
"file",
"based",
"on",
"the",
"template",
"file",
"`",
"ycmd_settings_path",
"`",
".",
"A",
"uniquely",
"-",
"generated",
"`",
"ycmd_hmac_secret",
"`",
"must",
"also",
"be",
"supplied",
"as",
"it",
"needs",... | def write_ycmd_settings_file(ycmd_settings_path, ycmd_hmac_secret, out=None):
ycmd_settings_data = generate_settings_data(
ycmd_settings_path, ycmd_hmac_secret,
)
out_path = None
if out is None:
temp_file_object = tempfile.NamedTemporaryFile(
prefix='ycmd_settings_', suffix='... | [
"def",
"write_ycmd_settings_file",
"(",
"ycmd_settings_path",
",",
"ycmd_hmac_secret",
",",
"out",
"=",
"None",
")",
":",
"ycmd_settings_data",
"=",
"generate_settings_data",
"(",
"ycmd_settings_path",
",",
"ycmd_hmac_secret",
",",
")",
"out_path",
"=",
"None",
"if",
... | Writes out a ycmd server settings file based on the template file
`ycmd_settings_path`. | [
"Writes",
"out",
"a",
"ycmd",
"server",
"settings",
"file",
"based",
"on",
"the",
"template",
"file",
"`",
"ycmd_settings_path",
"`",
"."
] | [
"'''\n Writes out a ycmd server settings file based on the template file\n `ycmd_settings_path`. A uniquely-generated `ycmd_hmac_secret` must also be\n supplied, as it needs to be written into this file.\n The return value is the path to the settings file, as a `str`.\n If `out` is omitted, a secure ... | [
{
"param": "ycmd_settings_path",
"type": null
},
{
"param": "ycmd_hmac_secret",
"type": null
},
{
"param": "out",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "ycmd_settings_path",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "ycmd_hmac_secret",
"type": null,
"docstring": null,
... |
f7001373a7204c33b024b0c7595942d17d82aa97 | mrmansano/sublime-ycmd | lib/ycmd/start.py | [
"MIT"
] | Python | prepare_ycmd_process | <not_specific> | def prepare_ycmd_process(startup_parameters, ycmd_settings_tempfile_path,
ycmd_server_hostname, ycmd_server_port):
'''
Initializes and returns a `Process` handle, correctly configured to launch
a ycmd server process. It does not automatically start it though.
The `ycmd_settings_... |
Initializes and returns a `Process` handle, correctly configured to launch
a ycmd server process. It does not automatically start it though.
The `ycmd_settings_tempfile_path` should be created by (return value of)
`write_ycmd_settings_file`. The ycmd server process will read that file on
startup an... | Initializes and returns a `Process` handle, correctly configured to launch
a ycmd server process. It does not automatically start it though.
The `ycmd_settings_tempfile_path` should be created by (return value of)
`write_ycmd_settings_file`. The ycmd server process will read that file on
startup and then immediately de... | [
"Initializes",
"and",
"returns",
"a",
"`",
"Process",
"`",
"handle",
"correctly",
"configured",
"to",
"launch",
"a",
"ycmd",
"server",
"process",
".",
"It",
"does",
"not",
"automatically",
"start",
"it",
"though",
".",
"The",
"`",
"ycmd_settings_tempfile_path",
... | def prepare_ycmd_process(startup_parameters, ycmd_settings_tempfile_path,
ycmd_server_hostname, ycmd_server_port):
assert isinstance(startup_parameters, StartupParameters), \
'startup parameters must be StartupParameters: %r' % \
(startup_parameters)
assert isinstance(yc... | [
"def",
"prepare_ycmd_process",
"(",
"startup_parameters",
",",
"ycmd_settings_tempfile_path",
",",
"ycmd_server_hostname",
",",
"ycmd_server_port",
")",
":",
"assert",
"isinstance",
"(",
"startup_parameters",
",",
"StartupParameters",
")",
",",
"'startup parameters must be St... | Initializes and returns a `Process` handle, correctly configured to launch
a ycmd server process. | [
"Initializes",
"and",
"returns",
"a",
"`",
"Process",
"`",
"handle",
"correctly",
"configured",
"to",
"launch",
"a",
"ycmd",
"server",
"process",
"."
] | [
"'''\n Initializes and returns a `Process` handle, correctly configured to launch\n a ycmd server process. It does not automatically start it though.\n The `ycmd_settings_tempfile_path` should be created by (return value of)\n `write_ycmd_settings_file`. The ycmd server process will read that file on\n ... | [
{
"param": "startup_parameters",
"type": null
},
{
"param": "ycmd_settings_tempfile_path",
"type": null
},
{
"param": "ycmd_server_hostname",
"type": null
},
{
"param": "ycmd_server_port",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "startup_parameters",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "ycmd_settings_tempfile_path",
"type": null,
"docstrin... |
399800dd198fdb2152127473688727c2140f50a4 | mrmansano/sublime-ycmd | tests/runtests.py | [
"MIT"
] | Python | configure_logging | null | def configure_logging(log_level=None, output_stream=None):
'''
Configures the logging module for running tests. This automatically binds
the helpers in lib.logutils and captures output into a specified file.
Supplying None to the parameters will result in defaults.
'''
if log_level is None:
... |
Configures the logging module for running tests. This automatically binds
the helpers in lib.logutils and captures output into a specified file.
Supplying None to the parameters will result in defaults.
| Configures the logging module for running tests. This automatically binds
the helpers in lib.logutils and captures output into a specified file.
Supplying None to the parameters will result in defaults. | [
"Configures",
"the",
"logging",
"module",
"for",
"running",
"tests",
".",
"This",
"automatically",
"binds",
"the",
"helpers",
"in",
"lib",
".",
"logutils",
"and",
"captures",
"output",
"into",
"a",
"specified",
"file",
".",
"Supplying",
"None",
"to",
"the",
... | def configure_logging(log_level=None, output_stream=None):
if log_level is None:
log_level = logging.WARNING
if output_stream is None:
output_stream = sys.stderr
logging.addLevelName(LOGLEVEL_NOTICE, LOGLEVELNAME_NOTICE)
logger_instance = logging.getLogger('sublime-ycmd')
logger_inst... | [
"def",
"configure_logging",
"(",
"log_level",
"=",
"None",
",",
"output_stream",
"=",
"None",
")",
":",
"if",
"log_level",
"is",
"None",
":",
"log_level",
"=",
"logging",
".",
"WARNING",
"if",
"output_stream",
"is",
"None",
":",
"output_stream",
"=",
"sys",
... | Configures the logging module for running tests. | [
"Configures",
"the",
"logging",
"module",
"for",
"running",
"tests",
"."
] | [
"'''\n Configures the logging module for running tests. This automatically binds\n the helpers in lib.logutils and captures output into a specified file.\n Supplying None to the parameters will result in defaults.\n '''",
"# handler/filter will decide how to filter, so log everything here:"
] | [
{
"param": "log_level",
"type": null
},
{
"param": "output_stream",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "log_level",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "output_stream",
"type": null,
"docstring": null,
"docstr... |
399800dd198fdb2152127473688727c2140f50a4 | mrmansano/sublime-ycmd | tests/runtests.py | [
"MIT"
] | Python | consume_line | <not_specific> | def consume_line(self):
'''
Returns a complete buffered line, if one exists, and removes it from
the buffer. If a complete line does not exist, this returns None, and
no modifications are made to the buffer.
'''
buffered_lines = self._buffer.splitlines()
if len(bu... |
Returns a complete buffered line, if one exists, and removes it from
the buffer. If a complete line does not exist, this returns None, and
no modifications are made to the buffer.
| Returns a complete buffered line, if one exists, and removes it from
the buffer. If a complete line does not exist, this returns None, and
no modifications are made to the buffer. | [
"Returns",
"a",
"complete",
"buffered",
"line",
"if",
"one",
"exists",
"and",
"removes",
"it",
"from",
"the",
"buffer",
".",
"If",
"a",
"complete",
"line",
"does",
"not",
"exist",
"this",
"returns",
"None",
"and",
"no",
"modifications",
"are",
"made",
"to"... | def consume_line(self):
buffered_lines = self._buffer.splitlines()
if len(buffered_lines) <= 1:
return None
first_line = buffered_lines[0]
remaining_buffer = '\n'.join(buffered_lines[1:])
self._buffer = remaining_buffer
return first_line | [
"def",
"consume_line",
"(",
"self",
")",
":",
"buffered_lines",
"=",
"self",
".",
"_buffer",
".",
"splitlines",
"(",
")",
"if",
"len",
"(",
"buffered_lines",
")",
"<=",
"1",
":",
"return",
"None",
"first_line",
"=",
"buffered_lines",
"[",
"0",
"]",
"rema... | Returns a complete buffered line, if one exists, and removes it from
the buffer. | [
"Returns",
"a",
"complete",
"buffered",
"line",
"if",
"one",
"exists",
"and",
"removes",
"it",
"from",
"the",
"buffer",
"."
] | [
"'''\n Returns a complete buffered line, if one exists, and removes it from\n the buffer. If a complete line does not exist, this returns None, and\n no modifications are made to the buffer.\n '''"
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
399800dd198fdb2152127473688727c2140f50a4 | mrmansano/sublime-ycmd | tests/runtests.py | [
"MIT"
] | Python | testrunner_log | null | def testrunner_log(*args):
'''
Dummy wrapper around the logger log statement. This method exists to
provide a better funcName in the log record.
'''
logger.log(LOGLEVEL_NOTICE, *args) |
Dummy wrapper around the logger log statement. This method exists to
provide a better funcName in the log record.
| Dummy wrapper around the logger log statement. This method exists to
provide a better funcName in the log record. | [
"Dummy",
"wrapper",
"around",
"the",
"logger",
"log",
"statement",
".",
"This",
"method",
"exists",
"to",
"provide",
"a",
"better",
"funcName",
"in",
"the",
"log",
"record",
"."
] | def testrunner_log(*args):
logger.log(LOGLEVEL_NOTICE, *args) | [
"def",
"testrunner_log",
"(",
"*",
"args",
")",
":",
"logger",
".",
"log",
"(",
"LOGLEVEL_NOTICE",
",",
"*",
"args",
")"
] | Dummy wrapper around the logger log statement. | [
"Dummy",
"wrapper",
"around",
"the",
"logger",
"log",
"statement",
"."
] | [
"'''\n Dummy wrapper around the logger log statement. This method exists to\n provide a better funcName in the log record.\n '''"
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
399800dd198fdb2152127473688727c2140f50a4 | mrmansano/sublime-ycmd | tests/runtests.py | [
"MIT"
] | Python | write | <not_specific> | def write(self, s):
'''
Receives messages and logs them using the test runner log level.
'''
nbytes = len(s)
self._buffer += s
buffered_line = self.consume_line()
while buffered_line:
self.testrunner_log(buffered_line)
buffered_line = self... |
Receives messages and logs them using the test runner log level.
| Receives messages and logs them using the test runner log level. | [
"Receives",
"messages",
"and",
"logs",
"them",
"using",
"the",
"test",
"runner",
"log",
"level",
"."
] | def write(self, s):
nbytes = len(s)
self._buffer += s
buffered_line = self.consume_line()
while buffered_line:
self.testrunner_log(buffered_line)
buffered_line = self.consume_line()
return nbytes | [
"def",
"write",
"(",
"self",
",",
"s",
")",
":",
"nbytes",
"=",
"len",
"(",
"s",
")",
"self",
".",
"_buffer",
"+=",
"s",
"buffered_line",
"=",
"self",
".",
"consume_line",
"(",
")",
"while",
"buffered_line",
":",
"self",
".",
"testrunner_log",
"(",
"... | Receives messages and logs them using the test runner log level. | [
"Receives",
"messages",
"and",
"logs",
"them",
"using",
"the",
"test",
"runner",
"log",
"level",
"."
] | [
"'''\n Receives messages and logs them using the test runner log level.\n '''"
] | [
{
"param": "self",
"type": null
},
{
"param": "s",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "s",
"type": null,
"docstring": null,
"docstring_tokens": [],
... |
399800dd198fdb2152127473688727c2140f50a4 | mrmansano/sublime-ycmd | tests/runtests.py | [
"MIT"
] | Python | close | null | def close(self):
'''
Receives the 'close' event. This writes out any pending buffered data
and then calls the parent 'close' method.
'''
for buffered_line in self._buffer.splitlines():
self.testrunner_log(buffered_line)
super(TestRunnerLogStream, self).close(... |
Receives the 'close' event. This writes out any pending buffered data
and then calls the parent 'close' method.
| Receives the 'close' event. This writes out any pending buffered data
and then calls the parent 'close' method. | [
"Receives",
"the",
"'",
"close",
"'",
"event",
".",
"This",
"writes",
"out",
"any",
"pending",
"buffered",
"data",
"and",
"then",
"calls",
"the",
"parent",
"'",
"close",
"'",
"method",
"."
] | def close(self):
for buffered_line in self._buffer.splitlines():
self.testrunner_log(buffered_line)
super(TestRunnerLogStream, self).close() | [
"def",
"close",
"(",
"self",
")",
":",
"for",
"buffered_line",
"in",
"self",
".",
"_buffer",
".",
"splitlines",
"(",
")",
":",
"self",
".",
"testrunner_log",
"(",
"buffered_line",
")",
"super",
"(",
"TestRunnerLogStream",
",",
"self",
")",
".",
"close",
... | Receives the 'close' event. | [
"Receives",
"the",
"'",
"close",
"'",
"event",
"."
] | [
"'''\n Receives the 'close' event. This writes out any pending buffered data\n and then calls the parent 'close' method.\n '''"
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
399800dd198fdb2152127473688727c2140f50a4 | mrmansano/sublime-ycmd | tests/runtests.py | [
"MIT"
] | Python | main | null | def main():
'''
Main method. Discovers and runs tests in the 'tests' subdirectory.
'''
cli_argparser = get_cli_argparser()
cli_args = cli_argparser.parse_args()
if cli_args.list not in [None, False]:
raise cli_argparser.error('Test listing is not yet implemented')
configure_logging... |
Main method. Discovers and runs tests in the 'tests' subdirectory.
| Main method. Discovers and runs tests in the 'tests' subdirectory. | [
"Main",
"method",
".",
"Discovers",
"and",
"runs",
"tests",
"in",
"the",
"'",
"tests",
"'",
"subdirectory",
"."
] | def main():
cli_argparser = get_cli_argparser()
cli_args = cli_argparser.parse_args()
if cli_args.list not in [None, False]:
raise cli_argparser.error('Test listing is not yet implemented')
configure_logging(cli_args.log_level, cli_args.log_file)
logger.debug('initialized logger, about to lo... | [
"def",
"main",
"(",
")",
":",
"cli_argparser",
"=",
"get_cli_argparser",
"(",
")",
"cli_args",
"=",
"cli_argparser",
".",
"parse_args",
"(",
")",
"if",
"cli_args",
".",
"list",
"not",
"in",
"[",
"None",
",",
"False",
"]",
":",
"raise",
"cli_argparser",
"... | Main method. | [
"Main",
"method",
"."
] | [
"'''\n Main method. Discovers and runs tests in the 'tests' subdirectory.\n '''"
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
eb382531484de8858b50bfa44db9669fc9573984 | mrmansano/sublime-ycmd | tests/lib/decorator.py | [
"MIT"
] | Python | log_function | <not_specific> | def log_function(desc=None, logger=None,
include_args=False, include_kwargs=False,
include_return=False):
'''
Decorator for a function call.
Generates log messages when executing the underlying function. Attaches a
specialized filter to the logger to prepend the descrip... |
Decorator for a function call.
Generates log messages when executing the underlying function. Attaches a
specialized filter to the logger to prepend the description to all log
messages while executing the function.
If `desc` is provided, it is used in the log message prefix. If omitted,
the fun... | Decorator for a function call.
Generates log messages when executing the underlying function. Attaches a
specialized filter to the logger to prepend the description to all log
messages while executing the function.
If `desc` is provided, it is used in the log message prefix. If omitted,
the function name will be used.
... | [
"Decorator",
"for",
"a",
"function",
"call",
".",
"Generates",
"log",
"messages",
"when",
"executing",
"the",
"underlying",
"function",
".",
"Attaches",
"a",
"specialized",
"filter",
"to",
"the",
"logger",
"to",
"prepend",
"the",
"description",
"to",
"all",
"l... | def log_function(desc=None, logger=None,
include_args=False, include_kwargs=False,
include_return=False):
if desc:
def get_desc(fn):
return desc
else:
def get_desc(fn):
if hasattr(fn, '__name__'):
return getattr(fn, '__nam... | [
"def",
"log_function",
"(",
"desc",
"=",
"None",
",",
"logger",
"=",
"None",
",",
"include_args",
"=",
"False",
",",
"include_kwargs",
"=",
"False",
",",
"include_return",
"=",
"False",
")",
":",
"if",
"desc",
":",
"def",
"get_desc",
"(",
"fn",
")",
":... | Decorator for a function call. | [
"Decorator",
"for",
"a",
"function",
"call",
"."
] | [
"'''\n Decorator for a function call.\n Generates log messages when executing the underlying function. Attaches a\n specialized filter to the logger to prepend the description to all log\n messages while executing the function.\n If `desc` is provided, it is used in the log message prefix. If omitted... | [
{
"param": "desc",
"type": null
},
{
"param": "logger",
"type": null
},
{
"param": "include_args",
"type": null
},
{
"param": "include_kwargs",
"type": null
},
{
"param": "include_return",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "desc",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "logger",
"type": null,
"docstring": null,
"docstring_tokens":... |
eb382531484de8858b50bfa44db9669fc9573984 | mrmansano/sublime-ycmd | tests/lib/decorator.py | [
"MIT"
] | Python | log_function_runner | <not_specific> | def log_function_runner(fn):
''' Base decorator. Decorates the underlying function. '''
desc = get_desc(fn)
@functools.wraps(fn)
def log_function_run(*args, **kwargs):
with LoggingContext(logger=logger, desc=desc):
if include_args and include_kwargs:
... | Base decorator. Decorates the underlying function. | Base decorator. Decorates the underlying function. | [
"Base",
"decorator",
".",
"Decorates",
"the",
"underlying",
"function",
"."
] | def log_function_runner(fn):
desc = get_desc(fn)
@functools.wraps(fn)
def log_function_run(*args, **kwargs):
with LoggingContext(logger=logger, desc=desc):
if include_args and include_kwargs:
logger.debug('args, kwargs: %r, %r', args, kwargs)
... | [
"def",
"log_function_runner",
"(",
"fn",
")",
":",
"desc",
"=",
"get_desc",
"(",
"fn",
")",
"@",
"functools",
".",
"wraps",
"(",
"fn",
")",
"def",
"log_function_run",
"(",
"*",
"args",
",",
"**",
"kwargs",
")",
":",
"with",
"LoggingContext",
"(",
"logg... | Base decorator. | [
"Base",
"decorator",
"."
] | [
"''' Base decorator. Decorates the underlying function. '''"
] | [
{
"param": "fn",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "fn",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
1890107dc47eb898ad10241fad6e97e34ca56009 | mrmansano/sublime-ycmd | lib/subl/view.py | [
"MIT"
] | Python | ready | <not_specific> | def ready(self):
'''
Returns true if the underlying view handle is both primary (the main
view for an underlying buffer), and not loading.
This indicates that the file is ready for use with ycmd.
'''
if not self._view:
logger.warning('view handle is not set, r... |
Returns true if the underlying view handle is both primary (the main
view for an underlying buffer), and not loading.
This indicates that the file is ready for use with ycmd.
| Returns true if the underlying view handle is both primary (the main
view for an underlying buffer), and not loading.
This indicates that the file is ready for use with ycmd. | [
"Returns",
"true",
"if",
"the",
"underlying",
"view",
"handle",
"is",
"both",
"primary",
"(",
"the",
"main",
"view",
"for",
"an",
"underlying",
"buffer",
")",
"and",
"not",
"loading",
".",
"This",
"indicates",
"that",
"the",
"file",
"is",
"ready",
"for",
... | def ready(self):
if not self._view:
logger.warning('view handle is not set, returning not ready...')
return False
view = self._view
return (
view.is_primary() and
not view.is_scratch() and
not view.is_loading()
) | [
"def",
"ready",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"_view",
":",
"logger",
".",
"warning",
"(",
"'view handle is not set, returning not ready...'",
")",
"return",
"False",
"view",
"=",
"self",
".",
"_view",
"return",
"(",
"view",
".",
"is_prima... | Returns true if the underlying view handle is both primary (the main
view for an underlying buffer), and not loading. | [
"Returns",
"true",
"if",
"the",
"underlying",
"view",
"handle",
"is",
"both",
"primary",
"(",
"the",
"main",
"view",
"for",
"an",
"underlying",
"buffer",
")",
"and",
"not",
"loading",
"."
] | [
"'''\n Returns true if the underlying view handle is both primary (the main\n view for an underlying buffer), and not loading.\n This indicates that the file is ready for use with ycmd.\n '''"
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
1890107dc47eb898ad10241fad6e97e34ca56009 | mrmansano/sublime-ycmd | lib/subl/view.py | [
"MIT"
] | Python | dirty | <not_specific> | def dirty(self):
'''
Returns true if the underlying buffer has unsaved changes.
'''
if not self._view:
logger.warning('view handle is not set, returning not dirty...')
return False
view = self._view
return view.is_dirty() |
Returns true if the underlying buffer has unsaved changes.
| Returns true if the underlying buffer has unsaved changes. | [
"Returns",
"true",
"if",
"the",
"underlying",
"buffer",
"has",
"unsaved",
"changes",
"."
] | def dirty(self):
if not self._view:
logger.warning('view handle is not set, returning not dirty...')
return False
view = self._view
return view.is_dirty() | [
"def",
"dirty",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"_view",
":",
"logger",
".",
"warning",
"(",
"'view handle is not set, returning not dirty...'",
")",
"return",
"False",
"view",
"=",
"self",
".",
"_view",
"return",
"view",
".",
"is_dirty",
"(... | Returns true if the underlying buffer has unsaved changes. | [
"Returns",
"true",
"if",
"the",
"underlying",
"buffer",
"has",
"unsaved",
"changes",
"."
] | [
"'''\n Returns true if the underlying buffer has unsaved changes.\n '''"
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
1890107dc47eb898ad10241fad6e97e34ca56009 | mrmansano/sublime-ycmd | lib/subl/view.py | [
"MIT"
] | Python | generate_request_parameters | <not_specific> | def generate_request_parameters(self):
'''
Generates and returns file-related `RequestParameters` for use in the
`Server` handlers.
These parameters include information about the file like the name,
contents, and file type(s). Additional parameters may still be added to
t... |
Generates and returns file-related `RequestParameters` for use in the
`Server` handlers.
These parameters include information about the file like the name,
contents, and file type(s). Additional parameters may still be added to
the result before passing it off to the server.
... | Generates and returns file-related `RequestParameters` for use in the
`Server` handlers.
These parameters include information about the file like the name,
contents, and file type(s). Additional parameters may still be added to
the result before passing it off to the server. | [
"Generates",
"and",
"returns",
"file",
"-",
"related",
"`",
"RequestParameters",
"`",
"for",
"use",
"in",
"the",
"`",
"Server",
"`",
"handlers",
".",
"These",
"parameters",
"include",
"information",
"about",
"the",
"file",
"like",
"the",
"name",
"contents",
... | def generate_request_parameters(self):
if not self._view:
logger.error('no view handle has been set')
return None
view = self._view
file_path = view.file_name()
if not file_path:
logger.debug(
'view is not associated with a file, using ... | [
"def",
"generate_request_parameters",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"_view",
":",
"logger",
".",
"error",
"(",
"'no view handle has been set'",
")",
"return",
"None",
"view",
"=",
"self",
".",
"_view",
"file_path",
"=",
"view",
".",
"file_... | Generates and returns file-related `RequestParameters` for use in the
`Server` handlers. | [
"Generates",
"and",
"returns",
"file",
"-",
"related",
"`",
"RequestParameters",
"`",
"for",
"use",
"in",
"the",
"`",
"Server",
"`",
"handlers",
"."
] | [
"'''\n Generates and returns file-related `RequestParameters` for use in the\n `Server` handlers.\n These parameters include information about the file like the name,\n contents, and file type(s). Additional parameters may still be added to\n the result before passing it off to th... | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
ac5555b80bbaaceba1a504fcdefa87d3a0f08f81 | mrmansano/sublime-ycmd | plugin/view.py | [
"MIT"
] | Python | has_notified_ready_to_parse | <not_specific> | def has_notified_ready_to_parse(self, view, server):
'''
Returns true if the given `view` has been parsed by the `server`. This
must be done at least once to ensure that the ycmd server has a list
of identifiers to offer in completion results.
This works by storing a view-specifi... |
Returns true if the given `view` has been parsed by the `server`. This
must be done at least once to ensure that the ycmd server has a list
of identifiers to offer in completion results.
This works by storing a view-specific variable indicating the server,
if any, that the view ... | Returns true if the given `view` has been parsed by the `server`. This
must be done at least once to ensure that the ycmd server has a list
of identifiers to offer in completion results.
This works by storing a view-specific variable indicating the server,
if any, that the view has been uploaded to. If this variable is... | [
"Returns",
"true",
"if",
"the",
"given",
"`",
"view",
"`",
"has",
"been",
"parsed",
"by",
"the",
"`",
"server",
"`",
".",
"This",
"must",
"be",
"done",
"at",
"least",
"once",
"to",
"ensure",
"that",
"the",
"ycmd",
"server",
"has",
"a",
"list",
"of",
... | def has_notified_ready_to_parse(self, view, server):
view = self.get_wrapped_view(view)
if not view:
logger.error('unknown view type: %r', view)
raise TypeError('view must be a View: %r' % (view))
init_notified_server_set(view)
return has_notified_server(view, ser... | [
"def",
"has_notified_ready_to_parse",
"(",
"self",
",",
"view",
",",
"server",
")",
":",
"view",
"=",
"self",
".",
"get_wrapped_view",
"(",
"view",
")",
"if",
"not",
"view",
":",
"logger",
".",
"error",
"(",
"'unknown view type: %r'",
",",
"view",
")",
"ra... | Returns true if the given `view` has been parsed by the `server`. | [
"Returns",
"true",
"if",
"the",
"given",
"`",
"view",
"`",
"has",
"been",
"parsed",
"by",
"the",
"`",
"server",
"`",
"."
] | [
"'''\n Returns true if the given `view` has been parsed by the `server`. This\n must be done at least once to ensure that the ycmd server has a list\n of identifiers to offer in completion results.\n This works by storing a view-specific variable indicating the server,\n if any, t... | [
{
"param": "self",
"type": null
},
{
"param": "view",
"type": null
},
{
"param": "server",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "view",
"type": null,
"docstring": null,
"docstring_tokens": [... |
ac5555b80bbaaceba1a504fcdefa87d3a0f08f81 | mrmansano/sublime-ycmd | plugin/view.py | [
"MIT"
] | Python | init_notified_server_set | null | def init_notified_server_set(view, key=NOTIFIED_SERVERS_KEY):
'''
Initializes the set of notified servers for a given `view` if it has not
already been initialized.
This does nothing if it has been initialized already.
'''
if not isinstance(view, View):
logger.warning('view does not app... |
Initializes the set of notified servers for a given `view` if it has not
already been initialized.
This does nothing if it has been initialized already.
| Initializes the set of notified servers for a given `view` if it has not
already been initialized.
This does nothing if it has been initialized already. | [
"Initializes",
"the",
"set",
"of",
"notified",
"servers",
"for",
"a",
"given",
"`",
"view",
"`",
"if",
"it",
"has",
"not",
"already",
"been",
"initialized",
".",
"This",
"does",
"nothing",
"if",
"it",
"has",
"been",
"initialized",
"already",
"."
] | def init_notified_server_set(view, key=NOTIFIED_SERVERS_KEY):
if not isinstance(view, View):
logger.warning('view does not appear valid: %r', view)
if key not in view:
logger.debug('view has not been sent to any server, creating metadata')
view[key] = set() | [
"def",
"init_notified_server_set",
"(",
"view",
",",
"key",
"=",
"NOTIFIED_SERVERS_KEY",
")",
":",
"if",
"not",
"isinstance",
"(",
"view",
",",
"View",
")",
":",
"logger",
".",
"warning",
"(",
"'view does not appear valid: %r'",
",",
"view",
")",
"if",
"key",
... | Initializes the set of notified servers for a given `view` if it has not
already been initialized. | [
"Initializes",
"the",
"set",
"of",
"notified",
"servers",
"for",
"a",
"given",
"`",
"view",
"`",
"if",
"it",
"has",
"not",
"already",
"been",
"initialized",
"."
] | [
"'''\n Initializes the set of notified servers for a given `view` if it has not\n already been initialized.\n\n This does nothing if it has been initialized already.\n '''"
] | [
{
"param": "view",
"type": null
},
{
"param": "key",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "view",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "key",
"type": null,
"docstring": null,
"docstring_tokens": []... |
ac5555b80bbaaceba1a504fcdefa87d3a0f08f81 | mrmansano/sublime-ycmd | plugin/view.py | [
"MIT"
] | Python | has_notified_server | <not_specific> | def has_notified_server(view, server, key=NOTIFIED_SERVERS_KEY):
'''
Checks if a given `server` is in the notified server set for a `view`.
'''
if not isinstance(view, View):
logger.warning('view does not appear valid: %r', view)
if key not in view:
logger.error(
'notifi... |
Checks if a given `server` is in the notified server set for a `view`.
| Checks if a given `server` is in the notified server set for a `view`. | [
"Checks",
"if",
"a",
"given",
"`",
"server",
"`",
"is",
"in",
"the",
"notified",
"server",
"set",
"for",
"a",
"`",
"view",
"`",
"."
] | def has_notified_server(view, server, key=NOTIFIED_SERVERS_KEY):
if not isinstance(view, View):
logger.warning('view does not appear valid: %r', view)
if key not in view:
logger.error(
'notified server set is not initialized for view: %r', view,
)
notified_servers = view[... | [
"def",
"has_notified_server",
"(",
"view",
",",
"server",
",",
"key",
"=",
"NOTIFIED_SERVERS_KEY",
")",
":",
"if",
"not",
"isinstance",
"(",
"view",
",",
"View",
")",
":",
"logger",
".",
"warning",
"(",
"'view does not appear valid: %r'",
",",
"view",
")",
"... | Checks if a given `server` is in the notified server set for a `view`. | [
"Checks",
"if",
"a",
"given",
"`",
"server",
"`",
"is",
"in",
"the",
"notified",
"server",
"set",
"for",
"a",
"`",
"view",
"`",
"."
] | [
"'''\n Checks if a given `server` is in the notified server set for a `view`.\n '''"
] | [
{
"param": "view",
"type": null
},
{
"param": "server",
"type": null
},
{
"param": "key",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "view",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "server",
"type": null,
"docstring": null,
"docstring_tokens":... |
ac5555b80bbaaceba1a504fcdefa87d3a0f08f81 | mrmansano/sublime-ycmd | plugin/view.py | [
"MIT"
] | Python | remove_notified_server | null | def remove_notified_server(view, server, key=NOTIFIED_SERVERS_KEY):
'''
Removes `server` to the notified server set for `view`.
If the server is not in the notified server set, this does nothing.
'''
if not isinstance(view, View):
logger.warning('view does not appear valid: %r', view)
... |
Removes `server` to the notified server set for `view`.
If the server is not in the notified server set, this does nothing.
| Removes `server` to the notified server set for `view`.
If the server is not in the notified server set, this does nothing. | [
"Removes",
"`",
"server",
"`",
"to",
"the",
"notified",
"server",
"set",
"for",
"`",
"view",
"`",
".",
"If",
"the",
"server",
"is",
"not",
"in",
"the",
"notified",
"server",
"set",
"this",
"does",
"nothing",
"."
] | def remove_notified_server(view, server, key=NOTIFIED_SERVERS_KEY):
if not isinstance(view, View):
logger.warning('view does not appear valid: %r', view)
if key not in view:
logger.error(
'notified server set is not initialized for view: %r', view,
)
notified_servers = vi... | [
"def",
"remove_notified_server",
"(",
"view",
",",
"server",
",",
"key",
"=",
"NOTIFIED_SERVERS_KEY",
")",
":",
"if",
"not",
"isinstance",
"(",
"view",
",",
"View",
")",
":",
"logger",
".",
"warning",
"(",
"'view does not appear valid: %r'",
",",
"view",
")",
... | Removes `server` to the notified server set for `view`. | [
"Removes",
"`",
"server",
"`",
"to",
"the",
"notified",
"server",
"set",
"for",
"`",
"view",
"`",
"."
] | [
"'''\n Removes `server` to the notified server set for `view`.\n\n If the server is not in the notified server set, this does nothing.\n '''"
] | [
{
"param": "view",
"type": null
},
{
"param": "server",
"type": null
},
{
"param": "key",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "view",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "server",
"type": null,
"docstring": null,
"docstring_tokens":... |
d4c9ebd16a1ecf6e788b68ff9433a46533f41747 | mrmansano/sublime-ycmd | lib/util/hmac.py | [
"MIT"
] | Python | calculate_hmac | <not_specific> | def calculate_hmac(hmac_secret, *content, digestmod=hashlib.sha256):
'''
Calculates the HMAC for the given `content` using the `hmac_secret`.
This is calculated by first generating the HMAC for each item in
`content` separately, then concatenating them, and finally running another
HMAC on the concat... |
Calculates the HMAC for the given `content` using the `hmac_secret`.
This is calculated by first generating the HMAC for each item in
`content` separately, then concatenating them, and finally running another
HMAC on the concatenated intermediate result. Finally, the result of that
is base-64 encod... | Calculates the HMAC for the given `content` using the `hmac_secret`.
This is calculated by first generating the HMAC for each item in
`content` separately, then concatenating them, and finally running another
HMAC on the concatenated intermediate result. Finally, the result of that
is base-64 encoded, so it is suitable... | [
"Calculates",
"the",
"HMAC",
"for",
"the",
"given",
"`",
"content",
"`",
"using",
"the",
"`",
"hmac_secret",
"`",
".",
"This",
"is",
"calculated",
"by",
"first",
"generating",
"the",
"HMAC",
"for",
"each",
"item",
"in",
"`",
"content",
"`",
"separately",
... | def calculate_hmac(hmac_secret, *content, digestmod=hashlib.sha256):
assert isinstance(hmac_secret, (str, bytes)), \
'hmac secret must be str or bytes: %r' % (hmac_secret)
if len(content) == 0:
raise ValueError('no data supplied')
hmac_secret = str_to_bytes(hmac_secret)
content_hmac_dige... | [
"def",
"calculate_hmac",
"(",
"hmac_secret",
",",
"*",
"content",
",",
"digestmod",
"=",
"hashlib",
".",
"sha256",
")",
":",
"assert",
"isinstance",
"(",
"hmac_secret",
",",
"(",
"str",
",",
"bytes",
")",
")",
",",
"'hmac secret must be str or bytes: %r'",
"%"... | Calculates the HMAC for the given `content` using the `hmac_secret`. | [
"Calculates",
"the",
"HMAC",
"for",
"the",
"given",
"`",
"content",
"`",
"using",
"the",
"`",
"hmac_secret",
"`",
"."
] | [
"'''\n Calculates the HMAC for the given `content` using the `hmac_secret`.\n This is calculated by first generating the HMAC for each item in\n `content` separately, then concatenating them, and finally running another\n HMAC on the concatenated intermediate result. Finally, the result of that\n is ... | [
{
"param": "hmac_secret",
"type": null
},
{
"param": "digestmod",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "hmac_secret",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "digestmod",
"type": null,
"docstring": null,
"docstrin... |
0f519146e5ddd7703b9c222b6f4c8da299b61bba | mrmansano/sublime-ycmd | lib/schema/request.py | [
"MIT"
] | Python | to_json | <not_specific> | def to_json(self):
'''
Generates and returns a `dict` representing all stored parameters, for
use in sending the request.
This will additionally validate all parameters, and generate defaults
for any missing ones.
'''
file_path = self.file_path
file_conten... |
Generates and returns a `dict` representing all stored parameters, for
use in sending the request.
This will additionally validate all parameters, and generate defaults
for any missing ones.
| Generates and returns a `dict` representing all stored parameters, for
use in sending the request.
This will additionally validate all parameters, and generate defaults
for any missing ones. | [
"Generates",
"and",
"returns",
"a",
"`",
"dict",
"`",
"representing",
"all",
"stored",
"parameters",
"for",
"use",
"in",
"sending",
"the",
"request",
".",
"This",
"will",
"additionally",
"validate",
"all",
"parameters",
"and",
"generate",
"defaults",
"for",
"a... | def to_json(self):
file_path = self.file_path
file_contents = self.file_contents
file_types = self.file_types
line_num = self.line_num
column_num = self.column_num
extra_params = self._extra_params
force_semantic = self._force_semantic
if not file_path:
... | [
"def",
"to_json",
"(",
"self",
")",
":",
"file_path",
"=",
"self",
".",
"file_path",
"file_contents",
"=",
"self",
".",
"file_contents",
"file_types",
"=",
"self",
".",
"file_types",
"line_num",
"=",
"self",
".",
"line_num",
"column_num",
"=",
"self",
".",
... | Generates and returns a `dict` representing all stored parameters, for
use in sending the request. | [
"Generates",
"and",
"returns",
"a",
"`",
"dict",
"`",
"representing",
"all",
"stored",
"parameters",
"for",
"use",
"in",
"sending",
"the",
"request",
"."
] | [
"'''\n Generates and returns a `dict` representing all stored parameters, for\n use in sending the request.\n This will additionally validate all parameters, and generate defaults\n for any missing ones.\n '''",
"# validate"
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
3131de44cf49d081c5748f24c693c1918b9beea9 | mrmansano/sublime-ycmd | tests/process/process.py | [
"MIT"
] | Python | make_output_stream | <not_specific> | def make_output_stream(process):
'''
Creates an in-memory output stream and binds the given process' stdout
and stderr to it.
'''
assert isinstance(process, Process), \
'[internal] process is not a Process instance: %r' % process
memstream = io.StringIO()
process.filehandles.stdout... |
Creates an in-memory output stream and binds the given process' stdout
and stderr to it.
| Creates an in-memory output stream and binds the given process' stdout
and stderr to it. | [
"Creates",
"an",
"in",
"-",
"memory",
"output",
"stream",
"and",
"binds",
"the",
"given",
"process",
"'",
"stdout",
"and",
"stderr",
"to",
"it",
"."
] | def make_output_stream(process):
assert isinstance(process, Process), \
'[internal] process is not a Process instance: %r' % process
memstream = io.StringIO()
process.filehandles.stdout = memstream
process.filehandles.stderr = memstream
return memstream | [
"def",
"make_output_stream",
"(",
"process",
")",
":",
"assert",
"isinstance",
"(",
"process",
",",
"Process",
")",
",",
"'[internal] process is not a Process instance: %r'",
"%",
"process",
"memstream",
"=",
"io",
".",
"StringIO",
"(",
")",
"process",
".",
"fileh... | Creates an in-memory output stream and binds the given process' stdout
and stderr to it. | [
"Creates",
"an",
"in",
"-",
"memory",
"output",
"stream",
"and",
"binds",
"the",
"given",
"process",
"'",
"stdout",
"and",
"stderr",
"to",
"it",
"."
] | [
"'''\n Creates an in-memory output stream and binds the given process' stdout\n and stderr to it.\n '''"
] | [
{
"param": "process",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "process",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
3131de44cf49d081c5748f24c693c1918b9beea9 | mrmansano/sublime-ycmd | tests/process/process.py | [
"MIT"
] | Python | poll_process_output | <not_specific> | def poll_process_output(process):
'''
Reads and returns the output to stdout and stderr for the supplied process.
This blocks until the process has either terminated, or has closed the
output file descriptors.
'''
assert isinstance(process, Process), \
'[internal] process is not a Proces... |
Reads and returns the output to stdout and stderr for the supplied process.
This blocks until the process has either terminated, or has closed the
output file descriptors.
| Reads and returns the output to stdout and stderr for the supplied process.
This blocks until the process has either terminated, or has closed the
output file descriptors. | [
"Reads",
"and",
"returns",
"the",
"output",
"to",
"stdout",
"and",
"stderr",
"for",
"the",
"supplied",
"process",
".",
"This",
"blocks",
"until",
"the",
"process",
"has",
"either",
"terminated",
"or",
"has",
"closed",
"the",
"output",
"file",
"descriptors",
... | def poll_process_output(process):
assert isinstance(process, Process), \
'[internal] process is not a Process instance: %r' % process
if process.alive():
logger.debug('process is still alive, this will likely block')
return process.communicate(None, 3) | [
"def",
"poll_process_output",
"(",
"process",
")",
":",
"assert",
"isinstance",
"(",
"process",
",",
"Process",
")",
",",
"'[internal] process is not a Process instance: %r'",
"%",
"process",
"if",
"process",
".",
"alive",
"(",
")",
":",
"logger",
".",
"debug",
... | Reads and returns the output to stdout and stderr for the supplied process. | [
"Reads",
"and",
"returns",
"the",
"output",
"to",
"stdout",
"and",
"stderr",
"for",
"the",
"supplied",
"process",
"."
] | [
"'''\n Reads and returns the output to stdout and stderr for the supplied process.\n This blocks until the process has either terminated, or has closed the\n output file descriptors.\n '''",
"# wait at most 3 seconds, and throw TimeoutExpired if that passes"
] | [
{
"param": "process",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "process",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
4e5801958ab9944c639f9e7f4c3db8dba59edd42 | mrmansano/sublime-ycmd | lib/process/filehandles.py | [
"MIT"
] | Python | configure_filehandles | null | def configure_filehandles(self, stdin=None, stdout=None, stderr=None):
'''
Sets the file handle behaviour for the launched process. Each handle
can be assigned one of the subprocess handle constants:
stdin = None, PIPE
stdout = None, PIPE, DEVNULL
stderr = Non... |
Sets the file handle behaviour for the launched process. Each handle
can be assigned one of the subprocess handle constants:
stdin = None, PIPE
stdout = None, PIPE, DEVNULL
stderr = None, PIPE, DEVNULL, STDOUT
These value gets forwarded directly to Popen.
... | Sets the file handle behaviour for the launched process. Each handle
can be assigned one of the subprocess handle constants:
stdin = None, PIPE
stdout = None, PIPE, DEVNULL
stderr = None, PIPE, DEVNULL, STDOUT
These value gets forwarded directly to Popen. | [
"Sets",
"the",
"file",
"handle",
"behaviour",
"for",
"the",
"launched",
"process",
".",
"Each",
"handle",
"can",
"be",
"assigned",
"one",
"of",
"the",
"subprocess",
"handle",
"constants",
":",
"stdin",
"=",
"None",
"PIPE",
"stdout",
"=",
"None",
"PIPE",
"D... | def configure_filehandles(self, stdin=None, stdout=None, stderr=None):
self.stdin = stdin
self.stdout = stdout
self.stderr = stderr | [
"def",
"configure_filehandles",
"(",
"self",
",",
"stdin",
"=",
"None",
",",
"stdout",
"=",
"None",
",",
"stderr",
"=",
"None",
")",
":",
"self",
".",
"stdin",
"=",
"stdin",
"self",
".",
"stdout",
"=",
"stdout",
"self",
".",
"stderr",
"=",
"stderr"
] | Sets the file handle behaviour for the launched process. | [
"Sets",
"the",
"file",
"handle",
"behaviour",
"for",
"the",
"launched",
"process",
"."
] | [
"'''\n Sets the file handle behaviour for the launched process. Each handle\n can be assigned one of the subprocess handle constants:\n stdin = None, PIPE\n stdout = None, PIPE, DEVNULL\n stderr = None, PIPE, DEVNULL, STDOUT\n These value gets forwarded directly... | [
{
"param": "self",
"type": null
},
{
"param": "stdin",
"type": null
},
{
"param": "stdout",
"type": null
},
{
"param": "stderr",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "stdin",
"type": null,
"docstring": null,
"docstring_tokens": ... |
4e5801958ab9944c639f9e7f4c3db8dba59edd42 | mrmansano/sublime-ycmd | lib/process/filehandles.py | [
"MIT"
] | Python | stdin | null | def stdin(self, stdin):
''' Sets the stdin file handle. '''
if not self.valid_filehandle(stdin):
raise ValueError('stdin handle must be a file instance')
if stdin == self.STDOUT:
# what?
raise ValueError('stdin handle cannot be redirected to stdout')
s... | Sets the stdin file handle. | Sets the stdin file handle. | [
"Sets",
"the",
"stdin",
"file",
"handle",
"."
] | def stdin(self, stdin):
if not self.valid_filehandle(stdin):
raise ValueError('stdin handle must be a file instance')
if stdin == self.STDOUT:
raise ValueError('stdin handle cannot be redirected to stdout')
self._stdin = stdin | [
"def",
"stdin",
"(",
"self",
",",
"stdin",
")",
":",
"if",
"not",
"self",
".",
"valid_filehandle",
"(",
"stdin",
")",
":",
"raise",
"ValueError",
"(",
"'stdin handle must be a file instance'",
")",
"if",
"stdin",
"==",
"self",
".",
"STDOUT",
":",
"raise",
... | Sets the stdin file handle. | [
"Sets",
"the",
"stdin",
"file",
"handle",
"."
] | [
"''' Sets the stdin file handle. '''",
"# what?"
] | [
{
"param": "self",
"type": null
},
{
"param": "stdin",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "stdin",
"type": null,
"docstring": null,
"docstring_tokens": ... |
796fd1de9cefc77441f708872ff195e90135afb1 | mrmansano/sublime-ycmd | lib/util/log.py | [
"MIT"
] | Python | strip_common_path_prefix | <not_specific> | def strip_common_path_prefix(basepath, relativeto=_SY_LIB_DIR):
'''
Strips the common prefix in a file path relative to the supplied path.
By default, this uses the directory of this script to compare against.
'''
assert isinstance(basepath, str), \
'basepath must be a string: %r' % basepath... |
Strips the common prefix in a file path relative to the supplied path.
By default, this uses the directory of this script to compare against.
| Strips the common prefix in a file path relative to the supplied path.
By default, this uses the directory of this script to compare against. | [
"Strips",
"the",
"common",
"prefix",
"in",
"a",
"file",
"path",
"relative",
"to",
"the",
"supplied",
"path",
".",
"By",
"default",
"this",
"uses",
"the",
"directory",
"of",
"this",
"script",
"to",
"compare",
"against",
"."
] | def strip_common_path_prefix(basepath, relativeto=_SY_LIB_DIR):
assert isinstance(basepath, str), \
'basepath must be a string: %r' % basepath
common_path_chars = os.path.commonprefix([basepath, relativeto])
common_path_components = os.path.split(common_path_chars)
common_path_prefix_str = commo... | [
"def",
"strip_common_path_prefix",
"(",
"basepath",
",",
"relativeto",
"=",
"_SY_LIB_DIR",
")",
":",
"assert",
"isinstance",
"(",
"basepath",
",",
"str",
")",
",",
"'basepath must be a string: %r'",
"%",
"basepath",
"common_path_chars",
"=",
"os",
".",
"path",
"."... | Strips the common prefix in a file path relative to the supplied path. | [
"Strips",
"the",
"common",
"prefix",
"in",
"a",
"file",
"path",
"relative",
"to",
"the",
"supplied",
"path",
"."
] | [
"'''\n Strips the common prefix in a file path relative to the supplied path.\n By default, this uses the directory of this script to compare against.\n '''",
"# Unfortunately, `os.path.commonpath` is only available in python 3.5+",
"# To be compatible with 3.3, need to use commonprefix and then proces... | [
{
"param": "basepath",
"type": null
},
{
"param": "relativeto",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "basepath",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "relativeto",
"type": null,
"docstring": null,
"docstring_... |
796fd1de9cefc77441f708872ff195e90135afb1 | mrmansano/sublime-ycmd | lib/util/log.py | [
"MIT"
] | Python | truncate_word_soft | <not_specific> | def truncate_word_soft(word):
'''
Applies light truncation to a name component. So far, this just removes
vowels (except first char). The result is probably not truncated by much.
'''
assert isinstance(word, str), \
'[internal] word is not a string: %r' % word
if not word:
return... |
Applies light truncation to a name component. So far, this just removes
vowels (except first char). The result is probably not truncated by much.
| Applies light truncation to a name component. So far, this just removes
vowels (except first char). The result is probably not truncated by much. | [
"Applies",
"light",
"truncation",
"to",
"a",
"name",
"component",
".",
"So",
"far",
"this",
"just",
"removes",
"vowels",
"(",
"except",
"first",
"char",
")",
".",
"The",
"result",
"is",
"probably",
"not",
"truncated",
"by",
"much",
"."
] | def truncate_word_soft(word):
assert isinstance(word, str), \
'[internal] word is not a string: %r' % word
if not word:
return word
vowel_removal_re = '[aeiouAEIOU]'
truncated_word = word[0] + re.sub(vowel_removal_re, '', word[1:])
return truncated_word | [
"def",
"truncate_word_soft",
"(",
"word",
")",
":",
"assert",
"isinstance",
"(",
"word",
",",
"str",
")",
",",
"'[internal] word is not a string: %r'",
"%",
"word",
"if",
"not",
"word",
":",
"return",
"word",
"vowel_removal_re",
"=",
"'[aeiouAEIOU]'",
"truncated_w... | Applies light truncation to a name component. | [
"Applies",
"light",
"truncation",
"to",
"a",
"name",
"component",
"."
] | [
"'''\n Applies light truncation to a name component. So far, this just removes\n vowels (except first char). The result is probably not truncated by much.\n '''"
] | [
{
"param": "word",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "word",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
796fd1de9cefc77441f708872ff195e90135afb1 | mrmansano/sublime-ycmd | lib/util/log.py | [
"MIT"
] | Python | truncate_word_hard | <not_specific> | def truncate_word_hard(word):
'''
Applies aggressive truncation to a name component. So far, this just
returns the first character of the supplied word. The result is very short.
'''
assert isinstance(word, str), \
'[internal] word is not a string: %r' % word
if word:
return word... |
Applies aggressive truncation to a name component. So far, this just
returns the first character of the supplied word. The result is very short.
| Applies aggressive truncation to a name component. So far, this just
returns the first character of the supplied word. The result is very short. | [
"Applies",
"aggressive",
"truncation",
"to",
"a",
"name",
"component",
".",
"So",
"far",
"this",
"just",
"returns",
"the",
"first",
"character",
"of",
"the",
"supplied",
"word",
".",
"The",
"result",
"is",
"very",
"short",
"."
] | def truncate_word_hard(word):
assert isinstance(word, str), \
'[internal] word is not a string: %r' % word
if word:
return word[0]
return word | [
"def",
"truncate_word_hard",
"(",
"word",
")",
":",
"assert",
"isinstance",
"(",
"word",
",",
"str",
")",
",",
"'[internal] word is not a string: %r'",
"%",
"word",
"if",
"word",
":",
"return",
"word",
"[",
"0",
"]",
"return",
"word"
] | Applies aggressive truncation to a name component. | [
"Applies",
"aggressive",
"truncation",
"to",
"a",
"name",
"component",
"."
] | [
"'''\n Applies aggressive truncation to a name component. So far, this just\n returns the first character of the supplied word. The result is very short.\n '''"
] | [
{
"param": "word",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "word",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
796fd1de9cefc77441f708872ff195e90135afb1 | mrmansano/sublime-ycmd | lib/util/log.py | [
"MIT"
] | Python | delimit_name_components | <not_specific> | def delimit_name_components(basestr):
'''
Splits a string into a list of identifiers and separators.
The original string can be reconstructed by joining the returned list.
'''
assert isinstance(basestr, str), \
'[internal] basestr is not a string: %r' % basestr
word_boundary_split_re = '... |
Splits a string into a list of identifiers and separators.
The original string can be reconstructed by joining the returned list.
| Splits a string into a list of identifiers and separators.
The original string can be reconstructed by joining the returned list. | [
"Splits",
"a",
"string",
"into",
"a",
"list",
"of",
"identifiers",
"and",
"separators",
".",
"The",
"original",
"string",
"can",
"be",
"reconstructed",
"by",
"joining",
"the",
"returned",
"list",
"."
] | def delimit_name_components(basestr):
assert isinstance(basestr, str), \
'[internal] basestr is not a string: %r' % basestr
word_boundary_split_re = '([^a-zA-Z0-9])'
split_components = re.split(word_boundary_split_re, basestr)
return split_components | [
"def",
"delimit_name_components",
"(",
"basestr",
")",
":",
"assert",
"isinstance",
"(",
"basestr",
",",
"str",
")",
",",
"'[internal] basestr is not a string: %r'",
"%",
"basestr",
"word_boundary_split_re",
"=",
"'([^a-zA-Z0-9])'",
"split_components",
"=",
"re",
".",
... | Splits a string into a list of identifiers and separators. | [
"Splits",
"a",
"string",
"into",
"a",
"list",
"of",
"identifiers",
"and",
"separators",
"."
] | [
"'''\n Splits a string into a list of identifiers and separators.\n The original string can be reconstructed by joining the returned list.\n '''"
] | [
{
"param": "basestr",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "basestr",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
796fd1de9cefc77441f708872ff195e90135afb1 | mrmansano/sublime-ycmd | lib/util/log.py | [
"MIT"
] | Python | smart_truncate | <not_specific> | def smart_truncate(basestr, maxlen):
'''
Truncates a string while trying to maintain human-readability. The logic is
quite limited. It can only truncate a few characters intelligently. If that
still isn't enough, certain parts will be arbitrarily removed...
'''
assert isinstance(basestr, str), \... |
Truncates a string while trying to maintain human-readability. The logic is
quite limited. It can only truncate a few characters intelligently. If that
still isn't enough, certain parts will be arbitrarily removed...
| Truncates a string while trying to maintain human-readability. The logic is
quite limited. It can only truncate a few characters intelligently. If that
still isn't enough, certain parts will be arbitrarily removed | [
"Truncates",
"a",
"string",
"while",
"trying",
"to",
"maintain",
"human",
"-",
"readability",
".",
"The",
"logic",
"is",
"quite",
"limited",
".",
"It",
"can",
"only",
"truncate",
"a",
"few",
"characters",
"intelligently",
".",
"If",
"that",
"still",
"isn",
... | def smart_truncate(basestr, maxlen):
assert isinstance(basestr, str), \
'basestr must be a string: %r' % basestr
assert isinstance(maxlen, int) and maxlen > 0, \
'invalid maximum length: %r' % maxlen
has_sep = os.path.sep and os.path.sep in basestr
has_altsep = os.path.altsep and os.path... | [
"def",
"smart_truncate",
"(",
"basestr",
",",
"maxlen",
")",
":",
"assert",
"isinstance",
"(",
"basestr",
",",
"str",
")",
",",
"'basestr must be a string: %r'",
"%",
"basestr",
"assert",
"isinstance",
"(",
"maxlen",
",",
"int",
")",
"and",
"maxlen",
">",
"0... | Truncates a string while trying to maintain human-readability. | [
"Truncates",
"a",
"string",
"while",
"trying",
"to",
"maintain",
"human",
"-",
"readability",
"."
] | [
"'''\n Truncates a string while trying to maintain human-readability. The logic is\n quite limited. It can only truncate a few characters intelligently. If that\n still isn't enough, certain parts will be arbitrarily removed...\n '''",
"# If it looks like a path, strip away the common prefix",
"# Ye... | [
{
"param": "basestr",
"type": null
},
{
"param": "maxlen",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "basestr",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "maxlen",
"type": null,
"docstring": null,
"docstring_token... |
796fd1de9cefc77441f708872ff195e90135afb1 | mrmansano/sublime-ycmd | lib/util/log.py | [
"MIT"
] | Python | apply_truncate_until_satisfied | <not_specific> | def apply_truncate_until_satisfied(truncatefn):
'''
Applies the specified truncation function to the current working
components until the length requirement is satisfied. Returns `True` if
successful, and `False` if it was not enough. Either way, the current
component state is up... |
Applies the specified truncation function to the current working
components until the length requirement is satisfied. Returns `True` if
successful, and `False` if it was not enough. Either way, the current
component state is updated after the application.
| Applies the specified truncation function to the current working
components until the length requirement is satisfied. Returns `True` if
successful, and `False` if it was not enough. Either way, the current
component state is updated after the application. | [
"Applies",
"the",
"specified",
"truncation",
"function",
"to",
"the",
"current",
"working",
"components",
"until",
"the",
"length",
"requirement",
"is",
"satisfied",
".",
"Returns",
"`",
"True",
"`",
"if",
"successful",
"and",
"`",
"False",
"`",
"if",
"it",
... | def apply_truncate_until_satisfied(truncatefn):
for i, component in enumerate(current_components):
truncated_component = truncatefn(component)
current_components[i] = truncated_component
if get_current_length() <= maxlen:
return True
return False | [
"def",
"apply_truncate_until_satisfied",
"(",
"truncatefn",
")",
":",
"for",
"i",
",",
"component",
"in",
"enumerate",
"(",
"current_components",
")",
":",
"truncated_component",
"=",
"truncatefn",
"(",
"component",
")",
"current_components",
"[",
"i",
"]",
"=",
... | Applies the specified truncation function to the current working
components until the length requirement is satisfied. | [
"Applies",
"the",
"specified",
"truncation",
"function",
"to",
"the",
"current",
"working",
"components",
"until",
"the",
"length",
"requirement",
"is",
"satisfied",
"."
] | [
"'''\n Applies the specified truncation function to the current working\n components until the length requirement is satisfied. Returns `True` if\n successful, and `False` if it was not enough. Either way, the current\n component state is updated after the application.\n '''"
] | [
{
"param": "truncatefn",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "truncatefn",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
796fd1de9cefc77441f708872ff195e90135afb1 | mrmansano/sublime-ycmd | lib/util/log.py | [
"MIT"
] | Python | format_record_entry | <not_specific> | def format_record_entry(name, length):
'''
Formats the entry for `name` by truncating it to a maximum of
`length` characters. Updates the `record` in place.
'''
if not isinstance(name, str):
if self._debug:
logger.error('inv... |
Formats the entry for `name` by truncating it to a maximum of
`length` characters. Updates the `record` in place.
| Formats the entry for `name` by truncating it to a maximum of
`length` characters. Updates the `record` in place. | [
"Formats",
"the",
"entry",
"for",
"`",
"name",
"`",
"by",
"truncating",
"it",
"to",
"a",
"maximum",
"of",
"`",
"length",
"`",
"characters",
".",
"Updates",
"the",
"`",
"record",
"`",
"in",
"place",
"."
] | def format_record_entry(name, length):
if not isinstance(name, str):
if self._debug:
logger.error('invalid formattable field: %r', name)
return
if not isinstance(length, int):
if self._debug:
logger.error('in... | [
"def",
"format_record_entry",
"(",
"name",
",",
"length",
")",
":",
"if",
"not",
"isinstance",
"(",
"name",
",",
"str",
")",
":",
"if",
"self",
".",
"_debug",
":",
"logger",
".",
"error",
"(",
"'invalid formattable field: %r'",
",",
"name",
")",
"return",
... | Formats the entry for `name` by truncating it to a maximum of
`length` characters. | [
"Formats",
"the",
"entry",
"for",
"`",
"name",
"`",
"by",
"truncating",
"it",
"to",
"a",
"maximum",
"of",
"`",
"length",
"`",
"characters",
"."
] | [
"'''\n Formats the entry for `name` by truncating it to a maximum of\n `length` characters. Updates the `record` in place.\n '''",
"# name not in it, so nothing to format",
"# not a str, don't format it, it's hard to handle it right..."
] | [
{
"param": "name",
"type": null
},
{
"param": "length",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "name",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "length",
"type": null,
"docstring": null,
"docstring_tokens":... |
796fd1de9cefc77441f708872ff195e90135afb1 | mrmansano/sublime-ycmd | lib/util/log.py | [
"MIT"
] | Python | parse_fields | <not_specific> | def parse_fields(fmt, style='%', default=None):
'''
Parses and yields template fields in a format string.
For %-style formatting, these look like: '%(foo)15s', where '15' refers to
the field width for 'foo'.
NOTE : This is a best-effort implementation. It might not work 100%.
'''
if style ... |
Parses and yields template fields in a format string.
For %-style formatting, these look like: '%(foo)15s', where '15' refers to
the field width for 'foo'.
NOTE : This is a best-effort implementation. It might not work 100%.
| Parses and yields template fields in a format string.
NOTE : This is a best-effort implementation. It might not work 100%. | [
"Parses",
"and",
"yields",
"template",
"fields",
"in",
"a",
"format",
"string",
".",
"NOTE",
":",
"This",
"is",
"a",
"best",
"-",
"effort",
"implementation",
".",
"It",
"might",
"not",
"work",
"100%",
"."
] | def parse_fields(fmt, style='%', default=None):
if style != '%':
raise NotImplementedError(
'unimplemented: field width for non %%-style formats' % ()
)
def _get_parser():
field_pattern = ''.join((
r'%',
r'(?:\((?P<name>\w+)\))?',
r'(?P<zer... | [
"def",
"parse_fields",
"(",
"fmt",
",",
"style",
"=",
"'%'",
",",
"default",
"=",
"None",
")",
":",
"if",
"style",
"!=",
"'%'",
":",
"raise",
"NotImplementedError",
"(",
"'unimplemented: field width for non %%-style formats'",
"%",
"(",
")",
")",
"def",
"_get_... | Parses and yields template fields in a format string. | [
"Parses",
"and",
"yields",
"template",
"fields",
"in",
"a",
"format",
"string",
"."
] | [
"'''\n Parses and yields template fields in a format string.\n\n For %-style formatting, these look like: '%(foo)15s', where '15' refers to\n the field width for 'foo'.\n\n NOTE : This is a best-effort implementation. It might not work 100%.\n '''",
"'''\n Compiles and returns a regex parser... | [
{
"param": "fmt",
"type": null
},
{
"param": "style",
"type": null
},
{
"param": "default",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "fmt",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "style",
"type": null,
"docstring": null,
"docstring_tokens": [... |
796fd1de9cefc77441f708872ff195e90135afb1 | mrmansano/sublime-ycmd | lib/util/log.py | [
"MIT"
] | Python | _get_parser | <not_specific> | def _get_parser():
'''
Compiles and returns a regex parser for parsing fields.
The regex matches something in the form: '%(foo) 15s'
% - prefix
(name) - named field (optional)
0 - for numbers, left pad with 0, override space (optional)
- ... |
Compiles and returns a regex parser for parsing fields.
The regex matches something in the form: '%(foo) 15s'
% - prefix
(name) - named field (optional)
0 - for numbers, left pad with 0, override space (optional)
- - left-pad, override 0 (opti... | Compiles and returns a regex parser for parsing fields.
NOTE : Attribute names must match regex parameter names. | [
"Compiles",
"and",
"returns",
"a",
"regex",
"parser",
"for",
"parsing",
"fields",
".",
"NOTE",
":",
"Attribute",
"names",
"must",
"match",
"regex",
"parameter",
"names",
"."
] | def _get_parser():
field_pattern = ''.join((
r'%',
r'(?:\((?P<name>\w+)\))?',
r'(?P<zero>0)?',
r'(?P<minus>-)?',
r'(?P<space>\s)?',
r'(?P<plus>\+)?',
r'(?P<width>\d+)?',
r'(?P<point>(?:\.\d+))?',
r'(?P<co... | [
"def",
"_get_parser",
"(",
")",
":",
"field_pattern",
"=",
"''",
".",
"join",
"(",
"(",
"r'%'",
",",
"r'(?:\\((?P<name>\\w+)\\))?'",
",",
"r'(?P<zero>0)?'",
",",
"r'(?P<minus>-)?'",
",",
"r'(?P<space>\\s)?'",
",",
"r'(?P<plus>\\+)?'",
",",
"r'(?P<width>\\d+)?'",
","... | Compiles and returns a regex parser for parsing fields. | [
"Compiles",
"and",
"returns",
"a",
"regex",
"parser",
"for",
"parsing",
"fields",
"."
] | [
"'''\n Compiles and returns a regex parser for parsing fields.\n\n The regex matches something in the form: '%(foo) 15s'\n % - prefix\n (name) - named field (optional)\n 0 - for numbers, left pad with 0, override space (optional)\n - - left-pad, o... | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
899c24a0ff552ad4a3c0a8368be240b2b3373006 | mrmansano/sublime-ycmd | lib/util/dict.py | [
"MIT"
] | Python | is_collection | <not_specific> | def is_collection(value):
'''
Returns true if `value` is a collection-like object.
Examples of these are lists and dictionaries.
Examples of non-collection objects are numbers and strings.
'''
if isinstance(value, (tuple, list, dict)):
# collections for sure
return True
col... |
Returns true if `value` is a collection-like object.
Examples of these are lists and dictionaries.
Examples of non-collection objects are numbers and strings.
| Returns true if `value` is a collection-like object.
Examples of these are lists and dictionaries.
Examples of non-collection objects are numbers and strings. | [
"Returns",
"true",
"if",
"`",
"value",
"`",
"is",
"a",
"collection",
"-",
"like",
"object",
".",
"Examples",
"of",
"these",
"are",
"lists",
"and",
"dictionaries",
".",
"Examples",
"of",
"non",
"-",
"collection",
"objects",
"are",
"numbers",
"and",
"strings... | def is_collection(value):
if isinstance(value, (tuple, list, dict)):
return True
collection_attrs = (
'__getitem__', '__setitem__', '__delitem__',
'__iter__', '__contains__',
)
for collection_attr in collection_attrs:
if not hasattr(value, collection_attr):
re... | [
"def",
"is_collection",
"(",
"value",
")",
":",
"if",
"isinstance",
"(",
"value",
",",
"(",
"tuple",
",",
"list",
",",
"dict",
")",
")",
":",
"return",
"True",
"collection_attrs",
"=",
"(",
"'__getitem__'",
",",
"'__setitem__'",
",",
"'__delitem__'",
",",
... | Returns true if `value` is a collection-like object. | [
"Returns",
"true",
"if",
"`",
"value",
"`",
"is",
"a",
"collection",
"-",
"like",
"object",
"."
] | [
"'''\n Returns true if `value` is a collection-like object.\n\n Examples of these are lists and dictionaries.\n Examples of non-collection objects are numbers and strings.\n '''",
"# collections for sure",
"# this is not necessarily true, but required for the implementation",
"# of `merge_dicts` b... | [
{
"param": "value",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "value",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
7bdb25f3c436492dffeef2814527cbc7141f9ecd | mrmansano/sublime-ycmd | lib/subl/errors.py | [
"MIT"
] | Python | desc | <not_specific> | def desc(self):
'''
Generic description for error type.
This is a broad description based on the class/sub-type. To be used
along side the message.
'''
return 'Plugin error' |
Generic description for error type.
This is a broad description based on the class/sub-type. To be used
along side the message.
| Generic description for error type.
This is a broad description based on the class/sub-type. To be used
along side the message. | [
"Generic",
"description",
"for",
"error",
"type",
".",
"This",
"is",
"a",
"broad",
"description",
"based",
"on",
"the",
"class",
"/",
"sub",
"-",
"type",
".",
"To",
"be",
"used",
"along",
"side",
"the",
"message",
"."
] | def desc(self):
return 'Plugin error' | [
"def",
"desc",
"(",
"self",
")",
":",
"return",
"'Plugin error'"
] | Generic description for error type. | [
"Generic",
"description",
"for",
"error",
"type",
"."
] | [
"'''\n Generic description for error type.\n\n This is a broad description based on the class/sub-type. To be used\n along side the message.\n '''"
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
7ad593208a2c2b60e6cc3a8ea4f095fdc2d29b71 | mrmansano/sublime-ycmd | lib/task/pool.py | [
"MIT"
] | Python | shutdown | <not_specific> | def shutdown(self, wait=True, timeout=None):
'''
Posts a quit message to all running workers.
If `wait` is truthy, then this call will also block until all worker
threads have returned. Otherwise, this method will return immediately
after posting the quit message (`timeout` will... |
Posts a quit message to all running workers.
If `wait` is truthy, then this call will also block until all worker
threads have returned. Otherwise, this method will return immediately
after posting the quit message (`timeout` will be ignored).
If `timeout` is given along with ... | Posts a quit message to all running workers.
If `wait` is truthy, then this call will also block until all worker
threads have returned. Otherwise, this method will return immediately
after posting the quit message (`timeout` will be ignored).
The `timeout` parameter is shared between all join operations. It is
poss... | [
"Posts",
"a",
"quit",
"message",
"to",
"all",
"running",
"workers",
".",
"If",
"`",
"wait",
"`",
"is",
"truthy",
"then",
"this",
"call",
"will",
"also",
"block",
"until",
"all",
"worker",
"threads",
"have",
"returned",
".",
"Otherwise",
"this",
"method",
... | def shutdown(self, wait=True, timeout=None):
with self._lock:
self._running = False
self._queue.put(None)
wait_result = True
if wait:
workers = list(self._workers)
for worker in workers:
try:
worker.join(timeou... | [
"def",
"shutdown",
"(",
"self",
",",
"wait",
"=",
"True",
",",
"timeout",
"=",
"None",
")",
":",
"with",
"self",
".",
"_lock",
":",
"self",
".",
"_running",
"=",
"False",
"self",
".",
"_queue",
".",
"put",
"(",
"None",
")",
"wait_result",
"=",
"Tru... | Posts a quit message to all running workers. | [
"Posts",
"a",
"quit",
"message",
"to",
"all",
"running",
"workers",
"."
] | [
"'''\n Posts a quit message to all running workers.\n\n If `wait` is truthy, then this call will also block until all worker\n threads have returned. Otherwise, this method will return immediately\n after posting the quit message (`timeout` will be ignored).\n\n If `timeout` is gi... | [
{
"param": "self",
"type": null
},
{
"param": "wait",
"type": null
},
{
"param": "timeout",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "wait",
"type": null,
"docstring": null,
"docstring_tokens": [... |
7ad593208a2c2b60e6cc3a8ea4f095fdc2d29b71 | mrmansano/sublime-ycmd | lib/task/pool.py | [
"MIT"
] | Python | disown_task_pool | <not_specific> | def disown_task_pool(task_pool, name=None, daemon=None):
'''
Shuts down a task pool on a daemon thread. The thread allows the task pool
to run to completion. Once it is completed, the thread itself terminates.
NOTE : It is possible to store a weak ref to the pool, just in case.
That hasn't b... |
Shuts down a task pool on a daemon thread. The thread allows the task pool
to run to completion. Once it is completed, the thread itself terminates.
NOTE : It is possible to store a weak ref to the pool, just in case.
That hasn't been necessary during testing, so don't bother.
| Shuts down a task pool on a daemon thread. The thread allows the task pool
to run to completion. Once it is completed, the thread itself terminates.
NOTE : It is possible to store a weak ref to the pool, just in case.
That hasn't been necessary during testing, so don't bother. | [
"Shuts",
"down",
"a",
"task",
"pool",
"on",
"a",
"daemon",
"thread",
".",
"The",
"thread",
"allows",
"the",
"task",
"pool",
"to",
"run",
"to",
"completion",
".",
"Once",
"it",
"is",
"completed",
"the",
"thread",
"itself",
"terminates",
".",
"NOTE",
":",
... | def disown_task_pool(task_pool, name=None, daemon=None):
if name is None:
name = generate_id('shutdown-task-pool-')
if daemon is None:
daemon = True
_TASK_POOL_SHUTDOWN_GRACE = (5 * 60)
def shutdown_task_pool(task_pool=task_pool,
timeout=_TASK_POOL_SHUT... | [
"def",
"disown_task_pool",
"(",
"task_pool",
",",
"name",
"=",
"None",
",",
"daemon",
"=",
"None",
")",
":",
"if",
"name",
"is",
"None",
":",
"name",
"=",
"generate_id",
"(",
"'shutdown-task-pool-'",
")",
"if",
"daemon",
"is",
"None",
":",
"daemon",
"=",... | Shuts down a task pool on a daemon thread. | [
"Shuts",
"down",
"a",
"task",
"pool",
"on",
"a",
"daemon",
"thread",
"."
] | [
"'''\n Shuts down a task pool on a daemon thread. The thread allows the task pool\n to run to completion. Once it is completed, the thread itself terminates.\n\n NOTE : It is possible to store a weak ref to the pool, just in case.\n That hasn't been necessary during testing, so don't bother.\n ... | [
{
"param": "task_pool",
"type": null
},
{
"param": "name",
"type": null
},
{
"param": "daemon",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "task_pool",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "name",
"type": null,
"docstring": null,
"docstring_token... |
772b2050a0ac9c36c8d8d9da4cacd17bf74a7f81 | ZAurele/alpha-py | libs/user_lib.py | [
"MIT"
] | Python | __get_user_data | <not_specific> | def __get_user_data(value, column):
"""Get the user role associated with given column."""
return DB.select(
User, filters=[User.__dict__[column] == value], first=True, json=True
) | Get the user role associated with given column. | Get the user role associated with given column. | [
"Get",
"the",
"user",
"role",
"associated",
"with",
"given",
"column",
"."
] | def __get_user_data(value, column):
return DB.select(
User, filters=[User.__dict__[column] == value], first=True, json=True
) | [
"def",
"__get_user_data",
"(",
"value",
",",
"column",
")",
":",
"return",
"DB",
".",
"select",
"(",
"User",
",",
"filters",
"=",
"[",
"User",
".",
"__dict__",
"[",
"column",
"]",
"==",
"value",
"]",
",",
"first",
"=",
"True",
",",
"json",
"=",
"Tr... | Get the user role associated with given column. | [
"Get",
"the",
"user",
"role",
"associated",
"with",
"given",
"column",
"."
] | [
"\"\"\"Get the user role associated with given column.\"\"\""
] | [
{
"param": "value",
"type": null
},
{
"param": "column",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "value",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "column",
"type": null,
"docstring": null,
"docstring_tokens"... |
0c8e1fdf90f326bbc25b354edad5bfd7a5312ea0 | ZAurele/alpha-py | models/watcher.py | [
"MIT"
] | Python | _watch_file | null | def _watch_file(self, file_name, module):
"Add a watch for a specific file, and map said file to a module name"
file_name = os.path.realpath(file_name)
self.mod_map[file_name] = module
self.wm.add_watch(file_name, pyinotify.EventsCodes.IN_MODIFY)
#print 'Watching', file_name | Add a watch for a specific file, and map said file to a module name | Add a watch for a specific file, and map said file to a module name | [
"Add",
"a",
"watch",
"for",
"a",
"specific",
"file",
"and",
"map",
"said",
"file",
"to",
"a",
"module",
"name"
] | def _watch_file(self, file_name, module):
file_name = os.path.realpath(file_name)
self.mod_map[file_name] = module
self.wm.add_watch(file_name, pyinotify.EventsCodes.IN_MODIFY) | [
"def",
"_watch_file",
"(",
"self",
",",
"file_name",
",",
"module",
")",
":",
"file_name",
"=",
"os",
".",
"path",
".",
"realpath",
"(",
"file_name",
")",
"self",
".",
"mod_map",
"[",
"file_name",
"]",
"=",
"module",
"self",
".",
"wm",
".",
"add_watch"... | Add a watch for a specific file, and map said file to a module name | [
"Add",
"a",
"watch",
"for",
"a",
"specific",
"file",
"and",
"map",
"said",
"file",
"to",
"a",
"module",
"name"
] | [
"\"Add a watch for a specific file, and map said file to a module name\"",
"#print 'Watching', file_name"
] | [
{
"param": "self",
"type": null
},
{
"param": "file_name",
"type": null
},
{
"param": "module",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "file_name",
"type": null,
"docstring": null,
"docstring_token... |
0c8e1fdf90f326bbc25b354edad5bfd7a5312ea0 | ZAurele/alpha-py | models/watcher.py | [
"MIT"
] | Python | watch_module | <not_specific> | def watch_module(self, name):
"Load a module, determine which files it uses, and watch them"
if imp.is_builtin(name) != 0:
# Pretty pointless to watch built-in modules
return
(fd, pathname, description) = imp.find_module(name)
try:
mod = imp.load_mo... | Load a module, determine which files it uses, and watch them | Load a module, determine which files it uses, and watch them | [
"Load",
"a",
"module",
"determine",
"which",
"files",
"it",
"uses",
"and",
"watch",
"them"
] | def watch_module(self, name):
if imp.is_builtin(name) != 0:
return
(fd, pathname, description) = imp.find_module(name)
try:
mod = imp.load_module(name, fd, pathname, description)
if fd:
self._watch_file(fd.name, name)
else:
... | [
"def",
"watch_module",
"(",
"self",
",",
"name",
")",
":",
"if",
"imp",
".",
"is_builtin",
"(",
"name",
")",
"!=",
"0",
":",
"return",
"(",
"fd",
",",
"pathname",
",",
"description",
")",
"=",
"imp",
".",
"find_module",
"(",
"name",
")",
"try",
":"... | Load a module, determine which files it uses, and watch them | [
"Load",
"a",
"module",
"determine",
"which",
"files",
"it",
"uses",
"and",
"watch",
"them"
] | [
"\"Load a module, determine which files it uses, and watch them\"",
"# Pretty pointless to watch built-in modules"
] | [
{
"param": "self",
"type": null
},
{
"param": "name",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "name",
"type": null,
"docstring": null,
"docstring_tokens": [... |
0c8e1fdf90f326bbc25b354edad5bfd7a5312ea0 | ZAurele/alpha-py | models/watcher.py | [
"MIT"
] | Python | process_IN_MODIFY | <not_specific> | def process_IN_MODIFY(self, event):
"A file of interest has changed"
# Is it a file I know about?
if event.path not in self.mod_map:
return
# Find out which module is using that file
modname = self.mod_map[event.path]
# Reload the module
(fd, pathna... | A file of interest has changed | A file of interest has changed | [
"A",
"file",
"of",
"interest",
"has",
"changed"
] | def process_IN_MODIFY(self, event):
if event.path not in self.mod_map:
return
modname = self.mod_map[event.path]
(fd, pathname, description) = imp.find_module(modname)
try:
imp.load_module(modname, fd, pathname, description)
finally:
if fd:
... | [
"def",
"process_IN_MODIFY",
"(",
"self",
",",
"event",
")",
":",
"if",
"event",
".",
"path",
"not",
"in",
"self",
".",
"mod_map",
":",
"return",
"modname",
"=",
"self",
".",
"mod_map",
"[",
"event",
".",
"path",
"]",
"(",
"fd",
",",
"pathname",
",",
... | A file of interest has changed | [
"A",
"file",
"of",
"interest",
"has",
"changed"
] | [
"\"A file of interest has changed\"",
"# Is it a file I know about?",
"# Find out which module is using that file",
"# Reload the module"
] | [
{
"param": "self",
"type": null
},
{
"param": "event",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "event",
"type": null,
"docstring": null,
"docstring_tokens": ... |
cbf060edc1772d363adf1c26792d6d7ce28b72a4 | ZAurele/alpha-py | libs/json_lib.py | [
"MIT"
] | Python | jsonify_database_models | <not_specific> | def jsonify_database_models(model: DefaultMeta, first=False):
"""Convert a database model structure to json
Args:
model (DefaultMeta): database mode structure
first (bool, optional): [description]. Defaults to False.
Returns:
[type]: [description]
"""
schema = mode... | Convert a database model structure to json
Args:
model (DefaultMeta): database mode structure
first (bool, optional): [description]. Defaults to False.
Returns:
[type]: [description]
| Convert a database model structure to json | [
"Convert",
"a",
"database",
"model",
"structure",
"to",
"json"
] | def jsonify_database_models(model: DefaultMeta, first=False):
schema = model.get_schema()
structures = schema()
results_json = structures.dump(model)
return results_json | [
"def",
"jsonify_database_models",
"(",
"model",
":",
"DefaultMeta",
",",
"first",
"=",
"False",
")",
":",
"schema",
"=",
"model",
".",
"get_schema",
"(",
")",
"structures",
"=",
"schema",
"(",
")",
"results_json",
"=",
"structures",
".",
"dump",
"(",
"mode... | Convert a database model structure to json | [
"Convert",
"a",
"database",
"model",
"structure",
"to",
"json"
] | [
"\"\"\"Convert a database model structure to json\n\n Args:\n model (DefaultMeta): database mode structure\n first (bool, optional): [description]. Defaults to False.\n\n Returns:\n [type]: [description]\n \"\"\"",
"#schema(many=True) if not first else ",
"# ? wtf why does it works... | [
{
"param": "model",
"type": "DefaultMeta"
},
{
"param": "first",
"type": null
}
] | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": "[type]"
}
],
"raises": [],
"params": [
{
"identifier": "model",
"type": "DefaultMeta",
"docstring": "database mode structure",
"docstring_tokens": [
"database"... |
cbf060edc1772d363adf1c26792d6d7ce28b72a4 | ZAurele/alpha-py | libs/json_lib.py | [
"MIT"
] | Python | jsonify_data | <not_specific> | def jsonify_data(data):
"""Convert any data to a json structure
Args:
data ([type]): data to convert
Returns:
[type]: data converted as a json structure
"""
if type(data) == list:
result = [jsonify_data(x) for x in data]
elif type(data) == dict:
result = {jsonif... | Convert any data to a json structure
Args:
data ([type]): data to convert
Returns:
[type]: data converted as a json structure
| Convert any data to a json structure | [
"Convert",
"any",
"data",
"to",
"a",
"json",
"structure"
] | def jsonify_data(data):
if type(data) == list:
result = [jsonify_data(x) for x in data]
elif type(data) == dict:
result = {jsonify_data(x):jsonify_data(y) for x,y in data.items()}
elif type(data) == Row:
result = dict(data)
else:
result = data
if hasattr(data,"sch... | [
"def",
"jsonify_data",
"(",
"data",
")",
":",
"if",
"type",
"(",
"data",
")",
"==",
"list",
":",
"result",
"=",
"[",
"jsonify_data",
"(",
"x",
")",
"for",
"x",
"in",
"data",
"]",
"elif",
"type",
"(",
"data",
")",
"==",
"dict",
":",
"result",
"=",... | Convert any data to a json structure | [
"Convert",
"any",
"data",
"to",
"a",
"json",
"structure"
] | [
"\"\"\"Convert any data to a json structure\n\n Args:\n data ([type]): data to convert\n\n Returns:\n [type]: data converted as a json structure\n \"\"\""
] | [
{
"param": "data",
"type": null
}
] | {
"returns": [
{
"docstring": "data converted as a json structure",
"docstring_tokens": [
"data",
"converted",
"as",
"a",
"json",
"structure"
],
"type": "[type]"
}
],
"raises": [],
"params": [
{
"identifier": "data",
... |
c7883529990a0c2645ec5cdc360cb8128fb26ff5 | ZAurele/alpha-py | libs/converter_lib.py | [
"MIT"
] | Python | ascii_compress | <not_specific> | def ascii_compress(data, level=9):
""" compress data to printable ascii-code """
code = zlib.compress(data, level)
csum = zlib.crc32(code)
code = base64.encodestring(code)
return code, csum | compress data to printable ascii-code | compress data to printable ascii-code | [
"compress",
"data",
"to",
"printable",
"ascii",
"-",
"code"
] | def ascii_compress(data, level=9):
code = zlib.compress(data, level)
csum = zlib.crc32(code)
code = base64.encodestring(code)
return code, csum | [
"def",
"ascii_compress",
"(",
"data",
",",
"level",
"=",
"9",
")",
":",
"code",
"=",
"zlib",
".",
"compress",
"(",
"data",
",",
"level",
")",
"csum",
"=",
"zlib",
".",
"crc32",
"(",
"code",
")",
"code",
"=",
"base64",
".",
"encodestring",
"(",
"cod... | compress data to printable ascii-code | [
"compress",
"data",
"to",
"printable",
"ascii",
"-",
"code"
] | [
"\"\"\" compress data to printable ascii-code \"\"\""
] | [
{
"param": "data",
"type": null
},
{
"param": "level",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "data",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "level",
"type": null,
"docstring": null,
"docstring_tokens": ... |
abebfd90f2bf8e33e7f5013a22c280e214ac1884 | ZAurele/alpha-py | libs/io_lib.py | [
"MIT"
] | Python | archive_object | None | def archive_object(object_to_save,filename:str, ext:str=None,log=None) -> None:
"""Archive a Python object as a dump file
Args:
object_to_save ([type]): [Python object to save]
filename (str): [output filename]
ext (str, optional): [file extension]. Defaults to 'dmp'.
"""
ensure... | Archive a Python object as a dump file
Args:
object_to_save ([type]): [Python object to save]
filename (str): [output filename]
ext (str, optional): [file extension]. Defaults to 'dmp'.
| Archive a Python object as a dump file | [
"Archive",
"a",
"Python",
"object",
"as",
"a",
"dump",
"file"
] | def archive_object(object_to_save,filename:str, ext:str=None,log=None) -> None:
ensure_dir(filename)
if '.' in filename:
ext = filename.split('.')[-1]
filename = filename.replace("."+ext,'')
if ext is None:
ext = 'dmp'
if ext is not None and pathlib.Path(filename).suffix == '':
... | [
"def",
"archive_object",
"(",
"object_to_save",
",",
"filename",
":",
"str",
",",
"ext",
":",
"str",
"=",
"None",
",",
"log",
"=",
"None",
")",
"->",
"None",
":",
"ensure_dir",
"(",
"filename",
")",
"if",
"'.'",
"in",
"filename",
":",
"ext",
"=",
"fi... | Archive a Python object as a dump file | [
"Archive",
"a",
"Python",
"object",
"as",
"a",
"dump",
"file"
] | [
"\"\"\"Archive a Python object as a dump file\n\n Args:\n object_to_save ([type]): [Python object to save]\n filename (str): [output filename]\n ext (str, optional): [file extension]. Defaults to 'dmp'.\n \"\"\""
] | [
{
"param": "object_to_save",
"type": null
},
{
"param": "filename",
"type": "str"
},
{
"param": "ext",
"type": "str"
},
{
"param": "log",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "object_to_save",
"type": null,
"docstring": "[Python object to save]",
"docstring_tokens": [
"[",
"Python",
"object",
"to",
"save",
"]"
],
"default": null,
"is_... |
abebfd90f2bf8e33e7f5013a22c280e214ac1884 | ZAurele/alpha-py | libs/io_lib.py | [
"MIT"
] | Python | unarchive_object | <not_specific> | def unarchive_object(filename:str, ext:str=None):
"""[Unarchive a Python object from a dump file]
Args:
filename (str): [filename]
ext (str, optional): [file extension]. Defaults to 'dmp'.
Returns:
[type]: [Unarchived python object]
"""
if '.' in filename and ext is None:
... | [Unarchive a Python object from a dump file]
Args:
filename (str): [filename]
ext (str, optional): [file extension]. Defaults to 'dmp'.
Returns:
[type]: [Unarchived python object]
| [Unarchive a Python object from a dump file] | [
"[",
"Unarchive",
"a",
"Python",
"object",
"from",
"a",
"dump",
"file",
"]"
] | def unarchive_object(filename:str, ext:str=None):
if '.' in filename and ext is None:
ext = filename.split('.')[-1]
filename = filename.replace("." + ext,'')
if ext is None:
ext = 'dmp'
if ext is not None and pathlib.Path(filename).suffix == '':
filename = filename + '.' + ex... | [
"def",
"unarchive_object",
"(",
"filename",
":",
"str",
",",
"ext",
":",
"str",
"=",
"None",
")",
":",
"if",
"'.'",
"in",
"filename",
"and",
"ext",
"is",
"None",
":",
"ext",
"=",
"filename",
".",
"split",
"(",
"'.'",
")",
"[",
"-",
"1",
"]",
"fil... | [Unarchive a Python object from a dump file] | [
"[",
"Unarchive",
"a",
"Python",
"object",
"from",
"a",
"dump",
"file",
"]"
] | [
"\"\"\"[Unarchive a Python object from a dump file]\n\n Args:\n filename (str): [filename]\n ext (str, optional): [file extension]. Defaults to 'dmp'.\n\n Returns:\n [type]: [Unarchived python object]\n \"\"\""
] | [
{
"param": "filename",
"type": "str"
},
{
"param": "ext",
"type": "str"
}
] | {
"returns": [
{
"docstring": "[Unarchived python object]",
"docstring_tokens": [
"[",
"Unarchived",
"python",
"object",
"]"
],
"type": "[type]"
}
],
"raises": [],
"params": [
{
"identifier": "filename",
"type": "str",
... |
18c8a660f1c89f4782015f66cdb2ec59ab213eec | ZAurele/alpha-py | libs/events.py | [
"MIT"
] | Python | matchtime | <not_specific> | def matchtime(self, t):
"""Return True if this event should trigger at the specified datetime"""
return ((t.seconde in self.seconds) and
(t.minute in self.minutes) and
(t.hour in self.hours) and
(t.day in self.days) and
... | Return True if this event should trigger at the specified datetime | Return True if this event should trigger at the specified datetime | [
"Return",
"True",
"if",
"this",
"event",
"should",
"trigger",
"at",
"the",
"specified",
"datetime"
] | def matchtime(self, t):
return ((t.seconde in self.seconds) and
(t.minute in self.minutes) and
(t.hour in self.hours) and
(t.day in self.days) and
(t.month in self.months) and
(t.weekday() in self.weekdaw)... | [
"def",
"matchtime",
"(",
"self",
",",
"t",
")",
":",
"return",
"(",
"(",
"t",
".",
"seconde",
"in",
"self",
".",
"seconds",
")",
"and",
"(",
"t",
".",
"minute",
"in",
"self",
".",
"minutes",
")",
"and",
"(",
"t",
".",
"hour",
"in",
"self",
".",... | Return True if this event should trigger at the specified datetime | [
"Return",
"True",
"if",
"this",
"event",
"should",
"trigger",
"at",
"the",
"specified",
"datetime"
] | [
"\"\"\"Return True if this event should trigger at the specified datetime\"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "t",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "t",
"type": null,
"docstring": null,
"docstring_tokens": [],
... |
11b9df4eb4946ccd99577cc6eed4279c8eab3410 | ZAurele/alpha-py | utils/decorators.py | [
"MIT"
] | Python | overrides | <not_specific> | def overrides(interface_class):
"""
Function override annotation.
Corollary to @abc.abstractmethod where the override is not of an
abstractmethod.
Modified from answer https://stackoverflow.com/a/8313042/471376
"""
def confirm_override(method):
if method.__name__ not in dir(interface... |
Function override annotation.
Corollary to @abc.abstractmethod where the override is not of an
abstractmethod.
Modified from answer https://stackoverflow.com/a/8313042/471376
| Function override annotation.
Corollary to @abc.abstractmethod where the override is not of an
abstractmethod. | [
"Function",
"override",
"annotation",
".",
"Corollary",
"to",
"@abc",
".",
"abstractmethod",
"where",
"the",
"override",
"is",
"not",
"of",
"an",
"abstractmethod",
"."
] | def overrides(interface_class):
def confirm_override(method):
if method.__name__ not in dir(interface_class):
raise NotImplementedError('function "%s" is an @override but that'
' function is not implemented in base'
' cl... | [
"def",
"overrides",
"(",
"interface_class",
")",
":",
"def",
"confirm_override",
"(",
"method",
")",
":",
"if",
"method",
".",
"__name__",
"not",
"in",
"dir",
"(",
"interface_class",
")",
":",
"raise",
"NotImplementedError",
"(",
"'function \"%s\" is an @override ... | Function override annotation. | [
"Function",
"override",
"annotation",
"."
] | [
"\"\"\"\n Function override annotation.\n Corollary to @abc.abstractmethod where the override is not of an\n abstractmethod.\n Modified from answer https://stackoverflow.com/a/8313042/471376\n \"\"\""
] | [
{
"param": "interface_class",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "interface_class",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
9bef32df87f9f6e9c4cc8e95bb2f8d6e4545f091 | ZAurele/alpha-py | models/api/_structures.py | [
"MIT"
] | Python | check_is_admin | bool | def check_is_admin(self) -> bool:
"""Check if user is an admin or not.
Args:
log ([type], optional): [description]. Defaults to None.
Returns:
bool: [description]
"""
route = self.get_current_route()
user_data = _utils.get_logged_user()
... | Check if user is an admin or not.
Args:
log ([type], optional): [description]. Defaults to None.
Returns:
bool: [description]
| Check if user is an admin or not. | [
"Check",
"if",
"user",
"is",
"an",
"admin",
"or",
"not",
"."
] | def check_is_admin(self) -> bool:
route = self.get_current_route()
user_data = _utils.get_logged_user()
if user_data is not None:
if user_data["role"] >= 9:
return True
else:
self.warning("Wrong permission: %s is not an admin"%user_data)
... | [
"def",
"check_is_admin",
"(",
"self",
")",
"->",
"bool",
":",
"route",
"=",
"self",
".",
"get_current_route",
"(",
")",
"user_data",
"=",
"_utils",
".",
"get_logged_user",
"(",
")",
"if",
"user_data",
"is",
"not",
"None",
":",
"if",
"user_data",
"[",
"\"... | Check if user is an admin or not. | [
"Check",
"if",
"user",
"is",
"an",
"admin",
"or",
"not",
"."
] | [
"\"\"\"Check if user is an admin or not.\n\n Args:\n log ([type], optional): [description]. Defaults to None.\n\n Returns:\n bool: [description]\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": "bool"
}
],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
... |
2b03b97041b58f1a26e480c1aea49e05b8485e96 | ZAurele/alpha-py | libs/flask_lib.py | [
"MIT"
] | Python | load_views | List[ModelView] | def load_views(log) -> List[ModelView]:
"""[Load view from tables definitions module]
Args:
module (ModuleType): [description]
Returns:
List[ModelView]: [description]
"""
log.info("START Loading views models")
views = []
for schema, cf in TABLES.items():
db, tables... | [Load view from tables definitions module]
Args:
module (ModuleType): [description]
Returns:
List[ModelView]: [description]
| [Load view from tables definitions module] | [
"[",
"Load",
"view",
"from",
"tables",
"definitions",
"module",
"]"
] | def load_views(log) -> List[ModelView]:
log.info("START Loading views models")
views = []
for schema, cf in TABLES.items():
db, tables = cf["db"], cf["tables"]
for table_name, class_object in tables.items():
if class_object is None:
continue
attributes... | [
"def",
"load_views",
"(",
"log",
")",
"->",
"List",
"[",
"ModelView",
"]",
":",
"log",
".",
"info",
"(",
"\"START Loading views models\"",
")",
"views",
"=",
"[",
"]",
"for",
"schema",
",",
"cf",
"in",
"TABLES",
".",
"items",
"(",
")",
":",
"db",
","... | [Load view from tables definitions module] | [
"[",
"Load",
"view",
"from",
"tables",
"definitions",
"module",
"]"
] | [
"\"\"\"[Load view from tables definitions module]\n\n Args:\n module (ModuleType): [description]\n\n Returns:\n List[ModelView]: [description]\n \"\"\"",
"# log.error('Cannot get class for table <%s>'%table_name)"
] | [
{
"param": "log",
"type": null
}
] | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": "List[ModelView]"
}
],
"raises": [],
"params": [
{
"identifier": "log",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_option... |
ef0b1e90a414cd10b99ab947636c1ca2151cab55 | dwabece/flatlist | flatlist/__init__.py | [
"WTFPL"
] | Python | flatten_list | <not_specific> | def flatten_list(input_list):
"""
Flattens list with many nested lists.
>>> flatten_list([1, [2, [3], [4]]])
[1, 2, 3, 4]
"""
result = []
for item in input_list:
if isinstance(item, list):
result.extend(flatten_list(item))
# yield from flatten_list(item)
... |
Flattens list with many nested lists.
>>> flatten_list([1, [2, [3], [4]]])
[1, 2, 3, 4]
| Flattens list with many nested lists. | [
"Flattens",
"list",
"with",
"many",
"nested",
"lists",
"."
] | def flatten_list(input_list):
result = []
for item in input_list:
if isinstance(item, list):
result.extend(flatten_list(item))
else:
result.append(item)
return result | [
"def",
"flatten_list",
"(",
"input_list",
")",
":",
"result",
"=",
"[",
"]",
"for",
"item",
"in",
"input_list",
":",
"if",
"isinstance",
"(",
"item",
",",
"list",
")",
":",
"result",
".",
"extend",
"(",
"flatten_list",
"(",
"item",
")",
")",
"else",
... | Flattens list with many nested lists. | [
"Flattens",
"list",
"with",
"many",
"nested",
"lists",
"."
] | [
"\"\"\"\n Flattens list with many nested lists.\n\n >>> flatten_list([1, [2, [3], [4]]])\n [1, 2, 3, 4]\n \"\"\"",
"# yield from flatten_list(item)",
"# yield item"
] | [
{
"param": "input_list",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "input_list",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.