src stringlengths 721 1.04M |
|---|
from conceptdb.freebase_imports import MQLQuery
from conceptdb.assertion import Assertion
from conceptdb.metadata import Dataset
from mongoengine.queryset import DoesNotExist
import freebase
import conceptdb
def test_freebase_allresults():
Assertion.drop_collection()
query_args = {'id':'/en/the_beatles',... |
#Copyright (c) 2017 Vantiv eCommerce
#
#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, merge, publish, distri... |
# -*- coding: utf-8 -*-
import pytest
from envparse import Env, env, ConfigurationError, urlparse
env_vars = dict(
BLANK='',
STR='foo',
INT='42',
FLOAT='33.3',
BOOL_TRUE='1',
BOOL_FALSE='0',
PROXIED='{{STR}}',
LIST_STR='foo,bar',
LIST_STR_WITH_SPACES=' foo, bar',
LIST_INT='1,... |
# -*- coding: utf-8 -*-
# Copyright (c) Jupyter Development Team.
# Distributed under the terms of the Modified BSD License.
from __future__ import print_function
from setuptools import setup, find_packages, Command
from setuptools.command.sdist import sdist
from setuptools.command.build_py import build_py
from setup... |
import unittest
from test.asserting.formatter import FormatterAssertion
import json
from pathlib import Path
from vint.linting.formatter.json_formatter import JSONFormatter
from vint.linting.level import Level
class TestJSONFormatter(FormatterAssertion, unittest.TestCase):
def test_format_violations(self):
... |
# -*- coding: utf-8 -*-
import logging
from random import shuffle
from claw.constants import RE_DELIMITER
log = logging.getLogger(__name__)
def safe_format(format_string, *args, **kwargs):
"""
Helper: formats string with any combination of bytestrings/unicode
strings without raising exceptions
"""... |
# -*- coding: utf-8 -*-
##############################################################################
#
# Copyright (C) 2011-15 Agile Business Group sagl (<http://www.agilebg.com>)
# Copyright (C) 2011 Domsense srl (<http://www.domsense.com>)
#
# This program is free software: you can redistribute it and/or m... |
import json
from django.contrib.auth.models import Group
from django.core.urlresolvers import reverse
from hs_core import hydroshare
from hs_core.views import change_quota_holder
from hs_core.testing import MockIRODSTestCaseMixin, ViewTestCase
from hs_access_control.models import PrivilegeCodes
class TestChangeQuot... |
"""This module implements a loader and dumper for the svmlight format
This format is a text-based format, with one sample per line. It does
not store zero valued features hence is suitable for sparse dataset.
The first element of each line can be used to store a target variable to
predict.
This format is used as the... |
""" MultiQC module to parse output from HOPS postprocessing script """
from __future__ import print_function
from collections import OrderedDict
import logging
import json
from multiqc.plots import heatmap
from multiqc.utils import config
from multiqc.modules.base_module import BaseMultiqcModule
log = logging.getLog... |
from . import test_auth_key, uuid4, Customer, TestCase
class TestCustomer(TestCase):
def setUp(self):
super(TestCustomer, self).setUp()
self.assertNotEqual(test_auth_key, None)
self.customer = Customer(authorization_key=test_auth_key)
def test_customer_setup_and_update(self):
... |
import os
import subprocess
import sys
import unittest
JSON_TYPE = None
try:
import simplejson as json
except ImportError:
import json
JSON_TYPE = 'json'
else:
JSON_TYPE = 'simplejson'
import mozharness.base.config as config
class TestParseConfigFile(unittest.TestCase):
def _get_json_config(self... |
# -*- coding: UTF-8 -*-
#######################################################################
# ----------------------------------------------------------------------------
# "THE BEER-WARE LICENSE" (Revision 42):
# @tantrumdev wrote this file. As long as you retain this notice you
# can do whatever you want wit... |
import os
import numpy as np
import os.path as op
from PIL import Image,ImageDraw
from sklearn.cluster import KMeans
def bin_or(_mat, _thr):
# 二值化并取反
for i in range(_mat.shape[0]):
for j in range(_mat.shape[1]):
_mat[i,j] = 0 if _mat[i,j] > _thr else 1
return _mat
def antinoise... |
# -*- coding: utf-8 -*-
from unittest import mock
import pytest
from django.contrib.auth import get_user_model
from django.core.urlresolvers import reverse
from django.test import RequestFactory
from django.utils import translation
from ideascube.views import validate_url
from .factories import UserFactory
from ..v... |
from kolibri.logger.models import AttemptLog, ContentRatingLog, ContentSessionLog, ContentSummaryLog, MasteryLog, UserSessionLog
from rest_framework import serializers
class ContentSessionLogSerializer(serializers.ModelSerializer):
class Meta:
model = ContentSessionLog
fields = ('pk', 'user', 'co... |
# Copyright 2021 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 ... |
from webapp.services import db
from datetime import datetime
import urllib2,re
class Stock(db.Model):
__tablename__ = 'stock_basic'
id = db.Column(db.Integer, primary_key=True)
code = db.Column(db.String(255))
name = db.Column(db.String(255))
flag = db.Column(db.String(5))
industry = db.Colum... |
#! /usr/bin/python
import os, re, sys
try:
SetType = set
except NameError:
import sets
SetType = sets.Set
set = sets.Set
_defaults = None
def read_default(name=None):
global _defaults
from ConfigParser import SafeConfigParser, NoOptionError
if not _defaults:
if os.path.exists('/usr... |
import tensorflow as tf
from tensorflow.examples.tutorials.mnist import input_data
import numpy as np
import matplotlib
matplotlib.use('PS')
import matplotlib.pyplot as plt
import matplotlib.gridspec as gridspec
import os
from time import gmtime, strftime
def xavier_init(size):
in_dim = size[0]
xavier_stddev ... |
import io
import struct
from array import array
from rxet.helper import read_uint32
class BWResource(object):
def __init__(self, name, size, memview):
self.name = name
self._size = size
self._data = memview
self._fileobj = io.BytesIO(self._data)
@property
def fileobj(self... |
# Copyright (C) 2014 Brian Marshall
#
# This program 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.
#
# This program is distributed in... |
# Copyright (C) 2013 by Ben Morris (ben@bendmorris.com)
# based on code by Eric Talevich (eric.talevich@gmail.com)
# This code is part of the Biopython distribution and governed by its
# license. Please see the LICENSE file that should have been included
# as part of this package.
"""Unit tests for the NeXML and NeXML... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import argparse
from datetime import datetime
import hashlib
import json
import logging
import re
from popong_models import Base
from popong_data_utils import guess_person
from sqlalchemy.orm.exc import MultipleResultsFound, NoResultFound
from pokr.data... |
"""Provide the facade device class and metaclass."""
# Imports
import time
import collections
# Graph imports
from facadedevice.graph import triplet, Graph, INVALID
# Exception imports
from facadedevice.exception import to_dev_failed, context
# Utils imports
from facadedevice.utils import EnhancedDevice, aggregate_... |
################################################################################
# Copyright (C) 2015 Surfacingx #
# #
# This Program is free software; you can redistribute it and/or modify ... |
from __future__ import division
import numpy as np
import scipy.sparse as sp
from scipy.sparse.linalg import spsolve
from pySDC.core.Problem import ptype
from pySDC.core.Errors import ParameterError, ProblemError
# noinspection PyUnusedLocal
class generalized_fisher(ptype):
"""
Example implementing the gene... |
# -*- coding: utf-8 -*-
from random import Random
import scrapy
from scrapy.selector import Selector, HtmlXPathSelector
from scrapy_webdriver.http import WebdriverRequest
# yield WebdriverRequest(_url, callback=self.parse_category_full_page)
from cwgooglelinkedin.items import GoogleLinkedIn
import urlparse
class Goo... |
from urlparse import urlparse
from logger import logger
class WorkloadSettings(object):
def __init__(self, options):
self.creates = options.creates
self.reads = options.reads
self.updates = options.updates
self.deletes = options.deletes
self.cases = 0 # Stub for library ... |
import os
import datetime
import glob
import re
import pandas as pd
from typing import Union
from itertools import repeat
from peewee import chunked, OperationalError, EXCLUDED
from .sms_db import SMSFileStats, SMSTable, DB
from .. import SETTINGS
SMS_FILE_LOC = SETTINGS['sms']['source']
class SMSFile:
"""Clas... |
__author__ = 'Christopher Nelson'
import logging
import os
import signal
import time
from infinisqlmgr import common, management
def start_management_server(config):
from infinisqlmgr.management import util
common.configure_logging(config)
cluster_name = config.get("management", "cluster_name")
exis... |
# -*- coding: utf-8 -*-
##
## This file is part of Invenio.
## Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012 CERN.
##
## Invenio 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 2 of t... |
# coding: utf-8
from __future__ import unicode_literals
from io import StringIO
from flaky import defaults
from flaky.names import FlakyNames
from flaky.utils import ensure_unicode_string
class _FlakyPlugin(object):
_retry_failure_message = ' failed ({0} runs remaining out of {1}).'
_failure_message = ' fail... |
# This file is part of Archivematica.
#
# Copyright 2010-2013 Artefactual Systems Inc. <http://artefactual.com>
#
# Archivematica is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the ... |
from monitor import MONITOR_VERBOSE_DMSG_LEVEL
from concurrent_base import ConcurrentBase
WORKERS_TO_START = 25
CCJ_INMATE_DETAILS_URL = 'http://www2.cookcountysheriff.org/search2/details.asp?jailnumber='
class InmatesScraper(ConcurrentBase):
def __init__(self, http, inmates, inmate_details_class, monitor, wor... |
import datetime
from django.conf import settings
from django.utils.translation import ugettext_lazy as _
from oioioi.acm.controllers import ACMContestController
from oioioi.contests.utils import is_contest_admin, is_contest_observer
class AMPPZContestController(ACMContestController):
description = _("AMPPZ")
... |
import string
from rulesdetail import TRANSACTION_CODES
from rulesdetail import record_type, bsb_number, account_number, indicator, transaction_code, amount, title
from rulesdetail import lodgement_reference, trace_record_bsb, trace_record_account_number, remitter_name
from rulesdetail import withholding_tax
def test... |
# Copyright NuoBiT Solutions, S.L. (<https://www.nuobit.com>)
# Eric Antones <eantones@nuobit.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl)
from odoo import models, fields
from odoo.addons.queue_job.job import job
class PayslipLinePayrollBinding(models.Model):
_name = 'sage.payroll.sage.pay... |
#!/usr/bin/python
import unittest
import sys
import random
import time
import traceback
import testcases
from vmpoolstate import VMPoolState
from dijkstra import VMPoolShortestPathFinder
from aspiers import VMPoolAdamPathFinder
STRATEGY = VMPoolAdamPathFinder
clear = True
sleep = 0.2
start_sleep = 1.0
end_sleep = 2... |
'''
Created on 01.06.2014
@author: ionitadaniel19
'''
import unittest
import traceback
import os
from config.utilities import load_browser_driver
from selenium.webdriver import FirefoxProfile
from selenium.webdriver import Firefox
from selenium.webdriver import Chrome
from selenium.webdriver import Ie
fro... |
# -*- coding: utf-8 -*-
"""
Created on Mon Mar 21 13:16:37 2016
@author: Alex Kerr
Define general Forcefield class, and specific forcefields (AMBER, etc.) that inherit
the general one.
"""
import numpy as np
#forcefield class definitions
global_cutoff = 5.0 #angstroms
class Forcefield:
"""A classical forcefiel... |
from django.db import models
from swampdragon.models import SelfPublishModel
from allauth.account.signals import user_signed_up
from .dragon_serializers import MessageSerializer, ProfileSerializer
class Profile(SelfPublishModel, models.Model):
serializer_class = ProfileSerializer
user = models.OneToOneField('... |
from __future__ import unicode_literals
from prompt_toolkit.completion import Completer, Completion
import re
import weakref
__all__ = (
'DocumentCompleter',
)
class DocumentWordsCompleter(Completer):
"""
Completer that completes on words that appear already in the open document.
"""
def get_com... |
import Tkinter
class Joystick(Tkinter.Toplevel):
def __init__(self, parent = None, hasZ = 0):
Tkinter.Toplevel.__init__(self, parent)
self.debug = 0
self.wm_title('Joystick')
self.protocol('WM_DELETE_WINDOW',self.destroy)
self.springBack = 0
self.hasZ = hasZ
self.mBar = Tk... |
import os
import subprocess
import logging as log
from shutil import copy2
from contextlib import contextmanager
@contextmanager
def pushd(newDir):
previousDir = os.getcwd()
os.chdir(newDir)
yield
os.chdir(previousDir)
def static_vars(**kwargs):
def decorate(func):
for k in kwargs:
... |
############################################################
# #
# The implementation of PHPRPC Protocol 3.0 #
# #
# phpformat.py #
# ... |
import networkx as nx
from scipy import stats
from operator import mul # or mul=lambda x,y:x*y
from fractions import Fraction
import sys
# Calculates binomial coefficient (n over k)
def nCk(n,k):
return int( reduce(mul, (Fraction(n-i, i+1) for i in range(k)), 1) )
# Read the network in form of edge list, unweight... |
"""
Static view.
This file is part of the everest project.
See LICENSE.txt for licensing, CONTRIBUTORS.txt for contributor information.
Created on Jun 22, 2010.
"""
from pyramid.static import static_view
from pyramid.threadlocal import get_current_registry
__docformat__ = 'reStructuredText en'
__all__ = ['public_vie... |
##
# Copyright 2009-2016 Ghent University
#
# This file is part of EasyBuild,
# originally created by the HPC team of Ghent University (http://ugent.be/hpc/en),
# with support of Ghent University (http://ugent.be/hpc),
# the Flemish Supercomputer Centre (VSC) (https://vscentrum.be/nl/en),
# Flemish Research Foundation ... |
"""Shared acceptance test functions."""
from random import choice
from time import sleep
import requests
import json
from splinter.driver.webdriver import WebDriverElement
from adhocracy_core.testing import god_login
from adhocracy_core.testing import god_password
from adhocracy_core.testing import participant_passwo... |
from re import match
try:
long
except NameError:
# noinspection PyShadowingBuiltins
long = int
class BaseUnitClass(float):
UNITS = {}
# noinspection PyInitNewSignature
def __new__(cls, x, unit=None):
if isinstance(x, str):
units_regex = "|".join(cls.UNITS.keys())
... |
"""
# The USP05 Data Set
Standard header:
"""
from __future__ import division,print_function
import sys
sys.dont_write_bytecode = True
from lib import *
"""
@attribute ObjType {FT,PJ,RQ}
@attribute IntComplx {5.0,2.0,1.0,4.0,3.0,3.5,2.5,4.5,NULL}
@attribute DataFile {18.0,9.0,7.0,12.0,2.0,5.0,4.0,3.0,1.0,11.0,0.0,75... |
# Copyright 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 ... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import sys
import signal
import time
import getopt
import threading
import logging
import logging.config
from TwitterEngine import instances
from TwitterEngine import TwitterApiCall
from TwitterEngine import DownloadTweetsREST, DownloadTweetsStream
logging.con... |
import sys
from modkit import Modkit
import cmdy
DEFAULT_CONFIG = dict(
default = dict(_raise = True),
bedtools = dict(_prefix = '-'),
biobambam = dict(_sep = '=', _prefix = ''),
bowtie2 = dict(_dupkey = True),
dtoxog = dict(_out = cmdy.DEVERR, _prefix = '-'),
sort = dict(_sep = '', _dupkey = True),... |
# coding: utf-8
'''
Python bindings for libmagic
'''
import ctypes
from collections import namedtuple
from ctypes import *
from ctypes.util import find_library
def _init():
"""
Loads the shared library through ctypes and returns a library
L{ctypes.CDLL} instance
"""
return ctypes.cdll.LoadLibr... |
import os.path
from datetime import date, timedelta #For Timestamps
from tkinter import *
from tkinter.ttk import *
from tkinter import messagebox #Must be explicitly imported. Used for placeholders.
class Hack_Frame(Frame):
def __init__(self, parent, ID, hack_type, empty=0):
Frame.__init__(self, paren... |
# 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 may ... |
import mock
import re
from stronghold import conf
from stronghold.middleware import LoginRequiredMiddleware
try:
from django.urls import reverse
except ImportError:
from django.core.urlresolvers import reverse
from django.http import HttpResponse
from django.test import TestCase
from django.test.client impor... |
########################################################################
# $HeadURL$
# File: Operation.py
# Author: Krzysztof.Ciba@NOSPAMgmail.com
# Date: 2012/07/24 12:12:05
########################################################################
"""
:mod: Operation
.. module: Operation
:synopsis: Operation implem... |
"""Copyright 2008 Orbitz WorldWide
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... |
# -*- coding: utf-8 -*-
"""
Created on Tue Feb 23 11:15:12 2016
@author: suraj
"""
import random
import numpy as np
import pickle
import matplotlib.pyplot as plt
attachRateList = []
for i in range(3360):
attachRateList.append(random.uniform(4,6))
attachRateList = np.array(attachRateList)
encoded_attach_rate... |
# Copyright (C) 2010-2011 Richard Lincoln
#
# 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, merge, publish... |
import unittest2
import inspect
from pytrace.core.debugger import ManagedDebugger, DebuggerEvent
TEST_FUNCTION_SCRIPT = """
def hello(arg1, arg2, *args, **kwargs):
var1 = 20
return var1
hello(1, 2, 3, 4, 5, 6, x=1, y=3)
"""
class ManagedDebuggerTests(unittest2.TestCase):
debugger_events = []
def... |
'''
cgatflow.py - Computational Genomics Analysis Workflows
=======================================================
:Tags: Genomics
To use a specific workflow, type::
cgatflow <workflow> [workflow options] [workflow arguments]
For this message and a list of available keywords type::
cgatflow --help
To get... |
# -*- coding: utf-8 -*-
import os
import sys
import re
import codecs
from alignment import Alignment,Hirschberg
from readers import AnnParser
from writers import AnnWriter
writer = AnnWriter()
def get_phrase(text):
p = re.compile(ur'[a-zA-Z]+|[0-9]+|\s+|[.,;!\(\)]+')
lista = []
pre = 0
for m in p.fin... |
"""
URLs for bootcamp
"""
from django.conf import settings
from django.conf.urls import url
from django.conf.urls.static import static
from django.urls import re_path, include, path
from django.contrib import admin
from django.contrib.auth import views as auth_views
from wagtail.admin import urls as wagtailadmin_urls
... |
from __future__ import with_statement
import time
import pytest
from redis.exceptions import LockError, ResponseError
from redis.lock import Lock, LuaLock
class TestLock(object):
lock_class = Lock
def get_lock(self, redis, *args, **kwargs):
kwargs['lock_class'] = self.lock_class
return redi... |
# Copyright (C) 2011-2017 Aratelia Limited - Juan A. Rubio
#
# This program 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.
#
# This pr... |
__author__ = 'we32zac'
from pyEOM.datasets import Dataset as DatasetAbs
class Dataset(DatasetAbs):
shortname = 'MYD10CM'
platform = 'Aqua'
collection = '005'
rastertype = 'CMG'
timeInterval = 'P1M'
host = 'n5eil01u.ecs.nsidc.org'
dir = '/SAN/MOSA/MYD10CM.005'
sources = ... |
# Ad-hoc fixing of mongo database
from datetime import datetime
import pymongo
client = pymongo.MongoClient('localhost', 27017)
db = client['stackoverflow']
jobs = db['jobs']
# total jobs
total_jobs = jobs.count()
print "Total jobs: %s" % total_jobs
print "=== Fixing Date Stamp ==="
date_stamp = datetime(2016, 6, ... |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
#
# (c) Copyright 2013 Hewlett-Packard Development Company, L.P.
# 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... |
# Copyright 2016 Hewlett Packard Enterprise Development Company LP
#
# Author: Endre Karlson <endre.karlson@hp.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.... |
# -*- coding: utf-8 -*-
"""Tests for cpauto.objects.group module."""
import pytest
import responses
import cpauto
@pytest.mark.parametrize("name,params", [
("grp_basic", {}),
("grp_with_comment", {"comments": "ow now brown cow"}),
("grp_with_tags", {"tags": ["servers", "web", "dns"]}),
])
def test_add(co... |
# -*- coding: utf-8 -*-
#
# coopervap documentation build configuration file, created by
# sphinx-quickstart on Wed Oct 6 18:00:51 2010.
#
# 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... |
# Copyright 2019 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... |
# encoding: utf-8
import sys
sys.path.append('/home/zjd/jmm/JPPCF/')
import os
import numpy as np
import util
from JPPCF import *
import logging
argvs = sys.argv
# We fix the num of latent feature
k = 100
lambd = 0.5
eta = 0.2
if len(argvs) == 4:
k = int(float(argvs[1]))
lambd = flo... |
import random
buildings = []
current_turn = 0
queued_shipments = []
MAX_SHIPMENT = 10
from fractions import Fraction
messages = []
def queue_shipment(source, amount, target, turns):
messages.append("Shipping {0} from {1} to {2}".format(amount, source.name, target.name))
queued_shipments.append((amount, targ... |
# Keno Data Logging - QuickKeno
# KDL v1.5.2 - Python 3 Conversion
# Last Edit Date: 1/9/2021
from urllib.request import urlopen
import json
import time
def write_file(file_name, write_mode, file_text):
text_file = open(file_name, write_mode)
text_file.write(file_text)
text_file.close()
#get the keno j... |
def check_type(name, value, expected_type, expected_iter_type=None):
"""Ensure that an object is of an expected type. Optionally, if the object is
iterable, check that each element is of a particular type.
Parameters
----------
name : str
Description of value being checked
value : objec... |
import argparse
import os
import sys
sys.path.append('..')
import numpy
from anna import util
from anna.datasets import supervised_dataset
from anna.datasets.supervised_data_loader import SupervisedDataLoader
import data_paths
from model import SupervisedModel
parser = argparse.ArgumentParser(prog='train_cnn_with_... |
# Pratice 19. BMI Calculator
# Output:
# Your BMI is 19.5.
# You are within the ideal weight range.
# Or
# Your BMI is 32.5.
# You are overweight. You should see your doctor.
# Formula:
# bmi = (weight / (height x height)) x 703
# Standard:
# BMI 18.5 ~ 25 is nomal weight.
# Constraint:
# - Ensure your ... |
import os.path
from django.conf import settings
from django.db import connection
from django.db import models
from django.db.models import Count
from django.db.models import F
from django.db.models import Q
from django.urls import reverse
from django.utils import timezone
class TimeStampedModel(models.Model):
cr... |
"""
Test module for annalist-manager site data management commands
"""
from __future__ import unicode_literals
from __future__ import absolute_import, division, print_function
__author__ = "Graham Klyne (GK@ACM.ORG)"
__copyright__ = "Copyright 2018, G. Klyne"
__license__ = "MIT (http://opensource.org/licen... |
from ..utils import *
##
# Hero Powers
# Reinforce (Uther Lightbringer)
class CS2_101:
activate = Summon(CONTROLLER, "CS2_101t")
# Reinforce (Uther Skin 1)
class CS2_101_H1:
activate = CS2_101.activate
##
# Minions
# Guardian of Kings
class CS2_088:
play = Heal(FRIENDLY_HERO, 6)
# Argent Protector
class EX1... |
from ..core import Basic, Tuple
from ..core.compatibility import as_int
from ..sets import FiniteSet
from ..utilities import flatten, unflatten
from ..utilities.iterables import minlex
from .perm_groups import PermutationGroup
from .permutations import Permutation
rmul = Permutation.rmul
class Polyhedron(Basic):
... |
import os
import shutil
import glob
import subprocess
import sys
import socket
# run tests without X-server
import matplotlib
matplotlib.use('Agg')
# pretty plots
import seaborn
import time
import datetime
import cPickle as pickle
from brian2 import *
from brian2.tests.features import *
from brian2.tests.features.b... |
# -*- coding: utf-8 -*-
#
# django-heroku-mongoify documentation build configuration file
#
# This file is execfile()d with the current directory set to its containing dir.
import sys, os
# -- General configuration -----------------------------------------------------
# Add any Sphinx extension module names here, as... |
# -*- 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
#... |
import re
import datetime
from collections import defaultdict
import dateutil.parser
import pytz
from django import forms
from django.db.models import Count
from django.conf import settings
from django.contrib.auth.models import User, Group
from django.utils.timezone import utc
from django.utils.safestring import mar... |
# Django settings for tennis project.
import os
SETTINGS_DIR = os.path.abspath(os.path.dirname(__file__))
DEBUG = os.environ.get("DEBUG_VALUE") == 'True'
ADMINS = (
('Admin User', 'admin@highgate-ladder.co.uk'),
)
MANAGERS = ADMINS
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
... |
#!/usr/bin/env python3
import os
import sys
import contextlib
import argparse
from collections import OrderedDict
import MySQLdb
# globals
ERROR_FILE = sys.stderr
OUTPUT_FILE = sys.stdout
DATABASE_HOST = 'db.host'
DATABASE_NAME = 'db.portal_db_name'
DATABASE_USER = 'db.user'
DATABASE_PW = 'db.password'
VERSION_TABLE ... |
import unittest
from machine import Machine, InvalidOrderException, NotEnoughStockException
from drink import Drink
from coins import Coins, NoChangePossibleException
import copy
class MachineTestCase(unittest.TestCase):
"""
Test for MMC, to test use in cmd: python.exe -m unittest test_XXXXX.py
... |
from django.core.urlresolvers import reverse
import pytest
from example.tests.utils import dump_json, redump_json
pytestmark = pytest.mark.django_db
def test_pagination_with_single_entry(single_entry, client):
expected = {
"data": [
{
"type": "posts",
"id": "... |
import sys
import sphinx_rtd_theme
from retriever.lib.defaults import ENCODING
encoding = ENCODING.lower()
from retriever.lib.defaults import VERSION, COPYRIGHT
from retriever.lib.scripts import SCRIPT_LIST, reload_scripts
from retriever.lib.tools import open_fw
from retriever.lib.repository import check_for_updates... |
# -*- coding: utf-8 -*-
# Copyright (C) 2008-2010, 2013-2015 Rocky Bernstein <rocky@gnu.org>
#
# This program 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... |
# -*- coding: utf-8 -*-
from django.conf.urls import include, url
from django.contrib import admin
import app.settings as settings
urlpatterns = [
url(r'^admin/', include(admin.site.urls)),
]
urlpatterns += [
url(r'^static/(?P<path>.*)$', 'django.views.static.serve',{'document_root': settings.URL_STATIC_ROO... |
# -*- coding: utf-8 -*-
def new(num_buckets=256):
"""Initializes a Map with the given number of buckets."""
aMap = []
for i in range(0, num_buckets):
aMap.append([])
return aMap
def hash_key(aMap, key):
"""Given a key this will create a number and then convert it to
an index for the aMap's buckets."""
retu... |
# -*- coding: utf-8 -*-
# Copyright 2013 Mirantis, 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 requir... |
#!/usr/bin/env python
# -*- coding: latin-1 -*-
# ****************************************************************************
# * Software: FPDF for python *
# * Version: 1.7.1 *
# * Date: 2010-09-10 ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.