Skip to content
Snippets Groups Projects

Extended filenames as dict

Merged Rémi Cresson requested to merge 102-pythonic_ext_fname into develop
All threads resolved!

Closes #102 (closed)

Merge request reports

Merge request pipeline #13390 passed

Merge request pipeline passed for 5f837bef

Approved by

Merged by Rémi CressonRémi Cresson 1 year ago (Jun 28, 2023 1:34pm UTC)

Merge details

  • Changes merged into develop with c4fe5746 (commits were squashed).
  • Deleted the source branch.

Pipeline #13392 passed

Pipeline passed for c4fe5746 on develop

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
  • Rémi Cresson added 1 commit

    added 1 commit

    • 6af96f3d - TEST: strenghten ext_fname tests

    Compare with previous version

  • Rémi Cresson added 1 commit

    added 1 commit

    • 38f320dc - Apply 1 suggestion(s) to 1 file(s)

    Compare with previous version

  • Rémi Cresson added 1 commit

    added 1 commit

    • 0fc010c6 - Apply 1 suggestion(s) to 1 file(s)

    Compare with previous version

  • Rémi Cresson added 1 commit

    added 1 commit

    • d1cdccfd - Apply 2 suggestion(s) to 1 file(s)

    Compare with previous version

  • Rémi Cresson added 1 commit

    added 1 commit

    • b80fd7e0 - Apply 1 suggestion(s) to 1 file(s)

    Compare with previous version

  • Vincent Delbar changed milestone to %Release 2.0

    changed milestone to %Release 2.0

  • Rémi Cresson added 1 commit

    added 1 commit

    Compare with previous version

  • Vincent Delbar
  • Rémi Cresson added 1 commit

    added 1 commit

    • 5b702ca3 - FIX: copy ext_fname when it's a dict

    Compare with previous version

  • Vincent Delbar
  • Rémi Cresson added 1 commit

    added 1 commit

    • b0122b17 - FIX: copy ext_fname when it's a dict

    Compare with previous version

  • Rémi Cresson added 1 commit

    added 1 commit

    • d953d957 - FIX: copy ext_fname when it's a dict

    Compare with previous version

  • Rémi Cresson added 1 commit

    added 1 commit

    • e6f14025 - FIX: copy ext_fname when it's a dict

    Compare with previous version

  • Rémi Cresson added 1 commit

    added 1 commit

    • af0b763c - FIX: copy ext_fname when it's a dict

    Compare with previous version

    • Resolved by Vincent Delbar

      @remicress I don't understand all those dict copies. The following should be enough and is 10 lines shorter :

              # Append filename extension to filenames
              if ext_fname:
                  if not isinstance(ext_fname, (dict, str)):
                      raise ValueError("Extended filename must be a str or a dict")
                  if isinstance(ext_fname, str):
                      splits = [pair.split("=") for pair in ext_fname.split("&")]
                      ext_fname = dict(split for split in splits if len(split) == 2)
      
                  logger.debug("%s: extended filename for all outputs:", self.name)
                  for key, ext in ext_fname.items():
                      logger.debug("%s: %s", key, ext)
                   ext_fname_str = "&".join([
                       f"{key}={value}" for key, value in ext_fname.items()
                   ])
      
                  for key, filepath in kwargs.items():
                      if self._out_param_types[key] == otb.ParameterType_OutputImage:
                          if "?&" in filepath:
                              logger.debug("Extended filename already provided for parameter %s", key)
                          else:
                              parameters[key] = f"{filepath}?&{ext_fname_str}"
      Edited by Vincent Delbar
  • Rémi Cresson added 1 commit

    added 1 commit

    • 0c2bc219 - ENH: ext_fn tests with 2 outputs

    Compare with previous version

  • Rémi Cresson added 1 commit

    added 1 commit

    • 1e68f1e0 - ENH: ext_fn tests with 2 outputs

    Compare with previous version

  • Rémi Cresson resolved all threads

    resolved all threads

  • Rémi Cresson added 1 commit

    added 1 commit

    • 68e7fdb7 - Apply 1 suggestion(s) to 1 file(s)

    Compare with previous version

  • Rémi Cresson resolved all threads

    resolved all threads

  • Rémi Cresson added 1 commit

    added 1 commit

    • 5f837bef - Apply 1 suggestion(s) to 1 file(s)

    Compare with previous version

  • Vincent Delbar approved this merge request

    approved this merge request

  • I think you should squash this kind of MR like !85 (merged) to avoid having commit history with duplicated messages, or things like "Apply 1 suggestion(s) to 1 file(s)" in the main branch

    Edited by Vincent Delbar
  • merged

  • Rémi Cresson mentioned in commit c4fe5746

    mentioned in commit c4fe5746

  • Please register or sign in to reply
    Loading