nebius/SWE-bench-extra huggingface dataset:
Repository: netromdk/vermin

Issue:
False positive when using backported zoneinfo
**Describe the bug**

I'm trying to use `vermin` on a project that uses `zoneinfo`. The project is properly set up to install the backport on Python < 3.9.

However, vermin reports this as a violation, and won't take `--backport zoneinfo`.

**To Reproduce**

```sh
git clone https://github.com/WhyNotHugo/django-afip.git
cd django-afip
vermin --no-tips --target=3.7 --violations .
vermin --no-tips --target=3.7 --violations --backport zoneinfo .
```

**Expected behavior**

The latter should work.

**Environment (please complete the following information):**

```con
> vermin --version
1.5.1
 
> git --version   
git version 2.40.1
````

**Additional context**

-


Comments:

Patch:
diff --git a/vermin/backports.py b/vermin/backports.py
index f10c6f8..2d32b07 100644
--- a/vermin/backports.py
+++ b/vermin/backports.py
@@ -27,6 +27,8 @@ BACKPORTS = (
   ("typing_extensions==4.0", ["https://pypi.org/project/typing-extensions/4.0.0/"], (None, (3, 6))),
   ("typing_extensions==4.3", ["https://pypi.org/project/typing-extensions/4.3.0/"], (None, (3, 7))),
   ("typing_extensions", ["https://pypi.org/project/typing-extensions/4.3.0/"], (None, (3, 7))),
+
+  ("zoneinfo", ["https://pypi.org/project/backports.zoneinfo/"], (None, (3, 6))),
 )
 
 class Backports:
diff --git a/vermin/rules.py b/vermin/rules.py
index f80f006..0d76ee5 100644
--- a/vermin/rules.py
+++ b/vermin/rules.py
@@ -192,7 +192,7 @@ def MOD_REQS(config):
     "xmlrpclib": ((2, 2), None),
     "zipapp": (None, (3, 5)),
     "zipimport": ((2, 3), (3, 0)),
-    "zoneinfo": (None, (3, 9)),
+    "zoneinfo": bpv("zoneinfo", (None, (3, 9)), config),
    }
 
 # Module member requirements: member -> (module, requirements)


Test patch:
diff --git a/tests/backports.py b/tests/backports.py
index c8061e1..e09c89a 100644
--- a/tests/backports.py
+++ b/tests/backports.py
@@ -20,6 +20,7 @@ class VerminBackportsTests(VerminTest):
       "typing_extensions==4.0",
       "typing_extensions==4.3",
       "typing_extensions",
+      "zoneinfo",
     ), Backports.modules())
 
   def test_is_backport(self):
@@ -41,7 +42,8 @@ class VerminBackportsTests(VerminTest):
    typing                 - https://pypi.org/project/typing/ (2.7, 3.2)
    typing_extensions==4.0 - https://pypi.org/project/typing-extensions/4.0.0/ (!2, 3.6)
    typing_extensions==4.3 - https://pypi.org/project/typing-extensions/4.3.0/ (!2, 3.7)
-   typing_extensions      - https://pypi.org/project/typing-extensions/4.3.0/ (!2, 3.7)""",
+   typing_extensions      - https://pypi.org/project/typing-extensions/4.3.0/ (!2, 3.7)
+   zoneinfo               - https://pypi.org/project/backports.zoneinfo/ (!2, 3.6)""",
                      Backports.str(3))
 
   def test_version_filter(self):
@@ -66,6 +68,7 @@ class VerminBackportsTests(VerminTest):
       "statistics",
       "typing",
       "typing_extensions",
+      "zoneinfo",
     ], Backports.unversioned_filter(Backports.modules()))
 
   def test_expand_versions(self):
Repository: netromdk/vermin

Issue:
pathlib module missing in checks
**Describe the bug**
The pathlib module is available since python 3.4 and is not in the checks

**To Reproduce**
Code using the pathlib module not having a minimum version of 3.4

**Expected behavior**
The minimum version should then be python 3.4 and no python 2 support

**Environment (please complete the following information):**
Vermin 0.4.4


Comments:

Patch:
diff --git a/.travis.yml b/.travis.yml
index ef67b64..2726025 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -16,8 +16,8 @@ python:
 install:
 - pip install -U pip virtualenv
 script:
-- if [[ $TRAVIS_PYTHON_VERSION != 3.2 ]]; then make setup-venv setup-coverage test-coverage; else make test; fi
-- if [[ $TRAVIS_PYTHON_VERSION > 3.2 ]]; then make setup-misc; source .venv/bin/activate; make check; fi
-- if [[ $TRAVIS_PYTHON_VERSION > 3.2 && $TRAVIS_PYTHON_VERSION < 3.7 ]]; then make setup-bandit; source .venv/bin/activate; make security-check; fi
+- if [[ $TRAVIS_PYTHON_VERSION != 3.2 && $TRAVIS_PYTHON_VERSION != 3.3 ]]; then make setup-venv setup-coverage test-coverage; else make test; fi
+- if [[ $TRAVIS_PYTHON_VERSION > 3.3 ]]; then make setup-misc; source .venv/bin/activate; make check; fi
+- if [[ $TRAVIS_PYTHON_VERSION > 3.3 && $TRAVIS_PYTHON_VERSION < 3.7 ]]; then make setup-bandit; source .venv/bin/activate; make security-check; fi
 after_success:
-- if [[ $TRAVIS_PYTHON_VERSION != 3.2 ]]; then make coveralls; fi
+- if [[ $TRAVIS_PYTHON_VERSION != 3.2 && $TRAVIS_PYTHON_VERSION != 3.3 ]]; then make coveralls; fi
diff --git a/vermin/rules.py b/vermin/rules.py
index 947d5b9..d54363e 100644
--- a/vermin/rules.py
+++ b/vermin/rules.py
@@ -75,6 +75,7 @@ MOD_REQS = {
   "numbers": (2.6, 3.0),
   "optparse": (2.3, 3.0),
   "ossaudiodev": (2.3, 3.0),
+  "pathlib": (None, 3.4),
   "pickletools": (2.3, 3.0),
   "pkgutil": (2.3, 3.0),
   "platform": (2.3, 3.0),


Test patch:
diff --git a/tests/module.py b/tests/module.py
index b8316fa..9900459 100644
--- a/tests/module.py
+++ b/tests/module.py
@@ -349,3 +349,6 @@ class VerminModuleTests(VerminTest):
 
   def test_venv(self):
     self.assertOnlyIn(3.3, detect("import venv"))
+
+  def test_pathlib(self):
+    self.assertOnlyIn(3.4, detect("import pathlib"))
Repository: netsiphd/netrd

Issue:
Clarify usage of utilities.entropy.entropy?
When I was refactoring the Dmeasure code, I looked at using our version of entropy instead of scipy's, but one is not a drop-in replacement for the other because they take different inputs - one takes a histogram and the other takes a sequence of values. It would touch a lot of files but but renaming our `entropy` to something like `entropy_from_sequence` would remove this ambiguity.

Comments:

Patch:
diff --git a/netrd/utilities/entropy.py b/netrd/utilities/entropy.py
index dff68e2..9d6f3d7 100644
--- a/netrd/utilities/entropy.py
+++ b/netrd/utilities/entropy.py
@@ -15,7 +15,7 @@ from scipy.stats import entropy as sp_entropy
 
 
 def js_divergence(P, Q):
-    """Jenson-Shannon divergence between `P` and `Q`.
+    """Jensen-Shannon divergence between `P` and `Q`.
 
     Parameters
     ----------
@@ -35,8 +35,10 @@ def js_divergence(P, Q):
     return 0.5 * (sp_entropy(P, M, base=2) + sp_entropy(Q, M, base=2))
 
 
-def entropy(var):
-    """Return the Shannon entropy of a variable.
+def entropy_from_seq(var):
+    """Return the Shannon entropy of a variable. This differs from
+    Scipy's entropy by taking a sequence of observations as input
+    rather than a histogram or probability distribution.
 
     Parameters
     ----------
@@ -65,7 +67,7 @@ def joint_entropy(data):
     Returns
     -------
     float
-        Joint entrpoy of the variables of interests.
+        Joint entropy of the variables of interests.
 
     Notes
     -----


Test patch:
diff --git a/tests/test_utilities.py b/tests/test_utilities.py
index 8837207..5b2ab79 100644
--- a/tests/test_utilities.py
+++ b/tests/test_utilities.py
@@ -8,7 +8,7 @@ Test utility functions.
 
 import numpy as np
 from netrd.utilities.entropy import categorized_data
-from netrd.utilities.entropy import entropy, joint_entropy, conditional_entropy
+from netrd.utilities.entropy import entropy_from_seq, joint_entropy, conditional_entropy
 from netrd.utilities import threshold
 
 
@@ -89,7 +89,7 @@ def test_entropies():
 
     """
     data = np.array([[1, 0, 0, 1, 1, 0, 1, 0], [0, 1, 0, 1, 1, 0, 1, 0]]).T
-    H = entropy(data[:, 0])
+    H = entropy_from_seq(data[:, 0])
     H_joint = joint_entropy(data)
     H_cond = conditional_entropy(data[:, 1, np.newaxis], data[:, 0, np.newaxis])