Skip to content

Commit

Permalink
Rename types::array into types::array_tuple so that types::array can …
Browse files Browse the repository at this point in the history
…be used normally

types::array_tuple is exactly what's it seems to be: a tuple of homogeneous
data that can be represented as an array.

types::array is the underlying type used to store array.ArrayType, currently
just an alias on types::list
  • Loading branch information
serge-sans-paille committed Aug 3, 2024
1 parent 2a59ec6 commit faff212
Show file tree
Hide file tree
Showing 1,139 changed files with 4,363 additions and 4,110 deletions.
2 changes: 1 addition & 1 deletion pythran/pythonic/__dispatch__/conjugate.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ namespace __dispatch__
{
return numpy::functor::conjugate{}(any);
}
}
} // namespace __dispatch__
PYTHONIC_NS_END

#endif
2 changes: 1 addition & 1 deletion pythran/pythonic/__dispatch__/copy.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ namespace __dispatch__
{
return any.copy();
}
}
} // namespace __dispatch__
PYTHONIC_NS_END

#endif
6 changes: 3 additions & 3 deletions pythran/pythonic/__dispatch__/count.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ namespace __dispatch__
{

template <class Any, class Value>
auto count(Any &&any, Value &&value)
-> decltype(any.count(std::forward<Value>(value)))
auto count(Any &&any,
Value &&value) -> decltype(any.count(std::forward<Value>(value)))
{
return any.count(std::forward<Value>(value));
}
}
} // namespace __dispatch__
PYTHONIC_NS_END

#endif
6 changes: 3 additions & 3 deletions pythran/pythonic/__dispatch__/pop.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ PYTHONIC_NS_BEGIN
namespace __dispatch__
{
template <class Any, class... Arg0>
auto pop(Any &&any, Arg0 &&... arg0)
-> decltype(any.pop(std::forward<Arg0>(arg0)...))
auto pop(Any &&any,
Arg0 &&...arg0) -> decltype(any.pop(std::forward<Arg0>(arg0)...))
{
return any.pop(std::forward<Arg0>(arg0)...);
}
}
} // namespace __dispatch__
PYTHONIC_NS_END

#endif
2 changes: 1 addition & 1 deletion pythran/pythonic/__dispatch__/remove.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ namespace __dispatch__
{
return any.remove(arg0);
}
}
} // namespace __dispatch__
PYTHONIC_NS_END

#endif
8 changes: 4 additions & 4 deletions pythran/pythonic/__dispatch__/sort.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,27 +12,27 @@ namespace __dispatch__
{

template <class T, class... Args>
auto sort(types::list<T> &l, Args &&... args)
auto sort(types::list<T> &l, Args &&...args)
-> decltype(pythonic::builtins::list::sort(l,
std::forward<Args>(args)...))
{
return pythonic::builtins::list::sort(l, std::forward<Args>(args)...);
}
template <class T, class... Args>
auto sort(types::list<T> &&l, Args &&... args)
auto sort(types::list<T> &&l, Args &&...args)
-> decltype(pythonic::builtins::list::sort(std::move(l),
std::forward<Args>(args)...))
{
return pythonic::builtins::list::sort(std::move(l),
std::forward<Args>(args)...);
}
template <class Any, class... Args>
types::none_type sort(Any &&any, Args &&... args)
types::none_type sort(Any &&any, Args &&...args)
{
return pythonic::numpy::ndarray::sort(std::forward<Any>(any),
std::forward<Args>(args)...);
}
}
} // namespace __dispatch__
PYTHONIC_NS_END

#endif
4 changes: 2 additions & 2 deletions pythran/pythonic/__dispatch__/update.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ namespace __dispatch__
{

template <class Any, class... Arg0>
auto update(Any &&any, Arg0 &&... arg0)
auto update(Any &&any, Arg0 &&...arg0)
-> decltype(any.update(std::forward<Arg0>(arg0)...))
{
return any.update(std::forward<Arg0>(arg0)...);
}
}
} // namespace __dispatch__
PYTHONIC_NS_END

