id int64 0 190k | prompt stringlengths 21 13.4M | docstring stringlengths 1 12k ⌀ |
|---|---|---|
166,612 | from __future__ import annotations
import math
from collections.abc import Callable
from enum import IntEnum, auto
from typing import Any
import pathway.internals as pw
from pathway.internals.helpers import StableSet
class JoinResult(pw.Schema):
left: pw.Pointer[Node]
right: pw.Pointer[Node]
weight: float
c... | null |
166,613 | from __future__ import annotations
import math
from collections.abc import Callable
from enum import IntEnum, auto
from typing import Any
import pathway.internals as pw
from pathway.internals.helpers import StableSet
class Feature(pw.Schema):
weight: float
normalization_type: int
class Edge(pw.Schema):
node... | null |
166,614 | from __future__ import annotations
import numpy as np
import pathway as pw
from ._lsh import lsh
def compute_cosine_dist(datapoint: np.ndarray, querypoint: np.ndarray) -> float:
return (
1
- np.dot(datapoint, querypoint)
/ (np.linalg.norm(datapoint) * np.linalg.norm(querypoint))
).item(... | null |
166,615 | from __future__ import annotations
import numpy as np
import pathway as pw
from ._lsh import lsh
class DataPoint(pw.Schema):
data: np.ndarray
class Query(pw.Schema):
data: np.ndarray
k: int
def compute_euclidean_dist2(datapoint: np.ndarray, querypoint: np.ndarray) -> float:
return np.sum((datapoint - qu... | Classifies queries against labeled data using approximate k-NN. |
166,616 | from __future__ import annotations
import numpy as np
import pathway as pw
from ._lsh import lsh
class DataPoint(pw.Schema):
data: np.ndarray
class Label:
label: int
def np_divide(data: np.ndarray, other: float) -> np.ndarray:
return data / other
def lsh(data: pw.Table, bucketer, origin_id="origin_id", inc... | null |
166,617 | from __future__ import annotations
import fnmatch
import logging
from statistics import mode
from typing import Literal
import jmespath
import jmespath.functions
import numpy as np
import pathway.internals as pw
from pathway.internals.helpers import StableSet
from pathway.stdlib.utils.col import groupby_reduce_majority... | Build the LSH index over data. L the number of repetitions of the LSH scheme. Returns a LSH projector of type (queries: Table, k:Any) -> Table |
166,618 | from __future__ import annotations
import fnmatch
import logging
from statistics import mode
from typing import Literal
import jmespath
import jmespath.functions
import numpy as np
import pathway.internals as pw
from pathway.internals.helpers import StableSet
from pathway.stdlib.utils.col import groupby_reduce_majority... | globmatch path to patter, using fnmatch at every level. |
166,619 | from __future__ import annotations
import fnmatch
import logging
from statistics import mode
from typing import Literal
import jmespath
import jmespath.functions
import numpy as np
import pathway.internals as pw
from pathway.internals.helpers import StableSet
from pathway.stdlib.utils.col import groupby_reduce_majority... | Build the LSH index over data using the Euclidean distances. d is the dimension of the data, L the number of repetition of the LSH scheme, M and A are specific to LSH with Euclidean distance, M is the number of random projections done to create each bucket and A is the width of each bucket on each projection. |
166,620 | from __future__ import annotations
import fnmatch
import logging
from statistics import mode
from typing import Literal
import jmespath
import jmespath.functions
import numpy as np
import pathway.internals as pw
from pathway.internals.helpers import StableSet
from pathway.stdlib.utils.col import groupby_reduce_majority... | Classify the queries. Use the knn_model to extract the k closest datapoints. The queries are then labeled using a majority vote between the labels of the retrieved datapoints, using the labels provided in data_labels. |
166,621 | from __future__ import annotations
import fnmatch
import logging
from statistics import mode
from typing import Literal
import jmespath
import jmespath.functions
import numpy as np
import pathway.internals as pw
from pathway.internals.helpers import StableSet
from pathway.stdlib.utils.col import groupby_reduce_majority... | null |
166,622 | from __future__ import annotations
import fnmatch
import logging
from statistics import mode
from typing import Literal
import jmespath
import jmespath.functions
import numpy as np
import pathway.internals as pw
from pathway.internals.helpers import StableSet
from pathway.stdlib.utils.col import groupby_reduce_majority... | null |
166,623 | from collections.abc import Callable
from typing import Any
import pandas as pd
import panel as pn
from bokeh.models import ColumnDataSource, Plot
import pathway as pw
from pathway.internals import api, parse_graph
from pathway.internals.graph_runner import GraphRunner
from pathway.internals.monitoring import Monitorin... | Allows for plotting contents of the table visually in e.g. jupyter. If the table depends only on the bounded data sources, the plot will be generated right away. Otherwise (in streaming scenario), the plot will be auto-updating after running pw.run() Args: self (pw.Table): a table serving as a source of data plotting_f... |
166,624 | import os
import pandas as pd
import panel as pn
import pathway as pw
from pathway.internals import api, parse_graph
from pathway.internals.graph_runner import GraphRunner
from pathway.internals.monitoring import MonitoringLevel
from pathway.internals.runtime_type_check import check_arg_types
from pathway.internals.tab... | null |
166,625 | from collections.abc import Callable
import pathway as pw
from pathway.internals.table import T, TSchema
TSchema = TypeVar("TSchema", bound=Schema)
T = TypeVar("T", bound=api.Value)
The provided code snippet includes necessary dependencies for implementing the `deduplicate` function. Write a Python function `def dedu... | Deduplicates rows in `table` on `col` column using acceptor function. It keeps rows which where accepted by the acceptor function. Acceptor operates on two arguments - current value and the previous accepted value. Args: table (pw.Table[TSchema]): table to deduplicate col (pw.ColumnReference): column used for deduplica... |
166,626 | from __future__ import annotations
import pathway.internals as pw
from pathway.internals import expression as expr
from pathway.internals.arg_handlers import (
arg_handler,
join_kwargs_handler,
select_args_handler,
)
from pathway.internals.desugaring import (
DesugaringContext,
TableSubstitutionDesu... | Performs asof now join of self with other using join expressions. Each row of self is joined with rows from other at a given processing time. Rows from self are not stored. They are joined with rows of other at their processing time. If other is updated in the future, rows from self from the past won't be updated. Rows... |
166,627 | from __future__ import annotations
import pathway.internals as pw
from pathway.internals import expression as expr
from pathway.internals.arg_handlers import (
arg_handler,
join_kwargs_handler,
select_args_handler,
)
from pathway.internals.desugaring import (
DesugaringContext,
TableSubstitutionDesu... | Performs asof now join of self with other using join expressions. Each row of self is joined with rows from other at a given processing time. Rows from self are not stored. They are joined with rows of other at their processing time. If other is updated in the future, rows from self from the past won't be updated. Rows... |
166,628 | from __future__ import annotations
import pathway.internals as pw
from pathway.internals import expression as expr
from pathway.internals.arg_handlers import (
arg_handler,
join_kwargs_handler,
select_args_handler,
)
from pathway.internals.desugaring import (
DesugaringContext,
TableSubstitutionDesu... | Performs asof now join of self with other using join expressions. Each row of self is joined with rows from other at a given processing time. If there are no matching rows in other, missing values on the right side are replaced with `None`. Rows from self are not stored. They are joined with rows of other at their proc... |
166,629 | import datetime
from typing import Any, Union
import pandas as pd
from dateutil import tz
from pathway.internals import dtype as dt
from pathway.internals.type_interpreter import eval_type
TimeEventType = Union[int, float, datetime.datetime]
def get_default_origin(time_event_type: dt.DType) -> TimeEventType:
mappi... | null |
166,630 | import datetime
from typing import Any, Union
import pandas as pd
from dateutil import tz
from pathway.internals import dtype as dt
from pathway.internals.type_interpreter import eval_type
IntervalType = Union[int, float, datetime.timedelta]
def zero_length_interval(interval_type: type[IntervalType]) -> IntervalType:
... | null |
166,631 | from __future__ import annotations
from typing import Any
import pathway.internals as pw
from pathway.internals.arg_handlers import (
arg_handler,
join_kwargs_handler,
select_args_handler,
)
from pathway.internals.desugaring import (
DesugaringContext,
TableSubstitutionDesugaring,
desugar,
)
fro... | Performs a window join of self with other using a window and join expressions. If two records belong to the same window and meet the conditions specified in the `on` clause, they will be joined. Note that if a sliding window is used and there are pairs of matching records that appear in more than one window, they will ... |
166,632 | from __future__ import annotations
from typing import Any
import pathway.internals as pw
from pathway.internals.arg_handlers import (
arg_handler,
join_kwargs_handler,
select_args_handler,
)
from pathway.internals.desugaring import (
DesugaringContext,
TableSubstitutionDesugaring,
desugar,
)
fro... | Performs a window join of self with other using a window and join expressions. If two records belong to the same window and meet the conditions specified in the `on` clause, they will be joined. Note that if a sliding window is used and there are pairs of matching records that appear in more than one window, they will ... |
166,633 | from __future__ import annotations
from typing import Any
import pathway.internals as pw
from pathway.internals.arg_handlers import (
arg_handler,
join_kwargs_handler,
select_args_handler,
)
from pathway.internals.desugaring import (
DesugaringContext,
TableSubstitutionDesugaring,
desugar,
)
fro... | Performs a window left join of self with other using a window and join expressions. If two records belong to the same window and meet the conditions specified in the `on` clause, they will be joined. Note that if a sliding window is used and there are pairs of matching records that appear in more than one window, they ... |
166,634 | from __future__ import annotations
from typing import Any
import pathway.internals as pw
from pathway.internals.arg_handlers import (
arg_handler,
join_kwargs_handler,
select_args_handler,
)
from pathway.internals.desugaring import (
DesugaringContext,
TableSubstitutionDesugaring,
desugar,
)
fro... | Performs a window right join of self with other using a window and join expressions. If two records belong to the same window and meet the conditions specified in the `on` clause, they will be joined. Note that if a sliding window is used and there are pairs of matching records that appear in more than one window, they... |
166,635 | from __future__ import annotations
from typing import Any
import pathway.internals as pw
from pathway.internals.arg_handlers import (
arg_handler,
join_kwargs_handler,
select_args_handler,
)
from pathway.internals.desugaring import (
DesugaringContext,
TableSubstitutionDesugaring,
desugar,
)
fro... | Performs a window outer join of self with other using a window and join expressions. If two records belong to the same window and meet the conditions specified in the `on` clause, they will be joined. Note that if a sliding window is used and there are pairs of matching records that appear in more than one window, they... |
166,636 | from dataclasses import dataclass
import pathway.internals as pw
from .utils import IntervalType
class CommonBehavior(Behavior):
"""Defines temporal behavior of windows and temporal joins."""
delay: IntervalType | None
cutoff: IntervalType | None
keep_results: bool
IntervalType = Union[int, float, date... | Creates an instance of ``CommonBehavior``, which contains a basic configuration of a behavior of temporal operators (like ``windowby`` or ``asof_join``). Each temporal operator tracks its own time (defined as a maximum time that arrived to the operator) and this configuration tells it that some of its inputs or outputs... |
166,637 | from dataclasses import dataclass
import pathway.internals as pw
from .utils import IntervalType
class ExactlyOnceBehavior(Behavior):
shift: IntervalType | None
IntervalType = Union[int, float, datetime.timedelta]
The provided code snippet includes necessary dependencies for implementing the `exactly_once_behavio... | Creates an instance of class ExactlyOnceBehavior, indicating that each non empty window should produce exactly one output. Args: shift: optional, defines the moment in time (``window end + shift``) in which the window stops accepting the data and sends the results to the output. Setting it to ``None`` is interpreted as... |
166,638 | from __future__ import annotations
import dataclasses
import datetime
from abc import ABC, abstractmethod
from collections.abc import Callable, Sequence
from typing import Any
import pathway.internals as pw
from pathway.internals import dtype as dt
from pathway.internals.arg_handlers import (
arg_handler,
offse... | Allows grouping together elements within a window across ordered time-like data column by locally grouping adjacent elements either based on a maximum time difference or using a custom predicate. Note: Usually used as an argument of `.windowby()`. Exactly one of the arguments `predicate` or `max_gap` should be provided... |
166,639 | from __future__ import annotations
import dataclasses
import datetime
from abc import ABC, abstractmethod
from collections.abc import Callable, Sequence
from typing import Any
import pathway.internals as pw
from pathway.internals import dtype as dt
from pathway.internals.arg_handlers import (
arg_handler,
offse... | Allows grouping together elements within a window of a given length sliding across ordered time-like data column according to a specified interval (hop) starting from a given origin. Note: Usually used as an argument of `.windowby()`. Exactly one of the arguments `hop` or `ratio` should be provided. Args: hop: frequenc... |
166,640 | from __future__ import annotations
import dataclasses
import datetime
from abc import ABC, abstractmethod
from collections.abc import Callable, Sequence
from typing import Any
import pathway.internals as pw
from pathway.internals import dtype as dt
from pathway.internals.arg_handlers import (
arg_handler,
offse... | Allows grouping together elements within a window of a given length tumbling across ordered time-like data column starting from a given origin. Note: Usually used as an argument of `.windowby()`. Args: duration: length of the window origin: a point in time at which the first window begins Returns: Window: object to pas... |
166,641 | from __future__ import annotations
import dataclasses
import datetime
from abc import ABC, abstractmethod
from collections.abc import Callable, Sequence
from typing import Any
import pathway.internals as pw
from pathway.internals import dtype as dt
from pathway.internals.arg_handlers import (
arg_handler,
offse... | Allows grouping together elements within a window. Windows are created for each time t in at, by taking values with times within [t+lower_bound, t+upper_bound]. Note: If a tuple reducer will be used on grouped elements within a window, values in the tuple will be sorted according to their time column. Args: lower_bound... |
166,642 | from __future__ import annotations
import dataclasses
import datetime
from abc import ABC, abstractmethod
from collections.abc import Callable, Sequence
from typing import Any
import pathway.internals as pw
from pathway.internals import dtype as dt
from pathway.internals.arg_handlers import (
arg_handler,
offse... | Create a GroupedTable by windowing the table (based on `expr` and `window`), optionally with `instance` argument. Args: time_expr (pw.ColumnExpression[int | float | datetime]): Column expression used for windowing window: type window to use instance: optional column expression to act as a shard key Examples: >>> import... |
166,643 | from __future__ import annotations
import datetime
from abc import abstractmethod
from dataclasses import dataclass
from typing import Any, Generic, TypeVar, overload
import pathway.internals as pw
from pathway.internals.arg_handlers import (
arg_handler,
join_kwargs_handler,
select_args_handler,
)
from pat... | null |
166,644 | from __future__ import annotations
import datetime
from abc import abstractmethod
from dataclasses import dataclass
from typing import Any, Generic, TypeVar, overload
import pathway.internals as pw
from pathway.internals.arg_handlers import (
arg_handler,
join_kwargs_handler,
select_args_handler,
)
from pat... | null |
166,645 | from __future__ import annotations
import datetime
from abc import abstractmethod
from dataclasses import dataclass
from typing import Any, Generic, TypeVar, overload
import pathway.internals as pw
from pathway.internals.arg_handlers import (
arg_handler,
join_kwargs_handler,
select_args_handler,
)
from pat... | null |
166,646 | from __future__ import annotations
import datetime
from abc import abstractmethod
from dataclasses import dataclass
from typing import Any, Generic, TypeVar, overload
import pathway.internals as pw
from pathway.internals.arg_handlers import (
arg_handler,
join_kwargs_handler,
select_args_handler,
)
from pat... | Allows testing whether two times are within a certain distance. Note: Usually used as an argument of `.interval_join()`. Args: lower_bound: a lower bound on `other_time - self_time`. upper_bound: an upper bound on `other_time - self_time`. Returns: Window: object to pass as an argument to `.interval_join()` Examples: >... |
166,647 | from __future__ import annotations
import datetime
from abc import abstractmethod
from dataclasses import dataclass
from typing import Any, Generic, TypeVar, overload
import pathway.internals as pw
from pathway.internals.arg_handlers import (
arg_handler,
join_kwargs_handler,
select_args_handler,
)
from pat... | Performs an interval join of self with other using a time difference and join expressions. If `self_time + lower_bound <= other_time <= self_time + upper_bound` and conditions in `on` are satisfied, the rows are joined. Args: other: the right side of a join. self_time (pw.ColumnExpression[int | float | datetime]): time... |
166,648 | from __future__ import annotations
import datetime
from abc import abstractmethod
from dataclasses import dataclass
from typing import Any, Generic, TypeVar, overload
import pathway.internals as pw
from pathway.internals.arg_handlers import (
arg_handler,
join_kwargs_handler,
select_args_handler,
)
from pat... | Performs an interval join of self with other using a time difference and join expressions. If `self_time + lower_bound <= other_time <= self_time + upper_bound` and conditions in `on` are satisfied, the rows are joined. Args: other: the right side of a join. self_time: time expression in self. other_time: time expressi... |
166,649 | from __future__ import annotations
import datetime
from abc import abstractmethod
from dataclasses import dataclass
from typing import Any, Generic, TypeVar, overload
import pathway.internals as pw
from pathway.internals.arg_handlers import (
arg_handler,
join_kwargs_handler,
select_args_handler,
)
from pat... | Performs an interval left join of self with other using a time difference and join expressions. If `self_time + lower_bound <= other_time <= self_time + upper_bound` and conditions in `on` are satisfied, the rows are joined. Rows from the left side that haven't been matched with the right side are returned with missing... |
166,650 | from __future__ import annotations
import datetime
from abc import abstractmethod
from dataclasses import dataclass
from typing import Any, Generic, TypeVar, overload
import pathway.internals as pw
from pathway.internals.arg_handlers import (
arg_handler,
join_kwargs_handler,
select_args_handler,
)
from pat... | Performs an interval right join of self with other using a time difference and join expressions. If `self_time + lower_bound <= other_time <= self_time + upper_bound` and conditions in `on` are satisfied, the rows are joined. Rows from the right side that haven't been matched with the left side are returned with missin... |
166,651 | from __future__ import annotations
import datetime
from abc import abstractmethod
from dataclasses import dataclass
from typing import Any, Generic, TypeVar, overload
import pathway.internals as pw
from pathway.internals.arg_handlers import (
arg_handler,
join_kwargs_handler,
select_args_handler,
)
from pat... | Performs an interval outer join of self with other using a time difference and join expressions. If `self_time + lower_bound <= other_time <= self_time + upper_bound` and conditions in `on` are satisfied, the rows are joined. Rows that haven't been matched with the other side are returned with missing values on the oth... |
166,652 | from __future__ import annotations
import dataclasses
import enum
from typing import Any
import pathway.internals as pw
import pathway.internals.expression as expr
import pathway.stdlib.indexing
from pathway.internals.arg_handlers import (
arg_handler,
join_kwargs_handler,
select_args_handler,
)
from pathwa... | Inputs: - t: ordered table - key: tuple where the last element indicate the group - next/prev pointers - dir_next: boolean Outputs a table with the same number elements with: - peer: next if dir_next else prev - peer_key: t(peer).key - peer_same: id of next/prev element in the table with the same group - peer_diff: id ... |
166,653 | from __future__ import annotations
import dataclasses
import enum
from typing import Any
import pathway.internals as pw
import pathway.internals.expression as expr
import pathway.stdlib.indexing
from pathway.internals.arg_handlers import (
arg_handler,
join_kwargs_handler,
select_args_handler,
)
from pathwa... | Perform an ASOF join of two tables. Args: other: Table to join with self, both must contain a column `val` self_time, other_time: time-like column expression to do the join against on: a list of column expressions. Each must have == as the top level operation and be of the form LHS: ColumnReference == RHS: ColumnRefere... |
166,654 | from __future__ import annotations
import dataclasses
import enum
from typing import Any
import pathway.internals as pw
import pathway.internals.expression as expr
import pathway.stdlib.indexing
from pathway.internals.arg_handlers import (
arg_handler,
join_kwargs_handler,
select_args_handler,
)
from pathwa... | Perform a left ASOF join of two tables. Args: other: Table to join with self, both must contain a column `val` self_time, other_time: time-like column expression to do the join against on: a list of column expressions. Each must have == as the top level operation and be of the form LHS: ColumnReference == RHS: ColumnRe... |
166,655 | from __future__ import annotations
import dataclasses
import enum
from typing import Any
import pathway.internals as pw
import pathway.internals.expression as expr
import pathway.stdlib.indexing
from pathway.internals.arg_handlers import (
arg_handler,
join_kwargs_handler,
select_args_handler,
)
from pathwa... | Perform a right ASOF join of two tables. Args: other: Table to join with self, both must contain a column `val` self_time, other_time: time-like column expression to do the join against on: a list of column expressions. Each must have == as the top level operation and be of the form LHS: ColumnReference == RHS: ColumnR... |
166,656 | from __future__ import annotations
import dataclasses
import enum
from typing import Any
import pathway.internals as pw
import pathway.internals.expression as expr
import pathway.stdlib.indexing
from pathway.internals.arg_handlers import (
arg_handler,
join_kwargs_handler,
select_args_handler,
)
from pathwa... | Perform an outer ASOF join of two tables. Args: other: Table to join with self, both must contain a column `val` self_time, other_time: time-like column expression to do the join against on: a list of column expressions. Each must have == as the top level operation and be of the form LHS: ColumnReference == RHS: Column... |
166,657 | import pathway as pw
from pathway.internals.runtime_type_check import check_arg_types
from pathway.internals.trace import trace_user_frame
The provided code snippet includes necessary dependencies for implementing the `diff` function. Write a Python function `def diff( self: pw.Table, timestamp: pw.ColumnRefer... | Compute the difference between the values in the ``values`` columns and the previous values according to the order defined by the column ``timestamp``. Args: - timestamp (pw.ColumnReference[int | float | datetime | str | bytes]): The column reference to the ``timestamp`` column on which the order is computed. - *values... |
166,658 | from __future__ import annotations
from enum import Enum
from typing import TYPE_CHECKING
from pathway.internals.expression import ColumnReference
from pathway.internals.trace import trace_user_frame
def _compute_interpolate(table_with_prev_next: Table) -> Table:
import pathway.internals as pw
class computing_i... | Interpolates missing values in a column using the previous and next values based on a timestamps column. Args: timestamp (ColumnReference): Reference to the column containing timestamps. *values (ColumnReference): References to the columns containing values to be interpolated. mode (InterpolateMode, optional): The inte... |
166,659 | from __future__ import annotations
import math
import pathway.internals as pw
from pathway.internals.fingerprints import fingerprint
from pathway.internals.runtime_type_check import check_arg_types
from pathway.internals.trace import trace_user_frame
from pathway.internals.udfs import udf
from pathway.stdlib.graphs.com... | r""" This function, given a weighted graph, finds a clustering that is a local maximum with respect to the objective function as defined by Louvain community detection algorithm |
166,660 | from __future__ import annotations
import math
import pathway.internals as pw
from pathway.internals.fingerprints import fingerprint
from pathway.internals.runtime_type_check import check_arg_types
from pathway.internals.trace import trace_user_frame
from pathway.internals.udfs import udf
from pathway.stdlib.graphs.com... | null |
166,661 | from __future__ import annotations
import math
import pathway.internals as pw
from pathway.internals.fingerprints import fingerprint
from pathway.internals.runtime_type_check import check_arg_types
from pathway.internals.trace import trace_user_frame
from pathway.internals.udfs import udf
from pathway.stdlib.graphs.com... | null |
166,662 | from __future__ import annotations
import math
import pathway.internals as pw
from pathway.internals.fingerprints import fingerprint
from pathway.internals.runtime_type_check import check_arg_types
from pathway.internals.trace import trace_user_frame
from pathway.internals.udfs import udf
from pathway.stdlib.graphs.com... | r""" This function computes modularity of a given weighted graph G with respect to clustering C. This implementation is meant to be used for testing / development, as computing exact value requires us to know the exact sum of the edge weights, which creates long dependency chains, and may be slow. This implementation r... |
166,663 | from __future__ import annotations
import math
import pathway.internals as pw
from pathway.internals.runtime_type_check import check_arg_types
from pathway.internals.trace import trace_user_frame
from ..common import Edge
class Vertex(pw.Schema):
is_source: bool
class Dist(pw.Schema):
dist: float
class DistFrom... | null |
166,664 | from __future__ import annotations
import pathway.internals as pw
from pathway.internals.runtime_type_check import check_arg_types
from pathway.internals.trace import trace_user_frame
from ..common import Edge
class Result(pw.Schema):
rank: int
class Edge(pw.Schema):
r"""
Basic edge class, holds pointers t... | null |
166,665 | from __future__ import annotations
from dataclasses import dataclass
import pathway.internals as pw
from .common import Clustering, Edge, Vertex, Weight
class Graph:
r"""
Basic class representing undirected, unweighted (multi)graph.
"""
V: pw.Table[Vertex]
E: pw.Table[Edge]
def contracted_to_unw... | r""" This function contracts the clusters of the graph, under the assumption that it was given a full clustering, i.e., all vertices have exactly one cluster in clustering Returns: a graph in which: - each vertex is a cluster from the clustering, - each original edge now points to clusters containing the original endpo... |
166,666 | from __future__ import annotations
from dataclasses import dataclass
import pathway.internals as pw
from .common import Clustering, Edge, Vertex, Weight
class WeightedGraph(Graph):
r"""
Basic class representing undirected, unweighted (multi)graph.
"""
WE: pw.Table[Edge | Weight]
def from_vertices_an... | r""" This function contracts the clusters of the graph, under the assumption that it was given a full clustering, i.e., all vertices have exactly one cluster in clustering Returns: a graph in which: - each vertex is a cluster from the clustering, - each original edge now points to clusters containing the original endpo... |
166,667 | from __future__ import annotations
from dataclasses import dataclass
import pathway.internals as pw
from .common import Clustering, Edge, Vertex, Weight
class Vertex(pw.Schema):
pass
class Clustering(pw.Schema):
r"""
Class describing cluster membership relation:
vertex u (id-column) belongs to ... | r""" This function, given a set of vertices and a partial clustering, i.e., a clustering in which not every vertex has assigned a cluster, creates extended clustering in which those vertices are in singleton clusters. The id of the new singleton cluster is the same as id of vertex |
166,668 | from __future__ import annotations
import math
from collections.abc import Callable
from typing import Optional, TypedDict
import pathway.internals as pw
from pathway.internals.arg_tuple import wrap_arg_tuple
from pathway.internals.fingerprints import fingerprint
from pathway.internals.runtime_type_check import check_a... | null |
166,669 | from __future__ import annotations
import math
from collections.abc import Callable
from typing import Optional, TypedDict
import pathway.internals as pw
from pathway.internals.arg_tuple import wrap_arg_tuple
from pathway.internals.fingerprints import fingerprint
from pathway.internals.runtime_type_check import check_a... | null |
166,670 | from __future__ import annotations
import math
from collections.abc import Callable
from typing import Optional, TypedDict
import pathway.internals as pw
from pathway.internals.arg_tuple import wrap_arg_tuple
from pathway.internals.fingerprints import fingerprint
from pathway.internals.runtime_type_check import check_a... | null |
166,671 | from __future__ import annotations
import pandas as pd
import pathway.internals as pw
from pathway.debug import table_from_pandas
from pathway.internals import schema
from pathway.internals.api import Pointer, ref_scalar
from pathway.internals.helpers import FunctionSpec, function_spec
from pathway.stdlib.utils.col imp... | Decorator that turns python function operating on pandas.DataFrame into pathway transformer. Input universes are converted into input DataFrame indexes. The resulting index is treated as the output universe, so it must maintain uniqueness and be of integer type. Args: output_schema: Schema of a resulting table. output_... |
166,672 | import annotations
import warnings
from collections.abc import Callable, Sequence
from typing import overload
import pathway.internals as pw
from pathway.internals import dtype as dt
from pathway.internals.runtime_type_check import check_arg_types
from pathway.internals.trace import trace_user_frame
The provided code ... | Deprecated: use pw.Table.flatten instead. Flattens a column of a table. Input: - column: Column expression of column to be flattened - origin_id: name of output column where to store id's of input rows Output: - Table with columns: colname_to_flatten and origin_id (if not None) Example: >>> import pathway as pw >>> t1 ... |
166,673 | import annotations
import warnings
from collections.abc import Callable, Sequence
from typing import overload
import pathway.internals as pw
from pathway.internals import dtype as dt
from pathway.internals.runtime_type_check import check_arg_types
from pathway.internals.trace import trace_user_frame
The provided code ... | Unpacks columns from a json object Input: - column: Column expression of column containing some pw.Json with an object - schema: Schema for columns to extract Output: - Table with columns given by the schema Example: >>> import pathway as pw >>> t = pw.debug.table_from_rows( ... schema=pw.schema_from_types(data=pw.Json... |
166,674 | import annotations
import warnings
from collections.abc import Callable, Sequence
from typing import overload
import pathway.internals as pw
from pathway.internals import dtype as dt
from pathway.internals.runtime_type_check import check_arg_types
from pathway.internals.trace import trace_user_frame
def multiapply_all_... | Applies a function to all the data in selected columns at once, returning a single column. This transformer is meant to be run infrequently on a relativelly small tables. Input: - cols: list of columns to which function will be applied - fun: function taking lists of columns and returning a corresponding list of output... |
166,675 | from __future__ import annotations
import pathway.internals as pw
def argmin_rows(
table: pw.Table, *on: pw.ColumnReference, what: pw.ColumnReference
) -> pw.Table:
filter = (
table.groupby(*on)
.reduce(argmin_id=pw.reducers.argmin(what))
.with_id(pw.this.argmin_id)
)
return tab... | null |
166,676 | from __future__ import annotations
import datetime
def truncate_to_minutes(time: datetime.datetime) -> datetime.datetime:
return time - datetime.timedelta(seconds=time.second, microseconds=time.microsecond) | null |
166,677 | from __future__ import annotations
import datetime
from typing import TYPE_CHECKING, Any, Generic, Protocol, TypeAlias, TypeVar, Union
import numpy as np
import pandas as pd
from pathway.engine import *
from pathway.internals import dtype as dt, json
from pathway.internals.schema import Schema
CapturedStream = list[Dat... | null |
166,678 | from __future__ import annotations
import builtins
import logging
import sys
import warnings
from collections.abc import Callable
from dataclasses import dataclass
from threading import Event, Lock, Thread
from typing import Any, TypeVar
from pathway.internals import (
api,
datasink as datasinks,
datasource... | null |
166,679 | from __future__ import annotations
import builtins
import logging
import sys
import warnings
from collections.abc import Callable
from dataclasses import dataclass
from threading import Event, Lock, Thread
from typing import Any, TypeVar
from pathway.internals import (
api,
datasink as datasinks,
datasource... | null |
166,680 | from __future__ import annotations
import datetime
import warnings
from collections.abc import Iterable
from dataclasses import dataclass
from types import EllipsisType
from typing import TYPE_CHECKING, Any, TypeVar
from pathway.internals import dtype as dt, expression as expr
from pathway.internals.expression_printer ... | null |
166,681 | from __future__ import annotations
from functools import wraps
from warnings import warn
import pathway.internals.expression as expr
from pathway.internals.join_mode import JoinMode
from pathway.internals.trace import trace_user_frame
def trace_user_frame(func: Callable[P, T]) -> Callable[P, T]:
def _pathway_trace... | null |
166,682 | from __future__ import annotations
from functools import wraps
from warnings import warn
import pathway.internals.expression as expr
from pathway.internals.join_mode import JoinMode
from pathway.internals.trace import trace_user_frame
def groupby_handler(
self,
*args,
id=None,
sort_by=None,
_filter... | null |
166,683 | from __future__ import annotations
from functools import wraps
from warnings import warn
import pathway.internals.expression as expr
from pathway.internals.join_mode import JoinMode
from pathway.internals.trace import trace_user_frame
def windowby_handler(
self, time_expr, *args, window, behavior=None, instance=No... | null |
166,684 | from __future__ import annotations
from functools import wraps
from warnings import warn
import pathway.internals.expression as expr
from pathway.internals.join_mode import JoinMode
from pathway.internals.trace import trace_user_frame
def shard_deprecation(self, *args, shard=None, instance=None, **kwargs):
if shar... | null |
166,685 | from __future__ import annotations
from functools import wraps
from warnings import warn
import pathway.internals.expression as expr
from pathway.internals.join_mode import JoinMode
from pathway.internals.trace import trace_user_frame
def offset_deprecation(*args, offset=None, origin=None, **kwargs):
if offset is ... | null |
166,686 | from __future__ import annotations
from functools import wraps
from warnings import warn
import pathway.internals.expression as expr
from pathway.internals.join_mode import JoinMode
from pathway.internals.trace import trace_user_frame
class JoinMode(Enum):
"""Enum used for controlling type of a join when passed to... | null |
166,687 | from __future__ import annotations
from functools import wraps
from warnings import warn
import pathway.internals.expression as expr
from pathway.internals.join_mode import JoinMode
from pathway.internals.trace import trace_user_frame
def reduce_args_handler(self, *args, **kwargs):
for arg in args:
if expr... | null |
166,688 | from __future__ import annotations
from functools import wraps
from warnings import warn
import pathway.internals.expression as expr
from pathway.internals.join_mode import JoinMode
from pathway.internals.trace import trace_user_frame
def select_args_handler(self, *args, **kwargs):
for arg in args:
if not ... | null |
166,689 | from __future__ import annotations
import operator
from operator import *
from typing import Any
def _binary_arithmetic_wrap(op, symbol: str):
def wrapped(left: float, right: float) -> float:
return op(left, right)
wrapped.__name__ = op.__name__
wrapped._symbol = symbol # type: ignore[attr-defin... | null |
166,690 | from __future__ import annotations
import operator
from operator import *
from typing import Any
def _binary_cmp_wrap(op, symbol):
def wrapped(left: Any, right: Any) -> bool:
return op(left, right)
wrapped.__name__ = op.__name__
wrapped._symbol = symbol # type: ignore[attr-defined]
return w... | null |
166,691 | from __future__ import annotations
import operator
from operator import *
from typing import Any
def _binary_boolean_wrap(op, symbol):
def wrapped(left: bool, right: bool) -> bool:
return op(left, right)
wrapped.__name__ = op.__name__
wrapped._symbol = symbol # type: ignore[attr-defined]
re... | null |
166,692 | from __future__ import annotations
import operator
from operator import *
from typing import Any
import operator
from operator import *
def neg(expr: float) -> float: # type: ignore # we replace the other signature
return operator.neg(expr) | null |
166,693 | from __future__ import annotations
import operator
from operator import *
from typing import Any
def inv(expr: bool) -> bool: # type: ignore # we overwrite the behavior
return not expr | null |
166,694 | from __future__ import annotations
import operator
from operator import *
from typing import Any
import operator
from operator import *
def itemgetter(*items, target_type=Any): # type: ignore # we replace the other signature
def wrapped(x):
return operator.itemgetter(*items)(x)
wrapped.__annotatio... | null |
166,695 | from __future__ import annotations
from abc import ABC, abstractmethod
from collections.abc import Callable
from typing import TYPE_CHECKING, Any, TypeVar
from pathway.internals import expression as expr
class TableCollector(IdentityTransform):
table_list: list[Table]
def __init__(self):
self.table_list... | null |
166,696 | from __future__ import annotations
import logging
import sys
from contextlib import contextmanager
from functools import cached_property
from opentelemetry import trace
from opentelemetry.context import Context
from opentelemetry.exporter.otlp.proto.grpc._log_exporter import OTLPLogExporter
from opentelemetry.exporter.... | null |
166,697 | from __future__ import annotations
import itertools
from abc import ABC, abstractmethod
from collections.abc import Iterable
from typing import ClassVar
import pathway.internals.column as clmn
import pathway.internals.expression as expr
import pathway.internals.operator as op
from pathway.internals.column_path import C... | null |
166,698 | from __future__ import annotations
import asyncio
import contextlib
import threading
def new_event_loop():
event_loop = asyncio.new_event_loop()
def target(event_loop: asyncio.AbstractEventLoop):
try:
event_loop.run_forever()
finally:
event_loop.close()
thread = th... | null |
166,699 | from __future__ import annotations
import boto3
from pathway.internals import api, dtype as dt, schema
from pathway.internals.table import Table
from pathway.internals.trace import trace_user_frame
class Table(
Joinable,
OperatorInput,
Generic[TSchema],
):
"""Collection of named columns over identical ... | null |
166,700 | from __future__ import annotations
from typing import TYPE_CHECKING
from pathway.internals.parse_graph import G
G = ParseGraph()
The provided code snippet includes necessary dependencies for implementing the `promise_are_pairwise_disjoint` function. Write a Python function `def promise_are_pairwise_disjoint(self: Tab... | Asserts to Pathway that an universe of self is a subset of universe of each of the others. Semantics: Used in situations where Pathway cannot deduce universes are disjoint. Returns: None Note: The assertion works in place. >>> import pathway as pw >>> t1 = pw.debug.table_from_markdown(''' ... | age | owner | pet ... 1 ... |
166,701 | from __future__ import annotations
from typing import TYPE_CHECKING
from pathway.internals.parse_graph import G
G = ParseGraph()
The provided code snippet includes necessary dependencies for implementing the `promise_is_subset_of` function. Write a Python function `def promise_is_subset_of(self: TableLike, *others: T... | Asserts to Pathway that an universe of self is a subset of universe of each of the others. Semantics: Used in situations where Pathway cannot deduce one universe being a subset of another. Returns: None Note: The assertion works in place. Example: >>> import pathway as pw >>> t1 = pw.debug.table_from_markdown(''' ... |... |
166,702 | from __future__ import annotations
from typing import TYPE_CHECKING
from pathway.internals.parse_graph import G
G = ParseGraph()
The provided code snippet includes necessary dependencies for implementing the `promise_are_equal` function. Write a Python function `def promise_are_equal(self: TableLike, *others: TableLi... | r"""Asserts to Pathway that an universe of self is equal to each of the others universes. Semantics: Used in situations where Pathway cannot deduce one universe being equal to another universe. Returns: None Note: The assertion works in place. Example: >>> import pathway as pw >>> import pytest >>> t1 = pw.debug.table_... |
166,703 | import contextlib
import logging
from enum import Enum
from typing import Any
from rich import box
from rich.align import Align
from rich.console import Console, ConsoleOptions, Group, RenderResult
from rich.layout import Layout
from rich.live import Live
from rich.logging import RichHandler
from rich.panel import Pane... | null |
166,704 | import contextlib
import logging
from enum import Enum
from typing import Any
from rich import box
from rich.align import Align
from rich.console import Console, ConsoleOptions, Group, RenderResult
from rich.layout import Layout
from rich.live import Live
from rich.logging import RichHandler
from rich.panel import Pane... | null |
166,705 | from pathway.internals import parse_graph
from pathway.internals.graph_runner import GraphRunner
from pathway.internals.monitoring import MonitoringLevel
from pathway.internals.runtime_type_check import check_arg_types
from pathway.persistence import Config as PersistenceConfig
class GraphRunner:
"""Runs evaluatio... | Runs the computation graph. Args: debug: enable output out of table.debug() operators monitoring_level: the verbosity of stats monitoring mechanism. One of pathway.MonitoringLevel.NONE, pathway.MonitoringLevel.IN_OUT, pathway.MonitoringLevel.ALL. If unset, pathway will choose between NONE and IN_OUT based on output int... |
166,706 | from pathway.internals import parse_graph
from pathway.internals.graph_runner import GraphRunner
from pathway.internals.monitoring import MonitoringLevel
from pathway.internals.runtime_type_check import check_arg_types
from pathway.persistence import Config as PersistenceConfig
class GraphRunner:
"""Runs evaluatio... | Runs the computation graph with disabled tree-shaking optimization. Args: debug: enable output out of table.debug() operators monitoring_level: the verbosity of stats monitoring mechanism. One of pathway.MonitoringLevel.NONE, pathway.MonitoringLevel.IN_OUT, pathway.MonitoringLevel.ALL. If unset, pathway will choose bet... |
166,707 | import pickle
from abc import ABC, abstractmethod
from collections import Counter
from typing import ParamSpec, Protocol, TypeVar
from typing_extensions import Self
from pathway.internals import api, expression as expr
from pathway.internals.column import ColumnExpression
from pathway.internals.common import apply_with... | null |
166,708 | import pickle
from abc import ABC, abstractmethod
from collections import Counter
from typing import ParamSpec, Protocol, TypeVar
from typing_extensions import Self
from pathway.internals import api, expression as expr
from pathway.internals.column import ColumnExpression
from pathway.internals.common import apply_with... | null |
166,709 | import pickle
from abc import ABC, abstractmethod
from collections import Counter
from typing import ParamSpec, Protocol, TypeVar
from typing_extensions import Self
from pathway.internals import api, expression as expr
from pathway.internals.column import ColumnExpression
from pathway.internals.common import apply_with... | Decorator for defining custom reducers. Requires custom accumulator as an argument. Custom accumulator should implement ``from_row``, ``update`` and ``compute_result``. Optionally ``neutral`` and ``retract`` can be provided for more efficient processing on streams with changing data. >>> import pathway as pw >>> class ... |
166,710 | import functools
import beartype
The provided code snippet includes necessary dependencies for implementing the `check_arg_types` function. Write a Python function `def check_arg_types(f)` to solve the following problem:
Decorator allowing validating types in runtime.
Here is the function:
def check_arg_types(f):
... | Decorator allowing validating types in runtime. |
166,711 | from __future__ import annotations
import abc
import asyncio
import functools
import sys
from collections.abc import Awaitable, Callable
from dataclasses import dataclass
from typing import ParamSpec, TypeVar
import pathway.internals.expression as expr
from pathway.internals.runtime_type_check import check_arg_types
fr... | Returns the automatic executor of Pathway UDF. It deduces whether the execution should be synchronous or asynchronous from the function signature. If the function is a coroutine, then the execution is asynchronous. Otherwise, it is synchronous. Example: >>> import pathway as pw >>> import asyncio >>> import time >>> t ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.