diff --git a/packagename/example_c.pyx b/packagename/example_c.pyx deleted file mode 100644 index a9689a4e0..000000000 --- a/packagename/example_c.pyx +++ /dev/null @@ -1,38 +0,0 @@ -def primes(int imax): - """ - Returns prime numbers up to imax. - - Parameters - ---------- - imax: int - The number of primes to return. This should be less or equal to 10000. - - Returns - ------- - result: list - The list of prime numbers. - """ - - cdef int n, k, i - cdef int p[10001] - result = [] - k = 0 - n = 2 - i = 0 - - if imax > 10000: - raise ValueError("imax should be <= 10000") - - while len(result) < imax: - i = 0 - while i < k and n % p[i] != 0: - i = i + 1 - if i == k: - p[k] = n - k = k + 1 - result.append(n) - if k > 10000: - break - n = n + 1 - - return result diff --git a/packagename/example_mod.py b/packagename/example_mod.py deleted file mode 100644 index 57fcf4f9f..000000000 --- a/packagename/example_mod.py +++ /dev/null @@ -1,77 +0,0 @@ -def primes(imax): - """ - Returns prime numbers up to imax. - - Parameters - ---------- - imax: int - The number of primes to return. This should be less or equal to 10000. - - Returns - ------- - result: list - The list of prime numbers. - """ - - p = range(10000) - result = [] - k = 0 - n = 2 - - if imax > 10000: - raise ValueError("imax should be <= 10000") - - while len(result) < imax: - i = 0 - while i < k and n % p[i] != 0: - i = i + 1 - if i == k: - p[k] = n - k = k + 1 - result.append(n) - if k > 10000: - break - n = n + 1 - - return result - - -def do_primes(n, usecython=False): - if usecython: - from .example_c import primes as cprimes - print('Using cython-based primes') - return cprimes(n) - else: - print('Using pure python primes') - return primes(n) - - -def main(args=None): - - from astropy.utils.compat import argparse - from time import time - - parser = argparse.ArgumentParser(description='Process some integers.') - parser.add_argument('-c', '--use-cython', dest='cy', action='store_true', - help='Use the Cython-based Prime number generator.') - parser.add_argument('-t', '--timing', dest='time', action='store_true', - help='Time the Fibonacci generator.') - parser.add_argument('-p', '--print', dest='prnt', action='store_true', - help='Print all of the Prime numbers.') - parser.add_argument('n', metavar='N', type=int, - help='Get Prime numbers up to this number.') - - res = parser.parse_args(args) - - pre = time() - primes = do_primes(res.n, res.cy) - post = time() - - print('Found {0} prime numbers'.format(len(primes))) - print('Largest prime: {0}'.format(primes[-1])) - - if res.time: - print('Running time: {0} s'.format(post - pre)) - - if res.prnt: - print('Primes: {0}'.format(primes)) diff --git a/packagename/example_subpkg/__init__.py b/packagename/example_subpkg/__init__.py deleted file mode 100644 index 621b0a7cd..000000000 --- a/packagename/example_subpkg/__init__.py +++ /dev/null @@ -1,5 +0,0 @@ -""" -This is the docstring for the examplesubpkg package. Normally you would -have whatever.py files in this directory implementing some modules, but this -is just an example sub-package, so it doesn't actually do anything. -""" diff --git a/packagename/tests/test_example.py b/packagename/tests/test_example.py deleted file mode 100644 index 416a363eb..000000000 --- a/packagename/tests/test_example.py +++ /dev/null @@ -1,7 +0,0 @@ -def test_primes_c(): - from ..example_c import primes as primes_c - assert primes_c(10) == [2, 3, 5, 7, 11, 13, 17, 19, 23, 29] - -def test_primes(): - from ..example_mod import primes - assert primes(10) == [2, 3, 5, 7, 11, 13, 17, 19, 23, 29] diff --git a/scripts/script_example b/scripts/script_example deleted file mode 100755 index 22190d5d8..000000000 --- a/scripts/script_example +++ /dev/null @@ -1,7 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -"""An example command-line script""" - -import packagename.example_mod - -packagename.example_mod.main()