Skip to content

Commit

Permalink
Merge pull request #21 from cfengine/index
Browse files Browse the repository at this point in the history
Fixed issues found by flake8
  • Loading branch information
olehermanse authored Oct 5, 2021
2 parents f83f23d + 517cf88 commit e100d74
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 16 deletions.
17 changes: 3 additions & 14 deletions cfbs/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@
import os
import sys

from cf_remote.paths import cfengine_dir

from cfbs.utils import (
cfbs_dir,
cfbs_filename,
is_cfbs_repo,
user_error,
get_json,
strip_left,
Expand All @@ -24,18 +25,6 @@
from cfbs.index import Index


def cfbs_filename() -> str:
return "cfbs.json"


def is_cfbs_repo() -> bool:
return os.path.isfile(cfbs_filename())


def cfbs_dir(append=None) -> str:
return os.path.join(cfengine_dir("cfbs"), append if append else "")


definition = None


Expand Down
1 change: 1 addition & 0 deletions cfbs/index.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
from cf_remote.paths import cfengine_dir

from cfbs.utils import (
cfbs_dir,
user_error,
get_json,
strip_left,
Expand Down
4 changes: 2 additions & 2 deletions cfbs/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import logging as log

from cfbs.version import string as version
from cfbs.utils import user_error
from cfbs.utils import user_error, is_cfbs_repo
from cfbs import commands


Expand Down Expand Up @@ -76,7 +76,7 @@ def main() -> int:
if args.command == "pretty":
return commands.pretty_command(args.args)

if not commands.is_cfbs_repo():
if not is_cfbs_repo():
user_error("This is not a cfbs repo, to get started, type: cfbs init")

if args.command == "status":
Expand Down
13 changes: 13 additions & 0 deletions cfbs/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import copy
from collections import OrderedDict
from shutil import rmtree
from cf_remote.paths import cfengine_dir

import requests

Expand Down Expand Up @@ -139,3 +140,15 @@ def merge_json(a, b, overwrite_callback=None, stack=None):
a[k] = v

return a


def cfbs_filename() -> str:
return "cfbs.json"


def is_cfbs_repo() -> bool:
return os.path.isfile(cfbs_filename())


def cfbs_dir(append=None) -> str:
return os.path.join(cfengine_dir("cfbs"), append if append else "")

0 comments on commit e100d74

Please sign in to comment.