From 640f4a30d4f6d34e9c13241bbaaf003bb1bc49c7 Mon Sep 17 00:00:00 2001 From: MomIsBestFriend <> Date: Sat, 9 Nov 2019 13:37:49 +0200 Subject: [PATCH 1/3] cleaned a bit, and touched some docs --- pandas/compat/__init__.py | 72 +++++++++++++++++++++++++++++++++------ 1 file changed, 62 insertions(+), 10 deletions(-) diff --git a/pandas/compat/__init__.py b/pandas/compat/__init__.py index 81431db5b867c..2c8b700520eee 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) @@ -38,29 +38,73 @@ def set_function_name(f, name, cls): # https://github.com/pandas-dev/pandas/pull/9123 -def is_platform_little_endian(): - """ am I little endian """ +def is_platform_little_endian() -> bool: + """ + Checks 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(): +def is_platform_windows() -> bool: + """ + Checks 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(): +def is_platform_linux() -> bool: + """ + Checks if the running platform is linux. + + Returns + ------- + bool + True if the running platform is linux. + """ return sys.platform == "linux2" -def is_platform_mac(): +def is_platform_mac() -> bool: + """ + Checks if the running platform is mac. + + Returns + ------- + bool + True if the running platform is mac. + """ return sys.platform == "darwin" -def is_platform_32bit(): +def is_platform_32bit() -> bool: + """ + Checks 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,16 @@ def _import_lzma(): def _get_lzma_file(lzma): - """Returns the lzma method LZMAFile when the module was correctly imported. - Otherwise, raises a RuntimeError. + """ + Returns + ------- + method + The lzma.LZMAFile method. + + Raises + ------ + RuntimeError + If the module lzma was not imported correctly, or didn't exist. """ if lzma is None: raise RuntimeError( From dcab5b4e408a9426de36b37a98f7f24f6792cbeb Mon Sep 17 00:00:00 2001 From: MomIsBestFriend <> Date: Sat, 9 Nov 2019 14:04:51 +0200 Subject: [PATCH 2/3] Fixed some docs in comact/__init.py --- pandas/compat/__init__.py | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/pandas/compat/__init__.py b/pandas/compat/__init__.py index 2c8b700520eee..8f9c753a6b6e9 100644 --- a/pandas/compat/__init__.py +++ b/pandas/compat/__init__.py @@ -38,9 +38,9 @@ def set_function_name(f, name, cls): # https://github.com/pandas-dev/pandas/pull/9123 -def is_platform_little_endian() -> bool: +def is_platform_little_endian(): """ - Checks if the running platform is little endian. + Checking if the running platform is little endian. Returns ------- @@ -50,9 +50,9 @@ def is_platform_little_endian() -> bool: return sys.byteorder == "little" -def is_platform_windows() -> bool: +def is_platform_windows(): """ - Checks if the running platform is windows. + Checking if the running platform is windows. Returns ------- @@ -62,9 +62,9 @@ def is_platform_windows() -> bool: return sys.platform == "win32" or sys.platform == "cygwin" -def is_platform_linux() -> bool: +def is_platform_linux(): """ - Checks if the running platform is linux. + Checking if the running platform is linux. Returns ------- @@ -74,9 +74,9 @@ def is_platform_linux() -> bool: return sys.platform == "linux2" -def is_platform_mac() -> bool: +def is_platform_mac(): """ - Checks if the running platform is mac. + Checking if the running platform is mac. Returns ------- @@ -86,9 +86,9 @@ def is_platform_mac() -> bool: return sys.platform == "darwin" -def is_platform_32bit() -> bool: +def is_platform_32bit(): """ - Checks if the running platform is 32-bit. + Checking if the running platform is 32-bit. Returns ------- @@ -121,6 +121,8 @@ def _import_lzma(): def _get_lzma_file(lzma): """ + Attempting to get the lzma.LZMAFile method. + Returns ------- method From 657a2b1549a3c5a035578c27210e36780d811904 Mon Sep 17 00:00:00 2001 From: MomIsBestFriend <50263213+MomIsBestFriend@users.noreply.github.com> Date: Sat, 9 Nov 2019 17:10:18 +0200 Subject: [PATCH 3/3] Update __init__.py --- pandas/compat/__init__.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pandas/compat/__init__.py b/pandas/compat/__init__.py index 8f9c753a6b6e9..c2cd656bfc651 100644 --- a/pandas/compat/__init__.py +++ b/pandas/compat/__init__.py @@ -121,12 +121,12 @@ def _import_lzma(): def _get_lzma_file(lzma): """ - Attempting to get the lzma.LZMAFile method. + Attempting to get the lzma.LZMAFile class. Returns ------- - method - The lzma.LZMAFile method. + class + The lzma.LZMAFile class. Raises ------