Skip to content

Commit

Permalink
Merge pull request #2 from espressif/lazy-load
Browse files Browse the repository at this point in the history
feat: lazy loading for constants and soc_header in bool_parser
  • Loading branch information
horw authored Jan 3, 2025
2 parents f85b2f5 + bc14497 commit 38cb76b
Showing 1 changed file with 15 additions and 15 deletions.
30 changes: 15 additions & 15 deletions esp_bool_parser/bool_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,6 @@
opAssoc,
)

from .constants import (
IDF_VERSION,
IDF_VERSION_MAJOR,
IDF_VERSION_MINOR,
IDF_VERSION_PATCH,
)
from .soc_header import (
SOC_HEADERS,
)
from .utils import (
InvalidInput,
to_version,
Expand Down Expand Up @@ -82,6 +73,20 @@ def get_value(self, target: str, config_name: str) -> t.Any:
if self.attr == 'IDF_TARGET':
return target

if self.attr == 'CONFIG_NAME':
return config_name

# for non-keyword cap words, check if it is defined in the environment variables
if self.attr in os.environ:
return os.environ[self.attr]

from .constants import (
IDF_VERSION,
IDF_VERSION_MAJOR,
IDF_VERSION_MINOR,
IDF_VERSION_PATCH,
)

if self.attr == 'IDF_VERSION':
return IDF_VERSION

Expand All @@ -94,16 +99,11 @@ def get_value(self, target: str, config_name: str) -> t.Any:
if self.attr == 'IDF_VERSION_PATCH':
return IDF_VERSION_PATCH

if self.attr == 'CONFIG_NAME':
return config_name
from .soc_header import SOC_HEADERS

if self.attr in SOC_HEADERS[target]:
return SOC_HEADERS[target][self.attr]

# for non-keyword cap words, check if it is defined in the environment variables
if self.attr in os.environ:
return os.environ[self.attr]

return 0 # default return 0 as false


Expand Down

1 comment on commit 38cb76b

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Coverage

Coverage Report
FileStmtsMissCoverMissing
esp_bool_parser
   bool_parser.py1233175%49, 73–107, 128, 131, 158–165, 170, 178, 182
   constants.py411368%19–20, 45–57
   soc_header.py684140%54–64, 77–82, 86–93, 97–138
   utils.py11373%21, 25–26
TOTAL2468864% 

Tests Skipped Failures Errors Time
49 0 💤 0 ❌ 0 🔥 0.607s ⏱️

Please sign in to comment.