Skip to content

Commit

Permalink
chore: fix minor typos
Browse files Browse the repository at this point in the history
  • Loading branch information
afuetterer committed Jan 25, 2024
1 parent ae3763d commit 65ed463
Show file tree
Hide file tree
Showing 25 changed files with 45 additions and 45 deletions.
4 changes: 2 additions & 2 deletions frictionless/analyzer/analyzer.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@


class Analyzer:
# Resoure
# Resource

def analyze_table_resource(
self, resource: TableResource, *, detailed: bool = False
Expand Down Expand Up @@ -100,7 +100,7 @@ def analyze_table_resource(
var_x.append(cell_x)
var_y.append(cell_y)

# check for atleast 2 data points for correlation calculation
# check for at least 2 data points for correlation calculation
if len(var_x) > 2:
if field.name not in analysis_report["correlations"]:
analysis_report["correlations"][field.name] = []
Expand Down
2 changes: 1 addition & 1 deletion frictionless/checks/baseline.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
class baseline(Check):
"""Check a table for basic errors
Ths check is enabled by default for any `validate` function run.
This check is enabled by default for any `validate` function run.
"""

Expand Down
2 changes: 1 addition & 1 deletion frictionless/checks/row/row_constraint.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class row_constraint(Check):

formula: str
"""
Python expression to apply to all rows. To evaluate the forumula
Python expression to apply to all rows. To evaluate the formula
simpleeval library is used.
"""

Expand Down
2 changes: 1 addition & 1 deletion frictionless/console/commands/transform.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def console_transform(
helpers.print_exception(console, debug=debug, exception=exception)
raise typer.Exit(code=1)

# TODO: support outputing packages
# TODO: support outputting packages

# Return default
table = result.to_petl() # type: ignore
Expand Down
2 changes: 1 addition & 1 deletion frictionless/console/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@

descriptor = Option(
default=None,
help="Excplicit path to the descriptor instead of guessing by providing a source",
help="Explicit path to the descriptor instead of guessing by providing a source",
)

keep_delimiter = Option(
Expand Down
6 changes: 3 additions & 3 deletions frictionless/detector/detector.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class Detector:

sample_size: int = settings.DEFAULT_SAMPLE_SIZE
"""
The amount of rows to be extracted as a sample for dialect/schema infering.
The amount of rows to be extracted as a sample for dialect/schema inferring.
It defaults to 100. The sample_size can be increased to improve the inference
accuracy.
"""
Expand Down Expand Up @@ -113,7 +113,7 @@ class Detector:
Whether to sync the schema.
If it sets to `True` the provided schema will be mapped to
the inferred schema. It means that, for example, you can
provide a subset of fileds to be applied on top of the inferred
provide a subset of fields to be applied on top of the inferred
fields or the provided schema can have different order of fields.
"""

Expand Down Expand Up @@ -265,7 +265,7 @@ def detect_dialect(
):
# This algorithm tries to find a header row
# that is close to average sample width or use default one
# We use it to eleminate initial rows that are comments/etc
# We use it to eliminate initial rows that are comments/etc

# Get header rows
width = round(sum(widths) / len(widths))
Expand Down
2 changes: 1 addition & 1 deletion frictionless/error/error.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
# NOTE:
# Consider other approaches for report/errors as dict is not really
# effective as it can be very memory consumig. As an option we can store
# raw data without rendering an error template to an error messsage.
# raw data without rendering an error template to an error message.


@attrs.define(kw_only=True, repr=False)
Expand Down
2 changes: 1 addition & 1 deletion frictionless/formats/csv/control.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ class CsvControl(Control):
# Convert

def to_python(self):
"""Conver to Python's `csv.Dialect`"""
"""Convert to Python's `csv.Dialect`"""
config = csv.excel()
config.delimiter = self.delimiter
config.doublequote = self.double_quote if self.escape_char else True
Expand Down
2 changes: 1 addition & 1 deletion frictionless/formats/csv/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def read_cell_stream_create(self): # type: ignore
config = csv.Sniffer().sniff("".join(sample), delimiter) # type: ignore
except csv.Error:
config = csv.excel()
# We can't rely on this guess as it's can be confused with embeded JSON
# We can't rely on this guess as it's can be confused with embedded JSON
# https://github.com/frictionlessdata/frictionless-py/issues/493
if config.quotechar == "'":
config.quotechar = '"'
Expand Down
4 changes: 2 additions & 2 deletions frictionless/formats/excel/parsers/xlsx.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ def read_cell_stream_create(self):
# Fill merged cells
if control.fill_merged_cells:
# NOTE:
# We can try using an algorithm similiar to what XlsParser has
# We can try using an algorithm similar to what XlsParser has
# to support mergin cells in the read-only mode (now we need the write mode)
for merged_cell_range in list(sheet.merged_cells.ranges): # type: ignore
merged_cell_range = str(merged_cell_range)
Expand Down Expand Up @@ -306,7 +306,7 @@ def convert_excel_date_format_string(excel_date: str):
)
new_excel_code = False

# Handle a new code without a different characeter in between
# Handle a new code without a different character in between
if (
ec
and not is_escape_char
Expand Down
2 changes: 1 addition & 1 deletion frictionless/formats/parquet/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def create_parser(self, resource: Resource):
def detect_resource(self, resource: Resource):
if resource.format in ["parq", "parquet"]:
resource.datatype = resource.datatype or "table"
resource.mediatype = resource.mediatype or "appliction/parquet"
resource.mediatype = resource.mediatype or "application/parquet"

def select_control_class(self, type: Optional[str] = None):
if type == "parquet":
Expand Down
8 changes: 4 additions & 4 deletions frictionless/formats/sql/mapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
class SqlMapper(Mapper):
"""Metadata mapper Frictionless from/to SQL
Partialy based on unmerged @ezwelty's work:
Partially based on unmerged @ezwelty's work:
- https://github.com/frictionlessdata/framework/pull/862
"""
Expand Down Expand Up @@ -208,7 +208,7 @@ def write_field(self, field: Field, *, table_name: str) -> Column: # type: igno
column_type = self.write_type(field.type) # type: ignore
nullable = not field.required

# Length contraints
# Length constraints
if field.type == "string":
min_length = field.constraints.get("minLength", None)
max_length = field.constraints.get("maxLength", None)
Expand All @@ -227,14 +227,14 @@ def write_field(self, field: Field, *, table_name: str) -> Column: # type: igno
if not isinstance(column_type, sa.CHAR) or self.dialect.name == "sqlite":
checks.append(Check("LENGTH(%s) >= %s" % (quoted_name, min_length)))

# Unique contstraint
# Unique constraint
unique = field.constraints.get("unique", False)
if self.dialect.name == "mysql":
# MySQL requires keys to have an explicit maximum length
# https://stackoverflow.com/questions/1827063/mysql-error-key-specification-without-a-key-length
unique = unique and column_type is not sa.Text

# Others contstraints
# Others constraints
for const, value in field.constraints.items():
if const == "minimum":
checks.append(Check("%s >= %s" % (quoted_name, value)))
Expand Down
2 changes: 1 addition & 1 deletion frictionless/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ def normalize_path(path: str, *, basepath: Optional[str] = None):

# NOTE:
# We need to rebase this function on checking actual path
# being withing a basepath directory (it's a safer approach)
# being within a basepath directory (it's a safer approach)
def is_safe_path(path: str):
contains_windows_var = lambda val: re.match(r"%.+%", val) # type: ignore
contains_posix_var = lambda val: re.match(r"\$.+", val) # type: ignore
Expand Down
4 changes: 2 additions & 2 deletions frictionless/metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@


class Metadata:
"""Metadata represenation
"""Metadata representation
For proper functioning a child class must be decorated by
"@attrs.define(kw_only=True, repr=False)" and ensure that
Expand Down Expand Up @@ -242,7 +242,7 @@ def to_yaml(self, path: Optional[str] = None) -> str:
def to_markdown(self, path: Optional[str] = None, table: bool = False) -> str:
"""Convert metadata as a markdown
This feature has been contributed to the framwork by Ethan Welty (@ezwelty):
This feature has been contributed to the framework by Ethan Welty (@ezwelty):
- https://github.com/frictionlessdata/frictionless-py/issues/837
Parameters:
Expand Down
10 changes: 5 additions & 5 deletions frictionless/package/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -355,11 +355,11 @@ def analyze(self, *, detailed: bool = False):
dict: dict of resource analysis
"""
analisis: Dict[str, Any] = {}
analysis: Dict[str, Any] = {}
for resource in self.resources:
if isinstance(resource, platform.frictionless_resources.TableResource):
analisis[resource.name] = resource.analyze(detailed=detailed)
return analisis
analysis[resource.name] = resource.analyze(detailed=detailed)
return analysis

# Describe

Expand Down Expand Up @@ -627,7 +627,7 @@ def metadata_validate(cls, descriptor: types.IDescriptor): # type: ignore
yield errors.PackageError(note=f'path "{item}" is not safe')
return

# Resoruce Names
# Resource Names
resource_names: List[str] = []
for resource in descriptor["resources"]:
if isinstance(resource, dict) and "name" in resource:
Expand Down Expand Up @@ -679,7 +679,7 @@ def metadata_validate(cls, descriptor: types.IDescriptor): # type: ignore
if profile == "tabular-data-package":
for resource in resources:
if resource.get("profile", None) != "tabular-data-resource":
note = 'profile "tabular-data-package" requries all the resources to be "tabular-data-resource"'
note = 'profile "tabular-data-package" requires all the resources to be "tabular-data-resource"'
yield errors.PackageError(note=note)

# Misleading
Expand Down
4 changes: 2 additions & 2 deletions frictionless/pipeline/step.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@

# NOTE:
# We might consider migrating transform_resource API to emitting
# data as an ouput instead of setting it to target.data
# data as an output instead of setting it to target.data
# It might make custom transform steps more eloquent
# This change probably not even breaking because it will be a new
# mode supported by the system (function emiting data instead of returning None)
# mode supported by the system (function emitting data instead of returning None)
# We might consider adding `process_schema/row` etc to the Step class


Expand Down
4 changes: 2 additions & 2 deletions frictionless/portals/github/adapter.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ def write_package(self, package: Package):
repository.create_file(
path=resource_path,
message='Create "resource_path"',
# It seeems to be it requries a string by a mistake
# It seeems to be it requires a string by a mistake
# https://stackoverflow.com/questions/72668275/how-to-upload-an-image-file-to-github-using-pygithub
content=resource.read_bytes(), # type: ignore
branch=branch,
Expand All @@ -122,7 +122,7 @@ def write_package(self, package: Package):
# Enable pages
if self.control.enable_pages:
try:
# TODO: rebase on public API when it's avaialble
# TODO: rebase on public API when it's available
# https://github.com/PyGithub/PyGithub/issues/2037
repository._requester.requestJsonAndCheck(
"POST",
Expand Down
2 changes: 1 addition & 1 deletion frictionless/portals/zenodo/control.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class ZenodoControl(Control):

base_url: str = BASE_URL
"""Endpoint for zenodo. By default it is set to live site (https://zenodo.org/api). For testing upload,
we can use sandbox for example, https://sandbox.zenodo.org/api. Sandbox doesnot work for
we can use sandbox for example, https://sandbox.zenodo.org/api. Sandbox does not work for
reading."""

title: Optional[str] = None
Expand Down
10 changes: 5 additions & 5 deletions frictionless/resource/resource.py
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ class Resource(Metadata, metaclass=Factory): # type: ignore

tabular: ClassVar[bool] = False
"""
Whether the resoruce is tabular
Whether the resource is tabular
"""

def __attrs_post_init__(self):
Expand Down Expand Up @@ -254,7 +254,7 @@ def __attrs_post_init__(self):

super().__attrs_post_init__()

# TODO: shall we guarantee here that it's at the beggining for the file?
# TODO: shall we guarantee here that it's at the beginning for the file?
# TODO: maybe it's possible to do type narrowing here?
def __enter__(self):
if self.closed:
Expand Down Expand Up @@ -287,7 +287,7 @@ def normpath(self) -> Optional[str]:
if self.path:
return helpers.normalize_path(self.path, basepath=self.basepath)

# TODO: add asteriks for user/pass in url
# TODO: add asterisks for user/pass in url
@property
def place(self) -> str:
"""Stringified resource location"""
Expand Down Expand Up @@ -497,7 +497,7 @@ def infer(self, *, stats: bool = False) -> None:
stats: stream file completely and infer stats
"""
if not self.closed:
note = "Resource.infer canot be used on a open resource"
note = "Resource.infer cannot be used on a open resource"
raise FrictionlessException(errors.ResourceError(note=note))
with self:
if not stats:
Expand Down Expand Up @@ -844,7 +844,7 @@ def metadata_validate(cls, descriptor: types.IDescriptor): # type: ignore
schema = descriptor.get("schema")
if profile == "tabular-data-resource":
if not schema:
note = 'profile "tabular-data-resource" requries "schema" to be present'
note = 'profile "tabular-data-resource" requires "schema" to be present'
yield errors.ResourceError(note=note)

# Misleading
Expand Down
4 changes: 2 additions & 2 deletions frictionless/resources/table.py
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ def __open_lookup(self):

def __open_row_stream(self):
# TODO: we need to rework this field_info / row code
# During row streaming we crate a field info structure
# During row streaming we create a field info structure
# This structure is optimized and detached version of schema.fields
# We create all data structures in-advance to share them between rows

Expand Down Expand Up @@ -461,7 +461,7 @@ def infer(self, *, stats: bool = False) -> None:
stats: stream file completely and infer stats
"""
if not self.closed:
note = "Resource.infer canot be used on a open resource"
note = "Resource.infer cannot be used on a open resource"
raise FrictionlessException(errors.ResourceError(note=note))
with self:
if not stats:
Expand Down
2 changes: 1 addition & 1 deletion frictionless/schemes/multipart/loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from .control import MultipartControl

# NOTE:
# Curretnly the situation with header/no-header concatenation is complicated
# Currently the situation with header/no-header concatenation is complicated
# We need to review it and add more tests for general/tabular edge cases


Expand Down
2 changes: 1 addition & 1 deletion frictionless/steps/row/row_split.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class row_split(Step):

field_name: str
"""
Field name whose cell value will be splitted.
Field name whose cell value will be split.
"""

# Transform
Expand Down
2 changes: 1 addition & 1 deletion frictionless/system/adapter.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

# NOTE:
# There should be a way to check the supported functionality of a concrete adapter
# For example, does it suport `read_catalog`? We can implement it based on what
# For example, does it support `read_catalog`? We can implement it based on what
# methods return (or not) or use some kins of `supported_actions` property


Expand Down
4 changes: 2 additions & 2 deletions frictionless/system/loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
# Probably we need to rework the way we calculate stats
# First of all, it's not really reliable as read/read1(size) can be called many times
# Secondly, for now, we stream compressed files twice (see loader.read_byte_stream_decompress)
# Although, we need to reviw how we collect buffer - cab it be less IO operations?
# Although, we need to review how we collect buffer - cab it be less IO operations?


# TODO: migrate to dataclass?
Expand Down Expand Up @@ -209,7 +209,7 @@ def read_byte_stream_decompress(
with platform.zipfile.ZipFile(byte_stream) as archive:
name = self.resource.innerpath or archive.namelist()[0]
if not name:
error = errors.Error(note="the arhive is empty")
error = errors.Error(note="the archive is empty")
raise FrictionlessException(error)
# TODO: enable typing when resource.innerpath is fixed
with archive.open(name) as file: # type: ignore
Expand Down
2 changes: 1 addition & 1 deletion frictionless/table/row.py
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ def to_dict(
if types is None and csv:
types = platform.frictionless_formats.CsvParser.supported_types

# Covert
# Convert
if types is not None:
for field_mapping in self.__field_info["mapping"].values():
field, _, _, cell_writer = field_mapping
Expand Down

0 comments on commit 65ed463

Please sign in to comment.