#endif
6 changes: 3 additions & 3 deletions pythran/pythonic/array/array.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@ namespace array
{

template <char c>
types::list<typename details::typecodes<c>::type>
types::array<typename details::typecodes<c>::type>
array(std::integral_constant<char, c>)
{
return {};
}

template <char c, class E>
types::list<typename details::typecodes<c>::type>
array(std::integral_constant<char, c>, E&& elts)
types::array<typename details::typecodes<c>::type>
array(std::integral_constant<char, c>, E &&elts)
{
return {std::forward<E>(elts)};
}
Expand Down
4 changes: 2 additions & 2 deletions pythran/pythonic/bisect/bisect.hpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#ifndef PYTHONIC_BISECT_BISECT_HPP
#define PYTHONIC_BISECT_BISECT_HPP

#include "pythonic/include/bisect/bisect.hpp"
#include "pythonic/builtins/ValueError.hpp"
#include "pythonic/include/bisect/bisect.hpp"

#include "pythonic/utils/functor.hpp"

Expand All @@ -29,7 +29,7 @@ namespace bisect
throw types::ValueError("lo must be non-negative");
return std::distance(x.begin(), fun(x.begin() + lo, x.begin() + hi, a));
}
}
} // namespace bisect
PYTHONIC_NS_END

#endif
2 changes: 1 addition & 1 deletion pythran/pythonic/bisect/bisect_left.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ namespace bisect
return bisect(x, a, lo, hi,
std::lower_bound<typename X::const_iterator, A>);
}
}
} // namespace bisect
PYTHONIC_NS_END

#endif
2 changes: 1 addition & 1 deletion pythran/pythonic/bisect/bisect_right.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ namespace bisect
{
return bisect(x, a, lo, hi);
}
}
} // namespace bisect
PYTHONIC_NS_END

#endif
4 changes: 2 additions & 2 deletions pythran/pythonic/builtins/all.hpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#ifndef PYTHONIC_BUILTIN_ALL_HPP
#define PYTHONIC_BUILTIN_ALL_HPP

#include "pythonic/utils/functor.hpp"
#include "pythonic/include/builtins/all.hpp"
#include "pythonic/utils/functor.hpp"

PYTHONIC_NS_BEGIN

Expand All @@ -18,7 +18,7 @@ namespace builtins
return false;
return true;
}
}
} // namespace builtins
PYTHONIC_NS_END

#endif
2 changes: 1 addition & 1 deletion pythran/pythonic/builtins/any.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ namespace builtins
return true;
return false;
}
}
} // namespace builtins
PYTHONIC_NS_END

#endif
2 changes: 1 addition & 1 deletion pythran/pythonic/builtins/bin.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ namespace builtins
return res;
}
}
}
} // namespace builtins
PYTHONIC_NS_END

#endif
2 changes: 1 addition & 1 deletion pythran/pythonic/builtins/bool_.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ namespace builtins
}

template <class T, size_t N>
bool bool_::operator()(types::array<T, N> const &val) const
bool bool_::operator()(types::array_tuple<T, N> const &val) const
{
return N;
}
Expand Down
2 changes: 1 addition & 1 deletion pythran/pythonic/builtins/chr.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ namespace builtins
{
return types::str((char)v);
}
}
} // namespace builtins
PYTHONIC_NS_END

#endif
7 changes: 4 additions & 3 deletions pythran/pythonic/builtins/dict.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,10 @@ namespace builtins
}

template <class Iterable>
auto dict(Iterable &&iterable) -> types::dict<
typename std::decay<decltype(std::get<0>(*iterable.begin()))>::type,
typename std::decay<decltype(std::get<1>(*iterable.begin()))>::type>
auto dict(Iterable &&iterable)
-> types::dict<
typename std::decay<decltype(std::get<0>(*iterable.begin()))>::type,
typename std::decay<decltype(std::get<1>(*iterable.begin()))>::type>
{
types::dict<
typename std::decay<decltype(std::get<0>(*iterable.begin()))>::type,
Expand Down
2 changes: 1 addition & 1 deletion pythran/pythonic/builtins/dict/clear.hpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#ifndef PYTHONIC_BUILTIN_DICT_CLEAR_HPP
#define PYTHONIC_BUILTIN_DICT_CLEAR_HPP

#include "pythonic/include/builtins/dict/clear.hpp"
#include "pythonic/__dispatch__/clear.hpp"
#include "pythonic/include/builtins/dict/clear.hpp"

#endif
2 changes: 1 addition & 1 deletion pythran/pythonic/builtins/dict/copy.hpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#ifndef PYTHONIC_BUILTIN_DICT_COPY_HPP
#define PYTHONIC_BUILTIN_DICT_COPY_HPP

#include "pythonic/include/builtins/dict/copy.hpp"
#include "pythonic/__dispatch__/copy.hpp"
#include "pythonic/include/builtins/dict/copy.hpp"

#endif
8 changes: 4 additions & 4 deletions pythran/pythonic/builtins/dict/fromkeys.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@ namespace builtins
fromkeys(Iterable &&iter, V const &v)
{
types::dict<typename std::remove_reference<Iterable>::type::value_type,
V> D =
types::empty_dict(); // Allocate default capacity to dict
V>
D = types::empty_dict(); // Allocate default capacity to dict
for (auto const &i : iter)
D[i] = v;
return D;
}
}
}
} // namespace dict
} // namespace builtins
PYTHONIC_NS_END

