Skip to content

Commit

Permalink
pre-commit code formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
tkarna committed Nov 7, 2024
1 parent 4520d97 commit d5a7f5e
Show file tree
Hide file tree
Showing 6 changed files with 40 additions and 18 deletions.
6 changes: 3 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# See https://pre-commit.com/hooks.html for more hooks
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
rev: v5.0.0
hooks:
- id: check-ast
- id: check-builtin-literals
Expand All @@ -19,13 +19,13 @@ repos:
- id: trailing-whitespace
exclude: '.*\.patch'
- repo: https://github.com/psf/black
rev: 24.8.0
rev: 24.10.0
hooks:
- id: black
args: ["--line-length", "80"]
language_version: python3
- repo: https://github.com/PyCQA/bandit
rev: '1.7.9'
rev: '1.7.10'
hooks:
- id: bandit
args: ["-c", ".bandit.yml"]
Expand Down
2 changes: 1 addition & 1 deletion src/_sharpy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ void init(bool cw, const std::string &libidtr) {
VT(VT_begin, vtWaitSym); \
py::gil_scoped_release release; \
Service::run(); \
auto r = (_f).get().get()->_a(); \
auto r = (_f).get().get() -> _a(); \
VT(VT_end, vtWaitSym); \
return r

Expand Down
2 changes: 1 addition & 1 deletion src/idtr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -525,7 +525,7 @@ WaitHandleBase *_idtr_copy_reshape(SHARPY::DTypeId sharpytype,
if (isStrided) {
unpack(rBuff, sharpytype, oDataShapePtr, oDataStridesPtr, oNDims,
oDataPtr);
delete[](char *) rBuff;
delete[] (char *)rBuff;
}
};
assert(sendbuff.empty() && sszs.empty() && soffs.empty() && rszs.empty() &&
Expand Down
44 changes: 33 additions & 11 deletions src/include/sharpy/CppTypes.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,17 +63,39 @@ enum _RANKS : rank_type {
};

template <typename T> struct DTYPE {};
template <> struct DTYPE<double> { constexpr static DTypeId value = FLOAT64; };
template <> struct DTYPE<float> { constexpr static DTypeId value = FLOAT32; };
template <> struct DTYPE<int64_t> { constexpr static DTypeId value = INT64; };
template <> struct DTYPE<int32_t> { constexpr static DTypeId value = INT32; };
template <> struct DTYPE<int16_t> { constexpr static DTypeId value = INT16; };
template <> struct DTYPE<int8_t> { constexpr static DTypeId value = INT8; };
template <> struct DTYPE<uint64_t> { constexpr static DTypeId value = UINT64; };
template <> struct DTYPE<uint32_t> { constexpr static DTypeId value = UINT32; };
template <> struct DTYPE<uint16_t> { constexpr static DTypeId value = UINT16; };
template <> struct DTYPE<uint8_t> { constexpr static DTypeId value = UINT8; };
template <> struct DTYPE<bool> { constexpr static DTypeId value = BOOL; };
template <> struct DTYPE<double> {
constexpr static DTypeId value = FLOAT64;
};
template <> struct DTYPE<float> {
constexpr static DTypeId value = FLOAT32;
};
template <> struct DTYPE<int64_t> {
constexpr static DTypeId value = INT64;
};
template <> struct DTYPE<int32_t> {
constexpr static DTypeId value = INT32;
};
template <> struct DTYPE<int16_t> {
constexpr static DTypeId value = INT16;
};
template <> struct DTYPE<int8_t> {
constexpr static DTypeId value = INT8;
};
template <> struct DTYPE<uint64_t> {
constexpr static DTypeId value = UINT64;
};
template <> struct DTYPE<uint32_t> {
constexpr static DTypeId value = UINT32;
};
template <> struct DTYPE<uint16_t> {
constexpr static DTypeId value = UINT16;
};
template <> struct DTYPE<uint8_t> {
constexpr static DTypeId value = UINT8;
};
template <> struct DTYPE<bool> {
constexpr static DTypeId value = BOOL;
};

template <DTypeId DT> struct TYPE {};
template <> struct TYPE<FLOAT64> {
Expand Down
2 changes: 1 addition & 1 deletion test/test_manip.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@

import numpy
import pytest
from mpi4py import MPI
from utils import device, runAndCompare

import sharpy as sp
from mpi4py import MPI


class TestManip:
Expand Down
2 changes: 1 addition & 1 deletion test/test_spmd.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import numpy as np
import pytest
from mpi4py import MPI
from utils import device

import sharpy as sp
from mpi4py import MPI
from sharpy import _sharpy_cw


Expand Down

0 comments on commit d5a7f5e

Please sign in to comment.