code
stringlengths
3
6.57k
Mock(object)
Mock()
mock_write(error_message)
buffer.append(error_message)
s3gis.KMLLayer(s3gis.GIS()
kml_layer.as_javascript()
initialize()
Character(name='Human')
human.put()
Character(name='Droid')
droid.put()
Faction(id="rebels", name='Alliance to Restore the Republic', hero_key=human.key)
rebels.put()
Faction(id="empire", name='Galactic Empire', hero_key=droid.key)
empire.put()
Ship(name='X-Wing', faction_key=rebels.key)
xwing.put()
Ship(name='Y-Wing', faction_key=rebels.key)
ywing.put()
Ship(name='A-Wing', faction_key=rebels.key)
awing.put()
Ship(name='Millenium Falcon', faction_key=rebels.key)
falcon.put()
Ship(name='Home One', faction_key=rebels.key)
homeOne.put()
Ship(name='TIE Fighter', faction_key=empire.key)
tieFighter.put()
Ship(name='TIE Interceptor', faction_key=empire.key)
tieInterceptor.put()
Ship(name='Executor', faction_key=empire.key)
executor.put()
create_ship(ship_name, faction_key)
Ship(name=ship_name, faction_key=faction_key)
new_ship.put()
logging.getLogger(__name__)
click.group()
main()
_decode_feed_ids(option_feeds)
_decode_feed_ids('123,456')
int(x)
option_feeds.strip()
split(',')
_decode_union_feed_ids(option_feeds)
_decode_union_feed_ids('014064,0140be')
unionid.decode(x)
option_feeds.strip()
split(',')
_get_all_feed_ids()
Feed.objects.only('id')
all()
_get_feed_ids(option_feeds)
_decode_feed_ids(option_feeds)
_get_all_feed_ids()
_get_story_ids(option_storys)
option_storys.strip()
split(',')
Story.objects.only('id')
all()
main.command()
click.option('--dry-run', is_flag=True)
fix_feed_total_storys(dry_run=False)
Story.query_feed_incorrect_total_storys()
LOG.info('total %s incorrect feeds', len(incorrect_feeds)
click.echo(format_table(incorrect_feeds, header=header)
transaction.atomic()
tqdm.tqdm(incorrect_feeds, ncols=80, ascii=True)
Story.fix_feed_total_storys(feed_id)
LOG.info('correct %s feeds', num_corrected)
main.command()
click.option('--feeds', help="feed ids, separate by ','")
update_feed_monthly_story_count(feeds=None)
_get_feed_ids(feeds)
LOG.info('total %s feeds', len(feed_ids)
tqdm.tqdm(feed_ids, ncols=80, ascii=True)
transaction.atomic()
Story.refresh_feed_monthly_story_count(feed_id)
main.command()
click.option('--feeds', help="feed ids, separate by ','")
update_feed_dryness(feeds=None)
_get_feed_ids(feeds)
LOG.info('total %s feeds', len(feed_ids)
tqdm.tqdm(feed_ids, ncols=80, ascii=True)
transaction.atomic()
Feed.get_by_pk(feed_id)
Story.refresh_feed_monthly_story_count(feed_id)
feed.refresh_from_db()
feed.monthly_story_count.dryness()
feed.save()
main.command()
click.option('--feeds', help="feed ids, separate by ','")
update_feed_dt_first_story_published(feeds=None)
_get_feed_ids(feeds)
LOG.info('total %s feeds', len(feed_ids)
tqdm.tqdm(feed_ids, ncols=80, ascii=True)
transaction.atomic()
Feed.get_by_pk(feed_id)
Story.get_by_offset(feed_id, 0, detail=True)
LOG.warning(f'story feed_id={feed_id} offset=0 not exists')
feed.save()
main.command()