repository_name stringlengths 7 55 | func_path_in_repository stringlengths 4 223 | func_name stringlengths 1 134 | whole_func_string stringlengths 75 104k | language stringclasses 1
value | func_code_string stringlengths 75 104k | func_code_tokens listlengths 19 28.4k | func_documentation_string stringlengths 1 46.9k | func_documentation_tokens listlengths 1 1.97k | split_name stringclasses 1
value | func_code_url stringlengths 87 315 |
|---|---|---|---|---|---|---|---|---|---|---|
GoogleCloudPlatform/python-repo-tools | gcp_devrel/tools/appengine.py | fixup_version | def fixup_version(destination, version):
"""Newer releases of the SDK do not have the version number set correctly
in the VERSION file. Fix it up."""
version_path = os.path.join(
destination, 'google_appengine', 'VERSION')
with open(version_path, 'r') as f:
version_data = f.read()
... | python | def fixup_version(destination, version):
"""Newer releases of the SDK do not have the version number set correctly
in the VERSION file. Fix it up."""
version_path = os.path.join(
destination, 'google_appengine', 'VERSION')
with open(version_path, 'r') as f:
version_data = f.read()
... | [
"def",
"fixup_version",
"(",
"destination",
",",
"version",
")",
":",
"version_path",
"=",
"os",
".",
"path",
".",
"join",
"(",
"destination",
",",
"'google_appengine'",
",",
"'VERSION'",
")",
"with",
"open",
"(",
"version_path",
",",
"'r'",
")",
"as",
"f"... | Newer releases of the SDK do not have the version number set correctly
in the VERSION file. Fix it up. | [
"Newer",
"releases",
"of",
"the",
"SDK",
"do",
"not",
"have",
"the",
"version",
"number",
"set",
"correctly",
"in",
"the",
"VERSION",
"file",
".",
"Fix",
"it",
"up",
"."
] | train | https://github.com/GoogleCloudPlatform/python-repo-tools/blob/87422ba91814529848a2b8bf8be4294283a3e041/gcp_devrel/tools/appengine.py#L105-L119 |
GoogleCloudPlatform/python-repo-tools | gcp_devrel/tools/appengine.py | download_command | def download_command(args):
"""Downloads and extracts the latest App Engine SDK to the given
destination."""
latest_two_versions = list(reversed(get_gae_versions()))[:2]
zip = None
version_number = None
for version in latest_two_versions:
if is_existing_up_to_date(args.destination, ver... | python | def download_command(args):
"""Downloads and extracts the latest App Engine SDK to the given
destination."""
latest_two_versions = list(reversed(get_gae_versions()))[:2]
zip = None
version_number = None
for version in latest_two_versions:
if is_existing_up_to_date(args.destination, ver... | [
"def",
"download_command",
"(",
"args",
")",
":",
"latest_two_versions",
"=",
"list",
"(",
"reversed",
"(",
"get_gae_versions",
"(",
")",
")",
")",
"[",
":",
"2",
"]",
"zip",
"=",
"None",
"version_number",
"=",
"None",
"for",
"version",
"in",
"latest_two_v... | Downloads and extracts the latest App Engine SDK to the given
destination. | [
"Downloads",
"and",
"extracts",
"the",
"latest",
"App",
"Engine",
"SDK",
"to",
"the",
"given",
"destination",
"."
] | train | https://github.com/GoogleCloudPlatform/python-repo-tools/blob/87422ba91814529848a2b8bf8be4294283a3e041/gcp_devrel/tools/appengine.py#L122-L155 |
pyQode/pyqode.core | pyqode/core/cache.py | Cache.preferred_encodings | def preferred_encodings(self):
"""
The list of user defined encodings, for display in the encodings
menu/combobox.
"""
default_encodings = [
locale.getpreferredencoding().lower().replace('-', '_')]
if 'utf_8' not in default_encodings:
default_enco... | python | def preferred_encodings(self):
"""
The list of user defined encodings, for display in the encodings
menu/combobox.
"""
default_encodings = [
locale.getpreferredencoding().lower().replace('-', '_')]
if 'utf_8' not in default_encodings:
default_enco... | [
"def",
"preferred_encodings",
"(",
"self",
")",
":",
"default_encodings",
"=",
"[",
"locale",
".",
"getpreferredencoding",
"(",
")",
".",
"lower",
"(",
")",
".",
"replace",
"(",
"'-'",
",",
"'_'",
")",
"]",
"if",
"'utf_8'",
"not",
"in",
"default_encodings"... | The list of user defined encodings, for display in the encodings
menu/combobox. | [
"The",
"list",
"of",
"user",
"defined",
"encodings",
"for",
"display",
"in",
"the",
"encodings",
"menu",
"/",
"combobox",
"."
] | train | https://github.com/pyQode/pyqode.core/blob/a99ec6cd22d519394f613309412f8329dc4e90cb/pyqode/core/cache.py#L51-L63 |
pyQode/pyqode.core | pyqode/core/cache.py | Cache.get_file_encoding | def get_file_encoding(self, file_path, preferred_encoding=None):
"""
Gets an eventual cached encoding for file_path.
Raises a KeyError if no encoding were cached for the specified file
path.
:param file_path: path of the file to look up
:returns: The cached encoding.
... | python | def get_file_encoding(self, file_path, preferred_encoding=None):
"""
Gets an eventual cached encoding for file_path.
Raises a KeyError if no encoding were cached for the specified file
path.
:param file_path: path of the file to look up
:returns: The cached encoding.
... | [
"def",
"get_file_encoding",
"(",
"self",
",",
"file_path",
",",
"preferred_encoding",
"=",
"None",
")",
":",
"_logger",
"(",
")",
".",
"debug",
"(",
"'getting encoding for %s'",
",",
"file_path",
")",
"try",
":",
"map",
"=",
"json",
".",
"loads",
"(",
"sel... | Gets an eventual cached encoding for file_path.
Raises a KeyError if no encoding were cached for the specified file
path.
:param file_path: path of the file to look up
:returns: The cached encoding. | [
"Gets",
"an",
"eventual",
"cached",
"encoding",
"for",
"file_path",
"."
] | train | https://github.com/pyQode/pyqode.core/blob/a99ec6cd22d519394f613309412f8329dc4e90cb/pyqode/core/cache.py#L72-L102 |
pyQode/pyqode.core | pyqode/core/cache.py | Cache.set_file_encoding | def set_file_encoding(self, path, encoding):
"""
Cache encoding for the specified file path.
:param path: path of the file to cache
:param encoding: encoding to cache
"""
try:
map = json.loads(self._settings.value('cachedFileEncodings'))
except TypeEr... | python | def set_file_encoding(self, path, encoding):
"""
Cache encoding for the specified file path.
:param path: path of the file to cache
:param encoding: encoding to cache
"""
try:
map = json.loads(self._settings.value('cachedFileEncodings'))
except TypeEr... | [
"def",
"set_file_encoding",
"(",
"self",
",",
"path",
",",
"encoding",
")",
":",
"try",
":",
"map",
"=",
"json",
".",
"loads",
"(",
"self",
".",
"_settings",
".",
"value",
"(",
"'cachedFileEncodings'",
")",
")",
"except",
"TypeError",
":",
"map",
"=",
... | Cache encoding for the specified file path.
:param path: path of the file to cache
:param encoding: encoding to cache | [
"Cache",
"encoding",
"for",
"the",
"specified",
"file",
"path",
"."
] | train | https://github.com/pyQode/pyqode.core/blob/a99ec6cd22d519394f613309412f8329dc4e90cb/pyqode/core/cache.py#L104-L116 |
pyQode/pyqode.core | pyqode/core/cache.py | Cache.get_cursor_position | def get_cursor_position(self, file_path):
"""
Gets the cached cursor position for file_path
:param file_path: path of the file in the cache
:return: Cached cursor position or (0, 0)
"""
try:
map = json.loads(self._settings.value('cachedCursorPosition'))
... | python | def get_cursor_position(self, file_path):
"""
Gets the cached cursor position for file_path
:param file_path: path of the file in the cache
:return: Cached cursor position or (0, 0)
"""
try:
map = json.loads(self._settings.value('cachedCursorPosition'))
... | [
"def",
"get_cursor_position",
"(",
"self",
",",
"file_path",
")",
":",
"try",
":",
"map",
"=",
"json",
".",
"loads",
"(",
"self",
".",
"_settings",
".",
"value",
"(",
"'cachedCursorPosition'",
")",
")",
"except",
"TypeError",
":",
"map",
"=",
"{",
"}",
... | Gets the cached cursor position for file_path
:param file_path: path of the file in the cache
:return: Cached cursor position or (0, 0) | [
"Gets",
"the",
"cached",
"cursor",
"position",
"for",
"file_path"
] | train | https://github.com/pyQode/pyqode.core/blob/a99ec6cd22d519394f613309412f8329dc4e90cb/pyqode/core/cache.py#L118-L137 |
pyQode/pyqode.core | pyqode/core/cache.py | Cache.set_cursor_position | def set_cursor_position(self, path, position):
"""
Cache encoding for the specified file path.
:param path: path of the file to cache
:param position: cursor position to cache
"""
try:
map = json.loads(self._settings.value('cachedCursorPosition'))
exc... | python | def set_cursor_position(self, path, position):
"""
Cache encoding for the specified file path.
:param path: path of the file to cache
:param position: cursor position to cache
"""
try:
map = json.loads(self._settings.value('cachedCursorPosition'))
exc... | [
"def",
"set_cursor_position",
"(",
"self",
",",
"path",
",",
"position",
")",
":",
"try",
":",
"map",
"=",
"json",
".",
"loads",
"(",
"self",
".",
"_settings",
".",
"value",
"(",
"'cachedCursorPosition'",
")",
")",
"except",
"TypeError",
":",
"map",
"=",... | Cache encoding for the specified file path.
:param path: path of the file to cache
:param position: cursor position to cache | [
"Cache",
"encoding",
"for",
"the",
"specified",
"file",
"path",
"."
] | train | https://github.com/pyQode/pyqode.core/blob/a99ec6cd22d519394f613309412f8329dc4e90cb/pyqode/core/cache.py#L139-L151 |
pyQode/pyqode.core | pyqode/core/widgets/output_window.py | _mid | def _mid(string, start, end=None):
"""
Returns a substring delimited by start and end position.
"""
if end is None:
end = len(string)
return string[start:start + end] | python | def _mid(string, start, end=None):
"""
Returns a substring delimited by start and end position.
"""
if end is None:
end = len(string)
return string[start:start + end] | [
"def",
"_mid",
"(",
"string",
",",
"start",
",",
"end",
"=",
"None",
")",
":",
"if",
"end",
"is",
"None",
":",
"end",
"=",
"len",
"(",
"string",
")",
"return",
"string",
"[",
"start",
":",
"start",
"+",
"end",
"]"
] | Returns a substring delimited by start and end position. | [
"Returns",
"a",
"substring",
"delimited",
"by",
"start",
"and",
"end",
"position",
"."
] | train | https://github.com/pyQode/pyqode.core/blob/a99ec6cd22d519394f613309412f8329dc4e90cb/pyqode/core/widgets/output_window.py#L753-L759 |
pyQode/pyqode.core | pyqode/core/widgets/output_window.py | _ansi_color | def _ansi_color(code, theme):
"""
Converts an ansi code to a QColor, taking the color scheme (theme) into account.
"""
red = 170 if code & 1 else 0
green = 170 if code & 2 else 0
blue = 170 if code & 4 else 0
color = QtGui.QColor(red, green, blue)
if theme is not None:
mappings =... | python | def _ansi_color(code, theme):
"""
Converts an ansi code to a QColor, taking the color scheme (theme) into account.
"""
red = 170 if code & 1 else 0
green = 170 if code & 2 else 0
blue = 170 if code & 4 else 0
color = QtGui.QColor(red, green, blue)
if theme is not None:
mappings =... | [
"def",
"_ansi_color",
"(",
"code",
",",
"theme",
")",
":",
"red",
"=",
"170",
"if",
"code",
"&",
"1",
"else",
"0",
"green",
"=",
"170",
"if",
"code",
"&",
"2",
"else",
"0",
"blue",
"=",
"170",
"if",
"code",
"&",
"4",
"else",
"0",
"color",
"=",
... | Converts an ansi code to a QColor, taking the color scheme (theme) into account. | [
"Converts",
"an",
"ansi",
"code",
"to",
"a",
"QColor",
"taking",
"the",
"color",
"scheme",
"(",
"theme",
")",
"into",
"account",
"."
] | train | https://github.com/pyQode/pyqode.core/blob/a99ec6cd22d519394f613309412f8329dc4e90cb/pyqode/core/widgets/output_window.py#L762-L785 |
pyQode/pyqode.core | pyqode/core/widgets/output_window.py | _qkey_to_ascii | def _qkey_to_ascii(event):
"""
(Try to) convert the Qt key event to the corresponding ASCII sequence for
the terminal. This works fine for standard alphanumerical characters, but
most other characters require terminal specific control_modifier sequences.
The conversion below works for TERM="linux' t... | python | def _qkey_to_ascii(event):
"""
(Try to) convert the Qt key event to the corresponding ASCII sequence for
the terminal. This works fine for standard alphanumerical characters, but
most other characters require terminal specific control_modifier sequences.
The conversion below works for TERM="linux' t... | [
"def",
"_qkey_to_ascii",
"(",
"event",
")",
":",
"if",
"sys",
".",
"platform",
"==",
"'darwin'",
":",
"control_modifier",
"=",
"QtCore",
".",
"Qt",
".",
"MetaModifier",
"else",
":",
"control_modifier",
"=",
"QtCore",
".",
"Qt",
".",
"ControlModifier",
"ctrl"... | (Try to) convert the Qt key event to the corresponding ASCII sequence for
the terminal. This works fine for standard alphanumerical characters, but
most other characters require terminal specific control_modifier sequences.
The conversion below works for TERM="linux' terminals. | [
"(",
"Try",
"to",
")",
"convert",
"the",
"Qt",
"key",
"event",
"to",
"the",
"corresponding",
"ASCII",
"sequence",
"for",
"the",
"terminal",
".",
"This",
"works",
"fine",
"for",
"standard",
"alphanumerical",
"characters",
"but",
"most",
"other",
"characters",
... | train | https://github.com/pyQode/pyqode.core/blob/a99ec6cd22d519394f613309412f8329dc4e90cb/pyqode/core/widgets/output_window.py#L825-L917 |
pyQode/pyqode.core | pyqode/core/widgets/output_window.py | OutputWindow.is_running | def is_running(self):
"""
Checks if the child process is running (or is starting).
"""
return self._process.state() in [self._process.Running, self._process.Starting] | python | def is_running(self):
"""
Checks if the child process is running (or is starting).
"""
return self._process.state() in [self._process.Running, self._process.Starting] | [
"def",
"is_running",
"(",
"self",
")",
":",
"return",
"self",
".",
"_process",
".",
"state",
"(",
")",
"in",
"[",
"self",
".",
"_process",
".",
"Running",
",",
"self",
".",
"_process",
".",
"Starting",
"]"
] | Checks if the child process is running (or is starting). | [
"Checks",
"if",
"the",
"child",
"process",
"is",
"running",
"(",
"or",
"is",
"starting",
")",
"."
] | train | https://github.com/pyQode/pyqode.core/blob/a99ec6cd22d519394f613309412f8329dc4e90cb/pyqode/core/widgets/output_window.py#L78-L82 |
pyQode/pyqode.core | pyqode/core/widgets/output_window.py | OutputWindow.start_process | def start_process(self, program, arguments=None, working_dir=None, print_command=True,
use_pseudo_terminal=True, env=None):
"""
Starts the child process.
:param program: program to start
:param arguments: list of program arguments
:param working_dir: workin... | python | def start_process(self, program, arguments=None, working_dir=None, print_command=True,
use_pseudo_terminal=True, env=None):
"""
Starts the child process.
:param program: program to start
:param arguments: list of program arguments
:param working_dir: workin... | [
"def",
"start_process",
"(",
"self",
",",
"program",
",",
"arguments",
"=",
"None",
",",
"working_dir",
"=",
"None",
",",
"print_command",
"=",
"True",
",",
"use_pseudo_terminal",
"=",
"True",
",",
"env",
"=",
"None",
")",
":",
"# clear previous output",
"se... | Starts the child process.
:param program: program to start
:param arguments: list of program arguments
:param working_dir: working directory of the child process
:param print_command: True to print the full command (pgm + arguments) as the first line
of the output window
... | [
"Starts",
"the",
"child",
"process",
"."
] | train | https://github.com/pyQode/pyqode.core/blob/a99ec6cd22d519394f613309412f8329dc4e90cb/pyqode/core/widgets/output_window.py#L143-L179 |
pyQode/pyqode.core | pyqode/core/widgets/output_window.py | OutputWindow.stop_process | def stop_process(self):
"""
Stops the child process.
"""
self._process.terminate()
if not self._process.waitForFinished(100):
self._process.kill() | python | def stop_process(self):
"""
Stops the child process.
"""
self._process.terminate()
if not self._process.waitForFinished(100):
self._process.kill() | [
"def",
"stop_process",
"(",
"self",
")",
":",
"self",
".",
"_process",
".",
"terminate",
"(",
")",
"if",
"not",
"self",
".",
"_process",
".",
"waitForFinished",
"(",
"100",
")",
":",
"self",
".",
"_process",
".",
"kill",
"(",
")"
] | Stops the child process. | [
"Stops",
"the",
"child",
"process",
"."
] | train | https://github.com/pyQode/pyqode.core/blob/a99ec6cd22d519394f613309412f8329dc4e90cb/pyqode/core/widgets/output_window.py#L181-L187 |
pyQode/pyqode.core | pyqode/core/widgets/output_window.py | OutputWindow.create_color_scheme | def create_color_scheme(background=None, foreground=None, error=None, custom=None, red=None,
green=None, yellow=None, blue=None, magenta=None, cyan=None):
"""
Utility function that creates a color scheme instance, with default values.
The default colors are chosen ba... | python | def create_color_scheme(background=None, foreground=None, error=None, custom=None, red=None,
green=None, yellow=None, blue=None, magenta=None, cyan=None):
"""
Utility function that creates a color scheme instance, with default values.
The default colors are chosen ba... | [
"def",
"create_color_scheme",
"(",
"background",
"=",
"None",
",",
"foreground",
"=",
"None",
",",
"error",
"=",
"None",
",",
"custom",
"=",
"None",
",",
"red",
"=",
"None",
",",
"green",
"=",
"None",
",",
"yellow",
"=",
"None",
",",
"blue",
"=",
"No... | Utility function that creates a color scheme instance, with default values.
The default colors are chosen based on the current palette.
:param background: background color
:param foreground: foreground color
:param error: color of error messages (stderr)
:param custom: color of... | [
"Utility",
"function",
"that",
"creates",
"a",
"color",
"scheme",
"instance",
"with",
"default",
"values",
"."
] | train | https://github.com/pyQode/pyqode.core/blob/a99ec6cd22d519394f613309412f8329dc4e90cb/pyqode/core/widgets/output_window.py#L196-L255 |
pyQode/pyqode.core | pyqode/core/widgets/output_window.py | OutputWindow.closeEvent | def closeEvent(self, event):
"""
Terminates the child process on close.
"""
self.stop_process()
self.backend.stop()
try:
self.modes.remove('_LinkHighlighter')
except KeyError:
pass # already removed
super(OutputWindow, self).closeE... | python | def closeEvent(self, event):
"""
Terminates the child process on close.
"""
self.stop_process()
self.backend.stop()
try:
self.modes.remove('_LinkHighlighter')
except KeyError:
pass # already removed
super(OutputWindow, self).closeE... | [
"def",
"closeEvent",
"(",
"self",
",",
"event",
")",
":",
"self",
".",
"stop_process",
"(",
")",
"self",
".",
"backend",
".",
"stop",
"(",
")",
"try",
":",
"self",
".",
"modes",
".",
"remove",
"(",
"'_LinkHighlighter'",
")",
"except",
"KeyError",
":",
... | Terminates the child process on close. | [
"Terminates",
"the",
"child",
"process",
"on",
"close",
"."
] | train | https://github.com/pyQode/pyqode.core/blob/a99ec6cd22d519394f613309412f8329dc4e90cb/pyqode/core/widgets/output_window.py#L263-L273 |
pyQode/pyqode.core | pyqode/core/widgets/output_window.py | OutputWindow.keyPressEvent | def keyPressEvent(self, event):
"""
Handle key press event using the defined input handler.
"""
if self._process.state() != self._process.Running:
return
tc = self.textCursor()
sel_start = tc.selectionStart()
sel_end = tc.selectionEnd()
tc.setP... | python | def keyPressEvent(self, event):
"""
Handle key press event using the defined input handler.
"""
if self._process.state() != self._process.Running:
return
tc = self.textCursor()
sel_start = tc.selectionStart()
sel_end = tc.selectionEnd()
tc.setP... | [
"def",
"keyPressEvent",
"(",
"self",
",",
"event",
")",
":",
"if",
"self",
".",
"_process",
".",
"state",
"(",
")",
"!=",
"self",
".",
"_process",
".",
"Running",
":",
"return",
"tc",
"=",
"self",
".",
"textCursor",
"(",
")",
"sel_start",
"=",
"tc",
... | Handle key press event using the defined input handler. | [
"Handle",
"key",
"press",
"event",
"using",
"the",
"defined",
"input",
"handler",
"."
] | train | https://github.com/pyQode/pyqode.core/blob/a99ec6cd22d519394f613309412f8329dc4e90cb/pyqode/core/widgets/output_window.py#L275-L291 |
pyQode/pyqode.core | pyqode/core/widgets/output_window.py | OutputWindow.mouseMoveEvent | def mouseMoveEvent(self, event):
"""
Handle mouse over file link.
"""
c = self.cursorForPosition(event.pos())
block = c.block()
self._link_match = None
self.viewport().setCursor(QtCore.Qt.IBeamCursor)
for match in self.link_regex.finditer(block.text()):
... | python | def mouseMoveEvent(self, event):
"""
Handle mouse over file link.
"""
c = self.cursorForPosition(event.pos())
block = c.block()
self._link_match = None
self.viewport().setCursor(QtCore.Qt.IBeamCursor)
for match in self.link_regex.finditer(block.text()):
... | [
"def",
"mouseMoveEvent",
"(",
"self",
",",
"event",
")",
":",
"c",
"=",
"self",
".",
"cursorForPosition",
"(",
"event",
".",
"pos",
"(",
")",
")",
"block",
"=",
"c",
".",
"block",
"(",
")",
"self",
".",
"_link_match",
"=",
"None",
"self",
".",
"vie... | Handle mouse over file link. | [
"Handle",
"mouse",
"over",
"file",
"link",
"."
] | train | https://github.com/pyQode/pyqode.core/blob/a99ec6cd22d519394f613309412f8329dc4e90cb/pyqode/core/widgets/output_window.py#L293-L311 |
pyQode/pyqode.core | pyqode/core/widgets/output_window.py | OutputWindow.mousePressEvent | def mousePressEvent(self, event):
"""
Handle file link clicks.
"""
super(OutputWindow, self).mousePressEvent(event)
if self._link_match:
path = self._link_match.group('url')
line = self._link_match.group('line')
if line is not None:
... | python | def mousePressEvent(self, event):
"""
Handle file link clicks.
"""
super(OutputWindow, self).mousePressEvent(event)
if self._link_match:
path = self._link_match.group('url')
line = self._link_match.group('line')
if line is not None:
... | [
"def",
"mousePressEvent",
"(",
"self",
",",
"event",
")",
":",
"super",
"(",
"OutputWindow",
",",
"self",
")",
".",
"mousePressEvent",
"(",
"event",
")",
"if",
"self",
".",
"_link_match",
":",
"path",
"=",
"self",
".",
"_link_match",
".",
"group",
"(",
... | Handle file link clicks. | [
"Handle",
"file",
"link",
"clicks",
"."
] | train | https://github.com/pyQode/pyqode.core/blob/a99ec6cd22d519394f613309412f8329dc4e90cb/pyqode/core/widgets/output_window.py#L313-L325 |
pyQode/pyqode.core | pyqode/core/widgets/output_window.py | OutputWindow._init_code_edit | def _init_code_edit(self, backend):
"""
Initializes the code editor (setup modes, panels and colors).
"""
from pyqode.core import panels, modes
self.modes.append(_LinkHighlighter(self.document()))
self.background = self._formatter.color_scheme.background
self.fore... | python | def _init_code_edit(self, backend):
"""
Initializes the code editor (setup modes, panels and colors).
"""
from pyqode.core import panels, modes
self.modes.append(_LinkHighlighter(self.document()))
self.background = self._formatter.color_scheme.background
self.fore... | [
"def",
"_init_code_edit",
"(",
"self",
",",
"backend",
")",
":",
"from",
"pyqode",
".",
"core",
"import",
"panels",
",",
"modes",
"self",
".",
"modes",
".",
"append",
"(",
"_LinkHighlighter",
"(",
"self",
".",
"document",
"(",
")",
")",
")",
"self",
".... | Initializes the code editor (setup modes, panels and colors). | [
"Initializes",
"the",
"code",
"editor",
"(",
"setup",
"modes",
"panels",
"and",
"colors",
")",
"."
] | train | https://github.com/pyQode/pyqode.core/blob/a99ec6cd22d519394f613309412f8329dc4e90cb/pyqode/core/widgets/output_window.py#L333-L360 |
pyQode/pyqode.core | pyqode/core/widgets/output_window.py | OutputWindow._setup_process_environment | def _setup_process_environment(self, env):
"""
Sets up the process environment.
"""
environ = self._process.processEnvironment()
if env is None:
env = {}
for k, v in os.environ.items():
environ.insert(k, v)
for k, v in env.items():
... | python | def _setup_process_environment(self, env):
"""
Sets up the process environment.
"""
environ = self._process.processEnvironment()
if env is None:
env = {}
for k, v in os.environ.items():
environ.insert(k, v)
for k, v in env.items():
... | [
"def",
"_setup_process_environment",
"(",
"self",
",",
"env",
")",
":",
"environ",
"=",
"self",
".",
"_process",
".",
"processEnvironment",
"(",
")",
"if",
"env",
"is",
"None",
":",
"env",
"=",
"{",
"}",
"for",
"k",
",",
"v",
"in",
"os",
".",
"enviro... | Sets up the process environment. | [
"Sets",
"up",
"the",
"process",
"environment",
"."
] | train | https://github.com/pyQode/pyqode.core/blob/a99ec6cd22d519394f613309412f8329dc4e90cb/pyqode/core/widgets/output_window.py#L362-L379 |
pyQode/pyqode.core | pyqode/core/widgets/output_window.py | OutputWindow._on_process_error | def _on_process_error(self, error):
"""
Display child process error in the text edit.
"""
if self is None:
return
err = PROCESS_ERROR_STRING[error]
self._formatter.append_message(err + '\r\n', output_format=OutputFormat.ErrorMessageFormat) | python | def _on_process_error(self, error):
"""
Display child process error in the text edit.
"""
if self is None:
return
err = PROCESS_ERROR_STRING[error]
self._formatter.append_message(err + '\r\n', output_format=OutputFormat.ErrorMessageFormat) | [
"def",
"_on_process_error",
"(",
"self",
",",
"error",
")",
":",
"if",
"self",
"is",
"None",
":",
"return",
"err",
"=",
"PROCESS_ERROR_STRING",
"[",
"error",
"]",
"self",
".",
"_formatter",
".",
"append_message",
"(",
"err",
"+",
"'\\r\\n'",
",",
"output_f... | Display child process error in the text edit. | [
"Display",
"child",
"process",
"error",
"in",
"the",
"text",
"edit",
"."
] | train | https://github.com/pyQode/pyqode.core/blob/a99ec6cd22d519394f613309412f8329dc4e90cb/pyqode/core/widgets/output_window.py#L381-L388 |
pyQode/pyqode.core | pyqode/core/widgets/output_window.py | OutputWindow._on_process_finished | def _on_process_finished(self):
"""
Write the process finished message and emit the `finished` signal.
"""
exit_code = self._process.exitCode()
if self._process.exitStatus() != self._process.NormalExit:
exit_code = 139
self._formatter.append_message('\x1b[0m\n... | python | def _on_process_finished(self):
"""
Write the process finished message and emit the `finished` signal.
"""
exit_code = self._process.exitCode()
if self._process.exitStatus() != self._process.NormalExit:
exit_code = 139
self._formatter.append_message('\x1b[0m\n... | [
"def",
"_on_process_finished",
"(",
"self",
")",
":",
"exit_code",
"=",
"self",
".",
"_process",
".",
"exitCode",
"(",
")",
"if",
"self",
".",
"_process",
".",
"exitStatus",
"(",
")",
"!=",
"self",
".",
"_process",
".",
"NormalExit",
":",
"exit_code",
"=... | Write the process finished message and emit the `finished` signal. | [
"Write",
"the",
"process",
"finished",
"message",
"and",
"emit",
"the",
"finished",
"signal",
"."
] | train | https://github.com/pyQode/pyqode.core/blob/a99ec6cd22d519394f613309412f8329dc4e90cb/pyqode/core/widgets/output_window.py#L390-L400 |
pyQode/pyqode.core | pyqode/core/widgets/output_window.py | OutputWindow._read_stdout | def _read_stdout(self):
"""
Reads the child process' stdout and process it.
"""
output = self._decode(self._process.readAllStandardOutput().data())
if self._formatter:
self._formatter.append_message(output, output_format=OutputFormat.NormalMessageFormat)
else:... | python | def _read_stdout(self):
"""
Reads the child process' stdout and process it.
"""
output = self._decode(self._process.readAllStandardOutput().data())
if self._formatter:
self._formatter.append_message(output, output_format=OutputFormat.NormalMessageFormat)
else:... | [
"def",
"_read_stdout",
"(",
"self",
")",
":",
"output",
"=",
"self",
".",
"_decode",
"(",
"self",
".",
"_process",
".",
"readAllStandardOutput",
"(",
")",
".",
"data",
"(",
")",
")",
"if",
"self",
".",
"_formatter",
":",
"self",
".",
"_formatter",
".",... | Reads the child process' stdout and process it. | [
"Reads",
"the",
"child",
"process",
"stdout",
"and",
"process",
"it",
"."
] | train | https://github.com/pyQode/pyqode.core/blob/a99ec6cd22d519394f613309412f8329dc4e90cb/pyqode/core/widgets/output_window.py#L414-L422 |
pyQode/pyqode.core | pyqode/core/widgets/output_window.py | OutputWindow._read_stderr | def _read_stderr(self):
"""
Reads the child process' stderr and process it.
"""
output = self._decode(self._process.readAllStandardError().data())
if self._formatter:
self._formatter.append_message(output, output_format=OutputFormat.ErrorMessageFormat)
else:
... | python | def _read_stderr(self):
"""
Reads the child process' stderr and process it.
"""
output = self._decode(self._process.readAllStandardError().data())
if self._formatter:
self._formatter.append_message(output, output_format=OutputFormat.ErrorMessageFormat)
else:
... | [
"def",
"_read_stderr",
"(",
"self",
")",
":",
"output",
"=",
"self",
".",
"_decode",
"(",
"self",
".",
"_process",
".",
"readAllStandardError",
"(",
")",
".",
"data",
"(",
")",
")",
"if",
"self",
".",
"_formatter",
":",
"self",
".",
"_formatter",
".",
... | Reads the child process' stderr and process it. | [
"Reads",
"the",
"child",
"process",
"stderr",
"and",
"process",
"it",
"."
] | train | https://github.com/pyQode/pyqode.core/blob/a99ec6cd22d519394f613309412f8329dc4e90cb/pyqode/core/widgets/output_window.py#L424-L432 |
pyQode/pyqode.core | pyqode/core/widgets/output_window.py | AnsiEscapeCodeParser.parse_text | def parse_text(self, formatted_text):
"""
Retursn a list of operations (draw, cup, ed,...).
Each operation consist of a command and its associated data.
:param formatted_text: text to parse with the default char format to apply.
:return: list of Operation
"""
as... | python | def parse_text(self, formatted_text):
"""
Retursn a list of operations (draw, cup, ed,...).
Each operation consist of a command and its associated data.
:param formatted_text: text to parse with the default char format to apply.
:return: list of Operation
"""
as... | [
"def",
"parse_text",
"(",
"self",
",",
"formatted_text",
")",
":",
"assert",
"isinstance",
"(",
"formatted_text",
",",
"FormattedText",
")",
"ret_val",
"=",
"[",
"]",
"fmt",
"=",
"formatted_text",
".",
"fmt",
"if",
"self",
".",
"_prev_fmt_closed",
"else",
"s... | Retursn a list of operations (draw, cup, ed,...).
Each operation consist of a command and its associated data.
:param formatted_text: text to parse with the default char format to apply.
:return: list of Operation | [
"Retursn",
"a",
"list",
"of",
"operations",
"(",
"draw",
"cup",
"ed",
"...",
")",
"."
] | train | https://github.com/pyQode/pyqode.core/blob/a99ec6cd22d519394f613309412f8329dc4e90cb/pyqode/core/widgets/output_window.py#L537-L737 |
pyQode/pyqode.core | pyqode/core/widgets/output_window.py | AnsiEscapeCodeParser._set_format_scope | def _set_format_scope(self, fmt):
"""
Opens the format scope.
"""
self._prev_fmt = QtGui.QTextCharFormat(fmt)
self._prev_fmt_closed = False | python | def _set_format_scope(self, fmt):
"""
Opens the format scope.
"""
self._prev_fmt = QtGui.QTextCharFormat(fmt)
self._prev_fmt_closed = False | [
"def",
"_set_format_scope",
"(",
"self",
",",
"fmt",
")",
":",
"self",
".",
"_prev_fmt",
"=",
"QtGui",
".",
"QTextCharFormat",
"(",
"fmt",
")",
"self",
".",
"_prev_fmt_closed",
"=",
"False"
] | Opens the format scope. | [
"Opens",
"the",
"format",
"scope",
"."
] | train | https://github.com/pyQode/pyqode.core/blob/a99ec6cd22d519394f613309412f8329dc4e90cb/pyqode/core/widgets/output_window.py#L745-L750 |
pyQode/pyqode.core | pyqode/core/widgets/output_window.py | ImmediateInputHandler.key_press_event | def key_press_event(self, event):
"""
Directly writes the ascii code of the key to the process' stdin.
:retuns: False to prevent the event from being propagated to the parent widget.
"""
if event.key() == QtCore.Qt.Key_Return:
cursor = self.edit.textCursor()
... | python | def key_press_event(self, event):
"""
Directly writes the ascii code of the key to the process' stdin.
:retuns: False to prevent the event from being propagated to the parent widget.
"""
if event.key() == QtCore.Qt.Key_Return:
cursor = self.edit.textCursor()
... | [
"def",
"key_press_event",
"(",
"self",
",",
"event",
")",
":",
"if",
"event",
".",
"key",
"(",
")",
"==",
"QtCore",
".",
"Qt",
".",
"Key_Return",
":",
"cursor",
"=",
"self",
".",
"edit",
".",
"textCursor",
"(",
")",
"cursor",
".",
"movePosition",
"("... | Directly writes the ascii code of the key to the process' stdin.
:retuns: False to prevent the event from being propagated to the parent widget. | [
"Directly",
"writes",
"the",
"ascii",
"code",
"of",
"the",
"key",
"to",
"the",
"process",
"stdin",
"."
] | train | https://github.com/pyQode/pyqode.core/blob/a99ec6cd22d519394f613309412f8329dc4e90cb/pyqode/core/widgets/output_window.py#L805-L819 |
pyQode/pyqode.core | pyqode/core/widgets/output_window.py | CommandHistory.add_command | def add_command(self, command):
"""
Adds a command to the history and reset history index.
"""
try:
self._history.remove(command)
except ValueError:
pass
self._history.insert(0, command)
self._index = -1 | python | def add_command(self, command):
"""
Adds a command to the history and reset history index.
"""
try:
self._history.remove(command)
except ValueError:
pass
self._history.insert(0, command)
self._index = -1 | [
"def",
"add_command",
"(",
"self",
",",
"command",
")",
":",
"try",
":",
"self",
".",
"_history",
".",
"remove",
"(",
"command",
")",
"except",
"ValueError",
":",
"pass",
"self",
".",
"_history",
".",
"insert",
"(",
"0",
",",
"command",
")",
"self",
... | Adds a command to the history and reset history index. | [
"Adds",
"a",
"command",
"to",
"the",
"history",
"and",
"reset",
"history",
"index",
"."
] | train | https://github.com/pyQode/pyqode.core/blob/a99ec6cd22d519394f613309412f8329dc4e90cb/pyqode/core/widgets/output_window.py#L930-L939 |
pyQode/pyqode.core | pyqode/core/widgets/output_window.py | CommandHistory.scroll_up | def scroll_up(self):
"""
Returns the previous command, if any.
"""
self._index += 1
nb_commands = len(self._history)
if self._index >= nb_commands:
self._index = nb_commands - 1
try:
return self._history[self._index]
except IndexErr... | python | def scroll_up(self):
"""
Returns the previous command, if any.
"""
self._index += 1
nb_commands = len(self._history)
if self._index >= nb_commands:
self._index = nb_commands - 1
try:
return self._history[self._index]
except IndexErr... | [
"def",
"scroll_up",
"(",
"self",
")",
":",
"self",
".",
"_index",
"+=",
"1",
"nb_commands",
"=",
"len",
"(",
"self",
".",
"_history",
")",
"if",
"self",
".",
"_index",
">=",
"nb_commands",
":",
"self",
".",
"_index",
"=",
"nb_commands",
"-",
"1",
"tr... | Returns the previous command, if any. | [
"Returns",
"the",
"previous",
"command",
"if",
"any",
"."
] | train | https://github.com/pyQode/pyqode.core/blob/a99ec6cd22d519394f613309412f8329dc4e90cb/pyqode/core/widgets/output_window.py#L941-L952 |
pyQode/pyqode.core | pyqode/core/widgets/output_window.py | CommandHistory.scroll_down | def scroll_down(self):
"""
Returns the next command if any.
"""
self._index -= 1
if self._index < 0:
self._index = -1
return ''
try:
return self._history[self._index]
except IndexError:
return '' | python | def scroll_down(self):
"""
Returns the next command if any.
"""
self._index -= 1
if self._index < 0:
self._index = -1
return ''
try:
return self._history[self._index]
except IndexError:
return '' | [
"def",
"scroll_down",
"(",
"self",
")",
":",
"self",
".",
"_index",
"-=",
"1",
"if",
"self",
".",
"_index",
"<",
"0",
":",
"self",
".",
"_index",
"=",
"-",
"1",
"return",
"''",
"try",
":",
"return",
"self",
".",
"_history",
"[",
"self",
".",
"_in... | Returns the next command if any. | [
"Returns",
"the",
"next",
"command",
"if",
"any",
"."
] | train | https://github.com/pyQode/pyqode.core/blob/a99ec6cd22d519394f613309412f8329dc4e90cb/pyqode/core/widgets/output_window.py#L954-L965 |
pyQode/pyqode.core | pyqode/core/widgets/output_window.py | BufferedInputHandler._insert_command | def _insert_command(self, command):
"""
Insert command by replacing the current input buffer and display it on the text edit.
"""
self._clear_user_buffer()
tc = self.edit.textCursor()
tc.insertText(command)
self.edit.setTextCursor(tc) | python | def _insert_command(self, command):
"""
Insert command by replacing the current input buffer and display it on the text edit.
"""
self._clear_user_buffer()
tc = self.edit.textCursor()
tc.insertText(command)
self.edit.setTextCursor(tc) | [
"def",
"_insert_command",
"(",
"self",
",",
"command",
")",
":",
"self",
".",
"_clear_user_buffer",
"(",
")",
"tc",
"=",
"self",
".",
"edit",
".",
"textCursor",
"(",
")",
"tc",
".",
"insertText",
"(",
"command",
")",
"self",
".",
"edit",
".",
"setTextC... | Insert command by replacing the current input buffer and display it on the text edit. | [
"Insert",
"command",
"by",
"replacing",
"the",
"current",
"input",
"buffer",
"and",
"display",
"it",
"on",
"the",
"text",
"edit",
"."
] | train | https://github.com/pyQode/pyqode.core/blob/a99ec6cd22d519394f613309412f8329dc4e90cb/pyqode/core/widgets/output_window.py#L978-L985 |
pyQode/pyqode.core | pyqode/core/widgets/output_window.py | BufferedInputHandler.key_press_event | def key_press_event(self, event):
"""
Manages our own buffer and send it to the subprocess when user pressed RETURN.
"""
input_buffer = self._get_input_buffer()
ctrl = int(event.modifiers() & QtCore.Qt.ControlModifier) != 0
shift = int(event.modifiers() & QtCore.Qt.ShiftM... | python | def key_press_event(self, event):
"""
Manages our own buffer and send it to the subprocess when user pressed RETURN.
"""
input_buffer = self._get_input_buffer()
ctrl = int(event.modifiers() & QtCore.Qt.ControlModifier) != 0
shift = int(event.modifiers() & QtCore.Qt.ShiftM... | [
"def",
"key_press_event",
"(",
"self",
",",
"event",
")",
":",
"input_buffer",
"=",
"self",
".",
"_get_input_buffer",
"(",
")",
"ctrl",
"=",
"int",
"(",
"event",
".",
"modifiers",
"(",
")",
"&",
"QtCore",
".",
"Qt",
".",
"ControlModifier",
")",
"!=",
"... | Manages our own buffer and send it to the subprocess when user pressed RETURN. | [
"Manages",
"our",
"own",
"buffer",
"and",
"send",
"it",
"to",
"the",
"subprocess",
"when",
"user",
"pressed",
"RETURN",
"."
] | train | https://github.com/pyQode/pyqode.core/blob/a99ec6cd22d519394f613309412f8329dc4e90cb/pyqode/core/widgets/output_window.py#L1001-L1072 |
pyQode/pyqode.core | pyqode/core/widgets/output_window.py | OutputFormatter.append_message | def append_message(self, text, output_format=OutputFormat.NormalMessageFormat):
"""
Parses and append message to the text edit.
"""
self._append_message(text, self._formats[output_format]) | python | def append_message(self, text, output_format=OutputFormat.NormalMessageFormat):
"""
Parses and append message to the text edit.
"""
self._append_message(text, self._formats[output_format]) | [
"def",
"append_message",
"(",
"self",
",",
"text",
",",
"output_format",
"=",
"OutputFormat",
".",
"NormalMessageFormat",
")",
":",
"self",
".",
"_append_message",
"(",
"text",
",",
"self",
".",
"_formats",
"[",
"output_format",
"]",
")"
] | Parses and append message to the text edit. | [
"Parses",
"and",
"append",
"message",
"to",
"the",
"text",
"edit",
"."
] | train | https://github.com/pyQode/pyqode.core/blob/a99ec6cd22d519394f613309412f8329dc4e90cb/pyqode/core/widgets/output_window.py#L1128-L1132 |
pyQode/pyqode.core | pyqode/core/widgets/output_window.py | OutputFormatter._append_message | def _append_message(self, text, char_format):
"""
Parses text and executes parsed operations.
"""
self._cursor = self._text_edit.textCursor()
operations = self._parser.parse_text(FormattedText(text, char_format))
for i, operation in enumerate(operations):
try:... | python | def _append_message(self, text, char_format):
"""
Parses text and executes parsed operations.
"""
self._cursor = self._text_edit.textCursor()
operations = self._parser.parse_text(FormattedText(text, char_format))
for i, operation in enumerate(operations):
try:... | [
"def",
"_append_message",
"(",
"self",
",",
"text",
",",
"char_format",
")",
":",
"self",
".",
"_cursor",
"=",
"self",
".",
"_text_edit",
".",
"textCursor",
"(",
")",
"operations",
"=",
"self",
".",
"_parser",
".",
"parse_text",
"(",
"FormattedText",
"(",
... | Parses text and executes parsed operations. | [
"Parses",
"text",
"and",
"executes",
"parsed",
"operations",
"."
] | train | https://github.com/pyQode/pyqode.core/blob/a99ec6cd22d519394f613309412f8329dc4e90cb/pyqode/core/widgets/output_window.py#L1141-L1159 |
pyQode/pyqode.core | pyqode/core/widgets/output_window.py | OutputFormatter._init_formats | def _init_formats(self):
"""
Initialise default formats.
"""
theme = self._color_scheme
# normal message format
fmt = QtGui.QTextCharFormat()
fmt.setForeground(theme.foreground)
fmt.setBackground(theme.background)
self._formats[OutputFormat.NormalM... | python | def _init_formats(self):
"""
Initialise default formats.
"""
theme = self._color_scheme
# normal message format
fmt = QtGui.QTextCharFormat()
fmt.setForeground(theme.foreground)
fmt.setBackground(theme.background)
self._formats[OutputFormat.NormalM... | [
"def",
"_init_formats",
"(",
"self",
")",
":",
"theme",
"=",
"self",
".",
"_color_scheme",
"# normal message format",
"fmt",
"=",
"QtGui",
".",
"QTextCharFormat",
"(",
")",
"fmt",
".",
"setForeground",
"(",
"theme",
".",
"foreground",
")",
"fmt",
".",
"setBa... | Initialise default formats. | [
"Initialise",
"default",
"formats",
"."
] | train | https://github.com/pyQode/pyqode.core/blob/a99ec6cd22d519394f613309412f8329dc4e90cb/pyqode/core/widgets/output_window.py#L1161-L1182 |
pyQode/pyqode.core | pyqode/core/widgets/output_window.py | OutputFormatter._draw | def _draw(self, data):
"""
Draw text
"""
self._cursor.clearSelection()
self._cursor.setPosition(self._last_cursor_pos)
if '\x07' in data.txt:
print('\a')
txt = data.txt.replace('\x07', '')
if '\x08' in txt:
parts = txt.split('\x08... | python | def _draw(self, data):
"""
Draw text
"""
self._cursor.clearSelection()
self._cursor.setPosition(self._last_cursor_pos)
if '\x07' in data.txt:
print('\a')
txt = data.txt.replace('\x07', '')
if '\x08' in txt:
parts = txt.split('\x08... | [
"def",
"_draw",
"(",
"self",
",",
"data",
")",
":",
"self",
".",
"_cursor",
".",
"clearSelection",
"(",
")",
"self",
".",
"_cursor",
".",
"setPosition",
"(",
"self",
".",
"_last_cursor_pos",
")",
"if",
"'\\x07'",
"in",
"data",
".",
"txt",
":",
"print",... | Draw text | [
"Draw",
"text"
] | train | https://github.com/pyQode/pyqode.core/blob/a99ec6cd22d519394f613309412f8329dc4e90cb/pyqode/core/widgets/output_window.py#L1185-L1234 |
pyQode/pyqode.core | pyqode/core/widgets/output_window.py | OutputFormatter._draw_chars | def _draw_chars(self, data, to_draw):
"""
Draw the specified charachters using the specified format.
"""
i = 0
while not self._cursor.atBlockEnd() and i < len(to_draw) and len(to_draw) > 1:
self._cursor.deleteChar()
i += 1
self._cursor.insertText(t... | python | def _draw_chars(self, data, to_draw):
"""
Draw the specified charachters using the specified format.
"""
i = 0
while not self._cursor.atBlockEnd() and i < len(to_draw) and len(to_draw) > 1:
self._cursor.deleteChar()
i += 1
self._cursor.insertText(t... | [
"def",
"_draw_chars",
"(",
"self",
",",
"data",
",",
"to_draw",
")",
":",
"i",
"=",
"0",
"while",
"not",
"self",
".",
"_cursor",
".",
"atBlockEnd",
"(",
")",
"and",
"i",
"<",
"len",
"(",
"to_draw",
")",
"and",
"len",
"(",
"to_draw",
")",
">",
"1"... | Draw the specified charachters using the specified format. | [
"Draw",
"the",
"specified",
"charachters",
"using",
"the",
"specified",
"format",
"."
] | train | https://github.com/pyQode/pyqode.core/blob/a99ec6cd22d519394f613309412f8329dc4e90cb/pyqode/core/widgets/output_window.py#L1236-L1244 |
pyQode/pyqode.core | pyqode/core/widgets/output_window.py | OutputFormatter._linefeed | def _linefeed(self):
"""
Performs a line feed.
"""
last_line = self._cursor.blockNumber() == self._text_edit.blockCount() - 1
if self._cursor.atEnd() or last_line:
if last_line:
self._cursor.movePosition(self._cursor.EndOfBlock)
self._curso... | python | def _linefeed(self):
"""
Performs a line feed.
"""
last_line = self._cursor.blockNumber() == self._text_edit.blockCount() - 1
if self._cursor.atEnd() or last_line:
if last_line:
self._cursor.movePosition(self._cursor.EndOfBlock)
self._curso... | [
"def",
"_linefeed",
"(",
"self",
")",
":",
"last_line",
"=",
"self",
".",
"_cursor",
".",
"blockNumber",
"(",
")",
"==",
"self",
".",
"_text_edit",
".",
"blockCount",
"(",
")",
"-",
"1",
"if",
"self",
".",
"_cursor",
".",
"atEnd",
"(",
")",
"or",
"... | Performs a line feed. | [
"Performs",
"a",
"line",
"feed",
"."
] | train | https://github.com/pyQode/pyqode.core/blob/a99ec6cd22d519394f613309412f8329dc4e90cb/pyqode/core/widgets/output_window.py#L1246-L1258 |
pyQode/pyqode.core | pyqode/core/widgets/output_window.py | OutputFormatter._cursor_down | def _cursor_down(self, value):
"""
Moves the cursor down by ``value``.
"""
self._cursor.clearSelection()
if self._cursor.atEnd():
self._cursor.insertText('\n')
else:
self._cursor.movePosition(self._cursor.Down, self._cursor.MoveAnchor, value)
... | python | def _cursor_down(self, value):
"""
Moves the cursor down by ``value``.
"""
self._cursor.clearSelection()
if self._cursor.atEnd():
self._cursor.insertText('\n')
else:
self._cursor.movePosition(self._cursor.Down, self._cursor.MoveAnchor, value)
... | [
"def",
"_cursor_down",
"(",
"self",
",",
"value",
")",
":",
"self",
".",
"_cursor",
".",
"clearSelection",
"(",
")",
"if",
"self",
".",
"_cursor",
".",
"atEnd",
"(",
")",
":",
"self",
".",
"_cursor",
".",
"insertText",
"(",
"'\\n'",
")",
"else",
":",... | Moves the cursor down by ``value``. | [
"Moves",
"the",
"cursor",
"down",
"by",
"value",
"."
] | train | https://github.com/pyQode/pyqode.core/blob/a99ec6cd22d519394f613309412f8329dc4e90cb/pyqode/core/widgets/output_window.py#L1260-L1269 |
pyQode/pyqode.core | pyqode/core/widgets/output_window.py | OutputFormatter._cursor_up | def _cursor_up(self, value):
"""
Moves the cursor up by ``value``.
"""
value = int(value)
if value == 0:
value = 1
self._cursor.clearSelection()
self._cursor.movePosition(self._cursor.Up, self._cursor.MoveAnchor, value)
self._last_cursor_pos = ... | python | def _cursor_up(self, value):
"""
Moves the cursor up by ``value``.
"""
value = int(value)
if value == 0:
value = 1
self._cursor.clearSelection()
self._cursor.movePosition(self._cursor.Up, self._cursor.MoveAnchor, value)
self._last_cursor_pos = ... | [
"def",
"_cursor_up",
"(",
"self",
",",
"value",
")",
":",
"value",
"=",
"int",
"(",
"value",
")",
"if",
"value",
"==",
"0",
":",
"value",
"=",
"1",
"self",
".",
"_cursor",
".",
"clearSelection",
"(",
")",
"self",
".",
"_cursor",
".",
"movePosition",
... | Moves the cursor up by ``value``. | [
"Moves",
"the",
"cursor",
"up",
"by",
"value",
"."
] | train | https://github.com/pyQode/pyqode.core/blob/a99ec6cd22d519394f613309412f8329dc4e90cb/pyqode/core/widgets/output_window.py#L1271-L1280 |
pyQode/pyqode.core | pyqode/core/widgets/output_window.py | OutputFormatter._cursor_position | def _cursor_position(self, data):
"""
Moves the cursor position.
"""
column, line = self._get_line_and_col(data)
self._move_cursor_to_line(line)
self._move_cursor_to_column(column)
self._last_cursor_pos = self._cursor.position() | python | def _cursor_position(self, data):
"""
Moves the cursor position.
"""
column, line = self._get_line_and_col(data)
self._move_cursor_to_line(line)
self._move_cursor_to_column(column)
self._last_cursor_pos = self._cursor.position() | [
"def",
"_cursor_position",
"(",
"self",
",",
"data",
")",
":",
"column",
",",
"line",
"=",
"self",
".",
"_get_line_and_col",
"(",
"data",
")",
"self",
".",
"_move_cursor_to_line",
"(",
"line",
")",
"self",
".",
"_move_cursor_to_column",
"(",
"column",
")",
... | Moves the cursor position. | [
"Moves",
"the",
"cursor",
"position",
"."
] | train | https://github.com/pyQode/pyqode.core/blob/a99ec6cd22d519394f613309412f8329dc4e90cb/pyqode/core/widgets/output_window.py#L1282-L1289 |
pyQode/pyqode.core | pyqode/core/widgets/output_window.py | OutputFormatter._move_cursor_to_column | def _move_cursor_to_column(self, column):
"""
Moves the cursor to the specified column, if possible.
"""
last_col = len(self._cursor.block().text())
self._cursor.movePosition(self._cursor.EndOfBlock)
to_insert = ''
for i in range(column - last_col):
to... | python | def _move_cursor_to_column(self, column):
"""
Moves the cursor to the specified column, if possible.
"""
last_col = len(self._cursor.block().text())
self._cursor.movePosition(self._cursor.EndOfBlock)
to_insert = ''
for i in range(column - last_col):
to... | [
"def",
"_move_cursor_to_column",
"(",
"self",
",",
"column",
")",
":",
"last_col",
"=",
"len",
"(",
"self",
".",
"_cursor",
".",
"block",
"(",
")",
".",
"text",
"(",
")",
")",
"self",
".",
"_cursor",
".",
"movePosition",
"(",
"self",
".",
"_cursor",
... | Moves the cursor to the specified column, if possible. | [
"Moves",
"the",
"cursor",
"to",
"the",
"specified",
"column",
"if",
"possible",
"."
] | train | https://github.com/pyQode/pyqode.core/blob/a99ec6cd22d519394f613309412f8329dc4e90cb/pyqode/core/widgets/output_window.py#L1291-L1304 |
pyQode/pyqode.core | pyqode/core/widgets/output_window.py | OutputFormatter._move_cursor_to_line | def _move_cursor_to_line(self, line):
"""
Moves the cursor to the specified line, if possible.
"""
last_line = self._text_edit.document().blockCount() - 1
self._cursor.clearSelection()
self._cursor.movePosition(self._cursor.End)
to_insert = ''
for i in ran... | python | def _move_cursor_to_line(self, line):
"""
Moves the cursor to the specified line, if possible.
"""
last_line = self._text_edit.document().blockCount() - 1
self._cursor.clearSelection()
self._cursor.movePosition(self._cursor.End)
to_insert = ''
for i in ran... | [
"def",
"_move_cursor_to_line",
"(",
"self",
",",
"line",
")",
":",
"last_line",
"=",
"self",
".",
"_text_edit",
".",
"document",
"(",
")",
".",
"blockCount",
"(",
")",
"-",
"1",
"self",
".",
"_cursor",
".",
"clearSelection",
"(",
")",
"self",
".",
"_cu... | Moves the cursor to the specified line, if possible. | [
"Moves",
"the",
"cursor",
"to",
"the",
"specified",
"line",
"if",
"possible",
"."
] | train | https://github.com/pyQode/pyqode.core/blob/a99ec6cd22d519394f613309412f8329dc4e90cb/pyqode/core/widgets/output_window.py#L1306-L1320 |
pyQode/pyqode.core | pyqode/core/widgets/output_window.py | OutputFormatter._get_line_and_col | def _get_line_and_col(data):
"""
Gets line and column from a string like the following: "1;5" or "1;" or ";5"
and convers the column/line numbers to 0 base.
"""
try:
line, column = data.split(';')
except AttributeError:
line = int(data)
... | python | def _get_line_and_col(data):
"""
Gets line and column from a string like the following: "1;5" or "1;" or ";5"
and convers the column/line numbers to 0 base.
"""
try:
line, column = data.split(';')
except AttributeError:
line = int(data)
... | [
"def",
"_get_line_and_col",
"(",
"data",
")",
":",
"try",
":",
"line",
",",
"column",
"=",
"data",
".",
"split",
"(",
"';'",
")",
"except",
"AttributeError",
":",
"line",
"=",
"int",
"(",
"data",
")",
"column",
"=",
"1",
"# handle empty values and convert ... | Gets line and column from a string like the following: "1;5" or "1;" or ";5"
and convers the column/line numbers to 0 base. | [
"Gets",
"line",
"and",
"column",
"from",
"a",
"string",
"like",
"the",
"following",
":",
"1",
";",
"5",
"or",
"1",
";",
"or",
";",
"5"
] | train | https://github.com/pyQode/pyqode.core/blob/a99ec6cd22d519394f613309412f8329dc4e90cb/pyqode/core/widgets/output_window.py#L1329-L1353 |
pyQode/pyqode.core | pyqode/core/widgets/output_window.py | OutputFormatter._erase_in_line | def _erase_in_line(self, value):
"""
Erases charachters in line.
"""
initial_pos = self._cursor.position()
if value == 0:
# delete end of line
self._cursor.movePosition(self._cursor.EndOfBlock, self._cursor.KeepAnchor)
elif value == 1:
... | python | def _erase_in_line(self, value):
"""
Erases charachters in line.
"""
initial_pos = self._cursor.position()
if value == 0:
# delete end of line
self._cursor.movePosition(self._cursor.EndOfBlock, self._cursor.KeepAnchor)
elif value == 1:
... | [
"def",
"_erase_in_line",
"(",
"self",
",",
"value",
")",
":",
"initial_pos",
"=",
"self",
".",
"_cursor",
".",
"position",
"(",
")",
"if",
"value",
"==",
"0",
":",
"# delete end of line",
"self",
".",
"_cursor",
".",
"movePosition",
"(",
"self",
".",
"_c... | Erases charachters in line. | [
"Erases",
"charachters",
"in",
"line",
"."
] | train | https://github.com/pyQode/pyqode.core/blob/a99ec6cd22d519394f613309412f8329dc4e90cb/pyqode/core/widgets/output_window.py#L1355-L1373 |
pyQode/pyqode.core | pyqode/core/widgets/output_window.py | OutputFormatter._erase_display | def _erase_display(self, value):
"""
Erases display.
"""
if value == 0:
# delete end of line
self._cursor.movePosition(self._cursor.End, self._cursor.KeepAnchor)
elif value == 1:
# delete start of line
self._cursor.movePosition(self... | python | def _erase_display(self, value):
"""
Erases display.
"""
if value == 0:
# delete end of line
self._cursor.movePosition(self._cursor.End, self._cursor.KeepAnchor)
elif value == 1:
# delete start of line
self._cursor.movePosition(self... | [
"def",
"_erase_display",
"(",
"self",
",",
"value",
")",
":",
"if",
"value",
"==",
"0",
":",
"# delete end of line",
"self",
".",
"_cursor",
".",
"movePosition",
"(",
"self",
".",
"_cursor",
".",
"End",
",",
"self",
".",
"_cursor",
".",
"KeepAnchor",
")"... | Erases display. | [
"Erases",
"display",
"."
] | train | https://github.com/pyQode/pyqode.core/blob/a99ec6cd22d519394f613309412f8329dc4e90cb/pyqode/core/widgets/output_window.py#L1375-L1390 |
pyQode/pyqode.core | pyqode/core/widgets/output_window.py | OutputFormatter._cursor_back | def _cursor_back(self, value):
"""
Moves the cursor back.
"""
if value <= 0:
value = 1
self._cursor.movePosition(self._cursor.Left, self._cursor.MoveAnchor, value)
self._text_edit.setTextCursor(self._cursor)
self._last_cursor_pos = self._cursor.positio... | python | def _cursor_back(self, value):
"""
Moves the cursor back.
"""
if value <= 0:
value = 1
self._cursor.movePosition(self._cursor.Left, self._cursor.MoveAnchor, value)
self._text_edit.setTextCursor(self._cursor)
self._last_cursor_pos = self._cursor.positio... | [
"def",
"_cursor_back",
"(",
"self",
",",
"value",
")",
":",
"if",
"value",
"<=",
"0",
":",
"value",
"=",
"1",
"self",
".",
"_cursor",
".",
"movePosition",
"(",
"self",
".",
"_cursor",
".",
"Left",
",",
"self",
".",
"_cursor",
".",
"MoveAnchor",
",",
... | Moves the cursor back. | [
"Moves",
"the",
"cursor",
"back",
"."
] | train | https://github.com/pyQode/pyqode.core/blob/a99ec6cd22d519394f613309412f8329dc4e90cb/pyqode/core/widgets/output_window.py#L1392-L1400 |
pyQode/pyqode.core | pyqode/core/widgets/output_window.py | OutputFormatter._cursor_forward | def _cursor_forward(self, value):
"""
Moves the cursor forward.
"""
if value <= 0:
value = 1
self._cursor.movePosition(self._cursor.Right, self._cursor.MoveAnchor, value)
self._text_edit.setTextCursor(self._cursor)
self._last_cursor_pos = self._cursor.... | python | def _cursor_forward(self, value):
"""
Moves the cursor forward.
"""
if value <= 0:
value = 1
self._cursor.movePosition(self._cursor.Right, self._cursor.MoveAnchor, value)
self._text_edit.setTextCursor(self._cursor)
self._last_cursor_pos = self._cursor.... | [
"def",
"_cursor_forward",
"(",
"self",
",",
"value",
")",
":",
"if",
"value",
"<=",
"0",
":",
"value",
"=",
"1",
"self",
".",
"_cursor",
".",
"movePosition",
"(",
"self",
".",
"_cursor",
".",
"Right",
",",
"self",
".",
"_cursor",
".",
"MoveAnchor",
"... | Moves the cursor forward. | [
"Moves",
"the",
"cursor",
"forward",
"."
] | train | https://github.com/pyQode/pyqode.core/blob/a99ec6cd22d519394f613309412f8329dc4e90cb/pyqode/core/widgets/output_window.py#L1402-L1410 |
pyQode/pyqode.core | pyqode/core/widgets/output_window.py | OutputFormatter._delete_chars | def _delete_chars(self, value):
"""
Deletes the specified number of charachters.
"""
value = int(value)
if value <= 0:
value = 1
for i in range(value):
self._cursor.deleteChar()
self._text_edit.setTextCursor(self._cursor)
self._last... | python | def _delete_chars(self, value):
"""
Deletes the specified number of charachters.
"""
value = int(value)
if value <= 0:
value = 1
for i in range(value):
self._cursor.deleteChar()
self._text_edit.setTextCursor(self._cursor)
self._last... | [
"def",
"_delete_chars",
"(",
"self",
",",
"value",
")",
":",
"value",
"=",
"int",
"(",
"value",
")",
"if",
"value",
"<=",
"0",
":",
"value",
"=",
"1",
"for",
"i",
"in",
"range",
"(",
"value",
")",
":",
"self",
".",
"_cursor",
".",
"deleteChar",
"... | Deletes the specified number of charachters. | [
"Deletes",
"the",
"specified",
"number",
"of",
"charachters",
"."
] | train | https://github.com/pyQode/pyqode.core/blob/a99ec6cd22d519394f613309412f8329dc4e90cb/pyqode/core/widgets/output_window.py#L1412-L1422 |
GoogleCloudPlatform/python-repo-tools | gcp_devrel/tools/requirements.py | get_package_info | def get_package_info(package):
"""Gets the PyPI information for a given package."""
url = 'https://pypi.python.org/pypi/{}/json'.format(package)
r = requests.get(url)
r.raise_for_status()
return r.json() | python | def get_package_info(package):
"""Gets the PyPI information for a given package."""
url = 'https://pypi.python.org/pypi/{}/json'.format(package)
r = requests.get(url)
r.raise_for_status()
return r.json() | [
"def",
"get_package_info",
"(",
"package",
")",
":",
"url",
"=",
"'https://pypi.python.org/pypi/{}/json'",
".",
"format",
"(",
"package",
")",
"r",
"=",
"requests",
".",
"get",
"(",
"url",
")",
"r",
".",
"raise_for_status",
"(",
")",
"return",
"r",
".",
"j... | Gets the PyPI information for a given package. | [
"Gets",
"the",
"PyPI",
"information",
"for",
"a",
"given",
"package",
"."
] | train | https://github.com/GoogleCloudPlatform/python-repo-tools/blob/87422ba91814529848a2b8bf8be4294283a3e041/gcp_devrel/tools/requirements.py#L30-L35 |
GoogleCloudPlatform/python-repo-tools | gcp_devrel/tools/requirements.py | read_requirements | def read_requirements(req_file):
"""Reads a requirements file.
Args:
req_file (str): Filename of requirements file
"""
items = list(parse_requirements(req_file, session={}))
result = []
for item in items:
# Get line number from item
line_number = item.comes_from.split(r... | python | def read_requirements(req_file):
"""Reads a requirements file.
Args:
req_file (str): Filename of requirements file
"""
items = list(parse_requirements(req_file, session={}))
result = []
for item in items:
# Get line number from item
line_number = item.comes_from.split(r... | [
"def",
"read_requirements",
"(",
"req_file",
")",
":",
"items",
"=",
"list",
"(",
"parse_requirements",
"(",
"req_file",
",",
"session",
"=",
"{",
"}",
")",
")",
"result",
"=",
"[",
"]",
"for",
"item",
"in",
"items",
":",
"# Get line number from item",
"li... | Reads a requirements file.
Args:
req_file (str): Filename of requirements file | [
"Reads",
"a",
"requirements",
"file",
"."
] | train | https://github.com/GoogleCloudPlatform/python-repo-tools/blob/87422ba91814529848a2b8bf8be4294283a3e041/gcp_devrel/tools/requirements.py#L38-L56 |
GoogleCloudPlatform/python-repo-tools | gcp_devrel/tools/requirements.py | _is_version_range | def _is_version_range(req):
"""Returns true if requirements specify a version range."""
assert len(req.specifier) > 0
specs = list(req.specifier)
if len(specs) == 1:
# "foo > 2.0" or "foo == 2.4.3"
return specs[0].operator != '=='
else:
# "foo > 2.0, < 3.0"
return Tr... | python | def _is_version_range(req):
"""Returns true if requirements specify a version range."""
assert len(req.specifier) > 0
specs = list(req.specifier)
if len(specs) == 1:
# "foo > 2.0" or "foo == 2.4.3"
return specs[0].operator != '=='
else:
# "foo > 2.0, < 3.0"
return Tr... | [
"def",
"_is_version_range",
"(",
"req",
")",
":",
"assert",
"len",
"(",
"req",
".",
"specifier",
")",
">",
"0",
"specs",
"=",
"list",
"(",
"req",
".",
"specifier",
")",
"if",
"len",
"(",
"specs",
")",
"==",
"1",
":",
"# \"foo > 2.0\" or \"foo == 2.4.3\""... | Returns true if requirements specify a version range. | [
"Returns",
"true",
"if",
"requirements",
"specify",
"a",
"version",
"range",
"."
] | train | https://github.com/GoogleCloudPlatform/python-repo-tools/blob/87422ba91814529848a2b8bf8be4294283a3e041/gcp_devrel/tools/requirements.py#L72-L82 |
GoogleCloudPlatform/python-repo-tools | gcp_devrel/tools/requirements.py | update_req | def update_req(req):
"""Updates a given req object with the latest version."""
if not req.name:
return req, None
info = get_package_info(req.name)
if info['info'].get('_pypi_hidden'):
print('{} is hidden on PyPI and will not be updated.'.format(req))
return req, None
if _... | python | def update_req(req):
"""Updates a given req object with the latest version."""
if not req.name:
return req, None
info = get_package_info(req.name)
if info['info'].get('_pypi_hidden'):
print('{} is hidden on PyPI and will not be updated.'.format(req))
return req, None
if _... | [
"def",
"update_req",
"(",
"req",
")",
":",
"if",
"not",
"req",
".",
"name",
":",
"return",
"req",
",",
"None",
"info",
"=",
"get_package_info",
"(",
"req",
".",
"name",
")",
"if",
"info",
"[",
"'info'",
"]",
".",
"get",
"(",
"'_pypi_hidden'",
")",
... | Updates a given req object with the latest version. | [
"Updates",
"a",
"given",
"req",
"object",
"with",
"the",
"latest",
"version",
"."
] | train | https://github.com/GoogleCloudPlatform/python-repo-tools/blob/87422ba91814529848a2b8bf8be4294283a3e041/gcp_devrel/tools/requirements.py#L85-L112 |
GoogleCloudPlatform/python-repo-tools | gcp_devrel/tools/requirements.py | write_requirements | def write_requirements(reqs_linenum, req_file):
"""Writes a list of req objects out to a given file."""
with open(req_file, 'r') as input:
lines = input.readlines()
for req in reqs_linenum:
line_num = int(req[1])
if hasattr(req[0], 'link'):
lines[line_num - 1] = '{}\n'.... | python | def write_requirements(reqs_linenum, req_file):
"""Writes a list of req objects out to a given file."""
with open(req_file, 'r') as input:
lines = input.readlines()
for req in reqs_linenum:
line_num = int(req[1])
if hasattr(req[0], 'link'):
lines[line_num - 1] = '{}\n'.... | [
"def",
"write_requirements",
"(",
"reqs_linenum",
",",
"req_file",
")",
":",
"with",
"open",
"(",
"req_file",
",",
"'r'",
")",
"as",
"input",
":",
"lines",
"=",
"input",
".",
"readlines",
"(",
")",
"for",
"req",
"in",
"reqs_linenum",
":",
"line_num",
"="... | Writes a list of req objects out to a given file. | [
"Writes",
"a",
"list",
"of",
"req",
"objects",
"out",
"to",
"a",
"given",
"file",
"."
] | train | https://github.com/GoogleCloudPlatform/python-repo-tools/blob/87422ba91814529848a2b8bf8be4294283a3e041/gcp_devrel/tools/requirements.py#L115-L129 |
GoogleCloudPlatform/python-repo-tools | gcp_devrel/tools/requirements.py | check_req | def check_req(req):
"""Checks if a given req is the latest version available."""
if not isinstance(req, Requirement):
return None
info = get_package_info(req.name)
newest_version = _get_newest_version(info)
if _is_pinned(req) and _is_version_range(req):
return None
current_spe... | python | def check_req(req):
"""Checks if a given req is the latest version available."""
if not isinstance(req, Requirement):
return None
info = get_package_info(req.name)
newest_version = _get_newest_version(info)
if _is_pinned(req) and _is_version_range(req):
return None
current_spe... | [
"def",
"check_req",
"(",
"req",
")",
":",
"if",
"not",
"isinstance",
"(",
"req",
",",
"Requirement",
")",
":",
"return",
"None",
"info",
"=",
"get_package_info",
"(",
"req",
".",
"name",
")",
"newest_version",
"=",
"_get_newest_version",
"(",
"info",
")",
... | Checks if a given req is the latest version available. | [
"Checks",
"if",
"a",
"given",
"req",
"is",
"the",
"latest",
"version",
"available",
"."
] | train | https://github.com/GoogleCloudPlatform/python-repo-tools/blob/87422ba91814529848a2b8bf8be4294283a3e041/gcp_devrel/tools/requirements.py#L132-L146 |
GoogleCloudPlatform/python-repo-tools | gcp_devrel/tools/requirements.py | check_requirements_file | def check_requirements_file(req_file, skip_packages):
"""Return list of outdated requirements.
Args:
req_file (str): Filename of requirements file
skip_packages (list): List of package names to ignore.
"""
reqs = read_requirements(req_file)
if skip_packages is not None:
reqs... | python | def check_requirements_file(req_file, skip_packages):
"""Return list of outdated requirements.
Args:
req_file (str): Filename of requirements file
skip_packages (list): List of package names to ignore.
"""
reqs = read_requirements(req_file)
if skip_packages is not None:
reqs... | [
"def",
"check_requirements_file",
"(",
"req_file",
",",
"skip_packages",
")",
":",
"reqs",
"=",
"read_requirements",
"(",
"req_file",
")",
"if",
"skip_packages",
"is",
"not",
"None",
":",
"reqs",
"=",
"[",
"req",
"for",
"req",
"in",
"reqs",
"if",
"req",
".... | Return list of outdated requirements.
Args:
req_file (str): Filename of requirements file
skip_packages (list): List of package names to ignore. | [
"Return",
"list",
"of",
"outdated",
"requirements",
"."
] | train | https://github.com/GoogleCloudPlatform/python-repo-tools/blob/87422ba91814529848a2b8bf8be4294283a3e041/gcp_devrel/tools/requirements.py#L162-L173 |
GoogleCloudPlatform/python-repo-tools | gcp_devrel/tools/requirements.py | update_command | def update_command(args):
"""Updates all dependencies the specified requirements file."""
updated = update_requirements_file(
args.requirements_file, args.skip_packages)
if updated:
print('Updated requirements in {}:'.format(args.requirements_file))
for item in updated:
... | python | def update_command(args):
"""Updates all dependencies the specified requirements file."""
updated = update_requirements_file(
args.requirements_file, args.skip_packages)
if updated:
print('Updated requirements in {}:'.format(args.requirements_file))
for item in updated:
... | [
"def",
"update_command",
"(",
"args",
")",
":",
"updated",
"=",
"update_requirements_file",
"(",
"args",
".",
"requirements_file",
",",
"args",
".",
"skip_packages",
")",
"if",
"updated",
":",
"print",
"(",
"'Updated requirements in {}:'",
".",
"format",
"(",
"a... | Updates all dependencies the specified requirements file. | [
"Updates",
"all",
"dependencies",
"the",
"specified",
"requirements",
"file",
"."
] | train | https://github.com/GoogleCloudPlatform/python-repo-tools/blob/87422ba91814529848a2b8bf8be4294283a3e041/gcp_devrel/tools/requirements.py#L176-L188 |
GoogleCloudPlatform/python-repo-tools | gcp_devrel/tools/requirements.py | check_command | def check_command(args):
"""Checks that all dependencies in the specified requirements file are
up to date."""
outdated = check_requirements_file(args.requirements_file,
args.skip_packages)
if outdated:
print('Requirements in {} are out of date:'.format(
... | python | def check_command(args):
"""Checks that all dependencies in the specified requirements file are
up to date."""
outdated = check_requirements_file(args.requirements_file,
args.skip_packages)
if outdated:
print('Requirements in {} are out of date:'.format(
... | [
"def",
"check_command",
"(",
"args",
")",
":",
"outdated",
"=",
"check_requirements_file",
"(",
"args",
".",
"requirements_file",
",",
"args",
".",
"skip_packages",
")",
"if",
"outdated",
":",
"print",
"(",
"'Requirements in {} are out of date:'",
".",
"format",
"... | Checks that all dependencies in the specified requirements file are
up to date. | [
"Checks",
"that",
"all",
"dependencies",
"in",
"the",
"specified",
"requirements",
"file",
"are",
"up",
"to",
"date",
"."
] | train | https://github.com/GoogleCloudPlatform/python-repo-tools/blob/87422ba91814529848a2b8bf8be4294283a3e041/gcp_devrel/tools/requirements.py#L191-L207 |
pyQode/pyqode.core | pyqode/core/panels/encodings.py | EncodingPanel.paintEvent | def paintEvent(self, event):
""" Fills the panel background. """
super(EncodingPanel, self).paintEvent(event)
if self.isVisible():
# fill background
painter = QtGui.QPainter(self)
self._background_brush = QtGui.QBrush(self._color)
painter.fillRect(... | python | def paintEvent(self, event):
""" Fills the panel background. """
super(EncodingPanel, self).paintEvent(event)
if self.isVisible():
# fill background
painter = QtGui.QPainter(self)
self._background_brush = QtGui.QBrush(self._color)
painter.fillRect(... | [
"def",
"paintEvent",
"(",
"self",
",",
"event",
")",
":",
"super",
"(",
"EncodingPanel",
",",
"self",
")",
".",
"paintEvent",
"(",
"event",
")",
"if",
"self",
".",
"isVisible",
"(",
")",
":",
"# fill background",
"painter",
"=",
"QtGui",
".",
"QPainter",... | Fills the panel background. | [
"Fills",
"the",
"panel",
"background",
"."
] | train | https://github.com/pyQode/pyqode.core/blob/a99ec6cd22d519394f613309412f8329dc4e90cb/pyqode/core/panels/encodings.py#L157-L164 |
pyQode/pyqode.core | pyqode/core/api/syntax_highlighter.py | ColorScheme._get_format_from_style | def _get_format_from_style(self, token, style):
""" Returns a QTextCharFormat for token by reading a Pygments style.
"""
result = QtGui.QTextCharFormat()
items = list(style.style_for_token(token).items())
for key, value in items:
if value is None and key == 'color':
... | python | def _get_format_from_style(self, token, style):
""" Returns a QTextCharFormat for token by reading a Pygments style.
"""
result = QtGui.QTextCharFormat()
items = list(style.style_for_token(token).items())
for key, value in items:
if value is None and key == 'color':
... | [
"def",
"_get_format_from_style",
"(",
"self",
",",
"token",
",",
"style",
")",
":",
"result",
"=",
"QtGui",
".",
"QTextCharFormat",
"(",
")",
"items",
"=",
"list",
"(",
"style",
".",
"style_for_token",
"(",
"token",
")",
".",
"items",
"(",
")",
")",
"f... | Returns a QTextCharFormat for token by reading a Pygments style. | [
"Returns",
"a",
"QTextCharFormat",
"for",
"token",
"by",
"reading",
"a",
"Pygments",
"style",
"."
] | train | https://github.com/pyQode/pyqode.core/blob/a99ec6cd22d519394f613309412f8329dc4e90cb/pyqode/core/api/syntax_highlighter.py#L144-L176 |
pyQode/pyqode.core | pyqode/core/api/syntax_highlighter.py | ColorScheme._get_color | def _get_color(color):
""" Returns a QColor built from a Pygments color string. """
color = str(color).replace("#", "")
qcolor = QtGui.QColor()
qcolor.setRgb(int(color[:2], base=16),
int(color[2:4], base=16),
int(color[4:6], base=16))
r... | python | def _get_color(color):
""" Returns a QColor built from a Pygments color string. """
color = str(color).replace("#", "")
qcolor = QtGui.QColor()
qcolor.setRgb(int(color[:2], base=16),
int(color[2:4], base=16),
int(color[4:6], base=16))
r... | [
"def",
"_get_color",
"(",
"color",
")",
":",
"color",
"=",
"str",
"(",
"color",
")",
".",
"replace",
"(",
"\"#\"",
",",
"\"\"",
")",
"qcolor",
"=",
"QtGui",
".",
"QColor",
"(",
")",
"qcolor",
".",
"setRgb",
"(",
"int",
"(",
"color",
"[",
":",
"2"... | Returns a QColor built from a Pygments color string. | [
"Returns",
"a",
"QColor",
"built",
"from",
"a",
"Pygments",
"color",
"string",
"."
] | train | https://github.com/pyQode/pyqode.core/blob/a99ec6cd22d519394f613309412f8329dc4e90cb/pyqode/core/api/syntax_highlighter.py#L189-L196 |
pyQode/pyqode.core | pyqode/core/api/syntax_highlighter.py | SyntaxHighlighter.refresh_editor | def refresh_editor(self, color_scheme):
"""
Refresh editor settings (background and highlight colors) when color
scheme changed.
:param color_scheme: new color scheme.
"""
self.editor.background = color_scheme.background
self.editor.foreground = color_scheme.form... | python | def refresh_editor(self, color_scheme):
"""
Refresh editor settings (background and highlight colors) when color
scheme changed.
:param color_scheme: new color scheme.
"""
self.editor.background = color_scheme.background
self.editor.foreground = color_scheme.form... | [
"def",
"refresh_editor",
"(",
"self",
",",
"color_scheme",
")",
":",
"self",
".",
"editor",
".",
"background",
"=",
"color_scheme",
".",
"background",
"self",
".",
"editor",
".",
"foreground",
"=",
"color_scheme",
".",
"formats",
"[",
"'normal'",
"]",
".",
... | Refresh editor settings (background and highlight colors) when color
scheme changed.
:param color_scheme: new color scheme. | [
"Refresh",
"editor",
"settings",
"(",
"background",
"and",
"highlight",
"colors",
")",
"when",
"color",
"scheme",
"changed",
"."
] | train | https://github.com/pyQode/pyqode.core/blob/a99ec6cd22d519394f613309412f8329dc4e90cb/pyqode/core/api/syntax_highlighter.py#L250-L275 |
pyQode/pyqode.core | pyqode/core/api/syntax_highlighter.py | SyntaxHighlighter.rehighlight | def rehighlight(self):
"""
Rehighlight the entire document, may be slow.
"""
start = time.time()
QtWidgets.QApplication.setOverrideCursor(
QtGui.QCursor(QtCore.Qt.WaitCursor))
try:
super(SyntaxHighlighter, self).rehighlight()
except Runtime... | python | def rehighlight(self):
"""
Rehighlight the entire document, may be slow.
"""
start = time.time()
QtWidgets.QApplication.setOverrideCursor(
QtGui.QCursor(QtCore.Qt.WaitCursor))
try:
super(SyntaxHighlighter, self).rehighlight()
except Runtime... | [
"def",
"rehighlight",
"(",
"self",
")",
":",
"start",
"=",
"time",
".",
"time",
"(",
")",
"QtWidgets",
".",
"QApplication",
".",
"setOverrideCursor",
"(",
"QtGui",
".",
"QCursor",
"(",
"QtCore",
".",
"Qt",
".",
"WaitCursor",
")",
")",
"try",
":",
"supe... | Rehighlight the entire document, may be slow. | [
"Rehighlight",
"the",
"entire",
"document",
"may",
"be",
"slow",
"."
] | train | https://github.com/pyQode/pyqode.core/blob/a99ec6cd22d519394f613309412f8329dc4e90cb/pyqode/core/api/syntax_highlighter.py#L349-L363 |
pyQode/pyqode.core | pyqode/core/panels/line_number.py | LineNumberPanel.line_number_area_width | def line_number_area_width(self):
"""
Computes the lineNumber area width depending on the number of lines
in the document
:return: Widtg
"""
digits = 1
count = max(1, self.editor.blockCount())
while count >= 10:
count /= 10
digits ... | python | def line_number_area_width(self):
"""
Computes the lineNumber area width depending on the number of lines
in the document
:return: Widtg
"""
digits = 1
count = max(1, self.editor.blockCount())
while count >= 10:
count /= 10
digits ... | [
"def",
"line_number_area_width",
"(",
"self",
")",
":",
"digits",
"=",
"1",
"count",
"=",
"max",
"(",
"1",
",",
"self",
".",
"editor",
".",
"blockCount",
"(",
")",
")",
"while",
"count",
">=",
"10",
":",
"count",
"/=",
"10",
"digits",
"+=",
"1",
"s... | Computes the lineNumber area width depending on the number of lines
in the document
:return: Widtg | [
"Computes",
"the",
"lineNumber",
"area",
"width",
"depending",
"on",
"the",
"number",
"of",
"lines",
"in",
"the",
"document"
] | train | https://github.com/pyQode/pyqode.core/blob/a99ec6cd22d519394f613309412f8329dc4e90cb/pyqode/core/panels/line_number.py#L30-L43 |
pyQode/pyqode.core | pyqode/core/panels/line_number.py | LineNumberPanel.mousePressEvent | def mousePressEvent(self, e):
"""
Starts selecting
"""
self._selecting = True
self._sel_start = e.pos().y()
start = end = TextHelper(self.editor).line_nbr_from_position(
self._sel_start)
self._start_line = start
TextHelper(self.editor).select_l... | python | def mousePressEvent(self, e):
"""
Starts selecting
"""
self._selecting = True
self._sel_start = e.pos().y()
start = end = TextHelper(self.editor).line_nbr_from_position(
self._sel_start)
self._start_line = start
TextHelper(self.editor).select_l... | [
"def",
"mousePressEvent",
"(",
"self",
",",
"e",
")",
":",
"self",
".",
"_selecting",
"=",
"True",
"self",
".",
"_sel_start",
"=",
"e",
".",
"pos",
"(",
")",
".",
"y",
"(",
")",
"start",
"=",
"end",
"=",
"TextHelper",
"(",
"self",
".",
"editor",
... | Starts selecting | [
"Starts",
"selecting"
] | train | https://github.com/pyQode/pyqode.core/blob/a99ec6cd22d519394f613309412f8329dc4e90cb/pyqode/core/panels/line_number.py#L45-L54 |
pyQode/pyqode.core | pyqode/core/widgets/outline.py | OutlineTreeWidget.set_editor | def set_editor(self, editor):
"""
Sets the current editor. The widget display the structure of that
editor.
:param editor: CodeEdit
"""
try:
self._editor.cursorPositionChanged.disconnect(self.sync)
except (AttributeError, TypeError, RuntimeError, Refe... | python | def set_editor(self, editor):
"""
Sets the current editor. The widget display the structure of that
editor.
:param editor: CodeEdit
"""
try:
self._editor.cursorPositionChanged.disconnect(self.sync)
except (AttributeError, TypeError, RuntimeError, Refe... | [
"def",
"set_editor",
"(",
"self",
",",
"editor",
")",
":",
"try",
":",
"self",
".",
"_editor",
".",
"cursorPositionChanged",
".",
"disconnect",
"(",
"self",
".",
"sync",
")",
"except",
"(",
"AttributeError",
",",
"TypeError",
",",
"RuntimeError",
",",
"Ref... | Sets the current editor. The widget display the structure of that
editor.
:param editor: CodeEdit | [
"Sets",
"the",
"current",
"editor",
".",
"The",
"widget",
"display",
"the",
"structure",
"of",
"that",
"editor",
"."
] | train | https://github.com/pyQode/pyqode.core/blob/a99ec6cd22d519394f613309412f8329dc4e90cb/pyqode/core/widgets/outline.py#L62-L105 |
pyQode/pyqode.core | pyqode/core/widgets/outline.py | OutlineTreeWidget._on_changed | def _on_changed(self):
"""
Update the tree items
"""
self._updating = True
to_collapse = []
self.clear()
if self._editor and self._outline_mode and self._folding_panel:
items, to_collapse = self.to_tree_widget_items(
self._outline_mode.... | python | def _on_changed(self):
"""
Update the tree items
"""
self._updating = True
to_collapse = []
self.clear()
if self._editor and self._outline_mode and self._folding_panel:
items, to_collapse = self.to_tree_widget_items(
self._outline_mode.... | [
"def",
"_on_changed",
"(",
"self",
")",
":",
"self",
".",
"_updating",
"=",
"True",
"to_collapse",
"=",
"[",
"]",
"self",
".",
"clear",
"(",
")",
"if",
"self",
".",
"_editor",
"and",
"self",
".",
"_outline_mode",
"and",
"self",
".",
"_folding_panel",
"... | Update the tree items | [
"Update",
"the",
"tree",
"items"
] | train | https://github.com/pyQode/pyqode.core/blob/a99ec6cd22d519394f613309412f8329dc4e90cb/pyqode/core/widgets/outline.py#L136-L162 |
pyQode/pyqode.core | pyqode/core/widgets/outline.py | OutlineTreeWidget._on_item_clicked | def _on_item_clicked(self, item):
"""
Go to the item position in the editor.
"""
if item:
name = item.data(0, QtCore.Qt.UserRole)
if name:
go = name.block.blockNumber()
helper = TextHelper(self._editor)
if helper.cur... | python | def _on_item_clicked(self, item):
"""
Go to the item position in the editor.
"""
if item:
name = item.data(0, QtCore.Qt.UserRole)
if name:
go = name.block.blockNumber()
helper = TextHelper(self._editor)
if helper.cur... | [
"def",
"_on_item_clicked",
"(",
"self",
",",
"item",
")",
":",
"if",
"item",
":",
"name",
"=",
"item",
".",
"data",
"(",
"0",
",",
"QtCore",
".",
"Qt",
".",
"UserRole",
")",
"if",
"name",
":",
"go",
"=",
"name",
".",
"block",
".",
"blockNumber",
... | Go to the item position in the editor. | [
"Go",
"to",
"the",
"item",
"position",
"in",
"the",
"editor",
"."
] | train | https://github.com/pyQode/pyqode.core/blob/a99ec6cd22d519394f613309412f8329dc4e90cb/pyqode/core/widgets/outline.py#L164-L175 |
pyQode/pyqode.core | pyqode/core/widgets/outline.py | OutlineTreeWidget.to_tree_widget_items | def to_tree_widget_items(self, definitions, to_collapse=None):
"""
Converts the list of top level definitions to a list of top level
tree items.
"""
def flatten(definitions):
"""
Flattens the document structure tree as a simple sequential list.
... | python | def to_tree_widget_items(self, definitions, to_collapse=None):
"""
Converts the list of top level definitions to a list of top level
tree items.
"""
def flatten(definitions):
"""
Flattens the document structure tree as a simple sequential list.
... | [
"def",
"to_tree_widget_items",
"(",
"self",
",",
"definitions",
",",
"to_collapse",
"=",
"None",
")",
":",
"def",
"flatten",
"(",
"definitions",
")",
":",
"\"\"\"\n Flattens the document structure tree as a simple sequential list.\n \"\"\"",
"ret_val",
"... | Converts the list of top level definitions to a list of top level
tree items. | [
"Converts",
"the",
"list",
"of",
"top",
"level",
"definitions",
"to",
"a",
"list",
"of",
"top",
"level",
"tree",
"items",
"."
] | train | https://github.com/pyQode/pyqode.core/blob/a99ec6cd22d519394f613309412f8329dc4e90cb/pyqode/core/widgets/outline.py#L177-L233 |
pyQode/pyqode.core | pyqode/core/modes/matcher.py | SymbolMatcherMode.symbol_pos | def symbol_pos(self, cursor, character_type=OPEN, symbol_type=PAREN):
"""
Find the corresponding symbol position (line, column) of the specified
symbol. If symbol type is PAREN and character_type is OPEN, the
function will look for '('.
:param cursor: QTextCursor
:param ... | python | def symbol_pos(self, cursor, character_type=OPEN, symbol_type=PAREN):
"""
Find the corresponding symbol position (line, column) of the specified
symbol. If symbol type is PAREN and character_type is OPEN, the
function will look for '('.
:param cursor: QTextCursor
:param ... | [
"def",
"symbol_pos",
"(",
"self",
",",
"cursor",
",",
"character_type",
"=",
"OPEN",
",",
"symbol_type",
"=",
"PAREN",
")",
":",
"retval",
"=",
"None",
",",
"None",
"original_cursor",
"=",
"self",
".",
"editor",
".",
"textCursor",
"(",
")",
"self",
".",
... | Find the corresponding symbol position (line, column) of the specified
symbol. If symbol type is PAREN and character_type is OPEN, the
function will look for '('.
:param cursor: QTextCursor
:param character_type: character type to look for (open or close char)
:param symbol_type... | [
"Find",
"the",
"corresponding",
"symbol",
"position",
"(",
"line",
"column",
")",
"of",
"the",
"specified",
"symbol",
".",
"If",
"symbol",
"type",
"is",
"PAREN",
"and",
"character_type",
"is",
"OPEN",
"the",
"function",
"will",
"look",
"for",
"(",
"."
] | train | https://github.com/pyQode/pyqode.core/blob/a99ec6cd22d519394f613309412f8329dc4e90cb/pyqode/core/modes/matcher.py#L127-L149 |
pyQode/pyqode.core | pyqode/core/modes/matcher.py | SymbolMatcherMode.do_symbols_matching | def do_symbols_matching(self):
"""
Performs symbols matching.
"""
self._clear_decorations()
current_block = self.editor.textCursor().block()
data = get_block_symbol_data(self.editor, current_block)
pos = self.editor.textCursor().block().position()
for symb... | python | def do_symbols_matching(self):
"""
Performs symbols matching.
"""
self._clear_decorations()
current_block = self.editor.textCursor().block()
data = get_block_symbol_data(self.editor, current_block)
pos = self.editor.textCursor().block().position()
for symb... | [
"def",
"do_symbols_matching",
"(",
"self",
")",
":",
"self",
".",
"_clear_decorations",
"(",
")",
"current_block",
"=",
"self",
".",
"editor",
".",
"textCursor",
"(",
")",
".",
"block",
"(",
")",
"data",
"=",
"get_block_symbol_data",
"(",
"self",
".",
"edi... | Performs symbols matching. | [
"Performs",
"symbols",
"matching",
"."
] | train | https://github.com/pyQode/pyqode.core/blob/a99ec6cd22d519394f613309412f8329dc4e90cb/pyqode/core/modes/matcher.py#L229-L238 |
pyQode/pyqode.core | pyqode/core/widgets/prompt_line_edit.py | PromptLineEdit.set_button_visible | def set_button_visible(self, visible):
"""
Sets the clear button as ``visible``
:param visible: Visible state (True = visible, False = hidden).
"""
self.button.setVisible(visible)
left, top, right, bottom = self.getTextMargins()
if visible:
right = se... | python | def set_button_visible(self, visible):
"""
Sets the clear button as ``visible``
:param visible: Visible state (True = visible, False = hidden).
"""
self.button.setVisible(visible)
left, top, right, bottom = self.getTextMargins()
if visible:
right = se... | [
"def",
"set_button_visible",
"(",
"self",
",",
"visible",
")",
":",
"self",
".",
"button",
".",
"setVisible",
"(",
"visible",
")",
"left",
",",
"top",
",",
"right",
",",
"bottom",
"=",
"self",
".",
"getTextMargins",
"(",
")",
"if",
"visible",
":",
"rig... | Sets the clear button as ``visible``
:param visible: Visible state (True = visible, False = hidden). | [
"Sets",
"the",
"clear",
"button",
"as",
"visible"
] | train | https://github.com/pyQode/pyqode.core/blob/a99ec6cd22d519394f613309412f8329dc4e90cb/pyqode/core/widgets/prompt_line_edit.py#L98-L110 |
pyQode/pyqode.core | pyqode/core/backend/server.py | import_class | def import_class(klass):
"""
Imports a class from a fully qualified name string.
:param klass: class string, e.g.
"pyqode.core.backend.workers.CodeCompletionWorker"
:return: The corresponding class
"""
path = klass.rfind(".")
class_name = klass[path + 1: len(klass)]
try:
... | python | def import_class(klass):
"""
Imports a class from a fully qualified name string.
:param klass: class string, e.g.
"pyqode.core.backend.workers.CodeCompletionWorker"
:return: The corresponding class
"""
path = klass.rfind(".")
class_name = klass[path + 1: len(klass)]
try:
... | [
"def",
"import_class",
"(",
"klass",
")",
":",
"path",
"=",
"klass",
".",
"rfind",
"(",
"\".\"",
")",
"class_name",
"=",
"klass",
"[",
"path",
"+",
"1",
":",
"len",
"(",
"klass",
")",
"]",
"try",
":",
"module",
"=",
"__import__",
"(",
"klass",
"[",... | Imports a class from a fully qualified name string.
:param klass: class string, e.g.
"pyqode.core.backend.workers.CodeCompletionWorker"
:return: The corresponding class | [
"Imports",
"a",
"class",
"from",
"a",
"fully",
"qualified",
"name",
"string",
"."
] | train | https://github.com/pyQode/pyqode.core/blob/a99ec6cd22d519394f613309412f8329dc4e90cb/pyqode/core/backend/server.py#L33-L52 |
pyQode/pyqode.core | pyqode/core/backend/server.py | serve_forever | def serve_forever(args=None):
"""
Creates the server and serves forever
:param args: Optional args if you decided to use your own
argument parser. Default is None to let the JsonServer setup its own
parser and parse command line arguments.
"""
class Unbuffered(object):
def _... | python | def serve_forever(args=None):
"""
Creates the server and serves forever
:param args: Optional args if you decided to use your own
argument parser. Default is None to let the JsonServer setup its own
parser and parse command line arguments.
"""
class Unbuffered(object):
def _... | [
"def",
"serve_forever",
"(",
"args",
"=",
"None",
")",
":",
"class",
"Unbuffered",
"(",
"object",
")",
":",
"def",
"__init__",
"(",
"self",
",",
"stream",
")",
":",
"self",
".",
"stream",
"=",
"stream",
"def",
"write",
"(",
"self",
",",
"data",
")",
... | Creates the server and serves forever
:param args: Optional args if you decided to use your own
argument parser. Default is None to let the JsonServer setup its own
parser and parse command line arguments. | [
"Creates",
"the",
"server",
"and",
"serves",
"forever"
] | train | https://github.com/pyQode/pyqode.core/blob/a99ec6cd22d519394f613309412f8329dc4e90cb/pyqode/core/backend/server.py#L207-L230 |
pyQode/pyqode.core | pyqode/core/modes/case_converter.py | CaseConverterMode._create_actions | def _create_actions(self):
""" Create associated actions """
self.action_to_lower = QtWidgets.QAction(self.editor)
self.action_to_lower.triggered.connect(self.to_lower)
self.action_to_upper = QtWidgets.QAction(self.editor)
self.action_to_upper.triggered.connect(self.to_upper)
... | python | def _create_actions(self):
""" Create associated actions """
self.action_to_lower = QtWidgets.QAction(self.editor)
self.action_to_lower.triggered.connect(self.to_lower)
self.action_to_upper = QtWidgets.QAction(self.editor)
self.action_to_upper.triggered.connect(self.to_upper)
... | [
"def",
"_create_actions",
"(",
"self",
")",
":",
"self",
".",
"action_to_lower",
"=",
"QtWidgets",
".",
"QAction",
"(",
"self",
".",
"editor",
")",
"self",
".",
"action_to_lower",
".",
"triggered",
".",
"connect",
"(",
"self",
".",
"to_lower",
")",
"self",... | Create associated actions | [
"Create",
"associated",
"actions"
] | train | https://github.com/pyQode/pyqode.core/blob/a99ec6cd22d519394f613309412f8329dc4e90cb/pyqode/core/modes/case_converter.py#L37-L50 |
pyQode/pyqode.core | pyqode/core/modes/wordclick.py | WordClickMode._select_word_cursor | def _select_word_cursor(self):
""" Selects the word under the mouse cursor. """
cursor = TextHelper(self.editor).word_under_mouse_cursor()
if (self._previous_cursor_start != cursor.selectionStart() and
self._previous_cursor_end != cursor.selectionEnd()):
self._remove_... | python | def _select_word_cursor(self):
""" Selects the word under the mouse cursor. """
cursor = TextHelper(self.editor).word_under_mouse_cursor()
if (self._previous_cursor_start != cursor.selectionStart() and
self._previous_cursor_end != cursor.selectionEnd()):
self._remove_... | [
"def",
"_select_word_cursor",
"(",
"self",
")",
":",
"cursor",
"=",
"TextHelper",
"(",
"self",
".",
"editor",
")",
".",
"word_under_mouse_cursor",
"(",
")",
"if",
"(",
"self",
".",
"_previous_cursor_start",
"!=",
"cursor",
".",
"selectionStart",
"(",
")",
"a... | Selects the word under the mouse cursor. | [
"Selects",
"the",
"word",
"under",
"the",
"mouse",
"cursor",
"."
] | train | https://github.com/pyQode/pyqode.core/blob/a99ec6cd22d519394f613309412f8329dc4e90cb/pyqode/core/modes/wordclick.py#L60-L68 |
pyQode/pyqode.core | pyqode/core/modes/wordclick.py | WordClickMode._on_mouse_moved | def _on_mouse_moved(self, event):
""" mouse moved callback """
if event.modifiers() & QtCore.Qt.ControlModifier:
cursor = TextHelper(self.editor).word_under_mouse_cursor()
if (not self._cursor or
cursor.position() != self._cursor.position()):
s... | python | def _on_mouse_moved(self, event):
""" mouse moved callback """
if event.modifiers() & QtCore.Qt.ControlModifier:
cursor = TextHelper(self.editor).word_under_mouse_cursor()
if (not self._cursor or
cursor.position() != self._cursor.position()):
s... | [
"def",
"_on_mouse_moved",
"(",
"self",
",",
"event",
")",
":",
"if",
"event",
".",
"modifiers",
"(",
")",
"&",
"QtCore",
".",
"Qt",
".",
"ControlModifier",
":",
"cursor",
"=",
"TextHelper",
"(",
"self",
".",
"editor",
")",
".",
"word_under_mouse_cursor",
... | mouse moved callback | [
"mouse",
"moved",
"callback"
] | train | https://github.com/pyQode/pyqode.core/blob/a99ec6cd22d519394f613309412f8329dc4e90cb/pyqode/core/modes/wordclick.py#L79-L89 |
pyQode/pyqode.core | pyqode/core/modes/wordclick.py | WordClickMode._on_mouse_released | def _on_mouse_released(self, event):
""" mouse pressed callback """
if event.button() == 1 and self._deco:
cursor = TextHelper(self.editor).word_under_mouse_cursor()
if cursor and cursor.selectedText():
self._timer.request_job(
self.word_clicke... | python | def _on_mouse_released(self, event):
""" mouse pressed callback """
if event.button() == 1 and self._deco:
cursor = TextHelper(self.editor).word_under_mouse_cursor()
if cursor and cursor.selectedText():
self._timer.request_job(
self.word_clicke... | [
"def",
"_on_mouse_released",
"(",
"self",
",",
"event",
")",
":",
"if",
"event",
".",
"button",
"(",
")",
"==",
"1",
"and",
"self",
".",
"_deco",
":",
"cursor",
"=",
"TextHelper",
"(",
"self",
".",
"editor",
")",
".",
"word_under_mouse_cursor",
"(",
")... | mouse pressed callback | [
"mouse",
"pressed",
"callback"
] | train | https://github.com/pyQode/pyqode.core/blob/a99ec6cd22d519394f613309412f8329dc4e90cb/pyqode/core/modes/wordclick.py#L94-L100 |
pyQode/pyqode.core | pyqode/core/modes/wordclick.py | WordClickMode._add_decoration | def _add_decoration(self, cursor):
"""
Adds a decoration for the word under ``cursor``.
"""
if self._deco is None:
if cursor.selectedText():
self._deco = TextDecoration(cursor)
if self.editor.background.lightness() < 128:
se... | python | def _add_decoration(self, cursor):
"""
Adds a decoration for the word under ``cursor``.
"""
if self._deco is None:
if cursor.selectedText():
self._deco = TextDecoration(cursor)
if self.editor.background.lightness() < 128:
se... | [
"def",
"_add_decoration",
"(",
"self",
",",
"cursor",
")",
":",
"if",
"self",
".",
"_deco",
"is",
"None",
":",
"if",
"cursor",
".",
"selectedText",
"(",
")",
":",
"self",
".",
"_deco",
"=",
"TextDecoration",
"(",
"cursor",
")",
"if",
"self",
".",
"ed... | Adds a decoration for the word under ``cursor``. | [
"Adds",
"a",
"decoration",
"for",
"the",
"word",
"under",
"cursor",
"."
] | train | https://github.com/pyQode/pyqode.core/blob/a99ec6cd22d519394f613309412f8329dc4e90cb/pyqode/core/modes/wordclick.py#L102-L117 |
pyQode/pyqode.core | pyqode/core/modes/wordclick.py | WordClickMode._remove_decoration | def _remove_decoration(self):
"""
Removes the word under cursor's decoration
"""
if self._deco is not None:
self.editor.decorations.remove(self._deco)
self._deco = None | python | def _remove_decoration(self):
"""
Removes the word under cursor's decoration
"""
if self._deco is not None:
self.editor.decorations.remove(self._deco)
self._deco = None | [
"def",
"_remove_decoration",
"(",
"self",
")",
":",
"if",
"self",
".",
"_deco",
"is",
"not",
"None",
":",
"self",
".",
"editor",
".",
"decorations",
".",
"remove",
"(",
"self",
".",
"_deco",
")",
"self",
".",
"_deco",
"=",
"None"
] | Removes the word under cursor's decoration | [
"Removes",
"the",
"word",
"under",
"cursor",
"s",
"decoration"
] | train | https://github.com/pyQode/pyqode.core/blob/a99ec6cd22d519394f613309412f8329dc4e90cb/pyqode/core/modes/wordclick.py#L119-L125 |
fmenabe/python-dokuwiki | dokuwiki.py | date | def date(date):
"""DokuWiki returns dates of `xmlrpclib`/`xmlrpc.client` ``DateTime``
type and the format changes between DokuWiki versions ... This function
convert *date* to a `datetime` object.
"""
date = date.value
return (datetime.strptime(date[:-5], '%Y-%m-%dT%H:%M:%S')
if len(... | python | def date(date):
"""DokuWiki returns dates of `xmlrpclib`/`xmlrpc.client` ``DateTime``
type and the format changes between DokuWiki versions ... This function
convert *date* to a `datetime` object.
"""
date = date.value
return (datetime.strptime(date[:-5], '%Y-%m-%dT%H:%M:%S')
if len(... | [
"def",
"date",
"(",
"date",
")",
":",
"date",
"=",
"date",
".",
"value",
"return",
"(",
"datetime",
".",
"strptime",
"(",
"date",
"[",
":",
"-",
"5",
"]",
",",
"'%Y-%m-%dT%H:%M:%S'",
")",
"if",
"len",
"(",
"date",
")",
"==",
"24",
"else",
"datetime... | DokuWiki returns dates of `xmlrpclib`/`xmlrpc.client` ``DateTime``
type and the format changes between DokuWiki versions ... This function
convert *date* to a `datetime` object. | [
"DokuWiki",
"returns",
"dates",
"of",
"xmlrpclib",
"/",
"xmlrpc",
".",
"client",
"DateTime",
"type",
"and",
"the",
"format",
"changes",
"between",
"DokuWiki",
"versions",
"...",
"This",
"function",
"convert",
"*",
"date",
"*",
"to",
"a",
"datetime",
"object",
... | train | https://github.com/fmenabe/python-dokuwiki/blob/7b5b13b764912b36f49a03a445c88f0934260eb1/dokuwiki.py#L36-L44 |
fmenabe/python-dokuwiki | dokuwiki.py | utc2local | def utc2local(date):
"""DokuWiki returns date with a +0000 timezone. This function convert *date*
to the local time.
"""
date_offset = (datetime.now() - datetime.utcnow())
# Python < 2.7 don't have the 'total_seconds' method so calculate it by hand!
date_offset = (date_offset.microseconds +
... | python | def utc2local(date):
"""DokuWiki returns date with a +0000 timezone. This function convert *date*
to the local time.
"""
date_offset = (datetime.now() - datetime.utcnow())
# Python < 2.7 don't have the 'total_seconds' method so calculate it by hand!
date_offset = (date_offset.microseconds +
... | [
"def",
"utc2local",
"(",
"date",
")",
":",
"date_offset",
"=",
"(",
"datetime",
".",
"now",
"(",
")",
"-",
"datetime",
".",
"utcnow",
"(",
")",
")",
"# Python < 2.7 don't have the 'total_seconds' method so calculate it by hand!",
"date_offset",
"=",
"(",
"date_offse... | DokuWiki returns date with a +0000 timezone. This function convert *date*
to the local time. | [
"DokuWiki",
"returns",
"date",
"with",
"a",
"+",
"0000",
"timezone",
".",
"This",
"function",
"convert",
"*",
"date",
"*",
"to",
"the",
"local",
"time",
"."
] | train | https://github.com/fmenabe/python-dokuwiki/blob/7b5b13b764912b36f49a03a445c88f0934260eb1/dokuwiki.py#L46-L55 |
fmenabe/python-dokuwiki | dokuwiki.py | CookiesTransport.parse_response | def parse_response(self, response):
"""parse and store cookie"""
try:
for header in response.msg.get_all("Set-Cookie"):
cookie = header.split(";", 1)[0]
cookieKey, cookieValue = cookie.split("=", 1)
self._cookies[cookieKey] = cookieValue
... | python | def parse_response(self, response):
"""parse and store cookie"""
try:
for header in response.msg.get_all("Set-Cookie"):
cookie = header.split(";", 1)[0]
cookieKey, cookieValue = cookie.split("=", 1)
self._cookies[cookieKey] = cookieValue
... | [
"def",
"parse_response",
"(",
"self",
",",
"response",
")",
":",
"try",
":",
"for",
"header",
"in",
"response",
".",
"msg",
".",
"get_all",
"(",
"\"Set-Cookie\"",
")",
":",
"cookie",
"=",
"header",
".",
"split",
"(",
"\";\"",
",",
"1",
")",
"[",
"0",... | parse and store cookie | [
"parse",
"and",
"store",
"cookie"
] | train | https://github.com/fmenabe/python-dokuwiki/blob/7b5b13b764912b36f49a03a445c88f0934260eb1/dokuwiki.py#L74-L82 |
fmenabe/python-dokuwiki | dokuwiki.py | CookiesTransport2.parse_response | def parse_response(self, response):
"""parse and store cookie"""
try:
for header in response.getheader("set-cookie").split(", "):
# filter 'expire' information
if not header.startswith("D"):
continue
cookie = header.split(";... | python | def parse_response(self, response):
"""parse and store cookie"""
try:
for header in response.getheader("set-cookie").split(", "):
# filter 'expire' information
if not header.startswith("D"):
continue
cookie = header.split(";... | [
"def",
"parse_response",
"(",
"self",
",",
"response",
")",
":",
"try",
":",
"for",
"header",
"in",
"response",
".",
"getheader",
"(",
"\"set-cookie\"",
")",
".",
"split",
"(",
"\", \"",
")",
":",
"# filter 'expire' information",
"if",
"not",
"header",
".",
... | parse and store cookie | [
"parse",
"and",
"store",
"cookie"
] | train | https://github.com/fmenabe/python-dokuwiki/blob/7b5b13b764912b36f49a03a445c88f0934260eb1/dokuwiki.py#L97-L108 |
fmenabe/python-dokuwiki | dokuwiki.py | DokuWiki.send | def send(self, command, *args, **kwargs):
"""Generic method for executing an XML-RPC *command*. *args* and
*kwargs* are the arguments and parameters needed by the command.
"""
args = list(args)
if kwargs:
args.append(kwargs)
method = self.proxy
for el... | python | def send(self, command, *args, **kwargs):
"""Generic method for executing an XML-RPC *command*. *args* and
*kwargs* are the arguments and parameters needed by the command.
"""
args = list(args)
if kwargs:
args.append(kwargs)
method = self.proxy
for el... | [
"def",
"send",
"(",
"self",
",",
"command",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"args",
"=",
"list",
"(",
"args",
")",
"if",
"kwargs",
":",
"args",
".",
"append",
"(",
"kwargs",
")",
"method",
"=",
"self",
".",
"proxy",
"for",
... | Generic method for executing an XML-RPC *command*. *args* and
*kwargs* are the arguments and parameters needed by the command. | [
"Generic",
"method",
"for",
"executing",
"an",
"XML",
"-",
"RPC",
"*",
"command",
"*",
".",
"*",
"args",
"*",
"and",
"*",
"kwargs",
"*",
"are",
"the",
"arguments",
"and",
"parameters",
"needed",
"by",
"the",
"command",
"."
] | train | https://github.com/fmenabe/python-dokuwiki/blob/7b5b13b764912b36f49a03a445c88f0934260eb1/dokuwiki.py#L163-L185 |
fmenabe/python-dokuwiki | dokuwiki.py | DokuWiki.add_acl | def add_acl(self, scope, user, permission):
"""Add an `ACL <https://www.dokuwiki.org/acl>`_ rule that restricts
the page/namespace *scope* to *user* (use *@group* syntax for groups)
with *permission* level. It returns a boolean that indicate if the rule
was correctly added.
"""
... | python | def add_acl(self, scope, user, permission):
"""Add an `ACL <https://www.dokuwiki.org/acl>`_ rule that restricts
the page/namespace *scope* to *user* (use *@group* syntax for groups)
with *permission* level. It returns a boolean that indicate if the rule
was correctly added.
"""
... | [
"def",
"add_acl",
"(",
"self",
",",
"scope",
",",
"user",
",",
"permission",
")",
":",
"return",
"self",
".",
"send",
"(",
"'plugin.acl.addAcl'",
",",
"scope",
",",
"user",
",",
"permission",
")"
] | Add an `ACL <https://www.dokuwiki.org/acl>`_ rule that restricts
the page/namespace *scope* to *user* (use *@group* syntax for groups)
with *permission* level. It returns a boolean that indicate if the rule
was correctly added. | [
"Add",
"an",
"ACL",
"<https",
":",
"//",
"www",
".",
"dokuwiki",
".",
"org",
"/",
"acl",
">",
"_",
"rule",
"that",
"restricts",
"the",
"page",
"/",
"namespace",
"*",
"scope",
"*",
"to",
"*",
"user",
"*",
"(",
"use",
"*"
] | train | https://github.com/fmenabe/python-dokuwiki/blob/7b5b13b764912b36f49a03a445c88f0934260eb1/dokuwiki.py#L221-L227 |
fmenabe/python-dokuwiki | dokuwiki.py | _Pages.info | def info(self, page, version=None):
"""Returns informations of *page*. Informations of the last version
is returned if *version* is not set.
"""
return (self._dokuwiki.send('wiki.getPageInfoVersion', page, version)
if version is not None
else self._dokuwik... | python | def info(self, page, version=None):
"""Returns informations of *page*. Informations of the last version
is returned if *version* is not set.
"""
return (self._dokuwiki.send('wiki.getPageInfoVersion', page, version)
if version is not None
else self._dokuwik... | [
"def",
"info",
"(",
"self",
",",
"page",
",",
"version",
"=",
"None",
")",
":",
"return",
"(",
"self",
".",
"_dokuwiki",
".",
"send",
"(",
"'wiki.getPageInfoVersion'",
",",
"page",
",",
"version",
")",
"if",
"version",
"is",
"not",
"None",
"else",
"sel... | Returns informations of *page*. Informations of the last version
is returned if *version* is not set. | [
"Returns",
"informations",
"of",
"*",
"page",
"*",
".",
"Informations",
"of",
"the",
"last",
"version",
"is",
"returned",
"if",
"*",
"version",
"*",
"is",
"not",
"set",
"."
] | train | https://github.com/fmenabe/python-dokuwiki/blob/7b5b13b764912b36f49a03a445c88f0934260eb1/dokuwiki.py#L281-L287 |
fmenabe/python-dokuwiki | dokuwiki.py | _Pages.get | def get(self, page, version=None):
"""Returns the content of *page*. The content of the last version is
returned if *version* is not set.
"""
return (self._dokuwiki.send('wiki.getPageVersion', page, version)
if version is not None
else self._dokuwiki.send(... | python | def get(self, page, version=None):
"""Returns the content of *page*. The content of the last version is
returned if *version* is not set.
"""
return (self._dokuwiki.send('wiki.getPageVersion', page, version)
if version is not None
else self._dokuwiki.send(... | [
"def",
"get",
"(",
"self",
",",
"page",
",",
"version",
"=",
"None",
")",
":",
"return",
"(",
"self",
".",
"_dokuwiki",
".",
"send",
"(",
"'wiki.getPageVersion'",
",",
"page",
",",
"version",
")",
"if",
"version",
"is",
"not",
"None",
"else",
"self",
... | Returns the content of *page*. The content of the last version is
returned if *version* is not set. | [
"Returns",
"the",
"content",
"of",
"*",
"page",
"*",
".",
"The",
"content",
"of",
"the",
"last",
"version",
"is",
"returned",
"if",
"*",
"version",
"*",
"is",
"not",
"set",
"."
] | train | https://github.com/fmenabe/python-dokuwiki/blob/7b5b13b764912b36f49a03a445c88f0934260eb1/dokuwiki.py#L289-L295 |
fmenabe/python-dokuwiki | dokuwiki.py | _Pages.append | def append(self, page, content, **options):
"""Appends *content* text to *page*.
Valid *options* are:
* *sum*: (str) change summary
* *minor*: (bool) whether this is a minor change
"""
return self._dokuwiki.send('dokuwiki.appendPage', page, content, options) | python | def append(self, page, content, **options):
"""Appends *content* text to *page*.
Valid *options* are:
* *sum*: (str) change summary
* *minor*: (bool) whether this is a minor change
"""
return self._dokuwiki.send('dokuwiki.appendPage', page, content, options) | [
"def",
"append",
"(",
"self",
",",
"page",
",",
"content",
",",
"*",
"*",
"options",
")",
":",
"return",
"self",
".",
"_dokuwiki",
".",
"send",
"(",
"'dokuwiki.appendPage'",
",",
"page",
",",
"content",
",",
"options",
")"
] | Appends *content* text to *page*.
Valid *options* are:
* *sum*: (str) change summary
* *minor*: (bool) whether this is a minor change | [
"Appends",
"*",
"content",
"*",
"text",
"to",
"*",
"page",
"*",
"."
] | train | https://github.com/fmenabe/python-dokuwiki/blob/7b5b13b764912b36f49a03a445c88f0934260eb1/dokuwiki.py#L298-L306 |
fmenabe/python-dokuwiki | dokuwiki.py | _Pages.html | def html(self, page, version=None):
"""Returns HTML content of *page*. The HTML content of the last version
of the page is returned if *version* is not set.
"""
return (self._dokuwiki.send('wiki.getPageHTMLVersion', page, version)
if version is not None
el... | python | def html(self, page, version=None):
"""Returns HTML content of *page*. The HTML content of the last version
of the page is returned if *version* is not set.
"""
return (self._dokuwiki.send('wiki.getPageHTMLVersion', page, version)
if version is not None
el... | [
"def",
"html",
"(",
"self",
",",
"page",
",",
"version",
"=",
"None",
")",
":",
"return",
"(",
"self",
".",
"_dokuwiki",
".",
"send",
"(",
"'wiki.getPageHTMLVersion'",
",",
"page",
",",
"version",
")",
"if",
"version",
"is",
"not",
"None",
"else",
"sel... | Returns HTML content of *page*. The HTML content of the last version
of the page is returned if *version* is not set. | [
"Returns",
"HTML",
"content",
"of",
"*",
"page",
"*",
".",
"The",
"HTML",
"content",
"of",
"the",
"last",
"version",
"of",
"the",
"page",
"is",
"returned",
"if",
"*",
"version",
"*",
"is",
"not",
"set",
"."
] | train | https://github.com/fmenabe/python-dokuwiki/blob/7b5b13b764912b36f49a03a445c88f0934260eb1/dokuwiki.py#L308-L314 |
fmenabe/python-dokuwiki | dokuwiki.py | _Pages.set | def set(self, page, content, **options):
"""Set/replace the *content* of *page*.
Valid *options* are:
* *sum*: (str) change summary
* *minor*: (bool) whether this is a minor change
"""
try:
return self._dokuwiki.send('wiki.putPage', page, content, op... | python | def set(self, page, content, **options):
"""Set/replace the *content* of *page*.
Valid *options* are:
* *sum*: (str) change summary
* *minor*: (bool) whether this is a minor change
"""
try:
return self._dokuwiki.send('wiki.putPage', page, content, op... | [
"def",
"set",
"(",
"self",
",",
"page",
",",
"content",
",",
"*",
"*",
"options",
")",
":",
"try",
":",
"return",
"self",
".",
"_dokuwiki",
".",
"send",
"(",
"'wiki.putPage'",
",",
"page",
",",
"content",
",",
"options",
")",
"except",
"ExpatError",
... | Set/replace the *content* of *page*.
Valid *options* are:
* *sum*: (str) change summary
* *minor*: (bool) whether this is a minor change | [
"Set",
"/",
"replace",
"the",
"*",
"content",
"*",
"of",
"*",
"page",
"*",
"."
] | train | https://github.com/fmenabe/python-dokuwiki/blob/7b5b13b764912b36f49a03a445c88f0934260eb1/dokuwiki.py#L316-L331 |
fmenabe/python-dokuwiki | dokuwiki.py | _Pages.lock | def lock(self, page):
"""Locks *page*."""
result = self._dokuwiki.send('dokuwiki.setLocks',
lock=[page], unlock=[])
if result['lockfail']:
raise DokuWikiError('unable to lock page') | python | def lock(self, page):
"""Locks *page*."""
result = self._dokuwiki.send('dokuwiki.setLocks',
lock=[page], unlock=[])
if result['lockfail']:
raise DokuWikiError('unable to lock page') | [
"def",
"lock",
"(",
"self",
",",
"page",
")",
":",
"result",
"=",
"self",
".",
"_dokuwiki",
".",
"send",
"(",
"'dokuwiki.setLocks'",
",",
"lock",
"=",
"[",
"page",
"]",
",",
"unlock",
"=",
"[",
"]",
")",
"if",
"result",
"[",
"'lockfail'",
"]",
":",... | Locks *page*. | [
"Locks",
"*",
"page",
"*",
"."
] | train | https://github.com/fmenabe/python-dokuwiki/blob/7b5b13b764912b36f49a03a445c88f0934260eb1/dokuwiki.py#L337-L342 |
fmenabe/python-dokuwiki | dokuwiki.py | _Medias.get | def get(self, media, dirpath=None, filename=None, overwrite=False, b64decode=False):
"""Returns the binary data of *media* or save it to a file. If *dirpath*
is not set the binary data is returned, otherwise the data is saved
to a file. By default, the filename is the name of the media but it ca... | python | def get(self, media, dirpath=None, filename=None, overwrite=False, b64decode=False):
"""Returns the binary data of *media* or save it to a file. If *dirpath*
is not set the binary data is returned, otherwise the data is saved
to a file. By default, the filename is the name of the media but it ca... | [
"def",
"get",
"(",
"self",
",",
"media",
",",
"dirpath",
"=",
"None",
",",
"filename",
"=",
"None",
",",
"overwrite",
"=",
"False",
",",
"b64decode",
"=",
"False",
")",
":",
"import",
"os",
"data",
"=",
"self",
".",
"_dokuwiki",
".",
"send",
"(",
"... | Returns the binary data of *media* or save it to a file. If *dirpath*
is not set the binary data is returned, otherwise the data is saved
to a file. By default, the filename is the name of the media but it can
be changed with *filename* parameter. *overwrite* parameter allow to
overwrite... | [
"Returns",
"the",
"binary",
"data",
"of",
"*",
"media",
"*",
"or",
"save",
"it",
"to",
"a",
"file",
".",
"If",
"*",
"dirpath",
"*",
"is",
"not",
"set",
"the",
"binary",
"data",
"is",
"returned",
"otherwise",
"the",
"data",
"is",
"saved",
"to",
"a",
... | train | https://github.com/fmenabe/python-dokuwiki/blob/7b5b13b764912b36f49a03a445c88f0934260eb1/dokuwiki.py#L397-L419 |
fmenabe/python-dokuwiki | dokuwiki.py | _Medias.add | def add(self, media, filepath, overwrite=True):
"""Set *media* from local file *filepath*. *overwrite* parameter specify
if the media must be overwrite if it exists remotely.
"""
with open(filepath, 'rb') as fhandler:
self._dokuwiki.send('wiki.putAttachment', media,
... | python | def add(self, media, filepath, overwrite=True):
"""Set *media* from local file *filepath*. *overwrite* parameter specify
if the media must be overwrite if it exists remotely.
"""
with open(filepath, 'rb') as fhandler:
self._dokuwiki.send('wiki.putAttachment', media,
... | [
"def",
"add",
"(",
"self",
",",
"media",
",",
"filepath",
",",
"overwrite",
"=",
"True",
")",
":",
"with",
"open",
"(",
"filepath",
",",
"'rb'",
")",
"as",
"fhandler",
":",
"self",
".",
"_dokuwiki",
".",
"send",
"(",
"'wiki.putAttachment'",
",",
"media... | Set *media* from local file *filepath*. *overwrite* parameter specify
if the media must be overwrite if it exists remotely. | [
"Set",
"*",
"media",
"*",
"from",
"local",
"file",
"*",
"filepath",
"*",
".",
"*",
"overwrite",
"*",
"parameter",
"specify",
"if",
"the",
"media",
"must",
"be",
"overwrite",
"if",
"it",
"exists",
"remotely",
"."
] | train | https://github.com/fmenabe/python-dokuwiki/blob/7b5b13b764912b36f49a03a445c88f0934260eb1/dokuwiki.py#L425-L431 |
fmenabe/python-dokuwiki | dokuwiki.py | _Medias.set | def set(self, media, _bytes, overwrite=True, b64encode=False):
"""Set *media* from *_bytes*. *overwrite* parameter specify if the media
must be overwrite if it exists remotely.
"""
data = base64.b64encode(_bytes) if b64encode else Binary(_bytes)
self._dokuwiki.send('wiki.putAttac... | python | def set(self, media, _bytes, overwrite=True, b64encode=False):
"""Set *media* from *_bytes*. *overwrite* parameter specify if the media
must be overwrite if it exists remotely.
"""
data = base64.b64encode(_bytes) if b64encode else Binary(_bytes)
self._dokuwiki.send('wiki.putAttac... | [
"def",
"set",
"(",
"self",
",",
"media",
",",
"_bytes",
",",
"overwrite",
"=",
"True",
",",
"b64encode",
"=",
"False",
")",
":",
"data",
"=",
"base64",
".",
"b64encode",
"(",
"_bytes",
")",
"if",
"b64encode",
"else",
"Binary",
"(",
"_bytes",
")",
"se... | Set *media* from *_bytes*. *overwrite* parameter specify if the media
must be overwrite if it exists remotely. | [
"Set",
"*",
"media",
"*",
"from",
"*",
"_bytes",
"*",
".",
"*",
"overwrite",
"*",
"parameter",
"specify",
"if",
"the",
"media",
"must",
"be",
"overwrite",
"if",
"it",
"exists",
"remotely",
"."
] | train | https://github.com/fmenabe/python-dokuwiki/blob/7b5b13b764912b36f49a03a445c88f0934260eb1/dokuwiki.py#L433-L438 |
fmenabe/python-dokuwiki | dokuwiki.py | Dataentry.get | def get(content, keep_order=False):
"""Get dataentry from *content*. *keep_order* indicates whether to
return an ordered dictionnay."""
if keep_order:
from collections import OrderedDict
dataentry = OrderedDict()
else:
dataentry = {}
found = F... | python | def get(content, keep_order=False):
"""Get dataentry from *content*. *keep_order* indicates whether to
return an ordered dictionnay."""
if keep_order:
from collections import OrderedDict
dataentry = OrderedDict()
else:
dataentry = {}
found = F... | [
"def",
"get",
"(",
"content",
",",
"keep_order",
"=",
"False",
")",
":",
"if",
"keep_order",
":",
"from",
"collections",
"import",
"OrderedDict",
"dataentry",
"=",
"OrderedDict",
"(",
")",
"else",
":",
"dataentry",
"=",
"{",
"}",
"found",
"=",
"False",
"... | Get dataentry from *content*. *keep_order* indicates whether to
return an ordered dictionnay. | [
"Get",
"dataentry",
"from",
"*",
"content",
"*",
".",
"*",
"keep_order",
"*",
"indicates",
"whether",
"to",
"return",
"an",
"ordered",
"dictionnay",
"."
] | train | https://github.com/fmenabe/python-dokuwiki/blob/7b5b13b764912b36f49a03a445c88f0934260eb1/dokuwiki.py#L449-L475 |
fmenabe/python-dokuwiki | dokuwiki.py | Dataentry.gen | def gen(name, data):
"""Generate dataentry *name* from *data*."""
return '---- dataentry %s ----\n%s\n----' % (name, '\n'.join(
'%s:%s' % (attr, value) for attr, value in data.items())) | python | def gen(name, data):
"""Generate dataentry *name* from *data*."""
return '---- dataentry %s ----\n%s\n----' % (name, '\n'.join(
'%s:%s' % (attr, value) for attr, value in data.items())) | [
"def",
"gen",
"(",
"name",
",",
"data",
")",
":",
"return",
"'---- dataentry %s ----\\n%s\\n----'",
"%",
"(",
"name",
",",
"'\\n'",
".",
"join",
"(",
"'%s:%s'",
"%",
"(",
"attr",
",",
"value",
")",
"for",
"attr",
",",
"value",
"in",
"data",
".",
"items... | Generate dataentry *name* from *data*. | [
"Generate",
"dataentry",
"*",
"name",
"*",
"from",
"*",
"data",
"*",
"."
] | train | https://github.com/fmenabe/python-dokuwiki/blob/7b5b13b764912b36f49a03a445c88f0934260eb1/dokuwiki.py#L478-L481 |
fmenabe/python-dokuwiki | dokuwiki.py | Dataentry.ignore | def ignore(content):
"""Remove dataentry from *content*."""
page_content = []
start = False
for line in content.split('\n'):
if line == '----' and not start:
start = True
continue
if start:
page_content.append(line)
... | python | def ignore(content):
"""Remove dataentry from *content*."""
page_content = []
start = False
for line in content.split('\n'):
if line == '----' and not start:
start = True
continue
if start:
page_content.append(line)
... | [
"def",
"ignore",
"(",
"content",
")",
":",
"page_content",
"=",
"[",
"]",
"start",
"=",
"False",
"for",
"line",
"in",
"content",
".",
"split",
"(",
"'\\n'",
")",
":",
"if",
"line",
"==",
"'----'",
"and",
"not",
"start",
":",
"start",
"=",
"True",
"... | Remove dataentry from *content*. | [
"Remove",
"dataentry",
"from",
"*",
"content",
"*",
"."
] | train | https://github.com/fmenabe/python-dokuwiki/blob/7b5b13b764912b36f49a03a445c88f0934260eb1/dokuwiki.py#L484-L494 |
pyQode/pyqode.core | pyqode/core/panels/global_checker.py | GlobalCheckerPanel._draw_messages | def _draw_messages(self, painter):
"""
Draw messages from all subclass of CheckerMode currently
installed on the editor.
:type painter: QtGui.QPainter
"""
checker_modes = []
for m in self.editor.modes:
if isinstance(m, modes.CheckerMode):
... | python | def _draw_messages(self, painter):
"""
Draw messages from all subclass of CheckerMode currently
installed on the editor.
:type painter: QtGui.QPainter
"""
checker_modes = []
for m in self.editor.modes:
if isinstance(m, modes.CheckerMode):
... | [
"def",
"_draw_messages",
"(",
"self",
",",
"painter",
")",
":",
"checker_modes",
"=",
"[",
"]",
"for",
"m",
"in",
"self",
".",
"editor",
".",
"modes",
":",
"if",
"isinstance",
"(",
"m",
",",
"modes",
".",
"CheckerMode",
")",
":",
"checker_modes",
".",
... | Draw messages from all subclass of CheckerMode currently
installed on the editor.
:type painter: QtGui.QPainter | [
"Draw",
"messages",
"from",
"all",
"subclass",
"of",
"CheckerMode",
"currently",
"installed",
"on",
"the",
"editor",
"."
] | train | https://github.com/pyQode/pyqode.core/blob/a99ec6cd22d519394f613309412f8329dc4e90cb/pyqode/core/panels/global_checker.py#L21-L41 |
pyQode/pyqode.core | pyqode/core/panels/global_checker.py | GlobalCheckerPanel._draw_visible_area | def _draw_visible_area(self, painter):
"""
Draw the visible area.
This method does not take folded blocks into account.
:type painter: QtGui.QPainter
"""
if self.editor.visible_blocks:
start = self.editor.visible_blocks[0][-1]
end = self.editor.v... | python | def _draw_visible_area(self, painter):
"""
Draw the visible area.
This method does not take folded blocks into account.
:type painter: QtGui.QPainter
"""
if self.editor.visible_blocks:
start = self.editor.visible_blocks[0][-1]
end = self.editor.v... | [
"def",
"_draw_visible_area",
"(",
"self",
",",
"painter",
")",
":",
"if",
"self",
".",
"editor",
".",
"visible_blocks",
":",
"start",
"=",
"self",
".",
"editor",
".",
"visible_blocks",
"[",
"0",
"]",
"[",
"-",
"1",
"]",
"end",
"=",
"self",
".",
"edit... | Draw the visible area.
This method does not take folded blocks into account.
:type painter: QtGui.QPainter | [
"Draw",
"the",
"visible",
"area",
"."
] | train | https://github.com/pyQode/pyqode.core/blob/a99ec6cd22d519394f613309412f8329dc4e90cb/pyqode/core/panels/global_checker.py#L43-L64 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.