sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
9c64eed6f6075817001ed50ea0c680e99c070e851aeca99777702fe22f1dc271
Python
885
32
from typing import TYPE_CHECKING, Any from langchain_classic._api import create_importer if TYPE_CHECKING: from langchain_community.example_selectors.ngram_overlap import ( NGramOverlapExampleSelector, ngram_overlap_score, ) # Create a way to dynamically look up deprecated imports. # Used to ...
fd3f687ce37b068a0f263fdb2a5bd3b802f2552a664fa604a63ff3b90beb61fb
Python
885
32
# Copyright (c) Microsoft Corporation. # Licensed under the MIT license. import os from pdearena import utils from pdearena.data.datamodule import PDEDataModule from pdearena.lr_scheduler import LinearWarmupCosineAnnealingLR # noqa: F401 from pdearena.models.pdemodel import PDEModel logger = utils.get_logger(__name_...
8cdcab1249ecc96cfd2bdaf540a6283075ff9baf012f7c6c9f1c10e998c8c6a9
Python
887
31
import setuptools setuptools.setup( name="pyebm", version="2.0.3", author="Vikram Venkatraghavan", author_email="v.venkatraghavan@erasmusmc.nl", description="Toolbox for event-based modeling", long_description="Contains codes for EBM and DEBM with several options for mixture modeling", long...
b50ece2acdddfb8273cf98703bd405b84e47d68147e6858cd1cf6f24f33ebd35
Python
887
28
from typing import TYPE_CHECKING, Any from langchain_classic._api import create_importer if TYPE_CHECKING: from langchain_community.document_loaders import AssemblyAIAudioTranscriptLoader from langchain_community.document_loaders.assemblyai import TranscriptFormat # Create a way to dynamically look up deprec...
5fdf18357ddcd97ce3b68c42eadc09e1060d7eab51ed55be30f830ca041d4e1f
Python
889
30
from typing import TYPE_CHECKING, Any from langchain_classic._api import create_importer if TYPE_CHECKING: from langchain_community.embeddings import ( SelfHostedHuggingFaceEmbeddings, SelfHostedHuggingFaceInstructEmbeddings, ) # Create a way to dynamically look up deprecated imports. # Used ...
bd5fd1af11aa4ad290f24eea1730f172b0c671eec7b0c018dbc27c05d6be8a94
Python
890
20
from typing import Any def __getattr__(name: str) -> Any: """Get attr name.""" if name == "create_python_agent": msg = ( "This agent has been moved to langchain_experimental. " "This agent relies on python REPL tool under the hood, so to use it " "safely please sand...
2a2d4fbbf05dec64eabdd1f83e6172b4f37fd74875eee48b449168c9e9ca6112
Python
891
36
from matformer.train_props import train_prop_model props = [ "formation_energy_peratom", "optb88vdw_bandgap", "bulk_modulus_kv", "shear_modulus_gv", "mbj_bandgap", "slme", "magmom_oszicar", "spillage", "kpoint_length_unit", "encut", "optb88vdw_total_energy", "epsx", ...
cf8473e9d51113ff0063634b32f5423dc2a123fcf877f3a03f0774a254a4a1f7
Python
892
32
from typing import TYPE_CHECKING, Any from langchain_classic._api.module_import import create_importer if TYPE_CHECKING: from langchain_community.chat_loaders.facebook_messenger import ( FolderFacebookMessengerChatLoader, SingleFileFacebookMessengerChatLoader, ) module_lookup = { "SingleF...
dac0117511e33debadc6491657bc93b8f920c00447ba0aafd9287ae3fb89a49d
Python
892
20
from typing import Any def __getattr__(name: str) -> Any: """Get attr name.""" if name == "create_xorbits_agent": msg = ( "This agent has been moved to langchain_experimental. " "This agent relies on python REPL tool under the hood, so to use it " "safely please san...
1d5b4bedf179836b945f8cfd75fe915915a340cb62f25835f3be43368d813ecd
Python
893
32
from typing import TYPE_CHECKING, Any from langchain_classic._api import create_importer if TYPE_CHECKING: from langchain_community.llms import AzureOpenAI, OpenAI, OpenAIChat from langchain_community.llms.openai import BaseOpenAI # Create a way to dynamically look up deprecated imports. # Used to consolidat...
7700b571ecee8c4cda61138907f85b36722f96866ad6784b2608d1dcb0ad74dc
Python
894
31
""" imagingplus: integrated tool-suite of essential processing and analysis of imaging+ experiments """ import warnings warnings.filterwarnings("ignore") from ._version import __version__ from .utils.io import import_obj from imagingplus.main.core import SingleImage from imagingplus.utils import utils from imaging...
f92efa2cbff9b424f4959a5f70a222fe2e154cb760bcfa5a2843a49786a2b301
Python
895
33
import argparse from pipeline import Pipeline from inverse_fold_models.proteinmpnn import ProteinMPNN from fold_models.esmfold import ESMFold def main(args): # inverse fold model inverse_fold_model = ProteinMPNN() # fold model fold_model = ESMFold() # pipeline pipeline = Pipeline(inverse_fold_model, fold_mod...
46256e25fa286c016a52102dda3198cb32f34163574ddd2ec1ffd9d2484f8cfd
Python
896
33
#!/usr/bin/env python """Setup script for the theta package """ from setuptools import setup, find_packages, Extension from Cython.Build import cythonize from Cython.Distutils import build_ext import numpy extensions = [ Extension('series', sources=['series.pyx', 'bessel.c'], ...
6f3617879cdfeef59633a3c5b84da7838e2c66d6b2e5fb3266bc696749090f5c
Python
896
19
import torch from torchvision import datasets, transforms def data_generator(root, batch_size): train_set = datasets.MNIST(root=root, train=True, download=True, transform=transforms.Compose([ transforms.ToTensor(), ...
b2db01bac2497a4313e088932ad4e96de2be2908c5fb5905c9ff2351c131320a
Python
896
29
import argparse def main(): parser = argparse.ArgumentParser() parser.add_argument('infile', help='the transformed values of latent variables') parser.add_argument('outfile', help='the reformated values of latent variables') args = parser.parse_args() outfh = open(args.outfile, 'w') ### the he...
5b4563e3a3d6db33da12f7fabc8d82b6de5f782c9d13d42ff2b4d02f8f0f1bc4
Python
897
35
import torch import torch.nn import torch.utils.data def compute_forces(energy, positions, training=True): grad_outputs = [torch.ones_like(energy)] gradient = torch.autograd.grad( outputs=[energy], inputs=[positions], grad_outputs=grad_outputs, retain_graph=training, ...
809b84e957398aa547eb9df3698ac3a5e852f7078ad309cbb912d19b14b8818d
Python
897
33
from typing import TYPE_CHECKING, Any from langchain_classic._api import create_importer if TYPE_CHECKING: from langchain_community.utilities.redis import ( TokenEscaper, check_redis_module_exist, get_client, ) # Create a way to dynamically look up deprecated imports. # Used to consol...
0523350a64dd12e9b43e1d4055e61f8662cb01de1cfe0a20d6da2b266bea68f6
Python
898
35
from logging import Logger from pathlib import Path from typing import List from ..data import AnnotationTable, WorldlineTable from ...methods.overwrite_checkpoint import overwrite_checkpoint from ._utilities import default_args @default_args("None, None") def overwrite_zeir_checkpoint( dataset: Path, annot...
6f475b777608c4a6440be721a3cabb07e21a6c113dfc37f6999580bd39b03df3
Python
898
20
from typing import Any def __getattr__(name: str) -> Any: """Get attr name.""" if name == "create_spark_dataframe_agent": msg = ( "This agent has been moved to langchain_experimental. " "This agent relies on python REPL tool under the hood, so to use it " "safely pl...
96b32f528a15fccfba4c979745f64a153b65baafc11f363e31f6bffb8441a3a5
Python
898
30
from typing import TYPE_CHECKING, Any from langchain_classic._api import create_importer if TYPE_CHECKING: from langchain_community.vectorstores import MyScale, MyScaleSettings from langchain_community.vectorstores.myscale import MyScaleWithoutJSON # Create a way to dynamically look up deprecated imports. # ...
b6c39e619e76bd441d8281698f94d1f8731da2f44f1306185d337a4e637025af
Python
898
30
from typing import TYPE_CHECKING, Any from langchain_classic._api import create_importer if TYPE_CHECKING: from langchain_community.embeddings import ( AlephAlphaAsymmetricSemanticEmbedding, AlephAlphaSymmetricSemanticEmbedding, ) # Create a way to dynamically look up deprecated imports. # Us...
1cdadfc195682931eca4be529d0551ec7c2cb6d97d8a23e9f110e0eaf673de43
Python
899
30
from ChipseqReport import * # for trackers_derived_sets and trackers_master if not os.path.exists("conf.py"): raise IOError("could not find conf.py") exec(compile(open("conf.py").read(), "conf.py", 'exec')) class CountsTranscripts (TrackerSQL): mPattern = "transcripts" mAsTables = True def getSlice...
24053805a2ac2c1189be93219ed1311ee92c55974f3790af5942b9bc72edafb3
Python
899
32
import torch import numpy as np import argparse parser = argparse.ArgumentParser(description='') parser.add_argument('--save_dir', type=str, help='') args = parser.parse_args() write_path = f'<path to the generated sequences folder>/log.txt' path = f"../sample_output/vina_output/{args.save_dir}/qvina2_scores.pt" ...
2f13dbcb5614e65b8ecb8c4e0e320389655bece9db01c3f8b9aca8ab428da557
Python
899
23
# Python function that creates tall transformation matrices that project a heartbeat onto the phase domain. # In order for the model to work, the length of the heartbeats in the phase domain is always greater than the length of the heartbeats in the time domain # Inputs # N - the length of the heartbeat in time dom...
4c4fae692c027e7f009459ac611abf61ccef78af83741711458a6d76211d905e
Python
899
30
import pandas as pd import mne 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 / 'eeg').exists()] eeg_template_monta...
c0a69e0684c9404c7fdde5ba35b58ff35dbb8824678f65de8849aee292b84709
Python
899
27
import logging import os import sys import os.path as osp import time def setup_logger(name, save_dir, if_train): logger = logging.getLogger(name) logger.setLevel(logging.DEBUG) ch = logging.StreamHandler(stream=sys.stdout) ch.setLevel(logging.DEBUG) formatter = logging.Formatter("%(asctime)s %(nam...
69c9eaa8090507216367855214801d7fc2587bc8fe2060c3907401e85afc0278
Python
900
20
from typing import Any def __getattr__(name: str) -> Any: """Get attr name.""" if name == "create_pandas_dataframe_agent": msg = ( "This agent has been moved to langchain_experimental. " "This agent relies on python REPL tool under the hood, so to use it " "safely p...
d39c914dada96e7210065d67b4802e621877464cc825dc8a68e891249a4caed5
Python
900
29
import os # Build paths inside the project like this: os.path.join(BASE_DIR, ...) BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) def get_weights_path(weights_key): path = os.path.join(BASE_DIR, 'weights', weights_key + '.pt') return path def save_weights(reconstructor, weights_key, ...
83503f2cb7358cba9e94a3dfb951c519809144f1881216834753ceb49b4aa07e
Python
901
24
import os import sys from indoor3d_util import DATA_PATH, collect_point_label BASE_DIR = os.path.dirname(os.path.abspath(__file__)) ROOT_DIR = os.path.dirname(BASE_DIR) sys.path.append(BASE_DIR) anno_paths = [line.rstrip() for line in open(os.path.join(BASE_DIR, 'meta/anno_paths.txt'))] anno_paths = [os.path.join(DAT...
5982ecd125f37e2e27500d946826846791783fc896da8257723c06029f02cdd3
Python
903
30
from typing import TYPE_CHECKING, Any from langchain_classic._api import create_importer if TYPE_CHECKING: from langchain_community.embeddings import InfinityEmbeddings from langchain_community.embeddings.infinity import ( TinyAsyncOpenAIInfinityEmbeddingClient, ) # Create a way to dynamically lo...
5dace3d33dd1463b040078bfa809f6061340f2abd26eb6ecd67b9f60bf75dcf1
Python
903
32
from abc import ABC, abstractmethod from collections import OrderedDict import numpy as np from typing import Union, Mapping, Callable class ABCFeatures(ABC): """ """ def __init__( self, compute_basic_stats: Callable[[Union[list, np.ndarray]], ...
1edb506f30d07a1b44d00f9715b210ffa604dc6a44e4c783a955e9243f706ada
Python
904
29
from typing import TYPE_CHECKING, Any from langchain_classic._api import create_importer if TYPE_CHECKING: from langchain_community.agent_toolkits.sql.prompt import ( SQL_FUNCTIONS_SUFFIX, SQL_PREFIX, SQL_SUFFIX, ) # Create a way to dynamically look up deprecated imports. # Used to co...
4dad188a2be560cecb1093e5e473cc15a8cb488c35975dedbbd76948efe9a10c
Python
905
31
import torch def test_image_cache_len(mock_image_cache) -> None: assert len(mock_image_cache) == 3 def test_image_cache_contains(mock_image_cache) -> None: assert 1 in mock_image_cache assert 2 in mock_image_cache assert 3 in mock_image_cache assert 4 not in mock_image_cache def test_image_cac...
763ad31e20e98f7bdddf1e5f00f042d25fbec7b3f667ff193e7b6762df0bd833
Python
905
32
from typing import TYPE_CHECKING, Any from langchain_classic._api import create_importer if TYPE_CHECKING: from langchain_community.tools.dataforseo_api_search.tool import ( DataForSeoAPISearchResults, DataForSeoAPISearchRun, ) # Create a way to dynamically look up deprecated imports. # Used ...
88f7fdb9f1166e9453ff09a168a3ac01e5988e497956f6b204c655466612662d
Python
905
34
import pickle from config import conf from runner import Runner import torch runner = Runner(conf) known_binding_site = True node_temp = 0.5 dist_temp = 0.3 angle_temp = 0.4 torsion_temp = 1.0 min_atoms = 10 max_atoms = 45 focus_th = 0.5 contact_th = 0.5 num_gen = 100 # number generate for each reference rec-lig p...
d45234b7571d2c74684f0e607d60639e3ec6f3e92d7cb6d4c022032e617880c1
Python
905
34
from pathlib import Path import pytest # Getting the absolute path of the current file's directory ABS_PATH = Path(__file__).resolve().parent # Getting the absolute path of the project's root directory PROJECT_DIR = ABS_PATH.parent.parent # Loading the .env file if it exists def _load_env() -> None: dotenv_pat...
5276b65c1efad2db4a362d4dc0bd6aa923011ac14471489c43cdf8e17834d4fa
Python
906
29
"""Calculate depth based on the boarders of each barrel column""" import pandas as pd from tqdm import tqdm barrels_positions = pd.read_feather("../data/annotated_barrels.feather") barrels_names = barrels_positions.barrel.unique() barrels_layers = barrels_positions.layer.unique() depth_df = [] for barrel in tqdm(bar...
935836d8b16080a3a5a66a10e2f3fdba20a9188df5f744d4fbcac3593be4a1e6
Python
906
31
from setuptools import setup, find_packages __version__ = "0.0.1" setup( name="fetalxbrainxmultiomics", version=__version__, packages=find_packages(), install_requires=[ 'loompy', 'numpy', 'scikit-learn', 'seaborn', 'numba==0.51.0', 'deeplift', 'twobitreader', 'captum', ...
ea4662302df54bc91425e6994e9e591f2062b2bdda2c1814e3dfcdd91d4a9046
Python
906
33
import sys import os import subprocess import tempfile #Only execute inside IDE with rayx as root def checkForTerminal(): cwd = os.getcwd() TerminalApp_Path = 'build/bin/TerminalApp' path_to_terminal = 'build/bin/' test = os.path.join(cwd,TerminalApp_Path) return os.path.exists(test),test,path_t...
ef3e2771d68c7c22468bc6182a6aec0e48ce3485c19a0a3e1c523dc949dac825
Python
907
40
import math import torch def sinusoidal_encoding(v, N, D): # v: [*] # [D] k = torch.arange(1, D+1).to(v.device) # [*, D] sin_div_term = N ** (2 * k / D) sin_div_term = sin_div_term.view(*((1, ) * len(v.shape) + (len(sin_div_term), ))) sin_enc = torch.sin(v.unsqueeze(-1) * math.pi / sin_div_term) # [*, D] ...
dae79b3d629ec70cabace950b66528bd44b640408420eb4f803298261cfd65d1
Python
908
30
from typing import TYPE_CHECKING, Any from langchain_classic._api import create_importer if TYPE_CHECKING: from langchain_community.embeddings import SagemakerEndpointEmbeddings from langchain_community.embeddings.sagemaker_endpoint import ( EmbeddingsContentHandler, ) # Create a way to dynamical...
f9d06790fa193bf4552b7a95456ea5aafcd9a7781b58c0f63a09a24f45187a52
Python
908
30
import torch import torch.nn as nn def get_activation(activation): if activation == "CReLU": return complexReLU() if activation == "modReLU": return modReLU() if activation == "zReLU": return zReLU() raise ValueError(f"Activation {activation} not recognized") class modReLU(nn.M...
072aa82c676f5bda539a43b2569d7847ecc517622cdb786bf75b7ac95b973740
Python
909
25
import os from langchain_core.prompts import ChatPromptTemplate from langchain_classic import hub def test_hub_pull_public_prompt() -> None: prompt = hub.pull("efriis/my-first-prompt") assert isinstance(prompt, ChatPromptTemplate) assert prompt.metadata is not None assert prompt.metadata["lc_hub_own...
1f31f199b0e627710dc6c9d2c8aa81ceeafebf7df2ccc9f87682d4d9a6778da9
Python
909
17
# Python function that computes the optimal Tau (i.e. number of samples of the beats in the phase space) # For every beat in time domain the region between the starting point and the corresponding R-peak is consdiered, and the maximum is selected; same for the region between the R-peak and the ending point; the sum is ...
31156f230482945afcd8a418373e1522729deb3eb348163191aec99efa6b59f8
Python
911
33
import os import tempfile import pytest import chroma import chroma.utility.api as api from chroma.models.graph_backbone import GraphBackbone from chroma.utility.model import load_model KEY_PATH = os.path.dirname(os.path.dirname(chroma.__file__)) KEY_PATH = os.path.join(KEY_PATH, "config.json") @pytest.mark.skipif...
d22885b7fc1038478193d4bf15cf86f30770ae98b93431e444066a37c6f71a5b
Python
911
30
"""Script to check if python modules can be imported.""" import random import string import sys import traceback from importlib.machinery import SourceFileLoader from importlib.util import module_from_spec, spec_from_loader if __name__ == "__main__": files = sys.argv[1:] has_failure = False for file in fi...
32cf547236ab1147581aef695270ed94771038b3b0a7e9e1b22ad512a673a454
Python
913
33
""" Combine parquet files into one. This uses with to reduce memory by only needing to load one files at a time. """ import argparse import session_info import pandas as pd from pathlib import Path def combine_files(output, label): data_dir = Path(output+"/") with open("%s.sex_interaction.txt" % label, "a+") a...
35eb8072ee4caa7a5e3d84438149ddb54b960f049b2460f353e2e9e8e5eb41f2
Python
913
25
import sys sys.path.append('../source') from matplotlib import pyplot as plt # for visualisation of imagedata import networkx as nx import tinaui plt.ion() # if only networks will be used load_imagedata can be set False t2 = tinaui.load_status(folder='../test/sampledata/ocn', load_imagedata=True) plt.imshow(t2.imgdic...
ef9ba8e6118133026f9a7145d74ce01e537d495c4d5ba82ee18df18b78c1c787
Python
913
32
from typing import TYPE_CHECKING, Any from langchain_classic._api import create_importer if TYPE_CHECKING: from langchain_community.tools import O365CreateDraftMessage from langchain_community.tools.office365.create_draft_message import ( CreateDraftMessageSchema, ) # Create a way to dynamically ...
f34b82bdea3a697b174be843994755269a386ce48244ad4ec6deb60709b5df95
Python
913
33
from typing import TYPE_CHECKING, Any from langchain_classic._api import create_importer if TYPE_CHECKING: from langchain_community.document_loaders import ( GoogleApiClient, GoogleApiYoutubeLoader, YoutubeLoader, ) # Create a way to dynamically look up deprecated imports. # Used to c...
7c3728d26ad5182a45b0cd17322f2b57cd5e268e864ef7180edc28584f13e433
Python
914
35
"""DEPRECATED: Kept for backwards compatibility.""" from typing import TYPE_CHECKING, Any from langchain_classic._api import create_importer if TYPE_CHECKING: from langchain_community.utilities import ( Requests, RequestsWrapper, TextRequestsWrapper, ) # Create a way to dynamically l...
a2cbee16c38b65b5435a564d09f2ae02fa8c2a98eb0d424fcce887f604b45cd1
Python
914
30
"""Amadeus tools.""" from typing import TYPE_CHECKING, Any from langchain_classic._api import create_importer if TYPE_CHECKING: from langchain_community.tools.amadeus.closest_airport import AmadeusClosestAirport from langchain_community.tools.amadeus.flight_search import AmadeusFlightSearch # Create a way t...
b054f285885e2e8a83a0d5652bdd7f4ab6042da9c25d4505e46b53f99cc6cb5e
Python
914
40
#!/usr/bin/env python import os import sys from Bio.PDB import PDBParser, PDBIO from Bio.PDB.Model import Model available_chain_ids = list("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz") parser = PDBParser(QUIET=True) io = PDBIO() # load the structure structure = parser.get_structure("", sys.argv[1]) ent = os...
d88812f613cf3f6da7e4ccb629536ccbdeaac4723ec8c7826ec147bde43dfdc7
Python
914
32
from typing import TYPE_CHECKING, Any from langchain_classic._api import create_importer if TYPE_CHECKING: from langchain_community.tools import ExtractHyperlinksTool from langchain_community.tools.playwright.extract_hyperlinks import ( ExtractHyperlinksToolInput, ) # Create a way to dynamically ...
12838f83998042f332d20f67799d312fe61e6888c084d1923d42db99a7f83e64
Python
915
36
# 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 RLS(x,d,p,lamb,delta): x = np.transpose(x) d = np.transpose(d) T = len(x) ...
53b8e8419d58b8867081a76d5ded7316298ecee03fb93a15d09eebf5f77862b4
Python
915
28
"""**Graphs** provide a natural language interface to graph databases.""" from typing import TYPE_CHECKING, Any from langchain_classic._api import create_importer if TYPE_CHECKING: from langchain_community.graphs.index_creator import GraphIndexCreator from langchain_community.graphs.networkx_graph import Net...
65a272feeb52d78dd311714cbcd0e8a3d2aa09ca24adc9fca2da5f7a5989876c
Python
915
44
from langchain_classic.schema import __all__ EXPECTED_ALL = [ "BaseCache", "BaseMemory", "BaseStore", "AgentFinish", "AgentAction", "Document", "BaseChatMessageHistory", "BaseDocumentTransformer", "BaseMessage", "ChatMessage", "FunctionMessage", "HumanMessage", "AIMe...
a3ac82321642431e259c09cf8ede9723fdf5880d19fc7f2fe5fb71474f352ba2
Python
915
32
import argparse def main(): parser = argparse.ArgumentParser() parser.add_argument('--old_listfile', type=str, required=True) parser.add_argument('--new_listfile', type=str, required=True) parser.add_argument('--sort', dest='sort', action='store_true') parser.set_defaults(sort=False) args = pa...
a1b395b9a1e736f30f9d2a6ed583758c7ac114cbe854c820b8d5cd4233b7784a
Python
916
24
from typing import Optional from typing import Tuple import numpy as np from numpy.typing import NDArray def get_train_val_split(n: int, train_frac: float, seed: Optional[int] = None) -> Tuple[NDArray, NDArray]: """ Splits the total number of images into train and test set. This ensures that in every ses...
ee05fd97780c96aa8e1b8dcb557c1115bed47a16d5c1e40921002d10c20c2718
Python
917
29
from typing import TYPE_CHECKING, Any from langchain_classic._api import create_importer if TYPE_CHECKING: from langchain_community.agent_toolkits.openapi.prompt import ( DESCRIPTION, OPENAPI_PREFIX, OPENAPI_SUFFIX, ) # Create a way to dynamically look up deprecated imports. # Used to...
32ccf1476764fa180bd403e8a9055483e72dee5b3e57f1b44ae8979989ba1684
Python
921
28
from langchain_core.prompts.prompt import PromptTemplate from langchain_classic.memory.prompt import ( ENTITY_EXTRACTION_PROMPT, ENTITY_MEMORY_CONVERSATION_TEMPLATE, ENTITY_SUMMARIZATION_PROMPT, KNOWLEDGE_TRIPLE_EXTRACTION_PROMPT, SUMMARY_PROMPT, ) DEFAULT_TEMPLATE = """The following is a friendly...
6b8d2ecca8f4639a5c64216aa0ba85f88b7cb8cf7b98d611bd3e259489f6f682
Python
921
33
from typing import TYPE_CHECKING, Any from langchain_classic._api import create_importer if TYPE_CHECKING: from langchain_community.tools.tavily_search.tool import ( TavilyAnswer, TavilyInput, TavilySearchResults, ) # Create a way to dynamically look up deprecated imports. # Used to c...
5b2eaa2e148803ad3643c7a56079043162d4f68de9f1f300fe6f63d153f1d266
Python
922
36
"""Run the two guarded MCP servers the graph factory talks to. `graph_factory.py` points `SERVERS` at fixed ports; this starts a server on each. Both verify tokens against the shared keypair (`MCP_DEMO_KEYFILE`), the same one `langgraph dev` mints with, so a token minted in the factory process validates here. MCP...
d383edbc79ef6d9d33eb9381e32052eb899988360d53d829e3f7873536c49edf
Python
922
28
#!/usr/bin/env python3 import os import sys def run(command, condition, message): if condition: return 0 print(message, file = sys.stderr) return os.system(command) def main(): return sum([ run( f"twoBitToFa /usr/local/genome/hg38.2bit {sys.argv[1]}/hg38.fa", os.path.e...
00da1005a8a4e38d3601d71abd8722f1e75d55c89afd30f6212d9abb182a55af
Python
923
23
# third party modules import torch def processBatch(device, batch, xtras=None): batch_data = {} if isinstance(batch, list): batch_data['train_mask'] = torch.cat([data.train_mask for data in batch]).to(device) batch_data['test_mask'] = torch.cat([data.test_mask for data in batch]).to(device) ...
dfbac8915cb0bee50ee7bd21e971e0aff20102ca5896ed49feea015a56f44ca8
Python
923
32
#!/usr/bin/env python import os import tempfile import requests import bz2 from ..constants.constants import HAPMAP3_SNPS_URL class HapMap3SNPs: @classmethod def fromBroad(cls, withoutHeader = False): return cls(bz2.decompress(requests.get(HAPMAP3_SNPS_URL).content).decode(), withoutHeader = without...
bcf2f225cdf154e3e258bf87529be9c533387001bda7dbb0e787dcec772d736b
Python
924
29
import logging import platform import socket # print('__file__={0:<35} | __name__={1:<20} | __package__={2:<20}'.format(__file__,__name__,str(__package__))) # Defaults GIT_REPO_NAME="STEP" LOGGING_LEVEL = logging.INFO EXTERNAL_LOGGING_LEVEL = logging.ERROR home_base_dir = "~/git/" + GIT_REPO_NAME BASE_DATA_DIR = ho...
9040a6de1b6e556d559304e6da6ec82e839aabe97073645720e989671bc269b8
Python
925
32
from pycromanager import JavaBackendAcquisition, multi_d_acquisition_events, start_headless, ZMQRemoteMMCoreJ import threading def snap_image(): while True: core = ZMQRemoteMMCoreJ() try: core.snap_image() image = core.get_tagged_image() except Exception as e: ...
215c8d1102b42dc4adbdff494f21dfad8147ec021f040eb237abb6231ae60fb8
Python
926
28
import setuptools with open("README.md", "r") as fh: long_description = fh.read() setuptools.setup( install_requires=[ "numpy>=1.18.5,<=1.19.5", "mpmath>=1.1.0", "pandas>=0.24.2,<=1.1.5", "patsy==0.5.1" ], name="combat", version="0.3.2", author="Abdelkader Behde...
d312208e4c53a14b4885d93a2c896c8ddb3a8124af5ed195515f510233ec603b
Python
926
25
import random from animalai.envs.environment import AnimalAIEnvironment from animalai.envs.arena_config import ArenaConfig from gym_unity.envs import UnityToGymWrapper def load_env(config_file, args, training = True): return AnimalAIEnvironment( file_name = 'env/AnimalAI', base_port = 5005 + rando...
dafa7aeb43ac068a63c76b72d8f20bb6b74f12194a2c1134442c94c149946c98
Python
926
27
# -- coding: utf-8 -- # @Time : 2023/3/6 19:55 # @Author : Biao Zhang # @Email : littlebiao@outlook.com # @File : get_human_acronym_color.py # @Description: This file is used to ... import pandas as pd if __name__ == '__main__': human_structure_df = pd.read_csv('./human_query.csv') name_list = human_structure...
e698273b576c10149e32aeac16f39063f995d3e1aa96f2fc561e86b643a081e3
Python
926
32
from typing import TYPE_CHECKING, Any from langchain_classic._api import create_importer if TYPE_CHECKING: from langchain_community.utils.math import ( cosine_similarity, cosine_similarity_top_k, ) # Create a way to dynamically look up deprecated imports. # Used to consolidate logic for raisi...
3c9f3664b2c2df1b8655852ebb72c66c29ad823ddd10b9426139ac401317eecd
Python
927
22
from openbabel.pybel import readfile,Outputfile import os def MolFormatConversion(input_file,output_file,input_format="mol2",output_format="smi"): molecules = readfile(input_format,input_file) output_file_writer = Outputfile(output_format,output_file, overwrite=True) for i,molecule in enumerate(molec...
d10d379179d4cc8eefef9d4d6055fb2d500525a7974ba80f97090f4342a90b5e
Python
927
28
from models.lstm import LSTMParams, get_model from utils.io import load_data_as_tensorflow_datasets import tensorflow as tf TRAIN_SAMPLES = 64 for i in range(4): model = get_model() model_params = LSTMParams(f"DUMMY_{i}") train_spectra = tf.random.normal((TRAIN_SAMPLES, 41, 1)) train_oxy = tf.random.n...
e4aba52170ea78648c4f60466438e1a34f186761f1f27a2679d6a73b4ba3123b
Python
930
32
""" Usage: python3 scripts/validate_jsons.py input_json/test3/set3_rnaseq.json input_json/test4/test_batchac_rnaseq.json """ import argparse import json def main(): parser = argparse.ArgumentParser(description="script to compare and validate json files") parser.add_argument("infile1", type=str, he...
685e4ac7526babb61779ce6c97cefbe857e7c26aea1acbcd1365c90707f89d35
Python
932
30
import numpy as np import pandas as pd import pytest from imagingplus import TwoPhotonImaging import imagingplus as pli from imagingplus.processing import anndata from conftest import anndata_trial_data, existing_trialobj_alloptical_fixture def test_AnnotatedData(existing_trialobj_alloptical_fixture): aotrial =...
7c788052034f8a4c631818c392ba28d12d1229fc42e285aebcfc47e6376f6580
Python
932
35
from langchain_classic.callbacks.manager import __all__ EXPECTED_ALL = [ "BaseRunManager", "RunManager", "ParentRunManager", "AsyncRunManager", "AsyncParentRunManager", "CallbackManagerForLLMRun", "AsyncCallbackManagerForLLMRun", "CallbackManagerForChainRun", "AsyncCallbackManagerFo...
18414027976e2918ff0d8202776de9c8b5a1d0f59c0fb6ddb426c844a5edf308
Python
933
29
from typing import TYPE_CHECKING, Any from langchain_classic._api import create_importer if TYPE_CHECKING: from langchain_community.chains.graph_qa.falkordb import ( INTERMEDIATE_STEPS_KEY, FalkorDBQAChain, extract_cypher, ) # Create a way to dynamically look up deprecated imports. # ...
bc583ca5aa4fc74d6147627bfcb5ae81765c14c1fb19d181dd002f9f7e5717d7
Python
933
23
from networks.unet_3D import unet_3D from networks.vnet import VNet from networks.VoxResNet import VoxResNet from networks.attention_unet import Attention_UNet from networks.nnunet import initialize_network def net_factory_3d(net_type="unet_3D", in_chns=1, class_num=2): if net_type == "unet_3D": net = une...
cc96f57bfb0014ccf6ec7a85e6fa2d89a5f52ea1bb6f62b2390a8489882dbd64
Python
933
45
import torch import torch.nn as nn import torch.nn.functional as F from bindsnet.conversion import ann_to_snn class FullyConnectedNetwork(nn.Module): # language=rst """ Simply fully-connected network implemented in PyTorch. """ def __init__(self): super(FullyConnectedNetwork, self).__ini...
67d37bd87e1d563db433d70f2b6d53ef2f4ab2d12b4e77e813619868a1cd0927
Python
934
27
from torch import nn class Shifter(nn.Module): """ Abstract base class for a shifter. It's strongly adviced that the regularizer and initialize methods are implemented by the inheriting class. """ def __repr__(self): s = super().__repr__() s += " [{} regularizers: ".format(self.__clas...
7a870ad85ee859889806ba12750225282788d88988d3508168aaf1cd20323c65
Python
934
30
import numpy as np def shape_data(data): timestamps = [] activeneurons = [] neuron = data[:,1] neuron_list = np.unique(data[:,1]) for k in range(len(neuron_list)): index = np.where(neuron == neuron_list [k])[0] if len(index) >= 2 : # C...
1151d2a396d571e0bdb9b3c8ae072552649cf112202ce4baa7830487cc97b89b
Python
935
35
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Mon Dec 19 17:15:11 2022 @author: biener """ import torch import sys import numpy as np from NN_Rslt_Anal import NN_Rslt_Anal as Ana Ana_O = Ana() for ii in range(1,len(sys.argv)): curVar = sys.argv[ii] if '.inp' in curVar: TS_fName = cur...
22b015b711c5c39e53965bd3edc1bd27e6408120aeb54cc293ab391e6f51f4d9
Python
935
31
"""Contains tests for the Conv2D-layer LRP implementations""" import numpy as np from tensorflow.keras.initializers import Constant from tensorflow.keras import Model from tensorflow.keras.layers import BatchNormalization, Input from explainability.layers import BatchNormalizationLRP def test_batchnormalization_lr...
2a08d9e5aab72d00566f8d0c53a2f0fdac8b801f4c6a9fdbfadf13ac506338e6
Python
936
34
"""DataForSeo API Toolkit.""" from typing import TYPE_CHECKING, Any from langchain_classic._api import create_importer if TYPE_CHECKING: from langchain_community.tools.dataforseo_api_search.tool import ( DataForSeoAPISearchResults, DataForSeoAPISearchRun, ) # Create a way to dynamically look...
41a79392903ae3a27790838f43c5ce0ca965f6a9a8bd2c7ff52519adc64e930c
Python
936
24
# write output file def dump(output_file_name, time, number_of_atoms, dimensions, configurations): output_file = open(output_file_name, 'a') output_file.write("ITEM: TIMESTEP\n") output_file.write(str(time) + "\n") output_file.write("ITEM: NUMBER OF ATOMS\n") output_file.write(str(number_of_atoms...
fb5c4805ddc817bf9109c7933644564cb43754a471994a5c71ed9fd642688b31
Python
936
39
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Mon Apr 24 00:48:43 2023 @author: weihan """ from torch import nn class DeepNeuralNetworks(nn.Module): def __init__(self, col, D): super().__init__() self.encoder = nn.Sequential( nn.Linear(col, 2048), nn.Tanh()...
05ed0b479846ef23d2c810ce3de8bbe4fc38f6740c9004e63665bb3dd7da79b6
Python
937
32
from typing import TYPE_CHECKING, Any from langchain_classic._api import create_importer if TYPE_CHECKING: from langchain_community.document_transformers import OpenAIMetadataTagger from langchain_community.document_transformers.openai_functions import ( create_metadata_tagger, ) # Create a way t...
60a549e9ef859b32763622a8ae477c70dabb7c687bc9e874053217450722cf3c
Python
937
27
import matplotlib from Articles.Sequential_Learning_Striatum.Figures.cfg_color import colors, cm matplotlib.rcParams['font.size'] = 8 matplotlib.rcParams['text.usetex'] = False matplotlib.rcParams['svg.fonttype'] = 'none' matplotlib.rcParams['lines.linewidth'] = 0.5 matplotlib.rcParams['axes.linewidth'] = 1. # set ti...
53c05e3e7b050351a7f5ba1d915b6df4af714f4491c9683b8e5782dcd9ab5253
Python
938
35
from qtpy.QtWidgets import QDialog, QDialogButtonBox, QVBoxLayout, QLabel, QPushButton from qtpy.QtCore import Qt class DemoDialog(QDialog): def __init__(self, parent=None): super().__init__(parent) self.case = 0 self.setWindowTitle("Choose the image type") b1 = QPushButton("2D") ...
7309dd4f2ac1167c118502168b985c548141e024ffec63ad2579744f1b177578
Python
938
30
import torch from torch import Tensor def get_angle(v1: Tensor, v2: Tensor) -> Tensor: return torch.atan2( torch.cross(v1, v2, dim=1).norm(p=2, dim=1), (v1 * v2).sum(dim=1)) def edge_pair_features( edge_index: Tensor, pos: Tensor, normal: Tensor, faces: Optional[Tensor] = N...
4eb75ac1358eb8ac8cacb96554df59b898ceaefbb4d8fd09743fbc5cbe7e469d
Python
939
27
import parmed import tempfile import os import shutil # Get the paths to the gaff.dat and leaprc files: leaprc_path = os.path.join(os.getenv("CONDA_PREFIX"), 'dat', 'leap', 'cmd', 'leaprc.gaff') gaffdat_path = os.path.join(os.getenv("CONDA_PREFIX"), 'dat', 'leap', 'parm', 'gaff.dat') # Make a temporary directory (oth...
fa7ae26bacd4d290b8df11d3b50cecd4b52d58fecea80a83273b6398dace3b06
Python
939
25
import pandas as pd import os from tqdm import tqdm df_artemis = pd.read_csv(os.path.join('./data/artemis_index', 'artemis_dataset_release_v0.csv')) for split in ['train','val','test']: print('Processing', split, 'set...') df = pd.read_json(os.path.join('./data/artemis_index', split + '_index.json')) df_0...
54071f8939a0aea8f48f0346fef052842f8039c0e4b17baf68ae3dd3ba4ffa5d
Python
941
30
#!/usr/bin/env python from .get_atom_kdtree import getAtomKDTree def pruneStructure(structure, target_chains, threshold=30.0, size_limit=45000): target_atoms = [] prune_chains = [] total_size = 0 for chain in structure.get_chains(): for residue in chain: total_size += len(residue) ...
a8b11a9738e58c563e14190685753df36bfcbfd51fd2da4310263e8f8f84185d
Python
941
26
from django import forms from django.forms import ModelForm from .models import Analysis class PsthAnalysisForm(ModelForm): trial_type = forms.CharField( max_length=15, widget=forms.Select(choices=Analysis.TRIAL_TYPES), required=True, ) unit_type = forms.CharField( max_len...
6fd8e13b75bdc8b382612b1f39d0fe8b75ddf2dd9edd4cb2f0e4a2dced4aa9cc
Python
943
32
from typing import TYPE_CHECKING, Any from langchain_classic._api import create_importer if TYPE_CHECKING: from langchain_community.tools import AIPluginTool from langchain_community.tools.plugin import AIPlugin, AIPluginToolSchema, ApiConfig # Create a way to dynamically look up deprecated imports. # Used t...
bfb2e2e1a84f7bec4df599a12ca560ee0cff3d006b7c0a756eee462924cfeb86
Python
943
26
from langchain_core.agents import AgentAction from langchain_core.messages import AIMessage, BaseMessage, HumanMessage def format_log_to_messages( intermediate_steps: list[tuple[AgentAction, str]], template_tool_response: str = "{observation}", ) -> list[BaseMessage]: """Construct the scratchpad that lets...
5abe627902e4aeac2fd0fcb96d4fa6dbfb11d8f593ebe1966a65dd4588f352db
Python
945
33
import os import sys import re import types import itertools import matplotlib.pyplot as plt import numpy import numpy.ma import Stats import Histogram from cpgReport import * from cgatReport.Tracker import * from cgatReport.odict import OrderedDict as odict ############################################################...
8f55eca649244b02f824b5d9001c52babd0b9c0475cab9fd137038ba7e791209
Python
945
30
"""Test Base Schema of documents.""" from collections.abc import Iterator from langchain_core.document_loaders import BaseBlobParser, Blob from langchain_core.documents import Document from typing_extensions import override def test_base_blob_parser() -> None: """Verify that the eager method is hooked up to the...
fdf1ee9ffdfdaa6a466e55741c898c947d7cca3efe706950bcfcd7f85c1d6661
Python
945
30
from LSTM import preprocess, train, predict, evaluate import os from utils import * setting = { 'train_size': 0.8, 'epochs': 100, 'input_size': 60, 'batch_size': 32, 'pre_len': 1, 'fileName': "o1_i1800s_w10_s1_fmean", 'model_name': 'lstm', 'ch...