Skip to content

Commit

Permalink
Merge pull request #150 from neutrons/pre-commit-ci-update-config
Browse files Browse the repository at this point in the history
[pre-commit.ci] pre-commit autoupdate
  • Loading branch information
rosswhitfield authored Apr 29, 2024
2 parents 2fb877c + e034651 commit 44604d5
Show file tree
Hide file tree
Showing 24 changed files with 31 additions and 8 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@ jobs:
export DJANGO_SETTINGS_MODULE='reporting.reporting_app.settings.unittest'
python -m pytest --cov --cov-report=xml --cov-report=term src
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v1
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
- name: Build documentation
run: |
conda activate webmon
Expand Down
6 changes: 3 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
rev: v4.6.0
hooks:
- id: trailing-whitespace
- id: check-docstring-first
Expand All @@ -16,11 +16,11 @@ repos:
- id: end-of-file-fixer
- id: sort-simple-yaml
- repo: https://github.com/psf/black
rev: 23.3.0
rev: 24.4.0
hooks:
- id: black
args: ['--line-length=119']
- repo: https://github.com/PyCQA/flake8
rev: 6.0.0
rev: 7.0.0
hooks:
- id: flake8
4 changes: 2 additions & 2 deletions src/dasmon_app/dasmon_listener/amq_consumer.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,10 +189,10 @@ def on_message(self, frame):
# elif 'timestamp' in data_dict:
# timestamp = data_dict['timestamp']
for key in data_dict:
if key == "monitors" and type(data_dict[key]) == dict:
if key == "monitors" and isinstance(data_dict[key], dict):
for item in data_dict[key]:
# Protect against old API
if not type(data_dict[key][item]) == dict:
if not isinstance(data_dict[key][item], dict):
key_id = self.retrieve_parameter("monitor_count_%s" % str(item))
store_and_cache(
instrument,
Expand Down
1 change: 1 addition & 0 deletions src/dasmon_app/dasmon_listener/listener_daemon.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
DASMON listener daemon
"""

import sys
import argparse

Expand Down
1 change: 1 addition & 0 deletions src/webmon_app/reporting/dasmon/legacy_status.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
@author: M. Doucet, Oak Ridge National Laboratory
@copyright: 2015 Oak Ridge National Laboratory
"""

import httplib2
import json
import logging
Expand Down
1 change: 1 addition & 0 deletions src/webmon_app/reporting/dasmon/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
@author: M. Doucet, Oak Ridge National Laboratory
@copyright: 2015 Oak Ridge National Laboratory
"""

from django.db import models
from reporting.report.models import Instrument

Expand Down
3 changes: 2 additions & 1 deletion src/webmon_app/reporting/dasmon/view_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
@author: M. Doucet, Oak Ridge National Laboratory
@copyright: 2014 Oak Ridge National Laboratory
"""

from reporting.report.models import Instrument, DataRun, WorkflowSummary
from reporting.dasmon.models import (
Parameter,
Expand Down Expand Up @@ -1082,7 +1083,7 @@ def get_signals(instrument_id):
if len(latests) == 0:
latests = PVStringCache.objects.filter(instrument=instrument_id, name=item.pv_name)
latest = latests.latest("update_time")
if type(latest.value) == float:
if isinstance(latest.value, float):
value = "%g" % latest.value
else:
value = "%s" % latest.value
Expand Down
1 change: 1 addition & 0 deletions src/webmon_app/reporting/pvmon/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
@author: M. Doucet, Oak Ridge National Laboratory
@copyright: 2014 Oak Ridge National Laboratory
"""

from django.db import models
from reporting.report.models import Instrument

Expand Down
1 change: 1 addition & 0 deletions src/webmon_app/reporting/pvmon/views.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Live PV monitoring
"""

from django.http import HttpResponse
from django.shortcuts import render, get_object_or_404
from django.urls import reverse
Expand Down
3 changes: 2 additions & 1 deletion src/webmon_app/reporting/reduction/view_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
@author: M. Doucet, Oak Ridge National Laboratory
@copyright: 2014 Oak Ridge National Laboratory
"""

from django.conf import settings
from django.urls import reverse
import logging
Expand Down Expand Up @@ -79,7 +80,7 @@ def send_template_request(instrument_id, template_dict, user="unknown"):
"""
use_default = False
if "use_default" in template_dict:
if type(template_dict["use_default"]) == bool:
if isinstance(template_dict["use_default"], bool):
use_default = template_dict["use_default"]
else:
use_default = template_dict["use_default"].lower() == "true"
Expand Down
1 change: 1 addition & 0 deletions src/webmon_app/reporting/report/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@
reporting app. The models are defined in the workflow manager and should be
installed on the system before running the app.
"""

from workflow.database.report.models import * # noqa: F401, F403
1 change: 1 addition & 0 deletions src/webmon_app/reporting/report/view_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
@author: M. Doucet, Oak Ridge National Laboratory
@copyright: 2014 Oak Ridge National Laboratory
"""

import logging
import json
import datetime
Expand Down
1 change: 1 addition & 0 deletions src/webmon_app/reporting/reporting_app/settings/develop.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""This is the settings to be used for a local developer build inside of docker"""

from .base import * # noqa
import ldap

Expand Down
1 change: 1 addition & 0 deletions src/webmon_app/reporting/reporting_app/settings/envtest.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""This is the settings to be used for a remote test deploy"""

from .base import * # noqa

# symbols to make flake8 happy
Expand Down
1 change: 1 addition & 0 deletions src/webmon_app/reporting/reporting_app/settings/prod.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""This is the settings to be used for a remote production deploy"""

from .base import * # noqa
from os import environ

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""This configuration is meant for running the unittests outside of docker"""

from .base import * # noqa
from .base import INSTALLED_APPS

Expand Down
1 change: 1 addition & 0 deletions src/webmon_app/reporting/reporting_app/view_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
@copyright: 2014 Oak Ridge National Laboratory
"""

from django.conf import settings
import logging

Expand Down
1 change: 1 addition & 0 deletions src/webmon_app/reporting/reporting_app/wsgi.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
framework.
"""

import os

os.environ.setdefault("DJANGO_SETTINGS_MODULE", "reporting.reporting_app.settings.develop")
Expand Down
1 change: 1 addition & 0 deletions src/webmon_app/reporting/users/views.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
User management
"""

from django.shortcuts import render, redirect
from django.urls import reverse
from django.contrib.auth import login, logout, authenticate
Expand Down
1 change: 1 addition & 0 deletions src/workflow_app/workflow/states.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
To add an action for a specific queue, add a StateAction class
with the name of the queue in lower-case, replacing periods with underscores.
"""

from .state_utilities import logged_action
from .settings import POSTPROCESS_ERROR, CATALOG_DATA_READY
from .settings import REDUCTION_DATA_READY, REDUCTION_CATALOG_DATA_READY
Expand Down
1 change: 1 addition & 0 deletions src/workflow_app/workflow/workflow_process.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Actual process that each data run must go through.
"""

import json
import logging
import datetime
Expand Down
1 change: 1 addition & 0 deletions tests/simple_producer.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Example of a simple non-listening producer
"""

import stomp
import json
import time
Expand Down
1 change: 1 addition & 0 deletions tests/test_autoreducer_high_memory.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
"""This is to test that the reduction tasks go to the correct autoreducer node
depending on if it requires high memoery or not"""

import psycopg2
import requests
import time
Expand Down
1 change: 1 addition & 0 deletions tests/workflow_command.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
ActiveMQ client used to issue commands to the post-processing workflow.
NOTE: Only works for runs that are already in the DB
"""

from report.models import Instrument, DataRun
from workflow.settings import BROKERS, ICAT_USER, ICAT_PASSCODE
import argparse
Expand Down

0 comments on commit 44604d5

Please sign in to comment.