38
38
from django .template .defaultfilters import pluralize
39
39
40
40
from commoncode .paths import common_prefix
41
+ from elf_inspector .dwarf import get_dwarf_paths
41
42
from extractcode import EXTRACT_SUFFIX
42
43
from packagedcode .npm import NpmPackageJsonHandler
43
44
from summarycode .classify import LEGAL_STARTS_ENDS
44
- from elf_inspector .dwarf import get_dwarf_paths
45
45
46
46
from scanpipe import pipes
47
47
from scanpipe .models import CodebaseRelation
@@ -1666,7 +1666,10 @@ def _match_purldb_resources_post_process(
1666
1666
1667
1667
1668
1668
def _map_dwarf_path_resource (
1669
- to_resource , from_resources , from_resources_index , logger = None ,
1669
+ to_resource ,
1670
+ from_resources ,
1671
+ from_resources_index ,
1672
+ logger = None ,
1670
1673
):
1671
1674
"""
1672
1675
Map DWARF dwarf_paths found in the ``to_resource`` extra_data to
@@ -1705,7 +1708,9 @@ def _map_dwarf_path_resource(
1705
1708
matched_from_resources = [
1706
1709
from_resources .get (id = rid ) for rid in match .resource_ids
1707
1710
]
1708
- matched_from_resources .sort (key = lambda res : (len (res .path .strip ("/" ).split ("/" )), res .path ))
1711
+ matched_from_resources .sort (
1712
+ key = lambda res : (len (res .path .strip ("/" ).split ("/" )), res .path )
1713
+ )
1709
1714
winning_from_resource = matched_from_resources [0 ]
1710
1715
1711
1716
# Do not count the "to/" segment as it is not "matchable"
@@ -1740,7 +1745,10 @@ def _map_dwarf_path_resource(
1740
1745
# save the "dwarf dwarf_paths not mapped"
1741
1746
to_resource .save ()
1742
1747
if logger :
1743
- logger (f"WARNING: DWARF paths NOT mapped for: { to_resource .path !r} : " + ", " .join (map (repr , dpnm )))
1748
+ logger (
1749
+ f"WARNING: DWARF paths NOT mapped for: { to_resource .path !r} : "
1750
+ + ", " .join (map (repr , dpnm ))
1751
+ )
1744
1752
1745
1753
1746
1754
def map_elf (project , logger = None ):
@@ -1764,9 +1772,7 @@ def map_elf(project, logger=None):
1764
1772
)
1765
1773
1766
1774
if logger :
1767
- logger (
1768
- f"Done building from/ resources index."
1769
- )
1775
+ logger (f"Done building from/ resources index." )
1770
1776
1771
1777
resource_iterator = to_resources .iterator (chunk_size = 2000 )
1772
1778
progress = LoopProgress (resource_count , logger )
@@ -1776,4 +1782,4 @@ def map_elf(project, logger=None):
1776
1782
from_resources ,
1777
1783
from_resources_index ,
1778
1784
logger = logger ,
1779
- )
1785
+ )
0 commit comments