src stringlengths 721 1.04M |
|---|
# -*- coding: utf-8 -*-
"""Transport functions for `BEL Commons <https://github.com/bel-commons/bel-commons>`_.
BEL Commons is a free, open-source platform for hosting BEL content. Because it was originally
developed and published in an academic capacity at Fraunhofer SCAI, a public instance can be
found at https://b... |
#!/usr/bin/python3
# This script loads PWN in the new OMW schema
# It requires Python3 and NLTK3 installed
import sqlite3, sys, nltk
from nltk.corpus import wordnet as wn
from collections import defaultdict as dd
### ToDo: add antonyms as synset links (?)
### ToDo: examples are being loaded as synset examples, chan... |
import unittest
import pytest
import azure.cosmos.diagnostics as m
_common = {
'x-ms-activity-id',
'x-ms-session-token',
'x-ms-item-count',
'x-ms-request-quota',
'x-ms-resource-usage',
'x-ms-retry-after-ms',
}
_headers = dict(zip(_common, _common))
_headers['other'] = 'other'
class BaseUnitT... |
from ddq.taxonomy.node import Node
from pprint import pprint
# from ddq.namer import Namer
def print_tree(root, children_func=list, name_func=str):
"""Pretty print a tree, in the style of gnu tree"""
# prefix components:
space = ' '
branch = '│ '
# pointers:
tee = '├── '
last = ... |
#
# Copyright 2012 eNovance <licensing@enovance.com>
# Copyright 2012 Red Hat, Inc
# Copyright 2014 Cisco Systems, 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... |
# helper.py
# Copyright (C) 2008, 2009 Michael Trier (mtrier@gmail.com) and contributors
#
# This module is part of GitPython and is released under
# the BSD License: http://www.opensource.org/licenses/bsd-license.php
from __future__ import print_function
import os
import sys
from unittest import TestCase
import time
i... |
try:
from django.conf.urls.defaults import patterns, url
except (ImportError, ):
from django.conf.urls import url
from django.views.generic import TemplateView
from django.contrib.auth.models import User
main_user = User.objects.get_or_create(username='test', email='test@test.com')
int_value = 231
float_val... |
#!/usr/bin/env python3
# Copyright (c) 2010 ArtForz -- public domain half-a-node
# Copyright (c) 2012 Jeff Garzik
# Copyright (c) 2010-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.
"""Bitcoin test... |
"""
This code was generated by Codezu.
Changes to this file may cause incorrect behavior and will be lost if
the code is regenerated.
"""
from mozurestsdk.mozuclient import default as default_client
from mozurestsdk.mozuurl import MozuUrl;
from mozurestsdk.urllocation import UrlLocation
from mozure... |
from django.conf import settings
from django.http import HttpResponse
from django.shortcuts import get_object_or_404, redirect, render_to_response
from django.views.decorators.cache import never_cache
from django.views.decorators.csrf import csrf_exempt
from django_fbi.app import apps
from django_fbi.backends import ge... |
import redis
import datetime
from site_config import REDIS_DB
import site_utils
import uuid
def _was_migration_applied(redis_conn, seq):
value = redis_conn.get('migration_%d' % seq)
if value is not None:
print "migration_%d - exists" % seq
return True
print "migration_%d - executing" % s... |
"""The dsmr component."""
import asyncio
from asyncio import CancelledError
import logging
from homeassistant.config_entries import ConfigEntry
from homeassistant.core import HomeAssistant
from .const import DATA_TASK, DOMAIN, PLATFORMS
_LOGGER = logging.getLogger(__name__)
async def async_setup(hass, config: dict... |
#
# 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 python
# -*- coding: utf-8 -*-
# The MIT License (MIT)
#
# Copyright (c) 2014 Siyuan Ren (netheril96@gmail.com)
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restr... |
from changes.config import db
from changes.models.option import ItemOption
from changes.testutils import APITestCase
class PlanOptionsListTest(APITestCase):
def test_simple(self):
project = self.create_project()
plan = self.create_plan(project)
path = '/api/0/plans/{0}/options/'.format(pl... |
# coding=utf-8
# Copyright 2021 The Tensor2Robot 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 ... |
from ..utilities import args_kwargs_from_args
from collections import OrderedDict as od, namedtuple as nt
import parse
class SpecialAttrsMeta(type):
'''A base metaclass that removes special attribute names from the namespace
prior to passing them for initialization.
Special attributes are designated by the... |
# Functions for applying console ANSI text effect and color codes.
# Copyright (C) 2011-2014 Dario Giovannetti <dev@dariogiovannetti.net>
#
# 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... |
from django.conf.urls.defaults import *
from django.contrib import auth
from django.conf import settings
from django_facebook import views as facebook_views
# Uncomment the next two lines to enable the admin:
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('',
(r'^admin/', include(adm... |
# Manually load w2v
# import os
# from nlpia.data.loaders import BIGDATA_PATH
# from gensim.models import KeyedVectors
# path = os.path.join(BIGDATA_PATH, 'GoogleNews-vectors-negative300.bin.gz')
# wv = KeyedVectors.load_word2vec_format(path, binary=True)
# nlpia can now automatically download and load w2v
from nlpia... |
from datetime import datetime, timedelta
from django.test import TestCase
from corehq.apps.repeaters.dbaccessors import (
get_pending_repeat_record_count,
get_success_repeat_record_count,
get_failure_repeat_record_count,
get_repeat_record_count,
get_repeaters_by_domain,
get_paged_repeat_records... |
# Copyright (c) 2015, FJTC
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice, this
# list of conditions and the follow... |
# Copyright 2017 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... |
#! /usr/bin/env python2
#
# This file is part of khmer, https://github.com/dib-lab/khmer/, and is
# Copyright (C) Michigan State University, 2009-2015. It is licensed under
# the three-clause BSD license; see LICENSE.
# Contact: khmer-project@idyll.org
#
"""
@@
"""
import sys
import screed
import khmer
from khmer.khme... |
from classtime.logging import logging
logging = logging.getLogger(__name__) #pylint: disable=C0103
from classtime.core import db
from classtime.models import Term, Schedule, Course, Section
class StandardLocalDatabase(object):
"""A single institution's view of the local database
Uses a stack-based accessor ... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# gaia - Waqas Bhatti (wbhatti@astro.princeton.edu) - Dec 2017
# License: MIT. See the LICENSE file for more details.
'''
This queries the GAIA catalog for object lists in specified areas of the
sky. The main use of this module is to generate realistic spatial distributio... |
<<<<<<< HEAD
import decimal
import json
import unittest
import uuid
from django import forms
from django.core import exceptions, serializers, validators
from django.core.management import call_command
from django.db import IntegrityError, connection, models
from django.test import TransactionTestCase, overrid... |
#!/usr/bin/env python
import rospy
from hlpr_manipulation_utils.manipulator import Gripper
from kinova_msgs.srv import Start, Stop
from hlpr_kinesthetic_interaction.kinesthetic_interaction import KinestheticInteraction
"""
jaco_7dof_arm.py
Simple wrapper that abstracts out the arm class so that other arms
can use ki... |
import datetime
import os
import shutil
import unittest.mock as mock
from io import BytesIO
import pytz
from PIL import Image
from django.conf import settings
from django.core.files.uploadedfile import InMemoryUploadedFile
from django.core.files.uploadedfile import SimpleUploadedFile
from django.test import TestCase
... |
#!/usr/bin/env python
import logging
def debug_entry(f):
"""
debug the entry into a function
>>> import sys
>>> import logging
The stream configuration is just to make doctests work.
In practice, you'd probably want the default stream sys.stderr.
>>> logging.basicConfig(lev... |
# Copyright 2014 Google Inc. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... |
# Copyright 2012 by Wibowo Arindrarto. All rights reserved.
# 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.
"""Tests for SearchIO HmmerIO hmmer3-tab parser."""
import os
import unittest
from Bio ... |
# Standard imports
import unittest
import datetime as pydt
import logging
import json
import uuid
import attrdict as ad
import time
import geojson as gj
import arrow
# Our imports
import emission.tests.common
import emission.core.get_database as edb
import emission.net.usercache.abstract_usercache as enua
import emis... |
# coding: utf-8
"""
KubeVirt API
This is KubeVirt API an add-on for Kubernetes.
OpenAPI spec version: 1.0.0
Contact: kubevirt-dev@googlegroups.com
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from pprint import pformat
from six import iteritems
import re
class V1beta1D... |
# -*- coding: utf-8 -*-
# Copyright(C) 2014 Bezleputh
#
# This file is part of weboob.
#
# weboob 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 License, or
# (at your opt... |
#!/usr/bin/env python2
# vim:fileencoding=utf-8
from __future__ import (unicode_literals, division, absolute_import,
print_function)
__license__ = 'GPL v3'
__copyright__ = '2013, Kovid Goyal <kovid at kovidgoyal.net>'
import sys
from PyQt5.Qt import (
QIcon, Qt, QSplitter, QListWidget, Q... |
# -*- coding: utf-8 -*-
# Copyright 2017 GIG Technology NV
#
# 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... |
#!/bin/env python
#
# Adventofcode.com
#
# Author : Guillaume Dorion
# Email : gdorion@gmail.com
#
class Reindeer(object):
def __init__(self, name, speed, flightTime, restTime):
self.name = name
self.speed = speed
self.flightTime = flightTime
self.restTime = restTime
#... |
from urllib.parse import urlparse
import urllib.request
import re
import requests as req
from PIL import Image
from io import BytesIO
import pandas as pd
kegg_out = pd.read_table('/home/zluna/Work/kegg/2.xls')
headers = {'User-Agent' : 'Mozilla/5.0 (Linux;Android 6.0;Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTM... |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'regenerateaddresses.ui'
#
# Created: Thu Jan 24 15:52:24 2013
# by: PyQt4 UI code generator 4.9.4
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore, QtGui
try:
_fromUtf8 = QtCore.QString.fromUtf8
ex... |
# -*- coding:utf8 -*-
# File : push_pipe.py
# Author : Jiayuan Mao
# Email : maojiayuan@gmail.com
# Date : 4/2/17
#
# This file is part of TensorArtist.
from . import configs, utils
from ...core.utils.meta import notnone_property
import zmq
import threading
import queue
import contextlib
import collections
imp... |
#!/usr/bin/python3
#
# Requires Python3
# *Please* make sure to use the version of Python included with
# your copy of LibreOffice.
#
# Convert spreadsheet to CSV file.
#
# Based on:
# PyODConverter (Python OpenDocument Converter) v1.0.0 - 2008-05-05
# Copyright (C) 2008 Mirko Nasato <mirko@artofsolving.com>
# Li... |
# mypy: ignore-errors
#
# This source file is part of the EdgeDB open source project.
#
# Copyright 2019-present MagicStack Inc. and the EdgeDB 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 ... |
# -*- coding: utf-8 -*-
# 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... |
from __future__ import absolute_import
import datetime
import email as eml
from email.parser import Parser
from email.utils import parseaddr, getaddresses, mktime_tz, parsedate_tz
import hashlib
import json
import magic
import re
import yaml
import io
import sys
import olefile
from dateutil.parser import parse as dat... |
#!/usr/bin/python3
from ebaysdk.finding import Connection as Finding
from ebaysdk.exception import ConnectionError
import itertools
import functools
import openpyxl
import sys
import re
import yaml
import argparse
import logging
import json
import datetime
import collections
from flask import Flask, redirect, request,... |
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
from __future__ import unicode_literals
from six import iteritems, string_types
"""build query for doclistview and return results"""
import frappe, json, copy, re
import frappe.defaults
import frappe.share
import fra... |
#!/usr/bin/python
import sys, traceback
import cv2
import numpy as np
import argparse
import string
import plantcv as pcv
### Parse command-line arguments
def options():
parser = argparse.ArgumentParser(description="Imaging processing with opencv")
parser.add_argument("-i", "--image", help="Input image file.", req... |
import re
from fnmatch import fnmatch
class Pattern(object):
def __init__(self, pattern_string):
self.pattern_string = pattern_string
class ExactPattern(Pattern):
def compare(self, string):
return self.pattern_string == string
class RegexPattern(Pattern):
def compare(self, string):
... |
class RelationshipTypes(object):
@classmethod
def types(cls):
types = {}
for k, rt in RELATIONSHIP_TYPES.items():
types[k] = rt.copy()
types[k].update({ 'relationship_type': k })
return types
@classmethod
def get_type(cls, relationship_type_id):
return cls.types().get(relationship_... |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Nova Billing
# Copyright (C) GridDynamics Openstack Core Team, GridDynamics
#
# 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... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# -*- Python -*-
"""
\file cin.py
\brief an example RTC for rtc_handle
\date $Date$
"""
import sys
import time
sys.path.append(".")
# Import RTM module
import RTC
import OpenRTM_aist
# Import Service implementation class
# <rtc-template block="service_impl">
# </rt... |
# -----------------------------------------------------------------------------
from dpa.action import Action, ActionError, ActionAborted
from dpa.notify import Notification
from dpa.shell.output import Output, Style, Fg
from dpa.product import Product, ProductError
from dpa.product.version import ProductVersion, Prod... |
# -*- coding: utf-8 -*-
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'Project'
db.create_table(u'mytodo_project', (
... |
import copy
import logging
import math
from typing import (
IO,
Any,
Callable,
Dict,
List,
MutableMapping,
MutableSequence,
Optional,
Set,
Tuple,
Union,
cast,
)
from rdflib import Graph, URIRef
from rdflib.namespace import OWL, RDFS
from ruamel.yaml.comments import Comme... |
from os.path import join as pjoin
# Format expected by setup.py and doc/source/conf.py: string of form "X.Y.Z"
_version_major = 0
_version_minor = 1
_version_micro = '' # use '' for first of series, number for 1 and above
_version_extra = 'dev'
# _version_extra = '' # Uncomment this for full releases
# Construct fu... |
from mock import MagicMock, patch
from nose.plugins.attrib import attr
from ion.agents.data.handlers.handler_utils import _get_type, list_file_info, \
list_file_info_http, list_file_info_ftp, list_file_info_fs, \
get_time_from_filename, calculate_iteration_count, get_sbuffer
from pyon.util.unit_test import Pyon... |
from functools import partial, wraps
import datetime
import queries
from utils import crossdomain
from flask import Flask, jsonify, request
from werkzeug.contrib.cache import MemcachedCache
cache = MemcachedCache(['127.0.0.1:11211'])
CACHE_TIMEOUT = 5 * 60
app = Flask(__name__)
# app.debug = True
CHART_INTERVALS = 6... |
# import numpy as np
import cv2
# import linecache
import LoadImagePrintText as f
# >>> import os
# >>> os.chdir("C:\Users\dario\Desktop\Dropbox\Work\DemoHDA\git\Source\\")
## Input
cam = 60
frame = 26
debugREID = 1
img = f.loadImagePrintText(cam, frame, debugREID=0, debugPD=1, PDthreshold=20)
cv2.namedWindow("1", c... |
import os
import commands
import time
import logging
import sys
if len(sys.argv) != 5 or (sys.argv[1:][0] not in ['pt', 'en']):
print "ERROR! use :\n python scripts/data_download/rais/download_manager_rais.py en/pt output_path year time(seconds)\n"
exit()
files = ["i", "lo", "lio"]
type_location = ["regions",... |
###############################################################################
#
# Copyright (C) 2001-2014 Micronaet SRL (<http://www.micronaet.it>).
#
# This program 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 ... |
# -*- coding: utf-8 -*-
from openerp import models, fields, api, _
from openerp.exceptions import Warning
class evaluation_detail(models.Model):
""""""
_inherit = 'kinesis_athletics.evaluation_detail'
@api.multi
def get_test_description(self):
return {
'type': 'ir.actions.act_wi... |
import itertools
from operator import attrgetter
import numpy as np
import pandas as pd
import toolz
from zipline.pipeline import Pipeline
from zipline.pipeline.classifiers import Everything
from zipline.pipeline.domain import US_EQUITIES
from zipline.pipeline.factors import CustomFactor
from zipline.pipeline.data im... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
import pandas as pd
from xarray import Dataset, DataArray, Variable
from xarray.core import indexing
from . import TestCase, ReturnItem
class TestIndexers(TestCase):
def set_to_zero(sel... |
from discussion.models import Topic
from discussion.serializers import TopicSerializer
from .models import Activity, Answer
from rest_framework import serializers
class ActivitySerializer(serializers.ModelSerializer):
data = serializers.JSONField()
expected = serializers.JSONField(required=False)
image_u... |
#
# Copyright (C) 2011 Michael Pitidis, Hussein Abdulwahid.
#
# This file is part of Labelme.
#
# Labelme 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) ... |
# -*- coding: utf-8 -*-
"""
Copyright (C) 2012 Dariusz Suchojad <dsuch at zato.io>
Licensed under LGPLv3, see LICENSE.txt for terms and conditions.
"""
from __future__ import absolute_import, division, print_function, unicode_literals
# stdlib
from datetime import datetime
from random import choice, randint
from un... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import django.db.models.deletion
from django.conf import settings
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
operati... |
import os
from django.core.exceptions import ObjectDoesNotExist
from hyperadmin.links import Link
from hyperadmin.resources.crud import CRUDResource
from hyperadmin.resources.storages.forms import UploadForm, Base64UploadForm, UploadLinkForm
from hyperadmin.resources.storages.indexes import StorageIndex
from hyperadm... |
# -*- coding: utf-8 -*-
import json
from odoo import api, models, _
from odoo.tools import float_round
class ReportBomStructure(models.AbstractModel):
_name = 'report.mrp.report_bom_structure'
_description = 'BOM Structure Report'
@api.model
def _get_report_values(self, docids, data=None):
d... |
# -*- coding: utf-8 -*-
# Copyright(C) 2017 Vincent A
#
# This file is part of a weboob module.
#
# This weboob module 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 Licen... |
import sys
def filter_fs(problem_f_handler, needed_features_list, orig_num_fname,
needed_labels_list, orig_num_labelname, filtered_name):
a = open('{0}.problem'.format(filtered_name), 'w')
orig_new_nums = {}
new_num_fname = {}
orig_new_labelnums = {}
new_num_labelname ... |
# -*- coding: utf-8 -*-
# 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... |
from django.conf import settings
from django.utils.encoding import smart_str
from mediagenerator.generators.bundles.base import Filter
class YUICompressor(Filter):
def __init__(self, **kwargs):
super(YUICompressor, self).__init__(**kwargs)
assert self.filetype in ('css', 'js'), (
'YUICo... |
# -*- cpy-indent-level: 4; indent-tabs-mode: nil -*-
# ex: set expandtab softtabstop=4 shiftwidth=4:
#
# Copyright (C) 2009,2010,2011,2012,2013,2014,2016 Contributor
#
# 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... |
"""
Ripped from https://www.smsoft.ru/en/pifdoc.htm
"""
import ptypes
from ptypes import *
class Heading(pstruct.type):
def __Next_section_offset(self):
return dyn.pointer(Section, pint.uint16_t)
def __Section_data_offset(self):
def _object_(_, self=self):
length = self['Length'].... |
"""
Bin API. Provides consistent access to IFCB raw data stored
in various formats.
"""
from functools import lru_cache
from .adc import SCHEMA
from .hdr import TEMPERATURE, HUMIDITY
from .utils import BaseDictlike
from ..metrics.ml_analyzed import compute_ml_analyzed
class BaseBin(BaseDictlike):
"""
Base c... |
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
""" Test scripts
If we appear to be running from the development directory, use the scripts in
the top-level folder ``scripts``. Otherwise try and get the scripts from the
path
"""
from __future__ import ... |
# -*- mode: python; coding: utf-8 -*-
# Copyright © 2016 by Jeffrey C. Ollie
#
# This file is part of ceph_exporter.
#
# ceph_exporter 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
#... |
# -*- coding: utf-8 -*-
#
# papyon - a python client library for Msn
#
# Copyright (C) 2005-2007 Ali Sabil <ali.sabil@gmail.com>
# Copyright (C) 2005-2006 Ole André Vadla Ravnås <oleavr@gmail.com>
# Copyright (C) 2007 Johann Prieur <johann.prieur@gmail.com>
#
# This program is free software; you can redistribute it and... |
# -*- coding: utf-8 -*-
"""Model unit tests."""
import datetime as dt
import pytest
from grasshopper.user.models import Role, User
from .factories import UserFactory
@pytest.mark.usefixtures('db')
class TestUser:
"""User tests."""
def test_get_by_id(self):
"""Get user by ID."""
user = User... |
from __future__ import print_function
import random
import numpy as np
import pandas as pd
import scipy.stats
import sklearn.cluster
import sklearn.covariance
import sklearn.manifold
from future.utils import iteritems, listvalues
from pandas.core.base import PandasObject
from scipy.optimize import minimize
from scipy... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import unittest
import cssbeautifier
class CSSBeautifierTest(unittest.TestCase):
def resetOptions(self):
false = False
true = True
self.options = cssbeautifier.default_options()
self.options.indent_size = 1
self.options.indent... |
#!/usr/bin/env python
'''
This module contains some common routines used by cv2 samples and an abstract multiprocessing class
'''
import numpy as np
import cv2
# built-in modules
import os
import itertools as it
from contextlib import contextmanager
import multiprocessing
import Queue #needed separately for the Em... |
from contextlib import contextmanager
from typing import (cast, Any, Callable, Dict, Iterable, Iterator, List, Mapping, Optional,
Sized, Tuple, Union, Text)
from django.core.urlresolvers import resolve
from django.conf import settings
from django.test import TestCase
from django.test.client import ... |
import time
import xbmc
import urlparse
import SimpleHTTPServer
import SocketServer
import urllib2
import urllib
import re
import json
import base64
import requests
import httplib
songInfoApi = 'http://api.mp3.zing.vn/api/mobile/song/getsonginfo?keycode=fafd463e2131914934b73310aa34a23f&requestdata={"id"... |
##
# Copyright (c) 2005-2015 Apple Inc. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable l... |
#!/usr/bin/env python
#
# Copyright 2007 Doug Hellmann.
#
#
# All Rights Reserved
#
# Permission to use, copy, modify, and distribute this software and
# its documentation for any purpose and without fee is hereby
# granted, provided that the above copyright notice appear in all
# copies and tha... |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2012 NEC Corporation
#
# 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
#... |
# Copyright 2013 Donald Stufft
#
# 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, so... |
import numpy as np
import logging
def manifold_mean(expmap, vecs, weights, max_iter=200):
""" Calculate arithmetic (geodesic) means of points.
Args:
expmap : dictionary with entries 'inv' and 'map' denoting functions
inv(location, pfrom, vto) and map(location, vfrom) that project
... |
from time import strftime
import csv
from django.views.generic.base import TemplateView, View
from django.views.generic.list import ListView
from django.core.exceptions import PermissionDenied
from django.http import HttpResponse
from braces.views import (
LoginRequiredMixin,
PermissionRequiredMixin,
Su... |
import os
import getpass
import sys
import time
import numpy as np
import tensorflow as tf
from q2_initialization import xavier_weight_init
import data_utils.utils as du
import data_utils.ner as ner
from utils import data_iterator
from model import LanguageModel
def variable_summaries(variable, name):
with tf.name_... |
# -*- coding:utf-8 -*-
import calendar
from mock import patch
from datetime import datetime
from alc.formatter import CalendarFormatter
class TestDatetime:
'''
Unit test for *CalendarFormatter.datetime()*.
'''
def test_default(self):
'''
:type: normal
:case: *datetime_format... |
"""
ISPAQ Business Logic for Simple Metrics.
:copyright:
Mazama Science
:license:
GNU Lesser General Public License, Version 3
(http://www.gnu.org/copyleft/lesser.html)
"""
from __future__ import (absolute_import, division, print_function)
import math
import numpy as np
import pandas as pd
from obspy im... |
# -*- coding:utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import fields, models, _
from odoo.exceptions import AccessError
class FleetVehicle(models.Model):
_inherit = 'fleet.vehicle'
analytic_account_id = fields.Many2one('account.analytic.account', string='... |
# particlesim
# Copyright (C) 2017 Mark Niehues, Stefaan Hessmann, Jaap Pedersen,
# Simon Treu, Hanna Wulkow, Thomas Hadler
#
# 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 ... |
import os
import socket
import sys
import ert.job_queue.driver as driver
#################################################################
# Only a quite few of the Linux computers in Statoil are proper LSF
# nodes, in the sense that they can talk directly to the LSF
# demons. When using LSF from a computer which is n... |
# -*- coding: utf-8 -*-
from unittest import mock
import jinja2
import pytest
from wt import jinja
def describe_Registry():
def must_properly_register_filter(jinja_registry):
assert len(list(jinja_registry)) == 0
def fltr(d):
return d
res = jinja_registry.add(fltr)
... |
# encoding: utf-8
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding field 'Project.project_type'
db.add_column('project_project', 'project_type', self.gf('django.db.... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.