How to use union method in wpt

Best JavaScript code snippet using wpt

db.py

Source:db.py Github

copy

Full Screen

1# -*- coding: utf-8 -*-2#3from django.utils.translation import ugettext as _4from functools import reduce5from django.db.models import F, CharField, Value, IntegerField, Q, Count6from django.db.models.functions import Concat7from common.utils import get_object_or_none8from orgs.utils import current_org9from ..models import AuthBook, SystemUser, Asset, AdminUser10from .base import BaseBackend11class DBBackend(BaseBackend):12 union_id_length = 213 def __init__(self, queryset=None):14 if queryset is None:15 queryset = self.all()16 self.queryset = queryset17 def _clone(self):18 return self.__class__(self.queryset)19 def all(self):20 return AuthBook.objects.none()21 def count(self):22 return self.queryset.count()23 def get_queryset(self):24 return self.queryset25 def delete(self, union_id):26 cleaned_union_id = union_id.split('_')27 # 如果union_id通不过本检查,代表可能不是本backend, 应该返回空28 if not self._check_union_id(union_id, cleaned_union_id):29 return30 return self._perform_delete_by_union_id(cleaned_union_id)31 def _perform_delete_by_union_id(self, union_id_cleaned):32 pass33 def filter(self, assets=None, node=None, prefer=None, prefer_id=None,34 union_id=None, id__in=None, **kwargs):35 clone = self._clone()36 clone._filter_union_id(union_id)37 clone._filter_prefer(prefer, prefer_id)38 clone._filter_node(node)39 clone._filter_assets(assets)40 clone._filter_other(kwargs)41 clone._filter_id_in(id__in)42 return clone43 def _filter_union_id(self, union_id):44 if not union_id:45 return46 cleaned_union_id = union_id.split('_')47 # 如果union_id通不过本检查,代表可能不是本backend, 应该返回空48 if not self._check_union_id(union_id, cleaned_union_id):49 self.queryset = self.queryset.none()50 return51 return self._perform_filter_union_id(union_id, cleaned_union_id)52 def _check_union_id(self, union_id, cleaned_union_id):53 return union_id and len(cleaned_union_id) == self.union_id_length54 def _perform_filter_union_id(self, union_id, union_id_cleaned):55 self.queryset = self.queryset.filter(union_id=union_id)56 def _filter_assets(self, assets):57 assets_id = self.make_assets_as_id(assets)58 if assets_id:59 self.queryset = self.queryset.filter(asset_id__in=assets_id)60 def _filter_node(self, node):61 pass62 def _filter_id_in(self, ids):63 if ids and isinstance(ids, list):64 self.queryset = self.queryset.filter(union_id__in=ids)65 @staticmethod66 def clean_kwargs(kwargs):67 return {k: v for k, v in kwargs.items() if v}68 def _filter_other(self, kwargs):69 kwargs = self.clean_kwargs(kwargs)70 if kwargs:71 self.queryset = self.queryset.filter(**kwargs)72 def _filter_prefer(self, prefer, prefer_id):73 pass74 def search(self, item):75 qs = []76 for i in ['hostname', 'ip', 'username']:77 kwargs = {i + '__startswith': item}78 qs.append(Q(**kwargs))79 q = reduce(lambda x, y: x | y, qs)80 clone = self._clone()81 clone.queryset = clone.queryset.filter(q).distinct()82 return clone83class SystemUserBackend(DBBackend):84 model = SystemUser.assets.through85 backend = 'system_user'86 prefer = backend87 base_score = 088 union_id_length = 289 def _filter_prefer(self, prefer, prefer_id):90 if prefer and prefer != self.prefer:91 self.queryset = self.queryset.none()92 if prefer_id:93 self.queryset = self.queryset.filter(systemuser__id=prefer_id)94 def _perform_filter_union_id(self, union_id, union_id_cleaned):95 system_user_id, asset_id = union_id_cleaned96 self.queryset = self.queryset.filter(97 asset_id=asset_id, systemuser__id=system_user_id,98 )99 def _perform_delete_by_union_id(self, union_id_cleaned):100 system_user_id, asset_id = union_id_cleaned101 system_user = get_object_or_none(SystemUser, pk=system_user_id)102 asset = get_object_or_none(Asset, pk=asset_id)103 if all((system_user, asset)):104 system_user.assets.remove(asset)105 def _filter_node(self, node):106 if node:107 self.queryset = self.queryset.filter(asset__nodes__id=node.id)108 def get_annotate(self):109 kwargs = dict(110 hostname=F("asset__hostname"),111 ip=F("asset__ip"),112 username=F("systemuser__username"),113 password=F("systemuser__password"),114 private_key=F("systemuser__private_key"),115 public_key=F("systemuser__public_key"),116 score=F("systemuser__priority") + self.base_score,117 version=Value(0, IntegerField()),118 date_created=F("systemuser__date_created"),119 date_updated=F("systemuser__date_updated"),120 asset_username=Concat(F("asset__id"), Value("_"),121 F("systemuser__username"),122 output_field=CharField()),123 union_id=Concat(F("systemuser_id"), Value("_"), F("asset_id"),124 output_field=CharField()),125 org_id=F("asset__org_id"),126 backend=Value(self.backend, CharField())127 )128 return kwargs129 def get_filter(self):130 return dict(131 systemuser__username_same_with_user=False,132 )133 def all(self):134 kwargs = self.get_annotate()135 filters = self.get_filter()136 qs = self.model.objects.all().annotate(**kwargs)137 if current_org.org_id() is not None:138 filters['org_id'] = current_org.org_id()139 qs = qs.filter(**filters)140 qs = self.qs_to_values(qs)141 return qs142class DynamicSystemUserBackend(SystemUserBackend):143 backend = 'system_user_dynamic'144 prefer = 'system_user'145 union_id_length = 3146 def get_annotate(self):147 kwargs = super().get_annotate()148 kwargs.update(dict(149 username=F("systemuser__users__username"),150 asset_username=Concat(151 F("asset__id"), Value("_"),152 F("systemuser__users__username"),153 output_field=CharField()154 ),155 union_id=Concat(156 F("systemuser_id"), Value("_"), F("asset_id"),157 Value("_"), F("systemuser__users__id"),158 output_field=CharField()159 ),160 users_count=Count('systemuser__users'),161 ))162 return kwargs163 def _perform_filter_union_id(self, union_id, union_id_cleaned):164 system_user_id, asset_id, user_id = union_id_cleaned165 self.queryset = self.queryset.filter(166 asset_id=asset_id, systemuser_id=system_user_id,167 union_id=union_id,168 )169 def _perform_delete_by_union_id(self, union_id_cleaned):170 system_user_id, asset_id, user_id = union_id_cleaned171 system_user = get_object_or_none(SystemUser, pk=system_user_id)172 if not system_user:173 return174 system_user.users.remove(user_id)175 if system_user.users.count() == 0:176 system_user.assets.remove(asset_id)177 def get_filter(self):178 return dict(179 users_count__gt=0,180 systemuser__username_same_with_user=True181 )182class AdminUserBackend(DBBackend):183 model = Asset184 backend = 'admin_user'185 prefer = backend186 base_score = 200187 def _filter_prefer(self, prefer, prefer_id):188 if prefer and prefer != self.backend:189 self.queryset = self.queryset.none()190 if prefer_id:191 self.queryset = self.queryset.filter(admin_user__id=prefer_id)192 def _filter_node(self, node):193 if node:194 self.queryset = self.queryset.filter(nodes__id=node.id)195 def _perform_filter_union_id(self, union_id, union_id_cleaned):196 admin_user_id, asset_id = union_id_cleaned197 self.queryset = self.queryset.filter(198 id=asset_id, admin_user_id=admin_user_id,199 )200 def _perform_delete_by_union_id(self, union_id_cleaned):201 raise PermissionError(_("Could not remove asset admin user"))202 def all(self):203 qs = self.model.objects.all().annotate(204 asset_id=F("id"),205 username=F("admin_user__username"),206 password=F("admin_user__password"),207 private_key=F("admin_user__private_key"),208 public_key=F("admin_user__public_key"),209 score=Value(self.base_score, IntegerField()),210 version=Value(0, IntegerField()),211 date_updated=F("admin_user__date_updated"),212 asset_username=Concat(F("id"), Value("_"), F("admin_user__username"), output_field=CharField()),213 union_id=Concat(F("admin_user_id"), Value("_"), F("id"), output_field=CharField()),214 backend=Value(self.backend, CharField()),215 )216 qs = self.qs_to_values(qs)217 return qs218class AuthbookBackend(DBBackend):219 model = AuthBook220 backend = 'db'221 prefer = backend222 base_score = 400223 def _filter_node(self, node):224 if node:225 self.queryset = self.queryset.filter(asset__nodes__id=node.id)226 def _filter_prefer(self, prefer, prefer_id):227 if not prefer or not prefer_id:228 return229 if prefer.lower() == "admin_user":230 model = AdminUser231 elif prefer.lower() == "system_user":232 model = SystemUser233 else:234 self.queryset = self.queryset.none()235 return236 obj = get_object_or_none(model, pk=prefer_id)237 if obj is None:238 self.queryset = self.queryset.none()239 return240 username = obj.get_username()241 if isinstance(username, str):242 self.queryset = self.queryset.filter(username=username)243 # dynamic system user return more username244 else:245 self.queryset = self.queryset.filter(username__in=username)246 def _perform_filter_union_id(self, union_id, union_id_cleaned):247 authbook_id, asset_id = union_id_cleaned248 self.queryset = self.queryset.filter(249 id=authbook_id, asset_id=asset_id,250 )251 def _perform_delete_by_union_id(self, union_id_cleaned):252 authbook_id, asset_id = union_id_cleaned253 authbook = get_object_or_none(AuthBook, pk=authbook_id)254 if authbook.is_latest:255 raise PermissionError(_("Latest version could not be delete"))256 AuthBook.objects.filter(id=authbook_id).delete()257 def all(self):258 qs = self.model.objects.all().annotate(259 hostname=F("asset__hostname"),260 ip=F("asset__ip"),261 score=F('version') + self.base_score,262 asset_username=Concat(F("asset__id"), Value("_"), F("username"), output_field=CharField()),263 union_id=Concat(F("id"), Value("_"), F("asset_id"), output_field=CharField()),264 backend=Value(self.backend, CharField()),265 )266 qs = self.qs_to_values(qs)...

