MCPcopy
hub / github.com/jmcnamara/XlsxWriter / _get_line_properties

Method _get_line_properties

xlsxwriter/shape.py:95–137  ·  view source on GitHub ↗
(options: dict)

Source from the content-addressed store, hash-verified

93
94 @staticmethod
95 def _get_line_properties(options: dict) -> dict:
96 # Convert user line properties to the structure required internally.
97 if not options.get("line") and not options.get("border"):
98 return {"defined": False}
99
100 # Copy the user defined properties since they will be modified.
101 # Depending on the context, the Excel UI property may be called 'line'
102 # or 'border'. Internally they are the same so we handle both.
103 if options.get("line"):
104 line = copy.deepcopy(options["line"])
105 else:
106 line = copy.deepcopy(options["border"])
107
108 dash_types = {
109 "solid": "solid",
110 "round_dot": "sysDot",
111 "square_dot": "sysDash",
112 "dash": "dash",
113 "dash_dot": "dashDot",
114 "long_dash": "lgDash",
115 "long_dash_dot": "lgDashDot",
116 "long_dash_dot_dot": "lgDashDotDot",
117 "dot": "dot",
118 "system_dash_dot": "sysDashDot",
119 "system_dash_dot_dot": "sysDashDotDot",
120 }
121
122 # Check the dash type.
123 dash_type = line.get("dash_type")
124
125 if dash_type is not None:
126 if dash_type in dash_types:
127 line["dash_type"] = dash_types[dash_type]
128 else:
129 warn(f"Unknown dash type '{dash_type}'")
130 return {}
131
132 if line.get("color"):
133 line["color"] = Color._from_value(line["color"])
134
135 line["defined"] = True
136
137 return line
138
139 @staticmethod
140 def _get_fill_properties(fill):

Callers 15

_set_optionsMethod · 0.95
add_seriesMethod · 0.80
set_titleMethod · 0.80
set_up_down_barsMethod · 0.80
set_drop_linesMethod · 0.80
set_high_low_linesMethod · 0.80
_convert_axis_argsMethod · 0.80
_get_error_bars_propsMethod · 0.80

Calls 2

getMethod · 0.80
_from_valueMethod · 0.80

Tested by

no test coverage detected