text stringlengths 1 927k |
|---|
import _plotly_utils.basevalidators
class XpadValidator(_plotly_utils.basevalidators.NumberValidator):
def __init__(
self, plotly_name="xpad", parent_name="scattercarpet.marker.colorbar", **kwargs
):
super(XpadValidator, self).__init__(
plotly_name=plotly_name,
parent_n... |
#!/usr/bin/env python3
import sys
import time
import datetime
import os
import psutil
def main():
CurrentTime = datetime.datetime.now()
with open(r"/sys/class/thermal/thermal_zone0/temp") as f:
CurrentTemp0 = f.readline()
with open(r"/sys/class/thermal/thermal_zone1/temp") as f:
Cur... |
# -*- coding:utf-8 -*-
import cv2
import time
import argparse
import os
import numpy as np
from PIL import Image
#from keras.models import model_from_json
from .utils.anchor_generator import generate_anchors
from .utils.anchor_decode import decode_bbox
from .utils.nms import single_class_non_max_suppression
from .load_... |
from collections import OrderedDict
# Data from: benchresults/rankselect/data/rankselect_nohugetlb/bitsize.csv
# Numbers to LaTeX regex: :s/\([0-9]\.?[0-9]*\)\([,\" ]\)/$\1$\2/g
lbls = "Elements,fixed[F],fixed[$\ell$],byte[F],byte[$\ell$],bit[F],bit[$\ell$],fixed[$16$]fixed,byte[$16$]byte,bit[$16$]bit,fixed[$16$]byte... |
#!/usr/bin/env python
"""Django's command-line utility for administrative tasks."""
import os
import sys
from store.settings.base import get_config_type
def main():
# Set path to the current config file
os.environ.setdefault(
'DJANGO_SETTINGS_MODULE',
'store.settings.' + get_config_type()
... |
#!/usr/bin/python
#
# Created on Aug 25, 2016
# @author: Gaurav Rastogi (grastogi@avinetworks.com)
# Eric Anderson (eanderson@avinetworks.com)
# module_check: supported
# Avi Version: 16.3.8
#
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the te... |
from typing import Any, Dict
from django.http import HttpRequest, HttpResponse
from zerver.decorator import webhook_view
from zerver.lib.exceptions import UnsupportedWebhookEventType
from zerver.lib.request import REQ, has_request_variables
from zerver.lib.response import json_success
from zerver.lib.webhooks.common ... |
from .mutation import Mutation
from .crossover import Crossover
from .selection import Selector
from .ga_pipeline import ga_pipeline |
'''
Vulnerability Scanner Class
'''
class VulnScan(object):
scanning=True
def set_scanning(self, val):
self.scanning = val
def get_scanning(self):
return self.scanning |
from netapp.coredump.coredump_config_info import CoredumpConfigInfo
from netapp.netapp_object import NetAppObject
class CoredumpConfigModifyIterInfo(NetAppObject):
"""
Information about the modify operation that was
attempted/performed against coredump-config object.
were not modified due to some error... |
# Copyright 2016 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.
"""The `depot_tools` module provides safe functions to access paths within
the depot_tools repo."""
import contextlib
from recipe_engine import recipe_api
... |
import os
import sys
import logging
import paddle
import argparse
import functools
import math
import paddle.fluid as fluid
sys.path.append("..")
import imagenet_reader as reader
import models
sys.path.append("../../")
from utility import add_arguments, print_arguments
from paddle.fluid.contrib.slim import Compressor
... |
from django.apps import AppConfig
class UploadingConfig(AppConfig):
default_auto_field = 'django.db.models.BigAutoField'
name = 'uploading' |
import json
from kraken import plugins
from kraken_examples.bob_guide import BobGuide
from kraken.core.profiler import Profiler
from kraken.helpers.utility_methods import logHierarchy
Profiler.getInstance().push("bob_guide_build")
bobGuide = BobGuide("char_bob_guide")
builder = plugins.getBuilder()
builder.build(b... |
import commands
import json
import os
import shutil
import sys
import time
import pickle
import signal
from os.path import abspath as _abspath, join as _join
from pandayoda.yodacore import Interaction,Database,Logger
from EventServer.EventServerJobManager import EventServerJobManager
class Droid:
def __init__(sel... |
# Copyright (c) 2012, 2017, 2019 ARM Limited
# All rights reserved.
#
# The license below extends only to copyright in the software and shall
# not be construed as granting a license to any other intellectual
# property including but not limited to intellectual property relating
# to a hardware implementation of the fu... |
import logging
__all__ = ['logger']
logger = logging.getLogger()
logger.setLevel(logging.INFO)
handler = logging.StreamHandler()
fmt = logging.Formatter(fmt="%(levelname)s: %(message)s")
handler.setFormatter(fmt)
handler.setLevel(logging.INFO)
logger.addHandler(handler) |
numeros = list()
for n in range(0, 5):
numeros.append(int(input(f'Digite um valor para a posição {n}: ')))
print(f'Voce digitou os valores {numeros}')
print('O maior valor digitado foi {} nas possições'.format(max(numeros)), end=' ')
'''
No for
O pos foi usado para fixar a localização
o v foi usado para fixar os v... |
import sqlite3
from flask import g, Flask
from constants import Constants
import json
DATABASE = 'db/sqlite.db'
app = Flask(Constants.APP_NAME)
def get_db():
db = getattr(g, '_database', None)
if db is None:
db = g._database = sqlite3.connect(DATABASE)
return db
@app.teardown_appcontext
def clos... |
# pylint: disable=wrong-or-nonexistent-copyright-notice
import pytest
import cirq
def test_qubit_set():
class RawDevice(cirq.Device):
pass
assert RawDevice().qubit_set() is None
class QubitFieldDevice(cirq.Device):
def __init__(self):
self.qubits = cirq.LineQubit.range(3)
... |
#!/usr/bin/env python
import dateutils
def quartiles(values):
"""
Returns the (rough) quintlines of a series of values. This is not intended
to be statistically correct - it's not a quick 'n' dirty measure.
"""
return [i * max(values) / 4 for i in range(5)]
def longest_streak(dates):
"""
... |
from aoc2020 import *
class Solution(SolutionABC):
expected = 7
def solve(self) -> any:
x, rt, rows = 0, 0, self.resource_lines("input")
try:
# Discard the first row
next(rows)
while True:
row = next(rows)
x = (x + 3) % len(... |
# -*- coding: utf-8 -*-
from captcha.fields import ReCaptchaField
from crispy_forms.bootstrap import FormActions
from crispy_forms.helper import FormHelper
from crispy_forms.layout import Submit
from django import forms
from django.conf import settings
from django.core.mail import send_mail
from django.http import Http... |
from __future__ import (absolute_import, division, print_function,
unicode_literals)
# geoms
from .geom_abline import geom_abline
from .geom_area import geom_area
from .geom_bar import geom_bar
from .geom_density import geom_density
from .geom_histogram import geom_histogram
from .geom_hline imp... |
# MIT LICENSE
#
# Copyright 1997 - 2020 by IXIA Keysight
#
# 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,... |
# -*- coding: utf-8 -*-
import pygame
from OpenGL.GL import *
from OpenGL.GLU import *
import socket
import json
from pygame.locals import *
SCREEN_SIZE = (800, 600)
address = ('', 5000)
def resize(width, height):
glViewport(0, 0, width, height)
glMatrixMode(GL_PROJECTION)
glLoadIdentity()
gluPerspe... |
import os
import shlex
import getpass
import warnings
import asyncio
import logging
import collections
import atexit
from typing import Optional, Dict, Deque
import tqdm
import asyncssh
from .conf import env, options_to_connect
from .utils import run_in_loop, CommandResult, prepare_environment, split_lines
# disable ... |
#!/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 annotations
from datetime import date, datetime
from unittest import TestCase
from tests.classes.super_datetime import SuperDateTime
class TestToboday(TestCase):
def test_toboday_transforms_datetime_into_the_time_of_beginning_of_day(self):
d = SuperDateTime(dtbd=datetime(2021, 10,... |
# Generated by Django 2.2.12 on 2020-05-15 14:15
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("datasets", "0010_auto_20200515_0959"),
]
operations = [
migrations.AlterField(
model_name="citycouncilagenda",
name... |
#!python3
# single-line string:
print("hello")
# multi-line strings:
print("""
w
o
r
l
d
"""
)
print("abc"*3)
a = [1,2,3,4]
print(a*3) |
from fastapi import FastAPI, HTTPException
from pydantic import BaseModel
from src.build_model import convert, predict
app = FastAPI()
# pydantic models
class StockIn(BaseModel):
ticker: str
class StockOut(StockIn):
forecast: dict
# routes
@app.get("/ping")
async def pong():
return {"ping": "pon... |
# Copyright (c) 2020 Open-E, 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 re... |
import os
import warnings
warnings.filterwarnings("ignore")
shared_params_st_mgcn = ('python ST_MGCN_Obj.py '
'--Dataset DiDi '
'--CT 6 '
'--PT 7 '
'--TT 4 '
'--LSTMUnits 64 '
... |
# Copyright 2017 ATT 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable la... |
# Generated by Django 2.2.7 on 2020-03-01 01:09
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='MyModelTest',
fields=[
('id', models.AutoFi... |
# -*- coding: utf-8 -*-
"""
20181010
ciklaminima
"""
import numpy as np
import matplotlib.pyplot as plt
import os
import pandas as pd
import _dataPostprLib_ as lib
import seaborn as sns
import importlib
#%%
sns.set()
#sns.set_context("poster")
sns.set_context("paper")
#sns.color_palette("Paired")
seq_col_brew = sns.c... |
"""Console script for python-github-stats."""
import argparse
import os
def cli_args():
"""Parse CLI arguments."""
parser = argparse.ArgumentParser(description="Manage GitHub via API.")
parser.add_argument(
"action", help="Define action to take.", choices=["user-attrs", "user-repos"]
)
... |
# coding: utf-8
from flask import Flask as FlaskBase
from flask_sqlalchemy import SQLAlchemy
from flask_apscheduler import APScheduler
import os
from jobs.tasks.timer import SchedulerConfig
from common.libs.utils import correctPath
db = SQLAlchemy()
scheduler = APScheduler() # 定时任务
class Flask(FlaskBase):
def __i... |
from app import app, db
class User(db.Model):
__tablename__ = 'user'
id = db.Column(db.Integer, autoincrement = True, primary_key = True)
name = db.Column(db.String(100))
age = db.Column(db.Integer)
email = db.Column(db.String(30))
phone = db.Column(db.Integer)
def __init__(self, name, age... |
#Import libraries for doing image analysis
from skimage.io import imread
from skimage.transform import resize
from sklearn.ensemble import RandomForestClassifier as RF
import glob
import os
from sklearn import cross_validation
from sklearn.cross_validation import StratifiedKFold as KFold
from sklearn.metrics import cla... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c) 2009, Giampaolo Rodola'. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""
Miscellaneous tests.
"""
import ast
import collections
import contextlib
import errno
import json
impor... |
"""
----------------------
Python Dictionary API
----------------------
PyDictAPI is library written in Python, that can be used to fetch meanings and translation.
Both the Finder and Translator class takes an arguement "jsonify" that is set to False by default.
If jsonify is set to True, than the processed queries... |
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the Apache 2.0 License.
import os
import json
import http
import random
import infra.network
import infra.proc
import infra.e2e_args
import infra.checker
from loguru import logger as LOG
def run(args):
# SNIPPET_START: parsing
with ... |
# -*- coding: utf-8 -*-
# This code is part of Qiskit.
#
# (C) Copyright IBM 2019.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
#
# Any modif... |
import numpy as np
# Dict of all the patterns with their replacements.
# Structure:
# name of replacement -> list of (pattern, replacement, kwargs) tuples
LINTBITS = {
'diagonal matrix dot product': [
# diag(x).dot(y)
('${diag}(${x}).dot(${y})', '((${x}) * (${y}).T).T',
dict(diag='name=... |
#! -*- coding: utf-8 -*-
# 代码合集
import os, sys, six, re, json
import logging
import numpy as np
from collections import defaultdict
from bert4keras.backend import K, keras, tf
_open_ = open
is_py2 = six.PY2
if not is_py2:
basestring = str
def to_array(*args):
"""批量转numpy的array
"""
results = [np.arr... |
import os
import json
def iter_example_names():
specdir = os.path.join(os.path.dirname(__file__), 'spec')
for spec in sorted(os.listdir(specdir)):
yield spec
def load_example(name):
filename = os.path.join(os.path.dirname(__file__), 'spec', name)
with open(filename, 'r') as f:
return... |
#!/usr/bin/env python3
from vl.app import app as application
if __name__ == "__main__":
application.run() |
# coding: utf-8
from __future__ import division, unicode_literals
"""
This module implements a Composition class to represent compositions,
and a ChemicalPotential class to represent potentials.
"""
__author__ = "Shyue Ping Ong"
__copyright__ = "Copyright 2011, The Materials Project"
__version__ = "0.1"
__maintainer... |
#!/usr/bin/env python
#-------------------------------------------------------------------------------
# Name: Gear Generator
# Purpose: Just for fun
#
# Author: Manuel Astros
# Email: manuel.astros1980@gmail.com
# Web: https://sites.google.com/view/interpolation/home
#
# Created: ... |
'''
CATEGORIES TO M SCRIPT - CREATE CONDITIONAL STATEMENT CODE FOR POWER BI
-
a dynamoPython script, visit the website for more details
https://github.com/Amoursol/dynamoPython
'''
__author__ = 'Adam Bear - adam@ukbear.com'
__twitter__ = '@adambear82'
__github__ = '@adambear82'
__version__ = '1.0.0'
'''
for large proj... |
import os
import sys
import numpy as np
import pandas as pd
import logging
if '../../' not in sys.path:
sys.path.append('../../')
import src.optimization as optimization
model = 'rabi'
model_parameters = dict(N=100, Omega=100, omega_0=1.)
protocol = 'bangramp'
optimization_method = 'Nelder-Mead'
# ------ build... |
# -*- coding: utf-8 -*-
#
# Nidhogg documentation build configuration file, created by
# sphinx-quickstart on Thu May 28 09:48:45 2015.
#
# 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.
#
# A... |
import time
import sys
import os
from collections import OrderedDict
from functools import wraps
from ..utils.common import get_current_user, list_intersect, is_sub_list, user_input, list_difference, parse_ports_from_profiles
from ..utils import parsing_opts, text_tables
from ..utils.text_opts import format_text, form... |
# -*- coding: utf-8 -*-
'''
The Saltutil runner is used to sync custom types to the Master. See the
:mod:`saltutil module <salt.modules.saltutil>` for documentation on
managing updates to minions.
.. versionadded:: 2016.3.0
'''
from __future__ import absolute_import, print_function, unicode_literals
# Import python l... |
# Copyright 2017 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... |
"""
Copyright 2017-present Airbnb, Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, sof... |
#!/usr/bin/env python3
# Copyright (c) 2015-2017 The Bitcoin Money developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Functionality to build scripts, as well as SignatureHash().
This file is modified from python-bitcoin... |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2012-2013 Ben Kurtovic <ben.kurtovic@gmail.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 ... |
import os,sys
import numpy as np
import csv
input_file=sys.argv[1]
output_file=sys.argv[2]
header='I0315'
if len(sys.argv)>3:
header=sys.argv[3]
keys=[]
epoch_data=[]
epoch_row=[]
with open(input_file,'r') as f:
for ln in f:
line=ln.rstrip('\n')
if line.startswith(header) and 'Test net output'... |
#i/o
import requests, os, random
from glob import glob
from collections import Counter
from collections import defaultdict
from PIL import Image
from skimage.io import imread
import pickle
#numerica
import numpy as np
import tensorflow as tf
import tensorflow.keras.backend as K
from tensorflow import keras
from tensor... |
class Solution:
def hammingDistance(self, x: int, y: int) -> int:
count = 0
diff = x ^ y
while diff != 0:
count += 1
diff &= (diff-1)
return count |
"""Logging utilities."""
import asyncio
import logging
import threading
from .async_ import run_coroutine_threadsafe
class HideSensitiveDataFilter(logging.Filter):
"""Filter API password calls."""
def __init__(self, text):
"""Initialize sensitive data filter."""
super().__init__()
se... |
#
# PySNMP MIB module HUAWEI-CLOCK-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/HUAWEI-CLOCK-MIB
# Produced by pysmi-0.3.4 at Wed May 1 13:43:52 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar ... |
from setuptools import setup
setup(name='gfracture',
version='0.1',
description='Fracture segmentation and trace analysis',
url='https://github.com/ScottHMcKean/gfracture',
author='Scott McKean',
author_email='scott.mckean@ucalgary.ca',
license='MIT',
packages=['gfracture'],
... |
from .char_ngrams import CharNgramsTokenizer
from .terms import TermsTokenizer |
# Generated by Django 3.1 on 2020-12-02 10:35
from django.db import migrations, models
import django.utils.timezone
class Migration(migrations.Migration):
dependencies = [
("selfswab", "0011_selfswabtest_should_sync"),
]
operations = [
migrations.AddField(
model_name="selfsw... |
# Copyright 2013: Mirantis 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 b... |
"""
WSGI config for src project.
This module contains the WSGI application used by Django's development server
and any production WSGI deployments. It should expose a module-level variable
named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover
this application via the ``WSGI_APPLICATION`` sett... |
import torch
import torch.nn as nn
import torch.nn.functional as F
device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
class VGG_FeatureExtractor(nn.Module):
def __init__(self, input_channel, output_channel=512):
super(VGG_FeatureExtractor, self).__init__()
self.output_channel = ... |
# coding: utf-8
# pylint: disable = invalid-name, C0111
import gpboost as gpb
import numpy as np
# import pandas as pd
import matplotlib.pyplot as plt
plt.style.use('ggplot')
# --------------------Grouped random effects model: single-level random effect----------------
# Simulate data
n = 100 # number of samples
m = ... |
"""Test cases for the Renault client API keys."""
from datetime import datetime
from typing import List
import aiohttp
import pytest
from aioresponses import aioresponses
from tests import get_file_content
from tests.const import TEST_ACCOUNT_ID
from tests.const import TEST_COUNTRY
from tests.const import TEST_KAMEREO... |
import requests, json, random, sys, configparser
#def getData(auth_string, id):
def getData():
global auth_token
s = random.randint(100000, 1000000)
id_str = str(s)
request_url = "http://api.genius.com/songs/" + id_str
headersMap = {
"User-Agent": "CompuServe Classic/1.22",
... |
# 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... |
startHTML = '''
<html>
<head>
<style>
table {
border-collapse: collapse;
height: 100%;
width: 100%;
}
table, th, td {
border: 3px solid black;
}
@media print {
table {
page-break-after: always;
... |
from rest_framework import status
from django.contrib.auth import get_user_model
from rest_framework.reverse import reverse
from .basetest import BaseTestCase
User = get_user_model()
signup_url = reverse("authentication:signup")
login_url = reverse("authentication:login")
class UserApiTestCase(BaseTestCase):
d... |
import subprocess
import os
def read_list(fname="lista.csv"):
for row in open(fname):
yield row
def write_preamble(fname):
preamble = r"""%25 EIC technology, (C) LM 2018
\documentclass{article}
\usepackage{graphicx}
\usepackage[space]{grffile}
\usepackage{anyfontsize}
\usepackage{fon... |
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... |
from unittest import mock
import os
import platform
import subprocess
import sys
import sysconfig
import tempfile
import unittest
import warnings
from test import support
class PlatformTest(unittest.TestCase):
def test_architecture(self):
res = platform.architecture()
@support.skip_unless_symlink
... |
"""
Implementation of an auxiliary class that as an intermediate layer of Monad and Prototype
A Function Class
"""
import functools as F
from __init__ import utils
from __init__ import proto
# a magica determines (A) the way to distribute the difference to each prototype
# (B) the way to measure o... |
"""This module contains examples of stream_func where f_type
is 'element' and stream_func has a list of multiple input streams,
a single output stream, and the operation is stateless. These
examples must have a LIST of input streams and not a single
input stream.
The functions on static Python data structures are of t... |
"""
Copyright (c) 2016-2018 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... |
# coding = utf-8
# Create date: 2018-11-20
# Author :Hailong
from utils.connect_to_os import executor, connection
def test_cloud_init(ros_kvm_init, cloud_config_url):
kwargs = dict(cloud_config='{url}test_cloud_init.yml'.format(url=cloud_config_url),
is_install_to_hard_drive=True)
tuple_retu... |
# Time: O(m * n)
# Space: O(m * n)
import collections
class Solution(object):
def maxDistance(self, grid):
"""
:type grid: List[List[int]]
:rtype: int
"""
directions = [(0, 1), (1, 0), (0, -1), (-1, 0)]
q = collections.deque([(i, j) for i in range(len(grid))
... |
# PRIMEIROS PASSOS
"""
Imprime OLÁ, MUNDO na tela -- obviamente!
Pede nome do usuário e dois números.
Exibe nome do usuário e a soma dos números inseridos
"""
print('Hello, world!!!')
nome = input('Qual é o seu nome? ')
print('Olá, {}, é um prazer te conhecer!'.format(nome))
#
idade = int(input('Qual é a sua idade? ')... |
import numpy as np
import matplotlib.pyplot as plt
# Part A: Numerical Differentiation Closure
def numerical_diff(f,h):
def inner(x):
return (f(x+h) - f(x))/h
return inner
# Part B:
f = np.log
x = np.linspace(0.2, 0.4, 500)
h = [1e-1, 1e-7, 1e-15]
y_analytical = 1/x
result = {}
for i in h:
y = n... |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
#
# Copyright 2013 Mellanox Technologies, 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
#
#... |
#! /usr/bin/env python
# PyTorch Tutorial 07 - Linear Regression
# https://www.youtube.com/watch?v=YAJ5XBwlN4o&list=PLqnslRFeH2UrcDBWF5mfPGpqQDSta6VK4&index=7
#from __future__ import print_function
import torch
print("\n" * 20)
print("-" * 80)
print("-" * 80)
print("\n" * 2)
#### Steps in Torch ML pipeline
# 1) Desi... |
"""
Fenced Code Extension for Python Markdown
=========================================
This extension adds Fenced Code Blocks to Python-Markdown.
>>> import markdown
>>> text = '''
... A paragraph before a fenced code block:
...
... ~~~
... Fenced code block
... ~~~
... '''
>>> ht... |
#
# 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
# ... |
"""This module contains the general information for ExportLdapCACertificate ManagedObject."""
from ...imcmo import ManagedObject
from ...imccoremeta import MoPropertyMeta, MoMeta
from ...imcmeta import VersionMeta
class ExportLdapCACertificateConsts:
PROTOCOL_FTP = "ftp"
PROTOCOL_HTTP = "http"
PROTOCOL_N... |
"""
Core data structures for working with labels.
Copyright 2017-2022, Voxel51, Inc.
voxel51.com
"""
# pragma pylint: disable=redefined-builtin
# pragma pylint: disable=unused-wildcard-import
# pragma pylint: disable=wildcard-import
from __future__ import absolute_import
from __future__ import division
from __future__... |
# 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... |
# coding=utf-8
import json
import threading
from autobahn.twisted.websocket import WebSocketClientFactory, \
WebSocketClientProtocol, \
connectWS
from twisted.internet import reactor, ssl
from twisted.internet.protocol import ReconnectingClientFactory
from twisted.internet.error import ReactorAlreadyRunning
... |
import sys
from .client import MantridClient
class MantridCli(object):
"""Command line interface to Mantrid"""
def __init__(self, base_url):
self.client = MantridClient(base_url)
@classmethod
def main(cls):
cli = cls("http://localhost:8042")
cli.run(sys.argv)
@property
... |
#!/usr/bin/env python3
import binascii
import hashlib
import os.path
import struct
import sys
sys.path.insert(0, os.path.dirname(__file__))
import rc4
# Helper functions
def rol32(val, shift):
val = val & 0xffffffff
shift = shift & 0x1f
if not shift:
return val
return ((val << shift) & 0xffff... |
# Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class Eztrace(AutotoolsPackage):
"""EZTrace is a tool to automatically generate execution traces... |
#!/usr/bin/env python2
import sys
import random
import bisect
import pysam
import gzip
import cPickle
import numpy
from time import time, localtime, strftime
import argparse
from multiprocessing import Process
import os
import math
import pysam
inds={'A':0,'T':1,'G':2,'C':3,'N':4,'a':0,'t':1,'g':2,'c':3,'n':4}
def su... |
"""
API Base class with util functions
"""
import json
import datetime
import uuid
from warnings import warn
from typing import Dict, List, Tuple
from urllib.parse import unquote
import re
import xmltodict
import requests
from ..exceptions import SageIntacctSDKError, ExpiredTokenError, InvalidTokenError, NoPrivilegeE... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.