🏡 index : github.com/captn3m0/india-pincode-regex.git

author Nemo <commits@captnemo.in> 2021-12-19 19:19:10.0 +05:30:00
committer Nemo <commits@captnemo.in> 2021-12-19 19:19:10.0 +05:30:00
commit
5d5e939a6b019dc9df34a8c825690c92738984ab [patch]
tree
020d645cdcc06b601f5ada474db692206e3cb1b5
parent
dc6531ee98cd6896da812a8f79fc411c73200d3a
download
5d5e939a6b019dc9df34a8c825690c92738984ab.tar.gz

[python] WIP switch to pdm



Diff

 pyproject.toml          | 49 ++++++++++++++++++++++++++++---------------------
 tests/test.py           |  2 +-
 src/pincode/__init__.py |  7 ++++++-
 3 files changed, 31 insertions(+), 27 deletions(-)

diff --git a/pyproject.toml b/pyproject.toml
index 8991813..edabc7f 100644
--- a/pyproject.toml
+++ a/pyproject.toml
@@ -1,44 +1,43 @@
[tool.poetry]
[project]
name = "pincode"
version = "1.0.4"
description = "A simple offline pincode validator for India"
authors = ["Nemo <python@captnemo.in>"]
license = "MIT"
authors = [
    {name = "Nemo", email = "python@captnemo.in"},
]
dependencies = ["requests"]
readme = "README.md"
homepage = "https://github.com/captn3m0/india-pincode-regex"
repository = "https://github.com/captn3m0/india-pincode-regex"
documentation = "https://github.com/captn3m0/india-pincode-regex/wiki"
requires-python = ">=3.7"
license = {text = "MIT"}
keywords = ["pincode", "regex", "offline", "pin", "validator"]

packages = [
    { include = "pincode", from = "src" },
classifiers = [
    "Development Status :: 4 - Beta",
    "Intended Audience :: Developers",
    "Topic :: Software Development :: Libraries"
]

include = ["CHANGELOG.md", "README.md", "regex.txt"]
[project.urls]
homepage = "https://github.com/captn3m0/india-pincode-regex"
Repository = "https://github.com/captn3m0/india-pincode-regex"
Documentation = "https://github.com/captn3m0/india-pincode-regex/wiki"

exclude = [
[tool.pdm]
includes = ["CHANGELOG.md", "README.md", "regex.txt", "src/pincode"]
excludes = [
    "src/*.js",
    "src/*.php",
    "tests/*.php",
    "tests/*.js",
    "tests/*.rb",
    "tests/*.html",
    "tests/jasmine*",
    "vendor/",
    "composer.",
    "package.json",
    "package-lock.json",
    "node_modules/"
]

classifiers = [
    "Development Status :: 4 - Beta",
    "Intended Audience :: Developers",
    "Topic :: Software Development :: Libraries"
]

[tool.poetry.dependencies]
python = "^3.5"

[tool.poetry.dev-dependencies]
    ]

[build-system]
requires = ["poetry>=0.12"]
build-backend = "poetry.masonry.api"
requires = ["pdm-pep517"]
build-backend = "pdm.pep517.api"
diff --git a/tests/test.py b/tests/test.py
index b4ff64c..7b81c3f 100644
--- a/tests/test.py
+++ a/tests/test.py
@@ -1,4 +1,4 @@
from pincode import *
from pincode import Pincode
from nose.tools import assert_equals

def test_valid_pincodes():
diff --git a/src/pincode/__init__.py b/src/pincode/__init__.py
index 8d1d282..86c3db5 100644
--- a/src/pincode/__init__.py
+++ a/src/pincode/__init__.py
@@ -1,9 +1,14 @@
import os
import re

from pathlib import Path

def get_project_root() -> Path:
    return Path(__file__).parent.parent.parent

regex = list()
dir_path = os.path.dirname(os.path.realpath(__file__))
f = open(dir_path +  '/../../regex.txt')
f = open(get_project_root() / 'regex.txt')
lines = f.readlines()
for line in lines:
    if (len(line) > 10):