mirror of
https://github.com/flancian/garden.git
synced 2026-08-07 23:16:21 +00:00
autopushed
This commit is contained in:
+1
-8
@@ -10,13 +10,6 @@ import math
|
|||||||
# I'm not proud (I am a little bit?).
|
# I'm not proud (I am a little bit?).
|
||||||
PROOF = [] # :)
|
PROOF = [] # :)
|
||||||
|
|
||||||
class RichGroup(click.Group):
|
|
||||||
def format_help(self, ctx, formatter):
|
|
||||||
sio = io.StringIO()
|
|
||||||
console = rich.Console(file=sio, force_terminal=True)
|
|
||||||
console.print("Hello, [bold magenta]World[/bold magenta]!", ":vampire:")
|
|
||||||
formatter.write(sio.getvalue())
|
|
||||||
|
|
||||||
def factor(n):
|
def factor(n):
|
||||||
for i in range(2, n+1):
|
for i in range(2, n+1):
|
||||||
click.echo(f"Is {i} a factor of {n}, I wonder?")
|
click.echo(f"Is {i} a factor of {n}, I wonder?")
|
||||||
@@ -47,7 +40,7 @@ def is_prime(n):
|
|||||||
# click.echo(f"Sieve: {is_prime}.")
|
# click.echo(f"Sieve: {is_prime}.")
|
||||||
return is_prime[n]
|
return is_prime[n]
|
||||||
|
|
||||||
@click.group(cls=RichGroup)
|
@click.command(cls=AgoraCommand)
|
||||||
@click.argument('n', type=click.INT)
|
@click.argument('n', type=click.INT)
|
||||||
def prime(n):
|
def prime(n):
|
||||||
"""Simple program that factors a number using a [[Sieve of Eratosthenes]]."""
|
"""Simple program that factors a number using a [[Sieve of Eratosthenes]]."""
|
||||||
|
|||||||
Reference in New Issue
Block a user