From ff7c380f33ecc74e271e13c70bc8ee00625a0ebe Mon Sep 17 00:00:00 2001 From: Abdel792 Date: Sat, 4 Jul 2026 18:21:49 +0200 Subject: [PATCH] update Clock add-on Template --- .github/scripts/languageMappings.json | 1 + .github/scripts/markdownTranslate.py | 881 ------- .github/workflows/build_addon.yml | 2 +- .github/workflows/manual-release.yaml | 4 +- addon/globalPlugins/clock/__init__.py | 174 +- addon/globalPlugins/clock/alarmHandler.py | 21 +- addon/globalPlugins/clock/clockHandler.py | 47 +- addon/globalPlugins/clock/clockSettingsGUI.py | 202 +- .../globalPlugins/clock/convertdate/hebrew.py | 2 +- addon/globalPlugins/clock/dtfunctions.py | 8 +- addon/globalPlugins/clock/formats.py | 99 +- addon/globalPlugins/clock/paths.py | 11 +- .../clock/pymeeus/Coordinates.py | 266 ++- .../clock/pymeeus/CurveFitting.py | 76 +- addon/globalPlugins/clock/pymeeus/Earth.py | 150 +- addon/globalPlugins/clock/pymeeus/Epoch.py | 130 +- .../clock/pymeeus/Interpolation.py | 26 +- addon/globalPlugins/clock/pymeeus/Jupiter.py | 86 +- .../clock/pymeeus/JupiterMoons.py | 239 +- addon/globalPlugins/clock/pymeeus/Mars.py | 108 +- addon/globalPlugins/clock/pymeeus/Mercury.py | 210 +- addon/globalPlugins/clock/pymeeus/Minor.py | 8 +- addon/globalPlugins/clock/pymeeus/Moon.py | 1102 +++++---- addon/globalPlugins/clock/pymeeus/Neptune.py | 42 +- addon/globalPlugins/clock/pymeeus/Pluto.py | 8 +- addon/globalPlugins/clock/pymeeus/Saturn.py | 200 +- addon/globalPlugins/clock/pymeeus/Sun.py | 82 +- addon/globalPlugins/clock/pymeeus/Uranus.py | 46 +- addon/globalPlugins/clock/pymeeus/Venus.py | 138 +- addon/globalPlugins/clock/pytz/__init__.py | 2086 +++++++++-------- addon/globalPlugins/clock/pytz/lazy.py | 6 +- addon/globalPlugins/clock/pytz/reference.py | 10 +- addon/globalPlugins/clock/pytz/tzfile.py | 52 +- addon/globalPlugins/clock/pytz/tzinfo.py | 39 +- addon/globalPlugins/clock/skipTranslation.py | 1 + addon/installTasks.py | 41 +- pyproject.toml | 131 +- uv.lock | 100 +- 38 files changed, 3378 insertions(+), 3457 deletions(-) delete mode 100644 .github/scripts/markdownTranslate.py diff --git a/.github/scripts/languageMappings.json b/.github/scripts/languageMappings.json index cae6e13..42b51d7 100644 --- a/.github/scripts/languageMappings.json +++ b/.github/scripts/languageMappings.json @@ -4,6 +4,7 @@ "es": "es-ES", "es_CO": "es-CO", "nb_NO": "nb", + "ne": "ne-NP", "nn_NO": "nn-NO", "pt_PT": "pt-PT", "pt_BR": "pt-BR", diff --git a/.github/scripts/markdownTranslate.py b/.github/scripts/markdownTranslate.py deleted file mode 100644 index 165e940..0000000 --- a/.github/scripts/markdownTranslate.py +++ /dev/null @@ -1,881 +0,0 @@ -# A part of NonVisual Desktop Access (NVDA) -# Copyright (C) 2024-2026 NV Access Limited. -# This file is covered by the GNU General Public License. -# See the file COPYING for more details. - -from collections.abc import Generator -from collections.abc import Iterable -import tempfile -import os -import contextlib -import lxml.etree -import argparse -import uuid -import re -from itertools import zip_longest -from xml.sax.saxutils import escape as xmlEscape -import difflib -from dataclasses import dataclass -import subprocess - - -def getGithubRepoURL() -> str | None: - """ - Get the GitHub repository URL from git remote origin. - return: The raw GitHub URL for the repository, or None if it cannot be determined. - """ - result = subprocess.run( - ["git", "remote", "get-url", "origin"], - capture_output=True, - text=True, - check=True, - ) - remote_url = result.stdout.strip() - # Convert SSH or HTTPS URL to raw GitHub URL format - if match := re.match(r"git@github\.com:(.+?)(?:\.git)?$", remote_url): - repo_path = match.group(1) - elif match := re.match(r"https://github\.com/(.+?)(?:\.git)?$", remote_url): - repo_path = match.group(1) - else: - raise ValueError(f"Cannot parse GitHub URL from git remote: {remote_url}") - return f"https://raw.githubusercontent.com/{repo_path}" - - -re_kcTitle = re.compile(r"^()$") -re_kcSettingsSection = re.compile(r"^()$") -# Comments that span a single line in their entirety -re_comment = re.compile(r"^$") -re_heading = re.compile(r"^(#+\s+)(.+?)((?:\s+\{#.+\})?)$") -re_bullet = re.compile(r"^(\s*\*\s+)(.+)$") -re_number = re.compile(r"^(\s*[0-9]+\.\s+)(.+)$") -re_hiddenHeaderRow = re.compile(r"^\|\s*\.\s*\{\.hideHeaderRow\}\s*(\|\s*\.\s*)*\|$") -re_postTableHeaderLine = re.compile(r"^(\|\s*-+\s*)+\|$") -re_tableRow = re.compile(r"^(\|)(.+)(\|)$") -re_translationID = re.compile(r"^(.*)\$\(ID:([0-9a-f-]+)\)(.*)$") -re_inlineMarkdownLintComment = re.compile(r"^(.*?)(?:\s*)(\s*)$") - - -def prettyPathString(path: str) -> str: - cwd = os.getcwd() - if os.path.normcase(os.path.splitdrive(path)[0]) != os.path.normcase( - os.path.splitdrive(cwd)[0], - ): - return path - return os.path.relpath(path, cwd) - - -@contextlib.contextmanager -def createAndDeleteTempFilePath_contextManager( - dir: str | None = None, - prefix: str | None = None, - suffix: str | None = None, -) -> Generator[str, None, None]: - """A context manager that creates a temporary file and deletes it when the context is exited""" - with tempfile.NamedTemporaryFile( - dir=dir, - prefix=prefix, - suffix=suffix, - delete=False, - ) as tempFile: - tempFilePath = tempFile.name - tempFile.close() - yield tempFilePath - os.remove(tempFilePath) - - -def getLastCommitID(filePath: str) -> str: - # Run the git log command to get the last commit ID for the given file - result = subprocess.run( - ["git", "log", "-n", "1", "--pretty=format:%H", "--", filePath], - capture_output=True, - text=True, - check=True, - ) - commitID = result.stdout.strip() - if not re.match(r"[0-9a-f]{40}", commitID): - raise ValueError(f"Invalid commit ID: '{commitID}' for file '{filePath}'") - return commitID - - -def getGitDir() -> str: - # Run the git rev-parse command to get the root of the git directory - result = subprocess.run( - ["git", "rev-parse", "--show-toplevel"], - capture_output=True, - text=True, - check=True, - ) - gitDir = result.stdout.strip() - if not os.path.isdir(gitDir): - raise ValueError(f"Invalid git directory: '{gitDir}'") - return gitDir - - -def getRawGithubURLForPath(filePath: str) -> str: - gitDirPath = getGitDir() - commitID = getLastCommitID(filePath) - relativePath = os.path.relpath(os.path.abspath(filePath), gitDirPath) - relativePath = relativePath.replace("\\", "/") - rawGithubRepoUrl = getGithubRepoURL() - return f"{rawGithubRepoUrl}/{commitID}/{relativePath}" - - -def preprocessMarkdownLines(mdLines: Iterable[str]) -> Iterable[str]: - """ - Preprocess markdown lines such as removing inline markdown lint comments.\ - :param mdLines: The markdown lines to preprocess - :returns: The preprocessed markdown lines - """ - for mdLine in mdLines: - # #18982: Remove markdown lint comments completely - not needed for intermediate markdown or final html. - mdLine = re_inlineMarkdownLintComment.sub(r"\1\2", mdLine) - yield mdLine - - -def skeletonizeLine(mdLine: str) -> str | None: - prefix = "" - suffix = "" - if ( - mdLine.isspace() - or mdLine.strip() == "[TOC]" - or re_hiddenHeaderRow.match(mdLine) - or re_postTableHeaderLine.match(mdLine) - ): - return None - elif m := re_heading.match(mdLine): - prefix, content, suffix = m.groups() - elif m := re_bullet.match(mdLine): - prefix, content = m.groups() - elif m := re_number.match(mdLine): - prefix, content = m.groups() - elif m := re_tableRow.match(mdLine): - prefix, content, suffix = m.groups() - elif m := re_kcTitle.match(mdLine): - prefix, content, suffix = m.groups() - elif m := re_kcSettingsSection.match(mdLine): - prefix, content, suffix = m.groups() - elif re_comment.match(mdLine): - return None - ID = str(uuid.uuid4()) - return f"{prefix}$(ID:{ID}){suffix}\n" - - -@dataclass -class Result_generateSkeleton: - numTotalLines: int = 0 - numTranslationPlaceholders: int = 0 - - -def generateSkeleton(mdPath: str, outputPath: str) -> Result_generateSkeleton: - print( - f"Generating skeleton file {prettyPathString(outputPath)} from {prettyPathString(mdPath)}...", - ) - res = Result_generateSkeleton() - with ( - open(mdPath, "r", encoding="utf8") as mdFile, - open(outputPath, "w", encoding="utf8", newline="") as outputFile, - ): - for mdLine in preprocessMarkdownLines(mdFile.readlines()): - res.numTotalLines += 1 - skelLine = skeletonizeLine(mdLine) - if skelLine: - res.numTranslationPlaceholders += 1 - else: - skelLine = mdLine - outputFile.write(skelLine) - print( - f"Generated skeleton file with {res.numTotalLines} total lines and {res.numTranslationPlaceholders} translation placeholders", - ) - return res - - -@dataclass -class Result_updateSkeleton: - numAddedLines: int = 0 - numAddedTranslationPlaceholders: int = 0 - numRemovedLines: int = 0 - numRemovedTranslationPlaceholders: int = 0 - numUnchangedLines: int = 0 - numUnchangedTranslationPlaceholders: int = 0 - - -def extractSkeleton(xliffPath: str, outputPath: str): - print( - f"Extracting skeleton from {prettyPathString(xliffPath)} to {prettyPathString(outputPath)}...", - ) - with contextlib.ExitStack() as stack: - outputFile = stack.enter_context( - open(outputPath, "w", encoding="utf8", newline=""), - ) - xliff = lxml.etree.parse(xliffPath) - xliffRoot = xliff.getroot() - namespace = {"xliff": "urn:oasis:names:tc:xliff:document:2.0"} - if xliffRoot.tag != "{urn:oasis:names:tc:xliff:document:2.0}xliff": - raise ValueError("Not an xliff file") - skeletonNode = xliffRoot.find( - "./xliff:file/xliff:skeleton", - namespaces=namespace, - ) - if skeletonNode is None: - raise ValueError("No skeleton found in xliff file") - skeletonContent = skeletonNode.text.strip() - outputFile.write(skeletonContent) - print(f"Extracted skeleton to {prettyPathString(outputPath)}") - - -def updateSkeleton( - origMdPath: str, - newMdPath: str, - origSkelPath: str, - outputPath: str, -) -> Result_updateSkeleton: - print( - f"Creating updated skeleton file {prettyPathString(outputPath)} from {prettyPathString(origSkelPath)} with changes from {prettyPathString(origMdPath)} to {prettyPathString(newMdPath)}...", - ) - res = Result_updateSkeleton() - with contextlib.ExitStack() as stack: - origMdFile = stack.enter_context(open(origMdPath, "r", encoding="utf8")) - newMdFile = stack.enter_context(open(newMdPath, "r", encoding="utf8")) - origSkelFile = stack.enter_context(open(origSkelPath, "r", encoding="utf8")) - outputFile = stack.enter_context( - open(outputPath, "w", encoding="utf8", newline=""), - ) - origMdLines = preprocessMarkdownLines(origMdFile.readlines()) - newMdLines = preprocessMarkdownLines(newMdFile.readlines()) - mdDiff = difflib.ndiff(list(origMdLines), list(newMdLines)) - origSkelLines = iter(origSkelFile.readlines()) - for mdDiffLine in mdDiff: - if mdDiffLine.startswith("?"): - continue - if mdDiffLine.startswith(" "): - res.numUnchangedLines += 1 - skelLine = next(origSkelLines) - if re_translationID.match(skelLine): - res.numUnchangedTranslationPlaceholders += 1 - outputFile.write(skelLine) - elif mdDiffLine.startswith("+"): - res.numAddedLines += 1 - skelLine = skeletonizeLine(mdDiffLine[2:]) - if skelLine: - res.numAddedTranslationPlaceholders += 1 - else: - skelLine = mdDiffLine[2:] - outputFile.write(skelLine) - elif mdDiffLine.startswith("-"): - res.numRemovedLines += 1 - origSkelLine = next(origSkelLines) - if re_translationID.match(origSkelLine): - res.numRemovedTranslationPlaceholders += 1 - else: - raise ValueError(f"Unexpected diff line: {mdDiffLine}") - print( - f"Updated skeleton file with {res.numAddedLines} added lines " - f"({res.numAddedTranslationPlaceholders} translation placeholders), " - f"{res.numRemovedLines} removed lines ({res.numRemovedTranslationPlaceholders} translation placeholders), " - f"and {res.numUnchangedLines} unchanged lines ({res.numUnchangedTranslationPlaceholders} translation placeholders)", - ) - return res - - -@dataclass -class Result_generateXliff: - numTranslatableStrings: int = 0 - - -def generateXliff( - mdPath: str, - outputPath: str, - skelPath: str | None = None, -) -> Result_generateXliff: - # If a skeleton file is not provided, first generate one - with contextlib.ExitStack() as stack: - if not skelPath: - skelPath = stack.enter_context( - createAndDeleteTempFilePath_contextManager( - dir=os.path.dirname(outputPath), - prefix=os.path.basename(mdPath), - suffix=".skel", - ), - ) - generateSkeleton(mdPath=mdPath, outputPath=skelPath) - with open(skelPath, "r", encoding="utf8") as skelFile: - skelContent = skelFile.read() - res = Result_generateXliff() - print( - f"Generating xliff file {prettyPathString(outputPath)} from {prettyPathString(mdPath)} and {prettyPathString(skelPath)}...", - ) - with contextlib.ExitStack() as stack: - mdFile = stack.enter_context(open(mdPath, "r", encoding="utf8")) - outputFile = stack.enter_context( - open(outputPath, "w", encoding="utf8", newline=""), - ) - fileID = os.path.basename(mdPath) - mdUri = getRawGithubURLForPath(mdPath) - print(f"Including Github raw URL: {mdUri}") - outputFile.write( - '\n' - f'\n' - f'\n', - ) - outputFile.write(f"\n{xmlEscape(skelContent)}\n\n") - res.numTranslatableStrings = 0 - for lineNo, (mdLine, skelLine) in enumerate( - zip_longest( - preprocessMarkdownLines(mdFile.readlines()), - skelContent.splitlines(keepends=True), - ), - start=1, - ): - mdLine = mdLine.rstrip() - skelLine = skelLine.rstrip() - if m := re_translationID.match(skelLine): - res.numTranslatableStrings += 1 - prefix, ID, suffix = m.groups() - if prefix and not mdLine.startswith(prefix): - raise ValueError( - f'Line {lineNo}: does not start with "{prefix}", {mdLine=}, {skelLine=}', - ) - if suffix and not mdLine.endswith(suffix): - raise ValueError( - f'Line {lineNo}: does not end with "{suffix}", {mdLine=}, {skelLine=}', - ) - source = mdLine[len(prefix) : len(mdLine) - len(suffix)] - outputFile.write( - f'\n\nline: {lineNo + 1}\n', - ) - if prefix: - outputFile.write( - f'prefix: {xmlEscape(prefix)}\n', - ) - if suffix: - outputFile.write( - f'suffix: {xmlEscape(suffix)}\n', - ) - outputFile.write( - "\n" - f"\n" - f"{xmlEscape(source)}\n" - "\n" - "\n", # fmt: skip - ) - else: - if mdLine != skelLine: - raise ValueError( - f"Line {lineNo}: {mdLine=} does not match {skelLine=}", - ) - outputFile.write("\n") - print( - f"Generated xliff file with {res.numTranslatableStrings} translatable strings", - ) - return res - - -@dataclass -class Result_translateXliff: - numTranslatedStrings: int = 0 - - -def updateXliff( - xliffPath: str, - mdPath: str, - outputPath: str, -): - # uses generateMarkdown, extractSkeleton, updateSkeleton, and generateXliff to generate an updated xliff file. - outputDir = os.path.dirname(outputPath) - print( - f"Generating updated xliff file {prettyPathString(outputPath)} from {prettyPathString(xliffPath)} and {prettyPathString(mdPath)}...", - ) - with contextlib.ExitStack() as stack: - origMdPath = stack.enter_context( - createAndDeleteTempFilePath_contextManager( - dir=outputDir, - prefix="generated_", - suffix=".md", - ), - ) - generateMarkdown(xliffPath=xliffPath, outputPath=origMdPath, translated=False) - origSkelPath = stack.enter_context( - createAndDeleteTempFilePath_contextManager( - dir=outputDir, - prefix="extracted_", - suffix=".skel", - ), - ) - extractSkeleton(xliffPath=xliffPath, outputPath=origSkelPath) - updatedSkelPath = stack.enter_context( - createAndDeleteTempFilePath_contextManager( - dir=outputDir, - prefix="updated_", - suffix=".skel", - ), - ) - updateSkeleton( - origMdPath=origMdPath, - newMdPath=mdPath, - origSkelPath=origSkelPath, - outputPath=updatedSkelPath, - ) - generateXliff( - mdPath=mdPath, - skelPath=updatedSkelPath, - outputPath=outputPath, - ) - print(f"Generated updated xliff file {prettyPathString(outputPath)}") - - -def translateXliff( - xliffPath: str, - lang: str, - pretranslatedMdPath: str, - outputPath: str, - allowBadAnchors: bool = False, -) -> Result_translateXliff: - print( - f"Creating {lang} translated xliff file {prettyPathString(outputPath)} from {prettyPathString(xliffPath)} using {prettyPathString(pretranslatedMdPath)}...", - ) - res = Result_translateXliff() - with contextlib.ExitStack() as stack: - pretranslatedMdFile = stack.enter_context( - open(pretranslatedMdPath, "r", encoding="utf8"), - ) - xliff = lxml.etree.parse(xliffPath) - xliffRoot = xliff.getroot() - namespace = {"xliff": "urn:oasis:names:tc:xliff:document:2.0"} - if xliffRoot.tag != "{urn:oasis:names:tc:xliff:document:2.0}xliff": - raise ValueError("Not an xliff file") - xliffRoot.set("trgLang", lang) - skeletonNode = xliffRoot.find( - "./xliff:file/xliff:skeleton", - namespaces=namespace, - ) - if skeletonNode is None: - raise ValueError("No skeleton found in xliff file") - skeletonContent = skeletonNode.text.strip() - for lineNo, (skelLine, pretranslatedLine) in enumerate( - zip_longest( - skeletonContent.splitlines(), - preprocessMarkdownLines(pretranslatedMdFile.readlines()), - ), - start=1, - ): - skelLine = skelLine.rstrip() - pretranslatedLine = pretranslatedLine.rstrip() - if m := re_translationID.match(skelLine): - prefix, ID, suffix = m.groups() - if prefix and not pretranslatedLine.startswith(prefix): - raise ValueError( - f'Line {lineNo} of translation does not start with "{prefix}", {pretranslatedLine=}, {skelLine=}', - ) - if suffix and not pretranslatedLine.endswith(suffix): - if allowBadAnchors and (m := re_heading.match(pretranslatedLine)): - print( - f"Warning: ignoring bad anchor in line {lineNo}: {pretranslatedLine}", - ) - suffix = m.group(3) - if suffix and not pretranslatedLine.endswith(suffix): - raise ValueError( - f'Line {lineNo} of translation: does not end with "{suffix}", {pretranslatedLine=}, {skelLine=}', - ) - translation = pretranslatedLine[len(prefix) : len(pretranslatedLine) - len(suffix)] - try: - unit = xliffRoot.find( - f'./xliff:file/xliff:unit[@id="{ID}"]', - namespaces=namespace, - ) - if unit is not None: - segment = unit.find("./xliff:segment", namespaces=namespace) - if segment is not None: - target = lxml.etree.Element("target") - target.text = translation - target.tail = "\n" - segment.append(target) - res.numTranslatedStrings += 1 - else: - raise ValueError(f"No segment found for unit {ID}") - else: - raise ValueError(f"Cannot locate Unit {ID} in xliff file") - except Exception as e: - e.add_note(f"Line {lineNo}: {pretranslatedLine=}, {skelLine=}") - raise - elif skelLine != pretranslatedLine: - raise ValueError( - f"Line {lineNo}: pretranslated line {pretranslatedLine!r}, does not match skeleton line {skelLine!r}", - ) - xliff.write(outputPath, encoding="utf8", xml_declaration=True) - print( - f"Translated xliff file with {res.numTranslatedStrings} translated strings", - ) - return res - - -@dataclass -class Result_generateMarkdown: - numTotalLines = 0 - numTranslatableStrings = 0 - numTranslatedStrings = 0 - numBadTranslationStrings = 0 - - -def generateMarkdown( - xliffPath: str, - outputPath: str, - translated: bool = True, -) -> Result_generateMarkdown: - print( - f"Generating markdown file {prettyPathString(outputPath)} from {prettyPathString(xliffPath)}...", - ) - res = Result_generateMarkdown() - with contextlib.ExitStack() as stack: - outputFile = stack.enter_context( - open(outputPath, "w", encoding="utf8", newline=""), - ) - xliff = lxml.etree.parse(xliffPath) - xliffRoot = xliff.getroot() - namespace = {"xliff": "urn:oasis:names:tc:xliff:document:2.0"} - if xliffRoot.tag != "{urn:oasis:names:tc:xliff:document:2.0}xliff": - raise ValueError("Not an xliff file") - skeletonNode = xliffRoot.find( - "./xliff:file/xliff:skeleton", - namespaces=namespace, - ) - if skeletonNode is None: - raise ValueError("No skeleton found in xliff file") - skeletonContent = skeletonNode.text.strip() - for lineNum, line in enumerate(skeletonContent.splitlines(keepends=True), 1): - res.numTotalLines += 1 - if m := re_translationID.match(line): - prefix, ID, suffix = m.groups() - res.numTranslatableStrings += 1 - unit = xliffRoot.find( - f'./xliff:file/xliff:unit[@id="{ID}"]', - namespaces=namespace, - ) - if unit is None: - raise ValueError(f"Cannot locate Unit {ID} in xliff file") - segment = unit.find("./xliff:segment", namespaces=namespace) - if segment is None: - raise ValueError(f"No segment found for unit {ID}") - source = segment.find("./xliff:source", namespaces=namespace) - if source is None: - raise ValueError(f"No source found for unit {ID}") - translation = "" - if translated: - target = segment.find("./xliff:target", namespaces=namespace) - if target is not None: - targetText = target.text - if targetText: - translation = targetText - # Crowdin treats empty targets () as a literal translation. - # Filter out such strings and count them as bad translations. - if translation in ( - "", - "<target/>", - "", - "<target></target>", - ): - res.numBadTranslationStrings += 1 - translation = "" - else: - res.numTranslatedStrings += 1 - # If we have no translation, use the source text - if not translation: - sourceText = source.text - if sourceText is None: - raise ValueError(f"No source text found for unit {ID}") - translation = sourceText - outputFile.write(f"{prefix}{translation}{suffix}\n") - else: - outputFile.write(line) - print( - f"Generated markdown file with {res.numTotalLines} total lines, {res.numTranslatableStrings} translatable strings, and {res.numTranslatedStrings} translated strings. Ignoring {res.numBadTranslationStrings} bad translated strings", - ) - return res - - -def ensureMarkdownFilesMatch(path1: str, path2: str, allowBadAnchors: bool = False): - print( - f"Ensuring files {prettyPathString(path1)} and {prettyPathString(path2)} match...", - ) - with contextlib.ExitStack() as stack: - file1 = stack.enter_context(open(path1, "r", encoding="utf8")) - file2 = stack.enter_context(open(path2, "r", encoding="utf8")) - for lineNo, (line1, line2) in enumerate( - zip_longest( - preprocessMarkdownLines(file1.readlines()), - preprocessMarkdownLines(file2.readlines()), - ), - start=1, - ): - line1 = line1.rstrip() - line2 = line2.rstrip() - if line1 != line2: - if ( - re_postTableHeaderLine.match(line1) - and re_postTableHeaderLine.match(line2) - and line1.count("|") == line2.count("|") - ): - print( - f"Warning: ignoring cell padding of post table header line at line {lineNo}: {line1}, {line2}", - ) - continue - if ( - re_hiddenHeaderRow.match(line1) - and re_hiddenHeaderRow.match(line2) - and line1.count("|") == line2.count("|") - ): - print( - f"Warning: ignoring cell padding of hidden header row at line {lineNo}: {line1}, {line2}", - ) - continue - if allowBadAnchors and (m1 := re_heading.match(line1)) and (m2 := re_heading.match(line2)): - print( - f"Warning: ignoring bad anchor in headings at line {lineNo}: {line1}, {line2}", - ) - line1 = m1.group(1) + m1.group(2) - line2 = m2.group(1) + m2.group(2) - if line1 != line2: - raise ValueError( - f"Files do not match at line {lineNo}: {line1=} {line2=}", - ) - print("Files match") - - -def markdownTranslateCommand(command: str, *args): - print(f"Running markdownTranslate command: {command} {' '.join(args)}") - subprocess.run(["python", __file__, command, *args], check=True) - - -def pretranslateAllPossibleLanguages(langsDir: str, mdBaseName: str): - # This function walks through all language directories in the given directory, skipping en (English) and translates the English xlif and skel file along with the lang's pretranslated md file - enXliffPath = os.path.join(langsDir, "en", f"{mdBaseName}.xliff") - if not os.path.exists(enXliffPath): - raise ValueError(f"English xliff file {enXliffPath} does not exist") - allLangs = set() - succeededLangs = set() - skippedLangs = set() - for langDir in os.listdir(langsDir): - if langDir == "en": - continue - langDirPath = os.path.join(langsDir, langDir) - if not os.path.isdir(langDirPath): - continue - langPretranslatedMdPath = os.path.join(langDirPath, f"{mdBaseName}.md") - if not os.path.exists(langPretranslatedMdPath): - continue - allLangs.add(langDir) - langXliffPath = os.path.join(langDirPath, f"{mdBaseName}.xliff") - if os.path.exists(langXliffPath): - print(f"Skipping {langDir} as the xliff file already exists") - skippedLangs.add(langDir) - continue - try: - translateXliff( - xliffPath=enXliffPath, - lang=langDir, - pretranslatedMdPath=langPretranslatedMdPath, - outputPath=langXliffPath, - allowBadAnchors=True, - ) - except Exception as e: - print(f"Failed to translate {langDir}: {e}") - continue - rebuiltLangMdPath = os.path.join(langDirPath, f"rebuilt_{mdBaseName}.md") - try: - generateMarkdown( - xliffPath=langXliffPath, - outputPath=rebuiltLangMdPath, - ) - except Exception as e: - print(f"Failed to rebuild {langDir} markdown: {e}") - os.remove(langXliffPath) - continue - try: - ensureMarkdownFilesMatch( - rebuiltLangMdPath, - langPretranslatedMdPath, - allowBadAnchors=True, - ) - except Exception as e: - print( - f"Rebuilt {langDir} markdown does not match pretranslated markdown: {e}", - ) - os.remove(langXliffPath) - continue - os.remove(rebuiltLangMdPath) - print(f"Successfully pretranslated {langDir}") - succeededLangs.add(langDir) - if len(skippedLangs) > 0: - print(f"Skipped {len(skippedLangs)} languages already pretranslated.") - print( - f"Pretranslated {len(succeededLangs)} out of {len(allLangs) - len(skippedLangs)} languages.", - ) - - -if __name__ == "__main__": - mainParser = argparse.ArgumentParser() - commandParser = mainParser.add_subparsers( - title="commands", - dest="command", - required=True, - ) - generateXliffParser = commandParser.add_parser("generateXliff") - generateXliffParser.add_argument( - "-m", - "--markdown", - dest="md", - type=str, - required=True, - help="The markdown file to generate the xliff file for", - ) - generateXliffParser.add_argument( - "-o", - "--output", - dest="output", - type=str, - required=True, - help="The file to output the xliff file to", - ) - updateXliffParser = commandParser.add_parser("updateXliff") - updateXliffParser.add_argument( - "-x", - "--xliff", - dest="xliff", - type=str, - required=True, - help="The original xliff file", - ) - updateXliffParser.add_argument( - "-m", - "--newMarkdown", - dest="md", - type=str, - required=True, - help="The new markdown file", - ) - updateXliffParser.add_argument( - "-o", - "--output", - dest="output", - type=str, - required=True, - help="The file to output the updated xliff to", - ) - translateXliffParser = commandParser.add_parser("translateXliff") - translateXliffParser.add_argument( - "-x", - "--xliff", - dest="xliff", - type=str, - required=True, - help="The xliff file to translate", - ) - translateXliffParser.add_argument( - "-l", - "--lang", - dest="lang", - type=str, - required=True, - help="The language to translate to", - ) - translateXliffParser.add_argument( - "-p", - "--pretranslatedMarkdown", - dest="pretranslatedMd", - type=str, - required=True, - help="The pretranslated markdown file to use", - ) - translateXliffParser.add_argument( - "-o", - "--output", - dest="output", - type=str, - required=True, - help="The file to output the translated xliff file to", - ) - generateMarkdownParser = commandParser.add_parser("generateMarkdown") - generateMarkdownParser.add_argument( - "-x", - "--xliff", - dest="xliff", - type=str, - required=True, - help="The xliff file to generate the markdown file for", - ) - generateMarkdownParser.add_argument( - "-o", - "--output", - dest="output", - type=str, - required=True, - help="The file to output the markdown file to", - ) - generateMarkdownParser.add_argument( - "-u", - "--untranslated", - dest="translated", - action="store_false", - help="Generate the markdown file with the untranslated strings", - ) - ensureMarkdownFilesMatchParser = commandParser.add_parser( - "ensureMarkdownFilesMatch", - ) - ensureMarkdownFilesMatchParser.add_argument( - dest="path1", - type=str, - help="The first markdown file", - ) - ensureMarkdownFilesMatchParser.add_argument( - dest="path2", - type=str, - help="The second markdown file", - ) - pretranslateLangsParser = commandParser.add_parser("pretranslateLangs") - pretranslateLangsParser.add_argument( - "-d", - "--langs-dir", - dest="langsDir", - type=str, - required=True, - help="The directory containing the language directories", - ) - pretranslateLangsParser.add_argument( - "-b", - "--md-base-name", - dest="mdBaseName", - type=str, - required=True, - help="The base name of the markdown files to pretranslate", - ) - args = mainParser.parse_args() - match args.command: - case "generateXliff": - generateXliff(mdPath=args.md, outputPath=args.output) - case "updateXliff": - updateXliff( - xliffPath=args.xliff, - mdPath=args.md, - outputPath=args.output, - ) - case "generateMarkdown": - generateMarkdown( - xliffPath=args.xliff, - outputPath=args.output, - translated=args.translated, - ) - case "translateXliff": - translateXliff( - xliffPath=args.xliff, - lang=args.lang, - pretranslatedMdPath=args.pretranslatedMd, - outputPath=args.output, - ) - case "pretranslateLangs": - pretranslateAllPossibleLanguages( - langsDir=args.langsDir, - mdBaseName=args.mdBaseName, - ) - case "ensureMarkdownFilesMatch": - ensureMarkdownFilesMatch(path1=args.path1, path2=args.path2) - case _: - raise ValueError(f"Unknown command: {args.command}") diff --git a/.github/workflows/build_addon.yml b/.github/workflows/build_addon.yml index 237a496..ec1cc73 100644 --- a/.github/workflows/build_addon.yml +++ b/.github/workflows/build_addon.yml @@ -30,7 +30,7 @@ jobs: - name: Install dependencies run: | sudo apt-get update -y - sudo apt-get install -y gettext + sudo apt-get install -y gettext libgtk-3-dev uv sync - name: Code checks diff --git a/.github/workflows/manual-release.yaml b/.github/workflows/manual-release.yaml index aa952f8..897f460 100644 --- a/.github/workflows/manual-release.yaml +++ b/.github/workflows/manual-release.yaml @@ -150,8 +150,8 @@ jobs: with open("changelog.md", "w", encoding="utf-8") as f: f.write(text) - - shell: python + + shell: python - name: Check if there are any changes diff --git a/addon/globalPlugins/clock/__init__.py b/addon/globalPlugins/clock/__init__.py index aacca15..e6f5f5b 100644 --- a/addon/globalPlugins/clock/__init__.py +++ b/addon/globalPlugins/clock/__init__.py @@ -27,33 +27,36 @@ import wx import globalCommands import os + sys.path.append(os.path.join(os.path.abspath(os.path.dirname(__file__)))) from . import convertdate + sys.path.remove(sys.path[-1]) import time from .formats import safeGetTimeFormatEx, safeGetDateFormatEx from configobj.validate import VdtTypeError import addonHandler + addonHandler.initTranslation() _: Callable[[str], str] confspec = { - 'timeDisplayFormat': 'integer(default=0)', - 'dateDisplayFormat': 'integer(default=1)', - 'input24HourFormat': 'boolean(default=False)', - 'autoAnnounce': 'integer(default=0)', - 'timeReporting': 'integer(default=0)', - 'timeIntermediateReportSound': 'string(default="clock_chime1.wav")', - 'separateReportSounds': 'boolean(default=False)', - 'timeReportSound': 'string(default="clock_chime1.wav")', - 'alarmSound': 'string(default="alarm1.wav")', - 'alarmTimerChoice': 'integer(default=1)', - 'quietHours': 'boolean(default=False)', - 'alarmTime': 'float(default=0.0)', - 'alarmSavedTime': 'float(default=0.0)', - 'quietHoursStartTime': 'string(default="")', - 'quietHoursEndTime': 'string(default="")', + "timeDisplayFormat": "integer(default=0)", + "dateDisplayFormat": "integer(default=1)", + "input24HourFormat": "boolean(default=False)", + "autoAnnounce": "integer(default=0)", + "timeReporting": "integer(default=0)", + "timeIntermediateReportSound": 'string(default="clock_chime1.wav")', + "separateReportSounds": "boolean(default=False)", + "timeReportSound": 'string(default="clock_chime1.wav")', + "alarmSound": 'string(default="alarm1.wav")', + "alarmTimerChoice": "integer(default=1)", + "quietHours": "boolean(default=False)", + "alarmTime": "float(default=0.0)", + "alarmSavedTime": "float(default=0.0)", + "quietHoursStartTime": 'string(default="")', + "quietHoursEndTime": 'string(default="")', } config.conf.spec["clockAndCalendar"] = confspec @@ -131,7 +134,7 @@ def getDayAndWeekOfYear(date: str) -> Tuple[int, ...]: # For the first month, number of days is the same as current date. nDayOfYear = curDay if curMonth > 1: - nDayOfYear += sum(monthLengths[:curMonth - 1]) + nDayOfYear += sum(monthLengths[: curMonth - 1]) # Calculation of the weeks number. if nDayOfYear % 7 == 0: if dt.to_jd(curYear, 1, 1) == ndw: @@ -163,13 +166,14 @@ def checkLocalTimeFormats(): opportunity to improve their translations by translating uniquely each time format. """ fmtCounter = Counter(formats.timeFormats) - for (fmt, nbOccurrences) in fmtCounter.items(): + for fmt, nbOccurrences in fmtCounter.items(): if nbOccurrences > 1: - log.debugWarning(f"The format '{fmt}' appears {nbOccurrences} times for the current localization.") + log.debugWarning( + f"The format '{fmt}' appears {nbOccurrences} times for the current localization.", + ) class GlobalPlugin(globalPluginHandler.GlobalPlugin): - # Translators: Script category for Clock addon commands in input gestures dialog. scriptCategory = _("Clock") clockLayerModeActive = False @@ -184,45 +188,48 @@ def __init__(self): # noqa: C901 self.toolsMenu = gui.mainFrame.sysTrayIcon.toolsMenu self.alarmSettings = self.toolsMenu.Append( # Translators: The name of the alarm item in NVDA Tools menu. - wx.ID_ANY, _("Schedule a&larms..."), + wx.ID_ANY, + _("Schedule a&larms..."), # Translators: The tooltyp text for the alarm item in NVDA Tools menu. - _("Allows you to schedule an alarm") + _("Allows you to schedule an alarm"), ) gui.mainFrame.sysTrayIcon.Bind(wx.EVT_MENU, self.onAlarmSettingsDialog, self.alarmSettings) self.clock = clockHandler.Clock() self.stopwatch = stopwatchHandler.Stopwatch() - conf = config.conf['clockAndCalendar'] + conf = config.conf["clockAndCalendar"] validationFailed = False try: - conf['alarmTime'] + conf["alarmTime"] except VdtTypeError: validationFailed = True - conf.profiles[0]['alarmTime'] = 0.0 + conf.profiles[0]["alarmTime"] = 0.0 try: - conf['timeDisplayFormat'] + conf["timeDisplayFormat"] except VdtTypeError: validationFailed = True - conf.profiles[0]['timeDisplayFormat'] = 0 + conf.profiles[0]["timeDisplayFormat"] = 0 try: - conf['dateDisplayFormat'] + conf["dateDisplayFormat"] except VdtTypeError: - conf.profiles[0]['dateDisplayFormat'] = 1 + conf.profiles[0]["dateDisplayFormat"] = 1 validationFailed = True # We save the configuration, in case the user would not have checked the # "Save configuration on exit" checkbox in General settings. # Only do this if validation fails. - if validationFailed and not config.conf['general']['saveConfigurationOnExit']: + if validationFailed and not config.conf["general"]["saveConfigurationOnExit"]: config.conf.save() - if not config.conf['clockAndCalendar']['alarmSound'] in paths.LIST_ALARMS: + if config.conf["clockAndCalendar"]["alarmSound"] not in paths.LIST_ALARMS: alarmSound = paths.LIST_ALARMS[0] else: - alarmSound = config.conf['clockAndCalendar']['alarmSound'] - if config.conf['clockAndCalendar']['alarmSavedTime'] != 0.0: - wakeUp = config.conf['clockAndCalendar']['alarmTime'] - ( - time.time() - config.conf['clockAndCalendar']['alarmSavedTime'] + alarmSound = config.conf["clockAndCalendar"]["alarmSound"] + if config.conf["clockAndCalendar"]["alarmSavedTime"] != 0.0: + wakeUp = config.conf["clockAndCalendar"]["alarmTime"] - ( + time.time() - config.conf["clockAndCalendar"]["alarmSavedTime"] ) alarmHandler.run = alarmHandler.AlarmTimer( - wakeUp, alarmHandler.runAlarm, [os.path.join(paths.ALARMS_DIR, alarmSound)] + wakeUp, + alarmHandler.runAlarm, + [os.path.join(paths.ALARMS_DIR, alarmSound)], ) alarmHandler.run.start() # Clock layer gestures. @@ -234,7 +241,7 @@ def __init__(self): # noqa: C901 ("c", self.script_cancelAlarm), ("space", self.script_timeDisplay), ("p", self.script_stopLongAlarm), - ("h", self.script_getHelp) + ("h", self.script_getHelp), ) def terminate(self): @@ -251,10 +258,10 @@ def terminate(self): # Translators: Message presented in input help mode. "Speaks current time. If pressed twice quickly, speaks current date. " "If pressed three times quickly, reports the current day, the week number, " - "the current year and the days remaining before the end of the year." + "the current year and the days remaining before the end of the year.", ), category=globalCommands.SCRCAT_SYSTEM, - gesture="kb:NVDA+f12" + gesture="kb:NVDA+f12", ) def script_reportTimeAndDate(self, gesture): curMode = speech.getState().speechMode @@ -263,37 +270,45 @@ def script_reportTimeAndDate(self, gesture): now = datetime.now() if scriptHandler.getLastScriptRepeatCount() == 0: msg = safeGetTimeFormatEx( - None, None, now, formats.rgx.sub( - formats.repl, formats.timeFormats[config.conf['clockAndCalendar']['timeDisplayFormat']] - ) + None, + None, + now, + formats.rgx.sub( + formats.repl, + formats.timeFormats[config.conf["clockAndCalendar"]["timeDisplayFormat"]], + ), ) elif scriptHandler.getLastScriptRepeatCount() == 1: msg = safeGetDateFormatEx( - None, None, None, formats.dateFormats[config.conf['clockAndCalendar']['dateDisplayFormat']] + None, + None, + None, + formats.dateFormats[config.conf["clockAndCalendar"]["dateDisplayFormat"]], ) else: informations = getDayAndWeekOfYear(safeGetDateFormatEx(None, None, None, "yyyy/M/d")) msg = _( - "Day {day}, week {week} of {year}, remaining days {remain}." + "Day {day}, week {week} of {year}, remaining days {remain}.", ).format(day=informations[0], week=informations[1], year=informations[2], remain=informations[3]) ui.message(msg) speech.setSpeechMode(curMode) + # We remove the docstring from the original dateTime script # to have only one entry in the "System status" category, # it will be automatically restored if the Clock add-on is disabled or uninstalled. globalCommands.commands.script_dateTime.__func__.__doc__ = "" def getScript(self, gesture): - if ( - not hasattr(self, "clockLayerModeActive") - or (hasattr(self, "clockLayerModeActive") and not self.clockLayerModeActive) + if not hasattr(self, "clockLayerModeActive") or ( + hasattr(self, "clockLayerModeActive") and not self.clockLayerModeActive ): return globalPluginHandler.GlobalPlugin.getScript(self, gesture) script = globalPluginHandler.GlobalPlugin.getScript(self, gesture) if not script: return self.script_error self.layeredScriptToRun = next( - (x[1] for x in self._clockLayerGestures if x[0] == gesture.mainKeyName), None + (x[1] for x in self._clockLayerGestures if x[0] == gesture.mainKeyName), + None, ) return self.runAndFinish @@ -317,9 +332,9 @@ def script_error(self, gesture): @scriptHandler.script( description=_( # Translators: Message presented in input help mode. - "Clock and calendar layer commands. After pressing this keystroke, press H for additional help." + "Clock and calendar layer commands. After pressing this keystroke, press H for additional help.", ), - gesture="kb:NVDA+shift+f12" + gesture="kb:NVDA+shift+f12", ) def script_clockLayerCommands(self, gesture): curMode = speech.getState().speechMode @@ -336,7 +351,7 @@ def script_clockLayerCommands(self, gesture): @scriptHandler.script( # Translators: Message presented in input help mode. - description=_("Starts, resets or stops the stopwatch.") + description=_("Starts, resets or stops the stopwatch."), ) def script_stopwatchRun(self, gesture): curMode = speech.getState().speechMode @@ -356,7 +371,7 @@ def script_stopwatchRun(self, gesture): @scriptHandler.script( # Translators: Message presented in input help mode. - description=_("Speaks current stopwatch or count-down timer.") + description=_("Speaks current stopwatch or count-down timer."), ) def script_timeDisplay(self, gesture): curMode = speech.getState().speechMode @@ -367,7 +382,7 @@ def script_timeDisplay(self, gesture): @scriptHandler.script( # Translators: Message presented in input help mode. - description=_("Gives the remaining and elapsed time before the next alarm.") + description=_("Gives the remaining and elapsed time before the next alarm."), ) def script_alarmInfo(self, gesture): curMode = speech.getState().speechMode @@ -377,7 +392,7 @@ def script_alarmInfo(self, gesture): elapsedTime = alarmHandler.run.elapsed() remainingTime = alarmHandler.run.remaining() msg = _( - "Elapsed time {elapsed}, remaining time {remaining}." + "Elapsed time {elapsed}, remaining time {remaining}.", ).format(elapsed=secondsToString(elapsedTime), remaining=secondsToString(remainingTime)) else: msg = _("No alarm") @@ -386,7 +401,7 @@ def script_alarmInfo(self, gesture): @scriptHandler.script( # Translators: Message presented in input help mode. - description=_("Cancel the next alarm.") + description=_("Cancel the next alarm."), ) def script_cancelAlarm(self, gesture): curMode = speech.getState().speechMode @@ -402,15 +417,21 @@ def script_cancelAlarm(self, gesture): @scriptHandler.script( # Translators: Message presented in input help mode. - description=_("Resets stopwatch to 0 without restarting it.") + description=_("Resets stopwatch to 0 without restarting it."), ) def script_stopwatchReset(self, gesture): curMode = speech.getState().speechMode if hasattr(speech.SpeechMode, "onDemand") and curMode == speech.SpeechMode.onDemand: speech.setSpeechMode(speech.SpeechMode.talk) - if self.stopwatch.startTime is None and self.stopwatch.stopTime is None and not self.stopwatch.running: + if ( + self.stopwatch.startTime is None + and self.stopwatch.stopTime is None + and not self.stopwatch.running + ): ui.message( - _("The stopwatch is already reset to 0. Use the clock layer command followed by s to start it.") + _( + "The stopwatch is already reset to 0. Use the clock layer command followed by s to start it.", + ), ) return self.stopwatch.reset() @@ -419,30 +440,48 @@ def script_stopwatchReset(self, gesture): @scriptHandler.script( # Translators: Message presented in input help mode. - description=_("Lists available commands in clock command layer.") + description=_("Lists available commands in clock command layer."), ) def script_getHelp(self, gesture): curMode = speech.getState().speechMode if hasattr(speech.SpeechMode, "onDemand") and curMode == speech.SpeechMode.onDemand: speech.setSpeechMode(speech.SpeechMode.talk) - ui.message("\n".join(x[0] + " : " + x[1].__doc__ if x[0] != "space" else skipTranslation.translate(x[0]) + " : " + x[1].__doc__ for x in self._clockLayerGestures)) # NOQA: E501 + ui.message( + "\n".join( + x[0] + " : " + x[1].__doc__ + if x[0] != "space" + else skipTranslation.translate(x[0]) + " : " + x[1].__doc__ + for x in self._clockLayerGestures + ), + ) # NOQA: E501 speech.setSpeechMode(curMode) @scriptHandler.script( # Translators: Message presented in input help mode. - description=_("Lists available commands in clock command layer, showing them in browse mode.") + description=_("Lists available commands in clock command layer, showing them in browse mode."), ) def script_getHelpInBrowseMode(self, gesture): curMode = speech.getState().speechMode if hasattr(speech.SpeechMode, "onDemand") and curMode == speech.SpeechMode.onDemand: speech.setSpeechMode(speech.SpeechMode.talk) - browseableMessageText = "
  • " + ("
  • ".join(x[0] + " : " + x[1].__doc__ if x[0] != "space" else skipTranslation.translate(x[0]) + " : " + x[1].__doc__ for x in self._clockLayerGestures)) + "
" # NOQA: E501 + browseableMessageText = ( + "
  • " + + ( + "
  • ".join( + x[0] + " : " + x[1].__doc__ + if x[0] != "space" + else skipTranslation.translate(x[0]) + " : " + x[1].__doc__ + for x in self._clockLayerGestures + ) + ) + + "
" + ) # NOQA: E501 ui.browseableMessage(browseableMessageText, self.scriptCategory, isHtml=True) speech.setSpeechMode(curMode) @scriptHandler.script( # Translators: Message presented in input help mode. - description=_("Allows to check the next alarm. If pressed twice, cancels it.") + description=_("Allows to check the next alarm. If pressed twice, cancels it."), ) def script_checkOrCancelAlarm(self, gesture): curMode = speech.getState().speechMode @@ -456,7 +495,7 @@ def script_checkOrCancelAlarm(self, gesture): msg = _("Alarm cancelled") else: msg = _( - "Elapsed time {elapsed}, remaining time {remaining}." + "Elapsed time {elapsed}, remaining time {remaining}.", ).format(elapsed=secondsToString(elapsedTime), remaining=secondsToString(remainingTime)) else: msg = _("No alarm") @@ -465,7 +504,7 @@ def script_checkOrCancelAlarm(self, gesture): @scriptHandler.script( # Translators: Message presented in input help mode. - description=_("If an alarm is too long, allows to stop it.") + description=_("If an alarm is too long, allows to stop it."), ) def script_stopLongAlarm(self, gesture): curMode = speech.getState().speechMode @@ -489,12 +528,13 @@ def onAlarmSettingsDialog(self, evt): gui.messageBox, # Translators: error message when attempting to open more than one alarm settings dialogs. _("Schedule alarms dialog is already open."), - skipTranslation.translate("Error"), wx.OK | wx.ICON_ERROR + skipTranslation.translate("Error"), + wx.OK | wx.ICON_ERROR, ) @scriptHandler.script( # Translators: Message presented in input help mode. - description=_("Display the clock settings dialog box.") + description=_("Display the clock settings dialog box."), ) def script_activateClockSettingsDialog(self, gesture): curMode = speech.getState().speechMode @@ -505,7 +545,7 @@ def script_activateClockSettingsDialog(self, gesture): @scriptHandler.script( # Translators: Message presented in input help mode. - description=_("Display schedule alarms dialog box.") + description=_("Display schedule alarms dialog box."), ) def script_activateAlarmSettingsDialog(self, gesture): curMode = speech.getState().speechMode diff --git a/addon/globalPlugins/clock/alarmHandler.py b/addon/globalPlugins/clock/alarmHandler.py index eab45ab..d9768c7 100644 --- a/addon/globalPlugins/clock/alarmHandler.py +++ b/addon/globalPlugins/clock/alarmHandler.py @@ -17,11 +17,11 @@ def runAlarm(sound: str) -> None: @type sound: basestring. """ nvwave.playWaveFile(sound) - config.conf['clockAndCalendar']['alarmTime'] = 0.0 - config.conf['clockAndCalendar']['alarmSavedTime'] = 0.0 + config.conf["clockAndCalendar"]["alarmTime"] = 0.0 + config.conf["clockAndCalendar"]["alarmSavedTime"] = 0.0 # We save the configuration, in case the user would not have checked the # "Save configuration on exit" checkbox in General settings. - if not config.conf['general']['saveConfigurationOnExit']: + if not config.conf["general"]["saveConfigurationOnExit"]: config.conf.save() @@ -30,32 +30,33 @@ class AlarmTimer(threading.Timer): A subclass of the threading._ Timer class that adds the ability to find the elapsed time as well as the remaining time """ + startTiming = 0.0 def start(self) -> None: self.startTiming = time.time() # We check whether NVDA has been restarted or not. - if config.conf['clockAndCalendar']['alarmSavedTime'] == 0.0: + if config.conf["clockAndCalendar"]["alarmSavedTime"] == 0.0: # NVDA has not been restarted - config.conf['clockAndCalendar']['alarmSavedTime'] = self.startTiming + config.conf["clockAndCalendar"]["alarmSavedTime"] = self.startTiming else: # NVDA has been restarted. - self.startTiming = config.conf['clockAndCalendar']['alarmSavedTime'] + self.startTiming = config.conf["clockAndCalendar"]["alarmSavedTime"] threading.Timer.start(self) def elapsed(self) -> float: return time.time() - self.startTiming if self.is_alive() else 0.0 def remaining(self) -> float: - return config.conf['clockAndCalendar']['alarmTime'] - self.elapsed() if self.is_alive() else 0 + return config.conf["clockAndCalendar"]["alarmTime"] - self.elapsed() if self.is_alive() else 0 def cancel(self) -> None: threading.Timer.cancel(self) - config.conf['clockAndCalendar']['alarmTime'] = 0.0 - config.conf['clockAndCalendar']['alarmSavedTime'] = 0.0 + config.conf["clockAndCalendar"]["alarmTime"] = 0.0 + config.conf["clockAndCalendar"]["alarmSavedTime"] = 0.0 # We save the configuration, in case the user would not have checked the # "Save configuration on exit" checkbox in General settings. - if not config.conf['general']['saveConfigurationOnExit']: + if not config.conf["general"]["saveConfigurationOnExit"]: config.conf.save() diff --git a/addon/globalPlugins/clock/clockHandler.py b/addon/globalPlugins/clock/clockHandler.py index ce8832b..9ca090c 100644 --- a/addon/globalPlugins/clock/clockHandler.py +++ b/addon/globalPlugins/clock/clockHandler.py @@ -28,7 +28,8 @@ def getWaveFileDuration(sound: str) -> int: @rtype: int. """ import wave - with wave.open(sound, 'r') as f: + + with wave.open(sound, "r") as f: frames = f.getnframes() rate = f.getframerate() duration = frames / rate @@ -45,7 +46,6 @@ def getWaveFileDuration(sound: str) -> int: autoAnnounceIntervals: Dict[int, int] = { AutoAnnounceIntervalEvery5Mins: 5, AutoAnnounceIntervalEvery10Mins: 10, - AutoAnnounceIntervalEvery15Mins: 15, AutoAnnounceIntervalEvery30Mins: 30, AutoAnnounceIntervalEveryHour: 60, @@ -53,7 +53,6 @@ def getWaveFileDuration(sound: str) -> int: class Clock(object): - def __init__(self) -> None: self._autoAnnounceClockTimer = wx.PyTimer(self._handleClockAnnouncement) self._autoAnnounceClockTimer.Start(1000) @@ -89,11 +88,14 @@ def reportClock(self) -> None: now = datetime.now() if self.quietHoursAreActive(): return - if config.conf["clockAndCalendar"]["separateReportSounds"] == True: - if now.minute == 0: - waveFile = os.path.join(paths.SOUNDS_DIR, config.conf["clockAndCalendar"]["timeReportSound"]) - else: - waveFile = os.path.join(paths.SOUNDS_DIR, config.conf["clockAndCalendar"]["timeIntermediateReportSound"]) + if config.conf["clockAndCalendar"]["separateReportSounds"]: + if now.minute == 0: + waveFile = os.path.join(paths.SOUNDS_DIR, config.conf["clockAndCalendar"]["timeReportSound"]) + else: + waveFile = os.path.join( + paths.SOUNDS_DIR, + config.conf["clockAndCalendar"]["timeIntermediateReportSound"], + ) else: waveFile = os.path.join(paths.SOUNDS_DIR, config.conf["clockAndCalendar"]["timeReportSound"]) if config.conf["clockAndCalendar"]["timeReporting"] != 1: @@ -105,18 +107,26 @@ def reportClock(self) -> None: 10 + (1000 * waveFileDuration), ui.message, safeGetTimeFormatEx( - None, None, now, formats.rgx.sub( - formats.repl, formats.timeFormats[config.conf['clockAndCalendar']['timeDisplayFormat']] - ) - ) + None, + None, + now, + formats.rgx.sub( + formats.repl, + formats.timeFormats[config.conf["clockAndCalendar"]["timeDisplayFormat"]], + ), + ), ) else: ui.message( safeGetTimeFormatEx( - None, None, now, formats.rgx.sub( - formats.repl, formats.timeFormats[config.conf['clockAndCalendar']['timeDisplayFormat']] - ) - ) + None, + None, + now, + formats.rgx.sub( + formats.repl, + formats.timeFormats[config.conf["clockAndCalendar"]["timeDisplayFormat"]], + ), + ), ) def quietHoursAreActive(self) -> bool: @@ -128,7 +138,10 @@ def quietHoursAreActive(self) -> bool: return False nowTime = dtfunctions.strfNowTime(config.conf["clockAndCalendar"]["input24HourFormat"]) if dtfunctions.timeInRange( - qhStartTime, qhEndTime, nowTime, config.conf["clockAndCalendar"]["input24HourFormat"] + qhStartTime, + qhEndTime, + nowTime, + config.conf["clockAndCalendar"]["input24HourFormat"], ): return True return False diff --git a/addon/globalPlugins/clock/clockSettingsGUI.py b/addon/globalPlugins/clock/clockSettingsGUI.py index 87faeae..f34c2e7 100644 --- a/addon/globalPlugins/clock/clockSettingsGUI.py +++ b/addon/globalPlugins/clock/clockSettingsGUI.py @@ -19,11 +19,12 @@ from typing import Callable import addonHandler + addonHandler.initTranslation() _: Callable[[str], str] -class ClockSettingsPanel(SettingsPanel): +class ClockSettingsPanel(SettingsPanel): # Translators: This is the label for the clock settings panel. title = _("Clock") @@ -37,7 +38,7 @@ def makeSettings(self, settingsSizer): self._announceChoices = ( # Translators: This is a choice of the auto announce choices combo box. _("off"), - # Translators: This is a choice of the auto announce choices combo box. + # Translators: This is a choice of the auto announce choices combo box. _("every 5 minutes"), # Translators: This is a choice of the auto announce choices combo box. _("every 10 minutes"), @@ -46,7 +47,7 @@ def makeSettings(self, settingsSizer): # Translators: This is a choice of the auto announce choices combo box. _("every 30 minutes"), # Translators: This is a choice of the auto announce choices combo box. - _("every hour") + _("every hour"), ) # Translators: This is the label for a combo box in the Clock settings dialog. @@ -58,7 +59,7 @@ def makeSettings(self, settingsSizer): # Translators: This is a choice of the time report choices combo box. _("message only"), # Translators: This is a choice of the time report choices combo box. - _("sound only") + _("sound only"), ) # Translators: This is the label for a combo box in the Clock settings dialog. @@ -80,7 +81,7 @@ def makeSettings(self, settingsSizer): # Translators: This is a choice of the quiet hours time format choices. _("12-hour format"), # Translators: This is a choice of the quiet hours time format choices. - _("24-hour format") + _("24-hour format"), ) # Translators: This is the label for a combo box in the Clock settings dialog. @@ -103,35 +104,59 @@ def makeSettings(self, settingsSizer): def showSettingsDialog(self, settingsSizer): clockSettingsGuiHelper = gui.guiHelper.BoxSizerHelper(self, sizer=settingsSizer) self._timeDisplayFormatChoice = clockSettingsGuiHelper.addLabeledControl( - self._timeDisplayFormat, wx.Choice, choices=formats.timeDisplayFormats + self._timeDisplayFormat, + wx.Choice, + choices=formats.timeDisplayFormats, ) self._dateDisplayFormatChoice = clockSettingsGuiHelper.addLabeledControl( - self._dateDisplayFormat, wx.Choice, choices=formats.dateDisplayFormats + self._dateDisplayFormat, + wx.Choice, + choices=formats.dateDisplayFormats, ) self._autoAnnounceChoice = clockSettingsGuiHelper.addLabeledControl( - self._autoAnnounce, wx.Choice, choices=self._announceChoices + self._autoAnnounce, + wx.Choice, + choices=self._announceChoices, ) self._timeReportChoice = clockSettingsGuiHelper.addLabeledControl( - self._timeReport, wx.Choice, choices=self._timeAnnounceChoices + self._timeReport, + wx.Choice, + choices=self._timeAnnounceChoices, ) self._timeReportSoundChoice = clockSettingsGuiHelper.addLabeledControl( - self._timeReportSound, wx.Choice, choices=paths.LIST_SOUNDS + self._timeReportSound, + wx.Choice, + choices=paths.LIST_SOUNDS, + ) + self.addCustomSoundButton = clockSettingsGuiHelper.addItem( + wx.Button(self, label=_("Add custom sound")), + ) + self.addCustomSoundButton.Bind( + wx.EVT_BUTTON, + lambda evt: self.onAddCustomSound(evt, soundType="timeReportSound"), ) - self.addCustomSoundButton = clockSettingsGuiHelper.addItem(wx.Button(self, label=_("Add custom sound"))) - self.addCustomSoundButton.Bind(wx.EVT_BUTTON, lambda evt: self.onAddCustomSound(evt, soundType="timeReportSound")) self._separateReportSoundsCheckBox = clockSettingsGuiHelper.addItem( - wx.CheckBox(self, label=self._separateReportSounds) + wx.CheckBox(self, label=self._separateReportSounds), ) self._timeIntermediateReportSoundChoice = clockSettingsGuiHelper.addLabeledControl( - self._timeIntermediateReportSound, wx.Choice, choices=paths.LIST_SOUNDS + self._timeIntermediateReportSound, + wx.Choice, + choices=paths.LIST_SOUNDS, + ) + self.addCustomIntermediateSoundButton = clockSettingsGuiHelper.addItem( + wx.Button(self, label=_("Add custom sound")), + ) + self.addCustomIntermediateSoundButton.Bind( + wx.EVT_BUTTON, + lambda evt: self.onAddCustomSound(evt, soundType="timeIntermediateReportSound"), ) - self.addCustomIntermediateSoundButton = clockSettingsGuiHelper.addItem(wx.Button(self, label=_("Add custom sound"))) - self.addCustomIntermediateSoundButton.Bind(wx.EVT_BUTTON, lambda evt: self.onAddCustomSound(evt, soundType="timeIntermediateReportSound")) self._quietHoursCheckBox = clockSettingsGuiHelper.addItem( - wx.CheckBox(self, label=self._quietHours) + wx.CheckBox(self, label=self._quietHours), ) self._input24HourFormatChoice = clockSettingsGuiHelper.addLabeledControl( - self._input24HourFormat, wx.Choice, choices=self._quietHourTimeFormatChoices + self._input24HourFormat, + wx.Choice, + choices=self._quietHourTimeFormatChoices, ) # Build appropriate hours list with or without period suffix. if not config.conf["clockAndCalendar"]["input24HourFormat"]: @@ -139,32 +164,42 @@ def showSettingsDialog(self, settingsSizer): else: hoursList = self.hoursList24 self._quietHoursStartGroup = gui.guiHelper.BoxSizerHelper( - self, sizer=wx.StaticBoxSizer(wx.StaticBox(self, label=self._quietStartTime), wx.HORIZONTAL) + self, + sizer=wx.StaticBoxSizer(wx.StaticBox(self, label=self._quietStartTime), wx.HORIZONTAL), ) clockSettingsGuiHelper.addItem(self._quietHoursStartGroup) self.startHourEntry = self._quietHoursStartGroup.addLabeledControl( # Translators: the hour label in quiet hours group. - _("Hour:"), wx.Choice, choices=hoursList + _("Hour:"), + wx.Choice, + choices=hoursList, ) self.startMinEntry = self._quietHoursStartGroup.addLabeledControl( # Translators: the minute label in quiet hours group. - _("Minute:"), wx.Choice, choices=self.minutesList + _("Minute:"), + wx.Choice, + choices=self.minutesList, ) self._quietHoursEndGroup = gui.guiHelper.BoxSizerHelper( - self, sizer=wx.StaticBoxSizer(wx.StaticBox(self, label=self._quietEndTime), wx.HORIZONTAL) + self, + sizer=wx.StaticBoxSizer(wx.StaticBox(self, label=self._quietEndTime), wx.HORIZONTAL), ) clockSettingsGuiHelper.addItem(self._quietHoursEndGroup) self.endHourEntry = self._quietHoursEndGroup.addLabeledControl( # Translators: the hour label in quiet hours group. - _("Hour:"), wx.Choice, choices=hoursList + _("Hour:"), + wx.Choice, + choices=hoursList, ) self.endMinEntry = self._quietHoursEndGroup.addLabeledControl( # Translators: the minute label in quiet hours group. - _("Minute:"), wx.Choice, choices=self.minutesList + _("Minute:"), + wx.Choice, + choices=self.minutesList, ) # Event. - + self._timeIntermediateReportSoundChoice.Bind(wx.EVT_CHOICE, self.onSoundSelected) self._separateReportSoundsCheckBox.Bind(wx.EVT_CHECKBOX, self.onSeparateReportSoundsToggle) self._timeReportSoundChoice.Bind(wx.EVT_CHOICE, self.onSoundSelected) @@ -177,7 +212,9 @@ def onAutoAnnounce(self, evt): evt.Skip() self._timeReportChoice.Enabled = bool(self._autoAnnounceChoice.GetSelection()) self._quietHoursCheckBox.Enabled = bool(self._autoAnnounceChoice.GetSelection()) - self._timeIntermediateReportSoundChoice.Enabled = bool(self._autoAnnounceChoice.GetSelection() and self._separateReportSoundsCheckBox.IsChecked()) + self._timeIntermediateReportSoundChoice.Enabled = bool( + self._autoAnnounceChoice.GetSelection() and self._separateReportSoundsCheckBox.IsChecked(), + ) self.addCustomIntermediateSoundButton.Show(self._separateReportSoundsCheckBox.IsChecked()) self._timeReportSoundChoice.Enabled = bool(self._autoAnnounceChoice.GetSelection()) self.addCustomSoundButton.Enabled = bool(self._autoAnnounceChoice.GetSelection()) @@ -185,9 +222,15 @@ def onAutoAnnounce(self, evt): self._input24HourFormatChoice.Enabled = ( self._quietHoursCheckBox.IsChecked() and self._quietHoursCheckBox.IsEnabled() ) - self.startHourEntry.Enable(self._quietHoursCheckBox.IsChecked() and self._quietHoursCheckBox.IsEnabled()) - self.startMinEntry.Enable(self._quietHoursCheckBox.IsChecked() and self._quietHoursCheckBox.IsEnabled()) - self.endHourEntry.Enable(self._quietHoursCheckBox.IsChecked() and self._quietHoursCheckBox.IsEnabled()) + self.startHourEntry.Enable( + self._quietHoursCheckBox.IsChecked() and self._quietHoursCheckBox.IsEnabled(), + ) + self.startMinEntry.Enable( + self._quietHoursCheckBox.IsChecked() and self._quietHoursCheckBox.IsEnabled(), + ) + self.endHourEntry.Enable( + self._quietHoursCheckBox.IsChecked() and self._quietHoursCheckBox.IsEnabled(), + ) self.endMinEntry.Enable(self._quietHoursCheckBox.IsChecked() and self._quietHoursCheckBox.IsEnabled()) import shutil @@ -198,7 +241,7 @@ def onAddCustomSound(self, evt, soundType): message=_("Choose a custom sound file"), defaultDir=os.path.expanduser("~"), wildcard="WAV files (*.wav)|*.wav", - style=wx.FD_OPEN | wx.FD_FILE_MUST_EXIST + style=wx.FD_OPEN | wx.FD_FILE_MUST_EXIST, ) if dlg.ShowModal() == wx.ID_OK: customSoundPath = dlg.GetPath() @@ -262,21 +305,23 @@ def setValues(self): if config.conf["clockAndCalendar"]["quietHoursStartTime"]: quietHoursStartTime = dtfunctions.parseTime( config.conf["clockAndCalendar"]["quietHoursStartTime"], - parse24hour=config.conf["clockAndCalendar"]["input24HourFormat"] + parse24hour=config.conf["clockAndCalendar"]["input24HourFormat"], ) else: quietHoursStartTime = datetime.time() if config.conf["clockAndCalendar"]["quietHoursEndTime"]: quietHoursEndTime = dtfunctions.parseTime( config.conf["clockAndCalendar"]["quietHoursEndTime"], - parse24hour=config.conf["clockAndCalendar"]["input24HourFormat"] + parse24hour=config.conf["clockAndCalendar"]["input24HourFormat"], ) else: quietHoursEndTime = datetime.time() self._autoAnnounceChoice.SetSelection(config.conf["clockAndCalendar"]["autoAnnounce"]) self._timeReportChoice.SetSelection(config.conf["clockAndCalendar"]["timeReporting"]) self._timeReportSoundChoice.SetStringSelection(config.conf["clockAndCalendar"]["timeReportSound"]) - self._timeIntermediateReportSoundChoice.SetStringSelection(config.conf["clockAndCalendar"]["timeIntermediateReportSound"]) + self._timeIntermediateReportSoundChoice.SetStringSelection( + config.conf["clockAndCalendar"]["timeIntermediateReportSound"], + ) self._quietHoursCheckBox.SetValue(config.conf["clockAndCalendar"]["quietHours"]) self._separateReportSoundsCheckBox.SetValue(config.conf["clockAndCalendar"]["separateReportSounds"]) self._input24HourFormatChoice.SetSelection(config.conf["clockAndCalendar"]["input24HourFormat"]) @@ -288,24 +333,38 @@ def setValues(self): self._quietHoursCheckBox.Enabled = bool(self._autoAnnounceChoice.GetSelection()) self._timeReportSoundChoice.Enabled = bool(self._autoAnnounceChoice.GetSelection()) self.addCustomSoundButton.Enabled = bool(self._autoAnnounceChoice.GetSelection()) - self._timeIntermediateReportSoundChoice.Enabled = bool(self._autoAnnounceChoice.GetSelection() and self._separateReportSoundsCheckBox.IsChecked()) + self._timeIntermediateReportSoundChoice.Enabled = bool( + self._autoAnnounceChoice.GetSelection() and self._separateReportSoundsCheckBox.IsChecked(), + ) self.addCustomIntermediateSoundButton.Show(self._separateReportSoundsCheckBox.IsChecked()) self._input24HourFormatChoice.Enabled = ( self._quietHoursCheckBox.IsChecked() and self._quietHoursCheckBox.IsEnabled() ) - self.startHourEntry.Enable(self._quietHoursCheckBox.IsChecked() and self._quietHoursCheckBox.IsEnabled()) - self.startMinEntry.Enable(self._quietHoursCheckBox.IsChecked() and self._quietHoursCheckBox.IsEnabled()) - self.endHourEntry.Enable(self._quietHoursCheckBox.IsChecked() and self._quietHoursCheckBox.IsEnabled()) + self.startHourEntry.Enable( + self._quietHoursCheckBox.IsChecked() and self._quietHoursCheckBox.IsEnabled(), + ) + self.startMinEntry.Enable( + self._quietHoursCheckBox.IsChecked() and self._quietHoursCheckBox.IsEnabled(), + ) + self.endHourEntry.Enable( + self._quietHoursCheckBox.IsChecked() and self._quietHoursCheckBox.IsEnabled(), + ) self.endMinEntry.Enable(self._quietHoursCheckBox.IsChecked() and self._quietHoursCheckBox.IsEnabled()) def onSave(self): config.conf["clockAndCalendar"]["timeDisplayFormat"] = self._timeDisplayFormatChoice.GetSelection() config.conf["clockAndCalendar"]["dateDisplayFormat"] = self._dateDisplayFormatChoice.GetSelection() - config.conf["clockAndCalendar"]["input24HourFormat"] = bool(self._input24HourFormatChoice.GetSelection()) + config.conf["clockAndCalendar"]["input24HourFormat"] = bool( + self._input24HourFormatChoice.GetSelection(), + ) config.conf["clockAndCalendar"]["autoAnnounce"] = self._autoAnnounceChoice.GetSelection() config.conf["clockAndCalendar"]["timeReporting"] = self._timeReportChoice.GetSelection() - config.conf["clockAndCalendar"]["timeIntermediateReportSound"] = self._timeIntermediateReportSoundChoice.GetStringSelection() - config.conf["clockAndCalendar"]["separateReportSounds"] = self._separateReportSoundsCheckBox.GetValue() + config.conf["clockAndCalendar"]["timeIntermediateReportSound"] = ( + self._timeIntermediateReportSoundChoice.GetStringSelection() + ) + config.conf["clockAndCalendar"]["separateReportSounds"] = ( + self._separateReportSoundsCheckBox.GetValue() + ) config.conf["clockAndCalendar"]["timeReportSound"] = self._timeReportSoundChoice.GetStringSelection() quietHours = self._quietHoursCheckBox.GetValue() config.conf["clockAndCalendar"]["quietHours"] = quietHours @@ -335,7 +394,6 @@ def onSave(self): class AlarmSettingsDialog(SettingsDialog): - # Translators: This is the label for the alarm settings panel. title = _("Schedule alarms") pause = False @@ -347,7 +405,7 @@ def makeSettings(self, settingsSizer): # Translators: This is an item of the alarm duration choices. _("minutes"), # Translators: This is an item of the alarm duration choices. - _("seconds") + _("seconds"), ) # Translators: This is the label for a combo box in the Alarm settings dialog. @@ -373,15 +431,22 @@ def postInit(self): def showAlarmDialog(self, settingsSizer): alarmSettingsGuiHelper = gui.guiHelper.BoxSizerHelper(self, sizer=settingsSizer) self._alarmTimerChoice = alarmSettingsGuiHelper.addLabeledControl( - self._alarmTimerTitle, wx.Choice, choices=self._alarmTimerChoices + self._alarmTimerTitle, + wx.Choice, + choices=self._alarmTimerChoices, ) self._alarmTimeWaitingText = alarmSettingsGuiHelper.addLabeledControl( - self._alarmTimeWaitingTitle, wx.TextCtrl + self._alarmTimeWaitingTitle, + wx.TextCtrl, ) self._alarmSoundChoice = alarmSettingsGuiHelper.addLabeledControl( - self._alarmSoundTitle, wx.Choice, choices=paths.LIST_ALARMS + self._alarmSoundTitle, + wx.Choice, + choices=paths.LIST_ALARMS, + ) + self.addCustomAlarmSoundButton = alarmSettingsGuiHelper.addItem( + wx.Button(self, label=_("Add custom sound")), ) - self.addCustomAlarmSoundButton = alarmSettingsGuiHelper.addItem(wx.Button(self, label=_("Add custom sound"))) self.addCustomAlarmSoundButton.Bind(wx.EVT_BUTTON, self.onAddCustomAlarmSound) self.stopButton = alarmSettingsGuiHelper.addItem(wx.Button(self, label=self.stopLabel)) self.pauseButton = alarmSettingsGuiHelper.addItem(wx.Button(self, label=self.pauseLabel)) @@ -390,8 +455,6 @@ def showAlarmDialog(self, settingsSizer): self._alarmSoundChoice.Bind(wx.EVT_CHOICE, self.onAlarmSelected) self.stopButton.Bind(wx.EVT_BUTTON, self.onStop) self.pauseButton.Bind(wx.EVT_BUTTON, self.onPause) - - curChoice = config.conf["clockAndCalendar"]["alarmTimerChoice"] self._alarmSoundChoice.SetStringSelection(config.conf["clockAndCalendar"]["alarmSound"]) def onStop(self, evt): @@ -401,9 +464,13 @@ def onStop(self, evt): def onPause(self, evt): if not nvwave.fileWavePlayer: - return nvwave.playWaveFile(os.path.join(paths.ALARMS_DIR, self._alarmSoundChoice.GetStringSelection())) + return nvwave.playWaveFile( + os.path.join(paths.ALARMS_DIR, self._alarmSoundChoice.GetStringSelection()), + ) if not nvwave.fileWavePlayer._waveout: - return nvwave.playWaveFile(os.path.join(paths.ALARMS_DIR, self._alarmSoundChoice.GetStringSelection())) + return nvwave.playWaveFile( + os.path.join(paths.ALARMS_DIR, self._alarmSoundChoice.GetStringSelection()), + ) self.pause = not self.pause return nvwave.fileWavePlayer.pause(self.pause) @@ -413,7 +480,7 @@ def onAddCustomAlarmSound(self, evt): message=_("Choose a custom alarm sound file"), defaultDir=os.path.expanduser("~"), wildcard="WAV files (*.wav)|*.wav", - style=wx.FD_OPEN | wx.FD_FILE_MUST_EXIST + style=wx.FD_OPEN | wx.FD_FILE_MUST_EXIST, ) if dlg.ShowModal() == wx.ID_OK: customSoundPath = dlg.GetPath() @@ -449,26 +516,35 @@ def onCancel(self, evt): def postSave(self): if re.match(r"\d+", self._alarmTimeWaitingText.GetValue()): - if gui.messageBox( - _( - # Translators: The message displayed after a countdown for an alarm has been chosen. - "You've chosen an alarm to be triggered in {tm} {unit}" - ).format(tm=self._alarmTimeWaitingText.GetValue(), unit=self._alarmTimerChoice.GetStringSelection()), - # Translators: The title of the dialog which appears when the user has chosen to trigger an alarm. - _("Confirmation"), wx.OK | wx.CANCEL | wx.ICON_INFORMATION, self - ) == wx.OK: + if ( + gui.messageBox( + _( + # Translators: The message displayed after a countdown for an alarm has been chosen. + "You've chosen an alarm to be triggered in {tm} {unit}", + ).format( + tm=self._alarmTimeWaitingText.GetValue(), + unit=self._alarmTimerChoice.GetStringSelection(), + ), + # Translators: The title of the dialog which appears when the user has chosen to trigger an alarm. + _("Confirmation"), + wx.OK | wx.CANCEL | wx.ICON_INFORMATION, + self, + ) + == wx.OK + ): wakeUp = int(self._alarmTimeWaitingText.GetValue()) if self._alarmTimerChoice.GetSelection() == 0: wakeUp *= 3600 if self._alarmTimerChoice.GetSelection() == 1: wakeUp *= 60 - config.conf['clockAndCalendar']['alarmTime'] = wakeUp + config.conf["clockAndCalendar"]["alarmTime"] = wakeUp # We save the configuration, in case the user would not have checked the # "Save configuration on exit" checkbox in General settings. - if not config.conf['general']['saveConfigurationOnExit']: + if not config.conf["general"]["saveConfigurationOnExit"]: config.conf.save() alarmHandler.run = alarmHandler.AlarmTimer( - wakeUp, alarmHandler.runAlarm, - [os.path.join(paths.ALARMS_DIR, self._alarmSoundChoice.GetStringSelection())] + wakeUp, + alarmHandler.runAlarm, + [os.path.join(paths.ALARMS_DIR, self._alarmSoundChoice.GetStringSelection())], ) alarmHandler.run.start() diff --git a/addon/globalPlugins/clock/convertdate/hebrew.py b/addon/globalPlugins/clock/convertdate/hebrew.py index fc99112..6cc379a 100644 --- a/addon/globalPlugins/clock/convertdate/hebrew.py +++ b/addon/globalPlugins/clock/convertdate/hebrew.py @@ -56,7 +56,7 @@ 'טבת', 'שבט', 'אדר', - 'אדר ב' + 'אדר ב', ] diff --git a/addon/globalPlugins/clock/dtfunctions.py b/addon/globalPlugins/clock/dtfunctions.py index edecc9d..d05444a 100644 --- a/addon/globalPlugins/clock/dtfunctions.py +++ b/addon/globalPlugins/clock/dtfunctions.py @@ -45,7 +45,7 @@ def parseTime(t: str, parse24hour: Optional[bool] = False) -> datetime: @returns: The time format converted to datetime.datetime format. @rtype : datetime.datetime. """ - f = '%H:%M' + f = "%H:%M" if parse24hour: res = datetime.strptime(t, f) else: @@ -62,11 +62,11 @@ def strfNowTime(parse24hour: Optional[bool] = False) -> str: @returns : The current time format converted to a string. @rtype: basestring. """ - f = '' + f = "" if parse24hour: - f = '%H:%M' + f = "%H:%M" else: - f = '%I:%M %p' + f = "%I:%M %p" return datetime.now().strftime(f) diff --git a/addon/globalPlugins/clock/formats.py b/addon/globalPlugins/clock/formats.py index 99b40d9..6e5dce9 100644 --- a/addon/globalPlugins/clock/formats.py +++ b/addon/globalPlugins/clock/formats.py @@ -4,13 +4,14 @@ # Copyright 2013-2021, released under GPL. import winKernel +from typing import Callable +import addonHandler import re from datetime import datetime import logging log = logging.getLogger(__name__) -from typing import Callable -import addonHandler + addonHandler.initTranslation() _: Callable[[str], str] # A regular expression to match and facilitate translation for words that are @@ -23,6 +24,7 @@ # are distinguishable. DT_EXAMPLE = datetime(2022, 6, 2, 1, 5, 9) + def repl(match): """ A function that captures and replaces words to make them @@ -59,6 +61,7 @@ def timeMarker(): tm = "am" return tm + def is24HourFormat(fmt): """ A function that indicates if a time format is a 24-hour format. @@ -68,20 +71,24 @@ def is24HourFormat(fmt): @rtype: bool. """ return "$$H" in fmt - + timeFormats = ( # Translators: A time formating (should be different from other time formattings) _("It's {hours} o'clock and {minutes} minutes").format(hours="$$H", minutes="$$m"), # Translators: A time formating (should be different from other time formattings) _("It's {hours} o'clock, {minutes} minutes and {seconds} seconds").format( - hours="$$H", minutes="$$m", seconds="$$s" + hours="$$H", + minutes="$$m", + seconds="$$s", ), # Translators: A time formating (should be different from other time formattings) _("{hours} o'clock, {minutes} minutes").format(hours="$$H", minutes="$$mm"), # Translators: A time formating (should be different from other time formattings) _("{hours} o'clock, {minutes} minutes, {seconds} seconds").format( - hours="$$H", minutes="$$mm", seconds="$$ss" + hours="$$H", + minutes="$$mm", + seconds="$$ss", ), # Translators: A time formating (should be different from other time formattings) _("It's {minutes} past {hours}").format(minutes="$$m", hours="$$H"), @@ -102,17 +109,21 @@ def is24HourFormat(fmt): "$$HH:$$mm", "$$H:$$m:$$s", "$$H:$$mm:$$ss", - "$$H $$mm $$ss", - "$$HH $$mm $$ss", + "$$H $$mm $$ss", + "$$HH $$mm $$ss", "$$H:$$m", ) -timeDisplayFormats = [( - # Translators: A way to display 24-hour formats in the time display formats list in the settings panel. - _('{fmt} (24-hour format)') if is24HourFormat(fmt) else - # Translators: A way to display 12-hour formats in the time display formats list in the settings panel. - _('{fmt} (12-hour format)') -).format(fmt=winKernel.GetTimeFormatEx(None, 0, DT_EXAMPLE, rgx.sub(repl, fmt))) for fmt in timeFormats] +timeDisplayFormats = [ + ( + # Translators: A way to display 24-hour formats in the time display formats list in the settings panel. + _("{fmt} (24-hour format)") + if is24HourFormat(fmt) + # Translators: A way to display 12-hour formats in the time display formats list in the settings panel. + else _("{fmt} (12-hour format)") + ).format(fmt=winKernel.GetTimeFormatEx(None, 0, DT_EXAMPLE, rgx.sub(repl, fmt))) + for fmt in timeFormats +] dateFormats = ( "dddd, MMMM dd, yyyy", @@ -124,42 +135,45 @@ def is24HourFormat(fmt): "dd-MM-yyyy", "MM-dd-yyyy", "MM/dd/yyyy", - "dd/MM/yyyy" + "dd/MM/yyyy", ) + def safeGetTimeFormatEx(locale, flags, timeObj, fmt): - """ - Safe wrapper for winKernel.GetTimeFormatEx. + """ + Safe wrapper for winKernel.GetTimeFormatEx. + + Older NVDA/ctypes versions accepted flags=None and implicitly treated it as 0. + Newer versions of ctypes (NVDA 2024.2+) no longer allow None for DWORD + arguments, causing TypeError. This wrapper ensures full backward and forward + compatibility by normalizing None -> 0. - Older NVDA/ctypes versions accepted flags=None and implicitly treated it as 0. - Newer versions of ctypes (NVDA 2024.2+) no longer allow None for DWORD - arguments, causing TypeError. This wrapper ensures full backward and forward - compatibility by normalizing None -> 0. + No behavioral changes, just safer argument handling. + """ + if flags is None: + flags = 0 + return winKernel.GetTimeFormatEx(locale, flags, timeObj, fmt) - No behavioral changes, just safer argument handling. - """ - if flags is None: - flags = 0 - return winKernel.GetTimeFormatEx(locale, flags, timeObj, fmt) def safeGetDateFormatEx(locale, flags, dateObj, fmt): - """ - Safe wrapper for winKernel.GetDateFormatEx. - - Older NVDA/ctypes versions accepted flags=None and implicitly treated it as 0. - Newer versions of ctypes (NVDA 2024.2+) no longer allow None for DWORD - arguments, causing TypeError. This wrapper ensures full backward and forward - compatibility by normalizing None -> 0. - - No behavioral changes, just safer argument handling. - """ - if flags is None: - flags = 0 - try: - return winKernel.GetDateFormatEx(locale, flags, dateObj, fmt) - except Exception as e: - log.debug(f"Clock: Failed GetDateFormatEx for '{fmt}', falling back. Error: {e}") - return fmt + """ + Safe wrapper for winKernel.GetDateFormatEx. + + Older NVDA/ctypes versions accepted flags=None and implicitly treated it as 0. + Newer versions of ctypes (NVDA 2024.2+) no longer allow None for DWORD + arguments, causing TypeError. This wrapper ensures full backward and forward + compatibility by normalizing None -> 0. + + No behavioral changes, just safer argument handling. + """ + if flags is None: + flags = 0 + try: + return winKernel.GetDateFormatEx(locale, flags, dateObj, fmt) + except Exception as e: + log.debug(f"Clock: Failed GetDateFormatEx for '{fmt}', falling back. Error: {e}") + return fmt + def _buildDateDisplayFormats(): """ @@ -176,5 +190,6 @@ def _buildDateDisplayFormats(): formatted.append(value) return formatted + # Build date display formats safely (NVDA 2024+ compatible). dateDisplayFormats = _buildDateDisplayFormats() diff --git a/addon/globalPlugins/clock/paths.py b/addon/globalPlugins/clock/paths.py index 2447d50..1a4a2d1 100644 --- a/addon/globalPlugins/clock/paths.py +++ b/addon/globalPlugins/clock/paths.py @@ -23,12 +23,13 @@ if not os.path.exists(path): os.makedirs(path) -LIST_SOUNDS = [os.path.split(path)[-1] for path in glob.glob(os.path.join(SOUNDS_DIR, '*.wav'))] -LIST_SOUNDS.extend([os.path.split(path)[-1] for path in glob.glob(os.path.join(CUSTOM_CLOCK_TIME_DIR, '*.wav'))]) +LIST_SOUNDS = [os.path.split(path)[-1] for path in glob.glob(os.path.join(SOUNDS_DIR, "*.wav"))] +LIST_SOUNDS.extend( + [os.path.split(path)[-1] for path in glob.glob(os.path.join(CUSTOM_CLOCK_TIME_DIR, "*.wav"))], +) -LIST_ALARMS = [os.path.split(path)[-1] for path in glob.glob(os.path.join(ALARMS_DIR, '*.wav'))] -LIST_ALARMS.extend([os.path.split(path)[-1] for path in glob.glob(os.path.join(CUSTOM_ALARMS_DIR, '*.wav'))]) +LIST_ALARMS = [os.path.split(path)[-1] for path in glob.glob(os.path.join(ALARMS_DIR, "*.wav"))] +LIST_ALARMS.extend([os.path.split(path)[-1] for path in glob.glob(os.path.join(CUSTOM_ALARMS_DIR, "*.wav"))]) # Translators: This is a choice in a list of sounds. CUSTOM_SOUND = _("Custom") - diff --git a/addon/globalPlugins/clock/pymeeus/Coordinates.py b/addon/globalPlugins/clock/pymeeus/Coordinates.py index 60902f1..5f75e1a 100644 --- a/addon/globalPlugins/clock/pymeeus/Coordinates.py +++ b/addon/globalPlugins/clock/pymeeus/Coordinates.py @@ -20,7 +20,7 @@ from math import ( sqrt, sin, cos, tan, atan, atan2, asin, acos, radians, pi, copysign, - degrees + degrees, ) from pymeeus.base import TOL, iint from pymeeus.Angle import Angle @@ -287,8 +287,12 @@ def mean_obliquity(*args, **kwargs): * ( -249.67 + u - * (-39.05 + u * (7.12 + u - * (27.87 + u * (5.79 + u * 2.45)))) + * ( + -39.05 + u * ( + 7.12 + u + * (27.87 + u * (5.79 + u * 2.45)) + ) + ) ) ) ) @@ -491,7 +495,7 @@ def nutation_obliquity(*args, **kwargs): def precession_equatorial( start_epoch, final_epoch, start_ra, start_dec, p_motion_ra=0.0, - p_motion_dec=0.0 + p_motion_dec=0.0, ): """This function converts the equatorial coordinates (right ascension and declination) given for an epoch and a equinox, to the corresponding @@ -546,8 +550,10 @@ def precession_equatorial( p_motion_ra = Angle(p_motion_ra) if isinstance(p_motion_dec, (int, float)): p_motion_dec = Angle(p_motion_dec) - if not (isinstance(p_motion_ra, Angle) - and isinstance(p_motion_dec, Angle)): + if not ( + isinstance(p_motion_ra, Angle) + and isinstance(p_motion_dec, Angle) + ): raise TypeError("Invalid input types") tt = (start_epoch - JDE2000) / 36525.0 t = (final_epoch - start_epoch) / 36525.0 @@ -574,10 +580,10 @@ def precession_equatorial( theta = Angle(0, 0, theta) a = cos(start_dec.rad()) * sin(start_ra.rad() + zeta.rad()) b = cos(theta.rad()) * cos(start_dec.rad()) * cos( - start_ra.rad() + zeta.rad() + start_ra.rad() + zeta.rad(), ) - sin(theta.rad()) * sin(start_dec.rad()) c = sin(theta.rad()) * cos(start_dec.rad()) * cos( - start_ra.rad() + zeta.rad() + start_ra.rad() + zeta.rad(), ) + cos(theta.rad()) * sin(start_dec.rad()) final_ra = atan2(a, b) + z.rad() if start_dec > 85.0: # Coordinates are close to the pole @@ -592,7 +598,7 @@ def precession_equatorial( def precession_ecliptical( start_epoch, final_epoch, start_lon, start_lat, p_motion_lon=0.0, - p_motion_lat=0.0 + p_motion_lat=0.0, ): """This function converts the ecliptical coordinates (longitude and latitude) given for an epoch and a equinox, to the corresponding @@ -644,8 +650,10 @@ def precession_ecliptical( p_motion_lon = Angle(p_motion_lon) if isinstance(p_motion_lat, (int, float)): p_motion_lat = Angle(p_motion_lat) - if not (isinstance(p_motion_lon, Angle) - and isinstance(p_motion_lat, Angle)): + if not ( + isinstance(p_motion_lon, Angle) + and isinstance(p_motion_lat, Angle) + ): raise TypeError("Invalid input types") tt = (start_epoch - JDE2000) / 36525.0 t = (final_epoch - start_epoch) / 36525.0 @@ -671,12 +679,14 @@ def precession_ecliptical( # But beware!: There is still a missing constant for pie. We didn't add # it before because of the mismatch between degrees and seconds pie += 174.876384 - a = (cos(eta.rad()) * cos(start_lat.rad()) - * sin(pie.rad() - start_lon.rad()) - sin(eta.rad()) - * sin(start_lat.rad())) + a = ( + cos(eta.rad()) * cos(start_lat.rad()) + * sin(pie.rad() - start_lon.rad()) - sin(eta.rad()) + * sin(start_lat.rad()) + ) b = cos(start_lat.rad()) * cos(pie.rad() - start_lon.rad()) c = cos(eta.rad()) * sin(start_lat.rad()) + sin(eta.rad()) * cos( - start_lat.rad() + start_lat.rad(), ) * sin(pie.rad() - start_lon.rad()) final_lon = p.rad() + pie.rad() - atan2(a, b) final_lat = asin(c) @@ -747,7 +757,7 @@ def p_motion_equa2eclip(p_motion_ra, p_motion_dec, ra, dec, lat, epsilon): def precession_newcomb( start_epoch, final_epoch, start_ra, start_dec, p_motion_ra=0.0, - p_motion_dec=0.0 + p_motion_dec=0.0, ): """This function implements the Newcomb precessional equations used in the old FK4 system. It takes equatorial coordinates (right ascension @@ -791,8 +801,10 @@ def precession_newcomb( p_motion_ra = Angle(p_motion_ra) if isinstance(p_motion_dec, (int, float)): p_motion_dec = Angle(p_motion_dec) - if not (isinstance(p_motion_ra, Angle) - and isinstance(p_motion_dec, Angle)): + if not ( + isinstance(p_motion_ra, Angle) + and isinstance(p_motion_dec, Angle) + ): raise TypeError("Invalid input types") tt = (start_epoch - 2415020.3135) / 36524.2199 t = (final_epoch - start_epoch) / 36524.2199 @@ -809,10 +821,10 @@ def precession_newcomb( theta = Angle(0, 0, theta) a = cos(start_dec.rad()) * sin(start_ra.rad() + zeta.rad()) b = cos(theta.rad()) * cos(start_dec.rad()) * cos( - start_ra.rad() + zeta.rad() + start_ra.rad() + zeta.rad(), ) - sin(theta.rad()) * sin(start_dec.rad()) c = sin(theta.rad()) * cos(start_dec.rad()) * cos( - start_ra.rad() + zeta.rad() + start_ra.rad() + zeta.rad(), ) + cos(theta.rad()) * sin(start_dec.rad()) final_ra = atan2(a, b) + z.rad() if start_dec > 85.0: # Coordinates are close to the pole @@ -826,7 +838,7 @@ def precession_newcomb( def motion_in_space( - start_ra, start_dec, distance, velocity, p_motion_ra, p_motion_dec, time + start_ra, start_dec, distance, velocity, p_motion_ra, p_motion_dec, time, ): """This function computes the star's true motion through space relative to the Sun, allowing to compute the start proper motion at a given @@ -885,8 +897,10 @@ def motion_in_space( p_motion_ra = Angle(p_motion_ra) if isinstance(p_motion_dec, (int, float)): p_motion_dec = Angle(p_motion_dec) - if not (isinstance(p_motion_ra, Angle) - and isinstance(p_motion_dec, Angle)): + if not ( + isinstance(p_motion_ra, Angle) + and isinstance(p_motion_dec, Angle) + ): raise TypeError("Invalid input types") if not ( isinstance(distance, (int, float)) @@ -1155,8 +1169,10 @@ def equatorial2galactic(right_ascension, declination): """ # First check that input values are of correct types - if not (isinstance(right_ascension, Angle) - and isinstance(declination, Angle)): + if not ( + isinstance(right_ascension, Angle) + and isinstance(declination, Angle) + ): raise TypeError("Invalid input types") ra = right_ascension.rad() dec = declination.rad() @@ -1372,8 +1388,14 @@ def ecliptic_equator(longitude, latitude, obliquity): lon = longitude.rad() lat = latitude.rad() eps = obliquity.rad() - q = (atan2((cos(lon) * tan(eps)), (sin(lat) - * sin(lon) * tan(eps) - cos(lat)))) + q = ( + atan2( + (cos(lon) * tan(eps)), ( + sin(lat) + * sin(lon) * tan(eps) - cos(lat) + ), + ) + ) q = Angle(q, radians=True) return q @@ -1401,8 +1423,10 @@ def diurnal_path_horizon(declination, geo_latitude): """ # First check that input values are of correct types - if not (isinstance(declination, Angle) - and isinstance(geo_latitude, Angle)): + if not ( + isinstance(declination, Angle) + and isinstance(geo_latitude, Angle) + ): raise TypeError("Invalid input types") dec = declination.rad() lat = geo_latitude.rad() @@ -1584,8 +1608,10 @@ def interpol(n, y1, y2, y3): return (m1 * 24.0, m0 * 24.0, m2 * 24.0) -def refraction_apparent2true(apparent_elevation, pressure=1010.0, - temperature=10.0): +def refraction_apparent2true( + apparent_elevation, pressure=1010.0, + temperature=10.0, +): """This function computes the atmospheric refraction converting from the apparent elevation (i.e., the observed elevation through the air) to the true, 'airless', elevation. @@ -1633,8 +1659,10 @@ def refraction_apparent2true(apparent_elevation, pressure=1010.0, return apparent_elevation - r -def refraction_true2apparent(true_elevation, pressure=1010.0, - temperature=10.0): +def refraction_true2apparent( + true_elevation, pressure=1010.0, + temperature=10.0, +): """This function computes the atmospheric refraction converting from the true, 'airless', elevation (i.e., the one computed from celestial coordinates) to the apparent elevation (the observed elevation through the @@ -1828,8 +1856,12 @@ def minimum_angular_separation( # Let's define some auxiliary functions def k_factor(d1, d_a): """This auxiliary function returns arcseconds, input is in radians""" - return (206264.8062 / (1.0 + sin(d1) * sin(d1) - * tan(d_a) * tan(d_a / 2.0))) + return ( + 206264.8062 / ( + 1.0 + sin(d1) * sin(d1) + * tan(d_a) * tan(d_a / 2.0) + ) + ) def u_factor(k, d1, d_a, d_d): """Input is in radians, except for k (arcseconds)""" @@ -2130,12 +2162,12 @@ def planet_star_conjunction(alpha_list, delta_list, alpha_star, delta_star): delta_star_list = [delta_star for _ in range(n_entries)] # Call the 'planetary_conjunction()' function. It handles everything else return planetary_conjunction( - alpha_list, delta_list, alpha_star_list, delta_star_list + alpha_list, delta_list, alpha_star_list, delta_star_list, ) def planet_stars_in_line( - alpha_list, delta_list, alpha_star1, delta_star1, alpha_star2, delta_star2 + alpha_list, delta_list, alpha_star1, delta_star1, alpha_star2, delta_star2, ): """Given the positions of one planet, this function computes the time when it is in a straight line with two other stars. @@ -2202,8 +2234,10 @@ def straight(alpha1, delta1, alpha2, delta2, alpha3, delta3): d2 = delta2.rad() a3 = alpha3.rad() d3 = delta3.rad() - return (tan(d1) * sin(a2 - a3) + tan(d2) * sin(a3 - a1) - + tan(d3) * sin(a1 - a2)) + return ( + tan(d1) * sin(a2 - a3) + tan(d2) * sin(a3 - a1) + + tan(d3) * sin(a1 - a2) + ) # First check that input values are of correct types if not ( @@ -2336,12 +2370,18 @@ def straight_line(alpha1, delta1, alpha2, delta2, alpha3, delta3): n3 = a1 * b3 - a3 * b1 psi = acos( (l1 * l2 + m1 * m2 + n1 * n2) - / (sqrt(l1 * l1 + m1 * m1 + n1 * n1) - * sqrt(l2 * l2 + m2 * m2 + n2 * n2))) + / ( + sqrt(l1 * l1 + m1 * m1 + n1 * n1) + * sqrt(l2 * l2 + m2 * m2 + n2 * n2) + ), + ) omega = asin( (a2 * l3 + b2 * m3 + c2 * n3) - / (sqrt(a2 * a2 + b2 * b2 + c2 * c2) - * sqrt(l3 * l3 + m3 * m3 + n3 * n3))) + / ( + sqrt(a2 * a2 + b2 * b2 + c2 * c2) + * sqrt(l3 * l3 + m3 * m3 + n3 * n3) + ), + ) return Angle(psi, radians=True), Angle(omega, radians=True) @@ -2416,7 +2456,7 @@ def circle_diameter(alpha1, delta1, alpha2, delta2, alpha3, delta3): d = a else: d = (2.0 * a * b * c) / sqrt( - (a + b + c) * (a + b - c) * (b + c - a) * (a + c - b) + (a + b + c) * (a + b - c) * (b + c - a) * (a + c - b), ) return Angle(d) @@ -2626,8 +2666,10 @@ def apparent_position(epoch, alpha, delta, sun_lon): d = delta.rad() eps = epsilon.rad() # Compute corrections due to nutation - dalpha1 = ((cos(eps) + sin(eps) * sin(a) * tan(d)) * dpsi - - (cos(a) * tan(d)) * depsilon) + dalpha1 = ( + (cos(eps) + sin(eps) * sin(a) * tan(d)) * dpsi + - (cos(a) * tan(d)) * depsilon + ) ddelta1 = (sin(eps) * cos(a)) * dpsi + sin(a) * depsilon dalpha1 = Angle(dalpha1) ddelta1 = Angle(ddelta1) @@ -2638,15 +2680,27 @@ def apparent_position(epoch, alpha, delta, sun_lon): pie = radians(pie) lon = sun_lon.rad() k = 20.49552 # The constant of aberration - dalpha2 = k * (-(cos(a) * cos(lon) * cos(eps) + sin(a) * sin(lon)) / cos(d) - + e * (cos(a) * cos(pie) * cos(eps) - + sin(a) * sin(pie)) / cos(d)) - ddelta2 = k * (-(cos(lon) * cos(eps) - * (tan(eps) * cos(d) - sin(a) * sin(d)) - + cos(a) * sin(d) * sin(lon)) - + e * (cos(pie) * cos(eps) * (tan(eps) * cos(d) - - sin(a) * sin(d)) - + cos(a) * sin(d) * sin(pie))) + dalpha2 = k * ( + -(cos(a) * cos(lon) * cos(eps) + sin(a) * sin(lon)) / cos(d) + + e * ( + cos(a) * cos(pie) * cos(eps) + + sin(a) * sin(pie) + ) / cos(d) + ) + ddelta2 = k * ( + -( + cos(lon) * cos(eps) + * (tan(eps) * cos(d) - sin(a) * sin(d)) + + cos(a) * sin(d) * sin(lon) + ) + + e * ( + cos(pie) * cos(eps) * ( + tan(eps) * cos(d) + - sin(a) * sin(d) + ) + + cos(a) * sin(d) * sin(pie) + ) + ) dalpha2 = Angle(0, 0, dalpha2) ddelta2 = Angle(0, 0, ddelta2) # Add the two corrections to the original values @@ -2736,9 +2790,11 @@ def orbital_equinox2equinox(epoch0, epoch, i0, arg0, lon0): omegapsi = atan2(a, b) omegapsi = Angle(omegapsi, radians=True) lon1 = omegapsi + pie + p - domega = atan2(-sin(etar) * sin(lon0r - pir), - sin(i0r) * cos(etar) - - cos(i0r) * sin(etar) * cos(lon0r - pir)) + domega = atan2( + -sin(etar) * sin(lon0r - pir), + sin(i0r) * cos(etar) + - cos(i0r) * sin(etar) * cos(lon0r - pir), + ) domega = Angle(domega, radians=True) arg1 = arg0 + domega return i1, arg1, lon1 @@ -2855,8 +2911,10 @@ def orbital_elements(epoch, parameters1, parameters2): """ # First check that input values are of correct types - if not (isinstance(epoch, Epoch) and isinstance(parameters1, list) - and isinstance(parameters2, list)): + if not ( + isinstance(epoch, Epoch) and isinstance(parameters1, list) + and isinstance(parameters2, list) + ): raise TypeError("Invalid input types") # Define an auxiliary function @@ -3045,8 +3103,10 @@ def passage_nodes_elliptic(omega, e, a, t, ascending=True): 0.8493 """ - if not (isinstance(omega, Angle) and isinstance(e, float) - and isinstance(a, float) and isinstance(t, Epoch)): + if not ( + isinstance(omega, Angle) and isinstance(e, float) + and isinstance(a, float) and isinstance(t, Epoch) + ): raise TypeError("Invalid input types") # First, get the true anomaly if ascending: @@ -3111,8 +3171,10 @@ def passage_nodes_parabolic(omega, q, t, ascending=True): 1.3901 """ - if not (isinstance(omega, Angle) and isinstance(q, float) - and isinstance(t, Epoch)): + if not ( + isinstance(omega, Angle) and isinstance(q, float) + and isinstance(t, Epoch) + ): raise TypeError("Invalid input types") # First, get the true anomaly if ascending: @@ -3152,11 +3214,15 @@ def phase_angle(sun_dist, earth_dist, sun_earth_dist): 72.96 """ - if not (isinstance(sun_dist, float) and isinstance(earth_dist, float) - and isinstance(sun_earth_dist, float)): + if not ( + isinstance(sun_dist, float) and isinstance(earth_dist, float) + and isinstance(sun_earth_dist, float) + ): raise TypeError("Invalid input types") - angle = acos((sun_dist * sun_dist + earth_dist * earth_dist - - sun_earth_dist * sun_earth_dist) + angle = acos(( + sun_dist * sun_dist + earth_dist * earth_dist + - sun_earth_dist * sun_earth_dist + ) / (2.0 * sun_dist * earth_dist)) angle = Angle(angle, radians=True) return angle @@ -3185,11 +3251,15 @@ def illuminated_fraction(sun_dist, earth_dist, sun_earth_dist): 0.647 """ - if not (isinstance(sun_dist, float) and isinstance(earth_dist, float) - and isinstance(sun_earth_dist, float)): + if not ( + isinstance(sun_dist, float) and isinstance(earth_dist, float) + and isinstance(sun_earth_dist, float) + ): raise TypeError("Invalid input types") - k = ((sun_dist + earth_dist) * (sun_dist + earth_dist) - - sun_earth_dist * sun_earth_dist) / (4.0 * sun_dist * earth_dist) + k = ( + (sun_dist + earth_dist) * (sun_dist + earth_dist) + - sun_earth_dist * sun_earth_dist + ) / (4.0 * sun_dist * earth_dist) return k @@ -3209,7 +3279,7 @@ def print_me(msg, val): e0 = mean_obliquity(1987, 4, 10) print( "The mean angle between Earth rotation axis and ecliptic axis for " - + "1987/4/10 is:" + + "1987/4/10 is:", ) print_me("Mean obliquity", e0.dms_str(n_dec=3)) # 23d 26' 27.407'' epsilon = true_obliquity(1987, 4, 10) @@ -3243,7 +3313,7 @@ def print_me(msg, val): pm_ra = Angle(0, 0, 0.03425, ra=True) pm_dec = Angle(0, 0, -0.0895) alpha, delta = precession_equatorial( - start_epoch, final_epoch, alpha0, delta0, pm_ra, pm_dec + start_epoch, final_epoch, alpha0, delta0, pm_ra, pm_dec, ) print_me("Final right ascension", alpha.ra_str(n_dec=3)) # 2h 46' 11.331'' print_me("Final declination", delta.dms_str(n_dec=2)) # 49d 20' 54.54'' @@ -3358,10 +3428,10 @@ def print_me(msg, val): epsilon = Angle(23.44) lon1, lon2, i = ecliptic_horizon(sidereal_time, lat, epsilon) print_me( - "Longitude of ecliptic point #1 on the horizon", lon1.dms_str(n_dec=1) + "Longitude of ecliptic point #1 on the horizon", lon1.dms_str(n_dec=1), ) # 169d 21' 29.9'' print_me( - "Longitude of ecliptic point #2 on the horizon", lon2.dms_str(n_dec=1) + "Longitude of ecliptic point #2 on the horizon", lon2.dms_str(n_dec=1), ) # 349d 21' 29.9'' print_me("Angle between the ecliptic and the horizon", round(i, 0)) # 62.0 @@ -3528,12 +3598,14 @@ def print_me(msg, val): delta1_list = [delta1_1, delta1_2, delta1_3, delta1_4, delta1_5] alpha2_list = [alpha2_1, alpha2_2, alpha2_3, alpha2_4, alpha2_5] delta2_list = [delta2_1, delta2_2, delta2_3, delta2_4, delta2_5] - pc = planetary_conjunction(alpha1_list, delta1_list, alpha2_list, - delta2_list) + pc = planetary_conjunction( + alpha1_list, delta1_list, alpha2_list, + delta2_list, + ) print_me("Epoch fraction 'n' for planetary conjunction", round(pc[0], 5)) # 0.23797 print_me( - "Difference in declination at conjunction", pc[1].dms_str(n_dec=1) + "Difference in declination at conjunction", pc[1].dms_str(n_dec=1), ) # 2d 8' 21.8'' print("") @@ -3553,12 +3625,18 @@ def print_me(msg, val): delta_star = Angle(-9, 22, 58.47) alpha_list = [alpha_1, alpha_2, alpha_3, alpha_4, alpha_5] delta_list = [delta_1, delta_2, delta_3, delta_4, delta_5] - pc = planet_star_conjunction(alpha_list, delta_list, alpha_star, - delta_star) - print_me("Epoch fraction 'n' for planetary conjunction with star", - round(pc[0], 4)) # 0.2551 - print_me("Difference in declination with star at conjunction", - pc[1].dms_str(n_dec=0)) # 3' 38.0'' + pc = planet_star_conjunction( + alpha_list, delta_list, alpha_star, + delta_star, + ) + print_me( + "Epoch fraction 'n' for planetary conjunction with star", + round(pc[0], 4), + ) # 0.2551 + print_me( + "Difference in declination with star at conjunction", + pc[1].dms_str(n_dec=0), + ) # 3' 38.0'' print("") @@ -3580,10 +3658,14 @@ def print_me(msg, val): delta_star2 = Angle(28, 2, 12.5) alpha_list = [alpha_1, alpha_2, alpha_3, alpha_4, alpha_5] delta_list = [delta_1, delta_2, delta_3, delta_4, delta_5] - n = planet_stars_in_line(alpha_list, delta_list, alpha_star1, delta_star1, - alpha_star2, delta_star2) - print_me("Epoch fraction 'n' when bodies are in a straight line", - round(n, 4)) # 0.2233 + n = planet_stars_in_line( + alpha_list, delta_list, alpha_star1, delta_star1, + alpha_star2, delta_star2, + ) + print_me( + "Epoch fraction 'n' when bodies are in a straight line", + round(n, 4), + ) # 0.2233 print("") @@ -3598,8 +3680,10 @@ def print_me(msg, val): psi, omega = straight_line(alpha1, delta1, alpha2, delta2, alpha3, delta3) print_me("Angle deviation from a straight line", psi.dms_str(n_dec=0)) # 7d 31' 1.0'' - print_me("Angular distance of central point to the straight line", - omega.dms_str(n_dec=0)) # -5' 24.0'' + print_me( + "Angular distance of central point to the straight line", + omega.dms_str(n_dec=0), + ) # -5' 24.0'' print("") diff --git a/addon/globalPlugins/clock/pymeeus/CurveFitting.py b/addon/globalPlugins/clock/pymeeus/CurveFitting.py index 3a42675..7d4ff7d 100644 --- a/addon/globalPlugins/clock/pymeeus/CurveFitting.py +++ b/addon/globalPlugins/clock/pymeeus/CurveFitting.py @@ -188,12 +188,12 @@ def set(self, *args): raise TypeError("Invalid input value") elif len(args) == 2: if isinstance(args[0], (int, float, Angle)) or isinstance( - args[1], (int, float, Angle) + args[1], (int, float, Angle), ): # Insuficient data for curve fitting. Raise ValueError raise ValueError("Invalid number of input values") elif isinstance(args[0], (list, tuple)) and isinstance( - args[1], (list, tuple) + args[1], (list, tuple), ): x = args[0] y = args[1] @@ -220,8 +220,10 @@ def set(self, *args): # Check that all the arguments are ints, floats or Angles all_numbers = True for arg in args: - all_numbers = (all_numbers - and isinstance(arg, (int, float, Angle))) + all_numbers = ( + all_numbers + and isinstance(arg, (int, float, Angle)) + ) # If any of the values failed the test, raise an exception if not all_numbers: raise TypeError("Invalid input value") @@ -327,8 +329,10 @@ def correlation_coeff(self): sy = self._T sx2 = self._Q sy2 = self._W - return ((n * sxy - sx * sy) / (sqrt(n * sx2 - sx * sx) - * sqrt(n * sy2 - sy * sy))) + return ((n * sxy - sx * sy) / ( + sqrt(n * sx2 - sx * sx) + * sqrt(n * sy2 - sy * sy) + )) def linear_fitting(self): """This method returns a tuple with the 'a', 'b' coefficients of the @@ -398,12 +402,18 @@ def quadratic_fitting(self): if abs(d) < TOL: raise ZeroDivisionError("Input data leads to a division by zero") - a = (n * q * v + p * r * t + p * q * u - - q2 * t - p * p * v - n * r * u) / d - b = (n * s * u + p * q * v + q * r * t - - q2 * u - p * s * t - n * r * v) / d - c = (q * s * t + q * r * u + p * r * v - - q2 * v - p * s * u - r * r * t) / d + a = ( + n * q * v + p * r * t + p * q * u + - q2 * t - p * p * v - n * r * u + ) / d + b = ( + n * s * u + p * q * v + q * r * t + - q2 * u - p * s * t - n * r * v + ) / d + c = ( + q * s * t + q * r * u + p * r * v + - q2 * v - p * s * u - r * r * t + ) / d return (a, b, c) def general_fitting(self, f0, f1=lambda *args: 0.0, f2=lambda *args: 0.0): @@ -474,12 +484,18 @@ def general_fitting(self, f0, f1=lambda *args: 0.0, f2=lambda *args: 0.0): if abs(d) < TOL: raise ZeroDivisionError("Input data leads to a division by zero") - a = (u * (r * t - s * s) + v * (q * s - p * t) - + w * (p * s - q * r)) / d - b = (u * (s * q - p * t) + v * (m * t - q * q) - + w * (p * q - m * s)) / d - c = (u * (p * s - r * q) + v * (p * q - m * s) - + w * (m * r - p * p)) / d + a = ( + u * (r * t - s * s) + v * (q * s - p * t) + + w * (p * s - q * r) + ) / d + b = ( + u * (s * q - p * t) + v * (m * t - q * q) + + w * (p * q - m * s) + ) / d + c = ( + u * (p * s - r * q) + v * (p * q - m * s) + + w * (m * r - p * p) + ) / d return (a, b, c) @@ -596,8 +612,12 @@ def print_me(msg, val): a, b, c = cf2.quadratic_fitting() # Original curve: y = -2.0*x*x + 3.5*x + 7.0 + noise print("Quadratic fitting:") - print(" a = {}\tb = {}\tc = {}".format(round(a, 2), round(b, 2), - round(c, 2))) + print( + " a = {}\tb = {}\tc = {}".format( + round(a, 2), round(b, 2), + round(c, 2), + ), + ) print("") @@ -661,8 +681,12 @@ def sin3(x): # Use 'general_fitting()' here a, b, c = cf4.general_fitting(sin1, sin2, sin3) print("General fitting with f0 = sin(x), f1 = sin(2*x), f2 = sin(3*x):") - print(" a = {}\tb = {}\tc = {}".format(round(a, 2), round(b, 2), - round(c, 2))) + print( + " a = {}\tb = {}\tc = {}".format( + round(a, 2), round(b, 2), + round(c, 2), + ), + ) print("") @@ -670,8 +694,12 @@ def sin3(x): a, b, c = cf5.general_fitting(sqrt) print("General fitting with f0 = sqrt(x), f1 = 0.0 and f2 = 0.0:") - print(" a = {}\tb = {}\t\tc = {}".format(round(a, 3), round(b, 3), - round(c, 3))) + print( + " a = {}\tb = {}\t\tc = {}".format( + round(a, 3), round(b, 3), + round(c, 3), + ), + ) if __name__ == "__main__": diff --git a/addon/globalPlugins/clock/pymeeus/Earth.py b/addon/globalPlugins/clock/pymeeus/Earth.py index 8a0f784..9481527 100644 --- a/addon/globalPlugins/clock/pymeeus/Earth.py +++ b/addon/globalPlugins/clock/pymeeus/Earth.py @@ -25,7 +25,7 @@ from pymeeus.Interpolation import Interpolation from pymeeus.Coordinates import ( geometric_vsop_pos, apparent_vsop_pos, orbital_elements, - passage_nodes_elliptic + passage_nodes_elliptic, ) """ @@ -2724,7 +2724,7 @@ [0.01670863, -0.000042037, -0.0000001267, 0.00000000014], # e [0.0, 0.0, 0.0, 0.0], # i [174.873176, -0.2410908, 0.00004262, 0.000000001], # Omega - [102.937348, 1.7195366, 0.00045688, -0.000000018] # pie + [102.937348, 1.7195366, 0.00045688, -0.000000018], # pie ] """This table contains the parameters to compute Earth's orbital elements for the mean equinox of date. Based in Table 31.A, page 212""" @@ -2734,7 +2734,7 @@ [100.466457, 35999.3728565, -0.00000568, -0.000000001], # L [0.0, 0.0130548, -0.00000931, -0.000000034], # i [174.873176, -0.2410908, 0.00004262, 0.000000001], # Omega - [102.937348, 0.3225654, 0.00014799, -0.000000039] # pie + [102.937348, 0.3225654, 0.00014799, -0.000000039], # pie ] """This table contains the parameters to compute Earth's orbital elements for the standard equinox J2000.0. Based on Table 31.B, page 214""" @@ -2789,7 +2789,7 @@ def __repr__(self): """ return "{}({}, {}, {})".format( - self.__class__.__name__, self._a, self._f, self._omega + self.__class__.__name__, self._a, self._f, self._omega, ) def b(self): @@ -2909,7 +2909,7 @@ def __repr__(self): return "{}(ellipsoid=Ellipsoid({}, {}, {}))".format( self.__class__.__name__, self._ellip._a, self._ellip._f, - self._ellip._omega + self._ellip._omega, ) def rho(self, latitude): @@ -2937,8 +2937,10 @@ def rho(self, latitude): phi = radians(latitude) # Convert to radians else: phi = latitude.rad() # It is an Angle. Call method rad() - return (0.9983271 + 0.0016764 * cos(2.0 * phi) - - 0.0000035 * cos(4.0 * phi)) + return ( + 0.9983271 + 0.0016764 * cos(2.0 * phi) + - 0.0000035 * cos(4.0 * phi) + ) def rho_sinphi(self, latitude, height): """Method to compute the rho*sin(phi') term, needed in the calculation @@ -3253,7 +3255,7 @@ def geometric_heliocentric_position_j2000(epoch, tofk5=True): """ return geometric_vsop_pos( - epoch, VSOP87_L_J2000, VSOP87_B_J2000, VSOP87_R, tofk5 + epoch, VSOP87_L_J2000, VSOP87_B_J2000, VSOP87_R, tofk5, ) @staticmethod @@ -3411,13 +3413,17 @@ def perihelion_aphelion(epoch, perihelion=True): a4 = Angle(136.95 + 659.306737 * k) a5 = Angle(249.52 + 329.653368 * k) if perihelion: - corr = (1.278 * sin(a1.rad()) - 0.055 * sin(a2.rad()) - - 0.091 * sin(a3.rad()) - 0.056 * sin(a4.rad()) - - 0.045 * sin(a5.rad())) + corr = ( + 1.278 * sin(a1.rad()) - 0.055 * sin(a2.rad()) + - 0.091 * sin(a3.rad()) - 0.056 * sin(a4.rad()) + - 0.045 * sin(a5.rad()) + ) else: - corr = (-1.352 * sin(a1.rad()) + 0.061 * sin(a2.rad()) - + 0.062 * sin(a3.rad()) + 0.029 * sin(a4.rad()) - + 0.031 * sin(a5.rad())) + corr = ( + -1.352 * sin(a1.rad()) + 0.061 * sin(a2.rad()) + + 0.062 * sin(a3.rad()) + 0.029 * sin(a4.rad()) + + 0.031 * sin(a5.rad()) + ) jde += corr # Compute the epochs half a day before and after jde_before = jde - 0.5 @@ -3472,8 +3478,10 @@ def passage_nodes(epoch, ascending=True): return time, r @staticmethod - def parallax_correction(right_ascension, declination, latitude, distance, - hour_angle, height=0.0): + def parallax_correction( + right_ascension, declination, latitude, distance, + hour_angle, height=0.0, + ): """This function computes the parallaxes in right ascension and declination in order to obtain the topocentric values. @@ -3514,12 +3522,14 @@ def parallax_correction(right_ascension, declination, latitude, distance, -15d 46' 30.0'' """ - if not (isinstance(right_ascension, Angle) - and isinstance(declination, Angle) - and isinstance(latitude, Angle) - and isinstance(distance, float) - and isinstance(hour_angle, Angle) - and isinstance(height, float)): + if not ( + isinstance(right_ascension, Angle) + and isinstance(declination, Angle) + and isinstance(latitude, Angle) + and isinstance(distance, float) + and isinstance(hour_angle, Angle) + and isinstance(height, float) + ): raise TypeError("Invalid input types") # Let's start computing the equatorial horizontal parallax ang = Angle(0, 0, 8.794) @@ -3529,21 +3539,27 @@ def parallax_correction(right_ascension, declination, latitude, distance, rho_sinphi = e.rho_sinphi(latitude, height) rho_cosphi = e.rho_cosphi(latitude, height) # Now, let's compute the correction for the right ascension - delta_a = atan2(-rho_cosphi * sin_pi * sin(hour_angle.rad()), - cos(declination.rad()) - rho_cosphi * sin_pi - * cos(hour_angle.rad())) + delta_a = atan2( + -rho_cosphi * sin_pi * sin(hour_angle.rad()), + cos(declination.rad()) - rho_cosphi * sin_pi + * cos(hour_angle.rad()), + ) delta_a = Angle(delta_a, radians=True) # And finally, the declination already corrected - dec = atan2((sin(declination.rad()) - rho_sinphi * sin_pi) - * cos(delta_a.rad()), - cos(declination.rad()) - rho_cosphi * sin_pi - * cos(hour_angle.rad())) + dec = atan2( + (sin(declination.rad()) - rho_sinphi * sin_pi) + * cos(delta_a.rad()), + cos(declination.rad()) - rho_cosphi * sin_pi + * cos(hour_angle.rad()), + ) dec = Angle(dec, radians=True) return (right_ascension + delta_a), dec @staticmethod - def parallax_ecliptical(longitude, latitude, semidiameter, obs_lat, - obliquity, sidereal_time, distance, height=0.0): + def parallax_ecliptical( + longitude, latitude, semidiameter, obs_lat, + obliquity, sidereal_time, distance, height=0.0, + ): """This function computes the topocentric coordinates of a celestial body (Moon or planet) directly from its geocentric values in ecliptical coordinates. @@ -3591,14 +3607,16 @@ def parallax_ecliptical(longitude, latitude, semidiameter, obs_lat, 16' 25.5'' """ - if not (isinstance(longitude, Angle) - and isinstance(latitude, Angle) - and isinstance(semidiameter, Angle) - and isinstance(obs_lat, Angle) - and isinstance(obliquity, Angle) - and isinstance(sidereal_time, Angle) - and isinstance(distance, float) - and isinstance(height, float)): + if not ( + isinstance(longitude, Angle) + and isinstance(latitude, Angle) + and isinstance(semidiameter, Angle) + and isinstance(obs_lat, Angle) + and isinstance(obliquity, Angle) + and isinstance(sidereal_time, Angle) + and isinstance(distance, float) + and isinstance(height, float) + ): raise TypeError("Invalid input types") # Let's start computing the equatorial horizontal parallax ang = Angle(0, 0, 8.794) @@ -3615,16 +3633,26 @@ def parallax_ecliptical(longitude, latitude, semidiameter, obs_lat, oblr = obliquity.rad() n = cos(lonr) * cos(latr) - rho_cosphi * sin_pi * cos(sidr) # Now, compute the topocentric longitude - topo_lon = atan2(sin(lonr) * cos(latr) - - sin_pi * (rho_sinphi * sin(oblr) - + rho_cosphi * cos(oblr) * sin(sidr)), n) + topo_lon = atan2( + sin(lonr) * cos(latr) + - sin_pi * ( + rho_sinphi * sin(oblr) + + rho_cosphi * cos(oblr) * sin(sidr) + ), n, + ) topo_lon = Angle(topo_lon, radians=True).to_positive() tlonr = topo_lon.rad() # Compute the topocentric latitude - topo_lat = atan2(cos(tlonr) * (sin(latr) - - sin_pi * (rho_sinphi * cos(oblr) - - rho_cosphi * sin(oblr) - * sin(sidr))), n) + topo_lat = atan2( + cos(tlonr) * ( + sin(latr) + - sin_pi * ( + rho_sinphi * cos(oblr) + - rho_cosphi * sin(oblr) + * sin(sidr) + ) + ), n, + ) topo_lat = Angle(topo_lat, radians=True).to_positive() # Watch out: Latitude is only valid in the +/-90 deg range if abs(topo_lat) > 90.0: @@ -3677,8 +3705,10 @@ def print_me(msg, val): # level, and at a certain latitude. It is given as a fraction of equatorial # radius lat = Angle(65, 45, 30.0) # We can use an Angle for this - print_me("Relative distance to Earth's center, from latitude 65d 45' 30''", - e.rho(lat)) + print_me( + "Relative distance to Earth's center, from latitude 65d 45' 30''", + e.rho(lat), + ) print("") @@ -3727,10 +3757,14 @@ def print_me(msg, val): lon_bai = Angle(58, 22, 54.0) lat_bai = Angle(-34, 36, 12.0) dist, error = e.distance(lon_ban, lat_ban, lon_bai, lat_bai) - print_me("The distance between Bangkok and Buenos Aires is (km)", - round(dist / 1000.0, 2)) - print_me("The approximate error of the estimation is (meters)", - round(error, 0)) + print_me( + "The distance between Bangkok and Buenos Aires is (km)", + round(dist / 1000.0, 2), + ) + print_me( + "The approximate error of the estimation is (meters)", + round(error, 0), + ) print("") @@ -3790,8 +3824,10 @@ def print_me(msg, val): latitude = Angle(33, 21, 22) distance = 0.37276 hour_angle = Angle(288.7958) - top_ra, top_dec = Earth.parallax_correction(right_ascension, declination, - latitude, distance, hour_angle) + top_ra, top_dec = Earth.parallax_correction( + right_ascension, declination, + latitude, distance, hour_angle, + ) print_me("Corrected topocentric right ascension: ", top_ra.ra_str(n_dec=2)) # 22h 38' 8.54'' print_me("Corrected topocentric declination", top_dec.dms_str(n_dec=1)) @@ -3808,8 +3844,10 @@ def print_me(msg, val): sidereal_time = Angle(209, 46, 7.9) distance = 0.0024650163 topo_lon, topo_lat, topo_diam = \ - Earth.parallax_ecliptical(longitude, latitude, semidiameter, obs_lat, - obliquity, sidereal_time, distance) + Earth.parallax_ecliptical( + longitude, latitude, semidiameter, obs_lat, + obliquity, sidereal_time, distance, + ) print_me("Corrected topocentric longitude", topo_lon.dms_str(n_dec=1)) # 181d 48' 5.0'' print_me("Corrected topocentric latitude", topo_lat.dms_str(n_dec=1)) diff --git a/addon/globalPlugins/clock/pymeeus/Epoch.py b/addon/globalPlugins/clock/pymeeus/Epoch.py index 4ba59ca..45dd5e4 100644 --- a/addon/globalPlugins/clock/pymeeus/Epoch.py +++ b/addon/globalPlugins/clock/pymeeus/Epoch.py @@ -345,7 +345,7 @@ def set(self, *args, **kwargs): elif isinstance(args[0], datetime.date): d = args[0] year, month, day, hours, minutes, sec = self._check_values( - d.year, d.month, d.day + d.year, d.month, d.day, ) else: raise TypeError("Invalid input type") @@ -361,22 +361,30 @@ def set(self, *args, **kwargs): self._jde = self._compute_jde( year, month, day, utc2tt=False, leap_seconds=kwargs["leap_seconds"], - local=kwargs["local"]) + local=kwargs["local"], + ) else: self._jde = self._compute_jde( year, month, day, utc2tt=False, - leap_seconds=kwargs["leap_seconds"]) + leap_seconds=kwargs["leap_seconds"], + ) elif "utc" in kwargs: - self._jde = self._compute_jde(year, month, day, - utc2tt=kwargs["utc"]) + self._jde = self._compute_jde( + year, month, day, + utc2tt=kwargs["utc"], + ) elif "local" in kwargs: - self._jde = self._compute_jde(year, month, day, - local=kwargs["local"]) + self._jde = self._compute_jde( + year, month, day, + local=kwargs["local"], + ) else: self._jde = self._compute_jde(year, month, day, utc2tt=False) - def _compute_jde(self, y, m, d, utc2tt=False, leap_seconds=0.0, - local=False): + def _compute_jde( + self, y, m, d, utc2tt=False, leap_seconds=0.0, + local=False, + ): """Method to compute the Julian Ephemeris Day (JDE). .. note:: The UTC to TT correction is only carried out for dates after @@ -407,8 +415,10 @@ def _compute_jde(self, y, m, d, utc2tt=False, leap_seconds=0.0, b = 0.0 if not Epoch.is_julian(y, m, iint(d)): b = 2.0 - a + iint(a / 4.0) - jde = (iint(365.25 * (y + 4716.0)) - + iint(30.6001 * (m + 1.0)) + d + b - 1524.5) + jde = ( + iint(365.25 * (y + 4716.0)) + + iint(30.6001 * (m + 1.0)) + d + b - 1524.5 + ) # If enabled, let's convert from UTC to TT, adding the needed seconds deltasec = 0.0 if local: @@ -536,7 +546,7 @@ def check_input_date(*args, **kwargs): else: raise ValueError("Invalid input") elif isinstance(args[0], datetime.datetime) or isinstance( - args[0], datetime.date + args[0], datetime.date, ): t = Epoch(args[0].year, args[0].month, args[0].day, **kwargs) else: @@ -787,8 +797,10 @@ def get_doy(yyyy, mm, dd): doy = d.timetuple().tm_yday else: k = 2 if Epoch.is_leap(yyyy) else 1 - doy = (iint((275.0 * mm) / 9.0) - - k * iint((mm + 9.0) / 12.0) + day - 30.0) + doy = ( + iint((275.0 * mm) / 9.0) + - k * iint((mm + 9.0) / 12.0) + day - 30.0 + ) return float(doy + frac) def doy(self): @@ -880,8 +892,10 @@ def doy2date(year, doy): m = 1 else: m = iint((9.0 * (k + doy)) / 275.0 + 0.98) - d = (doy - iint((275.0 * m) / 9.0) - + k * iint((m + 9.0) / 12.0) + 30) + d = ( + doy - iint((275.0 * m) / 9.0) + + k * iint((m + 9.0) / 12.0) + 30 + ) return year, int(m), d + frac else: raise ValueError("Invalid input values") @@ -987,8 +1001,10 @@ def utc2local(): utchour = datetime.datetime.utcnow().hour localminute = datetime.datetime.now().minute utcminute = datetime.datetime.utcnow().minute - return ((localhour - utchour) * 3600.0 - + (localminute - utcminute) * 60.0) + return ( + (localhour - utchour) * 3600.0 + + (localminute - utcminute) * 60.0 + ) @staticmethod def easter(year): @@ -1076,8 +1092,10 @@ def jewish_pesach(year): s = 0 if year < 1583 else iint((3.0 * c - 5.0) / 4.0) a = (12 * (year + 1)) % 19 b = year % 4 - q = (-1.904412361576 + 1.554241796621 * a - + 0.25 * b - 0.003177794022 * year + s) + q = ( + -1.904412361576 + 1.554241796621 * a + + 0.25 * b - 0.003177794022 * year + s + ) j = (iint(q) + 3 * year + 5 * b + 2 + s) % 7 r = q - iint(q) if j == 2 or j == 4 or j == 6: @@ -1506,8 +1524,12 @@ def tt2ut(year, month): + u * ( -5.952053 - + (u * (-0.1798452 - + u * (0.022174192 + 0.0090316521 * u))) + + ( + u * ( + -0.1798452 + + u * (0.022174192 + 0.0090316521 * u) + ) + ) ) ) ) @@ -1521,8 +1543,12 @@ def tt2ut(year, month): + u * ( 0.319781 - + (u * (-0.8503463 - + u * (-0.005050998 + 0.0083572073 * u))) + + ( + u * ( + -0.8503463 + + u * (-0.005050998 + 0.0083572073 * u) + ) + ) ) ) ) @@ -1548,8 +1574,12 @@ def tt2ut(year, month): * ( -0.00037436 + t - * (0.0000121272 + t * (-0.0000001699 - + 0.000000000875 * t)) + * ( + 0.0000121272 + t * ( + -0.0000001699 + + 0.000000000875 * t + ) + ) ) ) ) @@ -1559,8 +1589,12 @@ def tt2ut(year, month): dt = 7.62 + t * ( 0.5737 + t - * (-0.251754 + t * (0.01680668 - + t * (-0.0004473624 + t / 233174.0))) + * ( + -0.251754 + t * ( + 0.01680668 + + t * (-0.0004473624 + t / 233174.0) + ) + ) ) elif year >= 1900 and year < 1920: t = y - 1900.0 @@ -1581,15 +1615,21 @@ def tt2ut(year, month): dt = 63.86 + t * ( 0.3345 + t - * (-0.060374 + t * (0.0017275 - + t * (0.000651814 + 0.00002373599 * t))) + * ( + -0.060374 + t * ( + 0.0017275 + + t * (0.000651814 + 0.00002373599 * t) + ) + ) ) elif year >= 2005 and year < 2050: t = y - 2000.0 dt = 62.92 + t * (0.32217 + 0.005589 * t) elif year >= 2050 and year < 2150: - dt = (-20.0 + 32.0 * ((y - 1820.0) / 100.0) ** 2 - - 0.5628 * (2150.0 - y)) + dt = ( + -20.0 + 32.0 * ((y - 1820.0) / 100.0) ** 2 + - 0.5628 * (2150.0 - y) + ) else: u = (year - 1820.0) / 100.0 dt = -20.0 + 32.0 * u * u @@ -1814,8 +1854,10 @@ def rise_set(self, latitude, longitude, altitude=0.0): 17:48 """ - if not (isinstance(latitude, Angle) and isinstance(longitude, Angle) - and isinstance(altitude, (int, float))): + if not ( + isinstance(latitude, Angle) and isinstance(longitude, Angle) + and isinstance(altitude, (int, float)) + ): raise TypeError("Invalid input types") # Check that latitude is within valid range limit = Angle(66, 33, 0) @@ -2214,8 +2256,10 @@ def print_me(msg, val): print("") # There is an internal table which we can use to get the leap seconds - print_me("Number of leap seconds applied up to July 1983", - Epoch.leap_seconds(1983, 7)) + print_me( + "Number of leap seconds applied up to July 1983", + Epoch.leap_seconds(1983, 7), + ) print("") @@ -2271,7 +2315,7 @@ def print_me(msg, val): print( "When correcting for nutation-related effects, we get the " - + "'apparent' sidereal time:" + + "'apparent' sidereal time:", ) e = Epoch(1987, 4, 10) print("e = Epoch(1987, 4, 10)") @@ -2314,8 +2358,10 @@ def print_me(msg, val): # Now, convert a date in the Moslem calendar to the Gregorian calendar y, m, d = Epoch.moslem2gregorian(1421, 1, 1) - print_me("The date 1421/1/1 in the Moslem calendar is, in Gregorian " - + "calendar", "{}/{}/{}".format(y, m, d)) + print_me( + "The date 1421/1/1 in the Moslem calendar is, in Gregorian " + + "calendar", "{}/{}/{}".format(y, m, d), + ) y, m, d = Epoch.moslem2gregorian(1439, 9, 1) print_me( "The start of Ramadan month (9/1) for Gregorian year 2018 is", @@ -2342,8 +2388,10 @@ def print_me(msg, val): # Subtract two Epochs to find the number of days between them a = Epoch(1986, 2, 9.0) b = Epoch(1910, 4, 20.0) - print_me("The number of days between 1986/2/9 and 1910/4/20 is", - round(a - b, 2)) + print_me( + "The number of days between 1986/2/9 and 1910/4/20 is", + round(a - b, 2), + ) # We can also subtract a given amount of days from an Epoch a = Epoch(2003, 12, 31.0) diff --git a/addon/globalPlugins/clock/pymeeus/Interpolation.py b/addon/globalPlugins/clock/pymeeus/Interpolation.py index e436852..0826b37 100644 --- a/addon/globalPlugins/clock/pymeeus/Interpolation.py +++ b/addon/globalPlugins/clock/pymeeus/Interpolation.py @@ -231,12 +231,12 @@ def set(self, *args): raise TypeError("Invalid input value") elif len(args) == 2: if isinstance(args[0], (int, float, Angle)) or isinstance( - args[1], (int, float, Angle) + args[1], (int, float, Angle), ): # Insuficient data to interpolate. Raise ValueError exception raise ValueError("Invalid number of input values") elif isinstance(args[0], (list, tuple)) and isinstance( - args[1], (list, tuple) + args[1], (list, tuple), ): x = args[0] y = args[1] @@ -263,8 +263,10 @@ def set(self, *args): # Check that all the arguments are ints, floats or Angles all_numbers = True for arg in args: - all_numbers = (all_numbers - and isinstance(arg, (int, float, Angle))) + all_numbers = ( + all_numbers + and isinstance(arg, (int, float, Angle)) + ) # If any of the values failed the test, raise an exception if not all_numbers: raise TypeError("Invalid input value") @@ -374,8 +376,10 @@ def _newton_diff(self, start, end): val = self._y[start] else: x = list(self._x) # Let's make a copy, just in case - val = (self._newton_diff(start, end - 1) - - self._newton_diff(start + 1, end)) / (x[start] - x[end]) + val = ( + self._newton_diff(start, end - 1) + - self._newton_diff(start + 1, end) + ) / (x[start] - x[end]) return val @@ -506,8 +510,10 @@ def root(self, xl=0, xh=0, max_iter=1000): xmin = self._x[0] xmax = self._x[-1] # Check if input value is of correct type - if (isinstance(xl, (int, float, Angle)) - and isinstance(xh, (int, float, Angle))): + if ( + isinstance(xl, (int, float, Angle)) + and isinstance(xh, (int, float, Angle)) + ): # Check if BOTH values are zero if xl == 0 and xh == 0: xl = xmin @@ -541,7 +547,7 @@ def root(self, xl=0, xh=0, max_iter=1000): if num_iter >= max_iter: raise ValueError( "Too many iterations: Probably no root\ - exists" + exists", ) num_iter += 1 yp = self.derivative(x) @@ -686,7 +692,7 @@ def print_me(msg, val): "k = Interpolation([27.0, 27.5, 28.0, 28.5, 29.0],\n\ [Angle(0, 54, 36.125), Angle(0, 54, 24.606),\n\ Angle(0, 54, 15.486), Angle(0, 54, 8.694),\n\ - Angle(0, 54, 4.133)])" + Angle(0, 54, 4.133)])", ) print_me("k(28.278)", Angle(k(28.278)).dms_str()) diff --git a/addon/globalPlugins/clock/pymeeus/Jupiter.py b/addon/globalPlugins/clock/pymeeus/Jupiter.py index eea80fb..55ce3b1 100644 --- a/addon/globalPlugins/clock/pymeeus/Jupiter.py +++ b/addon/globalPlugins/clock/pymeeus/Jupiter.py @@ -26,7 +26,7 @@ from pymeeus.Coordinates import ( geometric_vsop_pos, apparent_vsop_pos, orbital_elements, nutation_longitude, true_obliquity, ecliptical2equatorial, - passage_nodes_elliptic + passage_nodes_elliptic, ) from pymeeus.Earth import Earth from pymeeus.Sun import Sun @@ -3608,7 +3608,7 @@ [0.04849793, 0.000163225, -0.0000004714, -0.00000000201], # e [1.303267, -0.0054965, 0.00000466, -0.000000002], # i [100.464407, 1.0209774, 0.00040315, 0.000000404], # Omega - [14.331207, 1.6126352, 0.00103042, -0.000004464] # pie + [14.331207, 1.6126352, 0.00103042, -0.000004464], # pie ] """This table contains the parameters to compute Jupiter's orbital elements for the mean equinox of date. Based in Table 31.A, page 213""" @@ -3618,7 +3618,7 @@ [34.351519, 3034.9056606, -0.00008501, 0.000000016], # L [1.303267, -0.0019877, 0.0000332, 0.000000097], # i [100.464407, 0.1767232, 0.000907, -0.000007272], # Omega - [14.331207, 0.2155209, 0.00072211, -0.000004485] # pie + [14.331207, 0.2155209, 0.00072211, -0.000004485], # pie ] """This table contains the parameters to compute Jupiter's orbital elements for the standard equinox J2000.0. Based on Table 31.B, page 215""" @@ -3887,15 +3887,17 @@ def conjunction(epoch): # Compute an auxiliary angle aa = 82.74 + 40.76 * t aa = Angle(aa).rad() # Convert to radians - corr = (0.1027 + t * (0.0002 - t * 0.00009) - + sin(m) * (-2.2637 + t * (0.0163 - t * 0.00003)) - + cos(m) * (-6.154 + t * (-0.021 + t * 0.00008)) - + sin(2.0 * m) * (-0.2021 + t * (-0.0017 + t * 0.00001)) - + cos(2.0 * m) * (0.131 - t * 0.0008) - + sin(3.0 * m) * (0.0086) - + cos(3.0 * m) * (0.0087 + t * 0.0002) - + sin(aa) * (0.0 + t * (0.0144 - t * 0.00008)) - + cos(aa) * (0.3642 + t * (-0.0019 - t * 0.00029))) + corr = ( + 0.1027 + t * (0.0002 - t * 0.00009) + + sin(m) * (-2.2637 + t * (0.0163 - t * 0.00003)) + + cos(m) * (-6.154 + t * (-0.021 + t * 0.00008)) + + sin(2.0 * m) * (-0.2021 + t * (-0.0017 + t * 0.00001)) + + cos(2.0 * m) * (0.131 - t * 0.0008) + + sin(3.0 * m) * (0.0086) + + cos(3.0 * m) * (0.0087 + t * 0.0002) + + sin(aa) * (0.0 + t * (0.0144 - t * 0.00008)) + + cos(aa) * (0.3642 + t * (-0.0019 - t * 0.00029)) + ) to_return = jde0 + corr return Epoch(to_return) @@ -3944,15 +3946,17 @@ def opposition(epoch): # Compute an auxiliary angle aa = 82.74 + 40.76 * t aa = Angle(aa).rad() # Convert to radians - corr = (-0.1029 - t * t * 0.00009 - + sin(m) * (-1.9658 + t * (-0.0056 + t * 0.00007)) - + cos(m) * (6.1537 + t * (0.021 - t * 0.00006)) - + sin(2.0 * m) * (-0.2081 - t * 0.0013) - + cos(2.0 * m) * (-0.1116 - t * 0.001) - + sin(3.0 * m) * (0.0074 + t * 0.0001) - + cos(3.0 * m) * (-0.0097 - t * 0.0001) - + sin(aa) * (0.0 + t * (0.0144 - t * 0.00008)) - + cos(aa) * (0.3642 + t * (-0.0019 - t * 0.00029))) + corr = ( + -0.1029 - t * t * 0.00009 + + sin(m) * (-1.9658 + t * (-0.0056 + t * 0.00007)) + + cos(m) * (6.1537 + t * (0.021 - t * 0.00006)) + + sin(2.0 * m) * (-0.2081 - t * 0.0013) + + cos(2.0 * m) * (-0.1116 - t * 0.001) + + sin(3.0 * m) * (0.0074 + t * 0.0001) + + cos(3.0 * m) * (-0.0097 - t * 0.0001) + + sin(aa) * (0.0 + t * (0.0144 - t * 0.00008)) + + cos(aa) * (0.3642 + t * (-0.0019 - t * 0.00029)) + ) to_return = jde0 + corr return Epoch(to_return) @@ -4002,15 +4006,17 @@ def station_longitude_1(epoch): # Compute an auxiliary angle aa = 82.74 + 40.76 * t aa = Angle(aa).rad() # Convert to radians - corr = (-60.367 + t * (-0.0001 - t * 0.00009) - + sin(m) * (-2.3144 + t * (-0.0124 + t * 0.00007)) - + cos(m) * (6.7439 + t * (0.0166 - t * 0.00006)) - + sin(2.0 * m) * (-0.2259 - t * 0.001) - + cos(2.0 * m) * (-0.1497 - t * 0.0014) - + sin(3.0 * m) * (0.0105 + t * 0.0001) - + cos(3.0 * m) * (-0.0098) - + sin(aa) * (0.0 + t * (0.0144 - t * 0.00008)) - + cos(aa) * (0.3642 + t * (-0.0019 - t * 0.00029))) + corr = ( + -60.367 + t * (-0.0001 - t * 0.00009) + + sin(m) * (-2.3144 + t * (-0.0124 + t * 0.00007)) + + cos(m) * (6.7439 + t * (0.0166 - t * 0.00006)) + + sin(2.0 * m) * (-0.2259 - t * 0.001) + + cos(2.0 * m) * (-0.1497 - t * 0.0014) + + sin(3.0 * m) * (0.0105 + t * 0.0001) + + cos(3.0 * m) * (-0.0098) + + sin(aa) * (0.0 + t * (0.0144 - t * 0.00008)) + + cos(aa) * (0.3642 + t * (-0.0019 - t * 0.00029)) + ) to_return = jde0 + corr return Epoch(to_return) @@ -4060,15 +4066,17 @@ def station_longitude_2(epoch): # Compute an auxiliary angle aa = 82.74 + 40.76 * t aa = Angle(aa).rad() # Convert to radians - corr = (60.3023 + t * (0.0002 - t * 0.00009) - + sin(m) * (0.3506 + t * (-0.0034 + t * 0.00004)) - + cos(m) * (5.3635 + t * (0.0247 - t * 0.00007)) - + sin(2.0 * m) * (-0.1872 - t * 0.0016) - + cos(2.0 * m) * (-0.0037 - t * 0.0005) - + sin(3.0 * m) * (0.0012 + t * 0.0001) - + cos(3.0 * m) * (-0.0096 - t * 0.0001) - + sin(aa) * (0.0 + t * (0.0144 - t * 0.00008)) - + cos(aa) * (0.3642 + t * (-0.0019 - t * 0.00029))) + corr = ( + 60.3023 + t * (0.0002 - t * 0.00009) + + sin(m) * (0.3506 + t * (-0.0034 + t * 0.00004)) + + cos(m) * (5.3635 + t * (0.0247 - t * 0.00007)) + + sin(2.0 * m) * (-0.1872 - t * 0.0016) + + cos(2.0 * m) * (-0.0037 - t * 0.0005) + + sin(3.0 * m) * (0.0012 + t * 0.0001) + + cos(3.0 * m) * (-0.0096 - t * 0.0001) + + sin(aa) * (0.0 + t * (0.0144 - t * 0.00008)) + + cos(aa) * (0.3642 + t * (-0.0019 - t * 0.00029)) + ) to_return = jde0 + corr return Epoch(to_return) diff --git a/addon/globalPlugins/clock/pymeeus/JupiterMoons.py b/addon/globalPlugins/clock/pymeeus/JupiterMoons.py index ceac998..709f002 100644 --- a/addon/globalPlugins/clock/pymeeus/JupiterMoons.py +++ b/addon/globalPlugins/clock/pymeeus/JupiterMoons.py @@ -113,15 +113,18 @@ def jupiter_system_angles(epoch): OMEGA_ascending_node_jupiter = 100.464407 + 1.0209774 * \ JC_jupiter_angles + 0.00040315 * ( - JC_jupiter_angles ** 2) + \ + JC_jupiter_angles ** 2 + ) + \ 0.000000404 * ( - JC_jupiter_angles ** 3) + JC_jupiter_angles ** 3 + ) return psi_corrected, OMEGA_ascending_node_jupiter @staticmethod def rectangular_positions_jovian_equatorial( - epoch, tofk5=True, solar=False, do_correction=True): + epoch, tofk5=True, solar=False, do_correction=True, + ): """This method computes the rectangular geocentric position of Jupiter's satellites for a given epoch, using the E5-theory. @@ -401,7 +404,8 @@ def rectangular_positions_jovian_equatorial( - 0.0000311 * sin(radians(L1 - psi)) \ + 0.0000093 * sin(radians(L1 - omega_4)) \ + 0.0000075 * sin( - radians(3 * L1 - 4 * l_2 - 1.9927 * sum1 + omega_2)) \ + radians(3 * L1 - 4 * l_2 - 1.9927 * sum1 + omega_2), + ) \ + 0.0000046 * sin(radians(L1 + psi - 2 * PI - 2 * G)) tan_B2 = +0.0081004 * sin(radians(L2 - omega_2)) \ @@ -409,12 +413,14 @@ def rectangular_positions_jovian_equatorial( - 0.0003284 * sin(radians(L2 - psi)) \ + 0.0001160 * sin(radians(L2 - omega_4)) \ + 0.0000272 * sin( - radians(l_1 - 2 * l_3 + 1.0146 * sum2 + omega_2)) \ + radians(l_1 - 2 * l_3 + 1.0146 * sum2 + omega_2), + ) \ - 0.0000144 * sin(radians(L2 - omega_1)) \ + 0.0000143 * sin(radians(L2 + psi - 2 * PI - 2 * G)) \ + 0.0000035 * sin(radians(L2 - psi + G)) \ - 0.0000028 * sin( - radians(l_1 - 2 * l_3 + 1.0146 * sum2 + omega_3)) + radians(l_1 - 2 * l_3 + 1.0146 * sum2 + omega_3), + ) tan_B3 = +0.0032402 * sin(radians(L3 - omega_3)) \ - 0.0016911 * sin(radians(L3 - psi)) \ @@ -426,7 +432,8 @@ def rectangular_positions_jovian_equatorial( - 0.0000045 * sin(radians(L3 + psi - 2 * PI)) \ + 0.0000037 * sin(radians(L3 + psi - 2 * PI - 3 * G)) \ + 0.0000030 * sin( - radians(2 * l_2 - 3 * L3 + 4.03 * sum3 + omega_2)) \ + radians(2 * l_2 - 3 * L3 + 4.03 * sum3 + omega_2), + ) \ - 0.0000021 * \ sin(radians(2 * l_2 - 3 * L3 + 4.03 * sum3 + omega_3)) @@ -548,73 +555,91 @@ def rectangular_positions_jovian_equatorial( OMEGA_asc_node_jup = 100.464407 + 1.0209774 * \ JC_jupiter_angles + 0.00040315 * ( - JC_jupiter_angles ** 2) + \ + JC_jupiter_angles ** 2 + ) + \ 0.000000404 * ( - JC_jupiter_angles ** 3) + JC_jupiter_angles ** 3 + ) i_ecliptic_jupiter = 1.303267 - 0.0054965 * JC_jupiter_angles + \ 0.00000466 * ( - JC_jupiter_angles ** 2) - 0.000000002 * ( - JC_jupiter_angles ** 3) + JC_jupiter_angles ** 2 + ) - 0.000000002 * ( + JC_jupiter_angles ** 3 + ) # Calculate D with the fictional satellite - D = JupiterMoons.apparent_rectangular_coordinates(epoch, X_5, Y_5, Z_5, - OMEGA_asc_node_jup, - psi_corrected, - i_ecliptic_jupiter, - lambda_0, beta_0, - isFictional=True) + D = JupiterMoons.apparent_rectangular_coordinates( + epoch, X_5, Y_5, Z_5, + OMEGA_asc_node_jup, + psi_corrected, + i_ecliptic_jupiter, + lambda_0, beta_0, + isFictional=True, + ) # Calculate rectangular Coordinates X, Y and Z in Jupiter's radii of # Io (1), Europa (2), # Ganimed (3) and Callisto (4) Io = JupiterMoons. \ - apparent_rectangular_coordinates(epoch, X_1, Y_1, - Z_1, - OMEGA_asc_node_jup, - psi_corrected, - i_ecliptic_jupiter, - lambda_0, beta_0, D) + apparent_rectangular_coordinates( + epoch, X_1, Y_1, + Z_1, + OMEGA_asc_node_jup, + psi_corrected, + i_ecliptic_jupiter, + lambda_0, beta_0, D, + ) Europa = JupiterMoons. \ - apparent_rectangular_coordinates(epoch, X_2, Y_2, - Z_2, - OMEGA_asc_node_jup, - psi_corrected, - i_ecliptic_jupiter, - lambda_0, - beta_0, D) + apparent_rectangular_coordinates( + epoch, X_2, Y_2, + Z_2, + OMEGA_asc_node_jup, + psi_corrected, + i_ecliptic_jupiter, + lambda_0, + beta_0, D, + ) Ganimed = JupiterMoons. \ - apparent_rectangular_coordinates(epoch, X_3, - Y_3, Z_3, - OMEGA_asc_node_jup, - psi_corrected, - i_ecliptic_jupiter, - lambda_0, - beta_0, D) + apparent_rectangular_coordinates( + epoch, X_3, + Y_3, Z_3, + OMEGA_asc_node_jup, + psi_corrected, + i_ecliptic_jupiter, + lambda_0, + beta_0, D, + ) Callisto = JupiterMoons. \ - apparent_rectangular_coordinates(epoch, X_4, - Y_4, Z_4, - OMEGA_asc_node_jup, - psi_corrected, - i_ecliptic_jupiter, - lambda_0, - beta_0, D) + apparent_rectangular_coordinates( + epoch, X_4, + Y_4, Z_4, + OMEGA_asc_node_jup, + psi_corrected, + i_ecliptic_jupiter, + lambda_0, + beta_0, D, + ) # Calculate corrected coordinates if do_correction: Io = JupiterMoons.correct_rectangular_positions(R_1, 1, DELTA, Io) Europa = JupiterMoons.correct_rectangular_positions( - R_2, 2, DELTA, Europa) + R_2, 2, DELTA, Europa, + ) Ganimed = JupiterMoons.correct_rectangular_positions( - R_3, 3, DELTA, Ganimed) + R_3, 3, DELTA, Ganimed, + ) Callisto = JupiterMoons.correct_rectangular_positions( - R_4, 4, DELTA, Callisto) + R_4, 4, DELTA, Callisto, + ) return Io, Europa, Ganimed, Callisto @staticmethod def apparent_rectangular_coordinates( epoch, X, Y, Z, OMEGA, psi, i, lambda_0, beta_0, D=0, - isFictional=False): + isFictional=False, + ): """This method computes the apparent rectangular coordinates of a Jupiter satellite for given coordinates. @@ -784,7 +809,8 @@ def calculate_delta(epoch): @staticmethod def correct_rectangular_positions( - R, i_sat, DELTA, X_coordinate, Y_coordinate=0, Z_coordinate=0): + R, i_sat, DELTA, X_coordinate, Y_coordinate=0, Z_coordinate=0, + ): """This method corrects the given rectangular coordinates of a Jupiter satellite in order to obtain higher accuracy by considering differential light-time and the perspective effect. @@ -909,20 +935,24 @@ def check_phenomena(epoch, check_all=True, i_sat=0): # Calculate coordinates as seen from the Earth Coords_Earth = JupiterMoons.rectangular_positions_jovian_equatorial( - epoch) + epoch, + ) # Calculate coordinates as seen from the Sun Coords_Sun = JupiterMoons.rectangular_positions_jovian_equatorial( - epoch, solar=True) + epoch, solar=True, + ) if check_all is True: # Result matrix, where each rows is for a satellite # Column 0: Occultation # Column 1: Eclipse # Column 2: No use - result_matrix = [[0.0, 0.0, 0.0], - [0.0, 0.0, 0.0], - [0.0, 0.0, 0.0], - [0.0, 0.0, 0.0]] + result_matrix = [ + [0.0, 0.0, 0.0], + [0.0, 0.0, 0.0], + [0.0, 0.0, 0.0], + [0.0, 0.0, 0.0], + ] for i in range(len(result_matrix)): # Coordinates for the iterated satellite @@ -941,13 +971,17 @@ def check_phenomena(epoch, check_all=True, i_sat=0): return result_matrix else: - return JupiterMoons.check_occultation(Coords_Earth[i_sat - 1][0], - Coords_Earth[i_sat - 1][0], - Coords_Earth[i_sat - 1][ - 0]), \ + return JupiterMoons.check_occultation( + Coords_Earth[i_sat - 1][0], + Coords_Earth[i_sat - 1][0], + Coords_Earth[i_sat - 1][ + 0 + ], + ), \ JupiterMoons.check_eclipse( Coords_Sun[i_sat - 1][0], Coords_Sun[i_sat - 1][0], - Coords_Sun[i_sat - 1][0]) + Coords_Sun[i_sat - 1][0], + ) @staticmethod def is_phenomena(epoch): @@ -995,10 +1029,12 @@ def is_phenomena(epoch): # Get distance Matrix dist_matrix = JupiterMoons.check_phenomena(epoch) - result_matrix = [[False, False, False], - [False, False, False], - [False, False, False], - [False, False, False]] + result_matrix = [ + [False, False, False], + [False, False, False], + [False, False, False], + [False, False, False], + ] for row in range(len(result_matrix)): for col in range(len(result_matrix[row]) - 1): @@ -1088,8 +1124,10 @@ def check_occultation(X=0, Y=0, Z=0, epoch=None, i_sat=None): # Calculate coordinates for given Epoch as seen from the Earth X, Y, Z = \ JupiterMoons.rectangular_positions_jovian_equatorial( - epoch)[ - i_sat - 1] + epoch, + )[ + i_sat - 1 + ] else: raise TypeError("Invalid input types") @@ -1148,7 +1186,8 @@ def check_eclipse(X_0=0, Y_0=0, Z_0=0, epoch=None, i_sat=None): # Calculate coordinates for given Epoch as seen from the Sun X_0, Y_0, Z_0 = \ JupiterMoons.rectangular_positions_jovian_equatorial( - epoch, solar=True)[i_sat - 1] + epoch, solar=True, + )[i_sat - 1] else: raise TypeError("Invalid input types") @@ -1176,13 +1215,15 @@ def print_me(msg, val): utc_1992_12_16_00_00_00 = Epoch(1992, 12, 16, utc=True) psi_corrected, OMEGA_ascending_node_jupiter = \ JupiterMoons.jupiter_system_angles( - utc_1992_12_16_00_00_00) + utc_1992_12_16_00_00_00, + ) print("Ascending node of Jupiter: ", OMEGA_ascending_node_jupiter) # 100.39249942976576 print( "Longitude of the node of the equator of Jupiter on the ecliptic (" "psi):", - psi_corrected) + psi_corrected, + ) # 317.1058009213959t print("") @@ -1193,24 +1234,28 @@ def print_me(msg, val): utc_1992_12_16_00_00_00 = Epoch(1992, 12, 16, utc=True) io, europa, ganymede, callisto = \ JupiterMoons.rectangular_positions_jovian_equatorial( - utc_1992_12_16_00_00_00) + utc_1992_12_16_00_00_00, + ) print("Corrected rectangular geocentric position of Io [X, Y , Z]: ", io) # (-3.450168811390241, 0.21370246960509387, -4.818966623735296) print( "Corrected rectangular geocentric position of Europa [X, Y , Z]: ", - europa) + europa, + ) # (7.441869121153001, 0.27524463479625677, -5.747104399729193) print( "Corrected rectangular geocentric position of Ganymede [X, Y , Z]: ", - ganymede) + ganymede, + ) # (1.201111684800708, 0.5899903274317162, -14.940581367576527) print( "Corrected rectangular geocentric position of Callisto [X, Y , Z]: ", - callisto) + callisto, + ) # (7.071943240286434, 1.0289562923230684, -25.224137724734955) print("") @@ -1224,26 +1269,31 @@ def print_me(msg, val): io_uncorrected, europa_uncorrected, ganymede_uncorrected, \ callisto_uncorrected = \ JupiterMoons.rectangular_positions_jovian_equatorial( - utc_1992_12_16_00_00_00, do_correction=False) + utc_1992_12_16_00_00_00, do_correction=False, + ) print( "Uncorrected rectangular geocentric position of Io [X, Y , Z]: ", - io_uncorrected) + io_uncorrected, + ) # (-3.4489935969836503, 0.21361563816963675, -4.818966623735296) print( "Uncorrected rectangular geocentric position of Europa [X, Y , Z]: ", - europa_uncorrected) + europa_uncorrected, + ) # (7.438101803124541, 0.2751112576349763, -5.747104399729193) print( "Uncorrected rectangular geocentric position of Ganymede [X, Y , Z]: ", - ganymede_uncorrected) + ganymede_uncorrected, + ) # (1.1990581804888616, 0.589247092847632, -14.940581367576527) print( "Uncorrected rectangular geocentric position of Callisto [X, Y , Z]: ", - callisto_uncorrected) + callisto_uncorrected, + ) # (7.056237832405445, 1.0267678919629089, -25.224137724734955) print("") @@ -1267,7 +1317,8 @@ def print_me(msg, val): io_ecc_start_2021_02_12_14_19_14 = Epoch(2021, 2, 12.5966898148148) result_matrix = JupiterMoons.check_phenomena( - io_ecc_start_2021_02_12_14_19_14) + io_ecc_start_2021_02_12_14_19_14, + ) # Row 0: Io Column 0: perspective distance as seen from the Earth # Row 1: Europa Column 1: perspective distance as seen from the Sun # Row 2: Ganymede Column 2: No use @@ -1276,28 +1327,32 @@ def print_me(msg, val): # print Row 0 print( "(perspective distance of Io (Earth View), perspective distance of " - "Io (Sun view), No use): ") + "Io (Sun view), No use): ", + ) print(result_matrix[0]) # [1.1926058680144362, 0.856027716233023, 0.0] # print Row 1 print( "(perspective distance of Europa (Earth View), perspective distance " - "of Europa (Sun view), No use): ") + "of Europa (Sun view), No use): ", + ) print(result_matrix[1]) # [-8.739720236890856, -8.893094092124032, 0.0] # print Row 2 print( "(perspective distance of Ganymede (Earth View), perspective " - "distance of Ganymede (Sun view), No use): ") + "distance of Ganymede (Sun view), No use): ", + ) print(result_matrix[2]) # [14.069121992481382, 13.8323491767871, 0.0] # print Row 3 print( "(perspective distance of Callisto (Earth View), perspective " - "distance of Callisto (Sun view), No use): ") + "distance of Callisto (Sun view), No use): ", + ) print(result_matrix[3]) # [-2.934134686233644, -3.9904786452498144, 0.0] @@ -1342,13 +1397,16 @@ def print_me(msg, val): # for December 16 at 0h UTC as seen from the Sun utc_1992_12_16_00_00_00 = Epoch(1992, 12, 16, utc=True) result_matrix = JupiterMoons.rectangular_positions_jovian_equatorial( - utc_1992_12_16_00_00_00, solar=True) + utc_1992_12_16_00_00_00, solar=True, + ) io_radius_to_center_of_jupiter_sun = JupiterMoons.check_coordinates( - result_matrix[0][0], result_matrix[0][1]) + result_matrix[0][0], result_matrix[0][1], + ) print( "Perspective distance of Io as seen from the Sun in Jupiter radii: ", - io_radius_to_center_of_jupiter_sun) + io_radius_to_center_of_jupiter_sun, + ) # 3.457757270630766 print("") @@ -1358,13 +1416,16 @@ def print_me(msg, val): # for December 16 at 0h UTC as seen from the Earth utc_1992_12_16_00_00_00 = Epoch(1992, 12, 16, utc=True) result_matrix = JupiterMoons.rectangular_positions_jovian_equatorial( - utc_1992_12_16_00_00_00, solar=False) + utc_1992_12_16_00_00_00, solar=False, + ) io_radius_to_center_of_jupiter_earth = JupiterMoons.check_coordinates( - result_matrix[0][0], result_matrix[0][1]) + result_matrix[0][0], result_matrix[0][1], + ) print( "Perspective distance of Io as seen from the Earth in Jupiter radii: ", - io_radius_to_center_of_jupiter_earth) + io_radius_to_center_of_jupiter_earth, + ) # 2.553301264153796 diff --git a/addon/globalPlugins/clock/pymeeus/Mars.py b/addon/globalPlugins/clock/pymeeus/Mars.py index 74dd1d9..cf9019a 100644 --- a/addon/globalPlugins/clock/pymeeus/Mars.py +++ b/addon/globalPlugins/clock/pymeeus/Mars.py @@ -26,7 +26,7 @@ from pymeeus.Coordinates import ( geometric_vsop_pos, apparent_vsop_pos, orbital_elements, nutation_longitude, true_obliquity, ecliptical2equatorial, - passage_nodes_elliptic + passage_nodes_elliptic, ) from pymeeus.Earth import Earth from pymeeus.Sun import Sun @@ -5607,7 +5607,7 @@ [0.09340065, 0.000090484, -0.0000000806, -0.00000000025], # e [1.849726, -0.0006011, 0.00001276, -0.000000007], # i [49.558093, 0.7720959, 0.00001557, 0.000002267], # Omega - [336.060234, 1.8410449, 0.00013477, 0.000000536] # pie + [336.060234, 1.8410449, 0.00013477, 0.000000536], # pie ] """This table contains the parameters to compute Mars' orbital elements for the mean equinox of date. Based in Table 31.A, page 212""" @@ -5617,7 +5617,7 @@ [355.433, 19140.2993039, 0.00000262, -0.000000003], # L [1.849726, -0.0081477, -0.00002255, -0.000000029], # i [49.558093, -0.295025, -0.00064048, -0.000001964], # Omega - [336.060234, 0.4439016, -0.00017313, 0.000000518] # pie + [336.060234, 0.4439016, -0.00017313, 0.000000518], # pie ] """This table contains the parameters to compute Mars' orbital elements for the standard equinox J2000.0. Based on Table 31.B, page 214""" @@ -5883,17 +5883,19 @@ def conjunction(epoch): m = Angle(m).to_positive() m = m.rad() t = (jde0 - 2451545.0) / 36525.0 - corr = (0.3102 + t * (-0.0001 + t * 0.00001) - + sin(m) * (9.7273 + t * (-0.0156 + t * 0.00001)) - + cos(m) * (-18.3195 + t * (-0.0467 + t * 0.00009)) - + sin(2.0 * m) * (-1.6488 + t * (-0.0133 + t * 0.00001)) - + cos(2.0 * m) * (-2.6117 + t * (-0.002 + t * 0.00004)) - + sin(3.0 * m) * (-0.6827 + t * (-0.0026 + t * 0.00001)) - + cos(3.0 * m) * (0.0281 + t * (0.0035 + t * 0.00001)) - + sin(4.0 * m) * (-0.0823 + t * (0.0006 + t * 0.00001)) - + cos(4.0 * m) * (0.1584 + t * 0.0013) - + sin(5.0 * m) * (0.027 + t * 0.0005) - + cos(5.0 * m) * (0.0433)) + corr = ( + 0.3102 + t * (-0.0001 + t * 0.00001) + + sin(m) * (9.7273 + t * (-0.0156 + t * 0.00001)) + + cos(m) * (-18.3195 + t * (-0.0467 + t * 0.00009)) + + sin(2.0 * m) * (-1.6488 + t * (-0.0133 + t * 0.00001)) + + cos(2.0 * m) * (-2.6117 + t * (-0.002 + t * 0.00004)) + + sin(3.0 * m) * (-0.6827 + t * (-0.0026 + t * 0.00001)) + + cos(3.0 * m) * (0.0281 + t * (0.0035 + t * 0.00001)) + + sin(4.0 * m) * (-0.0823 + t * (0.0006 + t * 0.00001)) + + cos(4.0 * m) * (0.1584 + t * 0.0013) + + sin(5.0 * m) * (0.027 + t * 0.0005) + + cos(5.0 * m) * (0.0433) + ) to_return = jde0 + corr return Epoch(to_return) @@ -5939,17 +5941,19 @@ def opposition(epoch): m = Angle(m).to_positive() m = m.rad() t = (jde0 - 2451545.0) / 36525.0 - corr = (-0.3088 + t * t * 0.00002 - + sin(m) * (-17.6965 + t * (0.0363 + t * 0.00005)) - + cos(m) * (18.3131 + t * (0.0467 - t * 0.00006)) - + sin(2.0 * m) * (-0.2162 + t * (-0.0198 - t * 0.00001)) - + cos(2.0 * m) * (-4.5028 + t * (-0.0019 + t * 0.00007)) - + sin(3.0 * m) * (0.8987 + t * (0.0058 - t * 0.00002)) - + cos(3.0 * m) * (0.7666 + t * (-0.005 - t * 0.00003)) - + sin(4.0 * m) * (-0.3636 + t * (-0.0001 + t * 0.00002)) - + cos(4.0 * m) * (0.0402 + t * 0.0032) - + sin(5.0 * m) * (0.0737 - t * 0.0008) - + cos(5.0 * m) * (-0.098 - t * 0.0011)) + corr = ( + -0.3088 + t * t * 0.00002 + + sin(m) * (-17.6965 + t * (0.0363 + t * 0.00005)) + + cos(m) * (18.3131 + t * (0.0467 - t * 0.00006)) + + sin(2.0 * m) * (-0.2162 + t * (-0.0198 - t * 0.00001)) + + cos(2.0 * m) * (-4.5028 + t * (-0.0019 + t * 0.00007)) + + sin(3.0 * m) * (0.8987 + t * (0.0058 - t * 0.00002)) + + cos(3.0 * m) * (0.7666 + t * (-0.005 - t * 0.00003)) + + sin(4.0 * m) * (-0.3636 + t * (-0.0001 + t * 0.00002)) + + cos(4.0 * m) * (0.0402 + t * 0.0032) + + sin(5.0 * m) * (0.0737 - t * 0.0008) + + cos(5.0 * m) * (-0.098 - t * 0.0011) + ) to_return = jde0 + corr return Epoch(to_return) @@ -5996,17 +6000,19 @@ def station_longitude_1(epoch): m = Angle(m).to_positive() m = m.rad() t = (jde0 - 2451545.0) / 36525.0 - corr = (-37.079 + t * (-0.0009 + t * 0.00002) - + sin(m) * (-20.0651 + t * (0.0228 + t * 0.00004)) - + cos(m) * (14.5205 + t * (0.0504 - t * 0.00001)) - + sin(2.0 * m) * (1.1737 - t * 0.0169) - + cos(2.0 * m) * (-4.255 + t * (-0.0075 + t * 0.00008)) - + sin(3.0 * m) * (0.4897 + t * (0.0074 - t * 0.00001)) - + cos(3.0 * m) * (1.1151 + t * (-0.0021 - t * 0.00005)) - + sin(4.0 * m) * (-0.3636 + t * (-0.002 + t * 0.00001)) - + cos(4.0 * m) * (-0.1769 + t * (0.0028 + t * 0.00002)) - + sin(5.0 * m) * (0.1437 - t * 0.0004) - + cos(5.0 * m) * (-0.0383 - t * 0.0016)) + corr = ( + -37.079 + t * (-0.0009 + t * 0.00002) + + sin(m) * (-20.0651 + t * (0.0228 + t * 0.00004)) + + cos(m) * (14.5205 + t * (0.0504 - t * 0.00001)) + + sin(2.0 * m) * (1.1737 - t * 0.0169) + + cos(2.0 * m) * (-4.255 + t * (-0.0075 + t * 0.00008)) + + sin(3.0 * m) * (0.4897 + t * (0.0074 - t * 0.00001)) + + cos(3.0 * m) * (1.1151 + t * (-0.0021 - t * 0.00005)) + + sin(4.0 * m) * (-0.3636 + t * (-0.002 + t * 0.00001)) + + cos(4.0 * m) * (-0.1769 + t * (0.0028 + t * 0.00002)) + + sin(5.0 * m) * (0.1437 - t * 0.0004) + + cos(5.0 * m) * (-0.0383 - t * 0.0016) + ) to_return = jde0 + corr return Epoch(to_return) @@ -6053,17 +6059,19 @@ def station_longitude_2(epoch): m = Angle(m).to_positive() m = m.rad() t = (jde0 - 2451545.0) / 36525.0 - corr = (36.7191 + t * (0.0016 + t * 0.00003) - + sin(m) * (-12.6163 + t * (0.0417 - t * 0.00001)) - + cos(m) * (20.1218 + t * (0.0379 - t * 0.00006)) - + sin(2.0 * m) * (-1.636 - t * 0.019) - + cos(2.0 * m) * (-3.9657 + t * (0.0045 + t * 0.00007)) - + sin(3.0 * m) * (1.1546 + t * (0.0029 - t * 0.00003)) - + cos(3.0 * m) * (0.2888 + t * (-0.0073 - t * 0.00002)) - + sin(4.0 * m) * (-0.3128 + t * (0.0017 + t * 0.00002)) - + cos(4.0 * m) * (0.2513 + t * (0.0026 - t * 0.00002)) - + sin(5.0 * m) * (-0.0021 - t * 0.0016) - + cos(5.0 * m) * (-0.1497 - t * 0.0006)) + corr = ( + 36.7191 + t * (0.0016 + t * 0.00003) + + sin(m) * (-12.6163 + t * (0.0417 - t * 0.00001)) + + cos(m) * (20.1218 + t * (0.0379 - t * 0.00006)) + + sin(2.0 * m) * (-1.636 - t * 0.019) + + cos(2.0 * m) * (-3.9657 + t * (0.0045 + t * 0.00007)) + + sin(3.0 * m) * (1.1546 + t * (0.0029 - t * 0.00003)) + + cos(3.0 * m) * (0.2888 + t * (-0.0073 - t * 0.00002)) + + sin(4.0 * m) * (-0.3128 + t * (0.0017 + t * 0.00002)) + + cos(4.0 * m) * (0.2513 + t * (0.0026 - t * 0.00002)) + + sin(5.0 * m) * (-0.0021 - t * 0.0016) + + cos(5.0 * m) * (-0.1497 - t * 0.0006) + ) to_return = jde0 + corr return Epoch(to_return) @@ -6183,8 +6191,10 @@ def magnitude(sun_dist, earth_dist, phase_angle): :raises: TypeError if input values are of wrong type. """ - if not (isinstance(sun_dist, float) and isinstance(earth_dist, float) - and isinstance(phase_angle, (float, Angle))): + if not ( + isinstance(sun_dist, float) and isinstance(earth_dist, float) + and isinstance(phase_angle, (float, Angle)) + ): raise TypeError("Invalid input types") i = float(phase_angle) m = -1.3 + 5.0 * log10(sun_dist * earth_dist) + 0.01486 * i diff --git a/addon/globalPlugins/clock/pymeeus/Mercury.py b/addon/globalPlugins/clock/pymeeus/Mercury.py index 1bcc817..09d23b9 100644 --- a/addon/globalPlugins/clock/pymeeus/Mercury.py +++ b/addon/globalPlugins/clock/pymeeus/Mercury.py @@ -26,7 +26,7 @@ from pymeeus.Coordinates import ( geometric_vsop_pos, apparent_vsop_pos, orbital_elements, nutation_longitude, true_obliquity, ecliptical2equatorial, - passage_nodes_elliptic + passage_nodes_elliptic, ) from pymeeus.Earth import Earth from pymeeus.Sun import Sun @@ -6952,7 +6952,7 @@ [0.20563175, 0.000020407, -0.0000000283, -0.00000000018], # e [7.004986, 0.0018215, -0.0000181, 0.000000056], # i [48.330893, 1.1861883, 0.00017542, 0.000000215], # Omega - [77.456119, 1.5564776, 0.00029544, 0.000000009] # pie + [77.456119, 1.5564776, 0.00029544, 0.000000009], # pie ] """This table contains the parameters to compute Mercury's orbital elements for the mean equinox of date. Based in Table 31.A, page 212""" @@ -6962,7 +6962,7 @@ [252.250906, 149472.6746358, -0.00000536, 0.000000002], # L [7.004986, -0.0059516, 0.0000008, 0.000000043], # i [48.330893, -0.1254227, -0.00008833, -0.0000002], # Omega - [77.456119, 0.1588643, -0.00001342, -0.000000007] # pie + [77.456119, 0.1588643, -0.00001342, -0.000000007], # pie ] """This table contains the parameters to compute Mercury's orbital elements for the standard equinox J2000.0. Based on Table 31.B, page 214""" @@ -7237,17 +7237,19 @@ def inferior_conjunction(epoch): m = Angle(m).to_positive() m = m.rad() t = (jde0 - 2451545.0) / 36525.0 - corr = (0.0545 + 0.0002 * t - + sin(m) * (-6.2008 + t * (0.0074 + t * 0.00003)) - + cos(m) * (-3.275 + t * (-0.0197 + t * 0.00001)) - + sin(2.0 * m) * (0.4737 + t * (-0.0052 - t * 0.00001)) - + cos(2.0 * m) * (0.8111 + t * (0.0033 - t * 0.00002)) - + sin(3.0 * m) * (0.0037 + t * 0.0018) - + cos(3.0 * m) * (-0.1768 + t * t * 0.00001) - + sin(4.0 * m) * (-0.0211 - t * 0.0004) - + cos(4.0 * m) * (0.0326 - t * 0.0003) - + sin(5.0 * m) * (0.0083 + t * 0.0001) - + cos(5.0 * m) * (-0.004 + t * 0.0001)) + corr = ( + 0.0545 + 0.0002 * t + + sin(m) * (-6.2008 + t * (0.0074 + t * 0.00003)) + + cos(m) * (-3.275 + t * (-0.0197 + t * 0.00001)) + + sin(2.0 * m) * (0.4737 + t * (-0.0052 - t * 0.00001)) + + cos(2.0 * m) * (0.8111 + t * (0.0033 - t * 0.00002)) + + sin(3.0 * m) * (0.0037 + t * 0.0018) + + cos(3.0 * m) * (-0.1768 + t * t * 0.00001) + + sin(4.0 * m) * (-0.0211 - t * 0.0004) + + cos(4.0 * m) * (0.0326 - t * 0.0003) + + sin(5.0 * m) * (0.0083 + t * 0.0001) + + cos(5.0 * m) * (-0.004 + t * 0.0001) + ) to_return = jde0 + corr return Epoch(to_return) @@ -7293,17 +7295,19 @@ def superior_conjunction(epoch): m = Angle(m).to_positive() m = m.rad() t = (jde0 - 2451545.0) / 36525.0 - corr = (-0.0548 - 0.0002 * t - + sin(m) * (7.3894 + t * (-0.01 - t * 0.00003)) - + cos(m) * (3.22 + t * (0.0197 - t * 0.00001)) - + sin(2.0 * m) * (0.8383 + t * (-0.0064 - t * 0.00001)) - + cos(2.0 * m) * (0.9666 + t * (0.0039 - t * 0.00003)) - + sin(3.0 * m) * (0.077 - t * 0.0026) - + cos(3.0 * m) * (0.2758 + t * (0.0002 - t * 0.00002)) - + sin(4.0 * m) * (-0.0128 - t * 0.0008) - + cos(4.0 * m) * (0.0734 + t * (-0.0004 - t * 0.00001)) - + sin(5.0 * m) * (-0.0122 - t * 0.0002) - + cos(5.0 * m) * (0.0173 - t * 0.0002)) + corr = ( + -0.0548 - 0.0002 * t + + sin(m) * (7.3894 + t * (-0.01 - t * 0.00003)) + + cos(m) * (3.22 + t * (0.0197 - t * 0.00001)) + + sin(2.0 * m) * (0.8383 + t * (-0.0064 - t * 0.00001)) + + cos(2.0 * m) * (0.9666 + t * (0.0039 - t * 0.00003)) + + sin(3.0 * m) * (0.077 - t * 0.0026) + + cos(3.0 * m) * (0.2758 + t * (0.0002 - t * 0.00002)) + + sin(4.0 * m) * (-0.0128 - t * 0.0008) + + cos(4.0 * m) * (0.0734 + t * (-0.0004 - t * 0.00001)) + + sin(5.0 * m) * (-0.0122 - t * 0.0002) + + cos(5.0 * m) * (0.0173 - t * 0.0002) + ) to_return = jde0 + corr return Epoch(to_return) @@ -7352,28 +7356,32 @@ def western_elongation(epoch): m = Angle(m).to_positive() m = m.rad() t = (jde0 - 2451545.0) / 36525.0 - corr = (21.6249 - 0.0002 * t - + sin(m) * (0.1306 + t * 0.0065) - + cos(m) * (-2.7661 + t * (-0.0011 + t * 0.00001)) - + sin(2.0 * m) * (0.2438 + t * (-0.0024 - t * 0.00001)) - + cos(2.0 * m) * (0.5767 + t * 0.0023) - + sin(3.0 * m) * (0.1041) - + cos(3.0 * m) * (-0.0184 + t * 0.0007) - + sin(4.0 * m) * (-0.0051 - t * 0.0001) - + cos(4.0 * m) * (0.0048 + t * 0.0001) - + sin(5.0 * m) * (0.0026) - + cos(5.0 * m) * (0.0037)) - elon = (22.4143 - 0.0001 * t - + sin(m) * (4.3651 + t * (-0.0048 - t * 0.00002)) - + cos(m) * (2.3787 + t * (0.0121 - t * 0.00001)) - + sin(2.0 * m) * (0.2674 + t * 0.0022) - + cos(2.0 * m) * (-0.3873 + t * (0.0008 + t * 0.00001)) - + sin(3.0 * m) * (-0.0369 - t * 0.0001) - + cos(3.0 * m) * (0.0017 - t * 0.0001) - + sin(4.0 * m) * (0.0059) - + cos(4.0 * m) * (0.0061 + t * 0.0001) - + sin(5.0 * m) * (0.0007) - + cos(5.0 * m) * (-0.0011)) + corr = ( + 21.6249 - 0.0002 * t + + sin(m) * (0.1306 + t * 0.0065) + + cos(m) * (-2.7661 + t * (-0.0011 + t * 0.00001)) + + sin(2.0 * m) * (0.2438 + t * (-0.0024 - t * 0.00001)) + + cos(2.0 * m) * (0.5767 + t * 0.0023) + + sin(3.0 * m) * (0.1041) + + cos(3.0 * m) * (-0.0184 + t * 0.0007) + + sin(4.0 * m) * (-0.0051 - t * 0.0001) + + cos(4.0 * m) * (0.0048 + t * 0.0001) + + sin(5.0 * m) * (0.0026) + + cos(5.0 * m) * (0.0037) + ) + elon = ( + 22.4143 - 0.0001 * t + + sin(m) * (4.3651 + t * (-0.0048 - t * 0.00002)) + + cos(m) * (2.3787 + t * (0.0121 - t * 0.00001)) + + sin(2.0 * m) * (0.2674 + t * 0.0022) + + cos(2.0 * m) * (-0.3873 + t * (0.0008 + t * 0.00001)) + + sin(3.0 * m) * (-0.0369 - t * 0.0001) + + cos(3.0 * m) * (0.0017 - t * 0.0001) + + sin(4.0 * m) * (0.0059) + + cos(4.0 * m) * (0.0061 + t * 0.0001) + + sin(5.0 * m) * (0.0007) + + cos(5.0 * m) * (-0.0011) + ) elon = Angle(elon).to_positive() to_return = jde0 + corr return Epoch(to_return), elon @@ -7423,28 +7431,32 @@ def eastern_elongation(epoch): m = Angle(m).to_positive() m = m.rad() t = (jde0 - 2451545.0) / 36525.0 - corr = (-21.6101 + 0.0002 * t - + sin(m) * (-1.9803 + t * (-0.006 + t * 0.00001)) - + cos(m) * (1.4151 + t * (-0.0072 - t * 0.00001)) - + sin(2.0 * m) * (0.5528 + t * (-0.0005 - t * 0.00001)) - + cos(2.0 * m) * (0.2905 + t * (0.0034 + t * 0.00001)) - + sin(3.0 * m) * (-0.1121 + t * (-0.0001 + t * 0.00001)) - + cos(3.0 * m) * (-0.0098 - t * 0.0015) - + sin(4.0 * m) * (0.0192) - + cos(4.0 * m) * (0.0111 + t * 0.0004) - + sin(5.0 * m) * (-0.0061) - + cos(5.0 * m) * (-0.0032 - t * 0.0001)) - elon = (22.4697 - + sin(m) * (-4.2666 + t * (0.0054 + t * 0.00002)) - + cos(m) * (-1.8537 - t * 0.0137) - + sin(2.0 * m) * (0.3598 + t * (0.0008 - t * 0.00001)) - + cos(2.0 * m) * (-0.068 + t * 0.0026) - + sin(3.0 * m) * (-0.0524 - t * 0.0003) - + cos(3.0 * m) * (0.0052 - t * 0.0006) - + sin(4.0 * m) * (0.0107 + t * 0.0001) - + cos(4.0 * m) * (-0.0013 + t * 0.0001) - + sin(5.0 * m) * (-0.0021) - + cos(5.0 * m) * (0.0003)) + corr = ( + -21.6101 + 0.0002 * t + + sin(m) * (-1.9803 + t * (-0.006 + t * 0.00001)) + + cos(m) * (1.4151 + t * (-0.0072 - t * 0.00001)) + + sin(2.0 * m) * (0.5528 + t * (-0.0005 - t * 0.00001)) + + cos(2.0 * m) * (0.2905 + t * (0.0034 + t * 0.00001)) + + sin(3.0 * m) * (-0.1121 + t * (-0.0001 + t * 0.00001)) + + cos(3.0 * m) * (-0.0098 - t * 0.0015) + + sin(4.0 * m) * (0.0192) + + cos(4.0 * m) * (0.0111 + t * 0.0004) + + sin(5.0 * m) * (-0.0061) + + cos(5.0 * m) * (-0.0032 - t * 0.0001) + ) + elon = ( + 22.4697 + + sin(m) * (-4.2666 + t * (0.0054 + t * 0.00002)) + + cos(m) * (-1.8537 - t * 0.0137) + + sin(2.0 * m) * (0.3598 + t * (0.0008 - t * 0.00001)) + + cos(2.0 * m) * (-0.068 + t * 0.0026) + + sin(3.0 * m) * (-0.0524 - t * 0.0003) + + cos(3.0 * m) * (0.0052 - t * 0.0006) + + sin(4.0 * m) * (0.0107 + t * 0.0001) + + cos(4.0 * m) * (-0.0013 + t * 0.0001) + + sin(5.0 * m) * (-0.0021) + + cos(5.0 * m) * (0.0003) + ) elon = Angle(elon).to_positive() to_return = jde0 + corr return Epoch(to_return), elon @@ -7492,17 +7504,19 @@ def station_longitude_1(epoch): m = Angle(m).to_positive() m = m.rad() t = (jde0 - 2451545.0) / 36525.0 - corr = (-11.0761 + 0.0003 * t - + sin(m) * (-4.7321 + t * (0.0023 + t * 0.00002)) - + cos(m) * (-1.323 - t * 0.0156) - + sin(2.0 * m) * (0.227 - t * 0.0046) - + cos(2.0 * m) * (0.7184 + t * (0.0013 - t * 0.00002)) - + sin(3.0 * m) * (0.0638 + t * 0.0016) - + cos(3.0 * m) * (-0.1655 + t * 0.0007) - + sin(4.0 * m) * (-0.0395 - t * 0.0003) - + cos(4.0 * m) * (0.0247 - t * 0.0006) - + sin(5.0 * m) * (0.0131) - + cos(5.0 * m) * (-0.0008 + t * 0.0002)) + corr = ( + -11.0761 + 0.0003 * t + + sin(m) * (-4.7321 + t * (0.0023 + t * 0.00002)) + + cos(m) * (-1.323 - t * 0.0156) + + sin(2.0 * m) * (0.227 - t * 0.0046) + + cos(2.0 * m) * (0.7184 + t * (0.0013 - t * 0.00002)) + + sin(3.0 * m) * (0.0638 + t * 0.0016) + + cos(3.0 * m) * (-0.1655 + t * 0.0007) + + sin(4.0 * m) * (-0.0395 - t * 0.0003) + + cos(4.0 * m) * (0.0247 - t * 0.0006) + + sin(5.0 * m) * (0.0131) + + cos(5.0 * m) * (-0.0008 + t * 0.0002) + ) to_return = jde0 + corr return Epoch(to_return) @@ -7549,17 +7563,19 @@ def station_longitude_2(epoch): m = Angle(m).to_positive() m = m.rad() t = (jde0 - 2451545.0) / 36525.0 - corr = (11.1343 - 0.0001 * t - + sin(m) * (-3.9137 + t * (0.0073 + t * 0.00002)) - + cos(m) * (-3.3861 + t * (-0.0128 + t * 0.00001)) - + sin(2.0 * m) * (0.5222 + t * (-0.004 - t * 0.00002)) - + cos(2.0 * m) * (0.5929 + t * (0.0039 - t * 0.00002)) - + sin(3.0 * m) * (-0.0593 + t * 0.0018) - + cos(3.0 * m) * (-0.1733 * t * (-0.0007 + t * 0.00001)) - + sin(4.0 * m) * (-0.0053 - t * 0.0006) - + cos(4.0 * m) * (0.0476 - t * 0.0001) - + sin(5.0 * m) * (0.007 + t * 0.0002) - + cos(5.0 * m) * (-0.0115 + t * 0.0001)) + corr = ( + 11.1343 - 0.0001 * t + + sin(m) * (-3.9137 + t * (0.0073 + t * 0.00002)) + + cos(m) * (-3.3861 + t * (-0.0128 + t * 0.00001)) + + sin(2.0 * m) * (0.5222 + t * (-0.004 - t * 0.00002)) + + cos(2.0 * m) * (0.5929 + t * (0.0039 - t * 0.00002)) + + sin(3.0 * m) * (-0.0593 + t * 0.0018) + + cos(3.0 * m) * (-0.1733 * t * (-0.0007 + t * 0.00001)) + + sin(4.0 * m) * (-0.0053 - t * 0.0006) + + cos(4.0 * m) * (0.0476 - t * 0.0001) + + sin(5.0 * m) * (0.007 + t * 0.0002) + + cos(5.0 * m) * (-0.0115 + t * 0.0001) + ) to_return = jde0 + corr return Epoch(to_return) @@ -7679,13 +7695,17 @@ def magnitude(sun_dist, earth_dist, phase_angle): :raises: TypeError if input values are of wrong type. """ - if not (isinstance(sun_dist, float) and isinstance(earth_dist, float) - and isinstance(phase_angle, (float, Angle))): + if not ( + isinstance(sun_dist, float) and isinstance(earth_dist, float) + and isinstance(phase_angle, (float, Angle)) + ): raise TypeError("Invalid input types") i = float(phase_angle) i50 = i - 50.0 - m = (1.16 + 5.0 * log10(sun_dist * earth_dist) + 0.02838 * i50 - + 0.0001023 * i50 * i50) + m = ( + 1.16 + 5.0 * log10(sun_dist * earth_dist) + 0.02838 * i50 + + 0.0001023 * i50 * i50 + ) return round(m, 1) diff --git a/addon/globalPlugins/clock/pymeeus/Minor.py b/addon/globalPlugins/clock/pymeeus/Minor.py index fdc3544..fdcf6f9 100644 --- a/addon/globalPlugins/clock/pymeeus/Minor.py +++ b/addon/globalPlugins/clock/pymeeus/Minor.py @@ -88,9 +88,11 @@ def set(self, q, e, i, omega, w, t): """ # First check that input value is of correct types - if not (isinstance(t, Epoch) and isinstance(q, float) - and isinstance(e, float) and isinstance(i, Angle) - and isinstance(omega, Angle) and isinstance(w, Angle)): + if not ( + isinstance(t, Epoch) and isinstance(q, float) + and isinstance(e, float) and isinstance(i, Angle) + and isinstance(omega, Angle) and isinstance(w, Angle) + ): raise TypeError("Invalid input types") # Compute auxiliary quantities se = 0.397777156 diff --git a/addon/globalPlugins/clock/pymeeus/Moon.py b/addon/globalPlugins/clock/pymeeus/Moon.py index 48a2c34..3231c20 100644 --- a/addon/globalPlugins/clock/pymeeus/Moon.py +++ b/addon/globalPlugins/clock/pymeeus/Moon.py @@ -24,7 +24,7 @@ from pymeeus.Epoch import Epoch, JDE2000 from pymeeus.Sun import Sun from pymeeus.Coordinates import ( - nutation_longitude, true_obliquity, ecliptical2equatorial + nutation_longitude, true_obliquity, ecliptical2equatorial, ) """ @@ -96,7 +96,7 @@ [0, 2, 1, 0, -323.0, 1165.0], [1, 1, -1, 0, 299.0, 0.0], [2, 0, 3, 0, 294.0, 0.0], - [2, 0, -1, -2, 0.0, 8752.0] + [2, 0, -1, -2, 0.0, 8752.0], ] """This table contains the periodic terms for the longitude (Sigmal) and distance (Sigmar) of the Moon. Units are 0.000001 degree for Sigmal, and 0.001 @@ -217,25 +217,45 @@ def geocentric_ecliptical_pos(epoch): # Get the time from J2000.0 in Julian centuries t = (epoch - JDE2000) / 36525.0 # Compute Moon's mean longitude, referred to mean equinox of date - Lprime = 218.3164477 + (481267.88123421 - + (-0.0015786 - + (1.0/538841.0 - - t/65194000.0) * t) * t) * t + Lprime = 218.3164477 + ( + 481267.88123421 + + ( + -0.0015786 + + ( + 1.0/538841.0 + - t/65194000.0 + ) * t + ) * t + ) * t # Mean elongation of the Moon - D = 297.8501921 + (445267.1114034 - + (-0.0018819 - + (1.0/545868.0 - t/113065000.0) * t) * t) * t + D = 297.8501921 + ( + 445267.1114034 + + ( + -0.0018819 + + (1.0/545868.0 - t/113065000.0) * t + ) * t + ) * t # Sun's mean anomaly M = 357.5291092 + (35999.0502909 + (-0.0001536 + t/24490000.0) * t) * t # Moon's mean anomaly - Mprime = 134.9633964 + (477198.8675055 - + (0.0087414 - + (1.0/69699.9 - + t/14712000.0) * t) * t) * t + Mprime = 134.9633964 + ( + 477198.8675055 + + ( + 0.0087414 + + ( + 1.0/69699.9 + + t/14712000.0 + ) * t + ) * t + ) * t # Moon's argument of latitude - F = 93.2720950 + (483202.0175233 - + (-0.0036539 - + (-1.0/3526000.0 + t/863310000.0) * t) * t) * t + F = 93.2720950 + ( + 483202.0175233 + + ( + -0.0036539 + + (-1.0/3526000.0 + t/863310000.0) * t + ) * t + ) * t # Let's compute some additional arguments A1 = 119.75 + 131.849 * t A2 = 53.09 + 479264.290 * t @@ -281,8 +301,10 @@ def geocentric_ecliptical_pos(epoch): sigmal += coeffl * sin(argument) sigmar += coeffr * cos(argument) # Add the additive terms to sigmal - sigmal += (3958.0 * sin(A1r) + 1962.0 * sin(Lprimer - Fr) - + 318.0 * sin(A2r)) + sigmal += ( + 3958.0 * sin(A1r) + 1962.0 * sin(Lprimer - Fr) + + 318.0 * sin(A2r) + ) # Now use the tabla for sigmab sigmab = 0.0 for i, value in enumerate(PERIODIC_TERMS_B_TABLE): @@ -297,10 +319,12 @@ def geocentric_ecliptical_pos(epoch): coeffb = coeffb * E2 sigmab += coeffb * sin(argument) # Add the additive terms to sigmab - sigmab += (-2235.0 * sin(Lprimer) + 382.0 * sin(A3r) - + 175.0 * sin(A1r - Fr) + 175.0 * sin(A1r + Fr) - + 127.0 * sin(Lprimer - Mprimer) - - 115.0 * sin(Lprimer + Mprimer)) + sigmab += ( + -2235.0 * sin(Lprimer) + 382.0 * sin(A3r) + + 175.0 * sin(A1r - Fr) + 175.0 * sin(A1r + Fr) + + 127.0 * sin(Lprimer - Mprimer) + - 115.0 * sin(Lprimer + Mprimer) + ) Lambda = Lprime + (sigmal / 1000000.0) Beta = Angle(sigmab / 1000000.0) Delta = 385000.56 + (sigmar / 1000.0) @@ -440,10 +464,16 @@ def longitude_mean_ascending_node(epoch): # Get the time from J2000.0 in Julian centuries t = (epoch - JDE2000) / 36525.0 # Compute Moon's longitude of the mean ascending node - Omega = 125.0445479 + (-1934.1362891 - + (0.0020754 - + (1.0/476441.0 - - t/60616000.0) * t) * t) * t + Omega = 125.0445479 + ( + -1934.1362891 + + ( + 0.0020754 + + ( + 1.0/476441.0 + - t/60616000.0 + ) * t + ) * t + ) * t Omega = Angle(Omega).to_positive() return Omega @@ -475,20 +505,34 @@ def longitude_true_ascending_node(epoch): # Get the time from J2000.0 in Julian centuries t = (epoch - JDE2000) / 36525.0 # Mean elongation of the Moon - D = 297.8501921 + (445267.1114034 - + (-0.0018819 - + (1.0/545868.0 - t/113065000.0) * t) * t) * t + D = 297.8501921 + ( + 445267.1114034 + + ( + -0.0018819 + + (1.0/545868.0 - t/113065000.0) * t + ) * t + ) * t # Sun's mean anomaly M = 357.5291092 + (35999.0502909 + (-0.0001536 + t/24490000.0) * t) * t # Moon's mean anomaly - Mprime = 134.9633964 + (477198.8675055 - + (0.0087414 - + (1.0/69699.9 - + t/14712000.0) * t) * t) * t + Mprime = 134.9633964 + ( + 477198.8675055 + + ( + 0.0087414 + + ( + 1.0/69699.9 + + t/14712000.0 + ) * t + ) * t + ) * t # Moon's argument of latitude - F = 93.2720950 + (483202.0175233 - + (-0.0036539 - + (-1.0/3526000.0 + t/863310000.0) * t) * t) * t + F = 93.2720950 + ( + 483202.0175233 + + ( + -0.0036539 + + (-1.0/3526000.0 + t/863310000.0) * t + ) * t + ) * t # Reduce the angles to a [0 360] range D = Angle(Angle.reduce_deg(D)).to_positive() Dr = D.rad() @@ -499,9 +543,11 @@ def longitude_true_ascending_node(epoch): F = Angle(Angle.reduce_deg(F)).to_positive() Fr = F.rad() # Compute the periodic terms - corr = (-1.4979 * sin(2.0 * (Dr - Fr)) - 0.15 * sin(Mr) - - 0.1226 * sin(2.0 * Dr) + 0.1176 * sin(2.0 * Fr) - - 0.0801 * sin(2.0 * (Mprimer - Fr))) + corr = ( + -1.4979 * sin(2.0 * (Dr - Fr)) - 0.15 * sin(Mr) + - 0.1226 * sin(2.0 * Dr) + 0.1176 * sin(2.0 * Fr) + - 0.0801 * sin(2.0 * (Mprimer - Fr)) + ) Omega += Angle(corr) return Omega @@ -531,9 +577,13 @@ def longitude_mean_perigee(epoch): # Get the time from J2000.0 in Julian centuries t = (epoch - JDE2000) / 36525.0 # Compute Moon's longitude of the mean perigee - ppii = 83.3532465 + (4069.0137287 - + (-0.01032 - + (-1.0/80053.0 + t/18999000.0) * t) * t) * t + ppii = 83.3532465 + ( + 4069.0137287 + + ( + -0.01032 + + (-1.0/80053.0 + t/18999000.0) * t + ) * t + ) * t ppii = Angle(ppii) return ppii @@ -563,16 +613,26 @@ def illuminated_fraction_disk(epoch): # Get the time from J2000.0 in Julian centuries t = (epoch - JDE2000) / 36525.0 # Mean elongation of the Moon - D = 297.8501921 + (445267.1114034 - + (-0.0018819 - + (1.0/545868.0 - t/113065000.0) * t) * t) * t + D = 297.8501921 + ( + 445267.1114034 + + ( + -0.0018819 + + (1.0/545868.0 - t/113065000.0) * t + ) * t + ) * t # Sun's mean anomaly M = 357.5291092 + (35999.0502909 + (-0.0001536 + t/24490000.0) * t) * t # Moon's mean anomaly - Mprime = 134.9633964 + (477198.8675055 - + (0.0087414 - + (1.0/69699.9 - + t/14712000.0) * t) * t) * t + Mprime = 134.9633964 + ( + 477198.8675055 + + ( + 0.0087414 + + ( + 1.0/69699.9 + + t/14712000.0 + ) * t + ) * t + ) * t # Reduce the angles to a [0 360] range D = Angle(Angle.reduce_deg(D)).to_positive() Dr = D.rad() @@ -581,9 +641,11 @@ def illuminated_fraction_disk(epoch): Mprime = Angle(Angle.reduce_deg(Mprime)).to_positive() Mprimer = Mprime.rad() # Compute the 'i' angle - i = Angle(180.0 - D - 6.289 * sin(Mprimer) + 2.1 * sin(Mr) - - 1.274 * sin(2.0 * Dr - Mprimer) - 0.658 * sin(2.0 * Dr) - - 0.214 * sin(2.0 * Mprimer) - 0.11 * sin(Dr)) + i = Angle( + 180.0 - D - 6.289 * sin(Mprimer) + 2.1 * sin(Mr) + - 1.274 * sin(2.0 * Dr - Mprimer) - 0.658 * sin(2.0 * Dr) + - 0.214 * sin(2.0 * Mprimer) - 0.11 * sin(Dr), + ) k = (1.0 + cos(i.rad())) / 2.0 return k @@ -686,21 +748,29 @@ def moon_phase(epoch, target="new"): k += 0.75 t = k / 1236.85 # Compute the time of the 'mean' phase of the Moon - jde = (2451550.09766 + 29.530588861 * k - + (0.00015437 + (-0.00000015 + 0.00000000073 * t) * t) * t * t) + jde = ( + 2451550.09766 + 29.530588861 * k + + (0.00015437 + (-0.00000015 + 0.00000000073 * t) * t) * t * t + ) # Eccentricity of Earth's orbit around the Sun E = 1.0 + (-0.002516 - 0.0000074 * t) * t # Sun's mean anomaly M = 2.5534 + 29.1053567 * k + (-0.0000014 - 0.00000011 * t) * t * t # Moon's mean anomaly - Mprime = (201.5643 + 385.81693528 * k - + (0.0107582 + (0.00001238 - 0.000000058 * t) * t) * t * t) + Mprime = ( + 201.5643 + 385.81693528 * k + + (0.0107582 + (0.00001238 - 0.000000058 * t) * t) * t * t + ) # Moon's argument of latitude - F = (160.7108 + 390.67050284 * k - + (-0.0016118 + (-0.00000227 + 0.000000011 * t) * t) * t * t) + F = ( + 160.7108 + 390.67050284 * k + + (-0.0016118 + (-0.00000227 + 0.000000011 * t) * t) * t * t + ) # Longitude of the ascending node of the lunar orbit - Omega = (124.7746 - 1.56375588 * k - + (0.0020672 + 0.00000215 * t) * t * t) + Omega = ( + 124.7746 - 1.56375588 * k + + (0.0020672 + 0.00000215 * t) * t * t + ) M = Angle(Angle.reduce_deg(M)).to_positive() Mr = M.rad() Mprime = Angle(Angle.reduce_deg(Mprime)).to_positive() @@ -756,88 +826,98 @@ def moon_phase(epoch, target="new"): corr = 0.0 w = 0.0 if target == "new": - corr = (-0.4072 * sin(Mprimer) + 0.17241 * E * sin(Mr) - + 0.01608 * sin(2.0 * Mprimer) + 0.01039 * sin(2.0 * Fr) - + 0.00739 * E * sin(Mprimer - Mr) - - 0.00514 * E * sin(Mprimer + Mr) - + 0.00208 * E * E * sin(2.0 * Mr) - - 0.00111 * sin(Mprimer - 2.0 * Fr) - - 0.00057 * sin(Mprimer + 2.0 * Fr) - + 0.00056 * E * sin(2.0 * Mprimer + Mr) - - 0.00042 * sin(3.0 * Mprimer) - + 0.00042 * E * sin(Mr + 2.0 * Fr) - + 0.00038 * E * sin(Mr - 2.0 * Fr) - - 0.00024 * E * sin(2.0 * Mprimer - Mr) - - 0.00017 * sin(Omegar) - 0.00007 * sin(Mprimer + 2.0 * Mr) - + 0.00004 * sin(2.0 * (Mprimer - Fr)) - + 0.00004 * sin(3.0 * Mr) - + 0.00003 * sin(Mprimer + Mr - 2.0 * Fr) - + 0.00003 * sin(2.0 * (Mprimer + Fr)) - - 0.00003 * sin(Mprimer + Mr + 2.0 * Fr) - + 0.00003 * sin(Mprimer - Mr + 2.0 * Fr) - - 0.00002 * sin(Mprimer - Mr - 2.0 * Fr) - - 0.00002 * sin(3.0 * Mprimer + Mr) - + 0.00002 * sin(4.0 * Mprimer)) + corr = ( + -0.4072 * sin(Mprimer) + 0.17241 * E * sin(Mr) + + 0.01608 * sin(2.0 * Mprimer) + 0.01039 * sin(2.0 * Fr) + + 0.00739 * E * sin(Mprimer - Mr) + - 0.00514 * E * sin(Mprimer + Mr) + + 0.00208 * E * E * sin(2.0 * Mr) + - 0.00111 * sin(Mprimer - 2.0 * Fr) + - 0.00057 * sin(Mprimer + 2.0 * Fr) + + 0.00056 * E * sin(2.0 * Mprimer + Mr) + - 0.00042 * sin(3.0 * Mprimer) + + 0.00042 * E * sin(Mr + 2.0 * Fr) + + 0.00038 * E * sin(Mr - 2.0 * Fr) + - 0.00024 * E * sin(2.0 * Mprimer - Mr) + - 0.00017 * sin(Omegar) - 0.00007 * sin(Mprimer + 2.0 * Mr) + + 0.00004 * sin(2.0 * (Mprimer - Fr)) + + 0.00004 * sin(3.0 * Mr) + + 0.00003 * sin(Mprimer + Mr - 2.0 * Fr) + + 0.00003 * sin(2.0 * (Mprimer + Fr)) + - 0.00003 * sin(Mprimer + Mr + 2.0 * Fr) + + 0.00003 * sin(Mprimer - Mr + 2.0 * Fr) + - 0.00002 * sin(Mprimer - Mr - 2.0 * Fr) + - 0.00002 * sin(3.0 * Mprimer + Mr) + + 0.00002 * sin(4.0 * Mprimer) + ) elif target == "full": - corr = (-0.40614 * sin(Mprimer) + 0.17302 * E * sin(Mr) - + 0.01614 * sin(2.0 * Mprimer) + 0.01043 * sin(2.0 * Fr) - + 0.00734 * E * sin(Mprimer - Mr) - - 0.00515 * E * sin(Mprimer + Mr) - + 0.00209 * E * E * sin(2.0 * Mr) - - 0.00111 * sin(Mprimer - 2.0 * Fr) - - 0.00057 * sin(Mprimer + 2.0 * Fr) - + 0.00056 * E * sin(2.0 * Mprimer + Mr) - - 0.00042 * sin(3.0 * Mprimer) - + 0.00042 * E * sin(Mr + 2.0 * Fr) - + 0.00038 * E * sin(Mr - 2.0 * Fr) - - 0.00024 * E * sin(2.0 * Mprimer - Mr) - - 0.00017 * sin(Omegar) - 0.00007 * sin(Mprimer + 2.0 * Mr) - + 0.00004 * sin(2.0 * (Mprimer - Fr)) - + 0.00004 * sin(3.0 * Mr) - + 0.00003 * sin(Mprimer + Mr - 2.0 * Fr) - + 0.00003 * sin(2.0 * (Mprimer + Fr)) - - 0.00003 * sin(Mprimer + Mr + 2.0 * Fr) - + 0.00003 * sin(Mprimer - Mr + 2.0 * Fr) - - 0.00002 * sin(Mprimer - Mr - 2.0 * Fr) - - 0.00002 * sin(3.0 * Mprimer + Mr) - + 0.00002 * sin(4.0 * Mprimer)) + corr = ( + -0.40614 * sin(Mprimer) + 0.17302 * E * sin(Mr) + + 0.01614 * sin(2.0 * Mprimer) + 0.01043 * sin(2.0 * Fr) + + 0.00734 * E * sin(Mprimer - Mr) + - 0.00515 * E * sin(Mprimer + Mr) + + 0.00209 * E * E * sin(2.0 * Mr) + - 0.00111 * sin(Mprimer - 2.0 * Fr) + - 0.00057 * sin(Mprimer + 2.0 * Fr) + + 0.00056 * E * sin(2.0 * Mprimer + Mr) + - 0.00042 * sin(3.0 * Mprimer) + + 0.00042 * E * sin(Mr + 2.0 * Fr) + + 0.00038 * E * sin(Mr - 2.0 * Fr) + - 0.00024 * E * sin(2.0 * Mprimer - Mr) + - 0.00017 * sin(Omegar) - 0.00007 * sin(Mprimer + 2.0 * Mr) + + 0.00004 * sin(2.0 * (Mprimer - Fr)) + + 0.00004 * sin(3.0 * Mr) + + 0.00003 * sin(Mprimer + Mr - 2.0 * Fr) + + 0.00003 * sin(2.0 * (Mprimer + Fr)) + - 0.00003 * sin(Mprimer + Mr + 2.0 * Fr) + + 0.00003 * sin(Mprimer - Mr + 2.0 * Fr) + - 0.00002 * sin(Mprimer - Mr - 2.0 * Fr) + - 0.00002 * sin(3.0 * Mprimer + Mr) + + 0.00002 * sin(4.0 * Mprimer) + ) elif target == "first" or target == "last": - corr = (-0.62801 * sin(Mprimer) + 0.17172 * E * sin(Mr) - - 0.01183 * E * sin(Mprimer + Mr) - + 0.00862 * sin(2.0 * Mprimer) + 0.00804 * sin(2.0 * Fr) - + 0.00454 * E * sin(Mprimer - Mr) - + 0.00204 * E * E * sin(2.0 * Mr) - - 0.0018 * sin(Mprimer - 2.0 * Fr) - - 0.0007 * sin(Mprimer + 2.0 * Fr) - - 0.0004 * sin(3.0 * Mprimer) - - 0.00034 * E * sin(2.0 * Mprimer - Mr) - + 0.00032 * E * sin(Mr + 2.0 * Fr) - + 0.00032 * E * sin(Mr - 2.0 * Fr) - - 0.00028 * E * E * sin(Mprimer + 2.0 * Mr) - + 0.00027 * E * sin(2.0 * Mprimer + Mr) - - 0.00017 * sin(Omegar) - - 0.00005 * sin(Mprimer - Mr - 2.0 * Fr) - + 0.00004 * sin(2.0 * (Mprimer + Fr)) - - 0.00004 * sin(Mprimer + Mr + 2.0 * Fr) - + 0.00004 * sin(Mprimer - 2.0 * Mr) - + 0.00003 * sin(Mprimer + Mr - 2.0 * Fr) - + 0.00003 * sin(3.0 * Mr) - + 0.00002 * sin(2.0 * (Mprimer - Fr)) - + 0.00002 * sin(Mprimer - Mr + 2.0 * Fr) - - 0.00002 * sin(3.0 * Mprimer + Mr)) - w = (0.00306 - 0.00038 * E * cos(Mr) + 0.00026 * cos(Mprimer) - - 0.00002 * cos(Mprimer - Mr) + 0.00002 * cos(Mprimer + Mr) - + 0.00002 * cos(2.0 * Fr)) + corr = ( + -0.62801 * sin(Mprimer) + 0.17172 * E * sin(Mr) + - 0.01183 * E * sin(Mprimer + Mr) + + 0.00862 * sin(2.0 * Mprimer) + 0.00804 * sin(2.0 * Fr) + + 0.00454 * E * sin(Mprimer - Mr) + + 0.00204 * E * E * sin(2.0 * Mr) + - 0.0018 * sin(Mprimer - 2.0 * Fr) + - 0.0007 * sin(Mprimer + 2.0 * Fr) + - 0.0004 * sin(3.0 * Mprimer) + - 0.00034 * E * sin(2.0 * Mprimer - Mr) + + 0.00032 * E * sin(Mr + 2.0 * Fr) + + 0.00032 * E * sin(Mr - 2.0 * Fr) + - 0.00028 * E * E * sin(Mprimer + 2.0 * Mr) + + 0.00027 * E * sin(2.0 * Mprimer + Mr) + - 0.00017 * sin(Omegar) + - 0.00005 * sin(Mprimer - Mr - 2.0 * Fr) + + 0.00004 * sin(2.0 * (Mprimer + Fr)) + - 0.00004 * sin(Mprimer + Mr + 2.0 * Fr) + + 0.00004 * sin(Mprimer - 2.0 * Mr) + + 0.00003 * sin(Mprimer + Mr - 2.0 * Fr) + + 0.00003 * sin(3.0 * Mr) + + 0.00002 * sin(2.0 * (Mprimer - Fr)) + + 0.00002 * sin(Mprimer - Mr + 2.0 * Fr) + - 0.00002 * sin(3.0 * Mprimer + Mr) + ) + w = ( + 0.00306 - 0.00038 * E * cos(Mr) + 0.00026 * cos(Mprimer) + - 0.00002 * cos(Mprimer - Mr) + 0.00002 * cos(Mprimer + Mr) + + 0.00002 * cos(2.0 * Fr) + ) if target == "last": w = -w # Additional corrections for all phases - corr2 = (0.000325 * sin(a1r) + 0.000165 * sin(a2r) - + 0.000164 * sin(a3r) + 0.000126 * sin(a4r) - + 0.000110 * sin(a5r) + 0.000062 * sin(a6r) - + 0.000060 * sin(a7r) + 0.000056 * sin(a8r) - + 0.000047 * sin(a9r) + 0.000042 * sin(a10r) - + 0.000040 * sin(a11r) + 0.000037 * sin(a12r) - + 0.000035 * sin(a13r) + 0.000023 * sin(a14r)) + corr2 = ( + 0.000325 * sin(a1r) + 0.000165 * sin(a2r) + + 0.000164 * sin(a3r) + 0.000126 * sin(a4r) + + 0.000110 * sin(a5r) + 0.000062 * sin(a6r) + + 0.000060 * sin(a7r) + 0.000056 * sin(a8r) + + 0.000047 * sin(a9r) + 0.000042 * sin(a10r) + + 0.000040 * sin(a11r) + 0.000037 * sin(a12r) + + 0.000035 * sin(a13r) + 0.000023 * sin(a14r) + ) jde += corr + corr2 + w jde = Epoch(jde) return jde @@ -894,11 +974,15 @@ def moon_perigee_apogee(epoch, target="perigee"): k += 0.5 t = k / 1325.55 # Compute the time of the 'mean' perigee or apogee - jde = (2451534.6698 + 27.55454989 * k - + (-0.0006691 + (0.000001098 + 0.0000000052 * t) * t) * t * t) + jde = ( + 2451534.6698 + 27.55454989 * k + + (-0.0006691 + (0.000001098 + 0.0000000052 * t) * t) * t * t + ) # Moon's mean elongation at jde - D = (171.9179 + 335.9106046 * k - + (-0.0100383 + (-0.00001156 + 0.000000055 * t) * t) * t * t) + D = ( + 171.9179 + 335.9106046 * k + + (-0.0100383 + (-0.00001156 + 0.000000055 * t) * t) * t * t + ) # Sun's mean anomaly M = 347.3477 + 27.1577721 * k + (-0.000813 - 0.000001 * t) * t * t # Moon's argument of latitude @@ -912,121 +996,129 @@ def moon_perigee_apogee(epoch, target="perigee"): corr = 0.0 parallax = 0.0 if target == "perigee": - corr = (-1.6769 * sin(2.0 * Dr) + 0.4589 * sin(4.0 * Dr) - - 0.1856 * sin(6.0 * Dr) + 0.0883 * sin(8.0 * Dr) - + (-0.0773 + 0.00019 * t) * sin(2.0 * Dr - Mr) - + (0.0502 - 0.00013 * t) * sin(Mr) - 0.046 * sin(10.0 * Dr) - + (0.0422 - 0.00011 * t) * sin(4.0 * Dr - Mr) - - 0.0256 * sin(6.0 * Dr - Mr) + 0.0253 * sin(12.0 * Dr) - + 0.0237 * sin(Dr) + 0.0162 * sin(8.0 * Dr - Mr) - - 0.0145 * sin(14.0 * Dr) + 0.0129 * sin(2.0 * Fr) - - 0.0112 * sin(3.0 * Dr) - 0.0104 * sin(10.0 * Dr - Mr) - + 0.0086 * sin(16.0 * Dr) + 0.0069 * sin(12.0 * Dr - Mr) - + 0.0066 * sin(5.0 * Dr) - 0.0053 * sin(2.0 * (Dr + Fr)) - - 0.0052 * sin(18.0 * Dr) - 0.0046 * sin(14.0 * Dr - Mr) - - 0.0041 * sin(7.0 * Dr) + 0.004 * sin(2.0 * Dr + Mr) - + 0.0032 * sin(20.0 * Dr) - 0.0032 * sin(Dr + Mr) - + 0.0031 * sin(16.0 * Dr - Mr) - - 0.0029 * sin(4.0 * Dr + Mr) + 0.0027 * sin(9.0 * Dr) - + 0.0027 * sin(4.0 * Dr + 2.0 * Fr) - - 0.0027 * sin(2.0 * (Dr - Mr)) - + 0.0024 * sin(4.0 * Dr - 2.0 * Mr) - - 0.0021 * sin(6.0 * Dr - 2.0 * Mr) - - 0.0021 * sin(22.0 * Dr) - 0.0021 * sin(18.0 * Dr - Mr) - + 0.0019 * sin(6.0 * Dr + Mr) - 0.0018 * sin(11.0 * Dr) - - 0.0014 * sin(8.0 * Dr + Mr) - - 0.0014 * sin(4.0 * Dr - 2.0 * Fr) - - 0.0014 * sin(6.0 * Dr + 2.0 * Fr) - + 0.0014 * sin(3.0 * Dr + Mr) - 0.0014 * sin(5.0 * Dr + Mr) - + 0.0013 * sin(13.0 * Dr) + 0.0013 * sin(20.0 * Dr - Mr) - + 0.0011 * sin(3.0 * Dr + 2.0 * Mr) - - 0.0011 * sin(4.0 * Dr + 2.0 * Fr - 2.0 * Mr) - - 0.0010 * sin(Dr + 2.0 * Mr) - - 0.0009 * sin(22.0 * Dr - Mr) - 0.0008 * sin(4.0 * Fr) - + 0.0008 * sin(6.0 * Dr - 2.0 * Fr) - + 0.0008 * sin(2.0 * Dr - 2.0 * Fr + Mr) - + 0.0007 * sin(2.0 * Mr) + 0.0007 * sin(2.0 * Fr - Mr) - + 0.0007 * sin(2.0 * Dr + 4.0 * Fr) - - 0.0006 * sin(2.0 * (Fr - Mr)) - - 0.0006 * sin(2.0 * (Dr - Fr + Mr)) - + 0.0006 * sin(24.0 * Dr) + 0.0005 * sin(4.0 * (Dr - Fr)) - + 0.0005 * sin(2.0 * (Dr + Mr)) - 0.0004 * sin(Dr - Mr)) - parallax = (3629.215 + 63.224 * cos(2.0 * Dr) - - 6.99 * cos(4.0 * Dr) - + (2.834 - 0.0071 * t) * cos(2.0 * Dr - Mr) - + 1.927 * cos(6.0 * Dr) - 1.263 * cos(Dr) - - 0.702 * cos(8.0 * Dr) - + (0.696 - 0.0017 * t) * cos(Mr) - 0.69 * cos(2.0 * Fr) - + (-0.629 + 0.0016 * t) * cos(4.0 * Dr - Mr) - - 0.392 * cos(2.0 * (Dr - Fr)) + 0.297 * cos(10.0 * Dr) - + 0.26 * cos(6.0 * Dr - Mr) + 0.201 * cos(3.0 * Dr) - - 0.161 * cos(2.0 * Dr + Mr) + 0.157 * cos(Dr + Mr) - - 0.138 * cos(12.0 * Dr) - 0.127 * cos(8.0 * Dr - Mr) - + 0.104 * cos(2.0 * (Dr + Fr)) - + 0.104 * cos(2.0 * (Dr - Mr)) - 0.079 * cos(5.0 * Dr) - + 0.068 * cos(14.0 * Dr) + 0.067 * cos(10.0 * Dr - Mr) - + 0.054 * cos(4.0 * Dr + Mr) - - 0.038 * cos(12.0 * Dr - Mr) - - 0.038 * cos(4.0 * Dr - 2.0 * Mr) - + 0.037 * cos(7.0 * Dr) - - 0.037 * cos(4.0 * Dr + 2.0 * Fr) - - 0.035 * cos(16.0 * Dr) - 0.03 * cos(3.0 * Dr + Mr) - + 0.029 * cos(Dr - Mr) - 0.025 * cos(6.0 * Dr + Mr) - + 0.023 * cos(2.0 * Mr) + 0.023 * cos(14.0 * Dr - Mr) - - 0.023 * cos(2.0 * (Dr + Mr)) - + 0.022 * cos(6.0 * Dr - 2.0 * Mr) - - 0.021 * cos(2.0 * (Dr - Fr) - Mr) - - 0.020 * cos(9.0 * Dr) + 0.019 * cos(18.0 * Dr) - + 0.017 * cos(6.0 * Dr + 2.0 * Fr) - + 0.014 * cos(2.0 * Fr - Mr) - - 0.014 * cos(16.0 * Dr - Mr) - + 0.013 * cos(4.0 * Dr - 2.0 * Fr) - + 0.012 * cos(8.0 * Dr + Mr) + 0.011 * cos(11.0 * Dr) - + 0.01 * cos(5.0 * Dr + Mr) - 0.01 * cos(20.0 * Dr)) + corr = ( + -1.6769 * sin(2.0 * Dr) + 0.4589 * sin(4.0 * Dr) + - 0.1856 * sin(6.0 * Dr) + 0.0883 * sin(8.0 * Dr) + + (-0.0773 + 0.00019 * t) * sin(2.0 * Dr - Mr) + + (0.0502 - 0.00013 * t) * sin(Mr) - 0.046 * sin(10.0 * Dr) + + (0.0422 - 0.00011 * t) * sin(4.0 * Dr - Mr) + - 0.0256 * sin(6.0 * Dr - Mr) + 0.0253 * sin(12.0 * Dr) + + 0.0237 * sin(Dr) + 0.0162 * sin(8.0 * Dr - Mr) + - 0.0145 * sin(14.0 * Dr) + 0.0129 * sin(2.0 * Fr) + - 0.0112 * sin(3.0 * Dr) - 0.0104 * sin(10.0 * Dr - Mr) + + 0.0086 * sin(16.0 * Dr) + 0.0069 * sin(12.0 * Dr - Mr) + + 0.0066 * sin(5.0 * Dr) - 0.0053 * sin(2.0 * (Dr + Fr)) + - 0.0052 * sin(18.0 * Dr) - 0.0046 * sin(14.0 * Dr - Mr) + - 0.0041 * sin(7.0 * Dr) + 0.004 * sin(2.0 * Dr + Mr) + + 0.0032 * sin(20.0 * Dr) - 0.0032 * sin(Dr + Mr) + + 0.0031 * sin(16.0 * Dr - Mr) + - 0.0029 * sin(4.0 * Dr + Mr) + 0.0027 * sin(9.0 * Dr) + + 0.0027 * sin(4.0 * Dr + 2.0 * Fr) + - 0.0027 * sin(2.0 * (Dr - Mr)) + + 0.0024 * sin(4.0 * Dr - 2.0 * Mr) + - 0.0021 * sin(6.0 * Dr - 2.0 * Mr) + - 0.0021 * sin(22.0 * Dr) - 0.0021 * sin(18.0 * Dr - Mr) + + 0.0019 * sin(6.0 * Dr + Mr) - 0.0018 * sin(11.0 * Dr) + - 0.0014 * sin(8.0 * Dr + Mr) + - 0.0014 * sin(4.0 * Dr - 2.0 * Fr) + - 0.0014 * sin(6.0 * Dr + 2.0 * Fr) + + 0.0014 * sin(3.0 * Dr + Mr) - 0.0014 * sin(5.0 * Dr + Mr) + + 0.0013 * sin(13.0 * Dr) + 0.0013 * sin(20.0 * Dr - Mr) + + 0.0011 * sin(3.0 * Dr + 2.0 * Mr) + - 0.0011 * sin(4.0 * Dr + 2.0 * Fr - 2.0 * Mr) + - 0.0010 * sin(Dr + 2.0 * Mr) + - 0.0009 * sin(22.0 * Dr - Mr) - 0.0008 * sin(4.0 * Fr) + + 0.0008 * sin(6.0 * Dr - 2.0 * Fr) + + 0.0008 * sin(2.0 * Dr - 2.0 * Fr + Mr) + + 0.0007 * sin(2.0 * Mr) + 0.0007 * sin(2.0 * Fr - Mr) + + 0.0007 * sin(2.0 * Dr + 4.0 * Fr) + - 0.0006 * sin(2.0 * (Fr - Mr)) + - 0.0006 * sin(2.0 * (Dr - Fr + Mr)) + + 0.0006 * sin(24.0 * Dr) + 0.0005 * sin(4.0 * (Dr - Fr)) + + 0.0005 * sin(2.0 * (Dr + Mr)) - 0.0004 * sin(Dr - Mr) + ) + parallax = ( + 3629.215 + 63.224 * cos(2.0 * Dr) + - 6.99 * cos(4.0 * Dr) + + (2.834 - 0.0071 * t) * cos(2.0 * Dr - Mr) + + 1.927 * cos(6.0 * Dr) - 1.263 * cos(Dr) + - 0.702 * cos(8.0 * Dr) + + (0.696 - 0.0017 * t) * cos(Mr) - 0.69 * cos(2.0 * Fr) + + (-0.629 + 0.0016 * t) * cos(4.0 * Dr - Mr) + - 0.392 * cos(2.0 * (Dr - Fr)) + 0.297 * cos(10.0 * Dr) + + 0.26 * cos(6.0 * Dr - Mr) + 0.201 * cos(3.0 * Dr) + - 0.161 * cos(2.0 * Dr + Mr) + 0.157 * cos(Dr + Mr) + - 0.138 * cos(12.0 * Dr) - 0.127 * cos(8.0 * Dr - Mr) + + 0.104 * cos(2.0 * (Dr + Fr)) + + 0.104 * cos(2.0 * (Dr - Mr)) - 0.079 * cos(5.0 * Dr) + + 0.068 * cos(14.0 * Dr) + 0.067 * cos(10.0 * Dr - Mr) + + 0.054 * cos(4.0 * Dr + Mr) + - 0.038 * cos(12.0 * Dr - Mr) + - 0.038 * cos(4.0 * Dr - 2.0 * Mr) + + 0.037 * cos(7.0 * Dr) + - 0.037 * cos(4.0 * Dr + 2.0 * Fr) + - 0.035 * cos(16.0 * Dr) - 0.03 * cos(3.0 * Dr + Mr) + + 0.029 * cos(Dr - Mr) - 0.025 * cos(6.0 * Dr + Mr) + + 0.023 * cos(2.0 * Mr) + 0.023 * cos(14.0 * Dr - Mr) + - 0.023 * cos(2.0 * (Dr + Mr)) + + 0.022 * cos(6.0 * Dr - 2.0 * Mr) + - 0.021 * cos(2.0 * (Dr - Fr) - Mr) + - 0.020 * cos(9.0 * Dr) + 0.019 * cos(18.0 * Dr) + + 0.017 * cos(6.0 * Dr + 2.0 * Fr) + + 0.014 * cos(2.0 * Fr - Mr) + - 0.014 * cos(16.0 * Dr - Mr) + + 0.013 * cos(4.0 * Dr - 2.0 * Fr) + + 0.012 * cos(8.0 * Dr + Mr) + 0.011 * cos(11.0 * Dr) + + 0.01 * cos(5.0 * Dr + Mr) - 0.01 * cos(20.0 * Dr) + ) else: - corr = (0.4392 * sin(2.0 * Dr) - + 0.0684 * sin(4.0 * Dr) - + (0.0456 - 0.00011 * t) * sin(Mr) - + (0.0426 - 0.00011 * t) * sin(2.0 * Dr - Mr) - + 0.0212 * sin(2.0 * Fr) - - 0.0189 * sin(Dr) - + 0.0144 * sin(6.0 * Dr) - + 0.0113 * sin(4.0 * Dr - Mr) - + 0.0047 * sin(2.0 * (Dr + Fr)) - + 0.0036 * sin(Dr + Mr) - + 0.0035 * sin(8.0 * Dr) - + 0.0034 * sin(6.0 * Dr - Mr) - - 0.0034 * sin(2.0 * (Dr - Fr)) - + 0.0022 * sin(2.0 * (Dr - Mr)) - - 0.0017 * sin(3.0 * Dr) - + 0.0013 * sin(4.0 * Dr + 2.0 * Fr) - + 0.0011 * sin(8.0 * Dr - Mr) - + 0.0010 * sin(4.0 * Dr - 2.0 * Mr) - + 0.0009 * sin(10.0 * Dr) - + 0.0007 * sin(3.0 * Dr + Mr) - + 0.0006 * sin(2.0 * Mr) - + 0.0005 * sin(2.0 * Dr + Mr) - + 0.0005 * sin(2.0 * (Dr + Mr)) - + 0.0004 * sin(6.0 * Dr + 2.0 * Fr) - + 0.0004 * sin(6.0 * Dr - 2.0 * Mr) - + 0.0004 * sin(10.0 * Dr - Mr) - - 0.0004 * sin(5.0 * Dr) - - 0.0004 * sin(4.0 * Dr - 2.0 * Fr) - + 0.0003 * sin(2.0 * Fr + Mr) - + 0.0003 * sin(12.0 * Dr) - + 0.0003 * sin(2.0 * (Dr + Fr) - Mr) - - 0.0003 * sin(Dr - Mr)) - parallax = (3245.251 - 9.147 * cos(2.0 * Dr) - 0.841 * cos(Dr) - + 0.697 * cos(2.0 * Fr) - + (-0.656 + 0.0016 * t) * cos(Mr) - + 0.355 * cos(4.0 * Dr) + 0.159 * cos(2.0 * Dr - Mr) - + 0.127 * cos(Dr + Mr) + 0.065 * cos(4.0 * Dr - Mr) - + 0.052 * cos(6.0 * Dr) + 0.043 * cos(2.0 * Dr + Mr) - + 0.031 * cos(2.0 * (Dr + Fr)) - - 0.023 * cos(2.0 * (Dr - Fr)) - + 0.022 * cos(2.0 * (Dr - Mr)) - + 0.019 * cos(2.0 * (Dr + Mr)) - 0.016 * cos(2.0 * Mr) - + 0.014 * cos(6.0 * Dr - Mr) + 0.01 * cos(8.0 * Dr)) + corr = ( + 0.4392 * sin(2.0 * Dr) + + 0.0684 * sin(4.0 * Dr) + + (0.0456 - 0.00011 * t) * sin(Mr) + + (0.0426 - 0.00011 * t) * sin(2.0 * Dr - Mr) + + 0.0212 * sin(2.0 * Fr) + - 0.0189 * sin(Dr) + + 0.0144 * sin(6.0 * Dr) + + 0.0113 * sin(4.0 * Dr - Mr) + + 0.0047 * sin(2.0 * (Dr + Fr)) + + 0.0036 * sin(Dr + Mr) + + 0.0035 * sin(8.0 * Dr) + + 0.0034 * sin(6.0 * Dr - Mr) + - 0.0034 * sin(2.0 * (Dr - Fr)) + + 0.0022 * sin(2.0 * (Dr - Mr)) + - 0.0017 * sin(3.0 * Dr) + + 0.0013 * sin(4.0 * Dr + 2.0 * Fr) + + 0.0011 * sin(8.0 * Dr - Mr) + + 0.0010 * sin(4.0 * Dr - 2.0 * Mr) + + 0.0009 * sin(10.0 * Dr) + + 0.0007 * sin(3.0 * Dr + Mr) + + 0.0006 * sin(2.0 * Mr) + + 0.0005 * sin(2.0 * Dr + Mr) + + 0.0005 * sin(2.0 * (Dr + Mr)) + + 0.0004 * sin(6.0 * Dr + 2.0 * Fr) + + 0.0004 * sin(6.0 * Dr - 2.0 * Mr) + + 0.0004 * sin(10.0 * Dr - Mr) + - 0.0004 * sin(5.0 * Dr) + - 0.0004 * sin(4.0 * Dr - 2.0 * Fr) + + 0.0003 * sin(2.0 * Fr + Mr) + + 0.0003 * sin(12.0 * Dr) + + 0.0003 * sin(2.0 * (Dr + Fr) - Mr) + - 0.0003 * sin(Dr - Mr) + ) + parallax = ( + 3245.251 - 9.147 * cos(2.0 * Dr) - 0.841 * cos(Dr) + + 0.697 * cos(2.0 * Fr) + + (-0.656 + 0.0016 * t) * cos(Mr) + + 0.355 * cos(4.0 * Dr) + 0.159 * cos(2.0 * Dr - Mr) + + 0.127 * cos(Dr + Mr) + 0.065 * cos(4.0 * Dr - Mr) + + 0.052 * cos(6.0 * Dr) + 0.043 * cos(2.0 * Dr + Mr) + + 0.031 * cos(2.0 * (Dr + Fr)) + - 0.023 * cos(2.0 * (Dr - Fr)) + + 0.022 * cos(2.0 * (Dr - Mr)) + + 0.019 * cos(2.0 * (Dr + Mr)) - 0.016 * cos(2.0 * Mr) + + 0.014 * cos(6.0 * Dr - Mr) + 0.01 * cos(8.0 * Dr) + ) jde += corr jde = Epoch(jde) parallax = Angle(0, 0, parallax) @@ -1082,16 +1174,24 @@ def moon_passage_nodes(epoch, target="ascending"): k += 0.5 t = k / 1342.23 # Compute the time without the corrections - jde = (2451565.1619 + 27.212220817 * k - + (0.0002762 + (0.000000021 - 0.000000000088 * t) * t) * t * t) + jde = ( + 2451565.1619 + 27.212220817 * k + + (0.0002762 + (0.000000021 - 0.000000000088 * t) * t) * t * t + ) # Compute the following angles in degrees - D = (183.638 + 331.73735682 * k - + (0.0014852 + (0.00000209 - 0.00000001 * t) * t) * t * t) + D = ( + 183.638 + 331.73735682 * k + + (0.0014852 + (0.00000209 - 0.00000001 * t) * t) * t * t + ) M = 17.4006 + 26.8203725 * k + (0.0001186 + 0.00000006 * t) * t * t - Mprime = (38.3776 + 355.52747313 * k - + (0.0123499 + (0.000014627 - 0.000000069 * t) * t) * t * t) - Omega = (123.9767 - 1.44098956 * k - + (0.0020608 + (0.00000214 - 0.000000016 * t) * t) * t * t) + Mprime = ( + 38.3776 + 355.52747313 * k + + (0.0123499 + (0.000014627 - 0.000000069 * t) * t) * t * t + ) + Omega = ( + 123.9767 - 1.44098956 * k + + (0.0020608 + (0.00000214 - 0.000000016 * t) * t) * t * t + ) V = 299.75 + (132.85 - 0.009173 * t) * t P = Omega + 272.75 - 2.3 * t # Reduce the angles to the [0 360] range, and convert to radians @@ -1110,23 +1210,25 @@ def moon_passage_nodes(epoch, target="ascending"): # Eccentricity of Earth's orbit around the Sun E = 1.0 + (-0.002516 - 0.0000074 * t) * t # Compute the correction to jde - corr = (-0.4721 * sin(Mprimer) - 0.1649 * sin(2.0 * Dr) - - 0.0868 * sin(2.0 * Dr - Mprimer) - + 0.0084 * sin(2.0 * Dr + Mprimer) - - 0.0083 * E * sin(2.0 * Dr - Mr) - - 0.0039 * E * sin(2.0 * Dr - Mr - Mprimer) - + 0.0034 * sin(2.0 * Mprimer) - - 0.0031 * sin(2.0 * (Dr - Mprimer)) - + 0.0030 * E * sin(2.0 * Dr + Mr) - + 0.0028 * E * sin(Mr - Mprimer) + 0.0026 * E * sin(Mr) - + 0.0025 * sin(4.0 * Dr) + 0.0024 * sin(Dr) - + 0.0022 * E * sin(Mr + Mprimer) + 0.0017 * sin(Omegar) - + 0.0014 * sin(4.0 * Dr - Mprimer) - + 0.0005 * E * sin(2.0 * Dr + Mr - Mprimer) - + 0.0004 * E * sin(2.0 * Dr - Mr + Mprimer) - - 0.0003 * E * sin(2.0 * (Dr - Mr)) - + 0.0003 * E * sin(4.0 * Dr - Mr) + 0.0003 * sin(Vr) - + 0.0003 * sin(Pr)) + corr = ( + -0.4721 * sin(Mprimer) - 0.1649 * sin(2.0 * Dr) + - 0.0868 * sin(2.0 * Dr - Mprimer) + + 0.0084 * sin(2.0 * Dr + Mprimer) + - 0.0083 * E * sin(2.0 * Dr - Mr) + - 0.0039 * E * sin(2.0 * Dr - Mr - Mprimer) + + 0.0034 * sin(2.0 * Mprimer) + - 0.0031 * sin(2.0 * (Dr - Mprimer)) + + 0.0030 * E * sin(2.0 * Dr + Mr) + + 0.0028 * E * sin(Mr - Mprimer) + 0.0026 * E * sin(Mr) + + 0.0025 * sin(4.0 * Dr) + 0.0024 * sin(Dr) + + 0.0022 * E * sin(Mr + Mprimer) + 0.0017 * sin(Omegar) + + 0.0014 * sin(4.0 * Dr - Mprimer) + + 0.0005 * E * sin(2.0 * Dr + Mr - Mprimer) + + 0.0004 * E * sin(2.0 * Dr - Mr + Mprimer) + - 0.0003 * E * sin(2.0 * (Dr - Mr)) + + 0.0003 * E * sin(4.0 * Dr - Mr) + 0.0003 * sin(Vr) + + 0.0003 * sin(Pr) + ) jde += corr jde = Epoch(jde) return jde @@ -1228,134 +1330,142 @@ def moon_maximum_declination(epoch, target="northern"): # Compute the periodic terms for the time of maximum declination if (target == 'northern'): # Correction for the epoch - corr = (0.8975 * cos(Fr) - 0.4726 * sin(Mprimer) - - 0.1030 * sin(2.0 * Fr) - 0.0976 * sin(2.0 * Dr - Mprimer) - - 0.0462 * cos(Mprimer - Fr) - 0.0461 * cos(Mprimer + Fr) - - 0.0438 * sin(2.0 * Dr) + 0.0162 * E * sin(Mr) - - 0.0157 * cos(3.0 * Fr) + 0.0145 * sin(Mprimer + 2.0 * Fr) - + 0.0136 * cos(2.0 * Dr - Fr) - - 0.0095 * cos(2.0 * Dr - Mprimer - Fr) - - 0.0091 * cos(2.0 * Dr - Mprimer + Fr) - - 0.0089 * cos(2.0 * Dr + Fr) + 0.0075 * sin(2.0 * Mprimer) - - 0.0068 * sin(Mprimer - 2.0 * Fr) - + 0.0061 * cos(2.0 * Mprimer - Fr) - - 0.0047 * sin(Mprimer + 3.0 * Fr) - - 0.0043 * E * sin(2.0 * Dr - Mr - Mprimer) - - 0.0040 * cos(Mprimer - 2.0 * Fr) - - 0.0037 * sin(2.0 * (Dr - Mprimer)) + 0.0031 * sin(Fr) - + 0.0030 * sin(2.0 * Dr + Mprimer) - - 0.0029 * cos(Mprimer + 2.0 * Fr) - - 0.0029 * E * sin(2.0 * Dr - Mr) - - 0.0027 * sin(Mprimer + Fr) - + 0.0024 * E * sin(Mr - Mprimer) - - 0.0021 * sin(Mprimer - 3.0 * Fr) - + 0.0019 * sin(2.0 * Mprimer + Fr) - + 0.0018 * cos(2.0 * (Dr - Mprimer) - Fr) - + 0.0018 * sin(3.0 * Fr) + 0.0017 * cos(Mprimer + 3.0 * Fr) - + 0.0017 * cos(2.0 * Mprimer) - - 0.0014 * cos(2.0 * Dr - Mprimer) - + 0.0013 * cos(2.0 * Dr + Mprimer + Fr) - + 0.0013 * cos(Mprimer) + 0.0012 * sin(3.0 * Mprimer + Fr) - + 0.0011 * sin(2.0 * Dr - Mprimer + Fr) - - 0.0011 * cos(2.0 * (Dr - Mprimer)) + 0.001 * cos(Dr + Fr) - + 0.0010 * E * sin(Mr + Mprimer) - - 0.0009 * sin(2.0 * (Dr - Fr)) - + 0.0007 * cos(2.0 * Mprimer + Fr) - - 0.0007 * cos(3.0 * Mprimer + Fr)) + corr = ( + 0.8975 * cos(Fr) - 0.4726 * sin(Mprimer) + - 0.1030 * sin(2.0 * Fr) - 0.0976 * sin(2.0 * Dr - Mprimer) + - 0.0462 * cos(Mprimer - Fr) - 0.0461 * cos(Mprimer + Fr) + - 0.0438 * sin(2.0 * Dr) + 0.0162 * E * sin(Mr) + - 0.0157 * cos(3.0 * Fr) + 0.0145 * sin(Mprimer + 2.0 * Fr) + + 0.0136 * cos(2.0 * Dr - Fr) + - 0.0095 * cos(2.0 * Dr - Mprimer - Fr) + - 0.0091 * cos(2.0 * Dr - Mprimer + Fr) + - 0.0089 * cos(2.0 * Dr + Fr) + 0.0075 * sin(2.0 * Mprimer) + - 0.0068 * sin(Mprimer - 2.0 * Fr) + + 0.0061 * cos(2.0 * Mprimer - Fr) + - 0.0047 * sin(Mprimer + 3.0 * Fr) + - 0.0043 * E * sin(2.0 * Dr - Mr - Mprimer) + - 0.0040 * cos(Mprimer - 2.0 * Fr) + - 0.0037 * sin(2.0 * (Dr - Mprimer)) + 0.0031 * sin(Fr) + + 0.0030 * sin(2.0 * Dr + Mprimer) + - 0.0029 * cos(Mprimer + 2.0 * Fr) + - 0.0029 * E * sin(2.0 * Dr - Mr) + - 0.0027 * sin(Mprimer + Fr) + + 0.0024 * E * sin(Mr - Mprimer) + - 0.0021 * sin(Mprimer - 3.0 * Fr) + + 0.0019 * sin(2.0 * Mprimer + Fr) + + 0.0018 * cos(2.0 * (Dr - Mprimer) - Fr) + + 0.0018 * sin(3.0 * Fr) + 0.0017 * cos(Mprimer + 3.0 * Fr) + + 0.0017 * cos(2.0 * Mprimer) + - 0.0014 * cos(2.0 * Dr - Mprimer) + + 0.0013 * cos(2.0 * Dr + Mprimer + Fr) + + 0.0013 * cos(Mprimer) + 0.0012 * sin(3.0 * Mprimer + Fr) + + 0.0011 * sin(2.0 * Dr - Mprimer + Fr) + - 0.0011 * cos(2.0 * (Dr - Mprimer)) + 0.001 * cos(Dr + Fr) + + 0.0010 * E * sin(Mr + Mprimer) + - 0.0009 * sin(2.0 * (Dr - Fr)) + + 0.0007 * cos(2.0 * Mprimer + Fr) + - 0.0007 * cos(3.0 * Mprimer + Fr) + ) # Correction for the declination - cor2 = (5.1093 * sin(Fr) + 0.2658 * cos(2.0 * Fr) - + 0.1448 * sin(2.0 * Dr - Fr) - 0.0322 * sin(3.0 * Fr) - + 0.0133 * cos(2.0 * (Dr - Fr)) + 0.0125 * cos(2.0 * Dr) - - 0.0124 * sin(Mprimer - Fr) - - 0.0101 * sin(Mprimer + 2.0 * Fr) + 0.0097 * cos(Fr) - - 0.0087 * E * sin(2.0 * Dr + Mr - Fr) - + 0.0074 * sin(Mprimer + 3.0 * Fr) + 0.0067 * sin(Dr + Fr) - + 0.0063 * sin(Mprimer - 2.0 * Fr) - + 0.0060 * E * sin(2.0 * Dr - Mr - Fr) - - 0.0057 * sin(2.0 * Dr - Mprimer - Fr) - - 0.0056 * cos(Mprimer + Fr) - + 0.0052 * cos(Mprimer + 2.0 * Fr) - + 0.0041 * cos(2.0 * Mprimer + Fr) - - 0.0040 * cos(Mprimer - 3.0 * Fr) - + 0.0038 * cos(2.0 * Mprimer - Fr) - - 0.0034 * cos(Mprimer - 2.0 * Fr) - - 0.0029 * sin(2.0 * Mprimer) - + 0.0029 * sin(3.0 * Mprimer + Fr) - - 0.0028 * E * cos(2.0 * Dr + Mr - Fr) - - 0.0028 * cos(Mprimer - Fr) - 0.0023 * cos(3.0 * Fr) - - 0.0021 * sin(2.0 * Dr + Fr) - + 0.0019 * cos(Mprimer + 3.0 * Fr) + 0.0018 * cos(Dr + Fr) - + 0.0017 * sin(2.0 * Mprimer - Fr) - + 0.0015 * cos(3.0 * Mprimer + Fr) - + 0.0014 * cos(2.0 * (Dr + Mprimer) + Fr) - - 0.0012 * sin(2.0 * (Dr - Mprimer) - Fr) - - 0.0012 * cos(2.0 * Mprimer) - 0.0010 * cos(Mprimer) - - 0.0010 * sin(2.0 * Fr) + 0.0006 * sin(Mprimer + Fr)) + cor2 = ( + 5.1093 * sin(Fr) + 0.2658 * cos(2.0 * Fr) + + 0.1448 * sin(2.0 * Dr - Fr) - 0.0322 * sin(3.0 * Fr) + + 0.0133 * cos(2.0 * (Dr - Fr)) + 0.0125 * cos(2.0 * Dr) + - 0.0124 * sin(Mprimer - Fr) + - 0.0101 * sin(Mprimer + 2.0 * Fr) + 0.0097 * cos(Fr) + - 0.0087 * E * sin(2.0 * Dr + Mr - Fr) + + 0.0074 * sin(Mprimer + 3.0 * Fr) + 0.0067 * sin(Dr + Fr) + + 0.0063 * sin(Mprimer - 2.0 * Fr) + + 0.0060 * E * sin(2.0 * Dr - Mr - Fr) + - 0.0057 * sin(2.0 * Dr - Mprimer - Fr) + - 0.0056 * cos(Mprimer + Fr) + + 0.0052 * cos(Mprimer + 2.0 * Fr) + + 0.0041 * cos(2.0 * Mprimer + Fr) + - 0.0040 * cos(Mprimer - 3.0 * Fr) + + 0.0038 * cos(2.0 * Mprimer - Fr) + - 0.0034 * cos(Mprimer - 2.0 * Fr) + - 0.0029 * sin(2.0 * Mprimer) + + 0.0029 * sin(3.0 * Mprimer + Fr) + - 0.0028 * E * cos(2.0 * Dr + Mr - Fr) + - 0.0028 * cos(Mprimer - Fr) - 0.0023 * cos(3.0 * Fr) + - 0.0021 * sin(2.0 * Dr + Fr) + + 0.0019 * cos(Mprimer + 3.0 * Fr) + 0.0018 * cos(Dr + Fr) + + 0.0017 * sin(2.0 * Mprimer - Fr) + + 0.0015 * cos(3.0 * Mprimer + Fr) + + 0.0014 * cos(2.0 * (Dr + Mprimer) + Fr) + - 0.0012 * sin(2.0 * (Dr - Mprimer) - Fr) + - 0.0012 * cos(2.0 * Mprimer) - 0.0010 * cos(Mprimer) + - 0.0010 * sin(2.0 * Fr) + 0.0006 * sin(Mprimer + Fr) + ) else: # Correction for the epoch - corr = (-0.8975 * cos(Fr) - 0.4726 * sin(Mprimer) - - 0.1030 * sin(2.0 * Fr) - 0.0976 * sin(2.0 * Dr - Mprimer) - + 0.0541 * cos(Mprimer - Fr) + 0.0516 * cos(Mprimer + Fr) - - 0.0438 * sin(2.0 * Dr) + 0.0112 * E * sin(Mr) - + 0.0157 * cos(3.0 * Fr) + 0.0023 * sin(Mprimer + 2.0 * Fr) - - 0.0136 * cos(2.0 * Dr - Fr) - + 0.0110 * cos(2.0 * Dr - Mprimer - Fr) - + 0.0091 * cos(2.0 * Dr - Mprimer + Fr) - + 0.0089 * cos(2.0 * Dr + Fr) + 0.0075 * sin(2.0 * Mprimer) - - 0.0030 * sin(Mprimer - 2.0 * Fr) - - 0.0061 * cos(2.0 * Mprimer - Fr) - - 0.0047 * sin(Mprimer + 3.0 * Fr) - - 0.0043 * E * sin(2.0 * Dr - Mr - Mprimer) - + 0.0040 * cos(Mprimer - 2.0 * Fr) - - 0.0037 * sin(2.0 * (Dr - Mprimer)) - 0.0031 * sin(Fr) - + 0.0030 * sin(2.0 * Dr + Mprimer) - + 0.0029 * cos(Mprimer + 2.0 * Fr) - - 0.0029 * E * sin(2.0 * Dr - Mr) - - 0.0027 * sin(Mprimer + Fr) - + 0.0024 * E * sin(Mr - Mprimer) - - 0.0021 * sin(Mprimer - 3.0 * Fr) - - 0.0019 * sin(2.0 * Mprimer + Fr) - - 0.0006 * cos(2.0 * (Dr - Mprimer) - Fr) - - 0.0018 * sin(3.0 * Fr) - 0.0017 * cos(Mprimer + 3.0 * Fr) - + 0.0017 * cos(2.0 * Mprimer) - + 0.0014 * cos(2.0 * Dr - Mprimer) - - 0.0013 * cos(2.0 * Dr + Mprimer + Fr) - - 0.0013 * cos(Mprimer) + 0.0012 * sin(3.0 * Mprimer + Fr) - + 0.0011 * sin(2.0 * Dr - Mprimer + Fr) - + 0.0011 * cos(2.0 * (Dr - Mprimer)) + 0.001 * cos(Dr + Fr) - + 0.0010 * E * sin(Mr + Mprimer) - - 0.0009 * sin(2.0 * (Dr - Fr)) - - 0.0007 * cos(2.0 * Mprimer + Fr) - - 0.0007 * cos(3.0 * Mprimer + Fr)) + corr = ( + -0.8975 * cos(Fr) - 0.4726 * sin(Mprimer) + - 0.1030 * sin(2.0 * Fr) - 0.0976 * sin(2.0 * Dr - Mprimer) + + 0.0541 * cos(Mprimer - Fr) + 0.0516 * cos(Mprimer + Fr) + - 0.0438 * sin(2.0 * Dr) + 0.0112 * E * sin(Mr) + + 0.0157 * cos(3.0 * Fr) + 0.0023 * sin(Mprimer + 2.0 * Fr) + - 0.0136 * cos(2.0 * Dr - Fr) + + 0.0110 * cos(2.0 * Dr - Mprimer - Fr) + + 0.0091 * cos(2.0 * Dr - Mprimer + Fr) + + 0.0089 * cos(2.0 * Dr + Fr) + 0.0075 * sin(2.0 * Mprimer) + - 0.0030 * sin(Mprimer - 2.0 * Fr) + - 0.0061 * cos(2.0 * Mprimer - Fr) + - 0.0047 * sin(Mprimer + 3.0 * Fr) + - 0.0043 * E * sin(2.0 * Dr - Mr - Mprimer) + + 0.0040 * cos(Mprimer - 2.0 * Fr) + - 0.0037 * sin(2.0 * (Dr - Mprimer)) - 0.0031 * sin(Fr) + + 0.0030 * sin(2.0 * Dr + Mprimer) + + 0.0029 * cos(Mprimer + 2.0 * Fr) + - 0.0029 * E * sin(2.0 * Dr - Mr) + - 0.0027 * sin(Mprimer + Fr) + + 0.0024 * E * sin(Mr - Mprimer) + - 0.0021 * sin(Mprimer - 3.0 * Fr) + - 0.0019 * sin(2.0 * Mprimer + Fr) + - 0.0006 * cos(2.0 * (Dr - Mprimer) - Fr) + - 0.0018 * sin(3.0 * Fr) - 0.0017 * cos(Mprimer + 3.0 * Fr) + + 0.0017 * cos(2.0 * Mprimer) + + 0.0014 * cos(2.0 * Dr - Mprimer) + - 0.0013 * cos(2.0 * Dr + Mprimer + Fr) + - 0.0013 * cos(Mprimer) + 0.0012 * sin(3.0 * Mprimer + Fr) + + 0.0011 * sin(2.0 * Dr - Mprimer + Fr) + + 0.0011 * cos(2.0 * (Dr - Mprimer)) + 0.001 * cos(Dr + Fr) + + 0.0010 * E * sin(Mr + Mprimer) + - 0.0009 * sin(2.0 * (Dr - Fr)) + - 0.0007 * cos(2.0 * Mprimer + Fr) + - 0.0007 * cos(3.0 * Mprimer + Fr) + ) # Correction for the declination - cor2 = (-5.1093 * sin(Fr) + 0.2658 * cos(2.0 * Fr) - - 0.1448 * sin(2.0 * Dr - Fr) + 0.0322 * sin(3.0 * Fr) - + 0.0133 * cos(2.0 * (Dr - Fr)) + 0.0125 * cos(2.0 * Dr) - - 0.0015 * sin(Mprimer - Fr) - + 0.0101 * sin(Mprimer + 2.0 * Fr) - 0.0097 * cos(Fr) - + 0.0087 * E * sin(2.0 * Dr + Mr - Fr) - + 0.0074 * sin(Mprimer + 3.0 * Fr) + 0.0067 * sin(Dr + Fr) - - 0.0063 * sin(Mprimer - 2.0 * Fr) - - 0.0060 * E * sin(2.0 * Dr - Mr - Fr) - + 0.0057 * sin(2.0 * Dr - Mprimer - Fr) - - 0.0056 * cos(Mprimer + Fr) - - 0.0052 * cos(Mprimer + 2.0 * Fr) - - 0.0041 * cos(2.0 * Mprimer + Fr) - - 0.0040 * cos(Mprimer - 3.0 * Fr) - - 0.0038 * cos(2.0 * Mprimer - Fr) - + 0.0034 * cos(Mprimer - 2.0 * Fr) - - 0.0029 * sin(2.0 * Mprimer) - + 0.0029 * sin(3.0 * Mprimer + Fr) - + 0.0028 * E * cos(2.0 * Dr + Mr - Fr) - - 0.0028 * cos(Mprimer - Fr) + 0.0023 * cos(3.0 * Fr) - + 0.0021 * sin(2.0 * Dr + Fr) - + 0.0019 * cos(Mprimer + 3.0 * Fr) + 0.0018 * cos(Dr + Fr) - - 0.0017 * sin(2.0 * Mprimer - Fr) - + 0.0015 * cos(3.0 * Mprimer + Fr) - + 0.0014 * cos(2.0 * (Dr + Mprimer) + Fr) - + 0.0012 * sin(2.0 * (Dr - Mprimer) - Fr) - - 0.0012 * cos(2.0 * Mprimer) + 0.0010 * cos(Mprimer) - - 0.0010 * sin(2.0 * Fr) + 0.0037 * sin(Mprimer + Fr)) + cor2 = ( + -5.1093 * sin(Fr) + 0.2658 * cos(2.0 * Fr) + - 0.1448 * sin(2.0 * Dr - Fr) + 0.0322 * sin(3.0 * Fr) + + 0.0133 * cos(2.0 * (Dr - Fr)) + 0.0125 * cos(2.0 * Dr) + - 0.0015 * sin(Mprimer - Fr) + + 0.0101 * sin(Mprimer + 2.0 * Fr) - 0.0097 * cos(Fr) + + 0.0087 * E * sin(2.0 * Dr + Mr - Fr) + + 0.0074 * sin(Mprimer + 3.0 * Fr) + 0.0067 * sin(Dr + Fr) + - 0.0063 * sin(Mprimer - 2.0 * Fr) + - 0.0060 * E * sin(2.0 * Dr - Mr - Fr) + + 0.0057 * sin(2.0 * Dr - Mprimer - Fr) + - 0.0056 * cos(Mprimer + Fr) + - 0.0052 * cos(Mprimer + 2.0 * Fr) + - 0.0041 * cos(2.0 * Mprimer + Fr) + - 0.0040 * cos(Mprimer - 3.0 * Fr) + - 0.0038 * cos(2.0 * Mprimer - Fr) + + 0.0034 * cos(Mprimer - 2.0 * Fr) + - 0.0029 * sin(2.0 * Mprimer) + + 0.0029 * sin(3.0 * Mprimer + Fr) + + 0.0028 * E * cos(2.0 * Dr + Mr - Fr) + - 0.0028 * cos(Mprimer - Fr) + 0.0023 * cos(3.0 * Fr) + + 0.0021 * sin(2.0 * Dr + Fr) + + 0.0019 * cos(Mprimer + 3.0 * Fr) + 0.0018 * cos(Dr + Fr) + - 0.0017 * sin(2.0 * Mprimer - Fr) + + 0.0015 * cos(3.0 * Mprimer + Fr) + + 0.0014 * cos(2.0 * (Dr + Mprimer) + Fr) + + 0.0012 * sin(2.0 * (Dr - Mprimer) - Fr) + - 0.0012 * cos(2.0 * Mprimer) + 0.0010 * cos(Mprimer) + - 0.0010 * sin(2.0 * Fr) + 0.0037 * sin(Mprimer + Fr) + ) # Add the correction to 'jde' jde += corr jde = Epoch(jde) @@ -1424,20 +1534,34 @@ def moon_librations(epoch): # Get the time from J2000.0 in Julian centuries t = (epoch - JDE2000) / 36525.0 # Mean elongation of the Moon - D = 297.8501921 + (445267.1114034 - + (-0.0018819 - + (1.0/545868.0 - t/113065000.0) * t) * t) * t + D = 297.8501921 + ( + 445267.1114034 + + ( + -0.0018819 + + (1.0/545868.0 - t/113065000.0) * t + ) * t + ) * t # Sun's mean anomaly M = 357.5291092 + (35999.0502909 + (-0.0001536 + t/24490000.0) * t) * t # Moon's mean anomaly - Mprime = 134.9633964 + (477198.8675055 - + (0.0087414 - + (1.0/69699.9 - + t/14712000.0) * t) * t) * t + Mprime = 134.9633964 + ( + 477198.8675055 + + ( + 0.0087414 + + ( + 1.0/69699.9 + + t/14712000.0 + ) * t + ) * t + ) * t # Moon's argument of latitude - F = 93.2720950 + (483202.0175233 - + (-0.0036539 - + (-1.0/3526000.0 + t/863310000.0) * t) * t) * t + F = 93.2720950 + ( + 483202.0175233 + + ( + -0.0036539 + + (-1.0/3526000.0 + t/863310000.0) * t + ) * t + ) * t F = Angle(Angle.reduce_deg(F)).to_positive() # Compute the mean longitude of the ascending node of lunar orbit Omega = Moon.longitude_mean_ascending_node(epoch) @@ -1476,35 +1600,41 @@ def moon_librations(epoch): bprimer = asin(-sinW * cosB * sinI - sinB * cosI) bprime = Angle(bprimer, radians=True) # Compute the expressions from D.H. Eckhardt 1981 - rho = (-0.02752 * cos(Mprimer) - 0.02245 * sin(Fr) - + 0.00684 * cos(Mprimer - 2.0 * Fr) - 0.00293 * cos(2.0 * Fr) - - 0.00085 * cos(2.0 * (Fr - Dr)) - - 0.00054 * cos(Mprimer - 2.0 * Dr) - 0.0002 * sin(Mprimer + Fr) - - 0.0002 * cos(Mprimer + 2.0 * Fr) - 0.0002 * cos(Mprimer - Fr) - + 0.00014 * cos(Mprimer + 2.0 * (Fr - Dr))) + rho = ( + -0.02752 * cos(Mprimer) - 0.02245 * sin(Fr) + + 0.00684 * cos(Mprimer - 2.0 * Fr) - 0.00293 * cos(2.0 * Fr) + - 0.00085 * cos(2.0 * (Fr - Dr)) + - 0.00054 * cos(Mprimer - 2.0 * Dr) - 0.0002 * sin(Mprimer + Fr) + - 0.0002 * cos(Mprimer + 2.0 * Fr) - 0.0002 * cos(Mprimer - Fr) + + 0.00014 * cos(Mprimer + 2.0 * (Fr - Dr)) + ) rho = Angle(rho) - sigma = (-0.02816 * sin(Mprimer) + 0.02244 * cos(Fr) - - 0.00682 * sin(Mprimer - 2.0 * Fr) - 0.00279 * sin(2.0 * Fr) - - 0.00083 * sin(2.0 * (Fr - Dr)) - + 0.00069 * sin(Mprimer - 2.0 * Dr) - + 0.0004 * cos(Mprimer + Fr) - 0.00025 * sin(2.0 * Mprimer) - - 0.00023 * sin(Mprimer + 2.0 * Fr) - + 0.0002 * cos(Mprimer - Fr) + 0.00019 * sin(Mprimer - Fr) - + 0.00013 * sin(Mprimer + 2.0 * (Fr - Dr)) - - 0.0001 * cos(Mprimer - 3.0 * Fr)) + sigma = ( + -0.02816 * sin(Mprimer) + 0.02244 * cos(Fr) + - 0.00682 * sin(Mprimer - 2.0 * Fr) - 0.00279 * sin(2.0 * Fr) + - 0.00083 * sin(2.0 * (Fr - Dr)) + + 0.00069 * sin(Mprimer - 2.0 * Dr) + + 0.0004 * cos(Mprimer + Fr) - 0.00025 * sin(2.0 * Mprimer) + - 0.00023 * sin(Mprimer + 2.0 * Fr) + + 0.0002 * cos(Mprimer - Fr) + 0.00019 * sin(Mprimer - Fr) + + 0.00013 * sin(Mprimer + 2.0 * (Fr - Dr)) + - 0.0001 * cos(Mprimer - 3.0 * Fr) + ) sigma = Angle(sigma) - tau = (0.0252 * E * sin(Mr) + 0.00473 * sin(2.0 * (Mprimer - Fr)) - - 0.00467 * sin(Mprimer) + 0.00396 * sin(k1r) - + 0.00276 * sin(2.0 * (Mprimer - Dr)) + 0.00196 * sin(Omegar) - - 0.00183 * cos(Mprimer - Fr) - + 0.00115 * sin(Mprimer - 2.0 * Dr) - - 0.00096 * sin(Mprimer - Dr) + 0.00046 * sin(2.0 * (Fr - Dr)) - - 0.00039 * sin(Mprimer - Fr) - 0.00032 * sin(Mprimer - Mr - Dr) - + 0.00027 * sin(2.0 * (Mprimer - Dr) - Mr) + 0.00023 * sin(k2r) - - 0.00014 * sin(2.0 * Dr) + 0.00014 * cos(2.0 * (Mprimer - Fr)) - - 0.00012 * sin(Mprimer - 2.0 * Fr) - - 0.00012 * sin(2.0 * Mprimer) - + 0.00011 * sin(2.0 * (Mprimer - Mr - Dr))) + tau = ( + 0.0252 * E * sin(Mr) + 0.00473 * sin(2.0 * (Mprimer - Fr)) + - 0.00467 * sin(Mprimer) + 0.00396 * sin(k1r) + + 0.00276 * sin(2.0 * (Mprimer - Dr)) + 0.00196 * sin(Omegar) + - 0.00183 * cos(Mprimer - Fr) + + 0.00115 * sin(Mprimer - 2.0 * Dr) + - 0.00096 * sin(Mprimer - Dr) + 0.00046 * sin(2.0 * (Fr - Dr)) + - 0.00039 * sin(Mprimer - Fr) - 0.00032 * sin(Mprimer - Mr - Dr) + + 0.00027 * sin(2.0 * (Mprimer - Dr) - Mr) + 0.00023 * sin(k2r) + - 0.00014 * sin(2.0 * Dr) + 0.00014 * cos(2.0 * (Mprimer - Fr)) + - 0.00012 * sin(Mprimer - 2.0 * Fr) + - 0.00012 * sin(2.0 * Mprimer) + + 0.00011 * sin(2.0 * (Mprimer - Mr - Dr)) + ) tau = Angle(tau) # Compute the physical librations lpp = -tau + (rho * cos(Ar) + sigma * sin(Ar)) * tan(bprimer) @@ -1547,18 +1677,32 @@ def moon_position_angle_axis(epoch): # Get the time from J2000.0 in Julian centuries t = (epoch - JDE2000) / 36525.0 # Mean elongation of the Moon - D = 297.8501921 + (445267.1114034 - + (-0.0018819 - + (1.0/545868.0 - t/113065000.0) * t) * t) * t + D = 297.8501921 + ( + 445267.1114034 + + ( + -0.0018819 + + (1.0/545868.0 - t/113065000.0) * t + ) * t + ) * t # Moon's mean anomaly - Mprime = 134.9633964 + (477198.8675055 - + (0.0087414 - + (1.0/69699.9 - + t/14712000.0) * t) * t) * t + Mprime = 134.9633964 + ( + 477198.8675055 + + ( + 0.0087414 + + ( + 1.0/69699.9 + + t/14712000.0 + ) * t + ) * t + ) * t # Moon's argument of latitude - F = 93.2720950 + (483202.0175233 - + (-0.0036539 - + (-1.0/3526000.0 + t/863310000.0) * t) * t) * t + F = 93.2720950 + ( + 483202.0175233 + + ( + -0.0036539 + + (-1.0/3526000.0 + t/863310000.0) * t + ) * t + ) * t F = Angle(Angle.reduce_deg(F)).to_positive() # Compute the mean longitude of the ascending node of lunar orbit Omega = Moon.longitude_mean_ascending_node(epoch) @@ -1570,23 +1714,27 @@ def moon_position_angle_axis(epoch): F = Angle(Angle.reduce_deg(F)).to_positive() Fr = F.rad() # Compute the expressions from D.H. Eckhardt 1981 - rho = (-0.02752 * cos(Mprimer) - 0.02245 * sin(Fr) - + 0.00684 * cos(Mprimer - 2.0 * Fr) - 0.00293 * cos(2.0 * Fr) - - 0.00085 * cos(2.0 * (Fr - Dr)) - - 0.00054 * cos(Mprimer - 2.0 * Dr) - 0.0002 * sin(Mprimer + Fr) - - 0.0002 * cos(Mprimer + 2.0 * Fr) - 0.0002 * cos(Mprimer - Fr) - + 0.00014 * cos(Mprimer + 2.0 * (Fr - Dr))) + rho = ( + -0.02752 * cos(Mprimer) - 0.02245 * sin(Fr) + + 0.00684 * cos(Mprimer - 2.0 * Fr) - 0.00293 * cos(2.0 * Fr) + - 0.00085 * cos(2.0 * (Fr - Dr)) + - 0.00054 * cos(Mprimer - 2.0 * Dr) - 0.0002 * sin(Mprimer + Fr) + - 0.0002 * cos(Mprimer + 2.0 * Fr) - 0.0002 * cos(Mprimer - Fr) + + 0.00014 * cos(Mprimer + 2.0 * (Fr - Dr)) + ) rho = Angle(rho) rhor = rho.rad() - sigma = (-0.02816 * sin(Mprimer) + 0.02244 * cos(Fr) - - 0.00682 * sin(Mprimer - 2.0 * Fr) - 0.00279 * sin(2.0 * Fr) - - 0.00083 * sin(2.0 * (Fr - Dr)) - + 0.00069 * sin(Mprimer - 2.0 * Dr) - + 0.0004 * cos(Mprimer + Fr) - 0.00025 * sin(2.0 * Mprimer) - - 0.00023 * sin(Mprimer + 2.0 * Fr) - + 0.0002 * cos(Mprimer - Fr) + 0.00019 * sin(Mprimer - Fr) - + 0.00013 * sin(Mprimer + 2.0 * (Fr - Dr)) - - 0.0001 * cos(Mprimer - 3.0 * Fr)) + sigma = ( + -0.02816 * sin(Mprimer) + 0.02244 * cos(Fr) + - 0.00682 * sin(Mprimer - 2.0 * Fr) - 0.00279 * sin(2.0 * Fr) + - 0.00083 * sin(2.0 * (Fr - Dr)) + + 0.00069 * sin(Mprimer - 2.0 * Dr) + + 0.0004 * cos(Mprimer + Fr) - 0.00025 * sin(2.0 * Mprimer) + - 0.00023 * sin(Mprimer + 2.0 * Fr) + + 0.0002 * cos(Mprimer - Fr) + 0.00019 * sin(Mprimer - Fr) + + 0.00013 * sin(Mprimer + 2.0 * (Fr - Dr)) + - 0.0001 * cos(Mprimer - 3.0 * Fr) + ) sigma = Angle(sigma) # Compute the parameters 'v', 'x', 'y' and 'w' v = Omega + deltaPsi + (sigma / sinI) @@ -1716,11 +1864,15 @@ def print_me(msg, val): passage = Moon.moon_passage_nodes(epoch, target="ascending") y, m, d, h, mi, s = passage.get_full_date() mi += s/60.0 - print("Passage by the ascending node: {}/{}/{} {}:{}".format(y, - m, - d, - h, - round(mi))) + print( + "Passage by the ascending node: {}/{}/{} {}:{}".format( + y, + m, + d, + h, + round(mi), + ), + ) # 1987/5/23 6:26 print("") @@ -1729,8 +1881,12 @@ def print_me(msg, val): epoch = Epoch(2049, 4, 15.0) epo, dec = Moon.moon_maximum_declination(epoch, target='southern') y, m, d, h, mi, s = epo.get_full_date() - print("Epoch of maximum declination: {}/{}/{} {}:{}".format(y, m, d, h, - mi)) + print( + "Epoch of maximum declination: {}/{}/{} {}:{}".format( + y, m, d, h, + mi, + ), + ) # 2049/4/21 14:0 print_me("Amplitude of maximum declination", dec.dms_str(n_dec=0)) # -22d 8' 18.0'' diff --git a/addon/globalPlugins/clock/pymeeus/Neptune.py b/addon/globalPlugins/clock/pymeeus/Neptune.py index 1c42a85..6f48ceb 100644 --- a/addon/globalPlugins/clock/pymeeus/Neptune.py +++ b/addon/globalPlugins/clock/pymeeus/Neptune.py @@ -24,7 +24,7 @@ from pymeeus.Epoch import Epoch, JDE2000 from pymeeus.Coordinates import ( geometric_vsop_pos, apparent_vsop_pos, orbital_elements, - nutation_longitude, true_obliquity, ecliptical2equatorial + nutation_longitude, true_obliquity, ecliptical2equatorial, ) from pymeeus.Earth import Earth from pymeeus.Sun import Sun @@ -733,11 +733,11 @@ # L4 [ [113.998, 3.14159265359, 0.00000000000], - [0.605, 3.18211885677, 76.26607127560] + [0.605, 3.18211885677, 76.26607127560], ], # L5 [ - [0.874, 3.14159265359, 0.00000000000] + [0.874, 3.14159265359, 0.00000000000], ], ] """This table contains Neptune's periodic terms (all of them) from the @@ -2045,7 +2045,7 @@ [0.00945575, 0.000006033, 0.0, -0.00000000005], # e [1.769953, -0.0093082, -0.00000708, 0.000000027], # i [131.748057, 1.1022039, 0.00025952, -0.000000637], # Omega - [48.120276, 1.4262957, 0.00038434, 0.00000002] # pie + [48.120276, 1.4262957, 0.00038434, 0.00000002], # pie ] """This table contains the parameters to compute Neptune's orbital elements for the mean equinox of date. Based in Table 31.A, page 213""" @@ -2055,7 +2055,7 @@ [304.348665, 218.4862002, 0.00000059, -0.000000002], # L [1.769953, 0.0002256, 0.00000023, 0.0], # i [131.748057, -0.0061651, -0.00000219, -0.000000078], # Omega - [48.120276, 0.0291866, 0.0000761, 0.0] # pie + [48.120276, 0.0291866, 0.0000761, 0.0], # pie ] """This table contains the parameters to compute Neptune's orbital elements for the standard equinox J2000.0. Based on Table 31.B, page 215""" @@ -2327,13 +2327,15 @@ def conjunction(epoch): # Convert to radians ee = Angle(ee).rad() gg = Angle(gg).rad() - corr = (0.0168 - + sin(m) * (-2.5606 + t * (0.0088 + t * 0.00002)) - + cos(m) * (-0.8611 + t * (-0.0037 + t * 0.00002)) - + sin(2.0 * m) * (0.0118 + t * (-0.0004 + t * 0.00001)) - + cos(2.0 * m) * (0.0307 - t * 0.0003) - + cos(ee) * (-0.5964) - + cos(gg) * (0.0728)) + corr = ( + 0.0168 + + sin(m) * (-2.5606 + t * (0.0088 + t * 0.00002)) + + cos(m) * (-0.8611 + t * (-0.0037 + t * 0.00002)) + + sin(2.0 * m) * (0.0118 + t * (-0.0004 + t * 0.00001)) + + cos(2.0 * m) * (0.0307 - t * 0.0003) + + cos(ee) * (-0.5964) + + cos(gg) * (0.0728) + ) to_return = jde0 + corr return Epoch(to_return) @@ -2385,13 +2387,15 @@ def opposition(epoch): # Convert to radians ee = Angle(ee).rad() gg = Angle(gg).rad() - corr = (-0.014 + t * t * 0.00001 - + sin(m) * (-1.3486 + t * (0.001 + t * 0.00001)) - + cos(m) * (0.8597 + t * 0.0037) - + sin(2.0 * m) * (-0.0082 + t * (-0.0002 + t * 0.00001)) - + cos(2.0 * m) * (0.0037 - t * 0.0003) - + cos(ee) * (-0.5964) - + cos(gg) * (0.0728)) + corr = ( + -0.014 + t * t * 0.00001 + + sin(m) * (-1.3486 + t * (0.001 + t * 0.00001)) + + cos(m) * (0.8597 + t * 0.0037) + + sin(2.0 * m) * (-0.0082 + t * (-0.0002 + t * 0.00001)) + + cos(2.0 * m) * (0.0037 - t * 0.0003) + + cos(ee) * (-0.5964) + + cos(gg) * (0.0728) + ) to_return = jde0 + corr return Epoch(to_return) diff --git a/addon/globalPlugins/clock/pymeeus/Pluto.py b/addon/globalPlugins/clock/pymeeus/Pluto.py index 967233c..0c1a0b6 100644 --- a/addon/globalPlugins/clock/pymeeus/Pluto.py +++ b/addon/globalPlugins/clock/pymeeus/Pluto.py @@ -77,7 +77,7 @@ (2.0, 0.0, 3.0), (3.0, 0.0, -2.0), (3.0, 0.0, -1.0), - (3.0, 0.0, 0.0) + (3.0, 0.0, 0.0), ] """This table contains Pluto's argument coefficients according to Table 37.A in Meeus' book, page 265.""" @@ -126,7 +126,7 @@ (1.0, 3.0), (-3.0, -1.0), (5.0, -3.0), - (0.0, 0.0) + (0.0, 0.0), ] """This table contains the periodic terms to compute Pluto's heliocentric longitude according to Table 37.A in Meeus' book, page 265""" @@ -175,7 +175,7 @@ (0.0, 0.0), (0.0, 1.0), (0.0, 0.0), - (1.0, 0.0) + (1.0, 0.0), ] """This table contains the periodic terms to compute Pluto's heliocentric latitude according to Table 37.A in Meeus' book, page 265""" @@ -224,7 +224,7 @@ (-8.0, 7.0), (2.0, -10.0), (19.0, 35.0), - (10.0, 3.0) + (10.0, 3.0), ] """This table contains the periodic terms to compute Pluto's heliocentric radius vector according to Table 37.A in Meeus' book, page 265""" diff --git a/addon/globalPlugins/clock/pymeeus/Saturn.py b/addon/globalPlugins/clock/pymeeus/Saturn.py index 289bee2..ae38805 100644 --- a/addon/globalPlugins/clock/pymeeus/Saturn.py +++ b/addon/globalPlugins/clock/pymeeus/Saturn.py @@ -19,7 +19,7 @@ from math import ( - sin, cos, tan, acos, atan2, sqrt, radians, log10, asin, fabs + sin, cos, tan, acos, atan2, sqrt, radians, log10, asin, fabs, ) from pymeeus.Angle import Angle from pymeeus.Epoch import Epoch, JDE2000 @@ -27,7 +27,7 @@ from pymeeus.Coordinates import ( geometric_vsop_pos, apparent_vsop_pos, orbital_elements, nutation_longitude, true_obliquity, ecliptical2equatorial, - passage_nodes_elliptic + passage_nodes_elliptic, ) from pymeeus.Earth import Earth from pymeeus.Sun import Sun @@ -5884,7 +5884,7 @@ [0.05554814, -0.000346641, -0.0000006436, 0.0000000034], # e [2.488879, -0.0037362, -0.00001519, 0.000000087], # i [113.665503, 0.877088, -0.00012176, -0.000002249], # Omega - [93.057237, 1.9637613, 0.00083753, 0.000004928] # pie + [93.057237, 1.9637613, 0.00083753, 0.000004928], # pie ] """This table contains the parameters to compute Saturn's orbital elements for the mean equinox of date. Based in Table 31.A, page 213""" @@ -5894,7 +5894,7 @@ [50.077444, 1222.1138488, 0.00021004, -0.000000046], # L [2.488879, 0.0025514, -0.00004906, 0.000000017], # i [113.665503, -0.2566722, -0.00018399, 0.00000048], # Omega - [93.057237, 0.5665415, 0.0005285, 0.000004912] # pie + [93.057237, 0.5665415, 0.0005285, 0.000004912], # pie ] """This table contains the parameters to compute Saturn's orbital elements for the standard equinox J2000.0. Based on Table 31.B, page 215""" @@ -6170,21 +6170,23 @@ def conjunction(epoch): bb = Angle(bb).rad() cc = Angle(cc).rad() dd = Angle(dd).rad() - corr = (0.0172 + t * (-0.0006 + t * 0.00023) - + sin(m) * (-8.5885 + t * (0.0411 + t * 0.0002)) - + cos(m) * (-1.147 + t * (0.0352 - t * 0.00011)) - + sin(2.0 * m) * (0.3331 + t * (-0.0034 - t * 0.00001)) - + cos(2.0 * m) * (0.1145 + t * (-0.0045 + t * 0.00002)) - + sin(3.0 * m) * (-0.0169 + t * 0.0002) - + cos(3.0 * m) * (-0.0109 + t * 0.0004) - + sin(aa) * (0.0 + t * (-0.0337 + t * 0.00018)) - + cos(aa) * (-0.851 + t * (0.0044 + t * 0.00068)) - + sin(bb) * (0.0 + t * (-0.0064 + t * 0.00004)) - + cos(bb) * (0.2397 + t * (-0.0012 - t * 0.00008)) - + sin(cc) * (0.0 - t * 0.001) - + cos(cc) * (0.1245 + t * 0.0006) - + sin(dd) * (0.0 + t * (0.0024 - t * 0.00003)) - + cos(dd) * (0.0477 + t * (-0.0005 - t * 0.00006))) + corr = ( + 0.0172 + t * (-0.0006 + t * 0.00023) + + sin(m) * (-8.5885 + t * (0.0411 + t * 0.0002)) + + cos(m) * (-1.147 + t * (0.0352 - t * 0.00011)) + + sin(2.0 * m) * (0.3331 + t * (-0.0034 - t * 0.00001)) + + cos(2.0 * m) * (0.1145 + t * (-0.0045 + t * 0.00002)) + + sin(3.0 * m) * (-0.0169 + t * 0.0002) + + cos(3.0 * m) * (-0.0109 + t * 0.0004) + + sin(aa) * (0.0 + t * (-0.0337 + t * 0.00018)) + + cos(aa) * (-0.851 + t * (0.0044 + t * 0.00068)) + + sin(bb) * (0.0 + t * (-0.0064 + t * 0.00004)) + + cos(bb) * (0.2397 + t * (-0.0012 - t * 0.00008)) + + sin(cc) * (0.0 - t * 0.001) + + cos(cc) * (0.1245 + t * 0.0006) + + sin(dd) * (0.0 + t * (0.0024 - t * 0.00003)) + + cos(dd) * (0.0477 + t * (-0.0005 - t * 0.00006)) + ) to_return = jde0 + corr return Epoch(to_return) @@ -6240,21 +6242,23 @@ def opposition(epoch): bb = Angle(bb).rad() cc = Angle(cc).rad() dd = Angle(dd).rad() - corr = (-0.0209 + t * (0.0006 + t * 0.00023) - + sin(m) * (4.5795 + t * (-0.0312 - t * 0.00017)) - + cos(m) * (1.1462 + t * (-0.0351 + t * 0.00011)) - + sin(2.0 * m) * (0.0985 - t * 0.0015) - + cos(2.0 * m) * (0.0733 + t * (-0.0031 + t * 0.00001)) - + sin(3.0 * m) * (0.0025 - t * 0.0001) - + cos(3.0 * m) * (0.005 - t * 0.0002) - + sin(aa) * (0.0 + t * (-0.0337 + t * 0.00018)) - + cos(aa) * (-0.851 + t * (0.0044 + t * 0.00068)) - + sin(bb) * (0.0 + t * (-0.0064 + t * 0.00004)) - + cos(bb) * (0.2397 + t * (-0.0012 - t * 0.00008)) - + sin(cc) * (0.0 - t * 0.001) - + cos(cc) * (0.1245 + t * 0.0006) - + sin(dd) * (0.0 + t * (0.0024 - t * 0.00003)) - + cos(dd) * (0.0477 + t * (-0.0005 - t * 0.00006))) + corr = ( + -0.0209 + t * (0.0006 + t * 0.00023) + + sin(m) * (4.5795 + t * (-0.0312 - t * 0.00017)) + + cos(m) * (1.1462 + t * (-0.0351 + t * 0.00011)) + + sin(2.0 * m) * (0.0985 - t * 0.0015) + + cos(2.0 * m) * (0.0733 + t * (-0.0031 + t * 0.00001)) + + sin(3.0 * m) * (0.0025 - t * 0.0001) + + cos(3.0 * m) * (0.005 - t * 0.0002) + + sin(aa) * (0.0 + t * (-0.0337 + t * 0.00018)) + + cos(aa) * (-0.851 + t * (0.0044 + t * 0.00068)) + + sin(bb) * (0.0 + t * (-0.0064 + t * 0.00004)) + + cos(bb) * (0.2397 + t * (-0.0012 - t * 0.00008)) + + sin(cc) * (0.0 - t * 0.001) + + cos(cc) * (0.1245 + t * 0.0006) + + sin(dd) * (0.0 + t * (0.0024 - t * 0.00003)) + + cos(dd) * (0.0477 + t * (-0.0005 - t * 0.00006)) + ) to_return = jde0 + corr return Epoch(to_return) @@ -6311,21 +6315,23 @@ def station_longitude_1(epoch): bb = Angle(bb).rad() cc = Angle(cc).rad() dd = Angle(dd).rad() - corr = (-68.884 + t * (0.0009 + t * 0.00023) - + sin(m) * (5.5452 + t * (-0.0279 - t * 0.0002)) - + cos(m) * (3.0727 + t * (-0.043 + t * 0.00007)) - + sin(2.0 * m) * (0.1101 + t * (-0.0006 - t * 0.00001)) - + cos(2.0 * m) * (0.1654 + t * (-0.0043 + t * 0.00001)) - + sin(3.0 * m) * (0.001 + t * 0.0001) - + cos(3.0 * m) * (0.0095 - t * 0.0003) - + sin(aa) * (0.0 + t * (-0.0337 + t * 0.00018)) - + cos(aa) * (-0.851 + t * (0.0044 + t * 0.00068)) - + sin(bb) * (0.0 + t * (-0.0064 + t * 0.00004)) - + cos(bb) * (0.2397 + t * (-0.0012 - t * 0.00008)) - + sin(cc) * (0.0 - t * 0.001) - + cos(cc) * (0.1245 + t * 0.0006) - + sin(dd) * (0.0 + t * (0.0024 - t * 0.00003)) - + cos(dd) * (0.0477 + t * (-0.0005 - t * 0.00006))) + corr = ( + -68.884 + t * (0.0009 + t * 0.00023) + + sin(m) * (5.5452 + t * (-0.0279 - t * 0.0002)) + + cos(m) * (3.0727 + t * (-0.043 + t * 0.00007)) + + sin(2.0 * m) * (0.1101 + t * (-0.0006 - t * 0.00001)) + + cos(2.0 * m) * (0.1654 + t * (-0.0043 + t * 0.00001)) + + sin(3.0 * m) * (0.001 + t * 0.0001) + + cos(3.0 * m) * (0.0095 - t * 0.0003) + + sin(aa) * (0.0 + t * (-0.0337 + t * 0.00018)) + + cos(aa) * (-0.851 + t * (0.0044 + t * 0.00068)) + + sin(bb) * (0.0 + t * (-0.0064 + t * 0.00004)) + + cos(bb) * (0.2397 + t * (-0.0012 - t * 0.00008)) + + sin(cc) * (0.0 - t * 0.001) + + cos(cc) * (0.1245 + t * 0.0006) + + sin(dd) * (0.0 + t * (0.0024 - t * 0.00003)) + + cos(dd) * (0.0477 + t * (-0.0005 - t * 0.00006)) + ) to_return = jde0 + corr return Epoch(to_return) @@ -6382,21 +6388,23 @@ def station_longitude_2(epoch): bb = Angle(bb).rad() cc = Angle(cc).rad() dd = Angle(dd).rad() - corr = (68.872 + t * (-0.0007 + t * 0.00023) - + sin(m) * (5.9399 + t * (-0.04 - t * 0.00015)) - + cos(m) * (-0.7998 + t * (-0.0266 + t * 0.00014)) - + sin(2.0 * m) * (0.1738 - t * 0.0032) - + cos(2.0 * m) * (-0.0039 + t * (-0.0024 + t * 0.00001)) - + sin(3.0 * m) * (0.0073 - t * 0.0002) - + cos(3.0 * m) * (0.002 - t * 0.0002) - + sin(aa) * (0.0 + t * (-0.0337 + t * 0.00018)) - + cos(aa) * (-0.851 + t * (0.0044 + t * 0.00068)) - + sin(bb) * (0.0 + t * (-0.0064 + t * 0.00004)) - + cos(bb) * (0.2397 + t * (-0.0012 - t * 0.00008)) - + sin(cc) * (0.0 - t * 0.001) - + cos(cc) * (0.1245 + t * 0.0006) - + sin(dd) * (0.0 + t * (0.0024 - t * 0.00003)) - + cos(dd) * (0.0477 + t * (-0.0005 - t * 0.00006))) + corr = ( + 68.872 + t * (-0.0007 + t * 0.00023) + + sin(m) * (5.9399 + t * (-0.04 - t * 0.00015)) + + cos(m) * (-0.7998 + t * (-0.0266 + t * 0.00014)) + + sin(2.0 * m) * (0.1738 - t * 0.0032) + + cos(2.0 * m) * (-0.0039 + t * (-0.0024 + t * 0.00001)) + + sin(3.0 * m) * (0.0073 - t * 0.0002) + + cos(3.0 * m) * (0.002 - t * 0.0002) + + sin(aa) * (0.0 + t * (-0.0337 + t * 0.00018)) + + cos(aa) * (-0.851 + t * (0.0044 + t * 0.00068)) + + sin(bb) * (0.0 + t * (-0.0064 + t * 0.00004)) + + cos(bb) * (0.2397 + t * (-0.0012 - t * 0.00008)) + + sin(cc) * (0.0 - t * 0.001) + + cos(cc) * (0.1245 + t * 0.0006) + + sin(dd) * (0.0 + t * (0.0024 - t * 0.00003)) + + cos(dd) * (0.0477 + t * (-0.0005 - t * 0.00006)) + ) to_return = jde0 + corr return Epoch(to_return) @@ -6536,14 +6544,18 @@ def magnitude(sun_dist, earth_dist, delta_U, B): # result for the example above is 0.9 (instead of 1.9). However, after # carefully checking the formula implemented here, I'm sure that the # book has an error - if not (isinstance(sun_dist, float) and isinstance(earth_dist, float) - and isinstance(delta_U, (float, Angle)) - and isinstance(B, (float, Angle))): + if not ( + isinstance(sun_dist, float) and isinstance(earth_dist, float) + and isinstance(delta_U, (float, Angle)) + and isinstance(B, (float, Angle)) + ): raise TypeError("Invalid input types") delta_U = float(delta_U) B = Angle(B).rad() - m = (-8.68 + 5.0 * log10(sun_dist * earth_dist) + 0.044 * abs(delta_U) - - 2.6 * sin(abs(B)) + 1.25 * sin(B) * sin(B)) + m = ( + -8.68 + 5.0 * log10(sun_dist * earth_dist) + 0.044 * abs(delta_U) + - 2.6 * sin(abs(B)) + 1.25 * sin(B) * sin(B) + ) return round(m, 1) @staticmethod @@ -6692,8 +6704,10 @@ def ring_parameters(epoch): # Get the Saturnicentic latitude of the Earth ir = i.rad() Omegar = Omega.rad() - B = asin(sin(ir) * cos(betar) * sin(lambdar - Omegar) - - (cos(ir) * sin(betar))) + B = asin( + sin(ir) * cos(betar) * sin(lambdar - Omegar) + - (cos(ir) * sin(betar)), + ) # Compute the size of the ring, in arcseconds a = 375.35 / delta b = a * sin(fabs(B)) @@ -6704,17 +6718,27 @@ def ring_parameters(epoch): # Correct l and b for the Sun's aberration as seen from Saturn lprime = Angle(ll() - 0.01759 / r) bprime = bl - (0.000764 * cos(lr - N.rad())) / r - Bprime = asin(sin(ir) * cos(bprime.rad()) * sin(lprime.rad() - Omegar) - - cos(ir) * sin(bprime.rad())) + Bprime = asin( + sin(ir) * cos(bprime.rad()) * sin(lprime.rad() - Omegar) + - cos(ir) * sin(bprime.rad()), + ) Bprime = Angle(Bprime, radians=True) # Let's calculate the quantity delta_U, needed to compute the magnitude bprimer = bprime.rad() diff1 = lprime.rad() - Omegar - U1r = atan2((sin(ir) * sin(bprimer) + cos(ir) * cos(bprimer) - * sin(diff1)), (cos(bprimer) * cos(diff1))) + U1r = atan2( + ( + sin(ir) * sin(bprimer) + cos(ir) * cos(bprimer) + * sin(diff1) + ), (cos(bprimer) * cos(diff1)), + ) diff2 = lambdar - Omegar - U2r = atan2((sin(ir) * sin(betar) + cos(ir) * cos(bprimer) - * sin(diff2)), (cos(betar) * cos(diff2))) + U2r = atan2( + ( + sin(ir) * sin(betar) + cos(ir) * cos(bprimer) + * sin(diff2) + ), (cos(betar) * cos(diff2)), + ) delta_U = Angle(fabs(U1r - U2r), radians=True) B = Angle(B, radians=True) dpsi = nutation_longitude(epoch) @@ -6733,9 +6757,13 @@ def ring_parameters(epoch): alpha, delta = ecliptical2equatorial(Lambda, Beta, epsilon) alphar = alpha.rad() deltar = delta.rad() - P = atan2((cos(delta0r) * sin(alpha0r - alphar)), - (sin(delta0r) * cos(deltar) - - cos(delta0r) * sin(deltar) * cos(alpha0r - alphar))) + P = atan2( + (cos(delta0r) * sin(alpha0r - alphar)), + ( + sin(delta0r) * cos(deltar) + - cos(delta0r) * sin(deltar) * cos(alpha0r - alphar) + ), + ) P = Angle(P, radians=True) return B, Bprime, P, delta_U, a, b @@ -6867,10 +6895,14 @@ def print_me(msg, val): B, Bprime, P, delta_U, a, b = Saturn.ring_parameters(epoch) print_me("Saturnicentric latitude of the Earth", round(B, 3)) # 16.442 print_me("Saturnicentric latitude of the Sun", round(Bprime, 3)) # 14.679 - print_me("Geocentric position angle of nothern semiminor axis", - round(P, 3)) # 6.741 - print_me("Difference in Saturnicentric longitudes of Sun and Earth", - round(delta_U, 3)) # 4.198 + print_me( + "Geocentric position angle of nothern semiminor axis", + round(P, 3), + ) # 6.741 + print_me( + "Difference in Saturnicentric longitudes of Sun and Earth", + round(delta_U, 3), + ) # 4.198 print_me("Size of major axis of outer ring", round(a, 2)) # 35.87 print_me("Size of minor axis of outer ring", round(b, 2)) # 10.15 diff --git a/addon/globalPlugins/clock/pymeeus/Sun.py b/addon/globalPlugins/clock/pymeeus/Sun.py index 5b84f00..8544015 100644 --- a/addon/globalPlugins/clock/pymeeus/Sun.py +++ b/addon/globalPlugins/clock/pymeeus/Sun.py @@ -430,8 +430,10 @@ def rectangular_coordinates_equinox(epoch, equinox_epoch): """ # First check that input values are of correct types - if (not isinstance(epoch, Epoch) - and not isinstance(equinox_epoch, Epoch)): + if ( + not isinstance(epoch, Epoch) + and not isinstance(equinox_epoch, Epoch) + ): raise TypeError("Invalid input types") # Second, compute Sun's rectangular coordinates w.r.t. J2000.0 x0, y0, z0 = Sun.rectangular_coordinates_j2000(epoch) @@ -521,15 +523,31 @@ def get_equinox_solstice(year, target="spring"): 365241.72562 + y * (-0.05323 + y * (0.00907 + y * 0.00025)) ) elif target == "autumn": - jde0 = (1721325.70455 - + y * (365242.49558 - + y * (-0.11677 + y * (-0.00297 - + y * 0.00074)))) + jde0 = ( + 1721325.70455 + + y * ( + 365242.49558 + + y * ( + -0.11677 + y * ( + -0.00297 + + y * 0.00074 + ) + ) + ) + ) elif target == "winter": - jde0 = (1721414.39987 - + y * (363242.88257 + y * (-0.00769 - + y * (-0.00933 - - y * 0.00006)))) + jde0 = ( + 1721414.39987 + + y * ( + 363242.88257 + y * ( + -0.00769 + + y * ( + -0.00933 + - y * 0.00006 + ) + ) + ) + ) elif (year >= 1000) and (year <= 3000): y = (year - 2000.0) / 1000.0 if target == "spring": @@ -545,10 +563,18 @@ def get_equinox_solstice(year, target="spring"): 365242.01767 + y * (-0.11575 + y * (0.00337 + y * 0.00078)) ) elif target == "winter": - jde0 = (2451900.05952 - + y * (365242.74049 - + y * (-0.06223 + y * (-0.00823 - + y * 0.00032)))) + jde0 = ( + 2451900.05952 + + y * ( + 365242.74049 + + y * ( + -0.06223 + y * ( + -0.00823 + + y * 0.00032 + ) + ) + ) + ) else: raise ValueError("'year' value out of range") k = ["spring", "summer", "autumn", "winter"].index(target) @@ -590,12 +616,22 @@ def equation_of_time(epoch): raise TypeError("Invalid input type") # Compute time in Julian millenia from J2000.0 t = (epoch - JDE2000) / 365250 - l0 = (280.4664567 - + t * (360007.6982779 - + t * (0.03032028 - + t * (1.0 / 49931.0 - + t * (-1.0 / 15300.0 - - t * 1.0 / 2000000.0))))) + l0 = ( + 280.4664567 + + t * ( + 360007.6982779 + + t * ( + 0.03032028 + + t * ( + 1.0 / 49931.0 + + t * ( + -1.0 / 15300.0 + - t * 1.0 / 2000000.0 + ) + ) + ) + ) + ) l0 = Angle(l0) l0 = l0.to_positive() # Compute the apparent position of the Sun @@ -832,8 +868,10 @@ def print_me(msg, val): # Get the epoch when the Carrington's synodic rotation No. 'number' starts epoch = Sun.beginning_synodic_rotation(1699) - print_me("Epoch for Carrington's synodic rotation No. 1699", - round(epoch(), 3)) # 2444480.723 + print_me( + "Epoch for Carrington's synodic rotation No. 1699", + round(epoch(), 3), + ) # 2444480.723 if __name__ == "__main__": diff --git a/addon/globalPlugins/clock/pymeeus/Uranus.py b/addon/globalPlugins/clock/pymeeus/Uranus.py index 0ea7370..20f3a73 100644 --- a/addon/globalPlugins/clock/pymeeus/Uranus.py +++ b/addon/globalPlugins/clock/pymeeus/Uranus.py @@ -26,7 +26,7 @@ from pymeeus.Coordinates import ( geometric_vsop_pos, apparent_vsop_pos, orbital_elements, nutation_longitude, true_obliquity, ecliptical2equatorial, - passage_nodes_elliptic + passage_nodes_elliptic, ) from pymeeus.Earth import Earth from pymeeus.Sun import Sun @@ -1636,7 +1636,7 @@ ], # L5 [ - [0.873, 3.14159265359, 0.00000000000] + [0.873, 3.14159265359, 0.00000000000], ], ] """This table contains Uranus' periodic terms (all of them) from the planetary @@ -2174,7 +2174,7 @@ # B4 [ [5.719, 2.85499529315, 74.78159856730], - [0.300, 3.14159265359, 0.00000000000] + [0.300, 3.14159265359, 0.00000000000], ], ] """This table contains Uranus' periodic terms (all of them) from the planetary @@ -4107,7 +4107,7 @@ [0.04638122, -0.000027293, 0.0000000789, 0.00000000024], # e [0.773197, 0.0007744, 0.00003749, -0.000000092], # i [74.005957, 0.5211278, 0.00133947, 0.000018484], # Omega - [173.005291, 1.486379, 0.00021406, 0.000000434] # pie + [173.005291, 1.486379, 0.00021406, 0.000000434], # pie ] """This table contains the parameters to compute Uranus's orbital elements for the mean equinox of date. Based in Table 31.A, page 213""" @@ -4117,7 +4117,7 @@ [314.055005, 428.4669983, -0.00000486, 0.000000006], # L [0.773197, -0.0016869, 0.00000349, 0.000000016], # i [74.005957, 0.0741431, 0.00040539, 0.000000119], # Omega - [173.005291, 0.0893212, -0.0000947, 0.000000414] # pie + [173.005291, 0.0893212, -0.0000947, 0.000000414], # pie ] """This table contains the parameters to compute Uranus's orbital elements for the standard equinox J2000.0. Based on Table 31.B, page 215""" @@ -4389,14 +4389,16 @@ def conjunction(epoch): # Convert to radians ee = Angle(ee).rad() ff = Angle(ff).rad() - corr = (-0.0859 + t * 0.0003 - + sin(m) * (-3.8179 + t * (-0.0148 + t * 0.00003)) - + cos(m) * (5.1228 + t * (-0.0105 - t * 0.00002)) - + sin(2.0 * m) * (-0.0803 + t * 0.0011) - + cos(2.0 * m) * (-0.1905 - t * 0.0006) - + sin(3.0 * m) * (0.0088 + t * 0.0001) - + cos(ee) * (0.885) - + cos(ff) * (0.2153)) + corr = ( + -0.0859 + t * 0.0003 + + sin(m) * (-3.8179 + t * (-0.0148 + t * 0.00003)) + + cos(m) * (5.1228 + t * (-0.0105 - t * 0.00002)) + + sin(2.0 * m) * (-0.0803 + t * 0.0011) + + cos(2.0 * m) * (-0.1905 - t * 0.0006) + + sin(3.0 * m) * (0.0088 + t * 0.0001) + + cos(ee) * (0.885) + + cos(ff) * (0.2153) + ) to_return = jde0 + corr return Epoch(to_return) @@ -4448,14 +4450,16 @@ def opposition(epoch): # Convert to radians ee = Angle(ee).rad() ff = Angle(ff).rad() - corr = (0.0844 - t * 0.0006 - + sin(m) * (-0.1048 + t * 0.0246) - + cos(m) * (-5.1221 + t * (0.0104 + t * 0.00003)) - + sin(2.0 * m) * (-0.1428 + t * 0.0005) - + cos(2.0 * m) * (-0.0148 - t * 0.0013) - + cos(3.0 * m) * (0.0055) - + cos(ee) * (0.885) - + cos(ff) * (0.2153)) + corr = ( + 0.0844 - t * 0.0006 + + sin(m) * (-0.1048 + t * 0.0246) + + cos(m) * (-5.1221 + t * (0.0104 + t * 0.00003)) + + sin(2.0 * m) * (-0.1428 + t * 0.0005) + + cos(2.0 * m) * (-0.0148 - t * 0.0013) + + cos(3.0 * m) * (0.0055) + + cos(ee) * (0.885) + + cos(ff) * (0.2153) + ) to_return = jde0 + corr return Epoch(to_return) diff --git a/addon/globalPlugins/clock/pymeeus/Venus.py b/addon/globalPlugins/clock/pymeeus/Venus.py index 769e08e..21fd384 100644 --- a/addon/globalPlugins/clock/pymeeus/Venus.py +++ b/addon/globalPlugins/clock/pymeeus/Venus.py @@ -26,7 +26,7 @@ from pymeeus.Coordinates import ( geometric_vsop_pos, apparent_vsop_pos, orbital_elements, nutation_longitude, true_obliquity, ecliptical2equatorial, - passage_nodes_elliptic + passage_nodes_elliptic, ) from pymeeus.Earth import Earth from pymeeus.Sun import Sun @@ -1806,7 +1806,7 @@ [0.00677192, -0.000047765, 0.0000000981, 0.00000000046], # e [3.394662, 0.0010037, -0.00000088, -0.000000007], # i [76.67992, 0.9011206, 0.00040618, -0.000000093], # Omega - [131.563703, 1.4022288, -0.00107618, -0.000005678] # pie + [131.563703, 1.4022288, -0.00107618, -0.000005678], # pie ] """This table contains the parameters to compute Venus' orbital elements for the mean equinox of date. Based in Table 31.A, page 212""" @@ -1816,7 +1816,7 @@ [181.979801, 58517.815676, 0.00000165, -0.000000002], # L [3.394662, -0.0008568, -0.00003244, 0.000000009], # i [76.67992, -0.2780134, -0.00014257, -0.000000164], # Omega - [131.563703, 0.0048746, -0.00138467, -0.000005695] # pie + [131.563703, 0.0048746, -0.00138467, -0.000005695], # pie ] """This table contains the parameters to compute Venus' orbital elements for the standard equinox J2000.0. Based on Table 31.B, page 214""" @@ -2082,13 +2082,15 @@ def inferior_conjunction(epoch): m = Angle(m).to_positive() m = m.rad() t = (jde0 - 2451545.0) / 36525.0 - corr = (-0.0096 + t * (0.0002 - t * 0.00001) - + sin(m) * (2.0009 + t * (-0.0033 - t * 0.00001)) - + cos(m) * (0.598 + t * (-0.0104 + t * 0.00001)) - + sin(2.0 * m) * (0.0967 + t * (-0.0018 - t * 0.00003)) - + cos(2.0 * m) * (0.0913 + t * (0.0009 - t * 0.00002)) - + sin(3.0 * m) * (0.0046 - t * 0.0002) - + cos(3.0 * m) * (0.0079 + t * 0.0001)) + corr = ( + -0.0096 + t * (0.0002 - t * 0.00001) + + sin(m) * (2.0009 + t * (-0.0033 - t * 0.00001)) + + cos(m) * (0.598 + t * (-0.0104 + t * 0.00001)) + + sin(2.0 * m) * (0.0967 + t * (-0.0018 - t * 0.00003)) + + cos(2.0 * m) * (0.0913 + t * (0.0009 - t * 0.00002)) + + sin(3.0 * m) * (0.0046 - t * 0.0002) + + cos(3.0 * m) * (0.0079 + t * 0.0001) + ) to_return = jde0 + corr return Epoch(to_return) @@ -2134,13 +2136,15 @@ def superior_conjunction(epoch): m = Angle(m).to_positive() m = m.rad() t = (jde0 - 2451545.0) / 36525.0 - corr = (0.0099 + t * (-0.0002 - t * 0.00001) - + sin(m) * (4.1991 + t * (-0.0121 - t * 0.00003)) - + cos(m) * (-0.6095 + t * (0.0102 - t * 0.00002)) - + sin(2.0 * m) * (0.25 + t * (-0.0028 - t * 0.00003)) - + cos(2.0 * m) * (0.0063 + t * (0.0025 - t * 0.00002)) - + sin(3.0 * m) * (0.0232 + t * (-0.0005 - t * 0.00001)) - + cos(3.0 * m) * (0.0031 + t * 0.0004)) + corr = ( + 0.0099 + t * (-0.0002 - t * 0.00001) + + sin(m) * (4.1991 + t * (-0.0121 - t * 0.00003)) + + cos(m) * (-0.6095 + t * (0.0102 - t * 0.00002)) + + sin(2.0 * m) * (0.25 + t * (-0.0028 - t * 0.00003)) + + cos(2.0 * m) * (0.0063 + t * (0.0025 - t * 0.00002)) + + sin(3.0 * m) * (0.0232 + t * (-0.0005 - t * 0.00001)) + + cos(3.0 * m) * (0.0031 + t * 0.0004) + ) to_return = jde0 + corr return Epoch(to_return) @@ -2189,18 +2193,22 @@ def western_elongation(epoch): m = Angle(m).to_positive() m = m.rad() t = (jde0 - 2451545.0) / 36525.0 - corr = (70.7462 - t * t * 0.00001 - + sin(m) * (1.1218 + t * (-0.0025 - t * 0.00001)) - + cos(m) * (0.4538 - t * 0.0066) - + sin(2.0 * m) * (0.132 + t * (0.002 - t * 0.00003)) - + cos(2.0 * m) * (-0.0702 + t * (0.0022 + t * 0.00004)) - + sin(3.0 * m) * (0.0062 - t * 0.0001) - + cos(3.0 * m) * (0.0015 - t * t * 0.00001)) - elon = (46.3245 - + sin(m) * (-0.5366 + t * (-0.0003 + t * 0.00001)) - + cos(m) * (0.3097 + t * (0.0016 - t * 0.00001)) - + sin(2.0 * m) * (-0.0163) - + cos(2.0 * m) * (-0.0075 + t * 0.0001)) + corr = ( + 70.7462 - t * t * 0.00001 + + sin(m) * (1.1218 + t * (-0.0025 - t * 0.00001)) + + cos(m) * (0.4538 - t * 0.0066) + + sin(2.0 * m) * (0.132 + t * (0.002 - t * 0.00003)) + + cos(2.0 * m) * (-0.0702 + t * (0.0022 + t * 0.00004)) + + sin(3.0 * m) * (0.0062 - t * 0.0001) + + cos(3.0 * m) * (0.0015 - t * t * 0.00001) + ) + elon = ( + 46.3245 + + sin(m) * (-0.5366 + t * (-0.0003 + t * 0.00001)) + + cos(m) * (0.3097 + t * (0.0016 - t * 0.00001)) + + sin(2.0 * m) * (-0.0163) + + cos(2.0 * m) * (-0.0075 + t * 0.0001) + ) elon = Angle(elon).to_positive() to_return = jde0 + corr return Epoch(to_return), elon @@ -2250,18 +2258,22 @@ def eastern_elongation(epoch): m = Angle(m).to_positive() m = m.rad() t = (jde0 - 2451545.0) / 36525.0 - corr = (-70.76 + t * (0.0002 - t * 0.00001) - + sin(m) * (1.0282 + t * (-0.001 - t * 0.00001)) - + cos(m) * (0.2761 - t * 0.006) - + sin(2.0 * m) * (-0.0438 + t * (-0.0023 + t * 0.00002)) - + cos(2.0 * m) * (0.166 + t * (-0.0037 - t * 0.00004)) - + sin(3.0 * m) * (0.0036 + t * 0.0001) - + cos(3.0 * m) * (-0.0011 + t * t * 0.00001)) - elon = (46.3173 + t * 0.0001 - + sin(m) * (0.6916 - t * 0.0024) - + cos(m) * (0.6676 - t * 0.0045) - + sin(2.0 * m) * (0.0309 - t * 0.0002) - + cos(2.0 * m) * (0.0036 - t * 0.0001)) + corr = ( + -70.76 + t * (0.0002 - t * 0.00001) + + sin(m) * (1.0282 + t * (-0.001 - t * 0.00001)) + + cos(m) * (0.2761 - t * 0.006) + + sin(2.0 * m) * (-0.0438 + t * (-0.0023 + t * 0.00002)) + + cos(2.0 * m) * (0.166 + t * (-0.0037 - t * 0.00004)) + + sin(3.0 * m) * (0.0036 + t * 0.0001) + + cos(3.0 * m) * (-0.0011 + t * t * 0.00001) + ) + elon = ( + 46.3173 + t * 0.0001 + + sin(m) * (0.6916 - t * 0.0024) + + cos(m) * (0.6676 - t * 0.0045) + + sin(2.0 * m) * (0.0309 - t * 0.0002) + + cos(2.0 * m) * (0.0036 - t * 0.0001) + ) elon = Angle(elon).to_positive() to_return = jde0 + corr return Epoch(to_return), elon @@ -2309,13 +2321,15 @@ def station_longitude_1(epoch): m = Angle(m).to_positive() m = m.rad() t = (jde0 - 2451545.0) / 36525.0 - corr = (-21.0672 + t * (0.0002 - t * 0.00001) - + sin(m) * (1.9396 + t * (-0.0029 - t * 0.00001)) - + cos(m) * (1.0727 - t * 0.0102) - + sin(2.0 * m) * (0.0404 + t * (-0.0023 - t * 0.00001)) - + cos(2.0 * m) * (0.1305 + t * (-0.0004 - t * 0.00003)) - + sin(3.0 * m) * (-0.0007 - t * 0.0002) - + cos(3.0 * m) * (0.0098)) + corr = ( + -21.0672 + t * (0.0002 - t * 0.00001) + + sin(m) * (1.9396 + t * (-0.0029 - t * 0.00001)) + + cos(m) * (1.0727 - t * 0.0102) + + sin(2.0 * m) * (0.0404 + t * (-0.0023 - t * 0.00001)) + + cos(2.0 * m) * (0.1305 + t * (-0.0004 - t * 0.00003)) + + sin(3.0 * m) * (-0.0007 - t * 0.0002) + + cos(3.0 * m) * (0.0098) + ) to_return = jde0 + corr return Epoch(to_return) @@ -2362,13 +2376,15 @@ def station_longitude_2(epoch): m = Angle(m).to_positive() m = m.rad() t = (jde0 - 2451545.0) / 36525.0 - corr = (21.0623 - t * t * 0.00001 - + sin(m) * (1.9913 + t * (-0.004 - t * 0.00001)) - + cos(m) * (-0.0407 - t * 0.0077) - + sin(2.0 * m) * (0.1351 + t * (-0.0009 - t * 0.00004)) - + cos(2.0 * m) * (0.0303 + t * 0.0019) - + sin(3.0 * m) * (0.0089 - t * 0.0002) - + cos(3.0 * m) * (0.0043 + t * 0.0001)) + corr = ( + 21.0623 - t * t * 0.00001 + + sin(m) * (1.9913 + t * (-0.004 - t * 0.00001)) + + cos(m) * (-0.0407 - t * 0.0077) + + sin(2.0 * m) * (0.1351 + t * (-0.0009 - t * 0.00004)) + + cos(2.0 * m) * (0.0303 + t * 0.0019) + + sin(3.0 * m) * (0.0089 - t * 0.0002) + + cos(3.0 * m) * (0.0043 + t * 0.0001) + ) to_return = jde0 + corr return Epoch(to_return) @@ -2525,12 +2541,16 @@ def magnitude(sun_dist, earth_dist, phase_angle): -3.8 """ - if not (isinstance(sun_dist, float) and isinstance(earth_dist, float) - and isinstance(phase_angle, (float, Angle))): + if not ( + isinstance(sun_dist, float) and isinstance(earth_dist, float) + and isinstance(phase_angle, (float, Angle)) + ): raise TypeError("Invalid input types") i = float(phase_angle) - m = (-4.0 + 5.0 * log10(sun_dist * earth_dist) + 0.01322 * i - + 0.0000004247 * i * i * i) + m = ( + -4.0 + 5.0 * log10(sun_dist * earth_dist) + 0.01322 * i + + 0.0000004247 * i * i * i + ) return round(m, 1) diff --git a/addon/globalPlugins/clock/pytz/__init__.py b/addon/globalPlugins/clock/pytz/__init__.py index e2f49fa..d10e254 100644 --- a/addon/globalPlugins/clock/pytz/__init__.py +++ b/addon/globalPlugins/clock/pytz/__init__.py @@ -92,8 +92,10 @@ def open_resource(name): if zoneinfo_dir is not None: filename = os.path.join(zoneinfo_dir, *name_parts) else: - filename = os.path.join(os.path.dirname(__file__), - 'zoneinfo', *name_parts) + filename = os.path.join( + os.path.dirname(__file__), + 'zoneinfo', *name_parts, + ) if not os.path.exists(filename): # http://bugs.launchpad.net/bugs/383171 - we avoid using this # unless absolutely necessary to help when a broken version of @@ -409,7 +411,7 @@ def utcoffset(self, dt): return self._offset def __reduce__(self): - return FixedOffset, (self._minutes, ) + return FixedOffset, (self._minutes,) def dst(self, dt): return ZERO @@ -515,1044 +517,1050 @@ def _test(): if __name__ == '__main__': _test() all_timezones = \ -['Africa/Abidjan', - 'Africa/Accra', - 'Africa/Addis_Ababa', - 'Africa/Algiers', - 'Africa/Asmara', - 'Africa/Asmera', - 'Africa/Bamako', - 'Africa/Bangui', - 'Africa/Banjul', - 'Africa/Bissau', - 'Africa/Blantyre', - 'Africa/Brazzaville', - 'Africa/Bujumbura', - 'Africa/Cairo', - 'Africa/Casablanca', - 'Africa/Ceuta', - 'Africa/Conakry', - 'Africa/Dakar', - 'Africa/Dar_es_Salaam', - 'Africa/Djibouti', - 'Africa/Douala', - 'Africa/El_Aaiun', - 'Africa/Freetown', - 'Africa/Gaborone', - 'Africa/Harare', - 'Africa/Johannesburg', - 'Africa/Juba', - 'Africa/Kampala', - 'Africa/Khartoum', - 'Africa/Kigali', - 'Africa/Kinshasa', - 'Africa/Lagos', - 'Africa/Libreville', - 'Africa/Lome', - 'Africa/Luanda', - 'Africa/Lubumbashi', - 'Africa/Lusaka', - 'Africa/Malabo', - 'Africa/Maputo', - 'Africa/Maseru', - 'Africa/Mbabane', - 'Africa/Mogadishu', - 'Africa/Monrovia', - 'Africa/Nairobi', - 'Africa/Ndjamena', - 'Africa/Niamey', - 'Africa/Nouakchott', - 'Africa/Ouagadougou', - 'Africa/Porto-Novo', - 'Africa/Sao_Tome', - 'Africa/Timbuktu', - 'Africa/Tripoli', - 'Africa/Tunis', - 'Africa/Windhoek', - 'America/Adak', - 'America/Anchorage', - 'America/Anguilla', - 'America/Antigua', - 'America/Araguaina', - 'America/Argentina/Buenos_Aires', - 'America/Argentina/Catamarca', - 'America/Argentina/ComodRivadavia', - 'America/Argentina/Cordoba', - 'America/Argentina/Jujuy', - 'America/Argentina/La_Rioja', - 'America/Argentina/Mendoza', - 'America/Argentina/Rio_Gallegos', - 'America/Argentina/Salta', - 'America/Argentina/San_Juan', - 'America/Argentina/San_Luis', - 'America/Argentina/Tucuman', - 'America/Argentina/Ushuaia', - 'America/Aruba', - 'America/Asuncion', - 'America/Atikokan', - 'America/Atka', - 'America/Bahia', - 'America/Bahia_Banderas', - 'America/Barbados', - 'America/Belem', - 'America/Belize', - 'America/Blanc-Sablon', - 'America/Boa_Vista', - 'America/Bogota', - 'America/Boise', - 'America/Buenos_Aires', - 'America/Cambridge_Bay', - 'America/Campo_Grande', - 'America/Cancun', - 'America/Caracas', - 'America/Catamarca', - 'America/Cayenne', - 'America/Cayman', - 'America/Chicago', - 'America/Chihuahua', - 'America/Coral_Harbour', - 'America/Cordoba', - 'America/Costa_Rica', - 'America/Creston', - 'America/Cuiaba', - 'America/Curacao', - 'America/Danmarkshavn', - 'America/Dawson', - 'America/Dawson_Creek', - 'America/Denver', - 'America/Detroit', - 'America/Dominica', - 'America/Edmonton', - 'America/Eirunepe', - 'America/El_Salvador', - 'America/Ensenada', - 'America/Fort_Nelson', - 'America/Fort_Wayne', - 'America/Fortaleza', - 'America/Glace_Bay', - 'America/Godthab', - 'America/Goose_Bay', - 'America/Grand_Turk', - 'America/Grenada', - 'America/Guadeloupe', - 'America/Guatemala', - 'America/Guayaquil', - 'America/Guyana', - 'America/Halifax', - 'America/Havana', - 'America/Hermosillo', - 'America/Indiana/Indianapolis', - 'America/Indiana/Knox', - 'America/Indiana/Marengo', - 'America/Indiana/Petersburg', - 'America/Indiana/Tell_City', - 'America/Indiana/Vevay', - 'America/Indiana/Vincennes', - 'America/Indiana/Winamac', - 'America/Indianapolis', - 'America/Inuvik', - 'America/Iqaluit', - 'America/Jamaica', - 'America/Jujuy', - 'America/Juneau', - 'America/Kentucky/Louisville', - 'America/Kentucky/Monticello', - 'America/Knox_IN', - 'America/Kralendijk', - 'America/La_Paz', - 'America/Lima', - 'America/Los_Angeles', - 'America/Louisville', - 'America/Lower_Princes', - 'America/Maceio', - 'America/Managua', - 'America/Manaus', - 'America/Marigot', - 'America/Martinique', - 'America/Matamoros', - 'America/Mazatlan', - 'America/Mendoza', - 'America/Menominee', - 'America/Merida', - 'America/Metlakatla', - 'America/Mexico_City', - 'America/Miquelon', - 'America/Moncton', - 'America/Monterrey', - 'America/Montevideo', - 'America/Montreal', - 'America/Montserrat', - 'America/Nassau', - 'America/New_York', - 'America/Nipigon', - 'America/Nome', - 'America/Noronha', - 'America/North_Dakota/Beulah', - 'America/North_Dakota/Center', - 'America/North_Dakota/New_Salem', - 'America/Nuuk', - 'America/Ojinaga', - 'America/Panama', - 'America/Pangnirtung', - 'America/Paramaribo', - 'America/Phoenix', - 'America/Port-au-Prince', - 'America/Port_of_Spain', - 'America/Porto_Acre', - 'America/Porto_Velho', - 'America/Puerto_Rico', - 'America/Punta_Arenas', - 'America/Rainy_River', - 'America/Rankin_Inlet', - 'America/Recife', - 'America/Regina', - 'America/Resolute', - 'America/Rio_Branco', - 'America/Rosario', - 'America/Santa_Isabel', - 'America/Santarem', - 'America/Santiago', - 'America/Santo_Domingo', - 'America/Sao_Paulo', - 'America/Scoresbysund', - 'America/Shiprock', - 'America/Sitka', - 'America/St_Barthelemy', - 'America/St_Johns', - 'America/St_Kitts', - 'America/St_Lucia', - 'America/St_Thomas', - 'America/St_Vincent', - 'America/Swift_Current', - 'America/Tegucigalpa', - 'America/Thule', - 'America/Thunder_Bay', - 'America/Tijuana', - 'America/Toronto', - 'America/Tortola', - 'America/Vancouver', - 'America/Virgin', - 'America/Whitehorse', - 'America/Winnipeg', - 'America/Yakutat', - 'America/Yellowknife', - 'Antarctica/Casey', - 'Antarctica/Davis', - 'Antarctica/DumontDUrville', - 'Antarctica/Macquarie', - 'Antarctica/Mawson', - 'Antarctica/McMurdo', - 'Antarctica/Palmer', - 'Antarctica/Rothera', - 'Antarctica/South_Pole', - 'Antarctica/Syowa', - 'Antarctica/Troll', - 'Antarctica/Vostok', - 'Arctic/Longyearbyen', - 'Asia/Aden', - 'Asia/Almaty', - 'Asia/Amman', - 'Asia/Anadyr', - 'Asia/Aqtau', - 'Asia/Aqtobe', - 'Asia/Ashgabat', - 'Asia/Ashkhabad', - 'Asia/Atyrau', - 'Asia/Baghdad', - 'Asia/Bahrain', - 'Asia/Baku', - 'Asia/Bangkok', - 'Asia/Barnaul', - 'Asia/Beirut', - 'Asia/Bishkek', - 'Asia/Brunei', - 'Asia/Calcutta', - 'Asia/Chita', - 'Asia/Choibalsan', - 'Asia/Chongqing', - 'Asia/Chungking', - 'Asia/Colombo', - 'Asia/Dacca', - 'Asia/Damascus', - 'Asia/Dhaka', - 'Asia/Dili', - 'Asia/Dubai', - 'Asia/Dushanbe', - 'Asia/Famagusta', - 'Asia/Gaza', - 'Asia/Harbin', - 'Asia/Hebron', - 'Asia/Ho_Chi_Minh', - 'Asia/Hong_Kong', - 'Asia/Hovd', - 'Asia/Irkutsk', - 'Asia/Istanbul', - 'Asia/Jakarta', - 'Asia/Jayapura', - 'Asia/Jerusalem', - 'Asia/Kabul', - 'Asia/Kamchatka', - 'Asia/Karachi', - 'Asia/Kashgar', - 'Asia/Kathmandu', - 'Asia/Katmandu', - 'Asia/Khandyga', - 'Asia/Kolkata', - 'Asia/Krasnoyarsk', - 'Asia/Kuala_Lumpur', - 'Asia/Kuching', - 'Asia/Kuwait', - 'Asia/Macao', - 'Asia/Macau', - 'Asia/Magadan', - 'Asia/Makassar', - 'Asia/Manila', - 'Asia/Muscat', - 'Asia/Nicosia', - 'Asia/Novokuznetsk', - 'Asia/Novosibirsk', - 'Asia/Omsk', - 'Asia/Oral', - 'Asia/Phnom_Penh', - 'Asia/Pontianak', - 'Asia/Pyongyang', - 'Asia/Qatar', - 'Asia/Qostanay', - 'Asia/Qyzylorda', - 'Asia/Rangoon', - 'Asia/Riyadh', - 'Asia/Saigon', - 'Asia/Sakhalin', - 'Asia/Samarkand', - 'Asia/Seoul', - 'Asia/Shanghai', - 'Asia/Singapore', - 'Asia/Srednekolymsk', - 'Asia/Taipei', - 'Asia/Tashkent', - 'Asia/Tbilisi', - 'Asia/Tehran', - 'Asia/Tel_Aviv', - 'Asia/Thimbu', - 'Asia/Thimphu', - 'Asia/Tokyo', - 'Asia/Tomsk', - 'Asia/Ujung_Pandang', - 'Asia/Ulaanbaatar', - 'Asia/Ulan_Bator', - 'Asia/Urumqi', - 'Asia/Ust-Nera', - 'Asia/Vientiane', - 'Asia/Vladivostok', - 'Asia/Yakutsk', - 'Asia/Yangon', - 'Asia/Yekaterinburg', - 'Asia/Yerevan', - 'Atlantic/Azores', - 'Atlantic/Bermuda', - 'Atlantic/Canary', - 'Atlantic/Cape_Verde', - 'Atlantic/Faeroe', - 'Atlantic/Faroe', - 'Atlantic/Jan_Mayen', - 'Atlantic/Madeira', - 'Atlantic/Reykjavik', - 'Atlantic/South_Georgia', - 'Atlantic/St_Helena', - 'Atlantic/Stanley', - 'Australia/ACT', - 'Australia/Adelaide', - 'Australia/Brisbane', - 'Australia/Broken_Hill', - 'Australia/Canberra', - 'Australia/Currie', - 'Australia/Darwin', - 'Australia/Eucla', - 'Australia/Hobart', - 'Australia/LHI', - 'Australia/Lindeman', - 'Australia/Lord_Howe', - 'Australia/Melbourne', - 'Australia/NSW', - 'Australia/North', - 'Australia/Perth', - 'Australia/Queensland', - 'Australia/South', - 'Australia/Sydney', - 'Australia/Tasmania', - 'Australia/Victoria', - 'Australia/West', - 'Australia/Yancowinna', - 'Brazil/Acre', - 'Brazil/DeNoronha', - 'Brazil/East', - 'Brazil/West', - 'CET', - 'CST6CDT', - 'Canada/Atlantic', - 'Canada/Central', - 'Canada/Eastern', - 'Canada/Mountain', - 'Canada/Newfoundland', - 'Canada/Pacific', - 'Canada/Saskatchewan', - 'Canada/Yukon', - 'Chile/Continental', - 'Chile/EasterIsland', - 'Cuba', - 'EET', - 'EST', - 'EST5EDT', - 'Egypt', - 'Eire', - 'Etc/GMT', - 'Etc/GMT+0', - 'Etc/GMT+1', - 'Etc/GMT+10', - 'Etc/GMT+11', - 'Etc/GMT+12', - 'Etc/GMT+2', - 'Etc/GMT+3', - 'Etc/GMT+4', - 'Etc/GMT+5', - 'Etc/GMT+6', - 'Etc/GMT+7', - 'Etc/GMT+8', - 'Etc/GMT+9', - 'Etc/GMT-0', - 'Etc/GMT-1', - 'Etc/GMT-10', - 'Etc/GMT-11', - 'Etc/GMT-12', - 'Etc/GMT-13', - 'Etc/GMT-14', - 'Etc/GMT-2', - 'Etc/GMT-3', - 'Etc/GMT-4', - 'Etc/GMT-5', - 'Etc/GMT-6', - 'Etc/GMT-7', - 'Etc/GMT-8', - 'Etc/GMT-9', - 'Etc/GMT0', - 'Etc/Greenwich', - 'Etc/UCT', - 'Etc/UTC', - 'Etc/Universal', - 'Etc/Zulu', - 'Europe/Amsterdam', - 'Europe/Andorra', - 'Europe/Astrakhan', - 'Europe/Athens', - 'Europe/Belfast', - 'Europe/Belgrade', - 'Europe/Berlin', - 'Europe/Bratislava', - 'Europe/Brussels', - 'Europe/Bucharest', - 'Europe/Budapest', - 'Europe/Busingen', - 'Europe/Chisinau', - 'Europe/Copenhagen', - 'Europe/Dublin', - 'Europe/Gibraltar', - 'Europe/Guernsey', - 'Europe/Helsinki', - 'Europe/Isle_of_Man', - 'Europe/Istanbul', - 'Europe/Jersey', - 'Europe/Kaliningrad', - 'Europe/Kiev', - 'Europe/Kirov', - 'Europe/Lisbon', - 'Europe/Ljubljana', - 'Europe/London', - 'Europe/Luxembourg', - 'Europe/Madrid', - 'Europe/Malta', - 'Europe/Mariehamn', - 'Europe/Minsk', - 'Europe/Monaco', - 'Europe/Moscow', - 'Europe/Nicosia', - 'Europe/Oslo', - 'Europe/Paris', - 'Europe/Podgorica', - 'Europe/Prague', - 'Europe/Riga', - 'Europe/Rome', - 'Europe/Samara', - 'Europe/San_Marino', - 'Europe/Sarajevo', - 'Europe/Saratov', - 'Europe/Simferopol', - 'Europe/Skopje', - 'Europe/Sofia', - 'Europe/Stockholm', - 'Europe/Tallinn', - 'Europe/Tirane', - 'Europe/Tiraspol', - 'Europe/Ulyanovsk', - 'Europe/Uzhgorod', - 'Europe/Vaduz', - 'Europe/Vatican', - 'Europe/Vienna', - 'Europe/Vilnius', - 'Europe/Volgograd', - 'Europe/Warsaw', - 'Europe/Zagreb', - 'Europe/Zaporozhye', - 'Europe/Zurich', - 'GB', - 'GB-Eire', - 'GMT', - 'GMT+0', - 'GMT-0', - 'GMT0', - 'Greenwich', - 'HST', - 'Hongkong', - 'Iceland', - 'Indian/Antananarivo', - 'Indian/Chagos', - 'Indian/Christmas', - 'Indian/Cocos', - 'Indian/Comoro', - 'Indian/Kerguelen', - 'Indian/Mahe', - 'Indian/Maldives', - 'Indian/Mauritius', - 'Indian/Mayotte', - 'Indian/Reunion', - 'Iran', - 'Israel', - 'Jamaica', - 'Japan', - 'Kwajalein', - 'Libya', - 'MET', - 'MST', - 'MST7MDT', - 'Mexico/BajaNorte', - 'Mexico/BajaSur', - 'Mexico/General', - 'NZ', - 'NZ-CHAT', - 'Navajo', - 'PRC', - 'PST8PDT', - 'Pacific/Apia', - 'Pacific/Auckland', - 'Pacific/Bougainville', - 'Pacific/Chatham', - 'Pacific/Chuuk', - 'Pacific/Easter', - 'Pacific/Efate', - 'Pacific/Enderbury', - 'Pacific/Fakaofo', - 'Pacific/Fiji', - 'Pacific/Funafuti', - 'Pacific/Galapagos', - 'Pacific/Gambier', - 'Pacific/Guadalcanal', - 'Pacific/Guam', - 'Pacific/Honolulu', - 'Pacific/Johnston', - 'Pacific/Kiritimati', - 'Pacific/Kosrae', - 'Pacific/Kwajalein', - 'Pacific/Majuro', - 'Pacific/Marquesas', - 'Pacific/Midway', - 'Pacific/Nauru', - 'Pacific/Niue', - 'Pacific/Norfolk', - 'Pacific/Noumea', - 'Pacific/Pago_Pago', - 'Pacific/Palau', - 'Pacific/Pitcairn', - 'Pacific/Pohnpei', - 'Pacific/Ponape', - 'Pacific/Port_Moresby', - 'Pacific/Rarotonga', - 'Pacific/Saipan', - 'Pacific/Samoa', - 'Pacific/Tahiti', - 'Pacific/Tarawa', - 'Pacific/Tongatapu', - 'Pacific/Truk', - 'Pacific/Wake', - 'Pacific/Wallis', - 'Pacific/Yap', - 'Poland', - 'Portugal', - 'ROC', - 'ROK', - 'Singapore', - 'Turkey', - 'UCT', - 'US/Alaska', - 'US/Aleutian', - 'US/Arizona', - 'US/Central', - 'US/East-Indiana', - 'US/Eastern', - 'US/Hawaii', - 'US/Indiana-Starke', - 'US/Michigan', - 'US/Mountain', - 'US/Pacific', - 'US/Samoa', - 'UTC', - 'Universal', - 'W-SU', - 'WET', - 'Zulu'] +[ + 'Africa/Abidjan', + 'Africa/Accra', + 'Africa/Addis_Ababa', + 'Africa/Algiers', + 'Africa/Asmara', + 'Africa/Asmera', + 'Africa/Bamako', + 'Africa/Bangui', + 'Africa/Banjul', + 'Africa/Bissau', + 'Africa/Blantyre', + 'Africa/Brazzaville', + 'Africa/Bujumbura', + 'Africa/Cairo', + 'Africa/Casablanca', + 'Africa/Ceuta', + 'Africa/Conakry', + 'Africa/Dakar', + 'Africa/Dar_es_Salaam', + 'Africa/Djibouti', + 'Africa/Douala', + 'Africa/El_Aaiun', + 'Africa/Freetown', + 'Africa/Gaborone', + 'Africa/Harare', + 'Africa/Johannesburg', + 'Africa/Juba', + 'Africa/Kampala', + 'Africa/Khartoum', + 'Africa/Kigali', + 'Africa/Kinshasa', + 'Africa/Lagos', + 'Africa/Libreville', + 'Africa/Lome', + 'Africa/Luanda', + 'Africa/Lubumbashi', + 'Africa/Lusaka', + 'Africa/Malabo', + 'Africa/Maputo', + 'Africa/Maseru', + 'Africa/Mbabane', + 'Africa/Mogadishu', + 'Africa/Monrovia', + 'Africa/Nairobi', + 'Africa/Ndjamena', + 'Africa/Niamey', + 'Africa/Nouakchott', + 'Africa/Ouagadougou', + 'Africa/Porto-Novo', + 'Africa/Sao_Tome', + 'Africa/Timbuktu', + 'Africa/Tripoli', + 'Africa/Tunis', + 'Africa/Windhoek', + 'America/Adak', + 'America/Anchorage', + 'America/Anguilla', + 'America/Antigua', + 'America/Araguaina', + 'America/Argentina/Buenos_Aires', + 'America/Argentina/Catamarca', + 'America/Argentina/ComodRivadavia', + 'America/Argentina/Cordoba', + 'America/Argentina/Jujuy', + 'America/Argentina/La_Rioja', + 'America/Argentina/Mendoza', + 'America/Argentina/Rio_Gallegos', + 'America/Argentina/Salta', + 'America/Argentina/San_Juan', + 'America/Argentina/San_Luis', + 'America/Argentina/Tucuman', + 'America/Argentina/Ushuaia', + 'America/Aruba', + 'America/Asuncion', + 'America/Atikokan', + 'America/Atka', + 'America/Bahia', + 'America/Bahia_Banderas', + 'America/Barbados', + 'America/Belem', + 'America/Belize', + 'America/Blanc-Sablon', + 'America/Boa_Vista', + 'America/Bogota', + 'America/Boise', + 'America/Buenos_Aires', + 'America/Cambridge_Bay', + 'America/Campo_Grande', + 'America/Cancun', + 'America/Caracas', + 'America/Catamarca', + 'America/Cayenne', + 'America/Cayman', + 'America/Chicago', + 'America/Chihuahua', + 'America/Coral_Harbour', + 'America/Cordoba', + 'America/Costa_Rica', + 'America/Creston', + 'America/Cuiaba', + 'America/Curacao', + 'America/Danmarkshavn', + 'America/Dawson', + 'America/Dawson_Creek', + 'America/Denver', + 'America/Detroit', + 'America/Dominica', + 'America/Edmonton', + 'America/Eirunepe', + 'America/El_Salvador', + 'America/Ensenada', + 'America/Fort_Nelson', + 'America/Fort_Wayne', + 'America/Fortaleza', + 'America/Glace_Bay', + 'America/Godthab', + 'America/Goose_Bay', + 'America/Grand_Turk', + 'America/Grenada', + 'America/Guadeloupe', + 'America/Guatemala', + 'America/Guayaquil', + 'America/Guyana', + 'America/Halifax', + 'America/Havana', + 'America/Hermosillo', + 'America/Indiana/Indianapolis', + 'America/Indiana/Knox', + 'America/Indiana/Marengo', + 'America/Indiana/Petersburg', + 'America/Indiana/Tell_City', + 'America/Indiana/Vevay', + 'America/Indiana/Vincennes', + 'America/Indiana/Winamac', + 'America/Indianapolis', + 'America/Inuvik', + 'America/Iqaluit', + 'America/Jamaica', + 'America/Jujuy', + 'America/Juneau', + 'America/Kentucky/Louisville', + 'America/Kentucky/Monticello', + 'America/Knox_IN', + 'America/Kralendijk', + 'America/La_Paz', + 'America/Lima', + 'America/Los_Angeles', + 'America/Louisville', + 'America/Lower_Princes', + 'America/Maceio', + 'America/Managua', + 'America/Manaus', + 'America/Marigot', + 'America/Martinique', + 'America/Matamoros', + 'America/Mazatlan', + 'America/Mendoza', + 'America/Menominee', + 'America/Merida', + 'America/Metlakatla', + 'America/Mexico_City', + 'America/Miquelon', + 'America/Moncton', + 'America/Monterrey', + 'America/Montevideo', + 'America/Montreal', + 'America/Montserrat', + 'America/Nassau', + 'America/New_York', + 'America/Nipigon', + 'America/Nome', + 'America/Noronha', + 'America/North_Dakota/Beulah', + 'America/North_Dakota/Center', + 'America/North_Dakota/New_Salem', + 'America/Nuuk', + 'America/Ojinaga', + 'America/Panama', + 'America/Pangnirtung', + 'America/Paramaribo', + 'America/Phoenix', + 'America/Port-au-Prince', + 'America/Port_of_Spain', + 'America/Porto_Acre', + 'America/Porto_Velho', + 'America/Puerto_Rico', + 'America/Punta_Arenas', + 'America/Rainy_River', + 'America/Rankin_Inlet', + 'America/Recife', + 'America/Regina', + 'America/Resolute', + 'America/Rio_Branco', + 'America/Rosario', + 'America/Santa_Isabel', + 'America/Santarem', + 'America/Santiago', + 'America/Santo_Domingo', + 'America/Sao_Paulo', + 'America/Scoresbysund', + 'America/Shiprock', + 'America/Sitka', + 'America/St_Barthelemy', + 'America/St_Johns', + 'America/St_Kitts', + 'America/St_Lucia', + 'America/St_Thomas', + 'America/St_Vincent', + 'America/Swift_Current', + 'America/Tegucigalpa', + 'America/Thule', + 'America/Thunder_Bay', + 'America/Tijuana', + 'America/Toronto', + 'America/Tortola', + 'America/Vancouver', + 'America/Virgin', + 'America/Whitehorse', + 'America/Winnipeg', + 'America/Yakutat', + 'America/Yellowknife', + 'Antarctica/Casey', + 'Antarctica/Davis', + 'Antarctica/DumontDUrville', + 'Antarctica/Macquarie', + 'Antarctica/Mawson', + 'Antarctica/McMurdo', + 'Antarctica/Palmer', + 'Antarctica/Rothera', + 'Antarctica/South_Pole', + 'Antarctica/Syowa', + 'Antarctica/Troll', + 'Antarctica/Vostok', + 'Arctic/Longyearbyen', + 'Asia/Aden', + 'Asia/Almaty', + 'Asia/Amman', + 'Asia/Anadyr', + 'Asia/Aqtau', + 'Asia/Aqtobe', + 'Asia/Ashgabat', + 'Asia/Ashkhabad', + 'Asia/Atyrau', + 'Asia/Baghdad', + 'Asia/Bahrain', + 'Asia/Baku', + 'Asia/Bangkok', + 'Asia/Barnaul', + 'Asia/Beirut', + 'Asia/Bishkek', + 'Asia/Brunei', + 'Asia/Calcutta', + 'Asia/Chita', + 'Asia/Choibalsan', + 'Asia/Chongqing', + 'Asia/Chungking', + 'Asia/Colombo', + 'Asia/Dacca', + 'Asia/Damascus', + 'Asia/Dhaka', + 'Asia/Dili', + 'Asia/Dubai', + 'Asia/Dushanbe', + 'Asia/Famagusta', + 'Asia/Gaza', + 'Asia/Harbin', + 'Asia/Hebron', + 'Asia/Ho_Chi_Minh', + 'Asia/Hong_Kong', + 'Asia/Hovd', + 'Asia/Irkutsk', + 'Asia/Istanbul', + 'Asia/Jakarta', + 'Asia/Jayapura', + 'Asia/Jerusalem', + 'Asia/Kabul', + 'Asia/Kamchatka', + 'Asia/Karachi', + 'Asia/Kashgar', + 'Asia/Kathmandu', + 'Asia/Katmandu', + 'Asia/Khandyga', + 'Asia/Kolkata', + 'Asia/Krasnoyarsk', + 'Asia/Kuala_Lumpur', + 'Asia/Kuching', + 'Asia/Kuwait', + 'Asia/Macao', + 'Asia/Macau', + 'Asia/Magadan', + 'Asia/Makassar', + 'Asia/Manila', + 'Asia/Muscat', + 'Asia/Nicosia', + 'Asia/Novokuznetsk', + 'Asia/Novosibirsk', + 'Asia/Omsk', + 'Asia/Oral', + 'Asia/Phnom_Penh', + 'Asia/Pontianak', + 'Asia/Pyongyang', + 'Asia/Qatar', + 'Asia/Qostanay', + 'Asia/Qyzylorda', + 'Asia/Rangoon', + 'Asia/Riyadh', + 'Asia/Saigon', + 'Asia/Sakhalin', + 'Asia/Samarkand', + 'Asia/Seoul', + 'Asia/Shanghai', + 'Asia/Singapore', + 'Asia/Srednekolymsk', + 'Asia/Taipei', + 'Asia/Tashkent', + 'Asia/Tbilisi', + 'Asia/Tehran', + 'Asia/Tel_Aviv', + 'Asia/Thimbu', + 'Asia/Thimphu', + 'Asia/Tokyo', + 'Asia/Tomsk', + 'Asia/Ujung_Pandang', + 'Asia/Ulaanbaatar', + 'Asia/Ulan_Bator', + 'Asia/Urumqi', + 'Asia/Ust-Nera', + 'Asia/Vientiane', + 'Asia/Vladivostok', + 'Asia/Yakutsk', + 'Asia/Yangon', + 'Asia/Yekaterinburg', + 'Asia/Yerevan', + 'Atlantic/Azores', + 'Atlantic/Bermuda', + 'Atlantic/Canary', + 'Atlantic/Cape_Verde', + 'Atlantic/Faeroe', + 'Atlantic/Faroe', + 'Atlantic/Jan_Mayen', + 'Atlantic/Madeira', + 'Atlantic/Reykjavik', + 'Atlantic/South_Georgia', + 'Atlantic/St_Helena', + 'Atlantic/Stanley', + 'Australia/ACT', + 'Australia/Adelaide', + 'Australia/Brisbane', + 'Australia/Broken_Hill', + 'Australia/Canberra', + 'Australia/Currie', + 'Australia/Darwin', + 'Australia/Eucla', + 'Australia/Hobart', + 'Australia/LHI', + 'Australia/Lindeman', + 'Australia/Lord_Howe', + 'Australia/Melbourne', + 'Australia/NSW', + 'Australia/North', + 'Australia/Perth', + 'Australia/Queensland', + 'Australia/South', + 'Australia/Sydney', + 'Australia/Tasmania', + 'Australia/Victoria', + 'Australia/West', + 'Australia/Yancowinna', + 'Brazil/Acre', + 'Brazil/DeNoronha', + 'Brazil/East', + 'Brazil/West', + 'CET', + 'CST6CDT', + 'Canada/Atlantic', + 'Canada/Central', + 'Canada/Eastern', + 'Canada/Mountain', + 'Canada/Newfoundland', + 'Canada/Pacific', + 'Canada/Saskatchewan', + 'Canada/Yukon', + 'Chile/Continental', + 'Chile/EasterIsland', + 'Cuba', + 'EET', + 'EST', + 'EST5EDT', + 'Egypt', + 'Eire', + 'Etc/GMT', + 'Etc/GMT+0', + 'Etc/GMT+1', + 'Etc/GMT+10', + 'Etc/GMT+11', + 'Etc/GMT+12', + 'Etc/GMT+2', + 'Etc/GMT+3', + 'Etc/GMT+4', + 'Etc/GMT+5', + 'Etc/GMT+6', + 'Etc/GMT+7', + 'Etc/GMT+8', + 'Etc/GMT+9', + 'Etc/GMT-0', + 'Etc/GMT-1', + 'Etc/GMT-10', + 'Etc/GMT-11', + 'Etc/GMT-12', + 'Etc/GMT-13', + 'Etc/GMT-14', + 'Etc/GMT-2', + 'Etc/GMT-3', + 'Etc/GMT-4', + 'Etc/GMT-5', + 'Etc/GMT-6', + 'Etc/GMT-7', + 'Etc/GMT-8', + 'Etc/GMT-9', + 'Etc/GMT0', + 'Etc/Greenwich', + 'Etc/UCT', + 'Etc/UTC', + 'Etc/Universal', + 'Etc/Zulu', + 'Europe/Amsterdam', + 'Europe/Andorra', + 'Europe/Astrakhan', + 'Europe/Athens', + 'Europe/Belfast', + 'Europe/Belgrade', + 'Europe/Berlin', + 'Europe/Bratislava', + 'Europe/Brussels', + 'Europe/Bucharest', + 'Europe/Budapest', + 'Europe/Busingen', + 'Europe/Chisinau', + 'Europe/Copenhagen', + 'Europe/Dublin', + 'Europe/Gibraltar', + 'Europe/Guernsey', + 'Europe/Helsinki', + 'Europe/Isle_of_Man', + 'Europe/Istanbul', + 'Europe/Jersey', + 'Europe/Kaliningrad', + 'Europe/Kiev', + 'Europe/Kirov', + 'Europe/Lisbon', + 'Europe/Ljubljana', + 'Europe/London', + 'Europe/Luxembourg', + 'Europe/Madrid', + 'Europe/Malta', + 'Europe/Mariehamn', + 'Europe/Minsk', + 'Europe/Monaco', + 'Europe/Moscow', + 'Europe/Nicosia', + 'Europe/Oslo', + 'Europe/Paris', + 'Europe/Podgorica', + 'Europe/Prague', + 'Europe/Riga', + 'Europe/Rome', + 'Europe/Samara', + 'Europe/San_Marino', + 'Europe/Sarajevo', + 'Europe/Saratov', + 'Europe/Simferopol', + 'Europe/Skopje', + 'Europe/Sofia', + 'Europe/Stockholm', + 'Europe/Tallinn', + 'Europe/Tirane', + 'Europe/Tiraspol', + 'Europe/Ulyanovsk', + 'Europe/Uzhgorod', + 'Europe/Vaduz', + 'Europe/Vatican', + 'Europe/Vienna', + 'Europe/Vilnius', + 'Europe/Volgograd', + 'Europe/Warsaw', + 'Europe/Zagreb', + 'Europe/Zaporozhye', + 'Europe/Zurich', + 'GB', + 'GB-Eire', + 'GMT', + 'GMT+0', + 'GMT-0', + 'GMT0', + 'Greenwich', + 'HST', + 'Hongkong', + 'Iceland', + 'Indian/Antananarivo', + 'Indian/Chagos', + 'Indian/Christmas', + 'Indian/Cocos', + 'Indian/Comoro', + 'Indian/Kerguelen', + 'Indian/Mahe', + 'Indian/Maldives', + 'Indian/Mauritius', + 'Indian/Mayotte', + 'Indian/Reunion', + 'Iran', + 'Israel', + 'Jamaica', + 'Japan', + 'Kwajalein', + 'Libya', + 'MET', + 'MST', + 'MST7MDT', + 'Mexico/BajaNorte', + 'Mexico/BajaSur', + 'Mexico/General', + 'NZ', + 'NZ-CHAT', + 'Navajo', + 'PRC', + 'PST8PDT', + 'Pacific/Apia', + 'Pacific/Auckland', + 'Pacific/Bougainville', + 'Pacific/Chatham', + 'Pacific/Chuuk', + 'Pacific/Easter', + 'Pacific/Efate', + 'Pacific/Enderbury', + 'Pacific/Fakaofo', + 'Pacific/Fiji', + 'Pacific/Funafuti', + 'Pacific/Galapagos', + 'Pacific/Gambier', + 'Pacific/Guadalcanal', + 'Pacific/Guam', + 'Pacific/Honolulu', + 'Pacific/Johnston', + 'Pacific/Kiritimati', + 'Pacific/Kosrae', + 'Pacific/Kwajalein', + 'Pacific/Majuro', + 'Pacific/Marquesas', + 'Pacific/Midway', + 'Pacific/Nauru', + 'Pacific/Niue', + 'Pacific/Norfolk', + 'Pacific/Noumea', + 'Pacific/Pago_Pago', + 'Pacific/Palau', + 'Pacific/Pitcairn', + 'Pacific/Pohnpei', + 'Pacific/Ponape', + 'Pacific/Port_Moresby', + 'Pacific/Rarotonga', + 'Pacific/Saipan', + 'Pacific/Samoa', + 'Pacific/Tahiti', + 'Pacific/Tarawa', + 'Pacific/Tongatapu', + 'Pacific/Truk', + 'Pacific/Wake', + 'Pacific/Wallis', + 'Pacific/Yap', + 'Poland', + 'Portugal', + 'ROC', + 'ROK', + 'Singapore', + 'Turkey', + 'UCT', + 'US/Alaska', + 'US/Aleutian', + 'US/Arizona', + 'US/Central', + 'US/East-Indiana', + 'US/Eastern', + 'US/Hawaii', + 'US/Indiana-Starke', + 'US/Michigan', + 'US/Mountain', + 'US/Pacific', + 'US/Samoa', + 'UTC', + 'Universal', + 'W-SU', + 'WET', + 'Zulu', +] all_timezones = LazyList( - tz for tz in all_timezones if resource_exists(tz)) - + tz for tz in all_timezones if resource_exists(tz) +) + all_timezones_set = LazySet(all_timezones) common_timezones = \ -['Africa/Abidjan', - 'Africa/Accra', - 'Africa/Addis_Ababa', - 'Africa/Algiers', - 'Africa/Asmara', - 'Africa/Bamako', - 'Africa/Bangui', - 'Africa/Banjul', - 'Africa/Bissau', - 'Africa/Blantyre', - 'Africa/Brazzaville', - 'Africa/Bujumbura', - 'Africa/Cairo', - 'Africa/Casablanca', - 'Africa/Ceuta', - 'Africa/Conakry', - 'Africa/Dakar', - 'Africa/Dar_es_Salaam', - 'Africa/Djibouti', - 'Africa/Douala', - 'Africa/El_Aaiun', - 'Africa/Freetown', - 'Africa/Gaborone', - 'Africa/Harare', - 'Africa/Johannesburg', - 'Africa/Juba', - 'Africa/Kampala', - 'Africa/Khartoum', - 'Africa/Kigali', - 'Africa/Kinshasa', - 'Africa/Lagos', - 'Africa/Libreville', - 'Africa/Lome', - 'Africa/Luanda', - 'Africa/Lubumbashi', - 'Africa/Lusaka', - 'Africa/Malabo', - 'Africa/Maputo', - 'Africa/Maseru', - 'Africa/Mbabane', - 'Africa/Mogadishu', - 'Africa/Monrovia', - 'Africa/Nairobi', - 'Africa/Ndjamena', - 'Africa/Niamey', - 'Africa/Nouakchott', - 'Africa/Ouagadougou', - 'Africa/Porto-Novo', - 'Africa/Sao_Tome', - 'Africa/Tripoli', - 'Africa/Tunis', - 'Africa/Windhoek', - 'America/Adak', - 'America/Anchorage', - 'America/Anguilla', - 'America/Antigua', - 'America/Araguaina', - 'America/Argentina/Buenos_Aires', - 'America/Argentina/Catamarca', - 'America/Argentina/Cordoba', - 'America/Argentina/Jujuy', - 'America/Argentina/La_Rioja', - 'America/Argentina/Mendoza', - 'America/Argentina/Rio_Gallegos', - 'America/Argentina/Salta', - 'America/Argentina/San_Juan', - 'America/Argentina/San_Luis', - 'America/Argentina/Tucuman', - 'America/Argentina/Ushuaia', - 'America/Aruba', - 'America/Asuncion', - 'America/Atikokan', - 'America/Bahia', - 'America/Bahia_Banderas', - 'America/Barbados', - 'America/Belem', - 'America/Belize', - 'America/Blanc-Sablon', - 'America/Boa_Vista', - 'America/Bogota', - 'America/Boise', - 'America/Cambridge_Bay', - 'America/Campo_Grande', - 'America/Cancun', - 'America/Caracas', - 'America/Cayenne', - 'America/Cayman', - 'America/Chicago', - 'America/Chihuahua', - 'America/Costa_Rica', - 'America/Creston', - 'America/Cuiaba', - 'America/Curacao', - 'America/Danmarkshavn', - 'America/Dawson', - 'America/Dawson_Creek', - 'America/Denver', - 'America/Detroit', - 'America/Dominica', - 'America/Edmonton', - 'America/Eirunepe', - 'America/El_Salvador', - 'America/Fort_Nelson', - 'America/Fortaleza', - 'America/Glace_Bay', - 'America/Goose_Bay', - 'America/Grand_Turk', - 'America/Grenada', - 'America/Guadeloupe', - 'America/Guatemala', - 'America/Guayaquil', - 'America/Guyana', - 'America/Halifax', - 'America/Havana', - 'America/Hermosillo', - 'America/Indiana/Indianapolis', - 'America/Indiana/Knox', - 'America/Indiana/Marengo', - 'America/Indiana/Petersburg', - 'America/Indiana/Tell_City', - 'America/Indiana/Vevay', - 'America/Indiana/Vincennes', - 'America/Indiana/Winamac', - 'America/Inuvik', - 'America/Iqaluit', - 'America/Jamaica', - 'America/Juneau', - 'America/Kentucky/Louisville', - 'America/Kentucky/Monticello', - 'America/Kralendijk', - 'America/La_Paz', - 'America/Lima', - 'America/Los_Angeles', - 'America/Lower_Princes', - 'America/Maceio', - 'America/Managua', - 'America/Manaus', - 'America/Marigot', - 'America/Martinique', - 'America/Matamoros', - 'America/Mazatlan', - 'America/Menominee', - 'America/Merida', - 'America/Metlakatla', - 'America/Mexico_City', - 'America/Miquelon', - 'America/Moncton', - 'America/Monterrey', - 'America/Montevideo', - 'America/Montserrat', - 'America/Nassau', - 'America/New_York', - 'America/Nipigon', - 'America/Nome', - 'America/Noronha', - 'America/North_Dakota/Beulah', - 'America/North_Dakota/Center', - 'America/North_Dakota/New_Salem', - 'America/Nuuk', - 'America/Ojinaga', - 'America/Panama', - 'America/Pangnirtung', - 'America/Paramaribo', - 'America/Phoenix', - 'America/Port-au-Prince', - 'America/Port_of_Spain', - 'America/Porto_Velho', - 'America/Puerto_Rico', - 'America/Punta_Arenas', - 'America/Rainy_River', - 'America/Rankin_Inlet', - 'America/Recife', - 'America/Regina', - 'America/Resolute', - 'America/Rio_Branco', - 'America/Santarem', - 'America/Santiago', - 'America/Santo_Domingo', - 'America/Sao_Paulo', - 'America/Scoresbysund', - 'America/Sitka', - 'America/St_Barthelemy', - 'America/St_Johns', - 'America/St_Kitts', - 'America/St_Lucia', - 'America/St_Thomas', - 'America/St_Vincent', - 'America/Swift_Current', - 'America/Tegucigalpa', - 'America/Thule', - 'America/Thunder_Bay', - 'America/Tijuana', - 'America/Toronto', - 'America/Tortola', - 'America/Vancouver', - 'America/Whitehorse', - 'America/Winnipeg', - 'America/Yakutat', - 'America/Yellowknife', - 'Antarctica/Casey', - 'Antarctica/Davis', - 'Antarctica/DumontDUrville', - 'Antarctica/Macquarie', - 'Antarctica/Mawson', - 'Antarctica/McMurdo', - 'Antarctica/Palmer', - 'Antarctica/Rothera', - 'Antarctica/Syowa', - 'Antarctica/Troll', - 'Antarctica/Vostok', - 'Arctic/Longyearbyen', - 'Asia/Aden', - 'Asia/Almaty', - 'Asia/Amman', - 'Asia/Anadyr', - 'Asia/Aqtau', - 'Asia/Aqtobe', - 'Asia/Ashgabat', - 'Asia/Atyrau', - 'Asia/Baghdad', - 'Asia/Bahrain', - 'Asia/Baku', - 'Asia/Bangkok', - 'Asia/Barnaul', - 'Asia/Beirut', - 'Asia/Bishkek', - 'Asia/Brunei', - 'Asia/Chita', - 'Asia/Choibalsan', - 'Asia/Colombo', - 'Asia/Damascus', - 'Asia/Dhaka', - 'Asia/Dili', - 'Asia/Dubai', - 'Asia/Dushanbe', - 'Asia/Famagusta', - 'Asia/Gaza', - 'Asia/Hebron', - 'Asia/Ho_Chi_Minh', - 'Asia/Hong_Kong', - 'Asia/Hovd', - 'Asia/Irkutsk', - 'Asia/Jakarta', - 'Asia/Jayapura', - 'Asia/Jerusalem', - 'Asia/Kabul', - 'Asia/Kamchatka', - 'Asia/Karachi', - 'Asia/Kathmandu', - 'Asia/Khandyga', - 'Asia/Kolkata', - 'Asia/Krasnoyarsk', - 'Asia/Kuala_Lumpur', - 'Asia/Kuching', - 'Asia/Kuwait', - 'Asia/Macau', - 'Asia/Magadan', - 'Asia/Makassar', - 'Asia/Manila', - 'Asia/Muscat', - 'Asia/Nicosia', - 'Asia/Novokuznetsk', - 'Asia/Novosibirsk', - 'Asia/Omsk', - 'Asia/Oral', - 'Asia/Phnom_Penh', - 'Asia/Pontianak', - 'Asia/Pyongyang', - 'Asia/Qatar', - 'Asia/Qostanay', - 'Asia/Qyzylorda', - 'Asia/Riyadh', - 'Asia/Sakhalin', - 'Asia/Samarkand', - 'Asia/Seoul', - 'Asia/Shanghai', - 'Asia/Singapore', - 'Asia/Srednekolymsk', - 'Asia/Taipei', - 'Asia/Tashkent', - 'Asia/Tbilisi', - 'Asia/Tehran', - 'Asia/Thimphu', - 'Asia/Tokyo', - 'Asia/Tomsk', - 'Asia/Ulaanbaatar', - 'Asia/Urumqi', - 'Asia/Ust-Nera', - 'Asia/Vientiane', - 'Asia/Vladivostok', - 'Asia/Yakutsk', - 'Asia/Yangon', - 'Asia/Yekaterinburg', - 'Asia/Yerevan', - 'Atlantic/Azores', - 'Atlantic/Bermuda', - 'Atlantic/Canary', - 'Atlantic/Cape_Verde', - 'Atlantic/Faroe', - 'Atlantic/Madeira', - 'Atlantic/Reykjavik', - 'Atlantic/South_Georgia', - 'Atlantic/St_Helena', - 'Atlantic/Stanley', - 'Australia/Adelaide', - 'Australia/Brisbane', - 'Australia/Broken_Hill', - 'Australia/Darwin', - 'Australia/Eucla', - 'Australia/Hobart', - 'Australia/Lindeman', - 'Australia/Lord_Howe', - 'Australia/Melbourne', - 'Australia/Perth', - 'Australia/Sydney', - 'Canada/Atlantic', - 'Canada/Central', - 'Canada/Eastern', - 'Canada/Mountain', - 'Canada/Newfoundland', - 'Canada/Pacific', - 'Europe/Amsterdam', - 'Europe/Andorra', - 'Europe/Astrakhan', - 'Europe/Athens', - 'Europe/Belgrade', - 'Europe/Berlin', - 'Europe/Bratislava', - 'Europe/Brussels', - 'Europe/Bucharest', - 'Europe/Budapest', - 'Europe/Busingen', - 'Europe/Chisinau', - 'Europe/Copenhagen', - 'Europe/Dublin', - 'Europe/Gibraltar', - 'Europe/Guernsey', - 'Europe/Helsinki', - 'Europe/Isle_of_Man', - 'Europe/Istanbul', - 'Europe/Jersey', - 'Europe/Kaliningrad', - 'Europe/Kiev', - 'Europe/Kirov', - 'Europe/Lisbon', - 'Europe/Ljubljana', - 'Europe/London', - 'Europe/Luxembourg', - 'Europe/Madrid', - 'Europe/Malta', - 'Europe/Mariehamn', - 'Europe/Minsk', - 'Europe/Monaco', - 'Europe/Moscow', - 'Europe/Oslo', - 'Europe/Paris', - 'Europe/Podgorica', - 'Europe/Prague', - 'Europe/Riga', - 'Europe/Rome', - 'Europe/Samara', - 'Europe/San_Marino', - 'Europe/Sarajevo', - 'Europe/Saratov', - 'Europe/Simferopol', - 'Europe/Skopje', - 'Europe/Sofia', - 'Europe/Stockholm', - 'Europe/Tallinn', - 'Europe/Tirane', - 'Europe/Ulyanovsk', - 'Europe/Uzhgorod', - 'Europe/Vaduz', - 'Europe/Vatican', - 'Europe/Vienna', - 'Europe/Vilnius', - 'Europe/Volgograd', - 'Europe/Warsaw', - 'Europe/Zagreb', - 'Europe/Zaporozhye', - 'Europe/Zurich', - 'GMT', - 'Indian/Antananarivo', - 'Indian/Chagos', - 'Indian/Christmas', - 'Indian/Cocos', - 'Indian/Comoro', - 'Indian/Kerguelen', - 'Indian/Mahe', - 'Indian/Maldives', - 'Indian/Mauritius', - 'Indian/Mayotte', - 'Indian/Reunion', - 'Pacific/Apia', - 'Pacific/Auckland', - 'Pacific/Bougainville', - 'Pacific/Chatham', - 'Pacific/Chuuk', - 'Pacific/Easter', - 'Pacific/Efate', - 'Pacific/Enderbury', - 'Pacific/Fakaofo', - 'Pacific/Fiji', - 'Pacific/Funafuti', - 'Pacific/Galapagos', - 'Pacific/Gambier', - 'Pacific/Guadalcanal', - 'Pacific/Guam', - 'Pacific/Honolulu', - 'Pacific/Kiritimati', - 'Pacific/Kosrae', - 'Pacific/Kwajalein', - 'Pacific/Majuro', - 'Pacific/Marquesas', - 'Pacific/Midway', - 'Pacific/Nauru', - 'Pacific/Niue', - 'Pacific/Norfolk', - 'Pacific/Noumea', - 'Pacific/Pago_Pago', - 'Pacific/Palau', - 'Pacific/Pitcairn', - 'Pacific/Pohnpei', - 'Pacific/Port_Moresby', - 'Pacific/Rarotonga', - 'Pacific/Saipan', - 'Pacific/Tahiti', - 'Pacific/Tarawa', - 'Pacific/Tongatapu', - 'Pacific/Wake', - 'Pacific/Wallis', - 'US/Alaska', - 'US/Arizona', - 'US/Central', - 'US/Eastern', - 'US/Hawaii', - 'US/Mountain', - 'US/Pacific', - 'UTC'] +[ + 'Africa/Abidjan', + 'Africa/Accra', + 'Africa/Addis_Ababa', + 'Africa/Algiers', + 'Africa/Asmara', + 'Africa/Bamako', + 'Africa/Bangui', + 'Africa/Banjul', + 'Africa/Bissau', + 'Africa/Blantyre', + 'Africa/Brazzaville', + 'Africa/Bujumbura', + 'Africa/Cairo', + 'Africa/Casablanca', + 'Africa/Ceuta', + 'Africa/Conakry', + 'Africa/Dakar', + 'Africa/Dar_es_Salaam', + 'Africa/Djibouti', + 'Africa/Douala', + 'Africa/El_Aaiun', + 'Africa/Freetown', + 'Africa/Gaborone', + 'Africa/Harare', + 'Africa/Johannesburg', + 'Africa/Juba', + 'Africa/Kampala', + 'Africa/Khartoum', + 'Africa/Kigali', + 'Africa/Kinshasa', + 'Africa/Lagos', + 'Africa/Libreville', + 'Africa/Lome', + 'Africa/Luanda', + 'Africa/Lubumbashi', + 'Africa/Lusaka', + 'Africa/Malabo', + 'Africa/Maputo', + 'Africa/Maseru', + 'Africa/Mbabane', + 'Africa/Mogadishu', + 'Africa/Monrovia', + 'Africa/Nairobi', + 'Africa/Ndjamena', + 'Africa/Niamey', + 'Africa/Nouakchott', + 'Africa/Ouagadougou', + 'Africa/Porto-Novo', + 'Africa/Sao_Tome', + 'Africa/Tripoli', + 'Africa/Tunis', + 'Africa/Windhoek', + 'America/Adak', + 'America/Anchorage', + 'America/Anguilla', + 'America/Antigua', + 'America/Araguaina', + 'America/Argentina/Buenos_Aires', + 'America/Argentina/Catamarca', + 'America/Argentina/Cordoba', + 'America/Argentina/Jujuy', + 'America/Argentina/La_Rioja', + 'America/Argentina/Mendoza', + 'America/Argentina/Rio_Gallegos', + 'America/Argentina/Salta', + 'America/Argentina/San_Juan', + 'America/Argentina/San_Luis', + 'America/Argentina/Tucuman', + 'America/Argentina/Ushuaia', + 'America/Aruba', + 'America/Asuncion', + 'America/Atikokan', + 'America/Bahia', + 'America/Bahia_Banderas', + 'America/Barbados', + 'America/Belem', + 'America/Belize', + 'America/Blanc-Sablon', + 'America/Boa_Vista', + 'America/Bogota', + 'America/Boise', + 'America/Cambridge_Bay', + 'America/Campo_Grande', + 'America/Cancun', + 'America/Caracas', + 'America/Cayenne', + 'America/Cayman', + 'America/Chicago', + 'America/Chihuahua', + 'America/Costa_Rica', + 'America/Creston', + 'America/Cuiaba', + 'America/Curacao', + 'America/Danmarkshavn', + 'America/Dawson', + 'America/Dawson_Creek', + 'America/Denver', + 'America/Detroit', + 'America/Dominica', + 'America/Edmonton', + 'America/Eirunepe', + 'America/El_Salvador', + 'America/Fort_Nelson', + 'America/Fortaleza', + 'America/Glace_Bay', + 'America/Goose_Bay', + 'America/Grand_Turk', + 'America/Grenada', + 'America/Guadeloupe', + 'America/Guatemala', + 'America/Guayaquil', + 'America/Guyana', + 'America/Halifax', + 'America/Havana', + 'America/Hermosillo', + 'America/Indiana/Indianapolis', + 'America/Indiana/Knox', + 'America/Indiana/Marengo', + 'America/Indiana/Petersburg', + 'America/Indiana/Tell_City', + 'America/Indiana/Vevay', + 'America/Indiana/Vincennes', + 'America/Indiana/Winamac', + 'America/Inuvik', + 'America/Iqaluit', + 'America/Jamaica', + 'America/Juneau', + 'America/Kentucky/Louisville', + 'America/Kentucky/Monticello', + 'America/Kralendijk', + 'America/La_Paz', + 'America/Lima', + 'America/Los_Angeles', + 'America/Lower_Princes', + 'America/Maceio', + 'America/Managua', + 'America/Manaus', + 'America/Marigot', + 'America/Martinique', + 'America/Matamoros', + 'America/Mazatlan', + 'America/Menominee', + 'America/Merida', + 'America/Metlakatla', + 'America/Mexico_City', + 'America/Miquelon', + 'America/Moncton', + 'America/Monterrey', + 'America/Montevideo', + 'America/Montserrat', + 'America/Nassau', + 'America/New_York', + 'America/Nipigon', + 'America/Nome', + 'America/Noronha', + 'America/North_Dakota/Beulah', + 'America/North_Dakota/Center', + 'America/North_Dakota/New_Salem', + 'America/Nuuk', + 'America/Ojinaga', + 'America/Panama', + 'America/Pangnirtung', + 'America/Paramaribo', + 'America/Phoenix', + 'America/Port-au-Prince', + 'America/Port_of_Spain', + 'America/Porto_Velho', + 'America/Puerto_Rico', + 'America/Punta_Arenas', + 'America/Rainy_River', + 'America/Rankin_Inlet', + 'America/Recife', + 'America/Regina', + 'America/Resolute', + 'America/Rio_Branco', + 'America/Santarem', + 'America/Santiago', + 'America/Santo_Domingo', + 'America/Sao_Paulo', + 'America/Scoresbysund', + 'America/Sitka', + 'America/St_Barthelemy', + 'America/St_Johns', + 'America/St_Kitts', + 'America/St_Lucia', + 'America/St_Thomas', + 'America/St_Vincent', + 'America/Swift_Current', + 'America/Tegucigalpa', + 'America/Thule', + 'America/Thunder_Bay', + 'America/Tijuana', + 'America/Toronto', + 'America/Tortola', + 'America/Vancouver', + 'America/Whitehorse', + 'America/Winnipeg', + 'America/Yakutat', + 'America/Yellowknife', + 'Antarctica/Casey', + 'Antarctica/Davis', + 'Antarctica/DumontDUrville', + 'Antarctica/Macquarie', + 'Antarctica/Mawson', + 'Antarctica/McMurdo', + 'Antarctica/Palmer', + 'Antarctica/Rothera', + 'Antarctica/Syowa', + 'Antarctica/Troll', + 'Antarctica/Vostok', + 'Arctic/Longyearbyen', + 'Asia/Aden', + 'Asia/Almaty', + 'Asia/Amman', + 'Asia/Anadyr', + 'Asia/Aqtau', + 'Asia/Aqtobe', + 'Asia/Ashgabat', + 'Asia/Atyrau', + 'Asia/Baghdad', + 'Asia/Bahrain', + 'Asia/Baku', + 'Asia/Bangkok', + 'Asia/Barnaul', + 'Asia/Beirut', + 'Asia/Bishkek', + 'Asia/Brunei', + 'Asia/Chita', + 'Asia/Choibalsan', + 'Asia/Colombo', + 'Asia/Damascus', + 'Asia/Dhaka', + 'Asia/Dili', + 'Asia/Dubai', + 'Asia/Dushanbe', + 'Asia/Famagusta', + 'Asia/Gaza', + 'Asia/Hebron', + 'Asia/Ho_Chi_Minh', + 'Asia/Hong_Kong', + 'Asia/Hovd', + 'Asia/Irkutsk', + 'Asia/Jakarta', + 'Asia/Jayapura', + 'Asia/Jerusalem', + 'Asia/Kabul', + 'Asia/Kamchatka', + 'Asia/Karachi', + 'Asia/Kathmandu', + 'Asia/Khandyga', + 'Asia/Kolkata', + 'Asia/Krasnoyarsk', + 'Asia/Kuala_Lumpur', + 'Asia/Kuching', + 'Asia/Kuwait', + 'Asia/Macau', + 'Asia/Magadan', + 'Asia/Makassar', + 'Asia/Manila', + 'Asia/Muscat', + 'Asia/Nicosia', + 'Asia/Novokuznetsk', + 'Asia/Novosibirsk', + 'Asia/Omsk', + 'Asia/Oral', + 'Asia/Phnom_Penh', + 'Asia/Pontianak', + 'Asia/Pyongyang', + 'Asia/Qatar', + 'Asia/Qostanay', + 'Asia/Qyzylorda', + 'Asia/Riyadh', + 'Asia/Sakhalin', + 'Asia/Samarkand', + 'Asia/Seoul', + 'Asia/Shanghai', + 'Asia/Singapore', + 'Asia/Srednekolymsk', + 'Asia/Taipei', + 'Asia/Tashkent', + 'Asia/Tbilisi', + 'Asia/Tehran', + 'Asia/Thimphu', + 'Asia/Tokyo', + 'Asia/Tomsk', + 'Asia/Ulaanbaatar', + 'Asia/Urumqi', + 'Asia/Ust-Nera', + 'Asia/Vientiane', + 'Asia/Vladivostok', + 'Asia/Yakutsk', + 'Asia/Yangon', + 'Asia/Yekaterinburg', + 'Asia/Yerevan', + 'Atlantic/Azores', + 'Atlantic/Bermuda', + 'Atlantic/Canary', + 'Atlantic/Cape_Verde', + 'Atlantic/Faroe', + 'Atlantic/Madeira', + 'Atlantic/Reykjavik', + 'Atlantic/South_Georgia', + 'Atlantic/St_Helena', + 'Atlantic/Stanley', + 'Australia/Adelaide', + 'Australia/Brisbane', + 'Australia/Broken_Hill', + 'Australia/Darwin', + 'Australia/Eucla', + 'Australia/Hobart', + 'Australia/Lindeman', + 'Australia/Lord_Howe', + 'Australia/Melbourne', + 'Australia/Perth', + 'Australia/Sydney', + 'Canada/Atlantic', + 'Canada/Central', + 'Canada/Eastern', + 'Canada/Mountain', + 'Canada/Newfoundland', + 'Canada/Pacific', + 'Europe/Amsterdam', + 'Europe/Andorra', + 'Europe/Astrakhan', + 'Europe/Athens', + 'Europe/Belgrade', + 'Europe/Berlin', + 'Europe/Bratislava', + 'Europe/Brussels', + 'Europe/Bucharest', + 'Europe/Budapest', + 'Europe/Busingen', + 'Europe/Chisinau', + 'Europe/Copenhagen', + 'Europe/Dublin', + 'Europe/Gibraltar', + 'Europe/Guernsey', + 'Europe/Helsinki', + 'Europe/Isle_of_Man', + 'Europe/Istanbul', + 'Europe/Jersey', + 'Europe/Kaliningrad', + 'Europe/Kiev', + 'Europe/Kirov', + 'Europe/Lisbon', + 'Europe/Ljubljana', + 'Europe/London', + 'Europe/Luxembourg', + 'Europe/Madrid', + 'Europe/Malta', + 'Europe/Mariehamn', + 'Europe/Minsk', + 'Europe/Monaco', + 'Europe/Moscow', + 'Europe/Oslo', + 'Europe/Paris', + 'Europe/Podgorica', + 'Europe/Prague', + 'Europe/Riga', + 'Europe/Rome', + 'Europe/Samara', + 'Europe/San_Marino', + 'Europe/Sarajevo', + 'Europe/Saratov', + 'Europe/Simferopol', + 'Europe/Skopje', + 'Europe/Sofia', + 'Europe/Stockholm', + 'Europe/Tallinn', + 'Europe/Tirane', + 'Europe/Ulyanovsk', + 'Europe/Uzhgorod', + 'Europe/Vaduz', + 'Europe/Vatican', + 'Europe/Vienna', + 'Europe/Vilnius', + 'Europe/Volgograd', + 'Europe/Warsaw', + 'Europe/Zagreb', + 'Europe/Zaporozhye', + 'Europe/Zurich', + 'GMT', + 'Indian/Antananarivo', + 'Indian/Chagos', + 'Indian/Christmas', + 'Indian/Cocos', + 'Indian/Comoro', + 'Indian/Kerguelen', + 'Indian/Mahe', + 'Indian/Maldives', + 'Indian/Mauritius', + 'Indian/Mayotte', + 'Indian/Reunion', + 'Pacific/Apia', + 'Pacific/Auckland', + 'Pacific/Bougainville', + 'Pacific/Chatham', + 'Pacific/Chuuk', + 'Pacific/Easter', + 'Pacific/Efate', + 'Pacific/Enderbury', + 'Pacific/Fakaofo', + 'Pacific/Fiji', + 'Pacific/Funafuti', + 'Pacific/Galapagos', + 'Pacific/Gambier', + 'Pacific/Guadalcanal', + 'Pacific/Guam', + 'Pacific/Honolulu', + 'Pacific/Kiritimati', + 'Pacific/Kosrae', + 'Pacific/Kwajalein', + 'Pacific/Majuro', + 'Pacific/Marquesas', + 'Pacific/Midway', + 'Pacific/Nauru', + 'Pacific/Niue', + 'Pacific/Norfolk', + 'Pacific/Noumea', + 'Pacific/Pago_Pago', + 'Pacific/Palau', + 'Pacific/Pitcairn', + 'Pacific/Pohnpei', + 'Pacific/Port_Moresby', + 'Pacific/Rarotonga', + 'Pacific/Saipan', + 'Pacific/Tahiti', + 'Pacific/Tarawa', + 'Pacific/Tongatapu', + 'Pacific/Wake', + 'Pacific/Wallis', + 'US/Alaska', + 'US/Arizona', + 'US/Central', + 'US/Eastern', + 'US/Hawaii', + 'US/Mountain', + 'US/Pacific', + 'UTC', +] common_timezones = LazyList( - tz for tz in common_timezones if tz in all_timezones) - + tz for tz in common_timezones if tz in all_timezones +) + common_timezones_set = LazySet(common_timezones) diff --git a/addon/globalPlugins/clock/pytz/lazy.py b/addon/globalPlugins/clock/pytz/lazy.py index 39344fc..be3ca74 100644 --- a/addon/globalPlugins/clock/pytz/lazy.py +++ b/addon/globalPlugins/clock/pytz/lazy.py @@ -79,7 +79,8 @@ class LazyList(list): 'reverse', 'sort', '__add__', '__radd__', '__iadd__', '__mul__', '__rmul__', '__imul__', '__contains__', '__len__', '__nonzero__', '__getitem__', '__setitem__', '__delitem__', '__iter__', - '__reversed__', '__getslice__', '__setslice__', '__delslice__'] + '__reversed__', '__getslice__', '__setslice__', '__delslice__', + ] def __new__(cls, fill_iter=None): @@ -134,7 +135,8 @@ class LazySet(set): 'discard', 'intersection', 'intersection_update', 'isdisjoint', 'issubset', 'issuperset', 'pop', 'remove', 'symmetric_difference', 'symmetric_difference_update', - 'union', 'update') + 'union', 'update', + ) def __new__(cls, fill_iter=None): diff --git a/addon/globalPlugins/clock/pytz/reference.py b/addon/globalPlugins/clock/pytz/reference.py index f765ca0..78c8638 100644 --- a/addon/globalPlugins/clock/pytz/reference.py +++ b/addon/globalPlugins/clock/pytz/reference.py @@ -15,7 +15,7 @@ 'Central', 'Mountain', 'Pacific', - 'UTC' + 'UTC', ] @@ -69,9 +69,11 @@ def tzname(self, dt): return _time.tzname[self._isdst(dt)] def _isdst(self, dt): - tt = (dt.year, dt.month, dt.day, - dt.hour, dt.minute, dt.second, - dt.weekday(), 0, -1) + tt = ( + dt.year, dt.month, dt.day, + dt.hour, dt.minute, dt.second, + dt.weekday(), 0, -1, + ) stamp = _time.mktime(tt) tt = _time.localtime(stamp) return tt.tm_isdst > 0 diff --git a/addon/globalPlugins/clock/pytz/tzfile.py b/addon/globalPlugins/clock/pytz/tzfile.py index 99e7448..addf1aa 100644 --- a/addon/globalPlugins/clock/pytz/tzfile.py +++ b/addon/globalPlugins/clock/pytz/tzfile.py @@ -24,22 +24,27 @@ def _std_string(s): def build_tzinfo(zone, fp): head_fmt = '>4s c 15x 6l' head_size = calcsize(head_fmt) - (magic, format, ttisgmtcnt, ttisstdcnt, leapcnt, timecnt, - typecnt, charcnt) = unpack(head_fmt, fp.read(head_size)) + ( + magic, format, ttisgmtcnt, ttisstdcnt, leapcnt, timecnt, + typecnt, charcnt, + ) = unpack(head_fmt, fp.read(head_size)) # Make sure it is a tzfile(5) file assert magic == _byte_string('TZif'), 'Got magic %s' % repr(magic) # Read out the transition times, localtime indices and ttinfo structures. data_fmt = '>%(timecnt)dl %(timecnt)dB %(ttinfo)s %(charcnt)ds' % dict( - timecnt=timecnt, ttinfo='lBB' * typecnt, charcnt=charcnt) + timecnt=timecnt, ttinfo='lBB' * typecnt, charcnt=charcnt, + ) data_size = calcsize(data_fmt) data = unpack(data_fmt, fp.read(data_size)) # make sure we unpacked the right number of values assert len(data) == 2 * timecnt + 3 * typecnt + 1 - transitions = [memorized_datetime(trans) - for trans in data[:timecnt]] + transitions = [ + memorized_datetime(trans) + for trans in data[:timecnt] + ] lindexes = list(data[timecnt:2 * timecnt]) ttinfo_raw = data[2 * timecnt:-1] tznames_raw = data[-1] @@ -57,19 +62,25 @@ def build_tzinfo(zone, fp): if nul < 0: nul = len(tznames_raw) tznames[tzname_offset] = _std_string( - tznames_raw[tzname_offset:nul]) - ttinfo.append((ttinfo_raw[i], - bool(ttinfo_raw[i + 1]), - tznames[tzname_offset])) + tznames_raw[tzname_offset:nul], + ) + ttinfo.append(( + ttinfo_raw[i], + bool(ttinfo_raw[i + 1]), + tznames[tzname_offset], + )) i += 3 # Now build the timezone object if len(ttinfo) == 1 or len(transitions) == 0: ttinfo[0][0], ttinfo[0][2] - cls = type(zone, (StaticTzInfo,), dict( + cls = type( + zone, (StaticTzInfo,), dict( zone=zone, _utcoffset=memorized_timedelta(ttinfo[0][0]), - _tzname=ttinfo[0][2])) + _tzname=ttinfo[0][2], + ), + ) else: # Early dates use the first standard time ttinfo i = 0 @@ -115,10 +126,13 @@ def build_tzinfo(zone, fp): dst = int((dst + 30) // 60) * 60 transition_info.append(memorized_ttinfo(utcoffset, dst, tzname)) - cls = type(zone, (DstTzInfo,), dict( + cls = type( + zone, (DstTzInfo,), dict( zone=zone, _utc_transition_times=transitions, - _transition_info=transition_info)) + _transition_info=transition_info, + ), + ) return cls() @@ -126,8 +140,12 @@ def build_tzinfo(zone, fp): import os.path from pprint import pprint base = os.path.join(os.path.dirname(__file__), 'zoneinfo') - tz = build_tzinfo('Australia/Melbourne', - open(os.path.join(base, 'Australia', 'Melbourne'), 'rb')) - tz = build_tzinfo('US/Eastern', - open(os.path.join(base, 'US', 'Eastern'), 'rb')) + tz = build_tzinfo( + 'Australia/Melbourne', + open(os.path.join(base, 'Australia', 'Melbourne'), 'rb'), + ) + tz = build_tzinfo( + 'US/Eastern', + open(os.path.join(base, 'US', 'Eastern'), 'rb'), + ) pprint(tz._utc_transition_times) diff --git a/addon/globalPlugins/clock/pytz/tzinfo.py b/addon/globalPlugins/clock/pytz/tzinfo.py index 725978d..e8a953e 100644 --- a/addon/globalPlugins/clock/pytz/tzinfo.py +++ b/addon/globalPlugins/clock/pytz/tzinfo.py @@ -50,7 +50,7 @@ def memorized_ttinfo(*args): ttinfo = ( memorized_timedelta(args[0]), memorized_timedelta(args[1]), - args[2] + args[2], ) _ttinfo_cache[args] = ttinfo return ttinfo @@ -184,7 +184,8 @@ def __init__(self, _inf=None, _tzinfos=None): _tzinfos = {} self._tzinfos = _tzinfos self._utcoffset, self._dst, self._tzname = ( - self._transition_info[0]) + self._transition_info[0] + ) _tzinfos[self._transition_info[0]] = self for inf in self._transition_info[1:]: if inf not in _tzinfos: @@ -192,8 +193,10 @@ def __init__(self, _inf=None, _tzinfos=None): def fromutc(self, dt): '''See datetime.tzinfo.fromutc''' - if (dt.tzinfo is not None and - getattr(dt.tzinfo, '_tzinfos', None) is not self._tzinfos): + if ( + dt.tzinfo is not None and + getattr(dt.tzinfo, '_tzinfos', None) is not self._tzinfos + ): raise ValueError('fromutc: dt.tzinfo is not self') dt = dt.replace(tzinfo=None) idx = max(0, bisect_right(self._utc_transition_times, dt) - 1) @@ -321,8 +324,11 @@ def localize(self, dt, is_dst=False): possible_loc_dt = set() for delta in [timedelta(days=-1), timedelta(days=1)]: loc_dt = dt + delta - idx = max(0, bisect_right( - self._utc_transition_times, loc_dt) - 1) + idx = max( + 0, bisect_right( + self._utc_transition_times, loc_dt, + ) - 1, + ) inf = self._transition_info[idx] tzinfo = self._tzinfos[inf] loc_dt = tzinfo.normalize(dt.replace(tzinfo=tzinfo)) @@ -345,14 +351,16 @@ def localize(self, dt, is_dst=False): # hours. elif is_dst: return self.localize( - dt + timedelta(hours=6), is_dst=True) - timedelta(hours=6) + dt + timedelta(hours=6), is_dst=True, + ) - timedelta(hours=6) # If we are forcing the post-DST side of the DST transition, we # obtain the correct timezone by winding the clock back. else: return self.localize( dt - timedelta(hours=6), - is_dst=False) + timedelta(hours=6) + is_dst=False, + ) + timedelta(hours=6) # If we get this far, we have multiple possible timezones - this # is an ambiguous case occuring during the end-of-DST transition. @@ -388,7 +396,8 @@ def localize(self, dt, is_dst=False): dates = {} # utc -> local for local_dt in filtered_possible_loc_dt: utc_time = ( - local_dt.replace(tzinfo=None) - local_dt.tzinfo._utcoffset) + local_dt.replace(tzinfo=None) - local_dt.tzinfo._utcoffset + ) assert utc_time not in dates dates[utc_time] = local_dt return dates[[min, max][not is_dst](dates)] @@ -508,11 +517,11 @@ def __repr__(self): dst = 'STD' if self._utcoffset > _notime: return '' % ( - self.zone, self._tzname, self._utcoffset, dst + self.zone, self._tzname, self._utcoffset, dst, ) else: return '' % ( - self.zone, self._tzname, self._utcoffset, dst + self.zone, self._tzname, self._utcoffset, dst, ) def __reduce__(self): @@ -522,7 +531,7 @@ def __reduce__(self): self.zone, _to_seconds(self._utcoffset), _to_seconds(self._dst), - self._tzname + self._tzname, ) @@ -562,8 +571,10 @@ def unpickler(zone, utcoffset=None, dstoffset=None, tzname=None): # get changed from the initial guess by the database maintainers to # match reality when this information is discovered. for localized_tz in tz._tzinfos.values(): - if (localized_tz._utcoffset == utcoffset and - localized_tz._dst == dstoffset): + if ( + localized_tz._utcoffset == utcoffset and + localized_tz._dst == dstoffset + ): return localized_tz # This (utcoffset, dstoffset) information has been removed from the diff --git a/addon/globalPlugins/clock/skipTranslation.py b/addon/globalPlugins/clock/skipTranslation.py index 7a91d7a..17624c7 100644 --- a/addon/globalPlugins/clock/skipTranslation.py +++ b/addon/globalPlugins/clock/skipTranslation.py @@ -7,5 +7,6 @@ # Based on implementation made by Alberto Buffolino # https://github.com/nvaccess/nvda/issues/4652 + def translate(text): return _(text) diff --git a/addon/installTasks.py b/addon/installTasks.py index 686d201..a2d565e 100644 --- a/addon/installTasks.py +++ b/addon/installTasks.py @@ -6,41 +6,46 @@ import config from configobj.validate import VdtTypeError import addonHandler + addonHandler.initTranslation() def onInstall(): import gui import wx + addon = next((addon for addon in addonHandler.getRunningAddons() if addon.name == "clock"), None) curProfile = config.conf.profiles[0] if addon and addon.version < "31.08.1": # We're migrating from a version that doesn't support 5-minute intervals; therefore, we must update the configuration key value. if config.conf["clockAndCalendar"]["autoAnnounce"] > 0: - config.conf["clockAndCalendar"]["autoAnnounce"]+= 1 + config.conf["clockAndCalendar"]["autoAnnounce"] += 1 # For those who have not checked the "Save configuration on exit" checkbox. if not config.conf["general"]["saveConfigurationOnExit"]: config.conf.save() - if ( - 'clockAndCalendar' in curProfile and ( - 'timeDisplayFormat' in list(curProfile['clockAndCalendar'].keys()) - and not isinstance(config.conf['clockAndCalendar']['timeDisplayFormat'], int)) + if "clockAndCalendar" in curProfile and ( + "timeDisplayFormat" in list(curProfile["clockAndCalendar"].keys()) + and not isinstance(config.conf["clockAndCalendar"]["timeDisplayFormat"], int) ): - if gui.messageBox( - _( - # Translators: the label of a message box dialog. - "The date and time format you were using are not compatible with this version of the Clock add-on, " - "this will be fixed during installation. Click OK to confirm these corrections" - ), - # Translators: the title of a message box dialog. - _("Time and date format corrections"), wx.OK | wx.ICON_INFORMATION - ) == wx.OK: + if ( + gui.messageBox( + _( + # Translators: the label of a message box dialog. + "The date and time format you were using are not compatible with this version of the Clock add-on, " + "this will be fixed during installation. Click OK to confirm these corrections", + ), + # Translators: the title of a message box dialog. + _("Time and date format corrections"), + wx.OK | wx.ICON_INFORMATION, + ) + == wx.OK + ): try: - config.conf['clockAndCalendar']['timeDisplayFormat'] = 0 - config.conf['clockAndCalendar']['dateDisplayFormat'] = 1 + config.conf["clockAndCalendar"]["timeDisplayFormat"] = 0 + config.conf["clockAndCalendar"]["dateDisplayFormat"] = 1 except VdtTypeError: - config.conf['clockAndCalendar']['timeDisplayFormat'] = "0" - config.conf['clockAndCalendar']['dateDisplayFormat'] = "1" + config.conf["clockAndCalendar"]["timeDisplayFormat"] = "0" + config.conf["clockAndCalendar"]["dateDisplayFormat"] = "1" finally: # For those who have not checked the "Save configuration on exit" checkbox. if not config.conf["general"]["saveConfigurationOnExit"]: diff --git a/pyproject.toml b/pyproject.toml index 8a1bbce..dcfc8a7 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -36,7 +36,9 @@ dependencies = [ "uv==0.11.15", "ruff==0.14.5", "pre-commit==4.2.0", - "pyright[nodejs]==1.1.407", + "pyright[nodejs]==1.1.411", + "wxpython>=4.2.5", + "configobj>=5.0.9", ] [project.urls] Repository = "https://github.com/hkatic/clock" @@ -65,6 +67,10 @@ exclude = [ "__pycache__", ".venv", "buildVars.py", + "addon/globalPlugins/clock/alarms", + "addon/globalPlugins/clock/convertdate", + "addon/globalPlugins/clock/pymeeus", + "addon/globalPlugins/clock/pytz", ] [tool.ruff.format] @@ -78,7 +84,7 @@ max-complexity = 15 ignore = [ # indentation contains tabs "W191", -] + ] logger-objects = ["logHandler.log"] [tool.ruff.lint.per-file-ignores] @@ -103,6 +109,10 @@ exclude = [ ".venv", "site_scons", ".github/scripts", + "addon/globalPlugins/clock/alarms", + "addon/globalPlugins/clock/convertdate", + "addon/globalPlugins/clock/pymeeus", + "addon/globalPlugins/clock/pytz", # When excluding concrete paths relative to a directory, # not matching multiple folders by name e.g. `__pycache__`, # paths are relative to the configuration file. @@ -125,89 +135,102 @@ strictDictionaryInference = true strictSetInference = true # Compliant rules -reportAbstractUsage = true -reportArgumentType = true reportAssertAlwaysTrue = true reportAssertTypeFailure = true -reportAssignmentType = true -reportAttributeAccessIssue = true -reportCallInDefaultInitializer = true -reportCallIssue = true -reportConstantRedefinition = true reportDuplicateImport = true -reportFunctionMemberAccess = true -reportGeneralTypeIssues = true -reportImplicitOverride = true -reportImplicitStringConcatenation = true -reportImportCycles = true -reportIncompatibleMethodOverride = true -reportIncompatibleVariableOverride = true reportIncompleteStub = true -reportInconsistentConstructor = true reportInconsistentOverload = true -reportIndexIssue = true +reportInconsistentConstructor = true reportInvalidStringEscapeSequence = true reportInvalidStubStatement = true -reportInvalidTypeArguments = true -reportInvalidTypeForm = true reportInvalidTypeVarUse = true reportMatchNotExhaustive = true -reportMissingImports = true reportMissingModuleSource = true -reportMissingParameterType = true -reportMissingSuperCall = true -reportMissingTypeArgument = true +reportMissingImports = true reportNoOverloadImplementation = true -reportOperatorIssue = true -reportOptionalCall = true reportOptionalContextManager = true -reportOptionalIterable = true -reportOptionalMemberAccess = true -reportOptionalOperand = true -reportOptionalSubscript = true reportOverlappingOverload = true -reportPossiblyUnboundVariable = true reportPrivateImportUsage = true -reportPrivateUsage = true reportPropertyTypeMismatch = true -reportRedeclaration = true -reportReturnType = true reportSelfClsParameterName = true reportTypeCommentUsage = true reportTypedDictNotRequiredAccess = true -reportUnboundVariable = true reportUndefinedVariable = true +reportUnusedExpression = true +reportUnboundVariable = true reportUnhashable = true -reportUninitializedInstanceVariable = true -reportUnknownArgumentType = true -reportUnknownLambdaType = true -reportUnknownMemberType = true -reportUnknownParameterType = true -reportUnknownVariableType = true reportUnnecessaryCast = true -reportUnnecessaryComparison = true reportUnnecessaryContains = true -reportUnnecessaryIsInstance = true reportUnnecessaryTypeIgnoreComment = true -reportUnsupportedDunderAll = true -reportUntypedBaseClass = true reportUntypedClassDecorator = true reportUntypedFunctionDecorator = true -reportUntypedNamedTuple = true -reportUnusedCallResult = true reportUnusedClass = true reportUnusedCoroutine = true reportUnusedExcept = true -reportUnusedExpression = true -reportUnusedFunction = true -reportUnusedImport = true -reportUnusedVariable = true -reportWildcardImportFromLibrary = true -reportDeprecated = true +# Should switch to true when possible +reportDeprecated = false # Can be enabled by generating type stubs for modules via pyright CLI reportMissingTypeStubs = false # Bad rules -# These are sorted alphabetically and should be enabled and moved to compliant rules section when resolved. +# These are roughly sorted by compliance to make it easier for devs to focus on enabling them. +# Errors were last checked Feb 2025. +# 1-50 errors +reportUnsupportedDunderAll = false +reportAbstractUsage = false +reportUntypedBaseClass = false +reportOptionalIterable = false +reportCallInDefaultInitializer = false +reportInvalidTypeArguments = false +reportUntypedNamedTuple = false +reportRedeclaration = false +reportOptionalCall = false +reportConstantRedefinition = false +reportWildcardImportFromLibrary = false +reportIncompatibleVariableOverride = false +reportInvalidTypeForm = false + +# 50-100 errors +reportGeneralTypeIssues = false +reportOptionalOperand = false +reportUnnecessaryComparison = false +reportFunctionMemberAccess = false +reportUnnecessaryIsInstance = false +reportUnusedFunction = false +reportImportCycles = false +reportUnusedImport = false +reportUnusedVariable = false + +# 100-1000 errors +reportOperatorIssue = false +reportAssignmentType = false +reportReturnType = false +reportPossiblyUnboundVariable = false +reportMissingSuperCall = false +reportUninitializedInstanceVariable = false +reportUnknownLambdaType = false +reportMissingTypeArgument = false +reportImplicitStringConcatenation = false +reportIncompatibleMethodOverride = false +reportPrivateUsage = false + +# 1000+ errors +reportUnusedCallResult = false +reportOptionalSubscript = false +reportCallIssue = false +reportOptionalMemberAccess = false +reportImplicitOverride = false +reportIndexIssue = false +reportAttributeAccessIssue = false +reportArgumentType = false +reportUnknownParameterType = false +reportMissingParameterType = false +reportUnknownVariableType = false +reportUnknownArgumentType = false +reportUnknownMemberType = false + +[tool.mypy] +warn_unused_configs = true +ignore_missing_imports = true diff --git a/uv.lock b/uv.lock index 02f4662..c576294 100644 --- a/uv.lock +++ b/uv.lock @@ -2,40 +2,6 @@ version = 1 revision = 3 requires-python = "==3.13.*" -[[package]] -name = "addontemplate" -source = { editable = "." } -dependencies = [ - { name = "crowdin-api-client" }, - { name = "lxml" }, - { name = "markdown" }, - { name = "markdown-link-attr-modifier" }, - { name = "mdx-gh-links" }, - { name = "mdx-truly-sane-lists" }, - { name = "nh3" }, - { name = "pre-commit" }, - { name = "pyright", extra = ["nodejs"] }, - { name = "ruff" }, - { name = "scons" }, - { name = "uv" }, -] - -[package.metadata] -requires-dist = [ - { name = "crowdin-api-client", specifier = "==1.24.1" }, - { name = "lxml", specifier = "==6.1.0" }, - { name = "markdown", specifier = "==3.10" }, - { name = "markdown-link-attr-modifier", specifier = "==0.2.1" }, - { name = "mdx-gh-links", specifier = "==0.4" }, - { name = "mdx-truly-sane-lists", specifier = "==1.3" }, - { name = "nh3", specifier = "==0.3.2" }, - { name = "pre-commit", specifier = "==4.2.0" }, - { name = "pyright", extras = ["nodejs"], specifier = "==1.1.407" }, - { name = "ruff", specifier = "==0.14.5" }, - { name = "scons", specifier = "==4.10.1" }, - { name = "uv", specifier = "==0.11.15" }, -] - [[package]] name = "certifi" version = "2026.5.20" @@ -79,6 +45,53 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/db/8f/61959034484a4a7c527811f4721e75d02d653a35afb0b6054474d8185d4c/charset_normalizer-3.4.7-py3-none-any.whl", hash = "sha256:3dce51d0f5e7951f8bb4900c257dad282f49190fdbebecd4ba99bcc41fef404d", size = 61958, upload-time = "2026-04-02T09:28:37.794Z" }, ] +[[package]] +name = "clock" +source = { editable = "." } +dependencies = [ + { name = "configobj" }, + { name = "crowdin-api-client" }, + { name = "lxml" }, + { name = "markdown" }, + { name = "markdown-link-attr-modifier" }, + { name = "mdx-gh-links" }, + { name = "mdx-truly-sane-lists" }, + { name = "nh3" }, + { name = "pre-commit" }, + { name = "pyright", extra = ["nodejs"] }, + { name = "ruff" }, + { name = "scons" }, + { name = "uv" }, + { name = "wxpython" }, +] + +[package.metadata] +requires-dist = [ + { name = "configobj", specifier = ">=5.0.9" }, + { name = "crowdin-api-client", specifier = "==1.24.1" }, + { name = "lxml", specifier = "==6.1.0" }, + { name = "markdown", specifier = "==3.10" }, + { name = "markdown-link-attr-modifier", specifier = "==0.2.1" }, + { name = "mdx-gh-links", specifier = "==0.4" }, + { name = "mdx-truly-sane-lists", specifier = "==1.3" }, + { name = "nh3", specifier = "==0.3.2" }, + { name = "pre-commit", specifier = "==4.2.0" }, + { name = "pyright", extras = ["nodejs"], specifier = "==1.1.411" }, + { name = "ruff", specifier = "==0.14.5" }, + { name = "scons", specifier = "==4.10.1" }, + { name = "uv", specifier = "==0.11.15" }, + { name = "wxpython", specifier = ">=4.2.5" }, +] + +[[package]] +name = "configobj" +version = "5.0.9" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/f5/c4/c7f9e41bc2e5f8eeae4a08a01c91b2aea3dfab40a3e14b25e87e7db8d501/configobj-5.0.9.tar.gz", hash = "sha256:03c881bbf23aa07bccf1b837005975993c4ab4427ba57f959afdd9d1a2386848", size = 101518, upload-time = "2024-09-21T12:47:46.315Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/a6/c4/0679472c60052c27efa612b4cd3ddd2a23e885dcdc73461781d2c802d39e/configobj-5.0.9-py2.py3-none-any.whl", hash = "sha256:1ba10c5b6ee16229c79a05047aeda2b55eb4e80d7c7d8ecf17ec1ca600c79882", size = 35615, upload-time = "2024-11-26T14:03:32.972Z" }, +] + [[package]] name = "crowdin-api-client" version = "1.24.1" @@ -286,15 +299,15 @@ wheels = [ [[package]] name = "pyright" -version = "1.1.407" +version = "1.1.411" source = { registry = "https://pypi.org/simple" } dependencies = [ { name = "nodeenv" }, { name = "typing-extensions" }, ] -sdist = { url = "https://files.pythonhosted.org/packages/a6/1b/0aa08ee42948b61745ac5b5b5ccaec4669e8884b53d31c8ec20b2fcd6b6f/pyright-1.1.407.tar.gz", hash = "sha256:099674dba5c10489832d4a4b2d302636152a9a42d317986c38474c76fe562262", size = 4122872, upload-time = "2025-10-24T23:17:15.145Z" } +sdist = { url = "https://files.pythonhosted.org/packages/7e/ab/265f7dc69d28113ebba19092e57b075f41543b2ed048429c5f56e2b88eac/pyright-1.1.411.tar.gz", hash = "sha256:d885a0551f2e763b089a02702174e7f4ba77548cddabc972ab86d1f7f1b0f998", size = 4112861, upload-time = "2026-06-25T02:14:06.37Z" } wheels = [ - { url = "https://files.pythonhosted.org/packages/dc/93/b69052907d032b00c40cb656d21438ec00b3a471733de137a3f65a49a0a0/pyright-1.1.407-py3-none-any.whl", hash = "sha256:6dd419f54fcc13f03b52285796d65e639786373f433e243f8b94cf93a7444d21", size = 5997008, upload-time = "2025-10-24T23:17:13.159Z" }, + { url = "https://files.pythonhosted.org/packages/0a/49/385be530a6a5b78d1cbcd5c2e38debc8959a2fc6bdb716f4e581002979fc/pyright-1.1.411-py3-none-any.whl", hash = "sha256:dc7c72a8e2700c55baa127554040e067041ea53ccfd50bf96308cc4291c7d5d9", size = 6181526, upload-time = "2026-06-25T02:14:04.691Z" }, ] [package.optional-dependencies] @@ -472,3 +485,16 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/ee/f3/96c39153a8737a6e9aa85adef254ac4195bea3f2d24efc60472ccc3c9e2e/wrapt-2.2.1-cp313-cp313t-win_arm64.whl", hash = "sha256:c318a64b53d97b841d7b5e637517e50a27be64bc695128422953d4b21710954e", size = 80295, upload-time = "2026-05-22T14:48:50.479Z" }, { url = "https://files.pythonhosted.org/packages/53/46/29ac9daf11a86c22a8c38cd9236c62928ccae83f7ceb06bd3b0467cf9d05/wrapt-2.2.1-py3-none-any.whl", hash = "sha256:3aafea2975caef8ca49400640dde02cc7426e798f24870ed01f490bc3cffd32f", size = 61000, upload-time = "2026-05-22T14:49:41.593Z" }, ] + +[[package]] +name = "wxpython" +version = "4.2.5" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/22/43/81657a6b126ffc19163500a8184d683cec08eb4e1d06905cd0c371c702d0/wxpython-4.2.5.tar.gz", hash = "sha256:44e836d1bccd99c38790bb034b6ecf70d9060f6734320560f7c4b0d006144793", size = 58732217, upload-time = "2026-02-08T20:40:42.086Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/e4/b9/1fee711ad5c26e7bbd4e10fae14b2ce0499684a084c3c60169373496ceae/wxpython-4.2.5-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:5f7ec6b028e8b1c4cad1ecb5c8402c2cae7840a25758be0fc209e56df86d1cac", size = 17775906, upload-time = "2026-02-08T20:40:12.031Z" }, + { url = "https://files.pythonhosted.org/packages/3d/53/521a79cbb169ab6b123e79ea23ebafe3046c1999a431b6fc864f1217bb86/wxpython-4.2.5-cp313-cp313-macosx_14_0_x86_64.whl", hash = "sha256:77ac5335d8e4aae92732fc039df24a58181cdfb5bc7931692f1f9415e9eeee7d", size = 18857767, upload-time = "2026-02-08T20:40:14.486Z" }, + { url = "https://files.pythonhosted.org/packages/c4/ea/a69ad0a1e7b01876619982b6cf8db0e26d0f3776b9be73b61d9f0662a2ce/wxpython-4.2.5-cp313-cp313-win32.whl", hash = "sha256:0985f190565b94635f146989886196a7e9faced8911800910460919cb72668cc", size = 14520419, upload-time = "2026-02-08T20:40:17.401Z" }, + { url = "https://files.pythonhosted.org/packages/a8/bd/d2698369dbc43aa5c9324c23fdd5cd3b23c245861e334b1d976209913f90/wxpython-4.2.5-cp313-cp313-win_amd64.whl", hash = "sha256:3fd3649fc4752f1a02776b7057073c932e5229bbab2031762b01532bcc6bd074", size = 16576741, upload-time = "2026-02-08T20:40:20.646Z" }, + { url = "https://files.pythonhosted.org/packages/cb/4e/4181734a2bc05940ba4feb3feb2474416b1dc12c329a2ac164632582c4d6/wxpython-4.2.5-cp313-cp313-win_arm64.whl", hash = "sha256:b794d9912464990ea1fd3744fb73fbd7446149e230e5a611ba40eb4ac74755a1", size = 15537287, upload-time = "2026-02-08T20:40:24.658Z" }, +]