New innovative programming disciplines, frameworks and products, I create new code.
I am a professional Python developer.
Asynchronous blackmagic & Witchcraft
License: Other
The interactive console should auto complete variable names when tab is pressed.
https://www.toptal.com/developers/hastebin/sohojozadu.py
I'm trying to run neumond/python-computer-craft with scarletio, but there's still some unimplemented methods, here's the code:
try:
from scarletio.ext import asyncio
except ImportError:
print("WARNING: Scarletio could not be imported! Performance may be degraded!")
from computercraft.server import main as ccserver
ccserver()
It is "more" & "intuitive", and not "more intuitive".
Can the HOME
and END
key be added? In most applications, HOME
moves the cursor to the start of the line and END
moves the cursor to the end, I use it a lot due to personal preference and it'd be nice ^^
On RichAttributeErrorBaseType
subclasses linters might be broken. By monkeypatching the getattr method it could be solved.
You're gonna hate this issue
Scarletio (and Hata) use an unorthodox code style that may be intimidating to contributors and users. I've decided to make this issue in an attempt to create a code styling convention that would be enforced throughout this codebase. A cleaner styling convention would increase readability and maintainability tenfold. I am willing refactor the codebase to implement a new coding style.
I propose that imports be sorted alphabetically, this can be done automatically by tools like isort.
Scarletio uses line continuations to break imports into multiple lines. I propose that all occurrences of line continuations be replaced by parenthesis.
Example:
from a import a, b, \
c, d, e, f, g
becomes
from a import (
a, b, c, d, e, f, g
)
Scarletio uses lots of unnecessary whitespace on blank lines and in-between function definitions in classes. In other areas is doesn't use enough whitespace. I propose that a flake8 compatible whitespace convention be adopted.
Note: This would also entail removing unnecessary indents from blank lines.
Example:
from math import log
MAGIC_NUMBER = 0x5f3759df
class Mathematician:
def __init__(self, name):
self.name = name
def q_sqrt(self, x):
# Definitely a real working Q_sqrt implementation.
return MAGIC_NUMBER-(x>>1)
becomes
from math import log
MAGIC_NUMBER = 0x5f3759df
class Mathematician:
def __init__(self, name):
self.name = name
def q_sqrt(self, x):
# Definitely a real working Q_sqrt implementation.
return MAGIC_NUMBER - (x >> 1)
Scarletio uses some unnecessary parenthesis in if statements. I propose that these unnecessary parenthesis be removed and that the end of multiline parenthesis be moved to match the indentation level.
Example:
if (not isinstance(x, ABC)) or (not isinstance(y, XYZ)):
raise TypeError('received invalid x'
'or invalid y')
becomes
if not isinstance(x, ABC) or not isinstance(y, XYZ):
raise TypeError(
'received invalid x or invalid y'
)
Scarletio reimplements some things that already exists in stdlib. I propose that such modules be deleted and that the stdlib modules be used instead.
Example:
print(code.CO_OPTIMIZED)
assert async_utils.is_coroutine_funciton(x)
print(utils.relative_index(y))
becomes
import inspect
import bisect
print(inspect.CO_OPTIMIZED)
assert inspect.iscoroutinefunction(x)
print(bisect.bisect(y))
Scarletio should have an option to turn on async debug mode.
Async debug mode would trace every future mutation. If required these actions could be displayed. By default these would be shown if a future is not completed as expected.
The feature can implemented on two ways:
This change would also require trace handling modifications, since it needs to store the trace. Long-time trace storing would require to ditch the frame itself to enable garbage collection.
Hata has https://github.com/HuyaneMatsu/hata/tree/master/hata/ext/asyncio to easily allow the user to use any asyncio library with scarletio, but this would really be more in place here instead, as well as allowing the user to use existing asyncio libraries easily too
There should be a way to host a server from the current process, that allows other processes to connect into it with an interactive console.
This would greatly improve debugging in case the execution context does not provide a way to run an interactive console on itself. (This is true when using containers.)
Additionally would help with collaboration, so multiple people can work on a single instance.
The server should run the code inputted by the client consoles.
The server stdout / stderr should be distributed between the clients.
The execution output should be returned to the clients as string / trace, so other consoles would not show that.
Console renders docstrings incorrectly. Potentially related to the highlighter.
The bug shows up while typing this:
class Pepe:
"""
The frog.
"""
Some exceptions might have multiple cause, but no builtin solution can resolve it.
Proposal:
raise Exception from CauseGroup(...)
The traceback renderer should pick up CauseGroup
as a special case and render the cause accordingly.
When an exception is raised with from None
, its context is still rendered. (It should not be.)
Frame representations should be rewritten, so we can un-allocate the frames, but keep the trace.
This would be useful to reserve traces of exceptions / tasks in case we want to render the trace later / elsewhere.
This is required for:
When long data is read by the editor to redirect, it is chunked to multiple parts. If the chunk is at the middle of a line, it will break the output.
Proposal:
If a not-ended line is read, cache it and it add it to the next read chunk's start.
When rendering trace decorator lines are not included.
We only include the lines from under if they are within the same expression, but as probably expected decorators do not have their own lines in bytecode either, instead they are bound the function or type definition's under them.
When using FutureSyncWrapper.wait
with propagate_cancellation = True
the task is cancelled, but no traceback of the cancellation is included. This means we can not debug the cancelled task.
As solutions, if the task is successfully cancelled, its cancellation traceback should be included.
If cancellation is unsuccessful, a RuntimeWarning should be used as cause.
This would need us to go back to the even loop for one more ready cycle.
Other solutions: Destroy the task if cancellation fails.
When pasting into scalretio repl, console prefixes should be auto removed if detectable.
Considerable usage & examples wanted. Mostly just a deign question.
Use io-like objects, like curio for example.
seems like new
is None
unless it uses black magic
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.