python类__version__()的实例源码

basic.py 文件源码 项目:hangoutsbot 作者: das7pad 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def version(bot, event, *args):
    """get the version of the bot and dependencies (admin-only)"""

    version_info = []

    version_info.append(_("Bot Version: **{}**").format(__version__)) # hangoutsbot
    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))
main.py 文件源码 项目:Deep-Subspace-Clustering 作者: tonyabracadabra 项目源码 文件源码 阅读 17 收藏 0 点赞 0 评论 0
def usage():
    print "SMOP compiler version " + __version__
    print """Usage: smop [options] file-list
    Options:
    -V --version
    -X --exclude=FILES      Ignore files listed in comma-separated list FILES.
                            Can be used several times.
    -S --syntax-errors=FILES Ignore syntax errors in comma-separated list of FILES.
                            Can be used several times.
    -S.                     Always gnore syntax errors 
    -d --dot=REGEX          For functions whose names match REGEX, save debugging
                            information in "dot" format (see www.graphviz.org).
                            You need an installation of graphviz to use --dot
                            option.  Use "dot" utility to create a pdf file.
                            For example: 
                                $ python main.py fastsolver.m -d "solver|cbest"
                                $ dot -Tpdf -o resolve_solver.pdf resolve_solver.dot
    -h --help
    -o --output=FILENAME    By default create file named a.py
    -o- --output=-          Use standard output
    -s --strict             Stop on the first error
    -v --verbose
"""
ndwi.py 文件源码 项目:bfalg-ndwi 作者: venicegeo 项目源码 文件源码 阅读 16 收藏 0 点赞 0 评论 0
def parse_args(args):
    """ Parse arguments for the NDWI algorithm """
    desc = 'Beachfront Algorithm: NDWI (v%s)' % __version__
    dhf = argparse.ArgumentDefaultsHelpFormatter
    parser = argparse.ArgumentParser(description=desc, formatter_class=dhf)

    parser.add_argument('-i', '--input', help='Input image (1 or 2 files)', required=True, action='append')
    parser.add_argument('-b', '--bands', help='Band numbers for Green and NIR bands', default=[1, 1], nargs=2, type=int)

    parser.add_argument('--outdir', help='Save intermediate files to this dir (otherwise temp)', default='')
    h = 'Basename to give to output files (no extension, defaults to first input filename'
    parser.add_argument('--basename', help=h, default=None)

    parser.add_argument('--l8bqa', help='Landat 8 Quality band (used to mask clouds)')
    parser.add_argument('--coastmask', help='Mask non-coastline areas', default=defaults['coastmask'], action='store_true')
    parser.add_argument('--minsize', help='Minimum coastline size', default=defaults['minsize'], type=float)
    parser.add_argument('--close', help='Close line strings within given pixels', default=defaults['close'], type=int)
    parser.add_argument('--simple', help='Simplify using tolerance in map units', default=None, type=float)
    parser.add_argument('--smooth', help='Smoothing from 0 (none) to 1.33 (no corners', default=defaults['smooth'], type=float)
    h = '0: Quiet, 1: Debug, 2: Info, 3: Warn, 4: Error, 5: Critical'
    parser.add_argument('--verbose', help=h, default=2, type=int)
    parser.add_argument('--version', help='Print version and exit', action='version', version=__version__)

    return parser.parse_args(args)
jonah.py 文件源码 项目:jonah 作者: elgatosf 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def help(self, argv=('jonah',)):
        """Output the help screen"""
        output = "Jonah {} -- ".format(version.__version__)

        output += "USAGE:\n"
        output += "  {} <COMMAND>, where <COMMMAND> is one of the following:\n".format(argv[0])

        commands = {"General": ['init', 'build', 'clean_build', 'cleanup', 'version'],
                    "Development": ['develop', 'reload', 'shell', 'stop', 'test', 'compilemessages'],
                    "Deployment": ['stage', 'deploy', 'tag', 'direct_deploy']}

        for group_name in commands.keys():
            output += "\n  {}:\n".format(group_name)
            for command_name in commands[group_name]:
                command_help = textwrap.wrap(getattr(self, command_name).__doc__, 56)
                output += "  - {}\t{}\n".format(command_name.ljust(12), command_help[0])
                if len(command_help) > 1:
                    for additional_line in command_help[1:]:
                        output += (" " * 20) + "\t" + additional_line + "\n"

        return output

    # Helper Methods ###################################################################################################
