Skip to content

Commit

Permalink
[Fix] circular import issue
Browse files Browse the repository at this point in the history
Signed-off-by: Kent Huang <[email protected]>
  • Loading branch information
kentwelcome committed Sep 7, 2023
1 parent 828317c commit 8fdfef8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
7 changes: 6 additions & 1 deletion piperider_cli/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,19 @@
import os
import re
import sys
import tempfile
import webbrowser
from datetime import datetime

from dateutil import tz
from rich.console import Console
from ruamel import yaml

from piperider_cli.event import PIPERIDER_USER_HOME, PIPERIDER_USER_PROFILE
PIPERIDER_USER_HOME = os.path.expanduser('~/.piperider')
if os.access(os.path.expanduser('~/'), os.W_OK) is False:
# If we can't create file in user home directory, fallback to use temp folder
PIPERIDER_USER_HOME = os.path.join(tempfile.gettempdir(), '.piperider')

Check warning on line 17 in piperider_cli/__init__.py

View check run for this annotation

Codecov / codecov/patch

piperider_cli/__init__.py#L17

Added line #L17 was not covered by tests
PIPERIDER_USER_PROFILE = os.path.join(PIPERIDER_USER_HOME, 'profile.yml')


def create_logger(name) -> logging.Logger:
Expand Down
7 changes: 1 addition & 6 deletions piperider_cli/event/__init__.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,13 @@
import os
import tempfile
import uuid
from typing import Union

from rich.console import Console
from ruamel import yaml

from piperider_cli import PIPERIDER_USER_HOME, PIPERIDER_USER_PROFILE
from piperider_cli.event.collector import Collector

PIPERIDER_USER_HOME = os.path.expanduser('~/.piperider')
if os.access(os.path.expanduser('~/'), os.W_OK) is False:
# If we can't create file in user home directory, fallback to use temp folder
PIPERIDER_USER_HOME = os.path.join(tempfile.gettempdir(), '.piperider')
PIPERIDER_USER_PROFILE = os.path.join(PIPERIDER_USER_HOME, 'profile.yml')
PIPERIDER_USER_EVENT_PATH = os.path.join(PIPERIDER_USER_HOME, '.unsend_events.json')
PIPERIDER_FLUSH_EVENTS_WHITELIST = ['init', 'run', 'generate-report', 'compare-reports']

Expand Down

0 comments on commit 8fdfef8

Please sign in to comment.