repo stringlengths 7 55 | path stringlengths 4 127 | func_name stringlengths 1 88 | original_string stringlengths 75 19.8k | language stringclasses 1
value | code stringlengths 75 19.8k | code_tokens listlengths 20 707 | docstring stringlengths 3 17.3k | docstring_tokens listlengths 3 222 | sha stringlengths 40 40 | url stringlengths 87 242 | partition stringclasses 1
value | idx int64 0 252k |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
newville/wxmplot | examples/tifffile.py | decodepackbits | def decodepackbits(encoded):
"""Decompress PackBits encoded byte string.
PackBits is a simple byte-oriented run-length compression scheme.
"""
func = ord if sys.version[0] == '2' else lambda x: x
result = []
i = 0
try:
while True:
n = func(encoded[i]) + 1
i ... | python | def decodepackbits(encoded):
"""Decompress PackBits encoded byte string.
PackBits is a simple byte-oriented run-length compression scheme.
"""
func = ord if sys.version[0] == '2' else lambda x: x
result = []
i = 0
try:
while True:
n = func(encoded[i]) + 1
i ... | [
"def",
"decodepackbits",
"(",
"encoded",
")",
":",
"func",
"=",
"ord",
"if",
"sys",
".",
"version",
"[",
"0",
"]",
"==",
"'2'",
"else",
"lambda",
"x",
":",
"x",
"result",
"=",
"[",
"]",
"i",
"=",
"0",
"try",
":",
"while",
"True",
":",
"n",
"=",... | Decompress PackBits encoded byte string.
PackBits is a simple byte-oriented run-length compression scheme. | [
"Decompress",
"PackBits",
"encoded",
"byte",
"string",
"."
] | 8e0dc037453e5cdf18c968dc5a3d29efd761edee | https://github.com/newville/wxmplot/blob/8e0dc037453e5cdf18c968dc5a3d29efd761edee/examples/tifffile.py#L1535-L1556 | train | 61,100 |
newville/wxmplot | examples/tifffile.py | unpackints | def unpackints(data, dtype, itemsize, runlen=0):
"""Decompress byte string to array of integers of any bit size <= 32.
Parameters
----------
data : byte str
Data to decompress.
dtype : numpy.dtype or str
A numpy boolean or integer type.
itemsize : int
Number of bits per ... | python | def unpackints(data, dtype, itemsize, runlen=0):
"""Decompress byte string to array of integers of any bit size <= 32.
Parameters
----------
data : byte str
Data to decompress.
dtype : numpy.dtype or str
A numpy boolean or integer type.
itemsize : int
Number of bits per ... | [
"def",
"unpackints",
"(",
"data",
",",
"dtype",
",",
"itemsize",
",",
"runlen",
"=",
"0",
")",
":",
"if",
"itemsize",
"==",
"1",
":",
"# bitarray",
"data",
"=",
"numpy",
".",
"fromstring",
"(",
"data",
",",
"'|B'",
")",
"data",
"=",
"numpy",
".",
"... | Decompress byte string to array of integers of any bit size <= 32.
Parameters
----------
data : byte str
Data to decompress.
dtype : numpy.dtype or str
A numpy boolean or integer type.
itemsize : int
Number of bits per integer.
runlen : int
Number of consecutive ... | [
"Decompress",
"byte",
"string",
"to",
"array",
"of",
"integers",
"of",
"any",
"bit",
"size",
"<",
"=",
"32",
"."
] | 8e0dc037453e5cdf18c968dc5a3d29efd761edee | https://github.com/newville/wxmplot/blob/8e0dc037453e5cdf18c968dc5a3d29efd761edee/examples/tifffile.py#L1641-L1701 | train | 61,101 |
newville/wxmplot | examples/tifffile.py | stripnull | def stripnull(string):
"""Return string truncated at first null character."""
i = string.find(b'\x00')
return string if (i < 0) else string[:i] | python | def stripnull(string):
"""Return string truncated at first null character."""
i = string.find(b'\x00')
return string if (i < 0) else string[:i] | [
"def",
"stripnull",
"(",
"string",
")",
":",
"i",
"=",
"string",
".",
"find",
"(",
"b'\\x00'",
")",
"return",
"string",
"if",
"(",
"i",
"<",
"0",
")",
"else",
"string",
"[",
":",
"i",
"]"
] | Return string truncated at first null character. | [
"Return",
"string",
"truncated",
"at",
"first",
"null",
"character",
"."
] | 8e0dc037453e5cdf18c968dc5a3d29efd761edee | https://github.com/newville/wxmplot/blob/8e0dc037453e5cdf18c968dc5a3d29efd761edee/examples/tifffile.py#L1788-L1791 | train | 61,102 |
newville/wxmplot | examples/tifffile.py | TIFFfile._fromfile | def _fromfile(self):
"""Read TIFF header and all page records from file."""
self._fd.seek(0)
try:
self.byte_order = {b'II': '<', b'MM': '>'}[self._fd.read(2)]
except KeyError:
raise ValueError("not a valid TIFF file")
version = struct.unpack(self.byte_orde... | python | def _fromfile(self):
"""Read TIFF header and all page records from file."""
self._fd.seek(0)
try:
self.byte_order = {b'II': '<', b'MM': '>'}[self._fd.read(2)]
except KeyError:
raise ValueError("not a valid TIFF file")
version = struct.unpack(self.byte_orde... | [
"def",
"_fromfile",
"(",
"self",
")",
":",
"self",
".",
"_fd",
".",
"seek",
"(",
"0",
")",
"try",
":",
"self",
".",
"byte_order",
"=",
"{",
"b'II'",
":",
"'<'",
",",
"b'MM'",
":",
"'>'",
"}",
"[",
"self",
".",
"_fd",
".",
"read",
"(",
"2",
")... | Read TIFF header and all page records from file. | [
"Read",
"TIFF",
"header",
"and",
"all",
"page",
"records",
"from",
"file",
"."
] | 8e0dc037453e5cdf18c968dc5a3d29efd761edee | https://github.com/newville/wxmplot/blob/8e0dc037453e5cdf18c968dc5a3d29efd761edee/examples/tifffile.py#L469-L494 | train | 61,103 |
newville/wxmplot | examples/tifffile.py | TIFFfile.asarray | def asarray(self, key=None, series=None):
"""Return image data of multiple TIFF pages as numpy array.
By default the first image series is returned.
Parameters
----------
key : int, slice, or sequence of page indices
Defines which pages to return as array.
s... | python | def asarray(self, key=None, series=None):
"""Return image data of multiple TIFF pages as numpy array.
By default the first image series is returned.
Parameters
----------
key : int, slice, or sequence of page indices
Defines which pages to return as array.
s... | [
"def",
"asarray",
"(",
"self",
",",
"key",
"=",
"None",
",",
"series",
"=",
"None",
")",
":",
"if",
"key",
"is",
"None",
"and",
"series",
"is",
"None",
":",
"series",
"=",
"0",
"if",
"series",
"is",
"not",
"None",
":",
"pages",
"=",
"self",
".",
... | Return image data of multiple TIFF pages as numpy array.
By default the first image series is returned.
Parameters
----------
key : int, slice, or sequence of page indices
Defines which pages to return as array.
series : int
Defines which series of pages... | [
"Return",
"image",
"data",
"of",
"multiple",
"TIFF",
"pages",
"as",
"numpy",
"array",
"."
] | 8e0dc037453e5cdf18c968dc5a3d29efd761edee | https://github.com/newville/wxmplot/blob/8e0dc037453e5cdf18c968dc5a3d29efd761edee/examples/tifffile.py#L563-L618 | train | 61,104 |
newville/wxmplot | examples/tifffile.py | TIFFpage._fromfile | def _fromfile(self):
"""Read TIFF IFD structure and its tags from file.
File cursor must be at storage position of IFD offset and is left at
offset to next IFD.
Raises StopIteration if offset (first bytes read) is 0.
"""
fd = self.parent._fd
byte_order = self.p... | python | def _fromfile(self):
"""Read TIFF IFD structure and its tags from file.
File cursor must be at storage position of IFD offset and is left at
offset to next IFD.
Raises StopIteration if offset (first bytes read) is 0.
"""
fd = self.parent._fd
byte_order = self.p... | [
"def",
"_fromfile",
"(",
"self",
")",
":",
"fd",
"=",
"self",
".",
"parent",
".",
"_fd",
"byte_order",
"=",
"self",
".",
"parent",
".",
"byte_order",
"offset_size",
"=",
"self",
".",
"parent",
".",
"offset_size",
"fmt",
"=",
"{",
"4",
":",
"'I'",
","... | Read TIFF IFD structure and its tags from file.
File cursor must be at storage position of IFD offset and is left at
offset to next IFD.
Raises StopIteration if offset (first bytes read) is 0. | [
"Read",
"TIFF",
"IFD",
"structure",
"and",
"its",
"tags",
"from",
"file",
"."
] | 8e0dc037453e5cdf18c968dc5a3d29efd761edee | https://github.com/newville/wxmplot/blob/8e0dc037453e5cdf18c968dc5a3d29efd761edee/examples/tifffile.py#L825-L872 | train | 61,105 |
newville/wxmplot | examples/tifffile.py | TIFFtag._fromdata | def _fromdata(self, code, dtype, count, value, name=None):
"""Initialize instance from arguments."""
self.code = int(code)
self.name = name if name else str(code)
self.dtype = TIFF_DATA_TYPES[dtype]
self.count = int(count)
self.value = value | python | def _fromdata(self, code, dtype, count, value, name=None):
"""Initialize instance from arguments."""
self.code = int(code)
self.name = name if name else str(code)
self.dtype = TIFF_DATA_TYPES[dtype]
self.count = int(count)
self.value = value | [
"def",
"_fromdata",
"(",
"self",
",",
"code",
",",
"dtype",
",",
"count",
",",
"value",
",",
"name",
"=",
"None",
")",
":",
"self",
".",
"code",
"=",
"int",
"(",
"code",
")",
"self",
".",
"name",
"=",
"name",
"if",
"name",
"else",
"str",
"(",
"... | Initialize instance from arguments. | [
"Initialize",
"instance",
"from",
"arguments",
"."
] | 8e0dc037453e5cdf18c968dc5a3d29efd761edee | https://github.com/newville/wxmplot/blob/8e0dc037453e5cdf18c968dc5a3d29efd761edee/examples/tifffile.py#L1249-L1255 | train | 61,106 |
newville/wxmplot | examples/tifffile.py | TIFFtag._fromfile | def _fromfile(self, parent):
"""Read tag structure from open file. Advance file cursor."""
fd = parent._fd
byte_order = parent.byte_order
self._offset = fd.tell()
self.value_offset = self._offset + parent.offset_size + 4
fmt, size = {4: ('HHI4s', 12), 8: ('HHQ8s', 20)}[... | python | def _fromfile(self, parent):
"""Read tag structure from open file. Advance file cursor."""
fd = parent._fd
byte_order = parent.byte_order
self._offset = fd.tell()
self.value_offset = self._offset + parent.offset_size + 4
fmt, size = {4: ('HHI4s', 12), 8: ('HHQ8s', 20)}[... | [
"def",
"_fromfile",
"(",
"self",
",",
"parent",
")",
":",
"fd",
"=",
"parent",
".",
"_fd",
"byte_order",
"=",
"parent",
".",
"byte_order",
"self",
".",
"_offset",
"=",
"fd",
".",
"tell",
"(",
")",
"self",
".",
"value_offset",
"=",
"self",
".",
"_offs... | Read tag structure from open file. Advance file cursor. | [
"Read",
"tag",
"structure",
"from",
"open",
"file",
".",
"Advance",
"file",
"cursor",
"."
] | 8e0dc037453e5cdf18c968dc5a3d29efd761edee | https://github.com/newville/wxmplot/blob/8e0dc037453e5cdf18c968dc5a3d29efd761edee/examples/tifffile.py#L1257-L1315 | train | 61,107 |
newville/wxmplot | wxmplot/stackedplotframe.py | StackedPlotFrame.set_xylims | def set_xylims(self, lims, axes=None, panel='top', **kws):
"""set xy limits"""
panel = self.get_panel(panel)
# print("Stacked set_xylims ", panel, self.panel)
panel.set_xylims(lims, axes=axes, **kws) | python | def set_xylims(self, lims, axes=None, panel='top', **kws):
"""set xy limits"""
panel = self.get_panel(panel)
# print("Stacked set_xylims ", panel, self.panel)
panel.set_xylims(lims, axes=axes, **kws) | [
"def",
"set_xylims",
"(",
"self",
",",
"lims",
",",
"axes",
"=",
"None",
",",
"panel",
"=",
"'top'",
",",
"*",
"*",
"kws",
")",
":",
"panel",
"=",
"self",
".",
"get_panel",
"(",
"panel",
")",
"# print(\"Stacked set_xylims \", panel, self.panel)",
"panel",
... | set xy limits | [
"set",
"xy",
"limits"
] | 8e0dc037453e5cdf18c968dc5a3d29efd761edee | https://github.com/newville/wxmplot/blob/8e0dc037453e5cdf18c968dc5a3d29efd761edee/wxmplot/stackedplotframe.py#L74-L78 | train | 61,108 |
newville/wxmplot | wxmplot/stackedplotframe.py | StackedPlotFrame.onThemeColor | def onThemeColor(self, color, item):
"""pass theme colors to bottom panel"""
bconf = self.panel_bot.conf
if item == 'grid':
bconf.set_gridcolor(color)
elif item == 'bg':
bconf.set_bgcolor(color)
elif item == 'frame':
bconf.set_framecolor(color)... | python | def onThemeColor(self, color, item):
"""pass theme colors to bottom panel"""
bconf = self.panel_bot.conf
if item == 'grid':
bconf.set_gridcolor(color)
elif item == 'bg':
bconf.set_bgcolor(color)
elif item == 'frame':
bconf.set_framecolor(color)... | [
"def",
"onThemeColor",
"(",
"self",
",",
"color",
",",
"item",
")",
":",
"bconf",
"=",
"self",
".",
"panel_bot",
".",
"conf",
"if",
"item",
"==",
"'grid'",
":",
"bconf",
".",
"set_gridcolor",
"(",
"color",
")",
"elif",
"item",
"==",
"'bg'",
":",
"bco... | pass theme colors to bottom panel | [
"pass",
"theme",
"colors",
"to",
"bottom",
"panel"
] | 8e0dc037453e5cdf18c968dc5a3d29efd761edee | https://github.com/newville/wxmplot/blob/8e0dc037453e5cdf18c968dc5a3d29efd761edee/wxmplot/stackedplotframe.py#L210-L221 | train | 61,109 |
benhoff/pluginmanager | pluginmanager/entry_point_manager.py | EntryPointManager.add_entry_points | def add_entry_points(self, names):
"""
adds `names` to the internal collection of entry points to track
`names` can be a single object or an iterable but
must be a string or iterable of strings.
"""
names = util.return_set(names)
self.entry_point_names.update(nam... | python | def add_entry_points(self, names):
"""
adds `names` to the internal collection of entry points to track
`names` can be a single object or an iterable but
must be a string or iterable of strings.
"""
names = util.return_set(names)
self.entry_point_names.update(nam... | [
"def",
"add_entry_points",
"(",
"self",
",",
"names",
")",
":",
"names",
"=",
"util",
".",
"return_set",
"(",
"names",
")",
"self",
".",
"entry_point_names",
".",
"update",
"(",
"names",
")"
] | adds `names` to the internal collection of entry points to track
`names` can be a single object or an iterable but
must be a string or iterable of strings. | [
"adds",
"names",
"to",
"the",
"internal",
"collection",
"of",
"entry",
"points",
"to",
"track"
] | a8a184f9ebfbb521703492cb88c1dbda4cd04c06 | https://github.com/benhoff/pluginmanager/blob/a8a184f9ebfbb521703492cb88c1dbda4cd04c06/pluginmanager/entry_point_manager.py#L18-L26 | train | 61,110 |
benhoff/pluginmanager | pluginmanager/entry_point_manager.py | EntryPointManager.set_entry_points | def set_entry_points(self, names):
"""
sets the internal collection of entry points to be
equal to `names`
`names` can be a single object or an iterable but
must be a string or iterable of strings.
"""
names = util.return_set(names)
self.entry_point_names... | python | def set_entry_points(self, names):
"""
sets the internal collection of entry points to be
equal to `names`
`names` can be a single object or an iterable but
must be a string or iterable of strings.
"""
names = util.return_set(names)
self.entry_point_names... | [
"def",
"set_entry_points",
"(",
"self",
",",
"names",
")",
":",
"names",
"=",
"util",
".",
"return_set",
"(",
"names",
")",
"self",
".",
"entry_point_names",
"=",
"names"
] | sets the internal collection of entry points to be
equal to `names`
`names` can be a single object or an iterable but
must be a string or iterable of strings. | [
"sets",
"the",
"internal",
"collection",
"of",
"entry",
"points",
"to",
"be",
"equal",
"to",
"names"
] | a8a184f9ebfbb521703492cb88c1dbda4cd04c06 | https://github.com/benhoff/pluginmanager/blob/a8a184f9ebfbb521703492cb88c1dbda4cd04c06/pluginmanager/entry_point_manager.py#L28-L37 | train | 61,111 |
benhoff/pluginmanager | pluginmanager/entry_point_manager.py | EntryPointManager.remove_entry_points | def remove_entry_points(self, names):
"""
removes `names` from the set of entry points to track.
`names` can be a single object or an iterable.
"""
names = util.return_set(names)
util.remove_from_set(self.entry_point_names,
names) | python | def remove_entry_points(self, names):
"""
removes `names` from the set of entry points to track.
`names` can be a single object or an iterable.
"""
names = util.return_set(names)
util.remove_from_set(self.entry_point_names,
names) | [
"def",
"remove_entry_points",
"(",
"self",
",",
"names",
")",
":",
"names",
"=",
"util",
".",
"return_set",
"(",
"names",
")",
"util",
".",
"remove_from_set",
"(",
"self",
".",
"entry_point_names",
",",
"names",
")"
] | removes `names` from the set of entry points to track.
`names` can be a single object or an iterable. | [
"removes",
"names",
"from",
"the",
"set",
"of",
"entry",
"points",
"to",
"track",
"."
] | a8a184f9ebfbb521703492cb88c1dbda4cd04c06 | https://github.com/benhoff/pluginmanager/blob/a8a184f9ebfbb521703492cb88c1dbda4cd04c06/pluginmanager/entry_point_manager.py#L39-L47 | train | 61,112 |
benhoff/pluginmanager | pluginmanager/util.py | to_absolute_paths | def to_absolute_paths(paths):
"""
helper method to change `paths` to absolute paths.
Returns a `set` object
`paths` can be either a single object or iterable
"""
abspath = os.path.abspath
paths = return_set(paths)
absolute_paths = {abspath(x) for x in paths}
return absolute_paths | python | def to_absolute_paths(paths):
"""
helper method to change `paths` to absolute paths.
Returns a `set` object
`paths` can be either a single object or iterable
"""
abspath = os.path.abspath
paths = return_set(paths)
absolute_paths = {abspath(x) for x in paths}
return absolute_paths | [
"def",
"to_absolute_paths",
"(",
"paths",
")",
":",
"abspath",
"=",
"os",
".",
"path",
".",
"abspath",
"paths",
"=",
"return_set",
"(",
"paths",
")",
"absolute_paths",
"=",
"{",
"abspath",
"(",
"x",
")",
"for",
"x",
"in",
"paths",
"}",
"return",
"absol... | helper method to change `paths` to absolute paths.
Returns a `set` object
`paths` can be either a single object or iterable | [
"helper",
"method",
"to",
"change",
"paths",
"to",
"absolute",
"paths",
".",
"Returns",
"a",
"set",
"object",
"paths",
"can",
"be",
"either",
"a",
"single",
"object",
"or",
"iterable"
] | a8a184f9ebfbb521703492cb88c1dbda4cd04c06 | https://github.com/benhoff/pluginmanager/blob/a8a184f9ebfbb521703492cb88c1dbda4cd04c06/pluginmanager/util.py#L5-L14 | train | 61,113 |
newville/wxmplot | wxmplot/config.py | LineProperties.update | def update(self, line=None):
""" set a matplotlib Line2D to have the current properties"""
if line:
markercolor = self.markercolor
if markercolor is None: markercolor=self.color
# self.set_markeredgecolor(markercolor, line=line)
# self.set_markerfacecolor(... | python | def update(self, line=None):
""" set a matplotlib Line2D to have the current properties"""
if line:
markercolor = self.markercolor
if markercolor is None: markercolor=self.color
# self.set_markeredgecolor(markercolor, line=line)
# self.set_markerfacecolor(... | [
"def",
"update",
"(",
"self",
",",
"line",
"=",
"None",
")",
":",
"if",
"line",
":",
"markercolor",
"=",
"self",
".",
"markercolor",
"if",
"markercolor",
"is",
"None",
":",
"markercolor",
"=",
"self",
".",
"color",
"# self.set_markeredgecolor(markercolor, line... | set a matplotlib Line2D to have the current properties | [
"set",
"a",
"matplotlib",
"Line2D",
"to",
"have",
"the",
"current",
"properties"
] | 8e0dc037453e5cdf18c968dc5a3d29efd761edee | https://github.com/newville/wxmplot/blob/8e0dc037453e5cdf18c968dc5a3d29efd761edee/wxmplot/config.py#L102-L116 | train | 61,114 |
newville/wxmplot | wxmplot/config.py | PlotConfig._init_trace | def _init_trace(self, n, color, style,
linewidth=2.5, zorder=None, marker=None, markersize=6):
""" used for building set of traces"""
while n >= len(self.traces):
self.traces.append(LineProperties())
line = self.traces[n]
label = "trace %i" % (n+1)
... | python | def _init_trace(self, n, color, style,
linewidth=2.5, zorder=None, marker=None, markersize=6):
""" used for building set of traces"""
while n >= len(self.traces):
self.traces.append(LineProperties())
line = self.traces[n]
label = "trace %i" % (n+1)
... | [
"def",
"_init_trace",
"(",
"self",
",",
"n",
",",
"color",
",",
"style",
",",
"linewidth",
"=",
"2.5",
",",
"zorder",
"=",
"None",
",",
"marker",
"=",
"None",
",",
"markersize",
"=",
"6",
")",
":",
"while",
"n",
">=",
"len",
"(",
"self",
".",
"tr... | used for building set of traces | [
"used",
"for",
"building",
"set",
"of",
"traces"
] | 8e0dc037453e5cdf18c968dc5a3d29efd761edee | https://github.com/newville/wxmplot/blob/8e0dc037453e5cdf18c968dc5a3d29efd761edee/wxmplot/config.py#L306-L323 | train | 61,115 |
newville/wxmplot | wxmplot/config.py | PlotConfig.set_gridcolor | def set_gridcolor(self, color):
"""set color for grid"""
self.gridcolor = color
for ax in self.canvas.figure.get_axes():
for i in ax.get_xgridlines()+ax.get_ygridlines():
i.set_color(color)
i.set_zorder(-1)
if callable(self.theme_color_callback... | python | def set_gridcolor(self, color):
"""set color for grid"""
self.gridcolor = color
for ax in self.canvas.figure.get_axes():
for i in ax.get_xgridlines()+ax.get_ygridlines():
i.set_color(color)
i.set_zorder(-1)
if callable(self.theme_color_callback... | [
"def",
"set_gridcolor",
"(",
"self",
",",
"color",
")",
":",
"self",
".",
"gridcolor",
"=",
"color",
"for",
"ax",
"in",
"self",
".",
"canvas",
".",
"figure",
".",
"get_axes",
"(",
")",
":",
"for",
"i",
"in",
"ax",
".",
"get_xgridlines",
"(",
")",
"... | set color for grid | [
"set",
"color",
"for",
"grid"
] | 8e0dc037453e5cdf18c968dc5a3d29efd761edee | https://github.com/newville/wxmplot/blob/8e0dc037453e5cdf18c968dc5a3d29efd761edee/wxmplot/config.py#L401-L409 | train | 61,116 |
newville/wxmplot | wxmplot/config.py | PlotConfig.set_bgcolor | def set_bgcolor(self, color):
"""set color for background of plot"""
self.bgcolor = color
for ax in self.canvas.figure.get_axes():
if matplotlib.__version__ < '2.0':
ax.set_axis_bgcolor(color)
else:
ax.set_facecolor(color)
if callab... | python | def set_bgcolor(self, color):
"""set color for background of plot"""
self.bgcolor = color
for ax in self.canvas.figure.get_axes():
if matplotlib.__version__ < '2.0':
ax.set_axis_bgcolor(color)
else:
ax.set_facecolor(color)
if callab... | [
"def",
"set_bgcolor",
"(",
"self",
",",
"color",
")",
":",
"self",
".",
"bgcolor",
"=",
"color",
"for",
"ax",
"in",
"self",
".",
"canvas",
".",
"figure",
".",
"get_axes",
"(",
")",
":",
"if",
"matplotlib",
".",
"__version__",
"<",
"'2.0'",
":",
"ax",... | set color for background of plot | [
"set",
"color",
"for",
"background",
"of",
"plot"
] | 8e0dc037453e5cdf18c968dc5a3d29efd761edee | https://github.com/newville/wxmplot/blob/8e0dc037453e5cdf18c968dc5a3d29efd761edee/wxmplot/config.py#L412-L421 | train | 61,117 |
newville/wxmplot | wxmplot/config.py | PlotConfig.set_framecolor | def set_framecolor(self, color):
"""set color for outer frame"""
self.framecolor = color
self.canvas.figure.set_facecolor(color)
if callable(self.theme_color_callback):
self.theme_color_callback(color, 'frame') | python | def set_framecolor(self, color):
"""set color for outer frame"""
self.framecolor = color
self.canvas.figure.set_facecolor(color)
if callable(self.theme_color_callback):
self.theme_color_callback(color, 'frame') | [
"def",
"set_framecolor",
"(",
"self",
",",
"color",
")",
":",
"self",
".",
"framecolor",
"=",
"color",
"self",
".",
"canvas",
".",
"figure",
".",
"set_facecolor",
"(",
"color",
")",
"if",
"callable",
"(",
"self",
".",
"theme_color_callback",
")",
":",
"s... | set color for outer frame | [
"set",
"color",
"for",
"outer",
"frame"
] | 8e0dc037453e5cdf18c968dc5a3d29efd761edee | https://github.com/newville/wxmplot/blob/8e0dc037453e5cdf18c968dc5a3d29efd761edee/wxmplot/config.py#L423-L428 | train | 61,118 |
newville/wxmplot | wxmplot/config.py | PlotConfig.set_textcolor | def set_textcolor(self, color):
"""set color for labels and axis text"""
self.textcolor = color
self.relabel()
if callable(self.theme_color_callback):
self.theme_color_callback(color, 'text') | python | def set_textcolor(self, color):
"""set color for labels and axis text"""
self.textcolor = color
self.relabel()
if callable(self.theme_color_callback):
self.theme_color_callback(color, 'text') | [
"def",
"set_textcolor",
"(",
"self",
",",
"color",
")",
":",
"self",
".",
"textcolor",
"=",
"color",
"self",
".",
"relabel",
"(",
")",
"if",
"callable",
"(",
"self",
".",
"theme_color_callback",
")",
":",
"self",
".",
"theme_color_callback",
"(",
"color",
... | set color for labels and axis text | [
"set",
"color",
"for",
"labels",
"and",
"axis",
"text"
] | 8e0dc037453e5cdf18c968dc5a3d29efd761edee | https://github.com/newville/wxmplot/blob/8e0dc037453e5cdf18c968dc5a3d29efd761edee/wxmplot/config.py#L430-L435 | train | 61,119 |
newville/wxmplot | wxmplot/config.py | PlotConfig.draw_legend | def draw_legend(self, show=None, auto_location=True, delay_draw=False):
"redraw the legend"
if show is not None:
self.show_legend = show
axes = self.canvas.figure.get_axes()
# clear existing legend
try:
lgn = self.mpl_legend
if lgn:
... | python | def draw_legend(self, show=None, auto_location=True, delay_draw=False):
"redraw the legend"
if show is not None:
self.show_legend = show
axes = self.canvas.figure.get_axes()
# clear existing legend
try:
lgn = self.mpl_legend
if lgn:
... | [
"def",
"draw_legend",
"(",
"self",
",",
"show",
"=",
"None",
",",
"auto_location",
"=",
"True",
",",
"delay_draw",
"=",
"False",
")",
":",
"if",
"show",
"is",
"not",
"None",
":",
"self",
".",
"show_legend",
"=",
"show",
"axes",
"=",
"self",
".",
"can... | redraw the legend | [
"redraw",
"the",
"legend"
] | 8e0dc037453e5cdf18c968dc5a3d29efd761edee | https://github.com/newville/wxmplot/blob/8e0dc037453e5cdf18c968dc5a3d29efd761edee/wxmplot/config.py#L565-L632 | train | 61,120 |
newville/wxmplot | wxmplot/config.py | PlotConfig.set_legend_location | def set_legend_location(self, loc, onaxis):
"set legend location"
self.legend_onaxis = 'on plot'
if not onaxis:
self.legend_onaxis = 'off plot'
if loc == 'best':
loc = 'upper right'
if loc in self.legend_abbrevs:
loc = self.legend_abbre... | python | def set_legend_location(self, loc, onaxis):
"set legend location"
self.legend_onaxis = 'on plot'
if not onaxis:
self.legend_onaxis = 'off plot'
if loc == 'best':
loc = 'upper right'
if loc in self.legend_abbrevs:
loc = self.legend_abbre... | [
"def",
"set_legend_location",
"(",
"self",
",",
"loc",
",",
"onaxis",
")",
":",
"self",
".",
"legend_onaxis",
"=",
"'on plot'",
"if",
"not",
"onaxis",
":",
"self",
".",
"legend_onaxis",
"=",
"'off plot'",
"if",
"loc",
"==",
"'best'",
":",
"loc",
"=",
"'u... | set legend location | [
"set",
"legend",
"location"
] | 8e0dc037453e5cdf18c968dc5a3d29efd761edee | https://github.com/newville/wxmplot/blob/8e0dc037453e5cdf18c968dc5a3d29efd761edee/wxmplot/config.py#L634-L644 | train | 61,121 |
newville/wxmplot | wxmplot/config.py | PlotConfig.unzoom | def unzoom(self, full=False, delay_draw=False):
"""unzoom display 1 level or all the way"""
if full:
self.zoom_lims = self.zoom_lims[:1]
self.zoom_lims = []
elif len(self.zoom_lims) > 0:
self.zoom_lims.pop()
self.set_viewlimits()
if not delay_d... | python | def unzoom(self, full=False, delay_draw=False):
"""unzoom display 1 level or all the way"""
if full:
self.zoom_lims = self.zoom_lims[:1]
self.zoom_lims = []
elif len(self.zoom_lims) > 0:
self.zoom_lims.pop()
self.set_viewlimits()
if not delay_d... | [
"def",
"unzoom",
"(",
"self",
",",
"full",
"=",
"False",
",",
"delay_draw",
"=",
"False",
")",
":",
"if",
"full",
":",
"self",
".",
"zoom_lims",
"=",
"self",
".",
"zoom_lims",
"[",
":",
"1",
"]",
"self",
".",
"zoom_lims",
"=",
"[",
"]",
"elif",
"... | unzoom display 1 level or all the way | [
"unzoom",
"display",
"1",
"level",
"or",
"all",
"the",
"way"
] | 8e0dc037453e5cdf18c968dc5a3d29efd761edee | https://github.com/newville/wxmplot/blob/8e0dc037453e5cdf18c968dc5a3d29efd761edee/wxmplot/config.py#L676-L685 | train | 61,122 |
newville/wxmplot | wxmplot/plotframe.py | PlotFrame.add_text | def add_text(self, text, x, y, **kws):
"""add text to plot"""
self.panel.add_text(text, x, y, **kws) | python | def add_text(self, text, x, y, **kws):
"""add text to plot"""
self.panel.add_text(text, x, y, **kws) | [
"def",
"add_text",
"(",
"self",
",",
"text",
",",
"x",
",",
"y",
",",
"*",
"*",
"kws",
")",
":",
"self",
".",
"panel",
".",
"add_text",
"(",
"text",
",",
"x",
",",
"y",
",",
"*",
"*",
"kws",
")"
] | add text to plot | [
"add",
"text",
"to",
"plot"
] | 8e0dc037453e5cdf18c968dc5a3d29efd761edee | https://github.com/newville/wxmplot/blob/8e0dc037453e5cdf18c968dc5a3d29efd761edee/wxmplot/plotframe.py#L26-L28 | train | 61,123 |
newville/wxmplot | wxmplot/plotframe.py | PlotFrame.add_arrow | def add_arrow(self, x1, y1, x2, y2, **kws):
"""add arrow to plot"""
self.panel.add_arrow(x1, y1, x2, y2, **kws) | python | def add_arrow(self, x1, y1, x2, y2, **kws):
"""add arrow to plot"""
self.panel.add_arrow(x1, y1, x2, y2, **kws) | [
"def",
"add_arrow",
"(",
"self",
",",
"x1",
",",
"y1",
",",
"x2",
",",
"y2",
",",
"*",
"*",
"kws",
")",
":",
"self",
".",
"panel",
".",
"add_arrow",
"(",
"x1",
",",
"y1",
",",
"x2",
",",
"y2",
",",
"*",
"*",
"kws",
")"
] | add arrow to plot | [
"add",
"arrow",
"to",
"plot"
] | 8e0dc037453e5cdf18c968dc5a3d29efd761edee | https://github.com/newville/wxmplot/blob/8e0dc037453e5cdf18c968dc5a3d29efd761edee/wxmplot/plotframe.py#L30-L32 | train | 61,124 |
newville/wxmplot | wxmplot/plotframe.py | PlotFrame.ExportTextFile | def ExportTextFile(self, fname, title='unknown plot'):
"save plot data to external file"
buff = ["# Plot Data for %s" % title,
"#---------------------------------"]
out = []
labels = []
itrace = 0
for ax in self.panel.fig.get_axes():
for line... | python | def ExportTextFile(self, fname, title='unknown plot'):
"save plot data to external file"
buff = ["# Plot Data for %s" % title,
"#---------------------------------"]
out = []
labels = []
itrace = 0
for ax in self.panel.fig.get_axes():
for line... | [
"def",
"ExportTextFile",
"(",
"self",
",",
"fname",
",",
"title",
"=",
"'unknown plot'",
")",
":",
"buff",
"=",
"[",
"\"# Plot Data for %s\"",
"%",
"title",
",",
"\"#---------------------------------\"",
"]",
"out",
"=",
"[",
"]",
"labels",
"=",
"[",
"]",
"i... | save plot data to external file | [
"save",
"plot",
"data",
"to",
"external",
"file"
] | 8e0dc037453e5cdf18c968dc5a3d29efd761edee | https://github.com/newville/wxmplot/blob/8e0dc037453e5cdf18c968dc5a3d29efd761edee/wxmplot/plotframe.py#L64-L108 | train | 61,125 |
benhoff/pluginmanager | pluginmanager/plugin_interface.py | PluginInterface.add_plugin_filepaths | def add_plugin_filepaths(self, filepaths, except_blacklisted=True):
"""
Adds `filepaths` to internal state. Recommend passing
in absolute filepaths. Method will attempt to convert to
absolute paths if they are not already.
`filepaths` can be a single object or an iterable
... | python | def add_plugin_filepaths(self, filepaths, except_blacklisted=True):
"""
Adds `filepaths` to internal state. Recommend passing
in absolute filepaths. Method will attempt to convert to
absolute paths if they are not already.
`filepaths` can be a single object or an iterable
... | [
"def",
"add_plugin_filepaths",
"(",
"self",
",",
"filepaths",
",",
"except_blacklisted",
"=",
"True",
")",
":",
"self",
".",
"file_manager",
".",
"add_plugin_filepaths",
"(",
"filepaths",
",",
"except_blacklisted",
")"
] | Adds `filepaths` to internal state. Recommend passing
in absolute filepaths. Method will attempt to convert to
absolute paths if they are not already.
`filepaths` can be a single object or an iterable
If `except_blacklisted` is `True`, all `filepaths` that
have been blacklisted... | [
"Adds",
"filepaths",
"to",
"internal",
"state",
".",
"Recommend",
"passing",
"in",
"absolute",
"filepaths",
".",
"Method",
"will",
"attempt",
"to",
"convert",
"to",
"absolute",
"paths",
"if",
"they",
"are",
"not",
"already",
"."
] | a8a184f9ebfbb521703492cb88c1dbda4cd04c06 | https://github.com/benhoff/pluginmanager/blob/a8a184f9ebfbb521703492cb88c1dbda4cd04c06/pluginmanager/plugin_interface.py#L214-L226 | train | 61,126 |
benhoff/pluginmanager | pluginmanager/plugin_interface.py | PluginInterface.set_plugin_filepaths | def set_plugin_filepaths(self, filepaths, except_blacklisted=True):
"""
Sets internal state to `filepaths`. Recommend passing
in absolute filepaths. Method will attempt to convert to
absolute paths if they are not already.
`filepaths` can be a single object or an iterable.
... | python | def set_plugin_filepaths(self, filepaths, except_blacklisted=True):
"""
Sets internal state to `filepaths`. Recommend passing
in absolute filepaths. Method will attempt to convert to
absolute paths if they are not already.
`filepaths` can be a single object or an iterable.
... | [
"def",
"set_plugin_filepaths",
"(",
"self",
",",
"filepaths",
",",
"except_blacklisted",
"=",
"True",
")",
":",
"self",
".",
"file_manager",
".",
"set_plugin_filepaths",
"(",
"filepaths",
",",
"except_blacklisted",
")"
] | Sets internal state to `filepaths`. Recommend passing
in absolute filepaths. Method will attempt to convert to
absolute paths if they are not already.
`filepaths` can be a single object or an iterable.
If `except_blacklisted` is `True`, all `filepaths` that
have been blackliste... | [
"Sets",
"internal",
"state",
"to",
"filepaths",
".",
"Recommend",
"passing",
"in",
"absolute",
"filepaths",
".",
"Method",
"will",
"attempt",
"to",
"convert",
"to",
"absolute",
"paths",
"if",
"they",
"are",
"not",
"already",
"."
] | a8a184f9ebfbb521703492cb88c1dbda4cd04c06 | https://github.com/benhoff/pluginmanager/blob/a8a184f9ebfbb521703492cb88c1dbda4cd04c06/pluginmanager/plugin_interface.py#L244-L256 | train | 61,127 |
benhoff/pluginmanager | pluginmanager/plugin_interface.py | PluginInterface.add_blacklisted_filepaths | def add_blacklisted_filepaths(self, filepaths, remove_from_stored=True):
"""
Add `filepaths` to blacklisted filepaths.
If `remove_from_stored` is `True`, any `filepaths` in
internal state will be automatically removed.
"""
self.file_manager.add_blacklisted_filepaths(filep... | python | def add_blacklisted_filepaths(self, filepaths, remove_from_stored=True):
"""
Add `filepaths` to blacklisted filepaths.
If `remove_from_stored` is `True`, any `filepaths` in
internal state will be automatically removed.
"""
self.file_manager.add_blacklisted_filepaths(filep... | [
"def",
"add_blacklisted_filepaths",
"(",
"self",
",",
"filepaths",
",",
"remove_from_stored",
"=",
"True",
")",
":",
"self",
".",
"file_manager",
".",
"add_blacklisted_filepaths",
"(",
"filepaths",
",",
"remove_from_stored",
")"
] | Add `filepaths` to blacklisted filepaths.
If `remove_from_stored` is `True`, any `filepaths` in
internal state will be automatically removed. | [
"Add",
"filepaths",
"to",
"blacklisted",
"filepaths",
".",
"If",
"remove_from_stored",
"is",
"True",
"any",
"filepaths",
"in",
"internal",
"state",
"will",
"be",
"automatically",
"removed",
"."
] | a8a184f9ebfbb521703492cb88c1dbda4cd04c06 | https://github.com/benhoff/pluginmanager/blob/a8a184f9ebfbb521703492cb88c1dbda4cd04c06/pluginmanager/plugin_interface.py#L411-L418 | train | 61,128 |
benhoff/pluginmanager | pluginmanager/file_manager.py | FileManager.collect_filepaths | def collect_filepaths(self, directories):
"""
Collects and returns every filepath from each directory in
`directories` that is filtered through the `file_filters`.
If no `file_filters` are present, passes every file in directory
as a result.
Always returns a `set` object
... | python | def collect_filepaths(self, directories):
"""
Collects and returns every filepath from each directory in
`directories` that is filtered through the `file_filters`.
If no `file_filters` are present, passes every file in directory
as a result.
Always returns a `set` object
... | [
"def",
"collect_filepaths",
"(",
"self",
",",
"directories",
")",
":",
"plugin_filepaths",
"=",
"set",
"(",
")",
"directories",
"=",
"util",
".",
"to_absolute_paths",
"(",
"directories",
")",
"for",
"directory",
"in",
"directories",
":",
"filepaths",
"=",
"uti... | Collects and returns every filepath from each directory in
`directories` that is filtered through the `file_filters`.
If no `file_filters` are present, passes every file in directory
as a result.
Always returns a `set` object
`directories` can be a object or an iterable. Recomme... | [
"Collects",
"and",
"returns",
"every",
"filepath",
"from",
"each",
"directory",
"in",
"directories",
"that",
"is",
"filtered",
"through",
"the",
"file_filters",
".",
"If",
"no",
"file_filters",
"are",
"present",
"passes",
"every",
"file",
"in",
"directory",
"as"... | a8a184f9ebfbb521703492cb88c1dbda4cd04c06 | https://github.com/benhoff/pluginmanager/blob/a8a184f9ebfbb521703492cb88c1dbda4cd04c06/pluginmanager/file_manager.py#L53-L73 | train | 61,129 |
benhoff/pluginmanager | pluginmanager/file_manager.py | FileManager.add_plugin_filepaths | def add_plugin_filepaths(self, filepaths, except_blacklisted=True):
"""
Adds `filepaths` to the `self.plugin_filepaths`. Recommend passing
in absolute filepaths. Method will attempt to convert to
absolute paths if they are not already.
`filepaths` can be a single object or an it... | python | def add_plugin_filepaths(self, filepaths, except_blacklisted=True):
"""
Adds `filepaths` to the `self.plugin_filepaths`. Recommend passing
in absolute filepaths. Method will attempt to convert to
absolute paths if they are not already.
`filepaths` can be a single object or an it... | [
"def",
"add_plugin_filepaths",
"(",
"self",
",",
"filepaths",
",",
"except_blacklisted",
"=",
"True",
")",
":",
"filepaths",
"=",
"util",
".",
"to_absolute_paths",
"(",
"filepaths",
")",
"if",
"except_blacklisted",
":",
"filepaths",
"=",
"util",
".",
"remove_fro... | Adds `filepaths` to the `self.plugin_filepaths`. Recommend passing
in absolute filepaths. Method will attempt to convert to
absolute paths if they are not already.
`filepaths` can be a single object or an iterable
If `except_blacklisted` is `True`, all `filepaths` that
have bee... | [
"Adds",
"filepaths",
"to",
"the",
"self",
".",
"plugin_filepaths",
".",
"Recommend",
"passing",
"in",
"absolute",
"filepaths",
".",
"Method",
"will",
"attempt",
"to",
"convert",
"to",
"absolute",
"paths",
"if",
"they",
"are",
"not",
"already",
"."
] | a8a184f9ebfbb521703492cb88c1dbda4cd04c06 | https://github.com/benhoff/pluginmanager/blob/a8a184f9ebfbb521703492cb88c1dbda4cd04c06/pluginmanager/file_manager.py#L75-L91 | train | 61,130 |
benhoff/pluginmanager | pluginmanager/file_manager.py | FileManager.set_plugin_filepaths | def set_plugin_filepaths(self, filepaths, except_blacklisted=True):
"""
Sets `filepaths` to the `self.plugin_filepaths`. Recommend passing
in absolute filepaths. Method will attempt to convert to
absolute paths if they are not already.
`filepaths` can be a single object or an it... | python | def set_plugin_filepaths(self, filepaths, except_blacklisted=True):
"""
Sets `filepaths` to the `self.plugin_filepaths`. Recommend passing
in absolute filepaths. Method will attempt to convert to
absolute paths if they are not already.
`filepaths` can be a single object or an it... | [
"def",
"set_plugin_filepaths",
"(",
"self",
",",
"filepaths",
",",
"except_blacklisted",
"=",
"True",
")",
":",
"filepaths",
"=",
"util",
".",
"to_absolute_paths",
"(",
"filepaths",
")",
"if",
"except_blacklisted",
":",
"filepaths",
"=",
"util",
".",
"remove_fro... | Sets `filepaths` to the `self.plugin_filepaths`. Recommend passing
in absolute filepaths. Method will attempt to convert to
absolute paths if they are not already.
`filepaths` can be a single object or an iterable.
If `except_blacklisted` is `True`, all `filepaths` that
have be... | [
"Sets",
"filepaths",
"to",
"the",
"self",
".",
"plugin_filepaths",
".",
"Recommend",
"passing",
"in",
"absolute",
"filepaths",
".",
"Method",
"will",
"attempt",
"to",
"convert",
"to",
"absolute",
"paths",
"if",
"they",
"are",
"not",
"already",
"."
] | a8a184f9ebfbb521703492cb88c1dbda4cd04c06 | https://github.com/benhoff/pluginmanager/blob/a8a184f9ebfbb521703492cb88c1dbda4cd04c06/pluginmanager/file_manager.py#L93-L109 | train | 61,131 |
benhoff/pluginmanager | pluginmanager/file_manager.py | FileManager.remove_plugin_filepaths | def remove_plugin_filepaths(self, filepaths):
"""
Removes `filepaths` from `self.plugin_filepaths`.
Recommend passing in absolute filepaths. Method will
attempt to convert to absolute paths if not passed in.
`filepaths` can be a single object or an iterable.
"""
... | python | def remove_plugin_filepaths(self, filepaths):
"""
Removes `filepaths` from `self.plugin_filepaths`.
Recommend passing in absolute filepaths. Method will
attempt to convert to absolute paths if not passed in.
`filepaths` can be a single object or an iterable.
"""
... | [
"def",
"remove_plugin_filepaths",
"(",
"self",
",",
"filepaths",
")",
":",
"filepaths",
"=",
"util",
".",
"to_absolute_paths",
"(",
"filepaths",
")",
"self",
".",
"plugin_filepaths",
"=",
"util",
".",
"remove_from_set",
"(",
"self",
".",
"plugin_filepaths",
",",... | Removes `filepaths` from `self.plugin_filepaths`.
Recommend passing in absolute filepaths. Method will
attempt to convert to absolute paths if not passed in.
`filepaths` can be a single object or an iterable. | [
"Removes",
"filepaths",
"from",
"self",
".",
"plugin_filepaths",
".",
"Recommend",
"passing",
"in",
"absolute",
"filepaths",
".",
"Method",
"will",
"attempt",
"to",
"convert",
"to",
"absolute",
"paths",
"if",
"not",
"passed",
"in",
"."
] | a8a184f9ebfbb521703492cb88c1dbda4cd04c06 | https://github.com/benhoff/pluginmanager/blob/a8a184f9ebfbb521703492cb88c1dbda4cd04c06/pluginmanager/file_manager.py#L111-L121 | train | 61,132 |
benhoff/pluginmanager | pluginmanager/file_manager.py | FileManager.set_file_filters | def set_file_filters(self, file_filters):
"""
Sets internal file filters to `file_filters` by tossing old state.
`file_filters` can be single object or iterable.
"""
file_filters = util.return_list(file_filters)
self.file_filters = file_filters | python | def set_file_filters(self, file_filters):
"""
Sets internal file filters to `file_filters` by tossing old state.
`file_filters` can be single object or iterable.
"""
file_filters = util.return_list(file_filters)
self.file_filters = file_filters | [
"def",
"set_file_filters",
"(",
"self",
",",
"file_filters",
")",
":",
"file_filters",
"=",
"util",
".",
"return_list",
"(",
"file_filters",
")",
"self",
".",
"file_filters",
"=",
"file_filters"
] | Sets internal file filters to `file_filters` by tossing old state.
`file_filters` can be single object or iterable. | [
"Sets",
"internal",
"file",
"filters",
"to",
"file_filters",
"by",
"tossing",
"old",
"state",
".",
"file_filters",
"can",
"be",
"single",
"object",
"or",
"iterable",
"."
] | a8a184f9ebfbb521703492cb88c1dbda4cd04c06 | https://github.com/benhoff/pluginmanager/blob/a8a184f9ebfbb521703492cb88c1dbda4cd04c06/pluginmanager/file_manager.py#L129-L135 | train | 61,133 |
benhoff/pluginmanager | pluginmanager/file_manager.py | FileManager.add_file_filters | def add_file_filters(self, file_filters):
"""
Adds `file_filters` to the internal file filters.
`file_filters` can be single object or iterable.
"""
file_filters = util.return_list(file_filters)
self.file_filters.extend(file_filters) | python | def add_file_filters(self, file_filters):
"""
Adds `file_filters` to the internal file filters.
`file_filters` can be single object or iterable.
"""
file_filters = util.return_list(file_filters)
self.file_filters.extend(file_filters) | [
"def",
"add_file_filters",
"(",
"self",
",",
"file_filters",
")",
":",
"file_filters",
"=",
"util",
".",
"return_list",
"(",
"file_filters",
")",
"self",
".",
"file_filters",
".",
"extend",
"(",
"file_filters",
")"
] | Adds `file_filters` to the internal file filters.
`file_filters` can be single object or iterable. | [
"Adds",
"file_filters",
"to",
"the",
"internal",
"file",
"filters",
".",
"file_filters",
"can",
"be",
"single",
"object",
"or",
"iterable",
"."
] | a8a184f9ebfbb521703492cb88c1dbda4cd04c06 | https://github.com/benhoff/pluginmanager/blob/a8a184f9ebfbb521703492cb88c1dbda4cd04c06/pluginmanager/file_manager.py#L137-L143 | train | 61,134 |
benhoff/pluginmanager | pluginmanager/file_manager.py | FileManager.remove_file_filters | def remove_file_filters(self, file_filters):
"""
Removes the `file_filters` from the internal state.
`file_filters` can be a single object or an iterable.
"""
self.file_filters = util.remove_from_list(self.file_filters,
file_filte... | python | def remove_file_filters(self, file_filters):
"""
Removes the `file_filters` from the internal state.
`file_filters` can be a single object or an iterable.
"""
self.file_filters = util.remove_from_list(self.file_filters,
file_filte... | [
"def",
"remove_file_filters",
"(",
"self",
",",
"file_filters",
")",
":",
"self",
".",
"file_filters",
"=",
"util",
".",
"remove_from_list",
"(",
"self",
".",
"file_filters",
",",
"file_filters",
")"
] | Removes the `file_filters` from the internal state.
`file_filters` can be a single object or an iterable. | [
"Removes",
"the",
"file_filters",
"from",
"the",
"internal",
"state",
".",
"file_filters",
"can",
"be",
"a",
"single",
"object",
"or",
"an",
"iterable",
"."
] | a8a184f9ebfbb521703492cb88c1dbda4cd04c06 | https://github.com/benhoff/pluginmanager/blob/a8a184f9ebfbb521703492cb88c1dbda4cd04c06/pluginmanager/file_manager.py#L145-L151 | train | 61,135 |
benhoff/pluginmanager | pluginmanager/file_manager.py | FileManager.add_blacklisted_filepaths | def add_blacklisted_filepaths(self, filepaths, remove_from_stored=True):
"""
Add `filepaths` to blacklisted filepaths.
If `remove_from_stored` is `True`, any `filepaths` in
`plugin_filepaths` will be automatically removed.
Recommend passing in absolute filepaths but method will ... | python | def add_blacklisted_filepaths(self, filepaths, remove_from_stored=True):
"""
Add `filepaths` to blacklisted filepaths.
If `remove_from_stored` is `True`, any `filepaths` in
`plugin_filepaths` will be automatically removed.
Recommend passing in absolute filepaths but method will ... | [
"def",
"add_blacklisted_filepaths",
"(",
"self",
",",
"filepaths",
",",
"remove_from_stored",
"=",
"True",
")",
":",
"filepaths",
"=",
"util",
".",
"to_absolute_paths",
"(",
"filepaths",
")",
"self",
".",
"blacklisted_filepaths",
".",
"update",
"(",
"filepaths",
... | Add `filepaths` to blacklisted filepaths.
If `remove_from_stored` is `True`, any `filepaths` in
`plugin_filepaths` will be automatically removed.
Recommend passing in absolute filepaths but method will attempt
to convert to absolute filepaths based on current working directory. | [
"Add",
"filepaths",
"to",
"blacklisted",
"filepaths",
".",
"If",
"remove_from_stored",
"is",
"True",
"any",
"filepaths",
"in",
"plugin_filepaths",
"will",
"be",
"automatically",
"removed",
"."
] | a8a184f9ebfbb521703492cb88c1dbda4cd04c06 | https://github.com/benhoff/pluginmanager/blob/a8a184f9ebfbb521703492cb88c1dbda4cd04c06/pluginmanager/file_manager.py#L164-L177 | train | 61,136 |
benhoff/pluginmanager | pluginmanager/file_manager.py | FileManager.set_blacklisted_filepaths | def set_blacklisted_filepaths(self, filepaths, remove_from_stored=True):
"""
Sets internal blacklisted filepaths to filepaths.
If `remove_from_stored` is `True`, any `filepaths` in
`self.plugin_filepaths` will be automatically removed.
Recommend passing in absolute filepaths but... | python | def set_blacklisted_filepaths(self, filepaths, remove_from_stored=True):
"""
Sets internal blacklisted filepaths to filepaths.
If `remove_from_stored` is `True`, any `filepaths` in
`self.plugin_filepaths` will be automatically removed.
Recommend passing in absolute filepaths but... | [
"def",
"set_blacklisted_filepaths",
"(",
"self",
",",
"filepaths",
",",
"remove_from_stored",
"=",
"True",
")",
":",
"filepaths",
"=",
"util",
".",
"to_absolute_paths",
"(",
"filepaths",
")",
"self",
".",
"blacklisted_filepaths",
"=",
"filepaths",
"if",
"remove_fr... | Sets internal blacklisted filepaths to filepaths.
If `remove_from_stored` is `True`, any `filepaths` in
`self.plugin_filepaths` will be automatically removed.
Recommend passing in absolute filepaths but method will attempt
to convert to absolute filepaths based on current working direct... | [
"Sets",
"internal",
"blacklisted",
"filepaths",
"to",
"filepaths",
".",
"If",
"remove_from_stored",
"is",
"True",
"any",
"filepaths",
"in",
"self",
".",
"plugin_filepaths",
"will",
"be",
"automatically",
"removed",
"."
] | a8a184f9ebfbb521703492cb88c1dbda4cd04c06 | https://github.com/benhoff/pluginmanager/blob/a8a184f9ebfbb521703492cb88c1dbda4cd04c06/pluginmanager/file_manager.py#L179-L192 | train | 61,137 |
benhoff/pluginmanager | pluginmanager/file_manager.py | FileManager.remove_blacklisted_filepaths | def remove_blacklisted_filepaths(self, filepaths):
"""
Removes `filepaths` from blacklisted filepaths
Recommend passing in absolute filepaths but method will attempt
to convert to absolute filepaths based on current working directory.
"""
filepaths = util.to_absolute_pat... | python | def remove_blacklisted_filepaths(self, filepaths):
"""
Removes `filepaths` from blacklisted filepaths
Recommend passing in absolute filepaths but method will attempt
to convert to absolute filepaths based on current working directory.
"""
filepaths = util.to_absolute_pat... | [
"def",
"remove_blacklisted_filepaths",
"(",
"self",
",",
"filepaths",
")",
":",
"filepaths",
"=",
"util",
".",
"to_absolute_paths",
"(",
"filepaths",
")",
"black_paths",
"=",
"self",
".",
"blacklisted_filepaths",
"black_paths",
"=",
"util",
".",
"remove_from_set",
... | Removes `filepaths` from blacklisted filepaths
Recommend passing in absolute filepaths but method will attempt
to convert to absolute filepaths based on current working directory. | [
"Removes",
"filepaths",
"from",
"blacklisted",
"filepaths"
] | a8a184f9ebfbb521703492cb88c1dbda4cd04c06 | https://github.com/benhoff/pluginmanager/blob/a8a184f9ebfbb521703492cb88c1dbda4cd04c06/pluginmanager/file_manager.py#L194-L203 | train | 61,138 |
benhoff/pluginmanager | pluginmanager/file_manager.py | FileManager._remove_blacklisted | def _remove_blacklisted(self, filepaths):
"""
internal helper method to remove the blacklisted filepaths
from `filepaths`.
"""
filepaths = util.remove_from_set(filepaths, self.blacklisted_filepaths)
return filepaths | python | def _remove_blacklisted(self, filepaths):
"""
internal helper method to remove the blacklisted filepaths
from `filepaths`.
"""
filepaths = util.remove_from_set(filepaths, self.blacklisted_filepaths)
return filepaths | [
"def",
"_remove_blacklisted",
"(",
"self",
",",
"filepaths",
")",
":",
"filepaths",
"=",
"util",
".",
"remove_from_set",
"(",
"filepaths",
",",
"self",
".",
"blacklisted_filepaths",
")",
"return",
"filepaths"
] | internal helper method to remove the blacklisted filepaths
from `filepaths`. | [
"internal",
"helper",
"method",
"to",
"remove",
"the",
"blacklisted",
"filepaths",
"from",
"filepaths",
"."
] | a8a184f9ebfbb521703492cb88c1dbda4cd04c06 | https://github.com/benhoff/pluginmanager/blob/a8a184f9ebfbb521703492cb88c1dbda4cd04c06/pluginmanager/file_manager.py#L211-L217 | train | 61,139 |
benhoff/pluginmanager | pluginmanager/file_manager.py | FileManager._filter_filepaths | def _filter_filepaths(self, filepaths):
"""
helps iterate through all the file parsers
each filter is applied individually to the
same set of `filepaths`
"""
if self.file_filters:
plugin_filepaths = set()
for file_filter in self.file_filters:
... | python | def _filter_filepaths(self, filepaths):
"""
helps iterate through all the file parsers
each filter is applied individually to the
same set of `filepaths`
"""
if self.file_filters:
plugin_filepaths = set()
for file_filter in self.file_filters:
... | [
"def",
"_filter_filepaths",
"(",
"self",
",",
"filepaths",
")",
":",
"if",
"self",
".",
"file_filters",
":",
"plugin_filepaths",
"=",
"set",
"(",
")",
"for",
"file_filter",
"in",
"self",
".",
"file_filters",
":",
"plugin_paths",
"=",
"file_filter",
"(",
"fil... | helps iterate through all the file parsers
each filter is applied individually to the
same set of `filepaths` | [
"helps",
"iterate",
"through",
"all",
"the",
"file",
"parsers",
"each",
"filter",
"is",
"applied",
"individually",
"to",
"the",
"same",
"set",
"of",
"filepaths"
] | a8a184f9ebfbb521703492cb88c1dbda4cd04c06 | https://github.com/benhoff/pluginmanager/blob/a8a184f9ebfbb521703492cb88c1dbda4cd04c06/pluginmanager/file_manager.py#L219-L233 | train | 61,140 |
newville/wxmplot | wxmplot/colors.py | rgb | def rgb(color,default=(0,0,0)):
""" return rgb tuple for named color in rgb.txt or a hex color """
c = color.lower()
if c[0:1] == '#' and len(c)==7:
r,g,b = c[1:3], c[3:5], c[5:]
r,g,b = [int(n, 16) for n in (r, g, b)]
return (r,g,b)
if c.find(' ')>-1: c = c.replace(' ','')
... | python | def rgb(color,default=(0,0,0)):
""" return rgb tuple for named color in rgb.txt or a hex color """
c = color.lower()
if c[0:1] == '#' and len(c)==7:
r,g,b = c[1:3], c[3:5], c[5:]
r,g,b = [int(n, 16) for n in (r, g, b)]
return (r,g,b)
if c.find(' ')>-1: c = c.replace(' ','')
... | [
"def",
"rgb",
"(",
"color",
",",
"default",
"=",
"(",
"0",
",",
"0",
",",
"0",
")",
")",
":",
"c",
"=",
"color",
".",
"lower",
"(",
")",
"if",
"c",
"[",
"0",
":",
"1",
"]",
"==",
"'#'",
"and",
"len",
"(",
"c",
")",
"==",
"7",
":",
"r",
... | return rgb tuple for named color in rgb.txt or a hex color | [
"return",
"rgb",
"tuple",
"for",
"named",
"color",
"in",
"rgb",
".",
"txt",
"or",
"a",
"hex",
"color"
] | 8e0dc037453e5cdf18c968dc5a3d29efd761edee | https://github.com/newville/wxmplot/blob/8e0dc037453e5cdf18c968dc5a3d29efd761edee/wxmplot/colors.py#L294-L305 | train | 61,141 |
newville/wxmplot | wxmplot/colors.py | hexcolor | def hexcolor(color):
" returns hex color given a tuple, wx.Color, or X11 named color"
# first, if this is a hex color already, return!
# Python 3: needs rewrite for str/unicode change
if isinstance(color, six.string_types):
if color[0] == '#' and len(color)==7:
return color.lower()
... | python | def hexcolor(color):
" returns hex color given a tuple, wx.Color, or X11 named color"
# first, if this is a hex color already, return!
# Python 3: needs rewrite for str/unicode change
if isinstance(color, six.string_types):
if color[0] == '#' and len(color)==7:
return color.lower()
... | [
"def",
"hexcolor",
"(",
"color",
")",
":",
"# first, if this is a hex color already, return!",
"# Python 3: needs rewrite for str/unicode change",
"if",
"isinstance",
"(",
"color",
",",
"six",
".",
"string_types",
")",
":",
"if",
"color",
"[",
"0",
"]",
"==",
"'#'",
... | returns hex color given a tuple, wx.Color, or X11 named color | [
"returns",
"hex",
"color",
"given",
"a",
"tuple",
"wx",
".",
"Color",
"or",
"X11",
"named",
"color"
] | 8e0dc037453e5cdf18c968dc5a3d29efd761edee | https://github.com/newville/wxmplot/blob/8e0dc037453e5cdf18c968dc5a3d29efd761edee/wxmplot/colors.py#L327-L355 | train | 61,142 |
newville/wxmplot | wxmplot/colors.py | register_custom_colormaps | def register_custom_colormaps():
"""
registers custom color maps
"""
if not HAS_MPL:
return ()
makemap = LinearSegmentedColormap.from_list
for name, val in custom_colormap_data.items():
cm1 = np.array(val).transpose().astype('f8')/256.0
cm2 = cm1[::-1]
nam1 = name... | python | def register_custom_colormaps():
"""
registers custom color maps
"""
if not HAS_MPL:
return ()
makemap = LinearSegmentedColormap.from_list
for name, val in custom_colormap_data.items():
cm1 = np.array(val).transpose().astype('f8')/256.0
cm2 = cm1[::-1]
nam1 = name... | [
"def",
"register_custom_colormaps",
"(",
")",
":",
"if",
"not",
"HAS_MPL",
":",
"return",
"(",
")",
"makemap",
"=",
"LinearSegmentedColormap",
".",
"from_list",
"for",
"name",
",",
"val",
"in",
"custom_colormap_data",
".",
"items",
"(",
")",
":",
"cm1",
"=",... | registers custom color maps | [
"registers",
"custom",
"color",
"maps"
] | 8e0dc037453e5cdf18c968dc5a3d29efd761edee | https://github.com/newville/wxmplot/blob/8e0dc037453e5cdf18c968dc5a3d29efd761edee/wxmplot/colors.py#L419-L435 | train | 61,143 |
newville/wxmplot | wxmplot/imageframe.py | ImageFrame.onCMapSave | def onCMapSave(self, event=None, col='int'):
"""save color table image"""
file_choices = 'PNG (*.png)|*.png'
ofile = 'Colormap.png'
dlg = wx.FileDialog(self, message='Save Colormap as...',
defaultDir=os.getcwd(),
defaultFile=ofile,
... | python | def onCMapSave(self, event=None, col='int'):
"""save color table image"""
file_choices = 'PNG (*.png)|*.png'
ofile = 'Colormap.png'
dlg = wx.FileDialog(self, message='Save Colormap as...',
defaultDir=os.getcwd(),
defaultFile=ofile,
... | [
"def",
"onCMapSave",
"(",
"self",
",",
"event",
"=",
"None",
",",
"col",
"=",
"'int'",
")",
":",
"file_choices",
"=",
"'PNG (*.png)|*.png'",
"ofile",
"=",
"'Colormap.png'",
"dlg",
"=",
"wx",
".",
"FileDialog",
"(",
"self",
",",
"message",
"=",
"'Save Color... | save color table image | [
"save",
"color",
"table",
"image"
] | 8e0dc037453e5cdf18c968dc5a3d29efd761edee | https://github.com/newville/wxmplot/blob/8e0dc037453e5cdf18c968dc5a3d29efd761edee/wxmplot/imageframe.py#L860-L871 | train | 61,144 |
benhoff/pluginmanager | pluginmanager/file_filters/matching_regex.py | MatchingRegexFileFilter.plugin_valid | def plugin_valid(self, filename):
"""
Checks if the given filename is a valid plugin for this Strategy
"""
filename = os.path.basename(filename)
for regex in self.regex_expressions:
if regex.match(filename):
return True
return False | python | def plugin_valid(self, filename):
"""
Checks if the given filename is a valid plugin for this Strategy
"""
filename = os.path.basename(filename)
for regex in self.regex_expressions:
if regex.match(filename):
return True
return False | [
"def",
"plugin_valid",
"(",
"self",
",",
"filename",
")",
":",
"filename",
"=",
"os",
".",
"path",
".",
"basename",
"(",
"filename",
")",
"for",
"regex",
"in",
"self",
".",
"regex_expressions",
":",
"if",
"regex",
".",
"match",
"(",
"filename",
")",
":... | Checks if the given filename is a valid plugin for this Strategy | [
"Checks",
"if",
"the",
"given",
"filename",
"is",
"a",
"valid",
"plugin",
"for",
"this",
"Strategy"
] | a8a184f9ebfbb521703492cb88c1dbda4cd04c06 | https://github.com/benhoff/pluginmanager/blob/a8a184f9ebfbb521703492cb88c1dbda4cd04c06/pluginmanager/file_filters/matching_regex.py#L35-L43 | train | 61,145 |
JensAstrup/pyOutlook | pyOutlook/core/main.py | OutlookAccount.get_message | def get_message(self, message_id):
"""Gets message matching provided id.
the Outlook email matching the provided message_id.
Args:
message_id: A string for the intended message, provided by Outlook
Returns:
:class:`Message <pyOutlook.core.message.Message>`
... | python | def get_message(self, message_id):
"""Gets message matching provided id.
the Outlook email matching the provided message_id.
Args:
message_id: A string for the intended message, provided by Outlook
Returns:
:class:`Message <pyOutlook.core.message.Message>`
... | [
"def",
"get_message",
"(",
"self",
",",
"message_id",
")",
":",
"r",
"=",
"requests",
".",
"get",
"(",
"'https://outlook.office.com/api/v2.0/me/messages/'",
"+",
"message_id",
",",
"headers",
"=",
"self",
".",
"_headers",
")",
"check_response",
"(",
"r",
")",
... | Gets message matching provided id.
the Outlook email matching the provided message_id.
Args:
message_id: A string for the intended message, provided by Outlook
Returns:
:class:`Message <pyOutlook.core.message.Message>` | [
"Gets",
"message",
"matching",
"provided",
"id",
"."
] | f4ca9d4a8629c0a41f78102ce84fab702a841167 | https://github.com/JensAstrup/pyOutlook/blob/f4ca9d4a8629c0a41f78102ce84fab702a841167/pyOutlook/core/main.py#L128-L142 | train | 61,146 |
JensAstrup/pyOutlook | pyOutlook/core/main.py | OutlookAccount.get_messages | def get_messages(self, page=0):
"""Get first 10 messages in account, across all folders.
Keyword Args:
page (int): Integer representing the 'page' of results to fetch
Returns:
List[:class:`Message <pyOutlook.core.message.Message>`]
"""
endpoint = 'https... | python | def get_messages(self, page=0):
"""Get first 10 messages in account, across all folders.
Keyword Args:
page (int): Integer representing the 'page' of results to fetch
Returns:
List[:class:`Message <pyOutlook.core.message.Message>`]
"""
endpoint = 'https... | [
"def",
"get_messages",
"(",
"self",
",",
"page",
"=",
"0",
")",
":",
"endpoint",
"=",
"'https://outlook.office.com/api/v2.0/me/messages'",
"if",
"page",
">",
"0",
":",
"endpoint",
"=",
"endpoint",
"+",
"'/?%24skip='",
"+",
"str",
"(",
"page",
")",
"+",
"'0'"... | Get first 10 messages in account, across all folders.
Keyword Args:
page (int): Integer representing the 'page' of results to fetch
Returns:
List[:class:`Message <pyOutlook.core.message.Message>`] | [
"Get",
"first",
"10",
"messages",
"in",
"account",
"across",
"all",
"folders",
"."
] | f4ca9d4a8629c0a41f78102ce84fab702a841167 | https://github.com/JensAstrup/pyOutlook/blob/f4ca9d4a8629c0a41f78102ce84fab702a841167/pyOutlook/core/main.py#L144-L164 | train | 61,147 |
JensAstrup/pyOutlook | pyOutlook/core/main.py | OutlookAccount.get_folders | def get_folders(self):
""" Returns a list of all folders for this account
Returns:
List[:class:`Folder <pyOutlook.core.folder.Folder>`]
"""
endpoint = 'https://outlook.office.com/api/v2.0/me/MailFolders/'
r = requests.get(endpoint, headers=self._headers)
... | python | def get_folders(self):
""" Returns a list of all folders for this account
Returns:
List[:class:`Folder <pyOutlook.core.folder.Folder>`]
"""
endpoint = 'https://outlook.office.com/api/v2.0/me/MailFolders/'
r = requests.get(endpoint, headers=self._headers)
... | [
"def",
"get_folders",
"(",
"self",
")",
":",
"endpoint",
"=",
"'https://outlook.office.com/api/v2.0/me/MailFolders/'",
"r",
"=",
"requests",
".",
"get",
"(",
"endpoint",
",",
"headers",
"=",
"self",
".",
"_headers",
")",
"if",
"check_response",
"(",
"r",
")",
... | Returns a list of all folders for this account
Returns:
List[:class:`Folder <pyOutlook.core.folder.Folder>`] | [
"Returns",
"a",
"list",
"of",
"all",
"folders",
"for",
"this",
"account"
] | f4ca9d4a8629c0a41f78102ce84fab702a841167 | https://github.com/JensAstrup/pyOutlook/blob/f4ca9d4a8629c0a41f78102ce84fab702a841167/pyOutlook/core/main.py#L243-L254 | train | 61,148 |
JensAstrup/pyOutlook | pyOutlook/core/main.py | OutlookAccount.get_folder_by_id | def get_folder_by_id(self, folder_id):
""" Retrieve a Folder by its Outlook ID
Args:
folder_id: The ID of the :class:`Folder <pyOutlook.core.folder.Folder>` to retrieve
Returns: :class:`Folder <pyOutlook.core.folder.Folder>`
"""
endpoint = 'https://outlook.office.c... | python | def get_folder_by_id(self, folder_id):
""" Retrieve a Folder by its Outlook ID
Args:
folder_id: The ID of the :class:`Folder <pyOutlook.core.folder.Folder>` to retrieve
Returns: :class:`Folder <pyOutlook.core.folder.Folder>`
"""
endpoint = 'https://outlook.office.c... | [
"def",
"get_folder_by_id",
"(",
"self",
",",
"folder_id",
")",
":",
"endpoint",
"=",
"'https://outlook.office.com/api/v2.0/me/MailFolders/'",
"+",
"folder_id",
"r",
"=",
"requests",
".",
"get",
"(",
"endpoint",
",",
"headers",
"=",
"self",
".",
"_headers",
")",
... | Retrieve a Folder by its Outlook ID
Args:
folder_id: The ID of the :class:`Folder <pyOutlook.core.folder.Folder>` to retrieve
Returns: :class:`Folder <pyOutlook.core.folder.Folder>` | [
"Retrieve",
"a",
"Folder",
"by",
"its",
"Outlook",
"ID"
] | f4ca9d4a8629c0a41f78102ce84fab702a841167 | https://github.com/JensAstrup/pyOutlook/blob/f4ca9d4a8629c0a41f78102ce84fab702a841167/pyOutlook/core/main.py#L256-L271 | train | 61,149 |
JensAstrup/pyOutlook | pyOutlook/core/main.py | OutlookAccount._get_messages_from_folder_name | def _get_messages_from_folder_name(self, folder_name):
""" Retrieves all messages from a folder, specified by its name. This only works with "Well Known" folders,
such as 'Inbox' or 'Drafts'.
Args:
folder_name (str): The name of the folder to retrieve
Returns: List[:class:`... | python | def _get_messages_from_folder_name(self, folder_name):
""" Retrieves all messages from a folder, specified by its name. This only works with "Well Known" folders,
such as 'Inbox' or 'Drafts'.
Args:
folder_name (str): The name of the folder to retrieve
Returns: List[:class:`... | [
"def",
"_get_messages_from_folder_name",
"(",
"self",
",",
"folder_name",
")",
":",
"r",
"=",
"requests",
".",
"get",
"(",
"'https://outlook.office.com/api/v2.0/me/MailFolders/'",
"+",
"folder_name",
"+",
"'/messages'",
",",
"headers",
"=",
"self",
".",
"_headers",
... | Retrieves all messages from a folder, specified by its name. This only works with "Well Known" folders,
such as 'Inbox' or 'Drafts'.
Args:
folder_name (str): The name of the folder to retrieve
Returns: List[:class:`Message <pyOutlook.core.message.Message>` ] | [
"Retrieves",
"all",
"messages",
"from",
"a",
"folder",
"specified",
"by",
"its",
"name",
".",
"This",
"only",
"works",
"with",
"Well",
"Known",
"folders",
"such",
"as",
"Inbox",
"or",
"Drafts",
"."
] | f4ca9d4a8629c0a41f78102ce84fab702a841167 | https://github.com/JensAstrup/pyOutlook/blob/f4ca9d4a8629c0a41f78102ce84fab702a841167/pyOutlook/core/main.py#L273-L286 | train | 61,150 |
JensAstrup/pyOutlook | pyOutlook/core/message.py | Message.api_representation | def api_representation(self, content_type):
""" Returns the JSON representation of this message required for making requests to the API.
Args:
content_type (str): Either 'HTML' or 'Text'
"""
payload = dict(Subject=self.subject, Body=dict(ContentType=content_type, Content=sel... | python | def api_representation(self, content_type):
""" Returns the JSON representation of this message required for making requests to the API.
Args:
content_type (str): Either 'HTML' or 'Text'
"""
payload = dict(Subject=self.subject, Body=dict(ContentType=content_type, Content=sel... | [
"def",
"api_representation",
"(",
"self",
",",
"content_type",
")",
":",
"payload",
"=",
"dict",
"(",
"Subject",
"=",
"self",
".",
"subject",
",",
"Body",
"=",
"dict",
"(",
"ContentType",
"=",
"content_type",
",",
"Content",
"=",
"self",
".",
"body",
")"... | Returns the JSON representation of this message required for making requests to the API.
Args:
content_type (str): Either 'HTML' or 'Text' | [
"Returns",
"the",
"JSON",
"representation",
"of",
"this",
"message",
"required",
"for",
"making",
"requests",
"to",
"the",
"API",
"."
] | f4ca9d4a8629c0a41f78102ce84fab702a841167 | https://github.com/JensAstrup/pyOutlook/blob/f4ca9d4a8629c0a41f78102ce84fab702a841167/pyOutlook/core/message.py#L219-L260 | train | 61,151 |
JensAstrup/pyOutlook | pyOutlook/core/message.py | Message.send | def send(self, content_type='HTML'):
""" Takes the recipients, body, and attachments of the Message and sends.
Args:
content_type: Can either be 'HTML' or 'Text', defaults to HTML.
"""
payload = self.api_representation(content_type)
endpoint = 'https://outlook.off... | python | def send(self, content_type='HTML'):
""" Takes the recipients, body, and attachments of the Message and sends.
Args:
content_type: Can either be 'HTML' or 'Text', defaults to HTML.
"""
payload = self.api_representation(content_type)
endpoint = 'https://outlook.off... | [
"def",
"send",
"(",
"self",
",",
"content_type",
"=",
"'HTML'",
")",
":",
"payload",
"=",
"self",
".",
"api_representation",
"(",
"content_type",
")",
"endpoint",
"=",
"'https://outlook.office.com/api/v1.0/me/sendmail'",
"self",
".",
"_make_api_call",
"(",
"'post'",... | Takes the recipients, body, and attachments of the Message and sends.
Args:
content_type: Can either be 'HTML' or 'Text', defaults to HTML. | [
"Takes",
"the",
"recipients",
"body",
"and",
"attachments",
"of",
"the",
"Message",
"and",
"sends",
"."
] | f4ca9d4a8629c0a41f78102ce84fab702a841167 | https://github.com/JensAstrup/pyOutlook/blob/f4ca9d4a8629c0a41f78102ce84fab702a841167/pyOutlook/core/message.py#L297-L308 | train | 61,152 |
JensAstrup/pyOutlook | pyOutlook/core/message.py | Message.forward | def forward(self, to_recipients, forward_comment=None):
# type: (Union[List[Contact], List[str]], str) -> None
"""Forward Message to recipients with an optional comment.
Args:
to_recipients: A list of :class:`Contacts <pyOutlook.core.contact.Contact>` to send the email to.
... | python | def forward(self, to_recipients, forward_comment=None):
# type: (Union[List[Contact], List[str]], str) -> None
"""Forward Message to recipients with an optional comment.
Args:
to_recipients: A list of :class:`Contacts <pyOutlook.core.contact.Contact>` to send the email to.
... | [
"def",
"forward",
"(",
"self",
",",
"to_recipients",
",",
"forward_comment",
"=",
"None",
")",
":",
"# type: (Union[List[Contact], List[str]], str) -> None",
"payload",
"=",
"dict",
"(",
")",
"if",
"forward_comment",
"is",
"not",
"None",
":",
"payload",
".",
"upda... | Forward Message to recipients with an optional comment.
Args:
to_recipients: A list of :class:`Contacts <pyOutlook.core.contact.Contact>` to send the email to.
forward_comment: String comment to append to forwarded email.
Examples:
>>> john = Contact('john.doe@domai... | [
"Forward",
"Message",
"to",
"recipients",
"with",
"an",
"optional",
"comment",
"."
] | f4ca9d4a8629c0a41f78102ce84fab702a841167 | https://github.com/JensAstrup/pyOutlook/blob/f4ca9d4a8629c0a41f78102ce84fab702a841167/pyOutlook/core/message.py#L310-L341 | train | 61,153 |
JensAstrup/pyOutlook | pyOutlook/core/message.py | Message.reply | def reply(self, reply_comment):
"""Reply to the Message.
Notes:
HTML can be inserted in the string and will be interpreted properly by Outlook.
Args:
reply_comment: String message to send with email.
"""
payload = '{ "Comment": "' + reply_comment + '"}'... | python | def reply(self, reply_comment):
"""Reply to the Message.
Notes:
HTML can be inserted in the string and will be interpreted properly by Outlook.
Args:
reply_comment: String message to send with email.
"""
payload = '{ "Comment": "' + reply_comment + '"}'... | [
"def",
"reply",
"(",
"self",
",",
"reply_comment",
")",
":",
"payload",
"=",
"'{ \"Comment\": \"'",
"+",
"reply_comment",
"+",
"'\"}'",
"endpoint",
"=",
"'https://outlook.office.com/api/v2.0/me/messages/'",
"+",
"self",
".",
"message_id",
"+",
"'/reply'",
"self",
".... | Reply to the Message.
Notes:
HTML can be inserted in the string and will be interpreted properly by Outlook.
Args:
reply_comment: String message to send with email. | [
"Reply",
"to",
"the",
"Message",
"."
] | f4ca9d4a8629c0a41f78102ce84fab702a841167 | https://github.com/JensAstrup/pyOutlook/blob/f4ca9d4a8629c0a41f78102ce84fab702a841167/pyOutlook/core/message.py#L343-L356 | train | 61,154 |
JensAstrup/pyOutlook | pyOutlook/core/message.py | Message.reply_all | def reply_all(self, reply_comment):
"""Replies to everyone on the email, including those on the CC line.
With great power, comes great responsibility.
Args:
reply_comment: The string comment to send to everyone on the email.
"""
payload = '{ "Comment": "' + reply_c... | python | def reply_all(self, reply_comment):
"""Replies to everyone on the email, including those on the CC line.
With great power, comes great responsibility.
Args:
reply_comment: The string comment to send to everyone on the email.
"""
payload = '{ "Comment": "' + reply_c... | [
"def",
"reply_all",
"(",
"self",
",",
"reply_comment",
")",
":",
"payload",
"=",
"'{ \"Comment\": \"'",
"+",
"reply_comment",
"+",
"'\"}'",
"endpoint",
"=",
"'https://outlook.office.com/api/v2.0/me/messages/{}/replyall'",
".",
"format",
"(",
"self",
".",
"message_id",
... | Replies to everyone on the email, including those on the CC line.
With great power, comes great responsibility.
Args:
reply_comment: The string comment to send to everyone on the email. | [
"Replies",
"to",
"everyone",
"on",
"the",
"email",
"including",
"those",
"on",
"the",
"CC",
"line",
"."
] | f4ca9d4a8629c0a41f78102ce84fab702a841167 | https://github.com/JensAstrup/pyOutlook/blob/f4ca9d4a8629c0a41f78102ce84fab702a841167/pyOutlook/core/message.py#L358-L370 | train | 61,155 |
JensAstrup/pyOutlook | pyOutlook/core/message.py | Message.move_to | def move_to(self, folder):
"""Moves the email to the folder specified by the folder parameter.
Args:
folder: A string containing the folder ID the message should be moved to, or a Folder instance
"""
if isinstance(folder, Folder):
self.move_to(folder.id)
... | python | def move_to(self, folder):
"""Moves the email to the folder specified by the folder parameter.
Args:
folder: A string containing the folder ID the message should be moved to, or a Folder instance
"""
if isinstance(folder, Folder):
self.move_to(folder.id)
... | [
"def",
"move_to",
"(",
"self",
",",
"folder",
")",
":",
"if",
"isinstance",
"(",
"folder",
",",
"Folder",
")",
":",
"self",
".",
"move_to",
"(",
"folder",
".",
"id",
")",
"else",
":",
"self",
".",
"_move_to",
"(",
"folder",
")"
] | Moves the email to the folder specified by the folder parameter.
Args:
folder: A string containing the folder ID the message should be moved to, or a Folder instance | [
"Moves",
"the",
"email",
"to",
"the",
"folder",
"specified",
"by",
"the",
"folder",
"parameter",
"."
] | f4ca9d4a8629c0a41f78102ce84fab702a841167 | https://github.com/JensAstrup/pyOutlook/blob/f4ca9d4a8629c0a41f78102ce84fab702a841167/pyOutlook/core/message.py#L397-L407 | train | 61,156 |
newville/wxmplot | wxmplot/imageconf.py | ImageConfig.rgb2cmy | def rgb2cmy(self, img, whitebg=False):
"""transforms image from RGB to CMY"""
tmp = img*1.0
if whitebg:
tmp = (1.0 - (img - img.min())/(img.max() - img.min()))
out = tmp*0.0
out[:,:,0] = (tmp[:,:,1] + tmp[:,:,2])/2.0
out[:,:,1] = (tmp[:,:,0] + tmp[:,:,2])/2.0
... | python | def rgb2cmy(self, img, whitebg=False):
"""transforms image from RGB to CMY"""
tmp = img*1.0
if whitebg:
tmp = (1.0 - (img - img.min())/(img.max() - img.min()))
out = tmp*0.0
out[:,:,0] = (tmp[:,:,1] + tmp[:,:,2])/2.0
out[:,:,1] = (tmp[:,:,0] + tmp[:,:,2])/2.0
... | [
"def",
"rgb2cmy",
"(",
"self",
",",
"img",
",",
"whitebg",
"=",
"False",
")",
":",
"tmp",
"=",
"img",
"*",
"1.0",
"if",
"whitebg",
":",
"tmp",
"=",
"(",
"1.0",
"-",
"(",
"img",
"-",
"img",
".",
"min",
"(",
")",
")",
"/",
"(",
"img",
".",
"m... | transforms image from RGB to CMY | [
"transforms",
"image",
"from",
"RGB",
"to",
"CMY"
] | 8e0dc037453e5cdf18c968dc5a3d29efd761edee | https://github.com/newville/wxmplot/blob/8e0dc037453e5cdf18c968dc5a3d29efd761edee/wxmplot/imageconf.py#L105-L114 | train | 61,157 |
benhoff/pluginmanager | pluginmanager/file_filters/with_info_file.py | WithInfoFileFilter.plugin_valid | def plugin_valid(self, filepath):
"""
checks to see if plugin ends with one of the
approved extensions
"""
plugin_valid = False
for extension in self.extensions:
if filepath.endswith(".{}".format(extension)):
plugin_valid = True
... | python | def plugin_valid(self, filepath):
"""
checks to see if plugin ends with one of the
approved extensions
"""
plugin_valid = False
for extension in self.extensions:
if filepath.endswith(".{}".format(extension)):
plugin_valid = True
... | [
"def",
"plugin_valid",
"(",
"self",
",",
"filepath",
")",
":",
"plugin_valid",
"=",
"False",
"for",
"extension",
"in",
"self",
".",
"extensions",
":",
"if",
"filepath",
".",
"endswith",
"(",
"\".{}\"",
".",
"format",
"(",
"extension",
")",
")",
":",
"plu... | checks to see if plugin ends with one of the
approved extensions | [
"checks",
"to",
"see",
"if",
"plugin",
"ends",
"with",
"one",
"of",
"the",
"approved",
"extensions"
] | a8a184f9ebfbb521703492cb88c1dbda4cd04c06 | https://github.com/benhoff/pluginmanager/blob/a8a184f9ebfbb521703492cb88c1dbda4cd04c06/pluginmanager/file_filters/with_info_file.py#L47-L57 | train | 61,158 |
JensAstrup/pyOutlook | pyOutlook/core/contact.py | Contact.api_representation | def api_representation(self):
""" Returns the JSON formatting required by Outlook's API for contacts """
return dict(EmailAddress=dict(Name=self.name, Address=self.email)) | python | def api_representation(self):
""" Returns the JSON formatting required by Outlook's API for contacts """
return dict(EmailAddress=dict(Name=self.name, Address=self.email)) | [
"def",
"api_representation",
"(",
"self",
")",
":",
"return",
"dict",
"(",
"EmailAddress",
"=",
"dict",
"(",
"Name",
"=",
"self",
".",
"name",
",",
"Address",
"=",
"self",
".",
"email",
")",
")"
] | Returns the JSON formatting required by Outlook's API for contacts | [
"Returns",
"the",
"JSON",
"formatting",
"required",
"by",
"Outlook",
"s",
"API",
"for",
"contacts"
] | f4ca9d4a8629c0a41f78102ce84fab702a841167 | https://github.com/JensAstrup/pyOutlook/blob/f4ca9d4a8629c0a41f78102ce84fab702a841167/pyOutlook/core/contact.py#L82-L84 | train | 61,159 |
JensAstrup/pyOutlook | pyOutlook/core/contact.py | Contact.set_focused | def set_focused(self, account, is_focused):
# type: (OutlookAccount, bool) -> bool
""" Emails from this contact will either always be put in the Focused inbox, or always put in Other, based on
the value of is_focused.
Args:
account (OutlookAccount): The :class:`OutlookAccoun... | python | def set_focused(self, account, is_focused):
# type: (OutlookAccount, bool) -> bool
""" Emails from this contact will either always be put in the Focused inbox, or always put in Other, based on
the value of is_focused.
Args:
account (OutlookAccount): The :class:`OutlookAccoun... | [
"def",
"set_focused",
"(",
"self",
",",
"account",
",",
"is_focused",
")",
":",
"# type: (OutlookAccount, bool) -> bool",
"endpoint",
"=",
"'https://outlook.office.com/api/v2.0/me/InferenceClassification/Overrides'",
"if",
"is_focused",
":",
"classification",
"=",
"'Focused'",
... | Emails from this contact will either always be put in the Focused inbox, or always put in Other, based on
the value of is_focused.
Args:
account (OutlookAccount): The :class:`OutlookAccount <pyOutlook.core.main.OutlookAccount>`
the override should be set for
is_f... | [
"Emails",
"from",
"this",
"contact",
"will",
"either",
"always",
"be",
"put",
"in",
"the",
"Focused",
"inbox",
"or",
"always",
"put",
"in",
"Other",
"based",
"on",
"the",
"value",
"of",
"is_focused",
"."
] | f4ca9d4a8629c0a41f78102ce84fab702a841167 | https://github.com/JensAstrup/pyOutlook/blob/f4ca9d4a8629c0a41f78102ce84fab702a841167/pyOutlook/core/contact.py#L86-L115 | train | 61,160 |
newville/wxmplot | wxmplot/imagematrixframe.py | image2wxbitmap | def image2wxbitmap(img):
"PIL image 2 wx bitmap"
if is_wxPhoenix:
wximg = wx.Image(*img.size)
else:
wximg = wx.EmptyImage(*img.size)
wximg.SetData(img.tobytes())
return wximg.ConvertToBitmap() | python | def image2wxbitmap(img):
"PIL image 2 wx bitmap"
if is_wxPhoenix:
wximg = wx.Image(*img.size)
else:
wximg = wx.EmptyImage(*img.size)
wximg.SetData(img.tobytes())
return wximg.ConvertToBitmap() | [
"def",
"image2wxbitmap",
"(",
"img",
")",
":",
"if",
"is_wxPhoenix",
":",
"wximg",
"=",
"wx",
".",
"Image",
"(",
"*",
"img",
".",
"size",
")",
"else",
":",
"wximg",
"=",
"wx",
".",
"EmptyImage",
"(",
"*",
"img",
".",
"size",
")",
"wximg",
".",
"S... | PIL image 2 wx bitmap | [
"PIL",
"image",
"2",
"wx",
"bitmap"
] | 8e0dc037453e5cdf18c968dc5a3d29efd761edee | https://github.com/newville/wxmplot/blob/8e0dc037453e5cdf18c968dc5a3d29efd761edee/wxmplot/imagematrixframe.py#L48-L55 | train | 61,161 |
JensAstrup/pyOutlook | pyOutlook/internal/utils.py | check_response | def check_response(response):
""" Checks that a response is successful, raising the appropriate Exceptions otherwise. """
status_code = response.status_code
if 100 < status_code < 299:
return True
elif status_code == 401 or status_code == 403:
message = get_response_data(response)
... | python | def check_response(response):
""" Checks that a response is successful, raising the appropriate Exceptions otherwise. """
status_code = response.status_code
if 100 < status_code < 299:
return True
elif status_code == 401 or status_code == 403:
message = get_response_data(response)
... | [
"def",
"check_response",
"(",
"response",
")",
":",
"status_code",
"=",
"response",
".",
"status_code",
"if",
"100",
"<",
"status_code",
"<",
"299",
":",
"return",
"True",
"elif",
"status_code",
"==",
"401",
"or",
"status_code",
"==",
"403",
":",
"message",
... | Checks that a response is successful, raising the appropriate Exceptions otherwise. | [
"Checks",
"that",
"a",
"response",
"is",
"successful",
"raising",
"the",
"appropriate",
"Exceptions",
"otherwise",
"."
] | f4ca9d4a8629c0a41f78102ce84fab702a841167 | https://github.com/JensAstrup/pyOutlook/blob/f4ca9d4a8629c0a41f78102ce84fab702a841167/pyOutlook/internal/utils.py#L30-L48 | train | 61,162 |
benhoff/pluginmanager | pluginmanager/plugin_manager.py | PluginManager.get_plugins | def get_plugins(self, filter_function=None):
"""
Gets out the plugins from the internal state. Returns a list object.
If the optional filter_function is supplied, applies the filter
function to the arguments before returning them. Filters should
be callable and take a list argume... | python | def get_plugins(self, filter_function=None):
"""
Gets out the plugins from the internal state. Returns a list object.
If the optional filter_function is supplied, applies the filter
function to the arguments before returning them. Filters should
be callable and take a list argume... | [
"def",
"get_plugins",
"(",
"self",
",",
"filter_function",
"=",
"None",
")",
":",
"plugins",
"=",
"self",
".",
"plugins",
"if",
"filter_function",
"is",
"not",
"None",
":",
"plugins",
"=",
"filter_function",
"(",
"plugins",
")",
"return",
"plugins"
] | Gets out the plugins from the internal state. Returns a list object.
If the optional filter_function is supplied, applies the filter
function to the arguments before returning them. Filters should
be callable and take a list argument of plugins. | [
"Gets",
"out",
"the",
"plugins",
"from",
"the",
"internal",
"state",
".",
"Returns",
"a",
"list",
"object",
".",
"If",
"the",
"optional",
"filter_function",
"is",
"supplied",
"applies",
"the",
"filter",
"function",
"to",
"the",
"arguments",
"before",
"returnin... | a8a184f9ebfbb521703492cb88c1dbda4cd04c06 | https://github.com/benhoff/pluginmanager/blob/a8a184f9ebfbb521703492cb88c1dbda4cd04c06/pluginmanager/plugin_manager.py#L37-L47 | train | 61,163 |
benhoff/pluginmanager | pluginmanager/plugin_manager.py | PluginManager._get_instance | def _get_instance(self, klasses):
"""
internal method that gets every instance of the klasses
out of the internal plugin state.
"""
return [x for x in self.plugins if isinstance(x, klasses)] | python | def _get_instance(self, klasses):
"""
internal method that gets every instance of the klasses
out of the internal plugin state.
"""
return [x for x in self.plugins if isinstance(x, klasses)] | [
"def",
"_get_instance",
"(",
"self",
",",
"klasses",
")",
":",
"return",
"[",
"x",
"for",
"x",
"in",
"self",
".",
"plugins",
"if",
"isinstance",
"(",
"x",
",",
"klasses",
")",
"]"
] | internal method that gets every instance of the klasses
out of the internal plugin state. | [
"internal",
"method",
"that",
"gets",
"every",
"instance",
"of",
"the",
"klasses",
"out",
"of",
"the",
"internal",
"plugin",
"state",
"."
] | a8a184f9ebfbb521703492cb88c1dbda4cd04c06 | https://github.com/benhoff/pluginmanager/blob/a8a184f9ebfbb521703492cb88c1dbda4cd04c06/pluginmanager/plugin_manager.py#L95-L100 | train | 61,164 |
benhoff/pluginmanager | pluginmanager/plugin_manager.py | PluginManager.get_instances | def get_instances(self, filter_function=IPlugin):
"""
Gets instances out of the internal state using
the default filter supplied in filter_function.
By default, it is the class IPlugin.
Can optionally pass in a list or tuple of classes
in for `filter_function` which will... | python | def get_instances(self, filter_function=IPlugin):
"""
Gets instances out of the internal state using
the default filter supplied in filter_function.
By default, it is the class IPlugin.
Can optionally pass in a list or tuple of classes
in for `filter_function` which will... | [
"def",
"get_instances",
"(",
"self",
",",
"filter_function",
"=",
"IPlugin",
")",
":",
"if",
"isinstance",
"(",
"filter_function",
",",
"(",
"list",
",",
"tuple",
")",
")",
":",
"return",
"self",
".",
"_get_instance",
"(",
"filter_function",
")",
"elif",
"... | Gets instances out of the internal state using
the default filter supplied in filter_function.
By default, it is the class IPlugin.
Can optionally pass in a list or tuple of classes
in for `filter_function` which will accomplish
the same goal.
lastly, a callable can be ... | [
"Gets",
"instances",
"out",
"of",
"the",
"internal",
"state",
"using",
"the",
"default",
"filter",
"supplied",
"in",
"filter_function",
".",
"By",
"default",
"it",
"is",
"the",
"class",
"IPlugin",
"."
] | a8a184f9ebfbb521703492cb88c1dbda4cd04c06 | https://github.com/benhoff/pluginmanager/blob/a8a184f9ebfbb521703492cb88c1dbda4cd04c06/pluginmanager/plugin_manager.py#L102-L123 | train | 61,165 |
benhoff/pluginmanager | pluginmanager/plugin_manager.py | PluginManager.register_classes | def register_classes(self, classes):
"""
Register classes as plugins that are not subclassed from
IPlugin.
`classes` may be a single object or an iterable.
"""
classes = util.return_list(classes)
for klass in classes:
IPlugin.register(klass) | python | def register_classes(self, classes):
"""
Register classes as plugins that are not subclassed from
IPlugin.
`classes` may be a single object or an iterable.
"""
classes = util.return_list(classes)
for klass in classes:
IPlugin.register(klass) | [
"def",
"register_classes",
"(",
"self",
",",
"classes",
")",
":",
"classes",
"=",
"util",
".",
"return_list",
"(",
"classes",
")",
"for",
"klass",
"in",
"classes",
":",
"IPlugin",
".",
"register",
"(",
"klass",
")"
] | Register classes as plugins that are not subclassed from
IPlugin.
`classes` may be a single object or an iterable. | [
"Register",
"classes",
"as",
"plugins",
"that",
"are",
"not",
"subclassed",
"from",
"IPlugin",
".",
"classes",
"may",
"be",
"a",
"single",
"object",
"or",
"an",
"iterable",
"."
] | a8a184f9ebfbb521703492cb88c1dbda4cd04c06 | https://github.com/benhoff/pluginmanager/blob/a8a184f9ebfbb521703492cb88c1dbda4cd04c06/pluginmanager/plugin_manager.py#L125-L133 | train | 61,166 |
benhoff/pluginmanager | pluginmanager/plugin_manager.py | PluginManager._instance_parser | def _instance_parser(self, plugins):
"""
internal method to parse instances of plugins.
Determines if each class is a class instance or
object instance and calls the appropiate handler
method.
"""
plugins = util.return_list(plugins)
for instance in plugin... | python | def _instance_parser(self, plugins):
"""
internal method to parse instances of plugins.
Determines if each class is a class instance or
object instance and calls the appropiate handler
method.
"""
plugins = util.return_list(plugins)
for instance in plugin... | [
"def",
"_instance_parser",
"(",
"self",
",",
"plugins",
")",
":",
"plugins",
"=",
"util",
".",
"return_list",
"(",
"plugins",
")",
"for",
"instance",
"in",
"plugins",
":",
"if",
"inspect",
".",
"isclass",
"(",
"instance",
")",
":",
"self",
".",
"_handle_... | internal method to parse instances of plugins.
Determines if each class is a class instance or
object instance and calls the appropiate handler
method. | [
"internal",
"method",
"to",
"parse",
"instances",
"of",
"plugins",
"."
] | a8a184f9ebfbb521703492cb88c1dbda4cd04c06 | https://github.com/benhoff/pluginmanager/blob/a8a184f9ebfbb521703492cb88c1dbda4cd04c06/pluginmanager/plugin_manager.py#L135-L148 | train | 61,167 |
benhoff/pluginmanager | pluginmanager/plugin_manager.py | PluginManager._handle_class_instance | def _handle_class_instance(self, klass):
"""
handles class instances. If a class is blacklisted, returns.
If uniuqe_instances is True and the class is unique, instantiates
the class and adds the new object to plugins.
If not unique_instances, creates and adds new instance to plu... | python | def _handle_class_instance(self, klass):
"""
handles class instances. If a class is blacklisted, returns.
If uniuqe_instances is True and the class is unique, instantiates
the class and adds the new object to plugins.
If not unique_instances, creates and adds new instance to plu... | [
"def",
"_handle_class_instance",
"(",
"self",
",",
"klass",
")",
":",
"if",
"(",
"klass",
"in",
"self",
".",
"blacklisted_plugins",
"or",
"not",
"self",
".",
"instantiate_classes",
"or",
"klass",
"==",
"IPlugin",
")",
":",
"return",
"elif",
"self",
".",
"u... | handles class instances. If a class is blacklisted, returns.
If uniuqe_instances is True and the class is unique, instantiates
the class and adds the new object to plugins.
If not unique_instances, creates and adds new instance to plugin
state | [
"handles",
"class",
"instances",
".",
"If",
"a",
"class",
"is",
"blacklisted",
"returns",
".",
"If",
"uniuqe_instances",
"is",
"True",
"and",
"the",
"class",
"is",
"unique",
"instantiates",
"the",
"class",
"and",
"adds",
"the",
"new",
"object",
"to",
"plugin... | a8a184f9ebfbb521703492cb88c1dbda4cd04c06 | https://github.com/benhoff/pluginmanager/blob/a8a184f9ebfbb521703492cb88c1dbda4cd04c06/pluginmanager/plugin_manager.py#L150-L166 | train | 61,168 |
benhoff/pluginmanager | pluginmanager/plugin_manager.py | PluginManager._unique_class | def _unique_class(self, cls):
"""
internal method to check if any of the plugins are instances
of a given cls
"""
return not any(isinstance(obj, cls) for obj in self.plugins) | python | def _unique_class(self, cls):
"""
internal method to check if any of the plugins are instances
of a given cls
"""
return not any(isinstance(obj, cls) for obj in self.plugins) | [
"def",
"_unique_class",
"(",
"self",
",",
"cls",
")",
":",
"return",
"not",
"any",
"(",
"isinstance",
"(",
"obj",
",",
"cls",
")",
"for",
"obj",
"in",
"self",
".",
"plugins",
")"
] | internal method to check if any of the plugins are instances
of a given cls | [
"internal",
"method",
"to",
"check",
"if",
"any",
"of",
"the",
"plugins",
"are",
"instances",
"of",
"a",
"given",
"cls"
] | a8a184f9ebfbb521703492cb88c1dbda4cd04c06 | https://github.com/benhoff/pluginmanager/blob/a8a184f9ebfbb521703492cb88c1dbda4cd04c06/pluginmanager/plugin_manager.py#L201-L206 | train | 61,169 |
benhoff/pluginmanager | pluginmanager/plugin_manager.py | PluginManager.add_blacklisted_plugins | def add_blacklisted_plugins(self, plugins):
"""
add blacklisted plugins.
`plugins` may be a single object or iterable.
"""
plugins = util.return_list(plugins)
self.blacklisted_plugins.extend(plugins) | python | def add_blacklisted_plugins(self, plugins):
"""
add blacklisted plugins.
`plugins` may be a single object or iterable.
"""
plugins = util.return_list(plugins)
self.blacklisted_plugins.extend(plugins) | [
"def",
"add_blacklisted_plugins",
"(",
"self",
",",
"plugins",
")",
":",
"plugins",
"=",
"util",
".",
"return_list",
"(",
"plugins",
")",
"self",
".",
"blacklisted_plugins",
".",
"extend",
"(",
"plugins",
")"
] | add blacklisted plugins.
`plugins` may be a single object or iterable. | [
"add",
"blacklisted",
"plugins",
".",
"plugins",
"may",
"be",
"a",
"single",
"object",
"or",
"iterable",
"."
] | a8a184f9ebfbb521703492cb88c1dbda4cd04c06 | https://github.com/benhoff/pluginmanager/blob/a8a184f9ebfbb521703492cb88c1dbda4cd04c06/pluginmanager/plugin_manager.py#L208-L214 | train | 61,170 |
benhoff/pluginmanager | pluginmanager/plugin_manager.py | PluginManager.set_blacklisted_plugins | def set_blacklisted_plugins(self, plugins):
"""
sets blacklisted plugins.
`plugins` may be a single object or iterable.
"""
plugins = util.return_list(plugins)
self.blacklisted_plugins = plugins | python | def set_blacklisted_plugins(self, plugins):
"""
sets blacklisted plugins.
`plugins` may be a single object or iterable.
"""
plugins = util.return_list(plugins)
self.blacklisted_plugins = plugins | [
"def",
"set_blacklisted_plugins",
"(",
"self",
",",
"plugins",
")",
":",
"plugins",
"=",
"util",
".",
"return_list",
"(",
"plugins",
")",
"self",
".",
"blacklisted_plugins",
"=",
"plugins"
] | sets blacklisted plugins.
`plugins` may be a single object or iterable. | [
"sets",
"blacklisted",
"plugins",
".",
"plugins",
"may",
"be",
"a",
"single",
"object",
"or",
"iterable",
"."
] | a8a184f9ebfbb521703492cb88c1dbda4cd04c06 | https://github.com/benhoff/pluginmanager/blob/a8a184f9ebfbb521703492cb88c1dbda4cd04c06/pluginmanager/plugin_manager.py#L216-L222 | train | 61,171 |
benhoff/pluginmanager | pluginmanager/module_manager.py | ModuleManager.collect_plugins | def collect_plugins(self, modules=None):
"""
Collects all the plugins from `modules`.
If modules is None, collects the plugins from the loaded modules.
All plugins are passed through the module filters, if any are any,
and returned as a list.
"""
if modules is No... | python | def collect_plugins(self, modules=None):
"""
Collects all the plugins from `modules`.
If modules is None, collects the plugins from the loaded modules.
All plugins are passed through the module filters, if any are any,
and returned as a list.
"""
if modules is No... | [
"def",
"collect_plugins",
"(",
"self",
",",
"modules",
"=",
"None",
")",
":",
"if",
"modules",
"is",
"None",
":",
"modules",
"=",
"self",
".",
"get_loaded_modules",
"(",
")",
"else",
":",
"modules",
"=",
"util",
".",
"return_list",
"(",
"modules",
")",
... | Collects all the plugins from `modules`.
If modules is None, collects the plugins from the loaded modules.
All plugins are passed through the module filters, if any are any,
and returned as a list. | [
"Collects",
"all",
"the",
"plugins",
"from",
"modules",
".",
"If",
"modules",
"is",
"None",
"collects",
"the",
"plugins",
"from",
"the",
"loaded",
"modules",
"."
] | a8a184f9ebfbb521703492cb88c1dbda4cd04c06 | https://github.com/benhoff/pluginmanager/blob/a8a184f9ebfbb521703492cb88c1dbda4cd04c06/pluginmanager/module_manager.py#L86-L109 | train | 61,172 |
benhoff/pluginmanager | pluginmanager/module_manager.py | ModuleManager.set_module_plugin_filters | def set_module_plugin_filters(self, module_plugin_filters):
"""
Sets the internal module filters to `module_plugin_filters`
`module_plugin_filters` may be a single object or an iterable.
Every module filters must be a callable and take in
a list of plugins and their associated n... | python | def set_module_plugin_filters(self, module_plugin_filters):
"""
Sets the internal module filters to `module_plugin_filters`
`module_plugin_filters` may be a single object or an iterable.
Every module filters must be a callable and take in
a list of plugins and their associated n... | [
"def",
"set_module_plugin_filters",
"(",
"self",
",",
"module_plugin_filters",
")",
":",
"module_plugin_filters",
"=",
"util",
".",
"return_list",
"(",
"module_plugin_filters",
")",
"self",
".",
"module_plugin_filters",
"=",
"module_plugin_filters"
] | Sets the internal module filters to `module_plugin_filters`
`module_plugin_filters` may be a single object or an iterable.
Every module filters must be a callable and take in
a list of plugins and their associated names. | [
"Sets",
"the",
"internal",
"module",
"filters",
"to",
"module_plugin_filters",
"module_plugin_filters",
"may",
"be",
"a",
"single",
"object",
"or",
"an",
"iterable",
"."
] | a8a184f9ebfbb521703492cb88c1dbda4cd04c06 | https://github.com/benhoff/pluginmanager/blob/a8a184f9ebfbb521703492cb88c1dbda4cd04c06/pluginmanager/module_manager.py#L111-L120 | train | 61,173 |
benhoff/pluginmanager | pluginmanager/module_manager.py | ModuleManager.add_module_plugin_filters | def add_module_plugin_filters(self, module_plugin_filters):
"""
Adds `module_plugin_filters` to the internal module filters.
May be a single object or an iterable.
Every module filters must be a callable and take in
a list of plugins and their associated names.
"""
... | python | def add_module_plugin_filters(self, module_plugin_filters):
"""
Adds `module_plugin_filters` to the internal module filters.
May be a single object or an iterable.
Every module filters must be a callable and take in
a list of plugins and their associated names.
"""
... | [
"def",
"add_module_plugin_filters",
"(",
"self",
",",
"module_plugin_filters",
")",
":",
"module_plugin_filters",
"=",
"util",
".",
"return_list",
"(",
"module_plugin_filters",
")",
"self",
".",
"module_plugin_filters",
".",
"extend",
"(",
"module_plugin_filters",
")"
] | Adds `module_plugin_filters` to the internal module filters.
May be a single object or an iterable.
Every module filters must be a callable and take in
a list of plugins and their associated names. | [
"Adds",
"module_plugin_filters",
"to",
"the",
"internal",
"module",
"filters",
".",
"May",
"be",
"a",
"single",
"object",
"or",
"an",
"iterable",
"."
] | a8a184f9ebfbb521703492cb88c1dbda4cd04c06 | https://github.com/benhoff/pluginmanager/blob/a8a184f9ebfbb521703492cb88c1dbda4cd04c06/pluginmanager/module_manager.py#L122-L131 | train | 61,174 |
benhoff/pluginmanager | pluginmanager/module_manager.py | ModuleManager._get_modules | def _get_modules(self, names):
"""
An internal method that gets the `names` from sys.modules and returns
them as a list
"""
loaded_modules = []
for name in names:
loaded_modules.append(sys.modules[name])
return loaded_modules | python | def _get_modules(self, names):
"""
An internal method that gets the `names` from sys.modules and returns
them as a list
"""
loaded_modules = []
for name in names:
loaded_modules.append(sys.modules[name])
return loaded_modules | [
"def",
"_get_modules",
"(",
"self",
",",
"names",
")",
":",
"loaded_modules",
"=",
"[",
"]",
"for",
"name",
"in",
"names",
":",
"loaded_modules",
".",
"append",
"(",
"sys",
".",
"modules",
"[",
"name",
"]",
")",
"return",
"loaded_modules"
] | An internal method that gets the `names` from sys.modules and returns
them as a list | [
"An",
"internal",
"method",
"that",
"gets",
"the",
"names",
"from",
"sys",
".",
"modules",
"and",
"returns",
"them",
"as",
"a",
"list"
] | a8a184f9ebfbb521703492cb88c1dbda4cd04c06 | https://github.com/benhoff/pluginmanager/blob/a8a184f9ebfbb521703492cb88c1dbda4cd04c06/pluginmanager/module_manager.py#L157-L165 | train | 61,175 |
benhoff/pluginmanager | pluginmanager/module_manager.py | ModuleManager.add_to_loaded_modules | def add_to_loaded_modules(self, modules):
"""
Manually add in `modules` to be tracked by the module manager.
`modules` may be a single object or an iterable.
"""
modules = util.return_set(modules)
for module in modules:
if not isinstance(module, str):
... | python | def add_to_loaded_modules(self, modules):
"""
Manually add in `modules` to be tracked by the module manager.
`modules` may be a single object or an iterable.
"""
modules = util.return_set(modules)
for module in modules:
if not isinstance(module, str):
... | [
"def",
"add_to_loaded_modules",
"(",
"self",
",",
"modules",
")",
":",
"modules",
"=",
"util",
".",
"return_set",
"(",
"modules",
")",
"for",
"module",
"in",
"modules",
":",
"if",
"not",
"isinstance",
"(",
"module",
",",
"str",
")",
":",
"module",
"=",
... | Manually add in `modules` to be tracked by the module manager.
`modules` may be a single object or an iterable. | [
"Manually",
"add",
"in",
"modules",
"to",
"be",
"tracked",
"by",
"the",
"module",
"manager",
"."
] | a8a184f9ebfbb521703492cb88c1dbda4cd04c06 | https://github.com/benhoff/pluginmanager/blob/a8a184f9ebfbb521703492cb88c1dbda4cd04c06/pluginmanager/module_manager.py#L167-L177 | train | 61,176 |
benhoff/pluginmanager | pluginmanager/module_manager.py | ModuleManager._filter_modules | def _filter_modules(self, plugins, names):
"""
Internal helper method to parse all of the plugins and names
through each of the module filters
"""
if self.module_plugin_filters:
# check to make sure the number of plugins isn't changing
original_length_plug... | python | def _filter_modules(self, plugins, names):
"""
Internal helper method to parse all of the plugins and names
through each of the module filters
"""
if self.module_plugin_filters:
# check to make sure the number of plugins isn't changing
original_length_plug... | [
"def",
"_filter_modules",
"(",
"self",
",",
"plugins",
",",
"names",
")",
":",
"if",
"self",
".",
"module_plugin_filters",
":",
"# check to make sure the number of plugins isn't changing",
"original_length_plugins",
"=",
"len",
"(",
"plugins",
")",
"module_plugins",
"="... | Internal helper method to parse all of the plugins and names
through each of the module filters | [
"Internal",
"helper",
"method",
"to",
"parse",
"all",
"of",
"the",
"plugins",
"and",
"names",
"through",
"each",
"of",
"the",
"module",
"filters"
] | a8a184f9ebfbb521703492cb88c1dbda4cd04c06 | https://github.com/benhoff/pluginmanager/blob/a8a184f9ebfbb521703492cb88c1dbda4cd04c06/pluginmanager/module_manager.py#L185-L206 | train | 61,177 |
benhoff/pluginmanager | pluginmanager/module_manager.py | ModuleManager._clean_filepath | def _clean_filepath(self, filepath):
"""
processes the filepath by checking if it is a directory or not
and adding `.py` if not present.
"""
if (os.path.isdir(filepath) and
os.path.isfile(os.path.join(filepath, '__init__.py'))):
filepath = os.path.joi... | python | def _clean_filepath(self, filepath):
"""
processes the filepath by checking if it is a directory or not
and adding `.py` if not present.
"""
if (os.path.isdir(filepath) and
os.path.isfile(os.path.join(filepath, '__init__.py'))):
filepath = os.path.joi... | [
"def",
"_clean_filepath",
"(",
"self",
",",
"filepath",
")",
":",
"if",
"(",
"os",
".",
"path",
".",
"isdir",
"(",
"filepath",
")",
"and",
"os",
".",
"path",
".",
"isfile",
"(",
"os",
".",
"path",
".",
"join",
"(",
"filepath",
",",
"'__init__.py'",
... | processes the filepath by checking if it is a directory or not
and adding `.py` if not present. | [
"processes",
"the",
"filepath",
"by",
"checking",
"if",
"it",
"is",
"a",
"directory",
"or",
"not",
"and",
"adding",
".",
"py",
"if",
"not",
"present",
"."
] | a8a184f9ebfbb521703492cb88c1dbda4cd04c06 | https://github.com/benhoff/pluginmanager/blob/a8a184f9ebfbb521703492cb88c1dbda4cd04c06/pluginmanager/module_manager.py#L208-L221 | train | 61,178 |
benhoff/pluginmanager | pluginmanager/module_manager.py | ModuleManager._processed_filepath | def _processed_filepath(self, filepath):
"""
checks to see if the filepath has already been processed
"""
processed = False
if filepath in self.processed_filepaths.values():
processed = True
return processed | python | def _processed_filepath(self, filepath):
"""
checks to see if the filepath has already been processed
"""
processed = False
if filepath in self.processed_filepaths.values():
processed = True
return processed | [
"def",
"_processed_filepath",
"(",
"self",
",",
"filepath",
")",
":",
"processed",
"=",
"False",
"if",
"filepath",
"in",
"self",
".",
"processed_filepaths",
".",
"values",
"(",
")",
":",
"processed",
"=",
"True",
"return",
"processed"
] | checks to see if the filepath has already been processed | [
"checks",
"to",
"see",
"if",
"the",
"filepath",
"has",
"already",
"been",
"processed"
] | a8a184f9ebfbb521703492cb88c1dbda4cd04c06 | https://github.com/benhoff/pluginmanager/blob/a8a184f9ebfbb521703492cb88c1dbda4cd04c06/pluginmanager/module_manager.py#L223-L231 | train | 61,179 |
benhoff/pluginmanager | pluginmanager/module_manager.py | ModuleManager._update_loaded_modules | def _update_loaded_modules(self):
"""
Updates the loaded modules by checking if they are still in sys.modules
"""
system_modules = sys.modules.keys()
for module in list(self.loaded_modules):
if module not in system_modules:
self.processed_filepaths.pop... | python | def _update_loaded_modules(self):
"""
Updates the loaded modules by checking if they are still in sys.modules
"""
system_modules = sys.modules.keys()
for module in list(self.loaded_modules):
if module not in system_modules:
self.processed_filepaths.pop... | [
"def",
"_update_loaded_modules",
"(",
"self",
")",
":",
"system_modules",
"=",
"sys",
".",
"modules",
".",
"keys",
"(",
")",
"for",
"module",
"in",
"list",
"(",
"self",
".",
"loaded_modules",
")",
":",
"if",
"module",
"not",
"in",
"system_modules",
":",
... | Updates the loaded modules by checking if they are still in sys.modules | [
"Updates",
"the",
"loaded",
"modules",
"by",
"checking",
"if",
"they",
"are",
"still",
"in",
"sys",
".",
"modules"
] | a8a184f9ebfbb521703492cb88c1dbda4cd04c06 | https://github.com/benhoff/pluginmanager/blob/a8a184f9ebfbb521703492cb88c1dbda4cd04c06/pluginmanager/module_manager.py#L233-L241 | train | 61,180 |
newville/wxmplot | wxmplot/basepanel.py | BasePanel.get_right_axes | def get_right_axes(self):
"create, if needed, and return right-hand y axes"
if len(self.fig.get_axes()) < 2:
ax = self.axes.twinx()
return self.fig.get_axes()[1] | python | def get_right_axes(self):
"create, if needed, and return right-hand y axes"
if len(self.fig.get_axes()) < 2:
ax = self.axes.twinx()
return self.fig.get_axes()[1] | [
"def",
"get_right_axes",
"(",
"self",
")",
":",
"if",
"len",
"(",
"self",
".",
"fig",
".",
"get_axes",
"(",
")",
")",
"<",
"2",
":",
"ax",
"=",
"self",
".",
"axes",
".",
"twinx",
"(",
")",
"return",
"self",
".",
"fig",
".",
"get_axes",
"(",
")"... | create, if needed, and return right-hand y axes | [
"create",
"if",
"needed",
"and",
"return",
"right",
"-",
"hand",
"y",
"axes"
] | 8e0dc037453e5cdf18c968dc5a3d29efd761edee | https://github.com/newville/wxmplot/blob/8e0dc037453e5cdf18c968dc5a3d29efd761edee/wxmplot/basepanel.py#L138-L143 | train | 61,181 |
newville/wxmplot | wxmplot/basepanel.py | BasePanel.onLeftUp | def onLeftUp(self, event=None):
""" left button up"""
if event is None:
return
self.cursor_mode_action('leftup', event=event)
self.canvas.draw_idle()
self.canvas.draw()
self.ForwardEvent(event=event.guiEvent) | python | def onLeftUp(self, event=None):
""" left button up"""
if event is None:
return
self.cursor_mode_action('leftup', event=event)
self.canvas.draw_idle()
self.canvas.draw()
self.ForwardEvent(event=event.guiEvent) | [
"def",
"onLeftUp",
"(",
"self",
",",
"event",
"=",
"None",
")",
":",
"if",
"event",
"is",
"None",
":",
"return",
"self",
".",
"cursor_mode_action",
"(",
"'leftup'",
",",
"event",
"=",
"event",
")",
"self",
".",
"canvas",
".",
"draw_idle",
"(",
")",
"... | left button up | [
"left",
"button",
"up"
] | 8e0dc037453e5cdf18c968dc5a3d29efd761edee | https://github.com/newville/wxmplot/blob/8e0dc037453e5cdf18c968dc5a3d29efd761edee/wxmplot/basepanel.py#L268-L275 | train | 61,182 |
newville/wxmplot | wxmplot/basepanel.py | BasePanel.ForwardEvent | def ForwardEvent(self, event=None):
"""finish wx event, forward it to other wx objects"""
if event is not None:
event.Skip()
if self.HasCapture():
try:
self.ReleaseMouse()
except:
pass | python | def ForwardEvent(self, event=None):
"""finish wx event, forward it to other wx objects"""
if event is not None:
event.Skip()
if self.HasCapture():
try:
self.ReleaseMouse()
except:
pass | [
"def",
"ForwardEvent",
"(",
"self",
",",
"event",
"=",
"None",
")",
":",
"if",
"event",
"is",
"not",
"None",
":",
"event",
".",
"Skip",
"(",
")",
"if",
"self",
".",
"HasCapture",
"(",
")",
":",
"try",
":",
"self",
".",
"ReleaseMouse",
"(",
")",
"... | finish wx event, forward it to other wx objects | [
"finish",
"wx",
"event",
"forward",
"it",
"to",
"other",
"wx",
"objects"
] | 8e0dc037453e5cdf18c968dc5a3d29efd761edee | https://github.com/newville/wxmplot/blob/8e0dc037453e5cdf18c968dc5a3d29efd761edee/wxmplot/basepanel.py#L277-L285 | train | 61,183 |
newville/wxmplot | wxmplot/basepanel.py | BasePanel.__date_format | def __date_format(self, x):
""" formatter for date x-data. primitive, and probably needs
improvement, following matplotlib's date methods.
"""
if x < 1: x = 1
span = self.axes.xaxis.get_view_interval()
tmin = max(1.0, span[0])
tmax = max(2.0, span[1])
tm... | python | def __date_format(self, x):
""" formatter for date x-data. primitive, and probably needs
improvement, following matplotlib's date methods.
"""
if x < 1: x = 1
span = self.axes.xaxis.get_view_interval()
tmin = max(1.0, span[0])
tmax = max(2.0, span[1])
tm... | [
"def",
"__date_format",
"(",
"self",
",",
"x",
")",
":",
"if",
"x",
"<",
"1",
":",
"x",
"=",
"1",
"span",
"=",
"self",
".",
"axes",
".",
"xaxis",
".",
"get_view_interval",
"(",
")",
"tmin",
"=",
"max",
"(",
"1.0",
",",
"span",
"[",
"0",
"]",
... | formatter for date x-data. primitive, and probably needs
improvement, following matplotlib's date methods. | [
"formatter",
"for",
"date",
"x",
"-",
"data",
".",
"primitive",
"and",
"probably",
"needs",
"improvement",
"following",
"matplotlib",
"s",
"date",
"methods",
"."
] | 8e0dc037453e5cdf18c968dc5a3d29efd761edee | https://github.com/newville/wxmplot/blob/8e0dc037453e5cdf18c968dc5a3d29efd761edee/wxmplot/basepanel.py#L312-L335 | train | 61,184 |
newville/wxmplot | wxmplot/basepanel.py | BasePanel.xformatter | def xformatter(self, x, pos):
" x-axis formatter "
if self.use_dates:
return self.__date_format(x)
else:
return self.__format(x, type='x') | python | def xformatter(self, x, pos):
" x-axis formatter "
if self.use_dates:
return self.__date_format(x)
else:
return self.__format(x, type='x') | [
"def",
"xformatter",
"(",
"self",
",",
"x",
",",
"pos",
")",
":",
"if",
"self",
".",
"use_dates",
":",
"return",
"self",
".",
"__date_format",
"(",
"x",
")",
"else",
":",
"return",
"self",
".",
"__format",
"(",
"x",
",",
"type",
"=",
"'x'",
")"
] | x-axis formatter | [
"x",
"-",
"axis",
"formatter"
] | 8e0dc037453e5cdf18c968dc5a3d29efd761edee | https://github.com/newville/wxmplot/blob/8e0dc037453e5cdf18c968dc5a3d29efd761edee/wxmplot/basepanel.py#L337-L342 | train | 61,185 |
newville/wxmplot | wxmplot/basepanel.py | BasePanel.__onKeyEvent | def __onKeyEvent(self, event=None):
""" handles key events on canvas
"""
if event is None:
return
key = event.guiEvent.GetKeyCode()
if (key < wx.WXK_SPACE or key > 255):
return
ckey = chr(key)
mod = event.guiEvent.ControlDown()
if... | python | def __onKeyEvent(self, event=None):
""" handles key events on canvas
"""
if event is None:
return
key = event.guiEvent.GetKeyCode()
if (key < wx.WXK_SPACE or key > 255):
return
ckey = chr(key)
mod = event.guiEvent.ControlDown()
if... | [
"def",
"__onKeyEvent",
"(",
"self",
",",
"event",
"=",
"None",
")",
":",
"if",
"event",
"is",
"None",
":",
"return",
"key",
"=",
"event",
".",
"guiEvent",
".",
"GetKeyCode",
"(",
")",
"if",
"(",
"key",
"<",
"wx",
".",
"WXK_SPACE",
"or",
"key",
">",... | handles key events on canvas | [
"handles",
"key",
"events",
"on",
"canvas"
] | 8e0dc037453e5cdf18c968dc5a3d29efd761edee | https://github.com/newville/wxmplot/blob/8e0dc037453e5cdf18c968dc5a3d29efd761edee/wxmplot/basepanel.py#L406-L428 | train | 61,186 |
newville/wxmplot | wxmplot/basepanel.py | BasePanel.zoom_motion | def zoom_motion(self, event=None):
"""motion event handler for zoom mode"""
try:
x, y = event.x, event.y
except:
return
self.report_motion(event=event)
if self.zoom_ini is None:
return
ini_x, ini_y, ini_xd, ini_yd = self.zoom_ini
... | python | def zoom_motion(self, event=None):
"""motion event handler for zoom mode"""
try:
x, y = event.x, event.y
except:
return
self.report_motion(event=event)
if self.zoom_ini is None:
return
ini_x, ini_y, ini_xd, ini_yd = self.zoom_ini
... | [
"def",
"zoom_motion",
"(",
"self",
",",
"event",
"=",
"None",
")",
":",
"try",
":",
"x",
",",
"y",
"=",
"event",
".",
"x",
",",
"event",
".",
"y",
"except",
":",
"return",
"self",
".",
"report_motion",
"(",
"event",
"=",
"event",
")",
"if",
"self... | motion event handler for zoom mode | [
"motion",
"event",
"handler",
"for",
"zoom",
"mode"
] | 8e0dc037453e5cdf18c968dc5a3d29efd761edee | https://github.com/newville/wxmplot/blob/8e0dc037453e5cdf18c968dc5a3d29efd761edee/wxmplot/basepanel.py#L458-L492 | train | 61,187 |
newville/wxmplot | wxmplot/basepanel.py | BasePanel.zoom_leftdown | def zoom_leftdown(self, event=None):
"""leftdown event handler for zoom mode"""
self.x_lastmove, self.y_lastmove = None, None
self.zoom_ini = (event.x, event.y, event.xdata, event.ydata)
self.report_leftdown(event=event) | python | def zoom_leftdown(self, event=None):
"""leftdown event handler for zoom mode"""
self.x_lastmove, self.y_lastmove = None, None
self.zoom_ini = (event.x, event.y, event.xdata, event.ydata)
self.report_leftdown(event=event) | [
"def",
"zoom_leftdown",
"(",
"self",
",",
"event",
"=",
"None",
")",
":",
"self",
".",
"x_lastmove",
",",
"self",
".",
"y_lastmove",
"=",
"None",
",",
"None",
"self",
".",
"zoom_ini",
"=",
"(",
"event",
".",
"x",
",",
"event",
".",
"y",
",",
"event... | leftdown event handler for zoom mode | [
"leftdown",
"event",
"handler",
"for",
"zoom",
"mode"
] | 8e0dc037453e5cdf18c968dc5a3d29efd761edee | https://github.com/newville/wxmplot/blob/8e0dc037453e5cdf18c968dc5a3d29efd761edee/wxmplot/basepanel.py#L494-L498 | train | 61,188 |
newville/wxmplot | wxmplot/basepanel.py | BasePanel.lasso_leftdown | def lasso_leftdown(self, event=None):
"""leftdown event handler for lasso mode"""
try:
self.report_leftdown(event=event)
except:
return
if event.inaxes:
# set lasso color
color='goldenrod'
cmap = getattr(self.conf, 'cmap', None... | python | def lasso_leftdown(self, event=None):
"""leftdown event handler for lasso mode"""
try:
self.report_leftdown(event=event)
except:
return
if event.inaxes:
# set lasso color
color='goldenrod'
cmap = getattr(self.conf, 'cmap', None... | [
"def",
"lasso_leftdown",
"(",
"self",
",",
"event",
"=",
"None",
")",
":",
"try",
":",
"self",
".",
"report_leftdown",
"(",
"event",
"=",
"event",
")",
"except",
":",
"return",
"if",
"event",
".",
"inaxes",
":",
"# set lasso color",
"color",
"=",
"'golde... | leftdown event handler for lasso mode | [
"leftdown",
"event",
"handler",
"for",
"lasso",
"mode"
] | 8e0dc037453e5cdf18c968dc5a3d29efd761edee | https://github.com/newville/wxmplot/blob/8e0dc037453e5cdf18c968dc5a3d29efd761edee/wxmplot/basepanel.py#L549-L570 | train | 61,189 |
JensAstrup/pyOutlook | pyOutlook/core/folder.py | Folder.rename | def rename(self, new_folder_name):
"""Renames the Folder to the provided name.
Args:
new_folder_name: A string of the replacement name.
Raises:
AuthError: Raised if Outlook returns a 401, generally caused by an invalid or expired access token.
Returns:
... | python | def rename(self, new_folder_name):
"""Renames the Folder to the provided name.
Args:
new_folder_name: A string of the replacement name.
Raises:
AuthError: Raised if Outlook returns a 401, generally caused by an invalid or expired access token.
Returns:
... | [
"def",
"rename",
"(",
"self",
",",
"new_folder_name",
")",
":",
"headers",
"=",
"self",
".",
"headers",
"endpoint",
"=",
"'https://outlook.office.com/api/v2.0/me/MailFolders/'",
"+",
"self",
".",
"id",
"payload",
"=",
"'{ \"DisplayName\": \"'",
"+",
"new_folder_name",... | Renames the Folder to the provided name.
Args:
new_folder_name: A string of the replacement name.
Raises:
AuthError: Raised if Outlook returns a 401, generally caused by an invalid or expired access token.
Returns:
A new Folder representing the folder with ... | [
"Renames",
"the",
"Folder",
"to",
"the",
"provided",
"name",
"."
] | f4ca9d4a8629c0a41f78102ce84fab702a841167 | https://github.com/JensAstrup/pyOutlook/blob/f4ca9d4a8629c0a41f78102ce84fab702a841167/pyOutlook/core/folder.py#L50-L71 | train | 61,190 |
JensAstrup/pyOutlook | pyOutlook/core/folder.py | Folder.get_subfolders | def get_subfolders(self):
"""Retrieve all child Folders inside of this Folder.
Raises:
AuthError: Raised if Outlook returns a 401, generally caused by an invalid or expired access token.
Returns:
List[:class:`Folder <pyOutlook.core.folder.Folder>`]
"""
h... | python | def get_subfolders(self):
"""Retrieve all child Folders inside of this Folder.
Raises:
AuthError: Raised if Outlook returns a 401, generally caused by an invalid or expired access token.
Returns:
List[:class:`Folder <pyOutlook.core.folder.Folder>`]
"""
h... | [
"def",
"get_subfolders",
"(",
"self",
")",
":",
"headers",
"=",
"self",
".",
"headers",
"endpoint",
"=",
"'https://outlook.office.com/api/v2.0/me/MailFolders/'",
"+",
"self",
".",
"id",
"+",
"'/childfolders'",
"r",
"=",
"requests",
".",
"get",
"(",
"endpoint",
"... | Retrieve all child Folders inside of this Folder.
Raises:
AuthError: Raised if Outlook returns a 401, generally caused by an invalid or expired access token.
Returns:
List[:class:`Folder <pyOutlook.core.folder.Folder>`] | [
"Retrieve",
"all",
"child",
"Folders",
"inside",
"of",
"this",
"Folder",
"."
] | f4ca9d4a8629c0a41f78102ce84fab702a841167 | https://github.com/JensAstrup/pyOutlook/blob/f4ca9d4a8629c0a41f78102ce84fab702a841167/pyOutlook/core/folder.py#L73-L88 | train | 61,191 |
JensAstrup/pyOutlook | pyOutlook/core/folder.py | Folder.delete | def delete(self):
"""Deletes this Folder.
Raises:
AuthError: Raised if Outlook returns a 401, generally caused by an invalid or expired access token.
"""
headers = self.headers
endpoint = 'https://outlook.office.com/api/v2.0/me/MailFolders/' + self.id
r = r... | python | def delete(self):
"""Deletes this Folder.
Raises:
AuthError: Raised if Outlook returns a 401, generally caused by an invalid or expired access token.
"""
headers = self.headers
endpoint = 'https://outlook.office.com/api/v2.0/me/MailFolders/' + self.id
r = r... | [
"def",
"delete",
"(",
"self",
")",
":",
"headers",
"=",
"self",
".",
"headers",
"endpoint",
"=",
"'https://outlook.office.com/api/v2.0/me/MailFolders/'",
"+",
"self",
".",
"id",
"r",
"=",
"requests",
".",
"delete",
"(",
"endpoint",
",",
"headers",
"=",
"header... | Deletes this Folder.
Raises:
AuthError: Raised if Outlook returns a 401, generally caused by an invalid or expired access token. | [
"Deletes",
"this",
"Folder",
"."
] | f4ca9d4a8629c0a41f78102ce84fab702a841167 | https://github.com/JensAstrup/pyOutlook/blob/f4ca9d4a8629c0a41f78102ce84fab702a841167/pyOutlook/core/folder.py#L90-L102 | train | 61,192 |
JensAstrup/pyOutlook | pyOutlook/core/folder.py | Folder.move_into | def move_into(self, destination_folder):
# type: (Folder) -> None
"""Move the Folder into a different folder.
This makes the Folder provided a child folder of the destination_folder.
Raises:
AuthError: Raised if Outlook returns a 401, generally caused by an invalid or expir... | python | def move_into(self, destination_folder):
# type: (Folder) -> None
"""Move the Folder into a different folder.
This makes the Folder provided a child folder of the destination_folder.
Raises:
AuthError: Raised if Outlook returns a 401, generally caused by an invalid or expir... | [
"def",
"move_into",
"(",
"self",
",",
"destination_folder",
")",
":",
"# type: (Folder) -> None",
"headers",
"=",
"self",
".",
"headers",
"endpoint",
"=",
"'https://outlook.office.com/api/v2.0/me/MailFolders/'",
"+",
"self",
".",
"id",
"+",
"'/move'",
"payload",
"=",
... | Move the Folder into a different folder.
This makes the Folder provided a child folder of the destination_folder.
Raises:
AuthError: Raised if Outlook returns a 401, generally caused by an invalid or expired access token.
Args:
destination_folder: A :class:`Folder <pyO... | [
"Move",
"the",
"Folder",
"into",
"a",
"different",
"folder",
"."
] | f4ca9d4a8629c0a41f78102ce84fab702a841167 | https://github.com/JensAstrup/pyOutlook/blob/f4ca9d4a8629c0a41f78102ce84fab702a841167/pyOutlook/core/folder.py#L104-L129 | train | 61,193 |
JensAstrup/pyOutlook | pyOutlook/core/folder.py | Folder.create_child_folder | def create_child_folder(self, folder_name):
"""Creates a child folder within the Folder it is called from and returns the new Folder object.
Args:
folder_name: The name of the folder to create
Returns: :class:`Folder <pyOutlook.core.folder.Folder>`
"""
headers = sel... | python | def create_child_folder(self, folder_name):
"""Creates a child folder within the Folder it is called from and returns the new Folder object.
Args:
folder_name: The name of the folder to create
Returns: :class:`Folder <pyOutlook.core.folder.Folder>`
"""
headers = sel... | [
"def",
"create_child_folder",
"(",
"self",
",",
"folder_name",
")",
":",
"headers",
"=",
"self",
".",
"headers",
"endpoint",
"=",
"'https://outlook.office.com/api/v2.0/me/MailFolders/'",
"+",
"self",
".",
"id",
"+",
"'/childfolders'",
"payload",
"=",
"'{ \"DisplayName... | Creates a child folder within the Folder it is called from and returns the new Folder object.
Args:
folder_name: The name of the folder to create
Returns: :class:`Folder <pyOutlook.core.folder.Folder>` | [
"Creates",
"a",
"child",
"folder",
"within",
"the",
"Folder",
"it",
"is",
"called",
"from",
"and",
"returns",
"the",
"new",
"Folder",
"object",
"."
] | f4ca9d4a8629c0a41f78102ce84fab702a841167 | https://github.com/JensAstrup/pyOutlook/blob/f4ca9d4a8629c0a41f78102ce84fab702a841167/pyOutlook/core/folder.py#L155-L171 | train | 61,194 |
newville/wxmplot | wxmplot/utils.py | gformat | def gformat(val, length=11):
"""Format a number with '%g'-like format, except that
a) the length of the output string will be the requested length.
b) positive numbers will have a leading blank.
b) the precision will be as high as possible.
c) trailing zeros will not be trimmed.
... | python | def gformat(val, length=11):
"""Format a number with '%g'-like format, except that
a) the length of the output string will be the requested length.
b) positive numbers will have a leading blank.
b) the precision will be as high as possible.
c) trailing zeros will not be trimmed.
... | [
"def",
"gformat",
"(",
"val",
",",
"length",
"=",
"11",
")",
":",
"try",
":",
"expon",
"=",
"int",
"(",
"log10",
"(",
"abs",
"(",
"val",
")",
")",
")",
"except",
"(",
"OverflowError",
",",
"ValueError",
")",
":",
"expon",
"=",
"0",
"length",
"=",... | Format a number with '%g'-like format, except that
a) the length of the output string will be the requested length.
b) positive numbers will have a leading blank.
b) the precision will be as high as possible.
c) trailing zeros will not be trimmed.
The precision will typically be le... | [
"Format",
"a",
"number",
"with",
"%g",
"-",
"like",
"format",
"except",
"that"
] | 8e0dc037453e5cdf18c968dc5a3d29efd761edee | https://github.com/newville/wxmplot/blob/8e0dc037453e5cdf18c968dc5a3d29efd761edee/wxmplot/utils.py#L26-L66 | train | 61,195 |
newville/wxmplot | wxmplot/utils.py | pack | def pack(window, sizer, expand=1.1):
"simple wxPython pack function"
tsize = window.GetSize()
msize = window.GetMinSize()
window.SetSizer(sizer)
sizer.Fit(window)
nsize = (10*int(expand*(max(msize[0], tsize[0])/10)),
10*int(expand*(max(msize[1], tsize[1])/10.)))
window.SetSize... | python | def pack(window, sizer, expand=1.1):
"simple wxPython pack function"
tsize = window.GetSize()
msize = window.GetMinSize()
window.SetSizer(sizer)
sizer.Fit(window)
nsize = (10*int(expand*(max(msize[0], tsize[0])/10)),
10*int(expand*(max(msize[1], tsize[1])/10.)))
window.SetSize... | [
"def",
"pack",
"(",
"window",
",",
"sizer",
",",
"expand",
"=",
"1.1",
")",
":",
"tsize",
"=",
"window",
".",
"GetSize",
"(",
")",
"msize",
"=",
"window",
".",
"GetMinSize",
"(",
")",
"window",
".",
"SetSizer",
"(",
"sizer",
")",
"sizer",
".",
"Fit... | simple wxPython pack function | [
"simple",
"wxPython",
"pack",
"function"
] | 8e0dc037453e5cdf18c968dc5a3d29efd761edee | https://github.com/newville/wxmplot/blob/8e0dc037453e5cdf18c968dc5a3d29efd761edee/wxmplot/utils.py#L68-L76 | train | 61,196 |
newville/wxmplot | wxmplot/utils.py | Printer.Setup | def Setup(self, event=None):
"""set up figure for printing. Using the standard wx Printer
Setup Dialog. """
if hasattr(self, 'printerData'):
data = wx.PageSetupDialogData()
data.SetPrintData(self.printerData)
else:
data = wx.PageSetupDialogData()
... | python | def Setup(self, event=None):
"""set up figure for printing. Using the standard wx Printer
Setup Dialog. """
if hasattr(self, 'printerData'):
data = wx.PageSetupDialogData()
data.SetPrintData(self.printerData)
else:
data = wx.PageSetupDialogData()
... | [
"def",
"Setup",
"(",
"self",
",",
"event",
"=",
"None",
")",
":",
"if",
"hasattr",
"(",
"self",
",",
"'printerData'",
")",
":",
"data",
"=",
"wx",
".",
"PageSetupDialogData",
"(",
")",
"data",
".",
"SetPrintData",
"(",
"self",
".",
"printerData",
")",
... | set up figure for printing. Using the standard wx Printer
Setup Dialog. | [
"set",
"up",
"figure",
"for",
"printing",
".",
"Using",
"the",
"standard",
"wx",
"Printer",
"Setup",
"Dialog",
"."
] | 8e0dc037453e5cdf18c968dc5a3d29efd761edee | https://github.com/newville/wxmplot/blob/8e0dc037453e5cdf18c968dc5a3d29efd761edee/wxmplot/utils.py#L250-L269 | train | 61,197 |
newville/wxmplot | wxmplot/utils.py | Printer.Preview | def Preview(self, title=None, event=None):
""" generate Print Preview with wx Print mechanism"""
if title is None:
title = self.title
if self.canvas is None:
self.canvas = self.parent.canvas
po1 = PrintoutWx(self.parent.canvas, title=title,
... | python | def Preview(self, title=None, event=None):
""" generate Print Preview with wx Print mechanism"""
if title is None:
title = self.title
if self.canvas is None:
self.canvas = self.parent.canvas
po1 = PrintoutWx(self.parent.canvas, title=title,
... | [
"def",
"Preview",
"(",
"self",
",",
"title",
"=",
"None",
",",
"event",
"=",
"None",
")",
":",
"if",
"title",
"is",
"None",
":",
"title",
"=",
"self",
".",
"title",
"if",
"self",
".",
"canvas",
"is",
"None",
":",
"self",
".",
"canvas",
"=",
"self... | generate Print Preview with wx Print mechanism | [
"generate",
"Print",
"Preview",
"with",
"wx",
"Print",
"mechanism"
] | 8e0dc037453e5cdf18c968dc5a3d29efd761edee | https://github.com/newville/wxmplot/blob/8e0dc037453e5cdf18c968dc5a3d29efd761edee/wxmplot/utils.py#L271-L294 | train | 61,198 |
newville/wxmplot | examples/floatcontrol.py | set_float | def set_float(val):
""" utility to set a floating value,
useful for converting from strings """
out = None
if not val in (None, ''):
try:
out = float(val)
except ValueError:
return None
if numpy.isnan(out):
out = default
return out | python | def set_float(val):
""" utility to set a floating value,
useful for converting from strings """
out = None
if not val in (None, ''):
try:
out = float(val)
except ValueError:
return None
if numpy.isnan(out):
out = default
return out | [
"def",
"set_float",
"(",
"val",
")",
":",
"out",
"=",
"None",
"if",
"not",
"val",
"in",
"(",
"None",
",",
"''",
")",
":",
"try",
":",
"out",
"=",
"float",
"(",
"val",
")",
"except",
"ValueError",
":",
"return",
"None",
"if",
"numpy",
".",
"isnan"... | utility to set a floating value,
useful for converting from strings | [
"utility",
"to",
"set",
"a",
"floating",
"value",
"useful",
"for",
"converting",
"from",
"strings"
] | 8e0dc037453e5cdf18c968dc5a3d29efd761edee | https://github.com/newville/wxmplot/blob/8e0dc037453e5cdf18c968dc5a3d29efd761edee/examples/floatcontrol.py#L14-L25 | train | 61,199 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.