text stringlengths 2 999k |
|---|
# coding: utf-8
"""
Physical terminal is what an user sees.
"""
import ast
import logging
try:
import ui
from objc_util import *
except ImportError:
from . import dummyui as ui
from .dummyobjc_util import *
from .shcommon import CTRL_KEY_FLAG
try:
unicode
except NameError:
unicode = str
# O... |
# Copyright (C) 2016 Google Inc.
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
"""A module with Comment object creation hooks"""
from ggrc import db
from ggrc.login import get_current_user_id
from ggrc.models.all_models import Comment, ObjectOwner
from ggrc.services.common import Reso... |
# uncompyle6 version 3.2.4
# Python bytecode 2.7 (62211)
# Decompiled from: Python 2.7.15 (v2.7.15:ca079a3ea3, Apr 30 2018, 16:30:26) [MSC v.1500 64 bit (AMD64)]
# Embedded file name: lib.coginvasion.quest.CogObjective
from direct.directnotify.DirectNotifyGlobal import directNotify
class CogObjective:
notify = dir... |
##### This code works on Keras version 2.2.4 with Tensorflow nightly version 1.14.1-dev20190402
import keras
from keras.optimizers import Adam,SGD
from keras import backend as K
from keras.models import Model, load_model
from keras.datasets import cifar10
import numpy as np
import random
import sys
import os, psutil
... |
"""Medley-solos-DB Dataset Loader.
.. admonition:: Dataset Info
:class: dropdown
Medley-solos-DB is a cross-collection dataset for automatic musical instrument
recognition in solo recordings. It consists of a training set of 3-second audio
clips, which are extracted from the MedleyDB dataset (Bittner ... |
#!/usr/bin/python3
# -*- coding: utf-8 -*-
__author__ = 'muwfm'
import tkinter as tk
from tkinter import ttk
from tkinter.filedialog import *
import tkinter.messagebox
import pymysql
class Search(ttk.Frame):
def __init__(self, win):
ttk.Frame.__init__(self, win)
frame00 = ttk.Frame(self)
... |
#
# needs test docs documentation build configuration file, created by
# sphinx-quickstart on Tue Mar 28 11:37:14 2017.
#
# 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 configuration... |
"""
cmdZedit.py
Author: Fletcher Haynes
This command allows editing of room attributes.
"""
import MudCommand
import MudWorld
import string
import os
class cmdZedit(MudCommand.MudCommand):
def __init__(self):
MudCommand.MudCommand.__init__(self)
self.info['cmdName'] = "zedit"
self.info... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Tests for `revisiondict` package."""
import sys
from revisiondict import RevisionDict
if sys.version_info[0] < 3:
from test import util_mapping_py2 as util_mapping
else:
from test import util_mapping_py3 as util_mapping
class RevisionDictMappingTest(util_ma... |
import os
import urllib.request
# PREWORK
#DICTIONARY = os.path.join('/tmp', 'dictionary.txt')
#urllib.request.urlretrieve('http://bit.ly/2iQ3dlZ', DICTIONARY)
DICTIONARY = '../../day020/bite_065_Get_all_valid_dictionary_words_for_a_draw_of_letters/dictionary.txt'
scrabble_scores = [(1, "E A O I N R T L S... |
from colorama import Fore
from config import token, prefix, dev_mode
from helpers import print, parse, get_server_actions
import actions
import actions.readme
import actions.settings
import actions.propose_command
import discord
import math
if dev_mode:
import importlib
client = discord.Client()
@client.event
a... |
"""
#Trains a ResNet on the CIFAR10 dataset.
"""
from __future__ import print_function
import keras
from keras.layers import Dense, Conv2D, BatchNormalization, Activation
from keras.layers import AveragePooling2D, Input, Flatten
from keras.optimizers import Adam
from keras.callbacks import ModelCheckpoint, LearningRa... |
# This file is dual licensed under the terms of the Apache License, Version
# 2.0, and the BSD License. See the LICENSE file in the root of this repository
# for complete details.
import json
import os
import subprocess
import sys
import textwrap
import pytest
from cryptography.hazmat.bindings.openssl.binding impor... |
import csv
from django.contrib.auth.decorators import permission_required
from django.shortcuts import render, redirect, get_object_or_404
from django.http import HttpResponse, HttpResponseRedirect, response
from django.urls import reverse
from .models import entry
from .forms import EntryForm
# @permission_require... |
#NOTE: This must be the first call in order to work properly!
from deoldify import device
from deoldify.device_id import DeviceId
#choices: CPU, GPU0...GPU7
device.set(device=DeviceId.GPU0)
import argparse
parser = argparse.ArgumentParser(description='Inference code to colorize and fix old photos')
parser.add_argum... |
"""
This should move into a configparser structure..
"""
__version__ = "0.1"
class Configuration(object):
def __init__(self, program):
self.program = program
self.lastupload = ".uploaded"
# source tree locations
self.sourceDirIsEagle ... |
import numpy as np
def logistic(X, y):
'''
LR Logistic Regression.
INPUT: X: training sample features, P-by-N matrix.
y: training sample labels, 1-by-N row vector.
OUTPUT: w: learned parameters, (P+1)-by-1 column vector.
'''
P, N = X.shape
w = np.zeros((P + 1, 1))
# YOUR... |
"""High-level functions to help perform complex tasks
"""
from __future__ import print_function, division
import os
import multiprocessing as mp
import warnings
from datetime import datetime
import platform
import struct
import shutil
import copy
import time
from ast import literal_eval
import traceback
import sys
im... |
from flask import Flask
from flasgger import Swagger
from api.controller.strip import strip_api
def create_app():
app = Flask(__name__)
app.config['SWAGGER'] = {
'title': 'Flask API Starter Kit',
}
Swagger(app)
app.register_blueprint(strip_api, url_prefix='/api')
return app
if... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.shortcuts import render
from django.contrib import auth
from django.contrib.auth.hashers import check_password
from django.views import generic
from django.http import response
from django.utils.translation import ugettext as _
from django.cor... |
from typing import Type
from ._base import ComposedConfiguration, ConfigMixin
class AllauthMixin(ConfigMixin):
"""
Configure Django Allauth.
This requires the django-allauth package to be installed.
"""
@staticmethod
def mutate_configuration(configuration: Type[ComposedConfiguration]) -> No... |
# pylint: disable=locally-disabled, too-few-public-methods, no-self-use, invalid-name
"""cmds.py - Implementations of the different HAProxy commands"""
import re
import csv
import json
from io import StringIO
class Cmd():
"""Cmd - Command base class"""
req_args = []
args = {}
cmdTxt = ""
helpTxt ... |
import bisect
import itertools
from functools import reduce
from collections import defaultdict
from sympy import Indexed, IndexedBase, Tuple, Sum, Add, S, Integer, diagonalize_vector, DiagMatrix
from sympy.combinatorics import Permutation
from sympy.core.basic import Basic
from sympy.core.compatibility import accumul... |
from .test_stat import *
from .test_pyplotlm import *
|
# Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
from api_categorizer import APICategorizer
from api_models import APIModels
from availability_finder import AvailabilityFinder
from empty_dir_file_system imp... |
import json
from aleph.core import db
from aleph.authz import Authz
from aleph.model import EntitySet
from aleph.logic.collections import compute_collection
from aleph.views.util import validate
from aleph.tests.util import TestCase, JSON
class CollectionsApiTestCase(TestCase):
def setUp(self):
super(Col... |
# 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... |
# pythom 2+3 compatibility
from __future__ import (absolute_import, division,
print_function, unicode_literals)
from builtins import super
import bson
import logging
import datetime
from ..common import try_reduce
from .. import units
from .simulationsdb import SimulationsDB
log = logging.get... |
# -*- coding: utf-8 -*-
# Copyright © 2012-2020 Roberto Alsina and others.
# 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 t... |
# -*- coding: utf-8 -*-
"""
Created on 2020/4/22 10:41 PM
---------
@summary:
---------
@author: Boris
@email: boris@bzkj.tech
"""
import feapder
class TestAirSpider(feapder.AirSpider):
# __custom_setting__ = dict(
# LOG_LEVEL = "INFO"
# )
def start_callback(self):
print("爬虫开始")
def... |
# 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
# d... |
# Generated by Django 3.2 on 2021-07-12 19:13
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='portfolio',
fields=[
('id', models.BigAutoFie... |
import re
from pathlib import Path
from setuptools import setup, find_packages
###############################################################################
# Package meta-data.
NAME = 'npyfile'
PROJECT_URLS = {
'Documentation': 'https://npyfile.readthedocs.io/',
'Source Code': 'https://github.c... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#***************************************************************************
# _ _ ____ _
# Project ___| | | | _ \| |
# / __| | | | |_) | |
# | (__| |_| | _ <| ... |
import argparse
import base64
import json
import cv2
import numpy as np
import matplotlib.pyplot as plt
from keras.models import model_from_json
from keras.preprocessing.image import ImageDataGenerator, array_to_img, img_to_array
# Fix error with Keras and TensorFlow
import tensorflow as tf
tf.python.control_flow_ops... |
from tests.utils import W3CTestCase
class TestLtrSpanOnly(W3CTestCase):
vars().update(W3CTestCase.find_tests(__file__, 'ltr-span-only'))
|
import pytest
nb_not_installed = False
try:
import nbformat
from nbconvert.preprocessors import ExecutePreprocessor
except ModuleNotFoundError:
nb_not_installed = True
from os import listdir, getcwd, pardir
from os.path import join, abspath
#Helper function to load and run notebooks with a given name at a ... |
"Rules constants"
BAZEL_DOTNETOS_CONSTRAINTS = {
"darwin": "@bazel_tools//platforms:osx",
"linux": "@bazel_tools//platforms:linux",
"windows": "@bazel_tools//platforms:windows",
}
BAZEL_DOTNETARCH_CONSTRAINTS = {
"amd64": "@bazel_tools//platforms:x86_64",
}
DOTNET_OS_ARCH = (
("darwin", "amd64"),... |
# -*- coding: utf-8 -*-
from .inthemoment import ITM
from .config import config
__all__ = (ITM, config)
# Version of the ITM package
__version__ = "0.0.1"
__author__ = "Stephan Meighen-Berger"
|
# Generated by Django 3.2.8 on 2021-10-22 16:42
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('recipe', '0001_initial')... |
import random
n = int(input('Введите максимальное число: '))
number = set()
number_user = set()
rand = random.randint(1, n)
number.add(rand)
print(number)
while True:
ask = input('Нужное число есть среди вот этих чисел: ').split()
if ask[0] == 'Помогите!':
number_user.update(number)
for i in... |
from abc import ABC, abstractmethod
import logging
from typing import List, Dict, NamedTuple, Iterable
from mlagents_envs.base_env import BatchedStepResult, AgentGroupSpec, AgentGroup
from mlagents.trainers.brain import BrainParameters
from mlagents.trainers.tf_policy import TFPolicy
from mlagents.trainers.agent_proces... |
import numpy as np
from .dc_motor import DcMotor
class DcSeriesMotor(DcMotor):
"""The DcSeriesMotor is a DcMotor with an armature and exciting circuit connected in series to one input voltage.
===================== ========== ============= ===========================================
Motor Para... |
from django.db import connection, ProgrammingError
from serveradmin.serverdb.models import Attribute, ServerAttribute, Server
from django.core.exceptions import ObjectDoesNotExist
def attribute_startswith(search_string, limit=20):
"""Query attributes starting search_string
:param search_string: e.g. al to m... |
import numpy as np
import os
import logging
import numbers
import tempfile
import time
import torch
import torch.distributed as dist
import ray
from ray.tune import Trainable
from ray.tune.trial import Resources
from ray.util.sgd.pytorch.distributed_pytorch_runner import (
DistributedPyTorchRunner)
from ray.util.... |
#!/usr/bin/env python3
# Copyright (c) 2014-2018 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test mempool re-org scenarios.
Test re-org scenarios with a mempool that contains transactions
that sp... |
import numpy as np
import tensorflow as tf
from utils.general_utils import test_all_close
def softmax(x):
"""
Compute the softmax function in tensorflow.
You might find the tensorflow functions tf.exp, tf.reduce_max,
tf.reduce_sum, tf.expand_dims useful. (Many solutions are possible, so you may
n... |
# Copyright 2021 Ismael Lugo <ismael.lugo@deloe.net>
#
# 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... |
from django.contrib.auth import get_user_model
from django.urls import reverse
from django.test import TestCase
from rest_framework import status
from rest_framework.test import APIClient
from core.models import Tag, Recipe
from recipe.serializers import TagSerializer
TAGS_URL = reverse('recipe:tag-list')
class P... |
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
from typing import Pattern, List, Dict
from recognizers_number import (BaseNumberExtractor, BaseNumberParser,
SpanishOrdinalExtractor, SpanishIntegerExtractor, SpanishNumberParserConfiguratio... |
from django.shortcuts import render
from .models import TimeSheet
def index(request):
TimeCards = TimeSheet.objects.all
context = {'TimeCards': TimeCards}
return render(request, 'timecard_app/index.html', context)
# Leave the rest of the views (detail, results, vote) unchanged |
import torch
import torch.nn as nn
import numpy as np
import json
class BertConfig(object):
def __init__(self,
vocab_size,
hidden_size=768,
num_hidden_layers=12,
num_attention_heads=12,
intermediate_size=3072,
hi... |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "Mtaa.settings")
try:
from django.core.management import execute_from_command_line
except ImportError:
# The above import may fail for some other reason. Ensure that the
... |
# Uses python3
import sys
def get_optimal_value(capacity, weights, values):
value = 0.
# get value per unit
v_u = [(v, w, v/w) for w, v in zip(weights, values)]
v_u = sorted(v_u, key=lambda x: x[2], reverse = True)
for idx in range(len(v_u)):
if capacity == 0:
return value
... |
# Generated by Django 3.1.13 on 2022-02-01 18:52
from django.db import migrations, models
import skills_matcher_db.users.models
class Migration(migrations.Migration):
dependencies = [
('users', '0012_auto_20220128_1918'),
]
operations = [
migrations.AlterField(
model_name='u... |
# GYP file to build a V8 sample.
{
'targets': [
{
'target_name': 'SkV8Example',
'type': 'executable',
'mac_bundle' : 1,
'include_dirs' : [
'../third_party/externals/v8/include',
],
'sources': [
'../experimental/SkV8Example/BaseContext.cpp',
'../experimen... |
#!/usr/bin/env python3
# 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.
import json
from unittest.mock import Mock, PropertyMock
import numpy as np
import pandas as pd
from ax.core.arm imp... |
#!/usr/bin/env python3
#
# Generates a file called version.txt with versioning info. Example:
#
# manufacturer=VGC Software
# suite=VGC
# versionType=alpha
# versionMajor=
# versionMinor=
# versionName=Alpha 2019-07-10
# commitRepository=https://github.com/vgc/vgc
# commitBranch=master
# commitHash=09... |
# coding: utf-8
"""
Isilon SDK
Isilon SDK - Language bindings for the OneFS API # noqa: E501
OpenAPI spec version: 10
Contact: sdk@isilon.com
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
import pprint
import re # noqa: F401
import six
from isi_sdk_9_0_0.models.mappin... |
# Copyright 2021 The Bellman Contributors
#
# 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... |
from django.conf import settings
from conference.models import Conference
def test_index(admin_client):
"""
Basic test to see if it even works.
"""
url = "/nothing-to-see-here/"
HTTP_OK_200 = 200
Conference.objects.create(
code=settings.CONFERENCE_CONFERENCE,
name=settings.CONF... |
import sys
import envs
from models.dqn import DQN2013
from argument.argManage import args
from common.utlis import set_seed
from interactor.episodeTrainer import run_GuidenceEnv
sys.path.append('..')
def run():
env = envs.make(args.env_name)
train_agent = DQN2013(env.state_dim, env.action_dim, is_train=True... |
from .friend import *
from .group import *
from .file import *
from .device import *
from .others import * |
from operator import attrgetter
import pyangbind.lib.xpathhelper as xpathhelper
from pyangbind.lib.yangtypes import RestrictedPrecisionDecimalType, RestrictedClassType, TypedListType
from pyangbind.lib.yangtypes import YANGBool, YANGListType, YANGDynClass, ReferenceType
from pyangbind.lib.base import PybindBase
from d... |
"""
Copyright 2020 The OneFlow 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 applicable law or agr... |
import json
import re
from collections import defaultdict
from datetime import datetime
import yara
from django.conf import settings
from django.core.exceptions import ValidationError
from django.db import models
from django.utils.translation import gettext_lazy as _
from django_jsonfield_backport.models import JSON... |
# Copyright (c) Microsoft. All rights reserved.
# Licensed under the MIT license. See LICENSE.md file in the project root
# for full license information.
# ==============================================================================
import numpy as np
from ..utils import wrap_numpy_arrays, get_rank
################... |
from __future__ import generator_stop
from fissix import fixer_base, fixer_util
import libmodernize
class FixBasestring(fixer_base.BaseFix):
BM_compatible = True
PATTERN = """'basestring'"""
def transform(self, node, results):
libmodernize.touch_import(None, "six", node)
return fixer_ut... |
#!/usr/bin/env python3
# Copyright (c) 2017 Pieter Wuille
# Copyright (c) Flo Developers 2013-2021
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Reference implementation for Bech32/Bech32m and segwit addresses."""
import unitt... |
# Ethan Tuning 2/6/2015
def sphereSurfaceArea(rad):
pi = 3.14159
surfaceArea = 4 * pi * rad ** 2
return surfaceArea
def sphereVolume(rad2):
pi = 3.14159
volume = (4/3) * pi * rad2 ** 3
return volume
def circleCircumference(rad3):
pi = 3.14159
circumference = 2 * pi * rad... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# standard modules
import logging
import sys
import random
import string
import os
# extra modules
dependencies_missing = False
try:
import requests
except ImportError:
dependencies_missing = True
# metasploit python module
from metasploit import module, login_sc... |
import pandas as pd
import matplotlib
import matplotlib.pyplot as plt
from sklearn import linear_model
import matplotlib.pyplot as plt
matplotlib.style.use('ggplot') # Look Pretty
def drawLine(model, X_test, y_test, title):
# This convenience method will take care of plotting your
# test observations, comparing ... |
from mythril.disassembler.disassembly import Disassembly
from mythril.laser.ethereum.state.environment import Environment
from mythril.laser.ethereum.state.account import Account
from mythril.laser.ethereum.state.machine_state import MachineState
from mythril.laser.ethereum.state.global_state import GlobalState
from my... |
import random
import signal
import sys
from abc import abstractmethod
from itertools import islice
from statistics import mean
import torch
from sacred import Experiment
from torch import optim
from torch.utils.data import DataLoader
from tqdm import tqdm
from code_transformer.configuration.transformer_lm_encoder imp... |
import tensorflow as tf
import cfg
def quad_loss(y_true, y_pred):
# loss for inside_score
logits = y_pred[:, :, :, :1]
labels = y_true[:, :, :, :1]
# balance positive and negative samples in an image
beta = 1 - tf.reduce_mean(labels)
# first apply sigmoid activation
predicts = tf.nn.sigmo... |
import sys
import itertools
#define constants, functions
BYTE_SIZE = 8;
append_zeros = lambda bit_pattern, ideal_size: "0"*(ideal_size-len(bit_pattern))+bit_pattern;
#backtrack to produce a list of SETS, each SET contains all the possibilities; before returning the answer, we 'intersect'...
#...all the sets
def back... |
from flask import json, jsonify, Blueprint
from extensions import db
from models import *
from sqlalchemy.ext.declarative import DeclarativeMeta
players_blueprint = Blueprint('players', __name__)
@players_blueprint.route('/api/players', methods=['GET'])
def players():
return jsonify([to_dict(player) for player... |
# ------------------------------------------------------------------------------
# Copyright 2013 Esri
# 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/LICEN... |
# -*- coding: utf-8 -*
import base64
import collections
import json
import unittest
from datetime import date, datetime
from decimal import Decimal
# non-standard import name for gettext_lazy, to prevent strings from being picked up for translation
from django import forms
from django.core.exceptions import Validatio... |
import numpy as np
import pandas as pd
import pytest
from numpy.testing import assert_array_almost_equal as aaae
from estimagic.config import IS_CYIPOPT_INSTALLED
from estimagic.config import IS_DFOLS_INSTALLED
from estimagic.config import IS_PETSC4PY_INSTALLED
from estimagic.config import IS_PYBOBYQA_INSTALLED
from e... |
import copy
from functools import partial
import multiprocessing
import numpy as np
from PySide2.QtCore import QObject, QSignalBlocker, Signal
from hexrd.ui.constants import ViewType
from hexrd.ui.create_hedm_instrument import create_hedm_instrument
from hexrd.ui.create_raw_mask import apply_threshold_mask, remove_th... |
# 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 ... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# */AIPND-revision/intropyproject-classify-pet-images/adjust_results4_isadog.py
#
# PROGRAMMER: Mohamed Gamal AbdElKhalek
# DATE CREATED: 2/5/2020
# REVISED DATE:
... |
import argparse
import os
import sys
from dotenv import load_dotenv
from sendgrid.helpers.mail import Mail
from requests.exceptions import RequestException
from bude_hezky.content import content_builder
from bude_hezky.sender import email_sender
from bude_hezky.weather import weather_forecast
CITY_OPTION_KEY = 'mest... |
# Surround data with 9s so we don't have to take special care of edges while identifying low points
# Since it's a 9, even low points on the actual edges remain low points.
with open("data.txt") as f:
data = [[9] + [int(e) for e in row] + [9] for row in [list(x[:-1]) for x in f.readlines()]]
data = [[9] * (len... |
# coding: utf-8
# Copyright (c) 2016, 2022, Oracle and/or its affiliates. All rights reserved.
# This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may c... |
# -*- coding: utf-8 -*-
from rest_framework import serializers
from .models import Country, Event
class CountrySerializer(serializers.ModelSerializer):
class Meta:
model = Country
fields = ["id", "name", "url"]
class EventSerializer(serializers.ModelSerializer):
latitude = serializers.Decim... |
'''
/*
* Copyright 2010-2017 Amazon.com, Inc. or its affiliates. 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.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "... |
import uuid
import hashlib
import hmac
from binascii import hexlify
import math
import base64
from Crypto.Cipher import PKCS1_v1_5
from Crypto.PublicKey.RSA import construct
def generate_nonce():
""" generate random clientside nonce """
return uuid.uuid4().hex + uuid.uuid4().hex
def get_client_pr... |
# Generated by Django 3.1.7 on 2021-10-27 17:39
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('donations', '0016_auto_20210522_1336'),
]
operations = [
migrations.CreateModel(
name='Donor',
... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import re
import random
import sys
import unicodedata
import my_conexion
sys.stdout.encoding
'UTF-8'
# PROCESAR MENSAJE DE USUARIO
def generarRespuesta(mensaje, STATES, username):
message_=sinAcentos(mensaje)
ans=''
ve... |
from binascii import hexlify
from fixtures import * # noqa: F401,F403
from fixtures import TEST_NETWORK
from flaky import flaky # noqa: F401
from pyln.client import RpcError, Millisatoshi
from pyln.proto.onion import TlvPayload
from pyln.testing.utils import EXPERIMENTAL_DUAL_FUND
from utils import (
DEVELOPER, w... |
# Copyright 2019 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... |
"""
VRChat API Documentation
The version of the OpenAPI document: 1.6.8
Contact: me@ruby.js.org
Generated by: https://openapi-generator.tech
"""
import re # noqa: F401
import sys # noqa: F401
from vrchatapi.model_utils import ( # noqa: F401
ApiTypeError,
ModelComposed,
ModelNormal,
... |
x = "python"
print(x.startswith("P"))
print(x.startswith("p")) # Return True if x starts with the specified prefix, False otherwise
print(x.endswith("P")) # Return True if x ends with the specified suffix, False otherwise
print(x.endswith('n'))
print(x.islower()) # Return True if the string is a lowercase string, ... |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2014-2019 Edgewall Software
# All rights reserved.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution. The terms
# are also available at http://trac.edgewall.com/license.html.
#
# This software consists ... |
import curses
if __name__ == "__main__":
print("Ejecutar el archivo main.py")
height, width = 1, 1
def set_size(stdscr):
global height, width
height, width = stdscr.getmaxyx()
def center_print(stdscr, text, y):
global height, width
t_len = len(text)
x = width // 2 - t_len // 2
stdscr.... |
""" Functions for moving clusters experiment. """
import itertools as it
import sys
import ciw
import dask
import numpy as np
import pandas as pd
import tqdm
from ciw.dists import Exponential
from dask.diagnostics import ProgressBar
from util import (
COPD,
DATA_DIR,
MAX_TIME,
NUM_SERVERS,
PROPS,... |
#!/usr/bin/env python3
# coding=utf-8
"""A utility to write a raw vendor/data files to AWS S3.
To use this utility you will need to ensure that your AWS credentials
are available via expected environment variables. Please refer to
the AWS boto3 documentation, which describes this: -
https://boto3.amazonaws.com/v... |
from __future__ import print_function, division
import sys
import os
import torch
import numpy as np
import random
import csv
from torch.utils.data import Dataset, DataLoader
from torchvision import transforms, utils
from torch.utils.data.sampler import Sampler
from pycocotools.coco import COCO
import skimage.io
imp... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.