text stringlengths 1 927k |
|---|
# 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... |
#!/usr/bin/env python
# Copyright 2013 Quanta Research Cambridge, 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
#
# U... |
"""Sensor platform for weenect."""
from __future__ import annotations
from datetime import datetime
from typing import List
from homeassistant.components.sensor import (
SensorDeviceClass,
SensorEntity,
SensorEntityDescription,
)
from homeassistant.config_entries import ConfigEntry
from homeassistant.core... |
from panda3d.core import *
from direct.showbase.ShowBaseGlobal import *
from direct.directnotify.DirectNotifyGlobal import directNotify
from direct.distributed.ClockDelta import *
from direct.interval.IntervalGlobal import *
from direct.showbase.PythonUtil import getShortestRotation
from otp.avatar import Avatar
from o... |
"""Docstring components common to several ndimage functions."""
from scipy._lib import doccer
__all__ = ['docfiller']
_input_doc = (
"""input : array_like
The input array.""")
_axis_doc = (
"""axis : int, optional
The axis of `input` along which to calculate. Default is -1.""")
_output_doc = (
"""output : ar... |
from data.database import ImageStorage, ManifestBlob
from data.model import BlobDoesNotExist
from data.model.storage import get_storage_by_uuid, InvalidImageException
from data.model.blob import get_repository_blob_by_digest as legacy_get
def get_repository_blob_by_digest(repository, blob_digest):
""" Find the conte... |
# Functions to read, analyze, and download from UCI ML portal
# ==========================================
# Function to read UCI ML datasets table
# ==========================================
def read_dataset_table(
url="https://archive.ics.uci.edu/ml/datasets.php", msg_flag=True
):
"""
Reads the table of... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
DEVELOPER: GURJOT SINGH MAHI
E-MAIL: GURJOTMAHI28@GMAIL.COM
WRITTEN USING: PYTHON 3.6
THE PUNJABI IPA CONVERSION SOFTWARE PROVIDE THE CAPABILITY TO CONVERT THE
PUNJABI WORDS OR CHARACTERS TO ITS EQUIVALENT IPA CHARACTERS.
THIS PIECE OF CODE WAS WRITTEN AS A UTILITY, D... |
# -*- coding: utf-8 -*-
"""A thin cross plattform installer and wrapper around chromaprint fpcalc."""
import os
import platform
import shutil
import tarfile
import zipfile
import subprocess
import stat
import click
import iscc_cli
from iscc_cli.utils import download_file
FPCALC_VERSION = "1.5.0"
FPCALC_URL_BASE = "ht... |
#!/usr/bin/python
# Copyright (c) 2016-2017 Hewlett Packard Enterprise Development LP
# 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
DOCUMENTATION = '''
---
module: oneview_fc_network_... |
#
# Interface to UMLS Databases and concept trie
#
#
#
import copy
import sqlite3
import create_sqliteDB
import os
import create_trie
import difflib
import string
import sys
features_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
if features_dir not in sys.path:
sys.path.append(features_dir)
... |
""""
This file contains some decorators that define stages.
There are two main types of stages:
1. stage - a high level stage
2. country_stage - a stage that applies to countries files(*.mwm).
country_stage might be inside stage. There are country stages inside mwm_stage.
mwm_stage is only one stage that conta... |
"""
Matrix Multiplication
======================
In this tutorial, you will write a 25-lines high-performance FP16 matrix multiplication
kernel that achieves performance on par with cuBLAS.
You will specifically learn about:
- Block-level matrix multiplications
- Multi-dimensional pointer arithmetic
- Program re-order... |
from pynput import keyboard
import time
def on_press(key):
try:
print('alphanumeric key {0} pressed'.format(
key.char))
except AttributeError:
print('special key {0} pressed'.format(
key))
def on_release(key):
print('{0} released'.format(
key))
if key == keyboard.Key.esc:
# Stop listener
return Fa... |
# Copyright (c) 2021 MobileCoin. All rights reserved.
#!/usr/bin/env python
"""Django's command-line utility for administrative tasks."""
import os
import sys
def main():
"""Run administrative tasks."""
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'mobot.settings')
try:
from django.core.manage... |
from pyrfuniverse.envs import RFUniverseBaseEnv
from pyrfuniverse.utils import RFUniverseToborController
import pybullet as p
import math
class FullToborEnv(RFUniverseBaseEnv):
def __init__(self, executable_file=None):
super().__init__(
executable_file=executable_file,
camera_chann... |
#!/usr/bin/python2.5
#
# Copyright 2009 Google 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... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Slixmpp: The Slick XMPP Library
Copyright (C) 2011 Dann Martens
This file is part of Slixmpp.
See the file LICENSE for copying permission.
"""
from slixmpp.plugins.xep_0009.remote import Endpoint, remote, Remote, \
ANY_ALL, Future
import time
c... |
#!/usr/bin/env python3
# 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.
import unittest
from parlai.core.agents import Agent
from collections import deque
SKIP_TESTS = False
try:
from pa... |
'''
Garden
======
.. versionadded:: 1.7.0
.. versionchanged:: 1.8.0
Garden is a project to centralize addons for Kivy maintained by users. You can
find more information at `Kivy Garden <http://kivy-garden.github.io/>`_. All
the garden packages are centralized on the `kivy-garden Github
<https://github.com/kivy-garde... |
# Tencent is pleased to support the open source community by making ncnn available.
#
# Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
#
# Licensed under the BSD 3-Clause License (the "License"); you may not use this file except
# in compliance with the License. You may obtain a copy of the... |
# Copyright Contributors to the Packit project.
# SPDX-License-Identifier: MIT
import functools
from typing import Dict, Type, Optional, Set, Iterable
from ogr.abstract import GitService, GitProject
from ogr.exceptions import OgrException
from ogr.parsing import parse_git_repo
_SERVICE_MAPPING: Dict[str, Type[GitSer... |
# person = input("Enter your name: ") # Carl
# print("Hello ", person) # Hello Carl
# x = input("Enter a number: ") # 8
# y = input("Enter another number: ") # 7
# z = x + y
# print(z) # 87 ## this was the result of concatenation
person = input("Enter your name: ") # Rich
print("Hello ", person)
x = input... |
#Desafio 001: Crie um programa que escreva "Olá, Mundo!" na tela.
import colorama
colorama.init()
print('\033[30;47mHello, World!\033[m ') |
from django.apps import AppConfig
class MembersConfig(AppConfig):
name = 'members' |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2017-2018 KuraLabs S.R.L
#
# 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 appl... |
#!/usr/bin/env python
import numpy
def jaccquard_similarity(a, b):
if len(b) == 0 or len(a) == 0: return 0.0
return len(set(a).intersection(b))*1./len(set(a).union(set(b)))
def similarityMatrix(features):
a = numpy.zeros((len(features), len(features)),
dtype=numpy.float)
ids = list(fe... |
"""
taken from: https://github.com/karpathy/minGPT/
GPT model:
- the initial stem consists of a combination of token encoding and a positional encoding
- the meat of it is a uniform sequence of Transformer blocks
- each Transformer is a sequential combination of a 1-hidden-layer MLP block and a self-attention block... |
# 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... |
from model.contact import Contact
def test_create_new_contact(app, db, json_contact):
contact = json_contact
old_contacts = db.get_contact_list()
app.contact.create(contact)
new_contacts = db.get_contact_list()
old_contacts.append(contact)
assert sorted(old_contacts, key=Contact.id_or_max) == ... |
###############################################################################
#
# Tests for XlsxWriter.
#
# Copyright (c), 2013-2015, John McNamara, jmcnamara@cpan.org
#
from ..excel_comparsion_test import ExcelComparisonTest
from ...workbook import Workbook
class TestCompareXLSXFiles(ExcelComparisonTest):
"""... |
# coding=utf-8
# Copyright 2019-present, Facebook, Inc 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
#
# Un... |
from rest_framework import serializers
from .models import Lead
class LeadSerializer(serializers.ModelSerializer):
class Meta:
model = Lead
fields = ('id', 'name', 'email', 'message', 'created_at') |
from torch.utils.data import DataLoader
from torchvision.datasets import ImageFolder
import torchvision.transforms as transforms
from config import *
def get_celeba_loader(path, batch_size):
"""CelebA Loader"""
transform = transforms.Compose([
transforms.Resize((config.crop_size, config.crop_size)),
... |
# -*- coding: utf-8 -*-
"""Pytest setup """
import pytest
from application.app_factory import build_app
from application.models import db
@pytest.yield_fixture(scope="session")
def app():
"""Flask application fixture """
_app = build_app(env='test')
db.create_all()
yield _app
db.drop_all() |
class StoreError(Exception):
... |
# Copyright (c) 2019, NVIDIA CORPORATION.
# 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 i... |
"""
Copyright (c) 2020 Huawei Technologies Co.,Ltd.
openGauss is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
http://license.coscl.org.cn/MulanPSL2
THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WI... |
from ctypes import c_int
from .dll import _bind, SDLFunc, AttributeDict
from .stdinc import Uint32
__all__ = [
# Constants
"SDL_INIT_TIMER", "SDL_INIT_AUDIO", "SDL_INIT_VIDEO", "SDL_INIT_JOYSTICK",
"SDL_INIT_HAPTIC", "SDL_INIT_GAMECONTROLLER", "SDL_INIT_EVENTS",
"SDL_INIT_SENSOR", "SDL_INIT_NOPARACHUTE... |
#!/usr/bin/env python3
import time
from decimal import *
from test_framework.test_framework import BitcoinTestFramework
from test_framework.util import *
#`zapwalletmints` conf setting test case
# Description: `zapwalletmints` configuration setting was added. What this does is clears the WalletDB of HD mints
# (ne... |
# Generated by Django 2.0 on 2018-01-22 20:24
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('logactivity', '0001_initial'),
]
operations = [
migrations.AddField(
model_name='record',
name='query_string',
... |
# To make print working for Python2/3
from __future__ import print_function
# Use six to import urllib so it is working for Python2/3
from six.moves import urllib
# If you don't want to use six, please comment out the line above
# and use the line below instead (for Python3 only).
#import urllib.request, urllib.parse,... |
"""Tests for s3copy.
These tests required the following environment variables:
``LTD_TEST_AWS_ID``
AWS access key ID
``LTD_TEST_AWS_SECRET``
AWS secret access key
``LTD_TEST_BUCKET``
Name of an S3 bucket that already exists and can be used for testing.
The tests will be skipped if they are not availabl... |
# Copyright (c) 2015 Rackspace, 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 wr... |
# -*- coding: utf-8 -*-
'''
The datetime utility module provides functions to gather date and time information
'''
from datetime import datetime
def strftime(format=''):
'''Return a string representing the date and time, controlled by an explicit
format string. For a complete list of formatting directives, s... |
# coding: utf-8
#
# This file is part of pyasn1-modules software.
#
# Created by Stanisław Pitucha with asn1ate tool.
# Modified by Russ Housley to add support for opentypes.
# Copyright (c) 2005-2020, Ilya Etingof <etingof@gmail.com>
# License: http://snmplabs.com/pyasn1/license.html
#
# Internet X.509 Public Key Infr... |
import numpy as np
from .base_plots import TimePlot
class StatePlot(TimePlot):
"""Plot to display the environments states and their references."""
_default_limit_line_cfg = {
'color': 'red',
'linestyle': '--',
'linewidth': 1
}
# Labels for each state variable.
state_labe... |
from rest_framework import serializers
from .models import Issue, Status, Priority, Project, Tracker, Comment
from users.models import CustomUser
class UserSerializer(serializers.ModelSerializer):
class Meta:
model = CustomUser
fields = ('pk', 'username', 'first_name', 'email', 'last_name', 'is_ac... |
# -*- coding: utf-8 -*-
# Copyright (c) 2022, bahaa and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
# import frappe
from frappe.model.document import Document
class StarsName(Document):
pass |
import os
import sys
import tensorflow as tf
from tensorflow.examples.tutorials.mnist import input_data
mnist_path = "/Users/liyanan/Documents/Test/Tensorflow/data/mnist_data/"
#print mnist data
def mnistInfo():
batch_size = 100
#read mnist data
mnist = input_data.read_data_sets(mnist_path,one_hot =... |
jdiasfdsafdaknbm
dsa
fd
sa |
import os
import re
from pathlib import Path
from subprocess import PIPE
from typing import List
import pytest
from _pytest.capture import CaptureFixture
from _pytest.monkeypatch import MonkeyPatch
import scanpy
from scanpy.cli import main
HERE = Path(__file__).parent
@pytest.fixture
def set_path(monkeypatch: Mon... |
# WQX API version
wqx_v = "3.0"
# Major version: breaking changes
major_v = "0"
# Minor version: new features
minor_v = "6"
# Patch version: bug fixes / no interface changes
patch_v = "0"
__version__ = f"{wqx_v}.{major_v}.{minor_v}.{patch_v}" |
# -*- 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):
# Removing unique constraint on 'TrackedUser', fields ['project', 'ident']
db.delete_unique('sentry_trackedu... |
def send_query(self, args):
data = json.dumps({"requests": args, 'token': self.token})
try:
response = requests.post(host, data=data).json()
except requests.exceptions.ConnectionError:
return False
try:
if response['error_code'] == 403:
self.authorization(self.user, s... |
from abc import ABC, abstractmethod
from dataclasses import dataclass
from typing import List, Optional
from didcomm.common.types import DID_URL, VerificationMethodType, VerificationMaterial
@dataclass
class Secret:
"""
A secret (private key) abstraction.
Attributes:
kid (str): a key ID identify... |
from contextlib import contextmanager
from pathlib import Path
from sqlalchemy import create_engine
from sqlalchemy import event
from sqlalchemy.engine import Engine
from sqlalchemy.event import listen
from sqlalchemy.orm import sessionmaker
import shutil
import sqlite3
import tempfile
__all__ = ["ThreediDatabase"]
... |
# 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... |
from cffi import FFI
ffibuilder = FFI()
# cdef() expects a single string declaring the C types, functions and
# globals needed to use the shared object. It must be in valid C syntax.
ffibuilder.cdef("""
typedef enum
{
SDL_POWERSTATE_UNKNOWN, /**< cannot determine power status */
SDL_POWERSTATE_ON_BATTERY... |
"""
Copyright (c) Microsoft Corporation.
Licensed under the MIT license.
Dataset interfaces
"""
from collections import defaultdict
from contextlib import contextmanager
import io
import json
from os.path import exists
import numpy as np
import torch
from torch.utils.data import Dataset, ConcatDataset
import horovod.... |
# -*- coding: utf-8 -*-
#
# Copyright 2017-2018 - Swiss Data Science Center (SDSC)
# A partnership between École Polytechnique Fédérale de Lausanne (EPFL) and
# Eidgenössische Technische Hochschule Zürich (ETHZ).
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in c... |
#!/usr/bin/env python3.6
"""
This is an example bare-bone script that you can use as an argument for
setting up an output hook.
>>> $ detect-secrets-server scan yelp/detect-secrets
... --output-hook examples/standalone_hook.py
"""
import json
import sys
def main():
print('repo:', sys.argv[1])
print(json.... |
#from __future__ import print_function, division
import torch
import numpy as np
import random
from PIL import Image
from torch.utils.data import Dataset
import os
import os.path
def make_dataset(image_list, labels):
if labels:
len_ = len(image_list)
images = [(image_list[i].strip(), labels[i, :]) for... |
from unittest import TestCase, main
from core.qm.qm import QM
class TestQM(TestCase):
def setup(self):
pass
def test_convert_binary(self):
#test if the strings are the actual binary representations
#for each of the strings
minterms = [1,2,3,4,5,6,15]
qm = QM(m... |
# 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 under t... |
#!/usr/bin/env python3
#
# macos.py - utility functions, mainly functions that call into CoreFoundation
# and Foundation
#
# Copyright © 2018 Alexander Schlarb
# Copyright © 2019 Calin Culianu <calin.culianu@gmail.com>
#
# License: MIT
import sys
if sys.platform != 'darwin':
raise ImportError("This file can only... |
# -*- coding: utf-8 -*-
# This code is part of Qiskit.
#
# (C) Copyright IBM 2017, 2018.
#
# 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... |
"""
1165. Single-Row Keyboard
Easy
There is a special keyboard with all keys in a single row.
Given a string keyboard of length 26 indicating the layout of the keyboard (indexed from 0 to 25), initially your finger is at index 0. To type a character, you have to move your finger to the index of the desired character.... |
## @package nonlinearity
# Module caffe2.python.helpers.nonlinearity
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from caffe2.python import core
def prelu(model, blob_in, blob_out, num_channels=1, slope_init=None,... |
"""
Sample Management | Cannlytics
Author: Keegan Skeate <keegan@cannlytics.com>
Created: 6/23/2021
Updated: 6/23/2021
License: MIT License <https://opensource.org/licenses/MIT>
Manage your laboratory samples.
"""
def get_sample_pictures():
"""Get sample pictures taken and stored on a lab computer."""
... |
# Copyright 2015, Cisco Systems.
#
# 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... |
"""Credential proposal message handler."""
from .....messaging.base_handler import (
BaseHandler,
BaseResponder,
HandlerException,
RequestContext,
)
from ..manager import CredentialManager
from ..messages.credential_proposal import CredentialProposal
from .....utils.tracing import trace_event, get_ti... |
# Copyright 2021-2022 VMware, Inc.
# SPDX-License-Identifier: Apache-2.0
#
"""
Test the ``@pytest.mark.skip_on_spawning_platform`` marker.
"""
import sys
from unittest import mock
import pytest
pytestmark = [
pytest.mark.skipif(
sys.platform.startswith("win")
and sys.version_info >= (3, 8)
... |
import unittest
from context import patternScore
search_regex = """[Pp]ython
(?<![A-Za-z])[Ss]cript(s|ing)*
[Ll][Ii][Nn][Uu][Xx]
([Jj][Aa][Vv][Aa](?![Ss]))
(([Dd]ata|[Ii]nformation|[Cc]yber|[Nn]etwork)(.))*[Ss]ecurity
(([Ss][Qq][Ll])|([Ss]tructured.[Qq]uery.[Ll]anguage))
[Dd]ev(elopment)*.{0,1}[Oo]p(s|erations)
([Bb][... |
from __future__ import print_function
from _fatcore import ffi, lib
from .error import HandleError
from . import error
from .internal import get_strerror
from .loop import Loop
uv_get_pyobj = lib.fatuv_get_pyobj
uv_set_pyobj = lib.fatuv_set_pyobj
uv_close = lib.fatuv_close
uv_is_active = lib.fatuv_is_active
u... |
import os
import numpy as np
import json
import pickle
from nltk.tokenize import word_tokenize
import random
import torch
from torch.autograd import Variable
# TODO global
NULL = "-NULL-"
UNK = "-UNK-"
ENT = "-ENT-"
def save_pickle(d, path):
print('save pickle to', path)
with open(path, mode='wb') as f:
... |
import time
import unittest
from signage_air_quality.air_quality_packet import AirQualityPacket
class TestAirQualityPacket(unittest.TestCase):
def test_to_bytes(self):
now = time.strptime("Mon Jan 13 21:00:00 2020")
timestamp = int(time.mktime(now))
packet = AirQualityPacket(56, 'O3', time... |
import logging
import logging.config
import re
from multiprocessing import Process, Queue
from serial import Serial
from serial.serialutil import SerialException
# Serial communication with Arduino
SERIAL_NAME = '/dev/ttyUSB0'
SERIAL_BAUDRATE =115200
# Regex for a message
REGEX_MSG = '^#[0-9]+ [0-9]$'
MSG_TRUE = '1'
... |
#
# Autogenerated by Frugal Compiler (3.14.1)
#
# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
#
from datetime import timedelta
from threading import Lock
import sys
from frugal.exceptions import TApplicationExceptionType
from frugal.exceptions import TTransportExceptionType
from frugal.middlewa... |
#!/usr/bin/python3
# Find all the zephyr build artifacts required for sanitycheck to be able
# to run on another system and tgz them up.
import os
import tarfile
ARCHIVE_FILES = (
'build.ninja',
'CMakeCache.txt',
'.config',
'zephyr.hex',
'generated_dts_board.conf',
'rules.ninja',
)
def scan... |
#!/usr/bin/env python2
# Copyright (c) 2015 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
import socket
import traceback, sys
from binascii import hexlify
import time, os
from socks5 import Socks5Conf... |
""" Principal Component Analysis
"""
# Author: Alexandre Gramfort <alexandre.gramfort@inria.fr>
# Olivier Grisel <olivier.grisel@ensta.org>
# Mathieu Blondel <mathieu@mblondel.org>
# Denis A. Engemann <d.engemann@fz-juelich.de>
# Michael Eickenberg <michael.eickenberg@inria.fr>
#
# Lice... |
from django import forms
from .models import Profile
class ProfileForm(forms.ModelForm):
"""
A form for editing user profiles.
Assumes that the Profile instance passed in has an associated User
object. The view (see views.py) takes care of that.
"""
name = forms.CharField(
required=F... |
# -*- encoding: utf-8 -*-
"""
tests.db.dbing module
"""
import logging
import os
from hio.base import doing
from hio.core.tcp import clienting, serving
from keri import help # logger support
from keri.base import basing, keeping, directing
from keri.core import eventing, coring
from keri.db import dbing
from keri.... |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2011 OpenStack LLC.
# Copyright (c) 2011 X.commerce, a business unit of eBay Inc.
# Copyright 2011 Grid Dynamics
# Copyright 2011 Eldar Nugaev, Kirill Shileev, Ilya Alekseyev
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not ... |
import numpy as np
# try to import numba
# or define dummy decorator
try:
from numba import autojit
except:
def autojit(func):
return func
# util functions for network simulation
def smooth_trace(trace, scale):
scale = int(scale)
if scale == 1 or scale == 0:
return trace
slen = int(... |
from collections import namedtuple
import json
import os
from os.path import join as pjoin
from pathlib import Path
import numpy as np
from plymit import Ply
from PIL import Image
from .renderer import Renderer
Model = namedtuple(
"Model",
[
"id",
"points",
"normals",
"color",... |
import unittest
import numpy as np
from sklearn.gaussian_process import GaussianProcessRegressor
from skactiveml.pool import (
MutualInformationGainMaximization,
KLDivergenceMaximization,
)
from skactiveml.pool.tests.provide_test_pool_regression import (
provide_test_regression_query_strategy_init_random_... |
from pyminder.goal import Goal
from natlibpy.factory import Factory
import datetime
import json
from road_compare.requests import Requests
from road_compare.python import Python
class Main:
_factory: Factory
_python: Python
_requests: Requests
def __init__(self, factory: Factory, python: Python, requ... |
# Copyright 2020 Google Research. 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... |
import ujson as json |
# -*- coding: utf-8 -*-
# Copyright 2021 Cohesity Inc.
class WormRetentionTypeProtectionPolicyEnum(object):
"""Implementation of the 'WormRetentionType_ProtectionPolicy' enum.
Specifies WORM retention type for the snapshots. When a WORM retention
type is specified, the snapshots of the Protection Jobs us... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""The setup script."""
from setuptools import setup, find_packages
with open('README.rst') as readme_file:
readme = readme_file.read()
setup_requirements = [{%- if cookiecutter.use_pytest == 'y' %}'pytest-runner',{%- endif %} ]
test_requirements = [{%- if cookiecu... |
import os
from datetime import datetime
from openpyxl import load_workbook
from openpyxl.styles import PatternFill
_IGM_ROW_OFFSET = 25
_CONTACT = 'MacKenzie Bryant'
_EMAIL = 'mackenzie.m.bryant@gmail.com'
_INSTITUTE = 'Knight Lab'
_PI_NAME = 'Dr. Knight'
_PLATFORM = 'NovaSeq S4'
_RUN_TYPE = 'PE150'
_CUSTOM_PRIMER ... |
import json
from disnake.ext import commands
def get_prefix(bot, message):
try:
with open("./dicts/prefixes.json") as fin:
prefixes = json.load(fin)
pref = ''
if str(message.guild.id) in prefixes:
if str(message.author.id) in prefixes:
pref = prefi... |
from __future__ import unicode_literals
from frappe import _
def get_data():
return {
'fieldname': 'greige_mending_form',
'transactions': [
{
'label': _('Purchase Receipt'),
'items': ['Purchase Receipt']
}
]
} |
from flask_io import FlaskIO
from flask_sqlalchemy import SQLAlchemy
db = SQLAlchemy()
io = FlaskIO() |
# -*- coding: utf-8 -*-
import re
from streamlink.plugin import Plugin
from streamlink.plugin.api import validate, useragents
from streamlink.stream import HLSStream, RTMPStream
from streamlink.stream.hls import HLSStreamReader, HLSStreamWorker
_url_re = re.compile(r'''^https?://
(?:\w*.)?
showroom-live.com/
... |
import os
""" Get the current absolute path to the Repository on your system.
Usefull for handling data and tests while being agnostic to current work dir
"""
path = os.path.abspath(os.getcwd())
while 'aisscv' in path:
path = os.path.abspath(path+'/..')
__RepoPath__ = path |
def deal_day1(src, dest):
n = len(src)
for i in range(n):
dest[n-i-1] = src[i]
def deal_one(src_pos, stack_size):
return stack_size-src_pos-1
def inv_deal_one(src_pos=None, deck_size=None):
# well, that's easy to invert...
return deck_size-src_pos-1
def inv_deal_all(src, dest):
dea... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.