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
@xfail(not supportsksyexport, reason="KSY exporter requires yaml and unicode strings") | |
def test_exportksy(): | |
d = Struct( | |
"nothing" / Pass * "field docstring", | |
"data1" / Bytes(10), | |
"data2" / GreedyBytes, | |
"bitstruct" / BitStruct( | |
"flag" / Flag, |
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
class Container(collections.OrderedDict): | |
r""" | |
Generic ordered dictionary that allows both key and attribute access, and preserve key order by insertion. Also it uses __call__ method to chain add keys, because **kw does not preserve order. | |
Struct and Sequence, and few others parsers returns a container, since their members have order so do keys. | |
Example:: | |
Container([ ("name","anonymous"), ("age",21) ]) | |
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
class Container(collections.OrderedDict): | |
__slots__ = ["__keys_order__","__recursion_lock__"] | |
def __getattr__(self, name): | |
try: | |
return self[name] | |
except KeyError: | |
raise AttributeError(name) | |
def __setattr__(self, name, value): |
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
import os | |
istravis = os.environ.get('TRAVIS') == 'true' |
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
$ ooo_cat ideas.odt mission.odt responses.odt > combined.odt | |
Traceback (most recent call last): | |
File "/usr/local/bin/ooo_cat", line 58, in <module> | |
t.transform (o) | |
File "/usr/local/lib/python2.7/dist-packages/ooopy/Transformer.py", line 1383, in transform | |
t.apply_all (self.trees) | |
File "/usr/local/lib/python2.7/dist-packages/ooopy/Transforms.py", line 854, in apply_all | |
self.style_merge (f) | |
File "/usr/local/lib/python2.7/dist-packages/ooopy/Transforms.py", line 1134, in style_merge | |
or namemap [key][name] == newname |
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
def dfs(graph, start): | |
color = {i : 'white' for i in graph} | |
stack = [start] | |
visited = [] | |
while stack: | |
vertex = stack.pop() | |
if color[vertex] == 'grey': | |
return True | |
color[vertex] = 'grey' |
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
def dfs(graph, start): | |
color = {i : 'white' for i in graph} | |
stack = [start] | |
visited = [] | |
while stack: | |
vertex = stack.pop() | |
if color[vertex] == 'grey': | |
return True | |
color[vertex] = 'grey' |
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
On Sun, 2015-10-18 at 23:39 +0200, Arek Bulski wrote: | |
> I read an interview where you said that disks nowadays guarantee | |
> atomic sector writes. I am inclined to believe that. However, I | |
> stumbled upon some comments on LWN saying that its all baloney because | |
> electronics outside the disk can fail before the disk, due to power | |
> loss, and therefore pass corrupted data to disk. Is there some | |
> citation that could authoritatively confirm one way or another? | |
Both can be true; though the exact characteristics of (especially |
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
/// Add references to: Mono.Simd, System, System.Core | |
using System; | |
using Mono.Simd; | |
using System.Diagnostics; | |
using System.Linq; | |
using System.Runtime; | |
namespace testzeros | |
{ | |
class MainClass |
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
def divide(inputlist): | |
"""Dzieli liste na wejsciu na liste list pojedynczych elementow. | |
>>> divide([1,2,3]) | |
[[1],[2],[3]] | |
""" | |
pass | |
def merge(onelist, seclist): | |
"""Scala dwie posortowane listy w jedna posortowana liste. | |
>>> merge([1,2,4],[2,3,5]) |
NewerOlder