text stringlengths 2 999k |
|---|
from __future__ import print_function
from datetime import datetime
from os.path import exists, join
from os import listdir
from tempfile import mkdtemp
from cloudbio.deploy.util import eval_template
from boto.exception import S3ResponseError
from boto.s3.key import Key
import yaml
from fabric.api import local, lcd... |
spanish_text = input()
spanish_text = spanish_text.replace(',', '')
spanish_text = spanish_text.replace('.', '')
spanish_text = spanish_text.replace('!', '')
spanish_text = spanish_text.replace('?', '')
spanish_text = spanish_text.lower()
print(spanish_text)
|
# coding: utf-8
"""
Isilon SDK
Isilon SDK - Language bindings for the OneFS API # noqa: E501
OpenAPI spec version: 5
Contact: sdk@isilon.com
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import unittest
import isi_sdk_8_1_0
from i... |
import talos as ta
def test_random_methods():
'''Tests all the available random methods
in reducers/sample_reducer.py that are invoked
that are invoked through Scan(random_method)'''
print('Start testing random methods...')
random_methods = ['sobol',
'quantum',
... |
import os, sys
from cffi import FFI
ffi = FFI()
prefix = {'win32': ''}.get(sys.platform, 'lib')
extension = {'darwin': '.dylib', 'win32': '.dll'}.get(sys.platform, '.so')
dirname = os.path.dirname(__file__)
library_file = os.path.join(dirname + '/../../target/debug/' + prefix + 'corelib' + extension)
header_file = os.... |
# encoding: utf-8
'''CKAN environment configuration'''
import os
import logging
import warnings
from urlparse import urlparse
import pytz
import sqlalchemy
from pylons import config as pylons_config
import formencode
import ckan.config.routing as routing
import ckan.model as model
import ckan.plugins as p
import cka... |
"""
Record Arrays
=============
Record arrays expose the fields of structured arrays as properties.
Most commonly, ndarrays contain elements of a single type, e.g. floats,
integers, bools etc. However, it is possible for elements to be combinations
of these using structured types, such as::
>>> a = np.array([(1, 2... |
"""
Django settings for simple_booking project.
Generated by 'django-admin startproject' using Django 3.2.3.
For more information on this file, see
https://docs.djangoproject.com/en/3.2/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/3.2/ref/settings/
"""
from ... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Copyright 2021 Matthew Wisdom
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice,
# this lis... |
# -*- coding:utf-8 -*-
# ๅฏผๅ
ฅ็ๅบ
import inspect
import json
import time
import requests
from SelfExpection.CustomExpection import CustomExpection
from SelfExpection.OfficialException import OfficialException
from logrecord.WriteLog import WriteLog
class IPLocation:
"""
Class:IPๅฎไฝ
IPๅฎไฝๆฏไธไธช็ฎๅ็... |
from setuptools import setup
setup(
name="tweetstream",
version="1.0.0",
packages=[
"tests",
"tests.unit",
"tests.unit.clients",
"tweetstream",
"tweetstream.utils",
"tweetstream.clients",
"tweetstream.consumers",
"tweetstream.resources",
]... |
#%%
import numpy as np
import matplotlib.pyplot as plt
from numpy import ones,zeros
# %%
plt.rcParams['lines.linewidth'] = 3
plt.rcParams['font.size'] = 20
plt.rcParams['figure.figsize'] = [16,12]
#%%
M = 64
N = M + 1
omega_p = 5
omega_r = 3.5
omega_s = 30
kp = int(np.floor(N*omega_p/omega_s))
print(kp)
print(M//2 -... |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.25 on 2019-10-16 15:14
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('universal_billing_system', '0001_initial'),
]
operations = [
migrations.Al... |
"""Set static variables in impala."""
GAMMA = 0.99
BATCH_SIZE = 512
|
#!/usr/bin/env python
# vim: ai ts=4 sts=4 et sw=4 fileencoding=utf-8
from django.core.management.base import BaseCommand
from django.utils.translation import ugettext_lazy
from onadata.apps.logger.models.attachment import Attachment
from onadata.apps.logger.models.xform import XForm
from onadata.libs.utils.model_too... |
from assertpy import assert_that
import year2017.day18.reader as reader
def test_example():
lines = ['set a 1\n', 'add a 2\n', 'mul a a\n', 'mod a 5\n', 'snd a\n']
result = reader.read_lines(lines)
assert_that(result).is_equal_to(['set a 1', 'add a 2', 'mul a a', 'mod a 5', 'snd a'])
|
# -*- coding: utf-8 -*-
import unittest
from qtconsole.qt import QtCore, QtGui
from qtconsole.qt_loaders import loaded_api, QT_API_PYQT5, QT_API_PYSIDE
from qtconsole.console_widget import ConsoleWidget
from qtconsole.completion_widget import CompletionWidget
import ipython_genutils.testing.decorators as dec
api =... |
# terrascript/resource/josenk/esxi.py
# Automatically generated by tools/makecode.py (24-Sep-2021 15:15:57 UTC)
import terrascript
class esxi_guest(terrascript.Resource):
pass
class esxi_portgroup(terrascript.Resource):
pass
class esxi_resource_pool(terrascript.Resource):
pass
class esxi_virtual_dis... |
#
# Copyright (C) 2014 Red Hat, 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... |
"""
You are given a string s and an integer k, a k duplicate removal consists of choosing k adjacent and equal letters from s and removing them, causing the left and the right side of the deleted substring to concatenate together.
We repeatedly make k duplicate removals on s until we no longer can.
Return the final st... |
from jsonrpc import ServiceProxy
access = ServiceProxy("http://127.0.0.1:9335")
pwd = raw_input("Enter wallet passphrase: ")
access.walletpassphrase(pwd, 60)
|
from pathlib import Path
# colt settings
DEFAULT_COLT_SETTING = {
"typekey": "type",
}
# pdpcli directory settings
PDPCLI_ROOT = Path.home() / ".pdpcli"
# plugin settings
LOCAL_PLUGINS_FILENAME = ".pdpcli_plugins"
GLOBAL_PLUGINS_FILENAME = PDPCLI_ROOT / "plugins"
|
# 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 use ... |
lanche = ('Hambรบrguer', 'Suco', 'Pizza', 'Pudim', 'Batata-Frita')
#lanche recebe 0 , 1 , 2 , 3 , 4
for comida in lanche:
print(f'Eu vou comer {comida}') # Neste aqui nรฃo tem como mostrar a posiรงรฃo
print()
for cont in range(0, len(lanche)):
print(f"Eu vou comer {lanche[cont]} na posiรง... |
#!/usr/bin/python3
import sys, os, os.path, re, json
import math, random
PRONOUNS = [
"yo", "tรบ", "รฉl/ella/usted", "nosotros", "vosotros", "ellos/ellas/ustedes"
]
BLANK_COUNT = 20
BLANK = "_" * BLANK_COUNT
N_REPS = 3
def generate_worksheet_data(dst, infinitives):
problems = [ [] for z in range(N... |
from montreal_forced_aligner.command_line.validate import run_validate_corpus
class ValidatorDummyArgs(object):
def __init__(self):
self.temp_directory = None
self.test_transcriptions = False
self.num_jobs = 0
self.speaker_characters = 0
self.ignore_acoustics = False
... |
# This code is part of Qiskit.
#
# (C) Copyright IBM 2021, 2022.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
#
# Any modifications or derivat... |
# File sets up the django environment, used by other scripts that need to
# execute in django land
import os
import django
from django.conf import settings
APP_NAME = "crawfish"
BASE_DIR = os.path.abspath(os.path.join(os.path.dirname(__file__), APP_NAME))
MIDDLEWARE = [
"django.contrib.sessions.middleware.Sessio... |
from copy import deepcopy
import attr
import re
import py
import pycparser
from pycparser import c_ast
from pycparser.c_generator import CGenerator
PUBLIC_API_H = py.path.local(__file__).dirpath('public_api.h')
def toC(node):
return toC.gen.visit(node)
toC.gen = CGenerator()
def find_typedecl(node):
while n... |
# Copyright 2009-present MongoDB, 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 to in wri... |
# -*- coding: utf-8 -*-
'''
Module to provide RabbitMQ compatibility to Salt.
Todo: A lot, need to add cluster support, logging, and minion configuration
data.
'''
# Import bonneville libs
from bonneville import exceptions, utils
# Import python libs
import logging
log = logging.getLogger(__name__)
def __virtual__... |
from bitcoding import DC, EC, PO, TPP, NTPP, TPPI, NTPPI, EQ, DALL
from baserels import B
# translate a base relation from integer to its string representation
def translate(BR):
if BR == DC:
return 'DC'
if BR == EC:
return 'EC'
if BR == PO:
return 'PO'
if BR == TPP:
return... |
from .inventory_base import InventoryBaseModel
from stats_arrays import uncertainty_choices
import numpy as np
class KroneckerDelta(InventoryBaseModel):
"""A model that choose only one input from multiple possibilities at each iteration. All other possible inputs are set to zero. See `Kronecker delta functions <h... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import numpy as np
#
# Funciรณn singleton(x, x0): funciรณn de pertenencia singleton.
# Argumentos:
# x: int, float, numpy.ndarray
# Contiene los valores de x en el universo de discurso
# para los cuales se evalรบa su valor de pertenencia.
# x0: valor de refere... |
from lxml import html
import requests
from html2dict.resources import *
__all__ = [
'TableExtractor',
'Table',
'get_text_content',
'is_header'
]
class TableExtractor(object):
"""Html to dictionaries extractor class
This is the skeleton Extractor class.
Attributes:
html_string (s... |
#!/usr/bin/env python3
import os
import re
base_path = os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))
config_h = os.path.join(base_path, 'include', 'spdlog', 'version.h')
data = {'MAJOR': 0, 'MINOR': 0, 'PATCH': 0}
reg = re.compile(r'^\s*#define\s+SPDLOG_VER_([A-Z]+)\s+([0-9]+).*$')
with open(config_... |
# coding=utf-8
"""
https://www.sojson.com/api/lunar.html
ๆๅฎๆฅๆ็่ๅๆฅๅไธๅนดๅไฟกๆฏ
"""
from datetime import datetime
import requests
from everyday_wechat.utils.common import (
WEEK_DICT,
SPIDER_HEADERS
)
__all__ = ['get_sojson_calendar']
def get_sojson_calendar(date=''):
"""
่ทๅๆๅฎๆฅๆ็่ๅๆฅๅไธๅนดๅไฟกๆฏ
https://www.so... |
from django.urls import path
from order.views import *
urlpatterns = [
path('place', OrderPlaceView.as_view(), name='place'), # ๆไบค่ฎขๅ้กต้ขๆพ็คบ
path('commit', OrderCommitView.as_view(), name='commit'), # ่ฎขๅๅๅปบ
path('pay', OrderPayView.as_view(), name='pay'), # ่ฎขๅๆฏไป
path('check', CheckPayView.as_view(), name=... |
import os
from flask import Flask
from flask.json import JSONEncoder
from flask_sqlalchemy import SQLAlchemy
from flask_login import LoginManager
from flask_openid import OpenID
from flask_mail import Mail
from flask_babel import Babel, lazy_gettext
from config import ADMINS, MAIL_SERVER, MAIL_PORT, MAIL_USERNAME, \
... |
'''
EXAMPLE:
records = [["chi",20.0],["beta",50.0],["alpha",50.0]]
The ordered list of scores is [20.0 , 50.0], so the second lowest score is 50.0.
There are two students with that score:["beta" , "alpha"] . Ordered alphabetically, the names are printed as:
alpha
beta
'''
CODE:
# Will save the variables f... |
#!/usr/bin/env python3
import os
from collections import defaultdict
from functools import partial
from pprint import pprint
def cache(fn):
def inner(*args, **kwargs):
return fn(*args, **kwargs)
return inner
def not_implemented(fn):
def inner(*args, **kwargs):
print("%s not implemented" % ... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Jul 28 14:02:57 2020
fpqSegmentLengthHist
plots a histogram of segment lengths, from an input file of x,y nodes
input:
name of ascii text file of x,y nodes
options:
-Bn, number of bins
@author: davidhealy
"""
import fracpaq as fpq
... |
""" A FrontendWidget that emulates the interface of the console IPython and
supports the additional functionality provided by the IPython kernel.
TODO: Add support for retrieving the system default editor. Requires code
paths for Windows (use the registry), Mac OS (use LaunchServices), and
... |
# Licensed to the .NET Foundation under one or more agreements.
# The .NET Foundation licenses this file to you under the Apache 2.0 License.
# See the LICENSE file in the project root for more information.
'''
Various method signatures to override.
'''
import unittest
from iptest import IronPythonTestCase, run_test... |
from django.contrib import admin
from .models import Post
from comment.models import Comment
class CommentInline(admin.StackedInline):
model = Comment
class PostAdmin(admin.ModelAdmin):
def post_comment_count(self, obj):
return Comment.objects.filter(post=obj).count()
post_comment_count.short... |
import json
import re
from verspec.loose import LooseVersion as Version
def _ensure_version(version):
if not isinstance(version, Version):
return Version(version)
return version
def _version_pair(version):
return _ensure_version(version), str(version)
class VersionInfo:
def __init__(self, ... |
#!/usr/bin/python
# -*- coding:utf-8 -*-
# @author : east
# @time : 2020/7/27 21:49
# @file : run.py.py
# @project : SpectralMethod
# @software : PyCharm
import numpy as np
from scipy.integrate import solve_ivp
import matplotlib.pyplot as plt
from rkm.erk import erk
from rkm.plot import imshow_2d, imshow_s... |
#
# Copyright (c) 2021 Airbyte, Inc., all rights reserved.
#
from unittest.mock import MagicMock
from source_rickymorty_http.source import SourceRickymortyHttp
def test_check_connection(mocker):
source = SourceRickymortyHttp()
logger_mock, config_mock = MagicMock(), MagicMock()
assert source.check_conne... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import logging
import iTOL
import os
import time
logger = logging.getLogger('[iTOL]')
formatter = logging.Formatter('%(asctime)s %(levelname)s %(name)s %(message)s', datefmt='%Y-%m-%d %H:%M:%S')
logger.setLevel(logging.INFO)
fh = logging.FileHandler('connection.log')
fh... |
#python model.py car_racing --filename ./controller/car_racing.cma.4.32.best.json --render_mode --record_video
#xvfb-run -a -s "-screen 0 1400x900x24" python model.py car_racing --filename ./controller/car_racing.cma.4.32.best.json --render_mode --record_video
import numpy as np
import random
import json
import sys
i... |
# Copyright (c) 2017 Mark D. Hill and David A. Wood
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met: redistributions of source code must retain the above copyright
# notice, this list of conditio... |
# -*- coding: utf-8 -*-
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'LinkCategory'
db.create_table(u'links_linkcategory', (
... |
# https://dmoj.ca/problem/ccc06s2
# https://dmoj.ca/submission/2225729
import sys
cipher = {}
plaintext = sys.stdin.readline()[:-1]
ciphertext = sys.stdin.readline()[:-1]
for i in range(len(ciphertext)):
cipher[ciphertext[i]] = plaintext[i]
message = sys.stdin.readline()[:-1]
for i in message:
try:
pri... |
#
# 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 us... |
# Copyright (c) 2011 OpenStack Foundation
# 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 ... |
print("Enter the list of numbers to be sorted:")
s=input()
if(s[-1]==" "):
s=s[0:len(s)-1:1]
s=list(map(int,s.split(" ")))
#MERGE SORT
def merge(a,b,c):
k=0
i=0
j=0
while(len(a)>i and len(b)>j):
if(a[i]>=b[j]):
c[k]=b[j]
j+=1
else:
c[k]=a[i]
i+=1
k+=1
while(len(a)>i):
c[k]=a[i]
k+=1
i+=1
... |
# 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 use ... |
from __future__ import annotations
import numpy as np
from PyQt6.QtGui import QPen, QKeyEvent
from PyQt6.QtCore import pyqtSignal
from pyqtgraph.GraphicsScene.mouseEvents import MouseClickEvent
from .linkaxes import linkAxes
from .plot import *
from .roi import PolygonROI
from ..cluster.item import ClusterItem
# no... |
from handler import Handler
import urllib2
from xml.dom import minidom
from DB_Models import Utilisateur
from google.appengine.ext import db
import json
class AdmistrationHandler(Handler):
def get(self):
#db.GqlQuery("DELETE * FROM Professeur")
#db.GqlQuery("DELETE * FROM Etudiant")
cook... |
"""
Funds API For Digital Portals
Search for mutual funds and ETFs using one single consolidated API, including a criteria-based screener. The API provides also base data, key figures, and holdings. A separate endpoint returns the possible values and value range for the parameters that the endpoint /fund/nota... |
import random
import hashlib
challengelen = 2
chain = []
def mine(lastblock, txns):
hash = '1'*challengelen
nonce = 0
while hash[:challengelen] != '0'*challengelen:
hash = hashlib.md5(lastblock[4] + '|' + txns + '|' + str(nonce)).digest()
nonce += 1
#print(txns, nonce, hash[:challengelen])
return (lastblo... |
from . import filters
Filter = filters.Filter
DownloadButton = filters.DownloadButton
ConditionalButton = filters.ConditionalButton
SliderInput = filters.SliderInput
SelectButton = filters.SelectButton
ApiButton = filters.ApiButton
DynamicTextInput = filters.DynamicTextInput
ReactSelect = filters.ReactSelect
|
# encoding: utf-8
"""
Classes defined in backtest module are responsible to run backtests.
They follow a fix procedure, from loading data to looping through
data and finally save backtest results.
"""
from __future__ import print_function, unicode_literals
import six
import abc
from collections import defaultdict
im... |
# -*- coding: utf-8 -*-
import base64
import contextlib
import functools
import glob
import json
import io
import os
import os.path
import re
import shutil
import subprocess
import sys
import tempfile
import traceback
import unittest
import pytest
from six import StringIO, b, string_types, text_type
from werkzeug.tes... |
#!/usr/bin/env python
import codecs
import os
from typing import List
from setuptools import setup
def read(fname):
file_path = os.path.join(os.path.dirname(__file__), fname)
return codecs.open(file_path, encoding="utf-8").read()
install_requires: List[List[str]] = []
install_requires += (["dataclasses;py... |
#!/usr/bin/python
# -*- coding: UTF-8 -*
from utils.smtp_helper import notify_approvers
from utils.api_version_verify import api_version
import traceback
from flask import request
from flask_restful import Resource
from core.governance_singleton import governance_singleton
from utils.status_code import response_code
f... |
# -*- coding: utf-8 -*-
###########################################################################
# Copyright (c), The AiiDA team. All rights reserved. #
# This file is part of the AiiDA code. #
# ... |
"""
A Trainable ResNet Class is defined in this file
Author: Kaihua Tang
"""
import math
import numpy as np
import tensorflow as tf
from functools import reduce
from configs import configs
class ResNet:
# some properties
"""
Initialize function
"""
def __init__(self, ResNet_npy_path=None,... |
from django.contrib.auth.mixins import LoginRequiredMixin
from django.core import serializers
from django.http import HttpResponse
from django.urls import reverse_lazy
from django.views.generic import CreateView, ListView, DetailView
from django.views.generic.edit import UpdateView
from .models import Entry, Proposal, ... |
import numpy as np
import matplotlib.pyplot as plt
def generate_policy(probs, max_period):
num_choices = 2
max_streak = max_period
num_states = max_streak + 1
## Get array of choices and possible states
max_streaks = np.array(range(0, num_states))
streaks = np.array(range(0, num_states))
... |
#!/usr/bin/python3 -u
import sys, os
import signal
from threading import Thread
from select import select, epoll, EPOLLPRI
from functools import partial
from collections import namedtuple
from argparse import ArgumentParser
import traceback
sys.path.insert(1, os.path.join(os.path.dirname(__file__), 'ext', 'velib_pytho... |
# 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 ... |
"""
RESTful Email API
"""
from django.conf import settings
from django.template.loader import render_to_string
from django.template import Context
from rest_framework.response import Response
from rest_framework.viewsets import ViewSet
from rest_framework import status
from api import permissions
from api.v2.except... |
# stdlib
from typing import Optional
from typing import Union
# third party
from nacl.signing import SigningKey
from nacl.signing import VerifyKey
# syft relative
from ....decorators.syft_decorator_impl import syft_decorator
from ...common.message import SignedMessage
from ...common.message import SyftMessage
from ..... |
from django.db import models
from django.contrib.auth.models import User
from django_extensions.db.models import TimeStampedModel
class Feedback(TimeStampedModel):
user = models.ForeignKey(User, on_delete=models.CASCADE)
feedback_message = models.TextField()
def __str__(self):
return self.feedbac... |
# encoding: UTF-8
import vtConstant
from ctpGateway import CtpGateway as gateway
gatewayName = 'CTP'
gatewayDisplayName = gatewayName
gatewayType = vtConstant.GATEWAYTYPE_FUTURES
gatewayQryEnabled = True
|
# coding=utf-8
"""apyfal._utilities tests"""
import time
import pytest
import requests
def test_timeout():
"""Tests Timeout"""
from apyfal._utilities import Timeout
# Should not timeout
with Timeout(timeout=1, sleep=0.001) as timeout:
while True:
assert not timeout.reached()
... |
from ..apibits import *
from ..endpoints import UsersEndpoint
class User(ApiResource):
@classmethod
def all(cls, params={}, headers={}):
res = cls.default_client().users().all(params, headers)
return res
@classmethod
def retrieve(cls, user_id, params={}, headers={}):
res = cls... |
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ##
#
# See COPYING file distributed along with the PyMVPA package for the
# copyright and license terms.
#
### ### ### ### ###... |
# -*- coding: utf-8 -*-
"""
Starter code for the controls project.
This is the solution of the backyard flyer script,
modified for all the changes required to get it working for controls.
"""
import time
from enum import Enum
import numpy as np
from udacidrone import Drone
from unity_drone import UnityDrone
from con... |
from typing import *
from cognite.client.data_classes._base import CognitePropertyClassUtil
# GenPropertyClass: EpochTimestampRange
class TimestampRange(dict):
"""Range between two timestamps.
Args:
max (int): The number of milliseconds since 00:00:00 Thursday, 1 January 1970, Coordinated Universal ... |
from user.factories import UserFactory
from django.test import TestCase
class UserModelTestCase(TestCase):
def setUp(self):
self.user = UserFactory(username='testuser1', password='12345')
self.other_user = UserFactory(username='testuser2', password='12345')
def test_get_absolute_url(self):
... |
#!/usr/bin/env python
"""Implement low level disk access using the sleuthkit."""
import stat
import pytsk3
from grr.client import client_utils
from grr.client import vfs
from grr.lib import rdfvalue
from grr.lib import utils
class CachedFilesystem(object):
"""A container for the filesystem and image."""
def... |
# Demonstrate the use of keyword-only arguments
# use keyword-only arguments to help ensure code clarity
def myFunction(a, b, *, exception=False):
pass
def main():
# try to call the function without the keyword
myFunction(1, 2, True)
if __name__ == "__main__":
main()
|
import sys
import time
class Log:
@staticmethod
def log(msg):
print(time.strftime("%d/%m/%Y %H:%M:%S") + ": " + str(msg))
@staticmethod
def log_ex(context):
ex_info = sys.exc_info()
ex_type = ""
ex_msg = ""
if len(ex_info) > 1:
ex_type = ex_info[0... |
"""Model Parameter - Fusion 360 addin to add a button that will let you construct a model parameter from a value type."""
__version__ = '0.1.0'
__author__ = 'Shawn Hice <shawn.hice@autodesk.com>'
__all__ = [] |
# -*- coding: utf-8 -*-
from django.conf import settings
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('push_notifications', '0004_fcm'),
]
operations = [
migrations.AddField(
model_name='apnsdevice',
name='appli... |
# The Expat License
#
# Copyright (c) 2020, Shlomi Fish
#
# 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, ... |
# Sample code for calculating the focal length of a camera, based on a known
# size, distance, and color range (for isolating the target in the image).
# import the necessary packages
import numpy as np
import cv2
import sys
# If "showImage" is True, then we'll pop up a masked-out version of the
# image, showing the ... |
'''
Tests for metadatatoph5
'''
import os
import sys
import unittest
from obspy.core import inventory
from obspy import UTCDateTime
from mock import patch
from testfixtures import OutputCapture
from ph5.utilities import metadatatoph5
from ph5.core.tests.test_base import LogTestCase, TempDirTestCase,\
initialize_e... |
_item_fullname_='openmm.System'
def is_openmm_System(item):
item_fullname = item.__class__.__module__+'.'+item.__class__.__name__
return _item_fullname_==item_fullname
|
"""Training GCMC model on the MovieLens data set.
The script loads the full graph to the training device.
"""
import os, time
import argparse
import logging
import random
import string
import numpy as np
import torch as th
import torch.nn as nn
from data import MovieLens
from model import BiDecoder, GCMCLayer
from uti... |
import errno
import math
import librosa
import numpy as np
import scipy.signal
import tempfile
import os
import shutil
import multiprocessing
from multiprocessing import Pool
import subprocess
import sys
import argparse
from pathlib import Path
from PIL import Image
from PIL import ImageChops
### Tunable values ###
... |
# MIT LICENSE
#
# Copyright 1997 - 2020 by IXIA Keysight
#
# 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,... |
#!/usr/bin/python
################################################################################
# PIP INSTALL CHERRYPY
#
# Justin L. Dierking
# justin.l.dierking.civ@mail.mil
# 614 692 2050
#
# 09/07/2017 Original Construction
################################################################################
import t... |
from random import choice, randint
ARTICLES = ('the', 'a', 'an', 'one')
SUBJECTS = ('cat', 'dog', 'man', 'woman', 'aligator', 'emu', 'iguana',
'octopus', 'urial')
VERBS = ('sang', 'ran', 'jumped')
ADVERBS = ('loudly', 'quietly', 'well', 'badly')
VOWELS = ('a', 'e', 'i', 'o', 'u')
def get_words():
wor... |
# -*- coding: iso-8859-1 -*-
from __future__ import print_function, division
import sys
if( sys.version_info[0] == 2 ):
range = xrange
import math
import qm3.fio
import qm3.maths.matrix
#
# J. Comput. Chem. v35, p1672 (2014) [10.1002/jcc.23673]
# J. Phys. Chem. A v121, p9764 (2017) [10.1021/acs.jpca.7b10842]
# W... |
import copy
from datetime import datetime
import pandas as pd
import pytest
from ..testing_utils import make_ecommerce_entityset
from featuretools import Relationship
@pytest.fixture
def entityset():
return make_ecommerce_entityset()
@pytest.fixture
def values_es(entityset):
new_es = copy.deepcopy(entity... |
import numpy as np
import utils
class Agent:
# ์์ด์ ํธ ์ํ๊ฐ ๊ตฌ์ฑํ๋ ๊ฐ ๊ฐ์
STATE_DIM = 2 # ์ฃผ์ ๋ณด์ ๋น์จ, ํฌํธํด๋ฆฌ์ค ๊ฐ์น ๋น์จ
# ๋งค๋งค ์์๋ฃ ๋ฐ ์ธ๊ธ
TRADING_CHARGE = 0.00015 # ๊ฑฐ๋ ์์๋ฃ 0.015%
# TRADING_CHARGE = 0.00011 # ๊ฑฐ๋ ์์๋ฃ 0.011%
# TRADING_CHARGE = 0 # ๊ฑฐ๋ ์์๋ฃ ๋ฏธ์ ์ฉ
TRADING_TAX = 0.0025 # ๊ฑฐ๋์ธ 0.25%
... |
import csv
from datetime import datetime
from datetime import timedelta
import time
from cumulusci.core.exceptions import TaskOptionsError
from cumulusci.core.exceptions import CumulusCIException
from cumulusci.core.exceptions import PushApiObjectNotFound
from cumulusci.tasks.push.push_api import SalesforcePushApi
from... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.