
    ch-(                        S S/r SSKJr  SSKJr  SSKJr  SSK	J
r
JrJrJr  SSKJr  SSKJrJrJr  SS	KJrJrJr  \(       a$  SS
KJr  SSKJr  SSKJr  SSKJr  SSK J!r!  SSK"J#r#  \S   r$ " S S \
5      r% " S S\%5      r&g)ObjectIndexObject    N)WorkTreeRepositoryUnsupported)	LazyMixin
bin_to_hexjoin_path_nativestream_copy   )get_object_type_by_name)AnyTYPE_CHECKINGUnion)AnyGitObjectGitObjectTypeStringPathLike)OStream)	Reference)Repo)Blob)	Submodule)Tree)r   r   r   c                     ^  \ rS rSr% SrSrSr\R                  \R                  \R                  \R                  4rSrSr\\S4   \S'    SS	S
\SS4U 4S jjr\SS	S\\S4   S\4S j5       r\SS	S\S\4S j5       rS\SS4U 4S jjrS\S\4S jrS\S\4S jrS\4S jrS\4S jr S\4S jr!\"S\4S j5       r#\"SS j5       r$SS jr%Sr&U =r'$ ) r   &   a  Base class for classes representing git object types.

The following four leaf classes represent specific kinds of git objects:

* :class:`Blob <git.objects.blob.Blob>`
* :class:`Tree <git.objects.tree.Tree>`
* :class:`Commit <git.objects.commit.Commit>`
* :class:`TagObject <git.objects.tag.TagObject>`

See :manpage:`gitglossary(7)` on:

* "object": https://git-scm.com/docs/gitglossary#def_object
* "object type": https://git-scm.com/docs/gitglossary#def_object_type
* "blob": https://git-scm.com/docs/gitglossary#def_blob_object
* "tree object": https://git-scm.com/docs/gitglossary#def_tree_object
* "commit object": https://git-scm.com/docs/gitglossary#def_commit_object
* "tag object": https://git-scm.com/docs/gitglossary#def_tag_object

:note:
    See the :class:`~git.types.AnyGitObject` union type of the four leaf subclasses
    that represent actual git object types.

:note:
    :class:`~git.objects.submodule.base.Submodule` is defined under the hierarchy
    rooted at this :class:`Object` class, even though submodules are not really a
    type of git object. (This also applies to its
    :class:`~git.objects.submodule.root.RootModule` subclass.)

:note:
    This :class:`Object` class should not be confused with :class:`object` (the root
    of the class hierarchy in Python).
(0000000000000000000000000000000000000000s                       )repobinshasizeNtyper   r   r   returnc                    > [         TU ]  5         Xl        X l        [	        U5      S:X  d   SU[	        U5      4-  5       eg)zInitialize an object by identifying it by its binary sha.

All keyword arguments will be set on demand if ``None``.

:param repo:
    Repository this object is located in.

:param binsha:
    20 byte SHA1
   z,Require 20 byte binary sha, got %r, len = %iN)super__init__r   r   len)selfr   r   	__class__s      cC:\Users\julio\OneDrive\Documentos\Trabajo\Ideas Frescas\venv\Lib\site-packages\git/objects/base.pyr#   Object.__init__d   sK     		6{b  	
"PKT
 #
 	
     idr   c                 6    UR                  [        U5      5      $ )a  
:return:
    New :class:`Object` instance of a type appropriate to the object type behind
    `id`. The id of the newly created object will be a binsha even though the
    input id may have been a :class:`~git.refs.reference.Reference` or rev-spec.

:param id:
    :class:`~git.refs.reference.Reference`, rev-spec, or hexsha.

:note:
    This cannot be a ``__new__`` method as it would always call :meth:`__init__`
    with the input id which is not necessarily a binsha.
)	rev_parsestr)clsr   r*   s      r'   new
Object.neww   s     ~~c"g&&r)   sha1c                     X R                   :X  a  [        S5      " X5      $ UR                  R                  U5      n[        UR                  5      " XR
                  5      nUR                  Ul        U$ )z
:return:
    New object instance of a type appropriate to represent the given binary sha1

:param sha1:
    20 byte binary sha1.
s   commit)NULL_BIN_SHAr   odbinfor   r   r   )r.   r   r1   oinfoinsts        r'   new_from_shaObject.new_from_sha   sY     ###*95dAAd#&uzz24FJJ	r)   attrc                    > US:X  aA  U R                   R                  R                  U R                  5      nUR                  U l        g[
        TU ]  U5        g)zRetrieve object information.r   N)r   r4   r5   r   r   r"   _set_cache_)r%   r:   r6   r&   s      r'   r<   Object._set_cache_   s>    6>IIMM&&t{{3E

