Sha256: 40af4691a0ba85bffbb6e2dbf238d385adb8f6abe073d62fcc8032fbbfd1eb16

Contents?: true

Size: 1.22 KB

Versions: 67

Compression:

Stored size: 1.22 KB

Contents

from javonet.core.generator.handler.AbstractGeneretatorHandler import AbstractGeneratorHandler
import keyword


class SharedMethodNameHandler(AbstractGeneratorHandler):
    def generate_command(self, analyzed_object, parent_command, handlers):
        return analyzed_object

    def generate_code(self, existing_string_builder, common_command, used_object, handlers):
        if keyword.iskeyword(used_object):
            used_object += used_object[-1]
        if "@" in used_object:
            used_object = used_object.replace("@", "")
        if "-" in used_object:
            used_object = used_object.replace("-", "_")
        if used_object[0].isdigit():
            pos = 0
            for i, x in enumerate(used_object):
                if x.isdigit():  # True if its a number
                    pos = i  # first letter position
                break

            new_str = used_object[pos:]
            used_object = new_str
        if used_object[0].isupper():
            used_object = used_object[0].lower() + used_object[1:]
        if used_object.isidentifier():
            existing_string_builder.append(used_object)
        else:
            raise NameError("SharedMethodNameHandlerError: Given name is not valid: " + used_object)

Version data entries

67 entries across 38 versions & 1 rubygems

Version Path
javonet-ruby-sdk-2.1.10 lib/javonet-ruby-sdk/Binaries/Python/Linux/X64/javonet/core/generator/handler/shared/SharedMethodNameHandler.py
javonet-ruby-sdk-2.1.9 lib/javonet-ruby-sdk/Binaries/Python/Linux/X64/javonet/core/generator/handler/shared/SharedMethodNameHandler.py
javonet-ruby-sdk-2.1.9 lib/javonet-ruby-sdk/Binaries/Python/MacOs/X64/javonet/core/generator/handler/shared/SharedMethodNameHandler.py
javonet-ruby-sdk-2.1.8 lib/javonet-ruby-sdk/Binaries/Python/MacOs/X64/javonet/core/generator/handler/shared/SharedMethodNameHandler.py
javonet-ruby-sdk-2.1.8 lib/javonet-ruby-sdk/Binaries/Python/Linux/X64/javonet/core/generator/handler/shared/SharedMethodNameHandler.py
javonet-ruby-sdk-2.1.7 lib/javonet-ruby-sdk/Binaries/Python/MacOs/X64/javonet/core/generator/handler/shared/SharedMethodNameHandler.py
javonet-ruby-sdk-2.1.7 lib/javonet-ruby-sdk/Binaries/Python/Linux/X64/javonet/core/generator/handler/shared/SharedMethodNameHandler.py
javonet-ruby-sdk-2.1.6 lib/javonet-ruby-sdk/Binaries/Python/MacOs/X64/javonet/core/generator/handler/shared/SharedMethodNameHandler.py
javonet-ruby-sdk-2.1.6 lib/javonet-ruby-sdk/Binaries/Python/Linux/X64/javonet/core/generator/handler/shared/SharedMethodNameHandler.py
javonet-ruby-sdk-2.1.5 lib/javonet-ruby-sdk/Binaries/Python/Linux/X64/javonet/core/generator/handler/shared/SharedMethodNameHandler.py
javonet-ruby-sdk-2.1.5 lib/javonet-ruby-sdk/Binaries/Python/MacOs/X64/javonet/core/generator/handler/shared/SharedMethodNameHandler.py
javonet-ruby-sdk-2.1.4 lib/javonet-ruby-sdk/Binaries/Python/MacOs/X64/javonet/core/generator/handler/shared/SharedMethodNameHandler.py
javonet-ruby-sdk-2.1.4 lib/javonet-ruby-sdk/Binaries/Python/Linux/X64/javonet/core/generator/handler/shared/SharedMethodNameHandler.py
javonet-ruby-sdk-2.1.3 lib/javonet-ruby-sdk/Binaries/Python/MacOs/X64/javonet/core/generator/handler/shared/SharedMethodNameHandler.py
javonet-ruby-sdk-2.1.3 lib/javonet-ruby-sdk/Binaries/Python/Linux/X64/javonet/core/generator/handler/shared/SharedMethodNameHandler.py
javonet-ruby-sdk-2.1.2 lib/javonet-ruby-sdk/Binaries/Python/MacOs/X64/javonet/core/generator/handler/shared/SharedMethodNameHandler.py
javonet-ruby-sdk-2.1.2 lib/javonet-ruby-sdk/Binaries/Python/Linux/X64/javonet/core/generator/handler/shared/SharedMethodNameHandler.py
javonet-ruby-sdk-2.1.1 lib/javonet-ruby-sdk/Binaries/Python/MacOs/X64/javonet/core/generator/handler/shared/SharedMethodNameHandler.py
javonet-ruby-sdk-2.1.1 lib/javonet-ruby-sdk/Binaries/Python/Linux/X64/javonet/core/generator/handler/shared/SharedMethodNameHandler.py
javonet-ruby-sdk-2.1.0 lib/javonet-ruby-sdk/Binaries/Python/MacOs/X64/javonet/core/generator/handler/shared/SharedMethodNameHandler.py