main.py 文件源码 项目:PyWallet 作者: AndreMiras 项目源码 文件源码 阅读 18 收藏 0 点赞 0 评论 0
def load_about(self):
        self.about_text_property = "" + \
            "PyWallet version: %s\n" % (__version__) + \
            "Project source code and info available on GitHub at: \n" + \
            "[color=00BFFF][ref=github]" + \
            self.project_page_property + \
            "[/ref][/color]"
main.py 文件源码 项目:PyWallet 作者: AndreMiras 项目源码 文件源码 阅读 18 收藏 0 点赞 0 评论 0
def configure_sentry(in_debug=False):
    """
    Configure the Raven client, or create a dummy one if `in_debug` is `True`.
    """
    key = 'eaee971c463b49678f6f352dfec497a9'
    # the public DSN URL is not available on the Python client
    # so we're exposing the secret and will be revoking it on abuse
    # https://github.com/getsentry/raven-python/issues/569
    secret = '4f37fdbde03a4753b78abb84d11f45ab'
    project_id = '191660'
    dsn = 'https://{key}:{secret}@sentry.io/{project_id}'.format(
        key=key, secret=secret, project_id=project_id)
    if in_debug:
        client = DebugRavenClient()
    else:
        client = Client(dsn=dsn, release=__version__)
        # adds context for Android devices
        if platform == 'android':
            from jnius import autoclass
            Build = autoclass("android.os.Build")
            VERSION = autoclass('android.os.Build$VERSION')
            android_os_build = {
                'model': Build.MODEL,
                'brand': Build.BRAND,
                'device': Build.DEVICE,
                'manufacturer': Build.MANUFACTURER,
                'version_release': VERSION.RELEASE,
            }
            client.user_context({'android_os_build': android_os_build})
        # Logger.error() to Sentry
        # https://docs.sentry.io/clients/python/integrations/logging/
        handler = SentryHandler(client)
        handler.setLevel(LOG_LEVELS.get('error'))
        setup_logging(handler)
    return client
app.py 文件源码 项目:user-sync.py 作者: adobe-apiplatform 项目源码 文件源码 阅读 16 收藏 0 点赞 0 评论 0
def process_args():
    '''
    Validates the application arguments, and resolves the arguments into a Namespace object.
    :rtype: Namespace object with argument values mapped to destination properties. The mapping is defined in the
        argument parser.
    '''
    parser = argparse.ArgumentParser(description="User Sync Test from Adobe")
    parser.add_argument("-v", "--version",
                        action="version",
                        version="%(prog)s " + APP_VERSION)
    parser.add_argument("-c", "--test-suite-config-filename",
                        help="main test suite config filename.",
                        metavar="filename",
                        dest="config_filename",
                        default=DEFAULT_CONFIG_FILENAME)
    parser.add_argument("-g", "--test-group-name",
                        help="test group to limit testing to.",
                        metavar="group",
                        dest="test_group_name",
                        default=None)
    parser.add_argument("-t", "--test",
                        help="test name",
                        metavar="name of test",
                        dest="test_name",
                        default=None)
    parser.add_argument("-l", "--live",
                        help="sets the user-sync-test tool in Live mode, which directs user-sync to communicate "
                             "with the ummapi server, and overwrites any recorded session with the communication "
                             "and output from this new live session. (Playback mode is the default mode.)",
                        action="store_true",
                        dest="live_mode")
    parser.add_argument("-p", "--playback",
                        help="sets the user-sync-test tool in Playback mode, which suppresses any communication "
                             "with the umapi server, and instead plays back the responses recorded from the server "
                             "during the last live session. (This is the default mode.)",
                        action="store_false",
                        dest="live_mode")
    parser.set_defaults(live_mode=False)
    return parser.parse_args()
Client.py 文件源码 项目:p2pool-bch 作者: amarian12 项目源码 文件源码 阅读 18 收藏 0 点赞 0 评论 0
def SOAPUserAgent():
    return "SOAPpy " + __version__ + " (pywebsvcs.sf.net)"
Server.py 文件源码 项目:p2pool-bch 作者: amarian12 项目源码 文件源码 阅读 15 收藏 0 点赞 0 评论 0
def version_string(self):
        return '<a href="http://pywebsvcs.sf.net">' + \
            'SOAPpy ' + __version__ + '</a> (Python ' + \
            sys.version.split()[0] + ')'
keyrotator.py 文件源码 项目:keyrotator 作者: GoogleCloudPlatform 项目源码 文件源码 阅读 16 收藏 0 点赞 0 评论 0
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__)
Client.py 文件源码 项目:p2pool-unitus 作者: amarian12 项目源码 文件源码 阅读 19 收藏 0 点赞 0 评论 0
def SOAPUserAgent():
    return "SOAPpy " + __version__ + " (pywebsvcs.sf.net)"
