text stringlengths 2 999k |
|---|
from unittest import TestCase
import os,sys,inspect
current_dir = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))
parent_dir = os.path.dirname(current_dir)
sys.path.insert(0, parent_dir)
import feladatok
class TestTobbnevuek(TestCase):
def test_feladat01(self):
adatok = ""
... |
"""
Generators Expression
WE studied:
- List Comprehension
- Dictionary Comprehension
- Set Comprehension
Not use:
- Tuple Comprehension => because call Generators
# List Comprehension
names = ['Carlos', 'Camila', 'Carla', 'Cassino', 'Cristina', 'Vanessa']
print(any([name[0] == 'C' for name in names]... |
"""Script to allow dynamic remappings of namespaces."""
# Copyright (c) 2022, ABB
# 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
# ab... |
from flask import make_response
from app import app
@app.route('/', methods=['GET'])
def main():
data = {
"message": "tropicalCyclone api",
}
return make_response(data, 200)
|
"""Constants for the Template Platform Components."""
CONF_AVAILABILITY_TEMPLATE = "availability_template"
CONF_ATTRIBUTE_TEMPLATES = "attribute_templates"
CONF_TRIGGER = "trigger"
DOMAIN = "template"
PLATFORM_STORAGE_KEY = "template_platforms"
PLATFORMS = [
"alarm_control_panel",
"binary_sensor",
"cove... |
# awl.rankedmodel.models.py
from django.db import models, transaction
# ============================================================================
class RankedModel(models.Model):
"""Abstract model used to have all the inheritors ordered in the database
by this model's ``rank`` field. Ranks can either be ... |
import torch
import torch.nn as nn
from ..attack import Attack
class MIFGSM(Attack):
r"""
MI-FGSM in the paper 'Boosting Adversarial Attacks with Momentum'
[https://arxiv.org/abs/1710.06081]
Distance Measure : Linf
Arguments:
model (nn.Module): model to attack.
eps (float): maxi... |
import click
from carpincho.attendees.api.attendees import AttendeeProvider
from carpincho.attendees.api.client import EventolClient
from carpincho.bot.main import bot
from carpincho.bot.activity_monitor import ActivityMonitor
from carpincho.db.models import init_db, Attendee
from carpincho.db.queries import get_next_... |
import logging
import pika
routing_key = "green"
def create_connection_channel():
connection_parameters = pika.ConnectionParameters(host="172.17.0.2", port=5672)
connection = pika.BlockingConnection(connection_parameters)
channel = connection.channel()
return channel
def echo_post(body): # noqa: ... |
from PyQt4 import QtCore, QtGui
from os import getenv, mkdir
from os.path import expanduser, join, exists, dirname
from sys import platform
from . import model
class QueueHandler(QtCore.QObject):
finishedLoading = QtCore.pyqtSignal(QtGui.QStandardItemModel)
finishedSaving = QtCore.pyqtSignal()
def __init... |
num = int(input("Enter any number "))
print(num) |
#!/usr/bin/python
import logging
import base64
import json
class MetadataPaginationTraits():
def __init__(self, a_page_size, a_start, a_end=""):
self.m_page_size = a_page_size
self.m_start_value = a_start
self.m_end_value = a_end
self.m_page_number = 0
def more_data(self, a_jso... |
# Documentation for Zulip's authentication backends is split across a few places:
#
# * https://zulip.readthedocs.io/en/latest/production/authentication-methods.html and
# zproject/prod_settings_template.py have user-level configuration documentation.
# * https://zulip.readthedocs.io/en/latest/development/authenticat... |
from grid.deploy import BaseDeployment
from grid import utils as gr_utils
import sys
import os
class HerokuNodeDeployment(BaseDeployment):
""" An abstraction of heroku grid node deployment process, the purpose of this class is set all configuration needed to deploy grid node application in heroku platform."""
... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#------------------------------------------------------
# @ File : cfgs.py
# @ Description:
# @ Author : Alex Chung
# @ Contact : yonganzhong@outlook.com
# @ License : Copyright (c) 2017-2018
# @ Time : 2020/11/4 上午9:00
# @ Software : PyCharm
#----... |
from os.path import join
from torchvision.transforms import Compose, CenterCrop, ToTensor, Resize
from data_utils import DatasetFromFolder
def calculate_valid_crop_size(crop_size, upscale_factor):
return crop_size - (crop_size % upscale_factor)
def input_transform(crop_size, upscale_factor):
return Compose... |
import colorsys
import logging
from enum import Enum
from itertools import chain
_LOGGER = logging.getLogger(__name__)
class Action(Enum):
"""
The Flow action enumeration.
Use this as the ``action`` parameter in a flow, to specify what should
happen after the flow ends.
"""
recover = 0
s... |
#!env python
from flask import Flask
from flask import request
from flask import jsonify
from werkzeug.utils import secure_filename
import json
import time
import os
from pprint import pprint
#################################
import torch
import numpy as np
import librosa
import scipy
from data_loader import loa... |
"""
Cisco Intersight
Cisco Intersight is a management platform delivered as a service with embedded analytics for your Cisco and 3rd party IT infrastructure. This platform offers an intelligent level of management that enables IT organizations to analyze, simplify, and automate their environments in more advan... |
"""
Profile ../profile-datasets-py/varying101lev_clw/004.py
file automaticaly created by prof_gen.py script
"""
self["ID"] = "../profile-datasets-py/varying101lev_clw/004.py"
self["Q"] = numpy.array([ 1.39118000e+00, 1.89830700e+00, 2.37902300e+00,
2.81347200e+00, 3.20298900e+00, 3.62377... |
from django.conf.urls import url
from bubu.products import views
app_name= 'posts'
urlpatterns = [
# /shop/
#ADD PRODUCT URLS
url(r'^settings/$', views.settings, name='settings'),
url(r'^settings/picture/$', views.picture, name='picture'),
url(r'^settings/upload_picture/$', views.upload_picture,
... |
#importing libraries and ignoring ssl errors.
from urllib.request import urlopen
from pathlib import Path
import json
import ssl
import time
import sys
import sqlite3
import xml.etree.ElementTree as ET
ctx = ssl.create_default_context()
ctx.check_hostname = False
ctx.verify_mode = ssl.CERT_NONE
#Setting up data folde... |
# 我方飞机模块
import pygame
import pygame.sprite # 碰撞检测类
import pygame.image
import pygame.time
import pygame.mixer
import pygame.event
import pygame.display
# 定义一个类 继承pygame.sprite.Sprite 用于后面碰撞检测
class MyPlane(pygame.sprite.Sprite):
def __init__(self, bg_size):
# 初始化碰撞检测类
pygame.sprite.Sprite.__... |
# -*- coding: utf-8 -*-
# Generated by Django 1.10 on 2017-01-14 23:37
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('hintgen', '0006_auto_20170114_1328'),
]
operations =... |
from __future__ import (division, absolute_import, print_function, unicode_literals)
import os
import numpy as np
import gzip
import os.path
import nltk
import logging
from nltk import FreqDist
from .WordEmbeddings import wordNormalize
from .CoNLL import readCoNLL
import sys
if (sys.version_info > (3, 0)):
impo... |
"""
Argo Server API
You can get examples of requests and responses by using the CLI with `--gloglevel=9`, e.g. `argo list --gloglevel=9` # noqa: E501
The version of the OpenAPI document: VERSION
Generated by: https://openapi-generator.tech
"""
import re # noqa: F401
import sys # noqa: F401
from ... |
import os
from setuptools import setup, find_packages
SCRIPT_DIR = os.path.abspath(os.path.dirname(__file__))
version_file_contents = open(os.path.join(SCRIPT_DIR, 'corpuscula/_version.py'),
'rt', encoding='utf-8').read()
VERSION = version_file_contents.strip()[len('__version__ = "'):-1]
... |
from lib.common import helpers
class Module:
def __init__(self, mainMenu, params=[]):
self.info = {
'Name': 'Get-NetSession',
'Author': ['@harmj0y'],
'Description': ('Execute the NetSessionEnum Win32API call to query a given host for active sessions on the host. Part... |
from pyrogram import Client as c
API_ID = input("\nEnter Your API_ID:\n > ")
API_HASH = input("\nEnter Your API_HASH:\n > ")
print("\n\n Enter Phone number when asked.\n\n")
i = c(name="wbb", in_memory=True, api_id=API_ID, api_hash=API_HASH)
with i:
ss = i.export_session_string()
print("\nHERE IS YOUR STRIN... |
import sqlite3
from flask import Flask, render_template, request, url_for, flash, redirect, abort
app = Flask(__name__)
app.config['SECRET_KEY'] = 'dncfIOVvftfFF*&5$_+1!!'
def get_db_connection():
conn = sqlite3.connect('database.db')
conn.row_factory = sqlite3.Row
return conn
def get_user(user_id):
... |
# coding=utf-8
# Copyright 2020 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... |
# ./pyxb/bundles/wssplat/raw/soapbind12.py
# -*- coding: utf-8 -*-
# PyXB bindings for NM:fe6dee6f975d5202c12c3e364c8df804f68deab8
# Generated 2016-09-18 17:34:06.486188 by PyXB version 1.2.5 using Python 2.7.12.final.0
# Namespace http://schemas.xmlsoap.org/wsdl/soap12/
from __future__ import unicode_literals
import ... |
# parameters.py
"""
Exp 181 - {'Initial_genes': '500', 'Host_mutation_rate': '0.03', 'TE_progeny': '0.00, 0, 0.55, 1, 0.30, 2, 0.15, 3', 'TE_Insertion_Distribution': 'Triangle( pmax=0, pzero=3.0/3.0 )', 'Carrying_capacity': '30', 'TE_excision_rate': '0.1', 'Junk_BP': '14', 'Gene_Insertion_Distribution': 'Triangle( pze... |
import smtplib # 相当于邮件服务器的客户端
from email.mime.text import MIMEText # 用于编写邮件正文
from email.header import Header # 用于编写邮件的头部
msg = MIMEText('Python发送邮件测试\n', 'plain', 'utf8') # plain表示纯文本
msg['From'] = Header('root', 'utf8')
msg['To'] = Header('zhangsan', 'utf8')
msg['Subject'] = Header('py email test', 'utf8')
sen... |
import os
import json
import argparse
import requests
from requests.packages.urllib3.exceptions import InsecureRequestWarning
requests.packages.urllib3.disable_warnings(InsecureRequestWarning)
parser = argparse.ArgumentParser(description='The script to generate data for harbor v1.4.0')
parser.add_argument('--endpoint... |
class OacensusError(Exception):
pass
class UserFeedback(OacensusError):
"""
An exception which was caused by user input or a runtime error and which
should be presented nicely.
"""
class ConfigFileFormatProblem(UserFeedback):
"""
A problem with config files.
"""
pass
class APIErro... |
import time
from typing import List
import numpy as np
from pbrl.algorithms.ppo.policy import Policy
class MultiPolicyRunner:
def __init__(
self,
env,
policy_num,
episode_num,
render=None
):
self.env = env
self.env_num = env.env_num
... |
#=============================================================================
# Copyright 2017 FLIR Integrated Imaging Solutions, Inc. All Rights Reserved.
#
# This software is the confidential and proprietary information of FLIR
# Integrated Imaging Solutions, Inc. ('Confidential Information'). You
# shall not d... |
"""
pneb is a parallelised nudged elastic band module.
"""
__author__ = 'Louis Vernon <louis.vernon@gmail.com>'
import os,sys,math,copy,random,time, multiprocessing
import numpy, scipy
from pesto import pio, putil
from multiprocessing import Queue
class Band():
pass
def worker(lattice, inputq, outputq):
w... |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
from django.contrib import admin
from pontoon.homepage import models
from pontoon.homepage import forms
class HomepageAdmin(admin.ModelAdmin):
list_display = (
"pk",
"created_at",
)
form = forms.HomepageFor... |
import numpy as np
from sklearn.decomposition import PCA
from scipy.stats import zscore
import time
import csv
import os
import os.path
import nibabel
from sklearn.metrics.pairwise import euclidean_distances
from scipy.ndimage.filters import gaussian_filter
from utils.global_params import n_folds, n_epochs, n_splits
f... |
#!/usr/bin/env python3
from pl_curve import sort_bins
import pandas
import numpy as np
def test_sort_bins():
'''
test the sort_bins function
'''
data = np.array([['', 'Col1', 'Col2'],
['Row1', 1, 2],
['Row2', 3, 4],
['Row3', 2, 3]])
# c... |
import math
from wpilib import SmartDashboard as Dash
from wpilib.command import Command
from constants import Constants
from subsystems import drive
from utils import pid, units
import odemetry
import wpilib
class TurnToAngle(Command):
def __init__(self, setpoint, relative=False):
super().__init__()
... |
import unittest
import numpy
from cupy import testing
@testing.gpu
class TestArrayCopyAndView(unittest.TestCase):
_multiprocess_can_split_ = True
@testing.numpy_cupy_array_equal()
def test_view(self, xp):
a = testing.shaped_arange((4,), xp, dtype=numpy.float32)
b = a.view(dtype=numpy.i... |
import os
import csv
import unittest
from unittest import TestCase, mock
from unittest.mock import patch, mock_open, MagicMock
INPUT_DIR = os.path.dirname(os.path.abspath(__file__))
import python_arptable
# Backup original function
_get_arp_table = getattr(python_arptable, 'get_arp_table')
# Mock arp table for host ... |
from tadataka.optimization import initializers |
# Generated by Django 3.0.5 on 2020-05-22 12:02
from django.conf import settings
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('chat', '0003_auto_20200522_1202'),
]
operations ... |
#!/usr/bin/python
#
# 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ag... |
"""
Given the root of a binary tree, return the postorder traversal of its nodes' values.
Example 1:
Input: root = [1, None, 2, 3], Output: [3, 2, 1]
1
\
2
/
3
Example 2:
Input: root = [], Output: []
Example 3:
Input: root = [1], Output: [1]
Example 4:
Input: root = [1, 2], Output: [2, 1]
... |
import gin
from colosseum.loops import human_loop
from colosseum.mdps import EpisodicMDP
from colosseum.mdps.river_swim.river_swim import RiverSwimMDP
@gin.configurable
class RiverSwimEpisodic(EpisodicMDP, RiverSwimMDP):
@property
def _graph_layout(self):
return {node: tuple(node) for node in self.G}... |
import json
import os
import time
import ccxt
import pandas as pd
from unittest import TestCase, mock
from crypto_data_fetcher.ftx import FtxFetcher
def ftx_config():
path = os.getenv("HOME") + '/.ftx.json'
with open(path) as f:
return json.load(f)
def create_ccxt_client():
headers = {
'FT... |
#!/usr/bin/python/3.8
import sys
path = '/home/$USER/www/pebmyn'
if path not in sys.path:
sys.path.append(path)
from main import app as application
|
# -*- coding: utf-8 -*-
## @package proxen.utils
# @brief Globals and utility functions used across the app.
import os, logging
from config import *
# --------------------------------------------------------------- #
## `bool` debug mode switcher (`True` = print debug messages to console)
DEBUG = CONFIG['app'].getboo... |
"""
Utilities.
Ben Adida - ben@adida.net
2005-04-11
"""
import urllib, re, datetime, string
# utils from helios_auth, too
from helios_auth.utils import *
from django.conf import settings
import random, logging
def split_by_length(str, length, rejoin_with=None):
"""
split a string by a given length
"""
... |
import unittest
from nose.tools import raises
from wextractor.extractors.extractor import Extractor
class TestExtractor(unittest.TestCase):
@raises(Exception)
def test_header_matches_dtypes(self):
'''
Tests that mismatched lengths of headers and dtypes raises
'''
Extractor(
... |
# 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: utf8 -*-
# Copyright (C) 2015 - Philipp Temminghoff <phil65@kodi.tv>
# This program is Free Software see LICENSE file for details
import xbmc
import xbmcgui
from ..Utils import *
from ..ImageTools import *
from ..TheMovieDB import *
from DialogBaseInfo import DialogBaseInfo
from ..WindowManager import w... |
# Generated by Django 2.0.4 on 2018-04-07 18:48
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('api', '0001_initial'),
]
operations = [
migrations.AddField(
m... |
import os
from oeqa.oetest import oeRuntimeTest, skipModule
from oeqa.utils.decorators import skipUnlessPassed
def setUpModule():
if not (oeRuntimeTest.hasPackage("dropbear") or oeRuntimeTest.hasPackage("openssh-sshd")):
skipModule("No ssh package in image")
class ScpTest(oeRuntimeTest):
@skipUnlessP... |
"""
Problem 2c.
Write a while loop that sums the values 1 through end, inclusive.
end is a variable that we define for you. So, for example, if we
define end to be 6, your code should print out the result:
21
which is 1 + 2 + 3 + 4 + 5 + 6.
"""
i = 1
sm = 0
while (i <= end):
sm += i
i += 1
print sm
|
""" Config helper """
import os
import sys
from configparser import RawConfigParser
from getpass import getpass
import validators
from oktaawscli.util import input
class OktaAuthConfig:
"""Config helper class"""
def __init__(self, logger):
self.logger = logger
self.config_path = os.path.ex... |
"""
move.py
Removes all annotations that do not have images associated with them.
"""
import os
import cv2
annots_dir = 'data/tennis_ball/annots'
no_image_dir = 'data/tennis_ball/no_image'
image_dir = 'data/tennis_ball/images'
# data/tennis_ball/annots/file.xml -> data/tennis_ball/images/file.JPEG
def to_image_path(... |
import os
script_path = os.path.dirname(os.path.realpath(__file__))
os.chdir(script_path) |
# Generated by Django 3.2.12 on 2022-03-23 13:25
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('rooms', '0001_initial'),
('bookings', '0002_auto_20220323_1304'),
]
operations = [
migrations.AddF... |
# Lint as: python3
# Copyright 2018, The TensorFlow Federated 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 ... |
"""
Copyright (c) 2019 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 writing,... |
# coding=utf-8
# Copyright 2018 The Tensor2Tensor 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... |
#!/usr/bin/env python3
"""
this module is responsible for finding and iterating over all unique possible
solutions / configurations by the given parameters
"""
import queue
from pieces import ChessPiece
def find_solutions_s(row_count, col_count, count_by_symbol):
"""find and iterate over solution boards, implem... |
# -*- coding: utf-8 -*-
import numpy as np
def events_to_mne(events, conditions=None):
"""Create MNE compatible events.
Parameters
----------
events : list, ndarray or dict
Events onset location. If a dict is passed (e.g., from 'events_find()'), will select only the 'Onset' list.
cond... |
import praw
import time
import os
from datetime import datetime
from bot_config import *
print("Initializing...") #initializing the good-guy bot we all truly love
cache = []
subreddit_array = ["FreeKarma","Test","python","learnprogramming","programming"]
print("Logging in as %s..." %REDDIT_USERNAME)
# Crea... |
import factory
from django.contrib.auth import get_user_model
from recipes.models import Recipe
from factory.django import DjangoModelFactory
User = get_user_model()
class UserFactory(DjangoModelFactory):
class Meta:
model = User
|
from xmlrpclib import ServerProxy, Fault
from server import Node, UNHANDLED
from client import randomString
from threading import Thread
from time import sleep
from os import listdir
import sys
import wx
HEAD_START = 0.1 # Seconds
SECRET_LENGTH = 100
class ListableNode(Node):
"""
An extended version of Node,... |
import os
import torch
import numpy as np
import scipy.misc as m
import re
import glob
from torch.utils import data
class CELEBA(data.Dataset):
def __init__(self, root, split="train", is_transform=False, img_size=(32, 32), augmentations=None):
"""__init__
:param root:
:param split:
... |
import unittest
import acpc_python_client as acpc
from tools.game_tree.builder import GameTreeBuilder
from tools.game_tree.node_provider import StrategyTreeNodeProvider
from tools.game_tree.nodes import ActionNode
from tools.walk_trees import walk_trees
from implicit_modelling.build_portfolio import train_portfolio_r... |
# Copyright 2016-2018, Pulumi 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 t... |
# -*- coding: utf-8 -*-
import os
import shutil
import json
import pprint
import sqlite3
class BetterBibtex(object):
def __init__(self, zotero_path, cache_path):
self.bb_database = os.path.join(zotero_path, 'better-bibtex.sqlite')
self.bb_copy = os.path.join(cache_path, 'better-bibtex.sqlite')
... |
from __future__ import absolute_import
from functools import total_ordering
import copy
import logging
try:
from itertools import imap
except ImportError:
imap = map
from tornado import web
from ..views import BaseHandler
from ..utils.tasks import iter_tasks, get_task_by_id, as_dict
logger = logging.getLog... |
# -*- coding: utf-8 -*-
# Copyright 2014-2016 OpenMarket Ltd
#
# 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... |
#!/usr/local/bin/python -u
'''
Provide a Cloudera Manager benchmark pipeline
Usage: %s [options]
Options:
-h --help Show help
--user=<cloudera-user> The Cloudera services user
Defaults to 'admin'
--password=<cloudera-password> ... |
import numpy as np
import tensorflow as tf
import cv2
import os
import tarfile
from pathlib import Path
from tqdm import tqdm
import shutil
from .base_dataset import BaseDataset
from superpoint.datasets_V2 import synthetic_dataset
from .utils import pipeline
from .utils.pipeline import parse_primitives
from superpoint... |
import os
import pickle
import threading
num_children = 0
import logging
l = logging.getLogger("claripy.backends.backend_z3_parallel")
from .backend_z3 import BackendZ3
class BackendZ3Parallel(BackendZ3):
def __init__(self):
BackendZ3.__init__(self)
self._child = False
self._lock = threa... |
from typing import (
TYPE_CHECKING,
Any,
Callable,
ClassVar,
Iterable,
Sequence,
TypeVar,
)
from typing_extensions import final
from returns._generated.iterable import iterable_kind
from returns.context import NoDeps
from returns.interfaces import iterable
from returns.interfaces.specific ... |
# 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 appli... |
'''
Test CIFAR classifications with JAX and Haiku using a ResNet
@author Shakes
'''
import haiku as hk
import jax
import numpy as np
import jax.numpy as jnp
import optax
import tensorflow as tf
import tensorflow_datasets as tfds #stable
from typing import Mapping, Tuple, NamedTuple
import time
#locals
import filename... |
"""Fig. 5 from Heitzig & Hiller (2020) Degrees of individual and groupwise
backward and forward responsibility in extensive-form games with ambiguity,
and their application to social choice problems. ArXiv:2007.07352
drsc_fig5:
v1: i
├─╴choose_unknown╶─╴chose_unknown
│ ├─╴w2: desired ✔
│ ... |
"""django1 URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/3.0/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: path('', views.home, name='home')
Class-based... |
# coding: utf-8
"""
Isilon SDK
Isilon SDK - Language bindings for the OneFS API # noqa: E501
OpenAPI spec version: 8
Contact: sdk@isilon.com
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import unittest
import isi_sdk_8_2_1
from i... |
import docker
from . import docker_shell
from . import host_shell
from . import dummy_net
class DummyNetFactory(object):
def __init__(self, log):
self.log = log
def host(self, sudo=False):
shell = host_shell.HostShell(log=self.log, sudo=sudo)
return dummy_net.DummyNet(shell=shell)
... |
# Generated by Django 2.0.13 on 2019-03-30 04:57
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('users', '0003_auto_20190323_1928'),
]
operations = [
migrations.AddField(
model_name='user',
name='profile_image',
... |
"""Save current active document as a PDF file."""
# Import built-in modules
import os
from tempfile import mkdtemp
# Import local modules
from photoshop import Session
with Session() as ps:
option = ps.PDFSaveOptions(jpegQuality=12, layers=True, view=True)
pdf = os.path.join(mkdtemp(), "test.pdf")
ps.act... |
# (C) Datadog, Inc. 2018-present
# All rights reserved
# Licensed under Simplified BSD License (see LICENSE)
import os
from datadog_checks.base.utils.common import get_docker_hostname
CHECK_NAME = "go_expvar"
HERE = os.path.dirname(os.path.abspath(__file__))
HOST = get_docker_hostname()
PORT = '8079'
URL = 'http://... |
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
from sklearn.metrics import mean_absolute_error
from sklearn.metrics import mean_squared_error
from sklearn.metrics import median_absolute_error
from sklearn.metrics import r2_score
def info(data):
"""Get info about dataset.
Create a resu... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time : 5/15/20 4:49 PM
# @File : grover.py
# qubit number=2
# total number=8
import cirq
import cirq.google as cg
from typing import Optional
import sys
from math import log2
import numpy as np
#thatsNoCode
from cirq.contrib.svg import SVGCircuit
# Symbols for ... |
""" -----------------------------------------------------
# TECHNOGIX
# -------------------------------------------------------
# Copyright (c) [2022] Technogix SARL
# All rights reserved
# -------------------------------------------------------
# Keywords to manage cloudtrail tasks
# ---------------------------... |
"""
morayで起動する内部サーバ設定
http://localhost:port/
"""
import bottle, logging, pkg_resources, os, socket, time
from bottle.ext.websocket import GeventWebSocketServer, websocket
from functools import wraps
from threading import Thread
import moray
from moray import _config, _module
from moray._module import py
... |
# -*- coding: utf-8 -*-
# Copyright 2020 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... |
# 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 argparse
import os
import numpy as np
import pandas as pd
import cv2
from math import atan, tan, pi
from tqdm import tqdm
import itertools
def point_to_plane(depth, fx=600, fy=600):
H, W = depth.shape
depth_plane = depth.copy()
# compute field of view
fov_x = 2 * atan(W / (2 * fx))
fov_y =... |
import os
from .. import constants
from . import application
from igraph import *
import copy
# Begin of src based on node-parser.py from https://github.com/danposch/BPR-Scripts
class Link(object):
def __init__(self, n1, n2):
self.n1 = n1
self.n2 = n2
self.ip1 = ""
self.ip2 = ""
... |
# Copyright 2018 The dm_control 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 i... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.