sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
1969649e55a04292027ad0130d33c71b0d9cc94855230d6d74495ddb95983545 | Python | 48,491 | 1,367 | import functools
import json
import os
import re
from typing import Tuple
from lark import Lark, Transformer
from operator import add, eq, ge, gt, le, lt, mul, ne, pow, sub, truediv
from nl_core.datalog import Conjunction, Fact, Implication, Negation, Union
from nl_core.datalog.constraints_representation import Right... |
599c9d862723ec9b79bfdecf08df15cdef1d40a7126ed4ec51431176f50b584f | Python | 48,676 | 1,237 | # Support branch detection within clusters.
import numpy as np
from sklearn.base import BaseEstimator, ClusterMixin
from scipy.sparse import coo_array
from scipy.sparse.csgraph import minimum_spanning_tree, connected_components
from joblib import Memory
from joblib import Parallel, delayed
from joblib.parallel import ... |
c64ccbda59281718cf6cbe425fcaea53445b7dc6622b765b7fafe240d8321170 | Python | 48,678 | 1,394 | from __future__ import annotations
import abc
import numpy as np
from scipy.interpolate import interp1d
from scipy.spatial.transform import Rotation as R
from ... import config
from ...config import types
def _reshape_vectors(rot_pts, x, y, z):
xrot = rot_pts[:, 0].reshape(x.shape)
yrot = rot_pts[:, 1].res... |
e84ae9726db011c161cb6a62d6cceb07f727e58f1976949acc1acc9ba1939e00 | Python | 48,734 | 1,362 | """Base class for directed graphs."""
from copy import deepcopy
from functools import cached_property
import networkx as nx
from networkx import convert
from networkx.classes.coreviews import AdjacencyView
from networkx.classes.graph import Graph
from networkx.classes.reportviews import (
DiDegreeView,
InDegr... |
15427cd4cf140ffde0f591239ef78cf4bc8df09e3cec3e8802d34f74a6da8c8e | Python | 48,948 | 1,398 | from collections.abc import MutableMapping
from itertools import islice
import numpy as np
from zarr._storage.store import (_get_metadata_suffix, data_root, meta_root,
DEFAULT_ZARR_VERSION, assert_zarr_v3_api_available)
from zarr.attrs import Attributes
from zarr.core import Array
fro... |
93bfb57cd736f542bd55895b3575c693b056fbdd9c753881b37168a57ca26b97 | Python | 48,982 | 948 | import numpy as np
import pytest
import tensorflow as tf
from packaging.version import parse as version
from tf_keras_vis import keras
from tf_keras_vis.activation_maximization import ActivationMaximization # noqa: E501
from tf_keras_vis.activation_maximization.input_modifiers import Jitter, Rotate, Scale
from tf_ker... |
133d59025bb117e44e49875790179a56f7db4a3f558b26bb3a57d216c33ff3dc | Python | 49,209 | 1,213 | import logging
import struct
import zlib
import numpy as np
from genomic_regions import GenomicRegion
from deprecated import deprecated
from ..regions import Genome
from ..hic import Hic
from ..pairs import ReadPairs
from ..matrix import RegionMatrixContainer, Edge
from ..config import config
from ..tools.files impor... |
706c93868003357ffac789c6122f66f68475b06c1b0e5b355b07c981fabc40b2 | Python | 49,273 | 1,072 | from __future__ import annotations
import inspect
import logging
import numpy as np
import pandas as pd
import pytest
import scanpy as sc
from anndata import AnnData
from fast_array_utils.conv import to_dense
from pandas import Series
from scanpy.pp import neighbors
from scipy.sparse import csr_matrix
from scipy.spar... |
10d4a59bf9adeaa138c1a50a638f50466e8201f7bca23ca3927a505cd12820a8 | Python | 49,277 | 1,230 | #!/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 enum
from collections.abc import Mapping, Sequence
from copy import deepcopy
from dataclasses i... |
1b1264b8d6e121959e16fc67c82a28ceab99a61e8c4584ee6f3ec44d223d66e9 | Python | 49,304 | 1,039 | # -*- coding: utf-8 -*-
"""
Created on Fri Feb 7 14:15:34 2020
@author: Maxsc
"""
import os
import re
import copy
import numpy as np
import pandas as pd
from matplotlib import pyplot as plt
from matplotlib import animation
from matplotlib.gridspec import GridSpec
from contextlib import suppress
#fo... |
22366082db42d4fdd948fe300f7e99959804882de3ceee9e4a450835be22221a | Python | 49,320 | 1,534 | # 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... |
628fc5961b1de652ddc90b8e2abc85ef8bf0bd902e0f73c073003451b461c44a | Python | 49,403 | 1,325 | from spikingjelly.logger import logger
import time
import os
from pathlib import Path
import abc
from typing import Callable, Optional, Tuple, Union
from dataclasses import dataclass
from concurrent.futures import ThreadPoolExecutor
from functools import partial
import numpy as np
from torchvision.datasets.utils impor... |
ae6e57936db41795dda58a47d059e6d2c0ac30e5fe4df7f2a95af7ef9a0c9b0f | Python | 49,868 | 1,462 | from dataclasses import dataclass
from typing import Any, Callable, ClassVar, Optional, Sequence
import torch
import torch.distributed as dist
import torch.nn as nn
from torch.distributed import ProcessGroup
from .. import functional, layer, memopt, neuron
from ..distributed.tensor_parallel import (
ChannelShardB... |
821568bf4c22abb8fed99846e414eaf364b1937f58fd71dd6162a301804d4a08 | Python | 49,958 | 1,577 | from typing import AbstractSet, Tuple
import pytest
from ..relational_algebra_set import (
RelationalAlgebraColumnInt,
RelationalAlgebraColumnStr,
pandas,
)
try:
from ..relational_algebra_set import polars
fixture_ids = ["pandas", "polars"]
fixture_params = [(pandas,), (polars,)]
except Import... |
4a8137716d961235dd347c46d1a7347dd4a8682cd50d2b0dd9a557ebd7046667 | Python | 50,018 | 1,231 | """
Based on
Estimating the Number of Communities in a Network
Newman, M. E. J. and Reinert, G. 2016
"""
from math import gamma
from math import lgamma
from math import log
from .partition import Partition
from .objective_functions import ObjectiveFunction
# @formatter:off
def newman_reinert_non_degree_corrected... |
2bd753755849ffdebe648f58b78b904141d2d2e47983cdae9cb7f607dfff5ac5 | Python | 50,061 | 1,276 | import os
import pathlib
import shutil
from dataclasses import dataclass, field
from operator import contains
from typing import Dict, List, Literal, Optional, Tuple, Union
from matplotlib import gridspec
from matplotlib.axes import Axes
import matplotlib.colors as colors
from matplotlib import cm
from matplotlib impor... |
de616d7b4638aa13587da35f530dc8b7501160e78e53080126059de56e6d8714 | Python | 50,064 | 1,632 | # -*- coding: utf-8 -*-
"""
Interface to TeraStitcher for stitching tiled large volumetric images
The TeraStitcher documentation can be found `here <http://abria.github.io/TeraStitcher/>`_.
Main routine is :func:`stitchData`
See Also:
:mod:`~ClearMap.Alignment`
"""
__author__ = 'Christoph Kirst <christoph... |
df98edc5a488566ca11076d9e05c3eceb2e273707cc3ab7b19a24de1de7e3b30 | Python | 50,176 | 1,285 | # -*- coding: utf-8 -*-
__all__ = ['Distribution']
import io
import sys
import re
import os
import warnings
import numbers
import distutils.log
import distutils.core
import distutils.cmd
import distutils.dist
from distutils.errors import DistutilsOptionError
from distutils.util import strtobool
from distutils.debug im... |
8240f3602ca8e7b99e4a19e37cea5b0a0c23f3923d2f22371a6c5a40c370c741 | Python | 50,300 | 1,755 | import contextlib
import operator
from typing import AbstractSet, Tuple
import pytest
from ...datalog.basic_representation import WrappedRelationalAlgebraSet
from nl_expr.expression_walker import ExpressionWalker
from nl_expr.expressions import Constant, FunctionApplication, Symbol
from ...utils.relational_algebra_se... |
ea03bafceffd692b8061e3a3c5987f735022b05a683741485a4b50743c4a8e02 | Python | 50,435 | 1,174 | """Experimental feature extraction module.
Extracts per-cell features from segmentation masks using cp_measure,
scikit-image ``regionprops``, and squidpy-specific metrics (summary
statistics, GLCM texture, intensity histograms). Large images are
automatically tiled so that each tile is processed independently.
"""
f... |
d5187dfe7129c7a2ea0b274c6cf1a85a06dbc472004a85703ce29183a85c97a8 | Python | 50,447 | 1,660 | """Tests for the PROB/MARG body predicate parser/transformer.
These tests exercise parser transformer methods for probabilistic body
predicates and related constructs without executing through the solver.
"""
import operator
import pytest
from lark import Tree, Token
from nl_core.datalog import Conjunction, Fact, I... |
9087ba7a2205d80295604f3fa77d19fc0c63ed048ad81a00d35ba25fc1de2833 | Python | 50,511 | 1,398 | """Run selected release profiles, paired benchmarks, and aggregate evidence."""
import argparse
import ast
from datetime import datetime, timezone
import fnmatch
import hashlib
import importlib.metadata
import json
import os
from pathlib import Path
import platform
import signal
import subprocess
import sys
import sys... |
c0fe5509f1278beb39a3f6ff5ca105f58ff36cd51ff75459e917427391ddf4c8 | Python | 50,912 | 1,488 | from collections import defaultdict
from copy import deepcopy
import networkx as nx
__all__ = ["check_planarity", "is_planar", "PlanarEmbedding"]
@nx._dispatchable
def is_planar(G):
"""Returns True if and only if `G` is planar.
A graph is *planar* iff it can be drawn in a plane without
any edge interse... |
2c0a90b462dfaf54fd10cbff2cfdca60cfae077816187c78183f43365f993f87 | Python | 50,936 | 1,384 | #!/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 math import isinf
from typing import cast
import numpy as np
import pandas as pd
from ax.core.pa... |
f8a247eb7009ee1aa32ed182c0e4eb8a89e12abd95b32b5dc248f2a3c51d11ca | Python | 51,029 | 1,339 | # -*- coding: utf-8 -*-
#
# Copyright (C) 2012-2017 The Python Software Foundation.
# See LICENSE.txt and CONTRIBUTORS.txt.
#
"""PEP 376 implementation."""
from __future__ import unicode_literals
import base64
import codecs
import contextlib
import hashlib
import logging
import os
import posixpath
import sys
import z... |
3c8a6ac73734c733e4002888aa2e17f0a4e82948662c1325101af53248ed24f5 | Python | 51,037 | 1,529 | import pytest
import torch
import torch.nn.functional as F
from spikingjelly.activation_based import base, functional, neuron, surrogate
from spikingjelly.activation_based.ann2snn.operators import (
TDGELU,
SNNElementWiseProduct,
SNNMatrixOperator,
TDConv2d,
TDLayerNorm,
TDLinear,
TDModule,... |
ea0cbfb84d2313a4d5d5f88b5af4d809014fb24ec5946453a427ea3bf2e80b06 | Python | 51,105 | 1,116 | """Detecting communities based on the Infomap algorithm.
Infomap identifies communities as regions in which a random walk tends to
remain; the literature calls them modules. It searches for a partition that
compresses the walk: each module has its own codebook, so node codewords can be
reused between modules, while tr... |
79fbfe6bd070a50f620ae9e8481e441d57a8afd4c660e7bba54d72ac39e82336 | Python | 51,162 | 1,166 | import nrrd
import h5py
import logging
import itertools
import numpy as np
import pandas as pd
from ccf_streamlines.coordinates import coordinates_to_voxels
from skimage.measure import find_contours
from tqdm import tqdm
from scipy.spatial.distance import cdist
from ccf_streamlines.linestring3d import LineString3D
HE... |
b7d34ce8a5aec4201cabb550f2a484574d34f399d18cac80b458ffb44fa93495 | Python | 51,203 | 1,312 | import os
import argparse
import logging
import subprocess
import shlex
import uuid
import threading
import multiprocessing as mp
import tempfile
from future.utils import string_types
from fanc.config import config
import re
import warnings
# configure logging
logger = logging.getLogger(__name__)
class CommandTask(... |
24c00656c09ea3dacbbf4cea13b04145f5d660943a1efc4d31683ffcb47a0390 | Python | 51,277 | 1,383 | # 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... |
a30a9b7149473bea4c026cdc9e6f03a38e475663bf44d69335eeaa26bbf45337 | Python | 51,396 | 1,169 | """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 json
import logging
import mimetypes
import time
import traceback
from urllib.parse import unquote, urlparse
from core.decorators import ov... |
00e1729a660cfb3c3c2c3f21dbe387e8a990c66db448ac415b450faf6f820898 | Python | 51,402 | 1,444 | """
This module is for transforming time series data.
"""
# Authors: David Burns, Matthias Gazzari, Philip Boyer
# License: BSD
import warnings
import numpy as np
from scipy.interpolate import interp1d
from sklearn.base import BaseEstimator, TransformerMixin
from sklearn.exceptions import NotFittedError
from sklearn.... |
42a426cb8f7409a71230e38e6db2bfeb77fd8117d44758c1029abb3033e9c471 | Python | 51,427 | 1,154 | # -*- coding: utf-8 -*-
"""
Color
=====
Provides tools for color manipulation.
Note
----
All numerical color values are by default returned in the range [0,1].
"""
__author__ = 'Christoph Kirst <christoph.kirst.ck@gmail.com>'
__license__ = 'GPLv3 - GNU General Pulic License v3 (see LICENSE)'
__copyright__ = 'Cop... |
f3e62130fbd68f338acc0e36861b4c3a8aa7f2eba50c835f0aeefed0fbdf50aa | Python | 51,519 | 1,113 | import unittest as ut
import six
from pysbm.test_ground_new import *
import os
import contextlib
import sys
class DummyOutput:
"""Replacement of stdout"""
def __init__(self):
self.lines = []
def write(self, x):
self.lines.append(x)
def __str__(self):
return ''.join(self.l... |
e1488a0ee88147dbbe1566c7b0e455864cf3b1c7019fae70e5c24447a9b61395 | Python | 51,577 | 903 | """
Class encapsulating the management of repositories installed into Galaxy from the Tool Shed.
"""
import copy
import logging
import os
import shutil
from typing import (
Any,
no_type_check,
Optional,
)
from galaxy import util
from galaxy.model.tool_shed_install import (
ToolDependency,
ToolShed... |
9067fd774600aa3899d9db3906aa604adf6af6c8ad3e597a7d6ffb36ef3a41b2 | Python | 51,665 | 1,369 | r"""
Query Builder Datalog
=====================
Complements QueryBuilderBase with query capabilities,
as well as Region and Neurosynth capabilities
"""
import warnings
from collections import defaultdict
from nl_core.datalog.magic_sets import magic_rewrite
from nl_core.datalog.range_restriction import check_range_rest... |
359520341b353f118c3bd853930e4736eb95ed10693510b7e1d7f1667c5da5e5 | Python | 51,690 | 1,129 | from unittest import TestCase
import networkx as nx
from pysbm import sbm
from pysbm.sbm.nxpartitiongraphbased import NxHierarchicalPartition
from pysbm.sbm.peixotos_hierarchical_sbm_full import ModelLikelihoodOfHierarchicalMicrocanonicalDegreeCorrectedSbm
class TestModelLikelihoodOfHierarchicalMicrocanonicalDegree... |
e4ef57105ad2128018a97725bc5b11028c5d4d6acd8ea04becdedb0e8f102e35 | Python | 51,787 | 977 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
@title: Bruker class
@description: methods and classes for the Bruker SolariX mass spectrometer
@author: chrisarcadia
@created: 2018/08/01
"""
import csv
import openpyxl
from lxml import etree
import sqlite3
import os
import numpy
import h5py
import copy
import time... |
4bd1b622c669d119cc31b5c6ad3fa0bbbf3dda9369cb55cc95412e5075f7388f | Python | 51,828 | 1,295 | # -*- coding: utf-8 -*-
#
# Copyright (C) 2012-2015 Vinay Sajip.
# Licensed to the Python Software Foundation under a contributor agreement.
# See LICENSE.txt and CONTRIBUTORS.txt.
#
import gzip
from io import BytesIO
import json
import logging
import os
import posixpath
import re
try:
import threading
except Impo... |
31944fae8cfcb68a963172e01b1460224226ef4374d35c5bcc4e845134e6afc0 | Python | 51,849 | 883 | import json
import multiprocessing as mp
import os
import shutil
import tempfile
import time
from multiprocessing import current_process
from typing import List, Optional, Tuple, Union
os.environ["KMP_DUPLICATE_LIB_OK"] = "TRUE"
try:
from typing import Literal
except:
from typing_extensions import Literal
im... |
ce77ca2b8b06838f984a326a3c6b01b4e20fb86c1c33e88757980137af385499 | Python | 51,893 | 1,672 | import itertools as it
import pytest
import networkx as nx
from networkx import vf2pp_all_isomorphisms, vf2pp_is_isomorphic, vf2pp_isomorphism
labels_same = ["blue"]
labels_many = [
"white",
"red",
"blue",
"green",
"orange",
"black",
"purple",
"yellow",
"brown",
"cyan",
"... |
72226bacd81f48cd38727390bbbdabb3d0384fea1ece6db0c26a244da6942984 | Python | 51,929 | 1,711 | import multiprocessing
from collections import namedtuple
from operator import add, contains
from typing import AbstractSet, Callable, Tuple
from unittest.mock import patch
import numpy as np
import pandas as pd
import pytest
from nl_expr import exceptions, expressions as exp
from ... import frontend
from nl_core.dat... |
631257df33d005d9c0201fe13094ed8d3e3ead4b02d1cdb03b570784ea3e7ba3 | Python | 52,070 | 1,369 | r"""
Probabilistic Frontend
======================
Complements QueryBuilderDatalog class with probabilistic capabilities
1- add extensional probabilistic facts and choices
2- solve probabilistic queries
"""
import collections
import functools
import typing
from typing import (
AbstractSet,
Any,
Callable,
... |
47f3eb7ca000f51ae7240e577ec1fff2f496f65443836002a643231d4ea037ed | Python | 52,205 | 1,196 | """Implement the experimental flow of the sampling paradigm."""
import os
import os.path as op
from collections import OrderedDict
import numpy as np
import pandas as pd
from psychopy import visual, event, core, gui, monitors
import sp_experiment
from sp_experiment.define_settings import (KEYLIST_SAMPLES,
... |
eae7f7845ccb1d36be584150432d1f0d1a92c0bc348626f9f9b377aec6f595d9 | Python | 52,211 | 1,115 | import inspect
import random as rd
import unittest as ut
import networkx as nx
import numpy as np
import six
from pysbm import sbm
class TestPartition(ut.TestCase):
""" Test Class for Partition """
def test_reminders(self):
"""Test NotImplementedError reminders"""
partition = sbm.Partition(... |
36022ea22e9917f2cbff82032458b19defc6f5fc306d23fb423d064e245f6810 | Python | 52,275 | 1,130 | """
tensorflow/keras networks for voxelmorph
If you use this code, please cite one of the voxelmorph papers:
https://github.com/voxelmorph/voxelmorph/blob/master/citations.bib
License: GPLv3
"""
# internal python imports
from collections.abc import Iterable
# third party imports
import numpy as np
import tensorflow... |
1a75937a3977748eb9e07fdbad43dda6a4bedbd742a9c9cefdc57559b815b4e7 | Python | 52,330 | 1,588 | # -*- coding: utf-8 -*-
"""
GraphGt
=======
Module provides basic Graph interface to the
`graph_tool <https://graph-tool.skewed.de>`_ library.
"""
__author__ = 'Christoph Kirst <christoph.kirst.ck@gmail.com>'
__license__ = 'GPLv3 - GNU General Pulic License v3 (see LICENSE)'
__copyright__ = 'Copyright © 2020 by C... |
8f83cf8b9d83016b8aaa4632d60112c1ed34dd367114fe34c622219498da09fe | Python | 52,386 | 1,490 | from collections import OrderedDict
from operator import itemgetter
from typing import Iterable, Callable, Dict, Union
from uuid import uuid1
import numpy as np
import pandas as pd
from . import abstract as abc
NA = pd.NA
class RelationalAlgebraStringExpression(str):
def __repr__(self):
return "{}{{ {}... |
b2418bb496ab22ac8f708224f1c71aaf90f159d67f0859b607219f132303932b | Python | 52,408 | 927 | # -*- coding: utf-8 -*-
"""
Created on Fri Jul 5 13:18:16 2019
@author: schelskim
"""
from .sortpoints import sortPoints
from .generaltools import generalTools
import numpy as np
import pandas as pd
from skimage import morphology as morph
from scipy.spatial import distance
from scipy import ndimage
import copy
from... |
baf0a3ec81b50ee626602bcd736fbabb422bf2c30400208cec1d71043c49fb64 | Python | 52,677 | 1,368 | import os
import shutil
import tempfile
import unittest
from unittest.mock import patch
import nest
import numpy as np
from bsb import (
AfterPrepareHook,
AfterSimulationHook,
BootError,
CastError,
ConfigurationError,
RequirementError,
config,
read_results,
)
from bsb.config import Conf... |
dcd360779f58dc1b716ec0cb7c57c0ec14d71ff1ea29bacc53e17f7590c58d79 | Python | 52,715 | 1,260 | #!/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 datetime import datetime, timedelta
from unittest.mock import patch
im... |
b503d325d999e0e867252946368e6b9d8c87e0a920c9eff3dff562bad345b9ca | Python | 53,181 | 1,162 | import collections
import logging
import os
import signal
import sys
import threading
import time
from collections.abc import Callable
from typing import (
Any,
Optional,
)
from beaker.cache import CacheManager
from beaker.util import parse_cache_config_options
import galaxy.model
import galaxy.model.security... |
0595e5101deaed5bf414ffa5620234d71b1d8c6e7665e771bfce2d064c28f6cd | Python | 53,334 | 929 | # -*- coding: utf-8 -*-
"""
Created on Fri Jul 5 13:18:16 2019
@author: schelskim
"""
from .sortpoints import sortPoints
from .generaltools import generalTools
import numpy as np
import pandas as pd
from skimage import morphology as morph
from scipy.spatial import distance
from scipy import ndimage
i... |
629509ed7747679bdd1bc430d4f0dccfaeb926de74050c69380e4233e41faf96 | Python | 53,516 | 1,284 | #!/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 copy
from itertools import product
from typing import Any
from unittest import mock
from unitte... |
eadb93696505fc9c0210c649ab29880fcc22e31cbc7352e8f662eaf628a1946e | Python | 53,579 | 1,376 | """Fit a Dirichlet prior (single or mixture) to multiple sequence alignments.
Fits a :class:`hidten.tf.prior.dirichlet.TFDirichletPrior` by maximum
likelihood to the column distributions of a directory of alignments and saves
the weights in the format used by the learnMSA HMM
(:mod:`learnMSA.hmm.tf.util`).
``--alphab... |
60d216370be05f02407138ddec4e23e26073a8e2085144261254f24a393835df | Python | 53,706 | 1,663 | """
View Classes provide node, edge and degree "views" of a graph.
As with dicts, the graph should not be updated while
iterating through the view. Views can be iterated multiple times.
Views are quick-to-create, read-only iterable containers,
live (they reflect changes to the graph), and provide
Pythonic access patt... |
b7e155e678ae471397f19090cf5c1545f9e15c2e6eb8734eca2ccf94cdfeb47b | Python | 53,724 | 1,360 | from __future__ import annotations
import copy
from dataclasses import dataclass
from types import SimpleNamespace
from typing import TYPE_CHECKING, Dict, Iterable, Mapping, Optional, Sequence, Tuple
import torch
import torch.nn as nn
import torch.nn.functional as F
from spikingjelly.activation_based.ann2snn.operato... |
86c9d771f32fd02d48274b0bd9a0cd2d901ab0cf0028c2a55ad26adc71a5d5f8 | Python | 53,782 | 1,195 | """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 base64
import concurrent.futures
import itertools
import json
import logging
import os
import sys
import traceback as tb
from concurrent.fut... |
2deedfebfdafb85646507384bcdd6846ae92beb5fc8f0d6ad64d4687fa5d1415 | Python | 53,783 | 1,224 | from __future__ import annotations
import abc
import importlib
import math
from copy import deepcopy
from dataclasses import dataclass, field, fields, is_dataclass
from pathlib import Path
from typing import Any, ClassVar, Literal, Mapping, Optional, Sequence
import torch
import torch.distributed as dist
from torch.d... |
cfbc357fbf7222770e02336485b1a3ceafd645ce00e01cc7ee5f2bf2d4bc1c22 | Python | 53,910 | 1,174 | # Implementation based on the following publication of Tiago P. Peixoto
# Nonparametric Bayesian inference of the microcanonical stochastic block model
#
import math
from .peixotos_flat_sbm import ModelLogLikelihoodOfFlatMicrocanonicalDegreeCorrectedSbm
from .peixotos_flat_sbm import DeltaModelLogLikelihoodOfFlatMi... |
d6b6df2ccd8228eca017ec1fc412ade341117534b63b9e03053a5b355a22339e | Python | 53,955 | 1,510 | import importlib
import pytest
import torch
import spikingjelly.configure as configure
from spikingjelly.activation_based import neuron, surrogate
from spikingjelly.activation_based.functional import neuron as functional_neuron
from spikingjelly._ops import triton_runtime as triton_utils
from spikingjelly._ops.fp8_ca... |
92124374e9a8d1c1052a79fb31e27bd2f3d64011eb529e41d951e345281405ea | Python | 53,960 | 1,172 | import json
import logging
import time
from typing import (
Any,
cast,
NoReturn,
Optional,
TYPE_CHECKING,
)
from urllib.parse import quote
import jwt
from jwt import InvalidTokenError
from msal import ConfidentialClientApplication
from social_core.actions import (
do_auth,
do_complete,
... |
c5520a7deaf890bb0408865f2b3c85d1f7e6693b3d7a7b9bd0706168ab136fd5 | Python | 54,026 | 1,129 | # 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... |
250b3df858fbd5a5fefd68eaf05ee1fc1c2e5752678d637cc84279f4e2e842d9 | Python | 54,087 | 1,258 | """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 collections.abc import MutableMapping
import ujson as json
from core.current_request import CurrentContext, get_current_reques... |
10894f1d17ff3c2322c01e70c3d795bc14ecc028e6df24f5b0753a227ec0d4ec | Python | 54,185 | 1,210 | # 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... |
af39463b82f8704de514a2485c4ada11a5c5d731df5e3f2943b4dde77efedf83 | Python | 54,377 | 1,184 | #!/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 __future__ import annotations
from collections import defaultdict
from collections.abc import Se... |
c0d9de05036784b02dbc6dceb46dca12c1f0f41061b09c610599a68e402fa3a3 | Python | 54,694 | 1,484 | """
Show-RA support for the frontends.
Machinery behind ``show_ra=True`` (``--show-ra`` in the CLI): instead of
reporting a query's answer, print the named relational algebra plan each
rule is evaluated with, stratum by stratum.
"""
import operator
import re
from dataclasses import dataclass, field
from functools impo... |
fc81cb13790a06c99237e3070a9c2d5babe09fc21670f93c4aa87e6d7cd94bd7 | Python | 54,740 | 1,442 | import random
import json
import copy
import re
from src.expressions_transfer import out_expression_list, compute_prefix_expression, from_infix_to_prefix
PAD_token = 0
class Lang:
"""
class to save the vocab and two dict: the word->index and index->word
"""
def __init__(self, file=No... |
5e5a2476457549c551e222452f53c4682cc6d864c84d7c9e83d87d4bc3c2ab5f | Python | 54,760 | 1,316 | #!/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 dataclasses
from enum import Enum
from logging import Logger
from typing import Any, cast
from... |
46b886b8d097f4e18526b32bf17ed4f5f73b8b9be9711ed7f81693891a68c31f | Python | 54,815 | 1,581 | """Unit tests for matplotlib drawing functions."""
import itertools
import warnings
import pytest
import networkx as nx
mpl = pytest.importorskip("matplotlib")
np = pytest.importorskip("numpy")
mpl.use("PS")
plt = pytest.importorskip("matplotlib.pyplot")
plt.rcParams["text.usetex"] = False
barbell = nx.barbell_gr... |
585d2677826bb0ac65dab68c36637cf3942174821997d05cf4f846041a776bd0 | Python | 55,301 | 1,614 | """
Command-line interface for NeuroLang query execution.
Provides a ``neurolang-query`` command that initializes a NeuroLang engine
from the :mod:`engine registry <neurolang_apps.utils.engine_registry>` and
executes Datalog queries from arguments, files, or standard input.
Usage
-----
::
# List available engine... |
c7537dee10f7d473e48fd5a7d8f62d8b9fa07306853674ad91a37fdfc1ca9c88 | Python | 55,319 | 1,742 | import random
from itertools import product
from textwrap import dedent
import pytest
import networkx as nx
def test_generate_network_text_forest_directed():
# Create a directed forest with labels
graph = nx.balanced_tree(r=2, h=2, create_using=nx.DiGraph)
for node in graph.nodes:
graph.nodes[no... |
9e76b16d67c5b73ba502544596f120af48ac748145c683437b966d80eb38eceb | Python | 55,345 | 1,419 | import ast
import inspect
import textwrap
import unittest
from collections import defaultdict
import numpy as np
from bsb_test import (
FixedPosConfigFixture,
MorphologiesFixture,
NetworkFixture,
NumpyTestCase,
RandomStorageFixture,
get_test_config,
skip_parallel,
)
import bsb
from bsb imp... |
ce7fd09316473574e183deceecc595b91453024f000bcfce890d69baf879a9ea | Python | 55,437 | 1,614 | # 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... |
a7233fd6ca0936d64ecfb6d4361c2e0e1f4ac409ffbaa078d65d448449bfe572 | Python | 55,592 | 1,495 | """
Generators for random graphs.
"""
import itertools
import math
from collections import defaultdict
import networkx as nx
from networkx.utils import py_random_state
from ..utils.misc import check_create_using
from .classic import complete_graph, empty_graph, path_graph, star_graph
from .degree_seq import degree_... |
8ccbfd185f68e047dc2340d4a2cbb63b6c79262b6d1bb3b4d907dd14a152ffb7 | Python | 55,608 | 1,614 | from __future__ import division
import numpy as np
from fanc.data.genomic import Chromosome, Genome, Hic, Node, Edge, \
GenomicRegion, _get_overlap_map, _edge_overlap_split_rao, \
RegionMatrix, RegionsTable, RegionMatrixTable, RegionPairs, AccessOptimisedRegionPairs, \
AccessOptimisedRegionMatrixTable, Acce... |
ed20688d2a5202f4e0b3381b10922ef041a33994572f661deab6cbe88d316403 | Python | 55,642 | 1,573 | import logging
import os
import re
from collections.abc import Callable
from typing import (
Optional,
)
from galaxy.datatypes import metadata
from galaxy.datatypes.binary import Binary
from galaxy.datatypes.data import (
get_file_peek,
Text,
)
from galaxy.datatypes.metadata import MetadataElement
from gal... |
376d598c84f3a7d754a544430c07c7c26777ade4f77655ddf74ee221e71360db | Python | 55,654 | 1,015 | # 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... |
4e44f9dedd6dd0e826f9c80c85ed6bb0e5e3c9c002dcf2943627ccca2768ab00 | Python | 55,722 | 1,379 | #!/usr/bin/env python
#
# Copyright (c) 2014 10X Genomics, Inc. All rights reserved.
#
import os
# 10X chemistry types
GEMCODE = 'GemCode'
CHROMIUM = 'Chromium'
# Mass of 1 bp in nanograms
NG_PER_BP = 1.1454e-12
# Where the code sits
CODE_PATH=os.path.dirname(os.path.abspath(__file__)) + '/'
# Where barcode white... |
494f9d061f4855c26f3b41c8b2a6329ee41e25c9d3bfe9f8cee5224f70d15821 | Python | 55,829 | 1,422 | """
Keeps the older BaseController security and fetching methods and also
defines a base ModelManager, ModelSerializer, and ModelDeserializer.
ModelManagers are used for operations on models that occur outside the scope of
a single model object, such as:
- object creation
- object lookup
- interactions between 2+ obj... |
c0972e090b70b519487433ef81eeeb41d5ddf25460810f432bb69ebda044f56f | Python | 55,863 | 1,276 | from __future__ import annotations
import subprocess
from collections import defaultdict
from collections.abc import Sequence, Set
from html.parser import HTMLParser
from itertools import permutations
from pathlib import Path
from typing import Any
import anndata as ad
import dask.array as da
import imageio.v3 as iio... |
7f1f8a1c51b397bb86be6cbee3c2f3550f215e5ecec55df4f71e4f79524b7df8 | Python | 55,883 | 1,233 | import csv
import gc
import os
import time
from pathlib import Path
import hlsvdpro
import mat73
import pandas as pd
import scipy
import sio as sio
from pytorch_lightning.callbacks import EarlyStopping
from pytorch_lightning.loggers import TensorBoardLogger
from ray.tune.suggest.bohb import TuneBOHB
from sklearn.clust... |
fa92d505a860dd76448702a7bd485a80e9272caeb8604cc497113f97b6a3b036 | Python | 55,893 | 1,612 | """Create portable serialized representations of Python objects.
See module copyreg for a mechanism for registering custom picklers.
See module pickletools source for extensive comments.
Classes:
Pickler
Unpickler
Functions:
dump(object, file)
dumps(object) -> string
load(file) -> object
lo... |
6b3ec3b329ee83b31f8936c227f7a64b30e7dd17e1d16f26df469fea20bb431b | Python | 55,955 | 887 | #!/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
from skimage import io
import matplotlib
import open... |
ac1ebb2543899f967d80bf80d6c229e03cdcb574eae7eb7ac4ce84500dcb2504 | Python | 56,015 | 1,034 | import logging
import os
from typing import (
Any,
cast,
Optional,
TYPE_CHECKING,
Union,
)
from typing_extensions import (
Protocol,
TypedDict,
)
from galaxy import util
from galaxy.model.tool_shed_install import ToolShedRepository
from galaxy.tool_shed.galaxy_install.client import (
D... |
56284224cae88de68a3e4517d8c5167c04f0b199e4f96027f279209d8c71bac2 | Python | 56,032 | 1,321 | # 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... |
044aaeccd0ef4b46f7cb4d5df6c5988925ae674b2804abc0aff089635d4a0288 | Python | 56,084 | 1,446 | import dataclasses
import functools
import pathlib
import shutil
import traceback
import typing
import uuid
import warnings
from datetime import datetime
import numpy as np
from ..exceptions import (
DatasetNotFoundError,
ResultsError,
ResultsMismatchError,
ResultsWarning,
)
from ..reporting import wa... |
64b26d51de066a4b28f86d1ce8f5f6c7ac031c5abb8c2cf83142ca16b528d567 | Python | 56,191 | 1,508 | """
=================================
Travelling Salesman Problem (TSP)
=================================
Implementation of approximate algorithms
for solving and approximating the TSP problem.
Categories of algorithms which are implemented:
- Christofides (provides a 3/2-approximation of TSP)
- Greedy
- Simulated A... |
e3fcdcafca706b78d7182748702bac2ec8adbcf3b13137cd2e4d8479ad3832d5 | Python | 56,394 | 1,312 | #!/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 __future__ import annotations
import inspect
from collections import OrderedDict
from collection... |
3ef9bfacf30718a2dc8417a1cdbe23f73e5dd18a830ab8c2c1a60767287ba9e6 | Python | 56,438 | 1,277 | # 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... |
1ee3e39fa841c906aadf881db84244db429ef71ecbfe0f04476f50062607717b | Python | 56,492 | 1,396 | #!/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 dataclasses
import warnings
from contextlib import ExitStack
from copy import deepcopy
from ite... |
f0c1d57c1c4c99409970b91e0e69e4994438b298c4b2e521bdc34c914168cc7a | Python | 56,834 | 1,686 | import json
import os
import subprocess
import sys
from concurrent.futures import Future
from dataclasses import replace
from pathlib import Path
from types import SimpleNamespace
import h5py
import numpy as np
import pytest
import torch
import torch.distributed.device_mesh as device_mesh
import torch.nn as nn
from to... |
eb562dab5e16ce5538896e3c92158289c6a7fbbc37b313b290301872ebc06ca0 | Python | 57,143 | 1,554 | # -*- coding: utf-8 -*-
"""
Created on Wed Mar 3 13:16:48 2021
@author: ColinVDB & Maxence Wynen
"""
import os
import warnings
import subprocess
from pathlib import Path
from shutil import rmtree
import json
import shutil
from os.path import join as pjoin
from os.path import exists as pexists
import pandas as pd
fr... |
49899dd34294b7855b55771b2eb6dbebdc464d2b30e62337516f8d23e9e2af72 | Python | 57,169 | 1,527 | """Tests for NeurolangPDL.execute_squall_program."""
import numpy as np
import pandas as pd
import pytest
from nl_expr.exceptions import ForbiddenDisjunctionError
from nl_expr.expressions import Symbol as ir_Symbol
from ..probabilistic_frontend import NeurolangPDL
from nl_expr.exceptions import (
SquallSemanticEr... |
a361e106cfc8ae506b18ac0d2316915bf64baf6aa7fbcc43cf85aa43a72334a3 | Python | 57,266 | 1,104 | """
Provides mapping between extensions and datatypes, mime-types, etc.
"""
import importlib.util
import logging
import os
import pkgutil
from collections.abc import Iterable
from string import Template
from typing import (
Any,
cast,
Optional,
TYPE_CHECKING,
Union,
)
import yaml
import galaxy.ut... |
1966a088e7bede82eb3e93b0585930cc820c7230a414db90cc3bc1d10d143a62 | Python | 57,491 | 1,556 | from __future__ import annotations
import re
from collections.abc import Callable, Iterable, Iterator, Mapping, Sequence
from copy import copy, deepcopy
from functools import partial
from itertools import chain
from pathlib import Path
from types import MappingProxyType
from typing import TYPE_CHECKING, Any, Literal
... |
4a9295e5db26f8f9793633e29b030c8371fdbe867e9b1ba9813dbe0eac77e02c | Python | 57,619 | 1,022 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
@title: Andrew class
@description: methods and classes for the liquid handling robot Andrew (Andrew Alliance, model 1000G)
@author: chrisarcadia
@created: 2018/03/29
"""
from lxml import etree
import time
from datetime import datetime
from copy import deepcopy
import ... |
73f49631a9c0f6bd326b14d7d91349832e55c64dd0aa16574b3c5e7b9b7783cf | Python | 57,795 | 1,488 | import glob
import pathlib
import re
import warnings
from typing import Union
import anndata
import dask
import numpy as np
import pandas as pd
import scipy.sparse as ss
import xarray as xr
import yaml
from pybedtools import BedTool
from ..plot.qc_plots import cutoff_vs_cell_remain, plot_dispersion
from .utilities im... |
1ab5bb405b01e4da7186e5bf2f8f7a6f997ac727b68d3d01b370920b99228114 | Python | 57,943 | 1,625 | from __future__ import annotations
import json
import math
import warnings
from collections.abc import Mapping, MutableMapping
from contextlib import contextmanager, nullcontext
from copy import copy
from functools import partial, wraps
from importlib.metadata import version
from itertools import product
from types im... |
3ad640c7d51d3728ff30c29d01ab6da4d8ed65378f6aeac0c0f1aadb93cc8928 | Python | 57,989 | 1,408 | # 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... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.