Пример #1
0
    def __init__(self) -> None:
        self.englishFile = open("en-es/source.final.file-found")
        self.spanishFile = open("en-es/reference.final.file-found")
        self.metadataFile = open("en-es/metadata.final.file-found")

        self.azureFile = open("machine-translations/azure.txt")
        self.ibmFile = open("machine-translations/ibm.txt")

        self.indexMap = indexes()
        self.objects = get_objects()
def get_stored_data(full=False):
    englishFile = open("en-es/source.final.file-found")
    spanishFile = open("en-es/reference.final.file-found")
    metadataFile = open("en-es/metadata.final.file-found")

    azureFile = open("machine-translations/azure.txt")
    ibmFile = open("machine-translations/ibm.txt")

    indexMap = indexes()
    objects = get_objects()

    referenceData = []
    translationData = []
    objectData = []

    if full:
        sourceData = []
        imageNameData = []

    for i in range(27367):
        # Machine translations
        azureLine = azureFile.readline()
        ibmLine = ibmFile.readline()
        translationData.append([azureLine[:-1], ibmLine[:-1]])

        # English reference caption
        referenceData.append(englishFile.readline())

        # Spanish source caption
        if full:
            sourceData.append(spanishFile.readline())

        # Image name
        metadataLine = metadataFile.readline()
        if full:
            imageNameData.append(metadataLine[:-1])

        # Objects
        imageIndex = indexMap[metadataLine[:-1]]
        imageNumber = int(imageIndex[3:]) - 1
        objectData.append(objects[imageNumber])

    if full:
        return (referenceData, translationData, objectData, imageNameData,
                sourceData)
    else:
        return (referenceData, translationData, objectData)
Пример #3
0
from get_objects import get_objects

fields = {
    "whitelist": [
        "^name$", r"^ip-protocol$", "^aggressive-aging$",
        "^keep-connections-open-after-policy-installation$", "^match-for-any$",
        r"^session-timeout$", "^source-port$", "^sync-connections-on-cluster$",
        "^tags$", "^color$", "^comments$"
    ],
    "blacklist": [],
    "translate": [
        # (#1, [(#2, #3)]) -> if field matches with regex #1 then in that field, replace regex #2 with regex #3
    ]
}

if __name__ == "__main__":
    get_objects("services-other", fields)
Пример #4
0
from get_objects import get_objects

fields = {
    "whitelist": [
        "^name$", "^ip-address$", "^ipv4-address$", "^ipv6-address$",
        "^color$", "^comments$", "^tags$", "^host-servers$"
    ],
    "blacklist": [],
    "translate": [
        # (#1, [(#2, #3)]) -> if field matches with regex #1 then in that field, replace regex #2 with regex #3
        (r"^groups\.[0-9]+\.name$", [(r"\.name", r"")])
    ]
}

if __name__ == "__main__":
    get_objects("hosts", fields)
Пример #5
0
from get_objects import get_objects

fields = {
    "whitelist": [
        "^name$", r"^port$", "^aggressive-aging$",
        "^keep-connections-open-after-policy-installation$", "^match-for-any$",
        r"^session-timeout$", "^source-port$", "^sync-connections-on-cluster$",
        "^tags$", "^color$", "^comments$"
    ],
    "blacklist": [],
    "translate": [
        # (#1, [(#2, #3)]) -> if field matches with regex #1 then in that field, replace regex #2 with regex #3
    ]
}

if __name__ == "__main__":
    get_objects("services-sctp", fields)
Пример #6
0
from get_objects import get_objects

fields = {
    "whitelist": [
        "^name$", "^machines$", "^networks$", "^remote-access-clients$",
        "^tags$", "^users$", "^color$", r"^comments"
    ],
    "blacklist": [],
    "translate": [
        # (#1, [(#2, #3)]) -> if field matches with regex #1 then in that field, replace regex #2 with regex #3
    ]
}

if __name__ == "__main__":
    get_objects("access-roles", fields)
from get_objects import get_objects

fields = {
    "whitelist": [
        "^name$", "^accept-replies$", "^aggressive-aging$",
        "^keep-connections-open-after-policy-installation$", "^match-for-any$",
        r"^port$", r"^session-timeout$", "^source-port$",
        "^sync-connections-on-cluster$", "^tags$", "^color$", "^comments$"
    ],
    "blacklist": [],
    "translate": [
        # (#1, [(#2, #3)]) -> if field matches with regex #1 then in that field, replace regex #2 with regex #3
    ]
}

