docs: strip non-essential comments, fold key facts into docstrings

This commit is contained in:
imSp4rky
2026-08-16 23:32:02 -06:00
parent 66bcbe9377
commit 511f96d8db
81 changed files with 204 additions and 1017 deletions
+3 -8
View File
@@ -50,6 +50,9 @@ class SurfsharkVPN(Proxy):
- Country ID: "228"
- Specific server: "us-bos" (Boston)
- City selection: "us:seattle", "ca:toronto"
Returns None if SurfsharkVPN has no servers in the queried country. A city with no matching
server raises ValueError.
"""
query = query.lower()
city = None
@@ -64,28 +67,22 @@ class SurfsharkVPN(Proxy):
hostname = f"{query}.prod.surfshark.com"
else:
if query.isdigit():
# country id
country = self.get_country(by_id=int(query))
elif re.match(r"^[a-z]+$", query):
# country code
country = self.get_country(by_code=query)
else:
raise ValueError(f"The query provided is unsupported and unrecognized: {query}")
if not country:
# SurfsharkVPN doesnt have servers in this region
return
# Check server_map for pinned servers (can include city)
server_map_key = f"{country['countryCode'].lower()}:{city}" if city else country["countryCode"].lower()
server_mapping = self.server_map.get(server_map_key) or (
self.server_map.get(country["countryCode"].lower()) if not city else None
)
if server_mapping:
# country was set to a specific server ID in config
hostname = f"{country['code'].lower()}{server_mapping}.prod.surfshark.com"
else:
# get the random server ID
random_server = self.get_random_server(country["countryCode"], city)
if not random_server:
raise ValueError(
@@ -123,7 +120,6 @@ class SurfsharkVPN(Proxy):
"""
servers = [x for x in self.countries if x["countryCode"].lower() == country_id.lower()]
# Filter by city if specified
if city:
city_lower = city.lower()
# Check if servers have a 'location' field for city filtering
@@ -145,7 +141,6 @@ class SurfsharkVPN(Proxy):
if not servers:
raise ValueError(f"Could not get random server for country '{country_id}': no servers found.")
# Only include servers that actually have a connection name to avoid KeyError.
connection_names = [x["connectionName"] for x in servers if "connectionName" in x]
if not connection_names:
raise ValueError(