text
stringlengths
100
1.03M
source
stringclasses
1 value
char_len
int64
100
1.03M
from autobahn.asyncio.websocket import WebSocketClientProtocol, \ WebSocketClientFactory import asyncio class MyClientProtocol(WebSocketClientProtocol): def onConnect(self, response): print("Server connected: {0}".format(response.peer)) @asyncio.coroutine def on...
code_python
1,264
from itertools import chain from django.utils.itercompat import is_iterable class Tags: """ Built-in tags for internal checks. """ admin = 'admin' caches = 'caches' compatibility = 'compatibility' database = 'database' models = 'models' security = 'security' signals = 'signals'...
code_python
3,104
""" The :mod:`sklearn.utils` module includes various utilites. """ from collections import Sequence import numpy as np from scipy.sparse import issparse import warnings from .murmurhash import murmurhash3_32 from .validation import (as_float_array, check_arrays, safe_asarray, assert_all_fini...
code_python
10,084
""" Python Character Mapping Codec cp1250 generated from 'MAPPINGS/VENDORS/MICSFT/WINDOWS/CP1250.TXT' with gencodec.py. """#" import codecs ### Codec APIs class Codec(codecs.Codec): def encode(self,input,errors='strict'): return codecs.charmap_encode(input,errors,encoding_table) def decode(self,in...
code_python
13,940
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) from __future__ import absolute_import, division, print_function __metaclass__ = type ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ['preview'], 'supported_by': 'community'} ...
code_python
3,887
import _controls_ import new new_instancemethod = new.instancemethod def _swig_setattr_nondynamic(self,class_type,name,value,static=1): if (name == "thisown"): return self.this.own(value) if (name == "this"): if type(value).__name__ == 'PySwigObject': self.__dict__[name] = value ...
code_python
332,240
# -*- coding: utf-8 -*- """ werkzeug.contrib.cache ~~~~~~~~~~~~~~~~~~~~~~ The main problem with dynamic Web sites is, well, they're dynamic. Each time a user requests a page, the webserver executes a lot of code, queries the database, renders templates until the visitor gets the page he sees. ...
code_python
23,510
from contextlib import contextmanager from datetime import datetime from inspect import isclass from celery import chord, group from celery_once import QueueOnce from celery.schedules import crontab from celery.utils.log import get_task_logger from sqlalchemy.orm.attributes import flag_modified # from pipet import ce...
code_python
1,540
import os from importlib import import_module from django.core.exceptions import ImproperlyConfigured from django.utils.module_loading import module_has_submodule MODELS_MODULE_NAME = 'models' class AppConfig: """Class representing a Django application and its configuration.""" def __init__(self, app_name, ...
code_python
8,045
from __future__ import (absolute_import, division, print_function) __metaclass__ = type import os import json import sys from nose.plugins.skip import SkipTest if sys.version_info < (2, 7): raise SkipTest("F5 Ansible modules require Python >= 2.7") from ansible.compat.tests import unittest from ansible.compat.te...
code_python
6,658
import unittest, os, errno from ctypes import * from ctypes.util import find_library from test import test_support try: import threading except ImportError: threading = None class Test(unittest.TestCase): def test_open(self): libc_name = find_library("c") if libc_name is None: r...
code_python
2,329
import os import shutil import sys from django.core.exceptions import ImproperlyConfigured from django.db.backends.base.creation import BaseDatabaseCreation from django.utils.encoding import force_text from django.utils.six.moves import input class DatabaseCreation(BaseDatabaseCreation): @staticmethod def is...
code_python
4,963
"""Provide access to Python's configuration information. """ import sys import os from os.path import pardir, realpath _INSTALL_SCHEMES = { 'posix_prefix': { 'stdlib': '{base}/lib/python{py_version_short}', 'platstdlib': '{platbase}/lib/python{py_version_short}', 'purelib': '{ba...
code_python
25,980
from __future__ import absolute_import, unicode_literals import json import hashlib from django import forms from django.conf import settings from django.db import connections from django.utils.encoding import force_text from django.utils.functional import cached_property from django.core.exceptions import Validation...
code_python
2,782
import os, sys, requests, pprint, re, json from uritemplate import URITemplate, expand from subprocess import call changelog_file = '../../changelog.txt' token_file = '../../../TelegramPrivate/github-releases-token.txt' version = '' commit = '' for arg in sys.argv: if re.match(r'\d+\.\d+', arg): version = arg ...
code_python
7,387
import datetime import ephem # dnf install python3-pyephem import math import navpy import numpy as np # find our custom built opencv first import sys sys.path.insert(0, "/usr/local/opencv3/lib/python2.7/site-packages/") import cv2 sys.path.append('../scripts') from lib import transformations impo...
code_python
43,547
""" Utilities for extracting text from generated classes. """ from __future__ import unicode_literals def is_string(txt): if isinstance(txt, str): return True try: if isinstance(txt, str): return True except NameError: pass return False def description(obj): if ...
code_python
1,081
# Commentary: # # # # # Change log: # # Tue May 21 16:34:53 IST 2013 - Subha moved code from # test_converter.py to test_hhfit.py. # # # 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; e...
code_python
6,018
"""Schur decomposition functions.""" import numpy from numpy import asarray_chkfinite, single # Local imports. import misc from misc import LinAlgError, _datacopied from lapack import get_lapack_funcs from decomp import eigvals __all__ = ['schur', 'rsf2csf'] _double_precision = ['i','l','d'] def schur(a, output='r...
code_python
5,246
# vim: tabstop=4 shiftwidth=4 softtabstop=4 # # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed o...
code_python
1,294
"""Simple MNIST classifier example with JIT XLA and timelines. """ from __future__ import absolute_import from __future__ import division from __future__ import print_function import argparse import sys import tensorflow as tf from tensorflow.examples.tutorials.mnist import input_data from tensorflow.python.client ...
code_python
2,939
""" Classes and subroutines dealing with network connections and related topics. """ from __future__ import with_statement from functools import wraps import getpass import os import re import time import socket import sys from StringIO import StringIO from fabric.auth import get_password, set_password from fabric.u...
code_python
24,591
from django.forms.widgets import Textarea from django.template import loader, Context from django.templatetags.static import static from django.utils import translation from django.contrib.gis.gdal import OGRException from django.contrib.gis.geos import GEOSGeometry, GEOSException # Creating a template context that c...
code_python
4,343
# See LICENSE for details. # """Module to parse ANSI escape sequences Maintainer: Jean-Paul Calderone """ import string # Twisted imports from twisted.python import log class ColorText: """ Represents an element of text along with the texts colors and additional attributes. """ # The colors to...
code_python
7,172
# encoding:UTF-8 import sys import os import time import wlstModule as wlst import ConfigParser from java.util import Properties from java.lang import System from java.io import FileInputStream from java.io import FileOutputStream from weblogic.security.internal import SerializedSystemIni from weblogic.security.int...
code_python
35,310
# Test the functions and main class method of FormatParagraph.py import unittest from idlelib import FormatParagraph as fp from idlelib.EditorWindow import EditorWindow from tkinter import Tk, Text, TclError from test.support import requires class Is_Get_Test(unittest.TestCase): """Test the is_ and get_ functions"...
code_python
14,343
""" Python Character Mapping Codec generated from 'VENDORS/MICSFT/PC/CP863.TXT' with gencodec.py. """#" import codecs ### Codec APIs class Codec(codecs.Codec): def encode(self,input,errors='strict'): return codecs.charmap_encode(input,errors,encoding_map) def decode(self,input,errors='strict'): ...
code_python
34,251
# coding: utf-8 from __future__ import unicode_literals import re from .common import InfoExtractor from ..utils import unescapeHTML class BaiduVideoIE(InfoExtractor): IE_DESC = '百度视频' _VALID_URL = r'https?://v\.baidu\.com/(?P<type>[a-z]+)/(?P<id>\d+)\.htm' _TESTS = [{ 'url': 'http://v.baidu.com/...
code_python
1,944
import json import logging from oslo_utils import units from django import conf from django.core.urlresolvers import reverse from django.core.urlresolvers import reverse_lazy from django.utils.translation import ugettext_lazy as _ from horizon import exceptions from horizon import forms from horizon import tables fr...
code_python
7,626
from openerp.osv import fields, osv from openerp.tools.translate import _ class account_move_line_reconcile_select(osv.osv_memory): _name = "account.move.line.reconcile.select" _description = "Move line reconcile select" _columns = { 'account_id': fields.many2one('account.account', 'Account', \ ...
code_python
1,377
__doc__ = """ SCons compatibility package for old Python versions This subpackage holds modules that provide backwards-compatible implementations of various things that we'd like to use in SCons but which only show up in later versions of Python than the early, old version(s) we still support. Other code will not gen...
code_python
7,000
import unittest from IECore import * class TestShader( unittest.TestCase ) : def test( self ) : s = Shader() self.assertEqual( s.name, "defaultsurface" ) self.assertEqual( s.type, "surface" ) self.assertEqual( len( s.parameters ), 0 ) self.assertEqual( s.parameters.typeName(), "CompoundData" ) s = Sha...
code_python
1,414
from __future__ import unicode_literals import frappe from frappe.utils import cint, validate_email_add from frappe import throw, msgprint, _ from frappe.model.document import Document class Warehouse(Document): def autoname(self): suffix = " - " + frappe.db.get_value("Company", self.company, "abbr") if not sel...
code_python
5,043
#!/usr/bin/env python from vcoptparse import * import vm_build import sys from threading import Thread, Semaphore class Builder(Thread): def __init__(self, name, branch, target, semaphore): Thread.__init__(self) self.name = name self.branch = branch self.target = target self...
code_python
6,290
""" mbed CMSIS-DAP debugger Copyright (c) 2006-2013 ARM Limited Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable ...
code_python
1,453
""" Various tests for synchronization primitives. """ import sys import time from thread import start_new_thread, get_ident import threading import unittest from test import test_support as support def _wait(): # A crude wait/yield function not relying on synchronization primitives. time.sleep(0.01) class B...
code_python
15,116
from __future__ import unicode_literals from datetime import datetime, timedelta from django.template.defaultfilters import timesince_filter from django.test import SimpleTestCase from django.test.utils import requires_tz_support from ..utils import setup from .timezone_utils import TimezoneTestCase class Timesince...
code_python
5,419
""" ============================================================================ Decoding in time-frequency space data using the Common Spatial Pattern (CSP) ============================================================================ The time-frequency decomposition is estimated by iterating over raw data that has be...
code_python
6,376
from allauth.socialaccount.providers.base import ProviderAccount from allauth.socialaccount.providers.oauth2.provider import OAuth2Provider class Scope(object): USERINFO_PROFILE = "/authenticate" class OrcidAccount(ProviderAccount): def get_profile_url(self): return extract_from_dict(self.account.extr...
code_python
1,558
import json import re import yaml import base64 import velruse import datetime from pygithub3 import Github from pyramid.httpexceptions import HTTPFound from pyramid.view import view_config from verse.utils import set_content #from pyramid.i18n import TranslationString as _ from .models import ( DBSession, Us...
code_python
7,347
from javascript import JSObject from browser import window import urllib.request class TempMod: def __init__(self, name): self.name=name #define my custom import hook (just to see if it get called etc). class BaseHook: def __init__(self, fullname=None, path=None): self._fullname=fullname self._p...
code_python
1,395
"""An optimizer that switches between several methods.""" import tensorflow as tf from tensorflow.python.training import optimizer class CompositeOptimizer(optimizer.Optimizer): """Optimizer that switches between several methods. """ def __init__(self, optimizer1, optimizer2, ...
code_python
1,923
{ 'name': 'Invoice on Timesheets', 'version': '1.0', 'category': 'Sales Management', 'description': """ Generate your Invoices from Expenses, Timesheet Entries. ======================================================== Module to generate invoices based on costs (human resources, expenses, ...). You can...
code_python
1,422
# -*- coding: utf-8 -*- # Import python libs from __future__ import absolute_import import os import copy import tempfile import json import datetime import pprint # Import Salt Testing libs from salttesting.unit import skipIf, TestCase from salttesting.case import ModuleCase from salttesting.helpers import ensure_in...
code_python
28,111
from django.conf.urls import patterns urlpatterns = patterns('survey.views', # Survey urls (r'^module/survey/$', 'survey_list'), (r'^module/survey/add/$', 'survey_add'), (r'^module/sealed_survey_view/(.+)/$', 'sealed_survey_view'), (r'^module/survey/del/(.+)/$', 'survey_del'), (r'^module/survey...
code_python
1,195
"""Definition of WebDriverException classes.""" def create_webdriver_exception_strict(status_code, message): """Create the appropriate WebDriverException given the status_code.""" if status_code in _exceptions_strict: return _exceptions_strict[status_code](message) return UnknownStatusCodeException...
code_python
6,459
from __future__ import unicode_literals from django.core.exceptions import ImproperlyConfigured from django.db import models from django.http import Http404 from django.utils.translation import ugettext as _ from django.views.generic.base import ContextMixin, TemplateResponseMixin, View class SingleObjectMixin(Contex...
code_python
6,917
from .utils import kwarg_decorator, last_arg_decorator from .version import version as __version__ from .version import version_info __all__ = [ '__version__', 'version_info', 'registry', 'register_model_chooser', 'register_simple_model_chooser', 'register_filter', ] class Registry(object): def __init__(s...
code_python
2,007
__all__ = ['FlashFileNaming'] import os, re from pyasm.biz import FileNaming, Project, Snapshot, File from pyasm.common import TacticException class FlashFileNaming(FileNaming): def add_ending(my, parts, auto_version=False): context = my.snapshot.get_value("context") version = my.snapshot.get_v...
code_python
1,341
""" Various asynchronous TCP/IP classes. End users shouldn't use this module directly - use the reactor APIs instead. Maintainer: Itamar Shtull-Trauring """ # System imports import os, sys, stat, socket, struct from errno import EINTR, EMSGSIZE, EAGAIN, EWOULDBLOCK, ECONNREFUSED, ENOBUFS from zope.interface import ...
code_python
17,697
"""DSA public-key signature algorithm. DSA_ is a widespread public-key signature algorithm. Its security is based on the discrete logarithm problem (DLP_). Given a cyclic group, a generator *g*, and an element *h*, it is hard to find an integer *x* such that *g^x = h*. The problem is believed to be difficult, and it h...
code_python
12,594
"""Setup for instrumentation host-driven tests.""" import logging import os import sys import types from pylib.host_driven import test_case from pylib.host_driven import test_info_collection from pylib.host_driven import test_runner def _GetPythonFiles(root, files): """Returns all files from |files| that end in 'T...
code_python
6,204
""" =========================== Pipeline bamstats =========================== :Author: Adam Cribbs :Release: $Id$ :Date: |today| :Tags: Python The intention of this pipeline is to perform QC statistics on `.bam` files that are produced following mapping of fastq files. The pipeline requires a `.bam` file as an...
code_python
25,295
""" Simple DOM for both SGML and XML documents. """ from __future__ import division from __future__ import generators from __future__ import nested_scopes import transforms class Container: def __init__(self): self.children = [] def add(self, child): child.parent = self self.children.append(child) ...
code_python
5,704
""" Support for MyQ-Enabled Garage Doors. For more details about this platform, please refer to the documentation https://home-assistant.io/components/cover.myq/ """ import logging import voluptuous as vol from homeassistant.components.cover import CoverDevice from homeassistant.const import ( CONF_USERNAME, CON...
code_python
2,879
#!/usr/bin/env python """This file abstracts the loading of the private key.""" from cryptography import x509 from cryptography.hazmat.backends import openssl from cryptography.hazmat.primitives import hashes from cryptography.x509 import oid from grr.lib import rdfvalue from grr.lib.rdfvalues import crypto as rdf_cr...
code_python
3,076
import gdb import os import re from linux import modules if hasattr(gdb, 'Breakpoint'): class LoadModuleBreakpoint(gdb.Breakpoint): def __init__(self, spec, gdb_command): super(LoadModuleBreakpoint, self).__init__(spec, internal=True) self.silent = True self.gdb_command...
code_python
6,042
from __future__ import unicode_literals # The *_FORMAT strings use the Django date format syntax, # see http://docs.djangoproject.com/en/dev/ref/templates/builtins/#date DATE_FORMAT = 'N j, Y' TIME_FORMAT = 'P' DATETIME_FORMAT = 'N j, Y, P' YEAR_MONTH_FORMAT = 'F Y' MONTH_DAY_FORMAT = 'F j' SHORT_DATE_FORMAT = 'm/d/Y'...
code_python
1,713
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) from __future__ import (absolute_import, division, print_function) __metaclass__ = type from ansible import constants as C from ansible.plugins.action import ActionBase from ansible.utils.vars import merge_hash class ActionM...
code_python
1,080
""" ``httm.transformations.metadata`` ================================= This module contains metadata related to transformation functions. - ``electron_flux_transformations`` is metadata describing transformation functions from images in electron counts to simulated raw images in *Analogue to Digital Converter ...
code_python
4,328
""" Copyright (C) 2010-2011 ST-Ericsson SA """ """ Author: Szymon Janc <szymon.janc@tieto.com> for ST-Ericsson. """ """ 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...
code_python
30,632
from __future__ import unicode_literals import os from flask_webpackext import FlaskWebpackExt from flask_webpackext.manifest import JinjaManifestLoader from pywebpack import ManifestLoader from indico.web.assets.util import get_custom_assets class IndicoManifestLoader(JinjaManifestLoader): cache = {} def ...
code_python
1,381
""" Views and functions for serving static files. These are only to be used during development, and SHOULD NOT be used in a production setting. """ from __future__ import unicode_literals import mimetypes import os import posixpath import re import stat from django.http import ( FileResponse, Http404, HttpRespons...
code_python
5,137
'''Unit tests for grit.tclib''' import sys import os.path if __name__ == '__main__': sys.path.append(os.path.join(os.path.dirname(__file__), '..')) import types import unittest from grit import tclib from grit import exception import grit.extern.tclib class TclibUnittest(unittest.TestCase): def testInit(self):...
code_python
7,930
import terminal import curses import time from curses import panel class InfoContainer(object): def __init__(self, stdscreen, title, debug_console): self.debug_console = debug_console self.height = int(terminal.height/2) self.width = terminal.width - 2 self.title = title s...
code_python
1,890
#!/usr/bin/env python """Node Server Example This example demonstrates how to create a very simple node server that supports bi-diractional messaging between server and connected clients forming a cluster of nodes. """ from __future__ import print_function from os import getpid from optparse import OptionParser fr...
code_python
2,420
import logging import os import time from webkitpy.common.system.crashlogs import CrashLogs from webkitpy.common.system.executive import ScriptError from webkitpy.port.apple import ApplePort from webkitpy.port.leakdetector import LeakDetector _log = logging.getLogger(__name__) class MacPort(ApplePort): port_name...
code_python
12,641
# This script is used to copy all dependencies into the local directory. # The package of files can then be uploaded to App Engine. import os import shutil import stat import sys SRC_DIR = os.path.join(sys.path[0], os.pardir, os.pardir, os.pardir, os.pardir, os.pardir) THIRD_PARTY_DIR = os.path.join(SRC_DIR, 'thir...
code_python
3,149
import l10n_fr import report import wizard # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
code_python
109
# Program to show the maps of RMSE averaged over time import matplotlib.pyplot as plt from sklearn.metrics import mean_squared_error import os from netCDF4 import Dataset as NetCDFFile import numpy as np from CCLM_OUTS import Plot_CCLM # option == 1 -> shift 4 with default cclm domain and nboundlines = 3 # option == 2...
code_python
2,005
"""App Engine configuration file. See: https://developers.google.com/appengine/docs/python/tools/appengineconfig """ import os import logging import os import sys # Log to disk for managed VMs: # https://cloud.google.com/appengine/docs/managed-vms/custom-runtimes#logging if os.environ.get('LOG_TO_DISK'): log...
code_python
2,379
from __future__ import unicode_literals import frappe from frappe import _ def execute(filters=None): columns = get_columns() proj_details = get_project_details() pr_item_map = get_purchased_items_cost() se_item_map = get_issued_items_cost() dn_item_map = get_delivered_items_cost() data = [] for project in pr...
code_python
3,044
#!/usr/bin/python """ Data Models for books.service All classes can be instantiated from an xml string using their FromString class method. Notes: * Book.title displays the first dc:title because the returned XML repeats that datum as atom:title. There is an undocumented gbs:ope...
code_python
18,514
""" 13. Adding hooks before/after saving and deleting To execute arbitrary code around ``save()`` and ``delete()``, just subclass the methods. """ from __future__ import unicode_literals from django.db import models from django.utils.encoding import python_2_unicode_compatible @python_2_unicode_compatible class Pers...
code_python
1,033
from copy import deepcopy from django.core.checks.templates import E001 from django.test import SimpleTestCase from django.test.utils import override_settings class CheckTemplateSettingsAppDirsTest(SimpleTestCase): TEMPLATES_APP_DIRS_AND_LOADERS = [ { 'BACKEND': 'django.template.backends.djang...
code_python
1,401
"""Documentation Flask Blueprint.""" import os from flask import render_template, current_app, abort, url_for, Blueprint from flask.helpers import send_from_directory from werkzeug.utils import cached_property, import_string from sphinx.websupport import WebSupport from sphinx.websupport.errors import DocumentNotFou...
code_python
2,796
""" Concatenates module scripts based on the module.json descriptor. Optionally, minifies the result using rjsmin. """ from cStringIO import StringIO from os import path import os import re import sys try: import simplejson as json except ImportError: import json rjsmin_path = path.abspath(path.join( ...
code_python
2,221
# -*- coding: utf-8 -*- """ Pelican Mathjax Markdown Extension ================================== An extension for the Python Markdown module that enables the Pelican python blog to process mathjax. This extension gives Pelican the ability to use Mathjax as a "first class citizen" of the blog """ import markdown from...
code_python
6,928
""" ========================================================= Multi-dimensional image processing (:mod:`scipy.ndimage`) ========================================================= .. currentmodule:: scipy.ndimage This package contains various functions for multi-dimensional image processing. Filters :mod:`scipy.ndimag...
code_python
5,326
from __future__ import unicode_literals from guessit import Guess from guessit.transfo import SingleNodeGuesser from guessit.patterns import weak_episode_rexps import re import logging log = logging.getLogger(__name__) def guess_weak_episodes_rexps(string, node): if 'episodeNumber' in node.root.info: retu...
code_python
1,309
# -*- coding: utf-8 -*- """ Created on Wed May 06 11:00:53 2015 @author: newJustin """ import ChronoTrack_pandas as CT import pylab as py if __name__ == '__main__': # logger import logging as lg lg.basicConfig(fileName = 'logFile.log', level=lg.WARN, format='%(message)s') # default fo...
code_python
4,229
# -*- coding: utf-8 -*- ''' FanFilm 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 ...
code_python
1,127
import os import shutil import zipfile import fnmatch import uuid def main(): kits = findAll(".") for kit in kits: print("* ", kit, " -> ", kits[kit]) print() print() print("Starting extraction:") print("------------------------------------------") extractKits(kits) def findAll(dir...
code_python
3,378
import abc import collections from oslo_log import log as logging import six from neutron.api.rpc.callbacks import exceptions as rpc_exc from neutron.api.rpc.callbacks import resources from neutron.callbacks import exceptions LOG = logging.getLogger(__name__) # TODO(QoS): split the registry/resources_rpc modules in...
code_python
4,132
# coding: utf-8 from __future__ import unicode_literals import os.path import re from .common import InfoExtractor from ..utils import ( ExtractorError, remove_start, sanitized_Request, urlencode_postdata, ) class MonikerIE(InfoExtractor): IE_DESC = 'allmyvideos.net and vidspot.net' _VALID_UR...
code_python
3,949
""" Management utility to create superusers. """ from __future__ import unicode_literals import getpass import sys from django.contrib.auth import get_user_model from django.contrib.auth.management import get_default_username from django.core import exceptions from django.core.management.base import BaseCommand, Comm...
code_python
7,692
# This file is part of pybootchartgui. # pybootchartgui 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. # pybootchartgui is dis...
code_python
5,535
import netaddr from neutron.common import utils from neutron.openstack.common import log as logging from neutron.plugins.nec.common import config from neutron.plugins.nec.common import exceptions as nexc from neutron.plugins.nec.db import api as ndb from neutron.plugins.nec import drivers LOG = logging.getLogger(__na...
code_python
8,733
import sys import struct i = 0 while True: buf = sys.stdin.read(4) if len(buf) == 0: break elif len(buf) != 4: sys.stdout.write("\n") sys.stderr.write("Error: read {0} not 4 bytes\n".format(len(buf))) sys.exit(1) if i > 0: sys.stdout.write(" ") sys.stdout.write("{0:x}={1}".format(i, struct.unpack("<I"...
code_python
363
import random from utils import constrained_sum_sample_pos, arr_str scenario_description = ( "During the fueling period of the DAO, send enough ether from all " "accounts to create tokens and then assert that the user's balance is " "indeed correct and that the minimum fueling goal has been reached" ) def...
code_python
1,426
import threading from func import synchronized __all__ = ['LRU'] class LRUNode(object): __slots__ = ['prev', 'next', 'me'] def __init__(self, prev, me): self.prev = prev self.me = me self.next = None class LRU(object): """ Implementation of a length-limited O(1) LRU queue. ...
code_python
3,072
from __future__ import unicode_literals from django.conf import settings from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ migrations.swappable_dependency(settings.AUTH_USER_MODEL), ('organization-projects', '0084_aut...
code_python
1,041
"""Unit Tests for BibAuthority""" from invenio.testsuite import InvenioTestCase from invenio.testsuite import make_test_suite, run_test_suite class TestBibAuthorityEngine(InvenioTestCase): """Unit tests for bibauthority_engine""" def test_split_name_parts(self): """bibauthority - test get_type_from_a...
code_python
863
# By default in Python if you divide an int by another int (5 / 2), the result will also # be an int (2). The following line changes this behavior so that float will be returned # if necessary (2.5). from __future__ import division import difflib import json import logging import os import prettytable import re from c...
code_python
43,216
"""Support for Dyson Pure Cool Link Sensors.""" import logging from libpurecool.dyson_pure_cool import DysonPureCool from libpurecool.dyson_pure_cool_link import DysonPureCoolLink from homeassistant.const import PERCENTAGE, STATE_OFF, TEMP_CELSIUS, TIME_HOURS from homeassistant.helpers.entity import Entity from . im...
code_python
6,449
from gnuradio import gr, gr_unittest, digital class test_digital(gr_unittest.TestCase): def setUp(self): self.tb = gr.top_block() def tearDown(self): self.tb = None if __name__ == '__main__': gr_unittest.run(test_digital, "test_digital.xml")
code_python
273
from django.test import TestCase from django.test.utils import override_settings from template_preprocess.processor import process_template_content from template_preprocess.test import get_test_template_settings template_settings = get_test_template_settings() @override_settings(**template_settings) class TestExtendB...
code_python
2,103
from __future__ import print_function import argparse import collections import json import logging import sys from grocsvs import options as svoptions from grocsvs import log from grocsvs import pipeline from grocsvs import utilities from grocsvs import stages as svstages logging.basicConfig(format='%(message)s', l...
code_python
5,821
# 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 your option) any later version. # # Ansible is distributed in the hope that ...
code_python
9,341
# -*- coding: utf-8 -*- """ markupsafe ~~~~~~~~~~ Implements a Markup string. :copyright: (c) 2010 by Armin Ronacher. :license: BSD, see LICENSE for more details. """ import re import string from collections import Mapping from markupsafe._compat import text_type, string_types, int_types, \ u...
code_python
10,689