Skip to content

Commit

Permalink
Added checks to see if a locations specification is on a data sourc…
Browse files Browse the repository at this point in the history
…e specification before trying to reference it
  • Loading branch information
christophertubbs committed Aug 4, 2023
1 parent f8c025c commit 402808b
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ def retrieve(self, *args, **kwargs) -> pandas.DataFrame:
)
frame = frame.join(constant_frame)

if self.definition.locations.from_field == "filename":
if self.definition.locations is not None and self.definition.locations.from_field == "filename":
name = None

if self.definition.locations.pattern:
Expand Down Expand Up @@ -205,7 +205,11 @@ def retrieve(self, *args, **kwargs) -> pandas.DataFrame:

table: pandas.DataFrame = document[column_names]

if self.definition.locations.identify and self.definition.locations.from_field == 'filename':
has_locations = self.definition.locations is not None
should_identify_locations = has_locations and self.definition.locations.identify
location_is_in_filename = should_identify_locations and self.definition.locations.from_field == 'filename'

if location_is_in_filename:
file_name_without_extension = os.path.splitext(os.path.basename(source))[0]
pattern = self.definition.locations.pattern

Expand Down

0 comments on commit 402808b

Please sign in to comment.