id stringlengths 24 24 | repo stringlengths 7 52 | path stringlengths 5 138 | func_name stringlengths 1 134 | url stringlengths 89 242 | split stringclasses 3
values | language stringclasses 1
value | docstring stringlengths 1 46.9k | code stringlengths 87 104k | text stringlengths 100 112k | token_count int32 25 38.1k | doc_chars int32 1 46.9k | code_chars int32 87 104k | license_basis stringclasses 1
value | source stringclasses 1
value | added stringdate 2026-12-05 00:00:00 2026-12-05 00:00:00 | record_sha256 stringlengths 64 64 | license stringclasses 9
values | license_class stringclasses 1
value | license_source stringlengths 46 99 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
9ed0ed36227c353a2051f316 | letuananh/chirptext | chirptext/texttaglib.py | Document.get | https://github.com/letuananh/chirptext/blob/ce60b47257b272a587c8703ea1f86cd1a45553a7/chirptext/texttaglib.py#L588-L598 | train | python | If sent_id exists, remove and return the associated sentence object else return default.
If no default is provided, KeyError will be raised. | def get(self, sent_id, **kwargs):
''' If sent_id exists, remove and return the associated sentence object else return default.
If no default is provided, KeyError will be raised.'''
if sent_id is not None and not isinstance(sent_id, int):
sent_id = int(sent_id)
if sent_id is ... | If sent_id exists, remove and return the associated sentence object else return default.
If no default is provided, KeyError will be raised.
def get(self, sent_id, **kwargs):
''' If sent_id exists, remove and return the associated sentence object else return default.
If no default is provided, ... | 146 | 148 | 563 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | c1b943d89f343182ebbabe378c691b88328d76e49cd6bb5cce7960164cbc9eaa | MIT | permissive | https://github.com/letuananh/chirptext/blob/main/LICENSE |
428b04657e6fb5056e6ace4b | letuananh/chirptext | chirptext/texttaglib.py | Document.add_sent | https://github.com/letuananh/chirptext/blob/ce60b47257b272a587c8703ea1f86cd1a45553a7/chirptext/texttaglib.py#L603-L614 | train | python | Add a ttl.Sentence object to this document | def add_sent(self, sent_obj):
''' Add a ttl.Sentence object to this document '''
if sent_obj is None:
raise Exception("Sentence object cannot be None")
elif sent_obj.ID is None:
# if sentID is None, create a new ID
sent_obj.ID = next(self.__idgen)
elif... | Add a ttl.Sentence object to this document
def add_sent(self, sent_obj):
''' Add a ttl.Sentence object to this document '''
if sent_obj is None:
raise Exception("Sentence object cannot be None")
elif sent_obj.ID is None:
# if sentID is None, create a new ID
s... | 129 | 42 | 529 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | 5e3847d4e5a4f06ace334052306cd6abd9caa966dc5e64c0f73f516b2bd90c2c | MIT | permissive | https://github.com/letuananh/chirptext/blob/main/LICENSE |
4c5c5ced2de3112ded4c11ea | letuananh/chirptext | chirptext/texttaglib.py | Document.new_sent | https://github.com/letuananh/chirptext/blob/ce60b47257b272a587c8703ea1f86cd1a45553a7/chirptext/texttaglib.py#L616-L620 | train | python | Create a new sentence and add it to this Document | def new_sent(self, text, ID=None, **kwargs):
''' Create a new sentence and add it to this Document '''
if ID is None:
ID = next(self.__idgen)
return self.add_sent(Sentence(text, ID=ID, **kwargs)) | Create a new sentence and add it to this Document
def new_sent(self, text, ID=None, **kwargs):
''' Create a new sentence and add it to this Document '''
if ID is None:
ID = next(self.__idgen)
return self.add_sent(Sentence(text, ID=ID, **kwargs)) | 68 | 49 | 231 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | 5096a8e1c68a0ac68f0f93b7ffdf7567365045707f73f232b2dd2584c9647680 | MIT | permissive | https://github.com/letuananh/chirptext/blob/main/LICENSE |
c9eaed9b1b8321cce32e336d | letuananh/chirptext | chirptext/texttaglib.py | Document.pop | https://github.com/letuananh/chirptext/blob/ce60b47257b272a587c8703ea1f86cd1a45553a7/chirptext/texttaglib.py#L622-L637 | train | python | If sent_id exists, remove and return the associated sentence object else return default.
If no default is provided, KeyError will be raised. | def pop(self, sent_id, **kwargs):
''' If sent_id exists, remove and return the associated sentence object else return default.
If no default is provided, KeyError will be raised.'''
if sent_id is not None and not isinstance(sent_id, int):
sent_id = int(sent_id)
if not self.ha... | If sent_id exists, remove and return the associated sentence object else return default.
If no default is provided, KeyError will be raised.
def pop(self, sent_id, **kwargs):
''' If sent_id exists, remove and return the associated sentence object else return default.
If no default is provided, ... | 171 | 148 | 709 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | df4b0707f0d3612667c47085b584c31896ca6f10003f2c436f60cd1496858340 | MIT | permissive | https://github.com/letuananh/chirptext/blob/main/LICENSE |
40f1cbb549aca8d71b64c6e2 | letuananh/chirptext | chirptext/texttaglib.py | Document.read | https://github.com/letuananh/chirptext/blob/ce60b47257b272a587c8703ea1f86cd1a45553a7/chirptext/texttaglib.py#L639-L644 | train | python | Read tagged doc from mutliple files (sents, tokens, concepts, links, tags) | def read(self):
''' Read tagged doc from mutliple files (sents, tokens, concepts, links, tags) '''
warnings.warn("Document.read() is deprecated and will be removed in near future.", DeprecationWarning)
with TxtReader.from_doc(self) as reader:
reader.read(self)
return self | Read tagged doc from mutliple files (sents, tokens, concepts, links, tags)
def read(self):
''' Read tagged doc from mutliple files (sents, tokens, concepts, links, tags) '''
warnings.warn("Document.read() is deprecated and will be removed in near future.", DeprecationWarning)
with TxtReader.fro... | 88 | 74 | 316 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | 4fce08e38d3be96aa00e1a15767cbba6421249e6518708687ebed362d9ef58c6 | MIT | permissive | https://github.com/letuananh/chirptext/blob/main/LICENSE |
bf23c27b6eafd814c8af7043 | letuananh/chirptext | chirptext/texttaglib.py | Document.read_ttl | https://github.com/letuananh/chirptext/blob/ce60b47257b272a587c8703ea1f86cd1a45553a7/chirptext/texttaglib.py#L647-L654 | train | python | Helper function to read Document in TTL-TXT format (i.e. ${docname}_*.txt)
E.g. Document.read_ttl('~/data/myfile') is the same as Document('myfile', '~/data/').read() | def read_ttl(path):
''' Helper function to read Document in TTL-TXT format (i.e. ${docname}_*.txt)
E.g. Document.read_ttl('~/data/myfile') is the same as Document('myfile', '~/data/').read()
'''
warnings.warn("Document.read_ttl() is deprecated and will be removed in near future. Use read... | Helper function to read Document in TTL-TXT format (i.e. ${docname}_*.txt)
E.g. Document.read_ttl('~/data/myfile') is the same as Document('myfile', '~/data/').read()
def read_ttl(path):
''' Helper function to read Document in TTL-TXT format (i.e. ${docname}_*.txt)
E.g. Document.read_ttl('~/dat... | 162 | 174 | 486 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | 7d4526db3c5bc2632dae02c191b0970527cbd6322970f941e9d10a4787b7660b | MIT | permissive | https://github.com/letuananh/chirptext/blob/main/LICENSE |
75018b026aceb687a0aec1e9 | letuananh/chirptext | chirptext/texttaglib.py | TxtReader.read | https://github.com/letuananh/chirptext/blob/ce60b47257b272a587c8703ea1f86cd1a45553a7/chirptext/texttaglib.py#L723-L792 | train | python | Read tagged doc from mutliple files (sents, tokens, concepts, links, tags) | def read(self, doc=None):
''' Read tagged doc from mutliple files (sents, tokens, concepts, links, tags) '''
if not self.sent_stream:
raise Exception("There is no sentence data stream available")
if doc is None:
doc = Document(name=self.doc_name, path=self.doc_path)
... | Read tagged doc from mutliple files (sents, tokens, concepts, links, tags)
def read(self, doc=None):
''' Read tagged doc from mutliple files (sents, tokens, concepts, links, tags) '''
if not self.sent_stream:
raise Exception("There is no sentence data stream available")
if doc is No... | 698 | 74 | 3,207 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | 33be094aa291a7e77170e48f21f72356812ee037a4aef08d32a6a76248f6637a | MIT | permissive | https://github.com/letuananh/chirptext/blob/main/LICENSE |
2301b29e88a7d6f93769e8e8 | alefnula/tea | tea/console/format.py | format_page | https://github.com/alefnula/tea/blob/f5a0a724a425ec4f9dd2c7fe966ef06faf3a15a3/tea/console/format.py#L16-L30 | train | python | Format the text for output adding ASCII frame around the text.
Args:
text (str): Text that needs to be formatted.
Returns:
str: Formatted string. | def format_page(text):
"""Format the text for output adding ASCII frame around the text.
Args:
text (str): Text that needs to be formatted.
Returns:
str: Formatted string.
"""
width = max(map(len, text.splitlines()))
page = "+-" + "-" * width + "-+\n"
for line in... | Format the text for output adding ASCII frame around the text.
Args:
text (str): Text that needs to be formatted.
Returns:
str: Formatted string.
def format_page(text):
"""Format the text for output adding ASCII frame around the text.
Args:
text (str): Text that nee... | 149 | 177 | 448 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | 8db4637f5a481cd896f2478928e95ccf5c35306faf85400352add0d2c8096525 | Apache-2.0 | permissive | https://github.com/alefnula/tea/blob/develop/LICENSE |
d8fb28846ee4106eb1d47a91 | alefnula/tea | tea/console/format.py | table | https://github.com/alefnula/tea/blob/f5a0a724a425ec4f9dd2c7fe966ef06faf3a15a3/tea/console/format.py#L33-L82 | train | python | Format the text as a table.
Text in format:
first | second
row 2 col 1 | 4
Will be formatted as::
+-------------+--------+
| first | second |
+-------------+--------+
| row 2 col 1 | 4 |
+-------------+--------+
Args:
te... | def table(text):
"""Format the text as a table.
Text in format:
first | second
row 2 col 1 | 4
Will be formatted as::
+-------------+--------+
| first | second |
+-------------+--------+
| row 2 col 1 | 4 |
+-------------+--------+... | Format the text as a table.
Text in format:
first | second
row 2 col 1 | 4
Will be formatted as::
+-------------+--------+
| first | second |
+-------------+--------+
| row 2 col 1 | 4 |
+-------------+--------+
Args:
te... | 436 | 410 | 1,390 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | b395e8460e1d0c030625179fe4eb028f82aeed28658e3ee23d76e6ba3abf7d5c | Apache-2.0 | permissive | https://github.com/alefnula/tea/blob/develop/LICENSE |
c4558b237cd9abaffdfe2d15 | alefnula/tea | tea/console/format.py | print_page | https://github.com/alefnula/tea/blob/f5a0a724a425ec4f9dd2c7fe966ef06faf3a15a3/tea/console/format.py#L97-L123 | train | python | Format the text and prints it on stdout.
Text is formatted by adding a ASCII frame around it and coloring the text.
Colors can be added to text using color tags, for example:
My [FG_BLUE]blue[NORMAL] text.
My [BG_BLUE]blue background[NORMAL] text. | def print_page(text):
"""Format the text and prints it on stdout.
Text is formatted by adding a ASCII frame around it and coloring the text.
Colors can be added to text using color tags, for example:
My [FG_BLUE]blue[NORMAL] text.
My [BG_BLUE]blue background[NORMAL] text.
"""
... | Format the text and prints it on stdout.
Text is formatted by adding a ASCII frame around it and coloring the text.
Colors can be added to text using color tags, for example:
My [FG_BLUE]blue[NORMAL] text.
My [BG_BLUE]blue background[NORMAL] text.
def print_page(text):
"""Format th... | 311 | 279 | 1,044 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | b4afc13839b4ee3083ebc703fb5b766835cd0bf8abb38bc2fbfaba00229ff095 | Apache-2.0 | permissive | https://github.com/alefnula/tea/blob/develop/LICENSE |
1b408771ad5d3f307fbc95c6 | alefnula/tea | tea/console/format.py | wrap_text | https://github.com/alefnula/tea/blob/f5a0a724a425ec4f9dd2c7fe966ef06faf3a15a3/tea/console/format.py#L126-L142 | train | python | Wrap text lines to maximum *width* characters.
Wrapped text is aligned against the left text border.
Args:
text (str): Text to wrap.
width (int): Maximum number of characters per line.
Returns:
str: Wrapped text. | def wrap_text(text, width=80):
"""Wrap text lines to maximum *width* characters.
Wrapped text is aligned against the left text border.
Args:
text (str): Text to wrap.
width (int): Maximum number of characters per line.
Returns:
str: Wrapped text.
"""
text =... | Wrap text lines to maximum *width* characters.
Wrapped text is aligned against the left text border.
Args:
text (str): Text to wrap.
width (int): Maximum number of characters per line.
Returns:
str: Wrapped text.
def wrap_text(text, width=80):
"""Wrap text lines to ... | 164 | 260 | 490 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | 04a8e3c446337a5569e9ee2ecd18aaf48462601a1eb44491af692ffe738226e5 | Apache-2.0 | permissive | https://github.com/alefnula/tea/blob/develop/LICENSE |
de4f2554eeaadbe8b03b1872 | alefnula/tea | tea/console/format.py | rjust_text | https://github.com/alefnula/tea/blob/f5a0a724a425ec4f9dd2c7fe966ef06faf3a15a3/tea/console/format.py#L145-L168 | train | python | Wrap text and adjust it to right border.
Same as L{wrap_text} with the difference that the text is aligned against
the right text border.
Args:
text (str): Text to wrap and align.
width (int): Maximum number of characters per line.
indent (int): Indentation of the first lin... | def rjust_text(text, width=80, indent=0, subsequent=None):
"""Wrap text and adjust it to right border.
Same as L{wrap_text} with the difference that the text is aligned against
the right text border.
Args:
text (str): Text to wrap and align.
width (int): Maximum number of chara... | Wrap text and adjust it to right border.
Same as L{wrap_text} with the difference that the text is aligned against
the right text border.
Args:
text (str): Text to wrap and align.
width (int): Maximum number of characters per line.
indent (int): Indentation of the first lin... | 313 | 478 | 923 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | 3be90aa71a55d7ffd54893cf5d74a13645d928c050d3cff7dcd893cb0c7f5348 | Apache-2.0 | permissive | https://github.com/alefnula/tea/blob/develop/LICENSE |
96576a04536d3311798ace89 | alefnula/tea | tea/console/format.py | center_text | https://github.com/alefnula/tea/blob/f5a0a724a425ec4f9dd2c7fe966ef06faf3a15a3/tea/console/format.py#L171-L187 | train | python | Center all lines of the text.
It is assumed that all lines width is smaller then B{width}, because the
line width will not be checked.
Args:
text (str): Text to wrap.
width (int): Maximum number of characters per line.
Returns:
str: Centered text. | def center_text(text, width=80):
"""Center all lines of the text.
It is assumed that all lines width is smaller then B{width}, because the
line width will not be checked.
Args:
text (str): Text to wrap.
width (int): Maximum number of characters per line.
Returns:
... | Center all lines of the text.
It is assumed that all lines width is smaller then B{width}, because the
line width will not be checked.
Args:
text (str): Text to wrap.
width (int): Maximum number of characters per line.
Returns:
str: Centered text.
def center_text(te... | 175 | 300 | 482 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | a8f750b7ae95f47fd77344d91b481257fc023c8a936602d60c06c43c3a99671a | Apache-2.0 | permissive | https://github.com/alefnula/tea/blob/develop/LICENSE |
8a9e862c0551885cdc0a9293 | RI-imaging/qpimage | qpimage/integrity_check.py | check | https://github.com/RI-imaging/qpimage/blob/863c0fce5735b4c0ae369f75c0df9a33411b2bb2/qpimage/integrity_check.py#L13-L45 | train | python | Checks various properties of a :class:`qpimage.core.QPImage` instance
Parameters
----------
qpi_or_h5file: qpimage.core.QPImage or str
A QPImage object or a path to an hdf5 file
checks: list of str
Which checks to perform ("attributes" and/or "background")
Raises
------
Int... | def check(qpi_or_h5file, checks=["attributes", "background"]):
"""Checks various properties of a :class:`qpimage.core.QPImage` instance
Parameters
----------
qpi_or_h5file: qpimage.core.QPImage or str
A QPImage object or a path to an hdf5 file
checks: list of str
Which checks to per... | Checks various properties of a :class:`qpimage.core.QPImage` instance
Parameters
----------
qpi_or_h5file: qpimage.core.QPImage or str
A QPImage object or a path to an hdf5 file
checks: list of str
Which checks to perform ("attributes" and/or "background")
Raises
------
Int... | 335 | 363 | 955 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | cbe9bf24932620d7e15a6e702bd8ccb1a6732bbe1434d971459bc06219f51283 | MIT | permissive | https://github.com/RI-imaging/qpimage/blob/master/LICENSE |
82c4ecf425d383d8e59beea7 | RI-imaging/qpimage | qpimage/integrity_check.py | check_attributes | https://github.com/RI-imaging/qpimage/blob/863c0fce5735b4c0ae369f75c0df9a33411b2bb2/qpimage/integrity_check.py#L48-L67 | train | python | Check QPimage attributes
Parameters
----------
qpi: qpimage.core.QPImage
Raises
------
IntegrityCheckError
if the check fails | def check_attributes(qpi):
"""Check QPimage attributes
Parameters
----------
qpi: qpimage.core.QPImage
Raises
------
IntegrityCheckError
if the check fails
"""
missing_attrs = []
for key in DATA_KEYS:
if key not in qpi.meta:
missing_attrs.append(key)... | Check QPimage attributes
Parameters
----------
qpi: qpimage.core.QPImage
Raises
------
IntegrityCheckError
if the check fails
def check_attributes(qpi):
"""Check QPimage attributes
Parameters
----------
qpi: qpimage.core.QPImage
Raises
------
IntegrityChe... | 153 | 159 | 484 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | b8d775fcba7d4d9f5aa72c61ba38add635677ceb2fd034b13debc782d28fdcc5 | MIT | permissive | https://github.com/RI-imaging/qpimage/blob/master/LICENSE |
45958397cc016b453a3edd9a | RI-imaging/qpimage | qpimage/integrity_check.py | check_background | https://github.com/RI-imaging/qpimage/blob/863c0fce5735b4c0ae369f75c0df9a33411b2bb2/qpimage/integrity_check.py#L70-L115 | train | python | Check QPimage background data
Parameters
----------
qpi: qpimage.core.QPImage
Raises
------
IntegrityCheckError
if the check fails | def check_background(qpi):
"""Check QPimage background data
Parameters
----------
qpi: qpimage.core.QPImage
Raises
------
IntegrityCheckError
if the check fails
"""
for imdat in [qpi._amp, qpi._pha]:
try:
fit, attrs = imdat.get_bg(key="fit", ret_attrs=Tr... | Check QPimage background data
Parameters
----------
qpi: qpimage.core.QPImage
Raises
------
IntegrityCheckError
if the check fails
def check_background(qpi):
"""Check QPimage background data
Parameters
----------
qpi: qpimage.core.QPImage
Raises
------
In... | 376 | 164 | 1,579 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | 73533c4dfe3e871e2a1606a07924675013c05dca81d7efdda0cac3fa4706ae3a | MIT | permissive | https://github.com/RI-imaging/qpimage/blob/master/LICENSE |
fc048bfaef5f7dab1be501e0 | RI-imaging/qpimage | qpimage/image_data.py | write_image_dataset | https://github.com/RI-imaging/qpimage/blob/863c0fce5735b4c0ae369f75c0df9a33411b2bb2/qpimage/image_data.py#L326-L369 | train | python | Write an image to an hdf5 group as a dataset
This convenience function sets all attributes such that the image
can be visualized with HDFView, sets the compression and fletcher32
filters, and sets the chunk size to the image shape.
Parameters
----------
group: h5py.Group
HDF5 group to ... | def write_image_dataset(group, key, data, h5dtype=None):
"""Write an image to an hdf5 group as a dataset
This convenience function sets all attributes such that the image
can be visualized with HDFView, sets the compression and fletcher32
filters, and sets the chunk size to the image shape.
Parame... | Write an image to an hdf5 group as a dataset
This convenience function sets all attributes such that the image
can be visualized with HDFView, sets the compression and fletcher32
filters, and sets the chunk size to the image shape.
Parameters
----------
group: h5py.Group
HDF5 group to ... | 477 | 647 | 1,388 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | 61d9d609c8bf124fda41857c6685315a203d00b1181d76937e58dd1155f062f5 | MIT | permissive | https://github.com/RI-imaging/qpimage/blob/master/LICENSE |
4eee685fcd6a2a75511438b8 | RI-imaging/qpimage | qpimage/image_data.py | ImageData.info | https://github.com/RI-imaging/qpimage/blob/863c0fce5735b4c0ae369f75c0df9a33411b2bb2/qpimage/image_data.py#L96-L122 | train | python | list of background correction parameters | def info(self):
"""list of background correction parameters"""
info = []
name = self.__class__.__name__.lower()
# get bg information
for key in VALID_BG_KEYS:
if key in self.h5["bg_data"]:
attrs = self.h5["bg_data"][key].attrs
for akey ... | list of background correction parameters
def info(self):
"""list of background correction parameters"""
info = []
name = self.__class__.__name__.lower()
# get bg information
for key in VALID_BG_KEYS:
if key in self.h5["bg_data"]:
attrs = self.h5["bg_d... | 261 | 40 | 1,228 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | efea33bc895c4f2f3f5e7632a7ac4a68e2d335094038d7e632051ec75924cedc | MIT | permissive | https://github.com/RI-imaging/qpimage/blob/master/LICENSE |
060de03b8dbbc7669ee946bd | RI-imaging/qpimage | qpimage/image_data.py | ImageData.del_bg | https://github.com/RI-imaging/qpimage/blob/863c0fce5735b4c0ae369f75c0df9a33411b2bb2/qpimage/image_data.py#L129-L143 | train | python | Remove the background image data
Parameters
----------
key: str
One of :const:`VALID_BG_KEYS` | def del_bg(self, key):
"""Remove the background image data
Parameters
----------
key: str
One of :const:`VALID_BG_KEYS`
"""
if key not in VALID_BG_KEYS:
raise ValueError("Invalid bg key: {}".format(key))
if key in self.h5["bg_data"]:
... | Remove the background image data
Parameters
----------
key: str
One of :const:`VALID_BG_KEYS`
def del_bg(self, key):
"""Remove the background image data
Parameters
----------
key: str
One of :const:`VALID_BG_KEYS`
"""
if ... | 133 | 130 | 473 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | b191d175fc020af9d3754a034a8807b8a32ddc607b2acbfdfb16f32353f3df38 | MIT | permissive | https://github.com/RI-imaging/qpimage/blob/master/LICENSE |
7017846cb530c4ea392da665 | RI-imaging/qpimage | qpimage/image_data.py | ImageData.estimate_bg | https://github.com/RI-imaging/qpimage/blob/863c0fce5735b4c0ae369f75c0df9a33411b2bb2/qpimage/image_data.py#L145-L206 | train | python | Estimate image background
Parameters
----------
fit_profile: str
The type of background profile to fit:
- "offset": offset only
- "poly2o": 2D 2nd order polynomial with mixed terms
- "tilt": 2D linear tilt with offset (default)
fit_offset... | def estimate_bg(self, fit_offset="mean", fit_profile="tilt",
border_px=0, from_mask=None, ret_mask=False):
"""Estimate image background
Parameters
----------
fit_profile: str
The type of background profile to fit:
- "offset": offset only
... | Estimate image background
Parameters
----------
fit_profile: str
The type of background profile to fit:
- "offset": offset only
- "poly2o": 2D 2nd order polynomial with mixed terms
- "tilt": 2D linear tilt with offset (default)
fit_offset... | 819 | 1,449 | 2,548 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | 132480d26cb9d9bdd7fd05e162c48822a82e89ae35c54ca1e0e9417e73448365 | MIT | permissive | https://github.com/RI-imaging/qpimage/blob/master/LICENSE |
8884b393938580796534f5be | RI-imaging/qpimage | qpimage/image_data.py | ImageData.get_bg | https://github.com/RI-imaging/qpimage/blob/863c0fce5735b4c0ae369f75c0df9a33411b2bb2/qpimage/image_data.py#L208-L242 | train | python | Get the background data
Parameters
----------
key: None or str
A user-defined key that identifies the background data.
Examples are "data" for experimental data, or "fit"
for an estimated background correction
(see :const:`VALID_BG_KEYS`). If set ... | def get_bg(self, key=None, ret_attrs=False):
"""Get the background data
Parameters
----------
key: None or str
A user-defined key that identifies the background data.
Examples are "data" for experimental data, or "fit"
for an estimated background corr... | Get the background data
Parameters
----------
key: None or str
A user-defined key that identifies the background data.
Examples are "data" for experimental data, or "fit"
for an estimated background correction
(see :const:`VALID_BG_KEYS`). If set ... | 378 | 493 | 1,461 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | d39e1aff6da1206702fb3fdfd4fe3e37333264a17ada5138807e6d7db07b7cdf | MIT | permissive | https://github.com/RI-imaging/qpimage/blob/master/LICENSE |
4d763a25773db00ce5fb1d57 | RI-imaging/qpimage | qpimage/image_data.py | ImageData.set_bg | https://github.com/RI-imaging/qpimage/blob/863c0fce5735b4c0ae369f75c0df9a33411b2bb2/qpimage/image_data.py#L244-L283 | train | python | Set the background data
Parameters
----------
bg: numbers.Real, 2d ndarray, ImageData, or h5py.Dataset
The background data. If `bg` is an `h5py.Dataset` object,
it must exist in the same hdf5 file (a hard link is created).
If set to `None`, the data will be r... | def set_bg(self, bg, key="data", attrs={}):
"""Set the background data
Parameters
----------
bg: numbers.Real, 2d ndarray, ImageData, or h5py.Dataset
The background data. If `bg` is an `h5py.Dataset` object,
it must exist in the same hdf5 file (a hard link is cre... | Set the background data
Parameters
----------
bg: numbers.Real, 2d ndarray, ImageData, or h5py.Dataset
The background data. If `bg` is an `h5py.Dataset` object,
it must exist in the same hdf5 file (a hard link is created).
If set to `None`, the data will be r... | 478 | 525 | 1,654 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | 66f65d27bd26554bd8873c8bb3811523edd081c1eeb81864495e0e5ae3f8dec9 | MIT | permissive | https://github.com/RI-imaging/qpimage/blob/master/LICENSE |
a728550b6dbc6946a69694a4 | RI-imaging/qpimage | qpimage/image_data.py | Amplitude._bg_combine | https://github.com/RI-imaging/qpimage/blob/863c0fce5735b4c0ae369f75c0df9a33411b2bb2/qpimage/image_data.py#L293-L299 | train | python | Combine several background amplitude images | def _bg_combine(self, bgs):
"""Combine several background amplitude images"""
out = np.ones(self.h5["raw"].shape, dtype=float)
# bg is an h5py.DataSet
for bg in bgs:
out *= bg[:]
return out | Combine several background amplitude images
def _bg_combine(self, bgs):
"""Combine several background amplitude images"""
out = np.ones(self.h5["raw"].shape, dtype=float)
# bg is an h5py.DataSet
for bg in bgs:
out *= bg[:]
return out | 65 | 43 | 241 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | f3059ed10a810e00ed8cff26bc2f06cc623d4dcb48ede5fd4c7a459dfaa31f37 | MIT | permissive | https://github.com/RI-imaging/qpimage/blob/master/LICENSE |
53f09c38b180adaa504e25a0 | RI-imaging/qpimage | qpimage/bg_estimate.py | estimate | https://github.com/RI-imaging/qpimage/blob/863c0fce5735b4c0ae369f75c0df9a33411b2bb2/qpimage/bg_estimate.py#L11-L100 | train | python | Estimate the background value of an image
Parameters
----------
data: np.ndarray
Data from which to compute the background value
fit_profile: str
The type of background profile to fit:
- "offset": offset only
- "poly2o": 2D 2nd order polynomial with mixed terms
... | def estimate(data, fit_offset="mean", fit_profile="tilt",
border_px=0, from_mask=None, ret_mask=False):
"""Estimate the background value of an image
Parameters
----------
data: np.ndarray
Data from which to compute the background value
fit_profile: str
The type of backg... | Estimate the background value of an image
Parameters
----------
data: np.ndarray
Data from which to compute the background value
fit_profile: str
The type of background profile to fit:
- "offset": offset only
- "poly2o": 2D 2nd order polynomial with mixed terms
... | 1,067 | 1,245 | 3,173 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | 9754ae2e62b0123804da369000c42b967af3844f3297caed20802d6744936508 | MIT | permissive | https://github.com/RI-imaging/qpimage/blob/master/LICENSE |
67d1594f065a68ada7ede0d6 | RI-imaging/qpimage | qpimage/bg_estimate.py | offset_gaussian | https://github.com/RI-imaging/qpimage/blob/863c0fce5735b4c0ae369f75c0df9a33411b2bb2/qpimage/bg_estimate.py#L103-L116 | train | python | Fit a gaussian model to `data` and return its center | def offset_gaussian(data):
"""Fit a gaussian model to `data` and return its center"""
nbins = 2 * int(np.ceil(np.sqrt(data.size)))
mind, maxd = data.min(), data.max()
drange = (mind - (maxd - mind) / 2, maxd + (maxd - mind) / 2)
histo = np.histogram(data, nbins, density=True, range=drange)
dx = ... | Fit a gaussian model to `data` and return its center
def offset_gaussian(data):
"""Fit a gaussian model to `data` and return its center"""
nbins = 2 * int(np.ceil(np.sqrt(data.size)))
mind, maxd = data.min(), data.max()
drange = (mind - (maxd - mind) / 2, maxd + (maxd - mind) / 2)
histo = np.histog... | 199 | 52 | 560 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | 4ece4ebde7bcf04886d95d8b2ba88c73cf9487bade7324fea5a89056f0fb7a25 | MIT | permissive | https://github.com/RI-imaging/qpimage/blob/master/LICENSE |
a5910857e89de1020b68647d | RI-imaging/qpimage | qpimage/bg_estimate.py | offset_mode | https://github.com/RI-imaging/qpimage/blob/863c0fce5735b4c0ae369f75c0df9a33411b2bb2/qpimage/bg_estimate.py#L119-L128 | train | python | Compute Mode using a histogram with `sqrt(data.size)` bins | def offset_mode(data):
"""Compute Mode using a histogram with `sqrt(data.size)` bins"""
nbins = int(np.ceil(np.sqrt(data.size)))
mind, maxd = data.min(), data.max()
histo = np.histogram(data, nbins, density=True, range=(mind, maxd))
dx = abs(histo[1][1] - histo[1][2]) / 2
hx = histo[1][1:] - dx
... | Compute Mode using a histogram with `sqrt(data.size)` bins
def offset_mode(data):
"""Compute Mode using a histogram with `sqrt(data.size)` bins"""
nbins = int(np.ceil(np.sqrt(data.size)))
mind, maxd = data.min(), data.max()
histo = np.histogram(data, nbins, density=True, range=(mind, maxd))
dx = ab... | 133 | 58 | 384 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | 496de57338bb99884df81cbc076892fdfb3788f4f8a66cc560494b8a6dce296e | MIT | permissive | https://github.com/RI-imaging/qpimage/blob/master/LICENSE |
54d303f599284b160c1aa6cb | RI-imaging/qpimage | qpimage/bg_estimate.py | profile_tilt | https://github.com/RI-imaging/qpimage/blob/863c0fce5735b4c0ae369f75c0df9a33411b2bb2/qpimage/bg_estimate.py#L131-L139 | train | python | Fit a 2D tilt to `data[mask]` | def profile_tilt(data, mask):
"""Fit a 2D tilt to `data[mask]`"""
params = lmfit.Parameters()
params.add(name="mx", value=0)
params.add(name="my", value=0)
params.add(name="off", value=np.average(data[mask]))
fr = lmfit.minimize(tilt_residual, params, args=(data, mask))
bg = tilt_model(fr.pa... | Fit a 2D tilt to `data[mask]`
def profile_tilt(data, mask):
"""Fit a 2D tilt to `data[mask]`"""
params = lmfit.Parameters()
params.add(name="mx", value=0)
params.add(name="my", value=0)
params.add(name="off", value=np.average(data[mask]))
fr = lmfit.minimize(tilt_residual, params, args=(data, m... | 110 | 29 | 351 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | f1867eafcdc7c5e19ed12ee4ee46b826d830b6645c29697b709d1ebbf226de13 | MIT | permissive | https://github.com/RI-imaging/qpimage/blob/master/LICENSE |
b5a0eaaaf43e4a01854bf4e7 | RI-imaging/qpimage | qpimage/bg_estimate.py | profile_poly2o | https://github.com/RI-imaging/qpimage/blob/863c0fce5735b4c0ae369f75c0df9a33411b2bb2/qpimage/bg_estimate.py#L142-L154 | train | python | Fit a 2D 2nd order polynomial to `data[mask]` | def profile_poly2o(data, mask):
"""Fit a 2D 2nd order polynomial to `data[mask]`"""
# lmfit
params = lmfit.Parameters()
params.add(name="mx", value=0)
params.add(name="my", value=0)
params.add(name="mxy", value=0)
params.add(name="ax", value=0)
params.add(name="ay", value=0)
params.a... | Fit a 2D 2nd order polynomial to `data[mask]`
def profile_poly2o(data, mask):
"""Fit a 2D 2nd order polynomial to `data[mask]`"""
# lmfit
params = lmfit.Parameters()
params.add(name="mx", value=0)
params.add(name="my", value=0)
params.add(name="mxy", value=0)
params.add(name="ax", value=0)
... | 161 | 45 | 491 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | c1963b1a2cc4da085c8d1184e9953ce1a346dcee92cb4d45d9a66b29dffaec8a | MIT | permissive | https://github.com/RI-imaging/qpimage/blob/master/LICENSE |
4e02d1c6f599775354aab5ff | RI-imaging/qpimage | qpimage/bg_estimate.py | poly2o_model | https://github.com/RI-imaging/qpimage/blob/863c0fce5735b4c0ae369f75c0df9a33411b2bb2/qpimage/bg_estimate.py#L157-L171 | train | python | lmfit 2nd order polynomial model | def poly2o_model(params, shape):
"""lmfit 2nd order polynomial model"""
mx = params["mx"].value
my = params["my"].value
mxy = params["mxy"].value
ax = params["ax"].value
ay = params["ay"].value
off = params["off"].value
bg = np.zeros(shape, dtype=float) + off
x = np.arange(bg.shape[0... | lmfit 2nd order polynomial model
def poly2o_model(params, shape):
"""lmfit 2nd order polynomial model"""
mx = params["mx"].value
my = params["my"].value
mxy = params["mxy"].value
ax = params["ax"].value
ay = params["ay"].value
off = params["off"].value
bg = np.zeros(shape, dtype=float) ... | 193 | 32 | 519 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | 2946f6fd2f7394fe3ecaecb981cc32d288a468839b0380501552a1b50b76a43b | MIT | permissive | https://github.com/RI-imaging/qpimage/blob/master/LICENSE |
65f0b5e8ef1a6afe2eff61fb | RI-imaging/qpimage | qpimage/bg_estimate.py | poly2o_residual | https://github.com/RI-imaging/qpimage/blob/863c0fce5735b4c0ae369f75c0df9a33411b2bb2/qpimage/bg_estimate.py#L174-L178 | train | python | lmfit 2nd order polynomial residuals | def poly2o_residual(params, data, mask):
"""lmfit 2nd order polynomial residuals"""
bg = poly2o_model(params, shape=data.shape)
res = (data - bg)[mask]
return res.flatten() | lmfit 2nd order polynomial residuals
def poly2o_residual(params, data, mask):
"""lmfit 2nd order polynomial residuals"""
bg = poly2o_model(params, shape=data.shape)
res = (data - bg)[mask]
return res.flatten() | 59 | 36 | 188 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | 1dfb5d752143601a359502abfb544ee04462f4d322dd37f7a95889aa75bae85a | MIT | permissive | https://github.com/RI-imaging/qpimage/blob/master/LICENSE |
808ddf950586368e6dfb29d1 | RI-imaging/qpimage | qpimage/bg_estimate.py | tilt_model | https://github.com/RI-imaging/qpimage/blob/863c0fce5735b4c0ae369f75c0df9a33411b2bb2/qpimage/bg_estimate.py#L181-L192 | train | python | lmfit tilt model | def tilt_model(params, shape):
"""lmfit tilt model"""
mx = params["mx"].value
my = params["my"].value
off = params["off"].value
bg = np.zeros(shape, dtype=float) + off
x = np.arange(bg.shape[0]) - bg.shape[0] // 2
y = np.arange(bg.shape[1]) - bg.shape[1] // 2
x = x.reshape(-1, 1)
y =... | lmfit tilt model
def tilt_model(params, shape):
"""lmfit tilt model"""
mx = params["mx"].value
my = params["my"].value
off = params["off"].value
bg = np.zeros(shape, dtype=float) + off
x = np.arange(bg.shape[0]) - bg.shape[0] // 2
y = np.arange(bg.shape[1]) - bg.shape[1] // 2
x = x.resh... | 135 | 16 | 377 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | fc6ec06da7ec43e3be260a1c12f8bf8ec69cebd4e4d3507f26a032afb071f853 | MIT | permissive | https://github.com/RI-imaging/qpimage/blob/master/LICENSE |
399ba1d15d1fd6b035a19286 | RI-imaging/qpimage | qpimage/bg_estimate.py | tilt_residual | https://github.com/RI-imaging/qpimage/blob/863c0fce5735b4c0ae369f75c0df9a33411b2bb2/qpimage/bg_estimate.py#L195-L199 | train | python | lmfit tilt residuals | def tilt_residual(params, data, mask):
"""lmfit tilt residuals"""
bg = tilt_model(params, shape=data.shape)
res = (data - bg)[mask]
return res.flatten() | lmfit tilt residuals
def tilt_residual(params, data, mask):
"""lmfit tilt residuals"""
bg = tilt_model(params, shape=data.shape)
res = (data - bg)[mask]
return res.flatten() | 47 | 20 | 168 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | 9de91b3ffb8674599b643bd9aed361d7ddf2bd066660aabcec4e8e69b642b5fe | MIT | permissive | https://github.com/RI-imaging/qpimage/blob/master/LICENSE |
70a6d77135a974cfaefa9469 | RI-imaging/qpimage | qpimage/holo.py | find_sideband | https://github.com/RI-imaging/qpimage/blob/863c0fce5735b4c0ae369f75c0df9a33411b2bb2/qpimage/holo.py#L5-L58 | train | python | Find the side band position of a hologram
The hologram is Fourier-transformed and the side band
is determined by finding the maximum amplitude in
Fourier space.
Parameters
----------
ft_data: 2d ndarray
Fourier transform of the hologram image
which: +1 or -1
which sideband ... | def find_sideband(ft_data, which=+1, copy=True):
"""Find the side band position of a hologram
The hologram is Fourier-transformed and the side band
is determined by finding the maximum amplitude in
Fourier space.
Parameters
----------
ft_data: 2d ndarray
Fourier transform of the ho... | Find the side band position of a hologram
The hologram is Fourier-transformed and the side band
is determined by finding the maximum amplitude in
Fourier space.
Parameters
----------
ft_data: 2d ndarray
Fourier transform of the hologram image
which: +1 or -1
which sideband ... | 535 | 565 | 1,340 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | e85e0a75b182f3dd352ff78d35a72d3324108e5c79917a26fbd973c9d139464a | MIT | permissive | https://github.com/RI-imaging/qpimage/blob/master/LICENSE |
7c423a2fa98da966f2e3e702 | RI-imaging/qpimage | qpimage/holo.py | fourier2dpad | https://github.com/RI-imaging/qpimage/blob/863c0fce5735b4c0ae369f75c0df9a33411b2bb2/qpimage/holo.py#L61-L84 | train | python | Compute the 2D Fourier transform with zero padding
Parameters
----------
data: 2d fload ndarray
real-valued image data
zero_pad: bool
perform zero-padding to next order of 2 | def fourier2dpad(data, zero_pad=True):
"""Compute the 2D Fourier transform with zero padding
Parameters
----------
data: 2d fload ndarray
real-valued image data
zero_pad: bool
perform zero-padding to next order of 2
"""
if zero_pad:
# zero padding size is next order ... | Compute the 2D Fourier transform with zero padding
Parameters
----------
data: 2d fload ndarray
real-valued image data
zero_pad: bool
perform zero-padding to next order of 2
def fourier2dpad(data, zero_pad=True):
"""Compute the 2D Fourier transform with zero padding
Parameters... | 246 | 206 | 702 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | 8d524ae30816260ec4eddd308f0e1142af2132bba26a8393e3750faebc12242f | MIT | permissive | https://github.com/RI-imaging/qpimage/blob/master/LICENSE |
92c09fe76ce323c0e8ab7dd0 | RI-imaging/qpimage | qpimage/holo.py | get_field | https://github.com/RI-imaging/qpimage/blob/863c0fce5735b4c0ae369f75c0df9a33411b2bb2/qpimage/holo.py#L87-L219 | train | python | Compute the complex field from a hologram using Fourier analysis
Parameters
----------
hologram: real-valued 2d ndarray
hologram data
sideband: +1, -1, or tuple of (float, float)
specifies the location of the sideband:
- +1: sideband in the upper half in Fourier space,
... | def get_field(hologram, sideband=+1, filter_name="disk", filter_size=1 / 3,
subtract_mean=True, zero_pad=True, copy=True):
"""Compute the complex field from a hologram using Fourier analysis
Parameters
----------
hologram: real-valued 2d ndarray
hologram data
sideband: +1, -1,... | Compute the complex field from a hologram using Fourier analysis
Parameters
----------
hologram: real-valued 2d ndarray
hologram data
sideband: +1, -1, or tuple of (float, float)
specifies the location of the sideband:
- +1: sideband in the upper half in Fourier space,
... | 1,982 | 2,354 | 5,324 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | d2418d43936ca4afd5535dd5398d0b30f0d730a69acd79128cf95a1e97451929 | MIT | permissive | https://github.com/RI-imaging/qpimage/blob/master/LICENSE |
6d9fcdabefc2db3610f38152 | RI-imaging/qpimage | qpimage/core.py | copyh5 | https://github.com/RI-imaging/qpimage/blob/863c0fce5735b4c0ae369f75c0df9a33411b2bb2/qpimage/core.py#L597-L655 | train | python | Recursively copy all hdf5 data from one group to another
Data from links is copied.
Parameters
----------
inh5: str, h5py.File, or h5py.Group
The input hdf5 data. This can be either a file name or
an hdf5 object.
outh5: str, h5py.File, h5py.Group, or None
The output hdf5 da... | def copyh5(inh5, outh5):
"""Recursively copy all hdf5 data from one group to another
Data from links is copied.
Parameters
----------
inh5: str, h5py.File, or h5py.Group
The input hdf5 data. This can be either a file name or
an hdf5 object.
outh5: str, h5py.File, h5py.Group, or... | Recursively copy all hdf5 data from one group to another
Data from links is copied.
Parameters
----------
inh5: str, h5py.File, or h5py.Group
The input hdf5 data. This can be either a file name or
an hdf5 object.
outh5: str, h5py.File, h5py.Group, or None
The output hdf5 da... | 666 | 523 | 1,960 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | 24a2eb87f20fd2843f0ec220abbcb345a28d0ecaca099baf6f5fd0e221bb4fcc | MIT | permissive | https://github.com/RI-imaging/qpimage/blob/master/LICENSE |
aae0890f263616efd7e5a1cb | RI-imaging/qpimage | qpimage/core.py | QPImage._conv_which_data | https://github.com/RI-imaging/qpimage/blob/863c0fce5735b4c0ae369f75c0df9a33411b2bb2/qpimage/core.py#L208-L237 | train | python | Convert which data to string or tuple
This function improves user convenience,
as `which_data` may be of several types
(str, ,str with spaces and commas, list, tuple) which
is internally handled by this method. | def _conv_which_data(which_data):
"""Convert which data to string or tuple
This function improves user convenience,
as `which_data` may be of several types
(str, ,str with spaces and commas, list, tuple) which
is internally handled by this method.
"""
if isinstan... | Convert which data to string or tuple
This function improves user convenience,
as `which_data` may be of several types
(str, ,str with spaces and commas, list, tuple) which
is internally handled by this method.
def _conv_which_data(which_data):
"""Convert which data to string o... | 294 | 243 | 1,218 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | 5bf802d55ce7b837a11c5779db8b1fee816f9637eb0d8924411ca09485c7b544 | MIT | permissive | https://github.com/RI-imaging/qpimage/blob/master/LICENSE |
f4bf2be360c452e28ff39591 | RI-imaging/qpimage | qpimage/core.py | QPImage._get_amp_pha | https://github.com/RI-imaging/qpimage/blob/863c0fce5735b4c0ae369f75c0df9a33411b2bb2/qpimage/core.py#L239-L294 | train | python | Convert input data to phase and amplitude
Parameters
----------
data: 2d ndarray (float or complex) or list
The experimental data (see `which_data`)
which_data: str
String or comma-separated list of strings indicating
the order and type of input data.... | def _get_amp_pha(self, data, which_data):
"""Convert input data to phase and amplitude
Parameters
----------
data: 2d ndarray (float or complex) or list
The experimental data (see `which_data`)
which_data: str
String or comma-separated list of strings ind... | Convert input data to phase and amplitude
Parameters
----------
data: 2d ndarray (float or complex) or list
The experimental data (see `which_data`)
which_data: str
String or comma-separated list of strings indicating
the order and type of input data.... | 657 | 628 | 2,178 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | 93acd31af06024c50326d4f51cf37ccd7580b26f715762318969b12bf2b94dc4 | MIT | permissive | https://github.com/RI-imaging/qpimage/blob/master/LICENSE |
f270fd05569f5064c15e43b5 | RI-imaging/qpimage | qpimage/core.py | QPImage.info | https://github.com/RI-imaging/qpimage/blob/863c0fce5735b4c0ae369f75c0df9a33411b2bb2/qpimage/core.py#L322-L332 | train | python | list of tuples with QPImage meta data | def info(self):
"""list of tuples with QPImage meta data"""
info = []
# meta data
meta = self.meta
for key in meta:
info.append((key, self.meta[key]))
# background correction
for imdat in [self._amp, self._pha]:
info += imdat.info
r... | list of tuples with QPImage meta data
def info(self):
"""list of tuples with QPImage meta data"""
info = []
# meta data
meta = self.meta
for key in meta:
info.append((key, self.meta[key]))
# background correction
for imdat in [self._amp, self._pha]:
... | 86 | 37 | 330 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | f2d77142b5c5af0b90d3a78774074964061ac12d6ce16643a8ffc5c43d01edb1 | MIT | permissive | https://github.com/RI-imaging/qpimage/blob/master/LICENSE |
17398219b2965cb57838b5af | RI-imaging/qpimage | qpimage/core.py | QPImage.clear_bg | https://github.com/RI-imaging/qpimage/blob/863c0fce5735b4c0ae369f75c0df9a33411b2bb2/qpimage/core.py#L359-L392 | train | python | Clear background correction
Parameters
----------
which_data: str or list of str
From which type of data to remove the background
information. The list contains either "amplitude",
"phase", or both.
keys: str or list of str
Which type of b... | def clear_bg(self, which_data=("amplitude", "phase"), keys="fit"):
"""Clear background correction
Parameters
----------
which_data: str or list of str
From which type of data to remove the background
information. The list contains either "amplitude",
... | Clear background correction
Parameters
----------
which_data: str or list of str
From which type of data to remove the background
information. The list contains either "amplitude",
"phase", or both.
keys: str or list of str
Which type of b... | 379 | 525 | 1,249 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | c6dae4611815d3606f26256e77dbe48cadcccabc895edae36466f8e04727f0ca | MIT | permissive | https://github.com/RI-imaging/qpimage/blob/master/LICENSE |
d3acc69eb3c6ecfe30c874ce | RI-imaging/qpimage | qpimage/core.py | QPImage.compute_bg | https://github.com/RI-imaging/qpimage/blob/863c0fce5735b4c0ae369f75c0df9a33411b2bb2/qpimage/core.py#L394-L494 | train | python | Compute background correction
Parameters
----------
which_data: str or list of str
From which type of data to remove the background
information. The list contains either "amplitude",
"phase", or both.
fit_profile: str
The type of backgroun... | def compute_bg(self, which_data="phase",
fit_offset="mean", fit_profile="tilt",
border_m=0, border_perc=0, border_px=0,
from_mask=None, ret_mask=False):
"""Compute background correction
Parameters
----------
which_data: str or lis... | Compute background correction
Parameters
----------
which_data: str or list of str
From which type of data to remove the background
information. The list contains either "amplitude",
"phase", or both.
fit_profile: str
The type of backgroun... | 1,349 | 2,248 | 4,231 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | d50d1977b3c4ed1a44b66b56a3edf8d1ce29fe44601f37ce2667991a18156ffc | MIT | permissive | https://github.com/RI-imaging/qpimage/blob/master/LICENSE |
d7b332a6fa821d78d1c58f8f | RI-imaging/qpimage | qpimage/core.py | QPImage.copy | https://github.com/RI-imaging/qpimage/blob/863c0fce5735b4c0ae369f75c0df9a33411b2bb2/qpimage/core.py#L496-L507 | train | python | Create a copy of the current instance
This is done by recursively copying the underlying hdf5 data.
Parameters
----------
h5file: str, h5py.File, h5py.Group, or None
see `QPImage.__init__` | def copy(self, h5file=None):
"""Create a copy of the current instance
This is done by recursively copying the underlying hdf5 data.
Parameters
----------
h5file: str, h5py.File, h5py.Group, or None
see `QPImage.__init__`
"""
h5 = copyh5(self.h5, h5fi... | Create a copy of the current instance
This is done by recursively copying the underlying hdf5 data.
Parameters
----------
h5file: str, h5py.File, h5py.Group, or None
see `QPImage.__init__`
def copy(self, h5file=None):
"""Create a copy of the current instance
... | 157 | 234 | 379 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | bd79bd3f6ab135df8bb745422b9744b2a17edf9171fe11b5a6e8a842852ccf07 | MIT | permissive | https://github.com/RI-imaging/qpimage/blob/master/LICENSE |
9d0d1688bb0e1f780888d502 | RI-imaging/qpimage | qpimage/core.py | QPImage.refocus | https://github.com/RI-imaging/qpimage/blob/863c0fce5735b4c0ae369f75c0df9a33411b2bb2/qpimage/core.py#L509-L564 | train | python | Compute a numerically refocused QPImage
Parameters
----------
distance: float
Focusing distance [m]
method: str
Refocusing method, one of ["helmholtz","fresnel"]
h5file: str, h5py.Group, h5py.File, or None
A path to an hdf5 data file where the... | def refocus(self, distance, method="helmholtz", h5file=None, h5mode="a"):
"""Compute a numerically refocused QPImage
Parameters
----------
distance: float
Focusing distance [m]
method: str
Refocusing method, one of ["helmholtz","fresnel"]
h5file: ... | Compute a numerically refocused QPImage
Parameters
----------
distance: float
Focusing distance [m]
method: str
Refocusing method, one of ["helmholtz","fresnel"]
h5file: str, h5py.Group, h5py.File, or None
A path to an hdf5 data file where the... | 851 | 1,351 | 2,339 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | 68ae7c03018ef4b6c98e6d7867aa60b2d016e39e79ec817da893d07bfa730cfd | MIT | permissive | https://github.com/RI-imaging/qpimage/blob/master/LICENSE |
5329eb02f0b025ca1ab29791 | RI-imaging/qpimage | qpimage/core.py | QPImage.set_bg_data | https://github.com/RI-imaging/qpimage/blob/863c0fce5735b4c0ae369f75c0df9a33411b2bb2/qpimage/core.py#L566-L594 | train | python | Set background amplitude and phase data
Parameters
----------
bg_data: 2d ndarray (float or complex), list, QPImage, or `None`
The background data (must be same type as `data`).
If set to `None`, the background data is reset.
which_data: str
String or... | def set_bg_data(self, bg_data, which_data=None):
"""Set background amplitude and phase data
Parameters
----------
bg_data: 2d ndarray (float or complex), list, QPImage, or `None`
The background data (must be same type as `data`).
If set to `None`, the background ... | Set background amplitude and phase data
Parameters
----------
bg_data: 2d ndarray (float or complex), list, QPImage, or `None`
The background data (must be same type as `data`).
If set to `None`, the background data is reset.
which_data: str
String or... | 436 | 622 | 1,299 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | 3be3ece695dccf32fc49989ccf8fbf45d85a024e5001703965d85e683cc4e95f | MIT | permissive | https://github.com/RI-imaging/qpimage/blob/master/LICENSE |
78be7b4fbc00c363a00aa4a0 | RI-imaging/qpimage | qpimage/series.py | QPSeries.add_qpimage | https://github.com/RI-imaging/qpimage/blob/863c0fce5735b4c0ae369f75c0df9a33411b2bb2/qpimage/series.py#L130-L168 | train | python | Add a QPImage instance to the QPSeries
Parameters
----------
qpi: qpimage.QPImage
The QPImage that is added to the series
identifier: str
Identifier key for `qpi`
bg_from_idx: int or None
Use the background data from the data stored in this in... | def add_qpimage(self, qpi, identifier=None, bg_from_idx=None):
"""Add a QPImage instance to the QPSeries
Parameters
----------
qpi: qpimage.QPImage
The QPImage that is added to the series
identifier: str
Identifier key for `qpi`
bg_from_idx: int o... | Add a QPImage instance to the QPSeries
Parameters
----------
qpi: qpimage.QPImage
The QPImage that is added to the series
identifier: str
Identifier key for `qpi`
bg_from_idx: int or None
Use the background data from the data stored in this in... | 477 | 458 | 1,608 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | 9919a837675f88a5b061655a7358387f7c2d698608a17d71a06654e29454f2a5 | MIT | permissive | https://github.com/RI-imaging/qpimage/blob/master/LICENSE |
93a799a0b7a8d4a466440a99 | RI-imaging/qpimage | qpimage/series.py | QPSeries.get_qpimage | https://github.com/RI-imaging/qpimage/blob/863c0fce5735b4c0ae369f75c0df9a33411b2bb2/qpimage/series.py#L170-L208 | train | python | Return a single QPImage of the series
Parameters
----------
index: int or str
Index or identifier of the QPImage
Notes
-----
Instead of ``qps.get_qpimage(index)``, it is possible
to use the short-hand ``qps[index]``. | def get_qpimage(self, index):
"""Return a single QPImage of the series
Parameters
----------
index: int or str
Index or identifier of the QPImage
Notes
-----
Instead of ``qps.get_qpimage(index)``, it is possible
to use the short-hand ``qps[in... | Return a single QPImage of the series
Parameters
----------
index: int or str
Index or identifier of the QPImage
Notes
-----
Instead of ``qps.get_qpimage(index)``, it is possible
to use the short-hand ``qps[index]``.
def get_qpimage(self, index):
... | 357 | 286 | 1,380 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | 1f95d17d29ca9209a61283097094a38ba67869e910f306a8b6e74b8a58e18ca2 | MIT | permissive | https://github.com/RI-imaging/qpimage/blob/master/LICENSE |
6aed9ed586a88fb3002dfe54 | Parquery/icontract | precommit.py | main | https://github.com/Parquery/icontract/blob/846e3187869a9ba790e9b893c98e5055e1cce274/precommit.py#L10-L72 | train | python | Main routine | def main() -> int:
""""
Main routine
"""
parser = argparse.ArgumentParser()
parser.add_argument(
"--overwrite",
help="Overwrites the unformatted source files with the well-formatted code in place. "
"If not set, an exception is raised if any of the files do not conform to the... | Main routine
def main() -> int:
""""
Main routine
"""
parser = argparse.ArgumentParser()
parser.add_argument(
"--overwrite",
help="Overwrites the unformatted source files with the well-formatted code in place. "
"If not set, an exception is raised if any of the files do not ... | 532 | 12 | 2,090 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | 67e53840c1cedc195cf1ece1f1be934429cb25cb763ddeaa16609a7eba6797ad | MIT | permissive | https://github.com/Parquery/icontract/blob/master/LICENSE.txt |
8d0b2ee4ecf12e3ef907ad3b | Parquery/icontract | icontract/_metaclass.py | _collapse_invariants | https://github.com/Parquery/icontract/blob/846e3187869a9ba790e9b893c98e5055e1cce274/icontract/_metaclass.py#L16-L31 | train | python | Collect invariants from the bases and merge them with the invariants in the namespace. | def _collapse_invariants(bases: List[type], namespace: MutableMapping[str, Any]) -> None:
"""Collect invariants from the bases and merge them with the invariants in the namespace."""
invariants = [] # type: List[Contract]
# Add invariants of the bases
for base in bases:
if hasattr(base, "__inv... | Collect invariants from the bases and merge them with the invariants in the namespace.
def _collapse_invariants(bases: List[type], namespace: MutableMapping[str, Any]) -> None:
"""Collect invariants from the bases and merge them with the invariants in the namespace."""
invariants = [] # type: List[Contract]
... | 166 | 86 | 655 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | f68108bc7d97bba1bd1f400a7f2b3c652afc514dc78a7b459a4495479a8a2944 | MIT | permissive | https://github.com/Parquery/icontract/blob/master/LICENSE.txt |
53fe6d5345f884b80e59a782 | Parquery/icontract | icontract/_metaclass.py | _collapse_preconditions | https://github.com/Parquery/icontract/blob/846e3187869a9ba790e9b893c98e5055e1cce274/icontract/_metaclass.py#L34-L51 | train | python | Collapse function preconditions with the preconditions collected from the base classes.
:param base_preconditions: preconditions collected from the base classes (grouped by base class)
:param bases_have_func: True if one of the base classes has the function
:param preconditions: preconditions of the functi... | def _collapse_preconditions(base_preconditions: List[List[Contract]], bases_have_func: bool,
preconditions: List[List[Contract]], func: Callable[..., Any]) -> List[List[Contract]]:
"""
Collapse function preconditions with the preconditions collected from the base classes.
:param... | Collapse function preconditions with the preconditions collected from the base classes.
:param base_preconditions: preconditions collected from the base classes (grouped by base class)
:param bases_have_func: True if one of the base classes has the function
:param preconditions: preconditions of the functi... | 320 | 463 | 1,208 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | cb00d1f3947f61e4232e14a99ff0b3c619e62bfc63a36ea1eb29b634c3f7aeb6 | MIT | permissive | https://github.com/Parquery/icontract/blob/master/LICENSE.txt |
ba37727d1977266c7d2e3387 | Parquery/icontract | icontract/_metaclass.py | _collapse_snapshots | https://github.com/Parquery/icontract/blob/846e3187869a9ba790e9b893c98e5055e1cce274/icontract/_metaclass.py#L54-L73 | train | python | Collapse snapshots of pre-invocation values with the snapshots collected from the base classes.
:param base_snapshots: snapshots collected from the base classes
:param snapshots: snapshots of the function (before the collapse)
:return: collapsed sequence of snapshots | def _collapse_snapshots(base_snapshots: List[Snapshot], snapshots: List[Snapshot]) -> List[Snapshot]:
"""
Collapse snapshots of pre-invocation values with the snapshots collected from the base classes.
:param base_snapshots: snapshots collected from the base classes
:param snapshots: snapshots of the f... | Collapse snapshots of pre-invocation values with the snapshots collected from the base classes.
:param base_snapshots: snapshots collected from the base classes
:param snapshots: snapshots of the function (before the collapse)
:return: collapsed sequence of snapshots
def _collapse_snapshots(base_snapshots... | 238 | 280 | 913 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | 9bca93c2c13f3bec22a44617fb0ce385ef00a5b9d78636e3d528e159e24cc30e | MIT | permissive | https://github.com/Parquery/icontract/blob/master/LICENSE.txt |
9dcba89d875795ab1a211587 | Parquery/icontract | icontract/_metaclass.py | _collapse_postconditions | https://github.com/Parquery/icontract/blob/846e3187869a9ba790e9b893c98e5055e1cce274/icontract/_metaclass.py#L76-L84 | train | python | Collapse function postconditions with the postconditions collected from the base classes.
:param base_postconditions: postconditions collected from the base classes
:param postconditions: postconditions of the function (before the collapse)
:return: collapsed sequence of postconditions | def _collapse_postconditions(base_postconditions: List[Contract], postconditions: List[Contract]) -> List[Contract]:
"""
Collapse function postconditions with the postconditions collected from the base classes.
:param base_postconditions: postconditions collected from the base classes
:param postcondit... | Collapse function postconditions with the postconditions collected from the base classes.
:param base_postconditions: postconditions collected from the base classes
:param postconditions: postconditions of the function (before the collapse)
:return: collapsed sequence of postconditions
def _collapse_postc... | 148 | 299 | 484 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | 82049fd0c934a31dd25f3287b9a7833f6c0e754a76659ba9ce6ab3e3c97c1e48 | MIT | permissive | https://github.com/Parquery/icontract/blob/master/LICENSE.txt |
aaf7e8dd46d12a5e8c421c59 | Parquery/icontract | icontract/_metaclass.py | _decorate_namespace_function | https://github.com/Parquery/icontract/blob/846e3187869a9ba790e9b893c98e5055e1cce274/icontract/_metaclass.py#L87-L169 | train | python | Collect preconditions and postconditions from the bases and decorate the function at the ``key``. | def _decorate_namespace_function(bases: List[type], namespace: MutableMapping[str, Any], key: str) -> None:
"""Collect preconditions and postconditions from the bases and decorate the function at the ``key``."""
# pylint: disable=too-many-branches
# pylint: disable=too-many-locals
value = namespace[key... | Collect preconditions and postconditions from the bases and decorate the function at the ``key``.
def _decorate_namespace_function(bases: List[type], namespace: MutableMapping[str, Any], key: str) -> None:
"""Collect preconditions and postconditions from the bases and decorate the function at the ``key``."""
#... | 812 | 97 | 4,035 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | 972d71858521976e9c6f79a1200567dcba360a22b07f2a7f9903fe32c87b008c | MIT | permissive | https://github.com/Parquery/icontract/blob/master/LICENSE.txt |
2d3ac98fda0e26e1fb703372 | Parquery/icontract | icontract/_metaclass.py | _decorate_namespace_property | https://github.com/Parquery/icontract/blob/846e3187869a9ba790e9b893c98e5055e1cce274/icontract/_metaclass.py#L172-L268 | train | python | Collect contracts for all getters/setters/deleters corresponding to ``key`` and decorate them. | def _decorate_namespace_property(bases: List[type], namespace: MutableMapping[str, Any], key: str) -> None:
"""Collect contracts for all getters/setters/deleters corresponding to ``key`` and decorate them."""
# pylint: disable=too-many-locals
# pylint: disable=too-many-branches
# pylint: disable=too-man... | Collect contracts for all getters/setters/deleters corresponding to ``key`` and decorate them.
def _decorate_namespace_property(bases: List[type], namespace: MutableMapping[str, Any], key: str) -> None:
"""Collect contracts for all getters/setters/deleters corresponding to ``key`` and decorate them."""
# pylin... | 940 | 94 | 4,519 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | a575613ed028cf406f0cf40e488df834e11f5b7fe5daf8cae0e6f7d37c9c3d45 | MIT | permissive | https://github.com/Parquery/icontract/blob/master/LICENSE.txt |
bea3315711fce8dbf3942461 | Parquery/icontract | icontract/_metaclass.py | _dbc_decorate_namespace | https://github.com/Parquery/icontract/blob/846e3187869a9ba790e9b893c98e5055e1cce274/icontract/_metaclass.py#L271-L289 | train | python | Collect invariants, preconditions and postconditions from the bases and decorate all the methods.
Instance methods are simply replaced with the decorated function/ Properties, class methods and static methods are
overridden with new instances of ``property``, ``classmethod`` and ``staticmethod``, respectively. | def _dbc_decorate_namespace(bases: List[type], namespace: MutableMapping[str, Any]) -> None:
"""
Collect invariants, preconditions and postconditions from the bases and decorate all the methods.
Instance methods are simply replaced with the decorated function/ Properties, class methods and static methods a... | Collect invariants, preconditions and postconditions from the bases and decorate all the methods.
Instance methods are simply replaced with the decorated function/ Properties, class methods and static methods are
overridden with new instances of ``property``, ``classmethod`` and ``staticmethod``, respectively.... | 240 | 320 | 939 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | dae17ea7fe07727b40a569ba1256540a71b354730511244f45af7bb4a7436f76 | MIT | permissive | https://github.com/Parquery/icontract/blob/master/LICENSE.txt |
acae3ea81b731d307213901a | Parquery/icontract | icontract/_represent.py | _representable | https://github.com/Parquery/icontract/blob/846e3187869a9ba790e9b893c98e5055e1cce274/icontract/_represent.py#L21-L31 | train | python | Check whether we want to represent the value in the error message on contract breach.
We do not want to represent classes, methods, modules and functions.
:param value: value related to an AST node
:return: True if we want to represent it in the violation error | def _representable(value: Any) -> bool:
"""
Check whether we want to represent the value in the error message on contract breach.
We do not want to represent classes, methods, modules and functions.
:param value: value related to an AST node
:return: True if we want to represent it in the violatio... | Check whether we want to represent the value in the error message on contract breach.
We do not want to represent classes, methods, modules and functions.
:param value: value related to an AST node
:return: True if we want to represent it in the violation error
def _representable(value: Any) -> bool:
... | 172 | 275 | 514 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | 4d6a4b3c9697ad1a5c2b18a4de23c0fc5ee994b8fd9570594186e10cdcd34b55 | MIT | permissive | https://github.com/Parquery/icontract/blob/master/LICENSE.txt |
9d0078f0a5f75738e3a0d622 | Parquery/icontract | icontract/_represent.py | inspect_decorator | https://github.com/Parquery/icontract/blob/846e3187869a9ba790e9b893c98e5055e1cce274/icontract/_represent.py#L183-L245 | train | python | Parse the file in which the decorator is called and figure out the corresponding call AST node.
:param lines: lines of the source file corresponding to the decorator call
:param lineno: line index (starting with 0) of one of the lines in the decorator call
:param filename: name of the file where decorator ... | def inspect_decorator(lines: List[str], lineno: int, filename: str) -> DecoratorInspection:
"""
Parse the file in which the decorator is called and figure out the corresponding call AST node.
:param lines: lines of the source file corresponding to the decorator call
:param lineno: line index (starting ... | Parse the file in which the decorator is called and figure out the corresponding call AST node.
:param lines: lines of the source file corresponding to the decorator call
:param lineno: line index (starting with 0) of one of the lines in the decorator call
:param filename: name of the file where decorator ... | 777 | 367 | 3,064 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | 4f1c29e84f0176c6ad44006d308f75619ce257bc7cf46ec800ba832014d57609 | MIT | permissive | https://github.com/Parquery/icontract/blob/master/LICENSE.txt |
d58cbd65e072932dd2b7c389 | Parquery/icontract | icontract/_represent.py | find_lambda_condition | https://github.com/Parquery/icontract/blob/846e3187869a9ba790e9b893c98e5055e1cce274/icontract/_represent.py#L248-L280 | train | python | Inspect the decorator and extract the condition as lambda.
If the condition is not given as a lambda function, return None. | def find_lambda_condition(decorator_inspection: DecoratorInspection) -> Optional[ConditionLambdaInspection]:
"""
Inspect the decorator and extract the condition as lambda.
If the condition is not given as a lambda function, return None.
"""
call_node = decorator_inspection.node
lambda_node = N... | Inspect the decorator and extract the condition as lambda.
If the condition is not given as a lambda function, return None.
def find_lambda_condition(decorator_inspection: DecoratorInspection) -> Optional[ConditionLambdaInspection]:
"""
Inspect the decorator and extract the condition as lambda.
If th... | 319 | 128 | 1,389 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | 3e483814f98090c96ad30b99294734f35cc40fe127f4f107335e2837592cceda | MIT | permissive | https://github.com/Parquery/icontract/blob/master/LICENSE.txt |
170aa879e669f4d2c1f00df2 | Parquery/icontract | icontract/_represent.py | repr_values | https://github.com/Parquery/icontract/blob/846e3187869a9ba790e9b893c98e5055e1cce274/icontract/_represent.py#L283-L351 | train | python | Represent function arguments and frame values in the error message on contract breach.
:param condition: condition function of the contract
:param lambda_inspection:
inspected lambda AST node corresponding to the condition function (None if the condition was not given as a
lambda function)
... | def repr_values(condition: Callable[..., bool], lambda_inspection: Optional[ConditionLambdaInspection],
condition_kwargs: Mapping[str, Any], a_repr: reprlib.Repr) -> List[str]:
# pylint: disable=too-many-locals
"""
Represent function arguments and frame values in the error message on contrac... | Represent function arguments and frame values in the error message on contract breach.
:param condition: condition function of the contract
:param lambda_inspection:
inspected lambda AST node corresponding to the condition function (None if the condition was not given as a
lambda function)
... | 721 | 495 | 2,995 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | 2c120c88c0f6226ac77775ef39d6bde271321da1d7c3fd53c656f9e41e4f9eb1 | MIT | permissive | https://github.com/Parquery/icontract/blob/master/LICENSE.txt |
73b9d40bedfbe453c3a40b4b | Parquery/icontract | icontract/_represent.py | generate_message | https://github.com/Parquery/icontract/blob/846e3187869a9ba790e9b893c98e5055e1cce274/icontract/_represent.py#L354-L405 | train | python | Generate the message upon contract violation. | def generate_message(contract: Contract, condition_kwargs: Mapping[str, Any]) -> str:
"""Generate the message upon contract violation."""
# pylint: disable=protected-access
parts = [] # type: List[str]
if contract.location is not None:
parts.append("{}:\n".format(contract.location))
if co... | Generate the message upon contract violation.
def generate_message(contract: Contract, condition_kwargs: Mapping[str, Any]) -> str:
"""Generate the message upon contract violation."""
# pylint: disable=protected-access
parts = [] # type: List[str]
if contract.location is not None:
parts.appen... | 427 | 45 | 2,020 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | 10cdc5507373bf1c22ce91cc5ef513fc5f3b2c36534b0f9b813310b6596a0764 | MIT | permissive | https://github.com/Parquery/icontract/blob/master/LICENSE.txt |
bf18950e83a9549433b1edd5 | Parquery/icontract | icontract/_represent.py | Visitor.visit_Name | https://github.com/Parquery/icontract/blob/846e3187869a9ba790e9b893c98e5055e1cce274/icontract/_represent.py#L57-L78 | train | python | Resolve the name from the variable look-up and the built-ins.
Due to possible branching (e.g., If-expressions), some nodes might lack the recomputed values. These nodes
are ignored. | def visit_Name(self, node: ast.Name) -> None:
"""
Resolve the name from the variable look-up and the built-ins.
Due to possible branching (e.g., If-expressions), some nodes might lack the recomputed values. These nodes
are ignored.
"""
if node in self._recomputed_values:... | Resolve the name from the variable look-up and the built-ins.
Due to possible branching (e.g., If-expressions), some nodes might lack the recomputed values. These nodes
are ignored.
def visit_Name(self, node: ast.Name) -> None:
"""
Resolve the name from the variable look-up and the bui... | 203 | 198 | 790 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | 248d64d061110b7f7c0193186b375ebc1e71bf1639d663020d381637f9a1cb89 | MIT | permissive | https://github.com/Parquery/icontract/blob/master/LICENSE.txt |
f829d1e03138881e02636227 | Parquery/icontract | icontract/_represent.py | Visitor.visit_Attribute | https://github.com/Parquery/icontract/blob/846e3187869a9ba790e9b893c98e5055e1cce274/icontract/_represent.py#L80-L89 | train | python | Represent the attribute by dumping its source code. | def visit_Attribute(self, node: ast.Attribute) -> None:
"""Represent the attribute by dumping its source code."""
if node in self._recomputed_values:
value = self._recomputed_values[node]
if _representable(value=value):
text = self._atok.get_text(node)
... | Represent the attribute by dumping its source code.
def visit_Attribute(self, node: ast.Attribute) -> None:
"""Represent the attribute by dumping its source code."""
if node in self._recomputed_values:
value = self._recomputed_values[node]
if _representable(value=value):
... | 89 | 51 | 389 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | c34d0f9e227c886e7fc9483b9c8b05aee849d26cb9c46fc503bb740b231c5799 | MIT | permissive | https://github.com/Parquery/icontract/blob/master/LICENSE.txt |
f05d80aceadba084f8321ef0 | Parquery/icontract | icontract/_represent.py | Visitor.visit_Call | https://github.com/Parquery/icontract/blob/846e3187869a9ba790e9b893c98e5055e1cce274/icontract/_represent.py#L91-L99 | train | python | Represent the call by dumping its source code. | def visit_Call(self, node: ast.Call) -> None:
"""Represent the call by dumping its source code."""
if node in self._recomputed_values:
value = self._recomputed_values[node]
text = self._atok.get_text(node)
self.reprs[text] = value
self.generic_visit(node=nod... | Represent the call by dumping its source code.
def visit_Call(self, node: ast.Call) -> None:
"""Represent the call by dumping its source code."""
if node in self._recomputed_values:
value = self._recomputed_values[node]
text = self._atok.get_text(node)
self.reprs[te... | 80 | 46 | 322 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | 28d68854e53cca85ce86f19ffd9c5b3f30b0069ae2a57a60d005c3f75077c2ca | MIT | permissive | https://github.com/Parquery/icontract/blob/master/LICENSE.txt |
3453c91f62becd877aed1ab6 | Parquery/icontract | icontract/_represent.py | Visitor.visit_ListComp | https://github.com/Parquery/icontract/blob/846e3187869a9ba790e9b893c98e5055e1cce274/icontract/_represent.py#L101-L109 | train | python | Represent the list comprehension by dumping its source code. | def visit_ListComp(self, node: ast.ListComp) -> None:
"""Represent the list comprehension by dumping its source code."""
if node in self._recomputed_values:
value = self._recomputed_values[node]
text = self._atok.get_text(node)
self.reprs[text] = value
self.... | Represent the list comprehension by dumping its source code.
def visit_ListComp(self, node: ast.ListComp) -> None:
"""Represent the list comprehension by dumping its source code."""
if node in self._recomputed_values:
value = self._recomputed_values[node]
text = self._atok.get_t... | 84 | 60 | 344 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | 0c2dbe3172776841dc547800c4b70ae018ab35f1e6988e62c83023a7dd321736 | MIT | permissive | https://github.com/Parquery/icontract/blob/master/LICENSE.txt |
41c2d52594ca43597b51decf | Parquery/icontract | icontract/_represent.py | Visitor.visit_DictComp | https://github.com/Parquery/icontract/blob/846e3187869a9ba790e9b893c98e5055e1cce274/icontract/_represent.py#L121-L129 | train | python | Represent the dictionary comprehension by dumping its source code. | def visit_DictComp(self, node: ast.DictComp) -> None:
"""Represent the dictionary comprehension by dumping its source code."""
if node in self._recomputed_values:
value = self._recomputed_values[node]
text = self._atok.get_text(node)
self.reprs[text] = value
... | Represent the dictionary comprehension by dumping its source code.
def visit_DictComp(self, node: ast.DictComp) -> None:
"""Represent the dictionary comprehension by dumping its source code."""
if node in self._recomputed_values:
value = self._recomputed_values[node]
text = self... | 85 | 66 | 350 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | 6b5fce1735d0c71b0f05e060bfa7a3ddda3ebac7ad33475400142cba2f4bec22 | MIT | permissive | https://github.com/Parquery/icontract/blob/master/LICENSE.txt |
a67494dca84debc7ef4110ba | Parquery/icontract | icontract/_checkers.py | _walk_decorator_stack | https://github.com/Parquery/icontract/blob/846e3187869a9ba790e9b893c98e5055e1cce274/icontract/_checkers.py#L17-L28 | train | python | Iterate through the stack of decorated functions until the original function.
Assume that all decorators used functools.update_wrapper. | def _walk_decorator_stack(func: CallableT) -> Iterable['CallableT']:
"""
Iterate through the stack of decorated functions until the original function.
Assume that all decorators used functools.update_wrapper.
"""
while hasattr(func, "__wrapped__"):
yield func
func = getattr(func, "... | Iterate through the stack of decorated functions until the original function.
Assume that all decorators used functools.update_wrapper.
def _walk_decorator_stack(func: CallableT) -> Iterable['CallableT']:
"""
Iterate through the stack of decorated functions until the original function.
Assume that al... | 92 | 140 | 349 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | e852558ea49a6f995b3db4f180d00b7e70bc81ed05a46903b4d2e701c01039fb | MIT | permissive | https://github.com/Parquery/icontract/blob/master/LICENSE.txt |
a5620a619403741e4f62d997 | Parquery/icontract | icontract/_checkers.py | find_checker | https://github.com/Parquery/icontract/blob/846e3187869a9ba790e9b893c98e5055e1cce274/icontract/_checkers.py#L31-L38 | train | python | Iterate through the decorator stack till we find the contract checker. | def find_checker(func: CallableT) -> Optional[CallableT]:
"""Iterate through the decorator stack till we find the contract checker."""
contract_checker = None # type: Optional[CallableT]
for a_wrapper in _walk_decorator_stack(func):
if hasattr(a_wrapper, "__preconditions__") or hasattr(a_wrapper, "... | Iterate through the decorator stack till we find the contract checker.
def find_checker(func: CallableT) -> Optional[CallableT]:
"""Iterate through the decorator stack till we find the contract checker."""
contract_checker = None # type: Optional[CallableT]
for a_wrapper in _walk_decorator_stack(func):
... | 99 | 70 | 411 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | 7ea2a71f3305edde1fda00e3a993b56c43afdf08fdbba5205886d246cb1cb079 | MIT | permissive | https://github.com/Parquery/icontract/blob/master/LICENSE.txt |
46baf844ae0a7eba8fc20279 | Parquery/icontract | icontract/_checkers.py | _kwargs_from_call | https://github.com/Parquery/icontract/blob/846e3187869a9ba790e9b893c98e5055e1cce274/icontract/_checkers.py#L41-L66 | train | python | Inspect the input values received at the wrapper for the actual function call.
:param param_names: parameter (*i.e.* argument) names of the original (decorated) function
:param kwdefaults: default argument values of the original function
:param args: arguments supplied to the call
:param kwargs: keywor... | def _kwargs_from_call(param_names: List[str], kwdefaults: Dict[str, Any], args: Tuple[Any, ...],
kwargs: Dict[str, Any]) -> MutableMapping[str, Any]:
"""
Inspect the input values received at the wrapper for the actual function call.
:param param_names: parameter (*i.e.* argument) name... | Inspect the input values received at the wrapper for the actual function call.
:param param_names: parameter (*i.e.* argument) names of the original (decorated) function
:param kwdefaults: default argument values of the original function
:param args: arguments supplied to the call
:param kwargs: keywor... | 338 | 424 | 1,119 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | a39ac72df2bb3c4f66d9053372284ca3b6e3777df7c90dda74f7857affe19a72 | MIT | permissive | https://github.com/Parquery/icontract/blob/master/LICENSE.txt |
ade4d4b9dd57234f98bee2cf | Parquery/icontract | icontract/_checkers.py | _assert_precondition | https://github.com/Parquery/icontract/blob/846e3187869a9ba790e9b893c98e5055e1cce274/icontract/_checkers.py#L69-L120 | train | python | Assert that the contract holds as a precondition.
:param contract: contract to be verified
:param resolved_kwargs: resolved keyword arguments (including the default values)
:return: | def _assert_precondition(contract: Contract, resolved_kwargs: Mapping[str, Any]) -> None:
"""
Assert that the contract holds as a precondition.
:param contract: contract to be verified
:param resolved_kwargs: resolved keyword arguments (including the default values)
:return:
"""
# Check tha... | Assert that the contract holds as a precondition.
:param contract: contract to be verified
:param resolved_kwargs: resolved keyword arguments (including the default values)
:return:
def _assert_precondition(contract: Contract, resolved_kwargs: Mapping[str, Any]) -> None:
"""
Assert that the contra... | 504 | 194 | 2,418 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | d1cf261b3e147bdba3e631ab3831e91eb1d20132201ed83c7a04ece9b99018c0 | MIT | permissive | https://github.com/Parquery/icontract/blob/master/LICENSE.txt |
9c21a38bda996829205915b6 | Parquery/icontract | icontract/_checkers.py | _assert_invariant | https://github.com/Parquery/icontract/blob/846e3187869a9ba790e9b893c98e5055e1cce274/icontract/_checkers.py#L123-L150 | train | python | Assert that the contract holds as a class invariant given the instance of the class. | def _assert_invariant(contract: Contract, instance: Any) -> None:
"""Assert that the contract holds as a class invariant given the instance of the class."""
if 'self' in contract.condition_arg_set:
check = contract.condition(self=instance)
else:
check = contract.condition()
if not check... | Assert that the contract holds as a class invariant given the instance of the class.
def _assert_invariant(contract: Contract, instance: Any) -> None:
"""Assert that the contract holds as a class invariant given the instance of the class."""
if 'self' in contract.condition_arg_set:
check = contract.con... | 277 | 84 | 1,423 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | c51815def03dc49148ebb089f5458277c30780804f2610942b4f10308e478ee5 | MIT | permissive | https://github.com/Parquery/icontract/blob/master/LICENSE.txt |
9e0851f06cb9d071e312d482 | Parquery/icontract | icontract/_checkers.py | _capture_snapshot | https://github.com/Parquery/icontract/blob/846e3187869a9ba790e9b893c98e5055e1cce274/icontract/_checkers.py#L153-L171 | train | python | Capture the snapshot from the keyword arguments resolved before the function call (including the default values).
:param a_snapshot: snapshot to be captured
:param resolved_kwargs: resolved keyword arguments (including the default values)
:return: captured value | def _capture_snapshot(a_snapshot: Snapshot, resolved_kwargs: Mapping[str, Any]) -> Any:
"""
Capture the snapshot from the keyword arguments resolved before the function call (including the default values).
:param a_snapshot: snapshot to be captured
:param resolved_kwargs: resolved keyword arguments (in... | Capture the snapshot from the keyword arguments resolved before the function call (including the default values).
:param a_snapshot: snapshot to be captured
:param resolved_kwargs: resolved keyword arguments (including the default values)
:return: captured value
def _capture_snapshot(a_snapshot: Snapshot,... | 218 | 275 | 864 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | 7389a53cb28ecae7350faeab1070dbb71706cebc7c99799d937a482303c158ae | MIT | permissive | https://github.com/Parquery/icontract/blob/master/LICENSE.txt |
275b8353b681c26e240b55a8 | Parquery/icontract | icontract/_checkers.py | decorate_with_checker | https://github.com/Parquery/icontract/blob/846e3187869a9ba790e9b893c98e5055e1cce274/icontract/_checkers.py#L252-L346 | train | python | Decorate the function with a checker that verifies the preconditions and postconditions. | def decorate_with_checker(func: CallableT) -> CallableT:
"""Decorate the function with a checker that verifies the preconditions and postconditions."""
assert not hasattr(func, "__preconditions__"), \
"Expected func to have no list of preconditions (there should be only a single contract checker per fun... | Decorate the function with a checker that verifies the preconditions and postconditions.
def decorate_with_checker(func: CallableT) -> CallableT:
"""Decorate the function with a checker that verifies the preconditions and postconditions."""
assert not hasattr(func, "__preconditions__"), \
"Expected fun... | 948 | 88 | 4,602 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | e2a64844397a405122f2f723c1a4e3c50942dd418c7fbbb9943f791d2dfcaa47 | MIT | permissive | https://github.com/Parquery/icontract/blob/master/LICENSE.txt |
88d06652af5e8bb936e3f09b | Parquery/icontract | icontract/_checkers.py | _find_self | https://github.com/Parquery/icontract/blob/846e3187869a9ba790e9b893c98e5055e1cce274/icontract/_checkers.py#L349-L357 | train | python | Find the instance of ``self`` in the arguments. | def _find_self(param_names: List[str], args: Tuple[Any, ...], kwargs: Dict[str, Any]) -> Any:
"""Find the instance of ``self`` in the arguments."""
instance_i = param_names.index("self")
if instance_i < len(args):
instance = args[instance_i]
else:
instance = kwargs["self"]
return in... | Find the instance of ``self`` in the arguments.
def _find_self(param_names: List[str], args: Tuple[Any, ...], kwargs: Dict[str, Any]) -> Any:
"""Find the instance of ``self`` in the arguments."""
instance_i = param_names.index("self")
if instance_i < len(args):
instance = args[instance_i]
else:... | 90 | 47 | 326 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | e739d32eb69ef3842598fd93674faeef24de3e3a88c4f65b1e3b560aaa34c3d0 | MIT | permissive | https://github.com/Parquery/icontract/blob/master/LICENSE.txt |
624e55161fac0368d343808c | Parquery/icontract | icontract/_checkers.py | _decorate_with_invariants | https://github.com/Parquery/icontract/blob/846e3187869a9ba790e9b893c98e5055e1cce274/icontract/_checkers.py#L360-L407 | train | python | Decorate the function ``func`` of the class ``cls`` with invariant checks.
If the function has been already decorated with invariant checks, the function returns immediately.
:param func: function to be wrapped
:param is_init: True if the ``func`` is __init__
:return: function wrapped with invariant c... | def _decorate_with_invariants(func: CallableT, is_init: bool) -> CallableT:
"""
Decorate the function ``func`` of the class ``cls`` with invariant checks.
If the function has been already decorated with invariant checks, the function returns immediately.
:param func: function to be wrapped
:param ... | Decorate the function ``func`` of the class ``cls`` with invariant checks.
If the function has been already decorated with invariant checks, the function returns immediately.
:param func: function to be wrapped
:param is_init: True if the ``func`` is __init__
:return: function wrapped with invariant c... | 437 | 325 | 1,747 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | b8d9cceb280436b267c01ce86a9cfff68f05f0900e2e65059965de412b96e1cd | MIT | permissive | https://github.com/Parquery/icontract/blob/master/LICENSE.txt |
b13f31acbcf7ffb6839fff85 | Parquery/icontract | icontract/_checkers.py | _already_decorated_with_invariants | https://github.com/Parquery/icontract/blob/846e3187869a9ba790e9b893c98e5055e1cce274/icontract/_checkers.py#L417-L425 | train | python | Check if the function has been already decorated with an invariant check by going through its decorator stack. | def _already_decorated_with_invariants(func: CallableT) -> bool:
"""Check if the function has been already decorated with an invariant check by going through its decorator stack."""
already_decorated = False
for a_decorator in _walk_decorator_stack(func=func):
if getattr(a_decorator, "__is_invariant... | Check if the function has been already decorated with an invariant check by going through its decorator stack.
def _already_decorated_with_invariants(func: CallableT) -> bool:
"""Check if the function has been already decorated with an invariant check by going through its decorator stack."""
already_decorated ... | 106 | 110 | 423 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | 1a0471e6c43f57b9ea1ac4fc8ccf910473a842af4f63ebbbd6cdaedc7403ac5e | MIT | permissive | https://github.com/Parquery/icontract/blob/master/LICENSE.txt |
947ab98ef126dc1e14a1fe25 | Parquery/icontract | icontract/_checkers.py | add_invariant_checks | https://github.com/Parquery/icontract/blob/846e3187869a9ba790e9b893c98e5055e1cce274/icontract/_checkers.py#L428-L486 | train | python | Decorate each of the class functions with invariant checks if not already decorated. | def add_invariant_checks(cls: type) -> None:
"""Decorate each of the class functions with invariant checks if not already decorated."""
# Candidates for the decoration as list of (name, dir() value)
init_name_func = None # type: Optional[Tuple[str, Callable[..., None]]]
names_funcs = [] # type: List[T... | Decorate each of the class functions with invariant checks if not already decorated.
def add_invariant_checks(cls: type) -> None:
"""Decorate each of the class functions with invariant checks if not already decorated."""
# Candidates for the decoration as list of (name, dir() value)
init_name_func = None ... | 630 | 84 | 2,766 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | a0298b53a3edd895f9472e97eaed32e52ae146885744e111462809d25c645dca | MIT | permissive | https://github.com/Parquery/icontract/blob/master/LICENSE.txt |
185b1bee60b64a9768f8e150 | Parquery/icontract | benchmarks/import_cost/measure.py | main | https://github.com/Parquery/icontract/blob/846e3187869a9ba790e9b893c98e5055e1cce274/benchmarks/import_cost/measure.py#L13-L114 | train | python | Execute the main routine. | def main() -> None:
""""Execute the main routine."""
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument("--module", help="name of the module to import",
choices=[
"functions_100_with_no_contract",
"functi... | Execute the main routine.
def main() -> None:
""""Execute the main routine."""
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument("--module", help="name of the module to import",
choices=[
"functions_100_with_no_contract",
... | 800 | 25 | 3,759 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | 64368631b10e555f2d6262426e8df2715bb43cb7e64fe6836137e9fc32d4827f | MIT | permissive | https://github.com/Parquery/icontract/blob/master/LICENSE.txt |
8dc27ede17d06075953af7fe | Parquery/icontract | benchmarks/import_cost/runme.py | main | https://github.com/Parquery/icontract/blob/846e3187869a9ba790e9b893c98e5055e1cce274/benchmarks/import_cost/runme.py#L10-L42 | train | python | Execute the main routine. | def main() -> None:
""""Execute the main routine."""
modules = [
"functions_100_with_no_contract",
"functions_100_with_1_contract",
"functions_100_with_5_contracts",
"functions_100_with_10_contracts",
"functions_100_with_1_disabled_contract",
"functions_100_with... | Execute the main routine.
def main() -> None:
""""Execute the main routine."""
modules = [
"functions_100_with_no_contract",
"functions_100_with_1_contract",
"functions_100_with_5_contracts",
"functions_100_with_10_contracts",
"functions_100_with_1_disabled_contract",
... | 295 | 25 | 1,199 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | ccde46763cf68e376e26d41750ceadf0017ba98df2d8a8b408a1f961f215a621 | MIT | permissive | https://github.com/Parquery/icontract/blob/master/LICENSE.txt |
b9a8ea48ec82d4570cf587af | Parquery/icontract | benchmarks/import_cost/generate.py | main | https://github.com/Parquery/icontract/blob/846e3187869a9ba790e9b893c98e5055e1cce274/benchmarks/import_cost/generate.py#L60-L108 | train | python | Execute the main routine. | def main() -> None:
""""Execute the main routine."""
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument("--outdir", help="output directory", default=os.path.dirname(__file__))
args = parser.parse_args()
outdir = pathlib.Path(args.outdir)
if not outdir.exists():
ra... | Execute the main routine.
def main() -> None:
""""Execute the main routine."""
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument("--outdir", help="output directory", default=os.path.dirname(__file__))
args = parser.parse_args()
outdir = pathlib.Path(args.outdir)
if not ... | 492 | 25 | 1,953 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | 93d839d30ccea4a6753888477130de3119a5baf2c1c6892b6dbf1cfebc087dea | MIT | permissive | https://github.com/Parquery/icontract/blob/master/LICENSE.txt |
c7e620c7d5d5c33dbc1086e5 | Parquery/icontract | icontract/_recompute.py | Visitor.visit_Num | https://github.com/Parquery/icontract/blob/846e3187869a9ba790e9b893c98e5055e1cce274/icontract/_recompute.py#L48-L53 | train | python | Recompute the value as the number at the node. | def visit_Num(self, node: ast.Num) -> Union[int, float]:
"""Recompute the value as the number at the node."""
result = node.n
self.recomputed_values[node] = result
return result | Recompute the value as the number at the node.
def visit_Num(self, node: ast.Num) -> Union[int, float]:
"""Recompute the value as the number at the node."""
result = node.n
self.recomputed_values[node] = result
return result | 59 | 46 | 210 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | c15e6a013c890a00f31c35a7a35b1e2f796b7fc214add822a2c057ea1b740209 | MIT | permissive | https://github.com/Parquery/icontract/blob/master/LICENSE.txt |
b58a5e4dfcc5aeccc14e24a8 | Parquery/icontract | icontract/_recompute.py | Visitor.visit_Str | https://github.com/Parquery/icontract/blob/846e3187869a9ba790e9b893c98e5055e1cce274/icontract/_recompute.py#L55-L60 | train | python | Recompute the value as the string at the node. | def visit_Str(self, node: ast.Str) -> str:
"""Recompute the value as the string at the node."""
result = node.s
self.recomputed_values[node] = result
return result | Recompute the value as the string at the node.
def visit_Str(self, node: ast.Str) -> str:
"""Recompute the value as the string at the node."""
result = node.s
self.recomputed_values[node] = result
return result | 56 | 46 | 196 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | f58799277a2a1610fea1537e6db93dd3b0311fab6544bb190b824e54860b764e | MIT | permissive | https://github.com/Parquery/icontract/blob/master/LICENSE.txt |
01e547388c5ccfb0f1a52353 | Parquery/icontract | icontract/_recompute.py | Visitor.visit_Bytes | https://github.com/Parquery/icontract/blob/846e3187869a9ba790e9b893c98e5055e1cce274/icontract/_recompute.py#L62-L67 | train | python | Recompute the value as the bytes at the node. | def visit_Bytes(self, node: ast.Bytes) -> bytes:
"""Recompute the value as the bytes at the node."""
result = node.s
self.recomputed_values[node] = result
return node.s | Recompute the value as the bytes at the node.
def visit_Bytes(self, node: ast.Bytes) -> bytes:
"""Recompute the value as the bytes at the node."""
result = node.s
self.recomputed_values[node] = result
return node.s | 58 | 45 | 201 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | 1425857e0a002228798185d8fe4e51ad982733d97038940adc053c7623cb74ff | MIT | permissive | https://github.com/Parquery/icontract/blob/master/LICENSE.txt |
ce117e739ffafdc6f1f13a46 | Parquery/icontract | icontract/_recompute.py | Visitor.visit_List | https://github.com/Parquery/icontract/blob/846e3187869a9ba790e9b893c98e5055e1cce274/icontract/_recompute.py#L69-L77 | train | python | Visit the elements and assemble the results into a list. | def visit_List(self, node: ast.List) -> List[Any]:
"""Visit the elements and assemble the results into a list."""
if isinstance(node.ctx, ast.Store):
raise NotImplementedError("Can not compute the value of a Store on a list")
result = [self.visit(node=elt) for elt in node.elts]
... | Visit the elements and assemble the results into a list.
def visit_List(self, node: ast.List) -> List[Any]:
"""Visit the elements and assemble the results into a list."""
if isinstance(node.ctx, ast.Store):
raise NotImplementedError("Can not compute the value of a Store on a list")
... | 93 | 56 | 384 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | f28bf1a3424ea20f0e95ab882646819c5f54bd6cb97084d29606eaa82d0ac049 | MIT | permissive | https://github.com/Parquery/icontract/blob/master/LICENSE.txt |
53558a212ca889bd0916f9ac | Parquery/icontract | icontract/_recompute.py | Visitor.visit_Tuple | https://github.com/Parquery/icontract/blob/846e3187869a9ba790e9b893c98e5055e1cce274/icontract/_recompute.py#L79-L87 | train | python | Visit the elements and assemble the results into a tuple. | def visit_Tuple(self, node: ast.Tuple) -> Tuple[Any, ...]:
"""Visit the elements and assemble the results into a tuple."""
if isinstance(node.ctx, ast.Store):
raise NotImplementedError("Can not compute the value of a Store on a tuple")
result = tuple(self.visit(node=elt) for elt in ... | Visit the elements and assemble the results into a tuple.
def visit_Tuple(self, node: ast.Tuple) -> Tuple[Any, ...]:
"""Visit the elements and assemble the results into a tuple."""
if isinstance(node.ctx, ast.Store):
raise NotImplementedError("Can not compute the value of a Store on a tuple... | 97 | 57 | 399 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | 1ab7c4ffe05fbf436ec5c75e185521b85720121fddd65aa7bfc8532a19907f67 | MIT | permissive | https://github.com/Parquery/icontract/blob/master/LICENSE.txt |
c479d69f09b9facd50958d5e | Parquery/icontract | icontract/_recompute.py | Visitor.visit_Set | https://github.com/Parquery/icontract/blob/846e3187869a9ba790e9b893c98e5055e1cce274/icontract/_recompute.py#L89-L94 | train | python | Visit the elements and assemble the results into a set. | def visit_Set(self, node: ast.Set) -> Set[Any]:
"""Visit the elements and assemble the results into a set."""
result = set(self.visit(node=elt) for elt in node.elts)
self.recomputed_values[node] = result
return result | Visit the elements and assemble the results into a set.
def visit_Set(self, node: ast.Set) -> Set[Any]:
"""Visit the elements and assemble the results into a set."""
result = set(self.visit(node=elt) for elt in node.elts)
self.recomputed_values[node] = result
return result | 68 | 55 | 250 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | 6ef6b991063cf3929fbaf2e795d44eb73bea8810425c4c2527556d779901f9ee | MIT | permissive | https://github.com/Parquery/icontract/blob/master/LICENSE.txt |
a1e17e7429ecfbe821d30d61 | Parquery/icontract | icontract/_recompute.py | Visitor.visit_Dict | https://github.com/Parquery/icontract/blob/846e3187869a9ba790e9b893c98e5055e1cce274/icontract/_recompute.py#L96-L103 | train | python | Visit keys and values and assemble a dictionary with the results. | def visit_Dict(self, node: ast.Dict) -> Dict[Any, Any]:
"""Visit keys and values and assemble a dictionary with the results."""
recomputed_dict = dict() # type: Dict[Any, Any]
for key, val in zip(node.keys, node.values):
recomputed_dict[self.visit(node=key)] = self.visit(node=val)
... | Visit keys and values and assemble a dictionary with the results.
def visit_Dict(self, node: ast.Dict) -> Dict[Any, Any]:
"""Visit keys and values and assemble a dictionary with the results."""
recomputed_dict = dict() # type: Dict[Any, Any]
for key, val in zip(node.keys, node.values):
... | 104 | 65 | 405 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | ecebca673908b768f601477136b330200e4efbea5e260456f428614f30fd9674 | MIT | permissive | https://github.com/Parquery/icontract/blob/master/LICENSE.txt |
6e20453d84554a1bf05a3d45 | Parquery/icontract | icontract/_recompute.py | Visitor.visit_NameConstant | https://github.com/Parquery/icontract/blob/846e3187869a9ba790e9b893c98e5055e1cce274/icontract/_recompute.py#L105-L108 | train | python | Forward the node value as a result. | def visit_NameConstant(self, node: ast.NameConstant) -> Any:
"""Forward the node value as a result."""
self.recomputed_values[node] = node.value
return node.value | Forward the node value as a result.
def visit_NameConstant(self, node: ast.NameConstant) -> Any:
"""Forward the node value as a result."""
self.recomputed_values[node] = node.value
return node.value | 48 | 35 | 186 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | ad7ebff426879baf581b5e5b74579ea9445006b50ccb09077c0c023d33bd6f97 | MIT | permissive | https://github.com/Parquery/icontract/blob/master/LICENSE.txt |
6b7bb6f9405cf5463f2d71f6 | Parquery/icontract | icontract/_recompute.py | Visitor.visit_Name | https://github.com/Parquery/icontract/blob/846e3187869a9ba790e9b893c98e5055e1cce274/icontract/_recompute.py#L110-L130 | train | python | Load the variable by looking it up in the variable look-up and in the built-ins. | def visit_Name(self, node: ast.Name) -> Any:
"""Load the variable by looking it up in the variable look-up and in the built-ins."""
if not isinstance(node.ctx, ast.Load):
raise NotImplementedError("Can only compute a value of Load on a name {}, but got context: {}".format(
no... | Load the variable by looking it up in the variable look-up and in the built-ins.
def visit_Name(self, node: ast.Name) -> Any:
"""Load the variable by looking it up in the variable look-up and in the built-ins."""
if not isinstance(node.ctx, ast.Load):
raise NotImplementedError("Can only com... | 220 | 80 | 964 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | 08f5b353e97d1707fd9a8496f9be4ba2afc0728a452f4f43b5908da1cf03c93a | MIT | permissive | https://github.com/Parquery/icontract/blob/master/LICENSE.txt |
7ad0cef3bc76f714cb51d6a6 | Parquery/icontract | icontract/_recompute.py | Visitor.visit_Expr | https://github.com/Parquery/icontract/blob/846e3187869a9ba790e9b893c98e5055e1cce274/icontract/_recompute.py#L132-L137 | train | python | Visit the node's ``value``. | def visit_Expr(self, node: ast.Expr) -> Any:
"""Visit the node's ``value``."""
result = self.visit(node=node.value)
self.recomputed_values[node] = result
return result | Visit the node's ``value``.
def visit_Expr(self, node: ast.Expr) -> Any:
"""Visit the node's ``value``."""
result = self.visit(node=node.value)
self.recomputed_values[node] = result
return result | 54 | 27 | 200 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | 5f3845b09d4b9085d4a4ac2b2bb3dc2d465ff68300337d90eb59f6714f6206bb | MIT | permissive | https://github.com/Parquery/icontract/blob/master/LICENSE.txt |
f4131d88e1ca1513be17ebfc | Parquery/icontract | icontract/_recompute.py | Visitor.visit_UnaryOp | https://github.com/Parquery/icontract/blob/846e3187869a9ba790e9b893c98e5055e1cce274/icontract/_recompute.py#L139-L153 | train | python | Visit the node operand and apply the operation on the result. | def visit_UnaryOp(self, node: ast.UnaryOp) -> Any:
"""Visit the node operand and apply the operation on the result."""
if isinstance(node.op, ast.UAdd):
result = +self.visit(node=node.operand)
elif isinstance(node.op, ast.USub):
result = -self.visit(node=node.operand)
... | Visit the node operand and apply the operation on the result.
def visit_UnaryOp(self, node: ast.UnaryOp) -> Any:
"""Visit the node operand and apply the operation on the result."""
if isinstance(node.op, ast.UAdd):
result = +self.visit(node=node.operand)
elif isinstance(node.op, ast... | 157 | 61 | 681 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | 494834f3169c472b0b918683c93183585fd82b37979214120f386e10e0ab5752 | MIT | permissive | https://github.com/Parquery/icontract/blob/master/LICENSE.txt |
a244cf77fbbc87bfba7df49c | Parquery/icontract | icontract/_recompute.py | Visitor.visit_BinOp | https://github.com/Parquery/icontract/blob/846e3187869a9ba790e9b893c98e5055e1cce274/icontract/_recompute.py#L155-L191 | train | python | Recursively visit the left and right operand, respectively, and apply the operation on the results. | def visit_BinOp(self, node: ast.BinOp) -> Any:
"""Recursively visit the left and right operand, respectively, and apply the operation on the results."""
# pylint: disable=too-many-branches
left = self.visit(node=node.left)
right = self.visit(node=node.right)
if isinstance(node.o... | Recursively visit the left and right operand, respectively, and apply the operation on the results.
def visit_BinOp(self, node: ast.BinOp) -> Any:
"""Recursively visit the left and right operand, respectively, and apply the operation on the results."""
# pylint: disable=too-many-branches
left =... | 334 | 99 | 1,485 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | 20292fd96d62e7577a4494d98abeaec7ec501f097b54b9bb54dca3329d9b3945 | MIT | permissive | https://github.com/Parquery/icontract/blob/master/LICENSE.txt |
fed9c17cb09e7b277d869693 | Parquery/icontract | icontract/_recompute.py | Visitor.visit_BoolOp | https://github.com/Parquery/icontract/blob/846e3187869a9ba790e9b893c98e5055e1cce274/icontract/_recompute.py#L193-L205 | train | python | Recursively visit the operands and apply the operation on them. | def visit_BoolOp(self, node: ast.BoolOp) -> Any:
"""Recursively visit the operands and apply the operation on them."""
values = [self.visit(value_node) for value_node in node.values]
if isinstance(node.op, ast.And):
result = functools.reduce(lambda left, right: left and right, value... | Recursively visit the operands and apply the operation on them.
def visit_BoolOp(self, node: ast.BoolOp) -> Any:
"""Recursively visit the operands and apply the operation on them."""
values = [self.visit(value_node) for value_node in node.values]
if isinstance(node.op, ast.And):
re... | 142 | 63 | 626 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | dc7826afe056416d11b8f3076bc57d3aafad19e00ee7cfd4a4c0286414120f60 | MIT | permissive | https://github.com/Parquery/icontract/blob/master/LICENSE.txt |
c890b820b115b1c135f49d8a | Parquery/icontract | icontract/_recompute.py | Visitor.visit_Compare | https://github.com/Parquery/icontract/blob/846e3187869a9ba790e9b893c98e5055e1cce274/icontract/_recompute.py#L207-L247 | train | python | Recursively visit the comparators and apply the operations on them. | def visit_Compare(self, node: ast.Compare) -> Any:
"""Recursively visit the comparators and apply the operations on them."""
# pylint: disable=too-many-branches
left = self.visit(node=node.left)
comparators = [self.visit(node=comparator) for comparator in node.comparators]
resu... | Recursively visit the comparators and apply the operations on them.
def visit_Compare(self, node: ast.Compare) -> Any:
"""Recursively visit the comparators and apply the operations on them."""
# pylint: disable=too-many-branches
left = self.visit(node=node.left)
comparators = [self.vis... | 324 | 67 | 1,651 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | 3ae2c664ec65d867fa0126df0983c216757db2ed5f3e91562ffbca26f534ab3e | MIT | permissive | https://github.com/Parquery/icontract/blob/master/LICENSE.txt |
501a84431411823ea6440443 | Parquery/icontract | icontract/_recompute.py | Visitor.visit_Call | https://github.com/Parquery/icontract/blob/846e3187869a9ba790e9b893c98e5055e1cce274/icontract/_recompute.py#L249-L273 | train | python | Visit the function and the arguments and finally make the function call with them. | def visit_Call(self, node: ast.Call) -> Any:
"""Visit the function and the arguments and finally make the function call with them."""
func = self.visit(node=node.func)
args = [] # type: List[Any]
for arg_node in node.args:
if isinstance(arg_node, ast.Starred):
... | Visit the function and the arguments and finally make the function call with them.
def visit_Call(self, node: ast.Call) -> Any:
"""Visit the function and the arguments and finally make the function call with them."""
func = self.visit(node=node.func)
args = [] # type: List[Any]
for ar... | 201 | 82 | 888 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | 649dcd2cc65c3c676169d8755238ad9236d451e64059208682b33590eb0fbc9b | MIT | permissive | https://github.com/Parquery/icontract/blob/master/LICENSE.txt |
bf5f51ddda96eb0e999a887b | Parquery/icontract | icontract/_recompute.py | Visitor.visit_IfExp | https://github.com/Parquery/icontract/blob/846e3187869a9ba790e9b893c98e5055e1cce274/icontract/_recompute.py#L275-L285 | train | python | Visit the ``test``, and depending on its outcome, the ``body`` or ``orelse``. | def visit_IfExp(self, node: ast.IfExp) -> Any:
"""Visit the ``test``, and depending on its outcome, the ``body`` or ``orelse``."""
test = self.visit(node=node.test)
if test:
result = self.visit(node=node.body)
else:
result = self.visit(node=node.orelse)
... | Visit the ``test``, and depending on its outcome, the ``body`` or ``orelse``.
def visit_IfExp(self, node: ast.IfExp) -> Any:
"""Visit the ``test``, and depending on its outcome, the ``body`` or ``orelse``."""
test = self.visit(node=node.test)
if test:
result = self.visit(node=node.... | 109 | 77 | 379 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | ca04c9f1bfc0f9d1261ebcdea07eb1e4ae4d5236e35a132e09e42880a96c519a | MIT | permissive | https://github.com/Parquery/icontract/blob/master/LICENSE.txt |
7b3e222d19243fad13e4e64d | Parquery/icontract | icontract/_recompute.py | Visitor.visit_Attribute | https://github.com/Parquery/icontract/blob/846e3187869a9ba790e9b893c98e5055e1cce274/icontract/_recompute.py#L287-L297 | train | python | Visit the node's ``value`` and get the attribute from the result. | def visit_Attribute(self, node: ast.Attribute) -> Any:
"""Visit the node's ``value`` and get the attribute from the result."""
value = self.visit(node=node.value)
if not isinstance(node.ctx, ast.Load):
raise NotImplementedError(
"Can only compute a value of Load on th... | Visit the node's ``value`` and get the attribute from the result.
def visit_Attribute(self, node: ast.Attribute) -> Any:
"""Visit the node's ``value`` and get the attribute from the result."""
value = self.visit(node=node.value)
if not isinstance(node.ctx, ast.Load):
raise NotImplem... | 116 | 65 | 498 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | 9676cc8ac24f97333dbbf13e09189567d26bf358467eb6c38411a77742c9c363 | MIT | permissive | https://github.com/Parquery/icontract/blob/master/LICENSE.txt |
6439b3cfc1f3375f77736816 | Parquery/icontract | icontract/_recompute.py | Visitor.visit_Index | https://github.com/Parquery/icontract/blob/846e3187869a9ba790e9b893c98e5055e1cce274/icontract/_recompute.py#L299-L304 | train | python | Visit the node's ``value``. | def visit_Index(self, node: ast.Index) -> Any:
"""Visit the node's ``value``."""
result = self.visit(node=node.value)
self.recomputed_values[node] = result
return result | Visit the node's ``value``.
def visit_Index(self, node: ast.Index) -> Any:
"""Visit the node's ``value``."""
result = self.visit(node=node.value)
self.recomputed_values[node] = result
return result | 53 | 27 | 202 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | ef5536da0be1ccbe8c45e7abd5ef31c111b13383f0ea18a3d48d9c158c2df085 | MIT | permissive | https://github.com/Parquery/icontract/blob/master/LICENSE.txt |
3fa16bd4ea54b8105f11b2f0 | Parquery/icontract | icontract/_recompute.py | Visitor.visit_Slice | https://github.com/Parquery/icontract/blob/846e3187869a9ba790e9b893c98e5055e1cce274/icontract/_recompute.py#L306-L323 | train | python | Visit ``lower``, ``upper`` and ``step`` and recompute the node as a ``slice``. | def visit_Slice(self, node: ast.Slice) -> slice:
"""Visit ``lower``, ``upper`` and ``step`` and recompute the node as a ``slice``."""
lower = None # type: Optional[int]
if node.lower is not None:
lower = self.visit(node=node.lower)
upper = None # type: Optional[int]
... | Visit ``lower``, ``upper`` and ``step`` and recompute the node as a ``slice``.
def visit_Slice(self, node: ast.Slice) -> slice:
"""Visit ``lower``, ``upper`` and ``step`` and recompute the node as a ``slice``."""
lower = None # type: Optional[int]
if node.lower is not None:
lower =... | 167 | 78 | 633 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | 12cef47de0376be3ad05df6cd4bf3304c3dda04ff0837c62be9854099346da8a | MIT | permissive | https://github.com/Parquery/icontract/blob/master/LICENSE.txt |
099ed7d8f9211efef92a5ca7 | Parquery/icontract | icontract/_recompute.py | Visitor.visit_ExtSlice | https://github.com/Parquery/icontract/blob/846e3187869a9ba790e9b893c98e5055e1cce274/icontract/_recompute.py#L325-L330 | train | python | Visit each dimension of the advanced slicing and assemble the dimensions in a tuple. | def visit_ExtSlice(self, node: ast.ExtSlice) -> Tuple[Any, ...]:
"""Visit each dimension of the advanced slicing and assemble the dimensions in a tuple."""
result = tuple(self.visit(node=dim) for dim in node.dims)
self.recomputed_values[node] = result
return result | Visit each dimension of the advanced slicing and assemble the dimensions in a tuple.
def visit_ExtSlice(self, node: ast.ExtSlice) -> Tuple[Any, ...]:
"""Visit each dimension of the advanced slicing and assemble the dimensions in a tuple."""
result = tuple(self.visit(node=dim) for dim in node.dims)
... | 81 | 84 | 298 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | 6e5876e732cec1207ab18d9e9430697968cca13b1e3d75934784ea911007e9b4 | MIT | permissive | https://github.com/Parquery/icontract/blob/master/LICENSE.txt |
5993021f0a09fe126751f4f2 | Parquery/icontract | icontract/_recompute.py | Visitor.visit_Subscript | https://github.com/Parquery/icontract/blob/846e3187869a9ba790e9b893c98e5055e1cce274/icontract/_recompute.py#L332-L340 | train | python | Visit the ``slice`` and a ``value`` and get the element. | def visit_Subscript(self, node: ast.Subscript) -> Any:
"""Visit the ``slice`` and a ``value`` and get the element."""
value = self.visit(node=node.value)
a_slice = self.visit(node=node.slice)
result = value[a_slice]
self.recomputed_values[node] = result
return result | Visit the ``slice`` and a ``value`` and get the element.
def visit_Subscript(self, node: ast.Subscript) -> Any:
"""Visit the ``slice`` and a ``value`` and get the element."""
value = self.visit(node=node.value)
a_slice = self.visit(node=node.slice)
result = value[a_slice]
self... | 86 | 56 | 317 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | 3c77b6e5ec3eaa74e763fd37e312979d930ac685465bf134ee82146738d16c2c | MIT | permissive | https://github.com/Parquery/icontract/blob/master/LICENSE.txt |
442b4cfe3a3b9754ede1a6a7 | Parquery/icontract | icontract/_recompute.py | Visitor._execute_comprehension | https://github.com/Parquery/icontract/blob/846e3187869a9ba790e9b893c98e5055e1cce274/icontract/_recompute.py#L342-L364 | train | python | Compile the generator or comprehension from the node and execute the compiled code. | def _execute_comprehension(self, node: Union[ast.ListComp, ast.SetComp, ast.GeneratorExp, ast.DictComp]) -> Any:
"""Compile the generator or comprehension from the node and execute the compiled code."""
args = [ast.arg(arg=name) for name in sorted(self._name_to_value.keys())]
func_def_node = as... | Compile the generator or comprehension from the node and execute the compiled code.
def _execute_comprehension(self, node: Union[ast.ListComp, ast.SetComp, ast.GeneratorExp, ast.DictComp]) -> Any:
"""Compile the generator or comprehension from the node and execute the compiled code."""
args = [ast.arg(... | 235 | 83 | 1,008 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | 7d13b106e5f013f24b71330100fab6263bb985f05c4e5893098063374949c5e8 | MIT | permissive | https://github.com/Parquery/icontract/blob/master/LICENSE.txt |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.