def deprecationCheckItem(importPath, lineNo, line): depCheck( importPath, lineNo, 'Category', line[0], corrections.correctCategory(line[0]), ) depCheck( importPath, lineNo, 'Item', line[1], corrections.correctItem(line[1]), )
def processItemLine(matches): nonlocal newItems, updtItems, ignItems itemName, modified = matches.group('item', 'time') itemName = itemName.upper() # Look up the item ID. itemID = getItemID(itemName, -1) if itemID < 0: oldName = itemName itemName = corrections.correctItem(itemName) if itemName == DELETED: DEBUG1("DELETED {}", oldName) return itemName = itemName.upper() itemID = getItemID(itemName, -1) if itemID < 0: ignoreOrWarn( UnknownItemError(priceFile, lineNo, itemName) ) return DEBUG1("Renamed {} -> {}", oldName, itemName) lastModified = stationItemDates.get(itemID, None) if lastModified and merging: if modified and modified != 'now' and modified <= lastModified: DEBUG1("Ignoring {} @ {}: {} <= {}".format( itemName, facility, modified, lastModified, )) if modified < lastModified: ignItems += 1 return # Check for duplicate items within the station. if itemID in processedItems: raise MultipleItemEntriesError( priceFile, lineNo, "{}".format(itemName), processedItems[itemID] ) demandCr, supplyCr = matches.group('sell', 'buy') demandCr, supplyCr = int(demandCr), int(supplyCr) demandString, supplyString = matches.group('demand', 'supply') if demandCr == 0 and supplyCr == 0: if lastModified: addZero((stationID, itemID)) else: if lastModified: updtItems += 1 else: newItems += 1 if demandString: if demandString == "?": demandUnits, demandLevel = -1, -1 elif demandString == "-": demandUnits, demandLevel = 0, 0 else: demandUnits, demandLevel = parseSupply( priceFile, lineNo, 'demand', demandString ) else: demandUnits, demandLevel = defaultUnits, defaultLevel if demandString and supplyString: if supplyString == "?": supplyUnits, supplyLevel = -1, -1 elif supplyString == "-": supplyUnits, supplyLevel = 0, 0 else: supplyUnits, supplyLevel = parseSupply( priceFile, lineNo, 'supply', supplyString ) else: supplyUnits, supplyLevel = defaultUnits, defaultLevel if modified == 'now': modified = None # Use CURRENT_FILESTAMP addItem(( stationID, itemID, modified, demandCr, demandUnits, demandLevel, supplyCr, supplyUnits, supplyLevel, )) processedItems[itemID] = lineNo
def processItemLine(matches): nonlocal newItems, updtItems, ignItems itemName, modified = matches.group('item', 'time') itemName = itemName.upper() # Look up the item ID. itemID = getItemID(itemName, -1) if itemID < 0: oldName = itemName itemName = corrections.correctItem(itemName) if itemName == DELETED: DEBUG1("DELETED {}", oldName) return itemName = itemName.upper() itemID = getItemID(itemName, -1) if itemID < 0: ignoreOrWarn(UnknownItemError(priceFile, lineNo, itemName)) return DEBUG1("Renamed {} -> {}", oldName, itemName) lastModified = stationItemDates.get(itemID, None) if lastModified and merging: if modified and modified != 'now' and modified <= lastModified: DEBUG1("Ignoring {} @ {}: {} <= {}".format( itemName, facility, modified, lastModified, )) if modified < lastModified: ignItems += 1 return # Check for duplicate items within the station. if itemID in processedItems: ignoreOrWarn( MultipleItemEntriesError(priceFile, lineNo, "{}".format(itemName), processedItems[itemID])) return demandCr, supplyCr = matches.group('sell', 'buy') demandCr, supplyCr = int(demandCr), int(supplyCr) demandString, supplyString = matches.group('demand', 'supply') if demandCr == 0 and supplyCr == 0: if lastModified: addZero((stationID, itemID)) else: if lastModified: updtItems += 1 else: newItems += 1 if demandString: if demandString == "?": demandUnits, demandLevel = -1, -1 elif demandString == "-": demandUnits, demandLevel = 0, 0 else: demandUnits, demandLevel = parseSupply( priceFile, lineNo, 'demand', demandString) else: demandUnits, demandLevel = defaultUnits, defaultLevel if demandString and supplyString: if supplyString == "?": supplyUnits, supplyLevel = -1, -1 elif supplyString == "-": supplyUnits, supplyLevel = 0, 0 else: supplyUnits, supplyLevel = parseSupply( priceFile, lineNo, 'supply', supplyString) else: supplyUnits, supplyLevel = defaultUnits, defaultLevel if modified == 'now': modified = None # Use CURRENT_FILESTAMP addItem(( stationID, itemID, modified, demandCr, demandUnits, demandLevel, supplyCr, supplyUnits, supplyLevel, )) processedItems[itemID] = lineNo
def deprecationCheckItem(importPath, lineNo, line): depCheck(importPath, lineNo, "Category", line[0], corrections.correctCategory(line[0])) depCheck(importPath, lineNo, "Item", line[1], corrections.correctItem(line[1]))