예제 #1
0
파일: sxbuiltin.py 프로젝트: uhla/suds-sw
 def translate(self, value, topython=True):
     if topython:
         if isinstance(value, six.string_types) and len(value):
             return Date(value).date
         else:
             return None
     else:
         if isinstance(value, dt.date):
             return str(Date(value))
         else:
             return value
예제 #2
0
 def process(self, _edObject=None):
     """
     First uses the ImageService to find the imageId.
     Then uses ToolsForCollectionWebService for storing the image quality indicators.
     """
     EDPluginExec.process(self)
     self.DEBUG("EDPluginISPyBStoreImageQualityIndicatorsv1_4.process")
     # First get the image ID
     xsDataImageQualityIndicators = self.getDataInput().getImageQualityIndicators()
     strPathToImage = xsDataImageQualityIndicators.getImage().getPath().getValue()
     strDirName = os.path.dirname(strPathToImage)+os.sep
     strFileName = os.path.basename(strPathToImage)
     if strDirName.endswith(os.sep):
         strDirName = strDirName[:-1]
     self.DEBUG("Looking for ISPyB imageId for dir %s name %s" % (strDirName, strFileName))
     httpAuthenticatedToolsForCollectionWebService = HttpAuthenticated(username=self.strUserName, password=self.strPassWord)
     clientToolsForCollectionWebService = Client(self.strToolsForCollectionWebServiceWsdl, transport=httpAuthenticatedToolsForCollectionWebService)
     iDataCollectionId = clientToolsForCollectionWebService.service.findDataCollectionFromFileLocationAndFileName(
             strDirName, \
             strFileName, \
             )
     print iDataCollectionId
     
     httpAuthenticatedToolsForAutoprocessingWebService = HttpAuthenticated(username=self.strUserName, password=self.strPassWord)
     clientToolsForAutoprocessingWebService = Client(self.strToolsForAutoprocessingWebServiceWsdl, transport=httpAuthenticatedToolsForAutoprocessingWebService)
     iImageId = 0
     iAutoProcProgramId = self.iAutoProcProgramId
     iSpotTotal = xsDataImageQualityIndicators.getSpotTotal().getValue()
     iInResTotal = xsDataImageQualityIndicators.getInResTotal().getValue()
     iGoodBraggCandidates = xsDataImageQualityIndicators.getGoodBraggCandidates().getValue()
     iIceRings = xsDataImageQualityIndicators.getIceRings().getValue()
     fMethod1res = xsDataImageQualityIndicators.getMethod1Res().getValue()
     fMethod2res = xsDataImageQualityIndicators.getMethod2Res().getValue()
     fMaxUnitCell = xsDataImageQualityIndicators.getMaxUnitCell().getValue()
     fPctSaturationTop50peaks = xsDataImageQualityIndicators.getPctSaturationTop50Peaks().getValue()
     iInResolutionOvrlSpots = xsDataImageQualityIndicators.getInResolutionOvrlSpots().getValue()
     fBinPopCutOffMethod2res = xsDataImageQualityIndicators.getBinPopCutOffMethod2Res().getValue()
     providedDate = Date(datetime.datetime.now())
     self.iImageQualityIndicatorsId = clientToolsForAutoprocessingWebService.service.storeImageQualityIndicators(
             strDirName, \
             strFileName, \
             iImageId, \
             iAutoProcProgramId, \
             iSpotTotal, \
             iInResTotal, \
             iGoodBraggCandidates, \
             iIceRings, \
             fMethod1res, \
             fMethod2res, \
             fMaxUnitCell, \
             fPctSaturationTop50peaks, \
             iInResolutionOvrlSpots, \
             fBinPopCutOffMethod2res, \
             providedDate)
     self.DEBUG("EDPluginISPyBStoreImageQualityIndicatorsv1_4.process: imageQualityIndicatorsId=%d" % self.iImageQualityIndicatorsId)
예제 #3
0
 def testConvertToString(self, input, output):
     assert str(Date(input)) == output
예제 #4
0
 def testConstructFromString(self, string, y, m, d):
     assert Date(string).value == datetime.date(y, m, d)
예제 #5
0
 def testConstructFromDateTime_tzAware(self, hours):
     tz = FixedOffsetTimezone(10)
     date = datetime.datetime(2001, 12, 10, hours, 50, 21, 32132, tzinfo=tz)
     assert Date(date).value == datetime.date(2001, 12, 10)
예제 #6
0
 def testConstructFromDateTime_naive(self):
     date = datetime.datetime(2001, 12, 10, 10, 50, 21, 32132)
     assert Date(date).value == datetime.date(2001, 12, 10)
예제 #7
0
 def testConstructFromDate(self):
     date = datetime.date(2001, 12, 10)
     assert Date(date).value is date