text stringlengths 2 999k |
|---|
import os
import json
import logging
import utils.gql as gql
import reconcile.queries as queries
from utils.jira_client import JiraClient
from utils.slack_api import SlackApi
QUERY = """
{
jira_boards: jira_boards_v1 {
path
name
server {
serverUrl
token {
path
}
}
sla... |
# Copyright 2017 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... |
# This Python file uses the following encoding: utf-8
"""autogenerated by genpy from zzz_perception_msgs/BoundingBox.msg. Do not edit."""
import sys
python3 = True if sys.hexversion > 0x03000000 else False
import genpy
import struct
import zzz_perception_msgs.msg
import geometry_msgs.msg
class BoundingBox(genpy.Messa... |
# This file is part of Indico.
# Copyright (C) 2002 - 2021 CERN
#
# Indico is free software; you can redistribute it and/or
# modify it under the terms of the MIT License; see the
# LICENSE file for more details.
from __future__ import unicode_literals
import os
import pytest
from indico.web.flask.app import make_a... |
# coding: utf-8
from flask import Flask
from flask_sqlalchemy import SQLAlchemy
from flask_login import LoginManager
from config import config
app = Flask(__name__)
"""
config
-- 'default': DevelopmentConfig
-- 'develop': DevelopmentConfig
-- 'testing': TestingConfig
-- 'production': ProductionConfig
you can... |
"""
Download process for Sentinel Hub Statistical API
"""
import logging
import copy
import os
import concurrent.futures
from .sentinelhub_client import SentinelHubDownloadClient
from ..constants import MimeType
from ..decoding import decode_data as decode_data_function
from ..io_utils import read_data, write_data
L... |
from django.db import models
from django.contrib.auth.models import User
from django.db.models.signals import post_save
from explorer import settings
from django.urls import reverse
from django.conf import settings
class Profile(models.Model):
user = models.OneToOneField(settings.AUTH_USER_MODEL,
... |
# --------------------------------------------------------
# Fast/er R-CNN
# Licensed under The MIT License [see LICENSE for details]
# Written by Ross Girshick and Xinlei Chen
# --------------------------------------------------------
from __future__ import absolute_import
from __future__ import division
from _... |
#
# 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... |
# GNU MediaGoblin -- federated, autonomous media hosting
# Copyright (C) 2011, 2012 MediaGoblin contributors. See AUTHORS.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either versio... |
#Date: July 21, 2021
#Author: Jimmy Majumder
#Affiliation: Graduate student-M1, LSSE, Kyutech, Japan.
# ©All rights to Shibatalaboratory, Kyutech, Japan.
import hebi
from time import sleep, time
lookup = hebi.Lookup() #initialization
# Wait 2 seconds for the module list to populate
sleep(10)
group = lookup.get_gr... |
#!/usr/bin/env python3
"""Script for updating data. """
import argparse
import json
import os
import re
import subprocess
from datetime import datetime, timedelta, tzinfo
from tempfile import mkstemp
from zipfile import ZipFile
from tqdm import tqdm
from fetch_holidays import CustomJSONEncoder, fetch_holiday
class... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from builtins import object
import boto3
from botocore.config import Config
from .resources.config import BOTO3_RETRIES
from .resources.models import AMI
class Fetcher(object):
""" Fetches function for AMI candidates to deletio... |
#! /usr/bin/env python
# Copyright (c) 2015, Fundacion Dr. Manuel Sadosky
# 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 notic... |
import torch
import torch.nn as nn
from pytorch_direct_warp.direct_proj import direct_projection
class DirectWarper(nn.Module):
def __init__(self, keep_index=False):
super(DirectWarper, self).__init__()
self.id_grid = None
self.keep_index = keep_index
def set_id_grid(self, depth):
... |
"""Test Home Assistant yaml loader."""
import io
import os
import unittest
from unittest.mock import patch
from homeassistant.exceptions import HomeAssistantError
from homeassistant.util import yaml
from homeassistant.config import YAML_CONFIG_FILE, load_yaml_config_file
from tests.common import get_test_config_dir, p... |
# Generated by Django 3.0.5 on 2020-06-01 15:00
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('library', '0010_auto_20200531_1750'),
]
operations = [
migrations.CreateModel(
name='Revue',
... |
# -*- coding: utf-8 -*-
#----------------------------------------------------------------------------
# Name: panel.py
# Purpose:
#
# Author: Andrea Gavana <andrea.gavana@gmail.com>
#
# Created:
# Version:
# Date:
# Licence: wxWindows license
# Tags: phoenix-port, unittest, documented, py3-po... |
from django.test import TestCase
from django.contrib.auth import get_user_model
class ModelTests(TestCase):
def test_create_user_with_email_successful(self):
"""Test creating a new user with an email is successful"""
email = "shahram.zarie.sarabi@gmail.com"
password = "123456789"
... |
from setuptools import setup
REQUIREMENTS = [
'requests'
]
TEST_REQUIREMENTS = [
'pytest',
'pytest-cov'
]
setup(
name='yadummy',
version='0.0.1',
description="Yet Another Dummy Project",
author="Madh93",
author_email='mhdez@protonmail.com',
url='https://github.com/Madh93/yadummy',... |
#!/usr/bin/env python
import os
import sys
import unittest
import logging
pkg_root = os.path.abspath(os.path.join(os.path.dirname(__file__), '..')) # noqa
sys.path.insert(0, pkg_root) # noqa
from tests.infra import SuppressWarningsMixin # noqa
from xsamtools.utils import run, XSamtoolsCalledProcessError # noqa
l... |
# -*- coding:utf-8 -*-
# Copyright 2015 NEC Corporation. #
# #
# Licensed under the Apache License, Version 2.0 (the "License"); #
# you may not use this file except in compliance with the License... |
"""
https://leetcode.com/problems/minimum-add-to-make-parentheses-valid/
https://leetcode.com/submissions/detail/182907873/
"""
class Solution:
def minAddToMakeValid(self, S):
"""
:type S: str
:rtype: int
"""
ans = 0
depth = 0
for char in S:
if ... |
"""
Python implementation of the LiNGAM algorithms.
The LiNGAM Project: https://sites.google.com/site/sshimizu06/lingam
"""
import numbers
import numpy as np
from sklearn.utils import check_array, resample
from .utils import find_all_paths
class BootstrapMixin():
"""Mixin class for all LiNGAM algorithms that i... |
# coding=utf-8
# Copyright 2022 The Google Research 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 applicab... |
# 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 typing import Union
from dataclasses import dataclass
from torchaudio.datasets.utils import download_url
import pathlib
@dataclass
clas... |
import os
import sys
import click
from zipfile import ZipFile
from askanna.core import client as askanna_client
from askanna.core.utils import get_config
HELP = """
Package downloader, intended for use with runner and unpacks code to /code
"""
SHORT_HELP = "Download package code for AskAnna"
@click.command(help=H... |
# Source: https://github.com/rwightman/pytorch-dpn-pretrained (License: Apache 2.0)
# Pretrained: Yes
import math
from .dualpath import *
from torchvision.models.resnet import resnet18, resnet34, resnet50, resnet101, resnet152
from torchvision.models.densenet import densenet121, densenet169, densenet161, densenet201
f... |
from typing import Any
from hypothesis import given
from hypothesis.strategies import from_type, lists, tuples
from absort.lfu import LFU
# TODO we need to test on LFU after random sequence of update/evict operations.
anys = lambda: from_type(type)
@given(lists(anys()))
def test_size(l: list) -> None:
lfu = ... |
# Generated by Django 3.2.10 on 2021-12-30 15:25
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('feedback_map', '0001_initial'),
]
operations = [
migrations.CreateModel(
name='Tag',
fields=[
('tag... |
# ###########################################################################
#
# CLOUDERA APPLIED MACHINE LEARNING PROTOTYPE (AMP)
# (C) Cloudera, Inc. 2021
# All rights reserved.
#
# Applicable Open Source License: Apache 2.0
#
# NOTE: Cloudera open source products are modular software products
# made up of hu... |
from bclearer_source.b_code.common_knowledge.convention_shift_operation_types import ConventionShiftOperationTypes
from bclearer_source.b_code.configurations.convention_shift_operation_configurations import \
ConventionShiftOperationConfigurations
def get_boson_1_2_2e_j1_configuration_separate_standard_names_and_... |
# Copyright 2021 DeepMind Technologies Limited. 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 ... |
import pytest
import torch
import pytorch_lightning as pl
import tests.base.develop_utils as tutils
from tests.base import EvalModelTemplate
@pytest.mark.skipif(torch.cuda.device_count() < 2, reason="test requires multi-GPU machine")
def test_single_gpu_test(tmpdir):
tutils.set_random_master_port()
model = ... |
from pathlib import Path
from unittest.mock import patch
import numpy as np
from sklearn import datasets
from sklearn.preprocessing import scale
from pyclustertend import (
vat,
ivat,
compute_ordered_dissimilarity_matrix,
compute_ivat_ordered_dissimilarity_matrix,
)
TEST_DIR = Path(__file__).resolve(... |
# pylint: disable=redefined-outer-name
import json
import keras
import numpy as np
import pytest
import tensorflow as tf
import bentoml
from tests.integration.utils import (
build_api_server_docker_image,
export_service_bundle,
run_api_server_docker_container,
)
TF2 = tf.__version__.startswith('2')
if ... |
# star/controllers.py
# Brought to you by We Vote. Be good.
# -*- coding: UTF-8 -*-
from .models import StarItemList, StarItemManager
from ballot.models import CANDIDATE, MEASURE, OFFICE
from candidate.models import CandidateCampaignManager
from django.http import HttpResponse
import json
from measure.models import Co... |
#encoding:utf-8
subreddit = 'space'
t_channel = '@r_space'
def send_post(submission, r2t):
return r2t.send_simple(submission)
|
import sys
import threading
import warnings
import weakref
from django.utils import six
from django.utils.deprecation import RemovedInDjango20Warning
from django.utils.inspect import func_accepts_kwargs
from django.utils.six.moves import range
if six.PY2:
from .weakref_backports import WeakMethod
else:
from w... |
import time
class Node(object):
def __init__(self, dataArg = None, nextArg = None):
self.__data = dataArg
self.next = nextArg
self.__has_been_visited = False
self.__time_visited = 0
def ck_data(self):
return self.__data
def ck_next(self):
return self.next
... |
from __future__ import print_function, division
from keras.initializers import RandomNormal
from keras.datasets import cifar10
from keras.layers import Input, Dense, Reshape, Flatten, Dropout
from keras.layers import BatchNormalization, Activation, ZeroPadding2D
from keras.layers.advanced_activations import LeakyReLU
f... |
# Generated by Django 3.0.7 on 2020-06-26 16:29
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('student_information_app', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name='attendance',
name='at... |
"""libtiff3 interface using ctypes.
from
http://starship.python.net/crew/theller/wiki/TiffWrapping
"""
import ctypes
import logging # Logging module
import platform # Platform discovery
class Tiff3Error(Exception):
pass
def InitUNIX(libpath="libtiff.so"):
log = logging.getLogger("LibTiff3.Init")
... |
#!/usr/bin/env python
# coding: utf-8
"""
The Clear BSD License
Copyright (c) – 2016, NetApp, Inc. All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted (subject to the limitations in the disclaimer below) provided that the following conditions... |
import json
from copy import deepcopy
from pathlib import Path
import pytest
from kedro_diff import KedroDiff
from kedro_diff.sample_data import create_simple_sample
DATA = Path(__file__).parent / "sample-data"
pipe10 = create_simple_sample(10)
pipe10_change_one_input = deepcopy(pipe10)
pipe10_change_one_input["pip... |
from flask import Flask, render_template, jsonify, redirect
import pymongo
import scrape_mars
app = Flask(__name__)
conn = "mongodb://localhost:27017"
client = pymongo.MongoClient(conn)
db = client.mars_db
@app.route("/")
def index():
listings = list(db.listings_mars.find())
print(listings)
return rende... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import gc
import os
import sys
import time
sys.path.append('../../')
import pandas as pd
import torch
import torch.nn as nn
from torch.utils.data import DataLoader
from tqdm import tqdm
from logdeep.dataset.log import log_dataset
from logdeep.dataset.samp... |
#!/usr/bin/env python
# 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/.
#
# Copyright 1997 - July 2008 CWI, August 2008 - 2016 MonetDB B.V.
import os
from setuptools im... |
'''
Created by auto_sdk on 2020.03.24
'''
from dingtalk.api.base import RestApi
class OapiRhinoMosExecClothesUnperformedGetRequest(RestApi):
def __init__(self,url=None):
RestApi.__init__(self,url)
self.req = None
def getHttpMethod(self):
return 'POST'
def getapiname(self):
return 'dingtalk.oapi.rhino.mos.e... |
#### This script will calculate AP per classwise without considering bounding boxes precision. This can be used to have a sanity check on the learnt model###
from sklearn.metrics import average_precision_score
from sklearn.metrics import classification_report
import pandas as pd
import torch
import numpy as np
import ... |
#!/usr/bin/env python
#
# Copyright (C) 2016 The CyanogenMod Project
# Copyright (C) 2017-2020 The LineageOS Project
#
# 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... |
import abc
import sys
import reframe.core.debug as debug
import reframe.core.logging as logging
import reframe.core.runtime as runtime
from reframe.core.environments import EnvironmentSnapshot
from reframe.core.exceptions import (AbortTaskError, JobNotStartedError,
ReframeFatalErro... |
# Copyright 2018 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... |
"""
MetOncoFit Interactive explorer
This application was built with a Flask framework using Dash and Plotly. The explorer shows three heatmaps that shows the top 10 features predicted by MetOncoFit on the y-axis, the genes corresponding to the feature predictions on the x-axis, and each cell is the corresponding ge... |
"""
This file should only be imported from Python 3.
It will raise SyntaxError when importing from Python 2.
"""
def sync_to_async(func):
"""Convert a blocking function to async function"""
async def wrapper(*args, **kwargs):
return func(*args, **kwargs)
return wrapper
|
import os
import sys
from sc2 import maps
from sc2.bot_ai import BotAI
from sc2.ids.ability_id import AbilityId
from sc2.ids.buff_id import BuffId
from sc2.ids.unit_typeid import UnitTypeId
from sc2.ids.upgrade_id import UpgradeId
from sc2.main import run_game
sys.path.append(os.path.join(os.path.dirname(__file__), "... |
"""Tests for the Alexa integration."""
from uuid import uuid4
from homeassistant.components.alexa import config, smart_home
from homeassistant.core import Context
from tests.common import async_mock_service
TEST_URL = "https://api.amazonalexa.com/v3/events"
TEST_TOKEN_URL = "https://api.amazon.com/auth/o2/token"
c... |
# -*- coding: utf-8 -*-
# PLEASE DO NOT EDIT THIS FILE, IT IS GENERATED AND WILL BE OVERWRITTEN:
# https://github.com/ccxt/ccxt/blob/master/CONTRIBUTING.md#how-to-contribute-code
from ccxt.async_support.base.exchange import Exchange
import hashlib
from ccxt.base.errors import ExchangeError
from ccxt.base.errors impor... |
# coding: utf-8
"""
Kubernetes
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501
The version of the OpenAPI document: release-1.19
Generated by: https://openapi-generator.tech
"""
import pprint
import re # noqa: F401
import si... |
# coding: utf-8
import re
import six
from huaweicloudsdkcore.utils.http_utils import sanitize_for_serialization
class OsfederationIdentityprovider:
"""
Attributes:
openapi_types (dict): The key is attribute name
and the value is attribute type.
attribute_map (dict... |
from collections import defaultdict, namedtuple
from django.contrib.gis import forms, gdal
from django.contrib.gis.db.models.proxy import SpatialProxy
from django.contrib.gis.gdal.error import GDALException
from django.contrib.gis.geos import (
GeometryCollection, GEOSException, GEOSGeometry, LineString,
Multi... |
import torch.nn as nn
import math
import torch.utils.model_zoo as model_zoo
from models.sync_batchnorm.batchnorm import SynchronizedBatchNorm2d
webroot = "https://tigress-web.princeton.edu/~fy/drn/models/"
model_urls = {
"resnet50": "https://download.pytorch.org/models/resnet50-19c8e357.pth",
"drn-c-26": webr... |
#很直白的思路, 但是为了不用额外的空间, 代码写的就比较丑了, 因为这里1已经表示有障碍, 所以用2表示初始化的可通行,然后再结果出除一下就是真实个数了, 另外就是每个格子除了判断来路两个方向之外, 还要判断自己本身是否有障碍
class Solution:
def uniquePathsWithObstacles(self, obstacleGrid):
"""
:type obstacleGrid: List[List[int]]
:rtype: int
"""
for i in range(0,len(obstacleGrid)):
... |
import tkinter, tkinter.messagebox
def main(title, message):
root = tkinter.Tk()
root.withdraw()
tkinter.messagebox.showinfo(title, message)
root.destroy()
|
class TreeNode:
def __init__(self, x):
self.val = x
self.left = None
self.right = None
# Definition for a binary tree node.
# class TreeNode:
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
class Solution:
def countNod... |
# Copyright 2012 Hewlett-Packard Development Company, L.P.
#
# 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 sys, os
sys.path.append("/usr/lib/python2.7/dist-packages")
from exascript_python import *
import decimal
import datetime
import traceback
import imp
class exa:
def __init__(self):
self.__modules = {}
self.__meta = meta = Metadata()
class exameta: pass
mo = exameta()
... |
from dagster_mlflow.version import __version__
def test_version():
assert __version__
|
# (c) Copyright 2015 Hewlett Packard Enterprise Development LP
#
# 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 aws_ssm_copy.copy import main
main()
|
from gym.envs.registration import registry, register, make, spec
# Algorithmic
# ----------------------------------------
register(
id='Copy-v0',
entry_point='gym.envs.algorithmic:CopyEnv',
max_episode_steps=200,
reward_threshold=25.0,
)
register(
id='RepeatCopy-v0',
entry_point='gym.envs.alg... |
from functools import partial
from pyrogram import filters
from pyrogram.types import InlineKeyboardButton
command = partial(filters.command, prefixes="/")
def button_toggle(button: InlineKeyboardButton) -> None:
is_selected = button.text[0] == "🔴"
if is_selected:
button.text = button.text.replace... |
# -------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
# --------------------------------------------------------------------------
import py... |
# -*- coding: utf-8 -*-
''' This file compiles a set of functions
Collects parameters from user
Loads Twitter API credentials and connects to API
Creates a .db file using sqlite3
Collects and process attrs from Twitter data
Builds and saves a network-like dataset
'''
# import modules
from w3lib.html import replace_en... |
from flask import Flask, render_template # import flask and render_template to render from HTML file
from flask import request # import request object
from dotenv import load_dotenv # import load_dotenv to handle env. variable loading
# Execution: this script will run in an environment with the Flask and dotenv mod... |
from machine import enable_irq, disable_irq, idle
import time
class HX711:
def __init__(self, pd_sck=5, dout=4, gain=128):
self.pSCK = Pin(pd_sck, Pin.OUT)
self.pOUT = Pin(dout, Pin.IN, pull=Pin.PULL_DOWN)
self.pSCK.value(False)
self.GAIN = 0
self.OFFSET = 0
... |
import unittest
from six import text_type, u, b, PY2, PY3
from nose.tools import raises
from expects import *
import httpretty
import textwrap
import json
import datetime
import pytz
from .validate_jwt import validate_jwt_header
from opentok import Client, Archive, __version__, OutputModes
class OpenTokArchiveTest(u... |
import os
import time
import math
import pickle
import cv2
import facenet
import numpy as np
from .face import Detection, Encoder, Face
from sklearn.svm import SVC
scale = 1
dataset_path = 'datasets'
name = input('Please enter a name: ')
path = dataset_path + '/' + name
classifier_filename = 'classifier/face_classifi... |
"""A module that stores classes related ot view configuration.
Attributes:
log (logging.Logger): Logger for this module.
"""
import time
import logging
import weakref
from os import path
from threading import RLock
from threading import Timer
from .tools import File
from .tools import Tools
from .tools import Sub... |
from __future__ import division
import cv2
import numpy as np
import matplotlib.pyplot as plot
from math import sin, cos, pi
img = cv2.imread("chessboard.bmp")
row4 = np.array(img, dtype='u1')[4]
# performs sampling of a continuous signal
def sampling(y, t, n): # signal, period, number of components
result = np... |
#
# 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
# ... |
# exported from PySB model 'model'
from pysb import Model, Monomer, Parameter, Expression, Compartment, Rule, Observable, Initial, MatchOnce, Annotation, ANY, WILD
Model()
Monomer('Ligand', ['Receptor'])
Monomer('ParpU', ['C3A'])
Monomer('C8A', ['BidU', 'C3pro'])
Monomer('SmacM', ['BaxA'])
Monomer('BaxM', ['BidM', '... |
from typing import Any, Optional
from starlette.requests import Request
from starlette.responses import Response
from fastapi_users.db import BaseUserDatabase
from fastapi_users.models import BaseUserDB
class BaseAuthentication:
"""
Base authentication backend.
Every backend should derive from this cla... |
# Author: Nikolay Mayorov <n59_ru@hotmail.com>
# License: 3-clause BSD
import numpy as np
from scipy.sparse import issparse
from scipy.special import digamma
from ..metrics.cluster import mutual_info_score
from ..neighbors import NearestNeighbors, KDTree
from ..preprocessing import scale
from ..utils import... |
from __future__ import unicode_literals
import datetime
import os
import re
import sys
from unittest import skipIf
import warnings
from xml.dom.minidom import parseString
try:
import pytz
except ImportError:
pytz = None
from django.conf import settings
from django.core import serializers
from django.core.url... |
import tensorflow as tf
#from tf.keras.models import Sequential, Model
#from keras.layers import Input, Dense, TimeDistributed, merge, Lambda
#from keras.layers.core import *
#from keras.layers.convolutional import *
#from keras.layers.recurrent import *
#from keras.activations import relu
from functools import parti... |
# Copyright(c) 2017-2020 Association of Universities for Research in Astronomy, Inc.
import numpy as np
from astropy.modeling import fitting, models, FittableModel, Parameter
from astropy.modeling.fitting import (_validate_model,
_fitter_to_model_params,
... |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes ... |
import zlib
import logging
import socketserver
import binascii
BLOCK_SIZE = 64
class ZlibRequestHandler(socketserver.BaseRequestHandler):
logger = logging.getLogger('Server')
def handle(self):
compressor = zlib.compressobj(1)
# Find out what file the client wants
filename = self.re... |
#include the Numpy linbrary
import numpy as np
#define the main() function
def main():
i = 0
x = 119.0
for i in range(120):
if((i%2)==0):
x += 3
else:
x -= 5
s = "%3.2e" % x
print(s)
if __name__ == "__main__":
main() |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may ... |
"""
Setup module.
"""
import re
import sys
from os.path import join as pjoin
from setuptools import setup
with open(pjoin('osbrain', '__init__.py')) as f:
line = next(l for l in f if l.startswith('__version__'))
version = re.match('__version__ = [\'"]([^\'"]+)[\'"]', line).group(1)
# While Python 3.4 is supp... |
# Copyright 2017 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... |
# Copyright 2012 by Wibowo Arindrarto. All rights reserved.
# This code is part of the Biopython distribution and governed by its
# license. Please see the LICENSE file that should have been included
# as part of this package.
"""Tests for SearchIO ExonerateIO parsers."""
import os
import unittest
from Bio import ... |
import numpy as np
import geometry as geom
from numpy import linalg as la
def calculate_form_value(M, b, vec):
# Подсчет значения формы M(x,x) - b(x) на векторе vec
res = np.dot(np.transpose(vec),
np.dot(M, vec)) + np.dot(np.transpose(b), vec)
try :
return res[0, 0]
except Index... |
import threading
import torch
import numpy as np
class TBHook(object):
def __init__(self, model,writer, start_iter=0, n_parallel_devices=0, log_interval=200):
self.hook = model.register_forward_hook(self.hook_fn)
self.writer = writer
self.log_interval = log_interval
self.n_parallel_... |
from django.utils.translation import ugettext_lazy as _
from .classes import Dashboard
dashboard_main = Dashboard(name='main', label=_('Main'))
|
import gym
import math
import numpy as np
from tasks.Task import Task
class CartPole(Task):
def __init__(self, discrete=False):
self.env = gym.make('CartPole-v1')
self.buckets = (3, 3, 6, 3)
self.discrete = discrete
def initial_state(self, training=True):
state = self.env.re... |
import os
import shutil
import site
from pathlib import Path
from typing import TYPE_CHECKING, Optional
from poetry.core.pyproject.project import Project
from poetry.core.utils.props_ext import cached_property
from poetry.console import console
from poetry.console.exceptions import PoetrySimpleConsoleException
from p... |
#
# 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 us... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.