#endif
6 changes: 3 additions & 3 deletions pythran/pythonic/builtins/dict/get.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@

#include "pythonic/include/builtins/dict/get.hpp"

#include "pythonic/types/dict.hpp"
#include "pythonic/types/NoneType.hpp"
#include "pythonic/types/dict.hpp"
#include "pythonic/utils/functor.hpp"

PYTHONIC_NS_BEGIN
Expand Down Expand Up @@ -32,8 +32,8 @@ namespace builtins
{
return default_;
}
}
}
} // namespace dict
} // namespace builtins
PYTHONIC_NS_END

#endif
6 changes: 3 additions & 3 deletions pythran/pythonic/builtins/dict/items.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@

#include "pythonic/include/builtins/dict/items.hpp"

#include "pythonic/include/utils/functor.hpp"
#include "pythonic/include/types/dict.hpp"
#include "pythonic/include/types/list.hpp"
#include "pythonic/include/utils/functor.hpp"

#include <tuple>

Expand All @@ -22,8 +22,8 @@ namespace builtins
{
return std::forward<D>(d).items();
}
}
}
} // namespace dict
} // namespace builtins
PYTHONIC_NS_END

#endif
4 changes: 2 additions & 2 deletions pythran/pythonic/builtins/dict/keys.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ namespace builtins
{
return std::forward<D>(d).keys();
}
}
}
} // namespace dict
} // namespace builtins
PYTHONIC_NS_END

#endif
2 changes: 1 addition & 1 deletion pythran/pythonic/builtins/dict/pop.hpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#ifndef PYTHONIC_BUILTIN_DICT_POP_HPP
#define PYTHONIC_BUILTIN_DICT_POP_HPP

#include "pythonic/include/builtins/dict/pop.hpp"
#include "pythonic/__dispatch__/pop.hpp"
#include "pythonic/include/builtins/dict/pop.hpp"

#endif
4 changes: 2 additions & 2 deletions pythran/pythonic/builtins/dict/popitem.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ namespace builtins
{
return std::forward<D>(d).popitem();
}
}
}
} // namespace dict
} // namespace builtins
PYTHONIC_NS_END

#endif
4 changes: 2 additions & 2 deletions pythran/pythonic/builtins/dict/setdefault.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ namespace builtins
{
return d.get(k);
}
}
}
} // namespace dict
} // namespace builtins
PYTHONIC_NS_END

#endif
2 changes: 1 addition & 1 deletion pythran/pythonic/builtins/dict/update.hpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#ifndef PYTHONIC_BUILTIN_DICT_UPDATE_HPP
#define PYTHONIC_BUILTIN_DICT_UPDATE_HPP

#include "pythonic/include/builtins/dict/update.hpp"
#include "pythonic/__dispatch__/update.hpp"
#include "pythonic/include/builtins/dict/update.hpp"

#endif
4 changes: 2 additions & 2 deletions pythran/pythonic/builtins/dict/values.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ namespace builtins
{
return std::forward<D>(d).values();
}
}
}
} // namespace dict
} // namespace builtins
PYTHONIC_NS_END

#endif
2 changes: 1 addition & 1 deletion pythran/pythonic/builtins/divmod.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ namespace builtins
{
return types::make_tuple(t0 / t1, t0 % t1);
}
}
} // namespace builtins
PYTHONIC_NS_END

#endif
Loading

0 comments on commit faff212

Please sign in to comment.