Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ on:
pull_request:
branches: ["*"]

permissions:
contents: read
id-token: write

jobs:
determine_version:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -58,14 +62,14 @@ jobs:
# Run spec tests without coverage for non Python 3.9
- name: Run spec_test
env:
HED_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ github.token }}
continue-on-error: true
run: |
python -m unittest discover spec_tests

# Run unittest without coverage
- name: Test with unittest
env:
HED_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ github.token }}
run: |
python -m unittest discover tests
27 changes: 6 additions & 21 deletions .github/workflows/ci_cov.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,26 +6,13 @@ on:
pull_request:
branches: ["*"]

jobs:
permissions:
contents: read
id-token: write

check-secret:
runs-on: ubuntu-latest
outputs:
secrets-exist: ${{ steps.check-for-secrets.outputs.defined }}
steps:
- name: Check for Secret availability
id: check-for-secrets
# perform secret check & put boolean result as an output
shell: bash
run: |
if [ "${{ secrets.QLTY_COVERAGE_TOKEN }}" != '' ]; then
echo "defined=true" >> $GITHUB_OUTPUT;
else
echo "defined=false" >> $GITHUB_OUTPUT;
fi
jobs:

build:
needs: check-secret
strategy:
matrix:
platform: [ubuntu-latest]
Expand Down Expand Up @@ -57,24 +44,22 @@ jobs:
# Run unittest with coverage
- name: Test with unittest and coverage
env:
HED_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ github.token }}
continue-on-error: true
run: |
coverage run -m unittest discover tests

# Run spec tests with coverage
- name: Run spec_test coverage
env:
HED_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ github.token }}
run: |
coverage run --append -m unittest discover spec_tests
coverage xml
ls -la

# Upload coverage to qlty
- name: Upload coverage to qlty
if: needs.check-secret.outputs.secrets-exist == 'true'
uses: qltysh/qlty-action/coverage@v2
with:
token: ${{ secrets.QLTY_COVERAGE_TOKEN }}
files: coverage.xml
8 changes: 4 additions & 4 deletions hed/models/base_input.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
"""
import os
from typing import Union

import openpyxl
import pandas as pd

from hed.models.column_metadata import ColumnMetadata
from hed.models.definition_dict import DefinitionDict
from hed.models.column_mapper import ColumnMapper
from hed.errors.exceptions import HedFileError, HedExceptions

Expand Down Expand Up @@ -269,11 +269,11 @@ def columns(self) -> list[str]:
columns = list(self._dataframe.columns)
return columns

def column_metadata(self) -> dict[int, 'ColumnMeta']:
def column_metadata(self) -> dict[int, 'ColumnMetadata']:
""" Return the metadata for each column.

Returns:
dict[int, 'ColumnMeta']: Number/ColumnMeta pairs.
dict[int, ColumnMetadata]: Number/ColumnMetadata pairs.
"""
if self._mapper:
return self._mapper._final_column_map
Expand Down
5 changes: 1 addition & 4 deletions hed/models/column_mapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,16 +206,13 @@ def set_tag_columns(self, tag_columns=None, optional_tag_columns=None, finalize_
if finalize_mapping:
self._finalize_mapping()

def set_column_map(self, new_column_map=None) -> list[dict]:
def set_column_map(self, new_column_map=None):
""" Set the column number to name mapping.

Parameters:
new_column_map (list or dict): Either an ordered list of the column names or column_number:column name.
dictionary. In both cases, column numbers start at 0.

Returns:
list[dict]: List of issues. Each issue is a dictionary.

"""
if new_column_map is None:
new_column_map = {}
Expand Down
5 changes: 4 additions & 1 deletion hed/schema/schema_io/schema_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,10 @@ def get_api_key():
try:
return os.environ["HED_GITHUB_TOKEN"]
except KeyError:
return github_api_access_token
try:
return os.environ["GITHUB_TOKEN"]
except KeyError:
return github_api_access_token


def make_url_request(resource_url, try_authenticate=True):
Expand Down
Loading