Skip to content

Commit

Permalink
remove safe application (#1228)
Browse files Browse the repository at this point in the history
  • Loading branch information
juftin authored Mar 3, 2024
1 parent 87e2118 commit e2ae3f6
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 24 deletions.
24 changes: 1 addition & 23 deletions src/hatch/cli/application.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ def get_environment(self, env_name: str | None = None) -> EnvironmentInterface:
isolated_data_directory,
self.platform,
self.verbosity,
self.get_safe_application(),
self,
)

# Ensure that this method is clearly written since it is
Expand Down Expand Up @@ -253,28 +253,6 @@ def abort(self, text='', code=1, **kwargs):
self.display_error(text, **kwargs)
self.__exit_func(code)

def get_safe_application(self) -> SafeApplication:
return SafeApplication(self)


class SafeApplication:
def __init__(self, app: Application):
self.abort = app.abort
self.display = app.display
self.display_critical = app.display_critical
self.display_info = app.display_info
self.display_error = app.display_error
self.display_success = app.display_success
self.display_waiting = app.display_waiting
self.display_warning = app.display_warning
self.display_debug = app.display_debug
self.display_mini_header = app.display_mini_header
# Divergence from what the backend provides
self.prompt = app.prompt
self.confirm = app.confirm
self.status = app.status
self.status_if = app.status_if


class EnvironmentMetadata:
def __init__(self, data_dir: Path, project_path: Path):
Expand Down
2 changes: 1 addition & 1 deletion src/hatch/cli/publish/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ def publish(
app.abort(f'Unknown publisher: {publisher_name}')

publisher = publisher_class(
app.get_safe_application(),
app,
app.project.location,
app.cache_dir / 'publish' / publisher_name,
app.project.config.publish.get(publisher_name, {}),
Expand Down

0 comments on commit e2ae3f6

Please sign in to comment.