Northy1717/SWE-bench-Live huggingface dataset:
Repository: reflex-dev/reflex

Issue:
Customizable Reflex.DIR
Hi,
In our current working environment, we are not allowed to execute batch scripts based on the appdata directory. Would it be possible to customize the `Reflex.DIR` constant (derived from PlatformDirs) based on an environment varialbe (if set?)

I would like to just set an environment variable called i.e. REFLEX_DIR which is considered prior `PlatformDirs(MODULE_NAME, False).user_data_dir`, e.g. via `os.environ.get("REFLEX_DIR", PlatformDirs(MODULE_NAME, False).user_data_dir)`
This would make the reflex installation more flexible and I would not have to manually fix the constants.base file


Thanks, Nico


Discussion:
This is an interesting feature, I haven't considered this use case before, thanks for bringing it up. We will look into this.
May I work on this



Patch:
diff --git a/reflex/constants/base.py b/reflex/constants/base.py
index d0d9a124cc2..eeef595eb4d 100644
--- a/reflex/constants/base.py
+++ b/reflex/constants/base.py
@@ -61,10 +61,14 @@ class Reflex(SimpleNamespace):
 
     # Files and directories used to init a new project.
     # The directory to store reflex dependencies.
-    DIR = (
+    # Get directory value from enviroment variables if it exists.
+    _dir = os.environ.get("REFLEX_DIR", "")
+
+    DIR = _dir or (
         # on windows, we use C:/Users/<username>/AppData/Local/reflex.
         # on macOS, we use ~/Library/Application Support/reflex.
         # on linux, we use ~/.local/share/reflex.
+        # If user sets REFLEX_DIR envroment variable use that instead.
         PlatformDirs(MODULE_NAME, False).user_data_dir
     )
     # The root directory of the reflex library.


Test patch:
diff --git a/tests/test_config.py b/tests/test_config.py
index bc35314122c..1ba2f548dea 100644
--- a/tests/test_config.py
+++ b/tests/test_config.py
@@ -1,3 +1,4 @@
+import multiprocessing
 import os
 from typing import Any, Dict
 
@@ -200,3 +201,21 @@ def test_replace_defaults(
     c._set_persistent(**set_persistent_vars)
     for key, value in exp_config_values.items():
         assert getattr(c, key) == value
+
+
+def reflex_dir_constant():
+    return rx.constants.Reflex.DIR
+
+
+def test_reflex_dir_env_var(monkeypatch, tmp_path):
+    """Test that the REFLEX_DIR environment variable is used to set the Reflex.DIR constant.
+
+    Args:
+        monkeypatch: The pytest monkeypatch object.
+        tmp_path: The pytest tmp_path object.
+    """
+    monkeypatch.setenv("REFLEX_DIR", str(tmp_path))
+
+    mp_ctx = multiprocessing.get_context(method="spawn")
+    with mp_ctx.Pool(processes=1) as pool:
+        assert pool.apply(reflex_dir_constant) == str(tmp_path)
Repository: sphinx-doc/sphinx

Issue:
Allow control over Enum repr
**Is your feature request related to a problem? Please describe.**

From #9272, [this commit](https://github.com/sphinx-doc/sphinx/commit/31ec519d3808617e333794493e0aabc5fe5d4f81) removed any user control over the representation of the Enum in the docs. As a result, what we would like to be represented as `<no_default>` becomes the slightly ugly `_NoDefault.no_default` in the [pandas docs](https://pandas.pydata.org/pandas-docs/version/2.1/reference/api/pandas.DataFrame.groupby.html). 

**Describe the solution you'd like**
Add a check to see if the user is overwriting Enum's repr: `object.__repr__ is Enum.__repr__`. If they are overwriting it, just use the repr as-is.

**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.

**Additional context**
Add any other context or screenshots about the feature request here.

- [e.g. URL or Ticket]




Discussion:
PR is welcomed. I agree that using a custom ``__repr__`` (if available) is better.



Patch:
diff --git a/CHANGES.rst b/CHANGES.rst
index 73cb7409de0..3843e3691cd 100644
--- a/CHANGES.rst
+++ b/CHANGES.rst
@@ -21,6 +21,8 @@ Features added
   Patch by Bénédikt Tran.
 
   .. _`<search>`: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/search
+* #11803: autodoc: Use an overriden ``__repr__()`` function in an enum,
+  if defined. Patch by Shengyu Zhang.
 
 Bugs fixed
 ----------
diff --git a/sphinx/util/inspect.py b/sphinx/util/inspect.py
index 218f4abca21..a70beb70e3b 100644
--- a/sphinx/util/inspect.py
+++ b/sphinx/util/inspect.py
@@ -387,6 +387,8 @@ def object_description(obj: Any, *, _seen: frozenset = frozenset()) -> str:
         return 'frozenset({%s})' % ', '.join(object_description(x, _seen=seen)
                                              for x in sorted_values)
     elif isinstance(obj, enum.Enum):
+        if obj.__repr__.__func__ is not enum.Enum.__repr__:  # type: ignore[attr-defined]
+            return repr(obj)
         return f'{obj.__class__.__name__}.{obj.name}'
     elif isinstance(obj, tuple):
         if id(obj) in seen:


Test patch:
diff --git a/tests/test_util_inspect.py b/tests/test_util_inspect.py
index 73f96562f42..6ae6ac0a9b1 100644
--- a/tests/test_util_inspect.py
+++ b/tests/test_util_inspect.py
@@ -667,6 +667,17 @@ class MyEnum(enum.Enum):
     assert inspect.object_description(MyEnum.FOO) == "MyEnum.FOO"
 
 
+def test_object_description_enum_custom_repr():
+    class MyEnum(enum.Enum):
+        FOO = 1
+        BAR = 2
+
+        def __repr__(self):
+            return self.name
+
+    assert inspect.object_description(MyEnum.FOO) == "FOO"
+
+
 def test_getslots():
     class Foo:
         pass