text stringlengths 1 927k |
|---|
# Copyright (C) 2013-2014 Sony Mobile Communications AB.
# All rights, including trade secret rights, reserved.
import os
import traceback
import signal
import select
import time
import copy
import errno
import socket
import json
from ctypes import *
from datetime import datetime, timedelta
from av... |
#!/usr/bin/env python
# Variants of this code exists in 2 places, this file which has no
# user facing options which is called for implicit data conversion,
# lib/galaxy/datatypes/converters/fasta_to_tabular_converter.py
# and the user-facing Galaxy tool of the same name which has many
# options. That version is now on... |
#
# Copyright (c) 2015-2021 University of Antwerp, Aloxy NV.
#
# This file is part of pyd7a.
# See https://github.com/Sub-IoT/pyd7a for further info.
#
# 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 Lice... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Slightly based on AboutModules in the Ruby Koans
#
import unittest
from runner.koan import *
class AboutMultipleInheritance(unittest.TestCase):
class Nameable(object):
def __init__(self):
self._name = None
def set_name(self, new_name... |
#
# Copyright (c) Pret-a-3D/Paolo Ciccone. All rights reserved.
# Modified by Fuzzy70/Lee Furssedonn with kind permission from Paolo Ciccone
#
from Reality_services import *
from Reality import *
# To customize this script all you need to do is to
# change the following variable
Re_sIBL_Map = ":Runtime:Textures:Reali... |
import json
from tests.integration import basetest
# TODO check if we can unit test this
class TestCaseConstants(basetest.BaseTest):
def test_constant_is_set(self):
self.stage_container(
"sample-6.2.0.mda",
env_vars={
# has more precedence
"MX_AppClo... |
class Solution(object):
def subtractProductAndSum(self, n):
"""
:type n: int
:rtype: int
"""
prod = 1
n = [int(x) for x in list(str(n))]
for i in n:
prod *= i
return prod - sum(n)
if __name__ == '__main__':
obj = Solution()
n = 10... |
import collections
import caffe2.python.hypothesis_test_util as hu
import hypothesis.strategies as st
import numpy as np
from caffe2.python import core, dyndep, workspace
from caffe2.quantization.server.dnnlowp_test_utils import check_quantized_results_close
from hypothesis import given
dyndep.InitOpsLibrary("//caff... |
import os
import sys
import _pickle as pickle
import numpy as np
import tensorflow as tf
import chess.pgn
import pgn_tensors_utils
import bz2
def read_data(data_path, num_valids=20000):
print("-" * 80)
print("Reading data")
nb_games = 200
#nb_games = sys.maxsize
boards, labels, results = {}, {}, {}
train... |
#! /usr/bin/env python3
# -*- coding: utf-8 -*-
# Copyright 2020 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 requi... |
# 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 math
import unittest
# pylint: disable=F0401
import mojo.system
# Generated files
# pylint: disable=F0401
import sample_import_mojom
import sample_i... |
# Copyright (C) 2007-2020, Raffaele Salmaso <raffaele@salmaso.org>
#
# 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, cop... |
from .user import USER_SHORT_FIELDS, USER_FIELDS
from .guide import GUIDE_FIELDS
from .photo import PHOTO_FIELDS
from .misc import LOCATION_FIELDS
from .places import PLACE_FIELDS |
#!/bin/python2
import collections
import re
import subprocess
import sys
import getpass
PUC = "../pamu2fcfg/pamu2fcfg"
user = getpass.getuser()
resident = ["", "-r"]
presence = ["", "-P"]
pin = ["", "-N"]
verification = ["", "-V"]
Credential = collections.namedtuple("Credential", "keyhandle pubkey attributes ol... |
palavras = ('aprender', 'programar', 'linguagem', 'python',
'curso', 'gratis', 'estudar', 'praticar',
'trabalhar', 'mercado', 'programador', 'futuro')
for p in palavras:
print(f'\nNa palavra {p.upper()} temos ', end='')
for letra in p:
if letra.lower() in 'aeiou':
pri... |
"""
This program show how the multiplication operator can be used on lists! It
takes whatever is in the list and repeats it the specified number of times.
"""
my_grid = []
for i in range(8):
my_grid.append([0] * 8)
print(my_grid) |
from google.appengine.ext import ndb
class Post(ndb.Model):
subject = ndb.StringProperty(required=True)
content = ndb.TextProperty(required=True)
created = ndb.DateTimeProperty(auto_now_add=True)
user_id = ndb.IntegerProperty(required=True) |
import unicodedata
texts = ['क्ष, त्र, ज्ञ और श्र हिन्दी के संयुक्त व्यंजन हैं', 'ता']
normalizetion_type = 'NFKC'
for text in texts:
noramalized_text = unicodedata.normalize(normalizetion_type, text)
print("Unnormalized text")
for char in text:
print(char, unicodedata.name(char))
print("Normal... |
import screeninfo
def get_centerCoordinatesOfMonitor(root, window, width=None, heigth=None):
''' When using dual monitors, this will give the center of the monitor where the root is located. '''
# Get the monitors
monitors = screeninfo.get_monitors()
# Get the location of the root window
x = r... |
from unittest import TestCase
from chatterbot.adapters.logic import LogicAdapter
class LogicAdapterTestCase(TestCase):
"""
This test case is for the LogicAdapter base class.
Although this class is not intended for direct use,
this test case ensures that exceptions requiring
basic functionality are... |
"""Grid example."""
from flow.controllers import IDMController, RLController
from flow.controllers.routing_controllers import Flow_Select, FluxBase_Router
from flow.core.params import SumoParams, EnvParams, InitialConfig, NetParams
from flow.core.params import VehicleParams, PersonParams
from flow.core.params import Tr... |
# -* encoding: utf-8 *-
from typing import Set, Dict, Union
from ghconf.plumbing.teams import Admin, Team, Maintainer, Member, TeamsConfig, BaseMember
from ghconf.plumbing.teams import teamsconfig_t
from ghconf.primitives import EXTEND, OVERWRITE, Policy
config = {
"organization": {
"admin_policy": EXTEND... |
###############################################################################
# WaterTAP Copyright (c) 2021, The Regents of the University of California,
# through Lawrence Berkeley National Laboratory, Oak Ridge National
# Laboratory, National Renewable Energy Laboratory, and National Energy
# Technology Laboratory ... |
# Generated by Django 3.1.4 on 2021-06-29 00:54
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
ope... |
from django.db import models
import time
import random
from functools import partial
def _update_filename(instance, filename, path):
return path + str(time.time()) + '_' + str(random.randint(0,1000)) + '_' + filename
def upload_to(path):
return partial(_update_filename, path=path)
# Create your models here.
cl... |
#!/usr/bin/env python3
import sys
from collections import defaultdict
def other(pair, x): return pair[0] if x == pair[1] else pair[1]
def search(m, avail, cur):
top = 0
for choice in m[cur]:
if choice not in avail: continue
avail.remove(choice)
val = search(m, avail, other(choice, cur... |
"""
Copyright 2019 InfAI (CC SES)
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... |
#!/usr/bin/python
# verticalCoreg.py
# Author: Andrew Kenneth Melkonian
# All rights reserved
def verticalCoreg(search_dem_tif_path, ref_dem_tif_path, ice_bounds_path, rock_bounds_path, upper_bound, lower_bound, resolution):
assert os.path.exists(ref_dem_tif_path), "\n***** ERROR: " + ref_dem_tif_path + " does no... |
# 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.
# Changes ... |
"""
Please install ibapi from Interactive Brokers github page.
"""
from copy import copy
from datetime import datetime
from queue import Empty
from threading import Thread
from ibapi import comm
from ibapi.client import EClient
from ibapi.common import MAX_MSG_LEN, NO_VALID_ID, OrderId, TickAttrib, TickerId
from ibapi... |
###############################################################################
#
# Tests for XlsxWriter.
#
# Copyright (c), 2013-2017, John McNamara, jmcnamara@cpan.org
#
import unittest
from ...compatibility import StringIO
from ..helperfunctions import _xml_to_list
from ...worksheet import Worksheet
class TestAss... |
from django import forms
from django.conf import settings
from django.utils.encoding import force_text
from django.utils.translation import ugettext
from django.utils.translation import ugettext_lazy as _
from .models import AnyLink
class AnyLinkAdminForm(forms.ModelForm):
confirmation = forms.BooleanField(
... |
# Copyright (c) 2019 Guilherme Borges <guilhermerosasborges@gmail.com>
# All rights reserved.
from twisted.conch.ssh import transport
from twisted.internet import defer, protocol
from twisted.protocols.policies import TimeoutMixin
from twisted.python import log
from cowrie.core.config import CowrieConfig
from cowrie.... |
from foundation.models import User
def get_staff_email_addresses():
'''
Utility function which fetches all the administrator emails and returns
a python array of emails.
'''
user_emails_queryset = User.objects.filter(is_staff=True).values_list('email')
user_emails = []
for email_tuple in u... |
from django.db import migrations
def create_site(apps, schema_editor):
Site = apps.get_model("sites", "Site")
custom_domain = "customerservice-32685.botics.co"
site_params = {
"name": "CustomerService",
}
if custom_domain:
site_params["domain"] = custom_domain
Site.objects.up... |
from django.db import models
class Event(models.Model):
dt = models.DateTimeField()
class MaybeEvent(models.Model):
dt = models.DateTimeField(blank=True, null=True)
class Session(models.Model):
name = models.CharField(max_length=20)
class SessionEvent(models.Model):
dt = models.DateTimeField()
... |
import networkx as nx
from networkx.algorithms import bfs_tree
import sys
from scopes import utils
from .tasks import Spout
import pdb
G = nx.DiGraph()
def build(tasks):
""" Build graph from a list of tasks. """
for t in tasks:
G.add_node(t)
for t in tasks:
deps_found = 0
f... |
from .all_pass import all_pass
from .and_func import and_func
from .any_pass import any_pass
from .both import both
from .complement import complement
from .either import either
from .if_else import if_else
from .not_func import not_func
from .or_func import or_func |
# -*- coding: utf-8 -*-
#
# TinyTestFW documentation build configuration file, created by
# sphinx-quickstart on Thu Sep 21 20:19:12 2017.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
... |
import datetime
from timeit import default_timer as timer
import numpy as np
import pkg_resources
from PyQt5 import uic, QtWidgets, QtCore
from PyQt5.QtCore import QThread, QSettings
from matplotlib.backends.backend_qt5agg import (
FigureCanvasQTAgg as FigureCanvas,
NavigationToolbar2QT as NavigationToolbar)
... |
# 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.
# Changes may ... |
# Copyright The PyTorch Lightning team.
#
# 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... |
from robox import DictCache, FileCache, Options, Robox
with Robox(options=Options(cache=DictCache())) as robox:
p1 = robox.open("https://httpbin.org/get")
assert not p1.from_cache
p2 = robox.open("https://httpbin.org/get")
assert p2.from_cache
with Robox(options=Options(cache=FileCache("./cache"))) a... |
# Generated by Django 3.1.6 on 2021-02-26 17:36
import datetime
from django.db import migrations, models
from django.utils.timezone import utc
class Migration(migrations.Migration):
dependencies = [
('authapp', '0014_auto_20210226_2033'),
]
operations = [
migrations.AlterField(
... |
import pyautogui as pg
import time
pg.hotkey("winleft", "x")
for x in range(2):
pg.keyDown("u")
pg.keyUp("u")
time.sleep(8)
pg.keyDown("Shift")
for x in range(2):
pg.keyDown("tab")
pg.keyUp("tab")
pg.press("enter")
# tab is 'tab'
# shift is 'shift' |
"""
<name>Histogram</name>
<tags>Plotting</tags>
<icon>histogram2.png</icon>
"""
from OWRpy import *
import redRGUI, signals
class hist(OWRpy):
globalSettingsList = ['commit']
def __init__(self, **kwargs):
OWRpy.__init__(self, **kwargs)
self.RFunctionParam_x = ''
self.column = ''
... |
"""
Cisco Intersight
Cisco Intersight is a management platform delivered as a service with embedded analytics for your Cisco and 3rd party IT infrastructure. This platform offers an intelligent level of management that enables IT organizations to analyze, simplify, and automate their environments in more advan... |
import numpy as np
# noinspection PyPep8Naming
from keras import backend as K
from keras.engine import Layer
from keras.utils import get_custom_objects
def positional_signal(d_model: int, length: int,
min_timescale: float = 1.0, max_timescale: float = 1e4):
"""
Helper function, constructi... |
#
# Copyright (c) 2021 Airbyte, Inc., all rights reserved.
#
from setuptools import find_packages, setup
MAIN_REQUIREMENTS = ["airbyte-cdk~=0.1"]
TEST_REQUIREMENTS = [
"pytest~=6.1",
"source-acceptance-test",
]
setup(
name="source_klaviyo",
description="Source implementation for Klaviyo.",
auth... |
# -*- coding: utf-8 -*-
"""
idfy_rest_client.models.collection_with_paging_document_summary
This file was automatically generated for Idfy by APIMATIC v2.0 ( https://apimatic.io )
"""
import idfy_rest_client.models.links
import idfy_rest_client.models.document_summary
class CollectionWithPagingDocumentSummar... |
"""
Contains the definition of PatternFill.
"""
from .fill import Fill
class PatternFill(Fill):
"""
Represents an image fill style.
"""
def __init__(self, width, height, scale_behavior, image_href):
"""Instantiates this PatternFill."""
super().__init__()
self.width = width
... |
# -*- coding:utf-8 -*-
"""
observer.py
~~~~~~~~
信号, 事件增加订阅
:author: Fufu, 2019/12/20
"""
from .async_with_app_demo import async_width_app_handler
from .observer import Observer
from .sys_admin import sys_admin_handler
from .user_logined import user_logined_handler
from ..events import event_user_logine... |
#!/usr/bin/env python
# fusion_async.py Asynchronous sensor fusion for micropython targets.
# Ported to MicroPython by Peter Hinch, May 2017.
# Released under the MIT License (MIT)
# Copyright (c) 2017 Peter Hinch
# Uses the uasyncio library to enable updating to run as a background coroutine.
# Supports 6 and 9 deg... |
from pyro.infer.mcmc.hmc import HMC
from pyro.infer.mcmc.mcmc import MCMC
from pyro.infer.mcmc.nuts import NUTS
__all__ = [
"HMC",
"MCMC",
"NUTS",
] |
from rodan.jobs.base import RodanTask
class HelloWorld(RodanTask):
name = 'Hello World'
author = 'Ryan Bannon'
description = 'Output string "Hello World"'
settings = {}
enabled = True
category = "Test"
interactive = False
input_port_types = (
{'name': 'Text input', 'minimum': ... |
import math
accumulated_fuel = 0
tmp_fuel0 = 0
tmp_fuel1 = 0
with open("input") as input:
for mass in input:
fuel = math.floor(int(mass) / 3) - 2
tmp_fuel0 = fuel
tmp_fuel1 = fuel
while tmp_fuel0 >=6:
tmp_fuel0 = math.floor(int(tmp_fuel0) / 3) - 2
tmp_fuel1 =... |
import logging
from dvc.cache import NamedCache
from dvc.config import NoRemoteError
from dvc.exceptions import DownloadError, OutputNotFoundError
from dvc.scm.base import CloneError
from dvc.path_info import PathInfo
logger = logging.getLogger(__name__)
def _fetch(
self,
targets=None,
jobs=None,
r... |
#!/usr/bin/env python3
import sys; assert sys.version_info[0] >= 3, "Python 3 required."
import os
from pyblake2 import blake2b
from sapling_generators import SPENDING_KEY_BASE
from sapling_jubjub import Fr, Point, r_j
from sapling_key_components import to_scalar
from sapling_utils import cldiv, leos2ip
from tv_outpu... |
import boto3
from view import quick_reply
from config import line_bot_api, s3_access_key_id, s3_secret_access_key, s3_bucket
from linebot.models import TextSendMessage, QuickReply, QuickReplyButton, MessageAction
from datetime import date
def handle(event):
user_id = event.source.user_id
profile = line_bot_api... |
import os.path
import unittest
import responses
from requests_cache import CachedSession
from openbadges.verifier.actions.action_types import STORE_ORIGINAL_RESOURCE
from openbadges.verifier.actions.tasks import add_task
from openbadges.verifier.reducers.input import input_reducer
from openbadges.verifier.tasks impor... |
from petabtests import *
from petab.C import *
import petab
import pandas as pd
test_id = 15
# problem --------------------------------------------------------------------
model = DEFAULT_SBML_FILE
condition_df = pd.DataFrame(data={
CONDITION_ID: ['c0'],
}).set_index([CONDITION_ID])
measurement_df = pd.DataF... |
"""
Main file for PyTorch Challenge Final Project
"""
from __future__ import print_function, division
import json
import yaml
import time
import torch
import optuna
from torchvision import transforms
from pathlib import Path
from torchsummary import summary
from torchvision import models
# Custom functions and classes
... |
print(23*'\033[31;1m_')
print('\033[1;36mSEQUENCIA DE FIBONACCI')
print(23*'\033[1;31m-\033[m')
terms = int(input('\033[1;30mQuantos termos você quer ver? '))
cont = 1
t1 = 1
t2 = 1
print(60*'~')
print('0 -> 1 -> 1', end=' -> ')
cont = 3
while cont < terms:
t3 = t1 + t2
print(t3, end=' -> ')
t1 = t2
t2 ... |
"""
Ibutsu API
A system to store and query test results # noqa: E501
The version of the OpenAPI document: 1.13.4
Generated by: https://openapi-generator.tech
"""
import unittest
import ibutsu_client
from ibutsu_client.api.login_api import LoginApi # noqa: E501
class TestLoginApi(unittest.TestCa... |
# 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.
# --------------------------------------------------------------------... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# @Author: José Sánchez-Gallego (gallegoj@uw.edu)
# @Date: 2020-01-10
# @Filename: exposure.py
# @License: BSD 3-clause (http://www.opensource.org/licenses/BSD-3-Clause)
from __future__ import annotations
import asyncio
import functools
import os
import pathlib
import r... |
#local = False
local = True
testUser = "tester"
rootDv = "root"
#accessURL = "http://140.247.116.223:8080/"
accessURL = "http://localhost:8080/"
#accessURL = "http://dvn-build.hmdc.harvard.edu" |
# coding: utf-8
"""
Kubernetes
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501
OpenAPI spec version: v1.14.7
Generated by: https://openapi-generator.tech
"""
from __future__ import absolute_import
import unittest
import kube... |
import operator
from .compat import PY2
from .compat import PY3
from .compat import with_metaclass
from .utils import cached_property
from .utils import identity
def make_proxy_method(code):
def proxy_wrapper(self, *args):
return code(self.__wrapped__, *args)
return proxy_wrapper
class _ProxyMetho... |
import os
import sys
import json
import logging
import numpy as np
import pandas as pd
import matplotlib
matplotlib.use('Agg')
import torch
from torch import nn
import torch.optim
import torch.utils.data
import torch.nn.functional as F
import utils
import logging
from text_encoder import TokenTextEncoder
from preproces... |
import json
from datetime import datetime, timedelta
from uuid import uuid4
import jwt
import requests
from flask import current_app, jsonify, request
from flask_cors import cross_origin
from jwt.algorithms import RSAAlgorithm # type: ignore
from alerta.auth.utils import create_token, get_customers, not_authorized
f... |
import tweepy
import pycorpora
import random
import json
import os
import unidecode
import time
from tweepy.streaming import StreamListener
from tweepy import OAuthHandler
from tweepy import Stream
access_token_secret="foo"
access_token="foo"
consumer_key="foo"
consumer_secret="foo"
pitches = ['57', '60', '62', '... |
# 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.
# Changes may ... |
import logging
from twisted.internet import defer
log = logging.getLogger(__name__)
class StreamProgressManager:
#implements(IProgressManager)
def __init__(self, finished_callback, blob_manager,
download_manager, delete_blob_after_finished=False):
self.finished_callback = finished_... |
while c1:
x = 1
else:
y = 1
while c2:
a = 1
break
b = 1
else:
c = 1
while c3:
m = 1
if m:
break
n = 1
else:
o = 1
while c4:
m = 1
if m:
break |
# 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... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.contrib.auth.decorators import login_required
from django.shortcuts import render, redirect, get_object_or_404
from django.urls import reverse
from django.contrib.auth import get_user_model, update_session_auth_hash
from django.contrib.auth.f... |
## @file
# This file contained the parser for define sections in INF file
#
# Copyright (c) 2011, Intel Corporation. All rights reserved.<BR>
#
# This program and the accompanying materials are licensed and made available
# under the terms and conditions of the BSD License which accompanies this
# distribution. The ... |
import re
import textwrap
import typing as typ
from warnings import warn
from sidekick.typing import Func
from sidekick.functions import fn
Fn1 = fn.annotate(1)
Fn2 = fn.annotate(2)
Fn3 = fn.annotate(3)
Fn1Opt = fn.annotate(1)
Fn2Opt = fn.annotate(2)
Fn3Opt = fn.annotate(3)
# from inflection import
NOT_GIVEN = objec... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# --------------------------------------------------------------------
# Copyright (c) iEXBase. All rights reserved.
# Licensed under the MIT License.
# See License.txt in the project root for license information.
# ----------------------------------------------------------... |
"""Utilities for scene caching."""
import json
import zlib
import inspect
import copy
import numpy as np
from types import ModuleType, MappingProxyType, FunctionType, MethodType
from time import perf_counter
from .. import logger
ALREADY_PROCESSED_ID = {}
class CustomEncoder(json.JSONEncoder):
def default(self... |
# Generated by Django 2.1.3 on 2018-12-18 22:31
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('AppFlaming', '0002_auto_20181218_2121'),
]
operations = [
migrations.AddField(
model_name='stockproducto',
name='pre... |
"""
This module contains the base Script class that all
scripts are inheriting from.
It also defines a few common scripts.
"""
from twisted.internet.defer import Deferred, maybeDeferred
from twisted.internet.task import LoopingCall
from django.conf import settings
from django.utils.translation import ugettext as _
fr... |
import matplotlib.pyplot as plt
import numpy as np
from scipy.io import loadmat
from scipy.interpolate import interp1d
def _load_signal(name):
try:
sig = loadmat(name)
except FileNotFoundError:
raise
condition = name.split('_')[-1]
sig['t'] = sig.pop('t_%s' % condition).flatten()
s... |
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
from .. import... |
import py
from socket import socket
from py.__.green.msgstruct import decodemessage, message
from socket import socket, AF_INET, SOCK_STREAM
import marshal
import sys
TRACE = False
def trace(msg):
if TRACE:
print >>sys.stderr, msg
class Finished(Exception):
pass
class SocketWrapper(object):
def _... |
import numpy as np
import tensorflow as tf
from . import variable
from .options import global_options
class AutoinitType(object):
''' Base class to identify auto initializers '''
pass
class AutoInit(object):
''' Indicates that the property should be auto initialized
Example: ::
TdlModel(pr... |
import ckan.plugins as p
from ckan.plugins.toolkit import add_template_directory
from ckanext.repeating import validators
class RepeatingPlugin(p.SingletonPlugin):
p.implements(p.IValidators)
p.implements(p.IConfigurer)
def update_config(self, config):
"""
We have some form snippets tha... |
# coding: utf-8
from __future__ import absolute_import
from datetime import date, datetime # noqa: F401
from typing import List, Dict # noqa: F401
from fuji_server.models.base_model_ import Model
from fuji_server.models.data_file_format_output import DataFileFormatOutput # noqa: F401,E501
from fuji_server.models.... |
import numpy as np
import cv2
import os
from os import listdir, makedirs
from os.path import join
from PIL import Image
import shutil
import sys
def crop_numpy(dim1, dim2, dim3, vol):
return vol[dim1:vol.shape[0] - dim1, dim2:vol.shape[1] - dim2, dim3:vol.shape[2] - dim3]
def write_tiff_stack(vol, fname):
im... |
import numpy as np
import pygmsh
import meshio
import sys
#---------------------Beam Parameters----------------------------#
L = 40 # length of beam
w = 5 # wdith of beam
r_max = w/10
r_min = w/15
#----------------------------------Import Files---------------------#
# Change to directory of dowloaded txt files in fol... |
import time
import pytest
from pnp.plugins.pull.simple import Repeat
from . import make_runner, start_runner
@pytest.mark.asyncio
async def test_repeat_pull():
events = []
def callback(plugin, payload):
events.append(payload)
dut = Repeat(name='pytest', repeat="Hello World", wait=0.001)
run... |
# Compile by Sanz
# Youtube : FREE TUTORIAL
# Github : https://github.com/Sxp-ID
# Mau recode ya? Izin dulu Slur >_< |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.response.AlipayResponse import AlipayResponse
from alipay.aop.api.domain.Institution import Institution
class MybankPaymentTradeBankRootQueryResponse(AlipayResponse):
def __init__(self):
super(MybankPaymentTradeBankRootQueryRe... |
# -*- coding: utf-8 -*-
# Copyright 2020 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... |
#!/usr/bin/env python3
import asyncio
import concurrent.futures
import logging
from argparse import Namespace
from configparser import ConfigParser
from json import JSONDecodeError, load
from pathlib import Path
from typing import Awaitable, List
from urllib.parse import urlparse
from packaging.utils import canonical... |
default_app_config = 'izi.apps.checkout.config.CheckoutConfig' |
A, B = map(int, input().split())
if B%A == 0:
print(A + B)
else:
print(B - A) |
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi SDK Generator. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union
from ... import _utilities, _tables
__a... |
from ..base import CacheBackend
class LocMemCacheBackend(CacheBackend):
scheme = 'locmem'
def __init__(self, **config):
super(LocMemCacheBackend, self).__init__(**config)
self._cache = {}
self.calls = 0
self.hits = 0
self.misses = 0
self.sets = 0
def clea... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.