diff options
| author | CoprDistGit <infra@openeuler.org> | 2023-04-10 16:59:22 +0000 |
|---|---|---|
| committer | CoprDistGit <infra@openeuler.org> | 2023-04-10 16:59:22 +0000 |
| commit | 444b8d18d82c0bc4938c47d3bd68c8eff1123154 (patch) | |
| tree | 4a1780ca1155f29bef5819e829d1c8facce8fbbd | |
| parent | 7c4ba70927b159f0a7070d9a62bc8e9ca184460f (diff) | |
automatic import of python-flake8-blind-except
| -rw-r--r-- | .gitignore | 1 | ||||
| -rw-r--r-- | python-flake8-blind-except.spec | 111 | ||||
| -rw-r--r-- | sources | 1 |
3 files changed, 113 insertions, 0 deletions
@@ -0,0 +1 @@ +/flake8-blind-except-0.2.1.tar.gz diff --git a/python-flake8-blind-except.spec b/python-flake8-blind-except.spec new file mode 100644 index 0000000..d626eaf --- /dev/null +++ b/python-flake8-blind-except.spec @@ -0,0 +1,111 @@ +%global _empty_manifest_terminate_build 0 +Name: python-flake8-blind-except +Version: 0.2.1 +Release: 1 +Summary: A flake8 extension that checks for blind except: statements +License: MIT +URL: https://github.com/elijahandrews/flake8-blind-except +Source0: https://mirrors.nju.edu.cn/pypi/web/packages/be/f8/cb5e0b8c948cb347b8942cb7ce73292a77ec8f9eafb8d5db999c5c1ac62f/flake8-blind-except-0.2.1.tar.gz +BuildArch: noarch + + +%description +A flake8 extension that checks for blind, catch-all ``except:`` and ``except Exception:`` statements. +As of `pycodestyle 2.1.0 <https://github.com/PyCQA/pycodestyle/commit/543f12b06592c53e2e60edc4846ee02ab9550e8b/>`_, "E722 do not use bare except, specify exception instead" is built-in. However, bare ``Exception`` and ``BaseException`` are still allowed. This extension flags them as `B902`. +Using ``except`` without explicitly specifying which exceptions to catch is generally considered bad practice, since it catches system signals like ``SIGINT``. You probably want to handle system interrupts differently than exceptions occurring in your code. +It's also usually better style to have many small ``try``-``except`` blocks catching specific exceptions instead of a giant ``try:`` block with a catch-all ``except:`` at the bottom. It's also nicer to your fellow programmers to be a bit more specific about what exceptions they can expect in specific parts of the code, and what the proper course of action is when they occur. +An example of code that will fail this check is: + try: + something_scary() + except: + everybody_panic() +However, the following code is valid: + try: + something_terrifying() + except TerrifyingException: + dont_panic() + +%package -n python3-flake8-blind-except +Summary: A flake8 extension that checks for blind except: statements +Provides: python-flake8-blind-except +BuildRequires: python3-devel +BuildRequires: python3-setuptools +BuildRequires: python3-pip +%description -n python3-flake8-blind-except +A flake8 extension that checks for blind, catch-all ``except:`` and ``except Exception:`` statements. +As of `pycodestyle 2.1.0 <https://github.com/PyCQA/pycodestyle/commit/543f12b06592c53e2e60edc4846ee02ab9550e8b/>`_, "E722 do not use bare except, specify exception instead" is built-in. However, bare ``Exception`` and ``BaseException`` are still allowed. This extension flags them as `B902`. +Using ``except`` without explicitly specifying which exceptions to catch is generally considered bad practice, since it catches system signals like ``SIGINT``. You probably want to handle system interrupts differently than exceptions occurring in your code. +It's also usually better style to have many small ``try``-``except`` blocks catching specific exceptions instead of a giant ``try:`` block with a catch-all ``except:`` at the bottom. It's also nicer to your fellow programmers to be a bit more specific about what exceptions they can expect in specific parts of the code, and what the proper course of action is when they occur. +An example of code that will fail this check is: + try: + something_scary() + except: + everybody_panic() +However, the following code is valid: + try: + something_terrifying() + except TerrifyingException: + dont_panic() + +%package help +Summary: Development documents and examples for flake8-blind-except +Provides: python3-flake8-blind-except-doc +%description help +A flake8 extension that checks for blind, catch-all ``except:`` and ``except Exception:`` statements. +As of `pycodestyle 2.1.0 <https://github.com/PyCQA/pycodestyle/commit/543f12b06592c53e2e60edc4846ee02ab9550e8b/>`_, "E722 do not use bare except, specify exception instead" is built-in. However, bare ``Exception`` and ``BaseException`` are still allowed. This extension flags them as `B902`. +Using ``except`` without explicitly specifying which exceptions to catch is generally considered bad practice, since it catches system signals like ``SIGINT``. You probably want to handle system interrupts differently than exceptions occurring in your code. +It's also usually better style to have many small ``try``-``except`` blocks catching specific exceptions instead of a giant ``try:`` block with a catch-all ``except:`` at the bottom. It's also nicer to your fellow programmers to be a bit more specific about what exceptions they can expect in specific parts of the code, and what the proper course of action is when they occur. +An example of code that will fail this check is: + try: + something_scary() + except: + everybody_panic() +However, the following code is valid: + try: + something_terrifying() + except TerrifyingException: + dont_panic() + +%prep +%autosetup -n flake8-blind-except-0.2.1 + +%build +%py3_build + +%install +%py3_install +install -d -m755 %{buildroot}/%{_pkgdocdir} +if [ -d doc ]; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi +if [ -d docs ]; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi +if [ -d example ]; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi +if [ -d examples ]; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi +pushd %{buildroot} +if [ -d usr/lib ]; then + find usr/lib -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/lib64 ]; then + find usr/lib64 -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/bin ]; then + find usr/bin -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/sbin ]; then + find usr/sbin -type f -printf "/%h/%f\n" >> filelist.lst +fi +touch doclist.lst +if [ -d usr/share/man ]; then + find usr/share/man -type f -printf "/%h/%f.gz\n" >> doclist.lst +fi +popd +mv %{buildroot}/filelist.lst . +mv %{buildroot}/doclist.lst . + +%files -n python3-flake8-blind-except -f filelist.lst +%dir %{python3_sitelib}/* + +%files help -f doclist.lst +%{_docdir}/* + +%changelog +* Mon Apr 10 2023 Python_Bot <Python_Bot@openeuler.org> - 0.2.1-1 +- Package Spec generated @@ -0,0 +1 @@ +8bef9ece23e009de0d34ebde7b6769c5 flake8-blind-except-0.2.1.tar.gz |
