Mercurial > hg
comparison mercurial/cffi/mpatchbuild.py @ 43076:2372284d9457
formatting: blacken the codebase
This is using my patch to black
(https://github.com/psf/black/pull/826) so we don't un-wrap collection
literals.
Done with:
hg files 'set:**.py - mercurial/thirdparty/** - "contrib/python-zstandard/**"' | xargs black -S
# skip-blame mass-reformatting only
# no-check-commit reformats foo_bar functions
Differential Revision: https://phab.mercurial-scm.org/D6971
author | Augie Fackler <augie@google.com> |
---|---|
date | Sun, 06 Oct 2019 09:45:02 -0400 |
parents | 0585337ea787 |
children | 687b865b95ad |
comparison
equal
deleted
inserted
replaced
43075:57875cf423c9 | 43076:2372284d9457 |
---|---|
2 | 2 |
3 import cffi | 3 import cffi |
4 import os | 4 import os |
5 | 5 |
6 ffi = cffi.FFI() | 6 ffi = cffi.FFI() |
7 mpatch_c = os.path.join(os.path.join(os.path.dirname(__file__), '..', | 7 mpatch_c = os.path.join( |
8 'mpatch.c')) | 8 os.path.join(os.path.dirname(__file__), '..', 'mpatch.c') |
9 ) | |
9 with open(mpatch_c) as f: | 10 with open(mpatch_c) as f: |
10 ffi.set_source("mercurial.cffi._mpatch", f.read(), | 11 ffi.set_source( |
11 include_dirs=["mercurial"]) | 12 "mercurial.cffi._mpatch", f.read(), include_dirs=["mercurial"] |
12 ffi.cdef(""" | 13 ) |
14 ffi.cdef( | |
15 """ | |
13 | 16 |
14 struct mpatch_frag { | 17 struct mpatch_frag { |
15 int start, end, len; | 18 int start, end, len; |
16 const char *data; | 19 const char *data; |
17 }; | 20 }; |
28 static int mpatch_apply(char *buf, const char *orig, size_t len, | 31 static int mpatch_apply(char *buf, const char *orig, size_t len, |
29 struct mpatch_flist *l); | 32 struct mpatch_flist *l); |
30 struct mpatch_flist *mpatch_fold(void *bins, | 33 struct mpatch_flist *mpatch_fold(void *bins, |
31 struct mpatch_flist* (*get_next_item)(void*, ssize_t), | 34 struct mpatch_flist* (*get_next_item)(void*, ssize_t), |
32 ssize_t start, ssize_t end); | 35 ssize_t start, ssize_t end); |
33 """) | 36 """ |
37 ) | |
34 | 38 |
35 if __name__ == '__main__': | 39 if __name__ == '__main__': |
36 ffi.compile() | 40 ffi.compile() |