text stringlengths 1 927k |
|---|
# Generated by Django 3.1.13 on 2021-08-18 05:33
from django.db import migrations, models
import django.db.models.deletion
import uuid
import wagtail.core.blocks
import wagtail.core.fields
import wagtail.images.blocks
class Migration(migrations.Migration):
initial = True
dependencies = [
('wagtaili... |
import os
import sys
import time
import xml.etree.ElementTree as ET
from chebi import load_chebi
from medic import load_medic
from ctd_chemicals import load_ctd_chemicals
from annotations import parse_craft_chebi_annotations, parse_cdr_annotations_pubtator
from candidates import write_candidates, generate_candidates_f... |
'''
gather redshift info across all observations for a given target type
'''
#standard python
import sys
import os
import shutil
import unittest
from datetime import datetime
import json
import numpy as np
import fitsio
import glob
import argparse
from astropy.table import Table,join,unique,vstack
from matplotlib impo... |
import pandas as pd
import sys, re, math, gzip
import numpy as np
cellLine = sys.argv[1]
doseResponse = sys.argv[2]
screenedComponents = sys.argv[3]
RACS = sys.argv[4]
variants = sys.argv[5]
expressionIn = sys.argv[6]
clinicalOut = sys.argv[7]
tmpExpression = sys.argv[8]
finalExpression = sys.argv[9]
def readSheetT... |
# -*- coding: utf-8 -*-
################################################################################
## Form generated from reading UI file 'main_pagesuUkijK.ui'
##
## Created by: Qt User Interface Compiler version 6.1.3
##
## WARNING! All changes made in this file will be lost when recompiling UI file!
##########... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Splits the preprocessed data into training, validation, and test set.
Created on Tue Sep 28 16:45:51 2021
@author: lbechberger
"""
from code.util import COLUMN_LABEL
import os, argparse, csv
import pandas as pd
from sklearn.model_selection import train_test_split
#... |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may ... |
#!/usr/bin/env python
# coding: utf-8
# In[5]:
import numpy as np
import matplotlib.pyplot as plt
from svg.path import parse_path
from svg.path.path import Line
from xml.dom import minidom
def line_splitter(start, end):
return (lambda t: (1-t)*start+t*end)
def cubic_bezier_converter(start, control1, control2,... |
import pandas as pd
import src.utils as utils
from scipy.sparse import hstack, csr_matrix
from src.core.callbacks import Callback, CallbackOrder
from src.core.states import RunningState
class SortColumnsCallback(Callback):
signature = "feature_loading"
callback_order = CallbackOrder.MIDDLE
def on_feat... |
#Importamos todo lo necesario como en el jupyter 1.0 de Ignacio
import os
import matplotlib.pylab as plt
import numpy as np
from tqdm import tqdm
import imgclas
from imgclas import paths, config
from imgclas.data_utils import load_image, load_data_splits, augment, load_class_names
#Comenzamos a preparar todos los da... |
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: POGOProtos/Networking/Requests/Messages/FortDeployPokemonMessage.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as ... |
import json
import pytest
import uuid
from copy import deepcopy
from datetime import datetime, timezone
from time import time
from unittest import TestCase
from ..please_ack_decorator import PleaseAckDecorator
MESSAGE_ID = "abc123"
ON = ("RECEIPT", "OUTCOME")
class TestPleaseAckDecorator(TestCase):
def test_i... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
import requests
# https://www.exchangerate-api.com/
# get 1 currency1 value in currency2
def get_exchange_rate(api_token: str, currency1: str, currency2: str, amount_currency1: int = 1.0):
resp = requests.get('https://v3.exchangerate-api.com/bulk/%s/%s' % (api_token, cu... |
log_level = 'INFO'
load_from = None
resume_from = None
dist_params = dict(backend='nccl')
workflow = [('train', 1)]
checkpoint_config = dict(interval=10)
evaluation = dict(interval=10, metric='mAP', key_indicator='AP')
optimizer = dict(
type='Adam',
lr=5e-4,
)
optimizer_config = dict(grad_clip=None)
# learning... |
""" Matrix Factorization for Spectrum Imaging Data Analysis
"""
# Author: Motoki Shiga, Gifu University <shiga_m@gifu-u.ac.jp>
# License: MIT
#
import numpy as np
import scipy
import matplotlib.pyplot as plt
import pandas as pd
class RandomMF(object):
"""Random Matrix Factorization
Fractorize a data matri... |
import random
import numpy as np
from easydict import EasyDict as edict
def get_default_augment_config():
config = edict()
config.do_aug = True
config.scale_factor = 0.25
config.rot_factor = 15
config.center_factor = 0.10 # 15% relative to the patch size
config.color_factor = 0.2
config.do... |
""" Unit tests for iso """
import isobar as iso
def test_pattern_add():
p1 = iso.PSequence([1, 2, 3], 1)
assert list(p1 + 1.5) == [2.5, 3.5, 4.5]
assert list(-1 + p1) == [0, 1, 2]
p2 = iso.PSequence([2, 3, 4, 5], 1)
assert list(p1 + p2) == [3, 5, 7]
def test_pattern_sub():
p1 = iso.PSequence... |
class Sm(object):
def __init__(self, session):
super(Sm, self).__init__()
self._session = session
def createNetworkSmBypassActivationLockAttempt(self, networkId: str, ids: list):
"""
**Bypass activation lock attempt**
https://developer.cisco.com/meraki/api-v1/#!create-ne... |
# Generated by Django 2.2.10 on 2020-03-18 15:35
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('majora2', '0006_auto_20200318_1535'),
]
operations = [
migrations.RenameField(
model_name='biosourcesamplingprocess',
old_n... |
# -*- coding: utf-8 -*-
# CCP in Tomographic Imaging (CCPi) Core Imaging Library (CIL).
# Copyright 2017 UKRI-STFC
# Copyright 2017 University of Manchester
# 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 ... |
import discord
import os
import sys
import random
import sqlite3
from requests import get
from discord.ext.commands import Cog, command
from time import sleep
class Fun(Cog):
def __init__(self, bot):
self.bot = bot
@command(aliases=['dankmeme'])
async def meme(self, ctx):
await ctx.send(... |
# (C) British Crown Copyright 2014 - 2020, Met Office
#
# This file is part of cartopy.
#
# cartopy is free software: you can redistribute it and/or modify it under
# the terms of the GNU Lesser General Public License as published by the
# Free Software Foundation, either version 3 of the License, or
# (at your option)... |
import numpy as np
import jax.numpy as jnp
from jax.numpy import interp
from jax import jit, partial, random, vmap
from tqdm import tqdm
import warnings
warnings.filterwarnings("ignore")
np.printoptions(precision=2)
'''
Constants
'''
# time line, starts at 20 ends at 80
T_min = 0
T_max = 60
T_R = 45
# discountin... |
# encoding: utf-8
# author: BrikerMan
# contact: eliyar917@gmail.com
# blog: https://eliyar.biz
# file: abc_embedding.py
# time: 2:43 下午
import json
from typing import Dict, List, Any, Optional, Union
import numpy as np
import tensorflow as tf
import tqdm
import kashgari
from kashgari.generators import CorpusGener... |
# encoding: utf-8
# Third Party Stuff
from django.apps import apps
from django.contrib.auth import get_user_model
from django.core.cache import cache
from django.db.models import F
from django.db.transaction import atomic
from .models import Like, Likes
cache_type = {
'object_like': 'ol:%(obj_type)s:%(obj_id)s:%... |
from flask import Flask, request, jsonify
from fastai.basic_train import load_learner
from fastai.vision import open_image
from flask_cors import CORS,cross_origin
app = Flask(__name__)
CORS(app, support_credentials=True)
# load the learner
learn = load_learner(path='./models', file='trained_model.pkl')
classes = lear... |
# This file is part of the MapProxy project.
# Copyright (C) 2010 Omniscale <http://omniscale.de>
#
# 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... |
# Generated by Django 3.2.9 on 2022-01-24 20:35
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('flowers', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name='customuser',
name='username',
... |
from dataclasses import dataclass
import commonmark
import json
import pprint
@dataclass
class Link:
url:str
text:str
def pretty(json):
pp = pprint.PrettyPrinter(indent=4, width=40, compact=False, sort_dicts=False)
return pp.pprint(json)
def markup_to_json(s):
parser = commonmark.Parser()
a... |
from fsspec import AbstractFileSystem
from fsspec.callbacks import _DEFAULT_CALLBACK
import io
import natsort
import flywheel
class FlywheelFileSystem(AbstractFileSystem):
cachable = True
_cached = False
protocol = "flywheel"
async_impl = False
root_marker = "/"
def __init__(self, hostname, a... |
from django.views.generic import CreateView, TemplateView
from django_monitor.views import MonitorMixin
class BaseAddFriendlyOwnerView(MonitorMixin, CreateView):
def get_template_names(self):
return ['livinglots/friendlyowners/add_friendlyowner.html',]
class BaseAddFriendlyOwnerSuccessView(TemplateVie... |
#!/usr/bin/python
"""Module used with classes to read the sensors on the Room Energy
Add-on board: temperature, humidity, light and CO2.
"""
from __future__ import division # do floating point div even with integers
import time
import smbus
import base_reader
import lib.tsl2591
def co2(i2c_bus):
i2c_bus.write_i2... |
class Solution:
def firstMissingPositive(self, nums: List[int]) -> int:
first_missing = 1
nums_set = set()
for item in nums:
nums_set.add(item)
while first_missing in nums_set:
first_missing += 1
return first_missing |
import os
from os import path
from .lib.htmlephant import (
Anchor,
Button,
Div,
DocumentStream,
Script,
Span,
Style,
Textarea,
)
###############################################################################
# Text File Editor
#########################################################... |
import sys
import re
from logging import warn
from types import StringTypes
from common import FormatError
TEXTBOUND_LINE_RE = re.compile(r'^T\d+\t')
KEEP_LONGER = 'keep-longer'
KEEP_SHORTER = 'keep-shorter'
OVERLAP_RULES = [KEEP_LONGER, KEEP_SHORTER]
FULL_SPAN = 'full-span'
FIRST_SPAN = 'first-span'
LAST_SPAN = ... |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may ... |
# 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
# distributed u... |
# -*- coding: utf-8 -*-
'''
:codeauthor: Nick Soracco
:copyright: © 2014 by Nick Soracco
:license: BSD
salt.grains.has_battery
~~~~~~~~~~~~~~~~~~~~~~~
Returns a boolean indicating whether (or not) the system has a battery.
FIXME: Only works in Linux, requires the acpi binary, which CentOS... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import shutil
import tempfile
import unittest
from collections import OrderedDict
from distutils.version import LooseVersion
import matplotlib
import numpy as np
from nose.tools import assert_true
from yt.frontends.stream.api import load_uniform_grid
from yt.tes... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Jul 8 16:18:07 2019
@author: Zhiyu Ye
Email: yezhiyu@hotmail.com
In London, the United Kingdom
"""
import os
import shutil
if __name__ == "__main__":
#path of the YCB Video Dataset
videopath = '/Users/zhiyu/Desktop/YCB_Video_Dataset/data'
... |
import os
from setuptools import setup
from flask_swagger_plus import __version__
readme = open('README.md').read()
CLASSIFIERS = [
'Environment :: Web Environment',
'Intended Audience :: Developers',
'License :: OSI Approved :: MIT License',
'Operating System :: OS Independent',
'Programming L... |
# Generated by Django 2.2.14 on 2020-10-29 23:43
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='InsuranceClaim',
fields=[
('ID', models.In... |
# vim: set fileencoding=utf-8 :
from nose.tools import *
import unittest
from sys import version_info as python_version
from helpers import create_osm_file
import osmium as o
class DanglingReferenceBase(object):
""" Base class for tests that try to keep a reference to the object
that was handed into the ... |
/usr/lib/python3.6/encodings/cp852.py |
# *** WARNING: this file was generated by the Pulumi Kubernetes codegen tool. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
from typing import Optional
import pulumi
import pulumi.runtime
from pulumi import Input, ResourceOptions
from ... import tables, version
... |
import logging
import sys
import uuid
import kazoo.exceptions
from kazoo.client import KazooClient
from kazoo.retry import KazooRetry
from kazoo.security import ACL, ANYONE_ID_UNSAFE, Permissions
from dcos_internal_utils import utils
if not utils.is_windows:
assert 'pwd' in sys.modules
log = logging.getLogger(_... |
from tapiriik.database import db
from tapiriik.messagequeue import mq
from tapiriik.sync import Sync
from datetime import datetime
from pymongo.read_preferences import ReadPreference
import kombu
import time
import uuid
from tapiriik.settings import MONGO_FULL_WRITE_CONCERN
Sync.InitializeWorkerBindings()
producer = ... |
"""Alembic generated code to run database migrations."""
from logging.config import fileConfig
from os import environ
from alembic import context
from sqlalchemy import engine_from_config, pool
# this is the Alembic Config object, which provides
# access to the values within the .ini file in use.
config = context.co... |
'''
lambdata - a collection of data science helper functions
'''
import numpy as np
import pandas as pd
# sample code
ONES = pd.DataFrame(np.ones(10))
ZEROS = pd.DataFrame(np.zeros(50)) |
double = lambda x: x * 2
print(double(100)) |
# Copyright (c) 2008 The Hewlett-Packard Development Company
# 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... |
# encoding=utf-8
"""
python3 test.py --tag complex_256 --dataset complex --load checkpoints/complex --which-epoch 499
"""
import os, sys
import pdb
# from dataloader.image_folder import get_data_loader_folder
from torch_template.dataloader.tta import OverlapTTA
import dataloader as dl
from network import get_mode... |
# coding: utf-8
import re
import six
from huaweicloudsdkcore.utils.http_utils import sanitize_for_serialization
class PublishAssetFromObsReq:
"""
Attributes:
openapi_types (dict): The key is attribute name
and the value is attribute type.
attribute_map (dict): The... |
from django.contrib import admin
from django.contrib.auth.admin import UserAdmin as BaseUserAdmin
from django.contrib.contenttypes.admin import GenericTabularInline
from store.admin import ProductImageInline, ProdutAdmin
from store.models import Product
from tags.models import TaggedItem
from . import models
# Regis... |
import tensorflow as tf
def merge_summaries(sd, id):
summaries = []
for key in sd.keys():
summaries.append(tf.summary.scalar(key, sd[key]))
for key in id.keys():
summaries.append(tf.summary.image(key, id[key]))
return tf.summary.merge(summaries)
def pack_images(images, rows, cols):
... |
# -*- 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):
# Adding field 'Course.full_transcript'
db.add_column('courses_course', 'full_transcript',
... |
# -*- coding: utf-8 -*-
import unittest
import time
from pprint import pprint
from flask.json import loads as json_load
from flask.json import dumps as json_dump
try:
from .test_resource_base import ActiniaResourceTestCaseBase, URL_PREFIX
except:
from test_resource_base import ActiniaResourceTestCaseBase, URL_... |
from cement import Controller, ex
from ..utils import controllerUtils
class ExportController(Controller):
class Meta:
label = 'export controls'
@ex(
help='export active collection as a file',
arguments=[
(
['-p', '--path'],
{
... |
import io
import unittest
from contextlib import redirect_stdout
from unittest.mock import patch
class TestQ(unittest.TestCase):
@patch('builtins.input', side_effect=[
'10',
'10 9.8 8 7.8 7.7 1.7 6 5 1.4 2 ',
'200 44 32 24 22 17 15 12 8 4',
])
def test_case_0(self, input_mock=None)... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2003-2010 Edgewall Software
# All rights reserved.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution. The terms
# are also available at http://trac.edgewall.org/wiki/TracLicense.
#... |
# -*- coding: utf-8 -*-
# ---------------------------------------------------------------------
# Generic.get_metrics
# ---------------------------------------------------------------------
# Copyright (C) 2007-2018 The NOC Project
# See LICENSE for details
# ------------------------------------------------------------... |
# coding: utf-8
from __future__ import absolute_import
from .base_model_ import Model
from datetime import date, datetime
from typing import List, Dict
from ..util import deserialize_model
class InlineResponse2001(Model):
"""
NOTE: This class is auto generated by the swagger code generator program.
Do no... |
"""
Definition of views.
"""
from datetime import datetime
from django.shortcuts import render, redirect
from django.http import HttpRequest
from app.models import Product, Cart, CartItem, Address, Order, OrderItem
from django.db.models import Sum
from django.contrib.auth.forms import UserCreationForm, AuthenticationF... |
import cv2
import sys
sys.path.append(".")
from glimg import detbbox as glbbox
from glimg import visualizer as glvis
image_path = "example/images/img1.jpg"
def test_draw_bbox():
img = cv2.imread(image_path)
bbox1 = [100, 100, 200, 200]
bbox2 = [150, 150, 25, 25]
img = glvis.draw_bbox(img, bbox1, wid... |
#### NOTICE: THIS FILE IS AUTOGENERATED
#### MODIFICATIONS MAY BE LOST IF DONE IMPROPERLY
#### PLEASE SEE THE ONLINE DOCUMENTATION FOR EXAMPLES
from swgpy.object import *
def create(kernel):
result = Intangible()
result.template = "object/draft_schematic/item/shared_item_ten_sided_dice.iff"
result.attribute_temp... |
"""
Training module for the project of vehicle signals recognition
Author: Filippenko Artyom, 2021-2022
MISIS Master Degree Project
"""
def main():
pass
if __name__ == '__main__':
main() |
"""Subscription API handlers."""
from typing import Dict, Union
from aiohttp import web
from dependency_injector.wiring import Provide
from newsfeed.domain.subscription import (
Subscription,
SubscriptionService,
)
from newsfeed.domain.error import DomainError
from newsfeed.containers import Container
Seri... |
"""
elasticapm.contrib.pylons
~~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2011-2017 Elasticsearch
Large portions are
:copyright: (c) 2010 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
from elasticapm.base import Client
from elasticapm.middleware import ElasticAPM as Middl... |
#copyright (c) 2020 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 l... |
from rest_framework.routers import DefaultRouter
from restaurants import views
router = DefaultRouter()
router.register(
r"restaurants",
views.RestaurantViewSet,
basename="restaurant",
)
urlpatterns = router.urls |
# coding: utf-8
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import collections
from concurrent.futures import ThreadPoolExecutor
import json
import logging
from multiprocessing import Process
import os
import random
import re
import setproctitle
import s... |
"""
R. J. Gildea, L. J. Bourhis, O. V. Dolomanov, R. W. Grosse-Kunstleve,
H. Puschmann, P. D. Adams and J. A. K. Howard:
iotbx.cif: a comprehensive CIF toolbox.
J. Appl. Cryst. (2011). 44, 1259-1263.
https://doi.org/10.1107/S0021889811041161
http://cctbx.sourceforge.net/iotbx_cif
"""
from __future__ import division
... |
import torch
from torch.autograd import Variable
"""
A fully-connected ReLU network with one hidden layer, trained to predict y from x
by minimizing squared Euclidean distance.
This implementation uses the nn package from PyTorch to build the network.
PyTorch autograd makes it easy to define computational graphs and ... |
# Configuration file for the Sphinx documentation builder.
#
# This file only contains a selection of the most common options. For a full
# list see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html
# -- Path setup --------------------------------------------------------------
# If ex... |
# Copyright 2018 Novo Nordisk Foundation Center for Biosustainability, DTU.
#
# 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... |
#!/usr/bin/env python
# defaultsdoc.py - documentation for ansible default vaules
# Copyright 2017-present Open Networking 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... |
"""
coast - Plot land and water.
"""
from pygmt.clib import Session
from pygmt.exceptions import GMTInvalidInput
from pygmt.helpers import (
args_in_kwargs,
build_arg_string,
fmt_docstring,
kwargs_to_strings,
use_alias,
)
@fmt_docstring
@use_alias(
R="region",
J="projection",
A="area_... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Author: zcy
# @Date: 2019-02-14 19:29:27
# @Last Modified by: zcy
# @Last Modified time: 2019-02-15 15:06:31
import torch
import torch.nn as nn
import torch.nn.functional as F
import math
from functools import partial
__all__ = ['ResNet', 'BasicBlock', 'Bottleneck']... |
import _plotly_utils.basevalidators
class DimensionValidator(_plotly_utils.basevalidators.CompoundValidator):
def __init__(
self,
plotly_name='dimensiondefaults',
parent_name='parcoords',
**kwargs
):
super(DimensionValidator, self).__init__(
plotly_name=plo... |
def test_termination(instance, workspace, run):
instance.launch_run(run.run_id, workspace)
assert instance.run_launcher.terminate(run.run_id)
assert not instance.run_launcher.terminate(run.run_id)
def test_missing_run(instance, workspace, run, monkeypatch):
instance.launch_run(run.run_id, workspace)
... |
from moz_books.exception.invalid_response_error import ( # noqa F401
InvalidResponseError,
)
from moz_books.exception.invalid_search_params_error import ( # noqa F401
InvalidSearchParamsError,
)
from moz_books.exception.not_found_env_value_error import ( # noqa F401
NotFoundEnvValueError,
) |
"""
This file offers the methods to automatically retrieve the graph Mycoplasma bovis.
The graph is automatically retrieved from the STRING repository.
Report
---------------------
At the time of rendering these methods (please see datetime below), the graph
had the following characteristics:
Datetime: 2021-02-02... |
from app import create_app
app = create_app()
if __name__ == '__main__':
# app.run(host='0.0.0.0', port=5000, debug="True")
app.run(port=5000) |
from typing import FrozenSet, Tuple
import pysmt.typing as types
from pysmt.environment import Environment as PysmtEnv
from pysmt.fnode import FNode
from utils import symb_to_next
from hint import Hint, Location
def transition_system(env: PysmtEnv) -> Tuple[FrozenSet[FNode], FNode, FNode,
... |
from decorators import * # noqa
from fixtures import * # noqa |
class Signal:
def __init__(self, name):
self.name = name
self.callbacks = []
def connect(self, callback):
self.callbacks.append(callback)
def disconnect(self, callback):
for index, cb in enumerate(self.callbacks):
if callback == cb:
del self.call... |
def centered_average(nums):
nums.sort()
return sum(nums[1:-1]) / (len(nums) - 2) |
"""
Given an integer array nums, find the contiguous subarray (containing at least one number)
which has the largest sum and return its sum.
"""
class Solution:
def maxSubArray(self, nums):
dp = [0] * len(nums)
dp[0] = nums[0]
for i in range(1, len(nums)):
dp[i] = max(nums[i], dp... |
# -*- coding: utf-8 -*-
# This code is part of Qiskit.
#
# (C) Copyright IBM 2019.
#
# 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 modif... |
import time
import threading
import random
from queue import Queue
from pool_workers import Pool
# Our logic to be performed Asynchronously.
def our_process(a):
t = threading.current_thread()
# just to semulate how mush time this logic is going to take to be done.
time.sleep(random.uniform(0, 3))
print(f'{t.getN... |
#Flask Imports
from flask import Flask
from flask_restful import Api
# DS Logic imports
import pandas as pd
import numpy as np
from math import radians, cos, sin, asin, sqrt
def create_app():
"""
Creates and configures an instance of our Flask API
"""
app = Flask(__name__)
app.run(debug=True)
... |
import re
import copy
from .lib import (
NOT_SET,
OverrideState
)
from . import EndpointEntity
from .exceptions import (
DefaultsNotDefined,
InvalidKeySymbols,
StudioDefaultsNotDefined,
RequiredKeyModified,
EntitySchemaError
)
from openpype.settings.constants import (
METADATA_KEYS,
... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('wagtailcore', '0040_page_draft_title'),
]
operations = [
migrations.CreateModel(
name='HomePage',
fi... |
from flask import Blueprint, render_template
main = Blueprint("main", __name__)
@main.route("/")
def index():
return render_template("index.html")
@main.route("/about")
def about():
return render_template("about.html") |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright: (c) 2013, Alexander Bulimov <lazywolf0@gmail.com>
# Based on lvol module by Jeroen Hoekx <jeroen.hoekx@dsquare.be>
# 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... |
import re
dashed_to_camel_regex = re.compile(r'(?!^)_([a-zA-Z])')
def dashed_to_camel(dashed_data):
data = {}
for key, value in dashed_data.items():
if isinstance(value, dict):
value = dashed_to_camel(value)
dashed_key = dashed_to_camel_regex.sub(
lambda match: match.... |
'''
Created on 13 Aug 2020
@author: Tobias Pielok
'''
import numpy as np
from .svd_dmd import *
from .ts_data import ts_data
from typing import List, Tuple
class dmd(object):
def __init__(self):
'''
Utility object for Dynamic-Mode-Decomposition
'''
self.Phi = None
s... |
import tensorflow as tf
import numpy as np
import dnnlib.tflib as tflib
from functools import partial
def create_stub(name, batch_size):
return tf.constant(0, dtype='float32', shape=(batch_size, 0))
def create_variable_for_generator(name, batch_size):
return tf.get_variable('learnable_dlatents',
... |
basket = ["a","b","c","d","e"]
#index
print(basket.index("b"))
#index search strat, end
print(basket.index("d",0,4))
#python keywords
print("x" in basket)
print("b" in basket)
#count
print(basket.count("d")) |
import time
import requests
def main():
headers = {
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3865.120 Safari/537.36'
}
url = "https://www.bilibili.com"
# url = "http://host.docker.internal:64150" # 与本机通信
try:
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.