Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Interactive files #1063

Open
wants to merge 18 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 10 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ dependencies = [
"dill>=0.3.5,<0.4",
"feather-format>=0.4.1,<1",
"importlib-metadata>=5.0",
"ipyfilechooser>=0.6.0",
"ipympl>=0.9.2,<1.0.0",
"ipython>=8.4,<9",
"jupyterlab>=3.4.3,<4",
Expand Down Expand Up @@ -157,6 +158,7 @@ exclude_lines = [
"raise NotImplementedError",
"(ArrowInvalid, OSError, IOError)",
]
omit = ["ark/utils/interactive_file_select/*.py"]

# Pytest Options
[tool.pytest.ini_options]
Expand All @@ -176,3 +178,4 @@ addopts = [
]
console_output_style = "count"
testpaths = ["tests"]
collect_ignore = ["ark/utils/interactive_file_select/*.py"]
3 changes: 3 additions & 0 deletions src/ark/utils/interactive_file_select/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from .filechooser import FileChooser

# source: Credit goes to ipyfilechooser (https://github.com/crahan/ipyfilechooser)
35 changes: 35 additions & 0 deletions src/ark/utils/interactive_file_select/errors.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
"""Exception classes."""
import os
from typing import Optional


class ParentPathError(Exception):
"""ParentPathError class."""

def __init__(self, path: str, parent_path: str, message: Optional[str] = None):
self.path = path
self.sandbox_path = parent_path
self.message = message or f'{path} is not a part of {parent_path}'
super().__init__(self.message)


class InvalidPathError(Exception):
"""InvalidPathError class."""

def __init__(self, path: str, message: Optional[str] = None):
self.path = path
self.message = message or f'{path} does not exist'
super().__init__(self.message)


class InvalidFileNameError(Exception):
"""InvalidFileNameError class."""
invalid_str = [os.sep, os.pardir]

if os.altsep:
invalid_str.append(os.altsep)

def __init__(self, filename: str, message: Optional[str] = None):
self.filename = filename
self.message = message or f'{filename} cannot contain {self.invalid_str}'
super().__init__(self.message)
Loading