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 builtins | |
| import inspect | |
| from enum import Enum | |
| class VarType(Enum): | |
| DICT = 1 | |
| LIST = 2 | |
| OBJECT = 3 | |
| FUNCTION = 4 |
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
| #!/usr/bin/env python | |
| import sys | |
| import pathlib | |
| import tomllib | |
| from setuptools import find_packages, setup | |
| WORK_DIR = pathlib.Path(__file__).parent | |
| # Check python version | |
| MINIMAL_PY_VERSION = (3, 10, 8) |
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
| static PyObject * | |
| BaseException_add_note(PyObject *self, PyObject *note) | |
| { | |
| if (!PyUnicode_Check(note)) { | |
| PyErr_Format(PyExc_TypeError, | |
| "note must be a str, not '%s'", | |
| Py_TYPE(note)->tp_name); | |
| return 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
| import sys | |
| import builtins | |
| class Exception311(BaseException): | |
| """ | |
| This is a fallback for exception behavior like in python 3.11 | |
| """ | |
| __notes__ = [] |
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
| 'use strict'; | |
| module.exports = leftPad; | |
| var cache = [ | |
| '', | |
| ' ', | |
| ' ', | |
| ' ', | |
| ' ', | |
| ' ', |
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
| #!/usr/bin/env bash | |
| ${1:?"Set file for editing or type --help for help"} | |
| if [ "$1" = "--help" ] | |
| then | |
| cat <<EOF | |
| Usage: | |
| edit file.name |
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
| javascript:(d=>{var css=`:root{background-color:#fefefe;filter:invert(100%)}*{background-color:inherit}img:not([src*=".svg"]),video{filter: invert(100%)}`,style,id="dark-theme-snippet",ee=d.getElementById(id);if(null!=ee)ee.parentNode.removeChild(ee);else {style = d.createElement('style');style.type="text/css";style.id=id;if(style.styleSheet)style.styleSheet.cssText=css;else style.appendChild(d.createTextNode(css));(d.head||d.querySelector('head')).appendChild(style)}})(document) |
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
| let singleton = Symbol(); | |
| let singletonEnforcer = Symbol(); | |
| class Singleton { | |
| constructor(enforcer) { | |
| if (enforcer !== singletonEnforcer) | |
| throw "Instantiation failed: use Singleton.getInstance() instead of new."; | |
| // код конструктора |
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
| (function(g){ | |
| /** @type {SingletonConstructor} */ | |
| var instance; | |
| g.Singleton = function() { | |
| if (instance !== void 0) return instance; | |
| return instance = this; | |
| }; | |
| g.Singleton.prototype.foo = 123; | |
| })(window||global); |
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
| class Instance { | |
| constructor(public foo: number = 123) {} | |
| } | |
| let instance = new Instance; | |
| export function getInstance() :Instance { | |
| return instance; | |
| } |
NewerOlder