﻿class Library:
  def __init__(self, name, manifestFunction):
    self.name = name
    self.manifestFunction = manifestFunction

class LibraryRegistry:
  def __init__(self, libraries):
    self.libraries = {}
    self.manifestFunctions = {}
    for name in libraries.keys():
      canonicalName = name.lower()
      try:
        self.manifestFunctions[canonicalName] = libraries[name].v_lib_manifest_RegisterFunctions
        fnFinderFn = self.createFnFinderFn(libraries[name])
        TranslationHelper_registerFunctionFinder(fnFinderFn)
      except:
        print("Invalid library: ", name)

  def loadLibrary(self, name, ver):
    canonicalName = name.lower()
    manifestFunction = self.manifestFunctions.get(canonicalName)
    if manifestFunction != None:
      self.libraries[canonicalName] = Library(canonicalName, manifestFunction)
    return 0

  def getLibrary(self, name):
    return self.libraries.get(name.lower())

  def createFnFinderFn(self, lib):
    def fnFinderFn(name):
      fnName = 'v_' + name.split(',')[-1]
      for fn in dir(lib):
        if fn == fnName:
          return eval('lib.' + fn)
      return None
    return fnFinderFn

﻿class Library:
  def __init__(self, name, manifestFunction):
    self.name = name
    self.manifestFunction = manifestFunction

class LibraryRegistry:
  def __init__(self, libraries):
    self.libraries = {}
    for name in libraries.keys():
      canonicalName = name.lower()
      try:
        fnFinderFn = self.createFnFinderFn(libraries[name])
        TranslationHelper_registerFunctionFinder(fnFinderFn)
      except:
        print("Invalid library: ", name)

  def loadLibrary(self, name, ver):
    canonicalName = name.lower()
    manifestFunction = self.manifestFunctions.get(canonicalName)
    if manifestFunction != None:
      self.libraries[canonicalName] = Library(canonicalName, manifestFunction)
    return 0

  def getLibrary(self, name):
    return self.libraries.get(name.lower())

  def createFnFinderFn(self, lib):
    def fnFinderFn(name):
      fnName = 'v_' + name.split(',')[-1]
      for fn in dir(lib):
        if fn == fnName:
          return eval('lib.' + fn)
      return None
    return fnFinderFn

Fix Python regression where library required a manifest function to be considered valid.
Fix Python regression where library required a manifest function to be considered valid.
