sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
d50e2218b285202e3721342558cd31eaab7b849534abd44cbccb97c2630d2b9f
Python
833
28
from typing import TYPE_CHECKING, Any from langchain_classic._api import create_importer if TYPE_CHECKING: from langchain_community.tools import GetElementsTool from langchain_community.tools.playwright.get_elements import GetElementsToolInput # Create a way to dynamically look up deprecated imports. # Used ...
d5b5232917fee18b7d82892999f72d33297b6e704b68afe0f3555452dc535625
Python
833
28
from scipy.io import loadmat import torch import numpy as np def data_generator(dataset): if dataset == "JSB": print('loading JSB data...') data = loadmat('./mdata/JSB_Chorales.mat') elif dataset == "Muse": print('loading Muse data...') data = loadmat('./mdata/MuseData.mat') ...
567eca1d8b41a419842a57b6781f0b15e67da2ba361b943567ac2f0f02bca89d
Python
834
31
import sys def all2lower(ifn): idx = ifn.rfind(".") ofn = ifn[:idx] + ".lower.txt" with open(ifn, "r") as fr, open(ofn, "w") as fw: for i, line in enumerate(fr): nline = " ".join([w.lower() for w in line.split(" ")]) fw.write(nline) def all2upper(ifn): idx = ifn.rfin...
cb5b090d926d5687256b78809bfdf12e52997b4be0a4d4ba70fd96c48893cb62
Python
835
33
import torch from bindsnet.datasets.collate import time_aware_collate class DataLoader(torch.utils.data.DataLoader): def __init__( self, dataset, batch_size=1, shuffle=False, sampler=None, batch_sampler=None, num_workers=0, collate_fn=time_aware_col...
480810429dc3db8f4434128e602be68cd11b554bcbe17c12da454fd4566b7c39
Python
836
19
# These are all the procedures that appear in the annotator. from .delete_annotations import delete_annotations from .insert_local_max import insert_local_max from .insert_annotation import insert_annotation from .worldline_utilities import randomly_color_worldlines, renumber_worldlines from .navigation import jump_to...
dcef991263b0d3ef33bdfd5a278e3a20e1802f1404b3e3df05be1e99e172655a
Python
836
29
import rdkit.Chem as Chem import numpy as np from collections import defaultdict ''' This script looks at how many bond changes actually occur in forward reactions (in this dataset) ''' def process_file(fpath): counter = defaultdict(int) with open(fpath, 'r') as fid_in, open(fpath + '.proc', 'w') as fid_out:...
ce7c0a77c9c035fcefe4eb76247d7845c111ca5caa4e7c60dc68e9cab7d6caf6
Python
837
24
import os import shutil import pathlib def move_files(source_directory, target_directory): files_list = os.listdir(source_directory) for filename in files_list: shutil.move(os.path.join(source_directory, filename), target_directory) return if '__main__' == __name__: working_directory = ...
968c534cc3ce344033d881a1830b457df807ecca6c130973d7894df70831ec1e
Python
838
24
import os from django.db import models from django.conf import settings def get_upload_path(instance, filename): return '/'.join(filter(None, ('clustering/files', filename))) class Cluster(models.Model): DATA_TYPES = [ ('pca', 'PCA'), ] ALGORITHM_TYPES = [ ('gmm', 'Gaussian Mi...
39fe0da6821ada24a7df64cead328f9112fdbaba013ff6e17fc5fd1b4440c842
Python
840
28
from typing import TYPE_CHECKING, Any from langchain_classic._api import create_importer if TYPE_CHECKING: from langchain_community.document_loaders import GitHubIssuesLoader from langchain_community.document_loaders.github import BaseGitHubLoader # Create a way to dynamically look up deprecated imports. # U...
f5248ae40cf7de6af6cdb2099d9323512206bb5ca5fcb97d6091dfaa4282b8f1
Python
840
33
from .statistics import \ kolmogorov_smirnov_analysis, \ mean_difference_analysis, \ feature_correlation from .relative_entropy import \ relative_entropy_analysis from .statespecific import \ ssi_feature_analysis, \ ssi_ensemble_analysis, \ cossi_featens_analysis from .visualization impor...
2e52d2ac17293930eff04f559a177dc8beb6c39c377992f23ef573e97b5c6bd6
Python
841
30
from typing import TYPE_CHECKING, Any from langchain_classic._api import create_importer if TYPE_CHECKING: from langchain_community.vectorstores import ( AlibabaCloudOpenSearch, AlibabaCloudOpenSearchSettings, ) # Create a way to dynamically look up deprecated imports. # Used to consolidate l...
5b31efcf9cef2d2a558cf43d019fef314e853fa495ab8485b7b6652f4ebd2ba9
Python
841
30
from typing import TYPE_CHECKING, Any from langchain_classic._api import create_importer if TYPE_CHECKING: from langchain_community.agent_toolkits.openapi.spec import ( ReducedOpenAPISpec, reduce_openapi_spec, ) # Create a way to dynamically look up deprecated imports. # Used to consolidate l...
908b67e389564bfda2e68bf994a0ae42497c56d1730f9d6064a63c201b06a45f
Python
841
30
from typing import TYPE_CHECKING, Any from langchain_classic._api import create_importer if TYPE_CHECKING: from langchain_community.tools.amadeus.flight_search import ( AmadeusFlightSearch, FlightSearchSchema, ) # Create a way to dynamically look up deprecated imports. # Used to consolidate l...
e1365bebd8cac6494187a99da1a365017cea6b6f8f176ce146b859720fdd1490
Python
841
30
from typing import TYPE_CHECKING, Any from langchain_classic._api import create_importer if TYPE_CHECKING: from langchain_community.tools.multion.close_session import ( CloseSessionSchema, MultionCloseSession, ) # Create a way to dynamically look up deprecated imports. # Used to consolidate l...
e5bd931c22b5d0b0cf38757f363b0bb32ee466bb1489cfc600a85942dcb7c82e
Python
841
28
from typing import TYPE_CHECKING, Any from langchain_classic._api import create_importer if TYPE_CHECKING: from langchain_community.retrievers import TavilySearchAPIRetriever from langchain_community.retrievers.tavily_search_api import SearchDepth # Create a way to dynamically look up deprecated imports. # U...
1d5d67a00e68e9fac6152b1188e56ae840cf61218f6a79d2f3b757edb5817e8c
Python
842
46
import pandas as pd import numpy as np import random data = pd.read_csv('data.csv') signal = data['num'].values seq = np.array(signal) c = (len(seq)//(96)) # print(c) seq = seq[:(len(seq)//(96)) * (96)] seq = seq.reshape((-1,(96))) e = 0 t = 0 for i in range(seq.shape[1]): col = seq[:,i] #...
4bde12e61fa33ee2813d7cf55abbcf8dd255c60ab3290a952a92b4d3499becb0
Python
842
34
import time from dliplib.reconstructors import learnedpd_dip_reconstructor, diptv_reconstructor from dliplib.utils.helper import load_standard_dataset, set_use_latex set_use_latex() # load data dataset = load_standard_dataset('ellipses') test_data = dataset.get_data_pairs('test', 100) obs, gt = test_data[0] data_s...
f3e64e1f63085a97cc8873821665f67190a84f7fbf44dacc079dd339c46d9b8d
Python
842
30
"""Utility functions for parsing an OpenAPI spec. Kept for backwards compat.""" 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 w...
513d86e3e3653561e359ed8a7875d7342ffcabad5e474fbf7a971dd44c54a876
Python
843
28
import numpy as np from voxcell import VoxelData from scipy.ndimage import generate_binary_structure, label import sys input_nrrd = sys.argv[1] output_xyz = sys.argv[2] vd = VoxelData.load_nrrd(input_nrrd) ntot = np.sum(vd.raw) # get connected components ball = generate_binary_structure(3, 3) cc = label(vd.raw, ball...
152275014c663a2f107c26f557404b36105c11ca9037f15e7d5af2fa2cefe159
Python
844
26
#!/usr/bin/env python """ Generate ffxml files for ligands in a multi-mole mol2. """ mol2_filename = 'Imatinib-epik-charged.mol2' ffxml_filename = 'Imatinib-epik-charged.ffxml' # Read mol2 file containing protonation states and extract canonical isomeric SMILES from this. print("Reading molecules") from openeye impo...
1561c60bdfe6a9acb5265b3e625ff8f15e64dde784be9012f9bf7f7a5d2b731c
Python
844
31
from typing import Any from langchain_core.documents import Document from langchain_core.retrievers import BaseRetriever from typing_extensions import override class SequentialRetriever(BaseRetriever): """Test util that returns a sequence of documents.""" sequential_responses: list[list[Document]] respo...
559d5109b0a32430b07464c34403f7fa44a4b8cfe53ee3e499e7e82afee07245
Python
844
11
"""Per-page layout scan of a PDF: body words, float captions, and the share of the page height covered by images/tables. Usage: python src/page_scan.py paper/main_2col.pdf [first last]""" import fitz, re, sys sys.stdout.reconfigure(encoding="utf-8") d = fitz.open(sys.argv[1]) a, b = (int(sys.argv[2]), int(sys.argv...
5fc1e16ea79d22527ae2c24491234b4f1094d5b8ea9cfbc993fd1d7e297dd532
Python
844
28
from typing import TYPE_CHECKING, Any from langchain_classic._api import create_importer if TYPE_CHECKING: from langchain_community.tools import ListDirectoryTool from langchain_community.tools.file_management.list_dir import DirectoryListingInput # Create a way to dynamically look up deprecated imports. # U...
a2316a2643a925880320ec74376ec0f57d723aed936c3b3535cb04d46b69c32d
Python
845
28
from langchain_classic.memory import chat_message_histories EXPECTED_ALL = [ "AstraDBChatMessageHistory", "ChatMessageHistory", "CassandraChatMessageHistory", "CosmosDBChatMessageHistory", "DynamoDBChatMessageHistory", "ElasticsearchChatMessageHistory", "FileChatMessageHistory", "Firest...
a92324d90e1919f0985f518281891837ed33dc2edb9251d383da55baa6d0c0a5
Python
845
36
import numpy as np import os import sys dtype = np.dtype(np.uint32) fpath = "/home/ubuntu/data/rx_chan_11.txt" nb_samples = int(os.path.getsize(fpath)/dtype.itemsize) data = np.fromfile(fpath, dtype=dtype, count=nb_samples) if len(sys.argv) > 1: if sys.argv[1] == "all": for i in r...
383c55de2b82cecede6fc822e0f0d19ec0b6fa8f070000a735111ed1d7d51d86
Python
846
11
PREFIX = """You are an agent designed to answer questions about sets of documents. You have access to tools for interacting with the documents, and the inputs to the tools are questions. Sometimes, you will be asked to provide sources for your questions, in which case you should use the appropriate tool to do so. If th...
e1565360bea1bcb38c78c9e7bdade2e5748f917b07ec17f953b0aaa8ba6e06dd
Python
846
28
from typing import TYPE_CHECKING, Any from langchain_classic._api import create_importer if TYPE_CHECKING: from langchain_community.document_loaders import DataFrameLoader from langchain_community.document_loaders.dataframe import BaseDataFrameLoader # Create a way to dynamically look up deprecated imports. ...
e8caabe2ed9a8c0b8d200af651d9b631192b05c885cefed4660e75ab89ea325f
Python
846
34
import glob import os import torch from torch.utils.ffi import create_extension this_file = os.path.dirname(__file__) sources = ['src/batchnormp.c'] headers = ['src/batchnormp.h'] defines = [] with_cuda = False abs_path = os.path.dirname(os.path.realpath(__file__)) extra_objects = [os.path.join(abs_path, 'dense/batc...
0acad52295e823e7503ce51ea68e71fecdc4db6553e1ec20ee6021c44a63f37c
Python
847
30
from typing import TYPE_CHECKING, Any from langchain_classic._api import create_importer if TYPE_CHECKING: from langchain_community.utilities.anthropic import ( get_num_tokens_anthropic, get_token_ids_anthropic, ) # Create a way to dynamically look up deprecated imports. # Used to consolidate...
499fa3ead3b10f0afbcb4fc845d77c22dd2f68e95e576404d61cc9c0c4256bed
Python
848
32
"""Tavily Search API toolkit.""" 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, TavilySearchResults, ) # Create a way to dynamically look up deprecated imports...
56eb597e86b8bbfc005cffc1c9df3537bdfb59c2d41d5ee9cd5e994ea641d245
Python
848
23
import importlib import pandas as pd dfs = list() for dataset in ['chbp', 'lemon', 'tuab', 'camcan']: config_map = {'chbp': "config_chbp_eeg", 'lemon': "config_lemon_eeg", 'tuab': "config_tuab", 'camcan': "config_camcan_meg"} if dataset not in config_map: ...
7a9ddfaf1a7dd10e7297b6e6dfe9fd584b6aacf775918ef3eaf381b85c8ec119
Python
848
25
from voxcell import VoxelData, RegionMap, OrientationField import numpy as np # load region annotations annot = VoxelData.load_nrrd('brain_regions.nrrd') rmap = RegionMap.load_json('hierarchy.json') # find voxels in region S1HL ids = list(rmap.find('S1HL', 'acronym', with_descendants=True)) mask = np.isin(annot.raw, ...
a74e858b525ecad67aa43d8de7332e7129f201b42aabf6c44b55fbcb79a9465a
Python
848
31
# -*- coding: utf-8 -*- """ Created on Thu May 5 19:58:48 2022 @author: ywjin0707 """ import tensorflow as tf def pearson_cor(targets, logits): mx = tf.reduce_mean(logits) my = tf.reduce_mean(targets) xm, ym = logits - mx, targets - my r_num = tf.reduce_sum(input_tensor=tf.multiply(xm, ym)) r_d...
0a562be40f8597bba72cb5a1d952af4756b2f6a8e4afa1a56b5fd0c9bc6de1da
Python
849
28
from typing import TYPE_CHECKING, Any from langchain_classic._api import create_importer if TYPE_CHECKING: from langchain_community.tools import SlackScheduleMessage from langchain_community.tools.slack.schedule_message import ScheduleMessageSchema # Create a way to dynamically look up deprecated imports. # ...
1023141a22c526bd5b7c2096d9646fdc111e22baf6b7cbe6f45b479663fc7e92
Python
849
26
"""Tests for the string run evaluator.""" from unittest.mock import MagicMock from langchain_classic.evaluation import criteria from langchain_classic.smith.evaluation.string_run_evaluator import ( ChainStringRunMapper, StringRunEvaluatorChain, ) from tests.unit_tests.llms import fake_llm def test_evaluate_...
7ef8b976999f7970e37a4cf6b8ee99d5d6ba230f542828e1bed49b392ee49e29
Python
850
27
from setuptools import setup, find_packages try: with open("README.md", "r", encoding="utf-8") as fp: long_description = "\n" + fp.read() except FileNotFoundError: long_description = "TensorFlow implementation of DONE (Direct ONE-shot learning with Hebbian weight imprinting)" setup( name="tfdone", ...
8d1841eeac0bf2a4480a518575d2552397601e45d43bdf73b0f10fc5e1719ad9
Python
850
30
from typing import TYPE_CHECKING, Any from langchain_classic._api import create_importer if TYPE_CHECKING: from langchain_community.tools.multion.update_session import ( MultionUpdateSession, UpdateSessionSchema, ) # Create a way to dynamically look up deprecated imports. # Used to consolidat...
b2414448413465664afbe5e8c1504cf52e66bd0f1d0c64d680a522aefc15623e
Python
850
30
from typing import TYPE_CHECKING, Any from langchain_classic._api import create_importer if TYPE_CHECKING: from langchain_community.tools.multion.create_session import ( CreateSessionSchema, MultionCreateSession, ) # Create a way to dynamically look up deprecated imports. # Used to consolidat...
c17d6ff343a3014597a801acffbc4f1e1cdffa63cf7ee8f95843ec2bad3bc8e5
Python
851
23
"""tffp URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/1.11/topics/http/urls/ Examples: Function views 1. Add an import: from my_app import views 2. Add a URL to urlpatterns: url(r'^$', views.home, name='home') Class-based...
f0c65c4b1d72213a14876e7c095da7fee7bc14adbdc0145d316fb0e9c5813494
Python
851
27
from pathlib import Path from langchain_core._api import path HERE = Path(__file__).parent ROOT = HERE.parent.parent.parent def test_as_import_path() -> None: """Test that the path is converted to a LangChain import path.""" # Verify that default paths are correct # if editable install, check director...
6e18e2aacb20779be4f73f9b7e66be17c5655865ea9afe36be68a387e612fbb2
Python
852
24
from NeuronModel.NeuronClass import neuronClass import numpy as np import matplotlib.pyplot as plt hsv = plt.get_cmap('hsv') def colors(n): return hsv(np.linspace(0., 1.0, len(n)+1)) class poissonPop(neuronClass): parameters = {'save': True, 'spike': True, 'b': 1., 'N': 1} def __init__(self, **kwargs): ...
ebba4217b7eecacd817a873dc7e25ea92f7b8fa3b934226d5f422ef951ce3ccb
Python
852
22
from setuptools import setup, find_packages with open("README.md", "r") as fh: long_description = fh.read() with open("requirements.txt", "r") as f: requirements = f.read().splitlines() requirements = [l for l in requirements if not l.startswith('#')] setup( name="DN_network_analysis", version="0...
f7548db8847a78a9fa09cc67cb160fd562b0bc5cb5fac15d429536b144c2d5b1
Python
853
30
from typing import TYPE_CHECKING, Any from langchain_classic._api import create_importer if TYPE_CHECKING: from langchain_community.chat_models.volcengine_maas import ( VolcEngineMaasChat, convert_dict_to_message, ) # Create a way to dynamically look up deprecated imports. # Used to consolida...
17800fdae7982abadabda435bf54657b04c883f48f95fc1dbfbc396c1c9a2230
Python
854
28
from typing import TYPE_CHECKING, Any from langchain_classic._api import create_importer if TYPE_CHECKING: from langchain_community.document_loaders import FacebookChatLoader from langchain_community.document_loaders.facebook_chat import concatenate_rows # Create a way to dynamically look up deprecated impor...
c51eab3206240e7257a7a3f210d06b63314bee540b81cc02fca7e2ffe72795b7
Python
854
28
from typing import TYPE_CHECKING, Any from langchain_classic._api import create_importer if TYPE_CHECKING: from langchain_community.document_loaders import WhatsAppChatLoader from langchain_community.document_loaders.whatsapp_chat import concatenate_rows # Create a way to dynamically look up deprecated impor...
7f90602768859092b3f8cc5278c7a343bebc8cb028ca6d1114b60d77407a7bb0
Python
855
28
from typing import TYPE_CHECKING, Any from langchain_classic._api import create_importer if TYPE_CHECKING: from langchain_community.tools import SteamshipImageGenerationTool from langchain_community.tools.steamship_image_generation.tool import ModelName # Create a way to dynamically look up deprecated import...
b66de7ce869a686e3a90babc0a371788c540adc01fd8a764b9fcd4f5579616ca
Python
856
28
from setuptools import setup, find_packages classifiers = [ 'Development Status :: 5 - Production/Stable', 'Operating System :: Microsoft :: Windows :: Windows 10', 'Operating System :: POSIX :: Linux', 'License :: OSI Approved :: MIT License', 'Programming Language :: Python :: 3' ] setup( name='Spati...
bcfc1a717655bc799e2b99be998248fd1a2e3dccd51ddf6df52079962dd1c0e2
Python
856
28
from setuptools import setup, find_packages classifiers = [ 'Development Status :: 5 - Production/Stable', 'Operating System :: Microsoft :: Windows :: Windows 10', 'Operating System :: POSIX :: Linux', 'License :: OSI Approved :: MIT License', 'Programming Language :: Python :: 3' ] setup( name='Spati...
fba3460eaee9c267512d1a953f3c81487605cebb574651bc9a07003821e613fa
Python
856
30
from typing import TYPE_CHECKING, Any from langchain_classic._api import create_importer if TYPE_CHECKING: from langchain_community.document_loaders.parsers.grobid import ( GrobidParser, ServerUnavailableException, ) # Create a way to dynamically look up deprecated imports. # Used to consolid...
98c997fa229e75d220d1f9b11e92bedfcfa99352a374253dbfc8f7d38c2b9851
Python
857
33
from typing import TYPE_CHECKING, Any from langchain_classic._api import create_importer if TYPE_CHECKING: from langchain_community.tools import ( InfoPowerBITool, ListPowerBITool, QueryPowerBITool, ) # Create a way to dynamically look up deprecated imports. # Used to consolidate logi...
cec517401de4a8b9da9549097b7114b80c0e81ee1d0b1cbb5e0dadf36cc482b1
Python
857
21
from django.db import models class Analysis(models.Model): TRIAL_TYPES = [ #('individual', 'Individual'), ('sequence', 'Sequence'), ] UNIT_TYPES = [ #('1', 'Multi Units'), ('2', 'Single Units'), ] trial_type = models.CharField(max_length=15, choices=TRIAL_TYP...
ff65120e2264b7c6fc0d1c89bc46a81b18f62c4b1076935800adf47cd92da767
Python
857
22
from EPI_MRI.EPIMRIDistortionCorrection import * from optimization.LBFGS import * import torch device = 'cuda:0' if torch.cuda.is_available() else 'cpu' # load the image and domain information # change this function call to be the filepath for your data data = DataObject('../data/156334_v.nii.gz', '../data/156334_-v....
459c255890354868e84c0d984b855618ff08439da6e20d77396552421df4b7e9
Python
858
35
from enum import Enum import pytest from langchain_core.exceptions import OutputParserException from langchain_classic.output_parsers.enum import EnumOutputParser class Colors(Enum): RED = "red" GREEN = "green" BLUE = "blue" def test_enum_output_parser_parse() -> None: parser = EnumOutputParser(en...
6912b8a99fb4373964d67d6303e6d9e3fe18692f693724d2828df333fc9153ed
Python
859
30
from typing import TYPE_CHECKING, Any from langchain_classic._api import create_importer if TYPE_CHECKING: from langchain_community.chat_models.anthropic import ( ChatAnthropic, convert_messages_to_prompt_anthropic, ) # Create a way to dynamically look up deprecated imports. # Used to consoli...
8ae6d7be99636638c69979fe73d7b32b7ea3c7e51b17171c5eda183afbb5c24f
Python
859
29
"""Test the initialize module.""" from langchain_core.tools import tool from langchain_classic.agents.agent_types import AgentType from langchain_classic.agents.initialize import initialize_agent from tests.unit_tests.llms.fake_llm import FakeLLM @tool def my_tool(query: str) -> str: # noqa: ARG001 """A fake t...
8cc8f081cb22bee163b7001d012682683dd9578978bcb206dc3759eeab291178
Python
859
30
from typing import TYPE_CHECKING, Any from langchain_classic._api import create_importer if TYPE_CHECKING: from langchain_community.chat_loaders.langsmith import ( LangSmithDatasetChatLoader, LangSmithRunChatLoader, ) # Create a way to dynamically look up deprecated imports. # Used to consoli...
8edf69b8245ad93657a1a7317b4b4331d6c4d66c396d2cebb88a76ddab8ef684
Python
859
21
import logging logger = logging.getLogger(__name__) def corr(y1, y2, dim=-1, eps=1e-8, **kwargs): """ Compute the correlation between two PyTorch tensors along the specified dimension(s). Args: y1: first PyTorch tensor y2: second PyTorch tensor dim: dimension(s) alo...
9f3b8d6282ff59bdc7d42a5f742b3344beb43d10f0a4658a05f5f1ef20935e35
Python
859
30
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, ClosestAirportSchema, ) # Create a way to dynamically look up deprecated imports. # Used to consoli...
ddc6a789a17a2b1eba31b85fdd1c6facb3d48d40c9cd456af4b6ca92bde107bb
Python
859
31
""" openforcefields.py A general small molecule forcefield descended from AMBER99 and parm@Frosst in the SMIRNOFF format. 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 typing import List from pkg_re...
38acf3d5f247c9abbbf71afe77541b9f190bc046a21cb678c27d6cd3527d340a
Python
860
28
from typing import TYPE_CHECKING, Any from langchain_classic._api import create_importer if TYPE_CHECKING: from langchain_community.document_loaders import BlockchainDocumentLoader from langchain_community.document_loaders.blockchain import BlockchainType # Create a way to dynamically look up deprecated impo...
622cb131f0a8f342374382afeb23c9f8117c02c8035bed9a5e46a3d35082218b
Python
860
25
from engine import sup_classifier from engine.arg_handler import get_combined_args from engine import utils import torch torch.autograd.set_detect_anomaly(False) torch.autograd.profiler.profile(False) torch.autograd.profiler.emit_nvtx(False) if __name__=='__main__': # Gets CLI args and overwrites preset params ...
bb731f7bb2c7fb7ec137d37eece5baaee40c59c8f5b9f2bd96433865afe8a8d2
Python
860
24
# Python function that returns the mid points relative to the R-peaks. (using this convention that a heartbeat is starting at the middle point between two R peaks and ends up at the middle point between the next two R peaks.) #Input: peaks - the R-peaks positions # : signal_length - length of the signal #Output: m...
7ecd365953a838d525bfe4ec7cc4028a1eb6ad922591ec780e682e13dd0af350
Python
861
32
import torch.nn.functional as F import torch from torch.utils.data import TensorDataset from data import GenRecogClassifyData, generate_recog_data from networks import HebbNet from plotting import plot_train_perf #%% d=Nh=50 net = HebbNet([d, Nh, 2]) teacher = HebbNet([d, Nh, 1]) teacher.plastic = to...
a40a31309acdc7542e96cd5d0bd7366b0b6937cd5905e983028f57f710717d40
Python
861
28
"""Birefringence reconstruction using the waveorder API.""" from waveorder.api import birefringence settings = birefringence.Settings( transfer_function=birefringence.TransferFunctionSettings(swing=0.1), apply_inverse=birefringence.ApplyInverseSettings( wavelength_illumination=0.532, ), ) # Simul...
2a27e623500aee6b9555e0b769edd6adf1c43fe99f7e34f7110d606955ea4056
Python
862
28
# 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 = open(sys.argv[1...
cf56f66dbf5c5afd1476b7ceb93fd1fe3c41329117d3372cc76f56a36f9ba0ba
Python
863
43
from openff.toolkit.topology.molecule import ( Atom, Bond, FrozenMolecule, HierarchyElement, HierarchyScheme, Molecule, Particle, ) from openff.toolkit.topology.topology import ( DuplicateUniqueMoleculeError, ImproperDict, InvalidBoxVectorsError, InvalidPeriodicityError, ...
feccc83706ff9b7e5dd25bc3900b037d619c2128febd68b7efa523361fcbd784
Python
863
30
from typing import TYPE_CHECKING, Any from langchain_classic._api import create_importer if TYPE_CHECKING: from langchain_community.retrievers import ZepRetriever from langchain_community.retrievers.zep import SearchScope, SearchType # Create a way to dynamically look up deprecated imports. # Used to consoli...
447856c8c1523bb436036ead2b077d13a666c4fae35f049d2c598a07db70d72e
Python
866
27
from pathlib import Path from langchain_core.documents import Document from langchain_core.documents.base import Blob def test_init() -> None: for doc in [ Document(page_content="foo"), Document(page_content="foo", metadata={"a": 1}), Document(page_content="foo", id=None), Documen...
a125f68d4cb72bf88153433ccbf51e35ae44fed9d03656c0e4109ab334910f46
Python
866
35
#!/usr/bin/env python # -*- coding: utf-8 -*- """The setup script.""" from setuptools import setup, find_packages with open('README.md') as readme_file: readme = readme_file.read() setup_requirements = ['pytest-runner'] with open('requirements.txt') as f: requirements = list(f.readlines()) test_requiremen...
127570ee6dd778662f2fef36f7470e1f1fd5cbfc31458a1ce74cfec49b6c96ea
Python
867
43
from langchain_core.prompts.prompt import PromptTemplate _PROMPT_TEMPLATE = """Translate a math problem into a expression that can be executed using Python's numexpr library. Use the output of running this code to answer the question. Question: ${{Question with math problem.}} ```text ${{single line mathematical expr...
2408715bd3191a9e328a224a71b906a7b4050221f88e3bedd956cf24bc764a31
Python
867
26
import re import json infile=open("Recon3D.json") out=open("Recon3D_id_subsystem.txt","w") inf=infile.read() r3d=json.loads(inf) #Example field input: #{'id': '25HVITD3t', 'name': '25-hydroxyvitamin D3 transport from cytoplasm', 'metabolites': {'25hvitd3_c': -1.0, '25hvitd3_e': 1.0}, 'lower_bound': 0.0, 'upper_boun...
33992dae122334c905731b3beedb1cf8e55bb3bf45c3d1e175e5cae477e591e9
Python
867
38
import numpy as np def low_pass_filter(x, tau, dt): assert tau > dt P = np.exp(-dt / tau) x_filtered = np.empty_like(x) x_filtered[0] = x[0] for i in range(1, len(x)): x_filtered[i] = P * x_filtered[i - 1] + (1.0 - P) * x[i] return x_filtered def moving_average(a, window_size): ...
a1ef591a3173ab56e2609135df4563a1f181f61fe91b5f6cf79caeac9d6f4b0f
Python
867
24
import numpy as np import tensorflow as tf from tensorflow.keras import Model from typing import List def _is_neighbour(outputs: List[tf.Tensor], inputs: List[tf.Tensor]) -> bool: outputs = outputs if isinstance(outputs, list) else [outputs] outputs = [output.name for output in outputs] inputs = inputs i...
fd9e828f11c6b9c45342e08ed39ee766c5a09ce804e2c00155f240710926f4a2
Python
867
27
# import sys # if len(sys.argv) == 0: # print("Please provide a path to a .fasta file with a sequence") # sys.exit() # def get_sequence(path): # """ # Get a sequence from a FASTA file with an initial sequence for the Protein Sequence Design Algorithm # """ # sequence = "" # with open(path,...
9fe186efc5013172a6ada933781cde5d8963c844c0012c7c2563a14b1ce17073
Python
868
32
import torch def sum_except_batch(x): return x.view(x.size(0), -1).sum(dim=-1) def assert_correctly_masked(variable, node_mask): assert (variable * (1 - node_mask)).abs().sum().item() < 1e-8 def compute_loss_and_nll(args, generative_model, nodes_dist, x, h, node_mask, edge_mask, context): bs, n_nodes,...
9bf5cb6e872975397678fb6885094c7adeade11970d066659ac082b4cc748320
Python
870
33
from typing import TYPE_CHECKING, Any from langchain_classic._api import create_importer if TYPE_CHECKING: from langchain_community.graphs.graph_document import ( GraphDocument, Node, Relationship, ) # Create a way to dynamically look up deprecated imports. # Used to consolidate logic...
8707e37f8cc7324f35a92b6830bbffd41bab62f00330fc28aa6fd7446eb34a8f
Python
871
30
from typing import TYPE_CHECKING, Any from langchain_classic._api import create_importer if TYPE_CHECKING: from langchain_community.chat_models.azureml_endpoint import ( AzureMLChatOnlineEndpoint, LlamaContentFormatter, ) # Create a way to dynamically look up deprecated imports. # Used to con...
b08bca8ec9f76d71f0eab82a2823c85c822fac1e7bf76e80ae9ca11fe5858131
Python
871
37
#!/usr/bin/python # see https://github.com/fabridamicelli/kuramoto from kuramoto import Kuramoto, plot_phase_coherence, plot_activity import numba import ast import memory_profiler from scipy.interpolate import pchip_interpolate from functools import partial from p_tqdm import p_map from scipy.stats import skew import...
bf33c039a30aaa8d96191ba56f75f0ace5206c69e065941dedb904ff7d0797c2
Python
871
30
from typing import TYPE_CHECKING, Any from langchain_classic._api import create_importer if TYPE_CHECKING: from langchain_community.tools import GmailSearch from langchain_community.tools.gmail.search import Resource, SearchArgsSchema # Create a way to dynamically look up deprecated imports. # Used to consol...
d01da9d1817b202dcd9b7a49741c3a2fa89f15e79070f7ebefbfb9e45fc376e7
Python
871
30
from typing import TYPE_CHECKING, Any from langchain_classic._api import create_importer if TYPE_CHECKING: from langchain_community.tools import AINAppOps from langchain_community.tools.ainetwork.app import AppOperationType, AppSchema # Create a way to dynamically look up deprecated imports. # Used to consol...
293a9ee0e2ab17ed4bc796914a84d572b0fc296b429206adc3c24fbf3345658b
Python
872
27
import os # Subject from environment variable SUBJECT_ID = os.environ['SUBJ'] os.environ.get("SUBJ") # Base directories BASE_DIR = "/scratch" DATA_DIR = os.path.join(BASE_DIR, "data") ROI_DIR = os.path.join(BASE_DIR, "roi_masks") TEMPLATE_DIR = os.path.join(BASE_DIR, "template") OUTPUT_DIR = os.path.join(BASE_DIR, "o...
acaf0051d87af315205c67ffff788cd8eaec7ab031cce24c5e2e343b2f9b323b
Python
873
28
import numpy as np def gaussian(mean,var): def f(size): return np.random.normal(mean,var,size) return f def gaussian_EI(r,J,sigma): def f(size): sol = np.zeros(size) N = size[0] if size[0]!=size[1] : print('Not right') else : Ne = int(size[0]...
83503ad34fd267fc5952ac8c9db43bfd8cdebee964f888e7e0c25cf9f12c64df
Python
874
28
# -*- coding: utf-8 -*- # @title Emulate configuration # @file SnnEmulator.py # @author Romain Beaubois # @date 23 Oct 2023 # @copyright # SPDX-FileCopyrightText: © 2023 Romain Beaubois <refbeaubois@yahoo.com> # SPDX-License-Identifier: GPL-3.0-or-later # # @brief # # @details # > **23 Oct 2023** ...
8a925180d53bae04c8e1a3e4ca07f4f1a14e9ed139f0d8c79ef8f76a953307bf
Python
874
41
# coding=utf-8 """ Imports network classes so they can be used directly""" from .utils import ( round_list, get_one_hot, pad, network_summary, print_model_structure, selu_weight_init_, selu_bias_init_, set_tensor_device, master_device_setter ) ...
9c410c419d84b4bb7aae8c9d13cfecc1eda27d4b29722857fe553a46597de3d8
Python
874
31
import tempfile import torch from chroma.models.procap import ProteinCaption, load_model, save_model def test_procap(): model = ProteinCaption( lm_id="EleutherAI/gpt-neo-125m", gnn_dim_edges=16, context_size=8, context_per_chain=1, gnn_num_neighbors=4, gnn_num_lay...
3aa18aa6f496679087c1ba131428db451589eef2d88046efb08e5b018b888587
Python
875
30
from typing import TYPE_CHECKING, Any from langchain_classic._api import create_importer if TYPE_CHECKING: from langchain_community.vectorstores import AzureSearch from langchain_community.vectorstores.azuresearch import ( AzureSearchVectorStoreRetriever, ) # Create a way to dynamically look up d...
f1dde68479ca30353d5e4c3f337fae7f9581b6a0387598fcd6d0fb03a660a3fa
Python
875
33
"""Message responsible for deleting other messages.""" from typing import Any, Literal from langchain_core.messages.base import BaseMessage class RemoveMessage(BaseMessage): """Message responsible for deleting other messages.""" type: Literal["remove"] = "remove" """The type of the message (used for se...
4761413e0d0ea11298ef2b9d9c8a4cce06e70eb9f39750b5eb986fbeb39a3238
Python
877
28
from psychopy import parallel import platform PLATFORM = platform.platform() if 'Linux' in PLATFORM: port = parallel.ParallelPort(address='/dev/parport0') # on MEG stim PC else: # on Win this will work, on Mac we catch error below port = parallel.ParallelPort(address=0xDFF8) # on MEG stim PC # NB problems ...
650ce75c0ba2293ab368beab7c22a392213a8ecc305e38405ff3df8ed5a1dac4
Python
877
42
#!/usr/bin/python import sys import os import re from PDBpy import * if __name__ == "__main__": regex = re.compile('noHet.pdb') lstf = os.listdir('.') for f in lstf: if os.path.isfile(f) and regex.search(f): basename = os.path.splitext(os.path.basename(f))[0] pdbname = str(basename)+".pdb" pdir = "resul...
d4dbdcd334e459fc57d0dd88cc7db79fb72d5a90d74a27d72f0819e84e72478e
Python
877
24
from scipy import stats import numpy as np def compute_batch_average(df): # Computes mean/SEM of measures across all seeds batch_PID = {} for i in df: if type(df[i][0]) == list: if type(df[i][0][0]) == dict: pass else: try: ...
b126d204e917abf64df52959d3c549901ded868aa430b685def05c18af5e4b77
Python
878
29
#!/usr/bin/env python # -*- coding: utf-8 -*- # @Time : 2023/9/28 10:39 # @Author : zhangchao # @File : dnn.py # @Software: PyCharm # @Email : zhangchao5@genomics.cn import torch.nn as nn class DNNModel(nn.Module): def __init__(self, input_dim, hidden_dim, output_dim, drop_rate=0.5): super(DNNMod...
c7825d6fb1ef71d1089a42b4b0e066a6ef5b10505880c18832572bde24b7aa81
Python
878
29
from typing import TYPE_CHECKING, Any from langchain_classic._api import create_importer if TYPE_CHECKING: from langchain_community.chains.graph_qa.kuzu import ( KuzuQAChain, extract_cypher, remove_prefix, ) # Create a way to dynamically look up deprecated imports. # Used to consolida...
6523cd6fd64d7b17e06e68b2bc7f12b3dab61015120f654d314b1700bc04b871
Python
879
23
import torch from torch.utils.data import Dataset class CustomDataset(Dataset): def __init__(self, data_list, labels_tensor, transform=None): self.data_list = data_list self.labels_tensor = labels_tensor self.transform = transform def __getitem__(self, index): if self.transfor...
deca44783576ec5750d002e3a1e8f1cc518106bc424781c3cf9c5b45fd076fcc
Python
879
30
'''This files stores the constants of the project''' # Enter your device's configuration for torch device = 'cuda:0' # Assign the path to the project files import os root_dir = os.path.dirname(os.path.abspath(__file__)) # (Optional) # Assign the path to the pickle file that has the data PICKLES_PATH = r"p...
f2ebca73805f6f0ffde0ed1d071decc58a7b40ba80186225ddb556f431f03374
Python
879
25
# Generated by Django 3.1.4 on 2021-12-06 08:47 from django.db import migrations, models import pl2kilosort.models class Migration(migrations.Migration): initial = True dependencies = [ ] operations = [ migrations.CreateModel( name='Trial', fields=[ ...
0000b376733c367b2e2e57487bffee6bb7acf26daf0d242c15d5a5b8286cd373
Python
880
34
""" Parse DrugBank """ import pathlib import pandas as pd class ParseDrugBank: """ """ def __init__(self, root=None , debug=False): self.debug = debug f_dict = {'db': 'drug_DrugBank_target.csv'} # set root if root is None: raise Exception(f'Error, file path is ...
5c0549e677b7cce659e0ed05530639e6d1b95c142e106cc27bb2224e55c6018f
Python
881
28
from typing import TYPE_CHECKING, Any from langchain_classic._api import create_importer if TYPE_CHECKING: from langchain_community.vectorstores import AzureCosmosDBVectorSearch from langchain_community.vectorstores.azure_cosmos_db import CosmosDBSimilarityType # Create a way to dynamically look up deprecate...
bfade2b5736ba02ec12da4ce8b8ca857748735a63ac33b6ea498036132a7a837
Python
882
32
from setuptools import setup from setuptools import find_packages from glob import glob from os.path import basename from os.path import dirname from os.path import join from os.path import splitext setup( name='coinstac', version='0.3.4', description='Python utility library for coinstac', url='https:...
caf7c7be6aa1ecea591e5d6b3da1dab0969c71c300f6b955b07886f727073812
Python
884
27
from langchain_core._api.deprecation import ( LangChainDeprecationWarning, LangChainPendingDeprecationWarning, deprecated, suppress_langchain_deprecation_warning, surface_langchain_deprecation_warnings, warn_deprecated, ) AGENT_DEPRECATION_WARNING = ( "Use `langchain.agents.create_agent` fo...
171b1e4c5783987cc4392c4994431c95d7d33eea13cbd0ecaa3ed6651ba098ab
Python
885
20
from typing import Any def __getattr__(name: str) -> Any: """Get attr name.""" if name == "create_csv_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 sandbox...