@@ -1672,18 +1672,6 @@ def map_paths_resource(
1672
1672
"""
1673
1673
Map paths found in the ``to_resource`` extra_data to paths of the ``from_resources``
1674
1674
CodebaseResource queryset using the precomputed ``from_resources_index`` path index.
1675
-
1676
- Args:
1677
- to_resource (CodebaseResource): The resource to map paths for.
1678
- from_resources (QuerySet): The queryset of from resources.
1679
- from_resources_index (dict): Index of from resources.
1680
- map_types (list): List of types of mapping.
1681
- logger (function, optional): Logger function to log messages.
1682
-
1683
- Returns
1684
- -------
1685
- None
1686
-
1687
1675
"""
1688
1676
relations = {}
1689
1677
@@ -1731,23 +1719,7 @@ def process_relations(
1731
1719
paths ,
1732
1720
not_mapped_paths ,
1733
1721
):
1734
- """
1735
- Process relations between resources.
1736
-
1737
- Args:
1738
- to_resource (CodebaseResource): The resource to map paths for.
1739
- from_resources (QuerySet): The queryset of from resources.
1740
- from_resources_index (dict): Index of from resources.
1741
- relations (dict): Dictionary to store relations.
1742
- map_type (str): Type of mapping.
1743
- paths (list): List of paths to map.
1744
- not_mapped_paths (list): List of not mapped paths.
1745
-
1746
- Returns
1747
- -------
1748
- None
1749
-
1750
- """
1722
+ """Process relations between resources."""
1751
1723
for path in paths :
1752
1724
match = pathmap .find_paths (path , from_resources_index )
1753
1725
if not match :
@@ -1785,15 +1757,8 @@ def process_relations(
1785
1757
1786
1758
def sort_matched_from_resources (matched_from_resources ):
1787
1759
"""
1788
- Sort the list of matched from resources based on path length and path.
1789
-
1790
- Args:
1791
- matched_from_resources (list): List of matched CodebaseResource objects.
1792
-
1793
- Returns
1794
- -------
1795
- list: Sorted list of CodebaseResource objects.
1796
-
1760
+ Return the sorted list of ``matched_from_resources``
1761
+ based on path length and path.
1797
1762
"""
1798
1763
return sorted (
1799
1764
matched_from_resources ,
@@ -1803,17 +1768,8 @@ def sort_matched_from_resources(matched_from_resources):
1803
1768
1804
1769
def is_invalid_match (match , matched_path_length ):
1805
1770
"""
1806
- Check if the match is invalid based on the matched path length and the number
1771
+ Check if the match is invalid based on the ``matched_path_length`` and the number
1807
1772
of resource IDs.
1808
-
1809
- Args:
1810
- match (PathMatch): The path match object.
1811
- matched_path_length (int): The length of the matched path.
1812
-
1813
- Returns
1814
- -------
1815
- bool: True if the match is invalid, False otherwise.
1816
-
1817
1773
"""
1818
1774
return matched_path_length == 1 and len (match .resource_ids ) != 1
1819
1775
@@ -1858,18 +1814,7 @@ def map_paths(project, file_type, collect_paths_func, map_types, logger=None):
1858
1814
1859
1815
1860
1816
def map_elfs (project , logger = None ):
1861
- """
1862
- Map ELF file paths in a project.
1863
-
1864
- Args:
1865
- project (Project): The project to map ELF files for.
1866
- logger (function, optional): Log messages.
1867
-
1868
- Returns
1869
- -------
1870
- None
1871
-
1872
- """
1817
+ """Map ELF file paths in a ``project``."""
1873
1818
from_resources = project .codebaseresources .files ().from_codebase ()
1874
1819
to_resources = (
1875
1820
project .codebaseresources .files ().to_codebase ().has_no_relation ().elfs ()
@@ -1907,17 +1852,7 @@ def map_elfs(project, logger=None):
1907
1852
1908
1853
1909
1854
def get_elf_file_dwarf_paths (location ):
1910
- """
1911
- Retrieve dwarf paths for ELF files.
1912
-
1913
- Args:
1914
- location (str): The location of the ELF file.
1915
-
1916
- Returns
1917
- -------
1918
- dict: Dictionary containing dwarf paths.
1919
-
1920
- """
1855
+ """Retrieve dwarf paths for ELF files."""
1921
1856
paths = get_dwarf_paths (location )
1922
1857
return {
1923
1858
"dwarf_compiled_paths" : paths .get ("compiled_paths" ) or [],
@@ -1926,36 +1861,15 @@ def get_elf_file_dwarf_paths(location):
1926
1861
1927
1862
1928
1863
def get_go_file_paths (location ):
1929
- """
1930
- Retrieve Go file paths.
1931
-
1932
- Args:
1933
- location (str): The location of the Go file.
1934
-
1935
- Returns
1936
- -------
1937
- dict: Dictionary containing Go file paths.
1938
-
1939
- """
1864
+ """Retrieve Go file paths."""
1940
1865
go_symbols = (
1941
1866
collect_and_parse_symbols (location , check_type = False ).get ("go_symbols" ) or {}
1942
1867
)
1943
1868
return {"go_file_paths" : go_symbols .get ("file_paths" ) or []}
1944
1869
1945
1870
1946
1871
def map_go_paths (project , logger = None ):
1947
- """
1948
- Map Go file paths in a project.
1949
-
1950
- Args:
1951
- project (Project): The project to map Go files for.
1952
- logger (function, optional): Log messages.
1953
-
1954
- Returns
1955
- -------
1956
- None
1957
-
1958
- """
1872
+ """Map Go file paths in a project."""
1959
1873
from_resources = project .codebaseresources .files ().from_codebase ()
1960
1874
to_resources = (
1961
1875
project .codebaseresources .files ()
0 commit comments