Skip to content

Commit

Permalink
Merge pull request #37 from cclauss/codespell
Browse files Browse the repository at this point in the history
Fix typos discovered by codespell
  • Loading branch information
davidlatwe committed Jun 5, 2021
2 parents 5a5f643 + 7f57772 commit b4b5fa5
Show file tree
Hide file tree
Showing 10 changed files with 28 additions and 25 deletions.
5 changes: 4 additions & 1 deletion .github/workflows/python-package.yml
Expand Up @@ -42,13 +42,16 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install flake8 lmdb pymongo pytest
python -m pip install codespell flake8 lmdb pymongo pytest
- name: Lint with flake8
run: |
# Ideally max-complexity should be set to 10
flake8 . --count --ignore=F841,W503 --max-complexity=26 --max-line-length=88 --statistics
- name: Find typos with codespell
run: codespell --ignore-words-list=nd,nin

- name: Test with pytest (${{ matrix.monty-storage }})
continue-on-error: ${{ matrix.experimental }}
run: >
Expand Down
4 changes: 2 additions & 2 deletions README.md
Expand Up @@ -106,7 +106,7 @@ client = MontyClient(":memory:")
from montydb import set_storage, MontyClient

set_storage("/db/repo", cache_modified=5) # optional step
client = MontyClient("/db/repo") # use curent working dir if no path given
client = MontyClient("/db/repo") # use current working dir if no path given
# ready to go
```

Expand Down Expand Up @@ -235,7 +235,7 @@ client = MontyClient("montydb:///db/repo")
* #### `MongoQueryRecorder`

Record MongoDB query results in a period of time.
*Requires to access databse profiler.*
*Requires to access database profiler.*

This works via filtering the database profile data and reproduce the queries of `find` and `distinct` commands.

Expand Down
4 changes: 2 additions & 2 deletions montydb/client.py
Expand Up @@ -32,7 +32,7 @@ def __init__(self,
returned from queries on this client. Default class is `dict`.
tz_aware (bool, optional): if `True`, `datetime.datetime` instances
returned as values in document by this client will be timezone
awared (otherwise they will be naive).
aware (otherwise they will be naive).
**kwargs: Other optional keyword arguments will pass into storage
engine as write concern arguments.
Expand Down Expand Up @@ -133,7 +133,7 @@ def get_database(self, name):
is_invalid = set('/\\. "$').intersection(set(name))

if is_invalid or not name:
raise errors.OperationFailure("Invaild database name.")
raise errors.OperationFailure("Invalid database name.")
else:
return MontyDatabase(self, name)

Expand Down
2 changes: 1 addition & 1 deletion montydb/collection.py
Expand Up @@ -232,7 +232,7 @@ def replace_one(
return UpdateResult(raw_result)

def _internal_scan_query(self, query_spec):
"""An interanl document generator for update"""
"""An internal document generator for update"""
queryfilter = QueryFilter(query_spec)
documents = self._storage.query(MontyCursor(self), 0)
first_matched = None
Expand Down
2 changes: 1 addition & 1 deletion montydb/database.py
Expand Up @@ -91,7 +91,7 @@ def get_collection(self, name, codec_options=None, write_concern=None, **kwargs)
is_invaild = True

if is_invaild or not name:
raise errors.OperationFailure("Invaild collection name.")
raise errors.OperationFailure("Invalid collection name.")
else:
return MontyCollection(
self, name, False, codec_options, write_concern, **kwargs
Expand Down
2 changes: 1 addition & 1 deletion montydb/engine/field_walker.py
Expand Up @@ -167,7 +167,7 @@ def __eq__(self, other):


class FieldNode(str):
"""Docuemtn field node
"""Document field node
Arguments:
field (str): Document field name
Expand Down
16 changes: 8 additions & 8 deletions montydb/engine/queries.py
Expand Up @@ -108,9 +108,9 @@ class LogicBox(list):
"""

def __init__(self, theme, implicity=False):
def __init__(self, theme, implicitly=False):
self.theme = theme
self.implicity = implicity
self.implicitly = implicitly
self._logic = {
"$and": self._call_and,
"$or": self._call_or,
Expand All @@ -127,7 +127,7 @@ def __repr__(self):
"""Display `theme` and `LogicBox` or operators content within"""
content = []
name = "[{}]"
if not self.implicity:
if not self.implicitly:
content = ["LogicBox({})".format(self.theme)]
name = "{}"

Expand All @@ -150,7 +150,7 @@ def __call__(self, fieldwalker):
A short-circuit logic sub-structure, passing `FieldWalker` instance.
Args:
fieldwalker (FieldWalker): Recived from `QueryFilter` instance.
fieldwalker (FieldWalker): Received from `QueryFilter` instance.
"""
try:
Expand Down Expand Up @@ -252,7 +252,7 @@ def __call__(self, doc, doc_type=None):
filter or not.
Args:
doc (dict): Document recived from database.
doc (dict): Document received from database.
"""
self.__fieldwalker = FieldWalker(doc, doc_type)
Expand All @@ -265,9 +265,9 @@ def fieldwalker(self):
def parser(self, spec):
"""Top-level parser"""

# Implementation of implicity $and operation, fundamental query
# Implementation of implicitly $and operation, fundamental query
# container.
logic_box = LogicBox("$and", implicity=True)
logic_box = LogicBox("$and", implicitly=True)

for path, sub_spec in spec.items():
if path.startswith("$"):
Expand All @@ -289,7 +289,7 @@ def subparser(self, path, sub_spec):
logic_box = LogicBox(path)

# There are two processing direction in field-level, one is filtering
# with operators, the other is implicity value $eq operation.
# with operators, the other is implicitly value $eq operation.
# The direction was first defined by the expression value type, if is
# <dict>, then by *first* key is starts with "$" or not.
#
Expand Down
2 changes: 1 addition & 1 deletion montydb/storage/__init__.py
Expand Up @@ -107,7 +107,7 @@ def wconcern_parser(self, **client_kwargs):
Parsing storage specific write concern
Optional, use Monty WriteConcern by default.
Recive MontyClient kwargs, should parse kwargs and return a instance
Receive MontyClient kwargs, should parse kwargs and return a instance
of `montydb.base.WriteConcern` class.
"""
pass
Expand Down
2 changes: 1 addition & 1 deletion montydb/types/objectid.py
Expand Up @@ -257,7 +257,7 @@ def __getstate__(self):
def __setstate__(self, value):
"""explicit state set from pickling
"""
# Provide backwards compatability with OIDs
# Provide backwards compatibility with OIDs
# pickled with pymongo-1.9 or older.
if isinstance(value, dict):
oid = value["_ObjectId__id"]
Expand Down
14 changes: 7 additions & 7 deletions montydb/utils/io.py
Expand Up @@ -71,7 +71,7 @@ def montyimport(database,
def montyexport(database,
collection,
out,
fileds=None,
fields=None,
query=None,
json_options=None,
use_bson=False):
Expand All @@ -98,16 +98,16 @@ def montyexport(database,
"""
init_bson(use_bson)
collection = _collection(database, collection)
fileds = fileds or []
fields = fields or []

out = os.path.abspath(out)
if not os.path.isdir(os.path.dirname(out)):
os.makedirs(os.path.dirname(out))

if isinstance(fileds, string_types):
fileds = [fileds]
if isinstance(fields, string_types):
fields = [fields]

projection = {field: True for field in fileds} or None
projection = {field: True for field in fields} or None

with open(out, "w") as fp:
for doc in collection.find(query, projection=projection):
Expand Down Expand Up @@ -183,7 +183,7 @@ def montydump(database, collection, dumpfile):
class MongoQueryRecorder(object):
"""Record MongoDB query results in a period of time
:Important: Requires to access databse profiler.
:Important: Requires to access database profiler.
This works via filtering the database profile data and reproduce the
queries of `find` and `distinct` commands.
Expand Down Expand Up @@ -252,7 +252,7 @@ def stop(self):
def extract(self):
"""Collect documents via previous queries
Via filtering the `[databse].system.profile`, parsing previous
Via filtering the `[database].system.profile`, parsing previous
commands to reproduce the query results.
NOTE: Depend on the `namespace`, the result may across multiple
Expand Down

0 comments on commit b4b5fa5

Please sign in to comment.