Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Support of python 3.7, 3.8#2

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions.travis.yml
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -19,6 +19,8 @@ notifications:
on_failure: always

env:
- TEST_PLATFORM=std3-all PYTHON_VERSION=3.7
- TEST_PLATFORM=std3-all PYTHON_VERSION=3.8
- TEST_PLATFORM=std3-all PYTHON_VERSION=3.9
- TEST_PLATFORM=std3-all PYTHON_VERSION=3.10
- TEST_PLATFORM=std3-all PYTHON_VERSION=3.11
Expand Down
2 changes: 1 addition & 1 deletionsrc/core/helpers.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -27,7 +27,7 @@ def ExtractOptionDataName(option: typing.Union[str, OptionData]) -> str:

# --------------------------------------------------------------------
def ExtractFirstOptionFromIndexItem(
optionName: str, indexItem: typing.Union[OptionData,list[OptionData]]
optionName: str, indexItem: typing.Union[OptionData,typing.List[OptionData]]
) -> OptionData:
assert type(optionName) == str

Expand Down
31 changes: 17 additions & 14 deletionssrc/core/model.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -155,7 +155,7 @@ def __init__(self, element: FileLineElementData):

# --------------------------------------------------------------------
m_Parent: FileData
m_Items:list[tagItem]
m_Items:typing.List[tagItem]

# --------------------------------------------------------------------
def __init__(self, parent: FileData):
Expand All@@ -164,7 +164,7 @@ def __init__(self, parent: FileData):
super().__init__()

self.m_Parent = parent
self.m_Items = list[__class__.tagItem]()
self.m_Items = list()

# own interface ------------------------------------------------------
def MarkAsDeletedFrom(self, fileData: FileData) -> None:
Expand DownExpand Up@@ -206,9 +206,9 @@ class FileData(ObjectData):
m_LastModifiedTimestamp: typing.Optional[datetime.datetime]

m_Path: str
m_Lines:list[FileLineData]
m_Lines:typing.List[FileLineData]

m_OptionsByName:dict[str, OptionData]
m_OptionsByName:typing.Dict[str, OptionData]

# --------------------------------------------------------------------
def __init__(self, parent: ConfigurationData, path: str):
Expand All@@ -226,9 +226,10 @@ def __init__(self, parent: ConfigurationData, path: str):
self.m_LastModifiedTimestamp = None

self.m_Path = path
self.m_Lines = list[FileLineData]()
self.m_Lines = list()

self.m_OptionsByName = dict[str, OptionData]()
self.m_OptionsByName = dict()
assert type(self.m_OptionsByName) == dict

assert type(self.m_Path) == str
assert self.m_Path != ""
Expand All@@ -254,10 +255,10 @@ class ConfigurationData(ObjectData):
m_DataDir: str
m_OsOps: ConfigurationOsOps

m_Files:list[FileData]
m_Files:typing.List[FileData]

m_AllOptionsByName:dict[str, typing.Union[OptionData,list[OptionData]]]
m_AllFilesByName:dict[str, typing.Union[FileData,list[FileData]]]
m_AllOptionsByName:typing.Dict[str, typing.Union[OptionData,typing.List[OptionData]]]
m_AllFilesByName:typing.Dict[str, typing.Union[FileData,typing.List[FileData]]]

# --------------------------------------------------------------------
def __init__(self, data_dir: str, osOps: ConfigurationOsOps):
Expand All@@ -269,11 +270,13 @@ def __init__(self, data_dir: str, osOps: ConfigurationOsOps):
self.m_DataDir = data_dir
self.m_OsOps = osOps

self.m_Files = list[FileData]()
self.m_AllOptionsByName = dict[
str, typing.Union[OptionData, list[OptionData]]
]()
self.m_AllFilesByName = dict[str, typing.Union[FileData, list[FileData]]]()
self.m_Files = list()
self.m_AllOptionsByName = dict()
self.m_AllFilesByName = dict()

assert type(self.m_Files) == list
assert type(self.m_AllOptionsByName) == dict
assert type(self.m_AllFilesByName) == dict

# Own interface ------------------------------------------------------
@property
Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -7,6 +7,8 @@
from ....handlersimportOptionHandlerCtxToPrepareGetValue
from ....handlersimportConfigurationDataHandler

importtyping

# //////////////////////////////////////////////////////////////////////////////
# OptionHandlerToPrepareGetValue__Std__UniqueStrList

Expand All@@ -25,9 +27,8 @@ def PrepareGetValue(self, ctx: OptionHandlerCtxToPrepareGetValue) -> any:
assertctx.OptionValueisnotNone
asserttype(ctx.OptionValue)==list

