hexsha stringlengths 40 40 | repo stringlengths 7 114 | path stringlengths 4 124 | license listlengths 1 9 | language stringclasses 1
value | identifier stringlengths 1 71 | return_type stringlengths 1 749 ⌀ | original_string stringlengths 76 22.7k | original_docstring stringlengths 16 7.61k | docstring stringlengths 16 2.47k | docstring_tokens listlengths 6 477 | code stringlengths 14 10.2k | code_tokens listlengths 6 996 | short_docstring stringlengths 2 644 | short_docstring_tokens listlengths 1 116 | comment listlengths 1 89 | parameters listlengths 0 64 | docstring_params dict |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
2ee3cc36af42df8972735fb2f9da0e6e5ee742b2 | collectiveacuity/labPack | labpack/events/meetup.py | [
"MIT"
] | Python | list_event_attendees | <not_specific> | def list_event_attendees(self, group_url, event_id):
''' a method to retrieve attendee list for event from meetup api
:param group_url: string with meetup urlname for host group
:param event_id: integer with meetup id for event
:return: dictionary with list of attendee details in... | a method to retrieve attendee list for event from meetup api
:param group_url: string with meetup urlname for host group
:param event_id: integer with meetup id for event
:return: dictionary with list of attendee details inside [json] key
attendee_details = self._reconstruct_att... | a method to retrieve attendee list for event from meetup api | [
"a",
"method",
"to",
"retrieve",
"attendee",
"list",
"for",
"event",
"from",
"meetup",
"api"
] | def list_event_attendees(self, group_url, event_id):
title = '%s.list_event_attendees' % self.__class__.__name__
input_fields = {
'group_url': group_url,
'event_id': event_id
}
for key, value in input_fields.items():
if value:
object_ti... | [
"def",
"list_event_attendees",
"(",
"self",
",",
"group_url",
",",
"event_id",
")",
":",
"title",
"=",
"'%s.list_event_attendees'",
"%",
"self",
".",
"__class__",
".",
"__name__",
"input_fields",
"=",
"{",
"'group_url'",
":",
"group_url",
",",
"'event_id'",
":",... | a method to retrieve attendee list for event from meetup api | [
"a",
"method",
"to",
"retrieve",
"attendee",
"list",
"for",
"event",
"from",
"meetup",
"api"
] | [
"''' a method to retrieve attendee list for event from meetup api\r\n\r\n :param group_url: string with meetup urlname for host group\r\n :param event_id: integer with meetup id for event\r\n :return: dictionary with list of attendee details inside [json] key\r\n\r\n attendee_details = s... | [
{
"param": "self",
"type": null
},
{
"param": "group_url",
"type": null
},
{
"param": "event_id",
"type": null
}
] | {
"returns": [
{
"docstring": "dictionary with list of attendee details inside [json] key\nattendee_details = self._reconstruct_attendee({})",
"docstring_tokens": [
"dictionary",
"with",
"list",
"of",
"attendee",
"details",
"inside",
"[",... |
2ee3cc36af42df8972735fb2f9da0e6e5ee742b2 | collectiveacuity/labPack | labpack/events/meetup.py | [
"MIT"
] | Python | list_locations | <not_specific> | def list_locations(self, latitude=0.0, longitude=0.0, zip_code='', city_name='', max_results=0):
''' a method to retrieve location address details based upon search parameters
:param latitude: [optional] float with latitude coordinate at center of geo search
:param longitude: [optional] f... | a method to retrieve location address details based upon search parameters
:param latitude: [optional] float with latitude coordinate at center of geo search
:param longitude: [optional] float with longitude coordinate at center of geo search
:param city_name: [optional] string with name o... | a method to retrieve location address details based upon search parameters | [
"a",
"method",
"to",
"retrieve",
"location",
"address",
"details",
"based",
"upon",
"search",
"parameters"
] | def list_locations(self, latitude=0.0, longitude=0.0, zip_code='', city_name='', max_results=0):
title = '%s.list_locations' % self.__class__.__name__
input_fields = {
'latitude': latitude,
'longitude': longitude,
'zip_code': zip_code,
'city_name': city_na... | [
"def",
"list_locations",
"(",
"self",
",",
"latitude",
"=",
"0.0",
",",
"longitude",
"=",
"0.0",
",",
"zip_code",
"=",
"''",
",",
"city_name",
"=",
"''",
",",
"max_results",
"=",
"0",
")",
":",
"title",
"=",
"'%s.list_locations'",
"%",
"self",
".",
"__... | a method to retrieve location address details based upon search parameters | [
"a",
"method",
"to",
"retrieve",
"location",
"address",
"details",
"based",
"upon",
"search",
"parameters"
] | [
"''' a method to retrieve location address details based upon search parameters\r\n\r\n :param latitude: [optional] float with latitude coordinate at center of geo search\r\n :param longitude: [optional] float with longitude coordinate at center of geo search\r\n :param city_name: [optional] st... | [
{
"param": "self",
"type": null
},
{
"param": "latitude",
"type": null
},
{
"param": "longitude",
"type": null
},
{
"param": "zip_code",
"type": null
},
{
"param": "city_name",
"type": null
},
{
"param": "max_results",
"type": null
}
] | {
"returns": [
{
"docstring": "dictionary with list of location details inside [json] key\nlocation_details = self.objects.location.schema",
"docstring_tokens": [
"dictionary",
"with",
"list",
"of",
"location",
"details",
"inside",
"[",
... |
2ee3cc36af42df8972735fb2f9da0e6e5ee742b2 | collectiveacuity/labPack | labpack/events/meetup.py | [
"MIT"
] | Python | join_group | <not_specific> | def join_group(self, group_url, membership_answers=None):
''' a method to add member to a meetup group
:param group_url: string with meetup urlname for group
:param membership_answers: list with question id and answer for group join questions
:return: dictionary with member profi... | a method to add member to a meetup group
:param group_url: string with meetup urlname for group
:param membership_answers: list with question id and answer for group join questions
:return: dictionary with member profile details inside [json] key
profile_details = self._reconstr... | a method to add member to a meetup group | [
"a",
"method",
"to",
"add",
"member",
"to",
"a",
"meetup",
"group"
] | def join_group(self, group_url, membership_answers=None):
title = '%s.join_group' % self.__class__.__name__
if not 'group_join' in self.service_scope:
raise ValueError('%s requires group_join as part of oauth2 service_scope permissions.' % title)
input_fields = {
'group_u... | [
"def",
"join_group",
"(",
"self",
",",
"group_url",
",",
"membership_answers",
"=",
"None",
")",
":",
"title",
"=",
"'%s.join_group'",
"%",
"self",
".",
"__class__",
".",
"__name__",
"if",
"not",
"'group_join'",
"in",
"self",
".",
"service_scope",
":",
"rais... | a method to add member to a meetup group | [
"a",
"method",
"to",
"add",
"member",
"to",
"a",
"meetup",
"group"
] | [
"''' a method to add member to a meetup group\r\n\r\n :param group_url: string with meetup urlname for group\r\n :param membership_answers: list with question id and answer for group join questions\r\n :return: dictionary with member profile details inside [json] key\r\n\r\n profile_deta... | [
{
"param": "self",
"type": null
},
{
"param": "group_url",
"type": null
},
{
"param": "membership_answers",
"type": null
}
] | {
"returns": [
{
"docstring": "dictionary with member profile details inside [json] key\nprofile_details = self._reconstruct_member({})",
"docstring_tokens": [
"dictionary",
"with",
"member",
"profile",
"details",
"inside",
"[",
"json",
... |
2ee3cc36af42df8972735fb2f9da0e6e5ee742b2 | collectiveacuity/labPack | labpack/events/meetup.py | [
"MIT"
] | Python | leave_group | <not_specific> | def leave_group(self, group_url, member_id, exit_comment=''):
''' a method to remove group from meetup member profile
:param group_url: string with meetup urlname for group
:param member_id: integer with member id from member profile
:param exit_comment: string with comment to le... | a method to remove group from meetup member profile
:param group_url: string with meetup urlname for group
:param member_id: integer with member id from member profile
:param exit_comment: string with comment to leave with organizer
:return: dictionary with code 204 on success
... | a method to remove group from meetup member profile | [
"a",
"method",
"to",
"remove",
"group",
"from",
"meetup",
"member",
"profile"
] | def leave_group(self, group_url, member_id, exit_comment=''):
title = '%s.leave_group' % self.__class__.__name__
if not 'profile_edit' in self.service_scope:
raise ValueError('%s requires profile_edit as part of oauth2 service_scope permissions.' % title)
input_fields = {
... | [
"def",
"leave_group",
"(",
"self",
",",
"group_url",
",",
"member_id",
",",
"exit_comment",
"=",
"''",
")",
":",
"title",
"=",
"'%s.leave_group'",
"%",
"self",
".",
"__class__",
".",
"__name__",
"if",
"not",
"'profile_edit'",
"in",
"self",
".",
"service_scop... | a method to remove group from meetup member profile | [
"a",
"method",
"to",
"remove",
"group",
"from",
"meetup",
"member",
"profile"
] | [
"''' a method to remove group from meetup member profile\r\n\r\n :param group_url: string with meetup urlname for group\r\n :param member_id: integer with member id from member profile\r\n :param exit_comment: string with comment to leave with organizer\r\n :return: dictionary with code ... | [
{
"param": "self",
"type": null
},
{
"param": "group_url",
"type": null
},
{
"param": "member_id",
"type": null
},
{
"param": "exit_comment",
"type": null
}
] | {
"returns": [
{
"docstring": "dictionary with code 204 on success",
"docstring_tokens": [
"dictionary",
"with",
"code",
"204",
"on",
"success"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "self",
"... |
2ee3cc36af42df8972735fb2f9da0e6e5ee742b2 | collectiveacuity/labPack | labpack/events/meetup.py | [
"MIT"
] | Python | join_topics | <not_specific> | def join_topics(self, member_id, topics):
''' a method to add topics to member profile details on meetup
:param member_id: integer with member id from member profile
:param topics: list of integer meetup ids for topics
:return: dictionary with list of topic details inside [json] ... | a method to add topics to member profile details on meetup
:param member_id: integer with member id from member profile
:param topics: list of integer meetup ids for topics
:return: dictionary with list of topic details inside [json] key
topic_details = self.objects.topic.schema... | a method to add topics to member profile details on meetup | [
"a",
"method",
"to",
"add",
"topics",
"to",
"member",
"profile",
"details",
"on",
"meetup"
] | def join_topics(self, member_id, topics):
title = '%s.join_topics' % self.__class__.__name__
if not 'profile_edit' in self.service_scope:
raise ValueError('%s requires group_join as part of oauth2 service_scope permissions.' % title)
input_fields = {
'member_id': member_i... | [
"def",
"join_topics",
"(",
"self",
",",
"member_id",
",",
"topics",
")",
":",
"title",
"=",
"'%s.join_topics'",
"%",
"self",
".",
"__class__",
".",
"__name__",
"if",
"not",
"'profile_edit'",
"in",
"self",
".",
"service_scope",
":",
"raise",
"ValueError",
"("... | a method to add topics to member profile details on meetup | [
"a",
"method",
"to",
"add",
"topics",
"to",
"member",
"profile",
"details",
"on",
"meetup"
] | [
"''' a method to add topics to member profile details on meetup\r\n\r\n :param member_id: integer with member id from member profile\r\n :param topics: list of integer meetup ids for topics\r\n :return: dictionary with list of topic details inside [json] key\r\n\r\n topic_details = self.... | [
{
"param": "self",
"type": null
},
{
"param": "member_id",
"type": null
},
{
"param": "topics",
"type": null
}
] | {
"returns": [
{
"docstring": "dictionary with list of topic details inside [json] key\ntopic_details = self.objects.topic.schema",
"docstring_tokens": [
"dictionary",
"with",
"list",
"of",
"topic",
"details",
"inside",
"[",
"json... |
2ee3cc36af42df8972735fb2f9da0e6e5ee742b2 | collectiveacuity/labPack | labpack/events/meetup.py | [
"MIT"
] | Python | leave_topics | <not_specific> | def leave_topics(self, member_id, topics):
''' a method to remove topics from member profile details on meetup
:param member_id: integer with member id from member profile
:param topics: list of integer meetup ids for topics
:return: dictionary with list of topic details inside [... | a method to remove topics from member profile details on meetup
:param member_id: integer with member id from member profile
:param topics: list of integer meetup ids for topics
:return: dictionary with list of topic details inside [json] key
topic_details = self.objects.topic.s... | a method to remove topics from member profile details on meetup | [
"a",
"method",
"to",
"remove",
"topics",
"from",
"member",
"profile",
"details",
"on",
"meetup"
] | def leave_topics(self, member_id, topics):
title = '%s.leave_topics' % self.__class__.__name__
if not 'profile_edit' in self.service_scope:
raise ValueError('%s requires group_join as part of oauth2 service_scope permissions.' % title)
input_fields = {
'member_id': member... | [
"def",
"leave_topics",
"(",
"self",
",",
"member_id",
",",
"topics",
")",
":",
"title",
"=",
"'%s.leave_topics'",
"%",
"self",
".",
"__class__",
".",
"__name__",
"if",
"not",
"'profile_edit'",
"in",
"self",
".",
"service_scope",
":",
"raise",
"ValueError",
"... | a method to remove topics from member profile details on meetup | [
"a",
"method",
"to",
"remove",
"topics",
"from",
"member",
"profile",
"details",
"on",
"meetup"
] | [
"''' a method to remove topics from member profile details on meetup\r\n\r\n :param member_id: integer with member id from member profile\r\n :param topics: list of integer meetup ids for topics\r\n :return: dictionary with list of topic details inside [json] key\r\n\r\n topic_details = ... | [
{
"param": "self",
"type": null
},
{
"param": "member_id",
"type": null
},
{
"param": "topics",
"type": null
}
] | {
"returns": [
{
"docstring": "dictionary with list of topic details inside [json] key\ntopic_details = self.objects.topic.schema",
"docstring_tokens": [
"dictionary",
"with",
"list",
"of",
"topic",
"details",
"inside",
"[",
"json... |
2ee3cc36af42df8972735fb2f9da0e6e5ee742b2 | collectiveacuity/labPack | labpack/events/meetup.py | [
"MIT"
] | Python | join_event | <not_specific> | def join_event(self, group_url, event_id, additional_guests=0, attendance_answers=None, payment_service='', payment_code=''):
''' a method to create an rsvp for a meetup event
:param group_url: string with meetup urlname for group
:param event_id: integer with meetup id for event
... | a method to create an rsvp for a meetup event
:param group_url: string with meetup urlname for group
:param event_id: integer with meetup id for event
:param additional_guests: [optional] integer with number of additional guests
:param attendance_answers: [optional] list with id &... | a method to create an rsvp for a meetup event | [
"a",
"method",
"to",
"create",
"an",
"rsvp",
"for",
"a",
"meetup",
"event"
] | def join_event(self, group_url, event_id, additional_guests=0, attendance_answers=None, payment_service='', payment_code=''):
title = '%s.join_event' % self.__class__.__name__
if not 'rsvp' in self.service_scope:
raise ValueError('%s requires group_join as part of oauth2 service_scope permis... | [
"def",
"join_event",
"(",
"self",
",",
"group_url",
",",
"event_id",
",",
"additional_guests",
"=",
"0",
",",
"attendance_answers",
"=",
"None",
",",
"payment_service",
"=",
"''",
",",
"payment_code",
"=",
"''",
")",
":",
"title",
"=",
"'%s.join_event'",
"%"... | a method to create an rsvp for a meetup event | [
"a",
"method",
"to",
"create",
"an",
"rsvp",
"for",
"a",
"meetup",
"event"
] | [
"''' a method to create an rsvp for a meetup event\r\n\r\n :param group_url: string with meetup urlname for group\r\n :param event_id: integer with meetup id for event\r\n :param additional_guests: [optional] integer with number of additional guests\r\n :param attendance_answers: [option... | [
{
"param": "self",
"type": null
},
{
"param": "group_url",
"type": null
},
{
"param": "event_id",
"type": null
},
{
"param": "additional_guests",
"type": null
},
{
"param": "attendance_answers",
"type": null
},
{
"param": "payment_service",
"type":... | {
"returns": [
{
"docstring": "dictionary with attendee details inside [json] key\nattendee_details = self._reconstruct_attendee({})",
"docstring_tokens": [
"dictionary",
"with",
"attendee",
"details",
"inside",
"[",
"json",
"]",
... |
2ee3cc36af42df8972735fb2f9da0e6e5ee742b2 | collectiveacuity/labPack | labpack/events/meetup.py | [
"MIT"
] | Python | leave_event | <not_specific> | def leave_event(self, group_url, event_id):
''' a method to rescind an rsvp to a meetup event
:param group_url: string with meetup urlname for group
:param event_id: integer with meetup id for event
:return: dictionary with attendee details inside [json] key
attendee_d... | a method to rescind an rsvp to a meetup event
:param group_url: string with meetup urlname for group
:param event_id: integer with meetup id for event
:return: dictionary with attendee details inside [json] key
attendee_details = self._reconstruct_attendee({})
| a method to rescind an rsvp to a meetup event | [
"a",
"method",
"to",
"rescind",
"an",
"rsvp",
"to",
"a",
"meetup",
"event"
] | def leave_event(self, group_url, event_id):
title = '%s.leave_event' % self.__class__.__name__
if not 'rsvp' in self.service_scope:
raise ValueError('%s requires group_join as part of oauth2 service_scope permissions.' % title)
input_fields = {
'group_url': group_url,
... | [
"def",
"leave_event",
"(",
"self",
",",
"group_url",
",",
"event_id",
")",
":",
"title",
"=",
"'%s.leave_event'",
"%",
"self",
".",
"__class__",
".",
"__name__",
"if",
"not",
"'rsvp'",
"in",
"self",
".",
"service_scope",
":",
"raise",
"ValueError",
"(",
"'... | a method to rescind an rsvp to a meetup event | [
"a",
"method",
"to",
"rescind",
"an",
"rsvp",
"to",
"a",
"meetup",
"event"
] | [
"''' a method to rescind an rsvp to a meetup event\r\n\r\n :param group_url: string with meetup urlname for group\r\n :param event_id: integer with meetup id for event\r\n :return: dictionary with attendee details inside [json] key\r\n\r\n attendee_details = self._reconstruct_attendee({}... | [
{
"param": "self",
"type": null
},
{
"param": "group_url",
"type": null
},
{
"param": "event_id",
"type": null
}
] | {
"returns": [
{
"docstring": "dictionary with attendee details inside [json] key\nattendee_details = self._reconstruct_attendee({})",
"docstring_tokens": [
"dictionary",
"with",
"attendee",
"details",
"inside",
"[",
"json",
"]",
... |
59261d316fe01db71fdb9510ffb8fb8aca6fb68c | collectiveacuity/labPack | labpack/compilers/git.py | [
"MIT"
] | Python | merge_diff | <not_specific> | def merge_diff(target, source, output=''):
'''
a method to merge the non-conflicting diffs between two files
method retrieves the results from `git diff --no-index target source`
and adds to target the lines from additions found in source. diff
results which would subtra... |
a method to merge the non-conflicting diffs between two files
method retrieves the results from `git diff --no-index target source`
and adds to target the lines from additions found in source. diff
results which would subtract lines from target are ignored.
PLE... | a method to merge the non-conflicting diffs between two files
method retrieves the results from `git diff --no-index target source`
and adds to target the lines from additions found in source. diff
results which would subtract lines from target are ignored.
PLEASE NOTE: method makes no check to ensure that target, ... | [
"a",
"method",
"to",
"merge",
"the",
"non",
"-",
"conflicting",
"diffs",
"between",
"two",
"files",
"method",
"retrieves",
"the",
"results",
"from",
"`",
"git",
"diff",
"--",
"no",
"-",
"index",
"target",
"source",
"`",
"and",
"adds",
"to",
"target",
"th... | def merge_diff(target, source, output=''):
cmd = 'git --no-pager diff --no-index %s %s' % (target, source)
out = subprocess.run(cmd.split(' '), stderr=open(devnull, 'wb'), stdout=subprocess.PIPE)
diff = out.stdout.decode("utf-8")
text = open(target).read()
if not diff:
return text
head =... | [
"def",
"merge_diff",
"(",
"target",
",",
"source",
",",
"output",
"=",
"''",
")",
":",
"cmd",
"=",
"'git --no-pager diff --no-index %s %s'",
"%",
"(",
"target",
",",
"source",
")",
"out",
"=",
"subprocess",
".",
"run",
"(",
"cmd",
".",
"split",
"(",
"' '... | a method to merge the non-conflicting diffs between two files
method retrieves the results from `git diff --no-index target source`
and adds to target the lines from additions found in source. | [
"a",
"method",
"to",
"merge",
"the",
"non",
"-",
"conflicting",
"diffs",
"between",
"two",
"files",
"method",
"retrieves",
"the",
"results",
"from",
"`",
"git",
"diff",
"--",
"no",
"-",
"index",
"target",
"source",
"`",
"and",
"adds",
"to",
"target",
"th... | [
"'''\n a method to merge the non-conflicting diffs between two files\n \n method retrieves the results from `git diff --no-index target source`\n and adds to target the lines from additions found in source. diff\n results which would subtract lines from target are ignored.\n ... | [
{
"param": "target",
"type": null
},
{
"param": "source",
"type": null
},
{
"param": "output",
"type": null
}
] | {
"returns": [
{
"docstring": "string with merged diff data",
"docstring_tokens": [
"string",
"with",
"merged",
"diff",
"data"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "target",
"type": null,
"doc... |
3700f2960f5627066420a1220c67286c55dda7d1 | collectiveacuity/labPack | labpack/storage/appdata.py | [
"MIT"
] | Python | _delete | null | def _delete(self, _file_path, _method_title, _record_key):
'''
a helper method for non-blocking deletion of files
:param _file_path: string with path to file to remove
:param _method_title: string with name of method calling _delete
:param _record_key: s... |
a helper method for non-blocking deletion of files
:param _file_path: string with path to file to remove
:param _method_title: string with name of method calling _delete
:param _record_key: string with name of record key to delete
:return: None
| a helper method for non-blocking deletion of files | [
"a",
"helper",
"method",
"for",
"non",
"-",
"blocking",
"deletion",
"of",
"files"
] | def _delete(self, _file_path, _method_title, _record_key):
import os
from time import sleep
current_dir = os.path.split(_file_path)[0]
count = 0
retry_count = 10
while True:
try:
os.remove(_file_path)
while current_dir != self.c... | [
"def",
"_delete",
"(",
"self",
",",
"_file_path",
",",
"_method_title",
",",
"_record_key",
")",
":",
"import",
"os",
"from",
"time",
"import",
"sleep",
"current_dir",
"=",
"os",
".",
"path",
".",
"split",
"(",
"_file_path",
")",
"[",
"0",
"]",
"count",
... | a helper method for non-blocking deletion of files | [
"a",
"helper",
"method",
"for",
"non",
"-",
"blocking",
"deletion",
"of",
"files"
] | [
"'''\r\n a helper method for non-blocking deletion of files\r\n \r\n :param _file_path: string with path to file to remove \r\n :param _method_title: string with name of method calling _delete\r\n :param _record_key: string with name of record key to delete\r\n :ret... | [
{
"param": "self",
"type": null
},
{
"param": "_file_path",
"type": null
},
{
"param": "_method_title",
"type": null
},
{
"param": "_record_key",
"type": null
}
] | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
... |
3700f2960f5627066420a1220c67286c55dda7d1 | collectiveacuity/labPack | labpack/storage/appdata.py | [
"MIT"
] | Python | _import | <not_specific> | def _import(self, record_key, record_data, overwrite=True, last_modified=0.0, **kwargs):
'''
a helper method for other storage clients to import into appdata
:param record_key: string with key for record
:param record_data: byte data for body of record
... |
a helper method for other storage clients to import into appdata
:param record_key: string with key for record
:param record_data: byte data for body of record
:param overwrite: [optional] boolean to overwrite existing records
:param last_modified: [option... | a helper method for other storage clients to import into appdata | [
"a",
"helper",
"method",
"for",
"other",
"storage",
"clients",
"to",
"import",
"into",
"appdata"
] | def _import(self, record_key, record_data, overwrite=True, last_modified=0.0, **kwargs):
file_path = os.path.join(self.collection_folder, record_key)
from os import path, makedirs
if not overwrite:
if path.exists(file_path):
return False
file_root, file_name =... | [
"def",
"_import",
"(",
"self",
",",
"record_key",
",",
"record_data",
",",
"overwrite",
"=",
"True",
",",
"last_modified",
"=",
"0.0",
",",
"**",
"kwargs",
")",
":",
"file_path",
"=",
"os",
".",
"path",
".",
"join",
"(",
"self",
".",
"collection_folder",... | a helper method for other storage clients to import into appdata | [
"a",
"helper",
"method",
"for",
"other",
"storage",
"clients",
"to",
"import",
"into",
"appdata"
] | [
"'''\r\n a helper method for other storage clients to import into appdata\r\n \r\n :param record_key: string with key for record\r\n :param record_data: byte data for body of record\r\n :param overwrite: [optional] boolean to overwrite existing records\r\n :param la... | [
{
"param": "self",
"type": null
},
{
"param": "record_key",
"type": null
},
{
"param": "record_data",
"type": null
},
{
"param": "overwrite",
"type": null
},
{
"param": "last_modified",
"type": null
}
] | {
"returns": [
{
"docstring": "boolean indicating whether record was imported",
"docstring_tokens": [
"boolean",
"indicating",
"whether",
"record",
"was",
"imported"
],
"type": null
}
],
"raises": [],
"params": [
{
"identi... |
3700f2960f5627066420a1220c67286c55dda7d1 | collectiveacuity/labPack | labpack/storage/appdata.py | [
"MIT"
] | Python | exists | <not_specific> | def exists(self, record_key):
'''
a method to determine if a record exists in collection
:param record_key: string with key of record
:return: boolean reporting status
'''
title = '%s.exists' % self.__class__.__name__
# validate... |
a method to determine if a record exists in collection
:param record_key: string with key of record
:return: boolean reporting status
| a method to determine if a record exists in collection | [
"a",
"method",
"to",
"determine",
"if",
"a",
"record",
"exists",
"in",
"collection"
] | def exists(self, record_key):
title = '%s.exists' % self.__class__.__name__
input_fields = {
'record_key': record_key
}
for key, value in input_fields.items():
object_title = '%s(%s=%s)' % (title, key, str(value))
self.fields.validate(value, '.%s' % ke... | [
"def",
"exists",
"(",
"self",
",",
"record_key",
")",
":",
"title",
"=",
"'%s.exists'",
"%",
"self",
".",
"__class__",
".",
"__name__",
"input_fields",
"=",
"{",
"'record_key'",
":",
"record_key",
"}",
"for",
"key",
",",
"value",
"in",
"input_fields",
".",... | a method to determine if a record exists in collection | [
"a",
"method",
"to",
"determine",
"if",
"a",
"record",
"exists",
"in",
"collection"
] | [
"''' \r\n a method to determine if a record exists in collection\r\n\r\n :param record_key: string with key of record\r\n :return: boolean reporting status\r\n '''",
"# validate inputs\r",
"# construct path to file\r",
"# validate existence of file\r"
] | [
{
"param": "self",
"type": null
},
{
"param": "record_key",
"type": null
}
] | {
"returns": [
{
"docstring": "boolean reporting status",
"docstring_tokens": [
"boolean",
"reporting",
"status"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_... |
3700f2960f5627066420a1220c67286c55dda7d1 | collectiveacuity/labPack | labpack/storage/appdata.py | [
"MIT"
] | Python | save | <not_specific> | def save(self, record_key, record_data, overwrite=True, secret_key=''):
'''
a method to create a record in the collection folder
:param record_key: string with name to assign to record (see NOTES below)
:param record_data: byte data for record body
:param overwrite:... |
a method to create a record in the collection folder
:param record_key: string with name to assign to record (see NOTES below)
:param record_data: byte data for record body
:param overwrite: [optional] boolean to overwrite records with same name
:param secret_key: [o... | a method to create a record in the collection folder | [
"a",
"method",
"to",
"create",
"a",
"record",
"in",
"the",
"collection",
"folder"
] | def save(self, record_key, record_data, overwrite=True, secret_key=''):
title = '%s.save' % self.__class__.__name__
input_fields = {
'record_key': record_key,
'secret_key': secret_key
}
for key, value in input_fields.items():
if value:
... | [
"def",
"save",
"(",
"self",
",",
"record_key",
",",
"record_data",
",",
"overwrite",
"=",
"True",
",",
"secret_key",
"=",
"''",
")",
":",
"title",
"=",
"'%s.save'",
"%",
"self",
".",
"__class__",
".",
"__name__",
"input_fields",
"=",
"{",
"'record_key'",
... | a method to create a record in the collection folder | [
"a",
"method",
"to",
"create",
"a",
"record",
"in",
"the",
"collection",
"folder"
] | [
"''' \r\n a method to create a record in the collection folder\r\n\r\n :param record_key: string with name to assign to record (see NOTES below)\r\n :param record_data: byte data for record body\r\n :param overwrite: [optional] boolean to overwrite records with same name\r\n :... | [
{
"param": "self",
"type": null
},
{
"param": "record_key",
"type": null
},
{
"param": "record_data",
"type": null
},
{
"param": "overwrite",
"type": null
},
{
"param": "secret_key",
"type": null
}
] | {
"returns": [
{
"docstring": "string with name of record\nNOTE: record_key may only contain alphanumeric, /, _, . or\ncharacters and may not begin with the . or / character.\n\nusing one or more / characters splits the key into\nseparate segments. these segments will appear as a\nsub directories inside t... |
3700f2960f5627066420a1220c67286c55dda7d1 | collectiveacuity/labPack | labpack/storage/appdata.py | [
"MIT"
] | Python | load | <not_specific> | def load(self, record_key, secret_key=''):
'''
a method to retrieve byte data of appdata record
:param record_key: string with name of record
:param secret_key: [optional] string used to decrypt data
:return: byte data for record body
'''
title =... |
a method to retrieve byte data of appdata record
:param record_key: string with name of record
:param secret_key: [optional] string used to decrypt data
:return: byte data for record body
| a method to retrieve byte data of appdata record | [
"a",
"method",
"to",
"retrieve",
"byte",
"data",
"of",
"appdata",
"record"
] | def load(self, record_key, secret_key=''):
title = '%s.load' % self.__class__.__name__
input_fields = {
'record_key': record_key,
'secret_key': secret_key
}
for key, value in input_fields.items():
if value:
object_title = '%s(%s=%s)' % ... | [
"def",
"load",
"(",
"self",
",",
"record_key",
",",
"secret_key",
"=",
"''",
")",
":",
"title",
"=",
"'%s.load'",
"%",
"self",
".",
"__class__",
".",
"__name__",
"input_fields",
"=",
"{",
"'record_key'",
":",
"record_key",
",",
"'secret_key'",
":",
"secret... | a method to retrieve byte data of appdata record | [
"a",
"method",
"to",
"retrieve",
"byte",
"data",
"of",
"appdata",
"record"
] | [
"''' \r\n a method to retrieve byte data of appdata record\r\n\r\n :param record_key: string with name of record\r\n :param secret_key: [optional] string used to decrypt data\r\n :return: byte data for record body\r\n '''",
"# validate inputs\r",
"# construct path to file\... | [
{
"param": "self",
"type": null
},
{
"param": "record_key",
"type": null
},
{
"param": "secret_key",
"type": null
}
] | {
"returns": [
{
"docstring": "byte data for record body",
"docstring_tokens": [
"byte",
"data",
"for",
"record",
"body"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring":... |
3700f2960f5627066420a1220c67286c55dda7d1 | collectiveacuity/labPack | labpack/storage/appdata.py | [
"MIT"
] | Python | conditional_filter | <not_specific> | def conditional_filter(self, path_filters):
''' a method to construct a conditional filter function for class list method
:param path_filters: dictionary or list of dictionaries with query criteria
:return: filter_function object
path_filters:
[ { 0: { conditional oper... | a method to construct a conditional filter function for class list method
:param path_filters: dictionary or list of dictionaries with query criteria
:return: filter_function object
path_filters:
[ { 0: { conditional operators }, 1: { conditional_operators }, ... } ]
... | a method to construct a conditional filter function for class list method | [
"a",
"method",
"to",
"construct",
"a",
"conditional",
"filter",
"function",
"for",
"class",
"list",
"method"
] | def conditional_filter(self, path_filters):
title = '%s.conditional_filter' % self.__class__.__name__
from labpack.compilers.filters import positional_filter
filter_function = positional_filter(path_filters, title)
return filter_function | [
"def",
"conditional_filter",
"(",
"self",
",",
"path_filters",
")",
":",
"title",
"=",
"'%s.conditional_filter'",
"%",
"self",
".",
"__class__",
".",
"__name__",
"from",
"labpack",
".",
"compilers",
".",
"filters",
"import",
"positional_filter",
"filter_function",
... | a method to construct a conditional filter function for class list method | [
"a",
"method",
"to",
"construct",
"a",
"conditional",
"filter",
"function",
"for",
"class",
"list",
"method"
] | [
"''' a method to construct a conditional filter function for class list method\r\n\r\n :param path_filters: dictionary or list of dictionaries with query criteria\r\n :return: filter_function object\r\n\r\n path_filters:\r\n [ { 0: { conditional operators }, 1: { conditional_operators },... | [
{
"param": "self",
"type": null
},
{
"param": "path_filters",
"type": null
}
] | {
"returns": [
{
"docstring": "filter_function object\npath_filters:\n[ { 0: { conditional operators }, 1: { conditional_operators }, ...\n\n",
"docstring_tokens": [
"filter_function",
"object",
"path_filters",
":",
"[",
"{",
"0",
":",
... |
3700f2960f5627066420a1220c67286c55dda7d1 | collectiveacuity/labPack | labpack/storage/appdata.py | [
"MIT"
] | Python | list | <not_specific> | def list(self, prefix='', delimiter='', filter_function=None, max_results=1, reverse_search=True, previous_key=''):
'''
a method to list keys in the collection
:param prefix: string with prefix value to filter results
:param delimiter: string with value which results must no... |
a method to list keys in the collection
:param prefix: string with prefix value to filter results
:param delimiter: string with value which results must not contain (after prefix)
:param filter_function: (positional arguments) function used to filter results
:param m... | a method to list keys in the collection | [
"a",
"method",
"to",
"list",
"keys",
"in",
"the",
"collection"
] | def list(self, prefix='', delimiter='', filter_function=None, max_results=1, reverse_search=True, previous_key=''):
title = '%s.list' % self.__class__.__name__
input_fields = {
'prefix': prefix,
'delimiter': delimiter,
'max_results': max_results,
'record_k... | [
"def",
"list",
"(",
"self",
",",
"prefix",
"=",
"''",
",",
"delimiter",
"=",
"''",
",",
"filter_function",
"=",
"None",
",",
"max_results",
"=",
"1",
",",
"reverse_search",
"=",
"True",
",",
"previous_key",
"=",
"''",
")",
":",
"title",
"=",
"'%s.list'... | a method to list keys in the collection | [
"a",
"method",
"to",
"list",
"keys",
"in",
"the",
"collection"
] | [
"''' \r\n a method to list keys in the collection\r\n\r\n :param prefix: string with prefix value to filter results\r\n :param delimiter: string with value which results must not contain (after prefix)\r\n :param filter_function: (positional arguments) function used to filter results... | [
{
"param": "self",
"type": null
},
{
"param": "prefix",
"type": null
},
{
"param": "delimiter",
"type": null
},
{
"param": "filter_function",
"type": null
},
{
"param": "max_results",
"type": null
},
{
"param": "reverse_search",
"type": null
},
... | {
"returns": [
{
"docstring": "list of key strings\nNOTE: each key string can be divided into one or more segments\nbased upon the / characters which occur in the key string as\nwell as its file extension type. if the key string represents\na file path, then each directory in the path, the file name\nand ... |
3700f2960f5627066420a1220c67286c55dda7d1 | collectiveacuity/labPack | labpack/storage/appdata.py | [
"MIT"
] | Python | delete | <not_specific> | def delete(self, record_key):
''' a method to delete a file
:param record_key: string with name of file
:return: string reporting outcome
'''
title = '%s.delete' % self.__class__.__name__
key_arg = '%s(record_key="%s")' % (title, record_key)
# validate ... | a method to delete a file
:param record_key: string with name of file
:return: string reporting outcome
| a method to delete a file | [
"a",
"method",
"to",
"delete",
"a",
"file"
] | def delete(self, record_key):
title = '%s.delete' % self.__class__.__name__
key_arg = '%s(record_key="%s")' % (title, record_key)
record_key = self.fields.validate(record_key, '.record_key')
file_path = os.path.join(self.collection_folder, record_key)
if not os.path.exists(file_p... | [
"def",
"delete",
"(",
"self",
",",
"record_key",
")",
":",
"title",
"=",
"'%s.delete'",
"%",
"self",
".",
"__class__",
".",
"__name__",
"key_arg",
"=",
"'%s(record_key=\"%s\")'",
"%",
"(",
"title",
",",
"record_key",
")",
"record_key",
"=",
"self",
".",
"f... | a method to delete a file | [
"a",
"method",
"to",
"delete",
"a",
"file"
] | [
"''' a method to delete a file\r\n\r\n :param record_key: string with name of file\r\n :return: string reporting outcome\r\n '''",
"# validate inputs\r",
"# construct path to file\r",
"# validate existence of file\r",
"# delete file asynchronously\r",
"# if non_blocking:\r",
"# ... | [
{
"param": "self",
"type": null
},
{
"param": "record_key",
"type": null
}
] | {
"returns": [
{
"docstring": "string reporting outcome",
"docstring_tokens": [
"string",
"reporting",
"outcome"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_... |
3700f2960f5627066420a1220c67286c55dda7d1 | collectiveacuity/labPack | labpack/storage/appdata.py | [
"MIT"
] | Python | remove | <not_specific> | def remove(self):
'''
a method to remove collection and all records in the collection
:return: string with confirmation of deletion
'''
_title = '%s.remove' % self.__class__.__name__
# TODO error handling is turned off to avoid system blocking
# ... |
a method to remove collection and all records in the collection
:return: string with confirmation of deletion
| a method to remove collection and all records in the collection | [
"a",
"method",
"to",
"remove",
"collection",
"and",
"all",
"records",
"in",
"the",
"collection"
] | def remove(self):
_title = '%s.remove' % self.__class__.__name__
try:
import shutil
shutil.rmtree(self.collection_folder, ignore_errors=True)
except:
raise Exception('%s failed to remove %s collection from app data.' % (_title, self.collection_folder))
... | [
"def",
"remove",
"(",
"self",
")",
":",
"_title",
"=",
"'%s.remove'",
"%",
"self",
".",
"__class__",
".",
"__name__",
"try",
":",
"import",
"shutil",
"shutil",
".",
"rmtree",
"(",
"self",
".",
"collection_folder",
",",
"ignore_errors",
"=",
"True",
")",
... | a method to remove collection and all records in the collection | [
"a",
"method",
"to",
"remove",
"collection",
"and",
"all",
"records",
"in",
"the",
"collection"
] | [
"''' \r\n a method to remove collection and all records in the collection\r\n\r\n :return: string with confirmation of deletion\r\n '''",
"# TODO error handling is turned off to avoid system blocking\r",
"# fix potential to create artifacts in the system\r",
"# remove collectio... | [
{
"param": "self",
"type": null
}
] | {
"returns": [
{
"docstring": "string with confirmation of deletion",
"docstring_tokens": [
"string",
"with",
"confirmation",
"of",
"deletion"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "self",
"type": nu... |
3700f2960f5627066420a1220c67286c55dda7d1 | collectiveacuity/labPack | labpack/storage/appdata.py | [
"MIT"
] | Python | export | <not_specific> | def export(self, storage_client, overwrite=True):
'''
a method to export all the records in collection to another platform
:param storage_client: class object with storage client methods
:return: string with exit message
'''
tit... |
a method to export all the records in collection to another platform
:param storage_client: class object with storage client methods
:return: string with exit message
| a method to export all the records in collection to another platform | [
"a",
"method",
"to",
"export",
"all",
"the",
"records",
"in",
"collection",
"to",
"another",
"platform"
] | def export(self, storage_client, overwrite=True):
title = '%s.export' % self.__class__.__name__
method_list = [ 'save', 'load', 'list', 'export', 'delete', 'remove', '_import', 'collection_name' ]
for method in method_list:
if not getattr(storage_client, method, None):
... | [
"def",
"export",
"(",
"self",
",",
"storage_client",
",",
"overwrite",
"=",
"True",
")",
":",
"title",
"=",
"'%s.export'",
"%",
"self",
".",
"__class__",
".",
"__name__",
"method_list",
"=",
"[",
"'save'",
",",
"'load'",
",",
"'list'",
",",
"'export'",
"... | a method to export all the records in collection to another platform | [
"a",
"method",
"to",
"export",
"all",
"the",
"records",
"in",
"collection",
"to",
"another",
"platform"
] | [
"'''\r\n a method to export all the records in collection to another platform\r\n \r\n :param storage_client: class object with storage client methods\r\n :return: string with exit message\r\n '''",
"# validate storage client\r",
"# walk collection folder to find files... | [
{
"param": "self",
"type": null
},
{
"param": "storage_client",
"type": null
},
{
"param": "overwrite",
"type": null
}
] | {
"returns": [
{
"docstring": "string with exit message",
"docstring_tokens": [
"string",
"with",
"exit",
"message"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
... |
a2bc9f074bf70cf1eb8c34d8025263483aa3df1f | collectiveacuity/labPack | labpack/platforms/aws/r53.py | [
"MIT"
] | Python | list_zones | <not_specific> | def list_zones(self):
'''
a method to retrieve the list of hosted zones on AWS Route 53
:return: list of strings with hosted zone ids
'''
title = '%s.list_zones' % self.__class__.__name__
# request list of hosted zones
self.iam.printer('Querying AWS region... |
a method to retrieve the list of hosted zones on AWS Route 53
:return: list of strings with hosted zone ids
| a method to retrieve the list of hosted zones on AWS Route 53 | [
"a",
"method",
"to",
"retrieve",
"the",
"list",
"of",
"hosted",
"zones",
"on",
"AWS",
"Route",
"53"
] | def list_zones(self):
title = '%s.list_zones' % self.__class__.__name__
self.iam.printer('Querying AWS region %s for hosted zones.' % self.iam.region_name)
zone_list = []
try:
response = self.connection.list_hosted_zones()
except:
raise AWSConnectionError(... | [
"def",
"list_zones",
"(",
"self",
")",
":",
"title",
"=",
"'%s.list_zones'",
"%",
"self",
".",
"__class__",
".",
"__name__",
"self",
".",
"iam",
".",
"printer",
"(",
"'Querying AWS region %s for hosted zones.'",
"%",
"self",
".",
"iam",
".",
"region_name",
")"... | a method to retrieve the list of hosted zones on AWS Route 53 | [
"a",
"method",
"to",
"retrieve",
"the",
"list",
"of",
"hosted",
"zones",
"on",
"AWS",
"Route",
"53"
] | [
"'''\n a method to retrieve the list of hosted zones on AWS Route 53\n\n :return: list of strings with hosted zone ids\n '''",
"# request list of hosted zones",
"# populate list from response",
"# report results and return details"
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [
{
"docstring": "list of strings with hosted zone ids",
"docstring_tokens": [
"list",
"of",
"strings",
"with",
"hosted",
"zone",
"ids"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "s... |
a2bc9f074bf70cf1eb8c34d8025263483aa3df1f | collectiveacuity/labPack | labpack/platforms/aws/r53.py | [
"MIT"
] | Python | list_records | <not_specific> | def list_records(self, zone_id):
'''
method for listing records associated with a hosted zone
:param zone_id: string of hosted zone id on AWS
:return: list of dictionaries with record fields
'name': 'string',
'dnsName': 'string',
... |
method for listing records associated with a hosted zone
:param zone_id: string of hosted zone id on AWS
:return: list of dictionaries with record fields
'name': 'string',
'dnsName': 'string',
'evaluateTargetHealth': false,
'hostedZoneID... | method for listing records associated with a hosted zone | [
"method",
"for",
"listing",
"records",
"associated",
"with",
"a",
"hosted",
"zone"
] | def list_records(self, zone_id):
title = '%s.list_zones' % self.__class__.__name__
self.iam.printer('Querying AWS region %s for records of hosted zone %s.' % (self.iam.region_name, zone_id))
record_list = []
try:
response = self.connection.list_resource_record_sets(
... | [
"def",
"list_records",
"(",
"self",
",",
"zone_id",
")",
":",
"title",
"=",
"'%s.list_zones'",
"%",
"self",
".",
"__class__",
".",
"__name__",
"self",
".",
"iam",
".",
"printer",
"(",
"'Querying AWS region %s for records of hosted zone %s.'",
"%",
"(",
"self",
"... | method for listing records associated with a hosted zone | [
"method",
"for",
"listing",
"records",
"associated",
"with",
"a",
"hosted",
"zone"
] | [
"'''\n method for listing records associated with a hosted zone\n \n :param zone_id: string of hosted zone id on AWS\n :return: list of dictionaries with record fields\n \n 'name': 'string',\n 'dnsName': 'string',\n 'evaluateTargetHealth': false,\n ... | [
{
"param": "self",
"type": null
},
{
"param": "zone_id",
"type": null
}
] | {
"returns": [
{
"docstring": "list of dictionaries with record fields\n'name': 'string',\n'dnsName': 'string',\n'evaluateTargetHealth': false,\n'hostedZoneID': 'string'",
"docstring_tokens": [
"list",
"of",
"dictionaries",
"with",
"record",
"fields",
... |
7b8980cac9ca98689456257b631c29096c6e6330 | collectiveacuity/labPack | labpack/storage/dropbox.py | [
"MIT"
] | Python | _import | <not_specific> | def _import(self, record_key, record_data, overwrite=True, last_modified=0.0, **kwargs):
'''
a helper method for other storage clients to import into appdata
:param record_key: string with key for record
:param record_data: byte data for body of record
... |
a helper method for other storage clients to import into appdata
:param record_key: string with key for record
:param record_data: byte data for body of record
:param overwrite: [optional] boolean to overwrite existing records
:param last_modified: [option... | a helper method for other storage clients to import into appdata | [
"a",
"helper",
"method",
"for",
"other",
"storage",
"clients",
"to",
"import",
"into",
"appdata"
] | def _import(self, record_key, record_data, overwrite=True, last_modified=0.0, **kwargs):
title = '%s._import' % self.__class__.__name__
if not overwrite:
if self.exists(record_key):
return False
import sys
record_max = self.fields.metadata['record_max_bytes']
... | [
"def",
"_import",
"(",
"self",
",",
"record_key",
",",
"record_data",
",",
"overwrite",
"=",
"True",
",",
"last_modified",
"=",
"0.0",
",",
"**",
"kwargs",
")",
":",
"title",
"=",
"'%s._import'",
"%",
"self",
".",
"__class__",
".",
"__name__",
"if",
"not... | a helper method for other storage clients to import into appdata | [
"a",
"helper",
"method",
"for",
"other",
"storage",
"clients",
"to",
"import",
"into",
"appdata"
] | [
"'''\r\n a helper method for other storage clients to import into appdata\r\n \r\n :param record_key: string with key for record\r\n :param record_data: byte data for body of record\r\n :param overwrite: [optional] boolean to overwrite existing records\r\n :param la... | [
{
"param": "self",
"type": null
},
{
"param": "record_key",
"type": null
},
{
"param": "record_data",
"type": null
},
{
"param": "overwrite",
"type": null
},
{
"param": "last_modified",
"type": null
}
] | {
"returns": [
{
"docstring": "boolean indicating whether record was imported",
"docstring_tokens": [
"boolean",
"indicating",
"whether",
"record",
"was",
"imported"
],
"type": null
}
],
"raises": [],
"params": [
{
"identi... |
7b8980cac9ca98689456257b631c29096c6e6330 | collectiveacuity/labPack | labpack/storage/dropbox.py | [
"MIT"
] | Python | _walk | null | def _walk(self, root_path=''):
''' an iterator method which walks the file structure of the dropbox collection '''
title = '%s._walk' % self.__class__.__name__
if root_path:
root_path = '/%s' % root_path
try:
response = self.dropbox.files_list_folder(path=ro... | an iterator method which walks the file structure of the dropbox collection | an iterator method which walks the file structure of the dropbox collection | [
"an",
"iterator",
"method",
"which",
"walks",
"the",
"file",
"structure",
"of",
"the",
"dropbox",
"collection"
] | def _walk(self, root_path=''):
title = '%s._walk' % self.__class__.__name__
if root_path:
root_path = '/%s' % root_path
try:
response = self.dropbox.files_list_folder(path=root_path, recursive=True)
for record in response.entries:
if not isinst... | [
"def",
"_walk",
"(",
"self",
",",
"root_path",
"=",
"''",
")",
":",
"title",
"=",
"'%s._walk'",
"%",
"self",
".",
"__class__",
".",
"__name__",
"if",
"root_path",
":",
"root_path",
"=",
"'/%s'",
"%",
"root_path",
"try",
":",
"response",
"=",
"self",
".... | an iterator method which walks the file structure of the dropbox collection | [
"an",
"iterator",
"method",
"which",
"walks",
"the",
"file",
"structure",
"of",
"the",
"dropbox",
"collection"
] | [
"''' an iterator method which walks the file structure of the dropbox collection '''"
] | [
{
"param": "self",
"type": null
},
{
"param": "root_path",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "root_path",
"type": null,
"docstring": null,
"docstring_token... |
7b8980cac9ca98689456257b631c29096c6e6330 | collectiveacuity/labPack | labpack/storage/dropbox.py | [
"MIT"
] | Python | exists | <not_specific> | def exists(self, record_key):
'''
a method to determine if a record exists in collection
:param record_key: string with key of record
:return: boolean reporting status
'''
title = '%s.exists' % self.__class__.__name__
# validate... |
a method to determine if a record exists in collection
:param record_key: string with key of record
:return: boolean reporting status
| a method to determine if a record exists in collection | [
"a",
"method",
"to",
"determine",
"if",
"a",
"record",
"exists",
"in",
"collection"
] | def exists(self, record_key):
title = '%s.exists' % self.__class__.__name__
input_fields = {
'record_key': record_key
}
for key, value in input_fields.items():
object_title = '%s(%s=%s)' % (title, key, str(value))
self.fields.validate(value, '.%s' % ke... | [
"def",
"exists",
"(",
"self",
",",
"record_key",
")",
":",
"title",
"=",
"'%s.exists'",
"%",
"self",
".",
"__class__",
".",
"__name__",
"input_fields",
"=",
"{",
"'record_key'",
":",
"record_key",
"}",
"for",
"key",
",",
"value",
"in",
"input_fields",
".",... | a method to determine if a record exists in collection | [
"a",
"method",
"to",
"determine",
"if",
"a",
"record",
"exists",
"in",
"collection"
] | [
"''' \r\n a method to determine if a record exists in collection\r\n\r\n :param record_key: string with key of record\r\n :return: boolean reporting status\r\n '''",
"# validate inputs\r",
"# send get metadata request\r"
] | [
{
"param": "self",
"type": null
},
{
"param": "record_key",
"type": null
}
] | {
"returns": [
{
"docstring": "boolean reporting status",
"docstring_tokens": [
"boolean",
"reporting",
"status"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_... |
7b8980cac9ca98689456257b631c29096c6e6330 | collectiveacuity/labPack | labpack/storage/dropbox.py | [
"MIT"
] | Python | save | <not_specific> | def save(self, record_key, record_data, overwrite=True, secret_key=''):
'''
a method to create a record in the collection folder
:param record_key: string with name to assign to record (see NOTES below)
:param record_data: byte data for record body
:param overwrite:... |
a method to create a record in the collection folder
:param record_key: string with name to assign to record (see NOTES below)
:param record_data: byte data for record body
:param overwrite: [optional] boolean to overwrite records with same name
:param secret_key: [o... | a method to create a record in the collection folder | [
"a",
"method",
"to",
"create",
"a",
"record",
"in",
"the",
"collection",
"folder"
] | def save(self, record_key, record_data, overwrite=True, secret_key=''):
title = '%s.save' % self.__class__.__name__
input_fields = {
'record_key': record_key,
'secret_key': secret_key
}
for key, value in input_fields.items():
if value:
... | [
"def",
"save",
"(",
"self",
",",
"record_key",
",",
"record_data",
",",
"overwrite",
"=",
"True",
",",
"secret_key",
"=",
"''",
")",
":",
"title",
"=",
"'%s.save'",
"%",
"self",
".",
"__class__",
".",
"__name__",
"input_fields",
"=",
"{",
"'record_key'",
... | a method to create a record in the collection folder | [
"a",
"method",
"to",
"create",
"a",
"record",
"in",
"the",
"collection",
"folder"
] | [
"''' \r\n a method to create a record in the collection folder\r\n\r\n :param record_key: string with name to assign to record (see NOTES below)\r\n :param record_data: byte data for record body\r\n :param overwrite: [optional] boolean to overwrite records with same name\r\n :... | [
{
"param": "self",
"type": null
},
{
"param": "record_key",
"type": null
},
{
"param": "record_data",
"type": null
},
{
"param": "overwrite",
"type": null
},
{
"param": "secret_key",
"type": null
}
] | {
"returns": [
{
"docstring": "string with name of record\nNOTE: record_key may only contain alphanumeric, /, _, . or\ncharacters and may not begin with the . or / character.\n\nusing one or more / characters splits the key into\nseparate segments. these segments will appear as a\nsub directories inside t... |
7b8980cac9ca98689456257b631c29096c6e6330 | collectiveacuity/labPack | labpack/storage/dropbox.py | [
"MIT"
] | Python | load | <not_specific> | def load(self, record_key, secret_key=''):
'''
a method to retrieve byte data of appdata record
:param record_key: string with name of record
:param secret_key: [optional] string used to decrypt data
:return: byte data for record body
'''
title =... |
a method to retrieve byte data of appdata record
:param record_key: string with name of record
:param secret_key: [optional] string used to decrypt data
:return: byte data for record body
| a method to retrieve byte data of appdata record | [
"a",
"method",
"to",
"retrieve",
"byte",
"data",
"of",
"appdata",
"record"
] | def load(self, record_key, secret_key=''):
title = '%s.load' % self.__class__.__name__
input_fields = {
'record_key': record_key,
'secret_key': secret_key
}
for key, value in input_fields.items():
if value:
object_title = '%s(%s=%s)' % ... | [
"def",
"load",
"(",
"self",
",",
"record_key",
",",
"secret_key",
"=",
"''",
")",
":",
"title",
"=",
"'%s.load'",
"%",
"self",
".",
"__class__",
".",
"__name__",
"input_fields",
"=",
"{",
"'record_key'",
":",
"record_key",
",",
"'secret_key'",
":",
"secret... | a method to retrieve byte data of appdata record | [
"a",
"method",
"to",
"retrieve",
"byte",
"data",
"of",
"appdata",
"record"
] | [
"''' \r\n a method to retrieve byte data of appdata record\r\n\r\n :param record_key: string with name of record\r\n :param secret_key: [optional] string used to decrypt data\r\n :return: byte data for record body\r\n '''",
"# validate inputs\r",
"# construct file path\r",... | [
{
"param": "self",
"type": null
},
{
"param": "record_key",
"type": null
},
{
"param": "secret_key",
"type": null
}
] | {
"returns": [
{
"docstring": "byte data for record body",
"docstring_tokens": [
"byte",
"data",
"for",
"record",
"body"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring":... |
7b8980cac9ca98689456257b631c29096c6e6330 | collectiveacuity/labPack | labpack/storage/dropbox.py | [
"MIT"
] | Python | list | <not_specific> | def list(self, prefix='', delimiter='', filter_function=None, max_results=1, previous_key=''):
'''
a method to list keys in the dropbox collection
:param prefix: string with prefix value to filter results
:param delimiter: string with value which results must not con... |
a method to list keys in the dropbox collection
:param prefix: string with prefix value to filter results
:param delimiter: string with value which results must not contain (after prefix)
:param filter_function: (positional arguments) function used to filter results
... | a method to list keys in the dropbox collection | [
"a",
"method",
"to",
"list",
"keys",
"in",
"the",
"dropbox",
"collection"
] | def list(self, prefix='', delimiter='', filter_function=None, max_results=1, previous_key=''):
title = '%s.list' % self.__class__.__name__
input_fields = {
'prefix': prefix,
'delimiter': delimiter,
'max_results': max_results,
'previous_key': previous_key
... | [
"def",
"list",
"(",
"self",
",",
"prefix",
"=",
"''",
",",
"delimiter",
"=",
"''",
",",
"filter_function",
"=",
"None",
",",
"max_results",
"=",
"1",
",",
"previous_key",
"=",
"''",
")",
":",
"title",
"=",
"'%s.list'",
"%",
"self",
".",
"__class__",
... | a method to list keys in the dropbox collection | [
"a",
"method",
"to",
"list",
"keys",
"in",
"the",
"dropbox",
"collection"
] | [
"''' \r\n a method to list keys in the dropbox collection\r\n\r\n :param prefix: string with prefix value to filter results\r\n :param delimiter: string with value which results must not contain (after prefix)\r\n :param filter_function: (positional arguments) function used to filter... | [
{
"param": "self",
"type": null
},
{
"param": "prefix",
"type": null
},
{
"param": "delimiter",
"type": null
},
{
"param": "filter_function",
"type": null
},
{
"param": "max_results",
"type": null
},
{
"param": "previous_key",
"type": null
}
] | {
"returns": [
{
"docstring": "list of key strings\nNOTE: each key string can be divided into one or more segments\nbased upon the / characters which occur in the key string as\nwell as its file extension type. if the key string represents\na file path, then each directory in the path, the file name\nand ... |
7b8980cac9ca98689456257b631c29096c6e6330 | collectiveacuity/labPack | labpack/storage/dropbox.py | [
"MIT"
] | Python | delete | <not_specific> | def delete(self, record_key):
''' a method to delete a file
:param record_key: string with name of file
:return: string reporting outcome
'''
title = '%s.delete' % self.__class__.__name__
# validate inputs
input_fields = {
'record_key': rec... | a method to delete a file
:param record_key: string with name of file
:return: string reporting outcome
| a method to delete a file | [
"a",
"method",
"to",
"delete",
"a",
"file"
] | def delete(self, record_key):
title = '%s.delete' % self.__class__.__name__
input_fields = {
'record_key': record_key
}
for key, value in input_fields.items():
object_title = '%s(%s=%s)' % (title, key, str(value))
self.fields.validate(value, '.%s' % ke... | [
"def",
"delete",
"(",
"self",
",",
"record_key",
")",
":",
"title",
"=",
"'%s.delete'",
"%",
"self",
".",
"__class__",
".",
"__name__",
"input_fields",
"=",
"{",
"'record_key'",
":",
"record_key",
"}",
"for",
"key",
",",
"value",
"in",
"input_fields",
".",... | a method to delete a file | [
"a",
"method",
"to",
"delete",
"a",
"file"
] | [
"''' a method to delete a file\r\n\r\n :param record_key: string with name of file\r\n :return: string reporting outcome\r\n '''",
"# validate inputs\r",
"# validate existence of file\r",
"# remove file\r",
"# remove empty directories in path to file\r"
] | [
{
"param": "self",
"type": null
},
{
"param": "record_key",
"type": null
}
] | {
"returns": [
{
"docstring": "string reporting outcome",
"docstring_tokens": [
"string",
"reporting",
"outcome"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_... |
7b8980cac9ca98689456257b631c29096c6e6330 | collectiveacuity/labPack | labpack/storage/dropbox.py | [
"MIT"
] | Python | remove | <not_specific> | def remove(self):
'''
a method to remove all records in the collection
NOTE: this method removes all the files in the collection, but the
collection folder itself created by oauth2 cannot be removed.
only the user can remove the app folder
... |
a method to remove all records in the collection
NOTE: this method removes all the files in the collection, but the
collection folder itself created by oauth2 cannot be removed.
only the user can remove the app folder
:return: stri... | a method to remove all records in the collection
NOTE: this method removes all the files in the collection, but the
collection folder itself created by oauth2 cannot be removed.
only the user can remove the app folder | [
"a",
"method",
"to",
"remove",
"all",
"records",
"in",
"the",
"collection",
"NOTE",
":",
"this",
"method",
"removes",
"all",
"the",
"files",
"in",
"the",
"collection",
"but",
"the",
"collection",
"folder",
"itself",
"created",
"by",
"oauth2",
"cannot",
"be",... | def remove(self):
title = '%s.remove' % self.__class__.__name__
try:
response = self.dropbox.files_list_folder(path='')
except:
raise DropboxConnectionError(title)
delete_list = []
for file in response.entries:
delete_list.append(self.objects.D... | [
"def",
"remove",
"(",
"self",
")",
":",
"title",
"=",
"'%s.remove'",
"%",
"self",
".",
"__class__",
".",
"__name__",
"try",
":",
"response",
"=",
"self",
".",
"dropbox",
".",
"files_list_folder",
"(",
"path",
"=",
"''",
")",
"except",
":",
"raise",
"Dr... | a method to remove all records in the collection
NOTE: this method removes all the files in the collection, but the
collection folder itself created by oauth2 cannot be removed. | [
"a",
"method",
"to",
"remove",
"all",
"records",
"in",
"the",
"collection",
"NOTE",
":",
"this",
"method",
"removes",
"all",
"the",
"files",
"in",
"the",
"collection",
"but",
"the",
"collection",
"folder",
"itself",
"created",
"by",
"oauth2",
"cannot",
"be",... | [
"''' \r\n a method to remove all records in the collection\r\n\r\n NOTE: this method removes all the files in the collection, but the\r\n collection folder itself created by oauth2 cannot be removed.\r\n only the user can remove the app folder\r\n \r\... | [
{
"param": "self",
"type": null
}
] | {
"returns": [
{
"docstring": "string with confirmation of deletion",
"docstring_tokens": [
"string",
"with",
"confirmation",
"of",
"deletion"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "self",
"type": nu... |
7b8980cac9ca98689456257b631c29096c6e6330 | collectiveacuity/labPack | labpack/storage/dropbox.py | [
"MIT"
] | Python | export | <not_specific> | def export(self, storage_client, overwrite=True):
'''
a method to export all the records in collection to another platform
:param storage_client: class object with storage client methods
:return: string with exit message
'''
tit... |
a method to export all the records in collection to another platform
:param storage_client: class object with storage client methods
:return: string with exit message
| a method to export all the records in collection to another platform | [
"a",
"method",
"to",
"export",
"all",
"the",
"records",
"in",
"collection",
"to",
"another",
"platform"
] | def export(self, storage_client, overwrite=True):
title = '%s.export' % self.__class__.__name__
method_list = [ 'save', 'load', 'list', 'export', 'delete', 'remove', '_import', 'collection_name' ]
for method in method_list:
if not getattr(storage_client, method, None):
... | [
"def",
"export",
"(",
"self",
",",
"storage_client",
",",
"overwrite",
"=",
"True",
")",
":",
"title",
"=",
"'%s.export'",
"%",
"self",
".",
"__class__",
".",
"__name__",
"method_list",
"=",
"[",
"'save'",
",",
"'load'",
",",
"'list'",
",",
"'export'",
"... | a method to export all the records in collection to another platform | [
"a",
"method",
"to",
"export",
"all",
"the",
"records",
"in",
"collection",
"to",
"another",
"platform"
] | [
"'''\r\n a method to export all the records in collection to another platform\r\n \r\n :param storage_client: class object with storage client methods\r\n :return: string with exit message\r\n '''",
"# validate storage client\r",
"# walk collection folder to find files... | [
{
"param": "self",
"type": null
},
{
"param": "storage_client",
"type": null
},
{
"param": "overwrite",
"type": null
}
] | {
"returns": [
{
"docstring": "string with exit message",
"docstring_tokens": [
"string",
"with",
"exit",
"message"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
... |
69db4401221433391c2ac10cf2a961ce54157d05 | collectiveacuity/labPack | labpack/parsing/conversion.py | [
"MIT"
] | Python | _to_camelcase | <not_specific> | def _to_camelcase(input_string):
''' a helper method to convert python to camelcase'''
camel_string = ''
for i in range(len(input_string)):
if input_string[i] == '_':
pass
elif not camel_string:
camel_string += input_string[i].upper()
elif input_string[i-1] ==... | a helper method to convert python to camelcase | a helper method to convert python to camelcase | [
"a",
"helper",
"method",
"to",
"convert",
"python",
"to",
"camelcase"
] | def _to_camelcase(input_string):
camel_string = ''
for i in range(len(input_string)):
if input_string[i] == '_':
pass
elif not camel_string:
camel_string += input_string[i].upper()
elif input_string[i-1] == '_':
camel_string += input_string[i].upper()
... | [
"def",
"_to_camelcase",
"(",
"input_string",
")",
":",
"camel_string",
"=",
"''",
"for",
"i",
"in",
"range",
"(",
"len",
"(",
"input_string",
")",
")",
":",
"if",
"input_string",
"[",
"i",
"]",
"==",
"'_'",
":",
"pass",
"elif",
"not",
"camel_string",
"... | a helper method to convert python to camelcase | [
"a",
"helper",
"method",
"to",
"convert",
"python",
"to",
"camelcase"
] | [
"''' a helper method to convert python to camelcase'''"
] | [
{
"param": "input_string",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "input_string",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
69db4401221433391c2ac10cf2a961ce54157d05 | collectiveacuity/labPack | labpack/parsing/conversion.py | [
"MIT"
] | Python | _to_python | <not_specific> | def _to_python(input_string):
''' a helper method to convert camelcase to python'''
python_string = ''
for i in range(len(input_string)):
if not python_string:
python_string += input_string[i].lower()
elif input_string[i].isupper():
python_string += '_%s' % input_stri... | a helper method to convert camelcase to python | a helper method to convert camelcase to python | [
"a",
"helper",
"method",
"to",
"convert",
"camelcase",
"to",
"python"
] | def _to_python(input_string):
python_string = ''
for i in range(len(input_string)):
if not python_string:
python_string += input_string[i].lower()
elif input_string[i].isupper():
python_string += '_%s' % input_string[i].lower()
else:
python_string += i... | [
"def",
"_to_python",
"(",
"input_string",
")",
":",
"python_string",
"=",
"''",
"for",
"i",
"in",
"range",
"(",
"len",
"(",
"input_string",
")",
")",
":",
"if",
"not",
"python_string",
":",
"python_string",
"+=",
"input_string",
"[",
"i",
"]",
".",
"lowe... | a helper method to convert camelcase to python | [
"a",
"helper",
"method",
"to",
"convert",
"camelcase",
"to",
"python"
] | [
"''' a helper method to convert camelcase to python'''"
] | [
{
"param": "input_string",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "input_string",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
69db4401221433391c2ac10cf2a961ce54157d05 | collectiveacuity/labPack | labpack/parsing/conversion.py | [
"MIT"
] | Python | camelcase_to_lowercase | <not_specific> | def camelcase_to_lowercase(camelcase_input, python_input=None):
'''
a function to recursively convert data with camelcase key names into lowercase keys
:param camelcase_input: list or dictionary with camelcase keys
:param python_input: [optional] list or dictionary with default lower... |
a function to recursively convert data with camelcase key names into lowercase keys
:param camelcase_input: list or dictionary with camelcase keys
:param python_input: [optional] list or dictionary with default lowercase keys in output
:return: dictionary with lowercase key names
| a function to recursively convert data with camelcase key names into lowercase keys | [
"a",
"function",
"to",
"recursively",
"convert",
"data",
"with",
"camelcase",
"key",
"names",
"into",
"lowercase",
"keys"
] | def camelcase_to_lowercase(camelcase_input, python_input=None):
if python_input:
if camelcase_input.__class__ != python_input.__class__:
raise ValueError('python_input type %s does not match camelcase_input type %s' % (python_input.__class__, camelcase_input.__class__))
if isinstance(camelca... | [
"def",
"camelcase_to_lowercase",
"(",
"camelcase_input",
",",
"python_input",
"=",
"None",
")",
":",
"if",
"python_input",
":",
"if",
"camelcase_input",
".",
"__class__",
"!=",
"python_input",
".",
"__class__",
":",
"raise",
"ValueError",
"(",
"'python_input type %s... | a function to recursively convert data with camelcase key names into lowercase keys | [
"a",
"function",
"to",
"recursively",
"convert",
"data",
"with",
"camelcase",
"key",
"names",
"into",
"lowercase",
"keys"
] | [
"'''\n a function to recursively convert data with camelcase key names into lowercase keys \n \n :param camelcase_input: list or dictionary with camelcase keys \n :param python_input: [optional] list or dictionary with default lowercase keys in output\n :return: dictionary with lowercase key ... | [
{
"param": "camelcase_input",
"type": null
},
{
"param": "python_input",
"type": null
}
] | {
"returns": [
{
"docstring": "dictionary with lowercase key names",
"docstring_tokens": [
"dictionary",
"with",
"lowercase",
"key",
"names"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "camelcase_input",
"... |
69db4401221433391c2ac10cf2a961ce54157d05 | collectiveacuity/labPack | labpack/parsing/conversion.py | [
"MIT"
] | Python | lowercase_to_camelcase | <not_specific> | def lowercase_to_camelcase(python_input, camelcase_input=None):
'''
a function to recursively convert data with lowercase key names into camelcase keys
:param camelcase_input: list or dictionary with lowercase keys
:param python_input: [optional] list or dictionary with default camel... |
a function to recursively convert data with lowercase key names into camelcase keys
:param camelcase_input: list or dictionary with lowercase keys
:param python_input: [optional] list or dictionary with default camelcase keys in output
:return: dictionary with camelcase key names
| a function to recursively convert data with lowercase key names into camelcase keys | [
"a",
"function",
"to",
"recursively",
"convert",
"data",
"with",
"lowercase",
"key",
"names",
"into",
"camelcase",
"keys"
] | def lowercase_to_camelcase(python_input, camelcase_input=None):
if camelcase_input:
if python_input.__class__ != camelcase_input.__class__:
raise ValueError('camelcase_input type %s does not match python_input type %s' % (camelcase_input.__class__, python_input.__class__))
if isinstance(pyth... | [
"def",
"lowercase_to_camelcase",
"(",
"python_input",
",",
"camelcase_input",
"=",
"None",
")",
":",
"if",
"camelcase_input",
":",
"if",
"python_input",
".",
"__class__",
"!=",
"camelcase_input",
".",
"__class__",
":",
"raise",
"ValueError",
"(",
"'camelcase_input t... | a function to recursively convert data with lowercase key names into camelcase keys | [
"a",
"function",
"to",
"recursively",
"convert",
"data",
"with",
"lowercase",
"key",
"names",
"into",
"camelcase",
"keys"
] | [
"'''\n a function to recursively convert data with lowercase key names into camelcase keys \n \n :param camelcase_input: list or dictionary with lowercase keys \n :param python_input: [optional] list or dictionary with default camelcase keys in output\n :return: dictionary with camelcase key ... | [
{
"param": "python_input",
"type": null
},
{
"param": "camelcase_input",
"type": null
}
] | {
"returns": [
{
"docstring": "dictionary with camelcase key names",
"docstring_tokens": [
"dictionary",
"with",
"camelcase",
"key",
"names"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "python_input",
"typ... |
8d9d110f2d087a92fe0f1512da08c3f34b5bd4f9 | collectiveacuity/labPack | labpack/location/find.py | [
"MIT"
] | Python | update_model | <not_specific> | def update_model(self):
'''
a method to update model with latest training data
:return: True
'''
import requests
url = self.endpoint_public + '/calculate'
params = {
'group': self.group_name
}
respon... |
a method to update model with latest training data
:return: True
| a method to update model with latest training data | [
"a",
"method",
"to",
"update",
"model",
"with",
"latest",
"training",
"data"
] | def update_model(self):
import requests
url = self.endpoint_public + '/calculate'
params = {
'group': self.group_name
}
response = requests.get(url, params=params)
response_details = response.json()
return response_details['success'] | [
"def",
"update_model",
"(",
"self",
")",
":",
"import",
"requests",
"url",
"=",
"self",
".",
"endpoint_public",
"+",
"'/calculate'",
"params",
"=",
"{",
"'group'",
":",
"self",
".",
"group_name",
"}",
"response",
"=",
"requests",
".",
"get",
"(",
"url",
... | a method to update model with latest training data | [
"a",
"method",
"to",
"update",
"model",
"with",
"latest",
"training",
"data"
] | [
"'''\n a method to update model with latest training data\n \n :return: True\n '''"
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
... |
8d9d110f2d087a92fe0f1512da08c3f34b5bd4f9 | collectiveacuity/labPack | labpack/location/find.py | [
"MIT"
] | Python | update_positions | <not_specific> | def update_positions(self):
'''
a method to update the latest position of all users being tracked
:return: dictionary with user_id keys and location/time dictionary values
NOTE: self.players is updated with position details
{
'us... |
a method to update the latest position of all users being tracked
:return: dictionary with user_id keys and location/time dictionary values
NOTE: self.players is updated with position details
{
'user_id': {
'time': 0.0,
... | a method to update the latest position of all users being tracked | [
"a",
"method",
"to",
"update",
"the",
"latest",
"position",
"of",
"all",
"users",
"being",
"tracked"
] | def update_positions(self):
user_list = []
for key in self.positions.keys():
user_list.append(key)
if not user_list:
return self.positions
import requests
url = self.endpoint + '/location'
while user_list:
if len(user_list) > 50:
... | [
"def",
"update_positions",
"(",
"self",
")",
":",
"user_list",
"=",
"[",
"]",
"for",
"key",
"in",
"self",
".",
"positions",
".",
"keys",
"(",
")",
":",
"user_list",
".",
"append",
"(",
"key",
")",
"if",
"not",
"user_list",
":",
"return",
"self",
".",... | a method to update the latest position of all users being tracked | [
"a",
"method",
"to",
"update",
"the",
"latest",
"position",
"of",
"all",
"users",
"being",
"tracked"
] | [
"'''\n a method to update the latest position of all users being tracked \n \n :return: dictionary with user_id keys and location/time dictionary values\n \n NOTE: self.players is updated with position details\n \n {\n 'user_id': {\n ... | [
{
"param": "self",
"type": null
}
] | {
"returns": [
{
"docstring": "dictionary with user_id keys and location/time dictionary values\nNOTE: self.players is updated with position details\n\n",
"docstring_tokens": [
"dictionary",
"with",
"user_id",
"keys",
"and",
"location",
"/",
... |
8d9d110f2d087a92fe0f1512da08c3f34b5bd4f9 | collectiveacuity/labPack | labpack/location/find.py | [
"MIT"
] | Python | subscribe | null | def subscribe(self, callable=None, block=False, port=1883):
'''
a method to establish a mosquitto socket with server to receive position updates
:param callable: [optional] callable to process the received positions
:param block: [optional] boolean to block the main thr... |
a method to establish a mosquitto socket with server to receive position updates
:param callable: [optional] callable to process the received positions
:param block: [optional] boolean to block the main thread when method is called
:param port: [optional] integer with p... | a method to establish a mosquitto socket with server to receive position updates | [
"a",
"method",
"to",
"establish",
"a",
"mosquitto",
"socket",
"with",
"server",
"to",
"receive",
"position",
"updates"
] | def subscribe(self, callable=None, block=False, port=1883):
title = '%s.subscribe' % self.__class__.__name__
input_fields = {
'port': port
}
for key, value in input_fields.items():
object_title = '%s(%s=%s)' % (title, key, str(value))
self.fields.valid... | [
"def",
"subscribe",
"(",
"self",
",",
"callable",
"=",
"None",
",",
"block",
"=",
"False",
",",
"port",
"=",
"1883",
")",
":",
"title",
"=",
"'%s.subscribe'",
"%",
"self",
".",
"__class__",
".",
"__name__",
"input_fields",
"=",
"{",
"'port'",
":",
"por... | a method to establish a mosquitto socket with server to receive position updates | [
"a",
"method",
"to",
"establish",
"a",
"mosquitto",
"socket",
"with",
"server",
"to",
"receive",
"position",
"updates"
] | [
"'''\n a method to establish a mosquitto socket with server to receive position updates\n \n :param callable: [optional] callable to process the received positions\n :param block: [optional] boolean to block the main thread when method is called\n :param port: [optional] i... | [
{
"param": "self",
"type": null
},
{
"param": "callable",
"type": null
},
{
"param": "block",
"type": null
},
{
"param": "port",
"type": null
}
] | {
"returns": [
{
"docstring": "None\nNOTE: subscribing without a callable will update the self.positions object\nwith any user message\n\n\n\n",
"docstring_tokens": [
"None",
"NOTE",
":",
"subscribing",
"without",
"a",
"callable",
"will... |
8d9d110f2d087a92fe0f1512da08c3f34b5bd4f9 | collectiveacuity/labPack | labpack/location/find.py | [
"MIT"
] | Python | publish | <not_specific> | def publish(self, user_id, wifi_fingerprint, action='track', location_id='', port=1883):
'''
a method to publish wifi fingerprint data to a mosquitto server
:param user_id: string with id of user
:param wifi_fingerprint: list of dictionaries with wifi fields mac and rss... |
a method to publish wifi fingerprint data to a mosquitto server
:param user_id: string with id of user
:param wifi_fingerprint: list of dictionaries with wifi fields mac and rssi
:param action: string with type of action to perform with data (track or learn)
:p... | a method to publish wifi fingerprint data to a mosquitto server | [
"a",
"method",
"to",
"publish",
"wifi",
"fingerprint",
"data",
"to",
"a",
"mosquitto",
"server"
] | def publish(self, user_id, wifi_fingerprint, action='track', location_id='', port=1883):
title = '%s.publish' % self.__class__.__name__
input_fields = {
'user_id': user_id,
'wifi_fingerprint': wifi_fingerprint,
'action': action,
'location_id': location_id,... | [
"def",
"publish",
"(",
"self",
",",
"user_id",
",",
"wifi_fingerprint",
",",
"action",
"=",
"'track'",
",",
"location_id",
"=",
"''",
",",
"port",
"=",
"1883",
")",
":",
"title",
"=",
"'%s.publish'",
"%",
"self",
".",
"__class__",
".",
"__name__",
"input... | a method to publish wifi fingerprint data to a mosquitto server | [
"a",
"method",
"to",
"publish",
"wifi",
"fingerprint",
"data",
"to",
"a",
"mosquitto",
"server"
] | [
"'''\n a method to publish wifi fingerprint data to a mosquitto server\n \n :param user_id: string with id of user\n :param wifi_fingerprint: list of dictionaries with wifi fields mac and rssi \n :param action: string with type of action to perform with data (track or lear... | [
{
"param": "self",
"type": null
},
{
"param": "user_id",
"type": null
},
{
"param": "wifi_fingerprint",
"type": null
},
{
"param": "action",
"type": null
},
{
"param": "location_id",
"type": null
},
{
"param": "port",
"type": null
}
] | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
... |
2e5baa7abe63784008bb5f8568d5e3c83580d517 | collectiveacuity/labPack | labpack/storage/aws/s3.py | [
"MIT"
] | Python | _key_digest | <not_specific> | def _key_digest(self, secret_key):
'''
a helper method for creating a base 64 encoded secret key and digest
:param secret_key: string with key to encrypt/decrypt data
:return: string with base64 key, string with base64 digest
'''
from hashlib import ... |
a helper method for creating a base 64 encoded secret key and digest
:param secret_key: string with key to encrypt/decrypt data
:return: string with base64 key, string with base64 digest
| a helper method for creating a base 64 encoded secret key and digest | [
"a",
"helper",
"method",
"for",
"creating",
"a",
"base",
"64",
"encoded",
"secret",
"key",
"and",
"digest"
] | def _key_digest(self, secret_key):
from hashlib import md5, sha256
from base64 import b64encode
key_bytes = sha256(secret_key.encode('utf-8')).digest()
key_b64 = b64encode(key_bytes).decode()
digest_bytes = md5(key_bytes).digest()
digest_b64 = b64encode(digest_bytes).deco... | [
"def",
"_key_digest",
"(",
"self",
",",
"secret_key",
")",
":",
"from",
"hashlib",
"import",
"md5",
",",
"sha256",
"from",
"base64",
"import",
"b64encode",
"key_bytes",
"=",
"sha256",
"(",
"secret_key",
".",
"encode",
"(",
"'utf-8'",
")",
")",
".",
"digest... | a helper method for creating a base 64 encoded secret key and digest | [
"a",
"helper",
"method",
"for",
"creating",
"a",
"base",
"64",
"encoded",
"secret",
"key",
"and",
"digest"
] | [
"'''\n a helper method for creating a base 64 encoded secret key and digest\n :param secret_key: string with key to encrypt/decrypt data\n :return: string with base64 key, string with base64 digest\n '''"
] | [
{
"param": "self",
"type": null
},
{
"param": "secret_key",
"type": null
}
] | {
"returns": [
{
"docstring": "string with base64 key, string with base64 digest",
"docstring_tokens": [
"string",
"with",
"base64",
"key",
"string",
"with",
"base64",
"digest"
],
"type": null
}
],
"raises": [],
"par... |
2e5baa7abe63784008bb5f8568d5e3c83580d517 | collectiveacuity/labPack | labpack/storage/aws/s3.py | [
"MIT"
] | Python | list_buckets | <not_specific> | def list_buckets(self):
'''
a method to retrieve a list of buckets on s3
:return: list of buckets
'''
title = '%s.list_buckets' % self.__class__.__name__
bucket_list = []
# send request to s3
try:
response = self.connection... |
a method to retrieve a list of buckets on s3
:return: list of buckets
| a method to retrieve a list of buckets on s3 | [
"a",
"method",
"to",
"retrieve",
"a",
"list",
"of",
"buckets",
"on",
"s3"
] | def list_buckets(self):
title = '%s.list_buckets' % self.__class__.__name__
bucket_list = []
try:
response = self.connection.list_buckets()
except:
raise AWSConnectionError(title)
for bucket in response['Buckets']:
bucket_list.append(bucket['Na... | [
"def",
"list_buckets",
"(",
"self",
")",
":",
"title",
"=",
"'%s.list_buckets'",
"%",
"self",
".",
"__class__",
".",
"__name__",
"bucket_list",
"=",
"[",
"]",
"try",
":",
"response",
"=",
"self",
".",
"connection",
".",
"list_buckets",
"(",
")",
"except",
... | a method to retrieve a list of buckets on s3 | [
"a",
"method",
"to",
"retrieve",
"a",
"list",
"of",
"buckets",
"on",
"s3"
] | [
"'''\n a method to retrieve a list of buckets on s3\n\n :return: list of buckets\n '''",
"# send request to s3",
"# create list from response"
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [
{
"docstring": "list of buckets",
"docstring_tokens": [
"list",
"of",
"buckets"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
... |
2e5baa7abe63784008bb5f8568d5e3c83580d517 | collectiveacuity/labPack | labpack/storage/aws/s3.py | [
"MIT"
] | Python | read_bucket | <not_specific> | def read_bucket(self, bucket_name):
'''
a method to retrieve properties of a bucket in s3
:param bucket_name: string with name of bucket
:return: dictionary with details of bucket
'''
title = '%s.read_bucket' % self.__class__.__name__
# validate inputs... |
a method to retrieve properties of a bucket in s3
:param bucket_name: string with name of bucket
:return: dictionary with details of bucket
| a method to retrieve properties of a bucket in s3 | [
"a",
"method",
"to",
"retrieve",
"properties",
"of",
"a",
"bucket",
"in",
"s3"
] | def read_bucket(self, bucket_name):
title = '%s.read_bucket' % self.__class__.__name__
input_fields = {
'bucket_name': bucket_name
}
for key, value in input_fields.items():
object_title = '%s(%s=%s)' % (title, key, str(value))
self.fields.validate(valu... | [
"def",
"read_bucket",
"(",
"self",
",",
"bucket_name",
")",
":",
"title",
"=",
"'%s.read_bucket'",
"%",
"self",
".",
"__class__",
".",
"__name__",
"input_fields",
"=",
"{",
"'bucket_name'",
":",
"bucket_name",
"}",
"for",
"key",
",",
"value",
"in",
"input_fi... | a method to retrieve properties of a bucket in s3 | [
"a",
"method",
"to",
"retrieve",
"properties",
"of",
"a",
"bucket",
"in",
"s3"
] | [
"'''\n a method to retrieve properties of a bucket in s3\n\n :param bucket_name: string with name of bucket\n :return: dictionary with details of bucket\n '''",
"# validate inputs",
"# validate existence of bucket",
"# create details dictionary",
"# retrieve access control de... | [
{
"param": "self",
"type": null
},
{
"param": "bucket_name",
"type": null
}
] | {
"returns": [
{
"docstring": "dictionary with details of bucket",
"docstring_tokens": [
"dictionary",
"with",
"details",
"of",
"bucket"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
... |
2e5baa7abe63784008bb5f8568d5e3c83580d517 | collectiveacuity/labPack | labpack/storage/aws/s3.py | [
"MIT"
] | Python | delete_bucket | <not_specific> | def delete_bucket(self, bucket_name):
'''
a method to delete a bucket in s3 and all its contents
:param bucket_name: string with name of bucket
:return: string with status of method
'''
title = '%s.delete_bucket' % self.__class__.__name__
# validate in... |
a method to delete a bucket in s3 and all its contents
:param bucket_name: string with name of bucket
:return: string with status of method
| a method to delete a bucket in s3 and all its contents | [
"a",
"method",
"to",
"delete",
"a",
"bucket",
"in",
"s3",
"and",
"all",
"its",
"contents"
] | def delete_bucket(self, bucket_name):
title = '%s.delete_bucket' % self.__class__.__name__
input_fields = {
'bucket_name': bucket_name
}
for key, value in input_fields.items():
object_title = '%s(%s=%s)' % (title, key, str(value))
self.fields.validate(... | [
"def",
"delete_bucket",
"(",
"self",
",",
"bucket_name",
")",
":",
"title",
"=",
"'%s.delete_bucket'",
"%",
"self",
".",
"__class__",
".",
"__name__",
"input_fields",
"=",
"{",
"'bucket_name'",
":",
"bucket_name",
"}",
"for",
"key",
",",
"value",
"in",
"inpu... | a method to delete a bucket in s3 and all its contents | [
"a",
"method",
"to",
"delete",
"a",
"bucket",
"in",
"s3",
"and",
"all",
"its",
"contents"
] | [
"'''\n a method to delete a bucket in s3 and all its contents\n\n :param bucket_name: string with name of bucket\n :return: string with status of method\n '''",
"# validate inputs",
"# check for existence of bucket",
"# retrieve list of records in bucket",
"# delete records i... | [
{
"param": "self",
"type": null
},
{
"param": "bucket_name",
"type": null
}
] | {
"returns": [
{
"docstring": "string with status of method",
"docstring_tokens": [
"string",
"with",
"status",
"of",
"method"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docst... |
2e5baa7abe63784008bb5f8568d5e3c83580d517 | collectiveacuity/labPack | labpack/storage/aws/s3.py | [
"MIT"
] | Python | list_records | <not_specific> | def list_records(self, bucket_name, prefix='', delimiter='', max_results=1000, starting_key=''):
'''
a method for retrieving a list of the versions of records in a bucket
:param bucket_name: string with name of bucket
:param prefix: [optional] string with value limiting results to ... |
a method for retrieving a list of the versions of records in a bucket
:param bucket_name: string with name of bucket
:param prefix: [optional] string with value limiting results to key prefix
:param delimiter: string with value which results must not contain (after prefix)
... | a method for retrieving a list of the versions of records in a bucket | [
"a",
"method",
"for",
"retrieving",
"a",
"list",
"of",
"the",
"versions",
"of",
"records",
"in",
"a",
"bucket"
] | def list_records(self, bucket_name, prefix='', delimiter='', max_results=1000, starting_key=''):
title = '%s.list_records' % self.__class__.__name__
from datetime import datetime
from dateutil.tz import tzutc
input_fields = {
'bucket_name': bucket_name,
'prefix': ... | [
"def",
"list_records",
"(",
"self",
",",
"bucket_name",
",",
"prefix",
"=",
"''",
",",
"delimiter",
"=",
"''",
",",
"max_results",
"=",
"1000",
",",
"starting_key",
"=",
"''",
")",
":",
"title",
"=",
"'%s.list_records'",
"%",
"self",
".",
"__class__",
".... | a method for retrieving a list of the versions of records in a bucket | [
"a",
"method",
"for",
"retrieving",
"a",
"list",
"of",
"the",
"versions",
"of",
"records",
"in",
"a",
"bucket"
] | [
"'''\n a method for retrieving a list of the versions of records in a bucket\n\n :param bucket_name: string with name of bucket\n :param prefix: [optional] string with value limiting results to key prefix\n :param delimiter: string with value which results must not contain (after pre... | [
{
"param": "self",
"type": null
},
{
"param": "bucket_name",
"type": null
},
{
"param": "prefix",
"type": null
},
{
"param": "delimiter",
"type": null
},
{
"param": "max_results",
"type": null
},
{
"param": "starting_key",
"type": null
}
] | {
"returns": [
{
"docstring": "list of results with key, size and date, string with ending key value",
"docstring_tokens": [
"list",
"of",
"results",
"with",
"key",
"size",
"and",
"date",
"string",
"with",
"ending"... |
2e5baa7abe63784008bb5f8568d5e3c83580d517 | collectiveacuity/labPack | labpack/storage/aws/s3.py | [
"MIT"
] | Python | list_versions | <not_specific> | def list_versions(self, bucket_name, prefix='', delimiter='', max_results=1000, starting_key='', starting_version=''):
'''
a method for retrieving a list of the versions of records in a bucket
:param bucket_name: string with name of bucket
:param prefix: [optional] string with valu... |
a method for retrieving a list of the versions of records in a bucket
:param bucket_name: string with name of bucket
:param prefix: [optional] string with value limiting results to key prefix
:param delimiter: [optional] string with value limiting results to key delimiter
:... | a method for retrieving a list of the versions of records in a bucket | [
"a",
"method",
"for",
"retrieving",
"a",
"list",
"of",
"the",
"versions",
"of",
"records",
"in",
"a",
"bucket"
] | def list_versions(self, bucket_name, prefix='', delimiter='', max_results=1000, starting_key='', starting_version=''):
title = '%s.list_versions' % self.__class__.__name__
from datetime import datetime
from dateutil.tz import tzutc
input_fields = {
'bucket_name': bucket_name,... | [
"def",
"list_versions",
"(",
"self",
",",
"bucket_name",
",",
"prefix",
"=",
"''",
",",
"delimiter",
"=",
"''",
",",
"max_results",
"=",
"1000",
",",
"starting_key",
"=",
"''",
",",
"starting_version",
"=",
"''",
")",
":",
"title",
"=",
"'%s.list_versions'... | a method for retrieving a list of the versions of records in a bucket | [
"a",
"method",
"for",
"retrieving",
"a",
"list",
"of",
"the",
"versions",
"of",
"records",
"in",
"a",
"bucket"
] | [
"'''\n a method for retrieving a list of the versions of records in a bucket\n\n :param bucket_name: string with name of bucket\n :param prefix: [optional] string with value limiting results to key prefix\n :param delimiter: [optional] string with value limiting results to key delimi... | [
{
"param": "self",
"type": null
},
{
"param": "bucket_name",
"type": null
},
{
"param": "prefix",
"type": null
},
{
"param": "delimiter",
"type": null
},
{
"param": "max_results",
"type": null
},
{
"param": "starting_key",
"type": null
},
{
... | {
"returns": [
{
"docstring": "list of results with key, size and date, dictionary with key and version id",
"docstring_tokens": [
"list",
"of",
"results",
"with",
"key",
"size",
"and",
"date",
"dictionary",
"with",
... |
2e5baa7abe63784008bb5f8568d5e3c83580d517 | collectiveacuity/labPack | labpack/storage/aws/s3.py | [
"MIT"
] | Python | create_record | <not_specific> | def create_record(self, bucket_name, record_key, record_data, record_metadata=None, record_mimetype='', record_encoding='', overwrite=True):
'''
a method for adding a record to an S3 bucket
:param bucket_name: string with name of bucket
:param record_key: string with na... |
a method for adding a record to an S3 bucket
:param bucket_name: string with name of bucket
:param record_key: string with name of key (path) for record
:param record_data: byte data for record
:param record_metadata: [optional] dictionary with metadata to attac... | a method for adding a record to an S3 bucket | [
"a",
"method",
"for",
"adding",
"a",
"record",
"to",
"an",
"S3",
"bucket"
] | def create_record(self, bucket_name, record_key, record_data, record_metadata=None, record_mimetype='', record_encoding='', overwrite=True):
title = '%s.create_record' % self.__class__.__name__
import sys
from hashlib import md5
from base64 import b64encode
metadata_max = self.fi... | [
"def",
"create_record",
"(",
"self",
",",
"bucket_name",
",",
"record_key",
",",
"record_data",
",",
"record_metadata",
"=",
"None",
",",
"record_mimetype",
"=",
"''",
",",
"record_encoding",
"=",
"''",
",",
"overwrite",
"=",
"True",
")",
":",
"title",
"=",
... | a method for adding a record to an S3 bucket | [
"a",
"method",
"for",
"adding",
"a",
"record",
"to",
"an",
"S3",
"bucket"
] | [
"'''\n a method for adding a record to an S3 bucket\n \n :param bucket_name: string with name of bucket\n :param record_key: string with name of key (path) for record\n :param record_data: byte data for record\n :param record_metadata: [optional] dictionary with met... | [
{
"param": "self",
"type": null
},
{
"param": "bucket_name",
"type": null
},
{
"param": "record_key",
"type": null
},
{
"param": "record_data",
"type": null
},
{
"param": "record_metadata",
"type": null
},
{
"param": "record_mimetype",
"type": null... | {
"returns": [
{
"docstring": "string with name of record key",
"docstring_tokens": [
"string",
"with",
"name",
"of",
"record",
"key"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "self",
"type": nul... |
2e5baa7abe63784008bb5f8568d5e3c83580d517 | collectiveacuity/labPack | labpack/storage/aws/s3.py | [
"MIT"
] | Python | read_headers | <not_specific> | def read_headers(self, bucket_name, record_key, record_version='', version_check=False):
'''
a method for retrieving the headers of a record from s3
:param bucket_name: string with name of bucket
:param record_key: string with key value of record
:param record_version: [opt... |
a method for retrieving the headers of a record from s3
:param bucket_name: string with name of bucket
:param record_key: string with key value of record
:param record_version: [optional] string with aws id of version of record
:param version_check: [optional] boolean to en... | a method for retrieving the headers of a record from s3 | [
"a",
"method",
"for",
"retrieving",
"the",
"headers",
"of",
"a",
"record",
"from",
"s3"
] | def read_headers(self, bucket_name, record_key, record_version='', version_check=False):
title = '%s.read_headers' % self.__class__.__name__
from datetime import datetime
from dateutil.tz import tzutc
input_fields = {
'bucket_name': bucket_name,
'record_key': reco... | [
"def",
"read_headers",
"(",
"self",
",",
"bucket_name",
",",
"record_key",
",",
"record_version",
"=",
"''",
",",
"version_check",
"=",
"False",
")",
":",
"title",
"=",
"'%s.read_headers'",
"%",
"self",
".",
"__class__",
".",
"__name__",
"from",
"datetime",
... | a method for retrieving the headers of a record from s3 | [
"a",
"method",
"for",
"retrieving",
"the",
"headers",
"of",
"a",
"record",
"from",
"s3"
] | [
"'''\n a method for retrieving the headers of a record from s3\n\n :param bucket_name: string with name of bucket\n :param record_key: string with key value of record\n :param record_version: [optional] string with aws id of version of record\n :param version_check: [optional]... | [
{
"param": "self",
"type": null
},
{
"param": "bucket_name",
"type": null
},
{
"param": "record_key",
"type": null
},
{
"param": "record_version",
"type": null
},
{
"param": "version_check",
"type": null
}
] | {
"returns": [
{
"docstring": "dictionary with headers of record",
"docstring_tokens": [
"dictionary",
"with",
"headers",
"of",
"record"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
... |
2e5baa7abe63784008bb5f8568d5e3c83580d517 | collectiveacuity/labPack | labpack/storage/aws/s3.py | [
"MIT"
] | Python | read_record | <not_specific> | def read_record(self, bucket_name, record_key, record_version='', version_check=False):
'''
a method for retrieving data of record from AWS S3
:param bucket_name: string with name of bucket
:param record_key: string with name of key (path) for record
:param reco... |
a method for retrieving data of record from AWS S3
:param bucket_name: string with name of bucket
:param record_key: string with name of key (path) for record
:param record_version: [optional] string with aws id of version of record
:param version_check: [option... | a method for retrieving data of record from AWS S3 | [
"a",
"method",
"for",
"retrieving",
"data",
"of",
"record",
"from",
"AWS",
"S3"
] | def read_record(self, bucket_name, record_key, record_version='', version_check=False):
title = '%s.read_record' % self.__class__.__name__
from datetime import datetime
from dateutil.tz import tzutc
input_fields = {
'bucket_name': bucket_name,
'record_key': record... | [
"def",
"read_record",
"(",
"self",
",",
"bucket_name",
",",
"record_key",
",",
"record_version",
"=",
"''",
",",
"version_check",
"=",
"False",
")",
":",
"title",
"=",
"'%s.read_record'",
"%",
"self",
".",
"__class__",
".",
"__name__",
"from",
"datetime",
"i... | a method for retrieving data of record from AWS S3 | [
"a",
"method",
"for",
"retrieving",
"data",
"of",
"record",
"from",
"AWS",
"S3"
] | [
"'''\n a method for retrieving data of record from AWS S3\n \n :param bucket_name: string with name of bucket\n :param record_key: string with name of key (path) for record\n :param record_version: [optional] string with aws id of version of record\n :param version_... | [
{
"param": "self",
"type": null
},
{
"param": "bucket_name",
"type": null
},
{
"param": "record_key",
"type": null
},
{
"param": "record_version",
"type": null
},
{
"param": "version_check",
"type": null
}
] | {
"returns": [
{
"docstring": "byte data for record, dictionary with metadata details",
"docstring_tokens": [
"byte",
"data",
"for",
"record",
"dictionary",
"with",
"metadata",
"details"
],
"type": null
}
],
"raises": ... |
2e5baa7abe63784008bb5f8568d5e3c83580d517 | collectiveacuity/labPack | labpack/storage/aws/s3.py | [
"MIT"
] | Python | delete_record | <not_specific> | def delete_record(self, bucket_name, record_key, record_version=''):
'''
a method for deleting an object record in s3
:param bucket_name: string with name of bucket
:param record_key: string with key value of record
:param record_version: [optional] string with aws id of ve... |
a method for deleting an object record in s3
:param bucket_name: string with name of bucket
:param record_key: string with key value of record
:param record_version: [optional] string with aws id of version of record
:return: dictionary with status of delete request
... | a method for deleting an object record in s3 | [
"a",
"method",
"for",
"deleting",
"an",
"object",
"record",
"in",
"s3"
] | def delete_record(self, bucket_name, record_key, record_version=''):
title = '%s.delete_record' % self.__class__.__name__
input_fields = {
'bucket_name': bucket_name,
'record_key': record_key,
'record_version': record_version
}
for key, value in input_... | [
"def",
"delete_record",
"(",
"self",
",",
"bucket_name",
",",
"record_key",
",",
"record_version",
"=",
"''",
")",
":",
"title",
"=",
"'%s.delete_record'",
"%",
"self",
".",
"__class__",
".",
"__name__",
"input_fields",
"=",
"{",
"'bucket_name'",
":",
"bucket_... | a method for deleting an object record in s3 | [
"a",
"method",
"for",
"deleting",
"an",
"object",
"record",
"in",
"s3"
] | [
"'''\n a method for deleting an object record in s3\n\n :param bucket_name: string with name of bucket\n :param record_key: string with key value of record\n :param record_version: [optional] string with aws id of version of record\n :return: dictionary with status of delete r... | [
{
"param": "self",
"type": null
},
{
"param": "bucket_name",
"type": null
},
{
"param": "record_key",
"type": null
},
{
"param": "record_version",
"type": null
}
] | {
"returns": [
{
"docstring": "dictionary with status of delete request",
"docstring_tokens": [
"dictionary",
"with",
"status",
"of",
"delete",
"request"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "self... |
2e5baa7abe63784008bb5f8568d5e3c83580d517 | collectiveacuity/labPack | labpack/storage/aws/s3.py | [
"MIT"
] | Python | export_records | <not_specific> | def export_records(self, bucket_name, export_path='', overwrite=True):
'''
a method to export all the records from a bucket to local files
:param bucket_name: string with name of bucket
:param export_path: [optional] string with path to root directory for record dump
:param... |
a method to export all the records from a bucket to local files
:param bucket_name: string with name of bucket
:param export_path: [optional] string with path to root directory for record dump
:param overwrite: [optional] boolean to overwrite existing files matching records
... | a method to export all the records from a bucket to local files | [
"a",
"method",
"to",
"export",
"all",
"the",
"records",
"from",
"a",
"bucket",
"to",
"local",
"files"
] | def export_records(self, bucket_name, export_path='', overwrite=True):
title = '%s.export_records' % self.__class__.__name__
input_fields = {
'bucket_name': bucket_name,
'export_path': export_path
}
for key, value in input_fields.items():
if value:
... | [
"def",
"export_records",
"(",
"self",
",",
"bucket_name",
",",
"export_path",
"=",
"''",
",",
"overwrite",
"=",
"True",
")",
":",
"title",
"=",
"'%s.export_records'",
"%",
"self",
".",
"__class__",
".",
"__name__",
"input_fields",
"=",
"{",
"'bucket_name'",
... | a method to export all the records from a bucket to local files | [
"a",
"method",
"to",
"export",
"all",
"the",
"records",
"from",
"a",
"bucket",
"to",
"local",
"files"
] | [
"'''\n a method to export all the records from a bucket to local files\n\n :param bucket_name: string with name of bucket\n :param export_path: [optional] string with path to root directory for record dump\n :param overwrite: [optional] boolean to overwrite existing files matching re... | [
{
"param": "self",
"type": null
},
{
"param": "bucket_name",
"type": null
},
{
"param": "export_path",
"type": null
},
{
"param": "overwrite",
"type": null
}
] | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
... |
2e5baa7abe63784008bb5f8568d5e3c83580d517 | collectiveacuity/labPack | labpack/storage/aws/s3.py | [
"MIT"
] | Python | import_records | <not_specific> | def import_records(self, bucket_name, import_path='', overwrite=True):
'''
a method to importing records from local files to a bucket
:param bucket_name: string with name of bucket
:param export_path: [optional] string with path to root directory of files
:param overwrite: ... |
a method to importing records from local files to a bucket
:param bucket_name: string with name of bucket
:param export_path: [optional] string with path to root directory of files
:param overwrite: [optional] boolean to overwrite existing files matching records
:return: Tr... | a method to importing records from local files to a bucket | [
"a",
"method",
"to",
"importing",
"records",
"from",
"local",
"files",
"to",
"a",
"bucket"
] | def import_records(self, bucket_name, import_path='', overwrite=True):
title = '%s.import_records' % self.__class__.__name__
input_fields = {
'bucket_name': bucket_name,
'import_path': import_path
}
for key, value in input_fields.items():
if value:
... | [
"def",
"import_records",
"(",
"self",
",",
"bucket_name",
",",
"import_path",
"=",
"''",
",",
"overwrite",
"=",
"True",
")",
":",
"title",
"=",
"'%s.import_records'",
"%",
"self",
".",
"__class__",
".",
"__name__",
"input_fields",
"=",
"{",
"'bucket_name'",
... | a method to importing records from local files to a bucket | [
"a",
"method",
"to",
"importing",
"records",
"from",
"local",
"files",
"to",
"a",
"bucket"
] | [
"'''\n a method to importing records from local files to a bucket\n\n :param bucket_name: string with name of bucket\n :param export_path: [optional] string with path to root directory of files\n :param overwrite: [optional] boolean to overwrite existing files matching records\n ... | [
{
"param": "self",
"type": null
},
{
"param": "bucket_name",
"type": null
},
{
"param": "import_path",
"type": null
},
{
"param": "overwrite",
"type": null
}
] | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
... |
2e5baa7abe63784008bb5f8568d5e3c83580d517 | collectiveacuity/labPack | labpack/storage/aws/s3.py | [
"MIT"
] | Python | _import | <not_specific> | def _import(self, record_key, record_data, overwrite=True, encryption='', last_modified=0.0, **kwargs):
'''
a helper method for other storage clients to import into s3
:param record_key: string with key for record
:param record_data: byte data for body of record... |
a helper method for other storage clients to import into s3
:param record_key: string with key for record
:param record_data: byte data for body of record
:param overwrite: [optional] boolean to overwrite existing records
:param encryption: [optional] string wit... | a helper method for other storage clients to import into s3 | [
"a",
"helper",
"method",
"for",
"other",
"storage",
"clients",
"to",
"import",
"into",
"s3"
] | def _import(self, record_key, record_data, overwrite=True, encryption='', last_modified=0.0, **kwargs):
from time import time
create_kwargs = {
'bucket_name': self.bucket_name,
'record_key': record_key,
'record_data': record_data,
'overwrite': overwrite,
... | [
"def",
"_import",
"(",
"self",
",",
"record_key",
",",
"record_data",
",",
"overwrite",
"=",
"True",
",",
"encryption",
"=",
"''",
",",
"last_modified",
"=",
"0.0",
",",
"**",
"kwargs",
")",
":",
"from",
"time",
"import",
"time",
"create_kwargs",
"=",
"{... | a helper method for other storage clients to import into s3 | [
"a",
"helper",
"method",
"for",
"other",
"storage",
"clients",
"to",
"import",
"into",
"s3"
] | [
"'''\n a helper method for other storage clients to import into s3\n \n :param record_key: string with key for record\n :param record_data: byte data for body of record\n :param overwrite: [optional] boolean to overwrite existing records\n :param encryption: [option... | [
{
"param": "self",
"type": null
},
{
"param": "record_key",
"type": null
},
{
"param": "record_data",
"type": null
},
{
"param": "overwrite",
"type": null
},
{
"param": "encryption",
"type": null
},
{
"param": "last_modified",
"type": null
}
] | {
"returns": [
{
"docstring": "boolean indicating whether record was imported",
"docstring_tokens": [
"boolean",
"indicating",
"whether",
"record",
"was",
"imported"
],
"type": null
}
],
"raises": [],
"params": [
{
"identi... |
2e5baa7abe63784008bb5f8568d5e3c83580d517 | collectiveacuity/labPack | labpack/storage/aws/s3.py | [
"MIT"
] | Python | exists | <not_specific> | def exists(self, record_key):
'''
a method to determine if a record exists in collection
:param record_key: string with key of record
:return: boolean reporting status
'''
title = '%s.exists' % self.__class__.__name__
# validate inputs
... |
a method to determine if a record exists in collection
:param record_key: string with key of record
:return: boolean reporting status
| a method to determine if a record exists in collection | [
"a",
"method",
"to",
"determine",
"if",
"a",
"record",
"exists",
"in",
"collection"
] | def exists(self, record_key):
title = '%s.exists' % self.__class__.__name__
input_fields = {
'record_key': record_key
}
for key, value in input_fields.items():
object_title = '%s(%s=%s)' % (title, key, str(value))
self.fields.validate(value, '.%s' % ke... | [
"def",
"exists",
"(",
"self",
",",
"record_key",
")",
":",
"title",
"=",
"'%s.exists'",
"%",
"self",
".",
"__class__",
".",
"__name__",
"input_fields",
"=",
"{",
"'record_key'",
":",
"record_key",
"}",
"for",
"key",
",",
"value",
"in",
"input_fields",
".",... | a method to determine if a record exists in collection | [
"a",
"method",
"to",
"determine",
"if",
"a",
"record",
"exists",
"in",
"collection"
] | [
"''' \n a method to determine if a record exists in collection\n\n :param record_key: string with key of record\n :return: boolean reporting status\n '''",
"# validate inputs",
"# read record headers"
] | [
{
"param": "self",
"type": null
},
{
"param": "record_key",
"type": null
}
] | {
"returns": [
{
"docstring": "boolean reporting status",
"docstring_tokens": [
"boolean",
"reporting",
"status"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_... |
2e5baa7abe63784008bb5f8568d5e3c83580d517 | collectiveacuity/labPack | labpack/storage/aws/s3.py | [
"MIT"
] | Python | save | <not_specific> | def save(self, record_key, record_data, overwrite=True, secret_key=''):
'''
a method to create a file in the collection folder on S3
:param record_key: string with name to assign to record (see NOTES below)
:param record_data: byte data for record body
:param overw... |
a method to create a file in the collection folder on S3
:param record_key: string with name to assign to record (see NOTES below)
:param record_data: byte data for record body
:param overwrite: [optional] boolean to overwrite records with same name
:param secret_key: [opt... | a method to create a file in the collection folder on S3 | [
"a",
"method",
"to",
"create",
"a",
"file",
"in",
"the",
"collection",
"folder",
"on",
"S3"
] | def save(self, record_key, record_data, overwrite=True, secret_key=''):
title = '%s.save' % self.__class__.__name__
input_fields = {
'record_key': record_key,
'secret_key': secret_key
}
for key, value in input_fields.items():
if value:
... | [
"def",
"save",
"(",
"self",
",",
"record_key",
",",
"record_data",
",",
"overwrite",
"=",
"True",
",",
"secret_key",
"=",
"''",
")",
":",
"title",
"=",
"'%s.save'",
"%",
"self",
".",
"__class__",
".",
"__name__",
"input_fields",
"=",
"{",
"'record_key'",
... | a method to create a file in the collection folder on S3 | [
"a",
"method",
"to",
"create",
"a",
"file",
"in",
"the",
"collection",
"folder",
"on",
"S3"
] | [
"''' \n a method to create a file in the collection folder on S3\n\n :param record_key: string with name to assign to record (see NOTES below)\n :param record_data: byte data for record body\n :param overwrite: [optional] boolean to overwrite records with same name\n :param se... | [
{
"param": "self",
"type": null
},
{
"param": "record_key",
"type": null
},
{
"param": "record_data",
"type": null
},
{
"param": "overwrite",
"type": null
},
{
"param": "secret_key",
"type": null
}
] | {
"returns": [
{
"docstring": "string with name of record\nNOTE: record_key may only contain alphanumeric, /, _, . or\ncharacters and may not begin with the . or / character.\n\nusing one or more / characters splits the key into\nseparate segments. these segments will appear as a\nsub directories inside t... |
2e5baa7abe63784008bb5f8568d5e3c83580d517 | collectiveacuity/labPack | labpack/storage/aws/s3.py | [
"MIT"
] | Python | load | <not_specific> | def load(self, record_key, secret_key=''):
'''
a method to retrieve byte data of an S3 record
:param record_key: string with name of record
:param secret_key: [optional] string used to decrypt data
:return: byte data for record body
'''
titl... |
a method to retrieve byte data of an S3 record
:param record_key: string with name of record
:param secret_key: [optional] string used to decrypt data
:return: byte data for record body
| a method to retrieve byte data of an S3 record | [
"a",
"method",
"to",
"retrieve",
"byte",
"data",
"of",
"an",
"S3",
"record"
] | def load(self, record_key, secret_key=''):
title = '%s.load' % self.__class__.__name__
input_fields = {
'record_key': record_key,
'secret_key': secret_key
}
for key, value in input_fields.items():
if value:
object_title = '%s(%s=%s)' % ... | [
"def",
"load",
"(",
"self",
",",
"record_key",
",",
"secret_key",
"=",
"''",
")",
":",
"title",
"=",
"'%s.load'",
"%",
"self",
".",
"__class__",
".",
"__name__",
"input_fields",
"=",
"{",
"'record_key'",
":",
"record_key",
",",
"'secret_key'",
":",
"secret... | a method to retrieve byte data of an S3 record | [
"a",
"method",
"to",
"retrieve",
"byte",
"data",
"of",
"an",
"S3",
"record"
] | [
"'''\n a method to retrieve byte data of an S3 record\n\n :param record_key: string with name of record\n :param secret_key: [optional] string used to decrypt data\n :return: byte data for record body\n '''",
"# validate inputs",
"# retrieve record data from s3",
"# vali... | [
{
"param": "self",
"type": null
},
{
"param": "record_key",
"type": null
},
{
"param": "secret_key",
"type": null
}
] | {
"returns": [
{
"docstring": "byte data for record body",
"docstring_tokens": [
"byte",
"data",
"for",
"record",
"body"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring":... |
2e5baa7abe63784008bb5f8568d5e3c83580d517 | collectiveacuity/labPack | labpack/storage/aws/s3.py | [
"MIT"
] | Python | list | <not_specific> | def list(self, prefix='', delimiter='', filter_function=None, max_results=1, previous_key=''):
'''
a method to list keys in the collection
:param prefix: string with prefix value to filter results
:param delimiter: string with value results must not contain (after prefix)
... |
a method to list keys in the collection
:param prefix: string with prefix value to filter results
:param delimiter: string with value results must not contain (after prefix)
:param filter_function: (positional arguments) function used to filter results
:param max_results: ... | a method to list keys in the collection | [
"a",
"method",
"to",
"list",
"keys",
"in",
"the",
"collection"
] | def list(self, prefix='', delimiter='', filter_function=None, max_results=1, previous_key=''):
title = '%s.list' % self.__class__.__name__
input_fields = {
'prefix': prefix,
'delimiter': delimiter,
'max_results': max_results,
'record_key': previous_key
... | [
"def",
"list",
"(",
"self",
",",
"prefix",
"=",
"''",
",",
"delimiter",
"=",
"''",
",",
"filter_function",
"=",
"None",
",",
"max_results",
"=",
"1",
",",
"previous_key",
"=",
"''",
")",
":",
"title",
"=",
"'%s.list'",
"%",
"self",
".",
"__class__",
... | a method to list keys in the collection | [
"a",
"method",
"to",
"list",
"keys",
"in",
"the",
"collection"
] | [
"''' \n a method to list keys in the collection\n\n :param prefix: string with prefix value to filter results\n :param delimiter: string with value results must not contain (after prefix)\n :param filter_function: (positional arguments) function used to filter results\n :param... | [
{
"param": "self",
"type": null
},
{
"param": "prefix",
"type": null
},
{
"param": "delimiter",
"type": null
},
{
"param": "filter_function",
"type": null
},
{
"param": "max_results",
"type": null
},
{
"param": "previous_key",
"type": null
}
] | {
"returns": [
{
"docstring": "list of key strings\nNOTE: each key string can be divided into one or more segments\nbased upon the / characters which occur in the key string as\nwell as its file extension type. if the key string represents\na file path, then each directory in the path, the file name\nand ... |
2e5baa7abe63784008bb5f8568d5e3c83580d517 | collectiveacuity/labPack | labpack/storage/aws/s3.py | [
"MIT"
] | Python | delete | <not_specific> | def delete(self, record_key):
''' a method to delete a record from S3
:param record_key: string with key of record
:return: string reporting outcome
'''
title = '%s.delete' % self.__class__.__name__
# validate inputs
input_fields = {
'r... | a method to delete a record from S3
:param record_key: string with key of record
:return: string reporting outcome
| a method to delete a record from S3 | [
"a",
"method",
"to",
"delete",
"a",
"record",
"from",
"S3"
] | def delete(self, record_key):
title = '%s.delete' % self.__class__.__name__
input_fields = {
'record_key': record_key
}
for key, value in input_fields.items():
object_title = '%s(%s=%s)' % (title, key, str(value))
self.fields.validate(value, '.%s' % ke... | [
"def",
"delete",
"(",
"self",
",",
"record_key",
")",
":",
"title",
"=",
"'%s.delete'",
"%",
"self",
".",
"__class__",
".",
"__name__",
"input_fields",
"=",
"{",
"'record_key'",
":",
"record_key",
"}",
"for",
"key",
",",
"value",
"in",
"input_fields",
".",... | a method to delete a record from S3 | [
"a",
"method",
"to",
"delete",
"a",
"record",
"from",
"S3"
] | [
"''' a method to delete a record from S3\n\n :param record_key: string with key of record\n :return: string reporting outcome\n '''",
"# validate inputs",
"# delete record"
] | [
{
"param": "self",
"type": null
},
{
"param": "record_key",
"type": null
}
] | {
"returns": [
{
"docstring": "string reporting outcome",
"docstring_tokens": [
"string",
"reporting",
"outcome"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_... |
2e5baa7abe63784008bb5f8568d5e3c83580d517 | collectiveacuity/labPack | labpack/storage/aws/s3.py | [
"MIT"
] | Python | remove | <not_specific> | def remove(self):
'''
a method to remove collection and all records in the collection
:return: string with confirmation of deletion
'''
title = '%s.remove' % self.__class__.__name__
# request bucket delete
self.s3.delete_bucket(self.bucket_na... |
a method to remove collection and all records in the collection
:return: string with confirmation of deletion
| a method to remove collection and all records in the collection | [
"a",
"method",
"to",
"remove",
"collection",
"and",
"all",
"records",
"in",
"the",
"collection"
] | def remove(self):
title = '%s.remove' % self.__class__.__name__
self.s3.delete_bucket(self.bucket_name)
exit_msg = '%s collection has been removed from S3.' % self.bucket_name
return exit_msg | [
"def",
"remove",
"(",
"self",
")",
":",
"title",
"=",
"'%s.remove'",
"%",
"self",
".",
"__class__",
".",
"__name__",
"self",
".",
"s3",
".",
"delete_bucket",
"(",
"self",
".",
"bucket_name",
")",
"exit_msg",
"=",
"'%s collection has been removed from S3.'",
"%... | a method to remove collection and all records in the collection | [
"a",
"method",
"to",
"remove",
"collection",
"and",
"all",
"records",
"in",
"the",
"collection"
] | [
"''' \n a method to remove collection and all records in the collection\n\n :return: string with confirmation of deletion\n '''",
"# request bucket delete ",
"# return confirmation"
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [
{
"docstring": "string with confirmation of deletion",
"docstring_tokens": [
"string",
"with",
"confirmation",
"of",
"deletion"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "self",
"type": nu... |
2e5baa7abe63784008bb5f8568d5e3c83580d517 | collectiveacuity/labPack | labpack/storage/aws/s3.py | [
"MIT"
] | Python | export | <not_specific> | def export(self, storage_client, overwrite=True):
'''
a method to export all the records in collection to another platform
:param storage_client: class object with storage client methods
:return: string with exit message
'''
title = '%s.expo... |
a method to export all the records in collection to another platform
:param storage_client: class object with storage client methods
:return: string with exit message
| a method to export all the records in collection to another platform | [
"a",
"method",
"to",
"export",
"all",
"the",
"records",
"in",
"collection",
"to",
"another",
"platform"
] | def export(self, storage_client, overwrite=True):
title = '%s.export' % self.__class__.__name__
method_list = [ 'save', 'load', 'list', 'export', 'delete', 'remove', '_import', 'collection_name' ]
for method in method_list:
if not getattr(storage_client, method, None):
... | [
"def",
"export",
"(",
"self",
",",
"storage_client",
",",
"overwrite",
"=",
"True",
")",
":",
"title",
"=",
"'%s.export'",
"%",
"self",
".",
"__class__",
".",
"__name__",
"method_list",
"=",
"[",
"'save'",
",",
"'load'",
",",
"'list'",
",",
"'export'",
"... | a method to export all the records in collection to another platform | [
"a",
"method",
"to",
"export",
"all",
"the",
"records",
"in",
"collection",
"to",
"another",
"platform"
] | [
"'''\n a method to export all the records in collection to another platform\n \n :param storage_client: class object with storage client methods\n :return: string with exit message\n '''",
"# validate storage client",
"# define copy record function",
"# retrieve list... | [
{
"param": "self",
"type": null
},
{
"param": "storage_client",
"type": null
},
{
"param": "overwrite",
"type": null
}
] | {
"returns": [
{
"docstring": "string with exit message",
"docstring_tokens": [
"string",
"with",
"exit",
"message"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
... |
bc0f4de7053e58c4775bf72e16cd19da85ac944f | collectiveacuity/labPack | labpack/mapping/data.py | [
"MIT"
] | Python | walk_data | null | def walk_data(input_data):
''' a generator function for retrieving data in a nested dictionary
:param input_data: dictionary or list with nested data
:return: string with dot_path, object with value of endpoint
'''
def _walk_dict(input_dict, path_to_root):
if not path_to_root:
... | a generator function for retrieving data in a nested dictionary
:param input_data: dictionary or list with nested data
:return: string with dot_path, object with value of endpoint
| a generator function for retrieving data in a nested dictionary | [
"a",
"generator",
"function",
"for",
"retrieving",
"data",
"in",
"a",
"nested",
"dictionary"
] | def walk_data(input_data):
def _walk_dict(input_dict, path_to_root):
if not path_to_root:
yield '.', input_dict
for key, value in input_dict.items():
key_path = '%s.%s' % (path_to_root, key)
type_name = value.__class__.__name__
yield key_path, value
... | [
"def",
"walk_data",
"(",
"input_data",
")",
":",
"def",
"_walk_dict",
"(",
"input_dict",
",",
"path_to_root",
")",
":",
"if",
"not",
"path_to_root",
":",
"yield",
"'.'",
",",
"input_dict",
"for",
"key",
",",
"value",
"in",
"input_dict",
".",
"items",
"(",
... | a generator function for retrieving data in a nested dictionary | [
"a",
"generator",
"function",
"for",
"retrieving",
"data",
"in",
"a",
"nested",
"dictionary"
] | [
"''' a generator function for retrieving data in a nested dictionary\n\n :param input_data: dictionary or list with nested data\n :return: string with dot_path, object with value of endpoint\n '''"
] | [
{
"param": "input_data",
"type": null
}
] | {
"returns": [
{
"docstring": "string with dot_path, object with value of endpoint",
"docstring_tokens": [
"string",
"with",
"dot_path",
"object",
"with",
"value",
"of",
"endpoint"
],
"type": null
}
],
"raises": [],
... |
bc0f4de7053e58c4775bf72e16cd19da85ac944f | collectiveacuity/labPack | labpack/mapping/data.py | [
"MIT"
] | Python | segment_path | <not_specific> | def segment_path(dot_path):
''' a function to separate the path segments in a dot_path key
:param dot_path: string with dot path syntax
:return: list of string segments of path
'''
import re
digit_pat = re.compile('\[(\d+)\]')
key_list = dot_path.split('.')
segment_list = []
for ... | a function to separate the path segments in a dot_path key
:param dot_path: string with dot path syntax
:return: list of string segments of path
| a function to separate the path segments in a dot_path key | [
"a",
"function",
"to",
"separate",
"the",
"path",
"segments",
"in",
"a",
"dot_path",
"key"
] | def segment_path(dot_path):
import re
digit_pat = re.compile('\[(\d+)\]')
key_list = dot_path.split('.')
segment_list = []
for key in key_list:
if key:
item_list = digit_pat.split(key)
for item in item_list:
if item:
segment_list.ap... | [
"def",
"segment_path",
"(",
"dot_path",
")",
":",
"import",
"re",
"digit_pat",
"=",
"re",
".",
"compile",
"(",
"'\\[(\\d+)\\]'",
")",
"key_list",
"=",
"dot_path",
".",
"split",
"(",
"'.'",
")",
"segment_list",
"=",
"[",
"]",
"for",
"key",
"in",
"key_list... | a function to separate the path segments in a dot_path key | [
"a",
"function",
"to",
"separate",
"the",
"path",
"segments",
"in",
"a",
"dot_path",
"key"
] | [
"''' a function to separate the path segments in a dot_path key\n\n :param dot_path: string with dot path syntax\n :return: list of string segments of path\n '''"
] | [
{
"param": "dot_path",
"type": null
}
] | {
"returns": [
{
"docstring": "list of string segments of path",
"docstring_tokens": [
"list",
"of",
"string",
"segments",
"of",
"path"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "dot_path",
"type... |
bc0f4de7053e58c4775bf72e16cd19da85ac944f | collectiveacuity/labPack | labpack/mapping/data.py | [
"MIT"
] | Python | transform_data | <not_specific> | def transform_data(function, input_data):
''' a function to apply a function to each value in a nested dictionary
:param function: callable function with a single input of any datatype
:param input_data: dictionary or list with nested data to transform
:return: dictionary or list with data transformed... | a function to apply a function to each value in a nested dictionary
:param function: callable function with a single input of any datatype
:param input_data: dictionary or list with nested data to transform
:return: dictionary or list with data transformed by function
| a function to apply a function to each value in a nested dictionary | [
"a",
"function",
"to",
"apply",
"a",
"function",
"to",
"each",
"value",
"in",
"a",
"nested",
"dictionary"
] | def transform_data(function, input_data):
try:
from copy import deepcopy
output_data = deepcopy(input_data)
except:
raise ValueError('transform_data() input_data argument cannot contain module datatypes.')
for dot_path, value in walk_data(input_data):
current_endpoint = outpu... | [
"def",
"transform_data",
"(",
"function",
",",
"input_data",
")",
":",
"try",
":",
"from",
"copy",
"import",
"deepcopy",
"output_data",
"=",
"deepcopy",
"(",
"input_data",
")",
"except",
":",
"raise",
"ValueError",
"(",
"'transform_data() input_data argument cannot ... | a function to apply a function to each value in a nested dictionary | [
"a",
"function",
"to",
"apply",
"a",
"function",
"to",
"each",
"value",
"in",
"a",
"nested",
"dictionary"
] | [
"''' a function to apply a function to each value in a nested dictionary\n\n :param function: callable function with a single input of any datatype\n :param input_data: dictionary or list with nested data to transform\n :return: dictionary or list with data transformed by function\n '''",
"# construct... | [
{
"param": "function",
"type": null
},
{
"param": "input_data",
"type": null
}
] | {
"returns": [
{
"docstring": "dictionary or list with data transformed by function",
"docstring_tokens": [
"dictionary",
"or",
"list",
"with",
"data",
"transformed",
"by",
"function"
],
"type": null
}
],
"raises": [],... |
bc0f4de7053e58c4775bf72e16cd19da85ac944f | collectiveacuity/labPack | labpack/mapping/data.py | [
"MIT"
] | Python | clean_data | <not_specific> | def clean_data(input_value):
''' a function to transform a value into a json or yaml valid datatype
:param input_value: object of any datatype
:return: object with json valid datatype
'''
# pass normal json/yaml datatypes
if input_value.__class__.__name__ in ['bool', 'str', 'float', 'int', 'NoneT... | a function to transform a value into a json or yaml valid datatype
:param input_value: object of any datatype
:return: object with json valid datatype
| a function to transform a value into a json or yaml valid datatype | [
"a",
"function",
"to",
"transform",
"a",
"value",
"into",
"a",
"json",
"or",
"yaml",
"valid",
"datatype"
] | def clean_data(input_value):
if input_value.__class__.__name__ in ['bool', 'str', 'float', 'int', 'NoneType']:
pass
elif isinstance(input_value, bytes):
from base64 import b64encode
input_value = b64encode(input_value).decode()
elif isinstance(input_value, tuple) or isinstance(input_... | [
"def",
"clean_data",
"(",
"input_value",
")",
":",
"if",
"input_value",
".",
"__class__",
".",
"__name__",
"in",
"[",
"'bool'",
",",
"'str'",
",",
"'float'",
",",
"'int'",
",",
"'NoneType'",
"]",
":",
"pass",
"elif",
"isinstance",
"(",
"input_value",
",",
... | a function to transform a value into a json or yaml valid datatype | [
"a",
"function",
"to",
"transform",
"a",
"value",
"into",
"a",
"json",
"or",
"yaml",
"valid",
"datatype"
] | [
"''' a function to transform a value into a json or yaml valid datatype\n\n :param input_value: object of any datatype\n :return: object with json valid datatype\n '''",
"# pass normal json/yaml datatypes",
"# transform byte data to base64 encoded string",
"# convert tuples and sets into lists",
"#... | [
{
"param": "input_value",
"type": null
}
] | {
"returns": [
{
"docstring": "object with json valid datatype",
"docstring_tokens": [
"object",
"with",
"json",
"valid",
"datatype"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "input_value",
"type": null,... |
bc0f4de7053e58c4775bf72e16cd19da85ac944f | collectiveacuity/labPack | labpack/mapping/data.py | [
"MIT"
] | Python | reconstruct_dict | <not_specific> | def reconstruct_dict(dot_paths, values):
''' a method for reconstructing a dictionary from the values along dot paths '''
output_dict = {}
for i in range(len(dot_paths)):
if i + 1 <= len(values):
path_segments = segment_path(dot_paths[i])
current_nest = output_... | a method for reconstructing a dictionary from the values along dot paths | a method for reconstructing a dictionary from the values along dot paths | [
"a",
"method",
"for",
"reconstructing",
"a",
"dictionary",
"from",
"the",
"values",
"along",
"dot",
"paths"
] | def reconstruct_dict(dot_paths, values):
output_dict = {}
for i in range(len(dot_paths)):
if i + 1 <= len(values):
path_segments = segment_path(dot_paths[i])
current_nest = output_dict
for j in range(len(path_segments)):
key_name = path_segments[j]
... | [
"def",
"reconstruct_dict",
"(",
"dot_paths",
",",
"values",
")",
":",
"output_dict",
"=",
"{",
"}",
"for",
"i",
"in",
"range",
"(",
"len",
"(",
"dot_paths",
")",
")",
":",
"if",
"i",
"+",
"1",
"<=",
"len",
"(",
"values",
")",
":",
"path_segments",
... | a method for reconstructing a dictionary from the values along dot paths | [
"a",
"method",
"for",
"reconstructing",
"a",
"dictionary",
"from",
"the",
"values",
"along",
"dot",
"paths"
] | [
"''' a method for reconstructing a dictionary from the values along dot paths '''"
] | [
{
"param": "dot_paths",
"type": null
},
{
"param": "values",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "dot_paths",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "values",
"type": null,
"docstring": null,
"docstring_tok... |
b3f68079eb3dde8a0ca046805b82c1b8d51928e2 | collectiveacuity/labPack | labpack/encryption/cryptolab.py | [
"MIT"
] | Python | encrypt | <not_specific> | def encrypt(byte_data, secret_key=''):
'''
uses cryptography module to encrypt byte data
cipher: AES (128 bit block_size)
hash: sha512
key size: 256 bit (first 32 bytes of secret key hash)
vector size: 128 bit (next 16 bytes of secret key hash)
padding: PKCS7... |
uses cryptography module to encrypt byte data
cipher: AES (128 bit block_size)
hash: sha512
key size: 256 bit (first 32 bytes of secret key hash)
vector size: 128 bit (next 16 bytes of secret key hash)
padding: PKCS7
cipher mode: CBC
backend: open... |
if secret_key is left blank,
method generates a 32 byte hexadecimal string | [
"if",
"secret_key",
"is",
"left",
"blank",
"method",
"generates",
"a",
"32",
"byte",
"hexadecimal",
"string"
] | def encrypt(byte_data, secret_key=''):
if not isinstance(byte_data, bytes):
raise TypeError('\nbyte data input must be a byte datatype.')
if secret_key:
if not isinstance(secret_key, str):
raise TypeError('\nsecret key input must be a utf-8 encoded string.')
else:
from os... | [
"def",
"encrypt",
"(",
"byte_data",
",",
"secret_key",
"=",
"''",
")",
":",
"if",
"not",
"isinstance",
"(",
"byte_data",
",",
"bytes",
")",
":",
"raise",
"TypeError",
"(",
"'\\nbyte data input must be a byte datatype.'",
")",
"if",
"secret_key",
":",
"if",
"no... | uses cryptography module to encrypt byte data
cipher: AES (128 bit block_size)
hash: sha512
key size: 256 bit (first 32 bytes of secret key hash)
vector size: 128 bit (next 16 bytes of secret key hash)
padding: PKCS7
cipher mode: CBC
backend: openssl 1.0.2a | [
"uses",
"cryptography",
"module",
"to",
"encrypt",
"byte",
"data",
"cipher",
":",
"AES",
"(",
"128",
"bit",
"block_size",
")",
"hash",
":",
"sha512",
"key",
"size",
":",
"256",
"bit",
"(",
"first",
"32",
"bytes",
"of",
"secret",
"key",
"hash",
")",
"ve... | [
"'''\r\n uses cryptography module to encrypt byte data\r\n cipher: AES (128 bit block_size)\r\n hash: sha512\r\n key size: 256 bit (first 32 bytes of secret key hash)\r\n vector size: 128 bit (next 16 bytes of secret key hash)\r\n padding: PKCS7\r\n cipher mode: CBC\... | [
{
"param": "byte_data",
"type": null
},
{
"param": "secret_key",
"type": null
}
] | {
"returns": [
{
"docstring": "encrypted byte data, secret key hex string",
"docstring_tokens": [
"encrypted",
"byte",
"data",
"secret",
"key",
"hex",
"string"
],
"type": null
}
],
"raises": [],
"params": [
{
"iden... |
355bad837ad8647b851235c6c82183a24e2353d1 | collectiveacuity/labPack | labpack/platforms/apscheduler.py | [
"MIT"
] | Python | list_jobs | <not_specific> | def list_jobs(self, argument_filters=None):
'''
a method to list jobs in the scheduler
:param argument_filters: list of query criteria dictionaries for class argument keys
:return: list of jobs (which satisfy the filters)
NOTE: query criteria architecture
... |
a method to list jobs in the scheduler
:param argument_filters: list of query criteria dictionaries for class argument keys
:return: list of jobs (which satisfy the filters)
NOTE: query criteria architecture
each item in the argument filters list must be... | a method to list jobs in the scheduler | [
"a",
"method",
"to",
"list",
"jobs",
"in",
"the",
"scheduler"
] | def list_jobs(self, argument_filters=None):
title = '%s.list_jobs' % self.__class__.__name__
if argument_filters:
self.fields.validate(argument_filters, '.argument_filters')
url = '%s/scheduler/jobs' % self.url
job_list = self._get_request(url)
def query_function(**kw... | [
"def",
"list_jobs",
"(",
"self",
",",
"argument_filters",
"=",
"None",
")",
":",
"title",
"=",
"'%s.list_jobs'",
"%",
"self",
".",
"__class__",
".",
"__name__",
"if",
"argument_filters",
":",
"self",
".",
"fields",
".",
"validate",
"(",
"argument_filters",
"... | a method to list jobs in the scheduler | [
"a",
"method",
"to",
"list",
"jobs",
"in",
"the",
"scheduler"
] | [
"'''\r\n a method to list jobs in the scheduler\r\n\r\n :param argument_filters: list of query criteria dictionaries for class argument keys\r\n :return: list of jobs (which satisfy the filters)\r\n\r\n NOTE: query criteria architecture\r\n\r\n each item in the argum... | [
{
"param": "self",
"type": null
},
{
"param": "argument_filters",
"type": null
}
] | {
"returns": [
{
"docstring": "list of jobs (which satisfy the filters)\nNOTE: query criteria architecture\n\neach item in the argument filters list must be a dictionary\nwhich is composed of one or more key names which represent the\ndotpath to a key in the job record to be queried with a value\nthat is ... |
b460eb6c9b294a37b9d340d7179f210df2587f6d | collectiveacuity/labPack | labpack/parsing/shell.py | [
"MIT"
] | Python | convert_table | <not_specific> | def convert_table(shell_output, delimiter='\t|\s{2,}', output='dict'):
'''
a method to convert a STDOUT shell table into a python data structure
:param shell_output: string from STDOUT with headers
:param delimiter: string with regex pattern delimiting headers
:param output: string wit... |
a method to convert a STDOUT shell table into a python data structure
:param shell_output: string from STDOUT with headers
:param delimiter: string with regex pattern delimiting headers
:param output: string with type of structure to output (dict, list or csv)
:return: list of dictiona... | a method to convert a STDOUT shell table into a python data structure | [
"a",
"method",
"to",
"convert",
"a",
"STDOUT",
"shell",
"table",
"into",
"a",
"python",
"data",
"structure"
] | def convert_table(shell_output, delimiter='\t|\s{2,}', output='dict'):
import re
gap_pattern = re.compile(delimiter)
output_lines = shell_output.splitlines()
column_headers = gap_pattern.split(output_lines[0])
blank_index = column_headers.index('')
if blank_index > -1:
column_headers.pop... | [
"def",
"convert_table",
"(",
"shell_output",
",",
"delimiter",
"=",
"'\\t|\\s{2,}'",
",",
"output",
"=",
"'dict'",
")",
":",
"import",
"re",
"gap_pattern",
"=",
"re",
".",
"compile",
"(",
"delimiter",
")",
"output_lines",
"=",
"shell_output",
".",
"splitlines"... | a method to convert a STDOUT shell table into a python data structure | [
"a",
"method",
"to",
"convert",
"a",
"STDOUT",
"shell",
"table",
"into",
"a",
"python",
"data",
"structure"
] | [
"'''\n a method to convert a STDOUT shell table into a python data structure\n \n :param shell_output: string from STDOUT with headers\n :param delimiter: string with regex pattern delimiting headers\n :param output: string with type of structure to output (dict, list or csv)\n :return: li... | [
{
"param": "shell_output",
"type": null
},
{
"param": "delimiter",
"type": null
},
{
"param": "output",
"type": null
}
] | {
"returns": [
{
"docstring": "list of dictionaries or list of lists or string with csv format",
"docstring_tokens": [
"list",
"of",
"dictionaries",
"or",
"list",
"of",
"lists",
"or",
"string",
"with",
"csv",
... |
d1578ff7f5ca3d438a334c2c3c0abea207a0445b | collectiveacuity/labPack | labpack/records/time.py | [
"MIT"
] | Python | new | <not_specific> | def new(cls):
''' a method to generate the current datetime as a labDT object
:return: labDT object
'''
dT = datetime.utcnow().replace(tzinfo=pytz.utc)
dt_kwargs = {
'year': dT.year,
'month': dT.month,
'day': dT.day,
... | a method to generate the current datetime as a labDT object
:return: labDT object
| a method to generate the current datetime as a labDT object | [
"a",
"method",
"to",
"generate",
"the",
"current",
"datetime",
"as",
"a",
"labDT",
"object"
] | def new(cls):
dT = datetime.utcnow().replace(tzinfo=pytz.utc)
dt_kwargs = {
'year': dT.year,
'month': dT.month,
'day': dT.day,
'hour': dT.hour,
'minute': dT.minute,
'second': dT.second,
'microsecond': dT.microsecond,
... | [
"def",
"new",
"(",
"cls",
")",
":",
"dT",
"=",
"datetime",
".",
"utcnow",
"(",
")",
".",
"replace",
"(",
"tzinfo",
"=",
"pytz",
".",
"utc",
")",
"dt_kwargs",
"=",
"{",
"'year'",
":",
"dT",
".",
"year",
",",
"'month'",
":",
"dT",
".",
"month",
"... | a method to generate the current datetime as a labDT object | [
"a",
"method",
"to",
"generate",
"the",
"current",
"datetime",
"as",
"a",
"labDT",
"object"
] | [
"''' a method to generate the current datetime as a labDT object\r\n \r\n :return: labDT object\r\n '''"
] | [
{
"param": "cls",
"type": null
}
] | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "cls",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
... |
d1578ff7f5ca3d438a334c2c3c0abea207a0445b | collectiveacuity/labPack | labpack/records/time.py | [
"MIT"
] | Python | zulu | <not_specific> | def zulu(self):
''' a method to report ISO UTC datetime string from a labDT object
NOTE: for timezone offset string use .isoformat() instead
:return: string in ISO UTC format
'''
# construct ISO UTC string from labDT
utc_dt = self.astimezone(pytz.utc)
i... | a method to report ISO UTC datetime string from a labDT object
NOTE: for timezone offset string use .isoformat() instead
:return: string in ISO UTC format
| a method to report ISO UTC datetime string from a labDT object
NOTE: for timezone offset string use .isoformat() instead | [
"a",
"method",
"to",
"report",
"ISO",
"UTC",
"datetime",
"string",
"from",
"a",
"labDT",
"object",
"NOTE",
":",
"for",
"timezone",
"offset",
"string",
"use",
".",
"isoformat",
"()",
"instead"
] | def zulu(self):
utc_dt = self.astimezone(pytz.utc)
iso_dt = utc_dt.isoformat()
return iso_dt.replace('+00:00', 'Z') | [
"def",
"zulu",
"(",
"self",
")",
":",
"utc_dt",
"=",
"self",
".",
"astimezone",
"(",
"pytz",
".",
"utc",
")",
"iso_dt",
"=",
"utc_dt",
".",
"isoformat",
"(",
")",
"return",
"iso_dt",
".",
"replace",
"(",
"'+00:00'",
",",
"'Z'",
")"
] | a method to report ISO UTC datetime string from a labDT object
NOTE: for timezone offset string use .isoformat() instead | [
"a",
"method",
"to",
"report",
"ISO",
"UTC",
"datetime",
"string",
"from",
"a",
"labDT",
"object",
"NOTE",
":",
"for",
"timezone",
"offset",
"string",
"use",
".",
"isoformat",
"()",
"instead"
] | [
"''' a method to report ISO UTC datetime string from a labDT object\r\n\r\n NOTE: for timezone offset string use .isoformat() instead\r\n\r\n :return: string in ISO UTC format\r\n '''",
"# construct ISO UTC string from labDT\r"
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [
{
"docstring": "string in ISO UTC format",
"docstring_tokens": [
"string",
"in",
"ISO",
"UTC",
"format"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": n... |
d1578ff7f5ca3d438a334c2c3c0abea207a0445b | collectiveacuity/labPack | labpack/records/time.py | [
"MIT"
] | Python | epoch | <not_specific> | def epoch(self):
''' a method to report posix epoch timestamp from a labDT object
:return: float with timestamp
'''
# construct epoch timestamp from labDT
epoch_dt = datetime.utcfromtimestamp(0).replace(tzinfo=pytz.utc)
delta_time = self - epoch_dt
return... | a method to report posix epoch timestamp from a labDT object
:return: float with timestamp
| a method to report posix epoch timestamp from a labDT object | [
"a",
"method",
"to",
"report",
"posix",
"epoch",
"timestamp",
"from",
"a",
"labDT",
"object"
] | def epoch(self):
epoch_dt = datetime.utcfromtimestamp(0).replace(tzinfo=pytz.utc)
delta_time = self - epoch_dt
return delta_time.total_seconds() | [
"def",
"epoch",
"(",
"self",
")",
":",
"epoch_dt",
"=",
"datetime",
".",
"utcfromtimestamp",
"(",
"0",
")",
".",
"replace",
"(",
"tzinfo",
"=",
"pytz",
".",
"utc",
")",
"delta_time",
"=",
"self",
"-",
"epoch_dt",
"return",
"delta_time",
".",
"total_secon... | a method to report posix epoch timestamp from a labDT object | [
"a",
"method",
"to",
"report",
"posix",
"epoch",
"timestamp",
"from",
"a",
"labDT",
"object"
] | [
"''' a method to report posix epoch timestamp from a labDT object\r\n\r\n :return: float with timestamp\r\n '''",
"# construct epoch timestamp from labDT\r"
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [
{
"docstring": "float with timestamp",
"docstring_tokens": [
"float",
"with",
"timestamp"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens":... |
d1578ff7f5ca3d438a334c2c3c0abea207a0445b | collectiveacuity/labPack | labpack/records/time.py | [
"MIT"
] | Python | pyLocal | <not_specific> | def pyLocal(self, time_zone=''):
''' a method to report a python datetime from a labDT object
:param time_zone: [optional] string with timezone to report in
:return: string with date and time info
'''
# validate inputs
get_tz = get_localzone()
title = 'Ti... | a method to report a python datetime from a labDT object
:param time_zone: [optional] string with timezone to report in
:return: string with date and time info
| a method to report a python datetime from a labDT object | [
"a",
"method",
"to",
"report",
"a",
"python",
"datetime",
"from",
"a",
"labDT",
"object"
] | def pyLocal(self, time_zone=''):
get_tz = get_localzone()
title = 'Timezone input for labDT.pyLocal'
if time_zone:
try:
get_tz = tz.gettz(time_zone)
except:
raise ValueError('\n%s is not a valid timezone format. Try:\nfor tz in pytz.all_tim... | [
"def",
"pyLocal",
"(",
"self",
",",
"time_zone",
"=",
"''",
")",
":",
"get_tz",
"=",
"get_localzone",
"(",
")",
"title",
"=",
"'Timezone input for labDT.pyLocal'",
"if",
"time_zone",
":",
"try",
":",
"get_tz",
"=",
"tz",
".",
"gettz",
"(",
"time_zone",
")"... | a method to report a python datetime from a labDT object | [
"a",
"method",
"to",
"report",
"a",
"python",
"datetime",
"from",
"a",
"labDT",
"object"
] | [
"''' a method to report a python datetime from a labDT object\r\n\r\n :param time_zone: [optional] string with timezone to report in\r\n :return: string with date and time info\r\n '''",
"# validate inputs\r",
"# if time_zone.lower() in ('utc', 'uct', 'universal', 'zulu'):\r",
"# rais... | [
{
"param": "self",
"type": null
},
{
"param": "time_zone",
"type": null
}
] | {
"returns": [
{
"docstring": "string with date and time info",
"docstring_tokens": [
"string",
"with",
"date",
"and",
"time",
"info"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "self",
"type": nul... |
d1578ff7f5ca3d438a334c2c3c0abea207a0445b | collectiveacuity/labPack | labpack/records/time.py | [
"MIT"
] | Python | jsLocal | <not_specific> | def jsLocal(self, time_zone=''):
''' a method to report a javascript string from a labDT object
:param time_zone: [optional] string with timezone to report in
:return: string with date and time info
'''
# validate inputs
js_format = '%a %b %d %Y %H:%M:%S GMT%z (%Z... | a method to report a javascript string from a labDT object
:param time_zone: [optional] string with timezone to report in
:return: string with date and time info
| a method to report a javascript string from a labDT object | [
"a",
"method",
"to",
"report",
"a",
"javascript",
"string",
"from",
"a",
"labDT",
"object"
] | def jsLocal(self, time_zone=''):
js_format = '%a %b %d %Y %H:%M:%S GMT%z (%Z)'
title = 'Timezone input for labDT.jsLocal'
get_tz = get_localzone()
if time_zone:
try:
get_tz = tz.gettz(time_zone)
except:
raise ValueError('\n%s is not... | [
"def",
"jsLocal",
"(",
"self",
",",
"time_zone",
"=",
"''",
")",
":",
"js_format",
"=",
"'%a %b %d %Y %H:%M:%S GMT%z (%Z)'",
"title",
"=",
"'Timezone input for labDT.jsLocal'",
"get_tz",
"=",
"get_localzone",
"(",
")",
"if",
"time_zone",
":",
"try",
":",
"get_tz",... | a method to report a javascript string from a labDT object | [
"a",
"method",
"to",
"report",
"a",
"javascript",
"string",
"from",
"a",
"labDT",
"object"
] | [
"''' a method to report a javascript string from a labDT object\r\n\r\n :param time_zone: [optional] string with timezone to report in\r\n :return: string with date and time info\r\n '''",
"# validate inputs\r",
"# if time_zone.lower() in ('utc', 'uct', 'universal', 'zulu'):\r",
"# ra... | [
{
"param": "self",
"type": null
},
{
"param": "time_zone",
"type": null
}
] | {
"returns": [
{
"docstring": "string with date and time info",
"docstring_tokens": [
"string",
"with",
"date",
"and",
"time",
"info"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "self",
"type": nul... |
d1578ff7f5ca3d438a334c2c3c0abea207a0445b | collectiveacuity/labPack | labpack/records/time.py | [
"MIT"
] | Python | humanFriendly | <not_specific> | def humanFriendly(self, time_zone='', include_day=True, include_time=True):
''' a method to report a human friendly string from a labDT object
:param time_zone: [optional] string with timezone to report in
:return: string with date and time info
'''
# validate inputs
... | a method to report a human friendly string from a labDT object
:param time_zone: [optional] string with timezone to report in
:return: string with date and time info
| a method to report a human friendly string from a labDT object | [
"a",
"method",
"to",
"report",
"a",
"human",
"friendly",
"string",
"from",
"a",
"labDT",
"object"
] | def humanFriendly(self, time_zone='', include_day=True, include_time=True):
zeroHourPattern = re.compile('\s0\d:')
title = 'Timezone input for labDT.humanFriendly'
human_format = ''
if include_day:
human_format += '%A, '
human_format += '%B %d, %Y'
if include_... | [
"def",
"humanFriendly",
"(",
"self",
",",
"time_zone",
"=",
"''",
",",
"include_day",
"=",
"True",
",",
"include_time",
"=",
"True",
")",
":",
"zeroHourPattern",
"=",
"re",
".",
"compile",
"(",
"'\\s0\\d:'",
")",
"title",
"=",
"'Timezone input for labDT.humanF... | a method to report a human friendly string from a labDT object | [
"a",
"method",
"to",
"report",
"a",
"human",
"friendly",
"string",
"from",
"a",
"labDT",
"object"
] | [
"''' a method to report a human friendly string from a labDT object\r\n\r\n :param time_zone: [optional] string with timezone to report in\r\n :return: string with date and time info\r\n '''",
"# validate inputs\r",
"# if time_zone.lower() in ('utc', 'uct', 'universal', 'zulu'):\r",
"# ... | [
{
"param": "self",
"type": null
},
{
"param": "time_zone",
"type": null
},
{
"param": "include_day",
"type": null
},
{
"param": "include_time",
"type": null
}
] | {
"returns": [
{
"docstring": "string with date and time info",
"docstring_tokens": [
"string",
"with",
"date",
"and",
"time",
"info"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "self",
"type": nul... |
d1578ff7f5ca3d438a334c2c3c0abea207a0445b | collectiveacuity/labPack | labpack/records/time.py | [
"MIT"
] | Python | fromEpoch | <not_specific> | def fromEpoch(cls, epoch_time):
''' a method for constructing a labDT object from epoch timestamp
:param epoch_time: number with epoch timestamp info
:return: labDT object
'''
# validate input
title = 'Epoch time input for labDT.fromEpoch'
if not isinstan... | a method for constructing a labDT object from epoch timestamp
:param epoch_time: number with epoch timestamp info
:return: labDT object
| a method for constructing a labDT object from epoch timestamp | [
"a",
"method",
"for",
"constructing",
"a",
"labDT",
"object",
"from",
"epoch",
"timestamp"
] | def fromEpoch(cls, epoch_time):
title = 'Epoch time input for labDT.fromEpoch'
if not isinstance(epoch_time, float) and not isinstance(epoch_time, int):
raise TypeError('\n%s must be an integer or float.' % title)
dT = datetime.utcfromtimestamp(epoch_time).replace(tzinfo=pytz.utc)
... | [
"def",
"fromEpoch",
"(",
"cls",
",",
"epoch_time",
")",
":",
"title",
"=",
"'Epoch time input for labDT.fromEpoch'",
"if",
"not",
"isinstance",
"(",
"epoch_time",
",",
"float",
")",
"and",
"not",
"isinstance",
"(",
"epoch_time",
",",
"int",
")",
":",
"raise",
... | a method for constructing a labDT object from epoch timestamp | [
"a",
"method",
"for",
"constructing",
"a",
"labDT",
"object",
"from",
"epoch",
"timestamp"
] | [
"''' a method for constructing a labDT object from epoch timestamp\r\n\r\n :param epoch_time: number with epoch timestamp info\r\n :return: labDT object\r\n '''",
"# validate input\r",
"# construct labDT from epoch time\r"
] | [
{
"param": "cls",
"type": null
},
{
"param": "epoch_time",
"type": null
}
] | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "cls",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
... |
d1578ff7f5ca3d438a334c2c3c0abea207a0445b | collectiveacuity/labPack | labpack/records/time.py | [
"MIT"
] | Python | fromISO | <not_specific> | def fromISO(cls, iso_string):
''' a method for constructing a labDT object from a timezone aware ISO string
:param iso_string: string with date and time info in ISO format
:return: labDT object
'''
# validate input
title = 'ISO time input for labDT.fromISO... | a method for constructing a labDT object from a timezone aware ISO string
:param iso_string: string with date and time info in ISO format
:return: labDT object
| a method for constructing a labDT object from a timezone aware ISO string | [
"a",
"method",
"for",
"constructing",
"a",
"labDT",
"object",
"from",
"a",
"timezone",
"aware",
"ISO",
"string"
] | def fromISO(cls, iso_string):
title = 'ISO time input for labDT.fromISO'
isopattern = re.compile('\d{4}-?\d{2}-?\d{2}[\s|T].*')
if not isopattern.search(iso_string):
raise ValueError('\n%s is not a valid ISO string.' % title)
python_datetime = dTparser.parse(iso_string)
... | [
"def",
"fromISO",
"(",
"cls",
",",
"iso_string",
")",
":",
"title",
"=",
"'ISO time input for labDT.fromISO'",
"isopattern",
"=",
"re",
".",
"compile",
"(",
"'\\d{4}-?\\d{2}-?\\d{2}[\\s|T].*'",
")",
"if",
"not",
"isopattern",
".",
"search",
"(",
"iso_string",
")",... | a method for constructing a labDT object from a timezone aware ISO string | [
"a",
"method",
"for",
"constructing",
"a",
"labDT",
"object",
"from",
"a",
"timezone",
"aware",
"ISO",
"string"
] | [
"''' a method for constructing a labDT object from a timezone aware ISO string\r\n \r\n :param iso_string: string with date and time info in ISO format\r\n :return: labDT object\r\n '''",
"# validate input\r",
"# construct labDT from parsed string\r"
] | [
{
"param": "cls",
"type": null
},
{
"param": "iso_string",
"type": null
}
] | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "cls",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
... |
d1578ff7f5ca3d438a334c2c3c0abea207a0445b | collectiveacuity/labPack | labpack/records/time.py | [
"MIT"
] | Python | fromPython | <not_specific> | def fromPython(cls, python_datetime):
''' a method for constructing a labDT from a python datetime with timezone info
:param python_datetime: datetime object with timezone info
:return: labDT object
'''
# validate inputs
title = 'Python datetime input for ... | a method for constructing a labDT from a python datetime with timezone info
:param python_datetime: datetime object with timezone info
:return: labDT object
| a method for constructing a labDT from a python datetime with timezone info | [
"a",
"method",
"for",
"constructing",
"a",
"labDT",
"from",
"a",
"python",
"datetime",
"with",
"timezone",
"info"
] | def fromPython(cls, python_datetime):
title = 'Python datetime input for labDT.fromPython'
if not isinstance(python_datetime, datetime):
raise TypeError('\n%s must be a valid %s object.' % (title, datetime.__class__))
elif not python_datetime.tzinfo:
raise ValueError('\n%... | [
"def",
"fromPython",
"(",
"cls",
",",
"python_datetime",
")",
":",
"title",
"=",
"'Python datetime input for labDT.fromPython'",
"if",
"not",
"isinstance",
"(",
"python_datetime",
",",
"datetime",
")",
":",
"raise",
"TypeError",
"(",
"'\\n%s must be a valid %s object.'"... | a method for constructing a labDT from a python datetime with timezone info | [
"a",
"method",
"for",
"constructing",
"a",
"labDT",
"from",
"a",
"python",
"datetime",
"with",
"timezone",
"info"
] | [
"''' a method for constructing a labDT from a python datetime with timezone info\r\n \r\n :param python_datetime: datetime object with timezone info\r\n :return: labDT object\r\n '''",
"# validate inputs\r",
"# construct labDT from python datetime\r"
] | [
{
"param": "cls",
"type": null
},
{
"param": "python_datetime",
"type": null
}
] | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "cls",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
... |
d1578ff7f5ca3d438a334c2c3c0abea207a0445b | collectiveacuity/labPack | labpack/records/time.py | [
"MIT"
] | Python | fromJavascript | <not_specific> | def fromJavascript(cls, javascript_datetime):
''' a method to construct labDT from a javascript datetime string
:param javascript_datetime: string with datetime info in javascript formatting
:return: labDT object
'''
# validate inputs
title = 'Javascript d... | a method to construct labDT from a javascript datetime string
:param javascript_datetime: string with datetime info in javascript formatting
:return: labDT object
| a method to construct labDT from a javascript datetime string | [
"a",
"method",
"to",
"construct",
"labDT",
"from",
"a",
"javascript",
"datetime",
"string"
] | def fromJavascript(cls, javascript_datetime):
title = 'Javascript datetime string input for labDT.fromJavascript'
jsDTpattern = re.compile('\s*\(.*\)$')
jsGMTpattern = re.compile('GMT[-\+]\d{4}')
if not jsGMTpattern.findall(javascript_datetime):
raise Exception('\n%s must hav... | [
"def",
"fromJavascript",
"(",
"cls",
",",
"javascript_datetime",
")",
":",
"title",
"=",
"'Javascript datetime string input for labDT.fromJavascript'",
"jsDTpattern",
"=",
"re",
".",
"compile",
"(",
"'\\s*\\(.*\\)$'",
")",
"jsGMTpattern",
"=",
"re",
".",
"compile",
"(... | a method to construct labDT from a javascript datetime string | [
"a",
"method",
"to",
"construct",
"labDT",
"from",
"a",
"javascript",
"datetime",
"string"
] | [
"''' a method to construct labDT from a javascript datetime string\r\n \r\n :param javascript_datetime: string with datetime info in javascript formatting\r\n :return: labDT object\r\n '''",
"# validate inputs\r",
"# construct datetime from javascript string\r"
] | [
{
"param": "cls",
"type": null
},
{
"param": "javascript_datetime",
"type": null
}
] | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "cls",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
... |
59f7fad2589ee5bd266de7dc7ed8025185a97f16 | collectiveacuity/labPack | labpack/parsing/magic.py | [
"MIT"
] | Python | analyze | <not_specific> | def analyze(self, file_path='', file_url='', byte_data=None):
''' a method to determine the mimetype and extension of a file from its byte data
:param file_path: [optional] string with local path to file
:param file_url: [optional] string with url of file
:param byte_data: [optio... | a method to determine the mimetype and extension of a file from its byte data
:param file_path: [optional] string with local path to file
:param file_url: [optional] string with url of file
:param byte_data: [optional] byte data from a file
:return: dictionary with file details
... | a method to determine the mimetype and extension of a file from its byte data | [
"a",
"method",
"to",
"determine",
"the",
"mimetype",
"and",
"extension",
"of",
"a",
"file",
"from",
"its",
"byte",
"data"
] | def analyze(self, file_path='', file_url='', byte_data=None):
title = '%s.analyze' % self.__class__.__name__
input_fields = {
'file_path': file_path,
'file_url': file_url
}
for key, value in input_fields.items():
if value:
object_title ... | [
"def",
"analyze",
"(",
"self",
",",
"file_path",
"=",
"''",
",",
"file_url",
"=",
"''",
",",
"byte_data",
"=",
"None",
")",
":",
"title",
"=",
"'%s.analyze'",
"%",
"self",
".",
"__class__",
".",
"__name__",
"input_fields",
"=",
"{",
"'file_path'",
":",
... | a method to determine the mimetype and extension of a file from its byte data | [
"a",
"method",
"to",
"determine",
"the",
"mimetype",
"and",
"extension",
"of",
"a",
"file",
"from",
"its",
"byte",
"data"
] | [
"''' a method to determine the mimetype and extension of a file from its byte data\r\n\r\n :param file_path: [optional] string with local path to file\r\n :param file_url: [optional] string with url of file\r\n :param byte_data: [optional] byte data from a file\r\n :return: dictionary wi... | [
{
"param": "self",
"type": null
},
{
"param": "file_path",
"type": null
},
{
"param": "file_url",
"type": null
},
{
"param": "byte_data",
"type": null
}
] | {
"returns": [
{
"docstring": "dictionary with file details\n{\n'name': 'filename.ext',\n'mimetype': 'type/sub-type',\n'extension': '.ext'\n}",
"docstring_tokens": [
"dictionary",
"with",
"file",
"details",
"{",
"'",
"name",
"'",
... |
8ddfce73d8b4673239dabfd8319c016303fe5914 | collectiveacuity/labPack | labpack/messaging/telegram.py | [
"MIT"
] | Python | _get_data | <not_specific> | def _get_data(self, file_url, file_name='', method_title='', argument_title=''):
''' a helper method to retrieve data buffer for a file url
:param file_url: string with url to file
:param file_name: [optional] string with name to affix to file buffer
:param method_title: [optiona... | a helper method to retrieve data buffer for a file url
:param file_url: string with url to file
:param file_name: [optional] string with name to affix to file buffer
:param method_title: [optional] string with name of class method calling
:param argument_title: [optional] string w... | a helper method to retrieve data buffer for a file url | [
"a",
"helper",
"method",
"to",
"retrieve",
"data",
"buffer",
"for",
"a",
"file",
"url"
] | def _get_data(self, file_url, file_name='', method_title='', argument_title=''):
import io
import requests
if not file_name:
file_name = 'file'
if not method_title:
method_title = '%s._get_data' % self.__class__.__name__
if not argument_title:
... | [
"def",
"_get_data",
"(",
"self",
",",
"file_url",
",",
"file_name",
"=",
"''",
",",
"method_title",
"=",
"''",
",",
"argument_title",
"=",
"''",
")",
":",
"import",
"io",
"import",
"requests",
"if",
"not",
"file_name",
":",
"file_name",
"=",
"'file'",
"i... | a helper method to retrieve data buffer for a file url | [
"a",
"helper",
"method",
"to",
"retrieve",
"data",
"buffer",
"for",
"a",
"file",
"url"
] | [
"''' a helper method to retrieve data buffer for a file url\r\n\r\n :param file_url: string with url to file\r\n :param file_name: [optional] string with name to affix to file buffer\r\n :param method_title: [optional] string with name of class method calling\r\n :param argument_title: [... | [
{
"param": "self",
"type": null
},
{
"param": "file_url",
"type": null
},
{
"param": "file_name",
"type": null
},
{
"param": "method_title",
"type": null
},
{
"param": "argument_title",
"type": null
}
] | {
"returns": [
{
"docstring": "byte data buffer with file data",
"docstring_tokens": [
"byte",
"data",
"buffer",
"with",
"file",
"data"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "self",
"type": n... |
8ddfce73d8b4673239dabfd8319c016303fe5914 | collectiveacuity/labPack | labpack/messaging/telegram.py | [
"MIT"
] | Python | _validate_type | <not_specific> | def _validate_type(self, file_name, extension_map, method_title, argument_title):
''' a helper method to validate extension type of file
:param file_name: string with file name to test
:param extension_map: dictionary with extensions names and regex patterns
:param method_title: ... | a helper method to validate extension type of file
:param file_name: string with file name to test
:param extension_map: dictionary with extensions names and regex patterns
:param method_title: string with title of feeder method
:param argument_title: string with title of argument... | a helper method to validate extension type of file | [
"a",
"helper",
"method",
"to",
"validate",
"extension",
"type",
"of",
"file"
] | def _validate_type(self, file_name, extension_map, method_title, argument_title):
from labpack.parsing.regex import labRegex
file_extension = ''
ext_types = labRegex(extension_map)
file_mapping = ext_types.map(file_name)[0]
extension_list = []
for key, value in file_mappi... | [
"def",
"_validate_type",
"(",
"self",
",",
"file_name",
",",
"extension_map",
",",
"method_title",
",",
"argument_title",
")",
":",
"from",
"labpack",
".",
"parsing",
".",
"regex",
"import",
"labRegex",
"file_extension",
"=",
"''",
"ext_types",
"=",
"labRegex",
... | a helper method to validate extension type of file | [
"a",
"helper",
"method",
"to",
"validate",
"extension",
"type",
"of",
"file"
] | [
"''' a helper method to validate extension type of file\r\n\r\n :param file_name: string with file name to test\r\n :param extension_map: dictionary with extensions names and regex patterns\r\n :param method_title: string with title of feeder method\r\n :param argument_title: string with... | [
{
"param": "self",
"type": null
},
{
"param": "file_name",
"type": null
},
{
"param": "extension_map",
"type": null
},
{
"param": "method_title",
"type": null
},
{
"param": "argument_title",
"type": null
}
] | {
"returns": [
{
"docstring": "string with file extension",
"docstring_tokens": [
"string",
"with",
"file",
"extension"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
... |
8ddfce73d8b4673239dabfd8319c016303fe5914 | collectiveacuity/labPack | labpack/messaging/telegram.py | [
"MIT"
] | Python | _compile_buttons | <not_specific> | def _compile_buttons(self, button_list, small_buttons, persist_buttons):
''' a helper method to compile buttons to telegram api format
:param button_list: list of strings with button values
:param small_buttons: boolean to resize buttons to fit text size
:param persist_buttons: b... | a helper method to compile buttons to telegram api format
:param button_list: list of strings with button values
:param small_buttons: boolean to resize buttons to fit text size
:param persist_buttons: boolean to keep buttons around after exiting
:return: string in json serial for... | a helper method to compile buttons to telegram api format | [
"a",
"helper",
"method",
"to",
"compile",
"buttons",
"to",
"telegram",
"api",
"format"
] | def _compile_buttons(self, button_list, small_buttons, persist_buttons):
import json
keyboard_list = []
for item in button_list:
keyboard_list.append([{'text': item}])
keyboard_kwargs = {
'keyboard': keyboard_list,
'one_time_keyboard': not persist_butt... | [
"def",
"_compile_buttons",
"(",
"self",
",",
"button_list",
",",
"small_buttons",
",",
"persist_buttons",
")",
":",
"import",
"json",
"keyboard_list",
"=",
"[",
"]",
"for",
"item",
"in",
"button_list",
":",
"keyboard_list",
".",
"append",
"(",
"[",
"{",
"'te... | a helper method to compile buttons to telegram api format | [
"a",
"helper",
"method",
"to",
"compile",
"buttons",
"to",
"telegram",
"api",
"format"
] | [
"''' a helper method to compile buttons to telegram api format\r\n\r\n :param button_list: list of strings with button values\r\n :param small_buttons: boolean to resize buttons to fit text size\r\n :param persist_buttons: boolean to keep buttons around after exiting\r\n :return: string ... | [
{
"param": "self",
"type": null
},
{
"param": "button_list",
"type": null
},
{
"param": "small_buttons",
"type": null
},
{
"param": "persist_buttons",
"type": null
}
] | {
"returns": [
{
"docstring": "string in json serial format",
"docstring_tokens": [
"string",
"in",
"json",
"serial",
"format"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docst... |
8ddfce73d8b4673239dabfd8319c016303fe5914 | collectiveacuity/labPack | labpack/messaging/telegram.py | [
"MIT"
] | Python | _compile_keypad | <not_specific> | def _compile_keypad(self, keypad_type, persist_buttons):
''' a helper method to compile keypad buttons to telegram api format
:param keypad_type: string with type of keypad to emulate
:param persist_buttons: boolean to keep buttons around after exiting
:return: string in ... | a helper method to compile keypad buttons to telegram api format
:param keypad_type: string with type of keypad to emulate
:param persist_buttons: boolean to keep buttons around after exiting
:return: string in json serial format
| a helper method to compile keypad buttons to telegram api format | [
"a",
"helper",
"method",
"to",
"compile",
"keypad",
"buttons",
"to",
"telegram",
"api",
"format"
] | def _compile_keypad(self, keypad_type, persist_buttons):
import json
keyboard_list = []
if keypad_type == 'phone':
row_list = [ {'text': '1'}, {'text': '2'}, {'text': '3'} ]
keyboard_list.append(row_list)
row_list = [ {'text': '4'}, {'text': '5'}, {'text': '6'... | [
"def",
"_compile_keypad",
"(",
"self",
",",
"keypad_type",
",",
"persist_buttons",
")",
":",
"import",
"json",
"keyboard_list",
"=",
"[",
"]",
"if",
"keypad_type",
"==",
"'phone'",
":",
"row_list",
"=",
"[",
"{",
"'text'",
":",
"'1'",
"}",
",",
"{",
"'te... | a helper method to compile keypad buttons to telegram api format | [
"a",
"helper",
"method",
"to",
"compile",
"keypad",
"buttons",
"to",
"telegram",
"api",
"format"
] | [
"''' a helper method to compile keypad buttons to telegram api format\r\n\r\n :param keypad_type: string with type of keypad to emulate\r\n :param persist_buttons: boolean to keep buttons around after exiting\r\n :return: string in json serial format\r\n '''"
] | [
{
"param": "self",
"type": null
},
{
"param": "keypad_type",
"type": null
},
{
"param": "persist_buttons",
"type": null
}
] | {
"returns": [
{
"docstring": "string in json serial format",
"docstring_tokens": [
"string",
"in",
"json",
"serial",
"format"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docst... |
8ddfce73d8b4673239dabfd8319c016303fe5914 | collectiveacuity/labPack | labpack/messaging/telegram.py | [
"MIT"
] | Python | send_message | <not_specific> | def send_message(self, user_id, message_text, message_style='', button_list=None, small_buttons=True, persist_buttons=False, link_preview=True):
''' a method to send a message using telegram api
:param user_id: integer with id of telegram user
:param message_text: string with message to u... | a method to send a message using telegram api
:param user_id: integer with id of telegram user
:param message_text: string with message to user
:param message_style: [optional] string with style to apply to text, only 'markdown'
:param button_list: [optional] list of string to inc... | a method to send a message using telegram api | [
"a",
"method",
"to",
"send",
"a",
"message",
"using",
"telegram",
"api"
] | def send_message(self, user_id, message_text, message_style='', button_list=None, small_buttons=True, persist_buttons=False, link_preview=True):
title = '%s.send_message' % self.__class__.__name__
input_fields = {
'user_id': user_id,
'message_text': message_text,
'mes... | [
"def",
"send_message",
"(",
"self",
",",
"user_id",
",",
"message_text",
",",
"message_style",
"=",
"''",
",",
"button_list",
"=",
"None",
",",
"small_buttons",
"=",
"True",
",",
"persist_buttons",
"=",
"False",
",",
"link_preview",
"=",
"True",
")",
":",
... | a method to send a message using telegram api | [
"a",
"method",
"to",
"send",
"a",
"message",
"using",
"telegram",
"api"
] | [
"''' a method to send a message using telegram api\r\n\r\n :param user_id: integer with id of telegram user\r\n :param message_text: string with message to user\r\n :param message_style: [optional] string with style to apply to text, only 'markdown'\r\n :param button_list: [optional] lis... | [
{
"param": "self",
"type": null
},
{
"param": "user_id",
"type": null
},
{
"param": "message_text",
"type": null
},
{
"param": "message_style",
"type": null
},
{
"param": "button_list",
"type": null
},
{
"param": "small_buttons",
"type": null
},
... | {
"returns": [
{
"docstring": "dictionary of response details with message details in [json][result]\n{\n'headers': { ...",
"docstring_tokens": [
"dictionary",
"of",
"response",
"details",
"with",
"message",
"details",
"in",
"[",
... |
8ddfce73d8b4673239dabfd8319c016303fe5914 | collectiveacuity/labPack | labpack/messaging/telegram.py | [
"MIT"
] | Python | send_photo | <not_specific> | def send_photo(self, user_id, photo_id='', photo_path='', photo_url='', caption_text='', button_list=None, small_buttons=True, persist_buttons=False):
''' a method to send a photo using telegram api
:param user_id: integer with id of telegram user
:param photo_id: [optional] string with i... | a method to send a photo using telegram api
:param user_id: integer with id of telegram user
:param photo_id: [optional] string with id of file stored with telegram api
:param photo_path: [optional] string with local path to file
:param photo_url: [optional] string with url of fil... | a method to send a photo using telegram api | [
"a",
"method",
"to",
"send",
"a",
"photo",
"using",
"telegram",
"api"
] | def send_photo(self, user_id, photo_id='', photo_path='', photo_url='', caption_text='', button_list=None, small_buttons=True, persist_buttons=False):
title = '%s.send_photo' % self.__class__.__name__
input_fields = {
'user_id': user_id,
'caption_text': caption_text,
... | [
"def",
"send_photo",
"(",
"self",
",",
"user_id",
",",
"photo_id",
"=",
"''",
",",
"photo_path",
"=",
"''",
",",
"photo_url",
"=",
"''",
",",
"caption_text",
"=",
"''",
",",
"button_list",
"=",
"None",
",",
"small_buttons",
"=",
"True",
",",
"persist_but... | a method to send a photo using telegram api | [
"a",
"method",
"to",
"send",
"a",
"photo",
"using",
"telegram",
"api"
] | [
"''' a method to send a photo using telegram api\r\n\r\n :param user_id: integer with id of telegram user\r\n :param photo_id: [optional] string with id of file stored with telegram api\r\n :param photo_path: [optional] string with local path to file\r\n :param photo_url: [optional] stri... | [
{
"param": "self",
"type": null
},
{
"param": "user_id",
"type": null
},
{
"param": "photo_id",
"type": null
},
{
"param": "photo_path",
"type": null
},
{
"param": "photo_url",
"type": null
},
{
"param": "caption_text",
"type": null
},
{
"p... | {
"returns": [
{
"docstring": "dictionary of response details with message detail in [json][result]\n{\n'headers': { ...",
"docstring_tokens": [
"dictionary",
"of",
"response",
"details",
"with",
"message",
"detail",
"in",
"[",
... |
dd8d73d7e1715e6efd689e8e17552a17bd1a50f9 | collectiveacuity/labPack | labpack/records/ip.py | [
"MIT"
] | Python | describe_ip | <not_specific> | def describe_ip(ip_address, source='whatismyip'):
''' a method to get the details associated with an ip address '''
# determine url
if source == 'nekudo':
source_url = 'https://geoip.nekudo.com/api/%s' % ip_address
elif source == 'geoip':
source_url = 'https://freegeoip.net/json/%s' % ... | a method to get the details associated with an ip address | a method to get the details associated with an ip address | [
"a",
"method",
"to",
"get",
"the",
"details",
"associated",
"with",
"an",
"ip",
"address"
] | def describe_ip(ip_address, source='whatismyip'):
if source == 'nekudo':
source_url = 'https://geoip.nekudo.com/api/%s' % ip_address
elif source == 'geoip':
source_url = 'https://freegeoip.net/json/%s' % ip_address
elif source == 'whatismyip':
source_url = 'https://whatismyipaddress.... | [
"def",
"describe_ip",
"(",
"ip_address",
",",
"source",
"=",
"'whatismyip'",
")",
":",
"if",
"source",
"==",
"'nekudo'",
":",
"source_url",
"=",
"'https://geoip.nekudo.com/api/%s'",
"%",
"ip_address",
"elif",
"source",
"==",
"'geoip'",
":",
"source_url",
"=",
"'... | a method to get the details associated with an ip address | [
"a",
"method",
"to",
"get",
"the",
"details",
"associated",
"with",
"an",
"ip",
"address"
] | [
"''' a method to get the details associated with an ip address '''",
"# determine url",
"# http://whatismyipaddress.com/ip-lookup",
"# TODO incorporate geoip module and c dependencies with local database",
"# http://tech.marksblogg.com/ip-address-lookups-in-python.html",
"# send request",
"# extract res... | [
{
"param": "ip_address",
"type": null
},
{
"param": "source",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "ip_address",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "source",
"type": null,
"docstring": null,
"docstring_to... |
5116b9c35ed88bd98518e78cd6ce7c93a7374e3d | collectiveacuity/labPack | labpack/databases/couchbase.py | [
"MIT"
] | Python | create_view | <not_specific> | def create_view(self, query_criteria=None, uid='_all_users'):
'''
a method to add a view to a design document of a uid
:param query_criteria: dictionary with valid jsonmodel query criteria
:param uid: [optional] string with uid of design document to update
... |
a method to add a view to a design document of a uid
:param query_criteria: dictionary with valid jsonmodel query criteria
:param uid: [optional] string with uid of design document to update
:return: integer with status of operation
an example of how to const... | a method to add a view to a design document of a uid | [
"a",
"method",
"to",
"add",
"a",
"view",
"to",
"a",
"design",
"document",
"of",
"a",
"uid"
] | def create_view(self, query_criteria=None, uid='_all_users'):
title = '%s.create_view' % self.__class__.__name__
input_fields = {
'uid': uid
}
for key, value in input_fields.items():
if value:
object_title = '%s(%s=%s)' % (title, key, str(value))
... | [
"def",
"create_view",
"(",
"self",
",",
"query_criteria",
"=",
"None",
",",
"uid",
"=",
"'_all_users'",
")",
":",
"title",
"=",
"'%s.create_view'",
"%",
"self",
".",
"__class__",
".",
"__name__",
"input_fields",
"=",
"{",
"'uid'",
":",
"uid",
"}",
"for",
... | a method to add a view to a design document of a uid | [
"a",
"method",
"to",
"add",
"a",
"view",
"to",
"a",
"design",
"document",
"of",
"a",
"uid"
] | [
"'''\n a method to add a view to a design document of a uid \n \n :param query_criteria: dictionary with valid jsonmodel query criteria \n :param uid: [optional] string with uid of design document to update\n :return: integer with status of operation\n\n an example ... | [
{
"param": "self",
"type": null
},
{
"param": "query_criteria",
"type": null
},
{
"param": "uid",
"type": null
}
] | {
"returns": [
{
"docstring": "integer with status of operation\nan example of how to construct the query_criteria argument.\n\n\n\nonly fields specified in the document schema at class initialization\ncan be used as fields in query_criteria. otherwise, an error will be thrown.\nuid is automatically added t... |
5116b9c35ed88bd98518e78cd6ce7c93a7374e3d | collectiveacuity/labPack | labpack/databases/couchbase.py | [
"MIT"
] | Python | delete_view | <not_specific> | def delete_view(self, query_criteria=None, uid='_all_users'):
'''
a method to delete a view associated with a user design doc
:param query_criteria: [optional] dictionary with valid jsonmodel query criteria
:param uid: [optional] string with uid of design document to up... |
a method to delete a view associated with a user design doc
:param query_criteria: [optional] dictionary with valid jsonmodel query criteria
:param uid: [optional] string with uid of design document to update
:return: integer with status of operation
... | a method to delete a view associated with a user design doc | [
"a",
"method",
"to",
"delete",
"a",
"view",
"associated",
"with",
"a",
"user",
"design",
"doc"
] | def delete_view(self, query_criteria=None, uid='_all_users'):
title = '%s.delete_view' % self.__class__.__name__
input_fields = {
'uid': uid
}
for key, value in input_fields.items():
if value:
object_title = '%s(%s=%s)' % (title, key, str(value))
... | [
"def",
"delete_view",
"(",
"self",
",",
"query_criteria",
"=",
"None",
",",
"uid",
"=",
"'_all_users'",
")",
":",
"title",
"=",
"'%s.delete_view'",
"%",
"self",
".",
"__class__",
".",
"__name__",
"input_fields",
"=",
"{",
"'uid'",
":",
"uid",
"}",
"for",
... | a method to delete a view associated with a user design doc | [
"a",
"method",
"to",
"delete",
"a",
"view",
"associated",
"with",
"a",
"user",
"design",
"doc"
] | [
"'''\n a method to delete a view associated with a user design doc\n \n :param query_criteria: [optional] dictionary with valid jsonmodel query criteria\n :param uid: [optional] string with uid of design document to update\n :return: integer with status of operation\n ... | [
{
"param": "self",
"type": null
},
{
"param": "query_criteria",
"type": null
},
{
"param": "uid",
"type": null
}
] | {
"returns": [
{
"docstring": "integer with status of operation\nan example of how to construct the query_criteria argument.\n\n\n\nonly fields specified in the document schema at class initialization\ncan be used as fields in query_criteria. otherwise, an error will be thrown.\nuid is automatically added t... |
5116b9c35ed88bd98518e78cd6ce7c93a7374e3d | collectiveacuity/labPack | labpack/databases/couchbase.py | [
"MIT"
] | Python | list_users | <not_specific> | def list_users(self):
''' a method to list all the user ids of all users in the bucket '''
# construct url
url = self.bucket_url + '/_user/'
# send request and unwrap response
response = requests.get(url)
response = response.json()
return response | a method to list all the user ids of all users in the bucket | a method to list all the user ids of all users in the bucket | [
"a",
"method",
"to",
"list",
"all",
"the",
"user",
"ids",
"of",
"all",
"users",
"in",
"the",
"bucket"
] | def list_users(self):
url = self.bucket_url + '/_user/'
response = requests.get(url)
response = response.json()
return response | [
"def",
"list_users",
"(",
"self",
")",
":",
"url",
"=",
"self",
".",
"bucket_url",
"+",
"'/_user/'",
"response",
"=",
"requests",
".",
"get",
"(",
"url",
")",
"response",
"=",
"response",
".",
"json",
"(",
")",
"return",
"response"
] | a method to list all the user ids of all users in the bucket | [
"a",
"method",
"to",
"list",
"all",
"the",
"user",
"ids",
"of",
"all",
"users",
"in",
"the",
"bucket"
] | [
"''' a method to list all the user ids of all users in the bucket '''",
"# construct url",
"# send request and unwrap response"
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
5116b9c35ed88bd98518e78cd6ce7c93a7374e3d | collectiveacuity/labPack | labpack/databases/couchbase.py | [
"MIT"
] | Python | save_user | <not_specific> | def save_user(self, uid, user_password, user_email='', user_channels=None, user_roles=None, user_views=None, disable_account=False):
'''
a method to add or update an authorized user to the bucket
:param uid: string with id to assign to user
:param user_password: string ... |
a method to add or update an authorized user to the bucket
:param uid: string with id to assign to user
:param user_password: string with password to assign to user
:param user_email: [optional] string with email of user for future lookup
:param user_channels: [... | a method to add or update an authorized user to the bucket | [
"a",
"method",
"to",
"add",
"or",
"update",
"an",
"authorized",
"user",
"to",
"the",
"bucket"
] | def save_user(self, uid, user_password, user_email='', user_channels=None, user_roles=None, user_views=None, disable_account=False):
title = '%s.save_user' % self.__class__.__name__
input_fields = {
'uid': uid,
'user_password': user_password,
'user_email': user_email,... | [
"def",
"save_user",
"(",
"self",
",",
"uid",
",",
"user_password",
",",
"user_email",
"=",
"''",
",",
"user_channels",
"=",
"None",
",",
"user_roles",
"=",
"None",
",",
"user_views",
"=",
"None",
",",
"disable_account",
"=",
"False",
")",
":",
"title",
"... | a method to add or update an authorized user to the bucket | [
"a",
"method",
"to",
"add",
"or",
"update",
"an",
"authorized",
"user",
"to",
"the",
"bucket"
] | [
"'''\n a method to add or update an authorized user to the bucket\n \n :param uid: string with id to assign to user\n :param user_password: string with password to assign to user\n :param user_email: [optional] string with email of user for future lookup\n :param us... | [
{
"param": "self",
"type": null
},
{
"param": "uid",
"type": null
},
{
"param": "user_password",
"type": null
},
{
"param": "user_email",
"type": null
},
{
"param": "user_channels",
"type": null
},
{
"param": "user_roles",
"type": null
},
{
... | {
"returns": [
{
"docstring": "integer with status code of user account creation",
"docstring_tokens": [
"integer",
"with",
"status",
"code",
"of",
"user",
"account",
"creation"
],
"type": null
}
],
"raises": [],
"pa... |
5116b9c35ed88bd98518e78cd6ce7c93a7374e3d | collectiveacuity/labPack | labpack/databases/couchbase.py | [
"MIT"
] | Python | load_user | <not_specific> | def load_user(self, uid):
'''
a method to retrieve the account details of a user in the bucket
:param uid: string with id of user in bucket
:return: dictionary with account fields for user
'''
title = '%s.load_user' % self.__class__.__name__
... |
a method to retrieve the account details of a user in the bucket
:param uid: string with id of user in bucket
:return: dictionary with account fields for user
| a method to retrieve the account details of a user in the bucket | [
"a",
"method",
"to",
"retrieve",
"the",
"account",
"details",
"of",
"a",
"user",
"in",
"the",
"bucket"
] | def load_user(self, uid):
title = '%s.load_user' % self.__class__.__name__
input_fields = {
'uid': uid
}
for key, value in input_fields.items():
if value:
object_title = '%s(%s=%s)' % (title, key, str(value))
self.fields.validate(va... | [
"def",
"load_user",
"(",
"self",
",",
"uid",
")",
":",
"title",
"=",
"'%s.load_user'",
"%",
"self",
".",
"__class__",
".",
"__name__",
"input_fields",
"=",
"{",
"'uid'",
":",
"uid",
"}",
"for",
"key",
",",
"value",
"in",
"input_fields",
".",
"items",
"... | a method to retrieve the account details of a user in the bucket | [
"a",
"method",
"to",
"retrieve",
"the",
"account",
"details",
"of",
"a",
"user",
"in",
"the",
"bucket"
] | [
"'''\n a method to retrieve the account details of a user in the bucket\n \n :param uid: string with id of user in bucket \n :return: dictionary with account fields for user\n '''",
"# validate inputs",
"# construct url",
"# send request and unwrap response"
] | [
{
"param": "self",
"type": null
},
{
"param": "uid",
"type": null
}
] | {
"returns": [
{
"docstring": "dictionary with account fields for user",
"docstring_tokens": [
"dictionary",
"with",
"account",
"fields",
"for",
"user"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "self",... |
5116b9c35ed88bd98518e78cd6ce7c93a7374e3d | collectiveacuity/labPack | labpack/databases/couchbase.py | [
"MIT"
] | Python | delete_user | <not_specific> | def delete_user(self, uid, delete_views=True):
'''
a method to retrieve the account details of a user in the bucket
:param uid: string with id of user in bucket
:param delete_views: boolean to remove indices attached to user
:return: integer with status ... |
a method to retrieve the account details of a user in the bucket
:param uid: string with id of user in bucket
:param delete_views: boolean to remove indices attached to user
:return: integer with status of delete operation
| a method to retrieve the account details of a user in the bucket | [
"a",
"method",
"to",
"retrieve",
"the",
"account",
"details",
"of",
"a",
"user",
"in",
"the",
"bucket"
] | def delete_user(self, uid, delete_views=True):
title = '%s.delete_user' % self.__class__.__name__
input_fields = {
'uid': uid
}
for key, value in input_fields.items():
if value:
object_title = '%s(%s=%s)' % (title, key, str(value))
... | [
"def",
"delete_user",
"(",
"self",
",",
"uid",
",",
"delete_views",
"=",
"True",
")",
":",
"title",
"=",
"'%s.delete_user'",
"%",
"self",
".",
"__class__",
".",
"__name__",
"input_fields",
"=",
"{",
"'uid'",
":",
"uid",
"}",
"for",
"key",
",",
"value",
... | a method to retrieve the account details of a user in the bucket | [
"a",
"method",
"to",
"retrieve",
"the",
"account",
"details",
"of",
"a",
"user",
"in",
"the",
"bucket"
] | [
"'''\n a method to retrieve the account details of a user in the bucket\n \n :param uid: string with id of user in bucket\n :param delete_views: boolean to remove indices attached to user\n :return: integer with status of delete operation\n '''",
"# validate input... | [
{
"param": "self",
"type": null
},
{
"param": "uid",
"type": null
},
{
"param": "delete_views",
"type": null
}
] | {
"returns": [
{
"docstring": "integer with status of delete operation",
"docstring_tokens": [
"integer",
"with",
"status",
"of",
"delete",
"operation"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "self",... |
5116b9c35ed88bd98518e78cd6ce7c93a7374e3d | collectiveacuity/labPack | labpack/databases/couchbase.py | [
"MIT"
] | Python | create_session | <not_specific> | def create_session(self, uid, duration=0):
'''
a method to create a session token for the user
:param uid: string with id of user in bucket
:param duration: integer with number of seconds to last (default: 24hrs)
:return: dictionary with account fields for user... |
a method to create a session token for the user
:param uid: string with id of user in bucket
:param duration: integer with number of seconds to last (default: 24hrs)
:return: dictionary with account fields for user
| a method to create a session token for the user | [
"a",
"method",
"to",
"create",
"a",
"session",
"token",
"for",
"the",
"user"
] | def create_session(self, uid, duration=0):
title = '%s.create_session' % self.__class__.__name__
input_fields = {
'uid': uid,
'duration': duration
}
for key, value in input_fields.items():
if value:
object_title = '%s(%s=%s)' % (title, ... | [
"def",
"create_session",
"(",
"self",
",",
"uid",
",",
"duration",
"=",
"0",
")",
":",
"title",
"=",
"'%s.create_session'",
"%",
"self",
".",
"__class__",
".",
"__name__",
"input_fields",
"=",
"{",
"'uid'",
":",
"uid",
",",
"'duration'",
":",
"duration",
... | a method to create a session token for the user | [
"a",
"method",
"to",
"create",
"a",
"session",
"token",
"for",
"the",
"user"
] | [
"'''\n a method to create a session token for the user\n \n :param uid: string with id of user in bucket\n :param duration: integer with number of seconds to last (default: 24hrs) \n :return: dictionary with account fields for user\n '''",
"# validate inputs",
"... | [
{
"param": "self",
"type": null
},
{
"param": "uid",
"type": null
},
{
"param": "duration",
"type": null
}
] | {
"returns": [
{
"docstring": "dictionary with account fields for user",
"docstring_tokens": [
"dictionary",
"with",
"account",
"fields",
"for",
"user"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "self",... |
5116b9c35ed88bd98518e78cd6ce7c93a7374e3d | collectiveacuity/labPack | labpack/databases/couchbase.py | [
"MIT"
] | Python | delete_sessions | <not_specific> | def delete_sessions(self, uid):
'''
a method to delete all session tokens associated with a user
:param uid: string with id of user in bucket
:return: integer with status code of delete operation
'''
title = '%s.delete_session' % self.__clas... |
a method to delete all session tokens associated with a user
:param uid: string with id of user in bucket
:return: integer with status code of delete operation
| a method to delete all session tokens associated with a user | [
"a",
"method",
"to",
"delete",
"all",
"session",
"tokens",
"associated",
"with",
"a",
"user"
] | def delete_sessions(self, uid):
title = '%s.delete_session' % self.__class__.__name__
input_fields = {
'uid': uid
}
for key, value in input_fields.items():
object_title = '%s(%s=%s)' % (title, key, str(value))
self.fields.validate(value, '.%s' % key, o... | [
"def",
"delete_sessions",
"(",
"self",
",",
"uid",
")",
":",
"title",
"=",
"'%s.delete_session'",
"%",
"self",
".",
"__class__",
".",
"__name__",
"input_fields",
"=",
"{",
"'uid'",
":",
"uid",
"}",
"for",
"key",
",",
"value",
"in",
"input_fields",
".",
"... | a method to delete all session tokens associated with a user | [
"a",
"method",
"to",
"delete",
"all",
"session",
"tokens",
"associated",
"with",
"a",
"user"
] | [
"'''\n a method to delete all session tokens associated with a user\n \n :param uid: string with id of user in bucket\n :return: integer with status code of delete operation\n '''",
"# validate inputs",
"# construct url",
"# send request"
] | [
{
"param": "self",
"type": null
},
{
"param": "uid",
"type": null
}
] | {
"returns": [
{
"docstring": "integer with status code of delete operation",
"docstring_tokens": [
"integer",
"with",
"status",
"code",
"of",
"delete",
"operation"
],
"type": null
}
],
"raises": [],
"params": [
{
... |
5116b9c35ed88bd98518e78cd6ce7c93a7374e3d | collectiveacuity/labPack | labpack/databases/couchbase.py | [
"MIT"
] | Python | exists | <not_specific> | def exists(self, doc_id, rev_id=''):
'''
a method to determine if document exists
:param doc_id: string with id of document in bucket
:param rev_id: [optional] string with revision id of document in bucket
:return: boolean indicating existence of docume... |
a method to determine if document exists
:param doc_id: string with id of document in bucket
:param rev_id: [optional] string with revision id of document in bucket
:return: boolean indicating existence of document
| a method to determine if document exists | [
"a",
"method",
"to",
"determine",
"if",
"document",
"exists"
] | def exists(self, doc_id, rev_id=''):
title = '%s.exists' % self.__class__.__name__
input_fields = {
'doc_id': doc_id,
'rev_id': rev_id
}
for key, value in input_fields.items():
if value:
object_title = '%s(%s=%s)' % (title, key, str(val... | [
"def",
"exists",
"(",
"self",
",",
"doc_id",
",",
"rev_id",
"=",
"''",
")",
":",
"title",
"=",
"'%s.exists'",
"%",
"self",
".",
"__class__",
".",
"__name__",
"input_fields",
"=",
"{",
"'doc_id'",
":",
"doc_id",
",",
"'rev_id'",
":",
"rev_id",
"}",
"for... | a method to determine if document exists | [
"a",
"method",
"to",
"determine",
"if",
"document",
"exists"
] | [
"'''\n a method to determine if document exists\n \n :param doc_id: string with id of document in bucket \n :param rev_id: [optional] string with revision id of document in bucket\n :return: boolean indicating existence of document\n '''",
"# validate inputs",
"... | [
{
"param": "self",
"type": null
},
{
"param": "doc_id",
"type": null
},
{
"param": "rev_id",
"type": null
}
] | {
"returns": [
{
"docstring": "boolean indicating existence of document",
"docstring_tokens": [
"boolean",
"indicating",
"existence",
"of",
"document"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "self",
"t... |
5116b9c35ed88bd98518e78cd6ce7c93a7374e3d | collectiveacuity/labPack | labpack/databases/couchbase.py | [
"MIT"
] | Python | list | null | def list(self, query_criteria=None, uid='_all_users', all_versions=False, previous_id='', purge_deleted=False):
'''
a generator method for retrieving documents from the bucket
:param query_criteria: [optional] dictionary with valid jsonmodel query criteria
:param ... |
a generator method for retrieving documents from the bucket
:param query_criteria: [optional] dictionary with valid jsonmodel query criteria
:param uid: [optional] string with uid of design document to update
:param all_versions: boolean to include previous revisions ... | a generator method for retrieving documents from the bucket | [
"a",
"generator",
"method",
"for",
"retrieving",
"documents",
"from",
"the",
"bucket"
] | def list(self, query_criteria=None, uid='_all_users', all_versions=False, previous_id='', purge_deleted=False):
title = '%s.list' % self.__class__.__name__
input_fields = {
'uid': uid,
'previous_id': previous_id
}
for key, value in input_fields.items():
... | [
"def",
"list",
"(",
"self",
",",
"query_criteria",
"=",
"None",
",",
"uid",
"=",
"'_all_users'",
",",
"all_versions",
"=",
"False",
",",
"previous_id",
"=",
"''",
",",
"purge_deleted",
"=",
"False",
")",
":",
"title",
"=",
"'%s.list'",
"%",
"self",
".",
... | a generator method for retrieving documents from the bucket | [
"a",
"generator",
"method",
"for",
"retrieving",
"documents",
"from",
"the",
"bucket"
] | [
"'''\n a generator method for retrieving documents from the bucket \n \n :param query_criteria: [optional] dictionary with valid jsonmodel query criteria \n :param uid: [optional] string with uid of design document to update\n :param all_versions: boolean to include previo... | [
{
"param": "self",
"type": null
},
{
"param": "query_criteria",
"type": null
},
{
"param": "uid",
"type": null
},
{
"param": "all_versions",
"type": null
},
{
"param": "previous_id",
"type": null
},
{
"param": "purge_deleted",
"type": null
}
] | {
"returns": [
{
"docstring": "dictionary with document fields\nNOTE: to efficiently use the query architecture of couchbase, it is important\nto first create a view for any query criteria you wish to use. if a\nspecific query criteria is not previously created or no query criteria\nis included, then list... |
5116b9c35ed88bd98518e78cd6ce7c93a7374e3d | collectiveacuity/labPack | labpack/databases/couchbase.py | [
"MIT"
] | Python | create | <not_specific> | def create(self, doc_details):
'''
a method to create a new document in the collection
:param doc_details: dictionary with document details and user id value
:return: dictionary with document details and _id and _rev values
'''
# https://developer.couchbase... |
a method to create a new document in the collection
:param doc_details: dictionary with document details and user id value
:return: dictionary with document details and _id and _rev values
| a method to create a new document in the collection | [
"a",
"method",
"to",
"create",
"a",
"new",
"document",
"in",
"the",
"collection"
] | def create(self, doc_details):
title = '%s.create' % self.__class__.__name__
if self.model:
doc_details = self.model.validate(doc_details, path_to_root='', object_title='%s(doc_details={...}' % title)
from copy import deepcopy
new_record = deepcopy(doc_details)
url = ... | [
"def",
"create",
"(",
"self",
",",
"doc_details",
")",
":",
"title",
"=",
"'%s.create'",
"%",
"self",
".",
"__class__",
".",
"__name__",
"if",
"self",
".",
"model",
":",
"doc_details",
"=",
"self",
".",
"model",
".",
"validate",
"(",
"doc_details",
",",
... | a method to create a new document in the collection | [
"a",
"method",
"to",
"create",
"a",
"new",
"document",
"in",
"the",
"collection"
] | [
"'''\n a method to create a new document in the collection\n\n :param doc_details: dictionary with document details and user id value\n :return: dictionary with document details and _id and _rev values\n '''",
"# https://developer.couchbase.com/documentation/mobile/1.5/references/s... | [
{
"param": "self",
"type": null
},
{
"param": "doc_details",
"type": null
}
] | {
"returns": [
{
"docstring": "dictionary with document details and _id and _rev values",
"docstring_tokens": [
"dictionary",
"with",
"document",
"details",
"and",
"_id",
"and",
"_rev",
"values"
],
"type": null
}
... |
5116b9c35ed88bd98518e78cd6ce7c93a7374e3d | collectiveacuity/labPack | labpack/databases/couchbase.py | [
"MIT"
] | Python | delete | <not_specific> | def delete(self, doc_id, rev_id):
'''
a method to mark a document for deletion
:param doc_id: string with id of document in bucket
:param rev_id: string with revision id of document in bucket
:return: string with id of deleted document
'''
... |
a method to mark a document for deletion
:param doc_id: string with id of document in bucket
:param rev_id: string with revision id of document in bucket
:return: string with id of deleted document
| a method to mark a document for deletion | [
"a",
"method",
"to",
"mark",
"a",
"document",
"for",
"deletion"
] | def delete(self, doc_id, rev_id):
title = '%s.delete' % self.__class__.__name__
input_fields = {
'doc_id': doc_id,
'rev_id': rev_id
}
for key, value in input_fields.items():
object_title = '%s(%s=%s)' % (title, key, str(value))
self.fields.... | [
"def",
"delete",
"(",
"self",
",",
"doc_id",
",",
"rev_id",
")",
":",
"title",
"=",
"'%s.delete'",
"%",
"self",
".",
"__class__",
".",
"__name__",
"input_fields",
"=",
"{",
"'doc_id'",
":",
"doc_id",
",",
"'rev_id'",
":",
"rev_id",
"}",
"for",
"key",
"... | a method to mark a document for deletion | [
"a",
"method",
"to",
"mark",
"a",
"document",
"for",
"deletion"
] | [
"'''\n a method to mark a document for deletion\n \n :param doc_id: string with id of document in bucket \n :param rev_id: string with revision id of document in bucket\n :return: string with id of deleted document\n '''",
"# validate inputs",
"# send request an... | [
{
"param": "self",
"type": null
},
{
"param": "doc_id",
"type": null
},
{
"param": "rev_id",
"type": null
}
] | {
"returns": [
{
"docstring": "string with id of deleted document",
"docstring_tokens": [
"string",
"with",
"id",
"of",
"deleted",
"document"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "self",
"ty... |
5116b9c35ed88bd98518e78cd6ce7c93a7374e3d | collectiveacuity/labPack | labpack/databases/couchbase.py | [
"MIT"
] | Python | purge | <not_specific> | def purge(self, doc_ids):
'''
a method to remove docs from the collection
:param doc_ids: string or list of strings with document ids to purge
:return: list of strings of doc ids purged
'''
# https://developer.couchbase.com/documentation/mobile... |
a method to remove docs from the collection
:param doc_ids: string or list of strings with document ids to purge
:return: list of strings of doc ids purged
| a method to remove docs from the collection | [
"a",
"method",
"to",
"remove",
"docs",
"from",
"the",
"collection"
] | def purge(self, doc_ids):
title = '%s.purge' % self.__class__.__name__
if isinstance(doc_ids, str):
doc_ids = [ doc_ids ]
input_fields = {
'doc_ids': doc_ids
}
for key, value in input_fields.items():
object_title = '%s(%s=%s)' % (title, key, st... | [
"def",
"purge",
"(",
"self",
",",
"doc_ids",
")",
":",
"title",
"=",
"'%s.purge'",
"%",
"self",
".",
"__class__",
".",
"__name__",
"if",
"isinstance",
"(",
"doc_ids",
",",
"str",
")",
":",
"doc_ids",
"=",
"[",
"doc_ids",
"]",
"input_fields",
"=",
"{",
... | a method to remove docs from the collection | [
"a",
"method",
"to",
"remove",
"docs",
"from",
"the",
"collection"
] | [
"'''\n a method to remove docs from the collection\n \n :param doc_ids: string or list of strings with document ids to purge \n :return: list of strings of doc ids purged\n '''",
"# https://developer.couchbase.com/documentation/mobile/1.5/references/sync-gateway/admin-re... | [
{
"param": "self",
"type": null
},
{
"param": "doc_ids",
"type": null
}
] | {
"returns": [
{
"docstring": "list of strings of doc ids purged",
"docstring_tokens": [
"list",
"of",
"strings",
"of",
"doc",
"ids",
"purged"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "self",
... |
5116b9c35ed88bd98518e78cd6ce7c93a7374e3d | collectiveacuity/labPack | labpack/databases/couchbase.py | [
"MIT"
] | Python | remove | <not_specific> | def remove(self):
'''
a method to remove the entire bucket from the database
:return: string with confirmation message
'''
# https://developer.couchbase.com/documentation/mobile/1.5/references/sync-gateway/admin-rest-api/index.html#/database/delete__db__
title =... |
a method to remove the entire bucket from the database
:return: string with confirmation message
| a method to remove the entire bucket from the database | [
"a",
"method",
"to",
"remove",
"the",
"entire",
"bucket",
"from",
"the",
"database"
] | def remove(self):
title = '%s.remove' % self.__class__.__name__
if not self.admin_access:
raise Exception('%s requires admin access.' % title)
if self.configs['server'].find('http:') > -1:
flush_url = self.configs['server'] + '/pools/%s/buckets/%s/controller/doFlush' % (s... | [
"def",
"remove",
"(",
"self",
")",
":",
"title",
"=",
"'%s.remove'",
"%",
"self",
".",
"__class__",
".",
"__name__",
"if",
"not",
"self",
".",
"admin_access",
":",
"raise",
"Exception",
"(",
"'%s requires admin access.'",
"%",
"title",
")",
"if",
"self",
"... | a method to remove the entire bucket from the database | [
"a",
"method",
"to",
"remove",
"the",
"entire",
"bucket",
"from",
"the",
"database"
] | [
"'''\n a method to remove the entire bucket from the database \n\n :return: string with confirmation message \n '''",
"# https://developer.couchbase.com/documentation/mobile/1.5/references/sync-gateway/admin-rest-api/index.html#/database/delete__db__",
"# validate admin access",
"# fl... | [
{
"param": "self",
"type": null
}
] | {
"returns": [
{
"docstring": "string with confirmation message",
"docstring_tokens": [
"string",
"with",
"confirmation",
"message"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstrin... |
097d53d68175b519a04c92e81ce2055dfa82de98 | collectiveacuity/labPack | labpack/platforms/heroku.py | [
"MIT"
] | Python | _validate_install | <not_specific> | def _validate_install(self):
''' a method to validate heroku is installed '''
self.printer('Checking heroku installation ... ', flush=True)
# import dependencies
import re
from os import devnull
from subprocess import call, check_output
# valida... | a method to validate heroku is installed | a method to validate heroku is installed | [
"a",
"method",
"to",
"validate",
"heroku",
"is",
"installed"
] | def _validate_install(self):
self.printer('Checking heroku installation ... ', flush=True)
import re
from os import devnull
from subprocess import call, check_output
sys_command = 'heroku --version'
try:
response = check_output(sys_command, shell=True, stderr=... | [
"def",
"_validate_install",
"(",
"self",
")",
":",
"self",
".",
"printer",
"(",
"'Checking heroku installation ... '",
",",
"flush",
"=",
"True",
")",
"import",
"re",
"from",
"os",
"import",
"devnull",
"from",
"subprocess",
"import",
"call",
",",
"check_output",... | a method to validate heroku is installed | [
"a",
"method",
"to",
"validate",
"heroku",
"is",
"installed"
] | [
"''' a method to validate heroku is installed '''",
"# import dependencies\r",
"# validate cli installation\r",
"# print response and return\r"
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
097d53d68175b519a04c92e81ce2055dfa82de98 | collectiveacuity/labPack | labpack/platforms/heroku.py | [
"MIT"
] | Python | _update_netrc | <not_specific> | def _update_netrc(self, netrc_path, auth_token, account_email):
''' a method to replace heroku login details in netrc file '''
# define patterns
import re
record_end = '(\n\n|\n\w|$)'
heroku_regex = re.compile('(machine\sapi\.heroku\.com.*?\nmachine\sgit\.heroku\... | a method to replace heroku login details in netrc file | a method to replace heroku login details in netrc file | [
"a",
"method",
"to",
"replace",
"heroku",
"login",
"details",
"in",
"netrc",
"file"
] | def _update_netrc(self, netrc_path, auth_token, account_email):
import re
record_end = '(\n\n|\n\w|$)'
heroku_regex = re.compile('(machine\sapi\.heroku\.com.*?\nmachine\sgit\.heroku\.com.*?)%s' % record_end, re.S)
netrc_text = open(netrc_path).read().strip()
new_heroku = 'machine... | [
"def",
"_update_netrc",
"(",
"self",
",",
"netrc_path",
",",
"auth_token",
",",
"account_email",
")",
":",
"import",
"re",
"record_end",
"=",
"'(\\n\\n|\\n\\w|$)'",
"heroku_regex",
"=",
"re",
".",
"compile",
"(",
"'(machine\\sapi\\.heroku\\.com.*?\\nmachine\\sgit\\.hero... | a method to replace heroku login details in netrc file | [
"a",
"method",
"to",
"replace",
"heroku",
"login",
"details",
"in",
"netrc",
"file"
] | [
"''' a method to replace heroku login details in netrc file '''",
"# define patterns\r",
"# retrieve netrc text\r",
"# replace text with new password and login\r",
"# save netrc\r"
] | [
{
"param": "self",
"type": null
},
{
"param": "netrc_path",
"type": null
},
{
"param": "auth_token",
"type": null
},
{
"param": "account_email",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "netrc_path",
"type": null,
"docstring": null,
"docstring_toke... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.