@@ -128,32 +128,11 @@ WsjcppJsonRpc20ExportCliPython::WsjcppJsonRpc20ExportCliPython(
128128 const std::string &sPackageName
129129) : WsjcppJsonRpc20ExportCliBase(sExportDir , sPackageName ) {
130130 TAG = " WsjcppJsonRpc20ExportCliPython" ;
131- m_sAuthorName = " Unknown" ;
132- m_sAuthorEmail = " unknown" ;
133- m_sClassName = " Unknown" ;
134131 m_sUrl = " none" ;
135132}
136133
137134// ---------------------------------------------------------------------
138135
139- void WsjcppJsonRpc20ExportCliPython::setAuthorName (const std::string &sAuthorName ) {
140- m_sAuthorName = sAuthorName ;
141- }
142-
143- // ---------------------------------------------------------------------
144-
145- void WsjcppJsonRpc20ExportCliPython::setAuthorEmail (const std::string &sAuthorEmail ) {
146- m_sAuthorEmail = sAuthorEmail ;
147- }
148-
149- // ---------------------------------------------------------------------
150-
151- void WsjcppJsonRpc20ExportCliPython::setClassName (const std::string &sClassName ) {
152- m_sClassName = sClassName ;
153- }
154-
155- // ---------------------------------------------------------------------
156-
157136void WsjcppJsonRpc20ExportCliPython::setUrl (const std::string &sUrl ) {
158137 m_sUrl = sUrl ;
159138}
@@ -252,7 +231,7 @@ bool WsjcppJsonRpc20ExportCliPython::prepareReadmeMdIfNeed() {
252231 if (!WsjcppCore::fileExists (sReadmeMd )) {
253232 std::string sContentReadme =
254233 " #" + this ->getPackageName () + " \n\n "
255- + m_sClassName + " Python Library for " + this ->getAppName () + " \n\n "
234+ + this -> getClassName () + " Python Library for " + this ->getAppName () + " \n\n "
256235 + " ## Install \n\n "
257236 + " ```\n "
258237 + " $ pip3 install " + this ->getPackageName () + " --upgrade\n "
@@ -261,8 +240,8 @@ bool WsjcppJsonRpc20ExportCliPython::prepareReadmeMdIfNeed() {
261240 + " ```\n "
262241 + " #!/usr/bin/env python3\n "
263242 + " # -*- coding: utf-8 -*-\n "
264- + " from " + this ->getPackageName () + " import " + m_sClassName + " \n\n "
265- + " client = " + m_sClassName + " (\" ws://host/ws-api/\" )\n\n "
243+ + " from " + this ->getPackageName () + " import " + this -> getClassName () + " \n\n "
244+ + " client = " + this -> getClassName () + " (\" ws://host/ws-api/\" )\n\n "
266245 + " resp = client.server_api({})\n\n "
267246 + " print(resp)\n "
268247 + " ```\n\n "
@@ -293,9 +272,9 @@ bool WsjcppJsonRpc20ExportCliPython::exportSetupPy() {
293272 " packages=['" + this ->getPackageName () + " '],\n "
294273 " install_requires=['websocket-client>=0.56.0', 'requests>=2.21.0'],\n "
295274 " keywords=['" + WsjcppCore::join (m_vKeywords, " ', '" ) + " '],\n "
296- " author='" + m_sAuthorName + " ',\n "
297- " author_email='" + m_sAuthorEmail + " ',\n "
298- " description='" + m_sClassName + " Python Library for " + this ->getAppName () + " ',\n "
275+ " author='" + this -> getAuthorName () + " ',\n "
276+ " author_email='" + this -> getAuthorEmail () + " ',\n "
277+ " description='" + this -> getClassName () + " Python Library for " + this ->getAppName () + " ',\n "
299278 " long_description=long_description,\n "
300279 " long_description_content_type='text/markdown',\n "
301280 " url='" + m_sUrl + " ',\n "
@@ -333,14 +312,14 @@ bool WsjcppJsonRpc20ExportCliPython::exportAPImd() {
333312
334313 long nSec = WsjcppCore::getCurrentTimeInSeconds ();
335314
336- apimd << " # " + m_sClassName + " Python Library \n\n " ;
315+ apimd << " # " + this -> getClassName () + " Python Library \n\n " ;
337316 apimd << " Automatically generated by " << this ->getAppName () << " . \n " ;
338317 apimd << " * Version: " << this ->getAppVersion () << " \n " ;
339318 apimd << " * Date: " << WsjcppCore::formatTimeForWeb (nSec) << " \n\n " ;
340319 apimd << " Example connect/disconnect:\n "
341320 << " ```\n "
342- << " from " + getPackageName () + " import " + m_sClassName + " \n\n "
343- << " client = " + m_sClassName + " ('ws://host:1234')\n "
321+ << " from " + getPackageName () + " import " + this -> getClassName () + " \n\n "
322+ << " client = " + this -> getClassName () + " ('ws://host:1234')\n "
344323 << " ... \n "
345324 << " client.close()\n "
346325 << " ```\n " ;
@@ -411,7 +390,7 @@ bool WsjcppJsonRpc20ExportCliPython::exportInitPy() {
411390 WsjcppLog::info (TAG, " Prepare __init__.py " + sFilename );
412391 std::ofstream __init__;
413392 __init__.open (sFilename );
414- __init__ << " from ." << m_sClassName << " import " << m_sClassName << " \n " ;
393+ __init__ << " from ." << this -> getClassName () << " import " << this -> getClassName () << " \n " ;
415394 WsjcppLog::ok (TAG, " Done: " + sFilename );
416395 return true ;
417396}
@@ -454,8 +433,8 @@ void exportCliPythonAddCheckDataTypeOfParam(
454433// ---------------------------------------------------------------------
455434
456435bool WsjcppJsonRpc20ExportCliPython::exportClientPy () {
457- std::string sFilename = this ->getExportDir () + " /" + this ->getPackageName () + " /" + m_sClassName + " .py" ;
458- WsjcppLog::info (TAG, " Prepare " + m_sClassName + " .py: " + sFilename );
436+ std::string sFilename = this ->getExportDir () + " /" + this ->getPackageName () + " /" + this -> getClassName () + " .py" ;
437+ WsjcppLog::info (TAG, " Prepare " + this -> getClassName () + " .py: " + sFilename );
459438
460439 std::ofstream clientpy;
461440 clientpy.open (sFilename );
@@ -476,7 +455,7 @@ bool WsjcppJsonRpc20ExportCliPython::exportClientPy() {
476455 .add (" import select" )
477456 .add (" import time" )
478457 .add (" " )
479- .sub (" class " + m_sClassName + " :" )
458+ .sub (" class " + this -> getClassName () + " :" )
480459 .add (" __ws = None" )
481460 .add (" __url = None" )
482461 .add (" __cli_version = '" + this ->getAppVersion () + " '" )
@@ -732,14 +711,14 @@ bool WsjcppJsonRpc20ExportCliPython::exportClientPy() {
732711 if (paramDef.isRequired ()) {
733712 builder
734713 .sub (" if " + sParamName + " is None: " )
735- .add (" raise Exception('Parameter \" " + sParamName + " \" expected (lib: " + m_sClassName + " ." + sMethod + " )')" )
714+ .add (" raise Exception('Parameter \" " + sParamName + " \" expected (lib: " + this -> getClassName () + " ." + sMethod + " )')" )
736715 .end ();
737- exportCliPythonAddCheckDataTypeOfParam (builder, paramDef, m_sClassName , sMethod );
716+ exportCliPythonAddCheckDataTypeOfParam (builder, paramDef, this -> getClassName () , sMethod );
738717 builder.add (" reqJson['params']['" + sParamName + " '] = " + sParamName );
739718 } else if (paramDef.isOptional ()) {
740719 builder
741720 .sub (" if " + sParamName + " != None: " );
742- exportCliPythonAddCheckDataTypeOfParam (builder, paramDef, m_sClassName , sMethod );
721+ exportCliPythonAddCheckDataTypeOfParam (builder, paramDef, this -> getClassName () , sMethod );
743722 builder
744723 .add (" reqJson['params']['" + sParamName + " '] = " + sParamName )
745724 .end ();
0 commit comments