src stringlengths 721 1.04M |
|---|
# -*- coding: utf-8 -*-
# Copyright 2020 Google LLC
#
# 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... |
# Copyright 2016 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 ... |
from vadvisor.store.event import InMemoryStore
import pytest
from freezegun import freeze_time
from datetime import datetime, timedelta
@pytest.fixture
@freeze_time("2012-01-14 03:00:00")
def expired_store():
store = InMemoryStore(60)
# Insert old data
store.put('old')
store.put('old')
store.put('... |
'''
Regrid the Arecibo data to match the VLA HI data.
'''
from spectral_cube import SpectralCube
from astropy.utils.console import ProgressBar
import numpy as np
import os
from cube_analysis.io_utils import create_huge_fits
from paths import fourteenB_HI_data_path, data_path
# Load the non-pb masked cube
vla_cube... |
from typing import Callable
def print_tree(root, children_func=list, name_func=str):
"""Pretty print a tree, in the style of gnu tree"""
# prefix components:
space = ' '
branch = '│ '
# pointers:
tee = '├── '
last = '└── '
# Inspired by https://stackoverflow.com/questions/... |
#!/usr/bin/env python
# Licensed under a 3-clause BSD style license - see LICENSE.rst
import ah_bootstrap
import pkg_resources
from setuptools import setup
from astropy_helpers.setup_helpers import register_commands, get_package_info
from astropy_helpers.version_helpers import generate_version_py
NAME = 'astropy_help... |
from discord.ext import commands
import sqlite3
class game :
conn = sqlite3.connect('bot_game.db')
c = conn.cursor()
def __init__(self, bot):
self.bot = bot
conn = sqlite3.connect('bot_game.db')
c = conn.cursor()
@commands.command(pass_context=True, no_pm=True)
async def join_game(self, ctx, *keywords):
se... |
import ipdb
import unittest
from libgraph import graphs, dfs, algorithms
class Tests(unittest.TestCase):
def test_basic(self):
g = graphs.Graph()
g.add_edges((1,2), (1,3), (1,4), (2,3), (2,5), (5, 6))
tr = dfs.Traversal(g)
dfs.dfs(1, tr)
self.assertEqual(tr.node_state[1], ... |
# Licensed under a 3-clause BSD style license - see LICENSE.rst
from math import exp
import numpy as np
__all__ = ['solve_corrections_sgd', 'determine_offset_matrix']
def determine_offset_matrix(arrays):
"""
Given a list of ReprojectedArraySubset, determine the offset
matrix between all arrays.
"""... |
"""Module which contains all classes needed for the plugin collection."""
from abc import ABCMeta, abstractmethod
from typing import cast, List
from .interfaces import IDataContainer, \
IPlugin, \
IProcessorPlugin, \
IRequiresPl... |
from __future__ import print_function, division
from sympy.core import Set, Dict, Tuple
from .cartan_type import Standard_Cartan
from sympy.matrices import eye
class TypeB(Standard_Cartan):
def __init__(self, n):
assert n >= 2
Standard_Cartan.__init__(self, "B", n)
def dimension(self):
... |
import copy
def pprint(A):
n = len(A)
for i in range(0, n):
line = ""
for j in range(0, n+1):
A[i][j] = float(A[i][j])
line += str(A[i][j]) + "\t"
if j == n-1:
line += "| "
print(line)
print("")
def gauss(A):
... |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
# Copyright (c) 2010 Citrix Systems, Inc.
# Copyright (c) 2011 Piston Cloud Computing, Inc
# Copyright (c) 2012 Univer... |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.6 on 2018-01-10 11:20
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('models', '0033_auto_20170927_1158'),
]
operations = [
migrations.AlterField... |
import serial
from evdev import uinput, ecodes as e
ser = serial.Serial('/dev/ttyUSB0')
while 1:
line = ser.readline()#.decode('utf-8')[:-4]
line = line[0]
if line == 'a':
with uinput.UInput() as ui:
ui.write(e.EV_KEY, e.KEY_A, 1)
ui.syn()
elif line == 'b':
... |
# Copyright 2014 Mellanox Technologies, Ltd
#
# 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 t... |
from __future__ import absolute_import, division, print_function, unicode_literals
import sys
from PyQt5.QtCore import Qt
from PyQt5.QtWidgets import QWidget, QApplication, QMainWindow, QMessageBox, QFileDialog, QGridLayout, QHBoxLayout, \
QVBoxLayout, QGroupBox, QCheckBox, QPushButton, QAction
from PatchEdit impor... |
from __future__ import absolute_import
import subprocess
import logging
import os.path as op
EMASS_PATH = [op.abspath("mzos/third_party/emass/emass"),
"-i",
op.abspath("mzos/third_party/emass/ISOTOPE.DAT")]
def get_theo_ip(f, min_rel_int=5.0):
"""
# todo ask wich adducts to pass i... |
from django.conf.urls.defaults import *
from django.conf import settings
from khufusite.app1.sitemaps import KhufuSitemap
# Uncomment the next two lines to enable the admin:
# from django.contrib import admin
# admin.autodiscover()
sitemaps = {
'blog': KhufuSitemap(),
}
urlpatterns = patterns('',
# Example:
... |
from SimPy.Simulation import *
import visual as v
import math
from random import seed, uniform, randint
class Global():
NUMNODES = 4
NUMCHANNELS = 1
Node_L_List = []
Node_A_List = []
Node_S_List = []
ChannelList = [] #stores
NodeSendQueueList = [] #stores
maxTime = 10
class Mon():
... |
from urllib.parse import urlparse
class Card:
AUTO_GENERATED_TEXT = 'Auto-created by TrelloNextActions'
def __init__(self, trello, json):
self._trello = trello
self.id = json['id']
self.name = json['name']
self.board_id = json['idBoard']
self.description = json['desc'... |
"""
Django settings for nba_stats project.
For more information on this file, see
https://docs.djangoproject.com/en/1.6/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.6/ref/settings/
"""
from unipath import Path
import dj_database_url
PROJECT_DIR = Path(__fi... |
# coding: utf-8
# -------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
# --------------------------------------------------------------------... |
# -*- coding: utf-8 -*-
'''
KODI Films For Action video add-on.
Copyright (C) 2014 José Antonio Montes (jamontes)
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 t... |
#!/usr/bin/env python
#
# __COPYRIGHT__
#
# 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 -*-
from numpy.testing import assert_array_equal
import pytest
from os import path as op
from pyeparse import read_raw
from pyeparse.utils import (_get_test_fnames, _TempDir, _requires_h5py,
_requires_edfapi)
temp_dir = _TempDir()
fnames = _get_test_fnames()
@_requir... |
import asyncio
import contextlib
import functools
import inspect
import logging
import os
import time
import unittest
import sys
import asynctnt
from asynctnt.instance import \
TarantoolSyncInstance, TarantoolSyncDockerInstance
from asynctnt import TarantoolTuple
__all__ = (
'TestCase', 'TarantoolTestCase', ... |
"""
Tests for Models
"""
import json
from django.test import TestCase
from django.contrib.auth.models import User
from .factories import CourseFactory, ModuleFactory
from courses.models import Course, Module, UserInfo
# pylint: disable=no-self-use
class CourseTests(TestCase):
"""
Tests for Course
"""
... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright 2012 - 2013
# Matías Herranz <matiasherranz@gmail.com>
# Joaquín Tita <joaquintita@gmail.com>
#
# https://github.com/PyRadar/pyradar
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
#... |
"""Perform automated searches against http://www.albme.org/.
The script will get license information such as the licensee name,
license number and expiration date information of a medical professional.
This information is then saved to a json file
"""
import json
import requests
import grequests
from BeautifulSoup im... |
__author__ = 'sohammondal'
import sys
import urllib
import re
def sortFunc(tuple):
'''
simple key comparison method for sorting
:param tuple:
:return:
'''
return tuple[-1]
def openAndCount(url):
'''
opens a site and finds the following movie pattern
serial number: 1.
movie na... |
from mock import MagicMock
from spacel.provision.orbit.provider import ProviderOrbitFactory
from test import BaseSpaceAppTest, ORBIT_REGION
TEST_PROVIDER = 'test'
class TestProviderOrbitFactory(BaseSpaceAppTest):
def setUp(self):
super(TestProviderOrbitFactory, self).setUp()
self.provider = Mag... |
import json
import sys
from tornado import gen
from tornado.httpclient import AsyncHTTPClient, HTTPError
from tornado.log import app_log
from vizydrop.sdk.source import DataSource, SourceSchema, SourceFilter
from vizydrop.fields import *
RESPONSE_SIZE_LIMIT = 10 # MB
class TrelloCardSourceFilters(SourceFilter):
... |
"""
This is a pure python implementation of the merge sort algorithm
For doctests run following command:
python -m doctest -v merge_sort.py
or
python3 -m doctest -v merge_sort.py
For manual testing run:
python merge_sort.py
"""
from __future__ import print_function
def merge_sort(collection):
"""Pure... |
__author__ = 'vasyanya'
from bs4 import BeautifulSoup
import re
class CityCategoryData:
def __init__(self):
self.link = ''
self.category = None
self.text = None
def extract(content):
soup = BeautifulSoup(content)
results = []
all_links = soup.find_all('a')
vacancy_link_r... |
import logging as log
from collections import defaultdict
from datetime import timedelta
import functools
import shlex
import marge.git as git
class RepoMock(git.Repo):
@classmethod
def init_for_merge_request(cls, merge_request, initial_target_sha, project, forked_project=None):
assert bool(forked_p... |
#!python
# coding=utf-8
from pocean.cf import CFDataset
from pocean import logger # noqa
class IncompleteMultidimensionalTimeseries(CFDataset):
@classmethod
def is_mine(cls, dsg, strict=False):
try:
rvars = dsg.filter_by_attrs(cf_role='timeseries_id')
assert len(rvars) == 1
... |
#-
# Copyright (c) 2014 Michael Roe
# All rights reserved.
#
# This software was developed by SRI International and the University of
# Cambridge Computer Laboratory under DARPA/AFRL contract FA8750-10-C-0237
# ("CTSRD"), as part of the DARPA CRASH research programme.
#
# @BERI_LICENSE_HEADER_START@
#
# Licensed to BER... |
'''
Aim :: To demonstrate the use of a list
Define a simple list , add values to it and iterate and print it
A list consists of comma seperated values which could be of any type
which is reprsented as [,,,,] .. all values are enclosed between '[' and ']'
** A list object is a mutable datatype which means it... |
from unittest import TestCase
from .types import expects_type, returns_type, T
@expects_type(a=T(int), b=T(str))
def example_kw_arg_function(a, b):
return a, b
class ExpectsTests(TestCase):
def test_correct_expectations_kw(self):
self.assertEqual(example_kw_arg_function(a=1, b="baz"), (1, "baz"))
... |
import cgi
import email
import hashlib
import json
import os
import requests
import smtplib
import uuid
from datetime import datetime
from flask import (abort, jsonify, g, session, render_template, redirect,
request, url_for)
from functools import wraps
from manage import app, client
from random impo... |
#!/usr/bin/python
import matplotlib.pyplot as plt
import matplotlib.dates as mdates
import numpy as np
import pandas as pd # used to convert datetime64 to datetime
import csv
import sys
from mpl_toolkits.axes_grid1 import host_subplot
import mpl_toolkits.axisartist as AA
class Gen_Graph:
def __init__(self, _... |
#---------------------------------------------------------------------------
# Copyright 2013-2019 The Open Source Electronic Health Record Alliance
#
# 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 Licen... |
#!/usr/bin/env python
import re
import sys
import os
include_pat = r'(<!--\s*#include\s*virtual\s*=\s*"([^"]+)"\s*-->)'
include_regex = re.compile(include_pat)
url_pat = r'(\s+href\s*=\s*")([^"#]+)(#[^"]+)?(")'
url_regex = re.compile(url_pat)
dirname = ''
# Instert tags for options
# Two styles are processed.
# ... |
from chroma_core.lib.cache import ObjectCache
from chroma_core.models import ManagedTargetMount
from chroma_core.models import Nid
from chroma_core.services.job_scheduler.job_scheduler_client import JobSchedulerClient
from chroma_core.models import ManagedTarget, ManagedMgs, ManagedHost
from tests.unit.chroma_core.hel... |
from Numeric import *
from mutils import *
from biomass import *
from free import *
from spelper import *
from logging import *
def open1(name, mode):
f=open(name, mode)
f.write("from mutils import *\nfrom Numeric import *\n")
return f
next_data={
"low":(0,"middle"),
"middle":(0,"high"),
"high":(1,"low"),
}
de... |
'''
@author: FangSun
'''
import zstackwoodpecker.test_util as test_util
import zstackwoodpecker.test_lib as test_lib
import zstackwoodpecker.test_state as test_state
import zstackwoodpecker.operations.primarystorage_operations as ps_ops
import random
_config_ = {
'timeout' : 3000,
'noparallel' : True
... |
# -*- coding: utf-8 -*-
"""
Python 富文本XSS过滤类
@package XssHtml
@version 0.1
@link http://phith0n.github.io/python-xss-filter
@since 20150407
@copyright (c) Phithon All Rights Reserved
Based on native Python module HTMLParser purifier of HTML, To Clear all javascript in html
You can use it in all python web framework
Wr... |
#Full working with icon working too.
from distutils.core import setup
import py2exe
import os
MFCDIR = r"C:\Python27\Lib\site-packages\pythonwin"
MFCFILES = ["mfc90.dll", "mfc90u.dll", "mfcm90.dll", "mfcm90u.dll",
"Microsoft.VC90.MFC.manifest"]
mfcfiles = map(lambda x: os.path.join(MFCDIR, x), MFCFILES)
... |
from direct.interval.IntervalGlobal import *
from BattleBase import *
from BattleProps import *
from BattleSounds import *
import MovieCamera
from direct.directnotify import DirectNotifyGlobal
import MovieUtil
import MovieNPCSOS
from MovieUtil import calcAvgSuitPos
from direct.showutil import Effects
notify = DirectNot... |
#!/usr/bin/python
import subprocess
ASSEMBLY_TEMPLATE = '''
.intel_syntax noprefix
.globl main
main:
%s
'''
ASSEMBLE = 'gcc -xassembler - -o /dev/stdout -m32 -nostdlib -emain -Xlinker --oformat=binary'
def run(command, stdin):
proc = subprocess.Popen(command, stdin=subprocess.PIPE, stdout=subprocess.PIPE, st... |
#
# This file is part of DF.
#
# DF 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.
#
# Latassan is distributed in the hope that it ... |
#This file is distributed under the terms of the GNU General Public license.
#Copyright (C) 1999 Aloril (See the file COPYING for details).
from common import const
from physics import *
from physics import Vector3D
from physics import Point3D
from mind.Goal import Goal
from mind.goals.common.common import *
from ra... |
# Copyright 2015 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 agr... |
from unittest import TestCase
from aleph.search.parser import SearchQueryParser
from aleph.search.query import Query
def query(args):
return Query(SearchQueryParser(args, None))
class QueryTestCase(TestCase):
def setUp(self):
# Allow list elements to be in any order
self.addTypeEqualityFunc(... |
# Copyright 2015-19 Eficent Business and IT Consulting Services S.L. -
# Jordi Ballester Alomar
# Copyright 2015-19 Serpent Consulting Services Pvt. Ltd. - Sudhir Arya
# Copyright 2018-19 ACSONE SA/NV
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html).
from odoo import api, fields, models
class Mis... |
# Copyright (C) 2014-2014 Project
# License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher
import unittest
from pwebs import main
class TestMain(unittest.TestCase):
def test_threshold(self):
import argparse
self.assertSequenceEqual(main.threshold('i25,o30,i20,o40'),
... |
from __future__ import absolute_import
import unittest
from tldt.diff import Mapper
DIFF = """diff --git a/requirements.txt b/requirements.txt
index 5dabd91..abbcf7c 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -1,4 +1,3 @@
pygithub==1.11.1
sh==1.08
-lxml==3.1.0
pylint==0.26.0
diff --git a/src/tldt/dif... |
#
# Revelation - a password manager for GNOME 2
# http://oss.codepoet.no/revelation/
# $Id$
#
# Module for UI functionality
#
#
# Copyright (c) 2003-2006 Erik Grinaker
#
# 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 Fr... |
import os
import resource
import sys
import traceback
import unittest
import mock
import numpy as np
import sklearn.datasets
import sklearn.decomposition
import sklearn.cross_validation
import sklearn.ensemble
import sklearn.svm
from sklearn.utils.testing import assert_array_almost_equal
from HPOlibConfigSpace.config... |
# -*- coding: utf-8 -*-
"""
eve.endpoints
~~~~~~~~~~~~~
This module implements the API endpoints. Each endpoint (resource, item,
home) invokes the appropriate method handler, returning its response
to the client, properly rendered.
:copyright: (c) 2013 by Nicola Iarocci.
:license: BSD, se... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import sys
import subprocess
import argparse
import configparser
import datetime
import tempfile
import sqlite3
import hashlib
parser = argparse.ArgumentParser()
parser.add_argument("-i", "--ini", help="The ethsnap ini configuration", \
metavar="FILE", nargs... |
#!/usr/bin/env python
#
# This code was copied from the data generation program of Tencent Alchemy
# project (https://github.com/tencent-alchemy).
#
#
# #
# # Copyright 2019 Tencent America LLC. All Rights Reserved.
# #
# # Licensed under the Apache License, Version 2.0 (the "License");
# # you may not use this file e... |
"""
--- Day 10: Knot Hash ---
You come across some programs that are trying to implement a software emulation of a hash based on knot-tying. The hash these programs are implementing isn't very strong, but you decide to help them anyway. You make a mental note to remind the Elves later not to invent their own cryptogra... |
from PIL import Image,ImageDraw, ImageFont, ImageFilter
import random
class VerifyCode():
def __init__(self):
self._letter_cases = 'abcdefghjkmnpqrstuvwxyzABCDEFGHJKMNOPRSTUVWXYZ3456789'
self._upper_cases = self._letter_cases.upper()
self._numbers = ''.join(map(str, range(3, 10)))
de... |
"""
Provides AWS4Auth class for handling Amazon Web Services version 4
authentication with the Requests module.
"""
# Licensed under the MIT License:
# http://opensource.org/licenses/MIT
from __future__ import unicode_literals
import hmac
import hashlib
import posixpath
import re
import shlex
import datetime
try:... |
from core.himesis import Himesis
import uuid
class Hlayer3rule2(Himesis):
def __init__(self):
"""
Creates the himesis graph representing the DSLTrans rule layer3rule2.
"""
# Flag this instance as compiled now
self.is_compiled = True
... |
# -*- coding: utf-8 -*-
"""
This module contains functions for creating charts.
"""
import gettext
import os
import textwrap
import matplotlib
import matplotlib.pyplot as plt
import matplotlib.pylab
import numpy as np
import pandas as pd
from scipy import stats
from statsmodels.graphics.mosaicplot import mosaic
impor... |
# This file is part of Invenio.
# Copyright (C) 2007, 2008, 2009, 2010, 2011, 2013, 2015 CERN.
#
# Invenio 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)... |
from toontown.toonbase import TTLocalizer
from toontown.coghq.SpecImports import *
GlobalEntities = {1000: {'type': 'levelMgr',
'name': 'LevelMgr',
'comment': '',
'parentEntId': 0,
'cogLevel': 0,
'farPlaneDistance': 1500.0,
'modelFilename': 'phase_9/models/cogHQ/SelbotLeg... |
# CirruxCache provides dynamic HTTP caching on AppEngine (CDN like)
# Copyright (C) 2009 Samuel Alba <sam.alba@gmail.com>
#
# 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 ... |
########################################################################
# File : InProcessComputingElement.py
# Author : Stuart Paterson
########################################################################
""" The simplest of the "inner" CEs (meaning it's used by a jobAgent inside a pilot)
A "InProcess" CE... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# This is a modified version of '__init__.py' (version 1.1.1), part of the 'atom' module
# from the gdata-python-client project (http://code.google.com/p/gdata-python-client/) by Google Inc.
# Copyright (C) 2006, 2007, 2008 Google Inc.
#
# It has been modified to support jso... |
# -*- coding: us-ascii -*-
# asynchia - asynchronous networking library
# Copyright (C) 2009 Florian Mayer <florian.mayer@bitsrc.org>
# This program 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 Software Foundation, eit... |
__license__ = 'GPL v3'
__copyright__ = '2014, Emily Palmieri <silentfuzzle@gmail.com>'
from calibre.gui2.viewer.behavior.adventurous_behavior import AdventurousBehavior
from calibre.gui2.viewer.behavior.adventurous_base_behavior import BaseAdventurousBehavior
from calibre.gui2.viewer.behavior.calibre_behavior impor... |
#!/usr/bin/env python
import cattle
import sys
ZK_NODES = 3
REDIS_NODES = 3
API_SERVER_NODES = 3
PROCESS_SERVER_NODES = 3
AGENT_SERVER_NODES = 3
MYSQL_COMPUTE = 1
# Set if you want to override the cattle.jar in the Docker image with a custom one
URL = ''
TAG = 'latest'
client = cattle.from_env()
def wait(c):
re... |
# coding=utf-8
# Copyright 2018 The Google AI Language Team 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 ... |
from __future__ import unicode_literals
import datetime
from django.core.exceptions import ImproperlyConfigured
from django.test import TestCase, override_settings, skipUnlessDBFeature
from django.test.utils import requires_tz_support
from django.utils import timezone
from .models import Book, BookSigning
def _mak... |
# Topydo - A todo.txt client written in Python.
# Copyright (C) 2014 - 2015 Bram Schoenmakers <bram@topydo.org>
#
# 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,... |
"""WebSocket protocol versions 13 and 8."""
__all__ = ['WebSocketParser', 'WebSocketWriter', 'do_handshake',
'Message', 'WebSocketError',
'MSG_TEXT', 'MSG_BINARY', 'MSG_CLOSE', 'MSG_PING', 'MSG_PONG']
import base64
import binascii
import collections
import hashlib
import struct
from aiohttp impo... |
import json
import logging
from twisted.internet import interfaces, defer
from zope.interface import implements
from lbrynet.interfaces import IRequestHandler
log = logging.getLogger(__name__)
class ServerRequestHandler(object):
"""This class handles requests from clients. It can upload blobs and
return req... |
import pandas as pd
# https://archive.ics.uci.edu/ml/machine-learning-databases/mushroom/agaricus-lepiota.names
#
# TODO: Load up the mushroom dataset into dataframe 'X'
# Verify you did it properly.
# Indices shouldn't be doubled.
# Header information is on the dataset's website at the UCI ML Repo
# Check NA Encodi... |
from functools import wraps
from async_generator import async_generator, yield_
from ssb.packet_stream import PSMessageType
class MuxRPCAPIException(Exception):
pass
class MuxRPCHandler(object):
def check_message(self, msg):
body = msg.body
if isinstance(body, dict) and 'name' in body and ... |
from csacompendium.research.models import (
Diversity,
ResearchDiversity,
)
from csacompendium.utils.hyperlinkedidentity import hyperlinked_identity
from csacompendium.utils.serializersutils import (
CreateSerializerUtil,
get_related_content_url,
FieldMethodSerializer
)
from rest_framework.serialize... |
# Copyright (c) 2006-2013 Regents of the University of Minnesota.
# For licensing terms, see the file LICENSE.
# MAC_RE = re.compile(r'^(mc|mac|de|van)(.)(.*)')
#
# def capitalize_surname(name):
# '''Return a semi-intelligently capitalized version of name.'''
# name = name.lower()
# # capitalize letter after... |
ownerclass = 'AppDelegateBase'
ownerimport = 'AppDelegateBase.h'
edition = args.get('edition', 'se')
result = Menu("")
appMenu = result.addMenu("dupeGuru")
fileMenu = result.addMenu("File")
editMenu = result.addMenu("Edit")
actionMenu = result.addMenu("Actions")
owner.columnsMenu = result.addMenu("Columns")
modeMenu =... |
#!/usr/bin/env python
"""
Test kamqp.client_0_8.exceptions module
"""
# Copyright (C) 2007-2008 Barry Pederson <bp@barryp.org>
#
# 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 Software Foundation; either
# ... |
"""Tests for cli repository set
:Requirement: Repository Set
:CaseAutomation: Automated
:CaseLevel: Acceptance
:CaseComponent: CLI
:TestType: Functional
:CaseImportance: High
:Upstream: No
"""
from robottelo.cli.factory import make_org
from robottelo.cli.product import Product
from robottelo.cli.repository_set i... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (C) 1999-2015, Raffaele Salmaso <raffaele@salmaso.org>
#
# 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, includ... |
"""
Convergence regions of the expansions used in ``struve.c``
Note that for v >> z both functions tend rapidly to 0,
and for v << -z, they tend to infinity.
The floating-point functions over/underflow in the lower left and right
corners of the figure.
Figure legend
=============
Red region
Power series is clo... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c) 2012-2013 Raphaël Barrois
import os
import re
import sys
from setuptools import setup
root_dir = os.path.abspath(os.path.dirname(__file__))
def get_version(package_name):
version_re = re.compile(r"^__version__ = [\"']([\w_.-]+)[\"']$")
package_c... |
# -*- coding: utf-8 -*-
from operator import attrgetter
from pyangbind.lib.yangtypes import RestrictedPrecisionDecimalType
from pyangbind.lib.yangtypes import RestrictedClassType
from pyangbind.lib.yangtypes import TypedListType
from pyangbind.lib.yangtypes import YANGBool
from pyangbind.lib.yangtypes import YANGListTy... |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (C) 2012 Deepin, Inc.
# 2012 Hailong Qiu
#
# Author: Hailong Qiu <356752238@qq.com>
# Maintainer: Hailong Qiu <356752238@qq.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General ... |
import operator
import re
import cv2
from PIL import Image
import pytesser
import reading_white_text
import smooth_image
INVERT_COLOR_THRESHOLD = 128
def make_string_alphanmeric(lines):
s = re.sub('[^0-9a-zA-Z\n]+', ' ', lines)
return s
def greyscale_image_mean(file_name):
size = 128, 128
im = Im... |
from django.contrib import admin
from getresults.admin import admin_site
from ..models import Aliquot, AliquotCondition, AliquotType
from ..filters import AliquotPatientFilter
class AliquotAdmin(admin.ModelAdmin):
def get_readonly_fields(self, request, obj=None):
if obj: # In edit mode
ret... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from setuptools import setup, find_packages
from setuptools.command.test import test as TestCommand
import sys
class PyTest(TestCommand):
def finalize_options(self):
TestCommand.finalize_options(self)
self.test_args = []
self.test_suite = True... |
# Volatility
# Copyright (C) 2007-2013 Volatility Foundation
#
# This file is part of Volatility.
#
# Volatility 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 ... |
"""
raven.contrib.django.client
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
: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
import logging
from django.conf import settings
from django.core.exceptions import Suspicio... |
# -*- coding: utf-8 -*-
# Copyright 2020 Google LLC
#
# 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... |
# -*- coding: utf-8 -*-
# gedit CodeCompletion plugin
# Copyright (C) 2011 Fabio Zendhi Nagao
#
# 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 o... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.