You're Invited: Meet the Socket team at BSidesSF and RSAC - April 27 - May 1.RSVP

file-process

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

file-process

A package that does file validation and file preview.

1.4.6
Maintainers
1

Superbio.ai

Package that can validate and return preview for different files.

Currenty supported extensions:

  • .h5ad
  • .csv
  • .tsv
  • .txt
  • .pdb
  • .fasta

Usage:

pip install file_process
from file_process import preview_file
try:
    processor = FileProcessFactory.get(file_data.filename, file_data.file)
except WrongExtension as exc:
    raise CustomException from exc
processor.validate(model_metadata_file)
var_target_names, obs_target_names, obs_preview, var_preview, text_preview  = processor.get_preview()

where:

  • file: an object of io.BytesIo or FileStorage which will be validated and previewed
  • filename: name of the validated file (only it's extention will be used)
  • model_metadata_file (optional parameter): file with metadata of a model that will be used for validation. If this file is provided, the code will check that this file has the same set of columns as the validated file. If this file is not provided, no validation will be applied.

The code returns a list of var targets and obs targets (columns from the validated file), var preview and obs preview and text preview. If some is not applicable for the file, None will be returned).

How to release:

  • Make your changes
  • Change the version in setup.py
  • Merge changes into the main branch; it will be automatically released to pypi

FAQs

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts