_id stringlengths 2 7 | title stringlengths 1 88 | partition stringclasses 3
values | text stringlengths 75 19.8k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q236600 | compute_err_score | train | def compute_err_score(true_positives, n_ref, n_est):
"""Compute error score metrics.
Parameters
----------
true_positives : np.ndarray
Array containing the number of true positives at each time point.
n_ref : np.ndarray
Array containing the number of reference frequencies at each ti... | python | {
"resource": ""
} |
q236601 | _hierarchy_bounds | train | def _hierarchy_bounds(intervals_hier):
'''Compute the covered time range of a hierarchical segmentation.
Parameters
----------
intervals_hier : list of ndarray
A hierarchical segmentation, encoded as a list of arrays of segment
intervals.
Returns
-------
t_min : float
t... | python | {
"resource": ""
} |
q236602 | _align_intervals | train | def _align_intervals(int_hier, lab_hier, t_min=0.0, t_max=None):
'''Align a hierarchical annotation to span a fixed start and end time.
Parameters
----------
int_hier : list of list of intervals
lab_hier : list of list of str
Hierarchical segment annotations, encoded as a
list of li... | python | {
"resource": ""
} |
q236603 | _compare_frame_rankings | train | def _compare_frame_rankings(ref, est, transitive=False):
'''Compute the number of ranking disagreements in two lists.
Parameters
----------
ref : np.ndarray, shape=(n,)
est : np.ndarray, shape=(n,)
Reference and estimate ranked lists.
`ref[i]` is the relevance score for point `i`.
... | python | {
"resource": ""
} |
q236604 | validate_hier_intervals | train | def validate_hier_intervals(intervals_hier):
'''Validate a hierarchical segment annotation.
Parameters
----------
intervals_hier : ordered list of segmentations
Raises
------
ValueError
If any segmentation does not span the full duration of the top-level
segmentation.
... | python | {
"resource": ""
} |
q236605 | evaluate | train | def evaluate(ref_intervals_hier, ref_labels_hier,
est_intervals_hier, est_labels_hier, **kwargs):
'''Compute all hierarchical structure metrics for the given reference and
estimated annotations.
Examples
--------
A toy example with two two-layer annotations
>>> ref_i = [[[0, 30], ... | python | {
"resource": ""
} |
q236606 | __expand_limits | train | def __expand_limits(ax, limits, which='x'):
'''Helper function to expand axis limits'''
if which == 'x':
getter, setter = ax.get_xlim, ax.set_xlim
elif which == 'y':
getter, setter = ax.get_ylim, ax.set_ylim
else:
raise ValueError('invalid axis: {}'.format(which))
old_lims ... | python | {
"resource": ""
} |
q236607 | __get_axes | train | def __get_axes(ax=None, fig=None):
'''Get or construct the target axes object for a new plot.
Parameters
----------
ax : matplotlib.pyplot.axes, optional
If provided, return this axes object directly.
fig : matplotlib.figure.Figure, optional
The figure to query for axes.
B... | python | {
"resource": ""
} |
q236608 | segments | train | def segments(intervals, labels, base=None, height=None, text=False,
text_kw=None, ax=None, **kwargs):
'''Plot a segmentation as a set of disjoint rectangles.
Parameters
----------
intervals : np.ndarray, shape=(n, 2)
segment intervals, in the format returned by
:func:`mir_e... | python | {
"resource": ""
} |
q236609 | labeled_intervals | train | def labeled_intervals(intervals, labels, label_set=None,
base=None, height=None, extend_labels=True,
ax=None, tick=True, **kwargs):
'''Plot labeled intervals with each label on its own row.
Parameters
----------
intervals : np.ndarray, shape=(n, 2)
se... | python | {
"resource": ""
} |
q236610 | hierarchy | train | def hierarchy(intervals_hier, labels_hier, levels=None, ax=None, **kwargs):
'''Plot a hierarchical segmentation
Parameters
----------
intervals_hier : list of np.ndarray
A list of segmentation intervals. Each element should be
an n-by-2 array of segment intervals, in the format returne... | python | {
"resource": ""
} |
q236611 | events | train | def events(times, labels=None, base=None, height=None, ax=None, text_kw=None,
**kwargs):
'''Plot event times as a set of vertical lines
Parameters
----------
times : np.ndarray, shape=(n,)
event times, in the format returned by
:func:`mir_eval.io.load_events` or
:func... | python | {
"resource": ""
} |
q236612 | pitch | train | def pitch(times, frequencies, midi=False, unvoiced=False, ax=None, **kwargs):
'''Visualize pitch contours
Parameters
----------
times : np.ndarray, shape=(n,)
Sample times of frequencies
frequencies : np.ndarray, shape=(n,)
frequencies (in Hz) of the pitch contours.
Voicing... | python | {
"resource": ""
} |
q236613 | multipitch | train | def multipitch(times, frequencies, midi=False, unvoiced=False, ax=None,
**kwargs):
'''Visualize multiple f0 measurements
Parameters
----------
times : np.ndarray, shape=(n,)
Sample times of frequencies
frequencies : list of np.ndarray
frequencies (in Hz) of the pitch... | python | {
"resource": ""
} |
q236614 | piano_roll | train | def piano_roll(intervals, pitches=None, midi=None, ax=None, **kwargs):
'''Plot a quantized piano roll as intervals
Parameters
----------
intervals : np.ndarray, shape=(n, 2)
timing intervals for notes
pitches : np.ndarray, shape=(n,), optional
pitches of notes (in Hz).
midi : ... | python | {
"resource": ""
} |
q236615 | separation | train | def separation(sources, fs=22050, labels=None, alpha=0.75, ax=None, **kwargs):
'''Source-separation visualization
Parameters
----------
sources : np.ndarray, shape=(nsrc, nsampl)
A list of waveform buffers corresponding to each source
fs : number > 0
The sampling rate
labels :... | python | {
"resource": ""
} |
q236616 | __ticker_midi_note | train | def __ticker_midi_note(x, pos):
'''A ticker function for midi notes.
Inputs x are interpreted as midi numbers, and converted
to [NOTE][OCTAVE]+[cents].
'''
NOTES = ['C', 'C#', 'D', 'D#', 'E', 'F', 'F#', 'G', 'G#', 'A', 'A#', 'B']
cents = float(np.mod(x, 1.0))
if cents >= 0.5:
cent... | python | {
"resource": ""
} |
q236617 | ticker_notes | train | def ticker_notes(ax=None):
'''Set the y-axis of the given axes to MIDI notes
Parameters
----------
ax : matplotlib.pyplot.axes
The axes handle to apply the ticker.
By default, uses the current axes handle.
'''
ax, _ = __get_axes(ax=ax)
ax.yaxis.set_major_formatter(FMT_MIDI... | python | {
"resource": ""
} |
q236618 | ticker_pitch | train | def ticker_pitch(ax=None):
'''Set the y-axis of the given axes to MIDI frequencies
Parameters
----------
ax : matplotlib.pyplot.axes
The axes handle to apply the ticker.
By default, uses the current axes handle.
'''
ax, _ = __get_axes(ax=ax)
ax.yaxis.set_major_formatter(FMT... | python | {
"resource": ""
} |
q236619 | FileImportJob.run | train | def run(self, **import_params):
"""
Actually creates the import job on the CARTO server
:param import_params: To be send to the Import API, see CARTO's docs
on Import API for an updated list of accepted
params
:type import_... | python | {
"resource": ""
} |
q236620 | FileImportJobManager.filter | train | def filter(self):
"""
Get a filtered list of file imports
:return: A list of file imports, with only the id set (you need to
refresh them if you want all the attributes to be filled in)
:rtype: list of :class:`carto.file_import.FileImportJob`
:raise: CartoExcept... | python | {
"resource": ""
} |
q236621 | APIKeyAuthClient.send | train | def send(self, relative_path, http_method, **requests_args):
"""
Makes an API-key-authorized request
:param relative_path: URL path relative to self.base_url
:param http_method: HTTP method
:param requests_args: kwargs to be sent to requests
:type relative_path: str
... | python | {
"resource": ""
} |
q236622 | AuthAPIClient.is_valid_api_key | train | def is_valid_api_key(self):
"""
Checks validity. Right now, an API key is considered valid if it
can list user API keys and the result contains that API key.
This might change in the future.
:return: True if the API key is considered valid for current user.
"""
r... | python | {
"resource": ""
} |
q236623 | DatasetManager.send | train | def send(self, url, http_method, **client_args):
"""
Sends an API request, taking into account that datasets are part of
the visualization endpoint.
:param url: Endpoint URL
:param http_method: The method used to make the request to the API
:param client_args: Arguments ... | python | {
"resource": ""
} |
q236624 | DatasetManager.is_sync_table | train | def is_sync_table(self, archive, interval, **import_args):
"""
Checks if this is a request for a sync dataset.
The condition for creating a sync dataset is to provide a URL or a
connection to an external database and an interval in seconds
:param archive: URL to the file (both ... | python | {
"resource": ""
} |
q236625 | DatasetManager.create | train | def create(self, archive, interval=None, **import_args):
"""
Creating a table means uploading a file or setting up a sync table
:param archive: URL to the file (both remote URLs or local paths are
supported) or StringIO object
:param interval: Interval in seconds.
... | python | {
"resource": ""
} |
q236626 | VisualizationManager.send | train | def send(self, url, http_method, **client_args):
"""
Sends API request, taking into account that visualizations are only a
subset of the resources available at the visualization endpoint
:param url: Endpoint URL
:param http_method: The method used to make the request to the API
... | python | {
"resource": ""
} |
q236627 | CartoRateLimitException.is_rate_limited | train | def is_rate_limited(response):
"""
Checks if the response has been rate limited by CARTO APIs
:param response: The response rate limited by CARTO APIs
:type response: requests.models.Response class
:return: Boolean
"""
if (response.status_code == codes.too_many_... | python | {
"resource": ""
} |
q236628 | NamedMap.update_from_dict | train | def update_from_dict(self, attribute_dict):
"""
Method overriden from the base class
"""
if 'template' in attribute_dict:
self.update_from_dict(attribute_dict['template'])
setattr(self,
self.Meta.id_field, attribute_dict['template']['name'])
... | python | {
"resource": ""
} |
q236629 | AsyncResource.run | train | def run(self, **client_params):
"""
Actually creates the async job on the CARTO server
:param client_params: To be send to the CARTO API. See CARTO's
documentation depending on the subclass
you are using
:type client_param... | python | {
"resource": ""
} |
q236630 | SQLClient.send | train | def send(self, sql, parse_json=True, do_post=True, format=None, **request_args):
"""
Executes SQL query in a CARTO server
:param sql: The SQL
:param parse_json: Set it to False if you want raw reponse
:param do_post: Set it to True to force post request
:param format: An... | python | {
"resource": ""
} |
q236631 | BatchSQLClient.send | train | def send(self, url, http_method, json_body=None, http_header=None):
"""
Executes Batch SQL query in a CARTO server
:param url: Endpoint url
:param http_method: The method used to make the request to the API
:param json_body: The information that needs to be sent, by default
... | python | {
"resource": ""
} |
q236632 | BatchSQLClient.create | train | def create(self, sql_query):
"""
Creates a new batch SQL query.
Batch SQL jobs are asynchronous, once created you should call
:func:`carto.sql.BatchSQLClient.read` method given the `job_id`
to retrieve the state of the batch query
:param sql_query: The SQL query to be u... | python | {
"resource": ""
} |
q236633 | BatchSQLClient.create_and_wait_for_completion | train | def create_and_wait_for_completion(self, sql_query):
"""
Creates a new batch SQL query and waits for its completion or failure
Batch SQL jobs are asynchronous, once created this method
automatically queries the job status until it's one of 'done',
'failed', 'canceled', 'unknown'... | python | {
"resource": ""
} |
q236634 | BatchSQLClient.read | train | def read(self, job_id):
"""
Reads the information for a specific Batch API request
:param job_id: The id of the job to be read from
:type job_id: str
:return: Response data, either as json or as a regular response.content
object
:rtype: object
... | python | {
"resource": ""
} |
q236635 | BatchSQLClient.update | train | def update(self, job_id, sql_query):
"""
Updates the sql query of a specific job
:param job_id: The id of the job to be updated
:param sql_query: The new SQL query for the job
:type job_id: str
:type sql_query: str
:return: Response data, either as json or as a ... | python | {
"resource": ""
} |
q236636 | BatchSQLClient.cancel | train | def cancel(self, job_id):
"""
Cancels a job
:param job_id: The id of the job to be cancelled
:type job_id: str
:return: A status code depending on whether the cancel request was
successful
:rtype: str
:raise CartoException:
"""
... | python | {
"resource": ""
} |
q236637 | CopySQLClient.copyfrom | train | def copyfrom(self, query, iterable_data, compress=True,
compression_level=DEFAULT_COMPRESSION_LEVEL):
"""
Gets data from an iterable object into a table
:param query: The "COPY table_name [(column_name[, ...])]
FROM STDIN [WITH(option[,...])]" query t... | python | {
"resource": ""
} |
q236638 | CopySQLClient.copyfrom_file_object | train | def copyfrom_file_object(self, query, file_object, compress=True,
compression_level=DEFAULT_COMPRESSION_LEVEL):
"""
Gets data from a readable file object into a table
:param query: The "COPY table_name [(column_name[, ...])]
FROM STDIN [WI... | python | {
"resource": ""
} |
q236639 | CopySQLClient.copyfrom_file_path | train | def copyfrom_file_path(self, query, path, compress=True,
compression_level=DEFAULT_COMPRESSION_LEVEL):
"""
Gets data from a readable file into a table
:param query: The "COPY table_name [(column_name[, ...])]
FROM STDIN [WITH(option[,...])]"... | python | {
"resource": ""
} |
q236640 | CopySQLClient.copyto | train | def copyto(self, query):
"""
Gets data from a table into a Response object that can be iterated
:param query: The "COPY { table_name [(column_name[, ...])] | (query) }
TO STDOUT [WITH(option[,...])]" query to execute
:type query: str
:return: response... | python | {
"resource": ""
} |
q236641 | CopySQLClient.copyto_file_object | train | def copyto_file_object(self, query, file_object):
"""
Gets data from a table into a writable file object
:param query: The "COPY { table_name [(column_name[, ...])] | (query) }
TO STDOUT [WITH(option[,...])]" query to execute
:type query: str
:param f... | python | {
"resource": ""
} |
q236642 | CopySQLClient.copyto_file_path | train | def copyto_file_path(self, query, path, append=False):
"""
Gets data from a table into a writable file
:param query: The "COPY { table_name [(column_name[, ...])] | (query) }
TO STDOUT [WITH(option[,...])]" query to execute
:type query: str
:param pat... | python | {
"resource": ""
} |
q236643 | SyncTableJob.run | train | def run(self, **import_params):
"""
Actually creates the job import on the CARTO server
:param import_params: To be send to the Import API, see CARTO's docs
on Import API for an updated list of accepted
params
:type import_... | python | {
"resource": ""
} |
q236644 | SyncTableJob.force_sync | train | def force_sync(self):
"""
Forces to sync the SyncTableJob
:return:
:raise: CartoException
"""
try:
self.send(self.get_resource_endpoint(), "put")
except Exception as e:
raise CartoException(e) | python | {
"resource": ""
} |
q236645 | BaseModel.set_prob_type | train | def set_prob_type(cls, problem_type, classification_type, eval_type):
""" Set problem type """
assert problem_type in problem_type_list, 'Need to set Problem Type'
if problem_type == 'classification':
assert classification_type in classification_type_list,\
... | python | {
"resource": ""
} |
q236646 | BaseModel.make_multi_cols | train | def make_multi_cols(self, num_class, name):
'''make cols for multi-class predictions'''
cols = ['c' + str(i) + '_' for i in xrange(num_class)]
cols = map(lambda x: x + name, cols)
return cols | python | {
"resource": ""
} |
q236647 | PathTableRecord.parse | train | def parse(self, data):
# type: (bytes) -> None
'''
A method to parse an ISO9660 Path Table Record out of a string.
Parameters:
data - The string to parse.
Returns:
Nothing.
'''
(self.len_di, self.xattr_length, self.extent_location,
self... | python | {
"resource": ""
} |
q236648 | PathTableRecord._record | train | def _record(self, ext_loc, parent_dir_num):
# type: (int, int) -> bytes
'''
An internal method to generate a string representing this Path Table Record.
Parameters:
ext_loc - The extent location to place in this Path Table Record.
parent_dir_num - The parent directory ... | python | {
"resource": ""
} |
q236649 | PathTableRecord.record_little_endian | train | def record_little_endian(self):
# type: () -> bytes
'''
A method to generate a string representing the little endian version of
this Path Table Record.
Parameters:
None.
Returns:
A string representing the little endian version of this Path Table Record.... | python | {
"resource": ""
} |
q236650 | PathTableRecord.record_big_endian | train | def record_big_endian(self):
# type: () -> bytes
'''
A method to generate a string representing the big endian version of
this Path Table Record.
Parameters:
None.
Returns:
A string representing the big endian version of this Path Table Record.
... | python | {
"resource": ""
} |
q236651 | PathTableRecord._new | train | def _new(self, name, parent_dir_num):
# type: (bytes, int) -> None
'''
An internal method to create a new Path Table Record.
Parameters:
name - The name for this Path Table Record.
parent_dir_num - The directory number of the parent of this Path Table
... | python | {
"resource": ""
} |
q236652 | PathTableRecord.new_dir | train | def new_dir(self, name):
# type: (bytes) -> None
'''
A method to create a new Path Table Record.
Parameters:
name - The name for this Path Table Record.
Returns:
Nothing.
'''
if self._initialized:
raise pycdlibexception.PyCdlibIntern... | python | {
"resource": ""
} |
q236653 | PathTableRecord.update_extent_location | train | def update_extent_location(self, extent_loc):
# type: (int) -> None
'''
A method to update the extent location for this Path Table Record.
Parameters:
extent_loc - The new extent location.
Returns:
Nothing.
'''
if not self._initialized:
... | python | {
"resource": ""
} |
q236654 | PathTableRecord.update_parent_directory_number | train | def update_parent_directory_number(self, parent_dir_num):
# type: (int) -> None
'''
A method to update the parent directory number for this Path Table
Record from the directory record.
Parameters:
parent_dir_num - The new parent directory number to assign to this PTR.
... | python | {
"resource": ""
} |
q236655 | PathTableRecord.equal_to_be | train | def equal_to_be(self, be_record):
# type: (PathTableRecord) -> bool
'''
A method to compare a little-endian path table record to its
big-endian counterpart. This is used to ensure that the ISO is sane.
Parameters:
be_record - The big-endian object to compare with the l... | python | {
"resource": ""
} |
q236656 | copy_data | train | def copy_data(data_length, blocksize, infp, outfp):
# type: (int, int, BinaryIO, BinaryIO) -> None
'''
A utility function to copy data from the input file object to the output
file object. This function will use the most efficient copy method available,
which is often sendfile.
Parameters:
... | python | {
"resource": ""
} |
q236657 | encode_space_pad | train | def encode_space_pad(instr, length, encoding):
# type: (bytes, int, str) -> bytes
'''
A function to pad out an input string with spaces to the length specified.
The space is first encoded into the specified encoding, then appended to
the input string until the length is reached.
Parameters:
... | python | {
"resource": ""
} |
q236658 | gmtoffset_from_tm | train | def gmtoffset_from_tm(tm, local):
# type: (float, time.struct_time) -> int
'''
A function to compute the GMT offset from the time in seconds since the epoch
and the local time object.
Parameters:
tm - The time in seconds since the epoch.
local - The struct_time object representing the loc... | python | {
"resource": ""
} |
q236659 | zero_pad | train | def zero_pad(fp, data_size, pad_size):
# type: (BinaryIO, int, int) -> None
'''
A function to write padding out from data_size up to pad_size
efficiently.
Parameters:
fp - The file object to use to write padding out to.
data_size - The current size of the data.
pad_size - The boundar... | python | {
"resource": ""
} |
q236660 | file_object_supports_binary | train | def file_object_supports_binary(fp):
# type: (BinaryIO) -> bool
'''
A function to check whether a file-like object supports binary mode.
Parameters:
fp - The file-like object to check for binary mode support.
Returns:
True if the file-like object supports binary mode, False otherwise.
... | python | {
"resource": ""
} |
q236661 | IsoHybrid.parse | train | def parse(self, instr):
# type: (bytes) -> bool
'''
A method to parse ISO hybridization info out of an existing ISO.
Parameters:
instr - The data for the ISO hybridization.
Returns:
Nothing.
'''
if self._initialized:
raise pycdlibexc... | python | {
"resource": ""
} |
q236662 | IsoHybrid.new | train | def new(self, mac, part_entry, mbr_id, part_offset,
geometry_sectors, geometry_heads, part_type):
# type: (bool, int, Optional[int], int, int, int, int) -> None
'''
A method to add ISO hybridization to an ISO.
Parameters:
mac - Whether this ISO should be made bootab... | python | {
"resource": ""
} |
q236663 | IsoHybrid._calc_cc | train | def _calc_cc(self, iso_size):
# type: (int) -> Tuple[int, int]
'''
A method to calculate the 'cc' and the 'padding' values for this
hybridization.
Parameters:
iso_size - The size of the ISO, excluding the hybridization.
Returns:
A tuple containing the c... | python | {
"resource": ""
} |
q236664 | IsoHybrid.record | train | def record(self, iso_size):
# type: (int) -> bytes
'''
A method to generate a string containing the ISO hybridization.
Parameters:
iso_size - The size of the ISO, excluding the hybridization.
Returns:
A string containing the ISO hybridization.
'''
... | python | {
"resource": ""
} |
q236665 | IsoHybrid.record_padding | train | def record_padding(self, iso_size):
# type: (int) -> bytes
'''
A method to record padding for the ISO hybridization.
Parameters:
iso_size - The size of the ISO, excluding the hybridization.
Returns:
A string of zeros the right size to pad the ISO.
'''
... | python | {
"resource": ""
} |
q236666 | IsoHybrid.update_rba | train | def update_rba(self, current_extent):
# type: (int) -> None
'''
A method to update the current rba for the ISO hybridization.
Parameters:
current_extent - The new extent to set the RBA to.
Returns:
Nothing.
'''
if not self._initialized:
... | python | {
"resource": ""
} |
q236667 | XARecord.parse | train | def parse(self, xastr):
# type: (bytes) -> None
'''
Parse an Extended Attribute Record out of a string.
Parameters:
xastr - The string to parse.
Returns:
Nothing.
'''
if self._initialized:
raise pycdlibexception.PyCdlibInternalError(... | python | {
"resource": ""
} |
q236668 | XARecord.new | train | def new(self):
# type: () -> None
'''
Create a new Extended Attribute Record.
Parameters:
None.
Returns:
Nothing.
'''
if self._initialized:
raise pycdlibexception.PyCdlibInternalError('This XARecord is already initialized!')
... | python | {
"resource": ""
} |
q236669 | XARecord.record | train | def record(self):
# type: () -> bytes
'''
Record this Extended Attribute Record.
Parameters:
None.
Returns:
A string representing this Extended Attribute Record.
'''
if not self._initialized:
raise pycdlibexception.PyCdlibInternalErr... | python | {
"resource": ""
} |
q236670 | DirectoryRecord._new | train | def _new(self, vd, name, parent, seqnum, isdir, length, xa):
# type: (headervd.PrimaryOrSupplementaryVD, bytes, Optional[DirectoryRecord], int, bool, int, bool) -> None
'''
Internal method to create a new Directory Record.
Parameters:
vd - The Volume Descriptor this record is p... | python | {
"resource": ""
} |
q236671 | DirectoryRecord.new_symlink | train | def new_symlink(self, vd, name, parent, rr_target, seqnum, rock_ridge,
rr_name, xa):
# type: (headervd.PrimaryOrSupplementaryVD, bytes, DirectoryRecord, bytes, int, str, bytes, bool) -> None
'''
Create a new symlink Directory Record. This implies that the new
record ... | python | {
"resource": ""
} |
q236672 | DirectoryRecord.new_file | train | def new_file(self, vd, length, isoname, parent, seqnum, rock_ridge, rr_name,
xa, file_mode):
# type: (headervd.PrimaryOrSupplementaryVD, int, bytes, DirectoryRecord, int, str, bytes, bool, int) -> None
'''
Create a new file Directory Record.
Parameters:
vd - Th... | python | {
"resource": ""
} |
q236673 | DirectoryRecord.new_root | train | def new_root(self, vd, seqnum, log_block_size):
# type: (headervd.PrimaryOrSupplementaryVD, int, int) -> None
'''
Create a new root Directory Record.
Parameters:
vd - The Volume Descriptor this record is part of.
seqnum - The sequence number for this directory record.
... | python | {
"resource": ""
} |
q236674 | DirectoryRecord.new_dot | train | def new_dot(self, vd, parent, seqnum, rock_ridge, log_block_size, xa,
file_mode):
# type: (headervd.PrimaryOrSupplementaryVD, DirectoryRecord, int, str, int, bool, int) -> None
'''
Create a new 'dot' Directory Record.
Parameters:
vd - The Volume Descriptor this ... | python | {
"resource": ""
} |
q236675 | DirectoryRecord.new_dotdot | train | def new_dotdot(self, vd, parent, seqnum, rock_ridge, log_block_size,
rr_relocated_parent, xa, file_mode):
# type: (headervd.PrimaryOrSupplementaryVD, DirectoryRecord, int, str, int, bool, bool, int) -> None
'''
Create a new 'dotdot' Directory Record.
Parameters:
... | python | {
"resource": ""
} |
q236676 | DirectoryRecord.new_dir | train | def new_dir(self, vd, name, parent, seqnum, rock_ridge, rr_name, log_block_size,
rr_relocated_child, rr_relocated, xa, file_mode):
# type: (headervd.PrimaryOrSupplementaryVD, bytes, DirectoryRecord, int, str, bytes, int, bool, bool, bool, int) -> None
'''
Create a new directory D... | python | {
"resource": ""
} |
q236677 | DirectoryRecord.change_existence | train | def change_existence(self, is_hidden):
# type: (bool) -> None
'''
Change the ISO9660 existence flag of this Directory Record.
Parameters:
is_hidden - True if this Directory Record should be hidden, False otherwise.
Returns:
Nothing.
'''
if not s... | python | {
"resource": ""
} |
q236678 | DirectoryRecord._recalculate_extents_and_offsets | train | def _recalculate_extents_and_offsets(self, index, logical_block_size):
# type: (int, int) -> Tuple[int, int]
'''
Internal method to recalculate the extents and offsets associated with
children of this directory record.
Parameters:
index - The index at which to start the... | python | {
"resource": ""
} |
q236679 | DirectoryRecord._add_child | train | def _add_child(self, child, logical_block_size, allow_duplicate, check_overflow):
# type: (DirectoryRecord, int, bool, bool) -> bool
'''
An internal method to add a child to this object. Note that this is called both
during parsing and when adding a new object to the system, so it
... | python | {
"resource": ""
} |
q236680 | DirectoryRecord.add_child | train | def add_child(self, child, logical_block_size, allow_duplicate=False):
# type: (DirectoryRecord, int, bool) -> bool
'''
A method to add a new child to this directory record.
Parameters:
child - The child directory record object to add.
logical_block_size - The size of ... | python | {
"resource": ""
} |
q236681 | DirectoryRecord.track_child | train | def track_child(self, child, logical_block_size, allow_duplicate=False):
# type: (DirectoryRecord, int, bool) -> None
'''
A method to track an existing child of this directory record.
Parameters:
child - The child directory record object to add.
logical_block_size - Th... | python | {
"resource": ""
} |
q236682 | DirectoryRecord.remove_child | train | def remove_child(self, child, index, logical_block_size):
# type: (DirectoryRecord, int, int) -> bool
'''
A method to remove a child from this Directory Record.
Parameters:
child - The child DirectoryRecord object to remove.
index - The index of the child into this Dir... | python | {
"resource": ""
} |
q236683 | DirectoryRecord.record | train | def record(self):
# type: () -> bytes
'''
A method to generate the string representing this Directory Record.
Parameters:
None.
Returns:
String representing this Directory Record.
'''
if not self._initialized:
raise pycdlibexception.... | python | {
"resource": ""
} |
q236684 | DirectoryRecord.is_associated_file | train | def is_associated_file(self):
# type: () -> bool
'''
A method to determine whether this file is 'associated' with another file
on the ISO.
Parameters:
None.
Returns:
True if this file is associated with another file on the ISO, False
otherwise.... | python | {
"resource": ""
} |
q236685 | DirectoryRecord.set_ptr | train | def set_ptr(self, ptr):
# type: (path_table_record.PathTableRecord) -> None
'''
A method to set the Path Table Record associated with this Directory
Record.
Parameters:
ptr - The path table record to associate with this Directory Record.
Returns:
Nothin... | python | {
"resource": ""
} |
q236686 | DirectoryRecord.set_data_location | train | def set_data_location(self, current_extent, tag_location): # pylint: disable=unused-argument
# type: (int, int) -> None
'''
A method to set the new extent location that the data for this Directory
Record should live at.
Parameters:
current_extent - The new extent.
... | python | {
"resource": ""
} |
q236687 | DirectoryRecord.get_data_length | train | def get_data_length(self):
# type: () -> int
'''
A method to get the length of the data that this Directory Record
points to.
Parameters:
None.
Returns:
The length of the data that this Directory Record points to.
'''
if not self._initia... | python | {
"resource": ""
} |
q236688 | DirectoryRecord.set_data_length | train | def set_data_length(self, length):
# type: (int) -> None
'''
A method to set the length of the data that this Directory Record
points to.
Parameters:
length - The new length for the data.
Returns:
The length of the data that this Directory Record points... | python | {
"resource": ""
} |
q236689 | Inode.new | train | def new(self, length, fp, manage_fp, offset):
# type: (int, BinaryIO, bool, int) -> None
'''
Initialize a new Inode.
Parameters:
None.
Returns:
Nothing.
'''
if self._initialized:
raise pycdlibexception.PyCdlibInternalError('Inode is ... | python | {
"resource": ""
} |
q236690 | Inode.parse | train | def parse(self, extent, length, fp, log_block_size):
# type: (int, int, BinaryIO, int) -> None
'''
Parse an existing Inode. This just saves off the extent for later use.
Parameters:
extent - The original extent that the data lives at.
Returns:
Nothing.
... | python | {
"resource": ""
} |
q236691 | Inode.add_boot_info_table | train | def add_boot_info_table(self, boot_info_table):
# type: (eltorito.EltoritoBootInfoTable) -> None
'''
A method to add a boot info table to this Inode.
Parameters:
boot_info_table - The Boot Info Table object to add to this Inode.
Returns:
Nothing.
'''
... | python | {
"resource": ""
} |
q236692 | Inode.update_fp | train | def update_fp(self, fp, length):
# type: (BinaryIO, int) -> None
'''
Update the Inode to use a different file object and length.
Parameters:
fp - A file object that contains the data for this Inode.
length - The length of the data.
Returns:
Nothing.
... | python | {
"resource": ""
} |
q236693 | string_to_timestruct | train | def string_to_timestruct(input_string):
# type: (bytes) -> time.struct_time
'''
A cacheable function to take an input string and decode it into a
time.struct_time from the time module. If the string cannot be decoded
because of an illegal value, then the all-zero time.struct_time will be
return... | python | {
"resource": ""
} |
q236694 | DirectoryRecordDate.parse | train | def parse(self, datestr):
# type: (bytes) -> None
'''
Parse a Directory Record date out of a string.
Parameters:
datestr - The string to parse the date out of.
Returns:
Nothing.
'''
if self._initialized:
raise pycdlibexception.PyCdli... | python | {
"resource": ""
} |
q236695 | DirectoryRecordDate.new | train | def new(self):
# type: () -> None
'''
Create a new Directory Record date based on the current time.
Parameters:
tm - An optional argument that must be None
Returns:
Nothing.
'''
if self._initialized:
raise pycdlibexception.PyCdlibInt... | python | {
"resource": ""
} |
q236696 | DirectoryRecordDate.record | train | def record(self):
# type: () -> bytes
'''
Return a string representation of the Directory Record date.
Parameters:
None.
Returns:
A string representing this Directory Record Date.
'''
if not self._initialized:
raise pycdlibexception.... | python | {
"resource": ""
} |
q236697 | VolumeDescriptorDate.parse | train | def parse(self, datestr):
# type: (bytes) -> None
'''
Parse a Volume Descriptor Date out of a string. A string of all zeros
is valid, which means that the date in this field was not specified.
Parameters:
datestr - string to be parsed
Returns:
Nothin... | python | {
"resource": ""
} |
q236698 | RRSPRecord.parse | train | def parse(self, rrstr):
# type: (bytes) -> None
'''
Parse a Rock Ridge Sharing Protocol record out of a string.
Parameters:
rrstr - The string to parse the record out of.
Returns:
Nothing.
'''
if self._initialized:
raise pycdlibexcep... | python | {
"resource": ""
} |
q236699 | RRSPRecord.new | train | def new(self, bytes_to_skip):
# type: (int) -> None
'''
Create a new Rock Ridge Sharing Protocol record.
Parameters:
bytes_to_skip - The number of bytes to skip.
Returns:
Nothing.
'''
if self._initialized:
raise pycdlibexception.PyCdl... | python | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.