sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
f578f810d464238327d0930587ac39ea1435380b4ea862de23f5015dbc663689 | Python | 561 | 19 | from .interpolator import Interpolator
from .one_hot_encode import oneHotEncode
from .clip_outliers import clipOutliers
from .generate_uniform_sphere_points import generateUniformSpherePoints
from .log_output import logOutput
from .line_segments_intersect_triangles import segmentsIntersectTriangles
from .io_utils impor... |
e77d6f79e9bec4a0dfb75d1351dbeee9f1a32ce7cdc74a22f239121f802acf6c | Python | 562 | 20 | import esm
import torch
import numpy as np
from fold_models.model import FoldModel
class ESMFold(FoldModel):
def __init__(self):
self.model = esm.pretrained.esmfold_v1()
self.model = self.model.eval().cuda()
def predict(self, seq):
with torch.no_grad():
output = self.model.infer(seq, num_recycles=3)
... |
87a076835271d70e1461a0fc5f9575c7c92f35fbb951b1e6418550a21be143c6 | Python | 563 | 19 | """For backwards compatibility."""
from typing import Any
from langchain_classic._api import create_importer
# Code has been removed from the community package as well.
# We'll proxy to community package, which will raise an appropriate exception,
# but we'll not include this in __all__, so it won't be listed as imp... |
3c7a42160aea0c6de76f84099b67d89fe1cd377e94946483f57dbc1af27ce4eb | Python | 564 | 18 | from sentence_transformers import SentenceTransformer
from src import constants
from src import utils
def run():
tools = utils.load_json(constants.TOOL_LIST)
print("Loading PubMedBERT model...")
model = SentenceTransformer('pritamdeka/PubMedBERT-mnli-snli-scinli-scitail-mednli-stsb')
descrip... |
cf9dec7dcc5c1bcc802243ee915467d60aaca27ba707cfe58d844e003adc28da | Python | 564 | 18 | import scipy
import scipy.signal
from scipy.signal import butter, lfilter, freqz
import numpy as np
class butter_filter():
def __init__(self, cutoff, fs, order=2, btype='bandstop'):
nyq = 0.5 * fs
normal_cutoff = cutoff / nyq
b, a = butter(order, normal_cutoff, btype=btype, analog=False)
... |
1c63f729fe7317d0723898670fa9dea8825a1a227b13e5555f5b00b2f40b3309 | Python | 565 | 16 | from pycromanager import multi_d_acquisition_events, Acquisition, start_headless, stop_headless
mm_app_path = r"C:\Users\henry\Micro-Manager-nightly"
config = mm_app_path + r"\MMConfig_demo.cfg"
start_headless(mm_app_path, config)
def print_notification_fn(acq_notification):
print(acq_notification.to_json())
wit... |
2b937541ede678b257d566ffa0630c66ab7683bbe129861b1dcc39a0cd44f1b8 | Python | 565 | 21 | from langchain_core.prompt_values import StringPromptValue
from langchain_core.prompts import (
BasePromptTemplate,
StringPromptTemplate,
check_valid_template,
get_template_variables,
jinja2_formatter,
validate_jinja2,
)
from langchain_core.prompts.string import _get_jinja2_variables_from_templa... |
3d98f8dfcf3b120f462888299ab50809e22e16ff51aba9eccd0a63a692a6b1f6 | Python | 566 | 17 | from torch import nn
from TCN.tcn import TemporalConvNet
class TCN(nn.Module):
def __init__(self, input_size, output_size, num_channels, kernel_size, dropout):
super(TCN, self).__init__()
self.tcn = TemporalConvNet(input_size, num_channels, kernel_size=kernel_size, dropout=dropout)
self.li... |
42e04cb26b3cdc7793b0f0b566375682324176a8da2b26d568bd9d23f604d45d | Python | 566 | 23 | import os
import sys
import re
import types
import itertools
import matplotlib.pyplot as plt
import numpy
import numpy.ma
import Stats
import Histogram
import cpgReport
from cgatReport.Tracker import *
from cgatReport.odict import OrderedDict as odict
##################################################################... |
28ded3d7dd9fa49a746469417e9044a0e5197ef4ba0cbf8d3d7f3c186b20a11d | Python | 567 | 22 | from LSTM import preprocess, train, predict, evaluate
setting = {
'train_size': 0.8,
'epochs': 1,
'input_size': 60,
'pre_len': 1,
'batch_size': 32,
'fileName': "o1_i900s_w10_s1_fmean",
'model_name': 'lstm',
'checkpoint_root_dir': './checkpoint-0507/recursion',
'true_epoch... |
b81db0d2d696cc0ad6177083ee4bd4464d20ad74d6c7c48e48ccb3ae3a370ca8 | Python | 567 | 21 | # file generated by setuptools-scm
# don't change, don't track in version control
__all__ = ["__version__", "__version_tuple__", "version", "version_tuple"]
TYPE_CHECKING = False
if TYPE_CHECKING:
from typing import Tuple
from typing import Union
VERSION_TUPLE = Tuple[Union[int, str], ...]
else:
VERS... |
b1af249b1e498734153ee99d1a2e57732c1bf4dfc0646b7773a662cf19cb6e44 | Python | 568 | 22 | """
adapted from:
https://github.com/Open-Catalyst-Project/ocp/blob/main/ocpmodels/common/typing.py
"""
from typing import Optional, Type, TypeVar
_T = TypeVar("_T")
def assert_is_instance(obj: object, cls: Type[_T]) -> _T:
if not isinstance(obj, cls):
raise TypeError(f"obj is not an instance of cls: obj... |
f8ec5302e389706d5fd7e320b7e188bc3e3365d68e0a864bd521e3b6699eed3b | Python | 568 | 20 | """
Extract barrel centers from annotated barrels positions.
"""
import numpy as np
import pandas as pd
positions = pd.read_feather("../data/annotated_barrels.feather")
barrels = positions[positions.layer == "4"]
barrel_centers = {}
for barrel, df in barrels.groupby("barrel"):
geometric_mean = df[list("xyz")].mea... |
2815551d7355dbf2ad0df17c2fdd03c276f6cb47c838e78e185fdebd3d71729e | Python | 569 | 15 | # This file is a part of the `allegro` package. Please see LICENSE and README at the root for information on using it.
from ._allegro import Allegro_Module
from .edgewise import EdgewiseReduce
from ._edgeembed import ProductTypeEmbedding
from .scalarembed import TwoBodyBesselScalarEmbed, TwoBodySplineScalarEmbed
from .... |
b4a66bab3f4d4e50b92e08e06fe16530bd7d00b0e1b0a6b6ccabdb7bbd486987 | Python | 569 | 19 | #Python function that is reording the R-peaks detected on the signal in order to assure "full" beats.
#Input: peaks - the R-peaks positions
# : mids - the mid points positions
#Output: pks, the reordered list of peaks.
def RPeakReordering(peaks,mids):
if(peaks[0]<mids[0] and peaks[-1]>mids[-1]):
pks = ... |
cc1f449a8895f6e5879367d38a75c556b76a9cf388900714d325b1be897950b1 | Python | 569 | 16 | import argparse
audiobook_segments = [
'snip01', 'snip02', 'snip03', 'snip04', 'snip05', 'snip06', 'snip07', 'snip08', 'snip09', 'snip10',
'snip11', 'snip12', 'snip13', 'snip14', 'snip15', 'snip16', 'snip17', 'snip18', 'snip19', 'snip20',
'snip21', 'snip22', 'snip23', 'snip24', 'snip25'
]
parser = argpars... |
f234d880931bc5360af760945cd6c4135dd35feb07bb22c3920632d22f550862 | Python | 569 | 24 | import json
from pathlib import Path
from typing import Any
from typing import Dict
import numpy as np
def save_json_stats(file: Path, stats: Dict[str, Any]) -> None:
for k, v in stats.items():
if type(v) is np.float32 or type(v) is float:
stats[k] = str(round(v, 5))
with file.open("w") a... |
fd016bb87243cb08af678bd8719f24edde80eca1799b2ad3bfbfaa283ed1b84c | Python | 569 | 23 | import pandas as pd
import yaml
import pathlib
def read_files(file):
return len(pd.read_csv(file, index_col=0))
def main():
with open("params.yaml", "r") as file:
params = yaml.safe_load(file)["phosphoproteomics"]["deg_count"]
files = pd.Series(params)
counts = files.map(read_files).to_dict... |
5c3fe0ad4014967111fd33a51b3cb194d3a7b9ff4d4b93a962871fa607ec0769 | Python | 572 | 17 | from torch import nn
from TCN.tcn import TemporalConvNet
class TCN(nn.Module):
def __init__(self, input_size, output_size, num_channels, kernel_size, dropout):
super(TCN, self).__init__()
self.tcn = TemporalConvNet(input_size, num_channels, kernel_size=kernel_size, dropout=dropout)
self.li... |
cff1459915406ef0a436667ffda62bc2635a47f4e77699fe7569e0117738e040 | Python | 573 | 17 | import numpy as np
import random
def dirac_sparse(prob,value,identity = False, normalize = True):
def f(size):
if normalize :
sol = np.zeros(size)
for i in range(size[0]):
select = random.sample(range(0, size[1]), int(size[1]*prob))
sol[i,select] = va... |
8bdb5d2ad4c74282f24b06e9a0fdcb9e5a4f181b2419f1fc6fe2587e2e1c494d | Python | 574 | 16 | from setuptools import setup
with open("README.md", "r") as readme_file:
long_description = readme_file.read()
setup(
name='PeptideModels',
version='1.0.0',
packages=['peptide_models', 'peptide_models.notebooks', 'peptide_models.supporting_experiments'],
url='https://github.com/amp91/PeptideModels... |
14c193efb0454d314127636c5d651771d337c87fc75b0bef28e14f6f3398c2f1 | Python | 577 | 13 | #TO BE UPDATED
from NeuronModel.NeuronClass import neuronClass
class integrate(neuronClass) :
parameters = {'save': True, 'spike':False, 'tau': 10., 'R': 10., 'E_l': -65.}
def __init__(self,**kwargs):
neuronClass.__init__(self,**kwargs)
neuronClass.subclass(self,integrate.parameters,**kwargs)
... |
68a779ae2436499b186ff1c8c1fef04175e5db798af0f5938f3652695fb17e63 | Python | 578 | 19 | import os
import logging
import random
import numpy as np
from pytorch_lightning.utilities.seed import seed_everything
from h3xsemble.utils.suppress_output import SuppressLogging
def seed_globally(seed=None):
if("PL_GLOBAL_SEED" not in os.environ):
if(seed is None):
seed = random.randint(0, n... |
309fdbb2abdf921298d4899e3656a2b0108bb73bd1ba77dd194c8a57382f62df | Python | 579 | 17 | import importlib
def test_dependencies():
assert importlib.util.find_spec("transformers"), \
"transformers is not installed"
assert importlib.util.find_spec("rdkit"), \
"rdkit is not installed"
assert importlib.util.find_spec("torch"), \
"pytorch is not installed"
assert importl... |
8cb60776b0bd1950e977a0c8c78007dcbb44e440135bda37dfbb271c38585654 | Python | 580 | 19 | """**Chat Sessions** are a collection of messages and function calls."""
from collections.abc import Sequence
from typing import Any, TypedDict
from langchain_core.messages import BaseMessage
class ChatSession(TypedDict, total=False):
"""Chat Session.
Chat Session represents a single conversation, channel,... |
157c1e40e32b507db314cdb0d0bdb54ec32cf33b8e745f6c3429b07c1686021b | Python | 581 | 21 | import numpy as np
from voxcell import VoxelData
import sys
orient_x_nrrd = sys.argv[1]
orient_y_nrrd = sys.argv[2]
orient_z_nrrd = sys.argv[3]
mask_nrrd = sys.argv[4]
output_nrrd = sys.argv[5]
nx = VoxelData.load_nrrd(orient_x_nrrd)
ny = VoxelData.load_nrrd(orient_x_nrrd)
nz = VoxelData.load_nrrd(orient_x_nrrd)
mask... |
21a4150a770cea70856265630e772fbca9f8020fc27ee4882df9bce4deb66f39 | Python | 581 | 18 | from histomicstk.utils.girder_convenience_utils import connect_to_api
class StyxAPI(object):
""" Params related to Styx DSA Instance """
url = 'https://styx.neurology.emory.edu/girder/'
apiurl = url + 'api/v1/'
apikey = 'ReplaceMeWithYourAPIKey'
@classmethod
def connect_to_styx(cls, interact... |
dfd47bade89b2afe2796c36f60e18f823a457b3727c78b74d66181456eb9f600 | Python | 583 | 23 | import numpy as np
from sys import argv
argc = len(argv)
flat_image = argv[1]
fxlen = int(argv[2])
data = np.fromfile(flat_image, dtype=np.float32)
assert(np.min(data) >= 0.0)
def flatmap_gini_curve(data):
pixel_counts = sorted(data)
cs = np.cumsum(np.flipud(pixel_counts)).astype(float) / np.sum(pixel_count... |
08261ecddd557fea59316c997cf367958a40700de4669b270636eeaa465518fb | Python | 584 | 18 | from pycromanager import JavaBackendAcquisition, multi_d_acquisition_events
import numpy as np
def image_saved_fn(axes, dataset):
pixels = dataset.read_image(**axes)
print(np.mean(pixels))
# Do something with image pixels/metadata
dir = r'C:\Users\henry\Desktop\data'
with JavaBackendAcquisition(directory=... |
4fb81b4ce4d184aae1041cd1eebd4a076788fd67816abb11f0d88c1f347dcddc | Python | 584 | 28 | from setuptools import setup
setup(
name='cldfbench_phoible',
py_modules=['cldfbench_phoible'],
include_package_data=True,
zip_safe=False,
entry_points={
'cldfbench.dataset': [
'phoible=cldfbench_phoible:Dataset',
],
},
install_requires=[
'pyglottolog>=3... |
5047c00fb083b09d6ac68d2db58c4ef0505cd18136506a31565c548f5c1b952f | Python | 587 | 18 | """Embeddings models.
!!! warning "Modules moved"
With the release of `langchain 1.0.0`, several embeddings modules were moved to
`langchain-classic`, such as `CacheBackedEmbeddings` and all community
embeddings. See [list](https://github.com/langchain-ai/langchain/blob/bdf1cd383ce36dc18381a3bf3fb0a579337... |
7d3d0561c49c0a9674072178fad71befe2c5a4ebf9b37062ab0c920bf1f1ccd2 | Python | 587 | 13 | # Copyright Generate Biomedicines, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to ... |
ee4f04ed09c0dd342e69c920b87999db0116a2d4946d7e7cc62d59141b78d26a | Python | 587 | 23 | from pathlib import Path
from typing import Optional
from pydantic import BaseModel, validator
def chain_id_from_pdb_path(pdb_path: Path):
return pdb_path.stem
class PredictionResult(BaseModel):
pdb_path: Path
confidence: float
chain_id: Optional[str]
sequence_md5: str
ndom: int
nres: int... |
9cbcd5fb67f8da8702a9ab04f8f3fa69a8d8783ae35b354b040b8bda85169026 | Python | 589 | 19 | """
openff-test-parameter-plugins
A test package used to ensure that parameterhandler plugins are handled correctly
"""
from setuptools import setup
setup(
name="openff-test-parameter-plugins",
packages=["custom_plugins"],
include_package_data=True,
entry_points={
"openff.toolkit.plugins.handl... |
a83cde265389777d00fc6369c1c081a4256080cc8cff73ef78fc0dff44bed8d0 | Python | 589 | 15 | from core.loss import loss_register
from core.loss.contrastive_loss import PlainContrastiveLoss
from core.loss.utils import loss_dict_remake_wrapper
@loss_register
class PlainDualModalityContrastiveLoss(PlainContrastiveLoss):
def __init__(self, cfg):
super(PlainDualModalityContrastiveLoss, self).__init__(... |
ffe5aa8e1272b07e8aa95f7cfd293193325b4c7bcb9b8ba6a541c7d72c371f6f | Python | 589 | 20 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time : 2023/9/28 11:02
# @Author : zhangchao
# @File : reader.py
# @Software: PyCharm
# @Email : zhangchao5@genomics.cn
import os
import scanpy as sc
from anndata import AnnData
def reader(data):
if isinstance(data, AnnData):
return data
elif i... |
3939998c6e1e7822c4e056bec4b0df773f1dbeacb11e26d3b4bc7d6cd5471282 | Python | 590 | 13 | # Copyright 2022 DeepMind Technologies Limited.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed... |
49f65c59566faa6620cc24cd4b4ebe938909b00e92fe6410e17b0712da91f5f3 | Python | 591 | 20 | import pytest
from langchain_core.utils.iter import batch_iterate
@pytest.mark.parametrize(
("input_size", "input_iterable", "expected_output"),
[
(2, [1, 2, 3, 4, 5], [[1, 2], [3, 4], [5]]),
(3, [10, 20, 30, 40, 50], [[10, 20, 30], [40, 50]]),
(1, [100, 200, 300], [[100], [200], [300]... |
ea62cc744e122fb79d6c9360968b734b62a2ac198b6bbcd076dbefc2dd124b4d | Python | 591 | 13 | # Copyright 2021 DeepMind Technologies Limited.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed... |
30abaa67b41f0da25e1360c09c0a58e1e87a83722fc5971169fec75aaa6056fd | Python | 592 | 32 | """Utility functions for PyTorch models."""
from .stochastic import GaussianSample
from .distributions import (
log_normal_standard,
log_normal_diag,
log_gaussian
)
from .utils import (
to_categorical,
get_empty_traces,
get_empty_dicts,
LogConfusionMatrix
)
from .metrics import *
from .loss... |
75d9b4fa242a0211b02f0b8618949286bbdf9a82cec63f58c82478780fbebc94 | Python | 593 | 26 | from langchain_classic.schema.runnable import __all__
EXPECTED_ALL = [
"ConfigurableField",
"ConfigurableFieldSingleOption",
"ConfigurableFieldMultiOption",
"patch_config",
"RouterInput",
"RouterRunnable",
"Runnable",
"RunnableSerializable",
"RunnableBinding",
"RunnableBranch",
... |
160844cdadf4ea43bdf08b2ecf24cb90d90dac3ecb75d7b1da8a15dac7d5d7a2 | Python | 594 | 25 | import glob
import random
import mne
import pandas as pd
def gen_subject_raw(subject_dir, shuffle=False):
list_of_raw = list()
for edf_file in sorted(glob.glob(f"{subject_dir}/sample*/EEG.edf")):
raw: mne.io.Raw = mne.io.read_raw_edf(edf_file, verbose=False)
list_of_raw.append(raw)
if sh... |
6ccb4d551e8792e42579bae16b6ac34fba44a1a76bab508f05abaeb7b9b8585d | Python | 594 | 26 | import pytest
import torch
from chroma.layers.structure.optimal_transport import (
optimize_couplings_gw,
optimize_couplings_sinkhorn,
)
# test sinkhorn
def test_sinkhorn():
C = torch.Tensor([[[1, 0, 0], [0, 0, 1], [0, 1, 0]]])
assert torch.allclose(
optimize_couplings_sinkhorn(C).argmin(-1),... |
049abbb47a44713a4071d85e65162c840733f4ace7351e727daec019f1f077fd | Python | 595 | 23 | from typing import TYPE_CHECKING, Any
from langchain_classic._api import create_importer
if TYPE_CHECKING:
from langchain_community.llms import Beam
# Create a way to dynamically look up deprecated imports.
# Used to consolidate logic for raising deprecation warnings and
# handling optional imports.
DEPRECATED_L... |
b89ebcf0582ce57433cd001b0e764edf00f06028aa8ed1145726963e574594d0 | Python | 595 | 23 | from typing import TYPE_CHECKING, Any
from langchain_classic._api import create_importer
if TYPE_CHECKING:
from langchain_community.llms import RWKV
# Create a way to dynamically look up deprecated imports.
# Used to consolidate logic for raising deprecation warnings and
# handling optional imports.
DEPRECATED_L... |
396bc0db8f6287f565881ea94d60be90df242b7d52d4821cb246d2f10d3d5e24 | Python | 596 | 20 | import pandas as pd
def ensure_folder(forced_path, return_string: bool = True):
path = forced_path.parent
if path.is_dir() is False:
path.mkdir(parents=True, exist_ok=True)
return str(forced_path) if return_string is True else forced_path
def read_dataframe(path, sep=";") -> pd.DataFrame:
tr... |
1a6236e37c3470a47b215ce01ef7d497bfbaa4979bc36554bf8c5e0214266441 | Python | 598 | 23 | from typing import TYPE_CHECKING, Any
from langchain_classic._api import create_importer
if TYPE_CHECKING:
from langchain_community.llms import Modal
# Create a way to dynamically look up deprecated imports.
# Used to consolidate logic for raising deprecation warnings and
# handling optional imports.
DEPRECATED_... |
7eac031bcb71dfb7592d816eecb7c08bb58f01991bb546fc8135aa74a2fecd7e | Python | 598 | 23 | from typing import TYPE_CHECKING, Any
from langchain_classic._api import create_importer
if TYPE_CHECKING:
from langchain_community.llms import Arcee
# Create a way to dynamically look up deprecated imports.
# Used to consolidate logic for raising deprecation warnings and
# handling optional imports.
DEPRECATED_... |
f08e7a73594774577fa07a2506d1cb387939f491ca1e332e1a679171587e5410 | Python | 598 | 19 | # -*- coding: utf-8 -*-
"""
Created on Thu May 5 20:51:41 2022
@author: ywjin0707
"""
sc.pp.normalize_total(mydata, target_sum = 1e4)
sc.pp.log1p(mydata)
sc.pp.highly_variable_genes(mydata)
mydata = mydata[:, mydata.var.highly_variable]
def simulate_bulk(datasets: list, n: int = 10000, c: int = 500, sf: int = 100):... |
094c053dc75b66300f38396b19bd72fa28ecf6c8ffcf042c41da6e9461080945 | Python | 601 | 23 | from typing import TYPE_CHECKING, Any
from langchain_classic._api import create_importer
if TYPE_CHECKING:
from langchain_community.llms import Petals
# Create a way to dynamically look up deprecated imports.
# Used to consolidate logic for raising deprecation warnings and
# handling optional imports.
DEPRECATED... |
32cae2a4a4cbc889515262163dcd9f2b564fa1ed60e16ccf95641195877d499b | Python | 601 | 23 | from typing import TYPE_CHECKING, Any
from langchain_classic._api import create_importer
if TYPE_CHECKING:
from langchain_community.llms import Writer
# Create a way to dynamically look up deprecated imports.
# Used to consolidate logic for raising deprecation warnings and
# handling optional imports.
DEPRECATED... |
40de30c77ab4d4e0a2df609c4a968a8aac800c04fcfe604d3848df65a955864a | Python | 601 | 23 | from typing import TYPE_CHECKING, Any
from langchain_classic._api import create_importer
if TYPE_CHECKING:
from langchain_community.llms import Nebula
# Create a way to dynamically look up deprecated imports.
# Used to consolidate logic for raising deprecation warnings and
# handling optional imports.
DEPRECATED... |
6280614da19af3f603bf6ebceb340e77fa9e8f1b0e666ccb2e3685f819d4486a | Python | 601 | 23 | from typing import TYPE_CHECKING, Any
from langchain_classic._api import create_importer
if TYPE_CHECKING:
from langchain_community.llms import Cohere
# Create a way to dynamically look up deprecated imports.
# Used to consolidate logic for raising deprecation warnings and
# handling optional imports.
DEPRECATED... |
62ac9fbdfc66a21af651f5777ab428fd2a1ea89c764a392b753d8a185df0b958 | Python | 601 | 23 | from typing import TYPE_CHECKING, Any
from langchain_classic._api import create_importer
if TYPE_CHECKING:
from langchain_community.llms import Mlflow
# Create a way to dynamically look up deprecated imports.
# Used to consolidate logic for raising deprecation warnings and
# handling optional imports.
DEPRECATED... |
6f9ec69772863f1abd8182637adb077c99b523a912aa2edb0c4f757c924e47ce | Python | 601 | 26 | """Chat loaders."""
from abc import ABC, abstractmethod
from collections.abc import Iterator
from langchain_core.chat_sessions import ChatSession
class BaseChatLoader(ABC):
"""Base class for chat loaders."""
@abstractmethod
def lazy_load(self) -> Iterator[ChatSession]:
"""Lazy load the chat ses... |
87f1b8431e2328141528ba76c85a725c9830963b9e6301b84a222c37b728971a | Python | 601 | 23 | from typing import TYPE_CHECKING, Any
from langchain_classic._api import create_importer
if TYPE_CHECKING:
from langchain_community.llms import Ollama
# Create a way to dynamically look up deprecated imports.
# Used to consolidate logic for raising deprecation warnings and
# handling optional imports.
DEPRECATED... |
92a9dfd4778321212b977b697738c30bb0b3c535463890461dfc16b43cbbfd14 | Python | 601 | 23 | from typing import TYPE_CHECKING, Any
from langchain_classic._api import create_importer
if TYPE_CHECKING:
from langchain_community.llms import Tongyi
# Create a way to dynamically look up deprecated imports.
# Used to consolidate logic for raising deprecation warnings and
# handling optional imports.
DEPRECATED... |
9ecfaed1af8e37e909a6bba1b121848fd0a84f19364af5f924cd585eb3031967 | Python | 601 | 23 | from typing import TYPE_CHECKING, Any
from langchain_classic._api import create_importer
if TYPE_CHECKING:
from langchain_community.llms import EdenAI
# Create a way to dynamically look up deprecated imports.
# Used to consolidate logic for raising deprecation warnings and
# handling optional imports.
DEPRECATED... |
e061b3e3dbcb405df14daed3e80b65ea036820958d24abc3e911be6d4d6a260b | Python | 601 | 23 | from typing import TYPE_CHECKING, Any
from langchain_classic._api import create_importer
if TYPE_CHECKING:
from langchain_community.llms import Banana
# Create a way to dynamically look up deprecated imports.
# Used to consolidate logic for raising deprecation warnings and
# handling optional imports.
DEPRECATED... |
ecc4b3796b81cdaea71990ac7a3266dcc51a07fc0443dcad43523d5f75b8a103 | Python | 601 | 23 | from typing import TYPE_CHECKING, Any
from langchain_classic._api import create_importer
if TYPE_CHECKING:
from langchain_community.llms import OpenLM
# Create a way to dynamically look up deprecated imports.
# Used to consolidate logic for raising deprecation warnings and
# handling optional imports.
DEPRECATED... |
f9260fcc0355d6de6ea0b050d57882438000d78bfaf79f243d1d4ff62b89ced4 | Python | 601 | 23 | from typing import TYPE_CHECKING, Any
from langchain_classic._api import create_importer
if TYPE_CHECKING:
from langchain_community.llms import Aviary
# Create a way to dynamically look up deprecated imports.
# Used to consolidate logic for raising deprecation warnings and
# handling optional imports.
DEPRECATED... |
023767ce61bcc490b9fbd419834ee720fb2fbde2d9fd771d41975939c86d225b | Python | 604 | 23 | from typing import TYPE_CHECKING, Any
from langchain_classic._api import create_importer
if TYPE_CHECKING:
from langchain_community.llms import OpenLLM
# Create a way to dynamically look up deprecated imports.
# Used to consolidate logic for raising deprecation warnings and
# handling optional imports.
DEPRECATE... |
07f553dd80dea19db789f8631d65eba6d7f751158cf76e479279167a61a741fd | Python | 604 | 23 | from typing import TYPE_CHECKING, Any
from langchain_classic._api import create_importer
if TYPE_CHECKING:
from langchain_community.llms import Baseten
# Create a way to dynamically look up deprecated imports.
# Used to consolidate logic for raising deprecation warnings and
# handling optional imports.
DEPRECATE... |
0ec43ab03de950c2614955f86f9da33da660304826d8a7b8704d63c11ca0e58f | Python | 604 | 23 | from typing import TYPE_CHECKING, Any
from langchain_classic._api import create_importer
if TYPE_CHECKING:
from langchain_community.llms import GooseAI
# Create a way to dynamically look up deprecated imports.
# Used to consolidate logic for raising deprecation warnings and
# handling optional imports.
DEPRECATE... |
3463c2e44b1f0e52d25576b02254bc4539614abab3333e849b32835a56a39c9f | Python | 604 | 23 | from typing import TYPE_CHECKING, Any
from langchain_classic._api import create_importer
if TYPE_CHECKING:
from langchain_community.llms import TextGen
# Create a way to dynamically look up deprecated imports.
# Used to consolidate logic for raising deprecation warnings and
# handling optional imports.
DEPRECATE... |
729b840a6914357a7f7f34e3467414126f11fbcd2fd40002174817fec7856b06 | Python | 604 | 23 | from typing import TYPE_CHECKING, Any
from langchain_classic._api import create_importer
if TYPE_CHECKING:
from langchain_community.llms import ChatGLM
# Create a way to dynamically look up deprecated imports.
# Used to consolidate logic for raising deprecation warnings and
# handling optional imports.
DEPRECATE... |
91ac3de5260be315bd0edfb8d6615c92925ec0d727b8b5c9b51e6833f9755363 | Python | 604 | 23 | from typing import TYPE_CHECKING, Any
from langchain_classic._api import create_importer
if TYPE_CHECKING:
from langchain_community.llms import Minimax
# Create a way to dynamically look up deprecated imports.
# Used to consolidate logic for raising deprecation warnings and
# handling optional imports.
DEPRECATE... |
b41118a8b5e039a90104b3b5e7c9a6d84bc236c7bc2a19f97134e5b9a0482a04 | Python | 604 | 21 | import numpy as np
from pycromanager import Dataset
import napari
# This path is to the top level of the magellan dataset (i.e. the one that contains the Full resolution folder)
data_path = "/Users/henrypinkard/tmp/tcz_acq_84"
# open the dataset
dataset = Dataset(data_path)
# read tiles or tiles + metadata by channe... |
d4fd6441f8c55278ba049f6a14f19f5b7663dfe8810362aef817107cf86261e0 | Python | 604 | 23 | from typing import TYPE_CHECKING, Any
from langchain_classic._api import create_importer
if TYPE_CHECKING:
from langchain_community.llms import GPT4All
# Create a way to dynamically look up deprecated imports.
# Used to consolidate logic for raising deprecation warnings and
# handling optional imports.
DEPRECATE... |
0bd6bb1c54ae77b910cd54c0323ad7313bd0201d9520292a6c64675b45dd9eb1 | Python | 606 | 21 | import pandas as pd
import numpy as np
import os
import json
def save_fluo_info( save_folder, cond, props ):
# Make it work for Python 2+3 and with Unicode
# print('### Done computing, saving data...')
# data = pd.DataFrame(props)
fname = os.path.join(save_folder,cond+'_fluo_intensity.json')
props... |
27d4624dbf2c5d3e5c73124b005b94b3141996ef2fb338a7240f89df5a991ce5 | Python | 607 | 23 | from typing import TYPE_CHECKING, Any
from langchain_classic._api import create_importer
if TYPE_CHECKING:
from langchain_community.llms import Together
# Create a way to dynamically look up deprecated imports.
# Used to consolidate logic for raising deprecation warnings and
# handling optional imports.
DEPRECAT... |
9698f4a72dc886a943e002ce88267865b7a19861afb91549100c1d4568f02f2b | Python | 607 | 23 | from typing import TYPE_CHECKING, Any
from langchain_classic._api import create_importer
if TYPE_CHECKING:
from langchain_community.llms import Clarifai
# Create a way to dynamically look up deprecated imports.
# Used to consolidate logic for raising deprecation warnings and
# handling optional imports.
DEPRECAT... |
9ccf8ea53ef2175f987a6ee44ac7b02d34b4c13e41d2cb5be8429bf25bd9ca98 | Python | 607 | 23 | from typing import TYPE_CHECKING, Any
from langchain_classic._api import create_importer
if TYPE_CHECKING:
from langchain_community.llms import LlamaCpp
# Create a way to dynamically look up deprecated imports.
# Used to consolidate logic for raising deprecation warnings and
# handling optional imports.
DEPRECAT... |
b5aeb7aa28c21070ca1730b70a70091e4cb0fd3980540e2622d34f36e73db66e | Python | 607 | 23 | from typing import TYPE_CHECKING, Any
from langchain_classic._api import create_importer
if TYPE_CHECKING:
from langchain_community.llms import Anyscale
# Create a way to dynamically look up deprecated imports.
# Used to consolidate logic for raising deprecation warnings and
# handling optional imports.
DEPRECAT... |
efccb7229c2061ec9f69c2ca5200345108d95983c16d75bf79e08402927a8934 | Python | 607 | 23 | from typing import TYPE_CHECKING, Any
from langchain_classic._api import create_importer
if TYPE_CHECKING:
from langchain_community.llms import GigaChat
# Create a way to dynamically look up deprecated imports.
# Used to consolidate logic for raising deprecation warnings and
# handling optional imports.
DEPRECAT... |
f106b338803dda479b8f16e4f88506610464ec8ab056a90e5af7ee93f2e62179 | Python | 607 | 23 | from typing import TYPE_CHECKING, Any
from langchain_classic._api import create_importer
if TYPE_CHECKING:
from langchain_community.llms import MosaicML
# Create a way to dynamically look up deprecated imports.
# Used to consolidate logic for raising deprecation warnings and
# handling optional imports.
DEPRECAT... |
feb6455c9fa44f58fbab8dee02317ac81680ddc70d9bb6d4077815c873169a94 | Python | 607 | 23 | from typing import TYPE_CHECKING, Any
from langchain_classic._api import create_importer
if TYPE_CHECKING:
from langchain_community.llms import NLPCloud
# Create a way to dynamically look up deprecated imports.
# Used to consolidate logic for raising deprecation warnings and
# handling optional imports.
DEPRECAT... |
0d0c7012a86b2359cdfa282d03a710a509762ceb9d9482ec2a1966d6977238da | Python | 608 | 22 | """Utilities for getting information about the runtime environment."""
import platform
from functools import lru_cache
from langchain_core import __version__
@lru_cache(maxsize=1)
def get_runtime_environment() -> dict[str, str]:
"""Get information about the LangChain runtime environment.
Returns:
A... |
19728c6c3d71245e20e9e3fdf015bddeed1814ea8d57f4fc8048ee21a03343b4 | Python | 608 | 21 | from ._base import BaseSupervisedMetric, BaseUnsupervisedMetric, get_metric
from .adjacency_cm import AdjacencyConfusionMatrix
from .correlation_score import CorrelationScore
from .fisher_c import FisherC
from .implied_cis import ImpliedCIs
from .orientation_cm import OrientationConfusionMatrix
from .shd import SHD
fro... |
bdf2340179474086169528c66de09203eeb5f600fd3960f3da80324f780ec869 | Python | 608 | 21 | import numpy as np
from pycromanager import multi_d_acquisition_events, JavaBackendAcquisition
def img_process_fn(image, metadata):
print(image)
pass # send them somewhere else, not default saving and display
with JavaBackendAcquisition(image_process_fn=img_process_fn) as acq:
# Generate the events for ... |
764b8b2b9c75a40aa9cbf521d0dc0474a8fe6247a77d8a3c1ac878c1c861948f | Python | 609 | 16 | from annotation2BIO import generate_BIO
from text_process.sentence_tokenization import SentenceBoundaryDetection
def test():
text = """below).A. (0/3).F. PSA at diagnosis (7.57, 2/17) . ?pT3a ?N0 ?MX . ?G"""
sent_tokenizer = SentenceBoundaryDetection()
entities = [['pT3a', 'T3a', (33, 37)], ['N0 ', 'N0',... |
37b24407e25cd7ed85e9b2b3de6640676c878236393a53dbf0b2e908fadb534f | Python | 610 | 23 | from typing import TYPE_CHECKING, Any
from langchain_classic._api import create_importer
if TYPE_CHECKING:
from langchain_community.llms import DeepInfra
# Create a way to dynamically look up deprecated imports.
# Used to consolidate logic for raising deprecation warnings and
# handling optional imports.
DEPRECA... |
616240f5f7b9480b608af753a93d33271fa11ecb6a282bc09922eef8ed97878c | Python | 610 | 23 | from typing import TYPE_CHECKING, Any
from langchain_classic._api import create_importer
if TYPE_CHECKING:
from langchain_community.llms import Replicate
# Create a way to dynamically look up deprecated imports.
# Used to consolidate logic for raising deprecation warnings and
# handling optional imports.
DEPRECA... |
65ca677c30e2e23570834839b573952ab2fe99893cd136ae97782497406d41e3 | Python | 610 | 23 | from typing import TYPE_CHECKING, Any
from langchain_classic._api import create_importer
if TYPE_CHECKING:
from langchain_community.llms import YandexGPT
# Create a way to dynamically look up deprecated imports.
# Used to consolidate logic for raising deprecation warnings and
# handling optional imports.
DEPRECA... |
73de269366188e8ff7a6aef2dc3dea223b33ca850917395d51d8ae20eb8efece | Python | 610 | 23 | from typing import TYPE_CHECKING, Any
from langchain_classic._api import create_importer
if TYPE_CHECKING:
from langchain_community.llms import Fireworks
# Create a way to dynamically look up deprecated imports.
# Used to consolidate logic for raising deprecation warnings and
# handling optional imports.
DEPRECA... |
95c1f4bef0168fc5f61a6ee5c651f77ad2fb4a1fea0de98548f11038e8568c05 | Python | 610 | 22 | """Test map_rerank parser."""
import pytest
from langchain_classic.chains.question_answering.map_rerank_prompt import output_parser
GOOD_SCORE = "foo bar answer.\nScore: 80"
SCORE_WITH_EXPLANATION = (
"foo bar answer.\n"
"Score: 80 (fully answers the question, "
"but could provide more detail on the spec... |
c2272518279d18ecd20e3b420ce3961d9b1db91f40282d667a7247569617b067 | Python | 610 | 23 | from typing import TYPE_CHECKING, Any
from langchain_classic._api import create_importer
if TYPE_CHECKING:
from langchain_community.llms import Predibase
# Create a way to dynamically look up deprecated imports.
# Used to consolidate logic for raising deprecation warnings and
# handling optional imports.
DEPRECA... |
f8239dedbdcb9f8f9e165cdb7a69af6ee01774a867f7898e80d99e07ccdcdd2a | Python | 610 | 23 | from typing import TYPE_CHECKING, Any
from langchain_classic._api import create_importer
if TYPE_CHECKING:
from langchain_community.llms import Anthropic
# Create a way to dynamically look up deprecated imports.
# Used to consolidate logic for raising deprecation warnings and
# handling optional imports.
DEPRECA... |
28a7884010abfd5890e361dddb58adcf315e36973d98e3d2ad4f02bc6ef909e8 | Python | 611 | 23 | from typing import TYPE_CHECKING, Any
from langchain_classic._api import create_importer
if TYPE_CHECKING:
from langchain_community.graphs import RdfGraph
# Create a way to dynamically look up deprecated imports.
# Used to consolidate logic for raising deprecation warnings and
# handling optional imports.
DEPREC... |
647655466410b31b6444525ea727a61dcfcee455e92fbc8173c253edcdb73bd2 | Python | 611 | 21 | import numpy as np
from scipy import interpolate
def compute_midline_and_tangent(anch, N_points, tck, width):
# print('Generating meshgrid')
t = np.linspace(0, 1, N_points)
x, y = interpolate.splev(t, tck)
# y = interpolate.splev(t, y_tup)
dx, dy = interpolate.splev(t, tck, der=1)
# dy = interp... |
b6e25c47864531b40fd9c1447a081b5d49a1b06dbdebe67649fbb949cd1ca3dc | Python | 611 | 23 | from typing import TYPE_CHECKING, Any
from langchain_classic._api import create_importer
if TYPE_CHECKING:
from langchain_community.vectorstores import Tair
# Create a way to dynamically look up deprecated imports.
# Used to consolidate logic for raising deprecation warnings and
# handling optional imports.
DEPR... |
ec96ec5c227fc7d1ed0c043588227314e447fd28c64d23708db95a107dc90033 | Python | 611 | 23 | from typing import TYPE_CHECKING, Any
from langchain_classic._api import create_importer
if TYPE_CHECKING:
from langchain_community.vectorstores import Vald
# Create a way to dynamically look up deprecated imports.
# Used to consolidate logic for raising deprecation warnings and
# handling optional imports.
DEPR... |
1900000e33918a46e0211ca52308f47df5864b29a65b098871645f4fd26584c3 | Python | 613 | 23 | from typing import TYPE_CHECKING, Any
from langchain_classic._api import create_importer
if TYPE_CHECKING:
from langchain_community.llms import WatsonxLLM
# Create a way to dynamically look up deprecated imports.
# Used to consolidate logic for raising deprecation warnings and
# handling optional imports.
DEPREC... |
3ab804de621a94b0a08df6a1ad5850aea224ad46840230696fa89c36e6848c0a | Python | 613 | 23 | from typing import TYPE_CHECKING, Any
from langchain_classic._api import create_importer
if TYPE_CHECKING:
from langchain_community.llms import PipelineAI
# Create a way to dynamically look up deprecated imports.
# Used to consolidate logic for raising deprecation warnings and
# handling optional imports.
DEPREC... |
4bd7e894d7f89a816c5b6fe7747d7f985833475ed699586699d2aeb3616d5e86 | Python | 613 | 23 | from typing import TYPE_CHECKING, Any
from langchain_classic._api import create_importer
if TYPE_CHECKING:
from langchain_community.llms import Xinference
# Create a way to dynamically look up deprecated imports.
# Used to consolidate logic for raising deprecation warnings and
# handling optional imports.
DEPREC... |
5d0f3da1d25f4e8c883b94c8af147ecc0eda193a1ee8c61f8a1ce53f28aacf9e | Python | 613 | 23 | from typing import TYPE_CHECKING, Any
from langchain_classic._api import create_importer
if TYPE_CHECKING:
from langchain_community.llms import AlephAlpha
# Create a way to dynamically look up deprecated imports.
# Used to consolidate logic for raising deprecation warnings and
# handling optional imports.
DEPREC... |
88331f5efa67f4766c8b548cbc86649cfea66af3ff2eeda0be28888f0097aba3 | Python | 613 | 23 | from typing import TYPE_CHECKING, Any
from langchain_classic._api import create_importer
if TYPE_CHECKING:
from langchain_community.llms import GooglePalm
# Create a way to dynamically look up deprecated imports.
# Used to consolidate logic for raising deprecation warnings and
# handling optional imports.
DEPREC... |
8c3e21b27cc8f9e9c5527e7092aa637fc2874ef5838e8eeefb2675832760501d | Python | 613 | 23 | from typing import TYPE_CHECKING, Any
from langchain_classic._api import create_importer
if TYPE_CHECKING:
from langchain_community.llms import DeepSparse
# Create a way to dynamically look up deprecated imports.
# Used to consolidate logic for raising deprecation warnings and
# handling optional imports.
DEPREC... |
9126771ed5ba938d343dad7ae744f6231d774fe67325d02f8b66f3af4e297257 | Python | 613 | 24 | import numpy as np
from explainability.utils import topological_sort
def test_topological_sort():
dependencies = np.asarray([
[0, 1, 0, 0, 0, 0, 0],
[0, 0, 1, 0, 0, 0, 0],
[0, 0, 0, 1, 0, 0, 0],
[0, 0, 0, 0, 0, 1, 0],
[0, 0, 0, 0, 0, 1, 0],
[0, 0, 0, 0, 0, 0, 1],
... |
ae84ba9e24a3aa0de412baafe6736f0ff515b067dd164bc6b51ff647566e5ccc | Python | 613 | 23 | from typing import TYPE_CHECKING, Any
from langchain_classic._api import create_importer
if TYPE_CHECKING:
from langchain_community.llms import Databricks
# Create a way to dynamically look up deprecated imports.
# Used to consolidate logic for raising deprecation warnings and
# handling optional imports.
DEPREC... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.