Skip to content

Commit

Permalink
fix(pre_commit): 🎨 auto format pre-commit hooks
Browse files Browse the repository at this point in the history
  • Loading branch information
pre-commit-ci[bot] committed Jul 16, 2024
1 parent fd6990b commit 098d96f
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 20 deletions.
6 changes: 3 additions & 3 deletions roboflow/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -237,16 +237,16 @@ def workspace(self, the_workspace=None):

if the_workspace is None:
the_workspace = self.current_workspace

if self.api_key: # Check if api_key was passed during __init__
workspace_api_key = load_roboflow_api_key(the_workspace)
api_key = workspace_api_key or self.api_key
list_projects = rfapi.get_workspace(api_key, the_workspace)
return Workspace(list_projects, api_key, the_workspace, self.model_format)

elif self.api_key in DEMO_KEYS:
return Workspace({}, self.api_key, the_workspace, self.model_format)

else:
raise ValueError("A valid API key must be provided.")

Expand Down
7 changes: 3 additions & 4 deletions roboflow/core/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def __init__(self, api_key: str, a_project: dict, model_format: Optional[str] =
>>> project = rf.workspace().project("PROJECT_ID")
"""

if api_key:
self.__api_key = api_key
self.annotation = a_project["annotation"]
Expand All @@ -73,14 +73,13 @@ def __init__(self, api_key: str, a_project: dict, model_format: Optional[str] =
temp = self.id.rsplit("/")
self.__workspace = temp[0]
self.__project_name = temp[1]

elif DEMO_KEYS:
self.__api_key = DEMO_KEYS[0]
self.model_format = model_format

else:
raise ValueError("A valid API key must be provided.")


def get_version_information(self):
"""
Expand Down
2 changes: 1 addition & 1 deletion roboflow/core/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ def __init__(
self.model = KeypointDetectionModel(self.__api_key, self.id, version=version_without_workspace)
else:
self.model = None

elif DEMO_KEYS:
api_key = DEMO_KEYS[0]
if api_key == "coco-128-sample":
Expand Down
8 changes: 4 additions & 4 deletions roboflow/core/workspace.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@ class Workspace:
"""
Manage a Roboflow workspace.
"""

def __init__(self, info, api_key, default_workspace, model_format):

if api_key:
self.__api_key = api_key
self.__api_key = api_key

workspace_info = info["workspace"]
self.name = workspace_info["name"]
self.project_list = workspace_info["projects"]
Expand All @@ -43,7 +43,7 @@ def __init__(self, info, api_key, default_workspace, model_format):

else:
raise ValueError("A valid API key must be provided.")

def list_projects(self):
"""
Print all projects in the workspace to the console.
Expand Down
17 changes: 9 additions & 8 deletions roboflow/roboflowpy.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,17 +113,17 @@ def get_workspace(args):
print(json.dumps(workspace_json, indent=2))



def get_workspace_project_version(args):
#api_key = load_roboflow_api_key(args.workspaceId)
# api_key = load_roboflow_api_key(args.workspaceId)
rf = roboflow.Roboflow(args.api_key)
workspace = rf.workspace()
print('workspace',workspace)
print("workspace", workspace)
project = workspace.project(args.project)
print('project',project)
print("project", project)
version = project.version(args.version_number)
print('version',version)

print("version", version)


def get_project(args):
workspace_url = args.workspace or get_conditional_configuration_variable("RF_WORKSPACE", default=None)
api_key = load_roboflow_api_key(workspace_url)
Expand Down Expand Up @@ -174,7 +174,6 @@ def _argparser():
_add_upload_model_parser(subparsers)
_add_get_workspace_project_version_parser(subparsers)


return parser


Expand Down Expand Up @@ -424,6 +423,7 @@ def _add_upload_model_parser(subparsers):
)
upload_model_parser.set_defaults(func=upload_model)


def _add_get_workspace_project_version_parser(subparsers):
workspace_project_version_parser = subparsers.add_parser(
"get_workspace_info",
Expand Down Expand Up @@ -451,7 +451,8 @@ def _add_get_workspace_project_version_parser(subparsers):
help="version number to upload the model to",
)
workspace_project_version_parser.set_defaults(func=get_workspace_project_version)



def _add_login_parser(subparsers):
login_parser = subparsers.add_parser("login", help="Log in to Roboflow")
login_parser.set_defaults(func=login)
Expand Down

0 comments on commit 098d96f

Please sign in to comment.