Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 11 additions & 9 deletions lib50/authentication.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import attr
import contextlib
import dataclasses
import enum
import os
import pexpect
Expand All @@ -20,16 +20,18 @@
_CREDENTIAL_SOCKET = Path("~/.git-credential-cache/lib50").expanduser()


@attr.s(slots=True)
@dataclasses.dataclass
class User:
"""An authenticated GitHub user that has write access to org/repo."""
name = attr.ib()
repo = attr.ib()
org = attr.ib()
passphrase = attr.ib(default=str)
email = attr.ib(default=attr.Factory(lambda self: f"{self.name}@users.noreply.github.com",
takes_self=True),
init=False)
name: str
repo: str
org: str
passphrase: str = ""
email: str = dataclasses.field(init=False)

def __post_init__(self):
self.email = f"{self.name}@users.noreply.github.com"


@contextlib.contextmanager
def authenticate(org, repo=None, auth_method=None):
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
license="GPLv3",
description="This is lib50, CS50's own internal library used in many of its tools.",
long_description="This is lib50, CS50's own internal library used in many of its tools.",
install_requires=["attrs>=18.1,<21", "packaging", "pexpect>=4.6,<5", "pyyaml<7", "requests>=2.13,<3", "setuptools", "termcolor>=1.1,<2", "jellyfish>=1,<2", "cryptography>=2.7"],
install_requires=["packaging", "pexpect>=4.6,<5", "pyyaml<7", "requests>=2.13,<3", "setuptools", "termcolor>=1.1,<2", "jellyfish>=1,<2", "cryptography>=2.7"],
extras_require = {
"develop": ["sphinx", "sphinx-autobuild", "sphinx_rtd_theme"]
},
Expand Down