text stringlengths 17 737k |
|---|
"""
Package resource API
--------------------
A resource is a logical file contained within a package, or a logical
subdirectory thereof. The package resource API expects resource names
to have their path parts separated with ``/``, *not* whatever the local
path separator is. Do not use os.path operations to manipul... |
# -*- coding: utf-8 -*-
import scrapy
class OpensooqDebugSpider(scrapy.Spider):
name = "opensooq_debug"
allowed_domains = ["https://sa.opensooq.com/"]
start_urls = [
# paginate
# 'https://sa.opensooq.com/ar/find?term=&cat_id=&scid=&city=&allposts_cb=true&allposts=no&price_from=&price_to=&p... |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU... |
# This file is part of fedmsg.
# Copyright (C) 2013 Red Hat, Inc.
#
# fedmsg 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 version.
#... |
import ldapdb.models
from django.contrib.auth.models import Group, User
from django.db import models
from django.utils.encoding import smart_unicode
from ldapdb.models import fields
from ipynbsrv.wui.signals.signals import *
from random import randint
class Backend(models.Model):
'''
The backend model is used... |
# -*- coding: utf-8 -*-
import plotly.graph_objs as go
from plotly import tools
import copy
from .layout import ElementBuilder
from .plot import AtomBuilder
from .subplot import SubPlotSpec, PlotCanvas
import itertools
class FigureHolder(object):
def __init__(self, figure):
self.figure = figure
def ... |
import requests
from graph import Graph
from distance import calculate_distance
import sys
def import_cities():
'''
Import the city flight connection path JSON file,
Returns dictionary of cities
'''
# url = 'cities_with_airports.json'
url = 'https://codefellows.github.io/sea-python-401d... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import (division, print_function, absolute_import,
unicode_literals)
import numpy as np
from radial import orbit, dataset, rv_model, prior
import scipy.signal as ss
import matplotlib.pyplot as plt
import matplotlib.markers as mrk
im... |
#!/usr/bin/env python
"""
Copyright (c) 2006-2015 sqlmap developers (http://sqlmap.org/)
See the file 'doc/COPYING' for copying permission
"""
import binascii
import compiler
import httplib
import json
import keyword
import logging
import re
import socket
import string
import struct
import time
import traceback
impor... |
"""Functions to communicate with the server using JSONRPC"""
from __future__ import absolute_import, division, print_function
import sys
import os
import time
from copy import deepcopy
from functools import wraps
from datetime import datetime
import logging
from iceprod.core import constants
from iceprod.core impor... |
class FlatList(list):
"""
This class inherits from list and has the same interface as a list-type.
However, there is a 'data'-attribute introduced, that is required for the encoding of the list!
The fields of the encoding-Schema must match the fields of the Object to be encoded!
"""
@property
... |
#!/usr/bin/env python
import inspect
import itertools
import logging
l = logging.getLogger(name = "simuvex.s_procedure")
import claripy
symbolic_count = itertools.count()
from .s_run import SimRun
run_args = inspect.getargspec(SimRun.__init__)[0]
class SimProcedure(SimRun):
ADDS_EXITS = False
NO_RET = Fal... |
from contextlib import contextmanager
from datetime import date
from rorn.ResponseWriter import ResponseWriter
from Task import Task
from LoadValues import isDevMode
from utils import *
colorMap = { # Maps status names to border colors
'blocked': '#00008b',
'canceled': '#000',
'complete': '#008b00',
'deferred': ... |
from ConfigParser import RawConfigParser
from tweepy import api, StreamListener, Stream, BasicAuthHandler
class Listener(StreamListener):
__slots__ = ('templates', 'output', 'triggers')
def __init__(self, templates, output, triggers):
super(Listener, self).__init__()
self.templates = templat... |
"""
Main entry point to access the on-the-fly estimation of
thermochemical properties of species using quantum chemical packages such
as G03, (Open)Mopac and MM4.
This module contains the driver class called QMTP with its principal method
.generateQMThermoData that generates a ThermoData object.
A molfile class i... |
# -*- coding: utf-8 -*-
u"""simulation data operations
:copyright: Copyright (c) 2019 RadiaSoft LLC. All Rights Reserved.
:license: http://www.apache.org/licenses/LICENSE-2.0.html
"""
from __future__ import absolute_import, division, print_function
from pykern import pkconfig
from pykern import pkio
from pykern.pkcol... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import requests
from requests.exceptions import ConnectionError
LOGIN = "http://api.lingualeo.com/api/login"
ADD_WORD = "http://api.lingualeo.com/addword"
GET_TRANSLATE = "http://api.lingualeo.com/gettranslates?word="
class Lingualeo:
def __init__(self, email, passw... |
"""
Code used to support old snapshots (those created from 0.9.7/r11275
onwards).
$Id$
"""
__version__='$Revision: 8021 $'
import sys
import param
# CEB: Add note that snapshot can be re-saved, making updates
# permanent. All functions in here should be written to support that.
# CEB: code to support older snapsh... |
__author__ = 'Chaya D. Stern'
import numpy as np
import logging
import sys
verbose = False
def RMSE(scanSet, db):
'''
:param model: TorsionScanSet
:param db: pymc database
:return: numpy array of rmse
'''
N = len(scanSet.qm_energy)
errors = np.zeros(len(db.trace('mm_energy')[:]))
fo... |
from FAdo.fa import *
import math
class MiniTasksAutomatonInterface():
_separator_string = " "
_negation_string = "not"
_anything_string = "anything"
_and_string = "and"
_or_string = "or"
_sigma = []
for i in range(26):
_sigma.append(chr(ord('A') + i))
def __init__(self, desc... |
# -*- coding: utf-8 -*-
"""
This module can do slight modifications to a wiki page source code such that
the code looks cleaner. The changes are not supposed to change the look of the
rendered wiki page.
The following parameters are supported:
¶ms;
-always Don't prompt you for each replacement. Warnin... |
from __future__ import absolute_import
from functools import partial
from sympy import S, finite_diff_weights
from devito.finite_differences import Differentiable
from devito.tools import Tag
__all__ = ['first_derivative', 'second_derivative', 'cross_derivative',
'generic_derivative', 'second_cross_deriv... |
# -*- coding: utf-8 -*-
###############################################################################
#
# ODOO (ex OpenERP)
# Open Source Management Solution
# Copyright (C) 2001-2015 Micronaet S.r.l. (<http://www.micronaet.it>)
# Developer: Nicola Riolini @thebrush (<https://it.linkedin.com/in/thebrush>)
# This pro... |
import deepsecurity as api
from deepsecurity.rest import ApiException as api_exception
import codecs
import re
import time
import pickle
import os
#DSM Host & port (must end in /api)
HOST='https://app.deepsecurity.trendmicro.com:443/api'
#API Key from the DSM defined in an environment varaible called "API_KEY"
API_KEY... |
import numpy as np
import pandas as pd
import sys
sys.path.append("..")
import matplotlib.pyplot as plt
import seaborn as sns
from sklearn.linear_model import LogisticRegression
import src.data.extractor.preprocessing as preprocessing
from sklearn.model_selection import train_test_split
from sklearn.metrics import clas... |
import logging
import plistlib
from six import PY2
from six.moves.urllib import parse as urlparse
import time
from libpytunes.Song import Song
from libpytunes.Playlist import Playlist
logger = logging.getLogger(__name__)
try:
import xspf
xspfAvailable = True
except ImportError:
xspfAvailable = False
... |
__version_info__ = (1, 4, 0, None)
# Dot-connect all but the last. Last is dash-connected if not None.
__version__ = '.'.join([str(i) for i in __version_info__[:-1]])
if __version_info__[-1] is not None:
__version__ += ('-%s' % (__version_info__[-1],))
# context processor to add version to the template environm... |
# -*- Mode: Python -*-
# vi:si:et:sw=4:sts=4:ts=4
# Flumotion - a streaming media server
# Copyright (C) 2004,2005,2006,2007,2008,2009 Fluendo, S.L.
# Copyright (C) 2010,2011 Flumotion Services, S.A.
# All rights reserved.
#
# This file may be distributed and/or modified under the terms of
# the GNU Lesser General Pub... |
# Django settings for recipe project.
DEBUG = True
TEMPLATE_DEBUG = DEBUG
ADMINS = (
# ('Your Name', 'your_email@example.com'),
)
MANAGERS = ADMINS
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'.
'NAME': 'db/reci... |
from __future__ import absolute_import, unicode_literals
from django.db.models.signals import post_save
from django.dispatch import receiver
from tracpro.client import get_client
from tracpro.groups.models import Group
from .models import Contact, ContactField
@receiver(post_save, sender=Contact)
def set_data_field... |
#!/usr/bin/env python3
import argparse
import yaml
import jinja2
import weasyprint
parser = argparse.ArgumentParser()
parser.add_argument('--data', help='path to data directory', required=True)
parser.add_argument('--number', help='Invoice number', type=int, required=True)
args = parser.parse_args()
data_directory =... |
# Copyright (c) 2015, 2016, 2017, 2018, Intel Corporation
#
# 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, this list of con... |
import sys
import os
from numpy import *
from scipy.linalg import *
from scipy.sparse import *
from pyspark import SparkContext
import logging
if len(sys.argv) < 6:
print >> sys.stderr, \
"(shotgun) usage: shotgun <master> <inputFile_A> <inputFile_y> <outputFile> <lambda>"
exit(-1)
def parseVector(line):
vec =... |
__author__ = 'onur'
from celery import Celery
import direnaj_api.config.server_celeryconfig as celeryconfig
app_object = Celery()
app_object.config_from_object(celeryconfig)
@app_object.task
def deneme(x, seconds):
print "Sleeping for printing %s for %s seconds.." % (x, seconds)
import time
time.sleep(... |
__author__ = 'onur'
from celery import Celery
import direnaj_api.config.server_celeryconfig as celeryconfig
app_object = Celery()
app_object.config_from_object(celeryconfig)
@app_object.task
def deneme(x, seconds):
print "Sleeping for printing %s for %s seconds.." % (x, seconds)
import time
time.sleep(... |
"""
Simfile parser for Python. This library currently only supports the .SM
format; .SSC support is planned for the future.
"""
import codecs
from cStringIO import StringIO
from decimal import Decimal
from fractions import Fraction, gcd
import os
__author__ = 'Grant Garcia'
__copyright__ = 'Copyright 2013, Grant Garci... |
class Dashboard(object):
"""Librato Dashboard Base class"""
def __init__(self, connection, name, id=None, instrument_dicts=None):
self.connection = connection
self.name = name
self.instrument_ids = []
self._instruments = None
for i in (instrument_dicts or []):
... |
# coding: utf-8
from datetime import datetime
try:
import simplejson as json
except ImportError:
import json
from celery.schedules import schedule, crontab
class RedBeatJSONDecoder(json.JSONDecoder):
def __init__(self, *args, **kargs):
super(RedBeatJSONDecoder, self).__init__(object_hook=self.d... |
# Copyright 2012 OpenStack Foundation
#
# 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 l... |
"""
This module contains the spatial lookup types, and the get_geo_where_clause()
routine for PostGIS.
"""
import re
from decimal import Decimal
from django.db import connection
from django.conf import settings
from django.contrib.gis.measure import Distance
from django.contrib.gis.db.backend.util import SpatialOper... |
############################################################################
#
# Copyright (C) 2014 tele <tele@rhizomatica.org>
#
# This file is part of RCCN
#
# RCCN is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero Public License as published by
# the Free Software Foundat... |
from __future__ import absolute_import
import boto3
import botocore
import inspect
import os
import zipfile
from django.core.exceptions import ImproperlyConfigured
from django.core.management.base import BaseCommand
from django.utils.text import slugify
from zappa.zappa import Zappa
class ZappaCommand(BaseCommand):... |
# Copyright 2013 Rackspace 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/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writi... |
# Copyright 2013 Rackspace 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/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writi... |
# -*- coding: utf-8 -*-
# Copyright (c) 2010-2012, GEM Foundation.
#
# OpenQuake 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 option) any later version.... |
"""
Graph utilities and algorithms
Graphs are represented with their adjacency matrices, preferably using
sparse matrices.
"""
# Authors: Aric Hagberg <hagberg@lanl.gov>
# Gael Varoquaux <gael.varoquaux@normalesup.org>
# Jake Vanderplas <vanderplas@astro.washington.edu>
# License: BSD
import numpy ... |
'''
Created on May 20, 2014
@author: rd
'''
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2012 Nebula, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# ht... |
'''
@author Luke Campbell
@file ion/services/dm/transformation/example/transform_example.py
@description an Example of a transform
'''
import threading
import time
from interface.objects import ProcessDefinition, StreamQuery
from pyon.ion.streamproc import StreamProcess
from pyon.ion.transform import TransformDataProce... |
# -*- coding: utf-8 -*-
# vim: tabstop=4 shiftwidth=4 softtabstop=4
#
# Copyright (C) 2022, GEM Foundation
#
# OpenQuake 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... |
#!/usr/bin/env python
# encoding: utf-8
"""
docker_connect.py
Created by Mat Appelman on 2013-04-18.
Copyright (c) 2013 __MyCompanyName__. All rights reserved.
"""
import sys
import os
import unittest
import sys
import sys
from subprocess import PIPE, STDOUT, Popen, CalledProcessError
from threading import Thread
i... |
from django.template.defaultfilters import slugify
from django.utils.datastructures import SortedDict
import os
import traceback
import pickle
from limbo.classes import Singleton
import logging
__author__ = 'gdoermann'
logger = logging.getLogger(__file__)
class Properties(dict):
def __init__(self, filepath):
... |
version = "1.0.0dev"
|
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import numpy as np
import keras
from keras import backend
from keras.utils.np_utils import to_categorical
from keras.models import Sequential
from keras.layers import De... |
##
# See the file COPYRIGHT for copyright information.
#
# 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... |
#!/usr/bin/env python
"""
Usage: get-addons [-m] path1 [path2 ...]
Given a list of paths, finds and returns a list of valid addons paths.
With -m flag, will return a list of modules names instead.
"""
from __future__ import print_function
import os
import sys
def is_module(path):
if not os.path.isdir(path):
... |
#
# IAS Basic device framework.
#
# Author: Joeri Hermans
#
import sys
import socket
import struct
import os
import RPIO
from time import sleep
# Global members, which are required for the communication
# with the remote IAS controller.
gDeviceIdentifier = sys.argv[1]
gControllerAddress = sys.argv[2]
gControllerPort... |
#!/usr/bin/python
## Binary Analysis Tool
## Copyright 2012-2013 Armijn Hemel for Tjaldur Software Governance Solutions
## Licensed under Apache 2.0, see LICENSE file for details
import os, os.path, sys, subprocess, copy, cPickle, multiprocessing, pydot
import bat.interfaces
'''
This program can be used to check whe... |
import logging, threading, time
from acq4.util import Qt
import falconoptics
from ..FilterWheel.filterwheel import FilterWheel, FilterWheelFuture, FilterWheelDevGui
class FalconTurret(FilterWheel):
def __init__(self, dm, config, name):
self.dev = falconoptics.Falcon(config_file=config.get('configFile', No... |
import psycopg2
import datetime
import network
nt = network.Table(('IA_ASOS','MO_ASOS','IL_ASOS', 'ND_ASOS', 'AWOS',
'WI_ASOS','MN_ASOS', 'SD_ASOS', 'NE_ASOS', 'KS_ASOS',
'IN_ASOS','KY_ASOS','OH_ASOS','MI_ASOS', 'WFO'))
AFOS = psycopg2.connect(database='afos', host='iemdb', user='nobody')
acursor =... |
import gdata.youtube.service
import sys
import time
def get_first(iterable, default=None):
if iterable:
for item in iterable:
return item
return default
def getplaylist (yt_service, playlist_name):
"""
yt_service: YouTube service
playlist: name to search
Retruns the playlist object o... |
# (c) 2012-2014, Chris Meyers <chris.meyers.fsu@gmail.com>
#
# This file is part of Ansible
#
# Ansible 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) an... |
# -*- encoding: utf-8 -*-
from supriya.tools.systemtools.SupriyaObject import SupriyaObject
class TimespanCollection(SupriyaObject):
r'''A mutable always-sorted collection of timespans.
::
>>> from abjad import timespantools
>>> from supriya import timetools
>>> timespans = (
... |
# Copyright 2017 Mycroft AI Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writin... |
import climate
import collections
import datetime
import fnmatch
import gzip
import io
import itertools
import numpy as np
import os
import pandas as pd
import re
logging = climate.get_logger(__name__)
class TimedMixin:
'''This mixin is for handling filenames that start with timestamps.
'''
FORMAT = '%Y... |
#!/usr/bin/python
## Binary Analysis Tool
## Copyright 2009-2016 Armijn Hemel for Tjaldur Software Governance Solutions
## Licensed under Apache 2.0, see LICENSE file for details
'''
This module contains helper functions to unpack archives or file systems.
Most of the commands are pretty self explaining. The result o... |
# -*- coding: utf-8 -*-
# /***************************************************************************
# Irmt
# A QGIS plugin
# OpenQuake Integrated Risk Modelling Toolkit
# -------------------
# begin : 2014-10-24
# copyright ... |
import inspect
from .base import BaseBackend, CacheBackend, StorageBackend
from .exceptions import InvalidBackend
from ..conf import settings
from ..utils.imports import import_class
from ..utils.uri import URI
BACKENDS = {
'locmem': 'locmem',
'sqlite': 'sqlite'
}
def get_backend(backend):
config = {}
... |
# Module: http
# Date: 13th September 2007
# Author: James Mills, prologic at shortcircuit dot net dot au
"""Hyper Text Transfer Protocol
This module implements the Hyper Text Transfer Protocol
or commonly known as HTTP.
"""
from urllib import unquote
from urlparse import urlparse
from cStringIO import Strin... |
#! /usr/local/bin/python
# NOTE: the above "/usr/local/bin/python" is NOT a mistake. It is
# intentionally NOT "/usr/bin/env python". On many systems
# (e.g. Solaris), /usr/local/bin is not in $PATH as passed to CGI
# scripts, and /usr/local/bin is the default directory where Python is
# installed, so /usr/bin/env w... |
# -*- coding: utf-8 -*-
########################################################################
#
# License: BSD
# Created: May 26, 2003
# Author: Francesc Alted - faltet@pytables.com
#
# $Id$
#
########################################################################
"""Here is defined the AttributeSet class."""
im... |
# -*- coding: utf-8 -*-
import argparse
import json
import logging
from os.path import abspath, exists
from tsstats import config
from tsstats.exceptions import InvalidConfiguration
from tsstats.log import parse_logs
from tsstats.template import render_servers
logger = logging.getLogger('tsstats')
def cli():
p... |
#!/usr/bin/env python3
import sys
import os
modules = {
"intel": ["e1000", "e1000e", "igb", "ixgb", "ixgbe", "ixgbevf", "i40e", "i40evf"],
"accel_ppp": ["ipoe"],
"misc": ["wireguard"]
}
if __name__ == '__main__':
success = True
print("[load modules] Test execution started")
for msk in modules:
... |
import copy
import datetime
import os
import re
import sys
from snakefire import GNOME_ENABLED, KDE_ENABLED
from PyQt4 import Qt
from PyQt4 import QtGui
from PyQt4 import QtCore
if KDE_ENABLED:
from PyKDE4 import kdecore
from PyKDE4 import kdeui
elif GNOME_ENABLED:
import subprocess
import keyring
from campfire... |
import urllib2
from xml.dom import minidom
YQL_URL = 'https://query.yahooapis.com/v1/public/yql?format=xml&q=%s'
WEATHER_NS = 'http://xml.weather.yahoo.com/ns/rss/1.0'
WEATHER_QUERY = 'select * from weather.forecast where woeid in (select woeid from geo.places(1) where text="%s")'
class WeatherPlugin(object):
def... |
"""Tornado handlers for the notebook.
Authors:
* Brian Granger
"""
#-----------------------------------------------------------------------------
# Copyright (C) 2008-2011 The IPython Development Team
#
# Distributed under the terms of the BSD License. The full license is in
# the file COPYING, distributed as p... |
import json
from logging import error
import sendgrid
from django.conf import settings
from django.core.mail import EmailMultiAlternatives
def sendgrid_send(recipients, subject, substitutions, template_id):
from_email = "HackUPC Team <contact@hackupc.com>"
mail = EmailMultiAlternatives(
subject=subje... |
"""Split the expression into tokens."""
import re
import collections
REGEX_OPERATOR = r"^([+\-*/=:()]?|([+\-*/%]=)|)$"
REGEX_WHITESPACE = r"^\s+$"
REGEX_NUMBER = r"^\-?[0-9]+(\.[0-9]+)?$"
REGEX_IDENTIFIER = r"^[a-zA-Z_]+([0-9a-zA-Z_]+)?$"
REGEX_STRING = "\"(\\.|[^\"])*(\")?"
class TokenType(collections.namedtuple("To... |
"""
homeassistant.components.automation.state
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Offers state listening automation rules.
"""
import logging
from homeassistant.helpers.event import track_state_change
from homeassistant.const import MATCH_ALL
CONF_ENTITY_ID = "entity_id"
CONF_FROM = "from"
CONF_TO = "to"
CONF... |
#!/usr/bin/python
"""
ircAsync -- An asynchronous IRC client interface.
This is intended as a component in a semantic web agent
with several interfaces, one of them being IRC.
It's implemented on top of asyncore so that the same
agent can export an HTTP interface in asynchronous,
non-blocking style.
see Log at end f... |
from pandas import DataFrame, Series
import scipy.sparse as sparse
from sqlalchemy.sql import bindparam, select
from .features import get_span_feats
from .models import GoldLabel, GoldLabelKey, Label, LabelKey, Feature, FeatureKey, Candidate
from .models.meta import new_sessionmaker
from .udf import UDF, UDFRunner
fro... |
import re
# private
pallette = {'grey': '\x38', 'blue': '\x39', 'green': '\x3a', 'cyan': '\x3b', 'red': '\x3c', 'magenta': '\x3d'}
clearseq = '\x04\x67'
# private
crankseq = '\x04\x65'
def getmaxlen(s, maxlen):
if len(s) > maxlen:
return len(s)
return maxlen
def getmaxpad(s, maxlen):
return ((... |
from django.db import models
from django.urls import reverse
# add options if needed
CATEGORY_OPTIONS = [('io', 'I/O'), ('intro', 'Introduction')]
LEVEL_OPTIONS = [(1, 'Beginner'), (2, 'Intermediate'), (3, 'Expert')]
LANGUAGE = [('de', 'german'), ('en', 'english'), ('fr', 'french')]
LICENSE = [('none', 'No'), ('cc0', ... |
from unittest import TestCase
from gsdmm.mgp import MovieGroupProcess
import numpy
class TestGSDMM(TestCase):
'''This class tests the Panel data structures needed to support the RSK model'''
def setUp(self):
numpy.random.seed(47)
def tearDown(self):
numpy.random.seed(None)
def comput... |
import pytest
from encoded.types.file import File, FileFastq, FileFasta, post_upload, force_beanstalk_env
from pyramid.httpexceptions import HTTPForbidden
import os
pytestmark = pytest.mark.working
def test_reference_file_by_md5(testapp, file):
res = testapp.get('/md5:{md5sum}'.format(**file)).follow(status=200)
... |
import glob
import io
import os
import sys
from pathlib import Path
import pytest
import numpy as np
import torch
from PIL import Image, __version__ as PILLOW_VERSION
import torchvision.transforms.functional as F
from common_utils import get_tmp_dir, needs_cuda
from _assert_utils import assert_equal
from torchvision.... |
# Tweepy
# Copyright 2009-2021 Joshua Roesslein
# See LICENSE for details.
# Appengine users: https://developers.google.com/appengine/docs/python/sockets/#making_httplib_use_sockets
import json
import logging
from math import inf
import ssl
from threading import Thread
from time import sleep
import requests
from req... |
import os
import re
from cloudvolume import paths
from cloudvolume.paths import strict_extract, extract, ExtractedPath
from cloudvolume.exceptions import UnsupportedProtocolError
from cloudvolume import lib
def test_path_extraction():
extract = paths.extract(r'file://C:\wow\this\is\a\cool\path', windows=True, disa... |
import json
import uuid
from libs.json_utils import dumps, loads
from polyaxon.settings import RedisPools, redis
class BaseRedisDb(object):
REDIS_POOL = None
@classmethod
def _get_redis(cls):
return redis.Redis(connection_pool=cls.REDIS_POOL)
class RedisJobContainers(BaseRedisDb):
"""Track... |
import os
import subprocess as sp
import pytest
import yaml
import tempfile
import requests
import uuid
import contextlib
from bioconda_utils import utils
from bioconda_utils import pkg_test
from bioconda_utils import docker_utils
from bioconda_utils import cli
from bioconda_utils import build
from bioconda_utils impor... |
from dreaml.dataframe.dataframe import DataFrame
import dreaml
import numpy as np
import json
class TestDataFrameInternal:
def setUp(self):
self.item_count = 8
assert self.item_count >= 4
def test_tuple_to_query(self):
df = DataFrame()
# Test conversion of hashable elements to ... |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals, print_function
import logging
# import weakref # FIXME: there should be weakrefs in this module
import psd_tools.reader
import psd_tools.decoder
from psd_tools.constants import TaggedBlock, SectionDivider, ImageResourceID
fr... |
# -*- coding: utf-8 -*-
# FOGLAMP_BEGIN
# See: http://foglamp.readthedocs.io/
# FOGLAMP_END
"""FogLAMP Sensor Readings Ingest API"""
import asyncio
import datetime
import logging
import time
import uuid
from typing import List, Union
import asyncpg
import dateutil.parser
import json
from foglamp import logger
from... |
# Copyright (c) 2009-2014, Christian Haintz
# 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, this list of ... |
####
# This script demonstrates how to log in to Tableau Server Client.
#
# To run the script, you must have installed Python 3.5 or later.
####
import argparse
import getpass
import logging
import tableauserverclient as TSC
def main():
parser = argparse.ArgumentParser(description='Logs in to the server.')
... |
import Queue
from elixir import Field, Unicode, Entity
from astral.models.base import BaseEntityMixin
import logging
log = logging.getLogger(__name__)
EVENT_QUEUE = Queue.Queue()
class Event(BaseEntityMixin, Entity):
message = Field(Unicode(96))
def __init__(self, *args, **kwargs):
kwargs['messag... |
"""
Rendering weather data in the Prometheus format.
"""
EXPORTED_FIELDS = {
"FeelsLikeC":("Feels Like Temperature in Celsius", "temperature_feels_like_celsius"),
"FeelsLikeF":("Feels Like Temperature in Fahrenheit", "temperature_feels_like_fahrenheit"),
"cloudcover":("Cloud Coverage in Percent", "cloudc... |
# Copyright 2008-2011 Nokia Siemens Networks Oyj
#
# 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... |
import logging; logger = logging.getLogger("robot." + __name__)
import random
from robots.lowlevel import *
from robots.exception import RobotError
from robots.action import *
from robots.helpers import trajectory
import os
@tested("04/10/2012")
@action
@workswith(ROS)
def enabledevileye(robot):
os.system("rosru... |
import time
import requests
import webbrowser
import keyring
import getpass
import lxml.html as html
from cStringIO import StringIO
from astropy.table import Table
from astropy.io import ascii
from ..query import QueryWithLogin
from . import ROW_LIMIT
class EsoClass(QueryWithLogin):
ROW_LIMIT = ROW_LIMIT()
... |
import pickle
import unittest
from unittest import mock
import pytest
import cupy
from cupy.cuda import compiler
from cupy import testing
def cuda_version():
return cupy.cuda.runtime.runtimeGetVersion()
@unittest.skipIf(cupy.cuda.runtime.is_hip, 'CUDA specific tests')
class TestNvrtcArch(unittest.TestCase):
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.