DIG%r)   otherc                 X    [        US5      (       d  gU R                  UR                  :H  $ )z3:return: ``True`` if the objects have the same SHA1r   Fhasattrr   r%   r>   s     r'   __eq__Object.__eq__   s%    uh''{{ell**r)   c                 X    [        US5      (       d  gU R                  UR                  :g  $ )z::return: ``True`` if the objects do not have the same SHA1r   Tr@   rB   s     r'   __ne__Object.__ne__   s%    uh''{{ell**r)   c                 ,    [        U R                  5      $ )zE:return: Hash of our id allowing objects to be used in dicts and sets)hashr   r%   s    r'   __hash__Object.__hash__   s    DKK  r)   c                     U R                   $ )z=:return: String of our SHA1 as understood by all git commands)hexsharJ   s    r'   __str__Object.__str__   s    {{r)   c                 T    SU R                   R                  < SU R                  < S3$ )z::return: String with pythonic representation of our objectz<git.z "z">)r&   __name__rN   rJ   s    r'   __repr__Object.__repr__   s    "&.."9"94;;GGr)   c                 J    [        U R                  5      R                  S5      $ )z6:return: 40 byte hex version of our 20 byte binary shaascii)r   r   decoderJ   s    r'   rN   Object.hexsha   s     $++&--g66r)   c                 `    U R                   R                  R                  U R                  5      $ )z
:return:
    File-object compatible stream to the uncompressed raw data of the object

:note:
    Returned streams must be read in order.
)r   r4   streamr   rJ   s    r'   data_streamObject.data_stream   s!     yy}}##DKK00r)   c                 z    U R                   R                  R                  U R                  5      n[	        X!5        U $ )zWrite our data directly to the given output stream.

:param ostream:
    File-object compatible stream object.

:return:
    self
)r   r4   rZ   r   r	   )r%   ostreamistreams      r'   stream_dataObject.stream_data   s-     ))--&&t{{3G%r)   )r   r   r   )r   r   )r^   r   r   r   )(rR   
__module____qualname____firstlineno____doc__NULL_HEX_SHAr3   dbtypstr_blob_typestr_tree_typestr_commit_typestr_tag_typeTYPES	__slots__r   r   r   __annotations__bytesr#   classmethodr-   r   r/   r8   r<   r   boolrC   rF   intrK   rO   rS   propertyrN   r[   r`   __static_attributes____classcell__r&   s   @r'   r   r   &   sq   B LL 		E +I-1D%#T)
*1
V 
U 
t 
& 'v '5k)9#: '| ' '   e   "& & &+C +D ++C +D +!# ! H# H 7 7 7
 1 1 r)   c                      ^  \ rS rSrSrSrSr  SSSS\S	\S\	4   S\S\
4   S
S4
U 4S jjjrS
\	4S jrS\S
S4U 4S jjr\S
\4S j5       r\S
\
4S j5       rSrU =r$ )r      ai  Base for all objects that can be part of the index file.

The classes representing git object types that can be part of the index file are
:class:`~git.objects.tree.Tree` and :class:`~git.objects.blob.Blob`. In addition,
:class:`~git.objects.submodule.base.Submodule`, which is not really a git object
type but can be part of an index file, is also a subclass.
)pathmodery   Nr   r   r   rz   r   c                 J   > [         TU ]  X5        Ub  X0l        Ub  X@l        gg)a5  Initialize a newly instanced :class:`IndexObject`.

:param repo:
    The :class:`~git.repo.base.Repo` we are located in.

:param binsha:
    20 byte sha1.

:param mode:
    The stat-compatible file mode as :class:`int`.
    Use the :mod:`stat` module to evaluate the information.

:param path:
    The path to the file in the file system, relative to the git repository
    root, like ``file.ext`` or ``folder/other.ext``.

:note:
    Path may not be set if the index object has been created directly, as it
    cannot be retrieved without knowing the parent tree.
N)r"   r#   rz   ry   )r%   r   r   rz   ry   r&   s        r'   r#   IndexObject.__init__   s-    6 	&II r)   c                 ,    [        U R                  5      $ )zh
:return:
    Hash of our path as index items are uniquely identifiable by path, not by
    their data!
)rI   ry   rJ   s    r'   rK   IndexObject.__hash__  s     DIIr)   r:   c                    > U[         R                  ;   a'  [        SU< S[        U 5      R                  < S35      e[
        TU ]  U5        g )NzAttribute 'z<' unset: path and mode attributes must have been set during z object creation)r   rm   AttributeErrorr   rR   r"   r<   )r%   r:   r&   s     r'   r<   IndexObject._set_cache_  sA    ;((( d,,. 
 G%r)   c                 B    [         R                  " U R                  5      $ )zA:return: Name portion of the path, effectively being the basename)ospbasenamery   rJ   s    r'   nameIndexObject.name  s     ||DII&&r)   c                     U R                   R                  b*  [        U R                   R                  U R                  5      $ [	        S5      e)z
:return:
    Absolute path to this index object in the file system (as opposed to the
    :attr:`path` field which is a path relative to the git repository).

    The returned path will be native to the system and contains ``\`` on
    Windows.
z"working_tree_dir was None or empty)r   working_tree_dirr   ry   r   rJ   s    r'   abspathIndexObject.abspath   s;     99%%1#DII$>$>		JJ/0TUUr)   )rz   ry   )NN)rR   rb   rc   rd   re   rm   _id_attribute_ro   r   rr   r   r#   rK   r-   r<   rs   r   r   rt   ru   rv   s   @r'   r   r      s     !I N "&&*  D#I	
 D(N# 
 B# & & & 'c ' ' V V Vr)   )'__all__os.pathry   r   	gitdb.typtyprg   git.excr   git.utilr   r   r   r	   utilr   typingr   r   r   	git.typesr   r   r   
gitdb.baser   git.refs.referencer   git.repor   blobr   submodule.baser   treer   IndexObjUnionr   r    r)   r'   <module>r      sp    ]
#   1 I I ) - , A A",)12
pY pfTV& TVr)   