Пример #1
0
 def create_script(
     self,
     name: Optional[str] = None,
     yml: Optional[dict] = None,
     code: str = '',
     readme: str = '',
     description: str = '',
     changelog: str = '',
     image: bytes = b'',
     create_unified=False,
 ) -> Script:
     if name is None:
         name = f'script{len(self.scripts)}'
     if yml is None:
         yml = {
             'commonfields': {
                 'id': name,
                 'version': -1
             },
             'name': name,
             'comment': f'this is script {name}',
             'type': 'python',
             'subtype': 'python3',
             'script': '-',
         }
     script = Script(self._scripts_path,
                     name,
                     self._repo,
                     create_unified=create_unified)
     script.build(code, yml, readme, description, changelog, image)
     self.scripts.append(script)
     return script
Пример #2
0
 def create_script(
         self,
         name: Optional[str] = None,
         yml: Optional[dict] = None,
         code: str = '',
         readme: str = '',
         description: str = '',
         changelog: str = '',
         image: bytes = b''
 ) -> Script:
     if name is None:
         name = f'script{len(self.integrations)}'
     if yml is None:
         yml = {}
     script = Script(self._scripts_path, name, self._repo)
     script.build(
         code,
         yml,
         readme,
         description,
         changelog,
         image
     )
     self.scripts.append(script)
     return script