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] = "="):
|
def fileToJson(self, path: str, remark: Optional[str] = "#", separate: Optional[str] = "="):
|
||||||
''' convert file to Json '''
|
''' convert file to Json '''
|
||||||
|
|
||||||
print(path)
|
|
||||||
|
|
||||||
dict = {}
|
dict = {}
|
||||||
with open(path) as fh:
|
with open(path) as fh:
|
||||||
for line in fh:
|
for line in fh:
|
||||||
|
@ -65,7 +62,8 @@ class FileOp:
|
||||||
|
|
||||||
if line.find(remark) != 0:
|
if line.find(remark) != 0:
|
||||||
item, value = line.strip().split(separate, -1)
|
item, value = line.strip().split(separate, -1)
|
||||||
dict[item] = value
|
if value != "":
|
||||||
|
dict[item] = value
|
||||||
else:
|
else:
|
||||||
continue
|
continue
|
||||||
fh.close()
|
fh.close()
|
||||||
|
@ -81,7 +79,7 @@ class NetOp:
|
||||||
def checkPort(self, port: int):
|
def checkPort(self, port: int):
|
||||||
'''check the target port's status'''
|
'''check the target port's status'''
|
||||||
search_key = "port="+str(port)
|
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")
|
print(str(port)+" is used")
|
||||||
return False
|
return False
|
||||||
else:
|
else:
|
||||||
|
|
22
cli/test.py
22
cli/test.py
|
@ -1,16 +1,10 @@
|
||||||
class Card:
|
import model,re
|
||||||
def __init__(self, rank, suit):
|
|
||||||
self.suit = suit
|
|
||||||
self.rank = rank
|
|
||||||
self.hard, self.soft = self._points()
|
|
||||||
|
|
||||||
class NumberCard( Card ):
|
env = {}
|
||||||
def _points(self):
|
fileop=model.FileOp()
|
||||||
return int(self.rank), int(self.rank)
|
env = fileop.fileToJson('c2/.env')
|
||||||
|
|
||||||
class AceCard( Card ):
|
for key,value in env.items():
|
||||||
def _points(self):
|
if re.match(pattern,key,re.I) != None:
|
||||||
return 1, 11
|
print(value)
|
||||||
|
|
||||||
nc=NumberCard(11,12)
|
|
||||||
print(nc)
|
|
Loading…
Reference in a new issue