Skip to content

Commit

Permalink
chore: formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
mikonse committed Sep 8, 2024
1 parent cd9129f commit 4c9ebc3
Show file tree
Hide file tree
Showing 58 changed files with 2,002 additions and 2,124 deletions.
7 changes: 5 additions & 2 deletions abrechnung/core/decorators.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from functools import wraps
from inspect import signature, Parameter
from inspect import Parameter, signature
from typing import Awaitable, Callable, TypeVar

from abrechnung.core.auth import check_group_permissions
Expand All @@ -11,7 +11,9 @@ def _add_arg_to_signature(original_func, new_func, name: str, annotation):
sig = signature(original_func)
if name in sig.parameters:
return
new_parameters = tuple(sig.parameters.values()) + (Parameter(name, kind=Parameter.KEYWORD_ONLY, annotation=annotation),)
new_parameters = tuple(sig.parameters.values()) + (
Parameter(name, kind=Parameter.KEYWORD_ONLY, annotation=annotation),
)
sig = sig.replace(parameters=new_parameters)
new_func.__signature__ = sig # type: ignore

Expand Down Expand Up @@ -78,6 +80,7 @@ async def wrapper(*args, **kwargs):
kwargs["group_id"] = group_id

return await func(*args, **kwargs)

_add_arg_to_signature(func, wrapper, "group_id", int)

