text stringlengths 2 999k |
|---|
# Copyright 2014 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 agreed to in writing, s... |
import re
def find_item(hero):
with open('sanguo.txt',encoding='utf-8') as f:
data = f.read().replace('\n', '')
name_num = len(re.findall(hero,data))
# print('主角 %s 出现了 %d 次'%(hero,name_num))
return name_num
# 读取人物的信息
name_dict = {}
with open('name.txt') as f:
for line in f:
... |
"""AprendePy URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/2.2/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: path('', views.home, name='home')
Class-bas... |
# Copyright 2021 Northern.tech AS
#
# 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 ag... |
# encoding: utf-8
import datetime
from ckan.common import asbool
from ckan.common import config
"""SQLAlchemy Metadata and Session object"""
from sqlalchemy import MetaData, and_
import sqlalchemy.orm as orm
from sqlalchemy.orm.session import SessionExtension
import extension
import ckan.lib.activity_streams_session... |
def decorate_lowercase(function):
def lowerfy():
funcaa = function()
string_lower = funcaa.lower()
return string_lower
return lowerfy
def splitfy(function):
def splitt():
s_value = function()
str_list = s_value.split()
return str_list
return splitt
@splitfy
@decorate_lowercase
def hello():
return "... |
'''
Created on 2019年6月19日
@author: bkd
'''
from tkinter import *
def data():
for i in range(50):
Label(frame, text=i).grid(row=i, column=0)
Label(frame, text="my text" + str(i)).grid(row=i, column=1)
Label(frame, text="..........").grid(row=i, column=2)
def myfunction(event):
# canvas.... |
from domain.model.environment import EnvironmentName
from domain.model.zone import ZoneRepository, ZoneName, Zone
from ..SQLAlchemyBase import SQLAlchemyBase
from ..model.ZoneModel import ZoneModel
class ZoneRepositorySQL(ZoneRepository):
def __init__(self, base_repo: SQLAlchemyBase):
self.base_repo = ba... |
# Copyright 2016 the GPflow authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writi... |
# flake8: noqa
import os
from tempfile import TemporaryDirectory
from pytest import mark
from torch import nn, optim
from torch.nn import functional as F
from torch.utils.data import DataLoader
from catalyst import dl, metrics
from catalyst.contrib.datasets import MNIST
from catalyst.data import ToTensor
from catal... |
import mock
import unittest
import django.test
import requests
import responses
from rest_framework.test import APIRequestFactory
from advisers import geocoder
from advisers import models
from advisers.views import AdviserViewSet
class GeocoderTest(unittest.TestCase):
def setUp(self):
self.postcode = "sw... |
#Copyright 2018 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, so... |
from rest_framework.decorators import api_view, authentication_classes, \
permission_classes
from rest_framework.response import Response
from rest_framework.reverse import reverse
from rest_framework.authentication import TokenAuthentication, \
SessionAuthentication
from rest_framework.permissions import IsAut... |
import os
import time
from glob import glob
import multiprocessing as mp
from collections import deque
from qdl import *
from models import *
OUTDIR = r"C:\School\qdl"
def run():
scenarios = [
#"IM_START",
#"LOAD_INCREASE",
#"VREF_INCREASE",
"FAULT_BUS2",
]
tstop = 1.1
ws = 2... |
#!/usr/bin/env python3
from testUtils import Utils
import testUtils
import time
from Cluster import Cluster
from WalletMgr import WalletMgr
from Node import BlockType
from Node import Node
from TestHelper import AppArgs
from TestHelper import TestHelper
import decimal
import math
import re
import signal
############... |
from django import forms
from caseworker.core.components import PicklistPicker
from lite_content.lite_internal_frontend import goods
from lite_content.lite_internal_frontend.strings import cases
from lite_forms.common import control_list_entries_question
from lite_forms.components import Form, RadioButtons, Option, Te... |
import unittest
from horners_method.horners_method import Polynomial
class TestPolynomialEvaluation(unittest.TestCase):
def test_horner_method(self):
polynomial = Polynomial([2, -6, 2, -1])
result = polynomial.evaluate_at(3)
self.assertEqual(5.0, result)
if __name__ == "__main__":
... |
from enum import Enum
import types
from pyons.kernel.base import Singleton
from pyons.kernel import errors
class FType(Enum):
"""
Function type. Could be initializer, finalizer, event handler or
any other (native, not managed) function.
"""
NOT_MANAGED = 0
INITIALIZER = 1
EVENT_HANDLER = 2... |
from django.contrib import admin
from treebeard.admin import TreeAdmin
from treebeard.forms import movenodeform_factory
from document_index.models import GroupTreeList, Group, Document, Source
class SourceInline(admin.TabularInline):
model = Source
extra = 1
fieldsets = [
(None, {'fields': ['name',... |
from .cell import Cell, Slice, deserialize_boc, deserialize_cell_from_json
from .dict_utils import parse_hashmap
from .stack_utils import render_tvm_stack, serialize_tvm_stack
|
# Lint as: python3
# 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agree... |
"""
Arithmetic operators are used with numeric values to perform common
mathematical operations.
Documentation - https://www.w3schools.com/python/python_operators.asp
"""
x = 3
y = 5
x + y # Adds the value of x and y (Addition, 8)
x - y # Subtracts the value of y from x (Subtraction, -2)
x * y # Multiplies x by y (... |
from trainers.basic import BasicTrainer
class SupervisedTrainer(BasicTrainer):
def calculate_logits(self, images, labels):
images = images.to(self.args.device)
labels = labels.to(self.args.device)
logits = self.model(images) / self.args.temperature
return logits, labels
def pr... |
load("//elm/private:test.bzl", _elm_test = "elm_test")
elm_test = _elm_test
def _elm_make_impl(ctx):
elm_compiler = ctx.toolchains["@rules_elm//elm:toolchain"].elm
output_file = ctx.actions.declare_file(ctx.attr.output)
env = {}
inputs = [elm_compiler, ctx.file.elm_json] + ctx.files.srcs
if ctx.f... |
#!/usr/bin/env python
#
# Use the raw transactions API to spend BCEs received on particular addresses,
# and send any change back to that same address.
#
# Example usage:
# spendfrom.py # Lists available funds
# spendfrom.py --from=ADDRESS --to=ADDRESS --amount=11.00
#
# Assumes it will talk to a blockchainenergyd o... |
class WallPlanner:
def __init__(self, params, robot_scale=0.3302):
self.parms = params
self.robot_scale = robot_scale
def plan(self, obs):
ranges = obs['scans']
left = ranges[720]
if left > 2.1: # If you move away from the left wall, you will get closer... |
#!/usr/bin/env python3
# Copyright (c) 2015-2016 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 behavior of -maxuploadtarget.
* Verify that getdata requests for old blocks (>1week) are dropped
... |
#!/usr/bin/env vpython3
# Copyright 2015 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.
"""Tests for git_drover."""
import os
import shutil
import subprocess
import sys
import tempfile
import unittest
sys.path.insert(0, ... |
import time
from mitmproxy.utils import strutils
from mitmproxy.utils import human
def write_raw(fp, lines, timestamp=True):
if fp:
if timestamp:
fp.write(human.format_timestamp(time.time()))
for i in lines:
fp.write(i)
fp.write("\n")
fp.flush()
class Log... |
from pydantic import BaseModel
from sqlalchemy import Column
from sqlalchemy import Integer
from sqlalchemy import String
from src.database import Base
class TaskDb(Base):
__tablename__ = 'task'
id = Column(Integer, primary_key=True)
name = Column(String(120), index=True, unique=True)
points = Column(... |
import base64
import re
from email.header import Header
from email.mime.image import MIMEImage
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
from chalicelib.utils import helper, smtp
from chalicelib.utils.helper import environ
def __get_subject(subject):
return subject
def... |
"""Test module."""
import unittest
from accessor import accessor as _, flatten
tester = [
{
'a': 1,
'b': {'c': 5, 'cc': {'d': 6, 'e': 7}},
'f': [
{'g': 11, 'h': 12},
{'g': 13, 'h': 14},
]
},
{
'a': 3,
'b': {'c': 8, 'cc': {'d': 9, 'e... |
def method(method_name, acc_modifier, return_type, params, body):
param_string = ""
if params:
for name, var_type in params.items():
param_string += "{} {},".format(var_type, name)
param_string = param_string[:-1]
return """ {} {} {}({}){{{}}}""".format(acc_modifier, return_t... |
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Changing field 'CaseVersion.name'
db.alter_column('library_caseversion', 'name', self.gf('django.db.model... |
"""
Takes in a folder of observations (center-[timestep].png images,
mot-[timestep].txt tracker logs) and creates and saves crops of the bounding
boxes. Useful for training the feature extractor model for DeepSORT tracker.
Example usage:
python gen_crops_from_obj_tracker_logs.py --data sample_data --out crops
"""
imp... |
from dhooks import Webhook, Embed
import datetime
import os
def sendDiscordMessage(successOrFailure, timeTaken, totalClasses=0):
hook = Webhook(os.environ.get("DISC_HOOK"))
if successOrFailure:
now = datetime.datetime.now()
#hook.send("[" + str(now) + "] Successfully updated database wi... |
#!/usr/bin/env python3
# Copyright (c) 2018 ISciences, LLC.
# All rights reserved.
#
# WSIM is 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.
#
# Unl... |
"""
Copyright 2013 Rackspace
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 writing, software
dist... |
from django.contrib.auth import get_user_model
from rest_framework import serializers
from blog.models import Category, Tag, Blog, Comment, Subscriber
class BlogSerializer(serializers.ModelSerializer):
class Meta:
model = Blog
fields = '__all__'
class CommentSerializer(serializers.ModelSerializer)... |
#!/usr/bin/env python
"""
This is the main function to call for disambiguating between BAM files
from two species that have alignments from the same source of fastq files.
It is part of the explant RNA/DNA-Seq workflow where an informatics
approach is used to distinguish between e.g. human and mouse or rat RNA/DNA rea... |
import pytest
import dateutil.parser as date_parser
from freezegun import freeze_time
from okdata.sdk.data.dataset import Dataset
from services import EventStreamService, ResourceConflict, ResourceNotFound
from clients import setup_origo_sdk, CloudformationClient
from unittest.mock import ANY
import test.test_data.s... |
from typing import List
import itertools
import collections
import tensorflow as tf
import numpy as np
from utils.misc import *
SSDBoxSizes = collections.namedtuple('SSDBoxSizes', ['min', 'max'])
SSDSpec = collections.namedtuple('SSDSpec', ['feature_map_size', 'shrinkage', 'box_sizes', 'aspect_ratios'])
d... |
import datetime
import frontmatter
def update_frontmatter_with_date(post: frontmatter.Post, date: datetime.date) -> None:
"""
Mutates (but does not overwrite) `post`'s `date` and `lastmod`
frontmatter fields with the passed `date`.
"""
if 'date' not in post:
post['date'] = date
if 'l... |
"""Tests for the editions API."""
import pytest
from werkzeug.exceptions import NotFound
from app.exceptions import ValidationError
def test_editions(client):
# Add a sample product
p = {'slug': 'pipelines',
'doc_repo': 'https://github.com/lsst/pipelines_docs.git',
'title': 'LSST Science Pi... |
# SPDX-License-Identifier: Apache-2.0
"""CDS Blueprint module."""
import json
import re
from dataclasses import dataclass, field
from datetime import datetime
from io import BytesIO
from typing import Any, Dict, Generator, Iterator, List
from uuid import uuid4
from zipfile import ZipFile
import oyaml as yaml
from ona... |
import asyncio
import socket
import pytest
from mock import AsyncMock, MagicMock, patch
import aioatomapi.host_resolver as hr
from aioatomapi.core import APIConnectionError
@pytest.fixture
def async_zeroconf():
with patch("zeroconf.asyncio.AsyncZeroconf") as klass:
yield klass.return_value
@pytest.fix... |
import pytest
from utils import retry
pytestmark = pytest.mark.skip
@pytest.fixture(scope='module')
def masters(syndics, minions):
return [
{
'config': {
"container__config__salt_config__extra_configs": {
"syndic": {
"order_masters"... |
#!/usr/bin/python
# coding: utf-8 -*-
# (c) 2017, Wayne Witzel III <wayne@riotousliving.com>
# 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_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1... |
import argparse
import os
import sys
import pandas as pd
class TrainOptions():
def __init__(self,argv):
self.argv=argv
self.parser = argparse.ArgumentParser()
self.initialized = False
def initialize(self):
# Common parameters for training the model
self.parser.add_a... |
from .model_loader import ModelLoader
__all__ = ["ModelLoader"]
|
"""The tests for the mochad light platform."""
import unittest.mock as mock
import pytest
from openpeerpower.components import light
from openpeerpower.components.mochad import light as mochad
from openpeerpower.setup import async_setup_component
@pytest.fixture(autouse=True)
def pymochad_mock():
"""Mock pymoc... |
import numpy as np
import tensorflow as tf
#from gym import Discrete
from rlstudy.common.utils import conv, fc, conv_to_fc, batch_to_seq, seq_to_batch
from rlstudy.common.distributions import make_pdtype
#from rlstudy.common.input import observation_input
from gym.spaces import Discrete, Box
def nature_cnn(unscaled_im... |
# Copyright 2018 The TensorFlow 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... |
# Copyright 2010-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
#
# This file is licensed under the Apache License, Version 2.0 (the "License").
# You may not use this file except in compliance with the License. A copy of the
# License is located at
#
# http://aws.amazon.com/apache2.0/
#
# This f... |
import numpy as np
from .downloader import load_trained_model
from ..parse_base import BaseParser, BaseInputExample
from .spacy_extensions import ConstituentData, NonConstituentException
import torch
class PartialConstituentData:
def __init__(self):
self.starts = [np.array([], dtype=int)]
self.e... |
r"""The objectives of secure messaging are to ensure data confidentiality, data
integrity, and authentication of the sender. Data integrity and issuer
authentication are achieved using a MAC. Data confidentiality is achieved
using encipherment of the data field.
"""
import binascii as _binascii
import sys as _sys
from... |
"""
EmojiWizard is a project licensed under GNU Affero General Public License.
Copyright (C) 2022-present Achxy
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License... |
"""Run a service that responds to pings with the address of the rabbitmq broker."""
import logging
import socket
import time
from fm_database.base import get_session
from fm_database.models.system import Interface
from fm_server.settings import get_config
from fm_server.system.info import get_ip_of_interface... |
from basic import Basic
from singleton import Singleton, S
from evalf import EvalfMixin
from numbers import Float
from sympify import _sympify
from sympy.mpmath import mpi, mpf
class Set(Basic):
"""
Represents any kind of set.
Real intervals are represented by the Interval class and unions of sets
by... |
"""
2 word commands
GO {DIRECTION}
USE {ITEM}
1 word
INVENTORY
"""
from typing import Optional, Tuple
def parse_chinese(command_text: str) -> str:
raise NotImplementedError("Maybe we should implement this someday")
def parse_short_cuts(command_text: str) -> str:
# TODO: replace command text with long f... |
import FWCore.ParameterSet.Config as cms
process = cms.Process("noiseCALIB")
process.load("CondCore.DBCommon.CondDBSetup_cfi")
process.load("Geometry.MuonCommonData.muonIdealGeometryXML_cfi")
process.load("Geometry.DTGeometry.dtGeometry_cfi")
process.DTGeometryESModule.applyAlignment = False
process.load("Geometry.... |
from pytos.models.context import Context
class RunCommand(object):
def __init__(self):
self.args = None
# return 0 if no errors
# set self.args to copy args formatted from cmdline
def parse_args(self, args) -> int:
return 0
# only call this post parse_args is called
def run(s... |
"""Utilities module."""
import base64
import hashlib
import json
import os
import traceback
from copy import copy
from datetime import datetime
from functools import wraps
from itertools import chain
from typing import Callable, List, Optional
from ratelimit import sleep_and_retry, limits
from pacu.settings import ap... |
# -*- coding: utf-8 -*-
#
# Copyright 2019 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law... |
import integ_test_base
import requests
class TestDeployModelSSLOnAuthOff(integ_test_base.IntegTestBase):
def _get_transfer_protocol(self) -> str:
return "https"
def _get_certificate_file_name(self) -> str:
return "./tests/integration/resources/2019_04_24_to_3018_08_25.crt"
def _get_key_f... |
from django.db import models
from tinymce.models import HTMLField
class School(models.Model):
"""学校"""
id = models.AutoField(primary_key=True)
name = models.CharField('名称', db_column='name', null=True, blank=True, max_length=255)
cover = models.ImageField('封面', db_column='cover', upload_to='school', n... |
# -*- coding: utf-8 -*-
"""Cisco DNA Center RunReadOnlyCommandsOnDevices data model.
Copyright (c) 2019-2021 Cisco Systems.
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, in... |
# -*- coding: utf-8 -*-
import ee
ee.Initialize()
###############################################################
# ENTER USER INPUTS HERE
###############################################################
plot_boundaries = ee.FeatureCollection() # Upload plot boundary data (e.g. using the Google Earth Engine consol... |
from tornado import gen
from machine.devices.base_device import BaseDevice
from machine.actions import action
from random import randint
import logging
logger = logging.getLogger(__name__)
REFILL = "refill"
class WaterTankState:
"""
FSM to track what state the water tank is in
"""
def __init__(sel... |
import unittest
from maritest.response import Response
class TestHttpResponse(unittest.TestCase):
def test_http_response_format(self):
response = Response(
method="GET",
url="https://jsonplaceholder.typicode.com/posts",
headers={"some_key": "some_value"},
pr... |
"""Preprocess the Vivi Ornitier model
The model is available for download from
https://sketchfab.com/models/be1e505ef3304343bf00736644730c70
The Python Imaging Library is required
pip install pillow
"""
from __future__ import print_function
import json
import os
import zipfile
from PIL import Image
from .... |
#!/usr/bin/env python
"""This demonstrates a minimal http upload cgi.
This allows a user to upload up to three files at once.
It is trivial to change the number of files uploaded.
This script has security risks. A user could attempt to fill
a disk partition with endless uploads.
If you have a system open to the public... |
"""
降順挿入ソート
<ループ不変式>
for文の各繰り返しが開始されるときには、
A[0..j-1]には、もともとA[0..j-1]に
格納されていた要素がソートされた状態で
格納されている。
初期条件(基底):
j = 1 のループが開始する直前では、A[0..j-1]は
元々A[0]に存在する要素である。
また、A[0]はソートされた状態である。
ループ内条件(帰納):
for文が行なっているのはA[j]を入れるべき場所が
見つかるまでA[j-1],A[j-2],A[j-3],..... |
#!/usr/bin/env python
from tools.load import LoadMatrix
lm=LoadMatrix()
traindat = lm.load_dna('../data/fm_train_dna.dat')
testdat = lm.load_dna('../data/fm_test_dna.dat')
parameter_list = [[traindat,testdat, 3,1.4,10,3,0,False],[
traindat,testdat, 3,1.4,10,3,0,False]]
def kernel_match_word_string (fm_train_dna=train... |
from django.db import models
from django.db.models.fields import related
from django.utils.timezone import now
from django.urls import reverse
# Create your models here.
from pathlib import Path
from django.conf import settings
import os
from functools import partial
from datetime import datetime
def _update_filena... |
import discord
import glob
from discord.ext import commands,tasks
import gspread
import random # おみくじで使用
from oauth2client.service_account import ServiceAccountCredentials
import numpy as np
import pandas as pd
import datetime
import os
import urllib.request, urllib.error
import requests
import matplotlib.... |
# coding: utf-8
###
# @file worker.py
# @author Arsany Guirguis <arsany.guirguis@epfl.ch>
#
# @section LICENSE
#
# Copyright (c) 2020 Arsany Guirguis.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to d... |
# Copyright (c) 2019 PaddlePaddle Authors. All Rights Reserve.
#
#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... |
# coding=utf-8
from __future__ import print_function
import copy
import math
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
class EncoderDecoder(nn.Module):
"""
A standard Encoder-Decoder architecture. Base for this and many
other models.
"""
def __init__(... |
"""empty message
Revision ID: 6bfa0312ba62
Revises: 5a782369bf8a
Create Date: 2021-05-10 14:49:32.300588
"""
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql
# revision identifiers, used by Alembic.
revision = '6bfa0312ba62'
down_revision = '5a782369bf8a'
branch_labels = None... |
# Copyright (c) 2020
# Author: xiaoweixiang
from pip._vendor.certifi import where
print(where())
|
from django.apps import AppConfig
from django.utils.translation import gettext_lazy as _
class UsersConfig(AppConfig):
name = "sanctuary.users"
verbose_name = _("Users")
def ready(self):
try:
import sanctuary.users.signals # noqa F401
except ImportError:
pass
|
# utils.py
# Jake Malley
# Provides utilities to be used across the application.
# Imports
import os
def load_application_configuration(application):
"""
Loads the configuration for the application,
loads the configuration in the following order:
1. Application defaults from peri2organise.config.D... |
from django.core.management import BaseCommand
from bot.tasks import get_recent_previous_launches
from celery.utils.log import get_task_logger
logger = get_task_logger('bot')
TAG = 'Digest Server'
class Command(BaseCommand):
help = 'Run Get Previous Launches manually.'
def handle(self, *args, **options):
... |
# Copyright 2019 The Texar 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 applicable ... |
# coding=utf-8
# Copyright 2021 The Deeplab2 Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law ... |
"""
Default settings for the ``mezzanine.blog`` app. Each of these can be
overridden in your project's settings module, just like regular
Django settings. The ``editable`` argument for each controls whether
the setting is editable via Django's admin.
Thought should be given to how a setting is actually used before
mak... |
from .masks import TrimapMasks
|
# Copyright (C) 2019 Google Inc.
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
"""Extended Info Page models (visible in LHN on hover over object members)."""
from lib import base
from lib.constants import locator
class ExtendedInfo(base.Component):
"""Extended Info box that allow o... |
#!/usr/bin/env python
import base_filters
COPY_GOOGLE_DOC_KEY = '170aMzV7rDuFJH6pR6eSeylIL_uTWeoG_AWp0Zl-I5oY'
USE_ASSETS = False
# Use these variables to override the default cache timeouts for this graphic
# DEFAULT_MAX_AGE = 20
# ASSETS_MAX_AGE = 300
JINJA_FILTER_FUNCTIONS = base_filters.FILTERS
|
# Generated by Django 2.0.5 on 2018-05-28 10:23
import django.contrib.gis.db.models.fields
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('bims', '0006_auto_20180529_0449'),
]
operations = [
migrations.C... |
import _plotly_utils.basevalidators
class NamelengthValidator(_plotly_utils.basevalidators.IntegerValidator):
def __init__(
self,
plotly_name='namelength',
parent_name='scattergl.hoverlabel',
**kwargs
):
super(NamelengthValidator, self).__init__(
plotly_nam... |
import sample as smp
import generate_title as gnrt
def clear_tail(data, split_char=' ', tail_length=1):
return split_char.join(data.split(split_char)[:-tail_length])
sample_txt = smp.main(gnrt.get_title(), 64, print_res=False)
final_txt = clear_tail(sample_txt, ':')
print(final_txt)
|
"""
Default base variables for defining configuration paths.
This is used by the translation loader as the settings models require using
the translator before the settings manager is created.
"""
from appdirs import user_config_dir
_FILENAME = "settings.yaml"
_APPNAME = "Napari"
_APPAUTHOR = "Napari"
_DEFAULT_LOCALE... |
# Copyright 2019 Uber Technologies, 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 applica... |
from backpack.core.derivatives.avgpool1d import AvgPool1DDerivatives
from backpack.core.derivatives.avgpool2d import AvgPool2DDerivatives
from backpack.core.derivatives.avgpool3d import AvgPool3DDerivatives
from backpack.core.derivatives.maxpool1d import MaxPool1DDerivatives
from backpack.core.derivatives.maxpool2d imp... |
'''functions for working with curves and surfaces'''
import maya.cmds as cmds
def curveFromNodes(nodeList):
'''given a list of nodes make and return a 1-degree curve passing through those transforms'''
positions = []
for node in nodeList:
positions.append(cmds.xform(node,q=True, t=True, ws=True))
... |
# -*- coding: utf-8 -*-
"""
Profile: http://hl7.org/fhir/StructureDefinition/Identifier
Release: DSTU2
Version: 1.0.2
Revision: 7202
"""
from pydantic import Field
from . import fhirtypes
from .element import Element
class Identifier(Element):
"""An identifier intended for computation.
A technical identifi... |
import os
from google.cloud import firestore
from google.cloud import vision
def photo_analysis_service(event, context):
bucket = os.environ.get('BUCKET', 'my-bmd-bucket')
file_name = event['name']
objects = _analyze_photo(bucket, file_name)
_store_results(bucket, file_name, objects)
def _analyze_... |
# Time: O(n * k)
# Space: O(k)
class Solution(object):
def kInversePairs(self, n, k):
"""
:type n: int
:type k: int
:rtype: int
"""
M = 1000000007
dp = [[0]*(k+1) for _ in range(2)]
dp[0][0] = 1
for i in range(1, n+1):
dp[i%2] = [... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.