code stringlengths 1 199k |
|---|
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "tcb.settings.local")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv) |
from __future__ import unicode_literals
from functools import partial
from cms.menu_bases import CMSAttachMenu
from menus.base import Menu, NavigationNode
from menus.menu_pool import menu_pool
from django.core.urlresolvers import reverse
from django.utils.translation import ugettext_lazy as _
from xue.materials.models ... |
from __future__ import absolute_import
import collections
import json
import logging
import multiprocessing
import os
import select
import subprocess
import sys
import zipfile
from six.moves import range # pylint: disable=redefined-builtin
from pylib import constants
from pylib.base import base_test_result
from pylib.... |
import json
import logging
from datetime import date, datetime, timedelta
from itertools import chain as ichain
from itertools import dropwhile, takewhile
from urllib.parse import urljoin
from uuid import UUID
import phonenumbers
import pytz
import requests
from celery.exceptions import SoftTimeLimitExceeded
from djang... |
from grasp_data_generator.models.occluded_grasp_mask_rcnn.occluded_grasp_mask_rcnn import OccludedGraspMaskRCNN # NOQA
from grasp_data_generator.models.occluded_grasp_mask_rcnn.occluded_grasp_mask_rcnn_resnet import OccludedGraspMaskRCNNResNet101 # NOQA
from grasp_data_generator.models.occluded_grasp_mask_rcnn.occlud... |
from django.contrib import admin
from django.conf import settings
from django.conf.urls.defaults import patterns, url
from django.db import transaction
from django.http import Http404, HttpResponseRedirect
from django.core.exceptions import PermissionDenied
from django.forms.models import modelform_factory
from django.... |
"""Unit tests for gsutil seek_ahead_thread."""
from __future__ import absolute_import
from __future__ import print_function
from __future__ import division
from __future__ import unicode_literals
import threading
import six
from six.moves import queue as Queue
from six.moves import range
from gslib.name_expansion impor... |
import logging
from django.conf import settings
from django.core.management import call_command
from django.template.defaultfilters import slugify
from django.contrib.auth.models import User
from nose.tools import assert_equal, with_setup, assert_false, eq_, ok_
from nose.plugins.attrib import attr
from . import Badger... |
from django.db import models
from django.utils.translation import ugettext_lazy as _
from pyconde.conference.models import Conference, CurrentConferenceManager
class Event(models.Model):
conference = models.ForeignKey(Conference, verbose_name=_("Conference"))
title = models.CharField(_("Title"), max_length=255)... |
import numpy as np
class BabiConfig(object):
"""
Configuration for bAbI
"""
def __init__(self, train_story, train_questions, dictionary):
self.dictionary = dictionary
self.batch_size = 32
self.nhops = 3
self.nepochs = 100
self.lrate... |
formatter = {'open_date': {'formatter':'date','sortable':True},
'price': {'formatter':'number','sortable':True},
'mktprice': {'formatter':'number','sortable':True},
'value': {'formatter':'currency','sortable':True},
'size': {'formatter':'currency','... |
from django.conf import settings
from django.conf.urls.defaults import patterns, include, url
from django.contrib.staticfiles.urls import staticfiles_urlpatterns
from BanHammer.blacklist.views import blacklist as views_blacklist
from BanHammer.blacklist.views import offender as views_offender
from BanHammer.blacklist.v... |
from __future__ import print_function
import pytest
from copy import deepcopy
import sys
from distutils.version import LooseVersion
from pandas.compat import range, lrange, long
from pandas import compat
from numpy.random import randn
import numpy as np
from pandas import DataFrame, Series, date_range, timedelta_range
... |
from django.conf.urls import include, url
from . import views
urlpatterns = (
url(
'^create-datastore-backup$',
views.create_datastore_backup,
name="create_datastore_backup"
),
) |
"""
EngineData structure.
PSD file embeds text formatting data in its own markup language referred
EngineData. The format looks like the following::
<<
/EngineDict
<<
/Editor
<<
/Text (˛ˇMake a change and save.)
>>
>>
/Font
<<
/Name (˛ˇHelvetic... |
"""
Make statistics on score files (stored in JSON files).
"""
import common_functions as common
import argparse
import matplotlib.pyplot as plt
import numpy as np
if __name__ == '__main__':
# PARSE OPTIONS ###########################################################
parser = argparse.ArgumentParser(description=... |
from rtruffle.source_section import SourceSection
from som.compiler.method_generation_context import MethodGenerationContextBase
from som.interpreter.ast.nodes.field_node import create_write_node, create_read_node
from som.interpreter.ast.nodes.global_read_node import create_global_node
from som.interpreter.ast.nodes.r... |
"""Test the importprunedfunds and removeprunedfunds RPCs."""
from test_framework.test_framework import BitcoinTestFramework
from test_framework.util import *
class ImportPrunedFundsTest(BitcoinTestFramework):
def set_test_params(self):
self.setup_clean_chain = True
self.num_nodes = 2
def run_tes... |
# $Id$
"""
A finite state machine specialized for regular-expression-based text filters,
this module defines the following classes:
- `StateMachine`, a state machine
- `State`, a state superclass
- `StateMachineWS`, a whitespace-sensitive version of `StateMachine`
- `StateWS`, a state superclass for use with `StateMac... |
'''
Measure the crosstalk between DAC0 and DAC1
'''
import numpy as np
import os
import time
import matplotlib.pyplot as plt
from fft import FFT
from koheron import connect
try: input = raw_input
except NameError: pass
host = os.getenv('HOST', '192.168.1.16')
client = connect(host, 'fft', restart=False)
driver = FFT(cl... |
from __future__ import unicode_literals
from warnings import warn
from flask_multipass import MultipassException
from werkzeug.utils import cached_property
from indico.core.auth import multipass
from indico.core.db import db
from indico.core.db.sqlalchemy.principals import PrincipalType
from indico.legacy.common.cache ... |
from django.test import TestCase
from django.test.utils import override_settings
from money import Money
from mock import patch
from ..models import MangoPayTransfer
from ..tasks import create_mangopay_transfer, _create_mangopay_transfer
from .factories import MangoPayTransferFactory, MangoPayWalletFactory
from .client... |
import unittest
from aviation_weather import Wind
from aviation_weather.exceptions import WindDecodeError
class TestWind(unittest.TestCase):
"""Unit tests for aviation_weather.components.wind.Wind"""
def _test_valid(self, raw, direction, speed, gusts, variable):
w = Wind(raw)
self.assertEqual(ra... |
CARRIERS = {
'AT&T': "%s@txt.att.net",
'Boost Mobile': "%s@sms.myboostmobile.com",
'Cricket Wireless': "%s@mms.cricketwireless.net",
'Sprint': "%s@messaging.sprintpcs.com",
'Tracfone': "%s@mmst5.tracfone.com",
'T-Mobile': "%s@tmomail.net",
'US Cellular': "%s@email.uscc.net",
'Verizon': "%s@vtext.com",
'Virgin ... |
from flask import abort, Flask, json, redirect, \
render_template, request, Response, url_for, session
from flask_sqlalchemy import SQLAlchemy
from werkzeug.utils import secure_filename
from errors import *
from apiclient import discovery
from oauth2client import client
from time import gmtime, strf... |
from PIL import Image, ImageFile, PngImagePlugin
from PIL._binary import i8
import io
import os
import shutil
import struct
import sys
import tempfile
enable_jpeg2k = hasattr(Image.core, 'jp2klib_version')
if enable_jpeg2k:
from PIL import Jpeg2KImagePlugin
HEADERSIZE = 8
def nextheader(fobj):
return struct.unp... |
import random
from axelrod import Actions, Player, init_args
C, D = Actions.C, Actions.D
class OnceBitten(Player):
"""
Cooperates once when the opponent defects, but if they defect twice in a row defaults to forgetful grudger for 10 turns defecting
"""
name = 'Once Bitten'
classifier = {
'me... |
"""Bioinformatics tools developed at the Max Planck Institute for Biology of Ageing"""
from .bed import *
from .biom import *
from .david import *
from .fasta import *
from .go import *
from .gtf import *
from .homology import *
from .kegg import *
from .meme import *
from .plots import *
from .rbiom import *
from .sam... |
from datetime import date
from . import GenericCalendarTest
from ..oceania import (
Australia,
AustralianCapitalTerritory,
NewSouthWales,
NorthernTerritory,
Queensland,
SouthAustralia,
Tasmania,
Hobart,
Victoria,
WesternAustralia,
MarshallIslands,
NewZealand
)
class Austr... |
import requests
import json
import re
import math
import time
import datetime
import random
import hashlib
import codecs
from Phone import *
from HaRunGo import *
class Point:
lat = 0
lng = 0
def __init__(self, x, y):
self.lat = x
self.lng = y
def __str__(self):
return "x: " + st... |
import pyopencl as cl
import pyopencl.array as clarray
import numpy as np
def divUp(x, by):
return ((x + by - 1)//by)
def divUpSafe(x, bpy):
k = x // bpy
if k * bpy != x:
k = k + 1
return k
def logDown(x, base):
power = 1
xbak = x
x /= base
i = 0
while x > 0:
power *=... |
import sys
import asyncio
import tokage
import sys
list_of_ids = sys.argv[1:]
async def find_chars(all_ids):
tok = tokage.Client()
for id in all_ids:
character = await tok.get_character(id)
if character.name:
print(character.name + ' | ' + str(character.favorites) + '\n')
loop = asyn... |
from swgpy.object import *
def create(kernel):
result = Tangible()
result.template = "object/tangible/item/quest/force_sensitive/shared_fs_sculpture_3.iff"
result.attribute_template_id = -1
result.stfName("item_n","fs_sculpture_3")
#### BEGIN MODIFICATIONS ####
#### END MODIFICATIONS ####
return result |
from plotly.basedatatypes import BaseLayoutHierarchyType as _BaseLayoutHierarchyType
import copy as _copy
class Button(_BaseLayoutHierarchyType):
# class properties
# --------------------
_parent_path_str = "layout.updatemenu"
_path_str = "layout.updatemenu.button"
_valid_props = {
"args",
... |
import requests
import json
import sys
import re
import os
import getpass
import datetime
import ast
from requests import Session
from robobrowser import RoboBrowser
from bs4 import BeautifulSoup
from re import findall
global data
def check_friends(uid_one, uid_two):
"""
uid_one: int
uid_two: int
"""
... |
"""
pygments.formatters.html
~~~~~~~~~~~~~~~~~~~~~~~~
Formatter for HTML output.
:copyright: Copyright 2006-2020 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
import functools
import os
import sys
import os.path
from io import StringIO
from pygments.formatter import ... |
from django.core.urlresolvers import reverse
from django.test import TestCase
import json
from voter.models import VoterManager
from future.standard_library import install_aliases
install_aliases()
class WeVoteAPIsV1TestsVoterCount(TestCase):
def setUp(self):
# self.voter_count_url = "http://localhost:8000%... |
class Tmeta(type):
def __init__(self, *args, **kwargs):
print 'yeal'
print self.name
super(Tmeta, self).__init__(*args, **kwargs)
class T(object):
__metaclass__ = Tmeta
name = 'h'
def __init__(self, n):
print '%s is me' % n
T('a') |
from __future__ import unicode_literals
from ..fr_FR import Provider as CompanyProvider
class Provider(CompanyProvider):
company_suffixes = ('SA', 'Sàrl.')
def ide(self):
"""
Generates a IDE number (9 digits).
http://www.bfs.admin.ch/bfs/portal/fr/index/themen/00/05/blank/03/02.html
... |
from settings import INSTALLED_APPS, MIDDLEWARE_CLASSES, LOGGING
DEBUG = True
SITE_ID = 3 #Site 3 is localhost
EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'
AUTHENTICATION_BACKENDS = ('django.contrib.auth.backends.ModelBackend',)
TASTYPIE_FULL_DEBUG = DEBUG
DATABASES = {
'default': {
'ENG... |
"""
doc_inherit decorator
Usage:
class Foo(object):
def foo(self):
"Frobber"
pass
class Bar(Foo):
@doc_inherit
def foo(self):
pass
Now, Bar.foo.__doc__ == Bar().foo.__doc__ == Foo.foo.__doc__ == "Frobber"
"""
from functools import wraps
class DocInherit(object):
"""
Docstring... |
from django.utils.text import slugify
from faker import Factory
from homes_for_sale.models import Sale
from homes.factories.property_tenure_factory import PropertyTenureFactory
from homes.factories.property_type_factory import PropertyTypeFactory
from homes.factories.point_factory import FuzzyPoint
from homes.factories... |
import webnotes
import webnotes.model
from webnotes.model.doc import Document
from webnotes import _
class DocList(list):
"""DocList object as a wrapper around a list"""
def get(self, filters, limit=0):
"""pass filters as:
{"key": "val", "key": ["!=", "val"],
"key": ["in", "val"], "key": ["not in", "val"], "k... |
from foreman.subItem import SubItem
class SubItemConfigTemplate(SubItem):
"""
ItemOverrideValues class
Represent the content of a foreman smart class parameter as a dict
"""
objName = 'config_templates'
objNameSet = 'config_templates'
payloadObj = 'config_template'
index = 'id'
setIn... |
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.support.ui import Select
from selenium.common.exceptions import NoSuchElementException
from selenium.common.exceptions import NoAlertPresentException
import unittest, time, ... |
from __future__ import division
__all__ = ['Binomial']
import numpy as np
import scipy.stats as stats
import scipy.special as special
from warnings import warn
from pybasicbayes.abstractions import GibbsSampling, MeanField, \
MeanFieldSVI
class Binomial(GibbsSampling, MeanField, MeanFieldSVI):
'''
Models a ... |
"""
energy.py
Compute energy and related quantities
Last updated: 15 December 2012
"""
import numpy
import scipy
from numpy.lib import stride_tricks
def energy(audioData, windowSize = 256):
"""
Compute the energy of the given audio data, using the given windowSize
Example:
>>> from test import chirp
... |
import threading
class BankAccount(object):
def __init__(self):
self.is_open = False
self.balance = 0
self.lock = threading.Lock()
def get_balance(self):
with self.lock:
if not self.is_open:
raise ValueError('account not open')
return self.... |
import logging
import json
from django.contrib.auth.models import User
from django.conf.urls import url
from django.shortcuts import get_object_or_404
from tastypie import fields
from tastypie.authorization import DjangoAuthorization
from tastypie.constants import ALL_WITH_RELATIONS, ALL
from tastypie.resources import ... |
import datetime
import numpy as np
from utide._time_conversion import _normalize_time
def test_formats():
forms = [
(np.array([693595.1]), "python"),
(np.array([693961.1]), "matlab"),
(np.array([2.1]), datetime.date(1899, 12, 29)),
(np.array([3.1]), datetime.datetime(1899, 12, 28)),
... |
import unittest
import numpy as np
import matplotlib.pyplot as plt
from explorers import Astronaut
class TestEnergyCostFunctions(unittest.TestCase):
def _generate_slopes(self):
slopes = np.radians(np.linspace(-25,25,101))
return slopes
def test_slope_energy_cost(self):
slopes_rad = self.... |
import responder
from ceryx.db import RedisClient
from ceryx.exceptions import NotFound
api = responder.API()
client = RedisClient.from_config()
@api.route(default=True)
def default(req, resp):
if not req.url.path.endswith("/"):
api.redirect(resp, f"{req.url.path}/")
@api.route("/api/routes/")
class RouteLi... |
import os
def run():
print "1. connect (USB?) serial cable to host"
print "2. launch terminal emulator software, and connect to dev card at 115200 baud 8n1"
os.system("sudo cutecom") |
"""Tests for post render hook."""
import unittest
from grow.extensions.hooks import dev_file_change_hook
class DevFileChangeHookTestCase(unittest.TestCase):
"""Test the dev file change hook."""
def test_something(self):
"""?"""
pass |
from rl.optimizer.base_optimizer import Optimizer
class SGDOptimizer(Optimizer):
'''
Stochastic gradient descent
Potential param:
lr (learning rate)
momentum
decay
nesterov
'''
def __init__(self, **kwargs):
from keras.optimizers import SGD
self.SGD = S... |
from tkinter import END, Tk
import pytest
from pyDEA.core.gui_modules.text_frame_gui import TextFrame
@pytest.fixture
def text_frame(request):
parent = Tk()
text_frame = TextFrame(parent)
request.addfinalizer(parent.destroy)
return text_frame
def test_clear_all_data(text_frame):
text_frame.text.inse... |
"""
The ``Parser`` tries to convert the available Python code in an easy to read
format, something like an abstract syntax tree. The classes who represent this
tree, are sitting in the :mod:`jedi.parser.representation` module.
The Python module ``tokenize`` is a very important part in the ``Parser``,
because it splits ... |
"""
Support for Vera devices.
For more details about this component, please refer to the documentation at
https://home-assistant.io/components/vera/
"""
import logging
from collections import defaultdict
import voluptuous as vol
from requests.exceptions import RequestException
from homeassistant.util.dt import utc_from... |
"""
helper functions.
"""
def format_num(num, unit='bytes'):
"""
Returns a human readable string of a byte-value.
If 'num' is bits, set unit='bits'.
"""
if unit == 'bytes':
extension = 'B'
else:
# if it's not bytes, it's bits
extension = 'Bit'
for dimension in (unit, ... |
from datetime import datetime
from django.db import models
from etherkeeper.core.models import Author
from etherkeeper.organize.models import Document
class Pad(models.Model):
"""
An etherpad-lite document
Instances are created with a padid id and a groupid
"""
document = models.ForeignKey(Document,... |
import json
import sys
import demjson
try:
from urllib.request import Request, urlopen
except ImportError: # python 2
from urllib2 import Request, urlopen
__author__ = 'Hongtao Cai'
googleFinanceKeyToFullName = {
u'id' : u'ID',
u't' : u'StockSymbol',
u'e' : u'Index',
u'l' : u... |
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 'ScoreSetting'
db.create_table(u'score_mgr_scoresetting', (
(u'id', self.... |
from headers.BeaEnginePython import *
from nose.tools import *
class TestSuite:
def test(self):
# 66 0F 38 3b /r
# pminud mm1, mm2/m64
Buffer = bytes.fromhex('660f383b9011223344')
myDisasm = Disasm(Buffer)
myDisasm.read()
assert_equal(hex(myDisasm.infos.Instruction.Op... |
import utilities.samplerstatus as samplerstatus
import ConfigParser
import logging
logger = logging.getLogger('actions.getStatus')
config = ConfigParser.RawConfigParser()
config.read("StarinetBeagleLogger.conf")
def control(buffer0, buffer1, buffer2): # buffer0 = reponse_command, buffer1 = response_status, buffer2 = r... |
from provisioning.provisioners_repository import ProvisionersRepository
import uuid
class Provisioners(object):
def __init__(self):
self.provisioners_repository = ProvisionersRepository()
def get_all_provisioners(self):
return self.provisioners_repository.get_all_provisioners()
def get_provi... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from six.moves import input
def confirm(msg):
"""
Display a message to the user and wait for confirmation.
Arguments:
msg (string) - message to display
Returns:
True if the user c... |
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 field 'MailLog.backend'
db.add_column('dbmail_maillog', 'backend',
se... |
import re
import os
import errno
import shlex, subprocess
import shutil
import pwd
def makedirs(path):
""" python implementation of `mkdir -p` """
try:
os.makedirs(path)
except OSError as exc: # Python >2.5
if exc.errno == errno.EEXIST and os.path.isdir(path):
pass
else:... |
import fauxfactory
import pytest
from cfme import test_requirements
from cfme.services.service_catalogs import ServiceCatalogs
from cfme.utils.appliance.implementations.ui import navigate_to
pytestmark = [
test_requirements.dialog,
pytest.mark.tier(2)
]
@pytest.fixture(scope="function")
def dropdown_dialog(appl... |
import liblightbase
from liblightbase import lbutils
from liblightbase.lbutils.conv import json2base
from liblightbase.lbutils.conv import document2json
from liblightbase.lbutils.conv import document2dict
from liblightbase.lbutils.conv import json2document
from liblightbase.lbutils.conv import dict2document
import unit... |
import zmq
import json
class Note_Client(object):
""" This is the client side library to interact with the note server """
def __init__(self):
"""
Initialize the client, mostly ZMQ setup
"""
self.server_addr = "127.0.0.1"
self.server_port = 5500 # FIXME - get from config... |
'''
Genesis Add-on
Copyright (C) 2015 lambda
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This pr... |
from __future__ import absolute_import
from __future__ import division
import pytest
from vdsm.network import errors as ne
from vdsm.network.ip import validator
class TestIPNameserverValidator(object):
def test_ignore_remove_networks(self):
validator.validate(
{
'NET0': {
... |
import os, sys, math, re, collections, getopt, pprint, subprocess
import zsim_lib
import math
DRAM_POWER_STATIC = .102 + .009 # act_stby + ref
DRAM_POWER_READ = .388 + .271 + .019 # act + rd + dq
DRAM_POWER_WRITE = .388 + .238 + .019 + .180 # act + wr + dq + termW
DRAM_CLOCK = 266 # MHz
DRAM_POWER_STATIC_OFFCHIP_INTERF... |
import sys
import cPickle
import os
import numpy
import theano
import theano.tensor as T
def gauss_newton_product(cost, p, v, s): # this computes the product Gv = J'HJv (G is the Gauss-Newton matrix)
Jv = T.Rop(s, p, v)
HJv = T.grad(T.sum(T.grad(cost, s)*Jv), s, consider_constant=[Jv], disconnected_inputs='ignore'... |
"""This example demonstrates how to use VersionSpec"""
import paludis
versions = [paludis.VersionSpec(v) for v in "1.0 1.1 1.2 1.2-r1 2.0 2.0-try1 2.0-scm 9999".split()]
for v in versions:
print(str(v) + ":")
# Show the output of various members.
print(" Remove revision: %s" % v.remove_revisi... |
"""
Copyright (c) 2006-2014 sqlmap developers (http://sqlmap.org/)
See the file 'doc/COPYING' for copying permission
"""
import os
import random
import re
import subprocess
import string
import sys
import time
from lib.core.enums import DBMS
from lib.core.enums import DBMS_DIRECTORY_NAME
from lib.core.enums import OS
f... |
import re
from tqdm import tqdm
from pprint import pformat
try:
from math import comb # breaks in python<3.8
except ImportError:
from math import factorial as fac
def comb(n, k):
return fac(n) / (fac(k) * fac(n - k))
import os
import glob
import json
from itertools import chain, combinations
impor... |
import urllib2
import sys
def req(proxy_url, url):
proxy=urllib2.ProxyHandler({'https': proxy_url})
opener=urllib2.build_opener(proxy)
urllib2.install_opener(opener)
try:
urllib2.urlopen(url, timeout=3).read()
return True
except:
return False
if __name__=='__main__':
for ... |
from opus_core.variables.variable import Variable
from variable_functions import my_attribute_label
from numpy import ma
from numpy import float32
class percent_mid_income_households_within_walking_distance(Variable):
"""Percent of households within the walking radius that are designated as mid-income.
[100 * (... |
import urllib,re
from resources.lib.modules import client
domains = ['streamlive.to']
def resolve(url):
try:
test = 'http://www.streamlive.to'
html = client.request(test)
html=html.replace('\r','').replace('\n','').replace('\t','').replace(' ','').replace("\/",'/')
question = re... |
from gi.repository import Gtk, Gdk, GLib
import threading
from .op_queue import OperationType
class ScExtraItem(Gtk.ListBoxRow):
""" Utility class to encapsulate items for display in boxes """
__gtype_name__ = "ScExtraItem"
name = None
def __init__(self, context, item):
Gtk.ListBoxRow.__init__(s... |
import wx
from MenuResourcesHolder import MenuResourcesHolder
from toolib.util import lang
from toolib import debug
class ToolBar(wx.ToolBar, MenuResourcesHolder):
def __init__(self, parent, menuResources, config):
#rint "create TOOLBAR from config", config.get('text')
style = config.get('style', wx.TB_HORIZ... |
"""Various utility functions for use across the workflows module."""
import datetime
import socket
from six import text_type, string_types
from werkzeug import import_string
def get_task_history(last_task):
"""Append last task to task history."""
if hasattr(last_task, 'branch') and last_task.branch:
ret... |
_relation = [
"24 24 414 2",
" c #FFFFFF",
". c #FEFEFE",
"+ c #FEFFFF",
"@ c #FCFDFD",
"# c #FDFFFF",
"$ c #FDFDFD",
"% c #FDFEFD",
"& c #FEFFFE",
"* c #FCFBFD",
"= c #F5E7E6",
"- c #EC1B1B",
"; c #EB2F2F",
"> c #FAFEFE",
", c #FEFEFF",
"' c #FCFCFC",
") c #FFFFFC",
"! c #8046D5",
"~ c #651DD2",
"{ ... |
import inetutils
import socket
import struct
import string
import os
IPVERSION = 4
IP_DF = 0x4000
IP_MF = 0x2000
IP_MAXPACKET = 65535
IPTOS_LOWDELAY = 0x10
IPTOS_THROUGHPUT = 0x08
IPTOS_RELIABILITY = 0x04
IPTOS_PREC_NETCONTROL = 0xe0
IPTOS_PREC_INTERNETCONTROL = 0xc0
IPTOS_PREC_CRITIC_ECP = 0xa0
IPTOS_PREC_FLASHOVERRID... |
import os
import logging
from gettext import gettext as _
from gi.repository import GLib
from gi.repository import GObject
from gi.repository import Pango
from gi.repository import Gtk
from gi.repository import Gdk
from sugar3 import profile
from sugar3 import util
from sugar3.graphics import style
from sugar3.graphics... |
import sys, os
import yaml
from PyQt4 import QtCore, QtGui
from ui_translator import Ui_MainWindow
from ui_about import Ui_AboutDialog
from ui_new_project import Ui_NewProjectDialog
from ui_project_properties import Ui_ProjectPropertiesDialog
from ui_msg_form import Ui_MsgForm
from ui_closing_project import Ui_ClosingP... |
import json
import frappe
from frappe import _
from frappe.utils import get_url_to_list
def execute(filters=None):
columns = columns = get_columns()
data = get_data(filters)
return columns, data
def get_columns():
return [
{
"fieldname": "title",
"label": _("Title"),
"fieldtype": "Data",
"width": 300,... |
__author__ = 'rossetti'
__license__ = "GPL"
__email__ = "giulio.rossetti@gmail.com" |
from __future__ import print_function
import abc
class Process(object):
"""Base class for processes.
Attributes:
step_time: minimum time between processing steps in ms.
working: True if precssing is working. False if stopped.
"""
__metaclass__ = abc.ABCMeta
def __init__(self, step_ti... |
from . import Net
import logging
log = logging.getLogger(__name__)
class IPWhois:
"""
The wrapper class for performing whois/RDAP lookups and parsing for
IPv4 and IPv6 addresses.
Args:
address: An IPv4 or IPv6 address as a string, integer, IPv4Address, or
IPv6Address.
timeout... |
from sleekxmpp.plugins import BasePlugin
from sleekxmpp.stanza import StreamFeatures
from sleekxmpp.xmlstream import register_stanza_plugin
from sleekxmpp.xmlstream import ElementBase
class CompressionStanza(ElementBase):
name = 'compression'
namespace = 'http://jabber.org/features/compress'
interfaces = se... |
"""
Test the `ipalib/plugins/selfservice.py` module.
"""
from ipalib import api, errors
from ipatests.test_xmlrpc import objectclasses
from xmlrpc_test import Declarative, fuzzy_digits, fuzzy_uuid
selfservice1 = u'testself'
invalid_selfservice1 = u'bad+name'
class test_selfservice(Declarative):
cleanup_commands = [... |
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 'Network'
db.create_table('ganeti_network', (
('description', self.gf('django.db.models.fields.CharField')(m... |
import DistUtilsExtra.auto
from linaro_image_tools.__version__ import __version__
DistUtilsExtra.auto.setup(
name="linaro-image-tools",
version=__version__,
description="Tools to create and write Linaro images",
url="https://launchpad.net/linaro-image-tools",
license="GPL v3 or later",
author='L... |
from io import open
import re
import sys
from setuptools import setup, find_packages
def version():
with open('pypot/_version.py') as f:
return re.search(r"^__version__ = ['\"]([^'\"]*)['\"]", f.read()).group(1)
extra = {}
if sys.version_info >= (3,):
extra['use_2to3'] = True
install_requires = ['numpy'... |
"""
Atoms module.
@author Tomas Lazauskas, 2016
@web www.lazauskas.net
@email tomas.lazauskas[a]gmail.com
"""
import sys, os
def atomicNumber(sym):
global atomicNumberDict
try:
value = atomicNumberDict[sym]
except:
sys.exit(__name__+": ERROR: no atomic number for " + sym)
return value
de... |
import catmap
from catmap import ReactionModelWrapper
from catmap.model import ReactionModel
from catmap.functions import smooth_piecewise_linear
from catmap.functions import parse_constraint
from catmap.thermodynamics import FirstOrderInteractions
import pylab as plt
import numpy as np
from scipy import integrate
clas... |
import pytest_bdd as bdd
bdd.scenarios('zoom.feature')
@bdd.then(bdd.parsers.parse("the zoom should be {zoom}%"))
def check_zoom(quteproc, zoom):
data = quteproc.get_session()
value = data['windows'][0]['tabs'][0]['history'][0]['zoom'] * 100
assert abs(value - float(zoom)) < 0.0001 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.