text
stringlengths
14
100k
source
stringclasses
1 value
repo
stringclasses
810 values
language
stringclasses
13 values
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import numpy as np import torch from vllm.sampling_params import MAX_LOGPROB_TOKEN_IDS, SamplingParams from vllm.triton_utils import tl, triton from vllm.v1.outputs import LogprobsTensors from vllm...
fim
vllm-project/vllm
python
<|fim_suffix|>ded_idx_mapping, min_p, vocab_size, BLOCK_SIZE=BLOCK_SIZE, ) <|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import torch from vllm.triton_utils import tl, triton @triton.jit def _min_p_kernel( logi...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project from dataclasses import dataclass import torch from vllm.v1.outputs import LogprobsTensors @dataclass class SamplerOutput: sampled_token_ids: torch.Tensor logprobs_tensors: L<|fim_suffix|...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import numpy as np import torch from vllm.sampling_params import SamplingParams from vllm.triton_utils import tl, triton from vllm.utils.math_utils import cdiv from vllm.utils.torch_utils import asy...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project from collections.abc import Callable import numpy as np import torch from vllm.sampling_params import SamplingParams from vllm.triton_utils import tl, triton from vllm.v1.outputs import LogprobsTen...
fim
vllm-project/vllm
python
<|fim_suffix|>penalties in place. self.penalties_state.apply_penalties( logits, expanded_idx_mapping, idx_mapping_np, input_ids, expanded_local_pos, ) # Apply bad words masking in place. self.bad_words_state.apply_bad_words( ...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import numpy as np import torch from vllm.sampling_params import SamplingParams from vllm.v1.sample.ops.topk_t<|fim_suffix|>op_p) def any_greedy(self, idx_mapping_np: np.ndarray) -> bool: ...
fim
vllm-project/vllm
python
# SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project from vllm.config import VllmConfig from vllm.logger import init_logger logger = init_logger(__name__) def free_before_shutdown(vllm_config: VllmConfig) -> None: from vllm.model_executor.layers.rotary_embedd...
fim
vllm-project/vllm
python
<|fim_suffix|> ) return EagleSpeculator(vllm_config, device) else: raise NotImplementedError(f"{speculative_config.method} is not supported yet.") <|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import torch from vllm.confi...
fim
vllm-project/vllm
python
<|fim_suffix|>pache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project <|fim_prefix|># SPDX<|fim_middle|>-License-Identifier: A<|endoftext|>
fim
vllm-project/vllm
python
<|fim_suffix|>s, block_tables: BlockTables, attn_groups: list[list[AttentionGroup]], kv_cache_config: KVCacheConfig, progress_bar_desc: str = "Capturing CUDA graphs", ) -> None: def create_forward_fn( desc: BatchExecutionDescriptor, warmup: bool, ...
fim
vllm-project/vllm
python
<|fim_suffix|>_step, hidden_states, hidden_states.stride(0), hidden_size, max_model_len, num_speculative_steps, BLOCK_SIZE=1024, ADVANCE_DRAFT_POSITIONS=advance_draft_positions, ) <|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Co...
fim
vllm-project/vllm
python
<|fim_suffix|> else None ) attn_state = _prepare_dflash_inputs_to_capture( num_reqs, num_tokens, input_buffers, block_tables, attn_groups, kv_cache_config, max_model_len, ...
fim
vllm-project/vllm
python
<|fim_suffix|>idx = ctx_start + tl.where(is_ctx, j, 0) ctx_pos = tl.load(target_positions_ptr + ctx_pos_idx, mask=is_ctx, other=0) ctx_block_num = ctx_pos // block_size ctx_block_num = tl.minimum(ctx_block_num, block_table_stride - 1) ctx_block_id = tl.load( block_table_ptr + req_idx * block_tab...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import torch.nn as nn from vllm.config import ModelConfig, VllmConfig, replace from vllm.distributed.parallel_state import get_pp_group from vllm.model_executor.model_loader import get_model from vl...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project from typing import cast import torch.nn as nn from vllm.config import SpeculativeConfig from vllm.logger import init_logger from vllm.model_executor.models.interfaces import SupportsEagle3, support...
fim
vllm-project/vllm
python
<|fim_suffix|>( AutoRegressiveSpeculator, ) from vllm.v1.worker.gpu.spec_decode.eagle.utils import load_eagle_model class EagleSpeculator(AutoRegressiveSpeculator): def load_draft_model( self, target_model: nn.Module, target_attn_layer_names: set[str], ) -> nn.Module: retur...
fim
vllm-project/vllm
python
<|fim_suffix|>l eagle_model.lm_head eagle_model.lm_head = target_lm_head # MTP layers route logits through layer.shared_head.head, not # eagle_model.lm_head, so the per-layer copies need fixing up too. layers = getattr(draft_inner, "layers", None) if layers is not None: ...
fim
vllm-project/vllm
python
<|fim_suffix|>nse-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project <|fim_prefix|><|fim_middle|># SPDX-Lice<|endoftext|>
fim
vllm-project/vllm
python
# SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project """Gemma4 MTP (Multi-Token Prediction) speculator for speculative decoding. The Gemma4 assistant model runs all decoder layers per draft step (producing one token), and all its attention layers share KV cache wit...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyright<|fim_suffix|>ributors to the vLLM project <|fim_middle|>Text: Copyright cont<|endoftext|>
fim
vllm-project/vllm
python
<|fim_suffix|>2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import torch.nn as nn from vllm.v1.worker.gpu.spec_decode.autoregressive.speculator import ( AutoRegressiveSpeculator, ) from vllm.v1.worker.gpu.spec_decode.eagle.utils import load_eagle_model class MTPSpeculator(AutoRegressi...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import torch from vllm.config import SpeculativeConfig from vllm.triton_utils import tl, triton from vllm.v1.outputs import LogprobsTensors from vllm.v1.spec_decode.utils import unconditional_to_con...
fim
vllm-project/vllm
python
<|fim_suffix|>orch.float32, ) _resample_kernel[(num_reqs, resample_num_blocks)]( resampled_local_argmax, resampled_local_argmax.stride(0), resampled_local_max, resampled_local_max.stride(0), target_logits, target_logits.stride(0), target_rejected_logsumexp...
fim
vllm-project/vllm
python
<|fim_suffix|> skip_attn_for_dummy_run: bool = False, mm_inputs: tuple[list[torch.Tensor], torch.Tensor] | None = None, is_profile: bool = False, ) -> torch.Tensor: pass class DraftModelSpeculator(BaseSpeculator): def __init__(self, vllm_config: VllmConfig, device: torch.device): ...
fim
vllm-project/vllm
python
<|fim_suffix|> self.req_ids: list[str] = [] self.draft_tokens_np: np.ndarray | None = None self.num_draft_tokens: int = 0 def set_draft_tokens( self, input_batch: InputBatch, draft_tokens: torch.Tensor ) -> None: self.req_ids = input_batch.req_ids self.num_draft_token...
fim
vllm-project/vllm
python
<|fim_suffix|> assert len(self.free_indices) > 0, "No free indices" req_idx = self.free_indices.pop() self.req_id_to_index[req_id] = req_idx self.index_to_req_id[req_idx] = req_id self.max_seq_len[req_idx] = prompt_len + max_tokens self.prompt_len.np[req_idx] = prompt_len ...
fim
vllm-project/vllm
python
<|fim_suffix|>idx = cu_num_logits[req_idx] logits_end_idx = cu_num_logits[req_idx + 1] mapping.extend(range(logits_start_idx, logits_end_idx)) # Asynchronously copy the mapping to GPU. with torch.cuda.stream(self.copy_stream): logits_indices = torch.tensor( ...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project from collections.abc import Callable from typing import Any import numpy as np import torch from vllm import PoolingParams, SamplingParams from vllm.utils.math_utils import cdiv from vllm.v1.core....
fim
vllm-project/vllm
python
<|fim_suffix|>a( prompt_lens=self.num_prompt_tokens_cpu_tensor[: self.num_reqs].clone(), prompt_token_ids=self.sampling_metadata.prompt_token_ids, prompt_token_ids_cpu=prompt_token_ids_cpu, pooling_params=pooling_params, pooling_states=pooling_states, ...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import threading from collections.abc import Callable from dataclasses import dataclass from typing import Any import torch import vllm.envs as envs from vllm.compilation.cuda_graph import CUDAGra...
fim
vllm-project/vllm
python
# SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project """A GPU worker class.""" import gc import os from collections.abc import Callable from contextlib import AbstractContextManager, contextmanager, nullcontext from datetime import timedelta from types import NoneT...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project """ Define KV connector functionality mixin for model runners. """ from collections.abc import Generator from contextlib import AbstractContextManager, contextmanager, nullcontext from typing import...
fim
vllm-project/vllm
python
<|fim_suffix|> need # to include -1 entries to simulate batches with both LoRA and # no-LoRA tokens. This ensures prepare_tensors computes the correct # num_active_loras that matches the cudagraph capture key. if num_active_loras == 0: # No LoRA active - u...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import dataclasses import itertools from collections.abc import Callable from typing import Any import torch from vllm.config import CacheConfig from vllm.model_executor.layers.mamba.mamba_utils im...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project # Datastructures defining a TPU input batch from typing import cast import numpy as np import torch from vllm.lora.request import LoRARequest from vllm.sampling_params import SamplingType from vll...
fim
vllm-project/vllm
python
# SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project from dataclasses import dataclass from typing import TypeAlias import numpy as np import torch from vllm.config import ParallelConfig from vllm.v1.attention.backend import CommonAttentionMetadata @dataclass cl...
fim
vllm-project/vllm
python
<|fim_suffix|>f.cpu_signal_event.set() self.cpu_wait_event.wait() self.cpu_wait_event.clear() self._restore_context() def switch_to_comm(self): self.update_stream(self.comm_stream) def switch_to_compute(self): self.update_stream(self.compute_stream) def switch_to_c...
fim
vllm-project/vllm
python
<|fim_suffix|>s full-graph compilation" # When sequence parallelism is enabled, we always pad num_input_tokens # to be a multiple of tensor_parallel_size (tp) earlier. assert num_input_tokens % tp == 0 return True <|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright ...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project from collections.abc import Callable from typing import TYPE_CHECKING, Any, NamedTuple, TypeVar import torch import torch.nn as nn import vllm.ir from vllm.config import VllmConfig, set_current_vl...
fim
vllm-project/vllm
python
<|fim_suffix|>growth. After calling this function, any attempt to allocate a workspace larger than the current size will raise an AssertionError. This ensures that workspace size is fixed during execution and prevents unexpected memory allocations in the hot path. Example: # During initial...
fim
vllm-project/vllm
python
<|fim_suffix|>__(vllm_config, device) @contextmanager def _torch_cuda_wrapper(): # replace cuda APIs with xpu APIs, this should work by default torch.cuda.Stream = torch.xpu.Stream torch.cuda.default_stream = torch.xpu.current_stream torch.cuda.current_stream = torch.xpu.current_stream torch.cuda....
fim
vllm-project/vllm
python
<|fim_suffix|>shot self.init_snapshot = init_snapshot = MemorySnapshot(device=self.device) self.requested_memory = request_memory(init_snapshot, self.cache_config) logger.debug("worker init memory snapshot: %r", self.init_snapshot) logger.debug( "worker requested memory: %sGi...
fim
vllm-project/vllm
python
<|fim_suffix|> # In dev tree, this will return "0.-1", but that will work fine" assert isinstance(__version_tuple__[1], int) return f"{__version_tuple__[0]}.{__version_tuple__[1] - 1}" <|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project try:...
fim
vllm-project/vllm
python
<|fim_suffix|>, "get_scheduler_metadata", "is_fa_version_supported", ] <|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import importlib.machinery import os import sys import types # In symlink mode (VLLM_FLASH_ATTN_SRC_DIR), cute/ is a s...
fim
vllm-project/vllm
python
<|fim_suffix|>BLOCK_M), NNZ_S) column_count: (batch_size, nheads, cdiv(seqlen, BLOCK_M)) column_index: (batch_size, nheads, cdiv(seqlen, BLOCK_M), NNZ_V) dropout_p: float. Dropout probability. softmax_scale: float. The scaling of QK^T before applying softmax. Default to 1 / s...
fim
vllm-project/vllm
python
<|fim_prefix|><?php declare(strict_types=1); namespace Dotenv; use Dotenv\Exception\InvalidPathException; use Dotenv\Loader\Loader; use Dotenv\Loader\LoaderInterface; use Dotenv\Parser\Parser; use Dotenv\Parser\ParserInterface; use Dotenv\Repository\Adapter\ArrayAdapter; use Dotenv\Repository\Adapter\PutenvAdapter; ...
fim
vlucas/phpdotenv
php
<|fim_prefix|><?php declare(s<|fim_suffix|>ceptionInterface extends Throwable { // } <|fim_middle|>trict_types=1); namespace Dotenv\Exception; use Throwable; interface Ex<|endoftext|>
fim
vlucas/phpdotenv
php
<|fim_suffix|>nds InvalidArgumentException implements ExceptionInterface { // } <|fim_prefix|><?php declare(strict_types=1);<|fim_middle|> namespace Dotenv\Exception; use InvalidArgumentException; final class InvalidEncodingException exte<|endoftext|>
fim
vlucas/phpdotenv
php
<|fim_suffix|>tException; final class InvalidFileException extends InvalidArgumentException implements ExceptionInterface { // } <|fim_prefix|><?php declare(strict_types=1); namespa<|fim_middle|>ce Dotenv\Exception; use InvalidArgumen<|endoftext|>
fim
vlucas/phpdotenv
php
<|fim_suffix|>gumentException implements ExceptionInterface { // } <|fim_prefix|><?php declare(strict_types=1); namespace Dotenv\Exception; <|fim_middle|> use InvalidArgumentException; final class InvalidPathException extends InvalidAr<|endoftext|>
fim
vlucas/phpdotenv
php
<|fim_suffix|> // } <|fim_prefix|><?php declare(strict_ty<|fim_middle|>pes=1); namespace Dotenv\Exception; use RuntimeException; final class ValidationException extends RuntimeException implements ExceptionInterface { <|endoftext|>
fim
vlucas/phpdotenv
php
<|fim_suffix|>tory * @param \Dotenv\Parser\Entry[] $entries * * @return array<string, string|null> */ public function load(RepositoryInterface $repository, array $entries) { /** @var array<string, string|null> */ return \array_reduce($entries, static function ...
fim
vlucas/phpdotenv
php
<|fim_prefix|><?php declare(strict_types=1); namespace Dotenv\Loader; use Dotenv\Repository\RepositoryInterface; interface LoaderInterface { /** * Load the given entries into the repository. * * @param \Dotenv\Repository\RepositoryInterface $reposit<|fim_suffix|>es * * @return array<str...
fim
vlucas/phpdotenv
php
<|fim_prefix|><?php declare(strict_types=1); namespace Dotenv\Loader; use Dotenv\Parser\Value; use Dotenv\Repository\RepositoryInterface; use Dotenv\Util\Regex; use Dotenv\Util\Str; use PhpOption\Option; final class Resolver { /** * This class is a singleton. * * @codeCoverageIgnore * *...
fim
vlucas/phpdotenv
php
<|fim_suffix|>() { /** @var \PhpOption\Option<\Dotenv\Parser\Value> */ return Option::fromValue($this->value); } } <|fim_prefix|><?php declare(strict_types=1); namespace Dotenv\Parser; use PhpOption\Option; final class Entry { /** * The entry name. * * @var string */ ...
fim
vlucas/phpdotenv
php
<|fim_suffix|>rue, self::DOUBLE_QUOTED_STATE]); } else { /** @var \GrahamCampbell\ResultType\Result<array{string, bool, int}, string> */ return Success::create([$token, false, self::DOUBLE_QUOTED_STATE]); } case self::ESCAPE_SEQUENCE_ST...
fim
vlucas/phpdotenv
php
<|fim_suffix|>ring processing is not needed here, and nether is error * handling, for performance reasons. * * @param string $content * * @return \Generator<string> */ public static function lex(string $content) { static $regex; if ($regex === null) { $...
fim
vlucas/phpdotenv
php
<|fim_suffix|>ring $line) { return Str::pos($line, '="')->map(static function () use ($line) { return self::looksLikeMultilineStop($line, true) === false; })->getOrElse(false); } /** * Determine if the given line can be the start of a multiline variable. * * @para...
fim
vlucas/phpdotenv
php
<|fim_suffix|>*/ return \array_merge($entries, [$entry]); }); }); }, Success::create([])); } } <|fim_prefix|><?php declare(strict_types=1); namespace Dotenv\Parser; use Dotenv\Exception\InvalidFileException; use Dotenv\Util\Regex; use GrahamCampbell\ResultT...
fim
vlucas/phpdotenv
php
<|fim_suffix|>serInterface { /** * Parse content into an entry array. * * @param string $content * * @throws \Dotenv\Exception\InvalidFileException * * @return \Dotenv\Parser\Entry[] */ public function parse(string $content); } <|fim_prefix|><?php declare(strict_types=1)...
fim
vlucas/phpdotenv
php
<|fim_prefix|><?php declare(strict_types=1); namespace Dotenv\Parser; use Dotenv\Util\Str; final class Value { /** * The string representation of the parsed value. * * @var string */ private $chars; /** * The locations of the variables in the value. * * @var int[] ...
fim
vlucas/phpdotenv
php
<|fim_suffix|>v\Repository\Adapter\AdapterInterface> */ public static function create(); } <|fim_prefix|><?php declare(strict_types=1); namespace Dotenv\Repository\Adapter; interface AdapterInterface extends ReaderInterface, WriterInter<|fim_middle|>face { /** * Create a new instance of the adapter...
fim
vlucas/phpdotenv
php
<|fim_prefix|><?php declare(strict_types=1); namespace Dotenv\Repository<|fim_suffix|> /** @var \PhpOption\Option<AdapterInterface> */ return Some::create(new self()); } return None::create(); } /** * Determines if the adapter is supported. * * This happens if ...
fim
vlucas/phpdotenv
php
<|fim_suffix|> * Delete an environment variable, if possible. * * @param non-empty-string $name * * @return bool */ public function delete(string $name) { unset($this->variables[$name]); return true; } } <|fim_prefix|><?php declare(strict_types=1); namespace Dot...
fim
vlucas/phpdotenv
php
<|fim_prefix|><?php declare(strict_types=1); namespace Dotenv\Repository\Adapter; use PhpOption\Option; use PhpOption\Some; final class EnvConstAdapter implements AdapterInterface { /** * Create a new env const adapter instance. * * @return void */ private function __construct() { ...
fim
vlucas/phpdotenv
php
<?php declare(strict_types=1); namespace Dotenv\Repository\Adapter; final class GuardedWriter implements WriterInterface { /** * The inner writer to use. * * @var \Dotenv\Repository\Adapter\WriterInterface */ private $writer; /** * The variable name allow list. * * @va...
fim
vlucas/phpdotenv
php
<|fim_prefix|><?php declare(strict_types=1); namespace Dot<|fim_suffix|>} /** * Write to an environment variable, if possible. * * @param non-empty-string $name * @param string $value * * @return bool */ public function write(string $name, string $value) { ...
fim
vlucas/phpdotenv
php
<|fim_suffix|>eaders = $readers; } /** * Read an environment variable, if it exists. * * @param non-empty-string $name * * @return \PhpOption\Option<string> */ public function read(string $name) { foreach ($this->readers as $reader) { $result = $reader-...
fim
vlucas/phpdotenv
php
<|fim_suffix|>ame) { foreach ($this->writers as $writers) { if (!$writers->delete($name)) { return false; } } return true; } } <|fim_prefix|><?php declare(strict_types=1); namespace Dotenv\Repository\Adapter; final class MultiWriter implements ...
fim
vlucas/phpdotenv
php
<|fim_suffix|> it exists. * * @param non-empty-string $name * * @return \PhpOption\Option<string> */ public function read(string $name) { /** @var \PhpOption\Option<string> */ return Option::fromValue(\getenv($name), false)->filter(static function ($value) { ...
fim
vlucas/phpdotenv
php
<?php declare(strict_types=1); namespace Dotenv\Repository\Adapter; interface ReaderInterface { /** * Read an environment variable, if it exists. * * @param non-empty-string $name * * @return \PhpOption\Option<string> */ public function read(string $name); } <|endoftext|>
fim
vlucas/phpdotenv
php
<|fim_prefix|><?php declare(strict_types=1); namespace Dotenv\Repository\Adapter; final class ReplacingWriter implements WriterInterface { /** * The inner writer to <|fim_suffix|> } // succeed if nothing to do return true; } /** * Does the given environment variable exist. ...
fim
vlucas/phpdotenv
php
<|fim_prefix|><?php declare(strict_types=1); namespace Dotenv\Repository\Adapter; use PhpOption\Option; use PhpOption\Some; final class ServerConstAdapter implements AdapterInterface { /** * Create a new server const adapter instance. * * @return void */ private function __construct() ...
fim
vlucas/phpdotenv
php
<|fim_prefix|><?php declare(strict_type<|fim_suffix|>if possible. * * @param non-empty-string $name * * @return bool */ public function delete(string $name); } <|fim_middle|>s=1); namespace Dotenv\Repository\Adapter; interface WriterInterface { /** * Write to an environment vari...
fim
vlucas/phpdotenv
php
<|fim_prefix|><?php declare(strict_types=1); namespace Dotenv\Repository; use Dotenv\Repository\Adapter\ReaderInterface; use Dotenv\Repository\Adapter\WriterInterface; use InvalidArgumentException; fin<|fim_suffix|>null); } /** * Set an environment variable. * * @param string $name * @p...
fim
vlucas/phpdotenv
php
<|fim_suffix|>e($adapter)->flatMap(static function ($adapter) { return \is_string($adapter) ? $adapter::create() : Some::create($adapter); }); $readers = \array_merge($this->readers, \iterator_to_array($optional)); $writers = \array_merge($this->writers, \iterator_to_array($optional...
fim
vlucas/phpdotenv
php
<|fim_prefix|><?php de<|fim_suffix|> * * @param string $name * * @throws \InvalidArgumentException * * @return string|null */ public function get(string $name); /** * Set an environment variable. * * @param string $name * @param string $value * * @...
fim
vlucas/phpdotenv
php
<|fim_suffix|> } } return $files; } } <|fim_prefix|><?php declare(strict_types=1); namespace Dotenv\Store\File; /** * @internal */ final class Paths { /** * This class is a singleton. * * @codeCoverageIgnore * * @return void */ private function __construc...
fim
vlucas/phpdotenv
php
<|fim_suffix|>ws \Dotenv\Exception\InvalidEncodingException * * @return \PhpOption\Option<string> */ private static function readFromFile(string $path, ?string $encoding = null) { /** @var Option<string> */ $content = Option::fromValue(@\file_get_contents($path), false); ...
fim
vlucas/phpdotenv
php
<|fim_suffix|> * Read the content of the environment file(s). * * @throws \Dotenv\Exception\InvalidEncodingException|\Dotenv\Exception\InvalidPathException * * @return string */ public function read() { if ($this->filePaths === []) { throw new InvalidPathException('...
fim
vlucas/phpdotenv
php
<|fim_prefix|><?php declare(strict_types=1); namespace Dotenv\Store; use Dotenv\Store\File\Paths; final class StoreBuilder { /** * The of default name. */ private const DEFAULT_NAME = '.env'; /** * The paths to search within. * * @var string[] */ private $paths; /...
fim
vlucas/phpdotenv
php
<|fim_suffix|>e(s). * * @throws \Dotenv\Exception\InvalidEncodingException|\Dotenv\Exception\InvalidPathException * * @return string */ public function read(); } <|fim_prefix|><?php declare(strict_types=1); namespace Dotenv\Store; interface StoreInterface { /** *<|fim_middle|> R...
fim
vlucas/phpdotenv
php
<|fim_prefix|><?php declare(strict_types=1); namespace Dotenv\Store; final class StringStore implements StoreInterface { /** * The file content. * * @var string */ pr<|fim_suffix|>s->content; } } <|fim_middle|>ivate $content; /** * Create a new string store instance. * ...
fim
vlucas/phpdotenv
php
<|fim_suffix|> /** @var string[] */ return (array) @\preg_split($pattern, $subject); }, $subject); } /** * Perform a preg operation, wrapping up the result. * * @template V * * @param callable(string): V $operation * @param string $subject * ...
fim
vlucas/phpdotenv
php
<?php declare(strict_types=1); namespace Dotenv\Util; use GrahamCampbell\ResultType\Error; use GrahamCampbell\ResultType\Success; use PhpOption\Option; /** * @internal */ final class Str { /** * This class is a singleton. * * @codeCoverageIgnore * * @return void */ private fu...
fim
vlucas/phpdotenv
php
<|fim_prefix|><?php declare(strict_types=1); namespace Dotenv; use Dotenv\Exception\ValidationException; use Dotenv\Repository\RepositoryInterface; use Dotenv\Util\Regex; use Dotenv\Util\Str; class Validator { /** * The environment repository instance. * * @var \Dotenv\Repository\RepositoryInterf...
fim
vlucas/phpdotenv
php
<|fim_prefix|><?php declare(strict_types=1); namespace Dotenv\Tests; use Dotenv\Dotenv; use Dotenv\Exception\InvalidEncodingException; use Dotenv\Exception\InvalidPathException; use Dotenv\Loader\Loader; use Dotenv\Parser\Parser; use Dotenv\Repository\RepositoryBuilder; use Dotenv\Store\StoreBuilder; use PHPUnit\Fra...
fim
vlucas/phpdotenv
php
<|fim_prefix|><?php declare(strict_types=1); namespace Dotenv\Tests\Loader; use Dotenv\Exception\InvalidFileException; use Dotenv\Loader\Loader; use Dotenv\Loader\LoaderInterface; use Dotenv\Parser\Parser; use Dotenv\Repository\Adapter\ArrayAdapter; use Dotenv\Repository\Adapter\EnvConstAdapter; use Dotenv\Repositor...
fim
vlucas/phpdotenv
php
<|fim_prefix|><?php declare(strict_types=1); namespace Dotenv\Tests\Parser; use Dotenv\Parser\Entry; use Dotenv\Parser\EntryParser; use Dotenv\Parser\Value; use GrahamCampbell\ResultType\Result; use PHPUnit\Framework\TestCase; final class EntryParserTest extends TestCase { public function testBasicParse() {...
fim
vlucas/phpdotenv
php
<|fim_prefix|><?php declare(strict_types=1); namespace Dotenv\Tests\Parser; use Dotenv<|fim_suffix|> { return [ ['', []], ['FOO', ['FOO']], ['FOO bar', ['FOO', ' ', 'bar']], ['FOO\\n()ab', ['FOO', '\\', 'n()ab']], ["FOO\n\n A", ['FOO', "\n\n", '...
fim
vlucas/phpdotenv
php
<|fim_prefix|><?php declare(strict_types=1); namespace Dotenv\Tests\Parser; use Dotenv\Parser\Lines; use Dotenv\Util\Regex; use PHPUnit\Framework\TestCase; final class LinesTest extends Test<|fim_suffix|>BuUyId8FzmXQ3TcBydJ474tmOU2F492ubk3LAiZ18\nmhiRGoshXAOSbS/P3+RZi4bDeNE/No4=\"", ]; self::assert...
fim
vlucas/phpdotenv
php
<|fim_prefix|><?php declare(strict_types=1); namespace Dotenv\Tests\Parser; use Dotenv\Exception\InvalidFileException; use Dotenv\Parser\Entry; use Dotenv\Parser\Parser; use Dotenv\Parser\ParserInterface; use Dotenv\Parser\Value; use PHPUnit\Framework\TestCase; final class ParserTest extends TestCase { public f...
fim
vlucas/phpdotenv
php
<|fim_suffix|>eateAdapter(); self::assertTrue($adapter->write('CONST_TEST', 'foo')); self::assertSame('foo', $adapter->read('CONST_TEST')->get()); } public function testEmptyWrite() { $adapter = self::createAdapter(); self::assertTrue($adapter->write('CONST_TEST', '')); ...
fim
vlucas/phpdotenv
php
<|fim_suffix|>) { $_ENV['CONST_TEST'] = [123]; $value = self::createAdapter()->read('CONST_TEST'); self::assertFalse($value->isDefined()); } public function testUndefinedRead() { unset($_ENV['CONST_TEST']); $value = self::createAdapter()->read('CONST_TEST'); ...
fim
vlucas/phpdotenv
php
<?php declare(strict_types=1); namespace Dotenv\Tests\Repository\Adapter; use Dotenv\Repository\Adapter\PutenvAdapter; use PHPUnit\Framework\TestCase; final class PutenvAdapterTest extends TestCase { public function testGoodRead() { \putenv('CONST_TEST=foo bar baz'); $value = self::createAda...
fim
vlucas/phpdotenv
php
<|fim_prefix|><?php declare(strict_types=1); namespace Dotenv\Tests\Repository\Adapter; use Dotenv\Repository\Adapter\ServerConstAdapter; use PHPUnit\Fr<|fim_suffix|> public function testGoodDelete() { self::assertTrue(self::createAdapter()->delete('CONST_TEST')); self::assertFalse(isset($_SER...
fim
vlucas/phpdotenv
php
<|fim_prefix|><?php declare(strict_types=1); namespace Dotenv\Tests\Repository; use Dotenv\Dotenv; use Dotenv\Repository\Adapter\ArrayAdapter; use Dotenv\Repository\RepositoryBuilder; use Dotenv\Repository\RepositoryInterface; use InvalidArgumentException; use PHPUnit\Framework\TestCase; use TypeError; final class ...
fim
vlucas/phpdotenv
php
<|fim_prefix|><?php declare(strict_types=1); namespace Dotenv\Tests\Store; use Dotenv\Exception\InvalidEncodingException; use Dotenv\Store\File\Paths; use Dotenv\Store\File\Reader; use Dotenv\Store\StoreBuilder; use PHPUnit\Framework\TestCase; final class StoreTest extends TestCase { /** * @var string ...
fim
vlucas/phpdotenv
php
<|fim_suffix|>rNonExist() { $dotenv = Dotenv::createImmutable(self::$folder, 'integers.env'); $dotenv->load(); $this->expectException(ValidationException::class); $this->expectExceptionMessage('One or more environment variables failed assertions: VAR_DOES_NOT_EXIST_234782462764'); ...
fim
vlucas/phpdotenv
php