if __name__ == "__main__":
    get_objects("services-udp", fields)
Пример #8
0
from get_objects import get_objects

fields = {
    "whitelist": ["^name$", "^tags$", "^color$", "^comments$"],
    "blacklist": ["uid"],
    "translate": [
        # (#1, [(#2, #3)]) -> if field matches with regex #1 then in that field, replace regex #2 with regex #3
    ]
}

if __name__ == "__main__":
    get_objects("dynamic-objects", fields)
Пример #9
0
from get_objects import get_objects

fields = {
    "whitelist":
    ["^name$", r"^members\.[0-9]+\.name$", "^tags$", "^color$", "^comments$"],
    "blacklist": ["uid"],
    "translate": [
        # (#1, [(#2, #3)]) -> if field matches with regex #1 then in that field, replace regex #2 with regex #3
        (r"^members\.[0-9]+\.name$", [(r"\.name", r"")])
    ]
}
dependency_solver_args = {"singular_type": "service-group"}
if __name__ == "__main__":
    get_objects("service-groups", fields, dependency_solver_args)
from get_objects import get_objects

fields = {
    "whitelist": [
        "^name$", "^url-list$", "^application-signature$",
        "^additional-categories$", "^description$", r"^primary-category$",
        r"^urls-defined-as-regular-expression$", "^tags$", "^color$",
        "^comments$"
    ],
    "blacklist": [],
    "translate": [
        # (#1, [(#2, #3)]) -> if field matches with regex #1 then in that field, replace regex #2 with regex #3
    ]
}

if __name__ == "__main__":
    get_objects("application-sites", fields)
Пример #11
0
from get_objects import get_objects


fields = {
    "whitelist": ["^name$", "^subnet4$", "^subnet6$", "^mask-length4$", "^mask-length6$", "^nat-settings$", "^tags$", "^broadcast$", "^color$", "^comments$"],
    "blacklist": ["uid", "domain"],
    "translate": [
        # (#1, [(#2, #3)]) -> if field matches with regex #1 then in that field, replace regex #2 with regex #3
        (r"^groups\.[0-9]+\.name$", [(r"\.name", r"")])
    ]
}

if __name__ == "__main__":
    get_objects("networks", fields)
Пример #12
0
from get_objects import get_objects

fields = {
    "whitelist": [
        "^name$", "^ip-address-first$", "^ipv4-address-first$",
        "^ipv6-address-first$", "^ip-address-last$", "^ipv4-address-last$",
        "^ipv6-address-last$", "^nat-settings$", "^tags$", "^color$",
        r"^comments"
    ],
    "blacklist": [],
    "translate": [
        # (#1, [(#2, #3)]) -> if field matches with regex #1 then in that field, replace regex #2 with regex #3
        (r"^groups\.[0-9]+\.name$", [(r"\.name", r"")])
    ]
}

if __name__ == "__main__":
    get_objects("address-ranges", fields)
Пример #13
0
from get_objects import get_objects

fields = {
    "whitelist": ["^name$", "^tags$", "^color$", "^comments$"],
    "blacklist": ["uid"],
    "translate": [
        # (#1, [(#2, #3)]) -> if field matches with regex #1 then in that field, replace regex #2 with regex #3
    ]
}

if __name__ == "__main__":
    get_objects("security-zones", fields)
Пример #14
0
from get_objects import get_objects


fields = {
    "whitelist": ["^name$", "^start$", "^start-now$", "^end$", "^end-never$", "^hours-ranges$", "^tags$", "^recurrence$", "^color$", "^comments$"],
    "blacklist": ["uid", "domain"],
    "translate": [
        # (#1, [(#2, #3)]) -> if field matches with regex #1 then in that field, replace regex #2 with regex #3
    ]
}

if __name__ == "__main__":
    get_objects("times", fields)
Пример #15
0
from get_objects import get_objects

fields = {
    "whitelist": [
        r"^name$", r"^applications-and-url-filtering$", r"^data-awareness$",
        r"^nat-settings", r"^detect-using-x-forward-for$", r"^firewall$",
        r"^mobile-access$", r"^show-parent-rule$", r"^shared$", r"^tags$",
        r"^color$", r"^comments$"
    ],
    "blacklist": [],
    "translate": [
        # (#1, [(#2, #3)]) -> if field matches with regex #1 then in that field, replace regex #2 with regex #3
    ]
}

