__  __    __   __  _____      _            _          _____ _          _ _ 
 |  \/  |   \ \ / / |  __ \    (_)          | |        / ____| |        | | |
 | \  / |_ __\ V /  | |__) | __ ___   ____ _| |_ ___  | (___ | |__   ___| | |
 | |\/| | '__|> <   |  ___/ '__| \ \ / / _` | __/ _ \  \___ \| '_ \ / _ \ | |
 | |  | | |_ / . \  | |   | |  | |\ V / (_| | ||  __/  ____) | | | |  __/ | |
 |_|  |_|_(_)_/ \_\ |_|   |_|  |_| \_/ \__,_|\__\___| |_____/|_| |_|\___V 2.1
 if you need WebShell for Seo everyday contact me on Telegram
 Telegram Address : @jackleet
        
        
For_More_Tools: Telegram: @jackleet | Bulk Smtp support mail sender | Business Mail Collector | Mail Bouncer All Mail | Bulk Office Mail Validator | Html Letter private



Upload:

Command:

www-data@216.73.217.60: ~ $
# SPDX-License-Identifier: Apache-2.0
# Copyright 2019 The Meson development team

from __future__ import annotations

import abc
import re
import typing as T

if T.TYPE_CHECKING:
    from ..minit import Arguments


class SampleImpl(metaclass=abc.ABCMeta):

    def __init__(self, args: Arguments):
        self.name = args.name
        self.version = args.version
        self.lowercase_token = re.sub(r'[^a-z0-9]', '_', self.name.lower())
        self.uppercase_token = self.lowercase_token.upper()
        self.capitalized_token = self.lowercase_token.capitalize()

    @abc.abstractmethod
    def create_executable(self) -> None:
        pass

    @abc.abstractmethod
    def create_library(self) -> None:
        pass

    @abc.abstractproperty
    def exe_template(self) -> str:
        pass

    @abc.abstractproperty
    def exe_meson_template(self) -> str:
        pass

    @abc.abstractproperty
    def lib_template(self) -> str:
        pass

    @abc.abstractproperty
    def lib_test_template(self) -> T.Optional[str]:
        pass

    @abc.abstractproperty
    def lib_meson_template(self) -> str:
        pass

    @abc.abstractproperty
    def source_ext(self) -> str:
        pass


class ClassImpl(SampleImpl):

    """For Class based languages, like Java and C#"""

    def create_executable(self) -> None:
        source_name = f'{self.capitalized_token}.{self.source_ext}'
        with open(source_name, 'w', encoding='utf-8') as f:
            f.write(self.exe_template.format(project_name=self.name,
                                             class_name=self.capitalized_token))
        with open('meson.build', 'w', encoding='utf-8') as f:
            f.write(self.exe_meson_template.format(project_name=self.name,
                                                   exe_name=self.name,
                                                   source_name=source_name,
                                                   version=self.version))

    def create_library(self) -> None:
        lib_name = f'{self.capitalized_token}.{self.source_ext}'
        test_name = f'{self.capitalized_token}_test.{self.source_ext}'
        kwargs = {'utoken': self.uppercase_token,
                  'ltoken': self.lowercase_token,
                  'class_test': f'{self.capitalized_token}_test',
                  'class_name': self.capitalized_token,
                  'source_file': lib_name,
                  'test_source_file': test_name,
                  'test_exe_name': f'{self.lowercase_token}_test',
                  'project_name': self.name,
                  'lib_name': self.lowercase_token,
                  'test_name': self.lowercase_token,
                  'version': self.version,
                  }
        with open(lib_name, 'w', encoding='utf-8') as f:
            f.write(self.lib_template.format(**kwargs))
        if self.lib_test_template:
            with open(test_name, 'w', encoding='utf-8') as f:
                f.write(self.lib_test_template.format(**kwargs))
        with open('meson.build', 'w', encoding='utf-8') as f:
            f.write(self.lib_meson_template.format(**kwargs))


class FileImpl(SampleImpl):

    """File based languages without headers"""

    def create_executable(self) -> None:
        source_name = f'{self.lowercase_token}.{self.source_ext}'
        with open(source_name, 'w', encoding='utf-8') as f:
            f.write(self.exe_template.format(project_name=self.name))
        with open('meson.build', 'w', encoding='utf-8') as f:
            f.write(self.exe_meson_template.format(project_name=self.name,
                                                   exe_name=self.name,
                                                   source_name=source_name,
                                                   version=self.version))

    def lib_kwargs(self) -> T.Dict[str, str]:
        """Get Language specific keyword arguments

        :return: A dictionary of key: values to fill in the templates
        """
        return {
            'utoken': self.uppercase_token,
            'ltoken': self.lowercase_token,
            'header_dir': self.lowercase_token,
            'class_name': self.capitalized_token,
            'function_name': f'{self.lowercase_token[0:3]}_func',
            'namespace': self.lowercase_token,
            'source_file': f'{self.lowercase_token}.{self.source_ext}',
            'test_source_file': f'{self.lowercase_token}_test.{self.source_ext}',
            'test_exe_name': f'{self.lowercase_token}_test',
            'project_name': self.name,
            'lib_name': self.lowercase_token,
            'test_name': self.lowercase_token,
            'version': self.version,
        }

    def create_library(self) -> None:
        lib_name = f'{self.lowercase_token}.{self.source_ext}'
        test_name = f'{self.lowercase_token}_test.{self.source_ext}'
        kwargs = self.lib_kwargs()
        with open(lib_name, 'w', encoding='utf-8') as f:
            f.write(self.lib_template.format(**kwargs))
        if self.lib_test_template:
            with open(test_name, 'w', encoding='utf-8') as f:
                f.write(self.lib_test_template.format(**kwargs))
        with open('meson.build', 'w', encoding='utf-8') as f:
            f.write(self.lib_meson_template.format(**kwargs))


class FileHeaderImpl(FileImpl):

    @abc.abstractproperty
    def header_ext(self) -> str:
        pass

    @abc.abstractproperty
    def lib_header_template(self) -> str:
        pass

    def lib_kwargs(self) -> T.Dict[str, str]:
        kwargs = super().lib_kwargs()
        kwargs['header_file'] = f'{self.lowercase_token}.{self.header_ext}'
        return kwargs

    def create_library(self) -> None:
        super().create_library()
        kwargs = self.lib_kwargs()
        with open(kwargs['header_file'], 'w', encoding='utf-8') as f:
            f.write(self.lib_header_template.format_map(kwargs))

Filemanager

Name Type Size Permission Actions
__pycache__ Folder 0755
__init__.py File 0 B 0644
cpptemplates.py File 3.07 KB 0644
cstemplates.py File 2.04 KB 0644
ctemplates.py File 2.88 KB 0644
cudatemplates.py File 3.08 KB 0644
dlangtemplates.py File 2.52 KB 0644
fortrantemplates.py File 2.23 KB 0644
javatemplates.py File 2.13 KB 0644
mesontemplates.py File 3 KB 0644
objcpptemplates.py File 2.99 KB 0644
objctemplates.py File 2.91 KB 0644
rusttemplates.py File 1.86 KB 0644
samplefactory.py File 1.37 KB 0644
sampleimpl.py File 5.78 KB 0644
valatemplates.py File 1.97 KB 0644
Filemanager