text stringlengths 1 927k |
|---|
n = int(input())
n_is_even = n % 2 == 0
right_line = "/"
left_line = chr(92)
down_line = "_"
up_middle = "^"
side = "|"
space = " "
between_left_right = n - (n // 2 + 2)
print(right_line + up_middle * (n // 2) + left_line + down_line * (between_left_right * 2) + right_line + up_middle
* (n // 2) + left_line)
fo... |
import typing
def main() -> typing.NoReturn:
n = int(input())
a = list(map(int, input().split()))
a.sort()
y = a[n - 1]
x = -1
mx = 0
for j in range(n - 1):
d = min(a[j], y - a[j])
if d < mx: continue
x = a[j]
mx = d
print(y, x)
main() |
"""Fixer for __metaclass__ = X -> (metaclass=X) methods.
The various forms of classef (inherits nothing, inherits once, inherints
many) don't parse the same in the CST so we look at ALL classes for
a __metaclass__ and if we find one normalize the inherits to all be
an arglist.
For one-liner classes ('c... |
"""tagrecords.py -- panthera tag records
Records are keyed on the following symbols:
* TAG
* TAGS
* MNEMONICS
* TITLE
* HOOK
* DESCRIPTION
* IDENTIFIER
* CREATOR
* CREATED
"""
from symbols import *
import listdict
from listdict import cue, val, val01, req, srt # working with lists of dictionaries
from listdict imp... |
# -*- coding:utf-8 -*-
# Copyright (C) 2020. Huawei Technologies Co., Ltd. All rights reserved.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the MIT License.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the ... |
"""
Access layer for datasets used in tests
"""
__author__ = 'lejlot'
import numpy as np
def baseline_logic(operator):
""" Creates 4-point dataset with given logical operator """
data = np.array([[1, 1], [0, 0], [1, 0], [0, 1]])
labels = np.array([max(0, min(1, operator(*point))) for point in data])
... |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "crowdsrc.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... |
from __future__ import division
import msprime
import pandas as pd
import numpy as np
import os
def trees(out, tree_sequence, chr, m, n_pops, N, sim, vcf, sample_index):
# DEV: Throw a warning if you try to do this and n_sims is high.
vcf_name = out + ".vcf"
with open(vcf_name, "w") as vcf_file:
tree_sequence.wri... |
# -*- coding: utf-8 -*-
"""
Demonstrates basic use of LegendItem
"""
import initExample ## Add path to library (just for examples; you do not need this)
import pyqtgraph as pg
from pyqtgraph.Qt import QtCore, QtGui
plt = pg.plot()
plt.setWindowTitle('pyqtgraph example: Legend')
plt.addLegend()
#l = pg.LegendItem((10... |
import os
import sys
import argparse
from pathlib import Path
from nabu.story import Story
def main():
default_lib_path = Path(os.environ['PWD'], 'stories')
default_template_path = Path(os.environ['PWD'], 'nabu', 'templates', 'story.html.jinja')
default_story = "stormy_night"
parser = argparse.Argume... |
__author__ = "Webber Huang"
__contact__ = "xracz.fx@gmail.com"
__website__ = "http://riggingtd.com"
import os
try:
from PySide import QtGui, QtCore
from PySide.QtGui import *
from PySide.QtCore import *
except ImportError:
from PySide2 import QtGui, QtCore, QtWidgets
from PySide2.QtGui import *
... |
#
# 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... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri Feb 14 17:55:39 2020
@author:
Dr. Maximilian N. Günther
European Space Agency (ESA)
European Space Research and Technology Centre (ESTEC)
Keplerlaan 1, 2201 AZ Noordwijk, The Netherlands
Email: maximilian.guenther@esa.int
GitHub: mnguenther
Twitter: m_n... |
from unittest import TestCase
from maxcube.thermostat import MaxThermostat
class TestMessage(TestCase):
""" Test Max! thermostat """
def testGetCurrentTemperatureReturnsNoneIfUninitialized(self):
t = MaxThermostat()
self.assertIsNone(t.get_current_temp_in_auto_mode()) |
"""
AWR + SAC from demo experiment
"""
from rlkit.demos.source.dict_to_mdp_path_loader import DictToMDPPathLoader
from rlkit.launchers.experiments.awac.awac_rl import experiment, process_args
import rlkit.misc.hyperparameter as hyp
from rlkit.launchers.arglauncher import run_variants
from rlkit.torch.sac.policies im... |
import numpy as np
import matplotlib.pyplot as plt
import math
import copy
# from mpc_func_with_cvxopt import MpcController as MpcController_cvxopt
from extended_MPC import IterativeMpcController
from animation import AnimDrawer
# from control import matlab
from coordinate_trans import coordinate_transformation_in_ang... |
# coding=utf8
# TODO: Move regex patterns into a dict for easier handling?
regex_SXEX = r"""
(?P<showname>.*)(?=(?:[. ](?:[S][0-9]{2})|[0-9][x])) #Show name
(?: # Get year if present
[ .]?(?<=[.( ](?P<showyear>\d{4})[.) ])
| # Get Season
[. ](?:S(?P<showseason>\d{1,2}))[E|X]
)
(?: # Get Episodes in case multi episode... |
from random import randint
pc = randint(0, 100)
tot = 0
while True:
num = int(input('Digite um valor: '))
resul = pc + num
resp = ' '
if num == 0:
break
while resp not in 'IiPp':
resp = str(input('Par ou impar? [P/I] ')).upper().strip()[0]
print('-=' * 30)
print(f'Voce jogou ... |
"""
Third example xml files to parse and compare with each other.
These fixtures asserts that in case of already corrupted data, migrator is
going to fix it.
Differences between form_xml_case_1 and form_xml_case_1_after:
- Rename 'name' to 'first_name' and insert into group
- Add 'last_name' field inside group
- Add d... |
from __future__ import print_function
import argparse
import clodius.cli.aggregate as cca
import os
import os.path as op
import sys
def set_postmortem_hook():
import sys, traceback, ipdb
def _excepthook(exc_type, value, tb):
traceback.print_exception(exc_type, value, tb)
print()
ipdb.p... |
# Copyright 2018 The TensorFlow Probability 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 o... |
import jax.numpy as np
import numpy as onp
import math
def X():
return np.array([[0, 1], [1, 0]])
def Y():
return np.array([[0, -1j], [1j, 0]])
def Z():
return np.array([[1, 0], [0, -1]])
def H():
return np.array([[1, 1], [1, -1]]) / math.sqrt(2)
def S():
return np.array([[1, 0], [0, 1j]])
def... |
from exaqute.ExaquteParameter import *
class ExaquteTask(object):
def __init__(self, *args, **kwargs):
raise Exception(
"Exaqute task decorator not implemented in the current scheduler")
def __call__(self, f):
raise Exception(
"Exaqute task call code not implemented i... |
import sys
import os.path
from win32com.client import makepy
output_file = os.path.join(os.path.dirname(__file__), "pinmapinterfaces.py")
pmi_type_library = (
r"C:\Program Files\National Instruments\TestStand 2020\Bin"
r"\NationalInstruments.TestStand.SemiconductorModule.PinMapInterfaces.tlb"
)
sys.argv = ["m... |
#
# Copyright(c) 2012-2020 Intel Corporation
# SPDX-License-Identifier: BSD-3-Clause-Clear
#
import pytest
from unittest.mock import patch, mock_open
from textwrap import dedent
import helpers as h
import opencas
@patch("builtins.open", new_callable=mock_open)
def test_cas_config_from_file_exception(mock_file):
... |
import keyboard
import time
isOnOrNot = False
def manageKeyboard():
global isOnOrNot
print("isOnOrNot",isOnOrNot)
isOnOrNot = not isOnOrNot
print("isOnOrNot",isOnOrNot)
keyboard.add_hotkey('ctrl+a', manageKeyboard, args=())
while(True):
time.sleep(1)
if(isOnOrNot==True):
keyboard.wri... |
import math
import time
import random
import numpy as np
import torch
import torch.optim as optim
import torch.optim.lr_scheduler as lrs
def set_seed(seed):
random.seed(seed)
np.random.seed(seed)
torch.manual_seed(seed)
if torch.cuda.device_count() == 1:
torch.cuda.manual_seed(seed)
else:
... |
from django.db import models
from django.contrib.auth import get_user_model
import os
import tweepy
import praw
# import asyncio
User = get_user_model()
class TwitterMessage(models.Model):
twitter = models.OneToOneField("Twitter", on_delete=models.CASCADE,
null=False, blank=False, related_name="direct_me... |
import numpy as np
from metagraph.wrappers import (
EdgeSetWrapper,
EdgeMapWrapper,
CompositeGraphWrapper,
BipartiteGraphWrapper,
)
from metagraph import dtypes
from metagraph.types import (
Graph,
BipartiteGraph,
EdgeSet,
EdgeMap,
)
from .. import has_cugraph
from typing import List, Se... |
# -*- coding: utf-8 -*-
#
# 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
#... |
# (c) 2016 Gregor Mitscha-Baude
from dolfin import *
from nanopores.tools import fields
# set save/load directory
fields.set_dir("/tmp/nanopores/")
mesh = UnitSquareMesh(10, 10)
V = FunctionSpace(mesh, "CG", 1)
u = Function(V)
u.interpolate(Expression("sin(x[0]*x[1]*4*pi)"))
if not fields.exists("test_save"):
fi... |
#!/bin/python3
import math
import os
import random
import re
import sys
# Complete the arrayManipulation function below.
def arrayManipulation(n, queries):
d=[0]*(n+1)
max_val=0
for query in queries:
d[query[0]-1]+=query[2]
d[query[1]]+=query[2]*(-1)
max_dif=0
for i in d:
... |
import os
from subprocess import check_call
access_key_id = os.environ.get('ACCESS_KEY_ID')
access_key_secret = os.environ.get('ACCESS_KEY_SECRET')
if access_key_id and access_key_secret:
cur_path = os.path.abspath('.')
path_list = []
for ret in os.walk(cur_path):
root_path = ret[0]
root_pat... |
from datetime import date, datetime
import json
from typing import Dict, List
import elasticsearch
from gazettes import GazetteDataGateway, Gazette
class ElasticSearchDataMapper(GazetteDataGateway):
GAZETTE_CONTENT_FIELD = "source_text"
def __init__(self, host: str, index: str):
self._index = inde... |
# Copyright 2018 The Cirq Developers
#
# 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 ... |
import torch
from torch import nn
from torchvision.ops import MultiScaleRoIAlign
from ._utils import overwrite_eps
from ..utils import load_state_dict_from_url
from .faster_rcnn import FasterRCNN
from .backbone_utils import resnet_fpn_backbone, _validate_trainable_layers
__all__ = [
"KeypointRCNN", "keypointrc... |
from . import Visualize #pylint: disable=relative-beyond-top-level
import networkx as nx
from matplotlib import lines
from scipy.spatial import Voronoi, voronoi_plot_2d
import numpy as np
# TODO: Needs to be retested and fixed.
''' Visualize or save images of the network with its various communities represented. '''
c... |
from vp_suite.base.base_model import VideoPredictionModel
class CopyLastFrame(VideoPredictionModel):
r"""
"""
# model-specific constants
NAME = "CopyLastFrame"
REQUIRED_ARGS = []
TRAINABLE = False
def __init__(self, device=None, **model_kwargs):
r"""
Args:
d... |
# This file is part of GridCal.
#
# GridCal is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# GridCal is distributed in the hope that... |
# -*- coding: utf-8 -*-
'''
states for infoblox stuff
ensures a record is either present or absent in an Infoblox DNS system
.. versionadded:: Boron
'''
from __future__ import absolute_import
# Import Python libs
import logging
log = logging.getLogger(__name__)
def __virtual__():
'''
make sure the infoblo... |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.1 on 2016-09-22 23:44
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
migratio... |
#in this program we append elements and its value to the dictionary
dick={}
inp=int(input("Enter the number of people you want to add :"))
for i in range(0,inp):
name=input("Enter Person's Name")
num=int(input("Enter his Number"))
dick[name]=num
print("Dictionary is as follows : \n",dick)
print(dick['qwe'... |
#-------------------------------------------------------------------------------
#
#
# Written by: David C. Morrill (based on similar routines written by Eric Jones)
#
# Date: 2007-05-01
#
# (c) Copyright 2002-7 by Enthought, Inc.
#
#-------------------------------------------------------------------------------
"""... |
# 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.core.exceptions import ValidationError
from django.test import TestCase
from ...utils import get_eth_address_with_key
from ..validators import validate_checksumed_address
class TestValidators(TestCase):
def test_checksum_address_validator(self):
eth_address, eth_key = get_eth_address_with_key... |
#!/usr/bin/python
############################################################
#Imports
from scapy.all import *
from termcolor import colored
import datetime
import string
import argparse
import platform
import binascii
# Static Configuration
# Default Broadcast MAC Address
broadcast_mac = 'ff:ff:ff:ff:ff:ff'
# To st... |
import locale
import sys
try:
from setproctitle import setproctitle
setproctitle('py3status')
except ImportError:
pass
try:
# python3
IOPipeError = BrokenPipeError
except NameError:
# python2
IOPipeError = IOError
def main():
from py3status.cli import parse_cli
options = parse_cl... |
import logging
from .. import files
from .component import Component
from cirrus.cli.utils.yaml import NamedYamlable
logger = logging.getLogger(__name__)
class StepFunction(Component):
definition = files.StepFunctionDefinition()
# TODO: Readme should be required once we have one per task
readme = files... |
############# Credits and version info #############
# Definition generated from Assembly XML tag def
# Date generated: 2018/12/03 04:56
#
# revision: 1 author: Lord Zedd
# I wanted to see what it did, sue me. Basically done.
# revision: 2 author: Moses_of_Egypt
# Cleaned up and converted to SuPyr definition
#
##... |
"""
.. module:: graphs
:synopsis: All graph plotting and creation facilities.
.. moduleauthor:: Jack Romo <sharrackor@gmail.com>
"""
from __future__ import division
import matplotlib.pyplot as plt
class FunctionsGraph(object):
"""
A graph that wraps around matplotlib.pyplot for plotting PlottableFuncti... |
from datetime import datetime, timedelta
import pytest
from sqlalchemy.orm import Session
from app.database.models import Category, Event, User
from app.routers.event import create_event
today_date = datetime.today().replace(hour=0, minute=0, second=0)
@pytest.fixture
def event(sender: User, category: Category, se... |
#!/usr/bin/env python3
# Copyright (c) 2018 The Bitcoin Core developers
# Copyright (c) 2017 The Raven Core developers
# Copyright (c) 2018 The RPG Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test account RPC... |
def BinaryTree(r):
"""Create a new binary tree."""
return [r, [], []]
def insertLeft(root, newBranch):
"""Insert a new left node."""
t = root.pop(1) # get the left child
if len(t) > 1:
# add new left child to root and
# make old left child it's left child.
root.insert(1, [newBranch, t, []])
el... |
import hashlib
from mybitbank.apps.accounts.models import accountFilter
from mybitbank.libs.connections import connector
from mybitbank.libs import misc
from cacher import Cacher
from coinaddress import CoinAddress
from cointransaction import CoinTransaction
from coinaccount import CoinAccount
class CoinWallet(object... |
"""
Contains urls mapped with CueSearch app views
"""
from django.urls import path
from . import views
urlpatterns = [
# Global Dimension
path("dimension/", views.DimensionView.as_view(), name="dimension"),
# path("metrics/", views.MetricsView.as_view(), name="metrics"),
path(
"global-dimension... |
#_*_coding:utf-8_*_
import os
import platform
import pandas as pd
import numpy as np
from sqlalchemy.types import String
print("hello github.com, I'm coming") |
import torch
import torch.nn as nn
import torch.nn.init as init
import numpy as np
import pdb
__author__ = "Yu-Hsiang Huang"
class Linear(nn.Module):
''' Simple Linear layer with xavier init '''
def __init__(self, d_in, d_out, bias=True):
super(Linear, self).__init__()
self.linear = nn.Linear(... |
from setuptools import setup
setup(name="sparkhpc",
version='0.3.post4',
author="Rok Roskar",
author_email="roskar@ethz.ch",
url="http://sparkhpc.readthedocs.io",
description="spark deployment on hpc resources made easy",
package_dir={'sparkhpc/':''},
packages=['sparkhpc'],
... |
__author__ = 'Kalyan'
notes = '''
This problem will require you to put together many things you have learnt
in earlier units to solve a problem.
In particular you will use functions, nested functions, file i/o, functions, lists, dicts, iterators, generators,
comprehensions, sorting etc.
Read the constraints ca... |
# Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0
import colcon_ros_bundle
def test_version():
version = colcon_ros_bundle.__version__
assert version == '0.1.1' |
import os
import sys
sys.path.insert(0, './sackmann')
import re
import datetime
import numpy as np
import pandas as pd
import elo_538 as elo
from tennisMatchProbability import matchProb
from processing_util import normalize_name
from data_classes import stats_52, adj_stats_52, tny_52, commop_stats
from collections im... |
#!/usr/bin/env python
#
# Copyright 2007 Google 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 o... |
import logging
import random
import numpy as np
from dpu_utils.utils import run_and_debug, RichPath
from data.representationviz import RepresentationsVisualizer
from data.synthetic.charedits import get_dataset
from editrepcomponents.alignededitencoder import AlignedEditTokensEmbedding
from dpu_utils.ptutils import B... |
from discord.ext import commands
import discord
import platform
import os
class maintenanceCommand(commands.Cog):
def __init__(self, bot):
self.bot = bot
cur_path = os.path.dirname(__file__)
async def on(self, ctx):
server = []
entries = os.listdir('server/')
for entry in... |
"""
Tests sklearn linear classifiers (LinearRegression, LogisticRegression, SGDClassifier, LogisticRegressionCV) converters.
"""
import unittest
import warnings
import numpy as np
import torch
from sklearn.linear_model import LinearRegression, LogisticRegression, SGDClassifier, LogisticRegressionCV
from sklearn import... |
from .hogsvd import HigherOrderGSVD
from ._version import __version__
__all__ = ['HigherOrderGSVD', '__version__'] |
class Solution:
def grayCode(self, n):
if n < 1: return [0,]
if n == 1: return [0,1]
pre_bit = 1<<(n-1)
lower = self.grayCode(n-1)
return lower + [(pre_bit|i) for i in reversed(lower)] |
from __future__ import absolute_import, division, print_function
from setuptools import find_packages, setup
# Long description will go up on the pypi page
with open("README.md") as file:
LONG_DESCRIPTION = file.read()
# Dependencies.
with open("requirements.txt") as f:
requirements = f.readlines()
with ope... |
from cfg.process import cfg_yielder
from .darkop import create_darkop
from utils import loader
import warnings
import time
import os
class Darknet(object):
_EXT = '.weights'
def __init__(self, FLAGS):
self.get_weight_src(FLAGS)
self.modify = False
print('Parsing {}'.format(self.src_c... |
__all__ = ['nitro_service', 'options'] |
# coding=utf-8
"""
This code was generated by
\ / _ _ _| _ _
| (_)\/(_)(_|\/| |(/_ v1.0.0
/ /
"""
from twilio.base import deserialize
from twilio.base import values
from twilio.base.instance_context import InstanceContext
from twilio.base.instance_resource import InstanceResource
from twilio.base.... |
from settings_base import *
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'NAME': 'pytest_django',
'HOST': 'localhost',
'USER': 'root',
'OPTIONS': {
'init_command': 'SET storage_engine=InnoDB'
}
},
} |
from flask_login import UserMixin
class User(UserMixin):
def __init__(self, id_, name, password, roles,rid):
self.id = id_
self.rid = rid
self.name = name
self.password = password
self.roles = roles
def has_role(self, role):
return role in self.roles |
#
# Copyright (c) 2019, Neptune Labs Sp. z o.o.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agr... |
#
# 画像をリサイズ.
#
##################################################
# import
##################################################
import lcd
import sensor
##################################################
# initialize
##################################################
# LCDを初期化
lcd.init()
# LCDの方向を設定
lcd.direction(lcd.Y... |
import pytest
import numpy as np
from itertools import zip_longest
from paminco.net import load_sioux
from paminco.net._data_gas import temporary_gas_files
from paminco.net._data_examples import (NET_SIMPLE_POLYNOMIAL,
NET_ELECTRICAL_PIECEWISE)
from paminco.net.network import Ne... |
from urllib.parse import urlparse
from urllib.request import urlopen, Request
import urllib
import bs4
import requests
import html5lib
def weather_search(area):
input_area = area
enc_area = urllib.parse.quote(input_area+'날씨')
url = 'https://search.naver.com/search.naver?ie=utf8&query='+enc_area
req =... |
"""Support for the Tank Utility propane monitor."""
import datetime
import logging
import requests
from tank_utility import auth, device as tank_monitor
import voluptuous as vol
from openpeerpower.components.sensor import PLATFORM_SCHEMA, SensorEntity
from openpeerpower.const import CONF_DEVICES, CONF_EMAIL, CONF_PA... |
""" Horizontal histogram plotting function. """
from __future__ import absolute_import
import matplotlib.pyplot as plt
import numpy as np
def horizontal_hist(items, title=None, axis_label=None, color=None, height=10, width=20, reverse=False):
"""
Plots a histogram of values and frequencies.
Arguments:
... |
# 环境变量配置,用于控制是否使用GPU
# 说明文档:https://paddlex.readthedocs.io/zh_CN/develop/appendix/parameters.html#gpu
import os
os.environ['CUDA_VISIBLE_DEVICES'] = '0'
from paddlex.det import transforms
import paddlex as pdx
# 下载和解压小度熊分拣数据集
xiaoduxiong_dataset = 'https://bj.bcebos.com/paddlex/datasets/xiaoduxiong_ins_det.tar.gz'
pd... |
# -*- coding: utf-8 -*-
# Scrapy settings for webCrawler_scrapy project
#
# For simplicity, this file contains only settings considered important or
# commonly used. You can find more settings consulting the documentation:
#
# http://doc.scrapy.org/en/latest/topics/settings.html
# http://scrapy.readthedocs.org... |
# Copyright (C) 2019 Google Inc.
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
import json
from logging import getLogger
from sqlalchemy.orm import backref
from ggrc import db
from ggrc.models import all_models
from ggrc.builder import simple_property
from ggrc.models.context import ... |
"""
Train an RNN decoder to make binary predictions;
then train an RNN language model to generate sequences
"""
import contextlib
from collections import defaultdict
import numpy as np
import torch
import torch.nn as nn
import torch.optim as optim
import models
import util
import data
import os
import vis
import em... |
# Copyright 2013 Red Hat, 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 agre... |
import sys
from django.utils.timezone import now
try:
from django.db import models
except Exception:
print("There was an error loading django modules. Do you have django installed?")
sys.exit()
from django.conf import settings
import uuid
# Instructor model
class Instructor(models.Model):
user = mode... |
from CONST import *
from Player import Player
from Background import Background
from Platform import Platform
from Enemy import Enemy
from menu import Menu
def main():
pygame.init()
clock = pygame.time.Clock()
player = Player()
bg = Background()
menu = Menu()
isInMenu = True
... |
# 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... |
from time import time
from tkinter import Tk, Button, Entry, PhotoImage, CENTER, TclError, Canvas, NW
from MazeRender import make_walls, coins_renderer
from SavingMananger import load_settings, load_leaderboard, continue_game, \
save_game, update_settings, save_score
from Enemy import Enemy
from Player import Playe... |
import basic
while True:
text = input('console > ')
if text.strip() == "": continue
result, error = basic.run('<stdin>', text)
if error:
print(error.as_string())
elif result:
if len(result.elements) == 1:
print(repr(result.elements[0]))
else:
print(repr(result)) |
# -*- coding: utf-8 -*-
"""
Created on Thu Jan 23 13:31:31 2021
@author: Annisa Nurdiana and Student ID = 001202000067
"""
print("\n---------Practice 2---------")
# --------Data types, variable--------
name = "Annisa Nurdiana"
age = 18
studentID = "001202000067"
print("Hello my name is ", name,"and I am ",age," years... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
class Validator:
def _area_validator(self, area):
if len(area) != 2:
return False
for character in str(area):
if not character.isalpha():
return False
return True
def _cara_validator(self, cara):
... |
"""
WSGI config for nandiasgarden project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/2.2/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault('DJANGO... |
# Programa -> Conversão de bases (qualquer uma) - Gui Reis - Mack (31920918)
# 19 linhas
alfabeto = ('a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z')
num_str = str(input('Número: ')).lower()
bi = int(input('Base inicial: '))
bf = int(input('Base final: '))
... |
# Plot three cubes lit by two lights with different attenuation
# profiles. The blue light has slower linear attenuation, the
# green one has quadratic attenuation that makes it decay
# faster. Note that there are no shadow effects included so each
# box gets lit by both lights.
#
import pyvista as pv
plotter = pv.Plo... |
# -*- coding: utf-8 -*-
from redap.specs.definitions import LDAP_OPERATION
from . import param_path, get_user_spec
data = get_user_spec(
summary='Unlock user',
params=[param_path],
responses=[(201, LDAP_OPERATION)]
) |
import tensorflow as tf
import numpy as np
from model_fn.graph_base import GraphBase
from model_fn.model_fn_nlp.util_nlp.attention import Selfattention, MultiHeadAttention
from model_fn.model_fn_nlp.util_nlp.transformer import EncoderLayer, Encoder, Decoder
import model_fn.model_fn_nlp.util_nlp.graphs_bert_lm as bert_... |
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
import datetime
import logging
import tempfile
import time
import os
import json
from collections import OrderedDict
import torch
from tqdm import tqdm
from ..utils.comm import is_main_process
from ..utils.comm import scatter_gather
from ..utils... |
import os
import pytest
import shutil
import tempfile
from pathlib import Path
from nip import parse, dump, load, construct
from nip.utils import deep_equals
import builders
class TestConfigLoadDump:
save_folder: Path
@classmethod
def setup_class(cls):
cls.save_folder = Path(tempfile.mkdtemp())... |
# 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
# distributed under t... |
# Note: this module should be self-contained to run tests (as it relies on `threading` not being
# imported and having no other threads running).
def wait_for_condition(condition, msg=None, timeout=5, sleep=.05):
import time
curtime = time.time()
while True:
if condition():
break
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.