summaryrefslogtreecommitdiff
blob: a8ff7d107f9c40059143ce0198c753af0aae65dc (plain)
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
From eefc2db1adcfdd9afc1955c81d73dc3d32c65a57 Mon Sep 17 00:00:00 2001
From: Oz N Tiram <oz.tiram@gmail.com>
Date: Sun, 9 Jan 2022 23:52:06 +0100
Subject: [PATCH] Remove vendored first

While first is nice to have, it adds a lot of code in vendor.
This patch achieves the same with less code in vendor (~80 lines less).
---
 pipenv/core.py              |  4 +-
 pipenv/vendor/first.LICENSE | 19 ---------
 pipenv/vendor/first.py      | 78 -------------------------------------
 pipenv/vendor/vendor.txt    |  1 -
 4 files changed, 2 insertions(+), 100 deletions(-)
 delete mode 100644 pipenv/vendor/first.LICENSE
 delete mode 100644 pipenv/vendor/first.py

diff --git a/pipenv/core.py b/pipenv/core.py
index 92811f74..1c04047c 100644
--- a/pipenv/core.py
+++ b/pipenv/core.py
@@ -2525,7 +2525,6 @@ def do_check(
     args=None,
     pypi_mirror=None
 ):
-    from first import first
     from pipenv.vendor.vistir.compat import JSONDecodeError
 
     if not system:
@@ -2569,7 +2568,8 @@ def do_check(
     if not system:
         python = project._which("python")
     else:
-        python = first(system_which(p) for p in ("python", "python3", "python2"))
+        interpreters = [system_which(p) for p in ("python", "python3", "python2")]
+        python = interpreters[0] if interpreters else None
     if not python:
         click.echo(crayons.red("The Python interpreter can't be found."), err=True)
         sys.exit(1)
diff --git a/pipenv/vendor/first.LICENSE b/pipenv/vendor/first.LICENSE
deleted file mode 100644
index a9c8c9db..00000000
--- a/pipenv/vendor/first.LICENSE
+++ /dev/null
@@ -1,19 +0,0 @@
-Copyright (c) 2012 Hynek Schlawack
-
-Permission is hereby granted, free of charge, to any person obtaining a copy of
-this software and associated documentation files (the "Software"), to deal in
-the Software without restriction, including without limitation the rights to
-use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
-of the Software, and to permit persons to whom the Software is furnished to do
-so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-SOFTWARE.
diff --git a/pipenv/vendor/first.py b/pipenv/vendor/first.py
deleted file mode 100644
index 8cf9d2d1..00000000
--- a/pipenv/vendor/first.py
+++ /dev/null
@@ -1,78 +0,0 @@
-## -*- coding: utf-8 -*-
-
-"""
-first
-=====
-
-first is the function you always missed in Python.
-
-In the simplest case, it returns the first true element from an iterable:
-
->>> from first import first
->>> first([0, False, None, [], (), 42])
-42
-
-Or None if there is none:
-
->>> from first import first
->>> first([]) is None
-True
->>> first([0, False, None, [], ()]) is None
-True
-
-It also supports the passing of a key argument to help selecting the first
-match in a more advanced way.
-
->>> from first import first
->>> first([1, 1, 3, 4, 5], key=lambda x: x % 2 == 0)
-4
-
-:copyright: (c) 2012 by Hynek Schlawack.
-:license: MIT, see LICENSE for more details.
-
-"""
-
-__title__ = 'first'
-__version__ = '2.0.2'
-__author__ = 'Hynek Schlawack'
-__license__ = 'MIT'
-__copyright__ = 'Copyright 2012 Hynek Schlawack'
-
-
-def first(iterable, default=None, key=None):
-    """
-    Return first element of `iterable` that evaluates true, else return None
-    (or an optional default value).
-
-    >>> first([0, False, None, [], (), 42])
-    42
-
-    >>> first([0, False, None, [], ()]) is None
-    True
-
-    >>> first([0, False, None, [], ()], default='ohai')
-    'ohai'
-
-    >>> import re
-    >>> m = first(re.match(regex, 'abc') for regex in ['b.*', 'a(.*)'])
-    >>> m.group(1)
-    'bc'
-
-    The optional `key` argument specifies a one-argument predicate function
-    like that used for `filter()`.  The `key` argument, if supplied, must be
-    in keyword form.  For example:
-
-    >>> first([1, 1, 3, 4, 5], key=lambda x: x % 2 == 0)
-    4
-
-    """
-    if key is None:
-        for el in iterable:
-            if el:
-                return el
-    else:
-        for el in iterable:
-            if key(el):
-                return el
-
-    return default
diff --git a/pipenv/vendor/vendor.txt b/pipenv/vendor/vendor.txt
index 0530062e..3d7b39ea 100644
--- a/pipenv/vendor/vendor.txt
+++ b/pipenv/vendor/vendor.txt
@@ -10,7 +10,6 @@ colorama==0.4.4
 distlib==0.3.2
 docopt==0.6.2
 dparse==0.5.1
-first==2.0.2
 funcsigs==1.0.2
 idna==3.2
 importlib-metadata==4.6.1
-- 
2.32.0