content stringlengths 5 1.05M |
|---|
import six
import os
import pickle
from coopy import fileutils
if six.PY3:
from pickle import Pickler
else:
from cPickle import Pickler
class DiskJournal():
def __init__(self, basedir, system_data_path):
'''
set basedir and declare file attribute
'''
self.basedir = base... |
from os.path import dirname, join
import numpy as np
import pandas as pd
import pytest
from bambi.models import Model
@pytest.fixture(scope="module")
def data_numeric_xy():
x = np.random.uniform(size=100)
y = x + np.random.normal(scale=0.5, size=100)
data = pd.DataFrame({"y": y, "x": x})
return data... |
import pandas as pd
import numpy as np
import sympy as sp
from scipy.constants import physical_constants
def LagCorrection(df, R0=0.49441, m=1):
'''
df must have Heat Rate, Peak Temp, Peak Height (W/g) as first three columns.
Does Lag Correction from ASTM E698-2011 and adds useful columns to dataframe
... |
# Generated by Django 2.0.2 on 2018-02-23 07:30
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('shop', '0003_order_status'),
]
operations = [
migrations.AddField(
... |
import json
# load json file
# import 'data.json'
f = open('json_data/search-keywords.json')
data = json.load(f)
# Function to process the message and extract the required information given by the user
def process_message(message, count):
# print(message)
queries = []
introduction = data['introduction']
... |
import numpy as np
from sklearn.model_selection import train_test_split
from sklearn import datasets
from sklearn import svm
iris = datasets.load_iris()
iris.data.shape, iris.target.shape
# validation set/Development set
# Test set/holdout set
for i in range(100):
X_train, X_dev, y_train, y_dev = train_test_spli... |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.9 on 2019-11-11 10:08
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('cmdb', '0038_auto_20191028_1833'),
]
operations = [
migrations.AlterField(
... |
# -*- coding: utf-8 -*-
################################################################################
# Copyright 1998-2018 by authors (see AUTHORS.txt)
#
# 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 th... |
import os
from flask_socketio import SocketIO
from flask_sqlalchemy import SQLAlchemy
class DB:
db_ref = None
def __init__(self):
DB.db_ref = SQLAlchemy()
class SOK:
socket_ref = None
def __init__(self):
SOK.socket_ref = SocketIO(cors_allowed_origins="*")
def get_db_ref():
"... |
import string
import factory.fuzzy
class FuzzyCode(factory.fuzzy.FuzzyText):
def __init__(self, *args, **kwargs):
kwargs.setdefault('chars', string.ascii_uppercase)
super().__init__(*args, **kwargs)
class ContinentFactory(factory.django.DjangoModelFactory):
code = FuzzyCode(length=2)
n... |
from django import template
register = template.Library()
@register.filter
def get_option(server, command):
try:
option = server.config_options.get(command=command)
return option.get_value()
except:
return ''
|
import sys
from dffml.high_level.ml import accuracy
from dffml.util.asynctestcase import AsyncTestCase
import dffml_model_scikit.scikit_models
from .test_scikit import (
REGRESSORS,
CLUSTERERS,
CLASSIFIERS,
TestScikitModel,
supervised_estimators,
unsupervised_estimators,
FEATURE_DATA_REGR... |
import FWCore.ParameterSet.Config as cms
from ..modules.hltDeepBLifetimeTagInfosPFPuppi_cfi import *
from ..modules.hltDeepCombinedSecondaryVertexBJetTagsInfosPuppi_cfi import *
from ..modules.hltDeepCombinedSecondaryVertexBJetTagsPFPuppi_cfi import *
from ..modules.hltDeepInclusiveMergedVerticesPF_cfi import *
from .... |
#!/usr/bin/python
import tecplot
import os
import numpy as np
import math
import string
import glob
from graphicsGenerator import graphicsGenerator
from tecplot.exception import *
from tecplot.constant import *
def postProcessingEuler():
# Python directory to bin directory
os.chdir("../bin");
... |
from flask import render_template, url_for, request, redirect, jsonify, make_response, Blueprint
from flask_login import current_user
from breadlog.models import Recipe, Step, User, StepIngredient
from breadlog.recipes.forms import RecipeForm
from breadlog.recipes.utils import make_err_response, sum_recipe_ingredients
... |
# Copyright 2000-2010 Michael Hudson-Doyle <micahel@gmail.com>
# Alex Gaynor
# Antonio Cuni
# Armin Rigo
# Holger Krekel
#
# All Rights Reserved
#
#
# Permission to use, copy, modify, and distribute this sof... |
from django.views import View
from django import http
from django_redis import get_redis_connection
from django.http import JsonResponse
from QQLoginTool.QQtool import OAuthQQ
from meiduo_mall import settings
from apps.oauth.models import *
from django.contrib.auth import login
from apps.oauth.utils import *
import jso... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Copyright (c) 2019. Mike Herbert
#
# This program 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 2 of the License, or
# (at your... |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
import render
from actionsource import KeyboardActionSource
from level_loader import load_level_filepath
import os.path
if __name__ == '__main__':
level_data = load_level_filepath(os.path.join('Data', 'Test', 'goal_advanced.json'))
actio... |
def decimal_to_binary(num):
# Number to convert
q = num
result = ""
NEW_BASE = 2
# Perform the body of the loop once
r = q % NEW_BASE
result = str(r) + result
q = q // NEW_BASE
# Keep on looping until q == 0
while q > 0:
r = q % NEW_BASE
result = s... |
from django.contrib.auth.views import login as django_login
from accounts.forms import LoginForm
def login(request):
response = django_login(
request, template_name="accounts/login.html", authentication_form=LoginForm
)
return response
|
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Author: HaiFeng --<galaxy>
Purpose:
Created: 2016/8/2
"""
class switch(object):
def __init__(self, value):
self.value = value
self.fall = False
def __iter__(self):
"""Return the match method once, then stop"""
yield self.match
raise StopIteration
... |
import os
import tensorflow as tf
slim = tf.contrib.slim
_FILE_PATTERN = '%s-*'
_ITEMS_TO_DESCRIPTIONS = {
'image': 'A color image of varying height and width.',
'object/bbox': 'A list of bounding boxes.',
}
_DOMAINS_TO_SIZES = {
'clothes': 13652,
'models': 11243,
}
def get_dataset(domain_name, d... |
import json
from schematics.exceptions import DataError
from nose.tools import eq_,raises
from moncli import column_value as cv
from moncli.enums import ColumnType
from moncli.models import MondayModel
from moncli.types import LinkType
def test_should_succeed_when_to_native_returns_a_link_when_passed_a_link_value_va... |
"""
Collection of tests for unified math functions
"""
# global
import pytest
import numpy as np
# local
import ivy
import ivy.functional.backends.numpy
import ivy_tests.test_ivy.helpers as helpers
# erf
@pytest.mark.parametrize(
"x", [[0.], [[1.]]])
@pytest.mark.parametrize(
"dtype", ['float32'])
@pytest.m... |
from .logger import initiate_logger
from .telegram import Telegram |
import matplotlib.pyplot as plt
def y(r1, x1):
"""
:param r1: growth rate r
:param x1: percentage of the maximum (expressed in decimals) x
:return: xn+1
"""
return r1*x1*(1-x1)
r = 0
x = 0.5
track_list_ex = list()
track_list_r = list()
while r <= 4:
for t in range(0, 400):
x = y(... |
import unittest
class TestInput(unittest.TestCase):
def test_addition(self):
add = 2 + 2
self.assertEqual( add, 4)
if __name__ == '__main__':
unittest.main() |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.6 on 2017-03-20 07:41
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('app01', '0005_auto_20170320_1535'),
]
operations = [
migrations.AlterUniqueTogether... |
import praw
import reddit.connection
import reddit.praw_utils as praw_utils
import copy
def get_new_as_dict(r, subname):
posts = []
sub = r.get_subreddit(subname)
for post in sub.get_new(limit=100):
p = praw_utils.prepare_post_for_json(copy.copy(post))
posts.append(p)
return posts
|
# Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import unittest
from telemetry.core.timeline import empty_timeline_data_importer
from telemetry.core.backends.chrome import tracing_timeline_data
class Em... |
#!/usr/bin/env python
"""
The actual jobArchiver algorithm
"""
import logging
import os
import os.path
import shutil
import tarfile
import threading
from Utils.IteratorTools import grouper
from Utils.Timers import timeFunction
from WMCore.DAOFactory import DAOFactory
from WMCore.JobStateMachine.ChangeState import Chan... |
# anaconda-requirements.py
# Generate a package list of Anaconda requirements based on the listed
# packages included on the website. Set Python version in line 9, and
# platform in line 10.
import requests
import sys
from lxml import html
PY_MAJOR = sys.version_info[0]
PY_MINOR = sys.version_info[1]
PLATFORM = 'Win... |
import time
from options.train_options import TrainOptions
from data.custom_dataset_data_loader import CustomDatasetDataLoader
from util.visualizer import Visualizer
import copy
from tqdm import tqdm
import numpy as np
import torch
from models.base_model import BaseModel
torch.manual_seed(0)
opt = TrainOptions().par... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# This file is part of antiviral
#
# Copyright (c) 2015 Lorenzo Carbonell Cerezo <a.k.a. atareao>
#
# 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 Sof... |
# -*- coding: utf-8 -*-
"""
@author: Satoshi Hara
(Class)
> DefragModel(modeltype='regression', maxitr=100, qitr=5, tol=1e-6, eps=1e-10, delta=1e-8, kappa=1e-6, seed=0, restart=10, L=-1, verbose=0, njobs=1)
modeltype : 'regression' or 'classification'
maxitr : maximum number of iterations for optimizati... |
"""
SmartRegisterOrderInfo操作用モジュール
# TODO: 動作確認後docString記載
"""
from logging import Logger
import os
from boto3.dynamodb.conditions import Key
from datetime import datetime
from dateutil.tz import gettz
from aws.dynamodb.base import DynamoDB
class SmartRegisterOrderInfo(DynamoDB):
"""SmartRegisterOrderInfo操作用クラ... |
# Copyright 2020 The ElasticDL 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 applicable law... |
import sys
from jpy import util
# Bash colours - taken from http://tldp.org/HOWTO/Bash-Prompt-HOWTO/x329.html
# Black 0;30 Dark Gray 1;30
# Blue 0;34 Light Blue 1;34
# Green 0;32 Light Green 1;32
# Cyan 0;36 Light Cyan 1;36
# Red 0;31 Light Re... |
# Copyright (c) 2018 Dolphin Emulator Website Contributors
# SPDX-License-Identifier: MIT
from django import template
from django.conf import settings
from django.contrib.staticfiles.storage import staticfiles_storage
from django.urls import reverse
from django.utils.translation import ugettext_lazy as _
from dolweb.c... |
import boto3
ec2 = boto3.resource('ec2')
for instance in ec2.instances.all():
print (instance)
print (instance.id, instance.state)
|
import torch as T
#from models.layers.BigTransformers.BERT import BertModel
#import numpy as np
#from configs.WNUT_configs import *
#from transformers import BertTokenizerFast, ElectraTokenizerFast
def pool(list_embeddings, pool_type='mean'):
if pool_type == 'first':
return list_embeddings[0]
elif poo... |
import json
from typing import Generator, Iterable, Union
import cv2
import grpc
import numpy as np
import torch
from proto.service_pb2 import InferRequest
from proto.service_pb2_grpc import PredictStub
from toolz import compose
from torchvision import transforms
from modelci.hub.deployer.config import ONNX_GRPC_PORT... |
#from __future__ import (absolute_import, division, print_function,unicode_literals)
import sqlalchemy as db
from sqlalchemy import Column, MetaData, Table, create_engine
from sqlalchemy import String, Integer, Float, BigInteger, DateTime
from sqlalchemy.schema import DropTable, CreateTable
from sqlalchemy.orm import... |
def flip():
pass
def set_mode(dim):
# returns a "screen" object
# screen.blit
pass
|
from django.shortcuts import render
from django import forms
from music_metadata.territories.territory import Territory
from music_metadata.territories.territory_list import TerritoryList
from django.views import View
class TerritoryForm(forms.Form):
def get_choices():
choices = [(None, '-')]
cho... |
# Generated by Django 2.1.5 on 2019-02-12 16:06
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('openbook_communities', '0011_auto_20190211_0941'),
]
operations = [
migrations.AlterField(
model_name='communitylog',
... |
'''
Ken Caluwaerts
<ken@caluwaerts.eu>
Example of a minimal tensegrity with 6 bars and 18 springs.
See Calladine 1978 for a discussion of the properties of this structure.
'''
import matplotlib.pylab as plt
plt.ion()
import numpy as np
import mplab_gui
import simulator_springmass_stiff as simulator
N = np.array(... |
# -*- coding: utf-8 -*-
# author: zhaijinyuan
# date: 2017/9/23 下午1:47
import sys
reload(sys)
sys.setdefaultencoding('utf8')
from aliyunsdkdysmsapi.request.v20170525 import SendSmsRequest
from aliyunsdkdysmsapi.request.v20170525 import QuerySendDetailsRequest
from aliyunsdkcore.client import AcsClient
import uuid
de... |
# Welcome to RAM and stack size hacks central, I'm your host, klardotsh!
# Our import structure is deeply nested enough that stuff
# breaks in some truly bizarre ways, including:
# - explicit RuntimeError exceptions, complaining that our
# stack depth is too deep
#
# - silent hard locks of the device (basically unrec... |
import os
import json
import vcr
import pytest
import cfn_resource
class FakeLambdaContext(object):
def __init__(self, name='Fake', version='LATEST'):
self.name = name
self.version = version
@property
def get_remaining_time_in_millis(self):
return 10000
@property
def fun... |
# Author: Jintao Huang
# Time: 2020-5-21
from models.efficientdet import efficientdet_d0
import torch
from utils.detection.predictor import Predictor
# -------------------------------- 参数
image_path = "images/1.png"
score_thresh = 0.2
nms_thresh = 0.2
# --------------------------------
if torch.cuda.is_available():
... |
# -*- coding: utf-8 -*-
from django.conf.urls.defaults import *
urlpatterns = patterns('',
(r'^password_required/$', 'password_required.views.login'),
# We just need a 200 response code, never mind that the template
# produces no output without a context.
(r'^test/$', 'django.views.generic.simple.dire... |
import pdb
import traceback
import numpy as np
from beautifultable import BeautifulTable
def evaluate_obj_fn(c, vars):
"""Evaluates objective function, takes in `c` and `var`"""
f = sum([c[i, 0] * vars["x" + str(i + 1)] for i in range(c.shape[0])])
return f
def calculate_b_a_ratios(a, b, c, s):
b_a_... |
from drf_spectacular.utils import OpenApiExample
from products.schemas import SIMPLE_PRODUCT_RETRIEVE
from utils.schema_helper import RESPONSE_DEFAULT_RETRIEVE, schema_generator
CARTITEM_RESPONSE_RETRIEVE = OpenApiExample(
**RESPONSE_DEFAULT_RETRIEVE,
value={
**schema_generator({
'quantity'... |
import numpy as np
import matplotlib.pyplot as plt
x = np.linspace(0,4,10001)
y = 0*x
y[np.logical_and(1<x,x<=2)] = x[np.logical_and(1<x,x<=2)]-1
y[np.logical_and(2<x,x<=3)] = 1 - np.sqrt(.3-.25) + np.sqrt(0.3 - (x[np.logical_and(2<x,x<=3)]-2.5)**2)
y[x>3] = 1
fig = plt.figure(figsize=(4, 3))
plt.plot(x,y, linewidth... |
import pygame
import pygame_gui
from pygame_gui.elements import UITextEntryLine
from src.ClientMain import client
'''
sys.path.insert(0, '../src')
from pygame_gui.elements import UITextEntryLine
from ClientMain import client
from GameBoard.NodeRoads import *
from GameBoard.Board import *
from client.Client import *
f... |
# coding: utf-8
# Copyright 2020. ThingsBoard
# #
# 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
# #
# Unl... |
#!/usr/bin/python
#
# Copyright 2018-2020 Polyaxon, 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 ... |
"""
Django settings for magpie project.
Generated by 'django-admin startproject' using Django 1.9.4.
For more information on this file, see
https://docs.djangoproject.com/en/1.9/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.9/ref/settings/
"""
import os
# ... |
import random
class Writer(Thread):
def set(self, d, l):
self.data = d
self.lock = l
def run(self):
while True:
#locks for write
self.lock.write_lock()
#generate data
self.data.append(random.choice([0,1,2,3,4]))
#unlock
... |
from django.conf.urls import url
from django.views.generic.base import TemplateView
from . import views
urlpatterns = [
url(
r"^application/new/$",
views.NewSponsorshipApplicationView.as_view(),
name="new_sponsorship_application",
),
url(
r"^application/$",
views.S... |
from setuptools import setup
setup(
name = 'brrr',
packages = ['brrr'], # this must be the same as the name above
version = '0.12',
description = 'Let Gucci Mane tell you when your script is done.',
author = 'Dominik Straub',
author_email = 'dstraub93@gmail.com',
url = 'https://github.com/dominikstrb/brrr... |
#################################################
#
# IDASynergy 0.1
# This module handles the UI and the SVN client.
#
#################################################
import re
import sys
import glob
import shutil
from idc import *
from idautils import *
from idaapi import *
import idc
import idautils
import idaapi... |
#%%
import sys
sys.path.append("..")
import scipy
from scipy.spatial import transform
import numpy as np
from numpy.linalg import matrix_rank, matrix_power, cholesky, inv
import torch
from torch.utils.tensorboard import SummaryWriter
from tqdm import tqdm
import util.geometry_util as geo_util
from solvers.rigidity_s... |
"""Fonduer TSV document preprocessor."""
import codecs
import sys
from typing import Iterator
from fonduer.parser.models import Document
from fonduer.parser.preprocessors.doc_preprocessor import DocPreprocessor
from fonduer.utils.utils_parser import build_node
class TSVDocPreprocessor(DocPreprocessor):
"""A ``Do... |
#!/usr/bin/env python3
import os
import unittest
import requests
import yaml
from flask import json
from parameterized import parameterized
from requests_toolbelt.utils import dump
from rest.api.constants.api_constants import ApiCode
from rest.api.responsehelpers.error_codes import ErrorMessage
class FlaskServerTes... |
import pandas as pd
import matplotlib.pyplot as plt
import numpy as np
data = pd.read_csv('../ECGFiveDays_TRAIN', sep=',', header=None)
label = data.pop(data.columns[0])
def plot_motif(Ta, Tb, values, indexes, m):
from matplotlib import gridspec
plt.figure(figsize=(8,4))
plt.subplot(211)
plt.plot(Ta, l... |
AUTHOR_FEMALE = {'Femina': ['0009', '0051', '0054', '0197', '0220', '0244', '0294', '0372', '0509', '1213', '1355', '1493', '1572', '1814', '1828', '2703', '2766']} |
import numpy as np
"""
Random and Human-ineracting players for the game of Ultimate TicTacToe.
Author: Alwin Hollebrandse, github.com/AlwinHollebrandse
Date: March 5, 2021.
Based on the OthelloPlayers by Surag Nair.
"""
class RandomPlayer():
def __init__(self, game):
self.game = game
def play(self,... |
from typing import Generator
import boto3
from resources.aws_resource import AWSResource
class GlueCatalog(AWSResource):
def __init__(self, glue_catalog: dict, should_dump_json: bool = False) -> None:
self.attr_map = {"arn": "GlueCatalogArn"}
super().__init__("GlueCatalog", glue_catalog, should... |
import sys
import os,glob,argparse,json
import shutil
parser = argparse.ArgumentParser()
parser.add_argument("--src",type=str)
parser.add_argument("--dest",type=str)
parser.add_argument("--calc-glob-outputs",action="store_const",const=True,default=False)
parser.add_argument("--glob",dest="glob",action="store_cons... |
import os
from basePhantom import _BasePhantom
class _PhantomActions(_BasePhantom):
"""
Wrapper around the Phantom REST calls for Assets
"""
def __init__(self, host, username, password):
_BasePhantom.__init__(self, host, username, password)
self.endpoint_url = os.path.join(self.host, "a... |
import csv
import os
import json
import re
from sklearn.feature_selection import VarianceThreshold
from sklearn.model_selection import train_test_split
from nltk import word_tokenize
datafile = '../data/preprocessed/preprocessed.csv'
tab = '\t'
punctuation = re.compile('[^a-zA-ZæøåÆØÅ0-9]')
def get_instances(filena... |
"""Asynchronous extension of :class:`fluidlab.interfaces.VISAInterface` (:mod:`pymanip.interfaces.aiovisa`)
===========================================================================================================
This module defines :class:`AsyncVISAInterface` as a subclass of :class:`fluidlab.interfaces.visa_inter... |
from fileinput import FileInput
from typing import Counter
from core import empty_str, split_on
from day14a import parse_inertions
def perform_insertions(pairs: Counter[str], table: dict[str, str]) -> Counter[str]:
new_pairs: Counter[str] = Counter()
for pair, n in pairs.items():
insert = table[pair... |
"""
Query hugs database and build sample.
"""
from __future__ import division, print_function
from argparse import ArgumentParser
import pandas as pd
import hugs
from hugs.database.tables import Source
parser = ArgumentParser()
parser.add_argument('out_fn', type=str)
parser.add_argument('--db-fn', dest='db_fn', type... |
#!/usr/bin/env python
# Filename: stumpff.py
|
from floodsystem.station import MonitoringStation
import matplotlib.pyplot as plt
import matplotlib
from floodsystem.analysis import polyfit
def plot_water_levels(station, dates, levels): # Task 2E new function
"""Displays a plot of the water level data against time, with
typical high/low levels for comparis... |
'''
Problem 9
A Pythagorean triplet is a set of three natural numbers, a < b < c, for which,
a**2 + b**2 = c**2
For example, 3**2 + 4**2 = 9 + 16 = 25 = 5**2.
There exists exactly one Pythagorean triplet for which a + b + c = 1000.
Find the product abc.
'''
import time
def list_gen(last):
triplet = [[a, b, c... |
import torch
import torch.nn as nn
import torch.nn.functional as F
from networks.deeplab.aspp import ASPP
from networks.deeplab.backbone.resnet import SEResNet50
from networks.correlation_package.correlation import Correlation
from networks.ltm_transfer import LTM_transfer
class ATnet(nn.Module):
def __init__(se... |
"""
The BagFile class is a child class of the camera, designed to be used for pre-recorded .bag files
"""
import cv2
import numpy as np
import pyrealsense2 as rs
try:
from vision.camera.template import Camera
except ImportError:
from template import Camera
try:
from vision.common.take_picture import save_ca... |
import sys
import os
import argparse
import logging
import aiohttp_cors
import socketio
from aiohttp import web, streamer
logging.basicConfig(stream=sys.stdout)
logger = logging.getLogger("socketio-server")
logger.setLevel(logging.INFO)
parser = argparse.ArgumentParser()
parser.add_argument("--static-dir", type=str,... |
"""
Example to run the CWT wavelet transform method.
"""
import numpy as np
from numpy.testing import assert_allclose
from gammapy.detect import CWT, CWTData, CWTKernels
from gammapy.image import SkyImage
def make_fermi_data():
filename = '$GAMMAPY_EXTRA/datasets/fermi_survey/all.fits.gz'
image = SkyImage.re... |
#!/usr/bin/python3.4
# -*- coding: iso-8859-15 -*-
# -O Optimize e non scrive il __debug__
#
# ####################################################################################################################
import sys, os
import types
import platform
import openpyxl
from openpyxl.utils import get_column_letter... |
import socket
BUFSIZE = 1024
ip_port = ('127.0.0.1', 9999)
server = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) # udp协议
server.bind(ip_port)
while True:
data,client_addr = server.recvfrom(BUFSIZE)
print('server收到的数据', data)
server.sendto(data.upper(),client_addr)
server.close() |
class RayException(Exception):
"""An exception raised if ray package is required but not available."""
@classmethod
def required_to(cls, thing):
return cls(
f"""Ray Package is required to simulate {thing}.
You may not have installed the [train] or [test] dependencies requ... |
#
# Copyright 2022 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... |
import itertools
import matplotlib.pyplot as plt
import numpy as np
import random
import sys
from formula_parser import *
from valuation import *
from search import get_phylogenetic_weights
universals = [
(1, "S-O"),
(2, "Adp-NP ⇔ N-Gen"),
(3, "V-S-O ⇒ Adp-NP"),
(4, "S-O-V ⇒ NP-Adp"),
(5, "( S-O-V & N-Gen ) ⇒ N-... |
"""Deploy module"""
import hashlib
import mmap
import os
import requests
from netlify_py.apis.api_base import ApiBase
class Deploys(ApiBase):
"""
Deploy class
Args:
access_token (str): netlify access token
base_url (str): netlify api base url
"""
def __init__(self, access_token,... |
"""
Copyright 2020 The OneFlow 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 applicable law or agr... |
# -*- coding: utf-8 -*-
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# #
# BSD 2-Clause License #
# ... |
# Software License Agreement (BSD License)
#
# Copyright (c) 2008, Willow Garage, 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... |
#!/usr/bin/env python2
from telegram.ext import Updater
updater = Updater(token='TOKEN')
|
"""
afplot.cli
~~~~~~~~~~
:copyright: (c) 2017 Sander Bollen
:copyright: (c) 2017 Leiden University Medical Center
:license: MIT
"""
from os import listdir
from os.path import realpath, join, dirname
import shutil
from tempfile import mkdtemp, NamedTemporaryFile
import pytest
from click.testing import CliRunner
import... |
# -*- coding: utf-8 -*-
from __future__ import (absolute_import, division, print_function,
unicode_literals)
from future.builtins import * # NOQA @UnusedWildImport
import codecs
import fnmatch
import os
import re
import unittest
import obspy
from obspy.core.util.misc import get_untracked_file... |
# The MIT License (MIT)
#
# Copyright (c) 2018 James K Bowler, Data Centauri Ltd
#
# 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... |
"""
Copyright 2021 Nirlep_5252_
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, software
d... |
#
# Copyright (c) 2016, deepsense.io
#
# 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 w... |
# This file is part of QuTiP.
#
# QuTiP 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 License, or
# (at your option) any later version.
#
# QuTiP is distributed in the ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.