updated py_checks.yml , workflow to be triggered (#17956)
* updated py_checks , trying to trigger workflow * trail trigger * undone changes * changes after PR * corrected flake for logger , constants .py * fixed flake8 test on modified files * fixed flake8 test on modified files * fixed logger.py to trigger workflow * Update .github/workflows/py_checks.yml Co-authored-by: Przemyslaw Wysocki <przemyslaw.wysocki@intel.com> * Update .github/workflows/py_checks.yml Co-authored-by: Anastasia Kuporosova <anastasia.kuporosova@intel.com> --------- Co-authored-by: Przemyslaw Wysocki <przemyslaw.wysocki@intel.com> Co-authored-by: Anastasia Kuporosova <anastasia.kuporosova@intel.com>
This commit is contained in:
parent
42c93a70d4
commit
0b708b5eff
13
.github/workflows/py_checks.yml
vendored
13
.github/workflows/py_checks.yml
vendored
@ -151,3 +151,16 @@ jobs:
|
|||||||
- name: Run Bandit
|
- name: Run Bandit
|
||||||
run: python -m bandit -r ./ -f screen
|
run: python -m bandit -r ./ -f screen
|
||||||
working-directory: src/bindings/python/src/compatibility/openvino
|
working-directory: src/bindings/python/src/compatibility/openvino
|
||||||
|
|
||||||
|
# layer_tests Flake code-style
|
||||||
|
- name: Run flake8 on python tests in openvino/tests/layer_tests
|
||||||
|
run: |
|
||||||
|
modified_files=$(git diff --name-only)
|
||||||
|
for file in $modified_files; do
|
||||||
|
if [[ $file == "openvino/tests/layer_tests/"* ]]; then
|
||||||
|
if [[ -f "$file" ]]; then
|
||||||
|
python -m flake8 "$file" --config= ./setup.cfg
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
# Copyright (C) 2018-2023 Intel Corporation
|
# Copyright (C) 2018-2023 Intel Corporation
|
||||||
# SPDX-License-Identifier: Apache-2.0
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
# Copyright (C) 2022 Intel Corporation
|
# Copyright (C) 2022 Intel Corporation
|
||||||
# SPDX-License-Identifier: Apache-2.0
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
@ -8,10 +9,12 @@ import re
|
|||||||
|
|
||||||
class TagFilter(log.Filter):
|
class TagFilter(log.Filter):
|
||||||
def __init__(self, regex):
|
def __init__(self, regex):
|
||||||
|
"""Initialize the TagFilter with a regular expression."""
|
||||||
log.Filter.__init__(self)
|
log.Filter.__init__(self)
|
||||||
self.regex = regex
|
self.regex = regex
|
||||||
|
|
||||||
def filter(self, record):
|
def filter(self, record): # noqa: A003
|
||||||
|
"""Filter the log record based on the provided regex."""
|
||||||
if record.__dict__['funcName'] == 'load_grammar': # for nx not to log into our logs
|
if record.__dict__['funcName'] == 'load_grammar': # for nx not to log into our logs
|
||||||
return False
|
return False
|
||||||
if self.regex:
|
if self.regex:
|
||||||
@ -20,15 +23,16 @@ class TagFilter(log.Filter):
|
|||||||
return re.findall(self.regex, tag)
|
return re.findall(self.regex, tag)
|
||||||
else:
|
else:
|
||||||
return False
|
return False
|
||||||
else: # if regex wasn't set print all logs
|
else: # if regex wasn't set, print all logs
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
def init_logger(lvl):
|
def init_logger(lvl):
|
||||||
|
"""Initialize the logger with the specified log level."""
|
||||||
logger = log.getLogger(__name__)
|
logger = log.getLogger(__name__)
|
||||||
log_exp = os.environ.get('MO_LOG_PATTERN')
|
log_exp = os.environ.get('MO_LOG_PATTERN')
|
||||||
log.basicConfig(
|
log.basicConfig(
|
||||||
format='%(levelname)s: %(module)s. %(funcName)s():%(lineno)d - %(message)s',
|
format='%(levelname)s: %(module)s. %(funcName)s():%(lineno)d - %(message)s',
|
||||||
level=lvl
|
level=lvl,
|
||||||
)
|
)
|
||||||
logger.addFilter(TagFilter(log_exp))
|
logger.addFilter(TagFilter(log_exp))
|
||||||
|
Loading…
Reference in New Issue
Block a user