Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrading biome #182

Merged
merged 1 commit into from
Mar 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions __tests__/expr.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ describe("expr", () => {
${2} | ${2}
`("$# fillNan", ({ replacement, filled }) => {
const df = pl.DataFrame({
a: [1, NaN, 2],
a: [1, Number.NaN, 2],
b: [2, 1, 1],
});
const expected = pl.DataFrame({ fillNan: [1, filled, 2] });
Expand Down Expand Up @@ -412,13 +412,13 @@ describe("expr", () => {
expect(actual).toFrameEqual(expected);
});
test("isNan", () => {
const df = pl.DataFrame({ a: [1, NaN, 2] });
const df = pl.DataFrame({ a: [1, Number.NaN, 2] });
const expected = pl.DataFrame({ isNan: [false, true, false] });
const actual = df.select(col("a").isNan().as("isNan"));
expect(actual).toFrameEqual(expected);
});
test("isNotNan", () => {
const df = pl.DataFrame({ a: [1, NaN, 2] });
const df = pl.DataFrame({ a: [1, Number.NaN, 2] });
const expected = pl.DataFrame({ isNotNan: [true, false, true] });
const actual = df.select(col("a").isNotNan().as("isNotNan"));
expect(actual).toFrameEqual(expected);
Expand Down Expand Up @@ -1831,18 +1831,19 @@ describe("rolling", () => {
const expected = pl
.Series(
"rolling",
[null, 0.707107, 0.707107, 0.707107, 0.707107],
[null, Math.SQRT1_2, Math.SQRT1_2, Math.SQRT1_2, Math.SQRT1_2],
pl.Float64,
)
.round(10)
.toFrame();
expect(df.select(col("rolling").rollingStd(2).round(6))).toFrameEqual(
expect(df.select(col("rolling").rollingStd(2).round(10))).toFrameEqual(
expected,
);
expect(
df.select(
col("rolling")
.rollingStd({ windowSize: 2, center: true, ddof: 4 })
.round(6),
.round(10),
),
).toFrameEqual(expected);
});
Expand Down
2 changes: 1 addition & 1 deletion __tests__/series.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ describe("typedArrays", () => {
const int64Array = new BigInt64Array([1n, 2n, 3n]);
const actual = pl.Series(int64Array).toArray();

const expected = Array.from(int64Array).map((v: any) => parseInt(v));
const expected = Array.from(int64Array).map((v: any) => Number.parseInt(v));

expect(actual).toEqual(expected);
});
Expand Down
7 changes: 4 additions & 3 deletions biome.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,14 @@
"rules": {
"recommended": true,
"style": {
"noParameterAssign": "off"
"noParameterAssign": "off",
"useNodejsImportProtocol": "off"
},
"suspicious": {
"noExplicitAny": "off",
"noUnsafeDeclarationMerging": "off",
"noImplicitAnyLet": "off"

"noImplicitAnyLet": "off",
"noThenProperty": "off"
},
"complexity": {
"useLiteralKeys": "off"
Expand Down
Binary file modified bun.lockb
Binary file not shown.
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,17 +54,17 @@
"precommit": "yarn lint && yarn test"
},
"devDependencies": {
"@biomejs/biome": "^1.5.3",
"@biomejs/biome": "^1.6.1",
"@napi-rs/cli": "^2.18.0",
"@types/chance": "^1.1.6",
"@types/jest": "^29.5.12",
"@types/node": "^20.11.17",
"@types/node": "^20.11.26",
"chance": "^1.1.11",
"jest": "^29.7.0",
"source-map-support": "^0.5.21",
"ts-jest": "^29.1.2",
"ts-node": "^10.9.2",
"typedoc": "^0.25.11",
"typedoc": "^0.25.12",
"typescript": "5.4.2"
},
"packageManager": "yarn@4.0.2",
Expand Down
23 changes: 14 additions & 9 deletions polars/dataframe.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
import pli from "./internals/polars_internal";
import { arrayToJsDataFrame } from "./internals/construction";
import { _GroupBy, DynamicGroupBy, GroupBy, RollingGroupBy } from "./groupby";
import { _LazyDataFrame, LazyDataFrame } from "./lazy/dataframe";
import {
_GroupBy,
DynamicGroupBy,
type GroupBy,
RollingGroupBy,
} from "./groupby";
import { _LazyDataFrame, type LazyDataFrame } from "./lazy/dataframe";
import { concat } from "./functions";
import { Expr } from "./lazy/expr";
import { _Series, Series } from "./series";
import { Stream, Writable } from "stream";
import {
import type {
FillNullStrategy,
JoinOptions,
WriteAvroOptions,
Expand All @@ -20,14 +25,14 @@ import { DataType } from "./datatypes";
import {
columnOrColumns,
columnOrColumnsStrict,
ColumnSelection,
ColumnsOrExpr,
ExprOrString,
type ColumnSelection,
type ColumnsOrExpr,
type ExprOrString,
isSeriesArray,
ValueOrArray,
type ValueOrArray,
} from "./utils";

import {
import type {
Arithmetic,
Deserialize,
GroupByOps,
Expand Down Expand Up @@ -1899,7 +1904,7 @@ export const _DataFrame = (_df: any): DataFrame => {
[jupyterDisplay]() {
let rows = 50;
if (process.env.POLARS_FMT_MAX_ROWS) {
rows = parseInt(process.env.POLARS_FMT_MAX_ROWS);
rows = Number.parseInt(process.env.POLARS_FMT_MAX_ROWS);
}

const limited = this.limit(rows);
Expand Down
2 changes: 1 addition & 1 deletion polars/datatypes/field.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { DataType } from "./datatype";
import type { DataType } from "./datatype";

/**
* A field is a name and a datatype.
Expand Down
6 changes: 3 additions & 3 deletions polars/functions.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
/* eslint-disable no-redeclare */
import { jsTypeToPolarsType } from "./internals/construction";
import { Series, _Series } from "./series";
import { DataFrame, _DataFrame } from "./dataframe";
import { type Series, _Series } from "./series";
import { type DataFrame, _DataFrame } from "./dataframe";
import pli from "./internals/polars_internal";
import { isDataFrameArray, isSeriesArray } from "./utils";
import { ConcatOptions } from "./types";
import type { ConcatOptions } from "./types";

/**
* _Repeat a single value n times and collect into a Series._
Expand Down
6 changes: 3 additions & 3 deletions polars/groupby.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { DataFrame, _DataFrame } from "./dataframe";
import { type DataFrame, _DataFrame } from "./dataframe";
import * as utils from "./utils";
import util from "util";
import { Expr } from "./lazy/expr";
import type { Expr } from "./lazy/expr";
import { col, exclude } from "./lazy/functions";
import { ColumnsOrExpr, StartBy } from "./utils";
import type { ColumnsOrExpr, StartBy } from "./utils";

const inspect = Symbol.for("nodejs.util.inspect.custom");
const inspectOpts = { colors: true, depth: null };
Expand Down
8 changes: 4 additions & 4 deletions polars/io.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { DataType } from "./datatypes";
import type { DataType } from "./datatypes";
import pli from "./internals/polars_internal";
import { DataFrame, _DataFrame } from "./dataframe";
import { type DataFrame, _DataFrame } from "./dataframe";
import { isPath } from "./utils";
import { LazyDataFrame, _LazyDataFrame } from "./lazy/dataframe";
import { Readable, Stream } from "stream";
import { type LazyDataFrame, _LazyDataFrame } from "./lazy/dataframe";
import { type Readable, Stream } from "stream";
import { concat } from "./functions";

export interface ReadCsvOptions {
Expand Down
18 changes: 9 additions & 9 deletions polars/lazy/dataframe.ts
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
import { DataFrame, _DataFrame } from "../dataframe";
import { type DataFrame, _DataFrame } from "../dataframe";
import { Expr, exprToLitOrExpr } from "./expr";
import pli from "../internals/polars_internal";
import {
columnOrColumnsStrict,
ColumnSelection,
ColumnsOrExpr,
ExprOrString,
type ColumnSelection,
type ColumnsOrExpr,
type ExprOrString,
selectionToExprList,
ValueOrArray,
type ValueOrArray,
} from "../utils";
import { _LazyGroupBy, LazyGroupBy } from "./groupby";
import { Deserialize, GroupByOps, Serialize } from "../shared_traits";
import {
import { _LazyGroupBy, type LazyGroupBy } from "./groupby";
import type { Deserialize, GroupByOps, Serialize } from "../shared_traits";
import type {
LazyOptions,
LazyJoinOptions,
SinkCsvOptions,
SinkParquetOptions,
} from "../types";
import { Series } from "../series";
import type { Series } from "../series";

const inspect = Symbol.for("nodejs.util.inspect.custom");

Expand Down
4 changes: 2 additions & 2 deletions polars/lazy/expr/datetime.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { DateFunctions } from "../../shared_traits";
import { Expr, _Expr } from "../expr";
import type { DateFunctions } from "../../shared_traits";
import { type Expr, _Expr } from "../expr";

/**
* DateTime functions
Expand Down
12 changes: 8 additions & 4 deletions polars/lazy/expr/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,16 @@ export type { ExprList as ListNamespace } from "./list";
export type { ExprDateTime as DatetimeNamespace } from "./datetime";
export type { ExprStruct as StructNamespace } from "./struct";

import { DataType } from "../../datatypes";
import type { DataType } from "../../datatypes";
import pli from "../../internals/polars_internal";
import {
ExprOrString,
type ExprOrString,
selectionToExprList,
INSPECT_SYMBOL,
regexToString,
} from "../../utils";
import { Series } from "../../series";
import {
import type {
Arithmetic,
Comparison,
Cumulative,
Expand All @@ -27,7 +27,11 @@ import {
Serialize,
EwmOps,
} from "../../shared_traits";
import { InterpolationMethod, FillNullStrategy, RankMethod } from "../../types";
import type {
InterpolationMethod,
FillNullStrategy,
RankMethod,
} from "../../types";
import { isRegExp } from "util/types";
/**
* Expressions that can be used in various contexts.
Expand Down
2 changes: 1 addition & 1 deletion polars/lazy/expr/list.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Expr, _Expr, exprToLitOrExpr } from "../expr";
import { ListFunctions } from "../../shared_traits";
import type { ListFunctions } from "../../shared_traits";
import { Series } from "../../series";
import pli from "../../internals/polars_internal";
import { concatList } from "../functions";
Expand Down
2 changes: 1 addition & 1 deletion polars/lazy/expr/string.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { StringFunctions } from "../../shared_traits";
import type { StringFunctions } from "../../shared_traits";
import { DataType } from "../../datatypes";
import { regexToString } from "../../utils";
import { Expr, _Expr, exprToLitOrExpr } from "../expr";
Expand Down
2 changes: 1 addition & 1 deletion polars/lazy/expr/struct.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { _Expr, Expr } from "../expr";
import { _Expr, type Expr } from "../expr";

/**
* Struct functions
Expand Down
2 changes: 1 addition & 1 deletion polars/lazy/functions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Expr, _Expr, exprToLitOrExpr } from "./expr";
import { DataType } from "../datatypes";
import { Series } from "../series";
import { DataFrame } from "../dataframe";
import { ExprOrString, range, selectionToExprList } from "../utils";
import { type ExprOrString, range, selectionToExprList } from "../utils";
import pli from "../internals/polars_internal";

/**
Expand Down
4 changes: 2 additions & 2 deletions polars/lazy/groupby.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Expr } from "./expr";
import type { Expr } from "./expr";
import { selectionToExprList } from "../utils";
import { _LazyDataFrame, LazyDataFrame } from "./dataframe";
import { _LazyDataFrame, type LazyDataFrame } from "./dataframe";

/** @ignore */
export const _LazyGroupBy = (_lgb: any): LazyGroupBy => {
Expand Down
4 changes: 2 additions & 2 deletions polars/series/datetime.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Series, _Series } from ".";
import { DateFunctions } from "../shared_traits";
import { type Series, _Series } from ".";
import type { DateFunctions } from "../shared_traits";

export type SeriesDateFunctions = DateFunctions<Series>;

Expand Down
10 changes: 5 additions & 5 deletions polars/series/index.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import pli from "../internals/polars_internal";
import { arrayToJsSeries } from "../internals/construction";
import { DataType, DTYPE_TO_FFINAME, Optional } from "../datatypes";
import { DataType, DTYPE_TO_FFINAME, type Optional } from "../datatypes";
import { DataFrame, _DataFrame } from "../dataframe";
import { SeriesStringFunctions, StringNamespace } from "./string";
import { ListNamespace, SeriesListFunctions } from "./list";
import { SeriesStringFunctions, type StringNamespace } from "./string";
import { type ListNamespace, SeriesListFunctions } from "./list";
import { SeriesDateFunctions } from "./datetime";
import { SeriesStructFunctions } from "./struct";
import { InvalidOperationError } from "../error";
import {
import type {
Arithmetic,
Comparison,
Cumulative,
Expand All @@ -19,7 +19,7 @@ import {
EwmOps,
} from "../shared_traits";
import { col } from "../lazy/functions";
import { InterpolationMethod, RankMethod } from "../types";
import type { InterpolationMethod, RankMethod } from "../types";

const inspect = Symbol.for("nodejs.util.inspect.custom");
/**
Expand Down
4 changes: 2 additions & 2 deletions polars/series/list.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Series, _Series } from ".";
import { type Series, _Series } from ".";
import { exprToLitOrExpr } from "..";
import { col } from "../lazy/functions";
import { ListFunctions } from "../shared_traits";
import type { ListFunctions } from "../shared_traits";

export type ListNamespace = ListFunctions<Series>;

Expand Down
8 changes: 4 additions & 4 deletions polars/series/string.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { Expr } from "./../lazy/expr/index";
import { DataType } from "../datatypes";
import { _Series, Series } from ".";
import type { Expr } from "./../lazy/expr/index";
import type { DataType } from "../datatypes";
import { _Series, type Series } from ".";
import { regexToString } from "../utils";
import { col } from "../lazy/functions";
import { StringFunctions } from "../shared_traits";
import type { StringFunctions } from "../shared_traits";

/**
* namespace containing series string functions
Expand Down
2 changes: 1 addition & 1 deletion polars/series/struct.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import pli from "../internals/polars_internal";
import { _DataFrame, DataFrame } from "../dataframe";
import { _Series, Series } from ".";
import { _Series, type Series } from ".";
import { _Expr } from "../lazy/expr";

export interface SeriesStructFunctions {
Expand Down
8 changes: 4 additions & 4 deletions polars/shared_traits.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import { ColumnsOrExpr, StartBy } from "./utils";
import { Expr, _Expr } from "./lazy/expr";
import type { ColumnsOrExpr, StartBy } from "./utils";
import { type Expr, _Expr } from "./lazy/expr";

import {
import type {
InterpolationMethod,
RollingOptions,
RollingQuantileOptions,
RollingSkewOptions,
ClosedWindow,
} from "./types";
import { DataType } from "./datatypes";
import type { DataType } from "./datatypes";

/**
* Arithmetic operations
Expand Down
Loading