{"action":"created","comment":{"url":"https://api.github.com/repos/kaitai-io/kaitai_struct_compiler/pulls/comments/75003963","id":75003963,"diff_hunk":"@@ -9,12 +9,14 @@ import io.kaitai.struct.translators.{BaseTranslator, PythonTranslator, TypeProvi\n \n class PythonCompiler(verbose: Boolean, out: LanguageOutputWriter)\n   extends LanguageCompiler(verbose, out)\n-    with StreamStructNames\n     with UniversalFooter\n     with UpperCamelCaseClasses\n     with EveryReadIsExpression\n+    with AllocateIOLocalVar\n     with NoNeedForFullClassPath {\n \n+  import PythonCompiler._","path":"shared/src/main/scala/io/kaitai/struct/languages/PythonCompiler.scala","position":19,"original_position":19,"commit_id":"574c39fb2f596bfa1d94485a1fd0a1c23675395d","original_commit_id":"574c39fb2f596bfa1d94485a1fd0a1c23675395d","user":{"login":"codacy-bot","id":19940114,"avatar_url":"https://avatars.githubusercontent.com/u/19940114?v=3","gravatar_id":"","url":"https://api.github.com/users/codacy-bot","html_url":"https://github.com/codacy-bot","followers_url":"https://api.github.com/users/codacy-bot/followers","following_url":"https://api.github.com/users/codacy-bot/following{/other_user}","gists_url":"https://api.github.com/users/codacy-bot/gists{/gist_id}","starred_url":"https://api.github.com/users/codacy-bot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/codacy-bot/subscriptions","organizations_url":"https://api.github.com/users/codacy-bot/orgs","repos_url":"https://api.github.com/users/codacy-bot/repos","events_url":"https://api.github.com/users/codacy-bot/events{/privacy}","received_events_url":"https://api.github.com/users/codacy-bot/received_events","type":"User","site_admin":false},"body":"![Codacy](https://www.codacy.com/assets/images/favicon.png) Issue found: [Put imports in the beginning of the package](https://www.codacy.com/app/greycat-na-kor/kaitai_struct_compiler/file/3342916955/issues/source?bid=3217973&fileBranchId=3580213#l18)","created_at":"2016-08-16T19:30:42Z","updated_at":"2016-08-16T19:30:42Z","html_url":"https://github.com/kaitai-io/kaitai_struct_compiler/pull/13#discussion_r75003963","pull_request_url":"https://api.github.com/repos/kaitai-io/kaitai_struct_compiler/pulls/13","_links":{"self":{"href":"https://api.github.com/repos/kaitai-io/kaitai_struct_compiler/pulls/comments/75003963"},"html":{"href":"https://github.com/kaitai-io/kaitai_struct_compiler/pull/13#discussion_r75003963"},"pull_request":{"href":"https://api.github.com/repos/kaitai-io/kaitai_struct_compiler/pulls/13"}}},"pull_request":{"url":"https://api.github.com/repos/kaitai-io/kaitai_struct_compiler/pulls/13","id":81514625,"html_url":"https://github.com/kaitai-io/kaitai_struct_compiler/pull/13","diff_url":"https://github.com/kaitai-io/kaitai_struct_compiler/pull/13.diff","patch_url":"https://github.com/kaitai-io/kaitai_struct_compiler/pull/13.patch","issue_url":"https://api.github.com/repos/kaitai-io/kaitai_struct_compiler/issues/13","number":13,"state":"open","locked":false,"title":"Formal names","user":{"login":"GreyCat","id":157154,"avatar_url":"https://avatars.githubusercontent.com/u/157154?v=3","gravatar_id":"","url":"https://api.github.com/users/GreyCat","html_url":"https://github.com/GreyCat","followers_url":"https://api.github.com/users/GreyCat/followers","following_url":"https://api.github.com/users/GreyCat/following{/other_user}","gists_url":"https://api.github.com/users/GreyCat/gists{/gist_id}","starred_url":"https://api.github.com/users/GreyCat/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GreyCat/subscriptions","organizations_url":"https://api.github.com/users/GreyCat/orgs","repos_url":"https://api.github.com/users/GreyCat/repos","events_url":"https://api.github.com/users/GreyCat/events{/privacy}","received_events_url":"https://api.github.com/users/GreyCat/received_events","type":"User","site_admin":false},"body":"Well, this looks like a *big* commit, but in reality, it's all about massive refactoring, no new functionality here.\r\n\r\nThe basic idea is simple: previously, we've worked with `String` as identifiers, using `String` both for identifier from the .ksy file itself (i.e. `foo_bar`), rendition of it to language-specific style `fooBar` and rendition of it with some special stuff appended/prendended to be invoked as a private member name or something (i.e. `this.fooBar` or `self.foo_bar` or `@foo_bar` or something).\r\n\r\nIt created a huge mess with all that chain of `lowerCamelCase` functions that were abused and that lead to lots of code duplication and hardships while developing new languages support. For example, it would be great to just change `this.` into `$this->` in exactly one place and kind of convert Java into PHP.\r\n\r\nSo, here's what I came up with:\r\n\r\n* All identifiers are now not the simple `String`, but a string wrapped in some subclass of `Identifier`.\r\n* It is illegal to use identifier as is, embedding / concatenating it to the string. Before usage, identifier must undergo some transformation into a string, there are now 3 of them:\r\n  * `idToStr` - basic transformation used in a language (`foo_bar` -> `fooBar`)\r\n  * `privateMemberName` - transform identifier to something that's ready to be used as a reference to private member (`foo_bar` -> `@foo_bar` in Ruby, `this.fooBar` in Java, `_fooBar` in C# or something along the lines)\r\n  * `publicMemberName` - transform identifier to the name of public member (i.e. a getter method, or property, or something like that — `foo_bar` -> `foo_bar` in Ruby, `fooBar` in Java, `FooBar` in C#).\r\n\r\nThere are no more plain string mangling, appending cryptic `_io_`, `_raw_`, etc, prefixes. If you want an additional identifier for a raw byte array for a given identifier, it is `RawIdentifier(existingId)` - voila, that's neatly wrapper, and all id-to-string functions are expected to work properly with that. The same stuff mostly applies to temporary IO vars.\r\n\r\nIn future, probably it should be very easy to add options to override default languages identifier transformation rules using this thing.\r\n\r\nIt's still not a very polished code (but it seems to pass the tests), so I would really love to hear some thoughts and feedback on it, especially from @LogicAndTrick, who seems to be working on support for yet another language.","created_at":"2016-08-16T17:47:54Z","updated_at":"2016-08-16T19:30:42Z","closed_at":null,"merged_at":null,"merge_commit_sha":"7653a7d52bbbcf3d1e63f8acd9a2039643b4f809","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/kaitai-io/kaitai_struct_compiler/pulls/13/commits","review_comments_url":"https://api.github.com/repos/kaitai-io/kaitai_struct_compiler/pulls/13/comments","review_comment_url":"https://api.github.com/repos/kaitai-io/kaitai_struct_compiler/pulls/comments{/number}","comments_url":"https://api.github.com/repos/kaitai-io/kaitai_struct_compiler/issues/13/comments","statuses_url":"https://api.github.com/repos/kaitai-io/kaitai_struct_compiler/statuses/574c39fb2f596bfa1d94485a1fd0a1c23675395d","head":{"label":"kaitai-io:formal_names","ref":"formal_names","sha":"574c39fb2f596bfa1d94485a1fd0a1c23675395d","user":{"login":"kaitai-io","id":17322584,"avatar_url":"https://avatars.githubusercontent.com/u/17322584?v=3","gravatar_id":"","url":"https://api.github.com/users/kaitai-io","html_url":"https://github.com/kaitai-io","followers_url":"https://api.github.com/users/kaitai-io/followers","following_url":"https://api.github.com/users/kaitai-io/following{/other_user}","gists_url":"https://api.github.com/users/kaitai-io/gists{/gist_id}","starred_url":"https://api.github.com/users/kaitai-io/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kaitai-io/subscriptions","organizations_url":"https://api.github.com/users/kaitai-io/orgs","repos_url":"https://api.github.com/users/kaitai-io/repos","events_url":"https://api.github.com/users/kaitai-io/events{/privacy}","received_events_url":"https://api.github.com/users/kaitai-io/received_events","type":"Organization","site_admin":false},"repo":{"id":52196052,"name":"kaitai_struct_compiler","full_name":"kaitai-io/kaitai_struct_compiler","owner":{"login":"kaitai-io","id":17322584,"avatar_url":"https://avatars.githubusercontent.com/u/17322584?v=3","gravatar_id":"","url":"https://api.github.com/users/kaitai-io","html_url":"https://github.com/kaitai-io","followers_url":"https://api.github.com/users/kaitai-io/followers","following_url":"https://api.github.com/users/kaitai-io/following{/other_user}","gists_url":"https://api.github.com/users/kaitai-io/gists{/gist_id}","starred_url":"https://api.github.com/users/kaitai-io/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kaitai-io/subscriptions","organizations_url":"https://api.github.com/users/kaitai-io/orgs","repos_url":"https://api.github.com/users/kaitai-io/repos","events_url":"https://api.github.com/users/kaitai-io/events{/privacy}","received_events_url":"https://api.github.com/users/kaitai-io/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/kaitai-io/kaitai_struct_compiler","description":"Kaitai Struct: compiler to translate .ksy => .cpp / .cs / .java / .js / .py / .rb","fork":false,"url":"https://api.github.com/repos/kaitai-io/kaitai_struct_compiler","forks_url":"https://api.github.com/repos/kaitai-io/kaitai_struct_compiler/forks","keys_url":"https://api.github.com/repos/kaitai-io/kaitai_struct_compiler/keys{/key_id}","collaborators_url":"https://api.github.com/repos/kaitai-io/kaitai_struct_compiler/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/kaitai-io/kaitai_struct_compiler/teams","hooks_url":"https://api.github.com/repos/kaitai-io/kaitai_struct_compiler/hooks","issue_events_url":"https://api.github.com/repos/kaitai-io/kaitai_struct_compiler/issues/events{/number}","events_url":"https://api.github.com/repos/kaitai-io/kaitai_struct_compiler/events","assignees_url":"https://api.github.com/repos/kaitai-io/kaitai_struct_compiler/assignees{/user}","branches_url":"https://api.github.com/repos/kaitai-io/kaitai_struct_compiler/branches{/branch}","tags_url":"https://api.github.com/repos/kaitai-io/kaitai_struct_compiler/tags","blobs_url":"https://api.github.com/repos/kaitai-io/kaitai_struct_compiler/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/kaitai-io/kaitai_struct_compiler/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/kaitai-io/kaitai_struct_compiler/git/refs{/sha}","trees_url":"https://api.github.com/repos/kaitai-io/kaitai_struct_compiler/git/trees{/sha}","statuses_url":"https://api.github.com/repos/kaitai-io/kaitai_struct_compiler/statuses/{sha}","languages_url":"https://api.github.com/repos/kaitai-io/kaitai_struct_compiler/languages","stargazers_url":"https://api.github.com/repos/kaitai-io/kaitai_struct_compiler/stargazers","contributors_url":"https://api.github.com/repos/kaitai-io/kaitai_struct_compiler/contributors","subscribers_url":"https://api.github.com/repos/kaitai-io/kaitai_struct_compiler/subscribers","subscription_url":"https://api.github.com/repos/kaitai-io/kaitai_struct_compiler/subscription","commits_url":"https://api.github.com/repos/kaitai-io/kaitai_struct_compiler/commits{/sha}","git_commits_url":"https://api.github.com/repos/kaitai-io/kaitai_struct_compiler/git/commits{/sha}","comments_url":"https://api.github.com/repos/kaitai-io/kaitai_struct_compiler/comments{/number}","issue_comment_url":"https://api.github.com/repos/kaitai-io/kaitai_struct_compiler/issues/comments{/number}","contents_url":"https://api.github.com/repos/kaitai-io/kaitai_struct_compiler/contents/{+path}","compare_url":"https://api.github.com/repos/kaitai-io/kaitai_struct_compiler/compare/{base}...{head}","merges_url":"https://api.github.com/repos/kaitai-io/kaitai_struct_compiler/merges","archive_url":"https://api.github.com/repos/kaitai-io/kaitai_struct_compiler/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/kaitai-io/kaitai_struct_compiler/downloads","issues_url":"https://api.github.com/repos/kaitai-io/kaitai_struct_compiler/issues{/number}","pulls_url":"https://api.github.com/repos/kaitai-io/kaitai_struct_compiler/pulls{/number}","milestones_url":"https://api.github.com/repos/kaitai-io/kaitai_struct_compiler/milestones{/number}","notifications_url":"https://api.github.com/repos/kaitai-io/kaitai_struct_compiler/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/kaitai-io/kaitai_struct_compiler/labels{/name}","releases_url":"https://api.github.com/repos/kaitai-io/kaitai_struct_compiler/releases{/id}","deployments_url":"https://api.github.com/repos/kaitai-io/kaitai_struct_compiler/deployments","created_at":"2016-02-21T07:36:26Z","updated_at":"2016-08-11T23:08:54Z","pushed_at":"2016-08-16T19:29:06Z","git_url":"git://github.com/kaitai-io/kaitai_struct_compiler.git","ssh_url":"git@github.com:kaitai-io/kaitai_struct_compiler.git","clone_url":"https://github.com/kaitai-io/kaitai_struct_compiler.git","svn_url":"https://github.com/kaitai-io/kaitai_struct_compiler","homepage":"http://kaitai.io/","size":524,"stargazers_count":12,"watchers_count":12,"language":"Scala","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":4,"mirror_url":null,"open_issues_count":1,"forks":4,"open_issues":1,"watchers":12,"default_branch":"master"}},"base":{"label":"kaitai-io:master","ref":"master","sha":"b42d26b6c9ab32cee41a70748d9dca857f3474ae","user":{"login":"kaitai-io","id":17322584,"avatar_url":"https://avatars.githubusercontent.com/u/17322584?v=3","gravatar_id":"","url":"https://api.github.com/users/kaitai-io","html_url":"https://github.com/kaitai-io","followers_url":"https://api.github.com/users/kaitai-io/followers","following_url":"https://api.github.com/users/kaitai-io/following{/other_user}","gists_url":"https://api.github.com/users/kaitai-io/gists{/gist_id}","starred_url":"https://api.github.com/users/kaitai-io/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kaitai-io/subscriptions","organizations_url":"https://api.github.com/users/kaitai-io/orgs","repos_url":"https://api.github.com/users/kaitai-io/repos","events_url":"https://api.github.com/users/kaitai-io/events{/privacy}","received_events_url":"https://api.github.com/users/kaitai-io/received_events","type":"Organization","site_admin":false},"repo":{"id":52196052,"name":"kaitai_struct_compiler","full_name":"kaitai-io/kaitai_struct_compiler","owner":{"login":"kaitai-io","id":17322584,"avatar_url":"https://avatars.githubusercontent.com/u/17322584?v=3","gravatar_id":"","url":"https://api.github.com/users/kaitai-io","html_url":"https://github.com/kaitai-io","followers_url":"https://api.github.com/users/kaitai-io/followers","following_url":"https://api.github.com/users/kaitai-io/following{/other_user}","gists_url":"https://api.github.com/users/kaitai-io/gists{/gist_id}","starred_url":"https://api.github.com/users/kaitai-io/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kaitai-io/subscriptions","organizations_url":"https://api.github.com/users/kaitai-io/orgs","repos_url":"https://api.github.com/users/kaitai-io/repos","events_url":"https://api.github.com/users/kaitai-io/events{/privacy}","received_events_url":"https://api.github.com/users/kaitai-io/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/kaitai-io/kaitai_struct_compiler","description":"Kaitai Struct: compiler to translate .ksy => .cpp / .cs / .java / .js / .py / .rb","fork":false,"url":"https://api.github.com/repos/kaitai-io/kaitai_struct_compiler","forks_url":"https://api.github.com/repos/kaitai-io/kaitai_struct_compiler/forks","keys_url":"https://api.github.com/repos/kaitai-io/kaitai_struct_compiler/keys{/key_id}","collaborators_url":"https://api.github.com/repos/kaitai-io/kaitai_struct_compiler/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/kaitai-io/kaitai_struct_compiler/teams","hooks_url":"https://api.github.com/repos/kaitai-io/kaitai_struct_compiler/hooks","issue_events_url":"https://api.github.com/repos/kaitai-io/kaitai_struct_compiler/issues/events{/number}","events_url":"https://api.github.com/repos/kaitai-io/kaitai_struct_compiler/events","assignees_url":"https://api.github.com/repos/kaitai-io/kaitai_struct_compiler/assignees{/user}","branches_url":"https://api.github.com/repos/kaitai-io/kaitai_struct_compiler/branches{/branch}","tags_url":"https://api.github.com/repos/kaitai-io/kaitai_struct_compiler/tags","blobs_url":"https://api.github.com/repos/kaitai-io/kaitai_struct_compiler/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/kaitai-io/kaitai_struct_compiler/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/kaitai-io/kaitai_struct_compiler/git/refs{/sha}","trees_url":"https://api.github.com/repos/kaitai-io/kaitai_struct_compiler/git/trees{/sha}","statuses_url":"https://api.github.com/repos/kaitai-io/kaitai_struct_compiler/statuses/{sha}","languages_url":"https://api.github.com/repos/kaitai-io/kaitai_struct_compiler/languages","stargazers_url":"https://api.github.com/repos/kaitai-io/kaitai_struct_compiler/stargazers","contributors_url":"https://api.github.com/repos/kaitai-io/kaitai_struct_compiler/contributors","subscribers_url":"https://api.github.com/repos/kaitai-io/kaitai_struct_compiler/subscribers","subscription_url":"https://api.github.com/repos/kaitai-io/kaitai_struct_compiler/subscription","commits_url":"https://api.github.com/repos/kaitai-io/kaitai_struct_compiler/commits{/sha}","git_commits_url":"https://api.github.com/repos/kaitai-io/kaitai_struct_compiler/git/commits{/sha}","comments_url":"https://api.github.com/repos/kaitai-io/kaitai_struct_compiler/comments{/number}","issue_comment_url":"https://api.github.com/repos/kaitai-io/kaitai_struct_compiler/issues/comments{/number}","contents_url":"https://api.github.com/repos/kaitai-io/kaitai_struct_compiler/contents/{+path}","compare_url":"https://api.github.com/repos/kaitai-io/kaitai_struct_compiler/compare/{base}...{head}","merges_url":"https://api.github.com/repos/kaitai-io/kaitai_struct_compiler/merges","archive_url":"https://api.github.com/repos/kaitai-io/kaitai_struct_compiler/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/kaitai-io/kaitai_struct_compiler/downloads","issues_url":"https://api.github.com/repos/kaitai-io/kaitai_struct_compiler/issues{/number}","pulls_url":"https://api.github.com/repos/kaitai-io/kaitai_struct_compiler/pulls{/number}","milestones_url":"https://api.github.com/repos/kaitai-io/kaitai_struct_compiler/milestones{/number}","notifications_url":"https://api.github.com/repos/kaitai-io/kaitai_struct_compiler/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/kaitai-io/kaitai_struct_compiler/labels{/name}","releases_url":"https://api.github.com/repos/kaitai-io/kaitai_struct_compiler/releases{/id}","deployments_url":"https://api.github.com/repos/kaitai-io/kaitai_struct_compiler/deployments","created_at":"2016-02-21T07:36:26Z","updated_at":"2016-08-11T23:08:54Z","pushed_at":"2016-08-16T19:29:06Z","git_url":"git://github.com/kaitai-io/kaitai_struct_compiler.git","ssh_url":"git@github.com:kaitai-io/kaitai_struct_compiler.git","clone_url":"https://github.com/kaitai-io/kaitai_struct_compiler.git","svn_url":"https://github.com/kaitai-io/kaitai_struct_compiler","homepage":"http://kaitai.io/","size":524,"stargazers_count":12,"watchers_count":12,"language":"Scala","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":4,"mirror_url":null,"open_issues_count":1,"forks":4,"open_issues":1,"watchers":12,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/kaitai-io/kaitai_struct_compiler/pulls/13"},"html":{"href":"https://github.com/kaitai-io/kaitai_struct_compiler/pull/13"},"issue":{"href":"https://api.github.com/repos/kaitai-io/kaitai_struct_compiler/issues/13"},"comments":{"href":"https://api.github.com/repos/kaitai-io/kaitai_struct_compiler/issues/13/comments"},"review_comments":{"href":"https://api.github.com/repos/kaitai-io/kaitai_struct_compiler/pulls/13/comments"},"review_comment":{"href":"https://api.github.com/repos/kaitai-io/kaitai_struct_compiler/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/kaitai-io/kaitai_struct_compiler/pulls/13/commits"},"statuses":{"href":"https://api.github.com/repos/kaitai-io/kaitai_struct_compiler/statuses/574c39fb2f596bfa1d94485a1fd0a1c23675395d"}}}}
{"actor":{"display_login":"codacy-bot"}}