code stringlengths 3 6.57k |
|---|
_unzip_file_entry(zip_ref, file_entry, target_dir) |
zip_ref.close() |
_unzip_file_entry(zip_ref, file_entry, target_dir) |
zip_ref.extract(file_entry.filename, path=target_dir) |
os.path.join(target_dir, file_entry.filename) |
os.chmod(out_path, perm or 0o777) |
untar(path, target_dir) |
path.endswith('gz') |
tarfile.open(path, mode) |
tar.extractall(path=target_dir) |
zip_contains_jar_entries(content, jar_path_prefix=None, match_single_jar=True) |
tempfile.NamedTemporaryFile() |
tf.write(content) |
tf.flush() |
zipfile.ZipFile(tf.name, 'r') |
zf.infolist() |
e.filename.lower() |
endswith('.jar') |
len(jar_entries) |
len(zf.infolist() |
e.filename.lower() |
startswith(jar_path_prefix) |
len(matching_prefix) |
is_jar_archive(content) |
tempfile.NamedTemporaryFile() |
tf.write(content) |
tf.flush() |
zipfile.ZipFile(tf.name, 'r') |
zf.infolist() |
e.filename.endswith('.class') |
zf.infolist() |
e.filename.upper() |
is_root() |
run('whoami') |
strip() |
cleanup_resources() |
cleanup_tmp_files() |
cleanup_threads_and_processes() |
synchronized(lock=SSL_CERT_LOCK) |
generate_ssl_cert(target_file=None, overwrite=False, random=False, return_content=False, serial_number=None) |
all_exist(*files) |
all([os.path.exists(f) |
os.path.exists(target_file) |
all_exist(key_file_name, cert_file_name) |
target_file.replace('.', '.%s.' % short_uid() |
short_uid() |
crypto.PKey() |
k.generate_key(crypto.TYPE_RSA, 2048) |
crypto.X509() |
cert.get_subject() |
cert.set_version(2) |
cert.set_serial_number(serial_number) |
cert.gmtime_adj_notBefore(0) |
cert.gmtime_adj_notAfter(2 * 365 * 24 * 60 * 60) |
cert.set_issuer(cert.get_subject() |
cert.set_pubkey(k) |
crypto.X509Extension(b'subjectAltName', False, alt_names) |
crypto.X509Extension(b'basicConstraints', True, b'CA:false') |
crypto.X509Extension(b'keyUsage', True, b'nonRepudiation,digitalSignature,keyEncipherment') |
crypto.X509Extension(b'extendedKeyUsage', True, b'serverAuth') |
cert.sign(k, 'SHA256') |
StringIO() |
StringIO() |
cert_file.write(to_str(crypto.dump_certificate(crypto.FILETYPE_PEM, cert) |
key_file.write(to_str(crypto.dump_privatekey(crypto.FILETYPE_PEM, k) |
cert_file.getvalue() |
strip() |
key_file.getvalue() |
strip() |
all_exist(target_file, key_file_name, cert_file_name) |
range(2) |
save_file(target_file, file_content) |
save_file(key_file_name, key_file_content) |
save_file(cert_file_name, cert_file_content) |
LOG.info('Unable to store certificate file under %s, using tmp file instead: %s' % (target_file, e) |
new_tmp_file() |
TMP_FILES.append(target_file) |
TMP_FILES.append(key_file_name) |
TMP_FILES.append(cert_file_name) |
run_safe(_python_lambda, print_error=False, **kwargs) |
_python_lambda(**kwargs) |
LOG.warning('Unable to execute function: %s' % e) |
run_cmd_safe(**kwargs) |
run_safe(run, print_error=False, **kwargs) |
run(cmd, cache_duration_secs=0, **kwargs) |
do_run(cmd) |
bootstrap.run(cmd, **kwargs) |
do_run(cmd) |
md5(cmd) |
CACHE_FILE_PATTERN.replace('*', hash) |
mkdir(os.path.dirname(CACHE_FILE_PATTERN) |
os.path.isfile(cache_file) |
os.path.getmtime(cache_file) |
now() |
open(cache_file) |
f.read() |
f.close() |
do_run(cmd) |
open(cache_file, 'w+') |
f.write(result) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.