Coverage for functions \ flipdare \ generated \ shared \ app_http_code.py: 100%

0 statements  

« prev     ^ index     » next       coverage.py v7.13.0, created at 2026-05-08 12:22 +1000

1#!/usr/bin/env python 

2# 

3# Copyright (c) 2026 Flipdare Pty Ltd. All rights reserved. 

4# 

5# This file is part of Flipdare's proprietary software and contains 

6# confidential and copyrighted material. Unauthorised copying, 

7# modification, distribution, or use of this file is strictly 

8# prohibited without prior written permission from Flipdare Pty Ltd. 

9# 

10# This software includes third-party components licensed under MIT, 

11# BSD, and Apache 2.0 licences. See THIRD_PARTY_NOTICES for details. 

12# 

13# NOTE: THIS FILE IS AUTO GENERATED. DO NOT EDIT. 

14# 

15# Generated by codegen_models.py 

16# 

17# Modify 'codegen_models.py' 

18# and re-run the script above to update. 

19# 

20 

21# pragma: no cover 

22 

23from enum import StrEnum 

24 

25 

26class AppHttpCode(StrEnum): 

27 """Standard HTTP status codes used in error responses.""" 

28 

29 # Declared here so type-checkers know these attributes exist. 

30 # They are populated per-member inside __new__. 

31 _status: int 

32 _label: str 

33 

34 def __new__( 

35 cls, 

36 code: str, 

37 status: int | None = None, 

38 label: str | None = None, 

39 ) -> "AppHttpCode": 

40 obj = str.__new__(cls, code) 

41 obj._value_ = code 

42 # Only set attributes if they are provided (during member definition) 

43 if status is not None: 

44 obj._status = status 

45 if label is not None: 

46 obj._label = label 

47 return obj 

48 

49 # ---- Members -------------------------------------------------------- 

50 # fmt: off 

51 OK = ("OK", 200, "Ok") 

52 UNAUTHORIZED = ("unauthorized", 401, "Unauthorized") 

53 FORBIDDEN = ("forbidden", 403, "Forbidden") 

54 NOT_FOUND = ("not_found", 404, "Not Found") 

55 INTERNAL_SERVER_ERROR = ("internal_server_error", 500, "Internal Server Error") 

56 BAD_REQUEST = ("bad_request", 400, "Bad Request") 

57 BAD_REQUEST_EMAIL = ("bad_request_email", 422, "Invalid Email") 

58 METHOD_NOT_ALLOWED = ("method_not_allowed", 405, "Method Not Allowed") 

59 SERVICE_UNAVAILABLE = ("service_unavailable", 503, "Service Unavailable") 

60 ALREADY_EXISTS = ("already_exists", 409, "Already Exists") 

61 DEADLINE_EXCEEDED = ("deadline_exceeded", 504, "Timed Out") 

62 RESOURCE_EXHAUSTED = ("resource_exhausted", 429, "Too Many Requests") 

63 NOT_IMPLEMENTED = ("not_implemented", 501, "Not Implemented") 

64 # fmt: on 

65 # ---- Properties ----------------------------------------------------- 

66 @property 

67 def status(self) -> int: 

68 return self._status 

69 

70 @property 

71 def label(self) -> str: 

72 return self._label