ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/ns_dev/Python/NinoCode/Tool_Box/LitTechHelperTools.py
Revision: 744
Committed: Tue Apr 13 21:40:41 2021 UTC (4 years, 11 months ago) by nino.borges
Content type: text/x-python
File size: 1163 byte(s)
Log Message:
Updated all tools libs to be python 3 compatible. 

File Contents

# Content
1 """
2
3 LitTechHelperTools.py
4
5 Created by
6 Emanuel Borges
7
8 This is a collection of generic litigation technology tools, like taking
9 begimage and begattach and making a dict.
10
11 """
12
13 import os
14
15 def FamilyToDict(dbExport):
16 """Takes an export of bates and begattach and makes a dir. should be pipe delimited and no quotes"""
17 ## Returns a dict where the parent is the key and the first value in the list (but only if its in the document)
18 familyDict = {}
19 for line in dbExport:
20 line = line.replace("\n","")
21 bates,begAttach = line.split("|")
22 if bates == begAttach:
23 ## Im a parent
24 if bates in list(familyDict.keys()):
25 pass
26 else:
27 familyDict[bates] = [bates,]
28 else:
29 ## Im a child
30 if begAttach in list(familyDict.keys()):
31 familyDict[begAttach].append(bates)
32 else:
33 ## I removed this line vecause there will be times where the parent is missing from the export
34 #familyDict[begAttach] = [begAttach,bates]
35 familyDict[begAttach] = [bates,]
36 return familyDict
37
38
39