Skip to content

Commit

Permalink
Avoid string types when using ClassVar
Browse files Browse the repository at this point in the history
As of Python 3.9.8, this does not work with Pydantic BaseModel, and
does not work in a way that causes the whole module to fail to
import.  See pydantic/pydantic#3401.

In general, Pydantic does not work well with string types as enabled
by from __future__ import annotations, which is why making that
feature the default has been delayed.  See
https://lwn.net/Articles/858576/ for more information.
  • Loading branch information
rra committed Nov 11, 2021
1 parent d67b257 commit 20ebc2a
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 5 deletions.
4 changes: 1 addition & 3 deletions python/lsst/daf/butler/core/logging.py
Expand Up @@ -19,8 +19,6 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.

from __future__ import annotations

__all__ = ("ButlerMDC", "ButlerLogRecords", "ButlerLogRecordHandler",
"ButlerLogRecord", "JsonLogFormatter")

Expand Down Expand Up @@ -192,7 +190,7 @@ class Config:
allow_mutation = False

@classmethod
def from_record(cls, record: LogRecord) -> ButlerLogRecord:
def from_record(cls, record: LogRecord) -> "ButlerLogRecord":
"""Create a new instance from a `~logging.LogRecord`.
Parameters
Expand Down
2 changes: 0 additions & 2 deletions python/lsst/daf/butler/core/serverModels.py
Expand Up @@ -19,8 +19,6 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.

from __future__ import annotations

__all__ = (
"QueryDatasetsModel",
"QueryDataIdsModel",
Expand Down

0 comments on commit 20ebc2a

Please sign in to comment.