text stringlengths 2 999k |
|---|
#!/usr/bin/env python
"""
Download utility as an easy way to get file from the net
python -m wget <URL>
python wget.py <URL>
Downloads: http://pypi.python.org/pypi/wget/
Development: http://bitbucket.org/techtonik/python-wget/
wget.py is not option compatible with Unix wget utility,
to make command line interfac... |
import tkinter as tk
import os
import random
import string
import re
from tkinter import filedialog
from tkinter import *
from PIL import Image, ImageTk, ImageOps
from guest import Guest
from guest_manager import *
class CapabilityFive:
def __init__(self, frame, guest_id):
self.frame = frame
self.... |
import FWCore.ParameterSet.Config as cms
process = cms.Process("PROD")
process.load("SimGeneral.HepPDTESSource.pythiapdt_cfi")
process.load("IOMC.EventVertexGenerators.VtxSmearedFlat_cfi")
process.load("Geometry.ForwardCommonData.totemTest2015_cff")
process.load("Configuration.StandardSequences.MagneticField_cff")
pro... |
#from Instrucciones.instruccion import Instruccion
from tytus.parser.fase2.team21.Analisis_Ascendente.Instrucciones.expresion import Id
from tytus.parser.fase2.team21.Analisis_Ascendente.Instrucciones.instruccion import Instruccion
from tytus.parser.fase2.team21.Analisis_Ascendente.Instrucciones.Expresiones.Expresion i... |
import sys
import unittest
import pythoncom
from win32com.client import Dispatch
from win32com.client.gencache import EnsureDispatch
class PippoTester(unittest.TestCase):
def setUp(self):
from win32com.test.util import RegisterPythonServer
from win32com.test import pippo_server
RegisterPyth... |
# The MIT License (MIT)
# Copyright (c) 2016, 2017 by the ESA CCI Toolbox development team and contributors
#
# 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 wi... |
import os
import sys
import re
import contextlib
from bson.objectid import ObjectId
from Qt import QtGui
from avalon import io
from openpype.pipeline import switch_container
from .pipeline import get_current_comp, comp_lock_and_undo_chunk
self = sys.modules[__name__]
self._project = None
def update_frame_range(sta... |
from fastapi import Body, FastAPI
from pydantic import BaseModel
app = FastAPI()
class Item(BaseModel):
name: str
description: str = None
price: float
tax: float = None
class User(BaseModel):
username: str
full_name: str = None
@app.put("/items/{item_id}")
async def update_item(
*,
... |
# -*- coding: utf-8 -*-
'''
Test the hosts module
'''
# Import python libs
from __future__ import absolute_import
import os
import shutil
# Import Salt Testing libs
from salttesting.helpers import ensure_in_syspath
ensure_in_syspath('../../')
# Import salt libs
import integration
import salt.utils
HFN = os.path.join... |
# get_basin_medians.py
# This script creates a shapefile of the basins along the SAF and gets the median channel gradient,
# hillslope gradient and hilltop curvature in each basin
# FJC 14/06/21
# import modules
import pandas as pd
import geopandas as gpd
import numpy as np
from shapely.geometry import Point
def perc... |
from datetime import datetime
from django.contrib.auth.models import User
from django.db.models import Count
from careers.forms import JobPostForm
from careers.models import JobPost
from mezzanine import template
register = template.Library()
@register.as_tag
def jobpost_months(*args):
"""
Put a list of d... |
"""
$Id: loggingrli.py,v 1.41 2006/04/24 14:49:23 jp Exp $
"""
import plastk.rl
from plastk.rl import RLI
from plastk.params import Parameter
from plastk import rand
#from Scientific.IO.NetCDF import NetCDFFile
from scipy.io.netcdf import netcdf_file as NetCDFFile
import time,sys,threading,os
NewColumn = 'new column'... |
# -*- coding: utf-8 -*-
"""MedleyDB pitch Dataset Loader
.. admonition:: Dataset Info
:class: dropdown
MedleyDB Pitch is a pitch-tracking subset of the MedleyDB dataset
containing only f0-annotated, monophonic stems.
MedleyDB is a dataset of annotated, royalty-free multitrack recordings.
Medley... |
#!/usr/bin/env python3
from pvweather import WeatherData
from pvbasemodul import PVBaseModul
import datetime
import pytz
import sys
import requests
import math
local = pytz.timezone("Europe/Berlin")
class PVWeather(PVBaseModul):
enabled = False
url = "http://127.0.0.1/weatherdata.json"
use... |
from datetime import datetime
class Block(object):
def __init__(self, block_id, block_ntime, block_chain_work, block_num_tx, btc=False):
self.block_id = block_id
self.block_ntime = int(block_ntime)
self.time = datetime.fromtimestamp(int(self.block_ntime))
self.time_str = self.time... |
import unittest
class ErrorStoreAsserts(unittest.TestCase):
def assert_errors(self, store):
errors = [["Error1", "aiml1.xml", "100", "200"],
["Error1", "aiml2.xml", "200", "300"]]
store.save_errors(errors)
|
import io
import mock
import unittest
import zipfile
from cumulusci.core.config import OrgConfig
from cumulusci.core.config import TaskConfig
from cumulusci.core.exceptions import ServiceNotConfigured
from cumulusci.tasks.salesforce import BaseRetrieveMetadata
from cumulusci.tasks.salesforce import BaseSalesforceTask
... |
# Copyright © 2019 Province of British Columbia
#
# 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... |
# Copyright 2011 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 ... |
#!/usr/bin/env python
# $Id$
#
# Copyright (c) 2000-2015 Board of Trustees of Leland Stanford Jr. University,
# all rights reserved.
#
# 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 Softw... |
from unittest import TestCase
from regulations3k.documents import SectionParagraphDocument
from regulations3k.models import (
EffectiveVersion, Part, Section, SectionParagraph, Subpart
)
class SectionParagraphDocumentTest(TestCase):
def test_prepare(self):
part = Part(cfr_title_number="0001",
... |
import pytest
from aws_sfn_builder import ResourceManager, State
@pytest.fixture
def jsp_resource_resolver():
resources = ResourceManager()
return resources.resolve
@pytest.mark.parametrize("input,expected", [
[
{"status": "FAILED"},
("Job Failed", {"status": "FAILED"}),
],
[
... |
#!/usr/bin/env python3
import asyncio
import collections
import copy
import io
import math
import numpy as np
import random
import sys
import torch
import torch.distributed as dist
import os.path
import config
import model
import dataStorage
#Deep MCCFR
#based on this paper
#https://arxiv.org/pdf/1811.00164.pdf
#t... |
import pytest
from pandas.testing import assert_series_equal
import reciprocalspaceship as rs
@pytest.mark.parametrize(
"dataseries",
[
(rs.DataSeries(range(10), dtype=rs.PhaseDtype()), "P"),
(rs.DataSeries(range(10), dtype=rs.HKLIndexDtype()), "H"),
(rs.DataSeries(range(10), name="Ph... |
from django.http import JsonResponse
from .serializer import *
from .models import Rol
from rest_framework.views import APIView
from rest_framework import generics, viewsets
class RolViewSet(viewsets.ModelViewSet):
serializer_class = ModelRolSerializer
queryset = Rol.objects.all()
class ModuloRolViewSet(vie... |
import urlparse
import requests
import json
import logging
import unicodedata
import re
import uuid
from string import Template
import mimetypes
from ckan import logic
from ckan import model
from ckan.model import Session
from ckanext.harvest.model import HarvestObject
from ckanext.harvest.model import HarvestObjectEx... |
# Copyright The OpenTelemetry 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 or agreed to in ... |
import numpy as np
import torch
import gym
import os
from general import get_logger, Progbar, export_plot
from baseline_network import BaselineNetwork
from network_utils import build_mlp, device, np2torch
from policy import CategoricalPolicy, GaussianPolicy
class PolicyGradient(object):
"""
Class for implemen... |
"""Environment file for behave
Selenium grid may be set here too.
TODO: This is deactivated for Alpha-5"""
import logging
LINE_LENGTH = 42
PASSED = "passed"
FAILED = "failed"
def before_all(context):
# Setup logging for SLAYER, according to behave API reference:
# http://python-behave.readthedocs.io/en/latest... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Create the word stems of the individual words of the tweet.
Created on Wed Oct 6 16:32:45 2021
@author: laura
"""
from code.preprocessing.preprocessor import Preprocessor
from code.util import TOKEN_DELIMITER
from nltk.stem import PorterStemmer
class Stemmer(Prepr... |
from selenium.common.exceptions import WebDriverException
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from keywordgroup import KeywordGroup
class _AlertKeywords(KeywordGroup):
def __init__(self):
self._cancel_on_next_co... |
# Copyright 2018 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... |
# Copyright 2019-2021 Axis Communications AB.
#
# For a full list of individual contributors, please see the commit history.
#
# 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... |
"""Support for Ecobee binary sensors."""
from homeassistant.components.binary_sensor import (
DEVICE_CLASS_OCCUPANCY,
BinarySensorDevice,
)
from .const import _LOGGER, DOMAIN, ECOBEE_MODEL_TO_NAME, MANUFACTURER
async def async_setup_platform(hass, config, async_add_entities, discovery_info=None):
"""Old ... |
from my_package import A1
from my_package import A2
print(A2)
|
#!/usr/bin/env python
"""
Simple implementation for mixup. The loss and onehot functions origin from: https://github.com/moskomule/mixup.pytorch
Hongyi Zhang, Moustapha Cisse, Yann N. Dauphin, David Lopez-Paz: mixup: Beyond Empirical Risk Minimization
https://arxiv.org/abs/1710.09412
"""
__all__ = [ 'mixup_cross_ent... |
# -*- coding: utf-8 -*-
# Generated by Django 1.9 on 2018-05-16 20:55
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('operation', '0004_coursecomments_parent_id'),
]
opera... |
'''
Routing for standard pipe connections
Copyright (c) 2018 Gibbs Consulting and others - see CONTRIBUTIONS.md
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 with... |
# #####################################################################################################################
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. #
# ... |
# 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... |
"""
wiggle - Plot z=f(x,y) anomalies along tracks.
"""
from pygmt.clib import Session
from pygmt.helpers import build_arg_string, fmt_docstring, kwargs_to_strings, use_alias
@fmt_docstring
@use_alias(
B="frame",
D="position",
G="color",
J="projection",
R="region",
T="track",
U="timestamp",... |
import json
if __name__ == '__main__':
str = "I want to Remove all white \t spaces, new lines \n and tabs \t"
new_string = ' '.join(str.split())
print(new_string)
list = [1, 2, 3]
list.append(4)
# def return2():
# return 1,2
#
# one,two = return2()
# print(one)
# pri... |
# -*- coding: utf-8 -*-
"""
test_environment_toctree
~~~~~~~~~~~~~~~~~~~~~~~~
Test the sphinx.environment.managers.toctree.
:copyright: Copyright 2007-2017 by the Sphinx team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
from docutils import nodes
from docutils.nodes import bullet_lis... |
"""
templates for models
"""
MODEL = """class %s(models.Model):\
%s
create_date = models.DateTimeField(auto_now_add=True)
def __str__(self):
return f"%s"
class Meta:
verbose_name_plural = "%s"
"""
MODEL_IMPORT = """from %(app)s.models import %(model)s
"""
CHARFIELD = """
%(name... |
from typing import Any, Callable, Dict, List, Optional, Type, TypeVar
import attr
from ..types import UNSET
from ..util.serialization import is_not_none
T = TypeVar("T", bound="AuthResetPasswordRequest")
@attr.s(auto_attribs=True)
class AuthResetPasswordRequest:
"""
Attributes:
new_password (str):
... |
import sys
import unittest
import logging
import os
import time
from itertools import product
from lxml import etree as etree_
import datetime
import copy
from sdc11073 import pmtypes
from sdc11073 import namespaces
from sdc11073 import observableproperties
from sdc11073 import commlog
from sdc11073.wsdi... |
# Copyright 2021 The Magenta 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 or agreed to in ... |
import pyaf.Bench.TS_datasets as tsds
import pyaf.tests.artificial.process_artificial_dataset as art
art.process_dataset(N = 1024 , FREQ = 'D', seed = 0, trendtype = "LinearTrend", cycle_length = 0, transform = "RelativeDifference", sigma = 0.0, exog_count = 100, ar_order = 0); |
# Generated by Django 3.1.7 on 2021-03-24 21:04
import json
from django.db import migrations, models
from django.db.migrations.operations.special import RunPython
from django.utils.translation import gettext_lazy as _
import metaci.fields
# @@@ we may need to limit scratch org instances to those created in the past... |
from django.urls import path,include,reverse_lazy
from . import views
from django.contrib.auth import views as auth_views
app_name='account'
urlpatterns=[
#password reset urls
path('password_change/', auth_views.PasswordChangeView.as_view( success_url=reverse_lazy('account:password_change_done')), name='password_c... |
import pytest
import numpy as np
from ansys import dpf
from ansys.dpf.core import Scoping
import numpy as np
from ansys.dpf.core import errors as dpf_errors
from ansys.dpf.core.check_version import meets_version, get_server_version
serv = dpf.core.start_local_server('127.0.0.1', 50075)
SERVER_VERSION_HIGHER_THAN_2_0 ... |
from setuptools import setup, find_packages
with open("requirements.txt") as f:
install_requires = f.read().strip().split("\n")
# get version from __version__ variable in rma/__init__.py
from rma import __version__ as version
setup(
name="rma",
version=version,
description="Returns made simple",
author="Gross I... |
# coding=utf-8
# Copyright 2022 The Google Research 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 applicab... |
def color_code(color):
return colors().index(color)
def colors():
return [
"black",
"brown",
"red",
"orange",
"yellow",
"green",
"blue",
"violet",
"grey",
"white",
] |
##################################################
## A multi-process and multi-threaded driver #####
## that executes the specified query workload ####
## simulating concurrent user sessions querying ##
## recent and historical data ingested into ######
## the specified database and table in Timestream
###############... |
import unittest
from run import app
from config import test_token
class ResourceTest(unittest.TestCase):
def setUp(self):
self.app = app.test_client()
# Add metadata to the DB
query = '/admin_metadata/test_platform44'
payload = {
'platform_code': 'test_platform44',
... |
"""Collect and sort version strings."""
import re
RE_SEMVER = re.compile(r'^v?V?(\d+)(?:\.(\d+))?(?:\.(\d+))?(?:\.(\d+))?(?:\.(\d+))?(?:\.(\d+))?(?:\.(\d+))?([\w.+-]*)$')
def semvers(names):
"""Parse versions into integers and convert non-integer meta indicators into integers with ord().
Each return list i... |
# Copyright 2021 The Kubeflow 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 or agreed to in... |
# coding: utf-8
import re
import six
from huaweicloudsdkcore.utils.http_utils import sanitize_for_serialization
class CreateCertificateAuthorityRequest:
"""
Attributes:
openapi_types (dict): The key is attribute name
and the value is attribute type.
attribute_map ... |
""" Python client for making API requests to the Altmetrics service.
This will be used to fetch a JWT token using user login information, as well
as use this token to make further API requests.
This will be developed alongside the Altmetrics API to help use this service.
TODO: This should eventually live outside of ... |
# SPDX-License-Identifier: Apache-2.0
# Copyright Contributors to the Rez Project
"""
Default algorithms for searching for packages based on some criteria. Package
repository plugins may implement these algorithms instead, because they may be
able to search packages much faster - for example, in a database-based pack... |
import asyncio
import logging
import sys
from rsocket.payload import Payload
from rsocket.transports.aiohttp_websocket import websocket_client
async def application(serve_port):
async with websocket_client('http://localhost:%s' % serve_port) as client:
result = await client.request_response(Payload(b'pin... |
from __future__ import annotations
from sectograph import entities, datetime as dt
from .base_event import BaseEvent
class Event(BaseEvent):
def get(self) -> list[entities.Event]:
now = dt.app_now()
con = self.db.con
cur = con.cursor()
result = cur.execute(
"""
... |
from unittest.mock import patch
from django.core.management import call_command
from django.db.utils import OperationalError
from django.test import TestCase
class CommandTests(TestCase):
def test_wait_for_db_ready(self):
"""Test waiting for db when db is available"""
with patch('django.db.utils... |
"""meditate URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.11/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Class-b... |
import lue.framework as lfr
import lue_test
import numpy as np
def setUpModule():
lue_test.start_hpx_runtime()
def tearDownModule():
return
lue_test.stop_hpx_runtime()
class D8FlowDirectionTest(lue_test.TestCase):
@lue_test.framework_test_case
def test_overloads(self):
array_shape = ... |
# -*- coding: utf-8 -*-
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
# Flag to indicate if this migration is too risky
# to run online and needs to be coordinated for offline
... |
# vim: set fileencoding=utf-8
from django.conf.urls.defaults import *
from views import *
urlpatterns = patterns('',
url(r'^$',
questionnaire, name='questionnaire_noargs'),
url(r'^csv/(?P<qid>\d+)/$',
export_csv, name='export_csv'),
url(r'^(?P<runcode>[^/]+)/progress/$',
... |
N,nf=input().split()
N=int(N)
nf=int(nf)
count=0
while N>0:
n=int(input())
if n==nf:
count+=1
N-=1
print(count)
|
# coding=utf-8
import re
import sqlite3
import logging
import datetime
import requests
logging.basicConfig(level=logging.DEBUG)
class BaseDBHandler(object):
def __init__(self, db_path):
self.db_path = db_path
def execute_sql(self, *args):
conn, cursor = self.db_connection
if len(arg... |
"""Test dependency representation
"""
from copy import copy
from unittest.mock import Mock
from pytest import fixture, raises
from smif.metadata import RelativeTimestep, Spec
from smif.model.dependency import Dependency
@fixture(scope='function')
def dep():
"""Dependency with mocked models
"""
source_mod... |
# emacs: -*- mode: python-mode; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ##
#
# See COPYING file distributed along with the NiBabel package for the
# copyright and license terms.
#
### ### ### #... |
def c_to_f(Jimmy):
# Forumla = (c * 9/5) +32
# I took this formula from this link: http://contractor quote
f = (c * 9/5) + 32
return f
def c_to_k(Jimmy):
#Forumla = (c + 273.15 )
# I took this formula from this link: //contractor quote
k = (c + 273.15)
return k
def f_to_c(Jimmy):
#... |
from django.conf import settings
from storages.backends.s3boto import S3BotoStorage
class S3StaticStorage(S3BotoStorage):
"S3 storage backend that sets the static bucket."
def __init__(self, *args, **kwargs):
super(S3StaticStorage, self).__init__(
bucket=settings.AWS_STATIC_BUCKET_NAME,
... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from setuptools import setup, find_packages
from io import open
with open("README.md", "r", encoding="utf-8") as f:
long_description = f.read()
setup(
name="ufoLib2",
use_scm_version={"write_to": "src/ufoLib2/_version.py"},
description="ufoLib2 is a UFO f... |
# coding: utf-8
"""
Blog Post endpoints
\"Use these endpoints for interacting with Blog Posts, Blog Authors, and Blog Tags\" # noqa: E501
The version of the OpenAPI document: v3
Generated by: https://openapi-generator.tech
"""
import pprint
import re # noqa: F401
import six
from hubspot.cms.blo... |
"""Tests for the Mazda Connected Services integration."""
import json
from unittest.mock import AsyncMock, MagicMock, patch
from pymazda import Client as MazdaAPI
from homeassistant.components.mazda.const import DOMAIN
from homeassistant.const import CONF_EMAIL, CONF_PASSWORD, CONF_REGION
from homeassistant.core imp... |
# generated from genmsg/cmake/pkg-genmsg.context.in
messages_str = "/home/wade/SJTU-swarm/swarm_ws/src/swarm_robot/msg/pos_info.msg"
services_str = ""
pkg_name = "swarm_robot"
dependencies_str = "geometry_msgs;std_msgs"
langs = "gencpp;geneus;genlisp;gennodejs;genpy"
dep_include_paths_str = "swarm_robot;/home/wade/SJT... |
from flask import Flask, request, redirect, jsonify
app = Flask(__name__)
@app.route("/request", methods = ['POST'])
def grab():
if request.method == "POST" and request.form.get('token') == "Add slash command token here. ":
text = request.form.get('text')
text = text.capitalize()
if "**" in text:
takeApart ... |
#!/usr/bin/env python
'''
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")... |
from __future__ import division, print_function, absolute_import
import os
import pyperf
import tempfile
def get_raw_values(filename, run_id):
bench = pyperf.Benchmark.load(filename)
run = bench.get_runs()[run_id]
inner_loops = run.get_inner_loops()
raw_values = [value * (loops * inner_loops)
... |
# 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 ... |
from django.db import models
from django.contrib.contenttypes.models import ContentType
from django.contrib.contenttypes import generic
from django.contrib.auth.models import User
from django_extensions.db.fields import CreationDateTimeField, ModificationDateTimeField
from django_common.managers import LimitingManager... |
#!/usr/bin/env python
#
# Copyright (c) 2006 alex Holkner
# alex.Holkner@mail.google.com
#
# Copyright (c) 2016 Matthias Y. Chen
#
# This library is free software; you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as published by the
# Free Software Foundation; either v... |
#!/usr/bin/env python3
#
# Copyright (c) 2016, The OpenThread Authors.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# 1. Redistributions of source code must retain the above copyright
# ... |
def main():
try:
arquivo = open('arquivo.txt')
except IOError:
print('arquivo nao exites')
else:
for linha in arquivo.readlines():
print(linha)
finally:
print('Fim '.ljust(100, '='))
if __name__ == '__main__':
main()
|
a = input()
s = (int(x) for x in input().split())
print(*sorted(s))
|
import json
from django.db import models
from django.utils.functional import cached_property
from django.utils.translation import gettext_lazy as _
from django_scopes import ScopedManager
from i18nfield.fields import I18nCharField
from pretalx.common.choices import Choices
from pretalx.common.mixins import LogMixin
f... |
import pytest
from river import compose, linear_model, optim, preprocessing, tree, utils
@pytest.mark.parametrize(
"model, param_grid, count",
[
(
linear_model.LinearRegression(),
{
"optimizer": [
(optim.SGD, {"lr": [1, 2]}),
... |
# Working with sqlite
# insert a table
# import the needed modules
import sqlite3
import pandas as pd
# connect to a database
connection = sqlite3.connect("myTable.db")
# make a cursor
curs = connection.cursor()
# SQL command to create a table in the database
sql_command = """CREATE TABLE emp (staff_number INT... |
from __future__ import unicode_literals
from operator import attrgetter
from django import VERSION
from django.contrib.contenttypes.generic import GenericRelation
from django.contrib.contenttypes.models import ContentType
from django.db import models, router
from django.db.models.fields import Field
from django.db.mod... |
#!/usr/bin/env python3
# FileName:do_base64.py
# -*- coding: utf-8 -*-
"""
测试使用Base64编码
"""
import base64
s = base64.b64encode('在Python中使用Base64编码'.encode('utf-8'))
print(s)
d = base64.b64decode(s).decode('utf-8')
print(d)
s = base64.urlsafe_b64encode('在Python中使用Base64编码'.encode('utf-8'))
print(s)
d = base64.u... |
# 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
from ... import _utilities, _tables
from... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time : 5/15/20 4:49 PM
# @File : grover.py
# qubit number=4
# total number=12
import cirq
import cirq.google as cg
from typing import Optional
import sys
from math import log2
import numpy as np
#thatsNoCode
from cirq.contrib.svg import SVGCircuit
# Symbols for... |
class Brb():
data = 'teste'
def format_brb(self):
return self.data
def __str__(self):
return self.data
from modules.load_config import load_config
config = load_config()
|
import ast
import copy
import datetime
import json
import logging
import os
import shutil
import traceback
import warnings
from io import StringIO
import numpy as np
from astropy.io import fits
from django.conf import settings
from interface.models import StarsFilter
from lcc.cli.input_parse import parse_query_ranges... |
import requests
from time import sleep
api_key = '' # https://pro.coinmarketcap.com/account
bot_key = '' # botFather HTTP API:
price_limit = 70000
time_interval = 60
telegram_chat_ids = ['', '', ] # IDBot
def get_price():
url = 'https://pro-api.coinmarketcap.com/v1/cryptocurrency/listings/latest'
parameters = {
... |
"""src URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/2.0/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')
Class-based vie... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# © arkoz 2021
import os
import sys
import requests
import logging
from logging import handlers
botnick = "satfinder"
def logprepare():
path = "logi/"
if not os.path.exists(path):
os.makedirs(path)
with open(path + botnick + '.log', 'a'):
p... |
# Clase 20. Curso Píldoras Informáticas.
# Control de Flujo. Generadores 2.
# Instrucción yield from: simplifica el código para bucles anidados.
# El asterisco es un número indeterminado de elementos dados en forma de tupla.
def Cities(*ciudades):
for i in ciudades:
yield i
Ciudades = Cities("Madri... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.