扫码登录,获取cookies
This commit is contained in:
12
backend/venv/Lib/site-packages/hypothesis/utils/__init__.py
Normal file
12
backend/venv/Lib/site-packages/hypothesis/utils/__init__.py
Normal file
@@ -0,0 +1,12 @@
|
||||
# This file is part of Hypothesis, which may be found at
|
||||
# https://github.com/HypothesisWorks/hypothesis/
|
||||
#
|
||||
# Copyright the Hypothesis Authors.
|
||||
# Individual contributors are listed in AUTHORS.rst and the git log.
|
||||
#
|
||||
# This Source Code Form is subject to the terms of the Mozilla Public License,
|
||||
# v. 2.0. If a copy of the MPL was not distributed with this file, You can
|
||||
# obtain one at https://mozilla.org/MPL/2.0/.
|
||||
|
||||
"""hypothesis.utils is a package for things that you can consider part of the
|
||||
semi-public Hypothesis API but aren't really the core point."""
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,23 @@
|
||||
# This file is part of Hypothesis, which may be found at
|
||||
# https://github.com/HypothesisWorks/hypothesis/
|
||||
#
|
||||
# Copyright the Hypothesis Authors.
|
||||
# Individual contributors are listed in AUTHORS.rst and the git log.
|
||||
#
|
||||
# This Source Code Form is subject to the terms of the Mozilla Public License,
|
||||
# v. 2.0. If a copy of the MPL was not distributed with this file, You can
|
||||
# obtain one at https://mozilla.org/MPL/2.0/.
|
||||
|
||||
|
||||
class UniqueIdentifier:
|
||||
"""A factory for sentinel objects with nice reprs."""
|
||||
|
||||
def __init__(self, identifier):
|
||||
self.identifier = identifier
|
||||
|
||||
def __repr__(self):
|
||||
return self.identifier
|
||||
|
||||
|
||||
infer = ...
|
||||
not_set = UniqueIdentifier("not_set")
|
||||
@@ -0,0 +1,35 @@
|
||||
# This file is part of Hypothesis, which may be found at
|
||||
# https://github.com/HypothesisWorks/hypothesis/
|
||||
#
|
||||
# Copyright the Hypothesis Authors.
|
||||
# Individual contributors are listed in AUTHORS.rst and the git log.
|
||||
#
|
||||
# This Source Code Form is subject to the terms of the Mozilla Public License,
|
||||
# v. 2.0. If a copy of the MPL was not distributed with this file, You can
|
||||
# obtain one at https://mozilla.org/MPL/2.0/.
|
||||
|
||||
import threading
|
||||
from contextlib import contextmanager
|
||||
|
||||
|
||||
class DynamicVariable:
|
||||
def __init__(self, default):
|
||||
self.default = default
|
||||
self.data = threading.local()
|
||||
|
||||
@property
|
||||
def value(self):
|
||||
return getattr(self.data, "value", self.default)
|
||||
|
||||
@value.setter
|
||||
def value(self, value):
|
||||
self.data.value = value
|
||||
|
||||
@contextmanager
|
||||
def with_value(self, value):
|
||||
old_value = self.value
|
||||
try:
|
||||
self.data.value = value
|
||||
yield
|
||||
finally:
|
||||
self.data.value = old_value
|
||||
37
backend/venv/Lib/site-packages/hypothesis/utils/terminal.py
Normal file
37
backend/venv/Lib/site-packages/hypothesis/utils/terminal.py
Normal file
@@ -0,0 +1,37 @@
|
||||
# This file is part of Hypothesis, which may be found at
|
||||
# https://github.com/HypothesisWorks/hypothesis/
|
||||
#
|
||||
# Copyright the Hypothesis Authors.
|
||||
# Individual contributors are listed in AUTHORS.rst and the git log.
|
||||
#
|
||||
# This Source Code Form is subject to the terms of the Mozilla Public License,
|
||||
# v. 2.0. If a copy of the MPL was not distributed with this file, You can
|
||||
# obtain one at https://mozilla.org/MPL/2.0/.
|
||||
|
||||
import os
|
||||
|
||||
|
||||
def guess_background_color():
|
||||
"""Returns one of "dark", "light", or "unknown".
|
||||
|
||||
This is basically just guessing, but better than always guessing "dark"!
|
||||
See also https://stackoverflow.com/questions/2507337/ and
|
||||
https://unix.stackexchange.com/questions/245378/
|
||||
"""
|
||||
django_colors = os.getenv("DJANGO_COLORS", "")
|
||||
for theme in ("light", "dark"):
|
||||
if theme in django_colors.split(";"):
|
||||
return theme
|
||||
# Guessing based on the $COLORFGBG environment variable
|
||||
try:
|
||||
fg, *_, bg = os.getenv("COLORFGBG").split(";")
|
||||
except Exception:
|
||||
pass
|
||||
else:
|
||||
# 0=black, 7=light-grey, 15=white ; we don't interpret other colors
|
||||
if fg in ("7", "15") and bg == "0":
|
||||
return "dark"
|
||||
elif fg == "0" and bg in ("7", "15"):
|
||||
return "light"
|
||||
# TODO: Guessing based on the xterm control sequence
|
||||
return "unknown"
|
||||
Reference in New Issue
Block a user