本文整理汇总了Python中output.Output类的典型用法代码示例。如果您正苦于以下问题:Python Output类的具体用法?Python Output怎么用?Python Output使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Output类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: main
def main():
(opts, args) = cli()
key = get_value('key')
td = Tmdb(key, opts.category)
if opts.listing:
li = Listing(opts.category)
movies = li.get_movies()
prefix = "list_"
subject = "Week %s: %s" % (THIS_WEEK, li.title)
else:
movies = td.get_movies(opts.numres)
prefix = ""
subject = "%s movies - week %s" % (opts.category.title().replace("_", " "), THIS_WEEK)
ca = Cache(prefix + os.path.basename(opts.category))
newMovies = ca.shelve_results(movies)
if opts.listing:
movieObjects = ca.shelve_get_items(movies) # allow dups
else:
movieObjects = ca.shelve_get_items(newMovies) # only new ones
op = Output(movieObjects)
html = [op.generate_header()]
html.append(op.generate_movie_html_div())
if opts.printres:
print "\n".join(html)
if opts.mailres:
sender = get_value('sender')
recipients = load_emails('recipients')
ma = Mail(sender)
ma.mail_html(recipients, subject, "\n".join(html))
示例2: add
def add(self):
adder = Add()
if self.args['one_sample'] is not None:
new_sample = [tuple(entry.strip('}').strip('{').strip(',').split(':')) for entry in self.args['one_sample']]
new_sample = dict(new_sample)
adder.add_one_sample(new_sample)
if len(self.args['email']) > 0:
if not sampleinfo_mongo.is_fully_annotated(new_sample['SAMPLE']):
annotate = Annotate()
annotate.annotate_sample(new_sample['SAMPLE'], 'orig')
output_files = Output()
final_file = output_files.sample_variants_csv(new_sample['SAMPLE'], 'orig')
message = "Here are all the variants for the sample %s with their QC status." % new_sample['SAMPLE']
for address in self.args['email']:
self.__log_sending_email(address)
output_bash.email_file(message, final_file, address)
elif self.args['sample_info'] is not None:
adder.add_sample_info(self.args['sample_info'])
示例3: __init__
class Feature1:
def __init__(self, f):
self.f = f
self.tfidf = f.tfidf
self.matrix = f.matrix
self.dfs = f.dfs
self.out = Output("output1")
self.features = Set()
def _select(self):
values = []
for did, row in self.matrix.iteritems():
values += [(v, k) for (k, v) in row.iteritems()]
length = len(values)
start = min(length / 20, 100)
end = min(start + 1000, length)
selected = sorted(values, key=operator.itemgetter(0), reverse=True)[start:end]
for tfidf, word in selected:
self.features.add(word)
self.features = sorted(self.features)
def write(self):
print "Building and selecting Feature Set 1"
self._select()
self.out.write_data(self.f.docs, self.features, self.matrix)
示例4: install
def install(self, target: Target, state: State, output: Output):
"""Installs CMake.
CMake is not easily buildable on Windows so we rely on a binary
distribution
Parameters
----------
target: Target
The target platform and architecture.
state: State
The state of the bootstrap build.
output: Output
The output helper.
"""
print("")
output.print_step_title("Installing CMake")
if state.cmake_path == "":
self._install(target)
print(" CMake installed successfully")
else:
self.path = state.cmake_path
print(" Using previous installation: " + self.path)
state.set_cmake_path(self.path)
output.next_step()
示例5: HandleData
def HandleData(self, Pesticide, szData, Answer):
szAnswer = ""
dicData = {}
dicData = utils.ParseAnswer(szData)
if dicData == None:
return False
# Analyze command
if dicData["CODE"] == "LIST":
Output.debug("Command LIST received")
if self.__HandleList(Pesticide, dicData, Answer) == False:
return False
elif dicData["CODE"] == "INFO":
Output.debug("Command INFO received")
if self.__HandleInfo(VERSION, PROTOCOL, DESC, STATUS, dicData, Answer) == False:
return False
elif dicData["CODE"] == "INC":
Output.debug("Command INC received")
if self.__HandleInc(Pesticide, dicData, Answer) == False:
return False
elif dicData["CODE"] == "DEC":
Output.debug("Command DEC received")
if self.__HandleDec(Pesticide, dicData, Answer) == False:
return False
else:
Output.debug("Unknown command \"%s\"" % dicData["CODE"])
return False
return True
示例6: run
def run(*datasources, **options):
"""Executes given Robot data sources with given options.
Data sources are paths to files and directories, similarly as when running
pybot/jybot from command line. Options are given as keywords arguments and
their names are same as long command line options without hyphens.
Examples:
run('/path/to/tests.html')
run('/path/to/tests.html', '/path/to/tests2.html', log='mylog.html')
Equivalent command line usage:
pybot /path/to/tests.html
pybot --log mylog.html /path/to/tests.html /path/to/tests2.html
"""
STOP_SIGNAL_MONITOR.start()
settings = RobotSettings(options)
LOGGER.register_console_logger(settings['MonitorWidth'],
settings['MonitorColors'])
init_global_variables(settings)
suite = TestSuite(datasources, settings)
output = Output(settings)
suite.run(output)
LOGGER.info("Tests execution ended. Statistics:\n%s"
% suite.get_stat_message())
output.close(suite)
if settings.is_rebot_needed():
output, settings = settings.get_rebot_datasource_and_settings()
ResultWriter(settings).write_robot_results(output)
LOGGER.close()
return suite
示例7: render_save
def render_save(self, varlist, outputfile=None):
"""Render and save to file"""
rendered_str = self.render(varlist)
out = Output(outputfile)
out.write(rendered_str)
out.close()
return outputfile
示例8: main
def main(send=False):
key = get_value('key')
html = None
# get movie info for all categories
for cat in CATEGORIES:
td = Tmdb(key, cat)
movies = td.get_movies(NUM_RES)
ca = Cache(os.path.basename(cat))
ca.shelve_results(movies)
newMovies = ca.shelve_results(movies)
movieObjects = ca.shelve_get_items(newMovies) # only new ones
op = Output(movieObjects)
if html is None:
html = [op.generate_header()]
catPrettified = cat.title().replace("_", " ")
html.append(op.generate_category_title(catPrettified))
html.append(op.generate_movie_html_div())
# save html
f = open(OUTFILE, "w")
f.write("\n".join(html))
f.close()
# email
if send:
subject = "Sharemovi.es / %s movies / week %s" % (", ".join(CATEGORIES), str(THIS_WEEK))
sender = get_value('sender')
recipients = load_emails('recipients')
ma = Mail(sender)
ma.mail_html(recipients, subject, "\n".join(html))
示例9: output
def output(self):
if self.args['type'] == 'sample':
if not sampleinfo_mongo.is_fully_annotated(self.args['name']):
annotate = Annotate()
annotate.annotate_sample(self.args['name'], 'orig')
output_files = Output()
output_files.sample_variants_csv(self.args['name'], 'orig')
示例10: remove
def remove(self, character):
"""Deze is voor leave"""
if character.RAW == 'alagos':
Output.leader_not_leave_party()
elif character in self.inside:
Output.character_leave_party(character.NAME, self.NAME)
del self.inside[character]
else:
raise KeyError
示例11: cmd_purchaselist
def cmd_purchaselist(*params):
try:
if params[0] == "weapons" and params[1] not in Output.WPN_SORT:
raise ValueError
Output.shop_list(data.list_gear_dict[params[0]][0], params[1])
except KeyError:
print("purchaselist [{}]".format("/".join(Output.DECO_SORT)))
except ValueError:
print("purchaselist weapons [{}]".format("/".join(Output.WPN_SORT)))
示例12: stats
def stats(self):
"""
The stats option handler.
:return:
"""
varstats = Output()
varstats.hotspot_stats()
vtools = VTools()
vtools.create_vcf_files()
示例13: cmd_load
def cmd_load(*params):
try:
filename = os.path.join('savegame', params[0]+'.dat')
Output.cmd_load()
with open(filename, 'rb') as f:
data.heroes, data.pouchitems, data.inventory, data.pouch, data.party = pickle.load(f)
except (OSError, FileNotFoundError):
print('load [name_savegame]')
except EOFError:
print('This is not a PyRPG save file.')
示例14: set_equipment
def set_equipment(self, item, verbose=True):
"""Deze is voor sell, equip en unequip"""
for equipment_type, equipment_item in self.equipment.items():
if isinstance(equipment_item, type(item)):
if self._is_unable_to_equip(item):
return False
self.equipment[equipment_type] = item
self.stats_update()
if verbose and "empty" not in item.RAW:
Output.is_equipping(self.NAME, item.NAME)
return True
示例15: ReadTextFile
def ReadTextFile(szFilePath):
try:
f = open(szFilePath, "r")
try:
return f.read()
finally:
f.close()
Output.debug('File "%s" successfully loaded' % szFilePath)
except:
Output.exception('Exception while trying to read file "%s"' % szFilePath)
return None