from modules.config import Config
import json
import websocket
import _thread
import time
import rel
from functools import partial
def on_message(c, ws, message):
print(c.some_property) # Пример использования свойства объекта Config
print(message)
# Остальные функции on_error, on_close, on_open остаются без изменений
if __name__ == '__main__':
c = Config()
websocket.enableTrace(True)
ws = websocket.WebSocketApp("ws://echo.websocket.events",
on_open=on_open,
on_message=partial(on_message, c), # Передача объекта c через partial-функцию
on_error=on_error,
on_close=on_close)
ws.run_forever(dispatcher=rel,
reconnect=5)
rel.signal(2, rel.abort)
rel.dispatch()
for /F "tokens=*" %%i in (requirements.txt) do (
python.exe -m pip download --quiet --platform manylinux2014_x86_64 --platform linux_x86_64 --python-version 310 --platform any --only-binary=:all: -d \dist %%i
)
python -m pip install --no-deps -r requirements.txt --no-index --find-links /dist
import requests
from xml.etree import ElementTree
response = requests.get(
'https://s3-ap-northeast-1.amazonaws.com/data.binance.vision?delimiter=/&prefix=data/spot/monthly/klines/BTCUSDT/1h/')
print(response)
archive_tree = ElementTree.fromstring(response.content)
namespace = archive_tree.tag.split('}')[0].strip('{')
for files in archive_tree.iter(f'{{{namespace}}}Key'):
print(files.text)
<Response [200]>
data/spot/monthly/klines/BTCUSDT/1h/BTCUSDT-1h-2017-08.zip
data/spot/monthly/klines/BTCUSDT/1h/BTCUSDT-1h-2017-08.zip.CHECKSUM
data/spot/monthly/klines/BTCUSDT/1h/BTCUSDT-1h-2017-09.zip
data/spot/monthly/klines/BTCUSDT/1h/BTCUSDT-1h-2017-09.zip.CHECKSUM
data/spot/monthly/klines/BTCUSDT/1h/BTCUSDT-1h-2017-10.zip
data/spot/monthly/klines/BTCUSDT/1h/BTCUSDT-1h-2017-10.zip.CHECKSUM
...
~/.local/share/remmina
// xyz.h
class xyz
{
private:
int abc;
public:
PROJECT2_API int printing_int();
};
//xyz.cpp
PROJECT2_API int hyz::printing_int() { // return 5
return abc;
}
void printing(char* pChar) {
char a[] = "Example String";
strcpy_s(pChar, strlen(a) + 1, a);
}
int main() {
char[4] buff = {0};
printing(buff);
printf("%s\n", buff);
}
pfg@srv:~$ lsb_release -d
Description: Ubuntu 20.04
pfg@srv:~$ rar
RAR 5.50 Copyright (c) 1993-2017 Alexander Roshal 14 Jun 2017
Trial version Type 'rar -?' for help
class Relay
{
private $privateProperty;
public function __construct()
{
$this->privateProperty = new \stdClass();
}
// метод, который работает с приватным свойством
public function call()
{
return $this->privateProperty;
}
}
use PHPUnit\Framework\TestCase;
class RelayTest extends TestCase
{
public function testCall(): void
{
$reflectionClass = new \ReflectionClass(Relay::class);
$reflectionProperty = $reflectionClass->getProperty('privateProperty');
$reflectionProperty->setAccessible(true);
// создаем наш объект БЕЗ конструктора
$relay = $reflectionClass->newInstanceWithoutConstructor();
// Меняем свойство и вызываем метод, работающий с этим приватным полем
$reflectionProperty->setValue($relay, 1111);
self::assertEquals(1111, $relay->call());
// Меняем свойство и вызываем метод, работающий с этим приватным полем
$reflectionProperty->setValue($relay, 'aaaa');
self::assertEquals('aaaa', $relay->call());
}
}
class RelayTest extends TestCase
public function testCall(): void
{
/** @var Example $stub */
$stub = Stub::make(Relay::class, [
'privateProperty' => 1111,
]);
self::assertEquals(1111, $stub->call());
$stub = Stub::make(Relay::class, [
'privateProperty' => 'aaaa',
]);
self::assertEquals('aaaa', $stub->call());
}
}