Skip to content

Commit 0cdae8a

Browse files
committed
Test case covering local overrides
1 parent bbc8c8a commit 0cdae8a

File tree

15 files changed

+1452
-4
lines changed

15 files changed

+1452
-4
lines changed

e2e/MODULE.bazel

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,12 @@ uv.lockfile(
8383
lockfile = "//cases/uv-deps-650:uv-default.lock",
8484
venv_name = "default",
8585
)
86+
uv.override_requirement(
87+
hub_name = "pypi",
88+
venv_name = "default",
89+
requirement = "cowsay",
90+
target = "//cases/uv-deps-650/third_party/cowsay:cowsay",
91+
)
8692
uv.declare_venv(
8793
hub_name = "pypi",
8894
venv_name = "airflow",

e2e/cases/uv-deps-650/say/__test__.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22

33
import cowsay
44
print(cowsay.__file__)
5-
assert "cases/uv-deps-650/say/.say/" in cowsay.__file__
5+
assert "cases/uv-deps-650/third_party/cowsay" in cowsay.__file__
6+
7+
cowsay.servitor("Hello, world!")
68

79
import sys
810
assert sys.version_info.major == 3
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
load("@aspect_rules_py//py:defs.bzl", "py_library")
2+
3+
py_library(
4+
name = "cowsay",
5+
srcs = glob(["**/*.py"]),
6+
data = glob(["**/*"], exclude=["**/*.py"]),
7+
imports = ["."],
8+
visibility = ["//visibility:public"],
9+
)

e2e/cases/uv-deps-650/third_party/cowsay/cowsay-6.1.dist-info/LICENSE.txt

Lines changed: 674 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 179 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,179 @@
1+
Metadata-Version: 2.1
2+
Name: cowsay
3+
Version: 6.1
4+
Summary: The famous cowsay for GNU/Linux is now available for python
5+
Home-page: https://github.com/VaasuDevanS/cowsay-python
6+
Author: Vaasudevan Srinivasan
7+
Author-email: [email protected]
8+
License: GNU-GPL
9+
Classifier: Operating System :: OS Independent
10+
Classifier: Programming Language :: Python :: 3.8
11+
Classifier: Programming Language :: Python :: 3.9
12+
Classifier: Programming Language :: Python :: 3.10
13+
Classifier: Programming Language :: Python :: 3.11
14+
Classifier: Programming Language :: Python :: 3.12
15+
Requires-Python: >=3.8
16+
Description-Content-Type: text/markdown
17+
License-File: LICENSE.txt
18+
19+
20+
[![cowsay](https://github.com/VaasuDevanS/cowsay-python/actions/workflows/cowsay.yaml/badge.svg?branch=main)](https://github.com/VaasuDevanS/cowsay-python/actions/workflows/cowsay.yaml)
21+
[![codecov](https://codecov.io/gh/VaasuDevanS/cowsay-python/graph/badge.svg?token=GV4ntsCNtd)](https://codecov.io/gh/VaasuDevanS/cowsay-python)
22+
[![Codacy Badge](https://app.codacy.com/project/badge/Grade/d5a358f5dd5c41d68db8c331d65fd0fd)](https://app.codacy.com/gh/VaasuDevanS/cowsay-python/dashboard)
23+
![PyPI - Python Version](https://img.shields.io/pypi/pyversions/cowsay)
24+
[![Github](https://img.shields.io/badge/github-cowsay--python-blue)](https://github.com/VaasuDevanS/cowsay-python)
25+
<br>
26+
![](https://img.shields.io/badge/Latest%20Release-Sep%2025,%202023-blue)
27+
[![Downloads](https://static.pepy.tech/badge/cowsay)](https://pepy.tech/project/cowsay)
28+
[![Downloads](https://static.pepy.tech/badge/cowsay/month)](https://pepy.tech/project/cowsay)
29+
[![Downloads](https://static.pepy.tech/badge/cowsay/week)](https://pepy.tech/project/cowsay)
30+
31+
32+
# Introduction
33+
34+
A python API / Command-line tool for the famous linux `cowsay`. <br>
35+
Take a look at [CHANGELOG.md](https://github.com/VaasuDevanS/cowsay-python/blob/main/CHANGELOG.md) for the changes.
36+
37+
38+
# Brief History
39+
`cowsay` for GNU/Linux was initially written in perl by Tony Monroe. More info
40+
[here](https://en.wikipedia.org/wiki/Cowsay).
41+
42+
43+
# Installation
44+
```console
45+
pip install cowsay
46+
```
47+
48+
49+
# API Usage
50+
```console
51+
>>> import cowsay
52+
53+
>>> cowsay.cow('Hello World')
54+
___________
55+
| Hello World |
56+
===========
57+
\
58+
\
59+
^__^
60+
(oo)\_______
61+
(__)\ )\/\
62+
||----w |
63+
|| ||
64+
65+
66+
>>> print(cowsay.get_output_string('cow', 'Hello World'))
67+
___________
68+
| Hello World |
69+
===========
70+
\
71+
\
72+
^__^
73+
(oo)\_______
74+
(__)\ )\/\
75+
||----w |
76+
|| ||
77+
78+
79+
>>> cowsay.cow('Lorem ipsum dolor sit amet, consectetur adipiscing elit. Mauris blandit rhoncus nibh. Mauris mi mauris, molestie vel metus sit amet, aliquam vulputate nibh.')
80+
_________________________________________________
81+
/ \
82+
| Lorem ipsum dolor sit amet, consectetur adipiscin |
83+
| g elit. Mauris blandit rhoncus nibh. Mauris mi ma |
84+
| uris, molestie vel metus sit amet, aliquam vulput |
85+
| ate nibh. |
86+
\ /
87+
=================================================
88+
\
89+
\
90+
^__^
91+
(oo)\_______
92+
(__)\ )\/\
93+
||----w |
94+
|| ||
95+
96+
97+
>>> my_fish = r'''
98+
\
99+
\
100+
/`·.¸
101+
/¸...¸`:·
102+
¸.·´ ¸ `·.¸.·´)
103+
: © ):´; ¸ {
104+
`·.¸ `· ¸.·´\`·¸)
105+
`\\´´\¸.·´
106+
'''
107+
108+
>>> cowsay.draw('Sharks are my best friend', my_fish)
109+
_________________________
110+
| Sharks are my best friend |
111+
=========================
112+
\
113+
\
114+
/`·.¸
115+
/¸...¸`:·
116+
¸.·´ ¸ `·.¸.·´)
117+
: © ):´; ¸ {
118+
`·.¸ `· ¸.·´\`·¸)
119+
`\\´´\¸.·´
120+
```
121+
122+
123+
# Command Line Usage
124+
```console
125+
$ cowsay -t "Hello World"
126+
___________
127+
| Hello World |
128+
===========
129+
\
130+
\
131+
^__^
132+
(oo)\_______
133+
(__)\ )\/\
134+
||----w |
135+
|| ||
136+
137+
138+
$ cowsay -t "Hello World" -c "tux"
139+
___________
140+
| Hello World |
141+
===========
142+
\
143+
\
144+
\
145+
.--.
146+
|o_o |
147+
|:_/ |
148+
// \ \
149+
(| | )
150+
/'\_ _/`\
151+
\___)=(___/
152+
```
153+
154+
155+
# More Characters
156+
```console
157+
>>> cowsay.char_names
158+
['beavis', 'cheese', 'cow', 'daemon', 'dragon', 'fox', 'ghostbusters', 'kitty',
159+
'meow', 'miki', 'milk', 'octopus', 'pig', 'stegosaurus', 'stimpy', 'trex',
160+
'turkey', 'turtle', 'tux']
161+
162+
163+
>>> cowsay.char_funcs
164+
{'beavis': <function func at 0x104b734c0>,
165+
'cheese': <function func at 0x104d285e0>,
166+
...
167+
'tux': <function func at 0x104d28f70>}
168+
169+
170+
>>> len(cowsay.chars)
171+
19
172+
```
173+
174+
# Contributing
175+
<a href="https://github.com/VaasuDevanS/cowsay-python/graphs/contributors">
176+
<img src="https://contrib.rocks/image?repo=VaasuDevanS/cowsay-python&columns=5" />
177+
</a>
178+
179+
Guide: [CONTRIBUTING.md](https://github.com/VaasuDevanS/cowsay-python/blob/main/CONTRIBUTING.md)
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
cowsay/__init__.py,sha256=8Vp53KAFMgvd_w8Bh-jGzSPl2xryuQNrQcvhy1vYJhQ,450
2+
cowsay/__main__.py,sha256=swvEz9wm3O4NBe2vtGq7ddqeQMSKh4ZKX_g7KEIijsM,775
3+
cowsay/characters.py,sha256=SgA3F9HhmXxW70Eo9U65LHKDHkTNpOPUnpOjKuDMkiI,12259
4+
cowsay/main.py,sha256=ey_m3cRx03H-h1mzj9VJuSlS571ezpv_guFt5QSiZy8,1949
5+
cowsay/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
6+
cowsay/tests/solutions.py,sha256=TdLCxGUInzdiVXDGISKIb3Ieo4YvAeuIXgzzQ5EWk4M,38065
7+
cowsay/tests/test_api.py,sha256=fxd30i-M6J9BD56tMwVTnl5AJ1IDFImzkz5iIFoIAfQ,919
8+
cowsay/tests/test_output.py,sha256=gmag5R2mvQUBUSIqgM7spNVSRxwIUGo_iZT5SPuMUwM,1118
9+
cowsay-6.1.dist-info/LICENSE.txt,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
10+
cowsay-6.1.dist-info/METADATA,sha256=ZGNBeztPwPUT1m6Jqx5BqQJcrq5bUunu8sLxSEtQyWA,5581
11+
cowsay-6.1.dist-info/WHEEL,sha256=2wepM1nk4DS4eFpYrW1TTqPcoGNfHhhO_i5m4cOimbo,92
12+
cowsay-6.1.dist-info/entry_points.txt,sha256=eA4lDJ_wo3_jLsgyh0peu2yWkpFbr4malOVJtMGVJiw,47
13+
cowsay-6.1.dist-info/top_level.txt,sha256=45zxJRiJFquDz8AIvNLxZWersc80tEFX0iKLKG868Ck,7
14+
cowsay-6.1.dist-info/RECORD,,
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
Wheel-Version: 1.0
2+
Generator: bdist_wheel (0.38.4)
3+
Root-Is-Purelib: true
4+
Tag: py3-none-any
5+
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[console_scripts]
2+
cowsay = cowsay.__main__:cli
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
cowsay
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
from .main import (
2+
3+
__version__,
4+
5+
# Variables
6+
char_names,
7+
CHARS,
8+
9+
# Methods
10+
get_output_string,
11+
draw,
12+
13+
CowsayError,
14+
15+
)
16+
17+
# This is where we create functions for each character dynamically
18+
19+
char_funcs = {}
20+
21+
for ch_name, ch_lines in CHARS.items():
22+
23+
def func(text: str, char_lines=ch_lines):
24+
draw(str(text), char_lines)
25+
26+
func.__name__ = ch_name
27+
globals()[ch_name] = func
28+
char_funcs[ch_name] = func

0 commit comments

Comments
 (0)