text stringlengths 1 927k |
|---|
from keras.datasets import mnist
from keras.utils import np_utils
import sys, os
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
from models.carlini_models import carlini_mnist_model
from models.cleverhans_models import cleverhans_mnist_model
from models.pgdtrained_models import pgdtraine... |
from importlib import import_module
from byemail.conf import settings
class DoesntExists(Exception):
pass
class MultipleResults(Exception):
pass
class Storage():
def __init__(self, loop=None):
self.loop = loop
self._storage = None
def load_storage(self, loop=None):
global st... |
# This script cluster similar variables
# Written by Son Doan, January 2014
# Version 2.0 March 2014
# RUN:
# Example
# python Similar_finding_v2.py -d 1 -o "LabTest" -i ../data/200test/500LabTests_random_KWL.txt2_cat
"""
RULE SETS:
1. Medical History
Type=Medical History
AND
SOI= {Study Subject, Participant, Patien... |
from django.shortcuts import render , render_to_response, RequestContext, get_object_or_404
from django.http import HttpResponseRedirect, HttpResponse , Http404
from django.utils.decorators import method_decorator
from django.contrib.auth.decorators import login_required
from django.core.urlresolvers import reverse
fro... |
#
# Copyright (c), 2018-2021, SISSA (International School for Advanced Studies).
# All rights reserved.
# This file is distributed under the terms of the MIT License.
# See the file 'LICENSE' in the root directory of the present
# distribution, or http://opensource.org/licenses/MIT.
#
# @author Davide Brunato <brunato@... |
from TwitterAuthenticater import TwitterAuthenticator
from TwitterListener import TwitterListener
from tweepy import Stream
class TwitterStreamer():
"""
Class for streaming and processing live tweets.
"""
# Constructor
def __init__(self):
self.twitter_autenticator = TwitterAuthenticato... |
# coding:utf-8
# Copyright (c) 2019 PaddlePaddle 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 req... |
from typing import List
def shifted_binary_search(nums: List[int], target: int) -> int:
left_idx = 0
right_idx = len(nums) - 1
while left_idx <= right_idx:
mid_idx = left_idx + (right_idx - left_idx) // 2
potential_match = nums[mid_idx]
left_bound = nums[left_idx]
right_bou... |
# 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... |
# Copyright 2018 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... |
from uberX import UberX
from uberPool import UberPool
from uberBlack import UberBlack
from uberSUV import UberSUV
from account import Account
if __name__ == "__main__":
# UBER X
uberX = UberX("ADF875", Account("Felipe López", "GSG458"), "Chevrolet", "Spark")
print(vars(uberX))
print(vars(uberX.driv... |
"""
Swaprs token1, for token2 in the sentence
token2 should belong in sentence for this to work
"""
def swap(token1, token2, sentence):
index = token2.idx
length = len(token2.text)
if index == 0:
prepend = ''
else:
prepend = sentence[:(index)]
append = sentence[(index + length):]
... |
# Copyright (c) Facebook, Inc. and its affiliates.
import glob
import logging
import numpy as np
import os
import tempfile
from collections import OrderedDict
import torch
from PIL import Image
from detectron2.data import MetadataCatalog
from detectron2.utils import comm
from detectron2.utils.file_io import PathManage... |
# Copyright (c) 2011, Hua Huang and Robert D. Cameron.
# Licensed under the Academic Free License 3.0.
def GetResult(fw, sh, data):
arg1 = data[0]
(i, sz, ans) = (0, len(arg1), "")
blockNum = int(sz/fw)
while i<blockNum:
ans += arg1[(i+sh)*fw:(i+sh+1)*fw] if (i+sh)<blockNum else "0"*fw
i += 1
return ans |
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
from typing import Callable, Tuple
import numpy as np
import torch
import torch.nn as nn
from fvcore.nn.squeeze_excitation import SqueezeExcitation
from pytorchvideo.layers.convolutions import Conv2plus1d
from pytorchvideo.layers.swish import Swi... |
class FFmpegProfile:
def __init__(self, profile_dict: dict):
self._profile_dict = profile_dict
@property
def inputs(self):
return self._profile_dict['inputs']
@property
def outputs(self):
return self._profile_dict['outputs'] |
import os
import sys
import numpy as np
import matplotlib.pyplot as plt
from astropy.coordinates import SkyCoord
from astropy import units as u
sys.path.append("/usr/custom/pyLIMA-1.0.0")
from pyLIMA import event, telescopes, microlmodels
import MulensModel as mm
# Common settings:
t_0 = 2456900.
u_0 = 0.1
t_E = 150... |
#!/usr/bin/env python
"""Provides scikit interface."""
import numpy as np
import networkx as nx
import random
from ego.decompose import do_decompose
from ego.decomposition.positive_and_negative import decompose_positive, decompose_negative
from ego.decomposition.union import decompose_all_union
from graphlearn.sample ... |
import pymysql
import dbconfig
connection = pymysql.connect(host='localhost',
user=dbconfig.db_user,
passwd=dbconfig.db_password)
try:
with connection.cursor() as cursor:
sql = "CREATE DATABASE IF NOT EXISTS crimemap"
cursor.execute(sql)
... |
from django.conf.urls import url
from . import api_views
urlpatterns = [
# {% url "api:entries" %}
url(
regex=r'entries/$',
view=api_views.EntryListView.as_view(),
name='entries'
),
url(
regex=r'entries/create/$',
view=api_views.EntryCreateVi... |
# Copyright (c) 2021 The Regents of the University of California
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met: redistributions of source code must retain the above copyright
# notice, this lis... |
"""
Implementation of Nyström Kernel PCA and a confidence bound on its accuracy
Experiments to evaluate the methods and confidence bound
Also implements a few other methods used for comparison
"""
from .algorithms.kernel_RR import KernelRR
from .algorithms.kernel_PCA import KernelPCA
from .algorithms.nystr... |
from typing import List
from os.path import join, dirname
from django.core.checks import register, CheckMessage, Error
from django.conf import settings
from fs.base import FS
from . import filesystem
def _create_check_file(fs: FS, path: str):
fs.makedirs(dirname(path), recreate=True)
fs.create(path, wipe=True... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri Sep 11 09:12:15 2020
@author: scantleb
@brief: Functions for generating keras layers.
"""
import tensorflow as tf
from tensorflow.keras import layers
def generate_activation_layers(block_name, activation, append_name_info=True):
"""Generate activ... |
# %% [markdown]
# #
import itertools
import os
import time
from itertools import chain
import colorcet as cc
import matplotlib as mpl
import matplotlib.pyplot as plt
import networkx as nx
import numpy as np
import pandas as pd
import seaborn as sns
from anytree import LevelOrderGroupIter, Node, RenderTree
from joblib ... |
#!/usr/bin/env python3
"""Export vocabulary of SMILESLanguage from .smi files in directory."""
import argparse
import os
from pytoda.smiles.smiles_language import SMILESLanguage
# define the parser arguments
parser = argparse.ArgumentParser()
parser.add_argument('smi_path', type=str, help='path to a folder with .smi ... |
import logging
from ambianic.configuration import get_root_config
from dynaconf.vendor.box.exceptions import BoxKeyError
from fastapi import HTTPException, status
from pydantic import BaseModel
log = logging.getLogger(__name__)
# Base class for pipeline input sources such as cameras and microphones
class SensorSour... |
#User function Template for python3
# 10 2 -2 -20 10
# -10
class Solution:
def findSubArraySum(self, Arr, N, k):
sums = []
count = 0
for i in range(N):
if i is 0:
sums[i]=Arr[i]
else:
sums[i] = sums[i-1]+Arr[i]
if sum[i] =... |
# Copyright 2018-2020 Jérôme Dumonteil
# Copyright (c) 2009-2012 Ars Aperta, Itaapy, Pierlis, Talend.
#
# 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/LI... |
# Copyright 2020 The Magenta 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 ... |
# Copyright 2018 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... |
from django.db import models
from meiduoshop.utils.models import BaseModel
# Create your models here.
class ContentCategory(BaseModel):
"""广告内容类别"""
name = models.CharField(max_length=50, verbose_name='名称')
key = models.CharField(max_length=50, verbose_name='类别键名')
class Meta:
db_table = 'tb_... |
# AUTOGENERATED BY NBDEV! DO NOT EDIT!
__all__ = ["index", "modules", "custom_doc_links", "git_url"]
index = {"sparsify": "neighbors.ipynb",
"hstack": "neighbors.ipynb",
"vstack": "neighbors.ipynb",
"stack": "neighbors.ipynb",
"NMSLibSklearnWrapper": "neighbors.ipynb",
"Fa... |
# 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! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union
from ... import _utilities, _tables
__a... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
################################################################################
# Copyright (C) 2012 Travis Shirk <travis@pobox.com>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as publi... |
from pytz import timezone
from utils import now_with_timezone
__additional_tag_for_area_reservoirs__ = {
'苗栗': {
'10501': '支援新竹',
},
'臺中': {
'20101': '支援苗栗',
'20202': '支援彰雲投',
},
'彰雲投': {
'30502': '支援嘉義',
'30501': '支援嘉義',
'30503': '支援高雄',
},
... |
from django.core.exceptions import ValidationError
from django.forms import URLField
from django.test import SimpleTestCase
from . import FormFieldAssertionsMixin
class URLFieldTest(FormFieldAssertionsMixin, SimpleTestCase):
def test_urlfield_1(self):
f = URLField()
self.assertWidgetRendersTo(f, ... |
# coding=utf-8
import requests
import os
def handler(event, context):
url = os.environ['KEEP_WARM_FC_URL']
method = os.environ['KEEP_WARM_FC_METHOD']
res = requests.request(method, url)
print(res.status_code) |
import torch
from torch import nn
from torch.nn import functional as F
LAYER1_NODE = 10240
def weights_init(m):
if type(m) == nn.Conv2d:
nn.init.xavier_uniform(m.weight.data)
nn.init.constant(m.bias.data, 0.01)
class TxtModule(nn.Module):
def __init__(self, y_dim, bit):
"""
... |
#Faça um programa que leia 5 números e informe a soma e a média dos números.
cont = 0
s = 0
m = 0
for i in range(5):
n = float(input("Digite nota : "))
s=s+n
cont=cont+1
m=(s)/cont
print(s)
print(m)
'''
'''
# 4)
i = 0
while i < 50:
if (i % 2) == 1:
print (i)
i=i+1 |
import numpy as np
import pandas as pd
from sklearn.base import BaseEstimator, TransformerMixin
from regression_model.processing.errors import InvalidModelInputError
class CategoricalImputer(BaseEstimator, TransformerMixin):
"""Categorical data missing value imputer."""
def __init__(self, variables=None) ->... |
from flask import Flask, request, jsonify, make_response
from flask_sqlalchemy import SQLAlchemy
import uuid
import jwt
import os
from flask_marshmallow import Marshmallow
from datetime import datetime, timedelta
from werkzeug.security import generate_password_hash, check_password_hash
from functools import wraps
app ... |
# Import
import traceback
from datetime import datetime
import aiohttp
import discord
from discord import Webhook, AsyncWebhookAdapter
from discord.ext import commands
import psutil
# Framework
import Framework
# Cog Initialising
class HANDLER(commands.Cog):
def __init__(self, client):
self.client = c... |
"""[リストについて]
リストの構文とリストの使い方について
配列とリストは同じ意味
"""
# リストの定義
['apple', 'banana', 'orange']
[1, 2, 3, 4, 5]
# リストを変数に代入
fruits = ['apple', 'banana', 'orange']
numbers = [1, 2, 3, 4, 5]
# インデックスとを指定して要素を取り出す
# 一番最初0はじまり
fruits[0]
# リストの最後を指定する -1
# 昨日と今日の気温差をリストを使って計算してみる
weather = [13, 15, 18, 13, 16]
# リストの連結
['スカイライン... |
import argparse
import torch
from deep_rl import random_seed, set_one_thread, select_device, Config, generate_tag, Task, TDAuxNet, NatureConvBody, \
LinearSchedule, AsyncReplay, ImageNormalizer, SignNormalizer, run_steps, mkdir
from deep_rl.agent.TDAux_agent import TDAuxAgent
import os
def td_aux_many(config: Co... |
from math import ceil
class Piece:
def __init__(self):
self.player = None
self.other_player = None
self.king = False
self.captured = False
self.position = None
self.board = None
self.capture_move_enemies = {}
self.reset_for_new_board()
def reset_for_new_board(self):
self.possible_capture_moves = ... |
class StatusBarDrawItemEventHandler(MulticastDelegate,ICloneable,ISerializable):
"""
Represents the method that will handle the System.Windows.Forms.StatusBar.DrawItem event of a System.Windows.Forms.StatusBar.
StatusBarDrawItemEventHandler(object: object,method: IntPtr)
"""
def Instance(self):
""" This func... |
# Software License Agreement (BSD License)
#
# Copyright (c) 2009-2014, Eucalyptus Systems, Inc.
# All rights reserved.
#
# Redistribution and use of this software in source and binary forms, with or
# without modification, are permitted provided that the following conditions
# are met:
#
# Redistributions of source ... |
# Generated by Django 4.0.3 on 2022-04-25 07:38
import django.core.validators
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('license', '0002_licensepurchase_order_number'),
]
operations = [
migrations.AlterField(
model_name... |
# Copyright 2012-2015 The Meson development 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
# Unless required by applicable law or agree... |
# -*- coding: utf-8 -*-
try:
# Python 2.7
from collections import OrderedDict
except:
# Python 2.6
from gluon.contrib.simplejson.ordered_dict import OrderedDict
from gluon import current, TR, TD, DIV
from gluon.storage import Storage
T = current.T
settings = current.deployment_settings
"""
Templ... |
# pylint: disable=missing-docstring
import unittest
import numpy as np
import tensorflow as tf
from absl.testing import parameterized
from tf_encrypted.primitives import paillier
from tf_encrypted.test import tf_execution_context
class EncryptionTest(parameterized.TestCase):
@parameterized.parameters(
{... |
"""
Mixins classes for use with Filters and Factors.
"""
from textwrap import dedent
from numpy import (
array,
full,
recarray,
vstack,
)
from pandas import NaT as pd_NaT
from catalyst.errors import (
WindowLengthNotPositive,
UnsupportedDataType,
NoFurtherDataError,
)
from catalyst.utils.c... |
import json
import uuid
from collections import OrderedDict
from ... import path
from ...iterutils import first
__all__ = ['SlnBuilder', 'SlnElement', 'SlnVariable', 'Solution', 'UuidMap']
class SlnElement:
def __init__(self, name, arg=None, value=None):
if (arg is None) != (value is None):
... |
from .base import *
from .reconstructors import *
from .forecasters import *
from .anomaly_detectors import * |
# web_app/routes/company_routes.py
import pandas as pd
from flask import Blueprint, jsonify, request, render_template #, flash, redirect
from web_app.models import *
company_routes = Blueprint("company_routes", __name__)
@company_routes.route("/div_yield")
def seeDivYield():
return render_template("highest_DivYi... |
#! /usr/bin/env python
#######################################
# ConvertImagery.py
# A python script to convert remote
# imagery to GeoTIFF unsigned 16 bit.
# Author: Pete Bunting
# Email: pete.bunting@aber.ac.uk
# Date: 12/12/2007
# Version: 1.0
#######################################
import os
import sys
class Con... |
class Sources:
'''
sources class to define news sources objects
'''
def __init__(self,id,name,description,url,category,country):
self.id = id
self.name = name
self.description=description
self.url=url
self.category=category
self.country=country
cla... |
#!/usr/bin/env python3
from flask import Flask, render_template
import flask_site.model as model
def create_app(test_config=None):
"""Create and configure the app.
Parameters
----------
test_config - Defaults to None, but can be used to set
up config for testing.
Returns
-------
Returns the app.
""... |
'''
Created on Nov 12, 2018
@author: yangzh
'''
from . import helpers
def say_hi():
"""Get a thought."""
return 'Hi, my friend ...'
def saySomething():
"""Contemplation..."""
if helpers.get_answer():
print(say_hi()) |
# Copyright 2015 Tesora 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 a... |
from pavo_cristatus.tests.doubles.module_fakes.module_fake_class import ModuleFakeClass
from trochilidae.interoperable_with_metaclass import interoperable_with_metaclass_future
__all__ = ["ModuleFakeClassWithNestedAnnotatedCallables"]
class ModuleFakeClassWithNestedAnnotatedCallables(interoperable_with_metaclass_fut... |
# 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.
"""Unit tests for //compiler_gym/wrappers."""
from compiler_gym.envs.llvm import LlvmEnv
from compiler_gym.wrappers import TimeLimit
from tests... |
from setuptools import setup, find_packages
setup(
name='bexl',
version='0.1.0',
description='A parser and interpreter for the Basic EXpression Language'
' (BEXL)',
long_description=open('README.rst', 'r').read(),
keywords='bexl basic expression language',
author='Jason Simeone',
autho... |
import logging
import asyncio
from hbmqtt.client import MQTTClient
from hbmqtt.mqtt.constants import QOS_1, QOS_2
#
# This sample shows how to publish messages to broker using different QOS
# Debug outputs shows the message flows
#
logger = logging.getLogger(__name__)
config = {
"will": {
"topic": "/wi... |
# save_to_google_team_drive.py
""" Saves a file to a Google Team Drive, in a given parent folder """
import os
import sys
where_i_am = os.path.dirname(os.path.realpath(__file__))
sys.path.append(where_i_am)
sys.path.append(where_i_am + "/dependencies")
from google.oauth2 import service_account # noqa: E402
from googl... |
from setuptools import setup
from sys import platform
from bookmeister import __version__
with open('README.md') as readme:
long_description = readme.read()
with open('requirements.txt') as required:
requirements = required.read()
data_files = []
if platform == 'linux':
data_files.append(('share/applica... |
# create list
a = ['a', 'b', 10, 1000]
# Sublists, Indexes of List
# Slice range notation generates shallow copy of list
simple_list = ['first', 'second', "third"]
print 'simple list: ' + str(simple_list)
# list index
print 'simple index: ' + simple_list[0]
# negative index
print 'negative index: ' + simple_list[-... |
# coding: utf-8
"""
OpenAPI
tinkoff.ru/invest OpenAPI. # noqa: E501
The version of the OpenAPI document: 1.0.0
Contact: n.v.melnikov@tinkoff.ru
Generated by: https://openapi-generator.tech
"""
import pprint
import re # noqa: F401
import six
class Portfolio(object):
"""NOTE: This class ... |
from documentModel import *
from NGramGraphCollector import * |
#!/usr/bin/env python3
# -*-coding:utf-8 -*-
# =============================================================================
"""
@Author : Yujie He
@File : viz_traj.py
@Date created : 2022/02/25
@Maintainer : Yujie He
@Email : yujie.he@epfl.ch
"""
# ================================... |
import tkinter as tk
from tkinter import messagebox
import utility
from table_management import create_table, insert_media_table
from suggestion_algorithm import main_algorithm, suggestion_algorithm_single_use, selecting_media, list_of_media_classes
from account_handling import updating_account_data
from filters import... |
"""
左寄せ表記(Left justified)
"""
import os
import numpy as np
# 環境変数
RADIX = int(os.getenv("RADIX", 2))
# 桁揃えに利用。10進数27 を指定したときの見やすさをデフォルトにするぜ(^~^)
count_width = 3
count_str = ""
dec_width = 4
dec_str = ""
radix_str = ""
# 表示した数の個数
count = 0
def update_print_number(dec):
"""表示するテキストの更新"""
global count_width
... |
import unittest
from nose_parameterized.parameterized import parameterized
from conans.test.utils.tools import TestClient
from conans.paths import CONANFILE
tool_conanfile = """
import os
from conans import ConanFile
class Tool(ConanFile):
name = "Tool"
version = "0.1"
def package_info(self):
s... |
from flask import Blueprint, render_template, jsonify, request, url_for, redirect, flash, \
abort, current_app as app
from mcarch.model.mod import Mod, ModAuthor, ModVersion, GameVersion
from mcarch.model.mod.draft import DraftMod
from mcarch.model.mod.logs import LogMod, gen_diffs
from mcarch.model.user impor... |
#!/usr/bin/env python
#
# Copyright 2011 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 o... |
from hypothesis import given
from symba.base import Expression
from tests.utils import pickle_round_trip
from . import strategies
@given(strategies.definite_expressions)
def test_round_trip(expression: Expression) -> None:
assert pickle_round_trip(expression) == expression |
from django.apps import AppConfig
class SystemConfig(AppConfig):
name = 'system'
verbose_name = '系统'
# 通过ready 来导入信号量
def ready(self):
import system.signals |
from lime import lime_image
from skimage.segmentation import mark_boundaries
class Image(object):
@staticmethod
def explainer(images, model, image_size):
output = list()
for image in images:
explainer = lime_image.LimeImageExplainer(random_state=42)
explanation = expl... |
# DO NOT EDIT THIS FILE. This file will be overwritten when re-running go-raml.
from .escape_type_service import Escape_typeService
from .http_client import HTTPClient
from .uri_service import UriService
from .User2_0 import User2_0
BASE_URI = "http://localhost:5000"
class Client:
"""
auto-generated. don't ... |
# This code is part of Qiskit.
#
# (C) Copyright IBM 2017, 2019.
#
# 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 modifications or derivat... |
# coding: utf-8
"""
Amadeus Travel Innovation Sandbox
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
OpenAPI spec version: 1.2
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from pprint import pformat
from six import ... |
# Mega Case Study - Make a Hybrid Deep Learning Model
# Part 1 - Identify the Frauds with the Self-Organizing Map
# Importing the libraries
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
# Importing the dataset
dataset = pd.read_csv('Credit_Card_Applications.csv')
X = dataset.iloc[:, :-1].v... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""
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
"""
import sys
import os
from clr import *
sys.path.append("..")
import te... |
transpiler_name = "adam"
mayusc = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
alphabet = mayusc + mayusc.lower() + "_"
digits = "0123456789"
alphanum = alphabet + digits
blanks = "/t /n"
strings = ["'", '"', '"""', "'''"]
matrices = "$"
vectors = "[]"
embedded = "#"
commentaries = "~"
floating = "."
one_char_symbols = "+-*/%=<>()[]{... |
import numpy as np
from numpy import ndarray
def hash_args(*args):
"""Return a tuple of hashes, with numpy support."""
return tuple(hash(arg.tobytes())
if isinstance(arg, ndarray)
else hash(arg) for arg in args)
class OrientedBoundary(ndarray):
"""An array of facet ind... |
from flask import abort, jsonify
from flask_restful import Resource
from flask_simplelogin import login_required
from test.models import Product
class ProductResource(Resource):
def get(self):
products = Product.query.all() or abort(204)
return jsonify(
{"products": [product.to_dict()... |
'''
from math import sqrt, floor
num = int(input('Digite um número: '))
raiz = sqrt(num)
print('A raiz de {} é igual a {:.2f}'.format(num,floor(raiz)))
'''
'''
import random
num = random.randint(1, 10)
print(num)'''
import emoji
print(emoji.emojize('Olá, Mundo :earth_americas:', use_aliases=True)) |
from google.cloud import storage
def upload_blob(bucket_name, source_file_name, destination_blob_name):
storage_client = storage.Client('liquid-force-295404')
"""Uploads a file to the bucket. https://cloud.google.com/storage/docs/ """
bucket = storage_client.get_bucket(bucket_name)
blob = bucket.blob(d... |
# Author: Hansheng Zhao <copyrighthero@gmail.com> (https://www.zhs.me)
from configparser import RawConfigParser
from argparse import ArgumentParser
def create_config(file_path):
# create config parser instance
configparser = RawConfigParser(allow_no_value = True)
# create required sections
configparser.add_... |
"""URLs to run the tests."""
from django.conf import settings
from django.conf.urls import url
from django.contrib import admin
from django.views import static
urlpatterns = [
url(r'^admin/', admin.site.urls),
]
if settings.DEBUG:
urlpatterns += [
url(r'^media/(?P<path>.*)$', static.serve, {'document... |
"""
tests for cache setup module
"""
import unittest
import random
import hou
import setupcache
reload(setupcache)
class HipTest(unittest.TestCase):
"""
base class to initiate empty houdini scene
across tests with a basic node network
"""
def setUp(self):
hou.hipFile.clear(suppress_save... |
"""
Entry point for training and evaluating a dependency parser.
This implementation combines a deep biaffine graph-based parser with linearization and distance features.
For details please refer to paper: https://nlp.stanford.edu/pubs/qi2018universal.pdf.
"""
"""
Training and evaluation for the parser.
"""
import s... |
"""
Functions and classes for managing a map saved in the .tmx format.
Typically these .tmx maps are created using the `Tiled Map Editor`_.
For more information, see the `Platformer Tutorial`_.
.. _Tiled Map Editor: https://www.mapeditor.org/
.. _Platformer Tutorial: http://arcade.academy/examples/platform_tutorial/... |
import requests
import pprint
from bs4 import BeautifulSoup as bsoup
year = 2019
month = 12
url = f"http://www.data.jma.go.jp/obd/stats/etrn/view/daily_s1.php?prec_no=44&block_no=47662&year={year}&month={month}"
html = requests.get(url).content
soup = bsoup(html, "html.parser", from_encoding="utf-8")
table = soup.find... |
# ---
# jupyter:
# jupytext:
# cell_markers: region,endregion
# formats: ipynb,.pct.py:percent,.lgt.py:light,.spx.py:sphinx,md,Rmd,.pandoc.md:pandoc
# text_representation:
# extension: .py
# format_name: percent
# format_version: '1.2'
# jupytext_version: 1.1.0
# kernelspec:
# ... |
###############################################################################
# PyDial: Multi-domain Statistical Spoken Dialogue System Software
###############################################################################
#
# Copyright 2015 - 2019
# Cambridge University Engineering Department Dialogue Systems Grou... |
import discord
from discord.ext import tasks, commands
import asyncio
import socketio
import threading
import subprocess
import time
from queue import Queue, Empty
from threading import Thread
from requests import get
import os
import re
import boto3
import utils
client = boto3.client('ec2')
chat_reg = re.comp... |
# University of Illinois/NCSA Open Source License
# Copyright (c) 2018, Jakub Svoboda.
# TODO: docstring for the file
import hashlib
import os
from woolnote import systemencoding
from woolnote import util
from woolnote import html_page_templates_pres
from woolnote import config
from woolnote import tests
@tests.i... |
#!/usr/bin/env python
"""Django's command-line utility for administrative tasks."""
import os
import sys
def main():
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'test_mobile_33934.settings')
try:
from django.core.management import execute_from_command_line
except ImportError as exc:
ra... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.