pygen/module.rb
# Generate import statement for the topmost module
Generate import statement for the topmost module
Generate import statement for the topmost module
def gen_topmost_module_import
    topmost = nil
    current = self
    while true
      if current.is_a? ModuleOrPackageNode
        topmost = current.name
      end
      current = current.parent
      unless current
        break
      end
    end
    d "Topmost module for #{self}"
    if topmost
      topmost = $pygen.py_class_name(topmost)
      d "  .. #{topmost}"
      $pygen.write "\nimport #{topmost}"
    else
      d "  .. not found"
    end
  end
def gen_topmost_module_import topmost = nil current = self while true if current . is_a? ModuleOrPackageNode topmost = current . name end current = current . parent unless current break end end d "Topmost module for #{self}" if topmost topmost = $pygen . py_class_name ( topmost ) d "  .. #{topmost}" $pygen . write "\nimport #{topmost}" else d "  .. not found" end end
Generate import statement for the topmost module
Generate import statement for the topmost module