This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Short answer: no—unittest.mock.patch itself is not inherently thread-safe, and there are only limited ways to make things effectively safe depending on what you mean by “thread-safe”. | |
| Why patching is not thread-safe | |
| patch() works by mutating global/module-level state (replacing an attribute with a mock, then restoring it later) . | |
| That creates a few problems in multithreaded scenarios: | |
| Global mutation: While a patch is active, all threads see the patched object. | |
| Timing/race issues: If multiple threads start/stop patches concurrently, they can overwrite or restore each other’s changes unpredictably. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import puppeteer from 'puppeteer'; | |
| // Or import puppeteer from 'puppeteer-core'; | |
| const SIGNIN_PAGE = "https://chat.deepseek.com/sign_in" | |
| const CHAT_PAGE = "https://chat.deepseek.com/chat" | |
| const SIGN_IN_MAIL = "Your dummy email" | |
| const SIGN_IN_PASSWORD = "your dummy password" | |
| const sleep = async (ms) => { | |
| return new Promise(resolve => setTimeout(resolve, ms)); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # import the time module | |
| import time | |
| from copy import copy | |
| class GridPoint: | |
| x: float | |
| y: float | |
| row: int | |
| col: int |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <script> | |
| (function () { | |
| var store = [] | |
| var timeout = null | |
| function checkDepsHaveLoadedForItem (item) { | |
| for(let i=0; i<item.deps.length; i++) { | |
| if(!window[item.deps[i]]) return false | |
| } | |
| return true |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| cli packages: (/home/led/Desktop/wattle/hc-app/cordova/app/node_modules) | |
| @ionic/cli-utils : 1.19.2 | |
| ionic (Ionic CLI) : 3.20.0 | |
| global packages: | |
| cordova (Cordova CLI) : 6.5.0 | |
| local packages: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| IncomingMessage { | |
| _readableState: | |
| ReadableState { | |
| objectMode: false, | |
| highWaterMark: 16384, | |
| buffer: BufferList { head: null, tail: null, length: 0 }, | |
| length: 0, | |
| pipes: null, | |
| pipesCount: 0, | |
| flowing: null, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Proto messages | |
| message TestMsg | |
| { | |
| bool param = 1; | |
| } | |
| // TEST wrapper | |
| message TheInnocentNotification | |
| { | |
| bool is_everything_ok = 1; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| v=0\r\no=- 1542507222416060282 2 IN IP4 127.0.0.1\r\ns=-\r\nt=0 0\r\na=group:BUNDLE audio video\r\na=msid-semantic: WMS\r\nm=audio 9 UDP/TLS/RTP/SAVPF 111 103 104 9 0 8 106 105 13 110 112 113 126\r\nc=IN IP4 0.0.0.0\r\na=rtcp:9 IN IP4 0.0.0.0\r\na=ice-ufrag:7/5h\r\na=ice-pwd:E2EzJ9BVV2JTQMqwTa5fq3wy\r\na=ice-options:trickle\r\na=fingerprint:sha-256 06:EA:34:D0:39:CA:77:9E:9D:75:BA:B6:ED:82:50:27:B6:77:88:04:55:D2:FD:DB:7F:8E:AA:03:D1:4B:9C:DF\r\na=setup:actpass\r\na=mid:audio\r\na=extmap:1 urn:ietf:params:rtp-hdrext:ssrc-audio-level\r\na=recvonly\r\na=rtcp-mux\r\na=rtpmap:111 opus/48000/2\r\na=rtcp-fb:111 transport-cc\r\na=fmtp:111 minptime=10;useinbandfec=1\r\na=rtpmap:103 ISAC/16000\r\na=rtpmap:104 ISAC/32000\r\na=rtpmap:9 G722/8000\r\na=rtpmap:0 PCMU/8000\r\na=rtpmap:8 PCMA/8000\r\na=rtpmap:106 CN/32000\r\na=rtpmap:105 CN/16000\r\na=rtpmap:13 CN/8000\r\na=rtpmap:110 telephone-event/48000\r\na=rtpmap:112 telephone-event/32000\r\na=rtpmap:113 telephone-event/16000\r\na=rtpmap:126 telephone-event/8000\r\nm=vi |