Skip to content

Commit

Permalink
client gen
Browse files Browse the repository at this point in the history
  • Loading branch information
JungleCatSW committed Nov 16, 2023
1 parent 67756d8 commit 72dcdaf
Show file tree
Hide file tree
Showing 7 changed files with 5,384 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/workflow-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ jobs:
with:
name: python-package-distributions
path: dist/
- name: Publish distribution 📦 to TestPyPI
- name: Publish distribution to TestPyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
repository-url: https://test.pypi.org/legacy/
275 changes: 271 additions & 4 deletions README.md

Large diffs are not rendered by default.

11 changes: 11 additions & 0 deletions codegen.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
rm -rf src
rm -rf swagger-codegen
git clone https://github.com/swagger-api/swagger-codegen
cp swagger/public.swagger.json swagger-codegen
cd swagger-codegen
./run-in-docker.sh mvn package
./run-in-docker.sh generate -i public.swagger.json \
-l python -o /gen/out -DpackageName=src.cudo_compute
cd ..
cp -r swagger-codegen/out/* .

59 changes: 59 additions & 0 deletions helpers/config.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
import yaml
import os

home = os.path.expanduser("~")


def load_config(path, context_name):
key_config = None
context_config = None
error = None

with open(path, 'r') as file:
config_data = yaml.safe_load(file)

if config_data['configVersion'] != "v0":
error = Exception("Only config version v0 is supported")
return key_config, context_config, error

if not context_name:
if 'current-context' in config_data:
context_name = config_data['current-context']
else:
return key_config, context_config, Exception("No current context selected")

if 'contexts' in config_data:
for context_data in config_data['contexts']:
if context_data['name'] == context_name:
context_config = context_data
break

if not context_config:
error = Exception("Context not found")
return key_config, context_config, error

if 'keys' in config_data:
for key_data in config_data['keys']:
if key_data['name'] == context_config['key']:
key_config = key_data

if not key_config:
error = Exception("Key not found")

return key_config, context_config, error


def get_api_key():
key_config, context_config, error = load_config(home + '/.config/cudo/cudo.yml', "")
if not error:
return key_config['key'], None
else:
return None, error


def get_project():
key_config, context_config, error = load_config(home + '/.config/cudo/cudo.yml', "")
if not error:
return context_config['project'], None
else:
return None, error
Empty file removed src/cudo-compute/__init__.py
Empty file.
2 changes: 0 additions & 2 deletions src/cudo-compute/example.py

This file was deleted.

Loading

0 comments on commit 72dcdaf

Please sign in to comment.