diff --git a/pandas/compat/__init__.py b/pandas/compat/__init__.py index 81431db5b867c..c2cd656bfc651 100644 --- a/pandas/compat/__init__.py +++ b/pandas/compat/__init__.py @@ -29,7 +29,7 @@ def set_function_name(f, name, cls): """ - Bind the name/qualname attributes of the function + Bind the name/qualname attributes of the function. """ f.__name__ = name f.__qualname__ = "{klass}.{name}".format(klass=cls.__name__, name=name) @@ -39,28 +39,72 @@ def set_function_name(f, name, cls): # https://github.com/pandas-dev/pandas/pull/9123 def is_platform_little_endian(): - """ am I little endian """ + """ + Checking if the running platform is little endian. + + Returns + ------- + bool + True if the running platform is little endian. + """ return sys.byteorder == "little" def is_platform_windows(): + """ + Checking if the running platform is windows. + + Returns + ------- + bool + True if the running platform is windows. + """ return sys.platform == "win32" or sys.platform == "cygwin" def is_platform_linux(): + """ + Checking if the running platform is linux. + + Returns + ------- + bool + True if the running platform is linux. + """ return sys.platform == "linux2" def is_platform_mac(): + """ + Checking if the running platform is mac. + + Returns + ------- + bool + True if the running platform is mac. + """ return sys.platform == "darwin" def is_platform_32bit(): + """ + Checking if the running platform is 32-bit. + + Returns + ------- + bool + True if the running platform is 32-bit. + """ return struct.calcsize("P") * 8 < 64 def _import_lzma(): - """Attempts to import lzma, warning the user when lzma is not available. + """ + Attempts to import the lzma module. + + Warns + ----- + When the lzma module is not available. """ try: import lzma @@ -76,8 +120,18 @@ def _import_lzma(): def _get_lzma_file(lzma): - """Returns the lzma method LZMAFile when the module was correctly imported. - Otherwise, raises a RuntimeError. + """ + Attempting to get the lzma.LZMAFile class. + + Returns + ------- + class + The lzma.LZMAFile class. + + Raises + ------ + RuntimeError + If the module lzma was not imported correctly, or didn't exist. """ if lzma is None: raise RuntimeError(