text stringlengths 3.07k 12.6k |
|---|
import sys, json
import nltk
from nltk.corpus import stopwords
from nltk import WordPunctTokenizer, RegexpTokenizer, pos_tag
import numpy as np
import string
import pandas as pd
import sklearn
import re
from collections import Counter
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
from sklearn.... |
"""
Copyright (c) Contributors to the Open 3D Engine Project.
For complete copyright and license terms please see the LICENSE at the root of this distribution.
SPDX-License-Identifier: Apache-2.0 OR MIT
"""
class Tests:
level_created = (
"New level created successfully",
"Failed to create new lev... |
#!/usr/bin/python
#
# Copyright 2018-2022 Polyaxon, 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 ... |
from urllib.request import urlopen
from datetime import datetime, timedelta
import subprocess
import av
import numpy as np
from stream import transforms, model, _tokenizer, test_wav, window_size, eval_args, lm_model
import torchaudio
import torch
import torch.nn.functional as F
import logging
hidden_ = lm_model.init_... |
"""
The "Brain" class handles most of Hey Athena's processing.
To listen for input, use ``brain.inst.run()``
"""
from __future__ import print_function
import traceback
import os
import re
import yaml
from athena import settings, stt, tts, apis, mods, log
inst = None
try:
input = raw_input # Pyt... |
import re
import sys
from django.core.exceptions import FieldError, ValidationError
from django.db import models
try:
from django.utils.encoding import smart_text
except ImportError:
from django.utils.encoding import smart_unicode as smart_text
from collections import deque
PY2 = sys.version_info[0] == 2
if n... |
from PyQt5 import QtGui
from PyQt5.QtWidgets import *
from PyQt5.QtGui import *
from PyQt5 import QtWidgets, QtCore, QtGui
from PyQt5.QtCore import *
import sys
class Spongebob(QMainWindow):
def __init__(self):
super().__init__()
self.setup()
def setup(self):
self.setWindo... |
# Copyright 2018 Iguazio
#
# 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, softwa... |
# Copyright (c) 2017 The Khronos Group 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 ... |
# -*- coding: utf-8 -*-
"""
Created on Sun Aug 25 07:59:03 2019
@author: tsd
"""
import os
import pickle
import pandas as pd
import torch
import numpy as np
from tqdm import tqdm
import logging
logging.basicConfig(format='%(asctime)s [%(levelname)s]: %(message)s', \
datefmt='%m/%d/%Y %I:%M:%S %p',... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import yaml
import glob
import re
import os
import sys
import argparse
import html_generiloj
def transpose_headlines(markdown, level):
prefix = ''
for i in range(level):
prefix += '#'
markdown = re.sub(r'^#', '#' + prefix, markdown)
markdown = re.s... |
import pathlib
import lxml.etree
import pytest
import ssis_validator
def dtsx_file(protection_level, last_mod_prod_ver, conn_name, conn_server):
# DTS Executable
def dts(
prop, nsmap={"DTS": "www.microsoft.com/SqlServer/Dts"}, ns_name="DTS"
):
return f"{{{nsmap[ns_name]}}}{p... |
#!/usr/bin/env python3
import os
import re
import html
import json
import gzip
import time
import email
import chardet
import mimetypes
from html.parser import HTMLParser
class MLStripper(HTMLParser):
def __init__(self):
self.reset()
self.fed = []
def convert_charrefs(x):
return x
... |
import ffmpeg
from phonemes.phoneme_picture_pais import picture_pairs
from csv import reader
import pandas as pd
import json
from scipy.interpolate import interp1d
import os
import re
from typing import List, Optional
import dnnlib
import numpy as np
import PIL.Image
import torch
import legacy
def read_phoneme_pairs()... |
class WeightedRandomizer:
def __init__ (self, weights):
self.__max = .0
self.__weights = []
for value, weight in weights.items():
self.__max += weight
self.__weights.append ( (self.__max, value) )
def random (self):
import random
r = random.random... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
... |
#!/usr/bin/env python3
# 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
# "L... |
#!/usr/bin/env python2.7
__author__ = ['[<NAME>](http://bamos.github.io)']
__date__ = '2014.04.19'
"""
This script (music-organizer.py) organizes my music collection for
iTunes and [mpv](http://mpv.io) using tag information.
The directory structure is `<artist>/<track>`, where `<artist>` and `<track>`
are lower case ... |
#!/usr/bin/env python3
import argparse
import sys
import os
import gzip
from Bio import SeqIO
directory = "sequence-categorisation"
if not os.path.exists(directory): os.makedirs(directory)
SSU_rRNA_archaea = "SSU_rRNA_archaea"
SSU_rRNA_bacteria = "SSU_rRNA_bacteria"
SSU_rRNA_eukarya = "SSU_rRNA_eukarya"
LSU_rRNA_ar... |
import math
import random
from pathlib import Path
from unittest import mock
import multiprocessing as mp
from direct.showbase.ShowBase import ShowBase
import numpy as np
import pybullet
import pybullet_utils.bullet_client as bc
from smarts.core.coordinates import Heading, Pose
from smarts.core.provider import Provid... |
# pylint: disable=locally-disabled, missing-docstring, no-member, wildcard-import
from selenium import webdriver
from selenium.common.exceptions import WebDriverException
from lib.proxy import *
import lib.constants as constants
def _format_har(har):
"""Format the retrieved HAR data from the proxy."""
format... |
import urllib3, os
from lxml import html
from typing import Any, Optional
from api.config import Config
from api.inspection.technology.wordpress import WordPressIdentifier
from api.models.requestcache import RequestCacheService
class InspectionResult(object):
def __init__(self):
self._name = ''
self._tech... |
from flask import _request_ctx_stack, current_app, g, request # type: ignore
from jwt import PyJWTError
from notifications_python_client.authentication import (
decode_jwt_token,
decode_token,
epoch_seconds,
get_token_issuer,
)
from notifications_python_client.errors import (
TokenDecodeError,
... |
import math
import numpy as np
import torch
import torch.nn.functional as F
from scipy import ndimage
from scipy.ndimage import measurements
from skimage import morphology as morph
import matplotlib.pyplot as plt
from misc.utils import center_pad_to_shape, cropping_center, get_bounding_box
from dataloader.augs impor... |
#!/usr/bin/env python
# Software License Agreement (MIT License)
#
# Copyright (c) 2020, control_warpper
# All rights reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without rest... |
# -*- coding:utf8 -*-
import Queue
import threading
import time
import traceback
from logger import Logger
from task import ExecutableTask, Task
class ThreadPool(object):
def __init__(self):
self._init_core_worker()
def _init_core_worker(self):
self.core_worker = CoreWorker()
self.cor... |
#!/usr/bin/env python
#
# 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.
"""Creates an AndroidManifest.xml for an incremental APK.
Given the manifest file for the real APK, generates an AndroidManifest.xml ... |
import streamlit as st
import numpy as np
import pandas as pd
#import matplotlib.pyplot as plt
from matplotlib import pyplot as plt
from sklearn import datasets
from sklearn.model_selection import train_test_split
from sklearn.preprocessing import LabelEncoder
from sklearn.preprocessing import StandardScaler
from s... |
import torch
import torch.nn as nn
import torchvision.models.detection.backbone_utils as backbone_utils
import torchvision.models._utils as _utils
import torch.nn.functional as F
from collections import OrderedDict
def conv_bn(inp, oup, stride = 1):
return nn.Sequential(
nn.Conv2d(inp, oup, 3, stride, 1, b... |
"""Tests for QS application."""
from copy import copy
from typing import List, Type
import pytest
from PyQt5.QtCore import QEventLoop, QThread, QTimer
from PyQt5.QtWidgets import QApplication
from qute_style.dev.mocks import check_call
from qute_style.qs_application import QuteStyleApplication
from qute_style.startup... |
import unittest
import numpy as np
import chainer
import chainer.functions as F
import onnx
import onnx_chainer
from chainer import testing
from onnx.backend.test.case import model
from onnx_chainer.testing import test_mxnet
MXNET_OPSET_VERSION = {
'cast': (1,),
'copy': (1,),
'depth2space': None,
'pa... |
import numpy as np
import pandas as pd
import scipy.integrate
import tqdm
def single_nutrient(params, time, gamma_max, nu_max, precursor_mass_ref, Km,
omega, phi_R, phi_P, num_muts=1, volume=1E-3):
"""
Defines the system of ordinary differenetial equations (ODEs) which describe
accu... |
from __future__ import (
absolute_import,
unicode_literals,
)
import copy
import itertools
from conformity import fields
from conformity.validator import validate
import six
from pysoa.common.metrics import MetricsSchema
from pysoa.common.schemas import BasicClassSchema
from pysoa.utils import resolve_python... |
#! /usr/bin/env python
"""
This script allows for the search of Sentinel-1 data on scihub.
Based on some search parameters the script will create a query on
www.scihub.copernicus.eu and return the results either as shapefile,
sqlite, or PostGreSQL database.
"""
# import modules
import getpass
import os
import logging... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Mar 24 07:43:00 2022
@author: f1lem0n
"""
import easygui as eg
import sys
def startMenu():
'''Initialize program\'s GUI.'''
choice = eg.indexbox('Welcome to Microplate Data Analyser by <NAME>!\n' +
'\n...For ... |
from __future__ import print_function, division
import numpy as np
import random
import torch
import os
# TODO: combine with data/misc/*.py
####################################################################
## Process image stacks.
####################################################################
def count_volu... |
#!/usr/bin/env python3
import collections
import os
import subprocess
import sys
import tempfile
# Hashes to be ignored
#
# The system sometimes fails to match commits and suggests to backport
# revision which was already ported. In order to solve that we can:
#
# - Explicitly ignore some of the commits.
# - Move the... |
import threading
import string
import random
import urllib
from copy import copy, deepcopy
from pubnub import utils
from pubnub.crypto import PubNubCryptodome
from pubnub.pnconfiguration import PNConfiguration
PAM_TOKEN_WITH_ALL_PERMS_GRANTED = (
"<KEY>"
"<KEY>"
"<KEY>"
)
PAM_TOKEN_EXPIRED = (
"<KEY... |
# -*- coding: utf-8 -*-
import os
import flask
import requests
import google.oauth2.credentials
import google_auth_oauthlib.flow
import googleapiclient.discovery
# This variable specifies the name of a file that contains the OAuth 2.0
# information for this application, including its client_id and client_secret.
CLI... |
import pytest
import mock
from awsshell import app
from awsshell import shellcomplete
from awsshell import compat
@pytest.fixture
def errstream():
return compat.StringIO()
def test_can_dispatch_dot_commands():
call_args = []
class CustomHandler(object):
def run(self, command, context):
... |
# -*- coding: UTF-8 -*-
import win32api
import win32gui
import win32con
import win32com.client
import win32clipboard as clipboard
import requests
import pythoncom
from apscheduler.schedulers.blocking import BlockingScheduler
import datetime
import time
import random
from random import randint
from random import choice
... |
"""A library for describing and applying affine transforms to PIL images."""
import numpy as np
import PIL.Image
class RGBTransform(object):
"""A description of an affine transformation to an RGB image.
This class is immutable.
Methods correspond to matrix left-multiplication/post-application:
for e... |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2004-2018 Edgewall Software
# Copyright (C) 2004 <NAME> <<EMAIL>>
# Copyright (C) 2005 <NAME> <<EMAIL>>
# 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 ava... |
"""Client."""
from datetime import datetime, timezone
import aiohttp
import logging
import numpy as np
from .const import INTENSITY
_LOGGER = logging.getLogger(__name__)
intensity_indexes = {
2021: [50, 140, 220, 330],
2022: [45, 130, 210, 310],
2023: [40, 120, 200, 290],
2024: [35, 110, 190, 270],
... |
#!/usr/bin/python
#
# Copyright (C) 2012-2015 Internet Systems Consortium, Inc. ("ISC")
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#
# This script lists obsolete... |
# Copyright (C) 2011 Google Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and th... |
import re
import logging
from markdown import Extension
from markdown.preprocessors import Preprocessor
from toolz.curried import (
pipe, curry, merge, map, filter,
)
from ..common import (
vmap, vfilter,
)
from .. import yaml
log = logging.getLogger(__name__)
log.addHandler(logging.NullHandler())
'''
|==[[... |
# Copyright 2018 D-Wave Systems 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 wri... |
"""Imports."""
from django.test import TestCase, Client
from .models import User
from .forms import ProfileEditForm
from django.urls import reverse_lazy
import factory
class UserFactory(factory.django.DjangoModelFactory):
"""Use factory to create a fake user for testing purposes."""
class Meta:
model... |
import requests
from bs4 import BeautifulSoup
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
import pymysql
driver = webdriver.Chrome('./chromedriver')
# res = requests... |
"""Flow item adapter connections."""
from typing import Type, Union
from gaphor import UML
from gaphor.diagram.connectors import Connector, UnaryRelationshipConnect
from gaphor.UML.actions.action import (
AcceptEventActionItem,
ActionItem,
SendSignalActionItem,
)
from gaphor.UML.actions.activitynodes impo... |
'''
Created on Dec 20, 2012
@author: <NAME>
@author: <NAME>
Copyright (c) 2012-2015. The Regents of the University of California (Regents)
and <NAME>. See the file COPYRIGHT.txt for details.
Implements the Latin Hypercube Sampling technique as described by Iman and Conover, 1982,
including correlation control both f... |
#!/usr/bin/python
import os, time, sys,inspect
last_format_file = '.last_format'
ignore_last_format = False
cpp_format_command = 'clang-format -i -sort-includes=${SORT_INCLUDES} -style=file "${FILE}"'
sql_format_command = 'pg_format "${FILE}" -o "${FILE}.out" && mv "${FILE}.out" "${FILE}"'
cmake_format_command = 'cma... |
import numpy as np
import fractions as f
from scipy.linalg import circulant
import matplotlib.pyplot as plt
from scipy import signal
import random
import matplotlib.pyplot as plt
import atexit
from time import time, strftime, localtime
from datetime import timedelta
from matplotlib.pyplot import *
def secondsToStr(ela... |
from os import stat
from typing import Any, List, Literal, Union, cast
from .TimeseriesModelDatV1 import TimeseriesModelDatV1
from .TimeseriesModelNwbV1 import TimeseriesModelNwbV1
import numpy as np
import kachery_client as kc
from numpy.core.numeric import Infinity
from .TimeseriesModelNpyV1 import TimeseriesModelNpy... |
import copy
from itertools import product
from django.db.models.sql.datastructures import EmptyResultSet
from djangae.db.backends.appengine.query import WhereNode
from django.db import NotSupportedError
def preprocess_node(node, negated):
to_remove = []
# Go through the children of this node and if any of t... |
# -*- coding:ascii -*-
from mako import runtime, filters, cache
UNDEFINED = runtime.UNDEFINED
__M_dict_builtin = dict
__M_locals_builtin = locals
_magic_number = 10
_modified_time = 1428511252.270336
_enable_loop = True
_template_filename = '/Users/Nate/chf_dmp/homepage/templates/rental_checkout.html'
_template_uri = '... |
import logging
import os
import asyncio
from time import time
import elasticsearch
from fastapi.middleware.cors import CORSMiddleware
from fastapi import FastAPI, Request
from starlette.staticfiles import StaticFiles
from app.api import token_endpoint, rule_endpoint, resource_endpoint, event_endpoint, \
profile_e... |
import stribor as st
import torch
import torch.nn as nn
import torch.nn.functional as F
class Coupling(nn.Module):
"""
Coupling transformation via elementwise flows. If `dim = 1`, set `mask = 'none'`.
Splits data into 2 parts based on a mask. One part generates parameters of the flow
that wi... |
import numpy as np
from scipy.special import factorial2
from scipy import optimize
def page_moment(n, na, m):
"""Return average trace of moment of reduced density matrix for ergodic states.
"""
if m == 2:
return 1/2**na + 1/2**(n-na)
if m == 3:
return 1/2**(2*na)+1/2**(2*(n-na))+1/2**(... |
# Copyright 2018-2021 The glTF-Blender-IO 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 ... |
''' Run Spark.
This is expecting a .tsv file in the next directory up.
Current criteria for removal: two or more reviews that are 5 stars and have five or fewer words. '''
# import com.datastax.spark.connector._
from csv import DictReader
from pyspark import SparkConf, SparkContext
import redis
from... |
'''
This script was used to copy the Hildebrand16 data 1k x 1k image tiles to the BOSS.
Run from the ndpush directory as module: python -m scripts.ingest_catmaid
'''
from argparse import Namespace
from functools import partial
from io import BytesIO
from multiprocessing.dummy import Pool as ThreadPool
from pathlib imp... |
import pytest
import six
from flexmock import flexmock
from sqlalchemy_utils import i18n
from sqlalchemy_utils.primitives import WeekDay, WeekDays
@pytest.fixture
def set_get_locale():
i18n.get_locale = lambda: i18n.babel.Locale('fi')
@pytest.mark.skipif('i18n.babel is None')
@pytest.mark.usefixtures('set_get_... |
#!/usr/bin/env python3
""" SoLoud Ruby wrapper generator """
import soloud_codegen
fo = open("../glue/soloud.rb", "w")
# module SoLoudImporter
# extend DL::Importer
# dlload 'soloud_x86.dll'
#
# extern "char * foo(int, float)"
#
# CONSTANT = 23
# end
#
SOLOUD_TYPES = []
for x in soloud_... |
"""
Copyright 2020 The Magma Authors.
This source code is licensed under the BSD-style license found in the
LICENSE file in the root directory of this source tree.
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES O... |
#!/usr/bin/python3
# python3 gemini.py status | jq
import base64
import datetime
import hashlib
import hmac
import json
import os
import time
import argparse
import requests
GEMINI_API_KEY = os.getenv('GEMINI_API_KEY').encode()
GEMINI_API_SECRET = os.getenv('GEMINI_API_SECRET').encode()
CLIENT_ORDER_ID = 'Python V1... |
# - <NAME> <<EMAIL>>
"""Functions for simulating sending with a given policy."""
import numpy as np
from numba import jit
from . import utils as ut
@jit(nopython=True)
def _simulate(qpm, policy, dset_mr, rsz_is):
"""Compiled implementation of simulate."""
assert qpm[0] < qpm[1]
assert qpm[2] >= qpm[1]
... |
import matplotlib.pyplot as plt
import matplotlib.cm as cm
import numpy as np
# Set random seed for reproducibility
np.random.seed(1000)
width = 15
height = 5
y_final = width - 1
x_final = height - 1
y_wells = [0, 1, 3, 5, 5, 7, 9, 11, 12, 14]
x_wells = [3, 1, 2, 0, 4, 1, 3, 2, 4, 1]
gamma = 0.... |
from typing import Optional, List, Union
from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker, Session
from autofit.database import query as q
from .scrape import scrape_directory
from .. import model as m
from ..query.query import AbstractQuery, Attribute
class NullPredicate(AbstractQuery):... |
# Copyright 2016 The Oppia 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 ... |
#!usr/bin/env python
# Python Imports
import os
import time
from tkinter import Tk, Button, Label, filedialog
# Third party modules
import cv2
import tensorflow as tf
import numpy as np
import matplotlib.pyplot as plt
from PIL import Image, ImageTk
from mtcnn.mtcnn import MTCNN
# Developer metadata.
__author__ = "<N... |
#coding: utf-8
from numpy import *
from itertools import combinations, permutations
from . import WINEPIRule
class WINEPI(object):
def __init__(self, sequence, episode_type='parallel'):
self.sequence = sequence
if episode_type not in ('serial', 'parallel'):
raise Exception(
'`episode_type` must be `serial`... |
#!/usr/bin/env python3
# (C) Copyright 2020 ECMWF.
#
# This software is licensed under the terms of the Apache Licence Version 2.0
# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
# In applying this licence, ECMWF does not waive the privileges and immunities
# granted to it by virtue of its statu... |
#!/usr/bin/env python
# Copyright (c) 2011 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.
"""Android system-wide tracing utility.
This is a tool for capturing a trace that includes data from both userland and
the kernel... |
#!/usr/bin/env python3
#expected value of max or min of kdn
def ex(n, k):
def ex_min(n, k):
if k == 1:
return 0.5 * (n + 1)
if k == 2:
return (n + 1) * ((n << 1) + 1) / (6 * n)
if k == 3:
m = n + 1
return m * m / (n << 2)
return sum(x... |
class Node:
def __init__(self, i, j=None, children=None):
self.i = i
self.j = j
self.children = children if children else {}
def __getitem__(self, c):
return self.children[c]
def __repr__(self):
return "Node("+str(self.i)+", "+str(self.j)+", children="+str(self.chil... |
# -*- coding: utf-8 -*-
"""
productporter.app
~~~~~~~~~~~~~~~~~
manages the app creation and configuration process
:copyright: (c) 2014 by the ProductPorter Team.
:license: BSD, see LICENSE for more details.
"""
import os
import logging
import datetime
from flask import Flask
from productporter.... |
# Copyright 2013 OpenStack 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://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable l... |
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
from .. import... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import matplotlib.pyplot as plt
import numpy as np
import parselmouth
import pyreaper
import pyworld as pw
def plot_line(path, x_list, y_list, label_list):
assert len(x_list) == len(y_list) == len(label_list)
plt.title('Result Analysis')
for x_data, y_data, label... |
# The Admin4 Project
# (c) 2013-2014 <NAME>
#
# Licensed under the Apache License,
# see LICENSE.TXT for conditions of usage
from _objects import ServerObject, DatabaseObject
from wh import xlt, YesNo
class Database(ServerObject):
typename=xlt("Database")
shortname=xlt("Database")
@staticmethod
def GetInst... |
#!/usr/bin/env python3
__author__ = "<NAME>"
__copyright__ = "Copyright 2021, <NAME>"
__license__ = "MPL 2.0"
import argparse
from glob import glob
from caliper.utils.file import read_json, write_json
from caliper.metrics import MetricsExtractor
import sys
import os
import re
import csv
# regular expression to iden... |
#!/usr/bin/python
import struct
import os
import glob
import argparse
pstates = range(0xC0010064, 0xC001006C)
def writemsr(msr, val, cpu = -1):
try:
if cpu == -1:
for c in glob.glob('/dev/cpu/[0-9]*/msr'):
f = os.open(c, os.O_WRONLY)
os.lseek(f, msr, os.SEEK_SET... |
import numpy as np
from ._mie import dmiess_module as dmiess
from ._mie import bhmie_module as bhmie
from ._mie import dmilay_module as dmilay
#: Density of pure water, in kg/m^3
RHO_WATER = 1e3
__all__ = ["bhmie_scatter", "core_shell_scatter", "integrate_mode", ]
def bhmie_scatter(particle_radius, radiation_lambd... |
import numpy as np
import bpy
from mathutils import Matrix, Vector
import bmesh
import mathutils
import copy
def normalise_vector_batch(vector):
'''
normalising vectors so that (a**2 + b**2 + c**2 == 1**2)
'''
vector_s = vector ** 2
vector_s = np.sum(vector_s, axis=1)
vector_s =... |
from flask import Flask, redirect, render_template, request, session, url_for, jsonify,flash
import os
from flask_sqlalchemy import SQLAlchemy
from flask_mail import Mail, Message
from werkzeug.security import generate_password_hash, check_password_hash
from PIL import Image
import base64
import pytesseract
import io
... |
# Copyright 2021 The KubeEdge 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... |
"""This module contains Crazyflie related functions."""
import sys
import time
import colorama
from cflib.utils import uri_helper
from cflib.crazyflie.log import LogConfig
from cflib.crazyflie.syncCrazyflie import SyncCrazyflie
from cflib.crazyflie import Crazyflie
from cflib.crazyflie.syncLogger import SyncLogger
fr... |
import os
import sys
import configparser
from pathlib import Path
import xml.etree.ElementTree as ET
from xml.dom import minidom
from time import sleep
import datetime
from http.server import BaseHTTPRequestHandler, HTTPServer
import ssl
dirname, filename = os.path.split(os.path.abspath(__file__))
posts_received = 0
p... |
# This code is part of Ansible, but is an independent component.
# This particular file snippet, and this file snippet only, is BSD licensed.
# Modules you write using this snippet, which is embedded dynamically by Ansible
# still belong to the author of the module, and may assign their own license
# to the complete wo... |
# (C) Datadog, Inc. 2018
# All rights reserved
# Licensed under a 3-clause BSD style license (see LICENSE)
from __future__ import unicode_literals
from copy import deepcopy
from distutils.version import StrictVersion
import mock
import pytest
import redis
from datadog_checks.redisdb import Redis
from .common import ... |
# -*- coding: utf-8 -*-
#
# Copyright 2017 Ricequant, 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 ... |
import numpy as np
import pandas as pd
from sklearn.decomposition import PCA
import plotly.graph_objects as go
import plotly.express as px
import plotly.io as pio
from plotly.subplots import make_subplots
__all__ = ['Game']
def power_step(t, a=2, b=2, alpha=1, *args, **kvargs):
return a / (b + t)**alpha
def... |
from decimal import Decimal
from django.shortcuts import render
from django.http import HttpResponse, HttpResponseRedirect, JsonResponse
from django.views.generic.base import View
from django.conf import settings
from django.urls import reverse_lazy
from django.contrib import messages
from django.db import transaction... |
import pytest
from tests.acceptance import run_gitlabform
@pytest.fixture(scope="class")
def schedules(gitlab, group_and_project):
another_branch = "scheduled/new-feature"
gitlab.create_branch(group_and_project, another_branch, "main")
# fmt: off
schedules = [
("Existing schedule", "main",... |
import ast
import json
import os
from io import BytesIO
from sys import argv
import cv2
import numpy as np
import pandas as pd
import requests
from PIL import Image
def get_box_centers_all_emotions(sample_row):
"""
input: A dictionary of the format
{
emotion1: [{geometry_box1: [list of 4 corner c... |
"""
# tests/test_entries.py
# For unit testing of entries
# standard unittest
"""
import unittest
from app import create_app
# import Entry classe from models
from app.models import Entry
class TestDiaryEntry(unittest.TestCase):
"""test for successful and unsuccessful entry addition"""
def setUp(self):
... |
from __future__ import unicode_literals
from django.apps import apps
from django.conf import settings
from django.core.exceptions import ObjectDoesNotExist, ValidationError
from django.db.models.signals import post_migrate
from django.http import HttpRequest
from django.test import TestCase, modify_settings, override_... |
import requests
import pandas as pd
import numpy as np
import io
from bs4 import BeautifulSoup
import datetime
def validate_datestring(date_text):
try:
datetime.datetime.strptime(date_text, '%Y-%m-%d')
except ValueError:
raise ValueError("Incorrect data format, should be YYYY-MM-DD")
def sanit... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.