Server.py 文件源码 项目:p2pool-unitus 作者: amarian12 项目源码 文件源码 阅读 18 收藏 0 点赞 0 评论 0
def version_string(self):
        return '<a href="http://pywebsvcs.sf.net">' + \
            'SOAPpy ' + __version__ + '</a> (Python ' + \
            sys.version.split()[0] + ')'
Client.py 文件源码 项目:p2pool-dgb-sha256 作者: ilsawa 项目源码 文件源码 阅读 17 收藏 0 点赞 0 评论 0
def SOAPUserAgent():
    return "SOAPpy " + __version__ + " (pywebsvcs.sf.net)"
Server.py 文件源码 项目:p2pool-dgb-sha256 作者: ilsawa 项目源码 文件源码 阅读 18 收藏 0 点赞 0 评论 0
def version_string(self):
        return '<a href="http://pywebsvcs.sf.net">' + \
            'SOAPpy ' + __version__ + '</a> (Python ' + \
            sys.version.split()[0] + ')'
Client.py 文件源码 项目:p2pool-ltc 作者: ilsawa 项目源码 文件源码 阅读 18 收藏 0 点赞 0 评论 0
def SOAPUserAgent():
    return "SOAPpy " + __version__ + " (pywebsvcs.sf.net)"
Server.py 文件源码 项目:p2pool-ltc 作者: ilsawa 项目源码 文件源码 阅读 17 收藏 0 点赞 0 评论 0
def version_string(self):
        return '<a href="http://pywebsvcs.sf.net">' + \
            'SOAPpy ' + __version__ + '</a> (Python ' + \
            sys.version.split()[0] + ')'
Client.py 文件源码 项目:p2pool-bsty 作者: amarian12 项目源码 文件源码 阅读 17 收藏 0 点赞 0 评论 0
def SOAPUserAgent():
    return "SOAPpy " + __version__ + " (pywebsvcs.sf.net)"
Server.py 文件源码 项目:p2pool-bsty 作者: amarian12 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
def version_string(self):
        return '<a href="http://pywebsvcs.sf.net">' + \
            'SOAPpy ' + __version__ + '</a> (Python ' + \
            sys.version.split()[0] + ')'
Client.py 文件源码 项目:p2pool-cann 作者: ilsawa 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
def SOAPUserAgent():
    return "SOAPpy " + __version__ + " (pywebsvcs.sf.net)"
Server.py 文件源码 项目:p2pool-cann 作者: ilsawa 项目源码 文件源码 阅读 17 收藏 0 点赞 0 评论 0
def version_string(self):
        return '<a href="http://pywebsvcs.sf.net">' + \
            'SOAPpy ' + __version__ + '</a> (Python ' + \
            sys.version.split()[0] + ')'
pwnup.py 文件源码 项目:pwnup 作者: vitapluvia 项目源码 文件源码 阅读 16 收藏 0 点赞 0 评论 0
def run(self):
    host, port = self.checkArgs()
    log.info("Running PwnUp {}".format(version.__version__))
    connection = self.chooseClientType(host, port)
    interaction = self.interact(connection)
    self.saveFile(connection, interaction)
    log.info("Client Written to {}".format(self.filename))
__main__.py 文件源码 项目:Protector 作者: trivago 项目源码 文件源码 阅读 20 收藏 0 点赞 0 评论 0
def show_version():
    """
    Show program version an quit
    :return:
    """
    from version import __version__
    print("{} {}".format(__package__, __version__))
    sys.exit(0)
__init__.py 文件源码 项目:DealershipSimulation 作者: creechD 项目源码 文件源码 阅读 27 收藏 0 点赞 0 评论 0
def _init(engine):
    global Interface, EVENT, Control, FunctionControl, Label, Textbox, Text, load_image, __version__, initialized
    import env
    env.engine = engine
    from interface import Interface, EVENT
    from control import Control, FunctionControl, Label, Textbox
    from util import Text, load_image
    from version import __version__
    initialized = True
ObjectUpdater.py 文件源码 项目:DownloaderForReddit 作者: MalloyDelacroix 项目源码 文件源码 阅读 17 收藏 0 点赞 0 评论 0
def update_user(cls, user):
        """
        Creates a new User object with current methods and attributes and fills in the new users attributes with
        attributes from the old user object.
        :param user: The User object which is to be updated.
        :type user: User
        """
        new_user = User(__version__, user.name, user.save_path, user.post_limit, user.avoid_duplicates,
                        user.download_videos, user.download_images, user.name_downloads_by, user.user_added)
        cls.update_extras(user, new_user)
        return new_user
