rustplus 6.0.10__tar.gz → 6.0.11__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 (118) hide show
  1. {rustplus-6.0.10/rustplus.egg-info → rustplus-6.0.11}/PKG-INFO +1 -1
  2. {rustplus-6.0.10 → rustplus-6.0.11}/rustplus/__init__.py +1 -1
  3. rustplus-6.0.11/rustplus/icons/jungle_ziggurat.png +0 -0
  4. rustplus-6.0.11/rustplus/icons/radtown.png +0 -0
  5. rustplus-6.0.11/rustplus/icons/underwater_lab.png +0 -0
  6. {rustplus-6.0.10 → rustplus-6.0.11}/rustplus/remote/ratelimiter/__init__.py +24 -13
  7. {rustplus-6.0.10 → rustplus-6.0.11}/rustplus/rust_api.py +3 -3
  8. {rustplus-6.0.10 → rustplus-6.0.11/rustplus.egg-info}/PKG-INFO +1 -1
  9. rustplus-6.0.10/rustplus/icons/jungle_ziggurat.png +0 -0
  10. rustplus-6.0.10/rustplus/icons/radtown.png +0 -0
  11. rustplus-6.0.10/rustplus/icons/underwater_lab.png +0 -0
  12. {rustplus-6.0.10 → rustplus-6.0.11}/LICENSE +0 -0
  13. {rustplus-6.0.10 → rustplus-6.0.11}/MANIFEST.in +0 -0
  14. {rustplus-6.0.10 → rustplus-6.0.11}/README.md +0 -0
  15. {rustplus-6.0.10 → rustplus-6.0.11}/requirements.txt +0 -0
  16. {rustplus-6.0.10 → rustplus-6.0.11}/rustplus/annotations/__init__.py +0 -0
  17. {rustplus-6.0.10 → rustplus-6.0.11}/rustplus/annotations/chat_event.py +0 -0
  18. {rustplus-6.0.10 → rustplus-6.0.11}/rustplus/annotations/command.py +0 -0
  19. {rustplus-6.0.10 → rustplus-6.0.11}/rustplus/annotations/entity_event.py +0 -0
  20. {rustplus-6.0.10 → rustplus-6.0.11}/rustplus/annotations/protobuf_event.py +0 -0
  21. {rustplus-6.0.10 → rustplus-6.0.11}/rustplus/annotations/team_event.py +0 -0
  22. {rustplus-6.0.10 → rustplus-6.0.11}/rustplus/commands/__init__.py +0 -0
  23. {rustplus-6.0.10 → rustplus-6.0.11}/rustplus/commands/chat_command.py +0 -0
  24. {rustplus-6.0.10 → rustplus-6.0.11}/rustplus/commands/chat_command_data.py +0 -0
  25. {rustplus-6.0.10 → rustplus-6.0.11}/rustplus/commands/command_options.py +0 -0
  26. {rustplus-6.0.10 → rustplus-6.0.11}/rustplus/events/__init__.py +0 -0
  27. {rustplus-6.0.10 → rustplus-6.0.11}/rustplus/events/chat_event.py +0 -0
  28. {rustplus-6.0.10 → rustplus-6.0.11}/rustplus/events/entity_event.py +0 -0
  29. {rustplus-6.0.10 → rustplus-6.0.11}/rustplus/events/protobuf_event.py +0 -0
  30. {rustplus-6.0.10 → rustplus-6.0.11}/rustplus/events/team_event.py +0 -0
  31. {rustplus-6.0.10 → rustplus-6.0.11}/rustplus/exceptions/__init__.py +0 -0
  32. {rustplus-6.0.10 → rustplus-6.0.11}/rustplus/exceptions/exceptions.py +0 -0
  33. {rustplus-6.0.10 → rustplus-6.0.11}/rustplus/icons/__init__.py +0 -0
  34. {rustplus-6.0.10 → rustplus-6.0.11}/rustplus/icons/airfield.png +0 -0
  35. {rustplus-6.0.10 → rustplus-6.0.11}/rustplus/icons/arctic_base.png +0 -0
  36. {rustplus-6.0.10 → rustplus-6.0.11}/rustplus/icons/bandit.png +0 -0
  37. {rustplus-6.0.10 → rustplus-6.0.11}/rustplus/icons/barn.png +0 -0
  38. {rustplus-6.0.10 → rustplus-6.0.11}/rustplus/icons/cargo.png +0 -0
  39. {rustplus-6.0.10 → rustplus-6.0.11}/rustplus/icons/chinook.png +0 -0
  40. {rustplus-6.0.10 → rustplus-6.0.11}/rustplus/icons/chinook_blades.png +0 -0
  41. {rustplus-6.0.10 → rustplus-6.0.11}/rustplus/icons/crate.png +0 -0
  42. {rustplus-6.0.10 → rustplus-6.0.11}/rustplus/icons/desert_base.png +0 -0
  43. {rustplus-6.0.10 → rustplus-6.0.11}/rustplus/icons/dome.png +0 -0
  44. {rustplus-6.0.10 → rustplus-6.0.11}/rustplus/icons/excavator.png +0 -0
  45. {rustplus-6.0.10 → rustplus-6.0.11}/rustplus/icons/explosion.png +0 -0
  46. {rustplus-6.0.10 → rustplus-6.0.11}/rustplus/icons/ferryterminal.png +0 -0
  47. {rustplus-6.0.10 → rustplus-6.0.11}/rustplus/icons/fishing.png +0 -0
  48. {rustplus-6.0.10 → rustplus-6.0.11}/rustplus/icons/harbour.png +0 -0
  49. {rustplus-6.0.10 → rustplus-6.0.11}/rustplus/icons/icon.png +0 -0
  50. {rustplus-6.0.10 → rustplus-6.0.11}/rustplus/icons/junkyard.png +0 -0
  51. {rustplus-6.0.10 → rustplus-6.0.11}/rustplus/icons/large_oil_rig.png +0 -0
  52. {rustplus-6.0.10 → rustplus-6.0.11}/rustplus/icons/launchsite.png +0 -0
  53. {rustplus-6.0.10 → rustplus-6.0.11}/rustplus/icons/lighthouse.png +0 -0
  54. {rustplus-6.0.10 → rustplus-6.0.11}/rustplus/icons/military_tunnels.png +0 -0
  55. {rustplus-6.0.10 → rustplus-6.0.11}/rustplus/icons/mining_outpost.png +0 -0
  56. {rustplus-6.0.10 → rustplus-6.0.11}/rustplus/icons/mining_quarry_hqm.png +0 -0
  57. {rustplus-6.0.10 → rustplus-6.0.11}/rustplus/icons/mining_quarry_stone.png +0 -0
  58. {rustplus-6.0.10 → rustplus-6.0.11}/rustplus/icons/mining_quarry_sulfur.png +0 -0
  59. {rustplus-6.0.10 → rustplus-6.0.11}/rustplus/icons/missile_silo.png +0 -0
  60. {rustplus-6.0.10 → rustplus-6.0.11}/rustplus/icons/outpost.png +0 -0
  61. {rustplus-6.0.10 → rustplus-6.0.11}/rustplus/icons/oxums.png +0 -0
  62. {rustplus-6.0.10 → rustplus-6.0.11}/rustplus/icons/patrol.png +0 -0
  63. {rustplus-6.0.10 → rustplus-6.0.11}/rustplus/icons/power_plant.png +0 -0
  64. {rustplus-6.0.10 → rustplus-6.0.11}/rustplus/icons/satellite.png +0 -0
  65. {rustplus-6.0.10 → rustplus-6.0.11}/rustplus/icons/sewer.png +0 -0
  66. {rustplus-6.0.10 → rustplus-6.0.11}/rustplus/icons/small_oil_rig.png +0 -0
  67. {rustplus-6.0.10 → rustplus-6.0.11}/rustplus/icons/stables.png +0 -0
  68. {rustplus-6.0.10 → rustplus-6.0.11}/rustplus/icons/supermarket.png +0 -0
  69. {rustplus-6.0.10 → rustplus-6.0.11}/rustplus/icons/swamp.png +0 -0
  70. {rustplus-6.0.10 → rustplus-6.0.11}/rustplus/icons/train.png +0 -0
  71. {rustplus-6.0.10 → rustplus-6.0.11}/rustplus/icons/train_yard.png +0 -0
  72. {rustplus-6.0.10 → rustplus-6.0.11}/rustplus/icons/vending_machine.png +0 -0
  73. {rustplus-6.0.10 → rustplus-6.0.11}/rustplus/icons/water_treatment.png +0 -0
  74. {rustplus-6.0.10 → rustplus-6.0.11}/rustplus/identification/__init__.py +0 -0
  75. {rustplus-6.0.10 → rustplus-6.0.11}/rustplus/identification/handler_list.py +0 -0
  76. {rustplus-6.0.10 → rustplus-6.0.11}/rustplus/identification/registered_listener.py +0 -0
  77. {rustplus-6.0.10 → rustplus-6.0.11}/rustplus/identification/server_details.py +0 -0
  78. {rustplus-6.0.10 → rustplus-6.0.11}/rustplus/remote/__init__.py +0 -0
  79. {rustplus-6.0.10 → rustplus-6.0.11}/rustplus/remote/camera/__init__.py +0 -0
  80. {rustplus-6.0.10 → rustplus-6.0.11}/rustplus/remote/camera/camera_constants.py +0 -0
  81. {rustplus-6.0.10 → rustplus-6.0.11}/rustplus/remote/camera/camera_manager.py +0 -0
  82. {rustplus-6.0.10 → rustplus-6.0.11}/rustplus/remote/camera/camera_parser.py +0 -0
  83. {rustplus-6.0.10 → rustplus-6.0.11}/rustplus/remote/camera/structures.py +0 -0
  84. {rustplus-6.0.10 → rustplus-6.0.11}/rustplus/remote/fcm/__init__.py +0 -0
  85. {rustplus-6.0.10 → rustplus-6.0.11}/rustplus/remote/fcm/fcm_listener.py +0 -0
  86. {rustplus-6.0.10 → rustplus-6.0.11}/rustplus/remote/proxy/__init__.py +0 -0
  87. {rustplus-6.0.10 → rustplus-6.0.11}/rustplus/remote/proxy/proxy_value_grabber.py +0 -0
  88. {rustplus-6.0.10 → rustplus-6.0.11}/rustplus/remote/rustplus_proto/__init__.py +0 -0
  89. {rustplus-6.0.10 → rustplus-6.0.11}/rustplus/remote/rustplus_proto/rustplus.py +0 -0
  90. {rustplus-6.0.10 → rustplus-6.0.11}/rustplus/remote/websocket/__init__.py +0 -0
  91. {rustplus-6.0.10 → rustplus-6.0.11}/rustplus/remote/websocket/ws.py +0 -0
  92. {rustplus-6.0.10 → rustplus-6.0.11}/rustplus/structs/__init__.py +0 -0
  93. {rustplus-6.0.10 → rustplus-6.0.11}/rustplus/structs/rust_chat_message.py +0 -0
  94. {rustplus-6.0.10 → rustplus-6.0.11}/rustplus/structs/rust_contents.py +0 -0
  95. {rustplus-6.0.10 → rustplus-6.0.11}/rustplus/structs/rust_entity_info.py +0 -0
  96. {rustplus-6.0.10 → rustplus-6.0.11}/rustplus/structs/rust_error.py +0 -0
  97. {rustplus-6.0.10 → rustplus-6.0.11}/rustplus/structs/rust_info.py +0 -0
  98. {rustplus-6.0.10 → rustplus-6.0.11}/rustplus/structs/rust_item.py +0 -0
  99. {rustplus-6.0.10 → rustplus-6.0.11}/rustplus/structs/rust_map.py +0 -0
  100. {rustplus-6.0.10 → rustplus-6.0.11}/rustplus/structs/rust_marker.py +0 -0
  101. {rustplus-6.0.10 → rustplus-6.0.11}/rustplus/structs/rust_team_info.py +0 -0
  102. {rustplus-6.0.10 → rustplus-6.0.11}/rustplus/structs/rust_time.py +0 -0
  103. {rustplus-6.0.10 → rustplus-6.0.11}/rustplus/structs/serialization.py +0 -0
  104. {rustplus-6.0.10 → rustplus-6.0.11}/rustplus/structs/util.py +0 -0
  105. {rustplus-6.0.10 → rustplus-6.0.11}/rustplus/utils/__init__.py +0 -0
  106. {rustplus-6.0.10 → rustplus-6.0.11}/rustplus/utils/deprecated.py +0 -0
  107. {rustplus-6.0.10 → rustplus-6.0.11}/rustplus/utils/emojis.py +0 -0
  108. {rustplus-6.0.10 → rustplus-6.0.11}/rustplus/utils/fonts/PermanentMarker.ttf +0 -0
  109. {rustplus-6.0.10 → rustplus-6.0.11}/rustplus/utils/fonts/__init__.py +0 -0
  110. {rustplus-6.0.10 → rustplus-6.0.11}/rustplus/utils/grab_items.py +0 -0
  111. {rustplus-6.0.10 → rustplus-6.0.11}/rustplus/utils/utils.py +0 -0
  112. {rustplus-6.0.10 → rustplus-6.0.11}/rustplus/utils/yielding_event.py +0 -0
  113. {rustplus-6.0.10 → rustplus-6.0.11}/rustplus.egg-info/SOURCES.txt +0 -0
  114. {rustplus-6.0.10 → rustplus-6.0.11}/rustplus.egg-info/dependency_links.txt +0 -0
  115. {rustplus-6.0.10 → rustplus-6.0.11}/rustplus.egg-info/requires.txt +0 -0
  116. {rustplus-6.0.10 → rustplus-6.0.11}/rustplus.egg-info/top_level.txt +0 -0
  117. {rustplus-6.0.10 → rustplus-6.0.11}/setup.cfg +0 -0
  118. {rustplus-6.0.10 → rustplus-6.0.11}/setup.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: rustplus
