content stringlengths 4 20k |
|---|
import os
import json
import getshorty
import unittest
import tempfile
URL = 'http://google.com'
URL_MOBILE = 'http://facebook.com'
URL_TABLET = 'https://yahoo.com'
BAD_URL = 'http//google.com'
UA = 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.133 Safari/537.36'
UA_MOBILE = ... |
flow_var = {}
flow_dec = {}
state_dec = {}
state_val = {}
cont_cond = {}
jump_cond = {}
def getHdr(n):
res = []
for i in range(n):
getHdr.counter += 1
res.append(getHdr.counter)
return res
getHdr.counter = 0
######################
# Formula generation #
######################
def prin... |
from collections import defaultdict
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
CUDA_MAJOR = int(torch.version.cuda.split('.')[0])
CUDA_MINOR = int(torch.version.cuda.split('.')[1])
class ProjectedAdaptiveLogSoftmax(nn.Module):
def __init__(self, n_token, d_embed, d_pro... |
"""
Verifies that stripping works.
"""
import TestGyp
import re
import subprocess
import sys
import time
if sys.platform == 'darwin':
test = TestGyp.TestGyp(formats=['ninja', 'make', 'xcode'])
test.run_gyp('test.gyp', chdir='strip')
test.build('test.gyp', test.ALL, chdir='strip')
# Lightweight check if st... |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
class Char2idx(object):
"""Convert from character to index.
Args:
map_file_path (string): path to the mapping file
do... |
import taggit
from django import forms
from django.contrib.auth.forms import UserCreationForm, UserChangeForm
from django.utils.translation import ugettext_lazy as _
from geonode.people.models import Profile
from geonode.base.models import ContactRole
# Ported in from django-registration
attrs_dict = {'class': 'requ... |
import logging
import re
import unicodedata
from openerp.osv import fields, osv
from openerp.tools import ustr
from openerp.modules.registry import RegistryManager
from openerp import SUPERUSER_ID
from openerp.tools.translate import _
_logger = logging.getLogger(__name__)
# Inspired by http://stackoverflow.com/quest... |
"""Contains various routines and helper functions for training models.
This script contains various functions for training models. These include
manipulating gradients, creating a `train_op` (an operation that computes the
loss and applies the gradients) and a training loop function. The training loop
allows the user ... |
"""Test largefile support on system where this makes sense.
"""
from __future__ import print_function
import os
import stat
import sys
import unittest
from test.test_support import run_unittest, TESTFN, verbose, requires, \
unlink
import io # C implementation of io
import _pyio as pyio ... |
"""Cuda op Python library."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os.path
import tensorflow as tf
if tf.test.is_built_with_cuda():
_cuda_op_module = tf.load_op_library(os.path.join(
tf.resource_loader.get_data_files_path(), 'cuda... |
"""
Script for importing courseware from XML format
"""
from django.core.management.base import BaseCommand, CommandError, make_option
from django_comment_common.utils import (seed_permissions_roles,
are_permissions_roles_seeded)
from xmodule.modulestore.xml_importer import imp... |
from __future__ import unicode_literals
import re
import frappe
from frappe.website.utils import get_shade
from frappe.website.doctype.website_theme.website_theme import get_active_theme
no_sitemap = 1
base_template_path = "templates/pages/website_theme.css"
default_properties = {
"background_color": "#ffffff",
"to... |
from __future__ import division
from math import pi, sin, cos, atan2, sqrt, radians, log, tan, degrees
from datetime import datetime
import pytz
import ephem
UTC = pytz.UTC
def latlong_to_locator (latitude, longitude):
"""converts WGS84 coordinates into the corresponding Maidenhead Locator
Args:
... |
#!/usr/bin/python
""" PN CLI vrouter-loopback-interface-add/remove """
#
# This file is part of Ansible
#
# Ansible 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 yo... |
"""Operations for bucketing data into groups.
The classes and functions in this module are used to queue up data into
buckets conditional on side information (e.g. sequence length).
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import functools
impor... |
"""
Example run
```
python3 preprocessing.py
```
"""
from PIL import Image
from scipy import ndimage
from skimage.filters import rank
from skimage.morphology import square
from skimage.morphology import disk
from skimage.morphology import white_tophat
import numpy
import cv2
import matplotlib.pypl... |
#!/usr/bin/env python
import pyfits
from LCScommon import *
from pylab import *
import os
import mystuff as my
class baseCluster:
def __init__(self,clustername):
#Get current path so program can tell if this is being run on Becky or Rose's computer
self.prefix=clustername
self.cra=clusterRA[self.prefix]
... |
# -*- coding: utf-8 -*-
import hashlib
import hmac
import time
import urlparse
import unittest
from lxml import objectify
import odoo
from odoo.addons.payment.models.payment_acquirer import ValidationError
from odoo.addons.payment.tests.common import PaymentAcquirerCommon
from odoo.addons.payment_authorize.controller... |
#!/usr/bin/env python
__author__ = 'Mitch Anderson'
__date__ = '08-14-2011'
__version__ = '1.0'
"""
Releasing Under the New BSD License same as where I got some of the code from.
Most of the S3 directory sync code came from the django-command-extensions project
on Google Code: http://code.google.com/p/django-command... |
"""Implement standard (and unused) TCP protocols.
These protocols are either provided by inetd, or are not provided at all.
"""
# system imports
import time, struct
from zope.interface import implements
# twisted import
from twisted.internet import protocol, interfaces
class Echo(protocol.Protocol):
"""As soon... |
"""TestCases for checking that it does not segfault when a DBEnv object
is closed before its DB objects.
"""
import os
import unittest
from test_all import db, test_support, verbose, get_new_environment_path, get_new_database_path
# We're going to get warnings in this module about trying to close the db when
# its e... |
'''
Copyright (C) 2013 Travis DeWolf
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 the hope t... |
"""Test GroupDataset module."""
from .context import GroupDataset
from .context import IndexGenerator
# from nose.tools import raises
from tensorflow.examples.tutorials.mnist import input_data
mnist_raw = input_data.read_data_sets('../data/MNIST_data', one_hot=True)
MNIST_size = 28
images_per_sample = 5
amount_of_cla... |
from st2actions.runners.pythonrunner import Action
import requests
class BaseAction(Action):
def __init__(self, config):
super(BaseAction, self).__init__(config)
self.url = None
self.headers = None
def _headers(self):
if not self.headers:
api_token = self.config.ge... |
"""Utilities to assist with commerce tasks."""
import json
import logging
from urllib import urlencode
from urlparse import urljoin
import requests
import waffle
from django.conf import settings
from django.contrib.auth import get_user_model
from django.urls import reverse
from django.utils.translation import ugettext... |
from __future__ import absolute_import
from traits.api import HasTraits, Range, Instance, Property
from traitsui.api import View, Item, Group
# ============= standard library imports ========================
from numpy import linspace
# ============= local library imports ==========================
from pychron.gra... |
"""
refcounting
~~~~~~~~~~~
Reference count annotations for C API functions. Has the same
result as the sphinx.ext.refcounting extension but works for all
functions regardless of the signature, and the reference counting
information is written inline with the documentation instead of a
sepa... |
import datetime
from django.db import models
from django.core.urlresolvers import reverse
from ..core.models import CoreRun
from django.utils.timezone import make_aware
from ..taxbrain.models import TaxBrainRun
from ..taxbrain.behaviors import DataSourceable
class DynamicElasticitySaveInputs(DataSourceable, models.... |
# Since this package contains a "django" module, this is required on Python 2.
from __future__ import absolute_import
import sys
import jinja2
from django.conf import settings
from django.template import TemplateDoesNotExist, TemplateSyntaxError
from django.utils import six
from django.utils.module_loading import im... |
"""SWM, A Simple Wildfire-inspired MDP model. Version 2.1"""
"""
SWMv2.1
New Features:
-An additional weather variable ("moisture") which works against the spread of large fires and which has
a separate threshold.
-The policy function now includes the current state variables "timber" and "vulnerability" as parame... |
import json
import os
import re
from django import forms
from django.utils.translation import ugettext_lazy as _
from django.contrib.contenttypes.models import ContentType
from django.conf import settings
from django.forms import HiddenInput, TextInput
from modeltranslation.forms import TranslationModelForm
from geon... |
"""
sprockets.handlers.status
A small handler for reporting application status
"""
import pkg_resources
from tornado import web
__version__ = '0.1.2'
UNKNOWN = 'unknown'
MAINTENANCE = 'maintenance'
OK = 'ok'
APPLICATION = UNKNOWN
def set_application(name):
"""Set the application name that is reported in th... |
from __future__ import absolute_import, division, print_function, with_statement
import logging
import sqlite3
import os
import sys
from gevent.server import StreamServer
from dumputils import common
from .common import send_data_safe, recv_data_safe, daemon_start
from .message import Message
from .encrypt import Encry... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
from ansible.compat.tests import unittest
from ansible.parsing.yaml.objects import AnsibleBaseYAMLObject
from ansible.errors import AnsibleError
from ansible.compat.tests import BUILTINS
from ansible.compat.tests.mock import mock... |
import matplotlib
from matplotlib.patches import Circle, Wedge, Polygon
from matplotlib.collections import PatchCollection
import pylab
fig=pylab.figure()
ax=fig.add_subplot(111)
resolution = 50 # the number of vertices
N = 3
x = pylab.rand(N)
y = pylab.rand(N)
radii = 0.1*pylab.rand(N)
patches = []
for... |
import re
from pybindgen.typehandlers import base as typehandlers
from pybindgen import ReturnValue, Parameter
from pybindgen.cppmethod import CustomCppMethodWrapper, CustomCppConstructorWrapper
from pybindgen.typehandlers.codesink import MemoryCodeSink
from pybindgen.typehandlers import ctypeparser
from pybindgen imp... |
"""Add event log.
Revision ID: d17d4d4fd1ee
Revises: 95779b509fe4
Create Date: 2016-07-22 12:21:14.296489
"""
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql
# revision identifiers, used by Alembic.
revision = 'd17d4d4fd1ee'
down_revision = '95779b509fe4'
def upgrade():
... |
ANSIBLE_METADATA = {'metadata_version': '1.0',
'status': ['preview'],
'supported_by': 'curated'}
DOCUMENTATION = r'''
---
module: win_chocolatey
version_added: "1.9"
short_description: Installs packages using chocolatey
description:
- Installs packages using Chocolatey (U(h... |
# This contains most of the executable examples from Guido's descr
# tutorial, once at
#
# http://www.python.org/2.2/descrintro.html
#
# A few examples left implicit in the writeup were fleshed out, a few were
# skipped due to lack of interest (e.g., faking super() by hand isn't
# of much interest anymore), and a f... |
import hr_holidays_summary_department
import hr_holidays_summary_employees
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
from openerp.osv import osv
#TODO:REMOVE this wizard is not used
class account_payment_make_payment(osv.osv_memory):
_name = "account.payment.make.payment"
_description = "Account make payment"
def launch_wizard(self, cr, uid, ids, context=None):
"""
Search for a wizard to launch accordin... |
from date import one_month_ago, now, two_months_ago, get_datetime_string, get_datetime, get_date_string, get_short_date_string, \
datetime_to_int, \
yesterday, jsonify
from flask_cache import Cache
from flask import session
from app.app_and_db import app
from... |
from numpy import *
import scipy.stats
from SloppyCell.ReactionNetworks import *
import example_net, example_model
#
# Calculate an ensemble
#
# Step scale = 3 gives faster convergence for this problem.
print("Generating ensemble")
ens_data, costs, ratio = Ensembles.ensemble_log_params(example_model.m,
... |
import json
import logging
import os
import sys
import tempfile
import unittest
import isolate
ROOT_DIR = os.path.dirname(os.path.abspath(__file__))
class Isolate(unittest.TestCase):
def setUp(self):
# Everything should work even from another directory.
os.chdir(os.path.dirname(ROOT_DIR))
def _run_proc... |
import unittest
from django.test import TestCase
from django.utils import six
@unittest.skipIf(six.PY2,
'Python 2 cannot import the project template because '
'django/conf/project_template doesn\'t have an __init__.py file.')
class TestStartProjectSettings(TestCase):
def test_middleware_classes_headers(... |
"""
Example of using cwFitter to generate a HH model for EGL-36 ion channel
Based on experimental data from doi:10.1016/S0896-6273(00)80355-4
"""
import os.path
import sys
import time
import numpy as np
import matplotlib.pyplot as plt
sys.path.append('../../..')
from channelworm.fitter import *
if __name__ == '__mai... |
"""Disassembler of Python byte code into mnemonics."""
import sys
import types
from opcode import *
from opcode import __all__ as _opcodes_all
__all__ = ["dis","disassemble","distb","disco"] + _opcodes_all
del _opcodes_all
def dis(x=None):
"""Disassemble classes, methods, functions, or code.
With no argume... |
from datetime import datetime
from django.forms import DateTimeInput
from django.test import override_settings
from django.utils import translation
from .base import WidgetTest
class DateTimeInputTest(WidgetTest):
widget = DateTimeInput()
def test_render_none(self):
self.check_html(self.widget, 'da... |
dset = [(1,'L','Cerebellum-vermis',None,True,None),
(1,'R','Cerebellum-VI',None,True,True),
(1,'L','Cingulate-posterior',None,None,True),
(1,'R','Cingulate-posterior',None,None,True),
(1,'R','IFG-pars opercularis',None,None,True),
(1,'R','IFG-pars triangularis',None,None,True),
... |
"""
sentry.utils.safe
~~~~~~~~~~~~~~~~~
:copyright: (c) 2010-2013 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
import logging
from django.db import transaction
from sentry.constants import MAX_VARIABLE_SIZE, MAX_DICTIONARY_ITEMS
from sentry.utils.strings import ... |
#!/usr/bin/env python
import cv
import cv2
def face_detect(imcolor):
# imcolor = cv.LoadImage('anush2.jpg') # input image
haarFace = cv.Load('haarcascade_frontalface_default.xml')
haarEyes = cv.Load('haarcascade_eye.xml')
# running the classifiers
storage = cv.CreateMemStorage()
detectedFace =... |
__author__ = 'derekbrameyer'
import random
import json
import datetime
def main():
maxstealcount = 2
currentturn=1
boolines = json.loads(open("boo_lines.json").read())
reportlines = json.loads(open("report_lines.json").read())
print greenify("\nWelcome to White Elephant! Please input names line b... |
from tests.factories import UserFactory
from nose.tools import *
from tests.base import OsfTestCase
from scripts.migration.migrate_personal_to_profile_websites import main, get_users_with_social_field
class TestMigrateProfileWebsites(OsfTestCase):
def setUp(self):
super(TestMigrateProfileWebsites, self).... |
from __future__ import unicode_literals
import frappe
from frappe.utils import flt, getdate, nowdate
from frappe import msgprint, _
from frappe.model.document import Document
class BankReconciliation(Document):
def get_details(self):
if not (self.bank_account and self.from_date and self.to_date):
msgprint("Bank ... |
from makohtml2html import parseNode
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
classifiers = """\
Development Status :: 4 - Beta
Intended Audience :: Developers
License :: OSI Approved :: Apache Software License
Programming Language :: Python :: 2.6
Programming Language :: Python :: 2.7
Programming Language :: Python :: 3.3
Programming Language :: Python :: 3.4
Topic :: Database
Topic :: Software... |
"""
Astronomical and physics constants in SI units. See :mod:`astropy.constants`
for a complete listing of constants defined in Astropy.
"""
from __future__ import (absolute_import, division, print_function,
unicode_literals)
import numpy as np
from .constant import Constant, EMConstant
# PH... |
# -*- coding: utf-8 -*-
"""
pygments.styles.monokai
~~~~~~~~~~~~~~~~~~~~~~~
Mimic the Monokai color scheme. Based on tango.py.
http://www.monokai.nl/blog/2006/07/15/textmate-color-theme/
:copyright: Copyright 2006-2013 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.... |
# -*- coding: utf-8 -*-
"""
This module contains provisional support for SOCKS proxies from within
urllib3. This module supports SOCKS4 (specifically the SOCKS4A variant) and
SOCKS5. To enable its functionality, either install PySocks or install this
module with the ``socks`` extra.
The SOCKS implementation supports t... |
# Script to role discord members who have already associated their BYOND account
# From Discord API:
# Clients are allowed 120 events every 60 seconds, meaning you can send on average at a rate of up to 2 events per second.
# So lets send every 0.6 seconds to ensure we arent rate capped
####### CONFIG ######
# Disc... |
"""Tests for Wrapping / Unwrapping dataset variants."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from tensorflow.python.data.kernel_tests import test_base
from tensorflow.python.data.ops import dataset_ops
from tensorflow.python.framework import ops
f... |
#!/usr/bin/jython
"""Unit tests for the readingdb interface"""
import unittest
from t_readingdb import *
class TestSequenceFunctions(unittest.TestCase):
def setUp(self):
"""Runs before every test"""
self.db = ReadingDBAccess()
print('\n')
def gen_to_list(self, gen):
return ge... |
import unittest
from itertools import chain
from overviewer_core.tileset import iterate_base4, RendertileSet
from overviewer_core.util import roundrobin
class RendertileSetTest(unittest.TestCase):
# If you change this definition, you must also change the hard-coded
# results list in test_posttraverse()
t... |
from datetime import datetime
from decimal import Decimal
import numpy as np
import pytest
import pytz
from pandas.compat import is_platform_little_endian
from pandas import CategoricalIndex, DataFrame, Index, Interval, RangeIndex, Series
import pandas._testing as tm
class TestFromRecords:
def test_from_record... |
from __future__ import division
import vistrails.core.interpreter.cached
import vistrails.core.interpreter.noncached
import unittest
cached_interpreter = vistrails.core.interpreter.cached.CachedInterpreter
noncached_interpreter = vistrails.core.interpreter.noncached.Interpreter
__default_interpreter = cached_interpr... |
from weboob.tools.test import BackendTest
class WeatherTest(BackendTest):
BACKEND = 'weather'
def test_cities(self):
paris = self.backend.iter_city_search('crappything¶m=;drop database')
self.assertTrue(len(list(paris)) == 0)
paris = self.backend.iter_city_search('paris')
... |
ANSIBLE_METADATA = {'status': ['preview'],
'supported_by': 'community',
'version': '1.0'}
try:
import gitlab
HAS_GITLAB_PACKAGE = True
except:
HAS_GITLAB_PACKAGE = False
from ansible.module_utils.pycompat24 import get_exception
from ansible.module_utils.basic import... |
"""more fields in submission
Revision ID: 661fce6a2f64
Revises: 0c79593066ed
Create Date: 2019-11-14 12:02:55.010214
"""
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql
# revision identifiers, used by Alembic.
revision = '661fce6a2f64'
down_revision = '0c79593066ed'
branch_... |
from openerp.tests.common import TransactionCase
from openerp.exceptions import ValidationError
class TestUsers(TransactionCase):
def setUp(self):
super(TestUsers, self).setUp()
users_obj = self.env['res.users']
groups_obj = self.env['res.groups']
# Create groups
self.gro... |
# coding: utf-8
from __future__ import unicode_literals
import re
import codecs
from .common import InfoExtractor
from ..utils import unified_strdate
class GooglePlusIE(InfoExtractor):
IE_DESC = 'Google Plus'
_VALID_URL = r'https://plus\.google\.com/(?:[^/]+/)*?posts/(?P<id>\w+)'
IE_NAME = 'plus.google'... |
#!/usr/bin/env python
from peyotl.ott import create_pruned_and_taxonomy_for_tip_ott_ids
from peyotl.phylo.compat import compare_bits_as_splits, SplitComparison
from peyotl.utility import any_early_exit, get_logger
_LOG = get_logger(__name__)
def evaluate_tree_rooting(nexson, ott, tree_proxy):
"""
Returns Non... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# seekiir Framework - Indexing
# ListReader class
#
import string
from os import linesep
from ifind.seeker.common_helpers import file_exists
class ListReader(list):
'''
A simple class which extends the Python list object. Reads in the input file list and stores... |
import DVDProject, TitleList, TitleCutter, TitleProperties, ProjectSettings, DVDToolbox, Process
from Screens.Screen import Screen
from Screens.ChoiceBox import ChoiceBox
from Screens.InputBox import InputBox
from Screens.MessageBox import MessageBox
from Screens.HelpMenu import HelpableScreen
from Screens.TaskView imp... |
"""Test the dirac-transformation-replication script and helper"""
import unittest
from mock import MagicMock as Mock, patch
from DIRAC import S_OK, S_ERROR
from DIRAC.TransformationSystem.Utilities.ReplicationTransformation import createDataTransformation
from DIRAC.TransformationSystem.Utilities.ReplicationCLIPara... |
from datetime import datetime
from dateutil.relativedelta import relativedelta
from openerp.osv import fields,osv
from openerp import tools
class report_timesheet_task_user(osv.osv):
_name = "report.timesheet.task.user"
_auto = False
_order = "name"
def get_hrs_timesheet(self, cr, uid, ids, name, arg... |
import unittest
from test import test_support
import pwd
class PwdTest(unittest.TestCase):
def test_values(self):
entries = pwd.getpwall()
entriesbyname = {}
entriesbyuid = {}
for e in entries:
self.assertEqual(len(e), 7)
self.assertEqual(e[0], e.pw_name)
... |
import os
from setuptools import setup, find_packages
def read(*paths):
with open(os.path.join(*paths), 'r') as f:
return f.read()
def requirements():
requirements_list = []
with open('requirements.txt') as requirements:
for install in requirements:
requirements_list.append(i... |
import re
import os
from setuptools import setup, find_packages
try:
import pypandoc
LONG_DESCRIPTION = pypandoc.convert('README.md', 'rst')
except (IOError, ImportError):
LONG_DESCRIPTION = ''
setup(
name='Flask-Validator',
version='1.4.2',
license='Mozilla Public License',
author='Jesus ... |
from allauth.socialaccount.app_settings import STORE_TOKENS
from allauth.socialaccount.providers.base import ProviderAccount
from allauth.socialaccount.providers.oauth2.provider import OAuth2Provider
class EveOnlineAccount(ProviderAccount):
def get_profile_url(self):
return 'https://gate.eveonline.com/Pro... |
"""RSA encryption protocol according to PKCS#1 OAEP
See RFC3447__ or the `original RSA Labs specification`__ .
This scheme is more properly called ``RSAES-OAEP``.
As an example, a sender may encrypt a message in this way:
>>> from Crypto.Cipher import PKCS1_OAEP
>>> from Crypto.PublicKey import RSA
... |
# Paul Schrum Unity ID: ptschrum
# Course Project for GIS 540
"""
Given one or more input files (required to be Polylines),
an output file, an optional LoadCheck boolean, and an optional
spatial reference, generate one or more csv files showing the
radius (and other attributes) of each point triplet in the
polylines... |
from __future__ import absolute_import, division, print_function, unicode_literals
from c7n.filters import CrossAccountAccessFilter
from c7n.manager import resources
from c7n.query import QueryResourceManager
@resources.register('sns')
class SNS(QueryResourceManager):
class resource_type(object):
servic... |
# vim:fileencoding=utf-8:noet
from __future__ import (unicode_literals, division, absolute_import, print_function)
import sys
import re
from powerline.lib.encoding import get_preferred_output_encoding
NON_PRINTABLE_STR = (
'[^'
# ASCII control characters: 0x00-0x19
+ '\t\n' # Tab, newline: allowed ASCI... |
import os
from os.path import join
import numpy
from numpy.distutils.misc_util import Configuration
from sklearn._build_utils import get_blas_info
def configuration(parent_package="", top_path=None):
config = Configuration("manifold", parent_package, top_path)
libraries = []
if os.name == 'posix':
... |
from django.http import HttpResponse, Http404
from django.template import loader
from django.contrib.sites.models import get_current_site
from django.core import urlresolvers
from django.core.paginator import EmptyPage, PageNotAnInteger
from django.contrib.gis.db.models.fields import GeometryField
from django.db import... |
#Boa:Frame:PlotFrame
from __future__ import division
import wx
import plotpanel
_INITIAL_TIME_VALUE_ = 0.2 # initial refresh rate in seconds
def create(parent):
return PlotFrame(parent)
[wxID_PLOTFRAME, wxID_PLOTFRAMECHECKAUTOSCALE, wxID_PLOTFRAMEEDITMAX, wxID_PLOTFRAMEEDITMIN, wxID_PLOTFRAMEEDITTIME, wxID_P... |
# encoding: utf-8
from __future__ import unicode_literals
import re
from hashlib import sha1
from .common import InfoExtractor
from ..compat import (
compat_urllib_parse,
)
from ..utils import (
ExtractorError,
determine_ext,
float_or_none,
int_or_none,
unified_strdate,
)
class ProSiebenSat1... |
from invenio.sequtils import SequenceGenerator
from invenio.bibedit_utils import get_bibrecord
from invenio.bibrecord import record_get_field_value, create_record
# Imports related to the texkey generation daemon
from invenio.search_engine import perform_request_search, get_record
from invenio.bibrecord import field_g... |
"""Poll module is ungraded xmodule used by students to
to do set of polls.
On the client side we show:
If student does not yet anwered - Question with set of choices.
If student have answered - Question with statistics for each answers.
"""
import cgi
import json
import logging
from collections import OrderedDict
fro... |
import sys
sys.path += ["../"]
from mingus.containers.NoteContainer import NoteContainer
from mingus.containers.Note import Note
import unittest
class test_NoteContainers(unittest.TestCase):
def setUp(self):
self.n1 = NoteContainer()
self.n2 = NoteContainer("A")
self.n3 = NoteContainer(["A", "C", "E"])
sel... |
from __future__ import unicode_literals, division, absolute_import
from builtins import * # noqa pylint: disable=unused-import, redefined-builtin
class TestDigest(object):
config = """
tasks:
digest 1:
mock:
- title: entry 1
accept_all: yes
dige... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('third_party_auth', '0008_auto_20170413_1455'),
]
operations = [
migrations.AddField(
model_name='ltiproviderconf... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Import/Export for SIP data."""
import codecs
from datetime import datetime
import numpy as np
import re
import pygimli as pg
def load(fileName, verbose=False, **kwargs):
"""Shortcut to load SIP spectral data.
Import Data and try to assume the file format.
... |
"""Extends the Cheetah generator search list to add html historic data tables in a nice colour scheme.
Tested on Weewx release 4.0.0.
Works with all databases.
Observes the units of measure and display formats specified in skin.conf.
WILL NOT WORK with Weewx prior to release 3.0.
-- Use this version for 2.4 - 2.7: ... |
"""Base utilities for loading datasets (deprecated).
This module and all its submodules are deprecated. See
[contrib/learn/README.md](https://www.tensorflow.org/code/tensorflow/contrib/learn/README.md)
for migration instructions.
"""
from __future__ import absolute_import
from __future__ import division
from __future... |
"""Various contrib ops related to text-processing."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from tensorflow.contrib.text.python.ops.skip_gram_ops import skip_gram_sample
from tensorflow.contrib.text.python.ops.skip_gram_ops import skip_gram_sample... |
import json
import time
class ExpirationMixin(object):
def _calc_ttl(self, item):
if item['expires'] < 0: return -1 # never expires
ttl = item['expires'] - time.clock()
return 0 if ttl < 0 else ttl
def _set_expires(self, item, expires):
item['expires'] = time.clock() + expires... |
#!/usr/bin/env python
import os
import sys
import subprocess
from optparse import OptionParser
SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
PARAMETERS = None
def doCMD(cmd):
print "-->> \"%s\"" % cmd
output = []
cmd_return_code = 1
cmd_proc = subprocess.Popen(
cmd, stdout=subproce... |
import os
import unittest
import Gaffer
import GafferTest
import GafferScene
import GafferSceneTest
import GafferOSL
import GafferDelight
@unittest.skipIf( GafferTest.inCI(), "No license available in cloud" )
class InteractiveDelightRenderTest( GafferSceneTest.InteractiveRenderTest ) :
interactiveRenderNodeClass = ... |
#!/usr/bin/env python3
'''Create YAML for dashboard page by querying GitHub repositories.'''
import sys
import time
import yaml
CONTROLS = (
('swcarpentry/shell-novice', 'Unix Shell'),
('swcarpentry/git-novice', 'Git'),
('swcarpentry/hg-novice', 'Mercurial'),
('swcarpentry/sql-novice-survey', 'SQL')... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.