diff --git a/faker/providers/address/en_IN/__init__.py b/faker/providers/address/en_IN/__init__.py index 4355239994..bf534d8c0d 100644 --- a/faker/providers/address/en_IN/__init__.py +++ b/faker/providers/address/en_IN/__init__.py @@ -1,5 +1,5 @@ -import random -from typing import Optional +from typing import Dict, Optional, Tuple + from faker.providers.address import Provider as AddressProvider @@ -393,7 +393,7 @@ class Provider(AddressProvider): "West Bengal", ) - states_abbr = ( + states_abbr: Tuple[str, ...] = ( "AP", "AR", "AS", @@ -497,7 +497,7 @@ class Provider(AddressProvider): "PY": [(605_000, 605_999)], } - army_pincode = {"APS": (900_000, 999_999)} + army_pincode: Dict[str, Tuple[int, int]] = {"APS": (900_000, 999_999)} def city_name(self) -> str: return self.random_element(self.cities) @@ -512,9 +512,7 @@ def union_territory(self) -> str: return self.random_element(self.union_territories)[0] - def pincode_in_state( - self, state_abbr: Optional[str] = None, include_union_territories=False - ) -> int: + def pincode_in_state(self, state_abbr: Optional[str] = None, include_union_territories: bool = False) -> int: """Random PIN Code within provided state abbreviation :param state_abbr: State Abbr, defaults to None @@ -544,20 +542,16 @@ def pincode_in_state( def pincode_in_military(self) -> int: """Random PIN Code within Army Postal Service range""" - key = self.random_element(self.army_pincode.keys()) + key: str = self.random_element(self.army_pincode.keys()) return self.generator.random.randint(*self.army_pincode[key]) # Aliases - def zipcode_in_state( - self, state_abbr: Optional[str] = None, include_union_territories=False - ) -> int: + def zipcode_in_state(self, state_abbr: Optional[str] = None, include_union_territories: bool = False) -> int: return self.pincode_in_state(state_abbr, include_union_territories) - def postcode_in_state( - self, state_abbr: Optional[str] = None, include_union_territories=False - ) -> int: + def postcode_in_state(self, state_abbr: Optional[str] = None, include_union_territories: bool = False) -> int: return self.pincode_in_state(state_abbr, include_union_territories) def pincode_in_army(self) -> int: diff --git a/faker/proxy.pyi b/faker/proxy.pyi index 792ad536e4..377c3ad29a 100644 --- a/faker/proxy.pyi +++ b/faker/proxy.pyi @@ -2955,6 +2955,34 @@ class Faker: def province(self) -> str: ... def province_abbr(self) -> str: ... def county(self) -> str: ... + def pincode_in_army(self) -> int: ... + def pincode_in_military(self) -> int: + """ + Random PIN Code within Army Postal Service range + """ + ... + + def pincode_in_state(self, state_abbr: Optional[str] = ..., include_union_territories: bool = ...) -> int: + """ + Random PIN Code within provided state abbreviation + + :param state_abbr: State Abbr, defaults to None + :param include_union_territories: Include Union Territories ?, defaults to False + :raises ValueError: If incorrect state abbr + :return: PIN Code + """ + ... + + def postcode_in_army(self) -> int: ... + def postcode_in_military(self) -> int: ... + def union_territory(self) -> str: + """ + Returns random union territory name + """ + ... + + def zipcode_in_army(self) -> int: ... + def zipcode_in_military(self) -> int: ... def aadhaar_id(self) -> str: """ Aadhaar is a 12 digit person identifier generated for residents of