Full Screen

Full Screen

unionTypeCallSignatures.js

Source:unionTypeCallSignatures.js Github

copy

Full Screen

1//// [unionTypeCallSignatures.ts]2var numOrDate: number | Date;3var strOrBoolean: string | boolean;4var strOrNum: string | number;5// If each type in U has call signatures and the sets of call signatures are identical ignoring return types, 6// U has the same set of call signatures, but with return types that are unions of the return types of the respective call signatures from each type in U.7var unionOfDifferentReturnType: { (a: number): number; } | { (a: number): Date; };8numOrDate = unionOfDifferentReturnType(10);9strOrBoolean = unionOfDifferentReturnType("hello"); // error 10unionOfDifferentReturnType1(true); // error in type of parameter11var unionOfDifferentReturnType1: { (a: number): number; (a: string): string; } | { (a: number): Date; (a: string): boolean; };12numOrDate = unionOfDifferentReturnType1(10);13strOrBoolean = unionOfDifferentReturnType1("hello");14unionOfDifferentReturnType1(true); // error in type of parameter15unionOfDifferentReturnType1(); // error missing parameter16var unionOfDifferentParameterTypes: { (a: number): number; } | { (a: string): Date; };17unionOfDifferentParameterTypes(10);// error - no call signatures18unionOfDifferentParameterTypes("hello");// error - no call signatures19unionOfDifferentParameterTypes();// error - no call signatures20var unionOfDifferentNumberOfSignatures: { (a: number): number; } | { (a: number): Date; (a: string): boolean; };21unionOfDifferentNumberOfSignatures(); // error - no call signatures22unionOfDifferentNumberOfSignatures(10); // error - no call signatures23unionOfDifferentNumberOfSignatures("hello"); // error - no call signatures24var unionWithDifferentParameterCount: { (a: string): string; } | { (a: string, b: number): number; } ;25unionWithDifferentParameterCount();// no call signature26unionWithDifferentParameterCount("hello");// no call signature27unionWithDifferentParameterCount("hello", 10);// no call signature28var unionWithOptionalParameter1: { (a: string, b?: number): string; } | { (a: string, b?: number): number; };29strOrNum = unionWithOptionalParameter1('hello');30strOrNum = unionWithOptionalParameter1('hello', 10);31strOrNum = unionWithOptionalParameter1('hello', "hello"); // error in parameter type32strOrNum = unionWithOptionalParameter1(); // error33var unionWithOptionalParameter2: { (a: string, b?: number): string; } | { (a: string, b: number): number };34strOrNum = unionWithOptionalParameter2('hello'); // error no call signature35strOrNum = unionWithOptionalParameter2('hello', 10); // error no call signature36strOrNum = unionWithOptionalParameter2('hello', "hello"); // error no call signature37strOrNum = unionWithOptionalParameter2(); // error no call signature38var unionWithOptionalParameter3: { (a: string, b?: number): string; } | { (a: string): number; };39strOrNum = unionWithOptionalParameter3('hello');40strOrNum = unionWithOptionalParameter3('hello', 10); // error no call signature41strOrNum = unionWithOptionalParameter3('hello', "hello"); // error no call signature42strOrNum = unionWithOptionalParameter3(); // error no call signature43var unionWithRestParameter1: { (a: string, ...b: number[]): string; } | { (a: string, ...b: number[]): number };44strOrNum = unionWithRestParameter1('hello');45strOrNum = unionWithRestParameter1('hello', 10);46strOrNum = unionWithRestParameter1('hello', 10, 11);47strOrNum = unionWithRestParameter1('hello', "hello"); // error in parameter type48strOrNum = unionWithRestParameter1(); // error49var unionWithRestParameter2: { (a: string, ...b: number[]): string; } | { (a: string, b: number): number };50strOrNum = unionWithRestParameter2('hello'); // error no call signature51strOrNum = unionWithRestParameter2('hello', 10); // error no call signature52strOrNum = unionWithRestParameter2('hello', 10, 11); // error no call signature53strOrNum = unionWithRestParameter2('hello', "hello"); // error no call signature54strOrNum = unionWithRestParameter2(); // error no call signature55var unionWithRestParameter3: { (a: string, ...b: number[]): string; } | { (a: string): number };56strOrNum = unionWithRestParameter3('hello');57strOrNum = unionWithRestParameter3('hello', 10); // error no call signature58strOrNum = unionWithRestParameter3('hello', 10, 11); // error no call signature59strOrNum = unionWithRestParameter3('hello', "hello"); // error no call signature60strOrNum = unionWithRestParameter3(); // error no call signature61var unionWithRestParameter4: { (...a: string[]): string; } | { (a: string, b: string): number; };62strOrNum = unionWithRestParameter4("hello"); // error supplied parameters do not match any call signature63strOrNum = unionWithRestParameter4("hello", "world");646566//// [unionTypeCallSignatures.js]67var numOrDate;68var strOrBoolean;69var strOrNum;70// If each type in U has call signatures and the sets of call signatures are identical ignoring return types, 71// U has the same set of call signatures, but with return types that are unions of the return types of the respective call signatures from each type in U.72var unionOfDifferentReturnType;73numOrDate = unionOfDifferentReturnType(10);74strOrBoolean = unionOfDifferentReturnType("hello"); // error 75unionOfDifferentReturnType1(true); // error in type of parameter76var unionOfDifferentReturnType1;77numOrDate = unionOfDifferentReturnType1(10);78strOrBoolean = unionOfDifferentReturnType1("hello");79unionOfDifferentReturnType1(true); // error in type of parameter80unionOfDifferentReturnType1(); // error missing parameter81var unionOfDifferentParameterTypes;82unionOfDifferentParameterTypes(10); // error - no call signatures83unionOfDifferentParameterTypes("hello"); // error - no call signatures84unionOfDifferentParameterTypes(); // error - no call signatures85var unionOfDifferentNumberOfSignatures;86unionOfDifferentNumberOfSignatures(); // error - no call signatures87unionOfDifferentNumberOfSignatures(10); // error - no call signatures88unionOfDifferentNumberOfSignatures("hello"); // error - no call signatures89var unionWithDifferentParameterCount;90unionWithDifferentParameterCount(); // no call signature91unionWithDifferentParameterCount("hello"); // no call signature92unionWithDifferentParameterCount("hello", 10); // no call signature93var unionWithOptionalParameter1;94strOrNum = unionWithOptionalParameter1('hello');95strOrNum = unionWithOptionalParameter1('hello', 10);96strOrNum = unionWithOptionalParameter1('hello', "hello"); // error in parameter type97strOrNum = unionWithOptionalParameter1(); // error98var unionWithOptionalParameter2;99strOrNum = unionWithOptionalParameter2('hello'); // error no call signature100strOrNum = unionWithOptionalParameter2('hello', 10); // error no call signature101strOrNum = unionWithOptionalParameter2('hello', "hello"); // error no call signature102strOrNum = unionWithOptionalParameter2(); // error no call signature103var unionWithOptionalParameter3;104strOrNum = unionWithOptionalParameter3('hello');105strOrNum = unionWithOptionalParameter3('hello', 10); // error no call signature106strOrNum = unionWithOptionalParameter3('hello', "hello"); // error no call signature107strOrNum = unionWithOptionalParameter3(); // error no call signature108var unionWithRestParameter1;109strOrNum = unionWithRestParameter1('hello');110strOrNum = unionWithRestParameter1('hello', 10);111strOrNum = unionWithRestParameter1('hello', 10, 11);112strOrNum = unionWithRestParameter1('hello', "hello"); // error in parameter type113strOrNum = unionWithRestParameter1(); // error114var unionWithRestParameter2;115strOrNum = unionWithRestParameter2('hello'); // error no call signature116strOrNum = unionWithRestParameter2('hello', 10); // error no call signature117strOrNum = unionWithRestParameter2('hello', 10, 11); // error no call signature118strOrNum = unionWithRestParameter2('hello', "hello"); // error no call signature119strOrNum = unionWithRestParameter2(); // error no call signature120var unionWithRestParameter3;121strOrNum = unionWithRestParameter3('hello');122strOrNum = unionWithRestParameter3('hello', 10); // error no call signature123strOrNum = unionWithRestParameter3('hello', 10, 11); // error no call signature124strOrNum = unionWithRestParameter3('hello', "hello"); // error no call signature125strOrNum = unionWithRestParameter3(); // error no call signature126var unionWithRestParameter4;127strOrNum = unionWithRestParameter4("hello"); // error supplied parameters do not match any call signature ...