3
- Version: 6.0.10
3
+ Version: 6.0.11
4
4
  Summary: A python wrapper for the Rust Plus API
5
5
  Home-page: https://github.com/olijeffers0n/rustplus
6
6
  Author: olijeffers0n
@@ -14,5 +14,5 @@ from .structs import RustError, RustMarker, Vector
14
14
 
15
15
  __name__ = "rustplus"
16
16
  __author__ = "olijeffers0n"
17
- __version__ = "6.0.10"
17
+ __version__ = "6.0.11"
18
18
  __support__ = "Discord: https://discord.gg/nQqJe8qvP8"
@@ -1,6 +1,6 @@
1
1
  import math
2
2
  import time
3
- import asyncio
3
+ import threading
4
4
  from typing import Dict
5
5
 
6
6
  from ...exceptions.exceptions import RateLimitError
@@ -34,6 +34,8 @@ class TokenBucket:
34
34
 
35
35
 
36
36
  class RateLimiter:
37
+ SOCKET_LIMIT = 25
38
+ SOCKET_REFRESH_AMOUNT = 3
37
39
  SERVER_LIMIT = 50
38
40
  SERVER_REFRESH_AMOUNT = 15
39
41
 
@@ -47,7 +49,7 @@ class RateLimiter:
47
49
  def __init__(self) -> None:
