sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
75d72a409759ed1ec8827dee13faefe468116c1ff48fddc1a3768d5a9d615820
Python
707
25
from typing import TYPE_CHECKING, Any from langchain_classic._api import create_importer if TYPE_CHECKING: from langchain_community.chat_message_histories import CassandraChatMessageHistory # Create a way to dynamically look up deprecated imports. # Used to consolidate logic for raising deprecation warnings and ...
e4ecbcb1597e7c349fcd1e9213269860d4793af03a2505d953bf03cb846d0936
Python
707
25
from typing import TYPE_CHECKING, Any from langchain_classic._api import create_importer if TYPE_CHECKING: from langchain_community.document_loaders import AzureBlobStorageContainerLoader # Create a way to dynamically look up deprecated imports. # Used to consolidate logic for raising deprecation warnings and # ...
ed08cf24968a5dbf3ad46f7742af9c5237fefbc708bf9dc14a755bce9bb0b706
Python
707
19
from langchain_core.prompts.prompt import PromptTemplate _template = """Given the following conversation and a follow up question, rephrase the follow up question to be a standalone question. Chat History: {chat_history} Follow Up Input: {question} Standalone question:""" # noqa: E501 CONDENSE_QUESTION_PROMPT = Prom...
f671ece8f4a129ff44a1712ae9e1a1945b7394820bb2d73d3045a543ba278c61
Python
707
25
from typing import TYPE_CHECKING, Any from langchain_classic._api import create_importer if TYPE_CHECKING: from langchain_community.chat_message_histories import FirestoreChatMessageHistory # Create a way to dynamically look up deprecated imports. # Used to consolidate logic for raising deprecation warnings and ...
4b160e7cfaceb3d4a4308e29893fa73eca33d58c1640cd6f7177fb2764c67e32
Python
708
19
import numpy as np from pycromanager import JavaBackendAcquisition, multi_d_acquisition_events with JavaBackendAcquisition("/Users/henrypinkard/tmp", "l_axis") as acq: # create one event for the image at each z-slice events = [] for time in range(5): for index, z_um in enumerate(np.arange(start=0,...
3bada76fd842d28485b8c310722c734586089ad205670be18503e824fe116c62
Python
710
23
import math import torch def get_betas(n_timestep, schedule): if schedule == 'linear': return linear_beta_schedule(n_timestep) elif schedule == 'cosine': return cosine_beta_schedule(n_timestep) else: print('Invalid schedule: {}'.format(schedule)) exit(0) def linear_beta_schedule(n_timestep, start=0.0001, ...
5134dde056cb0b826d21d41f3af85fd2f8533bea01d7e5f8100e5dc1cda71c53
Python
710
31
from langchain_classic.schema.runnable.utils import __all__ EXPECTED_ALL = [ "AddableDict", "ConfigurableField", "ConfigurableFieldMultiOption", "ConfigurableFieldSingleOption", "ConfigurableFieldSpec", "GetLambdaSource", "IsFunctionArgDict", "IsLocalDict", "SupportsAdd", "aadd"...
997f12a5f6c51f125d137179fb11bf2759b95ed353ad515071a5cb3a4f7e5a49
Python
710
25
from typing import TYPE_CHECKING, Any from langchain_classic._api import create_importer if TYPE_CHECKING: from langchain_community.chat_models.meta import convert_messages_to_prompt_llama # Create a way to dynamically look up deprecated imports. # Used to consolidate logic for raising deprecation warnings and #...
baef44f0ceab054f1faa6d086f716f5a00790f945f511ad94e0733f2218082b9
Python
710
24
import numpy as np from pycromanager import multi_d_acquisition_events, JavaBackendAcquisition # Version 1: def img_process_fn(image, metadata): image[250:350, 100:300] = np.random.randint(0, 4999) # raise Exception() return image, metadata with JavaBackendAcquisition( directory=r"C:\Users\henry\Deskt...
2ac57f5e901e35d4e76230276f2c44ecf53ee3b7b95a40d34dc46fb0669e40ea
Python
711
37
from bindsnet.encoding.encodings import bernoulli, poisson, rank_order, repeat, single from bindsnet.encoding.loaders import ( bernoulli_loader, poisson_loader, rank_order_loader, ) from .encoders import ( BernoulliEncoder, Encoder, NullEncoder, PoissonEncoder, RankOrderEncoder, Rep...
90268eab410505b4e60ddb4cec51eb542c98618ecf05e0ae47d2fff94984c45e
Python
711
24
# third party modules import torch # pnabind modules from pnabind.nn import processBatch def classWeights(data, nc, device='cpu', use_mask=True): if isinstance(data, torch.Tensor): # a tensor of class labels weight = data.shape[0]/(nc*torch.eye(nc)[data].sum(axis=0)) else: # a dataload...
ded6be5f9cc33c93eb44493a3059becb63d116bfb744cdae09a3d162dfbcfd5a
Python
711
28
from sys import argv, exit import pandas as pd """ Add TPM values from lines with same 'Gene_Name' """ # all_genes_human_protein_atlas_rna_expression_tpm.tsv.tmp input_file = argv[1] df = pd.read_csv(input_file, sep='\t') print(df.head()) target_col = 'ProteinAtlas_RNA_expression_TMP' dupl_genes = ['ARL14EPL', '...
321d0333f6502fb82ad7dc511d35cfd277cadb57eccfd06c316b74222a098ff4
Python
712
20
from .darknet import Darknet from .detectors_resnet import DetectoRS_ResNet from .detectors_resnext import DetectoRS_ResNeXt from .hourglass import HourglassNet from .hrnet import HRNet from .regnet import RegNet from .res2net import Res2Net from .resnest import ResNeSt from .resnet import ResNet, ResNetV1d from .resne...
5aaa9d318f1a1a1bbfdb32911b15b7b67c4aad3130433a511ff19ac0e3e11ce5
Python
713
20
"""Generate the upstream xxd-compatible embedded help arrays without xxd.""" from pathlib import Path import re import sys def generate(source, destination): source, destination = Path(source), Path(destination) data = source.read_bytes() symbol = re.sub(r'[^A-Za-z0-9_]', '_', source.name) rows = [', ...
ed8602f46c235f516f8cf12b1ab2c9798aab58fe89b46406d42fdece08503b40
Python
713
21
import contextlib import joblib # From https://stackoverflow.com/a/61689175 @contextlib.contextmanager def tqdm_joblib(tqdm_object): """Context manager to patch joblib to report into tqdm progress bar given as argument""" def tqdm_print_progress(self): if self.n_completed_tasks > tqdm_object.n: ...
fcb70991b09df15c9448a0421dc12d0b73e9f00c7997a7d56ee9b4a7d62a37b8
Python
715
27
""" Generate a movie from atom-by-atom proposal PMF and placement PDB files. Run with `run movie.py` in PyMOL """ iteration = 6 from pymol import cmd, movie #cmd.mclear() #cmd.mset('1') cmd.set('sphere_scale', 0.02) cmd.rewind() cmd.delete('all') cmd.load('geometry-%d-forward-proposal.pdb' % iteration) cmd.hide('all'...
00575a29aab9e8edc152fd51a8bd19d62feda639a5d13eb370427edda8a3427a
Python
716
19
import numpy as np def getAtomKDTree(atoms, engine='scipy'): # check if we're passed a list of atom objects or a higher level entity if not isinstance(atoms, list): atoms = [atom for atom in atoms.get_atoms()] # check which KDTree we want to construct. These have non-equilvalent methods if...
12f6d8cb406f01f941d70e00a38f8d6931d2e1cdba22076a4cce2389ab5744b6
Python
716
25
import numpy as np import scipy.sparse as sp import torch def normalize(mx): """Row-normalize sparse matrix""" rowsum = np.array(mx.sum(1)) r_inv = np.power(rowsum, -1).flatten() r_inv[np.isinf(r_inv)] = 0. r_mat_inv = sp.diags(r_inv) mx = r_mat_inv.dot(mx) return mx def sparse_mx_to_tor...
70fd7f2f4dd2340a4773260838cfe0d66a2f11766bd1ad208551356fe59e8d1c
Python
716
24
from pipeline_functions import * def main(): # Create synthetic dataset with 2 longitudinal views data, y = synthetic_data(eps=0.75, eta=0.75, plots=True) # Perform variable selection using method = 'LMM', 'DGB', 'JPTA' or 'nothing' data = variable_selection(data, y, method='LMM', top_fea...
933dc548c155357c339aa0e9645eec78ea49c2e0fcfd84f2d37f620bf30ae82a
Python
716
22
import torch from .rk_common import _ButcherTableau, RKAdaptiveStepsizeODESolver _BOGACKI_SHAMPINE_TABLEAU = _ButcherTableau( alpha=torch.tensor([1/2, 3/4, 1.], dtype=torch.float64), beta=[ torch.tensor([1/2], dtype=torch.float64), torch.tensor([0., 3/4], dtype=torch.float64), torch.t...
bd6a12ebb263c3916cd2580e42418c5d5b9def79f1812aa3e2efdb0f26c1b2ca
Python
716
25
import numpy as np import copy class inputClass: parameters = {} def __init__(self, neuronInstance, I_value, noise=None): self.neurons = neuronInstance self.noise = noise self.I_value = I_value self.current_I_input = I_value self.neurons.input.append(self) def subc...
182dda74fea011ddee23080571c363993024a90c56dd9eb7af2a81df45bf887b
Python
717
27
from typing import TYPE_CHECKING, Any from langchain_classic._api import create_importer if TYPE_CHECKING: from langchain_community.llms import VertexAI, VertexAIModelGarden # Create a way to dynamically look up deprecated imports. # Used to consolidate logic for raising deprecation warnings and # handling optio...
4bbe8254044f448416130f6afec70037d4d52dd5ea627af4eb1775a825dcf6a2
Python
717
26
import os import importlib from typing import List def open_txt_file(file_path: str) -> List[str]: ret = [] with open(file_path, "r") as f: ret = f.readlines() ret = [s.strip("\n") for s in ret] return ret def list_subdir(path: str): return sorted([folder for folder in os.listdir(path) i...
e26ddc9448786636f8acc52468e67ca7142d285ad8f6633d94ba430a49a09113
Python
717
27
""" openforcefields.py This module only contains the function that will be the entry point that will be used by the openforcefield toolkit to find the installed forcefield files. """ from importlib.resources import files def get_forcefield_dirs_paths() -> list[str]: """ Return the paths to the directories ...
24e2334a9b032056c11b3ab58f08db7a7ac081498a30b3a443bd411654447c33
Python
718
27
from typing import TYPE_CHECKING, Any from langchain_classic._api import create_importer if TYPE_CHECKING: from langchain_community.document_compressors.flashrank_rerank import ( FlashrankRerank, ) # Create a way to dynamically look up deprecated imports. # Used to consolidate logic for raising depre...
4de8bfc113b0779097467ec3b9282221e3f2bc293015083db212d9f5bca2ee7f
Python
718
17
import pandas as pd from tqdm import tqdm df_encode_meta = pd.read_csv('../data/ENCODE/metadata.tsv', sep='\t') df_encode_meta = df_encode_meta[df_encode_meta['Output type'] == 'methylation state at CpG'] for pos,row in tqdm(df_encode_meta.iterrows(), total=df_encode_meta.shape[0]): f_enc = '../data/ENCODE/{}.bed...
5d386d5e795af89ff0d48ec74168dfd0d638266eabdea3a3a7bb5b53870e3a02
Python
718
15
from setuptools import setup from predmoter.core.constants import PREDMOTER_VERSION setup( name="predmoter", version=PREDMOTER_VERSION, author="Felicitas Kindel", url="https://github.com/weberlab-hhu/Predmoter", description="Deep Learning model predicting ATAC- and ChIP-seq data", packages=["predmote...
c10b09df53e9027b2c7df9e0eced9c81650b4c344a529c7a7aabcf639d76872a
Python
718
22
import pandas as pd import re import sys input_file = 'InBio_Map_core_2016_09_12/core.psimitab' df = pd.read_csv(input_file, sep='\t', header=None) #, nrows=4000) # drop rows where only one gene is provided - no interaction can be captured df.dropna(subset=[4], inplace=True) df.dropna(subset=[5], inplace=True) cols...
c87ede8acb18bbe715c0c799153f3a9f1886bec1d646b93e47df39e46ded2b54
Python
718
25
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Tue Dec 20 23:37:56 2022 @author: biener """ import numpy as np import mAECell_Utils as utils #%% selEpoch = -1 nInterm = 3 strFName = utils.fOpen(Title = 'Load DED Maps with coordinates') ED = np.loadtxt(strFName) strFName = utils.fOpen(Title = 'Lo...
99b441519272b96c8ec84125d1bf4f180f668c7006cde30db26c8fc72c6b19ee
Python
719
27
from typing import TYPE_CHECKING, Any from langchain_classic._api import create_importer if TYPE_CHECKING: from langchain_community.document_loaders.parsers.language.cobol import ( CobolSegmenter, ) # Create a way to dynamically look up deprecated imports. # Used to consolidate logic for raising depr...
887fd703a4a88c46d4bc08ca15ecced2d0ae0f20a1a5b02a59a872766c492364
Python
720
36
# Configuration file for the Sphinx documentation builder. # -- Project information project = "SEDR" copyright = "2023, Hang Xu" author = "Hang Xu" release = '1.0' version = '1.0.0' # -- General configuration extensions = [ 'sphinx.ext.duration', 'sphinx.ext.doctest', 'sphinx.ext.autodoc', 'sphinx....
b0da229a7a6676097532290c8bf4cc08f5d6b55b6cdfcc528299ac8f8fbfa467
Python
720
23
import inspect from typing import cast def is_caller_internal(depth: int = 2) -> bool: """Return whether the caller at `depth` of this function is internal.""" try: frame = inspect.currentframe() except AttributeError: return False if frame is None: return False try: ...
ff6e1a7ecafa278e588f2fc7228a54a9ddae927fcd63320823160011c7fd75b6
Python
720
27
from typing import TYPE_CHECKING, Any from langchain_classic._api import create_importer if TYPE_CHECKING: from langchain_community.utilities import Requests, RequestsWrapper # Create a way to dynamically look up deprecated imports. # Used to consolidate logic for raising deprecation warnings and # handling opti...
338a9692331b1da4165063ad1ceba79b4e88b38f9708614328d130db98fd5d39
Python
722
25
from typing import TYPE_CHECKING, Any from langchain_classic._api import create_importer if TYPE_CHECKING: from langchain_community.query_constructors.mongodb_atlas import ( MongoDBAtlasTranslator, ) # Create a way to dynamically look up deprecated imports. # Used to consolidate logic for raising dep...
50c82ce59faa255667fb13e4ae9bf253acbf51539538f70e080c29909c1510ab
Python
722
25
from typing import TYPE_CHECKING, Any from langchain_classic._api import create_importer if TYPE_CHECKING: from langchain_community.chains.graph_qa.ontotext_graphdb import ( OntotextGraphDBQAChain, ) # Create a way to dynamically look up deprecated imports. # Used to consolidate logic for raising dep...
56af8f90708d61a95978bea6a74474bec88733ae69762d422ba742d64547a189
Python
722
25
""" Tests for nwb compatibility and interfacing functions. """ from imagingplus.utils.nwb import newImagingNWB, readImagingNWB def test_WriteImagingNWB(new_imaging_nwb_fixture): subject = new_imaging_nwb_fixture[0] expobj = new_imaging_nwb_fixture[1] trialobj = new_imaging_nwb_fixture[2] expobj.experi...
58fdcd2f4a5ee6f8efb7e29cb75c24f720b6615bcfb12ea124df3de1adba9daa
Python
723
34
from langchain_core.utils import __all__ EXPECTED_ALL = [ "StrictFormatter", "check_package_version", "convert_to_secret_str", "formatter", "get_bolded_text", "abatch_iterate", "batch_iterate", "get_color_mapping", "get_colored_text", "get_pydantic_field_names", "guard_impor...
596fd0b18759d2278e8b92673c720281b34b3daca2de077f9cc67ba861841702
Python
723
20
import torch import torch.nn as nn #from torch.nn import functional as F from VariationalNC.Variational_layers import VariationalLinear, VariationalConv2d, VariationalConv3d from VariationalNC.Variational_utils import variational_estimator @variational_estimator class VariationalLN(nn.Module): def __init...
f25adf6106e0f928fdcdd515bfa14673e2ed52392533245a63be0aa025ca58e2
Python
723
27
from typing import TYPE_CHECKING, Any from langchain_classic._api import create_importer if TYPE_CHECKING: from langchain_community.tools import SearchAPIResults, SearchAPIRun # Create a way to dynamically look up deprecated imports. # Used to consolidate logic for raising deprecation warnings and # handling opt...
f53e22b6808ce58d8f64bbc7e42afdc59ca6ac9eadd123150bee14fe613e24ea
Python
723
27
from typing import TYPE_CHECKING, Any from langchain_classic._api import create_importer if TYPE_CHECKING: from langchain_community.docstore.base import AddableMixin, Docstore # Create a way to dynamically look up deprecated imports. # Used to consolidate logic for raising deprecation warnings and # handling opt...
2ffea84363847e760d939f0283efffde038e959bd646e9c33fe82bf026527b12
Python
724
27
"""Google Trends API Toolkit.""" from typing import TYPE_CHECKING, Any from langchain_classic._api import create_importer if TYPE_CHECKING: from langchain_community.tools.google_trends.tool import GoogleTrendsQueryRun # Create a way to dynamically look up deprecated imports. # Used to consolidate logic for rais...
46d1deb3a872efd84e213d3e74da9e5942d37d562e63f7b4cc375bc70fd32bd2
Python
724
27
from typing import TYPE_CHECKING, Any from langchain_classic._api import create_importer if TYPE_CHECKING: from langchain_community.document_loaders.parsers.language.python import ( PythonSegmenter, ) # Create a way to dynamically look up deprecated imports. # Used to consolidate logic for raising de...
51e84d4829c8b8d04498461159b8e78116f124d3ceb23b0bc10bfe31fb37dcf6
Python
724
27
from typing import TYPE_CHECKING, Any from langchain_classic._api import create_importer if TYPE_CHECKING: from langchain_community.callbacks.sagemaker_callback import ( SageMakerCallbackHandler, ) # Create a way to dynamically look up deprecated imports. # Used to consolidate logic for raising depre...
acc2a00d2586fa73830c0132ddc9764b909f732bd102620d796c38f04d359f6a
Python
724
27
from typing import TYPE_CHECKING, Any from langchain_classic._api import create_importer if TYPE_CHECKING: from langchain_community.callbacks.llmonitor_callback import ( LLMonitorCallbackHandler, ) # Create a way to dynamically look up deprecated imports. # Used to consolidate logic for raising depre...
bd6b74e03ed7c4e5ad4bd40d108e4e90e55f0f6a0430cea8baebfe30dab7df5c
Python
724
20
""" Plot an example subject session for each task. """ import subject_sessions example_ada_pos_data_file = "data/ada-pos_subject-60290c574980dd7f8e378b84_run-63a9838a208f5a27774db1a4_2022-12-26.csv" example_ada_pos_isess = 0 example_ada_prob_data_file = "data/ada-prob_subject-582ee44408b46b00010dbb07_run-63c01ead873...
f3271a01b3ad7aa9160faffe8078221244124d5d7f8d2528c8a2ef29475d9412
Python
724
27
from typing import TYPE_CHECKING, Any from langchain_classic._api import create_importer if TYPE_CHECKING: from langchain_community.chat_models.baidu_qianfan_endpoint import ( QianfanChatEndpoint, ) # Create a way to dynamically look up deprecated imports. # Used to consolidate logic for raising depr...
001549f11d47aa0698ed76198949ce3c020b71e0e15a61c428405c738aab4943
Python
725
34
from logging import Logger from pathlib import Path from typing import List from ..data import (AnnotationTable, WorldlineTable, Worldline, get_nearby_max) from ._utilities import default_args def create_track( dataset: Path, annotations: AnnotationTable, worldlines: Worldlin...
12befe28620d1efce70d004cff515b6096c258334c163a040416a09b28e622f1
Python
725
30
"""Optional RGI integration for the ColabFold diffusion notebooks.""" SUPPORTED_MODELS = frozenset( { "alphafold3", "openbind0", "openfold3", "boltz2", "protenix2", "protenix1", "rosettafold3", "chai1", "opendde", "helixfold3", ...
78c4d00ee8bc0b276757d0c7c76c00a9920a8fad49a211f4c905c89138628e37
Python
725
25
from typing import TYPE_CHECKING, Any from langchain_classic._api import create_importer if TYPE_CHECKING: from langchain_community.query_constructors.elasticsearch import ( ElasticsearchTranslator, ) # Create a way to dynamically look up deprecated imports. # Used to consolidate logic for raising de...
f2c715ce6fd7d49bca2d26050eb8295e6d5f220859618985a3c84389164aaea5
Python
725
27
from typing import TYPE_CHECKING, Any from langchain_classic._api import create_importer if TYPE_CHECKING: from langchain_community.document_loaders.baiducloud_bos_file import ( BaiduBOSFileLoader, ) # Create a way to dynamically look up deprecated imports. # Used to consolidate logic for raising dep...
3b6f6df6ef4ffe5f24136078b21d4e888056a2b4428401516cf2eaf9b19655d9
Python
726
20
from langchain_core.embeddings import DeterministicFakeEmbedding def test_deterministic_fake_embeddings() -> None: """Test that DeterministicFakeEmbedding is deterministic. Test that the deterministic fake embeddings return the same embedding vector for the same text. """ fake = DeterministicFake...
b119407bab1e2f0b8ebcd6e81899a7d3d293a2c616c849bc8c2eb0c93d229af7
Python
726
27
from typing import TYPE_CHECKING, Any from langchain_classic._api import create_importer if TYPE_CHECKING: from langchain_community.agent_toolkits.powerbi.chat_base import ( create_pbi_chat_agent, ) # Create a way to dynamically look up deprecated imports. # Used to consolidate logic for raising depr...
b85961324d6ec6c648b8f447dd8d29582f50e02b1b38f3a4adb10b4ed4be5e0c
Python
726
15
import re, os ROOT = os.path.join(os.path.dirname(__file__), "..") s = open(os.path.join(ROOT, "paper", "main.tex"), encoding="utf-8").read() a = re.search(r"\\begin\{abstract\}(.*?)\\end\{abstract\}", s, re.S).group(1) a = a.replace("\\%", "PCT") a = re.sub(r"%[^\n]*", "", a) a = a.replace("PCT", "%").replace("\\,", "...
c08b989de086ceb9378ef3d972a4387e5d3e9d2cd7aebbb85ea469fc669ff715
Python
726
27
from langchain_classic import prompts EXPECTED_ALL = [ "AIMessagePromptTemplate", "BaseChatPromptTemplate", "BasePromptTemplate", "ChatMessagePromptTemplate", "ChatPromptTemplate", "FewShotPromptTemplate", "FewShotPromptWithTemplates", "HumanMessagePromptTemplate", "LengthBasedExamp...
c9e0014c557d483c340751da6f2c59bae96de8509718ab1f2b38e5b27431138e
Python
727
26
from typing import TYPE_CHECKING, Any from langchain_classic._api import create_importer if TYPE_CHECKING: from langchain_community.document_loaders.pyspark_dataframe import ( PySparkDataFrameLoader, ) # Create a way to dynamically look up deprecated imports. # Used to consolidate logic for raising ...
024db7e9403cd9a45648eb698e6fc0cb51a776bf62bee1055495300151ba58b5
Python
728
23
#!/usr/bin/env python # Imports import unittest import os.path import sys import subprocess ############################################################################### path_to_script = os.path.join(os.path.dirname(os.path.realpath(__file__)),'..','bin','enrichm') path_to_data = os.path.join(os.path.dirname(os.pat...
0b8fe640ca6268ce7adaf7da0bbdf3a1f7901a0621a8d5f34aaacf23fd2cb14e
Python
728
25
from langchain_core.messages import ( AIMessage, AIMessageChunk, HumanMessage, HumanMessageChunk, SystemMessage, SystemMessageChunk, ToolMessage, ToolMessageChunk, ) from langchain_core.prompt_values import ChatPromptValueConcrete def test_chat_prompt_value_concrete() -> None: mess...
75efc34e1e1ed6e1b34b396fb25d93a040ca8b1d9b0f8bdb66182614b6c5b0fe
Python
728
23
import tensorflow as tf from tensorflow.keras.layers import Activation, ReLU from typing import List from .layer import LRPLayer class ReLULRP(LRPLayer): def __init__(self, layer, *args, name: str = 'relu_lrp', **kwargs): assert isinstance(layer, ReLU) or \ (isinstance(layer, Activation) ...
b441d5dc9e61de1332c5efef202f3ffa78f21332715417ed11149dd62300f113
Python
728
24
# third-party modules import numpy as np def generateUniformSpherePoints(n, r=1): """Implemented from note by Markus Deserno: https://www.cmu.edu/biolphys/deserno/pdf/sphere_equi.pdf""" alpha = 4.0*np.pi*r*r/n d = np.sqrt(alpha) m_nu = int(np.round(np.pi/d)) d_nu = np.pi/m_nu d_phi = alpha...
55c110a2507e388350ef75736dd2d73bdd2e10a6d29fbf848cab3015de1311c8
Python
729
27
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 deprecation warnings and # handling o...
d78919c121406d64b880d8e65998f3af690f5758adea487a9cc14ad6e6632f61
Python
729
21
from setuptools import setup # with open("README.rst", "r", encoding="utf-8") as f: # __long_description__ = f.read() if __name__ == "__main__": setup( name = "SEDR", version = "1.0.0", description = "Unsupervised spatially embedded deep representation of spatial transcriptomics.", ...
1908eb8cff28bfb890f14399c53e6ef8c1668bb41fa1962ed9622468a8e378b5
Python
730
18
""" This simple example uses pycromanager to vary exposure times with three repetitions and can be run with Micro-manager's virtual DemoCamera / DCam device. The resulting dataset is saved to 'democam_X/Full Resolution/democam_MagellanStack.tif` within the current folder; consecutively numbered `X` separate individual ...
34e8fba99b5f352ce1719f2eed907ee976fdcc4008517fd995869d122c2addb8
Python
730
27
"""Google Scholar API Toolkit.""" from typing import TYPE_CHECKING, Any from langchain_classic._api import create_importer if TYPE_CHECKING: from langchain_community.tools.google_scholar.tool import GoogleScholarQueryRun # Create a way to dynamically look up deprecated imports. # Used to consolidate logic for r...
4adbf18446ffd7c963e91e8ac361de0fd19bef836d1ac2603f87b156b21b2794
Python
730
28
import torch import torch.nn.functional as F from torch.autograd import Variable import numpy as np def _iou(pred, target, size_average = True): b = pred.shape[0] IoU = 0.0 for i in range(0,b): #compute the IoU of the foreground Iand1 = torch.sum(target[i,:,:,:]*pred[i,:,:,:]) Ior1...
c2ea52d710cc1e163b4f1deaa06aff1f3f6f84afcb28c709676b81729005f946
Python
730
27
"""Google Finance API Toolkit.""" from typing import TYPE_CHECKING, Any from langchain_classic._api import create_importer if TYPE_CHECKING: from langchain_community.tools.google_finance.tool import GoogleFinanceQueryRun # Create a way to dynamically look up deprecated imports. # Used to consolidate logic for r...
43cb4424551ba1804cfd10e90caccfe12dff38baeedaa9d4c358072d5e9fc8c1
Python
732
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 ...
81c292e318a85b96540697f064c522116f61814d2581a249a2f3ae7901cc2888
Python
732
26
import numpy as np import torch from neurovisfit.common.random import set_random_seed def test_set_random_seed(): seed = 123 deterministic = True set_random_seed(seed, deterministic) # Check NumPy random seed assert np.random.get_state()[1][0] == seed # Check PyTorch random seed assert...
2d9485a4ef6cedee5a5c1f165ac82ab791b66ddb9b48871790366eaeeee4ef51
Python
733
19
from langchain_core.prompts.prompt import PromptTemplate _template = """Given the following conversation and a follow up question, rephrase the follow up question to be a standalone question, in its original language. Chat History: {chat_history} Follow Up Input: {question} Standalone question:""" # noqa: E501 CONDE...
7ac598e0641409d496b91a422b64141f75d09f2871dfe67849c5f2fdc05ef468
Python
733
33
import pandas as pd from PoET import POET # ============================================================================= # Perform tracking of videos # ============================================================================= # instantiate POET object with path to video folder folder = './data/' poet = POET(fo...
85beee2c567d2de74501f3bcf18605f9fe9f6066ef94c967bf91a2914ef4b70b
Python
733
27
from typing import TYPE_CHECKING, Any from langchain_classic._api import create_importer if TYPE_CHECKING: from langchain_community.chat_message_histories import ( UpstashRedisChatMessageHistory, ) # Create a way to dynamically look up deprecated imports. # Used to consolidate logic for raising depre...
509329c3e49c4ac3c8631fc5eccf70992c3aed79f14c34e60b85bad51c4d2d62
Python
734
23
import pnabind.utils import pnabind.structure import pnabind.mesh import pnabind.nn from .map_structure_features_to_mesh import mapStructureFeaturesToMesh from .assign_vertex_labels_to_mesh import assignMeshLabelsFromStructure, AtomToClassMapper, assignMeshLabelsFromList, maskClassBoundary from .vertex_labels_to_resid...
82c97fae24c5dbaa5a53ed311b072d50f7e870f93db67cc8d6bfe7c7d3cf48fe
Python
734
18
# Copyright (c) MONAI Consortium # 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 in writing, so...
aa4822674ee5feb610f4acfd8b174a760a803242dd47934b4b755d5c740fe93a
Python
734
29
from langchain_core.prompts import __all__ EXPECTED_ALL = [ "AIMessagePromptTemplate", "BaseChatPromptTemplate", "BasePromptTemplate", "ChatMessagePromptTemplate", "ChatPromptTemplate", "DictPromptTemplate", "FewShotPromptTemplate", "FewShotPromptWithTemplates", "FewShotChatMessageP...
c19c05d5ce00ceeac4f40da75cda0ebfc00751450e8c06a62ae5f25e99c40df9
Python
734
27
from typing import TYPE_CHECKING, Any from langchain_classic._api import create_importer if TYPE_CHECKING: from langchain_community.callbacks.promptlayer_callback import ( PromptLayerCallbackHandler, ) # Create a way to dynamically look up deprecated imports. # Used to consolidate logic for raising d...
4e8f30640984ad1ff054cc3324926e65036e0e5d64e49f1eeaa867aebda8903b
Python
735
27
from typing import TYPE_CHECKING, Any from langchain_classic._api import create_importer if TYPE_CHECKING: from langchain_community.tools import SearxSearchResults, SearxSearchRun # Create a way to dynamically look up deprecated imports. # Used to consolidate logic for raising deprecation warnings and # handling...
0970a5b9041b4d3cdbfc5014ebc53caaa2c534afc46bb665aff69d0cbbf04594
Python
736
27
from typing import TYPE_CHECKING, Any from langchain_classic._api import create_importer if TYPE_CHECKING: from langchain_community.chat_message_histories import ( SingleStoreDBChatMessageHistory, ) # Create a way to dynamically look up deprecated imports. # Used to consolidate logic for raising depr...
1493e5173593bf519421baad33f5ba5af07fb7d274135cdb51aaacda25658dee
Python
736
18
import torch from nequip.nn import with_edge_vectors_ from nequip.data import AtomicDataDict from allegro._compile import allegro_data_settings def test_pair_allegro_ghost_consistency(Cu_bulk): _, data = Cu_bulk pair_allegro_data = allegro_data_settings(data.copy()) pair_allegro_data = with_edge_vectors_(...
d8ff7efa26908a107649d15db9e154334629e74c231d7c0080f78dab3ad8f53e
Python
736
27
from typing import TYPE_CHECKING, Any from langchain_classic._api import create_importer if TYPE_CHECKING: from langchain_community.chat_message_histories import ( ElasticsearchChatMessageHistory, ) # Create a way to dynamically look up deprecated imports. # Used to consolidate logic for raising depr...
3207fb1ec2d277881d4b3e66aebc2a326dcaa9a8594c4d9a06fc71e97f9faf10
Python
737
24
# pnabind modules from .get_residue_id import getResidueID def getSurfaceResidues(structure, area_key='sesa', threshold=0.0, hydrogens=False): atoms = structure.get_atoms() # get residue area values residueArea = {} # dict to map rid to an area value for atom in atoms: if (not hydrogens) a...
52a8cf94c6ad6539033b2fb5cd3cd815e1eeae1bbea628ac65a38b7512430167
Python
737
29
from langchain_core.agents import AgentAction, AgentFinish from langchain_classic.agents.output_parsers.json import JSONAgentOutputParser def test_tool_usage() -> None: parser = JSONAgentOutputParser() _input = """ ``` { "action": "search", "action_input": "2+2" } ```""" output = parser.invoke(_in...
9f6a18eb2ed1d20b64ea1a4149ad560526915310fe508244c704b0ab463066d8
Python
737
27
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. # Used to consolidate logic for raising ...
b4d9831ea75496d4f50d8d1d2b5c76831635f76e2ed93383de625eafcf2dc8c9
Python
738
27
from typing import TYPE_CHECKING, Any from langchain_classic._api import create_importer if TYPE_CHECKING: from langchain_community.tools import RedditSearchRun, RedditSearchSchema # Create a way to dynamically look up deprecated imports. # Used to consolidate logic for raising deprecation warnings and # handlin...
44e78ff16c7bb49f112860efee563f0d68a38265ace5723366cd178ba815b090
Python
739
23
import yaml import argparse def load_config(config_path: str) -> dict: """ Load configuration from YAML file. """ with open(config_path, 'r') as file: return yaml.safe_load(file) def parse_arguments(default_subjects: list) -> list: """ Argument parser for parsing from command-line. """ parse...
fc5f88086db0201abe5ada08c79ded84ff6599dd123dc4dabda92d0d3f879782
Python
739
24
import os import random def obtain_files_list(): for root, dirs, files in os.walk(training_set_path): return files def rename_step_files(rename_list): for i, file_name in enumerate(rename_list): old_file = training_set_path + "\\" + file_name new_file = training_set_path + "\\" + str...
1ae56cb007aa7038681863bf12c75890ad963ab91ffc7d32cc98335a741246ad
Python
741
22
from langchain_core.language_models import BaseLanguageModel from langchain_core.output_parsers import StrOutputParser from langchain_core.prompts.few_shot import FewShotPromptTemplate from langchain_core.prompts.prompt import PromptTemplate TEST_GEN_TEMPLATE_SUFFIX = "Add another example." def generate_example( ...
3b513aa011f8093bf88840d495a3d222fc47b5048509571327726b75d030a8e2
Python
741
34
#!/bin/env python import web, os from cgatReport import Cache from cgatReport import Utils from cgatReport import DataTree urls = ( '/data/(.*)', 'DataTable', '/index/(.*)', 'Index' ) # expose zip within templates global_vars = {'zip': zip } render = web.template.render('templates/', globals = global_var...
61ec3708fe9252b6fd6fe1ec4381fa92d08e94818cba60cb7a81d5482e46bf64
Python
741
27
from typing import TYPE_CHECKING, Any from langchain_classic._api import create_importer if TYPE_CHECKING: from langchain_community.tools.memorize.tool import Memorize, TrainableLLM # Create a way to dynamically look up deprecated imports. # Used to consolidate logic for raising deprecation warnings and # handli...
8090f5bc714c5f9b7e38cc7f4414170e5e52f4ba4194c8f57aadfb24f37c4fd6
Python
741
27
from typing import TYPE_CHECKING, Any from langchain_classic._api import create_importer if TYPE_CHECKING: from langchain_community.tools import GoogleSerperResults, GoogleSerperRun # Create a way to dynamically look up deprecated imports. # Used to consolidate logic for raising deprecation warnings and # handli...
84405012a2234066bf076b6fbb97a70c98b8a3d423cd6c2c24639cc5b3f2acfe
Python
741
27
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 deprecation warnings and # handli...
aa5d0a2466f79aefbd4eb5f767df2126b69c9090dd6a75aa8f43c1b93f7a5cde
Python
741
28
## Run each command in parallel import argparse import pandas as pd from os import system,environ def get_cmd(task, tissue): return pd.read_csv(f"{tissue}.assemble.cmd", header=None).iloc[task-1,0] def run_sge(task, tissue): cmd = get_cmd(task, tissue) system(cmd) def main(): ...
bff889c743e6649009ac969e5a4bb8dd9d67e6491e26b3ce2fa4f33c66e459fe
Python
742
20
import mne import os.path as op from config_FaceName import MEG_data_path,group_name,Ids for subject_id in Ids: subject = group_name+"%02d" % subject_id print("processing subject: %s" % subject) fname=op.join(MEG_data_path,subject,'fname'+'_%02d'%(subject_id)+'_tsss_mc.fif') ep...
81422ba2a99a04d701929f68b9c6659dbeab1c0c404dd11c3ed0556997595257
Python
743
28
from typing import TYPE_CHECKING, Any from langchain_classic._api import create_importer if TYPE_CHECKING: from langchain_community.llms import AI21 from langchain_community.llms.ai21 import AI21PenaltyData # Create a way to dynamically look up deprecated imports. # Used to consolidate logic for raising depr...
80a19e2b5d11af8d1cce283b704ee26fc4fa13c0b281d14464d045a5b134ab86
Python
744
27
from typing import TYPE_CHECKING, Any from langchain_classic._api import create_importer if TYPE_CHECKING: from langchain_community.vectorstores import Clickhouse, ClickhouseSettings # Create a way to dynamically look up deprecated imports. # Used to consolidate logic for raising deprecation warnings and # handl...
d45ae9fe4d0cd0851956ca382c6c9452cac7f0288ebf2660e8c7d995377e719d
Python
744
27
from typing import TYPE_CHECKING, Any from langchain_classic._api import create_importer if TYPE_CHECKING: from langchain_community.llms.loading import load_llm, load_llm_from_config # Create a way to dynamically look up deprecated imports. # Used to consolidate logic for raising deprecation warnings and # handl...
5a758fb65698cc3219d31305ad08a845364579b196e74fc1b165843a85474642
Python
745
25
import pytest import torch from chroma.layers.structure import backbone, symmetry class Test_symmetry: @pytest.mark.parametrize("group", ["C_2", "C_4", "D_2", "D_4", "T", "O", "I"]) def test_point_groups(self, group): G = symmetry.get_point_group(group) # test if the determinants are ones fo...
a569e565179c767ac9005822bab7dd421890bb46424a9821c4b7468720f32767
Python
745
27
import numpy as np from ..brain import Brain from ..utils import path def test_ntf_parameters(): """Check whether a Brain class is being initialized correctly.""" new_brain = Brain.Brain() default_ntf_params = { "tau_e": 0.012, "tau_i": 0.003, "alpha": 1.0, "speed": 5.0, ...
f41da006b6e893a757245ea99f584313574d7801eddd243f7c5705dcfd8b8c2a
Python
746
28
from typing import TYPE_CHECKING, Any from langchain_classic._api import create_importer if TYPE_CHECKING: from langchain_community.llms import Bedrock from langchain_community.llms.bedrock import BedrockBase # Create a way to dynamically look up deprecated imports. # Used to consolidate logic for raising de...
badd4ee3f10b89db76dde164575b527c099e354c9ec0024a39bee061112cdfc5
Python
747
27
from typing import TYPE_CHECKING, Any from langchain_classic._api import create_importer if TYPE_CHECKING: from langchain_community.utilities.opaqueprompts import desanitize, sanitize # Create a way to dynamically look up deprecated imports. # Used to consolidate logic for raising deprecation warnings and # hand...
6513c77c5833f9d7d4529ec198cea9f4deff3274e957099b0c5d73b94b242c07
Python
748
31
import torch import torch.nn as nn import torch.nn.functional as F import numpy as np class Discriminator(nn.Module): def __init__(self, v_ft, u_ft): super().__init__() self.bilinear = nn.Bilinear(v_ft, u_ft, 1) self.act = nn.Sigmoid() for m in self.modules(): self.weig...
c3fc7a23a567bcc64d00b318bc7a6f9f1609769eee3753f825aef2599dd5de61
Python
748
24
import numpy as np import torch from torch.autograd import Variable def data_generator(T, mem_length, b_size): """ Generate data for the copying memory task :param T: The total blank time length :param mem_length: The length of the memory to be recalled :param b_size: The batch size :return: ...