FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
GitPython/lib/git/actor.py at 0.1 · og-python-scripts/GitPython · GitHub
og-python-scripts
GitPython
Repository navigation
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
GitPython
/
lib
/
git
/
actor.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
42 lines (34 loc) · 1.16 KB
Breadcrumbs
GitPython
/
lib
/
git
/
actor.py
Copy path
File metadata and controls
42 lines (34 loc) · 1.16 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# actor.py
# Copyright (C) 2008-2010 Michael Trier (mtrier@gmail.com) and contributors
#
# This module is part of GitPython and is released under
# the BSD License: http://www.opensource.org/licenses/bsd-license.php
import
re
class
Actor
(
object
):
"""Actors hold information about a person acting on the repository. They
can be committers and authors or anything with a name and an email as
mentioned in the git log entries."""
def
__init__
(
self
,
name
,
email
):
self
.
name
=
name
self
.
email
=
email
def
__str__
(
self
):
return
self
.
name
def
__repr__
(
self
):
return
'<git.Actor "%s <%s>">'
%
(
self
.
name
,
self
.
email
)
@
classmethod
def
from_string
(
cls
,
string
):
"""
Create an Actor from a string.
``str``
is the string, which is expected to be in regular git format
Format
John Doe <jdoe@example.com>
Returns
Actor
"""
if
re
.
search
(
r'<.+>'
,
string
):
m
=
re
.
search
(
r'(.*) <(.+?)>'
,
string
)
name
,
email
=
m
.
groups
()
return
Actor
(
name
,
email
)
else
:
return
Actor
(
string
,
None
)
Back
|
FazBrowse Home
|
New Git URL