return wrapper
23 changes: 11 additions & 12 deletions frontend/libs/api/src/lib/generated/Client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
import type { BaseHttpRequest } from './core/BaseHttpRequest';
import type { OpenAPIConfig } from './core/OpenAPI';
import { FetchHttpRequest } from './core/FetchHttpRequest';
import { AccountsService } from './services/AccountsService';
import { AuthService } from './services/AuthService';
import { CommonService } from './services/CommonService';
import { GroupsService } from './services/GroupsService';
import { TransactionsService } from './services/TransactionsService';
import type { BaseHttpRequest } from "./core/BaseHttpRequest";
import type { OpenAPIConfig } from "./core/OpenAPI";
import { FetchHttpRequest } from "./core/FetchHttpRequest";
import { AccountsService } from "./services/AccountsService";
import { AuthService } from "./services/AuthService";
import { CommonService } from "./services/CommonService";
import { GroupsService } from "./services/GroupsService";
import { TransactionsService } from "./services/TransactionsService";
type HttpRequestConstructor = new (config: OpenAPIConfig) => BaseHttpRequest;
export class Client {
public readonly accounts: AccountsService;
Expand All @@ -20,10 +20,10 @@ export class Client {
public readonly request: BaseHttpRequest;
constructor(config?: Partial<OpenAPIConfig>, HttpRequest: HttpRequestConstructor = FetchHttpRequest) {
this.request = new HttpRequest({
BASE: config?.BASE ?? '',
VERSION: config?.VERSION ?? '0.14.0',
BASE: config?.BASE ?? "",
VERSION: config?.VERSION ?? "0.14.0",
WITH_CREDENTIALS: config?.WITH_CREDENTIALS ?? false,
CREDENTIALS: config?.CREDENTIALS ?? 'include',
CREDENTIALS: config?.CREDENTIALS ?? "include",
TOKEN: config?.TOKEN,
USERNAME: config?.USERNAME,
PASSWORD: config?.PASSWORD,
Expand All @@ -37,4 +37,3 @@ export class Client {
this.transactions = new TransactionsService(this.request);
}
}

6 changes: 3 additions & 3 deletions frontend/libs/api/src/lib/generated/core/ApiError.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
import type { ApiRequestOptions } from './ApiRequestOptions';
import type { ApiResult } from './ApiResult';
import type { ApiRequestOptions } from "./ApiRequestOptions";
import type { ApiResult } from "./ApiResult";

export class ApiError extends Error {
public readonly url: string;
Expand All @@ -15,7 +15,7 @@ export class ApiError extends Error {
constructor(request: ApiRequestOptions, response: ApiResult, message: string) {
super(message);

this.name = 'ApiError';
this.name = "ApiError";
this.url = response.url;
this.status = response.status;
this.statusText = response.statusText;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
/* tslint:disable */
/* eslint-disable */
export type ApiRequestOptions = {
readonly method: 'GET' | 'PUT' | 'POST' | 'DELETE' | 'OPTIONS' | 'HEAD' | 'PATCH';
readonly method: "GET" | "PUT" | "POST" | "DELETE" | "OPTIONS" | "HEAD" | "PATCH";
readonly url: string;
readonly path?: Record<string, any>;
readonly cookies?: Record<string, any>;
Expand Down
7 changes: 3 additions & 4 deletions frontend/libs/api/src/lib/generated/core/BaseHttpRequest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,11 @@
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
import type { ApiRequestOptions } from './ApiRequestOptions';
import type { CancelablePromise } from './CancelablePromise';
import type { OpenAPIConfig } from './OpenAPI';
import type { ApiRequestOptions } from "./ApiRequestOptions";
import type { CancelablePromise } from "./CancelablePromise";
import type { OpenAPIConfig } from "./OpenAPI";

export abstract class BaseHttpRequest {

constructor(public readonly config: OpenAPIConfig) {}

public abstract request<T>(options: ApiRequestOptions): CancelablePromise<T>;
Expand Down
13 changes: 6 additions & 7 deletions frontend/libs/api/src/lib/generated/core/CancelablePromise.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,9 @@
/* tslint:disable */
/* eslint-disable */
export class CancelError extends Error {

constructor(message: string) {
super(message);
this.name = 'CancelError';
this.name = "CancelError";
}

public get isCancelled(): boolean {
Expand Down Expand Up @@ -69,15 +68,15 @@ export class CancelablePromise<T> implements Promise<T> {
this.#cancelHandlers.push(cancelHandler);
};

Object.defineProperty(onCancel, 'isResolved', {
Object.defineProperty(onCancel, "isResolved", {
get: (): boolean => this.#isResolved,
});

Object.defineProperty(onCancel, 'isRejected', {
Object.defineProperty(onCancel, "isRejected", {
get: (): boolean => this.#isRejected,
});

Object.defineProperty(onCancel, 'isCancelled', {
Object.defineProperty(onCancel, "isCancelled", {
get: (): boolean => this.#isCancelled,
});

Expand Down Expand Up @@ -117,12 +116,12 @@ export class CancelablePromise<T> implements Promise<T> {
cancelHandler();
}
} catch (error) {
console.warn('Cancellation threw an error', error);
console.warn("Cancellation threw an error", error);
return;
}
}
this.#cancelHandlers.length = 0;
if (this.#reject) this.#reject(new CancelError('Request aborted'));
if (this.#reject) this.#reject(new CancelError("Request aborted"));
}

public get isCancelled(): boolean {
Expand Down
11 changes: 5 additions & 6 deletions frontend/libs/api/src/lib/generated/core/FetchHttpRequest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,13 @@
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
import type { ApiRequestOptions } from './ApiRequestOptions';
import { BaseHttpRequest } from './BaseHttpRequest';
import type { CancelablePromise } from './CancelablePromise';
import type { OpenAPIConfig } from './OpenAPI';
import { request as __request } from './request';
import type { ApiRequestOptions } from "./ApiRequestOptions";
import { BaseHttpRequest } from "./BaseHttpRequest";
import type { CancelablePromise } from "./CancelablePromise";
import type { OpenAPIConfig } from "./OpenAPI";
import { request as __request } from "./request";

export class FetchHttpRequest extends BaseHttpRequest {

constructor(config: OpenAPIConfig) {
super(config);
}
Expand Down
10 changes: 5 additions & 5 deletions frontend/libs/api/src/lib/generated/core/OpenAPI.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
import type { ApiRequestOptions } from './ApiRequestOptions';
import type { ApiRequestOptions } from "./ApiRequestOptions";

type Resolver<T> = (options: ApiRequestOptions) => Promise<T>;
type Headers = Record<string, string>;
Expand All @@ -11,7 +11,7 @@ export type OpenAPIConfig = {
BASE: string;
VERSION: string;
WITH_CREDENTIALS: boolean;
CREDENTIALS: 'include' | 'omit' | 'same-origin';
CREDENTIALS: "include" | "omit" | "same-origin";
TOKEN?: string | Resolver<string> | undefined;
USERNAME?: string | Resolver<string> | undefined;
PASSWORD?: string | Resolver<string> | undefined;
Expand All @@ -20,10 +20,10 @@ export type OpenAPIConfig = {
};

export const OpenAPI: OpenAPIConfig = {
BASE: '',
VERSION: '0.14.0',
BASE: "",
VERSION: "0.14.0",
WITH_CREDENTIALS: false,
CREDENTIALS: 'include',
CREDENTIALS: "include",
TOKEN: undefined,
USERNAME: undefined,
PASSWORD: undefined,
Expand Down
Loading

0 comments on commit 4c9ebc3

Please sign in to comment.