content string |
|---|
import c4d
from c4d import *
from c4d.documents import *
from c4d import symbols as sy, plugins, utils, bitmaps, gui
import re,os,subprocess
clean = lambda varStr: re.sub('\W|^(?=\d)','_', varStr)
#save obj
name = op.GetName()
c4dPath = c4d.storage.GeGetC4DPath(sy.C4D_PATH_LIBRARY)
docPath = doc.GetDocumentPath()
obj... |
from __future__ import print_function
import copy
import distutils
import os
from os import path
import shutil
import subprocess
import sys
import tempfile
import pkg_resources
import setuptools
from setuptools.command import build_ext
dummy_extension = setuptools.Extension('chainer', ['chainer.c'])
cython_version ... |
import functools
import logging
import os
import subprocess
import lockfile
from oslotest import base as test_base
from six import moves
from six.moves.urllib import parse
import sqlalchemy
import sqlalchemy.exc
from openstack.common.db.sqlalchemy import utils
from openstack.common.gettextutils import _LE
LOG = logg... |
import copy
import sys
from django.apps import apps as django_apps
from django.utils.module_loading import import_module, module_has_submodule
class RegistryNotLoaded(Exception):
pass
class AlreadyRegisteredVisitSchedule(Exception):
pass
class SiteVisitScheduleError(Exception):
pass
class SiteVisitS... |
"""
FILE: blob_samples_copy_blob_async.py
DESCRIPTION:
This sample demos how to copy a blob from a URL.
USAGE: python blob_samples_copy_blob_async.py
Set the environment variables with your own values before running the sample.
1) AZURE_STORAGE_CONNECTION_STRING - the connection string to your storage accou... |
import pytest
import numpy as np
import fitsio
from .context import daskfitsio as df
try:
from unittest import mock
except ImportError:
import mock
@pytest.fixture
def da(fitsfile):
with fitsio.FITS(fitsfile) as infile:
return df.DaskAdapter(infile[0])
def test_shape(da, dim):
assert da.shap... |
import nnabla as nn
import nnabla.functions as F
import nnabla.function as _F
from .backward_function import UnaryDataGrad
class SumPoolingDataGrad(UnaryDataGrad):
def __init__(self, ctx, kernel, stride=None, ignore_border=True, pad=None,
channel_last=False, including_pad=True):
super(Su... |
from django.conf.urls import url, include
from django.conf import settings
from main import views
urlpatterns = [
url(r'^$',
views.index.main_index, name='index'),
url(r'^media/(?P<name>.+)$',
views.media.serve_media, name='media'),
url(r'^api/', include([
url(r'^$',
... |
# -*- coding: utf-8 -*-
import re
from django.conf import settings
# todo: remove duplication
from django.http import JsonResponse
from elasticsearch_dsl import FacetedSearch, TermsFacet, Search, Q
from .es_indexes import AnnotatedToken, LemmaDocument
from .utils import get_order_fields, get_ascii_from_unicode
'''
... |
class Optional:
def __init__(self, key):
self.key = key
class Or:
def __init__(self, *conditions):
self.conditions = conditions
class XOr:
def __init__(self, *conditions):
self.conditions = conditions
class If:
def __init__(self, paths, key):
self.paths = paths
... |
EOF = "TOK_EOF"
BANG = "TOK_BANG"
COMMA = "TOK_COMMA"
EQUAL = "TOK_EQUAL"
GREAT = "TOK_GREAT"
LESS = "TOK_LESS"
MINUS = "TOK_MINUS"
PAREN_LEFT = "TOK_PAREN_LEFT"
PAREN_RIGHT = "TOK_PAREN_RIGHT"
PERCENT = "TOK_PERCENT"
PLUS = "TOK_PLUS"
SEMICOLON = "TOK_SEMICOLON"
SLASH = "TOK_SLASH"
STAR = "TOK_STAR"
BANG_EQUAL = "TO... |
from abc import ABCMeta, abstractmethod
from pynestml.symbols.symbol import Symbol
from pynestml.utils.logger import Logger, LoggingLevel
from pynestml.utils.messages import Messages
class TypeSymbol(Symbol):
"""
This class is used to represent a single type symbol which represents the type of a element, e.g... |
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'community'}
DOCUMENTATION = r'''
---
module: win_iis_website
version_added: "2.0"
short_description: Configures a IIS Web site
description:
- Creates, Removes and configures a IIS Web sit... |
# -*- 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 field 'Video2013.approved'
db.add_column('videos_video2013', 'approved',
self... |
#!/usr/bin/python
import os
from whoosh import index
from whoosh.fields import *
from whoosh.qparser import QueryParser
head,tail = os.path.split('files/1.txt')
head = os.path.dirname('files/1.txt')
tail = os.path.basename('files/1.txt')
def list_all_files(rootdir):
"""
list all flies in rootdir recursively
return... |
"""Manage the configuration file."""
# Import system libs
import os
import sys
try:
from configparser import RawConfigParser
from configparser import NoOptionError
except ImportError: # Python 2
from ConfigParser import RawConfigParser
from ConfigParser import NoOptionError
# Import Glances lib
from ... |
from cloudshell.api.cloudshell_api import AppInfo, ResourceInfoVmDetails, ReservedResourceInfo, ServiceInstance
from cloudshell.workflow.orchestration.app import App
class Components(object):
def __init__(self, resources, services, apps):
self.apps = {app.Name : App(app) for app in apps if len(app.Deploym... |
"""remove empty filters
Revision ID: afb7730f6a9c
Revises: c5756bec8b47
Create Date: 2018-06-07 09:52:54.535961
"""
# revision identifiers, used by Alembic.
revision = 'afb7730f6a9c'
down_revision = 'c5756bec8b47'
from alembic import op
import json
from sqlalchemy.ext.declarative import declarative_base
from sqlalc... |
import types
from DIRAC import gLogger, gConfig, S_OK, S_ERROR
from DIRAC.Core.Utilities.PromptUser import promptUser
from DIRAC.Core.Base.API import API
from DIRAC.TransformationSystem.Client.TransformationClient import TransformationClient
from DIRAC.ConfigurationSystem.Client.Helpers.Operations import Operations
fr... |
import mcpi.minecraft as minecraft
import mcpi.block as block
import time
mc = minecraft.Minecraft.create()
def clearSomeSpace(x, y, z):
mc.setBlocks(x - 10, y, z - 20, x + 10, y + 20, z + 20, block.AIR)
def addWindow(x, y, z, width, height, depth):
if width == 1 and height == 1 and depth == 1... |
from jormungandr.scenarios import default, helpers
import copy
import logging
from jormungandr.scenarios.utils import JourneySorter, are_equals, compare
from navitiacommon import response_pb2
from operator import itemgetter, indexOf, attrgetter
from datetime import datetime, timedelta
import pytz
from collections impor... |
# Strategy Guide - Basic bot by ramk13
import rg
class Robot:
def act(self, game):
all_locs = {(x, y) for x in xrange(19) for y in xrange(19)}
spawn = {loc for loc in all_locs if 'spawn' in rg.loc_types(loc)}
obstacle = {loc for loc in all_locs if 'obstacle' in rg.loc_types(loc)}
... |
"""
Django settings for test_project project.
For more information on this file, see
https://docs.djangoproject.com/en/1.7/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.7/ref/settings/
"""
# Build paths inside the project like this: os.path.join(BASE_DIR, ..... |
from supybot.test import *
try:
import sqlite
except ImportError:
sqlite = None
if sqlite:
class LookupTestCase(PluginTestCase):
plugins = ('Lookup',)
d = {
'foo': 'bar',
'bar': 'baz',
'your mom': 'my mom',
'foo\\:bar': 'baz',
}
... |
# -*- coding: utf-8 -*-
"""Parser for PL/SQL Developer Recall files."""
from dfdatetime import delphi_date_time as dfdatetime_delphi_date_time
from plaso.containers import events
from plaso.containers import time_events
from plaso.lib import errors
from plaso.lib import definitions
from plaso.parsers import dtfabric_... |
"""Utilities for forming search expressions based on field classes."""
# Copyright (c) 2001-2009 ElevenCraft Inc.
# See LICENSE for details.
import sys
from schevo.lib import optimize
from operator import and_, eq, or_
from schevo.base import Field
class Expression(object):
def __init__(self, left, op, right... |
"""
consistency_check support for Gmail-over-IMAP
"""
# setup.py boilerplate for this plugin:
#
# entry_points={
# 'inbox.consistency_check_plugins': [
# 'imap_gm = inbox.util.consistency_check.imap_gm:ImapGmailPlugin',
# ],
# },
from __future__ import absolute_import, division, print_function
import... |
#! /usr/bin/env python3
import teacher as teacher
import dfa_parser as DFAParser
class CharacteristicSetTeacher(teacher.Teacher):
def __init__(self, dfa):
teacher.Teacher.__init__(self, dfa)
self.char_set = self.construct_char_set()
self.pos_example = self.char_set[0]
se... |
#!/usr/bin/env python
#
# Copy a set of PNG images from one directory to another.
#
import re
import os
import sys
import shutil
# Python Cookbook 4.16
def splitall(path):
allparts = []
while 1:
parts = os.path.split(path)
if parts[0] == path: # sentinel for absolute paths
allparts... |
"""
Monkey patch for the MAAS region server, with code for region server patching.
"""
from collections import OrderedDict
import inspect
from twisted.web import http
import yaml
from provisioningserver.monkey import add_patches_to_twisted
class DeferredValueAccessError(AttributeError):
"""Raised when a defer... |
"""
Problem 14
The following iterative sequence is defined for the set of positive integers:
n → n/2 (n is even)
n → 3n + 1 (n is odd)
Using the rule above and starting with 13, we generate the following sequence:
13 → 40 → 20 → 10 → 5 → 16 → 8 → 4 → 2 → 1
It can be seen that this sequence (starting at 13 and finis... |
"""
objects.py
--------------
Deal with objects which hold visual properties, like
ColorVisuals and TextureVisuals.
"""
import numpy as np
from .material import from_color, pack
from .texture import TextureVisuals
from .color import ColorVisuals
def create_visual(**kwargs):
"""
Create Visuals object from ke... |
# alloc library for outputting ascii or csv tables
import sys
import re
import csv
import subprocess
from prettytable import PrettyTable
from sys import stdout
# Some changes to the PrettyTable API between 0.5 and 0.6, fix it up as required
# https://code.google.com/p/prettytable/issues/detail?id=21
# This can go if/... |
import logging
import struct
import obnamlib
metadata_format = struct.Struct('!Q' + # flags
'Q' + # st_mode
'qQ' + # st_mtime_sec and _nsec
'qQ' + # st_atime_sec and _nsec
'Q' + # st... |
from telemetry.page import page as page_module
from telemetry.page import page_set as page_set_module
class SkiaBuildbotDesktopPage(page_module.Page):
def __init__(self, url, page_set):
super(SkiaBuildbotDesktopPage, self).__init__(
url=url,
page_set=page_set,
credentials_path='data/cre... |
# hex
<warning descr="Python version 2.6, 2.7, 3.4, 3.5 do not support underscores in numeric literals">0xCAFE_F00D</warning>
# oct
<warning descr="Python version 2.6, 2.7, 3.4, 3.5 do not support underscores in numeric literals">0o1_23</warning>
<error descr="Python version 3.6 does not support this syntax. It requir... |
import logging
from civis import APIClient
from civis._utils import maybe_get_random_name
from civis.futures import CivisFuture
from civis._deprecation import deprecate_param
log = logging.getLogger(__name__)
@deprecate_param('v2.0.0', 'api_key')
def query_civis(sql, database, api_key=None, client=None, credential_... |
import types
from xen.xend import sxp
from xen.xend.XendError import VmError
from xen.xend.XendLogging import log
from xen.xend.xenstore.xstransact import xstransact
from xen.xend.server.DevController import DevController
import xen.lowlevel.xc
from xen.util.pci import PciDevice
import resource
xc = xen.lowlevel.... |
from virtinst import util
from virtManager.libvirtobject import vmmLibvirtObject
class vmmStorageVolume(vmmLibvirtObject):
def __init__(self, conn, backend, key):
vmmLibvirtObject.__init__(self, conn, backend, key)
self._name = key
# Required class methods
def get_name(self):
re... |
#!/usr/bin/env python3
"""
Converts the btab output of AAT (nap/gap2) to GFF3 format with option-dependent modeling.
Example input:
jcf7180000787896 Aug 28 2013 16242 /usr/local/packages/aat/nap /usr/local/projects/mucormycosis/protein_alignments/fungi_jgi/fungi_jgi.faa jgi|Rhior3|10928|RO3G_0120... |
from .module import Module
class Unknown(Module):
possible_events = {'changed', 'pressed', 'released'}
# control modes
_PLAY = 0
_PAUSE = 1
_STOP = 2
_REC = 4
def __init__(self, id, alias, device):
Module.__init__(self, 'Unknown', id, alias, device)
self._control = 0
... |
# -*- coding: utf-8 -*-
"""
WiiPad, a simple user-space driver for Wii/WiiU controllers
Copyright (C) 2014 Arturo Casal
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 2
of the Licens... |
from __future__ import print_function
from os import environ
from twisted.internet.defer import inlineCallbacks
from autobahn.wamp.types import PublishOptions
from autobahn.twisted.util import sleep
from autobahn.twisted.wamp import ApplicationSession, ApplicationRunner
class Component(ApplicationSession):
"""
... |
import uuid
from oslo.config import cfg
import webob
from cinder.api import extensions
from cinder.api.v2 import snapshot_metadata
from cinder.api.v2 import snapshots
import cinder.db
from cinder import exception
from cinder.openstack.common import jsonutils
from cinder import test
from cinder.tests.api import fakes
... |
from JumpScale import j
#this is a test to see how actions can be nested and only the one with the error should be shown
class testactions():
def action_error():
print ("ACTIONERROR")
raise j.exceptions.RuntimeError("ERROR")
def action_3():
nr=3
print ("ACTION%s"%nr)
... |
import sys
import os
if sys.version < '3':
from .btcommon import *
else:
from bluetooth.btcommon import *
__version__ = 0.19
def _dbg(*args):
return
sys.stderr.write(*args)
sys.stderr.write("\n")
if sys.platform == "win32":
_dbg("trying widcomm")
have_widcomm = False
dll = "wbtapi.dll... |
import networkx as nx
import random
import copy
"""
Total-Induced Edge Sampling (TIES): http://docs.lib.purdue.edu/cgi/viewcontent.cgi?article=2743&context=cstech
"""
class TIES:
def sample(self, input_graph, fraction):
edge_based_node_graph = self.edge_based_node_step(input_graph, fraction)
sampl... |
# -*- coding: utf-8 -*-
"""
This is part of WebScout software
Docs EN: http://hack4sec.pro/wiki/index.php/WebScout_en
Docs RU: http://hack4sec.pro/wiki/index.php/WebScout
License: MIT
Copyright (c) Anton Kuzmin <http://anton-kuzmin.ru> (ru) <http://anton-kuzmin.pro> (en)
Common module class form Dafs* modules
"""
impo... |
"""Support for BerkeleyDB 3.2 through 4.2.
"""
try:
if __name__ == 'bsddb3':
# import _pybsddb binary as it should be the more recent version from
# a standalone pybsddb addon package than the version included with
# python as bsddb._bsddb.
import _pybsddb
_bsddb = _pybsddb
... |
#! /usr/bin/env python
# $Header$
'''Simple CGI dispatching.
'''
from ZSI import *
from ZSI import _copyright
import base64, os
_b64_decode = base64.decodestring
# Typecode to parse a ZSI BasicAuth header.
_auth_tc = TC.Struct(None,
[ TC.String('Name'), TC.String('Password') ],
... |
import sys
import random
import string
def main():
print "# this test is generated by change_column_blob_data.py"
print "# generate hot blob expansion test cases"
print "source include/have_tokudb.inc;"
print "--disable_warnings"
print "DROP TABLE IF EXISTS t, ti;"
print "--enable_warnings"
... |
# -*- coding: utf-8 -*-
from django.conf.urls.defaults import *
from django.conf import settings
from tagging.views import tagged_object_list
from transifex.projects.feeds import LatestProjects, ProjectFeed, ProjectTimelineFeed
from transifex.projects.models import Project
from transifex.projects.views import *
from t... |
'''
This file is part of Pymads.
Pymads is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Pymads is distributed in the hope that it wi... |
from __future__ import (absolute_import, division, print_function,
unicode_literals)
import functools
import nixio.util.find as finders
from nixio.util.proxy_list import ProxyList
from nixio.value import Value
from nixio.file import SectionProxyList
from operator import attrgetter
try:
... |
import re
from .base import Filterer
class Pattern(Filterer):
'''Filter logs using pattern matching.'''
INCLUDE, EXCLUDE = ('include', 'exclude')
def __init__(self, pattern, key='name', mode=INCLUDE):
'''Initialise filterer with *pattern* and *key* to test.
If *pattern* is a string it ... |
# 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 'Fax.device'
db.add_column('fax_fax', 'device', self.gf('django.db.models.fields.CharField'... |
from __future__ import unicode_literals
import frappe
from frappe import _
from frappe.utils import flt, nowdate, add_days
from frappe.model.mapper import get_mapped_doc
from erpnext.controllers.buying_controller import BuyingController
from erpnext.buying.utils import validate_for_items
form_grid_templates = {
"ite... |
# Ripped from Django1.5
import sys
from django.core.exceptions import ImproperlyConfigured
from django.utils.importlib import import_module
import six
def import_by_path(dotted_path, error_prefix=''):
"""
Import a dotted module path and return the attribute/class designated by the
last name in the path. ... |
from selenium.webdriver.firefox.webdriver import WebDriver
class Application:
def __init__(self):
self.wd = WebDriver()
self.wd.implicitly_wait(60)
def open_home_page(self):
wd = self.wd
wd.get("http://127.0.0.1:8080/addressbook/")
def login(self, username, pass... |
# -*- coding: utf-8 -*-
# * Authors:
# * TJEBBES Gaston <<EMAIL>>
# * Arezki Feth <<EMAIL>>;
# * Miotte Julien <<EMAIL>>;
import os
from autonomie.forms.admin import get_config_schema
from autonomie.views.admin.tools import (
get_model_admin_view,
BaseConfigView,
BaseAdminIndexView,
)
from... |
import json
from openstackclient.identity.v3 import credential
from openstackclient.tests.identity.v3 import fakes as identity_fakes
from openstackclient.tests import utils
class TestCredential(identity_fakes.TestIdentityv3):
data = {
"access": "abc123",
"secret": "hidden-message",
"trust... |
from testsuite.support import TestCase
from utile import enforce, enforce_false, EnforcementError, enforce_clean_exit
@enforce_clean_exit
def demo_clean_exit(x):
enforce(x < 0, 'x must be negative')
class EnforceTestCase(TestCase):
def setUp(self):
self.x = 10
def test_enforce(self):
en... |
"""Tests for libvirt inspector.
"""
import contextlib
import fixtures
import mock
from ceilometer.compute.virt import inspector as virt_inspector
from ceilometer.compute.virt.libvirt import inspector as libvirt_inspector
from ceilometer.openstack.common import test
class TestLibvirtInspection(test.BaseTestCase):
... |
__authors__ = [
'"Leo (Chong Liu)" <<EMAIL>>',
]
import httplib
from django.core import urlresolvers
from django.http import HttpRequest
from django.utils import simplejson
from google.appengine.api import users
from soc.logic.models.sponsor import logic as sponsor_logic
from soc.logic.models.user import logic... |
from rspecs.parser_base import ParserBase
from rspecs.crm.manifest_parser import CRMv3ManifestParser
from rspecs.openflow.manifest_parser import OFv3ManifestParser
from rspecs.serm.manifest_parser import SERMv3ManifestParser
from rspecs.tnrm.manifest_parser import TNRMv3ManifestParser
import core
logger = core.log.get... |
import sherpa.utils.integration as integration
from sherpa.utils import SherpaTestCase
class test_integration(SherpaTestCase):
def test_c_api(self):
self.assert_(hasattr(integration, '_C_API'))
self.assertEqual(type(integration._C_API).__name__, 'PyCObject') |
import sys
from os import listdir
from os.path import isfile, join
from nltk.tokenize import sent_tokenize
import nltk
import xml.etree.ElementTree as ET
import csv
from sklearn.feature_extraction.text import TfidfVectorizer
from itertools import islice
import numpy as np
from scipy.sparse import csc_matrix
#from PageR... |
# -*- coding: utf-8 -*-
import sys
import os
import pytest
import re
from tests import constants
import audioclipextractor.scripts.main as main
sys.path.insert(0, constants.ROOT_DIR)
FFMPEG = 'ffmpeg.exe' if sys.platform == 'win32' else 'ffmpeg'
def test_version_argument():
assert re.search(r'\d+\.\d+\.\d+\w*',... |
"""Dynamic loss scaler for AMP."""
import logging
from ...ndarray import multi_all_finite
from ...ndarray import ndarray as nd
from ... import autograd as ag
class LossScaler(object):
"""Dynamic loss scaler for AMP.
Properties
----------
loss_scale : float
The current loss scale
"""
d... |
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
from pwn import *
context(arch='amd64', os='linux', aslr=False, terminal=['tmux', 'neww'])
env = {'LD_PRELOAD': './libc.so.6'}
if args['GDB']:
io = gdb.debug(
'./artifact-amd64-2.24-9ubuntu2.2',
env=env,
gdbscript='''\
set follow-fork-... |
# base either object
class Either(object):
def __init__(self, name):
self.name = name
# represents a failure with a message
class Left(Either):
def __init__(self, val):
super(Left, self).__init__('Left')
self.val = val
def __str__(self):
return 'Left: %s' % str(self.val)
#... |
import werkzeug
from collections import defaultdict
from typing import List, Union, Dict, Any
class RequestArgsProxy:
"""
A wrapper class allowing an access to both
Werkzeug's request.form and request.args (MultiDict objects).
It is also possible to force arguments manually in which
case anything ... |
import requests
import sys
import json
import cherrypy
lib_path = '..'
sys.path.append(lib_path)
import slacker_config
# This is a micro-service intended to receive new details/credentials from a user
# and send them off to the user directory for storage.
class SignUpService(object):
exposed = True # expose al... |
import logging
from django.core.urlresolvers import reverse
from django.template import defaultfilters as filters
from django.utils.translation import pgettext_lazy
from django.utils.translation import ugettext_lazy as _
from django.utils.translation import ungettext_lazy
from neutronclient.common import exceptions as... |
from congress.api import api_utils
from congress.tests import base
class TestAPIUtils(base.TestCase):
def setUp(self):
super(TestAPIUtils, self).setUp()
def test_create_table_dict(self):
table_name = 'fake_table'
schema = {'fake_table': ('id', 'name')}
expected = {'table_id':... |
"""
distribution.py
Author: Ryan Kynor
Credit:
Assignment:
Write and submit a Python program (distribution.py) that computes and displays
the distribution of characters in a given sample of text.
Output of your program should look like this:
Please enter a string of text (the bigger the better): The rain in Spain... |
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
'''Deprecation utilities'''
import inspect
import warnings
class Deprecated(object):
'''A dummy class to catch usage of deprecated variable names'''
def __repr__(self):
return '<DEPRECATED parameter>'
def rename_kw(old_name, old_value, new_name, new_v... |
#Scrape food websites for ingredients
#look into hrecipe
#http://microformats.org/wiki/hrecipe
import IPython
from urllib.request import urlopen as uReq
from urllib.request import Request
from bs4 import BeautifulSoup as soup
import keys
import urllib
import json
import sys
def search(recipe):
if recipe == '' or re... |
import logging
import unittest
from unittest import mock
import pyborg.pyborg
from pyborg.mod.mod_http import DumbyIOMod
try:
import nltk
except ImportError:
nltk = None
logger = logging.getLogger(__name__)
# logging.basicConfig(level=logging.DEBUG)
class TestPyborgInit(unittest.TestCase):
"Test all t... |
# coding: utf-8
from PyQt4.QtGui import QDialog
from qgis.core import QgsVectorLayerCache
from qgis.gui import (QgsAttributeTableFilterModel, QgsAttributeTableModel,
QgsFeatureListModel, QgsFeatureListView,
QgsFeatureListViewDelegate)
from qgis.utils import iface
new_dialog... |
"""Tests for srcds.events.csgo"""
from srcds.events import csgo
from .test_generic import check_event
def test_switch_team_event():
"""Test SwitchTeamEvent"""
log_line = ''.join([
'L 01/21/2013 - 23:07:24: "Charmander<19><STEAM_1:1:11218680>" ',
'switched from team <Unassigned> to <CT>',
... |
import functools
import os
import re
from t_output import DummyOutput
from t_output import CompositeOutput
from t_output_aggregator import create_scope_factory
from t_output_aggregator import OutputContext
from t_output_aggregator import Primitive
from t_output_aggregator import PrimitiveFactory
from t_output_aggregat... |
#!/usr/bin/env python
import argparse
#import argcomplete
from quickly import quickly
def main(args, q):
if args.add:
q.add(args.add[0], args.add[1])
elif args.edit:
q.edit(args.edit[0], args.edit[1])
elif args.remove:
q.remove(args.remove)
elif args.list:
ls = q.list... |
__author__ = 'Tom Schaul, <EMAIL>'
from pybrain.rl.environments.twoplayergames.gomoku import GomokuGame
class PenteGame(GomokuGame):
""" The game of Pente.
The rules are similar to Go-Moku, except that it is now possible to capture
stones, in pairs, by putting stones at both ends of a pair of the oppone... |
from splunk_eventgen.lib.logging_config import logger
from splunk_eventgen.lib.outputplugin import OutputPlugin
class TcpOutputPlugin(OutputPlugin):
useOutputQueue = False
name = "tcpout"
MAXQUEUELENGTH = 10
def __init__(self, sample, output_counter=None):
OutputPlugin.__init__(self, sample, ... |
"""Downsample strategies.
Contains all of the downsample strategies. Use downsample(), and
secondary_downsample() for downsampling records stored in files.
"""
from math import ceil
FLOAT_PRECISION = 4
SECOND_TO_MICROSECOND = 1E6
STRATEGIES = ['max', 'min', 'avg']
def _max_min_downsample(records, is_max, downsamp... |
#!/usr/bin/env python
# coding: utf-8
"""
Copyright 2015 SYSTRAN Software, 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/licen... |
import sys, logging
log = logging.getLogger('log_parser')
if __name__ == '__main__':
sys.path.append('..')
import re, datetime, string
import db_interface
TABLENAME = "raw_web"
MAXLINESIZE = 1024
MONTHS = {'Jan': 1,
'Feb': 2,
'Mar': 3,
'Apr': 4,
'May': 5,
'Jun': 6,
... |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'search_results_dialog.ui'
#
# Created by: PyQt5 UI code generator 5.9
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_SearchResultsDialog(object):
def setupUi(self, SearchRes... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from udata.api import api, fields, API
from udata.auth import admin_permission
from udata.core.dataset.api_fields import dataset_ref_fields
from udata.core.reuse.api_fields import reuse_ref_fields
from udata.core.user.api_fields import user_ref_fields
f... |
import txkazoo
from twisted.trial.unittest import SynchronousTestCase
class VersionTests(SynchronousTestCase):
"""Tests for programmatically acquiring the version of txkazoo."""
def test_both_names(self):
"""The version is programmatically avaialble on the ``txkazoo`` module
as ``__version_... |
#!/usr/bin/env python3
r"""
Load events from BEAM phsp file
"""
import math
import struct
SHORT = 0
LONG = 1
def read_header(phsf):
"""
Read and return PhSF header
:param phsf: open phase space file
:type phsf: file
:returns: header info
:rtype: tuple
"""
mode = phsf.read(5) # sha... |
from flask.ext.security import RoleMixin, UserMixin
from ..core import db
roles_users = db.Table(
'roles_users',
db.Column('role_id', db.Integer, db.ForeignKey('role.id')),
db.Column('user_id', db.Integer, db.ForeignKey('user.id')),
)
class Role(db.Model, RoleMixin):
id = db.Column(db.Integer, primary... |
from __future__ import absolute_import, print_function
from functools import partial
import os
import conda_kapsel
from conda_kapsel.commands.main import _parse_args_and_run_subcommand
all_subcommands = ('init', 'run', 'prepare', 'clean', 'activate', 'archive', 'unarchive', 'upload', 'add-variable',
... |
from urlparse import urlparse, urlunparse
import re
from bs4 import BeautifulSoup
import requests
from .base import BaseCrawler
from ...models import Entity, Author, AuthorType
class TimesLiveCrawler(BaseCrawler):
TL_RE = re.compile('(www\.)?timeslive.co.za')
def offer(self, url):
""" Can this crawl... |
from odoo import models, fields, api
class Project(models.Model):
_inherit = "project.project"
subtask_project_id = fields.Many2one(
'project.project', string='Sub-task Project', ondelete="restrict",
help="Choosing a sub-tasks project will both enable sub-tasks and set their default project (... |
from mantid.simpleapi import *
from mantid.kernel import *
from mantid.api import *
from scipy.io import netcdf
import numpy as np
import re
import time
class VelocityCrossCorrelations(PythonAlgorithm):
def category(self):
return "Simulation"
def summary(self):
return ("Imports trajectory d... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
from django.conf import settings
class Migration(migrations.Migration):
dependencies = [
('core', '0031_performanceindicator'),
]
operations = [
migrations.CreateModel(
n... |
""" Example of a PCI alias::
| [pci]
| alias = '{
| "name": "QuickAssist",
| "product_id": "0443",
| "vendor_id": "8086",
| "device_type": "type-PCI",
| "numa_policy": "legacy"
| }'
Aliases with the same name, device_type and numa_policy ... |
from functools import reduce, partial
import inspect
import operator
__all__ = ('identity', 'thread_first', 'thread_last', 'memoize', 'compose',
'pipe', 'complement', 'juxt', 'do', 'curry')
def identity(x):
return x
def thread_first(val, *forms):
""" Thread value through a sequence of functions... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.