repo stringlengths 7 55 | path stringlengths 4 127 | func_name stringlengths 1 88 | original_string stringlengths 75 19.8k | language stringclasses 1
value | code stringlengths 75 19.8k | code_tokens list | docstring stringlengths 3 17.3k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 87 242 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
quantopian/trading_calendars | trading_calendars/trading_calendar.py | TradingCalendar.minutes_for_sessions_in_range | def minutes_for_sessions_in_range(self,
start_session_label,
end_session_label):
"""
Returns all the minutes for all the sessions from the given start
session label to the given end session label, inclusive.
Par... | python | def minutes_for_sessions_in_range(self,
start_session_label,
end_session_label):
"""
Returns all the minutes for all the sessions from the given start
session label to the given end session label, inclusive.
Par... | [
"def",
"minutes_for_sessions_in_range",
"(",
"self",
",",
"start_session_label",
",",
"end_session_label",
")",
":",
"first_minute",
",",
"_",
"=",
"self",
".",
"open_and_close_for_session",
"(",
"start_session_label",
")",
"_",
",",
"last_minute",
"=",
"self",
".",... | Returns all the minutes for all the sessions from the given start
session label to the given end session label, inclusive.
Parameters
----------
start_session_label: pd.Timestamp
The label of the first session in the range.
end_session_label: pd.Timestamp
... | [
"Returns",
"all",
"the",
"minutes",
"for",
"all",
"the",
"sessions",
"from",
"the",
"given",
"start",
"session",
"label",
"to",
"the",
"given",
"end",
"session",
"label",
"inclusive",
"."
] | 951711c82c8a2875c09e96e2979faaf8734fb4df | https://github.com/quantopian/trading_calendars/blob/951711c82c8a2875c09e96e2979faaf8734fb4df/trading_calendars/trading_calendar.py#L713-L737 | train |
quantopian/trading_calendars | trading_calendars/trading_calendar.py | TradingCalendar.open_and_close_for_session | def open_and_close_for_session(self, session_label):
"""
Returns a tuple of timestamps of the open and close of the session
represented by the given label.
Parameters
----------
session_label: pd.Timestamp
The session whose open and close are desired.
... | python | def open_and_close_for_session(self, session_label):
"""
Returns a tuple of timestamps of the open and close of the session
represented by the given label.
Parameters
----------
session_label: pd.Timestamp
The session whose open and close are desired.
... | [
"def",
"open_and_close_for_session",
"(",
"self",
",",
"session_label",
")",
":",
"sched",
"=",
"self",
".",
"schedule",
"return",
"(",
"sched",
".",
"at",
"[",
"session_label",
",",
"'market_open'",
"]",
".",
"tz_localize",
"(",
"UTC",
")",
",",
"sched",
... | Returns a tuple of timestamps of the open and close of the session
represented by the given label.
Parameters
----------
session_label: pd.Timestamp
The session whose open and close are desired.
Returns
-------
(Timestamp, Timestamp)
The ... | [
"Returns",
"a",
"tuple",
"of",
"timestamps",
"of",
"the",
"open",
"and",
"close",
"of",
"the",
"session",
"represented",
"by",
"the",
"given",
"label",
"."
] | 951711c82c8a2875c09e96e2979faaf8734fb4df | https://github.com/quantopian/trading_calendars/blob/951711c82c8a2875c09e96e2979faaf8734fb4df/trading_calendars/trading_calendar.py#L739-L762 | train |
quantopian/trading_calendars | trading_calendars/trading_calendar.py | TradingCalendar.all_minutes | def all_minutes(self):
"""
Returns a DatetimeIndex representing all the minutes in this calendar.
"""
opens_in_ns = self._opens.values.astype(
'datetime64[ns]',
).view('int64')
closes_in_ns = self._closes.values.astype(
'datetime64[ns]',
)... | python | def all_minutes(self):
"""
Returns a DatetimeIndex representing all the minutes in this calendar.
"""
opens_in_ns = self._opens.values.astype(
'datetime64[ns]',
).view('int64')
closes_in_ns = self._closes.values.astype(
'datetime64[ns]',
)... | [
"def",
"all_minutes",
"(",
"self",
")",
":",
"opens_in_ns",
"=",
"self",
".",
"_opens",
".",
"values",
".",
"astype",
"(",
"'datetime64[ns]'",
",",
")",
".",
"view",
"(",
"'int64'",
")",
"closes_in_ns",
"=",
"self",
".",
"_closes",
".",
"values",
".",
... | Returns a DatetimeIndex representing all the minutes in this calendar. | [
"Returns",
"a",
"DatetimeIndex",
"representing",
"all",
"the",
"minutes",
"in",
"this",
"calendar",
"."
] | 951711c82c8a2875c09e96e2979faaf8734fb4df | https://github.com/quantopian/trading_calendars/blob/951711c82c8a2875c09e96e2979faaf8734fb4df/trading_calendars/trading_calendar.py#L807-L822 | train |
quantopian/trading_calendars | trading_calendars/trading_calendar.py | TradingCalendar.minute_to_session_label | def minute_to_session_label(self, dt, direction="next"):
"""
Given a minute, get the label of its containing session.
Parameters
----------
dt : pd.Timestamp or nanosecond offset
The dt for which to get the containing session.
direction: str
"nex... | python | def minute_to_session_label(self, dt, direction="next"):
"""
Given a minute, get the label of its containing session.
Parameters
----------
dt : pd.Timestamp or nanosecond offset
The dt for which to get the containing session.
direction: str
"nex... | [
"def",
"minute_to_session_label",
"(",
"self",
",",
"dt",
",",
"direction",
"=",
"\"next\"",
")",
":",
"if",
"direction",
"==",
"\"next\"",
":",
"try",
":",
"return",
"self",
".",
"_minute_to_session_label_cache",
"[",
"dt",
"]",
"except",
"KeyError",
":",
"... | Given a minute, get the label of its containing session.
Parameters
----------
dt : pd.Timestamp or nanosecond offset
The dt for which to get the containing session.
direction: str
"next" (default) means that if the given dt is not part of a
session,... | [
"Given",
"a",
"minute",
"get",
"the",
"label",
"of",
"its",
"containing",
"session",
"."
] | 951711c82c8a2875c09e96e2979faaf8734fb4df | https://github.com/quantopian/trading_calendars/blob/951711c82c8a2875c09e96e2979faaf8734fb4df/trading_calendars/trading_calendar.py#L825-L876 | train |
quantopian/trading_calendars | trading_calendars/trading_calendar.py | TradingCalendar.minute_index_to_session_labels | def minute_index_to_session_labels(self, index):
"""
Given a sorted DatetimeIndex of market minutes, return a
DatetimeIndex of the corresponding session labels.
Parameters
----------
index: pd.DatetimeIndex or pd.Series
The ordered list of market minutes we w... | python | def minute_index_to_session_labels(self, index):
"""
Given a sorted DatetimeIndex of market minutes, return a
DatetimeIndex of the corresponding session labels.
Parameters
----------
index: pd.DatetimeIndex or pd.Series
The ordered list of market minutes we w... | [
"def",
"minute_index_to_session_labels",
"(",
"self",
",",
"index",
")",
":",
"if",
"not",
"index",
".",
"is_monotonic_increasing",
":",
"raise",
"ValueError",
"(",
"\"Non-ordered index passed to minute_index_to_session_labels.\"",
")",
"prev_opens",
"=",
"(",
"self",
"... | Given a sorted DatetimeIndex of market minutes, return a
DatetimeIndex of the corresponding session labels.
Parameters
----------
index: pd.DatetimeIndex or pd.Series
The ordered list of market minutes we want session labels for.
Returns
-------
pd.D... | [
"Given",
"a",
"sorted",
"DatetimeIndex",
"of",
"market",
"minutes",
"return",
"a",
"DatetimeIndex",
"of",
"the",
"corresponding",
"session",
"labels",
"."
] | 951711c82c8a2875c09e96e2979faaf8734fb4df | https://github.com/quantopian/trading_calendars/blob/951711c82c8a2875c09e96e2979faaf8734fb4df/trading_calendars/trading_calendar.py#L878-L930 | train |
quantopian/trading_calendars | trading_calendars/trading_calendar.py | TradingCalendar._special_dates | def _special_dates(self, calendars, ad_hoc_dates, start_date, end_date):
"""
Compute a Series of times associated with special dates.
Parameters
----------
holiday_calendars : list[(datetime.time, HolidayCalendar)]
Pairs of time and calendar describing when that time... | python | def _special_dates(self, calendars, ad_hoc_dates, start_date, end_date):
"""
Compute a Series of times associated with special dates.
Parameters
----------
holiday_calendars : list[(datetime.time, HolidayCalendar)]
Pairs of time and calendar describing when that time... | [
"def",
"_special_dates",
"(",
"self",
",",
"calendars",
",",
"ad_hoc_dates",
",",
"start_date",
",",
"end_date",
")",
":",
"regular",
"=",
"[",
"scheduled_special_times",
"(",
"calendar",
",",
"start_date",
",",
"end_date",
",",
"time_",
",",
"self",
".",
"t... | Compute a Series of times associated with special dates.
Parameters
----------
holiday_calendars : list[(datetime.time, HolidayCalendar)]
Pairs of time and calendar describing when that time occurs. These
are used to describe regularly-scheduled late opens or early
... | [
"Compute",
"a",
"Series",
"of",
"times",
"associated",
"with",
"special",
"dates",
"."
] | 951711c82c8a2875c09e96e2979faaf8734fb4df | https://github.com/quantopian/trading_calendars/blob/951711c82c8a2875c09e96e2979faaf8734fb4df/trading_calendars/trading_calendar.py#L932-L984 | train |
datahq/dataflows | setup.py | read | def read(*paths):
"""Read a text file."""
basedir = os.path.dirname(__file__)
fullpath = os.path.join(basedir, *paths)
contents = io.open(fullpath, encoding='utf-8').read().strip()
return contents | python | def read(*paths):
"""Read a text file."""
basedir = os.path.dirname(__file__)
fullpath = os.path.join(basedir, *paths)
contents = io.open(fullpath, encoding='utf-8').read().strip()
return contents | [
"def",
"read",
"(",
"*",
"paths",
")",
":",
"basedir",
"=",
"os",
".",
"path",
".",
"dirname",
"(",
"__file__",
")",
"fullpath",
"=",
"os",
".",
"path",
".",
"join",
"(",
"basedir",
",",
"*",
"paths",
")",
"contents",
"=",
"io",
".",
"open",
"(",... | Read a text file. | [
"Read",
"a",
"text",
"file",
"."
] | 2c5e5e01e09c8b44e0ff36d85b3f2f4dcf4e8465 | https://github.com/datahq/dataflows/blob/2c5e5e01e09c8b44e0ff36d85b3f2f4dcf4e8465/setup.py#L12-L17 | train |
ipfs/py-ipfs-api | ipfsapi/encoding.py | Encoding.parse | def parse(self, raw):
"""Returns a Python object decoded from the bytes of this encoding.
Raises
------
~ipfsapi.exceptions.DecodingError
Parameters
----------
raw : bytes
Data to be parsed
Returns
-------
object
... | python | def parse(self, raw):
"""Returns a Python object decoded from the bytes of this encoding.
Raises
------
~ipfsapi.exceptions.DecodingError
Parameters
----------
raw : bytes
Data to be parsed
Returns
-------
object
... | [
"def",
"parse",
"(",
"self",
",",
"raw",
")",
":",
"results",
"=",
"list",
"(",
"self",
".",
"parse_partial",
"(",
"raw",
")",
")",
"results",
".",
"extend",
"(",
"self",
".",
"parse_finalize",
"(",
")",
")",
"return",
"results",
"[",
"0",
"]",
"if... | Returns a Python object decoded from the bytes of this encoding.
Raises
------
~ipfsapi.exceptions.DecodingError
Parameters
----------
raw : bytes
Data to be parsed
Returns
-------
object | [
"Returns",
"a",
"Python",
"object",
"decoded",
"from",
"the",
"bytes",
"of",
"this",
"encoding",
"."
] | 7574dad04877b45dbe4ad321dcfa9e880eb2d90c | https://github.com/ipfs/py-ipfs-api/blob/7574dad04877b45dbe4ad321dcfa9e880eb2d90c/ipfsapi/encoding.py#L60-L78 | train |
ipfs/py-ipfs-api | ipfsapi/encoding.py | Json.parse_partial | def parse_partial(self, data):
"""Incrementally decodes JSON data sets into Python objects.
Raises
------
~ipfsapi.exceptions.DecodingError
Returns
-------
generator
"""
try:
# Python 3 requires all JSON data to be a text string
... | python | def parse_partial(self, data):
"""Incrementally decodes JSON data sets into Python objects.
Raises
------
~ipfsapi.exceptions.DecodingError
Returns
-------
generator
"""
try:
# Python 3 requires all JSON data to be a text string
... | [
"def",
"parse_partial",
"(",
"self",
",",
"data",
")",
":",
"try",
":",
"lines",
"=",
"self",
".",
"_decoder1",
".",
"decode",
"(",
"data",
",",
"False",
")",
".",
"split",
"(",
"\"\\n\"",
")",
"if",
"len",
"(",
"self",
".",
"_buffer",
")",
">",
... | Incrementally decodes JSON data sets into Python objects.
Raises
------
~ipfsapi.exceptions.DecodingError
Returns
-------
generator | [
"Incrementally",
"decodes",
"JSON",
"data",
"sets",
"into",
"Python",
"objects",
"."
] | 7574dad04877b45dbe4ad321dcfa9e880eb2d90c | https://github.com/ipfs/py-ipfs-api/blob/7574dad04877b45dbe4ad321dcfa9e880eb2d90c/ipfsapi/encoding.py#L141-L230 | train |
ipfs/py-ipfs-api | ipfsapi/encoding.py | Json.parse_finalize | def parse_finalize(self):
"""Raises errors for incomplete buffered data that could not be parsed
because the end of the input data has been reached.
Raises
------
~ipfsapi.exceptions.DecodingError
Returns
-------
tuple : Always empty
"""
... | python | def parse_finalize(self):
"""Raises errors for incomplete buffered data that could not be parsed
because the end of the input data has been reached.
Raises
------
~ipfsapi.exceptions.DecodingError
Returns
-------
tuple : Always empty
"""
... | [
"def",
"parse_finalize",
"(",
"self",
")",
":",
"try",
":",
"try",
":",
"self",
".",
"_decoder1",
".",
"decode",
"(",
"b''",
",",
"True",
")",
"except",
"UnicodeDecodeError",
"as",
"error",
":",
"raise",
"exceptions",
".",
"DecodingError",
"(",
"'json'",
... | Raises errors for incomplete buffered data that could not be parsed
because the end of the input data has been reached.
Raises
------
~ipfsapi.exceptions.DecodingError
Returns
-------
tuple : Always empty | [
"Raises",
"errors",
"for",
"incomplete",
"buffered",
"data",
"that",
"could",
"not",
"be",
"parsed",
"because",
"the",
"end",
"of",
"the",
"input",
"data",
"has",
"been",
"reached",
"."
] | 7574dad04877b45dbe4ad321dcfa9e880eb2d90c | https://github.com/ipfs/py-ipfs-api/blob/7574dad04877b45dbe4ad321dcfa9e880eb2d90c/ipfsapi/encoding.py#L232-L261 | train |
ipfs/py-ipfs-api | ipfsapi/encoding.py | Json.encode | def encode(self, obj):
"""Returns ``obj`` serialized as JSON formatted bytes.
Raises
------
~ipfsapi.exceptions.EncodingError
Parameters
----------
obj : str | list | dict | int
JSON serializable Python object
Returns
-------
... | python | def encode(self, obj):
"""Returns ``obj`` serialized as JSON formatted bytes.
Raises
------
~ipfsapi.exceptions.EncodingError
Parameters
----------
obj : str | list | dict | int
JSON serializable Python object
Returns
-------
... | [
"def",
"encode",
"(",
"self",
",",
"obj",
")",
":",
"try",
":",
"result",
"=",
"json",
".",
"dumps",
"(",
"obj",
",",
"sort_keys",
"=",
"True",
",",
"indent",
"=",
"None",
",",
"separators",
"=",
"(",
"','",
",",
"':'",
")",
",",
"ensure_ascii",
... | Returns ``obj`` serialized as JSON formatted bytes.
Raises
------
~ipfsapi.exceptions.EncodingError
Parameters
----------
obj : str | list | dict | int
JSON serializable Python object
Returns
-------
bytes | [
"Returns",
"obj",
"serialized",
"as",
"JSON",
"formatted",
"bytes",
"."
] | 7574dad04877b45dbe4ad321dcfa9e880eb2d90c | https://github.com/ipfs/py-ipfs-api/blob/7574dad04877b45dbe4ad321dcfa9e880eb2d90c/ipfsapi/encoding.py#L263-L287 | train |
ipfs/py-ipfs-api | ipfsapi/encoding.py | Pickle.parse_finalize | def parse_finalize(self):
"""Parses the buffered data and yields the result.
Raises
------
~ipfsapi.exceptions.DecodingError
Returns
-------
generator
"""
try:
self._buffer.seek(0, 0)
yield pickle.load(self._buffer)... | python | def parse_finalize(self):
"""Parses the buffered data and yields the result.
Raises
------
~ipfsapi.exceptions.DecodingError
Returns
-------
generator
"""
try:
self._buffer.seek(0, 0)
yield pickle.load(self._buffer)... | [
"def",
"parse_finalize",
"(",
"self",
")",
":",
"try",
":",
"self",
".",
"_buffer",
".",
"seek",
"(",
"0",
",",
"0",
")",
"yield",
"pickle",
".",
"load",
"(",
"self",
".",
"_buffer",
")",
"except",
"pickle",
".",
"UnpicklingError",
"as",
"error",
":"... | Parses the buffered data and yields the result.
Raises
------
~ipfsapi.exceptions.DecodingError
Returns
-------
generator | [
"Parses",
"the",
"buffered",
"data",
"and",
"yields",
"the",
"result",
"."
] | 7574dad04877b45dbe4ad321dcfa9e880eb2d90c | https://github.com/ipfs/py-ipfs-api/blob/7574dad04877b45dbe4ad321dcfa9e880eb2d90c/ipfsapi/encoding.py#L319-L334 | train |
ipfs/py-ipfs-api | ipfsapi/encoding.py | Pickle.encode | def encode(self, obj):
"""Returns ``obj`` serialized as a pickle binary string.
Raises
------
~ipfsapi.exceptions.EncodingError
Parameters
----------
obj : object
Serializable Python object
Returns
-------
bytes
"... | python | def encode(self, obj):
"""Returns ``obj`` serialized as a pickle binary string.
Raises
------
~ipfsapi.exceptions.EncodingError
Parameters
----------
obj : object
Serializable Python object
Returns
-------
bytes
"... | [
"def",
"encode",
"(",
"self",
",",
"obj",
")",
":",
"try",
":",
"return",
"pickle",
".",
"dumps",
"(",
"obj",
")",
"except",
"pickle",
".",
"PicklingError",
"as",
"error",
":",
"raise",
"exceptions",
".",
"EncodingError",
"(",
"'pickle'",
",",
"error",
... | Returns ``obj`` serialized as a pickle binary string.
Raises
------
~ipfsapi.exceptions.EncodingError
Parameters
----------
obj : object
Serializable Python object
Returns
-------
bytes | [
"Returns",
"obj",
"serialized",
"as",
"a",
"pickle",
"binary",
"string",
"."
] | 7574dad04877b45dbe4ad321dcfa9e880eb2d90c | https://github.com/ipfs/py-ipfs-api/blob/7574dad04877b45dbe4ad321dcfa9e880eb2d90c/ipfsapi/encoding.py#L360-L379 | train |
ipfs/py-ipfs-api | ipfsapi/multipart.py | glob_compile | def glob_compile(pat):
"""Translate a shell glob PATTERN to a regular expression.
This is almost entirely based on `fnmatch.translate` source-code from the
python 3.5 standard-library.
"""
i, n = 0, len(pat)
res = ''
while i < n:
c = pat[i]
i = i + 1
if c == '/' and... | python | def glob_compile(pat):
"""Translate a shell glob PATTERN to a regular expression.
This is almost entirely based on `fnmatch.translate` source-code from the
python 3.5 standard-library.
"""
i, n = 0, len(pat)
res = ''
while i < n:
c = pat[i]
i = i + 1
if c == '/' and... | [
"def",
"glob_compile",
"(",
"pat",
")",
":",
"i",
",",
"n",
"=",
"0",
",",
"len",
"(",
"pat",
")",
"res",
"=",
"''",
"while",
"i",
"<",
"n",
":",
"c",
"=",
"pat",
"[",
"i",
"]",
"i",
"=",
"i",
"+",
"1",
"if",
"c",
"==",
"'/'",
"and",
"l... | Translate a shell glob PATTERN to a regular expression.
This is almost entirely based on `fnmatch.translate` source-code from the
python 3.5 standard-library. | [
"Translate",
"a",
"shell",
"glob",
"PATTERN",
"to",
"a",
"regular",
"expression",
"."
] | 7574dad04877b45dbe4ad321dcfa9e880eb2d90c | https://github.com/ipfs/py-ipfs-api/blob/7574dad04877b45dbe4ad321dcfa9e880eb2d90c/ipfsapi/multipart.py#L319-L366 | train |
ipfs/py-ipfs-api | ipfsapi/multipart.py | stream_files | def stream_files(files, chunk_size=default_chunk_size):
"""Gets a buffered generator for streaming files.
Returns a buffered generator which encodes a file or list of files as
:mimetype:`multipart/form-data` with the corresponding headers.
Parameters
----------
files : str
The file(s) ... | python | def stream_files(files, chunk_size=default_chunk_size):
"""Gets a buffered generator for streaming files.
Returns a buffered generator which encodes a file or list of files as
:mimetype:`multipart/form-data` with the corresponding headers.
Parameters
----------
files : str
The file(s) ... | [
"def",
"stream_files",
"(",
"files",
",",
"chunk_size",
"=",
"default_chunk_size",
")",
":",
"stream",
"=",
"FileStream",
"(",
"files",
",",
"chunk_size",
"=",
"chunk_size",
")",
"return",
"stream",
".",
"body",
"(",
")",
",",
"stream",
".",
"headers"
] | Gets a buffered generator for streaming files.
Returns a buffered generator which encodes a file or list of files as
:mimetype:`multipart/form-data` with the corresponding headers.
Parameters
----------
files : str
The file(s) to stream
chunk_size : int
Maximum size of each str... | [
"Gets",
"a",
"buffered",
"generator",
"for",
"streaming",
"files",
"."
] | 7574dad04877b45dbe4ad321dcfa9e880eb2d90c | https://github.com/ipfs/py-ipfs-api/blob/7574dad04877b45dbe4ad321dcfa9e880eb2d90c/ipfsapi/multipart.py#L560-L575 | train |
ipfs/py-ipfs-api | ipfsapi/multipart.py | stream_directory | def stream_directory(directory,
recursive=False,
patterns='**',
chunk_size=default_chunk_size):
"""Gets a buffered generator for streaming directories.
Returns a buffered generator which encodes a directory as
:mimetype:`multipart/form-data` wi... | python | def stream_directory(directory,
recursive=False,
patterns='**',
chunk_size=default_chunk_size):
"""Gets a buffered generator for streaming directories.
Returns a buffered generator which encodes a directory as
:mimetype:`multipart/form-data` wi... | [
"def",
"stream_directory",
"(",
"directory",
",",
"recursive",
"=",
"False",
",",
"patterns",
"=",
"'**'",
",",
"chunk_size",
"=",
"default_chunk_size",
")",
":",
"stream",
"=",
"DirectoryStream",
"(",
"directory",
",",
"recursive",
"=",
"recursive",
",",
"pat... | Gets a buffered generator for streaming directories.
Returns a buffered generator which encodes a directory as
:mimetype:`multipart/form-data` with the corresponding headers.
Parameters
----------
directory : str
The filepath of the directory to stream
recursive : bool
Stream a... | [
"Gets",
"a",
"buffered",
"generator",
"for",
"streaming",
"directories",
"."
] | 7574dad04877b45dbe4ad321dcfa9e880eb2d90c | https://github.com/ipfs/py-ipfs-api/blob/7574dad04877b45dbe4ad321dcfa9e880eb2d90c/ipfsapi/multipart.py#L578-L604 | train |
ipfs/py-ipfs-api | ipfsapi/multipart.py | stream_filesystem_node | def stream_filesystem_node(path,
recursive=False,
patterns='**',
chunk_size=default_chunk_size):
"""Gets a buffered generator for streaming either files or directories.
Returns a buffered generator which encodes the file or direct... | python | def stream_filesystem_node(path,
recursive=False,
patterns='**',
chunk_size=default_chunk_size):
"""Gets a buffered generator for streaming either files or directories.
Returns a buffered generator which encodes the file or direct... | [
"def",
"stream_filesystem_node",
"(",
"path",
",",
"recursive",
"=",
"False",
",",
"patterns",
"=",
"'**'",
",",
"chunk_size",
"=",
"default_chunk_size",
")",
":",
"is_dir",
"=",
"isinstance",
"(",
"path",
",",
"six",
".",
"string_types",
")",
"and",
"os",
... | Gets a buffered generator for streaming either files or directories.
Returns a buffered generator which encodes the file or directory at the
given path as :mimetype:`multipart/form-data` with the corresponding
headers.
Parameters
----------
path : str
The filepath of the directory or f... | [
"Gets",
"a",
"buffered",
"generator",
"for",
"streaming",
"either",
"files",
"or",
"directories",
"."
] | 7574dad04877b45dbe4ad321dcfa9e880eb2d90c | https://github.com/ipfs/py-ipfs-api/blob/7574dad04877b45dbe4ad321dcfa9e880eb2d90c/ipfsapi/multipart.py#L607-L633 | train |
ipfs/py-ipfs-api | ipfsapi/multipart.py | stream_bytes | def stream_bytes(data, chunk_size=default_chunk_size):
"""Gets a buffered generator for streaming binary data.
Returns a buffered generator which encodes binary data as
:mimetype:`multipart/form-data` with the corresponding headers.
Parameters
----------
data : bytes
The data bytes to ... | python | def stream_bytes(data, chunk_size=default_chunk_size):
"""Gets a buffered generator for streaming binary data.
Returns a buffered generator which encodes binary data as
:mimetype:`multipart/form-data` with the corresponding headers.
Parameters
----------
data : bytes
The data bytes to ... | [
"def",
"stream_bytes",
"(",
"data",
",",
"chunk_size",
"=",
"default_chunk_size",
")",
":",
"stream",
"=",
"BytesStream",
"(",
"data",
",",
"chunk_size",
"=",
"chunk_size",
")",
"return",
"stream",
".",
"body",
"(",
")",
",",
"stream",
".",
"headers"
] | Gets a buffered generator for streaming binary data.
Returns a buffered generator which encodes binary data as
:mimetype:`multipart/form-data` with the corresponding headers.
Parameters
----------
data : bytes
The data bytes to stream
chunk_size : int
The maximum size of each s... | [
"Gets",
"a",
"buffered",
"generator",
"for",
"streaming",
"binary",
"data",
"."
] | 7574dad04877b45dbe4ad321dcfa9e880eb2d90c | https://github.com/ipfs/py-ipfs-api/blob/7574dad04877b45dbe4ad321dcfa9e880eb2d90c/ipfsapi/multipart.py#L636-L655 | train |
ipfs/py-ipfs-api | ipfsapi/multipart.py | stream_text | def stream_text(text, chunk_size=default_chunk_size):
"""Gets a buffered generator for streaming text.
Returns a buffered generator which encodes a string as
:mimetype:`multipart/form-data` with the corresponding headers.
Parameters
----------
text : str
The data bytes to stream
ch... | python | def stream_text(text, chunk_size=default_chunk_size):
"""Gets a buffered generator for streaming text.
Returns a buffered generator which encodes a string as
:mimetype:`multipart/form-data` with the corresponding headers.
Parameters
----------
text : str
The data bytes to stream
ch... | [
"def",
"stream_text",
"(",
"text",
",",
"chunk_size",
"=",
"default_chunk_size",
")",
":",
"if",
"isgenerator",
"(",
"text",
")",
":",
"def",
"binary_stream",
"(",
")",
":",
"for",
"item",
"in",
"text",
":",
"if",
"six",
".",
"PY2",
"and",
"isinstance",
... | Gets a buffered generator for streaming text.
Returns a buffered generator which encodes a string as
:mimetype:`multipart/form-data` with the corresponding headers.
Parameters
----------
text : str
The data bytes to stream
chunk_size : int
The maximum size of each stream chunk
... | [
"Gets",
"a",
"buffered",
"generator",
"for",
"streaming",
"text",
"."
] | 7574dad04877b45dbe4ad321dcfa9e880eb2d90c | https://github.com/ipfs/py-ipfs-api/blob/7574dad04877b45dbe4ad321dcfa9e880eb2d90c/ipfsapi/multipart.py#L658-L692 | train |
ipfs/py-ipfs-api | ipfsapi/multipart.py | BodyGenerator._write_headers | def _write_headers(self, headers):
"""Yields the HTTP header text for some content.
Parameters
----------
headers : dict
The headers to yield
"""
if headers:
for name in sorted(headers.keys()):
yield name.encode("ascii")
... | python | def _write_headers(self, headers):
"""Yields the HTTP header text for some content.
Parameters
----------
headers : dict
The headers to yield
"""
if headers:
for name in sorted(headers.keys()):
yield name.encode("ascii")
... | [
"def",
"_write_headers",
"(",
"self",
",",
"headers",
")",
":",
"if",
"headers",
":",
"for",
"name",
"in",
"sorted",
"(",
"headers",
".",
"keys",
"(",
")",
")",
":",
"yield",
"name",
".",
"encode",
"(",
"\"ascii\"",
")",
"yield",
"b': '",
"yield",
"h... | Yields the HTTP header text for some content.
Parameters
----------
headers : dict
The headers to yield | [
"Yields",
"the",
"HTTP",
"header",
"text",
"for",
"some",
"content",
"."
] | 7574dad04877b45dbe4ad321dcfa9e880eb2d90c | https://github.com/ipfs/py-ipfs-api/blob/7574dad04877b45dbe4ad321dcfa9e880eb2d90c/ipfsapi/multipart.py#L141-L155 | train |
ipfs/py-ipfs-api | ipfsapi/multipart.py | BodyGenerator.file_open | def file_open(self, fn):
"""Yields the opening text of a file section in multipart HTTP.
Parameters
----------
fn : str
Filename for the file being opened and added to the HTTP body
"""
yield b'--'
yield self.boundary.encode()
yield CRLF
... | python | def file_open(self, fn):
"""Yields the opening text of a file section in multipart HTTP.
Parameters
----------
fn : str
Filename for the file being opened and added to the HTTP body
"""
yield b'--'
yield self.boundary.encode()
yield CRLF
... | [
"def",
"file_open",
"(",
"self",
",",
"fn",
")",
":",
"yield",
"b'--'",
"yield",
"self",
".",
"boundary",
".",
"encode",
"(",
")",
"yield",
"CRLF",
"headers",
"=",
"content_disposition",
"(",
"fn",
")",
"headers",
".",
"update",
"(",
"content_type",
"(",... | Yields the opening text of a file section in multipart HTTP.
Parameters
----------
fn : str
Filename for the file being opened and added to the HTTP body | [
"Yields",
"the",
"opening",
"text",
"of",
"a",
"file",
"section",
"in",
"multipart",
"HTTP",
"."
] | 7574dad04877b45dbe4ad321dcfa9e880eb2d90c | https://github.com/ipfs/py-ipfs-api/blob/7574dad04877b45dbe4ad321dcfa9e880eb2d90c/ipfsapi/multipart.py#L169-L183 | train |
ipfs/py-ipfs-api | ipfsapi/multipart.py | BufferedGenerator.file_chunks | def file_chunks(self, fp):
"""Yields chunks of a file.
Parameters
----------
fp : io.RawIOBase
The file to break into chunks
(must be an open file or have the ``readinto`` method)
"""
fsize = utils.file_size(fp)
offset = 0
if hasat... | python | def file_chunks(self, fp):
"""Yields chunks of a file.
Parameters
----------
fp : io.RawIOBase
The file to break into chunks
(must be an open file or have the ``readinto`` method)
"""
fsize = utils.file_size(fp)
offset = 0
if hasat... | [
"def",
"file_chunks",
"(",
"self",
",",
"fp",
")",
":",
"fsize",
"=",
"utils",
".",
"file_size",
"(",
"fp",
")",
"offset",
"=",
"0",
"if",
"hasattr",
"(",
"fp",
",",
"'readinto'",
")",
":",
"while",
"offset",
"<",
"fsize",
":",
"nb",
"=",
"fp",
"... | Yields chunks of a file.
Parameters
----------
fp : io.RawIOBase
The file to break into chunks
(must be an open file or have the ``readinto`` method) | [
"Yields",
"chunks",
"of",
"a",
"file",
"."
] | 7574dad04877b45dbe4ad321dcfa9e880eb2d90c | https://github.com/ipfs/py-ipfs-api/blob/7574dad04877b45dbe4ad321dcfa9e880eb2d90c/ipfsapi/multipart.py#L222-L242 | train |
ipfs/py-ipfs-api | ipfsapi/multipart.py | BufferedGenerator.gen_chunks | def gen_chunks(self, gen):
"""Generates byte chunks of a given size.
Takes a bytes generator and yields chunks of a maximum of
``chunk_size`` bytes.
Parameters
----------
gen : generator
The bytes generator that produces the bytes
"""
for dat... | python | def gen_chunks(self, gen):
"""Generates byte chunks of a given size.
Takes a bytes generator and yields chunks of a maximum of
``chunk_size`` bytes.
Parameters
----------
gen : generator
The bytes generator that produces the bytes
"""
for dat... | [
"def",
"gen_chunks",
"(",
"self",
",",
"gen",
")",
":",
"for",
"data",
"in",
"gen",
":",
"size",
"=",
"len",
"(",
"data",
")",
"if",
"size",
"<",
"self",
".",
"chunk_size",
":",
"yield",
"data",
"else",
":",
"mv",
"=",
"buffer",
"(",
"data",
")",... | Generates byte chunks of a given size.
Takes a bytes generator and yields chunks of a maximum of
``chunk_size`` bytes.
Parameters
----------
gen : generator
The bytes generator that produces the bytes | [
"Generates",
"byte",
"chunks",
"of",
"a",
"given",
"size",
"."
] | 7574dad04877b45dbe4ad321dcfa9e880eb2d90c | https://github.com/ipfs/py-ipfs-api/blob/7574dad04877b45dbe4ad321dcfa9e880eb2d90c/ipfsapi/multipart.py#L244-L265 | train |
ipfs/py-ipfs-api | ipfsapi/multipart.py | FileStream.body | def body(self):
"""Yields the body of the buffered file."""
for fp, need_close in self.files:
try:
name = os.path.basename(fp.name)
except AttributeError:
name = ''
for chunk in self.gen_chunks(self.envelope.file_open(name)):
... | python | def body(self):
"""Yields the body of the buffered file."""
for fp, need_close in self.files:
try:
name = os.path.basename(fp.name)
except AttributeError:
name = ''
for chunk in self.gen_chunks(self.envelope.file_open(name)):
... | [
"def",
"body",
"(",
"self",
")",
":",
"for",
"fp",
",",
"need_close",
"in",
"self",
".",
"files",
":",
"try",
":",
"name",
"=",
"os",
".",
"path",
".",
"basename",
"(",
"fp",
".",
"name",
")",
"except",
"AttributeError",
":",
"name",
"=",
"''",
"... | Yields the body of the buffered file. | [
"Yields",
"the",
"body",
"of",
"the",
"buffered",
"file",
"."
] | 7574dad04877b45dbe4ad321dcfa9e880eb2d90c | https://github.com/ipfs/py-ipfs-api/blob/7574dad04877b45dbe4ad321dcfa9e880eb2d90c/ipfsapi/multipart.py#L300-L316 | train |
ipfs/py-ipfs-api | ipfsapi/multipart.py | DirectoryStream._prepare | def _prepare(self):
"""Pre-formats the multipart HTTP request to transmit the directory."""
names = []
added_directories = set()
def add_directory(short_path):
# Do not continue if this directory has already been added
if short_path in added_directories:
... | python | def _prepare(self):
"""Pre-formats the multipart HTTP request to transmit the directory."""
names = []
added_directories = set()
def add_directory(short_path):
# Do not continue if this directory has already been added
if short_path in added_directories:
... | [
"def",
"_prepare",
"(",
"self",
")",
":",
"names",
"=",
"[",
"]",
"added_directories",
"=",
"set",
"(",
")",
"def",
"add_directory",
"(",
"short_path",
")",
":",
"if",
"short_path",
"in",
"added_directories",
":",
"return",
"dir_base",
"=",
"short_path",
"... | Pre-formats the multipart HTTP request to transmit the directory. | [
"Pre",
"-",
"formats",
"the",
"multipart",
"HTTP",
"request",
"to",
"transmit",
"the",
"directory",
"."
] | 7574dad04877b45dbe4ad321dcfa9e880eb2d90c | https://github.com/ipfs/py-ipfs-api/blob/7574dad04877b45dbe4ad321dcfa9e880eb2d90c/ipfsapi/multipart.py#L415-L528 | train |
ipfs/py-ipfs-api | ipfsapi/multipart.py | BytesStream.body | def body(self):
"""Yields the encoded body."""
for chunk in self.gen_chunks(self.envelope.file_open(self.name)):
yield chunk
for chunk in self.gen_chunks(self.data):
yield chunk
for chunk in self.gen_chunks(self.envelope.file_close()):
yield chunk
... | python | def body(self):
"""Yields the encoded body."""
for chunk in self.gen_chunks(self.envelope.file_open(self.name)):
yield chunk
for chunk in self.gen_chunks(self.data):
yield chunk
for chunk in self.gen_chunks(self.envelope.file_close()):
yield chunk
... | [
"def",
"body",
"(",
"self",
")",
":",
"for",
"chunk",
"in",
"self",
".",
"gen_chunks",
"(",
"self",
".",
"envelope",
".",
"file_open",
"(",
"self",
".",
"name",
")",
")",
":",
"yield",
"chunk",
"for",
"chunk",
"in",
"self",
".",
"gen_chunks",
"(",
... | Yields the encoded body. | [
"Yields",
"the",
"encoded",
"body",
"."
] | 7574dad04877b45dbe4ad321dcfa9e880eb2d90c | https://github.com/ipfs/py-ipfs-api/blob/7574dad04877b45dbe4ad321dcfa9e880eb2d90c/ipfsapi/multipart.py#L548-L557 | train |
ipfs/py-ipfs-api | ipfsapi/http.py | pass_defaults | def pass_defaults(func):
"""Decorator that returns a function named wrapper.
When invoked, wrapper invokes func with default kwargs appended.
Parameters
----------
func : callable
The function to append the default kwargs to
"""
@functools.wraps(func)
def wrapper(self, *args, *... | python | def pass_defaults(func):
"""Decorator that returns a function named wrapper.
When invoked, wrapper invokes func with default kwargs appended.
Parameters
----------
func : callable
The function to append the default kwargs to
"""
@functools.wraps(func)
def wrapper(self, *args, *... | [
"def",
"pass_defaults",
"(",
"func",
")",
":",
"@",
"functools",
".",
"wraps",
"(",
"func",
")",
"def",
"wrapper",
"(",
"self",
",",
"*",
"args",
",",
"**",
"kwargs",
")",
":",
"merged",
"=",
"{",
"}",
"merged",
".",
"update",
"(",
"self",
".",
"... | Decorator that returns a function named wrapper.
When invoked, wrapper invokes func with default kwargs appended.
Parameters
----------
func : callable
The function to append the default kwargs to | [
"Decorator",
"that",
"returns",
"a",
"function",
"named",
"wrapper",
"."
] | 7574dad04877b45dbe4ad321dcfa9e880eb2d90c | https://github.com/ipfs/py-ipfs-api/blob/7574dad04877b45dbe4ad321dcfa9e880eb2d90c/ipfsapi/http.py#L23-L39 | train |
ipfs/py-ipfs-api | ipfsapi/http.py | HTTPClient.request | def request(self, path,
args=[], files=[], opts={}, stream=False,
decoder=None, headers={}, data=None):
"""Makes an HTTP request to the IPFS daemon.
This function returns the contents of the HTTP response from the IPFS
daemon.
Raises
------
... | python | def request(self, path,
args=[], files=[], opts={}, stream=False,
decoder=None, headers={}, data=None):
"""Makes an HTTP request to the IPFS daemon.
This function returns the contents of the HTTP response from the IPFS
daemon.
Raises
------
... | [
"def",
"request",
"(",
"self",
",",
"path",
",",
"args",
"=",
"[",
"]",
",",
"files",
"=",
"[",
"]",
",",
"opts",
"=",
"{",
"}",
",",
"stream",
"=",
"False",
",",
"decoder",
"=",
"None",
",",
"headers",
"=",
"{",
"}",
",",
"data",
"=",
"None"... | Makes an HTTP request to the IPFS daemon.
This function returns the contents of the HTTP response from the IPFS
daemon.
Raises
------
~ipfsapi.exceptions.ErrorResponse
~ipfsapi.exceptions.ConnectionError
~ipfsapi.exceptions.ProtocolError
~ipfsapi.excepti... | [
"Makes",
"an",
"HTTP",
"request",
"to",
"the",
"IPFS",
"daemon",
"."
] | 7574dad04877b45dbe4ad321dcfa9e880eb2d90c | https://github.com/ipfs/py-ipfs-api/blob/7574dad04877b45dbe4ad321dcfa9e880eb2d90c/ipfsapi/http.py#L202-L247 | train |
ipfs/py-ipfs-api | ipfsapi/http.py | HTTPClient.download | def download(self, path, args=[], filepath=None, opts={},
compress=True, **kwargs):
"""Makes a request to the IPFS daemon to download a file.
Downloads a file or files from IPFS into the current working
directory, or the directory given by ``filepath``.
Raises
... | python | def download(self, path, args=[], filepath=None, opts={},
compress=True, **kwargs):
"""Makes a request to the IPFS daemon to download a file.
Downloads a file or files from IPFS into the current working
directory, or the directory given by ``filepath``.
Raises
... | [
"def",
"download",
"(",
"self",
",",
"path",
",",
"args",
"=",
"[",
"]",
",",
"filepath",
"=",
"None",
",",
"opts",
"=",
"{",
"}",
",",
"compress",
"=",
"True",
",",
"**",
"kwargs",
")",
":",
"url",
"=",
"self",
".",
"base",
"+",
"path",
"wd",
... | Makes a request to the IPFS daemon to download a file.
Downloads a file or files from IPFS into the current working
directory, or the directory given by ``filepath``.
Raises
------
~ipfsapi.exceptions.ErrorResponse
~ipfsapi.exceptions.ConnectionError
~ipfsapi.ex... | [
"Makes",
"a",
"request",
"to",
"the",
"IPFS",
"daemon",
"to",
"download",
"a",
"file",
"."
] | 7574dad04877b45dbe4ad321dcfa9e880eb2d90c | https://github.com/ipfs/py-ipfs-api/blob/7574dad04877b45dbe4ad321dcfa9e880eb2d90c/ipfsapi/http.py#L250-L308 | train |
ipfs/py-ipfs-api | ipfsapi/http.py | HTTPClient.session | def session(self):
"""A context manager for this client's session.
This function closes the current session when this client goes out of
scope.
"""
self._session = requests.session()
yield
self._session.close()
self._session = None | python | def session(self):
"""A context manager for this client's session.
This function closes the current session when this client goes out of
scope.
"""
self._session = requests.session()
yield
self._session.close()
self._session = None | [
"def",
"session",
"(",
"self",
")",
":",
"self",
".",
"_session",
"=",
"requests",
".",
"session",
"(",
")",
"yield",
"self",
".",
"_session",
".",
"close",
"(",
")",
"self",
".",
"_session",
"=",
"None"
] | A context manager for this client's session.
This function closes the current session when this client goes out of
scope. | [
"A",
"context",
"manager",
"for",
"this",
"client",
"s",
"session",
"."
] | 7574dad04877b45dbe4ad321dcfa9e880eb2d90c | https://github.com/ipfs/py-ipfs-api/blob/7574dad04877b45dbe4ad321dcfa9e880eb2d90c/ipfsapi/http.py#L311-L320 | train |
ipfs/py-ipfs-api | ipfsapi/client.py | assert_version | def assert_version(version, minimum=VERSION_MINIMUM, maximum=VERSION_MAXIMUM):
"""Make sure that the given daemon version is supported by this client
version.
Raises
------
~ipfsapi.exceptions.VersionMismatch
Parameters
----------
version : str
The version of an IPFS daemon.
... | python | def assert_version(version, minimum=VERSION_MINIMUM, maximum=VERSION_MAXIMUM):
"""Make sure that the given daemon version is supported by this client
version.
Raises
------
~ipfsapi.exceptions.VersionMismatch
Parameters
----------
version : str
The version of an IPFS daemon.
... | [
"def",
"assert_version",
"(",
"version",
",",
"minimum",
"=",
"VERSION_MINIMUM",
",",
"maximum",
"=",
"VERSION_MAXIMUM",
")",
":",
"version",
"=",
"list",
"(",
"map",
"(",
"int",
",",
"version",
".",
"split",
"(",
"'-'",
",",
"1",
")",
"[",
"0",
"]",
... | Make sure that the given daemon version is supported by this client
version.
Raises
------
~ipfsapi.exceptions.VersionMismatch
Parameters
----------
version : str
The version of an IPFS daemon.
minimum : str
The minimal IPFS version to allow.
maximum : str
T... | [
"Make",
"sure",
"that",
"the",
"given",
"daemon",
"version",
"is",
"supported",
"by",
"this",
"client",
"version",
"."
] | 7574dad04877b45dbe4ad321dcfa9e880eb2d90c | https://github.com/ipfs/py-ipfs-api/blob/7574dad04877b45dbe4ad321dcfa9e880eb2d90c/ipfsapi/client.py#L23-L46 | train |
ipfs/py-ipfs-api | ipfsapi/client.py | Client.add | def add(self, files, recursive=False, pattern='**', *args, **kwargs):
"""Add a file, or directory of files to IPFS.
.. code-block:: python
>>> with io.open('nurseryrhyme.txt', 'w', encoding='utf-8') as f:
... numbytes = f.write('Mary had a little lamb')
>>> c.ad... | python | def add(self, files, recursive=False, pattern='**', *args, **kwargs):
"""Add a file, or directory of files to IPFS.
.. code-block:: python
>>> with io.open('nurseryrhyme.txt', 'w', encoding='utf-8') as f:
... numbytes = f.write('Mary had a little lamb')
>>> c.ad... | [
"def",
"add",
"(",
"self",
",",
"files",
",",
"recursive",
"=",
"False",
",",
"pattern",
"=",
"'**'",
",",
"*",
"args",
",",
"**",
"kwargs",
")",
":",
"opts",
"=",
"{",
"\"trickle\"",
":",
"kwargs",
".",
"pop",
"(",
"\"trickle\"",
",",
"False",
")"... | Add a file, or directory of files to IPFS.
.. code-block:: python
>>> with io.open('nurseryrhyme.txt', 'w', encoding='utf-8') as f:
... numbytes = f.write('Mary had a little lamb')
>>> c.add('nurseryrhyme.txt')
{'Hash': 'QmZfF6C9j4VtoCsTp4KSrhYH47QMd3DNXVZBK... | [
"Add",
"a",
"file",
"or",
"directory",
"of",
"files",
"to",
"IPFS",
"."
] | 7574dad04877b45dbe4ad321dcfa9e880eb2d90c | https://github.com/ipfs/py-ipfs-api/blob/7574dad04877b45dbe4ad321dcfa9e880eb2d90c/ipfsapi/client.py#L135-L189 | train |
ipfs/py-ipfs-api | ipfsapi/client.py | Client.get | def get(self, multihash, **kwargs):
"""Downloads a file, or directory of files from IPFS.
Files are placed in the current working directory.
Parameters
----------
multihash : str
The path to the IPFS object(s) to be outputted
"""
args = (multihash,)
... | python | def get(self, multihash, **kwargs):
"""Downloads a file, or directory of files from IPFS.
Files are placed in the current working directory.
Parameters
----------
multihash : str
The path to the IPFS object(s) to be outputted
"""
args = (multihash,)
... | [
"def",
"get",
"(",
"self",
",",
"multihash",
",",
"**",
"kwargs",
")",
":",
"args",
"=",
"(",
"multihash",
",",
")",
"return",
"self",
".",
"_client",
".",
"download",
"(",
"'/get'",
",",
"args",
",",
"**",
"kwargs",
")"
] | Downloads a file, or directory of files from IPFS.
Files are placed in the current working directory.
Parameters
----------
multihash : str
The path to the IPFS object(s) to be outputted | [
"Downloads",
"a",
"file",
"or",
"directory",
"of",
"files",
"from",
"IPFS",
"."
] | 7574dad04877b45dbe4ad321dcfa9e880eb2d90c | https://github.com/ipfs/py-ipfs-api/blob/7574dad04877b45dbe4ad321dcfa9e880eb2d90c/ipfsapi/client.py#L191-L202 | train |
ipfs/py-ipfs-api | ipfsapi/client.py | Client.cat | def cat(self, multihash, offset=0, length=-1, **kwargs):
r"""Retrieves the contents of a file identified by hash.
.. code-block:: python
>>> c.cat('QmTkzDwWqPbnAh5YiV5VwcTLnGdwSNsNTn2aDxdXBFca7D')
Traceback (most recent call last):
...
ipfsapi.exceptio... | python | def cat(self, multihash, offset=0, length=-1, **kwargs):
r"""Retrieves the contents of a file identified by hash.
.. code-block:: python
>>> c.cat('QmTkzDwWqPbnAh5YiV5VwcTLnGdwSNsNTn2aDxdXBFca7D')
Traceback (most recent call last):
...
ipfsapi.exceptio... | [
"def",
"cat",
"(",
"self",
",",
"multihash",
",",
"offset",
"=",
"0",
",",
"length",
"=",
"-",
"1",
",",
"**",
"kwargs",
")",
":",
"r",
"opts",
"=",
"{",
"}",
"if",
"offset",
"!=",
"0",
":",
"opts",
"[",
"'offset'",
"]",
"=",
"offset",
"if",
... | r"""Retrieves the contents of a file identified by hash.
.. code-block:: python
>>> c.cat('QmTkzDwWqPbnAh5YiV5VwcTLnGdwSNsNTn2aDxdXBFca7D')
Traceback (most recent call last):
...
ipfsapi.exceptions.Error: this dag node is a directory
>>> c.cat('Qme... | [
"r",
"Retrieves",
"the",
"contents",
"of",
"a",
"file",
"identified",
"by",
"hash",
"."
] | 7574dad04877b45dbe4ad321dcfa9e880eb2d90c | https://github.com/ipfs/py-ipfs-api/blob/7574dad04877b45dbe4ad321dcfa9e880eb2d90c/ipfsapi/client.py#L204-L235 | train |
ipfs/py-ipfs-api | ipfsapi/client.py | Client.ls | def ls(self, multihash, **kwargs):
"""Returns a list of objects linked to by the given hash.
.. code-block:: python
>>> c.ls('QmTkzDwWqPbnAh5YiV5VwcTLnGdwSNsNTn2aDxdXBFca7D')
{'Objects': [
{'Hash': 'QmTkzDwWqPbnAh5YiV5VwcTLnGdwSNsNTn2aDxdXBFca7D',
'... | python | def ls(self, multihash, **kwargs):
"""Returns a list of objects linked to by the given hash.
.. code-block:: python
>>> c.ls('QmTkzDwWqPbnAh5YiV5VwcTLnGdwSNsNTn2aDxdXBFca7D')
{'Objects': [
{'Hash': 'QmTkzDwWqPbnAh5YiV5VwcTLnGdwSNsNTn2aDxdXBFca7D',
'... | [
"def",
"ls",
"(",
"self",
",",
"multihash",
",",
"**",
"kwargs",
")",
":",
"args",
"=",
"(",
"multihash",
",",
")",
"return",
"self",
".",
"_client",
".",
"request",
"(",
"'/ls'",
",",
"args",
",",
"decoder",
"=",
"'json'",
",",
"**",
"kwargs",
")"... | Returns a list of objects linked to by the given hash.
.. code-block:: python
>>> c.ls('QmTkzDwWqPbnAh5YiV5VwcTLnGdwSNsNTn2aDxdXBFca7D')
{'Objects': [
{'Hash': 'QmTkzDwWqPbnAh5YiV5VwcTLnGdwSNsNTn2aDxdXBFca7D',
'Links': [
{'Hash': 'Qmd2xkBfEw... | [
"Returns",
"a",
"list",
"of",
"objects",
"linked",
"to",
"by",
"the",
"given",
"hash",
"."
] | 7574dad04877b45dbe4ad321dcfa9e880eb2d90c | https://github.com/ipfs/py-ipfs-api/blob/7574dad04877b45dbe4ad321dcfa9e880eb2d90c/ipfsapi/client.py#L237-L264 | train |
ipfs/py-ipfs-api | ipfsapi/client.py | Client.refs | def refs(self, multihash, **kwargs):
"""Returns a list of hashes of objects referenced by the given hash.
.. code-block:: python
>>> c.refs('QmTkzDwWqPbnAh5YiV5VwcTLnGdwSNsNTn2aDxdXBFca7D')
[{'Ref': 'Qmd2xkBfEwEs9oMTk77A6jrsgurpF3ugXSg7 … cNMV', 'Err': ''},
…
... | python | def refs(self, multihash, **kwargs):
"""Returns a list of hashes of objects referenced by the given hash.
.. code-block:: python
>>> c.refs('QmTkzDwWqPbnAh5YiV5VwcTLnGdwSNsNTn2aDxdXBFca7D')
[{'Ref': 'Qmd2xkBfEwEs9oMTk77A6jrsgurpF3ugXSg7 … cNMV', 'Err': ''},
…
... | [
"def",
"refs",
"(",
"self",
",",
"multihash",
",",
"**",
"kwargs",
")",
":",
"args",
"=",
"(",
"multihash",
",",
")",
"return",
"self",
".",
"_client",
".",
"request",
"(",
"'/refs'",
",",
"args",
",",
"decoder",
"=",
"'json'",
",",
"**",
"kwargs",
... | Returns a list of hashes of objects referenced by the given hash.
.. code-block:: python
>>> c.refs('QmTkzDwWqPbnAh5YiV5VwcTLnGdwSNsNTn2aDxdXBFca7D')
[{'Ref': 'Qmd2xkBfEwEs9oMTk77A6jrsgurpF3ugXSg7 … cNMV', 'Err': ''},
…
{'Ref': 'QmSY8RfVntt3VdxWppv9w5hWgNrE31u... | [
"Returns",
"a",
"list",
"of",
"hashes",
"of",
"objects",
"referenced",
"by",
"the",
"given",
"hash",
"."
] | 7574dad04877b45dbe4ad321dcfa9e880eb2d90c | https://github.com/ipfs/py-ipfs-api/blob/7574dad04877b45dbe4ad321dcfa9e880eb2d90c/ipfsapi/client.py#L266-L286 | train |
ipfs/py-ipfs-api | ipfsapi/client.py | Client.block_stat | def block_stat(self, multihash, **kwargs):
"""Returns a dict with the size of the block with the given hash.
.. code-block:: python
>>> c.block_stat('QmTkzDwWqPbnAh5YiV5VwcTLnGdwSNsNTn2aDxdXBFca7D')
{'Key': 'QmTkzDwWqPbnAh5YiV5VwcTLnGdwSNsNTn2aDxdXBFca7D',
'Size':... | python | def block_stat(self, multihash, **kwargs):
"""Returns a dict with the size of the block with the given hash.
.. code-block:: python
>>> c.block_stat('QmTkzDwWqPbnAh5YiV5VwcTLnGdwSNsNTn2aDxdXBFca7D')
{'Key': 'QmTkzDwWqPbnAh5YiV5VwcTLnGdwSNsNTn2aDxdXBFca7D',
'Size':... | [
"def",
"block_stat",
"(",
"self",
",",
"multihash",
",",
"**",
"kwargs",
")",
":",
"args",
"=",
"(",
"multihash",
",",
")",
"return",
"self",
".",
"_client",
".",
"request",
"(",
"'/block/stat'",
",",
"args",
",",
"decoder",
"=",
"'json'",
",",
"**",
... | Returns a dict with the size of the block with the given hash.
.. code-block:: python
>>> c.block_stat('QmTkzDwWqPbnAh5YiV5VwcTLnGdwSNsNTn2aDxdXBFca7D')
{'Key': 'QmTkzDwWqPbnAh5YiV5VwcTLnGdwSNsNTn2aDxdXBFca7D',
'Size': 258}
Parameters
----------
m... | [
"Returns",
"a",
"dict",
"with",
"the",
"size",
"of",
"the",
"block",
"with",
"the",
"given",
"hash",
"."
] | 7574dad04877b45dbe4ad321dcfa9e880eb2d90c | https://github.com/ipfs/py-ipfs-api/blob/7574dad04877b45dbe4ad321dcfa9e880eb2d90c/ipfsapi/client.py#L304-L324 | train |
ipfs/py-ipfs-api | ipfsapi/client.py | Client.block_get | def block_get(self, multihash, **kwargs):
r"""Returns the raw contents of a block.
.. code-block:: python
>>> c.block_get('QmTkzDwWqPbnAh5YiV5VwcTLnGdwSNsNTn2aDxdXBFca7D')
b'\x121\n"\x12 \xdaW>\x14\xe5\xc1\xf6\xe4\x92\xd1 … \n\x02\x08\x01'
Parameters
----------... | python | def block_get(self, multihash, **kwargs):
r"""Returns the raw contents of a block.
.. code-block:: python
>>> c.block_get('QmTkzDwWqPbnAh5YiV5VwcTLnGdwSNsNTn2aDxdXBFca7D')
b'\x121\n"\x12 \xdaW>\x14\xe5\xc1\xf6\xe4\x92\xd1 … \n\x02\x08\x01'
Parameters
----------... | [
"def",
"block_get",
"(",
"self",
",",
"multihash",
",",
"**",
"kwargs",
")",
":",
"r",
"args",
"=",
"(",
"multihash",
",",
")",
"return",
"self",
".",
"_client",
".",
"request",
"(",
"'/block/get'",
",",
"args",
",",
"**",
"kwargs",
")"
] | r"""Returns the raw contents of a block.
.. code-block:: python
>>> c.block_get('QmTkzDwWqPbnAh5YiV5VwcTLnGdwSNsNTn2aDxdXBFca7D')
b'\x121\n"\x12 \xdaW>\x14\xe5\xc1\xf6\xe4\x92\xd1 … \n\x02\x08\x01'
Parameters
----------
multihash : str
The base58 mu... | [
"r",
"Returns",
"the",
"raw",
"contents",
"of",
"a",
"block",
"."
] | 7574dad04877b45dbe4ad321dcfa9e880eb2d90c | https://github.com/ipfs/py-ipfs-api/blob/7574dad04877b45dbe4ad321dcfa9e880eb2d90c/ipfsapi/client.py#L326-L344 | train |
ipfs/py-ipfs-api | ipfsapi/client.py | Client.bitswap_wantlist | def bitswap_wantlist(self, peer=None, **kwargs):
"""Returns blocks currently on the bitswap wantlist.
.. code-block:: python
>>> c.bitswap_wantlist()
{'Keys': [
'QmeV6C6XVt1wf7V7as7Yak3mxPma8jzpqyhtRtCvpKcfBb',
'QmdCWFLDXqgdWQY9kVubbEHBbkieKd3uo7... | python | def bitswap_wantlist(self, peer=None, **kwargs):
"""Returns blocks currently on the bitswap wantlist.
.. code-block:: python
>>> c.bitswap_wantlist()
{'Keys': [
'QmeV6C6XVt1wf7V7as7Yak3mxPma8jzpqyhtRtCvpKcfBb',
'QmdCWFLDXqgdWQY9kVubbEHBbkieKd3uo7... | [
"def",
"bitswap_wantlist",
"(",
"self",
",",
"peer",
"=",
"None",
",",
"**",
"kwargs",
")",
":",
"args",
"=",
"(",
"peer",
",",
")",
"return",
"self",
".",
"_client",
".",
"request",
"(",
"'/bitswap/wantlist'",
",",
"args",
",",
"decoder",
"=",
"'json'... | Returns blocks currently on the bitswap wantlist.
.. code-block:: python
>>> c.bitswap_wantlist()
{'Keys': [
'QmeV6C6XVt1wf7V7as7Yak3mxPma8jzpqyhtRtCvpKcfBb',
'QmdCWFLDXqgdWQY9kVubbEHBbkieKd3uo7MtCm7nTZZE9K',
'QmVQ1XvYGF19X4eJqz1s7FJYJqAx... | [
"Returns",
"blocks",
"currently",
"on",
"the",
"bitswap",
"wantlist",
"."
] | 7574dad04877b45dbe4ad321dcfa9e880eb2d90c | https://github.com/ipfs/py-ipfs-api/blob/7574dad04877b45dbe4ad321dcfa9e880eb2d90c/ipfsapi/client.py#L370-L393 | train |
ipfs/py-ipfs-api | ipfsapi/client.py | Client.bitswap_unwant | def bitswap_unwant(self, key, **kwargs):
"""
Remove a given block from wantlist.
Parameters
----------
key : str
Key to remove from wantlist.
"""
args = (key,)
return self._client.request('/bitswap/unwant', args, **kwargs) | python | def bitswap_unwant(self, key, **kwargs):
"""
Remove a given block from wantlist.
Parameters
----------
key : str
Key to remove from wantlist.
"""
args = (key,)
return self._client.request('/bitswap/unwant', args, **kwargs) | [
"def",
"bitswap_unwant",
"(",
"self",
",",
"key",
",",
"**",
"kwargs",
")",
":",
"args",
"=",
"(",
"key",
",",
")",
"return",
"self",
".",
"_client",
".",
"request",
"(",
"'/bitswap/unwant'",
",",
"args",
",",
"**",
"kwargs",
")"
] | Remove a given block from wantlist.
Parameters
----------
key : str
Key to remove from wantlist. | [
"Remove",
"a",
"given",
"block",
"from",
"wantlist",
"."
] | 7574dad04877b45dbe4ad321dcfa9e880eb2d90c | https://github.com/ipfs/py-ipfs-api/blob/7574dad04877b45dbe4ad321dcfa9e880eb2d90c/ipfsapi/client.py#L424-L434 | train |
ipfs/py-ipfs-api | ipfsapi/client.py | Client.object_data | def object_data(self, multihash, **kwargs):
r"""Returns the raw bytes in an IPFS object.
.. code-block:: python
>>> c.object_data('QmTkzDwWqPbnAh5YiV5VwcTLnGdwSNsNTn2aDxdXBFca7D')
b'\x08\x01'
Parameters
----------
multihash : str
Key of the ... | python | def object_data(self, multihash, **kwargs):
r"""Returns the raw bytes in an IPFS object.
.. code-block:: python
>>> c.object_data('QmTkzDwWqPbnAh5YiV5VwcTLnGdwSNsNTn2aDxdXBFca7D')
b'\x08\x01'
Parameters
----------
multihash : str
Key of the ... | [
"def",
"object_data",
"(",
"self",
",",
"multihash",
",",
"**",
"kwargs",
")",
":",
"r",
"args",
"=",
"(",
"multihash",
",",
")",
"return",
"self",
".",
"_client",
".",
"request",
"(",
"'/object/data'",
",",
"args",
",",
"**",
"kwargs",
")"
] | r"""Returns the raw bytes in an IPFS object.
.. code-block:: python
>>> c.object_data('QmTkzDwWqPbnAh5YiV5VwcTLnGdwSNsNTn2aDxdXBFca7D')
b'\x08\x01'
Parameters
----------
multihash : str
Key of the object to retrieve, in base58-encoded multihash form... | [
"r",
"Returns",
"the",
"raw",
"bytes",
"in",
"an",
"IPFS",
"object",
"."
] | 7574dad04877b45dbe4ad321dcfa9e880eb2d90c | https://github.com/ipfs/py-ipfs-api/blob/7574dad04877b45dbe4ad321dcfa9e880eb2d90c/ipfsapi/client.py#L436-L454 | train |
ipfs/py-ipfs-api | ipfsapi/client.py | Client.object_new | def object_new(self, template=None, **kwargs):
"""Creates a new object from an IPFS template.
By default this creates and returns a new empty merkledag node, but you
may pass an optional template argument to create a preformatted node.
.. code-block:: python
>>> c.object_n... | python | def object_new(self, template=None, **kwargs):
"""Creates a new object from an IPFS template.
By default this creates and returns a new empty merkledag node, but you
may pass an optional template argument to create a preformatted node.
.. code-block:: python
>>> c.object_n... | [
"def",
"object_new",
"(",
"self",
",",
"template",
"=",
"None",
",",
"**",
"kwargs",
")",
":",
"args",
"=",
"(",
"template",
",",
")",
"if",
"template",
"is",
"not",
"None",
"else",
"(",
")",
"return",
"self",
".",
"_client",
".",
"request",
"(",
"... | Creates a new object from an IPFS template.
By default this creates and returns a new empty merkledag node, but you
may pass an optional template argument to create a preformatted node.
.. code-block:: python
>>> c.object_new()
{'Hash': 'QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqF... | [
"Creates",
"a",
"new",
"object",
"from",
"an",
"IPFS",
"template",
"."
] | 7574dad04877b45dbe4ad321dcfa9e880eb2d90c | https://github.com/ipfs/py-ipfs-api/blob/7574dad04877b45dbe4ad321dcfa9e880eb2d90c/ipfsapi/client.py#L456-L481 | train |
ipfs/py-ipfs-api | ipfsapi/client.py | Client.object_links | def object_links(self, multihash, **kwargs):
"""Returns the links pointed to by the specified object.
.. code-block:: python
>>> c.object_links('QmTkzDwWqPbnAh5YiV5VwcTLnGdwSNsNTn2aDx … ca7D')
{'Hash': 'QmTkzDwWqPbnAh5YiV5VwcTLnGdwSNsNTn2aDxdXBFca7D',
'Links': [
... | python | def object_links(self, multihash, **kwargs):
"""Returns the links pointed to by the specified object.
.. code-block:: python
>>> c.object_links('QmTkzDwWqPbnAh5YiV5VwcTLnGdwSNsNTn2aDx … ca7D')
{'Hash': 'QmTkzDwWqPbnAh5YiV5VwcTLnGdwSNsNTn2aDxdXBFca7D',
'Links': [
... | [
"def",
"object_links",
"(",
"self",
",",
"multihash",
",",
"**",
"kwargs",
")",
":",
"args",
"=",
"(",
"multihash",
",",
")",
"return",
"self",
".",
"_client",
".",
"request",
"(",
"'/object/links'",
",",
"args",
",",
"decoder",
"=",
"'json'",
",",
"**... | Returns the links pointed to by the specified object.
.. code-block:: python
>>> c.object_links('QmTkzDwWqPbnAh5YiV5VwcTLnGdwSNsNTn2aDx … ca7D')
{'Hash': 'QmTkzDwWqPbnAh5YiV5VwcTLnGdwSNsNTn2aDxdXBFca7D',
'Links': [
{'Hash': 'Qmd2xkBfEwEs9oMTk77A6jrsgurpF3ug... | [
"Returns",
"the",
"links",
"pointed",
"to",
"by",
"the",
"specified",
"object",
"."
] | 7574dad04877b45dbe4ad321dcfa9e880eb2d90c | https://github.com/ipfs/py-ipfs-api/blob/7574dad04877b45dbe4ad321dcfa9e880eb2d90c/ipfsapi/client.py#L483-L513 | train |
ipfs/py-ipfs-api | ipfsapi/client.py | Client.object_get | def object_get(self, multihash, **kwargs):
"""Get and serialize the DAG node named by multihash.
.. code-block:: python
>>> c.object_get('QmTkzDwWqPbnAh5YiV5VwcTLnGdwSNsNTn2aDxdXBFca7D')
{'Data': '\x08\x01',
'Links': [
{'Hash': 'Qmd2xkBfEwEs9oMTk77A... | python | def object_get(self, multihash, **kwargs):
"""Get and serialize the DAG node named by multihash.
.. code-block:: python
>>> c.object_get('QmTkzDwWqPbnAh5YiV5VwcTLnGdwSNsNTn2aDxdXBFca7D')
{'Data': '\x08\x01',
'Links': [
{'Hash': 'Qmd2xkBfEwEs9oMTk77A... | [
"def",
"object_get",
"(",
"self",
",",
"multihash",
",",
"**",
"kwargs",
")",
":",
"args",
"=",
"(",
"multihash",
",",
")",
"return",
"self",
".",
"_client",
".",
"request",
"(",
"'/object/get'",
",",
"args",
",",
"decoder",
"=",
"'json'",
",",
"**",
... | Get and serialize the DAG node named by multihash.
.. code-block:: python
>>> c.object_get('QmTkzDwWqPbnAh5YiV5VwcTLnGdwSNsNTn2aDxdXBFca7D')
{'Data': '\x08\x01',
'Links': [
{'Hash': 'Qmd2xkBfEwEs9oMTk77A6jrsgurpF3ugXSg7dtPNFkcNMV',
'Name': ... | [
"Get",
"and",
"serialize",
"the",
"DAG",
"node",
"named",
"by",
"multihash",
"."
] | 7574dad04877b45dbe4ad321dcfa9e880eb2d90c | https://github.com/ipfs/py-ipfs-api/blob/7574dad04877b45dbe4ad321dcfa9e880eb2d90c/ipfsapi/client.py#L515-L545 | train |
ipfs/py-ipfs-api | ipfsapi/client.py | Client.object_put | def object_put(self, file, **kwargs):
"""Stores input as a DAG object and returns its key.
.. code-block:: python
>>> c.object_put(io.BytesIO(b'''
... {
... "Data": "another",
... "Links": [ {
... "Name... | python | def object_put(self, file, **kwargs):
"""Stores input as a DAG object and returns its key.
.. code-block:: python
>>> c.object_put(io.BytesIO(b'''
... {
... "Data": "another",
... "Links": [ {
... "Name... | [
"def",
"object_put",
"(",
"self",
",",
"file",
",",
"**",
"kwargs",
")",
":",
"body",
",",
"headers",
"=",
"multipart",
".",
"stream_files",
"(",
"file",
",",
"self",
".",
"chunk_size",
")",
"return",
"self",
".",
"_client",
".",
"request",
"(",
"'/obj... | Stores input as a DAG object and returns its key.
.. code-block:: python
>>> c.object_put(io.BytesIO(b'''
... {
... "Data": "another",
... "Links": [ {
... "Name": "some link",
... "Ha... | [
"Stores",
"input",
"as",
"a",
"DAG",
"object",
"and",
"returns",
"its",
"key",
"."
] | 7574dad04877b45dbe4ad321dcfa9e880eb2d90c | https://github.com/ipfs/py-ipfs-api/blob/7574dad04877b45dbe4ad321dcfa9e880eb2d90c/ipfsapi/client.py#L547-L581 | train |
ipfs/py-ipfs-api | ipfsapi/client.py | Client.object_stat | def object_stat(self, multihash, **kwargs):
"""Get stats for the DAG node named by multihash.
.. code-block:: python
>>> c.object_stat('QmTkzDwWqPbnAh5YiV5VwcTLnGdwSNsNTn2aDxdXBFca7D')
{'LinksSize': 256, 'NumLinks': 5,
'Hash': 'QmTkzDwWqPbnAh5YiV5VwcTLnGdwSNsNTn2aD... | python | def object_stat(self, multihash, **kwargs):
"""Get stats for the DAG node named by multihash.
.. code-block:: python
>>> c.object_stat('QmTkzDwWqPbnAh5YiV5VwcTLnGdwSNsNTn2aDxdXBFca7D')
{'LinksSize': 256, 'NumLinks': 5,
'Hash': 'QmTkzDwWqPbnAh5YiV5VwcTLnGdwSNsNTn2aD... | [
"def",
"object_stat",
"(",
"self",
",",
"multihash",
",",
"**",
"kwargs",
")",
":",
"args",
"=",
"(",
"multihash",
",",
")",
"return",
"self",
".",
"_client",
".",
"request",
"(",
"'/object/stat'",
",",
"args",
",",
"decoder",
"=",
"'json'",
",",
"**",... | Get stats for the DAG node named by multihash.
.. code-block:: python
>>> c.object_stat('QmTkzDwWqPbnAh5YiV5VwcTLnGdwSNsNTn2aDxdXBFca7D')
{'LinksSize': 256, 'NumLinks': 5,
'Hash': 'QmTkzDwWqPbnAh5YiV5VwcTLnGdwSNsNTn2aDxdXBFca7D',
'BlockSize': 258, 'CumulativeS... | [
"Get",
"stats",
"for",
"the",
"DAG",
"node",
"named",
"by",
"multihash",
"."
] | 7574dad04877b45dbe4ad321dcfa9e880eb2d90c | https://github.com/ipfs/py-ipfs-api/blob/7574dad04877b45dbe4ad321dcfa9e880eb2d90c/ipfsapi/client.py#L583-L604 | train |
ipfs/py-ipfs-api | ipfsapi/client.py | Client.file_ls | def file_ls(self, multihash, **kwargs):
"""Lists directory contents for Unix filesystem objects.
The result contains size information. For files, the child size is the
total size of the file contents. For directories, the child size is the
IPFS link size.
The path can be a pref... | python | def file_ls(self, multihash, **kwargs):
"""Lists directory contents for Unix filesystem objects.
The result contains size information. For files, the child size is the
total size of the file contents. For directories, the child size is the
IPFS link size.
The path can be a pref... | [
"def",
"file_ls",
"(",
"self",
",",
"multihash",
",",
"**",
"kwargs",
")",
":",
"args",
"=",
"(",
"multihash",
",",
")",
"return",
"self",
".",
"_client",
".",
"request",
"(",
"'/file/ls'",
",",
"args",
",",
"decoder",
"=",
"'json'",
",",
"**",
"kwar... | Lists directory contents for Unix filesystem objects.
The result contains size information. For files, the child size is the
total size of the file contents. For directories, the child size is the
IPFS link size.
The path can be a prefixless reference; in this case, it is assumed
... | [
"Lists",
"directory",
"contents",
"for",
"Unix",
"filesystem",
"objects",
"."
] | 7574dad04877b45dbe4ad321dcfa9e880eb2d90c | https://github.com/ipfs/py-ipfs-api/blob/7574dad04877b45dbe4ad321dcfa9e880eb2d90c/ipfsapi/client.py#L728-L773 | train |
ipfs/py-ipfs-api | ipfsapi/client.py | Client.resolve | def resolve(self, name, recursive=False, **kwargs):
"""Accepts an identifier and resolves it to the referenced item.
There are a number of mutable name protocols that can link among
themselves and into IPNS. For example IPNS references can (currently)
point at an IPFS object, and DNS li... | python | def resolve(self, name, recursive=False, **kwargs):
"""Accepts an identifier and resolves it to the referenced item.
There are a number of mutable name protocols that can link among
themselves and into IPNS. For example IPNS references can (currently)
point at an IPFS object, and DNS li... | [
"def",
"resolve",
"(",
"self",
",",
"name",
",",
"recursive",
"=",
"False",
",",
"**",
"kwargs",
")",
":",
"kwargs",
".",
"setdefault",
"(",
"\"opts\"",
",",
"{",
"\"recursive\"",
":",
"recursive",
"}",
")",
"args",
"=",
"(",
"name",
",",
")",
"retur... | Accepts an identifier and resolves it to the referenced item.
There are a number of mutable name protocols that can link among
themselves and into IPNS. For example IPNS references can (currently)
point at an IPFS object, and DNS links can point at other DNS links,
IPNS entries, or IPFS... | [
"Accepts",
"an",
"identifier",
"and",
"resolves",
"it",
"to",
"the",
"referenced",
"item",
"."
] | 7574dad04877b45dbe4ad321dcfa9e880eb2d90c | https://github.com/ipfs/py-ipfs-api/blob/7574dad04877b45dbe4ad321dcfa9e880eb2d90c/ipfsapi/client.py#L775-L805 | train |
ipfs/py-ipfs-api | ipfsapi/client.py | Client.key_gen | def key_gen(self, key_name, type, size=2048, **kwargs):
"""Adds a new public key that can be used for name_publish.
.. code-block:: python
>>> c.key_gen('example_key_name')
{'Name': 'example_key_name',
'Id': 'QmQLaT5ZrCfSkXTH6rUKtVidcxj8jrW3X2h75Lug1AV7g8'}
... | python | def key_gen(self, key_name, type, size=2048, **kwargs):
"""Adds a new public key that can be used for name_publish.
.. code-block:: python
>>> c.key_gen('example_key_name')
{'Name': 'example_key_name',
'Id': 'QmQLaT5ZrCfSkXTH6rUKtVidcxj8jrW3X2h75Lug1AV7g8'}
... | [
"def",
"key_gen",
"(",
"self",
",",
"key_name",
",",
"type",
",",
"size",
"=",
"2048",
",",
"**",
"kwargs",
")",
":",
"opts",
"=",
"{",
"\"type\"",
":",
"type",
",",
"\"size\"",
":",
"size",
"}",
"kwargs",
".",
"setdefault",
"(",
"\"opts\"",
",",
"... | Adds a new public key that can be used for name_publish.
.. code-block:: python
>>> c.key_gen('example_key_name')
{'Name': 'example_key_name',
'Id': 'QmQLaT5ZrCfSkXTH6rUKtVidcxj8jrW3X2h75Lug1AV7g8'}
Parameters
----------
key_name : str
... | [
"Adds",
"a",
"new",
"public",
"key",
"that",
"can",
"be",
"used",
"for",
"name_publish",
"."
] | 7574dad04877b45dbe4ad321dcfa9e880eb2d90c | https://github.com/ipfs/py-ipfs-api/blob/7574dad04877b45dbe4ad321dcfa9e880eb2d90c/ipfsapi/client.py#L825-L856 | train |
ipfs/py-ipfs-api | ipfsapi/client.py | Client.key_rm | def key_rm(self, key_name, *key_names, **kwargs):
"""Remove a keypair
.. code-block:: python
>>> c.key_rm("bla")
{"Keys": [
{"Name": "bla",
"Id": "QmfJpR6paB6h891y7SYXGe6gapyNgepBeAYMbyejWA4FWA"}
]}
Parameters
------... | python | def key_rm(self, key_name, *key_names, **kwargs):
"""Remove a keypair
.. code-block:: python
>>> c.key_rm("bla")
{"Keys": [
{"Name": "bla",
"Id": "QmfJpR6paB6h891y7SYXGe6gapyNgepBeAYMbyejWA4FWA"}
]}
Parameters
------... | [
"def",
"key_rm",
"(",
"self",
",",
"key_name",
",",
"*",
"key_names",
",",
"**",
"kwargs",
")",
":",
"args",
"=",
"(",
"key_name",
",",
")",
"+",
"key_names",
"return",
"self",
".",
"_client",
".",
"request",
"(",
"'/key/rm'",
",",
"args",
",",
"deco... | Remove a keypair
.. code-block:: python
>>> c.key_rm("bla")
{"Keys": [
{"Name": "bla",
"Id": "QmfJpR6paB6h891y7SYXGe6gapyNgepBeAYMbyejWA4FWA"}
]}
Parameters
----------
key_name : str
Name of the key(s) to... | [
"Remove",
"a",
"keypair"
] | 7574dad04877b45dbe4ad321dcfa9e880eb2d90c | https://github.com/ipfs/py-ipfs-api/blob/7574dad04877b45dbe4ad321dcfa9e880eb2d90c/ipfsapi/client.py#L858-L879 | train |
ipfs/py-ipfs-api | ipfsapi/client.py | Client.key_rename | def key_rename(self, key_name, new_key_name, **kwargs):
"""Rename a keypair
.. code-block:: python
>>> c.key_rename("bla", "personal")
{"Was": "bla",
"Now": "personal",
"Id": "QmeyrRNxXaasZaoDXcCZgryoBCga9shaHQ4suHAYXbNZF3",
"Overwrite": F... | python | def key_rename(self, key_name, new_key_name, **kwargs):
"""Rename a keypair
.. code-block:: python
>>> c.key_rename("bla", "personal")
{"Was": "bla",
"Now": "personal",
"Id": "QmeyrRNxXaasZaoDXcCZgryoBCga9shaHQ4suHAYXbNZF3",
"Overwrite": F... | [
"def",
"key_rename",
"(",
"self",
",",
"key_name",
",",
"new_key_name",
",",
"**",
"kwargs",
")",
":",
"args",
"=",
"(",
"key_name",
",",
"new_key_name",
")",
"return",
"self",
".",
"_client",
".",
"request",
"(",
"'/key/rename'",
",",
"args",
",",
"deco... | Rename a keypair
.. code-block:: python
>>> c.key_rename("bla", "personal")
{"Was": "bla",
"Now": "personal",
"Id": "QmeyrRNxXaasZaoDXcCZgryoBCga9shaHQ4suHAYXbNZF3",
"Overwrite": False}
Parameters
----------
key_name : str... | [
"Rename",
"a",
"keypair"
] | 7574dad04877b45dbe4ad321dcfa9e880eb2d90c | https://github.com/ipfs/py-ipfs-api/blob/7574dad04877b45dbe4ad321dcfa9e880eb2d90c/ipfsapi/client.py#L881-L905 | train |
ipfs/py-ipfs-api | ipfsapi/client.py | Client.name_publish | def name_publish(self, ipfs_path, resolve=True, lifetime="24h", ttl=None,
key=None, **kwargs):
"""Publishes an object to IPNS.
IPNS is a PKI namespace, where names are the hashes of public keys, and
the private key enables publishing new (signed) values. In publish, the
... | python | def name_publish(self, ipfs_path, resolve=True, lifetime="24h", ttl=None,
key=None, **kwargs):
"""Publishes an object to IPNS.
IPNS is a PKI namespace, where names are the hashes of public keys, and
the private key enables publishing new (signed) values. In publish, the
... | [
"def",
"name_publish",
"(",
"self",
",",
"ipfs_path",
",",
"resolve",
"=",
"True",
",",
"lifetime",
"=",
"\"24h\"",
",",
"ttl",
"=",
"None",
",",
"key",
"=",
"None",
",",
"**",
"kwargs",
")",
":",
"opts",
"=",
"{",
"\"lifetime\"",
":",
"lifetime",
",... | Publishes an object to IPNS.
IPNS is a PKI namespace, where names are the hashes of public keys, and
the private key enables publishing new (signed) values. In publish, the
default value of *name* is your own identity public key.
.. code-block:: python
>>> c.name_publish('... | [
"Publishes",
"an",
"object",
"to",
"IPNS",
"."
] | 7574dad04877b45dbe4ad321dcfa9e880eb2d90c | https://github.com/ipfs/py-ipfs-api/blob/7574dad04877b45dbe4ad321dcfa9e880eb2d90c/ipfsapi/client.py#L907-L957 | train |
ipfs/py-ipfs-api | ipfsapi/client.py | Client.name_resolve | def name_resolve(self, name=None, recursive=False,
nocache=False, **kwargs):
"""Gets the value currently published at an IPNS name.
IPNS is a PKI namespace, where names are the hashes of public keys, and
the private key enables publishing new (signed) values. In resolve, th... | python | def name_resolve(self, name=None, recursive=False,
nocache=False, **kwargs):
"""Gets the value currently published at an IPNS name.
IPNS is a PKI namespace, where names are the hashes of public keys, and
the private key enables publishing new (signed) values. In resolve, th... | [
"def",
"name_resolve",
"(",
"self",
",",
"name",
"=",
"None",
",",
"recursive",
"=",
"False",
",",
"nocache",
"=",
"False",
",",
"**",
"kwargs",
")",
":",
"kwargs",
".",
"setdefault",
"(",
"\"opts\"",
",",
"{",
"\"recursive\"",
":",
"recursive",
",",
"... | Gets the value currently published at an IPNS name.
IPNS is a PKI namespace, where names are the hashes of public keys, and
the private key enables publishing new (signed) values. In resolve, the
default value of ``name`` is your own identity public key.
.. code-block:: python
... | [
"Gets",
"the",
"value",
"currently",
"published",
"at",
"an",
"IPNS",
"name",
"."
] | 7574dad04877b45dbe4ad321dcfa9e880eb2d90c | https://github.com/ipfs/py-ipfs-api/blob/7574dad04877b45dbe4ad321dcfa9e880eb2d90c/ipfsapi/client.py#L959-L989 | train |
ipfs/py-ipfs-api | ipfsapi/client.py | Client.dns | def dns(self, domain_name, recursive=False, **kwargs):
"""Resolves DNS links to the referenced object.
Multihashes are hard to remember, but domain names are usually easy to
remember. To create memorable aliases for multihashes, DNS TXT records
can point to other DNS links, IPFS objects... | python | def dns(self, domain_name, recursive=False, **kwargs):
"""Resolves DNS links to the referenced object.
Multihashes are hard to remember, but domain names are usually easy to
remember. To create memorable aliases for multihashes, DNS TXT records
can point to other DNS links, IPFS objects... | [
"def",
"dns",
"(",
"self",
",",
"domain_name",
",",
"recursive",
"=",
"False",
",",
"**",
"kwargs",
")",
":",
"kwargs",
".",
"setdefault",
"(",
"\"opts\"",
",",
"{",
"\"recursive\"",
":",
"recursive",
"}",
")",
"args",
"=",
"(",
"domain_name",
",",
")"... | Resolves DNS links to the referenced object.
Multihashes are hard to remember, but domain names are usually easy to
remember. To create memorable aliases for multihashes, DNS TXT records
can point to other DNS links, IPFS objects, IPNS keys, etc.
This command resolves those links to the... | [
"Resolves",
"DNS",
"links",
"to",
"the",
"referenced",
"object",
"."
] | 7574dad04877b45dbe4ad321dcfa9e880eb2d90c | https://github.com/ipfs/py-ipfs-api/blob/7574dad04877b45dbe4ad321dcfa9e880eb2d90c/ipfsapi/client.py#L991-L1025 | train |
ipfs/py-ipfs-api | ipfsapi/client.py | Client.pin_add | def pin_add(self, path, *paths, **kwargs):
"""Pins objects to local storage.
Stores an IPFS object(s) from a given path locally to disk.
.. code-block:: python
>>> c.pin_add("QmfZY61ukoQuCX8e5Pt7v8pRfhkyxwZKZMTodAtmvyGZ5d")
{'Pins': ['QmfZY61ukoQuCX8e5Pt7v8pRfhkyxwZKZM... | python | def pin_add(self, path, *paths, **kwargs):
"""Pins objects to local storage.
Stores an IPFS object(s) from a given path locally to disk.
.. code-block:: python
>>> c.pin_add("QmfZY61ukoQuCX8e5Pt7v8pRfhkyxwZKZMTodAtmvyGZ5d")
{'Pins': ['QmfZY61ukoQuCX8e5Pt7v8pRfhkyxwZKZM... | [
"def",
"pin_add",
"(",
"self",
",",
"path",
",",
"*",
"paths",
",",
"**",
"kwargs",
")",
":",
"if",
"\"recursive\"",
"in",
"kwargs",
":",
"kwargs",
".",
"setdefault",
"(",
"\"opts\"",
",",
"{",
"\"recursive\"",
":",
"kwargs",
".",
"pop",
"(",
"\"recurs... | Pins objects to local storage.
Stores an IPFS object(s) from a given path locally to disk.
.. code-block:: python
>>> c.pin_add("QmfZY61ukoQuCX8e5Pt7v8pRfhkyxwZKZMTodAtmvyGZ5d")
{'Pins': ['QmfZY61ukoQuCX8e5Pt7v8pRfhkyxwZKZMTodAtmvyGZ5d']}
Parameters
----------... | [
"Pins",
"objects",
"to",
"local",
"storage",
"."
] | 7574dad04877b45dbe4ad321dcfa9e880eb2d90c | https://github.com/ipfs/py-ipfs-api/blob/7574dad04877b45dbe4ad321dcfa9e880eb2d90c/ipfsapi/client.py#L1027-L1053 | train |
ipfs/py-ipfs-api | ipfsapi/client.py | Client.pin_rm | def pin_rm(self, path, *paths, **kwargs):
"""Removes a pinned object from local storage.
Removes the pin from the given object allowing it to be garbage
collected if needed.
.. code-block:: python
>>> c.pin_rm('QmfZY61ukoQuCX8e5Pt7v8pRfhkyxwZKZMTodAtmvyGZ5d')
{... | python | def pin_rm(self, path, *paths, **kwargs):
"""Removes a pinned object from local storage.
Removes the pin from the given object allowing it to be garbage
collected if needed.
.. code-block:: python
>>> c.pin_rm('QmfZY61ukoQuCX8e5Pt7v8pRfhkyxwZKZMTodAtmvyGZ5d')
{... | [
"def",
"pin_rm",
"(",
"self",
",",
"path",
",",
"*",
"paths",
",",
"**",
"kwargs",
")",
":",
"if",
"\"recursive\"",
"in",
"kwargs",
":",
"kwargs",
".",
"setdefault",
"(",
"\"opts\"",
",",
"{",
"\"recursive\"",
":",
"kwargs",
"[",
"\"recursive\"",
"]",
... | Removes a pinned object from local storage.
Removes the pin from the given object allowing it to be garbage
collected if needed.
.. code-block:: python
>>> c.pin_rm('QmfZY61ukoQuCX8e5Pt7v8pRfhkyxwZKZMTodAtmvyGZ5d')
{'Pins': ['QmfZY61ukoQuCX8e5Pt7v8pRfhkyxwZKZMTodAtmvyG... | [
"Removes",
"a",
"pinned",
"object",
"from",
"local",
"storage",
"."
] | 7574dad04877b45dbe4ad321dcfa9e880eb2d90c | https://github.com/ipfs/py-ipfs-api/blob/7574dad04877b45dbe4ad321dcfa9e880eb2d90c/ipfsapi/client.py#L1055-L1083 | train |
ipfs/py-ipfs-api | ipfsapi/client.py | Client.pin_ls | def pin_ls(self, type="all", **kwargs):
"""Lists objects pinned to local storage.
By default, all pinned objects are returned, but the ``type`` flag or
arguments can restrict that to a specific pin type or to some specific
objects respectively.
.. code-block:: python
... | python | def pin_ls(self, type="all", **kwargs):
"""Lists objects pinned to local storage.
By default, all pinned objects are returned, but the ``type`` flag or
arguments can restrict that to a specific pin type or to some specific
objects respectively.
.. code-block:: python
... | [
"def",
"pin_ls",
"(",
"self",
",",
"type",
"=",
"\"all\"",
",",
"**",
"kwargs",
")",
":",
"kwargs",
".",
"setdefault",
"(",
"\"opts\"",
",",
"{",
"\"type\"",
":",
"type",
"}",
")",
"return",
"self",
".",
"_client",
".",
"request",
"(",
"'/pin/ls'",
"... | Lists objects pinned to local storage.
By default, all pinned objects are returned, but the ``type`` flag or
arguments can restrict that to a specific pin type or to some specific
objects respectively.
.. code-block:: python
>>> c.pin_ls()
{'Keys': {
... | [
"Lists",
"objects",
"pinned",
"to",
"local",
"storage",
"."
] | 7574dad04877b45dbe4ad321dcfa9e880eb2d90c | https://github.com/ipfs/py-ipfs-api/blob/7574dad04877b45dbe4ad321dcfa9e880eb2d90c/ipfsapi/client.py#L1085-L1118 | train |
ipfs/py-ipfs-api | ipfsapi/client.py | Client.pin_update | def pin_update(self, from_path, to_path, **kwargs):
"""Replaces one pin with another.
Updates one pin to another, making sure that all objects in the new pin
are local. Then removes the old pin. This is an optimized version of
using first using :meth:`~ipfsapi.Client.pin_add` to add a n... | python | def pin_update(self, from_path, to_path, **kwargs):
"""Replaces one pin with another.
Updates one pin to another, making sure that all objects in the new pin
are local. Then removes the old pin. This is an optimized version of
using first using :meth:`~ipfsapi.Client.pin_add` to add a n... | [
"def",
"pin_update",
"(",
"self",
",",
"from_path",
",",
"to_path",
",",
"**",
"kwargs",
")",
":",
"if",
"\"unpin\"",
"in",
"kwargs",
":",
"kwargs",
".",
"setdefault",
"(",
"\"opts\"",
",",
"{",
"\"unpin\"",
":",
"kwargs",
"[",
"\"unpin\"",
"]",
"}",
"... | Replaces one pin with another.
Updates one pin to another, making sure that all objects in the new pin
are local. Then removes the old pin. This is an optimized version of
using first using :meth:`~ipfsapi.Client.pin_add` to add a new pin
for an object and then using :meth:`~ipfsapi.Cli... | [
"Replaces",
"one",
"pin",
"with",
"another",
"."
] | 7574dad04877b45dbe4ad321dcfa9e880eb2d90c | https://github.com/ipfs/py-ipfs-api/blob/7574dad04877b45dbe4ad321dcfa9e880eb2d90c/ipfsapi/client.py#L1120-L1156 | train |
ipfs/py-ipfs-api | ipfsapi/client.py | Client.pin_verify | def pin_verify(self, path, *paths, **kwargs):
"""Verify that recursive pins are complete.
Scan the repo for pinned object graphs and check their integrity.
Issues will be reported back with a helpful human-readable error
message to aid in error recovery. This is useful to help recover
... | python | def pin_verify(self, path, *paths, **kwargs):
"""Verify that recursive pins are complete.
Scan the repo for pinned object graphs and check their integrity.
Issues will be reported back with a helpful human-readable error
message to aid in error recovery. This is useful to help recover
... | [
"def",
"pin_verify",
"(",
"self",
",",
"path",
",",
"*",
"paths",
",",
"**",
"kwargs",
")",
":",
"if",
"\"verbose\"",
"in",
"kwargs",
":",
"kwargs",
".",
"setdefault",
"(",
"\"opts\"",
",",
"{",
"\"verbose\"",
":",
"kwargs",
"[",
"\"verbose\"",
"]",
"}... | Verify that recursive pins are complete.
Scan the repo for pinned object graphs and check their integrity.
Issues will be reported back with a helpful human-readable error
message to aid in error recovery. This is useful to help recover
from datastore corruptions (such as when accidenta... | [
"Verify",
"that",
"recursive",
"pins",
"are",
"complete",
"."
] | 7574dad04877b45dbe4ad321dcfa9e880eb2d90c | https://github.com/ipfs/py-ipfs-api/blob/7574dad04877b45dbe4ad321dcfa9e880eb2d90c/ipfsapi/client.py#L1158-L1199 | train |
ipfs/py-ipfs-api | ipfsapi/client.py | Client.id | def id(self, peer=None, **kwargs):
"""Shows IPFS Node ID info.
Returns the PublicKey, ProtocolVersion, ID, AgentVersion and
Addresses of the connected daemon or some other node.
.. code-block:: python
>>> c.id()
{'ID': 'QmVgNoP89mzpgEAAqK8owYoDEyB97MkcGvoWZir8o... | python | def id(self, peer=None, **kwargs):
"""Shows IPFS Node ID info.
Returns the PublicKey, ProtocolVersion, ID, AgentVersion and
Addresses of the connected daemon or some other node.
.. code-block:: python
>>> c.id()
{'ID': 'QmVgNoP89mzpgEAAqK8owYoDEyB97MkcGvoWZir8o... | [
"def",
"id",
"(",
"self",
",",
"peer",
"=",
"None",
",",
"**",
"kwargs",
")",
":",
"args",
"=",
"(",
"peer",
",",
")",
"if",
"peer",
"is",
"not",
"None",
"else",
"(",
")",
"return",
"self",
".",
"_client",
".",
"request",
"(",
"'/id'",
",",
"ar... | Shows IPFS Node ID info.
Returns the PublicKey, ProtocolVersion, ID, AgentVersion and
Addresses of the connected daemon or some other node.
.. code-block:: python
>>> c.id()
{'ID': 'QmVgNoP89mzpgEAAqK8owYoDEyB97MkcGvoWZir8otE9Uc',
'PublicKey': 'CAASpgIwggEi... | [
"Shows",
"IPFS",
"Node",
"ID",
"info",
"."
] | 7574dad04877b45dbe4ad321dcfa9e880eb2d90c | https://github.com/ipfs/py-ipfs-api/blob/7574dad04877b45dbe4ad321dcfa9e880eb2d90c/ipfsapi/client.py#L1254-L1289 | train |
ipfs/py-ipfs-api | ipfsapi/client.py | Client.bootstrap_add | def bootstrap_add(self, peer, *peers, **kwargs):
"""Adds peers to the bootstrap list.
Parameters
----------
peer : str
IPFS MultiAddr of a peer to add to the list
Returns
-------
dict
"""
args = (peer,) + peers
return self... | python | def bootstrap_add(self, peer, *peers, **kwargs):
"""Adds peers to the bootstrap list.
Parameters
----------
peer : str
IPFS MultiAddr of a peer to add to the list
Returns
-------
dict
"""
args = (peer,) + peers
return self... | [
"def",
"bootstrap_add",
"(",
"self",
",",
"peer",
",",
"*",
"peers",
",",
"**",
"kwargs",
")",
":",
"args",
"=",
"(",
"peer",
",",
")",
"+",
"peers",
"return",
"self",
".",
"_client",
".",
"request",
"(",
"'/bootstrap/add'",
",",
"args",
",",
"decode... | Adds peers to the bootstrap list.
Parameters
----------
peer : str
IPFS MultiAddr of a peer to add to the list
Returns
-------
dict | [
"Adds",
"peers",
"to",
"the",
"bootstrap",
"list",
"."
] | 7574dad04877b45dbe4ad321dcfa9e880eb2d90c | https://github.com/ipfs/py-ipfs-api/blob/7574dad04877b45dbe4ad321dcfa9e880eb2d90c/ipfsapi/client.py#L1317-L1331 | train |
ipfs/py-ipfs-api | ipfsapi/client.py | Client.swarm_filters_add | def swarm_filters_add(self, address, *addresses, **kwargs):
"""Adds a given multiaddr filter to the filter list.
This will add an address filter to the daemons swarm. Filters applied
this way will not persist daemon reboots, to achieve that, add your
filters to the configuration file.
... | python | def swarm_filters_add(self, address, *addresses, **kwargs):
"""Adds a given multiaddr filter to the filter list.
This will add an address filter to the daemons swarm. Filters applied
this way will not persist daemon reboots, to achieve that, add your
filters to the configuration file.
... | [
"def",
"swarm_filters_add",
"(",
"self",
",",
"address",
",",
"*",
"addresses",
",",
"**",
"kwargs",
")",
":",
"args",
"=",
"(",
"address",
",",
")",
"+",
"addresses",
"return",
"self",
".",
"_client",
".",
"request",
"(",
"'/swarm/filters/add'",
",",
"a... | Adds a given multiaddr filter to the filter list.
This will add an address filter to the daemons swarm. Filters applied
this way will not persist daemon reboots, to achieve that, add your
filters to the configuration file.
.. code-block:: python
>>> c.swarm_filters_add("/i... | [
"Adds",
"a",
"given",
"multiaddr",
"filter",
"to",
"the",
"filter",
"list",
"."
] | 7574dad04877b45dbe4ad321dcfa9e880eb2d90c | https://github.com/ipfs/py-ipfs-api/blob/7574dad04877b45dbe4ad321dcfa9e880eb2d90c/ipfsapi/client.py#L1456-L1479 | train |
ipfs/py-ipfs-api | ipfsapi/client.py | Client.dht_query | def dht_query(self, peer_id, *peer_ids, **kwargs):
"""Finds the closest Peer IDs to a given Peer ID by querying the DHT.
.. code-block:: python
>>> c.dht_query("/ip4/104.131.131.82/tcp/4001/ipfs/QmaCpDM … uvuJ")
[{'ID': 'QmPkFbxAQ7DeKD5VGSh9HQrdS574pyNzDmxJeGrRJxoucF',
... | python | def dht_query(self, peer_id, *peer_ids, **kwargs):
"""Finds the closest Peer IDs to a given Peer ID by querying the DHT.
.. code-block:: python
>>> c.dht_query("/ip4/104.131.131.82/tcp/4001/ipfs/QmaCpDM … uvuJ")
[{'ID': 'QmPkFbxAQ7DeKD5VGSh9HQrdS574pyNzDmxJeGrRJxoucF',
... | [
"def",
"dht_query",
"(",
"self",
",",
"peer_id",
",",
"*",
"peer_ids",
",",
"**",
"kwargs",
")",
":",
"args",
"=",
"(",
"peer_id",
",",
")",
"+",
"peer_ids",
"return",
"self",
".",
"_client",
".",
"request",
"(",
"'/dht/query'",
",",
"args",
",",
"de... | Finds the closest Peer IDs to a given Peer ID by querying the DHT.
.. code-block:: python
>>> c.dht_query("/ip4/104.131.131.82/tcp/4001/ipfs/QmaCpDM … uvuJ")
[{'ID': 'QmPkFbxAQ7DeKD5VGSh9HQrdS574pyNzDmxJeGrRJxoucF',
'Extra': '', 'Type': 2, 'Responses': None},
... | [
"Finds",
"the",
"closest",
"Peer",
"IDs",
"to",
"a",
"given",
"Peer",
"ID",
"by",
"querying",
"the",
"DHT",
"."
] | 7574dad04877b45dbe4ad321dcfa9e880eb2d90c | https://github.com/ipfs/py-ipfs-api/blob/7574dad04877b45dbe4ad321dcfa9e880eb2d90c/ipfsapi/client.py#L1506-L1533 | train |
ipfs/py-ipfs-api | ipfsapi/client.py | Client.dht_findprovs | def dht_findprovs(self, multihash, *multihashes, **kwargs):
"""Finds peers in the DHT that can provide a specific value.
.. code-block:: python
>>> c.dht_findprovs("QmNPXDC6wTXVmZ9Uoc8X1oqxRRJr4f1sDuyQu … mpW2")
[{'ID': 'QmaxqKpiYNr62uSFBhxJAMmEMkT6dvc3oHkrZNpH2VMTLZ',
... | python | def dht_findprovs(self, multihash, *multihashes, **kwargs):
"""Finds peers in the DHT that can provide a specific value.
.. code-block:: python
>>> c.dht_findprovs("QmNPXDC6wTXVmZ9Uoc8X1oqxRRJr4f1sDuyQu … mpW2")
[{'ID': 'QmaxqKpiYNr62uSFBhxJAMmEMkT6dvc3oHkrZNpH2VMTLZ',
... | [
"def",
"dht_findprovs",
"(",
"self",
",",
"multihash",
",",
"*",
"multihashes",
",",
"**",
"kwargs",
")",
":",
"args",
"=",
"(",
"multihash",
",",
")",
"+",
"multihashes",
"return",
"self",
".",
"_client",
".",
"request",
"(",
"'/dht/findprovs'",
",",
"a... | Finds peers in the DHT that can provide a specific value.
.. code-block:: python
>>> c.dht_findprovs("QmNPXDC6wTXVmZ9Uoc8X1oqxRRJr4f1sDuyQu … mpW2")
[{'ID': 'QmaxqKpiYNr62uSFBhxJAMmEMkT6dvc3oHkrZNpH2VMTLZ',
'Extra': '', 'Type': 6, 'Responses': None},
{'ID': '... | [
"Finds",
"peers",
"in",
"the",
"DHT",
"that",
"can",
"provide",
"a",
"specific",
"value",
"."
] | 7574dad04877b45dbe4ad321dcfa9e880eb2d90c | https://github.com/ipfs/py-ipfs-api/blob/7574dad04877b45dbe4ad321dcfa9e880eb2d90c/ipfsapi/client.py#L1535-L1572 | train |
ipfs/py-ipfs-api | ipfsapi/client.py | Client.dht_get | def dht_get(self, key, *keys, **kwargs):
"""Queries the DHT for its best value related to given key.
There may be several different values for a given key stored in the
DHT; in this context *best* means the record that is most desirable.
There is no one metric for *best*: it depends ent... | python | def dht_get(self, key, *keys, **kwargs):
"""Queries the DHT for its best value related to given key.
There may be several different values for a given key stored in the
DHT; in this context *best* means the record that is most desirable.
There is no one metric for *best*: it depends ent... | [
"def",
"dht_get",
"(",
"self",
",",
"key",
",",
"*",
"keys",
",",
"**",
"kwargs",
")",
":",
"args",
"=",
"(",
"key",
",",
")",
"+",
"keys",
"res",
"=",
"self",
".",
"_client",
".",
"request",
"(",
"'/dht/get'",
",",
"args",
",",
"decoder",
"=",
... | Queries the DHT for its best value related to given key.
There may be several different values for a given key stored in the
DHT; in this context *best* means the record that is most desirable.
There is no one metric for *best*: it depends entirely on the key type.
For IPNS, *best* is t... | [
"Queries",
"the",
"DHT",
"for",
"its",
"best",
"value",
"related",
"to",
"given",
"key",
"."
] | 7574dad04877b45dbe4ad321dcfa9e880eb2d90c | https://github.com/ipfs/py-ipfs-api/blob/7574dad04877b45dbe4ad321dcfa9e880eb2d90c/ipfsapi/client.py#L1610-L1638 | train |
ipfs/py-ipfs-api | ipfsapi/client.py | Client.ping | def ping(self, peer, *peers, **kwargs):
"""Provides round-trip latency information for the routing system.
Finds nodes via the routing system, sends pings, waits for pongs,
and prints out round-trip latency information.
.. code-block:: python
>>> c.ping("QmTzQ1JRkWErjk39mr... | python | def ping(self, peer, *peers, **kwargs):
"""Provides round-trip latency information for the routing system.
Finds nodes via the routing system, sends pings, waits for pongs,
and prints out round-trip latency information.
.. code-block:: python
>>> c.ping("QmTzQ1JRkWErjk39mr... | [
"def",
"ping",
"(",
"self",
",",
"peer",
",",
"*",
"peers",
",",
"**",
"kwargs",
")",
":",
"if",
"\"count\"",
"in",
"kwargs",
":",
"kwargs",
".",
"setdefault",
"(",
"\"opts\"",
",",
"{",
"\"count\"",
":",
"kwargs",
"[",
"\"count\"",
"]",
"}",
")",
... | Provides round-trip latency information for the routing system.
Finds nodes via the routing system, sends pings, waits for pongs,
and prints out round-trip latency information.
.. code-block:: python
>>> c.ping("QmTzQ1JRkWErjk39mryYw2WVaphAZNAREyMchXzYQ7c15n")
[{'Succe... | [
"Provides",
"round",
"-",
"trip",
"latency",
"information",
"for",
"the",
"routing",
"system",
"."
] | 7574dad04877b45dbe4ad321dcfa9e880eb2d90c | https://github.com/ipfs/py-ipfs-api/blob/7574dad04877b45dbe4ad321dcfa9e880eb2d90c/ipfsapi/client.py#L1685-L1716 | train |
ipfs/py-ipfs-api | ipfsapi/client.py | Client.config | def config(self, key, value=None, **kwargs):
"""Controls configuration variables.
.. code-block:: python
>>> c.config("Addresses.Gateway")
{'Key': 'Addresses.Gateway', 'Value': '/ip4/127.0.0.1/tcp/8080'}
>>> c.config("Addresses.Gateway", "/ip4/127.0.0.1/tcp/8081")
... | python | def config(self, key, value=None, **kwargs):
"""Controls configuration variables.
.. code-block:: python
>>> c.config("Addresses.Gateway")
{'Key': 'Addresses.Gateway', 'Value': '/ip4/127.0.0.1/tcp/8080'}
>>> c.config("Addresses.Gateway", "/ip4/127.0.0.1/tcp/8081")
... | [
"def",
"config",
"(",
"self",
",",
"key",
",",
"value",
"=",
"None",
",",
"**",
"kwargs",
")",
":",
"args",
"=",
"(",
"key",
",",
"value",
")",
"return",
"self",
".",
"_client",
".",
"request",
"(",
"'/config'",
",",
"args",
",",
"decoder",
"=",
... | Controls configuration variables.
.. code-block:: python
>>> c.config("Addresses.Gateway")
{'Key': 'Addresses.Gateway', 'Value': '/ip4/127.0.0.1/tcp/8080'}
>>> c.config("Addresses.Gateway", "/ip4/127.0.0.1/tcp/8081")
{'Key': 'Addresses.Gateway', 'Value': '/ip4/1... | [
"Controls",
"configuration",
"variables",
"."
] | 7574dad04877b45dbe4ad321dcfa9e880eb2d90c | https://github.com/ipfs/py-ipfs-api/blob/7574dad04877b45dbe4ad321dcfa9e880eb2d90c/ipfsapi/client.py#L1718-L1740 | train |
ipfs/py-ipfs-api | ipfsapi/client.py | Client.config_replace | def config_replace(self, *args, **kwargs):
"""Replaces the existing config with a user-defined config.
Make sure to back up the config file first if neccessary, as this
operation can't be undone.
"""
return self._client.request('/config/replace', args,
... | python | def config_replace(self, *args, **kwargs):
"""Replaces the existing config with a user-defined config.
Make sure to back up the config file first if neccessary, as this
operation can't be undone.
"""
return self._client.request('/config/replace', args,
... | [
"def",
"config_replace",
"(",
"self",
",",
"*",
"args",
",",
"**",
"kwargs",
")",
":",
"return",
"self",
".",
"_client",
".",
"request",
"(",
"'/config/replace'",
",",
"args",
",",
"decoder",
"=",
"'json'",
",",
"**",
"kwargs",
")"
] | Replaces the existing config with a user-defined config.
Make sure to back up the config file first if neccessary, as this
operation can't be undone. | [
"Replaces",
"the",
"existing",
"config",
"with",
"a",
"user",
"-",
"defined",
"config",
"."
] | 7574dad04877b45dbe4ad321dcfa9e880eb2d90c | https://github.com/ipfs/py-ipfs-api/blob/7574dad04877b45dbe4ad321dcfa9e880eb2d90c/ipfsapi/client.py#L1766-L1773 | train |
ipfs/py-ipfs-api | ipfsapi/client.py | Client.log_level | def log_level(self, subsystem, level, **kwargs):
r"""Changes the logging output of a running daemon.
.. code-block:: python
>>> c.log_level("path", "info")
{'Message': "Changed log level of 'path' to 'info'\n"}
Parameters
----------
subsystem : str
... | python | def log_level(self, subsystem, level, **kwargs):
r"""Changes the logging output of a running daemon.
.. code-block:: python
>>> c.log_level("path", "info")
{'Message': "Changed log level of 'path' to 'info'\n"}
Parameters
----------
subsystem : str
... | [
"def",
"log_level",
"(",
"self",
",",
"subsystem",
",",
"level",
",",
"**",
"kwargs",
")",
":",
"r",
"args",
"=",
"(",
"subsystem",
",",
"level",
")",
"return",
"self",
".",
"_client",
".",
"request",
"(",
"'/log/level'",
",",
"args",
",",
"decoder",
... | r"""Changes the logging output of a running daemon.
.. code-block:: python
>>> c.log_level("path", "info")
{'Message': "Changed log level of 'path' to 'info'\n"}
Parameters
----------
subsystem : str
The subsystem logging identifier (Use ``"all"`` f... | [
"r",
"Changes",
"the",
"logging",
"output",
"of",
"a",
"running",
"daemon",
"."
] | 7574dad04877b45dbe4ad321dcfa9e880eb2d90c | https://github.com/ipfs/py-ipfs-api/blob/7574dad04877b45dbe4ad321dcfa9e880eb2d90c/ipfsapi/client.py#L1775-L1803 | train |
ipfs/py-ipfs-api | ipfsapi/client.py | Client.log_tail | def log_tail(self, **kwargs):
r"""Reads log outputs as they are written.
This function returns an iterator needs to be closed using a context
manager (``with``-statement) or using the ``.close()`` method.
.. code-block:: python
>>> with c.log_tail() as log_tail_iter:
... | python | def log_tail(self, **kwargs):
r"""Reads log outputs as they are written.
This function returns an iterator needs to be closed using a context
manager (``with``-statement) or using the ``.close()`` method.
.. code-block:: python
>>> with c.log_tail() as log_tail_iter:
... | [
"def",
"log_tail",
"(",
"self",
",",
"**",
"kwargs",
")",
":",
"r",
"return",
"self",
".",
"_client",
".",
"request",
"(",
"'/log/tail'",
",",
"decoder",
"=",
"'json'",
",",
"stream",
"=",
"True",
",",
"**",
"kwargs",
")"
] | r"""Reads log outputs as they are written.
This function returns an iterator needs to be closed using a context
manager (``with``-statement) or using the ``.close()`` method.
.. code-block:: python
>>> with c.log_tail() as log_tail_iter:
... for item in log_tail_it... | [
"r",
"Reads",
"log",
"outputs",
"as",
"they",
"are",
"written",
"."
] | 7574dad04877b45dbe4ad321dcfa9e880eb2d90c | https://github.com/ipfs/py-ipfs-api/blob/7574dad04877b45dbe4ad321dcfa9e880eb2d90c/ipfsapi/client.py#L1836-L1872 | train |
ipfs/py-ipfs-api | ipfsapi/client.py | Client.files_cp | def files_cp(self, source, dest, **kwargs):
"""Copies files within the MFS.
Due to the nature of IPFS this will not actually involve any of the
file's content being copied.
.. code-block:: python
>>> c.files_ls("/")
{'Entries': [
{'Size': 0, 'Ha... | python | def files_cp(self, source, dest, **kwargs):
"""Copies files within the MFS.
Due to the nature of IPFS this will not actually involve any of the
file's content being copied.
.. code-block:: python
>>> c.files_ls("/")
{'Entries': [
{'Size': 0, 'Ha... | [
"def",
"files_cp",
"(",
"self",
",",
"source",
",",
"dest",
",",
"**",
"kwargs",
")",
":",
"args",
"=",
"(",
"source",
",",
"dest",
")",
"return",
"self",
".",
"_client",
".",
"request",
"(",
"'/files/cp'",
",",
"args",
",",
"**",
"kwargs",
")"
] | Copies files within the MFS.
Due to the nature of IPFS this will not actually involve any of the
file's content being copied.
.. code-block:: python
>>> c.files_ls("/")
{'Entries': [
{'Size': 0, 'Hash': '', 'Name': 'Software', 'Type': 0},
... | [
"Copies",
"files",
"within",
"the",
"MFS",
"."
] | 7574dad04877b45dbe4ad321dcfa9e880eb2d90c | https://github.com/ipfs/py-ipfs-api/blob/7574dad04877b45dbe4ad321dcfa9e880eb2d90c/ipfsapi/client.py#L1889-L1920 | train |
ipfs/py-ipfs-api | ipfsapi/client.py | Client.files_ls | def files_ls(self, path, **kwargs):
"""Lists contents of a directory in the MFS.
.. code-block:: python
>>> c.files_ls("/")
{'Entries': [
{'Size': 0, 'Hash': '', 'Name': 'Software', 'Type': 0}
]}
Parameters
----------
path : ... | python | def files_ls(self, path, **kwargs):
"""Lists contents of a directory in the MFS.
.. code-block:: python
>>> c.files_ls("/")
{'Entries': [
{'Size': 0, 'Hash': '', 'Name': 'Software', 'Type': 0}
]}
Parameters
----------
path : ... | [
"def",
"files_ls",
"(",
"self",
",",
"path",
",",
"**",
"kwargs",
")",
":",
"args",
"=",
"(",
"path",
",",
")",
"return",
"self",
".",
"_client",
".",
"request",
"(",
"'/files/ls'",
",",
"args",
",",
"decoder",
"=",
"'json'",
",",
"**",
"kwargs",
"... | Lists contents of a directory in the MFS.
.. code-block:: python
>>> c.files_ls("/")
{'Entries': [
{'Size': 0, 'Hash': '', 'Name': 'Software', 'Type': 0}
]}
Parameters
----------
path : str
Filepath within the MFS
... | [
"Lists",
"contents",
"of",
"a",
"directory",
"in",
"the",
"MFS",
"."
] | 7574dad04877b45dbe4ad321dcfa9e880eb2d90c | https://github.com/ipfs/py-ipfs-api/blob/7574dad04877b45dbe4ad321dcfa9e880eb2d90c/ipfsapi/client.py#L1922-L1943 | train |
ipfs/py-ipfs-api | ipfsapi/client.py | Client.files_mkdir | def files_mkdir(self, path, parents=False, **kwargs):
"""Creates a directory within the MFS.
.. code-block:: python
>>> c.files_mkdir("/test")
b''
Parameters
----------
path : str
Filepath within the MFS
parents : bool
Cr... | python | def files_mkdir(self, path, parents=False, **kwargs):
"""Creates a directory within the MFS.
.. code-block:: python
>>> c.files_mkdir("/test")
b''
Parameters
----------
path : str
Filepath within the MFS
parents : bool
Cr... | [
"def",
"files_mkdir",
"(",
"self",
",",
"path",
",",
"parents",
"=",
"False",
",",
"**",
"kwargs",
")",
":",
"kwargs",
".",
"setdefault",
"(",
"\"opts\"",
",",
"{",
"\"parents\"",
":",
"parents",
"}",
")",
"args",
"=",
"(",
"path",
",",
")",
"return"... | Creates a directory within the MFS.
.. code-block:: python
>>> c.files_mkdir("/test")
b''
Parameters
----------
path : str
Filepath within the MFS
parents : bool
Create parent directories as needed and do not raise an exception
... | [
"Creates",
"a",
"directory",
"within",
"the",
"MFS",
"."
] | 7574dad04877b45dbe4ad321dcfa9e880eb2d90c | https://github.com/ipfs/py-ipfs-api/blob/7574dad04877b45dbe4ad321dcfa9e880eb2d90c/ipfsapi/client.py#L1945-L1964 | train |
ipfs/py-ipfs-api | ipfsapi/client.py | Client.files_rm | def files_rm(self, path, recursive=False, **kwargs):
"""Removes a file from the MFS.
.. code-block:: python
>>> c.files_rm("/bla/file")
b''
Parameters
----------
path : str
Filepath within the MFS
recursive : bool
Recursi... | python | def files_rm(self, path, recursive=False, **kwargs):
"""Removes a file from the MFS.
.. code-block:: python
>>> c.files_rm("/bla/file")
b''
Parameters
----------
path : str
Filepath within the MFS
recursive : bool
Recursi... | [
"def",
"files_rm",
"(",
"self",
",",
"path",
",",
"recursive",
"=",
"False",
",",
"**",
"kwargs",
")",
":",
"kwargs",
".",
"setdefault",
"(",
"\"opts\"",
",",
"{",
"\"recursive\"",
":",
"recursive",
"}",
")",
"args",
"=",
"(",
"path",
",",
")",
"retu... | Removes a file from the MFS.
.. code-block:: python
>>> c.files_rm("/bla/file")
b''
Parameters
----------
path : str
Filepath within the MFS
recursive : bool
Recursively remove directories? | [
"Removes",
"a",
"file",
"from",
"the",
"MFS",
"."
] | 7574dad04877b45dbe4ad321dcfa9e880eb2d90c | https://github.com/ipfs/py-ipfs-api/blob/7574dad04877b45dbe4ad321dcfa9e880eb2d90c/ipfsapi/client.py#L1989-L2007 | train |
ipfs/py-ipfs-api | ipfsapi/client.py | Client.files_read | def files_read(self, path, offset=0, count=None, **kwargs):
"""Reads a file stored in the MFS.
.. code-block:: python
>>> c.files_read("/bla/file")
b'hi'
Parameters
----------
path : str
Filepath within the MFS
offset : int
... | python | def files_read(self, path, offset=0, count=None, **kwargs):
"""Reads a file stored in the MFS.
.. code-block:: python
>>> c.files_read("/bla/file")
b'hi'
Parameters
----------
path : str
Filepath within the MFS
offset : int
... | [
"def",
"files_read",
"(",
"self",
",",
"path",
",",
"offset",
"=",
"0",
",",
"count",
"=",
"None",
",",
"**",
"kwargs",
")",
":",
"opts",
"=",
"{",
"\"offset\"",
":",
"offset",
"}",
"if",
"count",
"is",
"not",
"None",
":",
"opts",
"[",
"\"count\"",... | Reads a file stored in the MFS.
.. code-block:: python
>>> c.files_read("/bla/file")
b'hi'
Parameters
----------
path : str
Filepath within the MFS
offset : int
Byte offset at which to begin reading at
count : int
... | [
"Reads",
"a",
"file",
"stored",
"in",
"the",
"MFS",
"."
] | 7574dad04877b45dbe4ad321dcfa9e880eb2d90c | https://github.com/ipfs/py-ipfs-api/blob/7574dad04877b45dbe4ad321dcfa9e880eb2d90c/ipfsapi/client.py#L2009-L2036 | train |
ipfs/py-ipfs-api | ipfsapi/client.py | Client.files_write | def files_write(self, path, file, offset=0, create=False, truncate=False,
count=None, **kwargs):
"""Writes to a mutable file in the MFS.
.. code-block:: python
>>> c.files_write("/test/file", io.BytesIO(b"hi"), create=True)
b''
Parameters
--... | python | def files_write(self, path, file, offset=0, create=False, truncate=False,
count=None, **kwargs):
"""Writes to a mutable file in the MFS.
.. code-block:: python
>>> c.files_write("/test/file", io.BytesIO(b"hi"), create=True)
b''
Parameters
--... | [
"def",
"files_write",
"(",
"self",
",",
"path",
",",
"file",
",",
"offset",
"=",
"0",
",",
"create",
"=",
"False",
",",
"truncate",
"=",
"False",
",",
"count",
"=",
"None",
",",
"**",
"kwargs",
")",
":",
"opts",
"=",
"{",
"\"offset\"",
":",
"offset... | Writes to a mutable file in the MFS.
.. code-block:: python
>>> c.files_write("/test/file", io.BytesIO(b"hi"), create=True)
b''
Parameters
----------
path : str
Filepath within the MFS
file : io.RawIOBase
IO stream object with da... | [
"Writes",
"to",
"a",
"mutable",
"file",
"in",
"the",
"MFS",
"."
] | 7574dad04877b45dbe4ad321dcfa9e880eb2d90c | https://github.com/ipfs/py-ipfs-api/blob/7574dad04877b45dbe4ad321dcfa9e880eb2d90c/ipfsapi/client.py#L2038-L2070 | train |
ipfs/py-ipfs-api | ipfsapi/client.py | Client.files_mv | def files_mv(self, source, dest, **kwargs):
"""Moves files and directories within the MFS.
.. code-block:: python
>>> c.files_mv("/test/file", "/bla/file")
b''
Parameters
----------
source : str
Existing filepath within the MFS
dest ... | python | def files_mv(self, source, dest, **kwargs):
"""Moves files and directories within the MFS.
.. code-block:: python
>>> c.files_mv("/test/file", "/bla/file")
b''
Parameters
----------
source : str
Existing filepath within the MFS
dest ... | [
"def",
"files_mv",
"(",
"self",
",",
"source",
",",
"dest",
",",
"**",
"kwargs",
")",
":",
"args",
"=",
"(",
"source",
",",
"dest",
")",
"return",
"self",
".",
"_client",
".",
"request",
"(",
"'/files/mv'",
",",
"args",
",",
"**",
"kwargs",
")"
] | Moves files and directories within the MFS.
.. code-block:: python
>>> c.files_mv("/test/file", "/bla/file")
b''
Parameters
----------
source : str
Existing filepath within the MFS
dest : str
Destination to which the file will be... | [
"Moves",
"files",
"and",
"directories",
"within",
"the",
"MFS",
"."
] | 7574dad04877b45dbe4ad321dcfa9e880eb2d90c | https://github.com/ipfs/py-ipfs-api/blob/7574dad04877b45dbe4ad321dcfa9e880eb2d90c/ipfsapi/client.py#L2072-L2088 | train |
ipfs/py-ipfs-api | ipfsapi/client.py | Client.add_bytes | def add_bytes(self, data, **kwargs):
"""Adds a set of bytes as a file to IPFS.
.. code-block:: python
>>> c.add_bytes(b"Mary had a little lamb")
'QmZfF6C9j4VtoCsTp4KSrhYH47QMd3DNXVZBKaxJdhaPab'
Also accepts and will stream generator objects.
Parameters
... | python | def add_bytes(self, data, **kwargs):
"""Adds a set of bytes as a file to IPFS.
.. code-block:: python
>>> c.add_bytes(b"Mary had a little lamb")
'QmZfF6C9j4VtoCsTp4KSrhYH47QMd3DNXVZBKaxJdhaPab'
Also accepts and will stream generator objects.
Parameters
... | [
"def",
"add_bytes",
"(",
"self",
",",
"data",
",",
"**",
"kwargs",
")",
":",
"body",
",",
"headers",
"=",
"multipart",
".",
"stream_bytes",
"(",
"data",
",",
"self",
".",
"chunk_size",
")",
"return",
"self",
".",
"_client",
".",
"request",
"(",
"'/add'... | Adds a set of bytes as a file to IPFS.
.. code-block:: python
>>> c.add_bytes(b"Mary had a little lamb")
'QmZfF6C9j4VtoCsTp4KSrhYH47QMd3DNXVZBKaxJdhaPab'
Also accepts and will stream generator objects.
Parameters
----------
data : bytes
Con... | [
"Adds",
"a",
"set",
"of",
"bytes",
"as",
"a",
"file",
"to",
"IPFS",
"."
] | 7574dad04877b45dbe4ad321dcfa9e880eb2d90c | https://github.com/ipfs/py-ipfs-api/blob/7574dad04877b45dbe4ad321dcfa9e880eb2d90c/ipfsapi/client.py#L2109-L2130 | train |
ipfs/py-ipfs-api | ipfsapi/client.py | Client.add_str | def add_str(self, string, **kwargs):
"""Adds a Python string as a file to IPFS.
.. code-block:: python
>>> c.add_str(u"Mary had a little lamb")
'QmZfF6C9j4VtoCsTp4KSrhYH47QMd3DNXVZBKaxJdhaPab'
Also accepts and will stream generator objects.
Parameters
... | python | def add_str(self, string, **kwargs):
"""Adds a Python string as a file to IPFS.
.. code-block:: python
>>> c.add_str(u"Mary had a little lamb")
'QmZfF6C9j4VtoCsTp4KSrhYH47QMd3DNXVZBKaxJdhaPab'
Also accepts and will stream generator objects.
Parameters
... | [
"def",
"add_str",
"(",
"self",
",",
"string",
",",
"**",
"kwargs",
")",
":",
"body",
",",
"headers",
"=",
"multipart",
".",
"stream_text",
"(",
"string",
",",
"self",
".",
"chunk_size",
")",
"return",
"self",
".",
"_client",
".",
"request",
"(",
"'/add... | Adds a Python string as a file to IPFS.
.. code-block:: python
>>> c.add_str(u"Mary had a little lamb")
'QmZfF6C9j4VtoCsTp4KSrhYH47QMd3DNXVZBKaxJdhaPab'
Also accepts and will stream generator objects.
Parameters
----------
string : str
Cont... | [
"Adds",
"a",
"Python",
"string",
"as",
"a",
"file",
"to",
"IPFS",
"."
] | 7574dad04877b45dbe4ad321dcfa9e880eb2d90c | https://github.com/ipfs/py-ipfs-api/blob/7574dad04877b45dbe4ad321dcfa9e880eb2d90c/ipfsapi/client.py#L2133-L2154 | train |
ipfs/py-ipfs-api | ipfsapi/client.py | Client.add_json | def add_json(self, json_obj, **kwargs):
"""Adds a json-serializable Python dict as a json file to IPFS.
.. code-block:: python
>>> c.add_json({'one': 1, 'two': 2, 'three': 3})
'QmVz9g7m5u3oHiNKHj2CJX1dbG1gtismRS3g9NaPBBLbob'
Parameters
----------
json_o... | python | def add_json(self, json_obj, **kwargs):
"""Adds a json-serializable Python dict as a json file to IPFS.
.. code-block:: python
>>> c.add_json({'one': 1, 'two': 2, 'three': 3})
'QmVz9g7m5u3oHiNKHj2CJX1dbG1gtismRS3g9NaPBBLbob'
Parameters
----------
json_o... | [
"def",
"add_json",
"(",
"self",
",",
"json_obj",
",",
"**",
"kwargs",
")",
":",
"return",
"self",
".",
"add_bytes",
"(",
"encoding",
".",
"Json",
"(",
")",
".",
"encode",
"(",
"json_obj",
")",
",",
"**",
"kwargs",
")"
] | Adds a json-serializable Python dict as a json file to IPFS.
.. code-block:: python
>>> c.add_json({'one': 1, 'two': 2, 'three': 3})
'QmVz9g7m5u3oHiNKHj2CJX1dbG1gtismRS3g9NaPBBLbob'
Parameters
----------
json_obj : dict
A json-serializable Python di... | [
"Adds",
"a",
"json",
"-",
"serializable",
"Python",
"dict",
"as",
"a",
"json",
"file",
"to",
"IPFS",
"."
] | 7574dad04877b45dbe4ad321dcfa9e880eb2d90c | https://github.com/ipfs/py-ipfs-api/blob/7574dad04877b45dbe4ad321dcfa9e880eb2d90c/ipfsapi/client.py#L2156-L2173 | train |
ipfs/py-ipfs-api | ipfsapi/client.py | Client.add_pyobj | def add_pyobj(self, py_obj, **kwargs):
"""Adds a picklable Python object as a file to IPFS.
.. deprecated:: 0.4.2
The ``*_pyobj`` APIs allow for arbitrary code execution if abused.
Either switch to :meth:`~ipfsapi.Client.add_json` or use
``client.add_bytes(pickle.dumps(... | python | def add_pyobj(self, py_obj, **kwargs):
"""Adds a picklable Python object as a file to IPFS.
.. deprecated:: 0.4.2
The ``*_pyobj`` APIs allow for arbitrary code execution if abused.
Either switch to :meth:`~ipfsapi.Client.add_json` or use
``client.add_bytes(pickle.dumps(... | [
"def",
"add_pyobj",
"(",
"self",
",",
"py_obj",
",",
"**",
"kwargs",
")",
":",
"warnings",
".",
"warn",
"(",
"\"Using `*_pyobj` on untrusted data is a security risk\"",
",",
"DeprecationWarning",
")",
"return",
"self",
".",
"add_bytes",
"(",
"encoding",
".",
"Pick... | Adds a picklable Python object as a file to IPFS.
.. deprecated:: 0.4.2
The ``*_pyobj`` APIs allow for arbitrary code execution if abused.
Either switch to :meth:`~ipfsapi.Client.add_json` or use
``client.add_bytes(pickle.dumps(py_obj))`` instead.
Please see :meth:`~ip... | [
"Adds",
"a",
"picklable",
"Python",
"object",
"as",
"a",
"file",
"to",
"IPFS",
"."
] | 7574dad04877b45dbe4ad321dcfa9e880eb2d90c | https://github.com/ipfs/py-ipfs-api/blob/7574dad04877b45dbe4ad321dcfa9e880eb2d90c/ipfsapi/client.py#L2194-L2221 | train |
ipfs/py-ipfs-api | ipfsapi/client.py | Client.get_pyobj | def get_pyobj(self, multihash, **kwargs):
"""Loads a pickled Python object from IPFS.
.. deprecated:: 0.4.2
The ``*_pyobj`` APIs allow for arbitrary code execution if abused.
Either switch to :meth:`~ipfsapi.Client.get_json` or use
``pickle.loads(client.cat(multihash))`... | python | def get_pyobj(self, multihash, **kwargs):
"""Loads a pickled Python object from IPFS.
.. deprecated:: 0.4.2
The ``*_pyobj`` APIs allow for arbitrary code execution if abused.
Either switch to :meth:`~ipfsapi.Client.get_json` or use
``pickle.loads(client.cat(multihash))`... | [
"def",
"get_pyobj",
"(",
"self",
",",
"multihash",
",",
"**",
"kwargs",
")",
":",
"warnings",
".",
"warn",
"(",
"\"Using `*_pyobj` on untrusted data is a security risk\"",
",",
"DeprecationWarning",
")",
"return",
"self",
".",
"cat",
"(",
"multihash",
",",
"decode... | Loads a pickled Python object from IPFS.
.. deprecated:: 0.4.2
The ``*_pyobj`` APIs allow for arbitrary code execution if abused.
Either switch to :meth:`~ipfsapi.Client.get_json` or use
``pickle.loads(client.cat(multihash))`` instead.
.. caution::
The pic... | [
"Loads",
"a",
"pickled",
"Python",
"object",
"from",
"IPFS",
"."
] | 7574dad04877b45dbe4ad321dcfa9e880eb2d90c | https://github.com/ipfs/py-ipfs-api/blob/7574dad04877b45dbe4ad321dcfa9e880eb2d90c/ipfsapi/client.py#L2223-L2257 | train |
ipfs/py-ipfs-api | ipfsapi/client.py | Client.pubsub_peers | def pubsub_peers(self, topic=None, **kwargs):
"""List the peers we are pubsubbing with.
Lists the id's of other IPFS users who we
are connected to via some topic. Without specifying
a topic, IPFS peers from all subscribed topics
will be returned in the data. If a topic is specif... | python | def pubsub_peers(self, topic=None, **kwargs):
"""List the peers we are pubsubbing with.
Lists the id's of other IPFS users who we
are connected to via some topic. Without specifying
a topic, IPFS peers from all subscribed topics
will be returned in the data. If a topic is specif... | [
"def",
"pubsub_peers",
"(",
"self",
",",
"topic",
"=",
"None",
",",
"**",
"kwargs",
")",
":",
"args",
"=",
"(",
"topic",
",",
")",
"if",
"topic",
"is",
"not",
"None",
"else",
"(",
")",
"return",
"self",
".",
"_client",
".",
"request",
"(",
"'/pubsu... | List the peers we are pubsubbing with.
Lists the id's of other IPFS users who we
are connected to via some topic. Without specifying
a topic, IPFS peers from all subscribed topics
will be returned in the data. If a topic is specified
only the IPFS id's of the peers from the spec... | [
"List",
"the",
"peers",
"we",
"are",
"pubsubbing",
"with",
"."
] | 7574dad04877b45dbe4ad321dcfa9e880eb2d90c | https://github.com/ipfs/py-ipfs-api/blob/7574dad04877b45dbe4ad321dcfa9e880eb2d90c/ipfsapi/client.py#L2282-L2330 | train |
ipfs/py-ipfs-api | ipfsapi/client.py | Client.pubsub_pub | def pubsub_pub(self, topic, payload, **kwargs):
"""Publish a message to a given pubsub topic
Publishing will publish the given payload (string) to
everyone currently subscribed to the given topic.
All data (including the id of the publisher) is automatically
base64 encoded when... | python | def pubsub_pub(self, topic, payload, **kwargs):
"""Publish a message to a given pubsub topic
Publishing will publish the given payload (string) to
everyone currently subscribed to the given topic.
All data (including the id of the publisher) is automatically
base64 encoded when... | [
"def",
"pubsub_pub",
"(",
"self",
",",
"topic",
",",
"payload",
",",
"**",
"kwargs",
")",
":",
"args",
"=",
"(",
"topic",
",",
"payload",
")",
"return",
"self",
".",
"_client",
".",
"request",
"(",
"'/pubsub/pub'",
",",
"args",
",",
"decoder",
"=",
"... | Publish a message to a given pubsub topic
Publishing will publish the given payload (string) to
everyone currently subscribed to the given topic.
All data (including the id of the publisher) is automatically
base64 encoded when published.
.. code-block:: python
# ... | [
"Publish",
"a",
"message",
"to",
"a",
"given",
"pubsub",
"topic"
] | 7574dad04877b45dbe4ad321dcfa9e880eb2d90c | https://github.com/ipfs/py-ipfs-api/blob/7574dad04877b45dbe4ad321dcfa9e880eb2d90c/ipfsapi/client.py#L2332-L2359 | train |
ipfs/py-ipfs-api | ipfsapi/client.py | Client.pubsub_sub | def pubsub_sub(self, topic, discover=False, **kwargs):
"""Subscribe to mesages on a given topic
Subscribing to a topic in IPFS means anytime
a message is published to a topic, the subscribers
will be notified of the publication.
The connection with the pubsub topic is opened an... | python | def pubsub_sub(self, topic, discover=False, **kwargs):
"""Subscribe to mesages on a given topic
Subscribing to a topic in IPFS means anytime
a message is published to a topic, the subscribers
will be notified of the publication.
The connection with the pubsub topic is opened an... | [
"def",
"pubsub_sub",
"(",
"self",
",",
"topic",
",",
"discover",
"=",
"False",
",",
"**",
"kwargs",
")",
":",
"args",
"=",
"(",
"topic",
",",
"discover",
")",
"return",
"SubChannel",
"(",
"self",
".",
"_client",
".",
"request",
"(",
"'/pubsub/sub'",
",... | Subscribe to mesages on a given topic
Subscribing to a topic in IPFS means anytime
a message is published to a topic, the subscribers
will be notified of the publication.
The connection with the pubsub topic is opened and read.
The Subscription returned should be used inside a ... | [
"Subscribe",
"to",
"mesages",
"on",
"a",
"given",
"topic"
] | 7574dad04877b45dbe4ad321dcfa9e880eb2d90c | https://github.com/ipfs/py-ipfs-api/blob/7574dad04877b45dbe4ad321dcfa9e880eb2d90c/ipfsapi/client.py#L2361-L2409 | train |
ipfs/py-ipfs-api | ipfsapi/utils.py | guess_mimetype | def guess_mimetype(filename):
"""Guesses the mimetype of a file based on the given ``filename``.
.. code-block:: python
>>> guess_mimetype('example.txt')
'text/plain'
>>> guess_mimetype('/foo/bar/example')
'application/octet-stream'
Parameters
----------
filename :... | python | def guess_mimetype(filename):
"""Guesses the mimetype of a file based on the given ``filename``.
.. code-block:: python
>>> guess_mimetype('example.txt')
'text/plain'
>>> guess_mimetype('/foo/bar/example')
'application/octet-stream'
Parameters
----------
filename :... | [
"def",
"guess_mimetype",
"(",
"filename",
")",
":",
"fn",
"=",
"os",
".",
"path",
".",
"basename",
"(",
"filename",
")",
"return",
"mimetypes",
".",
"guess_type",
"(",
"fn",
")",
"[",
"0",
"]",
"or",
"'application/octet-stream'"
] | Guesses the mimetype of a file based on the given ``filename``.
.. code-block:: python
>>> guess_mimetype('example.txt')
'text/plain'
>>> guess_mimetype('/foo/bar/example')
'application/octet-stream'
Parameters
----------
filename : str
The file name or path fo... | [
"Guesses",
"the",
"mimetype",
"of",
"a",
"file",
"based",
"on",
"the",
"given",
"filename",
"."
] | 7574dad04877b45dbe4ad321dcfa9e880eb2d90c | https://github.com/ipfs/py-ipfs-api/blob/7574dad04877b45dbe4ad321dcfa9e880eb2d90c/ipfsapi/utils.py#L13-L29 | train |
ipfs/py-ipfs-api | ipfsapi/utils.py | ls_dir | def ls_dir(dirname):
"""Returns files and subdirectories within a given directory.
Returns a pair of lists, containing the names of directories and files
in ``dirname``.
Raises
------
OSError : Accessing the given directory path failed
Parameters
----------
dirname : str
T... | python | def ls_dir(dirname):
"""Returns files and subdirectories within a given directory.
Returns a pair of lists, containing the names of directories and files
in ``dirname``.
Raises
------
OSError : Accessing the given directory path failed
Parameters
----------
dirname : str
T... | [
"def",
"ls_dir",
"(",
"dirname",
")",
":",
"ls",
"=",
"os",
".",
"listdir",
"(",
"dirname",
")",
"files",
"=",
"[",
"p",
"for",
"p",
"in",
"ls",
"if",
"os",
".",
"path",
".",
"isfile",
"(",
"os",
".",
"path",
".",
"join",
"(",
"dirname",
",",
... | Returns files and subdirectories within a given directory.
Returns a pair of lists, containing the names of directories and files
in ``dirname``.
Raises
------
OSError : Accessing the given directory path failed
Parameters
----------
dirname : str
The path of the directory to ... | [
"Returns",
"files",
"and",
"subdirectories",
"within",
"a",
"given",
"directory",
"."
] | 7574dad04877b45dbe4ad321dcfa9e880eb2d90c | https://github.com/ipfs/py-ipfs-api/blob/7574dad04877b45dbe4ad321dcfa9e880eb2d90c/ipfsapi/utils.py#L32-L50 | train |
ipfs/py-ipfs-api | ipfsapi/utils.py | clean_files | def clean_files(files):
"""Generates tuples with a ``file``-like object and a close indicator.
This is a generator of tuples, where the first element is the file object
and the second element is a boolean which is True if this module opened the
file (and thus should close it).
Raises
------
... | python | def clean_files(files):
"""Generates tuples with a ``file``-like object and a close indicator.
This is a generator of tuples, where the first element is the file object
and the second element is a boolean which is True if this module opened the
file (and thus should close it).
Raises
------
... | [
"def",
"clean_files",
"(",
"files",
")",
":",
"if",
"isinstance",
"(",
"files",
",",
"(",
"list",
",",
"tuple",
")",
")",
":",
"for",
"f",
"in",
"files",
":",
"yield",
"clean_file",
"(",
"f",
")",
"else",
":",
"yield",
"clean_file",
"(",
"files",
"... | Generates tuples with a ``file``-like object and a close indicator.
This is a generator of tuples, where the first element is the file object
and the second element is a boolean which is True if this module opened the
file (and thus should close it).
Raises
------
OSError : Accessing the given... | [
"Generates",
"tuples",
"with",
"a",
"file",
"-",
"like",
"object",
"and",
"a",
"close",
"indicator",
"."
] | 7574dad04877b45dbe4ad321dcfa9e880eb2d90c | https://github.com/ipfs/py-ipfs-api/blob/7574dad04877b45dbe4ad321dcfa9e880eb2d90c/ipfsapi/utils.py#L75-L95 | train |
miguelgrinberg/Flask-Migrate | flask_migrate/cli.py | merge | def merge(directory, message, branch_label, rev_id, revisions):
"""Merge two revisions together, creating a new revision file"""
_merge(directory, revisions, message, branch_label, rev_id) | python | def merge(directory, message, branch_label, rev_id, revisions):
"""Merge two revisions together, creating a new revision file"""
_merge(directory, revisions, message, branch_label, rev_id) | [
"def",
"merge",
"(",
"directory",
",",
"message",
",",
"branch_label",
",",
"rev_id",
",",
"revisions",
")",
":",
"_merge",
"(",
"directory",
",",
"revisions",
",",
"message",
",",
"branch_label",
",",
"rev_id",
")"
] | Merge two revisions together, creating a new revision file | [
"Merge",
"two",
"revisions",
"together",
"creating",
"a",
"new",
"revision",
"file"
] | 65fbd978681bdf2eddf8940edd04ed7272a94480 | https://github.com/miguelgrinberg/Flask-Migrate/blob/65fbd978681bdf2eddf8940edd04ed7272a94480/flask_migrate/cli.py#L114-L116 | train |
miguelgrinberg/Flask-Migrate | flask_migrate/cli.py | downgrade | def downgrade(directory, sql, tag, x_arg, revision):
"""Revert to a previous version"""
_downgrade(directory, revision, sql, tag, x_arg) | python | def downgrade(directory, sql, tag, x_arg, revision):
"""Revert to a previous version"""
_downgrade(directory, revision, sql, tag, x_arg) | [
"def",
"downgrade",
"(",
"directory",
",",
"sql",
",",
"tag",
",",
"x_arg",
",",
"revision",
")",
":",
"_downgrade",
"(",
"directory",
",",
"revision",
",",
"sql",
",",
"tag",
",",
"x_arg",
")"
] | Revert to a previous version | [
"Revert",
"to",
"a",
"previous",
"version"
] | 65fbd978681bdf2eddf8940edd04ed7272a94480 | https://github.com/miguelgrinberg/Flask-Migrate/blob/65fbd978681bdf2eddf8940edd04ed7272a94480/flask_migrate/cli.py#L150-L152 | train |
miguelgrinberg/Flask-Migrate | flask_migrate/templates/flask-multidb/env.py | get_metadata | def get_metadata(bind):
"""Return the metadata for a bind."""
if bind == '':
bind = None
m = MetaData()
for t in target_metadata.tables.values():
if t.info.get('bind_key') == bind:
t.tometadata(m)
return m | python | def get_metadata(bind):
"""Return the metadata for a bind."""
if bind == '':
bind = None
m = MetaData()
for t in target_metadata.tables.values():
if t.info.get('bind_key') == bind:
t.tometadata(m)
return m | [
"def",
"get_metadata",
"(",
"bind",
")",
":",
"if",
"bind",
"==",
"''",
":",
"bind",
"=",
"None",
"m",
"=",
"MetaData",
"(",
")",
"for",
"t",
"in",
"target_metadata",
".",
"tables",
".",
"values",
"(",
")",
":",
"if",
"t",
".",
"info",
".",
"get"... | Return the metadata for a bind. | [
"Return",
"the",
"metadata",
"for",
"a",
"bind",
"."
] | 65fbd978681bdf2eddf8940edd04ed7272a94480 | https://github.com/miguelgrinberg/Flask-Migrate/blob/65fbd978681bdf2eddf8940edd04ed7272a94480/flask_migrate/templates/flask-multidb/env.py#L44-L52 | train |
miguelgrinberg/Flask-Migrate | flask_migrate/__init__.py | init | def init(directory=None, multidb=False):
"""Creates a new migration repository"""
if directory is None:
directory = current_app.extensions['migrate'].directory
config = Config()
config.set_main_option('script_location', directory)
config.config_file_name = os.path.join(directory, 'alembic.in... | python | def init(directory=None, multidb=False):
"""Creates a new migration repository"""
if directory is None:
directory = current_app.extensions['migrate'].directory
config = Config()
config.set_main_option('script_location', directory)
config.config_file_name = os.path.join(directory, 'alembic.in... | [
"def",
"init",
"(",
"directory",
"=",
"None",
",",
"multidb",
"=",
"False",
")",
":",
"if",
"directory",
"is",
"None",
":",
"directory",
"=",
"current_app",
".",
"extensions",
"[",
"'migrate'",
"]",
".",
"directory",
"config",
"=",
"Config",
"(",
")",
... | Creates a new migration repository | [
"Creates",
"a",
"new",
"migration",
"repository"
] | 65fbd978681bdf2eddf8940edd04ed7272a94480 | https://github.com/miguelgrinberg/Flask-Migrate/blob/65fbd978681bdf2eddf8940edd04ed7272a94480/flask_migrate/__init__.py#L122-L134 | train |
miguelgrinberg/Flask-Migrate | flask_migrate/__init__.py | edit | def edit(directory=None, revision='current'):
"""Edit current revision."""
if alembic_version >= (0, 8, 0):
config = current_app.extensions['migrate'].migrate.get_config(
directory)
command.edit(config, revision)
else:
raise RuntimeError('Alembic 0.8.0 or greater is requi... | python | def edit(directory=None, revision='current'):
"""Edit current revision."""
if alembic_version >= (0, 8, 0):
config = current_app.extensions['migrate'].migrate.get_config(
directory)
command.edit(config, revision)
else:
raise RuntimeError('Alembic 0.8.0 or greater is requi... | [
"def",
"edit",
"(",
"directory",
"=",
"None",
",",
"revision",
"=",
"'current'",
")",
":",
"if",
"alembic_version",
">=",
"(",
"0",
",",
"8",
",",
"0",
")",
":",
"config",
"=",
"current_app",
".",
"extensions",
"[",
"'migrate'",
"]",
".",
"migrate",
... | Edit current revision. | [
"Edit",
"current",
"revision",
"."
] | 65fbd978681bdf2eddf8940edd04ed7272a94480 | https://github.com/miguelgrinberg/Flask-Migrate/blob/65fbd978681bdf2eddf8940edd04ed7272a94480/flask_migrate/__init__.py#L226-L233 | train |
miguelgrinberg/Flask-Migrate | flask_migrate/__init__.py | merge | def merge(directory=None, revisions='', message=None, branch_label=None,
rev_id=None):
"""Merge two revisions together. Creates a new migration file"""
if alembic_version >= (0, 7, 0):
config = current_app.extensions['migrate'].migrate.get_config(
directory)
command.merge(... | python | def merge(directory=None, revisions='', message=None, branch_label=None,
rev_id=None):
"""Merge two revisions together. Creates a new migration file"""
if alembic_version >= (0, 7, 0):
config = current_app.extensions['migrate'].migrate.get_config(
directory)
command.merge(... | [
"def",
"merge",
"(",
"directory",
"=",
"None",
",",
"revisions",
"=",
"''",
",",
"message",
"=",
"None",
",",
"branch_label",
"=",
"None",
",",
"rev_id",
"=",
"None",
")",
":",
"if",
"alembic_version",
">=",
"(",
"0",
",",
"7",
",",
"0",
")",
":",
... | Merge two revisions together. Creates a new migration file | [
"Merge",
"two",
"revisions",
"together",
".",
"Creates",
"a",
"new",
"migration",
"file"
] | 65fbd978681bdf2eddf8940edd04ed7272a94480 | https://github.com/miguelgrinberg/Flask-Migrate/blob/65fbd978681bdf2eddf8940edd04ed7272a94480/flask_migrate/__init__.py#L249-L258 | train |
miguelgrinberg/Flask-Migrate | flask_migrate/__init__.py | heads | def heads(directory=None, verbose=False, resolve_dependencies=False):
"""Show current available heads in the script directory"""
if alembic_version >= (0, 7, 0):
config = current_app.extensions['migrate'].migrate.get_config(
directory)
command.heads(config, verbose=verbose,
... | python | def heads(directory=None, verbose=False, resolve_dependencies=False):
"""Show current available heads in the script directory"""
if alembic_version >= (0, 7, 0):
config = current_app.extensions['migrate'].migrate.get_config(
directory)
command.heads(config, verbose=verbose,
... | [
"def",
"heads",
"(",
"directory",
"=",
"None",
",",
"verbose",
"=",
"False",
",",
"resolve_dependencies",
"=",
"False",
")",
":",
"if",
"alembic_version",
">=",
"(",
"0",
",",
"7",
",",
"0",
")",
":",
"config",
"=",
"current_app",
".",
"extensions",
"[... | Show current available heads in the script directory | [
"Show",
"current",
"available",
"heads",
"in",
"the",
"script",
"directory"
] | 65fbd978681bdf2eddf8940edd04ed7272a94480 | https://github.com/miguelgrinberg/Flask-Migrate/blob/65fbd978681bdf2eddf8940edd04ed7272a94480/flask_migrate/__init__.py#L353-L361 | train |
miguelgrinberg/Flask-Migrate | flask_migrate/__init__.py | branches | def branches(directory=None, verbose=False):
"""Show current branch points"""
config = current_app.extensions['migrate'].migrate.get_config(directory)
if alembic_version >= (0, 7, 0):
command.branches(config, verbose=verbose)
else:
command.branches(config) | python | def branches(directory=None, verbose=False):
"""Show current branch points"""
config = current_app.extensions['migrate'].migrate.get_config(directory)
if alembic_version >= (0, 7, 0):
command.branches(config, verbose=verbose)
else:
command.branches(config) | [
"def",
"branches",
"(",
"directory",
"=",
"None",
",",
"verbose",
"=",
"False",
")",
":",
"config",
"=",
"current_app",
".",
"extensions",
"[",
"'migrate'",
"]",
".",
"migrate",
".",
"get_config",
"(",
"directory",
")",
"if",
"alembic_version",
">=",
"(",
... | Show current branch points | [
"Show",
"current",
"branch",
"points"
] | 65fbd978681bdf2eddf8940edd04ed7272a94480 | https://github.com/miguelgrinberg/Flask-Migrate/blob/65fbd978681bdf2eddf8940edd04ed7272a94480/flask_migrate/__init__.py#L370-L376 | train |
miguelgrinberg/Flask-Migrate | flask_migrate/__init__.py | current | def current(directory=None, verbose=False, head_only=False):
"""Display the current revision for each database."""
config = current_app.extensions['migrate'].migrate.get_config(directory)
if alembic_version >= (0, 7, 0):
command.current(config, verbose=verbose, head_only=head_only)
else:
... | python | def current(directory=None, verbose=False, head_only=False):
"""Display the current revision for each database."""
config = current_app.extensions['migrate'].migrate.get_config(directory)
if alembic_version >= (0, 7, 0):
command.current(config, verbose=verbose, head_only=head_only)
else:
... | [
"def",
"current",
"(",
"directory",
"=",
"None",
",",
"verbose",
"=",
"False",
",",
"head_only",
"=",
"False",
")",
":",
"config",
"=",
"current_app",
".",
"extensions",
"[",
"'migrate'",
"]",
".",
"migrate",
".",
"get_config",
"(",
"directory",
")",
"if... | Display the current revision for each database. | [
"Display",
"the",
"current",
"revision",
"for",
"each",
"database",
"."
] | 65fbd978681bdf2eddf8940edd04ed7272a94480 | https://github.com/miguelgrinberg/Flask-Migrate/blob/65fbd978681bdf2eddf8940edd04ed7272a94480/flask_migrate/__init__.py#L388-L394 | train |
bulkan/robotframework-requests | src/RequestsLibrary/RequestsKeywords.py | RequestsKeywords.to_json | def to_json(self, content, pretty_print=False):
""" Convert a string to a JSON object
``content`` String content to convert into JSON
``pretty_print`` If defined, will output JSON is pretty print format
"""
if PY3:
if isinstance(content, bytes):
cont... | python | def to_json(self, content, pretty_print=False):
""" Convert a string to a JSON object
``content`` String content to convert into JSON
``pretty_print`` If defined, will output JSON is pretty print format
"""
if PY3:
if isinstance(content, bytes):
cont... | [
"def",
"to_json",
"(",
"self",
",",
"content",
",",
"pretty_print",
"=",
"False",
")",
":",
"if",
"PY3",
":",
"if",
"isinstance",
"(",
"content",
",",
"bytes",
")",
":",
"content",
"=",
"content",
".",
"decode",
"(",
"encoding",
"=",
"'utf-8'",
")",
... | Convert a string to a JSON object
``content`` String content to convert into JSON
``pretty_print`` If defined, will output JSON is pretty print format | [
"Convert",
"a",
"string",
"to",
"a",
"JSON",
"object"
] | 11baa3277f1cb728712e26d996200703c15254a8 | https://github.com/bulkan/robotframework-requests/blob/11baa3277f1cb728712e26d996200703c15254a8/src/RequestsLibrary/RequestsKeywords.py#L460-L477 | train |
bulkan/robotframework-requests | src/RequestsLibrary/RequestsKeywords.py | RequestsKeywords.get_request | def get_request(
self,
alias,
uri,
headers=None,
json=None,
params=None,
allow_redirects=None,
timeout=None):
""" Send a GET request on the session object found using the
given `alias`
``alias`` that... | python | def get_request(
self,
alias,
uri,
headers=None,
json=None,
params=None,
allow_redirects=None,
timeout=None):
""" Send a GET request on the session object found using the
given `alias`
``alias`` that... | [
"def",
"get_request",
"(",
"self",
",",
"alias",
",",
"uri",
",",
"headers",
"=",
"None",
",",
"json",
"=",
"None",
",",
"params",
"=",
"None",
",",
"allow_redirects",
"=",
"None",
",",
"timeout",
"=",
"None",
")",
":",
"session",
"=",
"self",
".",
... | Send a GET request on the session object found using the
given `alias`
``alias`` that will be used to identify the Session object in the cache
``uri`` to send the GET request to
``params`` url parameters to append to the uri
``headers`` a dictionary of headers to use with the... | [
"Send",
"a",
"GET",
"request",
"on",
"the",
"session",
"object",
"found",
"using",
"the",
"given",
"alias"
] | 11baa3277f1cb728712e26d996200703c15254a8 | https://github.com/bulkan/robotframework-requests/blob/11baa3277f1cb728712e26d996200703c15254a8/src/RequestsLibrary/RequestsKeywords.py#L479-L515 | train |
bulkan/robotframework-requests | src/RequestsLibrary/RequestsKeywords.py | RequestsKeywords.post_request | def post_request(
self,
alias,
uri,
data=None,
json=None,
params=None,
headers=None,
files=None,
allow_redirects=None,
timeout=None):
""" Send a POST request on the session object found using ... | python | def post_request(
self,
alias,
uri,
data=None,
json=None,
params=None,
headers=None,
files=None,
allow_redirects=None,
timeout=None):
""" Send a POST request on the session object found using ... | [
"def",
"post_request",
"(",
"self",
",",
"alias",
",",
"uri",
",",
"data",
"=",
"None",
",",
"json",
"=",
"None",
",",
"params",
"=",
"None",
",",
"headers",
"=",
"None",
",",
"files",
"=",
"None",
",",
"allow_redirects",
"=",
"None",
",",
"timeout",... | Send a POST request on the session object found using the
given `alias`
``alias`` that will be used to identify the Session object in the cache
``uri`` to send the POST request to
``data`` a dictionary of key-value pairs that will be urlencoded
and sent as POST data
... | [
"Send",
"a",
"POST",
"request",
"on",
"the",
"session",
"object",
"found",
"using",
"the",
"given",
"alias"
] | 11baa3277f1cb728712e26d996200703c15254a8 | https://github.com/bulkan/robotframework-requests/blob/11baa3277f1cb728712e26d996200703c15254a8/src/RequestsLibrary/RequestsKeywords.py#L550-L607 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.