<s> from . . _http import HTTPRequest <EOL> from . . _common_conversion import ( <EOL> _to_str , <EOL> ) <EOL> from . . _error import ( <EOL> _validate_not_none , <EOL> ) <EOL> from . . _serialization import ( <EOL> _get_request_body , <EOL> ) <EOL> from . _error import ( <EOL> _validate_entity , <EOL> ) <EOL> from . _serialization import ( <EOL> _convert_entity_to_json , <EOL> _DEFAULT_ACCEPT_HEADER , <EOL> _DEFAULT_CONTENT_TYPE_HEADER , <EOL> _DEFAULT_PREFER_HEADER , <EOL> ) <EOL> def _get_entity ( partition_key , row_key , select , accept ) : <EOL> '''<STR_LIT>''' <EOL> _validate_not_none ( '<STR_LIT>' , partition_key ) <EOL> _validate_not_none ( '<STR_LIT>' , row_key ) <EOL> _validate_not_none ( '<STR_LIT>' , accept ) <EOL> request = HTTPRequest ( ) <EOL> request . method = '<STR_LIT:GET>' <EOL> request . headers = [ ( '<STR_LIT>' , _to_str ( accept ) ) ] <EOL> request . query = [ ( '<STR_LIT>' , _to_str ( select ) ) ] <EOL> return request <EOL> def _insert_entity ( entity ) : <EOL> '''<STR_LIT>''' <EOL> _validate_entity ( entity ) <EOL> request = HTTPRequest ( ) <EOL> request . method = '<STR_LIT:POST>' <EOL> request . headers = [ _DEFAULT_CONTENT_TYPE_HEADER , <EOL> _DEFAULT_PREFER_HEADER , <EOL> _DEFAULT_ACCEPT_HEADER ] <EOL> request . body = _get_request_body ( _convert_entity_to_json ( entity ) ) <EOL> return request <EOL> def _update_entity ( entity , if_match ) : <EOL> '''<STR_LIT>''' <EOL> _validate_not_none ( '<STR_LIT>' , if_match ) <EOL> _validate_entity ( entity ) <EOL> request = HTTPRequest ( ) <EOL> request . method = '<STR_LIT>' <EOL> request . headers = [ _DEFAULT_CONTENT_TYPE_HEADER , <EOL> _DEFAULT_ACCEPT_HEADER , <EOL> ( '<STR_LIT>' , _to_str ( if_match ) ) , ] <EOL> request . body = _get_request_body ( _convert_entity_to_json ( entity ) ) <EOL> return request <EOL> def _merge_entity ( entity , if_match ) : <EOL> '''<STR_LIT>''' <EOL> _validate_not_none ( '<STR_LIT>' , if_match ) <EOL> _validate_entity ( entity ) <EOL> request = HTTPRequest ( ) <EOL> request . method = '<STR_LIT>' <EOL> request . headers = [ _DEFAULT_CONTENT_TYPE_HEADER , <EOL> _DEFAULT_ACCEPT_HEADER , <EOL> ( '<STR_LIT>' , _to_str ( if_match ) ) ] <EOL> request . body = _get_request_body ( _convert_entity_to_json ( entity ) ) <EOL> return request <EOL> def _delete_entity ( partition_key , row_key , if_match ) : <EOL> '''<STR_LIT>''' <EOL> _validate_not_none ( '<STR_LIT>' , if_match ) <EOL> _validate_not_none ( '<STR_LIT>' , partition_key ) <EOL> _validate_not_none ( '<STR_LIT>' , row_key ) <EOL> request = HTTPRequest ( ) <EOL> request . method = '<STR_LIT>' <EOL> request . headers = [ _DEFAULT_ACCEPT_HEADER , <EOL> ( '<STR_LIT>' , _to_str ( if_match ) ) ] <EOL> return request <EOL> def _insert_or_replace_entity ( entity ) : <EOL> '''<STR_LIT>''' <EOL> _validate_entity ( entity ) <EOL> request = HTTPRequest ( ) <EOL> request . method = '<STR_LIT>' <EOL> request . headers = [ _DEFAULT_CONTENT_TYPE_HEADER , <EOL> _DEFAULT_ACCEPT_HEADER ] <EOL> request . body = _get_request_body ( _convert_entity_to_json ( entity ) ) <EOL> return request <EOL> def _insert_or_merge_entity ( entity ) : <EOL> '''<STR_LIT>''' <EOL> _validate_entity ( entity ) <EOL> request = HTTPRequest ( ) <EOL> request . method = '<STR_LIT>' <EOL> request . headers = [ _DEFAULT_CONTENT_TYPE_HEADER , <EOL> _DEFAULT_ACCEPT_HEADER ] <EOL> request . body = _get_request_body ( _convert_entity_to_json ( entity ) ) <EOL> return request </s>