ObjectUpdater.py 文件源码 项目:DownloaderForReddit 作者: MalloyDelacroix 项目源码 文件源码 阅读 18 收藏 0 点赞 0 评论 0
def update_subreddit(cls, sub):
        """
        Creates a new Subreddit object with current methods and attributes and fills in the new subs attributes with
        the attributes from the old subreddit object.
        :param sub: The outdated subreddit object wich is to be updated.
        :type sub: Subreddit
        """
        new_sub = Subreddit(__version__, sub.name, sub.save_path, sub.post_limit, sub.avoid_duplicates,
                            sub.download_videos, sub.download_images, sub.subreddit_save_method, sub.name_downloads_by,
                            sub.user_added)
        cls.update_extras(sub, new_sub)
        return new_sub
UserFinder.py 文件源码 项目:DownloaderForReddit 作者: MalloyDelacroix 项目源码 文件源码 阅读 17 收藏 0 点赞 0 评论 0
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.reddit = 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
AboutDialog.py 文件源码 项目:DownloaderForReddit 作者: MalloyDelacroix 项目源码 文件源码 阅读 23 收藏 0 点赞 0 评论 0
def __init__(self):
        """
        Opens the "about" dialog box which displays the licensing information
        """
        QtWidgets.QDialog.__init__(self)
        self.setupUi(self)
        self.settings_manager = Core.Injector.get_settings_manager()
        geom = self.settings_manager.about_dialog_geom
        self.restoreGeometry(geom if geom is not None else self.saveGeometry())

        self.buttonBox.accepted.connect(self.accept)

        pixmap = QtGui.QPixmap('Images/RedditDownloaderIcon.png')
        pixmap = pixmap.scaled(QtCore.QSize(183, 186), QtCore.Qt.KeepAspectRatio)
        self.logo_label.setFixedWidth(80)
        self.logo_label.setFixedHeight(82)
        self.logo_label.setPixmap(pixmap)
        self.logo_label.setScaledContents(True)

        self.info_label.setText('Version: %s\nAuthor: Kyle H' % __version__)
        self.info_label.setScaledContents(True)

        self.link_label.setText('Homepage: <a href="https://github.com/MalloyDelacroix/DownloaderForReddit">Downloader for Reddit</a>')
        self.link_label.setToolTip('https://github.com/MalloyDelacroix/DownloaderForReddit')

        self.license_box.setOpenExternalLinks(True)

        self.total_downloads_label.setText("Total Downloads: %s" % self.settings_manager.total_files_downloaded)
Client.py 文件源码 项目:SOAPpy 作者: jfsanchez-gh 项目源码 文件源码 阅读 18 收藏 0 点赞 0 评论 0
def SOAPUserAgent():
    return "SOAPpy " + __version__ + " (pywebsvcs.sf.net)"
Server.py 文件源码 项目:SOAPpy 作者: jfsanchez-gh 项目源码 文件源码 阅读 18 收藏 0 点赞 0 评论 0
def version_string(self):
        return '<a href="http://pywebsvcs.sf.net">' + \
            'SOAPpy ' + __version__ + '</a> (Python ' + \
            sys.version.split()[0] + ')'
collector.py 文件源码 项目:llama 作者: dropbox 项目源码 文件源码 阅读 32 收藏 0 点赞 0 评论 0
def __init__(self, name, ip, port, *args, **kwargs):
        """Constructor.

        Args:
            name:  (str) name of Flask service
            ip:  (str) IP address to bind HTTP server
            port:  (int) TCP port for HTTP server to listen
        """
        super(HttpServer, self).__init__(name, *args, **kwargs)
        # Fixup the root path for Flask so it can find templates/*
        root_path = os.path.abspath(os.path.dirname(__file__))
        logging.debug('Setting root_path for Flask: %s', root_path)
        self.root_path = root_path
        self.targets = config.CollectorConfig()
        self.ip = ip
        self.port = port
        self.start_time = time.time()
        self.setup_time = 0
        self.scheduler = BackgroundScheduler(
            daemon=True, executors=self.EXECUTORS)
        self.collection = None
        self.add_url_rule('/', 'index', self.index_handler)
        self.add_url_rule('/status', 'status', self.status_handler)
        self.add_url_rule('/latency', 'latency', self.latency_handler)
        self.add_url_rule('/influxdata', 'influxdata', self.influxdata_handler)
        self.add_url_rule('/quitquit', 'quitquit', self.shutdown_handler)
        logging.info('Starting Llama Collector, version %s', __version__)


问题


面经


文章

微信
公众号

扫码关注公众号