text stringlengths 1 927k |
|---|
import multiprocessing
import os
import sys
import unittest
import threading
from descarteslabs.common.threading.local import ThreadLocalWrapper
class ThreadLocalWrapperTest(unittest.TestCase):
def setUp(self):
self.wrapper = ThreadLocalWrapper(
lambda: (os.getpid(), threading.current_thread(... |
# 这个程序开始即代表进入清洁模式
class cleaner(object):
'''Create this class to give a cleaning mode to the program.
Attribute:
__is_cleaning: A protected attribute refers to the status of cleaning mode.
'''
def __init__(self):
self.__is_cleaning = False #定义了一个私有属性
def is_cleanning_work_on... |
'''
Based on a set of search parameters the script will create a query
on www.scihub.copernicus.eu and return the results either
as shapefile, sqlite, or write to a PostGreSQL database.
------------------
Usage
------------------
python3 search.py -a /path/to/aoi-shapefile.shp -b 2018-01-01 -e 2018-31-12
... |
import numpy as np
import matplotlib.pyplot as plt
import sys
sys.path.append('../../core')
from imgutils import *
class xor(object):
"""
Class that creates a xor dataset. Note that for the grading of the project, this method
might be changed, although it's output format will not be. This implies we migh... |
from collections import defaultdict
import csv
from logging import Logger
import logging
import os
import sys
from typing import Callable, Dict, List, Tuple
import numpy as np
import pandas as pd
from .run_training import run_training
from chemprop.args import TrainArgs
from chemprop.constants import TEST_SCORES_FILE... |
from math import sqrt
from collections import namedtuple
import numpy as np
import pyopencl.array as parray
from os import path
from multiprocessing import cpu_count
from ..utils import nextpow2, updiv, get_opencl_srcfile, get_next_power
from .common import OpenclCorrelator, BaseCorrelator
from silx.math.fft.fftw impo... |
# Generated by Django 3.1.1 on 2021-10-18 12:09
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('me2ushop', '0155_auto_20211018_1401'),
]
operations = [
migrations.AddField(
model_name='productcustomizations',
nam... |
"""
Functions for manipulating FGONG files.
"""
import numpy as np
from tomso.common import integrate, DEFAULT_G
from tomso.adipls import fgong_to_amdl
def load_fgong(filename, N=-1, return_comment=False):
"""Given an FGONG file, returns NumPy arrays `glob` and `var` that
correspond to the scalar and point-w... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.response.AlipayResponse import AlipayResponse
class AlipaySocialGiftOrderRefundResponse(AlipayResponse):
def __init__(self):
super(AlipaySocialGiftOrderRefundResponse, self).__init__()
self._order_id = None
@prope... |
#!/usr/bin/env python3
# Copyright (c) 2016-2018 The Zenacoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Specialized SipHash-2-4 implementations.
This implements SipHash-2-4 for 256-bit integers.
"""
def r... |
"""This piece of software was last updated on 26-August-2020 at 18:52 IST.
Pull requests are always welcomed"""
from pywhatkit.mainfunctions import watch_tutorial_in_English, watch_tutorial_in_Hindi, developer_contact, showHistory, shutdown, cancelShutdown, prnt_sleeptm, check_window, sendwhatmsg, info, playonyt, imag... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from datetime import datetime
from django.contrib import admin
from notification.models import MobileDevice
class MobileDeviceAdmin(admin.ModelAdmin):
list_display = ['id', 'user', 'app', 'token', 'device_id', 'active']
list_filter = ['app', '... |
import os
import numpy as np
import pandas as pd
def compare_data(test,
compare_path='/home/isakev/challenges/viral_tweets/data/processed/a_test_data_lgb_NoImpute_NoOhe_jun23.csv'):
print("preprocessed path:\n", compare_path)
# print("cfg.test_preprocessed_path\n:", cfg.test_preprocessed_path)... |
import microbit as mbit
def main():
# TODO: Your code here...
mbit.display.show(mbit.Image.HAPPY)
if __name__ == '__main__':
main() |
# Generated by Django 3.2.8 on 2021-11-21 19:01
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='SavingApplication',
fields=[
('id', models.... |
#!/usr/bin/env python
import os
import sys
import glob
import math
import uuid
import shutil
import pathlib
import argparse
import numpy as np
import pandas as pd
import geopandas as gpd
import skimage
import torch
import tqdm
import gdal
import solaris as sol
import model
def makeemptyfolder(path):
"""
Cre... |
import asyncio
from mpf.platforms.rpi import rpi
from mpf.tests.MpfTestCase import MpfTestCase
class MockApigpio():
# gpio Pull Up Down
PUD_OFF = 0
PUD_DOWN = 1
PUD_UP = 2
# gpio modes
INPUT = 0
OUTPUT = 1
# gpio edges
RISING_EDGE = 0
FALLING_EDGE = 1
EITHER_EDGE = 2... |
"""
This module defines exporters for the SWF fileformat.
"""
from __future__ import absolute_import
from __future__ import division
from builtins import map
from builtins import chr
from builtins import str
from builtins import range
from past.utils import old_div
from builtins import object
from .consts import *
from... |
# 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... |
from consul_kv import map_dictionary
from tests.testcase import TestCase
class TestMapDictionary(TestCase):
def setUp(self):
self.dictionary = {
'some': {'key': 'and', 'some': 'values'},
'with': {
'some': {'other': 'keys'},
'and': {'some': 'other', '... |
#!/usr/bin/env python3
# Copyright 2014 BitPay Inc.
# Copyright 2016-2017 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test framework for pricecoin utils.
Runs automatically during `make check`.
... |
from django.shortcuts import redirect
from django.views import View
from django.http import HttpRequest, HttpResponse, HttpResponseRedirect
from django.contrib.auth import login, logout, authenticate
from django.utils import timezone
from tracker.models import DiscordUser
from config.environment import DISCORD_OAUTH_RO... |
import ccxt
import pprint
with open("../api.txt") as f:
lines = f.readlines()
api_key = lines[0].strip()
secret = lines[1].strip()
binance = ccxt.binance(config={
'apiKey': api_key,
'secret': secret,
'enableRateLimit': True,
'options': {
'defaultType': 'future'
}
})
markets... |
import collections
import sys
from selenium import webdriver
from seleniumbase.__version__ import __version__
from seleniumbase.common import decorators # noqa
from seleniumbase.common import encryption # noqa
from seleniumbase.core.browser_launcher import get_driver # noqa
from seleniumbase.fixtures import js_utils... |
import unittest
from survey import AnonymousSurvey
class TestAnonymousSurvey(unittest.TestCase):
"""Tests for the class AnonymousSurvey"""
def setUp(self):
"""
Create a survey and a set of responses for use in all test methods.
"""
question = "What language did you first le... |
"""update authorisation view
Revision ID: 9b3cd480fa3b
Revises: a930f64458f6
Create Date: 2020-03-09 19:02:58.716934
"""
from alembic import op
import sqlalchemy as sa
from auth_api.utils.custom_sql import CustomSql
# revision identifiers, used by Alembic.
revision = '9b3cd480fa3b'
down_revision = 'a930f64458f6'
bra... |
from abc import ABC
from typing import List, Union
from dataclasses import dataclass
from tools.codegen.context import method_with_native_function
from tools.codegen.model import BackendIndex, NativeFunction, NativeFunctionsGroup
from tools.codegen.api.types import (
BaseCType,
OptionalCType,
VectorCType,
... |
from router.bcrouter import app
if __name__ == '__main__':
app.run(host='0.0.0.0', port=5000) |
# coding: utf-8
# Copyright (c) Materials Virtual Lab
# Distributed under the terms of the BSD License.
import os
import shutil
import unittest
import tempfile
import numpy as np
from pymatgen.core import Structure
from monty.os.path import which
from monty.serialization import loadfn
from maml.apps.pes import GAPote... |
# Copyright (c) 2010-2012 OpenStack Foundation
#
# 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... |
import socket
import struct
from datetime import timezone, datetime
UDP_IP = "127.0.0.1"
UDP_PORT = 3869
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
# Setup the communication using "timestamp = 0"
smsg = struct.pack('<Qcffffff', 0, b'h', 0, 0, 0, 0, 0, 0)
sock.sendto(smsg, (UDP_IP, UDP_PORT))
smsg = struc... |
##################################################
# NetworkService_services.py
# generated by ZSI.generate.wsdl2python
##################################################
from NetworkService_services_types import *
import urlparse, types
from ZSI.TCcompound import ComplexType, Struct
from ZSI import client
import Z... |
# Copyright The Linux Foundation and each contributor to CommunityBridge.
# SPDX-License-Identifier: MIT
from cla.models.dynamo_models import Event, User, Project, Company
from cla.models import event_types
from unittest.mock import patch, Mock
import pytest
import datetime
import cla
import time
@pytest.fixture()
d... |
import datetime
import os
import string
from celery import Celery
import praw
import prawcore
from textblob import TextBlob
from django.core.cache import cache
from .helpers import *
from .models import *
app = Celery('tasks')
app.config_from_object('django.conf:settings')
reddit = praw.Reddit(client_id=os.environ['P... |
# Generated by Django 2.1.7 on 2020-02-03 18:09
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('jobsapp', '0007_job_salary'),
]
operations = [
migrations.AddField(
model_name='job',
name='experience',
... |
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import Variable
from torch_geometric.nn import GCNConv, GATConv
from torch_geometric.nn.conv import MessagePassing
from torch_geometric.nn.inits import glorot, uniform
from torch_geometric.utils import softmax
import math
class HGTC... |
from random import randint
from time import sleep
print('-=-' * 22)
print('-=- I will think in a number between 0 and 5. Try to guess... -=-')
print('-=-' * 22)
n = int(input('What number I thought? '))
r = randint(0, 5)
print('PROCESSING...')
sleep(2)
if n == r:
print('CONGRATULATIONS! You won!')
else:
pr... |
"""Select2 view implementation."""
import json
from dal.views import BaseQuerySetView
from django import http
from django.utils.translation import ugettext as _
class Select2ViewMixin(object):
"""View mixin to render a JSON response for Select2."""
def get_results(self, context):
"""Return data fo... |
import re
import logging
from lxml import etree
import spacy
logger = logging.getLogger(__name__)
class CorpusBase:
def __init__(self):
pass
class TimeBankBase(CorpusBase):
def __init__(self):
super(TimeBankBase, self).__init__()
self.nlp = None
def _get_sent_tok_idx(self, se... |
"""
WSGI config for Solar project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/2.2/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault('DJANGO_SETTING... |
import sqlite3
import re
conn = sqlite3.connect('orgdb.sqlite')
cur = conn.cursor()
cur.execute('''
DROP TABLE IF EXISTS Counts''')
cur.execute('''
CREATE TABLE Counts (org TEXT, count INTEGER)''')
fname = raw_input('Enter file name: ')
if (len(fname) < 1):
fname = 'mbox-short.txt'
fh = open(fname)
for line in ... |
import dash
import dash_core_components as dcc
import dash_html_components as html
import pandas as pd
import plotly.graph_objs as go
import matplotlib
from matplotlib import cm
import numpy as np
linecolours = ['rgba(0,114,178,1.)', 'rgba(230,159,0,1.)']
magma_cmap = cm.get_cmap('magma')
magma_rgb = []
norm = mat... |
# Generated by Django 3.0.7 on 2020-07-27 21:38
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('segint_api', '0025_auto_20200727_2125'),
]
operations = [
migrations.AddField(
model_name='mode... |
# Copyright (c) 2012 The Regents of The University of Michigan
# 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 ... |
from openpyxl import load_workbook
import re
filename = 'aalh_iit_industry_001.xlsx'
wb = load_workbook(filename)
ws = wb['Metadata Template']
minimumcol = 2
maximumcol = 2
minimumrow = 7
maximumrow = 472
iterationrow = 7
titlecol = 2
desccol = 8
subcol = 9
placecol = 13
timeperiodcol = 14
dateoforigcol = 15
isodate... |
#part1
# Sort homelessness by individual
homelessness_ind = homelessness.sort_values("individuals")
homelessness_ind.head()
# Print the top few rows
print(homelessness_ind.head())
#part2
# Sort homelessness by descending family members
homelessness_fam = homelessness.sort_values("family_members", ascending=False)
... |
# Generated by Django 2.2.6 on 2019-12-17 16:11
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('question_lib', '0002_auto_20191216_2020'),
]
operations = [
migrations.AlterField(
model_name='questionlib',
name='a... |
import datetime
import io
import os
import pathlib
import typing
import inspect
import asyncio
from ..crypto import AES
from .. import utils, helpers, errors, hints
from ..requestiter import RequestIter
from ..tl import TLObject, types, functions
try:
import aiohttp
except ImportError:
aiohttp = None
if typ... |
import os
import unittest
from pulsar import send
from pulsar.apps.test import ActorTestMixin
from pulsar.utils.tools import Pidfile
from pulsar.utils.system import platform
@unittest.skipUnless(platform.type != 'win', 'This fails in windows')
class TestPidfile(ActorTestMixin, unittest.TestCase):
concurrency = '... |
# coding: utf-8
"""
Kubernetes
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
OpenAPI spec version: v1.14.1
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from pprint import pformat
from six import iteritems
import re... |
# Original Code here:
# https://github.com/pytorch/examples/blob/master/mnist/main.py
from contextlib import contextmanager
import os
import logging
import shutil
import tempfile
import torch
from datetime import timedelta
import ray
from ray import tune
from ray.tune.result import RESULT_DUPLICATE
from ray.tune.logge... |
from random import randint
from django.conf import settings
from django.contrib.auth import get_user_model
# Create your views here.
from rest_framework import status
from rest_framework.permissions import AllowAny
from rest_framework.response import Response
from rest_framework.views import APIView
from twilio.rest i... |
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
from dataclasses import dataclass
from typing import Optional
from hydra.core.config_store import ConfigStore
from hydra.types import ObjectConf
from omegaconf import II
@dataclass
class RedisConf:
# host address via REDIS_HOST environment va... |
import metrics
import jax.numpy as np
import pandas as pd
class MCMCMetrics:
def __init__(self, result, true_posterior):
chains = result.get_final_chain()
self.samples, self.dim, self.num_chains = chains.shape
self.epsilon = result.epsilon
self.delta = result.delta
self.ind... |
from flask import Flask, request, render_template, flash, redirect, url_for, session, logging
from wtforms import Form, StringField, TextAreaField, PasswordField, validators
from passlib.hash import sha256_crypt
from flask_mysqldb import MySQL
from functools import wraps
app = Flask(__name__)
# MySQL Configuration
a... |
"""
Requirements file parsing
"""
import optparse
import os
import re
import shlex
import urllib.parse
from pip._internal.cli import cmdoptions
from pip._internal.exceptions import InstallationError, RequirementsFileParseError
from pip._internal.models.search_scope import SearchScope
from pip._internal.network.utils ... |
import io
from math import ceil
from typing import Optional
from google.cloud.storage.blob import Blob
from gs_chunked_io.config import default_chunk_size, reader_retries
from gs_chunked_io.async_collections import AsyncSet, AsyncQueue
_BLOB_CHUNK_SIZE_UNIT = 262144
class Reader(io.IOBase):
"""
Readable st... |
# 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
from... |
import configparser
import requests
import imap_errors
import json
class SlackPoster():
def __init__(self):
# Hueee
config = configparser.ConfigParser()
config.read('../slacknotify_envsettings.ini')
self.config = config
def post(self, channelId, iconURL=None, username=None, ts... |
#!/usr/bin/env python3
#####################################################################################################################
#
# Copyright (c) 2020 Bernhard Flühmann. All rights reserved.
#
# This work is licensed under the terms of the MIT license.
# For a copy, see <https://opensource.org/licenses... |
import timeit
import pickle
import os
import errno
import datetime
import shutil
import warnings
import traceback
import pstats
import io
import sys
import gc
import inspect
import importlib
import re
import pathlib
import types
import operator
import subprocess
import shlex
import json
import contextlib
import stat
im... |
from .bounded_image_cropper import BoundedImageCropper
from .image_masker import ImageMasker
from .gaussian_noise_generator import GaussianNoiseGenerator
from .image_extender import ImageExtender
from .shape_orientator import ShapeOrientator
from .image_paster import ImagePaster
from .shape_rotator import ShapeRotator
... |
#!/usr/bin/env python3
# Copyright (c) 2020 Dimitrios-Georgios Akestoridis
#
# 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... |
# -*- coding: utf-8 -*-
#
# Copyright © Spyder Project Contributors
#
# Licensed under the terms of the MIT License
# (see spyder/__init__.py for details)
"""Tests for status bar widgets."""
# Standard library imports
from unittest.mock import Mock
# Thrid party imports
from qtpy.QtCore import Qt
from qtpy.QtWidgets... |
import random
import time
from funcoes import divisoria,printsp
def dado_mostrar(dado):
divisoria()
print(f"\033[1;32;40mO número que você tirou foi \033[m\033[1;97;40m{dado}\033[m")
divisoria()
while True:
divisoria()
printsp("Olá , escolha um valor de dado para rodar:")
printsp("(6) (8) (16)... |
# Generated by Django 2.1.8 on 2019-07-03 09:57
import allink_core.core.models.fields
import aldryn_translation_tools.models
import allink_core.core.models.fields
import allink_core.core.models.mixins
import cms.models.fields
from django.conf import settings
import django.contrib.postgres.fields
from django.db import ... |
# Copyright 2009 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ... |
import time
def jstype(obj, typ):
__pragma__('js', '{}', '''
var t = typeof(obj)''')
if t == typ:
return True
return False
class PyDate:
'''
Descendants get a self.value property, which is always in sync
with an internal self.ts = unixtime'''
_value = ts = None
def get_value(sel... |
import pygame
import math
import random
import time
width = 900
height = 700
pygame.init()
window = pygame.display.set_mode((width, height))
pygame.display.set_caption("Fractal Tree")
screen = pygame.display.get_surface()
def Fractal_Tree(x1, y1, theta, depth):
if depth:
rand_length=random.randint(1,10)
rand_a... |
#!/usr/bin/env python3
import requests
from requests.auth import HTTPBasicAuth
import json
from ratelimit import limits, sleep_and_retry
CALLS = 2
RATE_LIMIT = 1
@sleep_and_retry
@limits(calls=CALLS, period=RATE_LIMIT)
def check_limit():
# Empty function just to check for calls to API
return
global codes
cod... |
from cirq import Circuit, Moment, GateOperation, SWAP, CNOT
import networkx as nx
from olsq.solve import OLSQ
from olsq.device import qcdevice
from olsq.olsq_cirq.input import input_cirq
class OLSQ_cirq(OLSQ):
def __init__(self, objective_name, if_transition_based):
"""Set the objective of OLSQ_cirq, and... |
"""
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... |
# Run this app with `python app.py` and
# visit http://127.0.0.1:8050/ in your web browser.
import dash
import dash_core_components as dcc
import dash_html_components as html
import dash_bootstrap_components as dbc
import pandas as pd
import yfinance as yf
import datetime
from datetime import date
#external_styleshee... |
import itertools
from typing import Any, List, Mapping, Optional, Sequence, Tuple, Union
import numpy as np
from mlir.ir import *
from mlir.dialects import arith, builtin, linalg, scf, std, tensor
from ..core.compilation import attach_inplaceable_attributes, attach_passthrough
from ..core.problem_definition import ... |
# recvcount.py
#
# Example of a co-routine
def recv_count():
try:
while True:
n = (yield)
print "T-minus", n
except GeneratorExit:
print "Kaboom!"
r = recv_count()
r.next()
for i in range(5,0,-1):
r.send(i)
r.close() |
import json
import scrapy
import os
import xmlrpc.client as xrpc
import sys
#subtitles_path = "/Users/mesutgurlek/Documents/Machine Learning/project/Movie-Category-Classification-from-Subtitles/Subtitles"
# subtitles_path = "/Users/aeakdogan/hooop/Movie-Category-Classification-from-Subtitles/Subtitles"
subtitles_path... |
import numpy as np
import time
import torch
import torch.nn as nn
def move_data_to_device(x, device):
if 'float' in str(x.dtype):
x = torch.Tensor(x)
elif 'int' in str(x.dtype):
x = torch.LongTensor(x)
else:
return x
return x.to(device)
def do_mixup(x, mixup_lambda):
"""... |
from flask import Flask
from flask import Flask
from flask_cors import CORS
from flask_sqlalchemy import SQLAlchemy
from flask_migrate import Migrate
from config import Config
# Flask-SQLAlchemy plugin
db = SQLAlchemy()
# Flask-Migrate plugin
migrate = Migrate()
def creat_app(config_class=Config):
app = Flask(__n... |
import numpy as np
from .pdb2sqlcore import pdb2sql
from .interface import interface
from .transform import rot_xyz_around_axis
def align(pdb, axis='x', export=True, **kwargs):
"""Align the max principal component of a structure along one of the cartesian axis
Arguments:
pdb {str, pdb2sql} -- the pdb... |
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
# Copyright (C) 2005, Pierre Legrand
#
# 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 la... |
import io
import numpy as np
from PIL import Image
from .. import ImageReader
def create_test_image(output_fn, size_width=50, size_height=50):
from PIL import Image
image = Image.new('RGB', size=(size_width, size_height), color=(155, 0, 0))
with open(output_fn, "wb") as f:
image.save(f, 'jpeg')
... |
from rlberry.envs.bandits import BernoulliBandit
from rlberry.manager import AgentManager
def check_bandit_agent(Agent, environment=BernoulliBandit, seed=42):
"""
Function used to check a bandit agent in rlberry on a Gaussian bandit problem.
Parameters
----------
Agent: rlberry agent module
... |
"""
Support for Tesla binary sensor.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/binary_sensor.tesla/
"""
import logging
from homeassistant.components.binary_sensor import (
BinarySensorDevice, ENTITY_ID_FORMAT)
from homeassistant.components.tesl... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.apps import AppConfig
class StuConfig(AppConfig):
name = 'stu' |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# michael a.g. aïvázis
# orthologue
# (c) 1998-2022 all rights reserved
#
"""
Verify that multiple inheritance is treated properly
"""
def test():
import pyre
# declare a couple of components
class base(pyre.component):
"""the base component"""
... |
# Generated by Django 2.2.10 on 2020-02-11 14:49
import django.contrib.postgres.fields
import django.db.models.deletion
from django.db import migrations
from django.db import models
class Migration(migrations.Migration):
dependencies = [("reporting", "0093_auto_20200210_1920")]
operations = [
migrat... |
# Copyright (c) 2009, 2012-2013, 2015-2017 ARM Limited
# All rights reserved.
#
# The license below extends only to copyright in the software and shall
# not be construed as granting a license to any other intellectual
# property including but not limited to intellectual property relating
# to a hardware implementation... |
# Copyright (c) 2013 Mirantis 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 writ... |
# -*- coding: utf-8 -*-
"""Playbook app wrapper for TextBlob (https://github.com/sloria/TextBlob)."""
import traceback
from tcex import TcEx
from textblob import TextBlob
def parse_arguments():
"""Parse arguments coming into the app."""
tcex.parser.add_argument('--string', help='String', required=True)
... |
"""
Web API (wrapper around WSGI)
(from web.py)
"""
import cgi
import pprint
import sys
import tempfile
from io import BytesIO
from urllib.parse import urljoin
from .utils import dictadd, intget, safestr, storage, storify, threadeddict
try:
from urllib.parse import unquote, quote
from http.cookies import Coo... |
import datetime
from django.utils import timezone
from .base import BlockObjectsTests
class ObjectTimeStampMethodsTests(BlockObjectsTests):
def test_old_object_was_not_published_recently(self):
time = timezone.now() - datetime.timedelta(days = 30)
old_object = self.create_object()
setat... |
BLUE = "#1017e6"
GREEN = "#31e319"
CYAN = "#03fccf"
RED = "#fc0335"
YELLOW = "#f2f205" |
# -*- coding: utf-8 -*-
##########################################################################
# Copyright 2013-2021 Aerospike, 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
#
# ... |
"""
Main Menu
"""
import arcade
import arcade.gui
from platformer.views.view import View
from platformer.views.view_game import GameView
from platformer.views.view_game_over import GameOverView
from platformer.views.view_pause import PauseView
class CharacterSelectView(View):
def __init__(self):
super().... |
# Generated by Django 3.0.3 on 2020-02-18 03:49
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone
class Migration(migrations.Migration):
initial = True
dependencies = [
migrations.swappable_dependency(settings.AUT... |
"""Introspection and validation for osbuild
This module contains utilities that help to introspect parts
that constitute the inner parts of osbuild, i.e. its stages,
assemblers and sources. Additionally, it provides classes and
functions to do schema validation of OSBuild manifests and
module options.
A central `Inde... |
# -*- coding: utf-8 -*-
"""
Created on Wed Sep 15 15:19:16 2021
@author: catal
"""
import tkinter as tk
window = tk.Tk()
for i in range(3):
window.columnconfigure(i, weight=1, minsize=75)
window.rowconfigure(i, weight=1, minsize=50)
for j in range(3):
frame = tk.Frame(
master=windo... |
import pytest
import torch
from torchts.nn.loss import masked_mae_loss, mis_loss, quantile_loss
@pytest.fixture
def y_true():
data = [1, 2, 3]
return torch.tensor(data)
@pytest.fixture
def y_pred():
data = [1.1, 1.9, 3.1]
return torch.tensor(data)
def test_masked_mae_loss(y_true, y_pred):
"""... |
from mock import ANY, Mock, patch
from nose.tools import eq_, ok_
from requests.exceptions import RequestException
from flicks.base.tests import TestCase
from flicks.users.tests import UserProfileFactory
from flicks.videos.models import Video2013
from flicks.videos.tests import Video2013Factory
from flicks.videos.vime... |
from socket import *
serverName = "127.0.0.1"
serverPort = 12000
clientSocket = socket(AF_INET, SOCK_DGRAM)
sentence = input("Enter file name: ")
clientSocket.sendto(bytes(sentence, "utf-8"), (serverName, serverPort))
filecontents, serverAddress = clientSocket.recvfrom(2048)
print("From Server: ", filecontents.decode... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.