text stringlengths 2 999k |
|---|
# -------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
# --------------------------------------------------------------------------
import ... |
# Copyright 2020 Zachary Frost
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribut... |
"""
scaffoldgraph.io.smiles
Contains functions for reading molecules from SMILES files.
"""
from rdkit.Chem import SmilesMolSupplier
from .supplier import EnumeratedMolSupplier, MolSupplier
def read_smiles_file(smiles_file, delimiter=' ', smiles_column=0,
name_column=1, header=False, requires_... |
from __future__ import print_function
from bokeh.browserlib import view
from bokeh.document import Document
from bokeh.embed import file_html
from bokeh.glyphs import Circle
from bokeh.objects import (
Plot, DataRange1d, LinearAxis, Grid, ColumnDataSource, Glyph, PanTool, WheelZoomTool
)
from bokeh.resources impor... |
"""Asynchronous Python client for Autarco API."""
from __future__ import annotations
import asyncio
import socket
from dataclasses import dataclass
from importlib import metadata
from typing import Any
import aiohttp
import async_timeout
from aiohttp.client import ClientError, ClientResponseError, ClientSession
from ... |
import json
import os
with open(os.getcwd() + '/pods.json', 'r') as jfile:
lines = jfile.readlines()
pods_lines = []
for l in lines:
wl = l
if l == '}\n':
wl = '},\n'
pods_lines.append(wl)
for line in [-1,-2,-3,-4]:
if pods_lines[line] == "},\n":
pods_lines[line] = "}\n"
... |
from OpenGLCffi.GLX import params
@params(api='glx', prms=['dpy', 'config', 'width', 'height', 'attrib_list'])
def glXCreateGLXPbufferSGIX(dpy, config, width, height, attrib_list):
pass
@params(api='glx', prms=['dpy', 'pbuf'])
def glXDestroyGLXPbufferSGIX(dpy, pbuf):
pass
@params(api='glx', prms=['dpy', 'pbuf', '... |
"""
Você deve criar uma classe carro que vai possuir
dois atributos compostos por outras duas classes:
1) Motor
2) Direção
O Motor terá a responsabilidade de controlar a velocidade.
Ele oferece os seguintes atributos:
1) Atributo de dado velocidade
2) Método acelerar, que deverá incremetar a velocidade de uma unidade
3... |
from datetime import date
from dateutil import parser
from .utils import DslBase, _make_dsl_class, ObjectBase, AttrDict
__all__ = ['construct_field', 'Object', 'Nested', 'Date', 'String', 'Float',
'Double', 'Byte', 'Short', 'Integer', 'Long', 'Boolean', 'Ip', 'Attachment',
'GeoPoint', 'GeoShape', ]
def const... |
import pandas as pd
from collections import namedtuple
#Data
from data.student import Student
#Utils
from utils.students_loader import loadStudents
from utils.corpus_loader import corpus_loader
#Const
import constants as const
#NLP Base
from baseNLP.word import Word
#Load list of Students
students = loadStudents(con... |
import difflib
import functools
import math
import numbers
import os
import warnings
import numpy as np
from tlz import frequencies, concat
from .core import Array
from ..highlevelgraph import HighLevelGraph
from ..utils import has_keyword, ignoring, is_arraylike
try:
AxisError = np.AxisError
except AttributeErr... |
'Algorithmia Data API Client (python)'
import json
import re
import os
import six
import tempfile
import Algorithmia
from Algorithmia.datafile import DataFile, AdvancedDataFile, LocalDataFile
from Algorithmia.data import DataObject, DataObjectType
from Algorithmia.errors import DataApiError
from Algorithmia.util impo... |
from pi_monitor.core import Event
import sendgrid
from sendgrid.helpers.mail import Content, Email, Mail
from python_http_client import exceptions
class Sendgrid:
def __init__(self, config):
config = _process_config(config)
self.api_key = config['api_ky']
self.from_email = config['from_ema... |
import networkx.algorithms.tests.test_minors
import pytest
from graphscope.nx.utils.compat import import_as_graphscope_nx
import_as_graphscope_nx(networkx.algorithms.tests.test_minors,
decorators=pytest.mark.usefixtures("graphscope_session"))
@pytest.mark.skip(reason="not support Graph objec... |
# Configuration file for the Sphinx documentation builder.
#
# This file only contains a selection of the most common options. For a full
# list see the documentation:
# http://www.sphinx-doc.org/en/master/config
# -- Path setup --------------------------------------------------------------
# If extensions (or module... |
# coding: utf-8
"""
Utility functions and classes for validation.
"""
__author__ = "Dan Gunter"
__copyright__ = "Copyright 2012-2013, The Materials Project"
__version__ = "1.0"
__maintainer__ = "Dan Gunter"
__email__ = "dkgunter@lbl.gov"
__status__ = "Development"
__date__ = "3/29/13"
#!/usr/bin/env python3
from arg... |
import logging
from importlib import import_module
from django.contrib.auth.signals import user_logged_in, user_logged_out
from django.dispatch import receiver
from django.db.models.signals import post_save
from django.conf import settings
from django.core.mail import send_mail
from indicators.models import ReportingF... |
# -*- coding: utf-8 -*-
"""
This module is a scratchpad for general development, testing & debugging
"""
from django.core.management.base import NoArgsCommand
from django.db.models import connection
from pprint import pprint
from pexp.models import *
def reset_queries():
connection.queries=[]
def show_queries()... |
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi SDK Generator. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
# Export this package's modules as members:
from ._enums import *
from .budget import *
from .budget_by_resource_group_name import *
from .get_budget i... |
# Copyright (c) 2013 dotCloud, 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 requir... |
import argparse
import configparser
import dataclasses
from datetime import datetime
import functools
import json
import random
import string
from typing import Callable
import lipsum
import requests
from tqdm import tqdm
DEFAULT_CONFIG = 'bot.ini'
class Bot:
@dataclasses.dataclass(frozen=False)
class User... |
import logipar
import json, os
with open(os.path.dirname(os.path.realpath(__file__)) + os.sep + 'cats.json') as json_file:
data = json.load(json_file)
print("-- Welcome to the cat library --")
s = input("Please enter an input string: ")
l = logipar.Logipar()
l.overwrite(logipar.Token.AND, "et")
l.caseSensitive = F... |
import copy
import pytest
from mmdet3d.core.evaluation.evaluation_3d.metrics import FalsePositivesPerFrameClassMetric, FalsePositivesPerFrame
class TestMetricFalsePositivesPerFrame:
def test_metric_keeps_results(self):
# this test should be implemented by all metrics
# assures that the original ma... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals, print_function, division
import logging
log = logging.getLogger("forecast")
has_pywapi = False
try:
import pywapi
has_pywapi = True
except:
log.error("Error loading library pywapi. Library not found.")
def fahrenheit_to_celcius(f):
r... |
import pandas as pd
import networkx as nx
import numpy as np
import json
import logging
from .helpers import combine_dicts
from datetime import datetime, timedelta
import community
from tqdm import tqdm
logger = logging.getLogger(__name__)
def convert_to_json(edge_df):
"""
Check if column type is list or di... |
import numpy as np
import rirgenerator as RG
import matplotlib.pyplot as plt
c = 340 # Sound velocity (m/s)
fs = 16000 # Sample frequency (samples/s)
r = [2,1.5,2] # Receiver position [x y z] (m)
s = [2,3.5,2] # Source position [x y z] (m)
L = [5,4,6] # Room dimensions [x y z] (m)
beta = 0.4 # Reverbe... |
import nltk
from nltk.stem.wordnet import WordNetLemmatizer
from sklearn.base import BaseEstimator, TransformerMixin
class Lemmatization(BaseEstimator, TransformerMixin):
def __init__(self):
nltk.download('wordnet')
self.lemmatizer = WordNetLemmatizer()
def fit(self, X, y=None):
retu... |
"""
some utiliy functions for data processing and visualization.
"""
import matplotlib.pyplot as plt
from matplotlib.patches import ConnectionPatch
import numpy as np
import torch
# class name for CIFAR-10 dataset
cifar10_class_name = ['airplane', 'automobile', 'bird', 'cat', 'deer', 'dog',
'fro... |
#!/usr/bin/python
# Copyright (c) 2020, 2021 Oracle and/or its affiliates.
# This software is made available to you under the terms of the GPL 3.0 license or the Apache 2.0 license.
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
# Apache License v2.0
# See LICENSE.TXT for d... |
"""
Negative of a distribution.
Example usage
-------------
Invert sign of a distribution::
>>> distribution = -chaospy.Uniform(0, 1)
>>> print(distribution)
Neg(Uniform(lower=0, upper=1))
>>> print(numpy.around(distribution.sample(5), 4))
[-0.3464 -0.885 -0.0497 -0.5178 -0.1275]
>>> print(d... |
class Interaction:
def __init__(self, _id, userid, slide_id, result, student_response, time, type, weighting):
self.id = _id
self.userid = userid
self.slide_id = slide_id
self.result = result
self.student_response = student_response
self.time = time
self.typ... |
"""Support for WiZ effect speed numbers."""
from __future__ import annotations
from collections.abc import Callable, Coroutine
from dataclasses import dataclass
from typing import Optional, cast
from pywizlight import wizlight
from homeassistant.components.number import (
NumberEntity,
NumberEntityDescriptio... |
#!/Users/taiwoadetiloye/Documents/development/chatbotApp/chatbotenv/bin/python
#
# The Python Imaging Library
# $Id$
#
# PIL raster font compiler
#
# history:
# 1997-08-25 fl created
# 2002-03-10 fl use "from PIL import"
#
from __future__ import print_function
import glob
import sys
# drivers
from PIL import Bdf... |
class Solution:
def validSubarrays(self, nums: List[int]) -> int:
stack, res = [], 0
for num in nums:
while stack and stack[-1] > num:
stack.pop()
stack.append(num)
res += len(stack)
return res |
from functools import reduce
print(reduce(lambda x,y: x+y, [1,2,3,4,5,6,7]))
def factorial(n):
return reduce(lambda x,y: x*y, range(1,n+1))
print(factorial(5)) |
#from rest_framework import serializers
from .models import UserProfiles
from dateutil.relativedelta import *
from datetime import date, datetime
from rest_framework.serializers import (
#HyperlinkedIdentityfield,
ModelSerializer,
SerializerMethodField,
ValidationError
)
class xUserProfilesSerializer(ModelSerial... |
#!/usr/bin/python
#coding=utf-8
import requests
from lxml import etree
from collections import namedtuple
import time
DBLP_BASE_URL = 'http://dblp.uni-trier.de/'
DBLP_AUTHOR_SEARCH_URL = DBLP_BASE_URL + 'search/author'
DBLP_PERSON_URL = DBLP_BASE_URL + 'pers/xk/{urlpt}'
DBLP_PUBLICATION_URL = DBLP_BASE_URL + 'rec/bib... |
import json
from lxml import etree
from ipware.ip import get_ip
from defusedxml.lxml import fromstring
from datetime import timedelta
from django.views.decorators.csrf import csrf_exempt
from django.utils.decorators import method_decorator
from django.views.generic import View
from django.http import HttpResponse, Htt... |
# -*- coding: utf-8 -*-
{
'name': "Academy",
'summary': """
Learning Odoo development with Kevin,
Enjoy the fun with Odoo""",
'description': """
This module covers nearly all sides of a module, from class to reports,
it is a good way for you to learn.
""",
'author'... |
# 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... |
ACCESS_TOKEN_COOKIE_NAME = "revibe_access_token"
BROWSER_EXPIRY_TIME = 5 # hours
DEFAULT_EXPIRY_TIME = 2 # hours
REVIBE_ARTISTS_EXPIRY_TIME = 5
REVIBE_MUSIC_EXPIRY_TIME = 2
REVIBE_FIRST_PARTY_APPLICATION_EXPIRY_TIME = DEFAULT_EXPIRY_TIME
# object constants
FIRST_PARTY_APPLICATION_NAME = 'Revibe First Party Applicati... |
"""
Copyright 2013 Rackspace
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
dist... |
import traceback
from time import time
from datetime import datetime
import gevent
from gevent.pool import Pool
class Application(object):
def __init__(self):
self.sockets = set()
self.pool = Pool(1024)
def __call__(self, environ, start_response):
path = environ['PATH_INFO'].strip('/... |
import xarray
from scipy.stats import norm
import numpy as np
import matplotlib.mlab as mlab
import matplotlib.pyplot as plt
list_indices = ['tasmax']
indices = list_indices[0]
exp = ['CTL_E0', '121GPsc_E0']
exp1 = '121GPsc_E0'
for i,ind in enumerate(exp): ... |
"""
Description: Socket wrapper that handles basic message sending needs like length
limiting.
Author: Amol Kapoor
"""
import socket
class SocketWrapper(object):
"""Wrapper for low level socket that handles sending/receiving messages."""
def __init__(self, is_listener, socket_info, user_socket=None):
... |
# -*- coding: utf-8 -*-
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: nn_service.proto
"""Generated protocol buffer code."""
from google.protobuf import descriptor as _descriptor
from google.protobuf import descriptor_pool as _descriptor_pool
from google.protobuf import message as _message
from g... |
#!/usr/bin/env python
'''
# Copyright 2013-2014 Mirsk Digital Aps (Author: Andreas Kirkedal)
# Copyright 2016 KTH Royal Institute of Technology (Author: Emelie Kullmann)
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtai... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# thumbor imaging service
# https://github.com/thumbor/thumbor/wiki
# Licensed under the MIT license:
# http://www.opensource.org/licenses/mit-license
# Copyright (c) 2011 globo.com thumbor@googlegroups.com
import cv2
import numpy as np
from thumbor.detectors import BaseDet... |
# -*- coding: utf-8 -*-
"""
##########
# Fields #
##########
Each Field class does some sort of validation. Each Field has a clean() method,
which either raises django.forms.ValidationError or returns the "clean"
data -- usually a Unicode object, but, in some rare cases, a list.
Each Field's __init__() takes at least... |
"""The tests device sun light trigger component."""
# pylint: disable=protected-access
from datetime import datetime
from unittest.mock import patch
import pytest
from homeassistant.components import (
device_sun_light_trigger,
device_tracker,
group,
light,
)
from homeassistant.components.device_track... |
from twisted.application.service import Service, IService
from twisted.python import filepath
from twisted.trial import unittest
from axiom.store import Store
from axiom.item import Item
from axiom.substore import SubStore
from axiom.attributes import text, bytes, boolean, inmemory
class SubStored(Item):
sche... |
import numpy as np
from defdap.quat import Quat
from scipy.stats import mode
from scipy.ndimage import zoom
from matflow_defdap import main_func
@main_func
def get_EBSD_image(EbsdMap, scaling_factor):
# Construct an array of Euler angles
grain_quats = np.empty((len(EbsdMap), 4))
# Transformation orient... |
"""SCons.Tool.sgic++
Tool-specific initialization for MIPSpro C++ on SGI.
There normally shouldn't be any need to import this module directly.
It will usually be imported through the generic SCons.Tool.Tool()
selection method.
"""
#
# Copyright (c) 2001, 2002, 2003, 2004 The SCons Foundation
#
# Permission is hereb... |
import argparse
import os
import sys
import time
import profile
import math
# Command line arguments
parser=argparse.ArgumentParser(description='Calculate the nearest two points on a plan')
parser.add_argument('--algorithm',default='a',\
help='Algorithm: Select the algorithm to run, default is all. (a)ll, (b)rutef... |
# Copyright (C) 2017-2020 University of Glasgow
#
# 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 the follow... |
"""Workflow to perform BSE calculation."""
from os.path import join as pjoin
import warnings
from ..config import flavors
from ..config import is_dft_flavor_espresso, is_dft_flavor_abinit, check_dft_flavor
from ..external import Structure
from ..core import Workflow
from ..BGW import EpsilonTask, SigmaTask, KernelTask... |
"""
EVE tests
"""
from __future__ import absolute_import
#pylint: disable=C0103,R0904,W0201,W0232,E1103
import sunpy
from sunpy.data.test import (EVE_AVERAGES_CSV)
class TestEve:
"""Tests the EVE class"""
def setup_class(self):
pass
def teardown_class(self):
pass
def test_csv... |
from dagster import check
from dagster.core.errors import DagsterInvalidDefinitionError
from dagster.utils.backcompat import experimental_arg_warning
from .config import ConfigMapping
from .definition_config_schema import convert_user_facing_definition_config_schema
from .graph import GraphDefinition
from .i_solid_def... |
from appannie.util import format_request_data
class Keyword(object):
EXPLORER_ENDPOINT = '/apps/{market}/keywords/explorer'
RANKED_ENDPOINT = '/apps/{market}/app/{product_id}/keywords/ranked'
PERFORMANCE_ENDPOINT = '/apps/{market}/app/{product_id}/keywords/ranks'
def __init__(self, http_client, marke... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from runner.koan import *
def function():
return "pineapple"
def function2():
return "tractor"
class Class:
def method(self):
return "parrot"
class AboutMethodBindings(Koan):
def test_methods_are_bound_to_an_object(self):
obj = Class()
... |
#!/usr/bin/env python
"""
Copyright 2019 Johns Hopkins University (Author: Jesus Villalba)
Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0)
Evals PLDA LLR
"""
import sys
import os
import argparse
import time
import logging
import numpy as np
from hyperion.hyp_defs import float_cpu, config_logger
fr... |
import sklearn
def test_scikit_learn_version():
# Test the model is trained and pickled in scikit-learn "0.23.1"
assert sklearn.__version__ == '0.23.1', 'scikit-learn version is changed!' |
# Copyright (C) 2020, 2022 GreenWaves Technologies, SAS
# 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 version 3 of the
# License, or (at your option) any later version.
# This... |
import functools
import random
import threading
import tkinter as tk
import tkinter.scrolledtext as tkst
import cv2
import numpy as np
from PIL import Image, ImageTk
from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg
from matplotlib.figure import Figure
from mpl_toolkits.mplot3d import Axes3D # this impo... |
# Copyright 2021 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# 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 ... |
# -------------------------------------------------------------------- #
# #
# Python script for calculating the bandstructure of C60 #
# #
# This scgript c... |
# -*- coding: utf-8 -*-
"""
Sphinx test suite utilities
~~~~~~~~~~~~~~~~~~~~~~~~~~~
:copyright: Copyright 2007-2015 by the Sphinx team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
import os
import re
import sys
import tempfile
from functools import wraps
from six import StringIO
from no... |
#!/usr/bin/env python3
# Copyright (c) 2019-2021 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Useful Script constants and utils."""
from test_framework.script import (
CScript,
CScriptOp,
... |
"""
# This is the application (probably basic) to find the location (almost any) in any Country
# according to the choices of your preference. Uses Foursquare API to get the data (geojson),
# also uses shitty tkinter GUI for accepting data. Please provide the Access key for the API
# if bychance not given! Thi... |
import unittest
from text_preparation.framing_numbers.tests.fixtures import test_cases, test_texts
from text_preparation.framing_numbers.framing_numbers import NumberWithSpacesCase
class FramingNumbersTest(unittest.TestCase):
def test_cases(self):
for text, expected in test_cases:
match_pos =... |
# Generated by Django 3.0.1 on 2020-12-26 12:38
from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone
import taggit.managers
class Migration(migrations.Migration):
initial = True
dependencies = [
('taggit', '0003_taggeditem_add_unique_index'),
]
... |
import os
from setuptools import setup, find_packages
from pip.req import parse_requirements
from pip.download import PipSession
# parse_requirements() returns generator of pip.req.InstallRequirement objects
install_requires = parse_requirements('requirements.txt', session=PipSession())
# reqs is a list of requireme... |
# This is an auto-generated Django model module.
# You'll have to do the following manually to clean this up:
# * Rearrange models' order
# * Make sure each model has one field with primary_key=True
# * Make sure each ForeignKey has `on_delete` set to the desired behavior.
# * Remove `managed = False` lines if ... |
# -*- coding: utf-8 -*-
# Copyright (c) 2019, Frappe Technologies Pvt. Ltd. and Contributors
# See license.txt
from __future__ import unicode_literals
# import frappe
import unittest
class TestLoanSecurityType(unittest.TestCase):
pass
|
# All cards available in a standard deck.
from classes import *
#TAs
aaron = TACard('Baron Aaron', 2100, 1300)
albert = TACard('Albert, Lethargy Incarnate', 1000, 2000)
alex = TACard('President Lieutenant Stennet for Senate', 1400, 2000)
aman = TACard('Aman', 1000, 2100)
anita = TACard("Anita, the Amazin' Avocado", 15... |
# Listas 1
calificaciones = [10, 9, 8, 10, 9, 8, 6]
promedio = 0
numero_elementos = 0
suma = 0
for calificacion in calificaciones:
numero_elementos = numero_elementos + 1
suma = suma + calificacion
promedio = suma / numero_elementos
print("Promedio: ", promedio)
# Usando while
numero_elementos = len(califi... |
import tensorflow as tf
import prettytensor as pt
from prettytensor.tutorial import data_utils
tf.app.flags.DEFINE_string('save_path', None, 'Where to save the model checkpoints.')
FLAGS = tf.app.flags.FLAGS
BATCH_SIZE = 50
EPOCH_SIZE = 60000 // BATCH_SIZE
TEST_SIZE = 10000 // BATCH_SIZE
tf.app.flags.DEFINE_string('... |
# Copyright 2017 Neural Networks and Deep Learning lab, MIPT
#
# 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... |
# -*- coding: utf-8 -*-
"""CLI UPnP client module."""
# pylint: disable=invalid-name
import argparse
import asyncio
import json
import logging
import operator
import sys
import time
import urllib.parse
from ipaddress import IPv4Address
from typing import Any, Mapping, Optional, Sequence, Tuple
from async_upnp_client ... |
#!/usr/bin/python2.7
# -*- coding: utf-8 -*-
# vim:ts=4:sw=4:softtabstop=4:smarttab:expandtab
# 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
... |
"""
Lasso Regression
Author: Balamurali M
"""
import numpy as np
from sklearn.linear_model import LinearRegression
from sklearn.metrics import mean_squared_error
from sklearn import linear_model
import warnings
warnings.filterwarnings('ignore')
#Generating matrix with explanatory and response variable
ma... |
# Generated by Django 2.2.2 on 2019-09-22 20:22
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('undertiers', '0020_auto_20190921_1355'),
]
operations = [
migrations.AlterField(
model_name='map',
name='early_game'... |
#!/usr/bin/env python
import warnings
warnings.filterwarnings("ignore", message="numpy.dtype size changed")
import sys
import os
import argparse
import re
import scanpy as sc
import pandas as pd
import numpy as np
import anndata
import scvelo as sv
GENOME = {'homo_sapiens': 'GRCh38',
'human': 'GRCh38',
... |
import tensorflow as tf
import tensorflow.keras as keras
class Residual(keras.layers.Layer) :
def __init__(self, filters = 32, strides = 1, use_1x1_conv=True) :
super(Residual, self).__init__()
self.use_1x1_conv = use_1x1_conv
self.conv1 = keras.layers.Conv2D(filters, padding ='same', kern... |
import os
from setuptools import find_packages, setup
# Source the version from the package.
__version__ = 'Unknown'
exec(open('src/perimeterator/version.py').read())
setup(
name='perimeterator',
version=__version__,
description='Continuous AWS Perimeter Monitoring',
author='Peter Adkins',
author_... |
import unittest
from libpysal.examples import load_example
import geopandas as gpd
import numpy as np
from segregation.spatial import DistanceDecayExposure
class Distance_Decay_Exposure_Tester(unittest.TestCase):
def test_Distance_Decay_Exposure(self):
s_map = gpd.read_file(load_example("Sacramento1").get... |
# 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 numpy as np
import gym
#*******************************************************************
# FIND CAVE TASK
#*******************************************************************
# custom action wrapper for complete GAIL agent for MineRL
class ActionShaping_FindCave(gym.ActionWrapper):
def __init__(self, e... |
'''
Created on Jun 20, 2018
@author: moffat
'''
from django.contrib.admin import AdminSite as DjangoAdminSite
from django.contrib.sites.shortcuts import get_current_site
class MyAdminSite(DjangoAdminSite):
site_url = '/administration/'
def each_context(self, request):
context = super().each_context... |
# =============================================================================
# Copyright 2020 NVIDIA. 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://ww... |
# Copyright [2015] 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... |
# 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 ... |
# from example_plugin import napari_get_writer, napari_write_image
# add your tests here...
def test_something():
pass
|
"""
MIT License
Copyright (c) 2021 MShawon
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distr... |
#!/usr/bin/env python3
import sys
import os
import unittest
import logging
import inspect
# Extend PYTHONPATH with local 'lib' folder
if __name__ == "__main__":
jasyroot = os.path.normpath(os.path.join(os.path.abspath(sys.argv[0]), os.pardir, os.pardir, os.pardir, os.pardir))
sys.path.insert(0, jasyroot)
... |
# coding: utf-8
import pprint
import re
import six
from huaweicloudsdkcore.sdk_response import SdkResponse
class ShowRepositoryResponse(SdkResponse):
"""
Attributes:
openapi_types (dict): The key is attribute name
and the value is attribute type.
attribute_map (di... |
"""Utility functions for MATLAB files"""
from pathlib import Path
from typing import List, Tuple
import numpy as np
from scipy import io
from vibromaf import config
def load_signal_from_mat(mat_file: Path, signal_name: str) -> np.array:
"""Load .mat file and parse signal from it"""
mat = io.loadmat(str(mat... |
import numpy as np
def get_im2col_indices(x_shape, field_height=3, field_width=3, padding=1, stride=1):
# First figure out what the size of the output should be
N, C, H, W = x_shape
assert (H + 2 * padding - field_height) % stride == 0
assert (W + 2 * padding - field_height) % stride == 0
out_heig... |
import numpy as np
import torch
import gym
import argparse
import os
import cv2
import imageio
from skimage.color import rgb2gray
import datetime
import utils
from torch.utils.tensorboard import SummaryWriter
def eval_policy(policy, env_name, seed, eval_episodes=10):
eval_env = gym.make(env_name)
#eval_env.seed(... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.