text stringlengths 2 999k |
|---|
#!/usr/bin/env python
"""Django's command-line utility for administrative tasks."""
import os
import sys
def main():
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "geekshop.settings")
try:
from django.core.management import execute_from_command_line
except ImportError as exc:
raise Impor... |
"""
OpenVINO DL Workbench
Class for creation job for creating and exporting inference report
Copyright (c) 2020 Intel Corporation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://... |
import sys
class KaffeError(Exception):
pass
def print_stderr(msg):
sys.stderr.write('%s\n' % msg)
|
# 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 or agreed to in writing,... |
from chainer.backends import cuda
from chainer import function_node
from chainer.utils import type_check
class Copy(function_node.FunctionNode):
"""Copies the input variable onto the specified device."""
def __init__(self, out_device):
self.out_device = out_device
def check_type_forward(self, i... |
# Copyright 2017 Rice University
#
# 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 writin... |
from datetime import date
from flask_wtf import FlaskForm
from wtforms import StringField
class ProducaoFinalizadasForm(FlaskForm):
nome = StringField('Nome:')
data_comeco = StringField('Data de início:')
data_coleta = StringField('Data de coleta:') |
# coding: utf-8
"""
Automox Console API
API for use with the Automox Console # noqa: E501
OpenAPI spec version: 2021-11-16
Contact: support@automox.com
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
import pprint
import re # noqa: F401
import six
class OneOfDeviceFilter... |
import ugame
import stage
import utils
GAME = None
#######################################################
# Game
class Game(stage.Stage):
"""Base class for a game and its display"""
# TODO: add game state machine
# TODO: make each screen a state, and make a transition between them when player overlaps with t... |
"""
TODO: Add doc what this file is doing
"""
from marshmallow import Schema, post_dump
class RootSchema(Schema):
SKIP_VALUES = [None]
@post_dump
def remove_skip_values(self, data, many, **kwargs):
return {
key: value for key, value in data.items()
if value not in self.SKI... |
import os
import io
import time
import base64
import functools
from PIL import Image
import numpy as np
import tensorflow as tf
import tensorflow_hub as hub
from helpers import *
os.environ["TFHUB_DOWNLOAD_PROGRESS"] = "True"
class PythonPredictor:
def __init__(self, config):
# Import TF-Hub module
... |
# coding=utf-8
# Copyright 2018 The TF-Agents 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... |
from os import system
def comprar(comida, juguetes):
comprado = ""
while not comprado:
system("cls")
comprar = (input("Que quiere comprar? Alimentos | Juguetes : ")).lower()
if comprar == "alimento":
print(f"Carne: {comida['carne']['cantidad']}|Agua: {comida['agua']['cantidad']}|Huesos: {comida['hueso'... |
"""
Third generation models implementation (VPIN)
"""
import pandas as pd
def get_vpin(volume: pd.Series, buy_volume: pd.Series, window: int = 1) -> pd.Series:
"""
Get Volume-Synchronized Probability of Informed Trading (VPIN) from bars, p. 292-293.
:param volume: (pd.Series) bar volume
:param buy_vo... |
"""
github3.gists.comment
---------------------
Module containing the logic for a GistComment
"""
from github3.models import BaseComment
from github3.users import User
class GistComment(BaseComment):
"""This object represents a comment on a gist.
Two comment instances can be checked like so::
c1... |
import numpy as np
class NeuralNetwork(object):
def __init__(self, topology, epsilon, numLabels):
self.theta = []
self.topology = topology
self.numLabels = numLabels
self.gradientChecking = False
for layer in range(len(self.topology)):
if layer == 0:
... |
"""“Write a for loop to print all the values in the half_lives list from Operations on Lists, all on a single line. half_lives refers to [87.74, 24110.0, 6537.0, 14.4, 376000.0]."""
half_lives = [87.74, 24110.0, 6537.0, 14.4, 376000.0]
for i in half_lives:
print(i , end=' ') |
#!/usr/bin/env python3
"""Read a correct swagger file and check whether it conforms to a style guide."""
import argparse
import pathlib
from typing import List
import sys
import swagger_to.intermediate
import swagger_to.style
import swagger_to.swagger
def main() -> int:
"""Execute the main routine."""
parse... |
# coding: utf-8
"""
Katib
Swagger description for Katib # noqa: E501
The version of the OpenAPI document: v1beta1-0.1
Generated by: https://openapi-generator.tech
"""
import pprint
import re # noqa: F401
import six
from kubeflow.katib.configuration import Configuration
class V1beta1Experiment... |
from collections import namedtuple
import os
import json
import numpy as np
from tqdm import tqdm
from data_generators.utils import load_image_rgb
# Copied from: https://github.com/mcordts/cityscapesScripts/blob/master/cityscapesscripts/helpers/labels.py
#
# Cityscapes labels
#
#-------------------------------------... |
"""PyMC4 continuous random variables for tensorflow."""
import tensorflow_probability as tfp
from pymc4.distributions import abstract
from pymc4.distributions.tensorflow.distribution import BackendDistribution
tfd = tfp.distributions
__all__ = [
"Beta",
"Cauchy",
"ChiSquared",
"Exponential",
"Gam... |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may ... |
# Copyright (c) 2018-2022 Micro Focus or one of its affiliates.
# Copyright (c) 2018 Uber 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/licen... |
#!/usr/bin/python
from __future__ import (absolute_import, division, print_function)
# Copyright 2019 Fortinet, Inc.
#
# 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 3 of the Lic... |
import os
import posixpath
from enum import Enum
from fastapi import Path, HTTPException
from utils import security
class UploadPath(str, Enum):
default = "default"
UPLOAD_PATH_DICT = {
UploadPath.default: "default/"
}
def get_upload(upload_key: UploadPath = Path(..., description="上传文件块位置")):
"""
... |
# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class Repeatmodeler(Package):
"""RepeatModeler is a de-novo repeat family identification and mod... |
import math
pi = math.pi
raio = float(input('Qual é o raio da esfera?: '))
volume_esf = 4/3*pi*math.pow(raio, 3)
litro = 1
lata = litro*5
precolata = 50.00
totaltinta = volume_esf *lata
totalpreco = totaltinta * precolata
print(f'O volume da esfera é {volume_esf: .2f}')
print(f'A quantidade de tinta necessária é... |
import pycurl
import sys, getopt
from StringIO import StringIO
import json
import copy
from importCommon import *
from importNormativeTypes import *
import importCommon
######################################################################################################################################################... |
import numpy as np
from seren3 import config
from seren3.halos import Halo, HaloCatalogue
import logging
logger = logging.getLogger('seren3.halos.halos')
class AHFCatalogue(HaloCatalogue):
'''
Class to handle catalogues produced by AHF.
'''
# assume file structure like this
# ID(1) hostHalo(2) ... |
from datetime import datetime, timezone
from http import HTTPStatus
from json import dumps, load
from logging import getLogger
from os import environ
from unittest.mock import MagicMock, patch
from mypy_boto3_events import EventBridgeClient
from mypy_boto3_lambda import LambdaClient
from mypy_boto3_sns.type_defs impor... |
# -*- coding: utf-8 -*-
"""
Created on Sat Mar 14 08:55:39 2020
@author: rolly
"""
import config
from twilio.rest import Client
#https://api.whatsapp.com/send?phone=14155238886&text=join%20actual-nor&source=&data=
def sendMsg(num,msg):
client = Client(config.account_sid, config.auth_token)
message = client.m... |
import logging
from typing import Any, Dict, List, Optional, Union
from ..models import SnsModel
from ..types import Model
from .base import BaseEnvelope
logger = logging.getLogger(__name__)
class SnsEnvelope(BaseEnvelope):
"""SNS Envelope to extract array of Records
The record's body parameter is a string... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright: (c) 2015, Joseph Callen <jcallen () csc.com>
# Copyright: (c) 2018, 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_function
__metaclass__ = type
... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import django.utils.timezone
from django.conf import settings
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
operations ... |
#!/usr/bin/env python
# Copyright 2014 Google Inc. All Rights Reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of c... |
from pluto.control.modes import mode
from pluto.control.modes.processes import process_manager
from protos import broker_pb2_grpc
class LiveControlMode(mode.ControlCommandHandler):
def __init__(self, server, framework_url, process_factory):
super(LiveControlMode, self).__init__(framework_url, process_fact... |
# Configuration file for the Sphinx documentation builder.
#
# This file only contains a selection of the most common options. For a full
# list see the documentation:
# http://www.sphinx-doc.org/en/master/config
# -- Path setup --------------------------------------------------------------
# If extensions (or module... |
## @file
# This file is used to define each component of INF file
#
# Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.<BR>
# This program and the accompanying materials
# are licensed and made available under the terms and conditions of the BSD License
# which accompanies this distribution. The full ... |
import pytest
jax = pytest.importorskip("jax", minversion="0.2")
jnp = jax.numpy
import numpy as np
import pennylane as qml
from pennylane.devices.default_qubit_jax import DefaultQubitJax
pytestmark = pytest.mark.usefixtures("tape_mode")
class TestQNodeIntegration:
"""Integration tests for default.q... |
import pytest
from pytest_mock_resources.fixture.database.generic import assign_fixture_credentials
from pytest_mock_resources.fixture.database.relational.generic import EngineManager
from pytest_mock_resources.fixture.database.relational.postgresql import (
_create_clean_database,
get_sqlalchemy_engine,
)
fro... |
from __future__ import annotations
from typing import NoReturn
from . import LinearRegression
from ...base import BaseEstimator
import numpy as np
class PolynomialFitting(BaseEstimator):
"""
Polynomial Fitting using Least Squares estimation
"""
def __init__(self, k: int) -> PolynomialFitting:
... |
# Copyright 2014 Facebook, Inc.
# You are hereby granted a non-exclusive, worldwide, royalty-free license to
# use, copy, modify, and distribute this software in source code or binary
# form for use in connection with the web services and APIs provided by
# Facebook.
# As with any software that integrates with the Fa... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.constant.ParamConstants import *
class PriceInformation(object):
def __init__(self):
self._amount = None
self._type = None
@property
def amount(self):
return self._amount
@amount.setter
def am... |
# Copyright 2020 The StackStorm Authors.
# Copyright (C) 2020 Extreme Networks, Inc - 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/license... |
import requests
import json
url = "https://www.cbr-xml-daily.ru/daily_json.js"
response = requests.get(url)
data = json.loads(response.text)
print(data)
|
from django.db import models
from authors import settings
from authors.apps.articles.models import Article
from authors.apps.profiles.models import Profile
# Create your models here.
class ReportArticle(models.Model):
"""model for reporting an article"""
reporter = models.ForeignKey(Profile, on_delete=models.C... |
# -*- coding: utf-8 -*-
import re
from six.moves import http_client
from six.moves import urllib
from wsgiref.headers import Headers
class Request(object):
def __init__(self, environ):
self.environ = environ
@property
def path(self):
return self.environ['PATH_INFO']
@property
de... |
#!/usr/bin/python
from __future__ import (absolute_import, division, print_function)
# Copyright 2019 Fortinet, Inc.
#
# 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 3 of the Lic... |
import torch
import torchvision
# An instance of your model.
model = torchvision.models.resnet18()
# An example input you would normally provide to your model's forward() method.
example = torch.rand(1, 3, 224, 224)
# Use torch.jit.trace to generate a torch.jit.ScriptModule via tracing.
traced_script_module = torch.... |
import glob
import logging
import os
from typing import Any, Dict, List, Optional
from django.conf import settings
from zerver.lib.storage import static_path
# See https://jackstromberg.com/2013/01/useraccountcontrol-attributeflag-values/
# for docs on what these values mean.
LDAP_USER_ACCOUNT_CONTROL_NORMAL = '512'... |
from django.contrib.auth.decorators import login_required
from django.contrib.auth.models import AnonymousUser
from django.core.paginator import Paginator
from django.shortcuts import render, redirect, get_object_or_404
from django.contrib import messages
from django.views.decorators.cache import cache_page
from django... |
from motor.motor_asyncio import AsyncIOMotorClient
from pymongo import MongoClient
__all__ = ['PymongoConnection', 'MotorConnection']
class PymongoConnection:
def __init__(self, host="127.0.0.1", port="27017", db="default", user=None, password=None):
"""Create database connection."""
if user and... |
import base64
import json
import os
import os.path
import shlex
import string
from datetime import datetime
from distutils.version import StrictVersion
from .. import errors
from .. import tls
from ..constants import DEFAULT_HTTP_HOST
from ..constants import DEFAULT_UNIX_SOCKET
from ..constants import DEFAULT_NPIPE
fr... |
#
# Copyright (c) 2021 Airbyte, Inc., all rights reserved.
#
# generated by datamodel-codegen:
# filename: airbyte_protocol.yaml
from __future__ import annotations
from enum import Enum
from typing import Any, Dict, List, Optional, Union
from pydantic import AnyUrl, BaseModel, Extra, Field
class Type(Enum):
... |
import os, collections, sqlite3
from flask import Flask, render_template
from flask.ext.bootstrap import Bootstrap
from AsciiDammit import asciiDammit
app = Flask(__name__)
bootstrap = Bootstrap(app)
import util as wpu
configDict = {}
appDataDirDict = {}
appName = "waypointapp"
@app.route('/')
def index():
appName... |
"""
Created: 16 August 2018
Last Updated: 16 August 2018
Dan Marley
daniel.edison.marley@cernSPAMNOT.ch
Texas A&M University
-----
Class for performing deep learning in pytorch
Designed for running on desktop at TAMU
with specific set of software installed
--> not guaranteed to work in CMSSW environment!
D... |
import torch
import os.path as osp
import sys
from torch.autograd import Variable
cur_dir = osp.dirname(osp.abspath(__file__))
sys.path.insert(0, cur_dir)
import torch_nndistance as NND
p1 = torch.rand(10, 1000, 3)
p2 = torch.rand(10, 1500, 3)
points1 = Variable(p1, requires_grad=True)
points2 = p2
points1 = points1... |
from geographiclib.geodesic import Geodesic
from pyproj import CRS, Transformer
from .geometry import Vector, Line
def azimuth(p1: Vector, p2: Vector):
""":return: azimuth of geodesic through p1 and p2 in p1 with WGS84"""
res = Geodesic.WGS84.Inverse(p1.y, p1.x, p2.y, p2.x)
return res['azi1']
def dist... |
from enum import Enum
class Color(Enum):
red = 1
green = 2
blue = 3
print(Color.red.name, Color.red.name.upper())
print(Color.red.name.<warning descr="Unresolved attribute reference 'foo' for class 'str'">foo</warning>)
print(Color.red.value.<warning descr="Unresolved attribute reference 'foo' for class... |
"""
Segment_tree creates a segment tree with a given array and function,
allowing queries to be done later in log(N) time
function takes 2 values and returns a same type value
"""
class SegmentTree:
def __init__(self, arr, function):
self.segment = [0 for x in range(3 * len(arr) + 3)]
self.arr = a... |
import unittest
from rfapi.error import JsonParseError, MissingAuthError
class ApiClientTest(unittest.TestCase):
def test_json_parse_error(self):
resp = type('', (object,), {"content": ""})()
msg = "Could not parse"
e = JsonParseError(msg, resp)
self.assertEqual(str(e), msg)
d... |
# BSD 3-Clause License; see https://github.com/scikit-hep/awkward-1.0/blob/main/LICENSE
from __future__ import absolute_import
import awkward as ak
np = ak.nplike.NumpyMetadata.instance()
def is_valid(array, exception=False):
pass
# """
# Args:
# array (#ak.Array, #ak.Record, #ak.layout.Conte... |
import matplotlib.pyplot as plt
import matplotlib.mlab as mlab
import numpy as np
import os,sys,inspect
import imageio
sys.path.insert(1, os.path.join(sys.path[0], '..')) #go up a dir to import
import CodePy2.funmath as funmath
#import imageio
n = 1.0
sizes = [i/n for i in range(33*int(n))]
xvals = sizes
filenames ... |
import copy
import math
import matplotlib.pyplot as plt
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import Variable
from utils.utils import clones
class LayerNormGoogle(nn.Module):
def __init__(self, features, epsilon=1e-6):
super(LayerNormGo... |
from tensorflow import keras
from constants import TRADING_DAYS_PER_WEEK, INDEX_RETURN_INDICATOR_NUMBER
from ..constants import *
MODEL_NAME = 'ifcp_model_ver1_2'
ROLLING_WINDOW_SIZE = TRADING_DAYS_PER_WEEK
def build_model():
fund1_return = keras.Input(shape=(ROLLING_WINDOW_SIZE, 1), name=FUND1_RETURN_NAME)
... |
# flake8: noqa
from fugue.extensions.creator.creator import Creator
from fugue.extensions.creator.convert import creator, _to_creator
|
# -*- coding: utf-8 -*-
__author__ = "苦叶子"
"""
公众号: 开源优测
Email: lymking@foxmail.com
"""
import os
import time
import tempfile
import subprocess
class Process:
def __init__(self, command):
self._command = command
self._process = None
self._error = None
self._out_file = None
... |
"""Inventory requests."""
from collections import defaultdict
from typing import Any, MutableMapping
import requests
from linnapi.request import LinnworksAPIRequest
class GetStockItemIDsBySKU(LinnworksAPIRequest):
"""Return the stock item ID for a SKU."""
URL = "https://eu-ext.linnworks.net/api/Inventory/... |
from flask import Flask, render_template, request
from dashboard_forms import Dashform
#import create_pickle as p_j
import json
import os
app = Flask(__name__)
app.secret_key = 'dash_flask_key'
creddir = os.path.join(os.path.dirname(
os.path.dirname(os.path.realpath(__file__))), 'credentials/dash_id.json'... |
class BaseDatabaseClient:
"""Encapsulate backend-specific methods for opening a client shell."""
# This should be a string representing the name of the executable
# (e.g., "psql"). Subclasses must override this.
executable_name = None
def __init__(self, connection):
# connection is an inst... |
"""
Unit tests for symupy.api.stream
"""
# ============================================================================
# STANDARD IMPORTS
# ============================================================================
import pytest
# ============================================================================
#... |
#
# Copyright 2016 Google Inc. 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 law or... |
exec(open("Modified_data/next_level.py").read())
|
from .base import lr
from . import het
from .merge import merge
from .permutation import permutation
|
# encoding: utf-8
from datetime import datetime, timedelta
from django.conf import settings
from django.contrib.auth.models import Group
from django.core.management.base import BaseCommand
from dateutil.tz import tzlocal
from core.models import Event, Venue
from programme.models import ProgrammeEventMeta, TimeBlock... |
import svm as SVM
import numpy as np
data_dict = { -1:np.array( [[10,9,1],
[2,8,1],
[3,8,1],]),
1:np.array( [[5,1,1],
[6,-1,1],
[7,3,1],])}
svm = SVM.Support_Vector_Machine()
svm.fit(data=data_dict)
predict_us = [[0,10,1],
[1,3,1],
... |
#!/usr/bin/python3
import configparser
config = configparser.ConfigParser()
config.read('eve-conf.ini')
def int_imp(inp):
while True:
try:
int(inp)
break
except ValueError:
print('Input has to be a number.')
inp = input('Select again: ')
return i... |
import argparse
import numpy as np
import cv2
from TauLidarCommon.frame import FrameType
from TauLidarCamera.camera import Camera
def setup(serialPort=None):
port = None
camera = None
# if no serial port is specified, scan for available Tau Camera devices
if serialPort is None:
ports = Camera... |
# Created by Thomas Jones on 06/11/15 - thomas@tomtecsolutions.com
# branding.py, a plugin for minqlx to brand your server.
# This plugin is released to everyone, for any purpose. It comes with no warranty, no guarantee it works, it's released AS IS.
# You can modify everything, except for lines 1-4 and the !tomtec_ver... |
import os
from django.utils.translation import gettext_lazy as _
######################
# CARTRIDGE SETTINGS #
######################
# The following settings are already defined in cartridge.shop.defaults
# with default values, but are common enough to be put here, commented
# out, for conveniently overriding. Plea... |
# HitObject class
class HitObject:
def __init__(self, start_x, start_y, end_x, end_y, time, object_type):
self.start_x = start_x
self.start_y = start_y
self.end_x = end_x
self.end_y = end_y
self.time = time
self.object_type = object_type # hit_circle, eve... |
r"""
Isomorphisms between Weierstrass models of elliptic curves
AUTHORS:
- Robert Bradshaw (2007): initial version
- John Cremona (Jan 2008): isomorphisms, automorphisms and twists
in all characteristics
"""
#*****************************************************************************
# Copyright (C) 2007 Rober... |
"""
Settings specific to prod-like deployable code, reading values from system environment variables.
"""
import os
from conf.configs import common
from conf.settings import PROJECT_ID
__author__ = "Alex Laird"
__copyright__ = "Copyright 2018, Helium Edu"
__version__ = "1.1.15"
# Define the base working directory o... |
import operator
from functools import reduce
from django.contrib.auth import get_user_model
from django.contrib.auth.decorators import login_required
from django.db.models import Q, Sum
from django.shortcuts import HttpResponse, get_object_or_404, redirect, render
from django.views.generic import View
from django.view... |
import pandas as pd
import numpy as np
import torch
from sklearn.model_selection import train_test_split
from backend.services.toxic_comment_jigsaw.application.ai.model import BERTClassifier
from backend.services.toxic_comment_jigsaw.application.ai.training.src.dataset import BERTDataset
from backend.services.toxic_co... |
# 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
# distributed under t... |
from setuptools import setup
from torch.utils.cpp_extension import BuildExtension, CUDAExtension
setup(
name='carafe_layer_cuda',
ext_modules=[
CUDAExtension('carafe_layer_cuda', [
'src/carafe_layer_cuda.cpp',
'src/carafe_layer_kernel.cu',
])
],
cmdclass={
... |
from numpy import *
import numpy as np
# from numba import jit
# @jit
def detrending_coeff(win_len , order):
#win_len = 51
#order = 2
n = (win_len-1)/2
A = mat(ones((win_len,order+1)))
x = np.arange(-n , n+1)
for j in range(0 , order + 1):
A[:,j] = mat(x ** j).T
coeff_output = (A.T * A).I * A... |
# Author: Javad Amirian
# Email: amiryan.j@gmail.com
import xml.etree.ElementTree as et
import numpy as np
import pandas as pd
from opentraj.toolkit.core.trajdataset import TrajDataset
from opentraj.toolkit.utils.calibration.camera_calibration_tsai import *
def load_pets(path, **kwargs):
"""
:param path: a... |
"""
Production settings for Estatisticas Facebook project.
- Use WhiteNoise for serving static files
- Use Amazon's S3 for storing uploaded media
- Use mailgun to send emails
- Use Redis for cache
- Use sentry for error logging
"""
import logging
from .base import * # noqa
# SECRET CONFIGURATION
# -----------... |
# coding: utf-8
# Copyright (c) Max-Planck-Institut für Eisenforschung GmbH - Computational Materials Design (CM) Department
# Distributed under the terms of "New BSD License", see the LICENSE file.
import os
import posixpath
import numpy as np
import pandas
import tables
import warnings
from pyiron_base import Gener... |
# coding: utf-8
"""
Kubernetes
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
OpenAPI spec version: v1.13.1
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from pprint import pformat
from six import iteritems
import re... |
#task 1
nyaam = float (input('enter a length in cm: '))
if nyaam < 0:
print ('entry is invalid')
else:
res = nyaam / 2.54
print (res, 'inch')
#task 2
whoosh = int (input ('how many credits have you taken? '))
if whoosh > 0 and whoosh < 24:
print ('congrats, you a freshman!')
elif whoosh > 23 and wh... |
import torch
import torch.nn as nn
import torch.nn.functional as F
from mp.models.segmentation.unet_fepegar import UNet2D
### UNet Wrapper ###
class UNet2D_dis(UNet2D):
r"""Wrapper for UNet2D to access encoder and decoder seperately.
"""
def __init__(self, *args, **kwargs):
super(UNet2D_dis, self).... |
"""Tornado handlers for nbgrader assignment list web service."""
import os
import json
import contextlib
import traceback
from tornado import web
from notebook.utils import url_path_join as ujoin
from nbgrader.exchange import ExchangeFactory
from nbgrader.coursedir import CourseDirectory
from nbgrader.auth import A... |
# Copyright 2016 Citrix Systems
#
# 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 agr... |
import os
import shutil
from multiprocessing.pool import Pool
import cv2
import numpy as np
from functools import partial
from path import Path
def process_scene(input_directory, output_folder):
K = np.array([[525.0, 0.0, 320.0],
[0.0, 525.0, 240.0],
[0.0, 0.0, 1.0]])
prin... |
import pygame
import math
import glob
import os
tilesize = 128 # pixels per tile
def tiletosurface(tile):
pass
def maptosurface(sx,sy,ex,ey,oholmap):
pass
def main(windowsize,tilepipe,OHOLMap):
wt = math.floor(windowsize/tilesize)
cx,cy,first = 0,0,True
if OHOLMap.data != {}:
for x in OHOL... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.http import Http404
from core.models import (Category, Article, Source, BaseUserProfile,
BookmarkArticle, ArticleLike, HashTag, Menu, Notification, Devices,
SocialAccount, Category, CategoryAss... |
import pygame, time
from pygame.locals import *
from random import *
pygame.init()
# Variables Pygame
white = (255, 255, 255)
crystal = (162,162,162)
black = (0, 0, 0)
rose = (236,28,115)
red = pygame.Color('#ff0000')
green = pygame.Color('#00ff62')
blue = pygame.Color('#0026ff')
yellow = (222,207,... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.