code stringlengths 66 870k | docstring stringlengths 19 26.7k | func_name stringlengths 1 138 | language stringclasses 1
value | repo stringlengths 7 68 | path stringlengths 5 324 | url stringlengths 46 389 | license stringclasses 7
values |
|---|---|---|---|---|---|---|---|
def gap_width(self):
"""
Width of gap between bar(s) of each category, as an integer
percentage of the bar width. The default value for a new bar chart is
150, representing 150% or 1.5 times the width of a single bar.
"""
gapWidth = self._element.gapWidth
if gapWi... |
Width of gap between bar(s) of each category, as an integer
percentage of the bar width. The default value for a new bar chart is
150, representing 150% or 1.5 times the width of a single bar.
| gap_width | python | scanny/python-pptx | src/pptx/chart/plot.py | https://github.com/scanny/python-pptx/blob/master/src/pptx/chart/plot.py | MIT |
def overlap(self):
"""
Read/write int value in range -100..100 specifying a percentage of
the bar width by which to overlap adjacent bars in a multi-series bar
chart. Default is 0. A setting of -100 creates a gap of a full bar
width and a setting of 100 causes all the bars in a c... |
Read/write int value in range -100..100 specifying a percentage of
the bar width by which to overlap adjacent bars in a multi-series bar
chart. Default is 0. A setting of -100 creates a gap of a full bar
width and a setting of 100 causes all the bars in a category to be
superimp... | overlap | python | scanny/python-pptx | src/pptx/chart/plot.py | https://github.com/scanny/python-pptx/blob/master/src/pptx/chart/plot.py | MIT |
def overlap(self, value):
"""
Set the value of the ``<c:overlap>`` child element to *int_value*,
or remove the overlap element if *int_value* is 0.
"""
if value == 0:
self._element._remove_overlap()
return
self._element.get_or_add_overlap().val = v... |
Set the value of the ``<c:overlap>`` child element to *int_value*,
or remove the overlap element if *int_value* is 0.
| overlap | python | scanny/python-pptx | src/pptx/chart/plot.py | https://github.com/scanny/python-pptx/blob/master/src/pptx/chart/plot.py | MIT |
def bubble_scale(self):
"""
An integer between 0 and 300 inclusive indicating the percentage of
the default size at which bubbles should be displayed. Assigning
|None| produces the same behavior as assigning `100`.
"""
bubbleScale = self._element.bubbleScale
if bu... |
An integer between 0 and 300 inclusive indicating the percentage of
the default size at which bubbles should be displayed. Assigning
|None| produces the same behavior as assigning `100`.
| bubble_scale | python | scanny/python-pptx | src/pptx/chart/plot.py | https://github.com/scanny/python-pptx/blob/master/src/pptx/chart/plot.py | MIT |
def PlotFactory(xChart, chart):
"""
Return an instance of the appropriate subclass of _BasePlot based on the
tagname of *xChart*.
"""
try:
PlotCls = {
qn("c:areaChart"): AreaPlot,
qn("c:area3DChart"): Area3DPlot,
qn("c:barChart"): BarPlot,
qn("... |
Return an instance of the appropriate subclass of _BasePlot based on the
tagname of *xChart*.
| PlotFactory | python | scanny/python-pptx | src/pptx/chart/plot.py | https://github.com/scanny/python-pptx/blob/master/src/pptx/chart/plot.py | MIT |
def chart_type(cls, plot):
"""
Return the member of :ref:`XlChartType` that corresponds to the chart
type of *plot*.
"""
try:
chart_type_method = {
"AreaPlot": cls._differentiate_area_chart_type,
"Area3DPlot": cls._differentiate_area_3d... |
Return the member of :ref:`XlChartType` that corresponds to the chart
type of *plot*.
| chart_type | python | scanny/python-pptx | src/pptx/chart/plot.py | https://github.com/scanny/python-pptx/blob/master/src/pptx/chart/plot.py | MIT |
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... |
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.
| name | python | scanny/python-pptx | src/pptx/chart/series.py | https://github.com/scanny/python-pptx/blob/master/src/pptx/chart/series.py | MIT |
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_... |
Read-only. A sequence containing the float values for this series, in
the order they appear on the chart.
| values | python | scanny/python-pptx | src/pptx/chart/series.py | https://github.com/scanny/python-pptx/blob/master/src/pptx/chart/series.py | MIT |
def invert_if_negative(self):
"""
|True| if a point having a value less than zero should appear with a
fill different than those with a positive value. |False| if the fill
should be the same regardless of the bar's value. When |True|, a bar
with a solid fill appears with white fi... |
|True| if a point having a value less than zero should appear with a
fill different than those with a positive value. |False| if the fill
should be the same regardless of the bar's value. When |True|, a bar
with a solid fill appears with white fill; in a bar with gradient
fill, ... | invert_if_negative | python | scanny/python-pptx | src/pptx/chart/series.py | https://github.com/scanny/python-pptx/blob/master/src/pptx/chart/series.py | MIT |
def smooth(self):
"""
Read/write boolean specifying whether to use curve smoothing to
form the line connecting the data points in this series into
a continuous curve. If |False|, a series of straight line segments
are used to connect the points.
"""
smooth = self.... |
Read/write boolean specifying whether to use curve smoothing to
form the line connecting the data points in this series into
a continuous curve. If |False|, a series of straight line segments
are used to connect the points.
| smooth | python | scanny/python-pptx | src/pptx/chart/series.py | https://github.com/scanny/python-pptx/blob/master/src/pptx/chart/series.py | MIT |
def iter_values(self):
"""
Generate each float Y value in this series, in the order they appear
on the chart. A value of `None` represents a missing Y value
(corresponding to a blank Excel cell).
"""
yVal = self._element.yVal
if yVal is None:
return
... |
Generate each float Y value in this series, in the order they appear
on the chart. A value of `None` represents a missing Y value
(corresponding to a blank Excel cell).
| iter_values | python | scanny/python-pptx | src/pptx/chart/series.py | https://github.com/scanny/python-pptx/blob/master/src/pptx/chart/series.py | MIT |
def _SeriesFactory(ser):
"""
Return an instance of the appropriate subclass of _BaseSeries based on the
xChart element *ser* appears in.
"""
xChart_tag = ser.getparent().tag
try:
SeriesCls = {
qn("c:areaChart"): AreaSeries,
qn("c:barChart"): BarSeries,
... |
Return an instance of the appropriate subclass of _BaseSeries based on the
xChart element *ser* appears in.
| _SeriesFactory | python | scanny/python-pptx | src/pptx/chart/series.py | https://github.com/scanny/python-pptx/blob/master/src/pptx/chart/series.py | MIT |
def _open_worksheet(self, xlsx_file):
"""
Enable XlsxWriter Worksheet object to be opened, operated on, and
then automatically closed within a `with` statement. A filename or
stream object (such as an `io.BytesIO` instance) is expected as
*xlsx_file*.
"""
workbook... |
Enable XlsxWriter Worksheet object to be opened, operated on, and
then automatically closed within a `with` statement. A filename or
stream object (such as an `io.BytesIO` instance) is expected as
*xlsx_file*.
| _open_worksheet | python | scanny/python-pptx | src/pptx/chart/xlsx.py | https://github.com/scanny/python-pptx/blob/master/src/pptx/chart/xlsx.py | MIT |
def categories_ref(self):
"""
The Excel worksheet reference to the categories for this chart (not
including the column heading).
"""
categories = self._chart_data.categories
if categories.depth == 0:
raise ValueError("chart data contains no categories")
... |
The Excel worksheet reference to the categories for this chart (not
including the column heading).
| categories_ref | python | scanny/python-pptx | src/pptx/chart/xlsx.py | https://github.com/scanny/python-pptx/blob/master/src/pptx/chart/xlsx.py | MIT |
def values_ref(self, series):
"""
The Excel worksheet reference to the values for this series (not
including the column heading).
"""
return "Sheet1!${col_letter}$2:${col_letter}${bottom_row}".format(
**{
"col_letter": self._series_col_letter(series),
... |
The Excel worksheet reference to the values for this series (not
including the column heading).
| values_ref | python | scanny/python-pptx | src/pptx/chart/xlsx.py | https://github.com/scanny/python-pptx/blob/master/src/pptx/chart/xlsx.py | MIT |
def _column_reference(column_number):
"""Return str Excel column reference like 'BQ' for *column_number*.
*column_number* is an int in the range 1-16384 inclusive, where
1 maps to column 'A'.
"""
if column_number < 1 or column_number > 16384:
raise ValueError("column... | Return str Excel column reference like 'BQ' for *column_number*.
*column_number* is an int in the range 1-16384 inclusive, where
1 maps to column 'A'.
| _column_reference | python | scanny/python-pptx | src/pptx/chart/xlsx.py | https://github.com/scanny/python-pptx/blob/master/src/pptx/chart/xlsx.py | MIT |
def _write_categories(self, workbook, worksheet):
"""
Write the categories column(s) to *worksheet*. Categories start in
the first column starting in the second row, and proceeding one
column per category level (for charts having multi-level categories).
A date category is format... |
Write the categories column(s) to *worksheet*. Categories start in
the first column starting in the second row, and proceeding one
column per category level (for charts having multi-level categories).
A date category is formatted as a date. All others are formatted
`General`.
... | _write_categories | python | scanny/python-pptx | src/pptx/chart/xlsx.py | https://github.com/scanny/python-pptx/blob/master/src/pptx/chart/xlsx.py | MIT |
def _write_cat_column(self, worksheet, col, level, num_format):
"""
Write a category column defined by *level* to *worksheet* at offset
*col* and formatted with *num_format*.
"""
worksheet.set_column(col, col, 10) # wide enough for a date
for off, name in level:
... |
Write a category column defined by *level* to *worksheet* at offset
*col* and formatted with *num_format*.
| _write_cat_column | python | scanny/python-pptx | src/pptx/chart/xlsx.py | https://github.com/scanny/python-pptx/blob/master/src/pptx/chart/xlsx.py | MIT |
def _write_series(self, workbook, worksheet):
"""
Write the series column(s) to *worksheet*. Series start in the column
following the last categories column, placing the series title in the
first cell.
"""
col_offset = self._chart_data.categories.depth
for idx, se... |
Write the series column(s) to *worksheet*. Series start in the column
following the last categories column, placing the series title in the
first cell.
| _write_series | python | scanny/python-pptx | src/pptx/chart/xlsx.py | https://github.com/scanny/python-pptx/blob/master/src/pptx/chart/xlsx.py | MIT |
def series_name_ref(self, series):
"""
Return the Excel worksheet reference to the cell containing the name
for *series*. This also serves as the column heading for the series
Y values.
"""
row = self.series_table_row_offset(series) + 1
return "Sheet1!$B$%d" % row |
Return the Excel worksheet reference to the cell containing the name
for *series*. This also serves as the column heading for the series
Y values.
| series_name_ref | python | scanny/python-pptx | src/pptx/chart/xlsx.py | https://github.com/scanny/python-pptx/blob/master/src/pptx/chart/xlsx.py | MIT |
def series_table_row_offset(self, series):
"""
Return the number of rows preceding the data table for *series* in
the Excel worksheet.
"""
title_and_spacer_rows = series.index * 2
data_point_rows = series.data_point_offset
return title_and_spacer_rows + data_point... |
Return the number of rows preceding the data table for *series* in
the Excel worksheet.
| series_table_row_offset | python | scanny/python-pptx | src/pptx/chart/xlsx.py | https://github.com/scanny/python-pptx/blob/master/src/pptx/chart/xlsx.py | MIT |
def x_values_ref(self, series):
"""
The Excel worksheet reference to the X values for this chart (not
including the column label).
"""
top_row = self.series_table_row_offset(series) + 2
bottom_row = top_row + len(series) - 1
return "Sheet1!$A$%d:$A$%d" % (top_row,... |
The Excel worksheet reference to the X values for this chart (not
including the column label).
| x_values_ref | python | scanny/python-pptx | src/pptx/chart/xlsx.py | https://github.com/scanny/python-pptx/blob/master/src/pptx/chart/xlsx.py | MIT |
def y_values_ref(self, series):
"""
The Excel worksheet reference to the Y values for this chart (not
including the column label).
"""
top_row = self.series_table_row_offset(series) + 2
bottom_row = top_row + len(series) - 1
return "Sheet1!$B$%d:$B$%d" % (top_row,... |
The Excel worksheet reference to the Y values for this chart (not
including the column label).
| y_values_ref | python | scanny/python-pptx | src/pptx/chart/xlsx.py | https://github.com/scanny/python-pptx/blob/master/src/pptx/chart/xlsx.py | MIT |
def _populate_worksheet(self, workbook, worksheet):
"""
Write chart data contents to *worksheet* in the standard XY chart
layout. Write the data for each series to a separate two-column
table, X values in column A and Y values in column B. Place the
series label in the first (hea... |
Write chart data contents to *worksheet* in the standard XY chart
layout. Write the data for each series to a separate two-column
table, X values in column A and Y values in column B. Place the
series label in the first (heading) cell of the column.
| _populate_worksheet | python | scanny/python-pptx | src/pptx/chart/xlsx.py | https://github.com/scanny/python-pptx/blob/master/src/pptx/chart/xlsx.py | MIT |
def bubble_sizes_ref(self, series):
"""
The Excel worksheet reference to the range containing the bubble
sizes for *series* (not including the column heading cell).
"""
top_row = self.series_table_row_offset(series) + 2
bottom_row = top_row + len(series) - 1
retur... |
The Excel worksheet reference to the range containing the bubble
sizes for *series* (not including the column heading cell).
| bubble_sizes_ref | python | scanny/python-pptx | src/pptx/chart/xlsx.py | https://github.com/scanny/python-pptx/blob/master/src/pptx/chart/xlsx.py | MIT |
def _populate_worksheet(self, workbook, worksheet):
"""
Write chart data contents to *worksheet* in the bubble chart layout.
Write the data for each series to a separate three-column table with
X values in column A, Y values in column B, and bubble sizes in
column C. Place the se... |
Write chart data contents to *worksheet* in the bubble chart layout.
Write the data for each series to a separate three-column table with
X values in column A, Y values in column B, and bubble sizes in
column C. Place the series label in the first (heading) cell of the
values co... | _populate_worksheet | python | scanny/python-pptx | src/pptx/chart/xlsx.py | https://github.com/scanny/python-pptx/blob/master/src/pptx/chart/xlsx.py | MIT |
def ChartXmlWriter(chart_type, chart_data):
"""
Factory function returning appropriate XML writer object for
*chart_type*, loaded with *chart_type* and *chart_data*.
"""
XL_CT = XL_CHART_TYPE
try:
BuilderCls = {
XL_CT.AREA: _AreaChartXmlWriter,
XL_CT.AREA_STACKED:... |
Factory function returning appropriate XML writer object for
*chart_type*, loaded with *chart_type* and *chart_data*.
| ChartXmlWriter | python | scanny/python-pptx | src/pptx/chart/xmlwriter.py | https://github.com/scanny/python-pptx/blob/master/src/pptx/chart/xmlwriter.py | MIT |
def numRef_xml(self, wksht_ref, number_format, values):
"""
Return the ``<c:numRef>`` element specified by the parameters as
unicode text.
"""
pt_xml = self.pt_xml(values)
return (
" <c:numRef>\n"
" <c:f>{wksht_ref}</c:f>\n"... |
Return the ``<c:numRef>`` element specified by the parameters as
unicode text.
| numRef_xml | python | scanny/python-pptx | src/pptx/chart/xmlwriter.py | https://github.com/scanny/python-pptx/blob/master/src/pptx/chart/xmlwriter.py | MIT |
def pt_xml(self, values):
"""
Return the ``<c:ptCount>`` and sequence of ``<c:pt>`` elements
corresponding to *values* as a single unicode text string.
`c:ptCount` refers to the number of `c:pt` elements in this sequence.
The `idx` attribute value for `c:pt` elements locates the ... |
Return the ``<c:ptCount>`` and sequence of ``<c:pt>`` elements
corresponding to *values* as a single unicode text string.
`c:ptCount` refers to the number of `c:pt` elements in this sequence.
The `idx` attribute value for `c:pt` elements locates the data point
in the overall dat... | pt_xml | python | scanny/python-pptx | src/pptx/chart/xmlwriter.py | https://github.com/scanny/python-pptx/blob/master/src/pptx/chart/xmlwriter.py | MIT |
def tx(self):
"""
Return a ``<c:tx>`` oxml element for this series, containing the
series name.
"""
xml = self._tx_tmpl.format(
**{
"wksht_ref": self._series.name_ref,
"series_name": self.name,
"nsdecls": " %s" % nsdecls... |
Return a ``<c:tx>`` oxml element for this series, containing the
series name.
| tx | python | scanny/python-pptx | src/pptx/chart/xmlwriter.py | https://github.com/scanny/python-pptx/blob/master/src/pptx/chart/xmlwriter.py | MIT |
def tx_xml(self):
"""
Return the ``<c:tx>`` (tx is short for 'text') element for this
series as unicode text. This element contains the series name.
"""
return self._tx_tmpl.format(
**{
"wksht_ref": self._series.name_ref,
"series_name":... |
Return the ``<c:tx>`` (tx is short for 'text') element for this
series as unicode text. This element contains the series name.
| tx_xml | python | scanny/python-pptx | src/pptx/chart/xmlwriter.py | https://github.com/scanny/python-pptx/blob/master/src/pptx/chart/xmlwriter.py | MIT |
def _tx_tmpl(self):
"""
The string formatting template for the ``<c:tx>`` element for this
series, containing the series title and spreadsheet range reference.
"""
return (
" <c:tx{nsdecls}>\n"
" <c:strRef>\n"
" ... |
The string formatting template for the ``<c:tx>`` element for this
series, containing the series title and spreadsheet range reference.
| _tx_tmpl | python | scanny/python-pptx | src/pptx/chart/xmlwriter.py | https://github.com/scanny/python-pptx/blob/master/src/pptx/chart/xmlwriter.py | MIT |
def replace_series_data(self, chartSpace):
"""
Rewrite the series data under *chartSpace* using the chart data
contents. All series-level formatting is left undisturbed. If
the chart data contains fewer series than *chartSpace*, the extra
series in *chartSpace* are deleted. If *c... |
Rewrite the series data under *chartSpace* using the chart data
contents. All series-level formatting is left undisturbed. If
the chart data contains fewer series than *chartSpace*, the extra
series in *chartSpace* are deleted. If *chart_data* contains more
series than the *char... | replace_series_data | python | scanny/python-pptx | src/pptx/chart/xmlwriter.py | https://github.com/scanny/python-pptx/blob/master/src/pptx/chart/xmlwriter.py | MIT |
def _add_cloned_sers(self, plotArea, count):
"""
Add `c:ser` elements to the last xChart element in *plotArea*, cloned
from the last `c:ser` child of that last xChart.
"""
def clone_ser(ser):
new_ser = deepcopy(ser)
new_ser.idx.val = plotArea.next_idx
... |
Add `c:ser` elements to the last xChart element in *plotArea*, cloned
from the last `c:ser` child of that last xChart.
| _add_cloned_sers | python | scanny/python-pptx | src/pptx/chart/xmlwriter.py | https://github.com/scanny/python-pptx/blob/master/src/pptx/chart/xmlwriter.py | MIT |
def _adjust_ser_count(self, plotArea, new_ser_count):
"""
Adjust the number of c:ser elements in *plotArea* to *new_ser_count*.
Excess c:ser elements are deleted from the end, along with any xChart
elements that are left empty as a result. Series elements are
considered in xChart... |
Adjust the number of c:ser elements in *plotArea* to *new_ser_count*.
Excess c:ser elements are deleted from the end, along with any xChart
elements that are left empty as a result. Series elements are
considered in xChart + series order. Any new c:ser elements required
are adde... | _adjust_ser_count | python | scanny/python-pptx | src/pptx/chart/xmlwriter.py | https://github.com/scanny/python-pptx/blob/master/src/pptx/chart/xmlwriter.py | MIT |
def _trim_ser_count_by(self, plotArea, count):
"""
Remove the last *count* ser elements from *plotArea*. Any xChart
elements having no ser child elements after trimming are also
removed.
"""
extra_sers = plotArea.sers[-count:]
for ser in extra_sers:
pa... |
Remove the last *count* ser elements from *plotArea*. Any xChart
elements having no ser child elements after trimming are also
removed.
| _trim_ser_count_by | python | scanny/python-pptx | src/pptx/chart/xmlwriter.py | https://github.com/scanny/python-pptx/blob/master/src/pptx/chart/xmlwriter.py | MIT |
def cat(self):
"""
Return the ``<c:cat>`` element XML for this series, as an oxml
element.
"""
categories = self._series.categories
if categories.are_numeric:
return parse_xml(
self._numRef_cat_tmpl.format(
**{
... |
Return the ``<c:cat>`` element XML for this series, as an oxml
element.
| cat | python | scanny/python-pptx | src/pptx/chart/xmlwriter.py | https://github.com/scanny/python-pptx/blob/master/src/pptx/chart/xmlwriter.py | MIT |
def cat_xml(self):
"""
The unicode XML snippet for the ``<c:cat>`` element for this series,
containing the category labels and spreadsheet reference.
"""
categories = self._series.categories
if categories.are_numeric:
return self._numRef_cat_tmpl.format(
... |
The unicode XML snippet for the ``<c:cat>`` element for this series,
containing the category labels and spreadsheet reference.
| cat_xml | python | scanny/python-pptx | src/pptx/chart/xmlwriter.py | https://github.com/scanny/python-pptx/blob/master/src/pptx/chart/xmlwriter.py | MIT |
def val(self):
"""
The ``<c:val>`` XML for this series, as an oxml element.
"""
xml = self._val_tmpl.format(
**{
"nsdecls": " %s" % nsdecls("c"),
"values_ref": self._series.values_ref,
"number_format": self._series.number_format... |
The ``<c:val>`` XML for this series, as an oxml element.
| val | python | scanny/python-pptx | src/pptx/chart/xmlwriter.py | https://github.com/scanny/python-pptx/blob/master/src/pptx/chart/xmlwriter.py | MIT |
def val_xml(self):
"""
Return the unicode XML snippet for the ``<c:val>`` element describing
this series, containing the series values and their spreadsheet range
reference.
"""
return self._val_tmpl.format(
**{
"nsdecls": "",
"... |
Return the unicode XML snippet for the ``<c:val>`` element describing
this series, containing the series values and their spreadsheet range
reference.
| val_xml | python | scanny/python-pptx | src/pptx/chart/xmlwriter.py | https://github.com/scanny/python-pptx/blob/master/src/pptx/chart/xmlwriter.py | MIT |
def _cat_num_pt_xml(self):
"""
The unicode XML snippet for the ``<c:pt>`` elements when category
labels are numeric (including date type).
"""
xml = ""
for idx, category in enumerate(self._series.categories):
xml += (
' <c:pt idx... |
The unicode XML snippet for the ``<c:pt>`` elements when category
labels are numeric (including date type).
| _cat_num_pt_xml | python | scanny/python-pptx | src/pptx/chart/xmlwriter.py | https://github.com/scanny/python-pptx/blob/master/src/pptx/chart/xmlwriter.py | MIT |
def _cat_pt_xml(self):
"""
The unicode XML snippet for the ``<c:pt>`` elements containing the
category names for this series.
"""
xml = ""
for idx, category in enumerate(self._series.categories):
xml += (
' <c:pt idx="{cat_idx}">... |
The unicode XML snippet for the ``<c:pt>`` elements containing the
category names for this series.
| _cat_pt_xml | python | scanny/python-pptx | src/pptx/chart/xmlwriter.py | https://github.com/scanny/python-pptx/blob/master/src/pptx/chart/xmlwriter.py | MIT |
def _cat_tmpl(self):
"""
The template for the ``<c:cat>`` element for this series, containing
the category labels and spreadsheet reference.
"""
return (
" <c:cat{nsdecls}>\n"
" <c:strRef>\n"
" <c:f>{wksht_ref}<... |
The template for the ``<c:cat>`` element for this series, containing
the category labels and spreadsheet reference.
| _cat_tmpl | python | scanny/python-pptx | src/pptx/chart/xmlwriter.py | https://github.com/scanny/python-pptx/blob/master/src/pptx/chart/xmlwriter.py | MIT |
def _lvl_xml(self, categories):
"""
The unicode XML snippet for the ``<c:lvl>`` elements containing
multi-level category names.
"""
def lvl_pt_xml(level):
xml = ""
for idx, name in level:
xml += (
' <c:... |
The unicode XML snippet for the ``<c:lvl>`` elements containing
multi-level category names.
| _lvl_xml | python | scanny/python-pptx | src/pptx/chart/xmlwriter.py | https://github.com/scanny/python-pptx/blob/master/src/pptx/chart/xmlwriter.py | MIT |
def _multiLvl_cat_tmpl(self):
"""
The template for the ``<c:cat>`` element for this series when there
are multi-level (nested) categories.
"""
return (
" <c:cat{nsdecls}>\n"
" <c:multiLvlStrRef>\n"
" <c:f>{wksht... |
The template for the ``<c:cat>`` element for this series when there
are multi-level (nested) categories.
| _multiLvl_cat_tmpl | python | scanny/python-pptx | src/pptx/chart/xmlwriter.py | https://github.com/scanny/python-pptx/blob/master/src/pptx/chart/xmlwriter.py | MIT |
def _numRef_cat_tmpl(self):
"""
The template for the ``<c:cat>`` element for this series when the
labels are numeric (or date) values.
"""
return (
" <c:cat{nsdecls}>\n"
" <c:numRef>\n"
" <c:f>{wksht_ref}</c:f>\... |
The template for the ``<c:cat>`` element for this series when the
labels are numeric (or date) values.
| _numRef_cat_tmpl | python | scanny/python-pptx | src/pptx/chart/xmlwriter.py | https://github.com/scanny/python-pptx/blob/master/src/pptx/chart/xmlwriter.py | MIT |
def _val_pt_xml(self):
"""
The unicode XML snippet containing the ``<c:pt>`` elements containing
the values for this series.
"""
xml = ""
for idx, value in enumerate(self._series.values):
if value is None:
continue
xml += (
... |
The unicode XML snippet containing the ``<c:pt>`` elements containing
the values for this series.
| _val_pt_xml | python | scanny/python-pptx | src/pptx/chart/xmlwriter.py | https://github.com/scanny/python-pptx/blob/master/src/pptx/chart/xmlwriter.py | MIT |
def _val_tmpl(self):
"""
The template for the ``<c:val>`` element for this series, containing
the series values and their spreadsheet range reference.
"""
return (
" <c:val{nsdecls}>\n"
" <c:numRef>\n"
" <c:f>{v... |
The template for the ``<c:val>`` element for this series, containing
the series values and their spreadsheet range reference.
| _val_tmpl | python | scanny/python-pptx | src/pptx/chart/xmlwriter.py | https://github.com/scanny/python-pptx/blob/master/src/pptx/chart/xmlwriter.py | MIT |
def xVal(self):
"""
Return the ``<c:xVal>`` element for this series as an oxml element.
This element contains the X values for this series.
"""
xml = self._xVal_tmpl.format(
**{
"nsdecls": " %s" % nsdecls("c"),
"numRef_xml": self.numRef... |
Return the ``<c:xVal>`` element for this series as an oxml element.
This element contains the X values for this series.
| xVal | python | scanny/python-pptx | src/pptx/chart/xmlwriter.py | https://github.com/scanny/python-pptx/blob/master/src/pptx/chart/xmlwriter.py | MIT |
def xVal_xml(self):
"""
Return the ``<c:xVal>`` element for this series as unicode text. This
element contains the X values for this series.
"""
return self._xVal_tmpl.format(
**{
"nsdecls": "",
"numRef_xml": self.numRef_xml(
... |
Return the ``<c:xVal>`` element for this series as unicode text. This
element contains the X values for this series.
| xVal_xml | python | scanny/python-pptx | src/pptx/chart/xmlwriter.py | https://github.com/scanny/python-pptx/blob/master/src/pptx/chart/xmlwriter.py | MIT |
def yVal(self):
"""
Return the ``<c:yVal>`` element for this series as an oxml element.
This element contains the Y values for this series.
"""
xml = self._yVal_tmpl.format(
**{
"nsdecls": " %s" % nsdecls("c"),
"numRef_xml": self.numRef... |
Return the ``<c:yVal>`` element for this series as an oxml element.
This element contains the Y values for this series.
| yVal | python | scanny/python-pptx | src/pptx/chart/xmlwriter.py | https://github.com/scanny/python-pptx/blob/master/src/pptx/chart/xmlwriter.py | MIT |
def yVal_xml(self):
"""
Return the ``<c:yVal>`` element for this series as unicode text. This
element contains the Y values for this series.
"""
return self._yVal_tmpl.format(
**{
"nsdecls": "",
"numRef_xml": self.numRef_xml(
... |
Return the ``<c:yVal>`` element for this series as unicode text. This
element contains the Y values for this series.
| yVal_xml | python | scanny/python-pptx | src/pptx/chart/xmlwriter.py | https://github.com/scanny/python-pptx/blob/master/src/pptx/chart/xmlwriter.py | MIT |
def bubbleSize(self):
"""
Return the ``<c:bubbleSize>`` element for this series as an oxml
element. This element contains the bubble size values for this
series.
"""
xml = self._bubbleSize_tmpl.format(
**{
"nsdecls": " %s" % nsdecls("c"),
... |
Return the ``<c:bubbleSize>`` element for this series as an oxml
element. This element contains the bubble size values for this
series.
| bubbleSize | python | scanny/python-pptx | src/pptx/chart/xmlwriter.py | https://github.com/scanny/python-pptx/blob/master/src/pptx/chart/xmlwriter.py | MIT |
def bubbleSize_xml(self):
"""
Return the ``<c:bubbleSize>`` element for this series as unicode
text. This element contains the bubble size values for all the
data points in the chart.
"""
return self._bubbleSize_tmpl.format(
**{
"nsdecls": "",
... |
Return the ``<c:bubbleSize>`` element for this series as unicode
text. This element contains the bubble size values for all the
data points in the chart.
| bubbleSize_xml | python | scanny/python-pptx | src/pptx/chart/xmlwriter.py | https://github.com/scanny/python-pptx/blob/master/src/pptx/chart/xmlwriter.py | MIT |
def _rewrite_ser_data(self, ser, series_data, date_1904):
"""
Rewrite the ``<c:tx>``, ``<c:cat>`` and ``<c:val>`` child elements
of *ser* based on the values in *series_data*.
"""
ser._remove_tx()
ser._remove_xVal()
ser._remove_yVal()
ser._remove_bubbleSiz... |
Rewrite the ``<c:tx>``, ``<c:cat>`` and ``<c:val>`` child elements
of *ser* based on the values in *series_data*.
| _rewrite_ser_data | python | scanny/python-pptx | src/pptx/chart/xmlwriter.py | https://github.com/scanny/python-pptx/blob/master/src/pptx/chart/xmlwriter.py | MIT |
def _rewrite_ser_data(self, ser, series_data, date_1904):
"""
Rewrite the ``<c:tx>``, ``<c:cat>`` and ``<c:val>`` child elements
of *ser* based on the values in *series_data*.
"""
ser._remove_tx()
ser._remove_cat()
ser._remove_val()
xml_writer = _Category... |
Rewrite the ``<c:tx>``, ``<c:cat>`` and ``<c:val>`` child elements
of *ser* based on the values in *series_data*.
| _rewrite_ser_data | python | scanny/python-pptx | src/pptx/chart/xmlwriter.py | https://github.com/scanny/python-pptx/blob/master/src/pptx/chart/xmlwriter.py | MIT |
def _rewrite_ser_data(self, ser, series_data, date_1904):
"""
Rewrite the ``<c:tx>``, ``<c:xVal>`` and ``<c:yVal>`` child elements
of *ser* based on the values in *series_data*.
"""
ser._remove_tx()
ser._remove_xVal()
ser._remove_yVal()
xml_writer = _XySe... |
Rewrite the ``<c:tx>``, ``<c:xVal>`` and ``<c:yVal>`` child elements
of *ser* based on the values in *series_data*.
| _rewrite_ser_data | python | scanny/python-pptx | src/pptx/chart/xmlwriter.py | https://github.com/scanny/python-pptx/blob/master/src/pptx/chart/xmlwriter.py | MIT |
def rgb(self):
"""
Raises TypeError on access unless overridden by subclass.
"""
tmpl = "no .rgb property on color type '%s'"
raise AttributeError(tmpl % self.__class__.__name__) |
Raises TypeError on access unless overridden by subclass.
| rgb | python | scanny/python-pptx | src/pptx/dml/color.py | https://github.com/scanny/python-pptx/blob/master/src/pptx/dml/color.py | MIT |
def theme_color(self):
"""
Raise TypeError on attempt to access .theme_color when no color
choice is present.
"""
tmpl = "no .theme_color property on color type '%s'"
raise AttributeError(tmpl % self.__class__.__name__) |
Raise TypeError on attempt to access .theme_color when no color
choice is present.
| theme_color | python | scanny/python-pptx | src/pptx/dml/color.py | https://github.com/scanny/python-pptx/blob/master/src/pptx/dml/color.py | MIT |
def from_string(cls, rgb_hex_str):
"""
Return a new instance from an RGB color hex string like ``'3C2F80'``.
"""
r = int(rgb_hex_str[:2], 16)
g = int(rgb_hex_str[2:4], 16)
b = int(rgb_hex_str[4:], 16)
return cls(r, g, b) |
Return a new instance from an RGB color hex string like ``'3C2F80'``.
| from_string | python | scanny/python-pptx | src/pptx/dml/color.py | https://github.com/scanny/python-pptx/blob/master/src/pptx/dml/color.py | MIT |
def inherit(self):
"""True if shape inherits shadow settings.
Read/write. An explicitly-defined shadow setting on a shape causes
this property to return |False|. A shape with no explicitly-defined
shadow setting inherits its shadow settings from the style hierarchy
(and so retur... | True if shape inherits shadow settings.
Read/write. An explicitly-defined shadow setting on a shape causes
this property to return |False|. A shape with no explicitly-defined
shadow setting inherits its shadow settings from the style hierarchy
(and so returns |True|).
Assigning... | inherit | python | scanny/python-pptx | src/pptx/dml/effect.py | https://github.com/scanny/python-pptx/blob/master/src/pptx/dml/effect.py | MIT |
def from_fill_parent(cls, eg_fillProperties_parent: BaseOxmlElement) -> FillFormat:
"""
Return a |FillFormat| instance initialized to the settings contained
in *eg_fillProperties_parent*, which must be an element having
EG_FillProperties in its child element sequence in the XML schema.
... |
Return a |FillFormat| instance initialized to the settings contained
in *eg_fillProperties_parent*, which must be an element having
EG_FillProperties in its child element sequence in the XML schema.
| from_fill_parent | python | scanny/python-pptx | src/pptx/dml/fill.py | https://github.com/scanny/python-pptx/blob/master/src/pptx/dml/fill.py | MIT |
def background(self):
"""
Sets the fill type to noFill, i.e. transparent.
"""
noFill = self._xPr.get_or_change_to_noFill()
self._fill = _NoFill(noFill) |
Sets the fill type to noFill, i.e. transparent.
| background | python | scanny/python-pptx | src/pptx/dml/fill.py | https://github.com/scanny/python-pptx/blob/master/src/pptx/dml/fill.py | MIT |
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 ... | 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 stops. The first stop is Accent... | gradient | python | scanny/python-pptx | src/pptx/dml/fill.py | https://github.com/scanny/python-pptx/blob/master/src/pptx/dml/fill.py | MIT |
def gradient_angle(self):
"""Angle in float degrees of line of a linear gradient.
Read/Write. May be |None|, indicating the angle should be inherited
from the style hierarchy. An angle of 0.0 corresponds to
a left-to-right gradient. Increasing angles represent
counter-clockwise ... | Angle in float degrees of line of a linear gradient.
Read/Write. May be |None|, indicating the angle should be inherited
from the style hierarchy. An angle of 0.0 corresponds to
a left-to-right gradient. Increasing angles represent
counter-clockwise rotation of the line, for example 90.... | gradient_angle | python | scanny/python-pptx | src/pptx/dml/fill.py | https://github.com/scanny/python-pptx/blob/master/src/pptx/dml/fill.py | MIT |
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 != ... | |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.
| gradient_stops | python | scanny/python-pptx | src/pptx/dml/fill.py | https://github.com/scanny/python-pptx/blob/master/src/pptx/dml/fill.py | MIT |
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.
"""
... | 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.
| patterned | python | scanny/python-pptx | src/pptx/dml/fill.py | https://github.com/scanny/python-pptx/blob/master/src/pptx/dml/fill.py | MIT |
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.
... |
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.
| solid | python | scanny/python-pptx | src/pptx/dml/fill.py | https://github.com/scanny/python-pptx/blob/master/src/pptx/dml/fill.py | MIT |
def back_color(self):
"""Raise TypeError for types that do not override this property."""
tmpl = "fill type %s has no background color, call .patterned() first"
raise TypeError(tmpl % self.__class__.__name__) | Raise TypeError for types that do not override this property. | back_color | python | scanny/python-pptx | src/pptx/dml/fill.py | https://github.com/scanny/python-pptx/blob/master/src/pptx/dml/fill.py | MIT |
def fore_color(self):
"""Raise TypeError for types that do not override this property."""
tmpl = "fill type %s has no foreground color, call .solid() or .pattern" "ed() first"
raise TypeError(tmpl % self.__class__.__name__) | Raise TypeError for types that do not override this property. | fore_color | python | scanny/python-pptx | src/pptx/dml/fill.py | https://github.com/scanny/python-pptx/blob/master/src/pptx/dml/fill.py | MIT |
def pattern(self):
"""Raise TypeError for fills that do not override this property."""
tmpl = "fill type %s has no pattern, call .patterned() first"
raise TypeError(tmpl % self.__class__.__name__) | Raise TypeError for fills that do not override this property. | pattern | python | scanny/python-pptx | src/pptx/dml/fill.py | https://github.com/scanny/python-pptx/blob/master/src/pptx/dml/fill.py | MIT |
def gradient_angle(self):
"""Angle in float degrees of line of a linear gradient.
Read/Write. May be |None|, indicating the angle is inherited from the
style hierarchy. An angle of 0.0 corresponds to a left-to-right
gradient. Increasing angles represent clockwise rotation of the line,
... | Angle in float degrees of line of a linear gradient.
Read/Write. May be |None|, indicating the angle is inherited from the
style hierarchy. An angle of 0.0 corresponds to a left-to-right
gradient. Increasing angles represent clockwise rotation of the line,
for example 90.0 represents a ... | gradient_angle | python | scanny/python-pptx | src/pptx/dml/fill.py | https://github.com/scanny/python-pptx/blob/master/src/pptx/dml/fill.py | MIT |
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... |
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 for your use
case, ... | color | python | scanny/python-pptx | src/pptx/dml/line.py | https://github.com/scanny/python-pptx/blob/master/src/pptx/dml/line.py | MIT |
def dash_style(self):
"""Return value indicating line style.
Returns a member of :ref:`MsoLineDashStyle` indicating line style, or
|None| if no explicit value has been set. When no explicit value has
been set, the line dash style is inherited from the style hierarchy.
Assigning... | Return value indicating line style.
Returns a member of :ref:`MsoLineDashStyle` indicating line style, or
|None| if no explicit value has been set. When no explicit value has
been set, the line dash style is inherited from the style hierarchy.
Assigning |None| removes any existing expl... | dash_style | python | scanny/python-pptx | src/pptx/dml/line.py | https://github.com/scanny/python-pptx/blob/master/src/pptx/dml/line.py | MIT |
def width(self):
"""
The width of the line expressed as an integer number of :ref:`English
Metric Units <EMU>`. The returned value is an instance of |Length|,
a value class having properties such as `.inches`, `.cm`, and `.pt`
for converting the value into convenient units.
... |
The width of the line expressed as an integer number of :ref:`English
Metric Units <EMU>`. The returned value is an instance of |Length|,
a value class having properties such as `.inches`, `.cm`, and `.pt`
for converting the value into convenient units.
| width | python | scanny/python-pptx | src/pptx/dml/line.py | https://github.com/scanny/python-pptx/blob/master/src/pptx/dml/line.py | MIT |
def from_xml(cls, xml_value: str) -> Self:
"""Enumeration member corresponding to XML attribute value `xml_value`.
Raises `ValueError` if `xml_value` is the empty string ("") or is not an XML attribute
value registered on the enumeration. Note that enum members that do not correspond to one
... | Enumeration member corresponding to XML attribute value `xml_value`.
Raises `ValueError` if `xml_value` is the empty string ("") or is not an XML attribute
value registered on the enumeration. Note that enum members that do not correspond to one
of the defined values for an XML attribute have `... | from_xml | python | scanny/python-pptx | src/pptx/enum/base.py | https://github.com/scanny/python-pptx/blob/master/src/pptx/enum/base.py | MIT |
def to_xml(cls: Type[_T], value: int | _T) -> str:
"""XML value of this enum member, generally an XML attribute value."""
# -- presence of multi-arg `__new__()` method fools type-checker, but getting a
# -- member by its value using EnumCls(val) works as usual.
member = cls(value)
... | XML value of this enum member, generally an XML attribute value. | to_xml | python | scanny/python-pptx | src/pptx/enum/base.py | https://github.com/scanny/python-pptx/blob/master/src/pptx/enum/base.py | MIT |
def validate(cls: Type[_T], value: _T):
"""Raise |ValueError| if `value` is not an assignable value."""
if value not in cls:
raise ValueError(f"{value} not a member of {cls.__name__} enumeration") | Raise |ValueError| if `value` is not an assignable value. | validate | python | scanny/python-pptx | src/pptx/enum/base.py | https://github.com/scanny/python-pptx/blob/master/src/pptx/enum/base.py | MIT |
def page_str(self):
"""
The RestructuredText documentation page for the enumeration. This is
the only API member for the class.
"""
tmpl = ".. _%s:\n\n%s\n\n%s\n\n----\n\n%s"
components = (
self._ms_name,
self._page_title,
self._intro_t... |
The RestructuredText documentation page for the enumeration. This is
the only API member for the class.
| page_str | python | scanny/python-pptx | src/pptx/enum/base.py | https://github.com/scanny/python-pptx/blob/master/src/pptx/enum/base.py | MIT |
def _intro_text(self):
"""
The docstring of the enumeration, formatted for use at the top of the
documentation page
"""
try:
cls_docstring = self._clsdict["__doc__"]
except KeyError:
cls_docstring = ""
if cls_docstring is None:
... |
The docstring of the enumeration, formatted for use at the top of the
documentation page
| _intro_text | python | scanny/python-pptx | src/pptx/enum/base.py | https://github.com/scanny/python-pptx/blob/master/src/pptx/enum/base.py | MIT |
def _member_def(self, member: BaseEnum | BaseXmlEnum):
"""Return an individual member definition formatted as an RST glossary entry.
Output is wrapped to fit within 78 columns.
"""
member_docstring = textwrap.dedent(member.__doc__ or "").strip()
member_docstring = textwrap.fill(... | Return an individual member definition formatted as an RST glossary entry.
Output is wrapped to fit within 78 columns.
| _member_def | python | scanny/python-pptx | src/pptx/enum/base.py | https://github.com/scanny/python-pptx/blob/master/src/pptx/enum/base.py | MIT |
def _member_defs(self):
"""
A single string containing the aggregated member definitions section
of the documentation page
"""
members = self._clsdict["__members__"]
member_defs = [self._member_def(member) for member in members if member.name is not None]
return "... |
A single string containing the aggregated member definitions section
of the documentation page
| _member_defs | python | scanny/python-pptx | src/pptx/enum/base.py | https://github.com/scanny/python-pptx/blob/master/src/pptx/enum/base.py | MIT |
def _page_title(self):
"""
The title for the documentation page, formatted as code (surrounded
in double-backtics) and underlined with '=' characters
"""
title_underscore = "=" * (len(self._clsname) + 4)
return "``%s``\n%s" % (self._clsname, title_underscore) |
The title for the documentation page, formatted as code (surrounded
in double-backtics) and underlined with '=' characters
| _page_title | python | scanny/python-pptx | src/pptx/enum/base.py | https://github.com/scanny/python-pptx/blob/master/src/pptx/enum/base.py | MIT |
def new(
cls, rId: str, reltype: str, target_ref: str, target_mode: str = RTM.INTERNAL
) -> CT_Relationship:
"""Return a new `<Relationship>` element.
`target_ref` is either a partname or a URI.
"""
relationship = cast(CT_Relationship, parse_xml(f'<Relationship xmlns="{nsmap... | Return a new `<Relationship>` element.
`target_ref` is either a partname or a URI.
| new | python | scanny/python-pptx | src/pptx/opc/oxml.py | https://github.com/scanny/python-pptx/blob/master/src/pptx/opc/oxml.py | MIT |
def add_rel(
self, rId: str, reltype: str, target: str, is_external: bool = False
) -> CT_Relationship:
"""Add a child `<Relationship>` element with attributes set as specified."""
target_mode = RTM.EXTERNAL if is_external else RTM.INTERNAL
relationship = CT_Relationship.new(rId, rel... | Add a child `<Relationship>` element with attributes set as specified. | add_rel | python | scanny/python-pptx | src/pptx/opc/oxml.py | https://github.com/scanny/python-pptx/blob/master/src/pptx/opc/oxml.py | MIT |
def relate_to(self, target: Part | str, reltype: str, is_external: bool = False) -> str:
"""Return rId key of relationship of `reltype` to `target`.
If such a relationship already exists, its rId is returned. Otherwise the relationship is
added and its new rId returned.
"""
if i... | Return rId key of relationship of `reltype` to `target`.
If such a relationship already exists, its rId is returned. Otherwise the relationship is
added and its new rId returned.
| relate_to | python | scanny/python-pptx | src/pptx/opc/package.py | https://github.com/scanny/python-pptx/blob/master/src/pptx/opc/package.py | MIT |
def _rels(self) -> _Relationships:
"""|_Relationships| object containing relationships from this part to others."""
raise NotImplementedError( # pragma: no cover
"`%s` must implement `.rels`" % type(self).__name__
) | |_Relationships| object containing relationships from this part to others. | _rels | python | scanny/python-pptx | src/pptx/opc/package.py | https://github.com/scanny/python-pptx/blob/master/src/pptx/opc/package.py | MIT |
def iter_parts(self) -> Iterator[Part]:
"""Generate exactly one reference to each part in the package."""
visited: Set[Part] = set()
for rel in self.iter_rels():
if rel.is_external:
continue
part = rel.target_part
if part in visited:
... | Generate exactly one reference to each part in the package. | iter_parts | python | scanny/python-pptx | src/pptx/opc/package.py | https://github.com/scanny/python-pptx/blob/master/src/pptx/opc/package.py | MIT |
def iter_rels(self) -> Iterator[_Relationship]:
"""Generate exactly one reference to each relationship in package.
Performs a depth-first traversal of the rels graph.
"""
visited: Set[Part] = set()
def walk_rels(rels: _Relationships) -> Iterator[_Relationship]:
for ... | Generate exactly one reference to each relationship in package.
Performs a depth-first traversal of the rels graph.
| iter_rels | python | scanny/python-pptx | src/pptx/opc/package.py | https://github.com/scanny/python-pptx/blob/master/src/pptx/opc/package.py | MIT |
def next_partname(self, tmpl: str) -> PackURI:
"""Return |PackURI| next available partname matching `tmpl`.
`tmpl` is a printf (%)-style template string containing a single replacement item, a '%d'
to be used to insert the integer portion of the partname. Example:
'/ppt/slides/slide%d.x... | Return |PackURI| next available partname matching `tmpl`.
`tmpl` is a printf (%)-style template string containing a single replacement item, a '%d'
to be used to insert the integer portion of the partname. Example:
'/ppt/slides/slide%d.xml'
| next_partname | python | scanny/python-pptx | src/pptx/opc/package.py | https://github.com/scanny/python-pptx/blob/master/src/pptx/opc/package.py | MIT |
def _load(self) -> Self:
"""Return the package after loading all parts and relationships."""
pkg_xml_rels, parts = _PackageLoader.load(self._pkg_file, cast("Package", self))
self._rels.load_from_xml(PACKAGE_URI, pkg_xml_rels, parts)
return self | Return the package after loading all parts and relationships. | _load | python | scanny/python-pptx | src/pptx/opc/package.py | https://github.com/scanny/python-pptx/blob/master/src/pptx/opc/package.py | MIT |
def load(
cls, pkg_file: str | IO[bytes], package: Package
) -> tuple[CT_Relationships, dict[PackURI, Part]]:
"""Return (pkg_xml_rels, parts) pair resulting from loading `pkg_file`.
The returned `parts` value is a {partname: part} mapping with each part in the package
included and c... | Return (pkg_xml_rels, parts) pair resulting from loading `pkg_file`.
The returned `parts` value is a {partname: part} mapping with each part in the package
included and constructed complete with its relationships to other parts in the package.
The returned `pkg_xml_rels` value is a `CT_Relatio... | load | python | scanny/python-pptx | src/pptx/opc/package.py | https://github.com/scanny/python-pptx/blob/master/src/pptx/opc/package.py | MIT |
def _load(self) -> tuple[CT_Relationships, dict[PackURI, Part]]:
"""Return (pkg_xml_rels, parts) pair resulting from loading pkg_file."""
parts, xml_rels = self._parts, self._xml_rels
for partname, part in parts.items():
part.load_rels_from_xml(xml_rels[partname], parts)
re... | Return (pkg_xml_rels, parts) pair resulting from loading pkg_file. | _load | python | scanny/python-pptx | src/pptx/opc/package.py | https://github.com/scanny/python-pptx/blob/master/src/pptx/opc/package.py | MIT |
def _parts(self) -> dict[PackURI, Part]:
"""dict {partname: Part} populated with parts loading from package.
Among other duties, this collection is passed to each relationships collection so each
relationship can resolve a reference to its target part when required. This reference can
o... | dict {partname: Part} populated with parts loading from package.
Among other duties, this collection is passed to each relationships collection so each
relationship can resolve a reference to its target part when required. This reference can
only be reliably carried out once the all parts have ... | _parts | python | scanny/python-pptx | src/pptx/opc/package.py | https://github.com/scanny/python-pptx/blob/master/src/pptx/opc/package.py | MIT |
def _xml_rels(self) -> dict[PackURI, CT_Relationships]:
"""dict {partname: xml_rels} for package and all package parts.
This is used as the basis for other loading operations such as loading parts and
populating their relationships.
"""
xml_rels: dict[PackURI, CT_Relationships] ... | dict {partname: xml_rels} for package and all package parts.
This is used as the basis for other loading operations such as loading parts and
populating their relationships.
| _xml_rels | python | scanny/python-pptx | src/pptx/opc/package.py | https://github.com/scanny/python-pptx/blob/master/src/pptx/opc/package.py | MIT |
def load_rels(source_partname: PackURI, rels: CT_Relationships):
"""Populate `xml_rels` dict by traversing relationships depth-first."""
xml_rels[source_partname] = rels
visited_partnames.add(source_partname)
base_uri = source_partname.baseURI
# --- recursion... | Populate `xml_rels` dict by traversing relationships depth-first. | load_rels | python | scanny/python-pptx | src/pptx/opc/package.py | https://github.com/scanny/python-pptx/blob/master/src/pptx/opc/package.py | MIT |
def _xml_rels_for(self, partname: PackURI) -> CT_Relationships:
"""Return CT_Relationships object formed by parsing rels XML for `partname`.
A CT_Relationships object is returned in all cases. A part that has no relationships
receives an "empty" CT_Relationships object, i.e. containing no `CT_R... | Return CT_Relationships object formed by parsing rels XML for `partname`.
A CT_Relationships object is returned in all cases. A part that has no relationships
receives an "empty" CT_Relationships object, i.e. containing no `CT_Relationship` objects.
| _xml_rels_for | python | scanny/python-pptx | src/pptx/opc/package.py | https://github.com/scanny/python-pptx/blob/master/src/pptx/opc/package.py | MIT |
def _blob_from_file(self, file: str | IO[bytes]) -> bytes:
"""Return bytes of `file`, which is either a str path or a file-like object."""
# --- a str `file` is assumed to be a path ---
if isinstance(file, str):
with open(file, "rb") as f:
return f.read()
# -... | Return bytes of `file`, which is either a str path or a file-like object. | _blob_from_file | python | scanny/python-pptx | src/pptx/opc/package.py | https://github.com/scanny/python-pptx/blob/master/src/pptx/opc/package.py | MIT |
def load(cls, partname: PackURI, content_type: str, package: Package, blob: bytes):
"""Return instance of `cls` loaded with parsed XML from `blob`."""
return cls(
partname, content_type, package, element=cast("BaseOxmlElement", parse_xml(blob))
) | Return instance of `cls` loaded with parsed XML from `blob`. | load | python | scanny/python-pptx | src/pptx/opc/package.py | https://github.com/scanny/python-pptx/blob/master/src/pptx/opc/package.py | MIT |
def _part_cls_for(cls, content_type: str) -> type[Part]:
"""Return the custom part class registered for `content_type`.
Returns |Part| if no custom class is registered for `content_type`.
"""
if content_type in cls.part_type_for:
return cls.part_type_for[content_type]
... | Return the custom part class registered for `content_type`.
Returns |Part| if no custom class is registered for `content_type`.
| _part_cls_for | python | scanny/python-pptx | src/pptx/opc/package.py | https://github.com/scanny/python-pptx/blob/master/src/pptx/opc/package.py | MIT |
Subsets and Splits
Django Code with Docstrings
Filters Python code examples from Django repository that contain Django-related code, helping identify relevant code snippets for understanding Django framework usage patterns.
SQL Console for Shuu12121/python-treesitter-filtered-datasetsV2
Retrieves specific code examples from the Flask repository but doesn't provide meaningful analysis or patterns beyond basic data retrieval.
HTTPX Repo Code and Docstrings
Retrieves specific code examples from the httpx repository, which is useful for understanding how particular libraries are used but doesn't provide broader analytical insights about the dataset.
Requests Repo Docstrings & Code
Retrieves code examples with their docstrings and file paths from the requests repository, providing basic filtering but limited analytical value beyond finding specific code samples.
Quart Repo Docstrings & Code
Retrieves code examples with their docstrings from the Quart repository, providing basic code samples but offering limited analytical value for understanding broader patterns or relationships in the dataset.