text stringlengths 2 999k |
|---|
from tastypie.resources import ModelResource
from .models import Music
class MusicResource(ModelResource):
class Meta:
queryset = Music.objects.all()
resource_name = 'music'
fields = ['name', 'artist']
allowed_methods = ['get']
music_resource = MusicResource()
|
# pylint: disable=C0103
import unittest
from summ_eval.chrfpp_metric import ChrfppMetric
from summ_eval.test_util import EPS, CANDS_chrfpp, REFS_chrfpp
class TestScore(unittest.TestCase):
def test_score(self):
metric = ChrfppMetric()
score = metric.evaluate_batch(CANDS_chrfpp, REFS_chrfpp)
... |
# Copyright (C) 2016 Google Inc.
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
"""add slug to task group task
Revision ID: 3605dca868e4
Revises: 1431e7094e26
Create Date: 2015-07-14 22:06:05.063945
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by ... |
#
# Copyright (c) 2001 - 2019 The SCons Foundation
#
# 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... |
from __future__ import annotations
from typing import TYPE_CHECKING, Callable, TypeVar
from returns.interfaces.specific.reader_result import ReaderResultLikeN
from returns.primitives.hkt import Kinded, KindN, kinded
if TYPE_CHECKING:
from returns.context import ReaderResult # noqa: WPS433
_FirstType = TypeVar(... |
from abc import abstractmethod
"""
NOTES:
- Thickcrust and Thincrust are pizza, changing description and implement
your own price
- description in class Pizza is used as a default
- As an abstract method, cost should be implemented by subclasses.
It is used to formalize a contract between subclasse... |
# -*- coding: utf-8 -*-
"""
pygments.lexers.graph
~~~~~~~~~~~~~~~~~~~~~
Lexers for graph query languages.
:copyright: Copyright 2006-2019 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
import re
from pygments.lexer import RegexLexer, include, bygroups, using, this... |
# coding: utf-8
# Copyright (c) 2016, 2022, Oracle and/or its affiliates. All rights reserved.
# This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may c... |
#!/usr/bin/env python3
from bs4 import BeautifulSoup
import requests
import pickle
from spotify_api import get_IDs, create_playlist, add_tracks_to_playlist, update_playlist, read_playlist
from tools import update_adw, get_weekly_filename_and_ID, add_to_playlist_archive, get_names, sortTrackHighlights
import constants
... |
# -*- coding: utf-8 -*-
"""Document engine here.
Copyright (C) 2020, Auto Trader UK
Created 15. Dec 2020 14:45
"""
from pathlib import Path
from typing import List, Union
import olivertwist
from olivertwist.config.model import Config, Severity
from olivertwist.manifest import Manifest
from olivertwist.ruleengine.dis... |
'''
Gimbal demo with classical PID support,
@usage Change parameters at the start of main according to your hardware
like camera and lcd direction, PID parameters etc.
@update https://github.com/sipeed/MaixPy_scripts
@author neucrack@sipeed
@license MIT
'''
import time, sys
from machin... |
# 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
__a... |
import osgtest.library.core as core
import osgtest.library.files as files
import osgtest.library.mysql as mysql
import osgtest.library.osgunittest as osgunittest
import osgtest.library.service as service
class TestStopSlurm(osgunittest.OSGTestCase):
def slurm_reqs(self):
core.skip_ok_unless_installed(*cor... |
# Author: reiven
# github: https://github.com/DXMarkets/Savoir
import requests
import json
from base64 import b64encode
import logging
import time
log = logging.getLogger('Savoir')
log.setLevel('WARNING')
class Savoir():
__id_count = 0
__MAX = 100000
def __init__(self,
rpcuser,
... |
from django.utils.translation import ugettext_lazy as _
from mayan.apps.document_states.classes import WorkflowAction
from mayan.apps.documents.models.document_page_models import DocumentPage
from mayan.apps.templating.classes import Template
from .models import DocumentPageOCRContent
__all__ = ('UpdateDocumentPageO... |
def checkType(arr, n=2):
# If the first two and the last two elements
# of the array are in increasing order
if arr[0] <= arr[1] and arr[n - 2] <= arr[n - 1]:
return True
# If the first two and the last two elements
# of the array are in decreasing order
elif arr[0] >= arr[1] and arr[n... |
# Created by Egor Kostan.
# GitHub: https://github.com/ikostan
# LinkedIn: https://www.linkedin.com/in/egor-kostan/
def disemvowel(string):
"""
A function that takes a string and return
a new string with all vowels removed.
For example, the string "This website is
for losers LOL!" would become "Ths wbst s fr... |
# Copyright 2018 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 ... |
from setuptools import setup
setup(
name='wp_sorter',
packages=['wp_sorter'],
include_package_data=True,
install_requires=[
'flask',
],
)
|
def count_by_weekday(start_date, end_date):
"""
returns a list of length 7 with the number of occurrences of each day over a given period
:param start_date: first day of the period
:type start_date: datetime.datetime
:param end_date: first day after the period
:type end_date: datetime.datetim... |
# 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... |
from AST.Nodo import Nodo
import data.jsonMode as JM
import Errores.Nodo_Error as err
from prettytable import PrettyTable
class CreateDatabase(Nodo):
def __init__(self, fila, columna, nombre_BD, or_replace = False, if_not_exist =False, owner = None, mode = 1):
super().__init__(fila, columna)
self.n... |
# -*- coding: utf-8 -*-
"""
Copyright (c) 2019 Valentin B.
A simple music bot written in discord.py using youtube-dl.
Though it's a simple example, music bots are complex and require much time and knowledge until they work perfectly.
Use this as an example or a base for your own bot and extend it as you want. If there... |
from __future__ import absolute_import, division, print_function
import sys,os
from libtbx.utils import Sorry
from cctbx.array_family import flex
from copy import deepcopy
from cctbx.array_family import flex
import scitbx.lbfgs
import math
from cctbx.maptbx.segment_and_split_map import map_and_b_object
from six.moves... |
import sys
import redis
from rdbtools import RdbCallback, JSONCallback, RdbParser
from rediscluster import RedisCluster
targethost = '127.0.0.1'
class MyCallback(RdbCallback):
_redisclient = None
def __init(self, string_escape=None):
super(MyCallback, self).__init__(string_escape)
def start_data... |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, print_function
import tensorflow as tf
import numpy as np
from niftynet.engine.handler_early_stopping import check_should_stop
from tests.niftynet_testcase import NiftyNetTestCase
class EarlyStopperTest(NiftyNetTestCase):
def test_mean(self):
... |
# -*- coding: utf-8 -*- #
# Copyright 2016 Google LLC. 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... |
# mylib.py
import logging
def do_something():
logging.info('Doing something')
|
from musurgia.fractaltree.fractalmusic import FractalMusic
fm = FractalMusic(tempo=72, quarter_duration=10)
fm.add_layer()
copied = fm.__deepcopy__()
print(fm.get_children()) |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.4 on 2017-01-03 07:09
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('data_storage_management', '0003_auto_20170102_0722'),
]
operations = [
migr... |
#!/usr/bin/env python
#
# Copyright (c) 2018, The OpenThread Authors.
# 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
# ... |
# -*- coding: utf-8 -*-
# Generated by Django 1.10 on 2017-09-15 08:54
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('students', '0006_auto_20170822_2303'),
]
operations ... |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
from __future__ import absolute_import, division, print_function, unicode_literals
import logging
import math
import torch
import torch.nn.f... |
# -*- coding: utf-8 -*-
# This file is part of beets.
# Copyright 2016, Adrian Sampson.
#
# 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 t... |
"""
Parser and utilities for the smart 'if' tag
"""
# Using a simple top down parser, as described here:
# http://effbot.org/zone/simple-top-down-parsing.htm.
# 'led' = left denotation
# 'nud' = null denotation
# 'bp' = binding power (left = lbp, right = rbp)
class TokenBase:
"""
Base class for... |
##########################################################################
#
# Copyright (c) 2011-2012, Image Engine Design 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:
#
# * Redi... |
import pandas as pd
import matplotlib.pyplot as plt
from pandas.plotting import register_matplotlib_converters
from sklearn.tree import export_graphviz
import seaborn as sns
from subprocess import call
from sklearn.decomposition import PCA
from mpl_toolkits.mplot3d import Axes3D
import numpy as np
from sklearn.neighbor... |
# coding=utf-8
# Copyright 2018 Google AI, Google Brain and the HuggingFace Inc. team.
#
# 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
#
# U... |
from Acquire.ObjectStore import Function
import pytest
def _test_sum(a, b):
return a + b
def test_function():
f = Function(_test_sum)
assert(f(a=1, b=3) == 4)
data = f.to_data()
g = Function.from_data(data)
assert(g(a=1, b=3) == 4)
f = Function(_test_sum, b=10)
assert(f(a=1)... |
import os
import pickle
import time
from bokeh.embed import components, autoload_static
from django.core.files.storage import FileSystemStorage
from django.shortcuts import render
from django.views.decorators.cache import never_cache
from config import paths
from descr import descr_main
from matchers.structure.s_matc... |
# -*- coding: utf-8 -*-
"""
Created on Thu Apr 28 12:48:01 2022
@author: LENOVO
"""
from chaospy import distributions as shape
import biosteam as bst
from biorefineries.ozonolysis.SUD_project import WCO_sys,R101,R103
|
print("Challenge 43: Write a Python program to test whether two lines PQ and RS are parallel. The four points are P(x1, y1), Q(x2, y2), R(x3, y3), S(x4, y4).")
print("Input x1,y1,x2,y2,x3,y3,xp,yp:")
x1, y1,x2, y2, x3, y3, x4, y4 = map(float, input().split())
print('PQ and RS are parallel.' if abs((x2 - x1)*(y4 - y3) ... |
# Copyright 2014-2015 F5 Networks 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 ... |
class Solution(object):
def countPoints(self, points, queries):
"""
:type points: List[List[int]]
:type queries: List[List[int]]
:rtype: List[int]
"""
num_queries = len(queries)
num_pts = len(points)
res = []
count = 0
# for i in range(... |
import os
import argparse
from datetime import datetime
import asyncio
from dotenv import load_dotenv
from aiofile import AIOFile
DELAY_TO_CONNECT = 5
def get_args(host, port, logs):
'''Parses arguments from CLI.'''
parser = argparse.ArgumentParser(description='Undergroung Chat CLI')
parser.add_argumen... |
"""Console and cursor control."""
from contextlib import contextmanager
from sys import stdin
from termios import TCSANOW, tcgetattr, tcsetattr
from tty import setcbreak
from typing import Optional
from .ansi import (
device_status_report_escape,
read_ansi_response,
set_cursor_position_escape,
)
from .posi... |
import os
import json
import datetime
import pandas as pd
from libcity.utils import ensure_dir
from libcity.model import loss
from logging import getLogger
from libcity.evaluator.abstract_evaluator import AbstractEvaluator
class TrafficStateEvaluator(AbstractEvaluator):
def __init__(self, config):
self.m... |
__author__ = 'github.com/wardsimon'
__version__ = '0.1.0'
import pytest
import itertools
from easyCore.Objects.Base import Descriptor, Parameter
from easyCore.Elements.Basic.SpaceGroup import SpaceGroup, SG_DETAILS
from easyCore.Symmetry.groups import SpaceGroup as SG
def test_SpaceGroup_fromDescriptor():
sg_i... |
# Copyright (c) 2021 War-Keeper
from discord.ext import commands
# ----------------------------------------------------------------------------------------------
# Returns the ping of the bot, useful for testing bot lag and as a simple functionality command
# ----------------------------------------------------------... |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
from fairseq.models.nat import NATransformerModel, base_architecture
from fairseq.models import register_model, register_model_archite... |
from __future__ import absolute_import, division, print_function, unicode_literals
# local imports
from reflectivity_ui.interfaces.data_handling.filepath import RunNumbers, FilePath
# 3rd-party imports
import pytest
def assert_equal_arrays(actual , expected):
assert len(actual) == len(expected)
assert all([... |
def fuel(x):
tot = 0
while True:
f = x//3 - 2
if f <= 0:
break
x = f
tot += f
return tot
input = """
123265
68442
94896
94670
145483
93807
88703
139755
53652
52754
128052
81533
56602
96476
87674
102510
95735
69174
136331
51266
148009
72417
52577
86813
60803
14923... |
def calculate_performance(y_actual, y_hat):
TP = 0
FP = 0
TN = 0
FN = 0
for i in range(len(y_hat)):
if y_hat[i] == y_actual[i] ==1:
TP += 1
if y_hat[i] == 1 and y_actual[i] == 0:
FP += 1
if y_hat[i] == y_actual[i] == 0:
TN += 1
if... |
from django.urls import path
from . import views
app_name = 'rest_auth'
urlpatterns = [
path('drf-token/', views.CreateDRFTokenView.as_view(), name='drf-token'),
]
|
import time
import random
import threading as thread
import uuid
from typing import List, Dict
import libs.game as lgame
import bots.game as bgame
from slackapi.payload import get_mentioned_string, build_payload, build_info_str, card_to_emoji, build_prompt_payload
from .poker_bot import PokerBot
from .player import Pla... |
import torch
import utils
from utils.hparams import hparams
from .diff.net import DiffNet
from .diff.shallow_diffusion_tts import GaussianDiffusion, OfflineGaussianDiffusion
from .diffspeech_task import DiffSpeechTask
from vocoders.base_vocoder import get_vocoder_cls, BaseVocoder
from modules.fastspeech.pe import Pitc... |
# -*- coding: utf-8 -*-
# @Author : William
# @Project : TextGAN-william
# @FileName : RelGAN_D.py
# @Time : Created at 2019-04-25
# @Blog : http://zhiweil.ml/
# @Description :
# Copyrights (C) 2018. All Rights Reserved.
import math
import torch
import torch.autograd as autograd
import... |
# Получение данных относительно html-документов
from bs4 import BeautifulSoup
# Рассмотрим наш код
html_string = """
<!DOCTYPE html>
<html>
<head>
<title>Web Development Page</title>
<style type="text/css">
h1{
color: white;
background: red;
... |
import os
from serial import Serial
import time
import numpy as np
from PIL import Image, JpegImagePlugin
import io
# Default Serial settings
PORT = "COM4"
BAUDRATE = 921600
TIMEOUT = 1
# Image types
YUV = 0
JPEG = 1
YUV_SIZE = [96, 96]
# JPEG Compressions
Compression_Off = 0
Compression_1 = 1
Compression_2 = 2
Com... |
# Copyright 2014 Scalyr 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 writing, so... |
# -*- coding: utf-8 -*-
"""
Created on Mon Feb 25 09:37:23 2019
@author: if715029
"""
# limpieza de base de datos y manejod de texto
import pandas as pd
import string
from datetime import datetime
#%% Importar tabla
dirty = pd.read_csv('../data//dirty_data_v3.csv', encoding='latin-1')
#%% Funcion para retirar signo... |
#!/usr/bin/env python3
import os
import torch
from setuptools import setup, find_packages
from torch.utils.cpp_extension import BuildExtension, CUDAExtension
cxx_args = ['-std=c++11']
nvcc_args = [
'-gencode', 'arch=compute_50,code=sm_50',
'-gencode', 'arch=compute_52,code=sm_52',
'-gencode', 'arch=compu... |
#
# Example file for working with date information
#
from datetime import date, time, datetime
def main() -> None:
## DATE OBJECTS
# Get today's date from the simple today() method from the date class
today = date.today()
print("Today's date is", today)
# Print out the date's individual componen... |
from ._abc import TimerRequest, InputStream, Context, Out # NoQA
from ._eventhub import EventHubEvent # NoQA
from ._eventgrid import EventGridEvent # NoQA
from ._cosmosdb import Document, DocumentList # NoQA
from ._http import HttpRequest # NoQA
from ._http import HttpResponse # NoQA
from ._queue import QueueMess... |
# -*- coding: utf-8 -*-
# Copyright 2014-2016 OpenMarket Ltd
# Copyright 2020 The Matrix.org Foundation C.I.C.
#
# 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/li... |
from openpyxl import load_workbook
filename = 'aalh_iit_transportation_004.xlsx'
wb = load_workbook(filename)
ws = wb['Metadata Template']
minimumcol = 8
maximumcol = 8
minimumrow = 7
maximumrow = 533
iterationrow = 7
desccol = 8
targetcol = 13
rawcovcol = 49
covcol = 10
titlecol = 2
for row in ws... |
import numpy as np
import scipy.stats as sps
import matplotlib.pyplot as plt
class UCB1:
''' Representation of a single agent bandit problem and a method to run the UCB1 algorithm on this problem
Attributes
----------
T: The number of time steps the UCB1 algorithm will run for.
ar... |
import sys
import random
import kolab.pj.piece as piece
#tokenize_pj = piece.load_tokenizer('aoj8k.model')
tokenize_pj = piece.load_tokenizer()
def read_corpus(filename):
pj = ''
D = {}
c = 0
with open(filename) as f:
for line in f.readlines():
if line.startswith('#'):
... |
def f(param):
"""
Args:<caret>
""" |
import pytest
from jupyblog import util
md_in = """
```python
```
```python id=hi
```
```python
```
"""
md_out = """
```python
```
```
{{ '0' }}
```
```python id=hi
```
```
{{ '1' }}
```
```python
```
```
{{ '2' }}
```
"""
@pytest.mark.xfail
def test_add_output_tags():
assert util.add_outp... |
from gym.envs.registration import register
register(
id='deepracer-v0',
entry_point='gym_deepracer.envs:DeepRacerEnv',
)
register(
id='deepracerDiscrete-v0',
entry_point='gym_deepracer.envs:DeepRacerEnvDiscrete',
) |
"""A class that performs simulations."""
import sys
import os
import gc
import json
from time import time
import math
import tensorflow as tf
import sklearn
import numpy as np
from simulator.graph.simulator_graph import SimulatorGraph
from simulator import simulator_utils as s_utils
from simulator.exceptions import I... |
# Copyright 2020 The SQLFlow 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 law o... |
import torch.utils.data as data
import os
import os.path
import numpy as np
from numpy.random import randint
import torch
from colorama import init
from colorama import Fore, Back, Style
import random
from os import listdir
from os.path import join, splitext
import numpy as np
import torch
import torch.nn.functiona... |
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------... |
# This file is part of the Reproducible and Reusable Data Analysis Workflow
# Server (flowServ).
#
# Copyright (C) 2019-2021 NYU.
#
# flowServ is free software; you can redistribute it and/or modify it under the
# terms of the MIT License; see LICENSE file for more details.
"""Pytest fixtures for unit tests."""
impor... |
from setuptools import setup
setup(name="evgen",
author = "Michal Zylinski",
author_email = "michal.zylinski@gmail.com",
license = "MIT",
url="https://github.com/MichalZylinski/evgen",
version="0.7",
description="Comprehensive event generation framework",
packages=['evgen', ... |
#!/usr/bin/env python3
# Copyright (c) 2015-2017 The Pizcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test BIP65 (CHECKLOCKTIMEVERIFY).
Test that the CHECKLOCKTIMEVERIFY soft-fork activates at (regtest) b... |
#!/usr/bin/env python
#
# Copyright (c) 2016 In-Q-Tel, 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
#
#... |
# pylint:disable=line-too-long
"""
The tool to check the availability or syntax of domain, IP or URL.
::
██████╗ ██╗ ██╗███████╗██╗ ██╗███╗ ██╗ ██████╗███████╗██████╗ ██╗ ███████╗
██╔══██╗╚██╗ ██╔╝██╔════╝██║ ██║████╗ ██║██╔════╝██╔════╝██╔══██╗██║ ██╔════╝
██████╔╝ ╚████╔╝ █████╗ ██║ ... |
# coding=utf-8
# Copyright 2021-present, the Recognai S.L. team.
#
# 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 ... |
#!/usr/bin/env python
# coding: UTF-8
'''
Created on 2013/06/28 (based on matrix_transform_make.py)
@author: Naoto Hori
'''
import numpy as np
from numpy import identity, dot
from math import cos, sin
class mtx_crd_transform():
def __init__(self):
self.mtx = identity(4)
def reset(self):
... |
import json
import logging
import uuid
import aiohttp
import discord
import discord.ext.commands as commands
from discord.ext.commands.errors import UserInputError
import bot.bot_secrets as bot_secrets
import bot.extensions as ext
from bot.consts import Colors
from bot.messaging.events import Events
log = logging.ge... |
from django.shortcuts import render, redirect
from portfolio.models import Project
from portfolio.forms import ProjectForm
# Create your views here.
def home(request):
template = 'home.html'
context = {}
method = request.method
if method == 'GET':
projects = Project.objects.all()
proje... |
# coding: utf-8
import re
import six
from huaweicloudsdkcore.utils.http_utils import sanitize_for_serialization
class ShowFunctionTriggerRequest:
"""
Attributes:
openapi_types (dict): The key is attribute name
and the value is attribute type.
attribute_map (dict):... |
import re
__product__ = "IBM Security Access Manager (WebSEAL)"
def detect(content, **kwargs):
content = str(content)
detection_schema = (
re.compile(r"\bWebSEAL\b", re.I), re.compile(r"\bIBM\b", re.I)
)
for detection in list(detection_schema):
if detection.search(content) is not Non... |
# Lint as: python3
# Copyright 2019 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 ... |
"""
Example queries of a CRCNS data RDF graph.
"""
import os
import pathlib
from odml.tools.rdf_converter import ODML_NS
from rdflib import Graph, Namespace, RDF, RDFS
from rdflib.plugins.sparql import prepareQuery
# Prepare graph from RDF file.
CURR_PATH = pathlib.Path(__file__).parent.resolve()
FILE_NAME = "rdf_c... |
# Copyright (C) 2015 Google Inc., authors, and contributors <see AUTHORS file>
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
# Created By: ivan@reciprocitylabs.com
# Maintained By: ivan@reciprocitylabs.com
from integration.ggrc.api_helper import Api
from ggrc.models.person import Perso... |
# This code is part of Qiskit.
#
# (C) Copyright IBM 2021.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
#
# Any modifications or derivative wo... |
""" Logging functions for the mkrefs
This module configures the logger for the jwst_reffiles package.
It also provides decorators to log the execution of modules. This code is
based on the JWQL package logging configuration code.
Authors
-------
- Bryan Hilbert 2018
- Catherine Martlin 2018 (JWQL version)
... |
#-*- coding:utf-8 -*-
from .chain import Chain, Fraction
|
#!/usr/bin/env python 3
# -*- coding: utf-8 -*-
#
# Copyright (c) 2020 PanXu, Inc. All Rights Reserved
#
"""
模型组件注册器
Authors: PanXu
Date: 2020/10/27 15:03:00
"""
from easytext.component import ComponentBuiltinKey
from easytext.component.register import ComponentRegister
from easytext.component.register.component_... |
from itertools import product
import numpy as np
import pytest
from pandas.core.dtypes.common import is_interval_dtype
import pandas as pd
import pandas._testing as tm
# Each test case consists of a tuple with the data and dtype to create the
# test Series, the default dtype for the expected result (which is valid
... |
import importlib
from fhirbug.exceptions import ConfigurationError
from fhirbug.config.utils import LazySettings
settings = LazySettings()
def import_models():
"""
Dynamic import of the models module based on the backend selected in the configuration
"""
global settings
if not settings:
... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from html.parser import HTMLParser
from urllib.request import Request, urlopen
from urllib.parse import urlencode, urljoin
BA_URL = 'http://beeradvocate.com'
class ResultParser(HTMLParser):
def __init__(self, *args, **kwargs):
self.parsing = False
... |
from datetime import date, datetime, timedelta
from functools import partial
from io import BytesIO
import os
import numpy as np
import pytest
import pandas.util._test_decorators as td
import pandas as pd
from pandas import DataFrame, Index, MultiIndex, get_option, set_option
import pandas._testing as tm
from panda... |
import scipy
import scipy.stats as ss
import numpy as np
import matplotlib
import pandas as pd
import random
import math
def iqr_threshold_method(scores, margin):
q1 = np.percentile(scores, 25, interpolation='midpoint')
q3 = np.percentile(scores, 75, interpolation='midpoint')
iqr = q3-q1
lower_range =... |
# Copyright 2021 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, ... |
from .document_content_type import DocumentContentType
__all__ = [
'DocumentContentType',
]
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.