Full Screen

Full Screen

itsdangerous.pyi

Source:itsdangerous.pyi Github

copy

Full Screen

1from datetime import datetime2from typing import Any, Callable, IO, Mapping, MutableMapping, Optional, Tuple, Union, Text, Generator3_serializer = Any # must be an object that has "dumps" and "loads" attributes (e.g. the json module)4def want_bytes(s: Union[Text, bytes], encoding: Text = ..., errors: Text = ...) -> bytes: ...5class BadData(Exception):6 message: str7 def __init__(self, message: str) -> None: ...8class BadPayload(BadData):9 original_error: Optional[Exception]10 def __init__(self, message: str, original_error: Optional[Exception] = ...) -> None: ...11class BadSignature(BadData):12 payload: Optional[Any]13 def __init__(self, message: str, payload: Optional[Any] = ...) -> None: ...14class BadTimeSignature(BadSignature):15 date_signed: Optional[int]16 def __init__(self, message: str, payload: Optional[Any] = ..., date_signed: Optional[int] = ...) -> None: ...17class BadHeader(BadSignature):18 header: Any19 original_error: Any20 def __init__(self, message, payload: Optional[Any] = ..., header: Optional[Any] = ..., original_error: Optional[Any] = ...) -> None: ...21class SignatureExpired(BadTimeSignature): ...22def base64_encode(string: Union[Text, bytes]) -> bytes: ...23def base64_decode(string: Union[Text, bytes]) -> bytes: ...24class SigningAlgorithm(object):25 def get_signature(self, key: bytes, value: bytes) -> bytes: ...26 def verify_signature(self, key: bytes, value: bytes, sig: bytes) -> bool: ...27class NoneAlgorithm(SigningAlgorithm):28 def get_signature(self, key: bytes, value: bytes) -> bytes: ...29class HMACAlgorithm(SigningAlgorithm):30 default_digest_method: Callable[..., Any]31 digest_method: Callable[..., Any]32 def __init__(self, digest_method: Optional[Callable[..., Any]] = ...) -> None: ...33 def get_signature(self, key: bytes, value: bytes) -> bytes: ...34class Signer(object):35 default_digest_method: Callable[..., Any] = ...36 default_key_derivation: str = ...37 secret_key: bytes38 sep: bytes39 salt: Union[Text, bytes]40 key_derivation: str41 digest_method: Callable[..., Any]42 algorithm: SigningAlgorithm43 def __init__(self,44 secret_key: Union[Text, bytes],45 salt: Optional[Union[Text, bytes]] = ...,46 sep: Optional[Union[Text, bytes]] = ...,47 key_derivation: Optional[str] = ...,48 digest_method: Optional[Callable[..., Any]] = ...,49 algorithm: Optional[SigningAlgorithm] = ...) -> None: ...50 def derive_key(self) -> bytes: ...51 def get_signature(self, value: Union[Text, bytes]) -> bytes: ...52 def sign(self, value: Union[Text, bytes]) -> bytes: ...53 def verify_signature(self, value: bytes, sig: Union[Text, bytes]) -> bool: ...54 def unsign(self, signed_value: Union[Text, bytes]) -> bytes: ...55 def validate(self, signed_value: Union[Text, bytes]) -> bool: ...56class TimestampSigner(Signer):57 def get_timestamp(self) -> int: ...58 def timestamp_to_datetime(self, ts: float) -> datetime: ...59 def sign(self, value: Union[Text, bytes]) -> bytes: ...60 def unsign(self, value: Union[Text, bytes], max_age: Optional[int] = ...,61 return_timestamp: bool = ...) -> Any: ... # morally -> Union[bytes, Tuple[bytes, datetime]]62 def validate(self, signed_value: Union[Text, bytes], max_age: Optional[int] = ...) -> bool: ...63class Serializer(object):64 default_serializer: _serializer = ...65 default_signer: Callable[..., Signer] = ...66 secret_key: bytes67 salt: bytes68 serializer: _serializer69 is_text_serializer: bool70 signer: Callable[..., Signer]71 signer_kwargs: MutableMapping[str, Any]72 def __init__(self, secret_key: Union[Text, bytes], salt: Optional[Union[Text, bytes]] = ...,73 serializer: Optional[_serializer] = ..., signer: Optional[Callable[..., Signer]] = ...,74 signer_kwargs: Optional[MutableMapping[str, Any]] = ...) -> None: ...75 def load_payload(self, payload: bytes, serializer: Optional[_serializer] = ...) -> Any: ...76 def dump_payload(self, obj: Any) -> bytes: ...77 def make_signer(self, salt: Optional[Union[Text, bytes]] = ...) -> Signer: ...78 def iter_unsigners(self, salt: Optional[Union[Text, bytes]] = ...) -> Generator[Any, None, None]: ...79 def dumps(self, obj: Any, salt: Optional[Union[Text, bytes]] = ...) -> Any: ... # morally -> Union[str, bytes]80 def dump(self, obj: Any, f: IO[Any], salt: Optional[Union[Text, bytes]] = ...) -> None: ...81 def loads(self, s: Union[Text, bytes], salt: Optional[Union[Text, bytes]] = ...) -> Any: ...82 def load(self, f: IO[Any], salt: Optional[Union[Text, bytes]] = ...): ...83 def loads_unsafe(self, s: Union[Text, bytes], salt: Optional[Union[Text, bytes]] = ...) -> Tuple[bool, Optional[Any]]: ...84 def load_unsafe(self, f: IO[Any], salt: Optional[Union[Text, bytes]] = ...) -> Tuple[bool, Optional[Any]]: ...85class TimedSerializer(Serializer):86 def loads(self, s: Union[Text, bytes], salt: Optional[Union[Text, bytes]] = ..., max_age: Optional[int] = ...,87 return_timestamp: bool = ...) -> Any: ... # morally -> Union[Any, Tuple[Any, datetime]]88 def loads_unsafe(self, s: Union[Text, bytes], salt: Optional[Union[Text, bytes]] = ...,89 max_age: Optional[int] = ...) -> Tuple[bool, Any]: ...90class JSONWebSignatureSerializer(Serializer):91 jws_algorithms: MutableMapping[Text, SigningAlgorithm] = ...92 default_algorithm: Text = ...93 default_serializer: Any = ...94 algorithm_name: Text95 algorithm: SigningAlgorithm96 def __init__(self, secret_key: Union[Text, bytes], salt: Optional[Union[Text, bytes]] = ...,97 serializer: Optional[_serializer] = ..., signer: Optional[Callable[..., Signer]] = ...,98 signer_kwargs: Optional[MutableMapping[str, Any]] = ..., algorithm_name: Optional[Text] = ...) -> None: ...99 def load_payload(self, payload: Union[Text, bytes], serializer: Optional[_serializer] = ...,100 return_header: bool = ...) -> Any: ... # morally -> Union[Any, Tuple[Any, MutableMapping[str, Any]]]101 def dump_payload(self, header: Mapping[str, Any], obj: Any) -> bytes: ... # type: ignore102 def make_algorithm(self, algorithm_name: Text) -> SigningAlgorithm: ...103 def make_signer(self, salt: Optional[Union[Text, bytes]] = ..., algorithm: SigningAlgorithm = ...) -> Signer: ...104 def make_header(self, header_fields: Optional[Mapping[str, Any]]) -> MutableMapping[str, Any]: ...105 def dumps(self, obj: Any, salt: Optional[Union[Text, bytes]] = ...,106 header_fields: Optional[Mapping[str, Any]] = ...) -> bytes: ...107 def loads(self, s: Union[Text, bytes], salt: Optional[Union[Text, bytes]] = ...,108 return_header: bool = ...) -> Any: ... # morally -> Union[Any, Tuple[Any, MutableMapping[str, Any]]]109 def loads_unsafe(self, s: Union[Text, bytes], salt: Optional[Union[Text, bytes]] = ...,110 return_header: bool = ...) -> Tuple[bool, Any]: ...111class TimedJSONWebSignatureSerializer(JSONWebSignatureSerializer):112 DEFAULT_EXPIRES_IN: int = ...113 expires_in: int114 def __init__(self, secret_key: Union[Text, bytes], expires_in: Optional[int] = ..., salt: Optional[Union[Text, bytes]] = ...,115 serializer: Optional[_serializer] = ..., signer: Optional[Callable[..., Signer]] = ...,116 signer_kwargs: Optional[MutableMapping[str, Any]] = ..., algorithm_name: Optional[Text] = ...) -> None: ...117 def make_header(self, header_fields: Optional[Mapping[str, Any]]) -> MutableMapping[str, Any]: ...118 def loads(self, s: Union[Text, bytes], salt: Optional[Union[Text, bytes]] = ...,119 return_header: bool = ...) -> Any: ... # morally -> Union[Any, Tuple[Any, MutableMapping[str, Any]]]120 def get_issue_date(self, header: Mapping[str, Any]) -> Optional[datetime]: ...121 def now(self) -> int: ...122class _URLSafeSerializerMixin(object):123 default_serializer: _serializer = ...124 def load_payload(self, payload: bytes, serializer: Optional[_serializer] = ...) -> Any: ...125 def dump_payload(self, obj: Any) -> bytes: ...126class URLSafeSerializer(_URLSafeSerializerMixin, Serializer): ......

