text stringlengths 2 999k |
|---|
import RPi.GPIO as GPIO
import time
import utils
import therm
GPIO.setmode(GPIO.BOARD)
#pwr = utils.PSU(13, 15)
#pwr.on()
#pwr.off()
adresses = therm.get_adr()
samples = 5
therms = []
now = time.time()
t_amb = therm.Therm('28-000004e08693')
t_c_b = therm.Therm('28-000004e0f7cc')
t_c_m = therm.Therm('28-000004e0840a... |
#!/usr/bin/env python
from setuptools import setup
import sys
install_requires=[
'setuptools',
'docopt',
'requests',
'python-slugify>=1.0',
'six>=1.9,<2.0',
]
tests_require=[
'pyfakefs',
]
if sys.version_info <= (3,):
install_requires.append('simplejson')
setup(
name='ckanapi',
... |
# 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 ... |
from opencage.geocoder import _query_for_reverse_geocoding
def _expected_output(input_latlng, expected_output): # pylint: disable=no-self-argument
def test():
lat, lng = input_latlng
assert _query_for_reverse_geocoding(lat, lng) == expected_output
return test
def test_reverse():
_expected_... |
# Copyright 2022 Tony Akocs
# SPDX-License-Identifier: MIT |
# MIT License
#
# Copyright (C) The Adversarial Robustness Toolbox (ART) Authors 2020
#
# 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
# r... |
'''
Copyright (c) Cloudneeti. All rights reserved.
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, merge, publish... |
#!/usr/bin/env python
from worker import *
from network import *
import threading
from time import sleep
flags = tf.app.flags
FLAGS = flags.FLAGS
flags.DEFINE_boolean('is_approaching_policy', False, 'If learning approaching policy.')
flags.DEFINE_integer('max_episodes', 200000, 'Maximum episodes.')
flags.DEFINE_inte... |
import unittest
import lightgbm as lgb
import pandas as pd
from common import gpu_test
class TestLightgbm(unittest.TestCase):
# Based on the "simple_example" from their documentation:
# https://github.com/Microsoft/LightGBM/blob/master/examples/python-guide/simple_example.py
def test_cpu(self):
l... |
from dataclasses import dataclass, field
import logging
from .mqtt_subscription import MqttSubscription
# Help out with cyclic import
from typing import TYPE_CHECKING, List
if TYPE_CHECKING:
from .mqtt_client import MqttClient
from .mqtt_message import MqttMessage
@dataclass
class MqttUserdata:
client... |
# Generated by Django 4.0.3 on 2022-03-09 17:22
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('funcionarios', '0002_funcionario_departamentos_funcionario_empresa_and_more'),
('registro_hora_extra', '0001_initial... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright: (c) 2018, Emmanouil Kampitakis <info@kampitakis.de>
# Copyright: (c) 2018, William Leemans <willie@elaba.net>
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_fun... |
import pandas as pd
import numpy as np
from scipy.stats import truncnorm
from patsy import dmatrix
from collections import OrderedDict
from hddm.simulators.basic_simulator import *
from hddm.model_config import model_config
from functools import partial
# Helper
def hddm_preprocess(
simulator_data=None,
subj_i... |
import socket
import psutil
def find_ip_form_interface(family=socket.AF_INET):
for interface, snics in psutil.net_if_addrs().items():
for snic in snics:
if snic.family == family:
yield (interface!='lo', snic.address)
def get_ip():
ipv4s = list(find_ip_form_interface())
... |
#
# Copyright (c) 2015 nexB Inc. and others. All rights reserved.
# http://nexb.com and https://github.com/nexB/scancode-toolkit/
# The ScanCode software is licensed under the Apache License version 2.0.
# Data generated with ScanCode require an acknowledgment.
# ScanCode is a trademark of nexB Inc.
#
# You may not use... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Butterfly - A sleek web based terminal emulator
"""
import os
import re
from setuptools import setup
ROOT = os.path.dirname(__file__)
with open(os.path.join(ROOT, 'butterfly', '__init__.py')) as fd:
__version__ = re.search("__version__ = '([^']+)'", fd.read()).gro... |
import copy
import gc
import pytest
import rpy2.rinterface as rinterface
rinterface.initr()
def test_invalid_init():
with pytest.raises(ValueError):
rinterface.Sexp('a')
def test_init_from_existing():
sexp = rinterface.baseenv.find('letters')
sexp_new = rinterface.Sexp(sexp)
assert sexp_new... |
#!/usr/bin/env python3
# Copyright 2021 Xiaomi Corp. (authors: Fangjun Kuang,
# Wei Kang)
#
# See ../../../../LICENSE for clarification regarding multiple authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this fi... |
########
# Copyright (c) 2016 GigaSpaces Technologies Ltd. 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... |
import pickle
import warnings
from collections import OrderedDict
class Reporter:
def __init__(self, entries_names=None):
self.entries = None
if entries_names is not None:
self.entries = OrderedDict([(entry, [[]]) for entry in entries_names])
def move_to_new_series(self):
... |
# Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appli... |
# coding: UTF-8
import os
import torch
import numpy as np
import pickle as pkl
from tqdm import tqdm
import time
from datetime import timedelta
MAX_VOCAB_SIZE = 10000
UNK, PAD = '<UNK>', '<PAD>'
def build_vocab(file_path, tokenizer, max_size, min_freq):
vocab_dic = {}
with open(file_path, 'r', encoding='UTF... |
#!/usr/bin/env python
import os
from Reco3D.lib import dataset
if __name__ == '__main__':
print ('re-preprocessing data')
os.remove('./data_preprocessed/*.npy')
print ('removed the preprocessed data')
dataset.preprocess_dataset()
print ('done...')
|
# Copyright (c) 2017, Djaodjin Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice,
# this list of conditions and t... |
import logging
logger = logging.getLogger('morp.crud')
|
from Encapsulation.project_wild_cat_zoo import DarkKnight
class BladeKnight(DarkKnight):
pass |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
"""
Some models in the merchant's implementation require a many-to-many relation with models from
outside djangoSHOP. Therefore these mapping tables must be materialized by the merchant's
implementation.
"""
from shop.models.related import BaseProductPage,... |
# Copyright (c) 2015 Intel Corporation
# 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 req... |
#!/usr/bin/python3
# VMM Analysis
# --------------------------------------------------------------------
# This script is a simple example, showing how to read the data from a
# ROOT tree, generated with vmm-sdat. In addition, some cuts are
# applied to the data using pandas. In this specific example, this
# means tha... |
# Copyright (C) 2014 Nippon Telegraph and Telephone Corporation.
#
# 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 appli... |
#!/usr/bin/env python3
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
from unittest import mock
import numpy as np
import pandas as pd
from ax.metrics.tensorboard import TensorboardCurve... |
# class normal node is the first type of node that is used in the hetorogeneous clustering involving WBAN
# 类普通节点是在涉及WBAN的异构集群中使用的第一类节点
import math as ma
import numpy as np
import cmath as ca
class normalnode:
# This is the constructor that initializes every default node with initial values and sets the value of residu... |
import imagect.api.viewmgr as vmm
import imagect.api.actmgr as actmgr
import imagect.api.app as app
import imagect.api.mainwin as mainwin
import imagect.config as config
#from rx.scheduler.mainloop import QtScheduler
from rx import operators as ops
import concurrent.futures
import asyncio
import rx
import time
from t... |
#!/usr/bin/python3
from brownie import PriceExercise, config, network
from scripts.helpful_scripts import fund_with_link, get_account
def main():
account = get_account()
price_contract = PriceExercise[-1]
tx = fund_with_link(
price_contract, amount=config["networks"][network.show_active()]["fee"]
... |
# -*- coding: utf-8 -*-
from .watson import IBMWatsonSTTPlugin
|
from rest_framework import permissions, generics
from rest_framework import validators
from rest_framework.response import Response
from .models import Friend
from .serializers import FriendRequestSerializer
# Create your views here.
class FriendRequestView(generics.ListCreateAPIView):
queryset = Friend.objects... |
#!/usr/bin/env python
######################################################################################################################
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. #
# ... |
# Copyright 2017 Huawei Technologies Co.,LTD.
#
# 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 agre... |
"""Helper functions
"""
import h5py
_mapping = {
h5py.File: "file",
h5py.Group: "group",
h5py.Dataset: "dataset",
}
def register_h5pyd():
import h5pyd
_mapping[h5pyd.File] = "file"
_mapping[h5pyd.Group] = "group"
_mapping[h5pyd.Dataset] = "dataset"
def check_class(obj_class):
"""Che... |
# Automatically generated by pb2py
# fmt: off
from .. import protobuf as p
if __debug__:
try:
from typing import Dict, List # noqa: F401
from typing_extensions import Literal # noqa: F401
except ImportError:
pass
class LiskSignedTx(p.MessageType):
MESSAGE_WIRE_TYPE = 117
de... |
import typing
import dataclasses as dc
from .common import AuthorizationBase
from .._api_base import RawClient, ApiStorage
from .._http import Request, Response, RequestMakerBase, RequestMiddlewareBase
@dc.dataclass
class SessionIdAuthorization(AuthorizationBase, RequestMiddlewareBase):
session_id: str
yandex... |
from itertools import chain
import pytest
from PIL import Image # type: ignore
import esparto._content as co
import esparto._layout as la
from tests.conftest import _EXTRAS, content_list
if _EXTRAS:
def test_all_content_classes_covered(content_list_fn):
test_classes = {type(c) for c in content_list_fn}... |
from .mongo_persistence_provider import MongoPersistenceProvider |
from django.urls import path
from identity import views
app_name = 'identity'
urlpatterns = [
path('register/', views.RegisterUserView.as_view(), name='register'),
path('login/', views.LoginCreateTokenView.as_view(), name='login'),
path('profile/', views.ManageUserView.as_view(), name='profile')
]
|
# 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 json
import warnings
import pulumi
import pulumi.runtime
from typing import Union
from .. import utilities, tables
class Functi... |
# -*- coding: utf-8 -*-
'''
CuBIC is a statistical method for the detection of higher order of
correlations in parallel spike trains based on the analysis of the
cumulants of the population count.
Given a list sts of SpikeTrains, the analysis comprises the following
steps:
1) compute the population histogram (PSTH) wi... |
from __future__ import absolute_import
#
# Copyright (c) 2018 Juniper Networks, Inc. All rights reserved.
#
from builtins import str
import os
import random
import signal
import socket
import sys
from attrdict import AttrDict
from cfgm_common import vnc_cgitb
from cfgm_common.kombu_amqp import KombuAmqpClient
from cf... |
"""文字列基礎
文字列を特定の区切り文字で分割する方法
前方から分割する split
[説明ページ]
https://tech.nkhn37.net/python-split-splitlines-partition/#_split
"""
sample_text1 = 'Python Java C C++ C# Go'
sample_text2 = 'Python|Java|C|C++|C#|Go'
# ===== 前方から分割する split
# 空白文字で分割
print('--- 空白で分割')
print(sample_text1.split())
# 指定文字で分割
print('--- 指定文字で分割')
pr... |
import torch
import torch.nn.functional as F
from torch import nn
from maskrcnn_benchmark.modeling.make_layers import group_norm
class Bottom2UP(nn.Module):
"""
Module that adds PANet on a list of feature maps from FPN.
The feature maps are currently supposed to be in increasing depth
order, and must ... |
# Copyright 2012 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.
from __future__ import absolute_import
import re
from telemetry.internal.browser import web_contents
def UrlToExtensionId(url):
return re.match(r"(chrom... |
from os.path import exists
def file_type(filepath):
imexts = ['.png', '.bmp', '.jpg', 'jpeg']
if filepath.endswith('.hdf5') or filepath.endswith('.h5'):
return 'hdf5'
if filepath.endswith('.csv'):
return 'csv'
if filepath.endswith('.grm.raw'):
return 'grm.raw'
if filepath.e... |
import os
import scipy.io
import numpy as np
import torch
from torchvision import datasets, transforms
def load_datasets(dataset, image_size, data_path):
if dataset == 'omniglot':
return load_omniglot()
elif dataset == 'mnist':
return load_mnist()
elif dataset.startswith('lsun'):
... |
from flask import Response
from backend.api.handlers.helpers.profiled_jsonify import profiled_jsonify
def make_error_response(status_code: int, error_dict: dict) -> Response:
response = profiled_jsonify(error_dict)
response.status_code = status_code
return response
|
from http import HTTPStatus
from unittest import TestCase
from mock import patch, Mock
from search_service import create_app
from search_service.models.search_result import SearchResult
from tests.unit.api.table.fixtures import mock_json_response, mock_proxy_results, default_json_response
class TestSearchTableAPI(T... |
"""
MIT License
Copyright (c) 2022 Alpha Zero
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, merge, publish, di... |
import elasticsearch
import curator
import os
import click
from click import testing as clicktest
from mock import patch, Mock
from . import CuratorTestCase
import logging
logger = logging.getLogger(__name__)
host, port = os.environ.get('TEST_ES_SERVER', 'localhost:9200').split(':')
port = int(port) if port else 920... |
import copy
import collections
import yaml
__version__ = '0.2'
class RdoinfoException(Exception):
msg_fmt = "An unknown error occurred"
def __init__(self, msg=None, **kwargs):
self.kwargs = kwargs
if not msg:
try:
msg = self.msg_fmt % kwargs
except Ex... |
import os
import requests as r
def urs_authenticate():
# AUTHENTICATION CONFIGURATION
from netrc import netrc
from subprocess import Popen
from getpass import getpass
urs = 'urs.earthdata.nasa.gov' # Earthdata URL to call for authentication
prompts = ['Enter NASA Earthdata Login Username \n... |
#!/usr/bin/env python
#
# Copyright 2015 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 requir... |
import torch
t = torch.randn(2, 3)
u = torch.randn(2, 3)
t.copy_(u)
(t == u).all()
|
import secrets
from base64 import urlsafe_b64encode as b64e, urlsafe_b64decode as b64d
from cryptography.fernet import Fernet
from cryptography.hazmat.backends import default_backend
from cryptography.hazmat.primitives import hashes
from cryptography.hazmat.primitives.kdf.pbkdf2 import PBKDF2HMAC
class Aes_128_cbc_p... |
import bleach
from django import forms
from django.utils import timezone
from django.contrib import messages
from django.contrib.auth.decorators import login_required # , user_passes_test
from django.core.exceptions import PermissionDenied
from django.http import HttpResponse, Http404
from django.shortcuts import get_... |
from typing import Union, List
from .purpose_reference import *
from .trait_reference import TraitReference
from cdm.utilities import JObject
class Purpose(JObject):
def __init__(self):
super().__init__()
self.explanation = '' # type: str
self.purposeName = '' # type: str
self.... |
from abc import ABC, abstractmethod
import random
class NaiveMdp(ABC):
"""The minimal (most general) definition of an MDP"""
@abstractmethod
def actions(self, cur_state):
"""@return actions allowable from state @p cur_state."""
pass
@abstractmethod
def next_state_probabilities(se... |
from django.conf import settings
from django.urls import include, path
from django.conf.urls.static import static
from django.contrib import admin
from django.views.generic import TemplateView
from django.views import defaults as default_views
urlpatterns = [
path("", TemplateView.as_view(template_name="pages/home... |
# Copyright (C) 2019 Google Inc.
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
"""Contains WithLastComment mixin.
This defines logic to get fields of the last Comment over all
Comments of object.
"""
from ggrc.fulltext import attributes
from ggrc.builder import simple_property
from g... |
# -*- coding:utf-8 -*-
# Copyright (C) 2020. Huawei Technologies Co., Ltd. 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... |
# -*- coding: utf-8 -*-
"""Configure the tests package for InfluxDBClient."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import sys
import os
import unittest
using_pypy = hasattr(sys, "pypy_version_info")
skip_... |
import json
import logging
from typing import Dict, List, Tuple
from kloppy.domain import (
BallOutEvent,
BodyPart,
BodyPartQualifier,
CardEvent,
CardType,
CounterAttackQualifier,
Dimension,
EventDataset,
FoulCommittedEvent,
GenericEvent,
GoalkeeperAction,
GoalkeeperActi... |
# -*- encoding: utf-8 -*-
#
# Copyright © 2018 Mehdi Abaakouk <sileht@sileht.net>
#
# 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
#
# Unles... |
import pandas as pd
import logging
from datetime import datetime
from datetime import timedelta
from typing import Union
def validate_name_dob(dict_id: dict, flight_manifest: pd.DataFrame) -> pd.DataFrame:
# get idx where name matches, if more than one, check dob
idx_name = flight_manifest.query(
f"n... |
env = {"USE_FORTRAN": "0"}
|
# 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, overload
from ... import _utilities
fro... |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.26 on 2019-12-09 23:15
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('dashboard', '0012_submission_grade_posted_local_date'),
]
operations = [
m... |
import copy
import random
import time
from math import exp
from os import mkdir
import torch.optim as optim
import wandb
from matplotlib import pyplot as plt
from helper.replay_memory import ReplayMemory, Transition
from k_choice.simulation import sample_one_choice
from k_thinning.full_knowledge.RL.DQN.constants impo... |
# OpenWeatherMap API Key
weather_api_key = "601b4c14f4ddb46a0080bbfb5ca51d3e"
# Google API Key
g_key = "AIzaSyDNUFB01N6sBwZfPznGBiHayHJrON12pYw"
|
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------... |
import pyaf.Bench.TS_datasets as tsds
import pyaf.tests.artificial.process_artificial_dataset as art
art.process_dataset(N = 128 , FREQ = 'D', seed = 0, trendtype = "PolyTrend", cycle_length = 0, transform = "Fisher", sigma = 0.0, exog_count = 0, ar_order = 0); |
from models import *
from models.multiatt import model
from models.multiatt import CRF_Weighted
from models.multiatt import concept_model
from models.multiatt import R2C_Joint
from models.multiatt import crf_multi_modular2_new
# You can add more models in this folder. like
# from models.no_question import mode... |
"""Per-prefix data, mapping each prefix to a dict of locale:name.
Auto-generated file, do not edit by hand.
"""
from ..util import u
# Copyright (C) 2011-2020 The Libphonenumber Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the Licens... |
from gerrit_coverage import check_style
if __name__ == '__main__':
check_style() |
"""Utilities around packages
"""
from relevanceai.utils.base import *
from relevanceai.utils.cache import *
from relevanceai.utils.concurrency import *
from relevanceai.constants.config import *
from relevanceai.constants.constants import *
from relevanceai.utils.datasets import *
from relevanceai.constants.errors impo... |
class ConfigurationError(Exception):
def __init__(self, msg):
self.msg = msg
def __str__(self):
return self.msg |
import tempfile
from PIL import Image
import numpy as np
import click
import mercantile
import rasterio
from rasterio.windows import Window
import pyproj
from rastervision2.pipeline.filesystem import (download_if_needed,
get_local_path, upload_or_copy)
from rastervision.... |
#!/usr/bin/env python
# Taken from https://github.com/dropbox/mypy-protobuf/blob/b72d8d15651460d400dd9c4e91e6c5f17999213e/python/protoc-gen-mypy
# (Apache 2.0 License)
# with own fixes to
# - appease flake8
# https://github.com/dropbox/mypy-protobuf/pull/19
# - fix type hints in this file
# https://github.com/drop... |
from chill import *
source('/uufs/chpc.utah.edu/common/home/u1142914/lib/ytopt_vinu/polybench/polybench-code/stencils/jacobi-1d/kernel.c')
destination('/uufs/chpc.utah.edu/common/home/u1142914/lib/ytopt_vinu/experiments/jacobi-1d/tmp_files/843.c')
procedure('kernel_jacobi_1d')
loop(0)
tile(0,2,32,2)
tile(1,2,32,2)
|
# -*- coding: utf-8 -*-
# Generated by Django 1.10.8 on 2018-09-12 01:32
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('wildlifecompliance', '0079_applicationdecisionpropose'),
]
operations = [
migration... |
import numpy as np
def random_crop_flip(x_in, y_in, i0=None, j0=None, crop_shape=(256, 256)):
# Sample frame from random location in image. Randomly flip frame.
if i0 == None:
i0 = np.random.randint(low=0, high=(x_in.shape[0]-crop_shape[0]))
if j0 == None:
j0 = np.random.randint(low=0, high... |
"""Request function for Symphony Web Services"""
from airflow.providers.http.operators.http import SimpleHttpOperator
def SymphonyRequest(**kwargs) -> SimpleHttpOperator:
app_id = kwargs.get("app_id")
client_id = kwargs.get("client_id")
conn_id = kwargs.get("conn_id")
dag = kwargs.get("dag")
data... |
# -*- 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... |
from hamcrest.core.base_matcher import BaseMatcher
from hamcrest.core.helpers.wrap_matcher import wrap_matcher
__author__ = "Jon Reid"
__copyright__ = "Copyright 2011 hamcrest.org"
__license__ = "BSD, see License.txt"
class HasString(BaseMatcher):
def __init__(self, str_matcher):
self.str_matcher = str_m... |
from injector import inject, singleton
from typing import List
from domain.model.track import Track
from interface.repository.track_repository import TrackRepository
from interface.usecase.track_usecase import TrackUsecase
@singleton
class TrackInteractor(TrackUsecase):
@inject
def __init__(
self,
... |
import copy
import re
import six
from six.moves import urllib
from .common import (
Requester,
_lower,
_upper,
_singularize,
_pluralize,
_json_dumper,
)
__author__ = "Mike Cugini <cugini@dropbox.com>"
from .version import __version__, version_info # noqa
TRIGGER_LOG_ENTRY_RE = re.compile(
... |
# Protected management frames tests
# Copyright (c) 2013, Jouni Malinen <j@w1.fi>
#
# This software may be distributed under the terms of the BSD license.
# See README for more details.
import time
import subprocess
import logging
logger = logging.getLogger()
import hwsim_utils
import hostapd
from wlantest import Wla... |
# https://leetcode.com/problems/construct-binary-tree-from-inorder-and-postorder-traversal/
# Definition for a binary tree node.
# class TreeNode(object):
# def __init__(self, val=0, left=None, right=None):
# self.val = val
# self.left = left
# self.right = right
class Solution(object):
... |
from invirtualenv.config import get_configuration
from invirtualenv.deploy import link_deployed_bin_files
def main():
config = get_configuration()
link_bin_files = config['docker_container'].get('link_bin_files', '')
if link_bin_files:
link_bin_files = config['docker_container'].getboolean('link_... |
# Generated by Django 2.2.2 on 2019-07-05 18:12
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('django_import_data', '0013_auto_20190705_1409'),
]
operations = [
migrations.AlterField(
model_... |
print("POS CLUB"+' '*18+"P W D L GF GA GD PTS",*[("\n{:>3} {:21}{:>2}"+"{:>4}"*7).format(*__import__("re").findall(r"[\d\-]+|(?=\w)[^\d\-]+(?![\d\-])",line))for line in __import__("sys").stdin])
|
# postgresql/psycopg2.py
# Copyright (C) 2005-2019 the SQLAlchemy authors and contributors
# <see AUTHORS file>
#
# This module is part of SQLAlchemy and is released under
# the MIT License: http://www.opensource.org/licenses/mit-license.php
r"""
.. dialect:: postgresql+psycopg2
:name: psycopg2
:dbapi: psycopg2... |
# project/config.py
import os
basedir = os.path.abspath(os.path.dirname(__file__))
class BaseConfig(object):
"""Base configuration."""
SECRET_KEY = 'my_precious'
DEBUG = False
BCRYPT_LOG_ROUNDS = 13
WTF_CSRF_ENABLED = True
DEBUG_TB_ENABLED = False
DEBUG_TB_INTERCEPT_REDIRECTS = False
cl... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.