repo
stringlengths
7
54
path
stringlengths
4
223
func_name
stringlengths
1
134
original_string
stringlengths
75
104k
language
stringclasses
1 value
code
stringlengths
75
104k
code_tokens
listlengths
20
28.4k
docstring
stringlengths
1
46.3k
docstring_tokens
listlengths
1
1.66k
sha
stringlengths
40
40
url
stringlengths
87
315
partition
stringclasses
1 value
summary
stringlengths
4
350
obf_code
stringlengths
7.85k
764k
dpkp/kafka-python
kafka/client.py
SimpleClient._send_consumer_aware_request
def _send_consumer_aware_request(self, group, payloads, encoder_fn, decoder_fn): """ Send a list of requests to the consumer coordinator for the group specified using the supplied encode/decode functions. As the payloads that use consumer-aware requests do not contain the group (e.g. ...
python
def _send_consumer_aware_request(self, group, payloads, encoder_fn, decoder_fn): """ Send a list of requests to the consumer coordinator for the group specified using the supplied encode/decode functions. As the payloads that use consumer-aware requests do not contain the group (e.g. ...
[ "def", "_send_consumer_aware_request", "(", "self", ",", "group", ",", "payloads", ",", "encoder_fn", ",", "decoder_fn", ")", ":", "# encoders / decoders do not maintain ordering currently", "# so we need to keep this so we can rebuild order before returning", "original_ordering", ...
Send a list of requests to the consumer coordinator for the group specified using the supplied encode/decode functions. As the payloads that use consumer-aware requests do not contain the group (e.g. OffsetFetchRequest), all payloads must be for a single group. Arguments: group...
[ "Send", "a", "list", "of", "requests", "to", "the", "consumer", "coordinator", "for", "the", "group", "specified", "using", "the", "supplied", "encode", "/", "decode", "functions", ".", "As", "the", "payloads", "that", "use", "consumer", "-", "aware", "reque...
f6a8a38937688ea2cc5dc13d3d1039493be5c9b5
https://github.com/dpkp/kafka-python/blob/f6a8a38937688ea2cc5dc13d3d1039493be5c9b5/kafka/client.py#L303-L394
train
Send a list of requests to the broker for the specified group and return the list of responses.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
dpkp/kafka-python
kafka/client.py
SimpleClient.copy
def copy(self): """ Create an inactive copy of the client object, suitable for passing to a separate thread. Note that the copied connections are not initialized, so :meth:`.reinit` must be called on the returned copy. """ _conns = self._conns self._conns...
python
def copy(self): """ Create an inactive copy of the client object, suitable for passing to a separate thread. Note that the copied connections are not initialized, so :meth:`.reinit` must be called on the returned copy. """ _conns = self._conns self._conns...
[ "def", "copy", "(", "self", ")", ":", "_conns", "=", "self", ".", "_conns", "self", ".", "_conns", "=", "{", "}", "c", "=", "copy", ".", "deepcopy", "(", "self", ")", "self", ".", "_conns", "=", "_conns", "return", "c" ]
Create an inactive copy of the client object, suitable for passing to a separate thread. Note that the copied connections are not initialized, so :meth:`.reinit` must be called on the returned copy.
[ "Create", "an", "inactive", "copy", "of", "the", "client", "object", "suitable", "for", "passing", "to", "a", "separate", "thread", "." ]
f6a8a38937688ea2cc5dc13d3d1039493be5c9b5
https://github.com/dpkp/kafka-python/blob/f6a8a38937688ea2cc5dc13d3d1039493be5c9b5/kafka/client.py#L422-L434
train
Create an inactive copy of the client object suitable for passing to a separate thread.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
dpkp/kafka-python
kafka/client.py
SimpleClient.load_metadata_for_topics
def load_metadata_for_topics(self, *topics, **kwargs): """Fetch broker and topic-partition metadata from the server. Updates internal data: broker list, topic/partition list, and topic/partition -> broker map. This method should be called after receiving any error. Note: Except...
python
def load_metadata_for_topics(self, *topics, **kwargs): """Fetch broker and topic-partition metadata from the server. Updates internal data: broker list, topic/partition list, and topic/partition -> broker map. This method should be called after receiving any error. Note: Except...
[ "def", "load_metadata_for_topics", "(", "self", ",", "*", "topics", ",", "*", "*", "kwargs", ")", ":", "if", "'ignore_leadernotavailable'", "in", "kwargs", ":", "ignore_leadernotavailable", "=", "kwargs", "[", "'ignore_leadernotavailable'", "]", "else", ":", "igno...
Fetch broker and topic-partition metadata from the server. Updates internal data: broker list, topic/partition list, and topic/partition -> broker map. This method should be called after receiving any error. Note: Exceptions *will not* be raised in a full refresh (i.e. no topic ...
[ "Fetch", "broker", "and", "topic", "-", "partition", "metadata", "from", "the", "server", "." ]
f6a8a38937688ea2cc5dc13d3d1039493be5c9b5
https://github.com/dpkp/kafka-python/blob/f6a8a38937688ea2cc5dc13d3d1039493be5c9b5/kafka/client.py#L488-L583
train
Fetch broker and topic - partition metadata for the specified topics.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
dpkp/kafka-python
kafka/client.py
SimpleClient.send_produce_request
def send_produce_request(self, payloads=(), acks=1, timeout=1000, fail_on_error=True, callback=None): """ Encode and send some ProduceRequests ProduceRequests will be grouped by (topic, partition) and then sent to a specific broker. Output is a list of respo...
python
def send_produce_request(self, payloads=(), acks=1, timeout=1000, fail_on_error=True, callback=None): """ Encode and send some ProduceRequests ProduceRequests will be grouped by (topic, partition) and then sent to a specific broker. Output is a list of respo...
[ "def", "send_produce_request", "(", "self", ",", "payloads", "=", "(", ")", ",", "acks", "=", "1", ",", "timeout", "=", "1000", ",", "fail_on_error", "=", "True", ",", "callback", "=", "None", ")", ":", "encoder", "=", "functools", ".", "partial", "(",...
Encode and send some ProduceRequests ProduceRequests will be grouped by (topic, partition) and then sent to a specific broker. Output is a list of responses in the same order as the list of payloads specified Arguments: payloads (list of ProduceRequest): produce requests to...
[ "Encode", "and", "send", "some", "ProduceRequests" ]
f6a8a38937688ea2cc5dc13d3d1039493be5c9b5
https://github.com/dpkp/kafka-python/blob/f6a8a38937688ea2cc5dc13d3d1039493be5c9b5/kafka/client.py#L599-L647
train
Sends a ProduceRequest to the broker.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
dpkp/kafka-python
kafka/client.py
SimpleClient.send_fetch_request
def send_fetch_request(self, payloads=(), fail_on_error=True, callback=None, max_wait_time=100, min_bytes=4096): """ Encode and send a FetchRequest Payloads are grouped by topic and partition so they can be pipelined to the same brokers. """ e...
python
def send_fetch_request(self, payloads=(), fail_on_error=True, callback=None, max_wait_time=100, min_bytes=4096): """ Encode and send a FetchRequest Payloads are grouped by topic and partition so they can be pipelined to the same brokers. """ e...
[ "def", "send_fetch_request", "(", "self", ",", "payloads", "=", "(", ")", ",", "fail_on_error", "=", "True", ",", "callback", "=", "None", ",", "max_wait_time", "=", "100", ",", "min_bytes", "=", "4096", ")", ":", "encoder", "=", "functools", ".", "parti...
Encode and send a FetchRequest Payloads are grouped by topic and partition so they can be pipelined to the same brokers.
[ "Encode", "and", "send", "a", "FetchRequest" ]
f6a8a38937688ea2cc5dc13d3d1039493be5c9b5
https://github.com/dpkp/kafka-python/blob/f6a8a38937688ea2cc5dc13d3d1039493be5c9b5/kafka/client.py#L649-L667
train
Send a FetchRequest to all brokers.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
davesque/django-rest-framework-simplejwt
rest_framework_simplejwt/tokens.py
Token.verify
def verify(self): """ Performs additional validation steps which were not performed when this token was decoded. This method is part of the "public" API to indicate the intention that it may be overridden in subclasses. """ # According to RFC 7519, the "exp" claim is OPT...
python
def verify(self): """ Performs additional validation steps which were not performed when this token was decoded. This method is part of the "public" API to indicate the intention that it may be overridden in subclasses. """ # According to RFC 7519, the "exp" claim is OPT...
[ "def", "verify", "(", "self", ")", ":", "# According to RFC 7519, the \"exp\" claim is OPTIONAL", "# (https://tools.ietf.org/html/rfc7519#section-4.1.4). As a more", "# correct behavior for authorization tokens, we require an \"exp\"", "# claim. We don't want any zombie tokens walking around.", ...
Performs additional validation steps which were not performed when this token was decoded. This method is part of the "public" API to indicate the intention that it may be overridden in subclasses.
[ "Performs", "additional", "validation", "steps", "which", "were", "not", "performed", "when", "this", "token", "was", "decoded", ".", "This", "method", "is", "part", "of", "the", "public", "API", "to", "indicate", "the", "intention", "that", "it", "may", "be...
d6084c595aefbf97865d15254b56017e710e8e47
https://github.com/davesque/django-rest-framework-simplejwt/blob/d6084c595aefbf97865d15254b56017e710e8e47/rest_framework_simplejwt/tokens.py#L84-L100
train
Verifies that the token is valid and that the token type and exp claims are present.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
davesque/django-rest-framework-simplejwt
rest_framework_simplejwt/tokens.py
Token.verify_token_type
def verify_token_type(self): """ Ensures that the token type claim is present and has the correct value. """ try: token_type = self.payload[api_settings.TOKEN_TYPE_CLAIM] except KeyError: raise TokenError(_('Token has no type')) if self.token_type...
python
def verify_token_type(self): """ Ensures that the token type claim is present and has the correct value. """ try: token_type = self.payload[api_settings.TOKEN_TYPE_CLAIM] except KeyError: raise TokenError(_('Token has no type')) if self.token_type...
[ "def", "verify_token_type", "(", "self", ")", ":", "try", ":", "token_type", "=", "self", ".", "payload", "[", "api_settings", ".", "TOKEN_TYPE_CLAIM", "]", "except", "KeyError", ":", "raise", "TokenError", "(", "_", "(", "'Token has no type'", ")", ")", "if...
Ensures that the token type claim is present and has the correct value.
[ "Ensures", "that", "the", "token", "type", "claim", "is", "present", "and", "has", "the", "correct", "value", "." ]
d6084c595aefbf97865d15254b56017e710e8e47
https://github.com/davesque/django-rest-framework-simplejwt/blob/d6084c595aefbf97865d15254b56017e710e8e47/rest_framework_simplejwt/tokens.py#L102-L112
train
Verifies that the token type claim is present and has the correct value.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
davesque/django-rest-framework-simplejwt
rest_framework_simplejwt/tokens.py
Token.set_exp
def set_exp(self, claim='exp', from_time=None, lifetime=None): """ Updates the expiration time of a token. """ if from_time is None: from_time = self.current_time if lifetime is None: lifetime = self.lifetime self.payload[claim] = datetime_to_epo...
python
def set_exp(self, claim='exp', from_time=None, lifetime=None): """ Updates the expiration time of a token. """ if from_time is None: from_time = self.current_time if lifetime is None: lifetime = self.lifetime self.payload[claim] = datetime_to_epo...
[ "def", "set_exp", "(", "self", ",", "claim", "=", "'exp'", ",", "from_time", "=", "None", ",", "lifetime", "=", "None", ")", ":", "if", "from_time", "is", "None", ":", "from_time", "=", "self", ".", "current_time", "if", "lifetime", "is", "None", ":", ...
Updates the expiration time of a token.
[ "Updates", "the", "expiration", "time", "of", "a", "token", "." ]
d6084c595aefbf97865d15254b56017e710e8e47
https://github.com/davesque/django-rest-framework-simplejwt/blob/d6084c595aefbf97865d15254b56017e710e8e47/rest_framework_simplejwt/tokens.py#L125-L135
train
Updates the expiration time of a token.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
davesque/django-rest-framework-simplejwt
rest_framework_simplejwt/tokens.py
Token.check_exp
def check_exp(self, claim='exp', current_time=None): """ Checks whether a timestamp value in the given claim has passed (since the given datetime value in `current_time`). Raises a TokenError with a user-facing error message if so. """ if current_time is None: ...
python
def check_exp(self, claim='exp', current_time=None): """ Checks whether a timestamp value in the given claim has passed (since the given datetime value in `current_time`). Raises a TokenError with a user-facing error message if so. """ if current_time is None: ...
[ "def", "check_exp", "(", "self", ",", "claim", "=", "'exp'", ",", "current_time", "=", "None", ")", ":", "if", "current_time", "is", "None", ":", "current_time", "=", "self", ".", "current_time", "try", ":", "claim_value", "=", "self", ".", "payload", "[...
Checks whether a timestamp value in the given claim has passed (since the given datetime value in `current_time`). Raises a TokenError with a user-facing error message if so.
[ "Checks", "whether", "a", "timestamp", "value", "in", "the", "given", "claim", "has", "passed", "(", "since", "the", "given", "datetime", "value", "in", "current_time", ")", ".", "Raises", "a", "TokenError", "with", "a", "user", "-", "facing", "error", "me...
d6084c595aefbf97865d15254b56017e710e8e47
https://github.com/davesque/django-rest-framework-simplejwt/blob/d6084c595aefbf97865d15254b56017e710e8e47/rest_framework_simplejwt/tokens.py#L137-L153
train
Checks whether a timestamp value in the given claim has passed since the given datetime value in current_time. Raises a TokenError if so.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
davesque/django-rest-framework-simplejwt
rest_framework_simplejwt/tokens.py
Token.for_user
def for_user(cls, user): """ Returns an authorization token for the given user that will be provided after authenticating the user's credentials. """ user_id = getattr(user, api_settings.USER_ID_FIELD) if not isinstance(user_id, int): user_id = str(user_id) ...
python
def for_user(cls, user): """ Returns an authorization token for the given user that will be provided after authenticating the user's credentials. """ user_id = getattr(user, api_settings.USER_ID_FIELD) if not isinstance(user_id, int): user_id = str(user_id) ...
[ "def", "for_user", "(", "cls", ",", "user", ")", ":", "user_id", "=", "getattr", "(", "user", ",", "api_settings", ".", "USER_ID_FIELD", ")", "if", "not", "isinstance", "(", "user_id", ",", "int", ")", ":", "user_id", "=", "str", "(", "user_id", ")", ...
Returns an authorization token for the given user that will be provided after authenticating the user's credentials.
[ "Returns", "an", "authorization", "token", "for", "the", "given", "user", "that", "will", "be", "provided", "after", "authenticating", "the", "user", "s", "credentials", "." ]
d6084c595aefbf97865d15254b56017e710e8e47
https://github.com/davesque/django-rest-framework-simplejwt/blob/d6084c595aefbf97865d15254b56017e710e8e47/rest_framework_simplejwt/tokens.py#L156-L168
train
Returns an authorization token for the given user.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
davesque/django-rest-framework-simplejwt
rest_framework_simplejwt/tokens.py
RefreshToken.access_token
def access_token(self): """ Returns an access token created from this refresh token. Copies all claims present in this refresh token to the new access token except those claims listed in the `no_copy_claims` attribute. """ access = AccessToken() # Use instantiat...
python
def access_token(self): """ Returns an access token created from this refresh token. Copies all claims present in this refresh token to the new access token except those claims listed in the `no_copy_claims` attribute. """ access = AccessToken() # Use instantiat...
[ "def", "access_token", "(", "self", ")", ":", "access", "=", "AccessToken", "(", ")", "# Use instantiation time of refresh token as relative timestamp for", "# access token \"exp\" claim. This ensures that both a refresh and", "# access token expire relative to the same time if they are c...
Returns an access token created from this refresh token. Copies all claims present in this refresh token to the new access token except those claims listed in the `no_copy_claims` attribute.
[ "Returns", "an", "access", "token", "created", "from", "this", "refresh", "token", ".", "Copies", "all", "claims", "present", "in", "this", "refresh", "token", "to", "the", "new", "access", "token", "except", "those", "claims", "listed", "in", "the", "no_cop...
d6084c595aefbf97865d15254b56017e710e8e47
https://github.com/davesque/django-rest-framework-simplejwt/blob/d6084c595aefbf97865d15254b56017e710e8e47/rest_framework_simplejwt/tokens.py#L266-L286
train
Returns an access token created from this refresh token.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
davesque/django-rest-framework-simplejwt
rest_framework_simplejwt/backends.py
TokenBackend.encode
def encode(self, payload): """ Returns an encoded token for the given payload dictionary. """ token = jwt.encode(payload, self.signing_key, algorithm=self.algorithm) return token.decode('utf-8')
python
def encode(self, payload): """ Returns an encoded token for the given payload dictionary. """ token = jwt.encode(payload, self.signing_key, algorithm=self.algorithm) return token.decode('utf-8')
[ "def", "encode", "(", "self", ",", "payload", ")", ":", "token", "=", "jwt", ".", "encode", "(", "payload", ",", "self", ".", "signing_key", ",", "algorithm", "=", "self", ".", "algorithm", ")", "return", "token", ".", "decode", "(", "'utf-8'", ")" ]
Returns an encoded token for the given payload dictionary.
[ "Returns", "an", "encoded", "token", "for", "the", "given", "payload", "dictionary", "." ]
d6084c595aefbf97865d15254b56017e710e8e47
https://github.com/davesque/django-rest-framework-simplejwt/blob/d6084c595aefbf97865d15254b56017e710e8e47/rest_framework_simplejwt/backends.py#L30-L35
train
Returns an encoded token for the given payload dictionary.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
davesque/django-rest-framework-simplejwt
rest_framework_simplejwt/backends.py
TokenBackend.decode
def decode(self, token, verify=True): """ Performs a validation of the given token and returns its payload dictionary. Raises a `TokenBackendError` if the token is malformed, if its signature check fails, or if its 'exp' claim indicates it has expired. """ try: ...
python
def decode(self, token, verify=True): """ Performs a validation of the given token and returns its payload dictionary. Raises a `TokenBackendError` if the token is malformed, if its signature check fails, or if its 'exp' claim indicates it has expired. """ try: ...
[ "def", "decode", "(", "self", ",", "token", ",", "verify", "=", "True", ")", ":", "try", ":", "return", "jwt", ".", "decode", "(", "token", ",", "self", ".", "verifying_key", ",", "algorithms", "=", "[", "self", ".", "algorithm", "]", ",", "verify", ...
Performs a validation of the given token and returns its payload dictionary. Raises a `TokenBackendError` if the token is malformed, if its signature check fails, or if its 'exp' claim indicates it has expired.
[ "Performs", "a", "validation", "of", "the", "given", "token", "and", "returns", "its", "payload", "dictionary", "." ]
d6084c595aefbf97865d15254b56017e710e8e47
https://github.com/davesque/django-rest-framework-simplejwt/blob/d6084c595aefbf97865d15254b56017e710e8e47/rest_framework_simplejwt/backends.py#L37-L48
train
Decodes a given token and returns its payload dictionary.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
davesque/django-rest-framework-simplejwt
rest_framework_simplejwt/authentication.py
JWTAuthentication.get_header
def get_header(self, request): """ Extracts the header containing the JSON web token from the given request. """ header = request.META.get('HTTP_AUTHORIZATION') if isinstance(header, str): # Work around django test client oddness header = header.e...
python
def get_header(self, request): """ Extracts the header containing the JSON web token from the given request. """ header = request.META.get('HTTP_AUTHORIZATION') if isinstance(header, str): # Work around django test client oddness header = header.e...
[ "def", "get_header", "(", "self", ",", "request", ")", ":", "header", "=", "request", ".", "META", ".", "get", "(", "'HTTP_AUTHORIZATION'", ")", "if", "isinstance", "(", "header", ",", "str", ")", ":", "# Work around django test client oddness", "header", "=",...
Extracts the header containing the JSON web token from the given request.
[ "Extracts", "the", "header", "containing", "the", "JSON", "web", "token", "from", "the", "given", "request", "." ]
d6084c595aefbf97865d15254b56017e710e8e47
https://github.com/davesque/django-rest-framework-simplejwt/blob/d6084c595aefbf97865d15254b56017e710e8e47/rest_framework_simplejwt/authentication.py#L46-L57
train
Extracts the header containing the JSON web token from the given request.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
davesque/django-rest-framework-simplejwt
rest_framework_simplejwt/authentication.py
JWTAuthentication.get_raw_token
def get_raw_token(self, header): """ Extracts an unvalidated JSON web token from the given "Authorization" header value. """ parts = header.split() if len(parts) == 0: # Empty AUTHORIZATION header sent return None if parts[0] not in AUTH_...
python
def get_raw_token(self, header): """ Extracts an unvalidated JSON web token from the given "Authorization" header value. """ parts = header.split() if len(parts) == 0: # Empty AUTHORIZATION header sent return None if parts[0] not in AUTH_...
[ "def", "get_raw_token", "(", "self", ",", "header", ")", ":", "parts", "=", "header", ".", "split", "(", ")", "if", "len", "(", "parts", ")", "==", "0", ":", "# Empty AUTHORIZATION header sent", "return", "None", "if", "parts", "[", "0", "]", "not", "i...
Extracts an unvalidated JSON web token from the given "Authorization" header value.
[ "Extracts", "an", "unvalidated", "JSON", "web", "token", "from", "the", "given", "Authorization", "header", "value", "." ]
d6084c595aefbf97865d15254b56017e710e8e47
https://github.com/davesque/django-rest-framework-simplejwt/blob/d6084c595aefbf97865d15254b56017e710e8e47/rest_framework_simplejwt/authentication.py#L59-L80
train
Extracts an unvalidated JSON web token from the given Authorization header value.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
davesque/django-rest-framework-simplejwt
rest_framework_simplejwt/authentication.py
JWTAuthentication.get_validated_token
def get_validated_token(self, raw_token): """ Validates an encoded JSON web token and returns a validated token wrapper object. """ messages = [] for AuthToken in api_settings.AUTH_TOKEN_CLASSES: try: return AuthToken(raw_token) exc...
python
def get_validated_token(self, raw_token): """ Validates an encoded JSON web token and returns a validated token wrapper object. """ messages = [] for AuthToken in api_settings.AUTH_TOKEN_CLASSES: try: return AuthToken(raw_token) exc...
[ "def", "get_validated_token", "(", "self", ",", "raw_token", ")", ":", "messages", "=", "[", "]", "for", "AuthToken", "in", "api_settings", ".", "AUTH_TOKEN_CLASSES", ":", "try", ":", "return", "AuthToken", "(", "raw_token", ")", "except", "TokenError", "as", ...
Validates an encoded JSON web token and returns a validated token wrapper object.
[ "Validates", "an", "encoded", "JSON", "web", "token", "and", "returns", "a", "validated", "token", "wrapper", "object", "." ]
d6084c595aefbf97865d15254b56017e710e8e47
https://github.com/davesque/django-rest-framework-simplejwt/blob/d6084c595aefbf97865d15254b56017e710e8e47/rest_framework_simplejwt/authentication.py#L82-L99
train
Validates an encoded JSON web token and returns a validated token wrapper object.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
davesque/django-rest-framework-simplejwt
rest_framework_simplejwt/authentication.py
JWTAuthentication.get_user
def get_user(self, validated_token): """ Attempts to find and return a user using the given validated token. """ try: user_id = validated_token[api_settings.USER_ID_CLAIM] except KeyError: raise InvalidToken(_('Token contained no recognizable user identifi...
python
def get_user(self, validated_token): """ Attempts to find and return a user using the given validated token. """ try: user_id = validated_token[api_settings.USER_ID_CLAIM] except KeyError: raise InvalidToken(_('Token contained no recognizable user identifi...
[ "def", "get_user", "(", "self", ",", "validated_token", ")", ":", "try", ":", "user_id", "=", "validated_token", "[", "api_settings", ".", "USER_ID_CLAIM", "]", "except", "KeyError", ":", "raise", "InvalidToken", "(", "_", "(", "'Token contained no recognizable us...
Attempts to find and return a user using the given validated token.
[ "Attempts", "to", "find", "and", "return", "a", "user", "using", "the", "given", "validated", "token", "." ]
d6084c595aefbf97865d15254b56017e710e8e47
https://github.com/davesque/django-rest-framework-simplejwt/blob/d6084c595aefbf97865d15254b56017e710e8e47/rest_framework_simplejwt/authentication.py#L101-L118
train
Attempts to find and return a user using the given validated token.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
davesque/django-rest-framework-simplejwt
rest_framework_simplejwt/authentication.py
JWTTokenUserAuthentication.get_user
def get_user(self, validated_token): """ Returns a stateless user object which is backed by the given validated token. """ if api_settings.USER_ID_CLAIM not in validated_token: # The TokenUser class assumes tokens will have a recognizable user # identifier...
python
def get_user(self, validated_token): """ Returns a stateless user object which is backed by the given validated token. """ if api_settings.USER_ID_CLAIM not in validated_token: # The TokenUser class assumes tokens will have a recognizable user # identifier...
[ "def", "get_user", "(", "self", ",", "validated_token", ")", ":", "if", "api_settings", ".", "USER_ID_CLAIM", "not", "in", "validated_token", ":", "# The TokenUser class assumes tokens will have a recognizable user", "# identifier claim.", "raise", "InvalidToken", "(", "_",...
Returns a stateless user object which is backed by the given validated token.
[ "Returns", "a", "stateless", "user", "object", "which", "is", "backed", "by", "the", "given", "validated", "token", "." ]
d6084c595aefbf97865d15254b56017e710e8e47
https://github.com/davesque/django-rest-framework-simplejwt/blob/d6084c595aefbf97865d15254b56017e710e8e47/rest_framework_simplejwt/authentication.py#L122-L132
train
Returns a stateless user object which is backed by the given validated_token.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
python-openxml/python-docx
docx/parts/image.py
ImagePart.default_cx
def default_cx(self): """ Native width of this image, calculated from its width in pixels and horizontal dots per inch (dpi). """ px_width = self.image.px_width horz_dpi = self.image.horz_dpi width_in_inches = px_width / horz_dpi return Inches(width_in_inc...
python
def default_cx(self): """ Native width of this image, calculated from its width in pixels and horizontal dots per inch (dpi). """ px_width = self.image.px_width horz_dpi = self.image.horz_dpi width_in_inches = px_width / horz_dpi return Inches(width_in_inc...
[ "def", "default_cx", "(", "self", ")", ":", "px_width", "=", "self", ".", "image", ".", "px_width", "horz_dpi", "=", "self", ".", "image", ".", "horz_dpi", "width_in_inches", "=", "px_width", "/", "horz_dpi", "return", "Inches", "(", "width_in_inches", ")" ]
Native width of this image, calculated from its width in pixels and horizontal dots per inch (dpi).
[ "Native", "width", "of", "this", "image", "calculated", "from", "its", "width", "in", "pixels", "and", "horizontal", "dots", "per", "inch", "(", "dpi", ")", "." ]
6756f6cd145511d3eb6d1d188beea391b1ddfd53
https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/parts/image.py#L28-L36
train
Default width of this image in inches.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
python-openxml/python-docx
docx/parts/image.py
ImagePart.default_cy
def default_cy(self): """ Native height of this image, calculated from its height in pixels and vertical dots per inch (dpi). """ px_height = self.image.px_height horz_dpi = self.image.horz_dpi height_in_emu = 914400 * px_height / horz_dpi return Emu(heigh...
python
def default_cy(self): """ Native height of this image, calculated from its height in pixels and vertical dots per inch (dpi). """ px_height = self.image.px_height horz_dpi = self.image.horz_dpi height_in_emu = 914400 * px_height / horz_dpi return Emu(heigh...
[ "def", "default_cy", "(", "self", ")", ":", "px_height", "=", "self", ".", "image", ".", "px_height", "horz_dpi", "=", "self", ".", "image", ".", "horz_dpi", "height_in_emu", "=", "914400", "*", "px_height", "/", "horz_dpi", "return", "Emu", "(", "height_i...
Native height of this image, calculated from its height in pixels and vertical dots per inch (dpi).
[ "Native", "height", "of", "this", "image", "calculated", "from", "its", "height", "in", "pixels", "and", "vertical", "dots", "per", "inch", "(", "dpi", ")", "." ]
6756f6cd145511d3eb6d1d188beea391b1ddfd53
https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/parts/image.py#L39-L47
train
Default height of this image in pixels and the vertical dots per inch.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
python-openxml/python-docx
docx/parts/image.py
ImagePart.filename
def filename(self): """ Filename from which this image part was originally created. A generic name, e.g. 'image.png', is substituted if no name is available, for example when the image was loaded from an unnamed stream. In that case a default extension is applied based on the det...
python
def filename(self): """ Filename from which this image part was originally created. A generic name, e.g. 'image.png', is substituted if no name is available, for example when the image was loaded from an unnamed stream. In that case a default extension is applied based on the det...
[ "def", "filename", "(", "self", ")", ":", "if", "self", ".", "_image", "is", "not", "None", ":", "return", "self", ".", "_image", ".", "filename", "return", "'image.%s'", "%", "self", ".", "partname", ".", "ext" ]
Filename from which this image part was originally created. A generic name, e.g. 'image.png', is substituted if no name is available, for example when the image was loaded from an unnamed stream. In that case a default extension is applied based on the detected MIME type of the image.
[ "Filename", "from", "which", "this", "image", "part", "was", "originally", "created", ".", "A", "generic", "name", "e", ".", "g", ".", "image", ".", "png", "is", "substituted", "if", "no", "name", "is", "available", "for", "example", "when", "the", "imag...
6756f6cd145511d3eb6d1d188beea391b1ddfd53
https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/parts/image.py#L50-L60
train
Returns the name of the image part from which this image part was originally created.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
python-openxml/python-docx
docx/parts/image.py
ImagePart.from_image
def from_image(cls, image, partname): """ Return an |ImagePart| instance newly created from *image* and assigned *partname*. """ return ImagePart(partname, image.content_type, image.blob, image)
python
def from_image(cls, image, partname): """ Return an |ImagePart| instance newly created from *image* and assigned *partname*. """ return ImagePart(partname, image.content_type, image.blob, image)
[ "def", "from_image", "(", "cls", ",", "image", ",", "partname", ")", ":", "return", "ImagePart", "(", "partname", ",", "image", ".", "content_type", ",", "image", ".", "blob", ",", "image", ")" ]
Return an |ImagePart| instance newly created from *image* and assigned *partname*.
[ "Return", "an", "|ImagePart|", "instance", "newly", "created", "from", "*", "image", "*", "and", "assigned", "*", "partname", "*", "." ]
6756f6cd145511d3eb6d1d188beea391b1ddfd53
https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/parts/image.py#L63-L68
train
Return an |ImagePart| instance created from image and partname.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
python-openxml/python-docx
docx/parts/image.py
ImagePart.load
def load(cls, partname, content_type, blob, package): """ Called by ``docx.opc.package.PartFactory`` to load an image part from a package being opened by ``Document(...)`` call. """ return cls(partname, content_type, blob)
python
def load(cls, partname, content_type, blob, package): """ Called by ``docx.opc.package.PartFactory`` to load an image part from a package being opened by ``Document(...)`` call. """ return cls(partname, content_type, blob)
[ "def", "load", "(", "cls", ",", "partname", ",", "content_type", ",", "blob", ",", "package", ")", ":", "return", "cls", "(", "partname", ",", "content_type", ",", "blob", ")" ]
Called by ``docx.opc.package.PartFactory`` to load an image part from a package being opened by ``Document(...)`` call.
[ "Called", "by", "docx", ".", "opc", ".", "package", ".", "PartFactory", "to", "load", "an", "image", "part", "from", "a", "package", "being", "opened", "by", "Document", "(", "...", ")", "call", "." ]
6756f6cd145511d3eb6d1d188beea391b1ddfd53
https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/parts/image.py#L77-L82
train
Load an image part from a file.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
python-openxml/python-docx
docx/text/tabstops.py
TabStops.add_tab_stop
def add_tab_stop(self, position, alignment=WD_TAB_ALIGNMENT.LEFT, leader=WD_TAB_LEADER.SPACES): """ Add a new tab stop at *position*, a |Length| object specifying the location of the tab stop relative to the paragraph edge. A negative *position* value is valid and ap...
python
def add_tab_stop(self, position, alignment=WD_TAB_ALIGNMENT.LEFT, leader=WD_TAB_LEADER.SPACES): """ Add a new tab stop at *position*, a |Length| object specifying the location of the tab stop relative to the paragraph edge. A negative *position* value is valid and ap...
[ "def", "add_tab_stop", "(", "self", ",", "position", ",", "alignment", "=", "WD_TAB_ALIGNMENT", ".", "LEFT", ",", "leader", "=", "WD_TAB_LEADER", ".", "SPACES", ")", ":", "tabs", "=", "self", ".", "_pPr", ".", "get_or_add_tabs", "(", ")", "tab", "=", "ta...
Add a new tab stop at *position*, a |Length| object specifying the location of the tab stop relative to the paragraph edge. A negative *position* value is valid and appears in hanging indentation. Tab alignment defaults to left, but may be specified by passing a member of the :ref:`WdTab...
[ "Add", "a", "new", "tab", "stop", "at", "*", "position", "*", "a", "|Length|", "object", "specifying", "the", "location", "of", "the", "tab", "stop", "relative", "to", "the", "paragraph", "edge", ".", "A", "negative", "*", "position", "*", "value", "is",...
6756f6cd145511d3eb6d1d188beea391b1ddfd53
https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/text/tabstops.py#L69-L82
train
Adds a new tab stop at position.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
python-openxml/python-docx
docx/oxml/text/font.py
CT_RPr.style
def style(self, style): """ Set val attribute of <w:rStyle> child element to *style*, adding a new element if necessary. If *style* is |None|, remove the <w:rStyle> element if present. """ if style is None: self._remove_rStyle() elif self.rStyle is Non...
python
def style(self, style): """ Set val attribute of <w:rStyle> child element to *style*, adding a new element if necessary. If *style* is |None|, remove the <w:rStyle> element if present. """ if style is None: self._remove_rStyle() elif self.rStyle is Non...
[ "def", "style", "(", "self", ",", "style", ")", ":", "if", "style", "is", "None", ":", "self", ".", "_remove_rStyle", "(", ")", "elif", "self", ".", "rStyle", "is", "None", ":", "self", ".", "_add_rStyle", "(", "val", "=", "style", ")", "else", ":"...
Set val attribute of <w:rStyle> child element to *style*, adding a new element if necessary. If *style* is |None|, remove the <w:rStyle> element if present.
[ "Set", "val", "attribute", "of", "<w", ":", "rStyle", ">", "child", "element", "to", "*", "style", "*", "adding", "a", "new", "element", "if", "necessary", ".", "If", "*", "style", "*", "is", "|None|", "remove", "the", "<w", ":", "rStyle", ">", "elem...
6756f6cd145511d3eb6d1d188beea391b1ddfd53
https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/oxml/text/font.py#L170-L181
train
Set val attribute of a element to style.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
python-openxml/python-docx
docx/oxml/text/font.py
CT_RPr._get_bool_val
def _get_bool_val(self, name): """ Return the value of the boolean child element having *name*, e.g. 'b', 'i', and 'smallCaps'. """ element = getattr(self, name) if element is None: return None return element.val
python
def _get_bool_val(self, name): """ Return the value of the boolean child element having *name*, e.g. 'b', 'i', and 'smallCaps'. """ element = getattr(self, name) if element is None: return None return element.val
[ "def", "_get_bool_val", "(", "self", ",", "name", ")", ":", "element", "=", "getattr", "(", "self", ",", "name", ")", "if", "element", "is", "None", ":", "return", "None", "return", "element", ".", "val" ]
Return the value of the boolean child element having *name*, e.g. 'b', 'i', and 'smallCaps'.
[ "Return", "the", "value", "of", "the", "boolean", "child", "element", "having", "*", "name", "*", "e", ".", "g", ".", "b", "i", "and", "smallCaps", "." ]
6756f6cd145511d3eb6d1d188beea391b1ddfd53
https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/oxml/text/font.py#L267-L275
train
Get the value of the boolean child element having name name. e. g. c1 c2 c3 c4 c5 c6 c7 c9 c9
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
python-openxml/python-docx
docx/oxml/text/font.py
CT_Underline.val
def val(self): """ The underline type corresponding to the ``w:val`` attribute value. """ val = self.get(qn('w:val')) underline = WD_UNDERLINE.from_xml(val) if underline == WD_UNDERLINE.SINGLE: return True if underline == WD_UNDERLINE.NONE: ...
python
def val(self): """ The underline type corresponding to the ``w:val`` attribute value. """ val = self.get(qn('w:val')) underline = WD_UNDERLINE.from_xml(val) if underline == WD_UNDERLINE.SINGLE: return True if underline == WD_UNDERLINE.NONE: ...
[ "def", "val", "(", "self", ")", ":", "val", "=", "self", ".", "get", "(", "qn", "(", "'w:val'", ")", ")", "underline", "=", "WD_UNDERLINE", ".", "from_xml", "(", "val", ")", "if", "underline", "==", "WD_UNDERLINE", ".", "SINGLE", ":", "return", "True...
The underline type corresponding to the ``w:val`` attribute value.
[ "The", "underline", "type", "corresponding", "to", "the", "w", ":", "val", "attribute", "value", "." ]
6756f6cd145511d3eb6d1d188beea391b1ddfd53
https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/oxml/text/font.py#L290-L300
train
Return the value of the w : val attribute.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
python-openxml/python-docx
docx/parts/hdrftr.py
FooterPart.new
def new(cls, package): """Return newly created footer part.""" partname = package.next_partname("/word/footer%d.xml") content_type = CT.WML_FOOTER element = parse_xml(cls._default_footer_xml()) return cls(partname, content_type, element, package)
python
def new(cls, package): """Return newly created footer part.""" partname = package.next_partname("/word/footer%d.xml") content_type = CT.WML_FOOTER element = parse_xml(cls._default_footer_xml()) return cls(partname, content_type, element, package)
[ "def", "new", "(", "cls", ",", "package", ")", ":", "partname", "=", "package", ".", "next_partname", "(", "\"/word/footer%d.xml\"", ")", "content_type", "=", "CT", ".", "WML_FOOTER", "element", "=", "parse_xml", "(", "cls", ".", "_default_footer_xml", "(", ...
Return newly created footer part.
[ "Return", "newly", "created", "footer", "part", "." ]
6756f6cd145511d3eb6d1d188beea391b1ddfd53
https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/parts/hdrftr.py#L18-L23
train
Return newly created footer part.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
python-openxml/python-docx
docx/parts/hdrftr.py
HeaderPart.new
def new(cls, package): """Return newly created header part.""" partname = package.next_partname("/word/header%d.xml") content_type = CT.WML_HEADER element = parse_xml(cls._default_header_xml()) return cls(partname, content_type, element, package)
python
def new(cls, package): """Return newly created header part.""" partname = package.next_partname("/word/header%d.xml") content_type = CT.WML_HEADER element = parse_xml(cls._default_header_xml()) return cls(partname, content_type, element, package)
[ "def", "new", "(", "cls", ",", "package", ")", ":", "partname", "=", "package", ".", "next_partname", "(", "\"/word/header%d.xml\"", ")", "content_type", "=", "CT", ".", "WML_HEADER", "element", "=", "parse_xml", "(", "cls", ".", "_default_header_xml", "(", ...
Return newly created header part.
[ "Return", "newly", "created", "header", "part", "." ]
6756f6cd145511d3eb6d1d188beea391b1ddfd53
https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/parts/hdrftr.py#L40-L45
train
Return newly created header part.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
python-openxml/python-docx
docx/parts/styles.py
StylesPart.default
def default(cls, package): """ Return a newly created styles part, containing a default set of elements. """ partname = PackURI('/word/styles.xml') content_type = CT.WML_STYLES element = parse_xml(cls._default_styles_xml()) return cls(partname, content_typ...
python
def default(cls, package): """ Return a newly created styles part, containing a default set of elements. """ partname = PackURI('/word/styles.xml') content_type = CT.WML_STYLES element = parse_xml(cls._default_styles_xml()) return cls(partname, content_typ...
[ "def", "default", "(", "cls", ",", "package", ")", ":", "partname", "=", "PackURI", "(", "'/word/styles.xml'", ")", "content_type", "=", "CT", ".", "WML_STYLES", "element", "=", "parse_xml", "(", "cls", ".", "_default_styles_xml", "(", ")", ")", "return", ...
Return a newly created styles part, containing a default set of elements.
[ "Return", "a", "newly", "created", "styles", "part", "containing", "a", "default", "set", "of", "elements", "." ]
6756f6cd145511d3eb6d1d188beea391b1ddfd53
https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/parts/styles.py#L26-L34
train
Return a newly created styles part containing a default set of ArcGIS elements.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
python-openxml/python-docx
docx/parts/styles.py
StylesPart._default_styles_xml
def _default_styles_xml(cls): """ Return a bytestream containing XML for a default styles part. """ path = os.path.join( os.path.split(__file__)[0], '..', 'templates', 'default-styles.xml' ) with open(path, 'rb') as f: xml_bytes = f.rea...
python
def _default_styles_xml(cls): """ Return a bytestream containing XML for a default styles part. """ path = os.path.join( os.path.split(__file__)[0], '..', 'templates', 'default-styles.xml' ) with open(path, 'rb') as f: xml_bytes = f.rea...
[ "def", "_default_styles_xml", "(", "cls", ")", ":", "path", "=", "os", ".", "path", ".", "join", "(", "os", ".", "path", ".", "split", "(", "__file__", ")", "[", "0", "]", ",", "'..'", ",", "'templates'", ",", "'default-styles.xml'", ")", "with", "op...
Return a bytestream containing XML for a default styles part.
[ "Return", "a", "bytestream", "containing", "XML", "for", "a", "default", "styles", "part", "." ]
6756f6cd145511d3eb6d1d188beea391b1ddfd53
https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/parts/styles.py#L45-L55
train
Return a bytestream containing XML for a default styles part.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
python-openxml/python-docx
docx/oxml/section.py
CT_SectPr.add_footerReference
def add_footerReference(self, type_, rId): """Return newly added CT_HdrFtrRef element of *type_* with *rId*. The element tag is `w:footerReference`. """ footerReference = self._add_footerReference() footerReference.type_ = type_ footerReference.rId = rId return f...
python
def add_footerReference(self, type_, rId): """Return newly added CT_HdrFtrRef element of *type_* with *rId*. The element tag is `w:footerReference`. """ footerReference = self._add_footerReference() footerReference.type_ = type_ footerReference.rId = rId return f...
[ "def", "add_footerReference", "(", "self", ",", "type_", ",", "rId", ")", ":", "footerReference", "=", "self", ".", "_add_footerReference", "(", ")", "footerReference", ".", "type_", "=", "type_", "footerReference", ".", "rId", "=", "rId", "return", "footerRef...
Return newly added CT_HdrFtrRef element of *type_* with *rId*. The element tag is `w:footerReference`.
[ "Return", "newly", "added", "CT_HdrFtrRef", "element", "of", "*", "type_", "*", "with", "*", "rId", "*", "." ]
6756f6cd145511d3eb6d1d188beea391b1ddfd53
https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/oxml/section.py#L75-L83
train
Add a CT_HdrFtrRef element of type_ with rId.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
python-openxml/python-docx
docx/oxml/section.py
CT_SectPr.add_headerReference
def add_headerReference(self, type_, rId): """Return newly added CT_HdrFtrRef element of *type_* with *rId*. The element tag is `w:headerReference`. """ headerReference = self._add_headerReference() headerReference.type_ = type_ headerReference.rId = rId return h...
python
def add_headerReference(self, type_, rId): """Return newly added CT_HdrFtrRef element of *type_* with *rId*. The element tag is `w:headerReference`. """ headerReference = self._add_headerReference() headerReference.type_ = type_ headerReference.rId = rId return h...
[ "def", "add_headerReference", "(", "self", ",", "type_", ",", "rId", ")", ":", "headerReference", "=", "self", ".", "_add_headerReference", "(", ")", "headerReference", ".", "type_", "=", "type_", "headerReference", ".", "rId", "=", "rId", "return", "headerRef...
Return newly added CT_HdrFtrRef element of *type_* with *rId*. The element tag is `w:headerReference`.
[ "Return", "newly", "added", "CT_HdrFtrRef", "element", "of", "*", "type_", "*", "with", "*", "rId", "*", "." ]
6756f6cd145511d3eb6d1d188beea391b1ddfd53
https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/oxml/section.py#L85-L93
train
Add a CT_HdrFtrRef element of type_ with rId.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
python-openxml/python-docx
docx/oxml/section.py
CT_SectPr.get_footerReference
def get_footerReference(self, type_): """Return footerReference element of *type_* or None if not present.""" path = "./w:footerReference[@w:type='%s']" % WD_HEADER_FOOTER.to_xml(type_) footerReferences = self.xpath(path) if not footerReferences: return None return fo...
python
def get_footerReference(self, type_): """Return footerReference element of *type_* or None if not present.""" path = "./w:footerReference[@w:type='%s']" % WD_HEADER_FOOTER.to_xml(type_) footerReferences = self.xpath(path) if not footerReferences: return None return fo...
[ "def", "get_footerReference", "(", "self", ",", "type_", ")", ":", "path", "=", "\"./w:footerReference[@w:type='%s']\"", "%", "WD_HEADER_FOOTER", ".", "to_xml", "(", "type_", ")", "footerReferences", "=", "self", ".", "xpath", "(", "path", ")", "if", "not", "f...
Return footerReference element of *type_* or None if not present.
[ "Return", "footerReference", "element", "of", "*", "type_", "*", "or", "None", "if", "not", "present", "." ]
6756f6cd145511d3eb6d1d188beea391b1ddfd53
https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/oxml/section.py#L139-L145
train
Return footerReference element of type_ * or None.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
python-openxml/python-docx
docx/oxml/section.py
CT_SectPr.get_headerReference
def get_headerReference(self, type_): """Return headerReference element of *type_* or None if not present.""" matching_headerReferences = self.xpath( "./w:headerReference[@w:type='%s']" % WD_HEADER_FOOTER.to_xml(type_) ) if len(matching_headerReferences) == 0: ret...
python
def get_headerReference(self, type_): """Return headerReference element of *type_* or None if not present.""" matching_headerReferences = self.xpath( "./w:headerReference[@w:type='%s']" % WD_HEADER_FOOTER.to_xml(type_) ) if len(matching_headerReferences) == 0: ret...
[ "def", "get_headerReference", "(", "self", ",", "type_", ")", ":", "matching_headerReferences", "=", "self", ".", "xpath", "(", "\"./w:headerReference[@w:type='%s']\"", "%", "WD_HEADER_FOOTER", ".", "to_xml", "(", "type_", ")", ")", "if", "len", "(", "matching_hea...
Return headerReference element of *type_* or None if not present.
[ "Return", "headerReference", "element", "of", "*", "type_", "*", "or", "None", "if", "not", "present", "." ]
6756f6cd145511d3eb6d1d188beea391b1ddfd53
https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/oxml/section.py#L147-L154
train
Return headerReference element of type_ or None.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
python-openxml/python-docx
docx/oxml/section.py
CT_SectPr.orientation
def orientation(self): """ The member of the ``WD_ORIENTATION`` enumeration corresponding to the value of the ``orient`` attribute of the ``<w:pgSz>`` child element, or ``WD_ORIENTATION.PORTRAIT`` if not present. """ pgSz = self.pgSz if pgSz is None: r...
python
def orientation(self): """ The member of the ``WD_ORIENTATION`` enumeration corresponding to the value of the ``orient`` attribute of the ``<w:pgSz>`` child element, or ``WD_ORIENTATION.PORTRAIT`` if not present. """ pgSz = self.pgSz if pgSz is None: r...
[ "def", "orientation", "(", "self", ")", ":", "pgSz", "=", "self", ".", "pgSz", "if", "pgSz", "is", "None", ":", "return", "WD_ORIENTATION", ".", "PORTRAIT", "return", "pgSz", ".", "orient" ]
The member of the ``WD_ORIENTATION`` enumeration corresponding to the value of the ``orient`` attribute of the ``<w:pgSz>`` child element, or ``WD_ORIENTATION.PORTRAIT`` if not present.
[ "The", "member", "of", "the", "WD_ORIENTATION", "enumeration", "corresponding", "to", "the", "value", "of", "the", "orient", "attribute", "of", "the", "<w", ":", "pgSz", ">", "child", "element", "or", "WD_ORIENTATION", ".", "PORTRAIT", "if", "not", "present", ...
6756f6cd145511d3eb6d1d188beea391b1ddfd53
https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/oxml/section.py#L208-L217
train
Returns the value of the orientation attribute of the WD_ORIENTATION enumeration corresponding to the passed in object.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
python-openxml/python-docx
docx/oxml/section.py
CT_SectPr.remove_footerReference
def remove_footerReference(self, type_): """Return rId of w:footerReference child of *type_* after removing it.""" footerReference = self.get_footerReference(type_) rId = footerReference.rId self.remove(footerReference) return rId
python
def remove_footerReference(self, type_): """Return rId of w:footerReference child of *type_* after removing it.""" footerReference = self.get_footerReference(type_) rId = footerReference.rId self.remove(footerReference) return rId
[ "def", "remove_footerReference", "(", "self", ",", "type_", ")", ":", "footerReference", "=", "self", ".", "get_footerReference", "(", "type_", ")", "rId", "=", "footerReference", ".", "rId", "self", ".", "remove", "(", "footerReference", ")", "return", "rId" ...
Return rId of w:footerReference child of *type_* after removing it.
[ "Return", "rId", "of", "w", ":", "footerReference", "child", "of", "*", "type_", "*", "after", "removing", "it", "." ]
6756f6cd145511d3eb6d1d188beea391b1ddfd53
https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/oxml/section.py#L263-L268
train
Return rId of w : footerReference child of type_ * after removing it.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
python-openxml/python-docx
docx/oxml/section.py
CT_SectPr.remove_headerReference
def remove_headerReference(self, type_): """Return rId of w:headerReference child of *type_* after removing it.""" headerReference = self.get_headerReference(type_) rId = headerReference.rId self.remove(headerReference) return rId
python
def remove_headerReference(self, type_): """Return rId of w:headerReference child of *type_* after removing it.""" headerReference = self.get_headerReference(type_) rId = headerReference.rId self.remove(headerReference) return rId
[ "def", "remove_headerReference", "(", "self", ",", "type_", ")", ":", "headerReference", "=", "self", ".", "get_headerReference", "(", "type_", ")", "rId", "=", "headerReference", ".", "rId", "self", ".", "remove", "(", "headerReference", ")", "return", "rId" ...
Return rId of w:headerReference child of *type_* after removing it.
[ "Return", "rId", "of", "w", ":", "headerReference", "child", "of", "*", "type_", "*", "after", "removing", "it", "." ]
6756f6cd145511d3eb6d1d188beea391b1ddfd53
https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/oxml/section.py#L270-L275
train
Return rId of w : headerReference child of type_ * after removing it.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
python-openxml/python-docx
docx/oxml/section.py
CT_SectPr.start_type
def start_type(self): """ The member of the ``WD_SECTION_START`` enumeration corresponding to the value of the ``val`` attribute of the ``<w:type>`` child element, or ``WD_SECTION_START.NEW_PAGE`` if not present. """ type = self.type if type is None or type.val is...
python
def start_type(self): """ The member of the ``WD_SECTION_START`` enumeration corresponding to the value of the ``val`` attribute of the ``<w:type>`` child element, or ``WD_SECTION_START.NEW_PAGE`` if not present. """ type = self.type if type is None or type.val is...
[ "def", "start_type", "(", "self", ")", ":", "type", "=", "self", ".", "type", "if", "type", "is", "None", "or", "type", ".", "val", "is", "None", ":", "return", "WD_SECTION_START", ".", "NEW_PAGE", "return", "type", ".", "val" ]
The member of the ``WD_SECTION_START`` enumeration corresponding to the value of the ``val`` attribute of the ``<w:type>`` child element, or ``WD_SECTION_START.NEW_PAGE`` if not present.
[ "The", "member", "of", "the", "WD_SECTION_START", "enumeration", "corresponding", "to", "the", "value", "of", "the", "val", "attribute", "of", "the", "<w", ":", "type", ">", "child", "element", "or", "WD_SECTION_START", ".", "NEW_PAGE", "if", "not", "present",...
6756f6cd145511d3eb6d1d188beea391b1ddfd53
https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/oxml/section.py#L295-L304
train
Return the value of the start type attribute of the WD_SECTION_START element.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
python-openxml/python-docx
docx/oxml/styles.py
CT_LatentStyles.bool_prop
def bool_prop(self, attr_name): """ Return the boolean value of the attribute having *attr_name*, or |False| if not present. """ value = getattr(self, attr_name) if value is None: return False return value
python
def bool_prop(self, attr_name): """ Return the boolean value of the attribute having *attr_name*, or |False| if not present. """ value = getattr(self, attr_name) if value is None: return False return value
[ "def", "bool_prop", "(", "self", ",", "attr_name", ")", ":", "value", "=", "getattr", "(", "self", ",", "attr_name", ")", "if", "value", "is", "None", ":", "return", "False", "return", "value" ]
Return the boolean value of the attribute having *attr_name*, or |False| if not present.
[ "Return", "the", "boolean", "value", "of", "the", "attribute", "having", "*", "attr_name", "*", "or", "|False|", "if", "not", "present", "." ]
6756f6cd145511d3eb6d1d188beea391b1ddfd53
https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/oxml/styles.py#L49-L57
train
Return the boolean value of the attribute having attr_name * or |False| if not present.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
python-openxml/python-docx
docx/oxml/styles.py
CT_Style.base_style
def base_style(self): """ Sibling CT_Style element this style is based on or |None| if no base style or base style not found. """ basedOn = self.basedOn if basedOn is None: return None styles = self.getparent() base_style = styles.get_by_id(bas...
python
def base_style(self): """ Sibling CT_Style element this style is based on or |None| if no base style or base style not found. """ basedOn = self.basedOn if basedOn is None: return None styles = self.getparent() base_style = styles.get_by_id(bas...
[ "def", "base_style", "(", "self", ")", ":", "basedOn", "=", "self", ".", "basedOn", "if", "basedOn", "is", "None", ":", "return", "None", "styles", "=", "self", ".", "getparent", "(", ")", "base_style", "=", "styles", ".", "get_by_id", "(", "basedOn", ...
Sibling CT_Style element this style is based on or |None| if no base style or base style not found.
[ "Sibling", "CT_Style", "element", "this", "style", "is", "based", "on", "or", "|None|", "if", "no", "base", "style", "or", "base", "style", "not", "found", "." ]
6756f6cd145511d3eb6d1d188beea391b1ddfd53
https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/oxml/styles.py#L154-L166
train
Returns the base style of this CT_Style element.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
python-openxml/python-docx
docx/oxml/styles.py
CT_Style.next_style
def next_style(self): """ Sibling CT_Style element identified by the value of `w:name/@w:val` or |None| if no value is present or no style with that style id is found. """ next = self.next if next is None: return None styles = self.getparent() ...
python
def next_style(self): """ Sibling CT_Style element identified by the value of `w:name/@w:val` or |None| if no value is present or no style with that style id is found. """ next = self.next if next is None: return None styles = self.getparent() ...
[ "def", "next_style", "(", "self", ")", ":", "next", "=", "self", ".", "next", "if", "next", "is", "None", ":", "return", "None", "styles", "=", "self", ".", "getparent", "(", ")", "return", "styles", ".", "get_by_id", "(", "next", ".", "val", ")" ]
Sibling CT_Style element identified by the value of `w:name/@w:val` or |None| if no value is present or no style with that style id is found.
[ "Sibling", "CT_Style", "element", "identified", "by", "the", "value", "of", "w", ":", "name", "/" ]
6756f6cd145511d3eb6d1d188beea391b1ddfd53
https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/oxml/styles.py#L209-L219
train
Returns the next Sibling CT_Style element.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
python-openxml/python-docx
docx/oxml/styles.py
CT_Styles.add_style_of_type
def add_style_of_type(self, name, style_type, builtin): """ Return a newly added `w:style` element having *name* and *style_type*. `w:style/@customStyle` is set based on the value of *builtin*. """ style = self.add_style() style.type = style_type style.cus...
python
def add_style_of_type(self, name, style_type, builtin): """ Return a newly added `w:style` element having *name* and *style_type*. `w:style/@customStyle` is set based on the value of *builtin*. """ style = self.add_style() style.type = style_type style.cus...
[ "def", "add_style_of_type", "(", "self", ",", "name", ",", "style_type", ",", "builtin", ")", ":", "style", "=", "self", ".", "add_style", "(", ")", "style", ".", "type", "=", "style_type", "style", ".", "customStyle", "=", "None", "if", "builtin", "else...
Return a newly added `w:style` element having *name* and *style_type*. `w:style/@customStyle` is set based on the value of *builtin*.
[ "Return", "a", "newly", "added", "w", ":", "style", "element", "having", "*", "name", "*", "and", "*", "style_type", "*", ".", "w", ":", "style", "/" ]
6756f6cd145511d3eb6d1d188beea391b1ddfd53
https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/oxml/styles.py#L299-L310
train
Return a newly added w : style element having name and style_type.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
python-openxml/python-docx
docx/oxml/styles.py
CT_Styles.default_for
def default_for(self, style_type): """ Return `w:style[@w:type="*{style_type}*][-1]` or |None| if not found. """ default_styles_for_type = [ s for s in self._iter_styles() if s.type == style_type and s.default ] if not default_styles_for_type: ...
python
def default_for(self, style_type): """ Return `w:style[@w:type="*{style_type}*][-1]` or |None| if not found. """ default_styles_for_type = [ s for s in self._iter_styles() if s.type == style_type and s.default ] if not default_styles_for_type: ...
[ "def", "default_for", "(", "self", ",", "style_type", ")", ":", "default_styles_for_type", "=", "[", "s", "for", "s", "in", "self", ".", "_iter_styles", "(", ")", "if", "s", ".", "type", "==", "style_type", "and", "s", ".", "default", "]", "if", "not",...
Return `w:style[@w:type="*{style_type}*][-1]` or |None| if not found.
[ "Return", "w", ":", "style", "[" ]
6756f6cd145511d3eb6d1d188beea391b1ddfd53
https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/oxml/styles.py#L312-L323
train
Return the default for a given style type.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
python-openxml/python-docx
docx/text/run.py
Run.add_break
def add_break(self, break_type=WD_BREAK.LINE): """ Add a break element of *break_type* to this run. *break_type* can take the values `WD_BREAK.LINE`, `WD_BREAK.PAGE`, and `WD_BREAK.COLUMN` where `WD_BREAK` is imported from `docx.enum.text`. *break_type* defaults to `WD_BREAK.LINE...
python
def add_break(self, break_type=WD_BREAK.LINE): """ Add a break element of *break_type* to this run. *break_type* can take the values `WD_BREAK.LINE`, `WD_BREAK.PAGE`, and `WD_BREAK.COLUMN` where `WD_BREAK` is imported from `docx.enum.text`. *break_type* defaults to `WD_BREAK.LINE...
[ "def", "add_break", "(", "self", ",", "break_type", "=", "WD_BREAK", ".", "LINE", ")", ":", "type_", ",", "clear", "=", "{", "WD_BREAK", ".", "LINE", ":", "(", "None", ",", "None", ")", ",", "WD_BREAK", ".", "PAGE", ":", "(", "'page'", ",", "None",...
Add a break element of *break_type* to this run. *break_type* can take the values `WD_BREAK.LINE`, `WD_BREAK.PAGE`, and `WD_BREAK.COLUMN` where `WD_BREAK` is imported from `docx.enum.text`. *break_type* defaults to `WD_BREAK.LINE`.
[ "Add", "a", "break", "element", "of", "*", "break_type", "*", "to", "this", "run", ".", "*", "break_type", "*", "can", "take", "the", "values", "WD_BREAK", ".", "LINE", "WD_BREAK", ".", "PAGE", "and", "WD_BREAK", ".", "COLUMN", "where", "WD_BREAK", "is",...
6756f6cd145511d3eb6d1d188beea391b1ddfd53
https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/text/run.py#L28-L47
train
Add a break element of type WD_BREAK.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
python-openxml/python-docx
docx/text/run.py
Run.add_picture
def add_picture(self, image_path_or_stream, width=None, height=None): """ Return an |InlineShape| instance containing the image identified by *image_path_or_stream*, added to the end of this run. *image_path_or_stream* can be a path (a string) or a file-like object containing a b...
python
def add_picture(self, image_path_or_stream, width=None, height=None): """ Return an |InlineShape| instance containing the image identified by *image_path_or_stream*, added to the end of this run. *image_path_or_stream* can be a path (a string) or a file-like object containing a b...
[ "def", "add_picture", "(", "self", ",", "image_path_or_stream", ",", "width", "=", "None", ",", "height", "=", "None", ")", ":", "inline", "=", "self", ".", "part", ".", "new_pic_inline", "(", "image_path_or_stream", ",", "width", ",", "height", ")", "self...
Return an |InlineShape| instance containing the image identified by *image_path_or_stream*, added to the end of this run. *image_path_or_stream* can be a path (a string) or a file-like object containing a binary image. If neither width nor height is specified, the picture appears at its ...
[ "Return", "an", "|InlineShape|", "instance", "containing", "the", "image", "identified", "by", "*", "image_path_or_stream", "*", "added", "to", "the", "end", "of", "this", "run", ".", "*", "image_path_or_stream", "*", "can", "be", "a", "path", "(", "a", "str...
6756f6cd145511d3eb6d1d188beea391b1ddfd53
https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/text/run.py#L49-L64
train
Adds a picture to the end of this run.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
python-openxml/python-docx
docx/text/run.py
Run.add_text
def add_text(self, text): """ Returns a newly appended |_Text| object (corresponding to a new ``<w:t>`` child element) to the run, containing *text*. Compare with the possibly more friendly approach of assigning text to the :attr:`Run.text` property. """ t = self....
python
def add_text(self, text): """ Returns a newly appended |_Text| object (corresponding to a new ``<w:t>`` child element) to the run, containing *text*. Compare with the possibly more friendly approach of assigning text to the :attr:`Run.text` property. """ t = self....
[ "def", "add_text", "(", "self", ",", "text", ")", ":", "t", "=", "self", ".", "_r", ".", "add_t", "(", "text", ")", "return", "_Text", "(", "t", ")" ]
Returns a newly appended |_Text| object (corresponding to a new ``<w:t>`` child element) to the run, containing *text*. Compare with the possibly more friendly approach of assigning text to the :attr:`Run.text` property.
[ "Returns", "a", "newly", "appended", "|_Text|", "object", "(", "corresponding", "to", "a", "new", "<w", ":", "t", ">", "child", "element", ")", "to", "the", "run", "containing", "*", "text", "*", ".", "Compare", "with", "the", "possibly", "more", "friend...
6756f6cd145511d3eb6d1d188beea391b1ddfd53
https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/text/run.py#L73-L81
train
Adds a text to the run containing the new .
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
python-openxml/python-docx
docx/text/run.py
Run.style
def style(self): """ Read/write. A |_CharacterStyle| object representing the character style applied to this run. The default character style for the document (often `Default Character Font`) is returned if the run has no directly-applied character style. Setting this property to...
python
def style(self): """ Read/write. A |_CharacterStyle| object representing the character style applied to this run. The default character style for the document (often `Default Character Font`) is returned if the run has no directly-applied character style. Setting this property to...
[ "def", "style", "(", "self", ")", ":", "style_id", "=", "self", ".", "_r", ".", "style", "return", "self", ".", "part", ".", "get_style", "(", "style_id", ",", "WD_STYLE_TYPE", ".", "CHARACTER", ")" ]
Read/write. A |_CharacterStyle| object representing the character style applied to this run. The default character style for the document (often `Default Character Font`) is returned if the run has no directly-applied character style. Setting this property to |None| removes any directly-...
[ "Read", "/", "write", ".", "A", "|_CharacterStyle|", "object", "representing", "the", "character", "style", "applied", "to", "this", "run", ".", "The", "default", "character", "style", "for", "the", "document", "(", "often", "Default", "Character", "Font", ")"...
6756f6cd145511d3eb6d1d188beea391b1ddfd53
https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/text/run.py#L123-L132
train
A |_CharacterStyle| object representing the character style applied to this run.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
python-openxml/python-docx
docx/oxml/text/parfmt.py
CT_PPr.first_line_indent
def first_line_indent(self): """ A |Length| value calculated from the values of `w:ind/@w:firstLine` and `w:ind/@w:hanging`. Returns |None| if the `w:ind` child is not present. """ ind = self.ind if ind is None: return None hanging = ind.hangin...
python
def first_line_indent(self): """ A |Length| value calculated from the values of `w:ind/@w:firstLine` and `w:ind/@w:hanging`. Returns |None| if the `w:ind` child is not present. """ ind = self.ind if ind is None: return None hanging = ind.hangin...
[ "def", "first_line_indent", "(", "self", ")", ":", "ind", "=", "self", ".", "ind", "if", "ind", "is", "None", ":", "return", "None", "hanging", "=", "ind", ".", "hanging", "if", "hanging", "is", "not", "None", ":", "return", "Length", "(", "-", "hang...
A |Length| value calculated from the values of `w:ind/@w:firstLine` and `w:ind/@w:hanging`. Returns |None| if the `w:ind` child is not present.
[ "A", "|Length|", "value", "calculated", "from", "the", "values", "of", "w", ":", "ind", "/" ]
6756f6cd145511d3eb6d1d188beea391b1ddfd53
https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/oxml/text/parfmt.py#L64-L79
train
A |Length| value calculated from the values of firstLine and hanging . Returns |None| if the child is not an indical node. Returns |None| if the child is not an indical node. Returns |Length| if the child is not an indical node. Returns |None| if the child is not an indical node. Returns |None| if the child is n...
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
python-openxml/python-docx
docx/oxml/text/parfmt.py
CT_PPr.spacing_lineRule
def spacing_lineRule(self): """ The value of `w:spacing/@w:lineRule` as a member of the :ref:`WdLineSpacing` enumeration. Only the `MULTIPLE`, `EXACTLY`, and `AT_LEAST` members are used. It is the responsibility of the client to calculate the use of `SINGLE`, `DOUBLE`, and `MULTI...
python
def spacing_lineRule(self): """ The value of `w:spacing/@w:lineRule` as a member of the :ref:`WdLineSpacing` enumeration. Only the `MULTIPLE`, `EXACTLY`, and `AT_LEAST` members are used. It is the responsibility of the client to calculate the use of `SINGLE`, `DOUBLE`, and `MULTI...
[ "def", "spacing_lineRule", "(", "self", ")", ":", "spacing", "=", "self", ".", "spacing", "if", "spacing", "is", "None", ":", "return", "None", "lineRule", "=", "spacing", ".", "lineRule", "if", "lineRule", "is", "None", "and", "spacing", ".", "line", "i...
The value of `w:spacing/@w:lineRule` as a member of the :ref:`WdLineSpacing` enumeration. Only the `MULTIPLE`, `EXACTLY`, and `AT_LEAST` members are used. It is the responsibility of the client to calculate the use of `SINGLE`, `DOUBLE`, and `MULTIPLE` based on the value of `w:spacing/@w...
[ "The", "value", "of", "w", ":", "spacing", "/" ]
6756f6cd145511d3eb6d1d188beea391b1ddfd53
https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/oxml/text/parfmt.py#L245-L259
train
Return the value of the WdLineSpacing enumeration.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
python-openxml/python-docx
docx/oxml/text/parfmt.py
CT_PPr.style
def style(self, style): """ Set val attribute of <w:pStyle> child element to *style*, adding a new element if necessary. If *style* is |None|, remove the <w:pStyle> element if present. """ if style is None: self._remove_pStyle() return pSty...
python
def style(self, style): """ Set val attribute of <w:pStyle> child element to *style*, adding a new element if necessary. If *style* is |None|, remove the <w:pStyle> element if present. """ if style is None: self._remove_pStyle() return pSty...
[ "def", "style", "(", "self", ",", "style", ")", ":", "if", "style", "is", "None", ":", "self", ".", "_remove_pStyle", "(", ")", "return", "pStyle", "=", "self", ".", "get_or_add_pStyle", "(", ")", "pStyle", ".", "val", "=", "style" ]
Set val attribute of <w:pStyle> child element to *style*, adding a new element if necessary. If *style* is |None|, remove the <w:pStyle> element if present.
[ "Set", "val", "attribute", "of", "<w", ":", "pStyle", ">", "child", "element", "to", "*", "style", "*", "adding", "a", "new", "element", "if", "necessary", ".", "If", "*", "style", "*", "is", "|None|", "remove", "the", "<w", ":", "pStyle", ">", "elem...
6756f6cd145511d3eb6d1d188beea391b1ddfd53
https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/oxml/text/parfmt.py#L279-L289
train
Set val attribute of a child element to style.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
python-openxml/python-docx
docx/oxml/text/parfmt.py
CT_TabStops.insert_tab_in_order
def insert_tab_in_order(self, pos, align, leader): """ Insert a newly created `w:tab` child element in *pos* order. """ new_tab = self._new_tab() new_tab.pos, new_tab.val, new_tab.leader = pos, align, leader for tab in self.tab_lst: if new_tab.pos < tab.pos: ...
python
def insert_tab_in_order(self, pos, align, leader): """ Insert a newly created `w:tab` child element in *pos* order. """ new_tab = self._new_tab() new_tab.pos, new_tab.val, new_tab.leader = pos, align, leader for tab in self.tab_lst: if new_tab.pos < tab.pos: ...
[ "def", "insert_tab_in_order", "(", "self", ",", "pos", ",", "align", ",", "leader", ")", ":", "new_tab", "=", "self", ".", "_new_tab", "(", ")", "new_tab", ".", "pos", ",", "new_tab", ".", "val", ",", "new_tab", ".", "leader", "=", "pos", ",", "align...
Insert a newly created `w:tab` child element in *pos* order.
[ "Insert", "a", "newly", "created", "w", ":", "tab", "child", "element", "in", "*", "pos", "*", "order", "." ]
6756f6cd145511d3eb6d1d188beea391b1ddfd53
https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/oxml/text/parfmt.py#L337-L348
train
Insert a newly created w : tab element in * pos * order.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
python-openxml/python-docx
docx/oxml/shape.py
CT_Inline.new
def new(cls, cx, cy, shape_id, pic): """ Return a new ``<wp:inline>`` element populated with the values passed as parameters. """ inline = parse_xml(cls._inline_xml()) inline.extent.cx = cx inline.extent.cy = cy inline.docPr.id = shape_id inline.do...
python
def new(cls, cx, cy, shape_id, pic): """ Return a new ``<wp:inline>`` element populated with the values passed as parameters. """ inline = parse_xml(cls._inline_xml()) inline.extent.cx = cx inline.extent.cy = cy inline.docPr.id = shape_id inline.do...
[ "def", "new", "(", "cls", ",", "cx", ",", "cy", ",", "shape_id", ",", "pic", ")", ":", "inline", "=", "parse_xml", "(", "cls", ".", "_inline_xml", "(", ")", ")", "inline", ".", "extent", ".", "cx", "=", "cx", "inline", ".", "extent", ".", "cy", ...
Return a new ``<wp:inline>`` element populated with the values passed as parameters.
[ "Return", "a", "new", "<wp", ":", "inline", ">", "element", "populated", "with", "the", "values", "passed", "as", "parameters", "." ]
6756f6cd145511d3eb6d1d188beea391b1ddfd53
https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/oxml/shape.py#L61-L75
train
Return a new inline element populated with the values passed as parameters.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
python-openxml/python-docx
docx/oxml/shape.py
CT_Inline.new_pic_inline
def new_pic_inline(cls, shape_id, rId, filename, cx, cy): """ Return a new `wp:inline` element containing the `pic:pic` element specified by the argument values. """ pic_id = 0 # Word doesn't seem to use this, but does not omit it pic = CT_Picture.new(pic_id, filename, r...
python
def new_pic_inline(cls, shape_id, rId, filename, cx, cy): """ Return a new `wp:inline` element containing the `pic:pic` element specified by the argument values. """ pic_id = 0 # Word doesn't seem to use this, but does not omit it pic = CT_Picture.new(pic_id, filename, r...
[ "def", "new_pic_inline", "(", "cls", ",", "shape_id", ",", "rId", ",", "filename", ",", "cx", ",", "cy", ")", ":", "pic_id", "=", "0", "# Word doesn't seem to use this, but does not omit it", "pic", "=", "CT_Picture", ".", "new", "(", "pic_id", ",", "filename"...
Return a new `wp:inline` element containing the `pic:pic` element specified by the argument values.
[ "Return", "a", "new", "wp", ":", "inline", "element", "containing", "the", "pic", ":", "pic", "element", "specified", "by", "the", "argument", "values", "." ]
6756f6cd145511d3eb6d1d188beea391b1ddfd53
https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/oxml/shape.py#L78-L87
train
Create a new pic element containing the pic : pic element containing the pic : pic specified by the argument values.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
python-openxml/python-docx
docx/oxml/shape.py
CT_Picture.new
def new(cls, pic_id, filename, rId, cx, cy): """ Return a new ``<pic:pic>`` element populated with the minimal contents required to define a viable picture element, based on the values passed as parameters. """ pic = parse_xml(cls._pic_xml()) pic.nvPicPr.cNvPr.id ...
python
def new(cls, pic_id, filename, rId, cx, cy): """ Return a new ``<pic:pic>`` element populated with the minimal contents required to define a viable picture element, based on the values passed as parameters. """ pic = parse_xml(cls._pic_xml()) pic.nvPicPr.cNvPr.id ...
[ "def", "new", "(", "cls", ",", "pic_id", ",", "filename", ",", "rId", ",", "cx", ",", "cy", ")", ":", "pic", "=", "parse_xml", "(", "cls", ".", "_pic_xml", "(", ")", ")", "pic", ".", "nvPicPr", ".", "cNvPr", ".", "id", "=", "pic_id", "pic", "."...
Return a new ``<pic:pic>`` element populated with the minimal contents required to define a viable picture element, based on the values passed as parameters.
[ "Return", "a", "new", "<pic", ":", "pic", ">", "element", "populated", "with", "the", "minimal", "contents", "required", "to", "define", "a", "viable", "picture", "element", "based", "on", "the", "values", "passed", "as", "parameters", "." ]
6756f6cd145511d3eb6d1d188beea391b1ddfd53
https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/oxml/shape.py#L130-L142
train
Return a new Pic element populated with the minimal contents required to define a viable picture element.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
python-openxml/python-docx
docx/styles/styles.py
Styles.add_style
def add_style(self, name, style_type, builtin=False): """ Return a newly added style object of *style_type* and identified by *name*. A builtin style can be defined by passing True for the optional *builtin* argument. """ style_name = BabelFish.ui2internal(name) i...
python
def add_style(self, name, style_type, builtin=False): """ Return a newly added style object of *style_type* and identified by *name*. A builtin style can be defined by passing True for the optional *builtin* argument. """ style_name = BabelFish.ui2internal(name) i...
[ "def", "add_style", "(", "self", ",", "name", ",", "style_type", ",", "builtin", "=", "False", ")", ":", "style_name", "=", "BabelFish", ".", "ui2internal", "(", "name", ")", "if", "style_name", "in", "self", ":", "raise", "ValueError", "(", "\"document al...
Return a newly added style object of *style_type* and identified by *name*. A builtin style can be defined by passing True for the optional *builtin* argument.
[ "Return", "a", "newly", "added", "style", "object", "of", "*", "style_type", "*", "and", "identified", "by", "*", "name", "*", ".", "A", "builtin", "style", "can", "be", "defined", "by", "passing", "True", "for", "the", "optional", "*", "builtin", "*", ...
6756f6cd145511d3eb6d1d188beea391b1ddfd53
https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/styles/styles.py#L61-L73
train
Add a new style object of type style_type to the document.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
python-openxml/python-docx
docx/styles/styles.py
Styles.default
def default(self, style_type): """ Return the default style for *style_type* or |None| if no default is defined for that type (not common). """ style = self._element.default_for(style_type) if style is None: return None return StyleFactory(style)
python
def default(self, style_type): """ Return the default style for *style_type* or |None| if no default is defined for that type (not common). """ style = self._element.default_for(style_type) if style is None: return None return StyleFactory(style)
[ "def", "default", "(", "self", ",", "style_type", ")", ":", "style", "=", "self", ".", "_element", ".", "default_for", "(", "style_type", ")", "if", "style", "is", "None", ":", "return", "None", "return", "StyleFactory", "(", "style", ")" ]
Return the default style for *style_type* or |None| if no default is defined for that type (not common).
[ "Return", "the", "default", "style", "for", "*", "style_type", "*", "or", "|None|", "if", "no", "default", "is", "defined", "for", "that", "type", "(", "not", "common", ")", "." ]
6756f6cd145511d3eb6d1d188beea391b1ddfd53
https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/styles/styles.py#L75-L83
train
Return the default style for the given style type.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
python-openxml/python-docx
docx/styles/styles.py
Styles.get_by_id
def get_by_id(self, style_id, style_type): """Return the style of *style_type* matching *style_id*. Returns the default for *style_type* if *style_id* is not found or is |None|, or if the style having *style_id* is not of *style_type*. """ if style_id is None: return...
python
def get_by_id(self, style_id, style_type): """Return the style of *style_type* matching *style_id*. Returns the default for *style_type* if *style_id* is not found or is |None|, or if the style having *style_id* is not of *style_type*. """ if style_id is None: return...
[ "def", "get_by_id", "(", "self", ",", "style_id", ",", "style_type", ")", ":", "if", "style_id", "is", "None", ":", "return", "self", ".", "default", "(", "style_type", ")", "return", "self", ".", "_get_by_id", "(", "style_id", ",", "style_type", ")" ]
Return the style of *style_type* matching *style_id*. Returns the default for *style_type* if *style_id* is not found or is |None|, or if the style having *style_id* is not of *style_type*.
[ "Return", "the", "style", "of", "*", "style_type", "*", "matching", "*", "style_id", "*", "." ]
6756f6cd145511d3eb6d1d188beea391b1ddfd53
https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/styles/styles.py#L85-L93
train
Return the style with the given style_id matching style_type.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
python-openxml/python-docx
docx/styles/styles.py
Styles.get_style_id
def get_style_id(self, style_or_name, style_type): """ Return the id of the style corresponding to *style_or_name*, or |None| if *style_or_name* is |None|. If *style_or_name* is not a style object, the style is looked up using *style_or_name* as a style name, raising |ValueError|...
python
def get_style_id(self, style_or_name, style_type): """ Return the id of the style corresponding to *style_or_name*, or |None| if *style_or_name* is |None|. If *style_or_name* is not a style object, the style is looked up using *style_or_name* as a style name, raising |ValueError|...
[ "def", "get_style_id", "(", "self", ",", "style_or_name", ",", "style_type", ")", ":", "if", "style_or_name", "is", "None", ":", "return", "None", "elif", "isinstance", "(", "style_or_name", ",", "BaseStyle", ")", ":", "return", "self", ".", "_get_style_id_fro...
Return the id of the style corresponding to *style_or_name*, or |None| if *style_or_name* is |None|. If *style_or_name* is not a style object, the style is looked up using *style_or_name* as a style name, raising |ValueError| if no style with that name is defined. Raises |ValueError| if ...
[ "Return", "the", "id", "of", "the", "style", "corresponding", "to", "*", "style_or_name", "*", "or", "|None|", "if", "*", "style_or_name", "*", "is", "|None|", ".", "If", "*", "style_or_name", "*", "is", "not", "a", "style", "object", "the", "style", "is...
6756f6cd145511d3eb6d1d188beea391b1ddfd53
https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/styles/styles.py#L95-L109
train
Returns the id of the style corresponding to style_or_name or None if the style is not found.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
python-openxml/python-docx
docx/styles/styles.py
Styles._get_by_id
def _get_by_id(self, style_id, style_type): """ Return the style of *style_type* matching *style_id*. Returns the default for *style_type* if *style_id* is not found or if the style having *style_id* is not of *style_type*. """ style = self._element.get_by_id(style_id) ...
python
def _get_by_id(self, style_id, style_type): """ Return the style of *style_type* matching *style_id*. Returns the default for *style_type* if *style_id* is not found or if the style having *style_id* is not of *style_type*. """ style = self._element.get_by_id(style_id) ...
[ "def", "_get_by_id", "(", "self", ",", "style_id", ",", "style_type", ")", ":", "style", "=", "self", ".", "_element", ".", "get_by_id", "(", "style_id", ")", "if", "style", "is", "None", "or", "style", ".", "type", "!=", "style_type", ":", "return", "...
Return the style of *style_type* matching *style_id*. Returns the default for *style_type* if *style_id* is not found or if the style having *style_id* is not of *style_type*.
[ "Return", "the", "style", "of", "*", "style_type", "*", "matching", "*", "style_id", "*", ".", "Returns", "the", "default", "for", "*", "style_type", "*", "if", "*", "style_id", "*", "is", "not", "found", "or", "if", "the", "style", "having", "*", "sty...
6756f6cd145511d3eb6d1d188beea391b1ddfd53
https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/styles/styles.py#L121-L130
train
Returns the style of style_type matching style_id. Returns the default style for style_type.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
python-openxml/python-docx
docx/shared.py
RGBColor.from_string
def from_string(cls, rgb_hex_str): """ Return a new instance from an RGB color hex string like ``'3C2F80'``. """ r = int(rgb_hex_str[:2], 16) g = int(rgb_hex_str[2:4], 16) b = int(rgb_hex_str[4:], 16) return cls(r, g, b)
python
def from_string(cls, rgb_hex_str): """ Return a new instance from an RGB color hex string like ``'3C2F80'``. """ r = int(rgb_hex_str[:2], 16) g = int(rgb_hex_str[2:4], 16) b = int(rgb_hex_str[4:], 16) return cls(r, g, b)
[ "def", "from_string", "(", "cls", ",", "rgb_hex_str", ")", ":", "r", "=", "int", "(", "rgb_hex_str", "[", ":", "2", "]", ",", "16", ")", "g", "=", "int", "(", "rgb_hex_str", "[", "2", ":", "4", "]", ",", "16", ")", "b", "=", "int", "(", "rgb_...
Return a new instance from an RGB color hex string like ``'3C2F80'``.
[ "Return", "a", "new", "instance", "from", "an", "RGB", "color", "hex", "string", "like", "3C2F80", "." ]
6756f6cd145511d3eb6d1d188beea391b1ddfd53
https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/shared.py#L148-L155
train
Return a new instance from an RGB color hex string like 3C2F80.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
python-openxml/python-docx
docx/opc/package.py
OpcPackage.iter_rels
def iter_rels(self): """ Generate exactly one reference to each relationship in the package by performing a depth-first traversal of the rels graph. """ def walk_rels(source, visited=None): visited = [] if visited is None else visited for rel in source.rel...
python
def iter_rels(self): """ Generate exactly one reference to each relationship in the package by performing a depth-first traversal of the rels graph. """ def walk_rels(source, visited=None): visited = [] if visited is None else visited for rel in source.rel...
[ "def", "iter_rels", "(", "self", ")", ":", "def", "walk_rels", "(", "source", ",", "visited", "=", "None", ")", ":", "visited", "=", "[", "]", "if", "visited", "is", "None", "else", "visited", "for", "rel", "in", "source", ".", "rels", ".", "values",...
Generate exactly one reference to each relationship in the package by performing a depth-first traversal of the rels graph.
[ "Generate", "exactly", "one", "reference", "to", "each", "relationship", "in", "the", "package", "by", "performing", "a", "depth", "-", "first", "traversal", "of", "the", "rels", "graph", "." ]
6756f6cd145511d3eb6d1d188beea391b1ddfd53
https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/opc/package.py#L44-L64
train
Generate exactly one reference to each relationship in the package by iterating over the rels in the package.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
python-openxml/python-docx
docx/opc/package.py
OpcPackage.iter_parts
def iter_parts(self): """ Generate exactly one reference to each of the parts in the package by performing a depth-first traversal of the rels graph. """ def walk_parts(source, visited=list()): for rel in source.rels.values(): if rel.is_external: ...
python
def iter_parts(self): """ Generate exactly one reference to each of the parts in the package by performing a depth-first traversal of the rels graph. """ def walk_parts(source, visited=list()): for rel in source.rels.values(): if rel.is_external: ...
[ "def", "iter_parts", "(", "self", ")", ":", "def", "walk_parts", "(", "source", ",", "visited", "=", "list", "(", ")", ")", ":", "for", "rel", "in", "source", ".", "rels", ".", "values", "(", ")", ":", "if", "rel", ".", "is_external", ":", "continu...
Generate exactly one reference to each of the parts in the package by performing a depth-first traversal of the rels graph.
[ "Generate", "exactly", "one", "reference", "to", "each", "of", "the", "parts", "in", "the", "package", "by", "performing", "a", "depth", "-", "first", "traversal", "of", "the", "rels", "graph", "." ]
6756f6cd145511d3eb6d1d188beea391b1ddfd53
https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/opc/package.py#L66-L85
train
Iterate over the parts of the package by iterating over the parts in the package.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
python-openxml/python-docx
docx/opc/package.py
OpcPackage.load_rel
def load_rel(self, reltype, target, rId, is_external=False): """ Return newly added |_Relationship| instance of *reltype* between this part and *target* with key *rId*. Target mode is set to ``RTM.EXTERNAL`` if *is_external* is |True|. Intended for use during load from a serializ...
python
def load_rel(self, reltype, target, rId, is_external=False): """ Return newly added |_Relationship| instance of *reltype* between this part and *target* with key *rId*. Target mode is set to ``RTM.EXTERNAL`` if *is_external* is |True|. Intended for use during load from a serializ...
[ "def", "load_rel", "(", "self", ",", "reltype", ",", "target", ",", "rId", ",", "is_external", "=", "False", ")", ":", "return", "self", ".", "rels", ".", "add_relationship", "(", "reltype", ",", "target", ",", "rId", ",", "is_external", ")" ]
Return newly added |_Relationship| instance of *reltype* between this part and *target* with key *rId*. Target mode is set to ``RTM.EXTERNAL`` if *is_external* is |True|. Intended for use during load from a serialized package, where the rId is well known. Other methods exist for adding a...
[ "Return", "newly", "added", "|_Relationship|", "instance", "of", "*", "reltype", "*", "between", "this", "part", "and", "*", "target", "*", "with", "key", "*", "rId", "*", ".", "Target", "mode", "is", "set", "to", "RTM", ".", "EXTERNAL", "if", "*", "is...
6756f6cd145511d3eb6d1d188beea391b1ddfd53
https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/opc/package.py#L87-L96
train
Load a relationship between thisCOOKIE and a target with key rId.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
python-openxml/python-docx
docx/opc/package.py
OpcPackage.next_partname
def next_partname(self, template): """Return a |PackURI| instance representing partname matching *template*. The returned part-name has the next available numeric suffix to distinguish it from other parts of its type. *template* is a printf (%)-style template string containing a single ...
python
def next_partname(self, template): """Return a |PackURI| instance representing partname matching *template*. The returned part-name has the next available numeric suffix to distinguish it from other parts of its type. *template* is a printf (%)-style template string containing a single ...
[ "def", "next_partname", "(", "self", ",", "template", ")", ":", "partnames", "=", "{", "part", ".", "partname", "for", "part", "in", "self", ".", "iter_parts", "(", ")", "}", "for", "n", "in", "range", "(", "1", ",", "len", "(", "partnames", ")", "...
Return a |PackURI| instance representing partname matching *template*. The returned part-name has the next available numeric suffix to distinguish it from other parts of its type. *template* is a printf (%)-style template string containing a single replacement item, a '%d' to be used to insert ...
[ "Return", "a", "|PackURI|", "instance", "representing", "partname", "matching", "*", "template", "*", "." ]
6756f6cd145511d3eb6d1d188beea391b1ddfd53
https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/opc/package.py#L108-L120
train
Return a |PackURI| instance representing the next available partname matching template.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
python-openxml/python-docx
docx/opc/package.py
OpcPackage.open
def open(cls, pkg_file): """ Return an |OpcPackage| instance loaded with the contents of *pkg_file*. """ pkg_reader = PackageReader.from_file(pkg_file) package = cls() Unmarshaller.unmarshal(pkg_reader, package, PartFactory) return package
python
def open(cls, pkg_file): """ Return an |OpcPackage| instance loaded with the contents of *pkg_file*. """ pkg_reader = PackageReader.from_file(pkg_file) package = cls() Unmarshaller.unmarshal(pkg_reader, package, PartFactory) return package
[ "def", "open", "(", "cls", ",", "pkg_file", ")", ":", "pkg_reader", "=", "PackageReader", ".", "from_file", "(", "pkg_file", ")", "package", "=", "cls", "(", ")", "Unmarshaller", ".", "unmarshal", "(", "pkg_reader", ",", "package", ",", "PartFactory", ")",...
Return an |OpcPackage| instance loaded with the contents of *pkg_file*.
[ "Return", "an", "|OpcPackage|", "instance", "loaded", "with", "the", "contents", "of", "*", "pkg_file", "*", "." ]
6756f6cd145511d3eb6d1d188beea391b1ddfd53
https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/opc/package.py#L123-L131
train
Open an OpcPackage instance from the contents of pkg_file.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
python-openxml/python-docx
docx/opc/package.py
OpcPackage.relate_to
def relate_to(self, part, reltype): """ Return rId key of relationship to *part*, from the existing relationship if there is one, otherwise a newly created one. """ rel = self.rels.get_or_add(reltype, part) return rel.rId
python
def relate_to(self, part, reltype): """ Return rId key of relationship to *part*, from the existing relationship if there is one, otherwise a newly created one. """ rel = self.rels.get_or_add(reltype, part) return rel.rId
[ "def", "relate_to", "(", "self", ",", "part", ",", "reltype", ")", ":", "rel", "=", "self", ".", "rels", ".", "get_or_add", "(", "reltype", ",", "part", ")", "return", "rel", ".", "rId" ]
Return rId key of relationship to *part*, from the existing relationship if there is one, otherwise a newly created one.
[ "Return", "rId", "key", "of", "relationship", "to", "*", "part", "*", "from", "the", "existing", "relationship", "if", "there", "is", "one", "otherwise", "a", "newly", "created", "one", "." ]
6756f6cd145511d3eb6d1d188beea391b1ddfd53
https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/opc/package.py#L149-L155
train
Return rId key of relationship to part
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
python-openxml/python-docx
docx/opc/package.py
OpcPackage.save
def save(self, pkg_file): """ Save this package to *pkg_file*, where *file* can be either a path to a file (a string) or a file-like object. """ for part in self.parts: part.before_marshal() PackageWriter.write(pkg_file, self.rels, self.parts)
python
def save(self, pkg_file): """ Save this package to *pkg_file*, where *file* can be either a path to a file (a string) or a file-like object. """ for part in self.parts: part.before_marshal() PackageWriter.write(pkg_file, self.rels, self.parts)
[ "def", "save", "(", "self", ",", "pkg_file", ")", ":", "for", "part", "in", "self", ".", "parts", ":", "part", ".", "before_marshal", "(", ")", "PackageWriter", ".", "write", "(", "pkg_file", ",", "self", ".", "rels", ",", "self", ".", "parts", ")" ]
Save this package to *pkg_file*, where *file* can be either a path to a file (a string) or a file-like object.
[ "Save", "this", "package", "to", "*", "pkg_file", "*", "where", "*", "file", "*", "can", "be", "either", "a", "path", "to", "a", "file", "(", "a", "string", ")", "or", "a", "file", "-", "like", "object", "." ]
6756f6cd145511d3eb6d1d188beea391b1ddfd53
https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/opc/package.py#L165-L172
train
Save this package to a file - like object.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
python-openxml/python-docx
docx/opc/package.py
OpcPackage._core_properties_part
def _core_properties_part(self): """ |CorePropertiesPart| object related to this package. Creates a default core properties part if one is not present (not common). """ try: return self.part_related_by(RT.CORE_PROPERTIES) except KeyError: core_prop...
python
def _core_properties_part(self): """ |CorePropertiesPart| object related to this package. Creates a default core properties part if one is not present (not common). """ try: return self.part_related_by(RT.CORE_PROPERTIES) except KeyError: core_prop...
[ "def", "_core_properties_part", "(", "self", ")", ":", "try", ":", "return", "self", ".", "part_related_by", "(", "RT", ".", "CORE_PROPERTIES", ")", "except", "KeyError", ":", "core_properties_part", "=", "CorePropertiesPart", ".", "default", "(", "self", ")", ...
|CorePropertiesPart| object related to this package. Creates a default core properties part if one is not present (not common).
[ "|CorePropertiesPart|", "object", "related", "to", "this", "package", ".", "Creates", "a", "default", "core", "properties", "part", "if", "one", "is", "not", "present", "(", "not", "common", ")", "." ]
6756f6cd145511d3eb6d1d188beea391b1ddfd53
https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/opc/package.py#L175-L185
train
Creates a core properties part related to this package.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
python-openxml/python-docx
docx/opc/package.py
Unmarshaller.unmarshal
def unmarshal(pkg_reader, package, part_factory): """ Construct graph of parts and realized relationships based on the contents of *pkg_reader*, delegating construction of each part to *part_factory*. Package relationships are added to *pkg*. """ parts = Unmarshaller._unm...
python
def unmarshal(pkg_reader, package, part_factory): """ Construct graph of parts and realized relationships based on the contents of *pkg_reader*, delegating construction of each part to *part_factory*. Package relationships are added to *pkg*. """ parts = Unmarshaller._unm...
[ "def", "unmarshal", "(", "pkg_reader", ",", "package", ",", "part_factory", ")", ":", "parts", "=", "Unmarshaller", ".", "_unmarshal_parts", "(", "pkg_reader", ",", "package", ",", "part_factory", ")", "Unmarshaller", ".", "_unmarshal_relationships", "(", "pkg_rea...
Construct graph of parts and realized relationships based on the contents of *pkg_reader*, delegating construction of each part to *part_factory*. Package relationships are added to *pkg*.
[ "Construct", "graph", "of", "parts", "and", "realized", "relationships", "based", "on", "the", "contents", "of", "*", "pkg_reader", "*", "delegating", "construction", "of", "each", "part", "to", "*", "part_factory", "*", ".", "Package", "relationships", "are", ...
6756f6cd145511d3eb6d1d188beea391b1ddfd53
https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/opc/package.py#L192-L204
train
Unmarshalls the contents of pkg_reader into the package.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
python-openxml/python-docx
docx/opc/package.py
Unmarshaller._unmarshal_parts
def _unmarshal_parts(pkg_reader, package, part_factory): """ Return a dictionary of |Part| instances unmarshalled from *pkg_reader*, keyed by partname. Side-effect is that each part in *pkg_reader* is constructed using *part_factory*. """ parts = {} for partname, ...
python
def _unmarshal_parts(pkg_reader, package, part_factory): """ Return a dictionary of |Part| instances unmarshalled from *pkg_reader*, keyed by partname. Side-effect is that each part in *pkg_reader* is constructed using *part_factory*. """ parts = {} for partname, ...
[ "def", "_unmarshal_parts", "(", "pkg_reader", ",", "package", ",", "part_factory", ")", ":", "parts", "=", "{", "}", "for", "partname", ",", "content_type", ",", "reltype", ",", "blob", "in", "pkg_reader", ".", "iter_sparts", "(", ")", ":", "parts", "[", ...
Return a dictionary of |Part| instances unmarshalled from *pkg_reader*, keyed by partname. Side-effect is that each part in *pkg_reader* is constructed using *part_factory*.
[ "Return", "a", "dictionary", "of", "|Part|", "instances", "unmarshalled", "from", "*", "pkg_reader", "*", "keyed", "by", "partname", ".", "Side", "-", "effect", "is", "that", "each", "part", "in", "*", "pkg_reader", "*", "is", "constructed", "using", "*", ...
6756f6cd145511d3eb6d1d188beea391b1ddfd53
https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/opc/package.py#L207-L218
train
Unmarshalls the given package into a dictionary of |Part| instances.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
python-openxml/python-docx
docx/opc/package.py
Unmarshaller._unmarshal_relationships
def _unmarshal_relationships(pkg_reader, package, parts): """ Add a relationship to the source object corresponding to each of the relationships in *pkg_reader* with its target_part set to the actual target part in *parts*. """ for source_uri, srel in pkg_reader.iter_srel...
python
def _unmarshal_relationships(pkg_reader, package, parts): """ Add a relationship to the source object corresponding to each of the relationships in *pkg_reader* with its target_part set to the actual target part in *parts*. """ for source_uri, srel in pkg_reader.iter_srel...
[ "def", "_unmarshal_relationships", "(", "pkg_reader", ",", "package", ",", "parts", ")", ":", "for", "source_uri", ",", "srel", "in", "pkg_reader", ".", "iter_srels", "(", ")", ":", "source", "=", "package", "if", "source_uri", "==", "'/'", "else", "parts", ...
Add a relationship to the source object corresponding to each of the relationships in *pkg_reader* with its target_part set to the actual target part in *parts*.
[ "Add", "a", "relationship", "to", "the", "source", "object", "corresponding", "to", "each", "of", "the", "relationships", "in", "*", "pkg_reader", "*", "with", "its", "target_part", "set", "to", "the", "actual", "target", "part", "in", "*", "parts", "*", "...
6756f6cd145511d3eb6d1d188beea391b1ddfd53
https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/opc/package.py#L221-L231
train
Unmarshalls the relationships in pkg_reader into the source object corresponding to each of the actual relationships in parts.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
python-openxml/python-docx
docx/parts/settings.py
SettingsPart.default
def default(cls, package): """ Return a newly created settings part, containing a default `w:settings` element tree. """ partname = PackURI('/word/settings.xml') content_type = CT.WML_SETTINGS element = parse_xml(cls._default_settings_xml()) return cls(par...
python
def default(cls, package): """ Return a newly created settings part, containing a default `w:settings` element tree. """ partname = PackURI('/word/settings.xml') content_type = CT.WML_SETTINGS element = parse_xml(cls._default_settings_xml()) return cls(par...
[ "def", "default", "(", "cls", ",", "package", ")", ":", "partname", "=", "PackURI", "(", "'/word/settings.xml'", ")", "content_type", "=", "CT", ".", "WML_SETTINGS", "element", "=", "parse_xml", "(", "cls", ".", "_default_settings_xml", "(", ")", ")", "retur...
Return a newly created settings part, containing a default `w:settings` element tree.
[ "Return", "a", "newly", "created", "settings", "part", "containing", "a", "default", "w", ":", "settings", "element", "tree", "." ]
6756f6cd145511d3eb6d1d188beea391b1ddfd53
https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/parts/settings.py#L25-L33
train
Return a newly created settings part containing a default xml.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
python-openxml/python-docx
docx/styles/latent.py
LatentStyles.add_latent_style
def add_latent_style(self, name): """ Return a newly added |_LatentStyle| object to override the inherited defaults defined in this latent styles object for the built-in style having *name*. """ lsdException = self._element.add_lsdException() lsdException.name = B...
python
def add_latent_style(self, name): """ Return a newly added |_LatentStyle| object to override the inherited defaults defined in this latent styles object for the built-in style having *name*. """ lsdException = self._element.add_lsdException() lsdException.name = B...
[ "def", "add_latent_style", "(", "self", ",", "name", ")", ":", "lsdException", "=", "self", ".", "_element", ".", "add_lsdException", "(", ")", "lsdException", ".", "name", "=", "BabelFish", ".", "ui2internal", "(", "name", ")", "return", "_LatentStyle", "("...
Return a newly added |_LatentStyle| object to override the inherited defaults defined in this latent styles object for the built-in style having *name*.
[ "Return", "a", "newly", "added", "|_LatentStyle|", "object", "to", "override", "the", "inherited", "defaults", "defined", "in", "this", "latent", "styles", "object", "for", "the", "built", "-", "in", "style", "having", "*", "name", "*", "." ]
6756f6cd145511d3eb6d1d188beea391b1ddfd53
https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/styles/latent.py#L40-L48
train
Add a latent style to the current object
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
python-openxml/python-docx
docx/opc/part.py
Part.relate_to
def relate_to(self, target, reltype, is_external=False): """ Return rId key of relationship of *reltype* to *target*, from an existing relationship if there is one, otherwise a newly created one. """ if is_external: return self.rels.get_or_add_ext_rel(reltype, target)...
python
def relate_to(self, target, reltype, is_external=False): """ Return rId key of relationship of *reltype* to *target*, from an existing relationship if there is one, otherwise a newly created one. """ if is_external: return self.rels.get_or_add_ext_rel(reltype, target)...
[ "def", "relate_to", "(", "self", ",", "target", ",", "reltype", ",", "is_external", "=", "False", ")", ":", "if", "is_external", ":", "return", "self", ".", "rels", ".", "get_or_add_ext_rel", "(", "reltype", ",", "target", ")", "else", ":", "rel", "=", ...
Return rId key of relationship of *reltype* to *target*, from an existing relationship if there is one, otherwise a newly created one.
[ "Return", "rId", "key", "of", "relationship", "of", "*", "reltype", "*", "to", "*", "target", "*", "from", "an", "existing", "relationship", "if", "there", "is", "one", "otherwise", "a", "newly", "created", "one", "." ]
6756f6cd145511d3eb6d1d188beea391b1ddfd53
https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/opc/part.py#L123-L132
train
Return rId key of relationship of reltype to target.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
python-openxml/python-docx
docx/opc/part.py
Part._rel_ref_count
def _rel_ref_count(self, rId): """ Return the count of references in this part's XML to the relationship identified by *rId*. """ rIds = self._element.xpath('//@r:id') return len([_rId for _rId in rIds if _rId == rId])
python
def _rel_ref_count(self, rId): """ Return the count of references in this part's XML to the relationship identified by *rId*. """ rIds = self._element.xpath('//@r:id') return len([_rId for _rId in rIds if _rId == rId])
[ "def", "_rel_ref_count", "(", "self", ",", "rId", ")", ":", "rIds", "=", "self", ".", "_element", ".", "xpath", "(", "'//@r:id'", ")", "return", "len", "(", "[", "_rId", "for", "_rId", "in", "rIds", "if", "_rId", "==", "rId", "]", ")" ]
Return the count of references in this part's XML to the relationship identified by *rId*.
[ "Return", "the", "count", "of", "references", "in", "this", "part", "s", "XML", "to", "the", "relationship", "identified", "by", "*", "rId", "*", "." ]
6756f6cd145511d3eb6d1d188beea391b1ddfd53
https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/opc/part.py#L158-L164
train
Return the count of references in this part s XML to the relationship identified by rId.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
python-openxml/python-docx
docx/opc/part.py
PartFactory._part_cls_for
def _part_cls_for(cls, content_type): """ Return the custom part class registered for *content_type*, or the default part class if no custom class is registered for *content_type*. """ if content_type in cls.part_type_for: return cls.part_type_for[content_type...
python
def _part_cls_for(cls, content_type): """ Return the custom part class registered for *content_type*, or the default part class if no custom class is registered for *content_type*. """ if content_type in cls.part_type_for: return cls.part_type_for[content_type...
[ "def", "_part_cls_for", "(", "cls", ",", "content_type", ")", ":", "if", "content_type", "in", "cls", ".", "part_type_for", ":", "return", "cls", ".", "part_type_for", "[", "content_type", "]", "return", "cls", ".", "default_part_type" ]
Return the custom part class registered for *content_type*, or the default part class if no custom class is registered for *content_type*.
[ "Return", "the", "custom", "part", "class", "registered", "for", "*", "content_type", "*", "or", "the", "default", "part", "class", "if", "no", "custom", "class", "is", "registered", "for", "*", "content_type", "*", "." ]
6756f6cd145511d3eb6d1d188beea391b1ddfd53
https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/opc/part.py#L194-L202
train
Return the custom part class registered for the given content type.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
python-openxml/python-docx
docx/oxml/text/run.py
CT_R.add_t
def add_t(self, text): """ Return a newly added ``<w:t>`` element containing *text*. """ t = self._add_t(text=text) if len(text.strip()) < len(text): t.set(qn('xml:space'), 'preserve') return t
python
def add_t(self, text): """ Return a newly added ``<w:t>`` element containing *text*. """ t = self._add_t(text=text) if len(text.strip()) < len(text): t.set(qn('xml:space'), 'preserve') return t
[ "def", "add_t", "(", "self", ",", "text", ")", ":", "t", "=", "self", ".", "_add_t", "(", "text", "=", "text", ")", "if", "len", "(", "text", ".", "strip", "(", ")", ")", "<", "len", "(", "text", ")", ":", "t", ".", "set", "(", "qn", "(", ...
Return a newly added ``<w:t>`` element containing *text*.
[ "Return", "a", "newly", "added", "<w", ":", "t", ">", "element", "containing", "*", "text", "*", "." ]
6756f6cd145511d3eb6d1d188beea391b1ddfd53
https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/oxml/text/run.py#L37-L44
train
Return a newly added <w : t > element containing text.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
python-openxml/python-docx
docx/oxml/text/run.py
CT_R.add_drawing
def add_drawing(self, inline_or_anchor): """ Return a newly appended ``CT_Drawing`` (``<w:drawing>``) child element having *inline_or_anchor* as its child. """ drawing = self._add_drawing() drawing.append(inline_or_anchor) return drawing
python
def add_drawing(self, inline_or_anchor): """ Return a newly appended ``CT_Drawing`` (``<w:drawing>``) child element having *inline_or_anchor* as its child. """ drawing = self._add_drawing() drawing.append(inline_or_anchor) return drawing
[ "def", "add_drawing", "(", "self", ",", "inline_or_anchor", ")", ":", "drawing", "=", "self", ".", "_add_drawing", "(", ")", "drawing", ".", "append", "(", "inline_or_anchor", ")", "return", "drawing" ]
Return a newly appended ``CT_Drawing`` (``<w:drawing>``) child element having *inline_or_anchor* as its child.
[ "Return", "a", "newly", "appended", "CT_Drawing", "(", "<w", ":", "drawing", ">", ")", "child", "element", "having", "*", "inline_or_anchor", "*", "as", "its", "child", "." ]
6756f6cd145511d3eb6d1d188beea391b1ddfd53
https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/oxml/text/run.py#L46-L53
train
Adds a drawing element to the current CT_Drawing element.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
python-openxml/python-docx
docx/oxml/text/run.py
CT_R.clear_content
def clear_content(self): """ Remove all child elements except the ``<w:rPr>`` element if present. """ content_child_elms = self[1:] if self.rPr is not None else self[:] for child in content_child_elms: self.remove(child)
python
def clear_content(self): """ Remove all child elements except the ``<w:rPr>`` element if present. """ content_child_elms = self[1:] if self.rPr is not None else self[:] for child in content_child_elms: self.remove(child)
[ "def", "clear_content", "(", "self", ")", ":", "content_child_elms", "=", "self", "[", "1", ":", "]", "if", "self", ".", "rPr", "is", "not", "None", "else", "self", "[", ":", "]", "for", "child", "in", "content_child_elms", ":", "self", ".", "remove", ...
Remove all child elements except the ``<w:rPr>`` element if present.
[ "Remove", "all", "child", "elements", "except", "the", "<w", ":", "rPr", ">", "element", "if", "present", "." ]
6756f6cd145511d3eb6d1d188beea391b1ddfd53
https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/oxml/text/run.py#L55-L61
train
Removes all child elements except the rPr element.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
python-openxml/python-docx
docx/oxml/text/run.py
CT_R.text
def text(self): """ A string representing the textual content of this run, with content child elements like ``<w:tab/>`` translated to their Python equivalent. """ text = '' for child in self: if child.tag == qn('w:t'): t_text = child.t...
python
def text(self): """ A string representing the textual content of this run, with content child elements like ``<w:tab/>`` translated to their Python equivalent. """ text = '' for child in self: if child.tag == qn('w:t'): t_text = child.t...
[ "def", "text", "(", "self", ")", ":", "text", "=", "''", "for", "child", "in", "self", ":", "if", "child", ".", "tag", "==", "qn", "(", "'w:t'", ")", ":", "t_text", "=", "child", ".", "text", "text", "+=", "t_text", "if", "t_text", "is", "not", ...
A string representing the textual content of this run, with content child elements like ``<w:tab/>`` translated to their Python equivalent.
[ "A", "string", "representing", "the", "textual", "content", "of", "this", "run", "with", "content", "child", "elements", "like", "<w", ":", "tab", "/", ">", "translated", "to", "their", "Python", "equivalent", "." ]
6756f6cd145511d3eb6d1d188beea391b1ddfd53
https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/oxml/text/run.py#L84-L99
train
A string representing the textual content of this run with content child elements like <w : t > translated to their Python equivalent.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
python-openxml/python-docx
docx/oxml/text/run.py
_RunContentAppender.append_to_run_from_text
def append_to_run_from_text(cls, r, text): """ Create a "one-shot" ``_RunContentAppender`` instance and use it to append the run content elements corresponding to *text* to the ``<w:r>`` element *r*. """ appender = cls(r) appender.add_text(text)
python
def append_to_run_from_text(cls, r, text): """ Create a "one-shot" ``_RunContentAppender`` instance and use it to append the run content elements corresponding to *text* to the ``<w:r>`` element *r*. """ appender = cls(r) appender.add_text(text)
[ "def", "append_to_run_from_text", "(", "cls", ",", "r", ",", "text", ")", ":", "appender", "=", "cls", "(", "r", ")", "appender", ".", "add_text", "(", "text", ")" ]
Create a "one-shot" ``_RunContentAppender`` instance and use it to append the run content elements corresponding to *text* to the ``<w:r>`` element *r*.
[ "Create", "a", "one", "-", "shot", "_RunContentAppender", "instance", "and", "use", "it", "to", "append", "the", "run", "content", "elements", "corresponding", "to", "*", "text", "*", "to", "the", "<w", ":", "r", ">", "element", "*", "r", "*", "." ]
6756f6cd145511d3eb6d1d188beea391b1ddfd53
https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/oxml/text/run.py#L127-L134
train
Create a one - shot appender and append the text to the run content elements corresponding to r.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
python-openxml/python-docx
docx/oxml/text/run.py
_RunContentAppender.add_text
def add_text(self, text): """ Append the run content elements corresponding to *text* to the ``<w:r>`` element of this instance. """ for char in text: self.add_char(char) self.flush()
python
def add_text(self, text): """ Append the run content elements corresponding to *text* to the ``<w:r>`` element of this instance. """ for char in text: self.add_char(char) self.flush()
[ "def", "add_text", "(", "self", ",", "text", ")", ":", "for", "char", "in", "text", ":", "self", ".", "add_char", "(", "char", ")", "self", ".", "flush", "(", ")" ]
Append the run content elements corresponding to *text* to the ``<w:r>`` element of this instance.
[ "Append", "the", "run", "content", "elements", "corresponding", "to", "*", "text", "*", "to", "the", "<w", ":", "r", ">", "element", "of", "this", "instance", "." ]
6756f6cd145511d3eb6d1d188beea391b1ddfd53
https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/oxml/text/run.py#L136-L143
train
Append the run content elements corresponding to text to the base element of this instance.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
python-openxml/python-docx
docx/oxml/text/run.py
_RunContentAppender.add_char
def add_char(self, char): """ Process the next character of input through the translation finite state maching (FSM). There are two possible states, buffer pending and not pending, but those are hidden behind the ``.flush()`` method which must be called at the end of text to ensu...
python
def add_char(self, char): """ Process the next character of input through the translation finite state maching (FSM). There are two possible states, buffer pending and not pending, but those are hidden behind the ``.flush()`` method which must be called at the end of text to ensu...
[ "def", "add_char", "(", "self", ",", "char", ")", ":", "if", "char", "==", "'\\t'", ":", "self", ".", "flush", "(", ")", "self", ".", "_r", ".", "add_tab", "(", ")", "elif", "char", "in", "'\\r\\n'", ":", "self", ".", "flush", "(", ")", "self", ...
Process the next character of input through the translation finite state maching (FSM). There are two possible states, buffer pending and not pending, but those are hidden behind the ``.flush()`` method which must be called at the end of text to ensure any pending ``<w:t>`` element is wr...
[ "Process", "the", "next", "character", "of", "input", "through", "the", "translation", "finite", "state", "maching", "(", "FSM", ")", ".", "There", "are", "two", "possible", "states", "buffer", "pending", "and", "not", "pending", "but", "those", "are", "hidd...
6756f6cd145511d3eb6d1d188beea391b1ddfd53
https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/oxml/text/run.py#L145-L160
train
Add a character to the internal list of available items.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
python-openxml/python-docx
docx/opc/parts/coreprops.py
CorePropertiesPart.default
def default(cls, package): """ Return a new |CorePropertiesPart| object initialized with default values for its base properties. """ core_properties_part = cls._new(package) core_properties = core_properties_part.core_properties core_properties.title = 'Word Docum...
python
def default(cls, package): """ Return a new |CorePropertiesPart| object initialized with default values for its base properties. """ core_properties_part = cls._new(package) core_properties = core_properties_part.core_properties core_properties.title = 'Word Docum...
[ "def", "default", "(", "cls", ",", "package", ")", ":", "core_properties_part", "=", "cls", ".", "_new", "(", "package", ")", "core_properties", "=", "core_properties_part", ".", "core_properties", "core_properties", ".", "title", "=", "'Word Document'", "core_pro...
Return a new |CorePropertiesPart| object initialized with default values for its base properties.
[ "Return", "a", "new", "|CorePropertiesPart|", "object", "initialized", "with", "default", "values", "for", "its", "base", "properties", "." ]
6756f6cd145511d3eb6d1d188beea391b1ddfd53
https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/opc/parts/coreprops.py#L26-L37
train
Return a |CorePropertiesPart| object initialized with default values for its base properties.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
python-openxml/python-docx
docx/text/font.py
Font._get_bool_prop
def _get_bool_prop(self, name): """ Return the value of boolean child of `w:rPr` having *name*. """ rPr = self._element.rPr if rPr is None: return None return rPr._get_bool_val(name)
python
def _get_bool_prop(self, name): """ Return the value of boolean child of `w:rPr` having *name*. """ rPr = self._element.rPr if rPr is None: return None return rPr._get_bool_val(name)
[ "def", "_get_bool_prop", "(", "self", ",", "name", ")", ":", "rPr", "=", "self", ".", "_element", ".", "rPr", "if", "rPr", "is", "None", ":", "return", "None", "return", "rPr", ".", "_get_bool_val", "(", "name", ")" ]
Return the value of boolean child of `w:rPr` having *name*.
[ "Return", "the", "value", "of", "boolean", "child", "of", "w", ":", "rPr", "having", "*", "name", "*", "." ]
6756f6cd145511d3eb6d1d188beea391b1ddfd53
https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/text/font.py#L397-L404
train
Get the value of boolean child having name.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
python-openxml/python-docx
docx/text/font.py
Font._set_bool_prop
def _set_bool_prop(self, name, value): """ Assign *value* to the boolean child *name* of `w:rPr`. """ rPr = self._element.get_or_add_rPr() rPr._set_bool_val(name, value)
python
def _set_bool_prop(self, name, value): """ Assign *value* to the boolean child *name* of `w:rPr`. """ rPr = self._element.get_or_add_rPr() rPr._set_bool_val(name, value)
[ "def", "_set_bool_prop", "(", "self", ",", "name", ",", "value", ")", ":", "rPr", "=", "self", ".", "_element", ".", "get_or_add_rPr", "(", ")", "rPr", ".", "_set_bool_val", "(", "name", ",", "value", ")" ]
Assign *value* to the boolean child *name* of `w:rPr`.
[ "Assign", "*", "value", "*", "to", "the", "boolean", "child", "*", "name", "*", "of", "w", ":", "rPr", "." ]
6756f6cd145511d3eb6d1d188beea391b1ddfd53
https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/text/font.py#L406-L411
train
Assign value to the boolean child named name of the rPr.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
python-openxml/python-docx
docx/table.py
Table.add_column
def add_column(self, width): """ Return a |_Column| object of *width*, newly added rightmost to the table. """ tblGrid = self._tbl.tblGrid gridCol = tblGrid.add_gridCol() gridCol.w = width for tr in self._tbl.tr_lst: tc = tr.add_tc() ...
python
def add_column(self, width): """ Return a |_Column| object of *width*, newly added rightmost to the table. """ tblGrid = self._tbl.tblGrid gridCol = tblGrid.add_gridCol() gridCol.w = width for tr in self._tbl.tr_lst: tc = tr.add_tc() ...
[ "def", "add_column", "(", "self", ",", "width", ")", ":", "tblGrid", "=", "self", ".", "_tbl", ".", "tblGrid", "gridCol", "=", "tblGrid", ".", "add_gridCol", "(", ")", "gridCol", ".", "w", "=", "width", "for", "tr", "in", "self", ".", "_tbl", ".", ...
Return a |_Column| object of *width*, newly added rightmost to the table.
[ "Return", "a", "|_Column|", "object", "of", "*", "width", "*", "newly", "added", "rightmost", "to", "the", "table", "." ]
6756f6cd145511d3eb6d1d188beea391b1ddfd53
https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/table.py#L23-L34
train
Return a |_Column| object of * width* newly added rightmost to the table.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
python-openxml/python-docx
docx/table.py
Table.add_row
def add_row(self): """ Return a |_Row| instance, newly added bottom-most to the table. """ tbl = self._tbl tr = tbl.add_tr() for gridCol in tbl.tblGrid.gridCol_lst: tc = tr.add_tc() tc.width = gridCol.w return _Row(tr, self)
python
def add_row(self): """ Return a |_Row| instance, newly added bottom-most to the table. """ tbl = self._tbl tr = tbl.add_tr() for gridCol in tbl.tblGrid.gridCol_lst: tc = tr.add_tc() tc.width = gridCol.w return _Row(tr, self)
[ "def", "add_row", "(", "self", ")", ":", "tbl", "=", "self", ".", "_tbl", "tr", "=", "tbl", ".", "add_tr", "(", ")", "for", "gridCol", "in", "tbl", ".", "tblGrid", ".", "gridCol_lst", ":", "tc", "=", "tr", ".", "add_tc", "(", ")", "tc", ".", "w...
Return a |_Row| instance, newly added bottom-most to the table.
[ "Return", "a", "|_Row|", "instance", "newly", "added", "bottom", "-", "most", "to", "the", "table", "." ]
6756f6cd145511d3eb6d1d188beea391b1ddfd53
https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/table.py#L36-L45
train
Return a |_Row| instance newly added bottom - most to the table.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
python-openxml/python-docx
docx/table.py
Table.cell
def cell(self, row_idx, col_idx): """ Return |_Cell| instance correponding to table cell at *row_idx*, *col_idx* intersection, where (0, 0) is the top, left-most cell. """ cell_idx = col_idx + (row_idx * self._column_count) return self._cells[cell_idx]
python
def cell(self, row_idx, col_idx): """ Return |_Cell| instance correponding to table cell at *row_idx*, *col_idx* intersection, where (0, 0) is the top, left-most cell. """ cell_idx = col_idx + (row_idx * self._column_count) return self._cells[cell_idx]
[ "def", "cell", "(", "self", ",", "row_idx", ",", "col_idx", ")", ":", "cell_idx", "=", "col_idx", "+", "(", "row_idx", "*", "self", ".", "_column_count", ")", "return", "self", ".", "_cells", "[", "cell_idx", "]" ]
Return |_Cell| instance correponding to table cell at *row_idx*, *col_idx* intersection, where (0, 0) is the top, left-most cell.
[ "Return", "|_Cell|", "instance", "correponding", "to", "table", "cell", "at", "*", "row_idx", "*", "*", "col_idx", "*", "intersection", "where", "(", "0", "0", ")", "is", "the", "top", "left", "-", "most", "cell", "." ]
6756f6cd145511d3eb6d1d188beea391b1ddfd53
https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/table.py#L75-L81
train
Return |_Cell| instance correponding to table cell at row_idx col_idx intersection.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
python-openxml/python-docx
docx/table.py
Table.column_cells
def column_cells(self, column_idx): """ Sequence of cells in the column at *column_idx* in this table. """ cells = self._cells idxs = range(column_idx, len(cells), self._column_count) return [cells[idx] for idx in idxs]
python
def column_cells(self, column_idx): """ Sequence of cells in the column at *column_idx* in this table. """ cells = self._cells idxs = range(column_idx, len(cells), self._column_count) return [cells[idx] for idx in idxs]
[ "def", "column_cells", "(", "self", ",", "column_idx", ")", ":", "cells", "=", "self", ".", "_cells", "idxs", "=", "range", "(", "column_idx", ",", "len", "(", "cells", ")", ",", "self", ".", "_column_count", ")", "return", "[", "cells", "[", "idx", ...
Sequence of cells in the column at *column_idx* in this table.
[ "Sequence", "of", "cells", "in", "the", "column", "at", "*", "column_idx", "*", "in", "this", "table", "." ]
6756f6cd145511d3eb6d1d188beea391b1ddfd53
https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/table.py#L83-L89
train
Sequence of cells in the column at column_idx.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
python-openxml/python-docx
docx/table.py
Table.row_cells
def row_cells(self, row_idx): """ Sequence of cells in the row at *row_idx* in this table. """ column_count = self._column_count start = row_idx * column_count end = start + column_count return self._cells[start:end]
python
def row_cells(self, row_idx): """ Sequence of cells in the row at *row_idx* in this table. """ column_count = self._column_count start = row_idx * column_count end = start + column_count return self._cells[start:end]
[ "def", "row_cells", "(", "self", ",", "row_idx", ")", ":", "column_count", "=", "self", ".", "_column_count", "start", "=", "row_idx", "*", "column_count", "end", "=", "start", "+", "column_count", "return", "self", ".", "_cells", "[", "start", ":", "end",...
Sequence of cells in the row at *row_idx* in this table.
[ "Sequence", "of", "cells", "in", "the", "row", "at", "*", "row_idx", "*", "in", "this", "table", "." ]
6756f6cd145511d3eb6d1d188beea391b1ddfd53
https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/table.py#L99-L106
train
Returns a sequence of cells in the row at the given index.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
python-openxml/python-docx
docx/table.py
Table.style
def style(self): """ Read/write. A |_TableStyle| object representing the style applied to this table. The default table style for the document (often `Normal Table`) is returned if the table has no directly-applied style. Assigning |None| to this property removes any directly-app...
python
def style(self): """ Read/write. A |_TableStyle| object representing the style applied to this table. The default table style for the document (often `Normal Table`) is returned if the table has no directly-applied style. Assigning |None| to this property removes any directly-app...
[ "def", "style", "(", "self", ")", ":", "style_id", "=", "self", ".", "_tbl", ".", "tblStyle_val", "return", "self", ".", "part", ".", "get_style", "(", "style_id", ",", "WD_STYLE_TYPE", ".", "TABLE", ")" ]
Read/write. A |_TableStyle| object representing the style applied to this table. The default table style for the document (often `Normal Table`) is returned if the table has no directly-applied style. Assigning |None| to this property removes any directly-applied table style causing it t...
[ "Read", "/", "write", ".", "A", "|_TableStyle|", "object", "representing", "the", "style", "applied", "to", "this", "table", ".", "The", "default", "table", "style", "for", "the", "document", "(", "often", "Normal", "Table", ")", "is", "returned", "if", "t...
6756f6cd145511d3eb6d1d188beea391b1ddfd53
https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/table.py#L116-L129
train
A |_TableStyle| object representing the style applied to .
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
python-openxml/python-docx
docx/table.py
Table._cells
def _cells(self): """ A sequence of |_Cell| objects, one for each cell of the layout grid. If the table contains a span, one or more |_Cell| object references are repeated. """ col_count = self._column_count cells = [] for tc in self._tbl.iter_tcs(): ...
python
def _cells(self): """ A sequence of |_Cell| objects, one for each cell of the layout grid. If the table contains a span, one or more |_Cell| object references are repeated. """ col_count = self._column_count cells = [] for tc in self._tbl.iter_tcs(): ...
[ "def", "_cells", "(", "self", ")", ":", "col_count", "=", "self", ".", "_column_count", "cells", "=", "[", "]", "for", "tc", "in", "self", ".", "_tbl", ".", "iter_tcs", "(", ")", ":", "for", "grid_span_idx", "in", "range", "(", "tc", ".", "grid_span"...
A sequence of |_Cell| objects, one for each cell of the layout grid. If the table contains a span, one or more |_Cell| object references are repeated.
[ "A", "sequence", "of", "|_Cell|", "objects", "one", "for", "each", "cell", "of", "the", "layout", "grid", ".", "If", "the", "table", "contains", "a", "span", "one", "or", "more", "|_Cell|", "object", "references", "are", "repeated", "." ]
6756f6cd145511d3eb6d1d188beea391b1ddfd53
https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/table.py#L162-L178
train
A sequence of |_Cell| objects one for each cell of the layout grid.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
python-openxml/python-docx
docx/table.py
_Cell.add_paragraph
def add_paragraph(self, text='', style=None): """ Return a paragraph newly added to the end of the content in this cell. If present, *text* is added to the paragraph in a single run. If specified, the paragraph style *style* is applied. If *style* is not specified or is |None|, t...
python
def add_paragraph(self, text='', style=None): """ Return a paragraph newly added to the end of the content in this cell. If present, *text* is added to the paragraph in a single run. If specified, the paragraph style *style* is applied. If *style* is not specified or is |None|, t...
[ "def", "add_paragraph", "(", "self", ",", "text", "=", "''", ",", "style", "=", "None", ")", ":", "return", "super", "(", "_Cell", ",", "self", ")", ".", "add_paragraph", "(", "text", ",", "style", ")" ]
Return a paragraph newly added to the end of the content in this cell. If present, *text* is added to the paragraph in a single run. If specified, the paragraph style *style* is applied. If *style* is not specified or is |None|, the result is as though the 'Normal' style was applied. Not...
[ "Return", "a", "paragraph", "newly", "added", "to", "the", "end", "of", "the", "content", "in", "this", "cell", ".", "If", "present", "*", "text", "*", "is", "added", "to", "the", "paragraph", "in", "a", "single", "run", ".", "If", "specified", "the", ...
6756f6cd145511d3eb6d1d188beea391b1ddfd53
https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/table.py#L199-L211
train
Add a paragraph to the end of the content in this cell.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
python-openxml/python-docx
docx/table.py
_Cell.add_table
def add_table(self, rows, cols): """ Return a table newly added to this cell after any existing cell content, having *rows* rows and *cols* columns. An empty paragraph is added after the table because Word requires a paragraph element as the last element in every cell. ""...
python
def add_table(self, rows, cols): """ Return a table newly added to this cell after any existing cell content, having *rows* rows and *cols* columns. An empty paragraph is added after the table because Word requires a paragraph element as the last element in every cell. ""...
[ "def", "add_table", "(", "self", ",", "rows", ",", "cols", ")", ":", "width", "=", "self", ".", "width", "if", "self", ".", "width", "is", "not", "None", "else", "Inches", "(", "1", ")", "table", "=", "super", "(", "_Cell", ",", "self", ")", ".",...
Return a table newly added to this cell after any existing cell content, having *rows* rows and *cols* columns. An empty paragraph is added after the table because Word requires a paragraph element as the last element in every cell.
[ "Return", "a", "table", "newly", "added", "to", "this", "cell", "after", "any", "existing", "cell", "content", "having", "*", "rows", "*", "rows", "and", "*", "cols", "*", "columns", ".", "An", "empty", "paragraph", "is", "added", "after", "the", "table"...
6756f6cd145511d3eb6d1d188beea391b1ddfd53
https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/table.py#L213-L223
train
Add a table to this cell after any existing cell with rows and cols columns.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
python-openxml/python-docx
docx/table.py
_Cell.merge
def merge(self, other_cell): """ Return a merged cell created by spanning the rectangular region having this cell and *other_cell* as diagonal corners. Raises |InvalidSpanError| if the cells do not define a rectangular region. """ tc, tc_2 = self._tc, other_cell._tc ...
python
def merge(self, other_cell): """ Return a merged cell created by spanning the rectangular region having this cell and *other_cell* as diagonal corners. Raises |InvalidSpanError| if the cells do not define a rectangular region. """ tc, tc_2 = self._tc, other_cell._tc ...
[ "def", "merge", "(", "self", ",", "other_cell", ")", ":", "tc", ",", "tc_2", "=", "self", ".", "_tc", ",", "other_cell", ".", "_tc", "merged_tc", "=", "tc", ".", "merge", "(", "tc_2", ")", "return", "_Cell", "(", "merged_tc", ",", "self", ".", "_pa...
Return a merged cell created by spanning the rectangular region having this cell and *other_cell* as diagonal corners. Raises |InvalidSpanError| if the cells do not define a rectangular region.
[ "Return", "a", "merged", "cell", "created", "by", "spanning", "the", "rectangular", "region", "having", "this", "cell", "and", "*", "other_cell", "*", "as", "diagonal", "corners", ".", "Raises", "|InvalidSpanError|", "if", "the", "cells", "do", "not", "define"...
6756f6cd145511d3eb6d1d188beea391b1ddfd53
https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/table.py#L225-L233
train
Returns a merged cell with this and other_cell as diagonal corners. Raises |InvalidSpanError| if the rectangular region is not defined.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
python-openxml/python-docx
docx/parts/story.py
BaseStoryPart.get_or_add_image
def get_or_add_image(self, image_descriptor): """Return (rId, image) pair for image identified by *image_descriptor*. *rId* is the str key (often like "rId7") for the relationship between this story part and the image part, reused if already present, newly created if not. *image* is an ...
python
def get_or_add_image(self, image_descriptor): """Return (rId, image) pair for image identified by *image_descriptor*. *rId* is the str key (often like "rId7") for the relationship between this story part and the image part, reused if already present, newly created if not. *image* is an ...
[ "def", "get_or_add_image", "(", "self", ",", "image_descriptor", ")", ":", "image_part", "=", "self", ".", "_package", ".", "get_or_add_image_part", "(", "image_descriptor", ")", "rId", "=", "self", ".", "relate_to", "(", "image_part", ",", "RT", ".", "IMAGE",...
Return (rId, image) pair for image identified by *image_descriptor*. *rId* is the str key (often like "rId7") for the relationship between this story part and the image part, reused if already present, newly created if not. *image* is an |Image| instance providing access to the properties of th...
[ "Return", "(", "rId", "image", ")", "pair", "for", "image", "identified", "by", "*", "image_descriptor", "*", "." ]
6756f6cd145511d3eb6d1d188beea391b1ddfd53
https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/parts/story.py#L21-L31
train
Return rId image pair for image identified by image_descriptor.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
python-openxml/python-docx
docx/parts/story.py
BaseStoryPart.new_pic_inline
def new_pic_inline(self, image_descriptor, width, height): """Return a newly-created `w:inline` element. The element contains the image specified by *image_descriptor* and is scaled based on the values of *width* and *height*. """ rId, image = self.get_or_add_image(image_descrip...
python
def new_pic_inline(self, image_descriptor, width, height): """Return a newly-created `w:inline` element. The element contains the image specified by *image_descriptor* and is scaled based on the values of *width* and *height*. """ rId, image = self.get_or_add_image(image_descrip...
[ "def", "new_pic_inline", "(", "self", ",", "image_descriptor", ",", "width", ",", "height", ")", ":", "rId", ",", "image", "=", "self", ".", "get_or_add_image", "(", "image_descriptor", ")", "cx", ",", "cy", "=", "image", ".", "scaled_dimensions", "(", "wi...
Return a newly-created `w:inline` element. The element contains the image specified by *image_descriptor* and is scaled based on the values of *width* and *height*.
[ "Return", "a", "newly", "-", "created", "w", ":", "inline", "element", "." ]
6756f6cd145511d3eb6d1d188beea391b1ddfd53
https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/parts/story.py#L50-L59
train
Return a newly - created w : inline element.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
python-openxml/python-docx
docx/parts/story.py
BaseStoryPart.next_id
def next_id(self): """Next available positive integer id value in this story XML document. The value is determined by incrementing the maximum existing id value. Gaps in the existing id sequence are not filled. The id attribute value is unique in the document, without regard to the elem...
python
def next_id(self): """Next available positive integer id value in this story XML document. The value is determined by incrementing the maximum existing id value. Gaps in the existing id sequence are not filled. The id attribute value is unique in the document, without regard to the elem...
[ "def", "next_id", "(", "self", ")", ":", "id_str_lst", "=", "self", ".", "_element", ".", "xpath", "(", "'//@id'", ")", "used_ids", "=", "[", "int", "(", "id_str", ")", "for", "id_str", "in", "id_str_lst", "if", "id_str", ".", "isdigit", "(", ")", "]...
Next available positive integer id value in this story XML document. The value is determined by incrementing the maximum existing id value. Gaps in the existing id sequence are not filled. The id attribute value is unique in the document, without regard to the element type it appears on.
[ "Next", "available", "positive", "integer", "id", "value", "in", "this", "story", "XML", "document", "." ]
6756f6cd145511d3eb6d1d188beea391b1ddfd53
https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/parts/story.py#L62-L73
train
Returns the next available positive integer id value in this story XML document.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...