text stringlengths 12 6.59M |
|---|
import datetime
from mock import patch
import pytz
from gittip.testing import GITHUB_USER_UNREGISTERED_LGTEST, Harness
from gittip.testing.client import TestClient
class TestPages(Harness):
def setUp(self):
super(Harness, self).setUp()
self.client = TestClient()
def get(self, url, returning=... |
from unittest import TestCase
from BeautifulSoup import BeautifulStoneSoup
import sys
sys.path.append('..')
from support import open_file
from ofxparse import *
from ofxparse.ofxparse import OfxFile
from StringIO import StringIO
from datetime import datetime, timedelta
class TestOfxFile(TestCase):
def testHeader... |
import os
import posixpath, ntpath
from unittest import TestCase
import lektor_s3
class TestPosixPaths(TestCase):
def setUp(self):
self.old_path = os.path
os.path = posixpath
def tearDown(self):
os.path = self.old_path
def test_split_abspath(self):
p = "/some/posixy/path... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
test_pytar
----------------------------------
Tests for `pytar` module.
"""
import unittest
import os
from pytar import pytar
CURRENT_DIR = os.path.dirname(os.path.abspath(__file__))
def abspath(relative_path):
return os.path.join(CURRENT_DIR, relative_path)
... |
from datetime import datetime, timedelta
from django.test import TestCase
from django.core.exceptions import ValidationError
from devilry.project.develop.testhelpers.corebuilder import PeriodBuilder
from devilry.project.develop.testhelpers.corebuilder import SubjectBuilder
from devilry.project.develop.testhelpers.cor... |
import os
import github3
from tests.utils import (generate_response, expect, BaseCase, load)
from mock import patch
class TestRepository(BaseCase):
def __init__(self, methodName='runTest'):
super(TestRepository, self).__init__(methodName)
self.repo = github3.repos.Repository(load('repo'))
def... |
# --------------------------------------------------------------------
# Mari Extension Tools INIT
# Copyright (c) 2015 Mari Ideascale. All Rights Reserved.
# --------------------------------------------------------------------
# Written by Jens Kafitz, 2015
# http://mari.ideascale.com
# -------------------------------... |
import getpass
import json
import requests
import six.moves
from piazza_api.exceptions import AuthenticationError, NotAuthenticatedError, \
RequestError
from piazza_api.nonce import nonce as _piazza_nonce
class PiazzaRPC(object):
"""Unofficial Client for Piazza's Internal API
Example:
>>> p = ... |
from __future__ import absolute_import
from builtins import range
from functools import partial
import numpy as npo
try:
import scipy
except:
from warnings import warn
warn('Skipping scipy tests.')
else:
import autograd.numpy as np
import autograd.numpy.random as npr
import autograd.scipy.misc
... |
from .mpu9250 import MPU9250
from .ms5611 import MS5611
from .adc import ADC
|
# Copyright (c) 2014 Christian Schwede <christian.schwede@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 b... |
from __future__ import absolute_import
import sys
from functools import *
from .version_info import PY2
if PY2:
reduce = reduce
if sys.version_info < (3, 2):
try:
from threading import Lock
except ImportError:
from dummy_threading import Lock
from .collections import OrderedDict
... |
#!/home/ssi/jwhitmore/progs/epd-7.1-2-rh5-x86_64/bin/python
# Copyright Jonathan Whitmore
# Distributed under the Boost Software License, Version 1.0.
#
# Permission is hereby granted, free of charge, to any person or organization
# obtaining a copy of the software and accompanying documentation covered by
# this licen... |
from common import *
initDependencies = {"POSCAR":"POSCAR", "POTCAR":"POTCAR", "INCAR":"INCAR", "KPOINTS":"KPOINTS"}
A = run4v.Job("run", folder="A", prevDependencies=initDependencies)
B = run4v.Job("run", folder="B", prev=A, prevDependencies=initDependencies)
C = run4v.Job("run", folder="C", prev=B, prevDependenci... |
from django.contrib import admin
from django.contrib.auth.models import User, Permission
from django.contrib.auth.admin import UserAdmin
from django.db.models import Q
from challenges.forms import PhaseRoundAdminForm
from challenges.models import (Challenge, Phase, Submission, ExternalLink,
... |
#!/usr/bin/env python
# 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
#
# Authors:
# - Mario Lassnig, mario.lassnig@cern.ch, 2017
# - Paul Nilsson, ... |
# SPDX-License-Identifier: MIT
"""
Unit tests for slots-related functionality.
"""
import pickle
import sys
import types
import weakref
from unittest import mock
import pytest
import attr
from attr._compat import PYPY, just_warn, make_set_closure_cell
# Pympler doesn't work on PyPy.
try:
from pympler.asizeo... |
#!/home/ssi/jwhitmore/progs/epd-7.1-2-rh5-x86_64/bin/python
# Copyright Jonathan Whitmore
# Distributed under the Boost Software License, Version 1.0.
#
# Permission is hereby granted, free of charge, to any person or organization
# obtaining a copy of the software and accompanying documentation covered by
# this licen... |
from django.core.urlresolvers import reverse
from django.utils.translation import ugettext_lazy as _
from django.db.models import Count, Q
from django.core.paginator import Paginator
from qa.models import QualityAssuranceCheck
from source import models as source_models
from contracts import models as contract_models
f... |
import logging
from django.contrib import messages
from django.contrib.auth.decorators import login_required, permission_required
from django.core.exceptions import PermissionDenied, ObjectDoesNotExist
from django.core.urlresolvers import reverse
from django.core.paginator import Paginator, InvalidPage, EmptyPage
from... |
import sys
import lldb
import logging
import debugevents
import itertools
import handles
import terminal
import subprocess
import util
log = logging.getLogger(__name__)
def opt_str(s):
return str(s) if s != None else None
class DebugSession:
def __init__(self, event_loop, send_message):
self.event_l... |
#!/usr/bin/env python
# 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
#
# Authors:
# - Mario Lassnig, mario.lassnig@cern.ch, 2017
# - Paul Nilsson, ... |
import numpy
from chainer import cuda
from chainer.functions.connection import depthwise_convolution_2d
from chainer import initializers
from chainer import link
class DepthwiseConvolution2D(link.Link):
"""Two-dimensional depthwise convolutional layer.
This link wraps the :func:`~chainer.functions.depthwis... |
# -*- coding: utf-8 -*-
# Copyright 2014 OpenMarket 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 la... |
#!/home/ssi/jwhitmore/progs/epd-7.1-2-rh5-x86_64/bin/python
# 2011-11-16 helpreduce.py
import sys
import shutil
import os
import glob
import csv
import pprint
import numpy as np
import scipy as sp
import subprocess as subprocess
import time
import datetime
from optparse import OptionParser
import argparse
from Config... |
# global
import os
import sys
import json
import platform
import webbrowser
import logging
from twisted.internet import threads
from twisted.internet import reactor
import sasmodels
import sasmodels.model_test
import sasmodels.kernelcl
from sasmodels.generate import F32, F64
import sas.qtgui.Utilities.GuiUtils as Gui... |
"""
Copyright 2015-2017 Jacob M. Graving <jgraving@gmail.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 or agree... |
import collections
import numpy as np
import os
import chainer
from chainer.dataset.download import get_dataset_directory
import chainer.functions as F
import chainer.links as L
from chainer.links import VGG16Layers
from chainercv.links.model.faster_rcnn.faster_rcnn import FasterRCNN
from chainercv.links.model.faster... |
# -*- coding: utf-8 -*-
import click
import distutils.spawn
import pytest
import zazu.cli
import zazu.style
import zazu.util
def write_c_file_with_bad_style(file):
with open(file, 'w') as f:
f.write('void main(){\n\n}\n \n')
def write_py_file_with_bad_style(file):
with open(file, 'w') as f:
... |
#!/usr/bin/python
# Author : ipmstyle, https://github.com/ipmstyle
# : jeonghoonkang, https://github.com/jeonghoonkang
# for the detail of HW connection, see lcd_connect.py
devel_dir="/home/pi/devel"
tmp_dir=devel_dir+"/BerePi/apps"
from types import *
import sys
from time import strftime, localtime
sys.path.a... |
import oelite.fetch
import oelite.git
import oelite.util
import os
import re
import warnings
import string
import sys
import hashlib
class GitFetcher():
SUPPORTED_SCHEMES = ("git")
SHA1_RE = re.compile("([0-9a-f]{1,40})$")
def __init__(self, uri, d):
if not uri.scheme in self.SUPPORTED_SCHEMES:
... |
"""
Usage:
heatmaps.py
"""
import pickle
from collections import defaultdict
from IPython import embed #FIXME name collisions sadness
import requests
import libxml2
import numpy as np
import pylab as plt
from docopt import docopt
args = docopt(__doc__, version='heatmaps .0001')
# NOTES: normalize by the first ... |
import sqlite3
import os
import base64
import time
import string
import hashlib
import bcrypt
from Crypto.Cipher import AES
from werkzeug.security import generate_password_hash, check_password_hash
class Database(object):
def __init__(self, dbfile):
self.dbfile = dbfile
conn = self.db_conn()
... |
# Copyright 2018 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... |
#
# Root of the pints module.
# Provides access to all shared functionality (optimisation, mcmc, etc.).
#
# This file is part of PINTS (https://github.com/pints-team/pints/) which is
# released under the BSD 3-clause license. See accompanying LICENSE.md for
# copyright notice and full license details.
#
"""
Pints: Prob... |
""" ==========================================================
File: WakaTime.py
Description: Automatic time tracking for Sublime Text 2 and 3.
Maintainer: WakaTi.me <support@wakatime.com>
Website: https://www.wakati.me/
==========================================================="""
__version__ = '1.5.2'
... |
import numpy as np
def assert_is_bbox(bbox, size=None):
"""Checks if bounding boxes satisfy bounding box format.
This function checks if given bounding boxes satisfy bounding boxes
format or not.
If the bounding boxes do not satifiy the format, this function raises an
:class:`AssertionError`.
... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
""" Tests slow summing algorithm
"""
from __future__ import division, print_function
import numpy as np
import os
from os.path import abspath, dirname, join, split
import sys
# Add parent directory to beginning of path variable
DIR = dirname(abspath(__file__))
sys.path =... |
import os
import random
import base64
import time
import string
import hashlib
from Crypto.Cipher import AES
from werkzeug.security import generate_password_hash, check_password_hash
from peewee import Expression, OP
from playhouse.shortcuts import model_to_dict
import markov
from models import (database, User, Pa... |
from apps.bluebottle_utils.managers import GenericForeignKeyManagerMixin
from django.db import models
from django.utils.text import Truncator
from django.utils.translation import ugettext_lazy as _
from django.contrib.contenttypes.models import ContentType
from django.contrib.contenttypes import generic
from django_ext... |
from odoo import http
from odoo.http import request
from odoo.addons.website_sale.controllers.main import WebsiteSale
from odoo.addons.http_routing.models.ir_http import slug
from odoo.tools import safe_eval
from odoo import models
from odoo.exceptions import ValidationError, UserError
def get_pricelist():
sale_o... |
import os
from itertools import chain
from django.db import models
from django.utils.translation import ugettext_lazy as _
from django.core.urlresolvers import reverse
from django.dispatch import receiver
from django.db.models.signals import pre_save
from reversion import revisions
from ckeditor.fields import RichTe... |
# -*- coding: utf-8 -*-
import io
import json
import os
import re
import sys
import base64
import fnmatch
import hashlib
import contoml
from first import first
import pipfile
import pipfile.api
import six
import toml
import json as simplejson
from ._compat import Path
from .cmdparse import Script
from .utils import (... |
#!/usr/bin/env python
__author__ = 'greg'
from aggregation_api import AggregationAPI,InvalidMarking
from classification import Classification
import clustering
import math
import pandas as pd
import numpy as np
from scipy.spatial.distance import pdist,squareform
from scipy.cluster.hierarchy import linkage
import abc
im... |
from __future__ import unicode_literals
import io
import os
import re
import sys
import tempfile
import uuid
if sys.version_info < (2, 7):
# we need unittest.skipIf, which isn't in unittest in python 2.6.
# note this causes a deprecation warning on django 1.7, but django 1.7 doesn't support python < 2.7
f... |
#-------------------------------------------------------------------------------
import sqlite3
import bcrypt
import os
import shutil
import data
#-------------------------------------------------------------------------------
BCRYPT_ROUNDS = 5
template = 'template.db'
database = 'database.db'
# JOB STATE
JOB_CREATED... |
import jug.task
import jug.dict_store
jug.task.Task.store = jug.dict_store.dict_store()
def add1(x):
return x + 1
def add2(x):
return x + 2
def _assert_tsorted(tasks):
for i in xrange(len(tasks)):
for j in xrange(i+1,len(tasks)):
for dep in list(tasks[i].dependencies) + tasks[i].kwde... |
"""
This module is the main part of the library. It houses the Scheduler class
and related exceptions.
"""
from threading import Thread, Event, Lock
from datetime import datetime, timedelta
from logging import getLogger
import os
import sys
from apscheduler.util import *
from apscheduler.triggers import SimpleTrigger... |
from django.db import models
from django.contrib.auth.models import User
from django.utils.translation import ugettext_lazy as _
from core.models import BaseModel
from source.constants import SOURCE_FREQUENCY_PER_YEAR
from source.models import Source
class Harvest(BaseModel):
"""
Represents the event of ... |
import json
import os
import pipfile
import toml
from requests.compat import OrderedDict
from .utils import format_toml, mkdir_p
from .utils import convert_deps_from_pip
class Project(object):
"""docstring for Project"""
def __init__(self):
super(Project, self).__init__()
@property
def nam... |
"""Functions for processing CUES data in AppEngine JSON format into CSV format
Has one public function, ProcessResults, used like this from interpreter:
ProcessResults('2015-01-06cuesDogfoodData.json', '2015-01-06-')
"""
import csv
import dateutil.parser
from datetime import datetime
import json
import re
DOGFOO... |
#coding: utf-8
import sys, json, time, urllib2
from pyquery import PyQuery
def getPyQueryFromURL(url):
opener = urllib2.build_opener()
opener.addheaders = [('User-agent', 'mozilla 3.6')] #fake agent
return PyQuery(opener.open(url).read())
def printProgressBar(current,maximum):
percentage = int(float(current)/flo... |
import random
'''I PUT IN COMMENTS THE FILTER PART AS THIBAULT ALREADY UPDATED IT'''
# """FILTER"""
# def define_treatment_needed(people):
# # health_status is generated (30% of population nee for eye-related treatment: 20% glasses, 10% surgery), 70% don't need treatment
# # 0 : no need for eye treatment, 1: need ... |
from django.core.urlresolvers import reverse
from django.http import Http404
from django.template.context import RequestContext
import simplejson
from corehq.apps.api.es import FullXFormES
from corehq.apps.reports.datatables import DataTablesColumn, DataTablesHeader
from corehq.apps.reports.generic import GenericTabula... |
#!/usr/bin/env python
"""This module has tests for the pvl lang functions."""
# Copyright 2019, Ross A. Beyer (rbeyer@seti.org)
#
# 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 os
from px import px_top
from px import px_poller
from px import px_process
from px import px_terminal
from px import px_launchcounter
from . import testutils
def test_adjust_cpu_times():
now = testutils.local_now()
current = [
px_process.create_kernel_process(now),
testutils.create_... |
# coding=utf-8
from classification_utils import get_word_count, sanitize_tweet, \
get_positive_negative_tweets_from_manually_labeled_tweets, get_lines_from_file, load_manually_labeled_tweets, \
aggregate_results
def word_count_classification(tweets_list, negative_dict, positive_dict, threshold=0):
"""
... |
import ConfigParser
import os
import sys
class Command(object):
def __init__(self, args):
self.args = args
def print_message(self, message, verbosity_needed=1):
""" Prints the message, if verbosity is high enough. """
if self.args.verbosity >= verbosity_needed:
print mess... |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
from django.contrib.auth.decorators import user_passes_test
from django.core.urlresolvers import reverse
from django.db.models import Sum
from django.views.generic import DetailView, ListView, RedirectView, UpdateView
from django.contrib... |
# coding: utf-8
from __future__ import print_function
import argparse
import json
import os
import sys
import time
from .. import compat, Catalog
__all__ = ['createservice', 'manageservice', 'managesite', 'deletecache',
'managecachetiles', 'createcacheschema',
'convertcachestorageformat', 'impo... |
"""Helper functions to call command line tools from python
@todo:
- Make it flexible so that a dict(a=42) can be given and
'a=42' or '-a 42' or '--a 42' is generated depending on an option!
- Make it a class, so that options like dryrun or options formattting
don't have to be handed around all the time!!!"""
import s... |
from sqlalchemy import create_engine
from sqlalchemy.orm import scoped_session, sessionmaker, class_mapper
from sqlalchemy.ext.declarative import declarative_base
import config as cfg
class DB(object):
engine = None
db_session = None
Base = declarative_base()
def __init__(self, dbstring):
self... |
#!/usr/bin/env python
import os
import re
import subprocess
import sys
db_admin_user = 'postgres'
original_db = 'original'
def info(message):
print message
def quiet_check_call(*args, **kwargs):
try:
with open('/tmp/subprocess.out', 'w') as out:
subprocess.check_call(*args,
... |
import sys
import tempfile
import os
from pathlib import Path
from typing import Text, Dict, Any
from unittest.mock import Mock
import pytest
from _pytest.capture import CaptureFixture
from _pytest.monkeypatch import MonkeyPatch
import rasa.model
import rasa.core
import rasa.nlu
import rasa.shared.importers.autoconfi... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import unittest
import os
from quikql import Quikql as ql
class QuikqlTest(unittest.TestCase):
def setUp(self):
self.testdb = ql(path)
self.testdb.create_table('test_table', ids='INTEGER')
def test_create_database(self):
test_table = 't... |
import contextlib
import itertools
import math
import os.path
from pathlib import Path
import pickle
import shutil
import sys
import tempfile
from typing import Optional
import warnings
from contextlib import ExitStack
from io import BytesIO
import numpy as np
import pandas as pd
import pytest
import xarray as xr
fro... |
import os
import settings
import subprocess
import shlex
import sys
from logger import Logger
def exit(logger, message, error=True):
'''Wrapper around sys.exit to faciliate good logging
This just functionalizes some code that gets used a lot in here,
logging a message and appropriately exiting.
It d... |
'''
TODO:
1:put array variables, sort functions into a class
2:include all assessment tags as arrays, centralise all assessment sorting into
one file, using main class
3: possible reporting function
4: sorting class to call infusionsoft class to get customer tags
5: use pandas or matplotlib for dataviz
6: statistic... |
# -*- coding: utf-8 -*-
import pytest
import plexapi.utils as utils
from plexapi.exceptions import NotFound
def test_utils_toDatetime():
assert str(utils.toDatetime('2006-03-03', format='%Y-%m-%d')) == '2006-03-03 00:00:00'
assert str(utils.toDatetime('0'))[:-9] in ['1970-01-01', '1969-12-31']
# should th... |
"""
mbed SDK
Copyright (c) 2011-2013 ARM Limited
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 wr... |
#!/usr/bin/env python3
"""Functions for reading and plotting estimator files.
Examples are temperatures, populations, heating/cooling rates.
"""
# import math
import argparse
import gzip
import math
import os
import re
import sys
from collections import namedtuple
from functools import lru_cache
from itertools import c... |
# Mrs
# Copyright 2008 Andrew McNabb <amcnabb-mrs@mcnabbs.org>
#
# This file is part of Mrs.
#
# Mrs 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 3 of the License, or (at your option)
... |
# -*- encoding: utf-8 -*-
import types
import unittest
from marnadi.utils import Lazy
try:
str = unicode
except NameError:
pass
_test_tuple = ('foo', 'bar')
_test_list = ['foo', 'bar']
_test_set = set(_test_tuple)
_test_dict = {'foo': 'bar'}
_test_str = b'foo'
_test_unicode = u'вася'
def _test_functio... |
import sys
from PlayerPython import *
from os import environ
import os.path
import ast
## FIGURE OUT WHETHER THIS IS A BATCH RUN
'''
If this is a batch run, CompuCell will modify 'batch_message,' so that it will contain all the necessary
information for such a run. If it is NOT a batch run, CompuCell will leave 'batch... |
#!/usr/bin/env python3
import argparse
import glob
import itertools
import math
import os
import sys
from pathlib import Path
from typing import Iterable
import numpy as np
import pandas as pd
from astropy import constants as const
from astropy import units as u
import artistools as at
import artistools.spectra
impo... |
import numpy as np
from pax import plugin, datastructure, utils
# Used for diagnostic plotting only
# TODO: factor out to separate plugin?
import matplotlib.pyplot as plt
import os
class FindSmallPeaks(plugin.TransformPlugin):
def startup(self):
# Get settings from configuration
self.min_sigma ... |
import yaml
import random
import string
def GetZonesList(context):
zones = []
if context.properties['usEast1b']:
zones.append('us-east1-b')
if context.properties['usEast1c']:
zones.append('us-east1-c')
if context.properties['usEast1d']:
zones.append('us-east1-d')
if context.... |
import itertools
from datetime import datetime
import pytest
from tests import BaseTestCase
from parameterized import parameterized, param
from dateparser.utils import (
find_date_separator, localize_timezone, apply_timezone,
apply_timezone_from_settings, registry,
get_last_day_of_month, get_previous_lea... |
"""
SoftLayer.Network
~~~~~~~~~~~~~~~~~
Network Manager/helpers
:copyright: (c) 2013, SoftLayer Technologies, Inc. All rights reserved.
:license: BSD, see LICENSE for more details.
"""
from SoftLayer.utils import NestedDict, query_filter, IdentifierMixin
class NetworkManager(IdentifierMixin, obj... |
"""
ARCHES - a program developed to inventory and manage immovable cultural heritage.
Copyright (C) 2013 J. Paul Getty Trust and World Monuments Fund
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 Founda... |
#!/usr/bin/env python2.5
#
# Copyright 2008 the Melange 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 applic... |
# coding: utf-8
# This file is part of LiSE, a framework for life simulation games.
# Copyright (c) 2013-2014 Zachary Spector, zacharyspector@gmail.com
from collections import (
Mapping,
MutableMapping,
MutableSequence,
Callable,
defaultdict
)
from .funlist import FunList
from .util import (
di... |
#!/usr/bin/env python3
"""Artistools - spectra related functions."""
import argparse
import json
import math
import multiprocessing
from collections import namedtuple
from functools import lru_cache
from functools import partial
from pathlib import Path
import matplotlib.ticker as ticker
import matplotlib.pyplot as pl... |
# -*- coding: utf-8 -*-
##############################################################################
#
# Odoo - Sentry connector
# Copyright (C) 2014 Mohammed Barsi.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# ... |
# -*- coding: utf-8 -*-
import os
import json
import requests
import configparser
from easydict import EasyDict as edict
from datetime import datetime
from archives_tools.dacs import iso2DACS
import uuid
#funtions for debugging
def pp(output):
try:
print (json.dumps(output, indent=2))
except:
import ast
print ... |
# Landsat Util
# License: CC0 1.0 Universal
"""Tests for utils"""
from os.path import join
import errno
import shutil
import unittest
from tempfile import mkdtemp, mkstemp
from landsat import utils
class TestUtils(unittest.TestCase):
@classmethod
def setUpClass(cls):
cls.temp_folder_base = mkdtemp... |
# This file is part of LiSE, a framework for life simulation games.
# Copyright (c) 2013 Zachary Spector, zacharyspector@gmail.com
"""Common utility functions and data structures.
"""
from collections import Mapping
def dispatch(d, key, *args):
assert(isinstance(d, Mapping))
if key in d:
for f in d[... |
#!/usr/bin/env python
# coding: utf-8
import os
from flask import json
import kvstore_module
from Trace.trace_helper import get_similar_names
from paths import *
import sys
from datetime import datetime
reload(sys)
sys.setdefaultencoding('utf8')
path_prepend = os.path.join(os.path.dirname(os.path.dirname(os.path.ab... |
#!/usr/bin/env python3
import argparse
# import glob
import math
# import re
import multiprocessing
import os
from collections import namedtuple
from functools import lru_cache
from pathlib import Path
import matplotlib.pyplot as plt
import numpy as np
# import matplotlib.ticker as ticker
import pandas as pd
from astr... |
#! /usr/bin/env python3
import sys
import cmd
import os.path
import yaml
import tweepy
import subprocess
import tempfile
import re
class TweetShell(cmd.Cmd):
prompt = '(nologin)> '
__consumer_key = 'IoapgGY0Of2AT84itoGw'
__consumer_sec = 'edB8pOHB9XSN0waHg8fiHWCGfb5Cur8LbF7yEzXpE'
__current_auth = None
__ap... |
#!/usr/bin/env python2.5
#
# Copyright 2008 the Melange 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 applic... |
#! /usr/bin/env python
"""An RFC 2821 smtp proxy.
Usage: %(program)s [options] localhost:port remotehost:port
Options:
--nosetuid
-n
This program generally tries to setuid `nobody', unless this flag is
set. The setuid call will fail if this program is not run as root (in
which case, ... |
#!/usr/bin/env python
"""
Example using Lyn (bindings to GNU Lightning) to JIT-compile native code that
takes an integer and returns its increment.
Then we disassemble the function using Capstone. Sweet!
Note that we explicitly disassemble the code as x86-64. If you're on a
different architecture, just pass differen... |
# coding=utf-8
from pyfiglet import Figlet, DEFAULT_FONT
from PIL import Image
import re
import curses
#: Attribute conversion table for the ${c,a} form of attributes for
#: :py:obj:`.paint`.
ATTRIBUTES = {
"1": curses.A_BOLD,
"2": curses.A_NORMAL,
"3": curses.A_REVERSE,
"4": curses.A_UNDERLINE,
}
c... |
"""distutils
The main package for the Python Module Distribution Utilities. Normally
used from a setup script as
from distutils.core import setup
setup (...)
"""
__revision__ = "$Id$"
# Distutils version
#
# Updated automatically by the Python release process.
#
#--start constants--
__version__ = "2.7b2"
#-... |
import pytest
from utils import *
import random
def test_removeall_list():
assert removeall(4, []) == []
assert removeall(4, [1, 2, 3, 4]) == [1, 2, 3]
assert removeall(4, [4, 1, 4, 2, 3, 4, 4]) == [1, 2, 3]
def test_removeall_string():
assert removeall('s', '') == ''
assert removeall('s', 'This... |
import xbmc
from lib.libs import iso639, mediatypes
from lib.libs.addonsettings import settings
from lib.libs.pykodi import json, UTF8JSONDecoder
from lib.libs.utils import SortedDisplay
from lib.providers.base import AbstractImageProvider, ProviderError, cache, build_key_error
class KyraDBMovieProvider(AbstractImage... |
# Define names for all type symbols known in the standard interpreter.
# Types that are part of optional modules (e.g. array) are not listed.
import sys
NoneType = type(None)
TypeType = type(NoneType)
IntType = type(0)
LongType = type(0L)
FloatType = type(0.0)
try:
ComplexType = type(complex(0,1))
except NameError:... |
from collections import q_list as list
from collections import table
from collections import q_dict as dict
from types import q_str as str
from types import month, date, datetime, time, minute, second
from conn import conn
|
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Views tests for the OSF."""
from __future__ import absolute_import
import datetime as dt
import httplib as http
import json
import time
import unittest
import urllib
from flask import request
import mock
import pytest
from nose.tools import * # noqa PEP8 asserts
from... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.