def _parse_id(uid)
if not instanceof(uid, UUID):
uid = UUID(uid)
return uid
This file contains 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
# Minimal reproduction of | |
# "the [include_in_root] parameter can't be updated on a nested object mapping" | |
# When that error would not be expected | |
# | |
# Seems to happen with `settings.index.number_of_shards` > 1 | |
# | |
# Tested against Elasticsearch 7.9.2 | |
ES_HOST=localhost:19200 |
This file contains 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
# Unittest style, written for easy port | |
def test_boolean_validator(self): | |
variations = ( | |
('False', 'err'), | |
('True', 'err'), | |
(0, 'err'), | |
(1, 'err'), | |
(True, True), | |
(False, False), |
I hereby claim:
- I am benhowes on github.
- I am benhowes (https://keybase.io/benhowes) on keybase.
- I have a public key whose fingerprint is BD4B 0BB8 0437 A7BA AF41 530F 7047 FE88 C4ED F6D2
To claim this, I am signing this object:
This file contains 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 mongoengine import * | |
class UpdatableDocument(Document): | |
schema_version = IntField(default=0) | |
schema_updates = {} # Dictionary to hold all the updates | |
def __init__(self, *args, **kwargs): | |
values = self.schema_update(kwargs) |
This file contains 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
processor : 15 | |
vendor_id : GenuineIntel | |
cpu family : 6 | |
model : 26 | |
model name : Intel(R) Xeon(R) CPU X5570 @ 2.93GHz | |
stepping : 5 | |
microcode : 0x19 | |
cpu MHz : 1596.000 | |
cache size : 8192 KB | |
physical id : 1 |
Gets a JS object which contains the decoded body of the JWT. For now I am pasting this in to postman tests when I need to get JWT decoding
#Important Does not validate the token at all!
This file contains 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
$prefixClass: rc-slider; | |
$disabledColor: #ccc; | |
$border-radius-base: 6px; | |
$primary-color: #2db7f5; | |
$tooltip-color: #fff; | |
$tooltip-bg: tint(#666, 4%); | |
$tooltip-arrow-width: 4px; | |
$tooltip-distance: $tooltip-arrow-width+4; | |
$tooltip-arrow-color: $tooltip-bg; |
This file contains 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
<predefinedLocation id="Link114001101"> | |
<predefinedLocationName><value lang="en">A50 westbound exit for A515 near Sudbury (west)</value></predefinedLocationName> | |
<predefinedLocation xsi:type="Linear"> | |
<tpeglinearLocation> | |
<tpegDirection>westBound</tpegDirection> | |
<tpegLocationType>segment</tpegLocationType> | |
<to xsi:type="TPEGJunction"> | |
<pointCoordinates> | |
<latitude>52.892544</latitude> | |
<longitude>-1.775278</longitude> |
This file contains 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 itertools import permutations | |
s = ['a','b','c','d','e','f','g',1,2,3,4,5] | |
perms = permutations(s,5) | |
# The following line does this: | |
# For each 5-permutation, see if there is an instance of an integer in it (isinstance). | |
# If there is, add one to a temporary list which we then sum to give the total count. | |
count = sum([1 for p in perms if sum([isinstance(_, int) for _ in p])]) | |
print count |
NewerOlder