Skip to main content

Tool for extracting embedded text data in python script.

Project description

Tool for extracting embedded text data in python script.

Requirement

  • Python >= 3.9

  • pip3

Usage

  1. Install

```
% pip install embedded-text
```
  1. import in your script

    import embedded_text
  2. Embeddig text data at the end of your script with head/tail lines

```
if False:
    ############# Embedded Code Start #######################

    #!/usr/bin/env python3

    def main():
        print ('This is the sample : ____OUTPUT_WORDS____')

        if __name__ == '__main__':
            main()

    ############# Embedded Code End #######################
```
  1. Initialize class with regular expression of head/tail lines

```
    s_pttrn = r'\s*#{5,}\s*Embedded\s+Code\s+Start\s*#{5,}',
    e_pttrn = r'\s*#{5,}\s*Embedded\s+Code\s+End\s*#{5,}'},
    extractor = EmbeddedText(s_marker=s_pttrn,
                             e_marker=e_pttrn, ...)
```
  1. You can do iterator access by EmbeddedText.lines()

    for line in extractor.lines(input_path=None):
        sys.stdout.write(line)
  2. You can save to other file by EmbeddedText.dump()

    extractor.dump(output_path, input_path=None)
It is possible to apply the keyword replacement and text filtering. You can see the example in "main()" function in "embedded_text.py"

Author

Nanigashi Uji (53845049+nanigashi-uji@users.noreply.github.com)
Nanigashi Uji (4423013-nanigashi_uji@users.noreply.gitlab.com)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

embedded_text-0.0.3.tar.gz (11.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

embedded_text-0.0.3-py3-none-any.whl (8.5 kB view details)

Uploaded Python 3

File details

Details for the file embedded_text-0.0.3.tar.gz.

File metadata

  • Download URL: embedded_text-0.0.3.tar.gz
  • Upload date:
  • Size: 11.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.4

File hashes

Hashes for embedded_text-0.0.3.tar.gz
Algorithm Hash digest
SHA256 c8d2094941b6c6538728e9194104dba208994baf4ded20bb27aadb04affd435d
MD5 2d12d8a8a3cc6b97eb4b123b6a04ffa2
BLAKE2b-256 0759dbb55ac47a96326f44438281d8c84c194b5ca5c51408235d0bc6de1db0dd

See more details on using hashes here.

File details

Details for the file embedded_text-0.0.3-py3-none-any.whl.

File metadata

  • Download URL: embedded_text-0.0.3-py3-none-any.whl
  • Upload date:
  • Size: 8.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.4

File hashes

Hashes for embedded_text-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 5b04f618aff23973b3943eea8f028464c5283eaca473fd6bf8cf57eb049f7304
MD5 9a56b8cdab1baa7011ad99c6998f0711
BLAKE2b-256 921d0f0bf5a8ab6112035d63e181a93a5bcc8fb45b038e8fccb066c13ea058b0

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page