]>
Softwares of Agnibho - ddstorm.git/blob - index.py
5 # Copyright (c) 2015 Agnibho Mondal
8 # This file is part of DDStorm.
10 # DDStorm is free software: you can redistribute it and/or modify
11 # it under the terms of the GNU General Public License as published by
12 # the Free Software Foundation, either version 3 of the License, or
13 # (at your option) any later version.
15 # DDStorm is distributed in the hope that it will be useful,
16 # but WITHOUT ANY WARRANTY; without even the implied warranty of
17 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 # GNU General Public License for more details.
20 # You should have received a copy of the GNU General Public License
21 # along with DDStorm. If not, see <http://www.gnu.org/licenses/>.
24 from fnmatch
import fnmatch
29 def __init__(self
, conf
=False):
38 for path
, subdirs
, files
in os
.walk(self
.conf
.get("index_path")):
40 if(fnmatch(name
, "*.txt")):
41 with
open(self
.conf
.get("index_path")+name
, "r") as f
:
46 line
=line
.rstrip().split("#")[0]
50 ws
=len(line
)-len(line
.lstrip())
51 line
=line
.lstrip().capitalize()
54 buff
[0].append(line
.lstrip())
58 buff
[0].append(line
.lstrip())
60 self
.data
[buff
[0][-1]]=list(reversed(buff
[0]))
61 elif(ws
==buff
[1][-1]):
62 buff
[0][-1]=line
.lstrip()
64 self
.data
[buff
[0][-1]]=list(reversed(buff
[0]))
66 for i
in reversed(buff
[1]):
71 buff
[0].append(line
.lstrip())
74 self
.data
[buff
[0][-1]]=list(reversed(buff
[0]))
76 def upstream(self
, name
):
79 return self
.data
[name
]
86 print(i
.upstream(sys
.argv
[1]))
88 if(__name__
=="__main__"):