Not only does it make it clearer to the reader what the intent is behind
the code, it fixes MRO evaluation of classes if the parent-child
relationship is nonlinear.
Signed-off-by: Enji Cooper <yaneurabeya@gmail.com>
Sprinkle around `@staticmethod` where need be and raise
`NotImplementedError` from `Entry.GetInitializer` instead of doing
similar with `assert`. `NotImplementedError` will provide a hint to
static analyzers that there are abstract methods which need to be
implemented, if they aren't, in subclasses.
Signed-off-by: Enji Cooper <yaneurabeya@gmail.com>
This resolves a number of flake8 issues as well as pylint issues. Not
all of the changes mesh between flake8/pylint though, so there are some
false positives, but it's better than before.
Signed-off-by: Enji Cooper <yaneurabeya@gmail.com>
This change converts the existing code to use triple-quotes extensively,
in the end-goal of making the code to reformat with black more readable
before and after the change (black messes around with the formatting in
a less than desirable way).
Signed-off-by: Enji Cooper <yaneurabeya@gmail.com>
This change converts raw parsing with `sys.argv` to its equivalent logic
with `argparse`.
It doesn't fully convert over all of the TODO items listed in the
comments, but it does provide some top-level structure which can be used
to drive down further improvements and structure.
Signed-off-by: Enji Cooper <yaneurabeya@gmail.com>
This change boost performance at scale by pre-compiling regular
expressions in the global space, then reusing them many times within
functions.
This (while not the desired intent of the author) will boost
performance when parsing input.
Signed-off-by: Enji Cooper <yaneurabeya@gmail.com>
This is being done to clarify logic and isn't being done for performance
reasons whatsoever, as bools are derived from ints.
Signed-off-by: Enji Cooper <yaneurabeya@gmail.com>
Global variables should be in all caps, as opposed to lowercase.
While here, use named groups for `STRUCT_REF_RE` instead of numbered
groups to make the results and their indented tokens to parse more
intuitive to the end reader.
Signed-off-by: Enji Cooper <yaneurabeya@gmail.com>
Indentation for the exception was double what it should have been. This
change normalizes the indentation to a consistent standard with the rest
of the file.
Fix minor flake8 issues while here corresponding to the minimum number
of needed blank lines around the class and its methods.
Signed-off-by: Enji Cooper <yaneurabeya@gmail.com>
Use `filep` instead of `file` to clarify the fact that `file` is a file
pointer object.
This mutes warnings on python 2.7 with `pylint`.
Signed-off-by: Enji Cooper <yaneurabeya@gmail.com>
Move all logic under `if __name__ == "__main__"` to a `main(..)`
function.
The purpose of this is to not only address flake8/pylint reported issues
with variable names, but also to enable testing of the function in
isolation to ensure the logic acts as desired.
Signed-off-by: Enji Cooper <yaneurabeya@gmail.com>
First of all __func__ is not a macro, it is char[] array, so the code
that we had before in cmake, was incorrect, i.e.:
#if defined (__func__)
#define EVENT____func__ __func__
#elif defined(__FUNCTION__)
#define EVENT____func__ __FUNCTION__
#else
#define EVENT____func__ __FILE__
#endif
So just detect do we have __func__/__FUNCTION__ in configure/cmake
before build and define EVENT__HAVE___func__/EVENT__HAVE___FUNCTION__
to use the later to choose which should be used as a __func__ (if it is
not presented).
Closes: #644
==> netbsd: In file included from ../listener.c:57:0:
==> netbsd: ../util-internal.h:58:0: warning: "__func__" redefined [enabled by default]
==> netbsd: #define __func__ EVENT____func__
==> netbsd: ^
==> netbsd: In file included from /usr/include/amd64/types.h:39:0,
==> netbsd: from /usr/include/sys/types.h:45,
==> netbsd: from ../listener.c:30:
==> netbsd: /usr/include/sys/cdefs.h:394:0: note: this is the location of the previous definition
==> netbsd: #define __func__ __PRETTY_FUNCTION__
Before, running make > /dev/null would result in status information cluttering
the error log. This changes it so that event_rpcgen.py prints status
information to stdout like the rest of the build tools.
The old code would use type_var_add() for its side-effect of expanding the
array, then leak the new object that was added to the array.
The new code adds a static function to handle the array resizing.
This makes evprc setup more extensible, and helps with Shuo Chen's
work on implementing Google protocol buffers rpc on top of Libevent 2
evrpc.
This patch breaks binary compatibility with previous versions of
Libevent, since it changes struct evrpc and the signature of
evrpc_register_generic(). Since all compliant code should be calling
evrpc_register_generic via EVRPC_REGISTER, it shouldn't break source
compatibility.
(Code by Shuo Chen; commit message by Nick)
Others may remain. I wasn't able to get gcc --std=c89 to build libevent
at all, so I don't know what compiler the original reporter is using here.
Note that this change requires us to disable the part of our rpc code
that uses variadic macros when using a non-gcc compiler. This is a
problem if we want our rpc api to be portable.
svn:r1231
Stop using deprecated autoconf code to set integer types; detect actual files to include more thoroughly. This should make us work on solaris 9 again. This should be a backport candidate, if it works. Also, make all libevent code use ev_uint32_t etc, rather than uint_32_t.
svn:r649