probotanki-lib 2.0.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (287) hide show
  1. probotanki_lib-2.0.0/MANIFEST.in +13 -0
  2. probotanki_lib-2.0.0/PKG-INFO +64 -0
  3. probotanki_lib-2.0.0/README.md +46 -0
  4. probotanki_lib-2.0.0/__init__.py +2 -0
  5. probotanki_lib-2.0.0/codec/__init__.py +5 -0
  6. probotanki_lib-2.0.0/codec/basecodec.py +34 -0
  7. probotanki_lib-2.0.0/codec/complex/__init__.py +7 -0
  8. probotanki_lib-2.0.0/codec/complex/doubleintcodec.py +6 -0
  9. probotanki_lib-2.0.0/codec/complex/jsoncodec.py +14 -0
  10. probotanki_lib-2.0.0/codec/complex/stringcodec.py +31 -0
  11. probotanki_lib-2.0.0/codec/complex/vector3dcodec.py +4 -0
  12. probotanki_lib-2.0.0/codec/complex/vectorshortcodec.py +4 -0
  13. probotanki_lib-2.0.0/codec/complex/vectorstringcodec.py +4 -0
  14. probotanki_lib-2.0.0/codec/complex/vectorvector3dcodec.py +4 -0
  15. probotanki_lib-2.0.0/codec/custom/__init__.py +23 -0
  16. probotanki_lib-2.0.0/codec/custom/battleimfouserpreviewcodec.py +8 -0
  17. probotanki_lib-2.0.0/codec/custom/battleinfocodec.py +9 -0
  18. probotanki_lib-2.0.0/codec/custom/battlelimitscodec.py +3 -0
  19. probotanki_lib-2.0.0/codec/custom/battlenotifiercodec.py +8 -0
  20. probotanki_lib-2.0.0/codec/custom/battleusercodec.py +8 -0
  21. probotanki_lib-2.0.0/codec/custom/battleuserrewardscodec.py +8 -0
  22. probotanki_lib-2.0.0/codec/custom/battleuserstatscodec.py +8 -0
  23. probotanki_lib-2.0.0/codec/custom/chatmessagecodec.py +9 -0
  24. probotanki_lib-2.0.0/codec/custom/missioncodec.py +11 -0
  25. probotanki_lib-2.0.0/codec/custom/missionrewardcodec.py +8 -0
  26. probotanki_lib-2.0.0/codec/custom/missionstreakcodec.py +7 -0
  27. probotanki_lib-2.0.0/codec/custom/movecodec.py +8 -0
  28. probotanki_lib-2.0.0/codec/custom/rankrangecodec.py +3 -0
  29. probotanki_lib-2.0.0/codec/custom/referraldatacodec.py +11 -0
  30. probotanki_lib-2.0.0/codec/custom/tankdamagecodec.py +8 -0
  31. probotanki_lib-2.0.0/codec/custom/targethitcodec.py +11 -0
  32. probotanki_lib-2.0.0/codec/custom/targetpositioncodec.py +8 -0
  33. probotanki_lib-2.0.0/codec/custom/turretrotatecodec.py +7 -0
  34. probotanki_lib-2.0.0/codec/custom/userstatscodec.py +8 -0
  35. probotanki_lib-2.0.0/codec/custom/userstatuscodec.py +9 -0
  36. probotanki_lib-2.0.0/codec/custombasecodec.py +33 -0
  37. probotanki_lib-2.0.0/codec/factory/__init__.py +7 -0
  38. probotanki_lib-2.0.0/codec/factory/multitypecodec.py +31 -0
  39. probotanki_lib-2.0.0/codec/factory/vectorcodec.py +40 -0
  40. probotanki_lib-2.0.0/codec/primitive/__init__.py +5 -0
  41. probotanki_lib-2.0.0/codec/primitive/boolcodec.py +10 -0
  42. probotanki_lib-2.0.0/codec/primitive/bytecodec.py +11 -0
  43. probotanki_lib-2.0.0/codec/primitive/floatcodec.py +11 -0
  44. probotanki_lib-2.0.0/codec/primitive/intcodec.py +11 -0
  45. probotanki_lib-2.0.0/codec/primitive/shortcodec.py +11 -0
  46. probotanki_lib-2.0.0/modules/__init__.py +0 -0
  47. probotanki_lib-2.0.0/modules/client/__init__.py +2 -0
  48. probotanki_lib-2.0.0/modules/client/asynctankiinstance.py +164 -0
  49. probotanki_lib-2.0.0/modules/client/tankiinstance.py +145 -0
  50. probotanki_lib-2.0.0/modules/communications/__init__.py +4 -0
  51. probotanki_lib-2.0.0/modules/communications/abstractmessage.py +13 -0
  52. probotanki_lib-2.0.0/modules/communications/command.py +30 -0
  53. probotanki_lib-2.0.0/modules/communications/error.py +31 -0
  54. probotanki_lib-2.0.0/modules/communications/log.py +21 -0
  55. probotanki_lib-2.0.0/modules/communications/typeguards.py +16 -0
  56. probotanki_lib-2.0.0/modules/misc/__init__.py +1 -0
  57. probotanki_lib-2.0.0/modules/misc/packetmanager.py +45 -0
  58. probotanki_lib-2.0.0/modules/networking/__init__.py +2 -0
  59. probotanki_lib-2.0.0/modules/networking/asynctankisocket.py +224 -0
  60. probotanki_lib-2.0.0/modules/networking/tankisocket.py +166 -0
  61. probotanki_lib-2.0.0/modules/processing/__init__.py +2 -0
  62. probotanki_lib-2.0.0/modules/processing/abstractprocessor.py +202 -0
  63. probotanki_lib-2.0.0/modules/processing/asyncabstractprocessor.py +249 -0
  64. probotanki_lib-2.0.0/modules/security/__init__.py +2 -0
  65. probotanki_lib-2.0.0/modules/security/cprotection.c +12094 -0
  66. probotanki_lib-2.0.0/modules/security/cprotection.cpython-311-darwin.so +0 -0
  67. probotanki_lib-2.0.0/modules/security/cprotection.pyi +14 -0
  68. probotanki_lib-2.0.0/modules/security/cprotection.pyx +111 -0
  69. probotanki_lib-2.0.0/modules/security/protection.py +76 -0
  70. probotanki_lib-2.0.0/modules/timer/__init__.py +1 -0
  71. probotanki_lib-2.0.0/modules/timer/tankitimer.py +109 -0
  72. probotanki_lib-2.0.0/modules/tracker/__init__.py +2 -0
  73. probotanki_lib-2.0.0/modules/tracker/asyncbasetracker.py +231 -0
  74. probotanki_lib-2.0.0/modules/tracker/asynctarget.py +63 -0
  75. probotanki_lib-2.0.0/modules/tracker/basetracker.py +179 -0
  76. probotanki_lib-2.0.0/modules/tracker/target.py +69 -0
  77. probotanki_lib-2.0.0/packets/__init__.py +10 -0
  78. probotanki_lib-2.0.0/packets/abstractpacket.py +78 -0
  79. probotanki_lib-2.0.0/packets/battle_info/__init__.py +46 -0
  80. probotanki_lib-2.0.0/packets/battle_info/battlefund.py +9 -0
  81. probotanki_lib-2.0.0/packets/battle_info/battlepinginfo.py +10 -0
  82. probotanki_lib-2.0.0/packets/battle_info/battlepingsync.py +10 -0
  83. probotanki_lib-2.0.0/packets/battle_info/battletimeleft.py +12 -0
  84. probotanki_lib-2.0.0/packets/battle_info/changeby.py +9 -0
  85. probotanki_lib-2.0.0/packets/battle_info/fullyrespawned.py +9 -0
  86. probotanki_lib-2.0.0/packets/battle_info/goldboxdroptext.py +11 -0
  87. probotanki_lib-2.0.0/packets/battle_info/initbattlestats.py +14 -0
  88. probotanki_lib-2.0.0/packets/battle_info/killconfirm.py +10 -0
  89. probotanki_lib-2.0.0/packets/battle_info/leftinsidedmbattle.py +10 -0
  90. probotanki_lib-2.0.0/packets/battle_info/leftinsideteambattle.py +10 -0
  91. probotanki_lib-2.0.0/packets/battle_info/loadnewplayerdm.py +12 -0
  92. probotanki_lib-2.0.0/packets/battle_info/loadnewplayerteam.py +13 -0
  93. probotanki_lib-2.0.0/packets/battle_info/playerstartposition.py +9 -0
  94. probotanki_lib-2.0.0/packets/battle_info/sendrespawn.py +6 -0
  95. probotanki_lib-2.0.0/packets/battle_info/tankdamage.py +10 -0
  96. probotanki_lib-2.0.0/packets/battle_info/tankhealth.py +10 -0
  97. probotanki_lib-2.0.0/packets/battle_info/updatebattleplayerstatistics.py +9 -0
  98. probotanki_lib-2.0.0/packets/battle_info/updateteambattlescore.py +10 -0
  99. probotanki_lib-2.0.0/packets/battle_info/userrewards.py +11 -0
  100. probotanki_lib-2.0.0/packets/battle_info/userstats.py +10 -0
  101. probotanki_lib-2.0.0/packets/battle_mechanics/__init__.py +41 -0
  102. probotanki_lib-2.0.0/packets/battle_mechanics/battleusercontrol.py +10 -0
  103. probotanki_lib-2.0.0/packets/battle_mechanics/battleuserteamstats.py +10 -0
  104. probotanki_lib-2.0.0/packets/battle_mechanics/bonusboxdropped.py +11 -0
  105. probotanki_lib-2.0.0/packets/battle_mechanics/bonusboxexistinglocations.py +9 -0
  106. probotanki_lib-2.0.0/packets/battle_mechanics/changedequipment.py +9 -0
  107. probotanki_lib-2.0.0/packets/battle_mechanics/collectcrybox.py +12 -0
  108. probotanki_lib-2.0.0/packets/battle_mechanics/collectedbonusbox.py +12 -0
  109. probotanki_lib-2.0.0/packets/battle_mechanics/deathdelayend.py +6 -0
  110. probotanki_lib-2.0.0/packets/battle_mechanics/despawnalive.py +9 -0
  111. probotanki_lib-2.0.0/packets/battle_mechanics/effectaftermath.py +10 -0
  112. probotanki_lib-2.0.0/packets/battle_mechanics/endrespfantom.py +6 -0
  113. probotanki_lib-2.0.0/packets/battle_mechanics/leavebattle.py +12 -0
  114. probotanki_lib-2.0.0/packets/battle_mechanics/loadbonusboxresources.py +9 -0
  115. probotanki_lib-2.0.0/packets/battle_mechanics/loadcurrentsupplyeffect.py +9 -0
  116. probotanki_lib-2.0.0/packets/battle_mechanics/loadmaplights.py +9 -0
  117. probotanki_lib-2.0.0/packets/battle_mechanics/loadownedgarageitems.py +9 -0
  118. probotanki_lib-2.0.0/packets/battle_mechanics/loadpurchasableitems.py +9 -0
  119. probotanki_lib-2.0.0/packets/battle_mechanics/minelocation.py +10 -0
  120. probotanki_lib-2.0.0/packets/battle_mechanics/mineplace.py +9 -0
  121. probotanki_lib-2.0.0/packets/battle_mechanics/move.py +13 -0
  122. probotanki_lib-2.0.0/packets/battle_mechanics/movecommand.py +11 -0
  123. probotanki_lib-2.0.0/packets/battle_mechanics/moved.py +10 -0
  124. probotanki_lib-2.0.0/packets/battle_mechanics/playerequipment.py +9 -0
  125. probotanki_lib-2.0.0/packets/battle_mechanics/playershot.py +10 -0
  126. probotanki_lib-2.0.0/packets/battle_mechanics/rankup.py +13 -0
  127. probotanki_lib-2.0.0/packets/battle_mechanics/removebonusbox.py +9 -0
  128. probotanki_lib-2.0.0/packets/battle_mechanics/respawndelay.py +10 -0
  129. probotanki_lib-2.0.0/packets/battle_mechanics/selfdestruct.py +6 -0
  130. probotanki_lib-2.0.0/packets/battle_mechanics/selfdestructed.py +10 -0
  131. probotanki_lib-2.0.0/packets/battle_mechanics/shotdirection.py +10 -0
  132. probotanki_lib-2.0.0/packets/battle_mechanics/shoteffect.py +10 -0
  133. probotanki_lib-2.0.0/packets/battle_mechanics/shoteffectapplied.py +9 -0
  134. probotanki_lib-2.0.0/packets/battle_mechanics/startrespfantom.py +10 -0
  135. probotanki_lib-2.0.0/packets/battle_mechanics/suicidedelay.py +9 -0
  136. probotanki_lib-2.0.0/packets/battle_mechanics/tankmovementinfo.py +10 -0
  137. probotanki_lib-2.0.0/packets/battle_mechanics/tankstatsynced.py +12 -0
  138. probotanki_lib-2.0.0/packets/battle_mechanics/turretcontrol.py +9 -0
  139. probotanki_lib-2.0.0/packets/battle_mechanics/turretrotated.py +11 -0
  140. probotanki_lib-2.0.0/packets/battle_mechanics/turretrotation.py +11 -0
  141. probotanki_lib-2.0.0/packets/battle_mechanics/usersuppliesinfo.py +9 -0
  142. probotanki_lib-2.0.0/packets/battle_mechanics/usesupply.py +12 -0
  143. probotanki_lib-2.0.0/packets/chat/__init__.py +15 -0
  144. probotanki_lib-2.0.0/packets/chat/receivegamechat.py +10 -0
  145. probotanki_lib-2.0.0/packets/chat/receivegamesystemchat.py +9 -0
  146. probotanki_lib-2.0.0/packets/chat/receivelobbychat.py +10 -0
  147. probotanki_lib-2.0.0/packets/chat/sendgamechat.py +10 -0
  148. probotanki_lib-2.0.0/packets/chat/sendlobbychat.py +9 -0
  149. probotanki_lib-2.0.0/packets/chat/wipelobbymessages.py +9 -0
  150. probotanki_lib-2.0.0/packets/entry/__init__.py +55 -0
  151. probotanki_lib-2.0.0/packets/entry/answercaptcha.py +11 -0
  152. probotanki_lib-2.0.0/packets/entry/banned.py +10 -0
  153. probotanki_lib-2.0.0/packets/entry/captchacorrect.py +10 -0
  154. probotanki_lib-2.0.0/packets/entry/changelayout.py +10 -0
  155. probotanki_lib-2.0.0/packets/entry/checknameavailability.py +10 -0
  156. probotanki_lib-2.0.0/packets/entry/createaccount.py +10 -0
  157. probotanki_lib-2.0.0/packets/entry/email.py +10 -0
  158. probotanki_lib-2.0.0/packets/entry/invitecodestatus.py +9 -0
  159. probotanki_lib-2.0.0/packets/entry/loadaccountstats.py +12 -0
  160. probotanki_lib-2.0.0/packets/entry/loadfriendslist.py +10 -0
  161. probotanki_lib-2.0.0/packets/entry/loadmapinfo.py +10 -0
  162. probotanki_lib-2.0.0/packets/entry/loadnewbierewards.py +11 -0
  163. probotanki_lib-2.0.0/packets/entry/loadratingstats.py +9 -0
  164. probotanki_lib-2.0.0/packets/entry/loadresources.py +11 -0
  165. probotanki_lib-2.0.0/packets/entry/login.py +10 -0
  166. probotanki_lib-2.0.0/packets/entry/loginfailed.py +6 -0
  167. probotanki_lib-2.0.0/packets/entry/loginready.py +9 -0
  168. probotanki_lib-2.0.0/packets/entry/loginsuccess.py +6 -0
  169. probotanki_lib-2.0.0/packets/entry/nameavailable.py +6 -0
  170. probotanki_lib-2.0.0/packets/entry/nameunavailable.py +10 -0
  171. probotanki_lib-2.0.0/packets/entry/receivecaptcha.py +13 -0
  172. probotanki_lib-2.0.0/packets/entry/requestcaptcha.py +10 -0
  173. probotanki_lib-2.0.0/packets/entry/resourcesloaded.py +9 -0
  174. probotanki_lib-2.0.0/packets/entry/setcaptchakeys.py +11 -0
  175. probotanki_lib-2.0.0/packets/entry/setclientlang.py +10 -0
  176. probotanki_lib-2.0.0/packets/entry/wrongnewcaptcha.py +13 -0
  177. probotanki_lib-2.0.0/packets/garage/__init__.py +13 -0
  178. probotanki_lib-2.0.0/packets/garage/buykit.py +11 -0
  179. probotanki_lib-2.0.0/packets/garage/buymultipleitems.py +10 -0
  180. probotanki_lib-2.0.0/packets/garage/checkitemmounted.py +10 -0
  181. probotanki_lib-2.0.0/packets/garage/loadgarage.py +6 -0
  182. probotanki_lib-2.0.0/packets/garage/mountitem.py +9 -0
  183. probotanki_lib-2.0.0/packets/lobby/__init__.py +47 -0
  184. probotanki_lib-2.0.0/packets/lobby/acceptinvite.py +9 -0
  185. probotanki_lib-2.0.0/packets/lobby/battlecreated.py +9 -0
  186. probotanki_lib-2.0.0/packets/lobby/battlekickreason.py +10 -0
  187. probotanki_lib-2.0.0/packets/lobby/checkbattlename.py +9 -0
  188. probotanki_lib-2.0.0/packets/lobby/createbattle.py +22 -0
  189. probotanki_lib-2.0.0/packets/lobby/joinbattle.py +9 -0
  190. probotanki_lib-2.0.0/packets/lobby/joinedoutsidedmbattle.py +10 -0
  191. probotanki_lib-2.0.0/packets/lobby/joinedoutsideteambattle.py +11 -0
  192. probotanki_lib-2.0.0/packets/lobby/joinedselecteddmbattle.py +11 -0
  193. probotanki_lib-2.0.0/packets/lobby/joinedselectedteambattle.py +12 -0
  194. probotanki_lib-2.0.0/packets/lobby/leftoutsidedmbattle.py +10 -0
  195. probotanki_lib-2.0.0/packets/lobby/leftoutsideteambattle.py +10 -0
  196. probotanki_lib-2.0.0/packets/lobby/leftselectedpreview.py +10 -0
  197. probotanki_lib-2.0.0/packets/lobby/loadallbattles.py +9 -0
  198. probotanki_lib-2.0.0/packets/lobby/loadbattleinfo.py +9 -0
  199. probotanki_lib-2.0.0/packets/lobby/loadlobby.py +6 -0
  200. probotanki_lib-2.0.0/packets/lobby/openfriendslist.py +6 -0
  201. probotanki_lib-2.0.0/packets/lobby/receivedinvite.py +9 -0
  202. probotanki_lib-2.0.0/packets/lobby/rejectinvite.py +9 -0
  203. probotanki_lib-2.0.0/packets/lobby/removebattle.py +9 -0
  204. probotanki_lib-2.0.0/packets/lobby/roundfinish.py +9 -0
  205. probotanki_lib-2.0.0/packets/lobby/roundstart.py +9 -0
  206. probotanki_lib-2.0.0/packets/lobby/selectbattle.py +9 -0
  207. probotanki_lib-2.0.0/packets/lobby/sendinvite.py +9 -0
  208. probotanki_lib-2.0.0/packets/lobby/serverrestart.py +9 -0
  209. probotanki_lib-2.0.0/packets/lobby/spectatebattle.py +6 -0
  210. probotanki_lib-2.0.0/packets/lobby/swapteams.py +9 -0
  211. probotanki_lib-2.0.0/packets/lobby/updateplayerdmbattlepreview.py +11 -0
  212. probotanki_lib-2.0.0/packets/lobby/updateplayerteambattlepreview.py +11 -0
  213. probotanki_lib-2.0.0/packets/lobby/updateteambattlepreview.py +11 -0
  214. probotanki_lib-2.0.0/packets/network/__init__.py +9 -0
  215. probotanki_lib-2.0.0/packets/network/activateprotection.py +10 -0
  216. probotanki_lib-2.0.0/packets/network/ping.py +7 -0
  217. probotanki_lib-2.0.0/packets/network/pong.py +7 -0
  218. probotanki_lib-2.0.0/packets/others/__init__.py +16 -0
  219. probotanki_lib-2.0.0/packets/others/acceptmission.py +9 -0
  220. probotanki_lib-2.0.0/packets/others/battleid.py +9 -0
  221. probotanki_lib-2.0.0/packets/others/buyfromshop.py +9 -0
  222. probotanki_lib-2.0.0/packets/others/changefreemission.py +9 -0
  223. probotanki_lib-2.0.0/packets/others/changemission.py +9 -0
  224. probotanki_lib-2.0.0/packets/others/changeshoplocation.py +9 -0
  225. probotanki_lib-2.0.0/packets/others/closesettings.py +9 -0
  226. probotanki_lib-2.0.0/packets/others/completedmission.py +9 -0
  227. probotanki_lib-2.0.0/packets/others/loadmissions.py +9 -0
  228. probotanki_lib-2.0.0/packets/others/loadreferral.py +6 -0
  229. probotanki_lib-2.0.0/packets/others/loadsettings.py +6 -0
  230. probotanki_lib-2.0.0/packets/others/notification.py +9 -0
  231. probotanki_lib-2.0.0/packets/others/referraldata.py +14 -0
  232. probotanki_lib-2.0.0/packets/others/shopinfo.py +9 -0
  233. probotanki_lib-2.0.0/packets/others/showmissions.py +11 -0
  234. probotanki_lib-2.0.0/packets/others/shownewmission.py +13 -0
  235. probotanki_lib-2.0.0/packets/shop/__init__.py +9 -0
  236. probotanki_lib-2.0.0/packets/shop/promocodefailed.py +6 -0
  237. probotanki_lib-2.0.0/packets/shop/promocodesuccess.py +6 -0
  238. probotanki_lib-2.0.0/packets/shop/sendpromocode.py +9 -0
  239. probotanki_lib-2.0.0/packets/status/__init__.py +15 -0
  240. probotanki_lib-2.0.0/packets/status/inbattlestatus.py +10 -0
  241. probotanki_lib-2.0.0/packets/status/notinbattlestatus.py +10 -0
  242. probotanki_lib-2.0.0/packets/status/onlinestatus.py +11 -0
  243. probotanki_lib-2.0.0/packets/status/premiumstatus.py +11 -0
  244. probotanki_lib-2.0.0/packets/status/rankstatus.py +11 -0
  245. probotanki_lib-2.0.0/packets/status/subscribestatus.py +11 -0
  246. probotanki_lib-2.0.0/packets/turrets/__init__.py +20 -0
  247. probotanki_lib-2.0.0/packets/turrets/firedamage.py +10 -0
  248. probotanki_lib-2.0.0/packets/turrets/fireendout.py +10 -0
  249. probotanki_lib-2.0.0/packets/turrets/firestartout.py +10 -0
  250. probotanki_lib-2.0.0/packets/turrets/freezeendout.py +9 -0
  251. probotanki_lib-2.0.0/packets/turrets/freezestartout.py +9 -0
  252. probotanki_lib-2.0.0/packets/turrets/hammershotout.py +15 -0
  253. probotanki_lib-2.0.0/packets/turrets/multishotturretin.py +14 -0
  254. probotanki_lib-2.0.0/packets/turrets/multishotturretout.py +15 -0
  255. probotanki_lib-2.0.0/packets/turrets/railgunshotinitout.py +10 -0
  256. probotanki_lib-2.0.0/packets/turrets/railgunshotout.py +12 -0
  257. probotanki_lib-2.0.0/packets/turrets/shaftarcadeout.py +12 -0
  258. probotanki_lib-2.0.0/packets/turrets/shaftscopeinitout.py +13 -0
  259. probotanki_lib-2.0.0/packets/turrets/shaftscopeout.py +12 -0
  260. probotanki_lib-2.0.0/packets/turrets/smokeyshootairout.py +9 -0
  261. probotanki_lib-2.0.0/packets/turrets/smokeyshootwallout.py +10 -0
  262. probotanki_lib-2.0.0/packets/turrets/smokyshoottargetout.py +11 -0
  263. probotanki_lib-2.0.0/packets/turrets/smokyshotin.py +10 -0
  264. probotanki_lib-2.0.0/packets/turrets/syncturretdata.py +9 -0
  265. probotanki_lib-2.0.0/packets/turrets/vulcanendout.py +12 -0
  266. probotanki_lib-2.0.0/packets/turrets/vulcanstartout.py +12 -0
  267. probotanki_lib-2.0.0/probotanki_lib.egg-info/PKG-INFO +64 -0
  268. probotanki_lib-2.0.0/probotanki_lib.egg-info/SOURCES.txt +557 -0
  269. probotanki_lib-2.0.0/probotanki_lib.egg-info/dependency_links.txt +1 -0
  270. probotanki_lib-2.0.0/probotanki_lib.egg-info/not-zip-safe +1 -0
  271. probotanki_lib-2.0.0/probotanki_lib.egg-info/requires.txt +2 -0
  272. probotanki_lib-2.0.0/probotanki_lib.egg-info/top_level.txt +1 -0
  273. probotanki_lib-2.0.0/pyproject.toml +29 -0
  274. probotanki_lib-2.0.0/requirements.txt +2 -0
  275. probotanki_lib-2.0.0/setup.cfg +4 -0
  276. probotanki_lib-2.0.0/setup.py +48 -0
  277. probotanki_lib-2.0.0/utils/__init__.py +4 -0
  278. probotanki_lib-2.0.0/utils/address.py +19 -0
  279. probotanki_lib-2.0.0/utils/ebytearray.py +77 -0
  280. probotanki_lib-2.0.0/utils/enums/__init__.py +6 -0
  281. probotanki_lib-2.0.0/utils/enums/autoenum.py +9 -0
  282. probotanki_lib-2.0.0/utils/enums/compare.py +5 -0
  283. probotanki_lib-2.0.0/utils/enums/layout.py +9 -0
  284. probotanki_lib-2.0.0/utils/enums/logchanneltype.py +9 -0
  285. probotanki_lib-2.0.0/utils/enums/message.py +8 -0
  286. probotanki_lib-2.0.0/utils/normalizer.py +3 -0
  287. probotanki_lib-2.0.0/utils/reconnectionconfig.py +21 -0
