diff --git a/.env_template b/.env_template new file mode 100644 index 0000000..ff7afa6 --- /dev/null +++ b/.env_template @@ -0,0 +1,2 @@ +SAUCE_USERNAME="" +SAUCE_ACCESS_KEY="" \ No newline at end of file diff --git a/.gitignore b/.gitignore index 0d20b64..78bf3f1 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,64 @@ +*.bak +.env +# Byte-compiled / optimized / DLL files +__pycache__/ *.pyc +*.pyd +*.pyo + +# Virtual environment +.venv/ +env/ +venv/ +ENV/ +env.bak/ +venv.bak/ + +# Distribution / packaging +.Python +build/ +develop-eggs/ +dist/ +eggs/ +*.egg-info/ +.installed.cfg +*.manifest +*.spec + +# Installer logs +pip-log.txt +pip-delete-this-directory.txt + +# Unit test / coverage reports +htmlcov/ +.tox/ +.nox/ +.coverage +.coverage.* +.cache +nosetests.xml +coverage.xml +*.cover +.hypothesis/ +.pytest_cache/ + +# IDE-specific files +.idea/ # IntelliJ IDEA / PyCharm +*.iml +.vscode/ # VS Code +.settings/ # Eclipse +.project +.pydevproject + +# OS-specific files +.DS_Store # macOS +Thumbs.db # Windows + +# Jupyter Notebook files +.ipynb_checkpoints + +# MyPy +.mypy_cache/ + +# Data files +*.log diff --git a/Pipfile b/Pipfile deleted file mode 100644 index 9db2a8c..0000000 --- a/Pipfile +++ /dev/null @@ -1,14 +0,0 @@ -[[source]] -name = "pypi" -url = "https://pypi.org/simple" -verify_ssl = true - -[dev-packages] -nose = "==1.3.7" -selenium = "==3.4.2" -twine = "*" - -[packages] - -[requires] -python_version = "3.8" diff --git a/Pipfile.lock b/Pipfile.lock deleted file mode 100644 index 767b427..0000000 --- a/Pipfile.lock +++ /dev/null @@ -1,151 +0,0 @@ -{ - "_meta": { - "hash": { - "sha256": "aa65200f913c612fbc54485aaf0a80513c433f52042f5c241b27339dac2eaecb" - }, - "pipfile-spec": 6, - "requires": { - "python_version": "3.8" - }, - "sources": [ - { - "name": "pypi", - "url": "https://pypi.org/simple", - "verify_ssl": true - } - ] - }, - "default": {}, - "develop": { - "bleach": { - "hashes": [ - "sha256:cc8da25076a1fe56c3ac63671e2194458e0c4d9c7becfd52ca251650d517903c", - "sha256:e78e426105ac07026ba098f04de8abe9b6e3e98b5befbf89b51a5ef0a4292b03" - ], - "version": "==3.1.4" - }, - "certifi": { - "hashes": [ - "sha256:1d987a998c75633c40847cc966fcf5904906c920a7f17ef374f5aa4282abd304", - "sha256:51fcb31174be6e6664c5f69e3e1691a2d72a1a12e90f872cbdb1567eb47b6519" - ], - "version": "==2020.4.5.1" - }, - "chardet": { - "hashes": [ - "sha256:84ab92ed1c4d4f16916e05906b6b75a6c0fb5db821cc65e70cbd64a3e2a5eaae", - "sha256:fc323ffcaeaed0e0a02bf4d117757b98aed530d9ed4531e3e15460124c106691" - ], - "version": "==3.0.4" - }, - "docutils": { - "hashes": [ - "sha256:0c5b78adfbf7762415433f5515cd5c9e762339e23369dbe8000d84a4bf4ab3af", - "sha256:c2de3a60e9e7d07be26b7f2b00ca0309c207e06c100f9cc2a94931fc75a478fc" - ], - "version": "==0.16" - }, - "idna": { - "hashes": [ - "sha256:7588d1c14ae4c77d74036e8c22ff447b26d0fde8f007354fd48a7814db15b7cb", - "sha256:a068a21ceac8a4d63dbfd964670474107f541babbd2250d61922f029858365fa" - ], - "version": "==2.9" - }, - "keyring": { - "hashes": [ - "sha256:197fd5903901030ef7b82fe247f43cfed2c157a28e7747d1cfcf4bc5e699dd03", - "sha256:8179b1cdcdcbc221456b5b74e6b7cfa06f8dd9f239eb81892166d9223d82c5ba" - ], - "version": "==21.2.0" - }, - "nose": { - "hashes": [ - "sha256:9ff7c6cc443f8c51994b34a667bbcf45afd6d945be7477b52e97516fd17c53ac", - "sha256:dadcddc0aefbf99eea214e0f1232b94f2fa9bd98fa8353711dacb112bfcbbb2a", - "sha256:f1bffef9cbc82628f6e7d7b40d7e255aefaa1adb6a1b1d26c69a8b79e6208a98" - ], - "index": "pypi", - "version": "==1.3.7" - }, - "pkginfo": { - "hashes": [ - "sha256:7424f2c8511c186cd5424bbf31045b77435b37a8d604990b79d4e70d741148bb", - "sha256:a6d9e40ca61ad3ebd0b72fbadd4fba16e4c0e4df0428c041e01e06eb6ee71f32" - ], - "version": "==1.5.0.1" - }, - "pygments": { - "hashes": [ - "sha256:647344a061c249a3b74e230c739f434d7ea4d8b1d5f3721bc0f3558049b38f44", - "sha256:ff7a40b4860b727ab48fad6360eb351cc1b33cbf9b15a0f689ca5353e9463324" - ], - "version": "==2.6.1" - }, - "readme-renderer": { - "hashes": [ - "sha256:1b6d8dd1673a0b293766b4106af766b6eff3654605f9c4f239e65de6076bc222", - "sha256:e67d64242f0174a63c3b727801a2fff4c1f38ebe5d71d95ff7ece081945a6cd4" - ], - "version": "==25.0" - }, - "requests": { - "hashes": [ - "sha256:43999036bfa82904b6af1d99e4882b560e5e2c68e5c4b0aa03b655f3d7d73fee", - "sha256:b3f43d496c6daba4493e7c431722aeb7dbc6288f52a6e04e7b6023b0247817e6" - ], - "version": "==2.23.0" - }, - "requests-toolbelt": { - "hashes": [ - "sha256:380606e1d10dc85c3bd47bf5a6095f815ec007be7a8b69c878507068df059e6f", - "sha256:968089d4584ad4ad7c171454f0a5c6dac23971e9472521ea3b6d49d610aa6fc0" - ], - "version": "==0.9.1" - }, - "selenium": { - "hashes": [ - "sha256:046439d9370105fdb0dc99caee7dbf3290a22b8cf42d182b064abdaed030bd30", - "sha256:2befcd8a18c4a88fe7af1f848277d83aa89682516fb2ac95942cb13ea6eaad02" - ], - "index": "pypi", - "version": "==3.4.2" - }, - "six": { - "hashes": [ - "sha256:236bdbdce46e6e6a3d61a337c0f8b763ca1e8717c03b369e87a7ec7ce1319c0a", - "sha256:8f3cd2e254d8f793e7f3d6d9df77b92252b52637291d0f0da013c76ea2724b6c" - ], - "version": "==1.14.0" - }, - "tqdm": { - "hashes": [ - "sha256:00339634a22c10a7a22476ee946bbde2dbe48d042ded784e4d88e0236eca5d81", - "sha256:ea9e3fd6bd9a37e8783d75bfc4c1faf3c6813da6bd1c3e776488b41ec683af94" - ], - "version": "==4.45.0" - }, - "twine": { - "hashes": [ - "sha256:c1af8ca391e43b0a06bbc155f7f67db0bf0d19d284bfc88d1675da497a946124", - "sha256:d561a5e511f70275e5a485a6275ff61851c16ffcb3a95a602189161112d9f160" - ], - "index": "pypi", - "version": "==3.1.1" - }, - "urllib3": { - "hashes": [ - "sha256:3018294ebefce6572a474f0604c2021e33b3fd8006ecd11d62107a5d2a963527", - "sha256:88206b0eb87e6d677d424843ac5209e3fb9d0190d0ee169599165ec25e9d9115" - ], - "version": "==1.25.9" - }, - "webencodings": { - "hashes": [ - "sha256:a0af1213f3c2226497a97e2b3aa01a7e4bee4f403f95be16fc9acd2947514a78", - "sha256:b36a1c245f2d304965eb4e0a82848379241dc04b865afcc4aab16748587e1923" - ], - "version": "==0.5.1" - } - } -} diff --git a/README.rst b/README.rst index e08bea5..fa2c23a 100644 --- a/README.rst +++ b/README.rst @@ -46,6 +46,16 @@ Supported and unsupported cases are documented by tests. If you have a request or a contribution for new conversions, include a test that proves the issue and solution and send a pull request. +To install the dependencies (Python 3.7+) + + $ python3 -m venv venv + $ source venv/bin/activate + # pip install -r requirements.txt + +Populate environment variables + copy the file .env_template to .env and change the value of the variables. + Python-dotenv will get the value and feed the code where necessary + To run all unit tests locally:: $ nosetests tests/test_cssify.py diff --git a/cssify/cssify.py b/cssify/cssify.py index 19d29a9..6acbf39 100755 --- a/cssify/cssify.py +++ b/cssify/cssify.py @@ -5,24 +5,24 @@ from optparse import OptionParser sub_regexes = { - "tag": "([a-zA-Z][a-zA-Z0-9]{0,10}|\*)", - "attribute": "[.a-zA-Z_:][-\w:.]*(\(\))?)", - "value": "\s*[\w/:][-/\w\s,:;.]*" + "tag": r"([a-zA-Z][a-zA-Z0-9]{0,10}|\*)", + "attribute": r"[.a-zA-Z_:][-\w:.]*(\(\))?)", + "value": r"\s*[\w/:][-/\w\s,:;.]*", } validation_re = ( "(?P" - "(" - "^id\([\"\']?(?P%(value)s)[\"\']?\)" # special case! id(idValue) - "|" - "(?P