webcode-tk 1.2.21__tar.gz → 1.2.22__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: webcode-tk
3
- Version: 1.2.21
3
+ Version: 1.2.22
4
4
  Summary: A set of tools for inspecting HTML and CSS code
5
5
  License: MIT
6
6
  License-File: LICENSE.rst
@@ -16,6 +16,7 @@ Classifier: Programming Language :: Python :: 3.11
16
16
  Classifier: Programming Language :: Python :: 3.12
17
17
  Classifier: Programming Language :: Python :: 3.13
18
18
  Classifier: Programming Language :: Python :: 3.14
19
+ Classifier: Programming Language :: Python :: 3.15
19
20
  Requires-Dist: bs4 (>=0.0.1,<0.0.2)
20
21
  Requires-Dist: file-clerk (>=1.0.9,<2.0.0)
21
22
  Requires-Dist: lxml (>=6.0.0,<7.0.0)
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "webcode-tk"
3
- version = "1.2.21"
3
+ version = "1.2.22"
4
4
  description = "A set of tools for inspecting HTML and CSS code"
5
5
  authors = ["hundredvisionsguy <cwinikka@gmail.com>"]
6
6
  keywords = ["html", "validation", "css", ]
@@ -40,4 +40,4 @@
40
40
  - **`validator_tools`**: sends HTML or CSS code to the W3C Validator to check
41
41
  for errors.
42
42
  """
43
- __version__ = "1.2.21"
43
+ __version__ = "1.2.22"
@@ -607,8 +607,7 @@ def contrast_ratio(hex1: str, hex2: str) -> float:
607
607
  try:
608
608
  rgb1 = hex_to_rgb(hex1)
609
609
  rgb2 = hex_to_rgb(hex2)
610
- except ValueError as e:
611
- print(f"Oops {str(e)}")
610
+ except ValueError:
612
611
  return 0
613
612
  l1 = luminance(rgb1)
614
613
  l2 = luminance(rgb2)
@@ -1095,12 +1094,5 @@ def color_to_hsl(color_code: str) -> str:
1095
1094
 
1096
1095
 
1097
1096
  if __name__ == "__main__":
1098
- # print()
1099
- # hex = rgb_to_hex("rgb(190, 228, 210)")
1100
- # print(hex)
1101
- # hex2 = rgb_to_hex("rgb(215, 248, 247)")
1102
- # print(hex2)
1103
- # hex = rgb_to_hex("rgb(250, 178, 172)")
1104
- # print(hex)
1105
1097
  hex = rgb_to_hex("rgb(237, 161, 193)")
1106
1098
  print(hex)
@@ -592,8 +592,6 @@ def apply_browser_defaults(
592
592
  },
593
593
  }
594
594
 
595
- if element.name in ["html", "body"]:
596
- print(f" ✓ Added <{element.name}> to element_styles")
597
595
  # Apply element-specific defaults
598
596
  # Apply link colors
599
597
  if element.name == "a":
@@ -758,7 +756,6 @@ def find_matching_elements(soup: BeautifulSoup, selector: str) -> list:
758
756
  if not is_selector_supported_by_bs4(selector):
759
757
  warning = f"Warning: Selector '{selector}' contains features not "
760
758
  warning += "supported by BS4"
761
- print(warning)
762
759
  return []
763
760
 
764
761
  # Try BeautifulSoup's select method
@@ -1097,9 +1094,8 @@ def convert_font_size_to_pixels(
1097
1094
 
1098
1095
  return f"{computed_px:.1f}px"
1099
1096
 
1100
- except Exception as e:
1097
+ except Exception:
1101
1098
  # Fallback for parsing errors
1102
- print(f"DEBUG: Exception caught: '{e}'")
1103
1099
  return f"{font_size_value}px" # Assume it's already in pixels
1104
1100
 
1105
1101
 
@@ -1386,5 +1382,3 @@ if __name__ == "__main__":
1386
1382
  contrast_results = generate_contrast_report(project_path, "AAA")
1387
1383
  project_path = "tests/test_files/contrast_tool_test/"
1388
1384
  global_colors = css_tools.get_project_global_colors(project_path)
1389
- print()
1390
- print()
@@ -326,15 +326,16 @@ class Stylesheet:
326
326
 
327
327
  # Check for a gradient bg color
328
328
  is_bg_gradient = color_tools.is_gradient(value)
329
- if is_bg_gradient:
330
- print()
329
+
331
330
  # skip if has vendor prefix
332
331
  if has_vendor_prefix(value):
333
332
  continue
333
+
334
334
  # skip if not valid color value
335
335
  is_valid_color = color_tools.is_color_value(value)
336
336
  if not is_valid_color and not is_bg_gradient:
337
337
  continue
338
+
338
339
  # make sure the value is a color (not other)
339
340
  rule = {selector: {property: value}}
340
341
  color_rulesets.append(rule)
@@ -1259,8 +1260,7 @@ def get_comment_positions(code: str) -> Union[list, None]:
1259
1260
  positions.append(code.index("/*"))
1260
1261
  positions.append(code.index("*/"))
1261
1262
  return positions
1262
- except Exception as ex:
1263
- print(ex)
1263
+ except Exception:
1264
1264
  return
1265
1265
 
1266
1266
 
@@ -1362,8 +1362,6 @@ def get_font_families(sheet: Stylesheet) -> list:
1362
1362
  # always take the last family as it would be an override in CSS
1363
1363
  family = families[-1]
1364
1364
  font_families.append({"selector": selector, "family": family})
1365
- else:
1366
- print()
1367
1365
  return font_families
1368
1366
 
1369
1367
 
@@ -1885,8 +1883,7 @@ def get_unique_font_rules(project_folder: str) -> list:
1885
1883
  unique_font_selectors.append(selector)
1886
1884
  if value not in unique_font_values:
1887
1885
  unique_font_values.append(value)
1888
- else:
1889
- print()
1886
+
1890
1887
  # apply the file, unique rules, unique selectors, and unique values
1891
1888
  filename = file.get("file")
1892
1889
  file_data = {"file": filename, "rules": unique_rules}
File without changes
File without changes