コード例 #1
0
def main():
    client = pymongo.MongoClient(
        "mongodb://*****:*****@trab-top-esp-bd-shard-00-00-3bzqm.mongodb.net:27017,trab-top-esp-bd-shard-00-01-3bzqm.mongodb.net:27017,trab-top-esp-bd-shard-00-02-3bzqm.mongodb.net:27017/test?ssl=true&replicaSet=trab-top-esp-bd-shard-0&authSource=admin&retryWrites=true"
    )
    migration.migrate(client.test)

    # user = User('Marcus', client.test)
    # try:
    #     user.favorite_product('2233')
    # except pymongo.errors.DuplicateKeyError:
    #     print("Voc j possui este produto adicionado em sua lista.")
    # print(user.buy_list())

    exit_program = False
    nome = intro_menu()
    user = User(nome, client.test)
    # user.favorite_product('48214')
    while exit_program is False:
        print("Bem-vindo, " + user.name + '!\n')
        print("O que deseja fazer?\n\n"
              "1) Procurar produto\n"
              "2) Lista de Compras\n"
              "3) Sair")
        resposta = raw_input()

        if resposta == '1':
            search_product_menu(user)
        if resposta == '2':
            shop_list_menu(user)
        if resposta == '3':
            print("\nAte mais, " + nome + '!')
            exit_program = True
コード例 #2
0
ファイル: sysman.py プロジェクト: samuelbaizg/ssguan
    def execute(self):
        action = self._get_str_parameter("action", "")
        if action == "migrate":
            migration.migrate(self._get_user_id())
        elif action == "downgrade":
            ver_id = self._get_int_parameter("verid")
            migration.downgrade(ver_id, self._get_user_id())

        migrations = migration.fetch_migrations(self._get_user_id())
        html = (
            "<div class='sysman-buttonbar'><span onclick='sysman.migrate()' title='Migrate'>Migrate</span></td></div>"
        )
        html += "<table>"
        for mig in migrations:
            tr = "<tr>"
            tr += "<td><p>%d</p></td>" % mig.ver_id
            tr += "<td><p>%r</p></td>" % mig.is_upgraded
            tr += "<td><p>%r</p></td>" % mig.migration_time
            tr += "<td><p>%r</p></td>" % mig.modifier_id
            tr += "<td><p>%r</p></td>" % mig.created_time
            tr += "<td><p>%r</p></td>" % mig.modified_time
            tr += "<td><span onclick='sysman.downgrade(\"%s\")' title='Downgrade'>X</span></td>" % (mig.ver_id)
            tr += "</tr>"
            html += tr
        html += "</table>"
        return html
コード例 #3
0
def doMain(args):
    # Parse all legacy files.
    import seqan.dddoc.core as core
    app = core.App()
    for path in args.legacy_doc_dirs:
        print 'Scanning %s...' % path
        app.loadFiles(path)
    migrated_doc = raw_doc.RawDoc()
    if args.legacy_doc_dirs:
        app.loadingComplete()
        migrated_doc.entries = migration.migrate(app.dddoc_tree)
        print 'migrated_doc.entries', [e.name.text for e in migrated_doc.entries]
    # Parse all normal input files.
    fmgr = file_mgr.FileManager()
    master_doc = raw_doc.RawDoc()
    master_doc.merge(migrated_doc)
    fns = FileNameSource(args.inputs)
    for filename in fns.generate():
        if args.debug:
            print 'Processing %s' % filename
        the_file = fmgr.loadFile(filename)
        lex = lexer.Lexer(dox_tokens.LEXER_TOKENS, skip_whitespace=False)
        for comment in the_file.comments:
            # TODO(holtgrew): Also give offset.
            lex.input(comment.text, filename, comment.line, comment.col, comment.offset_col)
            parser = dox_parser.Parser()
            try:
                parser.parse(lex)
            except dox_parser.ParserError, e:
                dox_parser.printParserError(e)
                return 1
            master_doc.merge(parser.documentation)
コード例 #4
0
def update(app):

    """ Any updates can go here... """

    curr_version = getattr(app, "pycms_version", "unknown")
    tgt_version = version

    if curr_version != tgt_version:

        migrated = migrate(curr_version, tgt_version)

        if migrated:
            setattr(app, "pycms_version", tgt_version)
コード例 #5
0
ファイル: addon.py プロジェクト: Heckie75/kodi-addon-timers
import migration
from resources.lib.timer.scheduler import Scheduler
# from resources.lib.utils.system_utils import set_windows_unlock

if __name__ == "__main__":

    migration.migrate()

    Scheduler().start()

    # scheduler = Scheduler()
    # try:
    #     scheduler.start()

    # finally:
    #     scheduler.resetPowermanagementDisplaysoff()
    #     set_windows_unlock(False)
コード例 #6
0
ファイル: bot.py プロジェクト: arbaes/reaction-light
from itertools import cycle
from urllib.request import urlopen
from sys import platform, exit as shutdown

