code
stringlengths
3
6.57k
tqdm.tqdm(users, ncols=80, ascii=True)
transaction.atomic()
filter(user_id=user.id, feed_id=feed.id)
first()
user_feed.save()
main.command()
update_feed_use_proxy()
click.echo('rss proxy not enable!')
where (NOT title LIKE ANY(%s)
or (total_storys <= 5 and dt_updated <= '2019-12-01')
list(Feed.objects.raw(sql, [blacklist])
click.echo(f'{len(feeds)
FeedReader(**_proxy_helper.get_proxy_options()
enumerate(feeds)
click.echo(f'#{i} {feed}')
reader.read(feed.url)
click.echo(f' #{i} status={FeedResponseStatus.name_of(status)
FeedResponseStatus.is_need_proxy(status)
reader.read(feed.url, use_proxy=True)
click.echo(f' #{i} proxy_status={FeedResponseStatus.name_of(proxy_status)
proxy_feeds.append(feed)
click.echo(f'{len(proxy_feeds)
transaction.atomic()
tqdm.tqdm(proxy_feeds, ncols=80, ascii=True)
feed.refresh_from_db()
feed.save()
main.command()
click.argument('key')
delete_feed(key)
int(key)
isinstance(key, int)
Feed.get_by_pk(key)
Q(url__contains=key)
Q(title__contains=key)
first()
print(f'not found feed like {key}')
click.confirm(f'delete {feed} ?')
feed.delete()
main.command()
click.option('--feeds', help="feed ids, separate by ','")
click.option('--union-feeds', help="union feed ids, separate by ','")
click.option('--key', help="feed url or title keyword")
click.option('--expire', type=int, default=1, help="expire hours")
refresh_feed(feeds, union_feeds, key, expire=None)
feed_ids.extend(_get_feed_ids(feeds)
feed_ids.extend(_decode_union_feed_ids(union_feeds)
Q(url__contains=key)
Q(title__contains=key)
Feed.objects.filter(cond)
only('id')
all()
feed_ids.extend(x.id for x in feed_objs)
list(sorted(set(feed_ids)
time.time()
tqdm.tqdm(feed_ids, ncols=80, ascii=True)
Feed.objects.only('id', 'url', 'use_proxy')
get(pk=feed_id)
main.command()
click.option('--feeds', required=True, help="feed ids, separate by ','")
update_feed_reverse_url(feeds)
_get_feed_ids(feeds)
tqdm.tqdm(feed_ids, ncols=80, ascii=True)
Feed.objects.get(pk=feed_id)
reverse_url(feed.url)
feed.save()
main.command()
click.option('--dst', required=True, help='actor dst')
click.option('--content', help='message content')
click.option('--expire-seconds', type=int, help='expire time in seconds')
tell(dst, content, expire_seconds)
json.loads(content)
int(time.time()
scheduler.tell(dst, content=content, expire_at=expire_at)
main()
SetAnnouncementHandler(webapp2.RequestHandler)
get(self)
self.request.headers.get('X-AppEngine-Cron', None)
ConferenceApi._cacheAnnouncement()
self.response.set_status(204)
SendConfirmationEmailHandler(webapp2.RequestHandler)
post(self)
self.request.headers.get('X-AppEngine-QueueName', None)
app_identity.get_application_id()
self.request.get('email')
pad_to_shape(this, shp)
F.pad(this, (0, shp[3] - this.shape[3], 0, shp[2] - this.shape[2])
First(nn.Module)
__init__(self, in_channels, middle_channels, out_channels, dropout=False)
super(First, self)
__init__()
nn.Conv2d(in_channels, middle_channels, kernel_size=3, padding=1)
nn.BatchNorm2d(middle_channels)
nn.ReLU(inplace=True)
nn.Conv2d(middle_channels, out_channels, kernel_size=3, padding=1)
nn.BatchNorm2d(out_channels)
nn.ReLU(inplace=True)
layers.append(nn.Dropout2d(p=dropout)
nn.Sequential(*layers)
forward(self, x)
self.first(x)