File tree 3 files changed +12
-5
lines changed
3 files changed +12
-5
lines changed Original file line number Diff line number Diff line change @@ -147,11 +147,7 @@ def format_node_name(
147
147
"""Format the name of a node."""
148
148
if isinstance (node , PPathNode ):
149
149
if node .name != node .path .as_posix ():
150
- # Use getattr with default because on existing projects PNode.attribute does
151
- # not exist. Remove with v0.6.0.
152
- if data_catalog_name := getattr (node , "attributes" , {}).get (
153
- DATA_CATALOG_NAME_FIELD
154
- ):
150
+ if data_catalog_name := node .attributes .get (DATA_CATALOG_NAME_FIELD ):
155
151
return Text (f"{ data_catalog_name } ::{ node .name } " )
156
152
return Text (node .name )
157
153
name = shorten_path (node .path , paths )
Original file line number Diff line number Diff line change @@ -93,6 +93,11 @@ def __attrs_post_init__(self) -> None:
93
93
# Initialize the data catalog with persisted nodes from previous runs.
94
94
for path in self .path .glob ("*-node.pkl" ):
95
95
node = pickle .loads (path .read_bytes ()) # noqa: S301
96
+
97
+ # To ease transition from nodes with and without attributes and it if it
98
+ # does not exist. Necessary since #650. Remove in v0.6.0.
99
+ if not hasattr (node , "attributes" ):
100
+ node .attributes = {DATA_CATALOG_NAME_FIELD : self .name }
96
101
self ._entries [node .name ] = node
97
102
98
103
def __getitem__ (self , name : str ) -> PNode | PProvisionalNode :
Original file line number Diff line number Diff line change
1
+ """Contains utilities for the data catalog."""
2
+
3
+ __all__ = ["DATA_CATALOG_NAME_FIELD" ]
4
+
5
+
6
+ DATA_CATALOG_NAME_FIELD = "catalog_name"
You can’t perform that action at this time.
0 commit comments