def GeneratePythonModule(self): return { 'enums': self.module.enums, 'imports': self.GetImports(), 'interfaces': self.GetInterfaces(), 'module': resolver.ResolveConstants(self.module, ExpressionToText), 'namespace': self.module.namespace, 'structs': self.GetStructs(), }
def GetParameters(self, args): package = self.module.name.split('.')[0] # True if handles are used anywhere in the mojom. has_handles = any( not mojom.IsCloneableKind(kind) for kind in (self.GetStructs() + self.GetStructsFromMethods() + self.GetUnions())) # True if the binding will need dart:async needs_dart_async = any( any(method.response_parameters is not None for method in interface.methods) for interface in self.GetInterfaces()) service_describer_pkg = "package:lib.fidl.compiler.interfaces/%s.fidl.dart" % \ _service_describer_pkg_short fidl_types_pkg = "package:lib.fidl.compiler.interfaces/%s.fidl.dart" % \ _fidl_types_pkg_short parameters = { "namespace": self.module.namespace, "imports": self.GetImports(args), "kinds": self.module.kinds, "enums": self.module.enums, "module": resolver.ResolveConstants(self.module, ExpressionToText), "structs": self.GetStructs() + self.GetStructsFromMethods(), "unions": self.GetUnions(), "interfaces": self.GetInterfaces(), "imported_interfaces": self.GetImportedInterfaces(), "imported_from": self.ImportedFrom(), "typepkg": '%s.' % _fidl_types_pkg_short, "descpkg": '%s.' % _service_describer_pkg_short, "fidl_types_import": 'import \'%s\' as %s;' % \ (fidl_types_pkg, _fidl_types_pkg_short), "service_describer_import": 'import \'%s\' as %s;' % \ (service_describer_pkg, _service_describer_pkg_short), "has_handles": has_handles, "needs_dart_async": needs_dart_async, } # If this is the mojom types package, clear the import-related params. if package == _fidl_types_pkg_short: parameters["typepkg"] = "" parameters["fidl_types_import"] = "" # If this is the service describer package, clear the import-related params. if package == _service_describer_pkg_short: parameters["descpkg"] = "" parameters["service_describer_import"] = "" # If no interfaces were defined, the service describer import isn't needed. if len(self.module.interfaces) == 0: parameters["service_describer_import"] = "" return parameters
def GetParameters(self, args): return { "namespace": self.module.namespace, "imports": self.GetImports(args), "kinds": self.module.kinds, "enums": self.module.enums, "module": resolver.ResolveConstants(self.module, ExpressionToText), "structs": self.GetStructs() + self.GetStructsFromMethods(), "interfaces": self.GetInterfaces(), "imported_interfaces": self.GetImportedInterfaces(), "imported_from": self.ImportedFrom(), }
def GetParameters(self, args): package = self.module.name.split('.')[0] # True if handles are used anywhere in the mojom. has_handles = any( not mojom.IsCloneableKind(kind) for kind in (self.GetStructs() + self.GetStructsFromMethods() + self.GetUnions())) parameters = { "namespace": self.module.namespace, "imports": self.GetImports(args), "kinds": self.module.kinds, "enums": self.module.enums, "module": resolver.ResolveConstants(self.module, ExpressionToText), "structs": self.GetStructs() + self.GetStructsFromMethods(), "unions": self.GetUnions(), "interfaces": self.GetInterfaces(), "imported_interfaces": self.GetImportedInterfaces(), "imported_from": self.ImportedFrom(), "typepkg": '%s.' % _mojom_types_pkg_short, "descpkg": '%s.' % _service_describer_pkg_short, "mojom_types_import": 'import \'%s\' as %s;' % \ (_mojom_types_pkg, _mojom_types_pkg_short), "service_describer_import": 'import \'%s\' as %s;' % \ (_service_describer_pkg, _service_describer_pkg_short), "has_handles": has_handles, } # If this is the mojom types package, clear the import-related params. if package == _mojom_types_pkg_short: parameters["typepkg"] = "" parameters["mojom_types_import"] = "" # If this is the service describer package, clear the import-related params. if package == _service_describer_pkg_short: parameters["descpkg"] = "" parameters["service_describer_import"] = "" # If no interfaces were defined, the service describer import isn't needed. if len(self.module.interfaces) == 0: parameters["service_describer_import"] = "" return parameters