text stringlengths 2 999k |
|---|
# coding=utf-8
# Copyright 2022 The TensorFlow Datasets 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 appl... |
# -*- 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 ------------------------------------------------------------... |
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi SDK Generator. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
from ... import _utilities
fro... |
"""Split a mesh by connectivity and
order the pieces by increasing area.
"""
from vtkplotter import *
em = load(datadir+"embryo.tif", threshold=80)
# return the list of the largest 10 connected meshes:
splitem = em.splitByConnectivity(maxdepth=40)[0:9]
t = Text2D(__doc__)
show( [(em, t), splitem], N=2, axes=1 )
|
# -*- coding:utf-8 -*-
# import ssl
# ssl._create_default_https_context =ssl._create_stdlib_context # 解决Mac开发环境下,网络错误的问题
from verifications.libs.yuntongxun.CCPRestSDK import REST
# 说明:主账号,登陆云通讯网站后,可在"控制台-应用"中看到开发者主账号ACCOUNT SID
_accountSid = '8a216da8762cb4570176d2c6be6e3bd8'
# 说明:主账号Token,登陆云通讯网站后,可在控制台-应用中看到开发者主账... |
from typing import Text, List, Any, Tuple
import numpy as np
import pytest
from rasa.shared.nlu.training_data.training_data import TrainingData
from rasa.shared.nlu.training_data.message import Message
from rasa.nlu.config import RasaNLUModelConfig
from rasa.nlu.tokenizers.whitespace_tokenizer import WhitespaceTokeni... |
"""
Author: Lucas Bony
Splits train and valid csv
"""
import os.path as osp
import argparse
import numpy as np
import pandas as pd
parser: argparse.ArgumentParser = argparse.ArgumentParser()
parser.add_argument('--train_ratio', type=float, default=0.8)
parser.add_argument('--valid_ratio', type=float, default=0.2)
p... |
import io
import numpy as np
import tensorflow as tf
from hparams import hparams
from librosa import effects
from models import create_model
from text import text_to_sequence
from util import audio
class Synthesizer:
def load(self, checkpoint_path, model_name='tacotron'):
print('Constructing model: %s' % model_... |
from pathlib import Path
from libs.file import read_txt
def read_filelist_texts(filepath):
contents = read_txt(filepath)
lines = contents.split(('\n'))
contents = [line.split('|')[1] for line in lines]
return '\n'.join(contents)
if __name__ == '__main__':
filepath = Path("/libs/dataset/tools/gi... |
# Copyright 2018, Kay Hayen, mailto:kay.hayen@gmail.com
#
# Python test originally created or extracted from other peoples work. The
# parts from me are licensed as below. It is at least Free Software where
# it's copied from other people. In these cases, that will normally be
# indicated.
#
# L... |
'''
Manage shared access keys of a domain.
'''
from .... pyaz_utils import _call_az
def list(name, resource_group):
'''
List shared access keys of a domain.
Required Parameters:
- name -- Name of the domain.
- resource_group -- Name of resource group. You can configure the default group using `az ... |
import sys
sys.path.append('..')
import numpy as np
import os
import pickle
import matplotlib.pyplot as plt
import packages.subgoal.inference as sg
from packages.mdp.gridworld import Gridworld
from packages.mdp.mdp import MDP, policyDivergence, normalizeQ, det2stoch
from packages.policy.exploration import softmaxPolic... |
# Copyright (c) 2012 Intel
# Copyright (c) 2012 OpenStack Foundation
# Copyright (c) 2015 EMC 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
#
#... |
import datetime, uuid, requests, json
from requests.auth import HTTPBasicAuth
from django.shortcuts import render
from django.shortcuts import render
from rest_framework.views import APIView, status
from .forms import SignUpForm, LoginForm
from requests.auth import HTTPBasicAuth
from django.http import HttpResponseR... |
#!/usr/bin/env python
#
# A library that provides a Python interface to the Telegram Bot API
# Copyright (C) 2015-2016
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser Public License as published by
#... |
# -*- coding:utf-8 -*-
# /usr/bin/env python
"""
Author: Albert King
date: 2019/12/6 14:34
contact: jindaxiang@163.com
desc: 获取申万指数-申万一级
http://www.swsindex.com/IdxMain.aspx
部分代码要感谢: PKUJson
"""
import time
import json
import datetime
import pandas as pd
import requests
from bs4 import BeautifulSoup
from mssdk.index.... |
import parsing
# Precedences.
class p1(parsing.Precedence):
"%left"
class p2(parsing.Precedence):
"%left >p1"
# Tokens.
class plus(parsing.Token):
"%token [p1]"
class star(parsing.Token):
"%token [p2]"
class id(parsing.Token):
"%token"
# Non-terminal definitions.
class S(parsing.Nonterm)... |
# -*- coding: utf-8 -*-
###############################################################################
#
# GetTranslations
# Retrieves an array of all translations for a given text.
#
# Python versions 2.6, 2.7, 3.x
#
# Copyright 2014, Temboo Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# ... |
import pickle
from build_pipeline import make_anomaly
def fit(
X, output_dir, class_order=None, row_weights=None, **kwargs,
):
"""
This hook must be implemented with your fitting code, for running drum in the fit mode.
This hook MUST ALWAYS be implemented for custom training models.
For inference... |
class Persona:
def __init__(self, nombre):
self.nombre = nombre
def avanza(self):
print('Ando caminando')
class Ciclista(Persona):
def __init__(self, nombre):
super().__init__(nombre)
def avanza(self):
print('Ando moviendome en mi bicicleta')
def main():
persona = Persona('James')
... |
from datetime import datetime, timedelta
import jwt
from app.setting import SECRET_KEY
from flask import request
def getPayload(userId):
payload = { # jwt设置过期时间的本质 就是在payload中 设置exp字段, 值要求为格林尼治时间
"user_id": userId,
"exp": datetime.utcnow() + timedelta(seconds=60 * 60 * 24 * 30),
}
retu... |
import numpy as np
A = [np.array([]),
np.array([5.26001519587677318785587544488e-2]),
np.array([1.97250569845378994544595329183e-2, 5.91751709536136983633785987549e-2]),
np.array([2.95875854768068491816892993775e-2, 0, 8.87627564304205475450678981324e-2]),
np.array([2.41365134159266685502369798665e... |
import pytest
from cltoolkit.wordlist import Wordlist
from cltoolkit.models import Sound, Inventory, Language
from cltoolkit.features.phonology import (
is_voiced,
stop_like,
is_uvular,
is_ejective,
is_lateral,
is_nasal,
HasPtk, HasUvular, HasGlottalized, HasSoundsWithFeature, HasRoundedVow... |
from social_django.views import _do_login
from social_core.actions import do_auth, do_complete, do_disconnect
from django.core.exceptions import ObjectDoesNotExist
from django.contrib.auth.decorators import login_required
from .models import ProfileForm, Profile, Workout, WorkoutForm
from badgify.models import Award, B... |
from robloxpy import User
User.id("ROBLOX") |
print("halo")
imie = input("Podaj imie: ")
print("czesc",imie)
|
"""
file_util provides helpers for dealing with file handles in robust,
memory-efficent ways.
"""
import sys
from . import formatting
import urllib.request
import urllib.parse
import urllib.error
import subprocess
from codalab.common import URLOPEN_TIMEOUT_SECONDS
BUFFER_SIZE = 2 * 1024 * 1024
def tracked(fileobj, ... |
from django.test import TestCase
from app.models.core import User
from app.models import Landscape, Land, Company, Place
from django.utils import timezone
import datetime
class LandscapeTestCase(TestCase):
def setUp(self):
self.load_data()
self.land: Landscape = Landscape.objects.create_land()
... |
"""New standard I/O library.
Based on sio.py from Guido van Rossum.
- This module contains various stream classes which provide a subset of the
classic Python I/O API: read(n), write(s), tell(), seek(offset, whence=0),
readall(), readline(), truncate(size), flush(), close(), peek(),
flushable(), try_to_find_fil... |
# Generated by Django 2.1.7 on 2019-03-25 05:10
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('products', '0004_auto_20190324_1851'),
]
operations = [
migrations.AddField(
model_name='product',
name='featured',
... |
# -*- coding: utf-8 -*-
#!/usr/bin/env python
#
# Electrum - lightweight Bitcoin client
# Copyright (C) 2011 thomasv@gitorious
#
# 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 restri... |
#!/usr/bin/python
#
# Copyright (c) 2019 Zim Kalinowski, (@zikalino)
#
# 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
ANSIBLE_METADATA = {'metadata_version': '1.1',
... |
import os
TEST_DIR = os.path.join(os.path.abspath(os.path.dirname(__file__)), 'tests')
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': ':memory:',
}
}
MIDDLEWARE_CLASSES = [
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.C... |
# 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 typing import Callable, Union, Optional, Dict, Any, List, Tuple
import os
import ujson
from django.http import HttpRequest, HttpResponse
from django.utils.translation import ugettext as _
from django.shortcuts import redirect, render
from django.conf import settings
from django.core.exceptions import Validation... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# pytorch model importer
# --------------------------------------------------------
# mcnPyTorch
# Licensed under The MIT License [see LICENSE.md for details]
# Copyright (C) 2017 Samuel Albanie
# --------------------------------------------------------
import sys
impor... |
import re
import sys
from dagster.core.definitions.dependency import DependencyStructure
from dagster.utils import check
MAX_NUM = sys.maxsize
def generate_dep_graph(pipeline_def):
''''pipeline to dependency graph. It currently only supports top-level solids.
Args:
pipeline (PipelineDefinition): Th... |
import os, sys
from datetime import datetime
from .text import parse_bool
def now():
return datetime.utcnow().isoformat() + 'Z'
def env(k, **kw):
if 'default' in kw and k not in os.environ:
return kw['default']
v = os.environ[k]
try:
return int(v)
except ValueError:
pas... |
'''
The class dealing with the player and the camel.
'''
import os
import random
class Player():
def __init__(self):
""" Variables more about the player itself """
self.milesTraveled = 0
self.gold = 2
self.thirst = 0
self.location = "DESERT"
self.inventory = [ "CANTEEN" ]
self.failed = False
""" C... |
from keyes import Keyes
from simple_page.simple_page import simple_page
app = Keyes(__name__)
app.register_blueprint(simple_page)
# Blueprint can be registered many times
app.register_blueprint(simple_page, url_prefix='/pages')
if __name__=='__main__':
app.run()
|
from mmxai.interpretability.classification.lime.lime_multimodal import (
LimeMultimodalExplainer,
)
from skimage.segmentation import mark_boundaries
from skimage import img_as_ubyte
import numpy as np
from PIL import Image
def lime_multimodal_explain(image_path, text, model, label_to_exp, num_samples=500):
im... |
""" Convolutional Neural Network.
Build and train a convolutional neural network with TensorFlow.
This example is using the MNIST database of handwritten digits
(http://yann.lecun.com/exdb/mnist/)
Author: Aymeric Damien
Project: https://github.com/aymericdamien/TensorFlow-Examples/
"""
from __future__ import division,... |
"""
Tasks related to projects.
This includes fetching repository code, cleaning ``conf.py`` files, and
rebuilding documentation.
"""
import datetime
import hashlib
import json
import logging
import os
import shutil
import signal
import socket
import tarfile
import tempfile
from collections import Counter, defaultdict... |
# Generated by Django 3.0.3 on 2021-03-08 08:05
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('netsuite', '0009_journalentry_department_id'),
]
operations = [
migrations.AlterField(
model_name='journalentry',
na... |
# import external modules
import numpy, os
# Add Exasim to Python search path
cdir = os.getcwd(); ii = cdir.find("Exasim");
exec(open(cdir[0:(ii+6)] + "/Installation/setpath.py").read());
# import internal modules
import Preprocessing, Postprocessing, Gencode, Mesh
# Create pde object and mesh object
pde,mesh = Prep... |
# -*- coding: utf-8 -*-
#
# pymunk documentation build configuration file, created by
# sphinx-quickstart on Sun Jun 03 03:50:06 2012.
#
# This file is execfile()d with the current directory set to its containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# All ... |
#!/usr/bin/python
__version__ = "1.0"
from yue.app.app import main
main()
|
# -*- coding: utf-8 -*-
from model.group import Group
def test_add_group(app, json_groups):
group = json_groups
old_groups = app.group.get_group_list()
app.group.create(group)
new_groups = app.group.get_group_list()
assert len(old_groups)+1 == len(new_groups)
old_groups.... |
from unittest import TestCase
import os
import pandas as pd
from landbosse.model import Cable, Array, ArraySystem
from landbosse.tests.model.test_WeatherDelay import generate_a_year
from landbosse.tests.model.test_filename_functions import landbosse_test_input_dir
import pytest
pd.set_option('display.width', 6000)
... |
# -*- coding: utf-8 -*-
# Copyright 2022 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... |
from flask import Flask, jsonify, request, render_template, Response
from flask_sqlalchemy import SQLAlchemy
app = Flask(__name__)
ENV = 'dev'
if ENV == 'dev':
app.debug = True
# postgresql://postgres:{password}@localhost:{port}/{databasename}
app.config['SQLALCHEMY_DATABASE_URI'] = "postgresql://postgre... |
'''
Test Attach/Detach Port Forwarding
@author: Youyk
'''
import zstackwoodpecker.test_util as test_util
import zstackwoodpecker.test_lib as test_lib
import zstackwoodpecker.test_state as test_state
import zstackwoodpecker.zstack_test.zstack_test_port_forwarding as zstack_pf_header
import apibinding.inventory as inve... |
from django.urls import reverse
from rest_framework import status
from bluebottle.test.utils import BluebottleTestCase
from bluebottle.test.factory_models.accounts import BlueBottleUserFactory
from bluebottle.test.factory_models.terms import TermsFactory
class TermsAPITest(BluebottleTestCase):
""" Integration t... |
# -*- coding: utf-8 -*-
#!/usr/bin/env python
#
# Copyright 2015-2019 BigML
#
# 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... |
from datetime import datetime
from pathlib import Path
from qcpump.pumps.base import STRING, BasePump, DIRECTORY, BOOLEAN, MULTCHOICE
from qcpump.pumps.common.qatrack import QATrackFetchAndPostTextFile, QATrackFetchAndPostBinaryFile
class BaseQATrackGenericUploader:
TEST_LIST_CONFIG = {
'name': "Test L... |
# RLWallet is subclass of Wallet
import asyncio
import json
import time
from dataclasses import dataclass
from secrets import token_bytes
from typing import Any, List, Optional, Tuple
from blspy import AugSchemeMPL, G1Element, PrivateKey
from chia.types.blockchain_format.coin import Coin
from chia.types.blockchain_fo... |
from tad.server.outbound_message import NodeType
from tad.types.peer_info import PeerInfo
from tests.block_tools import BlockTools, create_block_tools, create_block_tools_async
from tad.util.ints import uint16
from tad.util.keyring_wrapper import DEFAULT_PASSPHRASE_IF_NO_MASTER_PASSPHRASE
from tad.util.ws_message impor... |
"""
AllyMessages are things which are said to allies
AllyMessages are said to either all, or certain specific people.
This is represented by the "target".
Types of message:
* <CHAR> SHOULD ATTACK
* <CHAR> SHOULD RETREAT
* <CHAR> SHOULD WAIT
* <CHAR_A> SHOULD SUPPORT <CHAR_B>
* <ALL> SHOULD SUPPORT <CHAR_B>... |
# 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 ... |
"""
Created on Wed Feb 5 16:07:35 2020
@author: matias
"""
import numpy as np
from matplotlib import pyplot as plt
from scipy.optimize import minimize
import emcee
import corner
from scipy.interpolate import interp1d
import sys
import os
from os.path import join as osjoin
from pc_path import definir_path
path_git, ... |
# 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.
try:
from collections.abc import Iterable
except ImportError:
from collections import Iterable
import contextlib
import itertools
impo... |
# Copyright 2017 Battelle Energy Alliance, 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 t... |
import asyncio
import aiohttp
async def fetch(session):
print('Query http://httpbin.org/get')
async with session.get(
'http://httpbin.org/get') as resp:
print(resp.status)
data = await resp.json()
print(data)
async def go(loop):
async with aiohttp.ClientSession(loop=l... |
"""Crie um programa que crie uma matriz de dimensão 3x3 e preencha com valores lidos pelo teclado.
No final, mostre a matriz na tela, com a formatação correta"""
matriz = [[], [], []]
for l in range(0, 3):
for c in range(0, 3):
matriz[l].append(int(input(f'Digite um valor para [{l}, {c}]: ')))
for l in ran... |
import csv
import time
import json
import requests
import numpy as np
import gevent.monkey
import urllib
from datetime import datetime
from urllib.request import urlopen
start_time = time.time()
header_row = False
count = 0
file_name = "dust_result_" + time.strftime("%Y%m%d-%H%M%S") + ".csv"
# urls = ['https://api.wa... |
import os
import clingo
from typing import Tuple, Set
from src.mdp import MarkovDecisionProcedure
class PlannerPolicy:
def __init__(self, planning_horizon: int, mdp_builder):
self.planning_horizon: int = planning_horizon
self.mdp_interface_file_path: str = mdp_builder.mdp_interface_file_path
... |
# coding=utf-8
# Copyright 2014 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
from pants.backend.j... |
import pytest
import rdflib
data = """<?xml version="1.0" encoding="utf-8"?>
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:http="http://www.w3.org/2011/http#">
<http:HeaderElement rdf:about="#he0">
<http:params>
<http:Parameter rdf:about="#param0_0" />
... |
# SPDX-FileCopyrightText: 2020 2020
#
# SPDX-License-Identifier: Apache-2.0
#
# Splunk UI module python renderer
# This module is imported by the module loader (lib.module.ModuleMapper) into
# the splunk.appserver.mrsparkle.controllers.module.* namespace.
#
# required imports
import cherrypy
import controllers.modul... |
#!/usr/bin/python
import sys
def displayInventory(inventory):
print('Inventory:')
item_total = 0
for k,v in inventory.items():
print(str(v)+' '+str(k))
item_total += v
print('Total number of items: ' + str(item_total))
def main():
print('***************************************')
print('************ [ STARTE... |
"""A list of all the columns in the fully analysed CSV, mainly cause I hate making typos in column names"""
TOTAL = "Total"
CLEANED_TEXT = "Cleaned Text"
DAY = "Day"
ENTITIES = "Entities"
EMOTION_LABEL = "Emotion Label"
HOUR = "Hour"
PROFANITY_SCORE = "Profanity Score"
PROFANITY_LABEL = "Profanity Label"
RAW_TEXT = "R... |
import webhook
import msbot.msdb
import msbot.constants
db_file = 'db/broadcast_table.db'
database = msbot.msdb.MSDatabase(db_file)
broadcast_users = database.get_all_user_ids()
message = 'Hello World!'
for user_id in broadcast_users:
webhook.send_message(user_id, { msbot.constants.TEXT: message })
|
import argparse
import torch
import onmt
import onmt.model_builder
import onmt.inputters as inputters
import onmt.opts
from onmt.utils.misc import use_gpu
from onmt.utils.logging import init_logger, logger
parser = argparse.ArgumentParser(description='translate.py')
parser.add_argument('-model', required=True,
... |
from ..base import RecommenderMixin
from ..model import UserKNN
import numpy as np
class UserKNNRecommender(UserKNN, RecommenderMixin):
"""User k-Nearest-Neighbor (kNN; user-based collaborative filtering) recommender
References
----------
- M. Pepagelis et al.
**Incremental Collaborative Fil... |
class ReferencedItemDoesNotExistError(Exception):
"""
This occurs when a referenced item does not
exist and cannot be found when it should
"""
class PatientNotInIntegrationEngineError(Exception):
"""
This is raised when a patient cannot be found
via the integration engine
"""
class D... |
# coding: utf-8
from rest_framework import serializers
from .models import User, Entry
class UserSerializer(serializers.ModelSerializer):
class Meta:
model = User
fields = ('name', 'mail')
class EntrySerializer(serializers.ModelSerializer):
class Meta:
model = Entry
fields ... |
print("olá mundo")
|
import sys
__all__ = ['b', 'basestring_', 'bytes', 'next', 'is_unicode']
if sys.version < "3":
b = bytes = str
basestring_ = str
else:
def b(s):
if isinstance(s, str):
return s.encode('latin1')
return bytes(s)
basestring_ = (bytes, str)
bytes = bytes
tex... |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, print_function
from six.moves import range
import tensorflow as tf
from niftynet.layer import layer_util
from niftynet.layer.activation import ActiLayer
from niftynet.layer.base_layer import TrainableLayer, LayerFromCallable
from niftynet.layer.gn import... |
# -*- coding: utf-8 -*-
'''
:codeauthor: Nicole Thomas <nicole@saltstack.com>
'''
# Import Python Libs
from __future__ import absolute_import, unicode_literals, print_function
# Import Salt Testing Libs
from tests.support.case import ModuleCase
from tests.support.helpers import destructiveTest, skip_if_not_root
... |
import random
import string
import hashlib
import pymongo
class User(object):
"""User data access object."""
def __init__(self, db):
self.db = db
self.users = self.db.users
self.SECRET = "verysecret"
def make_salt(self):
"""Make a little salt."""
salt = ""
... |
from rest_framework import serializers
from apps.archivo.models import FotoEmpleado, FotoBitacora
class FotoEmpleadoSerializer(serializers.ModelSerializer):
class Meta:
model = FotoEmpleado
fields = ('id', 'foto')
class FotoBitacoraSerializer(serializers.ModelSerializer):
cl... |
#!/usr/bin/env python
# encoding: utf-8
#
# Licensed under the GNU LGPL v2.1 - http://www.gnu.org/licenses/lgpl.html
"""
Automated test to reproduce the results of Mihalcea and Tarau (2004).
Mihalcea and Tarau (2004) introduces the TextRank summarization algorithm.
As a validation of the gensim implementation we repr... |
from django.apps import AppConfig
class ContactConfig(AppConfig):
default_auto_field = 'django.db.models.BigAutoField'
name = 'apps.contact'
|
# Copyright (C) 2010-2011 Richard Lincoln
#
# 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, publish... |
import subprocess
import textwrap
import pytest
from citc.slurm import node_list, SlurmNode, parse_features
@pytest.fixture(scope="function")
def slurm_conf(tmp_path):
p = tmp_path / "slurm.conf"
p.write_text(
textwrap.dedent(
"""
# STARTNODES
NodeName=t3-micro-00... |
'''
Created on Jul 25, 2012
@author: andris
'''
import random
import re
import dateutil.parser
import numpy as np
__all__ = ['parse_list_from_string', 'normalize_listargument', 'parse_number',
'flatten_hierarchical_dict', 're_from_Cformatstring_numbers', 'random_str']
def parse_list_from_string(s):
... |
from configparser import ExtendedInterpolation
from io import StringIO
import os
import re
import tempfile
import pytest
from localconfig.manager import LocalConfig, DuplicateSectionError
TEST_CONFIG = """\
# Section used for type testing
[types]
# An int value
int = 1
# A float value
float = 2.0
# A mid-comment... |
SYMBOLS = {',', '?', '!', ':', '\'', '"', '(', ')', ';', '@', '^', '^', '&', '&', '$', '$', '£',
'[', ']', '{', '}', '<', '>', '+', '-', "*", "#", "%", "=", "~", '/', "_"}
PREP = {'about', 'above', 'across', 'after', 'against', 'aka', 'along', 'and', 'anti', 'apart', 'around', 'as',
'astride', 'at'... |
#!/usr/bin/env python3
# pyre-strict
# Copyright (c) Facebook, Inc. and its affiliates.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
from dataclasses import dataclass
from typing import Optional
from ldops.... |
# Copyright (c) 2020 by Fraunhofer Institute for Energy Economics
# and Energy System Technology (IEE), Kassel. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
import json
import os
import pickle
try:
from fiona.crs import from_epsg
from... |
"""LVQMLN example using all four dimensions of the Iris dataset."""
import argparse
import prototorch as pt
import pytorch_lightning as pl
import torch
class Backbone(torch.nn.Module):
def __init__(self, input_size=4, hidden_size=10, latent_size=2):
super().__init__()
self.input_size = input_siz... |
#!/usr/bin/python3
# -*- coding: utf-8 -*-
"""
Note Binder - a simple tool to organize text files
Author: Jérôme Spielmann
Website: jeromespielmann.com
MIT License
Copyright (c) 2020 Jérôme Spielmann
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated docume... |
# 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 ... |
# pylint: disable=missing-docstring
import logging
import subprocess
LOG = logging.getLogger(__name__)
class ExecutionError(Exception):
pass
class Timeout(ExecutionError):
pass
def execute(command, timeout=30):
try:
LOG.debug('Executinge "%s".', command)
process = subprocess.Popen(
... |
# -*- coding: utf-8 -*-
"""Implements the xonsh history backend via sqlite3."""
import builtins
import collections
import json
import os
import sqlite3
import sys
import threading
import time
from xonsh.history.base import History
import xonsh.tools as xt
XH_SQLITE_CACHE = threading.local()
XH_SQLITE_TABLE_NAME = "xo... |
from typing import List, Tuple
import numpy as np
import pandas as pd
import tensorflow as tf
from tensorflow.keras import layers, optimizers
from sklearn.preprocessing import MinMaxScaler
def scaleData(
paths_to_datasets: List[str], sub_sampling
) -> Tuple[List[pd.DataFrame], MinMaxScaler]:
scaler = MinMaxSc... |
from __future__ import absolute_import
from .npm_extra_metrics import NPMExtraMetrics
|
#!/usr/bin/env python3
import pytest
from pytest import raises
from hypothesis import given
from hypothesis.strategies import integers
from wellmap import *
@pytest.mark.parametrize(
'row, col, well', [
('A', 1, 'A1'),
('A', '1', 'A1'),
('A', '01', 'A1'),
])
def test_well_f... |
import asyncio
import json
import sys
from .bindings import version
from .ledger import (
build_custom_request,
build_get_txn_request,
build_get_acceptance_mechanisms_request,
build_get_txn_author_agreement_request,
build_get_validator_info_request,
build_get_cred_def_request,
build_get_rev... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.