text stringlengths 0 828 |
|---|
self.injections.inject(ssh_config_path, ssh_config_injection) |
else: |
self.injections.inject(ssh_config_path, ssh_config_injection) |
self.injections.commit()" |
997,"def _build_ssh_config(self, config): |
"""""" build the ssh injection configuration """""" |
ssh_config_injection = ssh_config_template % { |
'host': config.get('host'), |
'hostname': config.get('hostname'), |
'ssh_key_path': config.get('ssh_key_path'), |
'user': config.get('user') |
} |
if config.has('port'): |
ssh_config_injection += "" Port {0}\n"".format(config.get('port')) |
return ssh_config_injection" |
998,"def extract_followups(task): |
"""""" |
Retrieve callbacks and errbacks from provided task instance, disables |
tasks callbacks. |
"""""" |
callbacks = task.request.callbacks |
errbacks = task.request.errbacks |
task.request.callbacks = None |
return {'link': callbacks, 'link_error': errbacks}" |
999,"def gen_procfile(ctx, wsgi, dev): |
""""""Generates Procfiles which can be used with honcho or foreman. |
"""""" |
if wsgi is None: |
if os.path.exists(""wsgi.py""): |
wsgi = ""wsgi.py"" |
elif os.path.exists(""app.py""): |
wsgi = ""app.py"" |
else: |
wsgi = ""app.py"" |
ctx.invoke(gen_apppy) |
def write_procfile(filename, server_process, debug): |
processes = [server_process] + current_app.processes |
procfile = [] |
for name, cmd in procfile_processes(processes, debug).iteritems(): |
procfile.append(""%s: %s"" % (name, cmd)) |
with open(filename, ""w"") as f: |
f.write(""\n"".join(procfile)) |
write_procfile(""Procfile"", (""web"", [""gunicorn"", wsgi]), False) |
if dev: |
write_procfile(""Procfile.dev"", (""web"", [""frasco"", ""serve""]), True)" |
1000,"def add(self, host, filename, data, f_type, f_other_type=None, f_text=''): |
"""""" |
Add evidence |
:param host: db.t_hosts.id |
:param filename: Filename |
:param data: Content of file |
:param f_type: Evidence type |
:param f_other_type: If f_type is 'Other' what type it is |
:param f_text: Text information about the evidence |
:return: (True/False, response message) |
"""""" |
return self.send.evidence_add(host, filename, data, f_type, f_other_type, f_text)" |
1001,"def utc_mktime(utc_tuple): |
""""""Returns number of seconds elapsed since epoch |
Note that no timezone are taken into consideration. |
utc tuple must be: (year, month, day, hour, minute, second) |
"""""" |
if len(utc_tuple) == 6: |
utc_tuple += (0, 0, 0) |
return time.mktime(utc_tuple) - time.mktime((1970, 1, 1, 0, 0, 0, 0, 0, 0))" |
1002,"def f(self): |
"""""" |
Time, in 12-hour hours and minutes, with minutes left off if they're |
zero. |
Examples: '1', '1:30', '2:05', '2' |
Proprietary extension. |
"""""" |
if self.data.minute == 0: |
return self.g() |
return u'%s:%s' % (self.g(), self.i())" |
1003,"def g(self): |
""Hour, 12-hour format without leading zeros; i.e. '1' to '12'"" |
if self.data.hour == 0: |
return 12 |
if self.data.hour > 12: |
return self.data.hour - 12 |
return self.data.hour" |
1004,"def P(self): |
"""""" |
Time, in 12-hour hours, minutes and 'a.m.'/'p.m.', with minutes left off |
if they're zero and the strings 'midnight' and 'noon' if appropriate. |
Examples: '1 a.m.', '1:30 p.m.', 'midnight', 'noon', '12:30 p.m.' |
Proprietary extension. |
"""""" |
if self.data.minute == 0 and self.data.hour == 0: |
return _('midnight') |
if self.data.minute == 0 and self.data.hour == 12: |
return _('noon') |
return u'%s %s' % (self.f(), self.a())" |
1005,"def I(self): |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.