From 60eaf9ea87395f92b1837f86da0d41b5d15b894d Mon Sep 17 00:00:00 2001 From: fabcor Date: Fri, 18 Oct 2024 15:45:25 +0200 Subject: [PATCH] Enforce usage of isort Update the configuration for isort. Enforce usage of isort via a pre-commit hook. --- .isort.cfg | 13 +-- .pre-commit-config.yaml | 5 + deprecated/Command/Exporter/MDClient.py | 5 +- deprecated/HardwareObjects/Camera.py | 12 ++- deprecated/HardwareObjects/EnhancedPopen.py | 6 +- deprecated/HardwareObjects/NamedState.py | 4 +- .../HardwareObjects/Server/Daemonize.py | 2 +- .../Server/SimpleXMLReadWriteSupport.py | 10 +- deprecated/HardwareObjects/Server/__init__.py | 6 +- deprecated/HardwareObjects/SpecMotor.py | 3 +- .../HardwareObjects/SpecMotorWPositions.py | 3 +- deprecated/HardwareObjects/SpecScan.py | 6 +- deprecated/HardwareObjects/SpecShell.py | 1 + deprecated/HardwareObjects/SpecState.py | 1 + .../HardwareObjects/TacoDevice_MTSafe.py | 7 +- .../HardwareObjects/mockup/CameraMockup.py | 6 +- .../HardwareObjects/mockup/MachInfoMockup.py | 3 +- .../mockup/MultiCollectMockup.py | 10 +- .../HardwareObjects/mockup/Oxford700Mockup.py | 10 +- .../HardwareObjects/mockup/VideoMockup.py | 2 + mxcubecore/BaseHardwareObjects.py | 39 +++++--- mxcubecore/Command/Epics.py | 8 +- mxcubecore/Command/Exporter.py | 8 +- mxcubecore/Command/Mockup.py | 6 +- mxcubecore/Command/Pool.py | 4 +- mxcubecore/Command/Sardana.py | 20 ++-- mxcubecore/Command/Spec.py | 8 +- mxcubecore/Command/Taco.py | 9 +- mxcubecore/Command/Tango.py | 7 +- mxcubecore/Command/Tine.py | 13 ++- mxcubecore/Command/exporter/ExporterClient.py | 6 +- mxcubecore/Command/exporter/ExporterStates.py | 1 + mxcubecore/Command/exporter/MDEvents.py | 4 +- mxcubecore/Command/exporter/StandardClient.py | 3 +- mxcubecore/CommandContainer.py | 19 +++- mxcubecore/HardwareObjectFileParser.py | 1 - .../ALBA/ALBAAutoProcessing.py | 18 ++-- .../HardwareObjects/ALBA/ALBABackLight.py | 8 +- .../HardwareObjects/ALBA/ALBABeamInfo.py | 1 + .../HardwareObjects/ALBA/ALBACalibration.py | 5 +- mxcubecore/HardwareObjects/ALBA/ALBACats.py | 11 ++- .../HardwareObjects/ALBA/ALBACatsMaint.py | 4 +- .../HardwareObjects/ALBA/ALBAClusterJob.py | 8 +- .../HardwareObjects/ALBA/ALBACollect.py | 11 ++- .../HardwareObjects/ALBA/ALBADataAnalysis.py | 18 ++-- mxcubecore/HardwareObjects/ALBA/ALBAEnergy.py | 2 +- .../HardwareObjects/ALBA/ALBAEpsActuator.py | 5 +- .../HardwareObjects/ALBA/ALBAFastShutter.py | 5 +- mxcubecore/HardwareObjects/ALBA/ALBAFlux.py | 8 +- .../HardwareObjects/ALBA/ALBAFrontEnd.py | 5 +- .../HardwareObjects/ALBA/ALBAFrontLight.py | 3 +- .../HardwareObjects/ALBA/ALBAISPyBClient.py | 3 +- .../HardwareObjects/ALBA/ALBAMachineInfo.py | 8 +- .../HardwareObjects/ALBA/ALBAMiniDiff.py | 8 +- .../HardwareObjects/ALBA/ALBAPilatus.py | 9 +- .../HardwareObjects/ALBA/ALBASession.py | 2 +- .../HardwareObjects/ALBA/ALBASupervisor.py | 3 +- .../HardwareObjects/ALBA/ALBAZoomMotor.py | 6 +- .../ALBA/ALBAZoomMotorAutoBrightness.py | 3 +- .../HardwareObjects/ALBA/XalocCalibration.py | 2 +- .../HardwareObjects/ALBA/XalocMachineInfo.py | 8 +- .../HardwareObjects/ALBA/XalocMiniDiff.py | 8 +- mxcubecore/HardwareObjects/Attenuators.py | 1 + mxcubecore/HardwareObjects/BeamInfo.py | 3 +- mxcubecore/HardwareObjects/Beamline.py | 19 +++- mxcubecore/HardwareObjects/BeamlineActions.py | 20 ++-- mxcubecore/HardwareObjects/Bliss.py | 9 +- mxcubecore/HardwareObjects/BlissActuator.py | 4 +- mxcubecore/HardwareObjects/BlissEnergy.py | 4 +- .../HardwareObjects/BlissHutchTrigger.py | 4 +- mxcubecore/HardwareObjects/BlissMotor.py | 4 +- .../HardwareObjects/BlissMotorWPositions.py | 3 +- mxcubecore/HardwareObjects/BlissNState.py | 1 + mxcubecore/HardwareObjects/BlissShutter.py | 8 +- mxcubecore/HardwareObjects/Camera.py | 12 ++- mxcubecore/HardwareObjects/Cats90.py | 4 +- mxcubecore/HardwareObjects/CatsBessy.py | 5 +- mxcubecore/HardwareObjects/CatsMaint.py | 9 +- mxcubecore/HardwareObjects/CentringMath.py | 8 +- mxcubecore/HardwareObjects/DESY/Centring.py | 14 +-- .../HardwareObjects/DESY/DigitalZoomMotor.py | 7 +- .../HardwareObjects/DESY/MjpgStreamVideo.py | 13 ++- .../HardwareObjects/DESY/P11AlbulaView.py | 5 +- .../HardwareObjects/DESY/P11BackLight.py | 15 ++- mxcubecore/HardwareObjects/DESY/P11Beam.py | 9 +- .../HardwareObjects/DESY/P11BeamStop.py | 5 +- mxcubecore/HardwareObjects/DESY/P11Collect.py | 17 ++-- .../HardwareObjects/DESY/P11Collimator.py | 3 +- .../HardwareObjects/DESY/P11DetectorCover.py | 6 +- .../DESY/P11DetectorDistance.py | 3 +- .../HardwareObjects/DESY/P11DoorInterlock.py | 3 +- .../DESY/P11EDNACharacterisation.py | 50 +++++----- .../HardwareObjects/DESY/P11EigerDetector.py | 1 + mxcubecore/HardwareObjects/DESY/P11Energy.py | 6 +- .../HardwareObjects/DESY/P11FastShutter.py | 5 +- mxcubecore/HardwareObjects/DESY/P11Flux.py | 9 +- .../HardwareObjects/DESY/P11ISPyBClient.py | 7 +- .../HardwareObjects/DESY/P11MachineInfo.py | 8 +- .../HardwareObjects/DESY/P11NanoDiff.py | 46 +++++---- mxcubecore/HardwareObjects/DESY/P11Pinhole.py | 3 +- .../HardwareObjects/DESY/P11SampleChanger.py | 4 +- mxcubecore/HardwareObjects/DESY/P11Session.py | 10 +- mxcubecore/HardwareObjects/DESY/P11Shutter.py | 12 ++- .../HardwareObjects/DESY/P11Transmission.py | 4 +- .../HardwareObjects/DESY/P11YagDiode.py | 3 +- mxcubecore/HardwareObjects/DESY/P11Zoom.py | 8 +- mxcubecore/HardwareObjects/DataPublisher.py | 9 +- .../HardwareObjects/DozorOnlineProcessing.py | 13 +-- .../HardwareObjects/EDNACharacterisation.py | 50 +++++----- .../HardwareObjects/EMBL/EMBLAperture.py | 4 +- mxcubecore/HardwareObjects/EMBL/EMBLBSD.py | 8 +- mxcubecore/HardwareObjects/EMBL/EMBLBeam.py | 3 +- .../HardwareObjects/EMBL/EMBLBeamCentering.py | 6 +- .../HardwareObjects/EMBL/EMBLBeamFocusing.py | 3 +- .../HardwareObjects/EMBL/EMBLBeamline.py | 9 +- .../HardwareObjects/EMBL/EMBLBeamlineTest.py | 25 +++-- .../HardwareObjects/EMBL/EMBLBeamstop.py | 1 - mxcubecore/HardwareObjects/EMBL/EMBLCRL.py | 6 +- .../HardwareObjects/EMBL/EMBLCollect.py | 6 +- .../HardwareObjects/EMBL/EMBLDetector.py | 5 +- .../HardwareObjects/EMBL/EMBLDoorInterlock.py | 5 +- mxcubecore/HardwareObjects/EMBL/EMBLEnergy.py | 2 +- .../HardwareObjects/EMBL/EMBLEnergyScan.py | 13 +-- .../EMBL/EMBLExporterClient.py | 1 - mxcubecore/HardwareObjects/EMBL/EMBLFlux.py | 12 +-- .../HardwareObjects/EMBL/EMBLImageTracking.py | 1 - .../HardwareObjects/EMBL/EMBLMachineInfo.py | 12 ++- .../HardwareObjects/EMBL/EMBLMiniDiff.py | 13 +-- .../HardwareObjects/EMBL/EMBLMotorsGroup.py | 5 +- .../EMBL/EMBLOfflineProcessing.py | 7 +- .../EMBL/EMBLOnlineProcessing.py | 11 +-- .../HardwareObjects/EMBL/EMBLPPUControl.py | 1 - .../HardwareObjects/EMBL/EMBLQueueEntry.py | 5 +- .../HardwareObjects/EMBL/EMBLSSXChip.py | 2 +- .../HardwareObjects/EMBL/EMBLSafetyShutter.py | 9 +- .../HardwareObjects/EMBL/EMBLSession.py | 1 - .../HardwareObjects/EMBL/EMBLSlitBox.py | 1 - .../HardwareObjects/EMBL/EMBLTableMotor.py | 2 +- .../HardwareObjects/EMBL/EMBLTransfocator.py | 2 +- .../HardwareObjects/EMBL/EMBLXRFSpectrum.py | 9 +- .../HardwareObjects/EMBL/EMBLXrayImaging.py | 31 +++--- .../HardwareObjects/EMBL/MDFastShutter.py | 7 +- mxcubecore/HardwareObjects/EMBL/TINEMotor.py | 2 +- mxcubecore/HardwareObjects/EMBLFlexHCD.py | 10 +- .../HardwareObjects/EMBLFlexHarvester.py | 6 +- .../HardwareObjects/ESRF/BM14EnergyScan.py | 7 +- .../HardwareObjects/ESRF/BlissHutchTrigger.py | 9 +- .../HardwareObjects/ESRF/BlissTurret.py | 3 +- mxcubecore/HardwareObjects/ESRF/BlissVolpi.py | 3 +- mxcubecore/HardwareObjects/ESRF/ESRFBeam.py | 2 +- .../HardwareObjects/ESRF/ESRFBeamDefiner.py | 1 + .../HardwareObjects/ESRF/ESRFBeamInfo.py | 3 +- .../ESRF/ESRFBeamlineActions.py | 3 +- .../HardwareObjects/ESRF/ESRFCryoMon.py | 6 +- .../HardwareObjects/ESRF/ESRFEnergyScan.py | 18 ++-- mxcubecore/HardwareObjects/ESRF/ESRFMD2SC3.py | 5 +- .../ESRF/ESRFMetadataManagerClient.py | 12 ++- .../HardwareObjects/ESRF/ESRFMultiCollect.py | 14 +-- .../HardwareObjects/ESRF/ESRFPhotonFlux.py | 1 + mxcubecore/HardwareObjects/ESRF/ESRFSC3.py | 8 +- .../HardwareObjects/ESRF/ESRFSession.py | 9 +- .../ESRF/ESRFSmallXrayCentring.py | 16 +-- .../HardwareObjects/ESRF/ESRFXRFSpectrum.py | 12 ++- .../HardwareObjects/ESRF/ID231BeamCmds.py | 6 +- .../HardwareObjects/ESRF/ID231BeamInfo.py | 3 +- .../HardwareObjects/ESRF/ID231EnergyScan.py | 6 +- .../HardwareObjects/ESRF/ID231MultiCollect.py | 9 +- .../HardwareObjects/ESRF/ID232BeamCmds.py | 6 +- .../HardwareObjects/ESRF/ID232BeamDefiner.py | 7 +- .../HardwareObjects/ESRF/ID232BeamInfo.py | 2 +- .../HardwareObjects/ESRF/ID232HutchTrigger.py | 8 +- .../HardwareObjects/ESRF/ID232MultiCollect.py | 14 ++- .../HardwareObjects/ESRF/ID232PhotonFlux.py | 2 +- .../HardwareObjects/ESRF/ID23PhotonFlux.py | 6 +- .../HardwareObjects/ESRF/ID29BeamCmds.py | 6 +- .../HardwareObjects/ESRF/ID29EnergyScan.py | 7 +- .../HardwareObjects/ESRF/ID29HutchTrigger.py | 8 +- .../HardwareObjects/ESRF/ID29MultiCollect.py | 14 ++- .../HardwareObjects/ESRF/ID29PhotonFlux.py | 8 +- .../HardwareObjects/ESRF/ID29XRFSpectrum.py | 18 ++-- .../ESRF/ID30A1MultiCollect.py | 14 ++- .../HardwareObjects/ESRF/ID30A3BeamCmds.py | 1 + .../HardwareObjects/ESRF/ID30A3BeamDefiner.py | 1 + .../ESRF/ID30A3MultiCollect.py | 15 ++- .../HardwareObjects/ESRF/ID30A3PhotonFlux.py | 6 +- .../HardwareObjects/ESRF/ID30BBeamCmds.py | 7 +- .../HardwareObjects/ESRF/ID30BEnergyScan.py | 9 +- .../HardwareObjects/ESRF/ID30BPhotonFlux.py | 1 + .../HardwareObjects/ESRF/ID30BXRFSpectrum.py | 8 +- .../HardwareObjects/ESRF/ID30BeamCmds.py | 8 +- .../HardwareObjects/ESRF/ID30BeamInfo.py | 2 +- mxcubecore/HardwareObjects/ESRF/ID30Cryo.py | 6 +- .../HardwareObjects/ESRF/ID30HutchTrigger.py | 10 +- mxcubecore/HardwareObjects/ESRF/ID30Light.py | 6 +- mxcubecore/HardwareObjects/ESRF/ID30SC3.py | 5 +- .../HardwareObjects/ESRF/MD2MultiCollect.py | 11 ++- mxcubecore/HardwareObjects/ESRF/Oxford700.py | 10 +- .../HardwareObjects/ESRF/OxfordCryostream.py | 9 +- .../ESRF/TangoKeithleyPhotonFlux.py | 5 +- .../ESRF/queue_entry/ssx_base_queue_entry.py | 19 ++-- .../queue_entry/ssx_big_foil_collection.py | 26 +++-- .../ESRF/queue_entry/ssx_chip_collection.py | 25 ++--- .../ESRF/queue_entry/ssx_foil_collection.py | 23 ++--- .../queue_entry/ssx_injector_collection.py | 26 +++-- .../ESRF/queue_entry/test_collection.py | 21 ++-- mxcubecore/HardwareObjects/EdnaWorkflow.py | 13 +-- mxcubecore/HardwareObjects/Energy.py | 2 + mxcubecore/HardwareObjects/ExporterMotor.py | 12 ++- mxcubecore/HardwareObjects/ExporterNState.py | 9 +- mxcubecore/HardwareObjects/FlexHCD.py | 7 +- .../HardwareObjects/FlexHCDMaintenance.py | 2 +- .../HardwareObjects/GenericDiffractometer.py | 29 ++++-- .../HardwareObjects/Gphl/CollectEmulator.py | 11 ++- .../HardwareObjects/Gphl/GphlMessages.py | 16 ++- .../HardwareObjects/Gphl/GphlQueueEntry.py | 4 +- .../HardwareObjects/Gphl/GphlWorkflow.py | 37 ++++--- .../Gphl/GphlWorkflowConnection.py | 36 ++++--- .../Gphl/Transcal2MiniKappa.py | 10 +- mxcubecore/HardwareObjects/Grob.py | 3 +- mxcubecore/HardwareObjects/GrobMotor.py | 6 +- .../HardwareObjects/GrobSampleChanger.py | 4 +- mxcubecore/HardwareObjects/Harvester.py | 4 +- .../HardwareObjects/HarvesterMaintenance.py | 6 +- mxcubecore/HardwareObjects/ISARAMaint.py | 7 +- mxcubecore/HardwareObjects/ISPyBClient.py | 18 ++-- mxcubecore/HardwareObjects/ISPyBRestClient.py | 14 ++- .../HardwareObjects/LNLS/EPICSActuator.py | 4 +- mxcubecore/HardwareObjects/LNLS/EPICSMotor.py | 1 + .../HardwareObjects/LNLS/EPICSNState.py | 2 +- .../HardwareObjects/LNLS/LNLSAperture.py | 4 +- mxcubecore/HardwareObjects/LNLS/LNLSBeam.py | 5 +- mxcubecore/HardwareObjects/LNLS/LNLSCamera.py | 6 +- .../HardwareObjects/LNLS/LNLSCollect.py | 15 +-- .../HardwareObjects/LNLS/LNLSDetDistMotor.py | 2 +- .../LNLS/LNLSDiffractometer.py | 9 +- mxcubecore/HardwareObjects/LNLS/LNLSEnergy.py | 3 +- .../HardwareObjects/LNLS/LNLSPilatusDet.py | 7 +- mxcubecore/HardwareObjects/LNLS/LNLSSlits.py | 1 - .../HardwareObjects/LNLS/LNLSTransmission.py | 8 +- mxcubecore/HardwareObjects/LNLS/LNLSZoom.py | 9 +- .../LNLS/read_transmission_mnc.py | 4 +- .../LNLS/set_transmission_mnc.py | 3 +- .../HardwareObjects/LdapAuthenticator.py | 1 + mxcubecore/HardwareObjects/Lima2Detector.py | 16 ++- .../HardwareObjects/LimaEigerDetector.py | 13 +-- .../HardwareObjects/LimaJungfrauDetector.py | 9 +- .../HardwareObjects/LimaPilatusDetector.py | 15 ++- .../HardwareObjects/MAXIV/BIOMAXAperture.py | 1 + .../HardwareObjects/MAXIV/BIOMAXBeamInfo.py | 2 +- .../MAXIV/BIOMAXBeamlineActions.py | 5 +- .../HardwareObjects/MAXIV/BIOMAXCollect.py | 18 ++-- .../HardwareObjects/MAXIV/BIOMAXEiger.py | 12 ++- .../HardwareObjects/MAXIV/BIOMAXEnergy.py | 4 +- .../HardwareObjects/MAXIV/BIOMAXKafka.py | 8 +- mxcubecore/HardwareObjects/MAXIV/BIOMAXMD3.py | 14 +-- .../HardwareObjects/MAXIV/BIOMAXMD3Camera.py | 15 ++- .../HardwareObjects/MAXIV/BIOMAXPatches.py | 8 +- .../HardwareObjects/MAXIV/BIOMAXResolution.py | 2 +- .../MAXIV/BIOMAXTransmission.py | 3 +- .../MAXIV/MAXIVAutoProcessing.py | 17 ++-- mxcubecore/HardwareObjects/MAXIV/MachInfo.py | 11 ++- .../HardwareObjects/MAXIV/MaxIVSession.py | 9 +- .../HardwareObjects/MAXIV/autoProcLauncher.py | 12 +-- .../HardwareObjects/MAXIV/ednaProcLauncher.py | 10 +- mxcubecore/HardwareObjects/MD2Motor.py | 7 +- mxcubecore/HardwareObjects/MD3UP.py | 7 +- mxcubecore/HardwareObjects/MachCurrent.py | 5 +- mxcubecore/HardwareObjects/Marvin.py | 11 +-- mxcubecore/HardwareObjects/Microdiff.py | 12 ++- .../HardwareObjects/MicrodiffActuator.py | 5 +- .../HardwareObjects/MicrodiffAperture.py | 1 + .../HardwareObjects/MicrodiffFocusMotor.py | 2 +- mxcubecore/HardwareObjects/MicrodiffInOut.py | 3 +- .../HardwareObjects/MicrodiffKappaMotor.py | 4 +- mxcubecore/HardwareObjects/MicrodiffLight.py | 2 +- mxcubecore/HardwareObjects/MicrodiffMotor.py | 2 + .../HardwareObjects/MicrodiffSamplePseudo.py | 5 +- mxcubecore/HardwareObjects/MicrodiffZoom.py | 1 + mxcubecore/HardwareObjects/MiniDiff.py | 21 ++-- .../HardwareObjects/MiniKappaCorrection.py | 4 +- mxcubecore/HardwareObjects/MotorWPositions.py | 1 + mxcubecore/HardwareObjects/MotorsNPosition.py | 2 +- .../HardwareObjects/MultiplePositions.py | 3 +- mxcubecore/HardwareObjects/Native/__init__.py | 10 +- .../HardwareObjects/ObjectsController.py | 3 +- .../HardwareObjects/PlateManipulator.py | 9 +- mxcubecore/HardwareObjects/PyISPyBClient.py | 47 ++++----- mxcubecore/HardwareObjects/QtAxisCamera.py | 11 +-- mxcubecore/HardwareObjects/QtGraphicsLib.py | 6 +- .../HardwareObjects/QtGraphicsManager.py | 28 +++--- .../HardwareObjects/QtInstanceServer.py | 11 ++- mxcubecore/HardwareObjects/QtLimaVideo.py | 4 +- .../HardwareObjects/QtTangoLimaVideo.py | 6 +- mxcubecore/HardwareObjects/QueueManager.py | 5 +- mxcubecore/HardwareObjects/QueueModel.py | 7 +- mxcubecore/HardwareObjects/RedisClient.py | 8 +- mxcubecore/HardwareObjects/Resolution.py | 4 +- mxcubecore/HardwareObjects/Robodiff.py | 3 +- mxcubecore/HardwareObjects/RobodiffLight.py | 6 +- mxcubecore/HardwareObjects/RobodiffMotor.py | 5 +- .../RobodiffMotorWPositions.py | 3 +- mxcubecore/HardwareObjects/SC3.py | 6 +- .../SOLEIL/PX1/PX1Attenuator.py | 1 + .../SOLEIL/PX1/PX1CatsMaint.py | 6 +- .../HardwareObjects/SOLEIL/PX1/PX1Collect.py | 18 ++-- .../HardwareObjects/SOLEIL/PX1/PX1Cryotong.py | 11 +-- .../SOLEIL/PX1/PX1DetectorDistance.py | 1 + .../HardwareObjects/SOLEIL/PX1/PX1Energy.py | 9 +- .../SOLEIL/PX1/PX1EnergyScan.py | 23 ++--- .../SOLEIL/PX1/PX1Environment.py | 6 +- .../HardwareObjects/SOLEIL/PX1/PX1MiniDiff.py | 11 +-- .../HardwareObjects/SOLEIL/PX1/PX1Pilatus.py | 4 +- .../HardwareObjects/SOLEIL/PX1/PX1Pss.py | 1 + .../SOLEIL/PX1/PX1Resolution.py | 5 +- .../SOLEIL/PX1/PX1TangoLight.py | 1 + .../SOLEIL/PX2/PX2Attenuator.py | 3 +- .../HardwareObjects/SOLEIL/PX2/PX2BeamInfo.py | 1 + .../HardwareObjects/SOLEIL/PX2/PX2Collect.py | 28 +++--- .../SOLEIL/PX2/PX2Diffractometer.py | 36 +++---- .../HardwareObjects/SOLEIL/PX2/PX2Energy.py | 14 ++- .../SOLEIL/PX2/PX2Guillotine.py | 1 + .../SOLEIL/PX2/PX2Qt4_LimaVideo.py | 6 +- .../SOLEIL/PX2/PX2Resolution.py | 8 +- .../HardwareObjects/SOLEIL/PX2/PX2Video.py | 13 ++- .../HardwareObjects/SOLEIL/SOLEILCatsMaint.py | 8 +- .../SOLEIL/SOLEILEnergyScan.py | 10 +- .../HardwareObjects/SOLEIL/SOLEILFlux.py | 3 +- .../SOLEIL/SOLEILGuillotine.py | 3 +- .../SOLEIL/SOLEILISPyBClient.py | 15 +-- .../SOLEIL/SOLEILMachineInfo.py | 10 +- .../HardwareObjects/SOLEIL/SOLEILPss.py | 4 +- .../HardwareObjects/SOLEIL/SOLEILRuche.py | 5 +- .../SOLEIL/SOLEILSafetyShutter.py | 4 +- .../HardwareObjects/SOLEIL/SOLEILSession.py | 3 +- .../SOLEIL/SOLEILqueue_entry.py | 2 +- .../HardwareObjects/SOLEIL/TangoDCMotor.py | 13 +-- mxcubecore/HardwareObjects/SampleView.py | 8 +- mxcubecore/HardwareObjects/SardanaMotor.py | 11 ++- mxcubecore/HardwareObjects/Session.py | 5 +- mxcubecore/HardwareObjects/SimpleHTML.py | 3 +- mxcubecore/HardwareObjects/SpecMotor.py | 3 +- .../HardwareObjects/SpecMotorWPositions.py | 3 +- mxcubecore/HardwareObjects/SpecScan.py | 6 +- mxcubecore/HardwareObjects/SpecShell.py | 6 +- mxcubecore/HardwareObjects/SpecState.py | 1 + mxcubecore/HardwareObjects/StateMachine.py | 7 +- .../HardwareObjects/TangoLimaMpegVideo.py | 1 + mxcubecore/HardwareObjects/TangoLimaVideo.py | 10 +- .../HardwareObjects/TangoLimaVideoDevice.py | 3 +- .../HardwareObjects/TangoLimaVideoLoopback.py | 12 ++- .../HardwareObjects/TangoMachineInfo.py | 5 +- mxcubecore/HardwareObjects/TangoMotor.py | 4 +- mxcubecore/HardwareObjects/TangoShutter.py | 8 +- mxcubecore/HardwareObjects/Transmission.py | 3 +- mxcubecore/HardwareObjects/UnitTest.py | 3 +- mxcubecore/HardwareObjects/VaporyVideo.py | 4 +- mxcubecore/HardwareObjects/VimbaVideo.py | 14 +-- mxcubecore/HardwareObjects/XMLRPCServer.py | 18 ++-- mxcubecore/HardwareObjects/XRFSpectrum.py | 4 +- .../HardwareObjects/XSDataAutoprocv1_0.py | 44 +++++---- mxcubecore/HardwareObjects/XSDataCommon.py | 7 +- .../HardwareObjects/XSDataControlDozorv1_1.py | 40 ++++---- .../HardwareObjects/XSDataMXCuBEv1_3.py | 68 +++++++------ .../HardwareObjects/XSDataMXCuBEv1_4.py | 81 +++++++++------- mxcubecore/HardwareObjects/XSDataMXv1.py | 97 ++++++++++--------- .../abstract/AbstractActuator.py | 1 - .../abstract/AbstractAperture.py | 1 - .../abstract/AbstractAuthenticator.py | 1 + .../HardwareObjects/abstract/AbstractBeam.py | 5 +- .../abstract/AbstractCharacterisation.py | 1 + .../abstract/AbstractCollect.py | 15 +-- .../abstract/AbstractDetector.py | 2 +- .../abstract/AbstractEnergy.py | 3 +- .../abstract/AbstractEnergyScan.py | 8 +- .../HardwareObjects/abstract/AbstractFlux.py | 3 +- .../HardwareObjects/abstract/AbstractMCA.py | 1 + .../abstract/AbstractMachineInfo.py | 1 + .../HardwareObjects/abstract/AbstractMotor.py | 9 +- .../abstract/AbstractMultiCollect.py | 19 ++-- .../abstract/AbstractNState.py | 7 +- .../abstract/AbstractOnlineProcessing.py | 22 ++--- .../abstract/AbstractProcedure.py | 11 ++- .../abstract/AbstractResolution.py | 8 +- .../abstract/AbstractSampleChanger.py | 7 +- .../abstract/AbstractShutter.py | 6 +- .../HardwareObjects/abstract/AbstractSlits.py | 2 +- .../abstract/AbstractTransmission.py | 2 +- .../abstract/AbstractVideoDevice.py | 12 ++- .../abstract/AbstractXRFSpectrum.py | 4 +- .../abstract/AbstractXrayCentring.py | 10 +- .../abstract/sample_changer/Crims.py | 5 +- .../abstract/sample_changer/Sample.py | 1 + mxcubecore/HardwareObjects/autoprocessing.py | 2 +- .../HardwareObjects/mockup/ActuatorMockup.py | 4 +- .../HardwareObjects/mockup/ApertureMockup.py | 1 + .../mockup/BIOMAXEigerMockup.py | 11 ++- .../mockup/BeamDefinerMockup.py | 3 +- .../mockup/BeamlineActionsMockup.py | 13 ++- .../mockup/BeamlineTestMockup.py | 7 +- .../HardwareObjects/mockup/BeamstopMockup.py | 1 - .../HardwareObjects/mockup/CatsMaintMockup.py | 7 +- .../HardwareObjects/mockup/CollectMockup.py | 6 +- .../HardwareObjects/mockup/DetectorMockup.py | 4 +- .../mockup/DiffractometerMockup.py | 8 +- .../mockup/EDNACharacterisationMockup.py | 2 - .../mockup/EnergyScanMockup.py | 14 ++- .../mockup/ExporterNStateMockup.py | 4 +- .../HardwareObjects/mockup/FluxMockup.py | 9 +- .../HardwareObjects/mockup/HarvesterMockup.py | 3 +- .../mockup/ISPyBClientMockup.py | 2 +- .../mockup/ISPyBRestClientMockup.py | 4 +- .../mockup/LimaDetectorMockup.py | 6 +- .../HardwareObjects/mockup/MDCameraMockup.py | 5 +- .../mockup/MachineInfoMockup.py | 4 +- .../mockup/MicrodiffApertureMockup.py | 3 +- .../mockup/MicrodiffInOutMockup.py | 3 +- .../mockup/MicrodiffZoomMockup.py | 7 +- .../HardwareObjects/mockup/MotorMockup.py | 8 +- .../HardwareObjects/mockup/MotorMockupBis.py | 2 +- .../mockup/MultiCollectMockup.py | 14 +-- .../mockup/OfflineProcessingMockup.py | 7 +- .../mockup/OnlineProcessingMockup.py | 2 +- .../mockup/PlateManipulatorMockup.py | 1 + .../HardwareObjects/mockup/PlottingMockup.py | 3 +- .../HardwareObjects/mockup/ProcedureMockup.py | 5 +- .../HardwareObjects/mockup/QtVideoMockup.py | 12 ++- .../mockup/SOLEILCharacterisationMockup.py | 2 +- .../mockup/SampleChangerMockup.py | 2 +- .../HardwareObjects/mockup/ScanMockup.py | 11 ++- .../mockup/ShapeHistoryMockup.py | 2 +- .../HardwareObjects/mockup/ShutterMockup.py | 8 +- .../HardwareObjects/mockup/SlitsMockup.py | 1 - .../mockup/TransmissionMockup.py | 1 - .../HardwareObjects/mockup/XRFMockup.py | 3 +- .../mockup/XRFSpectrumMockup.py | 5 +- .../mockup/XrayCentringMockup.py | 10 +- mxcubecore/HardwareObjects/sample_centring.py | 11 ++- mxcubecore/HardwareRepository.py | 27 ++++-- mxcubecore/Poller.py | 6 +- mxcubecore/TaskUtils.py | 3 +- mxcubecore/__init__.py | 9 +- mxcubecore/configuration/checkxml.py | 11 ++- .../generate_md2_config_files.py | 2 +- mxcubecore/model/common.py | 6 +- mxcubecore/model/configmodel.py | 5 +- mxcubecore/model/crystal_symmetry.py | 5 +- mxcubecore/model/procedure_model.py | 5 +- mxcubecore/model/queue_model_objects.py | 5 +- mxcubecore/queue_entry/__init__.py | 11 +-- mxcubecore/queue_entry/advanced_connector.py | 2 +- mxcubecore/queue_entry/base_queue_entry.py | 16 +-- mxcubecore/queue_entry/characterisation.py | 8 +- mxcubecore/queue_entry/data_collection.py | 7 +- mxcubecore/queue_entry/energy_scan.py | 6 +- mxcubecore/queue_entry/generic_workflow.py | 2 +- mxcubecore/queue_entry/import_helper.py | 4 +- mxcubecore/queue_entry/optical_centring.py | 1 - mxcubecore/queue_entry/test_collection.py | 10 +- mxcubecore/queue_entry/xray_centering.py | 1 - mxcubecore/queue_entry/xray_centering2.py | 1 - mxcubecore/queue_entry/xrf_spectrum.py | 6 +- mxcubecore/saferef.py | 4 +- mxcubecore/utils/conversion.py | 14 ++- mxcubecore/utils/dataobject.py | 3 +- mxcubecore/utils/qt_import.py | 89 +++++++++-------- test/pytest/TestAbstractActuatorBase.py | 3 +- test/pytest/TestAbstractMotorBase.py | 6 +- test/pytest/TestAbstractNStateBase.py | 3 +- test/pytest/TestHardwareObjectBase.py | 12 ++- test/pytest/conftest.py | 8 +- test/pytest/test_aperture.py | 3 +- test/pytest/test_base_hardware_objects.py | 28 +++--- test/pytest/test_beam.py | 3 +- test/pytest/test_beam_definer.py | 3 +- test/pytest/test_beamline_ho_id.py | 8 +- test/pytest/test_command_container.py | 21 +++- test/pytest/test_detector.py | 9 +- test/pytest/test_detector_distance.py | 11 ++- test/pytest/test_energy.py | 4 +- test/pytest/test_flux.py | 1 + test/pytest/test_hwo_isara_maint.py | 14 ++- test/pytest/test_hwo_maxiv_mach_info.py | 8 +- test/pytest/test_mach_info.py | 3 +- test/pytest/test_procedure.py | 3 +- test/pytest/test_resolution.py | 2 +- test/pytest/test_sample_view.py | 8 +- test/pytest/test_shutter.py | 3 +- test/pytest/test_transmission.py | 1 + test/pytest/test_utils_units.py | 11 ++- test/pytest/test_xrf.py | 4 +- 490 files changed, 2401 insertions(+), 1733 deletions(-) diff --git a/.isort.cfg b/.isort.cfg index bbd41af7ab..4923de2c83 100644 --- a/.isort.cfg +++ b/.isort.cfg @@ -1,11 +1,4 @@ [settings] -; see https://github.com/psf/black -multi_line_output=3 -include_trailing_comma=True -force_grid_wrap=0 -combine_as_imports=True -use_parentheses=True -line_length=88 -sections=FUTURE,STDLIB,THIRDPARTY,FIRSTPARTY,LOCALFOLDER -default_section=THIRDPARTY -ensure_newline_before_comments = True +profile=black +py_version=38 +force_grid_wrap=2 diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 8a360004dd..75873ce5b4 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -26,6 +26,11 @@ repos: - --remove-duplicate-keys - --ignore-pass-after-docstring + - repo: https://github.com/pycqa/isort + rev: 5.13.2 + hooks: + - id: isort + - repo: https://github.com/psf/black rev: 24.8.0 # The following version (`24.10.0`) dropped support for Python 3.8. hooks: diff --git a/deprecated/Command/Exporter/MDClient.py b/deprecated/Command/Exporter/MDClient.py index 419eee9689..037a1e666e 100644 --- a/deprecated/Command/Exporter/MDClient.py +++ b/deprecated/Command/Exporter/MDClient.py @@ -1,7 +1,8 @@ -import sys -import time import string +import sys import threading +import time + from Command.exporter.ExporterClient import * SERVER_ADDRESS = "localhost" diff --git a/deprecated/HardwareObjects/Camera.py b/deprecated/HardwareObjects/Camera.py index 25f1a9c4dc..b6dc01b3b7 100644 --- a/deprecated/HardwareObjects/Camera.py +++ b/deprecated/HardwareObjects/Camera.py @@ -16,13 +16,17 @@ """ -from mxcubecore import BaseHardwareObjects -from mxcubecore import CommandContainer -import gevent import logging import os -import time import sys +import time + +import gevent + +from mxcubecore import ( + BaseHardwareObjects, + CommandContainer, +) try: from Qub.CTools.qttools import BgrImageMmap diff --git a/deprecated/HardwareObjects/EnhancedPopen.py b/deprecated/HardwareObjects/EnhancedPopen.py index e5b2c96f92..d0a63be10e 100644 --- a/deprecated/HardwareObjects/EnhancedPopen.py +++ b/deprecated/HardwareObjects/EnhancedPopen.py @@ -1,9 +1,9 @@ +import errno +import fcntl import os +import select import subprocess -import errno import time -import select -import fcntl PIPE = subprocess.PIPE diff --git a/deprecated/HardwareObjects/NamedState.py b/deprecated/HardwareObjects/NamedState.py index b5360c0aff..f442a766a2 100644 --- a/deprecated/HardwareObjects/NamedState.py +++ b/deprecated/HardwareObjects/NamedState.py @@ -17,11 +17,11 @@ # You should have received a copy of the GNU Lesser General Public License # along with MXCuBE. If not, see . +import logging + from mxcubecore import HardwareRepository as HWR from mxcubecore.BaseHardwareObjects import HardwareObject -import logging - class NamedState(HardwareObject): def __init__(self, name): diff --git a/deprecated/HardwareObjects/Server/Daemonize.py b/deprecated/HardwareObjects/Server/Daemonize.py index bc89775a69..4887f0e2de 100644 --- a/deprecated/HardwareObjects/Server/Daemonize.py +++ b/deprecated/HardwareObjects/Server/Daemonize.py @@ -1,5 +1,5 @@ -import sys import os +import sys """This module is used to fork the current process into a daemon. Almost none of this is necessary (or advisable) if your daemon diff --git a/deprecated/HardwareObjects/Server/SimpleXMLReadWriteSupport.py b/deprecated/HardwareObjects/Server/SimpleXMLReadWriteSupport.py index 725a5de63c..dcf1aaf8ba 100644 --- a/deprecated/HardwareObjects/Server/SimpleXMLReadWriteSupport.py +++ b/deprecated/HardwareObjects/Server/SimpleXMLReadWriteSupport.py @@ -1,10 +1,12 @@ -import sys import io +import sys +from xml.sax import ( + SAXParseException, + make_parser, +) +from xml.sax.handler import ContentHandler from xml.sax.saxutils import XMLGenerator -from xml.sax import make_parser -from xml.sax import SAXParseException from xml.sax.xmlreader import AttributesImpl -from xml.sax.handler import ContentHandler _parser = make_parser() diff --git a/deprecated/HardwareObjects/Server/__init__.py b/deprecated/HardwareObjects/Server/__init__.py index faaaa19009..3cf6b651e1 100644 --- a/deprecated/HardwareObjects/Server/__init__.py +++ b/deprecated/HardwareObjects/Server/__init__.py @@ -4,10 +4,12 @@ from xml.sax import SAXParseException from xml.sax.handler import ContentHandler -from SpecClient_gevent import SpecServer -from SpecClient_gevent import SpecMessage import Daemonize import SimpleXMLReadWriteSupport +from SpecClient_gevent import ( + SpecMessage, + SpecServer, +) class XMLNodesWithRolesReadingHandler(ContentHandler): diff --git a/deprecated/HardwareObjects/SpecMotor.py b/deprecated/HardwareObjects/SpecMotor.py index 1717d5a937..412ee2c904 100644 --- a/deprecated/HardwareObjects/SpecMotor.py +++ b/deprecated/HardwareObjects/SpecMotor.py @@ -1,6 +1,7 @@ -from mxcubecore.BaseHardwareObjects import HardwareObject from SpecClient_gevent.SpecMotor import SpecMotorA +from mxcubecore.BaseHardwareObjects import HardwareObject + class SpecMotor(HardwareObject, SpecMotorA): (NOTINITIALIZED, UNUSABLE, READY, MOVESTARTED, MOVING, ONLIMIT) = (0, 1, 2, 3, 4, 5) diff --git a/deprecated/HardwareObjects/SpecMotorWPositions.py b/deprecated/HardwareObjects/SpecMotorWPositions.py index 03b864f166..770c9f9f9d 100644 --- a/deprecated/HardwareObjects/SpecMotorWPositions.py +++ b/deprecated/HardwareObjects/SpecMotorWPositions.py @@ -1,6 +1,7 @@ -from mxcubecore.HardwareObjects import SpecMotor import logging +from mxcubecore.HardwareObjects import SpecMotor + class SpecMotorWPositions(SpecMotor.SpecMotor): def init(self): diff --git a/deprecated/HardwareObjects/SpecScan.py b/deprecated/HardwareObjects/SpecScan.py index f0e4f16cc5..8064e23187 100644 --- a/deprecated/HardwareObjects/SpecScan.py +++ b/deprecated/HardwareObjects/SpecScan.py @@ -1,6 +1,8 @@ try: - from SpecClient_gevent import SpecEventsDispatcher - from SpecClient_gevent import SpecConnectionsManager + from SpecClient_gevent import ( + SpecConnectionsManager, + SpecEventsDispatcher, + ) except ImportError: from SpecClient import SpecEventsDispatcher from SpecClient import SpecConnectionsManager diff --git a/deprecated/HardwareObjects/SpecShell.py b/deprecated/HardwareObjects/SpecShell.py index 0d73ebb1be..280ff51e8a 100644 --- a/deprecated/HardwareObjects/SpecShell.py +++ b/deprecated/HardwareObjects/SpecShell.py @@ -7,6 +7,7 @@ """ import logging + from mxcubecore.BaseHardwareObjects import HardwareObject try: diff --git a/deprecated/HardwareObjects/SpecState.py b/deprecated/HardwareObjects/SpecState.py index 2fa6935a22..ac615cf824 100644 --- a/deprecated/HardwareObjects/SpecState.py +++ b/deprecated/HardwareObjects/SpecState.py @@ -7,6 +7,7 @@ """ import logging + from mxcubecore.BaseHardwareObjects import Procedure try: diff --git a/deprecated/HardwareObjects/TacoDevice_MTSafe.py b/deprecated/HardwareObjects/TacoDevice_MTSafe.py index 722b81b20c..adc4141f84 100644 --- a/deprecated/HardwareObjects/TacoDevice_MTSafe.py +++ b/deprecated/HardwareObjects/TacoDevice_MTSafe.py @@ -1,8 +1,9 @@ # $Id: TacoDevice_MTSafe.py,v 1.5 2004/11/15 12:39:19 guijarro Exp $ -from Taco import * -from threading import RLock -import weakref import types +import weakref +from threading import RLock + +from Taco import * _global_lock = RLock() diff --git a/deprecated/HardwareObjects/mockup/CameraMockup.py b/deprecated/HardwareObjects/mockup/CameraMockup.py index 8ca6852157..2517f8f44e 100644 --- a/deprecated/HardwareObjects/mockup/CameraMockup.py +++ b/deprecated/HardwareObjects/mockup/CameraMockup.py @@ -1,14 +1,16 @@ """Class for cameras connected to framegrabbers run by Taco Device Servers """ -from mxcubecore import BaseHardwareObjects import logging import os -import gevent import time + +import gevent import numpy from PIL import Image +from mxcubecore import BaseHardwareObjects + try: from cStringIO import StringIO except ImportError: diff --git a/deprecated/HardwareObjects/mockup/MachInfoMockup.py b/deprecated/HardwareObjects/mockup/MachInfoMockup.py index 95242bea29..147554dda1 100644 --- a/deprecated/HardwareObjects/mockup/MachInfoMockup.py +++ b/deprecated/HardwareObjects/mockup/MachInfoMockup.py @@ -32,9 +32,10 @@ values['topup_remaining'] """ -import gevent import time +import gevent + from mxcubecore import HardwareRepository as HWR from mxcubecore.BaseHardwareObjects import HardwareObject diff --git a/deprecated/HardwareObjects/mockup/MultiCollectMockup.py b/deprecated/HardwareObjects/mockup/MultiCollectMockup.py index b84185c768..9fe76b8cdb 100644 --- a/deprecated/HardwareObjects/mockup/MultiCollectMockup.py +++ b/deprecated/HardwareObjects/mockup/MultiCollectMockup.py @@ -1,12 +1,14 @@ +import logging +import os +import time + +import gevent + from mxcubecore.BaseHardwareObjects import HardwareObject from mxcubecore.HardwareObjects.abstract.AbstractMultiCollect import ( AbstractMultiCollect, ) from mxcubecore.TaskUtils import task -import logging -import time -import os -import gevent class MultiCollectMockup(AbstractMultiCollect, HardwareObject): diff --git a/deprecated/HardwareObjects/mockup/Oxford700Mockup.py b/deprecated/HardwareObjects/mockup/Oxford700Mockup.py index 8131c52677..32ca4a01c2 100644 --- a/deprecated/HardwareObjects/mockup/Oxford700Mockup.py +++ b/deprecated/HardwareObjects/mockup/Oxford700Mockup.py @@ -1,10 +1,12 @@ # pylint: skip-file -from mxcubecore.BaseHardwareObjects import HardwareObject -from mxcubecore import HardwareRepository as HWR -import gevent -import sys import random +import sys + +import gevent + +from mxcubecore import HardwareRepository as HWR +from mxcubecore.BaseHardwareObjects import HardwareObject CRYO_STATUS = ["OFF", "SATURATED", "READY", "WARNING", "FROZEN", "UNKNOWN"] PHASE_ACTION = { diff --git a/deprecated/HardwareObjects/mockup/VideoMockup.py b/deprecated/HardwareObjects/mockup/VideoMockup.py index 54fdb399cc..e7d5da0bdf 100755 --- a/deprecated/HardwareObjects/mockup/VideoMockup.py +++ b/deprecated/HardwareObjects/mockup/VideoMockup.py @@ -4,8 +4,10 @@ import os import time + import gevent from gui.utils.qt_import import QImage + from mxcubecore import BaseHardwareObjects from mxcubecore.HardwareObjects.Camera import JpegType diff --git a/mxcubecore/BaseHardwareObjects.py b/mxcubecore/BaseHardwareObjects.py index f785b8db37..ee979a1649 100644 --- a/mxcubecore/BaseHardwareObjects.py +++ b/mxcubecore/BaseHardwareObjects.py @@ -20,37 +20,50 @@ from __future__ import absolute_import -import typing import ast import enum -from collections import OrderedDict import logging -from gevent import event, Timeout -from pydantic.v1 import create_model, Field +import typing import warnings - +from collections import OrderedDict from typing import ( TYPE_CHECKING, - Callable, - Iterator, - Union, Any, + Callable, + Dict, Generator, + Iterator, List, - Dict, + Optional, +) +from typing import OrderedDict as TOrderedDict +from typing import ( Tuple, Type, - Optional, - OrderedDict as TOrderedDict, + Union, +) + +from gevent import ( + Timeout, + event, +) +from pydantic.v1 import ( + Field, + create_model, +) +from typing_extensions import ( + Literal, + Self, ) -from typing_extensions import Self, Literal -from mxcubecore.dispatcher import dispatcher from mxcubecore.CommandContainer import CommandContainer +from mxcubecore.dispatcher import dispatcher if TYPE_CHECKING: from logging import Logger + from pydantic.v1 import BaseModel + from .CommandContainer import CommandObject __copyright__ = """ Copyright © 2010-2020 by the MXCuBE collaboration """ diff --git a/mxcubecore/Command/Epics.py b/mxcubecore/Command/Epics.py index a5c465b5d0..b747352965 100644 --- a/mxcubecore/Command/Epics.py +++ b/mxcubecore/Command/Epics.py @@ -18,8 +18,8 @@ # You should have received a copy of the GNU Lesser General Public License # along with MXCuBE. If not, see . -import logging import copy +import logging import time try: @@ -28,9 +28,11 @@ logging.getLogger("HWR").warning("EPICS support not available.") from mxcubecore import Poller +from mxcubecore.CommandContainer import ( + ChannelObject, + CommandObject, +) from mxcubecore.dispatcher import saferef -from mxcubecore.CommandContainer import CommandObject, ChannelObject - __copyright__ = """ Copyright © 2010 - 2020 by MXCuBE Collaboration """ __license__ = "LGPLv3+" diff --git a/mxcubecore/Command/Exporter.py b/mxcubecore/Command/Exporter.py index 7152c8e2a5..5f4ab2a8a1 100644 --- a/mxcubecore/Command/Exporter.py +++ b/mxcubecore/Command/Exporter.py @@ -22,9 +22,15 @@ # from warnings import warn import logging + import gevent from gevent.queue import Queue -from mxcubecore.CommandContainer import CommandObject, ChannelObject + +from mxcubecore.CommandContainer import ( + ChannelObject, + CommandObject, +) + from .exporter import ExporterClient from .exporter.StandardClient import PROTOCOL diff --git a/mxcubecore/Command/Mockup.py b/mxcubecore/Command/Mockup.py index 0e41f49665..0fe57900a9 100755 --- a/mxcubecore/Command/Mockup.py +++ b/mxcubecore/Command/Mockup.py @@ -28,8 +28,10 @@ # import queue -from mxcubecore.CommandContainer import CommandObject, ChannelObject - +from mxcubecore.CommandContainer import ( + ChannelObject, + CommandObject, +) __copyright__ = """ Copyright © 2010 - 2020 by MXCuBE Collaboration """ __license__ = "LGPLv3+" diff --git a/mxcubecore/Command/Pool.py b/mxcubecore/Command/Pool.py index 74cc81b1d0..bad95004e8 100755 --- a/mxcubecore/Command/Pool.py +++ b/mxcubecore/Command/Pool.py @@ -20,6 +20,7 @@ import logging import weakref + import qt try: @@ -27,10 +28,9 @@ except ImportError: import queue - from mxcubecore.CommandContainer import ( - CommandObject, ChannelObject, + CommandObject, ConnectionError, ) diff --git a/mxcubecore/Command/Sardana.py b/mxcubecore/Command/Sardana.py index 3c0a59aa10..7fbe7bcb3b 100644 --- a/mxcubecore/Command/Sardana.py +++ b/mxcubecore/Command/Sardana.py @@ -26,13 +26,13 @@ import logging import os +import gevent +from gevent.event import Event + # import time # import types from mxcubecore.dispatcher import saferef -import gevent -from gevent.event import Event - try: import Queue as queue except ImportError: @@ -42,25 +42,31 @@ from mxcubecore.CommandContainer import ( - CommandObject, ChannelObject, + CommandObject, ConnectionError, ) # This is a site specific module where some of the dependencies might not be capture by the ``pyproject.toml`` during installation try: - from PyTango import DevFailed, ConnectionFailed import PyTango + from PyTango import ( + ConnectionFailed, + DevFailed, + ) except Exception: logging.getLogger("HWR").warning("Pytango is not available in this computer.") # try: - from sardana.taurus.core.tango.sardana import registerExtensions - from taurus import Device, Attribute import taurus + from sardana.taurus.core.tango.sardana import registerExtensions + from taurus import ( + Attribute, + Device, + ) except Exception: logging.getLogger("HWR").warning("Sardana is not available in this computer.") diff --git a/mxcubecore/Command/Spec.py b/mxcubecore/Command/Spec.py index 7eb1d761ba..72a38fc744 100644 --- a/mxcubecore/Command/Spec.py +++ b/mxcubecore/Command/Spec.py @@ -19,16 +19,18 @@ # along with MXCuBE. If not, see . try: + from SpecClient_gevent import SpecVariable from SpecClient_gevent.SpecCommand import SpecCommandA from SpecClient_gevent.SpecVariable import SpecVariableA - from SpecClient_gevent import SpecVariable except ImportError: from SpecClient.SpecCommand import SpecCommandA from SpecClient.SpecVariable import SpecVariableA from SpecClient import SpecVariable -from mxcubecore.CommandContainer import CommandObject, ChannelObject - +from mxcubecore.CommandContainer import ( + ChannelObject, + CommandObject, +) __copyright__ = """ Copyright © 2010 - 2020 by MXCuBE Collaboration """ __license__ = "LGPLv3+" diff --git a/mxcubecore/Command/Taco.py b/mxcubecore/Command/Taco.py index 496a520a85..370aa2a26a 100644 --- a/mxcubecore/Command/Taco.py +++ b/mxcubecore/Command/Taco.py @@ -18,15 +18,18 @@ # You should have received a copy of the GNU Lesser General Public License # along with MXCuBE. If not, see . -import logging import copy +import logging +from mxcubecore.CommandContainer import ( + ChannelObject, + CommandObject, +) from mxcubecore.dispatcher import saferef + from .. import Poller -from mxcubecore.CommandContainer import CommandObject, ChannelObject from .. import TacoDevice_MTSafe as TacoDevice - __copyright__ = """ Copyright © 2010 - 2020 by MXCuBE Collaboration """ __license__ = "LGPLv3+" diff --git a/mxcubecore/Command/Tango.py b/mxcubecore/Command/Tango.py index e656a62090..46be4814af 100644 --- a/mxcubecore/Command/Tango.py +++ b/mxcubecore/Command/Tango.py @@ -19,6 +19,7 @@ # along with MXCuBE. If not, see . import logging + import gevent import gevent.event @@ -27,15 +28,15 @@ except ImportError: import queue +import numpy +from mxcubecore import Poller from mxcubecore.CommandContainer import ( - CommandObject, ChannelObject, + CommandObject, ConnectionError, ) -from mxcubecore import Poller from mxcubecore.dispatcher import saferef -import numpy gevent_version = list(map(int, gevent.__version__.split("."))) diff --git a/mxcubecore/Command/Tine.py b/mxcubecore/Command/Tine.py index b666a64708..7ba3218b16 100755 --- a/mxcubecore/Command/Tine.py +++ b/mxcubecore/Command/Tine.py @@ -18,23 +18,26 @@ # You should have received a copy of the GNU Lesser General Public License # along with MXCuBE. If not, see . +import logging import sys import time -import logging if sys.version_info[0] == 2: import Queue as queue else: import queue -import weakref -import gevent - -from mxcubecore.CommandContainer import CommandObject, ChannelObject import atexit +import weakref +import gevent import tine +from mxcubecore.CommandContainer import ( + ChannelObject, + CommandObject, +) + class TineCommand(CommandObject): def __init__( diff --git a/mxcubecore/Command/exporter/ExporterClient.py b/mxcubecore/Command/exporter/ExporterClient.py index f251a0ffbd..f608bdb884 100644 --- a/mxcubecore/Command/exporter/ExporterClient.py +++ b/mxcubecore/Command/exporter/ExporterClient.py @@ -21,7 +21,11 @@ """Exporter Client implementation""" import logging -from .StandardClient import StandardClient, ProtocolError + +from .StandardClient import ( + ProtocolError, + StandardClient, +) __copyright__ = """ Copyright © 2019 by the MXCuBE collaboration """ __license__ = "LGPLv3+" diff --git a/mxcubecore/Command/exporter/ExporterStates.py b/mxcubecore/Command/exporter/ExporterStates.py index 236a90f952..4b90725362 100644 --- a/mxcubecore/Command/exporter/ExporterStates.py +++ b/mxcubecore/Command/exporter/ExporterStates.py @@ -22,6 +22,7 @@ """ from enum import Enum + from mxcubecore.BaseHardwareObjects import HardwareObjectState __copyright__ = """ Copyright © 2020 by the MXCuBE collaboration """ diff --git a/mxcubecore/Command/exporter/MDEvents.py b/mxcubecore/Command/exporter/MDEvents.py index 0fd40accc2..ac8c4b754d 100644 --- a/mxcubecore/Command/exporter/MDEvents.py +++ b/mxcubecore/Command/exporter/MDEvents.py @@ -1,7 +1,9 @@ import sys -import time import threading +import time + from ExporterClient import ExporterClient + from mxcubecore.Command.exporter.StandardClient import PROTOCOL SERVER_ADDRESS = "localhost" diff --git a/mxcubecore/Command/exporter/StandardClient.py b/mxcubecore/Command/exporter/StandardClient.py index 2f53b2180a..a13e6da3a9 100644 --- a/mxcubecore/Command/exporter/StandardClient.py +++ b/mxcubecore/Command/exporter/StandardClient.py @@ -19,8 +19,9 @@ # along with MXCuBE. If not, see . """ ProtocolError and StandardClient implementation""" -import sys import socket +import sys + import gevent import gevent.lock diff --git a/mxcubecore/CommandContainer.py b/mxcubecore/CommandContainer.py index 99226f2b36..874e83409d 100644 --- a/mxcubecore/CommandContainer.py +++ b/mxcubecore/CommandContainer.py @@ -28,14 +28,22 @@ """ from __future__ import absolute_import -from typing import Any, Callable, Dict, Generator, List, Optional, Tuple, Union -import weakref import logging +import weakref +from typing import ( + Any, + Callable, + Dict, + Generator, + List, + Optional, + Tuple, + Union, +) from mxcubecore.dispatcher import dispatcher - __copyright__ = """ Copyright © 2010 - 2020 by MXCuBE Collaboration """ __license__ = "LGPLv3+" @@ -803,7 +811,10 @@ def add_command( self.name(), ) - from mxcubecore.Command.Sardana import SardanaCommand, SardanaMacro + from mxcubecore.Command.Sardana import ( + SardanaCommand, + SardanaMacro, + ) if cmd_type == "macro" and doorname is not None: try: diff --git a/mxcubecore/HardwareObjectFileParser.py b/mxcubecore/HardwareObjectFileParser.py index 36d1d3816a..870801d1f8 100644 --- a/mxcubecore/HardwareObjectFileParser.py +++ b/mxcubecore/HardwareObjectFileParser.py @@ -28,7 +28,6 @@ from mxcubecore import BaseHardwareObjects - CURRENT_XML = None new_objects_classes = { diff --git a/mxcubecore/HardwareObjects/ALBA/ALBAAutoProcessing.py b/mxcubecore/HardwareObjects/ALBA/ALBAAutoProcessing.py index 8990d358d9..2e50a29ea6 100644 --- a/mxcubecore/HardwareObjects/ALBA/ALBAAutoProcessing.py +++ b/mxcubecore/HardwareObjects/ALBA/ALBAAutoProcessing.py @@ -1,16 +1,20 @@ -from xaloc import XalocJob -from XSDataCommon import XSDataFile, XSDataString, XSDataInteger -from XSDataAutoprocv1_0 import XSDataAutoprocInput -from mxcubecore.BaseHardwareObjects import HardwareObject -from PyTango import DeviceProxy -import os import logging import math +import os +import sys from datetime import datetime from ALBAClusterJob import ALBAEdnaProcJob +from PyTango import DeviceProxy +from xaloc import XalocJob +from XSDataAutoprocv1_0 import XSDataAutoprocInput +from XSDataCommon import ( + XSDataFile, + XSDataInteger, + XSDataString, +) -import sys +from mxcubecore.BaseHardwareObjects import HardwareObject sys.path.append("/beamlines/bl13/controls/devel/pycharm/ALBAClusterClient") diff --git a/mxcubecore/HardwareObjects/ALBA/ALBABackLight.py b/mxcubecore/HardwareObjects/ALBA/ALBABackLight.py index c426dfabc1..48afa53615 100644 --- a/mxcubecore/HardwareObjects/ALBA/ALBABackLight.py +++ b/mxcubecore/HardwareObjects/ALBA/ALBABackLight.py @@ -1,9 +1,11 @@ -from mxcubecore import HardwareRepository as HWR -from mxcubecore.BaseHardwareObjects import HardwareObject import logging -import gevent import time +import gevent + +from mxcubecore import HardwareRepository as HWR +from mxcubecore.BaseHardwareObjects import HardwareObject + class ALBABackLight(HardwareObject): def __init__(self, *args): diff --git a/mxcubecore/HardwareObjects/ALBA/ALBABeamInfo.py b/mxcubecore/HardwareObjects/ALBA/ALBABeamInfo.py index 25a047bdc2..87e0a4064a 100644 --- a/mxcubecore/HardwareObjects/ALBA/ALBABeamInfo.py +++ b/mxcubecore/HardwareObjects/ALBA/ALBABeamInfo.py @@ -20,6 +20,7 @@ """ import logging + from mxcubecore.BaseHardwareObjects import HardwareObject diff --git a/mxcubecore/HardwareObjects/ALBA/ALBACalibration.py b/mxcubecore/HardwareObjects/ALBA/ALBACalibration.py index e781b573a4..c08a534e61 100644 --- a/mxcubecore/HardwareObjects/ALBA/ALBACalibration.py +++ b/mxcubecore/HardwareObjects/ALBA/ALBACalibration.py @@ -38,10 +38,11 @@ """ -from mxcubecore import HardwareRepository as HWR -from mxcubecore import BaseHardwareObjects import logging +from mxcubecore import BaseHardwareObjects +from mxcubecore import HardwareRepository as HWR + __author__ = "Jordi Andreu" __credits__ = ["MXCuBE collaboration"] diff --git a/mxcubecore/HardwareObjects/ALBA/ALBACats.py b/mxcubecore/HardwareObjects/ALBA/ALBACats.py index b292f2deff..ebf2ba465b 100644 --- a/mxcubecore/HardwareObjects/ALBA/ALBACats.py +++ b/mxcubecore/HardwareObjects/ALBA/ALBACats.py @@ -1,15 +1,16 @@ from __future__ import print_function +import logging +import time + +import gevent + from mxcubecore.HardwareObjects.Cats90 import ( + TOOL_SPINE, Cats90, SampleChangerState, - TOOL_SPINE, ) -import logging -import time -import gevent - TIMEOUT = 3 diff --git a/mxcubecore/HardwareObjects/ALBA/ALBACatsMaint.py b/mxcubecore/HardwareObjects/ALBA/ALBACatsMaint.py index bcff58c5fc..ce2afa8a3f 100644 --- a/mxcubecore/HardwareObjects/ALBA/ALBACatsMaint.py +++ b/mxcubecore/HardwareObjects/ALBA/ALBACatsMaint.py @@ -1,6 +1,4 @@ -from mxcubecore.HardwareObjects.abstract.sample_changer.CatsMaint import ( - CatsMaint, -) +from mxcubecore.HardwareObjects.abstract.sample_changer.CatsMaint import CatsMaint class ALBACatsMaint(CatsMaint): diff --git a/mxcubecore/HardwareObjects/ALBA/ALBAClusterJob.py b/mxcubecore/HardwareObjects/ALBA/ALBAClusterJob.py index 644eb39522..b450b8c28c 100644 --- a/mxcubecore/HardwareObjects/ALBA/ALBAClusterJob.py +++ b/mxcubecore/HardwareObjects/ALBA/ALBAClusterJob.py @@ -1,10 +1,10 @@ -from XSDataMXCuBEv1_3 import XSDataResultMXCuBE -from xaloc import XalocJob +import logging import os +import sys import time -import logging -import sys +from xaloc import XalocJob +from XSDataMXCuBEv1_3 import XSDataResultMXCuBE sys.path.append("/beamlines/bl13/controls/devel/pycharm/ALBAClusterClient") diff --git a/mxcubecore/HardwareObjects/ALBA/ALBACollect.py b/mxcubecore/HardwareObjects/ALBA/ALBACollect.py index ecfa04b286..06b2ea4ea1 100644 --- a/mxcubecore/HardwareObjects/ALBA/ALBACollect.py +++ b/mxcubecore/HardwareObjects/ALBA/ALBACollect.py @@ -19,15 +19,16 @@ """ ALBACollect """ -import os -import time import logging +import os import sys +import time + import gevent -from mxcubecore.TaskUtils import task -from mxcubecore.HardwareObjects.abstract.AbstractCollect import AbstractCollect -from mxcubecore import HardwareRepository as HWR +from mxcubecore import HardwareRepository as HWR +from mxcubecore.HardwareObjects.abstract.AbstractCollect import AbstractCollect +from mxcubecore.TaskUtils import task __author__ = "Vicente Rey Bakaikoa" __credits__ = ["MXCuBE collaboration"] diff --git a/mxcubecore/HardwareObjects/ALBA/ALBADataAnalysis.py b/mxcubecore/HardwareObjects/ALBA/ALBADataAnalysis.py index 143c775033..9483f3f3ab 100644 --- a/mxcubecore/HardwareObjects/ALBA/ALBADataAnalysis.py +++ b/mxcubecore/HardwareObjects/ALBA/ALBADataAnalysis.py @@ -1,13 +1,17 @@ -from xaloc import XalocJob -from XSDataCommon import XSDataFile, XSDataString -from XSDataMXCuBEv1_3 import XSDataResultMXCuBE -from mxcubecore.HardwareObjects.EDNACharacterisation import EDNACharacterisation -from PyTango import DeviceProxy +import logging import os +import sys import time -import logging -import sys +from PyTango import DeviceProxy +from xaloc import XalocJob +from XSDataCommon import ( + XSDataFile, + XSDataString, +) +from XSDataMXCuBEv1_3 import XSDataResultMXCuBE + +from mxcubecore.HardwareObjects.EDNACharacterisation import EDNACharacterisation sys.path.append("/beamlines/bl13/controls/devel/pycharm/ALBAClusterClient") diff --git a/mxcubecore/HardwareObjects/ALBA/ALBAEnergy.py b/mxcubecore/HardwareObjects/ALBA/ALBAEnergy.py index 3445cc069e..b70ca26b59 100644 --- a/mxcubecore/HardwareObjects/ALBA/ALBAEnergy.py +++ b/mxcubecore/HardwareObjects/ALBA/ALBAEnergy.py @@ -1,7 +1,7 @@ import logging -from mxcubecore.BaseHardwareObjects import HardwareObject from mxcubecore import HardwareRepository as HWR +from mxcubecore.BaseHardwareObjects import HardwareObject class ALBAEnergy(HardwareObject): diff --git a/mxcubecore/HardwareObjects/ALBA/ALBAEpsActuator.py b/mxcubecore/HardwareObjects/ALBA/ALBAEpsActuator.py index f008b7c8d8..1b821476cd 100644 --- a/mxcubecore/HardwareObjects/ALBA/ALBAEpsActuator.py +++ b/mxcubecore/HardwareObjects/ALBA/ALBAEpsActuator.py @@ -42,10 +42,11 @@ """ -from mxcubecore import HardwareRepository as HWR -from mxcubecore import BaseHardwareObjects import logging +from mxcubecore import BaseHardwareObjects +from mxcubecore import HardwareRepository as HWR + STATE_OUT, STATE_IN, STATE_MOVING, STATE_FAULT, STATE_ALARM, STATE_UNKNOWN = ( 0, 1, diff --git a/mxcubecore/HardwareObjects/ALBA/ALBAFastShutter.py b/mxcubecore/HardwareObjects/ALBA/ALBAFastShutter.py index b11b3a90ee..4f54408c99 100644 --- a/mxcubecore/HardwareObjects/ALBA/ALBAFastShutter.py +++ b/mxcubecore/HardwareObjects/ALBA/ALBAFastShutter.py @@ -42,11 +42,12 @@ """ -from mxcubecore import HardwareRepository as HWR -from mxcubecore import BaseHardwareObjects import logging import time +from mxcubecore import BaseHardwareObjects +from mxcubecore import HardwareRepository as HWR + STATE_OUT, STATE_IN, STATE_MOVING, STATE_FAULT, STATE_ALARM, STATE_UNKNOWN = ( 0, 1, diff --git a/mxcubecore/HardwareObjects/ALBA/ALBAFlux.py b/mxcubecore/HardwareObjects/ALBA/ALBAFlux.py index f8e0db95cc..0245a98c2d 100644 --- a/mxcubecore/HardwareObjects/ALBA/ALBAFlux.py +++ b/mxcubecore/HardwareObjects/ALBA/ALBAFlux.py @@ -1,8 +1,10 @@ -from mxcubecore.HardwareObjects.abstract import AbstractFlux -from mxcubecore.BaseHardwareObjects import HardwareObject -import taurus import logging +import taurus + +from mxcubecore.BaseHardwareObjects import HardwareObject +from mxcubecore.HardwareObjects.abstract import AbstractFlux + class ALBAFlux(Device, AbstractFlux.AbstractFlux): def init(self): diff --git a/mxcubecore/HardwareObjects/ALBA/ALBAFrontEnd.py b/mxcubecore/HardwareObjects/ALBA/ALBAFrontEnd.py index a004079f4e..e27d3f4d12 100644 --- a/mxcubecore/HardwareObjects/ALBA/ALBAFrontEnd.py +++ b/mxcubecore/HardwareObjects/ALBA/ALBAFrontEnd.py @@ -18,12 +18,13 @@ """ -from mxcubecore import HardwareRepository as HWR -from mxcubecore import BaseHardwareObjects import logging from ALBAEpsActuator import ALBAEpsActuator +from mxcubecore import BaseHardwareObjects +from mxcubecore import HardwareRepository as HWR + class ALBAFrontEnd(ALBAEpsActuator): def init(self): diff --git a/mxcubecore/HardwareObjects/ALBA/ALBAFrontLight.py b/mxcubecore/HardwareObjects/ALBA/ALBAFrontLight.py index e66d3489c3..740c2c9868 100644 --- a/mxcubecore/HardwareObjects/ALBA/ALBAFrontLight.py +++ b/mxcubecore/HardwareObjects/ALBA/ALBAFrontLight.py @@ -1,6 +1,7 @@ +import logging + from mxcubecore import HardwareRepository as HWR from mxcubecore.BaseHardwareObjects import HardwareObject -import logging class ALBAFrontLight(HardwareObject): diff --git a/mxcubecore/HardwareObjects/ALBA/ALBAISPyBClient.py b/mxcubecore/HardwareObjects/ALBA/ALBAISPyBClient.py index a9259d0df6..7e3a242447 100644 --- a/mxcubecore/HardwareObjects/ALBA/ALBAISPyBClient.py +++ b/mxcubecore/HardwareObjects/ALBA/ALBAISPyBClient.py @@ -1,8 +1,9 @@ import logging -from mxcubecore import HardwareRepository as HWR from ISPyBClient import ISPyBClient +from mxcubecore import HardwareRepository as HWR + class ALBAISPyBClient(ISPyBClient): def ldap_login(self, login_name, psd, ldap_connection): diff --git a/mxcubecore/HardwareObjects/ALBA/ALBAMachineInfo.py b/mxcubecore/HardwareObjects/ALBA/ALBAMachineInfo.py index 61be06f712..4f5da536f5 100644 --- a/mxcubecore/HardwareObjects/ALBA/ALBAMachineInfo.py +++ b/mxcubecore/HardwareObjects/ALBA/ALBAMachineInfo.py @@ -56,13 +56,17 @@ import logging import time +from datetime import ( + datetime, + timedelta, +) + from gevent import spawn from urllib2 import urlopen -from datetime import datetime, timedelta + from mxcubecore import HardwareRepository as HWR from mxcubecore.BaseHardwareObjects import HardwareObject - __author__ = "Jordi Andreu" __credits__ = ["MXCuBE collaboration"] diff --git a/mxcubecore/HardwareObjects/ALBA/ALBAMiniDiff.py b/mxcubecore/HardwareObjects/ALBA/ALBAMiniDiff.py index d10b1206e4..1da77d07b5 100644 --- a/mxcubecore/HardwareObjects/ALBA/ALBAMiniDiff.py +++ b/mxcubecore/HardwareObjects/ALBA/ALBAMiniDiff.py @@ -46,15 +46,15 @@ import logging import time + +import gevent + from mxcubecore.HardwareObjects.GenericDiffractometer import ( - GenericDiffractometer, DiffractometerState, + GenericDiffractometer, ) -import gevent - from mxcubecore.model import queue_model_objects - __author__ = "Jordi Andreu" __credits__ = ["MXCuBE collaboration"] diff --git a/mxcubecore/HardwareObjects/ALBA/ALBAPilatus.py b/mxcubecore/HardwareObjects/ALBA/ALBAPilatus.py index 268d009270..78c11f05ce 100644 --- a/mxcubecore/HardwareObjects/ALBA/ALBAPilatus.py +++ b/mxcubecore/HardwareObjects/ALBA/ALBAPilatus.py @@ -18,16 +18,15 @@ # along with MXCuBE. If not, see . from __future__ import print_function + import logging import time -from mxcubecore.HardwareObjects.abstract.AbstractDetector import ( - AbstractDetector, -) -from mxcubecore.BaseHardwareObjects import HardwareObject - from PyTango.gevent import DeviceProxy +from mxcubecore.BaseHardwareObjects import HardwareObject +from mxcubecore.HardwareObjects.abstract.AbstractDetector import AbstractDetector + __author__ = "Vicente Rey" __credits__ = ["ALBA"] __version__ = "2.3." diff --git a/mxcubecore/HardwareObjects/ALBA/ALBASession.py b/mxcubecore/HardwareObjects/ALBA/ALBASession.py index b77a640920..34ff01cbe8 100644 --- a/mxcubecore/HardwareObjects/ALBA/ALBASession.py +++ b/mxcubecore/HardwareObjects/ALBA/ALBASession.py @@ -1,6 +1,6 @@ +import logging import os import time -import logging from mxcubecore.HardwareObjects import Session from mxcubecore.model import queue_model_objects diff --git a/mxcubecore/HardwareObjects/ALBA/ALBASupervisor.py b/mxcubecore/HardwareObjects/ALBA/ALBASupervisor.py index 9b8df1e766..3e3924497e 100644 --- a/mxcubecore/HardwareObjects/ALBA/ALBASupervisor.py +++ b/mxcubecore/HardwareObjects/ALBA/ALBASupervisor.py @@ -1,6 +1,7 @@ +import logging + from mxcubecore import HardwareRepository as HWR from mxcubecore.BaseHardwareObjects import HardwareObject -import logging class ALBASupervisor(HardwareObject): diff --git a/mxcubecore/HardwareObjects/ALBA/ALBAZoomMotor.py b/mxcubecore/HardwareObjects/ALBA/ALBAZoomMotor.py index d6fc2e1d9b..25fe6c9a89 100755 --- a/mxcubecore/HardwareObjects/ALBA/ALBAZoomMotor.py +++ b/mxcubecore/HardwareObjects/ALBA/ALBAZoomMotor.py @@ -56,11 +56,13 @@ """ -from mxcubecore import BaseHardwareObjects -from mxcubecore.HardwareObjects.abstract.AbstractMotor import AbstractMotor import logging + import PyTango +from mxcubecore import BaseHardwareObjects +from mxcubecore.HardwareObjects.abstract.AbstractMotor import AbstractMotor + __author__ = "Bixente Rey" __credits__ = ["MXCuBE collaboration"] diff --git a/mxcubecore/HardwareObjects/ALBA/ALBAZoomMotorAutoBrightness.py b/mxcubecore/HardwareObjects/ALBA/ALBAZoomMotorAutoBrightness.py index d85b76008b..b78e453bdb 100755 --- a/mxcubecore/HardwareObjects/ALBA/ALBAZoomMotorAutoBrightness.py +++ b/mxcubecore/HardwareObjects/ALBA/ALBAZoomMotorAutoBrightness.py @@ -49,9 +49,10 @@ """ +import logging + from mxcubecore import BaseHardwareObjects from mxcubecore.HardwareObjects.abstract.AbstractMotor import AbstractMotor -import logging __author__ = "Jordi Andreu" __credits__ = ["MXCuBE collaboration"] diff --git a/mxcubecore/HardwareObjects/ALBA/XalocCalibration.py b/mxcubecore/HardwareObjects/ALBA/XalocCalibration.py index 10aef0434e..fb72762acf 100644 --- a/mxcubecore/HardwareObjects/ALBA/XalocCalibration.py +++ b/mxcubecore/HardwareObjects/ALBA/XalocCalibration.py @@ -2,8 +2,8 @@ Class for reading images from Falcon camera OAV """ -from mxcubecore import HardwareRepository as HWR from mxcubecore import BaseHardwareObjects +from mxcubecore import HardwareRepository as HWR class XalocCalibration(BaseHardwareObjects.HardwareObject): diff --git a/mxcubecore/HardwareObjects/ALBA/XalocMachineInfo.py b/mxcubecore/HardwareObjects/ALBA/XalocMachineInfo.py index 742aa44f67..7e28ef504e 100644 --- a/mxcubecore/HardwareObjects/ALBA/XalocMachineInfo.py +++ b/mxcubecore/HardwareObjects/ALBA/XalocMachineInfo.py @@ -56,13 +56,17 @@ import logging import time +from datetime import ( + datetime, + timedelta, +) + from gevent import spawn from urllib2 import urlopen -from datetime import datetime, timedelta + from mxcubecore import HardwareRepository as HWR from mxcubecore.BaseHardwareObjects import HardwareObject - __author__ = "Jordi Andreu" __credits__ = ["MXCuBE collaboration"] diff --git a/mxcubecore/HardwareObjects/ALBA/XalocMiniDiff.py b/mxcubecore/HardwareObjects/ALBA/XalocMiniDiff.py index 650a11e8cf..638a20b83f 100644 --- a/mxcubecore/HardwareObjects/ALBA/XalocMiniDiff.py +++ b/mxcubecore/HardwareObjects/ALBA/XalocMiniDiff.py @@ -1,10 +1,10 @@ import logging import time -from mxcubecore.HardwareObjects.GenericDiffractometer import ( - GenericDiffractometer, -) -from gevent.event import AsyncResult + import gevent +from gevent.event import AsyncResult + +from mxcubecore.HardwareObjects.GenericDiffractometer import GenericDiffractometer class XalocMiniDiff(GenericDiffractometer): diff --git a/mxcubecore/HardwareObjects/Attenuators.py b/mxcubecore/HardwareObjects/Attenuators.py index 2bdb78789d..6663a91962 100644 --- a/mxcubecore/HardwareObjects/Attenuators.py +++ b/mxcubecore/HardwareObjects/Attenuators.py @@ -19,6 +19,7 @@ import gevent + from mxcubecore.HardwareObjects.abstract.AbstractTransmission import ( AbstractTransmission, ) diff --git a/mxcubecore/HardwareObjects/BeamInfo.py b/mxcubecore/HardwareObjects/BeamInfo.py index f4c1f3dbf1..28966080c2 100644 --- a/mxcubecore/HardwareObjects/BeamInfo.py +++ b/mxcubecore/HardwareObjects/BeamInfo.py @@ -20,8 +20,9 @@ """ import logging -from mxcubecore.BaseHardwareObjects import HardwareObject + from mxcubecore import HardwareRepository as HWR +from mxcubecore.BaseHardwareObjects import HardwareObject class BeamInfo(HardwareObject): diff --git a/mxcubecore/HardwareObjects/Beamline.py b/mxcubecore/HardwareObjects/Beamline.py index dd9ab41804..686a1f3f09 100644 --- a/mxcubecore/HardwareObjects/Beamline.py +++ b/mxcubecore/HardwareObjects/Beamline.py @@ -24,10 +24,18 @@ All HardwareObjects """ -from __future__ import division, absolute_import -from __future__ import print_function, unicode_literals +from __future__ import ( + absolute_import, + division, + print_function, + unicode_literals, +) + +from typing import ( + Any, + Union, +) -from typing import Union, Any from mxcubecore.dispatcher import dispatcher __copyright__ = """ Copyright © 2019 by the MXCuBE collaboration """ @@ -36,7 +44,10 @@ import logging -from mxcubecore.BaseHardwareObjects import ConfiguredObject, HardwareObject +from mxcubecore.BaseHardwareObjects import ( + ConfiguredObject, + HardwareObject, +) # NBNB The acq parameter names match the attributes of AcquisitionParameters # Whereas the limit parameter values use more understandable names diff --git a/mxcubecore/HardwareObjects/BeamlineActions.py b/mxcubecore/HardwareObjects/BeamlineActions.py index 799e6e284d..c7243bbca8 100644 --- a/mxcubecore/HardwareObjects/BeamlineActions.py +++ b/mxcubecore/HardwareObjects/BeamlineActions.py @@ -1,22 +1,20 @@ -import sys import ast import importlib +import logging import operator +import sys -from mxcubecore.BaseHardwareObjects import HardwareObject -from mxcubecore.TaskUtils import task -from mxcubecore.CommandContainer import CommandObject -from mxcubecore.utils.conversion import camel_to_snake -from mxcubecore import HardwareRepository as HWR +import gevent +from mxcubecore import HardwareRepository as HWR +from mxcubecore.BaseHardwareObjects import HardwareObject from mxcubecore.CommandContainer import ( - CommandObject, - TWO_STATE_COMMAND_T, ARGUMENT_TYPE_LIST, + TWO_STATE_COMMAND_T, + CommandObject, ) - -import gevent -import logging +from mxcubecore.TaskUtils import task +from mxcubecore.utils.conversion import camel_to_snake class ControllerCommand(CommandObject): diff --git a/mxcubecore/HardwareObjects/Bliss.py b/mxcubecore/HardwareObjects/Bliss.py index 4e046796b2..a326da037a 100644 --- a/mxcubecore/HardwareObjects/Bliss.py +++ b/mxcubecore/HardwareObjects/Bliss.py @@ -3,11 +3,16 @@ """ import itertools + import gevent import numpy -from mxcubecore.BaseHardwareObjects import HardwareObject from bliss.config import static -from bliss.data.node import DataNode, get_or_create_node +from bliss.data.node import ( + DataNode, + get_or_create_node, +) + +from mxcubecore.BaseHardwareObjects import HardwareObject __copyright__ = """ Copyright © 2019 by the MXCuBE collaboration """ __license__ = "LGPLv3+" diff --git a/mxcubecore/HardwareObjects/BlissActuator.py b/mxcubecore/HardwareObjects/BlissActuator.py index fcaf3a2d5d..f41a1cc4d0 100644 --- a/mxcubecore/HardwareObjects/BlissActuator.py +++ b/mxcubecore/HardwareObjects/BlissActuator.py @@ -11,9 +11,7 @@ import logging from warnings import warn -from mxcubecore.HardwareObjects.abstract.AbstractActuator import ( - AbstractActuator, -) +from mxcubecore.HardwareObjects.abstract.AbstractActuator import AbstractActuator from mxcubecore.TaskUtils import task diff --git a/mxcubecore/HardwareObjects/BlissEnergy.py b/mxcubecore/HardwareObjects/BlissEnergy.py index 72398bd820..30ac2e609d 100644 --- a/mxcubecore/HardwareObjects/BlissEnergy.py +++ b/mxcubecore/HardwareObjects/BlissEnergy.py @@ -37,9 +37,11 @@ """ import logging import math + from gevent import spawn -from mxcubecore.HardwareObjects.abstract.AbstractEnergy import AbstractEnergy + from mxcubecore.BaseHardwareObjects import HardwareObjectState +from mxcubecore.HardwareObjects.abstract.AbstractEnergy import AbstractEnergy __copyright__ = """ Copyright © 2019 by the MXCuBE collaboration """ __license__ = "LGPLv3+" diff --git a/mxcubecore/HardwareObjects/BlissHutchTrigger.py b/mxcubecore/HardwareObjects/BlissHutchTrigger.py index f3c0630b93..c6934316f7 100644 --- a/mxcubecore/HardwareObjects/BlissHutchTrigger.py +++ b/mxcubecore/HardwareObjects/BlissHutchTrigger.py @@ -1,7 +1,9 @@ +import logging import sys + import gevent -import logging import PyTango.gevent + from mxcubecore import BaseHardwareObjects from mxcubecore import HardwareRepository as HWR diff --git a/mxcubecore/HardwareObjects/BlissMotor.py b/mxcubecore/HardwareObjects/BlissMotor.py index 4f4b2b41e8..18aa10f781 100644 --- a/mxcubecore/HardwareObjects/BlissMotor.py +++ b/mxcubecore/HardwareObjects/BlissMotor.py @@ -27,9 +27,11 @@ """ import enum + from bliss.config import static -from mxcubecore.HardwareObjects.abstract.AbstractMotor import AbstractMotor + from mxcubecore.BaseHardwareObjects import HardwareObjectState +from mxcubecore.HardwareObjects.abstract.AbstractMotor import AbstractMotor __copyright__ = """ Copyright © 2019 by the MXCuBE collaboration """ __license__ = "LGPLv3+" diff --git a/mxcubecore/HardwareObjects/BlissMotorWPositions.py b/mxcubecore/HardwareObjects/BlissMotorWPositions.py index 1c275ad79e..27706824c3 100644 --- a/mxcubecore/HardwareObjects/BlissMotorWPositions.py +++ b/mxcubecore/HardwareObjects/BlissMotorWPositions.py @@ -1,6 +1,7 @@ +import logging from warnings import warn + from BlissMotor import BlissMotor -import logging class BlissMotorWPositions(BlissMotor): diff --git a/mxcubecore/HardwareObjects/BlissNState.py b/mxcubecore/HardwareObjects/BlissNState.py index 1eb9ce45b0..5b31fc1f26 100644 --- a/mxcubecore/HardwareObjects/BlissNState.py +++ b/mxcubecore/HardwareObjects/BlissNState.py @@ -29,6 +29,7 @@ """ from enum import Enum + from mxcubecore.HardwareObjects.abstract.AbstractMotor import MotorStates from mxcubecore.HardwareObjects.abstract.AbstractNState import ( AbstractNState, diff --git a/mxcubecore/HardwareObjects/BlissShutter.py b/mxcubecore/HardwareObjects/BlissShutter.py index 2b294b7462..0b8d8c31e6 100644 --- a/mxcubecore/HardwareObjects/BlissShutter.py +++ b/mxcubecore/HardwareObjects/BlissShutter.py @@ -30,11 +30,15 @@ """ -from enum import Enum, unique +from enum import ( + Enum, + unique, +) + import gevent -from mxcubecore.HardwareObjects.abstract.AbstractShutter import AbstractShutter from mxcubecore.BaseHardwareObjects import HardwareObjectState +from mxcubecore.HardwareObjects.abstract.AbstractShutter import AbstractShutter __copyright__ = """ Copyright © 2020 by the MXCuBE collaboration """ __license__ = "LGPLv3+" diff --git a/mxcubecore/HardwareObjects/Camera.py b/mxcubecore/HardwareObjects/Camera.py index 34e9ce03ef..c58d48dc48 100644 --- a/mxcubecore/HardwareObjects/Camera.py +++ b/mxcubecore/HardwareObjects/Camera.py @@ -16,13 +16,17 @@ """ -from mxcubecore import BaseHardwareObjects -from mxcubecore import CommandContainer -import gevent import logging import os -import time import sys +import time + +import gevent + +from mxcubecore import ( + BaseHardwareObjects, + CommandContainer, +) try: from Qub.CTools.qttools import BgrImageMmap diff --git a/mxcubecore/HardwareObjects/Cats90.py b/mxcubecore/HardwareObjects/Cats90.py index 329f1ee82e..d4623894dd 100644 --- a/mxcubecore/HardwareObjects/Cats90.py +++ b/mxcubecore/HardwareObjects/Cats90.py @@ -20,9 +20,11 @@ """ from __future__ import print_function + +import logging import time + import PyTango -import logging from mxcubecore.HardwareObjects.abstract.AbstractSampleChanger import ( Container, diff --git a/mxcubecore/HardwareObjects/CatsBessy.py b/mxcubecore/HardwareObjects/CatsBessy.py index cbc5e4ce03..10eebc7b93 100644 --- a/mxcubecore/HardwareObjects/CatsBessy.py +++ b/mxcubecore/HardwareObjects/CatsBessy.py @@ -1,12 +1,13 @@ +import time + from mxcubecore.HardwareObjects.abstract.AbstractSampleChanger import ( - Container, SC3, + Container, Sample, SampleChanger, SampleChangerState, gevent, ) -import time class Pin(Sample): diff --git a/mxcubecore/HardwareObjects/CatsMaint.py b/mxcubecore/HardwareObjects/CatsMaint.py index fe5c19d8a3..42841a38ec 100644 --- a/mxcubecore/HardwareObjects/CatsMaint.py +++ b/mxcubecore/HardwareObjects/CatsMaint.py @@ -13,15 +13,14 @@ """ import logging - -from mxcubecore.TaskUtils import task -from mxcubecore.BaseHardwareObjects import HardwareObject - -import gevent import time +import gevent from PyTango import DeviceProxy +from mxcubecore.BaseHardwareObjects import HardwareObject +from mxcubecore.TaskUtils import task + __author__ = "Jie Nan" __credits__ = ["The MxCuBE collaboration"] diff --git a/mxcubecore/HardwareObjects/CentringMath.py b/mxcubecore/HardwareObjects/CentringMath.py index d65ea5b3ff..5f6b825392 100644 --- a/mxcubecore/HardwareObjects/CentringMath.py +++ b/mxcubecore/HardwareObjects/CentringMath.py @@ -1,8 +1,10 @@ -from mxcubecore import HardwareRepository as HWR -from mxcubecore.BaseHardwareObjects import Procedure +import logging import math + import numpy -import logging + +from mxcubecore import HardwareRepository as HWR +from mxcubecore.BaseHardwareObjects import Procedure class CentringMath(Procedure): diff --git a/mxcubecore/HardwareObjects/DESY/Centring.py b/mxcubecore/HardwareObjects/DESY/Centring.py index bd03fdd2e5..384e0f3d5a 100644 --- a/mxcubecore/HardwareObjects/DESY/Centring.py +++ b/mxcubecore/HardwareObjects/DESY/Centring.py @@ -23,16 +23,16 @@ import gevent - -from mxcubecore.BaseHardwareObjects import HardwareObject -from mxcubecore.BaseHardwareObjects import HardwareObject -from gevent import Timeout import numpy - +from gevent import Timeout # import DeviceProxy function and DevState: -from PyTango import DevState -from PyTango import DeviceProxy +from PyTango import ( + DeviceProxy, + DevState, +) + +from mxcubecore.BaseHardwareObjects import HardwareObject last_centred_position = [200, 200] diff --git a/mxcubecore/HardwareObjects/DESY/DigitalZoomMotor.py b/mxcubecore/HardwareObjects/DESY/DigitalZoomMotor.py index bdcbfddad1..b236441d39 100644 --- a/mxcubecore/HardwareObjects/DESY/DigitalZoomMotor.py +++ b/mxcubecore/HardwareObjects/DESY/DigitalZoomMotor.py @@ -25,9 +25,12 @@ import logging + from mxcubecore.BaseHardwareObjects import HardwareObject -from mxcubecore.HardwareObjects.abstract.AbstractMotor import AbstractMotor -from mxcubecore.HardwareObjects.abstract.AbstractMotor import MotorStates +from mxcubecore.HardwareObjects.abstract.AbstractMotor import ( + AbstractMotor, + MotorStates, +) class DigitalZoomMotor(AbstractMotor, HardwareObject): diff --git a/mxcubecore/HardwareObjects/DESY/MjpgStreamVideo.py b/mxcubecore/HardwareObjects/DESY/MjpgStreamVideo.py index baec00edc4..7e953c6607 100644 --- a/mxcubecore/HardwareObjects/DESY/MjpgStreamVideo.py +++ b/mxcubecore/HardwareObjects/DESY/MjpgStreamVideo.py @@ -24,10 +24,11 @@ __email__ = "jan.meyer@desy.de" -import gevent import json import traceback +import gevent + try: from httplib import HTTPConnection except ImportError: @@ -41,10 +42,14 @@ traceback.print_exc() redis_flag = False -from mxcubecore.utils.qt_import import QImage, QPixmap, QPoint -from mxcubecore.utils.conversion import string_types -from mxcubecore.HardwareObjects.abstract.AbstractVideoDevice import AbstractVideoDevice from mxcubecore.BaseHardwareObjects import HardwareObject +from mxcubecore.HardwareObjects.abstract.AbstractVideoDevice import AbstractVideoDevice +from mxcubecore.utils.conversion import string_types +from mxcubecore.utils.qt_import import ( + QImage, + QPixmap, + QPoint, +) class MjpgStreamVideo(AbstractVideoDevice): diff --git a/mxcubecore/HardwareObjects/DESY/P11AlbulaView.py b/mxcubecore/HardwareObjects/DESY/P11AlbulaView.py index c3c28dc2ab..88c8195b90 100644 --- a/mxcubecore/HardwareObjects/DESY/P11AlbulaView.py +++ b/mxcubecore/HardwareObjects/DESY/P11AlbulaView.py @@ -21,12 +21,13 @@ __copyright__ = """Copyright The MXCuBE Collaboration""" __license__ = "LGPLv3+" -from mxcubecore.BaseHardwareObjects import HardwareObject - import sys import time + from PIL import Image +from mxcubecore.BaseHardwareObjects import HardwareObject + sys.path.append("/opt/dectris/albula/4.0/python/") diff --git a/mxcubecore/HardwareObjects/DESY/P11BackLight.py b/mxcubecore/HardwareObjects/DESY/P11BackLight.py index bc541bffcf..4bc7f5c0ea 100644 --- a/mxcubecore/HardwareObjects/DESY/P11BackLight.py +++ b/mxcubecore/HardwareObjects/DESY/P11BackLight.py @@ -21,17 +21,24 @@ __copyright__ = """Copyright The MXCuBE Collaboration""" __license__ = "LGPLv3+" -from enum import Enum, unique -from mxcubecore.HardwareObjects.abstract.AbstractShutter import AbstractNState -from mxcubecore.BaseHardwareObjects import HardwareObjectState +from enum import ( + Enum, + unique, +) +from mxcubecore.BaseHardwareObjects import HardwareObjectState +from mxcubecore.HardwareObjects.abstract.AbstractShutter import AbstractNState __credits__ = ["DESY P11"] __license__ = "LGPLv3+" __category__ = "General" import time -from enum import Enum, unique +from enum import ( + Enum, + unique, +) + from mxcubecore.HardwareObjects.abstract.AbstractShutter import AbstractShutter diff --git a/mxcubecore/HardwareObjects/DESY/P11Beam.py b/mxcubecore/HardwareObjects/DESY/P11Beam.py index ab5560d065..ab808ca219 100644 --- a/mxcubecore/HardwareObjects/DESY/P11Beam.py +++ b/mxcubecore/HardwareObjects/DESY/P11Beam.py @@ -23,11 +23,14 @@ __credits__ = ["DESY P11"] __category__ = "General" -from mxcubecore.HardwareObjects.abstract.AbstractBeam import AbstractBeam -from mxcubecore.HardwareObjects.abstract.AbstractBeam import BeamShape -from mxcubecore.BaseHardwareObjects import HardwareObjectState import numpy as np +from mxcubecore.BaseHardwareObjects import HardwareObjectState +from mxcubecore.HardwareObjects.abstract.AbstractBeam import ( + AbstractBeam, + BeamShape, +) + class P11Beam(AbstractBeam): def init(self): diff --git a/mxcubecore/HardwareObjects/DESY/P11BeamStop.py b/mxcubecore/HardwareObjects/DESY/P11BeamStop.py index 24e4c9ee13..715158e560 100644 --- a/mxcubecore/HardwareObjects/DESY/P11BeamStop.py +++ b/mxcubecore/HardwareObjects/DESY/P11BeamStop.py @@ -21,11 +21,12 @@ __copyright__ = """Copyright The MXCuBE Collaboration""" __license__ = "LGPLv3+" -from mxcubecore.HardwareObjects.NState import NState -from mxcubecore.BaseHardwareObjects import HardwareObjectState import ast import time +from mxcubecore.BaseHardwareObjects import HardwareObjectState +from mxcubecore.HardwareObjects.NState import NState + class P11BeamStop(NState): default_delta = 0.1 diff --git a/mxcubecore/HardwareObjects/DESY/P11Collect.py b/mxcubecore/HardwareObjects/DESY/P11Collect.py index 2c95b2704f..4f59a005fb 100644 --- a/mxcubecore/HardwareObjects/DESY/P11Collect.py +++ b/mxcubecore/HardwareObjects/DESY/P11Collect.py @@ -22,23 +22,24 @@ __license__ = "LGPLv3+" import errno +import logging +import math +import os import socket -import time +import subprocess import sys -import os -import math -import logging +import time import traceback + +import gevent import h5py import numpy as np import psutil -import subprocess -import gevent -from mxcubecore.HardwareObjects.abstract.AbstractCollect import AbstractCollect from mxcubecore import HardwareRepository as HWR -from mxcubecore.TaskUtils import task from mxcubecore.Command.Tango import DeviceProxy +from mxcubecore.HardwareObjects.abstract.AbstractCollect import AbstractCollect +from mxcubecore.TaskUtils import task FILE_TIMEOUT = 5 diff --git a/mxcubecore/HardwareObjects/DESY/P11Collimator.py b/mxcubecore/HardwareObjects/DESY/P11Collimator.py index 7a7bcf4460..646788db2a 100644 --- a/mxcubecore/HardwareObjects/DESY/P11Collimator.py +++ b/mxcubecore/HardwareObjects/DESY/P11Collimator.py @@ -22,9 +22,10 @@ __license__ = "LGPLv3+" import ast -from mxcubecore.HardwareObjects.NState import NState from collections import OrderedDict + from mxcubecore.BaseHardwareObjects import HardwareObjectState +from mxcubecore.HardwareObjects.NState import NState class P11Collimator(NState): diff --git a/mxcubecore/HardwareObjects/DESY/P11DetectorCover.py b/mxcubecore/HardwareObjects/DESY/P11DetectorCover.py index 9a8fa5f92d..04a3e4900a 100644 --- a/mxcubecore/HardwareObjects/DESY/P11DetectorCover.py +++ b/mxcubecore/HardwareObjects/DESY/P11DetectorCover.py @@ -22,12 +22,12 @@ __license__ = "LGPLv3+" import time +from enum import Enum + import gevent -from mxcubecore.HardwareObjects.abstract.AbstractShutter import AbstractShutter from mxcubecore.BaseHardwareObjects import HardwareObjectState -from enum import Enum - +from mxcubecore.HardwareObjects.abstract.AbstractShutter import AbstractShutter __credits__ = ["DESY P11"] __license__ = "LGPLv3+" diff --git a/mxcubecore/HardwareObjects/DESY/P11DetectorDistance.py b/mxcubecore/HardwareObjects/DESY/P11DetectorDistance.py index 4ff0e65a4d..bf861c352b 100644 --- a/mxcubecore/HardwareObjects/DESY/P11DetectorDistance.py +++ b/mxcubecore/HardwareObjects/DESY/P11DetectorDistance.py @@ -23,9 +23,10 @@ __credits__ = ["DESY P11"] __category__ = "Motor" -from mxcubecore.HardwareObjects.abstract.AbstractMotor import AbstractMotor import time +from mxcubecore.HardwareObjects.abstract.AbstractMotor import AbstractMotor + class P11DetectorDistance(AbstractMotor): def __init__(self, name): diff --git a/mxcubecore/HardwareObjects/DESY/P11DoorInterlock.py b/mxcubecore/HardwareObjects/DESY/P11DoorInterlock.py index 2189ee9d81..32c31b8f08 100644 --- a/mxcubecore/HardwareObjects/DESY/P11DoorInterlock.py +++ b/mxcubecore/HardwareObjects/DESY/P11DoorInterlock.py @@ -21,11 +21,12 @@ __copyright__ = """Copyright The MXCuBE Collaboration""" __license__ = "LGPLv3+" -from mxcubecore.BaseHardwareObjects import HardwareObject import logging import sys import urllib.request +from mxcubecore.BaseHardwareObjects import HardwareObject + __credits__ = ["MXCuBE collaboration"] diff --git a/mxcubecore/HardwareObjects/DESY/P11EDNACharacterisation.py b/mxcubecore/HardwareObjects/DESY/P11EDNACharacterisation.py index e015bc3326..bd304f138a 100644 --- a/mxcubecore/HardwareObjects/DESY/P11EDNACharacterisation.py +++ b/mxcubecore/HardwareObjects/DESY/P11EDNACharacterisation.py @@ -21,39 +21,41 @@ __copyright__ = """Copyright The MXCuBE Collaboration""" __license__ = "LGPLv3+" -import os +import copy import logging +import os import time -import copy -from mxcubecore.model import queue_model_objects as qmo -from mxcubecore.model import queue_model_enumerables as qme -from mxcubecore.HardwareObjects.SecureXMLRpcRequestHandler import ( - SecureXMLRpcRequestHandler, +from XSDataCommon import ( + XSDataAngle, + XSDataBoolean, + XSDataDouble, + XSDataFile, + XSDataFlux, + XSDataImage, + XSDataInteger, + XSDataLength, + XSDataSize, + XSDataString, + XSDataTime, + XSDataWavelength, +) +from XSDataMXCuBEv1_4 import ( + XSDataInputMXCuBE, + XSDataMXCuBEDataSet, + XSDataResultMXCuBE, ) + from mxcubecore import HardwareRepository as HWR from mxcubecore.HardwareObjects.abstract.AbstractCharacterisation import ( AbstractCharacterisation, ) - from mxcubecore.HardwareObjects.EDNACharacterisation import EDNACharacterisation - -from XSDataMXCuBEv1_4 import XSDataInputMXCuBE -from XSDataMXCuBEv1_4 import XSDataMXCuBEDataSet -from XSDataMXCuBEv1_4 import XSDataResultMXCuBE - -from XSDataCommon import XSDataAngle -from XSDataCommon import XSDataBoolean -from XSDataCommon import XSDataDouble -from XSDataCommon import XSDataFile -from XSDataCommon import XSDataImage -from XSDataCommon import XSDataFlux -from XSDataCommon import XSDataLength -from XSDataCommon import XSDataTime -from XSDataCommon import XSDataWavelength -from XSDataCommon import XSDataInteger -from XSDataCommon import XSDataSize -from XSDataCommon import XSDataString +from mxcubecore.HardwareObjects.SecureXMLRpcRequestHandler import ( + SecureXMLRpcRequestHandler, +) +from mxcubecore.model import queue_model_enumerables as qme +from mxcubecore.model import queue_model_objects as qmo # from edna_test_data import EDNA_DEFAULT_INPUT # from edna_test_data import EDNA_TEST_DATA diff --git a/mxcubecore/HardwareObjects/DESY/P11EigerDetector.py b/mxcubecore/HardwareObjects/DESY/P11EigerDetector.py index 700707996e..577c384cee 100644 --- a/mxcubecore/HardwareObjects/DESY/P11EigerDetector.py +++ b/mxcubecore/HardwareObjects/DESY/P11EigerDetector.py @@ -22,6 +22,7 @@ __license__ = "LGPLv3+" import gevent + from mxcubecore.Command.Tango import DeviceProxy from mxcubecore.HardwareObjects.abstract.AbstractDetector import AbstractDetector diff --git a/mxcubecore/HardwareObjects/DESY/P11Energy.py b/mxcubecore/HardwareObjects/DESY/P11Energy.py index 891ea7b534..e8d7e24852 100644 --- a/mxcubecore/HardwareObjects/DESY/P11Energy.py +++ b/mxcubecore/HardwareObjects/DESY/P11Energy.py @@ -21,11 +21,11 @@ __copyright__ = """Copyright The MXCuBE Collaboration""" __license__ = "LGPLv3+" -from mxcubecore.HardwareObjects.abstract.AbstractEnergy import AbstractEnergy -from mxcubecore import HardwareRepository as HWR - import logging +from mxcubecore import HardwareRepository as HWR +from mxcubecore.HardwareObjects.abstract.AbstractEnergy import AbstractEnergy + log = logging.getLogger("HWR") diff --git a/mxcubecore/HardwareObjects/DESY/P11FastShutter.py b/mxcubecore/HardwareObjects/DESY/P11FastShutter.py index ae81fc6a2e..7ef713bdb4 100644 --- a/mxcubecore/HardwareObjects/DESY/P11FastShutter.py +++ b/mxcubecore/HardwareObjects/DESY/P11FastShutter.py @@ -22,15 +22,16 @@ __license__ = "LGPLv3+" from enum import Enum -from mxcubecore.HardwareObjects.abstract.AbstractShutter import AbstractNState -from mxcubecore.BaseHardwareObjects import HardwareObjectState +from mxcubecore.BaseHardwareObjects import HardwareObjectState +from mxcubecore.HardwareObjects.abstract.AbstractShutter import AbstractNState __credits__ = ["DESY P11"] __license__ = "LGPLv3+" __category__ = "General" from enum import Enum + from mxcubecore.HardwareObjects.abstract.AbstractShutter import AbstractShutter diff --git a/mxcubecore/HardwareObjects/DESY/P11Flux.py b/mxcubecore/HardwareObjects/DESY/P11Flux.py index 27673432c7..d9b040dfe6 100644 --- a/mxcubecore/HardwareObjects/DESY/P11Flux.py +++ b/mxcubecore/HardwareObjects/DESY/P11Flux.py @@ -22,12 +22,13 @@ __license__ = "LGPLv3+" import numpy as np -from scipy.interpolate import Rbf, interp1d - -from mxcubecore.HardwareObjects.abstract.AbstractFlux import AbstractFlux +from scipy.interpolate import ( + Rbf, + interp1d, +) from mxcubecore import HardwareRepository as HWR - +from mxcubecore.HardwareObjects.abstract.AbstractFlux import AbstractFlux __credits__ = ["MXCuBE collaboration"] __category__ = "General" diff --git a/mxcubecore/HardwareObjects/DESY/P11ISPyBClient.py b/mxcubecore/HardwareObjects/DESY/P11ISPyBClient.py index 4afe4cb053..53a01bfd36 100644 --- a/mxcubecore/HardwareObjects/DESY/P11ISPyBClient.py +++ b/mxcubecore/HardwareObjects/DESY/P11ISPyBClient.py @@ -23,12 +23,13 @@ import logging import ssl -from mxcubecore.HardwareObjects.ISPyBClient import ISPyBClient -from mxcubecore import HardwareRepository as HWR -from suds import WebFault from urllib.error import URLError + +from suds import WebFault from suds.transport import TransportError +from mxcubecore import HardwareRepository as HWR +from mxcubecore.HardwareObjects.ISPyBClient import ISPyBClient ssl._create_default_https_context = ssl._create_unverified_context diff --git a/mxcubecore/HardwareObjects/DESY/P11MachineInfo.py b/mxcubecore/HardwareObjects/DESY/P11MachineInfo.py index 049475123c..b24e898d27 100644 --- a/mxcubecore/HardwareObjects/DESY/P11MachineInfo.py +++ b/mxcubecore/HardwareObjects/DESY/P11MachineInfo.py @@ -22,11 +22,15 @@ __license__ = "LGPLv3+" import logging + import gevent +from PyQt5.QtCore import ( + QObject, + pyqtSignal, +) + from mxcubecore.HardwareObjects.abstract.AbstractMachineInfo import AbstractMachineInfo from mxcubecore.HardwareObjects.TangoMachineInfo import TangoMachineInfo -from mxcubecore.HardwareObjects.TangoMachineInfo import TangoMachineInfo -from PyQt5.QtCore import QObject, pyqtSignal class P11MachineInfo(TangoMachineInfo, QObject): diff --git a/mxcubecore/HardwareObjects/DESY/P11NanoDiff.py b/mxcubecore/HardwareObjects/DESY/P11NanoDiff.py index 7f09037448..eebca5e9bd 100644 --- a/mxcubecore/HardwareObjects/DESY/P11NanoDiff.py +++ b/mxcubecore/HardwareObjects/DESY/P11NanoDiff.py @@ -20,34 +20,42 @@ __copyright__ = """Copyright The MXCuBE Collaboration""" __license__ = "LGPLv3+" +import logging +import math +import os +import pickle +import sys +import time +from enum import ( + Enum, + unique, +) + +import gevent +import lmfit +import numpy as np +import sample_centring +import simplejpeg from gevent.event import AsyncResult +from tango import ( + DevFailed, + DeviceProxy, +) -from tango import DeviceProxy, DevFailed -from mxcubecore.TaskUtils import task +from mxcubecore import HardwareRepository as HWR +from mxcubecore.BaseHardwareObjects import HardwareObjectState from mxcubecore.HardwareObjects.GenericDiffractometer import ( DiffractometerState, GenericDiffractometer, ) - -from mxcubecore.BaseHardwareObjects import HardwareObjectState -from mxcubecore import HardwareRepository as HWR -from enum import Enum, unique -import pickle -import lmfit -import simplejpeg -import numpy as np -import sample_centring -import gevent -import time -import math -import os -import sys -import logging +from mxcubecore.TaskUtils import task murko_path = os.getenv("MURKO_PATH") sys.path.insert(1, murko_path) -from murko import get_predictions, plot_analysis - +from murko import ( + get_predictions, + plot_analysis, +) if sys.version_info[0] >= 3: unicode = str diff --git a/mxcubecore/HardwareObjects/DESY/P11Pinhole.py b/mxcubecore/HardwareObjects/DESY/P11Pinhole.py index 2d36b7a194..2cb8944337 100644 --- a/mxcubecore/HardwareObjects/DESY/P11Pinhole.py +++ b/mxcubecore/HardwareObjects/DESY/P11Pinhole.py @@ -21,9 +21,10 @@ __copyright__ = """Copyright The MXCuBE Collaboration""" __license__ = "LGPLv3+" -from mxcubecore.HardwareObjects.NState import NState import ast + from mxcubecore.BaseHardwareObjects import HardwareObjectState +from mxcubecore.HardwareObjects.NState import NState class P11Pinhole(NState): diff --git a/mxcubecore/HardwareObjects/DESY/P11SampleChanger.py b/mxcubecore/HardwareObjects/DESY/P11SampleChanger.py index f737e0e7d3..75a9e95f3e 100644 --- a/mxcubecore/HardwareObjects/DESY/P11SampleChanger.py +++ b/mxcubecore/HardwareObjects/DESY/P11SampleChanger.py @@ -22,16 +22,16 @@ __license__ = "LGPLv3+" -import time import logging +import time +from mxcubecore import HardwareRepository as HWR from mxcubecore.HardwareObjects.abstract.AbstractSampleChanger import ( SampleChanger, SampleChangerState, ) from mxcubecore.HardwareObjects.abstract.sample_changer import Container from mxcubecore.TaskUtils import task -from mxcubecore import HardwareRepository as HWR class P11SampleChanger(SampleChanger): diff --git a/mxcubecore/HardwareObjects/DESY/P11Session.py b/mxcubecore/HardwareObjects/DESY/P11Session.py index e70dd32226..76d64dd8e3 100644 --- a/mxcubecore/HardwareObjects/DESY/P11Session.py +++ b/mxcubecore/HardwareObjects/DESY/P11Session.py @@ -21,15 +21,17 @@ __copyright__ = """Copyright The MXCuBE Collaboration""" __license__ = "LGPLv3+" +import glob +import json import os import time -import json -import glob -import yaml +from configparser import ConfigParser from datetime import date from select import EPOLL_CLOEXEC + +import yaml + from mxcubecore.HardwareObjects.Session import Session -from configparser import ConfigParser PATH_BEAMTIME = "/gpfs/current" PATH_COMMISSIONING = "/gpfs/commissioning" diff --git a/mxcubecore/HardwareObjects/DESY/P11Shutter.py b/mxcubecore/HardwareObjects/DESY/P11Shutter.py index bd490b7040..40e88ac917 100644 --- a/mxcubecore/HardwareObjects/DESY/P11Shutter.py +++ b/mxcubecore/HardwareObjects/DESY/P11Shutter.py @@ -22,13 +22,17 @@ __license__ = "LGPLv3+" import time -import gevent import urllib -from mxcubecore.HardwareObjects.abstract.AbstractShutter import AbstractShutter +from enum import ( + Enum, + unique, +) + +import gevent + import mxcubecore.HardwareObjects.abstract.AbstractShutter as absshut from mxcubecore.BaseHardwareObjects import HardwareObjectState -from enum import Enum, unique - +from mxcubecore.HardwareObjects.abstract.AbstractShutter import AbstractShutter __credits__ = ["DESY P11"] __license__ = "LGPLv3+" diff --git a/mxcubecore/HardwareObjects/DESY/P11Transmission.py b/mxcubecore/HardwareObjects/DESY/P11Transmission.py index 34f9d6bff4..be14499117 100644 --- a/mxcubecore/HardwareObjects/DESY/P11Transmission.py +++ b/mxcubecore/HardwareObjects/DESY/P11Transmission.py @@ -21,9 +21,11 @@ __copyright__ = """Copyright The MXCuBE Collaboration""" __license__ = "LGPLv3+" -import gevent import logging import time + +import gevent + from mxcubecore.HardwareObjects.abstract.AbstractTransmission import ( AbstractTransmission, ) diff --git a/mxcubecore/HardwareObjects/DESY/P11YagDiode.py b/mxcubecore/HardwareObjects/DESY/P11YagDiode.py index 820346fcad..dfae32a780 100644 --- a/mxcubecore/HardwareObjects/DESY/P11YagDiode.py +++ b/mxcubecore/HardwareObjects/DESY/P11YagDiode.py @@ -22,9 +22,10 @@ __license__ = "LGPLv3+" import ast -from mxcubecore.HardwareObjects.NState import NState from collections import OrderedDict + from mxcubecore.BaseHardwareObjects import HardwareObjectState +from mxcubecore.HardwareObjects.NState import NState class P11YagDiode(NState): diff --git a/mxcubecore/HardwareObjects/DESY/P11Zoom.py b/mxcubecore/HardwareObjects/DESY/P11Zoom.py index b9a1deb9e0..ce63e530c3 100644 --- a/mxcubecore/HardwareObjects/DESY/P11Zoom.py +++ b/mxcubecore/HardwareObjects/DESY/P11Zoom.py @@ -21,11 +21,13 @@ __copyright__ = """Copyright The MXCuBE Collaboration""" __license__ = "LGPLv3+" -from enum import Enum import ast +from enum import Enum -from mxcubecore.HardwareObjects.abstract.AbstractNState import AbstractNState -from mxcubecore.HardwareObjects.abstract.AbstractNState import BaseValueEnum +from mxcubecore.HardwareObjects.abstract.AbstractNState import ( + AbstractNState, + BaseValueEnum, +) redis_flag = False try: diff --git a/mxcubecore/HardwareObjects/DataPublisher.py b/mxcubecore/HardwareObjects/DataPublisher.py index 1ab7551634..6906464e60 100644 --- a/mxcubecore/HardwareObjects/DataPublisher.py +++ b/mxcubecore/HardwareObjects/DataPublisher.py @@ -16,12 +16,15 @@ # # You should have received a copy of the GNU Lesser General Public License # along with MXCuBE. If not, see . -import redis import json -import gevent import logging +from enum import ( + Enum, + unique, +) -from enum import Enum, unique +import gevent +import redis from mxcubecore.BaseHardwareObjects import HardwareObject diff --git a/mxcubecore/HardwareObjects/DozorOnlineProcessing.py b/mxcubecore/HardwareObjects/DozorOnlineProcessing.py index b830c22a16..dea6a38cc2 100644 --- a/mxcubecore/HardwareObjects/DozorOnlineProcessing.py +++ b/mxcubecore/HardwareObjects/DozorOnlineProcessing.py @@ -18,17 +18,18 @@ # along with MXCuBE. If not, see . -from XSDataCommon import XSDataBoolean -from XSDataCommon import XSDataDouble -from XSDataCommon import XSDataInteger -from XSDataCommon import XSDataString +from XSDataCommon import ( + XSDataBoolean, + XSDataDouble, + XSDataInteger, + XSDataString, +) from XSDataControlDozorv1_1 import XSDataInputControlDozor +from mxcubecore import HardwareRepository as HWR from mxcubecore.HardwareObjects.abstract.AbstractOnlineProcessing import ( AbstractOnlineProcessing, ) -from mxcubecore import HardwareRepository as HWR - __credits__ = ["MXCuBE collaboration"] __license__ = "LGPLv3+" diff --git a/mxcubecore/HardwareObjects/EDNACharacterisation.py b/mxcubecore/HardwareObjects/EDNACharacterisation.py index c419fcc7e2..37661239f4 100644 --- a/mxcubecore/HardwareObjects/EDNACharacterisation.py +++ b/mxcubecore/HardwareObjects/EDNACharacterisation.py @@ -1,37 +1,39 @@ -import os +import binascii import copy import logging -import binascii +import os import subprocess import time -from mxcubecore.model import queue_model_objects as qmo -from mxcubecore.model import queue_model_enumerables as qme - -from mxcubecore.HardwareObjects.SecureXMLRpcRequestHandler import ( - SecureXMLRpcRequestHandler, +from XSDataCommon import ( + XSDataAngle, + XSDataBoolean, + XSDataDouble, + XSDataFile, + XSDataFlux, + XSDataImage, + XSDataInteger, + XSDataLength, + XSDataSize, + XSDataString, + XSDataTime, + XSDataWavelength, ) +from XSDataMXCuBEv1_4 import ( + XSDataInputMXCuBE, + XSDataMXCuBEDataSet, + XSDataResultMXCuBE, +) + from mxcubecore import HardwareRepository as HWR from mxcubecore.HardwareObjects.abstract.AbstractCharacterisation import ( AbstractCharacterisation, ) - -from XSDataMXCuBEv1_4 import XSDataInputMXCuBE -from XSDataMXCuBEv1_4 import XSDataMXCuBEDataSet -from XSDataMXCuBEv1_4 import XSDataResultMXCuBE - -from XSDataCommon import XSDataAngle -from XSDataCommon import XSDataBoolean -from XSDataCommon import XSDataDouble -from XSDataCommon import XSDataFile -from XSDataCommon import XSDataImage -from XSDataCommon import XSDataFlux -from XSDataCommon import XSDataLength -from XSDataCommon import XSDataTime -from XSDataCommon import XSDataWavelength -from XSDataCommon import XSDataInteger -from XSDataCommon import XSDataSize -from XSDataCommon import XSDataString +from mxcubecore.HardwareObjects.SecureXMLRpcRequestHandler import ( + SecureXMLRpcRequestHandler, +) +from mxcubecore.model import queue_model_enumerables as qme +from mxcubecore.model import queue_model_objects as qmo # from edna_test_data import EDNA_DEFAULT_INPUT # from edna_test_data import EDNA_TEST_DATA diff --git a/mxcubecore/HardwareObjects/EMBL/EMBLAperture.py b/mxcubecore/HardwareObjects/EMBL/EMBLAperture.py index e1f29c2427..e750231432 100644 --- a/mxcubecore/HardwareObjects/EMBL/EMBLAperture.py +++ b/mxcubecore/HardwareObjects/EMBL/EMBLAperture.py @@ -19,9 +19,7 @@ """Inherited from AbstracAperture""" -from mxcubecore.HardwareObjects.abstract.AbstractAperture import ( - AbstractAperture, -) +from mxcubecore.HardwareObjects.abstract.AbstractAperture import AbstractAperture __credits__ = ["EMBL Hamburg"] __license__ = "LGPLv3+" diff --git a/mxcubecore/HardwareObjects/EMBL/EMBLBSD.py b/mxcubecore/HardwareObjects/EMBL/EMBLBSD.py index 1ad3689e03..eca40ba42b 100644 --- a/mxcubecore/HardwareObjects/EMBL/EMBLBSD.py +++ b/mxcubecore/HardwareObjects/EMBL/EMBLBSD.py @@ -19,14 +19,12 @@ """EMBLBSD (Beam shaping device) represents a diffractometer without a gonio""" -import time import logging -import gevent +import time -from mxcubecore.HardwareObjects.GenericDiffractometer import ( - GenericDiffractometer, -) +import gevent +from mxcubecore.HardwareObjects.GenericDiffractometer import GenericDiffractometer __credits__ = ["EMBL Hamburg"] __license__ = "LGPLv3+" diff --git a/mxcubecore/HardwareObjects/EMBL/EMBLBeam.py b/mxcubecore/HardwareObjects/EMBL/EMBLBeam.py index 0f5729adaa..76fd5ceee8 100644 --- a/mxcubecore/HardwareObjects/EMBL/EMBLBeam.py +++ b/mxcubecore/HardwareObjects/EMBL/EMBLBeam.py @@ -23,12 +23,11 @@ It can include aperture, slits and/or beam focusing hwobj """ import ast -import sys import logging +import sys from mxcubecore.HardwareObjects.abstract.AbstractBeam import AbstractBeam - __credits__ = ["EMBL Hamburg"] __license__ = "LGPLv3+" __category__ = "General" diff --git a/mxcubecore/HardwareObjects/EMBL/EMBLBeamCentering.py b/mxcubecore/HardwareObjects/EMBL/EMBLBeamCentering.py index 35ce6e36bc..96ab0315fd 100644 --- a/mxcubecore/HardwareObjects/EMBL/EMBLBeamCentering.py +++ b/mxcubecore/HardwareObjects/EMBL/EMBLBeamCentering.py @@ -19,13 +19,13 @@ import logging from time import sleep + import gevent -from scipy.interpolate import interp1d import tine +from scipy.interpolate import interp1d -from mxcubecore.BaseHardwareObjects import HardwareObject from mxcubecore import HardwareRepository as HWR - +from mxcubecore.BaseHardwareObjects import HardwareObject __credits__ = ["EMBL Hamburg"] __category__ = "General" diff --git a/mxcubecore/HardwareObjects/EMBL/EMBLBeamFocusing.py b/mxcubecore/HardwareObjects/EMBL/EMBLBeamFocusing.py index f25bca65ca..ad55979160 100644 --- a/mxcubecore/HardwareObjects/EMBL/EMBLBeamFocusing.py +++ b/mxcubecore/HardwareObjects/EMBL/EMBLBeamFocusing.py @@ -20,10 +20,9 @@ import logging import gevent - from tine import query as tinequery -from mxcubecore.BaseHardwareObjects import HardwareObject +from mxcubecore.BaseHardwareObjects import HardwareObject __credits__ = ["EMBL Hamburg"] __license__ = "LGPLv3+" diff --git a/mxcubecore/HardwareObjects/EMBL/EMBLBeamline.py b/mxcubecore/HardwareObjects/EMBL/EMBLBeamline.py index f8c392b7b5..5ae39a0c51 100644 --- a/mxcubecore/HardwareObjects/EMBL/EMBLBeamline.py +++ b/mxcubecore/HardwareObjects/EMBL/EMBLBeamline.py @@ -24,14 +24,19 @@ All HardwareObjects """ -from __future__ import division, absolute_import -from __future__ import print_function, unicode_literals +from __future__ import ( + absolute_import, + division, + print_function, + unicode_literals, +) __copyright__ = """ Copyright © 2019 by the MXCuBE collaboration """ __license__ = "LGPLv3+" __author__ = "Rasmus H Fogh" from collections import OrderedDict + from mxcubecore.HardwareObjects.Beamline import Beamline diff --git a/mxcubecore/HardwareObjects/EMBL/EMBLBeamlineTest.py b/mxcubecore/HardwareObjects/EMBL/EMBLBeamlineTest.py index edee56f9e2..10142a1dfa 100644 --- a/mxcubecore/HardwareObjects/EMBL/EMBLBeamlineTest.py +++ b/mxcubecore/HardwareObjects/EMBL/EMBLBeamlineTest.py @@ -17,31 +17,30 @@ # You should have received a copy of the GNU Lesser General Public License # along with MXCuBE. If not, see . -import os -import tine -import numpy -import gevent import logging +import os import tempfile - -import numpy as np - - from csv import reader -from time import sleep from datetime import datetime from random import random -from scipy.interpolate import interp1d -from matplotlib.figure import Figure +from time import sleep + +import gevent +import numpy +import numpy as np +import tine from matplotlib.backends.backend_agg import FigureCanvasAgg +from matplotlib.figure import Figure +from scipy.interpolate import interp1d + +from mxcubecore.BaseHardwareObjects import HardwareObject +from mxcubecore.HardwareObjects import SimpleHTML # try: # import pdfkit # except Exception: # logging.getLogger("HWR").warning("pdfkit not available") -from mxcubecore.HardwareObjects import SimpleHTML -from mxcubecore.BaseHardwareObjects import HardwareObject __credits__ = ["EMBL Hamburg"] diff --git a/mxcubecore/HardwareObjects/EMBL/EMBLBeamstop.py b/mxcubecore/HardwareObjects/EMBL/EMBLBeamstop.py index bf06c9213e..969506e741 100644 --- a/mxcubecore/HardwareObjects/EMBL/EMBLBeamstop.py +++ b/mxcubecore/HardwareObjects/EMBL/EMBLBeamstop.py @@ -20,7 +20,6 @@ from mxcubecore.BaseHardwareObjects import HardwareObject from mxcubecore.HardwareObjects.abstract.AbstractMotor import AbstractMotor - __credits__ = ["EMBL Hamburg"] __version__ = "2.3." __category__ = "General" diff --git a/mxcubecore/HardwareObjects/EMBL/EMBLCRL.py b/mxcubecore/HardwareObjects/EMBL/EMBLCRL.py index 8b39685e43..0f8269b21a 100644 --- a/mxcubecore/HardwareObjects/EMBL/EMBLCRL.py +++ b/mxcubecore/HardwareObjects/EMBL/EMBLCRL.py @@ -19,13 +19,13 @@ """EMBLCRL""" -import math import logging +import math + import gevent -from mxcubecore.BaseHardwareObjects import HardwareObject from mxcubecore import HardwareRepository as HWR - +from mxcubecore.BaseHardwareObjects import HardwareObject __credits__ = ["EMBL Hamburg"] __license__ = "LGPLv3+" diff --git a/mxcubecore/HardwareObjects/EMBL/EMBLCollect.py b/mxcubecore/HardwareObjects/EMBL/EMBLCollect.py index 1ad690323c..a5d753eee9 100644 --- a/mxcubecore/HardwareObjects/EMBL/EMBLCollect.py +++ b/mxcubecore/HardwareObjects/EMBL/EMBLCollect.py @@ -21,11 +21,9 @@ import os -from mxcubecore.TaskUtils import task -from mxcubecore.HardwareObjects.abstract.AbstractCollect import AbstractCollect - from mxcubecore import HardwareRepository as HWR - +from mxcubecore.HardwareObjects.abstract.AbstractCollect import AbstractCollect +from mxcubecore.TaskUtils import task __credits__ = ["EMBL Hamburg"] __category__ = "General" diff --git a/mxcubecore/HardwareObjects/EMBL/EMBLDetector.py b/mxcubecore/HardwareObjects/EMBL/EMBLDetector.py index e5985eeac6..c8bc0e73e9 100644 --- a/mxcubecore/HardwareObjects/EMBL/EMBLDetector.py +++ b/mxcubecore/HardwareObjects/EMBL/EMBLDetector.py @@ -24,10 +24,7 @@ import gevent -from mxcubecore.HardwareObjects.abstract.AbstractDetector import ( - AbstractDetector, -) - +from mxcubecore.HardwareObjects.abstract.AbstractDetector import AbstractDetector __credits__ = ["EMBL Hamburg"] __license__ = "LGPLv3+" diff --git a/mxcubecore/HardwareObjects/EMBL/EMBLDoorInterlock.py b/mxcubecore/HardwareObjects/EMBL/EMBLDoorInterlock.py index 990c46b89b..0ceab99bb3 100644 --- a/mxcubecore/HardwareObjects/EMBL/EMBLDoorInterlock.py +++ b/mxcubecore/HardwareObjects/EMBL/EMBLDoorInterlock.py @@ -18,10 +18,11 @@ # along with MXCuBE. If not, see . import logging + import gevent -from mxcubecore.BaseHardwareObjects import HardwareObject -from mxcubecore import HardwareRepository as HWR +from mxcubecore import HardwareRepository as HWR +from mxcubecore.BaseHardwareObjects import HardwareObject __credits__ = ["EMBL Hamburg"] __license__ = "LGPLv3+" diff --git a/mxcubecore/HardwareObjects/EMBL/EMBLEnergy.py b/mxcubecore/HardwareObjects/EMBL/EMBLEnergy.py index be87c5b821..e9190d10a7 100644 --- a/mxcubecore/HardwareObjects/EMBL/EMBLEnergy.py +++ b/mxcubecore/HardwareObjects/EMBL/EMBLEnergy.py @@ -20,11 +20,11 @@ """EMBLEnergy""" import logging + import gevent from mxcubecore.HardwareObjects.abstract.AbstractEnergy import AbstractEnergy - __credits__ = ["EMBL Hamburg"] __license__ = "LGPLv3+" __category__ = "General" diff --git a/mxcubecore/HardwareObjects/EMBL/EMBLEnergyScan.py b/mxcubecore/HardwareObjects/EMBL/EMBLEnergyScan.py index 959b6f476a..114cdaab6e 100644 --- a/mxcubecore/HardwareObjects/EMBL/EMBLEnergyScan.py +++ b/mxcubecore/HardwareObjects/EMBL/EMBLEnergyScan.py @@ -17,23 +17,20 @@ # You should have received a copy of the GNU Lesser General Public License # along with MXCuBE. If not, see . -import os -import time import logging +import os import subprocess +import time import gevent import numpy as np -from matplotlib.figure import Figure from matplotlib.backends.backend_agg import FigureCanvasAgg +from matplotlib.figure import Figure +from mxcubecore import HardwareRepository as HWR from mxcubecore import TaskUtils -from mxcubecore.HardwareObjects.abstract.AbstractEnergyScan import ( - AbstractEnergyScan, -) from mxcubecore.BaseHardwareObjects import HardwareObject -from mxcubecore import HardwareRepository as HWR - +from mxcubecore.HardwareObjects.abstract.AbstractEnergyScan import AbstractEnergyScan __credits__ = ["EMBL Hamburg"] __license__ = "LGPLv3+" diff --git a/mxcubecore/HardwareObjects/EMBL/EMBLExporterClient.py b/mxcubecore/HardwareObjects/EMBL/EMBLExporterClient.py index dd1faf95bc..624419ca4c 100644 --- a/mxcubecore/HardwareObjects/EMBL/EMBLExporterClient.py +++ b/mxcubecore/HardwareObjects/EMBL/EMBLExporterClient.py @@ -23,7 +23,6 @@ from mxcubecore.BaseHardwareObjects import HardwareObject from mxcubecore.Command import Exporter - __credits__ = ["EMBL Hamburg"] __license__ = "LGPLv3+" __category__ = "General" diff --git a/mxcubecore/HardwareObjects/EMBL/EMBLFlux.py b/mxcubecore/HardwareObjects/EMBL/EMBLFlux.py index bc0f5ddc12..2aa5a3c043 100644 --- a/mxcubecore/HardwareObjects/EMBL/EMBLFlux.py +++ b/mxcubecore/HardwareObjects/EMBL/EMBLFlux.py @@ -17,19 +17,17 @@ # You should have received a copy of the GNU Lesser General Public License # along with MXCuBE. If not, see . -import tine -import numpy -import gevent import logging - from copy import deepcopy from datetime import datetime -from scipy.interpolate import interp1d -from mxcubecore.HardwareObjects.abstract.AbstractFlux import AbstractFlux +import gevent +import numpy +import tine +from scipy.interpolate import interp1d from mxcubecore import HardwareRepository as HWR - +from mxcubecore.HardwareObjects.abstract.AbstractFlux import AbstractFlux __credits__ = ["EMBL Hamburg"] __category__ = "General" diff --git a/mxcubecore/HardwareObjects/EMBL/EMBLImageTracking.py b/mxcubecore/HardwareObjects/EMBL/EMBLImageTracking.py index e1d3940c75..4ec8e28a7b 100644 --- a/mxcubecore/HardwareObjects/EMBL/EMBLImageTracking.py +++ b/mxcubecore/HardwareObjects/EMBL/EMBLImageTracking.py @@ -25,7 +25,6 @@ from mxcubecore.BaseHardwareObjects import HardwareObject - __credits__ = ["EMBL Hamburg"] __license__ = "LGPLv3+" __category__ = "General" diff --git a/mxcubecore/HardwareObjects/EMBL/EMBLMachineInfo.py b/mxcubecore/HardwareObjects/EMBL/EMBLMachineInfo.py index 81620c0092..83b43710e1 100644 --- a/mxcubecore/HardwareObjects/EMBL/EMBLMachineInfo.py +++ b/mxcubecore/HardwareObjects/EMBL/EMBLMachineInfo.py @@ -23,9 +23,9 @@ information). Value limits are included """ +import logging import os import time -import logging try: from urllib2 import urlopen @@ -33,13 +33,15 @@ from urllib.request import urlopen from collections import OrderedDict -from datetime import datetime, timedelta -from gevent import spawn +from datetime import ( + datetime, + timedelta, +) -from mxcubecore.BaseHardwareObjects import HardwareObject +from gevent import spawn from mxcubecore import HardwareRepository as HWR - +from mxcubecore.BaseHardwareObjects import HardwareObject __credits__ = ["EMBL Hamburg"] __license__ = "LGPLv3+" diff --git a/mxcubecore/HardwareObjects/EMBL/EMBLMiniDiff.py b/mxcubecore/HardwareObjects/EMBL/EMBLMiniDiff.py index bc9f96eded..64c7c3b981 100644 --- a/mxcubecore/HardwareObjects/EMBL/EMBLMiniDiff.py +++ b/mxcubecore/HardwareObjects/EMBL/EMBLMiniDiff.py @@ -17,12 +17,12 @@ # You should have received a copy of the GNU Lesser General Public License # along with MXCuBE. If not, see . -import time -import gevent import logging - +import time from math import sqrt +import gevent + try: import lucid3 as lucid except ImportError: @@ -33,12 +33,9 @@ "Could not find autocentring library, automatic centring is disabled" ) -from mxcubecore.HardwareObjects.GenericDiffractometer import ( - GenericDiffractometer, -) -from mxcubecore.TaskUtils import task from mxcubecore import HardwareRepository as HWR - +from mxcubecore.HardwareObjects.GenericDiffractometer import GenericDiffractometer +from mxcubecore.TaskUtils import task __credits__ = ["EMBL Hamburg"] __category__ = "General" diff --git a/mxcubecore/HardwareObjects/EMBL/EMBLMotorsGroup.py b/mxcubecore/HardwareObjects/EMBL/EMBLMotorsGroup.py index cc8c27e286..e5608a9aa5 100644 --- a/mxcubecore/HardwareObjects/EMBL/EMBLMotorsGroup.py +++ b/mxcubecore/HardwareObjects/EMBL/EMBLMotorsGroup.py @@ -76,14 +76,13 @@ """ -import time import logging +import time import gevent - import tine -from mxcubecore.BaseHardwareObjects import HardwareObject +from mxcubecore.BaseHardwareObjects import HardwareObject __credits__ = ["EMBL Hamburg"] __license__ = "LGPLv3+" diff --git a/mxcubecore/HardwareObjects/EMBL/EMBLOfflineProcessing.py b/mxcubecore/HardwareObjects/EMBL/EMBLOfflineProcessing.py index 7f5a9f4e68..eb56f189e4 100644 --- a/mxcubecore/HardwareObjects/EMBL/EMBLOfflineProcessing.py +++ b/mxcubecore/HardwareObjects/EMBL/EMBLOfflineProcessing.py @@ -16,22 +16,21 @@ # You should have received a copy of the GNU Lesser General Public License # along with MXCuBE. If not, see . -import os -import time import logging +import os import subprocess +import time import gevent from mxcubecore.BaseHardwareObjects import HardwareObject +from mxcubecore.HardwareObjects.XSDataAutoprocv1_0 import XSDataAutoprocInput from mxcubecore.HardwareObjects.XSDataCommon import ( XSDataDouble, XSDataFile, XSDataInteger, XSDataString, ) -from mxcubecore.HardwareObjects.XSDataAutoprocv1_0 import XSDataAutoprocInput - __credits__ = ["EMBL Hamburg"] __license__ = "LGPLv3+" diff --git a/mxcubecore/HardwareObjects/EMBL/EMBLOnlineProcessing.py b/mxcubecore/HardwareObjects/EMBL/EMBLOnlineProcessing.py index 98f909b4c0..41aedd912b 100644 --- a/mxcubecore/HardwareObjects/EMBL/EMBLOnlineProcessing.py +++ b/mxcubecore/HardwareObjects/EMBL/EMBLOnlineProcessing.py @@ -22,18 +22,18 @@ EMBLOnlineProcessing """ -import os import ast import logging +import os import subprocess -import numpy as np import gevent +import numpy as np +from mxcubecore import HardwareRepository as HWR from mxcubecore.HardwareObjects.abstract.AbstractOnlineProcessing import ( AbstractOnlineProcessing, ) - from mxcubecore.HardwareObjects.XSDataCommon import ( XSDataBoolean, XSDataDouble, @@ -41,14 +41,11 @@ XSDataString, ) from mxcubecore.HardwareObjects.XSDataControlDozorv1_1 import ( + XSDataControlImageDozor, XSDataInputControlDozor, XSDataResultControlDozor, - XSDataControlImageDozor, ) - -from mxcubecore import HardwareRepository as HWR - __credits__ = ["EMBL Hamburg"] __license__ = "LGPLv3+" diff --git a/mxcubecore/HardwareObjects/EMBL/EMBLPPUControl.py b/mxcubecore/HardwareObjects/EMBL/EMBLPPUControl.py index 88807f2968..82ba777c7c 100644 --- a/mxcubecore/HardwareObjects/EMBL/EMBLPPUControl.py +++ b/mxcubecore/HardwareObjects/EMBL/EMBLPPUControl.py @@ -2,7 +2,6 @@ from mxcubecore.BaseHardwareObjects import HardwareObject - __credits__ = ["EMBL Hamburg"] __category__ = "General" diff --git a/mxcubecore/HardwareObjects/EMBL/EMBLQueueEntry.py b/mxcubecore/HardwareObjects/EMBL/EMBLQueueEntry.py index 86bb909e29..ea8ae195fa 100644 --- a/mxcubecore/HardwareObjects/EMBL/EMBLQueueEntry.py +++ b/mxcubecore/HardwareObjects/EMBL/EMBLQueueEntry.py @@ -23,14 +23,13 @@ import logging +from mxcubecore import HardwareRepository as HWR from mxcubecore.dispatcher import dispatcher from mxcubecore.queue_entry.base_queue_entry import ( + QUEUE_ENTRY_STATUS, BaseQueueEntry, QueueExecutionException, - QUEUE_ENTRY_STATUS, ) -from mxcubecore import HardwareRepository as HWR - __credits__ = ["MXCuBE collaboration"] __license__ = "LGPLv3+" diff --git a/mxcubecore/HardwareObjects/EMBL/EMBLSSXChip.py b/mxcubecore/HardwareObjects/EMBL/EMBLSSXChip.py index 2b0bdc55ba..73a583a498 100644 --- a/mxcubecore/HardwareObjects/EMBL/EMBLSSXChip.py +++ b/mxcubecore/HardwareObjects/EMBL/EMBLSSXChip.py @@ -19,9 +19,9 @@ import logging -from mxcubecore.utils import qt_import from mxcubecore.HardwareObjects import QtGraphicsLib as GraphicsLib from mxcubecore.HardwareObjects.QtGraphicsManager import QtGraphicsManager +from mxcubecore.utils import qt_import SEQ_ITEM_COLORS = ( qt_import.QColor(204, 255, 204), diff --git a/mxcubecore/HardwareObjects/EMBL/EMBLSafetyShutter.py b/mxcubecore/HardwareObjects/EMBL/EMBLSafetyShutter.py index b98a788f21..000dd16d6c 100644 --- a/mxcubecore/HardwareObjects/EMBL/EMBLSafetyShutter.py +++ b/mxcubecore/HardwareObjects/EMBL/EMBLSafetyShutter.py @@ -20,10 +20,13 @@ """EMBLSafetyShutter""" import logging -from enum import Enum, unique -from mxcubecore.HardwareObjects.abstract.AbstractShutter import AbstractShutter -from mxcubecore.BaseHardwareObjects import HardwareObjectState +from enum import ( + Enum, + unique, +) +from mxcubecore.BaseHardwareObjects import HardwareObjectState +from mxcubecore.HardwareObjects.abstract.AbstractShutter import AbstractShutter __credits__ = ["EMBL Hamburg"] __license__ = "LGPLv3+" diff --git a/mxcubecore/HardwareObjects/EMBL/EMBLSession.py b/mxcubecore/HardwareObjects/EMBL/EMBLSession.py index 9c71375f7a..ca398e6b18 100644 --- a/mxcubecore/HardwareObjects/EMBL/EMBLSession.py +++ b/mxcubecore/HardwareObjects/EMBL/EMBLSession.py @@ -28,7 +28,6 @@ from mxcubecore.HardwareObjects.Session import Session - __credits__ = ["EMBL Hamburg"] __license__ = "LGPLv3+" __category__ = "General" diff --git a/mxcubecore/HardwareObjects/EMBL/EMBLSlitBox.py b/mxcubecore/HardwareObjects/EMBL/EMBLSlitBox.py index bfb9b0c069..91f6a8adfa 100644 --- a/mxcubecore/HardwareObjects/EMBL/EMBLSlitBox.py +++ b/mxcubecore/HardwareObjects/EMBL/EMBLSlitBox.py @@ -72,7 +72,6 @@ from mxcubecore.HardwareObjects.abstract.AbstractSlits import AbstractSlits - __credits__ = ["EMBL Hamburg"] __license__ = "LGPLv3+" __category__ = "Motor" diff --git a/mxcubecore/HardwareObjects/EMBL/EMBLTableMotor.py b/mxcubecore/HardwareObjects/EMBL/EMBLTableMotor.py index b06151a3a8..2883706eb5 100644 --- a/mxcubecore/HardwareObjects/EMBL/EMBLTableMotor.py +++ b/mxcubecore/HardwareObjects/EMBL/EMBLTableMotor.py @@ -19,10 +19,10 @@ """EMBLTableMotor""" -import time import atexit import logging import socket +import time from mxcubecore.HardwareObjects.abstract.AbstractMotor import AbstractMotor diff --git a/mxcubecore/HardwareObjects/EMBL/EMBLTransfocator.py b/mxcubecore/HardwareObjects/EMBL/EMBLTransfocator.py index ef1fde6926..b4bf816e82 100644 --- a/mxcubecore/HardwareObjects/EMBL/EMBLTransfocator.py +++ b/mxcubecore/HardwareObjects/EMBL/EMBLTransfocator.py @@ -20,11 +20,11 @@ """EMBLTransfocator""" import logging + import gevent from mxcubecore.BaseHardwareObjects import HardwareObject - __credits__ = ["EMBL Hamburg"] __category__ = "General" diff --git a/mxcubecore/HardwareObjects/EMBL/EMBLXRFSpectrum.py b/mxcubecore/HardwareObjects/EMBL/EMBLXRFSpectrum.py index 5d62fc57b1..d951769ada 100644 --- a/mxcubecore/HardwareObjects/EMBL/EMBLXRFSpectrum.py +++ b/mxcubecore/HardwareObjects/EMBL/EMBLXRFSpectrum.py @@ -18,15 +18,12 @@ # along with MXCuBE. If not, see . import logging -import gevent -from mxcubecore.HardwareObjects.abstract.AbstractXRFSpectrum import ( - AbstractXRFSpectrum, -) -from mxcubecore.BaseHardwareObjects import HardwareObject +import gevent from mxcubecore import HardwareRepository as HWR - +from mxcubecore.BaseHardwareObjects import HardwareObject +from mxcubecore.HardwareObjects.abstract.AbstractXRFSpectrum import AbstractXRFSpectrum __credits__ = ["EMBL Hamburg"] __license__ = "LGPLv3+" diff --git a/mxcubecore/HardwareObjects/EMBL/EMBLXrayImaging.py b/mxcubecore/HardwareObjects/EMBL/EMBLXrayImaging.py index 513a8c21d7..76e35783ff 100644 --- a/mxcubecore/HardwareObjects/EMBL/EMBLXrayImaging.py +++ b/mxcubecore/HardwareObjects/EMBL/EMBLXrayImaging.py @@ -18,33 +18,36 @@ # You should have received a copy of the GNU Lesser General Public License # along with MXCuBE. If not, see . -import os -import tine +import collections import json -import time -import Image import logging +import os import threading -import collections -from queue import Queue +import time from copy import deepcopy - -import gevent +from queue import Queue import cv2 as cv +import gevent +import Image import numpy as np -from scipy import ndimage, misc - +import tine from cStringIO import StringIO from PIL.ImageQt import ImageQt +from scipy import ( + misc, + ndimage, +) -from mxcubecore.utils import qt_import, Colors -from mxcubecore.TaskUtils import task +from mxcubecore import HardwareRepository as HWR from mxcubecore.HardwareObjects.abstract.AbstractCollect import AbstractCollect from mxcubecore.HardwareObjects.QtGraphicsManager import QtGraphicsManager from mxcubecore.model import queue_model_objects as qmo -from mxcubecore import HardwareRepository as HWR - +from mxcubecore.TaskUtils import task +from mxcubecore.utils import ( + Colors, + qt_import, +) __credits__ = ["EMBL Hamburg"] __category__ = "Task" diff --git a/mxcubecore/HardwareObjects/EMBL/MDFastShutter.py b/mxcubecore/HardwareObjects/EMBL/MDFastShutter.py index 2a298304f4..619fc3b6bc 100644 --- a/mxcubecore/HardwareObjects/EMBL/MDFastShutter.py +++ b/mxcubecore/HardwareObjects/EMBL/MDFastShutter.py @@ -17,8 +17,13 @@ # along with MXCuBE. If not, see . +from enum import ( + Enum, + unique, +) + import gevent -from enum import Enum, unique + from mxcubecore.HardwareObjects.abstract.AbstractShutter import AbstractShutter __credits__ = ["EMBL Hamburg"] diff --git a/mxcubecore/HardwareObjects/EMBL/TINEMotor.py b/mxcubecore/HardwareObjects/EMBL/TINEMotor.py index b60c74e2e2..d7aa7ab6fa 100644 --- a/mxcubecore/HardwareObjects/EMBL/TINEMotor.py +++ b/mxcubecore/HardwareObjects/EMBL/TINEMotor.py @@ -21,12 +21,12 @@ """ import logging + import gevent from mxcubecore.BaseHardwareObjects import HardwareObjectState from mxcubecore.HardwareObjects.abstract.AbstractMotor import AbstractMotor - __credits__ = ["EMBL Hamburg"] __license__ = "LGPLv3+" __category__ = "Motor" diff --git a/mxcubecore/HardwareObjects/EMBLFlexHCD.py b/mxcubecore/HardwareObjects/EMBLFlexHCD.py index af5c7ac40f..8c0ec13933 100644 --- a/mxcubecore/HardwareObjects/EMBLFlexHCD.py +++ b/mxcubecore/HardwareObjects/EMBLFlexHCD.py @@ -28,16 +28,16 @@ /puck_configuration> """ -import time import ast import base64 -import pickle import logging +import pickle +import time + import gevent +from PyTango.gevent import DeviceProxy from mxcubecore import HardwareRepository as HWR - -from mxcubecore.TaskUtils import task from mxcubecore.HardwareObjects.abstract.AbstractSampleChanger import ( SampleChanger, SampleChangerState, @@ -46,7 +46,7 @@ Container, Sample, ) -from PyTango.gevent import DeviceProxy +from mxcubecore.TaskUtils import task class Pin(Sample): diff --git a/mxcubecore/HardwareObjects/EMBLFlexHarvester.py b/mxcubecore/HardwareObjects/EMBLFlexHarvester.py index 50422e2535..6bb6cd8262 100644 --- a/mxcubecore/HardwareObjects/EMBLFlexHarvester.py +++ b/mxcubecore/HardwareObjects/EMBLFlexHarvester.py @@ -25,13 +25,13 @@ lid231flex1:9001 """ -import time import logging -import gevent +import time -from mxcubecore.TaskUtils import task +import gevent from mxcubecore.HardwareObjects.EMBLFlexHCD import EMBLFlexHCD +from mxcubecore.TaskUtils import task class EMBLFlexHarvester(EMBLFlexHCD): diff --git a/mxcubecore/HardwareObjects/ESRF/BM14EnergyScan.py b/mxcubecore/HardwareObjects/ESRF/BM14EnergyScan.py index f4320964d5..0c801825dd 100644 --- a/mxcubecore/HardwareObjects/ESRF/BM14EnergyScan.py +++ b/mxcubecore/HardwareObjects/ESRF/BM14EnergyScan.py @@ -1,6 +1,11 @@ import logging + +from ESRFEnergyScan import ( + ESRFEnergyScan, + TunableEnergy, +) + from mxcubecore.TaskUtils import task -from ESRFEnergyScan import ESRFEnergyScan, TunableEnergy class BM14EnergyScan(ESRFEnergyScan): diff --git a/mxcubecore/HardwareObjects/ESRF/BlissHutchTrigger.py b/mxcubecore/HardwareObjects/ESRF/BlissHutchTrigger.py index d7a06d0ad3..a7009d06aa 100644 --- a/mxcubecore/HardwareObjects/ESRF/BlissHutchTrigger.py +++ b/mxcubecore/HardwareObjects/ESRF/BlissHutchTrigger.py @@ -37,9 +37,14 @@ """ import logging -from gevent import sleep, spawn -from PyTango.gevent import DeviceProxy + +from gevent import ( + sleep, + spawn, +) from PyTango import DevFailed +from PyTango.gevent import DeviceProxy + from mxcubecore.HardwareObjects.abstract.AbstractNState import AbstractNState __copyright__ = """ Copyright © 2010-2020 by the MXCuBE collaboration """ diff --git a/mxcubecore/HardwareObjects/ESRF/BlissTurret.py b/mxcubecore/HardwareObjects/ESRF/BlissTurret.py index 916a95f5e6..1cc116637b 100644 --- a/mxcubecore/HardwareObjects/ESRF/BlissTurret.py +++ b/mxcubecore/HardwareObjects/ESRF/BlissTurret.py @@ -1,6 +1,7 @@ -from mxcubecore.BaseHardwareObjects import HardwareObject from bliss.config import static +from mxcubecore.BaseHardwareObjects import HardwareObject + class BlissTurret(HardwareObject): def __init__(self, name): diff --git a/mxcubecore/HardwareObjects/ESRF/BlissVolpi.py b/mxcubecore/HardwareObjects/ESRF/BlissVolpi.py index 808256b400..e5210b2fb0 100644 --- a/mxcubecore/HardwareObjects/ESRF/BlissVolpi.py +++ b/mxcubecore/HardwareObjects/ESRF/BlissVolpi.py @@ -1,6 +1,7 @@ -from mxcubecore.BaseHardwareObjects import HardwareObject from bliss.config import static +from mxcubecore.BaseHardwareObjects import HardwareObject + class BlissVolpi(HardwareObject): def __init__(self, name): diff --git a/mxcubecore/HardwareObjects/ESRF/ESRFBeam.py b/mxcubecore/HardwareObjects/ESRF/ESRFBeam.py index 7401713217..279b8c8caf 100644 --- a/mxcubecore/HardwareObjects/ESRF/ESRFBeam.py +++ b/mxcubecore/HardwareObjects/ESRF/ESRFBeam.py @@ -29,8 +29,8 @@ import logging -from mxcubecore.HardwareObjects.abstract.AbstractBeam import AbstractBeam from mxcubecore import HardwareRepository as HWR +from mxcubecore.HardwareObjects.abstract.AbstractBeam import AbstractBeam class ESRFBeam(AbstractBeam): diff --git a/mxcubecore/HardwareObjects/ESRF/ESRFBeamDefiner.py b/mxcubecore/HardwareObjects/ESRF/ESRFBeamDefiner.py index 213604cb3f..37d8b873ca 100644 --- a/mxcubecore/HardwareObjects/ESRF/ESRFBeamDefiner.py +++ b/mxcubecore/HardwareObjects/ESRF/ESRFBeamDefiner.py @@ -43,6 +43,7 @@ from ast import literal_eval from enum import Enum + from mxcubecore.HardwareObjects.abstract.AbstractNState import AbstractNState diff --git a/mxcubecore/HardwareObjects/ESRF/ESRFBeamInfo.py b/mxcubecore/HardwareObjects/ESRF/ESRFBeamInfo.py index 6b0adfb620..d8b7a9e3be 100644 --- a/mxcubecore/HardwareObjects/ESRF/ESRFBeamInfo.py +++ b/mxcubecore/HardwareObjects/ESRF/ESRFBeamInfo.py @@ -1,6 +1,7 @@ import logging -from mxcubecore.HardwareObjects import BeamInfo + from mxcubecore import HardwareRepository as HWR +from mxcubecore.HardwareObjects import BeamInfo """ XML example file diff --git a/mxcubecore/HardwareObjects/ESRF/ESRFBeamlineActions.py b/mxcubecore/HardwareObjects/ESRF/ESRFBeamlineActions.py index ef4d154eca..390dec46ce 100644 --- a/mxcubecore/HardwareObjects/ESRF/ESRFBeamlineActions.py +++ b/mxcubecore/HardwareObjects/ESRF/ESRFBeamlineActions.py @@ -35,14 +35,15 @@ """ import ast + import gevent -from mxcubecore.TaskUtils import task from mxcubecore.HardwareObjects.BeamlineActions import ( BeamlineActions, ControllerCommand, HWObjActuatorCommand, ) +from mxcubecore.TaskUtils import task __copyright__ = """ Copyright © 2010-2023 by the MXCuBE collaboration """ __license__ = "LGPLv3+" diff --git a/mxcubecore/HardwareObjects/ESRF/ESRFCryoMon.py b/mxcubecore/HardwareObjects/ESRF/ESRFCryoMon.py index 3a3b736e4c..5bb7505ab4 100644 --- a/mxcubecore/HardwareObjects/ESRF/ESRFCryoMon.py +++ b/mxcubecore/HardwareObjects/ESRF/ESRFCryoMon.py @@ -1,7 +1,9 @@ +import time + +import gevent from PyTango.gevent import DeviceProxy + from mxcubecore.BaseHardwareObjects import HardwareObject -import gevent -import time CRYO_STATUS = ["OFF", "SATURATED", "READY", "WARNING", "FROZEN", "UNKNOWN"] diff --git a/mxcubecore/HardwareObjects/ESRF/ESRFEnergyScan.py b/mxcubecore/HardwareObjects/ESRF/ESRFEnergyScan.py index 17277567be..32f8aa2803 100644 --- a/mxcubecore/HardwareObjects/ESRF/ESRFEnergyScan.py +++ b/mxcubecore/HardwareObjects/ESRF/ESRFEnergyScan.py @@ -1,25 +1,23 @@ import logging -import time +import math import os import os.path import shutil -import math -import gevent # import PyChooch # to run chooch in shell import subprocess -import numpy +import time -from matplotlib.figure import Figure +import gevent +import numpy from matplotlib.backends.backend_agg import FigureCanvasAgg +from matplotlib.figure import Figure -from mxcubecore.TaskUtils import task -from mxcubecore.BaseHardwareObjects import HardwareObject -from mxcubecore.HardwareObjects.abstract.AbstractEnergyScan import ( - AbstractEnergyScan, -) from mxcubecore import HardwareRepository as HWR +from mxcubecore.BaseHardwareObjects import HardwareObject +from mxcubecore.HardwareObjects.abstract.AbstractEnergyScan import AbstractEnergyScan +from mxcubecore.TaskUtils import task class FixedEnergy: diff --git a/mxcubecore/HardwareObjects/ESRF/ESRFMD2SC3.py b/mxcubecore/HardwareObjects/ESRF/ESRFMD2SC3.py index 6c687f7e6b..49b954fee8 100644 --- a/mxcubecore/HardwareObjects/ESRF/ESRFMD2SC3.py +++ b/mxcubecore/HardwareObjects/ESRF/ESRFMD2SC3.py @@ -1,9 +1,10 @@ """ESRF SC3 Sample Changer Hardware Object """ -from mxcubecore.TaskUtils import task -import SC3 import ESRF.ESRFSC3 as ESRFSC3 +import SC3 + +from mxcubecore.TaskUtils import task class Command: diff --git a/mxcubecore/HardwareObjects/ESRF/ESRFMetadataManagerClient.py b/mxcubecore/HardwareObjects/ESRF/ESRFMetadataManagerClient.py index 2b31f2f30e..d7fc9c6abb 100644 --- a/mxcubecore/HardwareObjects/ESRF/ESRFMetadataManagerClient.py +++ b/mxcubecore/HardwareObjects/ESRF/ESRFMetadataManagerClient.py @@ -3,18 +3,20 @@ """A simple client for MetadataManager and MetaExperiment """ from __future__ import print_function + +import logging +import math import os +import smtplib import sys -import math import time -import logging -import PyTango.client import traceback from email.mime.text import MIMEText -import smtplib -from mxcubecore.utils.conversion import string_types +import PyTango.client + from mxcubecore import HardwareRepository as HWR +from mxcubecore.utils.conversion import string_types class MetadataManagerClient(object): diff --git a/mxcubecore/HardwareObjects/ESRF/ESRFMultiCollect.py b/mxcubecore/HardwareObjects/ESRF/ESRFMultiCollect.py index 990210d619..7ded2bdf32 100644 --- a/mxcubecore/HardwareObjects/ESRF/ESRFMultiCollect.py +++ b/mxcubecore/HardwareObjects/ESRF/ESRFMultiCollect.py @@ -1,16 +1,16 @@ -from mxcubecore.BaseHardwareObjects import HardwareObject -from mxcubecore.HardwareObjects.abstract.AbstractMultiCollect import * import logging -import time -import os import math -from mxcubecore.model.queue_model_objects import PathTemplate -from mxcubecore.utils.conversion import string_types -from mxcubecore import HardwareRepository as HWR +import os +import time +from mxcubecore import HardwareRepository as HWR +from mxcubecore.BaseHardwareObjects import HardwareObject +from mxcubecore.HardwareObjects.abstract.AbstractMultiCollect import * from mxcubecore.HardwareObjects.ESRF.ESRFMetadataManagerClient import ( MXCuBEMetadataClient, ) +from mxcubecore.model.queue_model_objects import PathTemplate +from mxcubecore.utils.conversion import string_types try: from httplib import HTTPConnection diff --git a/mxcubecore/HardwareObjects/ESRF/ESRFPhotonFlux.py b/mxcubecore/HardwareObjects/ESRF/ESRFPhotonFlux.py index 54c4e4804a..8d87c9159b 100644 --- a/mxcubecore/HardwareObjects/ESRF/ESRFPhotonFlux.py +++ b/mxcubecore/HardwareObjects/ESRF/ESRFPhotonFlux.py @@ -33,6 +33,7 @@ """ import logging + import gevent from mxcubecore import HardwareRepository as HWR diff --git a/mxcubecore/HardwareObjects/ESRF/ESRFSC3.py b/mxcubecore/HardwareObjects/ESRF/ESRFSC3.py index 424639fc65..6993b21154 100644 --- a/mxcubecore/HardwareObjects/ESRF/ESRFSC3.py +++ b/mxcubecore/HardwareObjects/ESRF/ESRFSC3.py @@ -3,9 +3,15 @@ import functools import logging -from mxcubecore.TaskUtils import task, cleanup, error_cleanup + import SC3 +from mxcubecore.TaskUtils import ( + cleanup, + error_cleanup, + task, +) + class ESRFSC3(SC3.SC3): (FLAG_SC_IN_USE, FLAG_MINIDIFF_CAN_MOVE, FLAG_SC_CAN_LOAD, FLAG_SC_NEVER) = ( diff --git a/mxcubecore/HardwareObjects/ESRF/ESRFSession.py b/mxcubecore/HardwareObjects/ESRF/ESRFSession.py index 0211108144..d0fedaae7a 100644 --- a/mxcubecore/HardwareObjects/ESRF/ESRFSession.py +++ b/mxcubecore/HardwareObjects/ESRF/ESRFSession.py @@ -1,11 +1,12 @@ -from mxcubecore.HardwareObjects import Session +import glob import os import time -import glob -from mxcubecore.model import queue_model_objects -from mxcubecore import HardwareRepository as HWR from typing import Tuple +from mxcubecore import HardwareRepository as HWR +from mxcubecore.HardwareObjects import Session +from mxcubecore.model import queue_model_objects + class ESRFSession(Session.Session): def __init__(self, name): diff --git a/mxcubecore/HardwareObjects/ESRF/ESRFSmallXrayCentring.py b/mxcubecore/HardwareObjects/ESRF/ESRFSmallXrayCentring.py index 042de2438a..942b45aa41 100644 --- a/mxcubecore/HardwareObjects/ESRF/ESRFSmallXrayCentring.py +++ b/mxcubecore/HardwareObjects/ESRF/ESRFSmallXrayCentring.py @@ -18,21 +18,25 @@ """ """ -from __future__ import division, absolute_import -from __future__ import print_function, unicode_literals +from __future__ import ( + absolute_import, + division, + print_function, + unicode_literals, +) -import os import json -import time import logging +import os +import time + import requests +from mxcubecore import HardwareRepository as HWR from mxcubecore.HardwareObjects.abstract.AbstractXrayCentring import ( AbstractXrayCentring, ) -from mxcubecore import HardwareRepository as HWR - __copyright__ = """ Copyright © 2016 - 2022 by MXCuBE Collaboration """ __license__ = "LGPLv3+" __author__ = "rhfogh" diff --git a/mxcubecore/HardwareObjects/ESRF/ESRFXRFSpectrum.py b/mxcubecore/HardwareObjects/ESRF/ESRFXRFSpectrum.py index 32cb1d250c..f1f77c1e61 100644 --- a/mxcubecore/HardwareObjects/ESRF/ESRFXRFSpectrum.py +++ b/mxcubecore/HardwareObjects/ESRF/ESRFXRFSpectrum.py @@ -37,16 +37,18 @@ __copyright__ = """ Copyright © by the MXCuBE collaboration """ __license__ = "LGPLv3+" -from unittest.mock import MagicMock import logging import os.path from ast import literal_eval +from unittest.mock import MagicMock from warnings import warn -import numpy -from PyMca5.PyMca import ConfigDict -from PyMca5.PyMca import ClassMcaTheory -from PyMca5.PyMca import QtMcaAdvancedFitReport +import numpy +from PyMca5.PyMca import ( + ClassMcaTheory, + ConfigDict, + QtMcaAdvancedFitReport, +) from mxcubecore.HardwareObjects.abstract.AbstractXRFSpectrum import AbstractXRFSpectrum diff --git a/mxcubecore/HardwareObjects/ESRF/ID231BeamCmds.py b/mxcubecore/HardwareObjects/ESRF/ID231BeamCmds.py index 5952e32407..9d788b7421 100644 --- a/mxcubecore/HardwareObjects/ESRF/ID231BeamCmds.py +++ b/mxcubecore/HardwareObjects/ESRF/ID231BeamCmds.py @@ -1,5 +1,9 @@ from mxcubecore.BaseHardwareObjects import HardwareObject -from .BeamCmds import ControllerCommand, HWObjActuatorCommand + +from .BeamCmds import ( + ControllerCommand, + HWObjActuatorCommand, +) class ID231BeamCmds(HardwareObject): diff --git a/mxcubecore/HardwareObjects/ESRF/ID231BeamInfo.py b/mxcubecore/HardwareObjects/ESRF/ID231BeamInfo.py index 3dcb68264f..cf44caecc0 100644 --- a/mxcubecore/HardwareObjects/ESRF/ID231BeamInfo.py +++ b/mxcubecore/HardwareObjects/ESRF/ID231BeamInfo.py @@ -19,8 +19,9 @@ """ import logging -from mxcubecore.BaseHardwareObjects import HardwareObject + from mxcubecore import HardwareRepository as HWR +from mxcubecore.BaseHardwareObjects import HardwareObject class BeamInfo(HardwareObject): diff --git a/mxcubecore/HardwareObjects/ESRF/ID231EnergyScan.py b/mxcubecore/HardwareObjects/ESRF/ID231EnergyScan.py index 26218e13bb..febd3eb068 100644 --- a/mxcubecore/HardwareObjects/ESRF/ID231EnergyScan.py +++ b/mxcubecore/HardwareObjects/ESRF/ID231EnergyScan.py @@ -1,5 +1,9 @@ from mxcubecore.TaskUtils import task -from .ESRFEnergyScan import ESRFEnergyScan, TunableEnergy + +from .ESRFEnergyScan import ( + ESRFEnergyScan, + TunableEnergy, +) class ID231EnergyScan(ESRFEnergyScan): diff --git a/mxcubecore/HardwareObjects/ESRF/ID231MultiCollect.py b/mxcubecore/HardwareObjects/ESRF/ID231MultiCollect.py index 71a98a9746..2b01a3caee 100644 --- a/mxcubecore/HardwareObjects/ESRF/ID231MultiCollect.py +++ b/mxcubecore/HardwareObjects/ESRF/ID231MultiCollect.py @@ -1,7 +1,12 @@ -from .ESRFMultiCollect import ESRFMultiCollect, task, time -import shutil import logging import os +import shutil + +from .ESRFMultiCollect import ( + ESRFMultiCollect, + task, + time, +) class ID231MultiCollect(ESRFMultiCollect): diff --git a/mxcubecore/HardwareObjects/ESRF/ID232BeamCmds.py b/mxcubecore/HardwareObjects/ESRF/ID232BeamCmds.py index 2b726bf228..a5015b05e5 100644 --- a/mxcubecore/HardwareObjects/ESRF/ID232BeamCmds.py +++ b/mxcubecore/HardwareObjects/ESRF/ID232BeamCmds.py @@ -1,5 +1,9 @@ from mxcubecore.BaseHardwareObjects import HardwareObject -from .BeamCmds import ControllerCommand, HWObjActuatorCommand + +from .BeamCmds import ( + ControllerCommand, + HWObjActuatorCommand, +) class ID232BeamCmds(HardwareObject): diff --git a/mxcubecore/HardwareObjects/ESRF/ID232BeamDefiner.py b/mxcubecore/HardwareObjects/ESRF/ID232BeamDefiner.py index e9aeb9fab7..e98708c174 100644 --- a/mxcubecore/HardwareObjects/ESRF/ID232BeamDefiner.py +++ b/mxcubecore/HardwareObjects/ESRF/ID232BeamDefiner.py @@ -51,7 +51,12 @@ from enum import Enum -from gevent import Timeout, sleep + +from gevent import ( + Timeout, + sleep, +) + from mxcubecore.HardwareObjects.ESRF.ESRFBeamDefiner import ESRFBeamDefiner diff --git a/mxcubecore/HardwareObjects/ESRF/ID232BeamInfo.py b/mxcubecore/HardwareObjects/ESRF/ID232BeamInfo.py index 422d537a6e..2415f1aa38 100644 --- a/mxcubecore/HardwareObjects/ESRF/ID232BeamInfo.py +++ b/mxcubecore/HardwareObjects/ESRF/ID232BeamInfo.py @@ -1,5 +1,5 @@ -from mxcubecore.HardwareObjects import BeamInfo from mxcubecore import HardwareRepository as HWR +from mxcubecore.HardwareObjects import BeamInfo class ID232BeamInfo(BeamInfo.BeamInfo): diff --git a/mxcubecore/HardwareObjects/ESRF/ID232HutchTrigger.py b/mxcubecore/HardwareObjects/ESRF/ID232HutchTrigger.py index 0c0cfd50ed..4400b2720f 100644 --- a/mxcubecore/HardwareObjects/ESRF/ID232HutchTrigger.py +++ b/mxcubecore/HardwareObjects/ESRF/ID232HutchTrigger.py @@ -1,8 +1,10 @@ import logging -import PyTango.gevent -import gevent -import time import sys +import time + +import gevent +import PyTango.gevent + from mxcubecore import BaseHardwareObjects from mxcubecore import HardwareRepository as HWR diff --git a/mxcubecore/HardwareObjects/ESRF/ID232MultiCollect.py b/mxcubecore/HardwareObjects/ESRF/ID232MultiCollect.py index f79e59fa6e..198d5ab9fe 100644 --- a/mxcubecore/HardwareObjects/ESRF/ID232MultiCollect.py +++ b/mxcubecore/HardwareObjects/ESRF/ID232MultiCollect.py @@ -1,11 +1,17 @@ -import gevent -import shutil import logging import os +import shutil + +import gevent -from mxcubecore.TaskUtils import task -from .ESRFMultiCollect import ESRFMultiCollect, PixelDetector, TunableEnergy from mxcubecore.HardwareObjects.LimaPilatusDetector import LimaPilatusDetector +from mxcubecore.TaskUtils import task + +from .ESRFMultiCollect import ( + ESRFMultiCollect, + PixelDetector, + TunableEnergy, +) class ID232MultiCollect(ESRFMultiCollect): diff --git a/mxcubecore/HardwareObjects/ESRF/ID232PhotonFlux.py b/mxcubecore/HardwareObjects/ESRF/ID232PhotonFlux.py index bcc1cba99e..e3b9f663de 100644 --- a/mxcubecore/HardwareObjects/ESRF/ID232PhotonFlux.py +++ b/mxcubecore/HardwareObjects/ESRF/ID232PhotonFlux.py @@ -1,5 +1,5 @@ -from TangoKeithleyPhotonFlux import TangoKeithleyPhotonFlux from bliss.config import channels +from TangoKeithleyPhotonFlux import TangoKeithleyPhotonFlux class ID232PhotonFlux(TangoKeithleyPhotonFlux): diff --git a/mxcubecore/HardwareObjects/ESRF/ID23PhotonFlux.py b/mxcubecore/HardwareObjects/ESRF/ID23PhotonFlux.py index d8d1e5a658..d998f53841 100644 --- a/mxcubecore/HardwareObjects/ESRF/ID23PhotonFlux.py +++ b/mxcubecore/HardwareObjects/ESRF/ID23PhotonFlux.py @@ -1,11 +1,13 @@ -import time import logging import math +import time + from calc_flux import CalculateFlux from PyTango.gevent import DeviceProxy + +from mxcubecore import HardwareRepository as HWR from mxcubecore.BaseHardwareObjects import HardwareObject from mxcubecore.TaskUtils import task -from mxcubecore import HardwareRepository as HWR class ID23PhotonFlux(HardwareObject): diff --git a/mxcubecore/HardwareObjects/ESRF/ID29BeamCmds.py b/mxcubecore/HardwareObjects/ESRF/ID29BeamCmds.py index 4a220b09c3..6a7fae1a93 100644 --- a/mxcubecore/HardwareObjects/ESRF/ID29BeamCmds.py +++ b/mxcubecore/HardwareObjects/ESRF/ID29BeamCmds.py @@ -1,5 +1,9 @@ from mxcubecore.BaseHardwareObjects import HardwareObject -from .BeamCmds import ControllerCommand, HWObjActuatorCommand + +from .BeamCmds import ( + ControllerCommand, + HWObjActuatorCommand, +) class ID29BeamCmds(HardwareObject): diff --git a/mxcubecore/HardwareObjects/ESRF/ID29EnergyScan.py b/mxcubecore/HardwareObjects/ESRF/ID29EnergyScan.py index 59c067242c..df425f13d1 100644 --- a/mxcubecore/HardwareObjects/ESRF/ID29EnergyScan.py +++ b/mxcubecore/HardwareObjects/ESRF/ID29EnergyScan.py @@ -1,6 +1,11 @@ -from .ESRFEnergyScan import ESRFEnergyScan, TunableEnergy, task from datetime import datetime +from .ESRFEnergyScan import ( + ESRFEnergyScan, + TunableEnergy, + task, +) + class ID29EnergyScan(ESRFEnergyScan): def __init__(self, name): diff --git a/mxcubecore/HardwareObjects/ESRF/ID29HutchTrigger.py b/mxcubecore/HardwareObjects/ESRF/ID29HutchTrigger.py index 96a6f1f124..893161bd4d 100644 --- a/mxcubecore/HardwareObjects/ESRF/ID29HutchTrigger.py +++ b/mxcubecore/HardwareObjects/ESRF/ID29HutchTrigger.py @@ -1,8 +1,10 @@ import logging -import PyTango.gevent -import gevent -import time import sys +import time + +import gevent +import PyTango.gevent + from mxcubecore import BaseHardwareObjects from mxcubecore import HardwareRepository as HWR diff --git a/mxcubecore/HardwareObjects/ESRF/ID29MultiCollect.py b/mxcubecore/HardwareObjects/ESRF/ID29MultiCollect.py index a3218bf911..490c9fe77f 100644 --- a/mxcubecore/HardwareObjects/ESRF/ID29MultiCollect.py +++ b/mxcubecore/HardwareObjects/ESRF/ID29MultiCollect.py @@ -1,11 +1,17 @@ -import gevent -import shutil import logging import os +import shutil + +import gevent -from mxcubecore.TaskUtils import task -from .ESRFMultiCollect import ESRFMultiCollect, PixelDetector, TunableEnergy from mxcubecore.HardwareObjects.LimaPilatusDetector import LimaPilatusDetector +from mxcubecore.TaskUtils import task + +from .ESRFMultiCollect import ( + ESRFMultiCollect, + PixelDetector, + TunableEnergy, +) class ID29MultiCollect(ESRFMultiCollect): diff --git a/mxcubecore/HardwareObjects/ESRF/ID29PhotonFlux.py b/mxcubecore/HardwareObjects/ESRF/ID29PhotonFlux.py index b6ea643135..bf8845c4d7 100644 --- a/mxcubecore/HardwareObjects/ESRF/ID29PhotonFlux.py +++ b/mxcubecore/HardwareObjects/ESRF/ID29PhotonFlux.py @@ -1,11 +1,13 @@ -import time import logging import math -from calc_flux import CalculateFlux import sys +import time + +from calc_flux import CalculateFlux + +from mxcubecore import HardwareRepository as HWR from mxcubecore.BaseHardwareObjects import HardwareObject from mxcubecore.TaskUtils import task -from mxcubecore import HardwareRepository as HWR class ID29PhotonFlux(HardwareObject): diff --git a/mxcubecore/HardwareObjects/ESRF/ID29XRFSpectrum.py b/mxcubecore/HardwareObjects/ESRF/ID29XRFSpectrum.py index be2e624bc8..4585b69a6c 100644 --- a/mxcubecore/HardwareObjects/ESRF/ID29XRFSpectrum.py +++ b/mxcubecore/HardwareObjects/ESRF/ID29XRFSpectrum.py @@ -1,22 +1,28 @@ import logging import os.path + import numpy from mxcubecore.HardwareObjects.XRFSpectrum import XRFSpectrum try: - from PyMca import ConfigDict - from PyMca import ClassMcaTheory - from PyMca import QtMcaAdvancedFitReport + from PyMca import ( + ClassMcaTheory, + ConfigDict, + QtMcaAdvancedFitReport, + ) except ImportError: - from PyMca5.PyMca import ConfigDict - from PyMca5.PyMca import ClassMcaTheory - from PyMca5.PyMca import QtMcaAdvancedFitReport + from PyMca5.PyMca import ( + ClassMcaTheory, + ConfigDict, + QtMcaAdvancedFitReport, + ) """ Next two lines is a trick to avoid core dump in QtMcaAdvancedFitReport """ from unittest.mock import MagicMock + QtMcaAdvancedFitReport.qt = MagicMock() diff --git a/mxcubecore/HardwareObjects/ESRF/ID30A1MultiCollect.py b/mxcubecore/HardwareObjects/ESRF/ID30A1MultiCollect.py index 3aec0bf66e..d496b76460 100644 --- a/mxcubecore/HardwareObjects/ESRF/ID30A1MultiCollect.py +++ b/mxcubecore/HardwareObjects/ESRF/ID30A1MultiCollect.py @@ -1,13 +1,17 @@ -import shutil +import decimal import logging import os -import decimal +import shutil import time - -from mxcubecore.TaskUtils import task -from .ESRFMultiCollect import ESRFMultiCollect, FixedEnergy, PixelDetector from mxcubecore.HardwareObjects.LimaPilatusDetector import LimaPilatusDetector +from mxcubecore.TaskUtils import task + +from .ESRFMultiCollect import ( + ESRFMultiCollect, + FixedEnergy, + PixelDetector, +) class ID30A1MultiCollect(ESRFMultiCollect): diff --git a/mxcubecore/HardwareObjects/ESRF/ID30A3BeamCmds.py b/mxcubecore/HardwareObjects/ESRF/ID30A3BeamCmds.py index 6b403289f5..4487091b37 100644 --- a/mxcubecore/HardwareObjects/ESRF/ID30A3BeamCmds.py +++ b/mxcubecore/HardwareObjects/ESRF/ID30A3BeamCmds.py @@ -1,4 +1,5 @@ from mxcubecore.BaseHardwareObjects import HardwareObject + from .BeamCmds import ControllerCommand diff --git a/mxcubecore/HardwareObjects/ESRF/ID30A3BeamDefiner.py b/mxcubecore/HardwareObjects/ESRF/ID30A3BeamDefiner.py index 077776b7b3..defcc15869 100644 --- a/mxcubecore/HardwareObjects/ESRF/ID30A3BeamDefiner.py +++ b/mxcubecore/HardwareObjects/ESRF/ID30A3BeamDefiner.py @@ -48,6 +48,7 @@ __license__ = "LGPLv3+" from enum import Enum + from mxcubecore.HardwareObjects.ESRF.ESRFBeamDefiner import ESRFBeamDefiner diff --git a/mxcubecore/HardwareObjects/ESRF/ID30A3MultiCollect.py b/mxcubecore/HardwareObjects/ESRF/ID30A3MultiCollect.py index 5f861029fc..6da7c5a20e 100644 --- a/mxcubecore/HardwareObjects/ESRF/ID30A3MultiCollect.py +++ b/mxcubecore/HardwareObjects/ESRF/ID30A3MultiCollect.py @@ -1,13 +1,18 @@ -import gevent -import socket import logging import pickle as pickle +import socket -from mxcubecore.TaskUtils import task +import gevent +from PyTango.gevent import DeviceProxy -from .ESRFMultiCollect import ESRFMultiCollect, FixedEnergy, PixelDetector from mxcubecore.HardwareObjects.LimaEigerDetector import Eiger -from PyTango.gevent import DeviceProxy +from mxcubecore.TaskUtils import task + +from .ESRFMultiCollect import ( + ESRFMultiCollect, + FixedEnergy, + PixelDetector, +) class ID30A3MultiCollect(ESRFMultiCollect): diff --git a/mxcubecore/HardwareObjects/ESRF/ID30A3PhotonFlux.py b/mxcubecore/HardwareObjects/ESRF/ID30A3PhotonFlux.py index b9e5883f33..4a55b2ad59 100644 --- a/mxcubecore/HardwareObjects/ESRF/ID30A3PhotonFlux.py +++ b/mxcubecore/HardwareObjects/ESRF/ID30A3PhotonFlux.py @@ -1,8 +1,10 @@ -from mxcubecore.BaseHardwareObjects import HardwareObject -from mxcubecore.TaskUtils import task import time + from PyTango.gevent import DeviceProxy +from mxcubecore.BaseHardwareObjects import HardwareObject +from mxcubecore.TaskUtils import task + class ID30A3PhotonFlux(HardwareObject): def __init__(self, *args, **kwargs): diff --git a/mxcubecore/HardwareObjects/ESRF/ID30BBeamCmds.py b/mxcubecore/HardwareObjects/ESRF/ID30BBeamCmds.py index c47ccf3101..d562ca9a87 100644 --- a/mxcubecore/HardwareObjects/ESRF/ID30BBeamCmds.py +++ b/mxcubecore/HardwareObjects/ESRF/ID30BBeamCmds.py @@ -1,5 +1,10 @@ from mxcubecore.BaseHardwareObjects import HardwareObject -from .BeamCmds import ControllerCommand, TestCommand, HWObjActuatorCommand + +from .BeamCmds import ( + ControllerCommand, + HWObjActuatorCommand, + TestCommand, +) class ID30BBeamCmds(HardwareObject): diff --git a/mxcubecore/HardwareObjects/ESRF/ID30BEnergyScan.py b/mxcubecore/HardwareObjects/ESRF/ID30BEnergyScan.py index 9ee711a236..379dd23fc7 100644 --- a/mxcubecore/HardwareObjects/ESRF/ID30BEnergyScan.py +++ b/mxcubecore/HardwareObjects/ESRF/ID30BEnergyScan.py @@ -1,7 +1,12 @@ -from mxcubecore.TaskUtils import task -from .ESRFEnergyScan import ESRFEnergyScan, TunableEnergy from datetime import datetime +from mxcubecore.TaskUtils import task + +from .ESRFEnergyScan import ( + ESRFEnergyScan, + TunableEnergy, +) + class ID30BEnergyScan(ESRFEnergyScan): def __init__(self, name): diff --git a/mxcubecore/HardwareObjects/ESRF/ID30BPhotonFlux.py b/mxcubecore/HardwareObjects/ESRF/ID30BPhotonFlux.py index 1be0814923..d1c4cd8901 100644 --- a/mxcubecore/HardwareObjects/ESRF/ID30BPhotonFlux.py +++ b/mxcubecore/HardwareObjects/ESRF/ID30BPhotonFlux.py @@ -28,6 +28,7 @@ """ import logging + from mxcubecore import HardwareRepository as HWR from mxcubecore.HardwareObjects.abstract.AbstractFlux import AbstractFlux diff --git a/mxcubecore/HardwareObjects/ESRF/ID30BXRFSpectrum.py b/mxcubecore/HardwareObjects/ESRF/ID30BXRFSpectrum.py index b956624aba..850f666d64 100644 --- a/mxcubecore/HardwareObjects/ESRF/ID30BXRFSpectrum.py +++ b/mxcubecore/HardwareObjects/ESRF/ID30BXRFSpectrum.py @@ -1,11 +1,13 @@ -from qt import copy import logging import os import time -import gevent.event + import gevent -from mxcubecore.BaseHardwareObjects import HardwareObject +import gevent.event +from qt import copy + from mxcubecore import HardwareRepository as HWR +from mxcubecore.BaseHardwareObjects import HardwareObject class XrfSpectrum(HardwareObject): diff --git a/mxcubecore/HardwareObjects/ESRF/ID30BeamCmds.py b/mxcubecore/HardwareObjects/ESRF/ID30BeamCmds.py index b0cb795aa0..3dc2e0a8fb 100644 --- a/mxcubecore/HardwareObjects/ESRF/ID30BeamCmds.py +++ b/mxcubecore/HardwareObjects/ESRF/ID30BeamCmds.py @@ -1,8 +1,10 @@ +import logging + +import gevent + from mxcubecore.BaseHardwareObjects import HardwareObject -from mxcubecore.TaskUtils import task from mxcubecore.CommandContainer import CommandObject -import gevent -import logging +from mxcubecore.TaskUtils import task class ControllerCommand(CommandObject): diff --git a/mxcubecore/HardwareObjects/ESRF/ID30BeamInfo.py b/mxcubecore/HardwareObjects/ESRF/ID30BeamInfo.py index ec263c0516..21554c10d7 100644 --- a/mxcubecore/HardwareObjects/ESRF/ID30BeamInfo.py +++ b/mxcubecore/HardwareObjects/ESRF/ID30BeamInfo.py @@ -1,5 +1,5 @@ -from mxcubecore.HardwareObjects import BeamInfo from mxcubecore import HardwareRepository as HWR +from mxcubecore.HardwareObjects import BeamInfo class ID30BeamInfo(BeamInfo.BeamInfo): diff --git a/mxcubecore/HardwareObjects/ESRF/ID30Cryo.py b/mxcubecore/HardwareObjects/ESRF/ID30Cryo.py index c4cd41bf0b..7f50468dbd 100644 --- a/mxcubecore/HardwareObjects/ESRF/ID30Cryo.py +++ b/mxcubecore/HardwareObjects/ESRF/ID30Cryo.py @@ -1,8 +1,10 @@ -from mxcubecore.BaseHardwareObjects import HardwareObject -from mxcubecore.TaskUtils import task import time + import gevent +from mxcubecore.BaseHardwareObjects import HardwareObject +from mxcubecore.TaskUtils import task + class ID30Cryo(HardwareObject): states = {0: "out", 1: "in"} diff --git a/mxcubecore/HardwareObjects/ESRF/ID30HutchTrigger.py b/mxcubecore/HardwareObjects/ESRF/ID30HutchTrigger.py index 1c80ee25af..0cc60455cb 100644 --- a/mxcubecore/HardwareObjects/ESRF/ID30HutchTrigger.py +++ b/mxcubecore/HardwareObjects/ESRF/ID30HutchTrigger.py @@ -1,9 +1,11 @@ -from mxcubecore import BaseHardwareObjects import logging -import PyTango.gevent -import gevent -import time import sys +import time + +import gevent +import PyTango.gevent + +from mxcubecore import BaseHardwareObjects class ID30HutchTrigger(BaseHardwareObjects.HardwareObject): diff --git a/mxcubecore/HardwareObjects/ESRF/ID30Light.py b/mxcubecore/HardwareObjects/ESRF/ID30Light.py index 121995fea9..d53c2a9f1a 100644 --- a/mxcubecore/HardwareObjects/ESRF/ID30Light.py +++ b/mxcubecore/HardwareObjects/ESRF/ID30Light.py @@ -1,8 +1,10 @@ -from mxcubecore.BaseHardwareObjects import HardwareObject -from mxcubecore.HardwareObjects.abstract.AbstractMotor import AbstractMotor import time + import gevent +from mxcubecore.BaseHardwareObjects import HardwareObject +from mxcubecore.HardwareObjects.abstract.AbstractMotor import AbstractMotor + class ID30Light(Device, AbstractMotor): states = {0: "out", 1: "in"} diff --git a/mxcubecore/HardwareObjects/ESRF/ID30SC3.py b/mxcubecore/HardwareObjects/ESRF/ID30SC3.py index c88ccd7110..827145f68f 100644 --- a/mxcubecore/HardwareObjects/ESRF/ID30SC3.py +++ b/mxcubecore/HardwareObjects/ESRF/ID30SC3.py @@ -1,9 +1,10 @@ """ESRF SC3 Sample Changer Hardware Object """ -from mxcubecore.TaskUtils import task -import SC3 import ESRFSC3 +import SC3 + +from mxcubecore.TaskUtils import task class Command: diff --git a/mxcubecore/HardwareObjects/ESRF/MD2MultiCollect.py b/mxcubecore/HardwareObjects/ESRF/MD2MultiCollect.py index d040d60497..1c613f8f0f 100644 --- a/mxcubecore/HardwareObjects/ESRF/MD2MultiCollect.py +++ b/mxcubecore/HardwareObjects/ESRF/MD2MultiCollect.py @@ -1,13 +1,14 @@ -import gevent -import shutil import logging import os +import shutil -from mxcubecore.TaskUtils import task -from .ESRFMultiCollect import ESRFMultiCollect -from mxcubecore.HardwareObjects.LimaPilatusDetector import LimaPilatusDetector +import gevent from mxcubecore import HardwareRepository as HWR +from mxcubecore.HardwareObjects.LimaPilatusDetector import LimaPilatusDetector +from mxcubecore.TaskUtils import task + +from .ESRFMultiCollect import ESRFMultiCollect class MD2MultiCollect(ESRFMultiCollect): diff --git a/mxcubecore/HardwareObjects/ESRF/Oxford700.py b/mxcubecore/HardwareObjects/ESRF/Oxford700.py index 804c07f9c8..0729b6aaeb 100644 --- a/mxcubecore/HardwareObjects/ESRF/Oxford700.py +++ b/mxcubecore/HardwareObjects/ESRF/Oxford700.py @@ -1,12 +1,10 @@ -import gevent import sys -from mxcubecore.BaseHardwareObjects import HardwareObject -from mxcubecore import HardwareRepository as HWR +import gevent -from mxcubecore.HardwareObjects.abstract.AbstractActuator import ( - AbstractActuator, -) +from mxcubecore import HardwareRepository as HWR +from mxcubecore.BaseHardwareObjects import HardwareObject +from mxcubecore.HardwareObjects.abstract.AbstractActuator import AbstractActuator CRYO_STATUS = ["OFF", "SATURATED", "READY", "WARNING", "FROZEN", "UNKNOWN"] PHASE_ACTION = { diff --git a/mxcubecore/HardwareObjects/ESRF/OxfordCryostream.py b/mxcubecore/HardwareObjects/ESRF/OxfordCryostream.py index f1f1c51c0b..7c7a684771 100644 --- a/mxcubecore/HardwareObjects/ESRF/OxfordCryostream.py +++ b/mxcubecore/HardwareObjects/ESRF/OxfordCryostream.py @@ -33,9 +33,14 @@ """ -import sys import logging -from gevent import Timeout, sleep, spawn +import sys + +from gevent import ( + Timeout, + sleep, + spawn, +) from mxcubecore.HardwareObjects.abstract.AbstractActuator import AbstractActuator diff --git a/mxcubecore/HardwareObjects/ESRF/TangoKeithleyPhotonFlux.py b/mxcubecore/HardwareObjects/ESRF/TangoKeithleyPhotonFlux.py index 86302395f9..cd24af3f1e 100644 --- a/mxcubecore/HardwareObjects/ESRF/TangoKeithleyPhotonFlux.py +++ b/mxcubecore/HardwareObjects/ESRF/TangoKeithleyPhotonFlux.py @@ -1,10 +1,11 @@ -from mxcubecore.BaseHardwareObjects import HardwareObject -from mxcubecore.TaskUtils import task import time # from PyTango.gevent import DeviceProxy from PyTango import DeviceProxy +from mxcubecore.BaseHardwareObjects import HardwareObject +from mxcubecore.TaskUtils import task + class TangoKeithleyPhotonFlux(HardwareObject): def __init__(self, *args, **kwargs): diff --git a/mxcubecore/HardwareObjects/ESRF/queue_entry/ssx_base_queue_entry.py b/mxcubecore/HardwareObjects/ESRF/queue_entry/ssx_base_queue_entry.py index 91d3a0a0e8..21406849fc 100644 --- a/mxcubecore/HardwareObjects/ESRF/queue_entry/ssx_base_queue_entry.py +++ b/mxcubecore/HardwareObjects/ESRF/queue_entry/ssx_base_queue_entry.py @@ -1,20 +1,21 @@ -import os -import logging -import subprocess import datetime import json -import gevent +import logging +import os +import subprocess +import xmlrpc.client -from typing_extensions import Literal -from pydantic.v1 import BaseModel, Field +import gevent from devtools import debug +from pydantic.v1 import ( + BaseModel, + Field, +) +from typing_extensions import Literal from mxcubecore import HardwareRepository as HWR from mxcubecore.queue_entry.base_queue_entry import BaseQueueEntry -import logging -import xmlrpc.client - class BaseUserCollectionParameters(BaseModel): num_images: int = Field(0, description="") diff --git a/mxcubecore/HardwareObjects/ESRF/queue_entry/ssx_big_foil_collection.py b/mxcubecore/HardwareObjects/ESRF/queue_entry/ssx_big_foil_collection.py index 2d78ef104e..6f954f344b 100644 --- a/mxcubecore/HardwareObjects/ESRF/queue_entry/ssx_big_foil_collection.py +++ b/mxcubecore/HardwareObjects/ESRF/queue_entry/ssx_big_foil_collection.py @@ -1,29 +1,25 @@ import logging -from typing_extensions import Literal - -from pydantic.v1 import BaseModel, Field from devtools import debug - -from mxcubecore.model.common import ( - CommonCollectionParamters, - PathParameters, - LegacyParameters, - StandardCollectionParameters, +from pydantic.v1 import ( + BaseModel, + Field, ) +from typing_extensions import Literal from mxcubecore import HardwareRepository as HWR - from mxcubecore.HardwareObjects.ESRF.queue_entry.ssx_base_queue_entry import ( + BaseUserCollectionParameters, SsxBaseQueueEntry, SsxBaseQueueTaskParameters, - BaseUserCollectionParameters, ) - -from mxcubecore.model.queue_model_objects import ( - DataCollection, +from mxcubecore.model.common import ( + CommonCollectionParamters, + LegacyParameters, + PathParameters, + StandardCollectionParameters, ) - +from mxcubecore.model.queue_model_objects import DataCollection __credits__ = ["MXCuBE collaboration"] __license__ = "LGPLv3+" diff --git a/mxcubecore/HardwareObjects/ESRF/queue_entry/ssx_chip_collection.py b/mxcubecore/HardwareObjects/ESRF/queue_entry/ssx_chip_collection.py index 36c459094d..f09a16ffd3 100644 --- a/mxcubecore/HardwareObjects/ESRF/queue_entry/ssx_chip_collection.py +++ b/mxcubecore/HardwareObjects/ESRF/queue_entry/ssx_chip_collection.py @@ -1,29 +1,24 @@ -import os -import logging import contextlib import enum +import logging +import os import subprocess -from pydantic.v1 import BaseModel, Field -from devtools import debug - -from mxcubecore import HardwareRepository as HWR -from mxcubecore.queue_entry.base_queue_entry import ( - BaseQueueEntry, -) - -from mxcubecore.model.queue_model_objects import ( - DataCollection, +from devtools import debug +from pydantic.v1 import ( + BaseModel, + Field, ) - +from mxcubecore import HardwareRepository as HWR from mxcubecore.model.common import ( CommonCollectionParamters, - PathParameters, LegacyParameters, + PathParameters, StandardCollectionParameters, ) - +from mxcubecore.model.queue_model_objects import DataCollection +from mxcubecore.queue_entry.base_queue_entry import BaseQueueEntry __credits__ = ["MXCuBE collaboration"] __license__ = "LGPLv3+" diff --git a/mxcubecore/HardwareObjects/ESRF/queue_entry/ssx_foil_collection.py b/mxcubecore/HardwareObjects/ESRF/queue_entry/ssx_foil_collection.py index bdc938eab2..f016cf1ac6 100644 --- a/mxcubecore/HardwareObjects/ESRF/queue_entry/ssx_foil_collection.py +++ b/mxcubecore/HardwareObjects/ESRF/queue_entry/ssx_foil_collection.py @@ -2,29 +2,24 @@ import logging import math -from typing_extensions import Literal - -from pydantic import Field from devtools import debug - -from mxcubecore.model.common import ( - CommonCollectionParamters, - PathParameters, - LegacyParameters, - StandardCollectionParameters, -) +from pydantic import Field +from typing_extensions import Literal from mxcubecore import HardwareRepository as HWR - from mxcubecore.HardwareObjects.ESRF.queue_entry.ssx_base_queue_entry import ( + BaseUserCollectionParameters, SsxBaseQueueEntry, SsxBaseQueueTaskParameters, - BaseUserCollectionParameters, ) - +from mxcubecore.model.common import ( + CommonCollectionParamters, + LegacyParameters, + PathParameters, + StandardCollectionParameters, +) from mxcubecore.model.queue_model_objects import DataCollection - __credits__ = ["MXCuBE collaboration"] __license__ = "LGPLv3+" __category__ = "General" diff --git a/mxcubecore/HardwareObjects/ESRF/queue_entry/ssx_injector_collection.py b/mxcubecore/HardwareObjects/ESRF/queue_entry/ssx_injector_collection.py index a43e777851..9384375ea3 100644 --- a/mxcubecore/HardwareObjects/ESRF/queue_entry/ssx_injector_collection.py +++ b/mxcubecore/HardwareObjects/ESRF/queue_entry/ssx_injector_collection.py @@ -1,28 +1,26 @@ +import enum import logging import time -import enum -from pydantic.v1 import BaseModel, Field from devtools import debug - -from mxcubecore import HardwareRepository as HWR -from mxcubecore.model.common import ( - CommonCollectionParamters, - PathParameters, - LegacyParameters, - StandardCollectionParameters, +from pydantic.v1 import ( + BaseModel, + Field, ) +from mxcubecore import HardwareRepository as HWR from mxcubecore.HardwareObjects.ESRF.queue_entry.ssx_base_queue_entry import ( + BaseUserCollectionParameters, SsxBaseQueueEntry, SsxBaseQueueTaskParameters, - BaseUserCollectionParameters, ) - -from mxcubecore.model.queue_model_objects import ( - DataCollection, +from mxcubecore.model.common import ( + CommonCollectionParamters, + LegacyParameters, + PathParameters, + StandardCollectionParameters, ) - +from mxcubecore.model.queue_model_objects import DataCollection __credits__ = ["MXCuBE collaboration"] __license__ = "LGPLv3+" diff --git a/mxcubecore/HardwareObjects/ESRF/queue_entry/test_collection.py b/mxcubecore/HardwareObjects/ESRF/queue_entry/test_collection.py index 8ae771c4d4..c3263b1f4c 100644 --- a/mxcubecore/HardwareObjects/ESRF/queue_entry/test_collection.py +++ b/mxcubecore/HardwareObjects/ESRF/queue_entry/test_collection.py @@ -1,31 +1,26 @@ import os import subprocess -from typing_extensions import Literal - -from pydantic.v1 import BaseModel, Field from devtools import debug +from pydantic.v1 import ( + BaseModel, + Field, +) +from typing_extensions import Literal from mxcubecore import HardwareRepository as HWR - from mxcubecore.HardwareObjects.ESRF.queue_entry.ssx_base_queue_entry import ( + BaseUserCollectionParameters, SsxBaseQueueEntry, SsxBaseQueueTaskParameters, - BaseUserCollectionParameters, ) - - from mxcubecore.model.common import ( CommonCollectionParamters, - PathParameters, LegacyParameters, + PathParameters, StandardCollectionParameters, ) - -from mxcubecore.model.queue_model_objects import ( - DataCollection, -) - +from mxcubecore.model.queue_model_objects import DataCollection __credits__ = ["MXCuBE collaboration"] __license__ = "LGPLv3+" diff --git a/mxcubecore/HardwareObjects/EdnaWorkflow.py b/mxcubecore/HardwareObjects/EdnaWorkflow.py index cba088a169..ea2291d6da 100644 --- a/mxcubecore/HardwareObjects/EdnaWorkflow.py +++ b/mxcubecore/HardwareObjects/EdnaWorkflow.py @@ -1,18 +1,19 @@ -from mxcubecore.BaseHardwareObjects import HardwareObject - +import binascii +import logging import os +import pprint import time + import gevent -import pprint -import logging import requests -import binascii + +from mxcubecore import HardwareRepository as HWR +from mxcubecore.BaseHardwareObjects import HardwareObject # import threading from mxcubecore.HardwareObjects.SecureXMLRpcRequestHandler import ( SecureXMLRpcRequestHandler, ) -from mxcubecore import HardwareRepository as HWR try: from httplib import HTTPConnection diff --git a/mxcubecore/HardwareObjects/Energy.py b/mxcubecore/HardwareObjects/Energy.py index 2c07c24d6d..575ffbf97f 100644 --- a/mxcubecore/HardwareObjects/Energy.py +++ b/mxcubecore/HardwareObjects/Energy.py @@ -1,6 +1,8 @@ import logging import math + import gevent + from mxcubecore.BaseHardwareObjects import HardwareObject """ diff --git a/mxcubecore/HardwareObjects/ExporterMotor.py b/mxcubecore/HardwareObjects/ExporterMotor.py index 8da20eaebe..1a00ebc789 100644 --- a/mxcubecore/HardwareObjects/ExporterMotor.py +++ b/mxcubecore/HardwareObjects/ExporterMotor.py @@ -35,14 +35,18 @@ False """ -import sys -import math import logging +import math +import sys + +from gevent import ( + Timeout, + sleep, +) -from gevent import Timeout, sleep -from mxcubecore.HardwareObjects.abstract.AbstractMotor import AbstractMotor from mxcubecore.Command.Exporter import Exporter from mxcubecore.Command.exporter.ExporterStates import ExporterStates +from mxcubecore.HardwareObjects.abstract.AbstractMotor import AbstractMotor __copyright__ = """ Copyright © 2019 by the MXCuBE collaboration """ __license__ = "LGPLv3+" diff --git a/mxcubecore/HardwareObjects/ExporterNState.py b/mxcubecore/HardwareObjects/ExporterNState.py index 61d0c857bd..64394362ec 100644 --- a/mxcubecore/HardwareObjects/ExporterNState.py +++ b/mxcubecore/HardwareObjects/ExporterNState.py @@ -30,10 +30,15 @@ """ from enum import Enum -from gevent import Timeout, sleep -from mxcubecore.HardwareObjects.abstract.AbstractNState import AbstractNState + +from gevent import ( + Timeout, + sleep, +) + from mxcubecore.Command.Exporter import Exporter from mxcubecore.Command.exporter.ExporterStates import ExporterStates +from mxcubecore.HardwareObjects.abstract.AbstractNState import AbstractNState __copyright__ = """ Copyright © 2020 by the MXCuBE collaboration """ __license__ = "LGPLv3+" diff --git a/mxcubecore/HardwareObjects/FlexHCD.py b/mxcubecore/HardwareObjects/FlexHCD.py index 8bdecf5086..02bd018030 100644 --- a/mxcubecore/HardwareObjects/FlexHCD.py +++ b/mxcubecore/HardwareObjects/FlexHCD.py @@ -1,9 +1,10 @@ import base64 +import logging import pickle + import gevent -import logging +from PyTango.gevent import DeviceProxy -from mxcubecore.TaskUtils import task from mxcubecore.HardwareObjects.abstract.AbstractSampleChanger import ( SampleChanger, SampleChangerState, @@ -12,7 +13,7 @@ Container, Sample, ) -from PyTango.gevent import DeviceProxy +from mxcubecore.TaskUtils import task class Pin(Sample): diff --git a/mxcubecore/HardwareObjects/FlexHCDMaintenance.py b/mxcubecore/HardwareObjects/FlexHCDMaintenance.py index 2d2709dfcd..685e9c1b6a 100644 --- a/mxcubecore/HardwareObjects/FlexHCDMaintenance.py +++ b/mxcubecore/HardwareObjects/FlexHCDMaintenance.py @@ -2,9 +2,9 @@ FLEX HCD maintenance mockup. """ -from mxcubecore.BaseHardwareObjects import HardwareObject import ast +from mxcubecore.BaseHardwareObjects import HardwareObject TOOL_FLANGE, TOOL_UNIPUCK, TOOL_SPINE, TOOL_PLATE, TOOL_LASER, TOOL_DOUBLE_GRIPPER = ( 0, diff --git a/mxcubecore/HardwareObjects/GenericDiffractometer.py b/mxcubecore/HardwareObjects/GenericDiffractometer.py index b139d7cc92..0105894175 100755 --- a/mxcubecore/HardwareObjects/GenericDiffractometer.py +++ b/mxcubecore/HardwareObjects/GenericDiffractometer.py @@ -21,24 +21,33 @@ GenericDiffractometer """ -import os -import json import copy +import enum +import json +import logging +import math +import os import time +from typing import ( + Dict, + List, + Tuple, + Union, +) + import gevent import gevent.event -import logging -import math import numpy -import enum - -from typing import List, Tuple, Union, Dict -from pydantic.v1 import BaseModel, Field, ValidationError +from pydantic.v1 import ( + BaseModel, + Field, + ValidationError, +) +from mxcubecore import HardwareRepository as HWR +from mxcubecore.BaseHardwareObjects import HardwareObject from mxcubecore.HardwareObjects import sample_centring from mxcubecore.model import queue_model_objects -from mxcubecore.BaseHardwareObjects import HardwareObject -from mxcubecore import HardwareRepository as HWR try: unicode diff --git a/mxcubecore/HardwareObjects/Gphl/CollectEmulator.py b/mxcubecore/HardwareObjects/Gphl/CollectEmulator.py index 3626b0ec00..8f7287721a 100644 --- a/mxcubecore/HardwareObjects/Gphl/CollectEmulator.py +++ b/mxcubecore/HardwareObjects/Gphl/CollectEmulator.py @@ -22,17 +22,18 @@ along with MXCuBE. If not, see . """ -import os -import subprocess import logging +import os import re +import subprocess from collections import OrderedDict + import f90nml -from mxcubecore.utils import conversion -from mxcubecore.HardwareObjects.mockup.CollectMockup import CollectMockup -from mxcubecore.TaskUtils import task from mxcubecore import HardwareRepository as HWR +from mxcubecore.HardwareObjects.mockup.CollectMockup import CollectMockup +from mxcubecore.TaskUtils import task +from mxcubecore.utils import conversion __copyright__ = """ Copyright © 2017 - 2019 by Global Phasing Ltd. """ __license__ = "LGPLv3+" diff --git a/mxcubecore/HardwareObjects/Gphl/GphlMessages.py b/mxcubecore/HardwareObjects/Gphl/GphlMessages.py index 1057447e73..bcc1849daa 100644 --- a/mxcubecore/HardwareObjects/Gphl/GphlMessages.py +++ b/mxcubecore/HardwareObjects/Gphl/GphlMessages.py @@ -19,13 +19,19 @@ You should have received a copy of the GNU Lesser General Public License along with MXCuBE. If not, see . """ -from __future__ import division, absolute_import -from __future__ import print_function, unicode_literals +from __future__ import ( + absolute_import, + division, + print_function, + unicode_literals, +) -import uuid import json -from collections import OrderedDict -from collections import namedtuple +import uuid +from collections import ( + OrderedDict, + namedtuple, +) from mxcubecore.model import crystal_symmetry diff --git a/mxcubecore/HardwareObjects/Gphl/GphlQueueEntry.py b/mxcubecore/HardwareObjects/Gphl/GphlQueueEntry.py index 700e47173a..3e168e082e 100644 --- a/mxcubecore/HardwareObjects/Gphl/GphlQueueEntry.py +++ b/mxcubecore/HardwareObjects/Gphl/GphlQueueEntry.py @@ -23,9 +23,9 @@ import logging -from mxcubecore.queue_entry.base_queue_entry import BaseQueueEntry -from mxcubecore import HardwareRepository as HWR +from mxcubecore import HardwareRepository as HWR +from mxcubecore.queue_entry.base_queue_entry import BaseQueueEntry __credits__ = ["MXCuBE collaboration"] __license__ = "LGPLv3+" diff --git a/mxcubecore/HardwareObjects/Gphl/GphlWorkflow.py b/mxcubecore/HardwareObjects/Gphl/GphlWorkflow.py index 5b63c2b98a..9a5d91f301 100644 --- a/mxcubecore/HardwareObjects/Gphl/GphlWorkflow.py +++ b/mxcubecore/HardwareObjects/Gphl/GphlWorkflow.py @@ -21,35 +21,42 @@ You should have received a copy of the GNU Lesser General Public License along with MXCuBE. If not, see . """ -from __future__ import division, absolute_import -from __future__ import print_function, unicode_literals +from __future__ import ( + absolute_import, + division, + print_function, + unicode_literals, +) import copy -import logging -import enum -import time import datetime -import os +import enum +import logging import math -import subprocess +import os import socket +import subprocess +import time import uuid from collections import OrderedDict +import f90nml import gevent import gevent.event import gevent.queue -import f90nml -from mxcubecore.dispatcher import dispatcher +from mxcubecore import HardwareRepository as HWR from mxcubecore.BaseHardwareObjects import HardwareObjectYaml -from mxcubecore.model import queue_model_objects -from mxcubecore.model import crystal_symmetry -from mxcubecore.queue_entry import QUEUE_ENTRY_STATUS -from mxcubecore.queue_entry import QueueAbortedException - +from mxcubecore.dispatcher import dispatcher from mxcubecore.HardwareObjects.Gphl import GphlMessages -from mxcubecore import HardwareRepository as HWR +from mxcubecore.model import ( + crystal_symmetry, + queue_model_objects, +) +from mxcubecore.queue_entry import ( + QUEUE_ENTRY_STATUS, + QueueAbortedException, +) @enum.unique diff --git a/mxcubecore/HardwareObjects/Gphl/GphlWorkflowConnection.py b/mxcubecore/HardwareObjects/Gphl/GphlWorkflowConnection.py index 793568a005..f6fdb77a4b 100644 --- a/mxcubecore/HardwareObjects/Gphl/GphlWorkflowConnection.py +++ b/mxcubecore/HardwareObjects/Gphl/GphlWorkflowConnection.py @@ -20,32 +20,38 @@ You should have received a copy of the GNU Lesser General Public License along with MXCuBE. If not, see . """ -from __future__ import division, absolute_import -from __future__ import print_function, unicode_literals +from __future__ import ( + absolute_import, + division, + print_function, + unicode_literals, +) import logging import os -import subprocess -import uuid import signal -import time +import socket +import subprocess import sys +import time +import uuid -from py4j import clientserver, java_gateway +from py4j import ( + clientserver, + java_gateway, +) from py4j.protocol import Py4JJavaError -from mxcubecore.utils import conversion -from mxcubecore.HardwareObjects.Gphl import GphlMessages - -from mxcubecore.BaseHardwareObjects import HardwareObjectYaml from mxcubecore import HardwareRepository as HWR +from mxcubecore.BaseHardwareObjects import HardwareObjectYaml +from mxcubecore.HardwareObjects.Gphl import GphlMessages +from mxcubecore.utils import conversion # NB this is patching the original socket module in to avoid the # monkeypatched version we get from gevent - that causes errors. # It depends on knowing where in py4j socket is imported # Hacky, but the best solution to making py4j and gevent compatible -import socket origsocket = sys.modules.pop("socket") _origsocket = sys.modules.pop("_socket") @@ -67,9 +73,11 @@ try: from louie import dispatcher except ImportError: - from pydispatch import dispatcher - from pydispatch import robustapply - from pydispatch import saferef + from pydispatch import ( + dispatcher, + robustapply, + saferef, + ) saferef.safe_ref = saferef.safeRef robustapply.robust_apply = robustapply.robustApply diff --git a/mxcubecore/HardwareObjects/Gphl/Transcal2MiniKappa.py b/mxcubecore/HardwareObjects/Gphl/Transcal2MiniKappa.py index 331c408baa..1a08882363 100644 --- a/mxcubecore/HardwareObjects/Gphl/Transcal2MiniKappa.py +++ b/mxcubecore/HardwareObjects/Gphl/Transcal2MiniKappa.py @@ -20,11 +20,12 @@ along with MXCuBE. If not, see . """ -import os import ast +import os from xml.etree import ElementTree as ET -import numpy as np + import f90nml +import numpy as np __copyright__ = """ Copyright © 2016 - 2023 MXCuBE Collaboration.""" __license__ = "LGPLv3+" @@ -227,7 +228,10 @@ def get_minikappa_data(configfile): if __name__ == "__main__": - from argparse import ArgumentParser, RawTextHelpFormatter + from argparse import ( + ArgumentParser, + RawTextHelpFormatter, + ) parser = ArgumentParser( prog="Transcal2MiniKappa.py", diff --git a/mxcubecore/HardwareObjects/Grob.py b/mxcubecore/HardwareObjects/Grob.py index db48bef7c4..59315160bf 100644 --- a/mxcubecore/HardwareObjects/Grob.py +++ b/mxcubecore/HardwareObjects/Grob.py @@ -1,6 +1,7 @@ -from mxcubecore.BaseHardwareObjects import HardwareObject from grob import grob_control +from mxcubecore.BaseHardwareObjects import HardwareObject + class Grob(HardwareObject): def __init__(self, name): diff --git a/mxcubecore/HardwareObjects/GrobMotor.py b/mxcubecore/HardwareObjects/GrobMotor.py index bbe2a904b1..a44820f965 100644 --- a/mxcubecore/HardwareObjects/GrobMotor.py +++ b/mxcubecore/HardwareObjects/GrobMotor.py @@ -1,8 +1,10 @@ -from mxcubecore.BaseHardwareObjects import HardwareObject -from mxcubecore.HardwareObjects.abstract.AbstractMotor import AbstractMotor import math + import gevent +from mxcubecore.BaseHardwareObjects import HardwareObject +from mxcubecore.HardwareObjects.abstract.AbstractMotor import AbstractMotor + class GrobMotor(Device, AbstractMotor): (NOTINITIALIZED, UNUSABLE, READY, MOVESTARTED, MOVING, ONLIMIT) = (0, 1, 2, 3, 4, 5) diff --git a/mxcubecore/HardwareObjects/GrobSampleChanger.py b/mxcubecore/HardwareObjects/GrobSampleChanger.py index 6938468f84..3f2cee4a97 100644 --- a/mxcubecore/HardwareObjects/GrobSampleChanger.py +++ b/mxcubecore/HardwareObjects/GrobSampleChanger.py @@ -2,9 +2,11 @@ """ import logging -from mxcubecore.BaseHardwareObjects import HardwareObject + import gevent +from mxcubecore.BaseHardwareObjects import HardwareObject + class GrobSampleChanger(HardwareObject): (FLAG_SC_IN_USE, FLAG_MINIDIFF_CAN_MOVE, FLAG_SC_CAN_LOAD, FLAG_SC_NEVER) = ( diff --git a/mxcubecore/HardwareObjects/Harvester.py b/mxcubecore/HardwareObjects/Harvester.py index fa6e4ac6d1..a16e4204ac 100644 --- a/mxcubecore/HardwareObjects/Harvester.py +++ b/mxcubecore/HardwareObjects/Harvester.py @@ -41,10 +41,12 @@ ----------------------------------------------------------------- """ from __future__ import annotations -import gevent + import logging from typing import Optional +import gevent + from mxcubecore import queue_entry from mxcubecore.BaseHardwareObjects import HardwareObject diff --git a/mxcubecore/HardwareObjects/HarvesterMaintenance.py b/mxcubecore/HardwareObjects/HarvesterMaintenance.py index 7579b92b4d..a1ebd97efa 100644 --- a/mxcubecore/HardwareObjects/HarvesterMaintenance.py +++ b/mxcubecore/HardwareObjects/HarvesterMaintenance.py @@ -21,10 +21,12 @@ """ Harvester Maintenance. """ -import gevent import logging -from mxcubecore.BaseHardwareObjects import HardwareObject + +import gevent + from mxcubecore import HardwareRepository as HWR +from mxcubecore.BaseHardwareObjects import HardwareObject class HarvesterMaintenance(HardwareObject): diff --git a/mxcubecore/HardwareObjects/ISARAMaint.py b/mxcubecore/HardwareObjects/ISARAMaint.py index 43af08c4f2..40491f4060 100644 --- a/mxcubecore/HardwareObjects/ISARAMaint.py +++ b/mxcubecore/HardwareObjects/ISARAMaint.py @@ -1,5 +1,10 @@ from typing import Optional -from tango import DeviceProxy, DevFailed + +from tango import ( + DevFailed, + DeviceProxy, +) + from mxcubecore.BaseHardwareObjects import HardwareObject """ diff --git a/mxcubecore/HardwareObjects/ISPyBClient.py b/mxcubecore/HardwareObjects/ISPyBClient.py index eb0749bff4..c05768266e 100644 --- a/mxcubecore/HardwareObjects/ISPyBClient.py +++ b/mxcubecore/HardwareObjects/ISPyBClient.py @@ -1,37 +1,39 @@ from __future__ import print_function -import sys -import json -import time + import itertools +import json import os +import sys +import time import traceback import warnings -from pprint import pformat from collections import namedtuple from datetime import datetime +from pprint import pformat try: - from urlparse import urljoin from urllib2 import URLError + from urlparse import urljoin except Exception: # Python3 from urllib.parse import urljoin from urllib.error import URLError -from suds.sudsobject import asdict from suds import WebFault from suds.client import Client +from suds.sudsobject import asdict + +from mxcubecore import HardwareRepository as HWR from mxcubecore.BaseHardwareObjects import HardwareObject from mxcubecore.utils.conversion import string_types -from mxcubecore import HardwareRepository as HWR """ A client for ISPyB Webservices. """ import logging -import gevent +import gevent suds_encode = str.encode diff --git a/mxcubecore/HardwareObjects/ISPyBRestClient.py b/mxcubecore/HardwareObjects/ISPyBRestClient.py index 7b2bb43075..ac365e9603 100644 --- a/mxcubecore/HardwareObjects/ISPyBRestClient.py +++ b/mxcubecore/HardwareObjects/ISPyBRestClient.py @@ -2,15 +2,19 @@ A client for ISPyB Webservices. """ -import logging -import json import cgi - +import json +import logging from datetime import datetime -from requests import post, get from urllib.parse import urljoin -from mxcubecore.BaseHardwareObjects import HardwareObject + +from requests import ( + get, + post, +) + from mxcubecore import HardwareRepository as HWR +from mxcubecore.BaseHardwareObjects import HardwareObject _CONNECTION_ERROR_MSG = ( "Could not connect to ISPyB, please verify that " diff --git a/mxcubecore/HardwareObjects/LNLS/EPICSActuator.py b/mxcubecore/HardwareObjects/LNLS/EPICSActuator.py index 200fcd2477..78528b90da 100644 --- a/mxcubecore/HardwareObjects/LNLS/EPICSActuator.py +++ b/mxcubecore/HardwareObjects/LNLS/EPICSActuator.py @@ -15,9 +15,11 @@ """ -import time import random +import time + import gevent + from mxcubecore.HardwareObjects.abstract import AbstractActuator diff --git a/mxcubecore/HardwareObjects/LNLS/EPICSMotor.py b/mxcubecore/HardwareObjects/LNLS/EPICSMotor.py index 7a5e786a1b..c6b33aeb4d 100644 --- a/mxcubecore/HardwareObjects/LNLS/EPICSMotor.py +++ b/mxcubecore/HardwareObjects/LNLS/EPICSMotor.py @@ -21,6 +21,7 @@ """ import logging import time + import gevent from mxcubecore.HardwareObjects.abstract.AbstractMotor import AbstractMotor diff --git a/mxcubecore/HardwareObjects/LNLS/EPICSNState.py b/mxcubecore/HardwareObjects/LNLS/EPICSNState.py index b5f1edb485..df75f0d63d 100644 --- a/mxcubecore/HardwareObjects/LNLS/EPICSNState.py +++ b/mxcubecore/HardwareObjects/LNLS/EPICSNState.py @@ -10,8 +10,8 @@ """ import logging - from enum import Enum + from mxcubecore.HardwareObjects.abstract.AbstractNState import AbstractNState from mxcubecore.HardwareObjects.LNLS.EPICSActuator import EPICSActuator diff --git a/mxcubecore/HardwareObjects/LNLS/LNLSAperture.py b/mxcubecore/HardwareObjects/LNLS/LNLSAperture.py index 8af0417fcf..d9bcab496c 100644 --- a/mxcubecore/HardwareObjects/LNLS/LNLSAperture.py +++ b/mxcubecore/HardwareObjects/LNLS/LNLSAperture.py @@ -18,10 +18,8 @@ # along with MXCuBE. If not, see . import logging -from mxcubecore.HardwareObjects.abstract.AbstractAperture import ( - AbstractAperture, -) +from mxcubecore.HardwareObjects.abstract.AbstractAperture import AbstractAperture __credits__ = ["MXCuBE collaboration"] __license__ = "LGPLv3" diff --git a/mxcubecore/HardwareObjects/LNLS/LNLSBeam.py b/mxcubecore/HardwareObjects/LNLS/LNLSBeam.py index e1d8a66554..1bcb754bf5 100644 --- a/mxcubecore/HardwareObjects/LNLS/LNLSBeam.py +++ b/mxcubecore/HardwareObjects/LNLS/LNLSBeam.py @@ -27,7 +27,10 @@ import ast -from mxcubecore.HardwareObjects.abstract.AbstractBeam import BeamShape, AbstractBeam +from mxcubecore.HardwareObjects.abstract.AbstractBeam import ( + AbstractBeam, + BeamShape, +) class LNLSBeam(AbstractBeam): diff --git a/mxcubecore/HardwareObjects/LNLS/LNLSCamera.py b/mxcubecore/HardwareObjects/LNLS/LNLSCamera.py index 2047ae71e4..e19c0b7963 100644 --- a/mxcubecore/HardwareObjects/LNLS/LNLSCamera.py +++ b/mxcubecore/HardwareObjects/LNLS/LNLSCamera.py @@ -1,14 +1,14 @@ """ Class for cameras connected by EPICS Area Detector """ -import os import logging -import gevent +import os from io import BytesIO from threading import Thread -from PIL import Image +import gevent import numpy as np +from PIL import Image from mxcubecore import BaseHardwareObjects diff --git a/mxcubecore/HardwareObjects/LNLS/LNLSCollect.py b/mxcubecore/HardwareObjects/LNLS/LNLSCollect.py index b91ce0df32..5ced97b7c4 100644 --- a/mxcubecore/HardwareObjects/LNLS/LNLSCollect.py +++ b/mxcubecore/HardwareObjects/LNLS/LNLSCollect.py @@ -1,13 +1,15 @@ +import logging +import os +import time + +import gevent + +from mxcubecore import HardwareRepository as HWR from mxcubecore.BaseHardwareObjects import HardwareObject from mxcubecore.HardwareObjects.abstract.AbstractMultiCollect import ( AbstractMultiCollect, ) from mxcubecore.TaskUtils import task -from mxcubecore import HardwareRepository as HWR -import logging -import time -import os -import gevent class LNLSCollect(AbstractMultiCollect, HardwareObject): @@ -184,7 +186,8 @@ def loop(self, owner, data_collect_parameters_list): ) return - import sys, subprocess + import subprocess + import sys try: process = subprocess.Popen( diff --git a/mxcubecore/HardwareObjects/LNLS/LNLSDetDistMotor.py b/mxcubecore/HardwareObjects/LNLS/LNLSDetDistMotor.py index 2744b12d14..4c5ec2564c 100644 --- a/mxcubecore/HardwareObjects/LNLS/LNLSDetDistMotor.py +++ b/mxcubecore/HardwareObjects/LNLS/LNLSDetDistMotor.py @@ -1,5 +1,5 @@ -import time import logging +import time from mxcubecore.HardwareObjects.LNLS.LNLSMotor import LNLSMotor diff --git a/mxcubecore/HardwareObjects/LNLS/LNLSDiffractometer.py b/mxcubecore/HardwareObjects/LNLS/LNLSDiffractometer.py index b75f7a5905..184836301c 100644 --- a/mxcubecore/HardwareObjects/LNLS/LNLSDiffractometer.py +++ b/mxcubecore/HardwareObjects/LNLS/LNLSDiffractometer.py @@ -18,17 +18,16 @@ # along with MXCuBE. If not, see . import ast -import time import logging import random +import time import warnings -from mxcubecore.HardwareObjects.GenericDiffractometer import ( - GenericDiffractometer -) -from mxcubecore import HardwareRepository as HWR from gevent.event import AsyncResult +from mxcubecore import HardwareRepository as HWR +from mxcubecore.HardwareObjects.GenericDiffractometer import GenericDiffractometer + class LNLSDiffractometer(GenericDiffractometer): """ diff --git a/mxcubecore/HardwareObjects/LNLS/LNLSEnergy.py b/mxcubecore/HardwareObjects/LNLS/LNLSEnergy.py index f1fddce4c9..604e1490e4 100644 --- a/mxcubecore/HardwareObjects/LNLS/LNLSEnergy.py +++ b/mxcubecore/HardwareObjects/LNLS/LNLSEnergy.py @@ -21,8 +21,7 @@ import logging -from mxcubecore.HardwareObjects.abstract.AbstractEnergy import ( - AbstractEnergy) +from mxcubecore.HardwareObjects.abstract.AbstractEnergy import AbstractEnergy from mxcubecore.HardwareObjects.LNLS.EPICSActuator import EPICSActuator diff --git a/mxcubecore/HardwareObjects/LNLS/LNLSPilatusDet.py b/mxcubecore/HardwareObjects/LNLS/LNLSPilatusDet.py index 38c85820d9..6b0f6ad14e 100644 --- a/mxcubecore/HardwareObjects/LNLS/LNLSPilatusDet.py +++ b/mxcubecore/HardwareObjects/LNLS/LNLSPilatusDet.py @@ -1,11 +1,10 @@ -import time import logging +import time -from mxcubecore.HardwareObjects.abstract.AbstractDetector import ( - AbstractDetector, -) import epics +from mxcubecore.HardwareObjects.abstract.AbstractDetector import AbstractDetector + class LNLSPilatusDet(AbstractDetector): diff --git a/mxcubecore/HardwareObjects/LNLS/LNLSSlits.py b/mxcubecore/HardwareObjects/LNLS/LNLSSlits.py index db1e13bad4..f8b1d8ed4c 100644 --- a/mxcubecore/HardwareObjects/LNLS/LNLSSlits.py +++ b/mxcubecore/HardwareObjects/LNLS/LNLSSlits.py @@ -20,7 +20,6 @@ from mxcubecore.HardwareObjects.abstract.AbstractSlits import AbstractSlits - __credits__ = ["MXCuBE collaboration"] diff --git a/mxcubecore/HardwareObjects/LNLS/LNLSTransmission.py b/mxcubecore/HardwareObjects/LNLS/LNLSTransmission.py index 5efb4ea509..aadc255379 100644 --- a/mxcubecore/HardwareObjects/LNLS/LNLSTransmission.py +++ b/mxcubecore/HardwareObjects/LNLS/LNLSTransmission.py @@ -25,12 +25,10 @@ AbstractTransmission, ) from mxcubecore.HardwareObjects.LNLS.EPICSActuator import EPICSActuator - -from mxcubecore.HardwareObjects.LNLS.read_transmission_mnc import ( - read_transmission -) +from mxcubecore.HardwareObjects.LNLS.read_transmission_mnc import read_transmission from mxcubecore.HardwareObjects.LNLS.set_transmission_mnc import ( - get_transmission, set_foils + get_transmission, + set_foils, ) __copyright__ = """ Copyright © 2020 by the MXCuBE collaboration """ diff --git a/mxcubecore/HardwareObjects/LNLS/LNLSZoom.py b/mxcubecore/HardwareObjects/LNLS/LNLSZoom.py index bc71bfa61c..5b86af8c62 100644 --- a/mxcubecore/HardwareObjects/LNLS/LNLSZoom.py +++ b/mxcubecore/HardwareObjects/LNLS/LNLSZoom.py @@ -8,12 +8,15 @@ EL6": 6} """ +import time from enum import Enum + import gevent -import time -from mxcubecore.HardwareObjects.abstract.AbstractNState import AbstractNState -from mxcubecore.HardwareObjects.abstract.AbstractNState import BaseValueEnum +from mxcubecore.HardwareObjects.abstract.AbstractNState import ( + AbstractNState, + BaseValueEnum, +) from mxcubecore.HardwareObjects.LNLS.EPICSActuator import EPICSActuator diff --git a/mxcubecore/HardwareObjects/LNLS/read_transmission_mnc.py b/mxcubecore/HardwareObjects/LNLS/read_transmission_mnc.py index a6d85a58fb..0e092c3f0f 100644 --- a/mxcubecore/HardwareObjects/LNLS/read_transmission_mnc.py +++ b/mxcubecore/HardwareObjects/LNLS/read_transmission_mnc.py @@ -20,9 +20,11 @@ MU is the linear attenuation coeficient (cm^-1) and d is the thickness of the foil (cm). """ import argparse -from epics import PV import math +from epics import PV + + def read_input(): # Read inputs from terminal ap = argparse.ArgumentParser() diff --git a/mxcubecore/HardwareObjects/LNLS/set_transmission_mnc.py b/mxcubecore/HardwareObjects/LNLS/set_transmission_mnc.py index 2981d55ba8..21eb4a0a87 100755 --- a/mxcubecore/HardwareObjects/LNLS/set_transmission_mnc.py +++ b/mxcubecore/HardwareObjects/LNLS/set_transmission_mnc.py @@ -20,11 +20,12 @@ MU is the linear attenuation coeficient (cm^-1) and d is the thickness of the foil (cm). """ import argparse -from epics import PV import itertools import math import time +from epics import PV + def read_input(): # Read inputs from terminal diff --git a/mxcubecore/HardwareObjects/LdapAuthenticator.py b/mxcubecore/HardwareObjects/LdapAuthenticator.py index 574b011987..971cc658d5 100644 --- a/mxcubecore/HardwareObjects/LdapAuthenticator.py +++ b/mxcubecore/HardwareObjects/LdapAuthenticator.py @@ -5,6 +5,7 @@ """ import logging + import ldap from mxcubecore.HardwareObjects.abstract.AbstractAuthenticator import ( diff --git a/mxcubecore/HardwareObjects/Lima2Detector.py b/mxcubecore/HardwareObjects/Lima2Detector.py index 3c4cb7390c..c71a5d7121 100644 --- a/mxcubecore/HardwareObjects/Lima2Detector.py +++ b/mxcubecore/HardwareObjects/Lima2Detector.py @@ -1,23 +1,19 @@ -import gevent -import time import logging -from gevent import subprocess import os - -from uuid import uuid1 +import time from contextlib import ExitStack +from uuid import uuid1 -from lima2.client import Detector +import gevent +from gevent import subprocess from lima2.client import Detector from lima2.client.smx.aggregation import create_virtual_dataset -from mxcubecore.TaskUtils import task from mxcubecore import HardwareRepository as HWR +from mxcubecore.BaseHardwareObjects import HardwareObjectState from mxcubecore.CommandContainer import ConnectionError - from mxcubecore.HardwareObjects.abstract.AbstractDetector import AbstractDetector - -from mxcubecore.BaseHardwareObjects import HardwareObjectState +from mxcubecore.TaskUtils import task _logger = logging.getLogger("HWR") diff --git a/mxcubecore/HardwareObjects/LimaEigerDetector.py b/mxcubecore/HardwareObjects/LimaEigerDetector.py index 442e175255..a8ab08f124 100644 --- a/mxcubecore/HardwareObjects/LimaEigerDetector.py +++ b/mxcubecore/HardwareObjects/LimaEigerDetector.py @@ -2,16 +2,17 @@ Lima Tango Device Server implementation of the Dectris Eiger2 Detector. """ -import gevent -import time -import os -import math import logging +import math +import os +import time + +import gevent -from mxcubecore.model.queue_model_objects import PathTemplate -from mxcubecore.TaskUtils import task from mxcubecore import HardwareRepository as HWR from mxcubecore.HardwareObjects.abstract.AbstractDetector import AbstractDetector +from mxcubecore.model.queue_model_objects import PathTemplate +from mxcubecore.TaskUtils import task class LimaEigerDetector(AbstractDetector): diff --git a/mxcubecore/HardwareObjects/LimaJungfrauDetector.py b/mxcubecore/HardwareObjects/LimaJungfrauDetector.py index 615a2a1cff..881ecf1f2d 100644 --- a/mxcubecore/HardwareObjects/LimaJungfrauDetector.py +++ b/mxcubecore/HardwareObjects/LimaJungfrauDetector.py @@ -1,12 +1,13 @@ -import gevent -import time -import subprocess import logging import os +import subprocess +import time +import gevent + +from mxcubecore.BaseHardwareObjects import HardwareObjectState from mxcubecore.CommandContainer import ConnectionError from mxcubecore.HardwareObjects.abstract.AbstractDetector import AbstractDetector -from mxcubecore.BaseHardwareObjects import HardwareObjectState class LimaJungfrauDetector(AbstractDetector): diff --git a/mxcubecore/HardwareObjects/LimaPilatusDetector.py b/mxcubecore/HardwareObjects/LimaPilatusDetector.py index fab9785645..545317457a 100644 --- a/mxcubecore/HardwareObjects/LimaPilatusDetector.py +++ b/mxcubecore/HardwareObjects/LimaPilatusDetector.py @@ -1,17 +1,16 @@ -import gevent -import time -import subprocess -import os import logging +import os +import subprocess +import time +import gevent from PyTango import DeviceProxy -from mxcubecore.TaskUtils import task + from mxcubecore import HardwareRepository as HWR +from mxcubecore.BaseHardwareObjects import HardwareObjectState from mxcubecore.CommandContainer import ConnectionError - from mxcubecore.HardwareObjects.abstract.AbstractDetector import AbstractDetector - -from mxcubecore.BaseHardwareObjects import HardwareObjectState +from mxcubecore.TaskUtils import task class LimaPilatusDetector(AbstractDetector): diff --git a/mxcubecore/HardwareObjects/MAXIV/BIOMAXAperture.py b/mxcubecore/HardwareObjects/MAXIV/BIOMAXAperture.py index 3ecaba3410..35ccf654bc 100644 --- a/mxcubecore/HardwareObjects/MAXIV/BIOMAXAperture.py +++ b/mxcubecore/HardwareObjects/MAXIV/BIOMAXAperture.py @@ -1,4 +1,5 @@ import logging + from mxcubecore.HardwareObjects.MicrodiffAperture import MicrodiffAperture diff --git a/mxcubecore/HardwareObjects/MAXIV/BIOMAXBeamInfo.py b/mxcubecore/HardwareObjects/MAXIV/BIOMAXBeamInfo.py index 06a71f3d85..e210407820 100755 --- a/mxcubecore/HardwareObjects/MAXIV/BIOMAXBeamInfo.py +++ b/mxcubecore/HardwareObjects/MAXIV/BIOMAXBeamInfo.py @@ -1,5 +1,5 @@ -from mxcubecore.HardwareObjects import BeamInfo from mxcubecore import HardwareRepository as HWR +from mxcubecore.HardwareObjects import BeamInfo class BIOMAXBeamInfo(BeamInfo.BeamInfo): diff --git a/mxcubecore/HardwareObjects/MAXIV/BIOMAXBeamlineActions.py b/mxcubecore/HardwareObjects/MAXIV/BIOMAXBeamlineActions.py index 39ed91f22f..88235354fa 100644 --- a/mxcubecore/HardwareObjects/MAXIV/BIOMAXBeamlineActions.py +++ b/mxcubecore/HardwareObjects/MAXIV/BIOMAXBeamlineActions.py @@ -1,11 +1,12 @@ import logging import time + import gevent +from mxcubecore import HardwareRepository as HWR from mxcubecore.BaseHardwareObjects import HardwareObject -from mxcubecore.TaskUtils import task from mxcubecore.CommandContainer import CommandObject -from mxcubecore import HardwareRepository as HWR +from mxcubecore.TaskUtils import task class ControllerCommand(CommandObject): diff --git a/mxcubecore/HardwareObjects/MAXIV/BIOMAXCollect.py b/mxcubecore/HardwareObjects/MAXIV/BIOMAXCollect.py index 18a4fa1fab..390c4bc560 100644 --- a/mxcubecore/HardwareObjects/MAXIV/BIOMAXCollect.py +++ b/mxcubecore/HardwareObjects/MAXIV/BIOMAXCollect.py @@ -11,22 +11,22 @@ """ -import os +import json import logging -import gevent -import time import math -import requests -import uuid -import json +import os import sys +import time +import uuid +import gevent +import requests from EigerDataSet import EigerDataSet -from mxcubecore.TaskUtils import task -from mxcubecore.BaseHardwareObjects import HardwareObject -from mxcubecore.HardwareObjects.abstract.AbstractCollect import AbstractCollect from mxcubecore import HardwareRepository as HWR +from mxcubecore.BaseHardwareObjects import HardwareObject +from mxcubecore.HardwareObjects.abstract.AbstractCollect import AbstractCollect +from mxcubecore.TaskUtils import task class BIOMAXCollect(AbstractCollect, HardwareObject): diff --git a/mxcubecore/HardwareObjects/MAXIV/BIOMAXEiger.py b/mxcubecore/HardwareObjects/MAXIV/BIOMAXEiger.py index 1a3c0ee69a..95f15334f6 100644 --- a/mxcubecore/HardwareObjects/MAXIV/BIOMAXEiger.py +++ b/mxcubecore/HardwareObjects/MAXIV/BIOMAXEiger.py @@ -20,14 +20,16 @@ """ from __future__ import print_function -import gevent -import time + import copy import logging +import time + +import gevent -from mxcubecore.TaskUtils import task -from mxcubecore.BaseHardwareObjects import HardwareObject from mxcubecore import HardwareRepository as HWR +from mxcubecore.BaseHardwareObjects import HardwareObject +from mxcubecore.TaskUtils import task class BIOMAXEiger(HardwareObject): @@ -700,8 +702,8 @@ def abort(self): def test(): - import sys import os + import sys if len(sys.argv) != 5: print( diff --git a/mxcubecore/HardwareObjects/MAXIV/BIOMAXEnergy.py b/mxcubecore/HardwareObjects/MAXIV/BIOMAXEnergy.py index b7348023bc..c523768d69 100644 --- a/mxcubecore/HardwareObjects/MAXIV/BIOMAXEnergy.py +++ b/mxcubecore/HardwareObjects/MAXIV/BIOMAXEnergy.py @@ -1,7 +1,9 @@ import logging + import gevent -from mxcubecore.HardwareObjects import Energy + from mxcubecore import HardwareRepository as HWR +from mxcubecore.HardwareObjects import Energy class BIOMAXEnergy(Energy.Energy): diff --git a/mxcubecore/HardwareObjects/MAXIV/BIOMAXKafka.py b/mxcubecore/HardwareObjects/MAXIV/BIOMAXKafka.py index 4c410fbada..955bd9306d 100644 --- a/mxcubecore/HardwareObjects/MAXIV/BIOMAXKafka.py +++ b/mxcubecore/HardwareObjects/MAXIV/BIOMAXKafka.py @@ -2,14 +2,16 @@ A client for Biomax Kafka services. """ +import json import logging +import re import time -import json import uuid -import re + import requests -from mxcubecore.BaseHardwareObjects import HardwareObject + from mxcubecore import HardwareRepository as HWR +from mxcubecore.BaseHardwareObjects import HardwareObject class BIOMAXKafka(HardwareObject): diff --git a/mxcubecore/HardwareObjects/MAXIV/BIOMAXMD3.py b/mxcubecore/HardwareObjects/MAXIV/BIOMAXMD3.py index b151c7163b..ac25d55fa6 100644 --- a/mxcubecore/HardwareObjects/MAXIV/BIOMAXMD3.py +++ b/mxcubecore/HardwareObjects/MAXIV/BIOMAXMD3.py @@ -4,22 +4,22 @@ """ -import time +# import lucid +import io import logging +import math +import time + import gevent import lucid2 as lucid import numpy as np from PIL import Image -# import lucid -import io -import math - +from mxcubecore import HardwareRepository as HWR from mxcubecore.HardwareObjects.GenericDiffractometer import ( - GenericDiffractometer, DiffractometerState, + GenericDiffractometer, ) -from mxcubecore import HardwareRepository as HWR class BIOMAXMD3(GenericDiffractometer): diff --git a/mxcubecore/HardwareObjects/MAXIV/BIOMAXMD3Camera.py b/mxcubecore/HardwareObjects/MAXIV/BIOMAXMD3Camera.py index 4ba7125066..90f3ada66a 100755 --- a/mxcubecore/HardwareObjects/MAXIV/BIOMAXMD3Camera.py +++ b/mxcubecore/HardwareObjects/MAXIV/BIOMAXMD3Camera.py @@ -1,13 +1,18 @@ -from mxcubecore.BaseHardwareObjects import HardwareObject -import math +import array +import base64 import logging +import math import time +from threading import ( + Event, + Thread, +) + import gevent -from threading import Event, Thread -import base64 -import array import numpy as np +from mxcubecore.BaseHardwareObjects import HardwareObject + class MD2TimeoutError(Exception): pass diff --git a/mxcubecore/HardwareObjects/MAXIV/BIOMAXPatches.py b/mxcubecore/HardwareObjects/MAXIV/BIOMAXPatches.py index 0803b6a154..cae1a2bcdf 100644 --- a/mxcubecore/HardwareObjects/MAXIV/BIOMAXPatches.py +++ b/mxcubecore/HardwareObjects/MAXIV/BIOMAXPatches.py @@ -1,9 +1,11 @@ -from mxcubecore.BaseHardwareObjects import HardwareObject -import types import logging -import gevent import time +import types + +import gevent + from mxcubecore import HardwareRepository as HWR +from mxcubecore.BaseHardwareObjects import HardwareObject class BIOMAXPatches(HardwareObject): diff --git a/mxcubecore/HardwareObjects/MAXIV/BIOMAXResolution.py b/mxcubecore/HardwareObjects/MAXIV/BIOMAXResolution.py index 1c9bafb088..7ccf4f5ccc 100755 --- a/mxcubecore/HardwareObjects/MAXIV/BIOMAXResolution.py +++ b/mxcubecore/HardwareObjects/MAXIV/BIOMAXResolution.py @@ -1,8 +1,8 @@ import logging -from mxcubecore.HardwareObjects import Resolution import math from mxcubecore import HardwareRepository as HWR +from mxcubecore.HardwareObjects import Resolution class BIOMAXResolution(Resolution.Resolution): diff --git a/mxcubecore/HardwareObjects/MAXIV/BIOMAXTransmission.py b/mxcubecore/HardwareObjects/MAXIV/BIOMAXTransmission.py index 26ebbfc4c4..00e927c14c 100644 --- a/mxcubecore/HardwareObjects/MAXIV/BIOMAXTransmission.py +++ b/mxcubecore/HardwareObjects/MAXIV/BIOMAXTransmission.py @@ -1,6 +1,7 @@ import gevent -from mxcubecore.BaseHardwareObjects import HardwareObject + from mxcubecore import HardwareRepository as HWR +from mxcubecore.BaseHardwareObjects import HardwareObject class BIOMAXTransmission(HardwareObject): diff --git a/mxcubecore/HardwareObjects/MAXIV/MAXIVAutoProcessing.py b/mxcubecore/HardwareObjects/MAXIV/MAXIVAutoProcessing.py index d85cd59b77..9a51f95623 100755 --- a/mxcubecore/HardwareObjects/MAXIV/MAXIVAutoProcessing.py +++ b/mxcubecore/HardwareObjects/MAXIV/MAXIVAutoProcessing.py @@ -21,18 +21,19 @@ MAXIVAutoProcessing """ -import os -import time import logging -import gevent +import os import subprocess +import time +import gevent from XSDataAutoprocv1_0 import XSDataAutoprocInput - -from XSDataCommon import XSDataDouble -from XSDataCommon import XSDataFile -from XSDataCommon import XSDataInteger -from XSDataCommon import XSDataString +from XSDataCommon import ( + XSDataDouble, + XSDataFile, + XSDataInteger, + XSDataString, +) from mxcubecore.BaseHardwareObjects import HardwareObject diff --git a/mxcubecore/HardwareObjects/MAXIV/MachInfo.py b/mxcubecore/HardwareObjects/MAXIV/MachInfo.py index ad603aecf7..40c5326672 100755 --- a/mxcubecore/HardwareObjects/MAXIV/MachInfo.py +++ b/mxcubecore/HardwareObjects/MAXIV/MachInfo.py @@ -1,10 +1,15 @@ -import re -import math import logging +import math +import re + import gevent from tango import DeviceProxy -from mxcubecore.utils.units import sec_to_hour, A_to_mA + from mxcubecore.HardwareObjects.abstract.AbstractMachineInfo import AbstractMachineInfo +from mxcubecore.utils.units import ( + A_to_mA, + sec_to_hour, +) # how often we refresh machine info REFRESH_PERIOD_SEC = 30 diff --git a/mxcubecore/HardwareObjects/MAXIV/MaxIVSession.py b/mxcubecore/HardwareObjects/MAXIV/MaxIVSession.py index c6cdbed28a..0a1625b1d1 100644 --- a/mxcubecore/HardwareObjects/MAXIV/MaxIVSession.py +++ b/mxcubecore/HardwareObjects/MAXIV/MaxIVSession.py @@ -4,13 +4,16 @@ Adapting from original Session.py to adapt the names of data directories """ +import logging import os -import time import socket -import logging +import time try: - from sdm import storage, Visitor + from sdm import ( + Visitor, + storage, + ) except Exception: raise Exception("Cannot import SDM library.") diff --git a/mxcubecore/HardwareObjects/MAXIV/autoProcLauncher.py b/mxcubecore/HardwareObjects/MAXIV/autoProcLauncher.py index 6060ee68dd..b95275ed56 100755 --- a/mxcubecore/HardwareObjects/MAXIV/autoProcLauncher.py +++ b/mxcubecore/HardwareObjects/MAXIV/autoProcLauncher.py @@ -4,17 +4,17 @@ # /data/staff/biomax/staff/jie/2015_11_10/processed -mode after # -datacollectionID 13 -residues 200 -anomalous False -cell "0,0,0,0,0,0" +import logging import os +import shlex +import string +import subprocess import sys +import tempfile import time -import string import urllib -import logging + import httplib -import logging -import tempfile -import subprocess -import shlex inputTemplate = """ diff --git a/mxcubecore/HardwareObjects/MAXIV/ednaProcLauncher.py b/mxcubecore/HardwareObjects/MAXIV/ednaProcLauncher.py index cc48655577..d14baec17f 100755 --- a/mxcubecore/HardwareObjects/MAXIV/ednaProcLauncher.py +++ b/mxcubecore/HardwareObjects/MAXIV/ednaProcLauncher.py @@ -3,16 +3,16 @@ # /data/staff/biomax/staff/jie/20161212_thau_2/processed4 -mode after # -datacollectionID 14 -residues 200 -anomalous False -cell "0,0,0,0,0,0" +import logging import os +import string +import subprocess import sys +import tempfile import time -import string import urllib -import logging + import httplib -import logging -import tempfile -import subprocess # XDS.INP creation is now asynchronous in mxcube, so it may not be here yet # when we're started diff --git a/mxcubecore/HardwareObjects/MD2Motor.py b/mxcubecore/HardwareObjects/MD2Motor.py index 50adfbd30e..efc1e428fd 100644 --- a/mxcubecore/HardwareObjects/MD2Motor.py +++ b/mxcubecore/HardwareObjects/MD2Motor.py @@ -1,6 +1,11 @@ import logging -from gevent import Timeout, sleep from warnings import warn + +from gevent import ( + Timeout, + sleep, +) + from mxcubecore.HardwareObjects.abstract.AbstractMotor import ( AbstractMotor, MotorStates, diff --git a/mxcubecore/HardwareObjects/MD3UP.py b/mxcubecore/HardwareObjects/MD3UP.py index e1dc6745ad..fd955b771d 100644 --- a/mxcubecore/HardwareObjects/MD3UP.py +++ b/mxcubecore/HardwareObjects/MD3UP.py @@ -1,11 +1,12 @@ -import math -import numpy import logging +import math import time +import numpy + +from mxcubecore import HardwareRepository as HWR from mxcubecore.HardwareObjects import Microdiff from mxcubecore.HardwareObjects.sample_centring import CentringMotor -from mxcubecore import HardwareRepository as HWR class MD3UP(Microdiff.Microdiff): diff --git a/mxcubecore/HardwareObjects/MachCurrent.py b/mxcubecore/HardwareObjects/MachCurrent.py index bf7b2f4dd2..853fdef8f4 100644 --- a/mxcubecore/HardwareObjects/MachCurrent.py +++ b/mxcubecore/HardwareObjects/MachCurrent.py @@ -31,9 +31,8 @@ """ import logging -from mxcubecore.HardwareObjects.abstract.AbstractMachineInfo import ( - AbstractMachineInfo, -) + +from mxcubecore.HardwareObjects.abstract.AbstractMachineInfo import AbstractMachineInfo __copyright__ = """ Copyright © 2010-2023 by the MXCuBE collaboration """ __license__ = "LGPLv3+" diff --git a/mxcubecore/HardwareObjects/Marvin.py b/mxcubecore/HardwareObjects/Marvin.py index 4a244c67a8..6ba8399a17 100644 --- a/mxcubecore/HardwareObjects/Marvin.py +++ b/mxcubecore/HardwareObjects/Marvin.py @@ -17,13 +17,15 @@ # You should have received a copy of the GNU Lesser General Public License # along with MXCuBE. If not, see . -import os -import time -import gevent import logging +import os import tempfile +import time from datetime import datetime +import gevent + +from mxcubecore import HardwareRepository as HWR from mxcubecore.BaseHardwareObjects import HardwareObjectState from mxcubecore.HardwareObjects.abstract import AbstractSampleChanger from mxcubecore.HardwareObjects.abstract.sample_changer import ( @@ -32,9 +34,6 @@ Sample, ) -from mxcubecore import HardwareRepository as HWR - - POSITION_DESC = { "Park": "Parked", "PickDew": "Pick from dewar", diff --git a/mxcubecore/HardwareObjects/Microdiff.py b/mxcubecore/HardwareObjects/Microdiff.py index 0a6d542d44..2d5e3d1f4c 100644 --- a/mxcubecore/HardwareObjects/Microdiff.py +++ b/mxcubecore/HardwareObjects/Microdiff.py @@ -1,12 +1,18 @@ import logging import math import time + import gevent -from mxcubecore.BaseHardwareObjects import HardwareObject, HardwareObjectState -from mxcubecore.HardwareObjects import MiniDiff -from mxcubecore.HardwareObjects import sample_centring from mxcubecore import HardwareRepository as HWR +from mxcubecore.BaseHardwareObjects import ( + HardwareObject, + HardwareObjectState, +) +from mxcubecore.HardwareObjects import ( + MiniDiff, + sample_centring, +) MICRODIFF = None diff --git a/mxcubecore/HardwareObjects/MicrodiffActuator.py b/mxcubecore/HardwareObjects/MicrodiffActuator.py index 96d5fc5231..f7314293fc 100644 --- a/mxcubecore/HardwareObjects/MicrodiffActuator.py +++ b/mxcubecore/HardwareObjects/MicrodiffActuator.py @@ -13,9 +13,8 @@ import logging import time -from mxcubecore.HardwareObjects.abstract.AbstractActuator import ( - AbstractActuator, -) + +from mxcubecore.HardwareObjects.abstract.AbstractActuator import AbstractActuator from mxcubecore.TaskUtils import task diff --git a/mxcubecore/HardwareObjects/MicrodiffAperture.py b/mxcubecore/HardwareObjects/MicrodiffAperture.py index 756cf9ea2d..03ddcda36e 100644 --- a/mxcubecore/HardwareObjects/MicrodiffAperture.py +++ b/mxcubecore/HardwareObjects/MicrodiffAperture.py @@ -38,6 +38,7 @@ """ from ast import literal_eval from enum import Enum + from mxcubecore.HardwareObjects.abstract.AbstractNState import BaseValueEnum from mxcubecore.HardwareObjects.ExporterNState import ExporterNState diff --git a/mxcubecore/HardwareObjects/MicrodiffFocusMotor.py b/mxcubecore/HardwareObjects/MicrodiffFocusMotor.py index f1e1725371..5f613bb63d 100644 --- a/mxcubecore/HardwareObjects/MicrodiffFocusMotor.py +++ b/mxcubecore/HardwareObjects/MicrodiffFocusMotor.py @@ -1,5 +1,5 @@ -from mxcubecore.HardwareObjects.ExpMotor import ExpMotor from mxcubecore import HardwareRepository as HWR +from mxcubecore.HardwareObjects.ExpMotor import ExpMotor class MicrodiffFocusMotor(ExpMotor): diff --git a/mxcubecore/HardwareObjects/MicrodiffInOut.py b/mxcubecore/HardwareObjects/MicrodiffInOut.py index 2c42ae4896..6dbff06c96 100644 --- a/mxcubecore/HardwareObjects/MicrodiffInOut.py +++ b/mxcubecore/HardwareObjects/MicrodiffInOut.py @@ -1,7 +1,8 @@ import logging +import time + from mxcubecore.BaseHardwareObjects import HardwareObject from mxcubecore.HardwareObjects.abstract.AbstractMotor import MotorStates -import time """ Use the exporter to set different MD2 actuators in/out. diff --git a/mxcubecore/HardwareObjects/MicrodiffKappaMotor.py b/mxcubecore/HardwareObjects/MicrodiffKappaMotor.py index 32b4345738..71391f31fe 100644 --- a/mxcubecore/HardwareObjects/MicrodiffKappaMotor.py +++ b/mxcubecore/HardwareObjects/MicrodiffKappaMotor.py @@ -1,11 +1,11 @@ import logging import time + import gevent import numpy as np -import logging -from mxcubecore.HardwareObjects.ExporterMotor import ExporterMotor from mxcubecore.HardwareObjects.abstract.AbstractMotor import MotorStates +from mxcubecore.HardwareObjects.ExporterMotor import ExporterMotor class MicrodiffKappaMotor(ExporterMotor): diff --git a/mxcubecore/HardwareObjects/MicrodiffLight.py b/mxcubecore/HardwareObjects/MicrodiffLight.py index 42c5555225..257c75f1cd 100644 --- a/mxcubecore/HardwareObjects/MicrodiffLight.py +++ b/mxcubecore/HardwareObjects/MicrodiffLight.py @@ -1,5 +1,5 @@ -from mxcubecore.HardwareObjects.ExporterMotor import ExporterMotor from mxcubecore.BaseHardwareObjects import HardwareObjectState +from mxcubecore.HardwareObjects.ExporterMotor import ExporterMotor class MicrodiffLight(ExporterMotor): diff --git a/mxcubecore/HardwareObjects/MicrodiffMotor.py b/mxcubecore/HardwareObjects/MicrodiffMotor.py index d9982cca47..cdb0480048 100644 --- a/mxcubecore/HardwareObjects/MicrodiffMotor.py +++ b/mxcubecore/HardwareObjects/MicrodiffMotor.py @@ -1,5 +1,7 @@ import time + from gevent import Timeout + from mxcubecore.HardwareObjects.abstract.AbstractMotor import AbstractMotor diff --git a/mxcubecore/HardwareObjects/MicrodiffSamplePseudo.py b/mxcubecore/HardwareObjects/MicrodiffSamplePseudo.py index b0266b495f..c3c2a5d25e 100644 --- a/mxcubecore/HardwareObjects/MicrodiffSamplePseudo.py +++ b/mxcubecore/HardwareObjects/MicrodiffSamplePseudo.py @@ -1,8 +1,9 @@ -from mxcubecore.HardwareObjects.MD2Motor import MD2Motor -from mxcubecore.HardwareObjects.abstract.AbstractMotor import MotorStates import logging import math +from mxcubecore.HardwareObjects.abstract.AbstractMotor import MotorStates +from mxcubecore.HardwareObjects.MD2Motor import MD2Motor + class MicrodiffSamplePseudo(MD2Motor): def __init__(self, name): diff --git a/mxcubecore/HardwareObjects/MicrodiffZoom.py b/mxcubecore/HardwareObjects/MicrodiffZoom.py index 2afc6ab53b..fbb638ec6a 100644 --- a/mxcubecore/HardwareObjects/MicrodiffZoom.py +++ b/mxcubecore/HardwareObjects/MicrodiffZoom.py @@ -33,6 +33,7 @@ """ from enum import Enum + from mxcubecore.HardwareObjects.ExporterNState import ExporterNState __copyright__ = """ Copyright © 2020 by the MXCuBE collaboration """ diff --git a/mxcubecore/HardwareObjects/MiniDiff.py b/mxcubecore/HardwareObjects/MiniDiff.py index 1b8a553802..2bee7b4bc8 100644 --- a/mxcubecore/HardwareObjects/MiniDiff.py +++ b/mxcubecore/HardwareObjects/MiniDiff.py @@ -1,25 +1,22 @@ -import gevent -import tempfile +import copy +import json import logging import math import os +import tempfile import time -import copy -import numpy -import json - from typing import Union + +import gevent +import numpy from pydantic import ValidationError +from mxcubecore import HardwareRepository as HWR from mxcubecore.BaseHardwareObjects import HardwareObject -from mxcubecore.TaskUtils import task from mxcubecore.HardwareObjects import sample_centring +from mxcubecore.HardwareObjects.GenericDiffractometer import GonioHeadConfiguration from mxcubecore.model import queue_model_objects as qmo -from mxcubecore import HardwareRepository as HWR - -from mxcubecore.HardwareObjects.GenericDiffractometer import ( - GonioHeadConfiguration, -) +from mxcubecore.TaskUtils import task try: from Qub.Tools import QubImageSave diff --git a/mxcubecore/HardwareObjects/MiniKappaCorrection.py b/mxcubecore/HardwareObjects/MiniKappaCorrection.py index a56c2efb82..9524b6b0b7 100644 --- a/mxcubecore/HardwareObjects/MiniKappaCorrection.py +++ b/mxcubecore/HardwareObjects/MiniKappaCorrection.py @@ -1,7 +1,9 @@ -from mxcubecore.BaseHardwareObjects import HardwareObject import math + import numpy as np +from mxcubecore.BaseHardwareObjects import HardwareObject + class MiniKappaCorrection(HardwareObject): """ diff --git a/mxcubecore/HardwareObjects/MotorWPositions.py b/mxcubecore/HardwareObjects/MotorWPositions.py index 6a0bc3f010..bceebef658 100644 --- a/mxcubecore/HardwareObjects/MotorWPositions.py +++ b/mxcubecore/HardwareObjects/MotorWPositions.py @@ -18,6 +18,7 @@ # along with MXCuBE. If not, see . import logging + from mxcubecore.BaseHardwareObjects import HardwareObject from mxcubecore.HardwareObjects.abstract.AbstractMotor import AbstractMotor diff --git a/mxcubecore/HardwareObjects/MotorsNPosition.py b/mxcubecore/HardwareObjects/MotorsNPosition.py index 13257c5d73..5dcdd2effb 100644 --- a/mxcubecore/HardwareObjects/MotorsNPosition.py +++ b/mxcubecore/HardwareObjects/MotorsNPosition.py @@ -23,9 +23,9 @@ from collections import OrderedDict +from mxcubecore.BaseHardwareObjects import HardwareObjectState from mxcubecore.HardwareObjects.abstract.AbstractActuator import AbstractActuator from mxcubecore.HardwareObjects.abstract.AbstractMotor import MotorStates -from mxcubecore.BaseHardwareObjects import HardwareObjectState class MotorsNPosition(AbstractActuator): diff --git a/mxcubecore/HardwareObjects/MultiplePositions.py b/mxcubecore/HardwareObjects/MultiplePositions.py index 1e49961c89..c79eeb511f 100644 --- a/mxcubecore/HardwareObjects/MultiplePositions.py +++ b/mxcubecore/HardwareObjects/MultiplePositions.py @@ -144,9 +144,10 @@ except ImportError: import cElementTree -from mxcubecore.BaseHardwareObjects import HardwareObject import logging +from mxcubecore.BaseHardwareObjects import HardwareObject + class MultiplePositions(HardwareObject): def init(self): diff --git a/mxcubecore/HardwareObjects/Native/__init__.py b/mxcubecore/HardwareObjects/Native/__init__.py index 652e6abb4c..a9ee3d31af 100644 --- a/mxcubecore/HardwareObjects/Native/__init__.py +++ b/mxcubecore/HardwareObjects/Native/__init__.py @@ -1,11 +1,15 @@ # -*- coding: utf-8 -*- -import jsonpickle import inspect import logging -from mxcubecore.model import queue_model_objects -from mxcubecore.model import queue_model_enumerables + +import jsonpickle + from mxcubecore import HardwareRepository as HWR +from mxcubecore.model import ( + queue_model_enumerables, + queue_model_objects, +) xmlrpc_prefix = "" diff --git a/mxcubecore/HardwareObjects/ObjectsController.py b/mxcubecore/HardwareObjects/ObjectsController.py index 8019cfd82f..364674fd59 100644 --- a/mxcubecore/HardwareObjects/ObjectsController.py +++ b/mxcubecore/HardwareObjects/ObjectsController.py @@ -1,7 +1,8 @@ -from mxcubecore.BaseHardwareObjects import HardwareObject import os import sys +from mxcubecore.BaseHardwareObjects import HardwareObject + class ObjectsController(HardwareObject): def __init__(self, *args): diff --git a/mxcubecore/HardwareObjects/PlateManipulator.py b/mxcubecore/HardwareObjects/PlateManipulator.py index 2d0b60dacb..8637d9a54e 100644 --- a/mxcubecore/HardwareObjects/PlateManipulator.py +++ b/mxcubecore/HardwareObjects/PlateManipulator.py @@ -32,20 +32,21 @@ ----------------------------------------------------------------------- """ +import logging import time + import gevent -import logging -from mxcubecore.HardwareObjects.abstract.sample_changer import Crims from mxcubecore.HardwareObjects.abstract.AbstractSampleChanger import ( SampleChanger, + SampleChangerMode, SampleChangerState, - SampleChangerMode ) +from mxcubecore.HardwareObjects.abstract.sample_changer import Crims from mxcubecore.HardwareObjects.abstract.sample_changer.Container import ( + Basket, Container, Sample, - Basket, ) diff --git a/mxcubecore/HardwareObjects/PyISPyBClient.py b/mxcubecore/HardwareObjects/PyISPyBClient.py index 648e71730b..966adc9cd2 100644 --- a/mxcubecore/HardwareObjects/PyISPyBClient.py +++ b/mxcubecore/HardwareObjects/PyISPyBClient.py @@ -2,42 +2,37 @@ A client for PyISPyB Webservices. """ -import os +import datetime import json import logging -import datetime - -from typing_extensions import Literal - -from mxcubecore.BaseHardwareObjects import HardwareObject -from mxcubecore import HardwareRepository as HWR -from mxcubecore.model.common import BeamlineParameters, ISPYBCollectionPrameters +import os import pyispyb_client - -from pyispyb_client.apis.tags import authentication_api -from pyispyb_client.model.login import Login - -from pyispyb_client.apis.tags import webservices_serial_crystallography_api -from pyispyb_client.apis.tags import serial_crystallography_api -from pyispyb_client.model.ssx_data_collection_create import ( - SSXDataCollectionCreate, +from pyispyb_client import Configuration +from pyispyb_client.apis.tags import ( + authentication_api, + serial_crystallography_api, + webservices_serial_crystallography_api, ) +from pyispyb_client.model.event_chain_create import EventChainCreate +from pyispyb_client.model.event_create import EventCreate +from pyispyb_client.model.login import Login +from pyispyb_client.model.ssx_crystal_create import SSXCrystalCreate +from pyispyb_client.model.ssx_data_collection_create import SSXDataCollectionCreate from pyispyb_client.model.ssx_data_collection_group_create import ( SSXDataCollectionGroupCreate, ) -from pyispyb_client.model.ssx_sample_create import SSXSampleCreate -from pyispyb_client.model.ssx_crystal_create import SSXCrystalCreate from pyispyb_client.model.ssx_protein_create import SSXProteinCreate -from pyispyb_client.model.ssx_sample_component_create import ( - SSXSampleComponentCreate, -) -from pyispyb_client.model.event_chain_create import EventChainCreate -from pyispyb_client.model.event_create import ( - EventCreate, -) +from pyispyb_client.model.ssx_sample_component_create import SSXSampleComponentCreate +from pyispyb_client.model.ssx_sample_create import SSXSampleCreate +from typing_extensions import Literal -from pyispyb_client import Configuration +from mxcubecore import HardwareRepository as HWR +from mxcubecore.BaseHardwareObjects import HardwareObject +from mxcubecore.model.common import ( + BeamlineParameters, + ISPYBCollectionPrameters, +) class PyISPyBClient(HardwareObject): diff --git a/mxcubecore/HardwareObjects/QtAxisCamera.py b/mxcubecore/HardwareObjects/QtAxisCamera.py index 84867fd23d..b0baea0d9a 100755 --- a/mxcubecore/HardwareObjects/QtAxisCamera.py +++ b/mxcubecore/HardwareObjects/QtAxisCamera.py @@ -17,20 +17,17 @@ # You should have received a copy of the GNU Lesser General Public License # along with MXCuBE. If not, see . -import time -import Image import base64 -import urllib2 +import time +import Image import numpy as np - +import urllib2 from cStringIO import StringIO from PIL.ImageQt import ImageQt +from mxcubecore.HardwareObjects.abstract.AbstractVideoDevice import AbstractVideoDevice from mxcubecore.utils import qt_import -from mxcubecore.HardwareObjects.abstract.AbstractVideoDevice import ( - AbstractVideoDevice, -) """ Hardare objects allows to access Axis camera jpg frames via direct http requests. diff --git a/mxcubecore/HardwareObjects/QtGraphicsLib.py b/mxcubecore/HardwareObjects/QtGraphicsLib.py index a3269b6535..313c271f71 100644 --- a/mxcubecore/HardwareObjects/QtGraphicsLib.py +++ b/mxcubecore/HardwareObjects/QtGraphicsLib.py @@ -43,16 +43,14 @@ """ import copy -import math import logging +import math from datetime import datetime -from mxcubecore.utils import qt_import - from mxcubecore.model import queue_model_objects +from mxcubecore.utils import qt_import from mxcubecore.utils.conversion import string_types - SELECTED_COLOR = qt_import.Qt.green NORMAL_COLOR = qt_import.Qt.yellow SOLID_LINE_STYLE = qt_import.Qt.SolidLine diff --git a/mxcubecore/HardwareObjects/QtGraphicsManager.py b/mxcubecore/HardwareObjects/QtGraphicsManager.py index 7c71c06779..01463a05de 100644 --- a/mxcubecore/HardwareObjects/QtGraphicsManager.py +++ b/mxcubecore/HardwareObjects/QtGraphicsManager.py @@ -37,24 +37,28 @@ """ from __future__ import print_function -import os -import math + import logging +import math +import os try: import cPickle as pickle except Exception: import _pickle as pickle -from datetime import datetime from copy import deepcopy +from datetime import datetime import gevent +import matplotlib.pyplot as plt import numpy as np -from scipy import ndimage, interpolate, signal - from matplotlib import cm -import matplotlib.pyplot as plt +from scipy import ( + interpolate, + ndimage, + signal, +) try: import lucid2 as lucid @@ -64,15 +68,11 @@ except ImportError: pass -from mxcubecore.utils import qt_import - -from mxcubecore.model import queue_model_objects -from mxcubecore.HardwareObjects import QtGraphicsLib as GraphicsLib -from mxcubecore.HardwareObjects.abstract.AbstractSampleView import ( - AbstractSampleView, -) - from mxcubecore import HardwareRepository as HWR +from mxcubecore.HardwareObjects import QtGraphicsLib as GraphicsLib +from mxcubecore.HardwareObjects.abstract.AbstractSampleView import AbstractSampleView +from mxcubecore.model import queue_model_objects +from mxcubecore.utils import qt_import __credits__ = ["MXCuBE collaboration"] __category__ = "Graphics" diff --git a/mxcubecore/HardwareObjects/QtInstanceServer.py b/mxcubecore/HardwareObjects/QtInstanceServer.py index aecff95be6..0b4510db8b 100644 --- a/mxcubecore/HardwareObjects/QtInstanceServer.py +++ b/mxcubecore/HardwareObjects/QtInstanceServer.py @@ -1,13 +1,14 @@ -from mxcubecore.BaseHardwareObjects import Procedure import logging -import time -import pickle import os +import pickle +import pwd +import socket +import time + import gevent import gevent.server -import socket -import pwd +from mxcubecore.BaseHardwareObjects import Procedure from mxcubecore.utils import qt_import """ diff --git a/mxcubecore/HardwareObjects/QtLimaVideo.py b/mxcubecore/HardwareObjects/QtLimaVideo.py index defee8e57f..6db19b27f8 100644 --- a/mxcubecore/HardwareObjects/QtLimaVideo.py +++ b/mxcubecore/HardwareObjects/QtLimaVideo.py @@ -45,9 +45,7 @@ """ import logging -from mxcubecore.HardwareObjects.abstract.AbstractVideoDevice import ( - AbstractVideoDevice, -) +from mxcubecore.HardwareObjects.abstract.AbstractVideoDevice import AbstractVideoDevice try: from Lima import Core diff --git a/mxcubecore/HardwareObjects/QtTangoLimaVideo.py b/mxcubecore/HardwareObjects/QtTangoLimaVideo.py index 9a2a59f12e..92ae80a778 100644 --- a/mxcubecore/HardwareObjects/QtTangoLimaVideo.py +++ b/mxcubecore/HardwareObjects/QtTangoLimaVideo.py @@ -41,13 +41,11 @@ """ import struct -import numpy as np +import numpy as np import PyTango -from mxcubecore.HardwareObjects.abstract.AbstractVideoDevice import ( - AbstractVideoDevice, -) +from mxcubecore.HardwareObjects.abstract.AbstractVideoDevice import AbstractVideoDevice class QtTangoLimaVideo(AbstractVideoDevice): diff --git a/mxcubecore/HardwareObjects/QueueManager.py b/mxcubecore/HardwareObjects/QueueManager.py index bf4dc51dcc..c7a4481602 100644 --- a/mxcubecore/HardwareObjects/QueueManager.py +++ b/mxcubecore/HardwareObjects/QueueManager.py @@ -9,13 +9,14 @@ """ import logging -import gevent import traceback +import gevent + from mxcubecore import queue_entry from mxcubecore.BaseHardwareObjects import HardwareObject -from mxcubecore.queue_entry.base_queue_entry import QUEUE_ENTRY_STATUS from mxcubecore.queue_entry import base_queue_entry +from mxcubecore.queue_entry.base_queue_entry import QUEUE_ENTRY_STATUS QueueEntryContainer = base_queue_entry.QueueEntryContainer diff --git a/mxcubecore/HardwareObjects/QueueModel.py b/mxcubecore/HardwareObjects/QueueModel.py index fc0691fdce..ccba096c45 100644 --- a/mxcubecore/HardwareObjects/QueueModel.py +++ b/mxcubecore/HardwareObjects/QueueModel.py @@ -26,15 +26,16 @@ handle several models by using register_model and select_model. """ -import os import json import logging +import os + import jsonpickle -from mxcubecore.BaseHardwareObjects import HardwareObject +from mxcubecore import HardwareRepository as HWR from mxcubecore import queue_entry +from mxcubecore.BaseHardwareObjects import HardwareObject from mxcubecore.model import queue_model_objects -from mxcubecore import HardwareRepository as HWR class Serializer(object): diff --git a/mxcubecore/HardwareObjects/RedisClient.py b/mxcubecore/HardwareObjects/RedisClient.py index e94b93cde5..584dd873c0 100644 --- a/mxcubecore/HardwareObjects/RedisClient.py +++ b/mxcubecore/HardwareObjects/RedisClient.py @@ -33,14 +33,14 @@ """ -import redis -import gevent import logging + +import gevent import jsonpickle +import redis -from mxcubecore.BaseHardwareObjects import HardwareObject from mxcubecore import HardwareRepository as HWR - +from mxcubecore.BaseHardwareObjects import HardwareObject __version__ = "2.3." __category__ = "General" diff --git a/mxcubecore/HardwareObjects/Resolution.py b/mxcubecore/HardwareObjects/Resolution.py index a3e77b18f3..aa929a0742 100644 --- a/mxcubecore/HardwareObjects/Resolution.py +++ b/mxcubecore/HardwareObjects/Resolution.py @@ -29,9 +29,7 @@ """ -from mxcubecore.HardwareObjects.abstract.AbstractResolution import ( - AbstractResolution, -) +from mxcubecore.HardwareObjects.abstract.AbstractResolution import AbstractResolution __copyright__ = """ Copyright © 2010-2020 by the MXCuBE collaboration """ __license__ = "LGPLv3+" diff --git a/mxcubecore/HardwareObjects/Robodiff.py b/mxcubecore/HardwareObjects/Robodiff.py index 878790f22b..034ceb11a8 100644 --- a/mxcubecore/HardwareObjects/Robodiff.py +++ b/mxcubecore/HardwareObjects/Robodiff.py @@ -1,3 +1,5 @@ +import gevent + from mxcubecore.HardwareObjects.abstract.AbstractSampleChanger import ( Container, Sample, @@ -7,7 +9,6 @@ task, time, ) -import gevent class Pin(Sample): diff --git a/mxcubecore/HardwareObjects/RobodiffLight.py b/mxcubecore/HardwareObjects/RobodiffLight.py index fe248b5e60..e97570529d 100644 --- a/mxcubecore/HardwareObjects/RobodiffLight.py +++ b/mxcubecore/HardwareObjects/RobodiffLight.py @@ -1,8 +1,10 @@ -from mxcubecore.BaseHardwareObjects import HardwareObject -from mxcubecore.HardwareObjects.abstract.AbstractMotor import AbstractMotor import time + import gevent +from mxcubecore.BaseHardwareObjects import HardwareObject +from mxcubecore.HardwareObjects.abstract.AbstractMotor import AbstractMotor + class RobodiffLight(Device, AbstractMotor): states = {0: "out", 1: "in"} diff --git a/mxcubecore/HardwareObjects/RobodiffMotor.py b/mxcubecore/HardwareObjects/RobodiffMotor.py index 38ac9b91b8..25d2bcb9be 100644 --- a/mxcubecore/HardwareObjects/RobodiffMotor.py +++ b/mxcubecore/HardwareObjects/RobodiffMotor.py @@ -1,7 +1,8 @@ -from mxcubecore.BaseHardwareObjects import HardwareObject -from mxcubecore import HardwareRepository as HWR import gevent +from mxcubecore import HardwareRepository as HWR +from mxcubecore.BaseHardwareObjects import HardwareObject + class RobodiffMotor(HardwareObject): (NOTINITIALIZED, UNUSABLE, READY, MOVESTARTED, MOVING, ONLIMIT) = (0, 1, 2, 3, 4, 5) diff --git a/mxcubecore/HardwareObjects/RobodiffMotorWPositions.py b/mxcubecore/HardwareObjects/RobodiffMotorWPositions.py index 6faf380d70..e869d81b68 100644 --- a/mxcubecore/HardwareObjects/RobodiffMotorWPositions.py +++ b/mxcubecore/HardwareObjects/RobodiffMotorWPositions.py @@ -1,6 +1,7 @@ -from mxcubecore.HardwareObjects.RobodiffMotor import RobodiffMotor import logging +from mxcubecore.HardwareObjects.RobodiffMotor import RobodiffMotor + class RobodiffMotorWPositions(RobodiffMotor): def __init__(self, name): diff --git a/mxcubecore/HardwareObjects/SC3.py b/mxcubecore/HardwareObjects/SC3.py index 723c2d003f..0ab9248348 100644 --- a/mxcubecore/HardwareObjects/SC3.py +++ b/mxcubecore/HardwareObjects/SC3.py @@ -1,3 +1,6 @@ +import xml.sax +from xml.sax.handler import ContentHandler + from mxcubecore.HardwareObjects.abstract.AbstractSampleChanger import ( Container, Sample, @@ -8,9 +11,6 @@ sys, ) -import xml.sax -from xml.sax.handler import ContentHandler - class Pin(Sample): def __init__(self, basket, basket_no, sample_no): diff --git a/mxcubecore/HardwareObjects/SOLEIL/PX1/PX1Attenuator.py b/mxcubecore/HardwareObjects/SOLEIL/PX1/PX1Attenuator.py index c59a436952..b9001b697e 100644 --- a/mxcubecore/HardwareObjects/SOLEIL/PX1/PX1Attenuator.py +++ b/mxcubecore/HardwareObjects/SOLEIL/PX1/PX1Attenuator.py @@ -1,4 +1,5 @@ import logging + from mxcubecore.BaseHardwareObjects import HardwareObject diff --git a/mxcubecore/HardwareObjects/SOLEIL/PX1/PX1CatsMaint.py b/mxcubecore/HardwareObjects/SOLEIL/PX1/PX1CatsMaint.py index 32bfde811f..f03c9b353d 100644 --- a/mxcubecore/HardwareObjects/SOLEIL/PX1/PX1CatsMaint.py +++ b/mxcubecore/HardwareObjects/SOLEIL/PX1/PX1CatsMaint.py @@ -1,10 +1,10 @@ # -from mxcubecore.HardwareObjects.CatsMaint import CatsMaint -from mxcubecore import HardwareRepository as HWR - import logging import time +from mxcubecore import HardwareRepository as HWR +from mxcubecore.HardwareObjects.CatsMaint import CatsMaint + class PX1CatsMaint(CatsMaint): def __init__(self, *args): diff --git a/mxcubecore/HardwareObjects/SOLEIL/PX1/PX1Collect.py b/mxcubecore/HardwareObjects/SOLEIL/PX1/PX1Collect.py index 5117a8160a..aee801cc40 100644 --- a/mxcubecore/HardwareObjects/SOLEIL/PX1/PX1Collect.py +++ b/mxcubecore/HardwareObjects/SOLEIL/PX1/PX1Collect.py @@ -3,23 +3,21 @@ """ +import logging import os +import socket +import subprocess import sys import time -import logging -import gevent -import subprocess -import socket - -from mxcubecore.Command.Tango import DeviceProxy - -from mxcubecore.TaskUtils import task -from mxcubecore.BaseHardwareObjects import HardwareObject -from mxcubecore.HardwareObjects.abstract.AbstractCollect import AbstractCollect +import gevent from SOLEILMergeImage import merge as merge_images from mxcubecore import HardwareRepository as HWR +from mxcubecore.BaseHardwareObjects import HardwareObject +from mxcubecore.Command.Tango import DeviceProxy +from mxcubecore.HardwareObjects.abstract.AbstractCollect import AbstractCollect +from mxcubecore.TaskUtils import task __author__ = "Vicente Rey Bakaikoa" __credits__ = ["MXCuBE collaboration"] diff --git a/mxcubecore/HardwareObjects/SOLEIL/PX1/PX1Cryotong.py b/mxcubecore/HardwareObjects/SOLEIL/PX1/PX1Cryotong.py index 4ca94295e5..da707cda9e 100644 --- a/mxcubecore/HardwareObjects/SOLEIL/PX1/PX1Cryotong.py +++ b/mxcubecore/HardwareObjects/SOLEIL/PX1/PX1Cryotong.py @@ -1,19 +1,18 @@ from __future__ import print_function + import logging -import gevent import time -from mxcubecore.Command.Tango import DeviceProxy - +import gevent +from PX1Environment import EnvironmentPhase +from mxcubecore.Command.Tango import DeviceProxy from mxcubecore.HardwareObjects.Cats90 import ( + BASKET_UNIPUCK, Cats90, SampleChangerState, - BASKET_UNIPUCK, ) -from PX1Environment import EnvironmentPhase - class PX1Cryotong(Cats90): diff --git a/mxcubecore/HardwareObjects/SOLEIL/PX1/PX1DetectorDistance.py b/mxcubecore/HardwareObjects/SOLEIL/PX1/PX1DetectorDistance.py index 4aecfef96d..8650a78be4 100644 --- a/mxcubecore/HardwareObjects/SOLEIL/PX1/PX1DetectorDistance.py +++ b/mxcubecore/HardwareObjects/SOLEIL/PX1/PX1DetectorDistance.py @@ -1,4 +1,5 @@ import time + import gevent from mxcubecore.BaseHardwareObjects import HardwareObject diff --git a/mxcubecore/HardwareObjects/SOLEIL/PX1/PX1Energy.py b/mxcubecore/HardwareObjects/SOLEIL/PX1/PX1Energy.py index 316f67682a..1f359f0b1e 100644 --- a/mxcubecore/HardwareObjects/SOLEIL/PX1/PX1Energy.py +++ b/mxcubecore/HardwareObjects/SOLEIL/PX1/PX1Energy.py @@ -1,14 +1,13 @@ # from qt import * -from mxcubecore.BaseHardwareObjects import HardwareObject -from mxcubecore.HardwareObjects.abstract.AbstractEnergy import AbstractEnergy - -from mxcubecore.Command.Tango import DeviceProxy - import logging import os import time +from mxcubecore.BaseHardwareObjects import HardwareObject +from mxcubecore.Command.Tango import DeviceProxy +from mxcubecore.HardwareObjects.abstract.AbstractEnergy import AbstractEnergy + class PX1Energy(Device, AbstractEnergy): diff --git a/mxcubecore/HardwareObjects/SOLEIL/PX1/PX1EnergyScan.py b/mxcubecore/HardwareObjects/SOLEIL/PX1/PX1EnergyScan.py index e1165a6770..69fc97d6bc 100644 --- a/mxcubecore/HardwareObjects/SOLEIL/PX1/PX1EnergyScan.py +++ b/mxcubecore/HardwareObjects/SOLEIL/PX1/PX1EnergyScan.py @@ -12,24 +12,25 @@ """ import logging -import os -import time import math -import numpy -import gevent +import os import subprocess +import time -from matplotlib.figure import Figure -from matplotlib.backends.backend_agg import FigureCanvasAgg - +import gevent +import numpy from AbstractEnergyScan import AbstractEnergyScan -from mxcubecore.TaskUtils import task, cleanup - +from matplotlib.backends.backend_agg import FigureCanvasAgg +from matplotlib.figure import Figure from xabs_lib import McMaster -from mxcubecore.Command.Tango import DeviceProxy -from mxcubecore.BaseHardwareObjects import HardwareObject from mxcubecore import HardwareRepository as HWR +from mxcubecore.BaseHardwareObjects import HardwareObject +from mxcubecore.Command.Tango import DeviceProxy +from mxcubecore.TaskUtils import ( + cleanup, + task, +) class PX1EnergyScan(AbstractEnergyScan, Equipment): diff --git a/mxcubecore/HardwareObjects/SOLEIL/PX1/PX1Environment.py b/mxcubecore/HardwareObjects/SOLEIL/PX1/PX1Environment.py index e190ebac01..9396d5245d 100644 --- a/mxcubecore/HardwareObjects/SOLEIL/PX1/PX1Environment.py +++ b/mxcubecore/HardwareObjects/SOLEIL/PX1/PX1Environment.py @@ -1,12 +1,12 @@ # -*- coding: utf-8 -*- -import time import logging -import gevent +import time -from mxcubecore.Command.Tango import DeviceProxy +import gevent from mxcubecore.BaseHardwareObjects import HardwareObject +from mxcubecore.Command.Tango import DeviceProxy from mxcubecore.TaskUtils import task diff --git a/mxcubecore/HardwareObjects/SOLEIL/PX1/PX1MiniDiff.py b/mxcubecore/HardwareObjects/SOLEIL/PX1/PX1MiniDiff.py index e300630547..e8a405b5b2 100644 --- a/mxcubecore/HardwareObjects/SOLEIL/PX1/PX1MiniDiff.py +++ b/mxcubecore/HardwareObjects/SOLEIL/PX1/PX1MiniDiff.py @@ -1,11 +1,10 @@ import logging -import gevent import time -from mxcubecore.HardwareObjects.GenericDiffractometer import ( - GenericDiffractometer, -) +import gevent + from mxcubecore.HardwareObjects import sample_centring +from mxcubecore.HardwareObjects.GenericDiffractometer import GenericDiffractometer class PX1MiniDiff(GenericDiffractometer): @@ -207,9 +206,7 @@ def move_motors(self, motor_positions, timeout=15): and target values. :type motors_dict: dict """ - from mxcubecore.model.queue_model_objects import ( - CentredPosition, - ) + from mxcubecore.model.queue_model_objects import CentredPosition if isinstance(motor_positions, CentredPosition): motor_positions_copy = motor_positions.as_dict() diff --git a/mxcubecore/HardwareObjects/SOLEIL/PX1/PX1Pilatus.py b/mxcubecore/HardwareObjects/SOLEIL/PX1/PX1Pilatus.py index e6a48deab1..c336843551 100644 --- a/mxcubecore/HardwareObjects/SOLEIL/PX1/PX1Pilatus.py +++ b/mxcubecore/HardwareObjects/SOLEIL/PX1/PX1Pilatus.py @@ -20,10 +20,8 @@ import logging import time -from mxcubecore.HardwareObjects.abstract.AbstractDetector import ( - AbstractDetector, -) from mxcubecore.BaseHardwareObjects import HardwareObject +from mxcubecore.HardwareObjects.abstract.AbstractDetector import AbstractDetector __author__ = "Vicente Rey" __credits__ = ["SOLEIL"] diff --git a/mxcubecore/HardwareObjects/SOLEIL/PX1/PX1Pss.py b/mxcubecore/HardwareObjects/SOLEIL/PX1/PX1Pss.py index 0e8759482c..deab63cb8a 100644 --- a/mxcubecore/HardwareObjects/SOLEIL/PX1/PX1Pss.py +++ b/mxcubecore/HardwareObjects/SOLEIL/PX1/PX1Pss.py @@ -1,5 +1,6 @@ # -*- coding: utf-8 -*- import logging + from mxcubecore.BaseHardwareObjects import HardwareObject diff --git a/mxcubecore/HardwareObjects/SOLEIL/PX1/PX1Resolution.py b/mxcubecore/HardwareObjects/SOLEIL/PX1/PX1Resolution.py index 3afb38f633..db12fbede5 100644 --- a/mxcubecore/HardwareObjects/SOLEIL/PX1/PX1Resolution.py +++ b/mxcubecore/HardwareObjects/SOLEIL/PX1/PX1Resolution.py @@ -1,10 +1,9 @@ -import math import logging +import math import time -from mxcubecore.Command.Tango import DeviceProxy - from mxcubecore.BaseHardwareObjects import HardwareObject +from mxcubecore.Command.Tango import DeviceProxy DETECTOR_DIAMETER = 424.0 diff --git a/mxcubecore/HardwareObjects/SOLEIL/PX1/PX1TangoLight.py b/mxcubecore/HardwareObjects/SOLEIL/PX1/PX1TangoLight.py index 7a0da6b2b4..4a2ff7a9a8 100644 --- a/mxcubecore/HardwareObjects/SOLEIL/PX1/PX1TangoLight.py +++ b/mxcubecore/HardwareObjects/SOLEIL/PX1/PX1TangoLight.py @@ -1,5 +1,6 @@ import logging import time + import gevent from mxcubecore.BaseHardwareObjects import HardwareObject diff --git a/mxcubecore/HardwareObjects/SOLEIL/PX2/PX2Attenuator.py b/mxcubecore/HardwareObjects/SOLEIL/PX2/PX2Attenuator.py index 034d9a0f97..bb893cf4d6 100644 --- a/mxcubecore/HardwareObjects/SOLEIL/PX2/PX2Attenuator.py +++ b/mxcubecore/HardwareObjects/SOLEIL/PX2/PX2Attenuator.py @@ -1,9 +1,10 @@ # -*- coding: utf-8 -*- # from SimpleDevice2c import SimpleDevice -from PyTango.gevent import DeviceProxy import logging import math +from PyTango.gevent import DeviceProxy + from mxcubecore.BaseHardwareObjects import HardwareObject # from Command.Tango import TangoChannel diff --git a/mxcubecore/HardwareObjects/SOLEIL/PX2/PX2BeamInfo.py b/mxcubecore/HardwareObjects/SOLEIL/PX2/PX2BeamInfo.py index 3bf732fc66..afae0df357 100644 --- a/mxcubecore/HardwareObjects/SOLEIL/PX2/PX2BeamInfo.py +++ b/mxcubecore/HardwareObjects/SOLEIL/PX2/PX2BeamInfo.py @@ -31,6 +31,7 @@ """ import logging + from mxcubecore.BaseHardwareObjects import HardwareObject diff --git a/mxcubecore/HardwareObjects/SOLEIL/PX2/PX2Collect.py b/mxcubecore/HardwareObjects/SOLEIL/PX2/PX2Collect.py index ca1d0da4fd..ceb5890655 100644 --- a/mxcubecore/HardwareObjects/SOLEIL/PX2/PX2Collect.py +++ b/mxcubecore/HardwareObjects/SOLEIL/PX2/PX2Collect.py @@ -16,28 +16,28 @@ # You should have received a copy of the GNU Lesser General Public License # along with MXCuBE. If not, see . -import os import logging -import gevent -from mxcubecore.TaskUtils import task -from mxcubecore.BaseHardwareObjects import HardwareObject -from mxcubecore.HardwareObjects.abstract.AbstractCollect import AbstractCollect +import os -from omega_scan import omega_scan -from inverse_scan import inverse_scan -from reference_images import reference_images -from helical_scan import helical_scan -from fluorescence_spectrum import fluorescence_spectrum +import gevent from energy_scan import energy_scan +from film import film +from fluorescence_spectrum import fluorescence_spectrum +from helical_scan import helical_scan +from inverse_scan import inverse_scan +from nested_helical_acquisition import nested_helical_acquisition +from omega_scan import omega_scan # from xray_centring import xray_centring from raster_scan import raster_scan -from nested_helical_acquisition import nested_helical_acquisition +from reference_images import reference_images +from slits import slits1 from tomography import tomography -from film import film -from mxcubecore import HardwareRepository as HWR -from slits import slits1 +from mxcubecore import HardwareRepository as HWR +from mxcubecore.BaseHardwareObjects import HardwareObject +from mxcubecore.HardwareObjects.abstract.AbstractCollect import AbstractCollect +from mxcubecore.TaskUtils import task __credits__ = ["Synchrotron SOLEIL"] __version__ = "2.3." diff --git a/mxcubecore/HardwareObjects/SOLEIL/PX2/PX2Diffractometer.py b/mxcubecore/HardwareObjects/SOLEIL/PX2/PX2Diffractometer.py index 7e2f0ee6ef..0d926361dd 100644 --- a/mxcubecore/HardwareObjects/SOLEIL/PX2/PX2Diffractometer.py +++ b/mxcubecore/HardwareObjects/SOLEIL/PX2/PX2Diffractometer.py @@ -17,30 +17,27 @@ # You should have received a copy of the GNU Lesser General Public License # along with MXCuBE. If not, see . +import copy +import datetime +import logging import os +import pickle import time -import logging import traceback -import pickle -import copy -import datetime -import h5py - -import numpy as np -from scipy.optimize import minimize from math import sqrt -import gevent - -from goniometer import goniometer -from detector import detector -from camera import camera - import beam_align -import scan_and_align +import gevent +import h5py +import numpy as np import optical_alignment - +import scan_and_align from anneal import anneal as anneal_procedure +from camera import camera +from detector import detector +from goniometer import goniometer +from scipy.optimize import minimize + from mxcubecore.model.queue_model_enumerables import CENTRING_METHOD try: @@ -62,12 +59,9 @@ "Could not find autocentring library, automatic centring is disabled" ) -from mxcubecore.HardwareObjects.GenericDiffractometer import ( - GenericDiffractometer, -) - -from mxcubecore.TaskUtils import task from mxcubecore import HardwareRepository as HWR +from mxcubecore.HardwareObjects.GenericDiffractometer import GenericDiffractometer +from mxcubecore.TaskUtils import task __credits__ = ["SOLEIL"] __version__ = "2.3." diff --git a/mxcubecore/HardwareObjects/SOLEIL/PX2/PX2Energy.py b/mxcubecore/HardwareObjects/SOLEIL/PX2/PX2Energy.py index d04ea889f3..7bf332f134 100644 --- a/mxcubecore/HardwareObjects/SOLEIL/PX2/PX2Energy.py +++ b/mxcubecore/HardwareObjects/SOLEIL/PX2/PX2Energy.py @@ -1,8 +1,16 @@ -from mxcubecore.HardwareObjects.mockup.EnergyMockup import EnergyMockup -from energy import energy -from scipy.constants import kilo, h, c, eV, angstrom import logging +from energy import energy +from scipy.constants import ( + angstrom, + c, + eV, + h, + kilo, +) + +from mxcubecore.HardwareObjects.mockup.EnergyMockup import EnergyMockup + class PX2Energy(EnergyMockup): def init(self): diff --git a/mxcubecore/HardwareObjects/SOLEIL/PX2/PX2Guillotine.py b/mxcubecore/HardwareObjects/SOLEIL/PX2/PX2Guillotine.py index 830e1993b0..d411825287 100644 --- a/mxcubecore/HardwareObjects/SOLEIL/PX2/PX2Guillotine.py +++ b/mxcubecore/HardwareObjects/SOLEIL/PX2/PX2Guillotine.py @@ -12,6 +12,7 @@ import logging import time + from mxcubecore import BaseHardwareObjects from mxcubecore import HardwareRepository as HWR diff --git a/mxcubecore/HardwareObjects/SOLEIL/PX2/PX2Qt4_LimaVideo.py b/mxcubecore/HardwareObjects/SOLEIL/PX2/PX2Qt4_LimaVideo.py index 7a617547a8..2f31a215e6 100644 --- a/mxcubecore/HardwareObjects/SOLEIL/PX2/PX2Qt4_LimaVideo.py +++ b/mxcubecore/HardwareObjects/SOLEIL/PX2/PX2Qt4_LimaVideo.py @@ -43,10 +43,10 @@ 30 """ -import os -import time import logging +import os import struct +import time from mxcubecore.HardwareObjects.QtLimaVideo import QtLimaVideo @@ -110,10 +110,10 @@ def set_exposure_time(self, exposure_time): def test_hwo(): - from mxcubecore.utils.qt_import import * import time from mxcubecore import HardwareRepository as HWR + from mxcubecore.utils.qt_import import * hwr = HWR.get_hardware_repository() hwr.connect() diff --git a/mxcubecore/HardwareObjects/SOLEIL/PX2/PX2Resolution.py b/mxcubecore/HardwareObjects/SOLEIL/PX2/PX2Resolution.py index c387c2e975..252a17280c 100644 --- a/mxcubecore/HardwareObjects/SOLEIL/PX2/PX2Resolution.py +++ b/mxcubecore/HardwareObjects/SOLEIL/PX2/PX2Resolution.py @@ -1,8 +1,10 @@ import logging -from mxcubecore.HardwareObjects.abstract.AbstractResolution import AbstractResolution -from mxcubecore import HardwareRepository as HWR -from resolution import resolution + from beam_center import beam_center +from resolution import resolution + +from mxcubecore import HardwareRepository as HWR +from mxcubecore.HardwareObjects.abstract.AbstractResolution import AbstractResolution class PX2Resolution(AbstractResolution): diff --git a/mxcubecore/HardwareObjects/SOLEIL/PX2/PX2Video.py b/mxcubecore/HardwareObjects/SOLEIL/PX2/PX2Video.py index 768e2168cc..7b7bcaeab3 100644 --- a/mxcubecore/HardwareObjects/SOLEIL/PX2/PX2Video.py +++ b/mxcubecore/HardwareObjects/SOLEIL/PX2/PX2Video.py @@ -40,17 +40,20 @@ """ +import logging import os +import struct import time + import gevent -import logging -import struct import numpy as np - -from GenericVideoDevice import GenericVideoDevice from camera import camera +from GenericVideoDevice import GenericVideoDevice -from mxcubecore.utils.qt_import import QImage, QPixmap +from mxcubecore.utils.qt_import import ( + QImage, + QPixmap, +) class PX2Video(GenericVideoDevice, camera): diff --git a/mxcubecore/HardwareObjects/SOLEIL/SOLEILCatsMaint.py b/mxcubecore/HardwareObjects/SOLEIL/SOLEILCatsMaint.py index 39e9749cce..728e324edc 100644 --- a/mxcubecore/HardwareObjects/SOLEIL/SOLEILCatsMaint.py +++ b/mxcubecore/HardwareObjects/SOLEIL/SOLEILCatsMaint.py @@ -6,11 +6,13 @@ """ import logging -from mxcubecore.TaskUtils import task -from mxcubecore.BaseHardwareObjects import HardwareObject -import gevent import time +import gevent + +from mxcubecore.BaseHardwareObjects import HardwareObject +from mxcubecore.TaskUtils import task + __author__ = "Michael Hellmig" __credits__ = ["The MxCuBE collaboration"] diff --git a/mxcubecore/HardwareObjects/SOLEIL/SOLEILEnergyScan.py b/mxcubecore/HardwareObjects/SOLEIL/SOLEILEnergyScan.py index b0f0ed0d98..a59e0097ae 100644 --- a/mxcubecore/HardwareObjects/SOLEIL/SOLEILEnergyScan.py +++ b/mxcubecore/HardwareObjects/SOLEIL/SOLEILEnergyScan.py @@ -1,17 +1,17 @@ import logging -import PyChooch +import math import os import time -import math + import gevent +import PyChooch import Xane - -from matplotlib.figure import Figure from matplotlib.backends.backend_agg import FigureCanvasAgg +from matplotlib.figure import Figure +from mxcubecore import HardwareRepository as HWR from mxcubecore.BaseHardwareObjects import HardwareObject from mxcubecore.TaskUtils import cleanup -from mxcubecore import HardwareRepository as HWR class SOLEILEnergyScan(HardwareObject): diff --git a/mxcubecore/HardwareObjects/SOLEIL/SOLEILFlux.py b/mxcubecore/HardwareObjects/SOLEIL/SOLEILFlux.py index 2a59362d20..59102dd5cf 100644 --- a/mxcubecore/HardwareObjects/SOLEIL/SOLEILFlux.py +++ b/mxcubecore/HardwareObjects/SOLEIL/SOLEILFlux.py @@ -1,6 +1,7 @@ +import PyTango + from mxcubecore import HardwareRepository as HWR from mxcubecore.BaseHardwareObjects import HardwareObject -import PyTango class SOLEILFlux(HardwareObject): diff --git a/mxcubecore/HardwareObjects/SOLEIL/SOLEILGuillotine.py b/mxcubecore/HardwareObjects/SOLEIL/SOLEILGuillotine.py index 700ec7bb2e..c8a5a36191 100644 --- a/mxcubecore/HardwareObjects/SOLEIL/SOLEILGuillotine.py +++ b/mxcubecore/HardwareObjects/SOLEIL/SOLEILGuillotine.py @@ -10,9 +10,10 @@ """ -from mxcubecore import BaseHardwareObjects import logging import time + +from mxcubecore import BaseHardwareObjects from mxcubecore import HardwareRepository as HWR diff --git a/mxcubecore/HardwareObjects/SOLEIL/SOLEILISPyBClient.py b/mxcubecore/HardwareObjects/SOLEIL/SOLEILISPyBClient.py index a701c4a579..945fa551c3 100644 --- a/mxcubecore/HardwareObjects/SOLEIL/SOLEILISPyBClient.py +++ b/mxcubecore/HardwareObjects/SOLEIL/SOLEILISPyBClient.py @@ -1,14 +1,17 @@ import logging -import urllib2 import os -from cookielib import CookieJar +import traceback +from collections import namedtuple -from suds.transport.http import HttpAuthenticated +import urllib2 +from cookielib import CookieJar +from ISPyBClient import ( + _CONNECTION_ERROR_MSG, + ISPyBClient, +) from suds.client import Client +from suds.transport.http import HttpAuthenticated -from ISPyBClient import ISPyBClient, _CONNECTION_ERROR_MSG -import traceback -from collections import namedtuple from mxcubecore import HardwareRepository as HWR # The WSDL root is configured in the hardware object XML file. diff --git a/mxcubecore/HardwareObjects/SOLEIL/SOLEILMachineInfo.py b/mxcubecore/HardwareObjects/SOLEIL/SOLEILMachineInfo.py index f4948556b2..d25021292d 100644 --- a/mxcubecore/HardwareObjects/SOLEIL/SOLEILMachineInfo.py +++ b/mxcubecore/HardwareObjects/SOLEIL/SOLEILMachineInfo.py @@ -59,14 +59,18 @@ 'discSizeGB': 20} """ +import logging import os import time -import logging +from datetime import ( + datetime, + timedelta, +) + from gevent import spawn from urllib2 import urlopen -from datetime import datetime, timedelta -from mxcubecore.BaseHardwareObjects import HardwareObject +from mxcubecore.BaseHardwareObjects import HardwareObject __credits__ = ["SOLEIL", "EMBL Hamburg"] __version__ = "2.3." diff --git a/mxcubecore/HardwareObjects/SOLEIL/SOLEILPss.py b/mxcubecore/HardwareObjects/SOLEIL/SOLEILPss.py index a7b3df9ff2..998fbad8c3 100644 --- a/mxcubecore/HardwareObjects/SOLEIL/SOLEILPss.py +++ b/mxcubecore/HardwareObjects/SOLEIL/SOLEILPss.py @@ -1,9 +1,11 @@ # -*- coding: utf-8 -*- import logging import time -from mxcubecore.BaseHardwareObjects import HardwareObject + from PyTango import DeviceProxy +from mxcubecore.BaseHardwareObjects import HardwareObject + """Complex means we are not using SimpleDevice""" diff --git a/mxcubecore/HardwareObjects/SOLEIL/SOLEILRuche.py b/mxcubecore/HardwareObjects/SOLEIL/SOLEILRuche.py index 830164ecf8..2a0847eb57 100644 --- a/mxcubecore/HardwareObjects/SOLEIL/SOLEILRuche.py +++ b/mxcubecore/HardwareObjects/SOLEIL/SOLEILRuche.py @@ -1,8 +1,9 @@ +import logging import os import time -import logging -from mxcubecore.BaseHardwareObjects import HardwareObject + from mxcubecore import HardwareRepository as HWR +from mxcubecore.BaseHardwareObjects import HardwareObject class SOLEILRuche(HardwareObject): diff --git a/mxcubecore/HardwareObjects/SOLEIL/SOLEILSafetyShutter.py b/mxcubecore/HardwareObjects/SOLEIL/SOLEILSafetyShutter.py index 7a60eca910..4abbed7f25 100644 --- a/mxcubecore/HardwareObjects/SOLEIL/SOLEILSafetyShutter.py +++ b/mxcubecore/HardwareObjects/SOLEIL/SOLEILSafetyShutter.py @@ -1,7 +1,7 @@ -from mxcubecore.BaseHardwareObjects import HardwareObject - import logging +from mxcubecore.BaseHardwareObjects import HardwareObject + class SOLEILSafetyShutter(HardwareObject): def __init__(self, name): diff --git a/mxcubecore/HardwareObjects/SOLEIL/SOLEILSession.py b/mxcubecore/HardwareObjects/SOLEIL/SOLEILSession.py index 3d3345b0e7..2bd4b19c5e 100644 --- a/mxcubecore/HardwareObjects/SOLEIL/SOLEILSession.py +++ b/mxcubecore/HardwareObjects/SOLEIL/SOLEILSession.py @@ -1,8 +1,9 @@ +import logging import os import time -import logging import Session + from mxcubecore import HardwareRepository as HWR diff --git a/mxcubecore/HardwareObjects/SOLEIL/SOLEILqueue_entry.py b/mxcubecore/HardwareObjects/SOLEIL/SOLEILqueue_entry.py index ebfc90dff3..42fdbebc3a 100644 --- a/mxcubecore/HardwareObjects/SOLEIL/SOLEILqueue_entry.py +++ b/mxcubecore/HardwareObjects/SOLEIL/SOLEILqueue_entry.py @@ -1,5 +1,5 @@ -from mxcubecore.queue_entry import * from mxcubecore.model import queue_model_objects +from mxcubecore.queue_entry import * class PX2DataCollectionQueueEntry(DataCollectionQueueEntry): diff --git a/mxcubecore/HardwareObjects/SOLEIL/TangoDCMotor.py b/mxcubecore/HardwareObjects/SOLEIL/TangoDCMotor.py index c4c1ae3c8f..079059b558 100644 --- a/mxcubecore/HardwareObjects/SOLEIL/TangoDCMotor.py +++ b/mxcubecore/HardwareObjects/SOLEIL/TangoDCMotor.py @@ -1,16 +1,13 @@ -from mxcubecore import HardwareRepository as HWR - import logging + import gevent +import numpy +from PyQt4.QtGui import QApplication +from PyTango import DeviceProxy +from mxcubecore import HardwareRepository as HWR from mxcubecore.BaseHardwareObjects import HardwareObject from mxcubecore.Command.Tango import TangoCommand - -from PyTango import DeviceProxy - -from PyQt4.QtGui import QApplication - -import numpy from mxcubecore.HardwareObjects.abstract.AbstractMotor import MotorStates diff --git a/mxcubecore/HardwareObjects/SampleView.py b/mxcubecore/HardwareObjects/SampleView.py index d6ab601489..5bd31fe56b 100644 --- a/mxcubecore/HardwareObjects/SampleView.py +++ b/mxcubecore/HardwareObjects/SampleView.py @@ -23,13 +23,9 @@ import copy from functools import reduce -from mxcubecore.model import queue_model_objects - -from mxcubecore.HardwareObjects.abstract.AbstractSampleView import ( - AbstractSampleView, -) - from mxcubecore import HardwareRepository as HWR +from mxcubecore.HardwareObjects.abstract.AbstractSampleView import AbstractSampleView +from mxcubecore.model import queue_model_objects class SampleView(AbstractSampleView): diff --git a/mxcubecore/HardwareObjects/SardanaMotor.py b/mxcubecore/HardwareObjects/SardanaMotor.py index 2b8c44bf15..efbb5fbcb3 100644 --- a/mxcubecore/HardwareObjects/SardanaMotor.py +++ b/mxcubecore/HardwareObjects/SardanaMotor.py @@ -1,10 +1,15 @@ +import enum import logging import time -import enum -from mxcubecore.HardwareObjects.abstract.AbstractMotor import AbstractMotor -from mxcubecore.BaseHardwareObjects import HardwareObject, HardwareObjectState + from gevent import Timeout +from mxcubecore.BaseHardwareObjects import ( + HardwareObject, + HardwareObjectState, +) +from mxcubecore.HardwareObjects.abstract.AbstractMotor import AbstractMotor + """ Interfaces Sardana Motor objects. taurusname is the only obligatory property. diff --git a/mxcubecore/HardwareObjects/Session.py b/mxcubecore/HardwareObjects/Session.py index 4dec423be4..b9d6676ac1 100644 --- a/mxcubecore/HardwareObjects/Session.py +++ b/mxcubecore/HardwareObjects/Session.py @@ -6,13 +6,12 @@ """ import os -import time import socket +import time +from typing import Tuple from mxcubecore.BaseHardwareObjects import HardwareObject from mxcubecore.model.queue_model_objects import PathTemplate -from typing import Tuple - default_raw_data_folder = "RAW_DATA" default_processed_data_folder = "PROCESSED_DATA" diff --git a/mxcubecore/HardwareObjects/SimpleHTML.py b/mxcubecore/HardwareObjects/SimpleHTML.py index 22dcab81f1..12abd68dc0 100644 --- a/mxcubecore/HardwareObjects/SimpleHTML.py +++ b/mxcubecore/HardwareObjects/SimpleHTML.py @@ -1,5 +1,6 @@ -import json import base64 +import json + from PIL import Image HTML_START = """ diff --git a/mxcubecore/HardwareObjects/SpecMotor.py b/mxcubecore/HardwareObjects/SpecMotor.py index 1717d5a937..412ee2c904 100644 --- a/mxcubecore/HardwareObjects/SpecMotor.py +++ b/mxcubecore/HardwareObjects/SpecMotor.py @@ -1,6 +1,7 @@ -from mxcubecore.BaseHardwareObjects import HardwareObject from SpecClient_gevent.SpecMotor import SpecMotorA +from mxcubecore.BaseHardwareObjects import HardwareObject + class SpecMotor(HardwareObject, SpecMotorA): (NOTINITIALIZED, UNUSABLE, READY, MOVESTARTED, MOVING, ONLIMIT) = (0, 1, 2, 3, 4, 5) diff --git a/mxcubecore/HardwareObjects/SpecMotorWPositions.py b/mxcubecore/HardwareObjects/SpecMotorWPositions.py index 03b864f166..770c9f9f9d 100644 --- a/mxcubecore/HardwareObjects/SpecMotorWPositions.py +++ b/mxcubecore/HardwareObjects/SpecMotorWPositions.py @@ -1,6 +1,7 @@ -from mxcubecore.HardwareObjects import SpecMotor import logging +from mxcubecore.HardwareObjects import SpecMotor + class SpecMotorWPositions(SpecMotor.SpecMotor): def init(self): diff --git a/mxcubecore/HardwareObjects/SpecScan.py b/mxcubecore/HardwareObjects/SpecScan.py index a11be727b2..050ffc813e 100644 --- a/mxcubecore/HardwareObjects/SpecScan.py +++ b/mxcubecore/HardwareObjects/SpecScan.py @@ -1,6 +1,8 @@ try: - from SpecClient_gevent import SpecEventsDispatcher - from SpecClient_gevent import SpecConnectionsManager + from SpecClient_gevent import ( + SpecConnectionsManager, + SpecEventsDispatcher, + ) except ImportError: from SpecClient import SpecEventsDispatcher from SpecClient import SpecConnectionsManager diff --git a/mxcubecore/HardwareObjects/SpecShell.py b/mxcubecore/HardwareObjects/SpecShell.py index c4fe5c876f..01aa6ca1f9 100644 --- a/mxcubecore/HardwareObjects/SpecShell.py +++ b/mxcubecore/HardwareObjects/SpecShell.py @@ -7,6 +7,7 @@ """ import logging + from mxcubecore.BaseHardwareObjects import HardwareObject try: @@ -14,7 +15,10 @@ except ImportError: import SpecClient -from qt import PYSIGNAL, QObject +from qt import ( + PYSIGNAL, + QObject, +) class SpecOutputVar(QObject, SpecClient.SpecVariable.SpecVariableA): diff --git a/mxcubecore/HardwareObjects/SpecState.py b/mxcubecore/HardwareObjects/SpecState.py index bf1d1128e9..cf848feef0 100644 --- a/mxcubecore/HardwareObjects/SpecState.py +++ b/mxcubecore/HardwareObjects/SpecState.py @@ -7,6 +7,7 @@ """ import logging + from mxcubecore.BaseHardwareObjects import Procedure try: diff --git a/mxcubecore/HardwareObjects/StateMachine.py b/mxcubecore/HardwareObjects/StateMachine.py index b81bdbfbc5..7d45dbe6d2 100644 --- a/mxcubecore/HardwareObjects/StateMachine.py +++ b/mxcubecore/HardwareObjects/StateMachine.py @@ -17,14 +17,13 @@ # You should have received a copy of the GNU Lesser General Public License # along with MXCuBE. If not, see . -import time -import yaml import logging - +import time from datetime import datetime -from mxcubecore.BaseHardwareObjects import HardwareObject +import yaml +from mxcubecore.BaseHardwareObjects import HardwareObject __author__ = "EMBL Hamburg" __credits__ = ["MXCuBE collaboration"] diff --git a/mxcubecore/HardwareObjects/TangoLimaMpegVideo.py b/mxcubecore/HardwareObjects/TangoLimaMpegVideo.py index 2c47d5da16..1f8191f340 100644 --- a/mxcubecore/HardwareObjects/TangoLimaMpegVideo.py +++ b/mxcubecore/HardwareObjects/TangoLimaMpegVideo.py @@ -16,6 +16,7 @@ import os import subprocess import uuid + import psutil from mxcubecore.HardwareObjects.TangoLimaVideo import TangoLimaVideo diff --git a/mxcubecore/HardwareObjects/TangoLimaVideo.py b/mxcubecore/HardwareObjects/TangoLimaVideo.py index 439212cf68..9be8283c1d 100755 --- a/mxcubecore/HardwareObjects/TangoLimaVideo.py +++ b/mxcubecore/HardwareObjects/TangoLimaVideo.py @@ -13,16 +13,16 @@ If video mode is not specified, BAYER_RG16 is used by default. """ +import io import logging -import time import struct -import numpy +import time + import gevent +import gipc +import numpy import PyTango from PIL import Image -import io -import gipc - from PyTango.gevent import DeviceProxy from mxcubecore import BaseHardwareObjects diff --git a/mxcubecore/HardwareObjects/TangoLimaVideoDevice.py b/mxcubecore/HardwareObjects/TangoLimaVideoDevice.py index cb03a6d9b7..dd6092cda8 100644 --- a/mxcubecore/HardwareObjects/TangoLimaVideoDevice.py +++ b/mxcubecore/HardwareObjects/TangoLimaVideoDevice.py @@ -63,9 +63,10 @@ """ from __future__ import print_function + import struct -import numpy as np +import numpy as np import PyTango from mxcubecore.HardwareObjects.abstract.AbstractVideoDevice import AbstractVideoDevice diff --git a/mxcubecore/HardwareObjects/TangoLimaVideoLoopback.py b/mxcubecore/HardwareObjects/TangoLimaVideoLoopback.py index 583c88196c..6dd85319ec 100644 --- a/mxcubecore/HardwareObjects/TangoLimaVideoLoopback.py +++ b/mxcubecore/HardwareObjects/TangoLimaVideoLoopback.py @@ -13,17 +13,21 @@ If video mode is not specified, BAYER_RG16 is used by default. """ +import fcntl import logging -import v4l2 -import gipc import os -import fcntl import subprocess import time import uuid + import gevent +import gipc +import v4l2 -from mxcubecore.HardwareObjects.TangoLimaVideo import TangoLimaVideo, poll_image +from mxcubecore.HardwareObjects.TangoLimaVideo import ( + TangoLimaVideo, + poll_image, +) def _poll_image(sleep_time, video_device, device_uri, video_mode, formats): diff --git a/mxcubecore/HardwareObjects/TangoMachineInfo.py b/mxcubecore/HardwareObjects/TangoMachineInfo.py index 6c1a74490d..e62021ffa9 100644 --- a/mxcubecore/HardwareObjects/TangoMachineInfo.py +++ b/mxcubecore/HardwareObjects/TangoMachineInfo.py @@ -30,9 +30,8 @@ """ import logging -from mxcubecore.HardwareObjects.abstract.AbstractMachineInfo import ( - AbstractMachineInfo, -) + +from mxcubecore.HardwareObjects.abstract.AbstractMachineInfo import AbstractMachineInfo __copyright__ = """ Copyright © by the MXCuBE collaboration """ __license__ = "LGPLv3+" diff --git a/mxcubecore/HardwareObjects/TangoMotor.py b/mxcubecore/HardwareObjects/TangoMotor.py index 97ddb3bf95..73ea920bfc 100644 --- a/mxcubecore/HardwareObjects/TangoMotor.py +++ b/mxcubecore/HardwareObjects/TangoMotor.py @@ -20,10 +20,10 @@ TangoMotor class defines motor in the Tango control system (used and tested in DESY/P11 """ -from mxcubecore.HardwareObjects.abstract.AbstractMotor import AbstractMotor - import gevent +from mxcubecore.HardwareObjects.abstract.AbstractMotor import AbstractMotor + __credits__ = ["DESY P11"] __license__ = "LGPLv3+" __category__ = "Motor" diff --git a/mxcubecore/HardwareObjects/TangoShutter.py b/mxcubecore/HardwareObjects/TangoShutter.py index 5f85abe05a..1fc378d1da 100644 --- a/mxcubecore/HardwareObjects/TangoShutter.py +++ b/mxcubecore/HardwareObjects/TangoShutter.py @@ -39,9 +39,13 @@ are all covered by the TangoShuter class conventional states. """ import json -from enum import Enum, unique -from mxcubecore.HardwareObjects.abstract.AbstractShutter import AbstractShutter +from enum import ( + Enum, + unique, +) + from mxcubecore.BaseHardwareObjects import HardwareObjectState +from mxcubecore.HardwareObjects.abstract.AbstractShutter import AbstractShutter __copyright__ = """ Copyright © 2023 by the MXCuBE collaboration """ __license__ = "LGPLv3+" diff --git a/mxcubecore/HardwareObjects/Transmission.py b/mxcubecore/HardwareObjects/Transmission.py index 51bd50a027..62c4183ee0 100644 --- a/mxcubecore/HardwareObjects/Transmission.py +++ b/mxcubecore/HardwareObjects/Transmission.py @@ -1,6 +1,7 @@ from PyTransmission import matt_control -from mxcubecore.BaseHardwareObjects import HardwareObject + from mxcubecore import HardwareRepository as HWR +from mxcubecore.BaseHardwareObjects import HardwareObject class Transmission(HardwareObject): diff --git a/mxcubecore/HardwareObjects/UnitTest.py b/mxcubecore/HardwareObjects/UnitTest.py index f1e8744e5f..8c20abd91c 100644 --- a/mxcubecore/HardwareObjects/UnitTest.py +++ b/mxcubecore/HardwareObjects/UnitTest.py @@ -18,8 +18,9 @@ # along with MXCuBE. If not, see . -import unittest import logging +import unittest + from mxcubecore.BaseHardwareObjects import HardwareObject BEAMLINE = None diff --git a/mxcubecore/HardwareObjects/VaporyVideo.py b/mxcubecore/HardwareObjects/VaporyVideo.py index d09445d4ff..f4ea8a98ea 100755 --- a/mxcubecore/HardwareObjects/VaporyVideo.py +++ b/mxcubecore/HardwareObjects/VaporyVideo.py @@ -20,11 +20,13 @@ """ import time + import gevent import vapory -from mxcubecore.utils.qt_import import QImage + from mxcubecore import BaseHardwareObjects from mxcubecore.HardwareObjects.Camera import JpegType +from mxcubecore.utils.qt_import import QImage class VaporyVideo(BaseHardwareObjects.HardwareObject): diff --git a/mxcubecore/HardwareObjects/VimbaVideo.py b/mxcubecore/HardwareObjects/VimbaVideo.py index 08baa5d882..d49161dc3d 100644 --- a/mxcubecore/HardwareObjects/VimbaVideo.py +++ b/mxcubecore/HardwareObjects/VimbaVideo.py @@ -1,5 +1,6 @@ -import time import atexit +import time + import numpy as np from pymba import Vimba @@ -8,13 +9,14 @@ except ImportError: pass -from mxcubecore.utils.qt_import import QImage, QPixmap -from mxcubecore.HardwareObjects.abstract.AbstractVideoDevice import ( - AbstractVideoDevice, -) - from abstract.AbstractVideoDevice import AbstractVideoDevice +from mxcubecore.HardwareObjects.abstract.AbstractVideoDevice import AbstractVideoDevice +from mxcubecore.utils.qt_import import ( + QImage, + QPixmap, +) + class VimbaVideo(AbstractVideoDevice): def __init__(self, name): diff --git a/mxcubecore/HardwareObjects/XMLRPCServer.py b/mxcubecore/HardwareObjects/XMLRPCServer.py index 6da1b41d42..6f3ef7d295 100644 --- a/mxcubecore/HardwareObjects/XMLRPCServer.py +++ b/mxcubecore/HardwareObjects/XMLRPCServer.py @@ -5,25 +5,25 @@ configuration XML for more information. """ +import atexit +import inspect +import json import logging -import sys import os -import shutil -import inspect import pkgutil -import types +import shutil import socket +import sys import time +import types import xml -import json -import atexit -import jsonpickle - from functools import reduce + import gevent +import jsonpickle -from mxcubecore.BaseHardwareObjects import HardwareObject from mxcubecore import HardwareRepository as HWR +from mxcubecore.BaseHardwareObjects import HardwareObject from mxcubecore.HardwareObjects.SecureXMLRpcRequestHandler import ( SecureXMLRpcRequestHandler, ) diff --git a/mxcubecore/HardwareObjects/XRFSpectrum.py b/mxcubecore/HardwareObjects/XRFSpectrum.py index 046a126afb..fc53f3beea 100644 --- a/mxcubecore/HardwareObjects/XRFSpectrum.py +++ b/mxcubecore/HardwareObjects/XRFSpectrum.py @@ -2,8 +2,10 @@ import os import shutil import time -import gevent.event + import gevent +import gevent.event + from mxcubecore import HardwareRepository as HWR from mxcubecore.BaseHardwareObjects import HardwareObject diff --git a/mxcubecore/HardwareObjects/XSDataAutoprocv1_0.py b/mxcubecore/HardwareObjects/XSDataAutoprocv1_0.py index 45b9a891f4..88a5dedc84 100644 --- a/mxcubecore/HardwareObjects/XSDataAutoprocv1_0.py +++ b/mxcubecore/HardwareObjects/XSDataAutoprocv1_0.py @@ -4,19 +4,23 @@ # Generated Tue Oct 14 03:54::11 2014 by EDGenerateDS. # -from XSDataCommon import XSDataVectorDouble -from XSDataCommon import XSDataString -from XSDataCommon import XSDataResult -from XSDataCommon import XSDataInteger -from XSDataCommon import XSDataInput -from XSDataCommon import XSDataFile -from XSDataCommon import XSDataDouble -from XSDataCommon import XSDataBoolean import os import sys -from xml.dom import minidom -from xml.dom import Node - +from xml.dom import ( + Node, + minidom, +) + +from XSDataCommon import ( + XSDataBoolean, + XSDataDouble, + XSDataFile, + XSDataInput, + XSDataInteger, + XSDataResult, + XSDataString, + XSDataVectorDouble, +) strEdnaHome = os.environ.get("EDNA_HOME", None) @@ -32,14 +36,16 @@ } try: - from XSDataCommon import XSDataBoolean - from XSDataCommon import XSDataDouble - from XSDataCommon import XSDataFile - from XSDataCommon import XSDataInput - from XSDataCommon import XSDataInteger - from XSDataCommon import XSDataResult - from XSDataCommon import XSDataString - from XSDataCommon import XSDataVectorDouble + from XSDataCommon import ( + XSDataBoolean, + XSDataDouble, + XSDataFile, + XSDataInput, + XSDataInteger, + XSDataResult, + XSDataString, + XSDataVectorDouble, + ) except ImportError as error: if strEdnaHome is not None: for strXsdName in dictLocation: diff --git a/mxcubecore/HardwareObjects/XSDataCommon.py b/mxcubecore/HardwareObjects/XSDataCommon.py index 22c4e0681e..0852e5bffd 100644 --- a/mxcubecore/HardwareObjects/XSDataCommon.py +++ b/mxcubecore/HardwareObjects/XSDataCommon.py @@ -5,9 +5,10 @@ # import sys -from xml.dom import minidom -from xml.dom import Node - +from xml.dom import ( + Node, + minidom, +) # # Support/utility functions. diff --git a/mxcubecore/HardwareObjects/XSDataControlDozorv1_1.py b/mxcubecore/HardwareObjects/XSDataControlDozorv1_1.py index f1a7a993ba..0faf100fd7 100644 --- a/mxcubecore/HardwareObjects/XSDataControlDozorv1_1.py +++ b/mxcubecore/HardwareObjects/XSDataControlDozorv1_1.py @@ -4,18 +4,22 @@ # Generated Fri Feb 20 04:42::27 2015 by EDGenerateDS. # -from XSDataCommon import XSDataString -from XSDataCommon import XSDataResult -from XSDataCommon import XSDataInteger -from XSDataCommon import XSDataInput -from XSDataCommon import XSDataFile -from XSDataCommon import XSDataDouble -from XSDataCommon import XSDataBoolean import os import sys -from xml.dom import minidom -from xml.dom import Node - +from xml.dom import ( + Node, + minidom, +) + +from XSDataCommon import ( + XSDataBoolean, + XSDataDouble, + XSDataFile, + XSDataInput, + XSDataInteger, + XSDataResult, + XSDataString, +) strEdnaHome = os.environ.get("EDNA_HOME", None) @@ -30,13 +34,15 @@ } try: - from XSDataCommon import XSDataBoolean - from XSDataCommon import XSDataDouble - from XSDataCommon import XSDataFile - from XSDataCommon import XSDataInput - from XSDataCommon import XSDataInteger - from XSDataCommon import XSDataResult - from XSDataCommon import XSDataString + from XSDataCommon import ( + XSDataBoolean, + XSDataDouble, + XSDataFile, + XSDataInput, + XSDataInteger, + XSDataResult, + XSDataString, + ) except ImportError as error: if strEdnaHome is not None: for strXsdName in dictLocation: diff --git a/mxcubecore/HardwareObjects/XSDataMXCuBEv1_3.py b/mxcubecore/HardwareObjects/XSDataMXCuBEv1_3.py index fa5b75a921..5d12e827f3 100644 --- a/mxcubecore/HardwareObjects/XSDataMXCuBEv1_3.py +++ b/mxcubecore/HardwareObjects/XSDataMXCuBEv1_3.py @@ -4,24 +4,30 @@ # Generated Mon May 14 10:32::39 2012 by EDGenerateDS. # -from XSDataMXv1 import XSDataSampleCrystalMM -from XSDataMXv1 import XSDataResultCharacterisation -from XSDataMXv1 import XSDataInputCharacterisation -from XSDataMXv1 import XSDataExperimentalCondition -from XSDataMXv1 import XSDataDiffractionPlan -from XSDataMXv1 import XSDataCollectionPlan -from XSDataCommon import XSDataString -from XSDataCommon import XSDataResult -from XSDataCommon import XSDataInteger -from XSDataCommon import XSDataInput -from XSDataCommon import XSDataFile -from XSDataCommon import XSDataDictionary -from XSDataCommon import XSData import os import sys -from xml.dom import minidom -from xml.dom import Node - +from xml.dom import ( + Node, + minidom, +) + +from XSDataCommon import ( + XSData, + XSDataDictionary, + XSDataFile, + XSDataInput, + XSDataInteger, + XSDataResult, + XSDataString, +) +from XSDataMXv1 import ( + XSDataCollectionPlan, + XSDataDiffractionPlan, + XSDataExperimentalCondition, + XSDataInputCharacterisation, + XSDataResultCharacterisation, + XSDataSampleCrystalMM, +) strEdnaHome = os.environ.get("EDNA_HOME", None) @@ -42,19 +48,23 @@ } try: - from XSDataCommon import XSData - from XSDataCommon import XSDataDictionary - from XSDataCommon import XSDataFile - from XSDataCommon import XSDataInput - from XSDataCommon import XSDataInteger - from XSDataCommon import XSDataResult - from XSDataCommon import XSDataString - from XSDataMXv1 import XSDataCollectionPlan - from XSDataMXv1 import XSDataDiffractionPlan - from XSDataMXv1 import XSDataExperimentalCondition - from XSDataMXv1 import XSDataInputCharacterisation - from XSDataMXv1 import XSDataResultCharacterisation - from XSDataMXv1 import XSDataSampleCrystalMM + from XSDataCommon import ( + XSData, + XSDataDictionary, + XSDataFile, + XSDataInput, + XSDataInteger, + XSDataResult, + XSDataString, + ) + from XSDataMXv1 import ( + XSDataCollectionPlan, + XSDataDiffractionPlan, + XSDataExperimentalCondition, + XSDataInputCharacterisation, + XSDataResultCharacterisation, + XSDataSampleCrystalMM, + ) except ImportError as error: if strEdnaHome is not None: for strXsdName in dictLocation: diff --git a/mxcubecore/HardwareObjects/XSDataMXCuBEv1_4.py b/mxcubecore/HardwareObjects/XSDataMXCuBEv1_4.py index 350ad4d9f1..8ddcffbbff 100644 --- a/mxcubecore/HardwareObjects/XSDataMXCuBEv1_4.py +++ b/mxcubecore/HardwareObjects/XSDataMXCuBEv1_4.py @@ -4,10 +4,12 @@ # Generated Thu Feb 9 10:58::29 2023 by EDGenerateDS. # -import os, sys -from xml.dom import minidom -from xml.dom import Node - +import os +import sys +from xml.dom import ( + Node, + minidom, +) strEdnaHome = os.environ.get("EDNA_HOME", None) @@ -30,21 +32,25 @@ } try: - from XSDataCommon import XSData - from XSDataCommon import XSDataDictionary - from XSDataCommon import XSDataDouble - from XSDataCommon import XSDataFile - from XSDataCommon import XSDataInput - from XSDataCommon import XSDataInteger - from XSDataCommon import XSDataResult - from XSDataCommon import XSDataString - from XSDataMXv1 import XSDataCollectionPlan - from XSDataMXv1 import XSDataDiffractionPlan - from XSDataMXv1 import XSDataExperimentalCondition - from XSDataCommon import XSDataImage - from XSDataMXv1 import XSDataInputCharacterisation - from XSDataMXv1 import XSDataResultCharacterisation - from XSDataMXv1 import XSDataSampleCrystalMM + from XSDataCommon import ( + XSData, + XSDataDictionary, + XSDataDouble, + XSDataFile, + XSDataImage, + XSDataInput, + XSDataInteger, + XSDataResult, + XSDataString, + ) + from XSDataMXv1 import ( + XSDataCollectionPlan, + XSDataDiffractionPlan, + XSDataExperimentalCondition, + XSDataInputCharacterisation, + XSDataResultCharacterisation, + XSDataSampleCrystalMM, + ) except ImportError as error: if strEdnaHome is not None: for strXsdName in dictLocation: @@ -57,24 +63,25 @@ sys.path.append(strRoot) else: raise error -from XSDataCommon import XSData -from XSDataCommon import XSDataDictionary -from XSDataCommon import XSDataDouble -from XSDataCommon import XSDataFile -from XSDataCommon import XSDataInput -from XSDataCommon import XSDataInteger -from XSDataCommon import XSDataResult -from XSDataCommon import XSDataString -from XSDataMXv1 import XSDataCollectionPlan -from XSDataMXv1 import XSDataDiffractionPlan -from XSDataMXv1 import XSDataExperimentalCondition -from XSDataCommon import XSDataImage -from XSDataMXv1 import XSDataInputCharacterisation -from XSDataMXv1 import XSDataResultCharacterisation -from XSDataMXv1 import XSDataSampleCrystalMM - - - +from XSDataCommon import ( + XSData, + XSDataDictionary, + XSDataDouble, + XSDataFile, + XSDataImage, + XSDataInput, + XSDataInteger, + XSDataResult, + XSDataString, +) +from XSDataMXv1 import ( + XSDataCollectionPlan, + XSDataDiffractionPlan, + XSDataExperimentalCondition, + XSDataInputCharacterisation, + XSDataResultCharacterisation, + XSDataSampleCrystalMM, +) # # Support/utility functions. diff --git a/mxcubecore/HardwareObjects/XSDataMXv1.py b/mxcubecore/HardwareObjects/XSDataMXv1.py index 22bd6f2794..4aecddeef9 100644 --- a/mxcubecore/HardwareObjects/XSDataMXv1.py +++ b/mxcubecore/HardwareObjects/XSDataMXv1.py @@ -4,10 +4,12 @@ # Generated Tue Mar 28 09:42::39 2023 by EDGenerateDS. # -import os, sys -from xml.dom import minidom -from xml.dom import Node - +import os +import sys +from xml.dom import ( + Node, + minidom, +) strEdnaHome = os.environ.get("EDNA_HOME", None) @@ -35,26 +37,28 @@ } try: - from XSDataCommon import XSData - from XSDataCommon import XSDataBoolean - from XSDataCommon import XSDataDouble - from XSDataCommon import XSDataFile - from XSDataCommon import XSDataFloat - from XSDataCommon import XSDataInput - from XSDataCommon import XSDataInteger - from XSDataCommon import XSDataMatrixDouble - from XSDataCommon import XSDataResult - from XSDataCommon import XSDataSize - from XSDataCommon import XSDataString - from XSDataCommon import XSDataVectorDouble - from XSDataCommon import XSDataImage - from XSDataCommon import XSDataAbsorbedDoseRate - from XSDataCommon import XSDataAngularSpeed - from XSDataCommon import XSDataFlux - from XSDataCommon import XSDataLength - from XSDataCommon import XSDataTime - from XSDataCommon import XSDataWavelength - from XSDataCommon import XSDataAngle + from XSDataCommon import ( + XSData, + XSDataAbsorbedDoseRate, + XSDataAngle, + XSDataAngularSpeed, + XSDataBoolean, + XSDataDouble, + XSDataFile, + XSDataFloat, + XSDataFlux, + XSDataImage, + XSDataInput, + XSDataInteger, + XSDataLength, + XSDataMatrixDouble, + XSDataResult, + XSDataSize, + XSDataString, + XSDataTime, + XSDataVectorDouble, + XSDataWavelength, + ) except ImportError as error: if strEdnaHome is not None: for strXsdName in dictLocation: @@ -67,29 +71,28 @@ sys.path.append(strRoot) else: raise error -from XSDataCommon import XSData -from XSDataCommon import XSDataBoolean -from XSDataCommon import XSDataDouble -from XSDataCommon import XSDataFile -from XSDataCommon import XSDataFloat -from XSDataCommon import XSDataInput -from XSDataCommon import XSDataInteger -from XSDataCommon import XSDataMatrixDouble -from XSDataCommon import XSDataResult -from XSDataCommon import XSDataSize -from XSDataCommon import XSDataString -from XSDataCommon import XSDataVectorDouble -from XSDataCommon import XSDataImage -from XSDataCommon import XSDataAbsorbedDoseRate -from XSDataCommon import XSDataAngularSpeed -from XSDataCommon import XSDataFlux -from XSDataCommon import XSDataLength -from XSDataCommon import XSDataTime -from XSDataCommon import XSDataWavelength -from XSDataCommon import XSDataAngle - - - +from XSDataCommon import ( + XSData, + XSDataAbsorbedDoseRate, + XSDataAngle, + XSDataAngularSpeed, + XSDataBoolean, + XSDataDouble, + XSDataFile, + XSDataFloat, + XSDataFlux, + XSDataImage, + XSDataInput, + XSDataInteger, + XSDataLength, + XSDataMatrixDouble, + XSDataResult, + XSDataSize, + XSDataString, + XSDataTime, + XSDataVectorDouble, + XSDataWavelength, +) # # Support/utility functions. diff --git a/mxcubecore/HardwareObjects/abstract/AbstractActuator.py b/mxcubecore/HardwareObjects/abstract/AbstractActuator.py index 56cdbb7054..81657ac3ab 100644 --- a/mxcubecore/HardwareObjects/abstract/AbstractActuator.py +++ b/mxcubecore/HardwareObjects/abstract/AbstractActuator.py @@ -31,7 +31,6 @@ from mxcubecore.BaseHardwareObjects import HardwareObject - __copyright__ = """ Copyright © 2010-2022 by the MXCuBE collaboration """ __license__ = "LGPLv3+" diff --git a/mxcubecore/HardwareObjects/abstract/AbstractAperture.py b/mxcubecore/HardwareObjects/abstract/AbstractAperture.py index 52f0feb436..5193ecc4a6 100644 --- a/mxcubecore/HardwareObjects/abstract/AbstractAperture.py +++ b/mxcubecore/HardwareObjects/abstract/AbstractAperture.py @@ -23,7 +23,6 @@ from mxcubecore.BaseHardwareObjects import HardwareObject - __copyright__ = """ Copyright © 2010-2022 by the MXCuBE collaboration """ __license__ = "LGPLv3+" diff --git a/mxcubecore/HardwareObjects/abstract/AbstractAuthenticator.py b/mxcubecore/HardwareObjects/abstract/AbstractAuthenticator.py index 5f4a438e3a..9b4ef52766 100644 --- a/mxcubecore/HardwareObjects/abstract/AbstractAuthenticator.py +++ b/mxcubecore/HardwareObjects/abstract/AbstractAuthenticator.py @@ -20,6 +20,7 @@ import abc + from mxcubecore.BaseHardwareObjects import HardwareObject __copyright__ = """ Copyright © 2010- 2022 by the MXCuBE collaboration """ diff --git a/mxcubecore/HardwareObjects/abstract/AbstractBeam.py b/mxcubecore/HardwareObjects/abstract/AbstractBeam.py index 999bafb2e6..5d7c0ed2c2 100644 --- a/mxcubecore/HardwareObjects/abstract/AbstractBeam.py +++ b/mxcubecore/HardwareObjects/abstract/AbstractBeam.py @@ -32,8 +32,11 @@ import abc import sys +from enum import ( + Enum, + unique, +) from warnings import warn -from enum import Enum, unique from mxcubecore.BaseHardwareObjects import HardwareObject diff --git a/mxcubecore/HardwareObjects/abstract/AbstractCharacterisation.py b/mxcubecore/HardwareObjects/abstract/AbstractCharacterisation.py index 319356723d..08f31d4168 100644 --- a/mxcubecore/HardwareObjects/abstract/AbstractCharacterisation.py +++ b/mxcubecore/HardwareObjects/abstract/AbstractCharacterisation.py @@ -26,6 +26,7 @@ """ import abc + import gevent.event from mxcubecore.BaseHardwareObjects import HardwareObject diff --git a/mxcubecore/HardwareObjects/abstract/AbstractCollect.py b/mxcubecore/HardwareObjects/abstract/AbstractCollect.py index 2dc2b90c9e..cc92eae71e 100644 --- a/mxcubecore/HardwareObjects/abstract/AbstractCollect.py +++ b/mxcubecore/HardwareObjects/abstract/AbstractCollect.py @@ -23,18 +23,19 @@ Defines a sequence how data collection is executed. """ -import os -import logging -import time -import errno import abc import collections +import errno +import logging +import os +import time + import gevent import gevent.event -from mxcubecore.TaskUtils import task -from mxcubecore.BaseHardwareObjects import HardwareObject -from mxcubecore import HardwareRepository as HWR +from mxcubecore import HardwareRepository as HWR +from mxcubecore.BaseHardwareObjects import HardwareObject +from mxcubecore.TaskUtils import task __credits__ = ["MXCuBE collaboration"] diff --git a/mxcubecore/HardwareObjects/abstract/AbstractDetector.py b/mxcubecore/HardwareObjects/abstract/AbstractDetector.py index 11dc3bafce..fe87069355 100644 --- a/mxcubecore/HardwareObjects/abstract/AbstractDetector.py +++ b/mxcubecore/HardwareObjects/abstract/AbstractDetector.py @@ -49,8 +49,8 @@ """ import abc -import math import ast +import math from mxcubecore import HardwareRepository as HWR from mxcubecore.BaseHardwareObjects import HardwareObject diff --git a/mxcubecore/HardwareObjects/abstract/AbstractEnergy.py b/mxcubecore/HardwareObjects/abstract/AbstractEnergy.py index 8630f3f977..37ce9fb3e3 100644 --- a/mxcubecore/HardwareObjects/abstract/AbstractEnergy.py +++ b/mxcubecore/HardwareObjects/abstract/AbstractEnergy.py @@ -25,8 +25,9 @@ """ import abc -from mxcubecore.utils.conversion import HC_OVER_E + from mxcubecore.HardwareObjects.abstract.AbstractActuator import AbstractActuator +from mxcubecore.utils.conversion import HC_OVER_E __copyright__ = """ Copyright © 2010-2020 by the MXCuBE collaboration """ __license__ = "LGPLv3+" diff --git a/mxcubecore/HardwareObjects/abstract/AbstractEnergyScan.py b/mxcubecore/HardwareObjects/abstract/AbstractEnergyScan.py index a7fde87c6e..5f419cc686 100644 --- a/mxcubecore/HardwareObjects/abstract/AbstractEnergyScan.py +++ b/mxcubecore/HardwareObjects/abstract/AbstractEnergyScan.py @@ -1,10 +1,12 @@ -import os -import time import abc import logging +import os +import time + import gevent -from mxcubecore.TaskUtils import error_cleanup + from mxcubecore.BaseHardwareObjects import HardwareObject +from mxcubecore.TaskUtils import error_cleanup class AbstractEnergyScan(HardwareObject): diff --git a/mxcubecore/HardwareObjects/abstract/AbstractFlux.py b/mxcubecore/HardwareObjects/abstract/AbstractFlux.py index 7ef5473740..6cb0ee6322 100644 --- a/mxcubecore/HardwareObjects/abstract/AbstractFlux.py +++ b/mxcubecore/HardwareObjects/abstract/AbstractFlux.py @@ -22,9 +22,8 @@ """ from scipy.interpolate import interp1d -from mxcubecore.HardwareObjects.abstract.AbstractActuator import AbstractActuator - from mxcubecore import HardwareRepository as HWR +from mxcubecore.HardwareObjects.abstract.AbstractActuator import AbstractActuator __copyright__ = """ Copyright © 2010-2022 by the MXCuBE collaboration """ __license__ = "LGPLv3+" diff --git a/mxcubecore/HardwareObjects/abstract/AbstractMCA.py b/mxcubecore/HardwareObjects/abstract/AbstractMCA.py index 08ed911d18..ab49b773cb 100644 --- a/mxcubecore/HardwareObjects/abstract/AbstractMCA.py +++ b/mxcubecore/HardwareObjects/abstract/AbstractMCA.py @@ -1,5 +1,6 @@ import abc from warnings import warn + from mxcubecore.TaskUtils import task diff --git a/mxcubecore/HardwareObjects/abstract/AbstractMachineInfo.py b/mxcubecore/HardwareObjects/abstract/AbstractMachineInfo.py index c49c35e44e..eb65db741f 100644 --- a/mxcubecore/HardwareObjects/abstract/AbstractMachineInfo.py +++ b/mxcubecore/HardwareObjects/abstract/AbstractMachineInfo.py @@ -21,6 +21,7 @@ import abc from ast import literal_eval + from mxcubecore.BaseHardwareObjects import HardwareObject __copyright__ = """ Copyright © by the MXCuBE collaboration """ diff --git a/mxcubecore/HardwareObjects/abstract/AbstractMotor.py b/mxcubecore/HardwareObjects/abstract/AbstractMotor.py index 443fce394c..2a6cad88ce 100644 --- a/mxcubecore/HardwareObjects/abstract/AbstractMotor.py +++ b/mxcubecore/HardwareObjects/abstract/AbstractMotor.py @@ -25,12 +25,13 @@ """ import abc -from enum import Enum, unique +from enum import ( + Enum, + unique, +) from mxcubecore.BaseHardwareObjects import HardwareObjectState -from mxcubecore.HardwareObjects.abstract.AbstractActuator import ( - AbstractActuator, -) +from mxcubecore.HardwareObjects.abstract.AbstractActuator import AbstractActuator __copyright__ = """ Copyright © 2010-2020 by the MXCuBE collaboration """ __license__ = "LGPLv3+" diff --git a/mxcubecore/HardwareObjects/abstract/AbstractMultiCollect.py b/mxcubecore/HardwareObjects/abstract/AbstractMultiCollect.py index 378fd12970..4c09206911 100644 --- a/mxcubecore/HardwareObjects/abstract/AbstractMultiCollect.py +++ b/mxcubecore/HardwareObjects/abstract/AbstractMultiCollect.py @@ -1,18 +1,23 @@ -import os -import sys +import abc +import collections +import errno # import types import logging +import os +import socket +import sys import time -import errno -import abc -import collections + import autoprocessing import gevent -import socket -from mxcubecore.TaskUtils import task, cleanup, error_cleanup from mxcubecore import HardwareRepository as HWR +from mxcubecore.TaskUtils import ( + cleanup, + error_cleanup, + task, +) BeamlineControl = collections.namedtuple( "BeamlineControl", diff --git a/mxcubecore/HardwareObjects/abstract/AbstractNState.py b/mxcubecore/HardwareObjects/abstract/AbstractNState.py index 2cf3d4c550..a43078fb80 100644 --- a/mxcubecore/HardwareObjects/abstract/AbstractNState.py +++ b/mxcubecore/HardwareObjects/abstract/AbstractNState.py @@ -24,9 +24,12 @@ import abc import ast -from enum import Enum, unique -from mxcubecore.HardwareObjects.abstract.AbstractActuator import AbstractActuator +from enum import ( + Enum, + unique, +) +from mxcubecore.HardwareObjects.abstract.AbstractActuator import AbstractActuator __copyright__ = """ Copyright © 2010-2022 by the MXCuBE collaboration """ __license__ = "LGPLv3+" diff --git a/mxcubecore/HardwareObjects/abstract/AbstractOnlineProcessing.py b/mxcubecore/HardwareObjects/abstract/AbstractOnlineProcessing.py index ce061784c1..44be947348 100644 --- a/mxcubecore/HardwareObjects/abstract/AbstractOnlineProcessing.py +++ b/mxcubecore/HardwareObjects/abstract/AbstractOnlineProcessing.py @@ -17,25 +17,23 @@ # along with MXCuBE. If not, see . """Abstract Online Processing class """ -import os -import time -import logging import json +import logging +import os import subprocess - +import time from copy import copy -from scipy import ndimage -from scipy.interpolate import UnivariateSpline -import matplotlib.pyplot as plt -from mpl_toolkits.axes_grid1 import make_axes_locatable -import numpy as np import gevent - +import matplotlib.pyplot as plt +import numpy as np import SimpleHTML -from mxcubecore.BaseHardwareObjects import HardwareObject -from mxcubecore import HardwareRepository as HWR +from mpl_toolkits.axes_grid1 import make_axes_locatable +from scipy import ndimage +from scipy.interpolate import UnivariateSpline +from mxcubecore import HardwareRepository as HWR +from mxcubecore.BaseHardwareObjects import HardwareObject __copyright__ = """ Copyright © 2010-2022 by the MXCuBE collaboration """ __license__ = "LGPLv3+" diff --git a/mxcubecore/HardwareObjects/abstract/AbstractProcedure.py b/mxcubecore/HardwareObjects/abstract/AbstractProcedure.py index 6e6f00081c..a582a2803f 100644 --- a/mxcubecore/HardwareObjects/abstract/AbstractProcedure.py +++ b/mxcubecore/HardwareObjects/abstract/AbstractProcedure.py @@ -17,9 +17,16 @@ # You should have received a copy of the GNU Lesser General Public License # along with MXCuBE. If not, see . import logging -from enum import IntEnum, unique +from enum import ( + IntEnum, + unique, +) import gevent.event +from jsonschema import ( + ValidationError, + validate, +) from mxcubecore.BaseHardwareObjects import ConfiguredObject from mxcubecore.dispatcher import dispatcher @@ -30,8 +37,6 @@ # https://json-schema.org/ # https://github.com/Julian/jsonschema -from jsonschema import validate, ValidationError - __credits__ = ["MXCuBE collaboration"] diff --git a/mxcubecore/HardwareObjects/abstract/AbstractResolution.py b/mxcubecore/HardwareObjects/abstract/AbstractResolution.py index 40bdbfc0e2..8c9cdd1c2c 100644 --- a/mxcubecore/HardwareObjects/abstract/AbstractResolution.py +++ b/mxcubecore/HardwareObjects/abstract/AbstractResolution.py @@ -29,7 +29,13 @@ import abc import logging -from math import asin, atan, sin, tan +from math import ( + asin, + atan, + sin, + tan, +) + from mxcubecore import HardwareRepository as HWR from mxcubecore.HardwareObjects.abstract.AbstractMotor import AbstractMotor diff --git a/mxcubecore/HardwareObjects/abstract/AbstractSampleChanger.py b/mxcubecore/HardwareObjects/abstract/AbstractSampleChanger.py index ed2655393e..7a7a66bf64 100644 --- a/mxcubecore/HardwareObjects/abstract/AbstractSampleChanger.py +++ b/mxcubecore/HardwareObjects/abstract/AbstractSampleChanger.py @@ -127,11 +127,14 @@ import abc import logging -from gevent import sleep, Timeout +from gevent import ( + Timeout, + sleep, +) -from mxcubecore.TaskUtils import task as dtask from mxcubecore.BaseHardwareObjects import HardwareObject from mxcubecore.HardwareObjects.abstract.sample_changer.Container import Container +from mxcubecore.TaskUtils import task as dtask class SampleChangerState: diff --git a/mxcubecore/HardwareObjects/abstract/AbstractShutter.py b/mxcubecore/HardwareObjects/abstract/AbstractShutter.py index 973b0b459f..5c1de55974 100644 --- a/mxcubecore/HardwareObjects/abstract/AbstractShutter.py +++ b/mxcubecore/HardwareObjects/abstract/AbstractShutter.py @@ -23,7 +23,11 @@ """ import abc -from enum import Enum, unique +from enum import ( + Enum, + unique, +) + from mxcubecore.HardwareObjects.abstract.AbstractNState import AbstractNState __copyright__ = """ Copyright 2016-2023 by the MXCuBE collaboration """ diff --git a/mxcubecore/HardwareObjects/abstract/AbstractSlits.py b/mxcubecore/HardwareObjects/abstract/AbstractSlits.py index ae357aa344..52eed56aa6 100644 --- a/mxcubecore/HardwareObjects/abstract/AbstractSlits.py +++ b/mxcubecore/HardwareObjects/abstract/AbstractSlits.py @@ -21,8 +21,8 @@ """ import abc from warnings import warn -from mxcubecore.BaseHardwareObjects import HardwareObject +from mxcubecore.BaseHardwareObjects import HardwareObject __credits__ = ["MXCuBE collaboration"] __version__ = "2.3" diff --git a/mxcubecore/HardwareObjects/abstract/AbstractTransmission.py b/mxcubecore/HardwareObjects/abstract/AbstractTransmission.py index 29c714905d..a1bab489f7 100644 --- a/mxcubecore/HardwareObjects/abstract/AbstractTransmission.py +++ b/mxcubecore/HardwareObjects/abstract/AbstractTransmission.py @@ -23,8 +23,8 @@ """ import abc -from mxcubecore.HardwareObjects.abstract.AbstractActuator import AbstractActuator +from mxcubecore.HardwareObjects.abstract.AbstractActuator import AbstractActuator __copyright__ = """ Copyright © 2010- 2022 by the MXCuBE collaboration """ __license__ = "LGPLv3+" diff --git a/mxcubecore/HardwareObjects/abstract/AbstractVideoDevice.py b/mxcubecore/HardwareObjects/abstract/AbstractVideoDevice.py index c1af323b5f..df32f1264a 100644 --- a/mxcubecore/HardwareObjects/abstract/AbstractVideoDevice.py +++ b/mxcubecore/HardwareObjects/abstract/AbstractVideoDevice.py @@ -29,14 +29,15 @@ """ import abc +import logging import os import sys import time -import logging +import warnings from io import BytesIO + import gevent import numpy as np -import warnings try: import cv2 @@ -45,12 +46,15 @@ from mxcubecore.BaseHardwareObjects import HardwareObject - module_names = ["qt", "PyQt5", "PyQt4"] if any(mod in sys.modules for mod in module_names): USEQT = True - from mxcubecore.utils.qt_import import QPixmap, QImage, QSize + from mxcubecore.utils.qt_import import ( + QImage, + QPixmap, + QSize, + ) else: USEQT = False from PIL import Image diff --git a/mxcubecore/HardwareObjects/abstract/AbstractXRFSpectrum.py b/mxcubecore/HardwareObjects/abstract/AbstractXRFSpectrum.py index b8c8d99304..ce36e0cb31 100644 --- a/mxcubecore/HardwareObjects/abstract/AbstractXRFSpectrum.py +++ b/mxcubecore/HardwareObjects/abstract/AbstractXRFSpectrum.py @@ -24,9 +24,11 @@ import logging import os import time + import gevent -from mxcubecore.BaseHardwareObjects import HardwareObject + from mxcubecore import HardwareRepository as HWR +from mxcubecore.BaseHardwareObjects import HardwareObject __copyright__ = """ Copyright © by the MXCuBE collaboration """ __license__ = "LGPLv3+" diff --git a/mxcubecore/HardwareObjects/abstract/AbstractXrayCentring.py b/mxcubecore/HardwareObjects/abstract/AbstractXrayCentring.py index 967ae9a97c..ac484c5652 100644 --- a/mxcubecore/HardwareObjects/abstract/AbstractXrayCentring.py +++ b/mxcubecore/HardwareObjects/abstract/AbstractXrayCentring.py @@ -18,8 +18,12 @@ """Xray Centring Abstract Class with yaml configuration file. """ -from __future__ import division, absolute_import -from __future__ import print_function, unicode_literals +from __future__ import ( + absolute_import, + division, + print_function, + unicode_literals, +) __copyright__ = """ Copyright © 2016 - 2022 by MXCuBE Collaboration """ __license__ = "LGPLv3+" @@ -28,8 +32,8 @@ import abc -from mxcubecore.BaseHardwareObjects import HardwareObjectYaml from mxcubecore import HardwareRepository as HWR +from mxcubecore.BaseHardwareObjects import HardwareObjectYaml from mxcubecore.model import queue_model_objects diff --git a/mxcubecore/HardwareObjects/abstract/sample_changer/Crims.py b/mxcubecore/HardwareObjects/abstract/sample_changer/Crims.py index e2d82c9747..9ae97a35cf 100644 --- a/mxcubecore/HardwareObjects/abstract/sample_changer/Crims.py +++ b/mxcubecore/HardwareObjects/abstract/sample_changer/Crims.py @@ -1,10 +1,9 @@ +import urllib import xml.etree.cElementTree as et +from io import BytesIO import requests from PIL import Image -from io import BytesIO - -import urllib def get_image(url): diff --git a/mxcubecore/HardwareObjects/abstract/sample_changer/Sample.py b/mxcubecore/HardwareObjects/abstract/sample_changer/Sample.py index 99babb0a10..5f84d61af2 100644 --- a/mxcubecore/HardwareObjects/abstract/sample_changer/Sample.py +++ b/mxcubecore/HardwareObjects/abstract/sample_changer/Sample.py @@ -1,4 +1,5 @@ import sys + from .Component import Component try: diff --git a/mxcubecore/HardwareObjects/autoprocessing.py b/mxcubecore/HardwareObjects/autoprocessing.py index fc08024552..9f4de19bcc 100755 --- a/mxcubecore/HardwareObjects/autoprocessing.py +++ b/mxcubecore/HardwareObjects/autoprocessing.py @@ -1,5 +1,5 @@ -import os import logging +import os import subprocess diff --git a/mxcubecore/HardwareObjects/mockup/ActuatorMockup.py b/mxcubecore/HardwareObjects/mockup/ActuatorMockup.py index ac7badd63a..61c99ee2a5 100644 --- a/mxcubecore/HardwareObjects/mockup/ActuatorMockup.py +++ b/mxcubecore/HardwareObjects/mockup/ActuatorMockup.py @@ -26,9 +26,11 @@ e.g. class MotorMockup(ActuatorMockup, AbstractMotor): """ -import time import random +import time + import gevent + from mxcubecore.HardwareObjects.abstract import AbstractActuator __copyright__ = """ Copyright © 2010-2020 by the MXCuBE collaboration """ diff --git a/mxcubecore/HardwareObjects/mockup/ApertureMockup.py b/mxcubecore/HardwareObjects/mockup/ApertureMockup.py index ac21240fb0..f297c4b58f 100644 --- a/mxcubecore/HardwareObjects/mockup/ApertureMockup.py +++ b/mxcubecore/HardwareObjects/mockup/ApertureMockup.py @@ -29,6 +29,7 @@ """ from enum import Enum + from mxcubecore.HardwareObjects.abstract.AbstractNState import AbstractNState from mxcubecore.HardwareObjects.mockup.ActuatorMockup import ActuatorMockup diff --git a/mxcubecore/HardwareObjects/mockup/BIOMAXEigerMockup.py b/mxcubecore/HardwareObjects/mockup/BIOMAXEigerMockup.py index d4c4519024..bec548d493 100644 --- a/mxcubecore/HardwareObjects/mockup/BIOMAXEigerMockup.py +++ b/mxcubecore/HardwareObjects/mockup/BIOMAXEigerMockup.py @@ -20,13 +20,18 @@ """ -import gevent -import time import logging +import time + +import gevent from mxcubecore import HardwareRepository as HWR -from mxcubecore.TaskUtils import task, cleanup, error_cleanup from mxcubecore.BaseHardwareObjects import HardwareObject +from mxcubecore.TaskUtils import ( + cleanup, + error_cleanup, + task, +) class BIOMAXEigerMockup(HardwareObject): diff --git a/mxcubecore/HardwareObjects/mockup/BeamDefinerMockup.py b/mxcubecore/HardwareObjects/mockup/BeamDefinerMockup.py index 24764ccbac..11a931c290 100644 --- a/mxcubecore/HardwareObjects/mockup/BeamDefinerMockup.py +++ b/mxcubecore/HardwareObjects/mockup/BeamDefinerMockup.py @@ -37,8 +37,9 @@ __copyright__ = """ Copyright © by the MXCuBE collaboration """ __license__ = "LGPLv3+" -import time import random +import time + from mxcubecore.HardwareObjects.abstract.AbstractNState import AbstractNState from mxcubecore.HardwareObjects.mockup.ActuatorMockup import ActuatorMockup diff --git a/mxcubecore/HardwareObjects/mockup/BeamlineActionsMockup.py b/mxcubecore/HardwareObjects/mockup/BeamlineActionsMockup.py index 4e19e8e9fc..c3211a9668 100644 --- a/mxcubecore/HardwareObjects/mockup/BeamlineActionsMockup.py +++ b/mxcubecore/HardwareObjects/mockup/BeamlineActionsMockup.py @@ -1,14 +1,17 @@ +import logging + +import gevent +from pydantic.v1 import ( + BaseModel, + Field, +) from typing_extensions import Literal -from pydantic.v1 import BaseModel, Field from mxcubecore.HardwareObjects.BeamlineActions import ( - BeamlineActions, AnnotatedCommand, + BeamlineActions, ) -import gevent -import logging - class SimpleFloat(BaseModel): exp_time: float = Field(100e-6, gt=0, lt=10, description="(s)") diff --git a/mxcubecore/HardwareObjects/mockup/BeamlineTestMockup.py b/mxcubecore/HardwareObjects/mockup/BeamlineTestMockup.py index 853c69426f..3ff3265a7f 100644 --- a/mxcubecore/HardwareObjects/mockup/BeamlineTestMockup.py +++ b/mxcubecore/HardwareObjects/mockup/BeamlineTestMockup.py @@ -22,17 +22,16 @@ """ -import os import logging +import os import tempfile from datetime import datetime import gevent -from mxcubecore.HardwareObjects import SimpleHTML -from mxcubecore.BaseHardwareObjects import HardwareObject from mxcubecore import HardwareRepository as HWR - +from mxcubecore.BaseHardwareObjects import HardwareObject +from mxcubecore.HardwareObjects import SimpleHTML __credits__ = ["MXCuBE collaboration"] diff --git a/mxcubecore/HardwareObjects/mockup/BeamstopMockup.py b/mxcubecore/HardwareObjects/mockup/BeamstopMockup.py index 065a7e9714..a628b88717 100644 --- a/mxcubecore/HardwareObjects/mockup/BeamstopMockup.py +++ b/mxcubecore/HardwareObjects/mockup/BeamstopMockup.py @@ -21,7 +21,6 @@ from mxcubecore.BaseHardwareObjects import HardwareObject - __credits__ = ["MXCuBE collaboration"] diff --git a/mxcubecore/HardwareObjects/mockup/CatsMaintMockup.py b/mxcubecore/HardwareObjects/mockup/CatsMaintMockup.py index f85b50439b..930ef537a1 100644 --- a/mxcubecore/HardwareObjects/mockup/CatsMaintMockup.py +++ b/mxcubecore/HardwareObjects/mockup/CatsMaintMockup.py @@ -3,13 +3,12 @@ """ import logging - -from mxcubecore.TaskUtils import task -from mxcubecore.BaseHardwareObjects import HardwareObject +import time import gevent -import time +from mxcubecore.BaseHardwareObjects import HardwareObject +from mxcubecore.TaskUtils import task __author__ = "Mikel Eguiraun" __credits__ = ["The MxCuBE collaboration"] diff --git a/mxcubecore/HardwareObjects/mockup/CollectMockup.py b/mxcubecore/HardwareObjects/mockup/CollectMockup.py index b0365f4b30..e9415d4751 100644 --- a/mxcubecore/HardwareObjects/mockup/CollectMockup.py +++ b/mxcubecore/HardwareObjects/mockup/CollectMockup.py @@ -21,10 +21,10 @@ import os import time -from mxcubecore.TaskUtils import task -from mxcubecore.HardwareObjects.abstract.AbstractCollect import AbstractCollect -from mxcubecore import HardwareRepository as HWR +from mxcubecore import HardwareRepository as HWR +from mxcubecore.HardwareObjects.abstract.AbstractCollect import AbstractCollect +from mxcubecore.TaskUtils import task __credits__ = ["MXCuBE collaboration"] diff --git a/mxcubecore/HardwareObjects/mockup/DetectorMockup.py b/mxcubecore/HardwareObjects/mockup/DetectorMockup.py index 1d1ff95070..03008545d7 100644 --- a/mxcubecore/HardwareObjects/mockup/DetectorMockup.py +++ b/mxcubecore/HardwareObjects/mockup/DetectorMockup.py @@ -1,9 +1,7 @@ import time -from mxcubecore.HardwareObjects.abstract.AbstractDetector import ( - AbstractDetector, -) from mxcubecore.BaseHardwareObjects import HardwareObjectState +from mxcubecore.HardwareObjects.abstract.AbstractDetector import AbstractDetector class DetectorMockup(AbstractDetector): diff --git a/mxcubecore/HardwareObjects/mockup/DiffractometerMockup.py b/mxcubecore/HardwareObjects/mockup/DiffractometerMockup.py index 1e12413529..30e0e15849 100644 --- a/mxcubecore/HardwareObjects/mockup/DiffractometerMockup.py +++ b/mxcubecore/HardwareObjects/mockup/DiffractometerMockup.py @@ -17,19 +17,19 @@ # You should have received a copy of the GNU Lesser General Public License # along with MXCuBE. If not, see . -import time import logging import random +import time import warnings +from gevent.event import AsyncResult + +from mxcubecore import HardwareRepository as HWR from mxcubecore.HardwareObjects.GenericDiffractometer import ( GenericDiffractometer, PhaseEnum, ) -from mxcubecore import HardwareRepository as HWR -from gevent.event import AsyncResult - class DiffractometerMockup(GenericDiffractometer): """ diff --git a/mxcubecore/HardwareObjects/mockup/EDNACharacterisationMockup.py b/mxcubecore/HardwareObjects/mockup/EDNACharacterisationMockup.py index a75cbec468..a6a64c6b6e 100644 --- a/mxcubecore/HardwareObjects/mockup/EDNACharacterisationMockup.py +++ b/mxcubecore/HardwareObjects/mockup/EDNACharacterisationMockup.py @@ -19,10 +19,8 @@ from mxcubecore.HardwareObjects import edna_test_data from mxcubecore.HardwareObjects.EDNACharacterisation import EDNACharacterisation - from mxcubecore.HardwareObjects.XSDataMXCuBEv1_3 import XSDataResultMXCuBE - __credits__ = ["MXCuBE collaboration"] __license__ = "LGPLv3" diff --git a/mxcubecore/HardwareObjects/mockup/EnergyScanMockup.py b/mxcubecore/HardwareObjects/mockup/EnergyScanMockup.py index fadbbd6e87..477c3080ac 100644 --- a/mxcubecore/HardwareObjects/mockup/EnergyScanMockup.py +++ b/mxcubecore/HardwareObjects/mockup/EnergyScanMockup.py @@ -1,18 +1,16 @@ +import logging import os import time + import gevent import gevent.event -import logging - -from matplotlib.figure import Figure from matplotlib.backends.backend_agg import FigureCanvasAgg +from matplotlib.figure import Figure -from mxcubecore.TaskUtils import cleanup -from mxcubecore.HardwareObjects.abstract.AbstractEnergyScan import ( - AbstractEnergyScan, -) -from mxcubecore.BaseHardwareObjects import HardwareObject from mxcubecore import HardwareRepository as HWR +from mxcubecore.BaseHardwareObjects import HardwareObject +from mxcubecore.HardwareObjects.abstract.AbstractEnergyScan import AbstractEnergyScan +from mxcubecore.TaskUtils import cleanup scan_test_data = [ (10841.0, 20.0), diff --git a/mxcubecore/HardwareObjects/mockup/ExporterNStateMockup.py b/mxcubecore/HardwareObjects/mockup/ExporterNStateMockup.py index 4382ec7cec..9b16f03ec7 100644 --- a/mxcubecore/HardwareObjects/mockup/ExporterNStateMockup.py +++ b/mxcubecore/HardwareObjects/mockup/ExporterNStateMockup.py @@ -29,10 +29,12 @@ """ from enum import Enum + from gevent import sleep -from mxcubecore.HardwareObjects.abstract.AbstractNState import AbstractNState + from mxcubecore.Command.Exporter import Exporter from mxcubecore.Command.exporter.ExporterStates import ExporterStates +from mxcubecore.HardwareObjects.abstract.AbstractNState import AbstractNState __copyright__ = """ Copyright © 2020 by the MXCuBE collaboration """ __license__ = "LGPLv3+" diff --git a/mxcubecore/HardwareObjects/mockup/FluxMockup.py b/mxcubecore/HardwareObjects/mockup/FluxMockup.py index fb7b943654..528723c295 100644 --- a/mxcubecore/HardwareObjects/mockup/FluxMockup.py +++ b/mxcubecore/HardwareObjects/mockup/FluxMockup.py @@ -22,11 +22,14 @@ """ from random import random -from gevent import sleep, Timeout -from mxcubecore.HardwareObjects.abstract.AbstractFlux import AbstractFlux -from mxcubecore import HardwareRepository as HWR +from gevent import ( + Timeout, + sleep, +) +from mxcubecore import HardwareRepository as HWR +from mxcubecore.HardwareObjects.abstract.AbstractFlux import AbstractFlux __copyright__ = """ Copyright © 2010-2022 by the MXCuBE collaboration """ __license__ = "LGPLv3+" diff --git a/mxcubecore/HardwareObjects/mockup/HarvesterMockup.py b/mxcubecore/HardwareObjects/mockup/HarvesterMockup.py index 1a7a9ad8a0..e5c3f63d7b 100644 --- a/mxcubecore/HardwareObjects/mockup/HarvesterMockup.py +++ b/mxcubecore/HardwareObjects/mockup/HarvesterMockup.py @@ -34,9 +34,10 @@ ----------------------------------------------------------------------- """ -import gevent import logging +import gevent + from mxcubecore.BaseHardwareObjects import HardwareObject diff --git a/mxcubecore/HardwareObjects/mockup/ISPyBClientMockup.py b/mxcubecore/HardwareObjects/mockup/ISPyBClientMockup.py index 3cd11607a5..6ba8f22b3c 100644 --- a/mxcubecore/HardwareObjects/mockup/ISPyBClientMockup.py +++ b/mxcubecore/HardwareObjects/mockup/ISPyBClientMockup.py @@ -6,8 +6,8 @@ import time import warnings -from mxcubecore.BaseHardwareObjects import HardwareObject from mxcubecore import HardwareRepository as HWR +from mxcubecore.BaseHardwareObjects import HardwareObject try: from urlparse import urljoin diff --git a/mxcubecore/HardwareObjects/mockup/ISPyBRestClientMockup.py b/mxcubecore/HardwareObjects/mockup/ISPyBRestClientMockup.py index 72bb047533..135bb2f215 100644 --- a/mxcubecore/HardwareObjects/mockup/ISPyBRestClientMockup.py +++ b/mxcubecore/HardwareObjects/mockup/ISPyBRestClientMockup.py @@ -3,10 +3,12 @@ """ from __future__ import print_function + import logging from datetime import datetime -from mxcubecore.BaseHardwareObjects import HardwareObject + from mxcubecore import HardwareRepository as HWR +from mxcubecore.BaseHardwareObjects import HardwareObject try: from urlparse import urljoin diff --git a/mxcubecore/HardwareObjects/mockup/LimaDetectorMockup.py b/mxcubecore/HardwareObjects/mockup/LimaDetectorMockup.py index 0b113f6317..52c79515f9 100644 --- a/mxcubecore/HardwareObjects/mockup/LimaDetectorMockup.py +++ b/mxcubecore/HardwareObjects/mockup/LimaDetectorMockup.py @@ -1,10 +1,12 @@ # pylint: skip-file -import time -from mxcubecore.TaskUtils import task import logging +import time + from PyTango import DeviceProxy + from mxcubecore import HardwareRepository as HWR +from mxcubecore.TaskUtils import task class LimaDetectorMockup: diff --git a/mxcubecore/HardwareObjects/mockup/MDCameraMockup.py b/mxcubecore/HardwareObjects/mockup/MDCameraMockup.py index 94657418b7..e8b2e42df4 100644 --- a/mxcubecore/HardwareObjects/mockup/MDCameraMockup.py +++ b/mxcubecore/HardwareObjects/mockup/MDCameraMockup.py @@ -1,10 +1,11 @@ """Class for cameras connected to framegrabbers run by Taco Device Servers""" -import psutil -import subprocess import logging +import subprocess import time + import gevent +import psutil from mxcubecore import BaseHardwareObjects from mxcubecore import HardwareRepository as HWR diff --git a/mxcubecore/HardwareObjects/mockup/MachineInfoMockup.py b/mxcubecore/HardwareObjects/mockup/MachineInfoMockup.py index 152dd89afa..dc43fa28e5 100644 --- a/mxcubecore/HardwareObjects/mockup/MachineInfoMockup.py +++ b/mxcubecore/HardwareObjects/mockup/MachineInfoMockup.py @@ -37,9 +37,7 @@ import gevent from mxcubecore import HardwareRepository as HWR -from mxcubecore.HardwareObjects.abstract.AbstractMachineInfo import ( - AbstractMachineInfo, -) +from mxcubecore.HardwareObjects.abstract.AbstractMachineInfo import AbstractMachineInfo class MachineInfoMockup(AbstractMachineInfo): diff --git a/mxcubecore/HardwareObjects/mockup/MicrodiffApertureMockup.py b/mxcubecore/HardwareObjects/mockup/MicrodiffApertureMockup.py index d5e95db688..1b4199aa2f 100644 --- a/mxcubecore/HardwareObjects/mockup/MicrodiffApertureMockup.py +++ b/mxcubecore/HardwareObjects/mockup/MicrodiffApertureMockup.py @@ -1,7 +1,8 @@ # from MD2Motor import MD2Motor -from mxcubecore.BaseHardwareObjects import HardwareObject import math +from mxcubecore.BaseHardwareObjects import HardwareObject + class MicrodiffApertureMockup(HardwareObject): def init(self): diff --git a/mxcubecore/HardwareObjects/mockup/MicrodiffInOutMockup.py b/mxcubecore/HardwareObjects/mockup/MicrodiffInOutMockup.py index 1f0ce4db13..014b5d358e 100755 --- a/mxcubecore/HardwareObjects/mockup/MicrodiffInOutMockup.py +++ b/mxcubecore/HardwareObjects/mockup/MicrodiffInOutMockup.py @@ -1,7 +1,8 @@ import logging -from mxcubecore.BaseHardwareObjects import HardwareObject import time +from mxcubecore.BaseHardwareObjects import HardwareObject + """ Use the exporter to set different MD2 actuators in/out. If private_state not specified, True will be send to set in and False for out. diff --git a/mxcubecore/HardwareObjects/mockup/MicrodiffZoomMockup.py b/mxcubecore/HardwareObjects/mockup/MicrodiffZoomMockup.py index 2333d6bdcf..1ea04d5fa1 100644 --- a/mxcubecore/HardwareObjects/mockup/MicrodiffZoomMockup.py +++ b/mxcubecore/HardwareObjects/mockup/MicrodiffZoomMockup.py @@ -10,10 +10,13 @@ """ from enum import Enum + import gevent -from mxcubecore.HardwareObjects.abstract.AbstractNState import AbstractNState -from mxcubecore.HardwareObjects.abstract.AbstractNState import BaseValueEnum +from mxcubecore.HardwareObjects.abstract.AbstractNState import ( + AbstractNState, + BaseValueEnum, +) class MicrodiffZoomMockup(AbstractNState): diff --git a/mxcubecore/HardwareObjects/mockup/MotorMockup.py b/mxcubecore/HardwareObjects/mockup/MotorMockup.py index 0a428fac80..3cd1c510ac 100644 --- a/mxcubecore/HardwareObjects/mockup/MotorMockup.py +++ b/mxcubecore/HardwareObjects/mockup/MotorMockup.py @@ -33,12 +33,14 @@ """ -import time import ast +import time -from mxcubecore.HardwareObjects.abstract.AbstractMotor import AbstractMotor +from mxcubecore.HardwareObjects.abstract.AbstractMotor import ( + AbstractMotor, + MotorStates, +) from mxcubecore.HardwareObjects.mockup.ActuatorMockup import ActuatorMockup -from mxcubecore.HardwareObjects.abstract.AbstractMotor import MotorStates __copyright__ = """ Copyright © 2010-2020 by the MXCuBE collaboration """ __license__ = "LGPLv3+" diff --git a/mxcubecore/HardwareObjects/mockup/MotorMockupBis.py b/mxcubecore/HardwareObjects/mockup/MotorMockupBis.py index 9ff61362de..59d788966b 100644 --- a/mxcubecore/HardwareObjects/mockup/MotorMockupBis.py +++ b/mxcubecore/HardwareObjects/mockup/MotorMockupBis.py @@ -26,8 +26,8 @@ """ -from mxcubecore.HardwareObjects.abstract.AbstractMotor import AbstractMotor from mxcubecore.BaseHardwareObjects import HardwareObjectState +from mxcubecore.HardwareObjects.abstract.AbstractMotor import AbstractMotor __copyright__ = """ Copyright © 2019 by the MXCuBE collaboration """ __license__ = "LGPLv3+" diff --git a/mxcubecore/HardwareObjects/mockup/MultiCollectMockup.py b/mxcubecore/HardwareObjects/mockup/MultiCollectMockup.py index 743258f707..feb1a52302 100644 --- a/mxcubecore/HardwareObjects/mockup/MultiCollectMockup.py +++ b/mxcubecore/HardwareObjects/mockup/MultiCollectMockup.py @@ -1,15 +1,15 @@ +import logging +import os +import time + +import gevent + +from mxcubecore import HardwareRepository as HWR from mxcubecore.BaseHardwareObjects import HardwareObject from mxcubecore.HardwareObjects.abstract.AbstractMultiCollect import ( AbstractMultiCollect, ) - -from mxcubecore import HardwareRepository as HWR - from mxcubecore.TaskUtils import task -import logging -import time -import os -import gevent class MultiCollectMockup(AbstractMultiCollect, HardwareObject): diff --git a/mxcubecore/HardwareObjects/mockup/OfflineProcessingMockup.py b/mxcubecore/HardwareObjects/mockup/OfflineProcessingMockup.py index f50e18e797..def656335a 100644 --- a/mxcubecore/HardwareObjects/mockup/OfflineProcessingMockup.py +++ b/mxcubecore/HardwareObjects/mockup/OfflineProcessingMockup.py @@ -16,22 +16,21 @@ # You should have received a copy of the GNU Lesser General Public License # along with MXCuBE. If not, see . -import os -import time import logging +import os import subprocess +import time import gevent from mxcubecore.BaseHardwareObjects import HardwareObject +from mxcubecore.HardwareObjects.XSDataAutoprocv1_0 import XSDataAutoprocInput from mxcubecore.HardwareObjects.XSDataCommon import ( XSDataDouble, XSDataFile, XSDataInteger, XSDataString, ) -from mxcubecore.HardwareObjects.XSDataAutoprocv1_0 import XSDataAutoprocInput - __credits__ = ["EMBL Hamburg"] __license__ = "LGPLv3+" diff --git a/mxcubecore/HardwareObjects/mockup/OnlineProcessingMockup.py b/mxcubecore/HardwareObjects/mockup/OnlineProcessingMockup.py index 8df0bad546..0e0d579da9 100644 --- a/mxcubecore/HardwareObjects/mockup/OnlineProcessingMockup.py +++ b/mxcubecore/HardwareObjects/mockup/OnlineProcessingMockup.py @@ -19,13 +19,13 @@ import time + import numpy from mxcubecore.HardwareObjects.abstract.AbstractOnlineProcessing import ( AbstractOnlineProcessing, ) - __license__ = "LGPLv3" diff --git a/mxcubecore/HardwareObjects/mockup/PlateManipulatorMockup.py b/mxcubecore/HardwareObjects/mockup/PlateManipulatorMockup.py index 1bc91a427f..7ad392450b 100644 --- a/mxcubecore/HardwareObjects/mockup/PlateManipulatorMockup.py +++ b/mxcubecore/HardwareObjects/mockup/PlateManipulatorMockup.py @@ -45,6 +45,7 @@ import logging import time + import gevent from mxcubecore.HardwareObjects.abstract import AbstractSampleChanger diff --git a/mxcubecore/HardwareObjects/mockup/PlottingMockup.py b/mxcubecore/HardwareObjects/mockup/PlottingMockup.py index 2ad340993a..50ad603ae8 100644 --- a/mxcubecore/HardwareObjects/mockup/PlottingMockup.py +++ b/mxcubecore/HardwareObjects/mockup/PlottingMockup.py @@ -1,7 +1,8 @@ -from mxcubecore.BaseHardwareObjects import HardwareObject import gevent import numpy +from mxcubecore.BaseHardwareObjects import HardwareObject + def plot_emitter(new_plot, plot_data, plot_end): scan_nb = 0 diff --git a/mxcubecore/HardwareObjects/mockup/ProcedureMockup.py b/mxcubecore/HardwareObjects/mockup/ProcedureMockup.py index aaf6904f20..517bdfc8ac 100644 --- a/mxcubecore/HardwareObjects/mockup/ProcedureMockup.py +++ b/mxcubecore/HardwareObjects/mockup/ProcedureMockup.py @@ -1,9 +1,6 @@ import gevent -from mxcubecore.HardwareObjects.abstract.AbstractProcedure import ( - AbstractProcedure, -) - +from mxcubecore.HardwareObjects.abstract.AbstractProcedure import AbstractProcedure from mxcubecore.model import procedure_model as datamodel diff --git a/mxcubecore/HardwareObjects/mockup/QtVideoMockup.py b/mxcubecore/HardwareObjects/mockup/QtVideoMockup.py index 6e82a85fd2..5bb39bafc3 100755 --- a/mxcubecore/HardwareObjects/mockup/QtVideoMockup.py +++ b/mxcubecore/HardwareObjects/mockup/QtVideoMockup.py @@ -18,12 +18,18 @@ # along with MXCuBE. If not, see . import time + import numpy as np from pkg_resources import resource_filename -from mxcubecore.utils.qt_import import QPainter, QPixmap, QPen, QBrush, QImage, Qt -from mxcubecore.HardwareObjects.abstract.AbstractVideoDevice import ( - AbstractVideoDevice, +from mxcubecore.HardwareObjects.abstract.AbstractVideoDevice import AbstractVideoDevice +from mxcubecore.utils.qt_import import ( + QBrush, + QImage, + QPainter, + QPen, + QPixmap, + Qt, ) diff --git a/mxcubecore/HardwareObjects/mockup/SOLEILCharacterisationMockup.py b/mxcubecore/HardwareObjects/mockup/SOLEILCharacterisationMockup.py index 86eaefe8b8..f351c339ab 100644 --- a/mxcubecore/HardwareObjects/mockup/SOLEILCharacterisationMockup.py +++ b/mxcubecore/HardwareObjects/mockup/SOLEILCharacterisationMockup.py @@ -1,11 +1,11 @@ import logging + import gevent.event from mxcubecore.HardwareObjects import edna_test_data from mxcubecore.HardwareObjects.abstract.AbstractCharacterisation import ( AbstractCharacterisation, ) - from mxcubecore.HardwareObjects.XSDataMXCuBEv1_3 import XSDataResultMXCuBE diff --git a/mxcubecore/HardwareObjects/mockup/SampleChangerMockup.py b/mxcubecore/HardwareObjects/mockup/SampleChangerMockup.py index 5bb9490754..4a2dab91b3 100644 --- a/mxcubecore/HardwareObjects/mockup/SampleChangerMockup.py +++ b/mxcubecore/HardwareObjects/mockup/SampleChangerMockup.py @@ -1,5 +1,5 @@ -import time import logging +import time from mxcubecore.HardwareObjects.abstract import AbstractSampleChanger from mxcubecore.HardwareObjects.abstract.sample_changer import Container diff --git a/mxcubecore/HardwareObjects/mockup/ScanMockup.py b/mxcubecore/HardwareObjects/mockup/ScanMockup.py index 8b14a24b96..9a42b037e5 100644 --- a/mxcubecore/HardwareObjects/mockup/ScanMockup.py +++ b/mxcubecore/HardwareObjects/mockup/ScanMockup.py @@ -17,18 +17,19 @@ # You should have received a copy of the GNU Lesser General Public License # along with MXCuBE. If not, see . -import gevent -import random import ast +import random +import gevent + +from mxcubecore import HardwareRepository as HWR from mxcubecore.BaseHardwareObjects import HardwareObject from mxcubecore.HardwareObjects.DataPublisher import ( - PlotType, - PlotDim, DataType, + PlotDim, + PlotType, one_d_data, ) -from mxcubecore import HardwareRepository as HWR class ScanMockup(HardwareObject): diff --git a/mxcubecore/HardwareObjects/mockup/ShapeHistoryMockup.py b/mxcubecore/HardwareObjects/mockup/ShapeHistoryMockup.py index 453c1d889e..cb5b5bd47b 100644 --- a/mxcubecore/HardwareObjects/mockup/ShapeHistoryMockup.py +++ b/mxcubecore/HardwareObjects/mockup/ShapeHistoryMockup.py @@ -19,9 +19,9 @@ import logging import os -from mxcubecore.model import queue_model_objects from mxcubecore.BaseHardwareObjects import HardwareObject +from mxcubecore.model import queue_model_objects SELECTED_COLOR = "green" NORMAL_COLOR = "yellow" diff --git a/mxcubecore/HardwareObjects/mockup/ShutterMockup.py b/mxcubecore/HardwareObjects/mockup/ShutterMockup.py index 2902b5290c..c92bd508cb 100644 --- a/mxcubecore/HardwareObjects/mockup/ShutterMockup.py +++ b/mxcubecore/HardwareObjects/mockup/ShutterMockup.py @@ -19,9 +19,13 @@ """ Mockup shutter implementation""" -from enum import Enum, unique -from mxcubecore.HardwareObjects.abstract.AbstractShutter import AbstractShutter +from enum import ( + Enum, + unique, +) + from mxcubecore.BaseHardwareObjects import HardwareObjectState +from mxcubecore.HardwareObjects.abstract.AbstractShutter import AbstractShutter from mxcubecore.HardwareObjects.mockup.ActuatorMockup import ActuatorMockup diff --git a/mxcubecore/HardwareObjects/mockup/SlitsMockup.py b/mxcubecore/HardwareObjects/mockup/SlitsMockup.py index d1ea2431f2..b050fa10f0 100644 --- a/mxcubecore/HardwareObjects/mockup/SlitsMockup.py +++ b/mxcubecore/HardwareObjects/mockup/SlitsMockup.py @@ -20,7 +20,6 @@ from mxcubecore.HardwareObjects.abstract.AbstractSlits import AbstractSlits - __credits__ = ["MXCuBE collaboration"] diff --git a/mxcubecore/HardwareObjects/mockup/TransmissionMockup.py b/mxcubecore/HardwareObjects/mockup/TransmissionMockup.py index 44ac3d30df..505d4ef1a3 100644 --- a/mxcubecore/HardwareObjects/mockup/TransmissionMockup.py +++ b/mxcubecore/HardwareObjects/mockup/TransmissionMockup.py @@ -23,7 +23,6 @@ ) from mxcubecore.HardwareObjects.mockup.ActuatorMockup import ActuatorMockup - __copyright__ = """ Copyright © 2019 by the MXCuBE collaboration """ __license__ = "LGPLv3+" diff --git a/mxcubecore/HardwareObjects/mockup/XRFMockup.py b/mxcubecore/HardwareObjects/mockup/XRFMockup.py index b614486027..aa998368a3 100644 --- a/mxcubecore/HardwareObjects/mockup/XRFMockup.py +++ b/mxcubecore/HardwareObjects/mockup/XRFMockup.py @@ -1,6 +1,7 @@ import logging -import gevent import time + +import gevent import numpy from mxcubecore.BaseHardwareObjects import HardwareObject diff --git a/mxcubecore/HardwareObjects/mockup/XRFSpectrumMockup.py b/mxcubecore/HardwareObjects/mockup/XRFSpectrumMockup.py index de13511377..40d6aeb775 100644 --- a/mxcubecore/HardwareObjects/mockup/XRFSpectrumMockup.py +++ b/mxcubecore/HardwareObjects/mockup/XRFSpectrumMockup.py @@ -24,10 +24,7 @@ from time import sleep -from mxcubecore.HardwareObjects.abstract.AbstractXRFSpectrum import ( - AbstractXRFSpectrum, -) - +from mxcubecore.HardwareObjects.abstract.AbstractXRFSpectrum import AbstractXRFSpectrum __copyright__ = """ Copyright © by the MXCuBE collaboration """ __license__ = "LGPLv3+" diff --git a/mxcubecore/HardwareObjects/mockup/XrayCentringMockup.py b/mxcubecore/HardwareObjects/mockup/XrayCentringMockup.py index 66d12de265..f0aef268f6 100644 --- a/mxcubecore/HardwareObjects/mockup/XrayCentringMockup.py +++ b/mxcubecore/HardwareObjects/mockup/XrayCentringMockup.py @@ -18,15 +18,19 @@ """ """ -from __future__ import division, absolute_import -from __future__ import print_function, unicode_literals +from __future__ import ( + absolute_import, + division, + print_function, + unicode_literals, +) import logging -from mxcubecore.model import queue_model_objects from mxcubecore.HardwareObjects.abstract.AbstractXrayCentring import ( AbstractXrayCentring, ) +from mxcubecore.model import queue_model_objects __copyright__ = """ Copyright © 2016 - 2022 by MXCuBE Collaboration """ __license__ = "LGPLv3+" diff --git a/mxcubecore/HardwareObjects/sample_centring.py b/mxcubecore/HardwareObjects/sample_centring.py index e900367170..a69d608400 100644 --- a/mxcubecore/HardwareObjects/sample_centring.py +++ b/mxcubecore/HardwareObjects/sample_centring.py @@ -1,11 +1,12 @@ -from scipy import optimize -import numpy -import gevent.event -import math -import time import logging +import math import os import tempfile +import time + +import gevent.event +import numpy +from scipy import optimize try: import lucid3 as lucid diff --git a/mxcubecore/HardwareRepository.py b/mxcubecore/HardwareRepository.py index 6fc737e59c..e89a9ba088 100644 --- a/mxcubecore/HardwareRepository.py +++ b/mxcubecore/HardwareRepository.py @@ -26,24 +26,35 @@ connections to the Control Software (Spec or Taco Device Servers). """ -from __future__ import print_function, absolute_import +from __future__ import ( + absolute_import, + print_function, +) +import importlib import logging -import weakref -import sys import os +import sys import time -import importlib import traceback -from typing import Union, TYPE_CHECKING +import weakref from datetime import datetime +from typing import ( + TYPE_CHECKING, + Union, +) from ruamel.yaml import YAML -from mxcubecore.utils.conversion import string_types, make_table +from mxcubecore import ( + BaseHardwareObjects, + HardwareObjectFileParser, +) from mxcubecore.dispatcher import dispatcher -from mxcubecore import BaseHardwareObjects -from mxcubecore import HardwareObjectFileParser +from mxcubecore.utils.conversion import ( + make_table, + string_types, +) if TYPE_CHECKING: from mxcubecore.BaseHardwareObjects import HardwareObject diff --git a/mxcubecore/Poller.py b/mxcubecore/Poller.py index cc76b0e384..19ba6e69fb 100644 --- a/mxcubecore/Poller.py +++ b/mxcubecore/Poller.py @@ -1,13 +1,11 @@ import logging -from dispatcher import saferef import gevent import gevent.monkey +import numpy +from dispatcher import saferef from gevent import _threading - from gevent.event import Event -import numpy - try: import Queue as queue diff --git a/mxcubecore/TaskUtils.py b/mxcubecore/TaskUtils.py index cff16c3a2e..a3137794b0 100644 --- a/mxcubecore/TaskUtils.py +++ b/mxcubecore/TaskUtils.py @@ -6,9 +6,10 @@ from types import InstanceType except ImportError: InstanceType = object +import collections import logging + import gevent -import collections class cleanup: diff --git a/mxcubecore/__init__.py b/mxcubecore/__init__.py index 961be785d5..dee41c00b1 100644 --- a/mxcubecore/__init__.py +++ b/mxcubecore/__init__.py @@ -1,10 +1,15 @@ from __future__ import absolute_import import logging -from logging.handlers import RotatingFileHandler import os import sys -from colorama import Fore, Back, Style +from logging.handlers import RotatingFileHandler + +from colorama import ( + Back, + Fore, + Style, +) from mxcubecore import HardwareRepository as HWR from mxcubecore import __version__ diff --git a/mxcubecore/configuration/checkxml.py b/mxcubecore/configuration/checkxml.py index 1e29245efe..9f99080b66 100644 --- a/mxcubecore/configuration/checkxml.py +++ b/mxcubecore/configuration/checkxml.py @@ -1,10 +1,15 @@ -import os -import xmltodict import argparse +import os import pprint + import pydantic +import xmltodict +from colorama import ( + Back, + Fore, + Style, +) -from colorama import Fore, Back, Style from mxcubecore.model import configmodel diff --git a/mxcubecore/configuration/soleil_px2/diffractometer/generate_md2_config_files.py b/mxcubecore/configuration/soleil_px2/diffractometer/generate_md2_config_files.py index d092a64c2e..ae6df7b7fe 100755 --- a/mxcubecore/configuration/soleil_px2/diffractometer/generate_md2_config_files.py +++ b/mxcubecore/configuration/soleil_px2/diffractometer/generate_md2_config_files.py @@ -1,8 +1,8 @@ #!/usr/bin/env python2 """Generate configuration files for MD2 motors. Available options are "exporter", "tango_events", "tango_polling" """ -from string import Template import os +from string import Template continuous_motors = { "AlignmentX": {"direction": "1", "GUIstep": "0.1"}, diff --git a/mxcubecore/model/common.py b/mxcubecore/model/common.py index 3517fc290d..ded8b87cb0 100644 --- a/mxcubecore/model/common.py +++ b/mxcubecore/model/common.py @@ -1,6 +1,10 @@ from datetime import datetime from typing import Optional -from pydantic.v1 import BaseModel, Field + +from pydantic.v1 import ( + BaseModel, + Field, +) class CommonCollectionParamters(BaseModel): diff --git a/mxcubecore/model/configmodel.py b/mxcubecore/model/configmodel.py index a014abbcb0..7a7ca074bd 100644 --- a/mxcubecore/model/configmodel.py +++ b/mxcubecore/model/configmodel.py @@ -1,4 +1,7 @@ -from pydantic.v1 import BaseModel, Field +from pydantic.v1 import ( + BaseModel, + Field, +) class ExporterNStateConfigModel(BaseModel): diff --git a/mxcubecore/model/crystal_symmetry.py b/mxcubecore/model/crystal_symmetry.py index c2234141b2..8272376378 100644 --- a/mxcubecore/model/crystal_symmetry.py +++ b/mxcubecore/model/crystal_symmetry.py @@ -26,7 +26,10 @@ __date__ = "30/04/2023" import operator -from collections import namedtuple, OrderedDict +from collections import ( + OrderedDict, + namedtuple, +) CrystalClassInfo = namedtuple( "CrystalClassInfo", diff --git a/mxcubecore/model/procedure_model.py b/mxcubecore/model/procedure_model.py index 796c3b9559..97b2de1b3d 100644 --- a/mxcubecore/model/procedure_model.py +++ b/mxcubecore/model/procedure_model.py @@ -1,6 +1,9 @@ # -*- coding: utf-8 -*- -from pydantic.v1 import BaseModel, Field +from pydantic.v1 import ( + BaseModel, + Field, +) class ValidationError(Exception): diff --git a/mxcubecore/model/queue_model_objects.py b/mxcubecore/model/queue_model_objects.py index fac0562481..8ec6cf721f 100644 --- a/mxcubecore/model/queue_model_objects.py +++ b/mxcubecore/model/queue_model_objects.py @@ -24,15 +24,16 @@ the QueueModel. """ import copy -import os import logging +import os from mxcubecore.model import queue_model_enumerables try: - from mxcubecore.model import crystal_symmetry from ruamel.yaml import YAML + from mxcubecore.model import crystal_symmetry + # If you want to write out copies of the file, use typ="rt" instead # pure=True uses yaml version 1.2, with fewere gotchas for strange type conversions yaml = YAML(typ="safe", pure=True) diff --git a/mxcubecore/queue_entry/__init__.py b/mxcubecore/queue_entry/__init__.py index bb39621516..3c81d8ee25 100644 --- a/mxcubecore/queue_entry/__init__.py +++ b/mxcubecore/queue_entry/__init__.py @@ -18,20 +18,19 @@ import sys -from mxcubecore.queue_entry.import_helper import ImportHelper +from mxcubecore.HardwareObjects.EMBL import EMBLQueueEntry +from mxcubecore.HardwareObjects.Gphl import GphlQueueEntry +from mxcubecore.model import queue_model_objects # Import all constants and BaseQueueEntry from base_queue_entry so that # queue _entry can be imported and used as before. from mxcubecore.queue_entry.base_queue_entry import * - -from mxcubecore.model import queue_model_objects -from mxcubecore.HardwareObjects.Gphl import GphlQueueEntry -from mxcubecore.HardwareObjects.EMBL import EMBLQueueEntry +from mxcubecore.queue_entry.characterisation import CharacterisationGroupQueueEntry +from mxcubecore.queue_entry.import_helper import ImportHelper # These two queue entries, for the moment violates the convention above and # should eventually be changed from mxcubecore.queue_entry.xrf_spectrum import XrfSpectrumQueueEntry -from mxcubecore.queue_entry.characterisation import CharacterisationGroupQueueEntry __all__ = [] MODEL_QUEUE_ENTRY_MAPPINGS = {} diff --git a/mxcubecore/queue_entry/advanced_connector.py b/mxcubecore/queue_entry/advanced_connector.py index 6c8bdeb7bf..2be14275d2 100644 --- a/mxcubecore/queue_entry/advanced_connector.py +++ b/mxcubecore/queue_entry/advanced_connector.py @@ -17,10 +17,10 @@ # along with MXCuBE. If not, see . import logging + import gevent from mxcubecore import HardwareRepository as HWR - from mxcubecore.queue_entry.base_queue_entry import BaseQueueEntry __credits__ = ["MXCuBE collaboration"] diff --git a/mxcubecore/queue_entry/base_queue_entry.py b/mxcubecore/queue_entry/base_queue_entry.py index e2d2e1f720..c6ecf25330 100644 --- a/mxcubecore/queue_entry/base_queue_entry.py +++ b/mxcubecore/queue_entry/base_queue_entry.py @@ -22,20 +22,22 @@ execute queue entries in a hierarchical manner. """ +import copy import logging import sys -import traceback import time -import gevent -import copy - +import traceback from collections import namedtuple -from mxcubecore import HardwareRepository as HWR -from mxcubecore.model import queue_model_objects -from mxcubecore.model.queue_model_enumerables import CENTRING_METHOD, EXPERIMENT_TYPE +import gevent +from mxcubecore import HardwareRepository as HWR from mxcubecore.HardwareObjects import autoprocessing +from mxcubecore.model import queue_model_objects +from mxcubecore.model.queue_model_enumerables import ( + CENTRING_METHOD, + EXPERIMENT_TYPE, +) __credits__ = ["MXCuBE collaboration"] __license__ = "LGPLv3+" diff --git a/mxcubecore/queue_entry/characterisation.py b/mxcubecore/queue_entry/characterisation.py index 0b3ac813db..eaaa662086 100644 --- a/mxcubecore/queue_entry/characterisation.py +++ b/mxcubecore/queue_entry/characterisation.py @@ -17,13 +17,15 @@ # along with MXCuBE. If not, see . import logging + import gevent from mxcubecore import HardwareRepository as HWR from mxcubecore.model import queue_model_objects - -from mxcubecore.queue_entry.base_queue_entry import BaseQueueEntry, QUEUE_ENTRY_STATUS - +from mxcubecore.queue_entry.base_queue_entry import ( + QUEUE_ENTRY_STATUS, + BaseQueueEntry, +) from mxcubecore.queue_entry.data_collection import DataCollectionQueueEntry __credits__ = ["MXCuBE collaboration"] diff --git a/mxcubecore/queue_entry/data_collection.py b/mxcubecore/queue_entry/data_collection.py index 5626755e67..29183fd423 100644 --- a/mxcubecore/queue_entry/data_collection.py +++ b/mxcubecore/queue_entry/data_collection.py @@ -17,20 +17,21 @@ # along with MXCuBE. If not, see . import logging + import gevent from mxcubecore import HardwareRepository as HWR from mxcubecore.dispatcher import dispatcher from mxcubecore.model import queue_model_objects from mxcubecore.model.queue_model_enumerables import ( - EXPERIMENT_TYPE, COLLECTION_ORIGIN_STR, + EXPERIMENT_TYPE, ) from mxcubecore.queue_entry.base_queue_entry import ( - BaseQueueEntry, QUEUE_ENTRY_STATUS, - QueueExecutionException, + BaseQueueEntry, QueueAbortedException, + QueueExecutionException, center_before_collect, ) diff --git a/mxcubecore/queue_entry/energy_scan.py b/mxcubecore/queue_entry/energy_scan.py index 8ea2ed7144..c20b3eadb5 100644 --- a/mxcubecore/queue_entry/energy_scan.py +++ b/mxcubecore/queue_entry/energy_scan.py @@ -17,16 +17,16 @@ # along with MXCuBE. If not, see . import logging + import gevent from mxcubecore import HardwareRepository as HWR from mxcubecore.dispatcher import dispatcher - from mxcubecore.queue_entry.base_queue_entry import ( - BaseQueueEntry, QUEUE_ENTRY_STATUS, - QueueExecutionException, + BaseQueueEntry, QueueAbortedException, + QueueExecutionException, ) __credits__ = ["MXCuBE collaboration"] diff --git a/mxcubecore/queue_entry/generic_workflow.py b/mxcubecore/queue_entry/generic_workflow.py index a80b8b1b52..35512c72c9 100644 --- a/mxcubecore/queue_entry/generic_workflow.py +++ b/mxcubecore/queue_entry/generic_workflow.py @@ -16,8 +16,8 @@ # You should have received a copy of the GNU Lesser General Public License # along with MXCuBE. If not, see . -import time import logging +import time import gevent diff --git a/mxcubecore/queue_entry/import_helper.py b/mxcubecore/queue_entry/import_helper.py index 99ecafce2b..0666f556a7 100644 --- a/mxcubecore/queue_entry/import_helper.py +++ b/mxcubecore/queue_entry/import_helper.py @@ -21,9 +21,9 @@ Utility class for importing queue entries """ -import sys -import os import logging +import os +import sys from importlib import import_module from pathlib import Path diff --git a/mxcubecore/queue_entry/optical_centring.py b/mxcubecore/queue_entry/optical_centring.py index 1dca79d880..766daf9727 100644 --- a/mxcubecore/queue_entry/optical_centring.py +++ b/mxcubecore/queue_entry/optical_centring.py @@ -20,7 +20,6 @@ import gevent from mxcubecore import HardwareRepository as HWR - from mxcubecore.queue_entry.base_queue_entry import BaseQueueEntry __credits__ = ["MXCuBE collaboration"] diff --git a/mxcubecore/queue_entry/test_collection.py b/mxcubecore/queue_entry/test_collection.py index 094f9dcf83..abfc4f4cfa 100644 --- a/mxcubecore/queue_entry/test_collection.py +++ b/mxcubecore/queue_entry/test_collection.py @@ -1,16 +1,18 @@ import json -from pydantic.v1 import BaseModel, Field -from mxcubecore.queue_entry.base_queue_entry import BaseQueueEntry +from pydantic.v1 import ( + BaseModel, + Field, +) from mxcubecore.model.common import ( CommonCollectionParamters, - PathParameters, LegacyParameters, + PathParameters, StandardCollectionParameters, ) - from mxcubecore.model.queue_model_objects import DataCollection +from mxcubecore.queue_entry.base_queue_entry import BaseQueueEntry __credits__ = ["MXCuBE collaboration"] __license__ = "LGPLv3+" diff --git a/mxcubecore/queue_entry/xray_centering.py b/mxcubecore/queue_entry/xray_centering.py index c7a884e518..f5a4ccdac5 100644 --- a/mxcubecore/queue_entry/xray_centering.py +++ b/mxcubecore/queue_entry/xray_centering.py @@ -18,7 +18,6 @@ from mxcubecore import HardwareRepository as HWR from mxcubecore.model import queue_model_objects - from mxcubecore.queue_entry.base_queue_entry import BaseQueueEntry __credits__ = ["MXCuBE collaboration"] diff --git a/mxcubecore/queue_entry/xray_centering2.py b/mxcubecore/queue_entry/xray_centering2.py index 9ced94ff6f..2776346728 100644 --- a/mxcubecore/queue_entry/xray_centering2.py +++ b/mxcubecore/queue_entry/xray_centering2.py @@ -19,7 +19,6 @@ from mxcubecore import HardwareRepository as HWR from mxcubecore.model import queue_model_objects - from mxcubecore.queue_entry.base_queue_entry import BaseQueueEntry __credits__ = ["MXCuBE collaboration"] diff --git a/mxcubecore/queue_entry/xrf_spectrum.py b/mxcubecore/queue_entry/xrf_spectrum.py index 30588aa129..4f1023a635 100644 --- a/mxcubecore/queue_entry/xrf_spectrum.py +++ b/mxcubecore/queue_entry/xrf_spectrum.py @@ -22,13 +22,13 @@ import logging -from mxcubecore.BaseHardwareObjects import HardwareObjectState from mxcubecore import HardwareRepository as HWR +from mxcubecore.BaseHardwareObjects import HardwareObjectState from mxcubecore.queue_entry.base_queue_entry import ( - BaseQueueEntry, QUEUE_ENTRY_STATUS, - QueueExecutionException, + BaseQueueEntry, QueueAbortedException, + QueueExecutionException, ) __credits__ = ["MXCuBE collaboration"] diff --git a/mxcubecore/saferef.py b/mxcubecore/saferef.py index f0aeb665cc..df5840856e 100644 --- a/mxcubecore/saferef.py +++ b/mxcubecore/saferef.py @@ -1,8 +1,8 @@ """Refactored 'safe reference from dispatcher.py""" -import weakref -import traceback import collections +import traceback +import weakref def safe_ref(target, on_delete=None): diff --git a/mxcubecore/utils/conversion.py b/mxcubecore/utils/conversion.py index d9ad114d68..e350552b55 100644 --- a/mxcubecore/utils/conversion.py +++ b/mxcubecore/utils/conversion.py @@ -20,12 +20,20 @@ """General data and functions, that can be shared between different HardwareObjects """ -from __future__ import division, absolute_import -from __future__ import print_function, unicode_literals +from __future__ import ( + absolute_import, + division, + print_function, + unicode_literals, +) import re -from scipy.constants import h, c, e +from scipy.constants import ( + c, + e, + h, +) __date__ = "19/06/17" __credits__ = ["MXCuBE collaboration"] diff --git a/mxcubecore/utils/dataobject.py b/mxcubecore/utils/dataobject.py index 81aaec0113..77e198da62 100644 --- a/mxcubecore/utils/dataobject.py +++ b/mxcubecore/utils/dataobject.py @@ -18,9 +18,10 @@ # You should have received a copy of the GNU Lesser General Public License # along with MXCuBE. If not, see . -import jsonschema import copy +import jsonschema + __copyright__ = """ Copyright © 2019 by the MXCuBE collaboration """ __license__ = "LGPLv3+" diff --git a/mxcubecore/utils/qt_import.py b/mxcubecore/utils/qt_import.py index 3e6798cf06..0f2e14dbb6 100644 --- a/mxcubecore/utils/qt_import.py +++ b/mxcubecore/utils/qt_import.py @@ -115,10 +115,8 @@ if (qt_variant == "PyQt5") or (qt_variant is None and not qt_imported): try: from PyQt5.QtCore import ( - pyqtSignal, - pyqtSlot, PYQT_VERSION_STR, - Qt, + QT_VERSION_STR, QCoreApplication, QDir, QEvent, @@ -130,8 +128,34 @@ QRectF, QRegExp, QSize, - QT_VERSION_STR, + Qt, QTimer, + pyqtSignal, + pyqtSlot, + ) + from PyQt5.QtGui import ( + QBrush, + QColor, + QContextMenuEvent, + QCursor, + QDoubleValidator, + QFocusEvent, + QFont, + QIcon, + QImage, + QIntValidator, + QKeyEvent, + QKeySequence, + QLinearGradient, + QMouseEvent, + QPainter, + QPainterPath, + QPalette, + QPen, + QPixmap, + QPolygon, + QRegExpValidator, + QValidator, ) from PyQt5.QtWidgets import ( QAbstractItemView, @@ -181,10 +205,10 @@ QSplitter, QStackedWidget, QStatusBar, - QTabWidget, QTableView, QTableWidget, QTableWidgetItem, + QTabWidget, QTextBrowser, QTextEdit, QToolBar, @@ -199,30 +223,6 @@ QWhatsThis, QWidget, ) - from PyQt5.QtGui import ( - QBrush, - QColor, - QContextMenuEvent, - QCursor, - QDoubleValidator, - QFocusEvent, - QFont, - QKeyEvent, - QKeySequence, - QIcon, - QImage, - QIntValidator, - QLinearGradient, - QMouseEvent, - QPainter, - QPainterPath, - QPalette, - QPen, - QPixmap, - QPolygon, - QRegExpValidator, - QValidator, - ) from PyQt5.uic import loadUi QStringList = list @@ -256,14 +256,12 @@ # but code is guaranteed to be compatible try: from PyQt4.QtCore import ( - pyqtSignal, - pyqtSlot, PYQT_VERSION_STR, - Qt, + QT_VERSION_STR, + SIGNAL, QDir, QEvent, QEventLoop, - QUrl, QObject, QPoint, QPointF, @@ -272,12 +270,13 @@ QRegExp, QSize, QStringList, - QT_VERSION_STR, + Qt, QTimer, - SIGNAL, + QUrl, + pyqtSignal, + pyqtSlot, ) from PyQt4.QtGui import ( - qApp, QAbstractItemView, QAction, QActionGroup, @@ -287,19 +286,18 @@ QCheckBox, QColor, QColorDialog, - QContextMenuEvent, QComboBox, + QContextMenuEvent, QCursor, QDesktopWidget, QDial, QDialog, - QInputDialog, QDoubleSpinBox, QDoubleValidator, QFileDialog, + QFocusEvent, QFont, QFrame, - QFocusEvent, QGraphicsItem, QGraphicsPixmapItem, QGraphicsScene, @@ -308,16 +306,16 @@ QGroupBox, QHBoxLayout, QHeaderView, - QKeyEvent, - QKeySequence, QIcon, QImage, QInputDialog, QIntValidator, + QKeyEvent, + QKeySequence, QLabel, QLayout, - QLineEdit, QLinearGradient, + QLineEdit, QListView, QListWidget, QListWidgetItem, @@ -347,10 +345,10 @@ QSplitter, QStackedWidget, QStatusBar, - QTabWidget, QTableView, QTableWidget, QTableWidgetItem, + QTabWidget, QTextBrowser, QTextEdit, QToolBar, @@ -363,8 +361,9 @@ QTreeWidgetItemIterator, QValidator, QVBoxLayout, - QWidget, QWhatsThis, + QWidget, + qApp, ) from PyQt4.uic import loadUi @@ -402,8 +401,8 @@ def getQApp(): from PySide.QtCore import * from PySide.QtGui import * - from PySide.QtUiTools import * from PySide.QtSvg import * + from PySide.QtUiTools import * from PySide.QtWebKit import * pyqtSignal = Signal diff --git a/test/pytest/TestAbstractActuatorBase.py b/test/pytest/TestAbstractActuatorBase.py index 7366482999..4ef0000555 100644 --- a/test/pytest/TestAbstractActuatorBase.py +++ b/test/pytest/TestAbstractActuatorBase.py @@ -21,13 +21,12 @@ __copyright__ = """ Copyright © 2016 - 2022 by MXCuBE Collaboration """ __license__ = "LGPLv3+" +import abc from test.pytest import TestHardwareObjectBase -import abc import gevent import pytest - test_object = TestHardwareObjectBase.test_object diff --git a/test/pytest/TestAbstractMotorBase.py b/test/pytest/TestAbstractMotorBase.py index e4dd1ef6f0..f3244c6088 100644 --- a/test/pytest/TestAbstractMotorBase.py +++ b/test/pytest/TestAbstractMotorBase.py @@ -22,9 +22,13 @@ __license__ = "LGPLv3+" import abc +from test.pytest import ( + TestAbstractActuatorBase, + TestHardwareObjectBase, +) + import gevent import pytest -from test.pytest import TestHardwareObjectBase, TestAbstractActuatorBase test_object = TestAbstractActuatorBase.test_object diff --git a/test/pytest/TestAbstractNStateBase.py b/test/pytest/TestAbstractNStateBase.py index c62d40aaf5..22189bbecf 100644 --- a/test/pytest/TestAbstractNStateBase.py +++ b/test/pytest/TestAbstractNStateBase.py @@ -23,8 +23,9 @@ __copyright__ = """ Copyright © 2016 - 2022 by MXCuBE Collaboration """ __license__ = "LGPLv3+" -from test.pytest import TestAbstractActuatorBase import abc +from test.pytest import TestAbstractActuatorBase + import pytest test_object = TestAbstractActuatorBase.test_object diff --git a/test/pytest/TestHardwareObjectBase.py b/test/pytest/TestHardwareObjectBase.py index 9a99c00bbc..27f3c231a2 100644 --- a/test/pytest/TestHardwareObjectBase.py +++ b/test/pytest/TestHardwareObjectBase.py @@ -19,19 +19,23 @@ Test suite to be used as base for testing when inheriting from HardwareObject. """ -from __future__ import division, absolute_import -from __future__ import print_function, unicode_literals +from __future__ import ( + absolute_import, + division, + print_function, + unicode_literals, +) __copyright__ = """ Copyright © 2020 - 2020 by MXCuBE Collaboration """ __license__ = "LGPLv3+" import abc + import gevent.event +import pytest from mxcubecore.BaseHardwareObjects import HardwareObjectState -import pytest - @pytest.fixture def test_object(beamline): diff --git a/test/pytest/conftest.py b/test/pytest/conftest.py index 2399691756..8585738aae 100644 --- a/test/pytest/conftest.py +++ b/test/pytest/conftest.py @@ -19,13 +19,13 @@ # along with MXCuBE. If not, see . """Tests configuration""" -import sys import os +import sys -from mxcubecore import HardwareRepository as HWR - -from gevent import monkey import pytest +from gevent import monkey + +from mxcubecore import HardwareRepository as HWR monkey.patch_all(thread=False) diff --git a/test/pytest/test_aperture.py b/test/pytest/test_aperture.py index dc9f2bfddc..e79c5528fe 100644 --- a/test/pytest/test_aperture.py +++ b/test/pytest/test_aperture.py @@ -21,9 +21,10 @@ __copyright__ = """ Copyright © by the MXCuBE collaboration """ __license__ = "LGPLv3+" -import pytest from test.pytest.TestAbstractNStateBase import TestAbstractNStateBase +import pytest + @pytest.fixture def test_object(beamline): diff --git a/test/pytest/test_base_hardware_objects.py b/test/pytest/test_base_hardware_objects.py index 3fe87abed3..87e0dc8c6d 100644 --- a/test/pytest/test_base_hardware_objects.py +++ b/test/pytest/test_base_hardware_objects.py @@ -1,26 +1,30 @@ import copy -import pytest +from collections import OrderedDict +from logging import Logger from typing import ( - Any, - Union, TYPE_CHECKING, - Iterator, - Generator, + Any, Dict, - Tuple, + Generator, + Iterator, List, - OrderedDict as TOrderedDict, ) -from logging import Logger +from typing import OrderedDict as TOrderedDict +from typing import ( + Tuple, + Union, +) from unittest.mock import MagicMock -from collections import OrderedDict + +import pytest + from mxcubecore.BaseHardwareObjects import ( ConfiguredObject, - PropertySet, - HardwareObjectNode, - HardwareObjectMixin, HardwareObject, + HardwareObjectMixin, + HardwareObjectNode, HardwareObjectYaml, + PropertySet, ) if TYPE_CHECKING: diff --git a/test/pytest/test_beam.py b/test/pytest/test_beam.py index 1458891e37..2dbcc19be0 100644 --- a/test/pytest/test_beam.py +++ b/test/pytest/test_beam.py @@ -23,10 +23,11 @@ """ from test.pytest import TestHardwareObjectBase -from mxcubecore.HardwareObjects.abstract.AbstractBeam import BeamShape import pytest +from mxcubecore.HardwareObjects.abstract.AbstractBeam import BeamShape + __copyright__ = """ Copyright © 2016 - 2022 by MXCuBE Collaboration """ __license__ = "LGPLv3+" diff --git a/test/pytest/test_beam_definer.py b/test/pytest/test_beam_definer.py index c4685ee878..31aa8ee997 100644 --- a/test/pytest/test_beam_definer.py +++ b/test/pytest/test_beam_definer.py @@ -22,9 +22,10 @@ """Test suite for BeamDefiner hardware object. """ -import pytest from test.pytest.TestAbstractNStateBase import TestAbstractNStateBase +import pytest + __copyright__ = """ Copyright © by MXCuBE Collaboration """ __license__ = "LGPLv3+" diff --git a/test/pytest/test_beamline_ho_id.py b/test/pytest/test_beamline_ho_id.py index 2ac18a67ec..8e9ae29921 100644 --- a/test/pytest/test_beamline_ho_id.py +++ b/test/pytest/test_beamline_ho_id.py @@ -18,8 +18,12 @@ """ """ -from __future__ import division, absolute_import -from __future__ import print_function, unicode_literals +from __future__ import ( + absolute_import, + division, + print_function, + unicode_literals, +) import pytest diff --git a/test/pytest/test_command_container.py b/test/pytest/test_command_container.py index d58700c69a..a543d5ea88 100644 --- a/test/pytest/test_command_container.py +++ b/test/pytest/test_command_container.py @@ -1,17 +1,28 @@ import copy import json import weakref -import pytest -from typing import Generator, TYPE_CHECKING, Any, Dict, Union, List, Tuple, Optional -from typing_extensions import Annotated from logging import Logger +from typing import ( + TYPE_CHECKING, + Any, + Dict, + Generator, + List, + Optional, + Tuple, + Union, +) from unittest.mock import MagicMock + +import pytest +from typing_extensions import Annotated + from mxcubecore.CommandContainer import ( - ARGUMENT_TYPE_LIST, ARGUMENT_TYPE_JSON_SCHEMA, - CommandObject, + ARGUMENT_TYPE_LIST, ChannelObject, CommandContainer, + CommandObject, ) if TYPE_CHECKING: diff --git a/test/pytest/test_detector.py b/test/pytest/test_detector.py index be75e576b9..e5bc81f788 100644 --- a/test/pytest/test_detector.py +++ b/test/pytest/test_detector.py @@ -18,11 +18,16 @@ """ """ -from __future__ import division, absolute_import -from __future__ import print_function, unicode_literals +from __future__ import ( + absolute_import, + division, + print_function, + unicode_literals, +) import math from test.pytest import TestHardwareObjectBase + import pytest __copyright__ = """ Copyright © 2016 - 2020 by MXCuBE Collaboration """ diff --git a/test/pytest/test_detector_distance.py b/test/pytest/test_detector_distance.py index c489c12388..a9d41f51c4 100644 --- a/test/pytest/test_detector_distance.py +++ b/test/pytest/test_detector_distance.py @@ -18,12 +18,17 @@ """ """ -from __future__ import division, absolute_import -from __future__ import print_function, unicode_literals +from __future__ import ( + absolute_import, + division, + print_function, + unicode_literals, +) -import pytest from test.pytest import TestAbstractMotorBase +import pytest + __copyright__ = """ Copyright © 2016 - 2020 by MXCuBE Collaboration """ __license__ = "LGPLv3+" __author__ = "rhfogh" diff --git a/test/pytest/test_energy.py b/test/pytest/test_energy.py index a49d10c02f..a7a7b1dc82 100644 --- a/test/pytest/test_energy.py +++ b/test/pytest/test_energy.py @@ -21,10 +21,10 @@ __copyright__ = """ Copyright © 2019-2020 by the MXCuBE collaboration """ __license__ = "LGPLv3+" -import pytest - from test.pytest import TestAbstractActuatorBase +import pytest + @pytest.fixture def test_object(beamline): diff --git a/test/pytest/test_flux.py b/test/pytest/test_flux.py index e223e0b085..36f21dff08 100644 --- a/test/pytest/test_flux.py +++ b/test/pytest/test_flux.py @@ -24,6 +24,7 @@ __license__ = "LGPLv3+" from test.pytest import TestAbstractActuatorBase + import pytest diff --git a/test/pytest/test_hwo_isara_maint.py b/test/pytest/test_hwo_isara_maint.py index 3bacbe68bd..8c61c0c1f6 100644 --- a/test/pytest/test_hwo_isara_maint.py +++ b/test/pytest/test_hwo_isara_maint.py @@ -1,9 +1,17 @@ import pytest -from tango import DeviceProxy, Except -from tango.server import Device, attribute, command +from gevent.event import Event +from tango import ( + DeviceProxy, + Except, +) +from tango.server import ( + Device, + attribute, + command, +) from tango.test_context import DeviceTestContext + from mxcubecore.HardwareObjects.ISARAMaint import ISARAMaint -from gevent.event import Event """ Test the HardwareObjects.ISARAMaint sample changer maintenance hardware object. diff --git a/test/pytest/test_hwo_maxiv_mach_info.py b/test/pytest/test_hwo_maxiv_mach_info.py index 68324aa7f8..28de2c8d56 100644 --- a/test/pytest/test_hwo_maxiv_mach_info.py +++ b/test/pytest/test_hwo_maxiv_mach_info.py @@ -1,8 +1,14 @@ import math + import pytest from gevent.event import Event -from tango.server import Device, attribute, command +from tango.server import ( + Device, + attribute, + command, +) from tango.test_context import MultiDeviceTestContext + from mxcubecore.HardwareObjects.MAXIV.MachInfo import MachInfo diff --git a/test/pytest/test_mach_info.py b/test/pytest/test_mach_info.py index 0702db5b5d..226aa5786b 100644 --- a/test/pytest/test_mach_info.py +++ b/test/pytest/test_mach_info.py @@ -18,9 +18,10 @@ """Test suite for MachineInfo hardware object """ -import pytest from test.pytest import TestHardwareObjectBase +import pytest + __copyright__ = """ Copyright © by MXCuBE Collaboration """ __license__ = "LGPLv3+" diff --git a/test/pytest/test_procedure.py b/test/pytest/test_procedure.py index 2e4d5e681c..da076299eb 100644 --- a/test/pytest/test_procedure.py +++ b/test/pytest/test_procedure.py @@ -1,6 +1,7 @@ import gevent -from mxcubecore.model import procedure_model + from mxcubecore.HardwareObjects.abstract.AbstractProcedure import ProcedureState +from mxcubecore.model import procedure_model def test_procedure_init(beamline): diff --git a/test/pytest/test_resolution.py b/test/pytest/test_resolution.py index 67c6fd6a9e..1ed8155eee 100755 --- a/test/pytest/test_resolution.py +++ b/test/pytest/test_resolution.py @@ -20,8 +20,8 @@ hardware objects """ from test.pytest import TestAbstractMotorBase -import pytest +import pytest __copyright__ = """ Copyright © 2016 - 2022 by MXCuBE Collaboration """ __license__ = "LGPLv3+" diff --git a/test/pytest/test_sample_view.py b/test/pytest/test_sample_view.py index 16ef59baab..82c2cf3115 100644 --- a/test/pytest/test_sample_view.py +++ b/test/pytest/test_sample_view.py @@ -18,8 +18,12 @@ """ """ -from __future__ import division, absolute_import -from __future__ import print_function, unicode_literals +from __future__ import ( + absolute_import, + division, + print_function, + unicode_literals, +) import pytest diff --git a/test/pytest/test_shutter.py b/test/pytest/test_shutter.py index 95bc054018..ca19b45084 100644 --- a/test/pytest/test_shutter.py +++ b/test/pytest/test_shutter.py @@ -21,10 +21,11 @@ __copyright__ = """ Copyright © 2019-2020 by the MXCuBE collaboration """ __license__ = "LGPLv3+" +from test.pytest import TestAbstractNStateBase + import pytest from mxcubecore.BaseHardwareObjects import HardwareObjectState -from test.pytest import TestAbstractNStateBase @pytest.fixture diff --git a/test/pytest/test_transmission.py b/test/pytest/test_transmission.py index ce38ccaf6d..f799b89199 100644 --- a/test/pytest/test_transmission.py +++ b/test/pytest/test_transmission.py @@ -24,6 +24,7 @@ __license__ = "LGPLv3+" from test.pytest import TestAbstractActuatorBase + import pytest diff --git a/test/pytest/test_utils_units.py b/test/pytest/test_utils_units.py index 5a3f490f67..9c668f695f 100644 --- a/test/pytest/test_utils_units.py +++ b/test/pytest/test_utils_units.py @@ -1,14 +1,15 @@ from math import isclose + from mxcubecore.utils.units import ( - us_to_sec, - ms_to_sec, - sec_to_us, - sec_to_hour, + A_to_mA, ev_to_kev, meter_to_mm, mm_to_meter, + ms_to_sec, + sec_to_hour, + sec_to_us, um_to_mm, - A_to_mA, + us_to_sec, ) diff --git a/test/pytest/test_xrf.py b/test/pytest/test_xrf.py index 81b4ccb9e7..50358b4760 100644 --- a/test/pytest/test_xrf.py +++ b/test/pytest/test_xrf.py @@ -29,8 +29,10 @@ __copyright__ = """ Copyright © by the MXCuBE collaboration """ __license__ = "LGPLv3+" -import pytest from test.pytest import TestHardwareObjectBase + +import pytest + from mxcubecore.BaseHardwareObjects import HardwareObjectState