sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
7ac48a99a74959f41397bf4739f436a2b364e207311ca1fe9d01551e50252aee
Python
750
29
from typing import TYPE_CHECKING, Any from langchain_classic._api import create_importer if TYPE_CHECKING: from langchain_community.document_loaders.parsers.language.code_segmenter import ( CodeSegmenter, ) # Create a way to dynamically look up deprecated imports. # Used to consolidate logic for rais...
c8f89745b87da2688c6032062224d933c6ea08dac3e4d3a3ef4f7f44cd4680aa
Python
750
27
from typing import TYPE_CHECKING, Any from langchain_classic._api import create_importer if TYPE_CHECKING: from langchain_community.llms import PromptLayerOpenAI, PromptLayerOpenAIChat # Create a way to dynamically look up deprecated imports. # Used to consolidate logic for raising deprecation warnings and # han...
51e01bf21205403c3051ebdf8a8d7f314c051c1b3d5476faaf2c59d05514d6a3
Python
751
27
import numpy as np from .base_cam import BaseCAM class GradCAM(BaseCAM): def __init__(self, model, target_layers, use_cuda=False, reshape_transform=None): super( GradCAM, self).__init__( model, target_layers, use_cuda, ...
b288c6c871267be3da3cdb38a96405d14a31406b44464f8c86fd19b5665e53db
Python
751
27
from typing import TYPE_CHECKING, Any from langchain_classic._api import create_importer if TYPE_CHECKING: from langchain_community.query_constructors.timescalevector import ( TimescaleVectorTranslator, ) # Create a way to dynamically look up deprecated imports. # Used to consolidate logic for raisin...
f084024d655abf4b517cb5feda1202b1587091800873b93c8d9fcc57b56a8958
Python
751
27
from typing import TYPE_CHECKING, Any from langchain_classic._api import create_importer if TYPE_CHECKING: from langchain_community.query_constructors.tencentvectordb import ( TencentVectorDBTranslator, ) # Create a way to dynamically look up deprecated imports. # Used to consolidate logic for raisin...
0a24e484328644949716426da49fa0d903713189cd46f2d149f8962089701248
Python
752
27
import os import pickle def listdir_extension(folder_path, extension, return_full_path=True): if os.path.exists(folder_path) and os.path.isdir(folder_path): listdir = os.listdir(folder_path) else: return None to_pop = [] for i_l, file in enumerate(listdir): if file[-len(extensi...
d5fdac6db75c1eba2b00a330d3d41af98eb814a7f9f80051f000961510a400b4
Python
753
21
import math import numpy as np def shape_matching(im, size): sz=im.shape if sz[0] >size[0]: xstart=int(math.ceil(sz[0]/2)- int(size[0]/2-1)) im=im[xstart-1:xstart+size[0]-1,:] else: npad1=int(math.floor(float(size[0])/2-float(sz[0])/2)) npad2=int(math.ceil(float(size[0])/2-f...
e2ffbe67a3efa5299233819909c20e68038dd544db168c1aff09f1f7ec3b51be
Python
753
26
from joblib import Parallel, delayed import mne import pandas as pd from config_chbp_eeg import bids_root, deriv_root subjects_list = list(bids_root.glob('*')) subjects_df = pd.read_csv(bids_root / "participants.tsv", sep='\t') subjects = [sub for sub in subjects_df.participant_id if (deriv_root / sub ...
0429e3c175429f6bdaef69ae791eeffa6b6396bca771b80f8f7fcc6f1dbb3ca5
Python
754
25
""" Specifying the parameters for the matplotlib figures produced by visualize_gradients.py """ UR_CORNER_PARAMS = {'axis':'both', 'which':'both', 'left':'off', 'right':'off', 'bottom':'off', 'top': 'off', 'labelbottom':'off','labelleft':'off', 'labeltop':'off'} BOTTOM_EDGE_PARAMS = UR_CORNER_PARAMS.copy() BOTTOM_EDG...
1ec32d4434bc58df46f430948da5cb8d0d5f3f2c87510e8a23eb5312e0960079
Python
754
18
# 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 ...
340b6094c1c39aa4854fabe5c54554301c24d4fc64e1adbf47e41cc874c826d7
Python
754
29
from typing import TYPE_CHECKING, Any from langchain_classic._api import create_importer if TYPE_CHECKING: from langchain_community.agent_toolkits.file_management.toolkit import ( FileManagementToolkit, ) # Create a way to dynamically look up deprecated imports. # Used to consolidate logic for raisin...
81d6b0a134d11d32613e9419b7238c9632eb05ab74872ba6045ad886badbd7b4
Python
754
30
import unittest import pandas import cgatpipelines.tasks.counts as Counts class TestCountsClass(unittest.TestCase): def setUp(self): self.counts = Counts.Counts(pandas.DataFrame( {'sample1': [0, 1, 2], 'sample2': [2, 4, 3]})) def test_removeSamples_removes_low_counts(self):...
fdfc0876c0476ac52d9fd2d907a0fdaa3aecd2dff0c0bb82052647d29d227de9
Python
754
25
# Finds how many CG sites are targeted in each species for a selected set of Infinium 2 probes import sys import gzip from collections import defaultdict def main(): if len(sys.argv) != 3: print "Usage: python pickInf2Probes.py <probes file> <output file>" exit(1) probesFile = gzip.open(sys.arg...
14c08d40d88218405a87ac59f5bd1eee4f103201bb3b162b1e262752fc0e4926
Python
755
23
import argparse import pandas as pd if __name__ == '__main__': parser = argparse.ArgumentParser() parser.add_argument('lv_file', help='File containing LVs to be filtered by variance') parser.add_argument('out_file', help='File to store the filtered LVs to ') parser.add_argument('--n_to_keep', help='Th...
3a074991bda7d53e17c7bdd63c6f09aa90f4d6aaff8cb99414b597cefa6ad686
Python
755
25
import numpy as np from neurovisfit.common.splits import get_train_val_split def test_get_train_val_split(): n = 1000 train_frac = 0.8 seed = 123 train_idx, val_idx = get_train_val_split(n, train_frac, seed) assert isinstance(train_idx, np.ndarray) assert isinstance(val_idx, np.ndarray) ...
a315eab9345c9ae08a0ed7460eb91eb4bd096eecd69b7d8f6333526953c89039
Python
755
26
import numpy as np import random def random_no_repeat(numbers, count): number_list = list(numbers) random.shuffle(number_list) return np.array(number_list[:count]) def brunel(r , J , g, epsilon): def f(size): sol = np.zeros(size) if size[0]!=size[1] : print('Not right') ...
d1812c5eac3556b8b79e658b1864a4d85e90a8a6fcc65d445c7b5c7760566444
Python
755
19
"""Test formatting functionality.""" from langchain_core.language_models.base import _get_token_ids_default_method class TestTokenCountingWithGPT2Tokenizer: def test_tokenization(self) -> None: # Check that the tokenization is consistent with the GPT-2 tokenizer assert _get_token_ids_default_meth...
ed4f8f51be284c2a6adbc1b918286dcb8cad2c76cd377b4903f1fc89253cee42
Python
755
29
from typing import TYPE_CHECKING, Any from langchain_classic._api import create_importer if TYPE_CHECKING: from langchain_community.document_loaders.parsers.language.language_parser import ( LanguageParser, ) # Create a way to dynamically look up deprecated imports. # Used to consolidate logic for ra...
38e12ef8e04e8f26b399352dd00b89156ae60cc60e3f024a9b226b7d1cd5b8fd
Python
756
25
import torch import torch.nn as nn import torch.nn.functional as F from . import resnet class WideBottleneck(resnet.Bottleneck): expansion = 2 def generate_model(model_depth, k=2, **kwargs): assert model_depth in [50, 101, 152, 200] inplanes = [x * k for x in resnet.get_inplanes()] if model_depth ...
586a622d71a684373eb2e010c1fd07bc3c68cf5c6660ca1cea31653a19f4c2de
Python
756
23
from langchain_core.agents import AgentAction def format_log_to_str( intermediate_steps: list[tuple[AgentAction, str]], observation_prefix: str = "Observation: ", llm_prefix: str = "Thought: ", ) -> str: """Construct the scratchpad that lets the agent continue its thought process. Args: i...
fc540b7296edd728fbac28c2a236b6f85a9c5b3b28dcf79010ef227c09ea98d2
Python
756
27
from typing import TYPE_CHECKING, Any from langchain_classic._api import create_importer if TYPE_CHECKING: from langchain_community.tools.ainetwork.base import AINBaseTool, OperationType # Create a way to dynamically look up deprecated imports. # Used to consolidate logic for raising deprecation warnings and # h...
dee576864fb168c0d61d9a048d6e4b9ec6cb56d7b26997ec36e86fa38907e2d4
Python
757
24
from typing import TYPE_CHECKING, Any from langchain_classic._api import create_importer if TYPE_CHECKING: from langchain_community.agent_toolkits.json.prompt import JSON_PREFIX, JSON_SUFFIX # Create a way to dynamically look up deprecated imports. # Used to consolidate logic for raising deprecation warnings and...
15b25383a8a93056de91957078f7729986113b86377bc49d8494c5782f8d990f
Python
758
23
from skspatial.objects import Line, Points, Vector from scipy.sparse import csr_matrix from scipy.sparse.linalg import svds # faster and leaner Line.best_fit def best_line_fit(points, tol=None, **kwargs) -> Line: points_spatial = Points(points) if points_spatial.are_concurrent(tol=tol): raise ValueErr...
0b8e1924c5e2dd47527b7ed7009f44f125cb1c2f62e6bd48a2fea74cbfffafef
Python
759
27
from typing import TYPE_CHECKING, Any from langchain_classic._api import create_importer if TYPE_CHECKING: from langchain_community.callbacks.tracers.wandb import WandbRunArgs, WandbTracer # Create a way to dynamically look up deprecated imports. # Used to consolidate logic for raising deprecation warnings and #...
9aa9c6bd62de185bafe4009851ba77ed9b4f7ed447d7b3a3b6768fcd4f340d50
Python
759
27
from typing import TYPE_CHECKING, Any from langchain_classic._api import create_importer if TYPE_CHECKING: from langchain_community.storage import UpstashRedisByteStore, UpstashRedisStore # Create a way to dynamically look up deprecated imports. # Used to consolidate logic for raising deprecation warnings and # ...
d344883db67cf8d8b686f59deb65fcb257ac1c7a7f0fd00e827c8bd377c5b2cf
Python
759
28
from typing import TYPE_CHECKING, Any from langchain_classic._api import create_importer if TYPE_CHECKING: from langchain_community.tools import SleepTool from langchain_community.tools.sleep.tool import SleepInput # Create a way to dynamically look up deprecated imports. # Used to consolidate logic for rais...
fffbe87b5555d5505041fba77c834967523d85cce45b01912194a9c9767c2d9a
Python
759
28
from typing import TYPE_CHECKING, Any from langchain_classic._api import create_importer if TYPE_CHECKING: from langchain_community.tools import ShellTool from langchain_community.tools.shell.tool import ShellInput # Create a way to dynamically look up deprecated imports. # Used to consolidate logic for rais...
10f26f858c74b584b5765bf93016d68f971d85541caa76e9925f173dd320ff9e
Python
760
29
from typing import TYPE_CHECKING, Any from langchain_classic._api import create_importer if TYPE_CHECKING: from langchain_community.document_loaders.parsers.language.javascript import ( JavaScriptSegmenter, ) # Create a way to dynamically look up deprecated imports. # Used to consolidate logic for ra...
845b7f13b74f98ca0073a604e443b8b8f946ebc6ca4565b30251fff384e08547
Python
760
31
import time import zmq from math import ceil IP_ADDR = "tcp://127.0.0.1:5557" NB_NRN = 512 NB_REGS_SPK = 16 NB_TAB_PER_FRAME = 512 NB_BYTES_PER_REGS = 4 BYTE_SIZE_FRAME = (NB_REGS_SPK+1)*NB_BYTES_PER_REGS def producer(): context = zmq.Context() zmq_sock...
b4a8b95be0bdd0b4ee9e8a03c5fbd4b9246f60d91bd05b59f4bf5e1c1c1d9187
Python
761
28
from typing import TYPE_CHECKING, Any from langchain_classic._api import create_importer if TYPE_CHECKING: from langchain_community.tools import OpenAPISpec from langchain_community.utilities.openapi import HTTPVerb # Create a way to dynamically look up deprecated imports. # Used to consolidate logic for rai...
e91d5324bf64a966b1f23c6816a8727d245b872ca781d87b606303913a51e0ad
Python
761
29
"""Bing Search API toolkit.""" from typing import TYPE_CHECKING, Any from langchain_classic._api import create_importer if TYPE_CHECKING: from langchain_community.tools import BingSearchResults, BingSearchRun # Create a way to dynamically look up deprecated imports. # Used to consolidate logic for raising depre...
1787026c122101f3334a75d1d588a9b3fbdaf6f210335d56b6b57450b38a1d98
Python
762
27
#python scripts/coverage.py cand = open('core-wln-global/model-300-3-direct/test_withReagents.cbond') gold = open('data/test.txt.proc') ks = [6, 8, 10, 12, 14, 16, 18, 20] topks = [0 for k in ks] tot = 0 for line in cand: tot += 1 cand_bonds = [] for v in line.split(): x,y,t = v.split('-') ...
e849193081ef242f4b09d278be622b41c94346c0e0b670041d0bf43bbbf8a1ab
Python
762
27
from typing import TYPE_CHECKING, Any from langchain_classic._api import create_importer if TYPE_CHECKING: from langchain_community.document_loaders import CSVLoader, UnstructuredCSVLoader # Create a way to dynamically look up deprecated imports. # Used to consolidate logic for raising deprecation warnings and #...
1280e094fcceabe8dc018a12c8a7ee928828c175931c33330be79b8c7ccf1169
Python
763
24
from typing import Any from langchain_classic.base_memory import BaseMemory class ReadOnlySharedMemory(BaseMemory): """Memory wrapper that is read-only and cannot be changed.""" memory: BaseMemory @property def memory_variables(self) -> list[str]: """Return memory variables.""" retu...
391f1ae0bccc4eb82f2f49d3dd9be2d40aa122bd640fc6af8a527f924b93f9fa
Python
763
22
# Obtain the affinity corresponding to each protein import os import pandas as pd # Program root directory path = os.path.abspath(os.path.dirname(os.getcwd())) # index directory index_path = path + r'\pre-data\PDBbind_index\index\INDEX_general_PL_data.2020' # Affinity storage directory affinity_data_path = path...
e5218b5b03c3a522d133a241a59a4401145fd3329a14036a7b06fa6e4f707d8e
Python
764
37
import numpy as np from os import path from sys import argv from voxcell import VoxelData argc = len(argv) def loadext(filename): _, ext = path.splitext(filename) if ext == ".img": return np.fromfile(filename, dtype=np.float32) elif ext == ".nrrd": return VoxelData.load_nrrd(filename).raw ...
f7a4344bc15ac7ce28da54889dd3693a45bb4774f010b5e13697b95c2731bb9a
Python
764
29
from typing import TYPE_CHECKING, Any from langchain_classic._api import create_importer if TYPE_CHECKING: from langchain_community.embeddings.cloudflare_workersai import ( CloudflareWorkersAIEmbeddings, ) # Create a way to dynamically look up deprecated imports. # Used to consolidate logic for raisi...
12d7ccba326be968b35b4fe7b6080f96bdadbc0ec0d9ec5fc7e2f0a56d3b8716
Python
765
27
from typing import TYPE_CHECKING, Any from langchain_classic._api import create_importer if TYPE_CHECKING: from langchain_community.chat_models.bedrock import BedrockChat, ChatPromptAdapter # Create a way to dynamically look up deprecated imports. # Used to consolidate logic for raising deprecation warnings and ...
617e96b96a05ae25935c1be1615c85aa02cf8869a835c37240039f8ced639402
Python
765
27
from typing import TYPE_CHECKING, Any from langchain_classic._api import create_importer if TYPE_CHECKING: from langchain_community.vectorstores import ElasticKnnSearch, ElasticVectorSearch # Create a way to dynamically look up deprecated imports. # Used to consolidate logic for raising deprecation warnings and ...
11dde732e82aea331c0337baa7cf432f15ae95cc3b40e6485e62c45ba7cef773
Python
766
20
# 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 ...
316f95314b5b5c7ffd37c8e41ccddf0437523d3c389a2d21a6cbf3ca3862f27d
Python
766
19
# 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 ...
34c474eb32fbea08c2b8dfd5e17636d73cc1fdb6ab6deb69eca9d9fdeec04334
Python
766
28
from typing import TYPE_CHECKING, Any from langchain_classic._api import create_importer if TYPE_CHECKING: from langchain_community.llms import GradientLLM from langchain_community.llms.gradient_ai import TrainResult # Create a way to dynamically look up deprecated imports. # Used to consolidate logic for ra...
786c6995f9b58e578710422c658c05619d61fd26844078559f0b65f06a0970ca
Python
766
21
# TODO: deprecate agent_instructions = """You are a helpful assistant. Help the user answer any questions. You have access to the following tools: {tools} In order to use a tool, you can use <tool></tool> and <tool_input></tool_input> tags. \ You will then get back a response in the form <observation></observation> ...
a0a8e15c11082495d70a45c931de9125904ffff41de9d9ec9192bef92cac5da6
Python
766
29
from typing import TYPE_CHECKING, Any from langchain_classic._api import create_importer if TYPE_CHECKING: from langchain_community.document_loaders.baiducloud_bos_directory import ( BaiduBOSDirectoryLoader, ) # Create a way to dynamically look up deprecated imports. # Used to consolidate logic for r...
42660b79f178058bcf156c05842e830ab553d05690aef9e7f681ade7dc709ebb
Python
768
27
from typing import TYPE_CHECKING, Any from langchain_classic._api import create_importer if TYPE_CHECKING: from langchain_community.tools.nuclia.tool import NUASchema, NucliaUnderstandingAPI # Create a way to dynamically look up deprecated imports. # Used to consolidate logic for raising deprecation warnings and...
805a97e519a60c0368e495767d28dccc8b19654b5960625a4af58fffaa5ab356
Python
768
33
""" Utils ===== Utility functions meant to be used in the different openmm modules or tests. This module provides a common API point for different utility functions that serve as convenience or help users in different miscellaneous tasks. """ from .utils import ( _RESERVED_WORDS_PATTERNS, deserialize, fin...
3bc78faa7ba39bfa3beaa3b8992d7845ec8d347b229ed533480bd65c4e1674ee
Python
769
14
data_collection = "E_coli_PRECISE2" # Data set to train on. tied = True # Specifies if the autoencoder is tied. layer_sizes = [2000, 1000, 50] # Sizes of hidden layers up to and including the bottleneck. If untied, decoder layers must be given explicitly. layer_actis = ['sigmoid' for i in range(2*len(layer_...
059a2e6f80a3aa55b0bfa389bc23a48c34a9a1cfcc0206bfd125a951d630979b
Python
770
28
from typing import TYPE_CHECKING, Any from langchain_classic._api import create_importer if TYPE_CHECKING: from langchain_community.tools import AINRuleOps from langchain_community.tools.ainetwork.rule import RuleSchema # Create a way to dynamically look up deprecated imports. # Used to consolidate logic for...
a59a6e5615ce8972588f057475171ddb9fc176896d80920bb5e5c300b1710653
Python
770
19
# 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 ...
a5d736a877c120fa28592595002ea35b7ebfe0b3a8cd5760fb92dd9b2bd5f8f8
Python
771
28
from typing import TYPE_CHECKING, Any from langchain_classic._api import create_importer if TYPE_CHECKING: from langchain_community.tools import ArxivQueryRun from langchain_community.tools.arxiv.tool import ArxivInput # Create a way to dynamically look up deprecated imports. # Used to consolidate logic for ...
6b677856a054bfffc307d17289c338bcc1ef3a8d50a9ecd309a1661463fcaae6
Python
772
29
"""Playwright browser toolkit.""" from typing import TYPE_CHECKING, Any from langchain_classic._api import create_importer if TYPE_CHECKING: from langchain_community.agent_toolkits.playwright.toolkit import ( PlayWrightBrowserToolkit, ) # Create a way to dynamically look up deprecated imports. # Use...
fdfe5c6ec3d1714764056b77a1fa74d2ab7551d2376fed0888b76a5a1f66738f
Python
772
26
import pytest from qupkake.featurizer import Featurizer @pytest.fixture def example_featurizer(): smiles = "CCO" return Featurizer(smiles=smiles, name="example_molecule", xtb=True) def test_featurizer(example_featurizer): # Call the featurizer to get the PyTorch Geometric Data object data = example...
20ce774b22b61023dab88f2574de610378abe5e17d9807a3a64e9a9fc60fec0c
Python
773
29
"""Zapier Tool.""" from typing import TYPE_CHECKING, Any from langchain_classic._api import create_importer if TYPE_CHECKING: from langchain_community.tools import ZapierNLAListActions, ZapierNLARunAction # Create a way to dynamically look up deprecated imports. # Used to consolidate logic for raising deprecati...
1d39d06d309de4c92b6cff37f8b7dcc12138b6b77953ba4fe4330286f492d103
Python
774
28
from pathlib import Path from libs.eval.expresult import ExpResult from libs.visualizer.metrics import GenVisualizer, Visualizer class Eval: def __init__(self, dir_output: Path) -> None: self.dir_output = dir_output / "metrics" if not self.dir_output.exists(): self.dir_output.mkdir()...
6ca84769e111dc53571068bad3cd5943b0da11f3b4dda1e43b1b012d3b1a300b
Python
774
20
# Python function that computes the # input, output and delta SNR # Inputs: # the (input) signal x # the noise (i.e. the noise contained in x) n # the (output, i.e. the filtered signal) s # Ouputs: # input_SNR_db - the SNR computed for the (input) signal x and the noise n # output_SNR_db - t...
a2978a0e7180314b107d017c300bbd8c3c76b154ed6d08bf236459e236058cf5
Python
774
30
import pytest import torch from neurovisfit.models.core import TaskDrivenCore @pytest.fixture(scope="module") def sample_input(): return torch.randn(1, 3, 224, 224) # Example input tensor @pytest.fixture(scope="module") def task_core_layer3_resnet50(): return TaskDrivenCore( input_channels=3, ...
d127dc764552497993157ce7532799abf6f56a3a702060ee7860007f0c8ca546
Python
774
31
"""Embeddings.""" from typing import TYPE_CHECKING from langchain_core._import_utils import import_attr if TYPE_CHECKING: from langchain_core.embeddings.embeddings import Embeddings from langchain_core.embeddings.fake import ( DeterministicFakeEmbedding, FakeEmbeddings, ) __all__ = ("Det...
037b292d779934f69e69381202fe56e7b68121690970a64a40bd0e7bbcfbc685
Python
775
28
from typing import TYPE_CHECKING, Any from langchain_classic._api import create_importer if TYPE_CHECKING: from langchain_community.tools import AINOwnerOps from langchain_community.tools.ainetwork.owner import RuleSchema # Create a way to dynamically look up deprecated imports. # Used to consolidate logic f...
050567bf5d8bea38cb921ddee363918bcccd0694f5314a567c3f4f1532df2b5e
Python
775
23
import setuptools with open("README.md", "r") as fh: long_description = fh.read() setuptools.setup( name="pnabind", version="1.0", author="Jared Sagendorf", author_email="sagendor@usc.edu", description="A package for predicting protein binding sites and binding function using geometric deep le...
4b6c9022cc6eeb02d63998f9c0d11a8cca592eefbd7c83a9fc5e758eb0ea678f
Python
775
29
"""Google Search API Toolkit.""" from typing import TYPE_CHECKING, Any from langchain_classic._api import create_importer if TYPE_CHECKING: from langchain_community.tools import GoogleSearchResults, GoogleSearchRun # Create a way to dynamically look up deprecated imports. # Used to consolidate logic for raising...
d31454a432255d3dc5f57b36327fe46f6a7454c7495c8b85556f879ee9944981
Python
775
25
"""Different methods for rendering Tools to be passed to LLMs. Depending on the LLM you are using and the prompting strategy you are using, you may want Tools to be rendered in a different way. This module contains various ways to render tools. """ # For backwards compatibility from langchain_core.tools import ( ...
e05aa9e4f4f7487ae21a68065959acc1664fe12a8d163e681baa51046f023340
Python
775
28
"""Helper functions for managing the LangChain API. This module is only relevant for LangChain developers, not for users. !!! warning This module and its submodules are for internal use only. Do not use them in your own code. We may change the API at any time with no warning. """ from langchain_classic._a...
039ffefe833e3956677d239f811cbc0804aa747618062e4c6ef45a5e8b6a08a5
Python
777
28
import sys try: from .energy_space_explorer import EnergyExplorer except (ModuleNotFoundError, NameError): print('EnergyExplorer Module is not available. Check Rosetta installation.', sys.stderr) from .reaction_network import ReactionNetwork from .vectorized_rxn_net import VectorizedRxnNet from .vectorized_rxn_...
26a0d3b025b0ec2778ee6fd1aea987a016eb5912b99fa7bcf0fef48f4793f4a1
Python
777
23
import importlib.util import os.path as op def loadModule(module_path, model_name=None, model_args=[], model_kwargs={}, return_model=True): # specify the module that needs to be # imported relative to the path of the # module name = op.basename(module_path).strip('.py') spec = importlib.util.spe...
a2b39c552d9441b06cc2000ddd7bf686f1cd7a845dc9f1df24454fd1542e4a7f
Python
777
25
from langchain_core.documents import Document from langchain_classic.retrievers.document_compressors.listwise_rerank import ( LLMListwiseRerank, ) def test_list_rerank() -> None: from langchain_openai import ChatOpenAI documents = [ Document("Sally is my friend from school"), Document("S...
34cdbf538e5e1468730cc6adf7b2086b424b19cf9052f35bf07c136b9877dab9
Python
778
28
from typing import TYPE_CHECKING, Any from langchain_classic._api import create_importer if TYPE_CHECKING: from langchain_community.tools import AINValueOps from langchain_community.tools.ainetwork.value import ValueSchema # Create a way to dynamically look up deprecated imports. # Used to consolidate logic ...
8bd6cf9ad0766901e2eaee8412816d36a88eb45081e1af78fa64c4b2ef7e8028
Python
779
32
# -*- coding: utf-8 -*- # @title Main # @file main.py # @author Romain Beaubois # @date 20 Feb 2023 # @copyright # SPDX-FileCopyrightText: © 2023 Romain Beaubois <refbeaubois@yahoo.com> # SPDX-License-Identifier: GPL-3.0-or-later # # @brief # # @details # > **20 Feb 2023** : file creat...
9594be634d2e76de79a285476891c198bbacdb11fac1c47152a27c83f1daae41
Python
779
17
#TO BE UPDATED from NeuronModel.NeuronClass import neuronClass import numpy as np class stein(neuronClass): parameters = {'save': True, 'spike':False,'tau':10.,'R':10.,'E_l':-65., 'a_e':0.1, 'a_i':0.1} def __init__(self,**kwargs): neuronClass.__init__(self,**kwargs) neuronClass.subclass(self,s...
b3f3af0828ea5af95ebe1d53ef882f026bd02df3ab13d8b8eb93dbc71307c339
Python
779
27
import pytest def pytest_addoption(parser): parser.addoption( "--runslow", action="store_true", default=False, help="run slow tests" ) def pytest_configure(config): config.addinivalue_line("markers", "slow: mark test as slow to run") config.addinivalue_line("markers", "gpu_ci: mark test as u...
18eed4d87d6090005b5cb0a67f0ed168c27717a5c3603905e8c76a0022f3a964
Python
780
28
from typing import TYPE_CHECKING, Any from langchain_classic._api import create_importer if TYPE_CHECKING: from langchain_community.llms import JavelinAIGateway from langchain_community.llms.javelin_ai_gateway import Params # Create a way to dynamically look up deprecated imports. # Used to consolidate logic...
7043ab964d4d3e62f8f6941139a2c2b3fb40260acccaeae6355160004652c52a
Python
780
24
# Copyright (c) 2021, David Williams, Reza Sameni # All rights reserved. # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. import numpy as np import scipy.linalg as sp def TikhonovRegularization(x,DiffOrderOrFilterCoefs,lamb): if n...
cfa058df55ed553021fa9682e5dd2e58955968696302842574794db1a4aa09ff
Python
780
25
from prettyplot import * import h5py import os ### TABLE8 ### savepath = '../data/simulation_outputs/factor_fixing' file_name = "factor_fixing.h5" path = os.path.join(savepath, file_name) hf = h5py.File(path, 'r') # Open results output_samples = hf['output_samples'][()] first_order_indices = hf['S1'][()] total_order...
d51d68b870d245880982acde89bd0ae48bad0c7a4b7f226a1d174c1606535669
Python
780
29
from typing import TYPE_CHECKING, Any from langchain_classic._api import create_importer if TYPE_CHECKING: from langchain_community.agent_toolkits.azure_cognitive_services import ( AzureCognitiveServicesToolkit, ) # Create a way to dynamically look up deprecated imports. # Used to consolidate logic f...
72461b49fc10e13f09ecd0cee55f95bfd720849df8b98ada0f3c332935d15683
Python
781
24
# Copyright (c) 2021, David Williams, Reza Sameni # All rights reserved. # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. import numpy as np import scipy.linalg as sp def tikhonov_regularization(x,DiffOrderOrFilterCoefs,lamb): if ...
8654eb1e080af4b0870e70204dc6cf4cfaeeb2f3f243f36c11be6483d2e08481
Python
781
38
from langchain_core.runnables.base import ( Other, Runnable, RunnableBinding, RunnableBindingBase, RunnableEach, RunnableEachBase, RunnableGenerator, RunnableLambda, RunnableLike, RunnableParallel, RunnableSequence, RunnableSerializable, coerce_to_runnable, ) from lan...
2c65992e0c9787861964bc9e55a53e8e1a188882dfbee596f050bd0961116aed
Python
782
24
from typing import Dict import pytorch_lightning as pl import torch from utilities import instantiate_from_config class DiffusionDenoise(pl.LightningModule): def __init__(self, model_config: Dict, lr: float = 1e-5) -> None: super().__init__() self.lr = lr self.model = instantiate_from_conf...
eccc0345578263800a81bc4bb245a998df833c349f8142923d8f159ef7141dca
Python
782
28
import unittest import filecmp import tempfile import os import sys sys.path = [os.path.join(os.path.dirname( os.path.realpath(__file__)), '..', )]+sys.path from enrichm.writer import Writer class Tests(unittest.TestCase): def test_write(self): output_file = tempfile.mktemp() output_lines = ...
1972221deffc5274e4df9467a333747991593ab9ea5513852760c9e7aa488407
Python
783
32
# -*- coding: utf-8 -*- # @title Main # @file main.py # @author Romain Beaubois # @date 20 Feb 2023 # @copyright # SPDX-FileCopyrightText: © 2023 Romain Beaubois <refbeaubois@yahoo.com> # SPDX-License-Identifier: GPL-3.0-or-later # # @brief # # @details # > **20 Feb 2023** : file creat...
82744b3a792ba7b93db129c70188c96341aad066f51861f7a3756d2ee08c380f
Python
783
28
from typing import TYPE_CHECKING, Any from langchain_classic._api import create_importer if TYPE_CHECKING: from langchain_community.tools import ClickTool from langchain_community.tools.playwright.click import ClickToolInput # Create a way to dynamically look up deprecated imports. # Used to consolidate logi...
e43bf8cbf16cb42f55033ed92667ce6152929004f8b763f7a94f2f72820e1d2d
Python
783
32
"""Top-level package for mrQA.""" __author__ = """Harsh Sinha""" __email__ = 'harsh.sinha@pitt.edu' # __version__ = '0.1.0' import logging import sys from mrQA.config import configure_logger logger = logging.getLogger(__name__) logger = configure_logger(logger, output_dir=None, mode='w') from mrQA.monitor import m...
e4afe8e328f05942cae1a349ffe8a93ece60f9aeaa19d9412ce537e963f84c22
Python
783
23
import numpy as np import matplotlib import matplotlib.pyplot as plt from mpl_toolkits.axes_grid1 import ImageGrid from scipy.ndimage import zoom ori = '/data/datasets/ADNI_NoBack/ADNI_002_S_0295_MR_MPR__GradWarp__B1_Correction__N3__Scaled_2_Br_20081001114556321_S13408_I118671.npy' MRI = '../ADNIP_NoBack/ADNI_002_S_02...
01f113cc8c57ddc50fb3c8501467c0d326d2405ac1cfb8db19826af74ed7d9aa
Python
784
24
from setuptools import setup, find_packages setup( name='e3nn_Unet', version='0.1.0', description='Segmentation network with O3 and SO3 equivariant convolutions', url='https://github.com/SCAN-NRAD/e3nn_Unet', classifiers=[ 'Development Status :: 3 - Alpha', 'Intended Audience :: Sci...
15dddd5d1543fc69fb6de1b5849fb73e14b35a958e09da977c3ea49cb016a507
Python
785
28
from typing import TYPE_CHECKING, Any from langchain_classic._api import create_importer if TYPE_CHECKING: from langchain_community.vectorstores import Qdrant from langchain_community.vectorstores.qdrant import QdrantException # Create a way to dynamically look up deprecated imports. # Used to consolidate lo...
69bab0d75753ca18c4df963f393b19afff6bfb81bf8e0b89c328c28a8d7a9582
Python
785
28
from typing import TYPE_CHECKING, Any from langchain_classic._api import create_importer if TYPE_CHECKING: from langchain_community.llms.fake import FakeStreamingListLLM from langchain_core.language_models import FakeListLLM # Create a way to dynamically look up deprecated imports. # Used to consolidate logi...
1daffa047f21fc96334120d4101e6bfa136209308008899ef70439c45ff952f8
Python
786
37
# Copyright (c) 2021, David Williams, Reza Sameni # All rights reserved. # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. import numpy as np def SynchPhaseTimes2(peaks): I = np.where(peaks) I = I[0] D = I[1:] - I[0:-1] ...
9f60809d7d622a88cba548d1ea5bc23aee334ed1d129b2062774c407911f138b
Python
788
25
import os import pathlib import config_chbp_eeg as cfg import pandas as pd """Fixing the participants.tsv in the derivatives folder The current release of the CHBP has a faulty participants.tsv that doesn't include age. This script carries over the info from the demographics directory shipped by the CHBP and writes a...
a4368a101a36bcd989d3cbc2ea390e50eb38b416f7b47137be24b2b4b87b0ed5
Python
789
27
import os import random def obtain_files_list(): for root, dirs, files in os.walk(training_set_path): return files def remove_step_files(remove_list): for file_name in remove_list: del_file = training_set_path + "\\" + file_name os.remove(del_file) print("已经删除:", del_file) ...
aa68b52f82e9a061d36575f17b25e01a721bf692f9b5c8bda04223a169ef0073
Python
789
12
""" Perform optimization to find optimal field map for distortion correction. Files: - `ADMM`: A class implementing the Alternating Direction Method of Multipliers optimization algorithm. - `EPIOptimize`: A base class for different optimization algorithms in EPI-MRI distortion correction. - `GaussNewton`: A class impl...
2cd16570b9400296943c7af07f09889201adfd516157b30711570db1a43f01a5
Python
790
28
from typing import TYPE_CHECKING, Any from langchain_classic._api import create_importer if TYPE_CHECKING: from langchain_community.utilities import SerpAPIWrapper from langchain_community.utilities.serpapi import HiddenPrints # Create a way to dynamically look up deprecated imports. # Used to consolidate lo...
a52f03ef33956a9e3231dbceadd02a3a2d8e953bdcfaa86fd2f6103400218224
Python
790
27
from typing import TYPE_CHECKING, Any from langchain_classic._api import create_importer if TYPE_CHECKING: from langchain_community.query_constructors.databricks_vector_search import ( DatabricksVectorSearchTranslator, ) # Create a way to dynamically look up deprecated imports. # Used to consolidate ...
b8381c410d23474b7392e3375236e2167d4a0f2ca96fcdf3aea10151d6d6253c
Python
790
23
"""Parameterizations: models of one variable given its parents, and the distributions they return. This module is experimental: its API may change in any release without a deprecation period. """ from pgmpy.parameterization._base import BaseParameter from pgmpy.parameterization.adapters import DistributionAdapter, Sk...
741e80fa15b32bdc87151dd3119b60e32d762730b9d59452a00ae2674b6604b7
Python
791
33
import os import numpy as np import glob import mdtraj as md def mkdir(dir_name): if not os.path.exists(dir_name): os.mkdir(dir_name) def get_fns(dir_name,pattern): return np.sort(glob.glob(os.path.join(dir_name, pattern))) def load_traj_coords_dir(dir_name,pattern,top): fns = get_fns(dir_name, p...
79ac9c7615e294b9aa9ac5d960756e4813b59b2e8152c32c2b3e90efca551470
Python
791
31
# # Based on lsf CookieCutter.py # import os import json d = os.path.dirname(__file__) with open(os.path.join(d, "settings.json")) as fh: settings = json.load(fh) class CookieCutter: SBATCH_DEFAULTS = settings['SBATCH_DEFAULTS'] CLUSTER_NAME = settings['CLUSTER_NAME'] CLUSTER_CONFIG = settings['CLUS...
e6a6466210a126186a110a00ba8f17eec11dfccdfcca24ec87e47ffc64c8b2d7
Python
791
27
from typing import TYPE_CHECKING, Any from langchain_classic._api import create_importer if TYPE_CHECKING: from langchain_community.agent_toolkits.spark_sql.prompt import ( SQL_PREFIX, SQL_SUFFIX, ) # Create a way to dynamically look up deprecated imports. # Used to consolidate logic for rais...
df8bf852b722b34b47c9a8f1adf96b7a893192e2a39078e05171c43f7ef8ed45
Python
792
27
import scanpy as sc from bayestme import data, synthetic_data stdata = synthetic_data.generate_demo_dataset() data.SpatialExpressionDataset() print(stdata.gene_names) import numpy as np import pandas as pd #%% de from bayestme import deconvolution from bayestme.common import InferenceType best_spatial_smoothing_paramet...
fc305ff633974b9e9cd61bb72bde1bd82d508bdd39fa6de980b9c13578e38107
Python
792
31
"""Local file management toolkit.""" from typing import TYPE_CHECKING, Any from langchain_classic._api import create_importer if TYPE_CHECKING: from langchain_community.agent_toolkits.file_management.toolkit import ( FileManagementToolkit, ) # Create a way to dynamically look up deprecated imports. ...
3e27902c83dc2062739a67f4020cfd6d5212e0bc8958df59f6e1aa3cc57759fa
Python
793
28
from typing import TYPE_CHECKING, Any from langchain_classic._api import create_importer if TYPE_CHECKING: from langchain_community.tools import AINTransfer from langchain_community.tools.ainetwork.transfer import TransferSchema # Create a way to dynamically look up deprecated imports. # Used to consolidate ...
bbf3a8713427a1669852989a76cd2c042635ab92949cc79d9934ac113b5fb63e
Python
793
28
from typing import TYPE_CHECKING, Any from langchain_classic._api import create_importer if TYPE_CHECKING: from langchain_community.vectorstores import Vectara from langchain_community.vectorstores.vectara import VectaraRetriever # Create a way to dynamically look up deprecated imports. # Used to consolidate...
00f841fb6e5e0ecdc00187c3c2c2e34165c00327862ff490010f4dee3a354a0d
Python
794
36
import argparse import pickle def main(): parser = argparse.ArgumentParser() parser.add_argument('--old_pkl', type=str, required=True) parser.add_argument('--new_pkl', type=str, required=True) args = parser.parse_args() with open(args.old_pkl, 'rb') as f: old = dict(pickle.load(f)) w...
4dd026e46777b42f1e041091bb67e2d3da7962409dfa33bc23c050281b1150ac
Python
794
28
from typing import TYPE_CHECKING, Any from langchain_classic._api import create_importer if TYPE_CHECKING: from langchain_community.utilities import SQLDatabase from langchain_community.utilities.sql_database import truncate_word # Create a way to dynamically look up deprecated imports. # Used to consolidate...