Search is not available for this dataset
identifier
stringlengths
1
155
parameters
stringlengths
2
6.09k
docstring
stringlengths
11
63.4k
docstring_summary
stringlengths
0
63.4k
function
stringlengths
29
99.8k
function_tokens
list
start_point
list
end_point
list
language
stringclasses
1 value
docstring_language
stringlengths
2
7
docstring_language_predictions
stringlengths
18
23
is_langid_reliable
stringclasses
2 values
response
()
Sample pytest fixture. See more at: http://doc.pytest.org/en/latest/fixture.html
Sample pytest fixture.
def response(): """Sample pytest fixture. See more at: http://doc.pytest.org/en/latest/fixture.html """
[ "def", "response", "(", ")", ":" ]
[ 13, 0 ]
[ 17, 7 ]
python
et
['fr', 'et', 'it']
False
test_content
(response)
Sample pytest test function with the pytest fixture as an argument.
Sample pytest test function with the pytest fixture as an argument.
def test_content(response): """Sample pytest test function with the pytest fixture as an argument."""
[ "def", "test_content", "(", "response", ")", ":" ]
[ 22, 0 ]
[ 23, 77 ]
python
en
['en', 'en', 'en']
True
test_command_line_interface
()
Test the CLI.
Test the CLI.
def test_command_line_interface(): """Test the CLI.""" runner = CliRunner() # result = runner.invoke(cli.main, ['tests/conf.yaml']) # assert result.exit_code == 0 # assert 'gitlabirced.cli.main' in result.output help_result = runner.invoke(cli.main, ['--help']) assert help_result.exit_code =...
[ "def", "test_command_line_interface", "(", ")", ":", "runner", "=", "CliRunner", "(", ")", "# result = runner.invoke(cli.main, ['tests/conf.yaml'])", "# assert result.exit_code == 0", "# assert 'gitlabirced.cli.main' in result.output", "help_result", "=", "runner", ".", "invoke", ...
[ 35, 0 ]
[ 46, 34 ]
python
en
['en', 'en', 'en']
True
test_unique_id_migration
(mock_hc, hass, mock_write_config)
Test migration of switch unique ids to stable ones.
Test migration of switch unique ids to stable ones.
async def test_unique_id_migration(mock_hc, hass, mock_write_config): """Test migration of switch unique ids to stable ones.""" entry = MockConfigEntry( domain=DOMAIN, data={CONF_HOST: "192.0.2.0", CONF_NAME: HUB_NAME} ) entry.add_to_hass(hass) mock_registry( hass, { ...
[ "async", "def", "test_unique_id_migration", "(", "mock_hc", ",", "hass", ",", "mock_write_config", ")", ":", "entry", "=", "MockConfigEntry", "(", "domain", "=", "DOMAIN", ",", "data", "=", "{", "CONF_HOST", ":", "\"192.0.2.0\"", ",", "CONF_NAME", ":", "HUB_NA...
[ 20, 0 ]
[ 82, 66 ]
python
en
['en', 'en', 'en']
True
async_setup
(hass, config)
Set up ZHA from config.
Set up ZHA from config.
async def async_setup(hass, config): """Set up ZHA from config.""" hass.data[DATA_ZHA] = {} if DOMAIN in config: conf = config[DOMAIN] hass.data[DATA_ZHA][DATA_ZHA_CONFIG] = conf return True
[ "async", "def", "async_setup", "(", "hass", ",", "config", ")", ":", "hass", ".", "data", "[", "DATA_ZHA", "]", "=", "{", "}", "if", "DOMAIN", "in", "config", ":", "conf", "=", "config", "[", "DOMAIN", "]", "hass", ".", "data", "[", "DATA_ZHA", "]"...
[ 74, 0 ]
[ 82, 15 ]
python
en
['en', 'en', 'en']
True
async_setup_entry
(hass, config_entry)
Set up ZHA. Will automatically load components to support devices found on the network.
Set up ZHA.
async def async_setup_entry(hass, config_entry): """Set up ZHA. Will automatically load components to support devices found on the network. """ zha_data = hass.data.setdefault(DATA_ZHA, {}) config = zha_data.get(DATA_ZHA_CONFIG, {}) for platform in PLATFORMS: zha_data.setdefault(platf...
[ "async", "def", "async_setup_entry", "(", "hass", ",", "config_entry", ")", ":", "zha_data", "=", "hass", ".", "data", ".", "setdefault", "(", "DATA_ZHA", ",", "{", "}", ")", "config", "=", "zha_data", ".", "get", "(", "DATA_ZHA_CONFIG", ",", "{", "}", ...
[ 85, 0 ]
[ 130, 15 ]
python
en
['en', 'zu', 'en']
True
async_unload_entry
(hass, config_entry)
Unload ZHA config entry.
Unload ZHA config entry.
async def async_unload_entry(hass, config_entry): """Unload ZHA config entry.""" await hass.data[DATA_ZHA][DATA_ZHA_GATEWAY].shutdown() await hass.data[DATA_ZHA][DATA_ZHA_GATEWAY].async_update_device_storage() GROUP_PROBE.cleanup() api.async_unload_api(hass) dispatchers = hass.data[DATA_ZHA].g...
[ "async", "def", "async_unload_entry", "(", "hass", ",", "config_entry", ")", ":", "await", "hass", ".", "data", "[", "DATA_ZHA", "]", "[", "DATA_ZHA_GATEWAY", "]", ".", "shutdown", "(", ")", "await", "hass", ".", "data", "[", "DATA_ZHA", "]", "[", "DATA_...
[ 133, 0 ]
[ 155, 15 ]
python
en
['da', 'en', 'en']
True
async_load_entities
(hass: HomeAssistant)
Load entities after integration was setup.
Load entities after integration was setup.
async def async_load_entities(hass: HomeAssistant) -> None: """Load entities after integration was setup.""" await hass.data[DATA_ZHA][DATA_ZHA_GATEWAY].async_initialize_devices_and_entities() to_setup = hass.data[DATA_ZHA][DATA_ZHA_PLATFORM_LOADED] results = await asyncio.gather(*to_setup, return_excep...
[ "async", "def", "async_load_entities", "(", "hass", ":", "HomeAssistant", ")", "->", "None", ":", "await", "hass", ".", "data", "[", "DATA_ZHA", "]", "[", "DATA_ZHA_GATEWAY", "]", ".", "async_initialize_devices_and_entities", "(", ")", "to_setup", "=", "hass", ...
[ 158, 0 ]
[ 166, 52 ]
python
en
['en', 'en', 'en']
True
async_migrate_entry
( hass: HomeAssistant, config_entry: config_entries.ConfigEntry )
Migrate old entry.
Migrate old entry.
async def async_migrate_entry( hass: HomeAssistant, config_entry: config_entries.ConfigEntry ): """Migrate old entry.""" _LOGGER.debug("Migrating from version %s", config_entry.version) if config_entry.version == 1: data = { CONF_RADIO_TYPE: config_entry.data[CONF_RADIO_TYPE], ...
[ "async", "def", "async_migrate_entry", "(", "hass", ":", "HomeAssistant", ",", "config_entry", ":", "config_entries", ".", "ConfigEntry", ")", ":", "_LOGGER", ".", "debug", "(", "\"Migrating from version %s\"", ",", "config_entry", ".", "version", ")", "if", "conf...
[ 169, 0 ]
[ 198, 15 ]
python
en
['en', 'en', 'en']
True
minio_client_fixture
()
Patch Minio client.
Patch Minio client.
def minio_client_fixture(): """Patch Minio client.""" with patch("homeassistant.components.minio.minio_helper.Minio") as minio_mock: minio_client_mock = minio_mock.return_value yield minio_client_mock
[ "def", "minio_client_fixture", "(", ")", ":", "with", "patch", "(", "\"homeassistant.components.minio.minio_helper.Minio\"", ")", "as", "minio_mock", ":", "minio_client_mock", "=", "minio_mock", ".", "return_value", "yield", "minio_client_mock" ]
[ 25, 0 ]
[ 30, 31 ]
python
en
['lt', 'fr', 'en']
False
minio_client_event_fixture
()
Patch helper function for minio notification stream.
Patch helper function for minio notification stream.
def minio_client_event_fixture(): """Patch helper function for minio notification stream.""" with patch("homeassistant.components.minio.minio_helper.Minio") as minio_mock: minio_client_mock = minio_mock.return_value response_mock = MagicMock() stream_mock = MagicMock() stream_m...
[ "def", "minio_client_event_fixture", "(", ")", ":", "with", "patch", "(", "\"homeassistant.components.minio.minio_helper.Minio\"", ")", "as", "minio_mock", ":", "minio_client_mock", "=", "minio_mock", ".", "return_value", "response_mock", "=", "MagicMock", "(", ")", "st...
[ 34, 0 ]
[ 51, 31 ]
python
en
['en', 'en', 'en']
True
test_minio_services
(hass, caplog, minio_client)
Test Minio services.
Test Minio services.
async def test_minio_services(hass, caplog, minio_client): """Test Minio services.""" hass.config.allowlist_external_dirs = {"/test"} await async_setup_component( hass, DOMAIN, { DOMAIN: { CONF_HOST: "localhost", CONF_PORT: "9000", ...
[ "async", "def", "test_minio_services", "(", "hass", ",", "caplog", ",", "minio_client", ")", ":", "hass", ".", "config", ".", "allowlist_external_dirs", "=", "{", "\"/test\"", "}", "await", "async_setup_component", "(", "hass", ",", "DOMAIN", ",", "{", "DOMAIN...
[ 54, 0 ]
[ 104, 29 ]
python
el-Latn
['lt', 'el-Latn', 'en']
False
test_minio_listen
(hass, caplog, minio_client_event)
Test minio listen on notifications.
Test minio listen on notifications.
async def test_minio_listen(hass, caplog, minio_client_event): """Test minio listen on notifications.""" minio_client_event.presigned_get_object.return_value = "http://url" events = [] @callback def event_callback(event): """Handle event callbback.""" events.append(event) hass...
[ "async", "def", "test_minio_listen", "(", "hass", ",", "caplog", ",", "minio_client_event", ")", ":", "minio_client_event", ".", "presigned_get_object", ".", "return_value", "=", "\"http://url\"", "events", "=", "[", "]", "@", "callback", "def", "event_callback", ...
[ 107, 0 ]
[ 152, 43 ]
python
en
['en', 'fi', 'en']
True
test_queue_listener
()
Tests QueueListener firing events on Home Assistant event bus.
Tests QueueListener firing events on Home Assistant event bus.
async def test_queue_listener(): """Tests QueueListener firing events on Home Assistant event bus.""" hass = MagicMock() queue_listener = QueueListener(hass) queue_listener.start() queue_entry = { "event_name": "s3:ObjectCreated:Put", "bucket": "some_bucket", "key": "some_d...
[ "async", "def", "test_queue_listener", "(", ")", ":", "hass", "=", "MagicMock", "(", ")", "queue_listener", "=", "QueueListener", "(", "hass", ")", "queue_listener", ".", "start", "(", ")", "queue_entry", "=", "{", "\"event_name\"", ":", "\"s3:ObjectCreated:Put\...
[ 155, 0 ]
[ 188, 5 ]
python
en
['en', 'en', 'en']
True
async_setup_entry_from_discovery
(hass, config_entry, async_add_entities)
Set up MQTT device tracker dynamically through MQTT discovery.
Set up MQTT device tracker dynamically through MQTT discovery.
async def async_setup_entry_from_discovery(hass, config_entry, async_add_entities): """Set up MQTT device tracker dynamically through MQTT discovery.""" setup = functools.partial( _async_setup_entity, hass, async_add_entities, config_entry=config_entry ) await async_setup_entry_helper( h...
[ "async", "def", "async_setup_entry_from_discovery", "(", "hass", ",", "config_entry", ",", "async_add_entities", ")", ":", "setup", "=", "functools", ".", "partial", "(", "_async_setup_entity", ",", "hass", ",", "async_add_entities", ",", "config_entry", "=", "confi...
[ 40, 0 ]
[ 47, 5 ]
python
en
['en', 'en', 'en']
True
_async_setup_entity
( hass, async_add_entities, config, config_entry=None, discovery_data=None )
Set up the MQTT Device Tracker entity.
Set up the MQTT Device Tracker entity.
async def _async_setup_entity( hass, async_add_entities, config, config_entry=None, discovery_data=None ): """Set up the MQTT Device Tracker entity.""" async_add_entities([MqttDeviceTracker(hass, config, config_entry, discovery_data)])
[ "async", "def", "_async_setup_entity", "(", "hass", ",", "async_add_entities", ",", "config", ",", "config_entry", "=", "None", ",", "discovery_data", "=", "None", ")", ":", "async_add_entities", "(", "[", "MqttDeviceTracker", "(", "hass", ",", "config", ",", ...
[ 50, 0 ]
[ 54, 87 ]
python
en
['en', 'en', 'en']
True
MqttDeviceTracker.__init__
(self, hass, config, config_entry, discovery_data)
Initialize the tracker.
Initialize the tracker.
def __init__(self, hass, config, config_entry, discovery_data): """Initialize the tracker.""" self._location_name = None MqttEntity.__init__(self, hass, config, config_entry, discovery_data)
[ "def", "__init__", "(", "self", ",", "hass", ",", "config", ",", "config_entry", ",", "discovery_data", ")", ":", "self", ".", "_location_name", "=", "None", "MqttEntity", ".", "__init__", "(", "self", ",", "hass", ",", "config", ",", "config_entry", ",", ...
[ 60, 4 ]
[ 64, 77 ]
python
en
['en', 'en', 'en']
True
MqttDeviceTracker.config_schema
()
Return the config schema.
Return the config schema.
def config_schema(): """Return the config schema.""" return PLATFORM_SCHEMA_DISCOVERY
[ "def", "config_schema", "(", ")", ":", "return", "PLATFORM_SCHEMA_DISCOVERY" ]
[ 67, 4 ]
[ 69, 40 ]
python
en
['en', 'de', 'en']
True
MqttDeviceTracker._setup_from_config
(self, config)
(Re)Setup the entity.
(Re)Setup the entity.
def _setup_from_config(self, config): """(Re)Setup the entity.""" value_template = self._config.get(CONF_VALUE_TEMPLATE) if value_template is not None: value_template.hass = self.hass
[ "def", "_setup_from_config", "(", "self", ",", "config", ")", ":", "value_template", "=", "self", ".", "_config", ".", "get", "(", "CONF_VALUE_TEMPLATE", ")", "if", "value_template", "is", "not", "None", ":", "value_template", ".", "hass", "=", "self", ".", ...
[ 71, 4 ]
[ 75, 43 ]
python
en
['en', 'haw', 'en']
True
MqttDeviceTracker._subscribe_topics
(self)
(Re)Subscribe to topics.
(Re)Subscribe to topics.
async def _subscribe_topics(self): """(Re)Subscribe to topics.""" @callback @log_messages(self.hass, self.entity_id) def message_received(msg): """Handle new MQTT messages.""" payload = msg.payload value_template = self._config.get(CONF_VALUE_TEMPLATE...
[ "async", "def", "_subscribe_topics", "(", "self", ")", ":", "@", "callback", "@", "log_messages", "(", "self", ".", "hass", ",", "self", ".", "entity_id", ")", "def", "message_received", "(", "msg", ")", ":", "\"\"\"Handle new MQTT messages.\"\"\"", "payload", ...
[ 77, 4 ]
[ 107, 9 ]
python
en
['en', 'en', 'en']
True
MqttDeviceTracker.latitude
(self)
Return latitude if provided in extra_state_attributes or None.
Return latitude if provided in extra_state_attributes or None.
def latitude(self): """Return latitude if provided in extra_state_attributes or None.""" if ( self.extra_state_attributes is not None and ATTR_LATITUDE in self.extra_state_attributes ): return self.extra_state_attributes[ATTR_LATITUDE] return None
[ "def", "latitude", "(", "self", ")", ":", "if", "(", "self", ".", "extra_state_attributes", "is", "not", "None", "and", "ATTR_LATITUDE", "in", "self", ".", "extra_state_attributes", ")", ":", "return", "self", ".", "extra_state_attributes", "[", "ATTR_LATITUDE",...
[ 110, 4 ]
[ 117, 19 ]
python
en
['en', 'en', 'en']
True
MqttDeviceTracker.location_accuracy
(self)
Return location accuracy if provided in extra_state_attributes or None.
Return location accuracy if provided in extra_state_attributes or None.
def location_accuracy(self): """Return location accuracy if provided in extra_state_attributes or None.""" if ( self.extra_state_attributes is not None and ATTR_GPS_ACCURACY in self.extra_state_attributes ): return self.extra_state_attributes[ATTR_GPS_ACCURACY...
[ "def", "location_accuracy", "(", "self", ")", ":", "if", "(", "self", ".", "extra_state_attributes", "is", "not", "None", "and", "ATTR_GPS_ACCURACY", "in", "self", ".", "extra_state_attributes", ")", ":", "return", "self", ".", "extra_state_attributes", "[", "AT...
[ 120, 4 ]
[ 127, 19 ]
python
en
['en', 'en', 'en']
True
MqttDeviceTracker.longitude
(self)
Return longitude if provided in extra_state_attributes or None.
Return longitude if provided in extra_state_attributes or None.
def longitude(self): """Return longitude if provided in extra_state_attributes or None.""" if ( self.extra_state_attributes is not None and ATTR_LONGITUDE in self.extra_state_attributes ): return self.extra_state_attributes[ATTR_LONGITUDE] return None
[ "def", "longitude", "(", "self", ")", ":", "if", "(", "self", ".", "extra_state_attributes", "is", "not", "None", "and", "ATTR_LONGITUDE", "in", "self", ".", "extra_state_attributes", ")", ":", "return", "self", ".", "extra_state_attributes", "[", "ATTR_LONGITUD...
[ 130, 4 ]
[ 137, 19 ]
python
en
['en', 'en', 'en']
True
MqttDeviceTracker.location_name
(self)
Return a location name for the current location of the device.
Return a location name for the current location of the device.
def location_name(self): """Return a location name for the current location of the device.""" return self._location_name
[ "def", "location_name", "(", "self", ")", ":", "return", "self", ".", "_location_name" ]
[ 140, 4 ]
[ 142, 34 ]
python
en
['en', 'en', 'en']
True
MqttDeviceTracker.source_type
(self)
Return the source type, eg gps or router, of the device.
Return the source type, eg gps or router, of the device.
def source_type(self): """Return the source type, eg gps or router, of the device.""" return self._config.get(CONF_SOURCE_TYPE)
[ "def", "source_type", "(", "self", ")", ":", "return", "self", ".", "_config", ".", "get", "(", "CONF_SOURCE_TYPE", ")" ]
[ 145, 4 ]
[ 147, 49 ]
python
en
['en', 'en', 'en']
True
test_scenes
(hass, hank_binary_switch, integration, client)
Test scene events.
Test scene events.
async def test_scenes(hass, hank_binary_switch, integration, client): """Test scene events.""" # just pick a random node to fake the value notification events node = hank_binary_switch events = async_capture_events(hass, "zwave_js_value_notification") # Publish fake Basic Set value notification ...
[ "async", "def", "test_scenes", "(", "hass", ",", "hank_binary_switch", ",", "integration", ",", "client", ")", ":", "# just pick a random node to fake the value notification events", "node", "=", "hank_binary_switch", "events", "=", "async_capture_events", "(", "hass", ",...
[ 7, 0 ]
[ 133, 43 ]
python
en
['it', 'en', 'en']
True
test_notifications
(hass, hank_binary_switch, integration, client)
Test notification events.
Test notification events.
async def test_notifications(hass, hank_binary_switch, integration, client): """Test notification events.""" # just pick a random node to fake the value notification events node = hank_binary_switch events = async_capture_events(hass, "zwave_js_notification") # Publish fake Notification CC notifica...
[ "async", "def", "test_notifications", "(", "hass", ",", "hank_binary_switch", ",", "integration", ",", "client", ")", ":", "# just pick a random node to fake the value notification events", "node", "=", "hank_binary_switch", "events", "=", "async_capture_events", "(", "hass...
[ 136, 0 ]
[ 195, 66 ]
python
en
['es', 'en', 'en']
True
test_value_updated
(hass, vision_security_zl7432, integration, client)
Test value updated events.
Test value updated events.
async def test_value_updated(hass, vision_security_zl7432, integration, client): """Test value updated events.""" node = vision_security_zl7432 events = async_capture_events(hass, "zwave_js_value_updated") event = Event( type="value updated", data={ "source": "node", ...
[ "async", "def", "test_value_updated", "(", "hass", ",", "vision_security_zl7432", ",", "integration", ",", "client", ")", ":", "node", "=", "vision_security_zl7432", "events", "=", "async_capture_events", "(", "hass", ",", "\"zwave_js_value_updated\"", ")", "event", ...
[ 198, 0 ]
[ 260, 27 ]
python
en
['en', 'en', 'en']
True
create_fan_service
(accessory)
Define fan v1 characteristics as per HAP spec. This service is no longer documented in R2 of the public HAP spec but existing devices out there use it (like the SIMPLEconnect fan)
Define fan v1 characteristics as per HAP spec.
def create_fan_service(accessory): """ Define fan v1 characteristics as per HAP spec. This service is no longer documented in R2 of the public HAP spec but existing devices out there use it (like the SIMPLEconnect fan) """ service = accessory.add_service(ServicesTypes.FAN) cur_state = serv...
[ "def", "create_fan_service", "(", "accessory", ")", ":", "service", "=", "accessory", ".", "add_service", "(", "ServicesTypes", ".", "FAN", ")", "cur_state", "=", "service", ".", "add_char", "(", "CharacteristicsTypes", ".", "ON", ")", "cur_state", ".", "value...
[ 16, 0 ]
[ 32, 19 ]
python
en
['en', 'error', 'th']
False
create_fanv2_service
(accessory)
Define fan v2 characteristics as per HAP spec.
Define fan v2 characteristics as per HAP spec.
def create_fanv2_service(accessory): """Define fan v2 characteristics as per HAP spec.""" service = accessory.add_service(ServicesTypes.FAN_V2) cur_state = service.add_char(CharacteristicsTypes.ACTIVE) cur_state.value = 0 direction = service.add_char(CharacteristicsTypes.ROTATION_DIRECTION) di...
[ "def", "create_fanv2_service", "(", "accessory", ")", ":", "service", "=", "accessory", ".", "add_service", "(", "ServicesTypes", ".", "FAN_V2", ")", "cur_state", "=", "service", ".", "add_char", "(", "CharacteristicsTypes", ".", "ACTIVE", ")", "cur_state", ".",...
[ 35, 0 ]
[ 49, 24 ]
python
ca
['en', 'ca', 'it']
False
create_fanv2_service_with_min_step
(accessory)
Define fan v2 characteristics as per HAP spec.
Define fan v2 characteristics as per HAP spec.
def create_fanv2_service_with_min_step(accessory): """Define fan v2 characteristics as per HAP spec.""" service = accessory.add_service(ServicesTypes.FAN_V2) cur_state = service.add_char(CharacteristicsTypes.ACTIVE) cur_state.value = 0 direction = service.add_char(CharacteristicsTypes.ROTATION_DIR...
[ "def", "create_fanv2_service_with_min_step", "(", "accessory", ")", ":", "service", "=", "accessory", ".", "add_service", "(", "ServicesTypes", ".", "FAN_V2", ")", "cur_state", "=", "service", ".", "add_char", "(", "CharacteristicsTypes", ".", "ACTIVE", ")", "cur_...
[ 52, 0 ]
[ 67, 24 ]
python
ca
['en', 'ca', 'it']
False
create_fanv2_service_without_rotation_speed
(accessory)
Define fan v2 characteristics as per HAP spec.
Define fan v2 characteristics as per HAP spec.
def create_fanv2_service_without_rotation_speed(accessory): """Define fan v2 characteristics as per HAP spec.""" service = accessory.add_service(ServicesTypes.FAN_V2) cur_state = service.add_char(CharacteristicsTypes.ACTIVE) cur_state.value = 0 direction = service.add_char(CharacteristicsTypes.ROT...
[ "def", "create_fanv2_service_without_rotation_speed", "(", "accessory", ")", ":", "service", "=", "accessory", ".", "add_service", "(", "ServicesTypes", ".", "FAN_V2", ")", "cur_state", "=", "service", ".", "add_char", "(", "CharacteristicsTypes", ".", "ACTIVE", ")"...
[ 70, 0 ]
[ 81, 24 ]
python
ca
['en', 'ca', 'it']
False
test_fan_read_state
(hass, utcnow)
Test that we can read the state of a HomeKit fan accessory.
Test that we can read the state of a HomeKit fan accessory.
async def test_fan_read_state(hass, utcnow): """Test that we can read the state of a HomeKit fan accessory.""" helper = await setup_test_component(hass, create_fan_service) helper.characteristics[V1_ON].value = False state = await helper.poll_and_get_state() assert state.state == "off" helper....
[ "async", "def", "test_fan_read_state", "(", "hass", ",", "utcnow", ")", ":", "helper", "=", "await", "setup_test_component", "(", "hass", ",", "create_fan_service", ")", "helper", ".", "characteristics", "[", "V1_ON", "]", ".", "value", "=", "False", "state", ...
[ 84, 0 ]
[ 94, 30 ]
python
en
['en', 'en', 'en']
True
test_turn_on
(hass, utcnow)
Test that we can turn a fan on.
Test that we can turn a fan on.
async def test_turn_on(hass, utcnow): """Test that we can turn a fan on.""" helper = await setup_test_component(hass, create_fan_service) await hass.services.async_call( "fan", "turn_on", {"entity_id": "fan.testdevice", "speed": "high"}, blocking=True, ) assert helpe...
[ "async", "def", "test_turn_on", "(", "hass", ",", "utcnow", ")", ":", "helper", "=", "await", "setup_test_component", "(", "hass", ",", "create_fan_service", ")", "await", "hass", ".", "services", ".", "async_call", "(", "\"fan\"", ",", "\"turn_on\"", ",", "...
[ 97, 0 ]
[ 126, 66 ]
python
en
['en', 'en', 'en']
True
test_turn_on_off_without_rotation_speed
(hass, utcnow)
Test that we can turn a fan on.
Test that we can turn a fan on.
async def test_turn_on_off_without_rotation_speed(hass, utcnow): """Test that we can turn a fan on.""" helper = await setup_test_component( hass, create_fanv2_service_without_rotation_speed ) await hass.services.async_call( "fan", "turn_on", {"entity_id": "fan.testdevice...
[ "async", "def", "test_turn_on_off_without_rotation_speed", "(", "hass", ",", "utcnow", ")", ":", "helper", "=", "await", "setup_test_component", "(", "hass", ",", "create_fanv2_service_without_rotation_speed", ")", "await", "hass", ".", "services", ".", "async_call", ...
[ 129, 0 ]
[ 149, 55 ]
python
en
['en', 'en', 'en']
True
test_turn_off
(hass, utcnow)
Test that we can turn a fan off.
Test that we can turn a fan off.
async def test_turn_off(hass, utcnow): """Test that we can turn a fan off.""" helper = await setup_test_component(hass, create_fan_service) helper.characteristics[V1_ON].value = 1 await hass.services.async_call( "fan", "turn_off", {"entity_id": "fan.testdevice"}, blocki...
[ "async", "def", "test_turn_off", "(", "hass", ",", "utcnow", ")", ":", "helper", "=", "await", "setup_test_component", "(", "hass", ",", "create_fan_service", ")", "helper", ".", "characteristics", "[", "V1_ON", "]", ".", "value", "=", "1", "await", "hass", ...
[ 152, 0 ]
[ 164, 51 ]
python
en
['en', 'en', 'en']
True
test_set_speed
(hass, utcnow)
Test that we set fan speed.
Test that we set fan speed.
async def test_set_speed(hass, utcnow): """Test that we set fan speed.""" helper = await setup_test_component(hass, create_fan_service) helper.characteristics[V1_ON].value = 1 await hass.services.async_call( "fan", "set_speed", {"entity_id": "fan.testdevice", "speed": "high"}, ...
[ "async", "def", "test_set_speed", "(", "hass", ",", "utcnow", ")", ":", "helper", "=", "await", "setup_test_component", "(", "hass", ",", "create_fan_service", ")", "helper", ".", "characteristics", "[", "V1_ON", "]", ".", "value", "=", "1", "await", "hass",...
[ 167, 0 ]
[ 203, 51 ]
python
en
['en', 'fy', 'en']
True
test_set_percentage
(hass, utcnow)
Test that we set fan speed by percentage.
Test that we set fan speed by percentage.
async def test_set_percentage(hass, utcnow): """Test that we set fan speed by percentage.""" helper = await setup_test_component(hass, create_fan_service) helper.characteristics[V1_ON].value = 1 await hass.services.async_call( "fan", "set_percentage", {"entity_id": "fan.testdev...
[ "async", "def", "test_set_percentage", "(", "hass", ",", "utcnow", ")", ":", "helper", "=", "await", "setup_test_component", "(", "hass", ",", "create_fan_service", ")", "helper", ".", "characteristics", "[", "V1_ON", "]", ".", "value", "=", "1", "await", "h...
[ 206, 0 ]
[ 226, 51 ]
python
en
['en', 'fy', 'en']
True
test_speed_read
(hass, utcnow)
Test that we can read a fans oscillation.
Test that we can read a fans oscillation.
async def test_speed_read(hass, utcnow): """Test that we can read a fans oscillation.""" helper = await setup_test_component(hass, create_fan_service) helper.characteristics[V1_ON].value = 1 helper.characteristics[V1_ROTATION_SPEED].value = 100 state = await helper.poll_and_get_state() assert s...
[ "async", "def", "test_speed_read", "(", "hass", ",", "utcnow", ")", ":", "helper", "=", "await", "setup_test_component", "(", "hass", ",", "create_fan_service", ")", "helper", ".", "characteristics", "[", "V1_ON", "]", ".", "value", "=", "1", "helper", ".", ...
[ 229, 0 ]
[ 254, 46 ]
python
en
['en', 'en', 'en']
True
test_set_direction
(hass, utcnow)
Test that we can set fan spin direction.
Test that we can set fan spin direction.
async def test_set_direction(hass, utcnow): """Test that we can set fan spin direction.""" helper = await setup_test_component(hass, create_fan_service) await hass.services.async_call( "fan", "set_direction", {"entity_id": "fan.testdevice", "direction": "reverse"}, blocking=...
[ "async", "def", "test_set_direction", "(", "hass", ",", "utcnow", ")", ":", "helper", "=", "await", "setup_test_component", "(", "hass", ",", "create_fan_service", ")", "await", "hass", ".", "services", ".", "async_call", "(", "\"fan\"", ",", "\"set_direction\""...
[ 257, 0 ]
[ 275, 67 ]
python
en
['en', 'en', 'en']
True
test_direction_read
(hass, utcnow)
Test that we can read a fans oscillation.
Test that we can read a fans oscillation.
async def test_direction_read(hass, utcnow): """Test that we can read a fans oscillation.""" helper = await setup_test_component(hass, create_fan_service) helper.characteristics[V1_ROTATION_DIRECTION].value = 0 state = await helper.poll_and_get_state() assert state.attributes["direction"] == "forwa...
[ "async", "def", "test_direction_read", "(", "hass", ",", "utcnow", ")", ":", "helper", "=", "await", "setup_test_component", "(", "hass", ",", "create_fan_service", ")", "helper", ".", "characteristics", "[", "V1_ROTATION_DIRECTION", "]", ".", "value", "=", "0",...
[ 278, 0 ]
[ 288, 53 ]
python
en
['en', 'en', 'en']
True
test_fanv2_read_state
(hass, utcnow)
Test that we can read the state of a HomeKit fan accessory.
Test that we can read the state of a HomeKit fan accessory.
async def test_fanv2_read_state(hass, utcnow): """Test that we can read the state of a HomeKit fan accessory.""" helper = await setup_test_component(hass, create_fanv2_service) helper.characteristics[V2_ACTIVE].value = False state = await helper.poll_and_get_state() assert state.state == "off" ...
[ "async", "def", "test_fanv2_read_state", "(", "hass", ",", "utcnow", ")", ":", "helper", "=", "await", "setup_test_component", "(", "hass", ",", "create_fanv2_service", ")", "helper", ".", "characteristics", "[", "V2_ACTIVE", "]", ".", "value", "=", "False", "...
[ 291, 0 ]
[ 301, 30 ]
python
en
['en', 'en', 'en']
True
test_v2_turn_on
(hass, utcnow)
Test that we can turn a fan on.
Test that we can turn a fan on.
async def test_v2_turn_on(hass, utcnow): """Test that we can turn a fan on.""" helper = await setup_test_component(hass, create_fanv2_service) await hass.services.async_call( "fan", "turn_on", {"entity_id": "fan.testdevice", "speed": "high"}, blocking=True, ) assert ...
[ "async", "def", "test_v2_turn_on", "(", "hass", ",", "utcnow", ")", ":", "helper", "=", "await", "setup_test_component", "(", "hass", ",", "create_fanv2_service", ")", "await", "hass", ".", "services", ".", "async_call", "(", "\"fan\"", ",", "\"turn_on\"", ","...
[ 304, 0 ]
[ 351, 66 ]
python
en
['en', 'en', 'en']
True
test_v2_turn_off
(hass, utcnow)
Test that we can turn a fan off.
Test that we can turn a fan off.
async def test_v2_turn_off(hass, utcnow): """Test that we can turn a fan off.""" helper = await setup_test_component(hass, create_fanv2_service) helper.characteristics[V2_ACTIVE].value = 1 await hass.services.async_call( "fan", "turn_off", {"entity_id": "fan.testdevice"}, ...
[ "async", "def", "test_v2_turn_off", "(", "hass", ",", "utcnow", ")", ":", "helper", "=", "await", "setup_test_component", "(", "hass", ",", "create_fanv2_service", ")", "helper", ".", "characteristics", "[", "V2_ACTIVE", "]", ".", "value", "=", "1", "await", ...
[ 354, 0 ]
[ 366, 55 ]
python
en
['en', 'en', 'en']
True
test_v2_set_speed
(hass, utcnow)
Test that we set fan speed.
Test that we set fan speed.
async def test_v2_set_speed(hass, utcnow): """Test that we set fan speed.""" helper = await setup_test_component(hass, create_fanv2_service) helper.characteristics[V2_ACTIVE].value = 1 await hass.services.async_call( "fan", "set_speed", {"entity_id": "fan.testdevice", "speed": ...
[ "async", "def", "test_v2_set_speed", "(", "hass", ",", "utcnow", ")", ":", "helper", "=", "await", "setup_test_component", "(", "hass", ",", "create_fanv2_service", ")", "helper", ".", "characteristics", "[", "V2_ACTIVE", "]", ".", "value", "=", "1", "await", ...
[ 369, 0 ]
[ 405, 55 ]
python
en
['en', 'fy', 'en']
True
test_v2_set_percentage
(hass, utcnow)
Test that we set fan speed by percentage.
Test that we set fan speed by percentage.
async def test_v2_set_percentage(hass, utcnow): """Test that we set fan speed by percentage.""" helper = await setup_test_component(hass, create_fanv2_service) helper.characteristics[V2_ACTIVE].value = 1 await hass.services.async_call( "fan", "set_percentage", {"entity_id": "fa...
[ "async", "def", "test_v2_set_percentage", "(", "hass", ",", "utcnow", ")", ":", "helper", "=", "await", "setup_test_component", "(", "hass", ",", "create_fanv2_service", ")", "helper", ".", "characteristics", "[", "V2_ACTIVE", "]", ".", "value", "=", "1", "awa...
[ 408, 0 ]
[ 428, 55 ]
python
en
['en', 'fy', 'en']
True
test_v2_set_percentage_with_min_step
(hass, utcnow)
Test that we set fan speed by percentage.
Test that we set fan speed by percentage.
async def test_v2_set_percentage_with_min_step(hass, utcnow): """Test that we set fan speed by percentage.""" helper = await setup_test_component(hass, create_fanv2_service_with_min_step) helper.characteristics[V2_ACTIVE].value = 1 await hass.services.async_call( "fan", "set_percentage...
[ "async", "def", "test_v2_set_percentage_with_min_step", "(", "hass", ",", "utcnow", ")", ":", "helper", "=", "await", "setup_test_component", "(", "hass", ",", "create_fanv2_service_with_min_step", ")", "helper", ".", "characteristics", "[", "V2_ACTIVE", "]", ".", "...
[ 431, 0 ]
[ 451, 55 ]
python
en
['en', 'fy', 'en']
True
test_v2_speed_read
(hass, utcnow)
Test that we can read a fans oscillation.
Test that we can read a fans oscillation.
async def test_v2_speed_read(hass, utcnow): """Test that we can read a fans oscillation.""" helper = await setup_test_component(hass, create_fanv2_service) helper.characteristics[V2_ACTIVE].value = 1 helper.characteristics[V2_ROTATION_SPEED].value = 100 state = await helper.poll_and_get_state() ...
[ "async", "def", "test_v2_speed_read", "(", "hass", ",", "utcnow", ")", ":", "helper", "=", "await", "setup_test_component", "(", "hass", ",", "create_fanv2_service", ")", "helper", ".", "characteristics", "[", "V2_ACTIVE", "]", ".", "value", "=", "1", "helper"...
[ 454, 0 ]
[ 478, 46 ]
python
en
['en', 'en', 'en']
True
test_v2_set_direction
(hass, utcnow)
Test that we can set fan spin direction.
Test that we can set fan spin direction.
async def test_v2_set_direction(hass, utcnow): """Test that we can set fan spin direction.""" helper = await setup_test_component(hass, create_fanv2_service) await hass.services.async_call( "fan", "set_direction", {"entity_id": "fan.testdevice", "direction": "reverse"}, bloc...
[ "async", "def", "test_v2_set_direction", "(", "hass", ",", "utcnow", ")", ":", "helper", "=", "await", "setup_test_component", "(", "hass", ",", "create_fanv2_service", ")", "await", "hass", ".", "services", ".", "async_call", "(", "\"fan\"", ",", "\"set_directi...
[ 481, 0 ]
[ 499, 67 ]
python
en
['en', 'en', 'en']
True
test_v2_direction_read
(hass, utcnow)
Test that we can read a fans oscillation.
Test that we can read a fans oscillation.
async def test_v2_direction_read(hass, utcnow): """Test that we can read a fans oscillation.""" helper = await setup_test_component(hass, create_fanv2_service) helper.characteristics[V2_ROTATION_DIRECTION].value = 0 state = await helper.poll_and_get_state() assert state.attributes["direction"] == "...
[ "async", "def", "test_v2_direction_read", "(", "hass", ",", "utcnow", ")", ":", "helper", "=", "await", "setup_test_component", "(", "hass", ",", "create_fanv2_service", ")", "helper", ".", "characteristics", "[", "V2_ROTATION_DIRECTION", "]", ".", "value", "=", ...
[ 502, 0 ]
[ 512, 53 ]
python
en
['en', 'en', 'en']
True
test_v2_oscillate
(hass, utcnow)
Test that we can control a fans oscillation.
Test that we can control a fans oscillation.
async def test_v2_oscillate(hass, utcnow): """Test that we can control a fans oscillation.""" helper = await setup_test_component(hass, create_fanv2_service) await hass.services.async_call( "fan", "oscillate", {"entity_id": "fan.testdevice", "oscillating": True}, blocking=Tr...
[ "async", "def", "test_v2_oscillate", "(", "hass", ",", "utcnow", ")", ":", "helper", "=", "await", "setup_test_component", "(", "hass", ",", "create_fanv2_service", ")", "await", "hass", ".", "services", ".", "async_call", "(", "\"fan\"", ",", "\"oscillate\"", ...
[ 515, 0 ]
[ 533, 59 ]
python
en
['en', 'en', 'en']
True
test_v2_oscillate_read
(hass, utcnow)
Test that we can read a fans oscillation.
Test that we can read a fans oscillation.
async def test_v2_oscillate_read(hass, utcnow): """Test that we can read a fans oscillation.""" helper = await setup_test_component(hass, create_fanv2_service) helper.characteristics[V2_SWING_MODE].value = 0 state = await helper.poll_and_get_state() assert state.attributes["oscillating"] is False ...
[ "async", "def", "test_v2_oscillate_read", "(", "hass", ",", "utcnow", ")", ":", "helper", "=", "await", "setup_test_component", "(", "hass", ",", "create_fanv2_service", ")", "helper", ".", "characteristics", "[", "V2_SWING_MODE", "]", ".", "value", "=", "0", ...
[ 536, 0 ]
[ 546, 50 ]
python
en
['en', 'en', 'en']
True
stn
(s, length, encoding, errors)
Convert a string to a null-terminated bytes object.
Convert a string to a null-terminated bytes object.
def stn(s, length, encoding, errors): """Convert a string to a null-terminated bytes object. """ s = s.encode(encoding, errors) return s[:length] + (length - len(s)) * NUL
[ "def", "stn", "(", "s", ",", "length", ",", "encoding", ",", "errors", ")", ":", "s", "=", "s", ".", "encode", "(", "encoding", ",", "errors", ")", "return", "s", "[", ":", "length", "]", "+", "(", "length", "-", "len", "(", "s", ")", ")", "*...
[ 184, 0 ]
[ 188, 47 ]
python
en
['en', 'en', 'en']
True
nts
(s, encoding, errors)
Convert a null-terminated bytes object to a string.
Convert a null-terminated bytes object to a string.
def nts(s, encoding, errors): """Convert a null-terminated bytes object to a string. """ p = s.find(b"\0") if p != -1: s = s[:p] return s.decode(encoding, errors)
[ "def", "nts", "(", "s", ",", "encoding", ",", "errors", ")", ":", "p", "=", "s", ".", "find", "(", "b\"\\0\"", ")", "if", "p", "!=", "-", "1", ":", "s", "=", "s", "[", ":", "p", "]", "return", "s", ".", "decode", "(", "encoding", ",", "erro...
[ 190, 0 ]
[ 196, 37 ]
python
en
['en', 'en', 'en']
True
nti
(s)
Convert a number field to a python number.
Convert a number field to a python number.
def nti(s): """Convert a number field to a python number. """ # There are two possible encodings for a number field, see # itn() below. if s[0] != chr(0o200): try: n = int(nts(s, "ascii", "strict") or "0", 8) except ValueError: raise InvalidHeaderError("invali...
[ "def", "nti", "(", "s", ")", ":", "# There are two possible encodings for a number field, see", "# itn() below.", "if", "s", "[", "0", "]", "!=", "chr", "(", "0o200", ")", ":", "try", ":", "n", "=", "int", "(", "nts", "(", "s", ",", "\"ascii\"", ",", "\"...
[ 198, 0 ]
[ 213, 12 ]
python
en
['en', 'en', 'en']
True
itn
(n, digits=8, format=DEFAULT_FORMAT)
Convert a python number to a number field.
Convert a python number to a number field.
def itn(n, digits=8, format=DEFAULT_FORMAT): """Convert a python number to a number field. """ # POSIX 1003.1-1988 requires numbers to be encoded as a string of # octal digits followed by a null-byte, this allows values up to # (8**(digits-1))-1. GNU tar allows storing numbers greater than # tha...
[ "def", "itn", "(", "n", ",", "digits", "=", "8", ",", "format", "=", "DEFAULT_FORMAT", ")", ":", "# POSIX 1003.1-1988 requires numbers to be encoded as a string of", "# octal digits followed by a null-byte, this allows values up to", "# (8**(digits-1))-1. GNU tar allows storing numbe...
[ 215, 0 ]
[ 240, 12 ]
python
en
['en', 'en', 'en']
True
calc_chksums
(buf)
Calculate the checksum for a member's header by summing up all characters except for the chksum field which is treated as if it was filled with spaces. According to the GNU tar sources, some tars (Sun and NeXT) calculate chksum with signed char, which will be different if there are chars in ...
Calculate the checksum for a member's header by summing up all characters except for the chksum field which is treated as if it was filled with spaces. According to the GNU tar sources, some tars (Sun and NeXT) calculate chksum with signed char, which will be different if there are chars in ...
def calc_chksums(buf): """Calculate the checksum for a member's header by summing up all characters except for the chksum field which is treated as if it was filled with spaces. According to the GNU tar sources, some tars (Sun and NeXT) calculate chksum with signed char, which will be di...
[ "def", "calc_chksums", "(", "buf", ")", ":", "unsigned_chksum", "=", "256", "+", "sum", "(", "struct", ".", "unpack", "(", "\"148B\"", ",", "buf", "[", ":", "148", "]", ")", "+", "struct", ".", "unpack", "(", "\"356B\"", ",", "buf", "[", "156", ":"...
[ 242, 0 ]
[ 253, 41 ]
python
en
['en', 'en', 'en']
True
copyfileobj
(src, dst, length=None)
Copy length bytes from fileobj src to fileobj dst. If length is None, copy the entire content.
Copy length bytes from fileobj src to fileobj dst. If length is None, copy the entire content.
def copyfileobj(src, dst, length=None): """Copy length bytes from fileobj src to fileobj dst. If length is None, copy the entire content. """ if length == 0: return if length is None: while True: buf = src.read(16*1024) if not buf: break ...
[ "def", "copyfileobj", "(", "src", ",", "dst", ",", "length", "=", "None", ")", ":", "if", "length", "==", "0", ":", "return", "if", "length", "is", "None", ":", "while", "True", ":", "buf", "=", "src", ".", "read", "(", "16", "*", "1024", ")", ...
[ 255, 0 ]
[ 282, 10 ]
python
en
['en', 'pt', 'en']
True
filemode
(mode)
Convert a file's mode to a string of the form -rwxrwxrwx. Used by TarFile.list()
Convert a file's mode to a string of the form -rwxrwxrwx. Used by TarFile.list()
def filemode(mode): """Convert a file's mode to a string of the form -rwxrwxrwx. Used by TarFile.list() """ perm = [] for table in filemode_table: for bit, char in table: if mode & bit == bit: perm.append(char) break else: ...
[ "def", "filemode", "(", "mode", ")", ":", "perm", "=", "[", "]", "for", "table", "in", "filemode_table", ":", "for", "bit", ",", "char", "in", "table", ":", "if", "mode", "&", "bit", "==", "bit", ":", "perm", ".", "append", "(", "char", ")", "bre...
[ 311, 0 ]
[ 324, 24 ]
python
en
['en', 'en', 'en']
True
is_tarfile
(name)
Return True if name points to a tar archive that we are able to handle, else return False.
Return True if name points to a tar archive that we are able to handle, else return False.
def is_tarfile(name): """Return True if name points to a tar archive that we are able to handle, else return False. """ try: t = open(name) t.close() return True except TarError: return False
[ "def", "is_tarfile", "(", "name", ")", ":", "try", ":", "t", "=", "open", "(", "name", ")", "t", ".", "close", "(", ")", "return", "True", "except", "TarError", ":", "return", "False" ]
[ 2594, 0 ]
[ 2603, 20 ]
python
en
['en', 'en', 'en']
True
_Stream.__init__
(self, name, mode, comptype, fileobj, bufsize)
Construct a _Stream object.
Construct a _Stream object.
def __init__(self, name, mode, comptype, fileobj, bufsize): """Construct a _Stream object. """ self._extfileobj = True if fileobj is None: fileobj = _LowLevelFile(name, mode) self._extfileobj = False if comptype == '*': # Enable transparent co...
[ "def", "__init__", "(", "self", ",", "name", ",", "mode", ",", "comptype", ",", "fileobj", ",", "bufsize", ")", ":", "self", ".", "_extfileobj", "=", "True", "if", "fileobj", "is", "None", ":", "fileobj", "=", "_LowLevelFile", "(", "name", ",", "mode",...
[ 398, 4 ]
[ 448, 17 ]
python
en
['en', 'en', 'en']
True
_Stream._init_write_gz
(self)
Initialize for writing with gzip compression.
Initialize for writing with gzip compression.
def _init_write_gz(self): """Initialize for writing with gzip compression. """ self.cmp = self.zlib.compressobj(9, self.zlib.DEFLATED, -self.zlib.MAX_WBITS, self.zlib.DEF_MEM_LEVEL, ...
[ "def", "_init_write_gz", "(", "self", ")", ":", "self", ".", "cmp", "=", "self", ".", "zlib", ".", "compressobj", "(", "9", ",", "self", ".", "zlib", ".", "DEFLATED", ",", "-", "self", ".", "zlib", ".", "MAX_WBITS", ",", "self", ".", "zlib", ".", ...
[ 454, 4 ]
[ 466, 69 ]
python
en
['en', 'en', 'en']
True
_Stream.write
(self, s)
Write string s to the stream.
Write string s to the stream.
def write(self, s): """Write string s to the stream. """ if self.comptype == "gz": self.crc = self.zlib.crc32(s, self.crc) self.pos += len(s) if self.comptype != "tar": s = self.cmp.compress(s) self.__write(s)
[ "def", "write", "(", "self", ",", "s", ")", ":", "if", "self", ".", "comptype", "==", "\"gz\"", ":", "self", ".", "crc", "=", "self", ".", "zlib", ".", "crc32", "(", "s", ",", "self", ".", "crc", ")", "self", ".", "pos", "+=", "len", "(", "s"...
[ 468, 4 ]
[ 476, 23 ]
python
en
['en', 'en', 'en']
True
_Stream.__write
(self, s)
Write string s to the stream if a whole new block is ready to be written.
Write string s to the stream if a whole new block is ready to be written.
def __write(self, s): """Write string s to the stream if a whole new block is ready to be written. """ self.buf += s while len(self.buf) > self.bufsize: self.fileobj.write(self.buf[:self.bufsize]) self.buf = self.buf[self.bufsize:]
[ "def", "__write", "(", "self", ",", "s", ")", ":", "self", ".", "buf", "+=", "s", "while", "len", "(", "self", ".", "buf", ")", ">", "self", ".", "bufsize", ":", "self", ".", "fileobj", ".", "write", "(", "self", ".", "buf", "[", ":", "self", ...
[ 478, 4 ]
[ 485, 46 ]
python
en
['en', 'en', 'en']
True
_Stream.close
(self)
Close the _Stream object. No operation should be done on it afterwards.
Close the _Stream object. No operation should be done on it afterwards.
def close(self): """Close the _Stream object. No operation should be done on it afterwards. """ if self.closed: return if self.mode == "w" and self.comptype != "tar": self.buf += self.cmp.flush() if self.mode == "w" and self.buf: s...
[ "def", "close", "(", "self", ")", ":", "if", "self", ".", "closed", ":", "return", "if", "self", ".", "mode", "==", "\"w\"", "and", "self", ".", "comptype", "!=", "\"tar\"", ":", "self", ".", "buf", "+=", "self", ".", "cmp", ".", "flush", "(", ")...
[ 487, 4 ]
[ 513, 26 ]
python
en
['en', 'en', 'en']
True
_Stream._init_read_gz
(self)
Initialize for reading a gzip compressed fileobj.
Initialize for reading a gzip compressed fileobj.
def _init_read_gz(self): """Initialize for reading a gzip compressed fileobj. """ self.cmp = self.zlib.decompressobj(-self.zlib.MAX_WBITS) self.dbuf = b"" # taken from gzip.GzipFile with some alterations if self.__read(2) != b"\037\213": raise ReadError("not ...
[ "def", "_init_read_gz", "(", "self", ")", ":", "self", ".", "cmp", "=", "self", ".", "zlib", ".", "decompressobj", "(", "-", "self", ".", "zlib", ".", "MAX_WBITS", ")", "self", ".", "dbuf", "=", "b\"\"", "# taken from gzip.GzipFile with some alterations", "i...
[ 515, 4 ]
[ 544, 26 ]
python
en
['en', 'en', 'pt']
True
_Stream.tell
(self)
Return the stream's file pointer position.
Return the stream's file pointer position.
def tell(self): """Return the stream's file pointer position. """ return self.pos
[ "def", "tell", "(", "self", ")", ":", "return", "self", ".", "pos" ]
[ 546, 4 ]
[ 549, 23 ]
python
en
['en', 'en', 'en']
True
_Stream.seek
(self, pos=0)
Set the stream's file pointer to pos. Negative seeking is forbidden.
Set the stream's file pointer to pos. Negative seeking is forbidden.
def seek(self, pos=0): """Set the stream's file pointer to pos. Negative seeking is forbidden. """ if pos - self.pos >= 0: blocks, remainder = divmod(pos - self.pos, self.bufsize) for i in range(blocks): self.read(self.bufsize) self....
[ "def", "seek", "(", "self", ",", "pos", "=", "0", ")", ":", "if", "pos", "-", "self", ".", "pos", ">=", "0", ":", "blocks", ",", "remainder", "=", "divmod", "(", "pos", "-", "self", ".", "pos", ",", "self", ".", "bufsize", ")", "for", "i", "i...
[ 551, 4 ]
[ 562, 23 ]
python
en
['en', 'en', 'en']
True
_Stream.read
(self, size=None)
Return the next size number of bytes from the stream. If size is not defined, return all bytes of the stream up to EOF.
Return the next size number of bytes from the stream. If size is not defined, return all bytes of the stream up to EOF.
def read(self, size=None): """Return the next size number of bytes from the stream. If size is not defined, return all bytes of the stream up to EOF. """ if size is None: t = [] while True: buf = self._read(self.bufsize) ...
[ "def", "read", "(", "self", ",", "size", "=", "None", ")", ":", "if", "size", "is", "None", ":", "t", "=", "[", "]", "while", "True", ":", "buf", "=", "self", ".", "_read", "(", "self", ".", "bufsize", ")", "if", "not", "buf", ":", "break", "...
[ 564, 4 ]
[ 580, 18 ]
python
en
['en', 'en', 'en']
True
_Stream._read
(self, size)
Return size bytes from the stream.
Return size bytes from the stream.
def _read(self, size): """Return size bytes from the stream. """ if self.comptype == "tar": return self.__read(size) c = len(self.dbuf) while c < size: buf = self.__read(self.bufsize) if not buf: break try: ...
[ "def", "_read", "(", "self", ",", "size", ")", ":", "if", "self", ".", "comptype", "==", "\"tar\"", ":", "return", "self", ".", "__read", "(", "size", ")", "c", "=", "len", "(", "self", ".", "dbuf", ")", "while", "c", "<", "size", ":", "buf", "...
[ 582, 4 ]
[ 601, 18 ]
python
en
['en', 'en', 'en']
True
_Stream.__read
(self, size)
Return size bytes from stream. If internal buffer is empty, read another block from the stream.
Return size bytes from stream. If internal buffer is empty, read another block from the stream.
def __read(self, size): """Return size bytes from stream. If internal buffer is empty, read another block from the stream. """ c = len(self.buf) while c < size: buf = self.fileobj.read(self.bufsize) if not buf: break self.buf...
[ "def", "__read", "(", "self", ",", "size", ")", ":", "c", "=", "len", "(", "self", ".", "buf", ")", "while", "c", "<", "size", ":", "buf", "=", "self", ".", "fileobj", ".", "read", "(", "self", ".", "bufsize", ")", "if", "not", "buf", ":", "b...
[ 603, 4 ]
[ 616, 18 ]
python
en
['en', 'fy', 'en']
True
_FileInFile.tell
(self)
Return the current file position.
Return the current file position.
def tell(self): """Return the current file position. """ return self.position
[ "def", "tell", "(", "self", ")", ":", "return", "self", ".", "position" ]
[ 741, 4 ]
[ 744, 28 ]
python
en
['en', 'en', 'en']
True
_FileInFile.seek
(self, position)
Seek to a position in the file.
Seek to a position in the file.
def seek(self, position): """Seek to a position in the file. """ self.position = position
[ "def", "seek", "(", "self", ",", "position", ")", ":", "self", ".", "position", "=", "position" ]
[ 746, 4 ]
[ 749, 32 ]
python
en
['en', 'en', 'en']
True
_FileInFile.read
(self, size=None)
Read data from the file.
Read data from the file.
def read(self, size=None): """Read data from the file. """ if size is None: size = self.size - self.position else: size = min(size, self.size - self.position) buf = b"" while size > 0: while True: data, start, stop, off...
[ "def", "read", "(", "self", ",", "size", "=", "None", ")", ":", "if", "size", "is", "None", ":", "size", "=", "self", ".", "size", "-", "self", ".", "position", "else", ":", "size", "=", "min", "(", "size", ",", "self", ".", "size", "-", "self"...
[ 751, 4 ]
[ 777, 18 ]
python
en
['en', 'en', 'en']
True
ExFileObject.read
(self, size=None)
Read at most size bytes from the file. If size is not present or None, read all data until EOF is reached.
Read at most size bytes from the file. If size is not present or None, read all data until EOF is reached.
def read(self, size=None): """Read at most size bytes from the file. If size is not present or None, read all data until EOF is reached. """ if self.closed: raise ValueError("I/O operation on closed file") buf = b"" if self.buffer: if size is N...
[ "def", "read", "(", "self", ",", "size", "=", "None", ")", ":", "if", "self", ".", "closed", ":", "raise", "ValueError", "(", "\"I/O operation on closed file\"", ")", "buf", "=", "b\"\"", "if", "self", ".", "buffer", ":", "if", "size", "is", "None", ":...
[ 809, 4 ]
[ 831, 18 ]
python
en
['en', 'en', 'en']
True
ExFileObject.readline
(self, size=-1)
Read one entire line from the file. If size is present and non-negative, return a string with at most that size, which may be an incomplete line.
Read one entire line from the file. If size is present and non-negative, return a string with at most that size, which may be an incomplete line.
def readline(self, size=-1): """Read one entire line from the file. If size is present and non-negative, return a string with at most that size, which may be an incomplete line. """ if self.closed: raise ValueError("I/O operation on closed file") pos = ...
[ "def", "readline", "(", "self", ",", "size", "=", "-", "1", ")", ":", "if", "self", ".", "closed", ":", "raise", "ValueError", "(", "\"I/O operation on closed file\"", ")", "pos", "=", "self", ".", "buffer", ".", "find", "(", "b\"\\n\"", ")", "+", "1",...
[ 836, 4 ]
[ 863, 18 ]
python
en
['en', 'en', 'en']
True
ExFileObject.readlines
(self)
Return a list with all remaining lines.
Return a list with all remaining lines.
def readlines(self): """Return a list with all remaining lines. """ result = [] while True: line = self.readline() if not line: break result.append(line) return result
[ "def", "readlines", "(", "self", ")", ":", "result", "=", "[", "]", "while", "True", ":", "line", "=", "self", ".", "readline", "(", ")", "if", "not", "line", ":", "break", "result", ".", "append", "(", "line", ")", "return", "result" ]
[ 865, 4 ]
[ 873, 21 ]
python
en
['en', 'en', 'en']
True
ExFileObject.tell
(self)
Return the current file position.
Return the current file position.
def tell(self): """Return the current file position. """ if self.closed: raise ValueError("I/O operation on closed file") return self.position
[ "def", "tell", "(", "self", ")", ":", "if", "self", ".", "closed", ":", "raise", "ValueError", "(", "\"I/O operation on closed file\"", ")", "return", "self", ".", "position" ]
[ 875, 4 ]
[ 881, 28 ]
python
en
['en', 'en', 'en']
True
ExFileObject.seek
(self, pos, whence=os.SEEK_SET)
Seek to a position in the file.
Seek to a position in the file.
def seek(self, pos, whence=os.SEEK_SET): """Seek to a position in the file. """ if self.closed: raise ValueError("I/O operation on closed file") if whence == os.SEEK_SET: self.position = min(max(pos, 0), self.size) elif whence == os.SEEK_CUR: ...
[ "def", "seek", "(", "self", ",", "pos", ",", "whence", "=", "os", ".", "SEEK_SET", ")", ":", "if", "self", ".", "closed", ":", "raise", "ValueError", "(", "\"I/O operation on closed file\"", ")", "if", "whence", "==", "os", ".", "SEEK_SET", ":", "self", ...
[ 883, 4 ]
[ 902, 40 ]
python
en
['en', 'en', 'en']
True
ExFileObject.close
(self)
Close the file object.
Close the file object.
def close(self): """Close the file object. """ self.closed = True
[ "def", "close", "(", "self", ")", ":", "self", ".", "closed", "=", "True" ]
[ 904, 4 ]
[ 907, 26 ]
python
en
['en', 'en', 'en']
True
ExFileObject.__iter__
(self)
Get an iterator over the file's lines.
Get an iterator over the file's lines.
def __iter__(self): """Get an iterator over the file's lines. """ while True: line = self.readline() if not line: break yield line
[ "def", "__iter__", "(", "self", ")", ":", "while", "True", ":", "line", "=", "self", ".", "readline", "(", ")", "if", "not", "line", ":", "break", "yield", "line" ]
[ 909, 4 ]
[ 916, 22 ]
python
en
['en', 'en', 'en']
True
TarInfo.__init__
(self, name="")
Construct a TarInfo object. name is the optional name of the member.
Construct a TarInfo object. name is the optional name of the member.
def __init__(self, name=""): """Construct a TarInfo object. name is the optional name of the member. """ self.name = name # member name self.mode = 0o644 # file permissions self.uid = 0 # user id self.gid = 0 # group id ...
[ "def", "__init__", "(", "self", ",", "name", "=", "\"\"", ")", ":", "self", ".", "name", "=", "name", "# member name", "self", ".", "mode", "=", "0o644", "# file permissions", "self", ".", "uid", "=", "0", "# user id", "self", ".", "gid", "=", "0", "...
[ 936, 4 ]
[ 958, 29 ]
python
en
['en', 'en', 'en']
True
TarInfo.get_info
(self)
Return the TarInfo's attributes as a dictionary.
Return the TarInfo's attributes as a dictionary.
def get_info(self): """Return the TarInfo's attributes as a dictionary. """ info = { "name": self.name, "mode": self.mode & 0o7777, "uid": self.uid, "gid": self.gid, "size": self.size, "mtime": self....
[ "def", "get_info", "(", "self", ")", ":", "info", "=", "{", "\"name\"", ":", "self", ".", "name", ",", "\"mode\"", ":", "self", ".", "mode", "&", "0o7777", ",", "\"uid\"", ":", "self", ".", "uid", ",", "\"gid\"", ":", "self", ".", "gid", ",", "\"...
[ 977, 4 ]
[ 999, 19 ]
python
en
['en', 'en', 'en']
True
TarInfo.tobuf
(self, format=DEFAULT_FORMAT, encoding=ENCODING, errors="surrogateescape")
Return a tar header as a string of 512 byte blocks.
Return a tar header as a string of 512 byte blocks.
def tobuf(self, format=DEFAULT_FORMAT, encoding=ENCODING, errors="surrogateescape"): """Return a tar header as a string of 512 byte blocks. """ info = self.get_info() if format == USTAR_FORMAT: return self.create_ustar_header(info, encoding, errors) elif format == GN...
[ "def", "tobuf", "(", "self", ",", "format", "=", "DEFAULT_FORMAT", ",", "encoding", "=", "ENCODING", ",", "errors", "=", "\"surrogateescape\"", ")", ":", "info", "=", "self", ".", "get_info", "(", ")", "if", "format", "==", "USTAR_FORMAT", ":", "return", ...
[ 1001, 4 ]
[ 1013, 46 ]
python
en
['en', 'cy', 'en']
True
TarInfo.create_ustar_header
(self, info, encoding, errors)
Return the object as a ustar header block.
Return the object as a ustar header block.
def create_ustar_header(self, info, encoding, errors): """Return the object as a ustar header block. """ info["magic"] = POSIX_MAGIC if len(info["linkname"]) > LENGTH_LINK: raise ValueError("linkname is too long") if len(info["name"]) > LENGTH_NAME: info...
[ "def", "create_ustar_header", "(", "self", ",", "info", ",", "encoding", ",", "errors", ")", ":", "info", "[", "\"magic\"", "]", "=", "POSIX_MAGIC", "if", "len", "(", "info", "[", "\"linkname\"", "]", ")", ">", "LENGTH_LINK", ":", "raise", "ValueError", ...
[ 1015, 4 ]
[ 1026, 72 ]
python
en
['en', 'ga', 'en']
True
TarInfo.create_gnu_header
(self, info, encoding, errors)
Return the object as a GNU header block sequence.
Return the object as a GNU header block sequence.
def create_gnu_header(self, info, encoding, errors): """Return the object as a GNU header block sequence. """ info["magic"] = GNU_MAGIC buf = b"" if len(info["linkname"]) > LENGTH_LINK: buf += self._create_gnu_long_header(info["linkname"], GNUTYPE_LONGLINK, encoding,...
[ "def", "create_gnu_header", "(", "self", ",", "info", ",", "encoding", ",", "errors", ")", ":", "info", "[", "\"magic\"", "]", "=", "GNU_MAGIC", "buf", "=", "b\"\"", "if", "len", "(", "info", "[", "\"linkname\"", "]", ")", ">", "LENGTH_LINK", ":", "buf...
[ 1028, 4 ]
[ 1040, 76 ]
python
en
['en', 'en', 'en']
True
TarInfo.create_pax_header
(self, info, encoding)
Return the object as a ustar header block. If it cannot be represented this way, prepend a pax extended header sequence with supplement information.
Return the object as a ustar header block. If it cannot be represented this way, prepend a pax extended header sequence with supplement information.
def create_pax_header(self, info, encoding): """Return the object as a ustar header block. If it cannot be represented this way, prepend a pax extended header sequence with supplement information. """ info["magic"] = POSIX_MAGIC pax_headers = self.pax_headers.copy()...
[ "def", "create_pax_header", "(", "self", ",", "info", ",", "encoding", ")", ":", "info", "[", "\"magic\"", "]", "=", "POSIX_MAGIC", "pax_headers", "=", "self", ".", "pax_headers", ".", "copy", "(", ")", "# Test string fields for values that exceed the field length o...
[ 1042, 4 ]
[ 1089, 80 ]
python
en
['en', 'en', 'en']
True
TarInfo.create_pax_global_header
(cls, pax_headers)
Return the object as a pax global header block sequence.
Return the object as a pax global header block sequence.
def create_pax_global_header(cls, pax_headers): """Return the object as a pax global header block sequence. """ return cls._create_pax_generic_header(pax_headers, XGLTYPE, "utf8")
[ "def", "create_pax_global_header", "(", "cls", ",", "pax_headers", ")", ":", "return", "cls", ".", "_create_pax_generic_header", "(", "pax_headers", ",", "XGLTYPE", ",", "\"utf8\"", ")" ]
[ 1092, 4 ]
[ 1095, 75 ]
python
en
['en', 'en', 'en']
True
TarInfo._posix_split_name
(self, name)
Split a name longer than 100 chars into a prefix and a name part.
Split a name longer than 100 chars into a prefix and a name part.
def _posix_split_name(self, name): """Split a name longer than 100 chars into a prefix and a name part. """ prefix = name[:LENGTH_PREFIX + 1] while prefix and prefix[-1] != "/": prefix = prefix[:-1] name = name[len(prefix):] prefix = prefix[:-1] ...
[ "def", "_posix_split_name", "(", "self", ",", "name", ")", ":", "prefix", "=", "name", "[", ":", "LENGTH_PREFIX", "+", "1", "]", "while", "prefix", "and", "prefix", "[", "-", "1", "]", "!=", "\"/\"", ":", "prefix", "=", "prefix", "[", ":", "-", "1"...
[ 1097, 4 ]
[ 1110, 27 ]
python
en
['en', 'ht', 'en']
True
TarInfo._create_header
(info, format, encoding, errors)
Return a header block. info is a dictionary with file information, format must be one of the *_FORMAT constants.
Return a header block. info is a dictionary with file information, format must be one of the *_FORMAT constants.
def _create_header(info, format, encoding, errors): """Return a header block. info is a dictionary with file information, format must be one of the *_FORMAT constants. """ parts = [ stn(info.get("name", ""), 100, encoding, errors), itn(info.get("mode", 0) & 0o7...
[ "def", "_create_header", "(", "info", ",", "format", ",", "encoding", ",", "errors", ")", ":", "parts", "=", "[", "stn", "(", "info", ".", "get", "(", "\"name\"", ",", "\"\"", ")", ",", "100", ",", "encoding", ",", "errors", ")", ",", "itn", "(", ...
[ 1113, 4 ]
[ 1138, 18 ]
python
en
['en', 'en', 'en']
True
TarInfo._create_payload
(payload)
Return the string payload filled with zero bytes up to the next 512 byte border.
Return the string payload filled with zero bytes up to the next 512 byte border.
def _create_payload(payload): """Return the string payload filled with zero bytes up to the next 512 byte border. """ blocks, remainder = divmod(len(payload), BLOCKSIZE) if remainder > 0: payload += (BLOCKSIZE - remainder) * NUL return payload
[ "def", "_create_payload", "(", "payload", ")", ":", "blocks", ",", "remainder", "=", "divmod", "(", "len", "(", "payload", ")", ",", "BLOCKSIZE", ")", "if", "remainder", ">", "0", ":", "payload", "+=", "(", "BLOCKSIZE", "-", "remainder", ")", "*", "NUL...
[ 1141, 4 ]
[ 1148, 22 ]
python
en
['en', 'en', 'en']
True
TarInfo._create_gnu_long_header
(cls, name, type, encoding, errors)
Return a GNUTYPE_LONGNAME or GNUTYPE_LONGLINK sequence for name.
Return a GNUTYPE_LONGNAME or GNUTYPE_LONGLINK sequence for name.
def _create_gnu_long_header(cls, name, type, encoding, errors): """Return a GNUTYPE_LONGNAME or GNUTYPE_LONGLINK sequence for name. """ name = name.encode(encoding, errors) + NUL info = {} info["name"] = "././@LongLink" info["type"] = type info["size"]...
[ "def", "_create_gnu_long_header", "(", "cls", ",", "name", ",", "type", ",", "encoding", ",", "errors", ")", ":", "name", "=", "name", ".", "encode", "(", "encoding", ",", "errors", ")", "+", "NUL", "info", "=", "{", "}", "info", "[", "\"name\"", "]"...
[ 1151, 4 ]
[ 1165, 41 ]
python
en
['en', 'en', 'en']
True
TarInfo._create_pax_generic_header
(cls, pax_headers, type, encoding)
Return a POSIX.1-2008 extended or global header sequence that contains a list of keyword, value pairs. The values must be strings.
Return a POSIX.1-2008 extended or global header sequence that contains a list of keyword, value pairs. The values must be strings.
def _create_pax_generic_header(cls, pax_headers, type, encoding): """Return a POSIX.1-2008 extended or global header sequence that contains a list of keyword, value pairs. The values must be strings. """ # Check if one of the fields contains surrogate characters and thereby...
[ "def", "_create_pax_generic_header", "(", "cls", ",", "pax_headers", ",", "type", ",", "encoding", ")", ":", "# Check if one of the fields contains surrogate characters and thereby", "# forces hdrcharset=BINARY, see _proc_pax() for more information.", "binary", "=", "False", "for",...
[ 1168, 4 ]
[ 1216, 44 ]
python
en
['en', 'en', 'en']
True
TarInfo.frombuf
(cls, buf, encoding, errors)
Construct a TarInfo object from a 512 byte bytes object.
Construct a TarInfo object from a 512 byte bytes object.
def frombuf(cls, buf, encoding, errors): """Construct a TarInfo object from a 512 byte bytes object. """ if len(buf) == 0: raise EmptyHeaderError("empty header") if len(buf) != BLOCKSIZE: raise TruncatedHeaderError("truncated header") if buf.count(NUL) == ...
[ "def", "frombuf", "(", "cls", ",", "buf", ",", "encoding", ",", "errors", ")", ":", "if", "len", "(", "buf", ")", "==", "0", ":", "raise", "EmptyHeaderError", "(", "\"empty header\"", ")", "if", "len", "(", "buf", ")", "!=", "BLOCKSIZE", ":", "raise"...
[ 1219, 4 ]
[ 1279, 18 ]
python
en
['en', 'en', 'en']
True
TarInfo.fromtarfile
(cls, tarfile)
Return the next TarInfo object from TarFile object tarfile.
Return the next TarInfo object from TarFile object tarfile.
def fromtarfile(cls, tarfile): """Return the next TarInfo object from TarFile object tarfile. """ buf = tarfile.fileobj.read(BLOCKSIZE) obj = cls.frombuf(buf, tarfile.encoding, tarfile.errors) obj.offset = tarfile.fileobj.tell() - BLOCKSIZE return obj._proc_mem...
[ "def", "fromtarfile", "(", "cls", ",", "tarfile", ")", ":", "buf", "=", "tarfile", ".", "fileobj", ".", "read", "(", "BLOCKSIZE", ")", "obj", "=", "cls", ".", "frombuf", "(", "buf", ",", "tarfile", ".", "encoding", ",", "tarfile", ".", "errors", ")",...
[ 1282, 4 ]
[ 1289, 40 ]
python
en
['en', 'en', 'en']
True
TarInfo._proc_member
(self, tarfile)
Choose the right processing method depending on the type and call it.
Choose the right processing method depending on the type and call it.
def _proc_member(self, tarfile): """Choose the right processing method depending on the type and call it. """ if self.type in (GNUTYPE_LONGNAME, GNUTYPE_LONGLINK): return self._proc_gnulong(tarfile) elif self.type == GNUTYPE_SPARSE: return self._proc_sp...
[ "def", "_proc_member", "(", "self", ",", "tarfile", ")", ":", "if", "self", ".", "type", "in", "(", "GNUTYPE_LONGNAME", ",", "GNUTYPE_LONGLINK", ")", ":", "return", "self", ".", "_proc_gnulong", "(", "tarfile", ")", "elif", "self", ".", "type", "==", "GN...
[ 1302, 4 ]
[ 1313, 46 ]
python
en
['en', 'en', 'en']
True
TarInfo._proc_builtin
(self, tarfile)
Process a builtin type or an unknown type which will be treated as a regular file.
Process a builtin type or an unknown type which will be treated as a regular file.
def _proc_builtin(self, tarfile): """Process a builtin type or an unknown type which will be treated as a regular file. """ self.offset_data = tarfile.fileobj.tell() offset = self.offset_data if self.isreg() or self.type not in SUPPORTED_TYPES: # Skip the f...
[ "def", "_proc_builtin", "(", "self", ",", "tarfile", ")", ":", "self", ".", "offset_data", "=", "tarfile", ".", "fileobj", ".", "tell", "(", ")", "offset", "=", "self", ".", "offset_data", "if", "self", ".", "isreg", "(", ")", "or", "self", ".", "typ...
[ 1315, 4 ]
[ 1330, 19 ]
python
en
['en', 'en', 'en']
True
TarInfo._proc_gnulong
(self, tarfile)
Process the blocks that hold a GNU longname or longlink member.
Process the blocks that hold a GNU longname or longlink member.
def _proc_gnulong(self, tarfile): """Process the blocks that hold a GNU longname or longlink member. """ buf = tarfile.fileobj.read(self._block(self.size)) # Fetch the next header and process it. try: next = self.fromtarfile(tarfile) except HeaderE...
[ "def", "_proc_gnulong", "(", "self", ",", "tarfile", ")", ":", "buf", "=", "tarfile", ".", "fileobj", ".", "read", "(", "self", ".", "_block", "(", "self", ".", "size", ")", ")", "# Fetch the next header and process it.", "try", ":", "next", "=", "self", ...
[ 1332, 4 ]
[ 1352, 19 ]
python
en
['en', 'en', 'en']
True
TarInfo._proc_sparse
(self, tarfile)
Process a GNU sparse header plus extra headers.
Process a GNU sparse header plus extra headers.
def _proc_sparse(self, tarfile): """Process a GNU sparse header plus extra headers. """ # We already collected some sparse structures in frombuf(). structs, isextended, origsize = self._sparse_structs del self._sparse_structs # Collect sparse structures from extended hea...
[ "def", "_proc_sparse", "(", "self", ",", "tarfile", ")", ":", "# We already collected some sparse structures in frombuf().", "structs", ",", "isextended", ",", "origsize", "=", "self", ".", "_sparse_structs", "del", "self", ".", "_sparse_structs", "# Collect sparse struct...
[ 1354, 4 ]
[ 1380, 19 ]
python
en
['en', 'en', 'en']
True
TarInfo._proc_pax
(self, tarfile)
Process an extended or global header as described in POSIX.1-2008.
Process an extended or global header as described in POSIX.1-2008.
def _proc_pax(self, tarfile): """Process an extended or global header as described in POSIX.1-2008. """ # Read the header information. buf = tarfile.fileobj.read(self._block(self.size)) # A pax header stores supplemental information for either # the following ...
[ "def", "_proc_pax", "(", "self", ",", "tarfile", ")", ":", "# Read the header information.", "buf", "=", "tarfile", ".", "fileobj", ".", "read", "(", "self", ".", "_block", "(", "self", ".", "size", ")", ")", "# A pax header stores supplemental information for eit...
[ 1382, 4 ]
[ 1482, 19 ]
python
en
['en', 'en', 'en']
True