tadeja commented on code in PR #55264:
URL: https://github.com/apache/arrow/pull/55264#discussion_r4679000022


##########
python/pyarrow-stubs/__lib/types.pyi:
##########
@@ -0,0 +1,666 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+import datetime
+from collections.abc import Iterable, Iterator, Mapping, Sequence
+from typing import Any, ClassVar, Literal, Self, TypeAlias, overload
+
+import numpy as np
+import pandas as pd
+from numpy.typing import DTypeLike
+from pyarrow._stubs_typing import (
+    BinaryType,
+    BinaryViewType,
+    BoolType,
+    Date32Type,
+    Date64Type,
+    Float16Type,
+    Float32Type,
+    Float64Type,
+    Int8Type,
+    Int16Type,
+    Int32Type,
+    Int64Type,
+    IntegerType,
+    LargeBinaryType,
+    LargeStringType,
+    MonthDayNanoIntervalType,
+    NullType,
+    StringType,
+    StringViewType,
+    SupportsArrowSchema,
+    TimeUnit,
+    UInt8Type,
+    UInt16Type,
+    UInt32Type,
+    UInt64Type,
+)
+from pyarrow.lib import (
+    Array,
+    Buffer,
+    ChunkedArray,
+    ExtensionArray,
+    ExtensionScalar,
+    MemoryPool,
+    Table,
+)
+from typing_extensions import CapsuleType
+
+class _Weakrefable: ...

Review Comment:
   Reposting this remaining question by @jorisvandenbossche on 06 Aug from 
https://github.com/apache/arrow/pull/48622#discussion_r3731192827:
   _"Is this one needed for typing? (I don't know if typing tools know about 
weakref-ability) And if we use it, shouldn't it indicate this has the 
`__weakref__` method?"_ 
   
   That doesn't seem to be needed for typing as tools do not check 
weakref-ability (`weakref.ref` accepts any `object` in typeshed) but kept here 
to mirror the runtime base classes in `pyarrow.lib` like `_Metadata`.
   `__weakref__` is a Cython declaration, not a Python method, ~standard 
stubs/typeshed omit it.~ Edit: rather : typeshed doesn't declare it as an 
attribute.
   
   
https://github.com/apache/arrow/blob/88e5154544b4d73d6298dad1eac6b75031d16313/python/pyarrow/lib.pxd#L37-L38
   https://github.com/python/typeshed/blob/main/stdlib/weakref.pyi#L58
   
https://cython.readthedocs.io/en/latest/src/userguide/extension_types.html#making-extension-types-weak-referenceable



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to