text stringlengths 3.07k 22.1k |
|---|
#!/usr/bin/env python3
import argparse
from datetime import timedelta, datetime
import io
import itertools as it
import json
import multiprocessing as mp
import multiprocessing.dummy as mp_dummy
import os
import os.path as path
import sys
from time import strptime, strftime, mktime
import urllib.request
from glob impo... |
'''
https://medium.com/acing-ai/how-i-build-an-ai-to-play-dino-run-e37f37bdf153
https://blog.paperspace.com/dino-run/
https://github.com/Paperspace/DinoRunTutorial
https://gist.github.com/cadurosar/bd54c723c1d6335a43c8
http://edersantana.github.io/articles/keras_rl/
https://ai.intel.com/demystifying-deep-reinfo... |
import torch as t
import torch.nn as nn
from jukebox.transformer.ops import LayerNorm
from jukebox.vqvae.encdec import DecoderConvBock
from jukebox.utils.torch_utils import assert_shape
class Conditioner(nn.Module):
def __init__(self, input_shape, bins, down_t, stride_t, out_width, init_scale, zero_out, res_scale... |
# Software License Agreement (BSD License)
#
# Copyright (c) 2019, <NAME> (<EMAIL>)
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * Redistributions of source code must retain the above copyrig... |
# Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License").
# You may not use this file except in compliance with the License.
# A copy of the License is located at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# or in the "license... |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.
import copy
from logging import FileHandler
from pathlib import Path
from threading import Lock
from typing import Any, Callable, Dict, Iterator, List, Optional
from lisa import notifier, schema, transformer
from lisa.action import Action
from l... |
# -*- coding: utf-8 -*-
"""
Created on Tue Mar 3 15:10:24 2020
@author: Nicolai
----------------
"""
import numpy as np
import time
from scipy.stats import cauchy
import testFunctions as tf
def L_SHADE(population, p, H, function, minError, maxGeneration):
'''
implementation of L-SHADE based on: \n
Impr... |
"""Copyright (c) 2022 VIKTOR B.V.
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
documentation files (the "Software"), to deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute,... |
# Copyright (c) 2014, German Neuroinformatics Node (G-Node)
#
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted under the terms of the BSD License. See
# LICENSE file in the root of the Project.
from __future__ import (absolute_import, division,... |
# -*- coding: utf-8 -*-
# author = ChenZixuan
import csv
import urllib
import requests
import pandas as pd
import numpy as np
import time
import matplotlib.pyplot as plt
import random
from math import ceil
from urllib import parse
from fake_useragent import UserAgent
from bs4 import BeautifulSoup
from time import sleep... |
import discord
from discord.ext import commands
from .helpers.helpmaker import Help
from .helpers.guild import getChannelByService, getServiceByChannel
from common import common
from common.database import Database
class Roles(commands.Cog):
def __init__(self, bot):
self.bot = bot
self.groupedCom... |
#
# Copyright 1993-2019 NVIDIA Corporation. All rights reserved.
#
# NOTICE TO LICENSEE:
#
# This source code and/or documentation ("Licensed Deliverables") are
# subject to NVIDIA intellectual property rights under U.S. and
# international Copyright laws.
#
# These Licensed Deliverables contained herein is PROPRIETAR... |
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
import unittest
import pytest
from sklearn.base import TransformerMixin
from sklearn.linear_model import LinearRegression
from sklearn.pipeline import Pipeline
from sklearn.preprocessing import OneHotEncoder, FunctionTransfor... |
from logging import disable
from pathlib import Path
import controller as db_controller
from tkinter import (
Frame,
Canvas,
Entry,
Text,
Button,
PhotoImage,
messagebox,
StringVar,
)
from tkinter.ttk import Treeview
OUTPUT_PATH = Path(__file__).parent
ASSETS_PATH = OUTPUT_PATH / Path("... |
from django.shortcuts import render
from django.http import HttpResponse, HttpResponseNotFound, HttpResponseRedirect
from .models import Museo, Usuario, Comentario, MuseoLike
from django.contrib.auth.models import User
from django.db import IntegrityError
from django.db.models import Count
from django.template.loader i... |
""" smoke.py: smoke tests for JS9, calling much of the public API """
import time
import sys
import json
import re
import pyjs9
from astropy.io import fits
from smokesubs import *
# add new tests here
deftimeout = 2
regions1 = 'physical;ellipse(4103.0,3873.0,30.0,20.0,0) {"strokeWidth":2} # source,include,foo2; elli... |
#!/usr/bin/env python
"""
_build_
Implements the cirrus build command.
This command:
- creates a virtualenv in the package
- pip installs requirements.txt for the package into the venv
"""
import os
import sys
from argparse import ArgumentParser
from cirrus.documentation_utils import build_docs
from cirrus.enviro... |
import sys, os
from java.lang import System
from java.awt import Color, Font
from java.io import File
#from fiji.plugin.trackmate.visualization.hyperstack import HyperStackDisplayer
from fiji.plugin.trackmate.io import TmXmlReader
from fiji.plugin.trackmate import Logger
from ij.io import FileSaver
from ij.plugin impor... |
#!/usr/bin/env python3
"""
Avoid writing loops in shell one-liners.
When reading from stdin (the default), wrld abbreviates simple
`while read line; do` style loops. You could also think of it as
`xargs -I{}` or the `-exec` flag from `find` on steroids, because it
iterates on stdin, but it also allows inlining arbitra... |
from __future__ import print_function
import sys, math, re
min_penup_travel_distance = 1 # in mm, shorter travels will be removed
pendown_value = 'G0 F500.000 Z160.000'
penup_value = 'G0 F500.000 Z90.000'
feedrate_value = 'F60.000'
def calculate_distance(coordinates1, coordinates2):
x1 = coordinates1[0]
y1 = ... |
"""How to profile your code: ignore your intuition, directly measure the
perfomance
Python provides two built-in profilers, one that is pure python 'profile'
and another that is a C-extension module 'cProfile'
cProfile is better because of its minimal impact on the performance of your
program whilte it's being profil... |
import dimod
from tsp_helpers import *
from math import floor, log
'''
Solution format [(0,1), (1,2),... ]
Route format (0,2,...,n-1)
'''
### Functions for route to array conversion ###
def route_to_array_ilp(route, ins):
C, n = ins.C, ins.n
earliest, latest = ins.earliest, ins.latest
invalid = ins.inva... |
"""
Permutation Importance, Individual Conditional Expectation & Partial Dependence
===============================================================================
This module implements a collection of helper functions for an interactive
builder of permutation importance, individual conditional expectation and
partia... |
import matplotlib.pyplot as plt
from matplotlib import pyplot
import numpy as np
np.set_printoptions(suppress=True)
import os
import pickle
import sys
import json
from importlib import reload
import tensorflow as tf
import tensorflow_probability as tfp
tfd = tfp.distributions
sys.path.insert(0, './src')
# ... |
"""Utility functions to compute gram matrices."""
import math
import torch
def pairwise_dot(tensor, start_dim=1, flatten=True):
"""Compute pairwise scalar product. Pairs are determined by ``start_dim``.
Args:
tensor (torch.Tensor): A tensor whose slices, depending on ``start_dim``,
are ... |
"""
@author: <EMAIL>
"""
from ECGMOD.preprocess import prepare_data, return_tensor
from ECGMOD.singleT_preprocess import singleT_data_loader
from ECGMOD.OTFSample import OTFSampler
from ECGMOD.GPmodels import GPmodel, InferGPModel
from ECGMOD.DKLTuner import DKLmodel
from ECGMOD.ALquery import *
from ECGMOD.postproce... |
from __future__ import print_function, absolute_import
from collections import OrderedDict
from copy import deepcopy
from six.moves import range
from six import iteritems
from typing import List, Dict
from h5Nastran import H5Nastran
from pandas import DataFrame
import numpy as np
class CollectorSubcase(object):... |
import os
import string
from functools import reduce
import numpy as np
from nltk import word_tokenize
from nltk.corpus import stopwords
from sklearn.base import BaseEstimator
from sklearn.base import TransformerMixin
class DataLoader(BaseEstimator, TransformerMixin):
_contractions = {
"ain't": "am not /... |
import logging
import re
from typing import Iterable, List, Optional, Tuple, Union, cast
from bs4 import BeautifulSoup
from bs4.element import Tag
from notifier.types import RawPost, RawThreadMeta
logger = logging.getLogger(__name__)
def parse_thread_meta(thread: Tag) -> RawThreadMeta:
"""Parse the meta info o... |
'''ResNet1d in PyTorch.
For Pre-activation ResNet, see 'preact_resnet.py'.
Reference:
[1] <NAME>, <NAME>, <NAME>, <NAME>
Deep Residual Learning for Image Recognition. arXiv:1512.03385
This is a copy-paste from: https://github.com/kuangliu/pytorch-cifar/blob/master/models/resnet.py
I just changed 2d conv and batch... |
import os
import sys
import pandas as pd
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
import matplotlib.dates as mdates
import matplotlib.ticker as ticker
from matplotlib.dates import date2num as d2n
from collections.abc import Iterable
import numpy as np
month_dict = {"01": "Jan", "02": "Feb... |
import os
from Agent.dnn_models import *
from utils.common import *
from torch.utils.data import DataLoader
from utils.common import BasicDataset, safe_update_dict
import gym
from Enviroment.MultiEnvs import MultiEnviroment
device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu")
class episodic_memory:... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Author: penghuailiang
# @Date : 2019-04-27
from __future__ import division
from ops import *
def encoder(image, options, reuse=True, name="encoder"):
"""
Args:
image: input tensor, must have
options: options defining number of kernels in conv ... |
_typesCounter = 0
def _getTypeID(typeSet):
global _typesCounter
_typesCounter += 1
return typeSet + _typesCounter
# noinspection PySetFunctionToLiteral
class UIType(object):
TypesMisc = 0x0100
TypesPYQT = 0x0200
TypesPYSIDE = 0x0400
TypesM = 0x0800
TypesPM = 0x1000
TypesAll = Ty... |
import functools
import io
import os
import typing
from PIL import Image
from pymatting.alpha.estimate_alpha_cf import estimate_alpha_cf
from pymatting.foreground.estimate_foreground_ml import estimate_foreground_ml
from pymatting.util.util import stack_images
from scipy.ndimage.morphology import binary_erosion
import ... |
# This file is the script that users will actually run to generate the full set of statistics for a file
# set the path to find the current installation of pyMOAB
import sys
import numpy as np
import argparse
import sys
sys.path.append(
'/opt/tljh/user/lib/moab/lib/python3.6/site-packages/pymoab-5.1.0-py3.6-linux-... |
# -*- coding: utf-8 -*-
# (c) Copyright IBM Corp. 2010, 2020. All Rights Reserved.
from exchangelib import Credentials, Account, DELEGATE, Configuration, EWSDateTime, EWSTimeZone, Message, HTMLBody, CalendarItem, IMPERSONATION
from exchangelib.folders import FolderCollection
from exchangelib.attachments import FileAtta... |
import asyncio
import os
import random
import re
import time
from collections import defaultdict
import requests
from nonebot import get_driver, on_command, on_regex
from nonebot.adapters.onebot.v11.bot import Bot
from nonebot.adapters.onebot.v11.event import Event
from nonebot.adapters.onebot.v11.message import Messag... |
import logging
import sys
import os
from typing import List
from slack_sdk import WebClient
from slack_sdk.errors import SlackApiError
class SimpleMessage:
def __init__(
self,
token,
destination_id="",
msg_service_env_name="SIMPLE_MESSAGE_TYPE_DEFAULT",
msg_service_overrid... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright: (c) 2019, <NAME> <<EMAIL>>
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
DOCUMENTATION = '''
---
module: pacman_key
author:
- <... |
import argparse
import re
import os
from sys import argv
import time
import concurrent.futures
#Keep track of when the script began
startTime = time.time()
char = '\n' + ('*' * 70) + '\n'
# argv information
pathToFiles = argv[1]
if pathToFiles.endswith("/"):
pathToFiles = pathToFiles[0:-1]
# Get disease name base... |
import io
from dataclasses import dataclass, field
from enum import Enum, auto
from typing import Dict, Iterable, List, Union, cast
from .. import n
from ..page import Page
from ..types import FileId
def troff_escape(value: str) -> str:
"""Escape values that troff may interpret."""
value = value.replace(r"\\... |
from precise.skaters.portfolioutil.portfunctions import portfolio_variance
import numpy as np
import pandas as pd
from collections import Counter
from pprint import pprint
from precise.skaters.covarianceutil.covrandom import random_known_cov
from momentum import kurtosis_init, kurtosis_update
import time
from precise.... |
"""Modulo que contiene la clase directorio de funciones
-----------------------------------------------------------------
Compilers Design Project
Tec de Monterrey
<NAME> A01152537
<NAME> A00999281
-----------------------------------------------------------------
DOCUMENTATION: For complete Documentation see Us... |
#!/usr/bin/env python
#
# Copyright 2007 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law o... |
import logging
from pathlib import Path
from typing import Sequence, Union
import pytest
from typing_extensions import Literal
vfiles = ("incar", "kpoints", "potcar", "poscar")
logger = logging.getLogger("atomate2")
@pytest.fixture(scope="session")
def vasp_test_dir(test_dir):
return test_dir / "vasp"
_REF_P... |
# Code to perform Continuous k-Nearest Neighbors(CkNN), proposed in the paper
# 'Consistent Manifold Representation for Topological Data Analysis'
# (https://arxiv.org/pdf/1606.02353.pdf)
#
# Based on the implementation by <NAME> (https://github.com/chlorochrule/cknn),
# with some API and performance improvements (majo... |
from tkinter import *
from tkinter import messagebox as MessageBox
from pandastable import Table, TableModel
import pandas as pd
import os
from scihub import SciHub
from lib import crawl_scidirect,download_paper
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdri... |
import logging
from datetime import timedelta
from functools import partial
from qtpy.QtCore import Qt
from qtpy.QtGui import QIntValidator
from qtpy.QtWidgets import (
QWidget, QMainWindow, QLabel, QStackedLayout, QMessageBox,
QTableWidgetItem, QTreeWidgetItem)
from .util import redis_str
from .qutil import ... |
import json
import os
import random
import time
import uuid
from collections import defaultdict
import dotenv
from azure.cognitiveservices.language.luis.authoring import LUISAuthoringClient
from azure.cognitiveservices.language.luis.authoring.models import (
ApplicationCreateObject,
)
from azure.cognitiveservices.... |
import numpy as np
from typing import Iterable, Tuple
from collections import namedtuple
import scipy.stats as stats
from abito.lib.stats.plain import *
__all__ = [
't_test_from_stats',
't_test',
't_test_1samp',
'mann_whitney_u_test_from_stats',
'mann_whitney_u_test',
'bootstrap_test',
'sh... |
import os, glob
import random
import numpy as np
import torch
import torch.nn as nn
import torchvision.transforms as transforms
import torchvision.transforms.functional as F
from PIL import Image
from natsort import natsorted
from dataloader.image_folder import make_dataset
from PIL import ImageFile
ImageFile.LOAD_TRU... |
# -*- coding: utf-8 -*-
from __future__ import annotations
import json
from contextlib import suppress
from time import perf_counter
from time import sleep
from typing import Callable
from typing import Optional
import click
from pioreactor import error_codes
from pioreactor import exc
from pioreactor import hardwar... |
from copy import deepcopy
import json
import logging
from ruamel.yaml import YAML
from ruamel.yaml.scalarstring import walk_tree
from humanfriendly.prompts import prompt_for_confirmation
from sevenbridges import NotFound
from sbg_cwl_upgrader.validator.cwl_validation import CWLValidator
from sbg_cwl_upgrader.decompose... |
#!/usr/bin/env python
################################################################################
# Created by <NAME> #
# <EMAIL> #
################################################################################... |
# Copyright 2017 <NAME>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... |
import math, time, datetime
from direct.directnotify import DirectNotifyGlobal
from direct.interval.LerpInterval import LerpFunc
from panda3d.core import Vec3
from toontown.toonbase import TTLocalizer
from toontown.toonbase.ToontownTimer import ToontownTimer
from toontown.parties import PartyGlobals
notify = DirectNoti... |
# PATH: /home/jerry3chang/Workspace/tensorflow_py3/lib/python3.5/site-packages/tensorflow/contrib/learn/python/learn/datasets/mnist.py
from tensorflow.contrib.learn.python.learn.datasets import mnist as mnist_module
# PATH: /home/jerry3chang/Workspace/tensorflow_py3/lib/python3.5/site-packages/tensorflow/contrib/learn/... |
import h5py
import numpy as np
import argparse
from tqdm import tqdm
import os
from glob import glob
import pandas as pd
import json
import itertools
import deepab
from deepab.util.util import _aa_dict, letter_to_num
h_components = ["fwh1", "cdrh1", "fwh2", "cdrh2", "fwh3", "cdrh3", "fwh4"]
h_cdr_names = ["h1", "h2",... |
# Copyright (c) 2020 Xilinx, Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice, this
# list of conditions and the f... |
###modified based on centernet###
#MIT License
#Copyright (c) 2019 <NAME>
#All rights reserved.
"""Basic definition of detector"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
import cv2
from mindspore import Tensor
from dependency.c... |
from django import forms
from .models import *
from django_summernote.widgets import SummernoteWidget, SummernoteInplaceWidget
import re
class OfferRvIpoForm(forms.ModelForm):
class Meta:
model = OfferRvIpo
fields = "__all__"
widgets = {
'start_per_res': forms.DateInput(attrs={'... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Generated from FHIR 3.6.0-bd605d07 (http://hl7.org/fhir/StructureDefinition/MedicinalProductPackaged) on 2018-12-20.
# 2018, SMART Health IT.
from . import domainresource
class MedicinalProductPackaged(domainresource.DomainResource):
""" A medicinal product in ... |
# ======================================================================
VERSION = "proxyTEST v0.00000002"
# ======================================================================
# Plots Data Retrieved by proxyCEX, proxyDEX, proxyMIX, and proxyALPHA
" litepresence 2019 "
def WTFPL_v0_March_1765():
if any([stam... |
import logging
import os
import pandas as pd
from django.contrib import messages
from django.contrib.auth.decorators import login_required
from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger
from django.db.models import Count
from django.shortcuts import render, redirect, get_object_or_404
from dj... |
from typing import Dict, List, Any, Tuple, Optional
from .types import Status, Outputs
from .recipe import Recipe
from .logging import log
from .foreach_recipe import ForeachRecipe
# TODO(mathias): Rename this file to something more fitting
OutputsAndChecksums = Tuple[Outputs, Tuple[Optional[str], ...]]
def compute... |
# imports
import time
import datetime
from PyQt5.QtCore import *
from PyQt5.QtGui import *
from PyQt5.QtWidgets import *
from ui.membershipedit import Ui_MembershipEdit
from . import orm
# constants
# exception classes
# interface functions
#TODO: Adding membership through combobox sometimes doesn't leave editor ... |
#! /usr/bin/env python
"""Python Functions for CellRanger BCL->Fastq->SCP Pipeline
Arguments:
-c command to be run:
count:
-id, --sampleId Id of sample being run
-cf, --commaFastqs Comma seperated String with list of fastq directories
-fs, --fastqs List of fastq directories
-E, --expe... |
#!/usr/bin/python3
import sys
import os
from optparse import OptionParser
from matrixdemos import DATA_PATH
description = """The classic snake game, now on your matrix!
This requires a USB joystick."""
HI_SCORE_FILE = f"{DATA_PATH}/snakey_hiscore"
parser = OptionParser(description=description)
parser.add_option("-... |
import json
import zipfile
import sys
import traceback
import os.path
import compose
from shutil import make_archive
import shutil
import datetime
from django.views.decorators.csrf import csrf_exempt
from django.core.files.storage import default_storage
from django.core.files.base import ContentFile
from django.http im... |
#!/usr/bin/env python3
#
# Deploy script for HyVR
# ----------------------
#
# Use this to upload HyVR to github, github-pages and pypi.
#
# The script creates a new temporary directory and pulls the mercurial repository from bitbucket, so
# make sure you pushed your changes.
# By default, the script only does a test ... |
import math
pi = math.pi
tau = math.tau
def sqrt(input):
return math.sqrt(input)
def sqrd(input):
return input**2
class geometry():
class area():
def sqr (self, length, width):
area = length*width
return area
def tri (self, base, height):
area = (base*hei... |
# clize -- A command-line argument parser for Python
# Copyright (C) 2011-2016 by <NAME> and contributors. See AUTHORS and
# COPYING for details.
from __future__ import print_function
import sys
import os
from functools import partial, update_wrapper
import itertools
import shutil
from sigtools.modifiers import anno... |
#!/usr/bin/env python
# coding: utf-8
import unittest
from test import test_support
import numpy as np
from datetime import datetime
from events import AverageChange, CandlestickPatternEvents
from mktdata import init_marketdata, has_split_dividents, odd_data
from helpers import talib_candlestick_funcs, find_candlestic... |
import argparse
import numpy as np
import chainer
from chainer import report, training, Chain, datasets, iterators, optimizers, cuda, Reporter, report_scope
import chainer.functions as F
import chainer.links as L
from chainer.training import extensions
from chainer.datasets import tuple_dataset
import matplotlib.pypl... |
#!/usr/bin/env python3
# Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
import abc
import re
from dataclasses import dataclass, field
from datetime import datet... |
# -*- coding: utf-8 -*-
import pytest
import binascii
import time
import random
import os
import sys
sys.path.extend(["../"])
from bbc1.core import bbclib
from bbc1.core.message_key_types import KeyType
from bbc1.core.bbc_error import *
from bbc1.core import bbc_app
from testutils import prepare, get_core_client, sta... |
import pytest
def test_default_tag_exists_and_has_name(hlwm):
assert hlwm.get_attr('tags.count') == '1'
assert hlwm.get_attr('tags.0.name') == 'default'
def test_add_tag(hlwm):
focus_before = hlwm.get_attr('tags.focus.name')
hlwm.call('add foobar')
assert hlwm.get_attr('tags.count') == '2'
... |
import discord
from discord.ext import commands
import asyncio
import time
import random
import cogs.checks as check
from data.data_handler import data_handler
#ranksRP = formula = [int(50*(i**1.5)+100*i+300) for i in range(50)]
class Clans(commands.Cog):
"""
A server based XP system. Gives clans a way to co... |
"""
Useful ConfigurationModel subclasses
StackedConfigurationModel: A ConfigurationModel that can be overridden at site, org and course levels
"""
# -*- coding: utf-8 -*-
from collections import defaultdict
from enum import Enum
import crum
from config_models.models import ConfigurationModel, cache
from django.con... |
from __future__ import absolute_import, unicode_literals
from django.conf import settings
from django.contrib import messages
from django.contrib.contenttypes.models import ContentType
from django.http import HttpResponseRedirect
from django.utils.translation import ugettext_lazy as _
from django.views.generic import ... |
# Copyright 2014 PerfKitBenchmarker Authors. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appli... |
import operator
import collections
from .expression import Bool
from .expression import Params
from .expression import Filtered
from .expression import FunctionScore
from .expression import HighlightedField
OPERATORS = {
operator.and_: 'and',
operator.or_: 'or',
}
class CompilationError(Exception):
pas... |
# -*- coding: utf-8 -*-
# MegEngine is Licensed under the Apache License, Version 2.0 (the "License")
#
# Copyright (c) 2014-2021 Megvii Inc. All rights reserved.
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT ARRANTI... |
import json
import logging
import os
import sys
from math import floor
from pathlib import Path
from pathlib import PurePath
import boto3
import dask
import distributed
import numpy as np
import openpyxl
import parallel_functions
import psutil
import rasterio
import rioxarray
import xarray as xr
from dask.distributed ... |
import numpy as np # v1.19.3
import pandas as pd # v1.3.1
from tkinter import * # v8.6.0
import math
import json
import os
from PIL import Image, ImageDraw, ImageEnhance
# tkinter stuff
root = Tk()
root.title("Number recognition") # window title
root.maxsize(850, 600) # max size the window can expand to
root.geom... |
import os
import csv
import json
import math
import sys
import getopt
import multiprocessing
import functools
def cullFeaturesByLength(features, minLength):
return list(filter(lambda f: f["properties"]["length"] >= minLength, features))
def sphericalToCartesian(coord):
lat = math.radians(coord[1])
lon =... |
# Strain calculation functions
import numpy as np
from numpy import polyder, polyval, polyfit
import crosspy
def strain_calc(d, mapnos = 0, strain_method = 'l2'):
# This function calculates the strain between two images
# Images
# nodes_x = roi centres x
# nodes_y = roi centres y
# disp_x =... |
from __future__ import absolute_import
import os
import copy
import numpy as np
from . import translations
from ...util import proxy_object
from six.moves import range
from six.moves import zip
class HaloStatFile(object):
"""Manages and reads a halo stat file of unspecified format."""
_id_offset = 0
_col... |
from xnas.search_space.mb_ops import *
from xnas.search_space.proxyless_cnn import ProxylessNASNets
from xnas.search_space.utils import profile
import json
import xnas.core.logging as logging
import numpy as np
logger = logging.get_logger(__name__)
class MobileNetV3(MyNetwork):
def __init__(self, n_classes=1000... |
import pandas as pd
import numpy as np
import keras
from keras.models import Sequential
from keras.layers import Dropout
from keras.layers import Dense
from keras.wrappers.scikit_learn import KerasRegressor
from sklearn.model_selection import cross_val_score
#from sklearn.model_selection import KFold
import sklearn.m... |
import re
import json
import spacy
import msgpack
import unicodedata
import numpy as np
import argparse
import collections
import multiprocessing
from multiprocessing import Pool
from bertynet.utils import str2bool
from tqdm import tqdm
from functools import partial
import logging
def main():
args, log = setup()
... |
import numpy as np
from scipy.interpolate import griddata,interp2d
from scipy.optimize import root_scalar
import sys
import os
import multiprocessing as mp
from rebound.interruptible_pool import InterruptiblePool
import threading
def get_stab_func(incl):
data = np.genfromtxt("a_crit_Incl[%i].txt" % incl ,delimiter... |
import re
from cgi import parse_header
from typing import List, Optional, Tuple, Union, cast
from .datastructures import Headers
from .typing import Final
__all__ = [
"Event",
"Preamble",
"Field",
"File",
"Data",
"Epilogue",
"NeedData",
"NEED_DATA",
"MultipartDecoder",
"safe_de... |
from __future__ import absolute_import, division, print_function
"""
Author : Lyubimov, A.Y.
Created : 02/08/2021
Last Changed: 02/08/2021
Description : Analysis Threads and PostEvents
"""
import os
import shutil
from threading import Thread
import wx
from cctbx import crystal
from cctbx.sgtbx import lattic... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import copy
import os
import random
import numpy as np
from tqdm import tqdm
from utils import BaseEstimator, OneHotEncoder
class ArchManager:
def __init__(self, network_type):
self.network_type = network_type
if 'proxyless' in self.network_type:
... |
#!/usr/bin/env python
# -- Content-Encoding: UTF-8 --
"""
Tests the behavior of iPOPO contexts classes
:author: <NAME>
"""
# Tests
from tests.ipopo import install_bundle
# Pelix
from pelix.framework import FrameworkFactory
import pelix.constants
import pelix.framework
# iPOPO
import pelix.ipopo.constants as constan... |
# Copyright (c) 2015 Riverbed Technology, Inc.
#
# This software is licensed under the terms and conditions of the MIT License
# accompanying the software ("License"). This software is distributed "AS IS"
# as set forth in the License.
import re
import copy
import logging
import datetime
import pytz
import pandas
fr... |
from . import FmdlFile
#
# FMDL files store mesh geometry as vertices, and faces that are sequences of
# vertices.
#
# Blender, and many other mesh editors, support a richer notion of geometry,
# consisting of vertices, faces, and loops. A vertex is a combination of a
# position and position transformation behavior (i... |
"""
==
io
==
"""
def read_mantid_MDHisto(filename):
"""Read the saved MDHisto from from Mantid and returns an xarray.DataArray object"""
import h5py
import numpy as np
import xarray as xr
from javelin.unitcell import UnitCell
with h5py.File(filename, "r") as f:
if ('SaveMDVersion' not ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.