Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[pyOpenSci review] remove imports from function scope wherever possible #540

Closed
rich-iannone opened this issue Dec 2, 2024 · 2 comments
Closed

Comments

@rich-iannone
Copy link
Member

From the pyOpenSci comment:

issue (_boxhead.py, _formats.py, _modify_rows.py, _spanners.py, _utils_nanoplots.py, others): I can spot a few places where we could move some import statements to the top of the file instead of being in functions. AFAICT there is no circular import issue there, and it does not seem to be for performance reasons either.

pyOpenSci/software-submission#202 (comment)

@rich-iannone
Copy link
Member Author

rich-iannone commented Dec 12, 2024

List of functions that contain imports:

  • cols_label(): from great_tables._helpers import UnitStr
  • save(): import base64
  • save(): from ._utils_selenium import _get_web_driver
  • _save_screenshot(): from io import BytesIO
  • _save_screenshot(): from selenium.webdriver.common.by import By
  • _save_screenshot(): from selenium.webdriver.support import expected_conditions as EC
  • _save_screenshot(): from selenium.webdriver.support.ui import WebDriverWait
  • _save_screenshot(): from PIL import Image
  • fmt_units(): from great_tables._helpers import define_units
  • FmtImage/to_latex(): from warnings import warn
  • FmtImage/to_latex(): from ._gt_data import FormatterSkipElement
  • FmtIcon/to_latex(): from warnings import warn
  • FmtIcon/to_latex(): from ._gt_data import FormatterSkipElement
  • FmtFlag/to_latex(): from warnings import warn
  • FmtFlag/to_latex(): from ._gt_data import FormatterSkipElement
  • fmt_nanoplot(): from great_tables._utils import _str_detect
  • fmt_nanoplot(): from great_tables._utils import _flatten_list
  • GroupRows: from ._tbl_data import group_splits
  • _remove_from_body_styles(): from ._utils_render_html import _is_loc
  • _remove_from_body_styles(): from ._locations import LocBody
  • opt_table_font(): from great_tables._helpers import system_fonts
  • infer_render_env(): import IPython
  • tab_spanner(): from great_tables._helpers import UnitStr
  • Html/to_latex(): from ._utils_render_latex import _not_implemented
  • _format_number_compactly(): from great_tables.vals import fmt_currency, fmt_scientific, fmt_integer, fmt_number
  • _is_intlike(): import numbers
  • _is_intlike(): from decimal import Decimal
  • _remove_exponent(): from decimal import Decimal, InvalidOperation
  • _render_as_html(): from ._scss import compile_scss

@machow
Copy link
Collaborator

machow commented Dec 12, 2024

We plan to circle back to this, and have noted it, but I'm going to close here for now.

@machow machow closed this as not planned Won't fix, can't repro, duplicate, stale Dec 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants