sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
504303a054b6d00af424a06db6066ac4ed371abf1c2d6cdf30ccc9653c1f6854 | Python | 4,584 | 128 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models
# Create your models here.
class Book(models.Model):
book_name = models.CharField(max_length=64)
add_time = models.DateTimeField(auto_now_add=True)
def __unicode__(self):
return self.book_name
class Subm... |
bec8adca6550fabfb705b5feb2f7a1f7981e53deb63a182ddfc7eb942be9f719 | Python | 4,584 | 121 | from pathlib import Path
import numpy as np
import torch
from torch.utils.data import DataLoader, Dataset
from histoprep import SlideReader
from histoprep.utils import (
SlideReaderDataset,
TileImageDataset,
)
from ._utils import (
SLIDE_PATH_CZI,
SLIDE_PATH_JPEG,
SLIDE_PATH_SVS,
TMP_DIRECTOR... |
dfb58fa986e15d9b851aed9c2693e227ee4b3ad31a44fb2deea84a4d35820358 | Python | 4,591 | 103 | """Verify the guarded Torch documentation factory restores without training or loading data."""
import argparse
import hashlib
import importlib.util
import json
import os
import re
import shutil
import subprocess
import sys
import tempfile
import zipfile
from pathlib import Path
def _main() -> None:
"""Verify rea... |
e776d6e45f65fa67d64ef21aeeedf3e8958b50fe5775e1deeb06fb2a7254ad1a | Python | 4,594 | 120 | import os
from functools import partial
import nibabel as nib
from nibabel.streamlines import (Field, TrkFile, TckFile,
Tractogram, LazyTractogram,
detect_format)
from nibabel.orientations import aff2axcodes
from dipy.io.dpy import Dpy, Streamlines
def... |
c7bbed764d39678e0a422c093894cf1ef79b28c0c2372e04ad8ebf8f8b2e14db | Python | 4,595 | 161 | from __future__ import absolute_import
import pickle
from time import time
from celery.datastructures import LimitedSet
from celery.exceptions import WorkerShutdown, WorkerTerminate
from celery.worker import state
from celery.tests.case import AppCase, Mock, patch
class StateResetCase(AppCase):
def setup(sel... |
caf576930797fa8fb4a362aa486f76f8258f30ee71e57b29fa31e74f1300ffff | Python | 4,595 | 118 | #!/usr/bin/env python2
desc="""Identify enhanvers (eRNAs) from RNA-Seq.
Enhancers are defined as genomic regions having similar level of expression.
It's rather slow right now, 17h per fish genome (1.5G). Instead consider bam2cov_pool.py approach:
# get 100bp windows of non-coding part of the genome
w=500; awk -F'\t... |
863214ddef1aa51b6aa04837696816796dd1aa853be34936fe3a5f73fc4d1a83 | Python | 4,602 | 158 | from tkinter import BooleanVar
from os.path import normpath
class FileInfo():
"""
A base container class for the various data types to inherit
"""
def __init__(self, id_=None, file=None, parent=None):
"""
Parameters
----------
id_ : str
Id of the correspondi... |
8a605fc8a877c3ff15f982f48d884bcc1223993c4e37753fef4d12d702391f1b | Python | 4,602 | 80 | """Legacy training callbacks use the shared executor and preserve checkpointed row selection."""
from types import SimpleNamespace
from talos.experiment.runner import RunResult
class Scan(RunResult):
def __init__(self, x, y, params, model, experiment_name, x_val=None, y_val=None,
val_split=.3, m... |
b94d56e884d17a5a005db1cd1a49927158459a364170280c203d8f7f8d45e0ae | Python | 4,607 | 165 | #
# Support for the API of the multiprocessing package using threads
#
# multiprocessing/dummy/__init__.py
#
# Copyright (c) 2006-2008, R Oudkerk
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
... |
ac0d5461e3dc7551282340c29ebc7a4b3db277f9ad629c310dcf85474ca28f83 | Python | 4,609 | 141 | """
Creates permissions for all installed apps that need permissions.
"""
import getpass
import unicodedata
from django.apps import apps as global_apps
from django.contrib.auth import get_permission_codename
from django.core import exceptions
from django.db import DEFAULT_DB_ALIAS, router
def _get_all_permissions(op... |
08705ea72e602314809cea81becf789c986b2d4f5017a13ef99f62bc1ef50a47 | Python | 4,610 | 111 | #-----------------------------------------------------------------------
#Copyright 2019 Centrum Wiskunde & Informatica, Amsterdam
#
#Author: Daniel M. Pelt
#Contact: D.M.Pelt@cwi.nl
#Website: http://dmpelt.github.io/foam_ct_phantom/
#License: MIT
#
#This file is part of foam_ct_phantom, a Python package for generating... |
5a61446ebc10409a5d1dde5b0596183b4edbb11ff74aff191505cd8c681f7c60 | Python | 4,612 | 158 | """
This module contains functions that generate ctypes prototypes for the
GDAL routines.
"""
from ctypes import POINTER, c_char_p, c_double, c_int, c_int64, c_void_p
from functools import partial
from django.contrib.gis.gdal.prototypes.errcheck import (
check_arg_errcode, check_const_string, check_errcode, chec... |
23e20d7b5ac71ac41f57abe776d0f9ddf8728ec10e1b96ba5a80d8e30e8cd81e | Python | 4,618 | 159 | # coding: utf-8
"""
Function for calculating the modular inverse. Exports the following items:
- inverse_mod()
Source code is derived from
http://webpages.charter.net/curryfans/peter/downloads.html, but has been heavily
modified to fit into this projects lint settings. The original project license
is listed below:
... |
348314451d83a2c118db5271d0a064dd1cf87e961cb8b678768169b14ab31637 | Python | 4,624 | 139 | from __future__ import absolute_import
from collections import defaultdict
from contextlib import contextmanager
from kombu.utils.limits import TokenBucket
from celery.worker import state
from celery.utils.timeutils import rate
from celery.tests.case import AppCase, Mock, patch, body_from_sig
class test_default_s... |
9799cbf577729c4d09ef2dca5a01a14de5d56c365b225c1b32904066161db9ce | Python | 4,633 | 143 | ###############################################################################
# DICOM.py provides an implementation of PET class for DICOM file format
###############################################################################
# Copyright (c) 2019-2020, University of Liège
# Author: Nikita Beliy
# Owner: Liege Un... |
e989caf2c6dc37f1d64d287e03293def40f90c7994dcd2ea1b51416528da834a | Python | 4,634 | 109 | # -*- coding: utf8 -*-
"""
Loads in hippocampal like spike train (produced by `generate_spike_train.py`) and runs STD learning rule in a recurrent spiking neuron population
-> creates weight matrix for PC population, used by `spw*` scripts
updated to produce symmetric STDP curve as reported in Mishra et al. 2016 - 10.1... |
0c4acdd0e6e834b41198bfbf13ac046c19b1ca564f09424e7f2c9d0ebc96e701 | Python | 4,635 | 161 | # -*- coding: utf-8 -*-
"""
celery.backends.cache
~~~~~~~~~~~~~~~~~~~~~
Memcache and in-memory cache result backend.
"""
from __future__ import absolute_import
import sys
from kombu.utils import cached_property
from kombu.utils.encoding import bytes_to_str, ensure_bytes
from celery.exceptions import Im... |
add06bd215f4148b4b0f854c7d18b72ab262d44d5f05b36b7bc396a4eb9c5dfe | Python | 4,636 | 84 | """CI reduces runner demand without weakening source, coverage or packaging checks."""
from __future__ import annotations
from pathlib import Path
import yaml
ROOT = Path(__file__).resolve().parents[2]
WORKFLOWS = ROOT / '.github/workflows'
def load(name: str) -> dict[str, object]:
return yaml.safe_load((WORKF... |
2190c27177c19c0798b5fcb99550378be18bce15d1f9da6db2a2f2b2d12ea267 | Python | 4,641 | 85 | """Advisory lookup aliases preserve every installed hash-locked dependency."""
from __future__ import annotations
import hashlib
import importlib.util
import json
import tempfile
import unittest
from pathlib import Path
from unittest.mock import patch
from packaging.requirements import Requirement
SCRIPT = Path(__fi... |
de4b59b285f7309b8ae1af8395abbb453d1d7888f52878986f5c6b94818a3e95 | Python | 4,643 | 131 | """
BORIS plugin
Latency between behaviors
"""
import pandas as pd
__version__ = "0.1.3"
__version_date__ = "2026-04-13"
__plugin_name__ = "Behavior latency"
__author__ = "Olivier Friard - University of Torino - Italy"
GROUP_BY_COLUMNS = ["Observation id", "Subject"]
SORT_COLUMNS = ["Observation id", "Subject", "S... |
009d7e7f58e5c336841bd5d8c5622d7c326c6cb7e501f1b845ccc18e39bcdbc7 | Python | 4,658 | 144 | '''
Created on May 21, 2018
@author: helrewaidy
'''
# sub-parts of the U-Net model
import torch
import torch.nn as nn
import torch.nn.functional as F
class double_conv(nn.Module):
'''(conv => ReLU => BN) * 2'''
def __init__(self, in_ch, out_ch):
super(double_conv, self).__init__()
self.conv... |
75e764b937f4d552bc770b087fd7a302cb4235a8f3aeba4101f240a6bcaf6181 | Python | 4,661 | 127 | """
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... |
cf62bc08ac527c443777450c208817c3936e80a2d9c914bffc29f5d22bdb8863 | Python | 4,661 | 170 | # coding: utf-8
from __future__ import unicode_literals, division, absolute_import, print_function
import socket
import struct
from ._errors import unwrap
from ._types import byte_cls, bytes_to_list, str_cls, type_name
def inet_ntop(address_family, packed_ip):
"""
Windows compatibility shim for socket.inet_... |
abda91ee96a14211105a2d670c0bafcc9bd1597731a4137c025fa5db27c097ba | Python | 4,674 | 126 | """ Benchmarks for functions related to streamline
Run all benchmarks with::
import dipy.tracking as dipytracking
dipytracking.bench()
With Pytest, Run this benchmark with:
pytest -svv -c bench.ini /path/to/bench_streamline.py
"""
import numpy as np
from numpy.testing import measure
from numpy.testing ... |
81e2d73c213d866b9b22ae7ac12a6e9a5a932c12f46546854c5b1c37703d33ea | Python | 4,681 | 118 | """Create caller experiment files from packaged manifest templates."""
from pathlib import Path
import click
from talos.cli.git_utils import git_clone, run_git
def run_new(project_name: str,
backup_remote: str | None,
from_remote: str | None = None) -> bool:
'''
Create a new Talos ... |
eb4249e2a200bd0103e4bfe92077782edb0f80525a3d247740d1521dfc967131 | Python | 4,681 | 101 | #!/usr/bin/env python3
"""Bind every installed locked dependency to its upstream advisory identity."""
from __future__ import annotations
import argparse
import hashlib
import json
import re
from collections.abc import Callable
from importlib import metadata
from pathlib import Path
from urllib.parse import unquote, u... |
a6c3ecf806c7e9b87c23bf0664f579304d139a08a899cc22b0965094d1f42e03 | Python | 4,689 | 127 | ###############################################################################
# _PET.py contains the BIDS-defined PET modalities and met fields
###############################################################################
# Copyright (c) 2019-2020, University of Liège
# Author: Nikita Beliy
# Owner: Liege Universi... |
1746607d1a995a78baa4339d8bec5ed6a95f8484643a5a32f04f7c079c4a9d9f | Python | 4,709 | 106 | from __future__ import annotations
from pathlib import Path
import pytest
REPO_ROOT = Path(__file__).resolve().parents[2]
def test_issue_fetch_is_non_nullable_and_gate_has_no_none_guard() -> None:
source = (REPO_ROOT / 'governance/cc_gate.py').read_text(encoding='utf-8')
start = source.index('def fetch_iss... |
719a207edcbc4bfc1a1f813c875e446a40b92d9e075f682ece386758df1b7d37 | Python | 4,710 | 142 | import unittest
import tempfile
import os
import six
import caffe
class SimpleLayer(caffe.Layer):
"""A layer that just multiplies by ten"""
def setup(self, bottom, top):
pass
def reshape(self, bottom, top):
top[0].reshape(*bottom[0].data.shape)
def forward(self, bottom, top):
... |
eafc2e2082ca095f9603a8adc027b1181a5f3f89b78691087eba51d3634c7b47 | Python | 4,712 | 153 | #!/usr/bin/env python2
"""
Download genomes from NCBI for given taxid.
USAGE: get_complete_genomes.NCBI.py taxid nuccore
"""
import os, sys
from datetime import datetime
from Bio import Entrez, SeqIO
Entrez.email = 'lpryszcz@crg.eu'
def split_seq( seq,length=70 ):
"""Return list of sequence fragnments having ... |
afd21d47f986dc5054de952528b3c09a307c23708b53f7e1127ca223e48a28b9 | Python | 4,716 | 126 | #!/usr/bin/env python2
desc="""Report SAM entries with mismatches >= m.
"""
epilog="""Author:
l.p.pryszcz+git@gmail.com
Barcelona, 26/10/2012
"""
import argparse, os, re, sys
from Bio import Seq
from datetime import datetime
patM=re.compile(r'\d+M')
def sam2mismatches_single( handle,out,algTh,verbose ):
"... |
183c2e3b0b49911748f8ebed648025eb2dd645cddb6cfd22e6fa58aca11d0233 | Python | 4,717 | 126 | import numpy as np
from numpy.testing import (assert_equal,
assert_almost_equal,
run_module_suite,
assert_array_equal,
assert_raises)
from dipy.data import get_fnames, dsi_voxels
from dipy.reconst.dsi import Diff... |
fd7dcb8be93dab49bbb2806fbb456ede3c3098e0d9593c7d03722cc1829e5cb3 | Python | 4,720 | 117 | import logging
from django.contrib.gis.gdal import GDALException
from django.contrib.gis.geos import GEOSException, GEOSGeometry
from django.forms.widgets import Textarea
from django.utils import translation
# Creating a template context that contains Django settings
# values needed by admin map templates.
geo_contex... |
a5a623d9976d7dea1d4fdce6af02fc3db9a4d9a0948641a70206e7126ad067a9 | Python | 4,721 | 153 | from __future__ import absolute_import
from celery.bin.amqp import (
AMQPAdmin,
AMQShell,
dump_message,
amqp,
main,
)
from celery.tests.case import AppCase, Mock, WhateverIO, patch
class test_AMQShell(AppCase):
def setup(self):
self.fh = WhateverIO()
self.adm = self.create_a... |
63e97b55e2e02036e1265b625ff0c01eef0260a45530605448c3093f7c923254 | Python | 4,745 | 131 | """
Testing cross-validation analysis
"""
from __future__ import division, print_function, absolute_import
import numpy as np
import numpy.testing as npt
import nibabel as nib
import dipy.reconst.cross_validation as xval
import dipy.data as dpd
import dipy.reconst.dti as dti
import dipy.core.gradients as gt
import di... |
27a113bfe8d378dcf996c27b09cb6e8d126d8c0b55496e28d0103a458cde32ac | Python | 4,763 | 121 | #!/usr/bin/env python3
"""Publish the tested Talos version with immutable source and changelog identity."""
from __future__ import annotations
import argparse
import ast
import os
import re
import subprocess
import sys
from pathlib import Path
from typing import Final
try:
import tomllib
except ModuleNotFoundErro... |
866999e61d55a35b665c852cb6cd0035ab20f0f0b6142fe14b7c2df50c994928 | Python | 4,766 | 129 | from typing import Optional, Union
import cv2
import numpy as np
from PIL import Image
from ._check import check_image
ERROR_THRESHOLD = "Threshold should be in range [0, 255], got {}."
MAX_THRESHOLD = 255
WHITE_PIXEL = 255
BLACK_PIXEL = 0
SIGMA_NO_OP = 0.0
GRAY_NDIM = 2
def get_tissue_mask(
image: Union[Imag... |
e06ae2f5ffb104409c15ed6b899ebb49324e0b557575f9dd627d3c8089a197f2 | Python | 4,770 | 130 | """Select nondominated parameter cohorts across caller objectives."""
from typing import Any, TypeGuard, cast
import numpy as np
import numpy.typing as npt
import polars as pl
def _is_integral(value: Any) -> TypeGuard[int | np.integer[Any]]:
'''
Check whether a permutation id value is a Python or numpy int... |
f3fcc98d6687ed89e1f4b17e8f03f93339a6d3d3c6c480e6176c06b24a952f55 | Python | 4,779 | 177 |
from __future__ import (absolute_import, division, print_function,
unicode_literals)
from citeproc.py2compat import *
import unicodedata
from collections import namedtuple
from warnings import warn
__all__ = ['parse_latex', 'substitute_ligatures']
def parse_latex(string, macros={}):
... |
ea665a456177a7a087590eb93e98fe7deec1ebaa7e3e49d4a1321fb35581e1f5 | Python | 4,780 | 136 | # MRD Helper functions
import ismrmrd
import re
def update_img_header_from_raw(imgHead, rawHead):
"""Populate ImageHeader fields from AcquisitionHeader"""
if rawHead is None:
return imgHead
# # These fields are not translated from the raw header, but filled in
# # during image creation by fro... |
f56bb5710dd4294095fb2aebb9f7aaa40415beac9e315d558c61475de43102ad | Python | 4,782 | 136 | from __future__ import absolute_import
from celery.backends import couchbase as module
from celery.backends.couchbase import CouchBaseBackend
from celery.exceptions import ImproperlyConfigured
from celery import backends
from celery.tests.case import (
AppCase, MagicMock, Mock, SkipTest, patch, sentinel,
)
try:
... |
63c0d4b66ff549e24c8e049ef366a5b23172b02e24584639ea4f4c650bef7f22 | Python | 4,788 | 129 | import logging
import sys
from functools import wraps
from django.conf import settings
from django.core import signals
from django.core.exceptions import (
PermissionDenied, RequestDataTooBig, SuspiciousOperation,
TooManyFieldsSent,
)
from django.http import Http404
from django.http.multipartparser import Mult... |
787bc9f8a5a9afab21f40b1373946135a3756baf9554c56182557455e3a315f8 | Python | 4,789 | 123 | import torch
def polarToCylindricalConversion(input1, input2=None):
if input2 is None:
'''input1 is tensor of [B,C,H,W,D,2] contains both magnitude and phase channels
in the last dims'''
# if input1.ndimension() == 4:
# mag_input, phase_input = input1[:,:,:,0], input1[:,:... |
8a8e1bea4b99b1d7e6cdae90e809005ade1513c11610914e9b6ba87bafba9a3b | Python | 4,793 | 131 | import matplotlib.pyplot as plt
import torch
import numpy as np
from parameters import Parameters
params = Parameters()
from utils.cmplxBatchNorm import magnitude
from matplotlib.path import Path
from saveNet import *
def get_ROI_conts(epi_cont, endo_cont = None, s=0.05):
epi_cont = (epi_cont - np.mean(epi_cont, 0... |
3faea8dc4aca5f3845be3ddedd093a3014bb011d2ab03a9241c94800c1caa75f | Python | 4,801 | 128 | # -*- coding: utf-8 -*-
from __future__ import with_statement
import os
import re
import sys
import pytz
import subprocess
_systemconfig_tz = re.compile(r'^Time Zone: (.*)$', re.MULTILINE)
def _tz_from_env(tzenv):
if tzenv[0] == ':':
tzenv = tzenv[1:]
# TZ specifies a file
if os.path.exists(tzen... |
c8f0c5d965ec3d86ac7c1930292c4b5d6986567a8e803882ead2aca1b8b9427c | Python | 4,804 | 125 | import matplotlib.pyplot as plt
from sys import argv
import numpy as np
from deg_class import AdaptiveDegradation
from get_input_params import input_params
import seaborn as sns
def plotFIG5(ins):
instring = ins + ".npy"
data = np.load(instring,allow_pickle=True)
AVG_S_resp = data[0]
AVG_S_no... |
eeaa9beb8312ce97b87baf471b48499001575432b626840b7db7f36d6c5d8471 | Python | 4,808 | 126 | import numpy as np
import numpy.testing as npt
from dipy.tracking.streamline import Streamlines
from dipy.segment.bundles import gaussian_weights, afq_profile
def test_gaussian_weights():
# Some bogus x,y,z coordinates
x = np.arange(10).astype(float)
y = np.arange(10).astype(float)
z = np.arange(10).a... |
2170edd324218db7dfbb7d596444b55e8b62cf31ee39c0a4316dd1798a26690f | Python | 4,809 | 166 | """Generate publication-quality data acquisition methods section from BIDS dataset.
Utilities to generate the MRI data acquisition portion of a
methods section from a BIDS dataset.
"""
from __future__ import print_function
import logging
from .. import __version__
logging.basicConfig()
LOGGER = logging.getLogger('pyb... |
0fddc9f3b9cb5bab0a59b0673fb885633e2503a60b7eed75740bbcca04ca29ed | Python | 4,814 | 160 | import os
from io import BytesIO, StringIO, UnsupportedOperation
from django.core.files.utils import FileProxyMixin
from django.utils.functional import cached_property
class File(FileProxyMixin):
DEFAULT_CHUNK_SIZE = 64 * 2 ** 10
def __init__(self, file, name=None):
self.file = file
if name ... |
c34472a5741a719128d0df4a381c253a9f4af61f05babff6d42b18a568c4100a | Python | 4,826 | 162 | """
Feature Projection in Neural Networks with Restricted Expressive Power [Sec 3.4.2]
"""
import numpy as np
import matplotlib.pyplot as plt
import sys
import time
from keras.models import Sequential
from keras.layers import Dense, Activation
from keras.optimizers import SGD, Adam
from keras import backend as K
from ... |
c513f9a37fd0c488a94f40691234176e626aa08052bc3e2f20a9caa6a8b0c65e | Python | 4,831 | 136 | # post-process some of the BIDS files produced to add any extra data we want
from collections import OrderedDict as odict
import json
import os
import os.path as op
import shutil
from Biscuit.utils.utils import get_mrk_meas_date
from bidshandler.utils import _get_bids_params, _bids_params_are_subsets
from mne_bids i... |
c70e9456a9a3afeba293f78f24dc83b6c4821d157ac6f52c97dc2a0abc0e06ec | Python | 4,834 | 87 | ###############################################################################
## Vision Research Laboratory and ##
## Center for Multimodal Big Data Science and Healthcare ##
## University of California at Santa Barbara ##
... |
f360476748d35ebb1c55fc3644e46db265449a15cdf388121e826c2baf81382d | Python | 4,841 | 140 | """Record of phased-in incompatible language changes.
Each line is of the form:
FeatureName = "_Feature(" OptionalRelease "," MandatoryRelease ","
CompilerFlag ")"
where, normally, OptionalRelease < MandatoryRelease, and both are 5-tuples
of the same form as sys.version_info:
(... |
17484bde4599e4a188edde51a97931ecc1eaec191668d9cf2393c19024550d60 | Python | 4,842 | 162 | # -*- coding: utf-8 -*-
"""
Created on Thu Jun 11 16:14:25 2020
by Jeffrey Mc Hugh
mchughj3@tcd.ie
Analysis script for OT data taken from 3T3 fibroblasts
Notes:
For 10kPa 200201 11 there are NaN values at the end of the array so use these lines
pulPt = pulPt[0:64122]
pulPx = pulPx[0:64122]
pulPy = pulPy[... |
4389c0bdf28c56f1e84317cbd09027672a09df860759ff6a389baf0960e29122 | Python | 4,851 | 131 | #!/usr/bin/env python2
desc="""Convert files with RNA modifications into canonical FASTA.
"""
epilog="""Author:
l.p.pryszcz+git@gmail.com
Warsaw, 30/11/2017
"""
import sys
reload(sys)
sys.setdefaultencoding('utf8')
from datetime import datetime
from collections import Counter
def table2modifications(table, log=sy... |
0c466edda9ce94cdbf8fe23fd1c6f93ca2fe45c42e0344accde661a761d44583 | Python | 4,854 | 170 | """
registration_params
===================
Module to calculate volume of brain regions
"""
import logging
import numpy as np
import pandas as pd
from brainglobe_utils.IO.image.load import load_any
from brainglobe_utils.pandas.misc import initialise_df, safe_pandas_concat
class UnknownAtlasValue(Exception):
pa... |
28a7f8616baebd400e7f99765e7e7310847858703cbca439479a5a55f6003de3 | Python | 4,857 | 134 | from django.apps import apps as global_apps
from django.db import DEFAULT_DB_ALIAS, migrations, router, transaction
from django.db.utils import IntegrityError
class RenameContentType(migrations.RunPython):
def __init__(self, app_label, old_model, new_model):
self.app_label = app_label
self.old_mod... |
7ba88dd21aba1653afb00f4c988ba55b2499c6245035501cf7f20b66d2d67ad7 | Python | 4,864 | 162 | # -*- coding: utf-8 -*-
"""
celery.worker.autoscale
~~~~~~~~~~~~~~~~~~~~~~~
This module implements the internal thread responsible
for growing and shrinking the pool according to the
current autoscale settings.
The autoscale thread is only enabled if :option:`--autoscale`
has been enabled ... |
0b68b685c1fb0bf890e6182abd6b8cc3e11ae60565f75a888ab7716a01311f92 | Python | 4,867 | 127 | #!/usr/bin/env python2
desc="""Return orthologous groups for given species from a phylome.
It adds orthologs (and in-paralogs) to the group until outgroup species found.
TBD: Add one2one testing!
"""
epilog="""Author:
l.p.pryszcz+git@gmail.com
Barcelona, 8/07/2013
"""
import argparse, os, sys
from datetime import da... |
5a0a3e2badbcff1d5d253782946e535896cac717e242b024114bc4e359d15f9b | Python | 4,869 | 167 | # -*- coding: utf-8 -*-
"""
celery.utils.serialization
~~~~~~~~~~~~~~~~~~~~~~~~~~
Utilities for safely pickling exceptions.
"""
from __future__ import absolute_import
from inspect import getmro
from itertools import takewhile
try:
import cPickle as pickle
except ImportError:
import pickle # noq... |
5f02343a8beba0507bc73c31314dd11c4827636316dc5ce0d50edc1d7e36f860 | Python | 4,869 | 94 | #!/usr/bin/env python3
"""Reuse the exact successful documentation test command for identical source and dependencies."""
from __future__ import annotations
import argparse
import hashlib
import json
import os
import re
import subprocess
import sys
from pathlib import Path
COMMAND = ['-m', 'coverage', 'run', '-m', 'p... |
acb9dfa8d24e2b1d348c410e3786c0be5a268448ab81bb921bf33e07cfc7d6ac | Python | 4,878 | 95 | import torch
import torch.nn as nn
from saveNet import *
class ComplexLinear(nn.Module):
def __init__(self, in_features, out_features, bias=True):
super(ComplexLinear, self).__init__()
# real_weight = self.register_buffer('weight', torch.zeros(in_features*out_features))
# real_bias = self.... |
c6105f2e4e9c03bcb239528f5bc911d436ba88d44d894c4679dc975946842d3c | Python | 4,884 | 137 | #!/usr/bin/env python2
desc="""Report random entries from FastQ/FastA file(s).
Support uncompressed or BGZIP compressed files.
Headers need to have the same name in FastQ/FastA files.
"""
epilog="""Author: l.p.pryszcz+git@gmail.com
Mizerow, 13/10/2014
"""
import gzip, os, random, sqlite3, sys, time
from datetime imp... |
cb7e2495554b1a79a16b464800b5f5721affd32449352c4b1dd024f17692f57a | Python | 4,886 | 122 | ###############################################################################
# _MRI.py contains the BIDS-defined MRI modalities and met fields
###############################################################################
# Copyright (c) 2019-2020, University of Liège
# Author: Nikita Beliy
# Owner: Liege Universi... |
25a50063512d8f285ebde418016419ea8a37a7c7bc079fd9beefa00fda1cc9fd | Python | 4,887 | 116 | import numpy as np
import torch
from torchvision.utils import make_grid
from base import BaseTrainer
from utils import inf_loop, MetricTracker,ValidationRecorder
import torch.nn.functional as F
class Trainer(BaseTrainer):
"""
Trainer class
"""
def __init__(self, model, criterion, metric_ftns, optimizer... |
cec9c11d5454d6561f363a75c815fc13829e42daeb5b5d5d4d9c928ba4094cf6 | Python | 4,898 | 114 | """
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... |
11678b14f20d1a5e748644898f7cfad96c1e3e9cd18aa18ca359ca9bb6add7f8 | Python | 4,905 | 145 | # 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 enum import Enum
from six.moves import range
from cryptography imp... |
fd6019c9514a437c8a82aeb8649a0938ad3339beeabe8af587cdabc5f99b70fb | Python | 4,914 | 134 | #!/usr/bin/env python2
desc="""Annotate DESeq results.
"""
epilog="""Author: l.p.pryszcz+git@gmail.com
Mizerow, 2014/02/22
"""
import argparse, gzip, os, sys, sqlite3
from datetime import datetime
def getHandle(handle):
"""Deal with file names and file objects
Gzipped also supported.
"""
if type(han... |
27eeed55d08b30e2a7dcc022bb91c9b3da5bfa069979f12151373ff374d928a9 | Python | 4,920 | 147 | """ Benchmarks for fast squashing
Run all benchmarks with::
import dipy.reconst as dire
dire.bench()
With Pytest, Run this benchmark with:
pytest -svv -c bench.ini /path/to/bench_squash.py
"""
from __future__ import division, print_function, absolute_import
from functools import reduce
import numpy as... |
ae786bc1f25797970ffca3ad70f5b2a408418a19e6d056b953b5dea77e90a99d | Python | 4,944 | 190 | # -*- coding: utf-8 -*-
"""
celery.utils.mail
~~~~~~~~~~~~~~~~~
How task error emails are formatted and sent.
"""
from __future__ import absolute_import
import smtplib
import socket
import traceback
import warnings
from email.mime.text import MIMEText
from .functional import maybe_list
try:
from s... |
e5cec6bb71bb77200525a44f70c59a9d5aa16538aaa1f00c2a94f6cb80bfdc08 | Python | 4,945 | 167 | """Enumerate parameter combinations in deterministic permuted order."""
from __future__ import annotations
import math
import random
from typing import Any
from typing_extensions import override
from talos.experiment.param_domain import ParamDomain
from talos.experiment.param_search.search_strategy import SearchStr... |
10b44eedb47c4713b71c8bb1b62b6bd3aca1b06e03c584e546c4dae8d7a74ea2 | Python | 4,946 | 109 | from ctypes import POINTER, c_char_p, c_double, c_int, c_void_p
from django.contrib.gis.gdal.envelope import OGREnvelope
from django.contrib.gis.gdal.libgdal import lgdal
from django.contrib.gis.gdal.prototypes.errcheck import check_envelope
from django.contrib.gis.gdal.prototypes.generation import (
const_string_... |
36a96a30ed771e0688890c32e8a26c1e991cc0497c656c34de8ac87830c34503 | Python | 4,951 | 186 | """Define checkpointed parameter search and feedback contracts."""
from __future__ import annotations
from abc import ABC, abstractmethod
from collections.abc import Iterable, Iterator
from typing import Any, cast
from talos.experiment.param_domain import DomainObserver, ParamDomain
from talos.experiment.serializati... |
6f3ec1d762b93afb346a25df6463046d5b5601e574e49c8b2831b232b84277f7 | Python | 4,960 | 104 | import django.contrib.auth.models
from django.contrib.auth import validators
from django.db import migrations, models
from django.utils import timezone
class Migration(migrations.Migration):
dependencies = [
('contenttypes', '__first__'),
]
operations = [
migrations.CreateModel(
... |
7219d17c0db4ce75118a191dfaf91c6646afb86109ab233a98c2c302b5bd0c77 | Python | 4,962 | 172 | # 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 binascii
import inspect
import sys
import warnings
# ... |
b07ebd8f8fd8041c04f533e5ab291a0257f5d4037b6bbaf9fc9dd87f9a2a01e4 | Python | 4,986 | 183 | # -*- coding: utf-8 -*-
"""
celery.contrib.rdb
==================
Remote debugger for Celery tasks running in multiprocessing pool workers.
Inspired by http://snippets.dzone.com/posts/show/7248
**Usage**
.. code-block:: python
from celery.contrib import rdb
from celery import task
@task()
def add(x... |
1fc70dc50dd3ca9893d29f8eb56ce8c7bd1a51136f4593a59c580fe6ed67eb58 | Python | 4,993 | 173 | """
Models including feature selection models, classifiers, and regressors.
"""
# ========================================
# Feature Selection Models
# ========================================
class PCA_Feat_Sel():
def __init__(self, n_samples, n_features):
from sklearn.decomposition import PCA
se... |
626f7a30e7a8ce8c4b27b13f109214fadcc5fd83f0ae5b8c20410775af339cf6 | Python | 4,993 | 163 | ###############################################################################
# plugins.py define the plugins infrastructure to use in BIDSme
###############################################################################
# Copyright (c) 2019-2020, University of Liège
# Author: Nikita Beliy
# Owner: Liege University ... |
a45e4e6cd11cf94f4121ad710eddfae78c447e7c3b8f40f833edd6b946ff7946 | Python | 4,995 | 163 | ###############################################################################
# plugins.py define the plugins infrastructure to use in BIDSme
###############################################################################
# Copyright (c) 2019-2020, University of Liège
# Author: Nikita Beliy
# Owner: Liege University ... |
ab521a0bba1463d0843d44206bcb7a4683066d0431042182de0383b24a96dcb5 | Python | 5,008 | 158 | # -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
from contextlib import contextmanager
from functools import wraps
try:
from urllib import addinfourl
except ImportError: # py3k
from urllib.request import addinfourl # noqa
from anyjson import dumps
from kombu.utils.encoding im... |
cf5f8cd66b7552b0524dd51786c1f9e5e3843e017b7c1d3e32ec368cf4e122c2 | Python | 5,010 | 150 | ###############################################################################
# DICOM.py provides an implementation of PET class for DICOM file format
###############################################################################
# Copyright (c) 2019-2020, University of Liège
# Author: Nikita Beliy
# Owner: Liege Un... |
6c86417a14900d2291b5e28ac311b2156328455f94983e856e0333677285a124 | Python | 5,013 | 126 | #!/usr/bin/env python2
"""Return number of reads aligned to each gene.
Author:
l.p.pryszcz+git@gmail.com
Barcelona, 25/04/2012
"""
import commands, math, os, sys
from optparse import OptionParser
from datetime import datetime
from genome_annotation import load_gtf, load_gff, genome2dict, get_gc
def _count( bam,cont... |
644df77ef4faa6bc082c179eecc4a596da7e751def27d2f7e5eadffc60ff9cfd | Python | 5,014 | 168 | import os
import sys
import torch
import torch.nn as nn
import torch.nn.functional as F
import models as m
import constant as c
sys.path.append(os.path.join(sys.path[0], '../'))
from utils.config import device
#################################################################
# Functions
def get_model_dict_by_devic... |
17dd7a3a5af05ce356ba184301169a5c50d7d50495c5d74089ea05c9a9c3037a | Python | 5,031 | 108 | """Original realized legacy rows precede identity checks; checkpoints restore consumption later."""
import json
from collections.abc import Callable, Mapping, Sequence
from pathlib import Path
from typing import Protocol, cast
import numpy as np
from numpy.typing import NDArray
from talos.experiment import provenanc... |
7ae9c3dc080bf48ef0e82ae003d84eb39615b2d7c8cb2b0f27a306d746b9b157 | Python | 5,041 | 139 | #!/usr/bin/env python3
"""Write the closeout evidence fields into a slice issue's Done Means section.
The `slice_closeout_guard` workflow calls this when a merged PR closes a slice
issue: the merge SHA, the merged PR number and the required CI run ids become
part of the issue body, so a slice's done-ness rests on reco... |
fa9e454a14ab884a04ac9f8d0df2f9a4f68b10fa43721b9baacf7387f7b9ca05 | Python | 5,050 | 175 | """Generates data for the embedding plots
1. Load data
2. Measure intrinsic dimensions in the function of embedding dimension for a seizure
3. compute space-time separation diagrams
4. save out results
"""
import os
import bz2
import numpy as np
from mne.filter import filter_data
from tqdm import tqdm
from scipy.lin... |
2e10e9913a6b3daa1ced427d8bdbb09cffb9026d344956c74908b33e908ba6a1 | Python | 5,053 | 331 | # coding: utf-8
"""
Implementation of the teletex T.61 codec. Exports the following items:
- register()
"""
from __future__ import unicode_literals, division, absolute_import, print_function
import codecs
class TeletexCodec(codecs.Codec):
def encode(self, input_, errors='strict'):
return codecs.char... |
cbaaf7c241b057af48b08e00c66076b38c9675ae248cb06b8f4c34bdb2e8f774 | Python | 5,057 | 144 | """HMAC (Keyed-Hashing for Message Authentication) Python module.
Implements the HMAC algorithm as described by RFC 2104.
"""
import warnings as _warnings
from _operator import _compare_digest as compare_digest
import hashlib as _hashlib
trans_5C = bytes((x ^ 0x5C) for x in range(256))
trans_36 = bytes((x ^ 0x36) fo... |
2bf61f71b2b961a0021d6a79725e40f8fde425a808a06a5890cd55c35946b075 | Python | 5,069 | 145 | from __future__ import absolute_import
import re
import sys
import warnings
try:
import unittest # noqa
unittest.skip
from unittest.util import safe_repr, unorderable_list_difference
except AttributeError:
import unittest2 as unittest # noqa
from unittest2.util import safe_repr, unorderable_list... |
eded5870ed83eb8e0b00151d1986afa2fb0a0ae108e9ffd568806272fc7d08b8 | Python | 5,073 | 173 | """
A Pillow loader for .dds files (S3TC-compressed aka DXTC)
Jerome Leclanche <jerome@leclan.ch>
Documentation:
https://web.archive.org/web/20170802060935/http://oss.sgi.com/projects/ogl-sample/registry/EXT/texture_compression_s3tc.txt
The contents of this file are hereby released in the public domain (CC0)
Full t... |
ae220394536115f9866bc547d38104844d87094b6f945f880fa7a96232de6f90 | Python | 5,074 | 185 | from __future__ import absolute_import
import pickle
from kombu.utils.functional import lazy
from celery.five import THREAD_TIMEOUT_MAX, items, range, nextfun
from celery.utils.functional import (
LRUCache,
firstmethod,
first,
mlazy,
padlist,
maybe_list,
)
from celery.tests.case import Case
... |
6709685c2eee45481caff7bdb6ed80cce8422565f8c4b9918c0a56a715623da9 | Python | 5,077 | 126 | import numpy as np
import matplotlib.pyplot as plt
from matplotlib.gridspec import GridSpec
from lib.pinn import PINN
from lib.network import Network
import pandas as pd
import math
import tensorflow as tf
import os
def main(epochs=800,sigma=40,maxX_multiplier = 6.0,train=True,directory = './Data'):
"""
Usin... |
e7948a43ed2b59c598f68874f33c19e69791355f05d100fe3edeb3acc0e0d1f7 | Python | 5,081 | 171 | from dipy.workflows.workflow import Workflow
from dipy.workflows.combined_workflow import CombinedWorkflow
class DummyWorkflow1(Workflow):
@classmethod
def get_short_name(cls):
return 'dwf1'
def run(self, inputs, param1=1, out_dir='', output_1='out1.txt'):
""" Workflow used to test combi... |
324a4607ffaa4ab72348453457b8d140e5550f5b6d4d8647230f5a3c5cb8504f | Python | 5,085 | 122 | from dipy.denoise.enhancement_kernel import EnhancementKernel
from dipy.denoise.shift_twist_convolution import convolve, convolve_sf
from dipy.reconst.shm import sh_to_sf, sf_to_sh
from dipy.core.sphere import Sphere
from dipy.data import get_sphere
import numpy as np
import numpy.testing as npt
def test_enhancement_... |
091278e5c1b97b0afb0527d5b0c94f33e1416a0cb8b54a33cf430a526797a518 | Python | 5,086 | 170 | ###############################################################################
# info.py contains set of classes and functions to manage logging
###############################################################################
# Copyright (c) 2019-2020, University of Liège
# Author: Nikita Beliy
# Owner: Liege Universit... |
b3259d70022b6e9973781f688d38820b3f3adf55055d552f486e110bcd78699b | Python | 5,089 | 158 | def test_scan():
print("\n >>> start Scan()...")
import tensorflow as tf
from tensorflow.keras.activations import elu, relu
from tensorflow.keras.layers import Dense
from tensorflow.keras.losses import binary_crossentropy
from tensorflow.keras.models import Sequential
from tensorflow.keras... |
6e7382ff89665d2aed1a4bd2167744756889372b1cca72eb72918a9ebd4d85c3 | Python | 5,094 | 172 | # -*- coding: utf-8 -*-
"""
=========================
Abortable tasks overview
=========================
For long-running :class:`Task`'s, it can be desirable to support
aborting during execution. Of course, these tasks should be built to
support abortion specifically.
The :class:`AbortableTask` serves as a base clas... |
cf79b11aadd67294d77b69b095f1c6323fc7915b05bbd6320e4ae10365a8fecd | Python | 5,099 | 187 | from __future__ import absolute_import
import sys
import time
import celery.utils.timer2 as timer2
from celery.tests.case import Case, Mock, patch
from kombu.tests.case import redirect_stdouts
class test_Entry(Case):
def test_call(self):
scratch = [None]
def timed(x, y, moo='foo'):
... |
ff0e6ba1b5bb6bd39178078fe8196207eb5d29fa11deda57be708be9c72a2925 | Python | 5,103 | 156 | import numpy as np
from dipy.utils.optpkg import optional_package
fury, have_fury, setup_module = optional_package('fury')
if have_fury:
from dipy.viz import actor, ui
def build_label(text, font_size=18, bold=False):
""" Simple utility function to build labels
Parameters
----------
text : str
... |
04d27a94fb32d8b830be182e3a5deea2cf5e055b357d2ff2c3817af069ddc4e1 | Python | 5,104 | 161 | import napari
import pytest
from bg_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_napari_view... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.