{"action":"created","comment":{"url":"https://api.github.com/repos/IronLanguages/ironpython2/pulls/comments/189139658","pull_request_review_id":121262010,"id":189139658,"diff_hunk":"@@ -0,0 +1,207 @@\n+/* ****************************************************************************\n+ *\n+ * Copyright (c) Microsoft Corporation. \n+ *\n+ * This source code is subject to terms and conditions of the Microsoft Public License. A \n+ * copy of the license can be found in the License.html file at the root of this distribution. If \n+ * you cannot locate the  Microsoft Public License, please send an email to \n+ * ironpy@microsoft.com. By using this source code in any fashion, you are agreeing to be bound \n+ * by the terms of the Microsoft Public License.\n+ *\n+ * You must not remove this notice, or any other, from this software.\n+ *\n+ *\n+ * ***********************************************************************/\n+\n+#if FEATURE_NATIVE || NETCOREAPP2_0\n+\n+using System;\n+using System.Collections;\n+using System.Collections.Generic;\n+using System.ComponentModel;\n+using System.IO;\n+using System.IO.Pipes;\n+using System.Runtime.InteropServices;\n+\n+using Microsoft.Scripting.Runtime;\n+\n+using IronPython.Runtime;\n+using IronPython.Runtime.Operations;\n+\n+using System.Numerics;\n+\n+[assembly: PythonModule(\"grp\", typeof(IronPython.Modules.PythonGrp), PythonModuleAttribute.PlatformFamily.Unix)]\n+namespace IronPython.Modules {\n+    \n+    public static class PythonGrp {\n+        public const string __doc__ = @\"Access to the Unix group database.\n+        \n+Group entries are reported as 4-tuples containing the following fields\n+from the group database, in order:\n+\n+  gr_name   - name of the group\n+  gr_passwd - group password (encrypted); often empty\n+  gr_gid    - numeric ID of the group\n+  gr_mem    - list of members\n+  \n+The gid is an integer, name and password are strings.  (Note that most\n+users are not explicitly listed as members of the groups they are in\n+according to the password database.  Check both databases to get\n+complete membership information.)\";\n+\n+        [StructLayout(LayoutKind.Sequential)]\n+        private struct group {\n+            [MarshalAs(UnmanagedType.LPStr)]\n+            public string gr_name;\n+            [MarshalAs(UnmanagedType.LPStr)]\n+            public string gr_passwd;\n+            public int gr_gid;\n+            public IntPtr gr_mem;\n+        };\n+\n+        [PythonType(\"struct_group\")]\n+        [Documentation(@\"grp.struct_group: Results from getgr*() routines.\n+\n+This object may be accessed either as a tuple of\n+  (gr_name,gr_passwd,gr_gid,gr_mem)\n+or via the object attributes as named in the above tuple.\n+\")]\n+        public class struct_group : PythonTuple {\n+\n+            private const int LENGTH = 4;\n+\n+            internal struct_group(string gr_name, string gr_passwd, int gr_gid, List gr_mem) {\n+                this.gr_name = gr_name;\n+                this.gr_passwd = gr_passwd;\n+                this.gr_gid = gr_gid;\n+                this.gr_mem = gr_mem;\n+            }\n+\n+            [Documentation(\"group name\")]\n+            public string gr_name { get; }\n+\n+            [Documentation(\"password\")]\n+            public string gr_passwd { get; }\n+\n+            [Documentation(\"group id\")]\n+            public int gr_gid { get; }\n+\n+            [Documentation(\"group members\")]\n+            public List gr_mem { get; }\n+\n+            public override int __len__() {\n+                return LENGTH;\n+            }\n+\n+            private object[] AsArray() {\n+                return new object[] { gr_name, gr_passwd, gr_gid, gr_mem };","path":"Src/IronPython.Modules/grp.cs","position":97,"original_position":97,"commit_id":"4f6b016199ca7572232ae513774e3ed30e02f9d9","original_commit_id":"4f6b016199ca7572232ae513774e3ed30e02f9d9","user":{"login":"slozier","id":6061329,"avatar_url":"https://avatars3.githubusercontent.com/u/6061329?v=4","gravatar_id":"","url":"https://api.github.com/users/slozier","html_url":"https://github.com/slozier","followers_url":"https://api.github.com/users/slozier/followers","following_url":"https://api.github.com/users/slozier/following{/other_user}","gists_url":"https://api.github.com/users/slozier/gists{/gist_id}","starred_url":"https://api.github.com/users/slozier/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/slozier/subscriptions","organizations_url":"https://api.github.com/users/slozier/orgs","repos_url":"https://api.github.com/users/slozier/repos","events_url":"https://api.github.com/users/slozier/events{/privacy}","received_events_url":"https://api.github.com/users/slozier/received_events","type":"User","site_admin":false},"body":"Seems a bit inefficient to create an array every time we do a tuple operation? An option would be to initialize the tuple in the constructor and just make the properties index ops on the underlying array? That way we wouldn't need any of the overrides (other than `__repr__`).","created_at":"2018-05-18T00:52:04Z","updated_at":"2018-05-18T00:52:04Z","html_url":"https://github.com/IronLanguages/ironpython2/pull/383#discussion_r189139658","pull_request_url":"https://api.github.com/repos/IronLanguages/ironpython2/pulls/383","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/IronLanguages/ironpython2/pulls/comments/189139658"},"html":{"href":"https://github.com/IronLanguages/ironpython2/pull/383#discussion_r189139658"},"pull_request":{"href":"https://api.github.com/repos/IronLanguages/ironpython2/pulls/383"}}},"pull_request":{"url":"https://api.github.com/repos/IronLanguages/ironpython2/pulls/383","id":188888016,"html_url":"https://github.com/IronLanguages/ironpython2/pull/383","diff_url":"https://github.com/IronLanguages/ironpython2/pull/383.diff","patch_url":"https://github.com/IronLanguages/ironpython2/pull/383.patch","issue_url":"https://api.github.com/repos/IronLanguages/ironpython2/issues/383","number":383,"state":"open","locked":false,"title":"Implement pwd, grp and spwd modules","user":{"login":"slide","id":55871,"avatar_url":"https://avatars2.githubusercontent.com/u/55871?v=4","gravatar_id":"","url":"https://api.github.com/users/slide","html_url":"https://github.com/slide","followers_url":"https://api.github.com/users/slide/followers","following_url":"https://api.github.com/users/slide/following{/other_user}","gists_url":"https://api.github.com/users/slide/gists{/gist_id}","starred_url":"https://api.github.com/users/slide/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/slide/subscriptions","organizations_url":"https://api.github.com/users/slide/orgs","repos_url":"https://api.github.com/users/slide/repos","events_url":"https://api.github.com/users/slide/events{/privacy}","received_events_url":"https://api.github.com/users/slide/received_events","type":"User","site_admin":false},"body":"These modules will be available on Unix platforms.\r\n\r\nOnly tested on Linux for now.\r\n\r\ntest_spwd.py is not enabled to run because it required root privileges to run anything meaningful.","created_at":"2018-05-17T23:37:03Z","updated_at":"2018-05-18T00:52:04Z","closed_at":null,"merged_at":null,"merge_commit_sha":"f67d52fdd65b65c78ee401c246134ca508f89687","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/IronLanguages/ironpython2/pulls/383/commits","review_comments_url":"https://api.github.com/repos/IronLanguages/ironpython2/pulls/383/comments","review_comment_url":"https://api.github.com/repos/IronLanguages/ironpython2/pulls/comments{/number}","comments_url":"https://api.github.com/repos/IronLanguages/ironpython2/issues/383/comments","statuses_url":"https://api.github.com/repos/IronLanguages/ironpython2/statuses/4f6b016199ca7572232ae513774e3ed30e02f9d9","head":{"label":"slide:pwd_grp_spwd","ref":"pwd_grp_spwd","sha":"4f6b016199ca7572232ae513774e3ed30e02f9d9","user":{"login":"slide","id":55871,"avatar_url":"https://avatars2.githubusercontent.com/u/55871?v=4","gravatar_id":"","url":"https://api.github.com/users/slide","html_url":"https://github.com/slide","followers_url":"https://api.github.com/users/slide/followers","following_url":"https://api.github.com/users/slide/following{/other_user}","gists_url":"https://api.github.com/users/slide/gists{/gist_id}","starred_url":"https://api.github.com/users/slide/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/slide/subscriptions","organizations_url":"https://api.github.com/users/slide/orgs","repos_url":"https://api.github.com/users/slide/repos","events_url":"https://api.github.com/users/slide/events{/privacy}","received_events_url":"https://api.github.com/users/slide/received_events","type":"User","site_admin":false},"repo":{"id":91933658,"name":"ironpython2","full_name":"slide/ironpython2","owner":{"login":"slide","id":55871,"avatar_url":"https://avatars2.githubusercontent.com/u/55871?v=4","gravatar_id":"","url":"https://api.github.com/users/slide","html_url":"https://github.com/slide","followers_url":"https://api.github.com/users/slide/followers","following_url":"https://api.github.com/users/slide/following{/other_user}","gists_url":"https://api.github.com/users/slide/gists{/gist_id}","starred_url":"https://api.github.com/users/slide/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/slide/subscriptions","organizations_url":"https://api.github.com/users/slide/orgs","repos_url":"https://api.github.com/users/slide/repos","events_url":"https://api.github.com/users/slide/events{/privacy}","received_events_url":"https://api.github.com/users/slide/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/slide/ironpython2","description":"Implementation of the Python programming language for .NET Framework; built on top of the Dynamic Language Runtime (DLR).","fork":true,"url":"https://api.github.com/repos/slide/ironpython2","forks_url":"https://api.github.com/repos/slide/ironpython2/forks","keys_url":"https://api.github.com/repos/slide/ironpython2/keys{/key_id}","collaborators_url":"https://api.github.com/repos/slide/ironpython2/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/slide/ironpython2/teams","hooks_url":"https://api.github.com/repos/slide/ironpython2/hooks","issue_events_url":"https://api.github.com/repos/slide/ironpython2/issues/events{/number}","events_url":"https://api.github.com/repos/slide/ironpython2/events","assignees_url":"https://api.github.com/repos/slide/ironpython2/assignees{/user}","branches_url":"https://api.github.com/repos/slide/ironpython2/branches{/branch}","tags_url":"https://api.github.com/repos/slide/ironpython2/tags","blobs_url":"https://api.github.com/repos/slide/ironpython2/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/slide/ironpython2/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/slide/ironpython2/git/refs{/sha}","trees_url":"https://api.github.com/repos/slide/ironpython2/git/trees{/sha}","statuses_url":"https://api.github.com/repos/slide/ironpython2/statuses/{sha}","languages_url":"https://api.github.com/repos/slide/ironpython2/languages","stargazers_url":"https://api.github.com/repos/slide/ironpython2/stargazers","contributors_url":"https://api.github.com/repos/slide/ironpython2/contributors","subscribers_url":"https://api.github.com/repos/slide/ironpython2/subscribers","subscription_url":"https://api.github.com/repos/slide/ironpython2/subscription","commits_url":"https://api.github.com/repos/slide/ironpython2/commits{/sha}","git_commits_url":"https://api.github.com/repos/slide/ironpython2/git/commits{/sha}","comments_url":"https://api.github.com/repos/slide/ironpython2/comments{/number}","issue_comment_url":"https://api.github.com/repos/slide/ironpython2/issues/comments{/number}","contents_url":"https://api.github.com/repos/slide/ironpython2/contents/{+path}","compare_url":"https://api.github.com/repos/slide/ironpython2/compare/{base}...{head}","merges_url":"https://api.github.com/repos/slide/ironpython2/merges","archive_url":"https://api.github.com/repos/slide/ironpython2/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/slide/ironpython2/downloads","issues_url":"https://api.github.com/repos/slide/ironpython2/issues{/number}","pulls_url":"https://api.github.com/repos/slide/ironpython2/pulls{/number}","milestones_url":"https://api.github.com/repos/slide/ironpython2/milestones{/number}","notifications_url":"https://api.github.com/repos/slide/ironpython2/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/slide/ironpython2/labels{/name}","releases_url":"https://api.github.com/repos/slide/ironpython2/releases{/id}","deployments_url":"https://api.github.com/repos/slide/ironpython2/deployments","created_at":"2017-05-21T04:44:47Z","updated_at":"2017-05-21T04:45:26Z","pushed_at":"2018-05-17T23:36:04Z","git_url":"git://github.com/slide/ironpython2.git","ssh_url":"git@github.com:slide/ironpython2.git","clone_url":"https://github.com/slide/ironpython2.git","svn_url":"https://github.com/slide/ironpython2","homepage":"http://ironpython.net","size":250952,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":null,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"IronLanguages:master","ref":"master","sha":"38fd1335440f46b7f464658867d0200dade416d7","user":{"login":"IronLanguages","id":18199,"avatar_url":"https://avatars1.githubusercontent.com/u/18199?v=4","gravatar_id":"","url":"https://api.github.com/users/IronLanguages","html_url":"https://github.com/IronLanguages","followers_url":"https://api.github.com/users/IronLanguages/followers","following_url":"https://api.github.com/users/IronLanguages/following{/other_user}","gists_url":"https://api.github.com/users/IronLanguages/gists{/gist_id}","starred_url":"https://api.github.com/users/IronLanguages/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/IronLanguages/subscriptions","organizations_url":"https://api.github.com/users/IronLanguages/orgs","repos_url":"https://api.github.com/users/IronLanguages/repos","events_url":"https://api.github.com/users/IronLanguages/events{/privacy}","received_events_url":"https://api.github.com/users/IronLanguages/received_events","type":"Organization","site_admin":false},"repo":{"id":91620472,"name":"ironpython2","full_name":"IronLanguages/ironpython2","owner":{"login":"IronLanguages","id":18199,"avatar_url":"https://avatars1.githubusercontent.com/u/18199?v=4","gravatar_id":"","url":"https://api.github.com/users/IronLanguages","html_url":"https://github.com/IronLanguages","followers_url":"https://api.github.com/users/IronLanguages/followers","following_url":"https://api.github.com/users/IronLanguages/following{/other_user}","gists_url":"https://api.github.com/users/IronLanguages/gists{/gist_id}","starred_url":"https://api.github.com/users/IronLanguages/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/IronLanguages/subscriptions","organizations_url":"https://api.github.com/users/IronLanguages/orgs","repos_url":"https://api.github.com/users/IronLanguages/repos","events_url":"https://api.github.com/users/IronLanguages/events{/privacy}","received_events_url":"https://api.github.com/users/IronLanguages/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/IronLanguages/ironpython2","description":"Implementation of the Python programming language for .NET Framework; built on top of the Dynamic Language Runtime (DLR).","fork":false,"url":"https://api.github.com/repos/IronLanguages/ironpython2","forks_url":"https://api.github.com/repos/IronLanguages/ironpython2/forks","keys_url":"https://api.github.com/repos/IronLanguages/ironpython2/keys{/key_id}","collaborators_url":"https://api.github.com/repos/IronLanguages/ironpython2/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/IronLanguages/ironpython2/teams","hooks_url":"https://api.github.com/repos/IronLanguages/ironpython2/hooks","issue_events_url":"https://api.github.com/repos/IronLanguages/ironpython2/issues/events{/number}","events_url":"https://api.github.com/repos/IronLanguages/ironpython2/events","assignees_url":"https://api.github.com/repos/IronLanguages/ironpython2/assignees{/user}","branches_url":"https://api.github.com/repos/IronLanguages/ironpython2/branches{/branch}","tags_url":"https://api.github.com/repos/IronLanguages/ironpython2/tags","blobs_url":"https://api.github.com/repos/IronLanguages/ironpython2/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/IronLanguages/ironpython2/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/IronLanguages/ironpython2/git/refs{/sha}","trees_url":"https://api.github.com/repos/IronLanguages/ironpython2/git/trees{/sha}","statuses_url":"https://api.github.com/repos/IronLanguages/ironpython2/statuses/{sha}","languages_url":"https://api.github.com/repos/IronLanguages/ironpython2/languages","stargazers_url":"https://api.github.com/repos/IronLanguages/ironpython2/stargazers","contributors_url":"https://api.github.com/repos/IronLanguages/ironpython2/contributors","subscribers_url":"https://api.github.com/repos/IronLanguages/ironpython2/subscribers","subscription_url":"https://api.github.com/repos/IronLanguages/ironpython2/subscription","commits_url":"https://api.github.com/repos/IronLanguages/ironpython2/commits{/sha}","git_commits_url":"https://api.github.com/repos/IronLanguages/ironpython2/git/commits{/sha}","comments_url":"https://api.github.com/repos/IronLanguages/ironpython2/comments{/number}","issue_comment_url":"https://api.github.com/repos/IronLanguages/ironpython2/issues/comments{/number}","contents_url":"https://api.github.com/repos/IronLanguages/ironpython2/contents/{+path}","compare_url":"https://api.github.com/repos/IronLanguages/ironpython2/compare/{base}...{head}","merges_url":"https://api.github.com/repos/IronLanguages/ironpython2/merges","archive_url":"https://api.github.com/repos/IronLanguages/ironpython2/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/IronLanguages/ironpython2/downloads","issues_url":"https://api.github.com/repos/IronLanguages/ironpython2/issues{/number}","pulls_url":"https://api.github.com/repos/IronLanguages/ironpython2/pulls{/number}","milestones_url":"https://api.github.com/repos/IronLanguages/ironpython2/milestones{/number}","notifications_url":"https://api.github.com/repos/IronLanguages/ironpython2/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/IronLanguages/ironpython2/labels{/name}","releases_url":"https://api.github.com/repos/IronLanguages/ironpython2/releases{/id}","deployments_url":"https://api.github.com/repos/IronLanguages/ironpython2/deployments","created_at":"2017-05-17T21:11:51Z","updated_at":"2018-05-17T15:35:49Z","pushed_at":"2018-05-17T23:37:03Z","git_url":"git://github.com/IronLanguages/ironpython2.git","ssh_url":"git@github.com:IronLanguages/ironpython2.git","clone_url":"https://github.com/IronLanguages/ironpython2.git","svn_url":"https://github.com/IronLanguages/ironpython2","homepage":"http://ironpython.net","size":250818,"stargazers_count":234,"watchers_count":234,"language":"Python","has_issues":true,"has_projects":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":46,"mirror_url":null,"archived":false,"open_issues_count":152,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0"},"forks":46,"open_issues":152,"watchers":234,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/IronLanguages/ironpython2/pulls/383"},"html":{"href":"https://github.com/IronLanguages/ironpython2/pull/383"},"issue":{"href":"https://api.github.com/repos/IronLanguages/ironpython2/issues/383"},"comments":{"href":"https://api.github.com/repos/IronLanguages/ironpython2/issues/383/comments"},"review_comments":{"href":"https://api.github.com/repos/IronLanguages/ironpython2/pulls/383/comments"},"review_comment":{"href":"https://api.github.com/repos/IronLanguages/ironpython2/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/IronLanguages/ironpython2/pulls/383/commits"},"statuses":{"href":"https://api.github.com/repos/IronLanguages/ironpython2/statuses/4f6b016199ca7572232ae513774e3ed30e02f9d9"}},"author_association":"MEMBER"}}
{"actor":{"display_login":"slozier"}}