sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
14ff8a0a8e239ce9703dd64995e0ac05a1a17d7a373f6dffb7d0c0d33b7f2c6e | Python | 5,534 | 121 | """Documentation reuse and deadlines preserve executable evidence and terminate children."""
from __future__ import annotations
import importlib.util
import json
import os
import subprocess
import sys
import time
from pathlib import Path
import pytest
from tools.verify_documentation import execute_component
ROOT = ... |
2695a90b09ba0483d63adafcfc78d2319e182836d75b018b312d4b8b173369c5 | Python | 5,534 | 193 | #
# The Python Imaging Library.
#
# MSP file handling
#
# This is the format used by the Paint program in Windows 1 and 2.
#
# History:
# 95-09-05 fl Created
# 97-01-03 fl Read/write MSP images
# 17-02-21 es Fixed RLE interpretation
#
# Copyright (c) Secret Labs AB 1997.
# Copyright (c) Fr... |
2d909241669c8a19b7fbd9eb700466e429ab2eb458509089defe3385fe31c23f | Python | 5,537 | 194 | ###############################################################################
# abstract.py provides a purely abstract part of baseModule class
###############################################################################
# Copyright (c) 2019-2020, University of Liège
# Author: Nikita Beliy
# Owner: Liege Universit... |
834521402e604c521865126c842a8fc59ccec0ddb9895285c59028592ce9bf80 | Python | 5,539 | 194 | ###############################################################################
# abstract.py provides a purely abstract part of baseModule class
###############################################################################
# Copyright (c) 2019-2020, University of Liège
# Author: Nikita Beliy
# Owner: Liege Universit... |
aca820b47dfa705d1aecd6a2c2bc5f592d4bab6cd2a08f5b25f1af5b92c86b1f | Python | 5,558 | 128 | # encoding: utf-8
#
# The Python Imaging Library.
# $Id$
#
# WAL file handling
#
# History:
# 2003-04-23 fl created
#
# Copyright (c) 2003 by Fredrik Lundh.
#
# See the README file for information on usage and redistribution.
#
# NOTE: This format cannot be automatically recognized, so the reader
# is not registered... |
01ce2d7fe57bac6cd5481648132a432491db0b9f58d60248153ca546f6f215b2 | Python | 5,574 | 168 | #!/usr/bin/env python2
desc = "Identify Copy Number Variants (CNVs)."
epilog = """Takes two files containing gene and read counts info (bam2counts.py output).
Note, gene counts has to be already normalised (RPKMs)! Use bam2counts.py for that;)
Author:
l.p.pryszcz+git@gmail.com
Barcelona, 25/04/2012
"""
import os, ... |
c8d38fbc37a79636281226de7d0f630582a68994088e580763c2163f0724645e | Python | 5,578 | 149 | # This file is dual licensed under the terms of the Apache License, Version
# 2.0, and the BSD License. See the LICENSE file in the root of this repository
# for complete details.
from __future__ import absolute_import, division, print_function
import warnings
from cryptography import utils
from cryptography.hazmat.... |
5911b8a20fb303c7267b45567e3b411007c303349aef18728f362f9809852e4d | Python | 5,582 | 170 | ###############################################################################
# NIFTI.py provides an implementation of PET class for generic NIFTI file
# format
###############################################################################
# Copyright (c) 2019-2020, University of Liège
# Author: Nikita Beliy
# Owner... |
ce429417ae344fc71fda5b64e5bffa30e598c0d3986e3aac844f687dc7a2867d | Python | 5,583 | 179 | # -*- coding: utf-8 -*-
"""
celery.task.base
~~~~~~~~~~~~~~~~
The task implementation has been moved to :mod:`celery.app.task`.
This contains the backward compatible Task class used in the old API,
and shouldn't be used in new applications.
"""
from __future__ import absolute_import
from kombu i... |
d24b19365981b16a9698f7e361f61a84d842321c422e76c130e55203cc580482 | Python | 5,596 | 169 | import numpy as np
import scipy.sparse as sps
import numpy.testing as npt
from dipy.core.optimize import Optimizer, SCIPY_LESS_0_12, sparse_nnls, spdot
import dipy.core.optimize as opt
def func(x):
return x[0]**2 + x[1]**2 + x[2]**2
def func2(x):
return x[0]**2 + 0.5 * x[1]**2 + 0.2 * x[2]**2 + 0.2 * x[3]*... |
6c83a825ad88b7e70f179a17e601551f0e6fbec8fdd485e074098e342bf6e4be | Python | 5,599 | 134 | #!/usr/bin/env python2
desc="""Converts binary Illumina files (.bcl) to FastQ. Designed to work as cron service.
It proceeds only if given run has been sequenced (.bcl present),
but not yet successfully converted (no .fastq files).
Dependencies:
- bcl2fastq
"""
epilog="""Author: l.p.pryszcz+git@gmail.com
Warsaw, 11/... |
849184d28cba00122e05cde8b013d089decac1a29e7def16becb88aca4249308 | Python | 5,599 | 178 | from __future__ import absolute_import
import atexit
import logging
import os
import signal
import socket
import sys
import traceback
from itertools import count
from time import time
from celery import current_app
from celery.exceptions import TimeoutError
from celery.app.control import flatten_reply
from celery.ut... |
031990a96ded808a6aac9db5399ee0e80cf0a1505bacf6ddf6219117e69d11e7 | Python | 5,600 | 126 | import torch
import tqdm
@torch.no_grad()
def ba(func, dim=100, n=200, maxiter=2000, is_min=True, topk=100, topk_coef=10, fmin=0, fmax=1, loud_A=0.95, r0=0.85, alpha=0.999, gamma=0.1,
w_init=0.2, w_final=0.9, n_batch=1, seed=None, progress=False, device=None, low_mem=False):
# TODO: I made a mistake here. ... |
104fdb8bafe5481614b0582d3e069f960c80ffc17809794403ec49f1e0e53786 | Python | 5,607 | 150 | import json
from django.conf import settings
from django.contrib.admin.utils import quote
from django.contrib.contenttypes.models import ContentType
from django.db import models
from django.urls import NoReverseMatch, reverse
from django.utils import timezone
from django.utils.text import get_text_list
from django.uti... |
10650fc9d83b1993606282274c59ec4b129e33a3a051b3b061149a9f2958772c | Python | 5,607 | 141 | import numpy as np
import numpy.testing as npt
from dipy.core.geometry import cart2sphere
from dipy.core.gradients import gradient_table
from dipy.core.sphere import HemiSphere, unit_icosahedron
from dipy.direction.bootstrap_direction_getter import BootDirectionGetter
from dipy.direction.pmf import BootPmfGen, Simple... |
3dd49fe4603afedd861345ca2de0d1b8cce99298c0bc5b604401488e37179643 | Python | 5,619 | 128 | """Current caller domains and original realized rows share one legacy search facade."""
import math
from datetime import datetime
import numpy as np
from talos.experiment.param_domain import ParamDomain, values_equal
from talos.experiment.param_search.legacy_strategy import LegacyStrategy
from talos.experiment.serial... |
bafe9ceacafda0dfa8e4f36a06a0d25631e3fa98425a6b6c6a678b38ad9ec508 | Python | 5,623 | 164 | "File-based cache backend"
import glob
import hashlib
import os
import pickle
import random
import tempfile
import time
import zlib
from django.core.cache.backends.base import DEFAULT_TIMEOUT, BaseCache
from django.core.files import locks
from django.core.files.move import file_move_safe
def _write_content(f, expiry... |
b3055b504dc0fc6f21a26d1d1ed367d737f6ba89bc9d8aad10acb8227709fa63 | Python | 5,633 | 162 | from urllib.parse import urlencode
from urllib.request import urlopen
from django.apps import apps as django_apps
from django.conf import settings
from django.core import paginator
from django.core.exceptions import ImproperlyConfigured
from django.urls import NoReverseMatch, reverse
from django.utils import translati... |
d7a504f97ae9cc1b3427aad662d205db582a352f5cc33e92ed94dab85e7e0bb7 | Python | 5,635 | 136 | #!/usr/bin/env python3
"""Audit the complete compiled runtime graph and enforce active, time-boxed exceptions."""
from __future__ import annotations
import datetime
import json
import re
import subprocess
import sys
from functools import partial
from _common import REPO_ROOT, TOMLDecodeError, fail_setup, loads_toml
f... |
5efd2b6cd7e54996e2f17909a4e19dd4787be8ff17d8de5f867741e2cef53830 | Python | 5,642 | 169 | """ Standard "encodings" Package
Standard Python encoding modules are stored in this package
directory.
Codec modules must have names corresponding to normalized encoding
names as defined in the normalize_encoding() function below, e.g.
'utf-8' must be implemented by the module 'utf_8.py'.
Ea... |
4b22f25507917663ef56df523b8b2b09d21bd26da806ed47fe23b1e34338f013 | Python | 5,643 | 170 | from django.conf import settings
from django.contrib.messages import constants, utils
LEVEL_TAGS = utils.get_level_tags()
class Message:
"""
Represent an actual message that can be stored in any of the supported
storage classes (typically session- or cookie-based) and rendered in a view
or template.
... |
0ad2818f69d1e749b8657140a273b10dcca65bc2648f403dc71b7b10c2dba496 | Python | 5,644 | 200 | # This file is dual licensed under the terms of the Apache License, Version
# 2.0, and the BSD License. See the LICENSE file in the root of this repository
# for complete details.
from __future__ import absolute_import, division, print_function
import abc
import six
from cryptography import utils
from cryptography.... |
c99cc9c238f9a2b38a64751048dbe99950d2d7e6345e0cd77a8865257fb9571e | Python | 5,653 | 177 | from __future__ import division, print_function, absolute_import
import numpy as np
from os.path import splitext
def read_bvec_file(filename, atol=.001):
"""
Read gradient table information from a pair of files with extentions
.bvec and .bval. The bval file should have one row of values
representing ... |
52aef77739c487f822e705adc970f34d4034349d17417b6c475f1e1b992fab4a | Python | 5,657 | 141 | from unittest.mock import patch
from django.contrib.auth.models import User
from django.test import TestCase
from django.urls import reverse
from .tests_orig import QuestionnaireFormValidation, UtilTests
from ..models import QuestionnaireResponse
USERNAME = 'joaopedro'
PASSWD = 'password'
class QuestionnaireFillTe... |
dfd7864373b08e11a7c324d3229d42b7b5d5203e7d2d33bb767572157cc3889e | Python | 5,660 | 169 | #!/usr/bin/env python3
from __future__ import annotations
import ast
import importlib.util
import inspect
import sys
from pathlib import Path
from google_docstring_parser import parse_google_docstring
TARGET_PARENT_CLASSES = {"DualTransform", "ImageOnlyTransform", "Transform3D"}
# We'll check for both, but have di... |
5e4771a4fe72a901e37380708aa31d99aa4c7554e1394e0b5125a00e7fdc813b | Python | 5,679 | 161 | # This file is dual licensed under the terms of the Apache License, Version
# 2.0, and the BSD License. See the LICENSE file in the root of this repository
# for complete details.
from __future__ import absolute_import, division, print_function
from cryptography.exceptions import InvalidTag
_ENCRYPT = 1
_DECRYPT = ... |
73ed4a4536710cf2382aeddf4c2af5cb01af18ecf34cebfab25645d207c76dfe | Python | 5,679 | 192 | # -*- coding: utf-8 -*-
#
# Configuration file for the Sphinx documentation builder.
#
# This file does only contain a selection of the most common options. For a
# full list see the documentation:
# http://www.sphinx-doc.org/en/master/config
# -- Path setup -----------------------------------------------------------... |
e488fae7a499222a379ab7ec0295691fe39bfcf9940e9bcce03c905003a1f40a | Python | 5,685 | 153 | #!/usr/bin/env python2
desc="""Crosslink given proteomes and uniprot.
Using md5 hashing to detect the same proteins.
"""
epilog="""Author:
l.p.pryszcz+git@gmail.com
Barcelona, 6/11/2013
"""
import argparse, os, sys
from Bio import SeqIO, SwissProt
from datetime import datetime
import hashlib
import gzip
def loa... |
1ef5a903b7dcfedf9cdf7bdc85dbbb466fa934eb6985cf4022e4601b86c234b5 | Python | 5,705 | 196 | # Access WeakSet through the weakref module.
# This code is separated-out because it is needed
# by abc.py to load everything else at startup.
from _weakref import ref
__all__ = ['WeakSet']
class _IterationGuard:
# This context manager registers itself in the current iterators of the
# weak container, such ... |
9d5a5611e896b04f358c56cfb5f58b68765f6738e80f0fe3a5c6fc97744f1fb1 | Python | 5,715 | 140 |
import constants
from connection import Connection
import socket
import logging
import multiprocessing
import ismrmrd.xsd
import importlib
import simplefft
import invertcontrast
import analyzeflow
import t1mapping
import myomapnet
class Server:
"""
Something something docstring.
"""
def __init__(se... |
37332ec71cdfc1dc2ae32db0b3225e43e373a543c8744b3e0fca78d169bcb043 | Python | 5,722 | 176 | ###############################################################################
# NIFTI.py provides an implementation of MRS class for generic NIFTI file
# format
###############################################################################
# Copyright (c) 2019-2020, University of Liège
# Author: Nikita Beliy
# Owner... |
9f1100c9c56c1fe2c98431a4617debc3ebc8f9882689b7e99b1ce70863b767c6 | Python | 5,722 | 176 | ###############################################################################
# NIFTI.py provides an implementation of MRI class for generic NIFTI file
# format
###############################################################################
# Copyright (c) 2019-2020, University of Liège
# Author: Nikita Beliy
# Owner... |
bfd45d0ffa2f03cac2b6ab02f7922f922e55ebaeeb00e84682cddf6f6abdc693 | Python | 5,724 | 187 | from .error import VerificationError
class CffiOp(object):
def __init__(self, op, arg):
self.op = op
self.arg = arg
def as_c_expr(self):
if self.op is None:
assert isinstance(self.arg, str)
return '(_cffi_opcode_t)(%s)' % (self.arg,)
classname = CLASS_NA... |
dc2a50997c14b0edea05746f51b09481e6fde47b3bea2532b62d74a1ebec256c | Python | 5,727 | 155 | # -*- coding: utf-8 -*-
"""Distributed Task Queue"""
# :copyright: (c) 2015 Ask Solem and individual contributors.
# All rights # reserved.
# :copyright: (c) 2012-2014 GoPivotal, Inc., All rights reserved.
# :copyright: (c) 2009 - 2012 Ask Solem and individual contributors,
# All rights ... |
bc2621342eea46f3c83c62f0f069c0aa2f9cd520b0409970b81b59dfa9fb2d26 | Python | 5,733 | 140 | from django.contrib.syndication.views import Feed as BaseFeed
from django.utils.feedgenerator import Atom1Feed, Rss201rev2Feed
class GeoFeedMixin:
"""
This mixin provides the necessary routines for SyndicationFeed subclasses
to produce simple GeoRSS or W3C Geo elements.
"""
def georss_coords(self... |
429bfce4e025b4f5632fb5ae413af1f9809922b950f2b1186904d2daf8a33c1c | Python | 5,735 | 180 | from __future__ import division, print_function, absolute_import
from functools import reduce
import numpy as np
import numpy.testing as npt
from dipy.reconst.multi_voxel import _squash, multi_voxel_fit, CallableArray
from dipy.core.sphere import unit_icosahedron
def test_squash():
A = np.ones((3, 3), dtype=fl... |
1669a41aaf59d3c7d76675824b72337bc9ddbc838600070cc8ac6a5b2c58962c | Python | 5,736 | 188 | import json
from psycopg2.extras import Json
from django.contrib.postgres import forms, lookups
from django.core import exceptions
from django.db.models import (
Field, TextField, Transform, lookups as builtin_lookups,
)
from django.utils.translation import gettext_lazy as _
from .mixins import CheckFieldDefault... |
cabe90042735f6ee2e69fd34cef4407a4e0a0a3b45b0e44b4b698d8681f92329 | Python | 5,737 | 174 | ###############################################################################
# NIFTI.py provides an implementation of PET class for generic NIFTI file
# format
###############################################################################
# Copyright (c) 2019-2020, University of Liège
# Author: Nikita Beliy
# Owner... |
061a3abefd543228b8fb7824c8a72c87ed1cf526de36936f01169ffee3402fe1 | Python | 5,746 | 137 | """Legacy experiment analytics using current pandas and optional matplotlib."""
import json
from pathlib import Path
import pandas as pd
class Analyze:
def __init__(self, source=None):
self._parameter_columns = getattr(source, 'parameter_columns', None)
params = getattr(source, 'params', None)
... |
b9d4e0685f90c9c1b86620e9668fd086d8c2bb170cd4250a524e1d8655d030e5 | Python | 5,755 | 178 | # -*- coding: utf-8 -*-
"""
celery.concurrency.prefork
~~~~~~~~~~~~~~~~~~~~~~~~~~
Pool implementation using :mod:`multiprocessing`.
"""
from __future__ import absolute_import
import os
from billiard import forking_enable
from billiard.pool import RUN, CLOSE, Pool as BlockingPool
from celery import plat... |
69e7aa5021260ece077ba88126905f3cca411e45df1e587b8c1fcc7832b483e9 | Python | 5,756 | 177 | from inits import *
import tensorflow.compat.v1 as tf
flags = tf.app.flags
FLAGS = flags.FLAGS
# global unique layer ID dictionary for layer name assignment
_LAYER_UIDS = {}
def get_layer_uid(layer_name=''):
"""Helper function, assigns unique layer IDs."""
if layer_name not in _LAYER_UIDS:
_LAYER_UI... |
b9c98cc29ef75677c9a9c11ff0f26cb616c22539399f9e87b4d8bef0cd0bd67b | Python | 5,763 | 157 | import numpy as np
import numpy.testing as npt
import nibabel as nib
import dipy.reconst.sfm as sfm
import dipy.data as dpd
import dipy.core.gradients as grad
import dipy.sims.voxel as sims
import dipy.core.optimize as opt
import dipy.reconst.cross_validation as xval
from dipy.io.gradients import read_bvals_bvecs
def... |
a8913f8dbc60003576e5986d711067183d9b89c5a78ba0d7e592ea1d30b57cc5 | Python | 5,767 | 111 | """
This module houses the ctypes function prototypes for GDAL DataSource (raster)
related data structures.
"""
from ctypes import POINTER, c_bool, c_char_p, c_double, c_int, c_void_p
from functools import partial
from django.contrib.gis.gdal.libgdal import GDAL_VERSION, std_call
from django.contrib.gis.gdal.prototype... |
66c154c6773e1a2f1998341dc9425d122d8f0234d18b0214a9768635d51e6792 | Python | 5,780 | 158 | """
BORIS
Behavioral Observation Research Interactive Software
Copyright 2012-2026 Olivier Friard
This file is part of BORIS.
BORIS 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 L... |
aac38dc8456bcfdf54d571270b27657ed038d784233608222bbc1cb2d6679367 | Python | 5,803 | 135 | #!/usr/bin/env python2
"""
Convert embl to gtf.
USAGE:
cat in.embl | embl2gtf.py > out.gtf
NOTE:
It's designed to work with gb files coming from EMBL. gene is used as gene_id and transcript_id (locus_tag if gene not present).
Only entries having types in allowedTypes = ['gene','CDS','tRNA','tmRNA','rRNA','ncRNA'] are... |
5c6be771779f823d9bfdc1e0c333f9c4aae19e0ad60421f8e8b75d321f04dfda | Python | 5,809 | 224 | import platform
import sys
from pathlib import Path
import pandas as pd
import pytest
from brainreg.core.cli import main as brainreg_run
from .utils import check_images_same, check_volumes_equal
if platform.system() == "Darwin":
if platform.machine() == "x86_64":
test_dir = "Darwin_intel"
else:
... |
d9c5a52c9050f51775540bc67376d608c4017b4589b56462e044e4025b95dc09 | Python | 5,814 | 129 | """Column aliases for result tables without changing live parameter names."""
_CATEGORY_PREFIX = '__talos_category__:'
def log_frame(result):
"""Typed parameter categories in a portable Polars view, without Arrow."""
import numpy as np
import polars as pl
from .serialization import dumps
def f... |
d93fa89e0dbff98bd696d1cc1c4a3f99420f3d952e612cd65fcfc0324018af6d | Python | 5,819 | 179 | import napari
import pytest
from brainglobe_atlasapi import BrainGlobeAtlas
from brainreg.napari.register import (
add_registered_image_layers,
brainreg_register,
)
def test_add_detect_widget(make_napari_viewer):
"""
Smoke test to check that adding detection widget works
"""
viewer = make_nap... |
d3337d6a61e3fac4071232e650a82af4d52918a308dff03043e28185a23c4984 | Python | 5,823 | 153 | """Split caller DataFrames into consistent training, validation and test outputs."""
import math
import numbers
from collections.abc import Sequence
from datetime import date
from itertools import accumulate
from typing import Any
import polars as pl
def split_sequential(data: pl.DataFrame, ratios: Sequence[int]) -... |
fa7527167a6b9bf447441fa932cad159a56e69bf843e6dff109742157fea4309 | Python | 5,823 | 149 | #!/usr/bin/env python2
desc="""Insert SNPs from vcf into fasta.
If coordinates are provided in header name (chrI:200-300) the script will use them!
NOTE: coordinates are 0-based, half-open (BED,python) by default.
"""
epilog="""Author:
l.p.pryszcz+git@gmail.com
Girona/Cracow, 6/11/2012
"""
import argparse, os, rando... |
f39d5fbbc860ffd0f84aff5af279ada19ba388e45ae0ab1f63fe2bf791a7093d | Python | 5,836 | 185 | import numpy as np
import soundfile
import librosa
import os
from sklearn import metrics
from collections import Counter
import logging
import math
import matplotlib.pyplot as plt
import matplotlib.ticker as ticker
from collections import OrderedDict
from sklearn.metrics import recall_score, confusion_matrix, roc_auc_s... |
56ff8c01f134b8d89e245e96f604384cef881c2090bcbd6a014ee5c842b88b39 | Python | 5,848 | 133 | import argparse
from django.contrib.gis import gdal
from django.core.management.base import BaseCommand, CommandError
from django.utils.inspect import get_func_args
class LayerOptionAction(argparse.Action):
"""
Custom argparse action for the `ogrinspect` `layer_key` keyword option
which may be an integer... |
f51fcd2eab32a07dd8dcddea566e6c75738906d3a4a676f474286b3edcb11b9f | Python | 5,868 | 184 | """Blood vessel tortuosity"""
import numpy as np
import matplotlib.pyplot as plt
from igraph import *
import readimg
import tifffile_old as tifffile
import multiscale_tortuosity
import scipy.ndimage as nd
import file_tree
import time
def createAlphaImage(imgBack, indChange, colors, ABack=1., AFeature=0.7):
img_f = ... |
493f457a0ceca5df438908d1daef3affd68c16d12d4d15e4c1c6357d77e56a0f | Python | 5,870 | 173 | """A pure Python implementation of import."""
__all__ = ['__import__', 'import_module', 'invalidate_caches', 'reload']
# Bootstrap help #####################################################
# Until bootstrapping is complete, DO NOT import any modules that attempt
# to import importlib._bootstrap (directly or indirect... |
e9a745d4aa5903398234f73916e5d94301b1c52b9c521833fadf090d4b0e5771 | Python | 5,870 | 176 | """Stain normalization methods."""
__all__ = ["MachenkoStainNormalizer", "VahadaneStainNormalizer"]
from collections.abc import Callable
from functools import partial
from typing import Union
import numpy as np
from histoprep.functional._normalize import (
adjust_stain_concentrations,
check_and_copy_image,
... |
ec1f54e9008e60d5cd83806e2dcbb766d8f3078d15ecf7b431b75c999a1ca260 | Python | 5,870 | 104 | from experiment import models
import subprocess
# Collect and send User's (nep: Researcher's) -> ResearchProject's
# (nep: Study's), Experiment's and Experiment releated objects
users = models.User.objects.all()
portal_server = 'http://192.168.59.61:8000'
for user in users:
subprocess.call(['http', '-a', 'lab1:n... |
14a580b0f14bb05e73bd6f7af00f2fa839a8c9400f0969366e815d00fd66b9ef | Python | 5,873 | 140 | import numpy as np
import scipy.spatial.distance as distance
import scipy.stats as stats
import sklearn.metrics
from sksurv.compare import compare_survival
def ssum(a, axis=None, dtype=None, out=None, keepdims=np._NoValue, initial=np._NoValue, where=np._NoValue, nan_policy='propagate'):
# see https://docs.sci... |
89a907d5feb48f5960e14d537f33ac870b70affd6ba0f44efb513e12787ba949 | Python | 5,879 | 175 | import time
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.utils.data import DataLoader
from ba_lowmem import ba
from utils import Batch_evaluate
class Block(nn.Module):
def __init__(self, in_feat=128, out_feat=128, dropout=0.2):
super().__init__()
self.model = nn.... |
793ff9e485734ffcbcfe5e5cd808fcb9c42a58a08c739da485fe0dfae521804e | Python | 5,890 | 124 | from tkinter import DISABLED, StringVar
from tkinter.ttk import Label, Separator, Button, Frame
from Biscuit.CustomWidgets.InfoEntries import InfoEntry, InfoChoice
from Biscuit.CustomWidgets import DateEntry
from Biscuit.Management import OptionsVar, convert, ToolTipManager
# assign the tool tip manager
ttm = ToolTip... |
2cd00e6cbab0cbbf69174c4b216477e9d93a56d2f946ad2e393ee82d05b7643e | Python | 5,900 | 198 | from __future__ import absolute_import
import sys
from celery.concurrency.base import BasePool
from celery.five import monotonic
from celery.worker import state
from celery.worker import autoscale
from celery.tests.case import AppCase, Mock, patch, sleepdeprived
class Object(object):
pass
class MockPool(BaseP... |
74dd970f75e8433a587d74d1ede7a5da99edcba20d6305aca89785392786ae22 | Python | 5,918 | 20 | # -*- coding: utf-8 -*-
# Generated by Django 1.11.20 on 2019-04-17 15:28
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('custom_user', '0002_userprofile_citation_name'),
]
operations = [
migratio... |
67baf39ff8f79375ef41cd86de38e4f68707acd89e0aa4e208e10df04702d38e | Python | 5,929 | 159 | from tkinter import WORD, END, StringVar
from tkinter.scrolledtext import ScrolledText
from tkinter.ttk import Frame, Button, Label
from warnings import warn
try:
from pygments import lex
from pygments.lexers.python import Python3Lexer
from pygments.lexers.matlab import MatlabLexer
HAS_PYGMENTS = True
e... |
9c9a47e5a6ced9ba0b922b51bab52d35ff2b24ddad60cbd8d2d88deaaa3371f3 | Python | 5,932 | 147 | #!/usr/bin/env python3
"""Assert the complete contributor sdist and the isolated Talos wheel contract."""
from __future__ import annotations
import hashlib
import re
import subprocess
import sys
import tarfile
import zipfile
from pathlib import Path
from typing import Final
try:
import tomllib
except ModuleNotFou... |
e8272da6585164a8bc52f2be076909191672495b289d427089e43c4b49318fa5 | Python | 5,935 | 175 | from django.contrib.gis.geos import prototypes as capi
from django.contrib.gis.geos.coordseq import GEOSCoordSeq
from django.contrib.gis.geos.error import GEOSException
from django.contrib.gis.geos.geometry import GEOSGeometry, LinearGeometryMixin
from django.contrib.gis.geos.point import Point
from django.contrib.gis.... |
950c38d20bda9b899d464199b3eb4343eae25c645324380693bad74c1d9bc9b2 | Python | 5,955 | 119 | ###############################################################################
## Vision Research Laboratory and ##
## Center for Multimodal Big Data Science and Healthcare ##
## University of California at Santa Barbara ##
... |
7c0e82f4cbe096677b472ecde61cd5253d9527edf8cecfbc64e2b050cdbfdbce | Python | 5,959 | 189 | from __future__ import annotations
import pytest
from aicspylibczi import CziFile
from openslide import OpenSlide, OpenSlideUnsupportedFormatError
from PIL import Image, UnidentifiedImageError
from histoprep._backend import CziBackend, OpenSlideBackend, PillowBackend
from tests._utils import (
SLIDE_PATH_CZI,
... |
cef31c2e10dd45a790aa3a719beb6471aa1ccd0940b7b2e78afe7a10f7b950bb | Python | 5,959 | 161 | """Tests for event editing dialogs."""
from decimal import Decimal
import pytest
from PySide6.QtWidgets import QDialog
from boris import config as cfg
from boris import edit_event
@pytest.fixture
def warnings(monkeypatch):
messages = []
monkeypatch.setattr(edit_event.QMessageBox, "warning", lambda *args: m... |
5559eb6e9cb2504482ee8d61088326db1e5f373a682aee07246b7b078ff9ed87 | Python | 5,965 | 162 | """Provide legacy model callback examples with lazy framework imports."""
def breast_cancer(x_train, y_train, x_val, y_val, params):
from tensorflow.keras.layers import Dense, Dropout
from tensorflow.keras.models import Sequential
from talos.metrics.keras_metrics import f1score, matthews, precision, rec... |
19ff5107e555cc5035646e1ca29f3b1483559c39ef44a63ab88318426b1d9ef9 | Python | 5,967 | 196 | import torch.nn as nn
import torch.nn.functional as F
import math
import torch
# adapt from https://github.com/Kamnitsask/deepmedic
class ResBlock(nn.Module):
def __init__(self, inplanes, planes):
super(ResBlock, self).__init__()
self.inplanes = inplanes
self.conv1 = nn.Conv3d(inplanes, pl... |
4bedfb22e2589ec8f3c80c44271524848a18c46e36d53cede178a0f59447f7b8 | Python | 5,980 | 168 | """Profile caller experiment search spaces and sampled training behavior."""
import logging
import math
import random
import re
import time
from dataclasses import dataclass, field
from typing import Any
from typing_extensions import override
from talos.yaml.schema import COMPLEXITY_HIGH_MAX, COMPLEXITY_LOW_MAX, COM... |
b8a76d7c6d9e2e0f126c6769809faff1d4dace86c742690a26a0158cea351c19 | Python | 5,986 | 157 | """
Cross-validation analysis of diffusion models
"""
from __future__ import division, print_function, absolute_import
from dipy.utils.six.moves import range
import numpy as np
import dipy.core.gradients as gt
def coeff_of_determination(data, model, axis=-1):
"""
Calculate the coefficient of determination fo... |
5d036a0cb23d79029ad430c0f8ef29182687cad5094169f4796bea042ee39c36 | Python | 5,990 | 163 | import numpy as np
import pandas as pd
import pytest
from numpy.testing import assert_allclose
from scikit_posthocs import posthoc_durbin
from scikit_posthocs import test_durbin as durbin
from tests._input_cases import block_input
@pytest.fixture
def balanced_pairs():
return np.array(
[
[1, 2... |
ce3bc6550bc4e4ac2d3a240b366e2d3f0889e945829084fa901892c7e17c12d5 | Python | 5,990 | 173 | """Thin parameter choices whose observed metric variation has saturated."""
import logging
from typing import Any
import polars as pl
from typing_extensions import override
from talos.experiment.reducer.filter_types import FILTER_SAMPLE
from talos.experiment.reducer.pruning_strategy import PruningStrategy
logger = ... |
ff1576bc8fde771de57f415e80e6bcb0df7a652a8075b9e387260b22d67b8cd4 | Python | 5,991 | 189 | """Validation class for BIDS projects."""
import re
import os
import json
class BIDSValidator():
"""An object for BIDS (Brain Imaging Data Structure) verification in a data.
The main method of this class is `is_bids()`. You should use it for
checking whether a file path compatible with BIDS.
Parame... |
98033249959566e5717ecb16f9d486aadb33565f2b6c36becf8679191f535e91 | Python | 5,992 | 227 | #
# The Python Imaging Library.
# $Id$
#
# TGA file handling
#
# History:
# 95-09-01 fl created (reads 24-bit files only)
# 97-01-04 fl support more TGA versions, including compressed images
# 98-07-04 fl fixed orientation and alpha layer bugs
# 98-09-11 fl fixed orientation for runlength decoder
#
# Copyright ... |
e8be6ad2c0a1e1a1ec3a0faa9433a6a764a593b6f75f76c3a97f11e190c8b21d | Python | 5,999 | 179 | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import sys
import warnings
from contextlib import contextmanager
import pytest
from _pytest import compat
SHOW_PYTEST_WARNINGS_ARG = "-Walways::pytest.RemovedInPytest4Warning"
def _setoption(wmod, arg):
... |
1bc06e235c61f1b04b79592ec4a02f2020938c1571051d19df527c4aad79c34f | Python | 6,002 | 170 | import pickle
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
# from sympy.plotting import plot_implicit
from constants import *
import matplotlib.colors as mcolors
def plot_grid(grid, ax, is_colbar=False, cm_range=None, cm='inferno'):
ylabels = ['Gr-{}'.format(abc[0])] + ['{}'.format(i)... |
70a42d7602287394a310ecb44dd51704b5ec1c71fc234a0bad355ceda1b1218d | Python | 6,004 | 148 | #!/usr/bin/env python3
"""Coverage floor gate: actual coverage must clear a ratcheting floor.
Two rules over `talos/`, read from `coverage.json`:
FLOOR actual line/branch coverage >= the floor in
`.github/budgets.json`. The Limen-style absolute gate.
TRACK once the package is non-trivial, the floor may... |
06a5380aba808da7169db51893bca12e73a5a38963076798f1a3dbae6b6e9c99 | Python | 6,010 | 151 | import torch
from abc import abstractmethod
from numpy import inf
from logger import TensorboardWriter
class BaseTrainer:
"""
Base class for all trainers
"""
def __init__(self, model, criterion, metric_ftns, optimizer, config):
self.config = config
self.logger = config.get_logger('trai... |
6fa72fb86c1479291f6a967f0d8eca7fd8f71b6d876607a3cd267267f6fc6d96 | Python | 6,011 | 179 | import torch.nn as nn
from saveNet import *
class _cmplxDropoutNd(nn.Module):
def __init__(self, rank, p=0.5, inplace=True):
super(_cmplxDropoutNd, self).__init__()
if p < 0 or p > 1:
raise ValueError("dropout probability has to be between 0 and 1, "
"but g... |
1fc265b17dcdce933d5c4dcce0750663b0a4259eeababf450b6cc0c6b90a48b2 | Python | 6,023 | 170 | # This method is reverse engineered from M.P. Rice-Fernandez et al 2019
# https://www.sciencedirect.com/science/article/pii/S0168169918301911
from methods import base
import numpy as np
from sklearn.svm import SVC
from sklearn.utils import resample
from skimage.color import rgb2luv
import glob
from tqdm import tqdm
im... |
ea0fd46d5eec61748aa2a91c06c3eb9bcee1ecbe705e2616c70c9aededb05123 | Python | 6,023 | 174 | ###############################################################################
# bidsmeNIFTI.py provides an implementation of MRI class for Nifti file format
# with dumped header in form of json file
###############################################################################
# Copyright (c) 2019-2020, University o... |
a161a859f3a06924e2e216fe12900a1d650f0358171b4b2394ca7aa73e0f3ee0 | Python | 6,026 | 181 | # -*- coding: utf-8 -*-
"""
celery.bin.celeryd_detach
~~~~~~~~~~~~~~~~~~~~~~~~~
Program used to daemonize the worker
Using :func:`os.execv` because forking and multiprocessing
leads to weird issues (it was a long time ago now, but it
could have something to do with the threading mutex bug)
""... |
ea1cb7d4fa4280954fb6eca8247ee8451d2386da25ef8a11dd0ffd3aa7887a25 | Python | 6,043 | 154 | # This file is dual licensed under the terms of the Apache License, Version
# 2.0, and the BSD License. See the LICENSE file in the root of this repository
# for complete details.
from __future__ import absolute_import, division, print_function
from cryptography import exceptions, utils
from cryptography.hazmat.primi... |
de9fb4a1660efbfcce0d4c966830d2cb19dee59b28bbe6ac8d1c4ba19a945731 | Python | 6,046 | 126 | from tkinter import BooleanVar, IntVar
from tkinter.ttk import Frame, Label, Separator
from Biscuit.CustomWidgets.InfoEntries import (InfoEntry, InfoLabel, InfoCheck,
InfoList, InfoChoice)
from Biscuit.Management import OptionsVar
class ConFileFrame(Frame):
def __in... |
961da7f12a280f9cba995e56216bc02c3635c090a7939829bbe4fc782c2558dd | Python | 6,053 | 177 | from __future__ import annotations
from unittest.mock import MagicMock, patch
import pytest
from albumentations.check_version import (
check_for_updates,
fetch_version_info,
get_opener,
parse_version,
parse_version_parts,
compare_versions,
)
def test_get_opener():
opener = get_opener()
... |
fa346d99c62c1d70cd8ff1756d585c9cb1763fc3a19ca83ec31d01f507dae2be | Python | 6,062 | 158 | from tkinter import Toplevel, StringVar, messagebox
from tkinter.ttk import Frame, Label, Button
import os.path as op
import pickle
from platform import system as os_name
from Biscuit.CustomWidgets.WidgetTable import WidgetTable
from Biscuit.Windows import ProjectSettingsWindow
from Biscuit.utils.constants import OSCO... |
dc6000736d266284e43f72d3a2219b350385d54150c111a6132e9c0c7377154e | Python | 6,079 | 151 | # This file is dual licensed under the terms of the Apache License, Version
# 2.0, and the BSD License. See the LICENSE file in the root of this repository
# for complete details.
from __future__ import absolute_import, division, print_function
from cryptography import exceptions, utils
from cryptography.hazmat.primi... |
ceaf8b40c966d329034e35e166429a7e333a03d5c5cca335cea5298ba92464ec | Python | 6,081 | 137 | # This script mainly builds a class to train the deep neuron network and obtain the optimized solution based on the DNN.
import time
import numpy as np
import scipy.io as scio
import torch
import torch.nn as nn
from bba import bba
from torch.utils.data import DataLoader
class mlopt():
def __init__(self, filename... |
2e5d32a3173a0d9b73a239d929e82f9c695afa1abac8b490d433e419293570a3 | Python | 6,085 | 173 | # -*- coding: utf-8 -*-
"""
babel.messages.checkers
~~~~~~~~~~~~~~~~~~~~~~~
Various routines that help with validation of translations.
:since: version 0.9
:copyright: (c) 2013-2018 by the Babel Team.
:license: BSD, see LICENSE for more details.
"""
from babel.messages.catalog import Transla... |
95174c3e11d9feddb43b4ba8d5de4b9f109d93b6eaced446776a6d13b7378aec | Python | 6,087 | 206 |
from __future__ import (absolute_import, division, print_function,
unicode_literals)
from citeproc.py2compat import *
# http://sourceforge.net/mailarchive/message.php?msg_id=25355232
# http://dret.net/bibconvert/tex2unicode
from warnings import warn
from .. import VARIABLES
class CustomDi... |
a42fae600371f97596e6f60798642c884a61f9996f7f187b444948ab8b3b3081 | Python | 6,087 | 224 | #!/usr/bin/env python3
"""Ruleset drift gate for the protected main-branch ruleset."""
from __future__ import annotations
import argparse
import json
import subprocess
import sys
from pathlib import Path
from typing import Any, Final
from _common import exit_if_disabled
BANNER: Final[str] = 'RULESET GATE'
REQUIRED... |
8f00fad3744d6cf6e1123e486641e2aa16a2243ad6eddbb9f76f0263e71d1607 | Python | 6,094 | 193 | """
exception classes and constants handling test outcomes
as well as functions creating them
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import sys
class OutcomeException(BaseException):
""" OutcomeException and its subclass instances indicate... |
c8becb2d462615cea502fe98e7df2451b3cf8a1f556a8892962f5db346702f00 | Python | 6,110 | 157 | import pytest
from PySide6.QtCore import QEvent, Qt
from PySide6.QtGui import QKeyEvent, QKeySequence
from PySide6.QtWidgets import QDialog, QDialogButtonBox, QPushButton
from boris import behavior_shortcut_qevent
def portable_text(shortcut):
return shortcut.toString(QKeySequence.SequenceFormat.PortableText)
d... |
7d0708e8a2beb2a40f8e284ae246f043bf21caff201932640981f80c87a1f6be | Python | 6,119 | 166 | """Module for checking and comparing albumentations package versions.
This module provides utilities for version checking and comparison, including
the ability to fetch the latest version from PyPI and compare it with the currently
installed version. It helps users stay informed about available updates and
encourages ... |
8ecb544434ae75e232d912bda59c046637d0c77aa9175ed4f1fd672e5c686593 | Python | 6,136 | 167 | #!/usr/bin/env python2
"""Order contigs based on nucmer output.
Author:
l.p.pryszcz+git@gmail.com
Barcelona, 14/06/2012
"""
import os, sys
from optparse import OptionParser#,OptionGroup
from datetime import datetime
from genome_annotation import genome2dict,nucmer2list,_get_formatted_seq
def main():
usage = "u... |
f9fec41afcfe8e8a1903a83dab504e3e18ec56a78de12276aeac9adfff991274 | Python | 6,137 | 245 | #
# THIS IS WORK IN PROGRESS
#
# The Python Imaging Library
# $Id$
#
# portable compiled font file parser
#
# history:
# 1997-08-19 fl created
# 2003-09-13 fl fixed loading of unicode fonts
#
# Copyright (c) 1997-2003 by Secret Labs AB.
# Copyright (c) 1997-2003 by Fredrik Lundh.
#
# See the README file for informa... |
34818cc2a852734a999d11bca8196c3580260266d6a7c796b68eed9a067aecad | Python | 6,141 | 162 | import numpy as np
import pandas as pd
import pytest
import scikit_posthocs as sp
import scikit_posthocs._posthocs as posthocs
from tests._input_cases import BLOCK_POSTHOCS, LABELS, assert_matrix
@pytest.fixture
def block_values():
return np.array(
[
[31, 27, 24],
[31, 28, 31],
... |
b38eabfca090f61d4710d5cc8780062935deb22bd0aca9d6cd4dfe82893be6e2 | Python | 6,145 | 222 | # coding: utf-8
"""
Encoding DER to PEM and decoding PEM to DER. Exports the following items:
- armor()
- detect()
- unarmor()
"""
from __future__ import unicode_literals, division, absolute_import, print_function
import base64
import re
import sys
from ._errors import unwrap
from ._types import type_name as _... |
e1d2ba2b0699d6741d7c2430b569779ea13bf193c09c4bc96b9ef8080e588d65 | Python | 6,152 | 228 | #
# The Python Imaging Library.
# $Id$
#
# SGI image file handling
#
# See "The SGI Image File Format (Draft version 0.97)", Paul Haeberli.
# <ftp://ftp.sgi.com/graphics/SGIIMAGESPEC>
#
#
# History:
# 2017-22-07 mb Add RLE decompression
# 2016-16-10 mb Add save method without compression
# 1995-09-10 fl Created
#... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.