filename
stringlengths
13
19
text
stringlengths
134
1.04M
the-stack_106_20163
import os import openpype.api from openpype.hosts.photoshop import api as photoshop class ExtractImage(openpype.api.Extractor): """Produce a flattened image file from instance This plug-in takes into account only the layers in the group. """ label = "Extract Image" hosts = ["photoshop"] fam...
the-stack_106_20165
""" Copyright 2020 The Magma Authors. This source code is licensed under the BSD-style license found in the LICENSE file in the root directory of this source tree. Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES O...
the-stack_106_20166
""" Sample repo pull request events module. Type examples: {'CreateEvent', e.g. branch 'IssueCommentEvent', 'IssuesEvent', 'PullRequestEvent', 'PushEvent', 'WatchEvent'} """ import pprint from collections import Counter from etc import config from lib.connection import CONN def main(): for repo_name in con...
the-stack_106_20167
# !/usr/local/python/bin/python # -*- coding: utf-8 -*- # (C) Wu Dong, 2020 # All rights reserved # @Author: 'Wu Dong <wudong@eastwu.cn>' # @Time: '2020-03-19 10:33' """ 演示 pre-request 框架如何使用Json校验 """ import json from flask import Flask from pre_request import pre, Rule app = Flask(__name__) app.config["TESTING"] = ...
the-stack_106_20169
#!/usr/bin/env python # # Use the raw transactions API to spend TRANSCENDENCEs received on particular addresses, # and send any change back to that same address. # # Example usage: # spendfrom.py # Lists available funds # spendfrom.py --from=ADDRESS --to=ADDRESS --amount=11.00 # # Assumes it will talk to a transcend...
the-stack_106_20170
import numpy as np def kernel(M, float_n, data): mean = np.mean(data, axis=0) stddev = np.std(data, axis=0) stddev[stddev <= 0.1] = 1.0 data -= mean data /= np.sqrt(float_n) * stddev corr = np.eye(M, dtype=data.dtype) for i in range(M - 1): corr[i + 1:M, i] = corr[i, i + 1:M] = da...
the-stack_106_20172
import logging from PySide2.QtWidgets import QFrame, QLabel, QVBoxLayout, QHBoxLayout, QScrollArea, QSizePolicy, \ QTableWidget, QTableWidgetItem from PySide2.QtCore import Qt, QSize from ...ui.dialogs.new_state import SrcAddrAnnotation l = logging.getLogger('ui.widgets.qconstraint_viewer') class QConstraintVi...
the-stack_106_20175
from .taadd_com import TaaddCom class TenMangaCom(TaaddCom): _name_selector = '.read-page a[href*="/book/"]' _pages_selector = '.sl-page' _chapters_selector = '.chapter-box .choose-page a:last-child' img_selector = '.pic_box .manga_pic' main = TenMangaCom
the-stack_106_20176
############################################################################# # Import # ############################################################################# import os import random import PIL.Image as Image from tqdm import tqdm import numpy ...
the-stack_106_20179
# -*- coding: utf-8 -*- """Definition of the QueueOnce task and AlreadyQueued exception.""" from celery import Task, states from celery.result import EagerResult from .helpers import queue_once_key, import_backend class AlreadyQueued(Exception): def __init__(self, countdown): self.message = "Expires in {...
the-stack_106_20180
""" Google Text to Speech Available Commands: .tts LanguageCode as reply to a message .tts LangaugeCode | text to speak""" import asyncio import os import subprocess from datetime import datetime from gtts import gTTS from FIREX.utils import admin_cmd, edit_or_reply, sudo_cmd from userbot.cmdhelp import CmdHelp @b...
the-stack_106_20181
# Copyright Amazon.com Inc. or its affiliates. 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. A copy of # the License is located at # # http://aws.amazon.com/apache2.0/ # # or in the "license" file accompany...
the-stack_106_20182
#----------------------------------------------------------------------------- # Copyright (c) 2012 - 2018, Anaconda, Inc. All rights reserved. # # Powered by the Bokeh Development Team. # # The full license is in the file LICENSE.txt, distributed with this software. #---------------------------------------------------...
the-stack_106_20184
#!/usr/bin/env python # # Copyright 2010 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...
the-stack_106_20186
'''RL agent implementing hierarchical spatial attention (HSA).''' # python import os import pickle # scipy from numpy.random import rand, randint from numpy import array, delete, log2, meshgrid, ravel_multi_index, reshape, unravel_index, zeros # drawing from matplotlib import pyplot from mpl_toolkits.mplot3d import Ax...
the-stack_106_20187
# Copyright 2017 The Sonnet 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 applicable l...
the-stack_106_20188
from __future__ import unicode_literals from django.conf import settings from django.contrib.contenttypes.models import ContentType from django.core.urlresolvers import reverse from django.db import models from django.db.models.signals import pre_save from django.utils import timezone from django.utils.safestring impo...
the-stack_106_20192
""" Discogs API Query Tool: Connect to Discogs API and pull merchant listing data """ import sys import json import csv import argparse import logging import requests class MissingAPIKeyOrSecret(Exception): """Error logging for no input value""" def __init__(self, error_field): super(MissingAPIKeyOrS...
the-stack_106_20193
#!/usr/bin/env python # encoding: utf-8 # Thomas Nagy, 2005-2016 (ita) """ Utilities and platform-specific fixes The portability fixes try to provide a consistent behavior of the Waf API through Python versions 2.5 to 3.X and across different platforms (win32, linux, etc) """ import os, sys, errno, traceback, inspec...
the-stack_106_20194
""" Synth modules in Torch. """ import copy from typing import Any, Dict, List, Optional, Tuple import torch import torch.nn as nn import torch.nn.functional as F from torch import tensor from torch import Tensor as T import torchsynth.util as util from torchsynth.config import BASE_REPRODUCIBLE_BATCH_SIZE, SynthCon...
the-stack_106_20195
import asyncio import dataclasses import time import traceback from secrets import token_bytes from typing import Callable, Dict, List, Optional, Tuple, Set from blspy import AugSchemeMPL, G2Element from chiabip158 import PyBIP158 import staicoin.server.ws_connection as ws from staicoin.consensus.block_creation impor...
the-stack_106_20197
from __future__ import division import numpy as np from menpo.base import doc_inherit, name_of_callable from menpo.math import pca, pcacov, ipca, as_matrix from .linear import MeanLinearVectorModel from .vectorizable import VectorizableBackedModel class PCAVectorModel(MeanLinearVectorModel): r""" A :map:`Mea...
the-stack_106_20200
# ------------------------------------------------------------------------------ # CodeHawk Binary Analyzer # Author: Henny Sipma # ------------------------------------------------------------------------------ # The MIT License (MIT) # # Copyright (c) 2021 Aarno Labs, LLC # # Permission is hereby granted, free of char...
the-stack_106_20202
from gql import gql, Client from gql.transport.aiohttp import AIOHTTPTransport def getLastExchanges(network, exchange, contract: str, limit, pairAddress): transport = AIOHTTPTransport(url="https://graphql.bitquery.io") client = Client(transport=transport, fetch_schema_from_transport=True) query = gql...
the-stack_106_20204
import nengo import numpy as np from numpy import random import matplotlib.pyplot as plt import matplotlib.cm as cm # import tensorflow as tf import os from nengo.dists import Choice from datetime import datetime # from nengo_extras.data import load_mnist import pickle from nengo.utils.matplotlib import rasterplot im...
the-stack_106_20205
from ifcopenshell.geom.app import application from PyQt4 import QtCore, QtGui class my_app(application): def __init__(self): application.__init__(self) # self.window = my_app.window() self.window.setWindowTitle("TU Eindhoven IfcOpenShell scripting tool") self.labe...
the-stack_106_20207
""" #Trains a ResNet on the CIFAR10 dataset. """ from __future__ import print_function import keras from keras.layers import Dense, Conv2D, BatchNormalization, Activation from keras.layers import AveragePooling2D, Input, Flatten from keras.optimizers import Adam from keras.callbacks import ModelCheckpoint, LearningRa...
the-stack_106_20209
#!/usr/bin/python2 # -*- coding: utf-8 -*- """ CHOOSING LETTER-COLOR ASSOCIATIONS TASK O.Colizoli & M.Blasco Oliver, 2019 Outputs a TSV file for sub-101 and sub-201 (Group2 gets Group1's preferences) """ ### Import Libraries ### import os, time # for paths and data from psychopy import core, visual, event, gui, monito...
the-stack_106_20212
# -*- encoding: utf-8 -*- """ keri.kli.commands.multisig module """ import argparse from hio import help from hio.base import doing from keri.app import directing, grouping, indirecting from keri.app.cli.common import rotating, existing, displaying logger = help.ogler.getLogger() parser = argparse.ArgumentParser(...
the-stack_106_20213
# Copyright 2018 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by...
the-stack_106_20219
title = 'Addition of CH3 across a double bond in CH2O' description = \ """ This example illustrates how more complex explorer jobs work. In this case the source channel involves two reactants and since CH3 can add across the double bond two ways this results in two pressure dependent networks. """ database( the...
the-stack_106_20220
from path import path_code_dir import sys sys.path.insert(0, path_code_dir) import numpy as np from scipy import sparse import cv2 from pymatreader import read_mat # from extract_graph import dic_to_sparse from amftrack.pipeline.functions.image_processing.extract_graph import ( generate_skeleton, ) f...
the-stack_106_20221
# Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0 # For details: https://bitbucket.org/ned/coveragepy/src/default/NOTICE.txt """File wrangling.""" import fnmatch import ntpath import os import os.path import posixpath import re import sys from coverage import env from coverage.backward ...
the-stack_106_20222
from contextlib import closing import argparse import json import urllib2 import requests import cStringIO from PIL import Image from PIL import ImageDraw def highlight_faces(image_url, faces, output_filename): """Draws a polygon around the faces, then saves to output_filename. Args: image_url: a URL ...
the-stack_106_20223
import psycopg2 from psycopg2.extras import execute_values import fastkml as fk import shapely.wkt from shapely.geometry.point import Point import sys if len(sys.argv) < 3: print("Usage: python load_takeout.py <userid> <Location History.json>") sys.exit(1) userid, location_file = sys.argv[1], sys.argv[2] pri...
the-stack_106_20224
import unittest from unittest import mock from betfairlightweight.resources.baseresource import BaseResource from betfairlightweight.streaming.cache import ( OrderBookCache, OrderBookRunner, UnmatchedOrder, MarketBookCache, RunnerBook, Available, ) from betfairlightweight.exceptions import Cach...
the-stack_106_20226
# -*- coding: UTF-8 -*- import logging import traceback import simplejson as json from django.contrib.auth.models import Group from django.db.models import F from django.http import HttpResponse from common.utils.extend_json_encoder import ExtendJSONEncoder from common.utils.permission import superuser_required from ...
the-stack_106_20228
# -*- coding: utf-8 -*- # Copyright: (c) 2021, Frank Dornheim <dornheim@posteo.de> # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) from __future__ import (absolute_import, division, print_function) __metaclass__ = type import pytest import os from ansible.errors import A...
the-stack_106_20229
import os import random import time from copy import deepcopy # 打印出全部tensor,不要省略号 import numpy as np import torch import yaml from tensorboardX import SummaryWriter from tqdm import tqdm from src.data.data_iterator import DataIterator from src.data.dataset import TextLineDataset, ZipDataset from src.data.vocabulary i...
the-stack_106_20233
# -*- coding: utf-8 -*- # base16-prompt-toolkit (https://github.com/memeplex/base16-prompt-toolkit) # Base16 Prompt Toolkit template by Carlos Pita (carlosjosepita@gmail.com # Paraiso scheme by Jan T. Sott from prompt_toolkit.output.vt100 import _256_colors from pygments.style import Style from pygments.token import ...
the-stack_106_20237
import torch import json from torch import nn from .mlp import MLP from ..constants import CATEGORICAL, LABEL, LOGITS, FEATURES from typing import Optional, List from .utils import init_weights class CategoricalMLP(nn.Module): """ MLP for categorical input. The input dimension is automatically computed based ...
the-stack_106_20238
# # Copyright 2017 Netflix, 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...
the-stack_106_20240
""" matrix multiplication is a binary operation that produces a product matrix from two matrices . To multiply two matrices, the number of columns of first matrix should be equal to the number of rows to second matrix. This program finds the product of two given matrices """ Row_1 = int(input("Enter the number of ro...
the-stack_106_20242
"""Primitive dict ops.""" from mypyc.ir.ops import ERR_FALSE, ERR_MAGIC, ERR_NEVER, ERR_NEG_INT from mypyc.ir.rtypes import ( dict_rprimitive, object_rprimitive, bool_rprimitive, int_rprimitive, list_rprimitive, dict_next_rtuple_single, dict_next_rtuple_pair, c_pyssize_t_rprimitive, c_int_rprimitive ) fro...
the-stack_106_20244
# -*- coding: utf-8 -*- ''' データの読み込みと確認 ''' # ライブラリのインポート import pandas as pd import numpy as np import matplotlib.pyplot as plt import seaborn as sns # ランダムシードの設定 import random np.random.seed(1234) random.seed(1234) # データの読み込み train = pd.read_csv('./data/train.tsv', sep='\t') test = pd.read_csv(...
the-stack_106_20246
import pickle import matplotlib.pyplot as plt from binomial_model import * from scipy.special import loggamma from invasion_threshold import * def poisson(xvec, xmean): return np.exp(xvec*np.log(xmean)-xmean-loggamma(xvec+1)) #parameter mu = 0.05 f = lambda m: 1 K = 1 tmin = 1 T = np.inf mmax = 40 kmax = 20 mmean...
the-stack_106_20249
''' Tree View ========= .. image:: images/treeview.png :align: right .. versionadded:: 1.0.4 :class:`TreeView` is a widget used to represent a tree structure. It is currently very basic, supporting a minimal feature set. Introduction ------------ A :class:`TreeView` is populated with :class:`TreeViewNode` ins...
the-stack_106_20250
# -*- coding: utf-8 -*- from django.conf import settings from sys import version_info from yats.api import * def update_permissions_after_migration(app,**kwargs): """ Update app permission just after every migration. This is based on app django_extensions update_permissions management command. """ ...
the-stack_106_20251
""" Demo of HMR. Note that HMR requires the bounding box of the person in the image. The best performance is obtained when max length of the person in the image is roughly 150px. When only the image path is supplied, it assumes that the image is centered on a person whose length is roughly 150px. Alternatively, you c...
the-stack_106_20252
import re import dns.resolver import tldextract from app.plugin.data.dns_provider import DNS_PROVIDER __plugin__ = "DNS Scanner" SEQUENCE = 1 RESOLVER_NAMESERVERS = ["223.5.5.5", "1.1.1.1", "114.114.114.114"] RESOLVER_TIMEOUT = 2 RESOLVER_LIFETIME = 8 def run(url): scan_result = {"name": __plugin__, "sequen...
the-stack_106_20254
import sys import time import rospy from sensor_msgs.msg import Image as msg_Image from sensor_msgs.msg import PointCloud2 as msg_PointCloud2 import sensor_msgs.point_cloud2 as pc2 from sensor_msgs.msg import Imu as msg_Imu import numpy as np from cv_bridge import CvBridge, CvBridgeError import inspect import...
the-stack_106_20258
""" Extending the Button Context Menu +++++++++++++++++++++++++++++++++ This example enables you to insert your own menu entry into the common right click menu that you get while hovering over a value field, color, string, etc. To make the example work, you have to first select an object then right click on an user i...
the-stack_106_20260
import json STATUSES = { 200: "OK", 400: "Bad requests", 409: "Nick already exists", 410: "Wrong nick", 403: "Forbidden", 418: "Unclassified error" } class ProtocolException(Exception): def __init__(self, message): super().__init__(message, None) def form_service(attr={}): ...
the-stack_106_20261
import onmt import torch import argparse import math parser = argparse.ArgumentParser(description='translate.py') parser.add_argument('-model', required=True, help='Path to model .pt file') parser.add_argument('-src', required=True, help='Source sequence to decode (one line p...
the-stack_106_20262
# Authors: Alexandre Gramfort <alexandre.gramfort@telecom-paristech.fr> # Denis Engemann <denis.engemann@gmail.com> # Martin Luessi <mluessi@nmr.mgh.harvard.edu> # Eric Larson <larson.eric.d@gmail.com> # Marijn van Vliet <w.m.vanvliet@gmail.com> # Jona Sassenhagen <jona.sass...
the-stack_106_20265
#!/usr/bin/env python3 """A setuptools based setup module. See: https://packaging.python.org/en/latest/distributing.html https://github.com/pypa/sampleproject Extra supported commands are: * gen, to generate the classes required for Telethon to run or docs * pypi, to generate sdist, bdist_wheel, and push to PyPi """ ...
the-stack_106_20268
"""HTML sanitizer for Gruyere, a web application with holes. Copyright 2010 Google Inc. All rights reserved. This code is licensed under the http://creativecommons.org/licenses/by-nd/3.0/us Creative Commons Attribution-No Derivative Works 3.0 United States license. DO NOT COPY THIS CODE! This application is a small...
the-stack_106_20269
import subprocess import os import sys import subprocess import numpy as np import pycnal import pycnal_toolbox from remap_bdry import remap_bdry from remap_bdry_uv import remap_bdry_uv year = int(sys.argv[1]) lst_year = [year] data_dir = '/Volumes/R1/Data/SODA_2.1.6/' dst_dir='./' lst_file = [] for year in lst_y...
the-stack_106_20270
"""Support for the Fibaro devices.""" from __future__ import annotations from collections import defaultdict import logging from fiblary3.client.v4.client import Client as FibaroClient, StateHandler import voluptuous as vol from homeassistant.const import ( ATTR_ARMED, ATTR_BATTERY_LEVEL, CONF_DEVICE_CLA...
the-stack_106_20271
""" Reimplementation of the particle energy histogram for the electron species, directly on top of h5py. The resulting speedup compared to the openPMD-viewer-based `particle_energy_histogram` is a factor ~4. To view all groups datasets and corresponding attributes in an .h5 file, use `h5ls -rv filename.h5`. """ import...
the-stack_106_20272
""" @author: David Lei @since: 28/08/2016 @modified: Worst: O(n^2) Best: O(n) to find 3rd smallest element in array, a = [5, 4, 1, 2, 9, 8, 6] split array into 2 around a pivot, eg: make pivot 6 less than 6 = [5, 4, 1, 2] greater than 6 = [6, 8] len(less than) = 4 2 < 4 so do aga...
the-stack_106_20274
# Copyright 2019,2020,2021 Sony Corporation. # Copyright 2021 Sony Group 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 # # Un...
the-stack_106_20275
import utime import ustruct def color565(r, g, b): return (r & 0xf8) << 8 | (g & 0xfc) << 3 | b >> 3 class DummyPin: """A fake gpio pin for when you want to skip pins.""" OUT = 0 IN = 0 PULL_UP = 0 PULL_DOWN = 0 OPEN_DRAIN = 0 ALT = 0 ALT_OPEN_DRAIN = 0 LOW_POWER = 0 MED...
the-stack_106_20277
import datetime import dateutil.parser from django.core.cache import cache from django.test import TestCase from apps.physicaldevice.models import Device from apps.stream.models import StreamId, StreamVariable from apps.streamdata.helpers import StreamDataBuilderHelper from apps.streamdata.models import StreamData f...
the-stack_106_20279
#!/usr/bin/env python """ Tool for packaging Python apps for Android ========================================== This module defines the entry point for command line and programmatic use. """ from __future__ import print_function from os import environ from pythonforandroid import __version__ from pythonforandroid.pyt...
the-stack_106_20280
import pickle import numpy as np import matplotlib.pyplot as plt with open('c10p1.pickle', 'rb') as f: data = pickle.load(f) c10p1 = data['c10p1'] def normailze(raw_data): mean = np.mean(raw_data, axis=0) data = raw_data - mean return data data = normailze(c10p1) plt.figure(1) plt.scatter(data[:,...
the-stack_106_20281
import module_crud from time import sleep caminho = './projeto_crud_python/arquive/arquive.txt' conteudo = '\ntexto' opc1 = 'ler arquivo' opc2 = 'escrever' opc3 = 'apagar ' inicia = True while inicia : print('\n'*50) print('| ','-'*15,' |') print(f'1- {opc1}\n2- {opc2}\n3- {opc3}\n4- sair ->[') prin...
the-stack_106_20283
import os import sys import pytest # add scripts to the path sys.path.append( os.path.split( os.path.dirname( os.path.abspath(__file__) ) )[0] ) import pymsteams def test_env_webhook_url(): """ Test that we have the webhook set as an environment variable. This ...
the-stack_106_20284
""" Train LDA model using https://pypi.python.org/pypi/lda, and visualize in 2-D space with t-SNE. """ import os import time import lda import random import argparse import numpy as np from sklearn.feature_extraction.text import CountVectorizer from sklearn.manifold import TSNE import bokeh.plotting as bp from bo...
the-stack_106_20285
import click from flask.cli import FlaskGroup from myapi.app import create_app def create_myapi(info): return create_app(cli=True) @click.group(cls=FlaskGroup, create_app=create_myapi) def cli(): """Main entry point""" @cli.command("init") def init(): """Init application, create database tables a...
the-stack_106_20288
import os import hashlib import warnings from tempfile import mkdtemp, TemporaryFile from shutil import rmtree from twisted.trial import unittest from scrapy.item import Item, Field from scrapy.http import Request, Response from scrapy.settings import Settings from scrapy.pipelines.images import ImagesPipeline skip ...
the-stack_106_20290
""" AWS keys protection module """ import sys import json import hashlib import copy import ipaddress import urllib.request import boto3 import botocore.config from .common import get_accessibility_data DENY_NOT_IP_POLICY = { "Sid": "DenyIpBased", "Effect": "Deny", "NotAction": "iam:PutUserPolicy", ...
the-stack_106_20291
# Copyright (C) 2016 Atsushi Togo # All rights reserved. # # This file is part of phonopy. # # 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 # notic...
the-stack_106_20293
from math import sqrt, acos def dist(v1, v2): return sqrt((v1[0]-v2[0])**2 + (v1[1]-v2[1])**2) def dot(v1, v2): return v1[0]*v2[0] + v1[1]*v2[1] def cross(v1, v2, v3): return (v2[0]-v1[0])*(v3[1]-v1[1]) - (v2[1]-v1[1])*(v3[0]-v1[0]) def norm(v1): return sqrt(v1[0]*v1[0] + v1[1]*v1[1]) def angle(v1,...
the-stack_106_20294
#!/usr/bin/env python # # Copyright (c) 2013 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. """Updates the Chrome reference builds. Before running this script, you should first verify that you are authenticated for SVN. ...
the-stack_106_20296
# -*- coding: utf-8 -*- from django.core.cache import cache from django.db.models.signals import pre_delete, m2m_changed, pre_save from django.dispatch import receiver from publication_backbone.models_bases.polymorphic_mptt.signals import ( move_to_done, pre_save_polymorphic_mptt, post_save_polymorphic_mpt...
the-stack_106_20297
from django.test import TestCase from grid.templatetags.grid_tags import style_element, YES_IMG, NO_IMG, \ YES_KEYWORDS, NO_KEYWORDS class GridTest(TestCase): def test_01_style_element_filter(self): tests = [ ('+', 1, 0, ''), ('++', 2, 0, ''), ('+++', 3, 0, ''), ...
the-stack_106_20298
from flask import Flask, request, abort from flask.helpers import safe_join from werkzeug.utils import append_slash_redirect from lektor.db import Database from lektor.builder import Builder from lektor.buildfailures import FailureController from lektor.admin.modules import register_modules from lektor.reporter import...
the-stack_106_20299
""" .. Deep Residual Learning for Image Recognition: https://arxiv.org/abs/1512.03385 """ import torch import torch.nn as nn import torch.nn.functional as F class BasicBlock(nn.Module): expansion = 1 def __init__(self, in_planes, planes, stride=1): super(BasicBlock, self).__init__() ...
the-stack_106_20300
import logging import os import sys from urllib.request import urlopen from xml.etree.ElementTree import fromstring import pandas as pd import requests import xlrd from django.conf import settings from django.core.management.base import BaseCommand from django.core.management.color import no_style from django.db impo...
the-stack_106_20303
from marshmallow import Schema, fields, post_load from enum import Enum from src.messages.create_game import MsgCreateGame from src.messages.register import MsgRegister from src.messages.subscribe_game import MsgSubscribeGame from src.messages.turn import MsgTurn class MessageType: CREATE_GAME = 'creategame' R...
the-stack_106_20305
#!/usr/bin/env python # 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 ...
the-stack_106_20308
bl_info = { "name": "Manipulator Menu: Key: 'Ctrl Space'", "description": "Manipulator Modes", "author": "Antony Riakiotakis, Sebastian Koenig", "version": (0, 1, 1), "blender": (2, 77, 0), "location": "Ctrl Space", "warning": "", "wiki_url": "", "category": "3d View" } import bpy ...
the-stack_106_20309
# Advent of Code 2021 # Day 10: Part 1 and Part 2 # Author: Nico Van den Hooff from collections import Counter def read_data(path): with open(path, "r") as f: data = f.read().splitlines() # convert data to set, makes deleting corrupted lines efficient in part 2 data = set(data) return data ...
the-stack_106_20310
import os from subprocess import run import platform import time def log(string, file): print(string) file.write(f"{string}\n") file.flush() def timestamp(): now = time.localtime() return f"[{now.tm_mon}/{now.tm_mday}/{now.tm_year} {now.tm_hour}:{now.tm_min}:{now.tm_sec}]" duration = 0 def time_m...
the-stack_106_20313
import numpy as np from opytimizer.optimizers.evolutionary import ga from opytimizer.spaces import search def test_ga_params(): params = { 'p_selection': 0.75, 'p_mutation': 0.25, 'p_crossover': 0.5, } new_ga = ga.GA(params=params) assert new_ga.p_selection == 0.75 asse...
the-stack_106_20314
# 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 agreed to in writing, ...
the-stack_106_20315
# This file is distributed under the same license as the Django package. # # The *_FORMAT strings use the Django date format syntax, # see http://docs.djangoproject.com/en/dev/ref/templates/builtins/#date DATE_FORMAT = 'j F Y' TIME_FORMAT = 'G:i' DATETIME_FORMAT = 'j F Y, G:i' YEAR_MONTH_FORMAT = 'F Y' MONTH_DAY_FORMAT...
the-stack_106_20316
#!/usr/bin/env python # Two environmental variables influence this script. # # GDAL_CONFIG: the path to a gdal-config program that points to GDAL headers, # libraries, and data files. # # PACKAGE_DATA: if defined, GDAL and PROJ4 data files will be copied into the # source or binary distribution. This is essential when...
the-stack_106_20318
# Copyright 2017 Alethea Katherine Flowers # # 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...
the-stack_106_20321
############################################ # # Author: Luca Cinquini # ############################################ """ Abstract -------- The wps module of the OWSlib package provides client-side functionality for executing invocations to a remote Web Processing Server. Disclaimer ---------- PLEASE NOTE: the owsl...
the-stack_106_20322
#!/usr/bin/env python # -*- coding: utf-8 -*- # # This file is subject to the terms and conditions defined in # file 'LICENSE.md', which is part of this source code package. # from kubernetes_py.utils import is_valid_string class SubresourceReference(object): """ https://kubernetes.io/docs/api-reference/ext...
the-stack_106_20324
import matplotlib.pyplot as plt import numpy as np def show_inline(image, title=''): f, ax = plt.subplots(1, 1, figsize=(10,10)) ax.grid(False) ax.set_xticks([]) ax.set_yticks([]) ax.imshow(image) ax.set_title(title) plt.show() def get_patches(out, k, patch_size=36, random=False): im...
the-stack_106_20325
#!/usr/bin/env python3 import sqlite3 import sys from typing import List from time import time from clvm_rs import run_generator from clvm import KEYWORD_FROM_ATOM, KEYWORD_TO_ATOM from clvm.casts import int_from_bytes from clvm.operators import OP_REWRITE from chia.types.full_block import FullBlock from chia.types....
the-stack_106_20326
#!/usr/bin/env python3 """ logplot.py Usage: logplot.py [options] [-e=<regex>...] [<filename>...] logplot.py -h | --help logplot.py --version Options: -h --help Show this screen. --version Show version. -e=<regex> Pattern to match in ...
the-stack_106_20327
from collections import OrderedDict import copy import getpass import itertools import numpy as np from scipy import signal import time LOCAL_MODE = getpass.getuser() == 'tom' CONFIG = { 'halite_config_setting_divisor': 1.0, 'collect_smoothed_multiplier': 0.0, 'collect_actual_multiplier': 5.0, 'colle...
the-stack_106_20331
# Copyright: 2009 PathsScale # Copyright: 2010 Brian Harring <ferringb@gmail.com> # License: GPL2/BSD import time from snakeoil.data_source import text_data_source from snakeoil.osutils import pjoin, unlink_if_exists from snakeoil.process.spawn import spawn from pkgcore.fs import tar, fs, contents OPS = { '>=':...
the-stack_106_20332
# Copyright 2018 Xanadu Quantum Technologies 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 agre...
the-stack_106_20335
# Copyright (c) 2015, Ecole Polytechnique Federale de Lausanne, Blue Brain Project # All rights reserved. # # This file is part of NeuroM <https://github.com/BlueBrain/NeuroM> # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are ...
the-stack_106_20336
""" molecule.py A python package for the MolSSI Software Summer School. Contains a molecule class """ import numpy as np from .measure import calculate_angle, calculate_distance class Molecule: def __init__(self, name, symbols, coordinates): if isinstance(name, str): self.name = name ...