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 re | |
def expand_vars(value, vars): | |
return [vars.get(seg, [ seg ]) for seg in re.split('(\$\w+)', value)] | |
def join_segments(segments): | |
return [reduce(lambda acc, seg: (acc[0]+seg[acc[1]%len(seg)], acc[1]/len(seg)), | |
segments, | |
("", val))[0] | |
for val in range(0, reduce(lambda n, seg: n * len(seg), segments, 1))] |
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 Foundation | |
import Compression | |
public class GzipInputStream : InputStream { | |
private var decompressor : Decompressor | |
override public init(data: Data) { | |
let compressedInputStream = InputStream(data: data) | |
self.decompressor = Decompressor(compressedInputStream) |