code
stringlengths
66
870k
docstring
stringlengths
19
26.7k
func_name
stringlengths
1
138
language
stringclasses
1 value
repo
stringlengths
7
68
path
stringlengths
5
324
url
stringlengths
46
389
license
stringclasses
7 values
def get(self, key_id): """ .. http:get:: /api/1/distinct Get a list of distinct regions, names, accounts, accounttypes or technologies **Example Request**: .. sourcecode:: http GET /api/1/distinct/name HTTP/1.1 Host: example.com...
.. http:get:: /api/1/distinct Get a list of distinct regions, names, accounts, accounttypes or technologies **Example Request**: .. sourcecode:: http GET /api/1/distinct/name HTTP/1.1 Host: example.com Accept: applicati...
get
python
Netflix/security_monkey
security_monkey/views/distinct.py
https://github.com/Netflix/security_monkey/blob/master/security_monkey/views/distinct.py
Apache-2.0
def get(self, item_id): """ .. http:get:: /api/1/ignorelistentries/<int:id> Get the ignorelist entry with the given ID. **Example Request**: .. sourcecode:: http GET /api/1/ignorelistentries/123 HTTP/1.1 Host: example.com ...
.. http:get:: /api/1/ignorelistentries/<int:id> Get the ignorelist entry with the given ID. **Example Request**: .. sourcecode:: http GET /api/1/ignorelistentries/123 HTTP/1.1 Host: example.com Accept: application/json,...
get
python
Netflix/security_monkey
security_monkey/views/ignore_list.py
https://github.com/Netflix/security_monkey/blob/master/security_monkey/views/ignore_list.py
Apache-2.0
def put(self, item_id): """ .. http:get:: /api/1/ignorelistentries/<int:id> Update the ignorelist entry with the given ID. **Example Request**: .. sourcecode:: http PUT /api/1/ignorelistentries/123 HTTP/1.1 Host: example.com ...
.. http:get:: /api/1/ignorelistentries/<int:id> Update the ignorelist entry with the given ID. **Example Request**: .. sourcecode:: http PUT /api/1/ignorelistentries/123 HTTP/1.1 Host: example.com Accept: application/js...
put
python
Netflix/security_monkey
security_monkey/views/ignore_list.py
https://github.com/Netflix/security_monkey/blob/master/security_monkey/views/ignore_list.py
Apache-2.0
def delete(self, item_id): """ .. http:delete:: /api/1/ignorelistentries/123 Delete a ignorelist entry. **Example Request**: .. sourcecode:: http DELETE /api/1/ignorelistentries/123 HTTP/1.1 Host: example.com Acc...
.. http:delete:: /api/1/ignorelistentries/123 Delete a ignorelist entry. **Example Request**: .. sourcecode:: http DELETE /api/1/ignorelistentries/123 HTTP/1.1 Host: example.com Accept: application/json **E...
delete
python
Netflix/security_monkey
security_monkey/views/ignore_list.py
https://github.com/Netflix/security_monkey/blob/master/security_monkey/views/ignore_list.py
Apache-2.0
def get(self): """ .. http:get:: /api/1/ignorelistentries Get a list of Ignorelist entries. **Example Request**: .. sourcecode:: http GET /api/1/ignorelistentries HTTP/1.1 Host: example.com Accept: application/js...
.. http:get:: /api/1/ignorelistentries Get a list of Ignorelist entries. **Example Request**: .. sourcecode:: http GET /api/1/ignorelistentries HTTP/1.1 Host: example.com Accept: application/json, text/javascript ...
get
python
Netflix/security_monkey
security_monkey/views/ignore_list.py
https://github.com/Netflix/security_monkey/blob/master/security_monkey/views/ignore_list.py
Apache-2.0
def post(self): """ .. http:post:: /api/1/ignorelistentries Create a new ignore list entry. **Example Request**: .. sourcecode:: http POST /api/1/ignorelistentries HTTP/1.1 Host: example.com Accept: application/j...
.. http:post:: /api/1/ignorelistentries Create a new ignore list entry. **Example Request**: .. sourcecode:: http POST /api/1/ignorelistentries HTTP/1.1 Host: example.com Accept: application/json { ...
post
python
Netflix/security_monkey
security_monkey/views/ignore_list.py
https://github.com/Netflix/security_monkey/blob/master/security_monkey/views/ignore_list.py
Apache-2.0
def get(self, item_id): """ .. http:get:: /api/1/item/1234 Get a specific item **Example Request**: .. sourcecode:: http GET /api/1/item/1234 HTTP/1.1 Host: example.com Accept: application/json **Exa...
.. http:get:: /api/1/item/1234 Get a specific item **Example Request**: .. sourcecode:: http GET /api/1/item/1234 HTTP/1.1 Host: example.com Accept: application/json **Example Response**: .. so...
get
python
Netflix/security_monkey
security_monkey/views/item.py
https://github.com/Netflix/security_monkey/blob/master/security_monkey/views/item.py
Apache-2.0
def get(self): """ .. http:get:: /api/1/items Get a list of items matching the given criteria. **Example Request**: .. sourcecode:: http GET /api/1/items HTTP/1.1 Host: example.com Accept: application/json ...
.. http:get:: /api/1/items Get a list of items matching the given criteria. **Example Request**: .. sourcecode:: http GET /api/1/items HTTP/1.1 Host: example.com Accept: application/json **Example Response*...
get
python
Netflix/security_monkey
security_monkey/views/item.py
https://github.com/Netflix/security_monkey/blob/master/security_monkey/views/item.py
Apache-2.0
def delete(self, item_id, comment_id): """ .. http:delete:: /api/1/items/<int:item_id>/comment/<int:comment_id> Deletes an item comment. **Example Request**: .. sourcecode:: http DELETE /api/1/items/1234/comment/7718 HTTP/1.1 Ho...
.. http:delete:: /api/1/items/<int:item_id>/comment/<int:comment_id> Deletes an item comment. **Example Request**: .. sourcecode:: http DELETE /api/1/items/1234/comment/7718 HTTP/1.1 Host: example.com Accept: applicatio...
delete
python
Netflix/security_monkey
security_monkey/views/item_comment.py
https://github.com/Netflix/security_monkey/blob/master/security_monkey/views/item_comment.py
Apache-2.0
def get(self, item_id, comment_id): """ .. http:get:: /api/1/items/<int:item_id>/comment/<int:comment_id> Retrieves an item comment. **Example Request**: .. sourcecode:: http GET /api/1/items/1234/comment/7718 HTTP/1.1 Host: exa...
.. http:get:: /api/1/items/<int:item_id>/comment/<int:comment_id> Retrieves an item comment. **Example Request**: .. sourcecode:: http GET /api/1/items/1234/comment/7718 HTTP/1.1 Host: example.com Accept: application/js...
get
python
Netflix/security_monkey
security_monkey/views/item_comment.py
https://github.com/Netflix/security_monkey/blob/master/security_monkey/views/item_comment.py
Apache-2.0
def post(self, item_id): """ .. http:post:: /api/1/items/<int:item_id>/comments Adds an item comment. **Example Request**: .. sourcecode:: http POST /api/1/items/1234/comments HTTP/1.1 Host: example.com Accept: a...
.. http:post:: /api/1/items/<int:item_id>/comments Adds an item comment. **Example Request**: .. sourcecode:: http POST /api/1/items/1234/comments HTTP/1.1 Host: example.com Accept: application/json { ...
post
python
Netflix/security_monkey
security_monkey/views/item_comment.py
https://github.com/Netflix/security_monkey/blob/master/security_monkey/views/item_comment.py
Apache-2.0
def get(self): """ .. http:get:: /api/1/issues Get a list of Audit Issues matching the given criteria **Example Request**: .. sourcecode:: http GET /api/1/issues HTTP/1.1 Host: example.com Accept: applicat...
.. http:get:: /api/1/issues Get a list of Audit Issues matching the given criteria **Example Request**: .. sourcecode:: http GET /api/1/issues HTTP/1.1 Host: example.com Accept: application/json, text/javascript ...
get
python
Netflix/security_monkey
security_monkey/views/item_issue.py
https://github.com/Netflix/security_monkey/blob/master/security_monkey/views/item_issue.py
Apache-2.0
def get(self, audit_id): """ .. http:get:: /api/1/issue/1234 Get a specific issue **Example Request**: .. sourcecode:: http GET /api/1/issue/1234 HTTP/1.1 Host: example.com Accept: application/json *...
.. http:get:: /api/1/issue/1234 Get a specific issue **Example Request**: .. sourcecode:: http GET /api/1/issue/1234 HTTP/1.1 Host: example.com Accept: application/json **Example Response**: .....
get
python
Netflix/security_monkey
security_monkey/views/item_issue.py
https://github.com/Netflix/security_monkey/blob/master/security_monkey/views/item_issue.py
Apache-2.0
def post(self, audit_id): """ .. http:post:: /api/1/issues/1234/justification Justify an audit issue on a specific item. **Example Request**: .. sourcecode:: http POST /api/1/issues/1234/justification HTTP/1.1 Host: example.com ...
.. http:post:: /api/1/issues/1234/justification Justify an audit issue on a specific item. **Example Request**: .. sourcecode:: http POST /api/1/issues/1234/justification HTTP/1.1 Host: example.com Accept: application/j...
post
python
Netflix/security_monkey
security_monkey/views/item_issue_justification.py
https://github.com/Netflix/security_monkey/blob/master/security_monkey/views/item_issue_justification.py
Apache-2.0
def delete(self, audit_id): """ .. http:delete:: /api/1/issues/1234/justification Remove a justification on an audit issue on a specific item. **Example Request**: .. sourcecode:: http DELETE /api/1/issues/1234/justification HTTP/1.1 ...
.. http:delete:: /api/1/issues/1234/justification Remove a justification on an audit issue on a specific item. **Example Request**: .. sourcecode:: http DELETE /api/1/issues/1234/justification HTTP/1.1 Host: example.com ...
delete
python
Netflix/security_monkey
security_monkey/views/item_issue_justification.py
https://github.com/Netflix/security_monkey/blob/master/security_monkey/views/item_issue_justification.py
Apache-2.0
def get(self, revision_id): """ .. http:get:: /api/1/revision/1234 Get a specific revision. **Example Request**: .. sourcecode:: http GET /api/1/revision/123 HTTP/1.1 Host: example.com Accept: application/json, t...
.. http:get:: /api/1/revision/1234 Get a specific revision. **Example Request**: .. sourcecode:: http GET /api/1/revision/123 HTTP/1.1 Host: example.com Accept: application/json, text/javascript **Example R...
get
python
Netflix/security_monkey
security_monkey/views/revision.py
https://github.com/Netflix/security_monkey/blob/master/security_monkey/views/revision.py
Apache-2.0
def get(self): """ .. http:get:: /api/1/revisions Get a list of revisions **Example Request**: .. sourcecode:: http GET /api/1/revisions?count=1 HTTP/1.1 Host: example.com Accept: application/json **...
.. http:get:: /api/1/revisions Get a list of revisions **Example Request**: .. sourcecode:: http GET /api/1/revisions?count=1 HTTP/1.1 Host: example.com Accept: application/json **Example Response**: ...
get
python
Netflix/security_monkey
security_monkey/views/revision.py
https://github.com/Netflix/security_monkey/blob/master/security_monkey/views/revision.py
Apache-2.0
def get(self, revision_id, comment_id): """ .. http:get:: /api/1/revisions/<int:revision_id>/comments/<int:comment_id> Get a specific Revision Comment **Example Request**: .. sourcecode:: http GET /api/1/revisions/1141/comments/22 HTTP/1.1 ...
.. http:get:: /api/1/revisions/<int:revision_id>/comments/<int:comment_id> Get a specific Revision Comment **Example Request**: .. sourcecode:: http GET /api/1/revisions/1141/comments/22 HTTP/1.1 Host: example.com Accep...
get
python
Netflix/security_monkey
security_monkey/views/revision_comment.py
https://github.com/Netflix/security_monkey/blob/master/security_monkey/views/revision_comment.py
Apache-2.0
def delete(self, revision_id, comment_id): """ .. http:delete:: /api/1/revisions/<int:revision_id>/comments/<int:comment_id> Delete a specific Revision Comment **Example Request**: .. sourcecode:: http DELETE /api/1/revisions/1141/comments/22 H...
.. http:delete:: /api/1/revisions/<int:revision_id>/comments/<int:comment_id> Delete a specific Revision Comment **Example Request**: .. sourcecode:: http DELETE /api/1/revisions/1141/comments/22 HTTP/1.1 Host: example.com ...
delete
python
Netflix/security_monkey
security_monkey/views/revision_comment.py
https://github.com/Netflix/security_monkey/blob/master/security_monkey/views/revision_comment.py
Apache-2.0
def post(self, revision_id): """ .. http:post:: /api/1/revisions/<int:revision_id>/comments Create a new Revision Comment. **Example Request**: .. sourcecode:: http POST /api/1/revisions/1141/comments HTTP/1.1 Host: example.com ...
.. http:post:: /api/1/revisions/<int:revision_id>/comments Create a new Revision Comment. **Example Request**: .. sourcecode:: http POST /api/1/revisions/1141/comments HTTP/1.1 Host: example.com Accept: application/json...
post
python
Netflix/security_monkey
security_monkey/views/revision_comment.py
https://github.com/Netflix/security_monkey/blob/master/security_monkey/views/revision_comment.py
Apache-2.0
def get(self, tech_ids): """ .. http:get:: /api/1/techmethods Get a list of technologies and associated auditor check methods **Example Request**: .. sourcecode:: http GET /api/1/techmethods HTTP/1.1 Host: example.com ...
.. http:get:: /api/1/techmethods Get a list of technologies and associated auditor check methods **Example Request**: .. sourcecode:: http GET /api/1/techmethods HTTP/1.1 Host: example.com Accept: application/json, text...
get
python
Netflix/security_monkey
security_monkey/views/tech_methods.py
https://github.com/Netflix/security_monkey/blob/master/security_monkey/views/tech_methods.py
Apache-2.0
def get(self): """ .. http:get:: /api/1/users Get a list of users, checking that the requester is an admin. **Example Request**: .. sourcecode:: http GET /api/1/users HTTP/1.1 Host: example.com Accept: applicatio...
.. http:get:: /api/1/users Get a list of users, checking that the requester is an admin. **Example Request**: .. sourcecode:: http GET /api/1/users HTTP/1.1 Host: example.com Accept: application/json **Exam...
get
python
Netflix/security_monkey
security_monkey/views/users.py
https://github.com/Netflix/security_monkey/blob/master/security_monkey/views/users.py
Apache-2.0
def delete(self, user_id): """ .. http:delete:: /api/1/users/<int:user_id> Change the settings for the current user. **Example Request**: .. sourcecode:: http DELETE /api/1/users/15 HTTP/1.1 Host: example.com Acc...
.. http:delete:: /api/1/users/<int:user_id> Change the settings for the current user. **Example Request**: .. sourcecode:: http DELETE /api/1/users/15 HTTP/1.1 Host: example.com Accept: application/json **E...
delete
python
Netflix/security_monkey
security_monkey/views/users.py
https://github.com/Netflix/security_monkey/blob/master/security_monkey/views/users.py
Apache-2.0
def put(self, user_id): """ .. http:put:: /api/1/users/<int:user_id> Change the settings for the current user. **Example Request**: .. sourcecode:: http PUT /api/1/users/15 HTTP/1.1 Host: example.com Accept: appl...
.. http:put:: /api/1/users/<int:user_id> Change the settings for the current user. **Example Request**: .. sourcecode:: http PUT /api/1/users/15 HTTP/1.1 Host: example.com Accept: application/json { ...
put
python
Netflix/security_monkey
security_monkey/views/users.py
https://github.com/Netflix/security_monkey/blob/master/security_monkey/views/users.py
Apache-2.0
def get(self): """ .. http:get:: /api/1/roles Get a list of roles, checking that the requester is an admin. **Example Request**: .. sourcecode:: http GET /api/1/roles HTTP/1.1 Host: example.com Accept: applicatio...
.. http:get:: /api/1/roles Get a list of roles, checking that the requester is an admin. **Example Request**: .. sourcecode:: http GET /api/1/roles HTTP/1.1 Host: example.com Accept: application/json **Exam...
get
python
Netflix/security_monkey
security_monkey/views/users.py
https://github.com/Netflix/security_monkey/blob/master/security_monkey/views/users.py
Apache-2.0
def get(self): """ .. http:get:: /api/1/settings Get the settings for the given user. **Example Request**: .. sourcecode:: http GET /api/1/settings HTTP/1.1 Host: example.com Accept: application/json ...
.. http:get:: /api/1/settings Get the settings for the given user. **Example Request**: .. sourcecode:: http GET /api/1/settings HTTP/1.1 Host: example.com Accept: application/json **Example Response**: ...
get
python
Netflix/security_monkey
security_monkey/views/user_settings.py
https://github.com/Netflix/security_monkey/blob/master/security_monkey/views/user_settings.py
Apache-2.0
def post(self): """ .. http:post:: /api/1/settings Change the settings for the current user. **Example Request**: .. sourcecode:: http POST /api/1/settings HTTP/1.1 Host: example.com Accept: application/json ...
.. http:post:: /api/1/settings Change the settings for the current user. **Example Request**: .. sourcecode:: http POST /api/1/settings HTTP/1.1 Host: example.com Accept: application/json { ...
post
python
Netflix/security_monkey
security_monkey/views/user_settings.py
https://github.com/Netflix/security_monkey/blob/master/security_monkey/views/user_settings.py
Apache-2.0
def get(self): """ .. http:get:: /api/1/whitelistcidrs Get a list of CIDR's whitelisted to be used in security groups. **Example Request**: .. sourcecode:: http GET /api/1/whitelistcidrs HTTP/1.1 Host: example.com ...
.. http:get:: /api/1/whitelistcidrs Get a list of CIDR's whitelisted to be used in security groups. **Example Request**: .. sourcecode:: http GET /api/1/whitelistcidrs HTTP/1.1 Host: example.com Accept: application/json...
get
python
Netflix/security_monkey
security_monkey/views/whitelist.py
https://github.com/Netflix/security_monkey/blob/master/security_monkey/views/whitelist.py
Apache-2.0
def post(self): """ .. http:post:: /api/1/whitelistcidrs Create a new CIDR whitelist entry. **Example Request**: .. sourcecode:: http POST /api/1/whitelistcidrs HTTP/1.1 Host: example.com Accept: application/json...
.. http:post:: /api/1/whitelistcidrs Create a new CIDR whitelist entry. **Example Request**: .. sourcecode:: http POST /api/1/whitelistcidrs HTTP/1.1 Host: example.com Accept: application/json { ...
post
python
Netflix/security_monkey
security_monkey/views/whitelist.py
https://github.com/Netflix/security_monkey/blob/master/security_monkey/views/whitelist.py
Apache-2.0
def get(self, item_id): """ .. http:get:: /api/1/whitelistcidrs/<int:id> Get the whitelist entry with the given ID. **Example Request**: .. sourcecode:: http GET /api/1/whitelistcidrs/123 HTTP/1.1 Host: example.com ...
.. http:get:: /api/1/whitelistcidrs/<int:id> Get the whitelist entry with the given ID. **Example Request**: .. sourcecode:: http GET /api/1/whitelistcidrs/123 HTTP/1.1 Host: example.com Accept: application/json, text/j...
get
python
Netflix/security_monkey
security_monkey/views/whitelist.py
https://github.com/Netflix/security_monkey/blob/master/security_monkey/views/whitelist.py
Apache-2.0
def put(self, item_id): """ .. http:get:: /api/1/whitelistcidrs/<int:id> Update the whitelist entry with the given ID. **Example Request**: .. sourcecode:: http PUT /api/1/whitelistcidrs/123 HTTP/1.1 Host: example.com ...
.. http:get:: /api/1/whitelistcidrs/<int:id> Update the whitelist entry with the given ID. **Example Request**: .. sourcecode:: http PUT /api/1/whitelistcidrs/123 HTTP/1.1 Host: example.com Accept: application/json, tex...
put
python
Netflix/security_monkey
security_monkey/views/whitelist.py
https://github.com/Netflix/security_monkey/blob/master/security_monkey/views/whitelist.py
Apache-2.0
def delete(self, item_id): """ .. http:delete:: /api/1/whitelistcidrs/123 Delete a network whitelist entry. **Example Request**: .. sourcecode:: http DELETE /api/1/whitelistcidrs/123 HTTP/1.1 Host: example.com Ac...
.. http:delete:: /api/1/whitelistcidrs/123 Delete a network whitelist entry. **Example Request**: .. sourcecode:: http DELETE /api/1/whitelistcidrs/123 HTTP/1.1 Host: example.com Accept: application/json **...
delete
python
Netflix/security_monkey
security_monkey/views/whitelist.py
https://github.com/Netflix/security_monkey/blob/master/security_monkey/views/whitelist.py
Apache-2.0
def slurp(self): """ :returns: item_list - list of ACM Certificates with details. :returns: exception_map - A dict where the keys are a tuple containing the location of the exception and the value is the actual exception """ self.prep_for_slurp() item_list =...
:returns: item_list - list of ACM Certificates with details. :returns: exception_map - A dict where the keys are a tuple containing the location of the exception and the value is the actual exception
slurp
python
Netflix/security_monkey
security_monkey/watchers/acm.py
https://github.com/Netflix/security_monkey/blob/master/security_monkey/watchers/acm.py
Apache-2.0
def slurp(self): """ :returns: item_list - list of cloud_trail items. :returns: exception_map - A dict where the keys are a tuple containing the location of the exception and the value is the actual exception """ self.prep_for_slurp() item_list = [] e...
:returns: item_list - list of cloud_trail items. :returns: exception_map - A dict where the keys are a tuple containing the location of the exception and the value is the actual exception
slurp
python
Netflix/security_monkey
security_monkey/watchers/cloud_trail.py
https://github.com/Netflix/security_monkey/blob/master/security_monkey/watchers/cloud_trail.py
Apache-2.0
def slurp(self): """ :returns: item_list - list of configs. :returns: exception_map - A dict where the keys are a tuple containing the location of the exception and the value is the actual exception """ self.prep_for_slurp() item_list = [] exception_m...
:returns: item_list - list of configs. :returns: exception_map - A dict where the keys are a tuple containing the location of the exception and the value is the actual exception
slurp
python
Netflix/security_monkey
security_monkey/watchers/config.py
https://github.com/Netflix/security_monkey/blob/master/security_monkey/watchers/config.py
Apache-2.0
def slurp(self): """ :returns: item_list - list of AWS Config recorders. :returns: exception_map - A dict where the keys are a tuple containing the location of the exception and the value is the actual exception """ self.prep_for_slurp() @iter_account_region(...
:returns: item_list - list of AWS Config recorders. :returns: exception_map - A dict where the keys are a tuple containing the location of the exception and the value is the actual exception
slurp
python
Netflix/security_monkey
security_monkey/watchers/config_recorder.py
https://github.com/Netflix/security_monkey/blob/master/security_monkey/watchers/config_recorder.py
Apache-2.0
def slurp(self): """ :returns: item_list - list of ElasticSearchService Items :return: exception_map - A dict where the keys are a tuple containing the location of the exception and the value is the actual exception """ self.prep_for_slurp() @iter_account_r...
:returns: item_list - list of ElasticSearchService Items :return: exception_map - A dict where the keys are a tuple containing the location of the exception and the value is the actual exception
slurp
python
Netflix/security_monkey
security_monkey/watchers/elasticsearch_service.py
https://github.com/Netflix/security_monkey/blob/master/security_monkey/watchers/elasticsearch_service.py
Apache-2.0
def slurp(self): """ :returns: item_list - list of Elastic IPs. :returns: exception_map - A dict where the keys are a tuple containing the location of the exception and the value is the actual exception """ self.prep_for_slurp() item_list = [] except...
:returns: item_list - list of Elastic IPs. :returns: exception_map - A dict where the keys are a tuple containing the location of the exception and the value is the actual exception
slurp
python
Netflix/security_monkey
security_monkey/watchers/elastic_ip.py
https://github.com/Netflix/security_monkey/blob/master/security_monkey/watchers/elastic_ip.py
Apache-2.0
def slurp(self): """ :returns: item_list - list of networkinterface items. :returns: exception_map - A dict where the keys are a tuple containing the location of the exception and the value is the actual exception """ self.prep_for_slurp() item_list = [] ...
:returns: item_list - list of networkinterface items. :returns: exception_map - A dict where the keys are a tuple containing the location of the exception and the value is the actual exception
slurp
python
Netflix/security_monkey
security_monkey/watchers/eni.py
https://github.com/Netflix/security_monkey/blob/master/security_monkey/watchers/eni.py
Apache-2.0
def slurp(self): """ :returns: item_list - list of IAM SSH Keypairs. :returns: exception_map - A dict where the keys are a tuple containing the location of the exception and the value is the actual exception """ self.prep_for_slurp() item_list = [] e...
:returns: item_list - list of IAM SSH Keypairs. :returns: exception_map - A dict where the keys are a tuple containing the location of the exception and the value is the actual exception
slurp
python
Netflix/security_monkey
security_monkey/watchers/keypair.py
https://github.com/Netflix/security_monkey/blob/master/security_monkey/watchers/keypair.py
Apache-2.0
def slurp(self): """ :returns: item_list - list of KMS keys. :returns: exception_map - A dict where the keys are a tuple containing the location of the exception and the value is the actual exception """ self.prep_for_slurp() @iter_account_region(index=self....
:returns: item_list - list of KMS keys. :returns: exception_map - A dict where the keys are a tuple containing the location of the exception and the value is the actual exception
slurp
python
Netflix/security_monkey
security_monkey/watchers/kms.py
https://github.com/Netflix/security_monkey/blob/master/security_monkey/watchers/kms.py
Apache-2.0
def slurp(self): """ :returns: item_list - list of Redshift Policies. :returns: exception_map - A dict where the keys are a tuple containing the location of the exception and the value is the actual exception """ self.prep_for_slurp() from security_monkey.com...
:returns: item_list - list of Redshift Policies. :returns: exception_map - A dict where the keys are a tuple containing the location of the exception and the value is the actual exception
slurp
python
Netflix/security_monkey
security_monkey/watchers/redshift.py
https://github.com/Netflix/security_monkey/blob/master/security_monkey/watchers/redshift.py
Apache-2.0
def slurp(self): """ :returns: item_list - list of Route53 zones. :returns: exception_map - A dict where the keys are a tuple containing the location of the exception and the value is the actual exception """ self.prep_for_slurp() @iter_account_region(index=s...
:returns: item_list - list of Route53 zones. :returns: exception_map - A dict where the keys are a tuple containing the location of the exception and the value is the actual exception
slurp
python
Netflix/security_monkey
security_monkey/watchers/route53.py
https://github.com/Netflix/security_monkey/blob/master/security_monkey/watchers/route53.py
Apache-2.0
def slurp(self): """ :returns: item_list - list of domain names. :returns: exception_map - A dict where the keys are a tuple containing the location of the exception and the value is the actual exception """ self.prep_for_slurp() @iter_account_region(index=se...
:returns: item_list - list of domain names. :returns: exception_map - A dict where the keys are a tuple containing the location of the exception and the value is the actual exception
slurp
python
Netflix/security_monkey
security_monkey/watchers/route53domains.py
https://github.com/Netflix/security_monkey/blob/master/security_monkey/watchers/route53domains.py
Apache-2.0
def slurp(self): """ :returns: item_list - list of Security Groups. :returns: exception_map - A dict where the keys are a tuple containing the location of the exception and the value is the actual exception """ self.prep_for_slurp() item_list = [] ex...
:returns: item_list - list of Security Groups. :returns: exception_map - A dict where the keys are a tuple containing the location of the exception and the value is the actual exception
slurp
python
Netflix/security_monkey
security_monkey/watchers/security_group.py
https://github.com/Netflix/security_monkey/blob/master/security_monkey/watchers/security_group.py
Apache-2.0
def slurp(self): """ :returns: item_list - list of SES Identities. :returns: exception_map - A dict where the keys are a tuple containing the location of the exception and the value is the actual exception """ self.prep_for_slurp() from security_monkey.common...
:returns: item_list - list of SES Identities. :returns: exception_map - A dict where the keys are a tuple containing the location of the exception and the value is the actual exception
slurp
python
Netflix/security_monkey
security_monkey/watchers/ses.py
https://github.com/Netflix/security_monkey/blob/master/security_monkey/watchers/ses.py
Apache-2.0
def slurp(self): """ :returns: item_list - list of SNSItem's. :returns: exception_map - A dict where the keys are a tuple containing the location of the exception and the value is the actual exception """ self.prep_for_slurp() item_list = [] exceptio...
:returns: item_list - list of SNSItem's. :returns: exception_map - A dict where the keys are a tuple containing the location of the exception and the value is the actual exception
slurp
python
Netflix/security_monkey
security_monkey/watchers/sns.py
https://github.com/Netflix/security_monkey/blob/master/security_monkey/watchers/sns.py
Apache-2.0
def list_method(self, **kwargs): """ Get the list of SQS queues. Also, create the corresponding lookup table with URL -> position in the total list. :param kwargs: :return: """ items = [] queues = list_queues(**kwargs) # Offset by the existing ite...
Get the list of SQS queues. Also, create the corresponding lookup table with URL -> position in the total list. :param kwargs: :return:
list_method
python
Netflix/security_monkey
security_monkey/watchers/sqs.py
https://github.com/Netflix/security_monkey/blob/master/security_monkey/watchers/sqs.py
Apache-2.0
def slurp(self): """ :returns: item_list - list of connections :returns: exception_map - A dict where the keys are a tuple containing the location of the exception and the value is the actual exception """ self.prep_for_slurp() from security_monkey.common.sts...
:returns: item_list - list of connections :returns: exception_map - A dict where the keys are a tuple containing the location of the exception and the value is the actual exception
slurp
python
Netflix/security_monkey
security_monkey/watchers/direct_connect/connection.py
https://github.com/Netflix/security_monkey/blob/master/security_monkey/watchers/direct_connect/connection.py
Apache-2.0
def slurp(self): """ :returns: item_list - list of virtual gateways :returns: exception_map - A dict where the keys are a tuple containing the location of the exception and the value is the actual exception """ self.prep_for_slurp() from security_monkey.commo...
:returns: item_list - list of virtual gateways :returns: exception_map - A dict where the keys are a tuple containing the location of the exception and the value is the actual exception
slurp
python
Netflix/security_monkey
security_monkey/watchers/direct_connect/virtual_gateway.py
https://github.com/Netflix/security_monkey/blob/master/security_monkey/watchers/direct_connect/virtual_gateway.py
Apache-2.0
def slurp(self): """ :returns: item_list - list of available EBS snapshots defined by account :returns: exception_map - A dict where the keys are a tuple containing the location of the exception and the value is the actual exception """ self.prep_for_slurp() ...
:returns: item_list - list of available EBS snapshots defined by account :returns: exception_map - A dict where the keys are a tuple containing the location of the exception and the value is the actual exception
slurp
python
Netflix/security_monkey
security_monkey/watchers/ec2/ebs_snapshot.py
https://github.com/Netflix/security_monkey/blob/master/security_monkey/watchers/ec2/ebs_snapshot.py
Apache-2.0
def slurp(self): """ :returns: item_list - list of EBS volumes in use by account :returns: exception_map - A dict where the keys are a tuple containing the location of the exception and the value is the actual exception """ self.prep_for_slurp() @iter_accoun...
:returns: item_list - list of EBS volumes in use by account :returns: exception_map - A dict where the keys are a tuple containing the location of the exception and the value is the actual exception
slurp
python
Netflix/security_monkey
security_monkey/watchers/ec2/ebs_volume.py
https://github.com/Netflix/security_monkey/blob/master/security_monkey/watchers/ec2/ebs_volume.py
Apache-2.0
def slurp(self): """ :returns: item_list - list of EC2 instances in use by account :returns: exception_map - A dict where the keys are a tuple containing the location of the exception and the value is the actual exception """ self.prep_for_slurp() @iter_acco...
:returns: item_list - list of EC2 instances in use by account :returns: exception_map - A dict where the keys are a tuple containing the location of the exception and the value is the actual exception
slurp
python
Netflix/security_monkey
security_monkey/watchers/ec2/ec2_instance.py
https://github.com/Netflix/security_monkey/blob/master/security_monkey/watchers/ec2/ec2_instance.py
Apache-2.0
def slurp(self): """ :returns: item_list - list of GCEFirewallRules. :returns: exception _map - A dict where the keys are a tuple containing the location of the exception and the value is the actual exception """ self.prep_for_slurp() project_creds = get_gcp_proje...
:returns: item_list - list of GCEFirewallRules. :returns: exception _map - A dict where the keys are a tuple containing the location of the exception and the value is the actual exception
slurp
python
Netflix/security_monkey
security_monkey/watchers/gcp/gce/firewall.py
https://github.com/Netflix/security_monkey/blob/master/security_monkey/watchers/gcp/gce/firewall.py
Apache-2.0
def slurp(self): """ :returns: item_list - list of GCENetwork. :returns: exception _map - A dict where the keys are a tuple containing the location of the exception and the value is the actual exception """ self.prep_for_slurp() project_creds = get_gcp_project_cr...
:returns: item_list - list of GCENetwork. :returns: exception _map - A dict where the keys are a tuple containing the location of the exception and the value is the actual exception
slurp
python
Netflix/security_monkey
security_monkey/watchers/gcp/gce/network.py
https://github.com/Netflix/security_monkey/blob/master/security_monkey/watchers/gcp/gce/network.py
Apache-2.0
def slurp(self): """ :returns: item_list - list of GCSBuckets. :returns: exception _map - A dict where the keys are a tuple containing the location of the exception and the value is the actual exception """ self.prep_for_slurp() project_creds = get_gcp_project_cr...
:returns: item_list - list of GCSBuckets. :returns: exception _map - A dict where the keys are a tuple containing the location of the exception and the value is the actual exception
slurp
python
Netflix/security_monkey
security_monkey/watchers/gcp/gcs/bucket.py
https://github.com/Netflix/security_monkey/blob/master/security_monkey/watchers/gcp/gcs/bucket.py
Apache-2.0
def slurp(self): """ :returns: item_list - list of IAMServiceAccounts. :returns: exception _map - A dict where the keys are a tuple containing the location of the exception and the value is the actual exception """ self.prep_for_slurp() project_creds = get_gcp_pr...
:returns: item_list - list of IAMServiceAccounts. :returns: exception _map - A dict where the keys are a tuple containing the location of the exception and the value is the actual exception
slurp
python
Netflix/security_monkey
security_monkey/watchers/gcp/iam/serviceaccount.py
https://github.com/Netflix/security_monkey/blob/master/security_monkey/watchers/gcp/iam/serviceaccount.py
Apache-2.0
def slurp(self): """ :returns: item_list - list of IAM Groups. :returns: exception_map - A dict where the keys are a tuple containing the location of the exception and the value is the actual exception """ self.prep_for_slurp() item_list = [] exception...
:returns: item_list - list of IAM Groups. :returns: exception_map - A dict where the keys are a tuple containing the location of the exception and the value is the actual exception
slurp
python
Netflix/security_monkey
security_monkey/watchers/iam/iam_group.py
https://github.com/Netflix/security_monkey/blob/master/security_monkey/watchers/iam/iam_group.py
Apache-2.0
def cert_get_bitstrength(cert): """ Calculates a certificates public key bit length. :param cert: :return: Integer """ if hasattr(cert.public_key(), 'key_size'): return cert.public_key().key_size else: return None
Calculates a certificates public key bit length. :param cert: :return: Integer
cert_get_bitstrength
python
Netflix/security_monkey
security_monkey/watchers/iam/iam_ssl.py
https://github.com/Netflix/security_monkey/blob/master/security_monkey/watchers/iam/iam_ssl.py
Apache-2.0
def cert_get_issuer(cert): """ Gets a sane issuer from a given certificate. :param cert: :return: Issuer """ delchars = ''.join(c for c in map(chr, list(range(256))) if not c.isalnum()) try: issuer = str(cert.issuer.get_attributes_for_oid(x509.OID_ORGANIZATION_NAME)[0].value) ...
Gets a sane issuer from a given certificate. :param cert: :return: Issuer
cert_get_issuer
python
Netflix/security_monkey
security_monkey/watchers/iam/iam_ssl.py
https://github.com/Netflix/security_monkey/blob/master/security_monkey/watchers/iam/iam_ssl.py
Apache-2.0
def cert_get_domains(cert): """ Attempts to get an domains listed in a certificate. If 'subjectAltName' extension is not available we simply return the common name. :param cert: :return: List of domains """ domains = [] try: ext = cert.extensions.get_extension_for_oid(x509.O...
Attempts to get an domains listed in a certificate. If 'subjectAltName' extension is not available we simply return the common name. :param cert: :return: List of domains
cert_get_domains
python
Netflix/security_monkey
security_monkey/watchers/iam/iam_ssl.py
https://github.com/Netflix/security_monkey/blob/master/security_monkey/watchers/iam/iam_ssl.py
Apache-2.0
def cert_get_cn(cert): """ Attempts to get a sane common name from a given certificate. :param cert: :return: Common name or None """ cn = cert.subject.get_attributes_for_oid(x509.OID_COMMON_NAME) if len(cn) > 0: return cn[0].value.strip() return ''
Attempts to get a sane common name from a given certificate. :param cert: :return: Common name or None
cert_get_cn
python
Netflix/security_monkey
security_monkey/watchers/iam/iam_ssl.py
https://github.com/Netflix/security_monkey/blob/master/security_monkey/watchers/iam/iam_ssl.py
Apache-2.0
def cert_is_wildcard(cert): """ Determines if certificate is a wildcard certificate. :param cert: :return: Bool """ domains = cert_get_domains(cert) if len(domains) == 1 and domains[0][0:1] == "*": return True cn = cert.subject.get_attributes_for_oid(x509.OID_COMMON_NAME) i...
Determines if certificate is a wildcard certificate. :param cert: :return: Bool
cert_is_wildcard
python
Netflix/security_monkey
security_monkey/watchers/iam/iam_ssl.py
https://github.com/Netflix/security_monkey/blob/master/security_monkey/watchers/iam/iam_ssl.py
Apache-2.0
def slurp(self): """ :returns: item_list - list of IAM SSL Certificates. :returns: exception_map - A dict where the keys are a tuple containing the location of the exception and the value is the actual exception """ item_list = [] exception_map = {} fo...
:returns: item_list - list of IAM SSL Certificates. :returns: exception_map - A dict where the keys are a tuple containing the location of the exception and the value is the actual exception
slurp
python
Netflix/security_monkey
security_monkey/watchers/iam/iam_ssl.py
https://github.com/Netflix/security_monkey/blob/master/security_monkey/watchers/iam/iam_ssl.py
Apache-2.0
def slurp(self): """ :returns: item_list - list of Managed Policies. :returns: exception_map - A dict where the keys are a tuple containing the location of the exception and the value is the actual exception """ self.prep_for_slurp() item_list = [] exc...
:returns: item_list - list of Managed Policies. :returns: exception_map - A dict where the keys are a tuple containing the location of the exception and the value is the actual exception
slurp
python
Netflix/security_monkey
security_monkey/watchers/iam/managed_policy.py
https://github.com/Netflix/security_monkey/blob/master/security_monkey/watchers/iam/managed_policy.py
Apache-2.0
def _get_account_regions(self): """ Regions are not global but account specific """ def _get_regions(cloud_name, yaml_file): return [ _region.get('name') for _region in get_regions( cloud_name, yaml_file ) ] account_regions = {} for account in self.accounts: clo...
Regions are not global but account specific
_get_account_regions
python
Netflix/security_monkey
security_monkey/watchers/openstack/openstack_watcher.py
https://github.com/Netflix/security_monkey/blob/master/security_monkey/watchers/openstack/openstack_watcher.py
Apache-2.0
def slurp(self): """ :returns: item_list - list of RDS Cluster Snapshots. :returns: exception_map - A dict where the keys are a tuple containing the location of the exception and the value is the actual exception """ self.prep_for_slurp() from security_monkey...
:returns: item_list - list of RDS Cluster Snapshots. :returns: exception_map - A dict where the keys are a tuple containing the location of the exception and the value is the actual exception
slurp
python
Netflix/security_monkey
security_monkey/watchers/rds/rds_cluster_snapshot.py
https://github.com/Netflix/security_monkey/blob/master/security_monkey/watchers/rds/rds_cluster_snapshot.py
Apache-2.0
def slurp(self): """ :returns: item_list - list of RDS DB Clusters. :returns: exception_map - A dict where the keys are a tuple containing the location of the exception and the value is the actual exception """ self.prep_for_slurp() item_list = [] ex...
:returns: item_list - list of RDS DB Clusters. :returns: exception_map - A dict where the keys are a tuple containing the location of the exception and the value is the actual exception
slurp
python
Netflix/security_monkey
security_monkey/watchers/rds/rds_db_cluster.py
https://github.com/Netflix/security_monkey/blob/master/security_monkey/watchers/rds/rds_db_cluster.py
Apache-2.0
def slurp(self): """ :returns: item_list - list of RDS DB Instances. :returns: exception_map - A dict where the keys are a tuple containing the location of the exception and the value is the actual exception """ self.prep_for_slurp() @iter_account_region(ind...
:returns: item_list - list of RDS DB Instances. :returns: exception_map - A dict where the keys are a tuple containing the location of the exception and the value is the actual exception
slurp
python
Netflix/security_monkey
security_monkey/watchers/rds/rds_db_instance.py
https://github.com/Netflix/security_monkey/blob/master/security_monkey/watchers/rds/rds_db_instance.py
Apache-2.0
def slurp(self): """ :returns: item_list - list of RDS Security Groups. :returns: exception_map - A dict where the keys are a tuple containing the location of the exception and the value is the actual exception """ self.prep_for_slurp() @iter_account_region(...
:returns: item_list - list of RDS Security Groups. :returns: exception_map - A dict where the keys are a tuple containing the location of the exception and the value is the actual exception
slurp
python
Netflix/security_monkey
security_monkey/watchers/rds/rds_security_group.py
https://github.com/Netflix/security_monkey/blob/master/security_monkey/watchers/rds/rds_security_group.py
Apache-2.0
def slurp(self): """ :returns: item_list - list of RDS snapshots in use by account :returns: exception_map - A dict where the keys are a tuple containing the location of the exception and the value is the actual exception """ self.prep_for_slurp() from securi...
:returns: item_list - list of RDS snapshots in use by account :returns: exception_map - A dict where the keys are a tuple containing the location of the exception and the value is the actual exception
slurp
python
Netflix/security_monkey
security_monkey/watchers/rds/rds_snapshot.py
https://github.com/Netflix/security_monkey/blob/master/security_monkey/watchers/rds/rds_snapshot.py
Apache-2.0
def slurp(self): """ :returns: item_list - list of RDS Subnet Groups. :returns: exception_map - A dict where the keys are a tuple containing the location of the exception and the value is the actual exception """ self.prep_for_slurp() @iter_account_region(in...
:returns: item_list - list of RDS Subnet Groups. :returns: exception_map - A dict where the keys are a tuple containing the location of the exception and the value is the actual exception
slurp
python
Netflix/security_monkey
security_monkey/watchers/rds/rds_subnet_group.py
https://github.com/Netflix/security_monkey/blob/master/security_monkey/watchers/rds/rds_subnet_group.py
Apache-2.0
def slurp(self): """ :returns: item_list - list of dhcp option sets. :returns: exception_map - A dict where the keys are a tuple containing the location of the exception and the value is the actual exception """ self.prep_for_slurp() @iter_account_region(ind...
:returns: item_list - list of dhcp option sets. :returns: exception_map - A dict where the keys are a tuple containing the location of the exception and the value is the actual exception
slurp
python
Netflix/security_monkey
security_monkey/watchers/vpc/dhcp.py
https://github.com/Netflix/security_monkey/blob/master/security_monkey/watchers/vpc/dhcp.py
Apache-2.0
def slurp(self): """ :returns: item_list - list of endpoints. :returns: exception_map - A dict where the keys are a tuple containing the location of the exception and the value is the actual exception """ self.prep_for_slurp() item_list = [] exceptio...
:returns: item_list - list of endpoints. :returns: exception_map - A dict where the keys are a tuple containing the location of the exception and the value is the actual exception
slurp
python
Netflix/security_monkey
security_monkey/watchers/vpc/endpoint.py
https://github.com/Netflix/security_monkey/blob/master/security_monkey/watchers/vpc/endpoint.py
Apache-2.0
def slurp(self): """ :returns: item_list - list of Flow Logs in use by account :returns: exception_map - A dict where the keys are a tuple containing the location of the exception and the value is the actual exception """ self.prep_for_slurp() from security_m...
:returns: item_list - list of Flow Logs in use by account :returns: exception_map - A dict where the keys are a tuple containing the location of the exception and the value is the actual exception
slurp
python
Netflix/security_monkey
security_monkey/watchers/vpc/flow_log.py
https://github.com/Netflix/security_monkey/blob/master/security_monkey/watchers/vpc/flow_log.py
Apache-2.0
def slurp(self): """ :returns: item_list - list of nat_gateways. :returns: exception_map - A dict where the keys are a tuple containing the location of the exception and the value is the actual exception """ self.prep_for_slurp() item_list = [] excep...
:returns: item_list - list of nat_gateways. :returns: exception_map - A dict where the keys are a tuple containing the location of the exception and the value is the actual exception
slurp
python
Netflix/security_monkey
security_monkey/watchers/vpc/nat_gateway.py
https://github.com/Netflix/security_monkey/blob/master/security_monkey/watchers/vpc/nat_gateway.py
Apache-2.0
def slurp(self): """ :returns: item_list - list of network acls. :returns: exception_map - A dict where the keys are a tuple containing the location of the exception and the value is the actual exception """ self.prep_for_slurp() @iter_account_region(index=s...
:returns: item_list - list of network acls. :returns: exception_map - A dict where the keys are a tuple containing the location of the exception and the value is the actual exception
slurp
python
Netflix/security_monkey
security_monkey/watchers/vpc/networkacl.py
https://github.com/Netflix/security_monkey/blob/master/security_monkey/watchers/vpc/networkacl.py
Apache-2.0
def slurp(self): """ :returns: item_list - list of vpc peerings. :returns: exception_map - A dict where the keys are a tuple containing the location of the exception and the value is the actual exception """ self.prep_for_slurp() @iter_account_region(index=s...
:returns: item_list - list of vpc peerings. :returns: exception_map - A dict where the keys are a tuple containing the location of the exception and the value is the actual exception
slurp
python
Netflix/security_monkey
security_monkey/watchers/vpc/peering.py
https://github.com/Netflix/security_monkey/blob/master/security_monkey/watchers/vpc/peering.py
Apache-2.0
def slurp(self): """ :returns: item_list - list of route tables. :returns: exception_map - A dict where the keys are a tuple containing the location of the exception and the value is the actual exception """ self.prep_for_slurp() @iter_account_region(index=se...
:returns: item_list - list of route tables. :returns: exception_map - A dict where the keys are a tuple containing the location of the exception and the value is the actual exception
slurp
python
Netflix/security_monkey
security_monkey/watchers/vpc/route_table.py
https://github.com/Netflix/security_monkey/blob/master/security_monkey/watchers/vpc/route_table.py
Apache-2.0
def slurp(self): """ :returns: item_list - list of subnets. :returns: exception_map - A dict where the keys are a tuple containing the location of the exception and the value is the actual exception """ self.prep_for_slurp() @iter_account_region(index=self.i...
:returns: item_list - list of subnets. :returns: exception_map - A dict where the keys are a tuple containing the location of the exception and the value is the actual exception
slurp
python
Netflix/security_monkey
security_monkey/watchers/vpc/subnet.py
https://github.com/Netflix/security_monkey/blob/master/security_monkey/watchers/vpc/subnet.py
Apache-2.0
def augment_with_pretrained(words_freq, ext_emb_path): """ Augment the dictionary with words that have a pretrained embedding. """ print( 'Augmenting words by pretrained embeddings from %s...' % ext_emb_path ) assert os.path.isfile(ext_emb_path) # Load pretrained embeddings from fil...
Augment the dictionary with words that have a pretrained embedding.
augment_with_pretrained
python
EagleW/PaperRobot
New paper writing/loader/loader.py
https://github.com/EagleW/PaperRobot/blob/master/New paper writing/loader/loader.py
MIT
def create_mapping(freq, min_freq=0, max_vocab=50000): """ Create a mapping (item to ID / ID to item) from a dictionary. Items are ordered by decreasing frequency. char is an indicator whether the mapping is for char/word or the """ freq = freq.most_common(max_vocab) item2id = { '<pa...
Create a mapping (item to ID / ID to item) from a dictionary. Items are ordered by decreasing frequency. char is an indicator whether the mapping is for char/word or the
create_mapping
python
EagleW/PaperRobot
New paper writing/loader/preprocessing.py
https://github.com/EagleW/PaperRobot/blob/master/New paper writing/loader/preprocessing.py
MIT
def create_dict(item_list): """ Create a dictionary of items from a list of list of items. """ assert type(item_list) is list freq = Counter(item_list) return freq
Create a dictionary of items from a list of list of items.
create_dict
python
EagleW/PaperRobot
New paper writing/loader/preprocessing.py
https://github.com/EagleW/PaperRobot/blob/master/New paper writing/loader/preprocessing.py
MIT
def prepare_mapping(words, lower, min_freq): """ prepare word2id :param words: words corpus :param lower: whether lower char :return mappings """ if lower: words = [w.lower() for w in words] words_freq = create_dict(words) word2id, id2word = create_mapping(words_freq, min_fre...
prepare word2id :param words: words corpus :param lower: whether lower char :return mappings
prepare_mapping
python
EagleW/PaperRobot
New paper writing/loader/preprocessing.py
https://github.com/EagleW/PaperRobot/blob/master/New paper writing/loader/preprocessing.py
MIT
def precook(s, n=4, out=False): """Takes a string as input and returns an object that can be given to either cook_refs or cook_test. This is optional: cook_refs and cook_test can take string arguments as well.""" words = s.split() counts = defaultdict(int) for k in range(1,n+1): for i in...
Takes a string as input and returns an object that can be given to either cook_refs or cook_test. This is optional: cook_refs and cook_test can take string arguments as well.
precook
python
EagleW/PaperRobot
New paper writing/pycocoevalcap/bleu/bleu_scorer.py
https://github.com/EagleW/PaperRobot/blob/master/New paper writing/pycocoevalcap/bleu/bleu_scorer.py
MIT
def cook_refs(refs, eff=None, n=4): ## lhuang: oracle will call with "average" '''Takes a list of reference sentences for a single segment and returns an object that encapsulates everything that BLEU needs to know about them.''' reflen = [] maxcounts = {} for ref in refs: rl, counts = p...
Takes a list of reference sentences for a single segment and returns an object that encapsulates everything that BLEU needs to know about them.
cook_refs
python
EagleW/PaperRobot
New paper writing/pycocoevalcap/bleu/bleu_scorer.py
https://github.com/EagleW/PaperRobot/blob/master/New paper writing/pycocoevalcap/bleu/bleu_scorer.py
MIT
def cook_test(test, ref_len_counts, eff=None, n=4): '''Takes a test sentence and returns an object that encapsulates everything that BLEU needs to know about it.''' (reflen, refmaxcounts) = ref_len_counts testlen, counts = precook(test, n, True) result = {} # Calculate effective reference sent...
Takes a test sentence and returns an object that encapsulates everything that BLEU needs to know about it.
cook_test
python
EagleW/PaperRobot
New paper writing/pycocoevalcap/bleu/bleu_scorer.py
https://github.com/EagleW/PaperRobot/blob/master/New paper writing/pycocoevalcap/bleu/bleu_scorer.py
MIT
def my_lcs(string, sub): """ Calculates longest common subsequence for a pair of tokenized strings :param string : list of str : tokens from a string split using whitespace :param sub : list of str : shorter string, also split using whitespace :returns: length (list of int): length of the longest co...
Calculates longest common subsequence for a pair of tokenized strings :param string : list of str : tokens from a string split using whitespace :param sub : list of str : shorter string, also split using whitespace :returns: length (list of int): length of the longest common subsequence between the two...
my_lcs
python
EagleW/PaperRobot
New paper writing/pycocoevalcap/rouge/rouge.py
https://github.com/EagleW/PaperRobot/blob/master/New paper writing/pycocoevalcap/rouge/rouge.py
MIT
def calc_score(self, candidate, refs): """ Compute ROUGE-L score given one candidate and references for an image :param candidate: str : candidate sentence to be evaluated :param refs: list of str : COCO reference sentences for the particular image to be evaluated :returns score:...
Compute ROUGE-L score given one candidate and references for an image :param candidate: str : candidate sentence to be evaluated :param refs: list of str : COCO reference sentences for the particular image to be evaluated :returns score: int (ROUGE-L score for the candidate evaluated ag...
calc_score
python
EagleW/PaperRobot
New paper writing/pycocoevalcap/rouge/rouge.py
https://github.com/EagleW/PaperRobot/blob/master/New paper writing/pycocoevalcap/rouge/rouge.py
MIT
def compute_score(self, gts, res): """ Computes Rouge-L score given a set of reference and candidate sentences for the dataset Invoked by evaluate_captions.py :param hypo_for_image: dict : candidate / test sentences with "image name" key and "tokenized sentences" as values :param...
Computes Rouge-L score given a set of reference and candidate sentences for the dataset Invoked by evaluate_captions.py :param hypo_for_image: dict : candidate / test sentences with "image name" key and "tokenized sentences" as values :param ref_for_image: dict : reference MS-COCO sente...
compute_score
python
EagleW/PaperRobot
New paper writing/pycocoevalcap/rouge/rouge.py
https://github.com/EagleW/PaperRobot/blob/master/New paper writing/pycocoevalcap/rouge/rouge.py
MIT
def get_optimizer(model, lr_method, lr_rate): """ parse optimization method parameters, and initialize optimizer function """ lr_method_name = lr_method # initialize optimizer function if lr_method_name == 'sgd': optimizer = optim.SGD(model.parameters(), lr=lr_rate, momentum=0.9) ...
parse optimization method parameters, and initialize optimizer function
get_optimizer
python
EagleW/PaperRobot
New paper writing/utils/optim.py
https://github.com/EagleW/PaperRobot/blob/master/New paper writing/utils/optim.py
MIT
def _GenerateName(self) -> str: """Generates a unique name for the AppService. Locking the counter variable allows for each created app service name to be unique within the python process. Returns: The newly generated name. """ with self._appservice_counter_lock: self.appservice_nu...
Generates a unique name for the AppService. Locking the counter variable allows for each created app service name to be unique within the python process. Returns: The newly generated name.
_GenerateName
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/app_service.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/app_service.py
Apache-2.0
def Invoke( self, retries: int = 0, args: Any = None ) -> http_poller.PollingResponse: """Invokes a deployed app instance. Args: retries: Number of retries to attempt. args: dict. Arguments passed to app. Returns: An object containing success, response string, & latency. Latency ...
Invokes a deployed app instance. Args: retries: Number of retries to attempt. args: dict. Arguments passed to app. Returns: An object containing success, response string, & latency. Latency is also negative in the case of a failure.
Invoke
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/app_service.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/app_service.py
Apache-2.0
def _IsReady(self) -> bool: """Returns true if the underlying resource is ready. Supplying this method is optional. Use it when a resource can exist without being ready. If the subclass does not implement it then it just returns true. Returns: True if the resource was ready in time, False ...
Returns true if the underlying resource is ready. Supplying this method is optional. Use it when a resource can exist without being ready. If the subclass does not implement it then it just returns true. Returns: True if the resource was ready in time, False if the wait timed out.
_IsReady
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/app_service.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/app_service.py
Apache-2.0
def ArchiveRun( run_temp_directory, target_bucket, prefix='', gsutil_path='gsutil', aws_path=AWS_PATH, ): """Archive a run directory to GCS or S3. Args: run_temp_directory: str. directory to archive. target_bucket: str. Either a gs:// or s3:// path to an extant bucket. prefix: str. ...
Archive a run directory to GCS or S3. Args: run_temp_directory: str. directory to archive. target_bucket: str. Either a gs:// or s3:// path to an extant bucket. prefix: str. prefix for the file. gsutil_path: str. Path to the gsutil tool. aws_path: str. Path to the aws command line tool. Raises...
ArchiveRun
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/archive.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/archive.py
Apache-2.0
def _GetCallString(target_arg_tuple): """Returns the string representation of a function call.""" target, args, kwargs = target_arg_tuple while isinstance(target, functools.partial): args = target.args + args inner_kwargs = target.keywords.copy() inner_kwargs.update(kwargs) kwargs = inner_kwargs ...
Returns the string representation of a function call.
_GetCallString
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/background_tasks.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/background_tasks.py
Apache-2.0
def _WaitForCondition(condition_callback, timeout=None): """Waits until the specified callback returns a value that evaluates True. Similar to the threading.Condition.wait method that is the basis of most threading class wait routines. Polls the condition, starting with frequent checks but extending the delay ...
Waits until the specified callback returns a value that evaluates True. Similar to the threading.Condition.wait method that is the basis of most threading class wait routines. Polls the condition, starting with frequent checks but extending the delay between checks upon each failure. Args: condition_callb...
_WaitForCondition
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/background_tasks.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/background_tasks.py
Apache-2.0
def Run(self): """Sets the current thread context and executes the target.""" self.context.CopyToCurrentThread() try: self.return_value = self.target(*self.args, **self.kwargs) except Exception: self.traceback = traceback.format_exc()
Sets the current thread context and executes the target.
Run
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/background_tasks.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/background_tasks.py
Apache-2.0
def _ExecuteBackgroundThreadTasks(worker_id, task_queue, response_queue): """Executes tasks received on a task queue. Executed in a child Thread by _BackgroundThreadTaskManager. Args: worker_id: int. Identifier for the child thread relative to other child threads. task_queue: _NonPollingSingleRead...
Executes tasks received on a task queue. Executed in a child Thread by _BackgroundThreadTaskManager. Args: worker_id: int. Identifier for the child thread relative to other child threads. task_queue: _NonPollingSingleReaderQueue. Queue from which input is read. Each value in the queue can be o...
_ExecuteBackgroundThreadTasks
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/background_tasks.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/background_tasks.py
Apache-2.0
def _ExecuteProcessTask(task): """Function invoked in another process by _BackgroundProcessTaskManager. Executes a specified task function and returns the result or exception traceback. TODO(user): Rework this helper function when moving to Python 3.5 or when the backport of concurrent.futures.ProcessPoolEx...
Function invoked in another process by _BackgroundProcessTaskManager. Executes a specified task function and returns the result or exception traceback. TODO(user): Rework this helper function when moving to Python 3.5 or when the backport of concurrent.futures.ProcessPoolExecutor is able to preserve origina...
_ExecuteProcessTask
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/background_tasks.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/background_tasks.py
Apache-2.0