Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

add docs for rfsync

  • Loading branch information...
commit 9c3888178432fd63e5536cb900a35ece0ed0f620 1 parent 52e1e4f
@gawel authored
View
8 docs/_static/binaries/chutify
4 additions, 4 deletions not shown
View
2  docs/_static/binaries/chutify-examples
1 addition, 1 deletion not shown
View
67 docs/_static/binaries/rfsync
@@ -0,0 +1,67 @@
+#!/usr/bin/env python
+import base64, json, types, sys
+PY3 = sys.version_info[0] == 3
+mods = []
+mods.append(('six', 'IiIiVXRpbGl0aWVzIGZvciB3cml0aW5nIGNvZGUgdGhhdCBydW5zIG9uIFB5dGhvbiAyIGFuZCAz\nIiIiCgppbXBvcnQgb3BlcmF0b3IKaW1wb3J0IHN5cwppbXBvcnQgdHlwZXMKCl9fYXV0aG9yX18g\nPSAiQmVuamFtaW4gUGV0ZXJzb24gPGJlbmphbWluQHB5dGhvbi5vcmc+IgpfX3ZlcnNpb25fXyA9\nICIxLjEuMCIKCgojIFRydWUgaWYgd2UgYXJlIHJ1bm5pbmcgb24gUHl0aG9uIDMuClBZMyA9IHN5\ncy52ZXJzaW9uX2luZm9bMF0gPT0gMwoKaWYgUFkzOgogICAgc3RyaW5nX3R5cGVzID0gc3RyLAog\nICAgaW50ZWdlcl90eXBlcyA9IGludCwKICAgIGNsYXNzX3R5cGVzID0gdHlwZSwKICAgIHRleHRf\ndHlwZSA9IHN0cgogICAgYmluYXJ5X3R5cGUgPSBieXRlcwoKICAgIE1BWFNJWkUgPSBzeXMubWF4\nc2l6ZQplbHNlOgogICAgc3RyaW5nX3R5cGVzID0gYmFzZXN0cmluZywKICAgIGludGVnZXJfdHlw\nZXMgPSAoaW50LCBsb25nKQogICAgY2xhc3NfdHlwZXMgPSAodHlwZSwgdHlwZXMuQ2xhc3NUeXBl\nKQogICAgdGV4dF90eXBlID0gdW5pY29kZQogICAgYmluYXJ5X3R5cGUgPSBzdHIKCiAgICAjIEl0\nJ3MgcG9zc2libGUg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gc2VsZi5uYW1lKQogICAgICAgIHJldHVybiByZXN1bHQK\nCgpjbGFzcyBNb3ZlZE1vZHVsZShfTGF6eURlc2NyKToKCiAgICBkZWYgX19pbml0X18oc2VsZiwg\nbmFtZSwgb2xkLCBuZXc9Tm9uZSk6CiAgICAgICAgc3VwZXIoTW92ZWRNb2R1bGUsIHNlbGYpLl9f\naW5pdF9fKG5hbWUpCiAgICAgICAgaWYgUFkzOgogICAgICAgICAgICBpZiBuZXcgaXMgTm9uZToK\nICAgICAgICAgICAgICAgIG5ldyA9IG5hbWUKICAgICAgICAgICAgc2VsZi5tb2QgPSBuZXcKICAg\nICAgICBlbHNlOgogICAgICAgICAgICBzZWxmLm1vZCA9IG9sZAoKICAgIGRlZiBfcmVzb2x2ZShz\nZWxmKToKICAgICAgICByZXR1cm4gX2ltcG9ydF9tb2R1bGUoc2VsZi5tb2QpCgoKY2xhc3MgTW92\nZWRBdHRyaWJ1dGUoX0xhenlEZXNjcik6CgogICAgZGVmIF9faW5pdF9fKHNlbGYsIG5hbWUsIG9s\nZF9tb2QsIG5ld19tb2QsIG9sZF9hdHRyPU5vbmUsIG5ld19hdHRyPU5vbmUpOgogICAgICAgIHN1\ncGVyKE1vdmVkQXR0cmlidXRlLCBzZWxmKS5fX2luaXRfXyhuYW1lKQogICAgICAgIGlmIFBZMzoK\nICAgICAgICAgICAgaWYgbmV3X21vZCBpcyBOb25lOgogICAgICAgICAgICAgICAgbmV3X21vZCA9\nIG5hbWUKICAgICAgICAgICAgc2VsZi5tb2QgPSBuZXdfbW9kCiAgICAgICAgICAgIGlmIG5ld19h\ndHRyIGlzIE5vbmU6CiAgICAgICAgICAgICAgICBpZiBvbGRfYXR0ciBpcyBOb25lOgogICAgICAg\nICAgICAgICAgICAgIG5ld19hdHRyID0gbmFtZQogICAgICAgICAgICAgICAgZWxzZToKICAgICAg\nICAgICAgICAgICAgICBuZXdfYXR0ciA9IG9sZF9hdHRyCiAgICAgICAgICAgIHNlbGYuYXR0ciA9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gICAgICAgICBpZiBub3QgaXNpbnN0YW5jZShkYXRhLCBiYXNlc3RyaW5nKToK\nICAgICAgICAgICAgICAgIGRhdGEgPSBzdHIoZGF0YSkKICAgICAgICAgICAgZnAud3JpdGUoZGF0\nYSkKICAgICAgICB3YW50X3VuaWNvZGUgPSBGYWxzZQogICAgICAgIHNlcCA9IGt3YXJncy5wb3Ao\nInNlcCIsIE5vbmUpCiAgICAgICAgaWYgc2VwIGlzIG5vdCBOb25lOgogICAgICAgICAgICBpZiBp\nc2luc3RhbmNlKHNlcCwgdW5pY29kZSk6CiAgICAgICAgICAgICAgICB3YW50X3VuaWNvZGUgPSBU\ncnVlCiAgICAgICAgICAgIGVsaWYgbm90IGlzaW5zdGFuY2Uoc2VwLCBzdHIpOgogICAgICAgICAg\nICAgICAgcmFpc2UgVHlwZUVycm9yKCJzZXAgbXVzdCBiZSBOb25lIG9yIGEgc3RyaW5nIikKICAg\nICAgICBlbmQgPSBrd2FyZ3MucG9wKCJlbmQiLCBOb25lKQogICAgICAgIGlmIGVuZCBpcyBub3Qg\nTm9uZToKICAgICAgICAgICAgaWYgaXNpbnN0YW5jZShlbmQsIHVuaWNvZGUpOgogICAgICAgICAg\nICAgICAgd2FudF91bmljb2RlID0gVHJ1ZQogICAgICAgICAgICBlbGlmIG5vdCBpc2luc3RhbmNl\nKGVuZCwgc3RyKToKICAgICAgICAgICAgICAgIHJhaXNlIFR5cGVFcnJvcigiZW5kIG11c3QgYmUg\nTm9uZSBvciBhIHN0cmluZyIpCiAgICAgICAgaWYga3dhcmdzOgogICAgICAgICAgICByYWlzZSBU\neXBlRXJyb3IoImludmFsaWQga2V5d29yZCBhcmd1bWVudHMgdG8gcHJpbnQoKSIpCiAgICAgICAg\naWYgbm90IHdhbnRfdW5pY29kZToKICAgICAgICAgICAgZm9yIGFyZyBpbiBhcmdzOgogICAgICAg\nICAgICAgICAgaWYgaXNpbnN0YW5jZShhcmcsIHVuaWNvZGUpOgogICAgICAgICAgICAgICAgICAg\nIHdhbnRfdW5pY29kZSA9IFRydWUKICAgICAgICAgICAgICAgICAgICBicmVhawogICAgICAgIGlm\nIHdhbnRfdW5pY29kZToKICAgICAgICAgICAgbmV3bGluZSA9IHVuaWNvZGUoIlxuIikKICAgICAg\nICAgICAgc3BhY2UgPSB1bmljb2RlKCIgIikKICAgICAgICBlbHNlOgogICAgICAgICAgICBuZXds\naW5lID0gIlxuIgogICAgICAgICAgICBzcGFjZSA9ICIgIgogICAgICAgIGlmIHNlcCBpcyBOb25l\nOgogICAgICAgICAgICBzZXAgPSBzcGFjZQogICAgICAgIGlmIGVuZCBpcyBOb25lOgogICAgICAg\nICAgICBlbmQgPSBuZXdsaW5lCiAgICAgICAgZm9yIGksIGFyZyBpbiBlbnVtZXJhdGUoYXJncyk6\nCiAgICAgICAgICAgIGlmIGk6CiAgICAgICAgICAgICAgICB3cml0ZShzZXApCiAgICAgICAgICAg\nIHdyaXRlKGFyZykKICAgICAgICB3cml0ZShlbmQpCgpfYWRkX2RvYyhyZXJhaXNlLCAiIiJSZXJh\naXNlIGFuIGV4Y2VwdGlvbi4iIiIpCgoKZGVmIHdpdGhfbWV0YWNsYXNzKG1ldGEsIGJhc2U9b2Jq\nZWN0KToKICAgICIiIkNyZWF0ZSBhIGJhc2UgY2xhc3Mgd2l0aCBhIG1ldGFjbGFzcy4iIiIKICAg\nIHJldHVybiBtZXRhKCJOZXdCYXNlIiwgKGJhc2UsKSwge30pCg==\n'))
+mods.append(('docopt', 'aW1wb3J0IHN5cwppbXBvcnQgcmUKCgpjbGFzcyBEb2NvcHRMYW5ndWFnZUVycm9yKEV4Y2VwdGlv\nbik6CgogICAgIiIiRXJyb3IgaW4gY29uc3RydWN0aW9uIG9mIHVzYWdlLW1lc3NhZ2UgYnkgZGV2\nZWxvcGVyLiIiIgoKCmNsYXNzIERvY29wdEV4aXQoU3lzdGVtRXhpdCk6CgogICAgIiIiRXhpdCBp\nbiBjYXNlIHVzZXIgaW52b2tlZCBwcm9ncmFtIH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Ym91dCBsaXN0IGFyZ3VtZW50cy4KICAgICAgICByZXQgPSBbXQogICAgICAgIGdyb3Vw\ncyA9IFtbc2VsZl1dCiAgICAgICAgd2hpbGUgZ3JvdXBzOgogICAgICAgICAgICBjaGlsZHJlbiA9\nIGdyb3Vwcy5wb3AoMCkKICAgICAgICAgICAgdHlwZXMgPSBbdHlwZShjKSBmb3IgYyBpbiBjaGls\nZHJlbl0KICAgICAgICAgICAgaWYgRWl0aGVyIGluIHR5cGVzOgogICAgICAgICAgICAgICAgZWl0\naGVyID0gW2MgZm9yIGMgaW4gY2hpbGRyZW4gaWYgdHlwZShjKSBpcyBFaXRoZXJdWzBdCiAgICAg\nICAgICAgICAgICBjaGlsZHJlbi5wb3AoY2hpbGRyZW4uaW5kZXgoZWl0aGVyKSkKICAgICAgICAg\nICAgICAgIGZvciBjIGluIGVpdGhlci5jaGlsZHJlbjoKICAgICAgICAgICAgICAgICAgICBncm91\ncHMuYXBwZW5kKFtjXSArIGNoaWxkcmVuKQogICAgICAgICAgICBlbGlmIFJlcXVpcmVkIGluIHR5\ncGVzOgogICAgICAgICAgICAgICAgcmVxdWlyZWQgPSBbYyBmb3IgYyBpbiBjaGlsZHJlbiBpZiB0\neXBlKGMpIGlzIFJlcXVpcmVkXVswXQogICAgICAgICAgICAgICAgY2hpbGRyZW4ucG9wKGNoaWxk\ncmVuLmluZGV4KHJlcXVpcmVkKSkKICAgICAgICAgICAgICAgIGdyb3Vwcy5hcHBlbmQobGlzdChy\nZXF1aXJlZC5jaGlsZHJlbikgKyBjaGlsZHJlbikKICAgICAgICAgICAgZWxpZiBPcHRpb25hbCBp\nbiB0eXBlczoKICAgICAgICAgICAgICAgIG9wdGlvbmFsID0gW2MgZm9yIGMgaW4gY2hpbGRyZW4g\naWYgdHlwZShjKSBpcyBPcHRpb25hbF1bMF0KICAgICAgICAgICAgICAgIGNoaWxkcmVuLnBvcChj\naGlsZHJlbi5pbmRleChvcHRpb25hbCkpCiAgICAgICAgICAgICAgIC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lbHNlIE5vbmUKICAgICAgICByZXR1cm4gY2xhc3NfKHNob3J0LCBsb25nLCBhcmdjb3VudCwg\ndmFsdWUpCgogICAgZGVmIHNpbmdsZV9tYXRjaChzZWxmLCBsZWZ0KToKICAgICAgICBmb3Igbiwg\ncCBpbiBlbnVtZXJhdGUobGVmdCk6CiAgICAgICAgICAgIGlmIHNlbGYubmFtZSA9PSBwLm5hbWU6\nCiAgICAgICAgICAgICAgICByZXR1cm4gbiwgcAogICAgICAgIHJldHVybiBOb25lLCBOb25lCgog\nICAgQHByb3BlcnR5CiAgICBkZWYgbmFtZShzZWxmKToKICAgICAgICByZXR1cm4gc2VsZi5sb25n\nIG9yIHNlbGYuc2hvcnQKCiAgICBkZWYgX19yZXByX18oc2VsZik6CiAgICAgICAgcmV0dXJuICdP\ncHRpb24oJXIsICVyLCAlciwgJXIpJyAlIChzZWxmLnNob3J0LCBzZWxmLmxvbmcsCiAgICAgICAg\nICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZWxmLmFyZ2NvdW50LCBzZWxmLnZh\nbHVlKQoKCmNsYXNzIFJlcXVpcmVkKFBhcnJlbnRQYXR0ZXJuKToKCiAgICBkZWYgbWF0Y2goc2Vs\nZiwgbGVmdCwgY29sbGVjdGVkPU5vbmUpOgogICAgICAgIGNvbGxlY3RlZCA9IFtdIGlmIGNvbGxl\nY3RlZCBpcyBOb25lIGVsc2UgY29sbGVjdGVkCiAgICAgICAgbCA9IGxlZnQKICAgICAgICBjID0g\nY29sbGVjdGVkCiAgICAgICAgZm9yIHAgaW4gc2VsZi5jaGlsZHJlbjoKICAgICAgICAgICAgbWF0\nY2hlZCwgbCwgYyA9IHAubWF0Y2gobCwgYykKICAgICAgICAgICAgaWYgbm90IG1hdGNoZWQ6CiAg\nICAgICAgICAgICAgICByZXR1cm4gRmFsc2UsIGxlZnQsIGNvbGxlY3RlZAogICAgICAgIHJldHVy\nbiBUcnVlLCBsLCBjCgoKY2xhc3MgT3B0aW9uYWw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G9rZW5zLmVycm9yIGlzIERvY29wdEV4aXQ6CiAgICAgICAg\nICAgICAgICByYWlzZSB0b2tlbnMuZXJyb3IoJy0lcyBpcyBub3QgcmVjb2duaXplZCcgJSByYXdb\nMF0pCiAgICAgICAgICAgIGVsc2U6CiAgICAgICAgICAgICAgICBvID0gT3B0aW9uKCctJyArIHJh\nd1swXSwgTm9uZSkKICAgICAgICAgICAgICAgIG9wdGlvbnMuYXBwZW5kKG8pCiAgICAgICAgICAg\nICAgICBwYXJzZWQuYXBwZW5kKG8pCiAgICAgICAgICAgICAgICByYXcgPSByYXdbMTpdCiAgICAg\nICAgICAgICAgICBjb250aW51ZQogICAgICAgIG8gPSBvcHRbMF0KICAgICAgICBvcHQgPSBPcHRp\nb24oby5zaG9ydCwgby5sb25nLCBvLmFyZ2NvdW50LCBvLnZhbHVlKQogICAgICAgIHJhdyA9IHJh\nd1sxOl0KICAgICAgICBpZiBvcHQuYXJnY291bnQgPT0gMDoKICAgICAgICAgICAgdmFsdWUgPSBU\ncnVlIGlmIHRva2Vucy5lcnJvciBpcyBEb2NvcHRFeGl0IGVsc2UgRmFsc2UKICAgICAgICBlbHNl\nOgogICAgICAgICAgICBpZiByYXcgPT0gJyc6CiAgICAgICAgICAgICAgICBpZiB0b2tlbnMuY3Vy\ncmVudCgpIGlzIE5vbmU6CiAgICAgICAgICAgICAgICAgICAgcmFpc2UgdG9rZW5zLmVycm9yKCct\nJXMgcmVxdWlyZXMgYXJndW1lbnQnICUgb3B0LnNob3J0WzBdKQogICAgICAgICAgICAgICAgcmF3\nID0gdG9rZW5zLm1vdmUoKQogICAgICAgICAgICB2YWx1ZSwgcmF3ID0gcmF3LCAnJwogICAgICAg\nIGlmIHRva2Vucy5lcnJvciBpcyBEb2NvcHRFeGl0OgogICAgICAgICAgICBvcHQudmFsdWUgPSB2\nYWx1ZQogICAgICAgIGVsc2U6CiAgICAgICAgICAgIG9wdC52YWx1ZSA9IE5vbmUgaWYgdmFsdWUg\nZWxzZSB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UpOgogICAgICAgICIiImNv\nbnZlcnQgdmFsdWUgdG8gbGlzdDo6CiAgICAgICAgICAgID4+PiBjb25maWcgPSBDb25maWdPYmpl\nY3QoKQogICAgICAgICAgICA+Pj4gY29uZmlnLmxpc3RlcyA9IGRpY3QobGlzdGU9WzAsIDFdLCBz\ndHJpbmc9JzE7MjszJykKCiAgICAgICAgICAgID4+PiBwcmludChjb25maWcubGlzdGVzLmxpc3Rl\nKQogICAgICAgICAgICAwCiAgICAgICAgICAgIDEKICAgICAgICAgICAgPj4+IGNvbmZpZy5saXN0\nZXMubGlzdGUuYXNfbGlzdCgpCiAgICAgICAgICAgIFsnMCcsICcxJ10KICAgICAgICAgICAgPj4+\nIGNvbmZpZy5saXN0ZXMuc3RyaW5nLmFzX2xpc3Qoc2VwPSc7JykKICAgICAgICAgICAgWycxJywg\nJzInLCAnMyddCiAgICAgICAgIiIiCiAgICAgICAgaWYgc2VwIGlzIE5vbmUgYW5kICdcbicgaW4g\nc2VsZjoKICAgICAgICAgICAgc2VwID0gJ1xuJwogICAgICAgIHJldHVybiBbQ29uZmlnVmFsdWUo\ndikgZm9yIHYgaW4gc2VsZi5zcGxpdChzZXApIGlmIHZdCgogICAgZGVmIGFzX2Jvb2woc2VsZiwg\ndHJ1ZT1UcnVlLCBmYWxzZT1GYWxzZSk6CiAgICAgICAgIiIiY29udmVydCB2YWx1ZSB0byBib29s\nOjoKCiAgICAgICAgICAgID4+PiBjb25maWcgPSBDb25maWdPYmplY3QoKQogICAgICAgICAgICA+\nPj4gY29uZmlnLmJvb2xzID0gZGljdCh0cnVlPVRydWUsIGZhbHNlPUZhbHNlKQoKICAgICAgICAg\nICAgPj4+IGNvbmZpZy5ib29scy50cnVlCiAgICAgICAgICAgICd0cnVlJwogICAgICAgICAgICA+\nPj4gY29uZmlnLmJvb2xzLnRydWUuYXNfYm9vbCgpCiAgICAgICAgICAgIFRydWUKICAgICAgICAg\nICAgPj4+IGNvbmZpZy5ib29scy50cnVlLmFzX2Jvb2woJ29uJywgJ29mZicpCiAgICAgICAgICAg\nICdvbicKCiAgICAgICAgICAgID4+PiBjb25maWcuYm9vbHMuZmFsc2UKICAgICAgICAgICAgJ2Zh\nbHNlJwogICAgICAgICAgICA+Pj4gY29uZmlnLmJvb2xzLmZhbHNlLmFzX2Jvb2woKQogICAgICAg\nICAgICBGYWxzZQogICAgICAgICAgICA+Pj4gY29uZmlnLmJvb2xzLmZhbHNlLmFzX2Jvb2woJ29u\nJywgJ29mZicpCiAgICAgICAgICAgICdvZmYnCgogICAgICAgICAgICA+Pj4gY29uZmlnLmJvb2xz\nLm5vbmUuYXNfYm9vbCgpCiAgICAgICAgICAgIEZhbHNlCgogICAgICAgICIiIgogICAgICAgIGlm\nIHNlbGYubG93ZXIoKSBpbiAoJzEnLCAneScsICd0cnVlJywgJ3llcycsICdvbicpOgogICAgICAg\nICAgICByZXR1cm4gdHJ1ZQogICAgICAgIGVsaWYgc2VsZi5sb3dlcigpIGluICgnMCcsICdmJywg\nJ2ZhbHNlJywgJ25vJywgJ29mZicpOgogICAgICAgICAgICByZXR1cm4gZmFsc2UKICAgICAgICBl\nbGlmIG5vdCBzZWxmOgogICAgICAgICAgICByZXR1cm4gZmFsc2UKICAgICAgICBlbHNlOgogICAg\nICAgICAgICByYWlzZSBUeXBlRXJyb3IoJyVzIGlzIG5vdCBhIHZhbGlkIGJvb2wnICUgc2VsZikK\nCiAgICBkZWYgX19odG1sX18oc2VsZik6CiAgICAgICAgcmV0dXJuIHJlcHIoc2VsZikKCgpkZWYg\nX0NvbmZpZ1ZhbHVlKHZhbHVlPScnKToKICAgICIiIgogICAgICAgID4+PiBfQ29uZmlnVmFsdWUo\nMSkKICAgICAgICAnMScKICAgICAgICA+Pj4gX0NvbmZpZ1ZhbHVlKC4xKQogICAgICAgICcwLjEn\nCiAgICAgICAgPj4+IF9Db25maWdWYWx1ZShUcnVlKQogICAgICAgICd0cnVlJwogICAgICAgID4+\nPiBwcmludChfQ29uZmlnVmFsdWUobG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fXyhzZWxmLCBhdHRyKToKICAgICAgICBj\nb25maWcgPSBzZWxmLl9fcGFyZW50CiAgICAgICAgaWYgY29uZmlnLmhhc19zZWN0aW9uKHNlbGYu\nX19zZWN0aW9uKToKICAgICAgICAgICAgaWYgY29uZmlnLmhhc19vcHRpb24oc2VsZi5fX3NlY3Rp\nb24sIGF0dHIpOgogICAgICAgICAgICAgICAgY29uZmlnLnJlbW92ZV9vcHRpb24oc2VsZi5fX3Nl\nY3Rpb24sIGF0dHIpCgogICAgX19kZWxpdGVtX18gPSBfX2RlbGF0dHJfXwoKICAgIGRlZiBpdGVt\ncyhzZWxmKToKICAgICAgICAiIiJkaWN0IGFwaSIiIgogICAgICAgIGlmIHNlbGYuX19wYXJlbnQu\naGFzX3NlY3Rpb24oc2VsZi5fX3NlY3Rpb24pOgogICAgICAgICAgICBpdGVtcyA9IHNlbGYuX19w\nYXJlbnQuaXRlbXMoc2VsZi5fX3NlY3Rpb24pCiAgICAgICAgICAgIHJldHVybiBbKGssIF9Db25m\naWdWYWx1ZSh2KSkgZm9yIGssIHYgaW4gaXRlbXNdCiAgICAgICAgcmV0dXJuIFtdCgogICAgZGVm\nIGtleXMoc2VsZik6CiAgICAgICAgIiIiZGljdCBhcGkiIiIKICAgICAgICBpZiBzZWxmLl9fcGFy\nZW50Lmhhc19zZWN0aW9uKHNlbGYuX19zZWN0aW9uKToKICAgICAgICAgICAgcmV0dXJuIHNlbGYu\nX19wYXJlbnQub3B0aW9ucyhzZWxmLl9fc2VjdGlvbikKICAgICAgICByZXR1cm4gW10KCiAgICBk\nZWYgdXBkYXRlKHNlbGYsICphcmdzLCAqKmt3YXJncyk6CiAgICAgICAgIiIiZGljdCBhcGkiIiIK\nICAgICAgICB2YWx1ZXMgPSB7fQogICAgICAgIGZvciBhcmcgaW4gYXJnczoKICAgICAgICAgICAg\ndmFsdWVzLnVwZGF0ZShhcmcpCiAgICAgICAgdmFsdWVzLnVwZGF0ZShrd2FyZ3MpCiAgICAgICAg\n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ChDb25maWdQYXJzZXIsIG9iamVjdCk6CiAgICAiIiJDb25maWdQ\nYXJzZXJfIHdyYXBwZXIKICAgICIiIgoKICAgIGRlZiBfX2luaXRfXyhzZWxmLCAqYXJncywgKipr\nd2FyZ3MpOgogICAgICAgIHNlbGYuX19jb25maWcgPSBPYmplY3QoKQogICAgICAgIHNlbGYuZmls\nZW5hbWUgPSBOb25lCiAgICAgICAgaWYgJ2ZpbGVuYW1lJyBpbiBrd2FyZ3M6CiAgICAgICAgICAg\nIHNlbGYuZmlsZW5hbWUgPSBrd2FyZ3MucG9wKCdmaWxlbmFtZScpCiAgICAgICAgQ29uZmlnUGFy\nc2VyLl9faW5pdF9fKHNlbGYsICphcmdzLCAqKmt3YXJncykKICAgICAgICBpZiBzZWxmLmZpbGVu\nYW1lIGFuZCBvcy5wYXRoLmlzZmlsZShzZWxmLmZpbGVuYW1lKToKICAgICAgICAgICAgc2VsZi5y\nZWFkKHNlbGYuZmlsZW5hbWUpCgogICAgZGVmIHdyaXRlKHNlbGYsIGZkPU5vbmUsIHNwYWNlX2Fy\nb3VuZF9kZWxpbWl0ZXJzPVRydWUpOgogICAgICAgICIiIlNhdmUgdG8gYGBDb25maWdPYmplY3Qu\nZmlsZW5hbWVgYCBpZiBubyBmZCBpcyBwcm92aWRlZCIiIgogICAgICAgIGlmIGZkIGlzIE5vbmU6\nCiAgICAgICAgICAgIGZkID0gb3BlbihzZWxmLmZpbGVuYW1lLCAndycpCiAgICAgICAgICAgIGlm\nIFBZMzoKICAgICAgICAgICAgICAgIENvbmZpZ1BhcnNlci53cml0ZShzZWxmLCBmZCwKICAgICAg\nICAgICAgICAgICAgICBzcGFjZV9hcm91bmRfZGVsaW1pdGVycz1zcGFjZV9hcm91bmRfZGVsaW1p\ndGVycykKICAgICAgICAgICAgZWxzZToKICAgICAgICAgICAgICAgIENvbmZpZ1BhcnNlci53cml0\nZShzZWxmLCBmZCkKICAgICAgICAgICAgZmQuY2xvc2UoKQogICAgICAgIGVsc2U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HdoaWxlIHByZXZpb3VzIGlzIG5vdCBOb25lOgogICAgICAgICAgICBjbWRzLmluc2VydCgw\nLCBwcmV2aW91cykKICAgICAgICAgICAgcHJldmlvdXMgPSBwcmV2aW91cy5wcmV2aW91cwogICAg\nICAgIHJldHVybiBjbWRzCgogICAgZGVmIGNvbW1hbmRfbGluZShzZWxmLCBzaGVsbD1GYWxzZSk6\nCiAgICAgICAgYXJncyA9IFtdCgogICAgICAgIGlmIHNlbGYuX2NtZF9hcmdzOgogICAgICAgICAg\nICBhcmdzLmV4dGVuZChzZWxmLl9jbWRfYXJncykKCiAgICAgICAgaWYgJ3N1ZG8nIGluIGFyZ3M6\nCiAgICAgICAgICAgIGFyZ3NbMDoxXSA9IFthbGlhc2VzLmdldCgnc3VkbycpXQoKICAgICAgICBi\naW5hcnkgPSBzZWxmLl9iaW5hcnkKICAgICAgICBpZiBzZWxmLl9jbWRfYXJnc1s6MV0gPT0gWydz\nc2gnXToKICAgICAgICAgICAgY21kID0gJyVzICVzJyAlIChiaW5hcnksICcgJy5qb2luKHNlbGYu\nYXJncykpCiAgICAgICAgICAgIGNtZCA9IGNtZC5zdHJpcCgpCiAgICAgICAgICAgIGlmICgnfCcg\naW4gY21kIG9yICc+JyBpbiBjbWQpIGFuZCBzaGVsbDoKICAgICAgICAgICAgICAgIGNtZCA9IHJl\ncHIoc3RyKGNtZCkpCiAgICAgICAgICAgIGFyZ3MuYXBwZW5kKGNtZCkKICAgICAgICBlbHNlOgog\nICAgICAgICAgICBhcmdzLmV4dGVuZChiaW5hcnkuc3BsaXQoKSkKICAgICAgICAgICAgaWYgaXNp\nbnN0YW5jZShzZWxmLmFyZ3MsIGxpc3QpOgogICAgICAgICAgICAgICAgZm9yIGEgaW4gc2VsZi5h\ncmdzOgogICAgICAgICAgICAgICAgICAgIGFyZ3MuZXh0ZW5kKGEuc3BsaXQoKSkKICAgICAgICAg\nICAgZWxzZToKICAgICAgICAgICAgICAgIGFyZ3MuZXh0ZW5kKHNlbGYuYXJncy5zcGxpdCgiICIp\nKQoKICAgICAgICBhcmdzID0gW2EgZm9yIGEgaW4gYXJncyBpZiBhXQoKICAgICAgICBpZiBzaGVs\nbDoKICAgICAgICAgICAgcmV0dXJuICcgJy5qb2luKGFyZ3MpCiAgICAgICAgcmV0dXJuIGFyZ3MK\nCiAgICBAcHJvcGVydHkKICAgIGRlZiBjb21tYW5kc19saW5lKHNlbGYpOgogICAgICAgIGNtZHMg\nPSBbXQogICAgICAgIGZvciBjbWQgaW4gc2VsZi5jb21tYW5kczoKICAgICAgICAgICAgaWYgaXNp\nbnN0YW5jZShjbWQsIFN0ZGluKToKICAgICAgICAgICAgICAgIHMgPSAnc3RkaW4nCiAgICAgICAg\nICAgIGVsaWYgaXNpbnN0YW5jZShjbWQsIFB5UGlwZSk6CiAgICAgICAgICAgICAgICBzID0gJyVz\nKCknICUgY21kLl9fY2xhc3NfXy5fX25hbWVfXwogICAgICAgICAgICBlbHNlOgogICAgICAgICAg\nICAgICAgcyA9IGNtZC5jb21tYW5kX2xpbmUoc2hlbGw9VHJ1ZSkKICAgICAgICAgICAgY21kcy5h\ncHBlbmQocy5zdHJpcCgpKQogICAgICAgIHJldHVybiBzdHIoJyB8ICcuam9pbihjbWRzKSkKCiAg\nICBAcHJvcGVydHkKICAgIGRlZiBzdGRvdXQoc2VsZik6CiAgICAgICAgIiIic3RhbmRhcmQgb3V0\ncHV0IG9mIHRoZSBwaXBlLiBBIGZpbGUgZGVzY3JpcHRvciBvciBhbiBpdGVyYXJvciIiIgogICAg\nICAgIHAgPSBOb25lCiAgICAgICAgc2VsZi5wcm9jZXNzZXMgPSBbXQogICAgICAgIHNlbGYuX3N0\nZGVyciA9IE5vbmUKICAgICAgICBzdGRpbiA9IHN5cy5zdGRpbgogICAgICAgIGNtZHMgPSBzZWxm\nLmNvbW1hbmRzCgogICAgICAgIGlmIFtjIGZvciBjIGluIGNtZHMgaWYgYy5fY21kX2FyZ3NbOjFd\nID09IFsnc3VkbyddXToKICAgICAgICAgICAgY2hlY2tfc3VkbygpCgogICAgICAgIGZvciBjbWQg\naW4gY21kczoKICAgICAgICAgICAgaWYgaXNpbnN0YW5jZShjbWQsIFN0ZGluKToKICAgICAgICAg\nICAgICAgIHN0ZGluID0gY21kLml0ZXJfc3Rkb3V0CiAgICAgICAgICAgIGVsaWYgaXNpbnN0YW5j\nZShjbWQsIFB5UGlwZSk6CiAgICAgICAgICAgICAgICBjbWQuc3RkaW4gPSBwLnN0ZG91dAogICAg\nICAgICAgICAgICAgc3RkaW4gPSBjbWQuaXRlcl9zdGRvdXQKICAgICAgICAgICAgZWxzZToKICAg\nICAgICAgICAgICAgIGFyZ3MgPSBjbWQuY29tbWFuZF9saW5lKGNtZC5rd2FyZ3MuZ2V0KCdzaGVs\nbCcsIEZhbHNlKSkKCiAgICAgICAgICAgICAgICBrd2FyZ3MgPSBkaWN0KAogICAgICAgICAgICAg\nICAgICAgIHN0ZGluPXN0ZGluLCBzdGRlcnI9UElQRSwKICAgICAgICAgICAgICAgICAgICBzdGRv\ndXQ9UElQRQogICAgICAgICAgICAgICAgICAgICkKICAgICAgICAgICAgICAgIGt3YXJncy51cGRh\ndGUoY21kLmt3YXJncykKICAgICAgICAgICAgICAgIGVudl8gPSBrd2FyZ3MucG9wKCdlbnYnLCBl\nbnYpCgogICAgICAgICAgICAgICAgbG9nLmRlYnVnKCdQb3BlbiglciwgKiolciknLCBhcmdzLCBr\nd2FyZ3MpCgogICAgICAgICAgICAgICAga3dhcmdzWydlbnYnXSA9IGVudl8KCiAgICAgICAgICAg\nICAgICB0cnk6CiAgICAgICAgICAgICAgICAgICAgcCA9IFBvcGVuKGFyZ3MsICoqa3dhcmdzKQog\nICAgICAgICAgICAgICAgZXhjZXB0IE9TRXJyb3I6CiAgICAgICAgICAgICAgICAgICAgc2VsZi5f\ncmFpc2UoKQoKICAgICAgICAgICAgICAgIHNlbGYucHJvY2Vzc2VzLmFwcGVuZChwKQogICAgICAg\nICAgICAgICAgc3RkaW4gPSBwLnN0ZG91dAogICAgICAgIHJldHVybiBzdGRpbgoKICAgIEBjbGFz\nc21ldGhvZAogICAgZGVmIG1hcChjbHMsIGFyZ3MsCiAgICAgICAgICAgIHBvb2xfc2l6ZT1Ob25l\nLCBzdG9wX29uX2ZhaWx1cmU9RmFsc2UsICoqa3dhcmdzKToKICAgICAgICAiIiJSdW4gYSBiYXRj\naCBvZiB0aGUgc2FtZSBjb21tYW5kIGFuZCBtYW5hZ2UgYSBwb29sIG9mIHByb2Nlc3NlcyBmb3IK\nICAgICAgICB5b3UiIiIKICAgICAgICBrdyA9IGRpY3QoCiAgICAgICAgICAgIHN0ZGluPXN5cy5z\ndGRpbiwgc3RkZXJyPVBJUEUsCiAgICAgICAgICAgIHN0ZG91dD1QSVBFCiAgICAgICAgICAgICkK\nICAgICAgICBrdy51cGRhdGUoa3dhcmdzKQogICAgICAgIGlmIHBvb2xfc2l6ZSBpcyBOb25lOgog\nICAgICAgICAgICBpbXBvcnQgbXVsdGlwcm9jZXNzaW5nCiAgICAgICAgICAgIHBvb2xfc2l6ZSA9\nIG11bHRpcHJvY2Vzc2luZy5jcHVfY291bnQoKQogICAgICAgIHJlc3VsdHMgPSBbTm9uZV0gKiBs\nZW4oYXJncykKICAgICAgICBwcm9jZXNzZXMgPSBbXQogICAgICAgIGluZGV4ID0gMAogICAgICAg\nIG91dF9pbmRleCA9IDAKICAgICAgICB3aGlsZSBhcmdzIG9yIHByb2Nlc3NlczoKICAgICAgICAg\nICAgaWYgYXJncyBhbmQgbGVuKHByb2Nlc3NlcykgPCBwb29sX3NpemU6CiAgICAgICAgICAgICAg\nICBhID0gYXJncy5wb3AoMCkKICAgICAgICAgICAgICAgIGlmIG5vdCBpc2luc3RhbmNlKGEsIGxp\nc3QpOgogICAgICAgICAgICAgICAgICAgIGEgPSBbYV0KICAgICAgICAgICAgICAgIGNtZCA9IGNs\ncygqYSkKICAgICAgICAgICAgICAgIGEgPSBjbWQuY29tbWFuZF9saW5lKGNtZC5rd2FyZ3MuZ2V0\nKCdzaGVsbCcsIEZhbHNlKSkKICAgICAgICAgICAgICAgIHByb2Nlc3Nlcy5hcHBlbmQoKGluZGV4\nLCBjbWQsIFBvcGVuKGEsICoqa3cpKSkKICAgICAgICAgICAgICAgIGluZGV4ICs9IDEKICAgICAg\nICAgICAgZm9yIGksIGNtZCwgcCBpbiBwcm9jZXNzZXM6CiAgICAgICAgICAgICAgICByZXN1bHQg\nPSBwLnBvbGwoKQogICAgICAgICAgICAgICAgaWYgcmVzdWx0IGlzIG5vdCBOb25lOgogICAgICAg\nICAgICAgICAgICAgIG91dHB1dCA9IFN0ZG91dChwLnN0ZG91dC5yZWFkKCkpCiAgICAgICAgICAg\nICAgICAgICAgb3V0cHV0LnN0ZGVyciA9IHAuc3RkZXJyLnJlYWQoKQogICAgICAgICAgICAgICAg\nICAgIG91dHB1dC5yZXR1cm5jb2RlcyA9IFtyZXN1bHRdCiAgICAgICAgICAgICAgICAgICAgb3V0\ncHV0LmZhaWxlZCA9IGJvb2wocmVzdWx0KQogICAgICAgICAgICAgICAgICAgIG91dHB1dC5zdWNj\nZWVkZWQgPSBub3Qgb3V0cHV0LmZhaWxlZAogICAgICAgICAgICAgICAgICAgIHJlc3VsdHNbaV0g\nPSBvdXRwdXQKICAgICAgICAgICAgICAgICAgICBwcm9jZXNzZXMucmVtb3ZlKChpLCBjbWQsIHAp\nKQogICAgICAgICAgICAgICAgICAgIGlmIG91dF9pbmRleCA9PSBpOgogICAgICAgICAgICAgICAg\nICAgICAgICBvdXRfaW5kZXggKz0gMQogICAgICAgICAgICAgICAgICAgICAgICB5aWVsZCByZXN1\nbHRzW2ldCiAgICAgICAgICAgICAgICAgICAgaWYgcmVzdWx0ID4gMCBhbmQgc3RvcF9vbl9mYWls\ndXJlOgogICAgICAgICAgICAgICAgICAgICAgICBhcmdzID0gTm9uZQogICAgICAgICAgICAgICAg\nICAgICAgICBmb3IgaW5kZXgsIGNtZCwgcCBpbiBwcm9jZXNzZXM6CiAgICAgICAgICAgICAgICAg\nICAgICAgICAgICBpZiBwLnBvbGwoKSBpcyBOb25lOgogICAgICAgICAgICAgICAgICAgICAgICAg\nICAgICAgIHAua2lsbCgpCiAgICAgICAgICAgICAgICAgICAgICAgIGNtZC5fcmFpc2Uob3V0cHV0\nPW91dHB1dCkKICAgICAgICAgICAgdGltZS5zbGVlcCguMSkKICAgICAgICBpZiBvdXRfaW5kZXgg\nPCBsZW4ocmVzdWx0cyk6CiAgICAgICAgICAgIHlpZWxkIHJlc3VsdHNbb3V0X2luZGV4XQogICAg\nICAgICAgICBvdXRfaW5kZXggKz0gMQoKICAgIGRlZiBfX2dldGl0ZW1fXyhzZWxmLCBpdGVtKToK\nICAgICAgICBpZiBub3QgaXNpbnN0YW5jZShpdGVtLCBzbGljZSk6CiAgICAgICAgICAgIHJhaXNl\nIEtleUVycm9yKCdZb3UgY2FuIG9ubHkgdXNlIHNsaWNlcycpCiAgICAgICAgY21kcyA9IHNlbGYu\nY29tbWFuZHMKICAgICAgICBjbWRzID0gW2RlZXBjb3B5KGNtZCkgZm9yIGNtZCBpbiBjbWRzW2l0\nZW1dXQogICAgICAgIHJldHVybiBzZWxmLl9vcmRlcihjbWRzKVstMV0KCiAgICBkZWYgX19nZXRz\nbGljZV9fKHNlbGYsIHN0YXJ0LCBzdG9wKToKICAgICAgICBjbWRzID0gc2VsZi5jb21tYW5kcwog\nICAgICAgIGNtZHMgPSBbZGVlcGNvcHkoY21kKSBmb3IgY21kIGluIGNtZHNbc3RhcnQ6c3RvcF1d\nCiAgICAgICAgcmV0dXJuIHNlbGYuX29yZGVyKGNtZHMpWy0xXQoKICAgIGRlZiBfX2l0ZXJfXyhz\nZWxmKToKICAgICAgICBmb3IgbGluZSBpbiBzZWxmLnN0ZG91dDoKICAgICAgICAgICAgeWllbGQg\nc2VsZi5fZGVjb2RlKGxpbmUpCgogICAgZGVmIF9fY2FsbF9fKHNlbGYsICoqa3dhcmdzKToKICAg\nICAgICBpZiBzZWxmLl9kb25lIGFuZCBzZWxmLl9zdGRvdXQgaXMgbm90IE5vbmU6CiAgICAgICAg\nICAgIHJldHVybiBzZWxmLl9zdGRvdXQKICAgICAgICBmb3IgY21kIGluIHNlbGYuY29tbWFuZHM6\nCiAgICAgICAgICAgIGlmIGt3YXJncy5nZXQoJ3NoZWxsJyk6CiAgICAgICAgICAgICAgICBjbWQu\na3dhcmdzWydzaGVsbCddID0gVHJ1ZQogICAgICAgICAgICBpZiBrd2FyZ3MuZ2V0KCdjb21iaW5l\nX3N0ZGVycicpOgogICAgICAgICAgICAgICAgY21kLmt3YXJnc1snc3RkZXJyJ10gPSBTVERPVVQK\nICAgICAgICBzdGRvdXQgPSBzZWxmLnN0ZG91dAogICAgICAgIGlmIHN0ZG91dCBpcyBub3QgTm9u\nZToKICAgICAgICAgICAgaWYgaGFzYXR0cihzdGRvdXQsICdyZWFkJyk6CiAgICAgICAgICAgICAg\nICBvdXRwdXQgPSBzdGRvdXQucmVhZCgpLnJzdHJpcCgpCiAgICAgICAgICAgIGVsc2U6CiAgICAg\nICAgICAgICAgICBvdXRwdXQgPSBiJycuam9pbihsaXN0KHN0ZG91dCkpLnJzdHJpcCgpCiAgICAg\nICAgICAgIG91dHB1dCA9IHNlbGYuX2RlY29kZShvdXRwdXQpCiAgICAgICAgZWxzZToKICAgICAg\nICAgICAgb3V0cHV0ID0gJycKICAgICAgICBvdXRwdXQgPSBzZWxmLl9nZXRfc3Rkb3V0KG91dHB1\ndCkKICAgICAgICBpZiBzZWxmLl9kb25lOgogICAgICAgICAgICBzZWxmLl9zdGRvdXQgPSBvdXRw\ndXQKICAgICAgICByZXR1cm4gb3V0cHV0CgogICAgX19zdHJfXyA9IF9fY2FsbF9fCgogICAgZGVm\nIF9fZ3RfXyhzZWxmLCBmaWxlbmFtZSk6CiAgICAgICAgcmV0dXJuIHNlbGYuX3dyaXRlKGZpbGVu\nYW1lLCAnd2IrJykKCiAgICBkZWYgX19yc2hpZnRfXyhzZWxmLCBmaWxlbmFtZSk6CiAgICAgICAg\ncmV0dXJuIHNlbGYuX3dyaXRlKGZpbGVuYW1lLCAnYWIrJykKCiAgICBkZWYgX19vcl9fKHNlbGYs\nIG90aGVyKToKICAgICAgICBpZiBpc2luc3RhbmNlKG90aGVyLmNvbW1hbmRzLCBwcm9wZXJ0eSk6\nCiAgICAgICAgICAgIG90aGVyID0gb3RoZXIoKQogICAgICAgIGlmIGlzaW5zdGFuY2Uoc2VsZiwg\nU3RkaW4pOgogICAgICAgICAgICBmaXJzdCA9IG90aGVyLmNvbW1hbmRzWzBdCiAgICAgICAgICAg\nIGZpcnN0LnByZXZpb3VzID0gc2VsZgogICAgICAgICAgICByZXR1cm4gb3RoZXIKICAgICAgICBj\nbWRzID0gZGVlcGNvcHkoc2VsZi5jb21tYW5kcykgKyBkZWVwY29weShvdGhlci5jb21tYW5kcykK\nICAgICAgICBjbWRzID0gc2VsZi5fb3JkZXIoY21kcykKICAgICAgICBvdGhlciA9IGNtZHNbLTFd\nCiAgICAgICAgcmV0dXJuIG90aGVyCgogICAgZGVmIF9fYm9vbF9fKHNlbGYpOgogICAgICAgIHJl\ndHVybiBub3Qgc2VsZi5mYWlsZWQKICAgIF9fbm9uemVyb19fID0gX19ib29sX18KCiAgICBkZWYg\nX19kZWVwY29weV9fKHNlbGYsICphcmdzKToKICAgICAgICByZXR1cm4gc2VsZi5fX2NsYXNzX18o\nKnNlbGYuYXJncywgKipzZWxmLmt3YXJncykKCiAgICBkZWYgX19yZXByX18oc2VsZik6CiAgICAg\nICAgcmV0dXJuIHJlcHIoc2VsZi5jb21tYW5kc19saW5lKQoKICAgIGRlZiBfb3JkZXIoc2VsZiwg\nY21kcyk6CiAgICAgICAgaWYgY21kczoKICAgICAgICAgICAgY21kc1swXS5wcmV2aW91cyA9IE5v\nbmUKICAgICAgICAgICAgZm9yIGkgaW4gcmFuZ2UobGVuKGNtZHMpIC0gMSwgMCwgLTEpOgogICAg\nICAgICAgICAgICAgY21kc1tpXS5wcmV2aW91cyA9IGNtZHNbaSAtIDFdCiAgICAgICAgcmV0dXJu\nIGNtZHMKCiAgICBkZWYgX3dyaXRlX3RvKHNlbGYsIGZkKToKICAgICAgICBpZiBub3QgaXNpbnN0\nYW5jZShzZWxmLCBQeVBpcGUpOgogICAgICAgICAgICBzZWxmLmt3YXJnc1snc3Rkb3V0J10gPSBm\nZAogICAgICAgICAgICByZXR1cm4gc2VsZi5fX2NhbGxfXygpCiAgICAgICAgZWxzZToKICAgICAg\nICAgICAgZm9yIGxpbmUgaW4gc2VsZi5zdGRvdXQ6CiAgICAgICAgICAgICAgICBmZC53cml0ZShs\naW5lKQogICAgICAgICAgICByZXR1cm4gc2VsZi5fZ2V0X3N0ZG91dCgnJykKCiAgICBkZWYgX3dy\naXRlKHNlbGYsIGZpbGVuYW1lLCBtb2RlKToKICAgICAgICBpZiBpc2luc3RhbmNlKGZpbGVuYW1l\nLCBpbnQpOgogICAgICAgICAgICBpZiBmaWxlbmFtZSA9PSAyOgogICAgICAgICAgICAgICAgZmQg\nPSBzZWxmLl9zeXNfc3RkZXJyCiAgICAgICAgICAgIGVsc2U6CiAgICAgICAgICAgICAgICBmZCA9\nIHNlbGYuX3N5c19zdGRvdXQKICAgICAgICAgICAgb3V0cHV0ID0gc2VsZi5fd3JpdGVfdG8oZmQp\nCiAgICAgICAgZWxzZToKICAgICAgICAgICAgd2l0aCBvcGVuKGZpbGVuYW1lLCBtb2RlKSBhcyBm\nZDoKICAgICAgICAgICAgICAgIG91dHB1dCA9IHNlbGYuX3dyaXRlX3RvKGZkKQogICAgICAgIGlm\nIG91dHB1dC5mYWlsZWQ6CiAgICAgICAgICAgIHNlbGYuX3JhaXNlKG91dHB1dD1vdXRwdXQpCiAg\nICAgICAgcmV0dXJuIG91dHB1dAoKICAgIGRlZiBfZGVjb2RlKHNlbGYsIG91dHB1dCk6CiAgICAg\nICAgaWYgc2l4LlBZMyBhbmQgbm90IGlzaW5zdGFuY2Uob3V0cHV0LCBzaXgudGV4dF90eXBlKTo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ZWN0IHNvbWUgZGF0YSBpbiB0aGUgcGlwZSIiIgoKICAgIHN0ZGVy\nciA9ICcnCiAgICByZXR1cm5jb2RlcyA9IFtdCgogICAgZGVmIF9faW5pdF9fKHNlbGYsIHZhbHVl\nKToKICAgICAgICBzdXBlcihTdGRpbiwgc2VsZikuX19pbml0X18oKQogICAgICAgIHNlbGYudmFs\ndWUgPSB2YWx1ZQogICAgICAgIHNlbGYuX3N0ZGluID0gTm9uZQoKICAgIEBwcm9wZXJ0eQogICAg\nZGVmIGl0ZXJfc3Rkb3V0KHNlbGYpOgogICAgICAgIGlmIGhhc2F0dHIoc2VsZi52YWx1ZSwgJ3Nl\nZWsnKToKICAgICAgICAgICAgc2VsZi52YWx1ZS5zZWVrKDApCiAgICAgICAgaWYgaGFzYXR0cihz\nZWxmLnZhbHVlLCAnZmlsZW5vJyk6CiAgICAgICAgICAgIHIgPSBzZWxmLnZhbHVlCiAgICAgICAg\nZWxzZToKICAgICAgICAgICAgaWYgaGFzYXR0cihzZWxmLnZhbHVlLCAncmVhZCcpOgogICAgICAg\nICAgICAgICAgdmFsdWUgPSBzZWxmLnZhbHVlLnJlYWQoKQogICAgICAgICAgICBlbHNlOgogICAg\nICAgICAgICAgICAgaWYgbm90IGlzaW5zdGFuY2Uoc2VsZi52YWx1ZSwgc2l4LmJpbmFyeV90eXBl\nKToKICAgICAgICAgICAgICAgICAgICB2YWx1ZSA9IHNpeC5iKHNlbGYudmFsdWUpCiAgICAgICAg\nICAgICAgICBlbHNlOgogICAgICAgICAgICAgICAgICAgIHZhbHVlID0gc2VsZi52YWx1ZQogICAg\nICAgICAgICByLCB3ID0gb3MucGlwZSgpCiAgICAgICAgICAgIGZkID0gb3MuZmRvcGVuKHcsICd3\nYicpCiAgICAgICAgICAgIGZkLndyaXRlKHZhbHVlKQogICAgICAgICAgICBmZC5jbG9zZSgpCiAg\nICAgICAgcmV0dXJuIHIKCiAgICBkZWYgX19kZWVwY29weV9fKHNlbGYsICphcmdzKToKICA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ybiBzZWxmLl9jbWRzW2F0dHJdCgog\nICAgX19nZXRpdGVtX18gPSBfX2dldGF0dHJfXwoKICAgIGRlZiBfX3JlcHJfXyhzZWxmKToKICAg\nICAgICByZXR1cm4gJzwlcz4nICUgc2VsZi5fX25hbWVfXwoKCmNsYXNzIENodXQoQmFzZSk6Cgog\nICAgcGF0aCA9IHBvc2l4cGF0aAoKICAgIGRlZiB3cmFwcyhzZWxmLCBmdW5jKToKICAgICAgICBy\nZXR1cm4gdHlwZShmdW5jLl9fbmFtZV9fLCAoUHlQaXBlLCksIHsnZnVuYyc6IHN0YXRpY21ldGhv\nZChmdW5jKX0pKCkKCiAgICBAY29udGV4dG1hbmFnZXIKICAgIGRlZiBwaXBlcyhzZWxmLCBjbWQp\nOgogICAgICAgIHRyeToKICAgICAgICAgICAgeWllbGQgY21kCiAgICAgICAgZmluYWxseToKICAg\nICAgICAgICAgaWYgY21kLnJldHVybmNvZGVzOgogICAgICAgICAgICAgICAgc3RkZXJyID0gY21k\nLnN0ZGVycgogICAgICAgICAgICAgICAgbG9nLmVycm9yKCdFcnJvciB3aGlsZSBydW5uaW5nICVy\nXG4lcycsIGNtZCwgc3RkZXJyKQogICAgICAgICAgICAgICAgcmFpc2UgT1NFcnJvcihzdGRlcnIp\nCgogICAgZGVmIHBpcGUoc2VsZiwgYmluYXJ5LCAqYXJncywgKiprd2FyZ3MpOgogICAgICAgIHBp\ncGUgPSBnZXRhdHRyKHNlbGYsIHN0cihiaW5hcnkpKQogICAgICAgIHJldHVybiBwaXBlKCphcmdz\nLCAqKmt3YXJncykKCiAgICBkZWYgY2Qoc2VsZiwgZGlyZWN0b3J5KToKICAgICAgICAiIiJDaGFu\nZ2UgdGhlIGN1cnJlbnQgZGlyZWN0b3J5IiIiCiAgICAgICAgaWYgc2VsZi5fX25hbWVfXyBub3Qg\naW4gKCdzaCcsICdzdWRvJyk6CiAgICAgICAgICAgIHJhaXNlIEltcG9ydEVycm9yKCdZb3UgY2Fu\nIG9ubHk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5wb3AoJ2RvYycpCiAgICAgICAgICAgIGlmIGRvYyBpcyBOb25l\nOgogICAgICAgICAgICAgICAgZG9jID0gJ1VzYWdlOiAlcHJvZycKICAgICAgICAgICAgbmFtZSA9\nIGZ1bmMuX19uYW1lX18ucmVwbGFjZSgnXycsICctJykKICAgICAgICAgICAgZG9jID0gZG9jLnJl\ncGxhY2UoJyVwcm9nJywgbmFtZSkuc3RyaXAoKQogICAgICAgICAgICBkb2MgPSBkb2MucmVwbGFj\nZSgnXG4gICAgJywgJ1xuJykKICAgICAgICAgICAgaW1wb3J0IGRvY29wdAogICAgICAgICAgICBp\nZiBpc2luc3RhbmNlKGFyZ3VtZW50cywgbGlzdCk6CiAgICAgICAgICAgICAgICBkb2NvcHRzWydh\ncmd2J10gPSBhcmd1bWVudHMKICAgICAgICAgICAgICAgIGFyZ3VtZW50cyA9IGRvY29wdC5kb2Nv\ncHQoZG9jLCAqKmRvY29wdHMpCiAgICAgICAgICAgICAgICByZXR1cm4gZnVuYyhhcmd1bWVudHMp\nCiAgICAgICAgICAgIGVsc2U6CiAgICAgICAgICAgICAgICBhcmd1bWVudHMgPSBkb2NvcHQuZG9j\nb3B0KGRvYywgKipkb2NvcHRzKQogICAgICAgICAgICAgICAgc3lzLmV4aXQoZnVuYyhhcmd1bWVu\ndHMpKQogICAgICAgIHdyYXBwZXIuY29uc29sZV9zY3JpcHQgPSBUcnVlCiAgICAgICAgcmV0dXJu\nIHdyYXBwZXIKICAgIGlmIG5vdCBhcmdzOgogICAgICAgIGRlZiB3YWl0aW5nX2Zvcl9mdW5jKGZ1\nbmMpOgogICAgICAgICAgICByZXR1cm4gX2NvbnNvbGVfc2NyaXB0KGZ1bmMsICoqZG9jb3B0cykK\nICAgICAgICByZXR1cm4gd2FpdGluZ19mb3JfZnVuYwogICAgZWxzZToKICAgICAgICByZXR1cm4g\nX2NvbnNvbGVfc2NyaXB0KGFyZ3NbMF0pCgoKZGVmIGdlbmVyYXRlKGZpbGVuYW1lLCBhcmd1bWVu\ndHM9Tm9uZSk6CiAgICBpZiBhcmd1bWVudHMgaXMgTm9uZToKICAgICAgICBhcmd1bWVudHMgPSB7\nfQogICAgaWYgbm90IG9zLnBhdGguaXNmaWxlKGZpbGVuYW1lKToKICAgICAgICBtb2QgPSBfX2lt\ncG9ydF9fKGZpbGVuYW1lLCBnbG9iYWxzKCksIGxvY2FscygpLCBbJyddKQogICAgICAgIGZpbGVu\nYW1lID0gbW9kLl9fZmlsZV9fCiAgICAgICAgbmFtZSA9IG1vZC5fX25hbWVfXwogICAgZWxzZToK\nICAgICAgICBkaXJuYW1lID0gb3MucGF0aC5kaXJuYW1lKGZpbGVuYW1lKQogICAgICAgIHN5cy5w\nYXRoLmluc2VydCgwLCBkaXJuYW1lKQogICAgICAgIG5hbWUgPSBpbnNwZWN0LmdldG1vZHVsZW5h\nbWUoZmlsZW5hbWUpCiAgICAgICAgbW9kID0gX19pbXBvcnRfXyhuYW1lKQoKICAgIGZpbGVuYW1l\ncyA9IFtdCiAgICBmb3IgaywgdiBpbiBtb2QuX19kaWN0X18uaXRlbXMoKToKICAgICAgICBpZiBn\nZXRhdHRyKHYsICdjb25zb2xlX3NjcmlwdCcsIEZhbHNlKSBpcyBUcnVlOgogICAgICAgICAgICBm\naWxlbmFtZXMuYXBwZW5kKGspCgogICAgaWYgYXJndW1lbnRzLmdldCgnLS1saXN0LWVudHJ5LXBv\naW50cycpOgogICAgICAgIGZvciBuYW1lIGluIGZpbGVuYW1lczoKICAgICAgICAgICAgcHJpbnQo\nKCclcyA9ICVzOiVzJyAlIChuYW1lLnJlcGxhY2UoJ18nLCAnLScpLAogICAgICAgICAgICAgICAg\nICAgICAgICAgICAgICAgICAgIG1vZC5fX25hbWVfXywgbmFtZSkpKQogICAgICAgIHJldHVybiAw\nCgogICAgZGVzdCA9IG9zLnBhdGguZXhwYW5kdXNlcihhcmd1bWVudHMuZ2V0KCctLWRlc3RpbmF0\naW9uJywgJ2Rpc3Qvc2NyaXB0cycpKQogICAgc2gubWtkaXIoJy1wJywgZGVzdCkKCiAgICBkZWYg\nZW5jb2RlX21vZHVsZShtb2QpOgogICAgICAgIGlmIG5vdCBoYXNhdHRyKG1vZCwgJ19fZmlsZV9f\nJyk6CiAgICAgICAgICAgIG1vZCA9IF9faW1wb3J0X18obW9kKQogICAgICAgIGRhdGEgPSBpbnNw\nZWN0LmdldHNvdXJjZShtb2QpCiAgICAgICAgZGF0YSA9IGJhc2U2NC5lbmNvZGVzdHJpbmcoc2l4\nLmIoZGF0YSkpCiAgICAgICAgcmV0dXJuICdtb2RzLmFwcGVuZCgoJXIsICVyKSlcbicgJSAoc3Ry\nKG1vZC5fX25hbWVfXyksIGRhdGEpCgogICAgbW9kdWxlcyA9IFsKICAgICAgICAnc2l4JywgJ2Rv\nY29wdCcsICdDb25maWdPYmplY3QnLCBzeXMubW9kdWxlc1tfX25hbWVfX10KICAgIF0gKyBhcmd1\nbWVudHMuZ2V0KCc8TU9EVUxFPicsIFtdKQogICAgbW9kdWxlcyA9ICcnLmpvaW4oW2VuY29kZV9t\nb2R1bGUobSkgZm9yIG0gaW4gbW9kdWxlc10pCgogICAgZm9yIG5hbWUgaW4gZmlsZW5hbWVzOgog\nICAgICAgIHNjcmlwdCA9IG9zLnBhdGguam9pbihkZXN0LCBuYW1lLnJlcGxhY2UoJ18nLCAnLScp\nKQogICAgICAgIHdpdGggb3BlbihzY3JpcHQsICd3JykgYXMgZmQ6CiAgICAgICAgICAgIGZkLndy\naXRlKFNDUklQVF9IRUFERVIgKyBtb2R1bGVzICsgTE9BRF9NT0RVTEVTKQogICAgICAgICAgICBm\nZC53cml0ZShpbnNwZWN0LmdldHNvdXJjZShtb2QpLnJlcGxhY2UoJ19fbWFpbl9fJywKICAgICAg\nICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdfX2NodXRpZmll\nZF9fJykpCiAgICAgICAgICAgIGZkLndyaXRlKCJpZiBfX25hbWVfXyA9PSAnX19tYWluX18nOl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ICAgIG1vZC53cmFwc19tb2R1bGUobW9kKQogICAgZWxzZToKICAgICAg\nICBzeXMubW9kdWxlc1tuYW1lXSA9IG1vZAoKaW1wb3J0IHNpeAonJycubHN0cmlwKCkKCmlmIF9f\nbmFtZV9fICE9ICdfX21haW5fXyc6CiAgICBtb2QgPSBzeXMubW9kdWxlc1tfX25hbWVfX10KICAg\nIHdyYXBzX21vZHVsZShtb2QpCg==\n'))
+for name, code in mods:
+ if PY3:
+ if isinstance(code, str):
+ code = code.encode('utf-8')
+ else:
+ name = bytes(name)
+ code = base64.decodestring(code)
+ mod = types.ModuleType(name)
+ globs = dict()
+ if PY3:
+ if isinstance(code, bytes):
+ code = code.decode('utf-8')
+ exec(code, globs)
+ else:
+ exec('exec code in globs')
+ mod.__dict__.update(globs)
+ if name == 'chut':
+ mod.wraps_module(mod)
+ else:
+ sys.modules[name] = mod
+
+import six
+# -*- coding: utf-8 -*-
+from chut import * # NOQA
+
+
+@console_script
+def rfsync(args):
+ """
+ Usage: %prog <host>:<path> [--] [<find_options>...]
+ %prog [-] [-q] [-p] [--] [<rsync_options>...]
+
+ """
+ print(args)
+ remote = args.get('<host>:<path>')
+ if remote not in (None, '-'):
+ host, p = remote.split(':')
+ srv = ssh(host)
+ options = ' '.join(args.get('<find_options>', [])) or ''
+ for line in srv.find(p, options):
+ line = line.strip()
+ print(srv.join(line))
+ else:
+ options = ' '.join(args.get('<rsync_options>', [])) or '-aP'
+ targets = sys.stdin.readlines()
+ targets = [p.strip('\n/') for p in targets]
+ print(targets)
+ if args['-p']:
+ targets = [path.dirname(p) + '"' for p in targets]
+ targets = [p.strip('/ ') for p in targets if p.strip('/ ')]
+ targets = sorted(set(targets))
+ if not args['-q']:
+ print('$ rsync %s \\\n\t%s \\\n\t.' % (
+ options,
+ ' \\\n\t'.join(targets)
+ ))
+ rsync(options, ' '.join(targets), '.', shell=True) > 1
+if __name__ == '__main__':
+ rfsync()
View
2  docs/_static/binaries/ssh-copy-id
1 addition, 1 deletion not shown
View
2  docs/_static/binaries/translate
1 addition, 1 deletion not shown
View
8 docs/examples.rst
@@ -18,6 +18,14 @@ translator
Get the `standalone script <_static/binaries/translate>`_
+rfsync
+======
+
+.. literalinclude:: ../chut/examples/rfsync.py
+ :language: python
+
+Get the `standalone script <_static/binaries/rfsync>`_
+
chutify-examples
=================

0 comments on commit 9c38881

Please sign in to comment.
Something went wrong with that request. Please try again.