result=list[str]()

index=set[str]()
result:typing.List[str]=list()
index:set[str]=set()

forxinctx.OptionValue:
assertxisnotNone
Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -9,6 +9,8 @@
from ....handlers import OptionHandlerCtxToPrepareSetValue
from ....handlers import ConfigurationDataHandler

import typing

# //////////////////////////////////////////////////////////////////////////////
# OptionHandlerToPrepareSetValue__Std__Bool

Expand DownExpand Up@@ -84,7 +86,7 @@ def PrepareSetValue(self, ctx: OptionHandlerCtxToPrepareSetValue) -> any:
C_MIN_STR_VALUE_LENGTH = 1
C_MAX_STR_VALUE_LENGTH = 5

sm_Str_False:list[str] = [
sm_Str_False:typing.List[str] = [
"of",
"off",
"f",
Expand All@@ -97,7 +99,7 @@ def PrepareSetValue(self, ctx: OptionHandlerCtxToPrepareSetValue) -> any:
"0",
]

sm_Str_True:list[str] = [
sm_Str_True:typing.List[str] = [
"on",
"t",
"tr",
Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -11,6 +11,8 @@

from ....read_utils import ReadUtils

import typing

# //////////////////////////////////////////////////////////////////////////////
# OptionHandlerToPrepareSetValue__Std__UniqueStrList

Expand All@@ -36,9 +38,8 @@ def PrepareSetValue(self, ctx: OptionHandlerCtxToPrepareSetValue) -> any:
assert type(result) == list
return result
elif typeOfOptionValue == list:
result = list[str]()

index = set[str]()
result: typing.List[str] = list()
index: typing.Set[str] = set()

for x in ctx.OptionValue:
if x is None:
Expand Down
6 changes: 3 additions & 3 deletionssrc/core/read_utils.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -165,7 +165,7 @@ def IsValidSeqCh2(ch: str) -> bool:
return __class__.IsValidSeqCh1(ch)

# --------------------------------------------------------------------
def Unpack_StrList2(source: str) ->list[str]:
def Unpack_StrList2(source: str) ->typing.List[str]:
assert source is not None
assert type(source) == str

Expand All@@ -184,8 +184,8 @@ class tagCtx:
ctx.mode = C_MODE__NONE
ctx.curValueItem = None
ctx.dataLength = 0
ctx.result = list[str]()
ctx.index = set[str]()
ctx.result = list()
ctx.index = set()

i = 0
length = len(source)
Expand Down
4 changes: 3 additions & 1 deletionsrc/core/write_utils.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
# //////////////////////////////////////////////////////////////////////////////
# Postgres Pro. PostgreSQL Configuration Python Library.

import typing

# //////////////////////////////////////////////////////////////////////////////
# class WriteUtils
Expand All@@ -14,7 +15,8 @@ def Pack_StrList2(strList: list) -> str:
result = ""
sep = ""

index = set[str]()
index: typing.Set[str] = set()
assert type(index) == set

for x in strList:
assert x is not None
Expand Down
59 changes: 46 additions & 13 deletionssrc/implementation/v00/configuration_base.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -3005,7 +3005,8 @@ def Debug__CheckOurObjectData(self, data: PgCfgModel__ObjectData):
assert data is not None
assert isinstance(data, PgCfgModel__ObjectData)

stack = set[PgCfgModel__ObjectData]()
stack: typing.Set[PgCfgModel__ObjectData] = set()
assert type(stack) == set

ptr = data
while ptr is not self.m_Data:
Expand All@@ -3030,7 +3031,8 @@ def GetObject(
assert isinstance(objectData, PgCfgModel__ObjectData)

# Build stack
stack = list[PostgresConfigurationObject]()
stack: typing.List[PostgresConfigurationObject] = []


while True:
stack.append(objectData)
Expand DownExpand Up@@ -3165,7 +3167,7 @@ def LoadConfigurationFile(
assert type(filePath) == str
assert filePath != ""

existFileDatas = dict[str, PgCfgModel__FileData]()
existFileDatas: typing.Dict[str, PgCfgModel__FileData] = dict()

for fileName in cfg.m_Data.m_AllFilesByName.keys():
assert type(fileName) == str
Expand DownExpand Up@@ -3212,7 +3214,7 @@ def LoadConfigurationFile(
assert rootFile.m_FileData.m_LastModifiedTimestamp is None
assert len(rootFile.m_FileData.m_Lines) == 0

queuedFileDatas = set[PgCfgModel__FileData]()
queuedFileDatas: typing.Set[PgCfgModel__FileData] = set()

queuedFileDatas.add(rootFile.m_FileData)

Expand DownExpand Up@@ -3302,7 +3304,13 @@ def Helper__LoadFileContent(

lineReader = ReadUtils__LineReader()

while lineData := fileContent.ReadLine():
while True:
lineData = fileContent.ReadLine()

if not lineData:
# assert lineData is None
break

assert type(lineData) == str

lineReader.SetData(lineData)
Expand DownExpand Up@@ -3346,7 +3354,15 @@ def Helper__ProcessLineData(
sequenceOffset = lineReader.GetColOffset()
sequence = ch

while ch := lineReader.ReadSymbol():
while True:
ch = lineReader.ReadSymbol()

if not ch:
assert ch is None
break

assert type(ch) == str

if ReadUtils.IsValidSeqCh2(ch):
sequence += ch
continue
Expand DownExpand Up@@ -3387,8 +3403,15 @@ def Helper__ProcessLineData__Comment(
commentText = ""
commentOffset = lineReader.GetColOffset()

ch: str
while ch := lineReader.ReadSymbol():
while True:
ch = lineReader.ReadSymbol()

if not ch:
assert ch is None
break

assert type(ch) == str

if ReadUtils.IsEOL(ch):
break
commentText += ch
Expand DownExpand Up@@ -3699,9 +3722,15 @@ def Helper__ProcessLineData__Option__Generic(

optionValue = ""

ch: str
while True:
ch = lineReader.ReadSymbol()

if not ch:
assert ch is None
break

assert type(ch) == str

while ch := lineReader.ReadSymbol():
if ch == "#" or ReadUtils.IsEOL(ch):
lineReader.StepBack()
break
Expand DownExpand Up@@ -3757,9 +3786,13 @@ def __init__(self, cfg: PostgresConfiguration_Base):

self.Cfg = cfg

self.AllFiles = list[PostgresConfigurationWriterFileCtx_Base]()
self.NewFiles = list[PostgresConfigurationWriterFileCtx_Base]()
self.UpdFiles = list[PostgresConfigurationWriterFileCtx_Base]()
self.AllFiles = list()
self.NewFiles = list()
self.UpdFiles = list()

assert type(self.AllFiles) == list
assert type(self.NewFiles) == list
assert type(self.UpdFiles) == list

# --------------------------------------------------------------------
def Init(self):
Expand Down
2 changes: 1 addition & 1 deletiontests/CfgFileReader.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
# /////////////////////////////////////////////////////////////////////////////
# Postgres Pro. PostgreSQL Configuration Python Library. Tests.

from..src.os.abstract.configuration_os_opsimportConfigurationFileReader
fromsrc.os.abstract.configuration_os_opsimportConfigurationFileReader

importio

Expand Down
5 changes: 3 additions & 2 deletionstests/TestConfigHelper.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -5,6 +5,7 @@
from .ThrowError import ThrowError

import os
import typing

# /////////////////////////////////////////////////////////////////////////////
# TestConfigHelper
Expand All@@ -20,9 +21,9 @@ def NoCleanup() -> bool:
return __class__.Helper__ToBoolean(v, TestConfigPropNames.TEST_CFG__NO_CLEANUP)

# Helper methods -----------------------------------------------------
sm_YES:list[str] = ["1", "TRUE", "YES"]
sm_YES:typing.List[str] = ["1", "TRUE", "YES"]

sm_NO:list[str] = ["0", "FALSE", "NO"]
sm_NO:typing.List[str] = ["0", "FALSE", "NO"]

# --------------------------------------------------------------------
def Helper__ToBoolean(v, envVarName: str) -> bool:
Expand Down
6 changes: 4 additions & 2 deletionstests/TestGlobalCache.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -3,6 +3,7 @@

import logging
import threading
import typing

from .TestGlobalResource import TestGlobalResource

Expand All@@ -12,7 +13,7 @@

class TestGlobalCache:
sm_Guard = threading.Lock()
sm_Dict:dict[str, any] = dict[str, any]()
sm_Dict:typing.Dict[str, any] = dict

# --------------------------------------------------------------------
def __init__(self):
Expand DownExpand Up@@ -42,7 +43,8 @@ def ReleaseAllResources():
assert isinstance(__class__.sm_Dict, dict)

with __class__.sm_Guard:
emptyDict = dict[str, any]()
emptyDict: typing.Dict[str, any] = dict()
assert type(emptyDict) == dict

curDict = __class__.sm_Dict

Expand Down
Loading

[8]ページ先頭

©2009-2025 Movatter.jp