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
| def mapInitArgs(cls, fromType, toType, translateFun): | |
| oldinit = cls.__init__ | |
| def newinit(self, *args, **kwargs): | |
| fields = cls.__dataclass_fields__ | |
| fieldIter = iter(fields) | |
| for pos,arg in enumerate(args): | |
| fieldName = next(fieldIter) | |
| if fields[fieldName].type is toType and type(arg) is fromType: | |
| args[pos] = translateFun(arg) |
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 pytest | |
| def checkHelper(value): | |
| assert list(value) == list('foo') | |
| @pytest.mark.parametrize("value", ( | |
| 'foo', | |
| 'far' | |
| )) | |
| def testInline(value): |
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
| from dataclasses import dataclass | |
| @dataclass | |
| class Vendor: | |
| pass | |
| """ | |
| mini45=None | |
| midi45=None | |
| maxi45=None |
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
| const path = require("path") | |
| const glob = require("glob") | |
| const fs = require("fs") | |
| const nodeEval = require("node-eval") | |
| /** Helper object to construct a map of named design docs from a path containing js scripts. | |
| * It populates couchdb design documents from js files targeting Spidermonkey 1.8.5 | |
| * | |
| * File paths like | |
| * * designdocs/map/priority.js |
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
| const testScriptType = "map" | |
| const testScriptId = "priority" | |
| const priorities = [ | |
| "!urgent", | |
| null, | |
| "!soon", | |
| "!normal", | |
| "!backlog", | |
| "!wishlist", | |
| ] |
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
| var priorities = [ | |
| "!urgent", | |
| null, | |
| "!soon", | |
| "!normal", | |
| "!backlog", | |
| "!wishlist", | |
| ] | |
| function getPriorityOrder(task) { |
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
| const { | |
| Loader | |
| } = require("./designdocs/loader") | |
| class CouchdbConfigurator{ | |
| constructor(dbHandle){ | |
| if( //duck-type check for nano db handle | |
| typeof dbHandle === "object" && | |
| typeof dbHandle.config === "object" && | |
| dbHandle.config.url && |
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
| #! /home/linuxbrew/.linuxbrew/opt/[email protected]/bin/python3.8 | |
| import os | |
| import math | |
| import shutil | |
| import requests | |
| from xml.etree import ElementTree | |
| def decimalMinuteString(decimalDegreeString, paddegrees): | |
| degrees = float(decimalDegreeString) |
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
| for (let x = 1; x <= 100; x++) { | |
| console.log( | |
| `${x % 3 === 0 ? "Fizz" : ""}${x % 5 === 0 ? "Buzz" : ""}` || x.toString() | |
| ); | |
| } |
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 releaseGlobalsPromise: null | Promise<void> = null; | |
| async function acquireGlobalsLock() { | |
| while (releaseGlobalsPromise) { | |
| await releaseGlobalsPromise; | |
| } | |
| let release!: () => void; | |
| releaseGlobalsPromise = new Promise( | |
| (resolve) => | |
| (release = () => { | |
| releaseGlobalsPromise = null; |