code string | signature string | docstring string | loss_without_docstring float64 | loss_with_docstring float64 | factor float64 |
|---|---|---|---|---|---|
url = 'https://openapi.youku.com/v2/users/subscribe/get.json'
params = {
'client_id': self.client_id,
'access_token': access_token,
'page': page,
'count': count
}
r = requests.get(url, params=params)
check_error(r)
... | def subscribe_get(self, access_token, page=1, count=20) | doc: http://open.youku.com/docs/doc?id=30 | 2.019835 | 1.923474 | 1.050098 |
url = 'https://openapi.youku.com/v2/users/subscribe/notice.json'
params = {
'client_id': self.client_id,
'access_token': access_token
}
r = requests.get(url, params=params)
check_error(r)
return r.json() | def subscribe_notice(self, access_token) | doc: http://open.youku.com/docs/doc?id=31 | 2.316276 | 2.096227 | 1.104974 |
url = 'https://openapi.youku.com/v2/shows/show.json'
params = {
'client_id': self.client_id,
'show_id': show_id
}
r = requests.get(url, params=params)
check_error(r)
return r.json() | def find_show_by_id(self, show_id) | doc: http://open.youku.com/docs/doc?id=59 | 2.493631 | 2.127389 | 1.172156 |
url = 'https://openapi.youku.com/v2/shows/show_batch.json'
params = {
'client_id': self.client_id,
'show_ids': show_ids
}
r = requests.get(url, params=params)
check_error(r)
return r.json() | def find_shows_by_ids(self, show_ids) | doc: http://open.youku.com/docs/doc?id=60 | 2.678499 | 2.317124 | 1.155958 |
url = 'https://openapi.youku.com/v2/shows/show_premium.json'
params = {
'client_id': self.client_id,
'show_ids': show_ids,
'page': page,
'count': count
}
r = requests.get(url, params=params)
check_error(r)
return r.... | def find_show_premium_by_ids(self, show_ids, page=1, count=20) | doc: http://open.youku.com/docs/doc?id=61 | 2.223881 | 1.950629 | 1.140084 |
url = 'https://openapi.youku.com/v2/shows/by_category.json'
params = {
'client_id': self.client_id,
'category': category,
'genre': genre,
'area': area,
'release_year': release_year,
'paid': paid,
'orderby': orde... | def find_shows_by_category(self, category, genre=None, area=None,
release_year=None, paid=None,
orderby='view-today-count',
streamtypes=None, person=None,
page=1, count=20) | doc: http://open.youku.com/docs/doc?id=62 | 1.758481 | 1.669521 | 1.053285 |
url = 'https://openapi.youku.com/v2/shows/by_related.json'
params = {
'client_id': self.client_id,
'show_id': show_id,
'count': count
}
r = requests.get(url, params=params)
check_error(r)
return r.json() | def find_shows_by_related(self, show_id,
count=20) | doc: http://open.youku.com/docs/doc?id=63 | 2.26778 | 2.076119 | 1.092317 |
url = 'https://openapi.youku.com/v2/shows/videos.json'
params = {
'client_id': self.client_id,
'show_id': show_id,
'page': page,
'count': count,
'show_videotype': show_videotype,
'show_videostage': show_videostage,
... | def find_videos_by_show(self, show_id, show_videotype=None,
show_videostage=None, orderby='videoseq-asc',
page=1, count=20) | doc: http://open.youku.com/docs/doc?id=64 | 1.949164 | 1.840547 | 1.059013 |
params = {}
if title is None:
title = self.file_name
elif len(title) > 80:
title = title[:80]
if len(description) > 2000:
description = description[0:2000]
params['title'] = title
params['tags'] = tags
params['descrip... | def prepare_video_params(self, title=None, tags='Others', description='',
copyright_type='original', public_type='all',
category=None, watch_password=None,
latitude=None, longitude=None, shoot_time=None
) | util method for create video params to upload.
Only need to provide a minimum of two essential parameters:
title and tags, other video params are optional. All params spec
see: http://cloud.youku.com/docs?id=110#create .
Args:
title: string, 2-50 characters.
tag... | 1.551213 | 1.744295 | 0.889306 |
if os.access(self.file_dir, os.W_OK | os.R_OK | os.X_OK):
save_file = self.file + '.upload'
data = {
'upload_token': self.upload_token,
'upload_server_ip': self.upload_server_ip
}
with open(save_file, 'w') as f:
... | def _save_upload_state_to_file(self) | if create and create_file has execute, save upload state
to file for next resume upload if current upload process is
interrupted. | 2.624703 | 2.594952 | 1.011465 |
if self.upload_token is not None:
# resume upload
status = self.check()
if status['status'] != 4:
return self.commit()
else:
self.new_slice()
while self.slice_task_id != 0:
self.upload_sl... | def upload(self, params={}) | start uploading the file until upload is complete or error.
This is the main method to used, If you do not care about
state of process.
Args:
params: a dict object describe video info, eg title,
tags, description, category.
all video para... | 4.351911 | 3.838063 | 1.133882 |
if self.settings.GROUP_FILTER:
ldap_groups = self.ldap.search(self.settings.GROUP_FILTER, self.settings.GROUP_ATTRIBUTES.keys())
self._sync_ldap_groups(ldap_groups)
logger.info("Groups are synchronized") | def sync_groups(self) | Synchronize LDAP groups with local group model. | 5.258935 | 4.028898 | 1.305304 |
if self.settings.USER_FILTER:
user_attributes = self.settings.USER_ATTRIBUTES.keys() + self.settings.USER_EXTRA_ATTRIBUTES
ldap_users = self.ldap.search(self.settings.USER_FILTER, user_attributes)
self._sync_ldap_users(ldap_users)
logger.info("Users are s... | def sync_users(self) | Synchronize LDAP users with local user model. | 4.585357 | 3.669775 | 1.249493 |
parser = argparse.ArgumentParser()
parser.add_argument("filename", nargs=1)
parser.add_argument("--granule-id", dest="granule_id",
help=(
"Optional. Specify a granule to export metadata from."
)
)
parser.add_argument("--single-granule", dest="single_granule",
... | def main(args=sys.argv[1:]) | Generate EO O&M XML metadata. | 2.629957 | 2.508228 | 1.048532 |
url = 'https://openapi.youku.com/v2/searches/video/by_tag.json'
params = {
'client_id': self.client_id,
'tag': tag,
'period': period,
'orderby': orderby,
'page': page,
'count': count
}
if category:
... | def search_videos_by_tag(self, tag, category=None,
period='today',
orderby='relevance',
page=1, count=20) | doc: http://open.youku.com/docs/doc?id=80 | 1.978449 | 1.875435 | 1.054928 |
url = 'https://openapi.youku.com/v2/searches/video/by_keyword.json'
params = {
'client_id': self.client_id,
'keyword': keyword,
'category': category,
'period': period,
'orderby': orderby,
'public_type': public_type,
... | def search_videos_by_keyword(self, keyword, category=None,
period='week', orderby='relevance',
public_type='all', paid=None,
timeless=None, timemore=None,
streamtypes=None,
... | doc: http://open.youku.com/docs/doc?id=81 | 1.710563 | 1.652025 | 1.035434 |
url = 'https://openapi.youku.com/v2/searches/show/by_keyword.json'
params = {
'client_id': self.client_id,
'keyword': keyword,
'unite': unite,
'source_site': source_site,
'category': category,
'release_year': release_year,
... | def search_shows_by_keyword(self, keyword, unite=0, source_site=None,
category=None, release_year=None,
area=None, orderby='view-count',
paid=None, hasvideotype=None,
page=1, count=20) | doc: http://open.youku.com/docs/doc?id=82 | 1.72837 | 1.649117 | 1.048058 |
url = 'https://openapi.youku.com/v2/searches/keyword/complete.json'
params = {
'client_id': self.client_id,
'keyword': keyword
}
r = requests.get(url, params=params)
check_error(r)
return r.json() | def search_keyword_complete(self, keyword) | doc: http://open.youku.com/docs/doc?id=83 | 2.675648 | 2.300641 | 1.163001 |
url = 'https://openapi.youku.com/v2/searches/keyword/top.json'
params = {
'client_id': self.client_id,
'count': count,
'period': period
}
if category:
params['category'] = category
r = requests.get(url, params=params)
... | def search_keyword_top(self, category=None, count=20, period='today') | doc: http://open.youku.com/docs/doc?id=84 | 2.135245 | 1.950414 | 1.094765 |
url = 'https://openapi.youku.com/v2/searches/show/address_unite.json'
params = {
'client_id': self.client_id,
'progammeId': progammeId,
'source_site': source_site,
'type': type
}
params = remove_none_value(params)
r = reque... | def search_show_address_unite(self, progammeId,
source_site=None, type=None) | doc: http://open.youku.com/docs/doc?id=85 | 2.315226 | 2.121052 | 1.091546 |
url = 'https://openapi.youku.com/v2/searches/show/top_unite.json'
params = {
'client_id': self.client_id,
'category': category,
'genre': genre,
'area': area,
'year': year,
'orderby': orderby,
'headnum': headnum,... | def search_show_top_unite(self, category, genre=None, area=None,
year=None, orderby=None, headnum=1,
tailnum=1, onesiteflag=None,
page=1, count=20) | doc: http://open.youku.com/docs/doc?id=86 | 1.777013 | 1.676111 | 1.0602 |
url = 'https://openapi.youku.com/v2/playlists/show.json'
params = {
'client_id': self.client_id,
'playlist_id': playlist_id
}
r = requests.get(url, params=params)
check_error(r)
return r.json() | def find_playlist_by_id(self, playlist_id) | doc: http://open.youku.com/docs/doc?id=66 | 2.31246 | 2.032972 | 1.137478 |
url = 'https://openapi.youku.com/v2/playlists/show_batch.json'
params = {
'client_id': self.client_id,
'playlist_ids': playlist_ids
}
r = requests.get(url, params=params)
check_error(r)
return r.json() | def find_playlists_by_ids(self, playlist_ids) | doc: http://open.youku.com/docs/doc?id=67 | 2.613495 | 2.272164 | 1.150223 |
url = 'https://openapi.youku.com/v2/playlists/videos.json'
params = {
'client_id': self.client_id,
'playlist_id': playlist_id,
'page': page,
'count': count
}
r = requests.get(url, params=params)
check_error(r)
retur... | def find_videos_by_playlist(self, playlist_id, page=1, count=20) | doc: http://open.youku.com/docs/doc?id=71 | 2.099495 | 1.861655 | 1.127757 |
url = 'https://openapi.youku.com/v2/playlists/update.json'
data = {
'client_id': self.client_id,
'access_token': access_token,
'playlist_id': playlist_id,
'title': title,
'tags': tags,
'category': category,
'des... | def update_playlist(self, access_token, playlist_id, title,
tags=None, category=None, description=None) | doc: http://open.youku.com/docs/doc?id=73 | 1.874639 | 1.789128 | 1.047795 |
url = 'https://openapi.youku.com/v2/playlists/destroy.json'
data = {
'client_id': self.client_id,
'access_token': access_token,
'playlist_id': playlist_id
}
r = requests.post(url, data=data)
check_error(r)
return r.json()['id'] | def destroy_playlist(self, access_token, playlist_id) | doc: http://open.youku.com/docs/doc?id=74 | 2.107625 | 1.90112 | 1.108623 |
url = 'https://openapi.youku.com/v2/playlists/video/add.json'
data = {
'client_id': self.client_id,
'access_token': access_token,
'playlist_id': playlist_id,
'video_ids': video_ids
}
r = requests.post(url, data=data)
check_... | def add_videos_to_playlist(self, access_token, playlist_id, video_ids) | doc: http://open.youku.com/docs/doc?id=75 | 2.064105 | 1.847878 | 1.117014 |
url = 'https://openapi.youku.com/v2/playlists/video/setcover.json'
data = {
'client_id': self.client_id,
'access_token': access_token,
'playlist_id': playlist_id,
'video_id': video_id
}
r = requests.post(url, data=data)
che... | def set_cover_video_for_playlist(self, access_token, playlist_id,
video_id) | doc: http://open.youku.com/docs/doc?id=77 | 2.074975 | 1.92291 | 1.079081 |
url = 'https://openapi.youku.com/v2/playlists/video/next.json'
params = {
'client_id': self.client_id,
'playlist_id': playlist_id,
'video_id': cur_video_id
}
r = requests.get(url, params=params)
check_error(r)
return r.json() | def find_next_video_in_playlist(self, playlist_id, cur_video_id) | doc: http://open.youku.com/docs/doc?id=78 | 2.261094 | 1.943675 | 1.163309 |
pixel = TileSystem.geo_to_pixel(geo, level)
tile = TileSystem.pixel_to_tile(pixel)
key = TileSystem.tile_to_quadkey(tile, level)
return QuadKey(key) | def from_geo(geo, level) | Constucts a quadkey representation from geo and level
geo => (lat, lon)
If lat or lon are outside of bounds, they will be clipped
If level is outside of bounds, an AssertionError is raised | 3.505002 | 3.167726 | 1.106473 |
if self.level <= node.level or self.key[:len(node.key)] != node.key:
return None
return self.level - node.level | def is_ancestor(self, node) | If node is ancestor of self
Get the difference in level
If not, None | 5.958088 | 4.730358 | 1.259543 |
x,y = 0,1
assert self.level == to.level
self_tile = list(self.to_tile()[0])
to_tile = list(to.to_tile()[0])
if self_tile[x] >= to_tile[x] and self_tile[y] <= self_tile[y]:
ne_tile, sw_tile = self_tile, to_tile
else:
sw_tile, ne_tile = self... | def xdifference(self, to) | Generator
Gives the difference of quadkeys between self and to
Generator in case done on a low level
Only works with quadkeys of same level | 2.857002 | 2.654715 | 1.076199 |
return [ QuadKey(self.key[:l+1]) for l in reversed(range(len(self.key))) ] | def unwind(self) | Get a list of all ancestors in descending order of level, including a new instance of self | 10.253938 | 6.938849 | 1.477758 |
url = 'https://openapi.youku.com/v2/comments/show.json'
params = {
'client_id': self.client_id,
'comment_id': comment_id
}
r = requests.get(url, params=params)
check_error(r)
return r.json() | def find_comment_by_id(self, comment_id) | doc: http://open.youku.com/docs/doc?id=32 | 2.366716 | 2.063408 | 1.146994 |
url = 'https://openapi.youku.com/v2/comments/show_batch.json'
params = {
'client_id': self.client_id,
'comment_ids': comment_ids
}
r = requests.get(url, params=params)
check_error(r)
return r.json() | def find_comments_by_ids(self, comment_ids) | doc: http://open.youku.com/docs/doc?id=34 | 2.523269 | 2.208454 | 1.14255 |
url = 'https://openapi.youku.com/v2/comments/by_video.json'
params = {
'client_id': self.client_id,
'video_id': video_id,
'page': page,
'count': count
}
r = requests.get(url, params=params)
check_error(r)
return r.j... | def find_comments_by_video(self, video_id, page=1, count=20) | doc: http://open.youku.com/docs/doc?id=35 | 2.007473 | 1.817496 | 1.104526 |
url = 'https://openapi.youku.com/v2/comments/by_me.json'
data = {
'client_id': self.client_id,
'access_token': access_token,
'page': page,
'count': count
}
r = requests.post(url, data=data)
check_error(r)
return r.j... | def find_comments_by_me(self, access_token, page=1, count=20) | doc: http://open.youku.com/docs/doc?id=37 | 2.084807 | 1.877925 | 1.110166 |
url = 'https://openapi.youku.com/v2/comments/create.json'
data = {
'client_id': self.client_id,
'access_token': access_token,
'video_id': video_id,
'content': content,
'reply_id': reply_id,
'captcha_key': captcha_key,
... | def create_comment(self, access_token, video_id, content,
reply_id=None, captcha_key=None, captcha_text=None) | doc: http://open.youku.com/docs/doc?id=41 | 1.712326 | 1.704443 | 1.004625 |
url = 'https://openapi.youku.com/v2/comments/destroy.json'
data = {
'client_id': self.client_id,
'access_token': access_token,
'comment_id': comment_id
}
r = requests.post(url, data=data)
check_error(r)
return r.json()['id'] | def destroy_comment(self, access_token, comment_id) | doc: http://open.youku.com/docs/doc?id=42 | 2.148385 | 1.974635 | 1.087991 |
if self.GROUP_ATTRIBUTES and self.GROUPNAME_FIELD not in self.GROUP_ATTRIBUTES.values():
raise ImproperlyConfigured("LDAP_SYNC_GROUP_ATTRIBUTES must contain '%s'" % self.GROUPNAME_FIELD)
if not self.model._meta.get_field(self.USERNAME_FIELD).unique:
raise ImproperlyConf... | def validate(self) | Apply validation rules for loaded settings. | 2.532771 | 2.476736 | 1.022625 |
try:
user_account_control = int(attributes['userAccountControl'][0])
if user_account_control & 2:
user.is_active = False
else:
user.is_active = True
except KeyError:
pass | def user_active_directory_enabled(user, attributes, created, updated) | Activate/deactivate user accounts based on Active Directory's
userAccountControl flags. Requires 'userAccountControl'
to be included in LDAP_SYNC_USER_EXTRA_ATTRIBUTES. | 2.969358 | 2.659111 | 1.116673 |
url = 'https://openapi.youku.com/v2/videos/show_basic.json'
params = {
'client_id': self.client_id,
'video_id': video_id
}
r = requests.get(url, params=params)
check_error(r)
return r.json() | def find_video_by_id(self, video_id) | doc: http://open.youku.com/docs/doc?id=44 | 2.535497 | 2.28863 | 1.107867 |
url = 'https://openapi.youku.com/v2/videos/show_basic.json'
params = {
'client_id': self.client_id,
'video_url': video_url
}
r = requests.get(url, params=params)
check_error(r)
return r.json() | def find_video_by_url(self, video_url) | doc: http://open.youku.com/docs/doc?id=44 | 2.689247 | 2.399886 | 1.120573 |
url = 'https://openapi.youku.com/v2/videos/show_basic_batch.json'
params = {
'client_id': self.client_id,
'video_ids': video_ids
}
r = requests.get(url, params=params)
check_error(r)
return r.json() | def find_videos_by_ids(self, video_ids) | doc: http://open.youku.com/docs/doc?id=45 | 2.905118 | 2.550508 | 1.139035 |
url = 'https://api.youku.com/videos/show.json'
params = {
'client_id': self.client_id,
'video_id': video_id
}
if ext:
params['ext'] = ext
r = requests.get(url, params=params)
check_error(r)
return r.json() | def find_video_detail_by_id(self, video_id, ext=None) | doc: http://cloud.youku.com/docs?id=46 | 2.439031 | 2.205179 | 1.106047 |
url = 'https://openapi.youku.com/v2/videos/show_batch.json'
params = {
'client_id': self.client_id,
'video_ids': video_ids
}
if ext:
params['ext'] = ext
r = requests.get(url, params=params)
check_error(r)
return r.json(... | def find_video_details_by_ids(self, video_ids, ext=None) | doc: http://open.youku.com/docs/doc?id=47 | 2.356843 | 2.150982 | 1.095705 |
url = 'https://openapi.youku.com/v2/videos/update.json'
data = {
'client_id': self.client_id,
'access_token': access_token,
'video_id': video_id,
'title': title,
'tags': tags,
'category': category,
'copyright_ty... | def update_video(self, access_token, video_id, title=None,
tags=None, category=None, copyright_type=None,
public_type=None, watch_password=None,
description=None, thumbnail_seq=None) | doc: http://open.youku.com/docs/doc?id=50 | 1.577903 | 1.585011 | 0.995516 |
url = 'https://openapi.youku.com/v2/videos/by_related.json'
params = {
'client_id': self.client_id,
'video_id': video_id,
'count': count
}
r = requests.get(url, params=params)
check_error(r)
return r.json() | def find_videos_by_related(self, video_id, count=20) | doc: http://open.youku.com/docs/doc?id=52 | 2.17722 | 1.936247 | 1.124453 |
url = 'https://openapi.youku.com/v2/videos/favorite/by_user.json'
params = {
'client_id': self.client_id,
'user_id': user_id,
'orderby': orderby,
'page': page,
'count': count
}
r = requests.get(url, params=params)
... | def find_favorite_videos_by_userid(self, user_id,
orderby='favorite-time',
page=1, count=20) | doc: http://open.youku.com/docs/doc?id=54 | 1.945035 | 1.849398 | 1.051712 |
url = 'https://openapi.youku.com/v2/videos/favorite/by_user.json'
params = {
'client_id': self.client_id,
'user_name': user_name,
'orderby': orderby,
'page': page,
'count': count
}
r = requests.get(url, params=params)
... | def find_favorite_videos_by_username(self, user_name,
orderby='favorite-time',
page=1, count=20) | doc: http://open.youku.com/docs/doc?id=54 | 1.9874 | 1.882013 | 1.055997 |
url = 'https://openapi.youku.com/v2/videos/favorite/create.json'
data = {
'client_id': self.client_id,
'access_token': access_token,
'video_id': video_id
}
r = requests.post(url, data=data)
check_error(r)
return r.json()['id'] | def create_favorite_video(self, access_token, video_id) | doc: http://open.youku.com/docs/doc?id=55 | 2.024172 | 1.881616 | 1.075763 |
return self._paged_search_ext_s(self.settings.BASE, ldap.SCOPE_SUBTREE, filterstr=filterstr,
attrlist=attrlist, page_size=self.settings.PAGE_SIZE) | def search(self, filterstr, attrlist) | Query the configured LDAP server. | 7.198126 | 4.563527 | 1.577316 |
request_ctrl = SimplePagedResultsControl(True, size=page_size, cookie='')
results = []
while True:
msgid = self.conn.search_ext(base, scope, filterstr=filterstr, attrlist=attrlist, attrsonly=attrsonly,
serverctrls=(serverctrls or [])... | def _paged_search_ext_s(self, base, scope, filterstr='(objectClass=*)', attrlist=None, attrsonly=0,
serverctrls=None, clientctrls=None, timeout=-1, sizelimit=0, page_size=10) | Behaves similarly to LDAPObject.search_ext_s() but internally uses the
simple paged results control to retrieve search results in chunks.
Taken from the python-ldap paged_search_ext_s.py demo, showing how to use
the paged results control: https://bitbucket.org/jaraco/python-ldap/ | 2.201299 | 2.179734 | 1.009893 |
url = 'https://openapi.youku.com/v2/schemas/video/category.json'
r = requests.get(url)
check_error(r)
return r.json() | def video_category(self) | doc: http://open.youku.com/docs/doc?id=90 | 4.568439 | 3.59899 | 1.269367 |
url = 'https://openapi.youku.com/v2/schemas/upload/spec.json'
r = requests.get(url)
check_error(r)
return r.json() | def upload_spec(self) | doc: http://open.youku.com/docs/doc?id=91 | 4.611769 | 3.466743 | 1.330289 |
url = 'https://openapi.youku.com/v2/schemas/comment/expression.json'
r = requests.get(url)
check_error(r)
return r.json() | def comment_expression(self) | doc: http://open.youku.com/docs/doc?id=92 | 5.455542 | 3.879341 | 1.406306 |
url = 'https://openapi.youku.com/v2/schemas/show/category.json'
r = requests.get(url)
check_error(r)
return r.json() | def show_category(self) | doc: http://open.youku.com/docs/doc?id=93 | 5.072884 | 3.747658 | 1.353614 |
url = 'https://openapi.youku.com/v2/schemas/playlist/category.json'
r = requests.get(url)
check_error(r)
return r.json() | def playlist_category(self) | doc: http://open.youku.com/docs/doc?id=94 | 4.717735 | 3.605159 | 1.308607 |
url = 'https://openapi.youku.com/v2/schemas/searche/top/category.json'
r = requests.get(url)
check_error(r)
return r.json() | def searche_top_category(self) | doc: http://open.youku.com/docs/doc?id=95 | 5.025729 | 3.994242 | 1.258243 |
return ctx.gi.annotations.set_name(feature_id, name, organism=organism, sequence=sequence) | def cli(ctx, feature_id, name, organism="", sequence="") | Set a feature's name
Output:
A standard apollo feature dictionary ({"features": [{...}]}) | 3.360354 | 4.38791 | 0.765821 |
return ctx.gi.annotations.delete_sequence_alteration(feature_id, organism=organism, sequence=sequence) | def cli(ctx, feature_id, organism="", sequence="") | [UNTESTED] Delete a specific feature alteration
Output:
A list of sequence alterations(?) | 4.520671 | 3.916393 | 1.154295 |
rss = self._fetch_xml(LID_LOOKUP_URL.format(woeid, "f"))
# We are pulling the LID from the permalink tag in the XML file
# returned by Yahoo.
try:
link = rss.find("channel/link").text
except AttributeError:
return None
# use regex or st... | def fetch_lid(self, woeid) | Fetch a location's corresponding LID.
Args:
woeid: (string) the location's WOEID.
Returns:
a string containing the requested LID or None if the LID could
not be found.
Raises:
urllib.error.URLError: urllib.request could not open the URL
... | 8.471096 | 7.900444 | 1.07223 |
rss = self._fetch_xml(
WOEID_LOOKUP_URL.format(quote(location)))
try:
woeid = rss.find("results/Result/woeid").text
except AttributeError:
return None
return woeid | def fetch_woeid(self, location) | Fetch a location's corresponding WOEID.
Args:
location: (string) a location (e.g. 23454 or Berlin, Germany).
Returns:
a string containing the location's corresponding WOEID or None if
the WOEID could not be found.
Raises:
urllib.error.URLErr... | 4.770507 | 5.007886 | 0.952599 |
try:
degrees = float(degrees)
except ValueError:
return None
if degrees < 0 or degrees > 360:
return None
if degrees <= 11.25 or degrees >= 348.76:
return "N"
elif degrees <= 33.75:
return "NNE"
elif deg... | def _degrees_to_direction(self, degrees) | Convert wind direction from degrees to compass direction. | 1.212152 | 1.194936 | 1.014407 |
with contextlib.closing(urlopen(url)) as f:
return xml.etree.ElementTree.parse(f).getroot() | def _fetch_xml(self, url) | Fetch a url and parse the document's XML. | 2.88246 | 2.719504 | 1.059921 |
return ctx.gi.annotations.set_symbol(feature_id, symbol, organism=organism, sequence=sequence) | def cli(ctx, feature_id, symbol, organism="", sequence="") | Set a feature's description
Output:
A standard apollo feature dictionary ({"features": [{...}]}) | 3.416926 | 5.335025 | 0.640471 |
return ctx.gi.annotations.add_feature(feature=feature, organism=organism, sequence=sequence) | def cli(ctx, feature={}, organism="", sequence="") | Add a feature
Output:
A standard apollo feature dictionary ({"features": [{...}]}) | 3.621781 | 4.507465 | 0.803507 |
return ctx.gi.organisms.add_organism(common_name, directory, blatdb=blatdb, genus=genus, species=species, public=public) | def cli(ctx, common_name, directory, blatdb="", genus="", species="", public=False) | Add an organism
Output:
a dictionary with information about the new organism | 2.488637 | 2.628551 | 0.946772 |
# TODO: prompt for values someday.
click.echo()
if os.path.exists(config.global_config_path()):
info("Your arrow configuration already exists. Please edit it instead: %s" % config.global_config_path())
return 0
while True:
apollo_url= click.prompt("Please entry your Apollo'... | def cli(ctx, url=None, api_key=None, admin=False, **kwds) | Help initialize global configuration (in home directory) | 3.403463 | 3.374347 | 1.008629 |
return ctx.gi.cannedkeys.update_key(id_number, new_key, metadata=metadata) | def cli(ctx, id_number, new_key, metadata="") | Update a canned key
Output:
an empty dictionary | 4.559954 | 5.220191 | 0.873522 |
return ctx.gi.io.write_downloadable(organism, export_type=export_type, seq_type=seq_type, export_format=export_format, export_gff3_fasta=export_gff3_fasta, sequences=sequences, region=region) | def cli(ctx, organism, export_type="FASTA", seq_type="peptide", export_format="text", export_gff3_fasta=False, sequences=None, region="") | Prepare a download for an organism
Output:
a dictionary containing download information | 2.270899 | 2.617243 | 0.867668 |
return ctx.gi.annotations.add_transcript(transcript=transcript, suppress_history=suppress_history, suppress_events=suppress_events, organism=organism, sequence=sequence) | def cli(ctx, transcript={}, suppress_history=False, suppress_events=False, organism="", sequence="") | [UNTESTED] Add a transcript to a feature
Output:
A standard apollo feature dictionary ({"features": [{...}]}) | 2.670708 | 2.965886 | 0.900476 |
data = {
'value': value,
'metadata': metadata
}
return self.post('createValue', data) | def add_value(self, value, metadata="") | Add a canned value
:type value: str
:param value: New canned value
:type metadata: str
:param metadata: Optional metadata
:rtype: dict
:return: A dictionnary containing canned value description | 5.241766 | 8.459909 | 0.619601 |
values = self.get_values()
values = [x for x in values if x['label'] == value]
if len(values) == 0:
raise Exception("Unknown value")
else:
return values[0] | def show_value(self, value) | Get a specific canned value
:type value: str
:param value: Canned value to show
:rtype: dict
:return: A dictionnary containing canned value description | 3.356472 | 3.525872 | 0.951955 |
data = {
'id': id_number,
'new_value': new_value
}
if metadata is not None:
data['metadata'] = metadata
return self.post('updateValue', data) | def update_value(self, id_number, new_value, metadata=None) | Update a canned value
:type id_number: int
:param id_number: canned value ID number
:type new_value: str
:param new_value: New canned value value
:type metadata: str
:param metadata: Optional metadata
:rtype: dict
:return: an empty dictionary | 2.634536 | 3.571286 | 0.737699 |
data = {
'key': key,
'metadata': metadata
}
return self.post('createKey', data) | def add_key(self, key, metadata="") | Add a canned key
:type key: str
:param key: New canned key
:type metadata: str
:param metadata: Optional metadata
:rtype: dict
:return: A dictionnary containing canned key description | 4.84995 | 8.522596 | 0.56907 |
keys = self.get_keys()
keys = [x for x in keys if x['label'] == value]
if len(keys) == 0:
raise Exception("Unknown key")
else:
return keys[0] | def show_key(self, value) | Get a specific canned key
:type value: str
:param value: Canned key to show
:rtype: dict
:return: A dictionnary containing canned key description | 3.273095 | 3.578061 | 0.914768 |
data = {
'id': id_number,
'new_key': new_key
}
if metadata is not None:
data['metadata'] = metadata
return self.post('updateKey', data) | def update_key(self, id_number, new_key, metadata=None) | Update a canned key
:type id_number: int
:param id_number: canned key ID number
:type new_key: str
:param new_key: New canned key value
:type metadata: str
:param metadata: Optional metadata
:rtype: dict
:return: an empty dictionary | 2.593214 | 3.577471 | 0.724874 |
return ctx.gi.cannedvalues.update_value(id_number, new_value, metadata=metadata) | def cli(ctx, id_number, new_value, metadata="") | Update a canned value
Output:
an empty dictionary | 5.341663 | 5.785718 | 0.92325 |
if self.id is None:
raise ValueError("Cannot download image with no ID.")
pattern = re.compile("{(.*?)}")
dest_pattern = re.sub(pattern, lambda m: str(getattr(self, str(m.group(0))[1:-1], "_")), dest_pattern)
parameters = {"parent": parent}
destination = os... | def download(self, dest_pattern="{originalFilename}", override=True, parent=False) | Download the original image.
Parameters
----------
dest_pattern : str, optional
Destination path for the downloaded image. "{X}" patterns are replaced by the value of X attribute
if it exists.
override : bool, optional
True if a file with same name ca... | 3.69003 | 3.734496 | 0.988093 |
if self.id is None:
raise ValueError("Cannot dump an annotation with no ID.")
pattern = re.compile("{(.*?)}")
dest_pattern = re.sub(pattern, lambda m: str(getattr(self, str(m.group(0))[1:-1], "_")), dest_pattern)
destination = os.path.dirname(dest_pattern)
... | def dump(self, dest_pattern="{id}.jpg", override=True, max_size=None, bits=8, contrast=None, gamma=None,
colormap=None, inverse=None) | Download the image with optional image modifications.
Parameters
----------
dest_pattern : str, optional
Destination path for the downloaded image. "{X}" patterns are replaced by the value of X attribute
if it exists.
override : bool, optional
True if... | 2.534899 | 2.461094 | 1.029989 |
self.x = x
self.y = y
self.w = w
self.h = h
pattern = re.compile("{(.*?)}")
dest_pattern = re.sub(pattern, lambda m: str(getattr(self, str(m.group(0))[1:-1], "_")), dest_pattern)
del self.x
del self.y
del self.w
del self.h
... | def window(self, x, y, w, h, dest_pattern="{id}-{x}-{y}-{w}-{h}.jpg", override=True, mask=None, alpha=None,
bits=8, annotations=None, terms=None, users=None, reviewed=None) | Extract a window (rectangle) from an image and download it.
Parameters
----------
x : int
The X position of window top-left corner. 0 is image left.
y : int
The Y position of window top-left corner. 0 is image top.
w : int
The window width
... | 2.374752 | 2.357358 | 1.007379 |
if isinstance(model, self.element_type):
yield model
yield from (e for e in model.eAllContents() if isinstance(e, self.element_type)) | def filtered_elements(self, model) | Return iterator based on `element_type`. | 4.579718 | 3.437288 | 1.332364 |
parent = package.eContainer()
if parent:
return os.path.join(cls.folder_path_for_package(parent), package.name)
return package.name | def folder_path_for_package(cls, package: ecore.EPackage) | Returns path to folder holding generated artifact for given element. | 3.052816 | 2.830831 | 1.078417 |
classes = {c for c in p.eClassifiers if isinstance(c, ecore.EClass)}
references = itertools.chain(*(c.eAllReferences() for c in classes))
references_types = (r.eType for r in references)
imported = {c for c in references_types if getattr(c, 'ePackage', p) is not p}
imp... | def imported_classifiers_package(p: ecore.EPackage) | Determines which classifiers have to be imported into given package. | 3.310071 | 3.042425 | 1.087972 |
classes = {c for c in p.eClassifiers if isinstance(c, ecore.EClass)}
supertypes = itertools.chain(*(c.eAllSuperTypes() for c in classes))
imported = {c for c in supertypes if c.ePackage is not p}
attributes = itertools.chain(*(c.eAttributes for c in classes))
attribute... | def imported_classifiers(p: ecore.EPackage) | Determines which classifiers have to be imported into given module. | 3.028222 | 2.847438 | 1.06349 |
classes = (c for c in p.eClassifiers if isinstance(c, ecore.EClass))
return sorted(classes, key=lambda c: len(set(c.eAllSuperTypes()))) | def classes(p: ecore.EPackage) | Returns classes in package in ordered by number of bases. | 3.67758 | 2.577519 | 1.42679 |
return (c for c in value.eAllContents() if isinstance(c, type_)) | def filter_all_contents(value: ecore.EPackage, type_) | Returns `eAllContents(type_)`. | 6.012363 | 3.745825 | 1.605084 |
def collect_packages(element, packages):
parent = element.eContainer()
if parent:
collect_packages(parent, packages)
packages.append(element.name)
packages = []
collect_packages(value, packages)
if relative_to < 0 or relativ... | def filter_pyfqn(cls, value, relative_to=0) | Returns Python form of fully qualified name.
Args:
relative_to: If greater 0, the returned path is relative to the first n directories. | 3.596973 | 3.555544 | 1.011652 |
environment = super().create_environment(**kwargs)
environment.tests.update({
'type': self.test_type,
'kind': self.test_kind,
'opposite_before_self': self.test_opposite_before_self,
})
environment.filters.update({
'docstringline': ... | def create_environment(self, **kwargs) | Return a new Jinja environment.
Derived classes may override method to pass additional parameters or to change the template
loader type. | 4.149406 | 3.859991 | 1.074978 |
with pythonic_names():
super().generate(model, outfolder)
check_dependency = self.with_dependencies and model.eResource
if check_dependency:
if exclude is None:
exclude = set()
resource = model.eResource
... | def generate(self, model, outfolder, *, exclude=None) | Generate model code.
Args:
model: The meta-model to generate code for.
outfolder: Path to the directoty that will contain the generated code.
exclude: List of referenced resources for which code was already generated
(to prevent regeneration). | 6.642587 | 6.522519 | 1.018408 |
return ctx.gi.annotations.delete_dbxref(feature_id, db, accession, organism=organism, sequence=sequence) | def cli(ctx, feature_id, db, accession, organism="", sequence="") | Delete a dbxref from a feature
Output:
A standard apollo feature dictionary ({"features": [{...}]}) | 3.461294 | 3.570849 | 0.96932 |
data = {
'commonName': common_name,
'directory': directory,
'publicMode': public,
}
if blatdb is not None:
data['blatdb'] = blatdb
if genus is not None:
data['genus'] = genus
if species is not None:
... | def add_organism(self, common_name, directory, blatdb=None, genus=None,
species=None, public=False) | Add an organism
:type common_name: str
:param common_name: Organism common name
:type directory: str
:param directory: Server-side directory
:type blatdb: str
:param blatdb: Server-side Blat directory for the organism
:type genus: str
:param genus: Gen... | 3.16879 | 3.435195 | 0.922448 |
data = {
'id': organism_id,
'name': common_name,
'directory': directory,
'publicMode': public,
}
if blatdb is not None:
data['blatdb'] = blatdb
if genus is not None:
data['genus'] = genus
if species... | def update_organism(self, organism_id, common_name, directory, blatdb=None, species=None, genus=None, public=False) | Update an organism
:type organism_id: str
:param organism_id: Organism ID Number
:type common_name: str
:param common_name: Organism common name
:type directory: str
:param directory: Server-side directory
:type blatdb: str
:param blatdb: Server-side B... | 2.089129 | 2.361078 | 0.88482 |
return ctx.gi.annotations.set_readthrough_stop_codon(feature_id, organism=organism, sequence=sequence) | def cli(ctx, feature_id, organism="", sequence="") | Set the feature to read through the first encountered stop codon
Output:
A standard apollo feature dictionary ({"features": [{...}]}) | 5.219499 | 5.298757 | 0.985042 |
return ctx.gi.annotations.merge_exons(exon_a, exon_b, organism=organism, sequence=sequence) | def cli(ctx, exon_a, exon_b, organism="", sequence="") | Merge two exons
Output:
A standard apollo feature dictionary ({"features": [{...}]}) | 2.950437 | 3.56335 | 0.827995 |
return ctx.gi.status.update_status(id_number, new_value) | def cli(ctx, id_number, new_value) | Update a status name
Output:
an empty dictionary | 5.52864 | 6.695376 | 0.82574 |
return ctx.gi.annotations.set_description(feature_id, description, organism=organism, sequence=sequence) | def cli(ctx, feature_id, description, organism="", sequence="") | Set a feature's description
Output:
A standard apollo feature dictionary ({"features": [{...}]}) | 3.105669 | 4.338944 | 0.715766 |
return ctx.gi.users.remove_from_group(group, user) | def cli(ctx, group, user) | Remove a user from a group
Output:
an empty dictionary | 4.788287 | 8.202052 | 0.583791 |
return ctx.gi.annotations.set_translation_end(feature_id, end, organism=organism, sequence=sequence) | def cli(ctx, feature_id, end, organism="", sequence="") | Set a feature's end
Output:
A standard apollo feature dictionary ({"features": [{...}]}) | 3.595124 | 5.112185 | 0.703246 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.