src stringlengths 721 1.04M |
|---|
# -*- coding: utf-8 -*
import sys, re
import unicodedata
#reload(sys)
#sys.setdefaultencoding("utf-8")
class LangConfig:
def __init__(self):
self.avg_keywords = []
self.sum_keywords = []
self.max_keywords = []
self.min_keywords = []
self.count_keywords = []
self.junction_keywords = []
self.disjunctio... |
#coding=utf-8
from __future__ import with_statement
import sys
from pyke import knowledge_engine
from pyke import krb_compiler
from pyke import krb_traceback
from pyke import goal
import ibm_db
import ibm_db_dbi
import datetime
import time
import recommend_area
import BaseClass
import random
import area_coordinate_tra... |
from __future__ import absolute_import
from __future__ import print_function
from forecast import make_job_file, JobState, process_arguments, load_sys_cfg
import json
import logging
import sys,glob
import os.path as osp
simulations_path = osp.abspath('simulations') # copy here job_id/wfc
catalog_path = osp.join(sim... |
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
"""
Copyright © 2011: Lattyware <gareth@lattyware.co.uk>
This file is part of unrest.
unrest 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... |
"""
From the 26 March meeting, the plan was:
1) Fix 2D separation and overall R flux ratio. Find best fit PSF.
Issues... the best fit PSF can't just be a Gaussian. It is naturally the convolution of
multiple functional forms, i.e. something that is positive everywhere. On a quick search,
I can't find any obvious para... |
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2009-2010 Nick Hall
# Copyright (C) 2011 Tim G L Lyons
#
# 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... |
import pytest
from django.conf import settings
from django.test import override_settings
from django.utils.timezone import now
from tests import assert_num_queries
from pretix.base.models import Event, Organizer
from pretix.multidomain.models import KnownDomain
from pretix.multidomain.urlreverse import build_absolute_... |
# -*- coding: utf-8 -*-
from olympia.amo.tests import TestCase
from olympia.addons.models import Category
from olympia.constants.applications import APPS
from olympia.constants.base import ADDON_EXTENSION, ADDON_PERSONA
from olympia.constants.categories import CATEGORIES
from olympia.landfill.categories import generate... |
# -*- coding: utf-8 -*-
#
# src documentation build configuration file, created by
# sphinx-quickstart on Wed Apr 8 13:46:00 2015.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# All c... |
# -*- coding: utf-8 -*-
# ####################################################################
# Copyright (C) 2005-2010 by the FIFE team
# http://www.fifengine.net
# This file is part of FIFE.
#
# FIFE is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General ... |
from time import sleep, strftime
from datetime import datetime
# from requests.packages.urllib3.exceptions import InsecureRequestWarning
import requests, random
try:
from faker import Faker
fake = Faker()
except Exception:
print("Run \"pip install Faker\" using the correct pip path and you should be fine.")
# impor... |
#! /usr/bin/env python3
from collections import Counter
from operator import itemgetter
def cyclo_seq( spectrum_file, spectrum_table_file ):
N, spectrum = parse_spectrum_file( spectrum_file )
spectrum_table = parse_spectrum_table( spectrum_table_file )
aa_weights = set(spectrum_table.values())
peptides = list(fin... |
#!/usr/bin/env python
# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
### BEGIN LICENSE
# Copyright (C) 2014 <Arulalan.T> <arulalant@gmail.com>
# This program is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 3, as publish... |
from django.views import View
from django.shortcuts import render
import datetime
from django.conf import settings
class AppTimes(View):
def get(self, request):
servers = dict((("%s" % s['_id'], s['page_load']) for s in self.stats))
data = servers
chart_name = "app_times"
chart_typ... |
# -*- coding: utf-8 -*-
__author__ = """Chris Tabor (dxdstudio@gmail.com)"""
if __name__ == '__main__':
from os import getcwd
from os import sys
sys.path.append(getcwd())
from MOAL.helpers.display import Section
from MOAL.helpers.display import print_h3
from MOAL.helpers import datamaker as dmkr
from MOA... |
# -*- coding: utf-8 -*-
"""
/***************************************************************************
A QGIS plugin
CLUZ for QGIS
-------------------
begin : 2016-23-02
copyright : (C) 2016 by Bob Smith, DICE
... |
# approximate sum of two von mises with a single von mises
import numpy as np
from scipy.stats import vonmises
def sim(a, b, plot=False, n=int(1e8)):
unwrapped = vonmises.rvs(a, size=n) + vonmises.rvs(b, size=n)
unwrapped = unwrapped
wrapped = (unwrapped + np.pi) % (2 * np.pi) - np.pi
kappa, _, _ = von... |
#!/usr/bin/env python3
# Copyright (c) 2014-2016 The Presidentielcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
#
# Test spending coinbase transactions.
# The coinbase transaction in block N can appear in blo... |
# -*- coding: utf-8 -*-
"""
Anything natural language related should be abstracted into this file.
"""
__title__ = 'newspaper'
__author__ = 'Lucas Ou-Yang'
__license__ = 'MIT'
__copyright__ = 'Copyright 2014, Lucas Ou-Yang'
import re
import math
import operator
from collections import Counter
from . import settings
... |
"""
MIT License
Copyright (c) 2016 Emotly Contributors
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, pu... |
# -*- coding: utf-8 -*-
import sys
from heapq import heappush, heappop
import itertools
from functools import total_ordering
def is_scalar(obj):
return not hasattr(obj, '__iter__') or isinstance(obj, basestring)
def prefixed(arg, prefix=None):
if prefix and not arg.startswith(prefix):
arg = prefix ... |
'''
Copyright 2013 Cosnita Radu Viorel
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
documentation files (the "Software"), to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute... |
# #!/usr/bin/env python3
# # -*- coding: utf-8 -*-
#
# __author__ = 'zhangxianqiang'
#
# import asyncio, logging
#
# import aiomysql
#
# def log(sql, args=()):
# logging.info('SQL: %s' % sql)
#
# @asyncio.coroutine
# def creat_pool(loop, **kw):
# logging.info('creat database connection pool...')
# global __... |
from unittest import TestCase
from veritranspay.response.response import VirtualAccountBniChargeResponse, VirtualAccountPermataChargeResponse, \
VirtualAccountBcaChargeResponse, VirtualAccountMandiriChargeResponse
class VirtualAccountPermataChargeResponseTests(TestCase):
"""
https://api-docs.midtrans.com... |
# -*- coding: utf-8 -*-
#############################################################################
# Project : Mandriva Linux
# Module : rpmlint
# File : InitScriptCheck.py
# Author : Frederic Lepied
# Created On : Fri Aug 25 09:26:37 2000
# Purpose : check init scri... |
"""
Smart Align
Provides Aligning functionality for various Revit Objects.
TESTED REVIT API: 2015 | 2016
Copyright (c) 2014-2016 Gui Talarico
github.com/gtalarico | @gtalarico
This script is part of PyRevitPlus: Extensions for PyRevit
github.com/gtalarico | @gtalarico
-------------------------------------... |
""" Test using root marathon.
This test suite imports all common tests found in marathon_common.py which are
to be tested on root marathon and MoM.
In addition it contains tests which are specific to root marathon, specifically
tests round dcos services registration and control and security.
"""
import... |
"""Admin classes for the ``people`` app."""
from django.contrib import admin
from django.utils.translation import ugettext_lazy as _
from hvad.admin import TranslatableAdmin
from . import models
class NationalityAdmin(TranslatableAdmin):
"""Admin for the ``Nationality`` model."""
list_display = ['get_name',... |
from haystack.backends import BaseEngine
from haystack.backends.solr_backend import SolrSearchBackend, SolrSearchQuery
from haystack.constants import VALID_FILTERS, FILTER_SEPARATOR, DEFAULT_ALIAS, ITERATOR_LOAD_PER_QUERY
__author__ = 'Carrycat'
class EventSolrSearchBackend(SolrSearchBackend):
def _process_resul... |
#
# The Multiverse Platform is made available under the MIT License.
#
# Copyright (c) 2012 The Multiverse Foundation
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentation
# files (the "Software"), to deal in the Software without restrict... |
# -*- Mode:Python; indent-tabs-mode:nil; tab-width:4 -*-
#
# Copyright (C) 2018-2019 Canonical Ltd
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 3 as
# published by the Free Software Foundation.
#
# This program is distributed in ... |
# Copyright 2017 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... |
# -*- coding: utf-8 -*-
# Copyright (c) 2009 - 2014 Detlev Offenbach <detlev@die-offenbachs.de>
#
"""
Module implementing a network monitor dialog.
"""
from __future__ import unicode_literals
from PyQt5.QtCore import Qt, QAbstractTableModel, QModelIndex, QUrl, \
QSortFilterProxyModel
from PyQt5.QtGui import QSt... |
from nrs import nsisfile
import pytest
import utils
import os
import sys
EMPTY_PATH = os.path.join(utils.SAMPLES_DIR, 'empty')
EXAMPLE1_PATH = os.path.join(utils.SAMPLES_DIR, 'example1.exe')
EMPTY_PATH = os.path.join(utils.SAMPLES_DIR, 'vopackage.exe')
def test_non_nsis():
with pytest.raises(nsisfile.HeaderNotFou... |
##############################################################################
#
# OSIS stands for Open Student Information System. It's an application
# designed to manage the core business of higher education institutions,
# such as universities, faculties, institutes and professional schools.
# The core ... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
from django.conf import settings
class Migration(migrations.Migration):
dependencies = [
('pages', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name='pa... |
"""
Support for TPLink lights.
For more details about this component, please refer to the documentation at
https://home-assistant.io/components/light.tplink/
"""
import logging
import colorsys
import time
import voluptuous as vol
from homeassistant.const import (CONF_HOST, CONF_NAME)
from homeassistant.components.li... |
#
# Copyright (C) 2016 by YOUR NAME HERE
#
# This file is part of RoboComp
#
# RoboComp 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... |
import logging
from pymongo import MongoClient
class MongoDBHandler:
def __init__(self, config_name):
# Display progress logs on stdout
logging.basicConfig(level=logging.INFO,
format='>>> %(asctime)s %(levelname)s %(message)s')
from configparser import ConfigP... |
"""
Support for SNMP enabled switch.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/switch.snmp/
"""
import logging
import voluptuous as vol
from homeassistant.components.switch import (SwitchDevice, PLATFORM_SCHEMA)
from homeassistant.const import (
... |
import httplib2
import tests
def test_gzip_head():
# Test that we don't try to decompress a HEAD response
http = httplib2.Http()
response = tests.http_response_bytes(
headers={'content-encoding': 'gzip', 'content-length': 42},
)
with tests.server_const_bytes(response) as uri:
respo... |
from django.db import models
from django.conf import settings
from django.contrib.contenttypes.models import ContentType
from django.contrib.contenttypes import fields
from django_extensions.db.fields import (ModificationDateTimeField,
CreationDateTimeField)
from django.utils.te... |
# Copyright (c) 2012, 2013 Rich Porter - see LICENSE for further details
import re
import coverage
import database
import mdb
import message
################################################################################
# ids can be given in the form range-or-id,+
# where range-or-id is [0-9]+(..[0-9]+)
parser =... |
# -*- coding: utf-8 -*-
# Copyright (c) 2015 Ericsson AB
#
# 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 ... |
import sqlite3 # sqlite 3 database
import file_check_ex # to check if there is a file
import database # creating, editing, deleting the database
import intCheck # check that it is an integar
option = None # choose what manu option they want
sqlite_file = "" # the name of the sqlite3 file
option_list = (0, 1, 2, 3) # ... |
#!/usr/bin/env python2
from __future__ import division
import itertools
import math
import sys
import numpy
import scipy.stats
import cligraph
import utils
"""
TODO:
- Auto-detect number of bins
- Fixed width or variable width bins
- Stacked bins, overlapped bins or bins next to each other
- Change which side of bi... |
#! /usr/bin/python
import math
import numpy as np
import os
import random
import re
from scipy.sparse import *
from sklearn import datasets, cross_validation
from sklearn.base import BaseEstimator, TransformerMixin
from sklearn.feature_extraction.text import CountVectorizer, VectorizerMixin
from sklearn.feature_extrac... |
#!/usr/bin/python
import ConfigParser
import RPi.GPIO as GPIO
GPIO.setwarnings(False)
GPIO.cleanup()
GPIO.setmode(GPIO.BOARD)
cfg = ConfigParser.ConfigParser()
cfg.read("../config_rpi_1_model_b.ini")
motor_1_speed_pin = int(cfg.get('motor_pins', 'motor_1_speed_pin'))
motor_1_direction_pin = int(cfg.get('motor_pins'... |
"""
problem68.py
https://projecteuler.net/problem=68
What is the maximum 16-digit string for a 'magic' 5-gon ring?
"""
from itertools import chain
flatten = chain.from_iterable
def five_gon_rings(n):
"""Return list of solutions to the 'magic' 5-gon ring problem, each line
summing to n. The empty list will b... |
#!/usr/bin/env python
from __future__ import print_function
import re
import numpy as np
import numpy.testing as npt
import logging
logging.basicConfig(level=logging.DEBUG)
import unittest
# import the module
import tomographer.mhrwtasks
import tomographer
class MHRWTasksStuff(unittest.TestCase):
def test_... |
# -*- encoding: utf-8 -*-
# vim: ts=4 sw=4 expandtab ai
"""Test class for Host Collection CLI"""
from ddt import ddt
from fauxfactory import gen_string
from robottelo.cli.contentview import ContentView
from robottelo.cli.lifecycleenvironment import LifecycleEnvironment
from robottelo.cli.factory import (
CLIFacto... |
#!/usr/bin/env python
# Copyright 2018 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""
If should_use_hermetic_xcode.py emits "1", and the current toolchain is out of
date:
* Downloads the hermetic mac toolchain
*... |
#!/usr/local/bin/python2.7
##
# OOIPLACEHOLDER
#
# Copyright 2014 Raytheon Co.
##
__author__ = 'kustert,mworden'
import os
from mi.logging import config
from mi.core.log import get_logger
from mi.dataset.dataset_parser import DataSetDriverConfigKeys
from mi.dataset.dataset_driver import DataSetDriver
from mi.dataset.... |
import pygame.font
class Button():
""" A class to create a button. """
def __init__(self, screen, msg):
"""Initialize button attributes."""
self.screen = screen
self.screen_rect = screen.get_rect()
# Set the dimensions and properties of the button.
self.width, self.he... |
from pyramid.settings import asbool, aslist
from .interfaces import IAuthSourceService
from .policy import AuthServicePolicy
from .sources import (
CookieAuthSourceInitializer,
HeaderAuthSourceInitializer,
SessionAuthSourceInitializer,
)
from .util import int_or_none, kw_from_settings
default_settings = (... |
#!/usr/bin/env python
import os
import sys
import commands
workdir = os.getcwd()
submit = True
do_hist = False
do_scalar = True
exe = "/afs/cern.ch/user/x/xju/work/h4l/h4lcode/hzzws/bsubs/run_limit.sh"
cal_opt = "pvalue" # limit,pvalue
data_opt = "obs" #obs, exp
ws_name = "combWS"
mu_name = "xs"
#mG_low = 500
#mG_... |
import numpy as np
def readDirIndex(fileName):
import json
fileDir = open(fileName)
idxDir = json.load(fileDir)['order']
fileDir.close()
order = ['1', '3', '5']
idxStart = [0, 6, 44]
return order, idxDir, idxStart
def calcAmplitude(fileNameFunc, nt, nCoo, iDir):
s = np.zeros(nt)
fo... |
#!/usr/bin/env python
"""Utils for use from the console.
Includes functions that are used by interactive console utilities such as
approval or token handling.
"""
import getpass
import os
import time
import logging
from grr.lib import access_control
from grr.lib import aff4
from grr.lib import client_index
from grr... |
"""
Django settings for registry project.
Generated by 'django-admin startproject' using Django 1.9.4.
For more information on this file, see
https://docs.djangoproject.com/en/1.9/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.9/ref/settings/
"""
import os
... |
# -*- coding: utf-8 -*-
"""Type Open Service Interface Definitions
type version 3.0.0
The Type OSID defines a set of interfaces for managing ``Type``
definitions. ``Types`` are used as an identifier primarily for
identification of interface extensions throughout the OSIDs and
occasionally used as an extensible enumera... |
"""Tests for the notebook kernel and session manager"""
from subprocess import PIPE
import time
from unittest import TestCase
from ipython_genutils.testing import decorators as dec
from traitlets.config.loader import Config
from jupyter_client import KernelManager
class TestKernelManager(TestCase):
def _get_tc... |
import argparse
import json
import os
import shutil
import subprocess
from pathlib import Path
from typing import Tuple
def run_command(cmd: str) -> Tuple[str, str]:
return subprocess.Popen(cmd.split(), stdout=subprocess.PIPE, stderr=subprocess.PIPE, encoding='utf-8').communicate()
def create_incident_field(pat... |
#-------------------------------------------------------------------------------
# elftools tests
#
# Eli Bendersky (eliben@gmail.com)
# This code is in the public domain
#-------------------------------------------------------------------------------
import unittest
from elftools.common.py3compat import BytesIO, iter... |
#!/usr/bin/env python
'''
Open a GITM 3D file adn create a plot similar to the example given by Aaron.
Note that as pybats.gitm is more developed, a plot like this should be made
using syntax like,
>>>a=gitm.GitmBin('filename')
>>>a.add_alt_slice(0, 'Rho', add_cbar=True)
That's how most pybats stuff works right now.
'... |
# -*- coding: utf-8 -*-
"""
Created on Wed Sep 07 13:21:35 2016
@author: 024536
"""
import tdbpy
from datetime import datetime, timedelta
pSetting = {
'szIP':"172.22.137.140",
'szPort':"20003",
'szUser':"liyonghan",
'szPassword':"liyo1234",
'nTimeOutVal':10,
'nRetryCount':10,
'nRetryGap':... |
"""Supporting functions for polydata and grid objects."""
import signal
import collections
import ctypes
import enum
import logging
import warnings
from threading import Thread
import numpy as np
import scooby
import vtk
import vtk.util.numpy_support as nps
import pyvista
from .fileio import from_meshio
class Fiel... |
# Copyright (C) 2015 Google Inc., authors, and contributors <see AUTHORS file>
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
# Created By: jernej@reciprocitylabs.com
# Maintained By: jernej@reciprocitylabs.com
"""Page object models for the info widget of the object"""
from lib import... |
# -*- coding: utf-8 -*-
"""
keyboard
========
Take full control of your keyboard with this small Python library. Hook global events, register hotkeys, simulate key presses and much more.
## Features
- Global event hook on all keyboards (captures keys regardless of focus).
- **Listen** and **sends** keyboard events.
... |
def add_native_methods(clazz):
def initialize____(a0):
raise NotImplementedError()
def getDefaultLocale__int__(a0, a1):
raise NotImplementedError()
def getDateTimePattern__int__int__java_lang_String__(a0, a1, a2, a3):
raise NotImplementedError()
def getCalendarID__java_lang_St... |
import json
import os
import time
from unittest.mock import Mock
import pytest
from jupyterhub.objects import Hub
from jupyterhub.objects import Server
from jupyterhub.orm import Spawner
from kubernetes.client.models import V1Capabilities
from kubernetes.client.models import V1Container
from kubernetes.client.models i... |
# This file is dual licensed under the terms of the Apache License, Version
# 2.0, and the BSD License. See the LICENSE file in the root of this repository
# for complete details.
from __future__ import absolute_import, division, print_function
import binascii
from cryptography.hazmat.backends import default... |
#!/usr/bin/env python
"""
Stitches together the images from a recipe run and stores them as a video on
the recipe_start data point
"""
import os
import time
import rospy
import tempfile
import subprocess
from openag.cli.config import config as cli_config
from openag.couch import Server
from openag.db_names import ENVIR... |
#-------------------------------------------------------------------------------
# Name: process_data
# Purpose:
#
# Author: Ramakrishna
#
# Created: 17/04/2014
# Copyright: (c) Ramakrishna 2014
# Licence: <your licence>
#----------------------------------------------------------------------------... |
from config.api1_1_config import config as config_old #TODO remove when 2.0 worklfow API is implemented
from config.api2_0_config import config
from config.amqp import *
from modules.logger import Log
from modules.amqp import AMQPWorker
from modules.worker import WorkerThread, WorkerTasks
from on_http_api2_0 import A... |
# This file is part of the sos project: https://github.com/sosreport/sos
#
# This copyrighted material is made available to anyone wishing to use,
# modify, copy, or redistribute it subject to the terms and conditions of
# version 2 of the GNU General Public License.
#
# See the LICENSE file in the source distribution ... |
#!/usr/bin/env python
##########################################################################
# frontends/swig_python/python_rpyc.py
#
# Part of Project Thrill - http://project-thrill.org
#
# Copyright (C) 2015 Timo Bingmann <tb@panthema.net>
#
# All rights reserved. Published under the BSD-2 license in the LICENSE ... |
# Copyright 2019, OpenCensus Authors
#
# 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 law or agreed to in w... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2005, TUBITAK/UEKAE
#
# 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... |
#
# Copyright (c) SAS Institute Inc.
#
# 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 law or agreed to in w... |
#!/usr/bin/env python2
# SPDX-License-Identifier: GPL-2.0+
#
# Author: Masahiro Yamada <yamada.m@jp.panasonic.com>
#
"""
Converter from Kconfig and MAINTAINERS to a board database.
Run 'tools/genboardscfg.py' to create a board database.
Run 'tools/genboardscfg.py -h' for available options.
Python 2.6 or later, but ... |
import socket
from server.subscribable import Subscribable
from .decorators import with_logger
@with_logger
class NatPacketServer(Subscribable):
def __init__(self, loop, port):
super().__init__()
self.loop = loop
self.port = port
self._logger.debug("{id} Listening on {port}".forma... |
from __future__ import absolute_import
import six
import logging
from datetime import datetime
from django.utils import timezone
from collections import namedtuple, OrderedDict
import sentry_sdk
from sentry.models import Project, Release
from sentry.utils.cache import cache
from sentry.utils.hashlib import hash_val... |
import json
import sys
from flask import request
from scout.constants import PROTECTED_KEYS
from scout.exceptions import error
from scout.models import Index
if sys.version_info[0] == 2:
json_load = lambda d: json.loads(d)
else:
json_load = lambda d: json.loads(d.decode('utf-8') if isinstance(d, bytes)
... |
from django import forms
from django.utils.translation import ugettext_lazy as _
from .models import DropCard, BuildCard
class DropCardForm(forms.ModelForm):
class Meta:
model = DropCard
fields = ('ship_name', 'ship_type', 'get_map', 'satelite_no', 'place_name',)
labels = {
's... |
#!/usr/local/bin/python
# -*- coding: utf-8 -*-
from django.http import HttpResponse
from django.core.urlresolvers import reverse
from techism2 import service
from datetime import datetime, timedelta
import icalendar
import time
def ical(request):
ninety_days = datetime.utcnow() + timedelta(days=90)
event_lis... |
from collections import OrderedDict
from html.parser import HTMLParser
import argparse
import datetime
import json
import os
import sys
import time
import urllib.request
class PageParser(HTMLParser):
"""Parser for CDF Lab Machine Usage page."""
def __init__(self):
HTMLParser.__init__(self)
#... |
import os
import shutil
import logging
from voidpp_tools.terminal import get_size
from collections import OrderedDict
import re
from datetime import timedelta, datetime
from .repository_command_result_box import RepositoryCommandResultBox
from .exceptions import ProjectException, RepositoryCommandException
from .proje... |
#-------------------------------------------------------------------------------
# Copyright 2017 Cognizant Technology Solutions
#
# 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:... |
import misaka as m
from houdini import escape_html
from pygments import highlight
from pygments.formatters import HtmlFormatter
from pygments.lexers import get_lexer_by_name
from pygments.util import ClassNotFound
from catsup.models import Post
from catsup.utils import ObjectDict
from catsup.reader.utils import spli... |
# -*- coding: utf-8 -*-
'''
Copyright (c) 2015
@author: Marat Khayrullin <xmm.dev@gmail.com>
'''
from flask import current_app, request
from flask.views import MethodView
from werkzeug import abort
from werkzeug.exceptions import HTTPException
from api.exceptions import StorageUnavailableError, ResourceExists
from ap... |
# given a sorted array and a key
# find the first occurrence that larger than k
# return -1 if there is no such element
from problem0 import binary_search
def test_find_first_larger_1 ():
assert (find_first_larger([1,2,3,4,5,5,6],7) == -1)
def test_find_first_larger_2 ():
assert (find_first_larger([1,2,3,4,... |
## Copyright 2009-2012 Luc Saffre
## This file is part of the Lino project.
## Lino 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.... |
""" Transform models.
:Author: Jonathan Karr <karr@mssm.edu>
:Date: 2018-06-19
:Copyright: 2018, Karr Lab
:License: MIT
"""
from .core import Transform
from wc_lang import Model, Reaction, RateLawDirection
from wc_onto import onto
from wc_utils.util.ontology import are_terms_equivalent
import copy
import re
class S... |
import unittest
from unittest import TestCase
from cql_builder.base import ValidationError
from cql_builder.condition import eq
from cql_builder.assignment import Set, SetAt, Add, Subtract, Assignments
class TestSet(TestCase):
def test_value_single(self):
op = Set(name='foo')
self.assertEquals(op.cql, 'name=%s')... |
"""Add profile protected and verified flags.
Revision ID: daeb6753652a
Revises: 8b46a8a8ca17
Create Date: 2020-11-06 02:57:05.891627
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = 'daeb6753652a'
down_revision = '8b46a8a8ca17'
branch_labels = None
depends_on = ... |
# --------------------------------------------------------------------------
#
# Copyright (c) Microsoft Corporation. All rights reserved.
#
# The MIT License (MIT)
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the ""Software""),... |
'''
Created on Aug 26, 2014
@author: gschoenb
'''
import logging
import numpy as np
import json
from lxml import etree
class StdyState(object):
'''
Used to define a stable state of a device
'''
## Max number of carried out test rounds.
testRnds = 25
## Always use a sliding window of 4 to meas... |
from numpy.testing import (
assert_allclose,
assert_array_equal,
)
import numpy as np
import pytest
from sklearn.datasets import make_classification
from sklearn.compose import make_column_transformer
from sklearn.exceptions import NotFittedError
from sklearn.linear_model import LogisticRegression
from sklearn... |
from __future__ import unicode_literals
import datetime
from django.forms.utils import flatatt, pretty_name
from django.forms.widgets import Textarea, TextInput
from django.utils import six
from django.utils.encoding import (
force_text, python_2_unicode_compatible, smart_text,
)
from django.utils.html import con... |
"""Miscellaneous volute relations"""
from scipy.special import expit
import numpy as np
from matplotlib import pyplot as plt
from utils import memoized
from units import ureg
def _points_volute_width():
"""Data given"""
return [0, 1000, 1000, 3000, 3000, 4000], [2.0, 2.0, 1.75, 1.75, 1.6, 1.6]
def _points_c... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.