@@ -0,0 +1,13 @@
1
+ include README.md
2
+ include requirements.txt
3
+ graft modules
4
+ graft packets
5
+ graft utils
6
+ graft codec
7
+
8
+ # Include all Cython and interface files
9
+ global-include *.pyx *.pxd *.pyi
10
+
11
+ # Exclude common unwanted files
12
+ prune */__pycache__
13
+ global-exclude *.py[co]
@@ -0,0 +1,64 @@
1
+ Metadata-Version: 2.4
2
+ Name: probotanki-lib
3
+ Version: 2.0.0
4
+ Summary: Core library for ProboTanki providing networking modules and packet handling utilities.
5
+ Author-email: Teinc3 <teinc3@gmail.com>
6
+ License: Proprietary
7
+ Project-URL: Homepage, https://github.com/Teinc3/ProboTanki-Lib
8
+ Project-URL: Documentation, https://deepwiki.com/Teinc3/ProboTanki-Lib
9
+ Project-URL: Issue Tracker, https://github.com/Teinc3/ProboTanki-Lib/issues
10
+ Classifier: Programming Language :: Python :: 3
11
+ Classifier: Operating System :: OS Independent
12
+ Classifier: Development Status :: 5 - Production/Stable
13
+ Requires-Python: >=3.9
14
+ Description-Content-Type: text/markdown
15
+ Requires-Dist: pysocks
16
+ Requires-Dist: aiosocks
17
+ Dynamic: requires-dist
18
+
19
+ # ProboTanki-Lib
20
+ [![Latest Release](https://img.shields.io/github/v/release/Teinc3/ProboTanki-Lib?display_name=tag&sort=semver)](https://github.com/Teinc3/ProboTanki-Lib/releases/latest)
21
+ [![Ask DeepWiki](https://deepwiki.com/badge.svg)](https://deepwiki.com/Teinc3/ProboTanki-Lib)
22
+
23
+ A core library for ProboTanki providing networking modules and packet handling utilities.
24
+
25
+ ## Installation
26
+ This library is not available on PyPI and cannot be installed from there.
27
+
28
+ To install it, clone the repository to a local directory in your project.
29
+ ```bash
30
+ cd /path/to/your/project
31
+ mkdir -p pbtlib
32
+ git clone https://github.com/Teinc3/ProboTanki-Lib.git
33
+ ```
34
+ *OR*
35
+ ```bash
36
+ git clone git@github.com:Teinc3/ProboTanki-Lib.git
37
+ ```
38
+
39
+ Then, add the path to your requirements:
40
+ ```pip-requirements
41
+ ./pbtlib
42
+
43
+ # Other requirements you might need...
44
+ ```
45
+ *OR*
46
+ ```bash
47
+ pip install ./pbtlib
48
+ ```
49
+
50
+ This will install the library in your Python environment.
51
+
52
+ If you would like to develop a fork of the library alongside your project,
53
+ you can also install the package in *Editable Mode*:
54
+ ```bash
55
+ pip install -e ./pbtlib
56
+ ```
57
+
58
+ ## License and Contributing
59
+ This library is not licensed as it is subject to the terms of ProTanki Online.
60
+
61
+ If you want to contribute to this library, please fork the repository and create a pull request with your changes.
62
+ Please make sure to follow the coding style and conventions used in the library.
63
+
64
+ If you have any questions or suggestions, feel free to open an issue in the repository.
@@ -0,0 +1,46 @@
1
+ # ProboTanki-Lib
2
+ [![Latest Release](https://img.shields.io/github/v/release/Teinc3/ProboTanki-Lib?display_name=tag&sort=semver)](https://github.com/Teinc3/ProboTanki-Lib/releases/latest)
3
+ [![Ask DeepWiki](https://deepwiki.com/badge.svg)](https://deepwiki.com/Teinc3/ProboTanki-Lib)
4
+
5
+ A core library for ProboTanki providing networking modules and packet handling utilities.
6
+
7
+ ## Installation
8
+ This library is not available on PyPI and cannot be installed from there.
9
+
10
+ To install it, clone the repository to a local directory in your project.
11
+ ```bash
12
+ cd /path/to/your/project
13
+ mkdir -p pbtlib
14
+ git clone https://github.com/Teinc3/ProboTanki-Lib.git
15
+ ```
16
+ *OR*
17
+ ```bash
18
+ git clone git@github.com:Teinc3/ProboTanki-Lib.git
19
+ ```
20
+
21
+ Then, add the path to your requirements:
22
+ ```pip-requirements
23
+ ./pbtlib
24
+
25
+ # Other requirements you might need...
26
+ ```
27
+ *OR*
28
+ ```bash
29
+ pip install ./pbtlib
30
+ ```
31
+
32
+ This will install the library in your Python environment.
33
+
34
+ If you would like to develop a fork of the library alongside your project,
35
+ you can also install the package in *Editable Mode*:
36
+ ```bash
37
+ pip install -e ./pbtlib
38
+ ```
39
+
40
+ ## License and Contributing
41
+ This library is not licensed as it is subject to the terms of ProTanki Online.
42
+
43
+ If you want to contribute to this library, please fork the repository and create a pull request with your changes.
44
+ Please make sure to follow the coding style and conventions used in the library.
45
+
46
+ If you have any questions or suggestions, feel free to open an issue in the repository.
@@ -0,0 +1,2 @@
1
+ # Base package for ProboTanki-Lib
2
+ # Does not include any imports here, access through submodules
@@ -0,0 +1,5 @@
1
+ # As the base codecs should be imported directly through the file name
2
+ # If they import the base codecs from here, it will cause a circular import
3
+ # So only use this for AbstractPacket's importing of BaseCodec
4
+
5
+ from .basecodec import BaseCodec
@@ -0,0 +1,34 @@
1
+ from abc import ABC, abstractmethod
2
+ from typing import TypeVar, Generic, Any
3
+
4
+ from ..utils import EByteArray
5
+
6
+ T = TypeVar("T", bound=Any)
7
+
8
+
9
+ class BaseCodec(ABC, Generic[T]):
10
+ """
11
+ Base "Interface" for all codecs, whether primitive or complex
12
+
13
+ Type: Generic[T] (T is bound to Any, but can be specified for less complex codecs)
14
+
15
+ Static Methods:
16
+ - decode: Decodes a value from an ebytearray
17
+ - encode: Encodes a value to an ebytearray
18
+ """
19
+
20
+ boolshortern = False
21
+
22
+ def __init__(self, buffer: EByteArray):
23
+ self._buffer = buffer
24
+
25
+ @abstractmethod
26
+ def decode(self) -> T:
27
+ raise NotImplementedError()
28
+
29
+ @abstractmethod
30
+ def encode(self, value: T) -> int:
31
+ """
32
+ Encodes a value to an ebytearray and returns the number of bytes written
33
+ """
34
+ raise NotImplementedError()
@@ -0,0 +1,7 @@
1
+ from .doubleintcodec import DoubleIntCodecFactory
2
+ from .stringcodec import StringCodec
3
+ from .jsoncodec import JsonCodec
4
+ from .vector3dcodec import Vector3DCodec
5
+ from .vectorshortcodec import VectorShortCodec
6
+ from .vectorstringcodec import VectorStringCodec
7
+ from .vectorvector3dcodec import VectorVector3DCodec
@@ -0,0 +1,6 @@
1
+ from ..factory import MultiTypeCodecFactory
2
+ from ..primitive import IntCodec
3
+
4
+
5
+ def DoubleIntCodecFactory(attribute1: str, attribute2: str):
6
+ return MultiTypeCodecFactory([attribute1, attribute2], IntCodec)
@@ -0,0 +1,14 @@
1
+ import json
2
+
3
+ from .stringcodec import StringCodec
4
+ from ..basecodec import BaseCodec
5
+
6
+
7
+ class JsonCodec(BaseCodec[dict]):
8
+ """Codec for JSON objects"""
9
+
10
+ def decode(self):
11
+ return json.loads(StringCodec(self._buffer).decode())
12
+
13
+ def encode(self, value):
14
+ return StringCodec(self._buffer).encode(json.dumps(value, separators=(',', ':')))
@@ -0,0 +1,31 @@
1
+ from ..basecodec import BaseCodec
2
+ from ...utils import EByteArray
3
+
4
+
5
+ class StringCodec(BaseCodec[str]):
6
+ """
7
+ Codec for string values.
8
+
9
+ 1 Byte - Is string empty?
10
+ (If empty, everything else is ignored)
11
+ 4 Bytes - String length
12
+ Remaining Bytes - String value
13
+ """
14
+
15
+ def decode(self):
16
+ is_empty = self._buffer.read_boolean()
17
+ if is_empty:
18
+ return ""
19
+ length = self._buffer.read_int()
20
+ return self._buffer.read_string(length)
21
+
22
+ def encode(self, value):
23
+ self._buffer.write_boolean(not value)
24
+ if not value:
25
+ return 1
26
+ # NOTE: len() returns the length of the string in CHARS NOT BYTES!!!
27
+ string_buffer = EByteArray().write_string(value)
28
+ string_buffer_len = len(string_buffer)
29
+ self._buffer.write_int(string_buffer_len)
30
+ self._buffer.write(string_buffer)
31
+ return 1 + 4 + string_buffer_len
@@ -0,0 +1,4 @@
1
+ from ..factory import MultiTypeCodecFactory
2
+ from ..primitive import FloatCodec
3
+
4
+ Vector3DCodec = MultiTypeCodecFactory(["x", "y", "z"], FloatCodec, True)
@@ -0,0 +1,4 @@
1
+ from ..factory import VectorCodecFactory
2
+ from ..primitive import ShortCodec
3
+
4
+ VectorShortCodec = VectorCodecFactory(int, ShortCodec, True)
@@ -0,0 +1,4 @@
1
+ from .stringcodec import StringCodec
2
+ from ..factory import VectorCodecFactory
3
+
4
+ VectorStringCodec = VectorCodecFactory(str, StringCodec, True)
@@ -0,0 +1,4 @@
1
+ from .vector3dcodec import Vector3DCodec
2
+ from ..factory import VectorCodecFactory
3
+
4
+ VectorVector3DCodec = VectorCodecFactory(dict, Vector3DCodec, True)
@@ -0,0 +1,23 @@
1
+ # Again, only use the imports from this file externally
2
+ # Internally, juse reference the file directly.
3
+
4
+ from .battleinfocodec import BattleInfoCodec
5
+ from .battleimfouserpreviewcodec import BattleInfoUserCodec
6
+ from .battleusercodec import BattleUserCodec
7
+ from .battlelimitscodec import BattleLimitsCodec
8
+ from .battlenotifiercodec import BattleNotifierCodec
9
+ from .battleuserrewardscodec import BattleUserRewardsCodec
10
+ from .battleuserstatscodec import BattleUserStatsCodec
11
+ from .chatmessagecodec import ChatMessageCodec
12
+ from .missioncodec import MissionCodec
13
+ from .missionrewardcodec import MissionRewardCodec
14
+ from .missionstreakcodec import MissionStreakCodec
15
+ from .movecodec import MoveCodec
16
+ from .rankrangecodec import RankRangeCodec
17
+ from .tankdamagecodec import TankDamageCodec
18
+ from .targethitcodec import TargetHitCodec
19
+ from .targetpositioncodec import TargetPositionCodec
20
+ from .turretrotatecodec import TurretRotateCodec
21
+ from .userstatscodec import UserStatsCodec
22
+ from .userstatuscodec import UserStatusCodec
23
+ from .referraldatacodec import ReferralDataCodec
@@ -0,0 +1,8 @@
1
+ from ..custombasecodec import CustomBaseCodec
2
+ from ..complex import StringCodec
3
+ from ..primitive import BoolCodec, IntCodec
4
+
5
+
6
+ class BattleInfoUserCodec(CustomBaseCodec):
7
+ attributes = ["kills", "score", "suspicious", "user"]
8
+ codecs = [IntCodec, IntCodec, BoolCodec, StringCodec]
@@ -0,0 +1,9 @@
1
+ from ..custombasecodec import CustomBaseCodec
2
+ from ..complex import StringCodec
3
+ from ..primitive import BoolCodec, IntCodec
4
+ from .rankrangecodec import RankRangeCodec
5
+
6
+
7
+ class BattleInfoCodec(CustomBaseCodec):
8
+ attributes = ["battleID", "mapName", "mode", "private", "proBattle", "range", "serverNumber"]
9
+ codecs = [StringCodec, StringCodec, IntCodec, BoolCodec, BoolCodec, RankRangeCodec, IntCodec]
@@ -0,0 +1,3 @@
1
+ from ..complex.doubleintcodec import DoubleIntCodecFactory
2
+
3
+ BattleLimitsCodec = DoubleIntCodecFactory("scoreLimit", "timeLimit")
@@ -0,0 +1,8 @@
1
+ from ..custombasecodec import CustomBaseCodec
2
+ from ..complex import StringCodec
3
+ from .battleinfocodec import BattleInfoCodec
4
+
5
+
6
+ class BattleNotifierCodec(CustomBaseCodec):
7
+ attributes = ["battleInfo", "username"]
8
+ codecs = [BattleInfoCodec, StringCodec]
@@ -0,0 +1,8 @@
1
+ from ..custombasecodec import CustomBaseCodec
2
+ from ..complex import StringCodec
3
+ from ..primitive import IntCodec, ByteCodec
4
+
5
+
6
+ class BattleUserCodec(CustomBaseCodec):
7
+ attributes = ['modLevel', 'deaths', 'kills', 'rank', 'score', 'username']
8
+ codecs = [IntCodec, IntCodec, IntCodec, ByteCodec, IntCodec, StringCodec]
@@ -0,0 +1,8 @@
1
+ from ..custombasecodec import CustomBaseCodec
2
+ from ..complex import StringCodec
3
+ from ..primitive import IntCodec
4
+
5
+
6
+ class BattleUserRewardsCodec(CustomBaseCodec):
7
+ attributes = ["newbiesAbonementBonusReward", "premiumBonusReward", "reward", "userid"]
8
+ codecs = [IntCodec, IntCodec, IntCodec, StringCodec]
@@ -0,0 +1,8 @@
1
+ from ..custombasecodec import CustomBaseCodec
2
+ from ..complex import StringCodec
3
+ from ..primitive import IntCodec
4
+
5
+
6
+ class BattleUserStatsCodec(CustomBaseCodec):
7
+ attributes = ["deaths", "kills", "score", "user"]
8
+ codecs = [IntCodec, IntCodec, IntCodec, StringCodec]
@@ -0,0 +1,9 @@
1
+ from ..custombasecodec import CustomBaseCodec
2
+ from ..complex import StringCodec
3
+ from ..primitive import BoolCodec
4
+ from .userstatuscodec import UserStatusCodec
5
+
6
+
7
+ class ChatMessageCodec(CustomBaseCodec):
8
+ attributes = ["authorStatus", "systemMessage", "targetStatus", "message", "warning"]
9
+ codecs = [UserStatusCodec, BoolCodec, UserStatusCodec, StringCodec, BoolCodec]
@@ -0,0 +1,11 @@
1
+ from ..custombasecodec import CustomBaseCodec
2
+ from ..complex import StringCodec
3
+ from ..factory import VectorCodecFactory
4
+ from ..primitive import BoolCodec, IntCodec
5
+ from .missionrewardcodec import MissionRewardCodec
6
+
7
+
8
+ class MissionCodec(CustomBaseCodec):
9
+ attributes = ["freeChange", "description", "threshold", "image", "rewards", "progress", "missionID", "changeCost"]
10
+ codecs = [BoolCodec, StringCodec, IntCodec, IntCodec, VectorCodecFactory(dict, MissionRewardCodec), IntCodec,
11
+ IntCodec, IntCodec]
@@ -0,0 +1,8 @@
1
+ from ..custombasecodec import CustomBaseCodec
2
+ from ..complex import StringCodec
3
+ from ..primitive import IntCodec
4
+
5
+
6
+ class MissionRewardCodec(CustomBaseCodec):
7
+ attributes = ["amount", "name"]
8
+ codecs = [IntCodec, StringCodec]
@@ -0,0 +1,7 @@
1
+ from ..custombasecodec import CustomBaseCodec
2
+ from ..primitive import IntCodec, BoolCodec
3
+
4
+
5
+ class MissionStreakCodec(CustomBaseCodec):
6
+ attributes = ["level", "streak", "doneToday", "questImgID", "rewardImgID"]
7
+ codecs = [IntCodec, IntCodec, BoolCodec, IntCodec, IntCodec]
@@ -0,0 +1,8 @@
1
+ from ..custombasecodec import CustomBaseCodec
2
+ from ..complex import Vector3DCodec
3
+ from ..primitive import ByteCodec
4
+
5
+
6
+ class MoveCodec(CustomBaseCodec):
7
+ attributes = ["angV", "control", "linV", "orientation", "pos"]
8
+ codecs = [Vector3DCodec, ByteCodec, Vector3DCodec, Vector3DCodec, Vector3DCodec]
@@ -0,0 +1,3 @@
1
+ from ..complex import DoubleIntCodecFactory
2
+
3
+ RankRangeCodec = DoubleIntCodecFactory("maxRank", "minRank")
@@ -0,0 +1,11 @@
1
+ from ..custombasecodec import CustomBaseCodec
2
+ from ..primitive import IntCodec
3
+ from ..complex import StringCodec
4
+
5
+
6
+ class ReferralDataCodec(CustomBaseCodec):
7
+ attributes = ['income', 'username']
8
+ codecs = [IntCodec, StringCodec]
9
+
10
+
11
+ __all__ = ['ReferralDataCodec']
@@ -0,0 +1,8 @@
1
+ from ..custombasecodec import CustomBaseCodec
2
+ from ..complex import StringCodec
3
+ from ..primitive import FloatCodec, IntCodec
4
+
5
+
6
+ class TankDamageCodec(CustomBaseCodec):
7
+ attributes = ["damage", "damageType", "target"]
8
+ codecs = [FloatCodec, IntCodec, StringCodec]
@@ -0,0 +1,11 @@
1
+ from ..custombasecodec import CustomBaseCodec
2
+ from ..complex import Vector3DCodec, StringCodec
3
+ from ..primitive import ByteCodec
4
+
5
+
6
+ class TargetHitCodec(CustomBaseCodec):
7
+ attributes = ['direction', 'localHitPoint', 'numberOfHits', 'target']
8
+ codecs = [Vector3DCodec, Vector3DCodec, ByteCodec, StringCodec]
9
+
10
+
11
+ __all__ = ['TargetHitCodec']
@@ -0,0 +1,8 @@
1
+ from ..custombasecodec import CustomBaseCodec
2
+ from ..complex import Vector3DCodec, StringCodec
3
+ from ..primitive import FloatCodec
4
+
5
+
6
+ class TargetPositionCodec(CustomBaseCodec):
7
+ attributes = ['localHitPoint', 'orientation', 'position', 'target', 'turretAngle']
8
+ codecs = [Vector3DCodec, Vector3DCodec, Vector3DCodec, StringCodec, FloatCodec]
@@ -0,0 +1,7 @@
1
+ from ..custombasecodec import CustomBaseCodec
2
+ from ..primitive import ByteCodec, FloatCodec
3
+
4
+
5
+ class TurretRotateCodec(CustomBaseCodec):
6
+ attributes = ["angle", "control"]
7
+ codecs = [FloatCodec, ByteCodec]
@@ -0,0 +1,8 @@
1
+ from ..custombasecodec import CustomBaseCodec
2
+ from ..complex import StringCodec
3
+ from ..primitive import IntCodec
4
+
5
+
6
+ class UserStatsCodec(CustomBaseCodec):
7
+ attributes = ["deaths", "kills", "score", "username"]
8
+ codecs = [IntCodec, IntCodec, IntCodec, StringCodec]
@@ -0,0 +1,9 @@
1
+ from ..custombasecodec import CustomBaseCodec
2
+ from ..complex import StringCodec
3
+ from ..primitive import IntCodec
4
+
5
+
6
+ class UserStatusCodec(CustomBaseCodec):
7
+ attributes = ['modLevel', 'ip', 'rank', 'username']
8
+ codecs = [IntCodec, StringCodec, IntCodec, StringCodec]
9
+ boolshortern = True
@@ -0,0 +1,33 @@
1
+ from typing import Type, ClassVar
2
+
3
+ from .basecodec import BaseCodec
4
+ from .primitive import BoolCodec
5
+
6
+
7
+ class CustomBaseCodec(BaseCodec[dict]):
8
+ attributes: ClassVar[list[str]] = []
9
+ codecs: ClassVar[list[Type[BaseCodec]]] = []
10
+
11
+ # Override these methods if necessary
12
+ def decode(self):
13
+ obj = {}
14
+ if self.boolshortern and BoolCodec(self._buffer).decode():
15
+ return obj
16
+
17
+ for i in range(len(self.codecs)):
18
+ attribute_name = self.attributes[i]
19
+ codec_instance = self.codecs[i](self._buffer)
20
+ decoded_value = codec_instance.decode()
21
+ obj[attribute_name] = decoded_value
22
+ return obj
23
+
24
+ def encode(self, value):
25
+ data_len = 0
26
+ if self.boolshortern:
27
+ data_len += BoolCodec(self._buffer).encode(not value)
28
+ if not value:
29
+ return data_len
30
+
31
+ for i in range(len(self.codecs)):
32
+ data_len += self.codecs[i](self._buffer).encode(value[self.attributes[i]])
33
+ return data_len
@@ -0,0 +1,7 @@
1
+ from .multitypecodec import MultiTypeCodecFactory
2
+ from .vectorcodec import VectorCodecFactory
3
+
4
+ __all__ = [
5
+ MultiTypeCodecFactory,
6
+ VectorCodecFactory
7
+ ]
@@ -0,0 +1,31 @@
1
+ from typing import Type
2
+
3
+ from ..basecodec import BaseCodec
4
+ from ..primitive import BoolCodec
5
+
6
+
7
+ def MultiTypeCodecFactory(attributes: list[str], element_codec: Type[BaseCodec], param_boolshortern=False):
8
+ class MultiTypeCodec(BaseCodec[dict]):
9
+ boolshortern = param_boolshortern
10
+
11
+ def decode(self):
12
+ obj = {}
13
+ if self.boolshortern and BoolCodec(self._buffer).decode():
14
+ return obj
15
+ for attribute in attributes:
16
+ obj[attribute] = element_codec(self._buffer).decode()
17
+ return obj
18
+
19
+ def encode(self, value):
20
+ data_len = 0
21
+ if self.boolshortern:
22
+ data_len += BoolCodec(self._buffer).encode(not value)
23
+ if not value:
24
+ return data_len
25
+ for attribute in attributes:
26
+ data_len += element_codec(self._buffer).encode(value[attribute])
27
+ return data_len
28
+
29
+ type_name = element_codec.__name__.replace("Codec", "").capitalize()
30
+ MultiTypeCodec.__name__ = f"Multi{type_name}Codec[{len(attributes)}]"
31
+ return MultiTypeCodec
@@ -0,0 +1,40 @@
1
+ from typing import Type, TypeVar, Generic
2
+
3
+ from ..basecodec import BaseCodec
4
+ from ..primitive import IntCodec, BoolCodec
5
+
6
+ T = TypeVar('T')
7
+ C = TypeVar('C', bound=BaseCodec)
8
+
9
+
10
+ class AbstractVectorCodec(BaseCodec[list[T]], Generic[T, C]):
11
+ codec: Type[C]
12
+
13
+ def decode(self) -> list[T]:
14
+ if self.boolshortern and BoolCodec(self._buffer).decode():
15
+ return []
16
+
17
+ list_len = IntCodec(self._buffer).decode()
18
+ return [self.codec(self._buffer).decode() for _ in range(list_len)]
19
+
20
+ def encode(self, value: list[T]) -> int:
21
+ bytes_written = 0
22
+ if self.boolshortern:
23
+ bytes_written += BoolCodec(self._buffer).encode(len(value) == 0)
24
+ if len(value) == 0:
25
+ return bytes_written
26
+
27
+ bytes_written += IntCodec(self._buffer).encode(len(value))
28
+ for item in value:
29
+ bytes_written += self.codec(self._buffer).encode(item)
30
+ return bytes_written
31
+
32
+
33
+ def VectorCodecFactory(element_type: Type[T], element_codec: Type[C], param_boolshortern=False) -> Type[
34
+ AbstractVectorCodec[T, C]]:
35
+ class VectorCodec(AbstractVectorCodec[T, C]):
36
+ codec = element_codec
37
+ boolshortern = param_boolshortern
38
+
39
+ VectorCodec.__name__ = f"VectorCodec[{element_type.__name__}, {element_codec.__name__}]"
40
+ return VectorCodec
@@ -0,0 +1,5 @@
1
+ from .boolcodec import BoolCodec
2
+ from .bytecodec import ByteCodec
3
+ from .floatcodec import FloatCodec
4
+ from .intcodec import IntCodec
5
+ from .shortcodec import ShortCodec
@@ -0,0 +1,10 @@
1
+ from ..basecodec import BaseCodec
2
+
3
+ class BoolCodec(BaseCodec[bool]):
4
+
5
+ def decode(self):
6
+ return self._buffer.read_boolean()
7
+
8
+ def encode(self, value):
9
+ self._buffer.write_boolean(value)
10
+ return 1
@@ -0,0 +1,11 @@
1
+ from ..basecodec import BaseCodec
2
+
3
+
4
+ class ByteCodec(BaseCodec[float]):
5
+
6
+ def decode(self):
7
+ return self._buffer.read_byte()
8
+
9
+ def encode(self, value):
10
+ self._buffer.write_byte(value)
11
+ return 1
@@ -0,0 +1,11 @@
1
+ from ..basecodec import BaseCodec
2
+
3
+
4
+ class FloatCodec(BaseCodec[float]):
5
+
6
+ def decode(self):
7
+ return self._buffer.read_float()
8
+
9
+ def encode(self, value):
10
+ self._buffer.write_float(value)
11
+ return 4
@@ -0,0 +1,11 @@
1
+ from ..basecodec import BaseCodec
2
+
3
+
4
+ class IntCodec(BaseCodec[int]):
5
+
6
+ def decode(self):
7
+ return self._buffer.read_int()
8
+
9
+ def encode(self, value):
10
+ self._buffer.write_int(value)
11
+ return 4