How to use the prettytable.MSWORD_FRIENDLY function in prettytable

To help you get started, we’ve selected a few prettytable examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github kxxoling / PTable / tests / test_prettytable.py View on Github external
def setUp(self):
        BasicTests.setUp(self)
        self.x.set_style(MSWORD_FRIENDLY)
github nurdtechie98 / drive-cli / drive_cli / actions.py View on Github external
revisions = service.revisions().list(fileId=file_id).execute()
        t.add_row(["Revision", "", " "])
        rev_num = 0
        for rev in revisions["items"]:
            rev_num = rev_num + 1
            t.add_row([rev_num, "ID", rev["id"]])
            t.add_row(["", "modified by", rev["lastModifyingUser"]["displayName"]])
            t.add_row(["", "email address", rev["lastModifyingUser"]["emailAddress"]])
            date_time = rev["modifiedDate"].split("T")
            date = date_time[0]
            time = date_time[1].split(".")[0]
            t.add_row(["", "modified date", date + " " + time])
            t.add_row(["", "file size", rev["fileSize"] + "\n"])
    except:
        pass
    t.set_style(MSWORD_FRIENDLY)
    print(t)
github NUAA-AL / ALiPy / alipy / experiment / state_io.py View on Github external
def __repr__(self):
        numqdata = self._numqdata
        cost = self.cost_inall
        tb = pt.PrettyTable()
        tb.set_style(pt.MSWORD_FRIENDLY)
        tb.add_column('round', [self.round])
        tb.add_column('initially labeled data', [
            " %d (%.2f%% of all)" % (len(self.init_L), 100 * len(self.init_L) / (len(self.init_L) + len(self.init_U)))])
        tb.add_column('number of queries', [len(self.__state_list)])
        # tb.add_column('queried data', ["%d (%.2f%% of unlabeled data)" % (numqdata, self.queried_percentage)])
        tb.add_column('cost', [cost])
        # tb.add_column('saving path', [self._saving_dir])
        tb.add_column('Performance:', ["%.3f ± %.2f" % self.get_current_performance()])
        return str(tb)
github WangYihang / SourceLeakHacker / lib / util / output.py View on Github external
def asTable():
    table = prettytable.PrettyTable()
    table.field_names = headers
    for k, v in context.result.items():
        if v["code"] != 404:
            table.add_row([
                color.colorByStatusCode(v["code"], v["code"]), 
                # v["code"],
                v["Content-Length"], 
                "%02f" % v["time"], 
                v["Content-Type"], 
                # string.fixLength(k, 0x20)
                k,
            ])
    table.set_style(prettytable.MSWORD_FRIENDLY)
    logger.plain(table)
github ekta1007 / Experiments-in-Data-mining / Disambiguated_master_company_list.py View on Github external
# now do the frequncy plotting !

pt = PrettyTable(['Company', 'Freq'])
pt.align['Company'] = 'l'
fdist = nltk.FreqDist(company_list_final)
for (company, freq) in fdist.items():
    try:
        pt.add_row([company.decode('utf-8'), freq])
    except UnicodeDecodeError:
        pass
print (pt)
# I am plotting the entire frequnecy maps, while an option could be to have a threshold, and possibly also do cumulative counts as a fraction of overall "Network" population
#Getting the pretty table in A friendlier format - you can export this directly in Excel for further analysis.
from prettytable import MSWORD_FRIENDLY
pt.set_style(MSWORD_FRIENDLY)
print(pt)
github stephenslab / dsc / src / dsc_parser.py View on Github external
for x in self.content[k]['input']:
                    if isinstance(
                            self.content[k]['input'][x][0], str
                    ) and self.content[k]['input'][x][0].startswith('$'):
                        inputs.append(self.content[k]['input'][x][0][1:])
                    else:
                        params.append(x)
                res['modules']['input'].append(', '.join(sorted(inputs)))
                res['modules']['parameters'].append(', '.join(sorted(params)))
                res['modules']['type'].append(self.modules[k].exe['type'] if k
                                              in self.modules else 'unused')
        from prettytable import PrettyTable
        from prettytable import MSWORD_FRIENDLY
        output_string = []
        t = PrettyTable()
        t.set_style(MSWORD_FRIENDLY)
        # the master table
        for key, value in res['modules'].items():
            t.add_column(f'- {key} -' if key.strip() and not to_html else key,
                         value)
        if not to_html:
            env.logger.info("``MODULES``")
        # sub-tables
        groups = copy.deepcopy(self.runtime.groups)
        groups.update(self.runtime.concats)
        reported_rows = []
        if self.runtime.groups:
            for group, values in groups.items():
                rm = [
                    idx for idx, item in enumerate(res['modules'][' '])
                    if item not in values
                ]