code stringlengths 1 199k |
|---|
""" Test for assert_deallocated context manager and gc utilities
"""
import gc
from scipy.lib._gcutils import set_gc_state, gc_state, assert_deallocated, ReferenceError
from nose.tools import assert_equal, raises
def test_set_gc_state():
gc_status = gc.isenabled()
try:
for state in (True, False):
... |
"""
django admin page for the course creators table
"""
import logging
from smtplib import SMTPException
from django.conf import settings
from django.contrib import admin
from django.core.mail import send_mail
from django.dispatch import receiver
from course_creators.models import CourseCreator, send_admin_notification... |
#CutRenamePaste.py |
"""Runs 'ld -shared' and generates a .TOC file that's untouched when unchanged.
This script exists to avoid using complex shell commands in
gcc_toolchain.gni's tool("solink"), in case the host running the compiler
does not have a POSIX-like shell (e.g. Windows).
"""
import argparse
import os
import re
import subprocess... |
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'community'}
DOCUMENTATION = '''
---
module: ovirt_host
short_description: Module to manage hosts in oVirt/RHV
version_added: "2.3"
author: "Ondra Machacek (@machacekondra)"
description:
- "... |
from odoo import api, fields, models
class LinkTracker(models.Model):
_inherit = "link.tracker"
mass_mailing_id = fields.Many2one('mailing.mailing', string='Mass Mailing')
class LinkTrackerClick(models.Model):
_inherit = "link.tracker.click"
mailing_trace_id = fields.Many2one('mailing.trace', string='Ma... |
"""
TestGyp.py: a testing framework for GYP integration tests.
"""
import os
import re
import shutil
import stat
import subprocess
import sys
import tempfile
import TestCmd
import TestCommon
from TestCommon import __all__
__all__.extend([
'TestGyp',
])
def remove_debug_line_numbers(contents):
"""Function to remove... |
from kernpart import Kernpart
import numpy as np
from ...util.linalg import tdot
from ...core.mapping import Mapping
import GPy
class Gibbs(Kernpart):
"""
Gibbs non-stationary covariance function.
.. math::
r = sqrt((x_i - x_j)'*(x_i - x_j))
k(x_i, x_j) = \sigma^2*Z*exp(-r^2/(l(x)*l(x) + l(x')... |
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'certified'}
DOCUMENTATION = """
module: na_ontap_ntp
short_description: NetApp ONTAP NTP server
extends_doc... |
ANSIBLE_METADATA = {'status': ['preview'],
'supported_by': 'community',
'version': '1.0'}
DOCUMENTATION = '''
---
module: ecs_ecr
version_added: "2.3"
short_description: Manage Elastic Container Registry repositories
description:
- Manage Elastic Container Registry repositori... |
"""
Fill the "Commit" and "Removed" fields of doc/README.scrapyard
The file doc/README.scrapyard is used to keep track of removed boards.
When we remove support for boards, we are supposed to add entries to
doc/README.scrapyard leaving "Commit" and "Removed" fields blank.
The "Commit" field is the commit hash in which ... |
from .implicit_operations import ImplicitOperations
from .explicit_operations import ExplicitOperations
__all__ = [
'ImplicitOperations',
'ExplicitOperations',
] |
"""
Tests for L{twisted.web._newclient}.
"""
__metaclass__ = type
from zope.interface import implements
from zope.interface.verify import verifyObject
from twisted.python import log
from twisted.python.failure import Failure
from twisted.internet.interfaces import IConsumer, IPushProducer
from twisted.internet.error im... |
"""
%prog SUBMODULE...
Hack to pipe submodules of Numpy through 2to3 and build them in-place
one-by-one.
Example usage:
python3 tools/py3tool.py testing distutils core
This will copy files to _py3k/numpy, add a dummy __init__.py and
version.py on the top level, and copy and 2to3 the files of the three
submodules.
W... |
import os
import urlparse
from abc import ABCMeta, abstractmethod, abstractproperty
from utils import from_os_path, to_os_path
item_types = ["testharness", "reftest", "manual", "stub", "wdspec"]
def get_source_file(source_files, tests_root, manifest, path):
def make_new():
from sourcefile import SourceFile
... |
"""
Example that sends a single message and exits using the simple interface.
You can use `simple_receive.py` (or `complete_receive.py`) to receive the
message sent.
"""
import eventlet
from kombu import Connection
eventlet.monkey_patch()
def send_many(n):
#: Create connection
#: If hostname, userid, password a... |
from setuptools import setup, find_packages
version = '0.1'
setup(name='FSPkg',
version=version,
description="File system test package",
long_description="""\
File system test package""",
classifiers=[], # Get strings from http://pypi.python.org/pypi?%3Aaction=list_classifiers
keywords='pi... |
import testtools
import webob.exc
from nova.api.openstack.compute import hosts as os_hosts_v21
from nova.api.openstack.compute.legacy_v2.contrib import hosts as os_hosts_v2
from nova.compute import power_state
from nova.compute import vm_states
from nova import context as context_maker
from nova import db
from nova imp... |
import sys
sys.path.append(sys.path[-1] + '/third_party') |
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'community'}
DOCUMENTATION = '''
---
module: avi_authprofile
author: Gaurav Rastogi (grastogi@avinetworks.com)
short_description: Module for setup of AuthProfile Avi RESTful Object
description:
... |
"""Image processing and decoding ops.
See the [Images](https://tensorflow.org/api_guides/python/image) guide.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from tensorflow.python.ops.gen_image_ops import *
from tensorflow.python.ops.image_ops_impl impor... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'community'}
DOCUMENTATION = r'''
---
module: vultr_account_facts
short_description: Gather facts about th... |
from AddToImportFromFoo import bar
<caret><error descr="Unresolved reference 'add_to_import_test_unique_name'">add_to_import_test_unique_name</error> # must get imported |
"""Serializer tests for the Figshare addon."""
import mock
import pytest
from addons.base.tests.serializers import StorageAddonSerializerTestSuiteMixin
from addons.figshare.tests.factories import FigshareAccountFactory
from tests.base import OsfTestCase
from addons.figshare.serializer import FigshareSerializer
pytestma... |
from neutron.db import db_base_plugin_common
from neutron.tests import base
class DummyObject(object):
def __init__(self, **kwargs):
self.kwargs = kwargs
def to_dict(self):
return self.kwargs
class ConvertToDictTestCase(base.BaseTestCase):
@db_base_plugin_common.convert_result_to_dict
de... |
import re, random, string, cPickle
from androguard.core.androconf import error, warning, debug, is_ascii_problem
from androguard.core.bytecodes import jvm, dvm
from androguard.core.bytecodes.api_permissions import DVM_PERMISSIONS_BY_PERMISSION, DVM_PERMISSIONS_BY_ELEMENT
class ContextField :
def __init__(self, mode... |
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {
'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'community'
}
DOCUMENTATION = '''
---
module: vmware_guest_snapshot_facts
short_description: Gather facts about virtual machine's snaps... |
'''
It can save the contents of the file to the mysql database.
'''
import os
import random
import MySQLdb
f = open(os.getcwd()+'\\2','w')
for x in range(200):
words = [chr(a) for a in range(65,91)]+[chr(a) for a in range(97,122)]+[str(a) for a in range(0,11)]
# It is equal to string.ascii_letters + string.digits
s... |
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {
'metadata_version': '1.1',
'status': ['stableinterface'],
'supported_by': 'core'
}
DOCUMENTATION = r'''
---
author: Ansible Core Team (@ansible)
module: include_role
short_description: Load and execute... |
import os
import urllib
def dirlist(request):
r=['<ul class="jqueryFileTree" style="display: none;">']
try:
r=['<ul class="jqueryFileTree" style="display: none;">']
d=urllib.unquote(request.POST.get('dir','c:\\temp'))
for f in os.listdir(d):
ff=os.path.join(d,f)
if os.pa... |
"""
The Plex module provides lexical analysers with similar capabilities
to GNU Flex. The following classes and functions are exported;
see the attached docstrings for more information.
Scanner For scanning a character stream under the
direction of a Lexicon.
Lexicon For cons... |
"""
Helper functions for creating Form classes from Django models
and database field objects.
"""
from __future__ import unicode_literals
import warnings
from collections import OrderedDict
from itertools import chain
from django.core.exceptions import (
NON_FIELD_ERRORS, FieldError, ImproperlyConfigured, Validatio... |
my_dict = {"fst": 1, "snd": 2}
"formatted string {f<caret>}{snd}".format(**my_dict) |
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'community'}
DOCUMENTATION = '''
module: ec2_vpc_endpoint_facts
short_description: Retrieves AWS VPC endpoin... |
"""
Generator for shaderoperator* tests.
This file needs to be run in its folder.
"""
import sys
_DO_NOT_EDIT_WARNING = """<!--
This file is auto-generated from shaderoperator_test_generator.py
DO NOT EDIT!
-->
"""
_HTML_TEMPLATE = """<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">... |
__all__ = ['atleast_1d','atleast_2d','atleast_3d','vstack','hstack']
import numeric as _nx
from numeric import array, asanyarray, newaxis
def atleast_1d(*arys):
"""
Convert inputs to arrays with at least one dimension.
Scalar inputs are converted to 1-dimensional arrays, whilst
higher-dimensional inputs... |
import signal
def signal_to_exception(signum, frame):
"""
Called by the timeout alarm during the collector run time
"""
if signum == signal.SIGALRM:
raise SIGALRMException()
if signum == signal.SIGHUP:
raise SIGHUPException()
if signum == signal.SIGUSR1:
raise SIGUSR1Exce... |
from django.conf.urls import include, url
from .namespace_urls import URLObject
from .views import empty_view, view_class_instance
testobj3 = URLObject('testapp', 'test-ns3')
testobj4 = URLObject('testapp', 'test-ns4')
urlpatterns = [
url(r'^normal/$', empty_view, name='inc-normal-view'),
url(r'^normal/(?P<arg1... |
PAGE_BLANK = r'''
\makeatletter
\def\cleartooddpage{%%
\cleardoublepage%%
}
\def\cleardoublepage{%%
\clearpage%%
\if@twoside%%
\ifodd\c@page%%
%% nothing to do
\else%%
\hbox{}%%
\thispagestyle{plain}%%
\vspace*{\fill}%%
\begin{center}%%
\textbf{\em... |
"""Imperative mode for TensorFlow."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from tensorflow.contrib.imperative import imperative_graph
from tensorflow.python.client import session
from tensorflow.python.framework import errors
from tensorflow.python... |
print(type(int))
try:
type()
except TypeError:
print('TypeError')
try:
type(1, 2)
except TypeError:
print('TypeError') |
import re
import telnetlib
from couchpotato.api import addApiView
from couchpotato.core.event import addEvent
from couchpotato.core.helpers.encoding import tryUrlencode
from couchpotato.core.logger import CPLog
from couchpotato.core.notifications.base import Notification
try:
import xml.etree.cElementTree as etree
... |
import argparse
import collections
import os
import sys
import time
from distutils.version import StrictVersion
from io import StringIO
import json
import openstack as sdk
from openstack.cloud import inventory as sdk_inventory
from openstack.config import loader as cloud_config
CONFIG_FILES = ['/etc/ansible/openstack.y... |
import unittest
from .models import PersonWithCustomMaxLengths, PersonWithDefaultMaxLengths
class MaxLengthArgumentsTests(unittest.TestCase):
def verify_max_length(self, model, field, length):
self.assertEqual(model._meta.get_field(field).max_length, length)
def test_default_max_lengths(self):
s... |
from runner.koan import *
def function():
return "pineapple"
def function2():
return "tractor"
class Class:
def method(self):
return "parrot"
class AboutMethodBindings(Koan):
def test_methods_are_bound_to_an_object(self):
obj = Class()
self.assertEqual(__, obj.method.__self__ == ... |
"""Tests for distutils.command.bdist_dumb."""
import os
import sys
import zipfile
import unittest
from test.support import run_unittest
from distutils.core import Distribution
from distutils.command.bdist_dumb import bdist_dumb
from distutils.tests import support
SETUP_PY = """\
from distutils.core import setup
import ... |
"""Tests for pandas_io."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
from tensorflow.contrib.learn.python.learn.learn_io import pandas_io
from tensorflow.python.framework import errors
from tensorflow.python.platform import test
from ... |
from __future__ import unicode_literals
import frappe
from frappe.model.document import Document
class ShippingRuleCondition(Document):
pass |
"""This file contains a collection of standard key derivation functions.
A key derivation function derives one or more secondary secret keys from
one primary secret (a master key or a pass phrase).
This is typically done to insulate the secondary keys from each other,
to avoid that leakage of a secondary key compromise... |
from . import grammar, token, tokenize
class PgenGrammar(grammar.Grammar):
pass
class ParserGenerator(object):
def __init__(self, filename, stream=None):
close_stream = None
if stream is None:
stream = open(filename)
close_stream = stream.close
self.filename = fil... |
def dN(x,mu,si): # pdf normal distribution
z = (x - mu) / si
return exp(-0.5 * z ** 2) / sqrt(2 * pi * si ** 2)
S0 = 100.0 # initial index level |
__doc__ = """
SCons compatibility package for old Python versions
This subpackage holds modules that provide backwards-compatible
implementations of various things that we'd like to use in SCons but which
only show up in later versions of Python than the early, old version(s)
we still support.
Other code will not gener... |
import os.path
from setuptools import setup, find_packages
from cartman import __version__
here = os.path.abspath(os.path.dirname(__file__))
try:
README = open(os.path.join(here, "README.rst")).read()
CHANGES = open(os.path.join(here, "CHANGES.txt")).read()
except IOError:
README = CHANGES = ""
setup(
n... |
import dbus
def createDbusProxyObject(bus_name, object_path, bus=None):
'''
Create dbus proxy object
'''
bus = bus or dbus.SessionBus.get_session()
return bus.get_object(bus_name, object_path)
def fetchXMLFromDbusObject(obj):
'''
Return xml of dbus proxy object
'''
method = obj.get_d... |
import os
import string
from configparser import ConfigParser
from django.core.exceptions import ImproperlyConfigured
from django.utils.crypto import get_random_string
from filelock import FileLock
class FilePermissionError(Exception):
"""The key file permissions are insecure."""
pass
VALID_KEY_CHARS = string.a... |
"""
wirexfers.protocols.ipizza
~~~~~~~~~~~~~~~~~~~~~~~~~~
IPizza protocol implementations.
:copyright: (c) 2012-2014, Priit Laes
:license: ISC, see LICENSE for more details.
"""
from base64 import b64encode, b64decode
from Crypto import Random
from Crypto.Hash import SHA
from Crypto.Signature import... |
from django.contrib.sites.models import Site
from django.template import loader
from django.utils.translation import ugettext_lazy as _
from django.core.mail import EmailMultiAlternatives
from django.conf import settings
def token_expired(account):
"""
Send email to bank account manager
:param account: Inst... |
from twisted.internet.defer import Deferred, succeed, fail
from twisted.internet.defer import AlreadyCalledError, _NO_RESULT
class MultiDeferred(object):
"""An object that produces other deferreds. When this object is
callbacked or errbacked, those deferreds are callbacked or
errbacked with the same result ... |
from .core import app |
import re
def pre_process(text):
text = text.strip()
# remove URLs
text = re.sub(r"^https?://.*[\r\n]*", "", text, re.MULTILINE | re.IGNORECASE)
text = re.sub(r"http\S+(\s)*(\w+\.\w+)*", "", text, re.MULTILINE | re.IGNORECASE)
# un-contract
text = re.sub(r"\'ve", " have ", text, re.MULTILINE | r... |
import binascii
from x509 import ASN1_Node, bytestr_to_int, decode_OID
def a2b_base64(s):
try:
b = bytearray(binascii.a2b_base64(s))
except Exception as e:
raise SyntaxError("base64 error: %s" % e)
return b
def b2a_base64(b):
return binascii.b2a_base64(b)
def dePem(s, name):
"""Decod... |
from __future__ import division, print_function
import os
import argparse
import dask.array as da
from dask.diagnostics import ProgressBar
import comptools as comp
def add_reco_energy(partition, pipeline, feature_list):
partition['reco_log_energy'] = pipeline.predict(partition[feature_list])
partition['reco_ene... |
from itertools import groupby
s = input()
[print((len(list(j)), int(i)), end=' ') for i, j in groupby(s)] |
from tovendendo.users.models import User
import pytest
@pytest.fixture
def user(session):
new_user = User(
email='ana@testando.com',
password='1234',
phone_number='+358401234567')
session.add(new_user)
session.commit()
yield new_user
new_user.query.delete()
@pytest.fixture
de... |
import _plotly_utils.basevalidators
class ShowscaleValidator(_plotly_utils.basevalidators.BooleanValidator):
def __init__(
self, plotly_name="showscale", parent_name="scatterpolar.marker", **kwargs
):
super(ShowscaleValidator, self).__init__(
plotly_name=plotly_name,
pare... |
'''
lottery-omit-zj61
http://www.lottery.gov.cn/historykj/history_{0}.jspx?_ltype=zj61
@Author Aaric
@since 1.0
'''
import os
import threading |
import lasagne as nn
import theano.tensor as T
from theano.sandbox.rng_mrg import MRG_RandomStreams as RandomStreams
class GaussianSampleLayer(nn.layers.MergeLayer):
def __init__(self, mu, logsigma, rng=None, **kwargs):
self.rng = rng if rng else RandomStreams(nn.random.get_rng().randint(1,2147462579))
... |
from typing import TYPE_CHECKING
import warnings
from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error
from azure.core.pipeline import PipelineResponse
from azure.core.pipeline.transport import HttpRequest, HttpResponse
from azure.mgmt.core... |
import time
from . import MTM
from .mysix import _basestring, _range, makestring
SERV_CLASS_SIGNON = '0'
SERV_CLASS_SQL = '5'
SERV_CLASS_MRPC = '3'
class PIP(MTM):
def __init__(self, server_type='SCA$IBS'):
super(PIP, self).__init__(server_type)
self._token = None
self._msgid = 0
sel... |
from twisted.trial.unittest import TestCase
from twisted.internet import reactor
from twisted.web.client import getPage
from spammy.site import SpammySite
import ConfigParser
class SpammyIntegrationTestCase(TestCase):
def setUp(self):
config = ConfigParser.RawConfigParser()
self.site_factory = Spamm... |
import smtplib
import textwrap
from typing import Iterable, List, Set, Union
from asgiref.sync import async_to_sync
from django.conf import settings
from django.contrib.auth import (
login as auth_login,
logout as auth_logout,
update_session_auth_hash,
)
from django.contrib.auth.forms import AuthenticationF... |
from __future__ import absolute_import, division, print_function, with_statement
from .tools import PeriodTask, period_task, check_online, check_server_connected
from .base import *
__all__ = [
IPClientCN,
IPClientPPPOE,
get_perm,
get_perm_mac,
muti_wans,
PeriodTask,
period_task,
check_o... |
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('website', '0029_auto_20170329_1345'),
]
operations = [
migrations.AddField(
model_name='homepage',
name='header_dates_bg',
... |
from setuptools import setup, find_packages
setup(
name='easywebassets',
version='0.1',
url='http://github.com/frascoweb/easywebassets',
license='MIT',
author='Maxime Bouroumeau-Fuseau',
author_email='maxime.bouroumeau@gmail.com',
description='An easier way to use webassets',
packages=fi... |
"""File and IO related classes and functions."""
from contextlib import closing
from pythonicqt.Qt import QtCore, QtGui, QtUiTools
class File(QtCore.QFile):
"""File adds convenience abilities to QFiles open/close behavior..
Adds python mode support to opening modes."""
open_mode_dict = {
'r' :QtCore... |
import numpy
import json
class ISMBase:
_MAGIC_COOKIE = b'\xF0\x0A'
@classmethod
def open(cls, name):
"""Open an existing shared interprocess numpy array:
buffer = ISMBuffer.open('foo')
arr = buffer.asarray()
arr.fill(353)
send_arr_to_other_process(arr)
"""
... |
__author__ = "Prikly Grayp"
__license__ = "MIT"
__version__ = "1.0.0"
__email__ = "priklygrayp@gmail.com"
__status__ = "Development"
from reader.compressed.bzipped import opener as bz2_opener
from reader.compressed.gzipped import opener as gz_opener
__all__ = ['bz2_opener', 'gz_opener'] |
import sys
from PyQt5 import QtCore, QtWidgets, QtGui
import numpy
class MyOpenGLWindow( QtGui.QOpenGLWindow ):
def __init__( self ):
super().__init__()
self.profile = QtGui.QOpenGLVersionProfile()
self.profile.setVersion( 2, 1 )
self.opengl_paint_device = None
self.render_st... |
"""
WSGI config for msd project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.7/howto/deployment/wsgi/
"""
import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "msd.settings")
from django.core.wsgi import g... |
"""
Copyright 2009 Josh Marshall
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 writing, software
dist... |
from .Node import Node
from operator import attrgetter
class AddressedNode(Node):
_nb_attrs = frozenset(['local_address'])
def __init__(self, *, local_address, **kwargs):
'''Args:
local_address(int): local address is the address of the node without
consideration of any offset tha... |
"""
Test loading from pathlib objects.
"""
try:
from . import generic as g
except BaseException:
import generic as g
class PathTest(g.unittest.TestCase):
def test_pathlib(self):
"""
Test loading with paths passed as pathlib
"""
try:
import pathlib
except I... |
import cio
def getchar ():
return cio.getchar();
s=""
cio.write ("Hello World!")
while (1):
rc = getchar()
print ( rc );
print ( str(chr( rc )) )
if ( rc == 0x08 ): # backspace
if (len(s) >= 1):
s = s[:-1]
pass
else:
s = ""
elif ( rc == '\... |
from .pulseaudio import Module
class Module(Module):
def __init__(self, config, theme):
super().__init__(config, theme, "sink") |
from json import dumps
from flask import make_response
class Presenter(object):
mediatype = None
def __init__(self, data, code, headers):
self.data = data
self.code = code
self.headers = headers
@classmethod
def as_representation(cls, method, data, code, headers):
present... |
import sys
from shutil import rmtree
from os.path import abspath, dirname, join
import django
from django.conf import settings
import invoices
sys.path.insert(0, abspath(dirname(__file__)))
media_root = join(abspath(dirname(__file__)), 'test_files')
rmtree(media_root, ignore_errors=True)
installed_apps = (
'django.... |
"""
Support for getting information from Arduino pins.
Only analog pins are supported.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/sensor.arduino/
"""
import logging
import blumate.components.arduino as arduino
from blumate.const import DEVICE_DEFAULT_... |
from conans.client.output import Color
from conans.model.ref import PackageReference
from conans.model.ref import ConanFileReference
from collections import OrderedDict
class Printer(object):
""" Print some specific information """
INDENT_COLOR = {0: Color.BRIGHT_CYAN,
1: Color.BRIGHT_RED,
... |
import collections
class UserAccount(collections.Mapping):
VALID_KEYS = [
"github",
"name",
"slack",
"github_avatar",
"avatar",
]
def __init__(self, name, github=None, slack=None):
self.__github = github
self.__slack = slack
self.name = name
... |
import os
import sys
import platform
from stat import *
import subprocess
premake_path = os.path.join('packages', 'premake')
premake_version = '5.0.0-a6'
platform = platform.system()
def chmod(path):
stat = os.stat(path)
os.chmod(path, stat.st_mode|S_IEXEC|S_IXGRP)
def main():
if platform == 'Windows':
premak... |
import os
import time
import logging
import numpy as np
from keras.optimizers import Adam
from rl.agents.dqn import DQNAgent
from rl.policy import BoltzmannQPolicy
from rl.memory import SequentialMemory
from rl.processors import MultiInputProcessor
from mas_tools.api import Binance
from mas_tools.markets import Virtual... |
from unittest import TestCase
from unittest.mock import patch
from nose_parameterized import parameterized, param
from nose.tools import (
assert_equal, assert_dict_equal, assert_true)
from core.passwords import PasswordValidator, PasswordGenerator
class PasswordValidatorTestCase(TestCase):
@parameterized.expan... |
import unittest
import boto.swf.exceptions
from boto.swf.layer1 import Layer1
from mock import patch
from swf.models import ActivityType, Domain
from ..mocks.activity import mock_describe_activity_type
def throw(exception):
raise exception
class TestActivityType(unittest.TestCase):
def setUp(self):
self... |
import sys
import os
learnerEmail = raw_input('Login (Email address): ')
learnerSecret = raw_input('One-time Password (from the assignment page. This is NOT your own account\'s password): ')
from providedcode import dataset
from providedcode.transitionparser import TransitionParser
from providedcode.evaluate import Dep... |
"""
A web crawler for networks’ international calling costs.
"""
from __future__ import print_function
import json
import os
import re
import sys
import time
import textwrap
import argparse
import logging
import coloredlogs
try:
from selenium import webdriver
from selenium.common.exceptions import WebDriverExce... |
from __future__ import unicode_literals
from ..language_data.punctuation import ALPHA_LOWER, LIST_ELLIPSES, QUOTES, ALPHA_UPPER, LIST_QUOTES, UNITS, \
CURRENCY, LIST_PUNCT, ALPHA, _QUOTES
CURRENCY_SYMBOLS = r"\$ ¢ £ € ¥ ฿"
TOKENIZER_PREFIXES = (
[r'\+'] +
LIST_PUNCT +
LIST_ELLIPSES +
LIST_QUOTES
)
T... |
"""
pygments.formatters.img
~~~~~~~~~~~~~~~~~~~~~~~
Formatter for Pixmap output.
:copyright: Copyright 2006-2019 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
import os
import sys
from pygments.formatter import Formatter
from pygments.util import get_bool_opt, get_in... |
from distutils.core import setup
setup(name='CSHLDAP',
version='0.2',
description='LDAP Wrapper for CSH',
author='Matt Gambogi',
author_email='m@csh.rit.edu',
url='http://www.github.com/gambogi/CSHLDAP',
py_modules=['CSHLDAP'],
license="MIT") |
from django.http import HttpResponse
import urllib2
import re
from xml.dom import minidom
def cep(numero):
url = 'http://cep.republicavirtual.com.br/web_cep.php?formato=' \
'xml&cep=%s' % str(numero)
dom = minidom.parse(urllib2.urlopen(url))
tags_name = ('uf',
'cidade',
... |
__author__ = 'qiudebo'
import numpy as np
import matplotlib.pyplot as plt
if __name__ == '__main__':
fig, ax = plt.subplots(2, 2)
fig.suptitle(u'用户画像', fontsize=14, fontweight='bold')
labels = (u"1-17岁", u"18-24岁", u"25-30岁", u"31-35岁", u"36-40岁", u"40+岁")
x = np.arange(len(labels))
y = [0.07, 0.15,... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.