MCPcopy Create free account
hub / github.com/bugy/script-server / __init__

Method __init__

src/web/streaming_form_reader.py:10–27  ·  view source on GitHub ↗
(self, header, files_path)

Source from the content-addressed store, hash-verified

8
9class _FormDataPart:
10 def __init__(self, header, files_path):
11 header_str = header.decode('utf-8')
12 if '\r\n' in header_str:
13 header_str = header_str[:header_str.index('\r\n')]
14
15 (value, sub_headers) = parse_header(header_str)
16
17 self.name = sub_headers['name']
18
19 self.filename = sub_headers.get('filename')
20
21 if self.filename:
22 self.path = os.path.join(files_path, self.filename)
23 self.path = file_utils.create_unique_filename(self.path)
24 # touch file
25 open(self.path, 'w').close()
26 else:
27 self.value = ''
28
29 def write(self, chunk):
30 if self.filename:

Callers

nothing calls this directly

Calls 3

parse_headerFunction · 0.90
getMethod · 0.45
closeMethod · 0.45

Tested by

no test coverage detected