s3.bak 438 B

1234567891011121314151617
  1. import re
  2. from magic_pdf.libs.config_reader import get_s3_config_dict
  3. __re_s3_path = re.compile("^s3a?://([^/]+)(?:/(.*))?$")
  4. def get_s3_config(path):
  5. bucket_name = split_s3_path(path)[0] if path else ""
  6. return get_s3_config_dict(bucket_name)
  7. def split_s3_path(path: str):
  8. "split bucket and key from path"
  9. m = __re_s3_path.match(path)
  10. if m is None:
  11. return "", ""
  12. return m.group(1), (m.group(2) or "")