Python version.__version__() Examples

The following are 30 code examples of version.__version__(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module version , or try the search function .
Example #1
Source File: main.py    From doufen with MIT License 6 votes vote down vote up
def parse_args(args):
    """
    解析命令参数
    """
    parser = argparse.ArgumentParser(
        prog=version.__prog_name__,
        description=version.__description__
    )
    parser.add_argument('-v', '--version', action='version',
                        version='%(prog)s ' + version.__version__)
    parser.add_argument('-d', '--debug', action='store_true',
                        default=DEFAULT_DEBUG_MODE, help='print debug information')
    parser.add_argument('-p', '--port', type=int, default=DEFAULT_SERVICE_PORT,
                        metavar='port', help='specify the port to listen')
    parser.add_argument('-s', '--save', default=DEFAULT_DATEBASE,
                        metavar='database', dest='database', help='specify the database file')
    parser.add_argument('-c', '--cache', default=DEFAULT_CACHE_PATH,
                        metavar='cache', dest='cache', help='specify the cache path')
    parser.add_argument('-l', '--log', default=DEFAULT_LOG_PATH,
                        metavar='log', dest='log', help='specify the log files path')
    parser.add_argument('-q', '--quiet', action='store_true',
                        default=DEFAULT_SILENT_MODE, help='switch on silent mode')
                        
    return parser.parse_args(args) 
Example #2
Source File: publish.py    From macprefs with MIT License 6 votes vote down vote up
def main():
    if len(sys.argv) > 1 and sys.argv[1] == '-test':
        return False
    version = __version__
    check_for_uncommitted_files()
    create_version_tag_and_push(version)
    filename = version + '.tar.gz'
    download_tar(filename)
    sha256 = calc_sha256(filename)
    content = create_brew_formula_file_content(version, sha256)
    sha = get_sha_of_old_macprefs_formula()
    upload_new_brew_formula(content, version, sha)
    cleanup()
    download_macprefs()
    verify_macprefs()

    print('Success')

    return True 
Example #3
Source File: fabfile.py    From pynb with MIT License 6 votes vote down vote up
def git_push(ctx):
    """
    Push new version and corresponding tag to origin
    :return:
    """

    # get current version
    new_version = version.__version__
    values = list(map(lambda x: int(x), new_version.split('.')))

    # Push to origin new version and corresponding tag:
    # * commit new version
    # * create tag
    # * push version,tag to origin
    local(ctx, f'git add {project_name}/version.py version.py')

    local(ctx, 'git commit -m "updated version"')
    local(ctx, f'git tag {values[0]}.{values[1]}.{values[2]}')
    local(ctx, 'git push origin --tags')
    local(ctx, 'git push') 
Example #4
Source File: fabfile.py    From pynb with MIT License 6 votes vote down vote up
def inc_version():
    """
    Increment micro release version (in 'major.minor.micro') in version.py and re-import it.
    Major and minor versions must be incremented manually in version.py.

    :return: list with current version numbers, e.g., [0,1,23].
    """

    new_version = version.__version__

    values = list(map(lambda x: int(x), new_version.split('.')))
    values[2] += 1

    with open("version.py", "w") as f:
        f.write(f'__version__ = "{values[0]}.{values[1]}.{values[2]}"\n')
        f.write(f'__pkgname__ = "{project_name}"\n')
    with open(f"{project_name}/version.py", "w") as f:
        f.write(f'__version__ = "{values[0]}.{values[1]}.{values[2]}"\n')
        f.write(f'__pkgname__ = "{project_name}"\n')

    importlib.reload(version)

    print(f'Package {version.__pkgname__} current version: {version.__version__}')

    return values 
Example #5
Source File: basic.py    From hangoutsbot with GNU Affero General Public License v3.0 6 votes vote down vote up
def version(bot, event, *args):
    """get the version of the bot and dependencies (admin-only)"""

    version_info = []
    commit = _git_status()

    version_info.append(_("Bot Version: **{}**").format(__version__)) # hangoutsbot
    if commit:
        version_info.append(_("Git: **{}**").format(commit))
    version_info.append(_("Python Version: **{}**").format(sys.version.split()[0])) # python

    # display extra version information only if user is an admin

    admins_list = bot.get_config_suboption(event.conv_id, 'admins')
    if event.user.id_.chat_id in admins_list:
        # depedencies
        modules = args or [ "aiohttp", "appdirs", "emoji", "hangups", "telepot" ]
        for module_name in modules:
            try:
                _module = importlib.import_module(module_name)
                version_info.append(_("* {} **{}**").format(module_name, _module.__version__))
            except(ImportError, AttributeError):
                pass

    yield from bot.coro_send_message(event.conv, "\n".join(version_info)) 
Example #6
Source File: plugin.py    From Galaxy_Plugin_Bethesda with MIT License 6 votes vote down vote up
def __init__(self, reader, writer, token):
        super().__init__(Platform.Bethesda, __version__, reader, writer, token)
        self._http_client = AuthenticatedHttpClient(self.store_credentials)
        self.bethesda_client = BethesdaClient(self._http_client)
        self.local_client = LocalClient()

        self.local_client.local_games_cache = self.persistent_cache.get('local_games')
        if not self.local_client.local_games_cache:
            self.local_client.local_games_cache = {}

        self.products_cache = product_cache
        self.owned_games_cache = None

        self._asked_for_local = False

        self.update_game_running_status_task = None
        self.update_game_installation_status_task = None
        self.betty_client_process_task = None
        self.check_for_new_games_task = None
        self.running_games = {}
        self.launching_lock = None
        self._tick = 1 
Example #7
Source File: plugin.py    From galaxy_blizzard_plugin with MIT License 6 votes vote down vote up
def install_game(self, game_id):
        if not self.authentication_client.is_authenticated():
            raise AuthenticationRequired()

        installed_game = self.local_client.get_installed_games().get(game_id, None)
        if installed_game and os.access(installed_game.install_path, os.F_OK):
            log.warning("Received install command on an already installed game")
            return await self.launch_game(game_id)

        if game_id in [classic.uid for classic in Blizzard.CLASSIC_GAMES]:
            if SYSTEM == pf.WINDOWS:
                platform = 'windows'
            elif SYSTEM == pf.MACOS:
                platform = 'macos'
            webbrowser.open(f"https://www.blizzard.com/download/confirmation?platform={platform}&locale=enUS&version=LIVE&id={game_id}")
            return
        try:
            self.local_client.refresh()
            log.info(f'Installing game of id {game_id}')
            self.local_client.install_game(game_id)
        except ClientNotInstalledError as e:
            log.warning(e)
            await self.open_battlenet_browser()
        except Exception as e:
            log.exception(f"Installing game {game_id} failed: {e}") 
Example #8
Source File: Server.py    From p2pool-n with GNU General Public License v3.0 5 votes vote down vote up
def version_string(self):
        return '<a href="http://pywebsvcs.sf.net">' + \
            'SOAPpy ' + __version__ + '</a> (Python ' + \
            sys.version.split()[0] + ')' 
Example #9
Source File: scanpdf.py    From scanpdf with Apache License 2.0 5 votes vote down vote up
def main():
    args = docopt.docopt(__doc__, version='Scan PDF %s' % __version__ )
    script = ScanPdf()
    print(args)
    script.go(args) 
Example #10
Source File: publish.py    From macprefs with MIT License 5 votes vote down vote up
def verify_macprefs():
    result = execute_shell(['macprefs', '--version'])
    message = '\nworkspace:\t' + __version__ + '\ninstalled:\t' + result
    assert __version__ in result, message
    print('version check verified' + message) 
Example #11
Source File: test_publish.py    From macprefs with MIT License 5 votes vote down vote up
def test_verify_macprefs_throws_assertion_error(execute_shell_mock):
    execute_shell_mock.return_value = 'asdf'
    try:
        publish.verify_macprefs()
        assert False, 'expected AssertionError'
    except AssertionError as e:
        execute_shell_mock.assert_called_with(['macprefs', '--version'])
        assert __version__ in '\n'.join(e.args) 
Example #12
Source File: test_publish.py    From macprefs with MIT License 5 votes vote down vote up
def test_verify_macprefs(execute_shell_mock):
    execute_shell_mock.return_value = __version__
    publish.verify_macprefs()
    execute_shell_mock.assert_called_with(['macprefs', '--version']) 
Example #13
Source File: fabfile.py    From pynb with MIT License 5 votes vote down vote up
def pkgupload(ctx):
    pathname = f'dist/{project_name}-{version.__version__}.tar.gz'
    local(ctx, 'twine upload -u "{}" -p "{}" "{}"'.format(pypi_auth["user"], pypi_auth["pass"], pathname)) 
Example #14
Source File: cli.py    From cloudformation-environmentbase with BSD 2-Clause "Simplified" License 5 votes vote down vote up
def __init__(self, quiet=False, doc=__doc__):
        """
        CLI constructor is responsible for parsing sys.argv to collect configuration information.
        If you need to change the config file from the default name set the property 'config_filename'
        from the constructor.
        quiet: is provided to suppress output, primarily for unit testing
        """
        self.quiet = quiet

        self.args = docopt(doc, version='environmentbase %s' % version.__version__)

        # Parsing this config filename here is required since
        # the file is already loaded in self.update_config()
        self.config_filename = self.args.get('--config-file') 
Example #15
Source File: keyrotator.py    From keyrotator with Apache License 2.0 5 votes vote down vote up
def main():
  log_filename = "keyrotator" + time.strftime("-%Y-%m-%d-%H%M") + ".log"
  logging.basicConfig(filename=log_filename, level=logging.INFO)
  logging.getLogger("").addHandler(logging.StreamHandler())
  logging.info("Logging established in %s.", log_filename)

  dispatch(__doc__, version=__version__) 
Example #16
Source File: gtk.py    From bups with MIT License 5 votes vote down vote up
def on_about_clicked(self, btn):
		dialog = Gtk.AboutDialog()
		dialog.set_transient_for(self)
		dialog.set_title('Bups')
		dialog.set_name('Bups')
		dialog.set_program_name('Bups')
		dialog.set_version(__version__)
		dialog.set_authors(['Emersion'])
		dialog.set_comments(_('Simple GUI for Bup, a very efficient backup system.'))
		dialog.set_website('https://github.com/emersion/bups')
		dialog.set_logo_icon_name('drive-harddisk')
		dialog.set_license(_('Distributed under the MIT license.')+'\nhttp://opensource.org/licenses/MIT')
		dialog.run()
		dialog.destroy() 
Example #17
Source File: sv.py    From nanosv with MIT License 5 votes vote down vote up
def __init__(self, id, breakpoint):
        self.id = id

        self.chr = breakpoint.segment_1["rname"]
        self.chr2 = breakpoint.segment_2["rname"]
        self.flag1 = breakpoint.segment_1["flag"]
        self.flag2 = breakpoint.segment_2["flag"]
        self.pos = [breakpoint.segment_1["pos"]]
        self.ref = 'N'
        self.alt = str(breakpoint.svtype)
        self.qual = None
        self.filter = []
        self.info = {
            'ALT_READ_IDS': [bam.segments[breakpoint.segment_1['id'][0]][breakpoint.segment_1['id'][1]][breakpoint.segment_1['id'][2]].qname],
            'REF_READ_IDS_1': [],
            'REF_READ_IDS_2': [],
            'IMPRECISE': True,
            'END': [breakpoint.segment_2["pos"]],
            'SVTYPE': breakpoint.svtype,
            'SVMETHOD': 'NanoSV_v'+__version__,
        }
        self.format = {
            'GT': './.',
            'DV': [1, 1],
            'VO': [(1 - 10 ** (-breakpoint.segment_1["mapq"] / 10.0)),
                   (1 - 10 ** (-breakpoint.segment_2["mapq"] / 10.0))],
            'DR': [0, 0],
            'RO': [0, 0],
            'HR': [0, 0]
        }
        self.breakpoints = [breakpoint.id]
        self.set = 0
        self.SVcluster = 1
        self.ref_qname_clips = [[], []] 
Example #18
Source File: create_vcf.py    From nanosv with MIT License 5 votes vote down vote up
def set_info_header(vcf):
    """
    Create info header in vcf output file
    :param vcf used to add infos to file:
    """
    vcf.infos = {
        'IMPRECISE': py_vcf.parser._Info("IMPRECISE", 0, "Flag", "Imprecise structural variant", "NanoSV", __version__),
        'SVTYPE': py_vcf.parser._Info("SVTYPE", 1, "String", "Type of structural variant", "NanoSV", __version__),
        'SVMETHOD': py_vcf.parser._Info("SVMETHOD", 1, "String", "Type of approach used to detect SV", "NanoSV", __version__),
        'END': py_vcf.parser._Info("END", 1, "Integer", "End position of structural variant", "NanoSV", __version__),
        'CIPOS': py_vcf.parser._Info("CIPOS", 2, "Integer", "Confidence interval around POS", "NanoSV", __version__),
        'CIEND': py_vcf.parser._Info("CIEND", 2, "Integer", "Confidence interval around END", "NanoSV", __version__),
        'SVLEN': py_vcf.parser._Info("SVLEN", None, "Integer", "Distance between the two genomic positions", "NanoSV", __version__),
        'RT': py_vcf.parser._Info("RT", 3, "Integer", "Number of the different read types (2d, template, complement)","NanoSV", __version__),
        'GAP': py_vcf.parser._Info("GAP", 1, "Integer","Median number of bases between the two segments of the SV, in case of an insertion this is the size of the insertion","NanoSV", __version__),
        'MAPQ': py_vcf.parser._Info("MAPQ", 2, "Integer","Median mapping quality of the two segments of the structural variant", "NanoSV",__version__),
        'PID': py_vcf.parser._Info("PID", 2, "Float","Median percentage identity to the reference of the two segments of the structural variant","NanoSV", __version__),
        'PLENGTH': py_vcf.parser._Info("PLENGTH", 2, "Float","Median segment length percentage of the two segments of the structural variant","NanoSV", __version__),
        'RLENGTH': py_vcf.parser._Info("RLENGTH", 1, "Integer", "Median length of the total reads", "NanoSV", __version__),
        'MATEID': py_vcf.parser._Info('MATEID', None, 'String', 'ID of mate breakend', 'NanoSV', __version__),
        'PURITY_SCORE': py_vcf.parser._Info('PURITY_SCORE', None, "Integer", "Purity of clusters after phasing", "NanoSV", __version__),
        'PHASING_SCORE': py_vcf.parser._Info('PHASING_SCORE', None, "Integer", "Percentage of reads in two largest clusters after phasing", "NanoSV", __version__),
        'SNPS_USED': py_vcf.parser._Info('SNPS_USED', None, "Integer", "SNPs used during phasing", "NanoSV", __version__),
        'ALT_READ_IDS': py_vcf.parser._Info('ALT_READ_IDS', None, "String", "Read ids of the supporting alt reads", "NanoSV", __version__),
        'REF_READ_IDS_1': py_vcf.parser._Info('REF_READ_IDS_1', None, "String", "Read ids of the supporting reference reads for bp1", "NanoSV", __version__),
        'REF_READ_IDS_2': py_vcf.parser._Info('REF_READ_IDS_2', None, "String", "Read ids of the supporting reference reads for bp2", "NanoSV", __version__)
    }

    if NanoSV.opts_depth_support:
        vcf.infos['DEPTHPVAL'] = py_vcf.parser._Info("DEPTHPVAL", 1, "Float", "In case of a duplication or deletion the P-value of the significance test is shown here", "NanoSV", __version__) 
Example #19
Source File: client.py    From pybtracker with MIT License 5 votes vote down vote up
def main():
    parser = argparse.ArgumentParser(description='UDP tracker.')
    parser.add_argument(
        'tracker_uri', metavar='URI',
        help='The tracker URI.')
    parser.add_argument(
        '--log-to-stdout', '-O', action='store_true', default=False,
        help='Log to standard output.')
    parser.add_argument('--log-file', '-l', help='Log to the specified file.')
    parser.add_argument(
        '--log-level', '-L', default='info',
        choices=['debug', 'info', 'warning', 'error', 'critical'],
        help='Set log level. Defaults to "info".')
    parser.add_argument(
        '--version', '-V', action='version',
        version='pybtracker v' + __version__)

    args = parser.parse_args()
    setup_logging(args)

    shell = ClientShell(args)
    try:
        shell.cmdloop()
    except KeyboardInterrupt:
        print()
    finally:
        if not shell.is_closed:
            shell.close() 
Example #20
Source File: about.py    From kcauto with GNU General Public License v3.0 5 votes vote down vote up
def get_layout(cls):
        return sg.Column(
            [
                [sg.Column([[]], size=(cls.PRIMARY_COL_TAB_SIZE[0], 1))],
                [sg.Text("kcauto", font=cls.TITLE_FONT, pad=(0, (140, 0)))],
                [sg.Text(f"v{__version__}", font=cls.FONT_9)],
                [sg.Text(
                    "github",
                    key='link_github',
                    font=cls.FONT_10 + ('bold', ),
                    text_color='blue',
                    enable_events=True
                )],
                [
                    sg.Text(
                        "brought to you by",
                        font=cls.FONT_10,
                        pad=(0, (30, 0))),
                    sg.Text(
                        "mrmin123",
                        font=cls.FONT_10 + ('bold', ),
                        pad=(0, (30, 0))),
                ],
                [sg.Text(
                    "support on patreon",
                    key='link_patreon',
                    font=cls.FONT_10 + ('bold', ),
                    text_color='blue',
                    enable_events=True
                )],
            ],
            key='gui_tab_about',
            visible=False,
            size=cls.PRIMARY_COL_TAB_SIZE,
            element_justification='center',
            justification='center'
        ) 
Example #21
Source File: args_core.py    From kcauto with GNU General Public License v3.0 5 votes vote down vote up
def __init__(self):
        self.parser = argparse.ArgumentParser(
            description=(
                f"kcauto v{__version__} - "
                "automating your Kantai Collection needs"))
        self.parser.add_argument(
            '--cli', action='store_true',
            help="run kcauto without a GUI as a command-line script")
        self.parser.add_argument(
            '-c', '--cfg', type=str, action='store', default='config',
            help=(
                "name of config file to load (without .json) in the config "
                "directory; defaults to 'config' for the config.json file in "
                "the config directory"))
        self.parser.add_argument(
            '--cfg-path', type=str, action='store',
            help=(
                "full filepath of config file to load (with .json). Used for "
                "loading config files not in the config directory"))
        self.parser.add_argument(
            '--debug-output', action='store_true',
            help="enable granular kcauto debug log output")
        self.parser.add_argument(
            '--no-click-track', action='store_true',
            help="disable internal tracking of click locations")
        self.parser.add_argument(
            '--debug', action='store_true',
            help=(
                "debug mode that runs a 'find_all' on the screen. Use with "
                "--debug-asset and --debug-similarity"))
        self.parser.add_argument(
            '--debug-asset', type=str, action='store',
            help="asset to search for in debug mode")
        self.parser.add_argument(
            '--debug-similarity', type=float, action='store', default=DEFAULT,
            help=(
                "similarity to search asset with in debug mode; defaults to "
                f"{DEFAULT}")) 
Example #22
Source File: Client.py    From p2pool-n with GNU General Public License v3.0 5 votes vote down vote up
def SOAPUserAgent():
    return "SOAPpy " + __version__ + " (pywebsvcs.sf.net)" 
Example #23
Source File: window_menuitem.py    From openxenmanager with GNU General Public License v2.0 5 votes vote down vote up
def on_menuitem_help_activate(self, widget, data=None):
        """
        "About" menu item is pressed (Help)
        """
        # Show about dialog
        about = self.builder.get_object("aboutdialog")

        about.set_version(__version__)
        about.show() 
Example #24
Source File: config.py    From graham_discord_bot with MIT License 5 votes vote down vote up
def instance(cls) -> 'Config':
        if cls._instance is None:
            cls._instance = cls.__new__(cls)
            try:
                with open(f"{Utils.get_project_root().joinpath(pathlib.PurePath('config.yaml'))}", "r") as in_yaml:
                    cls.yaml = yaml.load(in_yaml, Loader=yaml.FullLoader)
            except FileNotFoundError:
                cls.yaml = None
            parser = argparse.ArgumentParser(description=f"Graham {'BANANO' if Env.banano() else 'Nano'} Discord Bot v{__version__}")
            parser.add_argument('-p', '--prefix', type=str, help='Command prefix for bot commands', default='!')
            parser.add_argument('-l', '--log-file', type=str, help='Log file location', default='/tmp/graham_bot.log')
            parser.add_argument('-s', '--status', type=str, help="The bot's 'playing status'", default=None, required=False)
            parser.add_argument('-u', '--node-url', type=str, help='URL of the node, e.g.: http://[::1]:7072', default='http://[::1]:7072' if Env.banano() else 'http://[::1]:7076')
            parser.add_argument('--debug', action='store_true', help='Runs in debug mode if specified', default=False)
            options, unknown = parser.parse_known_args()

            # Parse options
            cls.command_prefix = options.prefix
            if len(cls.command_prefix) != 1:
                print("Command prefix can only be 1 character")
                exit(1)
            cls.log_file = options.log_file
            cls.debug = options.debug
            cls.playing_status = f"{cls.command_prefix}help for help" if options.status is None else options.status

            cls.bot_token = os.getenv('BOT_TOKEN')
            if cls.bot_token is None:
                print("BOT_TOKEN must be set in your environment")
                exit(1)
            cls.wallet = os.getenv('WALLET_ID')
            if cls.wallet is  None:
                print("WALLET_ID must be specified in your environment")
                exit(1)

            cls.node_url = options.node_url
        return cls._instance 
Example #25
Source File: bot.py    From graham_discord_bot with MIT License 5 votes vote down vote up
def on_ready():
	logger.info(f"Starting Graham v{__version__}")
	logger.info(f"Discord.py version {discord.__version__}")
	logger.info(f"Bot name: {client.user.name}")
	logger.info(f"Bot Discord ID: {client.user.id}")
	await client.change_presence(activity=discord.Game(config.playing_status))

	# Process any transactions in our DB that are outstanding
	logger.info(f"Re-queueing any unprocessed transactions")
	unprocessed_txs = await Transaction.filter(block_hash=None, destination__not_isnull=True).all().prefetch_related('sending_user', 'receiving_user')
	for tx in unprocessed_txs:
		await TransactionQueue.instance(bot=client).put(tx)
	logger.info(f"Re-queued {len(unprocessed_txs)} transactions") 
Example #26
Source File: help.py    From graham_discord_bot with MIT License 5 votes vote down vote up
def get_help_pages(self, cmd_dict: dict, adminhelp: bool = False) -> list:
        """Builds paginated help menu"""
        pages = []
        # Overview
        author=f"Graham v{__version__} ({'BANANO' if Env.banano() else 'Nano'}) edition"
        title="Command Overview"
        description=("Use `{0}help command` for more information about a specific command " +
                " or go to the next page").format(config.Config.instance().command_prefix)
        entries = []
        for k, cmd_list in cmd_dict.items():
            for cmd in cmd_dict[k]['cmd_list']:
                entries.append(Entry(f"{config.Config.instance().command_prefix}{cmd.triggers[0]}", cmd.overview))
        if adminhelp:
            entries.append(Entry(f"{config.Config.instance().command_prefix}adminhelp", "View the full list of admin commands"))
        pages.append(Page(entries=entries, title=title,author=author, description=description))
        # Build detail pages
        for group, details in cmd_dict.items():
            author=cmd_dict[group]['header']
            description=cmd_dict[group]['info']
            entries = self.get_entries(cmd_dict[group]['cmd_list'])
            pages.append(Page(entries=entries, author=author,description=description))
        # Info
        entries = [Entry(f"{config.Config.instance().command_prefix}{tips.TIPAUTHOR_INFO.triggers[0]}", tips.TIPAUTHOR_INFO.details)]
        author=f"Graham v{__version__} for {Env.currency_name()}"
        heart = '\U0001F49B' if Env.banano() else '\U0001F499'
        description = "This bot is completely free, open source, and MIT licensed"
        description+= f"\n\nMade with {heart} for the **BANANO** and **NANO** communities"
        description+= f"\nHangout with some awesome people at https://chat.banano.cc"
        description+= f"\nMy Discord: **@bbedward#9246**"
        description+= f"\nMy Reddit: **/u/bbedward**"
        description+= f"\nMy Twitter: **@theRealBbedward**"
        description+= f"\n\nGraham GitHub: https://github.com/bbedward/graham_discord_bot"
        pages.append(Page(entries=entries, author=author,description=description))
        return pages 
Example #27
Source File: main.py    From IncetOps with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def GlobalTemplateVariables():
    data = {"Version": __version__, "Author": __author__, "Email": __email__, "Doc": __doc__, "sso_server": SSO["sso_server"].strip("/")}
    return data 
Example #28
Source File: plugin.py    From galaxy_blizzard_plugin with MIT License 5 votes vote down vote up
def __init__(self, reader, writer, token):
        super().__init__(Platform.Battlenet, version, reader, writer, token)
        self.local_client = LocalClient(self._update_statuses)
        self.authentication_client = AuthenticatedHttpClient(self)
        self.backend_client = BackendClient(self, self.authentication_client)

        self.watched_running_games = set()
        self.local_games_called = False 
Example #29
Source File: main.py    From SwarmOps with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def GlobalTemplateVariables():
    data = {"Version": __version__, "Author": __author__, "Email": __email__, "Doc": __doc__}
    return data 
Example #30
Source File: UserFinder_Obsolete.py    From DownloaderForReddit with GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, sub_list, black_list, top_sort_method, score_limit, sample_size, existing_users, save_path,
                 imgur_client, previously_found):
        """
        A class that searches supplied subreddits for top posts (of the user set period) and collects the names of users
        who have submitted posts that scored above the set score limit.  It will then download the user specified sample
        size of posts and display them on the second page.  Also has methods to add any found users to the main download
        users list as well as methods to exclude certain users that the user wishes not to include.  Parts of this class
        work similar to the parts of the main program, but on a smaller scale.  For instance, when a user is found an
        instance of the User class is created for them with preset settings supplied.  This class is only used
        temporarily and if the user is added to the main list the instance is destroyed and a new instance made with the
        proper overall settings.

        :param sub_list: The sub list supplied by the UserFinderGUI which is to be searched for top posts
        :param black_list: A list of users who are not to be included even if their posts reach the score limit
        :param top_sort_method: The period of top posts to be searched (eg: day, week, etc.)
        :param score_limit: The limit that post scores must be above to be considered
        :param sample_size: The number of posts that are to be downloaded if the conditions are met
        :param existing_users: A list of users already added to the main GUI lists that will be emitted from search
        :param save_path: The save path of the special UserFinder directory where the user finder posts are stored
        :param imgur_client: An instance of the imgure client that is supplied to temporarily created users
        :param previously_found: A list of users that have been previously found and will not be included in the search
        """
        super().__init__()
        self._r = praw.Reddit(user_agent='python:DownloaderForReddit:%s (by /u/MalloyDelacroix)' % __version__,
                              client_id='frGEUVAuHGL2PQ', client_secret=None)
        self.sub_list = sub_list
        self.black_list = black_list
        self.top_sort_method = top_sort_method
        self.score_limit = score_limit
        self.sample_size = sample_size
        self.existing_users = existing_users
        self.save_path = save_path
        self.imgur_client = imgur_client
        self.previously_found_users = previously_found
        self.validated_subreddits = []
        self.found_users = []
        self.queue = Queue()
        self.content_count = 0