Example #1
0
 def _to_frame(self, usecols, chunk_cnt, show_prog):
     _c = Property()
     _c.lineno = 0
     _c.linecnt = get_line_count(self.abspath)
     _c.show_prog = show_prog
     _c.chunk_cnt = chunk_cnt
     return pd.concat(self._to_frame_gen(_c, usecols))
Example #2
0
    def _to_frame_init_tfp(self):
        tfp = Property()

        # get functions
        tfp.get_line_date = _get_member(self._ctx, 'get_line_date', False)
        if tfp.get_line_date is None:
            tfp.get_line_time = _get_member(self._ctx, 'get_line_time')
        tfp.get_line_msg = _get_member(self._ctx, 'get_line_msg')
        tfp.get_line_type = _get_member(self._ctx, 'get_line_type', False)

        tfp.nodes = []
        tfp.kinds = []
        tfp.dates = []
        tfp.levels = []
        tfp.msgs = []
        return tfp
Example #3
0
 def _to_frame_prop(self, title, show_prog=True):
     c = Property()
     c.fileno = 0
     c.filecnt = len(self.files)
     c.files = self.files
     c.show_prog = show_prog
     c.pg = ProgressBar(title, c.filecnt)
     return c
Example #4
0
    def load_tmp(self):
        """Load from slot path as TempFile."""
        # load line info
        linfos = LineInfo.load(self.path, self.ctx)
        return TempFile(self.ctx, self.path, linfos)

    def remove(self):
        os.remove(self.path)
        self._linfos.remove_saved(self.path)


class SlotMap(object):

    def __init__(self, ctx):
        self.ctx = ctx
        self._dict = dict()

    def __call__(self, userid, slotname):
        key = userid, slotname
        if key not in self._dict:
            name = NAMED_TMP_PREFIX + userid + '-' + slotname
            tmp_dir = get_tmp_dir()
            self._dict[key] = Slot(self.ctx, os.path.join(tmp_dir, name))
        return self._dict[key]


pctx = Property()
pctx.fields = {}
file_field = FileField(pctx)