import discord
from discord.ext import commands, tasks

import rldb
import migration

# Original Repository: https://github.com/eibex/reaction-light
# License: MIT - Copyright 2019-2020 eibex

directory = os.path.dirname(os.path.realpath(__file__))

migrated = migration.migrate()
config_migrated = migration.migrateconfig()

with open(f"{directory}/.version") as f:
    __version__ = f.read().rstrip("\n").rstrip("\r")

folder = f"{directory}/files"
config = configparser.ConfigParser()
config.read(f"{directory}/config.ini")
TOKEN = str(config.get("server", "token"))
prefix = str(config.get("server", "prefix"))
botname = str(config.get("server", "name"))

Client = discord.Client()
bot = commands.Bot(command_prefix=prefix)
bot.remove_command("help")
コード例 #7
0
ファイル: search.py プロジェクト: bskim45/alfred-helm-hub
def main(wf):
    log = wf.logger

    if len(wf.args):
        query = wf.args[0]
    else:
        query = None

    log.info('user query: "%s"', query)

    # do workflow migration
    migrate(wf)

    if wf.update_available:
        wf.add_item('New version is available',
                    subtitle='Click to install the update',
                    autocomplete='workflow:update',
                    icon=ICON_INFO)

    if not query:
        add_default_item(wf)
        wf.send_feedback()
        return 0

    charts = []

    if is_artifacthub_enabled(wf):

        def search():
            api = ArtifactHubClient()
            return api.get_charts(query)

        charts.extend(
            wf.cached_data(ArtifactHubClient.get_cache_key(query),
                           search,
                           max_age=30))

    if is_chartcenter_enabled(wf):

        def search():
            api = ChartCenterClient()
            return api.get_charts(query)

        charts.extend(
            wf.cached_data(ChartCenterClient.get_cache_key(query),
                           search,
                           max_age=30))

    if is_hub_enabled(wf):

        def search():
            api = HubClient()
            q = query
            if '/' in q:
                q = q.split('/')[-1]
            return api.get_charts(q)

        charts.extend(
            wf.cached_data(HubClient.get_cache_key(query), search, max_age=30))

    log.info('%d charts found', len(charts))

    if query:
        # filter results that query only appears in the chart id
        charts = wf.filter(query, charts, key=generate_search_key)

    for chart in charts:
        wf.add_item(title='{0} ({1})'.format(chart.chart_id, chart.version),
                    subtitle=chart.description,
                    arg=chart.web_url,
                    valid=True,
                    icon=wf.workflowfile(chart.icon))

    if not charts:
        if '/' in query:
            chart_name = query.split('/')[-1]
            wf.add_item(
                title='Do you want to try with "{0}"?'.format(chart_name),
                subtitle='Try to search without a repository name',
                autocomplete=chart_name)

        if is_artifacthub_enabled(wf):
            wf.add_item('No charts found for "{0}"'.format(query),
                        subtitle='Click to search in ArtifactHub',
                        arg=ArtifactHubClient.BASE_URL,
                        valid=True)

        if is_chartcenter_enabled(wf):
            wf.add_item('No charts found for "{0}"'.format(query),
                        subtitle='Click to search in ChartCenter',
                        arg=ChartCenterClient.BASE_URL,
                        valid=True)

        if is_hub_enabled(wf):
            wf.add_item('No charts found for "{0}"'.format(query),
                        subtitle='Click to see the results in Helm Hub',
                        arg='{0}/charts?q={1}'.format(HubClient.HUB_BASE_URL,
                                                      query),
                        valid=True)
    else:
        add_default_item(wf)

    wf.send_feedback()
コード例 #8
0
def migrate(ctx, **kwargs):
    """ Update Infrastructure Repository to the latest configuration """
    logging.basicConfig(level=kwargs.get('log_level'))
    migration.migrate(kwargs['branch'], kwargs['yes'])
コード例 #9
0
print(BLUE + "#############################################")
print(GREEN + "#############################################")
print(RED + "#############################################")
print(CYAN + "#############################################")
print(BOLD + "Starting the migration of the elements")
print(BLUE + "#############################################")
print(GREEN + "#############################################")
print(RED + "#############################################")
print(CYAN + "#############################################\n\n")
errorFound = ['list of errors']
successFound = ['list of working project']

# cleanAmberProject(AmberDir)
# launchTest(FtagDir,FtagTarget)

result = migration.migrate(ActionBarCompatSampleDir,
                           ActionBarCompatSampleTarget)  #Works fine
successFound = successFound + result[0]
errorFound = errorFound + result[1]

result = migration.migrate(
    AmberDir, AmberTarget
)  #Failed: AndoidxMigration failed with android.support.design and projectName and myGradleGroupd are Res :(
successFound = successFound + result[0]
errorFound = errorFound + result[1]

result = migration.migrate(ChronoDir, ChronoTarget)  #Fine
successFound = successFound + result[0]
errorFound = errorFound + result[1]

result = migration.migrate(
    ForecastDir,