48
50
  self.socket_buckets: Dict[ServerDetails, TokenBucket] = {}
49
51
  self.server_buckets: Dict[str, TokenBucket] = {}
50
- self.lock = asyncio.Lock()
52
+ self.lock = threading.Lock()
51
53
 
52
54
  def add_socket(
53
55
  self,
@@ -57,19 +59,21 @@ class RateLimiter:
57
59
  refresh_rate: float,
58
60
  refresh_amount: float,
59
61
  ) -> None:
60
- self.socket_buckets[server_details] = TokenBucket(
61
- current, maximum, refresh_rate, refresh_amount
62
- )
63
- if server_details.get_server_string() not in self.server_buckets:
64
- self.server_buckets[server_details.get_server_string()] = TokenBucket(
65
- self.SERVER_LIMIT, self.SERVER_LIMIT, 1, self.SERVER_REFRESH_AMOUNT
66
- )
62
+ with self.lock:
63
+ if server_details not in self.socket_buckets:
64
+ self.socket_buckets[server_details] = TokenBucket(
65
+ current, maximum, refresh_rate, refresh_amount
66
+ )
67
+ if server_details.get_server_string() not in self.server_buckets:
68
+ self.server_buckets[server_details.get_server_string()] = TokenBucket(
69
+ self.SERVER_LIMIT, self.SERVER_LIMIT, 1, self.SERVER_REFRESH_AMOUNT
70
+ )
67
71
 
