{"action":"created","issue":{"url":"https://api.github.com/repos/vivisect/synapse/issues/109","repository_url":"https://api.github.com/repos/vivisect/synapse","labels_url":"https://api.github.com/repos/vivisect/synapse/issues/109/labels{/name}","comments_url":"https://api.github.com/repos/vivisect/synapse/issues/109/comments","events_url":"https://api.github.com/repos/vivisect/synapse/issues/109/events","html_url":"https://github.com/vivisect/synapse/pull/109","id":196773120,"number":109,"title":"types: add recursive option to SeprType","user":{"login":"williballenthin","id":156560,"avatar_url":"https://avatars.githubusercontent.com/u/156560?v=3","gravatar_id":"","url":"https://api.github.com/users/williballenthin","html_url":"https://github.com/williballenthin","followers_url":"https://api.github.com/users/williballenthin/followers","following_url":"https://api.github.com/users/williballenthin/following{/other_user}","gists_url":"https://api.github.com/users/williballenthin/gists{/gist_id}","starred_url":"https://api.github.com/users/williballenthin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/williballenthin/subscriptions","organizations_url":"https://api.github.com/users/williballenthin/orgs","repos_url":"https://api.github.com/users/williballenthin/repos","events_url":"https://api.github.com/users/williballenthin/events{/privacy}","received_events_url":"https://api.github.com/users/williballenthin/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2016-12-20T20:29:43Z","updated_at":"2016-12-20T21:30:15Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/vivisect/synapse/pulls/109","html_url":"https://github.com/vivisect/synapse/pull/109","diff_url":"https://github.com/vivisect/synapse/pull/109.diff","patch_url":"https://github.com/vivisect/synapse/pull/109.patch"},"body":"this PR sits on top of #108, so consider that one first.\r\n\r\nhere we add support for recursive comp types. that is, a subprop of a comp type may be an instance of that comp type. i've updated `SeprType` to support recursion. this means you can do something like:\r\n\r\n```\r\n>>> tlib.addType('path',\r\n                 subof='sepr',\r\n                 sep='/',\r\n                 reverse=1,\r\n                 fields='dirname,path|filename,str:lwr',\r\n                 recursive=1)\r\n>>> tlib.getTypeChop('path','/home/user/Downloads')\r\n\r\n<<<\r\n('/home/user/downloads',\r\n  {\r\n    'dirname': '/home/user',\r\n    'filename': 'downloads',\r\n  })\r\n```\r\n\r\nthere's possible a number of applications for this (fqdn, file paths, etc.), so i hope its worth the increased complexity within `SeprType`.\r\n\r\nalso adds the `strictfields` option to `SeprType`. by default, this option is set. when it is unset, then missing propvalues are not set, and no `BadPropValu` exception is raised. this makes it easy to parse strings with an optional suffix. for example:\r\n\r\n```\r\n>>> tlib.addType('filename',\r\n                 subof='sepr',\r\n                 sep='.',\r\n                 reverse=1,\r\n                 strictfields=0,\r\n                 fields='basename,str:lwr|ext,str:lwr')\r\n>>> tlib.getTypeChop('filename','kernel32.dll')\r\n\r\n<<<\r\n('kernel32.dll',\r\n  {\r\n    'basename': 'kernel32',\r\n    'ext': '.dll',\r\n  })\r\n\r\n>>> # look, no error!\r\n>>> tlib.getTypeChop('filename','Downloads')\r\n\r\n<<<\r\n('Downloads',\r\n  {\r\n    'basename': 'downloads',\r\n  })\r\n```"},"comment":{"url":"https://api.github.com/repos/vivisect/synapse/issues/comments/268364907","html_url":"https://github.com/vivisect/synapse/pull/109#issuecomment-268364907","issue_url":"https://api.github.com/repos/vivisect/synapse/issues/109","id":268364907,"user":{"login":"coveralls","id":2354108,"avatar_url":"https://avatars.githubusercontent.com/u/2354108?v=3","gravatar_id":"","url":"https://api.github.com/users/coveralls","html_url":"https://github.com/coveralls","followers_url":"https://api.github.com/users/coveralls/followers","following_url":"https://api.github.com/users/coveralls/following{/other_user}","gists_url":"https://api.github.com/users/coveralls/gists{/gist_id}","starred_url":"https://api.github.com/users/coveralls/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/coveralls/subscriptions","organizations_url":"https://api.github.com/users/coveralls/orgs","repos_url":"https://api.github.com/users/coveralls/repos","events_url":"https://api.github.com/users/coveralls/events{/privacy}","received_events_url":"https://api.github.com/users/coveralls/received_events","type":"User","site_admin":false},"created_at":"2016-12-20T21:30:15Z","updated_at":"2016-12-20T21:30:15Z","body":"\n[![Coverage Status](https://coveralls.io/builds/9367598/badge)](https://coveralls.io/builds/9367598)\n\nCoverage decreased (-0.006%) to 86.983% when pulling **c4da9e56ba5954d1ee2e3a5c3bdbe32ba3f619ca on williballenthin:sepr-recursive** into **3a4136db971d77c5c3ed9423ee064ae1ecc59966 on vivisect:master**.\n"}}
{"actor":{"display_login":"coveralls"}}