mirror of
https://github.com/Websoft9/websoft9.git
synced 2024-11-25 00:50:30 +00:00
test
This commit is contained in:
parent
08cd4d33cf
commit
be8dbf112a
3 changed files with 12 additions and 19 deletions
1
cli/c2
Submodule
1
cli/c2
Submodule
|
@ -0,0 +1 @@
|
|||
Subproject commit 324c5bc05dd27826e863d31f2e3b0caf84878b2c
|
|
@ -54,9 +54,6 @@ class FileOp:
|
|||
|
||||
def fileToJson(self, path: str, remark: Optional[str] = "#", separate: Optional[str] = "="):
|
||||
''' convert file to Json '''
|
||||
|
||||
print(path)
|
||||
|
||||
dict = {}
|
||||
with open(path) as fh:
|
||||
for line in fh:
|
||||
|
@ -65,7 +62,8 @@ class FileOp:
|
|||
|
||||
if line.find(remark) != 0:
|
||||
item, value = line.strip().split(separate, -1)
|
||||
dict[item] = value
|
||||
if value != "":
|
||||
dict[item] = value
|
||||
else:
|
||||
continue
|
||||
fh.close()
|
||||
|
@ -81,7 +79,7 @@ class NetOp:
|
|||
def checkPort(self, port: int):
|
||||
'''check the target port's status'''
|
||||
search_key = "port="+str(port)
|
||||
if str(psutil.net_connections()).find(search_key) != -1:
|
||||
if str(+psutil.net_connections()).find(search_key) != -1:
|
||||
print(str(port)+" is used")
|
||||
return False
|
||||
else:
|
||||
|
|
22
cli/test.py
22
cli/test.py
|
@ -1,16 +1,10 @@
|
|||
class Card:
|
||||
def __init__(self, rank, suit):
|
||||
self.suit = suit
|
||||
self.rank = rank
|
||||
self.hard, self.soft = self._points()
|
||||
import model,re
|
||||
|
||||
class NumberCard( Card ):
|
||||
def _points(self):
|
||||
return int(self.rank), int(self.rank)
|
||||
|
||||
class AceCard( Card ):
|
||||
def _points(self):
|
||||
return 1, 11
|
||||
env = {}
|
||||
fileop=model.FileOp()
|
||||
env = fileop.fileToJson('c2/.env')
|
||||
|
||||
for key,value in env.items():
|
||||
if re.match(pattern,key,re.I) != None:
|
||||
print(value)
|
||||
|
||||
nc=NumberCard(11,12)
|
||||
print(nc)
|
Loading…
Reference in a new issue