text stringlengths 2 999k |
|---|
import click
from agent.cli.prompt.pipeline.schemaless import SchemalessPrompter
class CactiPrompter(SchemalessPrompter):
def prompt_config(self):
self.config['timestamp'] = {}
self.config['timestamp']['type'] = 'unix'
self.prompt_step()
self.prompt_interval('Polling interval in s... |
import logging
from typing import ( # noqa: F401
TYPE_CHECKING,
Any,
Callable,
Dict,
List,
NoReturn,
Optional,
Sequence,
Tuple,
Union,
)
import uuid
from uuid import UUID
from eth_utils.toolz import (
pipe,
)
from htdfsdk.web3._utils.decorators import (
deprecated_for,... |
# Accompanying blog post:
# http://www.jeffwidman.com/blog/847/
from sqlalchemy.ext import compiler
from sqlalchemy.schema import DDLElement
from .. import db
class CreateView(DDLElement):
def __init__(self, name, selectable):
self.name = name
self.selectable = selectable
@compiler.compiles(Cre... |
# -*- coding: utf-8 -*-
# Copyright (C) 2008-2020 Mag. Christian Tanzer. All rights reserved
# Glasauergasse 32, A--1130 Wien, Austria. tanzer@swing.co.at
# ****************************************************************************
#
# This module is licensed under the terms of the BSD 3-Clause License
# <http://www.... |
# Copyright 2014 VMware, 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... |
# -*- coding: utf-8 -*-
# SPDX-License-Identifier: BSD-3-Clause
from .estimation import hubness_score
__all__ = ["hubness_score"]
|
import string
import time
from dagster import (
InputDefinition,
Int,
OutputDefinition,
PartitionSetDefinition,
ScheduleDefinition,
SkipReason,
lambda_solid,
pipeline,
repository,
sensor,
solid,
usable_as_dagster_type,
)
@lambda_solid
def do_something():
return 1
... |
import unittest
import os
import sys
import logging
from io import StringIO
from ruamel.yaml import YAML
from compiler.compiler import compile, init
from compiler.utils.configs import load_compiler_config
from compiler.tests.sample_dicts import *
log = logging.getLogger('testing-compiler')
log.setLevel(logging.DEBUG)... |
# Copyright 2021 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 agreed to... |
# Copyright 2020 Valentin Gabeur
#
# 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... |
#!/usr/bin/env python3
# Copyright 2017-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
"""DrQA Document Reader model"""
import torch
import torch.optim as optim
import torch.nn.functional as F
imp... |
import ase
from ase.visualize import view
import flatgraphene as fg
#test number of atoms in a cell
n_21_78 = 28 #number of atoms in hexagonal cell of 21.78 degree twist angle
p_found, q_found, theta_comp = fg.twist.find_p_q(21.79)
atoms = fg.twist.make_graphene(cell_type='hex',n_layer=2,
... |
import onfido
api = onfido.Api("<AN_API_TOKEN>")
webhook_details = {
"url": "https://<URL>",
"events": [
"report.completed",
"check.completed"
]
}
fake_uuid = "58a9c6d2-8661-4dbd-96dc-b9b9d344a7ce"
def test_create_webhook(requests_mock):
mock_create = requests_mock.post("https://api.onfido.com/v3... |
"""Supervisr DNS Signals"""
import logging
from datetime import datetime
from typing import List
from django.db.models.signals import post_save
from django.dispatch import receiver
from supervisr.core.signals import RobustSignal
from supervisr.dns.models import BaseRecord, Zone
LOGGER = logging.getLogger(__name__)
... |
'''
SLab Example
Example_02.py
Prints all ADC voltages
'''
# Locate slab in the parent folder
import sys
sys.path.append('..')
sys.path.append('.')
import slab
# Set prefix to locate calibrations
slab.setFilePrefix("../")
# Autodetects serial communication
slab.connect()
# Print ADC vol... |
#from . import bwt901cl |
import re
from datetime import datetime, date
from urllib.parse import urlsplit, urlunsplit
import pickle
from crispy_forms.bootstrap import InlineRadios, InlineCheckboxes
from crispy_forms.helper import FormHelper
from crispy_forms.layout import Layout
from django.db.models import Count
from dateutil.relativedelta im... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.response.AlipayResponse import AlipayResponse
from alipay.aop.api.domain.MultiBundleAppServiceResult import MultiBundleAppServiceResult
class AlipayOpenMiniServiceBundleQueryResponse(AlipayResponse):
def __init__(self):
super(... |
"""Provides a common base for configurator proxies"""
import logging
import os
import shutil
import tempfile
from certbot import constants
from certbot_compatibility_test import util
logger = logging.getLogger(__name__)
class Proxy(object):
# pylint: disable=too-many-instance-attributes
"""A common base fo... |
import argparse
import os
if __name__ == "__main__":
parser = argparse.ArgumentParser()
parser.add_argument("--videopath", help="")
parser.add_argument("--gifpath", help="")
parser.add_argument("--ss", help="")
parser.add_argument("--t", help="")
config = parser.parse_args()
bashCo... |
# Generated by Django 2.2.1 on 2019-05-25 09:22
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('main', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name='sight',
name='price',
field=... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# kernellib documentation build configuration file, created by
# sphinx-quickstart on Tue Jul 9 22:26:36 2013.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# a... |
import numpy as np
import torch
import torch.nn as nn
from cbam import cbam, cbam_channel
class Generator_v3(nn.Module):
def __init__(self, img_size=64, latent_length=64, hidden_length=256):
super(Generator_v3, self).__init__()
self.init_size = img_size // 4
self.latent = latent_length
... |
# 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 required by applicable law or a... |
"""
LANG_INFO is a dictionary structure to provide meta information about languages.
About name_local: capitalize it as if your language name was appearing
inside a sentence in your language.
The 'fallback' key can be used to specify a special fallback logic which doesn't
follow the traditional 'fr-ca' -> 'fr' fallbac... |
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... |
import devpkg
import unittest
class TestCase(unittest.TestCase):
def test_(self):
self.assertTrue(devpkg)
|
from django.contrib.auth.models import ContentType
from drf_yasg.utils import swagger_serializer_method
from rest_framework import serializers
from netbox.api import ChoiceField, ContentTypeField
from netbox.api.serializers import NestedGroupModelSerializer, PrimaryModelSerializer
from tenancy.choices import ContactPr... |
import sys
import mysql.connector
from openpyxl import Workbook
from reportlab.pdfgen import canvas
import tkinter
from tkinter import messagebox
try:
import Tkinter as tk
except ImportError:
... |
import csv
import json
from .utils import timer
from . import project_data
def load_command_summary():
commands_json_path = project_data / "commands.json"
with open(commands_json_path) as jsonfile:
commands_summary = json.load(jsonfile)
return commands_summary
def load_command():
"""
l... |
#!/usr/bin/env python
#-----------------------------------------------------------------------------
# Copyright (c) 2012 - 2018, Anaconda, Inc. and Intake contributors
# All rights reserved.
#
# The full license is in the LICENSE file, distributed with this software.
#--------------------------------------------------... |
import unittest
from wheatley.stroke import Stroke, HANDSTROKE, BACKSTROKE
class StrokeTests(unittest.TestCase):
def test_equality(self):
for i in [True, False]:
for j in [True, False]:
# Strokes containing `i` and `j` should be equal precisely when `i == j`
sel... |
var1=input("This is input testing")
print(var1) |
#!/usr/bin/env python3
# Tests check_format.py. This must be run in a context where the clang
# version and settings are compatible with the one in the Envoy
# docker. Normally this is run via check_format_test.sh, which
# executes it in under docker.
from __future__ import print_function
from run_command import run... |
# Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
"""Test YAML serialization for specs.
YAML format preserves DAG information in the spec.
"""
import ast
import inspect
i... |
# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License.
# This product includes software developed at Datadog (https://www.datadoghq.com/).
# Copyright 2019-Present Datadog, Inc.
import re # noqa: F401
import sys # noqa: F401
from datadog_api_client.v1.model_uti... |
# my_lambdata/assignment_w_inherit.py
# Inheritance
import pandas
class MyFrame(pandas.DataFrame):
def inspect_data(self):
print(self.head())
def add_state_names(self):
"""
State abbreviation -> Full Name and visa versa.
FL -> Florida, etc.
"""
names_map = {
... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
from guid_core.generate_GUID import generate_GUID2
import unittest
GUID = generate_GUID2('Jean-Michel', "Frégnac", '1949-03-22', 'M')
class TestUM(unittest.TestCase):
def setUp(self):
pass
def test_guid(self):
nom = 'Jean-Michel'
prenom = ... |
# Copyright 2016 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 applica... |
import pytest
from django.test import TestCase
from django.test import override_settings
import ozpcenter.api.category.model_access as model_access
from ozpcenter.models import Category
from tests.cases.factories import CategoryFactory
@pytest.mark.model_access
@override_settings(ES_ENABLED=False)
class CategoryTest... |
# -*- coding: utf-8 -*-
"""
flask.helpers
~~~~~~~~~~~~~
Implements various helpers.
:copyright: © 2010 by the Pallets team.
:license: BSD, see LICENSE for more details.
"""
import io
import os
import socket
import sys
import pkgutil
import posixpath
import mimetypes
from time import time
from zlib... |
# Copyright 2018-present Kensho Technologies, LLC.
import random
from .events import EVENT_NAMES_LIST
from .species import FOOD_LIST, SPECIES_LIST
from .utils import (
create_edge_statement, create_name, create_vertex_statement, extract_base_name_and_label,
get_random_date, get_random_net_worth, get_uuid
)
N... |
from setuptools import setup, find_packages
import coppertop.core
# read the contents of README.md file
from os import path
this_directory = path.abspath(path.dirname(__file__))
with open(path.join(this_directory, 'README.md'), encoding='utf-8') as f:
long_description = f.read()
version = coppertop.core.version
... |
import sys, csv, pysam, os
from File_Output import SiteToJSON
import json
import multiprocessing as mp
from Params import stats_params
class JSONSerializable(object):
def __repr__(self):
return json.dumps(self.__dict__, default = lambda o: o.__dict__)
class Site(JSONSerializable):
"""
Class ... |
import numpy as np
np.random.seed(42)
A = np.random.randint(0, 10, size=(2,2))
B = np.random.randint(0, 10, size=(2,3))
C = np.random.randint(0, 10, size=(3,3))
print("Matrix A is:\n{}, shape={}\n".format(A, A.shape))
print("Matrix B is:\n{}, shape={}\n".format(B, B.shape))
print("Matrix C is:\n{}, shape={}\n".f... |
%matplotlib inline
import numpy as np
import matplotlib.pyplot as plt
#plot exponential curve from 0 to 2pi
t = np.linspace(0,2*np.pi,100)
plt.plot(t,np.exp(t),'m', label = 'Exponential Curve')
plt.title('Plot of $e^x$')
plt.xlabel('t (s)')
plt.ylabel('$y(t)$')
plt.legend()
plt.grid()
plt.text(2.5,0.25,'This is a \nE... |
from re import findall
# Set indexing of word
def get_index(word):
word = list(word)
return [word.index(x) for x in word]
def remap(plainword, cipherword):
for p, c in zip(plainword, cipherword):
if az[c] is None:
az[c] = p
# Setup list of words
with open('dictionary.lst', 'r') as f:
... |
# (c) 2018, Scott Buchanan <sbuchanan@ri.pn>
# (c) 2016, Andrew Zenk <azenk@umn.edu> (test_lastpass.py used as starting point)
# 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
import json... |
from setuptools import setup
import io
# read the contents of your README file
from os import path
this_directory = path.abspath(path.dirname(__file__))
with io.open(path.join(this_directory, "README.md"), encoding="utf-8") as f:
long_description = f.read()
setup(
name="arduino-udev",
description="Get a... |
# coding: utf-8
"""
Isilon SDK
Isilon SDK - Language bindings for the OneFS API # noqa: E501
OpenAPI spec version: 3
Contact: sdk@isilon.com
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import unittest
import isi_sdk_8_0
from isi... |
""" Module FSA -- methods to manipulate finite-state automata
Created by: Oliver Steele // Modified and enlarged by: Roser Sauri
This module defines an FSA class, for representing and operating on
finite-state automata (FSAs). FSAs can be used to represent regular expressions
and to test sequences for membership in ... |
"""attributes constraint and icons
Revision ID: 72758d0c5410
Revises: e3e8aae9d6f6
Create Date: 2021-10-03 13:23:52.777036
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = "72758d0c5410"
down_revision = "e3e8aae9d6f6"
branch_labels = None
depends_on = None
def... |
"""
Web socket API for Zigbee Home Automation devices.
For more details about this component, please refer to the documentation at
https://home-assistant.io/components/zha/
"""
import logging
import voluptuous as vol
from homeassistant.components import websocket_api
from homeassistant.const import ATTR_ENTITY_ID
im... |
from portality import models
# first thing to do is delete suggestions which are marked "waiting for answer"
q = {
"query" : {
"bool" : {
"must" : [
{"term" : {"admin.application_status.exact" : "waiting for answer"}}
]
}
}
}
batch_size = 1000
total=0
... |
# coding=utf-8
import itertools
import sys
import re
import copy
import random
import colorama
from fastdict import attrdict
DOT = 1
BOX_GREEN = 2
BOX_RED = 3
BOX_BLUE = 4
DIA_RED = 5
DIA_BLUE = 6
class Engine(object):
chars = {
'0': colorama.Fore.WHITE + '□',
'1': colorama.Fore.WHITE + '●',
... |
import json
from pathlib import Path
import torch
import pytest
import pandas as pd
from scipy.spatial.distance import pdist, squareform
from bionic.train import Trainer
from bionic.utils.common import Device
torch.manual_seed(42 * 42 - 42 + 4 * 2)
config_path = Path(__file__).resolve().parents[0] / "confi... |
#!/usr/bin/env python
# coding: utf-8
# Copyright (c) Qotto, 2019
from typing import Dict, Any
from asyncio import Event, Future, get_event_loop, AbstractEventLoop
__all__ = [
'DictIsFull',
'DictIsEmpty',
'AsyncCoordinator'
]
class DictIsFull(Exception):
pass
class DictIsEmpty(Exception):
pas... |
#!/usr/bin/env pyhton
# -*- coding: UTF-8 -*-
__author__ = 'Chao Wu'
__date__ = '08/29/2021'
__version__ = '1.0'
from sympy import Symbol, lambdify
from sympy.parsing.sympy_parser import parse_expr
class Ratio:
def __init__(self, name, formula, variables):
'''
Parameters
name: str
ratio name
for... |
import FWCore.ParameterSet.Config as cms
from Configuration.Eras.Era_Run3_cff import Run3
from Configuration.ProcessModifiers.pp_on_AA_cff import pp_on_AA
from Configuration.Eras.Modifier_pp_on_PbPb_run3_cff import pp_on_PbPb_run3
Run3_pp_on_PbPb = cms.ModifierChain(Run3, pp_on_AA, pp_on_PbPb_run3)
|
# 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 agreed to in writing, ... |
from pathlib import Path
import numpy as np
import pandas as pd
def load_csv_dataset(csv_path):
df = pd.read_csv(csv_path, low_memory=False)
df.loc[:, 'flares'] = df['flares'].fillna('')
df.loc[:, 'bad_img_idx'] = df['bad_img_idx'].apply(
lambda s: [int(x) for x in s.strip('[]').split()])
retu... |
#!/usr/bin/env python3
# Copyright (c) 2014-2020 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Base class for RPC testing."""
import configparser
from enum import Enum
import argparse
import loggin... |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "palautebot.settings")
try:
from django.core.management import execute_from_command_line
except ImportError as exc:
raise ImportError(
"Couldn't import Django. A... |
from threading import Thread
from flask_mail import Message
from flask import current_app
from lws import mail
def send_async_email(app, msg):
with app.app_context():
mail.send(msg)
def send_email(subject, sender, recipients, text_body, html_body):
msg = Message(subject, sender=sender, recipients=rec... |
#
# 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 ... |
# 1636
# ^\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*
# POLYNOMIAL
# nums:4
# POLYNOMIAL AttackString:"1@1"+".0"*10000+"! _1_POA(i)"
import re
from time import perf_counter
regex = """^\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*"""
REGEX = re.compile(regex)
for i in range(0, 150000):
ATTACK = "1@1" + ".0" * i *... |
#!/usr/bin/python2.7
# -*- coding: utf-8 -*-
# Minor change by Jason Barbee
# Added security policy support - allow mac changes, forged transmits, promiscuous parameters.
# (c) 2015, Joseph Callen <jcallen () csc.com>
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify... |
#!/usr/bin/env python3
#
# Copyright (c) Greenplum Inc 2008. All Rights Reserved.
#
from gppylib.gparray import Segment, GpArray
from gppylib.test.unit.gp_unittest import *
import logging
import os
import shutil
import io
import tempfile
from gppylib.commands import base
from mock import patch, MagicMock, Mock
from gpp... |
from myPkgs.Data import *
import pickle
class Adjuster:
def __init__(self):
self.infoList=[]
self.infoListAdjusted=[]
with open(Path.infoDictList,"rb")as f:
self.infoDictList=pickle.load(f)
with open(Path.infoList,"rb")as f:
self.infoList=pickle.load(f)
... |
import json
from django.shortcuts import get_object_or_404, render
from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger
from django.contrib.auth.decorators import permission_required
from wagtail.wagtailadmin.modal_workflow import render_modal_workflow
from wagtail.wagtailadmin.forms import Search... |
'''Crie um programa que leia vários números inteiros pelo teclado. O programa só vai parar
quando o usuário digitar o valor 999, que é a condição de parada. No final, mostre quantos
números foram digitados e qual foi a soma entre eles (desconsiderando a flag)'''
print('~' * 30)
print('Super contador')
print('~' * 30)
... |
import pytest
import os
import tempfile
import shutil
from flexmock import flexmock
from scripttest import TestFileEnvironment
try:
import dnf
except ImportError:
dnf = None
from pyp2rpm.bin import Convertor, SclConvertor, main, convert_to_scl
tests_dir = os.path.split(os.path.abspath(__file__))[0]
class ... |
from flask import render_template, redirect, request, session
from flask_app import app
from flask_app.controllers import controllers_routes
if __name__ == "__main__":
app.run(debug=True) |
import math
import torch
from torch import nn as nn
from torch.distributions import Normal
from robolearn.torch.core import PyTorchModule
from robolearn.torch.utils.pytorch_util import np_ify
from torch.nn.modules.normalization import LayerNorm
import robolearn.torch.utils.pytorch_util as ptu
from robolearn.models.poli... |
# pylint: disable-msg=E1101,W0612
import operator
import pytest
from warnings import catch_warnings
from numpy import nan
import numpy as np
import pandas as pd
from pandas import Series, DataFrame, bdate_range, Panel
from pandas.core.dtypes.common import (
is_bool_dtype,
is_float_dtype,
is_object_dtype,... |
import tensorflow as tf
import os
import zipfile
from os import path, getcwd, chdir
# DO NOT CHANGE THE LINE BELOW. If you are developing in a local
# environment, then grab happy-or-sad.zip from the Coursera Jupyter Notebook
# and place it inside a local folder and edit the path to that location
path = f"{getcwd()}/.... |
import random
import numpy as np
import torch
from torch.utils.data import Dataset
from collections import deque
import cv2
from matplotlib import pyplot as plt
import time
import itertools
import sys
class MemoryDataset(Dataset):
def __init__(self, size, transforms=None):
self.memory = deque(maxlen=size)... |
##############################################################################
# Copyright (c) 2013-2018, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-64... |
"""
# REGULAR EXPRESSION MATCHING
Given an input string (s) and a pattern (p), implement regular expression matching with support for '.' and '*' where:
'.' Matches any single character.
'*' Matches zero or more of the preceding element.
The matching should cover the entire input string (not partial).
Exampl... |
import _thread
import socket
import sys
import time
import selectiverepeatpacket as packet
import selectiverepeatudt as udt
from selectiverepeattimer import Timer
PACKET_SIZE = 1024
RECEIVER_ADDR = ('localhost', 8080)
SENDER_ADDR = ('localhost', 0)
SLEEP_INTERVAL = 0.05
TIMEOUT_INTERVAL = 0.5
WINDOW_SIZE = 4
base = ... |
#
# Copyright 2019 Venafi, 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, ... |
# -*-coding:utf-8 -*-
from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker
from sqlalchemy.ext.declarative import declarative_base
from config.conf import get_db_args
def get_engine():
args = get_db_args()
connect_str = "{}+pymysql://{}:{}@{}:{}/{}?charset=utf8".format(args['db_type'],... |
# ---------------------------------------------------------------------
# Eltex.MES.get_interfaces
# ---------------------------------------------------------------------
# Copyright (C) 2007-2020 The NOC Project
# See LICENSE for details
# ---------------------------------------------------------------------
# Python... |
# group 8 and group 9
from django.db import models
from applications.academic_information.models import Student
from django.db import models
from applications.globals.models import ExtraInfo
class Constants:
RESPONSE_TYPE = (
('Approved', 'Approved'),
('Disapproved', 'Disapproved'),
('Pendi... |
# -*- coding: utf-8 -*-
"""Lineshape Test."""
import numpy as np
from mrsimulator import Simulator
from mrsimulator import Site
from mrsimulator import SpinSystem
from mrsimulator.methods import BlochDecaySpectrum
from mrsimulator.methods import Method2D
from mrsimulator.methods import SSB2D
def SSB2D_setup(ist, vr, ... |
"""
Django settings for instagram project.
Generated by 'django-admin startproject' using Django 1.11.
For more information on this file, see
https://docs.djangoproject.com/en/1.11/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.11/ref/settings/
"""
import os... |
# coding: utf-8
# Copyright (c) 2016, 2021, 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... |
from nnet.loss.loss import Loss
import numpy as np
class MSELoss(Loss):
def __init__(self):
super(Loss, self).__init__()
def forward(self, output, target):
# Mean Squared Error (MSE)
# diff -> square -> mean
diff = output - target
square = np.square(diff)
lo... |
# Copyright 2020 DeepMind Technologies Limited.
# 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 t... |
import pyttsx3
import SparrowDB
import auto_script
import wikipedia
import subprocess, webbrowser, os, requests, random, sys, platform, pyautogui, psutil, time, datetime
from speech_files import tc
from SparrowDB import get_answer_from_database, insert_ques_and_ans
from pynput.keyboard import Controller as key_c... |
#!/usr/bin/env python
#
#===- add_new_check.py - clang-tidy check generator ---------*- python -*--===#
#
# Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
# See https://llvm.org/LICENSE.txt for license information.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
#
#===----------... |
"""
Arithmetic operations for PandasObjects
This is not a public API.
"""
import datetime
import operator
from typing import Optional, Set, Tuple, Union
import numpy as np
from pandas._libs import Timedelta, Timestamp, lib
from pandas._libs.ops_dispatch import maybe_dispatch_ufunc_to_dunder_op # noqa:F401
from pand... |
#!/usr/bin/env python3
# Copyright (c) 2016-2018 The Bitcoin Core developers
# Copyright (c) 2015-2018 The PIVX developers
# Copyright (c) 2018 The Bone developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
import re
import f... |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.3 on 2018-01-16 10:58
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('ontask', '0013_auto_20171209_0809'),
('ontask', '0002_auto_20180116_1510'),
]
opera... |
from .optimizer import MiniBatchConvLinOptimizer
from .half_squared import HalfSquared
from .hinge import Hinge
from .logistic import Logistic |
# -*- coding: utf-8 -*-
from scrapy.exceptions import IgnoreRequest
from scrapy.linkextractors import LinkExtractor
from scrapy.spidermiddlewares.httperror import HttpError
from scrapy.spiders import Rule, CrawlSpider
from service_identity.exceptions import DNSMismatch
from twisted.internet.error import DNSLookupError,... |
#Embedded file name: /Users/versonator/Jenkins/live/output/Live/mac_64_static/Release/python-bundle/MIDI Remote Scripts/ableton/v2/base/live_api_utils.py
from __future__ import absolute_import, print_function, unicode_literals
def liveobj_changed(obj, other):
u"""
Check whether obj and other are not equal, pro... |
# ------------------------------------
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
# ------------------------------------
import logging
from typing import TYPE_CHECKING
from azure.core.exceptions import ClientAuthenticationError
from .._internal import AadClient, AsyncContextManager
from... |
# --------------------------------------------------------------------------
#
# Copyright (c) Microsoft Corporation. All rights reserved.
#
# The MIT License (MIT)
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the ""Software""), ... |
def detectCapitals(word:str):
# Flag to keep track of the cases
c = 0
for i in word:
if i == i.upper():
c += 1
# If all words are small || If first cap and rest are small || All are caps
return c == len(word) or (c == 1 and word[0] == word[0].upper()) or c == 0
print(detect... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.