text stringlengths 3.07k 12.6k |
|---|
from mk2.plugins import Plugin
from mk2.events import ServerEvent, EventPriority
from twisted.internet import reactor
from twisted.internet.defer import Deferred, DeferredList
from twisted.mail import smtp, relaymanager
from twisted.web.client import getPage
from cStringIO import StringIO
from email.mime.text import ... |
import pandas as pd
import datetime as dt
import numpy as np
import pandas as pd
from pandas import concat
class BackTest():
def __init__(self,
pending_sell_steps,
stop_loss,
initial_value = 100,
value = 100,
verbose = Fals... |
# ******************************************************************************
# Copyright 2017-2018 Intel Corporation
#
# 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://... |
import pygame
import random
import ctypes
import math
import numpy as np
##GLOBALS##
VISION = 30
population = 50
boidsize = 3
MAX_SPEED = 6
MAX_C_SPEED = 0.1
MAX_S_SPEED = 0.3
###########
##COLORS##
red = (255, 0, 0)
green = (0, 255, 0)
blue = (0, 0, 255)
white = (255, 255, 255)
black = (0, 0, 0)
##########
##PYGAME... |
#!/usr/bin/env python
#
# Copyright 2012, Google 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... |
import torch
import torch.nn as nn
import torch.nn.functional as F
from .base_model import BaseModel
from .blocks import (
FeatureFusionBlock,
FeatureFusionBlock_custom,
Interpolate,
_make_encoder,
forward_vit,
)
def _make_fusion_block(features, use_bn):
return FeatureFusionBlock_custom(
... |
# Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
Accuracy tests for Ecliptic coordinate systems.
"""
import numpy as np
import pytest
from astropy.units import allclose as quantity_allclose
from astropy import units as u
from astropy.coordinates import SkyCoord
from astropy.coordinates.builtin_fra... |
# Built-int imports
import os
import sys
import argparse
# External imports
import cv2 as cv
import numpy as np
# My own imports
import get_path_assests_folder as gpaf
# Get assets folder in repo for the samples
ASSETS_FOLDER = gpaf.get_assets_folder_path()
class DolphinPlayingWithPixels:
"""
Python clas... |
# Derived from io_scene_obj in stock Blender, by <NAME>, <NAME>, and <NAME>
if "bpy" in locals():
import importlib
if "import_brk" in locals():
importlib.reload(import_brk)
if "export_brk" in locals():
importlib.reload(export_brk)
import bpy
from bpy.props import (
BoolProperty,
FloatProperty,
StringPro... |
from collections.abc import Hashable
from enum import Enum
import abc
from copy import deepcopy
class MultiAnswer(dict):
@property
def default(self):
return super().get('default', False)
@default.setter
def default(self, v):
if v:
super().__setitem__('default', True)
... |
#
# Automated Dynamic Application Penetration Testing (ADAPT)
#
# Copyright (C) 2018 Applied Visions - http://securedecisions.com
#
# Written by <NAME> - http://www.siegetechnologies.com/
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the L... |
from pyastar.problem import Problem
from pyastar.util.node import NodeFactory
from pyastar.util.pq import PriorityQueueSet
class AStar:
def __init__(self,
problem,
heuristic_is_inconsistent=False,
open_set_max_size=None,
open_set_truncate_size=N... |
from __future__ import print_function
import numpy as np
from keras.models import Model
from keras.layers import Input, merge, Convolution2D, MaxPooling2D, UpSampling2D
from keras.optimizers import Adam
from keras.optimizers import SGD
from keras.callbacks import ModelCheckpoint, LearningRateScheduler
from keras impor... |
import pytorch_lightning as pl
import torch
import torchmetrics
import torch.nn.functional as F
OPTIMIZER = "Adam"
LR = 1e-4
ONE_CYCLE_TOTAL_STEPS = 100
class Accuracy(torchmetrics.Metric):
"""Accuracy Metric with a hack."""
def __init__(self, dist_sync_on_step=False):
super().__init__(dist_sync_on_... |
from iminuit import util
import pytest
def test_fitarg_rename():
fitarg = {"x": 1, "limit_x": (2, 3), "fix_x": True, "error_x": 10}
def ren(x):
return "z_" + x
newfa = util.fitarg_rename(fitarg, ren)
assert "z_x" in newfa
assert "limit_z_x" in newfa
assert "error_z_x" in newfa
as... |
#!/bin/env python
# Copyright Disney Enterprises, Inc. 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
# and the following modification to it: Section 6 Trademarks.
# deleted and replaced with:
#
# 6. Trademark... |
from django.shortcuts import render, redirect
from django.http import HttpResponse
import datetime
from .forms import *
from .models import *
from django.urls import reverse_lazy
from django.contrib.auth.decorators import login_required
from django.contrib.auth.views import LoginView
from django.contrib.auth import au... |
"""
===============
testapp.storage
===============
Implement working with Redis storages.
"""
import time
try:
from collections import OrderedDict
except ImportError:
from ordereddict import OrderedDict
from flask import current_app
from compat import iteritems, iterkeys
from constants import (
COMME... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
if os.environ.get('JASPER_HOME') is None:
os.environ['JASPER_HOME'] = '/home/osmc'
import unittest
import argparse
from mock import patch
from urllib2 import URLError, urlopen
import yaml
import test_mic
import g2p
import brain
import logger
def activeInte... |
# Meet Pybot: your friend
from chatbot_source import *
warnings.filterwarnings("ignore")
# nltk.download() # for downloading packages
# import tensorflow as tf
import numpy as np
import random
import string # to process standard python strings
f = open('miden_answers.txt', 'r', errors='ignore')
m = open('modules_py... |
# -*- coding: utf-8 -*-
import subprocess
import sys
import configparser
class Engine(object):
def __init__(self, rnr):
super(Engine, self).__init__()
self.logic_cmd = rnr.logic_cmd
self.logic_wrkdr = rnr.logic_wrkdr
self.my_bot_cmd = rnr.mybot_cmd
self.my_bot_wrkdr = rnr.m... |
# Copyright (c) 2019 Uber Technologies, 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 or agreed... |
'''
Blast phip-seq library against itself.
'''
from __future__ import (
print_function,
division,
absolute_import,
)
from . common import say
import sys
import time
import tempfile
import argparse
import os
import json
import shutil
import collections
import subprocess
from tqdm import tqdm
tqdm.monitor_in... |
# -*- encoding: utf-8 -*-
"""
KERI
keri.kli.commands.delegate module
"""
import argparse
import json
import sys
from json import JSONDecodeError
from hio import help
from hio.base import doing
from keri import kering
from keri.app import directing, keeping, habbing, agenting
from keri.app.cli.commands.delegate.incep... |
import seaborn as sb
from scipy import stats
from random import shuffle
import pandas as pd
from sklearn.model_selection import train_test_split, cross_val_score
from sklearn.metrics import recall_score, precision_score, roc_auc_score, plot_confusion_matrix, accuracy_score
from sklearn.preprocessing import label_binari... |
"""
alloc.py - Sketch of memory management.
This is roughly what you might do in C++, but it's probably overly complicated
for Python.
The idea is to save the LST for functions, but discard it for commands that
have already executed. Each statement/function can be parsed into a separate
Arena, and the entire Arena c... |
#Imported libraries
import numpy as np
import cv2
import matplotlib.pyplot as plt
import matplotlib.image as mpimg
from PIL import Image
import os
import sys
from copy import deepcopy
from keras.preprocessing.image import ImageDataGenerator
from math import *
#own libs
sys.path.insert(0, 'DARK/python/')
from darknet ... |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
"""This module defines a class to represent a compiler environment state."""
import csv
import sys
from typing import Iterable, List, Optional,... |
import os
import logging
import re
import gazu
from Qt import QtWidgets, QtGui, QtCore
log = logging.getLogger(__name__)
KITSU_LOGO = os.path.join(
os.path.dirname(os.path.dirname(__file__)), "res", "image", "logo_kitsu.png"
)
class AnimatedLabel(QtWidgets.QLabel):
"""
QLabel with animated background c... |
#
# Copyright 2014-2016 <NAME>, <NAME>, <NAME>,
# and others from Multicore Computing Lab, Department of Computer Science
# and Automation, Indian Institute of Science
#
# 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... |
import django.db.models
from goflow.workflow.models import *
DEBUG = True
def log(section, variable):
if DEBUG:
print('adding [%s] %s' % (section, variable))
else:
pass
# ------------------------------------------------------------------------------------
# a class based Process Bui... |
# Copyright 2019-2020 ETH Zurich and the DaCe authors. All rights reserved.
from dace.memlet import Memlet
from dace.dtypes import Language, StorageType
from dace.properties import CodeProperty
from dace.sdfg import propagation
from dace.sdfg.sdfg import InterstateEdge
from dace.symbolic import symbol
import dace
N = ... |
# Copyright 2021 Google LLC.
#
# 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, ... |
#!/usr/bin/env python3
"""
This module prepares reference tables for other modules
Inputs:
--------------------------------------------------------------
1. Gencode gtf file
2. Gencode fasta file
--------------------------------------------------------------
Output Tables:
--------------------... |
import sqlalchemy as sa
from closure_table.comments.db.tables import (
comments,
comments_tree,
)
from sqlalchemy.sql.expression import func
async def comment_create(conn, content, parent_id=None):
await conn.execute('BEGIN')
try:
query = comments.insert().values(content=content)
comme... |
import pandas as pd
import datetime
import sqlite3
import tqdm
import wget
import re
import os
from bs4 import BeautifulSoup
from selenium import webdriver
def create_tables(cursor, ticker, timeframes):
cursor.execute(f"""CREATE TABLE {ticker}_TICK
(timestamp text, symbol text, side text,... |
import torch.nn as nn
import math
import torch.utils.model_zoo as model_zoo
from .quant import ClippedReLU, int_conv2d, int_linear
__all__ = ["resnet18_imagenet_quant"]
class BasicBlock(nn.Module):
expansion = 1
def __init__(self, inplanes, planes, stride=1, downsample=None, wbit=4, abit=4, alpha_init=10, mo... |
#----------------zmienne poczatkowe--------------------#
pamiec_podreczna= []
#------------------klasy-------------------------------#
class Student():
def __init__(self):
self.imie = input("Imie studenta: ")
self.nazwisko = input("Nazwisko studenta: ")
self.nr_indeksu =... |
# Copyright 2014-2018 The PySCF Developers. 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 appl... |
import os
from boto3 import client, resource
from botocore.exceptions import ClientError
import yaml
from jinja2 import Environment, FileSystemLoader
import logging
from finnhub import Client
from functools import total_ordering
import heapq
import copy
from enum import Enum
from datetime import datetime
from decimal i... |
#!/usr/bin/env python3
import importlib.util
import sys
from os import listdir, path
from time import sleep
from tkinter import Tk
from tkinter.filedialog import askopenfilename, asksaveasfilename
import pygame
import scipy
import yaml
import libgol
color_scheme_default = {
0: (255, 255, 255),
1: (0, 0, ... |
from gensim.models import Word2Vec, KeyedVectors
from os import listdir, sep
from os.path import isfile
import sys
import csv
import re
import time
from random import shuffle
import torch
from torch import nn
from torch.utils.data import DataLoader
from torch.autograd import Variable
import torch.nn.functional as F
imp... |
import selenium
import time
import json
from bs4 import BeautifulSoup
from requests import get
from selenium import webdriver
from selenium.webdriver.support.wait import WebDriverWait
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.support import expected_conditions as EC
from selenium.w... |
#!/usr/bin/env python
"""
Main training workflow
"""
from __future__ import division
import argparse
import os
import random
import signal
import torch
import distributed
import numpy as np
from transformers import BertTokenizer
from models import data_loader
from models.data_loader import load_dataset
from model... |
"""
Copyright (C) 2018-2021 Intel Corporation
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 i... |
import os
import wx
from configparser import RawConfigParser
class AuditReport(wx.Dialog):
def __init__(self, parent, cat, fn, new, missing, common):
wx.Dialog.__init__(self, parent, wx.ID_ANY, "Audit Report for file %s/\"%s\"" % (cat, fn))
self.parent = parent
self.Bind(wx.EVT_CLOSE, self.onClose)
vsizer... |
from deep_hiv_ab_pred.train_full_catnap.constants import SPLITS_UNIFORM, MODELS_FOLDER
from deep_hiv_ab_pred.training.training import train_network_n_times, eval_network
from deep_hiv_ab_pred.catnap.constants import CATNAP_FLAT
from deep_hiv_ab_pred.preprocessing.pytorch_dataset import AssayDataset, zero_padding
from d... |
import sys
import argparse
from HTSeq import GFF_Reader
parser = argparse.ArgumentParser()
parser.add_argument(
'--lnc_classify', help='FEELnc_classifier output result', required=True)
parser.add_argument('--lnc_gtf', help='lncRNA gtf file', required=True)
parser.add_argument('--output', help='output file'... |
from flask import Flask
from __init__ import db
class Exchange(db.Model):
rowid = db.Column(db.Integer, primary_key=True)
exchange = db.Column(db.String(80))
name = db.Column(db.String(80))
market_cap_exchange = db.Column(db.String(80))
currency = db.Column(db.String(80))
location = db.Column(... |
# -*- coding: utf-8 -*-
"""
Tencent is pleased to support the open source community by making 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community
Edition) available.
Copyright (C) 2017-2021 THL A29 Limited, a Tencent company. All rights reserved.
Licensed under the MIT License (the "License"); you may not use this file except in co... |
#!/usr/bin/env python3
"""
read trained net : model+weights
read test data from HD5
infere for test data
Inference works alwasy on 1 GPU or CPUs
./predict.py --modelPath /pscratch/sd/b/balewski/tmp_digitalMind/neuInv/benchmark/january/1305196/out
"""
__author__ = "<NAME>"
__email__ = "<EMAIL>"
import numpy as ... |
from email.mime import base
import os
import cv2
import json
import numpy as np
import tensorflow as tf
from tensorflow.keras import metrics
from tensorflow.keras import layers
from tensorflow.keras import Model
from tensorflow.keras.applications import resnet, mobilenet
from tensorflow_addons.layers import AdaptiveMa... |
import numpy as np
import scipy.io as sio
import theano.tensor as T
import lasagne
from lasagne.layers import InputLayer, DropoutLayer, ReshapeLayer,\
DimshuffleLayer
from lasagne.layers import Pool2DLayer as PoolLayer
from lasagne.layers import Conv2DLayer as ConvLayer
from lasagne.layers import ElemwiseSumLayer, ... |
from types import SimpleNamespace
from .columns import Columns
from .utils import Private
class CountryData:
def __init__(self, country_info):
for key in country_info:
setattr(self, key, country_info[key])
def __str__(self):
return f"{self.official_name} ({self.ISO3166_1_Alpha_3})... |
import pytest
from qcodes.tests.instrument_mocks import DummyInstrument
from qcodes.instrument.parameter import Parameter
import qcodes.utils.validators as vals
class DummyTrackingInstrument(DummyInstrument):
def __init__(self, name):
super().__init__(name)
self.add_parameter("a",
... |
# Copyright (c) 2021 PaddlePaddle 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 pandas as pd
import torch
from transformers import AlbertTokenizer, AlbertForMaskedLM
# init softmax
sm = torch.nn.Softmax(dim=0)
torch.set_grad_enabled(False)
MODEL_NAMES = ["BERT_base", "BERT_large", "RoBERTa_small",\
"RoBERTa_large", "DistilRoBERTa", "DistilBERT",\
"SqueezeBE... |
#encoding: utf-8
from PIL import Image
import numpy as np
from config import config as cfg
from torch.utils.data import Dataset
from torchvision import transforms as T
from sklearn.preprocessing import MultiLabelBinarizer
from imgaug import augmenters as iaa
import pathlib
import cv2
import pandas as pd
from torch.util... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from collections import OrderedDict
import gym
import tensorflow as tf
from ray.rllib.models.misc import linear, normc_initializer
from ray.rllib.models.preprocessors import get_preprocessor
class Model(obj... |
#!/usr/bin/env python3
"""Classe to manage ModbusTCP agent configurations."""
# Standard imports
import itertools
# Import project libraries
from pattoo_shared import configuration, files
from pattoo_shared.configuration import Config
from pattoo_shared import data as lib_data
from pattoo_shared.variables import IPTa... |
"""Defines the main application and some helper functions."""
import logging
import os
import sys
import threading
from pathlib import Path
import config
import qt_classes
import qt_utils
import send_commands
import telemetry
from cli import BufferAwareCompleter
from geofence import generate_fence_from_mqtt
from logge... |
"""Copy file from or to a Docker container.
Usage:
docker-cp [--buffer-length=<bytes>] FILE TARGET
docker-cp (-h | --help)
docker-cp --version
Arguments:
FILE Source file. e.g. mycontainer:/proc/version
TARGET Destination directory. e.g. .
Options:
--buffer-length=<bytes> Buffer size in ... |
#!/usr/bin/python3
# Copyright (c) 2016-2017, henry232323
#
# 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... |
import pytest
import sys
import struct
import math
from pypytools import IS_PYPY
from six import b, PY3
from capnpy import ptr
from capnpy.printer import print_buffer
from capnpy.segment.base import BaseSegmentForTests as BaseSegment, unpack_uint32
def test_unpack_uint32():
a = 12
b = 2**31 + 1
buf = stru... |
from ctypes import (
CFUNCTYPE, Structure, c_int, c_char_p, c_uint, c_void_p, cast, POINTER,
py_object, string_at, c_char, addressof,
)
# error codes from ttfautohint-errors.h
TA_Err_Ok = 0x00
TA_Err_Invalid_FreeType_Version = 0x0E
TA_Err_Missing_Legal_Permission = 0x0F
TA_Err_Invalid_Stream_Write = 0x5F
TA_E... |
from centroidtracker import CentroidTracker
import numpy as np
import cv2
import random
from matplotlib import pyplot as plt
from scipy import ndimage
from aigame import AIGame
import time
import matplotlib.gridspec as gridspec
from matplotlib import animation
import anim
from collections import OrderedDict
import copy... |
from __future__ import print_function
from __future__ import division
import evaluation
import numpy as np
import torch
import logging
import loss
import json
import networks
import time
#import margin_net
import similarity
# __repr__ may contain `\n`, json replaces it by `\\n` + indent
json_dumps = lambda **kwargs:... |
import glob
import os
import os.path as osp
import weakref
#import subprocess # Only in case of matlab call (auto_configuration func)
from soma.controller import Controller
from soma.functiontools import SomaPartial
from traits.api import Directory, Undefined, Instance, String, Bool
class SPMConfig(Controller):
d... |
#!/usr/bin/env python
# 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
#
# Authors:
# - <NAME>, <EMAIL>, 2018-2021
import os
import re
import loggin... |
from place.exceptions import *
import place
import requests
import json
import sys
if sys.version_info >= (3,0):
from urllib.parse import urljoin
else:
from urlparse import urljoin
import os
import pprint
import copy
def _conv_object(obj, client=None, inverse=False):
obj = copy.copy( obj )
if isinstan... |
# py-staticmaps
# Copyright (c) 2020 <NAME>; see /LICENSE for licensing information
import io
import math
import sys
import typing
try:
import cairo # type: ignore
except ImportError:
pass
from PIL import Image as PIL_Image # type: ignore
from .color import Color, BLACK, WHITE
from .renderer import Render... |
#
# Copyright 2021 Logical Clocks AB
#
# 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 ag... |
# -*- coding: utf-8 -*-
#------------------------------------------------------------
# streamondemand - XBMC Plugin
# Conector para Real_Debrid
# http://www.mimediacenter.info/foro/viewforum.php?f=36
#------------------------------------------------------------
import re
import time
import urllib
from core import ch... |
import re
def decompose(keyword, in_str, script):
"""Find matching decomposition rule for a given keyword and string, if possible.
Parameters
----------
keyword : str
Keyword used to query the script for decomposition rules.
in_str : str
String used as input to the decomposition ru... |
from django.db import models
from django.contrib.auth.models import User
from django.utils.datetime_safe import datetime
from pytz import utc
from mptt.models import MPTTModel, TreeForeignKey
from geoposition.fields import GeopositionField
from djangoautoconf.django_utils import get_new_uuid
class Description(models.... |
# coding: utf-8
import inspect
import os
import time
from datetime import datetime
import datadog
import yaml
from clint.textui import puts, colored, indent
from memoized import memoized
from commcare_cloud.cli_utils import ask, ask_option
from commcare_cloud.commands.ansible.helpers import AnsibleContext
from commca... |
import os
import requests
import sqlite3,csv
import click
from flask import current_app
#from flask import cli (inutile ?)
from flask.cli import with_appcontext
'''
Mode BOURRIN
Je fais une connection globale pour l'application, contrairement au tuto qui fait une connexion dans g (donc si j'ai bien compris par reques... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Letter-color Consistency test
O.Colizoli 2020
Each letter of the alphabet in random order x 2
Color wheel opens at a randomized color on each trial (but does not turn)
Python 2..7
"""
# data saved in ~/LogFiles/sub-XXX
# Import necessary modules
import random
import n... |
from __future__ import annotations
from typing import Any
from coredis._utils import EncodingInsensitiveDict
from coredis.response._callbacks import ResponseCallback
from coredis.response._utils import flat_pairs_to_dict, flat_pairs_to_ordered_dict
from coredis.response.types import (
StreamEntry,
StreamInfo,... |
"""Report URL routes. Collection of controller methods to create and
operate existing reports on the database.
"""
from flask_smorest import Blueprint, abort
from sqlalchemy.exc import IntegrityError
from .. import models, notifications
from ..extensions import auth, db
from ..schemas import args, schemas
from ..utils... |
'''
A Convolutional Network implementation using TensorFlow library.
'''
from __future__ import print_function
import tensorflow as tf
import board #for extracting X,Y from play()
import random #for returning x_batch,y_batch for training
import numpy as np
def state_matrix(state,height,width):
M =... |
#!/usr/bin/env python
import sys
import os
import gdal
import numpy as np
from osgeo import osr
import re
import logging
################################################################################
def calculateAltiudes(P):
P = float(P)
if abs(P-9.99e+29) < 0.00000001:
return P
else:
h ... |
#!$HOME/anaconda/bin/python
# -*- coding: utf-8 -*-
'''
Ripped from template.py
- makes a "zenagon"
'''
import inkex # Required
import simplestyle # will be needed here for styles support
import os # here for alternative debug method only - so not usually required.
__version__ = '0.1'
inkex.localize... |
import logging
import os
import sys
import getopt
import binascii
from .config import Config
from .p2p import PeerPool
from .p2p.messages import ConnectionMessage
from .crypto import Identity, Nonce, KeyBox
logger = logging.getLogger('tezpie')
def usage ():
print ('usage: tezpie [options]\n')
print ('Options:')
p... |
"""Gather conmats."""
import re
import numpy as np
import itertools as iter
from itertools import combinations
from mne.viz import circular_layout, plot_connectivity_circle
import matplotlib.pyplot as plt
def atoi(text):
"""Get digit."""
return int(text) if text.isdigit() else text
def natural_keys(text):... |
# -*- coding: utf-8 -*-
# @Time : 2021/9/18 10:20
# @Author : Leesure
# @File : train.py
# @Software: PyCharm
# parameter file
import os
import torch
import torch.nn as nn
from torch import optim
from dataset_process.DataSet import DRCD_DataSet
import torch.utils.data as torch_utils
from models.Model import S... |
#!python
def contains(text, pattern):
"""Return a boolean indicating whether pattern occurs in text.
Runtime, worst case: O(n^2), n is the len(text)
Runtime, best case: O(1), if text == ''
Space Complexity: O(n), n is the len(text)
"""
assert isinstance(text, str), 'text is not a string: {}'.fo... |
'''
Implements the targetcli base UI node.
This file is part of targetcli.
Copyright (c) 2011-2013 by Datera, 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... |
# -*- coding: utf-8 -*-
"""
Created on Wed May 13 15:11:53 2015
@author: <NAME>
"""
import argparse
import textwrap
import timeit
import os
from snptools import *
###############################################################################
def version():
v0 = """
##########################################... |
from __future__ import division, print_function
import os
import argparse
import configparser
import logging
definitions = [
# model type default help
('model', (str, 'dilated-unet', "Model: unet, dilated-unet, dilated-densenet")),
('features', (int, 64, "Number ... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
This is a skeleton file that can serve as a starting point for a Python
console script.
Then run `python setup.py install` which will install the command `pyaleph`
inside your current environment.
Besides console scripts, the header (i.e. until _logger...) of this file... |
# Copyright 2019-2021 Huawei Technologies Co., Ltd
#
# 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 agre... |
# -*- coding: utf-8 -*-
import sys
from argparse import ArgumentParser
from concurrent.futures import ThreadPoolExecutor
from concurrent.futures import as_completed as futures_as_completed
from glob import glob
from os import makedirs
from os import rename
from shutil import rmtree as rmdir
from subprocess import run
... |
import os
import re
import sqlite3
import subprocess
from datetime import datetime
from multiprocessing import Process
from multiprocessing.context import TimeoutError as ThreadTimeoutError
from multiprocessing.pool import ThreadPool
from typing import NoReturn
from executors.logger import logger
from modules.audio im... |
"""
transp.py: a model for the multi-commodity transportation problem
Model for solving the multi-commodity transportation problem:
minimize the total transportation cost for satisfying demand at
customers, from capacitated facilities.
Copyright (c) by <NAME> and <NAME>, 2012
"""
from pyscipopt import Model, quicksu... |
import numpy as np
import pandas as pd
import tensorflow as tf
from keras.models import Input, Model
from keras.layers import Dense, Dropout, Concatenate,Reshape, Conv2DTranspose,Conv2D, MaxPooling2D, LeakyReLU, UpSampling2D, Lambda
import keras
from preprocess import *
def function_to_depth_to_space(x):
x = tf.depth... |
import os
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from mpl_toolkits import mplot3d
from cost import CostModel
from track import Track, track_name
from ref import RefDriver, ref_name
root = os.path.dirname(os.path.abspath(__file__))
plot_dir = os.path.join(root, "spec", "plots")
os.makedi... |
# -*- coding: utf-8 -*-
"""
file: lexicon.py
Description: a tagger that uses lexica to annotate text
author: <NAME>
MIT License
Copyright (c) 2018 <NAME>
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 th... |
#!/usr/bin/env python3
"""read_count_scatter.py takes two sample files (tsv) and a base name for the output .pdf file
, and returns a .pdf file containing a scatterplot of the readcounts for Sample A and Sample B
, with the points on the graph (genes) colour-coded based on p=0.05, adjusted for multiple testing.
29/01/... |
import enum
import types
import typing
import weakref
class DispatchError(RuntimeError):
"""Exception raised when an exception is raised
during the execution of a registerd function
in the dispatcher.
"""
class Register(enum.IntFlag):
"""Enum to select registering mode for
Dis... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.