text stringlengths 2 999k |
|---|
#Create a program that will play the “cows and bulls” game with the user. The game works like this:
#Randomly generate a 4-digit number. Ask the user to guess a 4-digit number. For every digit that the user
# guessed correctly in the correct place, they have a “cow”. For every digit the user guessed correctly in the
#... |
print("The following are the safety measures we should take against the new COVID-19 virus: ")
print("We all should wash our hands frequently")
print("We all should maintain social distancing")
print("We all should avoid touching nose, eyes and mouth")
print("Seek medical care urgently if you have fever, cough and diff... |
import pytest
from plenum.test.helper import checkViewNoForNodes, waitForViewChange, sdk_send_random_and_check
from plenum.test.node_catchup.helper import ensure_all_nodes_have_same_data
from plenum.test.node_request.helper import sdk_ensure_pool_functional
from plenum.test.test_node import ensureElectionsDone
from so... |
from scipy import stats
from sklearn.svm import SVR
from sklearn.linear_model import LinearRegression
import os
import random
import sys
import csv
import numpy as np
import pandas as pd
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.utils.data import TensorDataset, DataLoader, RandomSamp... |
#!/usr/bin/env python
import os
import json
import codecs
import base64
from copy import copy
from lulu import config
from lulu.util import fs
from lulu.extractor import SimpleExtractor
from lulu.common import (
r1,
match1,
url_info,
print_info,
get_content,
post_content,
get_location,
... |
import copy
from gtfspy.routing.label import compute_pareto_front
from gtfspy.routing.node_profile_analyzer_time import NodeProfileAnalyzerTime
from gtfspy.routing.profile_block_analyzer import ProfileBlockAnalyzer
from gtfspy.routing.profile_block import ProfileBlock
class FastestPathAnalyzer:
def __init__(sel... |
import numpy as nm
from sfepy.linalg import dot_sequences
from sfepy.homogenization.utils import iter_sym
from sfepy.terms.terms import Term, terms
from sfepy.terms.terms_th import THTerm, ETHTerm
## expr = """
## e = 1/2 * (grad( vec( u ) ) + grad( vec( u ) ).T)
## D = map( D_sym )
## s = D * e
## div( s )
## """
#... |
# coding: utf-8
#
# Copyright 2014 The Oppia 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 requi... |
class EventLogPermissionAttribute(CodeAccessSecurityAttribute,_Attribute):
"""
Allows declaritive permission checks for event logging.
EventLogPermissionAttribute(action: SecurityAction)
"""
def CreatePermission(self):
"""
CreatePermission(self: EventLogPermissionAttribute) -> IPermission
... |
"""
ProjetPythonFirstYear - Petit jeu de labyrinthe python/turtle
Auteur: Alexandre T.
Date: 18/05/2021
Rôle : main.py est le programme principal qui lance le jeu
Entrée: Import du sous programme s'occupant des déplacement du personnage
"""
from Deplacement import *
listen() #Fonction permettant d'atten... |
import inspect
from abc import ABCMeta, abstractmethod
from logging import Logger
from typing import Callable, Optional, Any, Dict
from slack_bolt.kwargs_injection.utils import build_required_kwargs
from slack_bolt.request.request import BoltRequest
from slack_bolt.response.response import BoltResponse
class Middlew... |
import insightconnect_plugin_runtime
from .schema import CalculateInput, CalculateOutput, Input, Output, Component
# Custom imports below
from insightconnect_plugin_runtime.exceptions import PluginException
import ipcalc
import validators
class Calculate(insightconnect_plugin_runtime.Action):
def __init__(self):... |
import importlib.machinery
import inspect
import linecache
import os
import pathlib
import sys
import traceback
from typing import AnyStr, Any, Callable, Tuple, TypeVar, Union
import nbformat
from ..config import load_config
from ..exporter import LiteraryPythonExporter
class NotebookLoader(importlib.machinery.Sour... |
import pytest
from graphene import Node
from saleor.checkout import calculations
from saleor.checkout.utils import add_variant_to_checkout
from saleor.payment import ChargeStatus, TransactionKind
from saleor.payment.models import Payment
from tests.api.utils import get_graphql_content
@pytest.fixture()
def checkout_... |
#!/usr/bin/env python
"""
Find alternative team names for all the teams in the 2018/19 FPL.
"""
import json
from fuzzywuzzy import fuzz
from airsenal.framework.data_fetcher import FPLDataFetcher
def find_best_match(fpl_teams, team):
"""
use fuzzy matching to see if we can match
names
"""
best_... |
import os
import pytest
from mp_api.routes.charge_density.client import ChargeDensityRester
import inspect
import typing
resters = [ChargeDensityRester()]
excluded_params = [
"sort_fields",
"chunk_size",
"num_chunks",
"all_fields",
"fields",
]
sub_doc_fields = [] # type: list
alt_name_dict = {... |
from six import iteritems
import json
import os
import multiprocessing
import numpy as np
import random
class file_data_loader:
def __next__(self):
raise NotImplementedError
def next(self):
return self.__next__()
def next_batch(self, batch_size):
raise NotImplementedError
cl... |
'''
Copyright 2020 Flexera Software LLC
See LICENSE.TXT for full license text
SPDX-License-Identifier: MIT
Author : sgeary
Created On : Fri Aug 07 2020
File : create_report.py
'''
import sys
import logging
import argparse
import zipfile
import os
import json
from datetime import datetime
import re
import _version
... |
# Copyright 2015 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 applica... |
from page_objects.exercises.po_exercise_1 import *
def test_positive(driver):
set_driver(driver)
open_page()
click_button1()
click_button2()
click_button1()
click_check_soluition()
assert get_trail_text() == Config.TEST_PASS_TEXT
def test_negative(driver):
set_driver(driver)
op... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
import requests
import json
import os
import sys
import csv
from pySmartDL import SmartDL
from shapely.geometry import shape
from planet.api.auth import find_api_key
os.chdir(os.path.dirname(os.path.realpath(__file__)))
planethome = os.path.dirname(os.path.realpath(__file__))
... |
from __future__ import print_function
__all__ = ["BrowseTag", "OPCBrowseTag"]
from java.lang import Object
class BrowseTag(Object):
def __init__(
self,
name=None,
path=None,
fullPath=None,
type=None,
valueSource=None,
dataType=None,
):
self.nam... |
# Main program - Version 1
# This is an example of how to use the library turboGen.py
# and cmpspec.py
# GENERATING 1D-2D-3D GAUSSIAN STOCHASTIC FIELD WITH A GIVEN POWER SPECTRUM AS INPUT
"""
Author: Stefano Merlini
Created: 14/05/2020
"""
# ____ _ _ __ _ _ ____ __ ____
# ( __)( \/ ) / _\ ( \/ )( _ \... |
import os
import copy
import collections
import warnings
import logging
import inspect
from collections import OrderedDict
from six.moves import configparser
import numpy as np
import tensorflow as tf
class _SettingsContextManager(object):
def __init__(self, manager, tmp_settings):
self._manager = mana... |
# coding: utf-8
import pprint
import re
import six
class UpdateRuleActionRequest:
"""
Attributes:
openapi_types (dict): The key is attribute name
and the value is attribute type.
attribute_map (dict): The key is attribute name
and the ... |
# 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 use ... |
import numpy as np
for i in range(40):
print(
np.floor(i / 4).astype(int)) |
import re
WORD = re.compile(r'\w+')
def tokenize(text):
"""
this function tokenizes text at a very high speed
:param str text: text to be tokenized
:rtype: list[str]
"""
words = WORD.findall(text)
return words
|
value = 1
<caret>if value < 1:
print("Less")
else:
print("Greater or equal") |
# Copyright 2016 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 applica... |
# 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 gc
import itertools
import logging
import os
import socket
import time
from typing import Any, Dict, List, Tuple
import numpy as np
imp... |
#!/usr/bin/env python
#-------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#----------------------------------------------------------------... |
import numpy as np
from .utils.diversifier import kmeanspp
from .utils.ops import cosine_similarity, softmax, divsum
from .graphs.nearestneighbors import NearestNeighbors
class QuickRecommender:
"""
QuickRecommender
Creates a content-based model using a nearest-neighbors graph, updates user-preferences
... |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2019 CERN.
#
# System Fields Test is free software; you can redistribute it and/or modify
# it under the terms of the MIT License; see LICENSE file for more details.
"""Record serializers."""
from __future__ import absolute_import, print_function
from invenio_records_rest.se... |
"""
Automated semblance velocity picking with dynamic programming
@author Andrew Munoz, CSM
"""
from bputils import *
from imports import *
papers=False
slides=False
setvis=True
if papers:
pngDir = "/Users/amunoz/Home/pics/sem/p_"
elif slides:
pngDir = "/Users/amunoz/Home/pics/sem/s_"
# cmp number -803 (SP1 and... |
# pylint: disable=protected-access,exec-used
import math
import os
import re
import json
import tempfile
from typing import List, Tuple, Callable, BinaryIO, Optional
from abc import ABC, abstractmethod
from . import Type, Value, Expr, Env, Error
from ._util import byte_size_units, chmod_R_plus
class Base:
"""
... |
import numpy as np
import emcee
import sys
import os
from os.path import join as osjoin
from pc_path import definir_path
path_git, path_datos_global = definir_path()
os.chdir(path_git)
sys.path.append('./Software/Funcionales/')
from funciones_parametros_derivados import parametros_derivados
#Rellenar acá:
model='EXP'
... |
#coding:utf-8
#
# id: bugs.core_5273
# title: Crash when attempt to create database with running trace ( internal Firebird consistency check (cannot find tip page (165), file: tra.cpp line: 2233) )
# decription:
# 1. Get the content of firebird.log before test.
# ... |
# Copyright 2021 Alexis Lopez Zubieta
#
# 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 the
# rights to use, copy, modify, merge, publi... |
from tkinter import *
from Switch import encrypt_input
window = Tk()
def encrypt():
text = encrypt_input(txt1.get())
txt1.delete(0, "end")
txt1.insert(0, str(text))
v = ""
window.title("SwapEncryptor")
lbl1 = Label(window, text="Enter text")
txt1 = Entry(window, width=30, textvariable=v)
btn1 = Button(win... |
def sum(n,x):
total = 0
for i in range(1, n+1):
total = total + (1 / x)**i
return total
x = int(input())
n = int(input())
print(round(sum(x, n),2))
def solutionRec(n,x):
if n == 1:
return 1/x
else:
return (1/x)**n + solutionRec(n-1,x)
print(roun... |
import math
import torch
import torch.nn as nn
from mmcv.cnn import ConvModule, DepthwiseSeparableConvModule
from mmseg.ops import resize
from ..builder import HEADS
from .aspp_head import ASPPHead, ASPPModule
def get_freq_indices(method):
assert method in ['top1','top2','top4','top8','top16','top32',
... |
import functools
import flux
from flask import g
from flask_security import current_user
def updates_last_active(func):
from . import models
@functools.wraps(func)
def new_func(*args, **kwargs):
if hasattr(g, 'token_user'):
u = g.token_user
elif current_user.is_authenticate... |
from .model.model import Model
from .aggregator.aggregator import Aggregator
class Ensemble(object):
def __init__(self):
self.models = []
self.aggregator = None
def add_models(self, models):
for model in models:
self.add_model(model)
def add_model(self, model):
... |
# Copyright 2020 Alibaba Group Holding Limited. 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 ... |
# -*- coding: utf-8 -*-
"""
File defining the global variables used in the main program
and all subfunctions.
"""
# --------------------------------------------------------
# --------------------- USER NAMELIST --------------------
# --------------------------------------------------------
# Output control
#---------... |
from chill import *
source('/uufs/chpc.utah.edu/common/home/u1142914/lib/ytopt_vinu/polybench/polybench-code/stencils/heat-3d/kernel.c')
destination('/uufs/chpc.utah.edu/common/home/u1142914/lib/ytopt_vinu/experiments/heat-3d_chill_openmp/tmp_files/7096.c')
procedure('kernel_heat_3d')
loop(0)
known('n>3')
pragma(0,2,"... |
import tensorflow as tf
# 声明两个变量并计算他们的和
v1 = tf.Variable(tf.constant(1.0, shape=[1]), name='v1')
v2 = tf.Variable(tf.constant(2.0, shape=[1]), name='v2')
result = v1 + v2
init_op = tf.global_variables_initializer()
# 声明tf.train.Saver类用于保存模型
saver = tf.train.Saver()
with tf.Session() as sess:
sess.run(init_op)
... |
# ----------------------------------------------------------------------------------
# Electrum plugin for the Digital Bitbox hardware wallet by Shift Devices AG
# digitalbitbox.com
#
import base64
import binascii
import hashlib
import hmac
import json
import math
import os
import re
import struct
import sys
import ti... |
# -*- coding: utf-8 -*-
from .basetypes import WidgetParameterItem, SimpleParameter
from ...Qt import QtCore
from ...colormap import ColorMap
from ...widgets.GradientWidget import GradientWidget
class ColorMapParameterItem(WidgetParameterItem):
"""Registered parameter type which displays a :class:`GradientWidget ... |
#!/usr/bin/python3
"""Test BaseModel for expected behavior and documentation"""
from datetime import datetime
import inspect
import models
import pep8 as pycodestyle
import time
import unittest
from unittest import mock
BaseModel = models.base_model.BaseModel
module_doc = models.base_model.__doc__
class TestBaseModel... |
# coding: utf-8
"""
Copyright 2016 SmartBear Software
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... |
import argparse
from myo_sign_language.data_saver.myo_connector import run as myo_listen
from myo_sign_language.data_saver.recorder import run as run_recording
default_port = 3002
def check_positive_integer(value):
ivalue = int(value)
if ivalue <= 0:
raise argparse.ArgumentTypeError("%s is an invalid... |
import json
import httplib
def user_request(access_token):
method = "GET"
endpoint = "api.github.com"
url = "/user"
headers = {
"Authorization": "token " + access_token, # https://developer.github.com/v3/#oauth2-token-sent-in-a-header
"Content-Type": "application/json",
"User-... |
# Copyright (c) 2014 Mirantis 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 writing, so... |
# coding: utf-8
"""
Gitea API.
This documentation describes the Gitea API. # noqa: E501
OpenAPI spec version: 1.16.7
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
import pprint
import re # noqa: F401
import six
class StopWatch(object):
"""NOTE: This class is auto ... |
from .erd_cycle_state import ErdCycleState, ErdCycleStateRaw
CYCLE_STATE_RAW_MAP = {
ErdCycleStateRaw.PREWASH: ErdCycleState.PRE_WASH,
ErdCycleStateRaw.PREWASH1: ErdCycleState.PRE_WASH,
ErdCycleStateRaw.AUTO_HOT_START1: ErdCycleState.PRE_WASH,
ErdCycleStateRaw.AUTO_HOT_START2: ErdCycleState.PRE_WASH,
... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import absolute_import, print_function
import argparse
import imp
import logging
import sys
import six
from lxml import etree
from . import namespaces as ns, xsd
from .py2xsd import generate_xsdspec
from .soap import SOAP_HTTP_Transport
from .utils impor... |
''' Program to connect with database and store record of employee and display records.
'''
from sqlTor import SqlTor
import mysql.connector
from mysql.connector import errorcode
from tabulate import tabulate
from utils import clear_screen
def input_employee_details():
while True:
try:
name = ... |
# coding=utf-8
import threading
import traceback
from config import redis
from dark_listener import BaseListener
from dark_listener.BaseOperation import validate
from dark_listener.ListenerManagerLauncher import listener_manager_launcher
from lib.Logger import log
rlock = threading.RLock()
def lock(func):
def w... |
import sys as _sys
from loguru import logger
from tqdm import tqdm as _tqdm
_sys.stdout.reconfigure(encoding='utf-8', errors='backslashreplace')
logger.remove() # removes the default console logger provided by Loguru.
# I find it to be too noisy with details more appropriate for file logging.
# INFO and messages of ... |
from sqlalchemy import ForeignKey
from sqlalchemy import Integer
from sqlalchemy import MetaData
from sqlalchemy import String
from sqlalchemy import testing
from sqlalchemy.ext.orderinglist import ordering_list
from sqlalchemy.orm import clear_mappers
from sqlalchemy.orm import relationship
from sqlalchemy.testing imp... |
#!/usr/bin/python2
'''
=== PREREQUISITES ===
Run in Python 2
Install requests library, via macOS terminal:
sudo pip install requests
=== DESCRIPTION ===
This script finds all MS switchports that match the input search parameter, searching either by clients from a file listing MAC addresses (one per line), a specific... |
import os
import csv
import numpy as np
import re
from tensorflow.keras.models import load_model
from tensorflow.keras.preprocessing.text import Tokenizer
from tensorflow.keras.utils import to_categorical
import tensorflow as tf
from deepac.utils import set_mem_growth
from Bio import SeqIO
from shap import DeepExpla... |
# Copyright 2018 The TensorFlow Probability 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 o... |
# Copyright (c) OpenMMLab. All rights reserved.
import torch
from mmdeploy.codebase.mmdet import get_post_processing_params, multiclass_nms
from mmdeploy.core import FUNCTION_REWRITER
@FUNCTION_REWRITER.register_rewriter(
func_name='mmdet.models.YOLOXHead.get_bboxes')
def yolox_head__get_bboxes(ctx,
... |
#!/usr/bin/python3
import os
import numpy as np
import argparse
if __name__ == "__main__":
parser = argparse.ArgumentParser(description='Process some integers.')
parser.add_argument('--disparity', type=str,
help='Input x-disparity map', required=True)
parser.add_argument('--ground_... |
# -*- coding: utf-8 -*-
translations = {
# Days
'days': {
0: 'Sondag',
1: 'Maandag',
2: 'Dinsdag',
3: 'Woensdag',
4: 'Donderdag',
5: 'Vrydag',
6: 'Saterdag'
},
'days_abbrev': {
0: 'Son',
1: 'Maa',
2: 'Din',
3: 'Woe'... |
import os
import time
import numpy as np
import pandas as pd
from importlib import reload
import pyscf
from pyscf import __config__
from pyscf.pbc import tools
ALLOWED_ENGINES = ["FFTW", "NUMPY", "NUMPY+BLAS", "BLAS"]
def bench_fft_engine(method: str, mesh_size: int):
# Check inputs (in case this is used as so... |
#!/usr/bin/env python
# coding: utf-8
# In[4]:
# 외부 모듈 socket 사용함으로 설치해줄 것
# 다른 버전의 PYthon 작동은 확인 안 해봄
import socket
Receive_Buffersize = 4096
def ipcheck():
return socket.gethostbyname(socket.getfqdn())
class TcpNet:
def __init__(self): # 생성자
self.com_socket=socket.socket() # 소켓객체생성
self.C... |
# -*- coding: utf-8 -*-
# File: varreplace.py
# Credit: Qinyao He
from contextlib import contextmanager
import tensorflow as tf
from .common import get_tf_version_tuple
__all__ = ['custom_getter_scope', 'freeze_variables', 'remap_variables']
@contextmanager
def custom_getter_scope(custom_getter):
"""
Args:... |
import torch
import numpy as np
import torch.nn as nn
import time
import logging
from torch.autograd import Variable
from utils import mask_softmax
def _concat(xs, idx = None):
if idx == None:
return torch.cat([x.view(-1) for x in xs])
else:
return torch.cat([x.view(-1) for i, x in enumerate(xs) if i in id... |
from picamera import PiCamera
from time import sleep
import warnings
warnings.filterwarnings('default', category=DeprecationWarning)
camera = PiCamera()
camera.rotation = 180
# Capturing image to stream: https://picamera.readthedocs.io/en/release-1.13/recipes1.html
# Photo
camera.resolution = (3280, 2464)
sleep(2)... |
from poetry import packages as poetry_pkg
def python_dependency_from_pep_508(name):
dep = poetry_pkg.dependency_from_pep_508(name)
dep._name = f"pypkg-{dep.name}"
dep._pretty_name = f"pypkg-{dep.pretty_name}"
return dep
|
# pylint: disable=wrong-import-position
"""
The ``mlflow`` module provides a high-level "fluent" API for starting and managing MLflow runs.
For example:
.. code:: python
import mlflow
mlflow.start_run()
mlflow.log_param("my", "param")
mlflow.log_metric("score", 100)
mlflow.end_run()
You can also... |
# -*- coding:utf-8 -*-
# /usr/bin/env python
"""
Date: 2021/5/4 15:12
Desc: 东方财富网-数据中心-研究报告-盈利预测
http://data.eastmoney.com/report/profitforecast.jshtml
"""
from datetime import datetime
import pandas as pd
import requests
from tqdm import tqdm
def stock_profit_forecast():
"""
东方财富网-数据中心-研究报告-盈利预测
http://... |
from twisted.trial import unittest
from axiom import store
from xmantissa import ixmantissa, endpoint
class MantissaQ2Q(unittest.TestCase):
def testInstallation(self):
d = self.mktemp()
s = store.Store(unicode(d))
q = endpoint.UniversalEndpointService(store=s)
q.installOn(s)
... |
"""SMTP/ESMTP client class.
This should follow RFC 821 (SMTP), RFC 1869 (ESMTP), RFC 2554 (SMTP
Authentication) and RFC 2487 (Secure SMTP over TLS).
Notes:
Please remember, when doing ESMTP, that the names of the SMTP service
extensions are NOT the same thing as the option keywords for the RCPT
and MAIL commands!
E... |
""" Q_BRIDGE_MIB
The VLAN Bridge MIB module for managing Virtual Bridged
Local Area Networks, as defined by IEEE 802.1Q\-2003,
including Restricted Vlan Registration defined by
IEEE 802.1u\-2001 and Vlan Classification defined by
IEEE 802.1v\-2001.
Copyright (C) The Internet Society (2006). This version of
this MIB... |
from argparse import ArgumentParser
from sftp import SpanPredictor
parser = ArgumentParser('predict spans')
parser.add_argument(
'-m', help='model path', type=str, default='https://gqin.top/sftp-fn'
)
args = parser.parse_args()
# Specify the path to the model and the device that the model resides.
# Here we us... |
from rest_framework import viewsets
from . import models, serializers
class UserViewSet(viewsets.ModelViewSet):
queryset = models.User.objects.all()
serializer_class = serializers.UserSerializer
|
#!/usr/bin/python
import ospray
from ospray import *
def main() :
imgSize = [1024,768]
## camera
cam_pos = [0, 0, 0]
cam_up = [0, 1, 0]
cam_view = [0.1, 0, 1]
## triangle mesh data
vertex = [
-1.0, -1.0, 3.0, 0,
-1.0, 1.0, 3.0, 0,
1.0, -1.0, 3.0, 0,
... |
from app.models import Comment,User
from app import db
import unittest
class CommentTest(unittest.TestCase):
'''
Test Class to test the behaviour of the Pitch class
'''
def setUp(self):
self.user_Dunco = User(username = 'Dunco',password = 'dunco', email = 'aruncodunco@gmail.com')
self.n... |
# pylint: disable=W0401,W0611,W0231
"""
More info: http://docs.jasminsms.com/en/latest/interception/index.html
"""
from jasmin.routing.Filters import Filter
from jasmin.routing.Routables import Routable
from jasmin.routing.jasminApi import *
class InvalidInterceptorParameterError(Exception):
"""Raised when a par... |
# Copyright 2022 MosaicML Composer authors
# SPDX-License-Identifier: Apache-2.0
"""Core Exponential Moving Average (EMA) classes and functions."""
from __future__ import annotations
import copy
import itertools
import logging
from typing import Any, Dict, List, Optional, Union
import torch
from composer.core impo... |
import cv2
import glob #library that look for a list of files on the filesystem with names matching a pattern - template images
original_resized = cv2.imread('../Images/corner1.png') #captured image, got from the camera
original = cv2.resize(original_resized,(75, 110))
all_templates = [] #array to store template ima... |
import os
import sys
from setuptools import setup, find_packages
from tethys_apps.app_installation import custom_develop_command, custom_install_command
### Apps Definition ###
app_package = 'ucar_hydrologic_forecasts'
release_package = 'tethysapp-' + app_package
app_class = 'ucar_hydrologic_forecasts.app:UcarHydrolog... |
from __future__ import annotations
import os
from collections.abc import Callable
from typing import Any, ClassVar, Generic, TypeVar
import attr
from flask import current_app
from loguru import logger
from PIL import Image
from .. import redisw
from ..constants import COUNT_KEY
from ..utils import get_size, natsize
... |
#
# Copyright (c) 2013 Juniper Networks, Inc. All rights reserved.
#
import uuid
import gevent
import gevent.event
import gevent.monkey
gevent.monkey.patch_all()
import requests
import copy
from cStringIO import StringIO
import bottle
import logging
import logging.handlers
from datetime import datetime
import Queue
im... |
# porcelain.py -- Porcelain-like layer on top of Dulwich
# Copyright (C) 2013 Jelmer Vernooij <jelmer@samba.org>
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# or (at your ... |
#!/usr/bin/env python2
"""
builtin_process.py - Builtins that deal with processes or modify process state.
This is sort of the opposite of builtin_pure.py.
"""
from __future__ import print_function
import signal # for calculating numbers
from _devbuild.gen import arg_types
from _devbuild.gen.runtime_asdl import (
... |
import requests
import os
import json
from Jumpscale import j
JSConfigBase = j.application.JSBaseConfigClass
class ApiError(Exception):
def __init__(self, response):
message = None
msg = "%s %s" % (response.status_code, response.reason)
try:
message = response.json()
e... |
from __future__ import annotations
import json
import pickle
import matplotlib.pyplot as plt
import numpy as np
from datetime import datetime
from pathlib import Path
import os
from srim import Ion, Layer, Target # , output
from srim.srim import TRIM
from srim.output import Results
from concurrent.futures import as_c... |
# 日本語クラスをインポートし、nlpオブジェクトを作成
from ____ import ____
nlp = ____
# テキストを処理
doc = ____("私はツリーカンガルーとイルカが好きです。")
# 最初のトークンを選択
first_token = doc[____]
# 最初のトークンのテキストをプリント
print(first_token.____)
|
import pandas as pd
import numpy as np
import sys
import utils
import config
def gen_train_sample(df):
df['target'] = (df['reference'] == df['impressions']).astype(int)
df.drop(['current_filters','reference','action_type'],axis=1,inplace=True)
df_session = df[['session_id','step']].drop_duplicates(subset='s... |
# -*- coding: utf-8 -*-
# Author: Óscar Nájera
# License: 3-clause BSD
"""
Link resolver objects
=====================
"""
import codecs
import gzip
from io import BytesIO
import os
import pickle
import posixpath
import re
import shelve
import sys
import urllib.request as urllib_request
import urllib.parse as urllib_p... |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.11 on 2019-06-27 16:28
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
('orders', '0001_initial'),
]
o... |
# Copyright (c) 2012-2014, Michael DeHaan <michael.dehaan@gmail.com>
# Copyright (c) 2017, Toshio Kuratomi <tkuraotmi@ansible.com>
# Copyright (c) 2020, Ansible Project
# 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_f... |
# Given a DNA string s of length at most 1000 bp
# Return the reverse complement s^c of s
import sys
def main():
with open(sys.argv[1]) as fs:
dna = fs.read()
complements = {'A': 'T', 'C': 'G', 'T': 'A', 'G': 'C'}
reverse = dna[::-1]
reverse = reverse.lstrip()
reverseComplement = ''
... |
BLOG_ITEMS_PER_PAGE = 'BLOG_ITEMS_PER_PAGE'
ATTRIBUTE_WEBSITE_TITLE = 'ATTRIBUTE_WEBSITE_TITLE'
COVER_LETTER = 'COVER_LETTER'
ATTRIBUTE_WEBSITE_KEYWORDS = 'ATTRIBUTE_WEBSITE_KEYWORDS'
ATTRIBUTE_DESCRIPTION = 'ATTRIBUTE_DESCRIPTION'
ATTRIBUTE_JOB_POSITION = 'ATTRIBUTE_JOB_POSITION'
ATTRIBUTE_NAME = 'ATTRIBUTE_NAME'
ATTR... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.