{"action":"created","comment":{"url":"https://api.github.com/repos/jeff1evesque/machine-learning/pulls/comments/80594183","id":80594183,"diff_hunk":"@@ -0,0 +1,131 @@\n+'''@validate_password\r\n+\r\n+This file contains functions for validating the user's password against\r\n+a set of requirements.\r\n+\r\n+'''\r\n+\r\n+from flask import current_app\r\n+import yaml\r\n+\r\n+\r\n+def load_min(app=True, root='/vagrant'):\r\n+    '''@load_min\r\n+\r\n+    This method returns the minimum character requirement for passwords.\r\n+\r\n+    @app, indicates if function is to be used by application, or manually\r\n+\r\n+    '''\r\n+    if app:\r\n+        min_c = current_app.config.get('PASSWORD_MIN_C', None)\r\n+        return {'password_min_c': min_c, 'error': None}\r\n+    else:\r\n+        with open(root + \"/hiera/settings.yaml\", 'r') as stream:\r\n+            try:\r\n+                yamlres = yaml.load(stream)\r\n+                min_c = yamlres['validate_password']['password_min_c']\r\n+                return {'password_min_c': min_c, 'error': None}\r\n+            except yaml.YAMLError as error:\r\n+                return {'password_min_c': None, 'error': error}\r\n+\r\n+\r\n+def load_max(app=True, root='/vagrant'):\r\n+    '''@load_max\r\n+\r\n+    This method returns the maximum character requirement for passwords.\r\n+\r\n+    @app, indicates if function is to be used by application, or manually\r\n+\r\n+    '''\r\n+    if app:\r\n+        max_c = current_app.config.get('PASSWORD_MAX_C', None)\r\n+        return {'password_max_c': max_c, 'error': None}\r\n+    else:\r\n+        with open(root + \"/hiera/settings.yaml\", 'r') as stream:\r\n+            try:\r\n+                yamlres = yaml.load(stream)\r\n+                max_c = yamlres['validate_password']['password_max_c']\r\n+                return {'password_max_c': max_c, 'error': None}\r\n+            except yaml.YAMLError as error:\r\n+                return {'password_max_c': None, 'error': error}\r\n+\r\n+\r\n+def req_min_c(password):\r\n+    '''@req_min_c\r\n+\r\n+    This method returns True if the minimum password character requirement is\r\n+    met.\r\n+\r\n+    @password, is the password to be validated\r\n+\r\n+    '''\r\n+    min_c = load_min(app=False)['password_min_c']\r\n+    min_c = 10 if min_c is None else min_c\r\n+    return len(password) >= min_c\r\n+\r\n+\r\n+def req_max_c(password):\r\n+    '''@req_max_c\r\n+\r\n+    This method returns True if the maximum password character requirement is\r\n+    met.\r\n+\r\n+    @password, is the password to be validated\r\n+\r\n+    '''\r\n+    max_c = load_max(app=False)['password_max_c']\r\n+    max_c = 64 if max_c is None else max_c\r","path":"brain/validator/validate_password.py","position":78,"original_position":78,"commit_id":"b6f6584010cee5580bf75d2969b08ce03897c3de","original_commit_id":"b6f6584010cee5580bf75d2969b08ce03897c3de","user":{"login":"jeff1evesque","id":2907085,"avatar_url":"https://avatars.githubusercontent.com/u/2907085?v=3","gravatar_id":"","url":"https://api.github.com/users/jeff1evesque","html_url":"https://github.com/jeff1evesque","followers_url":"https://api.github.com/users/jeff1evesque/followers","following_url":"https://api.github.com/users/jeff1evesque/following{/other_user}","gists_url":"https://api.github.com/users/jeff1evesque/gists{/gist_id}","starred_url":"https://api.github.com/users/jeff1evesque/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jeff1evesque/subscriptions","organizations_url":"https://api.github.com/users/jeff1evesque/orgs","repos_url":"https://api.github.com/users/jeff1evesque/repos","events_url":"https://api.github.com/users/jeff1evesque/events{/privacy}","received_events_url":"https://api.github.com/users/jeff1evesque/received_events","type":"User","site_admin":false},"body":"Your docstring suggests a minimum requirement.  Therefore, I would change the above to `max_c = 64 if (max_c is None or max_c < 64) else max_c`.  If the PEP8 linter complains about line length, I would remove the ternary operator, and implement the traditional if-else statement.","created_at":"2016-09-26T23:15:30Z","updated_at":"2016-09-26T23:20:45Z","html_url":"https://github.com/jeff1evesque/machine-learning/pull/2736#discussion_r80594183","pull_request_url":"https://api.github.com/repos/jeff1evesque/machine-learning/pulls/2736","_links":{"self":{"href":"https://api.github.com/repos/jeff1evesque/machine-learning/pulls/comments/80594183"},"html":{"href":"https://github.com/jeff1evesque/machine-learning/pull/2736#discussion_r80594183"},"pull_request":{"href":"https://api.github.com/repos/jeff1evesque/machine-learning/pulls/2736"}}},"pull_request":{"url":"https://api.github.com/repos/jeff1evesque/machine-learning/pulls/2736","id":86338042,"html_url":"https://github.com/jeff1evesque/machine-learning/pull/2736","diff_url":"https://github.com/jeff1evesque/machine-learning/pull/2736.diff","patch_url":"https://github.com/jeff1evesque/machine-learning/pull/2736.patch","issue_url":"https://api.github.com/repos/jeff1evesque/machine-learning/issues/2736","number":2736,"state":"open","locked":false,"title":"#2731, validate_password.py, creating new password validation script","user":{"login":"protojas","id":13712737,"avatar_url":"https://avatars.githubusercontent.com/u/13712737?v=3","gravatar_id":"","url":"https://api.github.com/users/protojas","html_url":"https://github.com/protojas","followers_url":"https://api.github.com/users/protojas/followers","following_url":"https://api.github.com/users/protojas/following{/other_user}","gists_url":"https://api.github.com/users/protojas/gists{/gist_id}","starred_url":"https://api.github.com/users/protojas/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/protojas/subscriptions","organizations_url":"https://api.github.com/users/protojas/orgs","repos_url":"https://api.github.com/users/protojas/repos","events_url":"https://api.github.com/users/protojas/events{/privacy}","received_events_url":"https://api.github.com/users/protojas/received_events","type":"User","site_admin":false},"body":"Resolves #2731.","created_at":"2016-09-22T13:34:14Z","updated_at":"2016-09-26T23:20:45Z","closed_at":null,"merged_at":null,"merge_commit_sha":"af0acaa01f29b99443e1e908a268ae932b6662e6","assignee":null,"assignees":[],"milestone":{"url":"https://api.github.com/repos/jeff1evesque/machine-learning/milestones/5","html_url":"https://github.com/jeff1evesque/machine-learning/milestones/0.5","labels_url":"https://api.github.com/repos/jeff1evesque/machine-learning/milestones/5/labels","id":1362064,"number":5,"title":"0.5","description":"The following features will be added:\r\n\r\n- standardized API to allow users to create a user account, stored in the database\r\n- web-interface to allow users to create an account, stored in the database\r\n- standardized API to validate logged in users\r\n- web-interface to validate logged in users\r\n- standardized API to allow users to review all datasets they stored:\r\n  - delete portions of the dataset\r\n- web-interface to allow users to review all datasets they stored:\r\n  - delete portions of the dataset\r\n- standardized API to allow users to review all models they stored:\r\n  - delete created models\r\n- web-interface to allow users to review all models they stored:\r\n  - delete created models\r\n- implement nginx webserver\r\n- split `tbl_feature_value` into two tables:\r\n  - `tbl_svm_data`\r\n  - `tbl_svr_data`\r\n- `index` relevant database tables","creator":{"login":"jeff1evesque","id":2907085,"avatar_url":"https://avatars.githubusercontent.com/u/2907085?v=3","gravatar_id":"","url":"https://api.github.com/users/jeff1evesque","html_url":"https://github.com/jeff1evesque","followers_url":"https://api.github.com/users/jeff1evesque/followers","following_url":"https://api.github.com/users/jeff1evesque/following{/other_user}","gists_url":"https://api.github.com/users/jeff1evesque/gists{/gist_id}","starred_url":"https://api.github.com/users/jeff1evesque/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jeff1evesque/subscriptions","organizations_url":"https://api.github.com/users/jeff1evesque/orgs","repos_url":"https://api.github.com/users/jeff1evesque/repos","events_url":"https://api.github.com/users/jeff1evesque/events{/privacy}","received_events_url":"https://api.github.com/users/jeff1evesque/received_events","type":"User","site_admin":false},"open_issues":27,"closed_issues":21,"state":"open","created_at":"2015-10-18T04:16:23Z","updated_at":"2016-09-23T12:20:07Z","due_on":null,"closed_at":null},"commits_url":"https://api.github.com/repos/jeff1evesque/machine-learning/pulls/2736/commits","review_comments_url":"https://api.github.com/repos/jeff1evesque/machine-learning/pulls/2736/comments","review_comment_url":"https://api.github.com/repos/jeff1evesque/machine-learning/pulls/comments{/number}","comments_url":"https://api.github.com/repos/jeff1evesque/machine-learning/issues/2736/comments","statuses_url":"https://api.github.com/repos/jeff1evesque/machine-learning/statuses/b6f6584010cee5580bf75d2969b08ce03897c3de","head":{"label":"protojas:feature-2731","ref":"feature-2731","sha":"b6f6584010cee5580bf75d2969b08ce03897c3de","user":{"login":"protojas","id":13712737,"avatar_url":"https://avatars.githubusercontent.com/u/13712737?v=3","gravatar_id":"","url":"https://api.github.com/users/protojas","html_url":"https://github.com/protojas","followers_url":"https://api.github.com/users/protojas/followers","following_url":"https://api.github.com/users/protojas/following{/other_user}","gists_url":"https://api.github.com/users/protojas/gists{/gist_id}","starred_url":"https://api.github.com/users/protojas/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/protojas/subscriptions","organizations_url":"https://api.github.com/users/protojas/orgs","repos_url":"https://api.github.com/users/protojas/repos","events_url":"https://api.github.com/users/protojas/events{/privacy}","received_events_url":"https://api.github.com/users/protojas/received_events","type":"User","site_admin":false},"repo":{"id":67224670,"name":"machine-learning","full_name":"protojas/machine-learning","owner":{"login":"protojas","id":13712737,"avatar_url":"https://avatars.githubusercontent.com/u/13712737?v=3","gravatar_id":"","url":"https://api.github.com/users/protojas","html_url":"https://github.com/protojas","followers_url":"https://api.github.com/users/protojas/followers","following_url":"https://api.github.com/users/protojas/following{/other_user}","gists_url":"https://api.github.com/users/protojas/gists{/gist_id}","starred_url":"https://api.github.com/users/protojas/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/protojas/subscriptions","organizations_url":"https://api.github.com/users/protojas/orgs","repos_url":"https://api.github.com/users/protojas/repos","events_url":"https://api.github.com/users/protojas/events{/privacy}","received_events_url":"https://api.github.com/users/protojas/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/protojas/machine-learning","description":"Web-interface, and programmatic API for classification and regression predictions","fork":true,"url":"https://api.github.com/repos/protojas/machine-learning","forks_url":"https://api.github.com/repos/protojas/machine-learning/forks","keys_url":"https://api.github.com/repos/protojas/machine-learning/keys{/key_id}","collaborators_url":"https://api.github.com/repos/protojas/machine-learning/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/protojas/machine-learning/teams","hooks_url":"https://api.github.com/repos/protojas/machine-learning/hooks","issue_events_url":"https://api.github.com/repos/protojas/machine-learning/issues/events{/number}","events_url":"https://api.github.com/repos/protojas/machine-learning/events","assignees_url":"https://api.github.com/repos/protojas/machine-learning/assignees{/user}","branches_url":"https://api.github.com/repos/protojas/machine-learning/branches{/branch}","tags_url":"https://api.github.com/repos/protojas/machine-learning/tags","blobs_url":"https://api.github.com/repos/protojas/machine-learning/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/protojas/machine-learning/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/protojas/machine-learning/git/refs{/sha}","trees_url":"https://api.github.com/repos/protojas/machine-learning/git/trees{/sha}","statuses_url":"https://api.github.com/repos/protojas/machine-learning/statuses/{sha}","languages_url":"https://api.github.com/repos/protojas/machine-learning/languages","stargazers_url":"https://api.github.com/repos/protojas/machine-learning/stargazers","contributors_url":"https://api.github.com/repos/protojas/machine-learning/contributors","subscribers_url":"https://api.github.com/repos/protojas/machine-learning/subscribers","subscription_url":"https://api.github.com/repos/protojas/machine-learning/subscription","commits_url":"https://api.github.com/repos/protojas/machine-learning/commits{/sha}","git_commits_url":"https://api.github.com/repos/protojas/machine-learning/git/commits{/sha}","comments_url":"https://api.github.com/repos/protojas/machine-learning/comments{/number}","issue_comment_url":"https://api.github.com/repos/protojas/machine-learning/issues/comments{/number}","contents_url":"https://api.github.com/repos/protojas/machine-learning/contents/{+path}","compare_url":"https://api.github.com/repos/protojas/machine-learning/compare/{base}...{head}","merges_url":"https://api.github.com/repos/protojas/machine-learning/merges","archive_url":"https://api.github.com/repos/protojas/machine-learning/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/protojas/machine-learning/downloads","issues_url":"https://api.github.com/repos/protojas/machine-learning/issues{/number}","pulls_url":"https://api.github.com/repos/protojas/machine-learning/pulls{/number}","milestones_url":"https://api.github.com/repos/protojas/machine-learning/milestones{/number}","notifications_url":"https://api.github.com/repos/protojas/machine-learning/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/protojas/machine-learning/labels{/name}","releases_url":"https://api.github.com/repos/protojas/machine-learning/releases{/id}","deployments_url":"https://api.github.com/repos/protojas/machine-learning/deployments","created_at":"2016-09-02T13:26:19Z","updated_at":"2016-09-02T13:26:22Z","pushed_at":"2016-09-26T15:16:33Z","git_url":"git://github.com/protojas/machine-learning.git","ssh_url":"git@github.com:protojas/machine-learning.git","clone_url":"https://github.com/protojas/machine-learning.git","svn_url":"https://github.com/protojas/machine-learning","homepage":"","size":17640,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"jeff1evesque:master","ref":"master","sha":"576ffee48f36e2594855259eb4215070c6d1e18f","user":{"login":"jeff1evesque","id":2907085,"avatar_url":"https://avatars.githubusercontent.com/u/2907085?v=3","gravatar_id":"","url":"https://api.github.com/users/jeff1evesque","html_url":"https://github.com/jeff1evesque","followers_url":"https://api.github.com/users/jeff1evesque/followers","following_url":"https://api.github.com/users/jeff1evesque/following{/other_user}","gists_url":"https://api.github.com/users/jeff1evesque/gists{/gist_id}","starred_url":"https://api.github.com/users/jeff1evesque/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jeff1evesque/subscriptions","organizations_url":"https://api.github.com/users/jeff1evesque/orgs","repos_url":"https://api.github.com/users/jeff1evesque/repos","events_url":"https://api.github.com/users/jeff1evesque/events{/privacy}","received_events_url":"https://api.github.com/users/jeff1evesque/received_events","type":"User","site_admin":false},"repo":{"id":22923393,"name":"machine-learning","full_name":"jeff1evesque/machine-learning","owner":{"login":"jeff1evesque","id":2907085,"avatar_url":"https://avatars.githubusercontent.com/u/2907085?v=3","gravatar_id":"","url":"https://api.github.com/users/jeff1evesque","html_url":"https://github.com/jeff1evesque","followers_url":"https://api.github.com/users/jeff1evesque/followers","following_url":"https://api.github.com/users/jeff1evesque/following{/other_user}","gists_url":"https://api.github.com/users/jeff1evesque/gists{/gist_id}","starred_url":"https://api.github.com/users/jeff1evesque/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jeff1evesque/subscriptions","organizations_url":"https://api.github.com/users/jeff1evesque/orgs","repos_url":"https://api.github.com/users/jeff1evesque/repos","events_url":"https://api.github.com/users/jeff1evesque/events{/privacy}","received_events_url":"https://api.github.com/users/jeff1evesque/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/jeff1evesque/machine-learning","description":"Web-interface, and programmatic API for classification and regression predictions","fork":false,"url":"https://api.github.com/repos/jeff1evesque/machine-learning","forks_url":"https://api.github.com/repos/jeff1evesque/machine-learning/forks","keys_url":"https://api.github.com/repos/jeff1evesque/machine-learning/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jeff1evesque/machine-learning/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jeff1evesque/machine-learning/teams","hooks_url":"https://api.github.com/repos/jeff1evesque/machine-learning/hooks","issue_events_url":"https://api.github.com/repos/jeff1evesque/machine-learning/issues/events{/number}","events_url":"https://api.github.com/repos/jeff1evesque/machine-learning/events","assignees_url":"https://api.github.com/repos/jeff1evesque/machine-learning/assignees{/user}","branches_url":"https://api.github.com/repos/jeff1evesque/machine-learning/branches{/branch}","tags_url":"https://api.github.com/repos/jeff1evesque/machine-learning/tags","blobs_url":"https://api.github.com/repos/jeff1evesque/machine-learning/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jeff1evesque/machine-learning/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jeff1evesque/machine-learning/git/refs{/sha}","trees_url":"https://api.github.com/repos/jeff1evesque/machine-learning/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jeff1evesque/machine-learning/statuses/{sha}","languages_url":"https://api.github.com/repos/jeff1evesque/machine-learning/languages","stargazers_url":"https://api.github.com/repos/jeff1evesque/machine-learning/stargazers","contributors_url":"https://api.github.com/repos/jeff1evesque/machine-learning/contributors","subscribers_url":"https://api.github.com/repos/jeff1evesque/machine-learning/subscribers","subscription_url":"https://api.github.com/repos/jeff1evesque/machine-learning/subscription","commits_url":"https://api.github.com/repos/jeff1evesque/machine-learning/commits{/sha}","git_commits_url":"https://api.github.com/repos/jeff1evesque/machine-learning/git/commits{/sha}","comments_url":"https://api.github.com/repos/jeff1evesque/machine-learning/comments{/number}","issue_comment_url":"https://api.github.com/repos/jeff1evesque/machine-learning/issues/comments{/number}","contents_url":"https://api.github.com/repos/jeff1evesque/machine-learning/contents/{+path}","compare_url":"https://api.github.com/repos/jeff1evesque/machine-learning/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jeff1evesque/machine-learning/merges","archive_url":"https://api.github.com/repos/jeff1evesque/machine-learning/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jeff1evesque/machine-learning/downloads","issues_url":"https://api.github.com/repos/jeff1evesque/machine-learning/issues{/number}","pulls_url":"https://api.github.com/repos/jeff1evesque/machine-learning/pulls{/number}","milestones_url":"https://api.github.com/repos/jeff1evesque/machine-learning/milestones{/number}","notifications_url":"https://api.github.com/repos/jeff1evesque/machine-learning/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jeff1evesque/machine-learning/labels{/name}","releases_url":"https://api.github.com/repos/jeff1evesque/machine-learning/releases{/id}","deployments_url":"https://api.github.com/repos/jeff1evesque/machine-learning/deployments","created_at":"2014-08-13T16:50:18Z","updated_at":"2016-09-26T18:16:39Z","pushed_at":"2016-09-26T15:16:33Z","git_url":"git://github.com/jeff1evesque/machine-learning.git","ssh_url":"git@github.com:jeff1evesque/machine-learning.git","clone_url":"https://github.com/jeff1evesque/machine-learning.git","svn_url":"https://github.com/jeff1evesque/machine-learning","homepage":"","size":17706,"stargazers_count":62,"watchers_count":62,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":20,"mirror_url":null,"open_issues_count":103,"forks":20,"open_issues":103,"watchers":62,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/jeff1evesque/machine-learning/pulls/2736"},"html":{"href":"https://github.com/jeff1evesque/machine-learning/pull/2736"},"issue":{"href":"https://api.github.com/repos/jeff1evesque/machine-learning/issues/2736"},"comments":{"href":"https://api.github.com/repos/jeff1evesque/machine-learning/issues/2736/comments"},"review_comments":{"href":"https://api.github.com/repos/jeff1evesque/machine-learning/pulls/2736/comments"},"review_comment":{"href":"https://api.github.com/repos/jeff1evesque/machine-learning/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/jeff1evesque/machine-learning/pulls/2736/commits"},"statuses":{"href":"https://api.github.com/repos/jeff1evesque/machine-learning/statuses/b6f6584010cee5580bf75d2969b08ce03897c3de"}}}}
{"actor":{"display_login":"jeff1evesque"}}