content stringlengths 5 1.05M |
|---|
###############################################################################
### Games support module for LiveWires using pygame.
###
### $Revision: 1.7 $ -- $Date: 2001/10/27 17:43:51 $
###############################################################################
# Copyright Richard Crook, Gareth McCaughan, R... |
# -*- coding: utf-8 -*-
#Git for team work
'''
This is HW2 for CS225
Team Member:
Zhu Zhongbo
Yang Zhaohua
Guan Zimu
Xie Tian
'''
import os
def upload(function = "all"):
if function == "all":
os.system('git add main.py &&\
git add Git.py &&\
git add pyli... |
from setuptools import setup, find_packages
setup(
name='SmartShopper',
version='1.0',
description='SE project: group 22',
author="CSC510 - Group 22, Chandrahas Reddy Mandapati, Harini Bharata, Sri Pallavi Damuluri, Niraj Lavani, sandesh A S": ,
author_email="sgaladha@ncsu.edu",
packages=find... |
# Copyright (c) 2021.
# The copyright lies with Timo Hirsch-Hoffmann, the further use is only permitted with reference to source
import urllib.request
from RiotGames.API.RiotApi import RiotApi
class Match(RiotApi):
__timeline_by_match_id_url: str = "https://{}.api.riotgames.com/lol/match/v4/timelines/by-matc... |
import sys
from utils import timex
from covid19.lk_vax_centers.expand import expand
from covid19.lk_vax_centers.expand_i18n import expand_i18n
from covid19.lk_vax_centers.finalize import finalize
from covid19.lk_vax_centers.parse_pdf import parse_pdf
from covid19.lk_vax_centers.scrape_pdf import scrape_pdf
from covid... |
import pycassa
from pycassa.types import *
from pycassa.system_manager import *
# Completely destroys and recreates the sample keyspace for this app.
def setup(keyspace):
schema = Schema(keyspace)
schema.create_keyspace()
schema.create_column_families()
schema.close()
class Schema(object):
def __... |
"""
Config for accessing database.
DB_TYPE: Type of database to connect to. Options: MYSQL, SQLITE, MSSQL (Only for Decision Tree Classifier as of now)
"""
DB_TYPE = "DB_TYPE"
DB_PATH = "DB_PATH"
DB_HOST = "DB_HOST"
DB_USER = "DB_USER"
DB_PW = "DB_PW"
DB_NAME = "DB_NAME"
DB_PORT = DB_PORT
"""
These fields are require... |
def from_bin(filename):
memory = []
with open(filename, 'rb') as f:
word = f.read(2)
while word:
memory.append(int.from_bytes(word, 'little'))
word = f.read(2)
return memory
|
from Imprimir_Listas import repetir
repetir(["hola", 52, ["Perros", 65, [16,23]], "gatos"], True)
|
n = int(input())
length = len(str(n))
ans = 0
for i in range(length, -1, -1):
if i%2 != 0 or i == 0:
continue
elif i==length:
b = n%(10**(i//2))
a = (n-b)//(10**(i//2))
ans += (a-(10**(i//2-1)))
if a <= b:
ans += 1
else:
ans += (10**(i//2))*0.9
pr... |
import os
import time
import copy
import logging
import warnings
import os.path as osp
import numpy as np
import tensorflow as tf
import scipy.sparse as sp
from functools import partial
from tensorflow.keras.utils import Sequence
from tensorflow.python.keras import callbacks as callbacks_module
from tensorflow.keras.c... |
"""
*Buffer-Point*
"""
class BufferPoint:
pass
|
"""lib/netbox/ansible.py"""
class NetBoxToAnsible:
"""Main NetBox to Ansible class"""
def __init__(self, netbox_data):
self.netbox_data = netbox_data
self.ansible_data = {}
def data(self):
"""Translate NetBox data to Ansible constructs"""
# DCIM
self.dcim_translat... |
from __future__ import print_function
from tweaker.tweaker import DatabaseTweaker
from config import config
import sys
# Setup
csv_file = "resources/broken-resources/emlo-url-check-all-errors.csv"
id_name = 'id'
skip_first_row = False
debugging = False
restrict = 500
errors = [
#'https://databank.ora.ox.ac.uk/',
'... |
import requests
raw_url = "http://numbersapi.com/{}/math"
params = {
'json': True,
}
with open('data/step03.txt') as in_f, open('output/step03.txt', 'a') as out_f:
for line in in_f:
line = line.strip()
api_url = raw_url.format(line)
res = requests.get(api_url, params=params)
... |
from typing import Optional
import attr
from .action import Action
from .block import Block
@attr.dataclass(slots=True)
class Field:
"""Field on Attachment"""
title: str
value: str
short: bool
@attr.dataclass(slots=True)
class Attachment:
"""Slack Attachment"""
fallback: Optional[str] = ... |
import numpy as np
def dynamic_slicing(array, slices):
"""Dynamic slicing of an array with arbitrary number of dimensions.
Slices must match number of dimensions. A single slice can either be [None], [i, None] or [None, j]. None is equal to ':'.
i is the slice index and can be negative."""
slc = [slice... |
# 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 required by appl... |
# coding=utf-8
# --------------------------------------------------------------------------
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
# --------------------------------------------------------------------------
from ... |
from odoo import api,fields,models
class TransfertDomain(models.Model):
_name = 'tansfert.domain'
generate_domain = fields.Integer(string="Generator", default=0) |
from datetime import datetime
from users.models import User
from django.utils import timezone
from django.contrib import messages
from django.http import JsonResponse
from reminders.models import Reminder
from django.forms import formset_factory
from django.views.generic import TemplateView
from main.utilities import c... |
import doctest
import unittest
from future.moves import sys
import snips_nlu.dataset
import snips_nlu.result
doctest_modules = [
snips_nlu.dataset.entity,
snips_nlu.dataset.intent,
snips_nlu.dataset.dataset,
snips_nlu.result
]
suite = unittest.TestSuite()
for mod in doctest_modules:
suite.addTes... |
from base_notifier import BaseNotifier
from slacker import Slacker, Error
class SlackNotifier(BaseNotifier):
def __init__(self, template, debug):
super(SlackNotifier, self).__init__(template, debug)
def notify(self, message, config):
slack_token = config['slack_api_token']
channels =... |
from figcow import cow
s = cow("Testing")
print(s)
|
# -*- coding: utf-8; tab-width: 4; indent-tabs-mode: nil; -*-
### BEGIN LICENSE
# Copyright (C) 2010 Kevin Mehall <km@kevinmehall.net>
# Copyright (C) 2012 Christopher Eby <kreed@kreed.org>
#This program is free software: you can redistribute it and/or modify it
#under the terms of the GNU General Public License versi... |
def clean_indentation(element, level=0, spaces_per_level=2):
"""
copy and paste from http://effbot.org/zone/elementent-lib.htm#prettyprint
it basically walks your tree and adds spaces and newlines so the tree is
printed in a nice way
"""
i = "\n" + level*spaces_per_level*" "
if len(element... |
import numpy as np
#quick percentage function
def percent(num, denom):
result = np.round((num/denom)*100,1)
return f'{result}%'
def evaluation(df):
#initialize the variable to 0
pdf_count = 0
html_count = 0
xml_count = 0
plain_count = 0
abstract_count = 0
content_count = 0
... |
#!/usr/bin/env python
# encoding: utf-8
import click
import io
import sys
import yaml
import storage
import datadiff
import hashlib
import methods
# TODO pattern to factor out:
# option to choose something from named dictionary
# TODO pattern to factor out:
# input/output file
# (flags: filename defaulting to ... |
#!/usr/bin/env python
import os
import sys
import csv
import argparse
try:
import numpy as np
from scipy.stats import spearmanr
from scipy.stats.mstats import kruskalwallis
except ImportError:
sys.exit( "This script requires the Python scientific stack: numpy and scipy." )
try:
from humann2 impor... |
import os
import shutil
print('path-utils loaded')
def makedir(direc):
if not os.path.exists(direc):
os.makedirs(direc)
return True
else:
return False
def get_file_name(filepath):
return os.path.splitext(os.path.basename(filepath))[0]
def get_files(direc, extns=None):
''' Retu... |
#!/usr/bin/env python
# This check data available on ESGF and on raijin that matches constraints passed on by user and return a summary.
"""
Copyright 2016 ARC Centre of Excellence for Climate Systems Science
author: Paola Petrelli <paola.petrelli@utas.edu.au>
Licensed under the Apache License, Version 2.0 (the "Lice... |
from unittest import TestCase
import mock
from ..tf_log_base import TFLogBase
class TestTFLogBase(TestCase):
def test_defaults_to_public_tf_api(self):
tf_log = TFLogBase([], 'foo')
self.assertEqual(tf_log.base_uri, "https://api.threshingfloor.io")
def test_base_uri_cannot_end_in_slash(self... |
"""
cTivoTelnetControl - a solution for controlling a TiVo over the internet
Converts a single key press into a command for a TiVo box
Charles Machalow - MIT License
"""
import telnetlib #for telnet connection
import sys #for args
import getch #local file for getch in Windows and Unix
import socket #f... |
import os
os.environ.setdefault('DJANGO_SETTINGS_MODULE','data_aggregate.settings')
import django
django.setup()
from data_agg_api.models import Temperature
import datetime
import random
import json
import requests
def create_temperatures():
print("Generating fake temperature data...")
no_data = 10
date ... |
import tensorflow as tf
import numpy as np
import resnet_fcn
from datageneratorClusterLblMask import ImageDataGenerator2
import time
import scipy
import cv2
import matplotlib.pyplot as plt
import os
from skimage.transform import resize
from scipy.misc import imsave
import copy
########################################... |
import psm.agemodels
import psm.coral
import psm.cellulose
import psm.icecore
import psm.speleo
import psm.aux_functions
|
from netconify.tty_serial import Serial
from netconify.tty_telnet import Telnet
from netconify import constants as C
__version__ = C.version
__date__ = C.date
__author__ = C.author
|
# Copyright 2018 The Fuego 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 wr... |
from ..kast import KAtt, KClaim, KRule, KToken
from ..ktool import KompileBackend
from ..prelude import Sorts
from .kprove_test import KProveTest
class SimpleProofTest(KProveTest):
KOMPILE_MAIN_FILE = 'k-files/simple-proofs.k'
KOMPILE_BACKEND = KompileBackend.HASKELL
KOMPILE_OUTPUT_DIR = 'definitions/simp... |
val = int(input('Diga o valor da casa: '))
sal = int(input('Qual o seu salario? '))
yar = int(input('Em quantos anos pretende pagar? '))
cor = {'lin':'\033[m','red': '\033[31m','gre':'\033[32m','yel':'\033[33m', 'blu':'\033[34m'}
par = val / (yar * 12)
print('{}-={}'.format(cor['blu'], cor['lin']) * 25)
if sal * 0.3 ... |
from django.core.exceptions import ValidationError
import re
def validate_password(password):
print('validating passowrd', password)
if len(password) < 8:
print('pass is short')
raise ValidationError('Password should be longer than 8 chars')
# return TypeError('Password should be longer... |
import django_tables2 as tables
from netbox.tables import BaseTable, ToggleColumn
from sidekick.models import (
AccountingProfile,
AccountingSource,
BandwidthProfile,
)
NAME_LINK = """
<a href="{{ record.get_absolute_url }}">{{ record }}</a>
"""
MEMBER_LINK = """
<a href="{{ record.accounting_p... |
import os
from flask import Flask
from flask_sqlalchemy import SQLAlchemy
# instantiate the db
db = SQLAlchemy()
def create_app(script_info=None):
# instantiate the app
app = Flask(__name__)
# set config
app_settings = os.getenv('APP_SETTINGS')
app.config.from_object(app_settings)
# set up... |
"""
Settings for Ublox Reader package
:author: Angelo Cutaia
:copyright: Copyright 2021, LINKS Foundation
:version: 1.0.0
..
Copyright 2021 LINKS Foundation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain... |
# Copyright (c) 2009 Matt Harrison
#from distutils.core import setup
from setuptools import setup
from cov2emacslib import meta
setup(name='cov2emacs',
version=meta.__version__,
author=meta.__author__,
description='FILL IN',
scripts=['bin/cov2emacs'],
package_dir={'cov2emacslib':'cov2ema... |
#!/usr/bin/env python
#
# Copyright 2011-2012 BloomReach, 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 appl... |
phrase = input("Entrer une phrase :")
lettre = input("Entrer Entrez le caractère recherché :")
if phrase.count(lettre) != 0 :
for i in range(len(phrase)) :
if lettre == phrase [i] :
print("Le caractère", lettre, "recherché est trouvé à l'index", i, "de la phrase")
else :
print("Le ca... |
# Problem: https://www.hackerrank.com/challenges/python-tuples/problem
# Score: 10
|
from onto_tool import onto_tool
import pydot
def test_local_instance():
onto_tool.main([
'graphic',
'-t', 'Local Ontology',
'--no-image',
'-o', 'tests-output/graphic/test_schema',
'tests/graphic/domain_ontology.ttl',
'tests/graphic/upper_ontology.ttl',
'test... |
import pytest
from rcache import cache, lru_cache
def execute_times(n):
def wrap(f, *args, **kwargs):
for _ in range(n):
last = f(*args, **kwargs)
return last
return wrap
def inspect_max_cache_size(size):
def wrap(f):
def wrap(*args, **kwargs):
resu... |
import torch
from mavi.torch.base_class.numerical_basis import Nbasist_fn
from mavi.torch.base_class.numerical_basis import NBasist as _Basist
from mavi.torch.base_class.numerical_basis import Intermidiate as _Intermidiate
from mavi.torch.util.util import res, pres, matrixfact, blow
class Basist(_Basist):
def __in... |
import traceback
import uuid
from oslo.config import cfg
import requests
from st2actions.query.base import Querier
from st2common.util import jsonify
from st2common import log as logging
from st2common.util.url import get_url_without_trailing_slash
from st2common.constants.action import (LIVEACTION_STATUS_SUCCEEDED, ... |
import os
MFMODULE = os.environ['MFMODULE']
HOSTNAME = os.environ['MFCOM_HOSTNAME']
MFMODULE_VERSION = os.environ.get('MFMODULE_VERSION', 'unknown')
def transform_func(dict_object):
if "name" in dict_object:
# FIXME: don't hardcode elasticsearch here
# But it's difficult to block elasticsearch lo... |
import os
mailacct = os.environ['MAILACCT']
hodor = os.environ['HODOR'] + "!MtG"
|
# Python program to convert decimal to binary
# Author: Yeffian the Teapot
num = 0 # Declaring a num variable to check and store input
exitCode = 1 # Declaring a exit code, which the user can input to stop the program
# Function to convert decimal to binary
def decimalToBinary(n):
return bin(n).repl... |
#!/usr/bin/env python3
import subprocess
import os
import re
import time
import rpyc
import configparser
import fileinput
from threading import Thread
from clic import initnode
from clic import nodesup
from clic import synchosts
from clic import pssh
from clic import nodes
config = configparser.ConfigParser()
config.r... |
import os
import io
from time import sleep
import time
import random
import re
import pathlib
import discord
from redbot.core import commands, bot, checks, data_manager, Config
from functools import reduce
from typing import List, Optional
from .eris_event_lib import ErisEventMixin
BaseCog = getattr(commands, "Cog",... |
import math
def binary_search(sorted_table, element):
index = math.ceil(len(sorted_table) / 2)
while element != sorted_table[index]:
print("boo")
if sorted_table[index] > element:
index = math.ceil(index / 2)
else:
index = math.ceil(index + index / 2)
return index
table ... |
# coding=utf-8
import re
from flask import Flask,render_template,session,redirect,url_for,flash,json,jsonify
from wtforms import Form, BooleanField,TextAreaField, IntegerField,TextField,HiddenField, PasswordField, validators,ValidationError,SelectField
from flask.ext.wtf import Form
from flask.ext.login import logout_u... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
from scripts.classes import Connection, Footpath, Stop, Trip
from scripts.connectionscan_router import ConnectionScanData
from scripts.helpers.funs import seconds_to_hhmmss, hhmmss_to_sec
fribourg = Stop("1", "FR", "Fribourg/Freiburg", 0.0, 0.0)
bern = Stop("2", "BN", "Bern",... |
# Copyright 2021 Intel 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 in wr... |
import os
from setuptools import setup
README = open(os.path.join(os.path.dirname(__file__), 'README.rst')).read()
# allow setup.py to be run from any path
os.chdir(os.path.normpath(os.path.join(os.path.abspath(__file__), os.pardir)))
setup(
name='djangorestframework-drilldown',
version='0.1.1',
url='htt... |
from setuptools import setup
def readme():
with open('README.md') as f:
README = f.read()
return README
setup(
name = 'Data_Split',
packages = ['Data_Split_by_Bhawika'],
version = '1.0.0',
license='MIT',
description = 'A python package to split Directory into... |
# Generated by Django 3.0.7 on 2020-07-07 19:32
import applications.users.managers
from django.db import migrations, models
import django.utils.timezone
class Migration(migrations.Migration):
initial = True
dependencies = [
('auth', '0011_update_proxy_permissions'),
]
operations = [
... |
from configs import cfg
from src.utils.record_log import _logger
from src.utils.nlp import dynamic_length, dynamic_keep
from src.utils.file import load_glove, save_file
import numpy as np
import nltk
import re
import os
import math
import random
class Dataset(object):
def __init__(self, data_file_path, dataset_ty... |
num1=1
num2=3
|
from pandas import Series, DataFrame
import pandas as pd
import numpy as np
import pandasql
def main():
years = [str(year) for year in range(2002,2013)]
# Load IEEE data
ieee_data = load_ieee_data()
# Load Tags data
tags_data = load_tags_data(years)
# Analyse the IEEE data
an... |
# MIT License
#
# Copyright (C) 2021. Huawei Technologies Co., Ltd. All rights reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation th... |
import zipfile
import tempfile
class ZipIter:
def __init__(self,filename,mode="r"):
if mode!="r" and mode!="rb" and mode!="w" and mode!="wb":
raise Exception("Unknown mode")
self.mode=mode
if mode[0]=="r": #READ MODE
self.zipfolder=zipfile.ZipFile(filename,mode)
... |
"""
UCR-FordA dataset
"""
import os
import numpy as np
import cv2
from tensorflow.keras.utils import to_categorical
def __get_pic(y, module_path):
if y == 10:
return cv2.imread(module_path+'/datasets/pics/arabic/num_0.png', cv2.IMREAD_GRAYSCALE).astype('float32') / 255.
elif y == 1:
return cv... |
import csv
import re
globalPriority = []
globalTechPriority = []
globalFlag = 0
# inputPriceMin, inputPriceMax, inputHeight, inputTypeWeights, inputPriorities, inputTechPriorities
def runAHP(data):
global globalFlag
global globalPriority
global globalTechPriority
userPriceMin = data['inputPriceMin']
... |
#create a dictionary
patient = {'name': 'Sameeksha', 'age':25,'disease':'Alzeimers','therapy':'drug b','response':'True'}
#Iterating over dictionaries
for characteristic in patient:
print(characteristic,patient[characteristic])
# Create a dictionary with multiple values
names = ['Max', 'Peter', 'Abby']
age=[77, ... |
from typing import Dict, Tuple
from stable_baselines3.common.evaluation import \
evaluate_policy as evaluate_policy_sb3
from stable_baselines.common.evaluation import evaluate_policy
from envs.env_eval_callback import EnvEvalCallback
from log import Log
class AcrobotEvalCallback(EnvEvalCallback):
# i.e. pe... |
import time
from data import get_addresses, get_reference
from substrate.substrate import get_subscan_rewards
from cardano.cardano import get_cardano_rewards
# Aggregate rewards and print them out
def calculate():
# Calculate rewards for all addresses
rewards = []
for _, address in enumerate(get_addresse... |
from django.conf.urls import url
from remo.voting import views
urlpatterns = [
url(r'^(?P<slug>[a-z0-9-]+)/edit/$', views.edit_voting, name='voting_edit_voting'),
url(r'^(?P<slug>[a-z0-9-]+)/$', views.view_voting, name='voting_view_voting'),
url(r'^(?P<slug>[a-z0-9-]+)/delete/$', views.delete_voting, nam... |
from jinja2 import Environment, FileSystemLoader
import pandas as pd
import yaml
from tornado.ioloop import IOLoop
from tornado.web import RequestHandler
from bokeh.application import Application
from bokeh.application.handlers import FunctionHandler
from bokeh.embed import autoload_server
from bokeh.layouts import c... |
import torch
from torch_geometric.nn import SignedConv
def test_signed_conv():
in_channels, out_channels = (16, 32)
pos_ei = torch.tensor([[0, 0, 0, 1, 2, 3], [1, 2, 3, 0, 0, 0]])
neg_ei = torch.tensor([[0, 0, 0, 1, 2, 3], [1, 2, 3, 0, 0, 0]])
num_nodes = pos_ei.max().item() + 1
x = torch.randn((n... |
import requests
from pathlib import Path
import random
import streamlit as st
import numpy as np
from PIL import Image, ImageOps
import utils
st.set_page_config(
"Streamlit Theme Generator",
"https://emojipedia-us.s3.dualstack.us-west-1.amazonaws.com/thumbs/240/apple/271/woman-artist_1f469-200d-1f3a8.png",
)... |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.1 on 2016-04-12 20:17
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('crowdcop_web', '0017_auto_20160412_1613'),
]
operations = [
migrations.AddFi... |
# coding: utf-8
"""
Quay Frontend
This API allows you to perform many of the operations required to work with Quay repositories, users, and organizations. You can find out more at <a href=\"https://quay.io\">Quay</a>. # noqa: E501
OpenAPI spec version: v1
Contact: support@quay.io
Generated by: h... |
"""
Mock implementation of a ``discord.state.ConnectionState``. Overwrites a Client's default state, allowing hooking of
its methods and support for test-related features.
"""
import asyncio
import typing
import discord
import discord.http as dhttp
import discord.state as dstate
from . import factories as fac... |
__all__ = ['is_match_states_batch_size', 'verify_nmt_model', 'verify_nmt_inference']
import numpy.testing as npt
import numpy as np
import mxnet as mx
from mxnet.util import use_np
from .parameter import move_to_ctx
def is_match_states_batch_size(states, states_batch_axis, batch_size) -> bool:
"""Test whether th... |
from django.urls import path
from .views import (
teacher_home_view, profile_view, change_password_view, update_profile_view,
add_assessment, ViewAssessments, MarkStudents, Mark, EditAssessment, DeleteAssessment
)
app_name = 'teachers'
urlpatterns = [
path('', teacher_home_view, name='teacher_home_view'),... |
from bs4 import BeautifulSoup
from django.conf import settings
from django.utils.deprecation import MiddlewareMixin
from google_analytics.tasks import send_ga_tracking
from google_analytics.utils import build_ga_params, set_cookie
class GoogleAnalyticsMiddleware(MiddlewareMixin):
def process_response(self, reque... |
"""
Copyright 2018 EPAM Systems, Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed... |
import numpy as np
import codecs
import matplotlib.pyplot as plt
from sklearn.model_selection import train_test_split
from sklearn.datasets import make_classification
from sklearn.neighbors import KNeighborsClassifier
from sklearn.metrics import silhouette_samples, silhouette_score
from sklearn.cluster import KM... |
# Copyright 2018 D-Wave Systems Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in wri... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from .whoosh_schema import GPS
data = [
GSP(x=0, y=0, z=0, map=0),
]
data = [bm.to_dict() for bm in data]
|
"""
Contains the definition of Compound.
"""
from xdtools.artwork import Artwork
from xdtools.utils import Point
class Compound(Artwork):
"""
A compound shape.
=== Attributes ===
uid - the unique id of this Compound shape.
name - the name of this Compound shape as it appears in the Layers panel.... |
# eventpy library
# Copyright (C) 2020 Wang Qi (wqking)
# Github: https://github.com/wqking/eventpy
# 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.... |
# coding: utf-8
from django.template import RequestContext, TemplateSyntaxError
from django.test import RequestFactory, SimpleTestCase, override_settings
from django.urls import NoReverseMatch, resolve
from ..utils import setup
@override_settings(ROOT_URLCONF='template_tests.urls')
class UrlTagTests(SimpleTestCase):... |
# A linked list is given such that each node contains an additional random pointer which could point to any node in the list or null.
# Return a deep copy of the list.
# Definition for singly-linked list with a random pointer.
class RandomListNode:
def __init__(self, x):
self.label = x
self.next ... |
from setuptools import setup, find_packages, findall
with open('README.md', 'r', encoding='utf-8') as f:
long_description = f.read()
packages = find_packages(include=('nonebot', 'nonebot.*'))
stub_files = list(filter(lambda x: x.endswith('.pyi'), findall('nonebot')))
setup(
name='nonebot',
version='1.2.3... |
#!/usr/bin/python
from UcsSdk import *
# This script shows how to create and use the filter in UCS Manager method "ConfigResolveClass".
if __name__ == "__main__":
try:
handle = UcsHandle()
handle.Login("0.0.0.0", "username", "password")
inFilter = FilterFilter()
... |
# -*- coding: utf-8 -*-
# Generated by Django 1.11 on 2017-04-24 02:12
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('resume', '0008_auto_20170423_2111'),
]
operations = [
migrations.Remove... |
# Generated by Django 3.0.4 on 2020-03-31 08:36
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('user_event_log', '0002_update_type'),
]
operations = [
migrations.AddIndex(
model_name='userevent',
index=models.Ind... |
# Python script to generate metadata for Moffitt datasets
import os
import sys
from glob import glob
from shutil import copyfile
import pydicom
# 1)
# COLLECTION_NAME = "Sample_Mammography_Reference_Set"
# 2)
COLLECTION_NAME = "Automated_System_For_Breast_Cancer_Biomarker_Analysis"
DATA_DIR=os.environ['LABCAS_ARC... |
a = int(input('Em que ano você nasceu? '))
b = 2021 - a
if b == 18:
print('Você já deve se alistar.')
elif b < 18:
c = 18 - b
print(f'Ainda não chegou seu tempo, faltam {c} anos')
else:
d = b - 18
print(f'Passou do tempo, exatamente {d} ano(s)')
|
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri Mar 24 09:38:23 2017
@author: yuhao
"""
import numpy as np
import scipy as sp
from sklearn.gaussian_process import GaussianProcessRegressor
from sklearn.gaussian_process.kernels import RBF, ConstantKernel as C
from sklearn.gaussian_process.kernels imp... |
"""
Utils for language models.
from https://github.com/litian96/FedProx/blob/master/flearn/utils/language_utils.py
"""
import re
import numpy as np
from collections import Counter
# ------------------------
# utils for shakespeare dataset
ALL_LETTERS = "\n !\"&'(),-.0123456789:;>?ABCDEFGHIJKLMNOPQRSTUVWXYZ[]abcdefg... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.