Full Screen

Full Screen

navtreeindex3.js

Source:navtreeindex3.js Github

copy

Full Screen

1var NAVTREEINDEX3 =2{3"unionCPACR__Type.html#a4de69636eb450fcc3f5f3e4a19a869f5":[6,1,3,2,15],4"unionCPACR__Type.html#a5a6f694264518a813bdbc202ff47664f":[6,1,3,2,14],5"unionCPACR__Type.html#a6206695a548b18ce0e2ea5276d1eef1d":[6,1,3,2,16],6"unionCPACR__Type.html#a6424b7a81a440217aab8e51e4b623adb":[6,1,3,2,10],7"unionCPACR__Type.html#a68d69635225dd479d3035cc51b4c40ce":[6,1,3,2,6],8"unionCPACR__Type.html#a792fabd71db2311eefbc9b896db37986":[6,1,3,2,0],9"unionCPACR__Type.html#a7aa1870fa74e00241618df136e04141f":[6,1,3,2,1],10"unionCPACR__Type.html#ac54b8897f9358f37e0046b010c334e87":[6,1,3,2,5],11"unionCPACR__Type.html#ac6f2f67dd0250b9dc9a8271a05655bbe":[6,1,3,2,17],12"unionCPACR__Type.html#acb2055cdbdf2a6c9b8279dc6f7cbc624":[6,1,3,2,3],13"unionCPACR__Type.html#ad5c0b15cd6a01a6f1db398e020809573":[6,1,3,2,11],14"unionCPACR__Type.html#ad898cab7c89a07b80068d141ced869e3":[6,1,3,2,12],15"unionCPACR__Type.html#ae2d9d724aff1f8f0060738f5d4527c33":[6,1,3,2,18],16"unionCPACR__Type.html#af245b8dabfea0bf7dc06f5d4de7bfa79":[6,1,3,2,9],17"unionCPSR__Type.html":[6,1,4,2],18"unionCPSR__Type.html#a0bdcd0ceaa1ecb8f55ea15075974eb5a":[6,1,4,2,12],19"unionCPSR__Type.html#a0d277e8b4d2147137407f526aa9e3214":[6,1,4,2,6],20"unionCPSR__Type.html#a20bbf5d5ba32cae380b7f181cf306f9e":[6,1,4,2,4],21"unionCPSR__Type.html#a26907b41c086a9f9e7b8c7051481c643":[6,1,4,2,11],22"unionCPSR__Type.html#a2bc38ab81bc2e2fd111526a58f94511f":[6,1,4,2,10],23"unionCPSR__Type.html#a2e735da6b6156874d12aaceb2017da06":[6,1,4,2,1],24"unionCPSR__Type.html#a5299532c92c92babc22517a433686b95":[6,1,4,2,7],25"unionCPSR__Type.html#a5d4e06d8dba8f512c54b16bfa7150d9d":[6,1,4,2,9],26"unionCPSR__Type.html#a790f1950658257a87ac58d132eca9849":[6,1,4,2,16],27"unionCPSR__Type.html#a8bdd87822e3c00b3742c94a42b0654b9":[6,1,4,2,8],28"unionCPSR__Type.html#a8dc2435a7c376c9b8dfdd9748c091458":[6,1,4,2,0],29"unionCPSR__Type.html#a96bd175ed9927279dba40e76259dcfa7":[6,1,4,2,3],30"unionCPSR__Type.html#aa967d0e42ed00bd886b2c6df6f49a7e2":[6,1,4,2,2],31"unionCPSR__Type.html#aba74c9da04be21f1266d3816af79f8c3":[6,1,4,2,14],32"unionCPSR__Type.html#ac5ec7329b5be4722abc3cef6ef2e9c1b":[6,1,4,2,13],33"unionCPSR__Type.html#acc18314a4088adfb93a9662c76073704":[6,1,4,2,5],34"unionCPSR__Type.html#afd5ed10bab25f324a6fbb3e124d16fc9":[6,1,4,2,15],35"unionDFSR__Type.html":[6,1,5,1],36"unionDFSR__Type.html#a0512860c27723cd35f0abdaa68be9935":[6,1,5,1,10],37"unionDFSR__Type.html#a38562a26cc210ea4c39c6b951c4a5b62":[6,1,5,1,0],38"unionDFSR__Type.html#a38982c7088a4069f8a4b347f5eb400e9":[6,1,5,1,1],39"unionDFSR__Type.html#a4cb3ba7b8c8075bfbff792b7e5b88103":[6,1,5,1,8],40"unionDFSR__Type.html#a54c2eb668436a0f15d781265ceaa8c58":[6,1,5,1,7],41"unionDFSR__Type.html#a583e3138696be655c46f297e083ece52":[6,1,5,1,5],42"unionDFSR__Type.html#a869658f432d5e213b8cd55e8e58d1f56":[6,1,5,1,4],43"unionDFSR__Type.html#ad827a36e38ce2dee796835122ae95dd2":[6,1,5,1,9],44"unionDFSR__Type.html#add7c7800b87cabdb4a9ecdf41e4469a7":[6,1,5,1,6],45"unionDFSR__Type.html#aede34079d030df1977646c155a90f445":[6,1,5,1,2],46"unionDFSR__Type.html#af29edf59ecfd29848b69e2bbfb7f3082":[6,1,5,1,3],47"unionIFSR__Type.html":[6,1,9,1],48"unionIFSR__Type.html#a40c5236caf0549cc1cc78945b0b0f131":[6,1,9,1,4],49"unionIFSR__Type.html#a4ece60d66e87e10e78aab83ac05e957c":[6,1,9,1,5],50"unionIFSR__Type.html#a543066fc60d5b63478cc85ba082524d4":[6,1,9,1,6],51"unionIFSR__Type.html#a8f4e4fe46a9cb9b6c8a6355f9b0938e3":[6,1,9,1,3],52"unionIFSR__Type.html#a9f9ae1ffa89d33e90159eec5c4b7cd6a":[6,1,9,1,1],53"unionIFSR__Type.html#adb493acf17881eaf09a2e8629ee2243e":[6,1,9,1,2],54"unionIFSR__Type.html#ae31262477d14b86f30c3bef90a3fc371":[6,1,9,1,7],55"unionIFSR__Type.html#aee6fed7525c5125e637acc8e957c8d0f":[6,1,9,1,0],56"unionISR__Type.html":[6,1,10,1],57"unionISR__Type.html#a4fca9c1057aa8a6006f1fb631a28ee30":[6,1,10,1,4],58"unionISR__Type.html#ad01f116d61c2ae79c2469a38a0b2f497":[6,1,10,1,1],59"unionISR__Type.html#ad4dfcb37f30162fd57c4402ae99ca49e":[6,1,10,1,0],60"unionISR__Type.html#ad83ba976f1764c7d3a7954c073c39c22":[6,1,10,1,3],61"unionISR__Type.html#ae691a856f7de0f301c60521a7a779dc2":[6,1,10,1,2],62"unionSCTLR__Type.html":[6,1,18,1],63"unionSCTLR__Type.html#a078edcb9c3fc8b46b8cf382ad249bb79":[6,1,18,1,0],64"unionSCTLR__Type.html#a0a4ed1a41f25a191cf4a500401c3c5db":[6,1,18,1,9],65"unionSCTLR__Type.html#a10212a8d038bb1e076cbd06a5ba0b055":[6,1,18,1,12],66"unionSCTLR__Type.html#a122a4dde5ab1a27855ddad88bb3f9f78":[6,1,18,1,4],67"unionSCTLR__Type.html#a1ca6569db52bca6250afbbd565d05449":[6,1,18,1,16],68"unionSCTLR__Type.html#a21ec59a37644281456a5f607450951d8":[6,1,18,1,3],69"unionSCTLR__Type.html#a25d4c4cf4df168a30cc4600a130580ab":[6,1,18,1,14],70"unionSCTLR__Type.html#a32873e90e6814c3a2fc1b1c79c0bc8c8":[6,1,18,1,17],71"unionSCTLR__Type.html#a37f6910db32361f44a268f93b9ff7b20":[6,1,18,1,22],72"unionSCTLR__Type.html#a4cb084e09742794f1d040c4e44ee4e0f":[6,1,18,1,20],73"unionSCTLR__Type.html#a551d0505856acaef4dd1ecca54cb540d":[6,1,18,1,21],74"unionSCTLR__Type.html#a60d589567422115a14d6d0fde342dfce":[6,1,18,1,11],75"unionSCTLR__Type.html#a6598f817304ccaef4509843ce041de1c":[6,1,18,1,13],76"unionSCTLR__Type.html#a805ee3324a333d7a77d9f0d8f0fac9a7":[6,1,18,1,2],77"unionSCTLR__Type.html#a8cbfde3ba235ebd48e82cb314c9b9cc4":[6,1,18,1,10],78"unionSCTLR__Type.html#a98b55213f3bf0a8bd4f1db90512238de":[6,1,18,1,5],79"unionSCTLR__Type.html#a9a3885d0e2ba2433d128f62ec2552a00":[6,1,18,1,18],80"unionSCTLR__Type.html#aba2a8aac3478cdc34428af7b9726d97f":[6,1,18,1,8],81"unionSCTLR__Type.html#abc3055203ce7f9d117ceb10f146722f3":[6,1,18,1,15],82"unionSCTLR__Type.html#ae5a729bf64a6de4cbfa42c1a7d254535":[6,1,18,1,1],83"unionSCTLR__Type.html#af29c170c65dd4d076b78c793dc17aa0a":[6,1,18,1,19],84"unionSCTLR__Type.html#af868e042d01b612649539c151f1aaea5":[6,1,18,1,6],85"unionSCTLR__Type.html#afe77b6c5d73e64d4ef3c5dc5ce2692dc":[6,1,18,1,7],86"using_ARM_pg.html":[2,1],87"using_CMSIS.html":[2,0],88"using_pg.html":[2] ...

Full Screen

Full Screen

get_union_boxes.py

Source:get_union_boxes.py Github

copy

Full Screen

1"""2credits to https://github.com/ruotianluo/pytorch-faster-rcnn/blob/master/lib/nets/network.py#L913"""4import torch5from torch.autograd import Variable6from torch.nn import functional as F7from lib.fpn.roi_align.functions.roi_align import RoIAlignFunction8from lib.draw_rectangles.draw_rectangles import draw_union_boxes9import numpy as np10from torch.nn.modules.module import Module11from torch import nn12from config import BATCHNORM_MOMENTUM13class UnionBoxesAndFeats(Module):14 def __init__(self, pooling_size=7, stride=16, dim=256, concat=False, use_feats=True):15 """16 :param pooling_size: Pool the union boxes to this dimension17 :param stride: pixel spacing in the entire image18 :param dim: Dimension of the feats19 :param concat: Whether to concat (yes) or add (False) the representations20 """21 super(UnionBoxesAndFeats, self).__init__()22 23 self.pooling_size = pooling_size24 self.stride = stride25 self.dim = dim26 self.use_feats = use_feats27 self.conv = nn.Sequential(28 nn.Conv2d(2, dim //2, kernel_size=7, stride=2, padding=3, bias=True),29 nn.ReLU(inplace=True),30 nn.BatchNorm2d(dim//2, momentum=BATCHNORM_MOMENTUM),31 nn.MaxPool2d(kernel_size=3, stride=2, padding=1),32 nn.Conv2d(dim // 2, dim, kernel_size=3, stride=1, padding=1, bias=True),33 nn.ReLU(inplace=True),34 nn.BatchNorm2d(dim, momentum=BATCHNORM_MOMENTUM),35 )36 self.concat = concat37 def forward(self, fmap, rois, union_inds):38 union_pools = union_boxes(fmap, rois, union_inds, pooling_size=self.pooling_size, stride=self.stride)39 if not self.use_feats:40 return union_pools.detach()41 pair_rois = torch.cat((rois[:, 1:][union_inds[:, 0]], rois[:, 1:][union_inds[:, 1]]),1).data.cpu().numpy()42 # rects_np = get_rect_features(pair_rois, self.pooling_size*2-1) - 0.543 x1_union = np.minimum(pair_rois[:, 0], pair_rois[:, 4])44 y1_union = np.minimum(pair_rois[:, 1], pair_rois[:, 5])45 x2_union = np.maximum(pair_rois[:, 2], pair_rois[:, 6])46 y2_union = np.maximum(pair_rois[:, 3], pair_rois[:, 7])47 w = x2_union - x1_union48 h = y2_union - y1_union49 w0 = np.where(w==0)[0]50 h0 = np.where(h==0)[0]51 if w0.shape[0]>0:52 print ('w==0 at ', w0)53 if h0.shape[0]>0:54 print ('h==0 at ', h0)55 pair_rois[np.where(w==0), 6] = x1_union[np.where(w==0)] + 1.56 pair_rois[np.where(h==0), 7] = y1_union[np.where(h==0)] + 1.57 rects_np = draw_union_boxes(pair_rois, self.pooling_size*4-1) - 0.558 rects = Variable(torch.FloatTensor(rects_np).cuda(fmap.get_device()), volatile=fmap.volatile)59 if self.concat:60 return torch.cat((union_pools, self.conv(rects)), 1)61 return union_pools + self.conv(rects)62# def get_rect_features(roi_pairs, pooling_size):63# rects_np = draw_union_boxes(roi_pairs, pooling_size)64# # add union + intersection65# stuff_to_cat = [66# rects_np.max(1),67# rects_np.min(1),68# np.minimum(1-rects_np[:,0], rects_np[:,1]),69# np.maximum(1-rects_np[:,0], rects_np[:,1]),70# np.minimum(rects_np[:,0], 1-rects_np[:,1]),71# np.maximum(rects_np[:,0], 1-rects_np[:,1]),72# np.minimum(1-rects_np[:,0], 1-rects_np[:,1]),73# np.maximum(1-rects_np[:,0], 1-rects_np[:,1]),74# ]75# rects_np = np.concatenate([rects_np] + [x[:,None] for x in stuff_to_cat], 1)76# return rects_np77def union_boxes(fmap, rois, union_inds, pooling_size=14, stride=16):78 """79 :param fmap: (batch_size, d, IM_SIZE/stride, IM_SIZE/stride)80 :param rois: (num_rois, 5) with [im_ind, x1, y1, x2, y2]81 :param union_inds: (num_urois, 2) with [roi_ind1, roi_ind2]82 :param pooling_size: we'll resize to this83 :param stride:84 :return:85 """86 assert union_inds.size(1) == 287 im_inds = rois[:,0][union_inds[:,0]]88 assert (im_inds.data == rois.data[:,0][union_inds[:,1]]).sum() == union_inds.size(0)89 union_rois = torch.cat((90 im_inds[:,None],91 torch.min(rois[:, 1:3][union_inds[:, 0]], rois[:, 1:3][union_inds[:, 1]]),92 torch.max(rois[:, 3:5][union_inds[:, 0]], rois[:, 3:5][union_inds[:, 1]]),93 ),1)94 # (num_rois, d, pooling_size, pooling_size)95 union_pools = RoIAlignFunction(pooling_size, pooling_size,96 spatial_scale=1/stride)(fmap, union_rois)97 return union_pools...

Full Screen

Full Screen

main.py

Source:main.py Github

copy

Full Screen

1from time import time2from random import randint3from chapter_11_UnionFind.union_find1 import UnionFind14from chapter_11_UnionFind.union_find2 import UnionFind25from chapter_11_UnionFind.union_find3 import UnionFind36from chapter_11_UnionFind.union_find4 import UnionFind47from chapter_11_UnionFind.union_find5 import UnionFind58from chapter_11_UnionFind.union_find6 import UnionFind69def test_uf(uf, m):10 size = uf.get_size()11 start_time = time()12 for _ in range(m):13 # python randint [a, b] random number with inclusive range 14 a = randint(0, size - 1)15 b = randint(0, size - 1)16 uf.union_elements(a, b)17 for _ in range(m):18 a = randint(0, size - 1)19 b = randint(0, size - 1)20 uf.is_connected(a, b)21 end_time = time()22 print('Time cost: {}'.format(end_time - start_time))23if __name__ == '__main__':24 size = 10000025 m = 10000026 # uf1 = UnionFind1(size)27 # uf2 = UnionFind2(size)28 uf3 = UnionFind3(size)29 uf4 = UnionFind4(size)30 uf5 = UnionFind5(size)31 uf6 = UnionFind6(size)32 # test_uf(uf1, m)33 # test_uf(uf2, m)34 test_uf(uf3, m)35 test_uf(uf4, m)36 test_uf(uf5, m)...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1const wptools = require('wptools');2const fs = require('fs');3const path = require('path');4const request = require('request');5const json2csv = require('json2csv').parse;6const fields = ['name', 'image', 'description', 'categories', 'coordinates', 'url'];7const opts = { fields };8var union = function (a, b) {9 var result = [];10 a.forEach(function (e) {11 if (b.indexOf(e) > -1 && result.indexOf(e) === -1) {12 result.push(e);13 }14 });15 return result;16};17var intersection = function (a, b) {18 var result = [];19 a.forEach(function (e) {20 if (b.indexOf(e) > -1 && result.indexOf(e) === -1) {21 result.push(e);22 }23 });24 return result;25};26var difference = function (a, b) {27 var result = [];28 a.forEach(function (e) {29 if (b.indexOf(e) === -1 && result.indexOf(e) === -1) {30 result.push(e);31 }32 });33 return result;34};35var symDifference = function (a, b) {36 var result = [];37 a.forEach(function (e) {38 if (b.indexOf(e) === -1 && result.indexOf(e) === -1) {39 result.push(e);40 }41 });42 b.forEach(function (e) {43 if (a.indexOf(e) === -1 && result.indexOf(e) === -1) {44 result.push(e);45 }46 });47 return result;48};49var union = function (a, b) {50 var result = [];51 a.forEach(function (e) {52 if (b.indexOf(e) > -1 && result.indexOf(e) === -1) {53 result.push(e);54 }55 });56 return result;57};58var intersection = function (a, b) {59 var result = [];60 a.forEach(function (e) {61 if (b.indexOf(e) > -1 && result.indexOf(e) === -1) {62 result.push(e);63 }64 });65 return result;66};

Full Screen

Using AI Code Generation

copy

Full Screen

1var wptools = require('wptools');2var fs = require('fs');3var jsdom = require('jsdom');4var jquery = require('jquery');5var request = require('request');6var async = require('async');7var _ = require('underscore');8var data = fs.readFileSync('list.csv', 'utf8');9var lines = data.split('\n');10var dataArray = [];11for (var i = 0; i < lines.length; i++) {12 var row = lines[i].split(',');13 dataArray.push(row);14}15var results = [];16function getWikiData(campus, callback) {17 wptools.page(campus).get(function(err, resp) {18 if (err) {19 console.log(err);20 } else {21 var data = resp.data;22 results.push(data);23 }24 callback();25 });26}27function getWikiData2(campus, callback) {28 wptools.page(campus).get(function(err, resp) {29 if (err) {30 console.log(err);31 } else {32 var data = resp.data;33 results.push(data);34 }35 callback();36 });37}38function getWikiData3(campus, callback) {

Full Screen

Using AI Code Generation

copy

Full Screen

1const wptools = require('wptools');2const fs = require('fs');3let page = wptools.page('Barack_Obama');4page.get().then(function(doc) {5 let json = doc.json();6 fs.writeFile('test.json', JSON.stringify(json, null, 2), function(err) {7 if (err) throw err;8 console.log('Saved!');9 });10});

Full Screen

Using AI Code Generation

copy

Full Screen

1var wptools = require('wptools');2wptools.get('Albert Einstein').then(function (page) {3 page.union('image').then(function (info) {4 console.log(info);5 });6});7var wptools = require('wptools');8wptools.get('Albert Einstein').then(function (page) {9 page.union('image', 'infobox').then(function (info) {10 console.log(info);11 });12});13var wptools = require('wptools');14wptools.get('Albert Einstein').then(function (page) {15 page.union('image', 'infobox', 'coordinates').then(function (info) {16 console.log(info);17 });18});19var wptools = require('wptools');20wptools.get('Albert Einstein').then(function (page) {21 page.union('image', 'infobox', 'coordinates', 'pageid').then(function (info) {22 console.log(info);23 });24});25var wptools = require('wptools');26wptools.get('Albert Einstein').then(function (page) {27 page.union('image', 'infobox', 'coordinates', 'pageid', 'extract').then(function (info) {28 console.log(info);29 });30});31var wptools = require('wptools');32wptools.get('Albert Einstein').then(function (page) {33 page.union('image', 'infobox', 'coordinates', 'pageid', 'extract', 'text').then(function (info) {34 console.log(info);35 });36});37var wptools = require('wptools');38wptools.get('Albert Einstein').then(function (page) {39 page.union('image', 'infobox', 'coordinates', 'pageid', 'extract', 'text', 'langlinks').then(function (info) {40 console.log(info);41 });42});

Full Screen

Using AI Code Generation

copy

Full Screen

1var wptools = require('wptools');2var fs = require('fs');3var union = 'List_of_union_members_of_the_17th_Lok_Sabha';4var unionMembers = [];5var page = wptools.page(union);6page.get(function(err, resp) {7 if (err) {8 console.log(err);9 } else {10 var members = resp.data.infobox.members;11 for (var i = 0; i < members.length; i++) {12 var member = members[i];13 var memberName = member.name;14 var memberParty = member.party;15 var memberState = member.state;16 var memberPage = wptools.page(memberName);17 memberPage.get(function(err, resp) {18 if (err) {19 console.log(err);20 } else {21 var image = resp.data.image;22 var member = {23 };24 unionMembers.push(member);25 if (unionMembers.length == members.length) {26 fs.writeFile('unionMembers.json', JSON.stringify(unionMembers, null, 4), function(err) {27 if (err) {28 console.log(err);29 } else {30 console.log('File successfully written!');31 }32 });33 }34 }35 });36 }37 }38});

Full Screen

Using AI Code Generation

copy

Full Screen

1var wpt = require('webpagetest');2 if (err) {3 console.log(err);4 } else {5 console.log('Test Status: ' + data.statusText);6 console.log('Test ID: ' + data.data.testId);7 console.log('Test URL: ' + data.data.summary);8 console.log('Test Results: ' + data.data.userUrl);9 }10});

Full Screen

Using AI Code Generation

copy

Full Screen

1var wpt = require('webpagetest');2var api = new wpt('A.9b7d0e9b2a7f1a0c2d7e1d3e3a3b0c01');3api.runTest(url, {runs: 3, firstViewOnly: true, video: true}, function(err, data) {4 if (err) return console.error(err);5 console.log('Test status: ' + data.statusText);6 console.log('Test ID: ' + data.data.testId);7 console.log('Test URL: ' + data.data.summary);8 console.log('Test video: ' + data.data.userUrl);9 console.log('Test video: ' + data.data.jsonUrl);10 console.log('Test video: ' + data.data.xmlUrl);11 console.log('Test video: ' + data.data.csvUrl);12 console.log('Test video: ' + data.data.harUrl);13 console.log('Test video: ' + data.data.pagespeedUrl);14 console.log('Test video: ' + data.data.checklistUrl);15 console.log('Test video: ' + data.data.reportUrl);16 console.log('Test video: ' + data.data.dataUrl);17 console.log('Test video: ' + data.data.runsUrl);18 console.log('Test video: ' + data.data.summaryCSV);19});20var wpt = require('webpagetest');21var api = new wpt('A.9b7d0e9b2a7f1a0c2d7e1d3e3a3b0c01');22api.runTest(url, {runs: 3, firstViewOnly: true, video: true}, function(err, data) {23 if (err) return console.error(err);24 console.log('Test status: ' + data.statusText);25 console.log('Test ID: ' + data.data.testId);26 console.log('Test URL: ' + data.data.summary);27 console.log('Test video: ' + data.data.userUrl);28 console.log('Test video: ' + data.data.jsonUrl);29 console.log('Test video: ' + data.data.xmlUrl);30 console.log('Test video: ' + data.data.csvUrl);

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run wpt automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful