-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #157 from biothings/py3.10_asyncio_pymongo4
Use Py3.10 asyncio API and upgrade to pymongo4
- Loading branch information
Showing
14 changed files
with
320 additions
and
289 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,37 @@ | ||
import biothings.hub.databuild.mapper as mapper | ||
from biothings import config as btconfig | ||
|
||
logging = btconfig.logger | ||
max_id_length = btconfig.MAX_ID_LENGTH | ||
|
||
|
||
class TagObserved(mapper.BaseMapper): | ||
|
||
def load(self, *args, **kwargs): | ||
pass | ||
|
||
def process(self,docs): | ||
def process(self, docs): | ||
for doc in docs: | ||
doc.update({'observed':True}) | ||
doc.update({'observed': True}) | ||
yield doc | ||
|
||
|
||
class SkipLongId(mapper.BaseMapper): | ||
|
||
def load(self, *args, **kwargs): | ||
pass | ||
|
||
def process(self,docs): | ||
def process(self, docs): | ||
for doc in docs: | ||
if len(doc["_id"]) > max_id_length: | ||
logging.debug("Skip doc, _id too long: %s" % doc["_id"]) | ||
continue | ||
yield doc | ||
|
||
class TagObservedAndSkipLongId(TagObserved,SkipLongId): | ||
|
||
def process(self,docs): | ||
okdocs = SkipLongId.process(self,docs) | ||
obsdocs = TagObserved.process(self,okdocs) | ||
|
||
|
||
class TagObservedAndSkipLongId(TagObserved, SkipLongId): | ||
|
||
def process(self, docs): | ||
okdocs = SkipLongId.process(self, docs) | ||
obsdocs = TagObserved.process(self, okdocs) | ||
return obsdocs |
Oops, something went wrong.