Skip to content

Commit

Permalink
Use plain copy of packaging instead of submodule
Browse files Browse the repository at this point in the history
  • Loading branch information
zjosua committed Mar 18, 2021
1 parent 2c2ac73 commit 185f134
Show file tree
Hide file tree
Showing 16 changed files with 2,817 additions and 8 deletions.
3 changes: 0 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +0,0 @@
[submodule "src/multiple_choice/packaging"]
path = src/multiple_choice/packaging
url = https://github.com/pypa/packaging
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,3 +58,5 @@ Volker Umpfenbach contributed a change that allows to customize how the question
He also provided the code to calculate and display the percentage of correctly answered items per question.

Shoutout to [3ter](https://github.com/3ter) for his contributions that improve card initialization and checkbox handling.

This add-on uses the [packaging](https://packaging.pypa.io/en/latest/) library.
2 changes: 2 additions & 0 deletions docs/ankiweb.html
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@

Shoutout to <a href="https://github.com/3ter">3ter</a> for his contributions that improve card initialization and checkbox handling.

This add-on uses the <a href="https://packaging.pypa.io/en/latest/">packaging</a> library.

<b>SUPPORT</b>

Please use the <a href="https://github.com/zjosua/anki-mc/issues">issue tracker</a> on GitHub if you run into any issues.
2 changes: 1 addition & 1 deletion src/multiple_choice/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
from aqt import gui_hooks, mw

from .config import *
from .packaging.packaging import version
from .packaging import version
from .template import *

def getOrCreateModel():
Expand Down
6 changes: 3 additions & 3 deletions src/multiple_choice/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,12 @@
from aqt import mw

# Compare semantic version: https://stackoverflow.com/a/11887885
from .packaging.packaging import version
from .packaging import version

# default configurations
# TODO: update version number before release
default_conf_local = {'version': "2.4.0"}
default_conf_syncd = {'version': "2.4.0"}
default_conf_local = {'version': "2.4.1"}
default_conf_syncd = {'version': "2.4.1"}

def getSyncedConfig():
# Synced preferences
Expand Down
1 change: 0 additions & 1 deletion src/multiple_choice/packaging
Submodule packaging deleted from 456f94
26 changes: 26 additions & 0 deletions src/multiple_choice/packaging/__about__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# This file is dual licensed under the terms of the Apache License, Version
# 2.0, and the BSD License. See the LICENSE file in the root of this repository
# for complete details.

__all__ = [
"__title__",
"__summary__",
"__uri__",
"__version__",
"__author__",
"__email__",
"__license__",
"__copyright__",
]

__title__ = "packaging"
__summary__ = "Core utilities for Python packages"
__uri__ = "https://github.com/pypa/packaging"

__version__ = "20.10.dev0"

__author__ = "Donald Stufft and individual contributors"
__email__ = "[email protected]"

__license__ = "BSD-2-Clause or Apache-2.0"
__copyright__ = "2014-2019 %s" % __author__
25 changes: 25 additions & 0 deletions src/multiple_choice/packaging/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# This file is dual licensed under the terms of the Apache License, Version
# 2.0, and the BSD License. See the LICENSE file in the root of this repository
# for complete details.

from .__about__ import (
__author__,
__copyright__,
__email__,
__license__,
__summary__,
__title__,
__uri__,
__version__,
)

__all__ = [
"__title__",
"__summary__",
"__uri__",
"__version__",
"__author__",
"__email__",
"__license__",
"__copyright__",
]
67 changes: 67 additions & 0 deletions src/multiple_choice/packaging/_structures.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
# This file is dual licensed under the terms of the Apache License, Version
# 2.0, and the BSD License. See the LICENSE file in the root of this repository
# for complete details.


class InfinityType:
def __repr__(self) -> str:
return "Infinity"

def __hash__(self) -> int:
return hash(repr(self))

def __lt__(self, other: object) -> bool:
return False

def __le__(self, other: object) -> bool:
return False

def __eq__(self, other: object) -> bool:
return isinstance(other, self.__class__)

def __ne__(self, other: object) -> bool:
return not isinstance(other, self.__class__)

def __gt__(self, other: object) -> bool:
return True

def __ge__(self, other: object) -> bool:
return True

def __neg__(self: object) -> "NegativeInfinityType":
return NegativeInfinity


Infinity = InfinityType()


class NegativeInfinityType:
def __repr__(self) -> str:
return "-Infinity"

def __hash__(self) -> int:
return hash(repr(self))

def __lt__(self, other: object) -> bool:
return True

def __le__(self, other: object) -> bool:
return True

def __eq__(self, other: object) -> bool:
return isinstance(other, self.__class__)

def __ne__(self, other: object) -> bool:
return not isinstance(other, self.__class__)

def __gt__(self, other: object) -> bool:
return False

def __ge__(self, other: object) -> bool:
return False

def __neg__(self: object) -> InfinityType:
return Infinity


NegativeInfinity = NegativeInfinityType()
Loading

0 comments on commit 185f134

Please sign in to comment.