text stringlengths 1 927k |
|---|
#datos de entrada
inporte=float(input("digite el importe total vendido en el mes:"))
#proceso
sueldo_basico=300
comision_ventas=0.09*inporte
sueldo_bruto=sueldo_basico + comision_ventas
descuento=0.11*sueldo_bruto
sueldo_neto=sueldo_bruto-descuento
#salida
print("sueldo basico:s/.",sueldo_basico)
print("comision por ve... |
import aiohttp
from fastapi import Request
from .models import User, Guild
from .config import DISCORD_URL, DISCORD_API_URL, DISCORD_TOKEN_URL, DISCORD_OAUTH_URL, DISCORD_OAUTH_AUTHENTICATION_URL
from .exeptions import Unauthorized, RateLimited, InvalidRequest
import re
from aiocache import cached
from functools import... |
from django.urls import path
from . import views
app_name = 'cv'
urlpatterns = [
path('', views.CVView.as_view(), name='cv_list'),
path('pdf/', views.cv_pdf, name='cv_pdf'),
path('forms/<str:model_name>/add/', views.CVCreateView.as_view(),name='cv_add'),
path('forms/<str:model_name>/<int:pk>/edit/', ... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from runner.koan import *
class AboutComprehension(Koan):
def test_creating_lists_with_list_comprehensions(self):
feast = ['lambs', 'sloths', 'orangutans', 'breakfast cereals',
'fruit bats']
comprehension = [delicacy.capitalize() for de... |
from collections import deque
class Calculator:
def __init__(self):
self.vars = {}
self.help = "This calculator supports arithmetic operations " \
+ "on integers: addition, subtraction, " \
+ "multiplication, division and exponentiation. " \
... |
import numpy as np
import math
from distance.npversion import distance
class Dataset(object):
def __init__(self, dataset, output_dim, code_dim):
self._dataset = dataset
self.n_samples = dataset.n_samples
self._train = dataset.train
self._output = np.zeros((self.n_samples, output_dim... |
# 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... |
# -*- coding: utf-8 -*-
"""DNA Center Add members to the tag data model.
Copyright (c) 2019-2020 Cisco and/or its affiliates.
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, ... |
import FWCore.ParameterSet.Config as cms
DiPhotonPSet = cms.PSet(
hltPathsToCheck = cms.vstring(
"HLT_DoublePhoton85_v", # Run2 proposal # Claimed path for Run3
"HLT_DoublePhoton70_v", # Claimed path for Run3
# "HLT_DoublePhoton33_CaloIdL_v" # Not claimed path for Run3
"HLT_Diphot... |
"""
WSGI config for exampleapp project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/3.2/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault('DJANGO_SE... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright 2010 British Broadcasting Corporation and Kamaelia Contributors(1)
#
# (1) Kamaelia Contributors are listed in the AUTHORS file and at
# http://www.kamaelia.org/AUTHORS - please extend this file,
# not this notice.
#
# Licensed under the Apache License,... |
import click
import pandas as pd
from opensearchpy import OpenSearch
from opensearchpy.helpers import bulk
import logging
logger = logging.getLogger(__name__)
logger.setLevel(logging.INFO)
logging.basicConfig(format='%(levelname)s:%(message)s')
def get_opensearch():
host = 'localhost'
port = 9200
auth =... |
import pytest
import urllib.parse
from helper import chromedriver
from browsermobproxy import Server, Client
from selenium import webdriver
@pytest.fixture
def proxy_server(request):
server = Server("browsermob-proxy/bin/browsermob-proxy")
server.start()
client = Client("localhost:8080")
server.creat... |
"""https://projecteuler.net/problem=4
"""
def palindromic(digits):
lower = 10**(digits-1)
d1 = 10*lower-1
mp = 0
while d1 >= lower:
d2 = d1
while d2 >= lower:
p = d1*d2
if p < mp:
break
ps = str(p)
if ps == ps[::-1]: # ch... |
import tensorflow as tf
from baseline.tf.tfy import TRAIN_FLAG
from eight_mile.utils import listify
from baseline.utils import get_model_file, get_metric_cmp
from baseline.train import create_trainer, register_training_func
from baseline.tf.seq2seq.training.utils import to_tensors, SHUF_BUF_SZ, NUM_PREFETCH
@register... |
"""
Django settings for app project.
Generated by 'django-admin startproject' using Django 2.1.15.
For more information on this file, see
https://docs.djangoproject.com/en/2.1/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/2.1/ref/settings/
"""
import os
# Bu... |
import argparse
import pytorch_lightning as pl
import torch
from pytorch_lightning import Trainer
from solo.methods import DINO
from .utils import DATA_KWARGS, gen_base_kwargs, gen_batch, prepare_dummy_dataloaders
def test_dino():
method_kwargs = {
"output_dim": 256,
"proj_hidden_dim": 2048,
... |
import unittest
from app.models import Pitch
Pitch = Pitch
class PitchTest(unittest.TestCase):
'''
Test Class to test the behaviour of the Pitch class
'''
def setUp(self):
'''
Set up method that will run before every Test
'''
self.new_pitch = Pitch()
def test_i... |
import argparse
import gym
parser = argparse.ArgumentParser()
parser.add_argument("results_folder")
parser.add_argument("--api_key")
args = parser.parse_args()
gym.upload(args.results_folder, api_key=args.api_key) |
'''
Given two integers dividend and divisor, divide two integers without using multiplication, division and mod operator.
Return the quotient after dividing dividend by divisor.
The integer division should truncate toward zero.
Example 1:
Input: dividend = 10, divisor = 3
Output: 3
Example 2:
Input: dividend = 7, ... |
import arrow
import json
import libvirt
import logging
import lxml.etree
import os
import subprocess
import tarfile
import virt_backup
from virt_backup.backups.packagers import ReadBackupPackagers, WriteBackupPackagers
from virt_backup.compat_layers.pending_info import (
convert as compat_convert_pending_info,
)
f... |
# include these urls instead of urls.py if you are using the WSGI + Django middlewares
# to set request.team, manually hooking up List/Create views as well as the accept/reject
from django.urls import path
from . import views
app_name = "pinax_teams"
urlpatterns = [
# team specific
path('detail/', views.te... |
def check_armstrong_num(n):
sum_of_cubes = 0
orig_n = n
while n > 0:
digit = n%10
sum_of_cubes = sum_of_cubes + pow(digit, 3)
n = n//10
if sum_of_cubes == orig_n:
return "Is an Armstrong Number"
else:
return "Not an Armstrong Number"
number = int(input()... |
"""
This program reads all of the tree heights in the trees.dat file and
computes the number of trees, the average height, the shortest tree and
the tallest tree. Only built-in functions are used in the calculations.
"""
trees = []
fin = open('/home/student/pydata/trees.dat')
# fin = open('c:/pydata/trees.dat')
for i ... |
"""
Dates
"""
import datetime as dt
from clay.time.base import BaseDateTimeRange
# date formats
MDY_FMT = '%m/%d/%Y'
MDY_DASH_FMT = '%m-%d-%Y'
YMD_FMT = '%Y/%m/%d'
YMD_DASH_FMT = '%Y-%m-%d'
# days of the week
MONDAY = dt.date(2019, 4, 22)
TUESDAY = dt.date(2019, 4, 23)
WEDNESDAY = dt.date(2019, 4, 24)
THURSDAY = d... |
# MIT License
# Copyright 2018 Ryan Hausen
#
# 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, publis... |
import boto3
region = 'ap-northeast-1'
KILLTAG = 'temp'
ec2 = boto3.resource('ec2', region)
instances = ec2.instances.all()
for instance in instances:
# print(instance.id, instance.instance_type, instance.state, instance.tags)
tags = instance.tags
state = instance.state['Name']
found = False
name = ... |
from copy import deepcopy
import torch
from thop import profile
def get_model_info(model, tsize):
if isinstance(tsize, list):
tsize = tsize[0]
stride = 64
img = torch.zeros((1, 3, stride, stride), device=next(model.parameters()).device)
flops, params = profile(deepcopy(model), inputs=(img,), v... |
#!/usr/bin/env python
# Licensed under an MIT license - see LICENSE
from setuptools import setup, find_packages
from pathlib import Path
## read __version__
with open(Path(__file__).parent.absolute().joinpath('divtel/version.py')) as f:
exec(f.read())
setup(name='divtel',
version=__version__,
descr... |
# -*- coding: utf-8 -*-
#
# Configuration file for the Sphinx documentation builder.
#
# This file does only contain a selection of the most common options. For a
# full list see the documentation:
# http://www.sphinx-doc.org/en/stable/config
# -- Path setup ------------------------------------------------------------... |
"""
This module contains utility functions for the NHL API proxy server.
"""
from fastapi import Request, Response, HTTPException
import httpx
def forward_request(api_url: str, request: Request) -> Response:
"""
Forwards a request to an API at the given url. Requires that the request has a path parameter
... |
# This file is part of the lexid project
# https://github.com/mbarkhau/lexid
#
# Copyright (c) 2020 Manuel Barkhau (mbarkhau@gmail.com) - MIT License
# SPDX-License-Identifier: MIT
import os
import sys
import setuptools
def project_path(*sub_paths):
project_dirpath = os.path.abspath(os.path.dirname(__file__))
... |
#!/usr/bin/env python3
"""Base class for all FAUCET unit tests."""
# pylint: disable=missing-function-docstring
# pylint: disable=too-many-arguments
# pylint: disable=too-many-lines
from functools import partial
import collections
import copy
import glob
import ipaddress
import json
import os
import random
import re... |
"""empty message
Revision ID: 8bd5fd537d97
Revises: 492842fc3ad0
Create Date: 2020-03-26 16:11:46.839537
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '8bd5fd537d97'
down_revision = '492842fc3ad0'
branch_labels = None
depends_on = None
def upgrade():
# ... |
# coding: utf-8
#
# Copyright 2022 :Barry-Thomas-Paul: Moss
#
# 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... |
""" Non-negative matrix factorization.
"""
# Author: Vlad Niculae
# Lars Buitinck
# Mathieu Blondel <mathieu@mblondel.org>
# Tom Dupre la Tour
# License: BSD 3 clause
import numbers
import numpy as np
import scipy.sparse as sp
import time
import warnings
from math import sqrt
from ._cdnmf_fast... |
import requests
from bs4 import BeautifulSoup
tipos = ['Aço', 'Água', 'Dragão', 'Elétrico','Fada','Fantasma','Fogo',
'Gelo','Inseto', 'Lutador', 'Normal','Pedra','Planta','Psiquico',
'Sombrio','Terrestre','Venenoso','Voador']
tipos_autolog = ['Steel', 'Water', 'Dragon', 'Electric','Fairy','Ghost','F... |
import streamlit as st
import pandas as pd
from gettext import translation, NullTranslations
from typing import Dict, Callable
from utils import get_data, dataframe_translator
from trends import line_plots
from trajectory import trajectory_cases
from maps import choropleth_maps
data = get_data()
st.sidebar.title("L... |
# coding: utf-8
"""
vserver
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
import pprint
import re # noqa: F401
import six
from ncloud_vserver.model.common_code import CommonCode # noqa: F401,E501
class Product(object):
"""NOTE: This class is auto generated by the swagge... |
import _plotly_utils.basevalidators
class IdsValidator(_plotly_utils.basevalidators.DataArrayValidator):
def __init__(self, plotly_name="ids", parent_name="scatterternary", **kwargs):
super(IdsValidator, self).__init__(
plotly_name=plotly_name,
parent_name=parent_name,
... |
from boa3.builtin.interop.blockchain import Transaction, get_transaction_from_block
def main() -> Transaction:
return get_transaction_from_block('height', 'tx_index') |
from django.conf.urls import url
from rest_framework import fields, generics, versioning
from snippets.models import Snippet
from snippets.serializers import SnippetSerializer
from testproj.urls import SchemaView, required_urlpatterns
class SnippetSerializerV2(SnippetSerializer):
v2field = fields.IntegerField(he... |
# -*- coding: utf-8 -*-
# ---------------------------------------------------------------------
# crm.supplierprofile application
# ---------------------------------------------------------------------
# Copyright (C) 2007-2019 The NOC Project
# See LICENSE for details
# ------------------------------------------------... |
from subprocess import Popen, PIPE
import pathlib
import sys
def create_executable(filename: str = 'bot.py'):
bot_source = pathlib.Path().cwd() / filename
print(f"[i] Source: {bot_source}")
print("[i] Creating executable file...")
proc = Popen(['pyinstaller',
'-F', '-w', '--clean',
... |
import json
import sys
if __name__ == '__main__':
network = sys.argv[1]
owners_required = sys.argv[2]
score_address_txt = "./config/" + network + "/score_address.txt"
call = json.loads(open("./calls/set_wallet_owners_required.json", "rb").read())
call["params"]["to"] = open(score_address_txt, "r"... |
from itertools import chain, product
import warnings
import pytest
import numpy as np
import scipy.sparse as sp
from sklearn.utils.testing import (assert_equal, assert_raises,
assert_array_equal,
SkipTest, assert_raises_regex,
... |
# MIT License
# Copyright (c) 2017 Jacob Bourne
# 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, p... |
###This file was altered/created by: Akshaj Dwivedula
# KidsCanCode - Game Development with Pygame video series
# Jumpy! (a platform game) - Part 2 and Part 5
# Video link: https://www.youtube.com/watch?v=8LRI0RLKyt0
# Player movement
# Copyright 2019 KidsCanCode LLC -/- All rights reserved.
#Citations: Some code was... |
# 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... |
#!/usr/bin/env python3
# vim:ts=4:sw=4:et:
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
# no unicode literals
import os
import tempfile
import unittest
import AsyncWatchmanTestCase
... |
"""
PyDraw-after: simple canvas paint program and object mover/animator
use widget.after scheduled events to implement object move loops, such
that more than one can be in motion at once without having to use threads;
this does moves in parallel, but seems to be slower than time.sleep version;
see also canvasDraw in To... |
#!/usr/bin/env python3
""" Calculate Fibonacci """
import argparse
from typing import NamedTuple
class Args(NamedTuple):
""" Command-line arguments """
generations: int
litter: int
# --------------------------------------------------
def get_args() -> Args:
""" Get command-line arguments """
p... |
from __future__ import absolute_import, division, print_function
import code
import os
import os.path
import sys
import time
from pprint import pformat
from threading import Event, Thread
from sqlalchemy import create_engine
from manhattan.server import Server, main as server_main, logging_config
from manhattan.clie... |
import tqdm, sklearn
import numpy as np
import os, time, sys
import pickle
from itertools import chain
if '../utils' not in sys.path:
sys.path.append('../utils')
from data import Data
def main():
data_bin, o_data_bin = '../run/seqVerbMC/data.bin', '../run/seqVerbMC/data_subsrl.bin'
data = Data()
data... |
import Cifras.bases_numericas as bases_numericas
import Cifras.utf8 as utf8
import dicionarios
dicionario_base_64 = {'000000': 'A', '000001': 'B', '000010': 'C', '000011': 'D', '000100': 'E',
'000101': 'F', '000110': 'G', '000111': 'H', '001000': 'I', '001001': 'J',
'001010'... |
"""URLs de usuarios"""
# Django
from django.urls import include, path
# Django REST Framework
from rest_framework.routers import DefaultRouter
# View
from .views import users as user_views
router = DefaultRouter()
router.register(r'users', user_views.UserViewSet, basename='users')
urlpatterns = [
path('', incl... |
import math
import numpy as np
# Base Configuration Class
# Don't use this class directly. Instead, sub-class it and override
# the configurations you need to change.
class Config(object):
"""Base configuration class. For custom configurations, create a
sub-class that inherits from this one and override prop... |
import numpy as np
from pySDC.core.Problem import ptype
from pySDC.implementations.datatype_classes.particles import particles, fields, acceleration
class planewave_single(ptype):
"""
Example implementing a single particle spiraling in a trap
"""
def __init__(self, cparams, dtype_u=particles, dtype_... |
# -*- coding: utf-8 -*-
"""
Proxy Minion interface module for managing VMWare vCenters.
:codeauthor: :email:`Rod McKenzie (roderick.mckenzie@morganstanley.com)`
:codeauthor: :email:`Alexandru Bleotu (alexandru.bleotu@morganstanley.com)`
Dependencies
============
- pyVmomi Python Module
pyVmomi
-------
PyVmomi can ... |
import ml_pipeline.utils.Logging as logging
logger = logging.logger
ALLOWED_USER_FILE_EXT = set(['csv'])
def validate_error_form_fields(config_form_dict):
logger.debug("Inside validate_error_form_fields - user submitted dict {}".format(config_form_dict))
config_user_dict = convert_user_dict_format(config_fo... |
import torch
import torch.nn as nn
import torch.nn.functional as F
import utils.pointnet2_utils as pointnet2_utils
import utils.pytorch_utils as pt_utils
from typing import List
import numpy as np
import time
import math
class _PointnetSAModuleBase(nn.Module):
def __init__(self):
super().__init__()
... |
# -*- coding: utf-8 -*-
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.10 on 2018-02-06 12:38
from __future__ import unicode_literals
import autoslug.fields
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
migr... |
from mopidy.models import Playlist, Track, Album, Artist
from tests import unittest, path_to_data_dir
class LibraryControllerTest(object):
artists = [Artist(name='artist1'), Artist(name='artist2'), Artist()]
albums = [Album(name='album1', artists=artists[:1]),
Album(name='album2', artists=artists[1:2... |
import numpy as np
from tf_utils import visualization_utils_cv2 as vis_util
from lib.session_worker import SessionWorker
from lib.load_graph_nms_v1 import LoadFrozenGraph
from lib.load_label_map import LoadLabelMap
from lib.mpvariable import MPVariable
from lib.mpvisualizeworker import MPVisualizeWorker, visualization
... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/Period) on 2019-01-22.
# 2019, SMART Health IT.
from . import element
class Period(element.Element):
"""
T
i
m
e
r
a
n
g
e
d
e
f
i... |
# stdlib
import secrets
from typing import List
from typing import Type
from typing import Union
import torch as th
# third party
from nacl.signing import VerifyKey
from nacl.encoding import HexEncoder
from syft.grid.client.client import connect
from syft.grid.client.grid_connection import GridHTTPConnection
from syft... |
# Generated by Django 3.0.9 on 2020-08-05 19:07
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('gifapp', '0001_initial'),
]
operations = [
migrations.AddField(
model_name='project',
... |
import os
from typing import List
import yaml
class SecretsReader:
def read(self, environment_variables: dict, files: List[str]) -> dict:
result = {}
for file in files:
result.update(yaml.load(open(file), Loader=yaml.FullLoader))
for (environment_variable_name,secret_key) in... |
import pytest
from django.conf import settings
from django.contrib.sessions.middleware import SessionMiddleware
from django.http import HttpRequest
from products.tests.factories import ProductFactory
from ..cart import Cart
pytestmark = pytest.mark.django_db
def dummy_get_response(request):
return None
@pytes... |
# Generated by Django 2.1.11 on 2019-08-18 07:02
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
('auth', '0009_alter_user_last_name_max_length'),
]
operations = [
migrations.CreateModel(
name='User',
... |
"""
From http://stackoverflow.com/a/13504757
"""
from scipy.interpolate import interp1d
from scipy.interpolate._fitpack import _bspleval
import numpy as np
class fast_interpolation:
def __init__(self, x, y, axis=-1):
assert len(x) == y.shape[axis]
self.x = x
self.y = y
self.axis =... |
from sklearn.linear_model import LogisticRegression
class MultivariateLogisticOvrModel(object):
def model_and_predict(self, X_train, y_train, X_test):
model = LogisticRegression(dual=True, fit_intercept=True,
multi_class='ovr')
model.fit(X_train, y_train)
... |
"""
DESCRIPTORS.TXTGREY: textural descriptors from grey-scale images.
@author: vlad
"""
from __future__ import (absolute_import, division, print_function, unicode_literals)
__version__ = 0.05
__author__ = 'Vlad Popovici'
__all__ = ['GaborDescriptor', 'LBPDescriptor', 'GLCMDescriptor', 'HOGDescriptor',
'His... |
try:
from PySide import QtCore
except:
try:
from PyQt4 import QtCore
except:
from PyQt5 import QtCore
class TestObject(QtCore.QObject):
"""
Test class providing some non-argument signal
"""
try:
testSignal = QtCore.Signal() # @UndefinedVariable
except:
... |
import ConfigParser
import os
import sys
import re
from django.core.management.base import LabelCommand, CommandError
from django.contrib.auth.models import User
from djangit.models import *
class Command(LabelCommand):
def handle_label(self, label, **options):
cfg = ConfigParser.ConfigParser()
... |
# -*- coding: utf-8 -*-
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... |
"""Unit test package for twitter_blocker.""" |
import cv2, wx
from imagepy.core.engine import Filter, Simple, Tool
from imagepy.core.manager import WindowsManager
from .matcher import Matcher
import numpy as np
from imagepy import IPy
CVSURF = cv2.xfeatures2d.SURF_create if cv2.__version__[0] =="3" else cv2.SURF
class FeatMark:
def __init__(self, feats):
... |
from pandas import *
K = 100
N = 100000
rng = DateRange('1/1/2000', periods=N, offset=datetools.Minute())
rng2 = np.asarray(rng).astype('M8[us]').astype('i8')
series = {}
for i in range(1, K + 1):
data = np.random.randn(N)[:-i]
this_rng = rng2[:-i]
data[100:] = np.nan
series[i] = SparseSeries(data, i... |
'''
This simple WebSocket server responds to text messages by reversing each
message string and sending it back.
It also handles ping/pong automatically and will correctly close down a
connection when the client requests it.
To use SSL/TLS: install the `trustme` package from PyPI and run the
`generate-cert.py` script... |
"""
# Copyright 2021 21CN Corporation Limited
#
# 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 agree... |
from .fields import FIELD_NO_INPUT
class InvalidRuleDefinition(Exception):
pass
def get_value(rule_list, defined_variables, defined_actions):
""" Run Rules till first will be triggered and returns its actions results.
Exception will be raised if more than one action was executed by the triggered rule.
... |
""" Loss as a Metrics to be used in research pipelines added with `run=True` """
import numpy as np
from .base import Metrics
class Loss(Metrics):
"""
This is a helper class to aggregate losses from pipelines
that are used in Research objects with `run=True`,
like test pipelines
Parameters
... |
from ptsemseg.loader.pascal_voc_loader import pascalVOCLoader
from ptsemseg.loader.coco_loader import COCOLoader
def get_loader(name):
"""get_loader
:param name:
"""
return {
'pascal': pascalVOCLoader,
'sbd': pascalVOCLoader,
'coco': COCOLoader,
}[name] |
value = 1
<caret>if value == 1:
print("Equal")
else:
print("Not equal") |
from hlwtadmin.models import Artist, GigFinderUrl, GigFinder, ConcertAnnouncement, Venue, Location, Organisation, Country, Concert, RelationConcertConcert, RelationConcertOrganisation, RelationConcertArtist, Location
from django.core.management.base import BaseCommand, CommandError
from django.db.models import Count
... |
from yape.main import fileout, fileout_splitcols, parse_args, yape2
from yape.parsepbuttons import parsepbuttons
import os
import traceback
import logging
TEST_DIR = "testdata"
TEST_RESULTS = "testresults"
# just to understand how tests work
class TestParser:
def test_is_string(self):
s = "this is a test"... |
import warnings
import numpy
import cupy
from cupy import _core
from cupy import _util
def label(input, structure=None, output=None):
"""Labels features in an array.
Args:
input (cupy.ndarray): The input array.
structure (array_like or None): A structuring element that defines
f... |
import smtplib
import datetime as dt
from random import choice
def sundays_emails():
# Usando o arquivo .txt das citações
with open("quotes.txt", "r") as citacoes:
quote_list = citacoes.readlines()
# Informações necessárias para o envio do email
host = "host do seu e-mail"
port = int
... |
from django.urls import path, include
from apps.core.views import HomeView, InvalidSsoLoginView, StatusView, router
urlpatterns = [
path('api/', include(router.urls)),
path('api/home/', view=HomeView.as_view(), name='HomeView'),
path('api/status/', view=StatusView.as_view(), name='StatusView'),
path(... |
# Copyright 2014 Scalyr 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... |
# 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... |
import os
banner='''
____ _ _ _ _ ____ _ _ _ __ __
/ ___|| | | | | | | __ )| | | | / \ | \/ |
\___ \| |_| | | | | _ \| |_| | / _ \ | |\/| |
___) | _ | |_| | |_) | _ |/ ___ \| | | |
|____/|_| |_|\___/|____/|_| |_... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from __future__ import print_function, absolute_import
import argparse
import time
import os.path as osp
import os
import numpy as np
import torch
from torch import nn
from torch.nn import init
from torch.backends import cudnn
from torch.utils.data import DataLoader
from ... |
"""testride_1_32770 URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/2.2/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: path('', views.home, name='home')
Cl... |
"""
Single stop word
"""
import pytest
from fast_rake import Rake
@pytest.mark.parametrize("stop_name", ["google", "nltk", "sklearn", "smart"])
def test_custom_stopword(text, stop_name):
custom_stopwords = ["minimal", "linear"]
rake = Rake(stopword_name=stop_name, custom_stopwords=custom_stopwords)
kw = ... |
# Licensed to the StackStorm, Inc ('StackStorm') 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 th... |
#!/usr/bin/env python
# Copyright (c) 2012 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.
'''Unit tests for grit.format.policy_templates.writers.plist_writer'''
import os
import sys
if __name__ == '__main__':
sys.path... |
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'booking.settings')
application = get_wsgi_application() |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.