Skip to content

Commit 88ee574

Browse files
committed
Change docstring format
Signed-off-by: Tushar Goel <tushar.goel.dav@gmail.com>
1 parent b27bcd8 commit 88ee574

File tree

1 file changed

+8
-94
lines changed

1 file changed

+8
-94
lines changed

scanpipe/pipes/d2d.py

Lines changed: 8 additions & 94 deletions
Original file line numberDiff line numberDiff line change
@@ -1672,18 +1672,6 @@ def map_paths_resource(
16721672
"""
16731673
Map paths found in the ``to_resource`` extra_data to paths of the ``from_resources``
16741674
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-
16871675
"""
16881676
relations = {}
16891677

@@ -1731,23 +1719,7 @@ def process_relations(
17311719
paths,
17321720
not_mapped_paths,
17331721
):
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."""
17511723
for path in paths:
17521724
match = pathmap.find_paths(path, from_resources_index)
17531725
if not match:
@@ -1785,15 +1757,8 @@ def process_relations(
17851757

17861758
def sort_matched_from_resources(matched_from_resources):
17871759
"""
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.
17971762
"""
17981763
return sorted(
17991764
matched_from_resources,
@@ -1803,17 +1768,8 @@ def sort_matched_from_resources(matched_from_resources):
18031768

18041769
def is_invalid_match(match, matched_path_length):
18051770
"""
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
18071772
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-
18171773
"""
18181774
return matched_path_length == 1 and len(match.resource_ids) != 1
18191775

@@ -1858,18 +1814,7 @@ def map_paths(project, file_type, collect_paths_func, map_types, logger=None):
18581814

18591815

18601816
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``."""
18731818
from_resources = project.codebaseresources.files().from_codebase()
18741819
to_resources = (
18751820
project.codebaseresources.files().to_codebase().has_no_relation().elfs()
@@ -1907,17 +1852,7 @@ def map_elfs(project, logger=None):
19071852

19081853

19091854
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."""
19211856
paths = get_dwarf_paths(location)
19221857
return {
19231858
"dwarf_compiled_paths": paths.get("compiled_paths") or [],
@@ -1926,36 +1861,15 @@ def get_elf_file_dwarf_paths(location):
19261861

19271862

19281863
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."""
19401865
go_symbols = (
19411866
collect_and_parse_symbols(location, check_type=False).get("go_symbols") or {}
19421867
)
19431868
return {"go_file_paths": go_symbols.get("file_paths") or []}
19441869

19451870

19461871
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."""
19591873
from_resources = project.codebaseresources.files().from_codebase()
19601874
to_resources = (
19611875
project.codebaseresources.files()

0 commit comments

Comments
 (0)