content stringlengths 4 20k |
|---|
"""
Copyright (C) 2009 Sergey Koposov
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 di... |
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['stableinterface'],
'supported_by': 'community'}
from ansible.module_utils.basic import AnsibleModule
from ansible.module_utils.cloudstack import (
AnsibleCloudStack,
cs_argument_spec,
cs_required_together
)
... |
"""
Simple multi-layer perceptron model.
"""
import logging
from neon.backends.backend import Block
from neon.models.model import Model
from neon.util.param import opt_param, req_param
logger = logging.getLogger(__name__)
class MLP(Model):
"""
Fully connected, feed-forward, multi-layer perceptron model
... |
"""Tests for event handling."""
__author__ = 'Sean Lip'
from core.domain import event_services
from core.platform import models
taskqueue_services = models.Registry.import_taskqueue_services()
from core.tests import test_utils
import feconf
from google.appengine.ext import ndb
class NumbersModel(ndb.Model):
nu... |
"""Map the residues of two structures to each other based on a FASTA alignment
file.
"""
from __future__ import print_function
from Bio.Data import SCOPData
from Bio.PDB import Selection
from Bio.PDB.Polypeptide import is_aa
__docformat__ = "restructuredtext en"
class StructureAlignment(object):
"""
This c... |
# -*- coding: utf-8 -*-
from nose.tools import eq_, ok_, raises
from wtforms import fields
from flask_admin.contrib.sqla import ModelView
from flask_admin.contrib.sqla.fields import InlineModelFormList
from flask_admin.contrib.sqla.validators import ItemsRequired
from . import setup
def test_inline_form():
app... |
"""
Tests the use of the NO_LOAD flag which makes loading sub .mk files
optional.
"""
# Python 2.5 needs this for the with statement.
from __future__ import with_statement
import os
import TestGyp
test = TestGyp.TestGyp(formats=['make'])
test.run_gyp('all.gyp', chdir='noload')
test.relocate('noload', 'relocate/nol... |
#!/usr/bin/python
# -*- coding: UTF-8 -*-
import pygtk, gtk
import sys
from conf.conf import Config
class App (Config):
def __init__(self): #initialize every important widget that we will interact with.
#bring all the file where the GUI is described
Config.__init__(self, "conf/")
s... |
import unittest
from test import support
import os
import sys
class NoAll(RuntimeError):
pass
class FailedImport(RuntimeError):
pass
class AllTest(unittest.TestCase):
def check_all(self, modname):
names = {}
with support.check_warnings(
(".* (module|package)", DeprecationWa... |
"""
=============
Masked Arrays
=============
Arrays sometimes contain invalid or missing data. When doing operations
on such arrays, we wish to suppress invalid values, which is the purpose masked
arrays fulfill (an example of typical use is given below).
For example, examine the following array:
>>> x = np.array(... |
# -*- coding: utf-8 -*-
"""
coin_flip_traders.py
An example trading strategy created using the Darwinex ZeroMQ Connector
for Python 3 and MetaTrader 4.
Source code:
https://github.com/darwinex/DarwinexLabs/tree/master/tools/dwx_zeromq_connector
The strategy launches 'n' threads (e... |
# -*- coding: 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 model 'Poll'
db.create_table('polls_poll', (
('id', self.gf('django.db.models.fields.Au... |
from cme.helpers.powershell import *
from cme.helpers.logger import write_log
from datetime import datetime
from io import StringIO
class CMEModule:
'''
Executes Get-ChromeDump to decrypt saved chrome credentials
Module by @byt3bl33d3r
'''
name = 'enum_chrome'
description = "Decrypts s... |
import numpy as np
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
# import matplotlib.finance as mf
from matplotlib.widgets import MultiCursor
import statsmodels.tsa.stattools as stt
# import scipy.signal as sgn
import statsmodels.api as sm
# from statsmodels.sandbox.regression.predstd import... |
from .currency_getter_interface import Currency_getter_interface
from openerp import _
from openerp.exceptions import except_orm
import logging
_logger = logging.getLogger(__name__)
class CA_BOC_getter(Currency_getter_interface):
"""Implementation of Curreny_getter_factory interface
for Bank of Canada RSS s... |
#!/usr/bin/env python
# Read DAKOTA parameters file standard format and call SU2
# python module for analysis and return the results file to Dakota.
# DAKOTA will execute this script as
# SU2_dakota_interface.py params.in results.out
# so sys.argv[1] will be the parameters file and
# sys.argv[2] will be the res... |
from django.core.exceptions import ValidationError
from django.test import SimpleTestCase
from weblate.checks.flags import TYPED_FLAGS, TYPED_FLAGS_ARGS, Flags
class FlagTest(SimpleTestCase):
def test_parse(self):
self.assertEqual(Flags("foo, bar").items(), {"foo", "bar"})
def test_parse_blank(self)... |
import weakref
import six
from sqlalchemy import and_
from sqlalchemy import or_
from sqlalchemy import sql
from neutron.common import exceptions as n_exc
from neutron.db import sqlalchemyutils
def model_query_scope(context, model):
# Unless a context has 'admin' or 'advanced-service' rights the
# query wil... |
# Gerhard Haering <<EMAIL>> is responsible for the hacked version of this
# module.
#
# This is a modified version of the bdist_wininst distutils command to make it
# possible to build installers *with extension modules* on Unix.
"""distutils.command.bdist_wininst
Implements the Distutils 'bdist_wininst' command: cre... |
import matplotlib.pyplot as plt
from collections import Counter
def make_chart_simple_line_chart(plt):
years = [1950, 1960, 1970, 1980, 1990, 2000, 2010]
gdp = [300.2, 543.3, 1075.9, 2862.5, 5979.6, 10289.7, 14958.3]
# create a line chart, years on x-axis, gdp on y-axis
plt.plot(years, gdp, color='gr... |
# ../gungame/gungame.py
"""Weapon leveling game modification."""
# =============================================================================
# >> IMPORTS
# =============================================================================
# Python
from contextlib import suppress
from importlib import import_module
# ... |
from __future__ import unicode_literals
from .common import InfoExtractor
from ..utils import parse_iso8601
class HowcastIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?howcast\.com/videos/(?P<id>\d+)'
_TEST = {
'url': 'http://www.howcast.com/videos/390161-How-to-Tie-a-Square-Knot-Properly',
... |
'''
This is a utility class for factorizing matching functions for
discovery runners and rules.
'''
import re
from item import Item
class MatchingItem(Item):
# Try to see if the key,value is matching one or
# our rule. If value got ',' we must look for each value
# If one match, we quit
# We can ... |
from __future__ import absolute_import
import os
from chaco.plot_label import PlotLabel
from enable.component_editor import ComponentEditor as EnableComponentEditor
from traits.api import Property, Event, cached_property, Any
from traitsui.api import View, UItem
from pychron.core.helpers.iterfuncs import groupby_gro... |
# coding: utf-8
from __future__ import unicode_literals
from .common import InfoExtractor
from ..utils import (
ExtractorError,
int_or_none,
float_or_none,
mimetype2ext,
parse_iso8601,
remove_end,
update_url_query,
)
class DRTVIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?dr\.d... |
"""distutils.command.config
Implements the Distutils 'config' command, a (mostly) empty command class
that exists mainly to be sub-classed by specific module distributions and
applications. The idea is that while every "config" command is different,
at least they're all named the same, and users always see "conf... |
from openerp.tests.common import TransactionCase
class TestFiscalPosition(TransactionCase):
"""Tests for fiscal positions in auto apply (account.fiscal.position).
If a partner has a vat number, the fiscal positions with "vat_required=True"
are prefered.
"""
def setUp(self):
super(TestFisca... |
from django.test.utils import override_settings
from mock import patch
from nose.tools import eq_, ok_
from requests import ConnectionError, HTTPError
from mozillians.common.tests import TestCase
from mozillians.geo.models import Country, Region, City
from mozillians.geo.lookup import (GeoLookupException, deduplicate... |
import unittest
from itest_support import IntegrationTestSupport
class Test(IntegrationTestSupport):
def test(self):
self.write_build_file("""
from pybuilder.core import use_plugin
use_plugin("python.core")
use_plugin("python.distutils")
name = "integration-test"
default_task = "publish"
""")
... |
"""A binary to train CIFAR-10 using multiple GPU's with synchronous updates.
Accuracy:
cifar10_multi_gpu_train.py achieves ~86% accuracy after 100K steps (256
epochs of data) as judged by cifar10_eval.py.
Speed: With batch_size 128.
System | Step Time (sec/batch) | Accuracy
------------------------------... |
#!/usr/bin/env python
#
# Created on 7/5/2013 Pat Cappelaere - Vightel Corporation
#
# Requirements:
# gdal...
#
# Requires 2011 LandScan EPSG:4326
# cd [ls]/LandScan-2011/ArcGIS/Population
# gdalwarp lspop2011 -t_srs EPSG:4326 -of GTIFF lspop2011_4326.tif
#
import os, inspect, sys
import argparse
from osgeo import ... |
"""add task fails journal table
Revision ID: 64de9cddf6c9
Revises: 211e584da130
Create Date: 2016-08-03 14:02:59.203021
"""
import sqlalchemy as sa
from alembic import op
# revision identifiers, used by Alembic.
from airflow.models.base import COLLATION_ARGS
revision = '64de9cddf6c9'
down_revision = '211e584da130'
... |
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['stableinterface'],
'supported_by': 'community'}
from ansible.module_utils.basic import AnsibleModule
from ansible.module_utils.mysql... |
import socket
try:
from select import poll, POLLIN
except ImportError: # `poll` doesn't exist on OSX and other platforms
poll = False
try:
from select import select
except ImportError: # `select` doesn't exist on AppEngine.
select = False
def is_connection_dropped(conn): # Platform-... |
from telemetry.page.actions import action_runner as action_runner_module
from telemetry.page.actions import page_action
from telemetry.unittest_util import tab_test_case
class PinchActionTest(tab_test_case.TabTestCase):
def setUp(self):
super(PinchActionTest, self).setUp()
def testPinchByApiCalledWithCorrect... |
import logging
import argparse
import sys
from cairis.core.Borg import Borg
import cairis.core.BorgFactory
from cairis.core.dba import resetUser,accounts
from cairis.mio.ModelExport import exportPackage
from cairis.bin.cimport import package_import
__author__ = 'Shamal Faily'
logging.basicConfig(level=logging.INFO)
l... |
"""
Dogleg algorithm with rectangular trust regions for least-squares minimization.
The description of the algorithm can be found in [Voglis]_. The algorithm does
trust-region iterations, but the shape of trust regions is rectangular as
opposed to conventional elliptical. The intersection of a trust region and
an init... |
import logging
from django.core.urlresolvers import reverse
from django.core.urlresolvers import reverse_lazy
from django.utils.translation import ugettext_lazy as _
from django.utils.translation import ungettext_lazy
from horizon import exceptions
from horizon import tables
from horizon.utils import memoized
from o... |
"""
Views and functions for serving static files. These are only to be used during
development, and SHOULD NOT be used in a production setting.
"""
import mimetypes
import os
import posixpath
import re
import stat
import urllib
from email.Utils import parsedate_tz, mktime_tz
from django.conf import setti... |
""" Part of Cosmos by OpenGenus Foundation"""
import collections
"""
Wrapper function for the print function.
Used as the default visitFunc for bfs
"""
def visitPrint(i):
print(i)
"""
A class representing a undirected graph of nodes.
An edge can be added between two nodes by calling addEdge
... |
from gi.repository import GtkSource
from meld.ui import gnomeglade
class FindBar(gnomeglade.Component):
def __init__(self, parent):
gnomeglade.Component.__init__(self, "findbar.ui", "findbar",
["arrow_left", "arrow_right"])
self.set_text_view(None)
se... |
from __future__ import print_function, unicode_literals
import unittest
import weblab.core.coordinator.sql.priority_queue_scheduler_model as PQSM
import weblab.core.coordinator.sql.model as CM
class PriorityQueueSchedulerModelTestCase(unittest.TestCase):
def test_repr_pq_current_reservation(self):
resour... |
'''
A script to check that the (Linux) executables produced by gitian only contain
allowed gcc, glibc and libstdc++ version symbols. This makes sure they are
still compatible with the minimum supported Linux distribution versions.
Example usage:
find ../gitian-builder/build -type f -executable | xargs python con... |
import logging
import os
import sys
import threading
from flask import Flask, Response
from flask.ext.compress import Compress
from history.statebuffer import BufferCollection, BufferUpdater
compress = Compress()
state_buffer = None
log = logging.getLogger(__name__)
add_headers_cb = None
try:
import dcos_auth... |
from __future__ import absolute_import
from django.db.models.query_utils import DeferredAttribute
from django.test import TestCase
from .models import Secondary, Primary, Child, BigChild, ChildProxy
class DeferTests(TestCase):
def assert_delayed(self, obj, num):
count = 0
for field in obj._meta.... |
from bot.api.api import Api
from bot.logger.message_sender.asynchronous import AsynchronousMessageSender
from bot.logger.message_sender.message_builder.factory import MessageBuilderFactory
from bot.logger.message_sender.reusable.limiter.group import ReusableMessageLimiterGroup
from bot.logger.message_sender.reusable.li... |
__author__ = 'Dominic Miglar <<EMAIL>>'
import unittest
from time import sleep, time
from bitcodin import create_job
from bitcodin import create_input
from bitcodin import create_encoding_profile
from bitcodin import delete_input
from bitcodin import delete_encoding_profile
from bitcodin import transfer_job
from bitco... |
import weakref
from . import attributes
from .. import util
class IdentityMap(dict):
def __init__(self):
self._modified = set()
self._wr = weakref.ref(self)
def replace(self, state):
raise NotImplementedError()
def add(self, state):
raise NotImplementedError()
def upd... |
from __future__ import unicode_literals
import re
from ..utils import (
ExtractorError,
unescapeHTML,
unified_strdate,
US_RATINGS,
)
from .subtitles import SubtitlesInfoExtractor
class VikiIE(SubtitlesInfoExtractor):
IE_NAME = 'viki'
_VALID_URL = r'^https?://(?:www\.)?viki\.com/videos/(?P<i... |
#! /usr/bin/env python2
"""
poller-wrapper A small tool which wraps around the poller and tries to
guide the polling process with a more modern approach with a
Queue and workers
Author: Job Snijders <<EMAIL>>
Date: Jan 2013
Usage: This program accepts one co... |
import os
import sys
import shutil
import subprocess
from oeqa.oetest import oeRuntimeTest
from oeqa.utils.decorators import tag
from get_source import get_test_module_repo
CONST_PATH = os.path.dirname(os.path.realpath(__file__))
def copy_test_files(self):
'''
Copy necessary all files related to testing to ... |
"""Unit tests for scalar space encoder"""
import unittest2 as unittest
from nupic.encoders.scalar_space import ScalarSpaceEncoder, DeltaEncoder
class ScalarSpaceEncoderTest(unittest.TestCase):
'''Unit tests for ScalarSpaceEncoder class'''
def testScalarSpaceEncoder(self):
"""scalar space encoder"""
#... |
from collections import namedtuple
from airflow.utils.db import provide_session
class BaseTIDep(object):
"""
Abstract base class for dependencies that must be satisfied in order for task
instances to run. For example, a task that can only run if a certain number of its
upstream tasks succeed. This is... |
import sys
if sys.version_info[:2] < (3, 2):
from xml.sax.saxutils import escape
else:
from html import escape
WINNERS = ("Nikolai Andrianov", "Matt Biondi", "Bjørn Dæhlie",
"Birgit Fischer", "Sawao Kato", "Larisa Latynina", "Carl Lewis",
"Michael Phelps", "Mark Spitz", "Jenny Thompson")
def... |
import logging
import stat as stat_module
logger = logging.getLogger(__name__)
def do_overwrite_save(fs, path, data):
def copy_data(path_dest):
try:
fs.create(path_dest, overwrite=False, data=data)
logging.info("Wrote to " + path_dest)
except Exception as e:
... |
data = (
'ja', # 0x00
'ju', # 0x01
'ji', # 0x02
'jaa', # 0x03
'jee', # 0x04
'je', # 0x05
'jo', # 0x06
'jwa', # 0x07
'ga', # 0x08
'gu', # 0x09
'gi', # 0x0a
'gaa', # 0x0b
'gee', # 0x0c
'ge', # 0x0d
'go', # 0x0e
'[?]', # 0x0f
'gwa', # 0x10
'[?]', # 0x11
'gwi', # 0x1... |
"""
Filter to add support for Trusted Computing Pools (EXPERIMENTAL).
Filter that only schedules tasks on a host if the integrity (trust)
of that host matches the trust requested in the ``extra_specs`` for the
flavor. The ``extra_specs`` will contain a key/value pair where the
key is ``trust``. The value of this pai... |
"""
Provide tests for git_add_course management command.
"""
import logging
import os
import shutil
import StringIO
import subprocess
import unittest
from django.conf import settings
from django.core.management import call_command
from django.core.management.base import CommandError
from django.test.utils import overr... |
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'core'}
import re
from ansible.module_utils._text import to_native, to_text
from ansible.module_utils.bas... |
""" Copyright (C) MX4J.
All rights reserved.
This software is distributed under the terms of the MX4J License version 1.0.
See the terms of the MX4J License in the documentation provided with this software.
author <a href="mailto:<EMAIL>">Carlos Quiroz</a>
version $Revision: 1.3 $
"""
from javax.mana... |
"""Miscellaneous WSGI-related Utilities"""
import posixpath
__all__ = [
'FileWrapper', 'guess_scheme', 'application_uri', 'request_uri',
'shift_path_info', 'setup_testing_defaults',
]
class FileWrapper:
"""Wrapper to convert file-like objects to iterables"""
def __init__(self, filelike, blksize=819... |
# -*- coding: utf-8 -*-
"""
***************************************************************************
ScriptEdit.py
---------------------
Date : April 2013
Copyright : (C) 2013 by Alexander Bruy
Email : alexander dot bruy at gmail dot com
****************... |
#!/usr/bin/env python
import os
import sys
from os.path import join
from distutils.sysconfig import get_python_inc
def configuration(parent_package='',top_path=None):
from numpy.distutils.misc_util import Configuration
config = Configuration('special', parent_package, top_path)
define_macros = []
if ... |
import time
from openerp.osv import osv
from openerp.report import report_sxw
class pos_payment_report(report_sxw.rml_parse):
def __init__(self, cr, uid, name, context):
super(pos_payment_report, self).__init__(cr, uid, name, context=context)
self.total = 0.0
self.localcontext.update({
... |
import abc
from neutron.api import extensions
from neutron.api.v2 import base
from neutron import manager
from neutron import quota
# Attribute Map
RESOURCE_ATTRIBUTE_MAP = {
'ext_test_resources': {
'id': {'allow_post': False, 'allow_put': False,
'validate': {'type:uuid': None},
... |
import os
from binascii import hexlify
from hashlib import sha1
from twisted.internet import defer
from twisted.python import log
from buildbot.util import bytes2unicode
from buildbot.util import unicode2bytes
# TODO: fossil comes from a plugin. We should have an API that plugins could use to
# register allowed user... |
from neutron_lib import constants as n_const
from oslo_log import log
from neutron.plugins.ml2.drivers.linuxbridge.agent.common import constants
LOG = log.getLogger(__name__)
def get_tap_device_name(interface_id):
"""Convert port ID into device name format expected by linux bridge."""
if not interface_id:
... |
"""RSA module
pri = k[1] //Private part of keys d,p,q
Module for calculating large primes, and RSA encryption, decryption,
signing and verification. Includes generating public and private keys.
WARNING: this code implements the mathematics of RSA. It is not suitable for
real-world secur... |
import json
import jenkins
import sys
from optparse import OptionParser
from six.moves.urllib.request import Request
JENKINS_IP = 'http://52.7.139.177/'
GEONODE_DEMO_DOMAIN = 'demo.geonode.org' # should match the jenkins configuration
NODE_LIST = 'computer/api/json' # jenkins api backend
GEONODE_DEMO_JOB = 'geonode-a... |
import datetime
import json
import string
import dateparser
from flask import Flask
from flask import render_template
from flask import request
import dbconfig
if dbconfig.test:
from mockdbhelper import MockDBHelper as DBHelper
else:
from dbhelper import DBHelper
app = Flask(__name__)
DB = DBHelper()
cate... |
"""
Make sure paths are normalized with VS macros properly expanded on Windows.
"""
import TestGyp
import sys
if sys.platform == 'win32':
test = TestGyp.TestGyp(formats=['ninja'])
test.run_gyp('normalize-paths.gyp')
# We can't use existence tests because any case will pass, so we check the
# contents of ni... |
"""Shared support for scanning document type declarations in HTML and XHTML.
This module is used as a foundation for the HTMLParser and sgmllib
modules (indirectly, for htmllib as well). It has no documented
public API and should not be used directly.
"""
import re
_declname_match = re.compile(r'[a-zA-Z]... |
from rest_framework import serializers
from django.contrib.auth.models import User
from rest_framework_gis.serializers import GeoModelSerializer
from .models import Alert, HouseholdSurveyJSON, TeamMember, HouseholdMember
class JSONSerializerField(serializers.Field):
""" Serializer for JSONField -- required to m... |
"""Presubmit script for Chromium theme resources.
See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts
for more details about the presubmit API built into gcl/git cl, and see
http://www.chromium.org/developers/web-development-style-guide for the rules
we're checking against here.
"""
def Check... |
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'community'}
try:
import consul
from requests.exceptions import ConnectionError
python_consul_... |
"""Tests for 1-Wire config flow."""
from unittest.mock import patch
from pyownet.protocol import ConnError, OwnetError
from homeassistant.components.onewire.const import CONF_TYPE_OWSERVER, DOMAIN
from homeassistant.config_entries import (
CONN_CLASS_LOCAL_POLL,
ENTRY_STATE_LOADED,
ENTRY_STATE_NOT_LOADED,... |
from ..excel_comparsion_test import ExcelComparisonTest
from ...workbook import Workbook
class TestCompareXLSXFiles(ExcelComparisonTest):
"""
Test file created by XlsxWriter against a file created by Excel.
"""
def setUp(self):
self.maxDiff = None
filename = 'comment09.xlsx'
... |
from sympy import symbols
from sympy.physics.mechanics import Point, Particle, ReferenceFrame
def test_particle():
m, m2, v1, v2, v3, r, g, h = symbols('m m2 v1 v2 v3 r g h')
P = Point('P')
P2 = Point('P2')
p = Particle('pa', P, m)
assert p.mass == m
assert p.point == P
# Test the mass set... |
from invenio.modules.jsonalchemy.jsonext.functions.util_merge_fields_info_list \
import util_merge_fields_info_list
def sync_meeting_names(self, field_name, connected_field, action): # pylint: disable=W0613
"""
Sync corparate names content only when `__setitem__` or similar is used
"""
if action ... |
"""
Test the style of toggle and radio buttons inside a palette. The buttons
contains only an icon and should be rendered similarly to the toolbar
controls. Ticket #2855.
"""
from gi.repository import Gtk
from sugar3.graphics.palette import Palette
from sugar3.graphics.icon import Icon
import common
test = common.T... |
import unittest
import numpy as np
np.random.seed(1337) # for reproducibility
from keras.models import Sequential
from keras.layers.core import Merge, Dense, Activation, Flatten, ActivityRegularization
from keras.layers.embeddings import Embedding
from keras.datasets import mnist
from keras.utils import np_utils
from ... |
# coding=utf-8
#
#
# ZapiSession
# (c) 2014 Pascal Nançoz
# modified by Daniel Griner
#
import os, re, base64
import urllib, urllib2
import json
class ZapiSession:
ZAPI_AUTH_URL = 'https://zattoo.com'
ZAPI_URL = 'https://zattoo.com'
DATA_FOLDER = None
COOKIE_FILE = None
SESSION_FILE = None... |
import sys
import os
import argparse
import subprocess
from datetime import datetime
import json
import base64
import glob
import shutil
from urllib.request import urlopen, Request, HTTPError
format_simple = '--pretty=format:%h - %an : %s'
format_debian = '--pretty=format: * %h - %an : %s'
repka_site = 'rm.nextgis.co... |
import numpy as np
def long_substr(strgs):
"""
Returns a list with the longest common substring sequences from @strgs
Based on: http://stackoverflow.com/questions/2892931/longest-common-substring-from-more-than-two-strings-python
"""
# Copy the list
strgs = strgs[:]
if len(strgs) > 1 and l... |
"""
Support for getting data from websites with scraping.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/sensor.scrape/
"""
import logging
import voluptuous as vol
from homeassistant.components.sensor import PLATFORM_SCHEMA
from homeassistant.component... |
import sys
import logging
from contracts import contract, new_contract
from fs.osfs import OSFS
from lazy import lazy
from xblock.runtime import KvsFieldData, KeyValueStore
from xblock.fields import ScopeIds
from xblock.core import XBlock
from opaque_keys.edx.locator import BlockUsageLocator, LocalId, CourseLocator, L... |
"""This will retrieve a PDBs "fingerprint" from it's corresponding executable
image (.dll or .exe). This is used when retrieving the PDB from the symbol
server. The .pdb (or cab compressed .pd_) is expected at a path like:
foo.pdb/FINGERPRINT/foo.pdb
We can retrieve the same information from the .PDB file itself, b... |
# coding: utf-8
"""Included django-nose plugins."""
from __future__ import unicode_literals
import sys
from nose.plugins.base import Plugin
from nose.suite import ContextSuite
from django.test.testcases import TransactionTestCase, TestCase
from django_nose.testcases import FastFixtureTestCase
from django_nose.utils... |
# -*- coding: utf-8 -*-
# These tests don't work at the moment, due to the security_groups multi select not working
# in selenium (the group is selected then immediately reset)
import fauxfactory
import pytest
from cfme.cloud.instance import Instance
from cfme.cloud.provider import CloudProvider
from cfme.infrastructu... |
"""Resulttype definition"""
from __future__ import (print_function,
unicode_literals,
division)
import jube2.util
import xml.etree.ElementTree as ET
import re
import jube2.log
LOGGER = jube2.log.get_logger(__name__)
class Result(object):
"""A generic result type... |
__version__=''' $Id: PyFontify.py 3660 2010-02-08 18:17:33Z damian $ '''
__doc__="""
Module to analyze Python source code; for syntax coloring tools.
Interface::
tags = fontify(pytext, searchfrom, searchto)
- The 'pytext' argument is a string containing Python source code.
- The (optional) arguments 'searchfro... |
#file for creating the hash key-values
import os
import sys
from rooster.hashfunc import *
from rooster.parsedata import *
#creates a directory in python
def createrooster(directory):
if not os.path.exists(directory):
os.makedirs(directory)
else:
raise FileExistsError("directory name already ... |
from __future__ import unicode_literals, absolute_import
from client import JobGetter
from django.test import override_settings
from mock import patch
import os, subprocess
import threading
import time
from ci import views
from ci.tests import utils as test_utils
from client.tests import LiveClientTester, utils
@overr... |
import functools
import imp
import importlib
import inspect
import itertools
import logging
import os
import re
import sys
import time
import unittest
import threading
from os.path import join as opj
import unittest2
import openerp
import openerp.tools as tools
import openerp.release as release
from openerp.tools.saf... |
# -*- coding: utf-8 -*-
# ------------------------------------------------------------
# pelisalacarta - XBMC Plugin
# Conector para divxstage/cloudtime
# http://blog.tvalacarta.info/plugin-xbmc/pelisalacarta/
# ------------------------------------------------------------
import re
from core import httptools
from cor... |
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'certified'}
from ansible.module_utils.basic import AnsibleModule
from ansible.module_utils.net_tools.nio... |
import re
STR_MASK = '*' * 8
COLORS = {'nocolor': "\033[0m", 'red': "\033[0;31m",
'green': "\033[32m", 'blue': "\033[34m",
'yellow': "\033[33m"}
def color_text(text, color):
"""
Returns given text string with appropriate color tag. Allowed values
for color parameter are 'red', 'blue'... |
# coding=utf-8
from django.db import models
from account.models import User
from utils.models import RichTextField
class ProblemTag(models.Model):
name = models.CharField(max_length=30)
class Meta:
db_table = "problem_tag"
class AbstractProblem(models.Model):
# 标题
title = models.CharField(... |
"""Data generators for the Description2Code OpenAI data-set."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import collections
import os
import random
import re
import zipfile
from tensor2tensor.data_generators import generator_utils
from tensor2tensor.... |
import uuid
from dimagi.utils.parsing import json_format_datetime
from django.contrib.auth.models import User
from django.test import TestCase
from casexml.apps.case.mock import CaseBlock
from casexml.apps.case.models import CommCareCase
from casexml.apps.case.util import post_case_blocks
from casexml.apps.case.xml imp... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.