text stringlengths 12 6.59M |
|---|
import os
import abc
import uuid
import asyncio
class BaseStream(asyncio.StreamReader, metaclass=abc.ABCMeta):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.readers = {}
self.writers = {}
@abc.abstractproperty
def size(self):
pass
def ad... |
# No shebang line, this module is meant to be imported
#
# Copyright 2013 Oliver Palmer
#
# 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
#
# U... |
#!/usr/bin/env python
'''
'''
__docformat__ = 'restructuredtext'
__version__ = '$Id: $'
import ctypes
import math
import sys
import re
import atexit
from pyglet import image
from pyglet.media import Sound, Video, Medium, MediaException
from pyglet.media import lib_openal as al
from pyglet.media import openal
from p... |
#!/usr/bin/env python
# ----------------------------------------------------------------------------
# pyglet
# Copyright (c) 2006-2007 Alex Holkner
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are ... |
# Copyright (c) 2014 Joe H. Rahme <joe@enovance.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-2.0
#
# Unless required by applicable law ... |
# -*- coding: utf-8 -*-
"""
pygments.lexers.cypher
~~~~~~~~~~~~~~~~~~~~~~
A Lexer for the cypher graph query language use in the neo4j graph database.
`CypherLexer`
the ``tests/examplefiles`` contains file "test.cyp" which has valid
cypher queries that execute against the example database shi... |
# -*- coding: utf-8 -*-
"""
pygments.lexers.cypher
~~~~~~~~~~~~~~~~~~~~~~
A Lexer for the cypher graph query language use in the neo4j graph database.
`CypherLexer`
the ``tests/examplefiles`` contains file "test.cyp" which has valid
cypher queries that execute against the example database shi... |
# -*- coding: utf-8 -*-
"""
pygments.lexers.dotnet
~~~~~~~~~~~~~~~~~~~~~~
Lexers for .net languages.
:copyright: 2006-2007 by Georg Brandl, Armin Ronacher.
:license: BSD, see LICENSE for more details.
"""
import re
from pygments.lexer import RegexLexer, bygroups, using, this
from pygments.token i... |
# -*- coding: utf-8 -*-
"""
pygments.lexers.monkey
~~~~~~~~~~~~~~~~~~~~~~
Lexer for the monkey language
:copyright: Copyright 2012
:license: BSD, see LICENSE for details.
"""
import re
from pygments.lexer import RegexLexer, bygroups, include
from pygments.token import Punctuation, Text, Comment, ... |
# -*- coding: utf-8 -*-
"""
pygments.lexers.puppet
~~~~~~~~~~~~~~~~~~~~~~
Lexer for the Puppet DSL.
:copyright: Copyright 2006-2012 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
from pygments.lexer import RegexLexer, bygroups, include
from pygments.token import Co... |
#
# -*- coding: utf-8 -*-
#
# Copyright (c) 2014 by Anselm Kruis
#
# 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 a... |
#!/usr/bin/env python
# vim: set expandtab tabstop=4 shiftwidth=4:
#
# Copyright (c) 2012, Christopher J. Kucera
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * Redistributions of source c... |
from operator import itemgetter
from server import mc, TOOL_API_KEY
from server.views import TAG_COUNT_UI_LENGTH
from server.cache import cache, key_generator
from server.auth import user_mediacloud_client, user_mediacloud_key, is_user_logged_in, user_admin_mediacloud_client
from server.util.tags import processed_by_c... |
"""
An interface to the small NORB dataset. Unlike `./norb_small.py`, this reads
the original NORB file format, not the LISA lab's `.npy` version.
Currently only supports the Small NORB Dataset.
Download the dataset from
`here <http://www.cs.nyu.edu/~ylclab/data/norb-v1.0-small/>`_.
NORB dataset(s) by Fu Jie Huang a... |
from datetime import datetime
from bs4 import BeautifulSoup, Tag
import requests
from sqlalchemy import exists, and_
from sqlalchemy.orm import sessionmaker
from sqlalchemy.sql import text
from models import NbaGame, create_tables, db_connect
def parse_date(date):
beforeNYE = ['Oct', 'Nov', 'Dec']
month_and_d... |
import logging
from pymongo.results import InsertOneResult
from tornado import gen
from tornado.iostream import StreamClosedError, IOStream
from tornado.tcpserver import TCPServer
import csv
import pynmea2
import geojson # Docs https://pypi.python.org/pypi/geojson # https://github.com/tmcw/awesome-geojson
from shapely... |
#!/usr/bin/python -t
import argparse
import gc
import glob
import os
import re
import sys
from datetime import datetime
from time import strftime, time
import requests
import yaml
from apt.cache import Cache
from debian.changelog import Changelog
from debian.deb822 import Deb822, PkgRelation
import apt_pkg
import gi... |
# This file is part of Lod4Stat.
#
# Copyright (C) 2014 Provincia autonoma di Trento
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your optio... |
class Data(object):
def __init__(self, prompt=None, default=None, values=None,
kind=None, decode=None):
self.prompt = prompt
self.default = default
self.values = values
self.kind = kind
self._decode = decode
def decode(self, value):
if self._dec... |
#!/usr/bin/env python
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
import json
import os
import shutil
from jinja2 import Environment, FileSystemLoader
env = Envir... |
from lab.nodes.lab_server import LabServer
class CimcServer(LabServer):
LOM_ENABLED, LOM_DISABLED = 'Enabled', 'Disabled'
POWER_UP, POWER_DOWN, POWER_CYCLE = 'up', 'down', 'cycle-immediate'
RAID_0, RAID_1, RAID_10 = '0', '1', '10'
def __init__(self, node_id, lab, role):
super(CimcServer, self... |
# Copyright (c) 2016 Canonical 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 ... |
# Copyright (c) 2016 Canonical 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 ... |
# Copyright (c) Pymatgen Development Team.
# Distributed under the terms of the MIT License.
"""
This package contains core modules and classes for representing structures and
operations on them.
"""
import os
import warnings
from ruamel.yaml import YAML
from .composition import Composition
from .lattice import Lat... |
# coding: utf-8
# Copyright (c) Pymatgen Development Team.
# Distributed under the terms of the MIT License.
from monty.json import MSONable
import numpy as np
from scipy.ndimage.filters import gaussian_filter1d
from pymatgen.util.coord_utils import get_linear_interpolated_value
"""
This module defines classes to re... |
#!/usr/bin/env python
"""
This module defines the VaspInputSet abstract base class and a concrete
implementation for the parameters used by the Materials Project and the MIT
high throughput project. The basic concept behind an input set is to specify
a scheme to generate a consistent set of VASP inputs from a structu... |
# coding: utf-8
# Copyright (c) Pymatgen Development Team.
# Distributed under the terms of the MIT License.
from __future__ import division, unicode_literals
import math
import numpy as np
from monty.dev import deprecated
from pymatgen.core.periodic_table import Element
"""
Utilities for generating nicer plots.
""... |
"""Test MBAR by performing statistical tests on a set of model systems
for which the true free energy differences can be computed analytically.
"""
import numpy as np
import pytest
from pymbar import MBAR
from pymbar.testsystems import harmonic_oscillators, exponential_distributions
from pymbar.utils_for_testing impor... |
import socket
import time
import logging
from pymemcache.client.base import Client, PooledClient, _check_key
from pymemcache.client.rendezvous import RendezvousHash
logger = logging.getLogger(__name__)
class HashClient(object):
"""
A client for communicating with a cluster of memcached servers
"""
d... |
# ======================================================================
# matscipy - Python materials science tools
# https://github.com/libAtoms/matscipy
#
# Copyright (2014) James Kermode, King's College London
# Lars Pastewka, Karlsruhe Institute of Technology
#
# This program is free software: you... |
# Copyright (C) 2011 REES Marche <http://www.reesmarche.org>
#
# This file is part of ``django-simple-accounting``.
# ``django-simple-accounting`` is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, versio... |
#!/usr/bin/python
ABOUT="""\
Mailpile.py a tool Copyright 2011, Bjarni R. Einarsson
for searching and <http://bre.klaki.net/>
organizing piles of e-mail
This program is free software: you can redistribute it and/or modify it under
the terms of the ... |
import urlparse
import config # this is the config.py
from rdflib import Namespace, URIRef, Literal
def generate_hash(filename):
from hashlib import sha1
# the 'b' isn't needed less you run this on Windows
with open(filename, 'rb') as f:
# we apply a sort func to make sure the contents are the sam... |
## $Id$
##
## This file is part of CDS Invenio.
## Copyright (C) 2002, 2003, 2004, 2005, 2006 CERN.
##
## CDS 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 (a... |
# -*- coding: utf-8 -*-
from os.path import dirname, join, isabs
import tempfile
import logging
import six
from six.moves import configparser
CONF_DIR = '/etc/marcodeployer'
CERTS = "/usr/lib/marcodeployer/certs"
APPCERT = "app.crt"
APPKEY = "app.key"
RECEIVERCERT = "receiver.crt"
RECEIVERKEY = "receiver.key"
TMPDIR... |
# -*- coding: utf-8 -*-
import codecs
import os
def absolute_path(relative_path):
"""
:param relative_path: the path relative to alembic migration folder
:return: the absolute path
"""
from alembic import context
current_path = context.config.get_main_option('here')
if current_path:
... |
"""Attribute-value matrix."""
from matcher import Matcher
class AVM(object):
TYPE, REQUIRED, DEFAULT, VALUE = xrange(4)
def __init__(self):
self.__data = {} # {key: [type, required, default_value, value]}
def add_attribute(self, key, datatype, required=False, default_value=None):
"""Add... |
import os
import shutil
import subprocess
import socket
import SocketServer
import StringIO
import time
import threading
from Queue import Queue
import numpy as np
from matscipy.elasticity import full_3x3_to_Voigt_6_stress
from matscipy.logger import quiet, screen
from ase.atoms import Atoms
from ase.io.extxyz impor... |
"""
This module acts as the only interface point between other apps and the database backend for the content.
It exposes several convenience functions for accessing content
"""
from functools import wraps
from uuid import UUID
from django.core.files import File as DjFile
from django.db.models import Q
from kolibri.con... |
#!/usr/bin/python
ABOUT="""\
Mailpile.py - a tool for searching and Copyright 2011, Bjarni R. Einarsson
organizing piles of e-mail <http://bre.klaki.net/>
This program is free software: you can redistribute it and/or modify it under
the terms of the GNU Affero General Public License ... |
''' Lib for Plugin
Authors:
Andrey Kvichansky (kvichans on github.com)
Alexey - minor fixes (CudaText)
Version:
'2.1.17 2021-01-14'
Content
log Logger with timing
get_translation i18n
dlg_wrapper Wrapper for dlg_custom: pack/unpack values, h-align controls
ToDo: (s... |
# This file is part of Cockpit.
#
# Copyright (C) 2013 Red Hat, Inc.
#
# Cockpit 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 version 2.1 of the License, or
# (at your option) any later versio... |
# encoding: utf-8
"""A higher-level socket server API.
Uses Protocols to implement common callbacks without restricting advanced capabilities.
Additionally, provides prefork and worker thread pool capabilities.
"""
import os
import sys
import functools
import socket
import time
import random
from functools import ... |
import os
from configparser import ConfigParser
from background_task import background
from datetime import datetime, timedelta
from .models import Preset
from django.conf import settings
from subprocess import Popen, PIPE
import re
@background(schedule=timedelta(seconds=0))
def write_config(preset_id):
preset = ... |
"""A module for housing the EncodedSession class.
Exported Classes:
EncodedSession -- Class for representing an encoded session with the database.
"""
__all__ = [ 'EncodedSession' ]
import uuid
import struct
import decimal
import sys
from .crypt import toByteString, fromByteString, toSignedByteString, fromSignedBy... |
import os
from buildercore import core, config, project, bakery
from buildercore.utils import lookup
from buildercore.decorators import osissue, osissuefn
import utils
from decorators import requires_aws_stack, debugtask, echo_output
import boto
from buildercore.core import boto_cfn_conn, boto_ec2_conn, connect_aws_wit... |
import sys
from pathlib import Path
BASE_DIR = Path()
def rel(*x):
return str(BASE_DIR.joinpath(*x).absolute())
DEBUG = False
DOMAIN = 'localhost:8000'
APPEND_SLASH = True
ALLOWED_HOSTS = ["pharmacognosy.herokuapp.co", DOMAIN]
USE_X_FORWARDED_HOST = True
SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTOCOL',... |
from functools import reduce
from random import sample
from django.db.models import Q
from kolibri.content import models, serializers
from rest_framework import filters, pagination, viewsets
from .utils.metaphone import dm
from .utils.stemmer import stem
class ChannelMetadataCacheViewSet(viewsets.ModelViewSet):
... |
import unittest
from django.test import TestCase
class AccessTests(TestCase):
"""
Simple tests that check that basic pages can be accessed
and they contain something sensible.
"""
def test_docstring_index(self):
response = self.client.get('/docs/')
self.failUnless('All docstri... |
#!/usr/bin/env python
import argparse, os, shutil, subprocess, bagit
parser = argparse.ArgumentParser(description="script for making a bunch of directories with a bunch of files in them")
parser.add_argument('-t', '--target', type=str, required=True, help='where to put the test data')
parser.add_argument('-r', '--ree... |
# This file is part of Cockpit.
#
# Copyright (C) 2013 Red Hat, Inc.
#
# Cockpit 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 version 2.1 of the License, or
# (at your option) any later versio... |
# -*- coding: utf-8 -*-
"""The :class:`Schema` class, including its metaclass and options (class Meta)."""
from __future__ import absolute_import, unicode_literals
from collections import defaultdict, Mapping, namedtuple
import copy
import datetime as dt
import decimal
import inspect
import json
import uuid
import war... |
""" Store package data in DynamoDB """
import logging
import six
from collections import defaultdict
from datetime import datetime
from dynamo3 import DynamoDBConnection
from pkg_resources import parse_version
from pyramid.settings import asbool
from .base import ICache
from pypicloud.models import Package
try:
... |
# Django settings for timetable project.
import os
import sys
from datetime import timedelta
# setup
relative = lambda *x: os.path.join(os.path.abspath(os.path.dirname(__file__)), '..', *x)
if relative('lib') not in sys.path:
sys.path.append(relative('lib'))
# end setup
DEBUG = True
TEMPLATE_DEBUG = DEBUG
ADMI... |
"""
Django settings for kraang_api project.
"""
import os
BASE_DIR = os.path.dirname(os.path.dirname(__file__))
SECRET_KEY = os.environ['KRAANG_SECRET_KEY']
DEBUG = os.environ['KRAANG_DEBUG']
TEMPLATE_DEBUG = os.environ['KRAANG_DEBUG']
ALLOWED_HOSTS = []
# Application definition
INSTALLED_APPS = (
'django.con... |
from domain.tokenizer import Tokenizer, WordPartOfSpeach
def test_tokenize_sentences():
text = 'I hoped to see my friend. And shake his hand.'
sentences = Tokenizer().sentences(text)
assert list(sentences) == ['I hoped to see my friend.', 'And shake his hand.']
def test_tokenize_words():
sentences ... |
from django.conf.urls import url, include
import views
urlpatterns = [
url(r'^$', views.MapView.as_view(), name='home'),
url(r'^grid/$', views.FetchGridView.as_view(), name='grid'),
]
|
from __future__ import absolute_import
__author__ = 'katharine'
from gevent import monkey
monkey.patch_all()
import collections
import zipfile
from uuid import UUID
import gevent
import json
import logging
import os
import os.path
import shutil
import urlparse
import urllib
from libpebble2.services.appmessage import... |
'''
Script to match coords and image shapes of 2 cubes.
Specifically, this is for creating model images of single dish data for
cleaning interferometric data.
'''
import FITS_tools as ft
from astropy.io import fits
import numpy as np
from astropy.wcs import WCS
def match_regrid(filename1, filename2, reappend_dim=Tr... |
SECRET = 'foobar'
SECRET_KEY = 'my-session-secret'
SQLALCHEMY_DATABASE_TEST_URI = 'postgresql://rtester:rtester@localhost/pybossa_test'
GOOGLE_CLIENT_ID = 'id'
GOOGLE_CLIENT_SECRET = 'secret'
TWITTER_CONSUMER_KEY='key'
TWITTER_CONSUMER_SECRET='secret'
FACEBOOK_APP_ID='id'
FACEBOOK_APP_SECRET='secret'
TERMSOFUSE = 'http... |
#!/usr/bin/env python3
# -*- encoding: utf-8 -*-
__author__ = 'Florents Tselai'
from urllib.request import urlopen, Request
from bs4 import BeautifulSoup
from datetime import datetime
import requests as req
from .model import PocketItem, to_dict
class PocketTopicScraper:
def __init__(self, topic):
sel... |
"""
Description.
"""
__author__ = 'Dan Gunter <dkgunter@lbl.gov>'
__date__ = '2/21/13'
from email.mime.text import MIMEText
import json
from operator import itemgetter
import smtplib
#
from .util import DoesLogging
from ..util import MongoJSONEncoder
from .diff import Differ # for field constants
class Report:
... |
"""
This module contains the client socket API. This API is exposed to the
user throught the backend manager (
:class:`pyqode.core.managers.BackendManager`)
"""
import locale
import json
import logging
import socket
import struct
import uuid
from pyqode.qt import QtCore, QtNetwork
def _logger():
return logging.g... |
# This Python module is part of the PyRate software package.
#
# Copyright 2020 Geoscience Australia
#
# 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/... |
try:
import time
except ImportError:
print "Requirement: 'time' module not found."
try:
import os
except ImportError:
print "Requirement: 'os' module not found."
try:
from subprocess import check_output
except ImportError:
print "Requirement: 'subprocess' module not found."
from .common impor... |
"""
:mod:`weights` --- Spatial Weights
==================================
"""
__all__ = ['W']
__author__ = "Sergio J. Rey <srey@asu.edu> "
from pysal.common import *
from scipy import sparse, float32
import gc
class W(object):
"""
Spatial weights
Parameters
----------
neighbors : dictiona... |
"""
tests the pysat utils area
"""
import os
import numpy as np
import pandas as pds
import nose.tools
from nose.tools import assert_raises, raises
import tempfile
import pysat
import pysat.instruments.pysat_testing
import sys
if sys.version_info[0] >= 3:
if sys.version_info[1] < 4:
import imp
re_l... |
import csv
import cStringIO as StringIO
import itertools
def safe_convert(string):
if string == '':
return None
if string == 'T':
return True
elif string == 'F':
return False
try:
return int(string)
except ValueError:
pass
try:
return float(st... |
# encoding: utf-8
"""
.. codeauthor:: Tsuyoshi Hombashi <gogogo.vm@gmail.com>
"""
from __future__ import absolute_import
import copy
import os
import dataproperty
from .error import InvalidFilePathError
from .error import LoaderNotFoundError
from .csv.core import CsvTableFileLoader
from .html.core import HtmlTable... |
# -*- coding: utf-8 -*-
import sys
import serial
import config
import time
import dispatch
port = '/dev/tty.usbmodemfd131'
ser = serial.Serial(port, 9600)
def send(text):
#time.sleep(2)
#print ser.readline()
text += '\n'
ser.write(text)
print ">", text
ser.close()
def read():
try:
... |
import os, hashlib
class CircleCIError(Exception):
"""Raised for problems running the CirleCI py.test plugin"""
def read_circleci_env_variables():
"""Read and convert CIRCLE_* environment variables"""
circle_node_total = int(os.environ.get("CIRCLE_NODE_TOTAL", "1").strip() or "1")
circle_node_index... |
#!/usr/bin/python3
import collections
import json
import os
import re
import select
import socket
import traceback
class Scanner:
def __init__(self, string):
self.whitespace = re.compile(r'([ \t\n]|#.*$)+', re.ASCII | re.MULTILINE)
self.keyword_pattern = re.compile(r'\b[a-z]+\b|[:,(){}]|->|\[\]',... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from time import time
import argparse
import json
import sys
import os
import logging
import operator
from copy import copy
from uuid import uuid4
import socket
import re
from redis import Redis
from operator import itemgetter
from pyzabbix import ZabbixAPI
__version__ = '... |
# -*- coding: utf-8 -*-
"""
Decorators and other functions for hooks.
@author: Seva Zhidkov
@contact: zhidkovseva@gmail.com
@license: The MIT license
Copyright (C) 2015
"""
import re
from sheldon.exceptions import catch_plugin_errors
class Hook:
"""
Basic class for hooks
"""
# Every hook has type... |
#!/usr/bin/env python
###
# Copyright (c) 2002, Jeremiah Fincher
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice,
# ... |
"""bot.py - implements the FlowBot class, a boilerplate for other bots."""
from .channel_db import ChannelDb
from .server import Server
from .config import Config
import logging
from datetime import datetime
import threading
import time
import json
try:
import Queue
except ImportError:
import queue as Queue
... |
import requests
import re
import random
import inspect
from ec2_helper import EC2Helper
from camplight import Request, Campfire
from time import sleep
# + get random cat gif (http://thecatapi.com/api/images/get?format=src&type=gif)
# + get staging status
# + chuck http://api.icndb.com/jokes/random?limitTo=[nerdy]
# + ... |
# -*- coding: utf-8 -*-
# Copyright (c) 2010-2016, MIT Probabilistic Computing Project
#
# 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/LICENS... |
#! /usr/bin/python
# Copyright 2015 Kevin Lynch
#
# 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 agre... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import urllib2
import urllib
import re
import time
import json
import web
from web.contrib.template import render_jinja
from views import zhihudaily, music, todo
headers = {'User-Agent': 'Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.1.6)Gecko/2009120... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
try:
import gevent
except ImportError:
pass
else:
from gevent import monkey
monkey.patch_all()
import sys
import os
import md5
import json
import logging
import argparse
import multiprocessing
from ConfigParser import SafeConfigParser
import requests
logg... |
#!/usr/bin/env python
# Android Device Testing Framework ("dtf")
# Copyright 2013-2015 Jake Valletta (@jake_valletta)
#
# 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... |
#!/usr/bin/env python
"""
Problem Definition :
It can be seen that the number, 125874, and its double, 251748, contain exactly the same digits, but in a different order.
Find the smallest positive integer, x, such that 2x, 3x, 4x, 5x, and 6x, contain the same digits.
"""
__author__ = 'vivek'
import time
def ma... |
##########################################################################
#
# Copyright (c) 2011-2016, John Haddon. All rights reserved.
# Copyright (c) 2011-2013, Image Engine Design Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted prov... |
""" Represents a MyPages session """
import re
import requests
# this import is depending on python version
try:
import HTMLParser
UNESCAPE = HTMLParser.HTMLParser().unescape
except ImportError:
import html
UNESCAPE = html.unescape
DOMAIN = 'https://mypages.verisure.com'
URL_LOGIN = DOMAIN + '/j_spr... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""
Created on 2015-03-02
@author: joschi
@author: razavian
"""
from __future__ import print_function
import shelve
import sys
import os.path
#import simplejson as json
import json
def writeRow(cols, out, start, length, colZero):
delim = out['delim'];
quote = out['quo... |
#//////////////////////////////////////////////////////////
#// //
#// General package //
#// //
#// ---------------------------------------------------- //
#// ... |
"""Python implementation of Binary Search Tree."""
class Node(object):
"""Node, or leaf of the BST."""
def __init__(self, val=None, parent=None):
"""Create node object."""
self.val = val
self.right = None
self.left = None
self.parent = parent
class Bst(object):
"... |
# shrunk - Rutgers University URL Shortener
"""Database-level interactions for shrunk. """
import datetime
import random
import string
import re
import pymongo
from shrunk.aggregations import match_short_url, monthly_visits_aggregation
class DuplicateIdException(Exception):
"""Raised when trying to add a duplicat... |
import random
from fabric.api import task, run
from fabric.context_managers import settings
from fab_deploy2 import functions
INTERNAL_RANGES = [
'10.0.0.0/8',
'192.168.0.0/16',
'172.16.0.0/12'
]
@task
def get_ip(interface, hosts=[]):
"""
"""
return run(get_ip_command(interface))
def get_ip_... |
#!/usr/bin/env python
import pika
import sys
connection = pika.BlockingConnection(pika.ConnectionParameters(
host='localhost'))
channel = connection.channel()
channel.exchange_declare(exchange='direct_logs',
exchange_type='direct')
severity = sys.argv[1] if len(sys.argv) > 2 else 'in... |
# _*_ encoding: utf-8 _*_
class BST(object):
"""Create an instance of a binary search tree."""
def __init__(self):
"""Instantiating tree and setting marker to show if tree is empty."""
self.head = None
self.length = 0
def _get_node(self, value):
curnode = self.head
... |
"""Contains all the core ShutIt methods and functionality.
"""
#The MIT License (MIT)
#
#Copyright (C) 2014 OpenBet Limited
#
#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... |
import cryptanalib as ca
import feathermodules
def detect_hash_format(hashes):
options = feathermodules.current_options
if options['words'] == '' or ',' not in options['words']:
options['words'] = raw_input('Please enter words that might be in the plaintext version of the hashes, comma-separated: ').split(... |
# -*- coding: utf-8 -*-
"""Binary Search Tree Module."""
from collections import deque
class Node(object):
"""Define a node class."""
def __init__(self, value=None, parent=None, left=None, right=None):
"""Initialize a Node object."""
self.value = value
self.parent = parent
sel... |
"""Implementation of the Stan warmup for the HMC family of sampling algorithms."""
from typing import Any, Callable, Dict, List, NamedTuple, Tuple, Union
import jax
import jax.numpy as jnp
import numpy as np
from blackjax.adaptation.mass_matrix import (
MassMatrixAdaptationState,
mass_matrix_adaptation,
)
fro... |
from __future__ import print_function
import sys
import json
HEADER = {'User-Agent': 'RealTimeWeb Geocode library for educational purposes'}
PYTHON_3 = sys.version_info >= (3, 0)
if PYTHON_3:
import urllib.request as request
from urllib.parse import quote_plus
else:
import urllib2
from urllib import q... |
"""Contains all the core ShutIt methods and functionality.
"""
#The MIT License (MIT)
#
#Copyright (C) 2014 OpenBet Limited
#
#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... |
# -*- coding: utf-8 -*-
"""Binary Search Tree Module."""
from collections import deque
class Node(object):
"""Define a node class."""
def __init__(self, value=None, parent=None, left=None, right=None):
"""Initialize a Node object."""
self.value = value
self.parent = parent
sel... |
from __future__ import absolute_import, division, print_function, unicode_literals
import socket
from util import Platform
def ip_address():
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
s.connect(('8.8.8.8', 80))
name = s.getsockname()[0]
s.close()
return name
if Platform.IS_LINUX:
import fcnt... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.