text stringlengths 1 927k |
|---|
from pywps import Service
from pywps.tests import assert_response_success
from flyingpigeon.processes import PointinspectionProcess
from flyingpigeon.tests.common import TESTDATA, client_for, CFG_FILE
import os
datainputs_fmt = (
"resource=files@xlink:href={0};"
"coords={1};"
)
def test_wps_point_inspectio... |
# Support for the MATRIX Voice
# https://www.matrix.one/products/voice
# Author: Andres Calderon <andres.calderon@admobilize.com>
# FPGA: Spartan 6 xc6slx9-2-ftg256
# Copyright 2020 MATRIX Labs
# License: BSD
from fractions import Fraction
from migen import *
from migen.genlib.resetsync import AsyncResetSynchronizer
... |
"""
Model services code
"""
from . import model_service |
from django.test import TestCase
from django.contrib.auth import get_user_model
from tasks.models import Task
class ViewsTest(TestCase):
user_model = get_user_model()
def setUp(self):
self.user = self.user_model(username='testuser', email='test@test.com')
self.user.set_password('qwertyuiop')... |
import denga.augment as au
import pandas as pd
class Genda():
def __init__(self,filepath):
self.filepath = filepath
self.dataset = None
try:
self.dataset = pd.read_csv(self.filepath, header= None, error_bad_lines=False)
except:
raise Exception("ERROR: File Missing")
self.data = None
def generate... |
import json
import os
from typing import List
from fastapi import BackgroundTasks, Body, FastAPI
from fastapi.middleware.cors import CORSMiddleware
from fastapi.responses import FileResponse, RedirectResponse
from data.model import (
DisItem,
DistractorOrder,
Distractors,
DistractorSelectionStrategry,... |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import api, fields, models
from odoo.exceptions import UserError
from odoo.addons.iap.models import iap
DEFAULT_ENDPOINT = 'https://iap-sms.odoo.com'
class SmsApi(models.AbstractModel):
_name = 'sms.api'... |
from enum import IntEnum
class CTL0(IntEnum):
SRESET = 0x1 << 15 # Software reset
SALT = 0x1 << 13 # SMBus alert
PECTRANS = 0x1 << 12 # PEC Transfer
POAP = 0x1 << 11 # Position of ACK and PEC when receiving
ACKEN = 0x1 << 10 # Whether or not to send an ACK
STOP = 0x1... |
# included from snippets/main.py
def debug(*x, msg=""):
import sys
print(msg, *x, file=sys.stderr)
def solve(SOLVE_PARAMS):
pass
def main():
N = int(input())
d = 999
ret = 0
while N > d:
ret += N - d
d = d * 1000 + 999
print(ret)
# tests
T1 = """
1010
"""
TEST_T1 = ... |
import json
import requests
import pandas as pd
from typing import List
from haws.services.setup_helper import get_runtime_settings
from haws.main import logger
# Get the bearer token - see https://dev.leanix.net/v4.0/docs/authentication
def authenticate():
settings = get_runtime_settings()
api_token = setti... |
from pathlib import Path
from modlunky2.sprites.base_classes import BaseSpriteLoader
class HudSheet(BaseSpriteLoader):
_sprite_sheet_path = Path("Data/Textures/hud.png")
_chunk_size = 32
_chunk_map = {
# What are these things?
"hud_bar_long": (0, 0, 8, 2),
"hud_bar_medium": (9, 0,... |
from itertools import chain
from rhymes import (
read_cmu_dict,
analyze_rhyme
)
WORD_KEYS, _ = read_cmu_dict()
class Poem:
def __init__(self, lines, title=""):
self.read_lines(lines)
self.title = title or str(self.stanzas[0].lines[0])
def read_l... |
import os
class Empresa():
def __init__(self,nom="",ruc=0,dire="",tele=0,ciud="",tipEmpr=""):
self.nombre=nom
self.ruc=ruc
self.direccion=dire
self.telefono=tele
self.ciudad=ciud
self.tipoEmpresa=tipEmpr
def datosEmpresa(self):#3
self.nombre=input("Ingres... |
# Copyright (C) 2017 Dmitry Marakasov <amdmi3@amdmi3.ru>
#
# This file is part of repology
#
# repology 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) an... |
import pandas as pd
import networkx as nx
from networkx.algorithms import dijkstra_path
import itertools
import time
import datetime as dt
# import matplotlib.pyplot as plt
# Retourne la liste de toutes les villes du dataframe
def GetListOfcolnames(data):
listofColnames = list(data.columns)[1:]
return listofC... |
DIFFICULTY = 5
DB_FILE = "blockchain_db/blockchain.db" |
n = int(input('digite um número inteiro: '))
op = int(input('''escolha uma opção de conversão:
[ 1 ] Binário
[ 2 ] Octal
[ 3 ] Hexadecimal'''))
if op == 1:
print(bin(n)[2:])
elif op == 2:
print(oct(n)[2:])
elif op == 3:
print(hex(n)[2:]) |
# Copyright (c) OpenMMLab. All rights reserved.
from typing import List
from torch import Tensor
from mmdeploy.core import SYMBOLIC_REWRITER
# Here using mmcv.ops.roi_align_rotated.__self__ to find
# mmcv.ops.roi_align.RoIAlignRotatedFunction, because RoIAlignRotatedFunction
# is not visible in mmcv.
@SYMBOLIC_REWR... |
from django.urls import path
from post.views import index,NewPost, PostDetails, tags, like, favorite
from . import views
urlpatterns = [
path('', views.index, name='index'),
path('newpost/', NewPost, name='newpost'),
path('<uuid:post_id>', PostDetails, name='postdetails'),
path('tag/<slug:tag_slug>', tags, name... |
# -*- encoding:utf-8 -*-
import discord
from discord.ext.commands import check, NotOwner
def is_owner():
"""
A :func:`.check` that checks if the person invoking this command is the
owner of the bot.
This is powered by :meth:`.Bot.is_owner`.
This check raises a special exception, :exc:`.NotOwner`... |
"""This module contains the general information for EtherRxStats ManagedObject."""
from ...ucscentralmo import ManagedObject
from ...ucscentralcoremeta import UcsCentralVersion, MoPropertyMeta, MoMeta
from ...ucscentralmeta import VersionMeta
class EtherRxStatsConsts():
SUSPECT_FALSE = "false"
SUSPECT_NO = "... |
#!/usr/bin/env python3
''' drugcentral_psql_to_drugcentral_json.py: Converts a PostgreSQL output
file and the query that produced it and stores it under a key in
a JSON file.
Usage: drugcentral_psql_to_drugcentral_json.py <inputFile.txt>
<outputFile.json> <outputKey> --query <query>
'''
import json
i... |
from django.db import models
# Create your models here.
class StockData(models.Model):
trade_date = models.DateField()
close_price = models.FloatField() |
"""
High level interface to PyTables for reading and writing pandas data structures
to disk
"""
# pylint: disable-msg=E1101,W0613,W0603
from datetime import datetime, date
import time
import re
import copy
import itertools
import warnings
import os
from pandas.types.common import (is_list_like,
... |
"""Unittests for the deepblink.augment module."""
# pylint: disable=missing-function-docstring
from hypothesis import given
from hypothesis.extra.numpy import arrays
import numpy as np
import pytest
from deepblink.augment import augment_batch_baseline
from deepblink.augment import flip
from deepblink.augment import g... |
"""
*
* Copyright (c) 2021 Manuel Yves Galliker
* 2021 Autonomous Systems Lab ETH Zurich
* 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 cod... |
# Copyright (c) 2013 OpenStack Foundation.
#
# 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... |
from django.shortcuts import render, redirect
from django.core.urlresolvers import reverse
from django.http import HttpResponse
from django.http import HttpResponseRedirect
from django.contrib.auth.decorators import login_required
from django.contrib.auth import authenticate, login, logout
from django.contrib import me... |
# ==============================================================================
# Copyright (c) 2018, Yamagishi Laboratory, National Institute of Informatics
# Author: Yusuke Yasuda (yasuda@nii.ac.jp)
# All rights reserved.
# ==============================================================================
""" Models. ""... |
"""
mathfuncs.py
Contains mathematical functions for use in interpreting formulas.
Contains some helper functions used in grading formulae:
* within_tolerance
Defines:
* DEFAULT_FUNCTIONS
* DEFAULT_VARIABLES
* DEFAULT_SUFFIXES
* METRIC_SUFFIXES
"""
from __future__ import print_function, division, absolute_import, un... |
from setuptools import setup
setup(
name='sanity',
version='1.0',
author='Greg Flynn',
url='https://github.com/gregflynn/dotsanity',
packages=['sanity'],
provides=['sanity'],
install_requires=[
'click==7.1.2',
'dataset==1.3.1',
'requests==2.24.0',
'tabulate=... |
# Copyright 2018 Amazon.com, Inc. or its affiliates. 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.
# A copy of the License is located at
# http://www.apache.org/licenses/LICENSE-2.0
# or in the "license" file... |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes ... |
import math
import random
from matplotlib.pyplot import *
class Dot:
def __init__(self, x = 0.0, y = 0.0):
self.x = x
self.y = y
def distanceOf2Dot(dot1, dot2):
return ((dot2.x - dot1.x)**2 + (dot2.y - dot1.y)**2) ** 0.5
def get13dot(dot1, dot2):
return Dot(dot2.x / 3 + 2*dot1.x / 3, dot2... |
import setuptools
setuptools.setup(
name = 'appwrite',
packages = ['appwrite', 'appwrite/services'],
version = '0.0.4',
license='BSD-3-Clause',
description = 'Appwrite backend as a service cuts up to 70% of the time and costs required for building a modern application. We abstract and simplify common develop... |
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 = "PolyTrend", cycle_length = 5, transform = "None", sigma = 0.0, exog_count = 100, ar_order = 0); |
from jiamtrader.app.cta_strategy import (
CtaTemplate,
StopOrder,
TickData,
BarData,
TradeData,
OrderData,
BarGenerator,
ArrayManager,
)
import pandas_ta as ta
import pandas as pd
class KingKeltnerStrategy(CtaTemplate):
""""""
author = "用Python的交易员"
kk_length = 11
kk_... |
# -*- coding: utf-8 -*-
'''
The module used to execute states in salt. A state is unlike a module
execution in that instead of just executing a command it ensure that a
certain state is present on the system.
The data sent to the state calls is as follows:
{ 'state': '<state module name>',
'fun': '<state fun... |
import matplotlib.pyplot as plt
from datetime import datetime
import numpy as np
import torch
import os
import time
from scipy.ndimage.filters import gaussian_filter1d
from itertools import repeat
import copy
import gym
# import torch.multiprocessing as multiprocessing
import multiprocessing
import pickle
import matplo... |
import discord
from discord.ext import commands
from x86 import helpers
class Ping:
"""Ping command"""
@commands.command()
@commands.cooldown(6,12)
async def ping(self, ctx):
"""Ping the bot"""
#heartbeat latency (i'll be honest, dont really understand how it works)
hb_latency... |
"""Test sqlalchemy types."""
from .common import db
class Test(db.Model):
"""Test."""
id = db.Column(db.Integer, primary_key=True)
name = db.Column(db.String(80), unique=True, nullable=False) |
#!/usr/bin/env python3
# SPDX-License-Identifier: Apache-2.0
#
# Copyright (C) 2021 Micron Technology, Inc. All rights reserved.
'''
To add keys to LC and make sure that an unintended ingest doesn't move it all to cn set these
two run time params:
1. durability.enabled = false // kvdb_sync() ingests to lc + cn
... |
from lemur.plugins.bases import DestinationPlugin
class TestDestinationPlugin(DestinationPlugin):
title = 'Test'
slug = 'test-destination'
description = 'Enables testing'
author = 'Kevin Glisson'
author_url = 'https://github.com/netflix/lemur.git'
def __init__(self, *args, **kwargs):
... |
from werkzeug.security import generate_password_hash, check_password_hash
from shopyoapi.init import db
from flask_login import UserMixin
from modules.course.models import Course
from modules.lightcourse.models import LightCourse
from modules.course.models import QuizHistory
course_subs = db.Table('course_subs',
... |
import torch
import torch.nn as nn
class LabelSmoothingLoss(nn.Module):
"""
Provides Label-Smoothing loss.
Args:
class_num (int): the number of classfication
ignore_index (int): Indexes that are ignored when calculating loss
smoothing (float): ratio of smoothing (confidence = 1.0 -... |
from unittest import mock
from django_celery_beat.models import PeriodicTask, CrontabSchedule
from service_catalog.celery_beat_scheduler import DatabaseSchedulerWithCleanup
from tests.test_service_catalog.base import BaseTest
from service_catalog.celery import app
class TestCeleryBeatScheduler(BaseTest):
@moc... |
from random import randrange
from sympy.simplify.hyperexpand import (ShiftA, ShiftB, UnShiftA, UnShiftB,
MeijerShiftA, MeijerShiftB, MeijerShiftC, MeijerShiftD,
MeijerUnShiftA, MeijerUnShiftB, MeijerUnShiftC,
MeijerUnShiftD,
Re... |
from datetime import datetime
from hashlib import md5
from time import time
from flask_login import UserMixin
from werkzeug.security import generate_password_hash, check_password_hash
import jwt
from app import app, db, login
followers = db.Table(
'followers',
db.Column('follower_id', db.Integer, db.ForeignKe... |
x1, y1, r = map(int, input().split())
x2, y2, x3, y3 = map(int, input().split())
ans1 = 'YES'
if x2 <= x1-r and x1+r <= x3 and y2 <= y1-r and y1+r <= y3:
ans1 = 'NO'
ans2 = 'YES'
if (x3 - x1) ** 2 + (y3 - y1) ** 2 <= r ** 2 and \
(x2 - x1) ** 2 + (y2 - y1) ** 2 <= r ** 2 and \
(x3 - x1) ** 2 + (y2 - y1) *... |
"""
Contains the git Hoster abstraction.
"""
from typing import Iterator, Set, Union
from IGitt.Interfaces import IGittObject, Token
from IGitt.Interfaces.Repository import Repository
from IGitt.Interfaces.Issue import Issue
from IGitt.Interfaces.MergeRequest import MergeRequest
class Hoster(IGittObject):
"""
... |
import requests
import Mark
from colorama import Fore
from util.plugins.common import print_slow, getheaders, proxy
def StatusChanger(token, Status):
#change status
CustomStatus = {"custom_status": {"text": Status}} #{"text": Status, "emoji_name": "☢"} if you want to add an emoji to the status
try:
... |
# Author: Simon Blanke
# Email: simon.blanke@yahoo.com
# License: MIT License
import numpy as np
import pandas as pd
class Memory:
def __init__(self, warm_start, conv):
self.memory_dict = {}
self.memory_dict_new = {}
self.conv = conv
if warm_start is None:
return
... |
#!/usr/bin/env python
# Fuente: https://www.youtube.com/watch?v=aE7RQNhwnPQ / 7:45
import rospy
from geometry_msgs.msg import Twist
from std_msgs.msg import Float64MultiArray, Header
from sensor_msgs.msg import LaserScan
''' Teleop '''
R = 0.1016 # Radio de las ruedas en metros
L = 0.3219 # Distancia entre las rued... |
#coding=utf-8
#filter for chembl_chemicals
#CHOOSE "uM,nM,microM,M,umol/L,nmol/L"
#FILEOUT:
f2=open("chembl_filter_2.txt","w")
f1=open("chembl_filter_1.txt","w")
with open("chembl_all.txt","r") as f:
a=f.readline().split("\t")
f.seek(0,0)
i=0
chembl_set=set()
try:
while a[0]!="":
... |
"""
WSGI config for fw_django 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.1/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault('DJANGO_SET... |
# vim: set fileencoding=utf-8 :
#
# Copyright (c) 2013 Daniel Truemper <truemped at googlemail.com>
#
# 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/LICENS... |
from models.mensagem import Mensagem
from views.principal import Principal as PrincipalView
mensagem = Mensagem()
def sair():
mensagem.titulo("Saindo...")
mensagem.alerta("Obrigado por utilizar nosso sistema!")
exit()
if __name__ == '__main__':
principal = PrincipalView()
principal.inicial()
... |
# -*- coding: utf-8 -*-
# The MIT License (MIT)
#
# Copyright (c) 2015 Björn Larsson
#
# 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 r... |
if "a" == "a":
print("a")
else:
print("b") |
from six import add_metaclass
from abc import ABCMeta
from abstract_has_constraints \
import AbstractHasConstraints
from abstract_has_label \
import AbstractHasLabel
@add_metaclass(ABCMeta)
class AbstractVertex(AbstractHasConstraints, AbstractHasLabel):
""" A vertex in a graph
"""
__slots__ = () |
# Generated by Django 3.1.4 on 2020-12-11 05:38
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('cotiza', '0013_todo_fecha'),
]
operations = [
migrations.AddField(
model_name='todo',
name='kms',
field=... |
import sys
from pathlib import Path
import unittest
thisDir = Path(__file__).parent.absolute()
sys.path.insert(0, str(thisDir.parent))
sys.path.insert(0, str(thisDir))
from ImportTimeline import ImportTimelineTestCase
class Tests(ImportTimelineTestCase):
def testInterference(self):
self.etalon = [
"from lazil... |
#!/usr/bin/env python3
import os, sys, re
import struct
import gzip
from itertools import chain
# This is a stand-alone script to inspect a CBCL file - see the format description at
# https://support.illumina.com/content/dam/illumina-support/documents/documentation/software_documentation/bcl2fastq/bcl2fastq2_guide_150... |
import discord
from discord.ext import commands
import random
# This determines a keyword that the bot will look for. Having nothing means it can reply even when the bot isnt called
client = commands.Bot(command_prefix="")
# this will print as soon as the bot is live
@client.event
async def on_ready():
print("bot is... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.FileItem import FileItem
from alipay.aop.api.constant.ParamConstants import *
from alipay.aop.api.domain.ZhimaCustomerCertificationQueryModel import ZhimaCustomerCertificationQueryModel
class ZhimaCustomerCertificationQueryRequest(object... |
import tweepy
bearer_token = ""
client = tweepy.Client(bearer_token)
# Get User's Tweets
# This endpoint/method returns Tweets composed by a single user, specified by
# the requested user ID
user_id = 2244994945
response = client.get_users_tweets(user_id)
# By default, only the ID and text fields of each Tweet ... |
# coding=utf-8
# Copyright 2020 Microsoft and the Hugging Face Inc. team.
#
# 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 require... |
"""make read -> reads
Create Date: 2021-02-24 10:58:25.108079
"""
import enumtables # noqa: F401
from alembic import op
# revision identifiers, used by Alembic.
revision = "20210224_105823"
down_revision = "20210222_220412"
branch_labels = None
depends_on = None
def upgrade():
op.rename_table(
"sequen... |
"""Command line interface to schema-salad."""
from __future__ import absolute_import, print_function
import argparse
import logging
import os
import sys
from typing import Any, Dict, List, Mapping, MutableSequence, Optional, Union, cast
import pkg_resources # part of setuptools
import six
from rdflib.parser import P... |
from dataclasses import dataclass, field
from enum import Enum
from typing import Optional
__NAMESPACE__ = "NISTSchema-SV-IV-atomic-integer-enumeration-5-NS"
class NistschemaSvIvAtomicIntegerEnumeration5Type(Enum):
VALUE_MINUS_165130515156176 = -165130515156176
VALUE_MINUS_4149 = -4149
VALUE_848 = 848
... |
"""Unit tests for numbers.py."""
import math
import operator
import unittest
from numbers import Complex, Real, Rational, Integral
class TestNumbers(unittest.TestCase):
def test_int(self):
self.assertTrue(issubclass(int, Integral))
# self.assertTrue(issubclass(int, Complex)) # Error in Julia
... |
# Copyright 2013, Big Switch Networks
#
# 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 ... |
"""Pydaikin appliance, represent a Daikin BRP069 device."""
import logging
from pydaikin.daikin_base import Appliance
_LOGGER = logging.getLogger(__name__)
class DaikinInterface(Appliance):
TRANSLATIONS = {
'mode': {
'2': 'dry',
'3': 'cool',
'4': 'hot',
... |
import pygal
from die import Die
# Create two D6 dice.
die_1 = Die()
die_2 = Die()
# Make some rolls, and store results in a list.
results = []
for roll_num in range(1000):
result = die_1.roll() + die_2.roll()
results.append(result)
# Analyze the results.
frequencies = []
max_result = die_1.num_sides + ... |
#!/usr/bin/env python
import typer
from typing import List, Tuple
import callbacks
import ersa_search
import logger
from os import environ
import colors
import search_ibd_files
app = typer.Typer(add_completion=False)
color_formatter: colors.Color = colors.Color()
def display_input(grid_list: str, cores: int, ibd_fil... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Author: Mara Alexandru Cristian
# Contact: alexandru.mara@ugent.be
# Date: 18/12/2018
# The manager module contains functions and classes for reading, parsing and using a configuration file to
# run a complete evaluation of network embedding methods.
from __future__ imp... |
#
# 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... |
import math
name = input()
budget = float(input())
beer_count = int(input())
chips_count = int(input())
beer = 1.20
beer_cost = beer_count * beer
b = beer_cost * 0.45
chips_cost = math.ceil(b * chips_count)
total_sum = beer_cost + chips_cost
if total_sum <= budget:
print(f"{name} bought a snack and has {budget ... |
# coding: utf-8
#
# Copyright 2022 :Barry-Thomas-Paul: Moss
#
# 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... |
# 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 PyTerminado(PythonPackage):
"""Terminals served to term.js using Tornado websockets"""
... |
from pyunity import Behaviour, GameObject, SceneManager, Material, Color, Mesh, Vector3, MeshRenderer
class Switch(Behaviour):
def Start(self):
self.a = 3
def Update(self, dt):
self.a -= dt
if self.a < 0:
SceneManager.LoadSceneByIndex(1)
def main():
scene = SceneManage... |
#!/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.
"""Helpful routines for regression testing."""
from base64 import b64encode
from binascii import hexlify,... |
# Lot's of stuff for making text prettier
# try to import all the needed libraries, if it doesn't work,
# make all the functions do nothing.
try:
import colorama
from termcolor import colored
colorama.init()
def bold(string):
return colored(string, attrs = ["bold"])
def underline(string):
... |
default_app_config = 'demo.apps.partner.config.PartnerConfig' |
from dagster_graphql.test.utils import infer_pipeline_selector
from dagster_graphql_tests.graphql.setup import LONG_INT
from .graphql_context_test_suite import ExecutingGraphQLContextTestMatrix
from .utils import sync_execute_get_events
class TestMaterializations(ExecutingGraphQLContextTestMatrix):
def test_mate... |
from veracode_api_py.dynamic import Analyses, Scans, ScanCapacitySummary, ScanOccurrences, ScannerVariables, DynUtils, Occurrences
url = DynUtils().setup_url('http://www.example.com','DIRECTORY_AND_SUBDIRECTORY',False)
allowed_hosts = [url]
auth = DynUtils().setup_auth('AUTO','admin','smithy')
auth_config = DynUtil... |
## Recommendation.py will take in a set of 4 numbers representing which illness the person has
import re #regular expression library - powerful tool for processing text
import sys
survey = sys.argv
#print str(survey)
disease = ''
#print(survey[1])
if survey[1] == '1':
disease = 'PTSD'
data = open('ptsd.txt')
e... |
"""Default configuration
Use env var to override
"""
import os
ENV = os.getenv("FLASK_ENV")
DEBUG = ENV == "development"
SECRET_KEY = os.getenv("SECRET_KEY") |
# Copyright (c) 2019, NVIDIA Corporation. All rights reserved.
#
# This work is made available under the Nvidia Source Code License-NC.
# To view a copy of this license, visit
# https://nvlabs.github.io/stylegan2/license.html
"""Perceptual Path Length (PPL)."""
import numpy as np
import tensorflow as tf
import dnnlib... |
from utils import CanadianJurisdiction
class NorthDumfries(CanadianJurisdiction):
classification = 'legislature'
division_id = 'ocd-division/country:ca/csd:3530004'
division_name = 'North Dumfries'
name = 'North Dumfries Township Council'
url = 'http://www.northdumfries.ca' |
# 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 __future__ import print_function
import copy
import os
import sys
import llnl.util.tty as tty
import llnl.util.tty.... |
"""
patterns
--------
Common regex patterns for including in scripts.
"""
us_phone = r"\(\d\d\d\) \d\d\d-?\d\d\d\d"
short_date = r"\d?\d/\d?\d/\d\d\d\d"
ssn = r"\d\d\d-\d\d-\d\d\d\d"
time_format = r"[0-9]?[0-9]:[0-9][0-9]"
zip_code = r"\d{5}-\d{4}|\d{5}"
last_first = r"([\w\-]+)\s*,\s*(\w+)\s*"
ip_address = r"\d{1,3}... |
import copy
a = [1,2,3,4]
b = copy.copy(a) # Shallow copy
print(a)
print(b)
b.append(1)
print(a)
print(b) |
DICTIONARY = '''acclimatisation acclimatization
acclimatise acclimatize
acclimatised acclimatized
acclimatising acclimatizing
actualisation actualization
actualise actualize
actualised actualized
actualising actualizing
aeon eon
aeons eons
aeroplane airplane
aetiology etiology
aggrandise aggrandize
aggrandised aggrandi... |
import os
from step_project.utils.import_methods import import_pygraphviz
from common_utils.file_utils import get_settings
def create_project_graph(project, output_filename='project_graph'):
# Nodes
nodes = []
edges = []
for d in sorted(os.listdir('.')):
if os.path.isdir(d) and os.path.isfile(... |
class response:
codes = {"Bad request": 1, "Success": 2, "Internal error":3, "Denied":4, "Accepted":5}
def __init__(self, Response, Data=None, _bool=None):
"""Possible Responses: Bad request, Success, Internal error
"""
self.Response = Response
self.Data = Data
self.Code ... |
"""
Python Lexical Analyser
Regular Expressions
"""
import array
import string
import types
from sys import maxsize
from plex import errors
#
# Constants
#
BOL = 'bol'
EOL = 'eol'
EOF = 'eof'
nl_code = ord('\n')
#
# Helper functions
#
def chars_to_ranges(s):
"""
Return a list of character codes consi... |
from shuttle import __version__
def test_version():
assert __version__ == '0.1.0' |
from collections import defaultdict
from tqdm import tqdm
import csv
def get_sequence(data, k):
n = len(data)
dict_sequences = defaultdict(int)
id_ = 0
for x in tqdm(data):
for j in range(n - k + 1):
sequence = tuple(x[j : j + k])
if sequence not in dict_sequences:
... |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.1 on 2016-03-02 04:42
from __future__ import unicode_literals
import core.models
from django.db import migrations
import wagtail.wagtailcore.blocks
import wagtail.wagtailcore.fields
import wagtail.wagtailimages.blocks
class Migration(migrations.Migration):
depen... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.