content stringlengths 4 20k |
|---|
import logging
from six import moves
from testtools import matchers
from tempest.api.messaging import base
from tempest.common.utils import data_utils
from tempest import test
LOG = logging.getLogger(__name__)
class TestQueues(base.BaseMessagingTest):
@test.attr(type='smoke')
def test_create_queue(self):... |
#!/home/jpadula/uframes/ooi/uframe-1.0/python/bin/python
__author__ = 'Joe Padula'
from mi.core.log import get_logger
log = get_logger()
from mi.idk.config import Config
import unittest
import os
from mi.dataset.driver.velpt_ab.dcl.velpt_ab_dcl_telemetered_driver import parse
from mi.dataset.dataset_driver import ... |
import re
from textslice import TextSlice
__all__ = ['normalize_macro_name', 're_count',
'Tokenizer', 'Parser', 'SourceMapper', 'MacroExpander',
'split_args', 'LEVEL_WARNING', 'LEVEL_ERROR']
token_re = re.compile(r'([(][*]|[*][)]|\'|"|[\\]|//|\r\n|\n\r|\n)')
endline_re = re.compile(r'(\r\n|\n\... |
from msrest.service_client import ServiceClient
from msrest import Serializer, Deserializer
from msrestazure import AzureConfiguration
from .version import VERSION
from .operations.servers_operations import ServersOperations
from .operations.firewall_rules_operations import FirewallRulesOperations
from .operations.data... |
from cloudify import exceptions, ctx
from cloudify.decorators import operation
__author__ = 'kemi'
# Built in Imports
import platform
import tempfile
# Cloudify Imports
from package_installer_plugin.constants import *
from utils import run, download_file
@operation
def install_packages(config, **_):
""" Instal... |
from . import pathstyles as styles
import cadnano.util as util
from PyQt5.QtCore import QRectF, Qt
from PyQt5.QtGui import QBrush, QFont, QPen, QDrag
from PyQt5.QtWidgets import QGraphicsItem, QGraphicsSimpleTextItem, QColorDialog
_FONT = QFont(styles.THE_FONT, 12, QFont.Bold)
class ColorPanel(QGraphicsItem):
... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
from django.conf import settings
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
operations = [
migrations.Create... |
import sys, os, stat, os.path, getpass, subprocess, argparse
from django.core import management
parser = argparse.ArgumentParser(
description = "Start a new herokuapp Django project.",
)
parser.add_argument("project_name",
help = "The name of the project to create.",
)
parser.add_argument("dest_dir",
def... |
from __future__ import absolute_import, print_function, division
import os.path
from mitmproxy import exceptions
from mitmproxy.flow import io
class FileStreamer:
def __init__(self):
self.stream = None
self.active_flows = set() # type: Set[models.Flow]
def start_stream_to_path(self, path, m... |
#!/usr/bin/python3
""" heartbeat.py:
"""
# Import Required Libraries (Standard, Third Party, Local) ********************
import datetime
import logging
if __name__ == "__main__":
import os
import sys
sys.path.append(os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))))
from rpihome_... |
import argparse
from preprocess import MSRII, KTH
from preprocess.c3d import C3DFeatureNet
from network.trainer import Trainer
from network.model import FC4Net
from evaluate.evaluator import ProposalEvaluator
def extract_feature():
dataset = MSRII.Dataset('/data-disk/MSRII/')
c3dnet = C3DFeatureNet(feature_f... |
import re, json, zipfile, shutil
from os import path, mkdir
from sys import exit, stdout, stderr
import requests
import datetime
FORGE_VERSIONS_URL = "http://files.minecraftforge.net/maven/net/minecraftforge/forge/promotions_slim.json"
ignored_verions = ["1.7.10-latest-1.7.10", "latest-1.7.10", "1.10-latest", "latest"... |
# -*- coding: utf-8 -*-
'''
Bubbles Addon
Copyright (C) 2016 Exodus
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 l... |
from __future__ import absolute_import, division, print_function, unicode_literals
from pyflakes.checker import Checker as FlakesChecker
from pants.contrib.python.checks.checker.common import CheckstylePlugin, Nit
class FlakeError(Nit):
# TODO(wickman) There is overlap between this and Flake8 -- consider integrat... |
# encoding: utf-8
# module PyKDE4.kio
# from /usr/lib/python2.7/dist-packages/PyKDE4/kio.so
# by generator 1.135
# no doc
# imports
import PyKDE4.kdeui as __PyKDE4_kdeui
import PyQt4.QtCore as __PyQt4_QtCore
import PyQt4.QtGui as __PyQt4_QtGui
class KImageIO(): # skipped bases: <type 'sip.wrapper'>
# no doc
... |
from geopytool.ImportDependence import *
from geopytool.CustomClass import *
class MyICA(AppForm):
Lines = []
Tags = []
description = 'ICA'
unuseful = ['Name',
'Mineral',
'Author',
'DataType',
'Label',
'Marker',
... |
import os
import string
import random
def random_password(size=40, chars=None):
'''Return a random password string.
The default length is 32 characters. Different character classes can be
passed in, but the default draws from ASCII uppercase, lowercase, and
digits.
Uses the SystemRamdom to ensu... |
def get_net(ipaddress, netmask):
"""get network address from the ipaddres and netmask
>>> get_net('10.7.2.1', '255.255.255.0')
'10.7.2.0'
"""
ip = ipaddress.split(".")
netm = netmask.split(".")
network = str(int(ip[0])&int(netm[0]))+"."+str(int(ip[1])&int(netm[1]))+"."+str(int(ip[2])&int(net... |
import tempfile
import socket
import ssl
HOST = ('127.0.0.1', 8000)
CERT = tempfile.NamedTemporaryFile(mode='w+t')
CERT.write("""
-----BEGIN CERTIFICATE-----
MIIBiTCCAS6gAwIBAgIQc5xt4hCgFJUFhloTJ3u4zTAKBggqhkjOPQQDAjAtMRQw
EgYDVQQKEwtKdXN0IEVub3VnaDEVMBMGA1UEAxMMVGVzdENlcnRzIENBMB4XDTE0
MTAwMjAzMDczMVoXDTI0MTAwMjAzMD... |
ANSIBLE_METADATA = {
'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'community'
}
from ansible.module_utils.basic import AnsibleModule
from ansible_common_f5.base import F5_NAMED_OBJ_ARGS
from ansible_common_f5.base import F5_PROVIDER_ARGS
from ansible_common_f5.bigip import F5BigIpNamed... |
"""
Django settings for usosidmapper project.
Generated by 'django-admin startproject' using Django 1.10.5.
For more information on this file, see
https://docs.djangoproject.com/en/1.10/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.10/ref/settings/
"""
impo... |
# -*- coding: utf-8 -*-
"""The canvas of main window."""
from __future__ import annotations
__author__ = "Yuan Chang"
__copyright__ = "Copyright (C) 2016-2021"
__license__ = "AGPL"
__email__ = "<EMAIL>"
from collections import deque
from typing import (
cast, TYPE_CHECKING, List, Tuple, Sequence, Union, Mapping... |
# -*- coding: utf-8 -*-
import subprocess
import os
import traceback
import sys
class WinPDF2Image(object):
GHOSTSCRIPTCMD = "C:/Program Files/gs/gs9.18/bin/gswin64.exe"
RESOLUTION = '200x200'
def __init__(self):
#filepath = "test.pdf"
#self.gs_pdf_to_png(os.path.join(os.... |
import re
from uge.exceptions.object_not_found import ObjectNotFound
from uge.exceptions.invalid_request import InvalidRequest
from uge.objects.qconf_object_factory import QconfObjectFactory
from .dict_based_object_manager import DictBasedObjectManager
class ProjectManager(DictBasedObjectManager):
QCONF_ERROR_REG... |
from __future__ import absolute_import
import json
import os
from bs4 import BeautifulSoup
import digits.test_views
from digits import extensions
from digits.utils import constants
# May be too short on a slow system
TIMEOUT_DATASET = 45
#############################################################################... |
"""
Support code for pooling operations (in pooled ICA type models, for now).
"""
import numpy as np
import theano
import warnings
try:
import scipy.sparse
except ImportError:
warnings.warn("Could not import scipy")
from itertools import izip
def pooling_matrix(groups, per_group, strides=None, dtype=None, spa... |
# -*- coding: utf-8 -*-
from webargs.core import json
try:
from urllib.parse import urlencode
except ImportError: # PY2
from urllib import urlencode # type: ignore
import mock
import pytest
import marshmallow as ma
import tornado.web
import tornado.httputil
import tornado.httpserver
import tornado.http1c... |
import logging
from clientIF import clientIF
from contextlib import contextmanager
from monkeypatch import MonkeyPatch
from testlib import VdsmTestCase as TestCaseBase, \
expandPermutations, \
permutations, \
dummyTextGenerator
from jsonRpcHelper import \
PERMUTATIONS, \
constructClient, \
Fak... |
from django.forms import ModelForm
from models import Book, Language
class BookForm(ModelForm):
# dc_language = ModelChoiceField(Language.objects, widget=SelectWithPop)
class Meta:
model = Book
exclude = ('mimetype', 'file_sha256sum', )
def save(self, commit=True):
"""
Sto... |
# YPL parser 1.5
# written by VB.
import re
import sys, codecs
import exceptions
class keyword(unicode): pass
class code(unicode): pass
class ignore(object):
def __init__(self, regex_text, *args):
self.regex = re.compile(regex_text, *args)
class _and(object):
def __init__(self, something):
s... |
import numpy as np
from Classifiers import My_svm,My_svm2
from Evaluation import confusionMatrix, errorReview, confusionMatrix5
import re
import random
import nltk
from sklearn.feature_extraction.text import TfidfVectorizer
def review_to_words(raw_review):
# remove non-letters
letters_only = re.sub("[^a-zA-Z... |
"""This code example deactivates a user.
Deactivated users can no longer make requests to the API. The user making the
request cannot deactivate itself. To determine which users exist, run
get_all_users.py.
"""
# Import appropriate modules from the client library.
from googleads import ad_manager
USER_ID = 'INSERT_... |
"""This code example updates all users by adding " Sr." to the end of each
name. To determine which users exist, run get_all_users.py."""
__author__ = '<EMAIL> (Jeff Sham)'
# Locate the client library. If module was installed via "setup.py" script, then
# the following two lines are not needed.
import os
import sys
s... |
from Router import *
from PyQt4 import QtCore
##
# Class: the wireless router class
class Wireless_access_point(Router):
type="Wireless_access_point"
##
# Constructor: Initial a router device
# @param x the x axis of the device on the canvas
# @param y the y axis of the device on the canvas
#... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
from ansible.compat.six import iteritems
from ansible.errors import AnsibleError
from ansible.plugins.action import ActionBase
from ansible.utils.boolean import boolean
from ansible.utils.vars import isidentifier
class ActionMod... |
class dstat_plugin(dstat):
"""
ZFS on Linux L2ARC (Level 2 Adjustable Replacement Cache)
Data is extracted from /proc/spl/kstat/zfs/arcstats
"""
def __init__(self):
self.name = 'ZFS L2ARC'
self.nick = ('size', 'hit', 'miss', 'hit%', 'read', 'write')
self.vars = ('l2_size', '... |
#!/usr/bin/env python
"""Client actions for cloud VMs."""
import os
import platform
import re
import subprocess
import requests
from grr_response_client import actions
from grr_response_core.lib.rdfvalues import cloud as rdf_cloud
class GetCloudVMMetadata(actions.ActionPlugin):
"""Get metadata for cloud VMs.
... |
import signal
import os
import pexpect
import traceback
from log import *
class Hook(object):
"""
Generic hooks before/after API/CLI calls
"""
def __init__(self, logger):
self.logger = logger
def before_api(self, api_name, api_args):
"""
Function called before API call
... |
#!/usr/bin/env python3
import unittest
import numpy as np
from panda import Panda
from panda.tests.safety import libpandasafety_py
import panda.tests.safety.common as common
from panda.tests.safety.common import CANPackerPanda
ANGLE_DELTA_BP = [0., 5., 15.]
ANGLE_DELTA_V = [5., .8, .15] # windup limit
ANGLE_DELTA_... |
import numpy as np
import numpy.random as rng
import matplotlib.pyplot as plt
# Set the seed
rng.seed(0)
# Import the model
from transit_model import from_prior, log_prior, log_likelihood, proposal,\
num_params
# Generate a starting point from the prior
# (Feel free to use a better reci... |
from six.moves import map
import nnabla as nn
def check_cached_array_preferred(ac, prefer=True):
c = list(map(lambda x: not (prefer ^ ('Cached' in x)), ac))
assert c == sorted(c, reverse=True)
def test_prefer_cached_array():
nn.reset_array_preference()
nn.prefer_cached_array(True)
ac2 = nn.arra... |
from hal_widgets import HAL_HideTable
from hal_widgets import HAL_HBox
from hal_widgets import HAL_Table
from hal_widgets import HAL_ComboBox
from hal_widgets import HAL_Button
from hal_widgets import HALIO_Button
from hal_widgets import HAL_RadioButton
from hal_widgets import HAL_ToggleButton
from hal_widgets import H... |
# -*- coding: utf-8 -*-
"""
<DefineSource>
@Date : Fri Nov 14 13:20:38 2014 \n
@Author : Erwan Ledoux \n\n
</DefineSource>
Collecter instances
"""
#<DefineAugmentation>
import ShareYourSystem as SYS
BaseModuleStr="ShareYourSystem.Standards.Noders.Parenter"
DecorationModuleStr="ShareYourSystem.Standards.Classors.C... |
# -*- coding: utf-8 -*-
"""Test path methods
:todo: actual implementation of path tests - currently it is just a placeholder assuring
that the module can at least be imported
"""
from __future__ import unicode_literals
import os
import sys
from butility.future import str
# test * import
from butility.path import *
... |
# -*- coding: utf-8 -*-
__author__ = 'rolandh'
from saml2.attribute_converter import d_to_local_name
from saml2.attribute_converter import ac_factory
from saml2.mongo_store import export_mdstore_to_mongo_db
from saml2.mongo_store import MetadataMDB
from saml2.mdstore import MetadataStore
from saml2.mdstore import des... |
# usr/bin/env python
# -*- coding: utf-8 -*-
"""
Created on Thu Jul 20 13:15:05 2017
@author: Vijayasai S
"""
# Use python3
import my_dbscan as mydb
import alert_update as au
import generate_data as gd
import generate_data_2 as gd_2
from pymongo import MongoClient
import pandas as pd
def _connect_mongo(host, port, ... |
import os
import sys
import re
import datetime
from new import classobj
from sqlalchemy import *
from sqlalchemy.schema import CheckConstraint, Sequence
from sqlalchemy.orm import *
from sqlalchemy.sql.expression import text
#from sqlalchemy import Table, Column, ForeignKey
#from sqlalchemy import Integer, String, Date... |
#!/usr/bin/env python
"""
Setup script
"""
import os
import re
from setuptools import setup
gitsyncfile = os.path.join(os.path.dirname(__file__), 'gitsync.py')
# Thanks to SQLAlchemy:
# https://github.com/zzzeek/sqlalchemy/blob/master/setup.py#L104
with open(gitsyncfile) as stream:
__version__ = re.compile(
... |
"""Miscellaneous protobuf-related utils."""
import datetime
from pykeg.core import util
try:
from django.conf import settings
TIME_ZONE = settings.TIME_ZONE
except ImportError:
TIME_ZONE = 'America/Los_Angeles'
def ProtoMessageToDict(message):
ret = util.AttrDict()
#if not message.IsInitialized():
# ra... |
from swift.common.swob import Request, Response
class CrossDomainMiddleware(object):
"""
Cross domain middleware used to respond to requests for cross domain
policy information.
If the path is /crossdomain.xml it will respond with an xml cross domain
policy document. This allows web pages hosted... |
from notifications.models import Notification, NotificationRestriction, NotificationEmail
from django.contrib.contenttypes.models import ContentType
def notify_people(request, key, species, obj, users, metadata=None):
for user in users:
if request and user == request.user:
continue
... |
from flask import render_template, redirect, request, url_for, flash
from flask.ext.login import login_user, logout_user, login_required, \
current_user
from . import auth
from .. import db
from ..models import User
from ..email import send_email
from .forms import LoginForm, RegistrationForm, ChangePasswordForm,\
... |
from collections import OrderedDict
from distutils import util
import os
import re
from typing import Callable, Dict, Optional, Sequence, Tuple, Type, Union
import pkg_resources
from google.api_core import client_options as client_options_lib # type: ignore
from google.api_core import exceptions as core_exceptions ... |
#!/usr/bin/python
"""
setup2.py
Copyright 2014, Ty A. Lasky
Released under the GNU General Public License 3.0
See LICENSE.txt for license information.
---------------------------------------------------
Second setup dialog. Gets further setup information for match.
Exported classes:
Setup2 -- Second setup dialo... |
from openstack.auth import base
class Token(base.BaseAuthPlugin):
"""A provider that will always use the given token and endpoint.
This is really only useful for testing and in certain CLI cases where you
have a known endpoint and admin token that you want to use.
"""
def __init__(self, endpoint... |
import sys
from re import compile as recompile
from xmlrpc.client import ServerProxy
DVRCRE = recompile(r'^Delivered\s+in\s+\[(\d+)\]\s+\(from\s+'
r'\[source:([\w\d/\-\.]+)@(\d+)\s([\w\d/\-\.]+)\]\s+to\s+'
r'\[source:([\w\d/\-\.]+)@(\d+)\s(?P<dst>[\w\d/\-\.]+)\]')
DASCRE = recompi... |
"""
BR_LilUCB app implements DuelingBanditsPureExplorationPrototype
author: Kevin Jamieson, <EMAIL>
last updated: 1/11/2015
BR_LilUCB implements the lilUCB algorithm described in
Jamieson, Malloy, Nowak, Bubeck, "lil' UCB : An Optimal Exploration Algorithm for Multi-Armed Bandits," COLT 2014
using the Borda reduction... |
"""
sentry.buffer.redis
~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2010-2013 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
from __future__ import with_statement
from django.core.exceptions import ImproperlyConfigured
for package in ('nydus', 'redis'):
try:
_... |
from instagram.client import InstagramAPI
import json
import datetime
from geopy.geocoders import Nominatim
from collections import Counter
DISTANCE = 1500
TEL_AVIV = (32.085300, 34.781768)
RIO = (-22.906847, -43.172896)
LONDON = (51.507351, -0.127758)
GAZA = (31.354676, 34.308826)
JERUSALEM = (31.768319, 35.213710)
... |
from foam.case import Case
from ui.config import ConfigDialog
from PyQt4.QtCore import QProcess, QSettings
from PyQt4.QtGui import QApplication, QFileDialog
from ui.mainwindow import MainWindow
import argparse
import logging
import sys
import os
class Shampoo:
def __init__(self):
self.app = QApplication... |
# coding: utf-8
import logging
from ray.tune.trial import Trial, Checkpoint
from ray.tune.error import TuneError
from ray.tune.cluster_info import is_ray_cluster
logger = logging.getLogger(__name__)
class TrialExecutor:
"""Module for interacting with remote trainables.
Manages platform-specific details suc... |
#!/usr/bin/python
#coding:utf8
__author__ = 'markshao'
import sys
import shutil
import os
from pagrant.commands import PAGRANT_CONFIG_FILE_NAME
from pagrant.basecommand import Command
from pagrant.util import get_userinput, is_true
from pagrant.globalsettings import PAGRANT_CONFIG_TEMPLATE_PATH
class InitCommand(C... |
#!/usr/bin/env python3
import unittest
from PlotConfiguration import *
from PlotResult import *
from io import StringIO
class ANodeResult:
def __init__(self):
self.data = { 'properties' : {} }
def get(self):
return NodeResult(self.data)
def withId(self,i):
self.data['id'] = i
... |
"""Unittests for test_runner.py."""
import collections
import json
import os
import sys
import unittest
import test_runner
class TestCase(unittest.TestCase):
"""Test case which supports installing mocks. Uninstalls on tear down."""
def __init__(self, *args, **kwargs):
"""Initializes a new instance of this ... |
import unittest
from floo import FlooBase, Floo
class TestFlooBase(unittest.TestCase):
def setUp(self):
self.floo = FlooBase("abc")
def test_get_zero(self):
floo = self.floo
i = floo.initial()
self.assertEqual(i, "a")
def test_get_twenty_seven(self):
floo = self.f... |
"""
In-memory package repository
"""
from rez.package_repository import PackageRepository
from rez.package_resources_ import PackageFamilyResource, PackageResource, \
VariantResourceHelper, PackageResourceHelper, package_pod_schema
from rez.exceptions import PackageMetadataError
from rez.utils.formatting import is_... |
from mock import Mock
from trove.tests.unittests import trove_testtools
from trove.versions import BaseVersion
from trove.versions import Version
from trove.versions import VersionDataView
from trove.versions import VERSIONS
from trove.versions import VersionsAPI
from trove.versions import VersionsController
from trov... |
"""Public API."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from functools import wraps
from enum import Enum
# pylint:disable=g-bad-import-order
import gast
import six
# pylint:enable=g-bad-import-order
from tensorflow.contrib.autograph.impl impor... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import arrayfire as af
from bolt.lib.linear.utils.fft_funcs import fft2, ifft2
import numpy as np
# TODO: Change docstring to say that it returns either moment_hat or moment
# depending on the input
def compute_moments(self, moment_name, f=None, f_hat=None):
"""
... |
import urllib
import urlparse
import requests
from smartfile import Client
from smartfile import OAuthToken
from smartfile.errors import APIError
from requests_oauthlib import OAuth1
from oauthlib.oauth1 import SIGNATURE_PLAINTEXT
import common
class SmartFileClient(Client):
"""Overrides Client from the smartfi... |
'''
This file contains code related to managing migrations of the database
'''
from VilfredoReloadedCore import app
from VilfredoReloadedCore.database import db
from flask.ext.script import Manager
from flask.ext.migrate import Migrate, MigrateCommand
# Creat migration manager
migrate = Migrate(app, db)
manager = Mana... |
"""
Script to generate contributor and pull request lists
This script generates contributor and pull request lists for release
changelogs using Github v3 protocol. Use requires an authentication token in
order to have sufficient bandwidth, you can get one following the directions at
`<https://help.github.com/articles/... |
"""Test the cross_validation module"""
import numpy as np
from scipy.sparse import coo_matrix
from sklearn.utils.testing import assert_true
from sklearn.utils.testing import assert_equal
from sklearn.utils.testing import assert_raises
from sklearn.utils.testing import assert_greater
from sklearn.utils.testing import ... |
#!/usr/bin/env python
# coding=utf-8
"""
A `<enc:EncryptedData>` element.
Note: this class might be incomplete and/or need refactoring.
"""
from yael.element import Element
from yael.namespace import Namespace
import yael.util
__author__ = "Alberto Pettarin"
__copyright__ = "Copyright 2015, Alberto Pettarin (www.al... |
"""
[2014-12-10] Challenge #192 [Intermediate] Markov Chain Error Detection
https://www.reddit.com/r/dailyprogrammer/comments/2ovt2i/20141210_challenge_192_intermediate_markov_chain/
# [](#IntermediateIcon) **(Intermediate)**: Markov Chain Error Detection
A Markov process describes a system where the probability of c... |
# encoding: utf-8
from django.http import HttpResponse, HttpResponseBadRequest
from django.shortcuts import render, redirect, get_object_or_404
from .models import Story, StoryPart, Teller, MAXLEN_STORY_TITLE, MAXLEN_SENTENCE, NotEnoughActivePlayers
from django.contrib import messages
from django.contrib.auth.decorator... |
import pandas as pd
import numpy as np
from collections import namedtuple
Community = namedtuple('Community', 'code name pair intervention')
communities = {
'bokaa': Community('17', 'bokaa', 4, False),
'digawana': Community('12', 'digawana', 1, True),
'gumare': Community('35', 'gumare', 13, True),
'g... |
import markovify, re, os, textwrap, time
import karl_markov, c
from pygments import highlight
from pygments.lexers import CLexer
from pygments.formatters import Terminal256Formatter
from asm import asm_name
from functools import reduce
def header_names(path):
"""Generates a list of names defined in the header file... |
"""MARC21 RERO to JSON."""
from .model import marc21
__all__ = ('marc21') |
#import util
import pickle
import socket
import uuid
class CAServer():
def __init__(self, IP, PORT):
self.address = (IP, PORT)
self.socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
self.socket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
self.clients = {}
... |
#!/usr/bin/python
import time
import baseservice
from bson import ObjectId
import geoip2
from geoip2 import database
from geoip2.errors import *
import os
from pymongo import *
basepath = os.path.dirname(__file__)
class Iptocountry(baseservice.BaseService):
inst = None
def __init__(self):
Iptocoun... |
"""Implementation of :class:`PythonRationalField` class. """
from sympy.polys.domains.rationalfield import RationalField
from sympy.polys.domains.groundtypes import PythonIntegerType
from sympy.polys.domains.groundtypes import PythonRationalType
from sympy.polys.domains.groundtypes import SymPyRationalType
from symp... |
####################################
# Base WLS Domain Creation script #
####################################
from jarray import array
from java.io import File
from sets import Set
from java.io import FileInputStream
from java.util import Properties
from java.lang import Exception
import re
import ConfigParser
de... |
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
import logging
import socket
import traceback
from six.moves.socketserver import BaseRequestHandler, BaseServer, TCPServer
from pants.java.nailgun_protocol import Na... |
from __future__ import print_function
from __future__ import absolute_import
from __future__ import division
from compas.plugins import pluggable
__all__ = [
'trimesh_remesh',
'trimesh_remesh_constrained',
'trimesh_remesh_along_isoline',
]
@pluggable(category='trimesh')
def trimesh_remesh(mesh, target_... |
import sublime
import sublime_plugin
from .lint import persist
from .lint import quick_fix
from .lint import util
MYPY = False
if MYPY:
from typing import Callable, List, Optional, TypedDict
LintError = persist.LintError
QuickAction = quick_fix.QuickAction
Event = TypedDict("Event", {"x": float, "y"... |
# -*- 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):
# Changing field 'Building.wheelchair'
db.alter_column(u'campi_building', 'wheelchair', self.gf('django.db.... |
# coding=utf-8
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import matplotlib.animation as animation
import matplotlib.pyplot as plt
import numpy as np
import scipy.integrate
import scipy.special
import seaborn as s... |
import os, errno
from argparse import ArgumentParser
from argparse import RawTextHelpFormatter
from subprocess import PIPE, Popen, call
import django
from django.core.management import call_command
from django_jinja.management.commands import makemessages
SOURCE_LANG = "en"
def _get_locale_dirs(resources):
"""... |
#!/usr/bin/python2.7
# -*- coding: utf-8 -*-
"""
Commercial Airline Passenger Numbers Rendering Tool
Usage:
./plot.py render <stats_file> <image_file>
./plot.py (-h | --help)
Options:
-h, --help Show this screen and exit.
"""
import matplotlib as mpl
mpl.use('Agg') # This needs to be called before mpl... |
# This testfile tests SymPy <-> NumPy compatibility
# Don't test any SymPy features here. Just pure interaction with NumPy.
# Always write regular SymPy tests for anything, that can be tested in pure
# Python (without numpy). Here we test everything, that a user may need when
# using SymPy with NumPy
from __future__ ... |
"""
To understand why this file is here, please read:
http://cookiecutter-django.readthedocs.org/en/latest/faq.html#why-is-there-a-django-contrib-sites-directory-in-cookiecutter-django
"""
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.conf import settings
from django.db import migration... |
"""Calendar module for Zinnia templatetags"""
from datetime import date
from calendar import HTMLCalendar
from django.utils.dates import MONTHS
from django.utils.dates import WEEKDAYS_ABBR
from django.utils.formats import get_format
from django.utils.formats import date_format
from django.core.urlresolvers import reve... |
import scipy.spatial.kdtree, numpy
from scipy import version
from numpy import sin,cos,deg2rad,rad2deg,arcsin
scipy_version = ('.'.join(version.version.split('.')[0:2])).split('.')[0:2]
def match_lists(ra1, dec1, ra2, dec2, dist, numNei=1):
"""crossmatches the list of objects (ra1,dec1) with
another list of object... |
from abc import ABCMeta, abstractmethod
import numpy as np
import cv2
class Model:
__metaclass__ = ABCMeta
nParams = 0
#zwraca wektor rezyduow przy danych parametrach modelu, wektorze wejsciowym i oczekiwanych wektorze wyjsciowym
def residual(self, params, x, y):
r = y - self.fun(x, params)
... |
#!/usr/bin/env python
# coding: utf-8
# ---
# syncID: a6db1047adb34f41b9d17d6ed41f5fd5
# title: "Exploring Uncertainty in LiDAR Data using Python"
# description: "Learn to analyze the difference between rasters taken a few days apart to assess the uncertainty between days."
# dateCreated: 2017-06-21
# authors: Tris... |
import inspect
import json
from typing import Any, Callable, Dict, List, Optional, Union
from rich.box import ASCII_DOUBLE_HEAD
from rich.console import Console
from rich.syntax import Syntax
from rich.table import Table
from tabulate import tabulate
from airflow.plugins_manager import PluginsDirectorySource
from air... |
# -*- coding: utf-8 -*-
# This file helps to compute a version number in source trees obtained from
# git-archive tarball (such as those provided by githubs download-from-tag
# feature). Distribution tarballs (built by setup.py sdist) and build
# directories (produced by setup.py build) will contain a much shorter file... |
#!/usr/bin/env python
"""
Proxy tester.
"""
# Copyright (c) 2014-2015, Lev Givon
# All rights reserved.
# Distributed under the terms of the BSD license:
# http://www.opensource.org/licenses/bsd-license
import requests
import requests_futures.sessions
class ProxyTest(object):
"""
Test whether proxies are al... |
import unittest
import optparse
import os
import sys
from libavg import avg, player
import testcase
class TestApp(object):
EXIT_OK = 0
EXIT_FAILURE = 1
def __init__(self):
self.__exitOk = TestApp.EXIT_FAILURE
self.__registeredSuiteFactories = []
self.__registerd... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.