if __name__ == "__main__":
    get_objects("access-layers", fields)
from get_objects import get_objects

fields = {
    "whitelist": [
        "^name$", "^include.name$", "^except.name$", "^tags$", "^color$",
        r"^comments$"
    ],
    "blacklist": [],
    "translate": [
        (r"^include.name$", [(r"\.name", r"")]),
        (r"^except.name$", [(r"\.name", r"")]),
    ]
}
dependency_solver_args = {
    "singular_type": "group-with-exclusion",
    "children_keys": ["include", "except"]
}
if __name__ == "__main__":
    get_objects("groups-with-exclusion", fields, dependency_solver_args)
from get_objects import get_objects

fields = {
    "whitelist": [
        "^name$", "^center-gateways\.[0-9]+\.name$",
        "^mesh-center-gateways\.[0-9]+\.name$",
        "^satellite-gateways\.[0-9]+\.name$", "^tags$", "^color$", "^comments$"
    ],
    "blacklist": [],
    "translate": [
        # (#1, [(#2, #3)]) -> if field matches with regex #1 then in that field, replace regex #2 with regex #3
        (r"^center-gateways\.[0-9]+\.name$", [(r"\.name", r"")]),
        (r"^satellite-gateways\.[0-9]+\.name$", [(r"\.name", r"")]),
        (r"^mesh-center-gateways\.[0-9]+\.name$", [(r"\.name", r"")]),
    ]
}

if __name__ == "__main__":
    get_objects("vpn-communities-star", fields)
from get_objects import get_objects

fields = {
    "whitelist":
    ["^name$", "^tags$", "^color$", "^comments$", r"^members\.[0-9]+\.name$"],
    "blacklist": ["uid"],
    "translate": [
        # (#1, [(#2, #3)]) -> if field matches with regex #1 then in that field, replace regex #2 with regex #3
        (r"^members\.[0-9]+\.name$", [(r"\.name", r"")]),
        (r"^groups\.[0-9]+\.name$", [(r"\.name", r"")]),
    ]
}
dependency_solver_args = {"singular_type": "application-site-group"}
if __name__ == "__main__":
    get_objects("application-site-groups", fields, dependency_solver_args)
Пример #19
0
from get_objects import get_objects


fields = {
    "whitelist": ["^name$", "^description$", "^new-name$", "^color$", "^comments$", "^tags$"],
    "blacklist": [],
    "translate": [
        # (#1, [(#2, #3)]) -> if field matches with regex #1 then in that field, replace regex #2 with regex #3
    ]
}

if __name__ == "__main__":
    get_objects("application-site-categories", fields)
from get_objects import get_objects

fields = {
    "whitelist": [
        "^name$", "^program-number$",
        "^keep-connections-open-after-policy-installation$", "^tags$",
        "^color$", "^comments$"
    ],
    "blacklist": [],
    "translate": [
        # (#1, [(#2, #3)]) -> if field matches with regex #1 then in that field, replace regex #2 with regex #3
    ]
}

if __name__ == "__main__":
    get_objects("services-rpc", fields)
from get_objects import get_objects


fields = {
    "whitelist": ["^name$", "^gateways\.[0-9]+\.name$", "^tags$", "^color$", "^comments$"],
    "blacklist": [],
    "translate": [
        # (#1, [(#2, #3)]) -> if field matches with regex #1 then in that field, replace regex #2 with regex #3
        (r"^gateways\.[0-9]+\.name$", [(r"\.name", r"")]),
    ]
}

if __name__ == "__main__":
    get_objects("vpn-communities-meshed", fields)
from get_objects import get_objects


fields = {
    "whitelist": ["^name$", "^aggressive-aging$", "^keep-connections-open-after-policy-installation$", "^match-for-any$", r"^port$", r"^session-timeout$", "^source-port$", "^sync-connections-on-cluster$", "^tags$", "^color$", "^comments$"],
    "blacklist": [],
    "translate": [
        # (#1, [(#2, #3)]) -> if field matches with regex #1 then in that field, replace regex #2 with regex #3
    ]
}

if __name__ == "__main__":
    get_objects("services-tcp", fields)