<commit_before># -------------------------------------------------------------------------
# Copyright (c) Microsoft.  All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#   http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# --------------------------------------------------------------------------
from io import (
    BytesIO
)
from os import (
    path,
)

from azure.storage.common._common_conversion import (
    _encode_base64,
    _to_str,
    _int_to_str,
    _datetime_to_utc_string,
    _get_content_md5,
)
from azure.storage.common._constants import (
    SERVICE_HOST_BASE,
    DEFAULT_PROTOCOL,
)
from azure.storage.common._error import (
    _validate_not_none,
    _validate_type_bytes,
    _validate_encryption_required,
    _validate_encryption_unsupported,
    _ERROR_VALUE_NEGATIVE,
    _ERROR_VALUE_SHOULD_BE_STREAM
)
from azure.storage.common._http import HTTPRequest
from azure.storage.common._serialization import (
    _get_request_body,
    _get_data_bytes_only,
    _get_data_bytes_or_stream_only,
    _add_metadata_headers,
)
from azure.storage.common._serialization import (
    _len_plus
)
from ._deserialization import (
    _convert_xml_to_block_list,
    _parse_base_properties,
)
from ._encryption import (
    _encrypt_blob,
    _generate_blob_encryption_data,
)
from ._serialization import (
    _convert_block_list_to_xml,
    _get_path,
)
from ._upload_chunking import (
    _BlockBlobChunkUploader,
    _upload_blob_chunks,
    _upload_blob_substream_blocks,
)
from .baseblobservice import BaseBlobService
from .models import (
    _BlobTypes,
)


class BlockBlobService(BaseBlobService):
    '''
    Block blobs let you upload large blobs efficiently. Block blobs are comprised
    of blocks, each of which is identified by a block ID. You create or modify a
    block blob by writing a set of blocks and committing them by their block IDs.
    Each block can be a different size, up to a maximum of 4 MB, and a block blob
    can include up to 50,000 blocks. The maximum size of a block blob is therefore
    slightly more than 195 GB (4 MB X 50,000 blocks). If you are writing a block
    blob that is no more than 64 MB in size, you can upload it in its entirety with
    a single write operation; see create_blob_from_bytes.<commit_msg>Minor: comment fix for max block size<commit_after># -------------------------------------------------------------------------
# Copyright (c) Microsoft.  All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#   http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# --------------------------------------------------------------------------
from io import (
    BytesIO
)
from os import (
    path,
)

from azure.storage.common._common_conversion import (
    _encode_base64,
    _to_str,
    _int_to_str,
    _datetime_to_utc_string,
    _get_content_md5,
)
from azure.storage.common._constants import (
    SERVICE_HOST_BASE,
    DEFAULT_PROTOCOL,
)
from azure.storage.common._error import (
    _validate_not_none,
    _validate_type_bytes,
    _validate_encryption_required,
    _validate_encryption_unsupported,
    _ERROR_VALUE_NEGATIVE,
    _ERROR_VALUE_SHOULD_BE_STREAM
)
from azure.storage.common._http import HTTPRequest
from azure.storage.common._serialization import (
    _get_request_body,
    _get_data_bytes_only,
    _get_data_bytes_or_stream_only,
    _add_metadata_headers,
)
from azure.storage.common._serialization import (
    _len_plus
)
from ._deserialization import (
    _convert_xml_to_block_list,
    _parse_base_properties,
)
from ._encryption import (
    _encrypt_blob,
    _generate_blob_encryption_data,
)
from ._serialization import (
    _convert_block_list_to_xml,
    _get_path,
)
from ._upload_chunking import (
    _BlockBlobChunkUploader,
    _upload_blob_chunks,
    _upload_blob_substream_blocks,
)
from .baseblobservice import BaseBlobService
from .models import (
    _BlobTypes,
)


class BlockBlobService(BaseBlobService):
    '''
    Block blobs let you upload large blobs efficiently. Block blobs are comprised
    of blocks, each of which is identified by a block ID. You create or modify a
    block blob by writing a set of blocks and committing them by their block IDs.
    Each block can be a different size, up to a maximum of 100 MB, and a block blob
    can include up to 50,000 blocks. The maximum size of a block blob is therefore
    approximately 4.75 TB (100 MB X 50,000 blocks). If you are writing a block
    blob that is no more than 64 MB in size, you can upload it in its entirety with
    a single write operation; see create_blob_from_bytes.
{'fraction_non_alphanumeric': 0.10505270810614321, 'fraction_numerical': 0.009451108687749909, 'mean_word_length': 3.0944940476190474, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 4}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4150669', 'n_tokens_mistral': 1606, 'n_tokens_neox': 1554, 'n_words': 557}