geotom / free.dm-common Goto Github PK
View Code? Open in Web Editor NEWCore framework of free.dm
License: MIT License
Core framework of free.dm
License: MIT License
When exiting a server transport in Python 3.7, the transport does not inform active clients of shutdown and cancel their active read/write handlers
freedm/transport/server/base.py:135: RuntimeWarning: coroutine 'wait' was never awaited
When the freedm package is used as library it would be good if we throw a freedm related exception class with its own basic error handling and more specific meaning instead of general Python exceptions
This context manager should write to a temporary file and only if this works without an error, then we can replace the target file by the temporary file. This way we can assure we do never leave corrupted files.
One possibility is to use JSON-RPC (https://de.wikipedia.org/wiki/JSON-RPC) for for client-node and node-node communication. We can also use JSON-SCHEMA to validate RPC calls
If we need to iterate only once, it is better to use a generator expression instead of a normal list comprehension!
#Generator expression
(x*2 for x in range(256))
#List comprehension
[x*2 for x in range(256)]
By using list(generator_expr) we would get the same result when needed.
Check the code where we use comprehensions and replace these when possible (https://medium.freecodecamp.org/python-list-comprehensions-vs-generator-expressions-cef70ccb49db). Also look at Async comprehensions introduced with python 3.6
https://www.blog.pythonlibrary.org/2017/02/14/whats-new-in-python-asynchronous-comprehensions-generators/
#Todo
https://medium.freecodecamp.org/how-to-secure-your-websocket-connections-d0be0996c556
Let the project be checked by the https://pyup.io/ service to discover vulnerabilities in Python packages
Change normal strings to formatted literals
Annotate functions and variables with type hints
Introduce pathlib instead of string pathes
Check if we can make use of asynchronous generators/comprehensions
#Todo
Should we turn certain base classes (for now only the transport util classes) into ABC?
See: https://docs.python.org/3/library/abc.html
With the @AbstractMethod decorator we can clearly outline required template functions and properties in sub classes
Should be named package defaults, and not globals. We don't want to use globals or even name it like this
To avoid exceeding memory, we should read large messages or file uploads in a tempfile.SpooledTemporaryFile, that can get written on disk after a certain threshold.
See https://docs.python.org/3/library/tempfile.html#tempfile.SpooledTemporaryFile
The best might be to use SSL or SSH to protect the clear text communication
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.