Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
# warnings.warn("Parameter icon_size is deprecated. Use font_size instead.", DeprecationWarning)
self._pa["font_size"] = self._pa["icon_size"]
# TODO: deprecating icon_set
if self._pa["icon_set"] != "solid" and self._pa["icon_style"] == "solid":
self._pa["icon_style"] = self._pa["icon_set"]
warnings.warn(
"Parameter icon_set is deprecated and will be removed in future version. Use icon_style instead.",
DeprecationWarning,
)
# If icon_set is a string, convert it into a list of same icon. It's length is the value's length
# 'solid' -> ['solid', 'solid', 'solid', ]
if isinstance(self._pa["icon_style"], str):
self._pa["icon_style"] = [self._pa["icon_style"].lower()] * self.values_len
elif set(self._pa["icon_style"]) - set(icons.keys()):
raise KeyError("icon_set should be one of {}".format(", ".join(icons.keys())))
# If icons is a string, convert it into a list of same icon. It's length is the value's length
# '\uf26e' -> ['\uf26e', '\uf26e', '\uf26e', ]
if isinstance(self._pa["icons"], str):
self._pa["icons"] = [self._pa["icons"]] * self.values_len
if len(self._pa["icons"]) != self.values_len:
raise ValueError("Length of icons doesn't match the values.")
# Replace icon name with Unicode symbols in parameter icons
self._pa["icons"] = [
icons[icon_style][icon_name] for icon_name, icon_style in zip(self._pa["icons"], self._pa["icon_style"])
]
# Calculate icon size based on the block size
# warnings.warn("Parameter icon_size is deprecated. Use font_size instead.", DeprecationWarning)
self._pa["font_size"] = self._pa["icon_size"]
# TODO: deprecating icon_set
if self._pa["icon_set"] != "solid" and self._pa["icon_style"] == "solid":
self._pa["icon_style"] = self._pa["icon_set"]
warnings.warn(
"Parameter icon_set is deprecated and will be removed in future version. Use icon_style instead.",
DeprecationWarning,
)
# If icon_set is a string, convert it into a list of same icon. It's length is the value's length
# 'solid' -> ['solid', 'solid', 'solid', ]
if isinstance(self._pa["icon_style"], str):
self._pa["icon_style"] = [self._pa["icon_style"].lower()] * self.values_len
elif set(self._pa["icon_style"]) - set(icons.keys()):
raise KeyError("icon_set should be one of {}".format(", ".join(icons.keys())))
# If icons is a string, convert it into a list of same icon. It's length is the value's length
# '\uf26e' -> ['\uf26e', '\uf26e', '\uf26e', ]
if isinstance(self._pa["icons"], str):
self._pa["icons"] = [self._pa["icons"]] * self.values_len
if len(self._pa["icons"]) != self.values_len:
raise ValueError("Length of icons doesn't match the values.")
# Replace icon name with Unicode symbols in parameter icons
self._pa["icons"] = [
icons[icon_style][icon_name] for icon_name, icon_style in zip(self._pa["icons"], self._pa["icon_style"])
]
# Calculate icon size based on the block size
self._pa["font_size"] = self._pa["icon_size"]
# TODO: deprecating icon_set
if self._pa["icon_set"] != "solid" and self._pa["icon_style"] == "solid":
self._pa["icon_style"] = self._pa["icon_set"]
warnings.warn(
"Parameter icon_set is deprecated and will be removed in future version. Use icon_style instead.",
DeprecationWarning,
)
# If icon_set is a string, convert it into a list of same icon. It's length is the value's length
# 'solid' -> ['solid', 'solid', 'solid', ]
if isinstance(self._pa["icon_style"], str):
self._pa["icon_style"] = [self._pa["icon_style"].lower()] * self.values_len
elif set(self._pa["icon_style"]) - set(icons.keys()):
raise KeyError("icon_set should be one of {}".format(", ".join(icons.keys())))
# If icons is a string, convert it into a list of same icon. It's length is the value's length
# '\uf26e' -> ['\uf26e', '\uf26e', '\uf26e', ]
if isinstance(self._pa["icons"], str):
self._pa["icons"] = [self._pa["icons"]] * self.values_len
if len(self._pa["icons"]) != self.values_len:
raise ValueError("Length of icons doesn't match the values.")
# Replace icon name with Unicode symbols in parameter icons
self._pa["icons"] = [
icons[icon_style][icon_name] for icon_name, icon_style in zip(self._pa["icons"], self._pa["icon_style"])
]
# Calculate icon size based on the block size
tx, ty = self.ax.transData.transform([(0, 0), (0, block_x_length)])
if isinstance(self._pa["icon_style"], str):
self._pa["icon_style"] = [self._pa["icon_style"].lower()] * self.values_len
elif set(self._pa["icon_style"]) - set(icons.keys()):
raise KeyError("icon_set should be one of {}".format(", ".join(icons.keys())))
# If icons is a string, convert it into a list of same icon. It's length is the value's length
# '\uf26e' -> ['\uf26e', '\uf26e', '\uf26e', ]
if isinstance(self._pa["icons"], str):
self._pa["icons"] = [self._pa["icons"]] * self.values_len
if len(self._pa["icons"]) != self.values_len:
raise ValueError("Length of icons doesn't match the values.")
# Replace icon name with Unicode symbols in parameter icons
self._pa["icons"] = [
icons[icon_style][icon_name] for icon_name, icon_style in zip(self._pa["icons"], self._pa["icon_style"])
]
# Calculate icon size based on the block size
tx, ty = self.ax.transData.transform([(0, 0), (0, block_x_length)])
prop = fm.FontProperties(size=self._pa["font_size"] or int((ty[1] - tx[1]) / 16 * 12))
elif self._pa["characters"]:
# If characters is a string, convert it into a list of same characters. It's length is the value's length
if isinstance(self._pa["characters"], str):
self._pa["characters"] = [self._pa["characters"]] * self.values_len
if len(self._pa["characters"]) != self.values_len:
raise ValueError("Length of characters doesn't match the values.")
# Calculate icon size based on the block size
tx, ty = self.ax.transData.transform([(0, 0), (0, block_x_length)])