code
stringlengths
3
6.57k
LOG.debug('Writing %s bytes (total %s)
len(chunk)
LOG.debug('Empty chunk %s (total %s)
f.flush()
os.fsync(f)
os.path.getsize(path)
LOG.warning('Zero bytes downloaded from %s, retrying' % url)
download(url, path, verify_ssl)
LOG.debug('Done downloading %s, response code %s, total bytes %d' % (url, r.status_code, total)
LOG.debug('Cleaning up file handles for download of %s' % url)
r.close()
s.close()
parse_chunked_data(data)
strip()
re.match(r'^([0-9a-zA-Z]+)
length.group(1)
lower()
int(length, 16)
data.partition('\r\n')
chunks.append(data[:length])
strip()
join(chunks)
is_number(s)
float(s)
except (TypeError, ValueError)
is_mac_os()
bootstrap.is_mac_os()
is_linux()
bootstrap.is_linux()
is_alpine()
os.path.exists('/etc/issue')
to_str(subprocess.check_output('cat /etc/issue', shell=True)
get_arch()
is_mac_os()
is_alpine()
is_linux()
Exception('Unable to determine system architecture')
short_uid()
str(uuid.uuid4()
json_safe(item)
object (e.g., dict)
json.loads(json.dumps(item, cls=CustomEncoder)
fix_json_keys(item)
json.loads(json.dumps(item, cls=CustomEncoder)
fix_json_keys(item)
strings (not binary type or other)
isinstance(item, list)
item_copy.append(fix_json_keys(i)
isinstance(item, dict)
item.items()
to_str(k)
fix_json_keys(v)
save_file(file, content, append=False)
isinstance(content, six.string_types)
open(file, mode)
f.write(content)
f.flush()
load_file(file_path, default=None, mode=None)
os.path.isfile(file_path)
open(file_path, mode)
f.read()
to_str(obj, encoding=DEFAULT_ENCODING, errors='strict')
obj.decode(encoding, errors)
obj.decode(encoding, errors)
isinstance(obj, six.binary_type)
to_bytes(obj, encoding=DEFAULT_ENCODING, errors='strict')
obj.encode(encoding, errors)
obj.encode(encoding, errors)
isinstance(obj, six.text_type)
cleanup(files=True, env=ENV_DEV, quiet=True)
cleanup_tmp_files()
cleanup_threads_and_processes(quiet=True)
t.stop(quiet=quiet)
p.terminate()
print(e)
clear_list(TMP_THREADS)
clear_list(TMP_PROCESSES)
clear_list(l)
len(l)
cleanup_tmp_files()
rm_rf(tmp)
new_tmp_file()
tempfile.mkstemp()
os.close(tmp_file)
TMP_FILES.append(tmp_path)
new_tmp_dir()
new_tmp_file()
rm_rf(folder)
mkdir(folder)
is_ip_address(addr)
socket.inet_aton(addr)
is_zip_file(content)
BytesIO(content)
zipfile.is_zipfile(stream)
unzip(path, target_dir, overwrite=True)
is_alpine()
run('cd %s; unzip %s %s' % (target_dir, flags, path)
zipfile.ZipFile(path, 'r')
LOG.warning('Unable to open zip file: %s: %s' % (path, e)
zip_ref.infolist()