_id stringlengths 2 7 | title stringlengths 1 88 | partition stringclasses 3
values | text stringlengths 75 19.8k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q20200 | GetFile | train | def GetFile(message=None, title=None, directory=None, fileName=None,
allowsMultipleSelection=False, fileTypes=None):
"""
An get file dialog.
Optionally a `message`, `title`, `directory`, `fileName` and
`allowsMultipleSelection` can be provided.
::
from fontParts.ui import GetFi... | python | {
"resource": ""
} |
q20201 | Message | train | def Message(message, title='FontParts', informativeText=""):
"""
An message dialog.
Optionally a `message`, `title` and `informativeText` can be provided.
::
from fontParts.ui import Message
print(Message("This is a message"))
"""
return dispatcher["Message"](message=message, ... | python | {
"resource": ""
} |
q20202 | SearchList | train | def SearchList(items, message="Select an item:", title='FontParts'):
"""
A dialgo to search a given list.
Optionally a `message`, `title` and `allFonts` can be provided.
::
from fontParts.ui import SearchList
result = SearchList(["a", "b", "c"])
print(result)
"""
retur... | python | {
"resource": ""
} |
q20203 | SelectFont | train | def SelectFont(message="Select a font:", title='FontParts', allFonts=None):
"""
Select a font from all open fonts.
Optionally a `message`, `title` and `allFonts` can be provided.
If `allFonts` is `None` it will list all open fonts.
::
from fontParts.ui import SelectFont
font = Sele... | python | {
"resource": ""
} |
q20204 | SelectGlyph | train | def SelectGlyph(aFont, message="Select a glyph:", title='FontParts'):
"""
Select a glyph for a given font.
Optionally a `message` and `title` can be provided.
::
from fontParts.ui import SelectGlyph
font = CurrentFont()
glyph = SelectGlyph(font)
print(glyph)
"""
... | python | {
"resource": ""
} |
q20205 | ProgressBar | train | def ProgressBar(title="RoboFab...", ticks=None, label=""):
"""
A progess bar dialog.
Optionally a `title`, `ticks` and `label` can be provided.
::
from fontParts.ui import ProgressBar
bar = ProgressBar()
# do something
bar.close()
"""
return dispatcher["Progre... | python | {
"resource": ""
} |
q20206 | BasePoint._get_index | train | def _get_index(self):
"""
Get the point's index.
This must return an ``int``.
Subclasses may override this method.
"""
contour = self.contour
if contour is None:
return None
return contour.points.index(self) | python | {
"resource": ""
} |
q20207 | BaseObject.copy | train | def copy(self):
"""
Copy this object into a new object of the same type.
The returned object will not have a parent object.
"""
copyClass = self.copyClass
if copyClass is None:
copyClass = self.__class__
copied = copyClass()
copied.copyData(sel... | python | {
"resource": ""
} |
q20208 | BaseObject.copyData | train | def copyData(self, source):
"""
Subclasses may override this method.
If so, they should call the super.
"""
for attr in self.copyAttributes:
selfValue = getattr(self, attr)
sourceValue = getattr(source, attr)
if isinstance(selfValue, BaseObject... | python | {
"resource": ""
} |
q20209 | TransformationMixin.transformBy | train | def transformBy(self, matrix, origin=None):
"""
Transform the object.
>>> obj.transformBy((0.5, 0, 0, 2.0, 10, 0))
>>> obj.transformBy((0.5, 0, 0, 2.0, 10, 0), origin=(500, 500))
**matrix** must be a :ref:`type-transformation`.
**origin** defines the point at wi... | python | {
"resource": ""
} |
q20210 | TransformationMixin.moveBy | train | def moveBy(self, value):
"""
Move the object.
>>> obj.transformBy((10, 0))
**value** must be an iterable containing two
:ref:`type-int-float` values defining the x and y
values to move the object by.
"""
value = normalizers.normalizeTransformationOff... | python | {
"resource": ""
} |
q20211 | TransformationMixin.scaleBy | train | def scaleBy(self, value, origin=None):
"""
Scale the object.
>>> obj.transformBy(2.0)
>>> obj.transformBy((0.5, 2.0), origin=(500, 500))
**value** must be an iterable containing two
:ref:`type-int-float` values defining the x and y
values to scale the ob... | python | {
"resource": ""
} |
q20212 | TransformationMixin.rotateBy | train | def rotateBy(self, value, origin=None):
"""
Rotate the object.
>>> obj.transformBy(45)
>>> obj.transformBy(45, origin=(500, 500))
**value** must be a :ref:`type-int-float` values
defining the angle to rotate the object by. **origin**
defines the point at... | python | {
"resource": ""
} |
q20213 | TransformationMixin.skewBy | train | def skewBy(self, value, origin=None):
"""
Skew the object.
>>> obj.skewBy(11)
>>> obj.skewBy((25, 10), origin=(500, 500))
**value** must be rone of the following:
* single :ref:`type-int-float` indicating the
value to skew the x direction by.
... | python | {
"resource": ""
} |
q20214 | BaseInfo.fromMathInfo | train | def fromMathInfo(self, mathInfo, guidelines=True):
"""
Replaces the contents of this info object with the contents of ``mathInfo``.
>>> font.fromMathInfo(mg)
``mathInfo`` must be an object following the
`MathInfo protocol <https://github.com/typesupply/fontMath>`_.
... | python | {
"resource": ""
} |
q20215 | BaseInfo.interpolate | train | def interpolate(self, factor, minInfo, maxInfo, round=True, suppressError=True):
"""
Interpolate all pairs between minInfo and maxInfo.
The interpolation occurs on a 0 to 1.0 range where minInfo
is located at 0 and maxInfo is located at 1.0.
factor is the interpolation value. It... | python | {
"resource": ""
} |
q20216 | autoprefixCSS | train | def autoprefixCSS(sassPath):
'''
Take CSS file and automatically add browser prefixes with postCSS autoprefixer
'''
print("Autoprefixing CSS")
cssPath = os.path.splitext(sassPath)[0] + ".css"
command = "postcss --use autoprefixer --autoprefixer.browsers '> 5%' -o" + cssPath + " " + cssPath
... | python | {
"resource": ""
} |
q20217 | BaseFont.generate | train | def generate(self, format, path=None, **environmentOptions):
"""
Generate the font to another format.
>>> font.generate("otfcff")
>>> font.generate("otfcff", "/path/to/my/font.otf")
**format** defines the file format to output.
Standard format identifiers can be... | python | {
"resource": ""
} |
q20218 | BaseFont.appendGuideline | train | def appendGuideline(self, position=None, angle=None, name=None, color=None, guideline=None):
"""
Append a new guideline to the font.
>>> guideline = font.appendGuideline((50, 0), 90)
>>> guideline = font.appendGuideline((0, 540), 0, name="overshoot",
>>> color=(0, 0,... | python | {
"resource": ""
} |
q20219 | BaseFont.interpolate | train | def interpolate(self, factor, minFont, maxFont,
round=True, suppressError=True):
"""
Interpolate all possible data in the font.
>>> font.interpolate(0.5, otherFont1, otherFont2)
>>> font.interpolate((0.5, 2.0), otherFont1, otherFont2, round=False)
Th... | python | {
"resource": ""
} |
q20220 | BaseContour.getIdentifierForPoint | train | def getIdentifierForPoint(self, point):
"""
Create a unique identifier for and assign it to ``point``.
If the point already has an identifier, the existing
identifier will be returned.
>>> contour.getIdentifierForPoint(point)
'ILHGJlygfds'
``point`` must... | python | {
"resource": ""
} |
q20221 | BaseContour.contourInside | train | def contourInside(self, otherContour):
"""
Determine if ``otherContour`` is in the black or white of this contour.
>>> contour.contourInside(otherContour)
True
``contour`` must be a :class:`BaseContour`.
"""
otherContour = normalizers.normalizeContour(ot... | python | {
"resource": ""
} |
q20222 | BaseContour.appendSegment | train | def appendSegment(self, type=None, points=None, smooth=False, segment=None):
"""
Append a segment to the contour.
"""
if segment is not None:
if type is not None:
type = segment.type
if points is None:
points = [(point.x, point.y) f... | python | {
"resource": ""
} |
q20223 | BaseContour.insertSegment | train | def insertSegment(self, index, type=None, points=None, smooth=False, segment=None):
"""
Insert a segment into the contour.
"""
if segment is not None:
if type is not None:
type = segment.type
if points is None:
points = [(point.x, p... | python | {
"resource": ""
} |
q20224 | BaseContour.removeSegment | train | def removeSegment(self, segment, preserveCurve=False):
"""
Remove segment from the contour.
If ``preserveCurve`` is set to ``True`` an attempt
will be made to preserve the shape of the curve
if the environment supports that functionality.
"""
if not isinstance(seg... | python | {
"resource": ""
} |
q20225 | BaseContour._removeSegment | train | def _removeSegment(self, segment, preserveCurve, **kwargs):
"""
segment will be a valid segment index.
preserveCurve will be a boolean.
Subclasses may override this method.
"""
segment = self.segments[segment]
for point in segment.points:
self.removeP... | python | {
"resource": ""
} |
q20226 | BaseContour.setStartSegment | train | def setStartSegment(self, segment):
"""
Set the first segment on the contour.
segment can be a segment object or an index.
"""
segments = self.segments
if not isinstance(segment, int):
segmentIndex = segments.index(segment)
else:
segmentInd... | python | {
"resource": ""
} |
q20227 | BaseContour.appendBPoint | train | def appendBPoint(self, type=None, anchor=None, bcpIn=None, bcpOut=None, bPoint=None):
"""
Append a bPoint to the contour.
"""
if bPoint is not None:
if type is None:
type = bPoint.type
if anchor is None:
anchor = bPoint.anchor
... | python | {
"resource": ""
} |
q20228 | BaseContour.insertBPoint | train | def insertBPoint(self, index, type=None, anchor=None, bcpIn=None, bcpOut=None, bPoint=None):
"""
Insert a bPoint at index in the contour.
"""
if bPoint is not None:
if type is None:
type = bPoint.type
if anchor is None:
anchor = bPo... | python | {
"resource": ""
} |
q20229 | BaseContour.removeBPoint | train | def removeBPoint(self, bPoint):
"""
Remove the bpoint from the contour.
bpoint can be a point object or an index.
"""
if not isinstance(bPoint, int):
bPoint = bPoint.index
bPoint = normalizers.normalizeIndex(bPoint)
if bPoint >= self._len__points():
... | python | {
"resource": ""
} |
q20230 | BaseContour._removeBPoint | train | def _removeBPoint(self, index, **kwargs):
"""
index will be a valid index.
Subclasses may override this method.
"""
bPoint = self.bPoints[index]
nextSegment = bPoint._nextSegment
offCurves = nextSegment.offCurve
if offCurves:
offCurve = offCu... | python | {
"resource": ""
} |
q20231 | BaseContour.appendPoint | train | def appendPoint(self, position=None, type="line", smooth=False, name=None, identifier=None, point=None):
"""
Append a point to the contour.
"""
if point is not None:
if position is None:
position = point.position
type = point.type
smoot... | python | {
"resource": ""
} |
q20232 | BaseContour.insertPoint | train | def insertPoint(self, index, position=None, type="line", smooth=False, name=None, identifier=None, point=None):
"""
Insert a point into the contour.
"""
if point is not None:
if position is None:
position = point.position
type = point.type
... | python | {
"resource": ""
} |
q20233 | BaseContour.removePoint | train | def removePoint(self, point, preserveCurve=False):
"""
Remove the point from the contour.
point can be a point object or an index.
If ``preserveCurve`` is set to ``True`` an attempt
will be made to preserve the shape of the curve
if the environment supports that functiona... | python | {
"resource": ""
} |
q20234 | BaseKerning.asDict | train | def asDict(self, returnIntegers=True):
"""
Return the Kerning as a ``dict``.
This is a backwards compatibility method.
"""
d = {}
for k, v in self.items():
d[k] = v if not returnIntegers else normalizers.normalizeRounding(v)
return d | python | {
"resource": ""
} |
q20235 | BaseSimpleType.validate_float | train | def validate_float(cls, value):
"""
Note that int values are accepted.
"""
if not isinstance(value, (int, float)):
raise TypeError(
"value must be a number, got %s" % type(value)
) | python | {
"resource": ""
} |
q20236 | ST_Angle.convert_to_xml | train | def convert_to_xml(cls, value):
"""
Convert signed angle float like -42.42 to int 60000 per degree,
normalized to positive value.
"""
# modulo normalizes negative and >360 degree values
rot = int(round(value * cls.DEGREE_INCREMENTS)) % cls.THREE_SIXTY
return str(r... | python | {
"resource": ""
} |
q20237 | ST_PositiveFixedAngle.convert_to_xml | train | def convert_to_xml(cls, degrees):
"""Convert signed angle float like -427.42 to int 60000 per degree.
Value is normalized to a positive value less than 360 degrees.
"""
if degrees < 0.0:
degrees %= -360
degrees += 360
elif degrees > 0.0:
degre... | python | {
"resource": ""
} |
q20238 | LayoutPlaceholder._base_placeholder | train | def _base_placeholder(self):
"""
Return the master placeholder this layout placeholder inherits from.
"""
base_ph_type = {
PP_PLACEHOLDER.BODY: PP_PLACEHOLDER.BODY,
PP_PLACEHOLDER.CHART: PP_PLACEHOLDER.BODY,
PP_PLACEHOLDER.BITMAP: ... | python | {
"resource": ""
} |
q20239 | NotesSlidePlaceholder._base_placeholder | train | def _base_placeholder(self):
"""
Return the notes master placeholder this notes slide placeholder
inherits from, or |None| if no placeholder of the matching type is
present.
"""
notes_master = self.part.notes_master
ph_type = self.element.ph_type
return no... | python | {
"resource": ""
} |
q20240 | GroupShape.shapes | train | def shapes(self):
"""|GroupShapes| object for this group.
The |GroupShapes| object provides access to the group's member shapes
and provides methods for adding new ones.
"""
from pptx.shapes.shapetree import GroupShapes
return GroupShapes(self._element, self) | python | {
"resource": ""
} |
q20241 | load_adjustment_values | train | def load_adjustment_values():
"""load adjustment values and their default values from XML"""
# parse XML --------------------------------------------
thisdir = os.path.split(__file__)[0]
prst_defs_relpath = (
'ISO-IEC-29500-1/schemas/dml-geometries/OfficeOpenXML-DrawingMLGeomet'
'ries/pr... | python | {
"resource": ""
} |
q20242 | print_mso_auto_shape_type_spec | train | def print_mso_auto_shape_type_spec():
"""print spec dictionary for msoAutoShapeType"""
auto_shape_types = MsoAutoShapeTypeCollection.load(sort='const_name')
out = render_mso_auto_shape_type_spec(auto_shape_types)
print out | python | {
"resource": ""
} |
q20243 | render_desc | train | def render_desc(desc):
"""calculate desc string, wrapped if too long"""
desc = desc + '.'
desc_lines = split_len(desc, 54)
if len(desc_lines) > 1:
join_str = "'\n%s'" % (' '*21)
lines_str = join_str.join(desc_lines)
out = "('%s')" % lines_str
else:
out = "'%s'" % desc... | python | {
"resource": ""
} |
q20244 | parse_args | train | def parse_args(spectypes):
"""
Return arguments object formed by parsing the command line used to launch
the program.
"""
arg_parser = argparse.ArgumentParser()
arg_parser.add_argument(
"-c", "--constants",
help="emit constants instead of spec dict",
action="store_true"
... | python | {
"resource": ""
} |
q20245 | MsoAutoShapeTypeCollection.load_adjustment_values | train | def load_adjustment_values(self, c):
"""load adjustment values for auto shape types in self"""
# retrieve auto shape types in const_name order --------
for mast in self:
# retriev adj vals for this auto shape type --------
c.execute(
' SELECT name, val\n'... | python | {
"resource": ""
} |
q20246 | _required_attribute | train | def _required_attribute(element, name, default):
"""
Add attribute with default value to element if it doesn't already exist.
"""
if element.get(name) is None:
element.set(name, default) | python | {
"resource": ""
} |
q20247 | ComplexType.add_element | train | def add_element(self, element):
"""
Add an element to this ComplexType and also append it to element dict
of parent type graph.
"""
self.elements.append(element)
self.type_graph.add_element(element) | python | {
"resource": ""
} |
q20248 | NotesSlide.notes_placeholder | train | def notes_placeholder(self):
"""
Return the notes placeholder on this notes slide, the shape that
contains the actual notes text. Return |None| if no notes placeholder
is present; while this is probably uncommon, it can happen if the
notes master does not have a body placeholder,... | python | {
"resource": ""
} |
q20249 | SlideLayout.iter_cloneable_placeholders | train | def iter_cloneable_placeholders(self):
"""
Generate a reference to each layout placeholder on this slide layout
that should be cloned to a slide when the layout is applied to that
slide.
"""
latent_ph_types = (
PP_PLACEHOLDER.DATE, PP_PLACEHOLDER.FOOTER,
... | python | {
"resource": ""
} |
q20250 | SlideLayout.used_by_slides | train | def used_by_slides(self):
"""Tuple of slide objects based on this slide layout."""
# ---getting Slides collection requires going around the horn a bit---
slides = self.part.package.presentation_part.presentation.slides
return tuple(s for s in slides if s.slide_layout == self) | python | {
"resource": ""
} |
q20251 | Presentation.slides | train | def slides(self):
"""
|Slides| object containing the slides in this presentation.
"""
sldIdLst = self._element.get_or_add_sldIdLst()
self.part.rename_slide_parts([sldId.rId for sldId in sldIdLst])
return Slides(sldIdLst, self) | python | {
"resource": ""
} |
q20252 | FreeformBuilder.new | train | def new(cls, shapes, start_x, start_y, x_scale, y_scale):
"""Return a new |FreeformBuilder| object.
The initial pen location is specified (in local coordinates) by
(*start_x*, *start_y*).
"""
return cls(
shapes, int(round(start_x)), int(round(start_y)),
x... | python | {
"resource": ""
} |
q20253 | FreeformBuilder.convert_to_shape | train | def convert_to_shape(self, origin_x=0, origin_y=0):
"""Return new freeform shape positioned relative to specified offset.
*origin_x* and *origin_y* locate the origin of the local coordinate
system in slide coordinates (EMU), perhaps most conveniently by use
of a |Length| object.
... | python | {
"resource": ""
} |
q20254 | FreeformBuilder.shape_offset_x | train | def shape_offset_x(self):
"""Return x distance of shape origin from local coordinate origin.
The returned integer represents the leftmost extent of the freeform
shape, in local coordinates. Note that the bounding box of the shape
need not start at the local origin.
"""
m... | python | {
"resource": ""
} |
q20255 | FreeformBuilder.shape_offset_y | train | def shape_offset_y(self):
"""Return y distance of shape origin from local coordinate origin.
The returned integer represents the topmost extent of the freeform
shape, in local coordinates. Note that the bounding box of the shape
need not start at the local origin.
"""
mi... | python | {
"resource": ""
} |
q20256 | FreeformBuilder._add_line_segment | train | def _add_line_segment(self, x, y):
"""Add a |_LineSegment| operation to the drawing sequence."""
self._drawing_operations.append(_LineSegment.new(self, x, y)) | python | {
"resource": ""
} |
q20257 | FreeformBuilder._dx | train | def _dx(self):
"""Return integer width of this shape's path in local units."""
min_x = max_x = self._start_x
for drawing_operation in self:
if hasattr(drawing_operation, 'x'):
min_x = min(min_x, drawing_operation.x)
max_x = max(max_x, drawing_operation... | python | {
"resource": ""
} |
q20258 | FreeformBuilder._dy | train | def _dy(self):
"""Return integer height of this shape's path in local units."""
min_y = max_y = self._start_y
for drawing_operation in self:
if hasattr(drawing_operation, 'y'):
min_y = min(min_y, drawing_operation.y)
max_y = max(max_y, drawing_operatio... | python | {
"resource": ""
} |
q20259 | FreeformBuilder._local_to_shape | train | def _local_to_shape(self, local_x, local_y):
"""Translate local coordinates point to shape coordinates.
Shape coordinates have the same unit as local coordinates, but are
offset such that the origin of the shape coordinate system (0, 0) is
located at the top-left corner of the shape bou... | python | {
"resource": ""
} |
q20260 | FillFormat.background | train | def background(self):
"""
Sets the fill type to noFill, i.e. transparent.
"""
noFill = self._xPr.get_or_change_to_noFill()
self._fill = _NoFill(noFill) | python | {
"resource": ""
} |
q20261 | FillFormat.gradient | train | def gradient(self):
"""Sets the fill type to gradient.
If the fill is not already a gradient, a default gradient is added.
The default gradient corresponds to the default in the built-in
PowerPoint "White" template. This gradient is linear at angle
90-degrees (upward), with two ... | python | {
"resource": ""
} |
q20262 | FillFormat.gradient_stops | train | def gradient_stops(self):
"""|GradientStops| object providing access to stops of this gradient.
Raises |TypeError| when fill is not gradient (call `fill.gradient()`
first). Each stop represents a color between which the gradient
smoothly transitions.
"""
if self.type != ... | python | {
"resource": ""
} |
q20263 | FillFormat.patterned | train | def patterned(self):
"""Selects the pattern fill type.
Note that calling this method does not by itself set a foreground or
background color of the pattern. Rather it enables subsequent
assignments to properties like fore_color to set the pattern and
colors.
"""
... | python | {
"resource": ""
} |
q20264 | FillFormat.solid | train | def solid(self):
"""
Sets the fill type to solid, i.e. a solid color. Note that calling
this method does not set a color or by itself cause the shape to
appear with a solid color fill; rather it enables subsequent
assignments to properties like fore_color to set the color.
... | python | {
"resource": ""
} |
q20265 | Point.format | train | def format(self):
"""
The |ChartFormat| object providing access to the shape formatting
properties of this data point, such as line and fill.
"""
dPt = self._ser.get_or_add_dPt_for_point(self._idx)
return ChartFormat(dPt) | python | {
"resource": ""
} |
q20266 | Point.marker | train | def marker(self):
"""
The |Marker| instance for this point, providing access to the visual
properties of the data point marker, such as fill and line. Setting
these properties overrides any value set at the series level.
"""
dPt = self._ser.get_or_add_dPt_for_point(self._... | python | {
"resource": ""
} |
q20267 | CT_GroupShape.recalculate_extents | train | def recalculate_extents(self):
"""Adjust x, y, cx, and cy to incorporate all contained shapes.
This would typically be called when a contained shape is added,
removed, or its position or size updated.
This method is recursive "upwards" since a change in a group shape
can change... | python | {
"resource": ""
} |
q20268 | CT_GroupShape._next_shape_id | train | def _next_shape_id(self):
"""Return unique shape id suitable for use with a new shape element.
The returned id is the next available positive integer drawing object
id in shape tree, starting from 1 and making use of any gaps in
numbering. In practice, the minimum id is 2 because the sp... | python | {
"resource": ""
} |
q20269 | CT_PlotArea.iter_xCharts | train | def iter_xCharts(self):
"""
Generate each xChart child element in document.
"""
plot_tags = (
qn('c:area3DChart'), qn('c:areaChart'), qn('c:bar3DChart'),
qn('c:barChart'), qn('c:bubbleChart'), qn('c:doughnutChart'),
qn('c:line3DChart'), qn('c:lineChart... | python | {
"resource": ""
} |
q20270 | LineFormat.color | train | def color(self):
"""
The |ColorFormat| instance that provides access to the color settings
for this line. Essentially a shortcut for ``line.fill.fore_color``.
As a side-effect, accessing this property causes the line fill type
to be set to ``MSO_FILL.SOLID``. If this sounds risky... | python | {
"resource": ""
} |
q20271 | GraphicFrame.chart_part | train | def chart_part(self):
"""
The |ChartPart| object containing the chart in this graphic frame.
"""
rId = self._element.chart_rId
chart_part = self.part.related_parts[rId]
return chart_part | python | {
"resource": ""
} |
q20272 | GraphicFrame.table | train | def table(self):
"""
The |Table| object contained in this graphic frame. Raises
|ValueError| if this graphic frame does not contain a table.
"""
if not self.has_table:
raise ValueError('shape does not contain a table')
tbl = self._element.graphic.graphicData.t... | python | {
"resource": ""
} |
q20273 | TextFitter._fits_inside_predicate | train | def _fits_inside_predicate(self):
"""
Return a function taking an integer point size argument that returns
|True| if the text in this fitter can be wrapped to fit entirely
within its extents when rendered at that point size.
"""
def predicate(point_size):
"""
... | python | {
"resource": ""
} |
q20274 | Categories.levels | train | def levels(self):
"""
Return a sequence of |CategoryLevel| objects representing the
hierarchy of this category collection. The sequence is empty when the
category collection is not hierarchical, that is, contains only
leaf-level categories. The levels are ordered from the leaf le... | python | {
"resource": ""
} |
q20275 | FontFiles._font_directories | train | def _font_directories(cls):
"""
Return a sequence of directory paths likely to contain fonts on the
current platform.
"""
if sys.platform.startswith('darwin'):
return cls._os_x_font_directories()
if sys.platform.startswith('win32'):
return cls._win... | python | {
"resource": ""
} |
q20276 | FontFiles._os_x_font_directories | train | def _os_x_font_directories(cls):
"""
Return a sequence of directory paths on a Mac in which fonts are
likely to be located.
"""
os_x_font_dirs = [
'/Library/Fonts',
'/Network/Library/Fonts',
'/System/Library/Fonts',
]
home = os.... | python | {
"resource": ""
} |
q20277 | CT_TableCell.is_merge_origin | train | def is_merge_origin(self):
"""True if cell is top-left in merged cell range."""
if self.gridSpan > 1 and not self.vMerge:
return True
if self.rowSpan > 1 and not self.hMerge:
return True
return False | python | {
"resource": ""
} |
q20278 | CT_TableCell.text | train | def text(self):
"""str text contained in cell"""
# ---note this shadows lxml _Element.text---
txBody = self.txBody
if txBody is None:
return ''
return '\n'.join([p.text for p in txBody.p_lst]) | python | {
"resource": ""
} |
q20279 | CT_TableCell._get_marX | train | def _get_marX(self, attr_name, default):
"""
Generalized method to get margin values.
"""
if self.tcPr is None:
return Emu(default)
return Emu(int(self.tcPr.get(attr_name, default))) | python | {
"resource": ""
} |
q20280 | TcRange.from_merge_origin | train | def from_merge_origin(cls, tc):
"""Return instance created from merge-origin tc element."""
other_tc = tc.tbl.tc(
tc.row_idx + tc.rowSpan - 1, # ---other_row_idx
tc.col_idx + tc.gridSpan - 1 # ---other_col_idx
)
return cls(tc, other_tc) | python | {
"resource": ""
} |
q20281 | TcRange.contains_merged_cell | train | def contains_merged_cell(self):
"""True if one or more cells in range are part of a merged cell."""
for tc in self.iter_tcs():
if tc.gridSpan > 1:
return True
if tc.rowSpan > 1:
return True
if tc.hMerge:
return True
... | python | {
"resource": ""
} |
q20282 | TcRange.in_same_table | train | def in_same_table(self):
"""True if both cells provided to constructor are in same table."""
if self._tc.tbl is self._other_tc.tbl:
return True
return False | python | {
"resource": ""
} |
q20283 | TcRange.move_content_to_origin | train | def move_content_to_origin(self):
"""Move all paragraphs in range to origin cell."""
tcs = list(self.iter_tcs())
origin_tc = tcs[0]
for spanned_tc in tcs[1:]:
origin_tc.append_ps_from(spanned_tc) | python | {
"resource": ""
} |
q20284 | TcRange._bottom | train | def _bottom(self):
"""Index of row following last row of range"""
_, top, _, height = self._extents
return top + height | python | {
"resource": ""
} |
q20285 | TcRange._right | train | def _right(self):
"""Index of column following the last column in range"""
left, _, width, _ = self._extents
return left + width | python | {
"resource": ""
} |
q20286 | DataLabels.font | train | def font(self):
"""
The |Font| object that provides access to the text properties for
these data labels, such as bold, italic, etc.
"""
defRPr = self._element.defRPr
font = Font(defRPr)
return font | python | {
"resource": ""
} |
q20287 | DataLabel.font | train | def font(self):
"""The |Font| object providing text formatting for this data label.
This font object is used to customize the appearance of automatically
inserted text, such as the data point value. The font applies to the
entire data label. More granular control of the appearance of cu... | python | {
"resource": ""
} |
q20288 | Legend.include_in_layout | train | def include_in_layout(self):
"""|True| if legend should be located inside plot area.
Read/write boolean specifying whether legend should be placed inside
the plot area. In many cases this will cause it to be superimposed on
the chart itself. Assigning |None| to this property causes any
... | python | {
"resource": ""
} |
q20289 | PresentationPart.notes_master_part | train | def notes_master_part(self):
"""
Return the |NotesMasterPart| object for this presentation. If the
presentation does not have a notes master, one is created from
a default template. The same single instance is returned on each
call.
"""
try:
return sel... | python | {
"resource": ""
} |
q20290 | Movie.poster_frame | train | def poster_frame(self):
"""Return |Image| object containing poster frame for this movie.
Returns |None| if this movie has no poster frame (uncommon).
"""
slide_part, rId = self.part, self._element.blip_rId
if rId is None:
return None
return slide_part.get_ima... | python | {
"resource": ""
} |
q20291 | Picture.auto_shape_type | train | def auto_shape_type(self):
"""Member of MSO_SHAPE indicating masking shape.
A picture can be masked by any of the so-called "auto-shapes"
available in PowerPoint, such as an ellipse or triangle. When
a picture is masked by a shape, the shape assumes the same dimensions
as the pi... | python | {
"resource": ""
} |
q20292 | Picture.image | train | def image(self):
"""
An |Image| object providing access to the properties and bytes of the
image in this picture shape.
"""
slide_part, rId = self.part, self._element.blip_rId
if rId is None:
raise ValueError('no embedded image')
return slide_part.get_... | python | {
"resource": ""
} |
q20293 | _BaseSeries.name | train | def name(self):
"""
The string label given to this series, appears as the title of the
column for this series in the Excel worksheet. It also appears as the
label for this series in the legend.
"""
names = self._element.xpath('./c:tx//c:pt/c:v/text()')
name = name... | python | {
"resource": ""
} |
q20294 | _BaseCategorySeries.values | train | def values(self):
"""
Read-only. A sequence containing the float values for this series, in
the order they appear on the chart.
"""
def iter_values():
val = self._element.val
if val is None:
return
for idx in range(val.ptCount_v... | python | {
"resource": ""
} |
q20295 | TextFrame.clear | train | def clear(self):
"""
Remove all paragraphs except one empty one.
"""
for p in self._txBody.p_lst[1:]:
self._txBody.remove(p)
p = self.paragraphs[0]
p.clear() | python | {
"resource": ""
} |
q20296 | TextFrame.fit_text | train | def fit_text(self, font_family='Calibri', max_size=18, bold=False,
italic=False, font_file=None):
"""Fit text-frame text entirely within bounds of its shape.
Make the text in this text frame fit entirely within the bounds of
its shape by setting word wrap on and applying the "b... | python | {
"resource": ""
} |
q20297 | TextFrame.paragraphs | train | def paragraphs(self):
"""
Immutable sequence of |_Paragraph| instances corresponding to the
paragraphs in this text frame. A text frame always contains at least
one paragraph.
"""
return tuple([_Paragraph(p, self) for p in self._txBody.p_lst]) | python | {
"resource": ""
} |
q20298 | TextFrame.word_wrap | train | def word_wrap(self):
"""
Read-write setting determining whether lines of text in this shape
are wrapped to fit within the shape's width. Valid values are True,
False, or None. True and False turn word wrap on and off,
respectively. Assigning None to word wrap causes any word wrap... | python | {
"resource": ""
} |
q20299 | _Paragraph.clear | train | def clear(self):
"""
Remove all content from this paragraph. Paragraph properties are
preserved. Content includes runs, line breaks, and fields.
"""
for elm in self._element.content_children:
self._element.remove(elm)
return self | python | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.