
_A	  =					(1, 153, 370, 371, 1_634, 24_678_051, 115_132_219_018_763_992_565_095_597_973_971_522_401)
_A	  =					(-153, -1, 0, 1.2, 200, "A", [], {}, None)




def 				lowerCamelCase__				(						a__  :  List[str]     )		->	Dict:







       if not isinstance(lowercase_	,				lowercase_     ) or n < 1:
              return False

       # Initialization of sum and number of digits.
       UpperCamelCase_							       =       0
       UpperCamelCase_							       =       0
       UpperCamelCase_							       =       n
       # Calculation of digits of the number
       while temp > 0:
              number_of_digits += 1
              temp //= 10
       # Dividing number into separate digits and find Armstrong number
       UpperCamelCase_							       =       n
       while temp > 0:
              UpperCamelCase_							       =       temp % 10
              total += rem**number_of_digits
              temp //= 10
       return n == total




def 				lowerCamelCase__				(						a__  :  List[Any]     )		->	Union[str, Any]:







       if not isinstance(lowercase_	,				lowercase_     ) or n < 1:
              return False

       # Init a "histogram" of the digits
       UpperCamelCase_							       =       [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
       UpperCamelCase_							       =       0
       UpperCamelCase_							       =       0
       UpperCamelCase_							       =       n
       while temp > 0:
              UpperCamelCase_       ,				UpperCamelCase_							       =       divmod(lowercase_	,				10     )
              digit_histogram[rem] += 1
              digit_total += 1

       for cnt, i in zip(lowercase_	,				range(len(lowercase_     )     )     ):
              total += cnt * i**digit_total

       return n == total




def 				lowerCamelCase__				(						a__  :  List[str]     )		->	Optional[int]:







       if not isinstance(lowercase_	,				lowercase_     ) or n < 1:
              return False
       UpperCamelCase_							       =       len(str(lowercase_     )     )  # the power that all digits will be raised to
       # check if sum of each digit multiplied expo times is equal to number
       return n == sum(int(lowercase_     ) ** expo for i in str(lowercase_     )     )




def 				lowerCamelCase__				(						)		->	List[Any]:
       UpperCamelCase_							       =       int(input("""Enter an integer to see if it is an Armstrong number: """     ).strip()     )
       print(f'''{num} is {"" if armstrong_number(lowercase_     ) else "not "}an Armstrong number.'''     )
       print(f'''{num} is {"" if narcissistic_number(lowercase_     ) else "not "}an Armstrong number.'''     )
       print(f'''{num} is {"" if pluperfect_number(lowercase_     ) else "not "}an Armstrong number.'''     )


if __name__ == "__main__":
      import doctest

      doctest.testmod()
      main()





import hashlib
import importlib.util
import json
import os
import pathlib
from types import ModuleType

import pytest
import requests

_A	  =					pathlib.Path.cwd().joinpath('''project_euler''')
_A	  =					pathlib.Path.cwd().joinpath(
    '''scripts''', '''project_euler_answers.json'''
)

with open(PROJECT_EULER_ANSWERS_PATH) as file_handle:
      _A	  =					json.load(file_handle)




def 				lowerCamelCase__				(						a__  :  pathlib.Path     )		->	ModuleType:
       UpperCamelCase_							       =       importlib.util.spec_from_file_location(file_path.name	,      str(a__     )     )
       UpperCamelCase_							       =       importlib.util.module_from_spec(a__     )  # type: ignore
       spec.loader.exec_module(a__     )  # type: ignore
       return module




def 				lowerCamelCase__				(						)		->	list[pathlib.Path]:
       UpperCamelCase_							       =       []
       for problem_dir_path in PROJECT_EULER_DIR_PATH.iterdir():
              if problem_dir_path.is_file() or problem_dir_path.name.startswith("""_"""     ):
                     continue
              for file_path in problem_dir_path.iterdir():
                     if file_path.suffix != ".py" or file_path.name.startswith(("""_""", """test""")     ):
                            continue
                     solution_file_paths.append(a__     )
       return solution_file_paths




def 				lowerCamelCase__				(						)		->	str:
       with open(os.environ["""GITHUB_EVENT_PATH"""]     ) as file:
              UpperCamelCase_							       =       json.load(a__     )
       return event["pull_request"]["url"] + "/files"




def 				lowerCamelCase__				(						)		->	list[pathlib.Path]:
       UpperCamelCase_							       =       []
       UpperCamelCase_							       =       {
           """Accept""": """application/vnd.github.v3+json""",
           """Authorization""": """token """ + os.environ["""GITHUB_TOKEN"""],
       }
       UpperCamelCase_							       =       requests.get(get_files_url()	,      headers=a__     ).json()
       for file in files:
              UpperCamelCase_							       =       pathlib.Path.cwd().joinpath(file["""filename"""]     )
              if (
                  filepath.suffix != ".py"
                  or filepath.name.startswith(("""_""", """test""")     )
                  or not filepath.name.startswith("""sol"""     )
              ):
                     continue
              solution_file_paths.append(a__     )
       return solution_file_paths




def 				lowerCamelCase__				(						)		->	list[pathlib.Path]:
       if os.environ.get("""CI"""     ) and os.environ.get("""GITHUB_EVENT_NAME"""     ) == "pull_request":
              # Return only if there are any, otherwise default to all solutions
              if filepaths := added_solution_file_path():
                     return filepaths
       return all_solution_file_paths()







@pytest.mark.parametrize(
    """solution_path"""	,      collect_solution_file_paths()	,      ids=lambda a__     : f'''{path.parent.name}/{path.name}'''	,      )
def 				lowerCamelCase__				(						a__  :  pathlib.Path     )		->	None:
       UpperCamelCase_							       =       solution_path.parent.name[8:].zfill(3     )
       UpperCamelCase_							       =       PROBLEM_ANSWERS[problem_number]
       UpperCamelCase_							       =       convert_path_to_module(a__     )
       UpperCamelCase_							       =       str(solution_module.solution()     )  # type: ignore
       UpperCamelCase_							       =       hashlib.shaaaa(answer.encode()     ).hexdigest()
       assert (
           answer == expected
       ), f'''Expected solution to {problem_number} to have hash {expected}, got {answer}'''