68
72
  async def can_consume(self, server_details: ServerDetails, amount: int = 1) -> bool:
69
73
  """
70
74
  Returns whether the user can consume the amount of tokens provided
71
75
  """
72
- async with self.lock:
76
+ with self.lock:
73
77
  for bucket in [
74
78
  self.socket_buckets.get(server_details),
75
79
  self.server_buckets.get(server_details.get_server_string()),
@@ -83,7 +87,7 @@ class RateLimiter:
83
87
  """
84
88
  Consumes an amount of tokens from the bucket. You should first check to see whether it is possible with can_consume
85
89
  """
86
- async with self.lock:
90
+ with self.lock:
87
91
  for bucket in [
88
92
  self.socket_buckets.get(server_details),
89
93
  self.server_buckets.get(server_details.get_server_string()),
@@ -103,12 +107,14 @@ class RateLimiter:
103
107
  """
104
108
  Returns how long until the amount of tokens needed will be available
105
109
  """
106
- async with self.lock:
110
+
111
+ with self.lock:
107
112
  delay = 0
108
113
  for bucket in [
109
114
  self.socket_buckets.get(server_details),
110
115
  self.server_buckets.get(server_details.get_server_string()),
111
116
  ]:
117
+ bucket.refresh()
112
118
  val = (
113
119
  math.ceil(
114
120
  (
@@ -127,5 +133,10 @@ class RateLimiter:
127
133
  """
128
134
  Removes the limiter
129
135
  """
130
- async with self.lock:
136
+ with self.lock:
131
137
  del self.socket_buckets[server_details]
138
+ server_str = server_details.get_server_string()
139
+ if not any(
140
+ d.get_server_string() == server_str for d in self.socket_buckets
141
+ ):
142
+ del self.server_buckets[server_str]
@@ -85,10 +85,10 @@ class RustSocket:
85
85
 
86
86
  self.ratelimiter.add_socket(
87
87
  self.server_details,
88
- RateLimiter.SERVER_LIMIT,
89
- RateLimiter.SERVER_LIMIT,
88
+ RateLimiter.SOCKET_LIMIT,
89
+ RateLimiter.SOCKET_LIMIT,
90
90
  1,
91
- RateLimiter.SERVER_REFRESH_AMOUNT,
91
+ RateLimiter.SOCKET_REFRESH_AMOUNT,
92
92
  )
93
93
 
94
94
  async def _handle_ratelimit(self, tokens) -> None:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: rustplus
3
- Version: 6.0.10
3
+ Version: 6.0.11
4
4
  Summary: A python wrapper for the Rust Plus API
5
5
  Home-page: https://github.com/olijeffers0n/rustplus
6
6
  Author: olijeffers0n
Binary file
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes