sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
ae26f10bc664371924043ca3499f0fd9ff09eb2e72e20f8893e939841819731e | Python | 31,567 | 872 | import copy
import pytest
import networkx as nx
# Unit tests relevant for both functions in this module.
def test_positive_iters():
G1 = nx.empty_graph()
with pytest.raises(
ValueError,
match="The WL algorithm requires that `iterations` be positive",
):
nx.weisfeiler_lehman_grap... |
8486a427dc30e890e9e4d2f0facd4418b430da7e6ea71db009602333f5292ef8 | Python | 31,601 | 748 | #!/usr/bin/env python3
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
# pyre-strict
from contextlib import ExitStack
from unittest.mock import Mock, patch
import numpy as np
import torc... |
471c9908d7b5eae081d525592d57eca0c4a876eb12570f89fc3f78675227562f | Python | 31,619 | 551 | # -*- coding: utf-8 -*-
"""Extract corpus statistics from the local SimBA use-case paper PDFs and write a
small, committable JSON that the docs renderer consumes.
The PDFs themselves are NOT in the repo (they live locally, e.g. F:\\simba_papers) and
cannot be reached by the CI/ReadTheDocs build. This script is the LOC... |
97102cd25d02a5bc4c22c8a39bb94056efe1c95f50eed845923aabcd1f3f1bf0 | Python | 31,632 | 802 | '''
'''
#
# Adapted from MATLAB code written by S. Nishimoto (see Nishimoto, et al., 2011).
# Anwar O. Nunez-Elizalde (Jan, 2016)
#
# Updates:
# Anwar O. Nunez-Elizalde (Apr, 2020)
#
#
# Implementation notes:
#
# The terminology here is "pyramid" and "filters".
# In moten.core, the termilogy is inconsistent.
#
# TODO:... |
ba336d1bfdc9118b62e94a431181a8f6837ecbec9d04c9e1e4af8ba7d9830215 | Python | 31,643 | 825 | """
Galaxy Metadata
"""
import copy
import json
import logging
import os
import sys
import tempfile
import weakref
from collections import OrderedDict
from collections.abc import (
Iterator,
Mapping,
)
from os.path import abspath
from typing import (
Any,
Optional,
TYPE_CHECKING,
Union,
)
from... |
2716e86c270415dbda0d9ccfc65d0f061c1bf1cbb55b230d4dc847f262b1abbd | Python | 31,645 | 625 | '''
The script to test the trained models to learn pairwise potential, including PIGNPI and baseline
'''
import os
os.environ["CUDA_DEVICE_ORDER"]="PCI_BUS_ID"
os.environ["CUDA_VISIBLE_DEVICES"] = "0"
import numpy as np
import torch
from torch.autograd import Variable
from matplotlib import pyplot as plt
import pickl... |
e2764af702c1238fe215ad311d73ac61e9605012ee2d3d2e4611a3d74934fdfc | Python | 31,665 | 753 | """Detecting communities based on the Leiden Community Detection algorithm"""
import functools
import itertools
import math
import random
from collections import deque
import networkx as nx
from networkx.algorithms.community.quality import constant_potts_model, modularity
from networkx.utils import not_implemented_fo... |
c4249587649809a27fcb8959f5d881126c6731897d9659ad49bff9da90410ae1 | Python | 31,672 | 739 | import logging
from typing import (
Any,
cast,
Literal,
Optional,
Union,
)
from uuid import uuid4
from pydantic import (
BaseModel,
UUID4,
ValidationError,
)
from galaxy.exceptions import (
Conflict,
InternalServerError,
ItemOwnershipException,
MessageException,
Obj... |
68eb4f13d0628bc05f5ab1fb1e91a44535f0be8b2b45da98fd4dc7f0d35286c7 | Python | 31,693 | 810 | from datetime import datetime
from enum import Enum
from typing import (
Annotated,
Any,
Generic,
Literal,
Optional,
Union,
)
from pydantic import (
BaseModel,
ConfigDict,
Field,
RootModel,
UUID1,
UUID4,
)
from typing_extensions import (
TypeAliasType,
)
from galaxy... |
ae2e8f2eb8e71b274655f68b664be836ae3badb91028a5d29793643595932df6 | Python | 31,704 | 764 | # Copyright (C) CVAT.ai Corporation
#
# SPDX-License-Identifier: MIT
from __future__ import annotations
import unittest
from typing import cast
import datumaro as dm
import numpy as np
from cvat.apps.quality_control.backends.datumaro.matching import (
AttributeMatchingResult,
Comparator,
ComparisonParam... |
e843b53a3426756d68f29fbcd28abab6cfd5d37efb3a1615d06144616e892aa3 | Python | 31,711 | 958 | # Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... |
be2c9af323134931d4515beed5cdaa7acb22eefea2ebc5b16eabe6c34a29e528 | Python | 31,733 | 687 | #!/usr/bin/env python3
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
# pyre-strict
import logging
from abc import ABC, abstractmethod
from collections.abc import Iterable
from logging i... |
2b11e45753f39b027d67dc97f10d31f7d4d966c1672e9cadb149a63506b15fd2 | Python | 31,743 | 873 | import math
from typing import Callable, Optional
import numpy as np
import torch
import torch.nn as nn
from .. import base, functional, surrogate
from .base_node import BaseNode
from .lif import LIFNode
__all__ = [
"GatedLIFNode",
"KLIFNode",
"ComplementaryLIFNode",
"CUBALIFNode",
"LIAFNode",
]
... |
7fd97c328b7db9ed0f27a01891682c63979c7a6de379f92bb8766266d78cd79f | Python | 31,763 | 763 | #!/usr/bin/env python3
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
# pyre-strict
import warnings
from ax.core.metric import Metric
from ax.core.objective import MultiObjective, Objec... |
8c92b4b2a171bbc48e6eb6e20f71779594f399719dc44e490c9c2500fe884021 | Python | 31,804 | 816 | import pathlib
import subprocess
import warnings
from collections import defaultdict
from concurrent.futures import ProcessPoolExecutor, as_completed
import dask
import joblib
import numpy as np
import pandas as pd
import pybedtools
import pyBigWig
import xarray as xr
from sklearn.model_selection import train_test_spl... |
38ee3c72c242658dd6259d136fca8fd72e2ad2b458e5c4c2d2693699988fc885 | Python | 31,850 | 644 | """
Execute an external process to set_meta() on a provided list of pickled datasets.
This was formerly scripts/set_metadata.py and expects these arguments:
%prog datatypes_conf.xml job_metadata_file metadata_kwds,metadata_out,metadata_results_code,output_filename_override,metadata_override... max_metadata_value_... |
3713d14e8de20d7546d34a421844cd8394d85bdb25e55b561f26d66ff222a011 | Python | 31,851 | 714 | import logging
import os
import re
import shutil
from typing import (
Any,
Optional,
TYPE_CHECKING,
Union,
)
from urllib.error import HTTPError
from markupsafe import escape
from sqlalchemy import (
and_,
false,
)
from typing_extensions import TypeIs
from galaxy import util
from galaxy.model.b... |
e68c3a35d19ae92eded8f931c2a38ad72420788f59486162c1ea52154deea51d | Python | 31,889 | 529 | import datetime
import optuna
import pandas as pd
import sklearn
import sklearn.inspection
import numpy as np
import shutil
import time
import csv
import gc
import pathlib
import torch.cuda
import tensorflow as tf
from ..preprocess import base_dataset
from ..utils import helper_functions
from ..evaluation import eval... |
608020e9c5940d11bfcd8dc814e79dc4a11246b2eb69371618781d25d7e24ba8 | Python | 31,893 | 1,026 | """Expressions for the intermediate representation and auxiliary functions."""
import inspect
import logging
import operator as op
import threading
import types
import typing
from contextlib import contextmanager
from functools import WRAPPER_ASSIGNMENTS, lru_cache, wraps
from itertools import chain
from warnings impor... |
b8db1f76649c6e70f86ac56e8bf876c0dffdbbc0148e22bad7ce69021fcf65b8 | Python | 31,912 | 920 | """
Read graphs in GML format.
"GML, the Graph Modelling Language, is our proposal for a portable
file format for graphs. GML's key features are portability, simple
syntax, extensibility and flexibility. A GML file consists of a
hierarchical key-value lists. Graphs can be annotated with arbitrary
data structures. The ... |
df3212ab8a671f64a0ed0c325868c3feb98c465ab50cd6f14f94dbc4b857c222 | Python | 31,923 | 807 | #!/usr/bin/env python3
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
# pyre-strict
import itertools
import logging
from collections import namedtuple
from collections.abc import Callabl... |
0f010e4701e3240db008be31e27f1a8f6c960b49fb49bf946e20cc81f53a7f83 | Python | 31,934 | 878 | """
Magic Sets [1] rewriting implementation for Datalog.
[1] F. Bancilhon, D. Maier, Y. Sagiv, J. D. Ullman, in ACM PODS ’86, pp. 1–15.
"""
from abc import ABC, abstractmethod
from typing import Iterable, List, Set, Tuple
from nl_expr.expressions import (
Constant,
Expression,
FunctionApplication,
S... |
98361a303d5437b30fb4d269f9d2eb87a29b3a54c29e6fdee5a463622834f950 | Python | 31,959 | 879 | import multiprocessing
import pathlib
from collections import OrderedDict
import anndata
import joblib
import numpy as np
import pandas as pd
import pynndescent
from scipy.cluster.hierarchy import linkage
from scipy.sparse import issparse
from scipy.stats import zscore
from sklearn.decomposition import PCA
from sklear... |
38ff9a489f3598d0d21a16977c112adb6c6b242260362063d4fb7426175d6121 | Python | 31,993 | 839 | """Tests for the line editing of the interactive REPL."""
import io
import threading
import time
import pytest
pytest.importorskip("prompt_toolkit")
pytest.importorskip("rich")
from prompt_toolkit.completion import CompleteEvent # noqa: E402
from prompt_toolkit.document import Document # noqa: E402
from prompt_to... |
3bff7ed0d9c13f92bbde4ed814fdee918558f8c7685ca13cc9634921b30867cb | Python | 31,995 | 822 | """
Copyright © 2023 Howard Hughes Medical Institute, Authored by Carsen Stringer and Marius Pachitariu.
"""
import sys, os
import numpy as np
import matplotlib.pyplot as plt
import shutil
from natsort import natsorted
from glob import glob
from pathlib import Path
import string
import matplotlib.pyplot as plt
from ma... |
a1d9f293b0a02db30623642e1f18f704f457e1c09f5872b937ae6b8f48cc2d6f | Python | 32,048 | 1,014 | """Unit tests for the traveling_salesman module."""
import random
import pytest
import networkx as nx
import networkx.algorithms.approximation as nx_app
pairwise = nx.utils.pairwise
def test_christofides_hamiltonian():
random.seed(42)
G = nx.complete_graph(20)
for u, v in G.edges():
G[u][v]["w... |
2a0975ab113726623ae3193dc3545d844267bf48d271d236b867cd4fb6d4b20f | Python | 32,106 | 864 | """
Flow based connectivity algorithms
"""
import itertools
from operator import itemgetter
import networkx as nx
from networkx.algorithms.approximation.connectivity import (
local_node_connectivity as approx_local_node_connectivity,
)
# Define the default maximum flow function to use in all flow based
# connect... |
b30c9ca1cfb558c7011bc7bce4debacfefcbdc80f10c6f4f60a57aba95200090 | Python | 32,113 | 973 | """
Image classes
"""
import base64
import io
import json
import logging
import math
import struct
from collections.abc import Iterator
from typing import (
Any,
Literal,
Optional,
Union,
)
import mrcfile
import numpy as np
import png
import pydicom
import tifffile
try:
import PIL
import PIL.... |
117adbb8ee8c29bb56f39f01f8a8343914ff4d60a239c7592b582d397f9f5fa1 | Python | 32,116 | 625 | import tensorflow as tf
import numpy as np
import learnMSA.legacy.Initializers as initializers
import learnMSA.legacy.Priors as priors
from learnMSA.legacy.Utility import get_num_states, get_num_states_implicit, deserialize
from packaging import version
if version.parse(tf.__version__) < version.parse("2.10.0"):
fr... |
10231552785ebdf74afd2c70304d0dc4e20dfbaafd114a332bebdf926446db87 | Python | 32,131 | 615 | """
Job control via the DRMAA API / qstat and qacct.
Known to work on the UNIVA grid engine.
known bugs/problems:
- if a job runs longer than the time limits of the queue two things happen
1. at the soft limit (s_rt) SIGUSR1 is sent to the job
2. at the hard limit (h_rt) SIGKILL is sent to the job
The second... |
5cc617ed7af5df8df9ecb2e1dc3622a07097065856583339ec7251cd60ce5a7f | Python | 32,147 | 891 | """This module describes the :class:`MulledContainerResolver` ContainerResolver plugin."""
import json
import logging
import os
import subprocess
import threading
import weakref
from abc import (
ABCMeta,
abstractmethod,
)
from typing import (
Any,
Callable,
Container as TypingContainer,
Dict,
... |
c6e59950863531239bd71e054e9508809585653c39bf68dbc786f0541f94323b | Python | 32,147 | 727 | from __future__ import annotations
import math
from collections.abc import Callable
import torch
__all__ = [
"stdp_linear_step",
"mstdp_linear_step",
"mstdpet_linear_step",
"stdp_conv1d_step",
"stdp_conv2d_step",
"mstdpet_reward_step",
]
def _check_time_constants(
*, exponential: bool ... |
baf359d8106c6499d77e0d148f35defe07beb3068e6d12dcce2aa17ff68122c1 | Python | 32,148 | 1,073 | # -*- coding: utf-8 -*-
"""
Elastix
=======
Interface to Elastix for alignment of volumetric data.
The elastix documentation can be found `here <http://elastix.isi.uu.nl/>`_.
In essence, a transformation :math:`T(x)` is sought so that for a fixed image
:math:`F(x)` and a moving image :math:`M(x)`:
.. math::
F(... |
64b4fa027e9e6f9e6735333c9776642ab8b90963f36bdf9e4c2aeb98d3e708e1 | Python | 32,159 | 845 | import functools
import importlib
import inspect
import os
import sys
import types
import warnings
from collections import defaultdict
from re import sub
import errr
from .._package_spec import warn_missing_packages
from .._util import get_qualified_class_name
from ..exceptions import (
AttributeOrderError,
B... |
b3ff025347adf81a6688f078a7e02e5fd5806ae5deda51009405b96c31e5ed94 | Python | 32,198 | 825 | import datetime
import json
import logging
import math
import os
import re
from concurrent.futures import (
as_completed,
ThreadPoolExecutor,
)
from typing import (
Any,
cast,
Literal,
Optional,
)
from urllib.parse import quote
from typing_extensions import (
TypedDict,
)
log = logging.get... |
dd12cbf45121db64f0b2a8b48fcb0ef0641397777ab4acd05a2525f91856e6f0 | Python | 32,248 | 798 | """
Copyright © 2025 Howard Hughes Medical Institute, Authored by Carsen Stringer , Michael Rariden and Marius Pachitariu.
"""
import logging
import traceback
from qtpy import QtGui, QtCore
from qtpy.QtGui import QPixmap, QDoubleValidator
from qtpy.QtWidgets import QWidget, QDialog, QGridLayout, QPushButton, QLabel, QL... |
1d4b2c8a445a4c84abbf2c78aa07df06ddcbe817374d9d6b311c93118ba6018c | Python | 32,326 | 809 | # Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... |
28edfd2392bb91b5362cfd056276060230c14305d65b27b62481e43945427d3a | Python | 32,342 | 757 | # 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... |
27fae465c86028faa746dbababf873a5906a2b0e47cba82808466fbf0109bf56 | Python | 32,344 | 831 | # Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
# pyre-strict
from logging import Logger
from unittest.mock import MagicMock
import pandas as pd
from ax.adapter.registry import Generato... |
454ef6d03aa3ea7426cf3a4b3f918c699507144d6fe59d273d2748ff06072014 | Python | 32,409 | 832 | #!/usr/bin/env python3
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
# pyre-strict
from collections.abc import Callable, Iterable, Sequence
from copy import deepcopy
from datetime impor... |
984fc5fe69c436d8a3eedd239dc865de0729b89ab69422bb503682a361779b41 | Python | 32,416 | 916 | """
Tests for ISMAGS isomorphism algorithm.
"""
import random
import pytest
import networkx as nx
from networkx.algorithms import isomorphism as iso
graph_classes = [nx.Graph, nx.DiGraph, nx.MultiGraph, nx.MultiDiGraph]
def _matches_to_sets(matches):
"""
Helper function to facilitate comparing collections... |
11cdec9d759f2a3e39a8c42e12f1782b1bf1696b875adca38e788e6adeadd2f3 | Python | 32,425 | 765 | # Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... |
719bc3fcba0da6eade6b4473bf4d98c172bff853713b4fe0792bb498dfff1ba4 | Python | 32,438 | 810 | import random
import sys
from os import path
import tensorflow as tf
import numpy as np
import pandas as pd
from Bio.Seq import Seq
import threading
import pybedtools
import os
import glob
from maxatac.architectures.dcnn import get_dilated_cnn
from maxatac.utilities.constants import BP_RESOLUTION, BATCH_SIZE, CHR_POO... |
d4d9cc70f6a8a63b6e13655e4c6cf04da549ad20641490041f2c56f07fc984f5 | Python | 32,448 | 1,146 | from operator import add, contains, eq, gt, mul, not_
from typing import AbstractSet, Callable, Tuple
import numpy
import pytest
from nl_expr import exceptions
from nl_expr.exceptions import NeuroLangException
from nl_expr.expression_walker import expression_iterator
from nl_expr.expressions import Constant, Function... |
87d8dc876a52f3acb8477ea92914b72ce61409514d209311c236787c90ed278e | Python | 32,452 | 952 | # Copyright (c) 2010-2018 Benjamin Peterson
#
# 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, publi... |
ab21e5478592673cbba69d1892c39e9175b9811f7fd206de0b6c92b118d941f1 | Python | 32,487 | 882 | # Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... |
4b7d8acb4ab03d9e2433be796faff908e5bb4e4b1efb493e768920bc166a015d | Python | 32,513 | 865 | ""# -*- coding: utf-8 -*-
"""
The *Resampling* module provides methods to resample and reorient volumetric
and point data.
Resampling the data is usually necessary as the first step to match the
resolution and orientation of the reference object.
Main routines for resampling are: :func:`~ClearMap.Alignment.Resamp... |
975b866ba336eac00ffac4cc048254ef25d645b4b7016f6b02695f361d53959d | Python | 32,525 | 937 | from __future__ import annotations
import re
import warnings
from itertools import product
from typing import TYPE_CHECKING
import h5py
import numpy as np
import pandas as pd
import pytest
import zarr
from numpy import ma
from scipy import sparse as sp
from scipy.sparse import csr_matrix, issparse
from zarr.storage i... |
5afab1049f05c6567a16a941fa7efa27870ea2d80eec8f7dae61455ed068eeae | Python | 32,650 | 923 | #!/usr/bin/env python3
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
# pyre-strict
import re
from copy import deepcopy
from typing import Any
import numpy as np
import numpy.typing as ... |
173f0149da13f9a853eff22c231f23d26e58f9b1de161f74e37f2567a928c0b9 | Python | 32,667 | 987 | import math
import operator
from nl_expr.exceptions import RelationalAlgebraError
from nl_expr.expression_walker import PatternWalker, add_match
from nl_expr.expressions import (
Constant,
FunctionApplication,
Symbol,
sure_is_not_pattern,
)
from .relational_algebra import (
BinaryRelationalAlgebraO... |
c0da665bfdef03bf4611a2b60dbb88cf06a2c74d7235aeee4a810d9540ba070a | Python | 32,680 | 747 | import math
from typing import Sequence, Union, Optional
import torch
import torch.nn as nn
from .. import base, surrogate
__all__ = [
"FewSpikeNode",
"FewSpikeTable",
"HGNode",
"OutlierAwareThresholdNode",
]
TensorLike1D = Union[torch.Tensor, Sequence[float]]
def _as_float_1d_tensor(name: str, ... |
985c62908be34305e954fd3f747c65cdac344d2da791841cc1f949725440f132 | Python | 32,683 | 942 | """Unit tests for the :mod:`networkx.algorithms.tree.mst` module."""
import pytest
import networkx as nx
from networkx.utils import edges_equal, nodes_equal
def test_unknown_algorithm():
with pytest.raises(ValueError):
nx.minimum_spanning_tree(nx.Graph(), algorithm="random")
with pytest.raises(
... |
ec2e35b6ad600083139a0cd544933f87a6dbe9affe4406e9dcb629786261e36f | Python | 32,703 | 655 | import os
import threading
import numpy as np
from tkinter import *
from tkinter.filedialog import askopenfilename # Removed askopenfilenames
from tkinter.filedialog import asksaveasfile
from tkinter import messagebox
import queue
from tkinter import ttk
from GUI import CustomButton
from GUI import Input
from GUI impo... |
daae2d42c46bce60febeac41c8437c2883fe3ecb13db3ad908489d5eed4e0f80 | Python | 32,711 | 974 | """This module contains a storage class and codec to support the N5 format.
"""
import os
import struct
import sys
from typing import Any, Dict, Optional, cast
import warnings
import numpy as np
from numcodecs.abc import Codec
from numcodecs.compat import ndarray_copy
from numcodecs.registry import get_codec, register... |
5b1e7ab60c78e0c0a0d1540883006400f0255cb444c1fa61198d12487c147ddb | Python | 32,786 | 873 | """Pretty-printer for named Relational Algebra expressions."""
import collections.abc
import operator
import re
from nl_expr.expressions import Constant, FunctionApplication, Symbol
from ..utils.relational_algebra_set import (
NamedRelationalAlgebraFrozenSet,
RelationalAlgebraFrozenSet,
)
from .relational_alg... |
fe00833c645fddb35f49a01614679690104abb13b6d2d38b616caed795a00563 | Python | 32,854 | 959 | import re
import copy
from contextlib import contextmanager
import scipy.sparse as sp
import networkx as nx
import torch
import numpy as np
from cogdl.utils import (
csr2coo,
coo2csr_index,
add_remaining_self_loops,
symmetric_normalization,
row_normalization,
get_degrees,
)
from cogdl.utils imp... |
ab0c66ce23ba2759b15195f8d7e0536ad7bd8e8730910dc40fdc4cc5c50e6dab | Python | 32,860 | 1,061 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sat May 7 12:39:16 2022
@author: juliuskernbach
R1 revision NNMF clustering
"""
# =============================================================================
# Import libraries
# ==========================================================================... |
583cb4272375388c14fef68376cc6a9ed3667f49c6488ed94b4c9460f9a884e9 | Python | 32,867 | 1,121 | """
Various small and named graphs, together with some compact generators.
"""
__all__ = [
"LCF_graph",
"bull_graph",
"chvatal_graph",
"cubical_graph",
"desargues_graph",
"diamond_graph",
"dodecahedral_graph",
"frucht_graph",
"generalized_petersen_graph",
"heawood_graph",
"... |
3cdd0ff72e444d31182867d6563858b7306974a9bab33590f8e5713d5b5cd71c | Python | 32,956 | 633 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon May 25 14:31:34 2020
This is the main script for processing scRNA-Seq Data through ScanPy.
@author: smith
"""
import numpy as np
import pandas as pd
import scanpy as sc
import scanpy.external as sce
import scprep
from skimage import io
import os
impor... |
d280c8762a84bd0fad90215e90dc75d1e3510dabdb7ce4f4a9878cab3845f140 | Python | 32,974 | 1,102 | """Generators for some classic graphs.
The typical graph builder function is called as follows:
>>> G = nx.complete_graph(100)
returning the complete graph on n nodes labeled 0, .., 99
as a simple graph. Except for `empty_graph`, all the functions
in this module return a Graph class (i.e. a simple, undirected graph)... |
484c1765951cac83026c064b3988d22b2d16ec6f4a47f419ba1852df55391662 | Python | 32,988 | 886 | """
This module includes the main class that handles
the data generation from the (input) PDB files.
"""
# Python import(s).
from pathlib import Path
import numpy as np
from pandas import DataFrame
from numba import njit
# BIO-python import(s).
from Bio.PDB.PDBParser import PDBParser
# Private import(s).
from src.ch... |
7d74e0b866100ca30b59f6f014b2e5c847fd1b09b673e5547c973b614fdf11fe | Python | 32,993 | 794 | #!/usr/bin/env python3
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
# pyre-strict
from copy import deepcopy
from math import nan
from unittest import mock
import numpy as np
from ax.a... |
19374ba38f29207b18dddbce23245fd7b315364b4560f24e22685d6bf1680275 | Python | 33,035 | 743 | # Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... |
3c2643add3d544d783ae8f86056de0ef1e0d87e24aa986956f6b70c3d0d88292 | Python | 33,054 | 979 | import itertools
import os
import pathlib
import tempfile
from dataclasses import dataclass
from pathlib import Path
from typing import Dict, Generator, List
import matplotlib.colors as colors
import natsort
import numpy as np
import pandas as pd
import pytest
import skimage.io as io
import xarray as xr
from alpineer ... |
80ad87b0a93c8361f6b8bec6c3873715dc1b4528398ca6fbb7210ced386465ac | Python | 33,066 | 841 | import numbers
from ..backend import get_backend
from ..utils import compute_lipschitz_constants
from ..utils import _batch_or_skip
from ._kernels import KernelCenterer
def _weighted_kernel_ridge_gradient(Ks, Y, dual_weights, exp_deltas, alpha=1.,
double_K=False, return_objective=... |
5141e4f363c8d9ba393c4bd02bfbd4f8fc88349b710cc0fcf751ac45b71409ab | Python | 33,095 | 571 | """
Build ``docs/data_inventory.rst`` and ``docs/_static/data_inventory/``: a page listing every piece of public SimBA data (OSF + Google Drive) and where it lives.
Inputs (made by the read-only crawlers in this folder, see ``README.md``):
osf_all.json every sgoldenlab OSF project, wiki and file
... |
05c325b5a3709b9221920ee180b36fde60893db1d590d4c00b427ec673a8d579 | Python | 33,163 | 868 | from typing import Any, Callable, Optional
import torch
import torch.nn as nn
from .. import base, neuron
from .._neuron import _make_multi_step_neuron
from .bn import BatchNorm2d
from .container import SeqToANNContainer
from .stateless_wrapper import Conv2d
__all__ = [
"TemporalWiseAttention",
"MultiDimens... |
0571517dfa6199e610b4bff13d87940fa34aff9eb732c36ca500840bf20eee2a | Python | 33,188 | 941 | """Provides pipeline for segmenting the cerebellum."""
# ---------------------------------------------------------------------------
# Authors: John G Samuelson <johnsam@mit.edu>
# Christoph Dinh <christoph.dinh@brain-link.de>
# Teemu Taivainen
# Created: September, 2021 (Modified: July, 2026)
# Licen... |
e04a6aac832303a68f829439764ceaa5f8caf4c43a45b7a45772585417b6fd06 | Python | 33,209 | 898 | """
Copyright © 2025 Howard Hughes Medical Institute, Authored by Carsen Stringer , Michael Rariden and Marius Pachitariu.
"""
import os, warnings, glob, shutil
from natsort import natsorted
import numpy as np
import cv2
import tifffile
import logging, pathlib, sys
from tqdm import tqdm
from pathlib import Path
import ... |
d381d0ac371f05bd8e4eb9168d1caf220ab702ff3e8216308095c003040d989d | Python | 33,240 | 660 | #!/usr/bin/env python
import argparse
__version__ = "3.0.0"
parser = argparse.ArgumentParser(
description="single cell RNAseq mixed genotype clustering using sparse mixture model clustering.")
parser.add_argument("-i", "--bam", required = True, help = "cellranger bam")
parser.add_argument("-b", "--barcodes", requi... |
b817e93504e663a113d338d60f95224eb93d4d5e4cef83c145f75e2769b2028b | Python | 33,249 | 881 | import warnings
import numpy as np
import pytest
import sklearn
import sklearn.kernel_ridge
import sklearn.utils.estimator_checks
from packaging import version
from himalaya.backend import ALL_BACKENDS, get_backend, set_backend
from himalaya.kernel_ridge import (
KernelRidge,
KernelRidgeCV,
MultipleKernel... |
dcd3c7951cf8cfbadf44396b53d1905da2889cb26138e59c591fd93edf63c2af | Python | 33,260 | 641 | import abc
import numpy as np
import torch
from torch import nn
from torch.distributions import Categorical
from torch.nn import functional as F
from utils import get_data_loader
from models import fc
from models.utils.ncl import additive_nearest_kf
class ContinualLearner(nn.Module, metaclass=abc.ABCMeta):
'''Abs... |
8640dab1fd77e6181bab1c3e77d7437c068b9bf0191c8a2a6a21787142f38b60 | Python | 33,290 | 986 | #!/usr/bin/env python3
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
# pyre-strict
import math
from collections.abc import Callable
from logging import Logger
from typing import Any
im... |
c162c591eba3bf73abe2e327ea8d4f522a5e2518b44de4c67eddbbc6cb946cd4 | Python | 33,394 | 841 | #!/usr/bin/env python3
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
# pyre-strict
import numpy as np
import pandas as pd
import torch
from ax.adapter.adapter_utils import (
_get_a... |
18317d354e1509a013656647dfa2c8f45151e1f0a8a9be8cf89c848be31b26c9 | Python | 33,450 | 833 | from __future__ import division, print_function
from fanc.config import config
from fanc.plotting.helpers import style_ticks_whitegrid, LimitGroup
from matplotlib.ticker import MaxNLocator, Formatter, Locator
from genomic_regions import GenomicRegion
from abc import abstractmethod, abstractproperty, ABCMeta
import nump... |
4e16cdb47c23d7d7382e40c5f8763dfbc9640a039d5d1a91c4dd50fd6c4d241d | Python | 33,466 | 793 | """
Partition of a graph into different groups with saving a lot of additional information
"""
import random as rd
import networkx as nx
import numpy as np
# from pysbm import additional_types
from MolRep.Interactions.link_models.CFLP.pysbm import additional_types
from .exceptions import NoFreeNodeException
class ... |
757b73e09d4378a8e90025c5427c6c0172db1c94393dc3c4fcd96179697276da | Python | 33,512 | 884 | #!/usr/bin/env python3
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
# pyre-strict
import warnings
from pathlib import Path
from typing import Any, cast
from ax.adapter.transforms.base... |
fb829c66227c12b9cbcce643626e9b0a3f8ac01f8c6f12596e74c3c6a4f7785e | Python | 33,547 | 1,040 | from __future__ import absolute_import
import contextlib
import errno
import io
import locale
# we have a submodule named 'logging' which would shadow this if we used the
# regular name:
import logging as std_logging
import os
import posixpath
import re
import shutil
import stat
import subprocess
import sys
import tar... |
ffd823343986b2c20ac80ddce5788171057ba74568c8273203575110486d6c1d | Python | 33,584 | 975 | # test_io.py
# Contact: Jacob Schreiber <jmschreiber91@gmail.com>
import h5py
import numpy
import scipy.special
import pytest
from modiscolite.io import save_pattern
from modiscolite.io import save_hdf5
from modiscolite.io import write_meme_from_h5
from modiscolite.io import write_bed_from_h5
from modiscolite.io impo... |
562d0b440b08c20a0cdc91ee812849a9cd7e76d037fb67ac500f2288a4b9a263 | Python | 33,604 | 626 | # New matplotlib colormaps by Nathaniel J. Smith, Stefan van der Walt,
# and (in the case of viridis) Eric Firing.
#
# This file and the colormaps in it are released under the CC0 license /
# public domain dedication. We would appreciate credit if you use or
# redistribute these colormaps, but do not impose any legal r... |
098c1e4846cb14271ca4c225f86ad81ac0424ce41035e8a833c6346dd548880d | Python | 33,642 | 908 | #!/usr/bin/env python3
"""Source space construction for combined cerebral and cerebellar MEG/EEG analysis.
Provides functions to set up cerebellar surface source spaces, register them
to individual subject anatomy via ANTs diffeomorphic registration, and merge
them with MNE-Python cortical source spaces.
"""
# -------... |
9be266ef9e938e69f8eae51619e91d320d55041c1a1324cefdf150f0fda35262 | Python | 33,645 | 812 | from dataclasses import dataclass
import numpy as np
from learnMSA.config.structure import StructureConfig
from learnMSA.util.aligned_dataset import AlignedDataset
from learnMSA.hmm.util.transition_index_set import PHMMTransitionIndexSet
from learnMSA.hmm.util.util import state_index_to_name
from learnMSA.config.hmm ... |
2c9856d5a93d1bc27a7c22ad0dbb90186c6be2822c0a4bf89298a31b9bea77a7 | Python | 33,669 | 942 | #!/usr/bin/env python
#
# Copyright (c) 2014 10X Genomics, Inc. All rights reserved.
#
import re
import os
import glob
import vcf
import subprocess
from collections import OrderedDict, namedtuple
import tenkit.tabix as tk_tabix
from tenkit.regions import Regions
from tenkit.exceptions import NotSupportedException
from... |
2e61cd49aa84c404fc904f9e39bffaed9e9c912183fd7a8ee7a3875e13646c57 | Python | 33,669 | 923 | import math
import pytest
import networkx as nx
def weighted_G():
G = nx.Graph()
G.add_edge(0, 1, weight=3)
G.add_edge(0, 2, weight=2)
G.add_edge(0, 3, weight=6)
G.add_edge(0, 4, weight=4)
G.add_edge(1, 3, weight=5)
G.add_edge(1, 5, weight=5)
G.add_edge(2, 4, weight=1)
G.add_edge... |
528ded52ac8c691ce8b29b756d91fb07525f645859437713b1c958ceb14f05a8 | Python | 33,706 | 963 | import fnmatch
import os
import re
from abc import (
ABCMeta,
abstractmethod,
)
from os.path import join
from typing import (
Any,
cast,
Dict,
List,
Optional,
Sequence,
Tuple,
TYPE_CHECKING,
Union,
)
import packaging.version
from typing_extensions import (
Literal,
N... |
3f756cf051ca56b14127b0278657acc58005942686cb582e1b2101f74cfee8ff | Python | 33,783 | 969 | """
Tests for TypeResolutionMixin.
Validates that types from EDB predicates and builtin functions are
propagated to variable symbols in Datalog rules, and that rules with
no resolvable type information are passed through unchanged.
"""
from typing import AbstractSet, Callable
import pytest
from nl_core.datalog.basi... |
d0094b6f730a14f1d3efc646ab14351740826844cd54820c74ef10c9adc6ba32 | Python | 33,801 | 763 | """Code allowing tools to define extra files associated with an output datset."""
import abc
import logging
import operator
import os
import re
from collections.abc import Callable
from decimal import Decimal
from tempfile import NamedTemporaryFile
from typing import (
Any,
Optional,
TYPE_CHECKING,
Uni... |
c88838600448115607354ba208a861586d3d87e5a11de7eab1b9447e987e5538 | Python | 33,806 | 933 | from __future__ import annotations
from collections.abc import Iterator, Mapping, Sequence
from typing import Any, Literal, cast
import dask.array as da
import numpy as np
import spatialdata as sd
import xarray as xr
from dask.base import is_dask_collection
from dask_image.ndinterp import affine_transform as da_affin... |
59978786119981f7036e39a2a69aff10cd59a94b427f78accefb291061b55252 | Python | 33,922 | 750 | # Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... |
7ef0e2ea7c6e17ab325fc7f783de8cbd75265cc1c7c106e5b415ec9b28ae669e | Python | 33,926 | 1,098 | from typing import Optional
import torch
from spikingjelly.activation_based import surrogate
from spikingjelly.logger import logger
from ..layout import _empty_like
from ..surrogate_dispatch import resolve_sg_triton_id_and_alpha, sg_triton
from ..triton_layout import (
_block_minor,
_check_mp_cuda_inputs,
... |
0a4ab6c35d7c809423031c07c68336dc0784ef4812d4d2c4ed850b3e1a256f37 | Python | 33,942 | 906 | from __future__ import annotations
import contextlib
import itertools
import os
import sys
import time
import typing
import numpy as np
from . import options
from ._util import obj_str_insert
from .config._config import Configuration
from .connectivity import ConnectionStrategy
from .exceptions import (
Configur... |
390a1699209f81686f3e879c7eaf58bd0318fb1e523a7fbdfc1c19bb9fb9f11a | Python | 33,944 | 1,004 | import collections
import itertools
import math
import numbers
import numpy as np
from zarr.errors import (
ArrayIndexError,
NegativeStepError,
err_too_many_indices,
VindexInvalidSelectionError,
BoundsCheckError,
)
def is_integer(x):
"""True if x is an integer (both pure Python or NumPy).
... |
938f43294b5ad83f3c75c0429696d7e98085e0ef625908461d53e2d6d175dba5 | Python | 33,947 | 1,035 | # Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... |
2cb6c76d7f3677cec130dcdcd6bfce1bac1ff7cb52b48fba3f5a0232d96e34fb | Python | 33,966 | 846 | # SPDX-License-Identifier: Apache-2.0
"""CIFAR-100 MaxFormer/MaxResNet and Tiny ImageNet CLIF task benchmarks.
Max recipe: bic-L/MaxFormer, 6ddd4ccde2cc9c4b965059403868e57803b9b6b0,
cifar10-100/{cifar100.yaml,train.py,aa_snn.py}; timm 0.6.12.
CLIF recipe: HuuYuLong/Complementary-LIF,
d76af5918b5797be367150d6761d10946d... |
4982a1cfbaa79fa97c5530ac31707b83d5bec3a25ec11700708a64a17d6024af | Python | 34,000 | 904 | #!/usr/bin/env python3
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
# pyre-strict
from unittest.mock import patch
import numpy as np
import pandas as pd
from ax.core.data import (
... |
7b53f554354aa90d75a92cac2c2cbcdf486bc6a32080d390385acaf20e7128ba | Python | 34,116 | 831 | """This file and its contents are licensed under the Apache License 2.0. Please see the included NOTICE for copyright information and LICENSE for a copy of the license."""
import logging
from core.current_request import CurrentContext
from core.permissions import ViewClassPermission, all_permissions
from core.utils.c... |
b1bf9f7999ba17c6860125c96be9cdf7fadcb348fb3a78172e818824ff645d13 | Python | 34,132 | 1,020 | from pprint import pprint
from functools import wraps
import pathlib
import shutil
from typing import Iterator, Tuple, Union
import pytest
from testbook import testbook
from testbook.client import TestbookNotebookClient
from . import notebooks_test_utils
# Sets a shared notebook testing temporary directory. Saves a... |
177251ca84e1abfd3a88e246ae2c24f9d998f3ceb288f71278d8bd598f20bfb0 | Python | 34,160 | 1,103 | # Note: these imports must remain light to ensure the CLI runs quickly.
# Do not import any sub-command dependencies here directly! Lazy-load them by
# importing within their respective CLI commands.
import click
import sys
from .config.cli import *
from .config.options import DEFAULT_PROCESSING_STREAM
from .config.p... |
ff0f8ca777436e44b48f8f8ef4eb29d549e19fc8d078c470d04d1030a590614d | Python | 34,161 | 1,103 | # Note: these imports must remain light to ensure the CLI runs quickly.
# Do not import any sub-command dependencies here directly! Lazy-load them by
# importing within their respective CLI commands.
import click
import sys
from .config.cli import *
from .config.options import DEFAULT_PROCESSING_STREAM
from .config.p... |
97b9bc275ac67458099ea6d1832fd3d6d30b37d71b557009a29d3331efd1040d | Python | 34,170 | 836 | """UTC-1335: import/reimport status observability (progress, stale fail, list, safety)."""
from contextlib import ExitStack
from datetime import timedelta
from unittest.mock import MagicMock, patch
import pytest
from data_import.functions import (
_async_import_background_streaming,
_async_reimport_background... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.