sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
93838e730f7770c14340e6a536467840fdaa32136ae3fab06038a08299fb7c78 | Python | 6,168 | 166 | from __future__ import annotations
import pytest
from governance import version_gate
def _pyproject(version: str) -> str:
return f'[project]\nname = "demo"\nversion = "{version}"\n'
def _changelog(version: str, body: str = '- Change.\n') -> str:
return f'# v{version}\n\n{body}\n# v1.2.3\n\n- Previous.\n'
... |
f575fcb235002ec994576b2021c1f898ca90fef4b9d9ebe10d87479b0ba945c5 | Python | 6,173 | 175 | import cv2
import numpy as np
import pytest
import albumentations as A
def get_downscale_image():
"""Create 100x100 test image for downscaling tests."""
image = np.zeros((100, 100, 3), dtype=np.uint8)
# Add recognizable pattern
image[20:80, 20:80, 0] = 255 # Red square
image[40:60, 40:60, 1] = 2... |
8f577946a79834d058f88f7973050bec44cbbf9ec3afc1704791b5c35aea3978 | Python | 6,178 | 184 | import os
import nibabel as nib
import numpy as np
import matplotlib
from matplotlib import pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
import skimage
from skimage import measure
import scipy
from scipy import ndimage
# patient = 'yejiguo'
# CT_dir = f"/Users/fangcai/Documents/MATLAB/{patient}_test/CT"
# mri... |
8dba35cddd9aa00d14bf740272ffb7615b5e66bef460b679a0ca6ddded8843e8 | Python | 6,179 | 157 | import os
import logging
from pathlib import Path
from functools import reduce, partial
from operator import getitem
from datetime import datetime
from logger import setup_logging
from utils import read_json, write_json
class ConfigParser:
def __init__(self, config, resume=None, modification=None, run_id=None):
... |
0a17f835de72cc690968b3582f51b9ccdf88b65cf56447b925a56698dd04dfeb | Python | 6,181 | 180 | #!/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)!
CHECK LINE80 - NOT TESTED CHANGES!
Author:
l.p.pryszcz+git@gmail.com
Barcelona, 25/04/2012
"""
impo... |
1a27f891f9dd05d05ee2c73635f2d385efffa8a709058e5ea83fb63a1ead6a40 | Python | 6,183 | 154 | import inspect
import types
from itertools import chain
from django.apps import apps
from django.core.checks import Error, Tags, register
@register(Tags.models)
def check_all_models(app_configs=None, **kwargs):
errors = []
if app_configs is None:
models = apps.get_models()
else:
models = ... |
1da8d57d273de79798112152e84b11f9bcc38d0307c9d7a4d7af23ecb4fc075c | Python | 6,185 | 158 |
from pathlib import Path
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
import pandas as pd
import json
if __name__ == "__main__":
# ------------------------ Load Data ------------------------------
dataset = 'nsclc'
path_features = Path.cwd()/('results/features/'+dataset+'/r... |
a507f31e608a382b644ab59d881af6051d6c7319e072bc9b6ba8a02de9f9ccc5 | Python | 6,185 | 178 | #!/usr/bin/env python2
"""Retrieve one2one orthologs between species A and B, that have been duplicated only once.
So A1 - B1 and A2 - B2 are orthologous, and there is no more orthologs/paralogs between these species.
Require:
ete2
Author:
l.p.pryszcz+git@gmail.com
Barcelona, 4/05/2012
"""
import os, sys
import num... |
d7e67d0c09bb0df60c63424fd8f0cb4e674360ab72fa3174b0c85ea55b6e0fc8 | Python | 6,190 | 159 | import inspect
import numpy as np
import pandas as pd
import pytest
from scipy import stats
import scikit_posthocs as sp
from tests._input_cases import (
INDEPENDENT_POSTHOCS,
LABELS,
assert_matrix,
independent_samples,
long_data,
)
@pytest.fixture(autouse=True)
def deterministic_dunnett(monkeyp... |
365378593adeb7af46489ad224118453d203160d54745130a4142825a23a1529 | Python | 6,198 | 196 | from __future__ import absolute_import, unicode_literals
from datetime import datetime
from pickle import loads, dumps
from celery import states
from celery.exceptions import ImproperlyConfigured
from celery.utils import uuid
from celery.tests.case import (
AppCase,
SkipTest,
depends_on_current_app,
... |
ff8fd38d741341b10f8b614bfb7aa55d3c60ca0216e1c0cac5dffb967646d232 | Python | 6,199 | 169 | import numpy as np
from dipy.sims.voxel import add_noise
from dipy.segment.mrf import (ConstantObservationModel,
IteratedConditionalModes)
class TissueClassifierHMRF(object):
r"""
This class contains the methods for tissue classification using the Markov
Random Fields modelin... |
86a00e8d2bb897b64e1b453b909427d24487805b88e7ba399dbe284d0eef1a71 | Python | 6,206 | 255 | # 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.... |
dff8deab536f60dc413c06f2b48078029b3524a92946f7120b4d539f86c4c559 | Python | 6,211 | 226 | from __future__ import division, print_function, absolute_import
import os
import numpy as np
from dipy.direction.peaks import (PeaksAndMetrics,
reshape_peaks_for_visualization)
from dipy.core.sphere import Sphere
from dipy.io.image import save_nifti
import h5py
def _safe_save(grou... |
49709e09cd7c74ea5fdb025688bbcc85babbac0413f316ede9f52286cbf1da8b | Python | 6,235 | 154 | # -*- coding: UTF-8 -*-
from django.test import TestCase
from custom_user.views import *
from django.contrib.auth.models import User
USER_USERNAME = 'myadmin'
USER_PWD = 'mypassword'
# Tests of the form of institutions
class InstitutionFormValidation(TestCase):
def setUp(self):
self.user = User.objects.c... |
a0a5a8594496e86da5610fac113ed34d398c7f6b65b6bde3570c1df6bc042a2f | Python | 6,235 | 187 | #!/usr/bin/env python2
"""Process SNPs report(s) and plot density on chromosomes given some window size (kb).
It ignores contigs without SNPs and having size smaller than twice of the window.
It can handle vcf and bam2snps.py output files.
Author:
l.p.pryszcz+git@gmail.com
Barcelona, 21/03/2012
"""
import os, sys
f... |
0c21c78cb9e7b09de6514391f9b47b3ce2f6a64bb90c3b1422c3ad9628d98ace | Python | 6,237 | 223 | #
# The Python Imaging Library.
# $Id$
#
# im.show() drivers
#
# History:
# 2008-04-06 fl Created
#
# Copyright (c) Secret Labs AB 2008.
#
# See the README file for information on usage and redistribution.
#
from __future__ import print_function
from PIL import Image
import os
import sys
import subprocess
import te... |
da7c6b3e4fff0ba2ca8715ee2f6cb8d208663a8738eec7dea516987a13720469 | Python | 6,246 | 139 |
import torch
import numpy as np
import torch.nn as nn
from saveNet import *
from math import exp
def sinc(input, weights):
x, y = torch.unbind(input, dim=-1)
b, c = torch.unbind(weights, dim=-1)
mag = np.pi * ((b*x)**2 + (c*y)**2)**0.5
output = torch.sin(mag)/mag
return output
class GriddingKerne... |
6cc8d89a9e4ddd20a2366f925021e0262852b53b28a8ec225aef7155473e955c | Python | 6,274 | 216 | """ MODULE images2gif
Provides a function (writeGif) to write animated gif from a series
of PIL images or numpy arrays.
This code is provided as is, and is free to use for all.
Almar Klein (June 2009)
- based on gifmaker (in the scripts folder of the source distribution of PIL)
- based on gif file structure as prov... |
e04198b5089a3713da373b456e55be072c62075921e566820fad19d4c33d54b9 | Python | 6,282 | 225 | #
# THIS IS WORK IN PROGRESS
#
# The Python Imaging Library.
# $Id$
#
# FlashPix support for PIL
#
# History:
# 97-01-25 fl Created (reads uncompressed RGB images only)
#
# Copyright (c) Secret Labs AB 1997.
# Copyright (c) Fredrik Lundh 1997.
#
# See the README file for information on usage and redistribution.
#
fr... |
c90cdb9c9392f66710176bfb2dd667590ba159819fa0c316dccd931638ce644f | Python | 6,298 | 227 | import os
from collections import defaultdict
import matplotlib.pyplot as plt
import numpy as np
import segmentation_models_pytorch as smp
import torch
from sklearn.model_selection import train_test_split
from torch.utils.data import DataLoader
from pytraction.net.dataloader import (Dataset, get_preprocessi... |
05692c77c6b6e1897961219557b08b6e713c402a044cbb40d7a17299dbc2a103 | Python | 6,304 | 178 | from __future__ import absolute_import
import re
from django import http
from django.apps import apps
from django.utils.cache import patch_vary_headers
from django.utils.deprecation import MiddlewareMixin
from django.utils.six.moves.urllib.parse import urlparse
from .conf import conf
from .signals import check_reque... |
58adfec7a8b76eff2075b30be34d7c239b5c193a108e0f46d30f63417e5bd38e | Python | 6,310 | 156 | #!/usr/bin/env python2
desc="""Generate expression plot similar to cummeRbund from .sf expression values.
CHANGELOG:
v1.3
- calculate FPKM for salmon output
"""
epilog="""Author: l.p.pryszcz+git@gmail.com
Mizerow, 8/05/2015
"""
import os, sys, time
from datetime import datetime
import numpy as np
import matplotlib.p... |
4b5c4a6c46922944dc88b28eab62d158b79c2463562277cf890be8dca4448048 | Python | 6,311 | 167 | import warnings
from typing import List, Optional, Union
import numpy as np
from pandas import DataFrame, Index, Series
def compact_letter_display(
p_values: Union[DataFrame, np.ndarray],
alpha: float = 0.05,
names: Optional[List] = None,
maxiter: int = 100,
) -> Series:
"""Compact Letter Display... |
9fdcc329f1fa28f0cc1d13711bebb81dcc3d5549ea3718b44a3ead8efd87379d | Python | 6,312 | 186 | from tkinter import Variable, StringVar, IntVar
class OptionsVar(Variable):
"""Construct a string options variable.
Parameters
----------
master : widget
The parent widget
value : str
The value from options to set as the currently selected value
If this is not specified, t... |
0ec2bb0932c073862fceff49d28ab0e25a84eba22014ce2bb4115fd373dbe509 | Python | 6,315 | 179 | ###############################################################################
# DICOM.py provides an implementation of MRI class for DICOM file format
###############################################################################
# Copyright (c) 2019-2020, University of Liège
# Author: Nikita Beliy
# Owner: Liege Un... |
2032fd1604f094149f51da3ff014a94bd9c760616b70dce0a8962a740e0acb2b | Python | 6,319 | 216 | #
# The Python Imaging Library.
# $Id$
#
# image palette object
#
# History:
# 1996-03-11 fl Rewritten.
# 1997-01-03 fl Up and running.
# 1997-08-23 fl Added load hack
# 2001-04-16 fl Fixed randint shadow bug in random()
#
# Copyright (c) 1997-2001 by Secret Labs AB
# Copyright (c) 1996-1997 by Fredrik Lundh
#
... |
a47def12c52e32be8083d2a6d6e17ea3beaecb69d2b2be8eeac6d61b3ad3f6e6 | Python | 6,325 | 206 | ###############################################################################
# tools.py contains a set of various convinience functions
###############################################################################
# Copyright (c) 2019-2020, University of Liège
# Author: Nikita Beliy
# Owner: Liege University https... |
fb36feb98f197554130e5a3361ef91e7a77086e10cb49b88d87b821543a7fa7f | Python | 6,326 | 133 | """Package a selected trained model and its experiment provenance locally."""
import hashlib
import json
import shutil
import tempfile
from pathlib import Path
import numpy as np
from talos.backends import backend_for
from talos.utils.best_model import activate_model, best_model
def _json(value):
if hasattr(val... |
34dc3e0f670806936b8b6ac622a3ea519253e75c2a19cd58d9e4e5fd6a70392d | Python | 6,334 | 185 | # -*- coding: utf-8 -*-
"""
babel.messages.jslexer
~~~~~~~~~~~~~~~~~~~~~~
A simple JavaScript 1.5 lexer which is used for the JavaScript
extractor.
:copyright: (c) 2013-2018 by the Babel Team.
:license: BSD, see LICENSE for more details.
"""
from collections import namedtuple
import re
from ba... |
700f7eda583db0963d48cf857f363cd38ea5128e9825d45033794917c637ef90 | Python | 6,348 | 248 | #
# Module which supports allocation of ctypes objects from shared memory
#
# multiprocessing/sharedctypes.py
#
# Copyright (c) 2006-2008, R Oudkerk
# Licensed to PSF under a Contributor Agreement.
#
from __future__ import absolute_import
import ctypes
import weakref
from . import heap, RLock
from .five import int_ty... |
7a697aacacb0e2b1081f104951ca8285476f7c487af4ca27ca3926f450d33a86 | Python | 6,355 | 166 | from itertools import chain
from types import MethodType
from django.apps import apps
from django.conf import settings
from django.core import checks
from .management import _get_builtin_permissions
def check_user_model(app_configs=None, **kwargs):
if app_configs is None:
cls = apps.get_model(settings.A... |
23af58cafd0420197419755f753a8c12a5c105c95a8f56532dc07640f5c66a2c | Python | 6,363 | 162 | from django.contrib.gis.db.models import GeometryField
from django.contrib.gis.db.models.functions import Distance
from django.contrib.gis.measure import (
Area as AreaMeasure, Distance as DistanceMeasure,
)
from django.db.utils import NotSupportedError
from django.utils.functional import cached_property
class Ba... |
929ab8e29c37c672320253f0691e6a447291759ef67fc1d2f585485ace64da99 | Python | 6,367 | 181 | import re
from .const import Bound, inf
from .interval import Interval
def from_string(
string,
conv,
*,
bound=r".+?",
disj=r" ?\| ?",
sep=r", ?",
left_open=r"\(",
left_closed=r"\[",
right_open=r"\)",
right_closed=r"\]",
pinf=r"\+inf",
ninf=r"-inf",
):
"""
Pars... |
e59d5eac13dccd82e506bfdfdc56c4b0e575408496368aa5714de2aa7dba7290 | Python | 6,371 | 168 | """ Module to help tests check script output
Provides class to be instantiated in tests that check scripts. Usually works
something like this in a test module::
from dipy.tests.scriptrunner import ScriptRunner
runner = ScriptRunner()
Then, in the tests, something like::
code, stdout, stderr = runner.ru... |
79432d875685707d0cd4689c8b71b1076654c0a0f8ae86002f894b310b540c87 | Python | 6,383 | 209 | ###############################################################################
# tools.py contains a set of various convinience functions
###############################################################################
# Copyright (c) 2019-2020, University of Liège
# Author: Nikita Beliy
# Owner: Liege University https... |
d1e8199b032dbd9654fcd839299b7389a5b1d37e4dbc4d9781ff63988d189b20 | Python | 6,388 | 293 | import numpy as np
from dipy.denoise import nlmeans_block
"""
Functions for Wavelet Transforms in 3D domain
Code adapted from
WAVELET SOFTWARE AT POLYTECHNIC UNIVERSITY, BROOKLYN, NY
http://taco.poly.edu/WaveletSoftware/
"""
def cshift3D(x, m, d):
"""3D Circular Shift
Parameters
----------
x :... |
1d7ca79235a16ff4545d89e314e4793b00b71dd487f465f53b636cc647ea24fa | Python | 6,396 | 97 | #!/usr/bin/env python2
desc="""Parse BWA MEM sam output and report reads matching two contigs.
"""
epilog="""Author:
l.p.pryszcz+git@gmail.com
Barcelona, 2/08/2013
"""
import argparse, os, sys
from datetime import datetime
def report_spanning(outfiles, sams, lenTh, verbose):
"""Take care only about the split_rea... |
9bcc28f762ce08fae0dea9f23c3136b40a9aa06525b2c55fa961395d97f88271 | Python | 6,408 | 192 | ###############################################################################
# ECAT.py provides an implementation of PET class for generic ECAT file format
###############################################################################
# Copyright (c) 2019-2020, University of Liège
# Author: Nikita Beliy
# Owner: Li... |
1ceb4611f2fcdac51704d388af40f7cf77c836679e647fa60439ce0fcdc1f77b | Python | 6,412 | 190 | from __future__ import absolute_import
import socket
from pickle import loads, dumps
from celery import states
from celery.exceptions import ImproperlyConfigured
from celery.tests.case import (
AppCase, Mock, mock_module, depends_on_current_app,
)
class Object(object):
pass
def install_exceptions(mod):
... |
da6c0ced364455428105f113504257d1f896bdd6c6e4b373ec47d29aad4d9515 | Python | 6,412 | 161 | import os
import numpy as np
import h5py
import time
area_um_min, area_um_max = 100,500 # cell area in um
circ_min, circ_max = 0,1 #circularity (range: 0-1)
userdef1_min, userdef1_max = 0.5, 1 #probability for class 0 (range: 0-1)
# a. filter all files in a given folder
path = r"."
files = os.listdir(path)... |
70c1a0dd73e6db1dd5623918cacf2ba23446eeeccc7b3f05a4eaf61c3f89cbc4 | Python | 6,419 | 196 | """
This module houses the GEOSCoordSeq object, which is used internally
by GEOSGeometry to house the actual coordinates of the Point,
LineString, and LinearRing geometries.
"""
from ctypes import byref, c_double, c_uint
from django.contrib.gis.geos import prototypes as capi
from django.contrib.gis.geos.base import... |
272717697193b48cb10b2f7aa61d5993c150ff7c24fbd7e1083b9e1f88569dea | Python | 6,420 | 191 | # -*- coding: utf-8 -*-
"""
The :program:`celery graph` command.
.. program:: celery graph
"""
from __future__ import absolute_import, unicode_literals
from operator import itemgetter
from celery.datastructures import DependencyGraph, GraphFormatter
from celery.five import items
from .base import Command
__all__... |
a1f1671cedd4d666853b4d09a1e6c56f6203ce994898130ce3978efeaf68afd9 | Python | 6,421 | 169 | #!/usr/bin/env python2
"""
Identify SNP sites in mpileup out from BAM alignments.
In addition calculates overall and each contig coverage.
At first run: /users/tg/lpryszcz/cluster/assembly/mpileup.sh (s=MCO456; samtools mpileup -f gem/$s.fa gem/${s}.bam > gem/${s}.mpileup)
Execute:
python ~/workspace/assembly/src... |
7bbc295c0de6f61a233de98389deb61b3229b8074ae79bd667c638a4dc16dd0d | Python | 6,428 | 160 | #!/usr/bin/env python2
desc="""Return sequences diverged by given percentage compares to input.
LOH sizes are drawn from log-normal distribution.
"""
epilog="""Author:
l.p.pryszcz+git@gmail.com
Mizerow, 4/03/2014
"""
import os, random, sys
from datetime import datetime
from Bio import SeqIO, Seq
import numpy as np
... |
1610390a2c2b120e41338dd1efbebded0f714a9fa899f9780894bba2632350b8 | Python | 6,429 | 158 | from tkinter import Toplevel, StringVar, BooleanVar, IntVar, DISABLED, NORMAL
from tkinter import Button as tkButton
from tkinter.ttk import Frame, Label, Button, Checkbutton, Entry
import os.path as op
import pickle
from PIL import Image, ImageTk
from Biscuit.utils.constants import OSCONST
from Biscuit.CustomWidgets.... |
dcfe2a162a3f23d7a6223738436e4005c75474e188cb9387169c461fadf2626b | Python | 6,431 | 187 | from types import SimpleNamespace
import pytest
from PySide6.QtCore import QBuffer, QEvent, QIODevice, QPoint, QPointF, Qt
from PySide6.QtGui import QColor, QMouseEvent, QPixmap
from boris import behaviors_coding_map, config as cfg
def bitmap_data():
pixmap = QPixmap(20, 20)
pixmap.fill(QColor("white"))
... |
5e95f129500ece78c4a4570fc5afac53f9094a8c068c6963a69efbf4e6fc5bd8 | Python | 6,437 | 188 | # 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 os
from cryptography import exceptions, utils
from cryptography.h... |
1ef267142b0c303eb8f0a0cbe6eed8bebaada20f62d03704edff1f754fe10d2e | Python | 6,448 | 171 | """Compare one Keras fit with a native Talos sweep on bundled Iris data.
Install the maintained generation for this example::
python -m pip install 'talos[keras,torch] @ git+https://github.com/autonomio/talos.git@master'
Choose the backend before running this file:
``KERAS_BACKEND=torch python examples/keras_to_... |
a7130ea4c2f070c5508ebd365c776436d8c1415684335177bc2daa818d63922f | Python | 6,448 | 163 | import numpy as np
try:
from scipy.linalg.lapack import dgesvd as svd
svd_args = [1, 0]
# If you have an older version of scipy, we fall back
# on the standard scipy SVD API:
except ImportError:
from scipy.linalg import svd
svd_args = [False]
from scipy.linalg import eigh
def localpca(arr, sig... |
b3bd400a18735e234cc38e25cc5bf8c86e57fd9edc681d1d48ac1b8ebdb02334 | Python | 6,459 | 149 | #!/usr/bin/env python2
desc="""
TDB:
- more sophisticated read capturing
- python3 support
CHANGELOG:
v1.1
- reports reads to tsv
"""
epilog="""Author: l.p.pryszcz+git@gmail.com
Warsaw/Mizerow, 18/06/2018
"""
import os, sys
from datetime import datetime
import numpy as np
#from multiprocessing import Pool
#from skle... |
0ed9541764f45a40c2adfe9f5269ab89f7d7ffc6992f3c09bd1667ec20acbea8 | Python | 6,470 | 205 | """
Base file upload handler classes, and the built-in concrete subclasses
"""
from io import BytesIO
from django.conf import settings
from django.core.files.uploadedfile import (
InMemoryUploadedFile, TemporaryUploadedFile,
)
from django.utils.module_loading import import_string
__all__ = [
'UploadFileExcep... |
c017848af9c27dadd27f00f2cc8e68e747c89a49dd5e2022d643739dde2f1849 | Python | 6,474 | 196 | """ support for providing temporary directories to test functions. """
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
import re
import tempfile
import warnings
import attr
import py
import six
import pytest
from .pathlib import ensure_reset_dir... |
a7ce75d4b528d2d945a771d186468206236eb3c4e6f9a42191485954fd0bec4f | Python | 6,477 | 178 | """
Optimization module for PCM toolbox with main functionality for model fitting.
@author: jdiedrichsen
"""
import numpy as np
from numpy.linalg import solve, eigh, cholesky
from numpy import sum, diag, log, eye, exp, trace, einsum
from PcmPy import model
def newton(theta0, lossfcn, max_iter=80, thres= 1e-4, hess_re... |
9c3313aea6f40416b57b3d049e5f67a157f5b436f4fb53e7727d8da6f43e3d3b | Python | 6,485 | 113 | """Select parameter cohorts using caller experiment metrics."""
import inspect
from pathlib import Path
import numpy as np
from talos.cohort.sfc import BUILTIN_SELECTORS
class Cohort:
"""Select saved trials and aggregate compatible outputs for caller tasks."""
def __init__(self, *, experiment_id=None, expe... |
d30db1c03ec8b0b7cc7c7be30ca303403d670b5d7f5ae4eca0c560f0a8a8c754 | Python | 6,485 | 182 | #DEGnext
#Copyright Tulika Kakati, 2020
#Distributed under GPL v3 license
#This code may be used to import cancer RNA-seq dataset(s) into Pytorch DataLoader
from torch.utils.data import Dataset
import numpy as np
from sklearn.preprocessing import Normalizer
import torch
import os
dir_path = os.path.dirname(os.path.abs... |
417fa7634f18303379714a8a3457fa1b421516cf6821e29af213889798e44e31 | Python | 6,491 | 178 | from collections import defaultdict
from django.apps import apps
from django.db import models
from django.utils.translation import gettext_lazy as _
class ContentTypeManager(models.Manager):
use_in_migrations = True
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
# Cac... |
6a169ae9832e9f9ceac5e65bbb40aeaca6b1038c15d1df6be977b869e862aef5 | Python | 6,500 | 192 | ###############################################################################
# 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... |
913145b83d7c3971444b7edc3d4258520cabffeeed12fa6d20988bd865684e96 | Python | 6,513 | 139 | # Author: Timothée Proix
# License: GPL-3.0-only
import os
import numpy as np
import scipy.io as sio
import matplotlib.pyplot as plt
import pandas as pd
import seaborn as sns
sns.set_context('paper')
sns.set(font_scale=2)
sns.set_style("ticks")
path_sim = 'path_sim'
show_plot = 1
savefig = 0
name = 'overt'
ldatase... |
2efbefe2c85008f94e477163af8ea2b8afb6bd04c0e2b37024ac48f498429387 | Python | 6,520 | 180 | """Lambda transform module for creating custom user-defined transformations.
This module provides a flexible transform class that allows users to define their own
custom transformation functions for different targets (image, mask, keypoints, bboxes).
It's particularly useful for implementing custom logic that isn't av... |
588976ff88712597cba5a0ea3390fdb1bdb3c2a501922fc7fe5db49602d16d0e | Python | 6,523 | 195 | ###############################################################################
# ECAT.py provides an implementation of PET class for generic ECAT file format
###############################################################################
# Copyright (c) 2019-2020, University of Liège
# Author: Nikita Beliy
# Owner: Li... |
e3700d36ee4476fab90a593559cd6acf5f68b59663badcc4f69627dbd6ffe034 | Python | 6,529 | 190 | # -*- coding: utf-8 -*-
"""
Created on Sat Dec 1 2019
A simple example of Hybrid plasticity SNN on fashion-MNIST datasets
Python 3.5.2
"""
from __future__ import print_function
import sys
import torchvision
import torchvision.transforms as transforms
import os
import torch
os.environ['CUDA_VISIBLE_DEVICES'] = "1"
i... |
bc0bd4601ce7491636ced7de65ee5adfccaeab56b5d4b1a40dc86cddcdc0c0c1 | Python | 6,532 | 166 | import json
from django.conf import settings
from django.contrib.messages.storage.base import BaseStorage, Message
from django.http import SimpleCookie
from django.utils.crypto import constant_time_compare, salted_hmac
from django.utils.safestring import SafeData, mark_safe
class MessageEncoder(json.JSONEncoder):
... |
c70c4c24c567d30a9dfd2a4d34a9add10b592b24f571d96c976508ce3be254ff | Python | 6,535 | 163 | # Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0
# For details: https://bitbucket.org/ned/coveragepy/src/default/NOTICE.txt
"""Summary reporting"""
import sys
from coverage import env
from coverage.report import Reporter
from coverage.results import Numbers
from coverage.misc import No... |
bd75027c54860f355f8f1fe4879f77759dbb5b8de82356f4a53936381759e3fe | Python | 6,554 | 174 | from django.contrib.auth import get_user_model
from django.contrib.auth.models import Permission
UserModel = get_user_model()
class ModelBackend:
"""
Authenticates against settings.AUTH_USER_MODEL.
"""
def authenticate(self, request, username=None, password=None, **kwargs):
if username is No... |
9960db16dd967415541c942d6d7c9f7ff11affafec062c00e47b7e927797b457 | Python | 6,558 | 218 | #
# The Python Imaging Library.
# $Id$
#
# a simple Qt image interface.
#
# history:
# 2006-06-03 fl: created
# 2006-06-04 fl: inherit from QImage instead of wrapping it
# 2006-06-05 fl: removed toimage helper; move string support to ImageQt
# 2013-11-13 fl: add support for Qt5 (aurelien.ballier@cyclonit.com)
#
# Copyr... |
d340daa5d41bd38fa4efd2998f3cdfc2723543c9dfb221794cf79572a6c6570d | Python | 6,562 | 216 | import contextlib
import io
import os
import sys
import tempfile
try:
import fcntl
except ImportError:
fcntl = None
__version__ = '1.3.0'
PY2 = sys.version_info[0] == 2
text_type = unicode if PY2 else str # noqa
def _path_to_unicode(x):
if not isinstance(x, text_type):
return x.decode(sys.ge... |
802c03776c6427de63c70196708cfd208b2dd5aaf2686278363b9f47bc4f9a6a | Python | 6,568 | 201 | # -*- coding: utf-8 -*-
"""
celery.backends.database
~~~~~~~~~~~~~~~~~~~~~~~~
SQLAlchemy result store backend.
"""
from __future__ import absolute_import
import logging
from contextlib import contextmanager
from functools import wraps
from celery import states
from celery.backends.base import BaseBacken... |
3b1a8da4b57d67a285aedc68909f151d5b9e73e740e349cb0ad3151f6da9c01c | Python | 6,575 | 217 | from __future__ import absolute_import
from celery import group, chord
from celery.app import builtins
from celery.canvas import Signature
from celery.five import range
from celery._state import _task_stack
from celery.tests.case import AppCase, Mock, patch
class BuiltinsCase(AppCase):
def setup(self):
... |
e6a29fe994185bf5bab6b7a5888241cd2acbc8461e7b2abfcb1e63e0a1912165 | Python | 6,583 | 148 | # coding=utf-8
from django.forms import CharField, CheckboxSelectMultiple, ModelForm, PasswordInput, RadioSelect, Select, TextInput, \
ValidationError
from django.contrib.auth.hashers import make_password
from django.contrib.auth.models import User
from django.utils.translation import ugettext_lazy as _
from djang... |
98abe19f86489e35dbd699bf6abc3a52cc2ad7f8df06ddd7e29f91944193aab7 | Python | 6,613 | 128 | #!/usr/bin/env python2
desc="""Parse BWASW sam output and convert split matches into pair-end fastq.
NOTE: sam has to be sorted by read name (default BWASW output)
"""
epilog="""Author:
l.p.pryszcz+git@gmail.com
Barcelona, 18/1/2013
"""
import argparse, os, re, sys
from Bio import Seq
from datetime import dateti... |
b9afcb5aa3a8493b4863fc9b77982efab8ee7d60655406d16fe0f5cc85b252e4 | Python | 6,618 | 189 | ###############################################################################
# Nibabel.py contains tools, that can be used in user plugins
# these tools do require nibabel module installed
###############################################################################
# Copyright (c) 2019-2020, University of Liège
#... |
7050d846effd9ac03b1f1f4903ddf61ff9970fe08724bc873731de029da98671 | Python | 6,621 | 130 | """Reject altered source wheels, incomplete audit graphs and unproved findings."""
import contextlib
import copy
import io
import json
import subprocess
import sys
import zipfile
from pathlib import Path
import pytest
import yaml
from tools.security.legacy_audit import dispositions
from tools.security.patches import ... |
972b8e1c80339f834549c775cc9fa2ea463473031a07fc48eeb2557527c8a334 | Python | 6,621 | 204 | #!/usr/bin/env python2
desc="""Fold sequences from BED file and report visual representation.
CHANGELOG:
"""
epilog="""Author:
l.p.pryszcz+git@gmail.com
Warsaw, 1/09/2015
"""
import argparse, os, re, sys, pysam
from datetime import datetime
import subprocess
import numpy as np
# https://github.com/pkerpedjiev/forg... |
fd75ccbd38e8e3ea1f3ed84148492c069f7ca07cea916abc3aead8e4f618d16e | Python | 6,621 | 194 | # -*- coding: utf-8 -*-
"""
Created on Sat Dec 1 2019
LP SNN on fashion-MNIST datasets
Python 3.5.2
"""
from __future__ import print_function
import sys
import torchvision
import torchvision.transforms as transforms
import os
import torch
import time
from model_lp import *
from shared_parameters import *
import ar... |
c8f6516929d6a3683363c4fd80c63c0fb35be9977eb6b81b0aa04fbd22534dec | Python | 6,632 | 172 | import sys
from pathlib import Path
import numpy as np
import numpy.random as npr
import numpy.testing as npt
import pytest
import delta
from delta import data, imgops
# fmt: off
MASK_1D = np.array(
[
[
0, 1,
0, 0, 0, 1, 1, 0, 1, 1,
0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 1, 1, ... |
eda278f64f2892fa1d1ff7d6e1baef181f2bc06ed630d802aa05fe6733f3106e | Python | 6,635 | 193 | # -*- coding: utf-8 -*-
"""
Created on Sat Dec 1 2019
Hybrid plasticity SNN on fashion-MNIST datasets
Python 3.5.2
"""
from __future__ import print_function
import sys
import torchvision
import torchvision.transforms as transforms
import os
import torch
import time
from model_hp import *
from shared_parameters imp... |
9d41de43d234008b37d0d8b6c3d4dc53dc3e01022978e03ac0b75f03ece44e62 | Python | 6,641 | 218 | # 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
@six.add_metacla... |
0ab817b4f7a3acb711a74897ac175e4173c30eee4bd341011c8f8aad4ce37b98 | Python | 6,644 | 173 | #!/usr/bin/env python2
"""
Parses vcf file (SNPs/INDELs) and check whether:
-coding
-nonsynonymous
-compare with reference (optionally)
In addition, filter for min depth of coverage and whether reads aligned to both strands.
"""
import os, sys
from optparse import OptionParser
from datetime import datetime
from genome... |
899a1075e6aa84c5f350a7d74b10ba070fc6a0268296bcd0d14c1ea35efb709f | Python | 6,654 | 165 |
import ismrmrd
import os
import itertools
import logging
import numpy as np
import numpy.fft as fft
import matplotlib.pyplot as plt
import xml.dom.minidom
import base64
import ctypes
import re
import mrdhelper
# Folder for debug output files
debugFolder = "/tmp/share/debug"
def process(connection, config, metadata):... |
106e70d3eac59c918edafd49370a321ee96daf32a621421f83bf665014cbe04f | Python | 6,667 | 167 | # -*- coding: utf-8 -*-
"""
Created on Wed Apr 7 14:28:48 2021
@author: hqin
Description:
This script main used to extract the intersect sites with one liminted depth(eg: totalRN>=10) in all reps,
in order to used varify the accuracy of our LSTM models among reps with the same sites with same depth.... |
22d68ce9a9d4faa7c7b7230921541f87288ad26a8fdf3a87a7bd80ee06d5be65 | Python | 6,667 | 167 | import unittest
import os
import logging
import shutil
import nibabel
import json
import numpy as np
from bidsme.Modules.MRI import NIFTI
from bidsme.plugins.tools import Nibabel as plNibabel
data_path = os.path.dirname(__file__)
class TestConvert3Dto4D(unittest.TestCase):
log_info = "bidsme.plugins.tools.Nib... |
bd261b681b147e472379572e6400e1b79720d9f224066aa843ec6f8b03a93108 | Python | 6,677 | 215 | import tempfile
from pathlib import Path
import cv2
import numpy as np
import pytest
from delta import imgops
from delta.config import Config
from delta.imgops import CroppingBox
from delta.pipeline import ROI, Position
from delta.utils import XPReader
DATA_PATH = Path(__file__).parent / "data"
@pytest.mark.parame... |
8a1a59f91bcb3063a6788743977456a4e582e5e823ab8d842b6dc4992b4ff046 | Python | 6,678 | 180 | from __future__ import annotations
import logging
from collections.abc import Sequence
from typing import Any, Literal, cast
import numpy as np
import pandas as pd
logger = logging.getLogger(__name__)
_FRAMEWORK_LOG_COLUMNS = frozenset({
'id', '_id', '_round_index', 'execution_time', '_warnings',
})
def exper... |
8ad7a5fee1af0d0c6b8580f956c42dfe3147c960745e00d6e31930abc7f72a22 | Python | 6,685 | 179 | from ctypes import byref, c_uint
from django.contrib.gis.geos import prototypes as capi
from django.contrib.gis.geos.geometry import GEOSGeometry
from django.contrib.gis.geos.libgeos import GEOM_PTR
from django.contrib.gis.geos.linestring import LinearRing
class Polygon(GEOSGeometry):
_minlength = 1
def __i... |
59baf0dea7f699049bc98f8cdf43cac55c17a6953ddbdd0fa8d111cd6e95f557 | Python | 6,686 | 148 | from __future__ import division
import tensorflow as tf
from ops import *
from utils import *
def discriminator(image, options, reuse=False, name="discriminator"):
with tf.variable_scope(name):
# image is 256 x 256 x input_c_dim
if reuse:
tf.get_variable_scope().reuse_variables()
... |
d9d48859e4af3d29c0ad53111393f58a2533d9b8eb9948335572da3663dc8aea | Python | 6,691 | 243 | # coding: utf-8
"""
This file is the result of running nbconvert on SENSE_python.ipynb
and manually replacing the `%pylab inline` magic with
the corresponding imports. I also removed the visualization
code.
"""
# In[1]:
from __future__ import division
from matplotlib import pylab, mlab, pyplot
import matplotlib
fro... |
b69871d6c28ca9867e4ab0e267ad8ab4526984cabdddfbc1e552036f47327dfb | Python | 6,701 | 234 | from ctypes import byref, c_int
from datetime import date, datetime, time
from django.contrib.gis.gdal.base import GDALBase
from django.contrib.gis.gdal.error import GDALException
from django.contrib.gis.gdal.prototypes import ds as capi
from django.utils.encoding import force_text
# For more information, see the OG... |
82dc061ba09ee63c0833f8f40f19d15df4daa12d90e9e360f15531efec4b4800 | Python | 6,741 | 168 | """Prove the bot exemption skips exactly what it claims and nothing else.
The exemption is the one place a gate is allowed to not run, so the interesting
cases are the ones where it must still run: a bot on a gate nobody exempted, a
human whose login was never listed, and a repository that configured nothing.
"""
from... |
26c17c52f24b9565c5db2b2cc16693d3c32a77a283b78c1e394af5faca4266df | Python | 6,743 | 210 | from django.conf import settings
from .. import Tags, Warning, register
SECRET_KEY_MIN_LENGTH = 50
SECRET_KEY_MIN_UNIQUE_CHARACTERS = 5
W001 = Warning(
"You do not have 'django.middleware.security.SecurityMiddleware' "
"in your MIDDLEWARE so the SECURE_HSTS_SECONDS, "
"SECURE_CONTENT_TYPE_NOSNIFF, "
... |
037be8f2e4b1c1b522da457368407e595467b6cf129a92747d17765bf403532b | Python | 6,757 | 255 | #
# The Python Imaging Library.
# $Id$
#
# IPTC/NAA file handling
#
# history:
# 1995-10-01 fl Created
# 1998-03-09 fl Cleaned up and added to PIL
# 2002-06-18 fl Added getiptcinfo helper
#
# Copyright (c) Secret Labs AB 1997-2002.
# Copyright (c) Fredrik Lundh 1995.
#
# See the README file for information on usa... |
4fc6722817dc712353ce65dcf3f1722544413be9136a29228cf2ce04b0c15575 | Python | 6,770 | 222 | from __future__ import absolute_import
from celery import uuid
from celery import signals
from celery import states
from celery.exceptions import Ignore, Retry
from celery.app.trace import (
TraceInfo,
eager_trace_task,
trace_task,
setup_worker_optimizations,
reset_worker_optimizations,
)
from cele... |
37bfb79dfa2c55c2207df1a2ac24826705a0d125a0c21f0c76c283a5fbcc721f | Python | 6,782 | 292 | #
# The Python Imaging Library.
# $Id$
#
# standard channel operations
#
# History:
# 1996-03-24 fl Created
# 1996-08-13 fl Added logical operations (for "1" images)
# 2000-10-12 fl Added offset method (from Image.py)
#
# Copyright (c) 1997-2000 by Secret Labs AB
# Copyright (c) 1996-2000 by Fredrik Lundh
#
# See... |
feec70f5fb6773b0e5ae39efb249815bb732ca3ee778589ab672422e12783bcb | Python | 6,788 | 169 | import logging
import types
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured, MiddlewareNotUsed
from django.db import connections, transaction
from django.urls import get_resolver, set_urlconf
from django.utils.log import log_response
from django.utils.module_loading import impo... |
8b60dbbd7e6fe3cdcbc9ffd551429bce9ee83021d2beae6c31b6f70371b5cf1e | Python | 6,791 | 246 | # -*- coding: utf-8 -*-
"""
celery.worker.state
~~~~~~~~~~~~~~~~~~~
Internal worker state (global)
This includes the currently active and reserved tasks,
statistics, and revoked tasks.
"""
from __future__ import absolute_import
import os
import sys
import platform
import shelve
import zlib
from... |
51025b775d959ef8c5a365daa24398398225289d372ce99c6c780342c453d3fe | Python | 6,808 | 232 | import os
import sys
from typing import Tuple, Type
import cv2
import matplotlib as mpl
import matplotlib.pyplot as plt
import numpy as np
import scipy.sparse as sparse
from mpl_toolkits.axes_grid1 import make_axes_locatable
from scipy.interpolate import griddata
from scipy.sparse import linalg as splinalg
... |
ebbec4c6c3068cd607b79885c183f6008ca56d8babc681dbb849ba1cf40b639b | Python | 6,811 | 238 | import itertools
import numpy as np
from numpy.testing import (assert_array_equal, assert_equal, assert_raises,
run_module_suite)
from dipy.segment.clustering import QuickBundlesX, QuickBundles, qbx_and_merge
from dipy.segment.featurespeed import ResampleFeature
from dipy.segment.metric impo... |
3ff861e0926141bf69bbed13b17e7808ffed1accd963cbc98aff4bbcd6eb2604 | Python | 6,823 | 241 | import numpy as np
from cmfsapy.dimension.fsa import fsa
from cmfsapy.data import gen_ncube
import os
import matplotlib.pyplot as plt
from tqdm import tqdm
import numpy as np
from scipy.special import betainc, beta
from scipy.stats import beta as bet
from scipy.integrate import quad, simps
import matplotlib.pyplot a... |
51e6bbc52463753d8c5c1f237d30eeb46b2aec96dda6ddce2fe6f42c5c66cbed | Python | 6,831 | 201 | #!/usr/bin/env python
"""
Parse training log
Evolved from parse_log.sh
"""
import os
import re
import extract_seconds
import argparse
import csv
from collections import OrderedDict
def parse_log(path_to_log):
"""Parse log file
Returns (train_dict_list, train_dict_names, test_dict_list, test_dict_names)
... |
58bbc27023aa7537019ac8da04db75e58c15cc4d39bd7cd056f7c6bdaeaad57a | Python | 6,838 | 165 | from django.db.backends.sqlite3.schema import DatabaseSchemaEditor
from django.db.utils import DatabaseError
class SpatialiteSchemaEditor(DatabaseSchemaEditor):
sql_add_geometry_column = (
"SELECT AddGeometryColumn(%(table)s, %(column)s, %(srid)s, "
"%(geom_type)s, %(dim)s, %(null)s)"
)
sq... |
7e4a30625d3358de86910455c39106fb3ff4ae82c406a6aad477af4392d72d22 | Python | 6,846 | 216 | # imports
import json
import time
import pickle
import scipy.misc
import skimage.io
import caffe
import numpy as np
import os.path as osp
from xml.dom import minidom
from random import shuffle
from threading import Thread
from PIL import Image
from tools import SimpleTransformer
class PascalMultilabelDataLayerSync... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.