From 1cd50b25eaa7d9f493730177f956135279b2828e Mon Sep 17 00:00:00 2001 From: zhang_xubo <2578876417@qq.com> Date: Sat, 9 Oct 2021 11:38:20 +0800 Subject: [PATCH 1/6] test static --- script/test.py | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 script/test.py diff --git a/script/test.py b/script/test.py new file mode 100644 index 00000000..36684e7b --- /dev/null +++ b/script/test.py @@ -0,0 +1,27 @@ +""" +This is a test file. +Do not merge it +""" + +class classA: + + def __init__(self): + self.value1 = "" + + def function1(self): + """ + 测试大小写格式 + """ + var1 = "abc" + var2 = "123" + VAR3 = "dddd" + + def Function2(self): + """ + 测试大小写格式 + """ + print(123) + testValue = 123 + testvalue2 = 456 + test_value3 = 789 + print(testValue + testvalue2 + test_value3) \ No newline at end of file -- Gitee From e4fa57f10f5e428d73193db26b73e01190489ffa Mon Sep 17 00:00:00 2001 From: zhang_xubo <2578876417@qq.com> Date: Tue, 12 Oct 2021 14:23:57 +0800 Subject: [PATCH 2/6] test code check --- script/test.py | 163 ++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 161 insertions(+), 2 deletions(-) diff --git a/script/test.py b/script/test.py index 36684e7b..24f2d2a1 100644 --- a/script/test.py +++ b/script/test.py @@ -3,7 +3,7 @@ This is a test file. Do not merge it """ -class classA: +class ClassA: def __init__(self): self.value1 = "" @@ -24,4 +24,163 @@ class classA: testValue = 123 testvalue2 = 456 test_value3 = 789 - print(testValue + testvalue2 + test_value3) \ No newline at end of file + print(testValue + testvalue2 + test_value3) + + +class IPv6Network(_BaseV6, _BaseNetwork): + + """This class represents and manipulates 128-bit IPv6 networks. + + Attributes: [examples for IPv6('2001:db8::1000/124')] + .network_address: IPv6Address('2001:db8::1000') + .hostmask: IPv6Address('::f') + .broadcast_address: IPv6Address('2001:db8::100f') + .netmask: IPv6Address('ffff:ffff:ffff:ffff:ffff:ffff:ffff:fff0') + .prefixlen: 124 + + """ + + # Class to use when creating address objects + _address_class = IPv6Address + + def __init__(self, address, strict=True): + """Instantiate a new IPv6 Network object. + + Args: + address: A string or integer representing the IPv6 network or the + IP and prefix/netmask. + '2001:db8::/128' + '2001:db8:0000:0000:0000:0000:0000:0000/128' + '2001:db8::' + are all functionally the same in IPv6. That is to say, + failing to provide a subnetmask will create an object with + a mask of /128. + + Additionally, an integer can be passed, so + IPv6Network('2001:db8::') == + IPv6Network(42540766411282592856903984951653826560) + or, more generally + IPv6Network(int(IPv6Network('2001:db8::'))) == + IPv6Network('2001:db8::') + + strict: A boolean. If true, ensure that we have been passed + A true network address, eg, 2001:db8::1000/124 and not an + IP address on a network, eg, 2001:db8::1/124. + + Raises: + AddressValueError: If address isn't a valid IPv6 address. + NetmaskValueError: If the netmask isn't valid for + an IPv6 address. + ValueError: If strict was True and a network address was not + supplied. + + """ + _BaseNetwork.__init__(self, address) + + # Efficient constructor from integer or packed address + if isinstance(address, (bytes, _compat_int_types)): + self.network_address = IPv6Address(address) + self.netmask, self._prefixlen = self._make_netmask( + self._max_prefixlen) + return + + if isinstance(address, tuple): + if len(address) > 1: + arg = address[1] + else: + arg = self._max_prefixlen + self.netmask, self._prefixlen = self._make_netmask(arg) + self.network_address = IPv6Address(address[0]) + packed = int(self.network_address) + if packed & int(self.netmask) != packed: + if strict: + raise ValueError('%s has host bits set' % self) + else: + self.network_address = IPv6Address(packed & + int(self.netmask)) + return + + # Assume input argument to be string or any object representation + # which converts into a formatted IP prefix string. + addr = _split_optional_netmask(address) + + self.network_address = IPv6Address(self._ip_int_from_string(addr[0])) + + if len(addr) == 2: + arg = addr[1] + else: + arg = self._max_prefixlen + self.netmask, self._prefixlen = self._make_netmask(arg) + + if strict: + if (IPv6Address(int(self.network_address) & int(self.netmask)) != + self.network_address): + raise ValueError('%s has host bits set' % self) + self.network_address = IPv6Address(int(self.network_address) & + int(self.netmask)) + + if self._prefixlen == (self._max_prefixlen - 1): + self.hosts = self.__iter__ + + def hosts(self): + """Generate Iterator over usable hosts in a network. + + This is like __iter__ except it doesn't return the + Subnet-Router anycast address. + + """ + network = int(self.network_address) + broadcast = int(self.broadcast_address) + for x in _compat_range(network + 1, broadcast + 1): + yield self._address_class(x) + + @property + def is_site_local(self): + """Test if the address is reserved for site-local. + + Note that the site-local address space has been deprecated by RFC 3879. + Use is_private to test if this address is in the space of unique local + addresses as defined by RFC 4193. + + Returns: + A boolean, True if the address is reserved per RFC 3513 2.5.6. + + """ + return (self.network_address.is_site_local and + self.broadcast_address.is_site_local) + + +class _IPv6Constants(object): + + _linklocal_network = IPv6Network('fe80::/10') + + _multicast_network = IPv6Network('ff00::/8') + + _private_networks = [ + IPv6Network('::1/128'), + IPv6Network('::/128'), + IPv6Network('::ffff:0:0/96'), + IPv6Network('100::/64'), + IPv6Network('2001::/23'), + IPv6Network('2001:2::/48'), + IPv6Network('2001:db8::/32'), + IPv6Network('2001:10::/28'), + IPv6Network('fc00::/7'), + IPv6Network('fe80::/10'), + ] + + _reserved_networks = [ + IPv6Network('::/8'), IPv6Network('100::/8'), + IPv6Network('200::/7'), IPv6Network('400::/6'), + IPv6Network('800::/5'), IPv6Network('1000::/4'), + IPv6Network('4000::/3'), IPv6Network('6000::/3'), + IPv6Network('8000::/3'), IPv6Network('A000::/3'), + IPv6Network('C000::/3'), IPv6Network('E000::/4'), + IPv6Network('F000::/5'), IPv6Network('F800::/6'), + IPv6Network('FE00::/9'), + ] + + _sitelocal_network = IPv6Network('fec0::/10') + + +IPv6Address._constants = _IPv6Constants \ No newline at end of file -- Gitee From 8857fe4db528eab7c3cedacf277930cfd7009cea Mon Sep 17 00:00:00 2001 From: zhang_xubo <2578876417@qq.com> Date: Wed, 13 Oct 2021 14:23:19 +0800 Subject: [PATCH 3/6] add gscheck --- script/gs_check | 14 +++++++++----- script/gspylib/inspection/common/SharedFuncs.py | 3 ++- script/test.py | 2 +- 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/script/gs_check b/script/gs_check index 87bf74fe..da1ffa07 100644 --- a/script/gs_check +++ b/script/gs_check @@ -1475,14 +1475,14 @@ def doRootCheck(): # get local node host = __getLocalNode(g_context.nodes) # prepare the command for running check - cmd = __prepareCmd(g_context.items, g_context.user, g_context.checkID) + cmd = __prepareCmd(g_context.items, g_context.user, g_context.checkID, True) # run root cmd output = SharedFuncs.runRootCmd(cmd, g_opts.pwdMap[host][0], g_opts.pwdMap[host][1], g_context.mpprc) - print(output) + print(output.decode()) -def __prepareCmd(items, user, checkid): +def __prepareCmd(items, user, checkid, print_output=False): """ function: prepare the command for running check """ @@ -1491,15 +1491,19 @@ def __prepareCmd(items, user, checkid): userParam = "" checkIdParam = "" routingParam = "" + printParam = "" + if not print_output: + printParam = "--non-print" + if user: userParam = " -U %s " % user if checkid: checkIdParam = " --cid=%s " % checkid if g_context.routing: routingParam = "--routing %s" % g_context.routing - cmd = "%s/gs_check -i %s %s %s -L %s -o %s -l %s --non-print" % ( + cmd = "%s/gs_check -i %s %s %s -L %s -o %s -l %s %s" % ( cmdPath, ",".join(itemsName), userParam, checkIdParam, - routingParam, g_context.tmpPath, g_context.logFile) + routingParam, g_context.tmpPath, g_context.logFile, printParam) return cmd diff --git a/script/gspylib/inspection/common/SharedFuncs.py b/script/gspylib/inspection/common/SharedFuncs.py index b5370eb8..44e0b2ca 100644 --- a/script/gspylib/inspection/common/SharedFuncs.py +++ b/script/gspylib/inspection/common/SharedFuncs.py @@ -150,7 +150,8 @@ def runRootCmd(cmd, rootuser, passwd, mpprcFile=''): ssh = None try: import paramiko - cmd = "export LC_ALL=C; source /etc/profile 2>/dev/null; %s" % cmd + # cmd = "export LC_ALL=C; source /etc/profile 2>/dev/null; %s" % cmd + cmd = "source /etc/profile 2>/dev/null; %s" % cmd ssh = paramiko.SSHClient() ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy()) ssh.connect('localhost', 22, rootuser, passwd) diff --git a/script/test.py b/script/test.py index 24f2d2a1..c5592120 100644 --- a/script/test.py +++ b/script/test.py @@ -16,7 +16,7 @@ class ClassA: var2 = "123" VAR3 = "dddd" - def Function2(self): + def testFunc2(self): """ 测试大小写格式 """ -- Gitee From 62d46a3a74f21f1662d8c5b3606b5eda0ac2575a Mon Sep 17 00:00:00 2001 From: zhang_xubo <2578876417@qq.com> Date: Wed, 13 Oct 2021 14:41:51 +0800 Subject: [PATCH 4/6] add gscheck --- script/gspylib/inspection/common/SharedFuncs.py | 3 +-- script/test.py | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/script/gspylib/inspection/common/SharedFuncs.py b/script/gspylib/inspection/common/SharedFuncs.py index 44e0b2ca..b5370eb8 100644 --- a/script/gspylib/inspection/common/SharedFuncs.py +++ b/script/gspylib/inspection/common/SharedFuncs.py @@ -150,8 +150,7 @@ def runRootCmd(cmd, rootuser, passwd, mpprcFile=''): ssh = None try: import paramiko - # cmd = "export LC_ALL=C; source /etc/profile 2>/dev/null; %s" % cmd - cmd = "source /etc/profile 2>/dev/null; %s" % cmd + cmd = "export LC_ALL=C; source /etc/profile 2>/dev/null; %s" % cmd ssh = paramiko.SSHClient() ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy()) ssh.connect('localhost', 22, rootuser, passwd) diff --git a/script/test.py b/script/test.py index c5592120..4ed7ebe0 100644 --- a/script/test.py +++ b/script/test.py @@ -16,7 +16,7 @@ class ClassA: var2 = "123" VAR3 = "dddd" - def testFunc2(self): + def test_func2(self): """ 测试大小写格式 """ -- Gitee From db56c1b47815c8a2be9df2e74fe86fd26ce6829a Mon Sep 17 00:00:00 2001 From: zhangxubo <2578876417@qq.com> Date: Tue, 7 Dec 2021 13:35:18 +0000 Subject: [PATCH 5/6] add testkubernetes.py. --- testkubernetes.py | 84 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 84 insertions(+) create mode 100644 testkubernetes.py diff --git a/testkubernetes.py b/testkubernetes.py new file mode 100644 index 00000000..6a4958fb --- /dev/null +++ b/testkubernetes.py @@ -0,0 +1,84 @@ +# Copyright 2016 The Kubernetes Authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from setuptools import setup + +# Do not edit these constants. They will be updated automatically +# by scripts/update-client.sh. +CLIENT_VERSION = "21.0.0-snapshot" +PACKAGE_NAME = "kubernetes" +DEVELOPMENT_STATUS = "3 - Alpha" + +# To install the library, run the following +# +# python setup.py install +# +# prerequisite: setuptools +# http://pypi.python.org/pypi/setuptools + +EXTRAS = { + 'adal': ['adal>=1.0.2'] +} +REQUIRES = [] +with open('requirements.txt') as f: + for line in f: + line, _, _ = line.partition('#') + line = line.strip() + if ';' in line: + requirement, _, specifier = line.partition(';') + for_specifier = EXTRAS.setdefault(':{}'.format(specifier), []) + for_specifier.append(requirement) + else: + REQUIRES.append(line) + +with open('test-requirements.txt') as f: + TESTS_REQUIRES = f.readlines() + +setup( + name=PACKAGE_NAME, + version=CLIENT_VERSION, + description="Kubernetes python client", + author_email="", + author="Kubernetes", + license="Apache License Version 2.0", + url="https://github.com/kubernetes-client/python", + keywords=["Swagger", "OpenAPI", "Kubernetes"], + install_requires=REQUIRES, + tests_require=TESTS_REQUIRES, + extras_require=EXTRAS, + packages=['kubernetes', 'kubernetes.client', 'kubernetes.config', + 'kubernetes.watch', 'kubernetes.client.api', + 'kubernetes.stream', 'kubernetes.client.models', + 'kubernetes.utils', 'kubernetes.client.apis', + 'kubernetes.dynamic', 'kubernetes.leaderelection', + 'kubernetes.leaderelection.resourcelock'], + include_package_data=True, + long_description="Python client for kubernetes http://kubernetes.io/", + python_requires='>=3.6', + classifiers=[ + "Development Status :: %s" % DEVELOPMENT_STATUS, + "Topic :: Utilities", + "Intended Audience :: Developers", + "Intended Audience :: Information Technology", + "License :: OSI Approved :: Apache Software License", + "Operating System :: OS Independent", + "Programming Language :: Python", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.6", + "Programming Language :: Python :: 3.7", + "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + ], +) \ No newline at end of file -- Gitee From a97a5c22ba261a8399383a61bbe073f3c6c1353d Mon Sep 17 00:00:00 2001 From: zhangxubo <2578876417@qq.com> Date: Tue, 7 Dec 2021 13:55:24 +0000 Subject: [PATCH 6/6] add a.c. --- a.c | 325 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 325 insertions(+) create mode 100644 a.c diff --git a/a.c b/a.c new file mode 100644 index 00000000..6186bcf0 --- /dev/null +++ b/a.c @@ -0,0 +1,325 @@ +/* zutil.c -- target dependent utility functions for the compression library + * Copyright (C) 1995-2017 Jean-loup Gailly + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +/* @(#) $Id$ */ + +#include "zutil.h" +#ifndef Z_SOLO +# include "gzguts.h" +#endif + +z_const char * const z_errmsg[10] = { + (z_const char *)"need dictionary", /* Z_NEED_DICT 2 */ + (z_const char *)"stream end", /* Z_STREAM_END 1 */ + (z_const char *)"", /* Z_OK 0 */ + (z_const char *)"file error", /* Z_ERRNO (-1) */ + (z_const char *)"stream error", /* Z_STREAM_ERROR (-2) */ + (z_const char *)"data error", /* Z_DATA_ERROR (-3) */ + (z_const char *)"insufficient memory", /* Z_MEM_ERROR (-4) */ + (z_const char *)"buffer error", /* Z_BUF_ERROR (-5) */ + (z_const char *)"incompatible version",/* Z_VERSION_ERROR (-6) */ + (z_const char *)"" +}; + + +const char * ZEXPORT zlibVersion() +{ + return ZLIB_VERSION; +} + +uLong ZEXPORT zlibCompileFlags() +{ + uLong flags; + + flags = 0; + switch ((int)(sizeof(uInt))) { + case 2: break; + case 4: flags += 1; break; + case 8: flags += 2; break; + default: flags += 3; + } + switch ((int)(sizeof(uLong))) { + case 2: break; + case 4: flags += 1 << 2; break; + case 8: flags += 2 << 2; break; + default: flags += 3 << 2; + } + switch ((int)(sizeof(voidpf))) { + case 2: break; + case 4: flags += 1 << 4; break; + case 8: flags += 2 << 4; break; + default: flags += 3 << 4; + } + switch ((int)(sizeof(z_off_t))) { + case 2: break; + case 4: flags += 1 << 6; break; + case 8: flags += 2 << 6; break; + default: flags += 3 << 6; + } +#ifdef ZLIB_DEBUG + flags += 1 << 8; +#endif +#if defined(ASMV) || defined(ASMINF) + flags += 1 << 9; +#endif +#ifdef ZLIB_WINAPI + flags += 1 << 10; +#endif +#ifdef BUILDFIXED + flags += 1 << 12; +#endif +#ifdef DYNAMIC_CRC_TABLE + flags += 1 << 13; +#endif +#ifdef NO_GZCOMPRESS + flags += 1L << 16; +#endif +#ifdef NO_GZIP + flags += 1L << 17; +#endif +#ifdef PKZIP_BUG_WORKAROUND + flags += 1L << 20; +#endif +#ifdef FASTEST + flags += 1L << 21; +#endif +#if defined(STDC) || defined(Z_HAVE_STDARG_H) +# ifdef NO_vsnprintf + flags += 1L << 25; +# ifdef HAS_vsprintf_void + flags += 1L << 26; +# endif +# else +# ifdef HAS_vsnprintf_void + flags += 1L << 26; +# endif +# endif +#else + flags += 1L << 24; +# ifdef NO_snprintf + flags += 1L << 25; +# ifdef HAS_sprintf_void + flags += 1L << 26; +# endif +# else +# ifdef HAS_snprintf_void + flags += 1L << 26; +# endif +# endif +#endif + return flags; +} + +#ifdef ZLIB_DEBUG +#include +# ifndef verbose +# define verbose 0 +# endif +int ZLIB_INTERNAL z_verbose = verbose; + +void ZLIB_INTERNAL z_error (m) + char *m; +{ + fprintf(stderr, "%s\n", m); + exit(1); +} +#endif + +/* exported to allow conversion of error code to string for compress() and + * uncompress() + */ +const char * ZEXPORT zError(err) + int err; +{ + return ERR_MSG(err); +} + +#if defined(_WIN32_WCE) + /* The Microsoft C Run-Time Library for Windows CE doesn't have + * errno. We define it as a global variable to simplify porting. + * Its value is always 0 and should not be used. + */ + int errno = 0; +#endif + +#ifndef HAVE_MEMCPY + +void ZLIB_INTERNAL zmemcpy(dest, source, len) + Bytef* dest; + const Bytef* source; + uInt len; +{ + if (len == 0) return; + do { + *dest++ = *source++; /* ??? to be unrolled */ + } while (--len != 0); +} + +int ZLIB_INTERNAL zmemcmp(s1, s2, len) + const Bytef* s1; + const Bytef* s2; + uInt len; +{ + uInt j; + + for (j = 0; j < len; j++) { + if (s1[j] != s2[j]) return 2*(s1[j] > s2[j])-1; + } + return 0; +} + +void ZLIB_INTERNAL zmemzero(dest, len) + Bytef* dest; + uInt len; +{ + if (len == 0) return; + do { + *dest++ = 0; /* ??? to be unrolled */ + } while (--len != 0); +} +#endif + +#ifndef Z_SOLO + +#ifdef SYS16BIT + +#ifdef __TURBOC__ +/* Turbo C in 16-bit mode */ + +# define MY_ZCALLOC + +/* Turbo C malloc() does not allow dynamic allocation of 64K bytes + * and farmalloc(64K) returns a pointer with an offset of 8, so we + * must fix the pointer. Warning: the pointer must be put back to its + * original form in order to free it, use zcfree(). + */ + +#define MAX_PTR 10 +/* 10*64K = 640K */ + +local int next_ptr = 0; + +typedef struct ptr_table_s { + voidpf org_ptr; + voidpf new_ptr; +} ptr_table; + +local ptr_table table[MAX_PTR]; +/* This table is used to remember the original form of pointers + * to large buffers (64K). Such pointers are normalized with a zero offset. + * Since MSDOS is not a preemptive multitasking OS, this table is not + * protected from concurrent access. This hack doesn't work anyway on + * a protected system like OS/2. Use Microsoft C instead. + */ + +voidpf ZLIB_INTERNAL zcalloc (voidpf opaque, unsigned items, unsigned size) +{ + voidpf buf; + ulg bsize = (ulg)items*size; + + (void)opaque; + + /* If we allocate less than 65520 bytes, we assume that farmalloc + * will return a usable pointer which doesn't have to be normalized. + */ + if (bsize < 65520L) { + buf = farmalloc(bsize); + if (*(ush*)&buf != 0) return buf; + } else { + buf = farmalloc(bsize + 16L); + } + if (buf == NULL || next_ptr >= MAX_PTR) return NULL; + table[next_ptr].org_ptr = buf; + + /* Normalize the pointer to seg:0 */ + *((ush*)&buf+1) += ((ush)((uch*)buf-0) + 15) >> 4; + *(ush*)&buf = 0; + table[next_ptr++].new_ptr = buf; + return buf; +} + +void ZLIB_INTERNAL zcfree (voidpf opaque, voidpf ptr) +{ + int n; + + (void)opaque; + + if (*(ush*)&ptr != 0) { /* object < 64K */ + farfree(ptr); + return; + } + /* Find the original pointer */ + for (n = 0; n < next_ptr; n++) { + if (ptr != table[n].new_ptr) continue; + + farfree(table[n].org_ptr); + while (++n < next_ptr) { + table[n-1] = table[n]; + } + next_ptr--; + return; + } + Assert(0, "zcfree: ptr not found"); +} + +#endif /* __TURBOC__ */ + + +#ifdef M_I86 +/* Microsoft C in 16-bit mode */ + +# define MY_ZCALLOC + +#if (!defined(_MSC_VER) || (_MSC_VER <= 600)) +# define _halloc halloc +# define _hfree hfree +#endif + +voidpf ZLIB_INTERNAL zcalloc (voidpf opaque, uInt items, uInt size) +{ + (void)opaque; + return _halloc((long)items, size); +} + +void ZLIB_INTERNAL zcfree (voidpf opaque, voidpf ptr) +{ + (void)opaque; + _hfree(ptr); +} + +#endif /* M_I86 */ + +#endif /* SYS16BIT */ + + +#ifndef MY_ZCALLOC /* Any system without a special alloc function */ + +#ifndef STDC +extern voidp malloc OF((uInt size)); +extern voidp calloc OF((uInt items, uInt size)); +extern void free OF((voidpf ptr)); +#endif + +voidpf ZLIB_INTERNAL zcalloc (opaque, items, size) + voidpf opaque; + unsigned items; + unsigned size; +{ + (void)opaque; + return sizeof(uInt) > 2 ? (voidpf)malloc(items * size) : + (voidpf)calloc(items, size); +} + +void ZLIB_INTERNAL zcfree (opaque, ptr) + voidpf opaque; + voidpf ptr; +{ + (void)opaque; + free(ptr); +} + +#endif /* MY_ZCALLOC */ + +#endif /* !Z_SOLO */ \ No newline at end of file -- Gitee