text stringlengths 1 927k |
|---|
# coding: utf-8
# Copyright (c) 2016, 2022, Oracle and/or its affiliates. All rights reserved.
# This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may c... |
import json
import logging
import urllib
from http.client import HTTPResponse
from ssl import SSLContext
from typing import Dict, Union, List, Optional
from urllib.error import HTTPError
from urllib.request import Request, urlopen, OpenerDirector, ProxyHandler, HTTPSHandler
from slack.errors import SlackRequestError
f... |
# Python - 3.6.0
reverseWords = lambda str: ' '.join(str.split()[::-1]) |
"""
.. See the NOTICE file distributed with this work for additional information
regarding copyright ownership.
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.... |
from time import sleep
import logging
from dapr.clients import DaprClient
logging.basicConfig(level=logging.INFO)
DAPR_STORE_NAME = "statestore"
for i in range(1, 10):
orderId = str(i)
order = {'orderId': orderId}
with DaprClient() as client:
# Save state into the state store
client.save_... |
"""
Django settings for thomasdevri_es project.
Generated by 'django-admin startproject' using Django 3.0.7.
For more information on this file, see
https://docs.djangoproject.com/en/3.0/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/3.0/ref/settings/
"""
impor... |
from __future__ import absolute_import
from __future__ import unicode_literals
from functools import reduce
import six
from .const import LABEL_CONTAINER_NUMBER
from .const import LABEL_SERVICE
class Container(object):
"""
Represents a Docker container, constructed from the output of
GET /containers/:i... |
import pulsar as psr
def load_ref_system():
""" Returns beta-l-lyxopyranose as found in the IQMol fragment library.
All credit to https://github.com/nutjunkie/IQmol
"""
return psr.make_system("""
C 1.4299 0.2461 0.7896
O 0.4230 1.0739 1.3901
C ... |
#######################################################
#
# ConnectHandler.py
# Python implementation of the Class ConnectHandler
# Generated by Enterprise Architect
# Created on: 29-Dec-2020 8:10:45 AM
# Original author: natha
#
#######################################################
from Catalog.Data.Federatio... |
import tensorflow as tf
from random import shuffle
import pandas as pd
import numpy as np
import imageio
import os
from detr_tf.data import processing
from detr_tf.data.transformation import detr_transform
from detr_tf import bbox
def morethan1(img, tbbox, tclass):
ret = False
print("morethan1 ", tbbox.shape... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
JS and CSS minification
============================
Author: Toni Heittola (toni.heittola@gmail.com)
This plugin will create dynamic datatable with charting features from given yaml-datafile.
"""
import os
import sys
import io
import argparse
import textwrap
from IPy... |
# -*- coding: utf-8 -*-
"""
author: John Bass
email: john.bobzwik@gmail.com
license: MIT
Please feel free to use and modify this, but keep the above information. Thanks!
adaptation
author: Tom Antoine and Alex Martinez
"""
import numpy as np
import matplotlib.pyplot as plt
import time
import cProfile
from trajectory i... |
import typing
from .qc_base import ParametersQC, QuantumChemistryBase
SUPPORTED_QCHEMISTRY_BACKENDS = ["base", "psi4"]
INSTALLED_QCHEMISTRY_BACKENDS = {"base": QuantumChemistryBase}
try:
from .psi4_interface import QuantumChemistryPsi4
INSTALLED_QCHEMISTRY_BACKENDS["psi4"] = QuantumChemistryPsi4
except Impo... |
# coding: utf-8
"""
Harbor API
These APIs provide services for manipulating Harbor project.
OpenAPI spec version: 1.4.0
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import os
import sys
sys.path.append(os.environ["SWAGGER_CLIENT_PATH"]... |
'''
Author: your name
Date: 2021-07-02 17:20:23
LastEditTime: 2021-07-08 16:28:05
LastEditors: Please set LastEditors
Description: In User Settings Edit
FilePath: /genetic-drawing/2.py
'''
#coding:utf-8
import cv2
import math
import numpy as np
def dodgeNaive(image, mask):
# determine the shape of the input im... |
# Generated by Django 2.1.15 on 2020-04-25 00:55
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('core', '0003_ingredients'),
]
operations = [
migrations.CreateModel(
... |
import pytest
from goji.util.network import get_host_addr
class TestNetwork:
@pytest.mark.asyncio
async def test_get_host_addr4(self):
# Run these tests forcing IPv4 resolution
prefer_ipv6 = False
assert get_host_addr("127.0.0.1", prefer_ipv6) == "127.0.0.1"
assert get_host_add... |
######################################################################
#
# File: test_session.py
#
# Copyright 2018 Backblaze Inc. All Rights Reserved.
#
# License https://www.backblaze.com/using_b2_code.html
#
######################################################################
from b2.exception import InvalidAuthT... |
# -*- coding: utf-8 -*-
'''
A few checks to make sure the environment is sane
'''
from __future__ import absolute_import
# Original Author: Jeff Schroeder <jeffschroeder@computer.org>
# Import python libs
import os
import re
import sys
import stat
import errno
import socket
import logging
# Import third party libs
i... |
import vaex
import vaex.ml
import tempfile
import vaex.ml.datasets
features = ['petal_length', 'petal_width', 'sepal_length', 'sepal_width']
def test_pca():
ds = vaex.ml.datasets.load_iris()
pca = vaex.ml.PCA(features=features, n_components=2)
pca.fit(ds)
ds1 = pca.transform(ds)
path = tempfile.m... |
__version__ = '1.0'
__author__ = 'Zachary Nowak'
"""STANDARD LIBRARY IMPORTS"""
from statistics import *
def create_dict(tupleList,pressCharTimeLine,pressTimeLine,dataDict):
keyHistory = ""
timingList = [[] for i in range(len(tupleList))]
"""CREATE A STRING WITH ALL THE EVENTS"""
for char in pressCharTimeLine:
... |
# coding=utf-8
# Copyright 2011 Foursquare Labs Inc. All Rights Reserved
from __future__ import (nested_scopes, generators, division, absolute_import, with_statement,
print_function, unicode_literals)
import unittest
from foursquare.source_code_analysis.scala.scala_unused_import_remover impor... |
# Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.
"""
Tests for positioning sentences.
"""
from __future__ import absolute_import, division
import itertools
from twisted.positioning import _sentence
from twisted.trial.unittest import TestCase
sentinelValueOne = "someStringValue"
sentinelValue... |
# Listing_22-8.py
# Copyright Warren & Csrter Sande, 2013
# Released under MIT license http://www.opensource.org/licenses/mit-license.php
# Version $version ----------------------------
# Hangman game using PyQt
import sys
from PyQt4 import QtCore, QtGui, uic
import random
form_class = uic.loadUiType("hangman.ui"... |
from abc import abstractmethod
from utils.utils import init_sess
class Gan:
def __init__(self):
self.oracle = None
self.generator = None
self.discriminator = None
self.gen_data_loader = None
self.dis_data_loader = None
self.oracle_data_loader = None
self.se... |
import time, copy
import os, os.path
import sys
import numpy
from PyQt4.QtCore import *
from PyQt4.QtGui import *
from scipy import optimize
from echem_plate_ui import *
from echem_plate_math import *
import pickle
p='C:/Users/Gregoire/Documents/CaltechWork/echemdrop/2012-9_FeCoNiTi/results/2012-9FeCoNiTi_500C_CAill_p... |
# chat/consumers.py
from channels.generic.websocket import AsyncWebsocketConsumer
import json
class ChatConsumer(AsyncWebsocketConsumer):
async def connect(self):
self.room_name = self.scope['url_route']['kwargs']['room_name']
self.room_group_name = 'chat_%s' % self.room_name
# Join room g... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
clever.py
Compute CLEVER score using collected Lipschitz constants
Copyright (C) 2017-2018, IBM Corp.
Copyright (C) 2017, Lily Weng <twweng@mit.edu>
and Huan Zhang <ecezhang@ucdavis.edu>
This program is licenced under the Apache 2.0 licence,
contain... |
from types import SimpleNamespace
class Segment_Tree:
'''
A Class used to get partial sum of an array and update data
...
Attributes
----------
array : list
a list which to make a segment tree
Methods
-------
init(tree, start, end, node)
make segment tree from the a... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
import os
import sp
import pp
import fp
import step2
import ts
def sensplit(_src):
return pp.sensplit(_src,pp.sendivs)
argv = sys.argv
if(len(argv) < 2):
print 'we need an arguement'
sys.exit(0)
filename = argv[1]
if(not os.path.isfile(filename)):
... |
from typing import Union
from pandas import Series
from datatypes.AbstractAttribute import AbstractAttribute
from datatypes.utils.DataType import DataType
class IntegerAttribute(AbstractAttribute):
def __init__(self, name: str, is_candidate_key, is_categorical, histogram_size: Union[int, str], data: Series):
... |
# coding=utf-8
# Copyright 2019 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... |
# Copyright 2019 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.
from __future__ import print_function
from __future__ import division
from __future__ import absolute_import
import contextlib
import logging
import os
impo... |
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
from ._criterion import Criterion, RegressionCriterion, MSE
from ._splitter import Splitter, BestSplitter
from ._tree import DepthFirstTreeBuilder
from ._tree import Tree
__all__ = ["Tree",
"Splitter",
... |
import nltk
import csv
import datetime
import pandas as pd
import matplotlib.pyplot as plt
import numpy as np
now = datetime.datetime.now()
today = now.strftime("%Y-%m-%d")
dInfoMoney = 'C:/Users/vitor/Documents/GetDataset/Infomoney/'
dInvesting = 'C:/Users/vitor/Documents/GetDataset/Investing.com/'
dTrading = 'C:/Us... |
# coding: utf-8
"""
Kubernetes
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
OpenAPI spec version: v1.12.4
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import sys
import os
i... |
# 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... |
from flask import Blueprint, jsonify
main_bp = Blueprint('main', __name__)
@main_bp.route('/')
def api_home():
return jsonify({"message": "Welcome to the Student Hub API"}) |
# 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, sof... |
from django.shortcuts import render, redirect
from django.views.generic.detail import DetailView
from .models import Fly,Airport
from django.db.models import Q
from django.contrib import messages
from django.contrib.auth.decorators import login_required
# Create your views here.
@login_required(login_url='/login/'... |
import uuid
from django.db import models
from django.urls import reverse
from core.models import (Authorable,
Titleable,
TimeStampedModel)
class Recipe(Authorable, Titleable, TimeStampedModel):
"""
Recipe model as of v.1.0.
"""
CATEGORY = (
(... |
from typing import List
from aiogram.types import KeyboardButton, ReplyKeyboardMarkup
from keyboards import emojis
from repository import Repository
PART_NAMES: List[str] = ["head", "story", "essence", "proofs", "claims", "additions"]
def get_claim_parts_kb(user_id: int) -> ReplyKeyboardMarkup:
parts_status: d... |
"""
##############################################################################
#
# Select top N distinct motifs with highest (statistically significant)
# activity Z-score (for every site separately)
#
# AUTHOR: Maciej_Bak
# AFFILIATION: University_of_Basel
# AFFILIATION: Swiss_Institute_of_Bioinformatics... |
#!/usr/bin/env python
import requests
from bs4 import BeautifulSoup
import sys
from twython import Twython
import numpy as np
apiKey = '...'
apiSecret = '...'
accessToken = '...'
accessTokenSecret = '...'
#BeautifulSoup scraping algorythm
url = 'https://coinmarketcap.com'
soup = BeautifulSoup(requests.get(url).text, ... |
"""
Assorted utilities for working with neural networks in AllenNLP.
"""
# pylint: disable=too-many-lines
from collections import defaultdict
from typing import Any, Dict, List, Optional, Sequence, Tuple, TypeVar
import logging
import math
import warnings
import torch
from allennlp.common.checks import ConfigurationE... |
#!/usr/bin/python
import subprocess
try:
from subprocess import DEVNULL # py3k
except ImportError:
import os
DEVNULL = open(os.devnull, 'wb')
version_path = "version.txt"
build_type = "rc"
with open(version_path, "r") as f:
version = f.readline()
build_number = 0
tag = "{0}-{1}.{2}".format(versio... |
import logging
import re
from PyCRC.CRC16 import CRC16
from dsmr_parser.objects import MBusObject, CosemObject
from dsmr_parser.exceptions import ParseContentError, InvalidChecksumError, NoChecksumError
logger = logging.getLogger(__name__)
class TelegramParser(object):
def __init__(self, telegram_specificatio... |
discord_extensions = (
"core.controllers.discord.delete",
"core.controllers.discord.join",
"core.controllers.discord.leave",
"core.controllers.discord.logout",
"core.controllers.discord.ping",
"core.controllers.discord.tts",
"core.controllers.discord.poll",
"core.controllers.discord.roul... |
"""
Retrain the YOLO model for your own dataset.
"""
import numpy as np
import keras.backend as K
from keras.layers import Input, Lambda
from keras.models import Model
from keras.optimizers import Adam
from keras.callbacks import TensorBoard, ModelCheckpoint, ReduceLROnPlateau, EarlyStopping
from yolo3.model import p... |
from .anomalies import AnomalyABC
from .labeler import AnomalySetLabeler
from .anomaly_generator import AnomalyGenerator
from .config import AnomalyGeneratorTemplate |
# stdlib
from typing import Dict
from typing import Optional
# third party
from google.protobuf.reflection import GeneratedProtocolMessageType
from nacl.signing import VerifyKey
# syft absolute
import syft as sy
# relative
from ..... import lib
from .....proto.core.node.common.action.get_enum_attribute_pb2 import (
... |
#!/usr/bin/env python
#-*- coding:utf-8 -*-
import os
import glob
##
from distutils.core import setup
import py2exe
assert py2exe != None
##
osp=os.path
windows = [
{
"script": "btn.py",
"icon_resources": [(1, "gui.ico")],
}
]
options = {
"py2exe": {
"includes": ["PyQt4", "sip"],
... |
from django import forms
from django.contrib.auth.forms import UserCreationForm
from django.contrib.auth.models import User
class SignUpForm(UserCreationForm):
"""Custom signup form with additional fields."""
first_name = forms.CharField(max_length=50, required=False,
help_te... |
#!/usr/bin/env python3
import time
import motion_detector
if __name__ == "__main__":
while True:
if motion_detector.motion_detect():
print("Somebody is closing")
else:
print("Nobody")
time.sleep(1) |
"""
Off Multipage Cheatsheet
https://github.com/daniellewisDL/streamlit-cheat-sheet
@daniellewisDL : https://github.com/daniellewisDL
"""
import streamlit as st
from pathlib import Path
import base64
from modules.toc import *
# Initial page config
st.set_page_config(
page_title='Code Compendium Intro Page',
... |
from waldur_core.core import WaldurExtension
class PlaybookJobsExtension(WaldurExtension):
class Settings:
WALDUR_PLAYBOOK_JOBS = {
'PLAYBOOKS_DIR_NAME': 'ansible_playbooks',
'PLAYBOOK_ICON_SIZE': (64, 64),
}
@staticmethod
def django_app():
return 'waldur_a... |
"""
PythonAEM error, contains a message and PythonAEM Result object
"""
class Error(RuntimeError):
"""
PythonAEM error, contains a message and PythonAEM Result object
useful for debugging the result and response when an error occurs
"""
def __init__(self, message, result):
"""
Ini... |
# Generated by Django 3.2.9 on 2021-11-25 10:37
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('run', '0014_run_duration'),
]
operations = [
migrations.AlterField(
model_name='run',
name='pipeline_command',
... |
# No restocks, only releases
import requests
from datetime import datetime
import json
from bs4 import BeautifulSoup
import urllib3
import time
import logging
import dotenv
from random_user_agent.user_agent import UserAgent
from random_user_agent.params import SoftwareName, HardwareType
from fp.fp import FreeProxy
log... |
#!/usr/bin/python
#
# run iperf to measure the effective throughput between two nodes when
# n nodes are connected to a virtual wlan; run test for testsec
# and repeat for minnodes <= n <= maxnodes with a step size of
# nodestep
from core import load_logging_config
from core.emulator.emudata import IpPrefixes
from core... |
"""
Generates a wheel (.whl) file from the output of makepanda.
Since the wheel requires special linking, this will only work if compiled with
the `--wheel` parameter.
Please keep this file work with Panda3D 1.9 until that reaches EOL.
"""
from __future__ import print_function, unicode_literals
from distutils.util im... |
#!/usr/bin/python3
import matplotlib.pyplot as plt
import numpy as np
def sigmoid(z):
return 1.0 / (1.0 + np.exp(-z))
z = np.arange(-7, 7, 0.01)
phi_z = sigmoid(z)
plt.plot(z, phi_z)
plt.axvline(0.0, color = 'k')
plt.axhspan(0.0, 1.0, facecolor = '1.0', alpha = 1.0, ls = 'dotted')
plt.axhline(0.5, ls = 'dotted... |
# Name: test_decoder.py
# Since: April 13th, 2020
# Author: Christen Ford
# Purpose: Implementes unit tests for simplejson.decoder.
from unittest import TestCase
import simplejson.decoder as decoder
import simplejson.errors as errors
class TestDecoder(TestCase):
"""Implements a set of unit tests for the simplej... |
# 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.
import os
import rospkg
import threading
import yaml
from copy import deepcopy
import message_filters
import numpy as np
import pyrobot.util a... |
#!/usr/bin/env python
'''Event constants from /usr/include/linux/input.h
'''
__docformat__ = 'restructuredtext'
__version__ = '$Id$'
EV_SYN = 0x00
EV_KEY = 0x01
EV_REL = 0x02
EV_ABS = 0x03
EV_MSC = 0x04
EV_LED = 0x11
EV_SND = 0x12
EV_REP = 0x14
EV_FF = 0x15
EV_PWR = 0x16
EV_FF_STATUS = 0x17
EV_MAX = 0x1f
# Synchro... |
monety = input("Podaj posiadane monety, dzieląc je przecinkiem: ")
monety = monety.replace(" ", "")
monety = monety.split(",")
monety = list(map(int, monety))
ilosc = len(monety)
reszta = int(input("Jaką reszte chcesz wydać? "))
licznik = 0
historia = []
while reszta > 0:
if licznik >= ilosc:
print("Nie ... |
from .. import BaseClient
class Client(BaseClient):
REQUIRES_AUTHENTICATION = False
def __init__(self, session):
super().__init__(session)
self._signin_aws = self.session().client('signin_aws')
self._signin_amazon = self.session().client('signin_amazon')
def signin(self, email, ... |
# -*- coding: utf-8 -*-
# Copyright (c) 2021, Baida and Contributors
# See license.txt
from __future__ import unicode_literals
# import frappe
import unittest
class TestBeneficiaryAidType(unittest.TestCase):
pass |
import os
import sys
try:
import cPickle as pickle
except ImportError:
import _pickle as pickle
import numpy as np
import tensorflow as tf
from tensorflow.examples.tutorials.mnist import input_data
def _read_data(data_path, train_files):
"""Reads CIFAR-10 format data. Always returns NHWC format.
Returns:
... |
"""
Collaborate with RestApiClient to make remote anonymous and authenticated calls.
Uses user_io to request user's login and password and obtain a token for calling authenticated
methods if receives AuthenticationException from RestApiClient.
Flow:
Directly invoke a REST method in RestApiClient, example: get_co... |
# -*- coding: utf-8 -*-
# @Author: Wenwen Yu
# @Created Time: 7/12/2020 9:50 PM
import os
import numpy as np
from numpy import inf
import torch
import torch.distributed as dist
from torch.nn.parallel import DistributedDataParallel as DDP
from src.utils import inf_loop
from src.utils.metrics import MetricTracker, Spa... |
from .core import *
from .cpotential import *
from .ccompositepotential import *
from .builtin import *
from .io import *
from .util import * |
import requests
from bs4 import BeautifulSoup
from logger_impl import *
import MongoDao
import pandas as pd
import time
payload = {'key': 'ac9e8cf2dec81949d9ee1235ed6ae3fb', 'url':
'https://httpbin.org/ip'}
def scrapData(scorecardSoup, matchId, matchDesc, matchTypeText, pageUrl, season, Date, venue):
#pageUrl ... |
# Copyright 2019 TerraPower, 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 writi... |
# coding=utf-8
# Copyright 2021 Intel Corporation. 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 ... |
from App.Config.app import settings
DATABASES = {
'default': 'mysql',
'mysql': {
'driver': 'mysql',
'host': settings.DB_HOST,
'port': settings.DB_PORT,
'database': settings.DB_DATABASE,
'user': settings.DB_USER,
'password': settings.DB_PASSWORD,
'prefix':... |
import random
import string
import json
from django.shortcuts import render, redirect, reverse
from django.urls.exceptions import NoReverseMatch
from django.contrib.auth import login, authenticate
from django.conf import settings
from django.views.decorators.http import require_http_methods
from django.http import Jso... |
#!/usr/bin/env python
# Info module template
#############################################
# WARNING #
#############################################
#
# This file is auto generated by
# https://github.com/jgroom33/vmware_rest_code_generator
#
# Do not edit this file manually.
#
# Ch... |
import errno
import fcntl
import logging
import os
import random
import struct
import ctypes
from elftools.elf.elffile import ELFFile
from ..utils.helpers import issymbolic
from ..core.cpu.abstractcpu import Interruption, Syscall, ConcretizeArgument
from ..core.cpu.cpufactory import CpuFactory
from ..core.memory impo... |
from fastapi import FastAPI
import logging
from .routers import routers
from .core.config import get_config, get_gunicorn_config
from .core.logger import setup_logger, StubbedGunicornLogger
import gunicorn.app.base
def createSimpleFastapi():
app = FastAPI()
app.include_router(routers.router)
return app
... |
try:
import networkx as nx
except ImportError:
from ..._shared.utils import warn
warn('RAGs require networkx')
import numpy as np
from . import _ncut
from . import _ncut_cy
from scipy.sparse import linalg
def cut_threshold(labels, rag, thresh, in_place=True):
"""Combine regions separated by weight les... |
import pytest
from meijer import __version__
from meijer import Meijer
@pytest.fixture(scope="session")
def meijer():
with Meijer() as m:
m.login()
yield m
@pytest.fixture(scope="session")
def shopping_list(meijer):
shopping_list = meijer.list
shopping_list.clear()
yield shopping_li... |
# Copyright (c) 2017-2021 Manfred Moitzi
# License: MIT License
import ezdxf
doc = ezdxf.new("R2018", setup=True)
modelspace = doc.modelspace()
modelspace.add_circle(
center=(0, 0),
radius=1.5,
dxfattribs={
"layer": "test",
"linetype": "DASHED",
},
)
filename = "circle_R2018.dxf"
doc.s... |
# ---
# jupyter:
# jupytext:
# formats: ipynb,py:percent
# text_representation:
# extension: .py
# format_name: percent
# format_version: '1.2'
# jupytext_version: 1.1.3
# kernelspec:
# display_name: Python 3
# language: python
# name: python3
# ---
# %% [markdown]
# # D... |
with open('C:\\Python Practice\\MyProjects01\\MyProjects01\\20180609\\poem_01.txt') as f:
for k in f.readlines():
print(k.strip().split()) |
#!/usr/bin/env python3
import argparse
import logging
from pathlib import Path
import sys
from typing import List
from typing import Optional
from typing import Sequence
from typing import Tuple
from typing import Union
import humanfriendly
import numpy as np
import torch
from tqdm import trange
from typeguard import ... |
import unittest
import os
import sys
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
import time
import xmlrunner
import ElasTestBase
class TestWebApp(ElasTestBase.ElasTestBase):
def test_check_tit... |
## @author Jared Adolf-Bryfogle (jadolfbr@gmail.com)
#Python Imports
import copy
import pandas
import re, logging
from collections import defaultdict
from typing import Union, DefaultDict, List, Any, Dict
from pathlib import Path
from jade2.basic.path import *
class PythonPDB2:
def __init__(self, pdb_file_path: ... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Note: To use the 'upload' functionality of this file, you must:
# $ pip install twine
"""Based on https://github.com/kennethreitz/setup.py"""
import io
import os
import sys
from shutil import rmtree
from setuptools import... |
# Copyright 2017 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 applicab... |
# Comment it before submitting
# class Node:
# def __init__(self, value, next_item=None):
# self.value = value
# self.next_item = next_item
def solution(node, idx):
# Your code
# ヽ(´▽`)/
pass
def test():
node3 = Node("node3", None)
node2 = Node("node2", node3)
node1 ... |
import pytest
from zentropi import Agent
from zentropi import Frame
from zentropi.transport import datagram
class MockDatagram(object):
def __init__(self, login_ok=True, send_ok=True, recv_ok=True):
self._login_ok = login_ok
self._send_ok = send_ok
self._recv_ok = recv_ok
self.fra... |
from keras.layers import Input, Dense, concatenate
from keras.layers.recurrent import GRU
from keras.utils import plot_model
from keras.models import Model, load_model
from keras.callbacks import ModelCheckpoint
import keras
import pandas as pd
import numpy as np
import keras.backend as K
from keras.utils import to_cat... |
# This is the object-based adapter pattern
# It allows us to take an outside class 'StrangeCreature' with a different interface,
# and squeeze that SOB into another hierachy.
# The good thing about the object version of this pattern is that if StrangeCreature had
# a lot of subtypes, we would not need to write an adapt... |
from tests.helpers import create_ctfd, destroy_ctfd, login_as_user
def test_previewing_pages_works():
"""Test that pages can be previewed properly"""
app = create_ctfd()
with app.app_context():
client = login_as_user(app, name="admin", password="password")
with client.session_transaction(... |
#!/usr/bin/env python
# coding: utf-8
# In[1]:
from model_inference import do_inference
# In[ ]:
from modules.Facebook_AF_model_v25 import ArgsT25_NfNetl1_ImageNet, FacebookModel
ckpt_filename = './checkpoints/smp_test25/FacebookModel_epoch=16_trn_loss_epoch=0.9023_trn_acc_epoch=0.0000_val_loss_epoch=0.4303_val_... |
"""
Revision ID: 0221_nullable_service_branding
Revises: 0220_email_brand_type_non_null
Create Date: 2018-08-24 13:36:49.346156
"""
from alembic import op
from app.models import BRANDING_ORG, BRANDING_GOVUK
revision = '0221_nullable_service_branding'
down_revision = '0220_email_brand_type_non_null'
def upgrade():... |
#!/usr/bin/env python3
"""Compute and check message digest with different hash algorithms.
The sums are computed as described in [1].
When checking, the input should be a former output of this program.
The default mode is to print a line with checksum, a character indicating
input mode ('*' for binary, space for text... |
##########################################################################
#
# Copyright (c) 2011-2012, John Haddon. All rights reserved.
# Copyright (c) 2011-2013, Image Engine Design Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted prov... |
default_app_config = 'enrichmentmanager.apps.EnrichmentManagerConfig' |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.