sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
9b418bfe64af4920917c803e18d96f52939d1748947e70027553fea435271234 | Python | 40,877 | 786 | import copy
import os.path
import pytest
# Find path to the test directory. This is because we need to read datafiles stored in subdirectories.
from mirp.data_import.import_image_and_mask import import_image_and_mask
from mirp._data_import.itk_file import ImageITKFile, MaskITKFile
from mirp._data_import.dicom_file_sta... |
b333200ef5c7836ff349ce641ce063c92fbe17776b59256b7d96d8653a864094 | Python | 40,912 | 1,029 | # Copyright (c) 2022 PaddlePaddle Authors. All Rights Reserved.
#
# 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 app... |
bad3faf4ac5e78c6fc781309e50216af661bd3216b2348a437d1e0bab69cfa63 | Python | 40,938 | 1,295 | #!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
"""Configs."""
import math
from fvcore.common.config import CfgNode
from . import custom_config
# -----------------------------------------------------------------------------
# Config definition
# ----------------------... |
f65e51859c7d1a2fc5f39280d22f7e1dc7822874afc6985503c2ffa056609624 | Python | 40,941 | 1,033 | """
Unit tests for MySQL backup module.
Tests cover:
- DatabaseConnectionManager context manager
- BaseSQLConnector database operations (remote/local info retrieval, comparison)
- MySQLdbToSQLite initialization and setup
- Schema extraction and conversion (MySQL -> SQLite)
- Table creation with constraints and migrati... |
fc6a9406e6bc8c7ab1de8978b3d9ed248a5708f6beb8238a4a50410bcd998839 | Python | 41,031 | 1,049 | import os
import warnings
import numpy as np
import pytest
from absl.testing import parameterized
from keras.src import backend
from keras.src import constraints
from keras.src import dtype_policies
from keras.src import initializers
from keras.src import layers
from keras.src import models
from keras.src import ops
... |
ea73256c0365dcba26f94bda8e502c5bf06c4e0631df5b7f4b513e52882104c5 | Python | 41,047 | 1,343 | # mask_mod varlen test script
# Forward-only
#
# Since flex_attention doesn't support varlen natively, we compare
# results sequence-by-sequence: run the kernel with cu_seqlens (packed),
# then run flex_attention per-sequence and compare.
#
# Usage:
# pytest test_mask_mod_varlen.py -v -s
import math
import random
... |
78bc1c1d020041f5f55414b865d08e947bb3292f6a9cd45f51da855b7702939a | Python | 41,081 | 1,081 | """Round-22 + round-24 conditional/taken-branch hardening regressions.
Adversarial audit findings (round22 condbranch): order-dependent branch
erasure, 1:N predicate reuse, same-line nested-ternary cross-wiring,
decorated-forward scope loss, short-circuited elif evaluation claims,
``bool_value_at_run`` vs ``fired`` co... |
0eef35cdb87c2ecef413112c9b4d28a73886be31857dc642a190d43b6ceeb7d4 | Python | 41,112 | 1,160 | """
*Experimental* implementation of FlashAttention in Triton.
Tested with triton==2.0.0.dev20221202.
Triton 2.0 has a new backend (MLIR) but seems like it doesn't yet work for head dimensions
other than 64:
https://github.com/openai/triton/blob/d376020f90002757eea3ea9475d4f7cfc2ec5ead/python/triton/ops/flash_attention... |
3e975ed2d4f8820f9d454e2e49bc7ca9cc22145fcdc979c8d712fc73a97f5fad | Python | 41,125 | 1,103 | """Tests for AWQ quantization."""
import os
import numpy as np
import pytest
from absl.testing import parameterized
import keras
from keras.src import backend
from keras.src import layers
from keras.src import models
from keras.src import ops
from keras.src import saving
from keras.src import testing
from keras.src.... |
e23fb938268a22af9915b5d78af4d5ac83d68c8a5aa71ad43d2c36abcd4de31b | Python | 41,137 | 950 | # -----------------------------------------------------------------------------------
# SwinIR: Image Restoration Using Swin Transformer, https://arxiv.org/abs/2108.10257
# Originally Written by Ze Liu, Modified by Jingyun Liang.
# -----------------------------------------------------------------------------------
# p... |
438775cc119ad750cc55718b6d9d3dbc7fc1051001cdf7f84de0699cde232a22 | Python | 41,166 | 1,359 | """Means of SPD/HPD matrices."""
import warnings
from array_api_compat import array_namespace as get_namespace, device as xpd
from array_api_extra import create_diagonal, nan_to_num
import numpy as np
from ._backend import diag_indices, nanmean, tril_indices
from ._check import check_function, check_init, check_weig... |
4be364e8ebe7fa76730f5b1b1bf0270dc8b01c5eafd3c491685910feed52963b | Python | 41,180 | 1,059 | """Interfaces for the post-processing workflows."""
import json
import os
import nibabel as nb
import numpy as np
import pandas as pd
from nipype import logging
from nipype.interfaces.base import (
BaseInterfaceInputSpec,
File,
SimpleInterface,
TraitedSpec,
isdefined,
traits,
)
from xcp_d.uti... |
1d72095795b8acb3e6c1ac1728faa21a1c8feec1398b2b56d886edffd79af11b | Python | 41,194 | 1,039 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created in April 2020
@author: Thomas Bonald <thomas.bonald@telecom-paris.fr>
@author: Quentin Lutz <qlutz@live.fr>
"""
from typing import Optional, Iterable, Union, Tuple
import numpy as np
from scipy import sparse
from sknetwork.clustering.louvain import Louvain
fr... |
139723abfeb528f3d360a0370c37986df182aec7cf15d3e073698b4046bbda42 | Python | 41,211 | 1,774 | from warnings import warn
from ._core import make_figure
from ._doc import make_docstring
import plotly.graph_objs as go
_wide_mode_xy_append = [
"Either `x` or `y` can optionally be a list of column references or array_likes, ",
"in which case the data will be treated as if it were 'wide' rather than 'long'.... |
99d3d119dbfc69a170d9cde65f9cb3b9416e9c040420e2da75ef56d9d25e4c38 | Python | 41,253 | 1,115 | import json
import logging
from collections import UserDict
from copy import deepcopy
from textwrap import dedent
from .dict_tool import merge_dict
logger = logging.getLogger(__name__)
BACKEND_GCP = 'gcp'
BACKEND_AWS = 'aws'
BACKEND_LOCAL = 'Local'
BACKEND_ALIAS_LOCAL = 'local'
BACKEND_SLURM = 'slurm'
BACKEND_SGE =... |
7b324be896f526f5231913d1a8bd38f5cdfbea1a4431fed99dc6a50de42db85b | Python | 41,303 | 1,043 | """
This script was adapted from Niklas Wilming et al. Nature Communications 2020
https://github.com/DonnerLab/2020_Large-scale-Dynamics-of-Perceptual-Decision-Information-across-Human-Cortex
"""
import os
import pandas as pd
from glob import glob
import numpy as np
from joblib import Parallel, delayed
from joblib impo... |
f186d6cae2959380a3c37ca2f476ac746453e6a03151eced1d807999239853a3 | Python | 41,308 | 794 | """
This module contains the HomogeneousReactor class that provides a high-level interface for a variety of 0-D reactors
"""
# Spitfire - a Python-C++ library for building tabulated chemistry models and solving differential equations
# Copyright 2019 National Technology & Engineering Solutions of S... |
4d7987794f71acd8971f8dabe01e5cdd498cdebe6eec299859256cd323ea0be9 | Python | 41,310 | 760 | #==============================================================================#
# Author: Dominik Müller #
# Copyright: 2024 IT-Infrastructure for Translational Medical Research, #
# University of Augsburg ... |
628dcccbdade9259e661bf7c41ff0b92641f66e4275657c33080594aed03c4e8 | Python | 41,367 | 1,248 | # emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
"""Plotting interfaces."""
import os
import matplotlib.pyplot as plt
import nibabel as nb
import numpy as np
import pandas as pd
import seaborn as sns
from matplotlib.cm import ScalarMappable
from matplot... |
62f60cbc292481cf28072c1b46034c502b28487acec66150cd4eb0667cc79e0f | Python | 41,401 | 1,053 | import numpy as np
import pandas as pd
from rdkit import Chem, DataStructs
from rdkit.Chem import AllChem
from rdkit.Chem.Fingerprints import FingerprintMols
from DeepPurpose.pybiomed_helper import _GetPseudoAAC, CalculateAADipeptideComposition, \
calcPubChemFingerAll, CalculateConjointTriad, GetQuasiSequenceOrder
impo... |
f62211d3c792ff65ad12169608e4ebb56ed8b637cef3083af54d53b7774a9e73 | Python | 41,416 | 1,255 | """
Title: SpatialBasePlot for all spatial coordinates and image plot
Author: Duy Pham
Date: 20 Feb 2021
"""
import numbers
import warnings
from typing import ( # Special
Optional, # Classes
)
import matplotlib
import matplotlib.axes
import matplotlib.figure
import matplotlib.pyplot as plt
import networkx as nx... |
4f956c20888acfff62933dbcd5d9f8c965510ed52be5088d93fc71091b247c7c | Python | 41,427 | 1,049 | import os
import numpy as np
import pandas as pd
import pickle as pkl
import nibabel as nib
from os.path import join as pjoin
from scipy.stats import pearsonr
from pandas.api.types import is_numeric_dtype
from magicbox.io.io import CiftiReader
from cxy_visual_dev.lib.predefine import proj_dir, Atlas,\
s1200_avg_ang... |
7019d342e051e2a4582c28057d7becfb7bafd05cb7bc92905781ed95c0115f33 | Python | 41,494 | 1,201 | """The lazy extraction reader: the documented read path (extract D14).
Opening reads BOUNDED manifest/ledger metadata only. The reader supplies
metadata, keys, logical shapes, ledger-order ``iter_batches``, integer /
slice / fancy row access via cumulative offsets, duplicate-aware ID lookup,
exact ragged rows, explici... |
1e8b00e681c18e9240d0cb35d670a6d1d5133225cfd62394aedf7da5485d64cb | Python | 41,527 | 632 | ##### Related to source DNN models #####
# Sets of models used in the paper:
# Core set of models, n=20 (for Figure 2 and Figure 5)
FIG_2_5_MODEL_LIST = ['Kell2018word', 'Kell2018speaker',
'Kell2018music', 'Kell2018audioset',
'Kell2018multitask',
'ResNet50word', '... |
f9c6ef3f54f40852ff37319891fb1a903648c46e1d4481ffd0b47a09d5ab8131 | Python | 41,542 | 818 | """Predefined Faster RCNN Model."""
from __future__ import absolute_import
import warnings
import mxnet as mx
from mxnet.gluon import nn
from mxnet.gluon.contrib.nn import SyncBatchNorm
from ..faster_rcnn import get_faster_rcnn
from .doublehead_rcnn import get_doublehead_rcnn
from ....nn.feature import FPNFeatureExp... |
569ee09ab21c43bf9702d0f87b7b9abad4b28c46ed1ce9c0ae9bd761c18ff963 | Python | 41,547 | 1,260 | """Top-level driver and report writer for TorchLens performance benchmarks."""
from __future__ import annotations
import argparse
import datetime as dt
import json
import platform
import re
import subprocess
import sys
import time
from collections import defaultdict
from importlib import metadata
from pathlib import ... |
82c74db2bd77c8101f419225cf45c47fb7e5e76e7cbe0ae20306563abe1556b9 | Python | 41,560 | 859 | import os
#os.environ["CUDA_VISIBLE_DEVICES"] = "-1"
import time
import subprocess
import h5py
import sys
import random
import numpy as np
import json
import warnings
import operator
import seaborn as sns
import pandas as pd
from matplotlib import pyplot as plt
import matplotlib.gridspec as gridspec
import tensorflo... |
3fe791f2d04f6f115f4f4c6063cfbbf9c3319a6e19bb4dd088cf4095f58436fe | Python | 41,567 | 1,125 | # pylint: disable=missing-docstring, unused-argument, line-too-long, too-many-lines
"""
Temporal Pyramid Network for Action Recognition
CVPR 2020, https://arxiv.org/pdf/2004.03548.pdf
Code adapted from https://github.com/decisionforce/TPN
"""
import numpy as np
import torch
import torch.nn as nn
import torch.utils.che... |
470d9479080c57a8081b53fb765e6fcbb6295310b3112a582acbf8d35a9fe510 | Python | 41,575 | 1,084 | """
Base classes for Galaxy AI agents.
"""
import asyncio
import fnmatch
import logging
import os
import random
from abc import (
ABC,
abstractmethod,
)
from collections.abc import (
Callable,
Sequence,
)
from dataclasses import (
dataclass,
field,
)
from functools import partial
from typing im... |
00cb7ec890c7d07f571e0907cc9ceb8e348d3e28f24328c94c9cd3c44c3cd197 | Python | 41,587 | 1,038 | #!/usr/bin/env python
# =============================================================================
# MODULE DOCSTRING
# =============================================================================
"""
Various analysis utilities.
"""
# =============================================================================... |
d40a596024c4ae2abbd33a581a263d941e66a2b0cb739cd3ad4a3b9508cfe320 | Python | 41,588 | 1,010 | # Copyright 2021 DeepMind Technologies Limited
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agr... |
7bc7b9a7555f1c84dcb7bd72d740eba7c86f4186e18ac3b1621e49a8c7faeabd | Python | 41,615 | 1,118 |
import torch
import os
import numpy as np
from torch.nn import functional as F
from torchvision.utils import save_image
from networks import mel_scale, hz2ind, amplitude
import matplotlib as mpl
import matplotlib.pyplot as plt
mpl.use("Agg")
import scipy.signal
import scipy.io.wavfile
import math
from librosa import g... |
abff81bb6e74ca11710cae9396297d1001e15e20e3e638fd00165be2b02de89b | Python | 41,659 | 1,098 | """Resume machinery + the D16 signature for extraction v2 (lane F18).
The KNOWN-FIELDS signature builder, the manifest loader/creator, the D8
callable-identity resume rules, the field-by-field mismatch refusals, and
the disk-run preparation (trusted-prefix resolution, v1 migration entry,
completed-compatible no-op res... |
b03805cb7584cfeea1644076c88de044e4185b54ed83ed178a597c9f795a86cc | Python | 41,679 | 1,145 | """Backend registry and public ``backend=`` routing tests."""
from __future__ import annotations
import ast
import builtins
import inspect
import sys
import types
from collections.abc import Iterator
from pathlib import Path
from typing import Any, cast
import pytest
import torch
from _source_corpus import package_a... |
a891ae04b1c0ef586bdc0daf6edc55732e34dff127c48b3e53d1a3deced1b4fb | Python | 41,703 | 1,068 | import numpy as np
from keras.src import activations
from keras.src import backend
from keras.src import ops
from keras.src import testing
from keras.src.saving import object_registration
def _ref_softmax(values):
m = np.max(values)
e = np.exp(values - m)
return e / np.sum(e)
def _ref_softplus(x):
... |
4d47870a750ef55389a0df016a9b7a8429d4c47807feb7bc08bfd98d704f7679 | Python | 41,731 | 992 | # Copyright (c) 2022 PaddlePaddle Authors. All Rights Reserved.
#
# 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 app... |
f89b3776d73f181d78030b2afd54c35d0862fd59f0de91f6a25479dbc268e8e9 | Python | 41,744 | 1,317 | from __future__ import annotations
import json
from pathlib import Path
import pandas as pd
import pytest
from larvaworld.lib import reg, util
from larvaworld.lib.process.dataset import LarvaDataset
from larvaworld.portal.datasets.replay_data import (
_infer_coordinate_origin,
build_environment_state_for_mem... |
9494de5d28d4b0b3f008088de85074f68d0249bb9525280923d5f8126a79e841 | Python | 41,747 | 757 | """
This module facilitates loading chemical reaction mechanisms in Cantera format and mixing streams in useful ways.
"""
# Spitfire - a Python-C++ library for building tabulated chemistry models and solving differential equations
# Copyright 2019 National Technology & Engineering Solutions of Sand... |
d5e18abbb6fc1b5a608c9961f76f297559fdf9111b155b71517921e1cf2aad61 | Python | 41,770 | 1,204 | """
Spatial grids holding the environment's scalar fields.
Provides the grid primitives backing the odor landscape, the food distribution,
the thermal field and the wind field, together with the diffusion and decay
that evolve them over time.
"""
from __future__ import annotations
from typing import Any
import math
... |
e7dfc7ef799259fb522eb4da27f097e5f71317cef0140ddc590ba3552928b9b4 | Python | 41,787 | 1,112 | # SOURCE: vendored from jiupinjia/stylized-neural-painting @ master (networks.py)
# SOURCE: vendored from BrunoKM/deep-pilco-torch @ master (torchpilco/dynamics_models.py, policy_models.py)
# SOURCE: vendored from Bogacz-Group/PredictiveCoding @ main (predictive_coding/pc_layer.py)
# SOURCE: vendored from facebookresea... |
2e739352f47aa3544db498c458efbf61c25c4c9fcd58bbff868ddbd70a5aff09 | Python | 41,821 | 571 | """
SV detection algorithm.
Copyright (C) 2021 Tham Cheng Yong
This file is part of NanoVar.
NanoVar is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any late... |
b37bd8f8071bcd9ae17007db06a6f0a9e52a238e308b0592c8ba4868957ce051 | Python | 41,836 | 1,337 | """Unit tests for ``torchlens.postprocess.ast_branches``."""
from __future__ import annotations
import ast
import os
import warnings
from collections.abc import Iterator
from dataclasses import replace
from pathlib import Path
from textwrap import dedent
import pytest
import torchlens.postprocess.ast_branches as as... |
64a2128415733313f4178494333d1c115468e94bbf23be6fcedf38abfddde597 | Python | 41,853 | 1,415 | # utility functions for dealing with contigs during hallucination
import numpy as np
import random, copy, torch, geometry, os, sys
from kinematics import xyz_to_t2d
def parse_range_string(el):
''' Splits string with integer or integer range into start and end ints. '''
if '-' in el:
s,e = el.split('-')
s,e... |
887eb85ea5380707a78cd15dc04169e654f4dee58f9bddab49a2ce71f1680e35 | Python | 41,901 | 1,146 | # Copyright (c) 2023, Tri Dao.
from typing import Optional, Union, List, Tuple
import os
import torch
import torch.nn as nn
import warnings
USE_TRITON_ROCM = os.getenv("FLASH_ATTENTION_TRITON_AMD_ENABLE", "FALSE") == "TRUE"
if not USE_TRITON_ROCM and getattr(torch.version, 'hip', None) is not None:
try:
... |
0804584ad5552ece48a9a217bfc1a36a240a4931beabbf8e7a7b7e852f15db7d | Python | 41,902 | 1,008 | """r55 C6 (r54 corr_2/corr_4): AUTHORITATIVE inert reachability of the RNG sweep.
The r53 hand-maintained callable-interior vocabulary (closure cells, defaults,
kwdefaults, partial/property/static/classmethod fields) was a whack-a-mole table:
r54 found generators hidden behind ``__annotations__`` (corr_2) and a
``func... |
e3dd77a7295ffe0d728b1233383943896045df2c11f47a54a48152749b975cee | Python | 41,938 | 1,062 | #!/usr/bin/env python
"""
Simple tool for manual state annotation.
TODO:
- automatically add user defined keybindings to the help string
"""
import warnings
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.colors import to_rgba_array
from matplotlib.collections import LineCollection
DEBUG = False
S... |
502abab88eee9d7a8f7cab560026f135eb2318fd8b5e1f0316fce1078f67c6aa | Python | 41,981 | 1,138 | """
Implements tracking Intel CPU Power Consumption on Mac and Windows
using Intel Power Gadget
https://software.intel.com/content/www/us/en/develop/articles/intel-power-gadget.html
"""
from __future__ import annotations
import os
import re
import shutil
import subprocess
import sys
from functools import lru_cache
fr... |
b6508c99a2458e4078357a75873279dfc70f5c90b8e86e0f749d1ed8cf2ad129 | Python | 41,992 | 1,287 | import functools
import itertools
import operator
import numpy as np
import torch
import torch._dynamo as dynamo
import torch.nn.functional as F
from keras.src import backend
from keras.src.backend.common import is_float_dtype
from keras.src.backend.common import is_int_dtype
from keras.src.backend.common import stan... |
6f6df4b8546c40fe6053ec263524e3f251085e6e6926e566987dac5d70024745 | Python | 42,056 | 1,254 | import multiprocessing as mp
import timeit
import pandas as pd
from functools import partial # pool.map with multiple args
import subprocess as sp #run bash commands that are much faster than in python (i.e cut, grep, awk, etc)
import numpy as np
from cyvcf2 import VCF
#from scipy.stats import linregress #r2
import gzi... |
6cb665c3dfebe2b249c2277384cb29b033ec972730f9a4103e72dd65f53f5d39 | Python | 42,083 | 890 | """ResNetV1bs, implemented in Gluon."""
# pylint: disable=arguments-differ,unused-argument,missing-docstring
from __future__ import division
from mxnet.context import cpu
from mxnet.gluon.block import HybridBlock
from mxnet.gluon import nn
from mxnet.gluon.nn import BatchNorm
__all__ = ['ResNetV1b', 'resnet18_v1b', '... |
881de9d2e0d6cb1ac406e2d138eaeb62f7193f42055bbfa5d302b2671b638305 | Python | 42,108 | 993 | # Copyright (c) 2023, Tri Dao.
import math
from functools import partial
import torch
import torch.nn as nn
from einops import rearrange, repeat
from flash_attn.utils.distributed import get_dim_for_local_rank
try:
from flash_attn import (
flash_attn_kvpacked_func,
flash_attn_qkvpacked_func,
... |
15611e025c1ee7310e522b87732027baaae5a28c20601c41b17007130f23cb32 | Python | 42,138 | 1,244 | import ml_dtypes
import numpy as np
from keras.src import backend
from keras.src.backend.common import is_float_dtype
from keras.src.backend.common import standardize_dtype
from keras.src.backend.numpy.ops.core import convert_to_tensor
from keras.src.random.seed_generator import draw_seed
from keras.src.utils.module_u... |
210e1607a2349eee613ea16bc0e47a57ca6c3785831086d0aed31608bc2fca73 | Python | 42,166 | 1,193 | """Backward intervention selector, helper, and grad_fn_handle dispatch tests."""
from __future__ import annotations
import warnings
from dataclasses import dataclass, field
from typing import Any
import pytest
import torch
from torch import nn
import torchlens as tl
from torchlens import _state
from torchlens.backe... |
b2dfa4f7988af25570f2b09860fbbff273ce9489c1c56c499a1d2dcfe0cc0451 | Python | 42,210 | 981 | """Worker-side decode and spill.
A worker decodes a contiguous run of blobs and accumulates the decoded blocks into a shard,
spilling it once it reaches ``_SHARD_TARGET_BYTES`` (so a country file produces a few hundred
shards rather than one per ~8k-element block -- far less per-file open/read overhead when
collect re... |
5b077b39dd968609cbf19f4bb7eef254daeac85cb2465fcee03fe9b11edc9d39 | Python | 42,213 | 1,144 | # Copyright 2025 Google.
#
# 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, soft... |
ad864a71fec31bfe784468efbb30283e7a8b9fb04656305f02aea43921230dba | Python | 42,218 | 1,009 | import logging
from collections.abc import Callable
from datetime import datetime
from enum import Enum
from typing import (
cast,
NamedTuple,
)
from urllib.parse import urlparse
from pydantic import (
BaseModel,
ValidationError,
)
from sqlalchemy import (
and_,
delete,
false,
func,
... |
616510f6f9deac443e50c1b36026a2139b8ad88fb431c84e5f1168109be90536 | Python | 42,233 | 1,102 | # Copyright 2025 Google.
#
# 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, soft... |
93941aa0097ac936856ee8f0c3b022b37d951b6787ea600416a5e96d89c71b94 | Python | 42,268 | 1,100 | #!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
import math
import numpy as np
import slowfast.models.losses as losses
import slowfast.utils.distributed as du
import slowfast.utils.logging as logging
import torch
import torch.nn as nn
import torch.nn.functional as F
from... |
267791b1f392e4d3839cb78f2665db3b5d104b655f72223b2d2881c74cf16b11 | Python | 42,273 | 1,264 | # --- THIS FILE IS AUTO-GENERATED ---
# Modifications will be overwitten the next time code generation run.
from plotly.basedatatypes import BaseLayoutHierarchyType as _BaseLayoutHierarchyType
import copy as _copy
class Annotation(_BaseLayoutHierarchyType):
_parent_path_str = "layout.scene"
... |
292c9f9d1a5b05a462a91932d25d18b5a79f344decf810973b72aec48634a707 | Python | 42,277 | 804 |
# this is a parameter defition import shared across all the alignment top level scripts.
# the parameters are defined per experiment (different for different experiment alignments).
# NOTE: defaults for any parameters that are set by argparse (command line) are defined in the
# individual scripts and not here.
# xxx... |
7c6aa334219824dbe6e20b754e324bffa841fbbb5a1b18e3bbea388b5e35a6fe | Python | 42,281 | 1,173 | import datetime
import glob
import json
import logging
import os
import socket
import subprocess
import time
import traceback
from optparse import OptionParser
import bottle
import netifaces as ni
from ethoclient import listenerIsAlive, send_command
from zeroconf import ServiceInfo, Zeroconf
from ethoscope.control.re... |
287a31b676aa3a95efcc26eac4aab1e8ed27a88d6d9d5b62351abc72c4f182f1 | Python | 42,382 | 1,259 | from functools import partialmethod, partial
from scipy.stats import truncnorm
import math
import numpy as np
import torch
import torch.nn as nn
from typing import Tuple, Sequence, Optional, Union, List, Callable
import math
from src.layers.openfold.chunk_utils import chunk_layer
from src.layers.openfold... |
e219eff2debf2309700ea9b2b491164bccb666e8f7757713d5f580c21d7ae4bb | Python | 42,386 | 814 | import pickle
import torch
import torch.nn.functional as F
from trainingUtils import NBLoss,_convert_mean_disp_to_counts_logits #,MultipleOptimizer, MultipleScheduler, compute_kernel, compute_mmd
from models import Encoder,Decoder,GaussianDecoder,VAE,CellStateEncoder,\
CellStateDecoder, CellStateVAE,... |
80159d2e3a080a1e3267a0f48c08d20d147b98f14c0a0a715a5533484baf0f29 | Python | 42,471 | 842 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
30_external_replication.py — 外部重复 + 流水线自校验
================================================================================
在【三套互相独立、完全公开】的人血浆 Olink 蛋白组数据上,检验路线 A 的核心命题:
器官特异性蛋白质组衰老时钟,是否对「疾病活动度」而非「衰老进程」敏感?
三套数据集
----------------------------------------------------... |
bc2b14e790225db78917a9f221d6226a8ea6265d92b3a4aa17394c07b73eeccf | Python | 42,544 | 1,392 | """
Contains wrapper class for datasets.
"""
from __future__ import print_function
from __future__ import division
from __future__ import unicode_literals
import json
import os
import math
import numpy as np
import pandas as pd
import random
from dcCustom.utils.save import save_to_disk, save_metadata
from dcCustom.util... |
53e13d970888ee0354afe44933eeb07e4687ad594a691187fdafb18c891ec8ba | Python | 42,598 | 1,252 | # Copyright (c) 2024, Tri Dao.
# Implement dropout + residual + layer_norm / rms_norm.
# Based on the Triton LayerNorm tutorial: https://triton-lang.org/main/getting-started/tutorials/05-layer-norm.html
# For the backward pass, we keep weight_grad and bias_grad in registers and accumulate.
# This is faster for dimensi... |
29ffff2b70ce4d164dcb71090a98e6be62dacc3c01442173105302c2998e6f9b | Python | 42,692 | 1,119 | import os
import warnings
import random
import itertools
import numpy as np
import torch
from sklearn.mixture import GaussianMixture
import matplotlib as mpl
import matplotlib.pyplot as plt
from tqdm.auto import tqdm
import ipywidgets as widgets
from tlib import tutils
from ..utils.generator import TensorGenerator
fr... |
de9a182b597f87db47779b38f10fff0cc5718dbdb1cbc7befedde39db5a25f52 | Python | 42,708 | 1,039 | #!/usr/bin/env python3
"""
File: manim_scene.py
Created: 2022/02/02
Last Changed: 2022/07/20
Author: M.Vochteloo
Copyright (C) 2020 University Medical Center Groningen.
A copy of the BSD 3-Clause "New" or "Revised" License can be found in the
LICENSE file in the root directory of this source tree.... |
0d7f84a47106147496bab5ba60b3da3ba58dbbb160faf3abcfcd675f376ae947 | Python | 42,785 | 1,265 |
# coding: utf-8
# In[1]:
# OpenOE_AC_map_v1_01, 06/30/15
#__version__=1.02
#__version__=1.03 # removing the initial gap (acquired when Open Ephys is initialized)
"""
__version__=1.04 # 07/03/15, adding saving the averaged file into an hdf5-file
__version__=1.05 # fixing the averaging, AAC
__version__=1.06 # fixed va... |
b8984a6b0929a6927caef127c707d1d058ac26ade8c29b723c08cc7d9a01f398 | Python | 42,809 | 993 | # Copyright (c) 2022 PaddlePaddle Authors. All Rights Reserved.
#
# 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 app... |
aa1cd788c5e09d17993ebe2971aaeced792a304aec1dddf1fce838647cf89965 | Python | 42,867 | 922 | """Torch Classification Estimator"""
# pylint: disable=unused-variable,bad-whitespace,missing-function-docstring,logging-format-interpolation,arguments-differ,logging-not-lazy, not-callable
import math
import copy
import os
import logging
import time
import warnings
import pickle
from contextlib import suppress
from PI... |
50abb842bc8526c6644014aea79af2f2b487033a8f221f66d134551fa17ffced | Python | 42,924 | 676 | __author__ = 'Aaron Gudmundson'
__email__ = 'agudmund@uci.edu'
'''
This python script contains a dictionary of N metabolites
commonly seen in-vivo within the human brain.
Each metabolite is contained within a sub-dictionary
with the following:
- Name : Metabolite Name #
- Omega... |
4c6e5737f320c8d0c8894453189d645be80f85f0efeb46cb99b3e77de9a4e4f7 | Python | 43,006 | 1,227 | import warnings
from copy import deepcopy
import numpy as np
from numpy.linalg import eigvals, inv, svd
from scipy.linalg import sqrtm
from scipy.sparse.linalg import eigs
from scipy.special import comb
from sklearn.cluster import KMeans
from mudcod.network_distances import Distances
_eps = 10 ** (-10)
CONVERGENCE_C... |
b80c41422dfdc05a629da40c5ebeaec13ae1553544dd684972d49e1f38b1b7ec | Python | 43,020 | 1,018 | """
gen_analysis_plots.py
This script contains functions to plot results of ROI and running analyses on
specific sessions (gen_analys.py) from dictionaries.
Authors: Colleen Gillon
Date: October, 2018
Note: this code uses python 3.7.
"""
import copy
import warnings
from pathlib import Path
import numpy as np
f... |
b262cc6308f17fbd6bf8f7dfd2b199efbd2acbcf34e46d26a7dea894b3c7966d | Python | 43,022 | 516 | from __future__ import print_function, division, absolute_import
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.utils.model_zoo as model_zoo
import os
import sys
__all__ = ['BNInception', 'bninception']
pretrained_settings = {
'bninception': {
'imagenet': {
# W... |
617a2ab0c6aada95cd1385af92aa14fefbc0fe66e2cd11e1478edd9f3bff7521 | Python | 43,025 | 1,327 | # -*- coding: utf-8 -*-
# czifile.py
# Copyright (c) 2013-2017, Christoph Gohlke
# Copyright (c) 2013-2017, The Regents of the University of California
# Produced at the Laboratory for Fluorescence Dynamics.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, a... |
fdcfe34116a1350c01a0d33306bb03b8f6e574d312c9acf51979bd7e92dec79b | Python | 43,086 | 952 | """
Google Cloud Batch Job Runner
This runner submits Galaxy jobs to Google Cloud Batch for execution.
"""
import json
import logging
import os
import time
from typing import (
Any,
)
from google.api_core import exceptions as gcp_exceptions
from google.auth import default
from google.cloud import batch_v1
from ... |
be4b195705d517932e81cf1eacf45475e2f460e6d260e99a7f0f156bf37afabf | Python | 43,181 | 894 | """Functions for building the features for the AlphaFold-3 inference pipeline."""
import copy
import dataclasses
from functools import partial
import json
import os
import time, gzip, pickle
from typing import Mapping, List, Dict
import numpy as np
import pathlib
import logging
import collections
from datetime import d... |
e68363fc4cce1b61960adaaa4b85b2834ebd3901e9dae8016b4afda4f16e4746 | Python | 43,186 | 980 | ### PREREQUISITES
import graph_nets as gn
import sonnet as snt
import tensorflow as tf
import logging
tf.get_logger().setLevel(logging.ERROR)
import numpy as np
from itertools import combinations
import itertools
import matplotlib.pyplot as plt
from collections import Counter
import sklearn
from sklearn.... |
1299ad3560eb305f507df975c8d8e91ac8c2e415ce0906684c53c0864f7ff074 | Python | 43,215 | 1,080 | import torch
import torch
import torch.nn as nn
import logging
import numpy as np
import torch.nn.functional as F
import math
import os
import yaml
from ruamel import yaml as ryl
import scipy.io as sio
import datetime
def setup_runtime(args, saveyaml=False):
"""Load configs."""
# Setup CUDA
... |
7225a2c74d0b2ad1d241f8a2173bcb6412d6cf2ff80cbe23c833143c9620a403 | Python | 43,222 | 1,104 | # Author: Christian Brodbeck <christianbrodbeck@nyu.edu>
"""PySurfer Brain subclass to embed in Eelbrain"""
from distutils.version import LooseVersion
from functools import partial
import os
import sys
from tempfile import mkdtemp
from typing import Sequence
from time import time, sleep
from warnings import warn
from ... |
200929fba8b71efd272f405855014a61124349ebe18212b2a49423e82ee2f2b1 | Python | 43,281 | 847 | import argparse
import random
import time
from collections.abc import Iterable
from typing import List, Set, Tuple
import numpy as np
from ...logging import logger_manager as lm
from .MuSIC import MuSIC
np.random.seed(888)
random.seed(888)
# To allow for running by function definition (for more flexible option)
de... |
cb91c895b14d7569ff71455e164753c71105f8c591599e06471bd8d2c18499ce | Python | 43,363 | 1,201 | """Tigramite toymodels."""
# Author: Jakob Runge <jakob@jakob-runge.com>
#
# License: GNU General Public License v3.0
from __future__ import print_function
from collections import defaultdict, OrderedDict
import sys
import warnings
import copy
import math
import numpy as np
import scipy.sparse
import scipy.sparse.lina... |
a81a071d6311bf788e4529ff55167e5889151d3a119c8b5761ed553d6eeddbb8 | Python | 43,420 | 1,236 | import itertools
import warnings
from functools import partial
import jax
import numpy as np
from keras.src import backend
from keras.src import callbacks as callbacks_module
from keras.src import optimizers as optimizers_module
from keras.src import tree
from keras.src.backend import config
from keras.src.backend im... |
0eef76b7ba8b1d7960d184eb56108b31423bc8fb7596d2e60421633393b10184 | Python | 43,450 | 1,045 | """Redis result store backend."""
import select
import selectors
import threading
import time
import warnings
from contextlib import contextmanager
from functools import partial
from ssl import CERT_NONE, CERT_OPTIONAL, CERT_REQUIRED
from urllib.parse import unquote
from kombu.utils import symbol_by_name
from kombu.ut... |
a29af177f434a47cc6267e48469e63e429f4f33061894c286982006d4b29329a | Python | 43,479 | 1,359 | """
Data layer behind the model inspector.
Loads a model into an editable draft, applies module and mode changes to it,
and validates the result before it is stored.
"""
from __future__ import annotations
from numbers import Real
from types import SimpleNamespace
from typing import Any
import pandas as pd
from lar... |
ae1ae90fdba901a62a2f1ba2823543b0bb34cf1bc6e71e61758a2245d1679e2a | Python | 43,497 | 1,166 | """The periodic task scheduler."""
import copy
import dbm
import errno
import heapq
import os
import shelve
import socket
import sys
import time
import traceback
from calendar import timegm
from collections import namedtuple
from functools import total_ordering
from pickle import UnpicklingError
from threading import ... |
d073abe904ee00566c03fd148488b35e02b056674bd375513cb7b6e619ba8311 | Python | 43,514 | 1,008 | # Copyright (c) 2022 PaddlePaddle Authors. All Rights Reserved.
#
# 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 app... |
c21adc7e350d325ec1965c4ef588c71a26df785915067b3200ce849462daebda | Python | 43,515 | 1,241 | from __future__ import annotations
import copy
import random
from typing import Optional
import pytest
import torch
import torch.nn as nn
from pytest_mock import MockerFixture
from torch import Tensor
from torch.nn import Identity, Parameter
from lightly.models import utils
from lightly.models.utils import (
_ma... |
d112fd5a9e7874c3677f1bf0bc787063d92a38c12a3fcc8cb59471d268c680db | Python | 43,518 | 900 | '''Settings computed from the images before an LDDMM fit.
* :func:`affine_prefit`: a coarse affine pre-alignment. Many starts (rotations of the
initial affine in 2D; tilted and shifted planes in 3D) are fitted at once on mean-pooled
images, the best one is refined at a finer level, and LDDMM starts from the resul... |
43cb5df68c12be23c25f5cabfb1af13156593d2fd11ea0e0aa99c891a6169dbf | Python | 43,532 | 1,286 | """
Title: SpatialBasePlot for all spatial coordinates and image plot
Author: Duy Pham
Date: 20 Feb 2021
"""
from lib2to3.pgen2.token import OP
from typing import Optional, Union, Mapping, List # Special
from typing import Sequence, Iterable # ABCs
from typing import Tuple # Classes
import numbers
import numpy as ... |
694529ad1b111ed85c6ec6e67348f30089834d664009f2faf8ecee4a79a9eee2 | Python | 43,535 | 1,234 | """
rgenetics datatypes
Use at your peril
Ross Lazarus
for the rgenetics and galaxy projects
genome graphs datatypes derived from Interval datatypes
genome graphs datasets have a header row with appropriate columnames
The first column is always the marker - eg columname = rs, first row= rs12345 if the rows are snps
su... |
1b0e0c7b41deb5e4282728703c24e0e759a0772e46de3c54a624ec4d884d6b8e | Python | 43,543 | 978 | """
Manager and Serializer for Datasets.
"""
import glob
import logging
import os
from typing import (
Any,
TypeVar,
)
from sqlalchemy import select
from galaxy import (
exceptions,
model,
)
from galaxy.datatypes import sniff
from galaxy.exceptions import ObjectInvalid
from galaxy.managers import (
... |
ec4ab39b9ce456a8d108377dd9aebdb48cd703a47d45462e051fca1b97b70c89 | Python | 43,564 | 1,185 | """Tests for lazy toggle-gated decoration architecture.
Covers: lazy wrapping lifecycle, toggle state, detached imports, sys.modules
crawl, permanent model preparation, pause_logging, functools.wraps
transparency, decorated identity, JIT compatibility, wrap/unwrap, and
exception/interrupt safety.
"""
import gc
import... |
c4daf9417554499e1947df308c1d05be87cf93c1851ec13a1715f5d377c75c9f | Python | 43,568 | 1,140 | # Copyright (c) 2022 PaddlePaddle Authors. All Rights Reserved.
#
# 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 app... |
29f7d756d9c2a4a6443971af9547443a9d9d0bd430830ce10b9b063682443c86 | Python | 43,582 | 951 | #!/usr/bin/env python
import sys
import argparse
import glob
import errno
import math
import re
import matplotlib
matplotlib.use('Agg')
from matplotlib import pyplot as plt
import matplotlib.colors as cc
import matplotlib.lines as line2d
from matplotlib.ticker import MaxNLocator # added
import matplotlib.lines
import ... |
cc05963ed765475525bc8970a9cb9b8f6cec695ad8271ada59f6ac440dc877a8 | Python | 43,594 | 975 | # %%
# import os, sys
# import json, random
# import io
# import base64
# import tempfile
# from PIL import Image
# from lxml import etree
# from copy import deepcopy
# import nrrd,PIL.Image,re,IPython.display
# current_path = os.getcwd()
# main_path = os.path.abspath('../') #'/cortexdisk/data2/NestorRembrandtCollab/'... |
cf5356f71babc16b164338b2c5d83c3162552e31e6a40159c3e72f2c950e6f22 | Python | 43,622 | 931 | import pandas
import numpy
import scipy
import datetime
import logging
import geopandas
from tqdm import tqdm
from igraph import *
from math import sqrt, sin, cos, pi, asin
from ..utils import utils
from ..core.trajectorydataframe import TrajDataFrame
from ..models.markov_diary_generator import MarkovDiaryGenerator
'... |
075483669db7a87048cf6a6f5096871aa94d939312d2bc639ca171ecccaa96a0 | Python | 43,660 | 1,114 | """
MIT License
Copyright (c) 2017 Jake Gardner
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, ... |
d99d662aa605760daa012415b505fd3523b61bd24a36b74300b709d1222bcd18 | Python | 43,664 | 1,217 | import os
import threading
import time
import traceback
import unittest
from unittest import mock, skipIf
from unittest.mock import Mock, patch, MagicMock
from threading import Event
from typing import List, Any
from carbontracker.emissions.intensity.intensity import IntensityFetch
import numpy as np
from carbontracke... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.