mirror of https://github.com/exaloop/codon.git
Spelling (#276)
* spelling: about Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com> * spelling: adopted Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com> * spelling: between Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com> * spelling: convenience Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com> * spelling: ellipsis Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com> * spelling: improve Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com> * spelling: indicates Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com> * spelling: intermediate Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com> * spelling: into Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com> * spelling: multiple Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com> * spelling: quartiles Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com> * spelling: reentrant Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com> * spelling: relevant Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com> * spelling: supports Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com> * spelling: reproducible Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com> * spelling: wrappers Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com> --------- Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>pull/380/head
parent
2d20e1b358
commit
e5e19a663a
|
@ -232,7 +232,7 @@ class Chaosgame(object):
|
|||
|
||||
def create_image_chaos(self, w, h, iterations, filename, rng_seed):
|
||||
# Always use the same sequence of random numbers
|
||||
# to get reproductible benchmark
|
||||
# to get reproducible benchmark
|
||||
random.seed(rng_seed)
|
||||
|
||||
im = [[1] * h for i in range(w)]
|
||||
|
|
|
@ -212,7 +212,7 @@ class Chaosgame(object):
|
|||
|
||||
def create_image_chaos(self, w, h, iterations, filename, rng_seed):
|
||||
# Always use the same sequence of random numbers
|
||||
# to get reproductible benchmark
|
||||
# to get reproducible benchmark
|
||||
random.seed(rng_seed)
|
||||
|
||||
im = [[1] * h for i in range(w)]
|
||||
|
|
|
@ -300,7 +300,7 @@ struct CaptureContext {
|
|||
};
|
||||
|
||||
// This visitor answers the questions of what vars are
|
||||
// releavant to track in a capturing expression. For
|
||||
// relevant to track in a capturing expression. For
|
||||
// example, in "a[i] = x", the expression "a[i]" captures
|
||||
// "x"; in this case we need to track "a" but the variable
|
||||
// "i" (typically) we would not care about.
|
||||
|
|
|
@ -387,16 +387,16 @@ CallExpr::CallExpr(ExprPtr expr, std::vector<ExprPtr> args)
|
|||
validate();
|
||||
}
|
||||
void CallExpr::validate() const {
|
||||
bool namesStarted = false, foundEllispis = false;
|
||||
bool namesStarted = false, foundEllipsis = false;
|
||||
for (auto &a : args) {
|
||||
if (a.name.empty() && namesStarted &&
|
||||
!(CAST(a.value, KeywordStarExpr) || a.value->getEllipsis()))
|
||||
E(Error::CALL_NAME_ORDER, a.value);
|
||||
if (!a.name.empty() && (a.value->getStar() || CAST(a.value, KeywordStarExpr)))
|
||||
E(Error::CALL_NAME_STAR, a.value);
|
||||
if (a.value->getEllipsis() && foundEllispis)
|
||||
if (a.value->getEllipsis() && foundEllipsis)
|
||||
E(Error::CALL_ELLIPSIS, a.value);
|
||||
foundEllispis |= bool(a.value->getEllipsis());
|
||||
foundEllipsis |= bool(a.value->getEllipsis());
|
||||
namesStarted |= !a.name.empty();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -383,7 +383,7 @@ struct TryStmt : public Stmt {
|
|||
struct ThrowStmt : public Stmt {
|
||||
ExprPtr expr;
|
||||
// True if a statement was transformed during type-checking stage
|
||||
// (to avoid setting up ExcHeader multuple times).
|
||||
// (to avoid setting up ExcHeader multiple times).
|
||||
bool transformed;
|
||||
|
||||
explicit ThrowStmt(ExprPtr expr, bool transformed = false);
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# Copyright (C) 2022 Exaloop Inc. <https://exaloop.io>
|
||||
# Codon PEG grammar
|
||||
# Adpoted from Python 3's PEG grammar (https://docs.python.org/3/reference/grammar.html)
|
||||
# Adopted from Python 3's PEG grammar (https://docs.python.org/3/reference/grammar.html)
|
||||
|
||||
# TODO: nice docstrs
|
||||
|
||||
|
|
|
@ -238,7 +238,7 @@ SimplifyVisitor::getImport(const std::vector<std::string> &chain) {
|
|||
for (auto i = chain.size(); i-- > importEnd;) {
|
||||
if (fctx->getModule() == "std.python" && importEnd < chain.size()) {
|
||||
// Special case: importing from Python.
|
||||
// Fake SimplifyItem that inidcates std.python access
|
||||
// Fake SimplifyItem that indicates std.python access
|
||||
val = std::make_shared<SimplifyItem>(SimplifyItem::Var, "", "",
|
||||
fctx->getModule(), std::vector<int>{});
|
||||
return {importEnd, val};
|
||||
|
|
|
@ -770,7 +770,7 @@ ExprPtr TypecheckVisitor::transformStaticLen(CallExpr *expr) {
|
|||
}
|
||||
|
||||
/// Transform hasattr method to a static boolean expression.
|
||||
/// This method also supports supports additional argument types that are used to check
|
||||
/// This method also supports additional argument types that are used to check
|
||||
/// for a matching overload (not available in Python).
|
||||
ExprPtr TypecheckVisitor::transformHasAttr(CallExpr *expr) {
|
||||
expr->staticValue.type = StaticValue::INT;
|
||||
|
|
|
@ -239,7 +239,7 @@ public:
|
|||
const std::string ValidateFoo::KEY = "validate-foo";
|
||||
```
|
||||
|
||||
Note that `insertAfter` is a conveience method of `Operator` that inserts the given node "after" the node
|
||||
Note that `insertAfter` is a convenience method of `Operator` that inserts the given node "after" the node
|
||||
being visited (along with `insertBefore` which inserts *before* the node being visited).
|
||||
|
||||
Running this pass on the snippet above, we would get:
|
||||
|
|
|
@ -177,7 +177,7 @@ module:
|
|||
|
||||
``` python
|
||||
from threading import Lock
|
||||
lock = Lock() # or RLock for re-entrant lock
|
||||
lock = Lock() # or RLock for reentrant lock
|
||||
|
||||
@par
|
||||
for i in range(100):
|
||||
|
|
|
@ -103,7 +103,7 @@ after 3 years.
|
|||
|
||||
## How can I use Codon for production or commercial use?
|
||||
|
||||
Please reach out to [info@exaloop.io](mailto:info@exaloop.io) to inquire about about a
|
||||
Please reach out to [info@exaloop.io](mailto:info@exaloop.io) to inquire about a
|
||||
production-use license.
|
||||
|
||||
# Contributing
|
||||
|
|
|
@ -151,7 +151,7 @@ def quantiles(
|
|||
|
||||
Set *n* to 4 for quartiles (the default). Set *n* to 10 for deciles.
|
||||
Set *n* to 100 for percentiles which gives the 99 cuts points that
|
||||
separate *data* in to 100 equal sized groups.
|
||||
separate *data* into 100 equal sized groups.
|
||||
|
||||
The *data* can be any iterable containing sample.
|
||||
The cut points are linearly interpolated between data points.
|
||||
|
@ -190,7 +190,7 @@ def quantiles(
|
|||
|
||||
def _lcm(x: int, y: int):
|
||||
"""
|
||||
Returns the lowest common multiple bewteen x and y
|
||||
Returns the lowest common multiple between x and y
|
||||
"""
|
||||
greater = 0
|
||||
if x > y:
|
||||
|
@ -563,7 +563,7 @@ class NormalDist:
|
|||
|
||||
Set *n* to 4 for quartiles (the default). Set *n* to 10 for deciles.
|
||||
Set *n* to 100 for percentiles which gives the 99 cuts points that
|
||||
separate the normal distribution in to 100 equal sized groups.
|
||||
separate the normal distribution into 100 equal sized groups.
|
||||
"""
|
||||
return [self.inv_cdf(float(i) / float(n)) for i in range(1, n)]
|
||||
|
||||
|
|
|
@ -1023,7 +1023,7 @@ print list(foo(*args)) == result #: False
|
|||
|
||||
|
||||
#%% type_error_reporting
|
||||
# TODO: imporove this certainly
|
||||
# TODO: improve this certainly
|
||||
def tee(iterable, n=2):
|
||||
from collections import deque
|
||||
it = iter(iterable)
|
||||
|
@ -1160,7 +1160,7 @@ print t(6, Optional(1)) #! 'Optional[int]' does not match expected type 'Optiona
|
|||
#%% traits_error_2,barebones
|
||||
z: Callable[[int],int] = 4 #! 'Callable[[int],int]' does not match expected type 'int'
|
||||
|
||||
#%% assign_wrapers,barebones
|
||||
#%% assign_wrappers,barebones
|
||||
a = 1.5
|
||||
print a #: 1.5
|
||||
if 1:
|
||||
|
|
|
@ -84,9 +84,9 @@ def test_combinations():
|
|||
[0, 2, 3],
|
||||
[1, 2, 3],
|
||||
]
|
||||
test_intermediat = itertools.combinations(range(4), 3)
|
||||
next(test_intermediat)
|
||||
assert list(test_intermediat) == [[0, 1, 3], [0, 2, 3], [1, 2, 3]]
|
||||
test_intermediate = itertools.combinations(range(4), 3)
|
||||
next(test_intermediate)
|
||||
assert list(test_intermediate) == [[0, 1, 3], [0, 2, 3], [1, 2, 3]]
|
||||
|
||||
|
||||
@test
|
||||
|
|
|
@ -393,7 +393,7 @@ test_inv_cdf()
|
|||
|
||||
|
||||
@test
|
||||
def test_ND_qualtiles():
|
||||
def test_ND_quartiles():
|
||||
PRECISION = 1e-6
|
||||
Z = statistics.NormalDist(0.0, 1.0)
|
||||
for n, expected in [
|
||||
|
@ -406,7 +406,7 @@ def test_ND_qualtiles():
|
|||
assert math.fabs(actual[i] - expected[i]) < PRECISION
|
||||
|
||||
|
||||
test_ND_qualtiles()
|
||||
test_ND_quartiles()
|
||||
|
||||
|
||||
@test
|
||||
|
|
Loading…
Reference in New Issue