-
Notifications
You must be signed in to change notification settings - Fork 291
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Guarin lig 2601 add black and isort (#1093)
* Add black and isort dev dependencies. * Add `make format` and `make format-check` commands. * Add CI action running `make format-check`, failing checks do not block from merging. * Format files with black and isort * Update contribution guidelines
- Loading branch information
Showing
288 changed files
with
6,514 additions
and
6,398 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
name: Code Format Check | ||
|
||
on: | ||
push: | ||
pull_request: | ||
workflow_dispatch: | ||
|
||
jobs: | ||
test: | ||
name: Check | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout Code | ||
uses: actions/checkout@v3 | ||
- name: Hack to get setup-python to work on nektos/act | ||
run: | | ||
if [ ! -f "/etc/lsb-release" ] ; then | ||
echo "DISTRIB_RELEASE=18.04" > /etc/lsb-release | ||
fi | ||
- name: Set up Python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: "3.10" | ||
- uses: actions/cache@v2 | ||
with: | ||
path: ${{ env.pythonLocation }} | ||
key: cache_v2_${{ env.pythonLocation }}-${{ hashFiles('requirements/**') }} | ||
- name: Install Dependencies and lightly | ||
run: pip install -e '.[all]' | ||
- name: Run Format Check | ||
run: | | ||
export LIGHTLY_SERVER_LOCATION="localhost:-1" | ||
make format-check |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 13 additions & 13 deletions
26
docs/source/docker/advanced/code_examples/python_create_dataset_azure_example.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,29 @@ | ||
import json | ||
|
||
import lightly | ||
from lightly.openapi_generated.swagger_client.models.dataset_type import DatasetType | ||
from lightly.openapi_generated.swagger_client.models.datasource_purpose import DatasourcePurpose | ||
|
||
from lightly.openapi_generated.swagger_client.models.datasource_purpose import ( | ||
DatasourcePurpose, | ||
) | ||
|
||
# Create the Lightly client to connect to the API. | ||
client = lightly.api.ApiWorkflowClient(token="YOUR_TOKEN") | ||
|
||
# Create a new dataset on the Lightly Platform. | ||
client.create_dataset('pedestrian-videos-datapool', | ||
dataset_type=DatasetType.VIDEOS) | ||
client.create_dataset("pedestrian-videos-datapool", dataset_type=DatasetType.VIDEOS) | ||
|
||
# Azure Blob Storage | ||
# Input bucket | ||
client.set_azure_config( | ||
container_name='my-container/input/', | ||
account_name='ACCOUNT-NAME', | ||
sas_token='SAS-TOKEN', | ||
purpose=DatasourcePurpose.INPUT | ||
container_name="my-container/input/", | ||
account_name="ACCOUNT-NAME", | ||
sas_token="SAS-TOKEN", | ||
purpose=DatasourcePurpose.INPUT, | ||
) | ||
# Output bucket | ||
client.set_azure_config( | ||
container_name='my-container/output/', | ||
account_name='ACCOUNT-NAME', | ||
sas_token='SAS-TOKEN', | ||
purpose=DatasourcePurpose.LIGHTLY | ||
container_name="my-container/output/", | ||
account_name="ACCOUNT-NAME", | ||
sas_token="SAS-TOKEN", | ||
purpose=DatasourcePurpose.LIGHTLY, | ||
) | ||
|
18 changes: 9 additions & 9 deletions
18
docs/source/docker/advanced/code_examples/python_create_dataset_gcs_example.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,29 @@ | ||
import json | ||
|
||
import lightly | ||
from lightly.openapi_generated.swagger_client.models.dataset_type import DatasetType | ||
from lightly.openapi_generated.swagger_client.models.datasource_purpose import DatasourcePurpose | ||
|
||
from lightly.openapi_generated.swagger_client.models.datasource_purpose import ( | ||
DatasourcePurpose, | ||
) | ||
|
||
# Create the Lightly client to connect to the API. | ||
client = lightly.api.ApiWorkflowClient(token="YOUR_TOKEN") | ||
|
||
# Create a new dataset on the Lightly Platform. | ||
client.create_dataset('pedestrian-videos-datapool', | ||
dataset_type=DatasetType.VIDEOS) | ||
client.create_dataset("pedestrian-videos-datapool", dataset_type=DatasetType.VIDEOS) | ||
|
||
# Google Cloud Storage | ||
# Input bucket | ||
client.set_gcs_config( | ||
resource_path="gs://bucket/input/", | ||
project_id="PROJECT-ID", | ||
credentials=json.dumps(json.load(open('credentials_read.json'))), | ||
purpose=DatasourcePurpose.INPUT | ||
credentials=json.dumps(json.load(open("credentials_read.json"))), | ||
purpose=DatasourcePurpose.INPUT, | ||
) | ||
# Output bucket | ||
client.set_gcs_config( | ||
resource_path="gs://bucket/output/", | ||
project_id="PROJECT-ID", | ||
credentials=json.dumps(json.load(open('credentials_write.json'))), | ||
purpose=DatasourcePurpose.LIGHTLY | ||
credentials=json.dumps(json.load(open("credentials_write.json"))), | ||
purpose=DatasourcePurpose.LIGHTLY, | ||
) | ||
|
28 changes: 14 additions & 14 deletions
28
docs/source/docker/advanced/code_examples/python_create_dataset_s3_example.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,31 @@ | ||
import json | ||
|
||
import lightly | ||
from lightly.openapi_generated.swagger_client.models.dataset_type import DatasetType | ||
from lightly.openapi_generated.swagger_client.models.datasource_purpose import DatasourcePurpose | ||
|
||
from lightly.openapi_generated.swagger_client.models.datasource_purpose import ( | ||
DatasourcePurpose, | ||
) | ||
|
||
# Create the Lightly client to connect to the API. | ||
client = lightly.api.ApiWorkflowClient(token="YOUR_TOKEN") | ||
|
||
# Create a new dataset on the Lightly Platform. | ||
client.create_dataset('pedestrian-videos-datapool', | ||
dataset_type=DatasetType.VIDEOS) | ||
client.create_dataset("pedestrian-videos-datapool", dataset_type=DatasetType.VIDEOS) | ||
|
||
# AWS S3 | ||
# AWS S3 | ||
# Input bucket | ||
client.set_s3_config( | ||
resource_path="s3://bucket/input/", | ||
region='eu-central-1', | ||
access_key='S3-ACCESS-KEY', | ||
secret_access_key='S3-SECRET-ACCESS-KEY', | ||
purpose=DatasourcePurpose.INPUT | ||
region="eu-central-1", | ||
access_key="S3-ACCESS-KEY", | ||
secret_access_key="S3-SECRET-ACCESS-KEY", | ||
purpose=DatasourcePurpose.INPUT, | ||
) | ||
# Output bucket | ||
client.set_s3_config( | ||
resource_path="s3://bucket/output/", | ||
region='eu-central-1', | ||
access_key='S3-ACCESS-KEY', | ||
secret_access_key='S3-SECRET-ACCESS-KEY', | ||
purpose=DatasourcePurpose.LIGHTLY | ||
region="eu-central-1", | ||
access_key="S3-ACCESS-KEY", | ||
secret_access_key="S3-SECRET-ACCESS-KEY", | ||
purpose=DatasourcePurpose.LIGHTLY, | ||
) | ||
|
Oops, something went wrong.