text stringlengths 1 927k |
|---|
#!/bin/python3
import os
# Complete the 'simpleArraySum' function below.
#
# The function is expected to return an INTEGER.
# The function accepts INTEGER_ARRAY ar as parameter.
# Solution 1:
# def simpleArraySum(ar):
# res = 0
# for i in ar:
# res += i
# return res
# Solution 2:
def simpleArra... |
# Copyright 2021 kubeflow.org.
#
# 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,... |
# Import all the modules required
import hashlib
import json
import multiprocessing
import os
import subprocess
import sys
import time
# import logging function
from . import logger
log = logger.log
#****************************#
# Utility functions
#****************************#
def getTime(format=None):
''' Ret... |
#!/usr/bin/env python3
import sys,os,argparse,pickle,re,numpy
import functools
#***************************************************************************************************************
#* Log of change *
#* Januar... |
# Copyright [yyyy] [name of copyright owner]
# Copyright 2020 Huawei Technologies Co., Ltd
#
# 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.or... |
from bite_003 import load_words, calc_word_value, max_word_value
words = load_words()
def test_load_words():
assert len(words) == 235886
assert words[0] == 'A'
assert words[-1] == 'Zyzzogeton'
assert ' ' not in ''.join(words)
def test_calc_word_value():
assert calc_word_value('bob') == 7
as... |
import datetime
current_weight = 220
goal_weight = 180
avg_lbs_week = 2
start_date = datetime.date.today()
end_date = start_date
while current_weight > goal_weight:
end_date += datetime.timedelta(days=7)
current_weight -= avg_lbs_week
print(end_date)
print(f'Reached goal in {(end_date - start_date).days // ... |
# Python imports
from typing import Optional
from typing import List
from typing import Union
from typing import Any
import numpy as np
import mimetypes
import weakref
# Deeplodocus imports
from deeplodocus.utils.notification import Notification
from deeplodocus.utils.generic_utils import get_int_or_float
from deeplo... |
'''
Created by auto_sdk on 2017.05.15
'''
from top.api.base import RestApi
class AlibabaAliqinFcSmsNumSendRequest(RestApi):
def __init__(self,domain='gw.api.taobao.com',port=80):
RestApi.__init__(self,domain, port)
self.extend = None
self.rec_num = None
self.sms_free_sign_name = None
self.sms_param = None
... |
# -*- coding: utf-8 -*-
# Copyright 2017 IBM RESEARCH. 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 requ... |
# -*- coding: utf-8 -*-
# Spearmint
#
# Academic and Non-Commercial Research Use Software License and Terms
# of Use
#
# Spearmint is a software package to perform Bayesian optimization
# according to specific algorithms (the “Software”). The Software is
# designed to automatically run experiments (thus the code name
... |
import requests
import sys
import re
def get_merged_pull_reqs_since_last_release(token):
"""
Get all the merged pull requests since the last release.
"""
stopPattern = r"^(r|R)elease v"
pull_reqs = []
found_last_release = False
page = 1
print("Getting PRs since last release.")
whi... |
import sympy.physics.mechanics as me
import sympy as sm
import math as m
import numpy as np
x, y = me.dynamicsymbols('x y')
a, b, r = sm.symbols('a b r', real=True)
eqn = sm.Matrix([[0]])
eqn[0] = a*x**3+b*y**2-r
eqn = eqn.row_insert(eqn.shape[0], sm.Matrix([[0]]))
eqn[eqn.shape[0]-1] = a*sm.sin(x)**2+b*sm.cos(2*y)-r*... |
import uuid
from django import template
from django.forms.widgets import Media
from django.utils.safestring import mark_safe
from django.core.urlresolvers import reverse
from settings import PROGRESSBARUPLOAD_INCLUDE_JQUERY
register = template.Library()
@register.simple_tag
def progress_bar():
"""
progress... |
#
# 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 us... |
# -*- coding: utf-8 -*-
import click
from click._bashcomplete import get_choices
def test_basic():
@click.group()
@click.option('--global-opt')
def cli(global_opt):
pass
@cli.command()
@click.option('--local-opt')
def sub(local_opt):
pass
assert list(get_choices(cli, 'lol... |
# -*- coding: utf-8 -*-
"""
Created on Tue May 5 16:26:25 2015
@author: mweier
"""
import numpy as np
from numba import jit
@jit
def channelBuilder(wsDepth, rightSS, leftSS, widthBottom):
"""
Builds trapziodal channel station/elevation array given depth,
right side slope, left side slope, and bottom wi... |
from boltons.strutils import slugify
from django.db import models
from quiggler.constants import QUILT_TYPES, QUILT_TYPES_DEFAULT
class SlugModel(models.Model):
slug = models.SlugField(primary_key=True, unique=True, editable=False)
name = models.CharField(max_length=255)
class Meta:
abstract = T... |
# Copyright (c) 2020 Huawei Technologies Co.,Ltd.
#
# openGauss is licensed under Mulan PSL v2.
# You can use this software according to the terms and conditions of the Mulan PSL v2.
# You may obtain a copy of Mulan PSL v2 at:
#
# http://license.coscl.org.cn/MulanPSL2
#
# THIS SOFTWARE IS PROVIDED ON AN "AS IS... |
import json
from django.core.urlresolvers import reverse
from django.shortcuts import render
from django.views.generic import FormView, CreateView, DetailView
from sirtrevor import SirTrevorContent
from .forms import ContentForm, ContentModelForm
from .models import Content
TEST_CONTENT = {
"data": [
{
... |
#!/usr/bin/env python3
#
# Copyright (c) 2019 Roberto Riggio
#
# 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 applicabl... |
# -*- 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 ------------------------------------------------------------... |
# Generated by Django 3.1.7 on 2021-04-02 17:44
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('profiles', '0001_initial'),
('checkout', '0003_auto_20210402_1428'),
]
operations = [
migrations.Ad... |
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
"""
Modules to compute the matching cost and solve the corresponding LSAP.
"""
import torch
from scipy.optimize import linear_sum_assignment
from torch import nn
from util.box_ops import box_cxcywh_to_xyxy, generalized_box_iou
class HungarianMatc... |
# -*- coding: utf-8 -*-
'''
DigitalOcean Cloud Module v2
============================
The DigitalOcean cloud module is used to control access to the DigitalOcean
VPS system.
Use of this module only requires the ``personal_access_token`` parameter to be set. Set up the
cloud configuration at ``/etc/salt/cloud.provider... |
# encoding: utf-8
def Fib(n):
if n == 0:
return 0
elif n == 1:
return 1
elif n >= 2:
return Fib(n - 1) + Fib(n - 2)
def sequence(n):
seq = []
for num in range(n + 1):
seq.append(Fib(num))
print seq
if __name__== "__main__":
sequence(20) |
# pylint: disable=no-member, no-name-in-module, import-error
from __future__ import absolute_import
import glob
import os
import distutils.command.sdist
import distutils.log
import subprocess
from setuptools import Command, setup
import setuptools.command.sdist
# Patch setuptools' sdist behaviour with distutils' sdis... |
# 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 -*-
# PLEASE DO NOT EDIT THIS FILE, IT IS GENERATED AND WILL BE OVERWRITTEN:
# https://github.com/ccxt/ccxt/blob/master/CONTRIBUTING.md#how-to-contribute-code
from ccxt.base.exchange import Exchange
import hashlib
from ccxt.base.errors import ExchangeError
from ccxt.base.errors import Authenticati... |
from django.core.mail import EmailMultiAlternatives
from django.dispatch import receiver
from django.template.loader import render_to_string
from django.urls import reverse
from django.conf import settings
from decouple import config
from django_rest_passwordreset.signals import reset_password_token_created
from django... |
"""
Copyright (c) 2016-2019 Keith Sterling http://www.keithsterling.com
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, m... |
# Generated by Django 3.2.6 on 2021-11-19 11:25
from django.db import migrations, models
import django.db.models.deletion
from django.conf import settings
class Migration(migrations.Migration):
dependencies = [
('receitas', '0001_initial'),
]
operations = [
migrations.AddField(
... |
# del global
x = 1
print(x)
del x
try:
print(x)
except NameError:
print("NameError")
try:
del x
except: # NameError:
# FIXME uPy returns KeyError for this
print("NameError")
class C:
def f():
pass |
"""Maths related filter definitions."""
import math
import decimal
from typing import Optional
from typing import Union
from liquid.context import is_undefined
from liquid.exceptions import FilterArgumentError
from liquid.filter import math_filter
from liquid.filter import num_arg
from liquid.filter import int_arg
... |
from collections import namedtuple
from typing import List, Optional
from django.conf import settings
from django.core.exceptions import ValidationError
from django.core.mail import EmailMultiAlternatives
from django.db import models
from django.template import Template, TemplateSyntaxError, engines
from django.urls i... |
#
# Copyright 2019 NXP
# SPDX-License-Identifier: Apache-2.0
#
#
# This script is used to provision key and certificate to secure element.
# These Provisioned keys and certificates are used in azure demo
from .Provision_util import *
from . import cloud_credentials
def reset_and_update(cur_dir, keypair_index_priva... |
# !/usr/bin/env python
"""
ExcisionFinder identifies allele-specific excision sites. Written in Python version 3.6.1.
Kathleen Keough et al 2017-2018.
Note: This version of the script is intended only for analysis of large cohorts, particularly the
1000 Genomes cohort. There is a more general purpose script for small... |
# -*- coding: utf-8 -*-
"""
Created on Thu Jul 19 17:54:29 2018
@author: ujejskik
"""
from bs4 import BeautifulSoup, SoupStrainer
from urllib.request import urlopen
import urllib.request as ul
from urllib.parse import urlparse, urljoin
import time
import tkinter
from tkinter.filedialog import askopenfilename
import p... |
#!/usr/bin/env python
# coding: utf-8
import json
import ast
from tqdm import tqdm
import torch
from transformers import BartForConditionalGeneration, BartTokenizerFast
def evaluate(diagram_logic_file, text_logic_file, tokenizer_name, model_name, check_point, seq_num):
test_lst = range(2401, 3002)
## read... |
# Copyright 2022 Huawei Technologies Co., Ltd
#
# 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... |
files = [
"mkrvidor4000_top.sv"
]
modules = {
"git": [
"git@github.com:hdl-util/hdmi.git::master",
"git@github.com:hdl-util/sound.git::master",
"git@github.com:hdl-util/vga-text-mode.git::master",
"git@github.com:hdl-util/clock-domain-crossing.git::master"
],
"local" : [... |
# Copyright 2017 Deborah Kaplan
#
# 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... |
# Copyright (c) 2021, eQualit.ie inc.
# 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.
import logging
import os
import shutil
import gnupg
import certifi
import tarfile
from cryptography.hazmat.primitives import... |
# Copyright 2015 VMware, 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 a... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import os
import re
import json
import shutil
import git
from punica.exception.punica_exception import PunicaError, PunicaException
from punica.config.punica_config import InitConfig
from punica.utils.file_system import (
ensure_remove_dir_if_exists,
remove_file... |
# 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... |
import json
from datetime import date
from unittest import TestCase
from corehq.elastic import ESError, SIZE_LIMIT
from .es_query import HQESQuery, ESQuerySet
from . import filters
from . import forms, users
class ElasticTestMixin(object):
def checkQuery(self, query, json_output):
msg = "Expected Query:\... |
import numpy as np
from gym.spaces import Box
from metaworld.envs.env_util import get_asset_full_path
from metaworld.envs.mujoco.sawyer_xyz.sawyer_xyz_env import SawyerXYZEnv, _assert_task_is_set
class SawyerLeverPullEnv(SawyerXYZEnv):
def __init__(self):
hand_low = (-0.5, 0.40, -0.15)
hand_hig... |
from leapp.utils.meta import with_metaclass
from leapp.workflows.flags import Flags
from leapp.workflows.policies import Policies
class PhaseMeta(type):
classes = []
def __new__(mcs, name, bases, attrs):
klass = super(PhaseMeta, mcs).__new__(mcs, name, bases, attrs)
PhaseMeta.classes.append(k... |
from sdk import meta
old = "this is a string"
print(meta("const neww = old.substr(0, 2);", "javascript", {"old":old}, ["neww"])) |
from django.db import models
# Create your models here.
class Comment(models.Model):
name = models.CharField(max_length=100)
email = models.EmailField(max_length=255)
url = models.URLField(blank=True)
text = models.TextField()
created_time = models.DateTimeField(auto_now_add=True)
post = mode... |
import sys
from pathlib import Path
import h5py
import numpy as np
import matplotlib.pyplot as plt
TWOTHETA_KEYS = ["2th", "2theta", "twotheta"]
Q_KEYS = ["q"]
INTENSITY_KEYS = ["i", "intensity", "int"]
STACK_INDICES_KEY = "stack_indices"
DPI = 300
FIGSIZE = (12,4)
FONTSIZE_LABELS = 20
FONTSIZE_TICKS = 14
LINEWIDTH ... |
import matplotlib.pyplot as plt
from matplotlib_scalebar.scalebar import ScaleBar
from matplotlib_scalebar.dimension import _Dimension, _PREFIXES_FACTORS, _LATEX_MU
class TimeDimension(_Dimension):
def __init__(self):
super().__init__("s")
for prefix, factor in _PREFIXES_FACTORS.items():
... |
"""Core control stuff for Coverage."""
import atexit, os, random, socket, sys
from coverage.annotate import AnnotateReporter
from coverage.backward import string_class, iitems, sorted # pylint: disable=W0622
from coverage.codeunit import code_unit_factory, CodeUnit
from coverage.collector import Collector
from cover... |
import datetime
import os
from azure.keyvault.secrets import SecretClient
from azure.identity import DefaultAzureCredential
from azure.core.exceptions import HttpResponseError
# ----------------------------------------------------------------------------------------------------------
# Prerequistes -
#
# 1. An Azure K... |
# desafio 026: Faça um programa que leia uma frase pelo teclado e mostre quantas vezes aparece a letra "A", em que posição ela aparece a
# primeira vez e em que posição ela aparece a última vez.
autor = input('Digite o seu autor preferido: ').strip()
autor_lower = (autor.lower())
quantidade = (autor_lower.count('a'))
... |
from dataclasses import dataclass
from typing import List, Optional
from goji.types.blockchain_format.proof_of_space import ProofOfSpace
from goji.types.blockchain_format.reward_chain_block import RewardChainBlock
from goji.types.blockchain_format.sized_bytes import bytes32
from goji.types.blockchain_format.vdf import... |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "testdj.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
... |
"""
Script calculates sea ice extent in the Bering Sea from SIC fields
Notes
-----
Author : Zachary Labe
Date : 12 March 2018
"""
### Import modules
import numpy as np
from netCDF4 import Dataset
import matplotlib.pyplot as plt
import datetime
import statsmodels.api as sm
### Define directories
directorydat... |
# pylint: disable=C0103,W0613,R0201
from abc import ABC
from pathlib import Path
from typing import Dict, List
import attr
from marshmallow import EXCLUDE, Schema, fields, post_load
from shapely import geometry
__all__ = (
"Point",
"PointSchema",
"Polygon",
"PolygonSchema",
"Space",
"SpaceSch... |
#!/usr/bin/env python3
# Copyright (c) 2019 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 the wallet implicit segwit feature."""
import test_framework.address as address
from test_framework.te... |
# -*- coding: utf-8 -*-
# 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, softw... |
from setuptools import setup, find_packages
from shutil import copyfile
import os
def get_long_description():
this_directory = os.path.abspath(os.path.dirname(__file__))
with open(os.path.join(this_directory, 'README.md')) as f:
long_description = f.read()
return long_description
def copy_do... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# esh5or documentation build configuration file, created by
# sphinx-quickstart on Tue Jul 9 22:26:36 2013.
#
# 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
# auto... |
from corpus_builder.rule import Rule
from corpus_builder.grammar import Grammar
from corpus_builder.builder import CorpusBuilder
root_rule = Rule('<S>', ('<A>', '<B>'))
a_rule = Rule('<A>', ['a', '<B>'])
b_rule = Rule('<B>', ('<A>', 'b', '<C>'))
c_rule = Rule('<C>', 'c')
rule_set = [root_rule, a_rule, b_rule, c_rule]... |
# -*- coding: utf-8 -*-
"""
A class for working with a collection of spaCy docs. Includes functionality for
easily adding, getting, and removing documents; saving to / loading their data
from disk; and tracking basic corpus statistics.
"""
from __future__ import absolute_import, division, print_function, unicode_litera... |
""" Created by Max 10/4/2017 """
from __future__ import division
import random
import math
from typing import Dict, Tuple, List
class CrossValidation:
def __init__(self, folds, learner):
"""
Constructor
:param folds: num folds
:param learner: the k-NN algorithm to use.
""... |
import yaml
import os
import pytest
from ..greeter import greet
def read_fixture():
with open(os.path.join(os.path.dirname(__file__),
'fixtures',
'samples.yaml')) as fixtures_file:
fixtures = yaml.load(fixtures_file)
return fixtures
@pytest.mark.pa... |
##########################################################################
#
# Copyright (c) 2012, Image Engine Design 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:
#
# * Redistribu... |
from .explain_mro_failure import * |
#!/usr/bin/env python
# -*- coding: utf-8 -*- #
from __future__ import unicode_literals
import os
AUTHOR = 'Jonathan'
SITENAME = 'My Blog'
SITEURL = 'https://jonathan-zz-zhao.github.io/'
PATH = 'content'
STATIC_PATHS = ['images']
TIMEZONE = 'America/Toronto'
DEFAULT_LANG = 'en'
DEFAULT_PAGINATION = 10
# set to False ... |
# Plot_Mission.py
#
# Created: May 2015, E. Botero
# Modified:
# ----------------------------------------------------------------------
# Imports
# ----------------------------------------------------------------------
import SUAVE
from SUAVE.Core import Units
import pylab as plt
# ----------------... |
s = 0
for i in range(101):
s += i
print("Suma liczb od 1 do 100 to: ", s) |
"""Support for AlarmDecoder-based alarm control panels (Honeywell/DSC)."""
import voluptuous as vol
from homeassistant.components.alarm_control_panel import (
FORMAT_NUMBER,
AlarmControlPanelEntity,
AlarmControlPanelEntityFeature,
)
from homeassistant.config_entries import ConfigEntry
from homeassistant.co... |
#!/usr/bin/env python3
#! -*- coding: utf-8 -*-
# Imports
## Standard: Mandatory generic modules
import sys
import logging
import json
import time
## External
import requests
import urllib3
## Custom
from wesp9Lib.statisticModels import wirlessClientStatistics
# Create logger
logger = logging.getLogger(__name__)
... |
#! /usr/bin/env python
# coding: utf-8
# $Id: test_html4css1_misc.py 8356 2019-08-26 16:44:19Z milde $
# Authors: Lea Wiemann, Dmitry Shachnev, Günter Milde
# Maintainer: docutils-develop@lists.sourceforge.net
# Copyright: This module has been placed in the public domain.
"""
Miscellaneous HTML writer tests.
"""
from... |
"""
DIRBS DB schema migration script (v84 -> v85).
Copyright (c) 2018-2021 Qualcomm Technologies, Inc.
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted (subject to the
limitations in the disclaimer below) provided that the following conditions are me... |
import torch
import torch.nn as nn
from torch.nn import init
import functools
from torch.autograd import Variable
import numpy as np
from .basic_layers import ResidualBlock
from .attention_module import AttentionModule
class ResidualAttentionModel(nn.Module):
def __init__(self, in_channels=3, num_classes=1000):
... |
"""
"""
import math
from typing import Callable, Optional
import datetime
import pandas as pd
from dashboard.kpi.base import BaseKPI, KpiZone, get_current_week, get_recent_weeks
from dashboard.data import WeeklyStats
from dashboard.load import PomodorosProcessed
from dashboard.config import Config
class WeeklyDoneK... |
# 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 ... |
{
"targets": [
{
"target_name": "crypt32",
"cflags!": [
"-fno-exceptions"
],
"cflags_cc!": [
"-fno-exceptions"
],
"sources": [
"crypt32.cc"
],
"include_dirs": [
"<!@(node -p \"require('node-addon-api').include\")"
],
"defi... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.FileItem import FileItem
from alipay.aop.api.constant.ParamConstants import *
from alipay.aop.api.domain.RegionInfo import RegionInfo
class AlipayOpenMiniVersionAuditApplyRequest(object):
def __init__(self, biz_model=None):
... |
def leiadinheiro(msg):
valido = False
while not valido:
entrada = str(input(msg)).replace(',', '.').strip()
if entrada.isalpha() or entrada == '':
print('Preço inválido')
else:
valido = True
return float(entrada) |
'''
python3 reduces.py
python3 watch_file.py -p2 python3 reduces.py -p1 ./reinstall_from_source.sh -d /Users/bennettbullock/python-pype-lang-3
'''
from pype3 import pypeify,pypeify_namespace,p,_,_0,_1,_2,_last
from pype3 import ep,db,a,iff,d,ift,squash,ifp
from pype3.time_helpers import *
from pype3.helpers import *
... |
import json
from datetime import datetime
from django.contrib.sites.models import Site
from django.db.models import Q
from django.http import Http404, HttpResponse, JsonResponse
from django.shortcuts import get_object_or_404, redirect
from django.template.loader import render_to_string
from django.urls import reverse
... |
# Copyright 2022 AI Singapore
#
# 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing... |
# -*- 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 django.db import models
import os
# Create your models here.
import datetime as dt
from django.utils import timezone
from cloudinary.models import CloudinaryField
from django.contrib.auth.models import User
from allprojects.models import User
from django.db import models
# .............
from PIL import Image
... |
""":mod:`wand.version` --- Version data
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
You can find the current version in the command line interface:
.. sourcecode:: console
$ python -m wand.version
0.0.0
$ python -m wand.version --verbose
Wand 0.0.0
ImageMagick 6.7.7-6 2012-06-03 Q16 http://www.imagemagick... |
"""Generated client library for deploymentmanager version v2."""
# NOTE: This file is autogenerated and should not be edited by hand.
from apitools.base.py import base_api
from googlecloudsdk.third_party.apis.deploymentmanager.v2 import deploymentmanager_v2_messages as messages
class DeploymentmanagerV2(base_api.Base... |
from django.contrib.auth.models import AbstractUser
from django.db import models
from django.db.models.fields import BooleanField
from django.db.models.fields.related import ForeignKey, ManyToManyField
class User(AbstractUser):
pass
class Category(models.Model):
class Meta:
verbose_name_plural = "cate... |
# This file was automatically created by FeynRules 2.3.35
# Mathematica version: 12.1.0 for Linux x86 (64-bit) (March 18, 2020)
# Date: Tue 18 Aug 2020 11:58:03
from object_library import all_orders, CouplingOrder
QCD = CouplingOrder(name = 'QCD',
expansion_order = 99,
hierar... |
"""@package command
Handle building, listing, and showing WQt projects
"""
import os
import shutil
import subprocess
from colorama import Fore
from wqt.command import creation
from wqt.command.creation import (
update
)
from wqt.command.resource import (
get_configuration,
set_configuration
)
from wqt.te... |
import ipaddress
from dataclasses import dataclass
from typing import Optional, Union
from caldera.util.ints import uint16, uint64
from caldera.util.streamable import Streamable, streamable
@dataclass(frozen=True)
@streamable
class PeerInfo(Streamable):
host: str
port: uint16
def is_valid(self, allow_pr... |
#!/usr/bin/env python3
from config import read_config
import typing as tp
import threading
import logging
import json
import time
import pika
import robonomicsinterface as RI
def callback(ch, method, properties, body) -> None:
"""
get data from sensors and save it to dictionary
"""
data = body.decod... |
import pyblish.api
class AvalonSceneReady(pyblish.api.ContextPlugin):
"""標記場景為預備狀態
場景在被標記為預備狀態之後,如果有任何物件或數值的更動,狀態就會失效
"""
"""Define current scene in ready state
Collecte current undo count for later validation.
"""
order = pyblish.api.CollectorOrder + 0.49999
label = "進入預備狀態"
... |
#!/usr/bin/env python3
import rospy
from std_msgs.msg import Int32
n = 0
def cb(message):
global n
n = message.data*2
rospy.init_node('twice')
sub = rospy.Subscriber('count_up', Int32, cb)
pub = rospy.Publisher('twice', Int32, queue_size=1)
rate = rospy.Rate(10)
while not rospy.is_shutdown():
pub.publis... |
import unittest
import numpy as np
import os
import inspect
from Java_Connection import Java_Connection
from Model_Manager.Link_Model_Manager import Link_Model_Manager_class
from Data_Types.Demand_Assignment_Class import Demand_Assignment_class
from Traffic_States.Static_Traffic_State import Static_Traffic_State_class
... |
from traction_1d import *
import numpy as np
from utils import ColorPrint
# ell_list = np.linspace(.1, .5, 20)
# ell_min = 0.1
#ell_max = 2.
ell_list = np.logspace(np.log10(.15), np.log10(1.5), 20)
def t_stab(ell, q=2):
coeff_stab = 2.*np.pi*q/(q+1)**(3./2.)*np.sqrt(2)
if 1/ell > coeff_stab:
return 1.
else:
re... |
#!/usr/bin/env python2
# Copyright (c) 2014-2015 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 merkleblock fetch/validation
#
from test_framework.test_framework import BitcoinTestFramework
f... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.