summaryrefslogtreecommitdiff
path: root/venv/Lib/site-packages/astroid/brain/brain_nose.py
diff options
context:
space:
mode:
authorpravindalve2023-05-30 04:20:14 +0530
committerGitHub2023-05-30 04:20:14 +0530
commitcbdd7ca21f1f673a3a739065098f7cc6c9c4b881 (patch)
tree595e888c38f00a314e751096b6bf636a544a5efe /venv/Lib/site-packages/astroid/brain/brain_nose.py
parent7740d1ca0c2e6bf34900460b0c58fa4d528577fb (diff)
parent280c6aa89a15331fb76b7014957953dc72af6093 (diff)
downloadChemical-Simulator-GUI-master.tar.gz
Chemical-Simulator-GUI-master.tar.bz2
Chemical-Simulator-GUI-master.zip
Merge pull request #63 from brenda-br/Fix-35HEADmaster
Restructure Project and Deployment
Diffstat (limited to 'venv/Lib/site-packages/astroid/brain/brain_nose.py')
-rw-r--r--venv/Lib/site-packages/astroid/brain/brain_nose.py77
1 files changed, 0 insertions, 77 deletions
diff --git a/venv/Lib/site-packages/astroid/brain/brain_nose.py b/venv/Lib/site-packages/astroid/brain/brain_nose.py
deleted file mode 100644
index 7b12d76..0000000
--- a/venv/Lib/site-packages/astroid/brain/brain_nose.py
+++ /dev/null
@@ -1,77 +0,0 @@
-# Copyright (c) 2015-2016 Claudiu Popa <pcmanticore@gmail.com>
-# Copyright (c) 2016 Ceridwen <ceridwenv@gmail.com>
-
-# Licensed under the LGPL: https://www.gnu.org/licenses/old-licenses/lgpl-2.1.en.html
-# For details: https://github.com/PyCQA/astroid/blob/master/COPYING.LESSER
-
-
-"""Hooks for nose library."""
-
-import re
-import textwrap
-
-import astroid
-import astroid.builder
-
-_BUILDER = astroid.builder.AstroidBuilder(astroid.MANAGER)
-
-
-def _pep8(name, caps=re.compile("([A-Z])")):
- return caps.sub(lambda m: "_" + m.groups()[0].lower(), name)
-
-
-def _nose_tools_functions():
- """Get an iterator of names and bound methods."""
- module = _BUILDER.string_build(
- textwrap.dedent(
- """
- import unittest
-
- class Test(unittest.TestCase):
- pass
- a = Test()
- """
- )
- )
- try:
- case = next(module["a"].infer())
- except astroid.InferenceError:
- return
- for method in case.methods():
- if method.name.startswith("assert") and "_" not in method.name:
- pep8_name = _pep8(method.name)
- yield pep8_name, astroid.BoundMethod(method, case)
- if method.name == "assertEqual":
- # nose also exports assert_equals.
- yield "assert_equals", astroid.BoundMethod(method, case)
-
-
-def _nose_tools_transform(node):
- for method_name, method in _nose_tools_functions():
- node.locals[method_name] = [method]
-
-
-def _nose_tools_trivial_transform():
- """Custom transform for the nose.tools module."""
- stub = _BUILDER.string_build("""__all__ = []""")
- all_entries = ["ok_", "eq_"]
-
- for pep8_name, method in _nose_tools_functions():
- all_entries.append(pep8_name)
- stub[pep8_name] = method
-
- # Update the __all__ variable, since nose.tools
- # does this manually with .append.
- all_assign = stub["__all__"].parent
- all_object = astroid.List(all_entries)
- all_object.parent = all_assign
- all_assign.value = all_object
- return stub
-
-
-astroid.register_module_extender(
- astroid.MANAGER, "nose.tools.trivial", _nose_tools_trivial_transform
-)
-astroid.MANAGER.register_transform(
- astroid.Module, _nose_tools_transform, lambda n: n.name == "nose.tools"
-)