content stringlengths 5 1.05M |
|---|
# -*- coding: utf-8 -*-
# legume. Copyright 2009-2013 Dale Reidy. All rights reserved.
# See LICENSE for details.
__docformat__ = 'restructuredtext'
'''
A message class is a subclass of legume.messages.BaseMessage with two
class attributes defined:
* MessageTypeID - An integer uniquely identifying the message ... |
import torch
import torch.nn as nn
from model.spectrogram import Spectrogram
class Encoder(nn.Module):
"""
Encodes the waveforms into the latent representation
"""
def __init__(self, N, kernel_size, stride, layers, num_mels, sampling_rate):
"""
Arguments:
N {int} -- Dimens... |
from bitmovin_api_sdk.encoding.encodings.muxings.progressive_webm.information.information_api import InformationApi
|
class Type:
def __init__(self, name):
self.name = name
def __and__(self,other):
return Union_Type(self,other)
def __or__(self,other):
return Option_Type(self,other)
def __repr__(self):
return self.name
class Union_Type(Type):
def __init__(self,*args):
self.... |
import numpy as np
import pandas as pd
import math
from sklearn.cross_validation import train_test_split
import scipy.sparse as sparse
from scipy.sparse.linalg import spsolve
from numpy.linalg import norm,cholesky
from sklearn.metrics import mean_squared_error,mean_absolute_error
# import data
data = pd.read... |
# -*- coding: utf-8 -*-
from copy import deepcopy
import numpy as np
from scipy.integrate import simps
from .scattering_factors import scattering_factor_param, calculate_coherent_scattering_factor, \
calculate_incoherent_scattered_intensity
from .soller_correction import SollerCorrection
from .pattern import Pat... |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator 2.3.3... |
#!/usr/bin/env python
from resource_management.core.logger import Logger
import base64
import urllib2
import ambari_simplejson as json
from resource_management.core.source import Template
class RangerPolicyUpdate:
def create_policy_if_needed(self):
service_name = self.get_service()
Logger.info("... |
# -*- coding: utf-8 -*-
"""
Kernel k-means
==============
This example uses Global Alignment kernel (GAK, [1]) at the core of a kernel
:math:`k`-means algorithm [2] to perform time series clustering.
Note that, contrary to :math:`k`-means, a centroid cannot be computed when
using kernel :math:`k`-means. However, one ... |
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Created on Fri Jan 19 15:52:33 2018
@author: dalonlobo
"""
from __future__ import absolute_import, division, \
print_function, unicode_literals
import os
import sys
import argparse
import logging
import pandas as pd
from pysrt.srtfile import S... |
#!/usr/bin/python
# Given a username and plaintext password,
# authenticate against the db user records
import sys
from grinbase.model.users import Users
from grinlib import lib
# User to authenticate
username = sys.argv[1]
password = sys.argv[2]
# Initialize a db connection
database = lib.get_db()
# Lookup / ... |
# Copyright (C) Microsoft Corporation. All rights reserved.
# 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 option) any later version.
#!/usr/bin... |
import math
import glob
import os
import sys
import cv2
import numpy as np
class PreProcess():
def deskew(self, img):
gray = cv2.bitwise_not(img)
# threshold the image, setting all foreground pixels to
# 255 and all background pixels to 0
thresh = cv2.threshold(gray, 0, 255, cv2... |
import logging
import vivisect
import vivisect.exc as v_exc
import vivisect.impemu.monitor as viv_monitor
import vivisect.analysis.generic.codeblocks as viv_cb
import envi
import envi.archs.arm as e_arm
from envi.archs.arm.regs import *
from envi.archs.arm.const import *
from vivisect.const import *
logger = loggi... |
# This file is part of the Data Cleaning Library (openclean).
#
# Copyright (C) 2018-2021 New York University.
#
# openclean is released under the Revised BSD License. See file LICENSE for
# full license details.
"""Unit tests for the mapping operator."""
from openclean.function.value.mapping import mapping, Standard... |
import datetime
import db_helpers
class Event:
def __init__(self, email, event_type, timestamp):
self.email = email
self.event_type = event_type
self.timestamp = timestamp
def create_event(db, email, event_type):
event_timestamp = datetime.datetime.utcnow().isoformat()
# put toge... |
import sys
#This is a table lookup for all "flush" hands (e.g. both
#flushes and straight-flushes. entries containing a zero
#mean that combination is not possible with a five-card
#flush hand.
flushes=[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 9, 0, 0, 0, 0, 0, 0, ... |
# Generated by Django 3.1.3 on 2021-01-16 17:48
import authentication.validators
from django.db import migrations, models
import django_countries.fields
class Migration(migrations.Migration):
dependencies = [
('authentication', '0001_initial'),
]
operations = [
migrations.... |
from hpc.autoscale.ccbindings.mock import MockClusterBinding
from hpc.autoscale.node.nodemanager import new_node_manager
def test_basic() -> None:
binding = MockClusterBinding()
binding.add_nodearray("hpc", {"ncpus": "node.vcpu_count"})
binding.add_bucket("hpc", "Standard_F4", max_count=100, available_cou... |
"""Unit test package for geojson_fixer."""
|
from jivago.serialization.serialization_exception import SerializationException
class MissingKeyException(SerializationException):
pass
|
#!/usr/bin/python -tt
# -*- coding: utf-8 -*-
'''
Copyright 2014-2015 Teppo Perä
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
Un... |
from flask_jwt_extended import (create_access_token, create_refresh_token,
jwt_required, jwt_refresh_token_required, get_jwt_identity, get_raw_jwt)
from flask import Flask, Blueprint, jsonify, request, make_response, current_app
from disasterpets.Pets.models import Pets, PetsJoin
from disasterpets import bcrypt, db, j... |
from random import randint
from time import sleep
def sorteia(lista):
print(f'Sorteando 5 valores da lista: ', end='')
for cont in range(0, 5):
num = randint(1, 10)
lista.append(num)
print(f'{num} ', end='', flush=True)
sleep(0.5)
print('PRONTO!')
def soma_par(lista):
... |
from .StoreStrategy import StoreStrategy
|
# -*- coding: utf-8 -*-
# Generated by Django 1.11.7 on 2018-03-06 22:43
from __future__ import unicode_literals
from django.db import migrations
results = ['passed', 'failed', 'errored', 'skipped',
'aborted', 'not run', 'blocked']
def populate_result_types(apps, schema_editor):
Result = apps.get_m... |
import argparse
import random
import numpy as np
import torch
def setup():
parser = argparse.ArgumentParser()
parser.add_argument('--config_path', type=str,
default="/app/config.yml")
parser.add_argument('--batch-size', type=int, default=64, metavar='N',
he... |
from Redy.Typing import *
from Redy.Magic.Classic import record
def format_ast(self: 'AST', i: int):
if isinstance(self, Named):
content = self.format(i)
elif isinstance(self, Nested):
content = self.format(i)
else:
content = (' ' * i) + str(self)
return content
class AST:
... |
from nuaal.connections.api.apic_em import ApicEmBase
from nuaal.utils import get_logger
class ApicEmPnpClient:
def __init__(self, apic=None, DEBUG=False):
"""
:param apic:
:param DEBUG:
"""
self.apic = apic
self.DEBUG = DEBUG
self.logger = get_logger(name="... |
"""Test the change password view using flask's test_client()."""
from flask import url_for, get_flashed_messages
from flask_login import current_user
def test_requires_login(client, auth):
"""Check the change password view requires login."""
with client:
response = client.get("/auth/change-password"... |
# encoding=utf-8
import bisect
x = list(range(10**6))
# i = x.index(991234)
i = bisect.bisect_left(x,991234)
|
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright 2014 The Plaso Project Authors.
# Please see the AUTHORS file for details on individual authors.
#
# 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 L... |
"""Tests for parser components"""
__docformat__ = 'restructuredtext'
from io import StringIO
from unittest.mock import patch
from datalad.tests.utils_pytest import (
assert_equal,
assert_in,
assert_raises,
)
from ..parser import (
fail_with_short_help,
setup_parser,
)
def test_fail_with_short_... |
"""p2 ui General View tests"""
from django.contrib.auth.models import User
from django.shortcuts import reverse
from django.test import TestCase
class GeneralViewTests(TestCase):
"""Test general views"""
def setUp(self):
self.user, _ = User.objects.get_or_create(
username='p2-unittest')
... |
import argparse
from yolo import YOLO
from PIL import Image
parser = argparse.ArgumentParser(argument_default=argparse.SUPPRESS)
test_file = '../../DataSets/labels/HeadsTesting_modif.csv'
predictions_file = '../../DataSets/detections/heads_labels_predicted_tinyYolo_adaptedAnchors.csv'
def center(box):
print(box... |
"""
@file
@brief Modified converter from
`XGBoost.py <https://github.com/onnx/onnxmltools/blob/master/onnxmltools/convert/
xgboost/operator_converters/XGBoost.py>`_.
"""
import json
import numpy
from xgboost import XGBClassifier
class XGBConverter:
"common methods for converters"
@staticmethod
def get_xg... |
#!/usr/bin/env python3
from __future__ import unicode_literals, print_function
import codecs
import os
import re
import sys
def generate_and_write_bindings(source_dir, output_dir):
binding_params = [
("writer", { 'ignore': ['new', 'ref', 'unref', 'init', 'clear', 'reset',
... |
#!/usr/bin/env python3
# Useful for importing any python modules I have in the "modules" directory.
# http://stackoverflow.com/a/35259170/2752888
import os
import sys
sys.path.append(os.path.join(os.path.dirname(sys.path[0]),'modules'))
import random_alleles as ra
from zk_utils import *
import argparse
import inspect
... |
from django.utils.translation import gettext_lazy
try:
from pretix.base.plugins import PluginConfig
except ImportError:
raise RuntimeError("Please use pretix 2.7 or above to run this plugin!")
__version__ = "1.2.0"
class PluginApp(PluginConfig):
name = "pretix_cinesend"
verbose_name = "CineSend"
... |
# -*- coding: utf-8 -*-
import unittest
import six
from xml.etree import ElementTree
if six.PY3:
from urllib.parse import parse_qs, urlparse
else:
from urlparse import parse_qs, urlparse
class AlipayTests(unittest.TestCase):
def Alipay(self, *a, **kw):
from alipay import Alipay
return Ali... |
class ChainException(Exception):
pass
class PeerNotFoundException(ChainException):
pass
|
from praw.models import MoreComments
from ... import IntegrationTest
class TestMore(IntegrationTest):
def setup(self):
super(TestMore, self).setup()
# Responses do not decode well on travis so manually renable gzip.
self.reddit._core._requestor._http.headers['Accept-Encoding'] = 'gzip'
... |
# -*- coding: utf-8 -*-
# vispy: gallery 5:105:5
# -----------------------------------------------------------------------------
# Copyright (c) Vispy Development Team. All Rights Reserved.
# Distributed under the (new) BSD License. See LICENSE.txt for more info.
# ------------------------------------------------------... |
from abc import ABC
import tensorflow_datasets as tfds
from tqdm import tqdm
import numpy as np
class DS(ABC):
def __init__(self, variants):
"""
:param variants: Possible variants to load
"""
self.variants = variants
def load(self, name, split='train'):
"""
Lo... |
import numpy as np
import pytest
import gbpy.pad_dump_file as pad
import gbpy.util_funcs as uf
import byxtal.lattice as gbl
@pytest.mark.parametrize('filename0, element, num_GBregion, actual_min_z_gbreg, actual_max_z_gbreg,'
'actual_w_bottom_SC, actual_w_top_SC',
[("te... |
#!/bin/python3
from recognize import *
from os import system
def main():
R = Recognizer('_model')
system('clear')
R.start()
if __name__ == '__main__':
try:
main()
except KeyboardInterrupt:
print()
post('Пока')
|
# -*- coding: utf-8 -*-
import json
from pprint import pprint
from tgolosbase.api import Api
print('connect')
b4 = Api()
print('try call')
account = 'ksantoprotein'
wif = '5...'
password = 'P5...'
tx = b4.account_update_password(account, password, wif)
pprint(tx)
input()
|
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
@author: Salvatore Anzalone
@organization: CHArt - Université Paris 8
"""
from Box2D import b2
from Box2D import (b2Body, b2World, b2Vec2)
import numpy as np
"""
Vehicle based on Chris Campbell's tutorial from iforce2d.net:
http://www.iforce2d.net/b2dtut/top-down-car
"... |
"""
pytest files
"""
|
from sqlalchemy.dialects.mssql.base import MSDialect, MSSQLCompiler, MSIdentifierPreparer, MSExecutionContext
from sqlalchemy import util
from .connector import PyTDSConnector
_server_side_id = util.counter()
class SSCursor(object):
def __init__(self, c):
self._c = c
self._name = None
self.... |
"""Abstracte Factory."""
class Dog(object):
def speak(self):
return "Woooof"
def __str__(self):
return self.__class__.__name__
class DogFactory(object):
def get_pet(self):
return Dog()
def get_food(self):
return "Dog Food..!"
class PetStore(object):
def __i... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import re
import django.core.validators
import tablemanager.models
class Migration(migrations.Migration):
dependencies = [
('tablemanager', '0003_publish_geoserver_setting'),
]
operations = ... |
import time
import requests
import re
import pymysql
import urllib3
from fake_useragent import UserAgent
from scrapy import Selector
urllib3.disable_warnings()
db = pymysql.connect("localhost", "root", "", "miraihyoka")
cursor = db.cursor()
def spider():
domain = "https://www.animenewsnetwork.com/encyclopedia... |
#!/home/samhattangady/anaconda3/bin/python
import time
import sys
import pygame
import argparse
import datetime
# Function to print current time
def print_time():
print('{0:02d}:{1:02d}'.format(datetime.datetime.now().hour, datetime.datetime.now().minute), end='\t')
# Function is used to return the cursor to
# o... |
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... |
import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits import mplot3d
def plot1D(x, y):
plt.plot(x, y)
plt.grid(True)
#plt.xlim([0, np.max(x)])
#plt.ylim([0, np.max(y)])
plt.show()
def plot2D(x, y, z):
plt.contourf(x, y, z)
#plt.imshow(z, vmin=np.min(z), vmax=np.max(z),
# or... |
from django.forms import ModelForm
from django.contrib.auth.forms import UserCreationForm
from django import forms
# from django.contrib.auth.models import User
from .models import CustomUser
from django.contrib import messages
class CustomUserCreationForm(UserCreationForm):
def clean_email(self):
demail ... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from builtins import object
from builtins import range
from daglet._utils import get_hash_int, get_hash
from functools import reduce
from past.builtins import basestring
from textwrap import dedent
import copy
import daglet
import operator
import subproce... |
#!/usr/bin/env python
# Import relevant packages
import os, math, sys, argparse
# Main function
def main():
# Version info
vers = "Noise insertion script - v1.0 - Adds white noise to resistors based on temperature"
# Initiate the parser
parser = argparse.ArgumentParser(description=vers)
# Add possible pars... |
# pylint: skip-file
# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
import grpc
|
import configparser
import platform
linux_database_config_path = '/config/database.ini'
windows_database_config_path = 'D:\\database.ini'
def get_db_config():
config = configparser.ConfigParser()
config.sections()
if 'linux' in platform.system().lower():
config.read(linux_database_config_path)
... |
#打开邮件样本
with open('E:\lessons\ML wu.n.g\coursera-ml-py-master\coursera-ml-py-master\machine-learning-ex6\ex6\emailSample1.txt'
, 'r'
) as f:
email = f.read()
print(email)
#处理邮件的方法,常将url,email address , dollars 等标准化,忽略其内容
'''
1. Lower-casing: 把整封邮件转化为小写。
2. Stripping HTML: 移除所有HTML标签,只保留内... |
"""
In Counting sort, the frequencies of distinct elements of the array to be sorted is counted
and stored in an auxiliary array, by mapping its value as an index of the auxiliary array.
Initialize the auxillary array Aux[] as 0.
Note: The size of this array should be ≥max(A[]).
Traverse array A and store t... |
import ipaddress
import re
from collections import defaultdict
from boardfarm.lib.linux_nw_utility import NwDnsLookup
from boardfarm.lib.regexlib import (
AllValidIpv6AddressesRegex,
ValidIpv4AddressRegex,
)
class DNS:
"""To get the dns IPv4 and IPv6"""
def __init__(self, device, device_options, aux... |
import asyncio
import re
from urllib.parse import urlparse
import time
import discord
import dns.resolver
from discord.ext import commands, tasks
from ink.core.command import squidcommand
from ink.core.context import Context
from ink.utils.db import RedisDict
from emoji import UNICODE_EMOJI
import numpy
import unicoded... |
import os
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
# Important security settings
ALLOWED_HOSTS = []
DEBUG = False
SECRET_KEY = os.environ['SECRET_KEY']
# Application definition
INSTALLED_APPS = (
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',... |
import FWCore.ParameterSet.Config as cms
process = cms.Process("GeometryXMLWriter")
process.source = cms.Source("EmptyIOVSource",
lastValue = cms.uint64(1),
timetype = cms.string('runnumber'),
firstValue = cms.uint64(1),
... |
from typing import TYPE_CHECKING
from datetime import datetime
import uuid
from sqlalchemy import Column, Integer, String, Boolean, DateTime
from sqlalchemy.orm import relationship
from sqlalchemy.sql.schema import ForeignKey
from fastapi_utils.guid_type import GUID
from app.db.base_class import Base
class User(Base... |
# import dash
# from dash import dcc
# from dash import html
# from dash.dependencies import Output, Input, State
# import dash_bootstrap_components as dbc
# # import dash_datetimepicker as dash_dt
# # import plotly.express as px
# # import plotly.graph_objects as go
# import pandas as pd
# from dtools import wdr_ticke... |
from tkinter import *
from tkinter import ttk
from tkinter import filedialog
from tkinter import scrolledtext
from tkinter import messagebox
from PIL import ImageTk, Image
import requests
import pickle
import numpy as np
import base64
from io import BytesIO
import json
import matplotlib.pyplot as plt
import matplotlib
... |
# coding: utf-8
# Copyright (c) 2016, 2020, Oracle and/or its affiliates. All rights reserved.
# This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may c... |
from .processor import Processor
class ColorMeanProcessor(Processor):
channel_dict = dict(r=0, g=1, b=2)
channel_dict_reverse = {0: "r", 1: "g", 2: "b"}
def __init__(self, channel="g", winsize=1):
Processor.__init__(self)
if channel not in self.channel_dict.keys():
raise Key... |
# Generated by Django 3.0.8 on 2020-07-13 07:03
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('sites', '0001_initial'),
]
operations = [
migrations.AddField(
model_name='project',
... |
"""
This file contains the implementation of the main class object: anaRDPacct --- an analytical moment accountant
that keeps track the effects of a hetereogeneous sequence of randomized algorithms using the RDP technique.
In particular it supports amplification of RDP by subsampling without replacement and the ampli... |
import bson
import ujson
from bson import ObjectId
from .utils import db
def lambda_handler(event, context):
try:
object_id = event["pathParameters"]["Id"]
except TypeError:
object_id = None
mongo = db.MongoDBConnection()
with mongo:
database = mongo.connection['myDB']
... |
import wx, wx.html
from wx.lib.expando import ExpandoTextCtrl
#from gui.uberwidgets.formattedinput import FormattedInput
#from gui.uberwidgets.SizerBar import SizerBar
import gettext
gettext.install('Digsby', unicode=True)
from gui.skin import skininit
from gui.uberwidgets.formattedinput import FormattedInput
class P... |
import logging
from datetime import datetime, timezone
from typing import Any, Dict, Union
from .exceptions import NotFoundException, ServerFailureException
from .utils import BaseDict
_LOGGER = logging.getLogger(__name__)
STATUS = {
0: "OFFLINE",
1: "DISCONNECTED",
2: "AWAITING_START",
3: "CHARGING... |
import unittest
from unittest.mock import MagicMock, patch
from unit_tests.data import \
test_process_message_data_valid, \
test_process_message_no_feature_collection
from maintain_feeder.utilities.local_land_charge import process_land_charge
from maintain_feeder.models import LocalLandChargeHistory, LocalLandC... |
"""Unit tests for the parameter model."""
from external.data_model.parameters import IntegerParameter
from .meta.base import MetaModelTestCase
class IntegerParameterTest(MetaModelTestCase):
"""Integer parameter unit tests."""
MODEL = IntegerParameter
def test_check_unit(self):
"""Test that a p... |
from Houdini.Handlers import Handlers, XT
class Waddle(object):
def __init__(self, id, seats, game, room):
self.id = id
self.seats = seats
self.game = game
self.room = room
self.penguins = [None] * seats
def add(self, penguin):
seatId = self.penguins.index(Non... |
# Copyright 2013 IBM Corp.
#
# 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 agree... |
# coding=utf-8
# Copyright 2017 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
from pants.base.depr... |
# qlearningAgents.py
# ------------------
# based on http://inst.eecs.berkeley.edu/~cs188/sp09/pacman.html
from game import *
from learningAgents import ReinforcementAgent
from scipy.spatial import distance
from featureExtractors import *
import numpy as np
import random
import util
import math
from collections import... |
from dissect.utils.utils import Factorization
from dissect.traits.trait_interface import compute_results
from dissect.utils.custom_curve import CustomCurve
TRAIT_TIMEOUT = 20
def a25_curve_function(curve: CustomCurve, deg):
"""Computation of the trace in an extension together with its factorization"""
trace ... |
from fastapi import FastAPI
from yamldb import YamlDB
from cloudmesh.common.util import path_expand
import yamldb
from cloudmesh.common.util import path_expand
from pathlib import Path
from pprint import pprint
app = FastAPI()
filename = path_expand("~/.cloudmesh/catalog/data.yml")
print (filename)
print(yamldb.__ver... |
from app import db
class Face:
def __init__(self, rep, identity):
self.rep = rep
self.identity = identity
def __repr__(self):
return "{{identity: {}, rep[0:5]: {}}}".format(
str(self.identity),
self.rep[0:5]
)
class FaceImage(db.Model):
id = db.Column(... |
import codecs
import hashlib
import os
import sys
import inspect
import traceback
import sj
import typing
from mitmproxy import http
from mitmproxy import ctx
from mitmproxy.script import concurrent
from subprocess import CalledProcessError, Popen, PIPE, STDOUT
p = Popen(['mitmdump --version'], stdout=PIPE, stdin=PI... |
description = 'Slit 5 devices in the SINQ AMOR.'
group = 'lowlevel'
pvprefix = 'SQ:AMOR:motc:'
devices = dict(
d5v=device('nicos_ess.devices.epics.motor.EpicsMotor',
epicstimeout=3.0,
description='Slit 5 vertical motor',
motorpv=pvprefix + 'd5v',
errorm... |
# -*- coding: utf-8 -*-
from django.db import models, migrations
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('configuration', '0001_initial'),
]
operations = [
migrations.CreateModel(
name='OperationalSlot',
fields=[... |
# Copyright (c) 2018 MetPy Developers.
# Distributed under the terms of the BSD 3-Clause License.
# SPDX-License-Identifier: BSD-3-Clause
"""Test packaging details."""
from metpy.calc import tke
from metpy.interpolate import interpolate_to_grid
from metpy.io import Level2File
from metpy.plots import StationPlot
def ... |
import time
from random import randint
for i in range(1,85):
print('')
space = ''
for i in range(1,1000):
count = randint(1, 100)
while(count > 0):
space += ' '
count -= 1
if(i%10==0):
print(space + '🎂Happy Birthday!')
elif(i%9 == 0):
print(space + "🎂")
elif(... |
# Standard library imports.
import unittest
# Library imports.
import numpy as np
# Local library imports.
from pysph.base.particle_array import ParticleArray
from pysph.base.cython_generator import KnownType
from pysph.sph.acceleration_eval_cython_helper import (get_all_array_names,
get_known_types_for_arrays)
... |
from pandas import DataFrame
import sqlalchemy
import constants
import json
import logging
import os
from helpers import omit
from functools import reduce
from operator import concat
from pydash import flatten, flatten_deep
logging.basicConfig(
level=logging.INFO,
format='[%(module)s-l.%(lineno)s]%(asctime)s:... |
import datetime
class TestRecord(object):
def __init__(self, init_total_record: bool = False):
self.init_total_record = init_total_record
self.total_record_list = list()
def clean_record(self):
self.total_record_list = list()
test_record = TestRecord()
def record_total(function_n... |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.10 on 2018-08-03 16:54
from __future__ import unicode_literals
from django.db import migrations
def populate_names(apps, schema_editor):
def get_name(doc, fields):
return " ".join(filter(None, (doc.get(x, None) for x in fields)))
matches = apps.get_... |
from affine import Affine
import numpy as np
import pytest
from datacube.utils.geometry import gbox as gbx
from datacube.utils import geometry
from datacube.utils.geometry import GeoBox
epsg3857 = geometry.CRS('EPSG:3857')
def test_gbox_ops():
s = GeoBox(1000, 100, Affine(10, 0, 12340, 0, -10, 316770), epsg3857)... |
class Solution:
def mySqrt(self, x: int) -> int:
if x == 0:
return 0
if x == 1:
return 1
pivot = x // 2
left, right = 0, pivot
while left <= right:
mid = (left + right) // 2
nxt = (mid + 1) * (mid + 1)
prev = (mid - ... |
from functools import lru_cache
from corehq.apps.change_feed import topics
from corehq.apps.change_feed.consumer.feed import KafkaChangeFeed, KafkaCheckpointEventHandler
from corehq.apps.export.models.new import LedgerSectionEntry
from corehq.apps.locations.models import SQLLocation
from corehq.elastic import get_es_n... |
import csv
import os
import copy
import torch
import numpy as np
from torch.utils.data import Dataset
CLASSES = [
'epidural',
'intraparenchymal',
'intraventricular',
'subarachnoid',
'subdural',
'any'
]
def read_rsna_kaggle_label_csv(file):
data = {}
with open(file) as f:
re... |
class Usuario:
def __init__(self, nome, espaco, cdusuario):
self.nome = nome
self.espaco = espaco
self.cdUsuario = cdUsuario
def byteParaMega(self):
return float(self.espaco) / (1024*1024)
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.