content string |
|---|
import bert
import error
import socket
import struct
class Service(object):
def __init__(self, host, port, timeout = None):
self.host = host
self.port = port
self.timeout = timeout
def request(self, kind, options=None):
if kind in ['call', 'cast']:
self._verify_opt... |
from __future__ import unicode_literals
from django.contrib.auth import get_user_model
from django.urls import reverse
from django.test import TestCase
from caffeine_oauth2.models import CoffeestatsApplication
User = get_user_model()
class CoffeestatsApplicationTest(TestCase):
def test___str__(self):
a... |
#!/usr/bin/python -u
#
#
from __future__ import absolute_import
import sys
import os
SANS_PATH = os.path.realpath( os.path.join( os.path.split( __file__ )[0], "../" ) )
sys.path.append( SANS_PATH )
import sans
class Handler( sans.ContentHandler ) :
def startData( self, line, name ) :
return False
de... |
import time
import uuid
from flask import request
from web import app
from . import get_entity
from lastfm import LastFm
from db import *
@app.route('/rest/star.view', methods = [ 'GET', 'POST' ])
def star():
id, albumId, artistId = map(request.args.getlist, [ 'id', 'albumId', 'artistId' ])
app.logger.debug('... |
# -*- coding: utf-8 -*-
"""WebSocketBaseTestCase is based on combination of Tornado
and Django test systems. It require to use decorator '@gen.coroutine'
for each test case method( see documentation: http://www.tornadoweb.org/en/stable/testing.html).
It requires implementation of 'get_app' method to initialize tornado... |
"""
Implementation of the PKCS7 algorithm.
"""
import struct
from .exceptions import InvalidBlockSize, InvalidMessage
__all__ = ["pad", "unpad", "MAX_BLOCK_SIZE"]
MAX_BLOCK_SIZE = 0x100
def pad(buf, block_size=MAX_BLOCK_SIZE):
"""Padded with the number, N, of bytes padded repeated N times."""
if not isinsta... |
"""
Place number puzzle Google CP Solver.
http://ai.uwaterloo.ca/~vanbeek/Courses/Slides/introduction.pdf
'''
Place numbers 1 through 8 on nodes
- each number appears exactly once
- no connected nodes have consecutive numbers
2 - 5
/ | X | \
1 - 3 - 6 - 8
\ | X | /
4 - 7
""
... |
"""Routine to "compile" a .py file to a .pyc file.
This module has intimate knowledge of the format of .pyc files.
"""
import enum
import importlib._bootstrap_external
import importlib.machinery
import importlib.util
import os
import os.path
import sys
import traceback
__all__ = ["compile", "main", "PyCompileError",... |
# -*- coding: utf-8 -*-
from openerp import models, api, fields
import logging
_logger = logging.getLogger(__name__)
class product_template(models.Model):
_inherit = 'product.template'
@api.one
@api.depends('ean13')
def _calculate_isbn(self):
isbn = False
if self.ean13:
e... |
from fsgamesys.drivers.messdriver import MessDriver
from fsgamesys.options.option import Option
from fsgamesys.platforms.cpc.cpcconstants import (
CPC_JOYSTICK_TYPE,
CPC_MAME_ROMS_464,
CPC_MAME_ROMS_664,
CPC_MAME_ROMS_6128,
CPC_PORTS,
)
# <port tag=":controller_type" type="CONFIG" mask="3" defvalue... |
import re
# nearly lexicographic order, but with longest names first, to avoid fake
# matches in the regular expression below; Guinea_Bissau must go before
# Guinea, Dominican_Republic before Dominica and Nigeria before Niger
COUNTRY_CODE = """\
Afghanistan,AFG
Albania,ALB
Algeria,DZA
American_Samoa,ASM
Andorra,AND
An... |
from pathlib import Path
from typing import Dict
from typing import Optional
from typing import Type
import config as _config
from typing import Set
class SDConfig:
def __init__(self) -> None:
try:
self.JOURNALIST_APP_FLASK_CONFIG_CLS = (
_config.JournalistInterfaceFlaskConfi... |
from helper_functions import *
from scipy.ndimage.measurements import label
from sklearn.svm import LinearSVC
from moviepy.editor import VideoFileClip
import matplotlib.image as mpimg
import matplotlib.pyplot as plt
import numpy as np
import pickle
import os
# Extract HOG and color features from the dataset
feature_e... |
#!/usr/bin/env python
# vim: set fileencoding=utf-8 :
# @author: Tiago de Freitas Pereira <<EMAIL>>
# @date: Wed 11 May 2016 09:39:36 CEST
import numpy
def scale_mean_norm(data, scale=0.00390625):
mean = numpy.mean(data)
data = (data - mean) * scale
return data, mean
"""
Data
"""
class DataShuffler... |
from django import template
from django.contrib.sites.shortcuts import get_current_site
from django.contrib.contenttypes.models import ContentType
register = template.Library()
@register.inclusion_tag('includes/social_links.html', takes_context=True)
def social_links(context, object, user=None, authed=False, downabl... |
from .request import Request
from .response import Response
from .part import Part
from .stat import Stat
from .primitives import UString, Int, Vector
class ID(Part):
"""
"""
parts = (
("scheme", UString),
("id", UString),
)
class ACL(Part):
"""
"""
READ_PERM = 1 << 0
... |
try:
import wx
except ImportError:
raise ImportError("The wxPython module is required to run this program")
import copy
import os
import shutil
from resources.base import BEEFBaseResource
from resources.enum import EResource
from resources.enum import ELight
class BEEFLight(BEEFBaseResource):
def __init__(self, t... |
"""Tests for workflow specific imports."""
from datetime import date
from os.path import abspath
from os.path import dirname
from os.path import join
from integration.ggrc.converters import TestCase
from ggrc import db
from ggrc.converters import errors
from ggrc_workflows.models.task_group import TaskGroup
from ggr... |
"""Lit runner configuration."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
import lit.formats
from lit.llvm import llvm_config
from lit.llvm.subst import ToolSubst
# Lint for undefined variables is disabled as config is not defined inside th... |
from _emerge.AbstractDepPriority import AbstractDepPriority
class DepPriority(AbstractDepPriority):
__slots__ = ("satisfied", "optional", "rebuild")
def __int__(self):
"""
Note: These priorities are only used for measuring hardness
in the circular dependency display via digraph.debug_print(),
and nothing mo... |
import pprint
import cStringIO as StringIO
import itertools
from collections import OrderedDict
import theano
import theano.tensor as T
import nested_structures
import pandas as pd
import jinja2
from .template import (OPERATOR_TEMPLATE, FUNCTION_HEADER_TEMPLATE,
CYTHON_HEADER_TEMPLATE)
CTYPE_B... |
import sys
from setuptools import setup
# from distutils.core import setup
# test with an old version of Python that we'll never normally use
if sys.version_info[:2] == (3, 5):
# die intentionally to signal that we're using the old python version
sys.exit(1)
setup(
name="conda-build-test-project",
ver... |
# -*- coding: utf-8 -*-
import os
import re
from setuptools import setup, find_packages
def _get_version():
v_file_path = os.path.join(os.path.dirname(os.path.abspath(__file__)),
'rest_arch', '__init__.py')
ver_info_str = re.compile(r".*version_info = \((.*?)\)", re.S). \
... |
import math
from seleniumbase import BaseCase
class DownloadTests(BaseCase):
def test_download_files(self):
self.open("https://pypi.org/project/seleniumbase/#files")
pkg_header = self.get_text("h1.package-header__name").strip()
pkg_name = pkg_header.replace(" ", "-")
whl_f... |
"""
Test monitors for specific properties such as default periods, correct
handling of projection matrices, etc.
.. moduleauthor:: Paula Sanz Leon <<EMAIL>>
.. moduleauthor:: Marmaduke Woodman <<EMAIL>>
"""
import unittest
import numpy
if __name__ == "__main__":
from tvb.tests.library import setup_test_console_... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
###############################################################################
# Virial equation of state implementation
###############################################################################
from scipy import zeros, log, exp
from scipy.constants import R
from lib.... |
import pdb
import matplotlib.pyplot as plt
import numpy as np
import scipy
from scipy.sparse import csr_matrix, hstack, vstack
import graph_tool.all as gt
from sklearn import cross_validation
from sklearn import metrics
from sklearn.metrics import classification_report, roc_curve, auc
from sklearn.dummy import DummyC... |
import sys
import re
def find_all(a_str, sub):
start = 0
while True:
start = a_str.find(sub, start)
if start == -1: return
yield start
start += len(sub) # use start += 1 to find overlapping matches
def parse_vcf(vcf_file_name, vcf_lines, vcf_headers, add_sname=True):
header... |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file '/home/yc/code/calibre/calibre/src/calibre/gui2/dialogs/choose_format.ui'
#
# by: PyQt4 UI code generator 4.8.5
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore, QtGui
try:
_fromUtf8 = QtCore.QStrin... |
import json
import requests
from django.conf import settings
from django.db.models.signals import post_save, pre_delete
from django.dispatch import receiver
from karrot.conversations.models import Conversation
from karrot.groups import roles, stats
from karrot.groups.emails import prepare_user_became_editor_email
fro... |
import pytest
import json
from unittest import mock
from django.core.urlresolvers import reverse
from .. import factories as f
from taiga.base.utils import json
from taiga.base import exceptions as exc
from taiga.users.models import AuthData
pytestmark = pytest.mark.django_db
fake_token = "access.secret"
def t... |
from django.urls import include, path, re_path
from django.contrib import admin
from course.views import index, subject, course, enroll, time, news
handler404 = 'course.views.index.handler404'
handler500 = 'course.views.index.handler500'
urlpatterns = [
path('admin/', admin.site.urls),
re_path(r'^$', index.i... |
"""
raven.contrib.django.serializers
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2010-2012 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
from __future__ import absolute_import
from __future__ import unicode_literals
from django.conf import settings
from django... |
"""scalable font"""
from gfxlcd.abstract.font import Font
def scaleBinaryRow(binaryRow, multiplier):
originalRow = bin(binaryRow).replace("0b", "")
scaledRow = ""
for binaryDigit in originalRow:
for i in range(0, multiplier):
scaledRow += binaryDigit
return int(scaledRow, 2)
def ... |
from . import oemedical_hospital_bed
from . import oemedical_hospital_building
from . import oemedical_hospital_or
from . import oemedical_hospital_unit
from . import oemedical_hospital_ward
from . import oemedical_operational_area
from . import oemedical_operational_sector
from . import oemedical_surgery |
from __future__ import division
import chimera
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.animation as animation
def animate(image, nframes, vmin, vmax, scale, cmap, fps, outtype):
"""
Generate animation from CHIMERA image cube.
Parameters
----------
image : string... |
from django.conf.urls import include, url
from django.conf.urls.static import static
from django.conf import settings
from django.contrib import admin
from django.contrib.sitemaps.views import sitemap as sitemap_view
from parliament.core.api import docs as api_docs
from parliament.core.api import no_robots
from parlia... |
# -*- coding: utf-8 -*-
"""Lesson-related database interface for SQLAlchemy.
"""
from __future__ import absolute_import
from __future__ import print_function
from __future__ import unicode_literals
from sqlalchemy.schema import Column, ForeignKey, CheckConstraint, \
UniqueConstraint, ForeignKeyConstraint, Table... |
import copy
import feature_compiler
import unittest
class FeatureCompilerTest(unittest.TestCase):
"""Test the FeatureCompiler. Note that we test that the expected features are
generated more thoroughly in features_generation_unittest.cc. And, of course,
this is most exhaustively tested through Chrome's compilati... |
from collections import namedtuple
import logging
from django.utils.translation import ugettext as _
from molly.utils.views import BaseView
from molly.utils.breadcrumbs import *
logger = logging.getLogger(__name__)
Service = namedtuple('Service', ['slug', 'name', 'last_updated',
'se... |
# pylint: disable-msg=no-name-in-module,import-error
from distutils.cmd import Command
from os import getcwd
from subprocess import check_call
from setuptools import find_packages, setup
class PylintCommand(Command):
description = 'run pylint on Python source files'
user_options = []
def initialize_option... |
from __future__ import annotations # Needed for Python 4.0 type annotations
from typing import Any, Dict, Optional as Optional_Type
from flask import g, session
from flask_babel import lazy_gettext as _
from flask_login import current_user
from openatlas.forms.field import TreeField
from openatlas.forms.setting imp... |
#/u/GoldenSights
import praw
import sqlite3
import time
import string
APP_ID = ""
APP_SECRET = ""
APP_URI = ""
APP_REFRESH = ""
# https://www.reddit.com/comments/3cm1p8/how_to_make_your_bot_use_oauth2/
USERAGENT = ""
#This is a short description of what the bot does. For example "/u/GoldenSights' Newsletter bot"
SUBR... |
# -*- coding=utf8 -*-
import time
import resource
import thriftpy
from thriftpy.protocol import TBinaryProtocolFactory
from thriftpy.thrift import TClient
from thriftpy.transport import (
TBufferedTransportFactory,
TSocket,
)
from locust import (
Locust,
events,
task,
TaskSet,
)
# 避免客户端出现too ma... |
import sys
import Tkinter
import ttk
import tkFont
from support_widget import Widget
from support_grow import Grow
import pyuser as pu
class List( Widget ):
def __init__( self, s_name = None, o_parent = 'auto' ):
Widget.__init__( self, s_name = s_name, o_parent = o_parent )
assert self.dparent.isLayout... |
import Queue
import threading
from receita.tools.client import Client
class Runner(object):
"""Client runner.
We are keeping multiple requests running at the same time, but
in a limited fashion. This will allow a better performance while
getting data from the web service.
This class assumes tha... |
from webob import Response
from webob.exc import HTTPNotFound, HTTPPreconditionFailed, HTTPBadRequest, \
HTTPConflict
from lunr.storage.controller.base import BaseController, lock
from lunr.common import logger
from lunr.storage.helper.utils import NotFound, AlreadyExists
class CloneController(BaseController):
... |
'''
/*******************************************************************************
*
* Copyright (c) 2015 Fraunhofer FOKUS, All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Sof... |
##==============
## Installer
##===============
import xbmc,xbmcaddon,xbmcgui,os,time
import skindefault
import downloader
import extract
import common
AddonID = 'plugin.program.VikingsWizard'
ADDON=xbmcaddon.Addon(id='plugin.program.VikingsWizard')
HOME = xbmc.translatePath('special://home/')
PATH = "Vikings Wiza... |
import re
import os
import csv
import xml.etree.ElementTree as ET
import logging
import glob
import json
from datetime import datetime
from collections import OrderedDict
from bs4 import BeautifulSoup #html parser
class RunParser(object):
"""Parses an Illumina run folder. It generates data for statusdb
notab... |
from operator import itemgetter
import pytest
from dvc.hash_info import HashInfo
from dvc.objects.file import HashFile
from dvc.objects.tree import Tree, _merge
@pytest.mark.parametrize(
"lst, trie_dict",
[
([], {}),
(
[
{"md5": "def", "relpath": "zzz"},
... |
import os
from typing import Optional
from PyQt5.QtCore import QObject, pyqtSlot
from UM.Qt.QtApplication import QtApplication
from UM.Signal import Signal
from .SubscribedPackagesModel import SubscribedPackagesModel
class DiscrepanciesPresenter(QObject):
"""Shows a list of packages to be added or removed. The ... |
#!/usr/bin/python
# -*- coding: iso-8859-1 -*-
import serial
import AHRS_Madgwick
import socket
from time import sleep
def mean_filter(signal):
sum = 0.0
for i in signal:
sum += i
return sum / len(signal)
def filtered_angle(sample, samples_vector):
if len(samples_vector) < 5:
samples_vector.append(sample)
... |
from openerp import fields, models
class Tag(models.Model):
_inherit = 'myo.tag'
mfile_ids = fields.Many2many(
'myo.mfile',
'myo_mfile_tag_rel',
'tag_id',
'mfile_id',
'Media Files'
)
class MediaFile(models.Model):
_inherit = 'myo.mfile'
tag_ids = fields.... |
"""
byceps.blueprints.admin.brand.views
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:Copyright: 2006-2019 Jochen Kupperschmidt
:License: Modified BSD, see LICENSE for details.
"""
from flask import abort, request
from ....services.brand import service as brand_service, \
settings_service as brand_settings_service
from .... |
# -*- coding: utf-8 -*-
import uuid
from django.db import models
from django.utils.text import slugify
class Room(models.Model):
slug = models.SlugField()
name = models.CharField(max_length=60)
def __str__(self):
return self.name
def save(self, *args, **kwargs):
self.slug = slugify(... |
#!/usr/bin/env python3
"""
This a script that takes the result of automatic postediting encoded as a
sequence of <keep>, <delete> and insert operations and applies them on the
original text being post-edited.
The inverse script to this one is 'postedit_prepare_data.py'.
"""
# tests: lint, mypy
import argparse
from ... |
##
#Name: Sam Kantor
##
import random
TeamARolls = []
TeamBRolls = []
TeamA_Attacking = False
TeamB_Attacking = False
TeamA_LostMen = 0
TeamB_LostMen = 0
keepGoing = True
class Team:
'''
(None) --> (None)
Used to track amount of men on teams
'''
def __init__ (self):
while True:
... |
import numpy as np
from funcs import *
import sys
''' A Naive Baseline of Task Assignment '''
def random_assignment(data, maxlevel_budget=15):
n_task = data['n_task'] # number of tasks
n_worker = data['n_worker'] # number of workers
max_budget = n_task * maxlevel_budget # maximum budget
n_rec = maxlev... |
from typing import Any
from django.db import ProgrammingError
from confirmation.models import generate_realm_creation_url
from zerver.lib.management import CommandError, ZulipBaseCommand
from zerver.models import Realm
class Command(ZulipBaseCommand):
help = """
Outputs a randomly generated, 1-time-use link... |
import sys, os, traceback, optparse
import time
import re
import requests
from bs4 import BeautifulSoup
import csv
#Station_ID_List = ['70472', '70469', '78939', '76825', '70673', '72111', '72106', '72398',
#'74884', '71916', '60210', '75911', '7918', '71439', '102295', '64921', '8372', '72104',
#'163161', '76835', '... |
# -*- coding: utf-8 -*-
"""
Created on Thu May 22 13:26:35 2014
@author: Meagan
@author: Pat
"""
from collections import defaultdict
from collections import Counter
import json
import re
bigcor = open('corpus/hiligaynon.txt').read().decode('utf-8')
VOWELS = list(u'aeiou')
def vocabularize(text):
text = text.lowe... |
'''Final assignment. This is a program that reads the gamescore.csv file, which has game information regarding a football match.
The program has a number of pre-created statements. Based on the score, by quarter (and assuming 2 OT), the program will
print the box score, game summary, and auto-generate a short report a... |
import os
import pytest
import re
hostenv = os.environ['SECUREDROP_TESTINFRA_TARGET_HOST']
@pytest.mark.parametrize('sysctl_opt', [
('net.ipv4.conf.all.accept_redirects', 0),
('net.ipv4.conf.all.accept_source_route', 0),
('net.ipv4.conf.all.rp_filter', 1),
('net.ipv4.conf.all.secure_redirects', 0),
('net.i... |
import numpy as np
import matplotlib.pyplot as plt
error_gt_refiner = np.array(np.loadtxt('reproj_error_gt_refiner.txt'))
error_gt = np.array(np.loadtxt('reproj_error_gt.txt'))
error_vo_refiner = np.array(np.loadtxt('reproj_error_refiner.txt'))
error_vo = np.array(np.loadtxt('reproj_error.txt'))
# plot errors
fig_sca... |
import hmac
import re
from base64 import b64encode, b64decode
from datetime import datetime
from functools import wraps
from hashlib import sha1
from urlparse import parse_qs
from flask import Blueprint, make_response, request, g, json, abort
from pymongo.errors import OperationFailure, DuplicateKeyError
from . impo... |
import os
import functools
import codecs
import pickle
from . import utils
class Memozo(object):
def __init__(self, path='./'):
self.base_path = path
memozo_file = os.path.join(self.base_path, utils.MEMOZO_FILE_NAME)
if not os.path.exists(memozo_file):
with codecs.open(memoz... |
# -*- coding: utf-8 -*-
import re
p_point = re.compile('Point\((?P<lat>[-0-9.]+)\s(?P<lon>[-0-9.]+)\)')
p_url = re.compile('https://www.openstreetmap.org/(?P<type>.*)/(?P<id>\d+)')
class OsmLintEntity(object):
"""
Since our entities can either be of various types (PyOsmium, osmread...), this is wrapper to a... |
from django.core.management.commands import loaddata
from django.core.management.base import CommandError
from django.core import serializers
from django.db import (connections, router, transaction, DEFAULT_DB_ALIAS,
IntegrityError, DatabaseError)
import os
class Command(loaddata.Command):
def load_label(self... |
# urllib3/poolmanager.py
##
##
##
##
import logging
from ._collections import RecentlyUsedContainer
from .connectionpool import HTTPConnectionPool, HTTPSConnectionPool
from .connectionpool import get_host, connection_from_url, port_by_scheme
from .exceptions import HostChangedError
from .request import RequestMet... |
"""
Write an email address ldif for email routing.
This script writes the mail-db.ldif file used for routing emails at the mail
exchange.
Configuration
-------------
This export is affected by the following settings in cereconf:
cereconf.LDAP_MAIL
dn
Distingushed name of the tree where objects are placed... |
"""
freelance_sociology.py
A utility to run the OKDigger tools
Written by Chris Taylor, 3/5/15
"""
import ages
import build_database
import correlations
import searches
import sys
import thecrunch
def getChoice():
sys.stdout.write("Choice: ")
choice = raw_input()
return choice
def printMenu():
print "#########... |
import zeit.cms.checkout.interfaces
import zeit.cms.interfaces
import zeit.cms.repository.interfaces
import zeit.cms.syndication.interfaces
import zeit.cms.workingcopy.interfaces
import zope.app.locking.interfaces
import zope.cachedescriptors.property
import zope.component
import zope.event
import zope.interface
clas... |
#!/usr/bin/env python
"""
SlipStream Client
=====
Copyright (C) 2014 SixSq Sarl (sixsq.com)
=====
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-... |
# -*- coding: utf-8 -*-
"""
pygments.lexers.ecl
~~~~~~~~~~~~~~~~~~~
Lexers for the ECL language.
:copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
import re
from ..lexer import RegexLexer, include, bygroups, words
from ..token import T... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from setuptools import setup
setup(
name='pyunlocbox',
version='0.5.2',
description='Convex Optimization in Python using Proximal Splitting',
long_description=open('README.rst').read(),
long_description_content_type='text/x-rst',
author='EPFL LTS2... |
import msvc6prj, msvc_common
from msvc6prj import ProjectGeneratorMsvc6
class ProjectGeneratorEvc4(ProjectGeneratorMsvc6):
# --------------------------------------------------------------------
# basic configuration
# --------------------------------------------------------------------
def getS... |
from django.db import models
class MALTRow(models.Model):
"""
Specifies a row for 'Monthly Aggregate Lite Table (MALT)'
See https://docs.google.com/document/d/1QQ3tzFPs6TWiPiah6YUBCrFILKih6OcJV7444i50o1U/edit
"""
month = models.DateField(db_index=True)
# Using TextField instead of Cha... |
from __future__ import print_function # for Python 3
import sys
import copy
from numpy import linspace, zeros, sin, pi, array
from pylab import subplot, plot, show
from tlfem.genmesh import Gen2Dregion, NlSpace
from tlfem.solver import Solver
from tlfem.util import GetITout
from tlfem.f... |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
import csv
import json
import os
import string
from django.conf import settings
from django.contrib.gis.geos import GEOSGeometry
from django.core.management.base import BaseCommand, CommandError
from django.db.models import Count
from s... |
"""
# Copyright (c) 02 2015 | surya
# 27/02/15 <EMAIL>
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This ... |
# -*- coding: cp1251 -*-
import os
import sys
from datetime import datetime
import requests
FILENAME = "_input.txt"
RES_DIR = "output"
def main():
t = datetime.now()
glob = 0
groupNum = 1
if not os.path.isfile(FILENAME):
print 'No _input.txt file'
sys.exit()
if not os.path.isdir(... |
## Importing helper class for setting up a reachability planning problem
from hpp.corbaserver.rbprm.rbprmbuilder import Builder
# Importing Gepetto viewer helper class
from hpp.gepetto import Viewer
import time
import math
import omniORB.any
from planning.configs.walk_bauzil_stairs import *
from hpp.corbaserver impor... |
import pygame
import time
import utils
###########
# Classes #
###########
# Renders an area of "darkness" around the camera's view
class DarknessLayer(object):
# The piece rendered at the top of the screen
topSurf = None
# The piece rendered at the bottom
btmSurf = None
# The size of the curtain... |
import numpy as np
import pickle
from malpi.optimizer import *
from malpi import optim
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
from optparse import OptionParser
def stats(arr, msg=""):
mi = np.min(arr)
ma = np.max(arr)
av = np.mean(arr)
std = np.std(arr)
arr_abs = np... |
from .fetchers import NUPermissionsFetcher
from .fetchers import NUMetadatasFetcher
from .fetchers import NUGlobalMetadatasFetcher
from bambou import NURESTObject
class NUNSGatewaysCount(NURESTObject):
""" Represents a NSGatewaysCount in the VSD
Notes:
NSGateway count is a summary object... |
from django.db import transaction
from jsonobject import JsonObject
from jsonobject.properties import StringProperty, BooleanProperty, DecimalProperty, ListProperty, IntegerProperty,\
FloatProperty, DictProperty
from corehq.apps.commtrack.models import SupplyPointCase, CommtrackConfig, CommtrackActionConfig
from co... |
import os
import json
from enum import Enum
from attributes import AttributeSet
from entity import Entity
from entity_database import EntityDatabase
ItemType = Enum("ItemType", "WEAPON ARMOR HEALING")
base = os.path.dirname(__file__)
data_file = os.path.join(base, "..", "data", "items.json")
item_database = None
#... |
from __future__ import (absolute_import, division, print_function)
import unittest
import mantid
from sans.state.calculate_transmission import (StateCalculateTransmission, StateCalculateTransmissionLOQ,
get_calculate_transmission_builder)
from sans.state.data import get_d... |
#!/usr/bin/python3
from __future__ import print_function
import os
import sys
import re
# Macros for SORT_KEY
SORT_QTY = 0 # Absolute number of hits that a SA rule has gained
SORT_SCORE = 1 # The score of a SA rule
# Minimum required records, a rule was hit
REQ_MIN_QTY = 2
# Sort table
SORT_KEY = SORT... |
#!/usr/bin/python
#coding:utf-8
from __future__ import print_function, unicode_literals
import time
import types
import threading
#
class UploadInfo(object):
UPLOAD_STATE_WAITING = 0
UPLOAD_STATE_PROCESSING = 1
UPLOAD_STATE_DONE = 2
UPLOAD_STATE_ERROR = -1
UPDATE_TYPE_ADD = 1
UPDATE_TYPE_REMOVE = 2
UP... |
#! /usr/bin/env python
# compute the formant trajectories :
# first try:
# compute LPC coefficients
# compute the poles of corresponding filter
# get the 4 poles with highest peak, avoid duplicates?
import time
import numpy as np
# import scikits.audiolab as al
import scikits.talkbox as... |
from __future__ import unicode_literals
from django.core.exceptions import FieldError
from django.test import SimpleTestCase, TestCase
from .models import (
AdvancedUserStat, Child1, Child2, Child3, Child4, Image, LinkedList,
Parent1, Parent2, Product, StatDetails, User, UserProfile, UserStat,
UserStatRes... |
"""Test Home Assistant yaml loader."""
import io
import logging
import os
import unittest
from unittest.mock import patch
import pytest
from homeassistant.config import YAML_CONFIG_FILE, load_yaml_config_file
from homeassistant.exceptions import HomeAssistantError
import homeassistant.util.yaml as yaml
from homeassis... |
import proto # type: ignore
__protobuf__ = proto.module(
package="google.ads.googleads.v8.enums",
marshal="google.ads.googleads.v8",
manifest={"PlacementTypeEnum",},
)
class PlacementTypeEnum(proto.Message):
r"""Container for enum describing possible placement types. """
class PlacementType... |
# --*-- coding: utf-8 --*--
import logging
from managers.manager import Manager
from orm.common import *
from tools.translations import trlocal as _
_logger = logging.getLogger('listener.' + __name__)
class pgdb_exception(Exception): pass
class pgdbmodelManager(Manager):
"""
Выполняет манипуляции с реляционной баз... |
from io import StringIO
from unittest import TestCase
from checkbox.parsers.efi import EfiParser
class EfiResult:
def __init__(self):
self.device = None
def setEfiDevice(self, device):
self.device = device
class TestCputableParser(TestCase):
def getParser(self, string):
stre... |
from Gelatin import INDENT
from .Token import Token
class Number(Token):
def __init__(self, number):
self.data = number
def value(self):
return self.data
def re_value(self):
return str(self.data)
def dump(self, indent=0):
return INDENT * indent + str(self.data) |
"""Helper routines for EXTENSION command"""
# History
# 12-Oct-2007 JKP Initial version
# 14-Nov-2007 Changed to handle Unicode mode
# 21-Feb-2008 Correct error msg for int, float out of range
# 27-Jun-2008 Add checkrequiredparams function
# 12-Jul -2008 Add processcmd function to handle general execution pat... |
"""The configs create command."""
from googlecloudsdk.api_lib.runtime_config import util
from googlecloudsdk.calliope import base
from googlecloudsdk.core import log
class Create(base.CreateCommand):
"""Create runtime-config resources.
This command creates a new runtime-config resource with the specified name
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.