content string |
|---|
from gi.repository import Gio, Gtk, GObject
import os.path
"""Create SPICE simulation commands"""
class AddSimulation(Gtk.Dialog):
def __init__(self, parent, device_list):
'''Init AddSimulation dialog.
Args:
parent: parent window.
device_list: list of device names... |
import os
import random
import storjlib
_log = storjlib.log.getLogger(__name__)
_builtin_open = open
def _get_shard_path(store_path, shardid, use_folder_tree,
create_needed_folders=False):
if use_folder_tree:
folders = os.path.join(*storjlib.util.chunks(shardid, 3))
store_pat... |
import logging
import requests
from cacheops.simple import cache, CacheMiss
from django.conf import settings
from django_rq import job
from packaging import version
# Get an instance of a logger
logger = logging.getLogger('netbox.releases')
@job('check_releases')
def get_releases(pre_releases=False):
url = sett... |
import logging
import sys
from pyprint.ConsolePrinter import ConsolePrinter
from dependency_management.requirements.PipRequirement import PipRequirement
from coalib.parsing.FilterHelper import (
apply_filter, apply_filters, InvalidFilterException)
from coalib.output.Logging import configure_logging
from coalib.p... |
import math
import random
import xmlreader
from PyQt4 import QtCore, QtGui, uic
from PyQt4.QtGui import QGraphicsScene, QPushButton, QBrush, QColor
from widgets import dialogs, code_editor, network_graph, menus
from widgets.QNetworkxGraph.QNetworkxGraph import QNetworkxWidget, NodeShapes
from logger import RCManagerLo... |
"""
Code to handle EC2 stand-alone instances
"""
import base64
import logging
import os
import time
import datetime
import boto3
import pywren
logger = logging.getLogger(__name__)
def b64s(string):
"""
Base-64 encode a string and return a string
"""
return base64.b64encode(string.encode('utf-8')).deco... |
from ontobio.sim.annotation_scorer import AnnotationScorer
from ontobio.sim.api.owlsim2 import OwlSim2Api
from ontobio.model.similarity import IcStatistic
from unittest.mock import patch
class TestAnnotationSufficiency():
"""
Unit tests for AnnotationScorer
Mock data based on star trek example
https:... |
import logging
from django.conf import settings
from mock import patch
from rest_framework import status
from rest_framework.test import APITestCase, APIClient as _APIClient
class APIClient(_APIClient):
def get(self, path, data=None, follow=False, **extra):
response = super(APIClient, self).get(path, dat... |
# -*- coding: utf-8 -*-
"""
Created on Wed Apr 05 17:10:19 2017
@author: Luca
"""
import sys
import serial # import Serial Library
import drawnow as drawnow
import numpy as np
import matplotlib.pyplot as plt
from scipy.interpolate import interp1d
x_eval = np.linspace(0, 1024, 1024)
def Connect(cha... |
from describe.matchers import class_matchers as matchers
__all__ = 'includes contains be_instance_of be_an_instance_of be_a_subclass_of'.split(' ') + \
'be_subclass_of be_gt be_greater_than be_gte be_ge be_greater_than_or_equal_to be_lt be_less_than'.split(' ') + \
'be_lte be_le be_less_than_or_equal_to ra... |
import unittest
from unittest.mock import ANY
from unittest.mock import patch
from geobeam import map_requests
class MapRequestsTest(unittest.TestCase):
def setUp(self):
point_one = (37.4178134, -122.086011)
point_two = (37.4179142, -122.0858751)
point_three = (37.4211366, -122.0936967)
point_four ... |
from oslo_log import log as logging
from oslo_middleware import base
from oslo_utils import strutils
import webob
import webob.exc as ex
from sahara.i18n import _
LOG = logging.getLogger(__name__)
class AuthValidator(base.Middleware):
"""Handles token auth results and tenants."""
@webob.dec.wsgify
de... |
import xml.etree.cElementTree as ET
import datetime, os, re
from itertools import imap
_DEBUG = True
_xsd_datetime = re.compile(
"^-?"
"(?P<year>[0-9]{4})"
"-"
"(?P<month>[0-9]{2})"
"-"
"(?P<day>[0-9]{2})"
"T"
"(?P<hour>[0-9]{2})"
":"
"(?P<minutes>[0-9]{2})"
":"
"(?P<se... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Feb 18 18:45:19 2021
@author: martin.widjaja
https://www.facebook.com/careers/life/sample_interview_questions
"""
def look_and_say(s,n):
res = ''
st = str(s)
i = 0
while i <= n:
print(st)
b = ''
count =... |
import sys
import sleekxmpp
from sleekxmpp.xmlstream.matcher import MatchXPath
from sleekxmpp.xmlstream.handler import Callback
from sleekxmpp.exceptions import XMPPError
from sleekxmpp.test import *
class TestStreamExceptions(SleekTest):
"""
Test handling roster updates.
"""
def tearDown(self):
... |
from ctypes import POINTER, c_char_p, c_int, c_void_p
from django.contrib.gis.gdal.libgdal import lgdal, std_call
from django.contrib.gis.gdal.prototypes.generation import (
const_string_output, double_output, int_output, srs_output, string_output,
void_output,
)
# Shortcut generation for routines w... |
"""empty message
Revision ID: 1eb1ce61f03e
Revises: 85ee332dd4db
Create Date: 2017-02-08 16:37:06.437732
"""
# revision identifiers, used by Alembic.
revision = '1eb1ce61f03e'
down_revision = '85ee332dd4db'
from alembic import op
import sqlalchemy as sa
TABLE = 'shipit_dashboard_analysis'
def upgrade():
# Ad... |
# -*- coding: utf-8 -*-
from module.plugins.internal.MultiAccount import MultiAccount
from module.plugins.internal.utils import json
class MegaDebridEu(MultiAccount):
__name__ = "MegaDebridEu"
__type__ = "account"
__version__ = "0.25"
__status__ = "testing"
__config__ = [("mh_mode" , "... |
from mock import patch
from django.core import mail
from django.core.urlresolvers import reverse
from django.test.utils import override_script_prefix
from nose.tools import eq_, ok_
from mozillians.common.tests import TestCase
from mozillians.groups.models import Group, GroupMembership
from mozillians.groups.tests im... |
from django.conf.urls.defaults import *
from django.conf import settings
# Uncomment the next two lines to enable the admin:
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('',
# Uncomment the admin/doc line below and add 'django.contrib.admindocs'
# to INSTALLED_APPS to enable a... |
from django.contrib import admin
from cms.admin import ContentManageableModelAdmin, NameSlugAdmin
from .models import Calendar, EventCategory, Event, OccurringRule, RecurringRule, Alarm, EventLocation
class EventInline(admin.StackedInline):
model = Event
extra = 0
class CalendarAdmin(ContentManageableModel... |
"""
The latest version of this package is available at:
<http://github.com/jantman/biweeklybudget>
################################################################################
Copyright 2016 Jason Antman <<EMAIL>> <http://www.jasonantman.com>
This file is part of biweeklybudget, also known as biweeklybudget.
... |
import os
from django.core.management.base import BaseCommand
from django.core.management import call_command
from app.scripts.extract_odm_strings import extract_odm_strings
from app.scripts.extract_plugin_manifest_strings import extract_plugin_manifest_strings
from app.scripts.extract_potree_strings import extract_po... |
__revision__ = "$Id$"
from Crypto.Util.py3compat import *
# This is a list of (expected_result, input[, description]) tuples.
test_data = [
# Test vectors downloaded 2008-09-12 from
# http://homes.esat.kuleuven.be/~bosselae/ripemd160.html
('9c1185a5c5e9fc54612808977ee8f548b2258d31', '', "'' (empty strin... |
import os
from app_yaml_helper import AppYamlHelper
def GetAppVersion():
if 'CURRENT_VERSION_ID' in os.environ:
# The version ID looks like 2-0-25.36712548, we only want the 2-0-25.
return os.environ['CURRENT_VERSION_ID'].split('.', 1)[0]
# Not running on appengine, get it from the app.yaml file ourselves... |
import json
import time
import urllib.request
import urllib.error
from collections import deque
from . import utils
CFDOCS_BASE_URL = "https://raw.githubusercontent.com/foundeo/cfdocs/master/data/en/"
CFDOCS_HTTP_ERROR_MESSAGE = """
<p>HTTP requests to GitHub seem to be failing at the moment. This means that
cfdocs.or... |
"""This module contains Splittable DoFn logic that's common to all runners."""
import uuid
import apache_beam as beam
from apache_beam import pvalue
from apache_beam.coders import typecoders
from apache_beam.pipeline import AppliedPTransform
from apache_beam.pipeline import PTransformOverride
from apache_beam.runners... |
""" run with
python setup.py install; pip install . ; nosetests -v --nocapture tests/test_docker.py
python setup.py install; pip install . ; nosetests -v --nocapture tests/test_docker.py:Test_docker.test_001
"""
from cloudmesh.common.Shell import Shell
from cloudmesh.common.util import HEADING
import os
def run(co... |
import functools
import persistent
import time
import logging
from uuid import uuid4
from BTrees.OOBTree import OOBTree
from grokcore.component import Subscription, querySubscriptions, baseclass
from zope import schema
from zope.annotation.interfaces import IAttributeAnnotatable
from zope.interface import alsoProvides... |
import random
import string
import sys
from email.utils import formatdate as maildate
from mailbox import Mailbox, Maildir, Message, mbox
from textwrap import dedent, indent
from uuid import uuid4
import arrow
import click
import pytest
from boltons.iterutils import flatten, same
from boltons.tbutils import ExceptionI... |
import os
import pandas as pd
import mclib.vcf2 as mcvcf
mclab = os.getenv('MCLAB')
sandbox = '/home/jfear/sandbox/cegs_ase_paper/ase_lvl2_filtered_vcf_files'
## File Names ##
design = os.path.join(mclab, 'cegs_ase_paper/design_files/CEGS_list_68_lines.txt')
output = os.path.join(mclab, 'cegs_ase_paper/pipeline_outpu... |
# -*- coding: utf-8 -*-
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding field 'ActionCluster.needs_partner'
db.add_column(u'actioncluste... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import provider.utils
from django.conf import settings
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
operations = [
... |
# -*- coding: utf-8 -*-
import os # noqa: F401
import shutil
import time
import unittest
from configparser import ConfigParser
from os import environ
import requests
from biokbase.workspace.client import Workspace as workspaceService
from mock import patch
from installed_clients.AssemblyUtilClient import AssemblyUti... |
"""Tokenization classes."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import collections
import re
import unicodedata
from absl import flags
import six
import tensorflow.compat.v1 as tf
FLAGS = flags.FLAGS
flags.DEFINE_bool(
"preserve_unused_to... |
from requests_oauthlib import OAuth1Session
API_PATH = 'api/1.0'
CONTENT_TYPE_HEADER = 'Content-Type'
CONTENT_TYPE_MAP = {
'txt': 'text/plain',
'html': 'text/html',
'md': 'text/x-web-markdown',
}
def parse_url(url):
if '//' not in url:
url = '//' + url
try:
i... |
import os.path
from PyQt5.QtGui import QOpenGLContext
from UM.Application import Application
from UM.Logger import Logger
from UM.Math.Color import Color
from UM.PluginRegistry import PluginRegistry
from UM.Platform import Platform
from UM.Event import Event
from UM.Scene.Iterator.BreadthFirstIterator import BreadthFi... |
from vectors import Line, Point, Plane, get_direction
from locations import dist_between, Location
from gps import *
import numpy as np
from time import sleep
from datetime import datetime
class Behaviour():
"""
Class which holds the possible behaviours to be used.
"""
def __init__(self,perimiter_lines... |
import ctypes
import os
_libc = None
def get_libc():
global _libc
if _libc is None:
for sover in ('6', '5'):
try:
_libc = ctypes.CDLL('libc.so.' + sover, use_errno=True)
break
except:
pass
else:
raise OSError(... |
from string import Template
try:
import xml.etree.ElementTree as etree
except ImportError:
sys.stderr.write('ERROR: Pylot was unable to find the XML parser. Make sure you have Python 2.5+ installed.\n')
sys.exit(1)
from engine import Request
def load_xml_string_cases(tc_xml_blob):
# parse xml and lo... |
import sys
import os
import json
import fnmatch
import re
from rdflib import Graph
import rdfextras
COLLECTION_QUERY = """SELECT DISTINCT ?coll
WHERE {
?item <http://purl.org/dc/terms/isPartOf> ?coll .
}"""
ITEM_QUERY = """SELECT DISTINCT ?item ?identifier
... |
# -*- coding: utf-8 -*-
# __
# /__) _ _ _ _ _/ _
# / ( (- (/ (/ (- _) / _)
# /
"""
Requests HTTP Library
~~~~~~~~~~~~~~~~~~~~~
Requests is an HTTP library, written in Python, for human beings. Basic GET
usage:
>>> import requests
>>> r = requests.get('https://www.python.org')
>>> ... |
#!tailor
'''
[DEFAULT]
verbose = False
target-module = None
projects = project2
[project1]
root-directory = /tmp/tailor-tests
source = svn:project1repo
target = darcs:
refill-changelogs = Yes
state-file = project1.state
before-commit = (maybe_skip, refill, p1_remap_authors)
after-commit = checkpoint
[svn:project1repo... |
#!/usr/bin/env python
# to run the script with the correct version of uvcdat:
# source /usr/local/uvcdat/1.2.0/bin/setup_cdat.sh
# series 1 (yyyy, mm): original data
# series 2 (mm): data to select
# select data in series 2, for the month when max was observed in series 1
import cdms2
from cdms2 import MV
import nu... |
"""SQLAlchemy storage backend."""
from __future__ import absolute_import
import datetime
import os
from oslo_config import cfg
from oslo_db import exception as dbexc
from oslo_db.sqlalchemy import session as db_session
from oslo_log import log
from oslo_utils import timeutils
import sqlalchemy as sa
from ceilometer.... |
from xml.dom import minidom
class XMLBuilder(minidom.Document):
"""
This class intends to wrap around the Document class which is inside the minidom library,
and provides some utility functions to build up XML document easily.
"""
def __init__(self, tag = "request"):
minidom.Document.__init... |
"""
Copyright (C) 2010 - 2013 TopCoder Inc., All Rights Reserved.
This file contains claim file.
ClaimFile provides the access to the file
@version 1.0 (Healthcare Fraud Prevention - Partner Database Appliance - Assembly)
@author: zeadom, TCSASSEMBLER
@since 2013-12-10
"""
import os, sys
import abc
import csv
sys.pa... |
from plugin_api import register_plugin
class SproxelFile(object):
# Description of file type
description = "Sproxel Files"
# File type filter
filetype = "*.csv"
def __init__(self, api):
self.api = api
# Register our exporter
self.api.register_file_handler(self)
# Ca... |
"""n-body simulator to derive TDV+TTV diagrams of planet-moon configurations.
Credit for part of the source is given to
https://github.com/akuchling/50-examples/blob/master/gravity.rst
Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License
"""
import numpy
import math
import matplotlib.pylab as plt... |
"""
The main command line interface to all SMAC development and deployment
utilities.
@author: Jonathan Stoppani <<EMAIL>>
"""
COMMANDS_PKG = 'smac.core.management.commands'
import smac.core.management.commands
from smac.core.management import BaseOptions
from twisted.python import usage, reflect
import os.path
im... |
"""
Minimal example showing the use of the FoldingPanel.
"""
import logging
logging.basicConfig(level=logging.DEBUG)
import sys
from pyqode.qt import QtWidgets
from pyqode.core.api import CodeEdit, IndentFoldDetector
from pyqode.core.backend import server
from pyqode.core.modes import PygmentsSH
from pyqode.core.pane... |
import unittest
from ddt import ddt, data, unpack
import py2pack
@ddt
class Py2packTestCase(unittest.TestCase):
def setUp(self):
class Args:
name = "py2pack"
version = "0.4.4"
self.args = Args()
def test_list(self):
py2pack.list(self.args)
def test_searc... |
# -*- coding: utf-8 -*-
"""This code is a part of Yoda Extension
.. module:: hydratk.extensions.yoda.translation.cs
:platform: Unix
:synopsis: Czech language translation for Yoda extension
.. moduleauthor:: Petr Czaderna <<EMAIL>>
"""
language = {
'name': 'Čeština',
'ISO-639-1': 'cs'
}
msg = {
'... |
"""
WSGI config for inventory-db project.
This module contains the WSGI application used by Django's development server
and any production WSGI deployments. It should expose a module-level variable
named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover
this application via the ``WSGI_APPLICATI... |
import datetime
from ..core import db
import json
from bson import ObjectId
class VersionModel(db.Document):
created_at = db.StringField(default=str(datetime.datetime.utcnow()))
possible_system = ["git", "mercurial", "subversion", "cvs", "bazaar", "arch", "monotone", "aegis", "fastcst", "opencm", "ve... |
# -*- coding: utf-8-*-
import os
import re
import subprocess
import tempfile
import logging
import yaml
import diagnose
import jarvispath
class PhonetisaurusG2P(object):
PATTERN = re.compile(r'^(?P<word>.+)\t(?P<precision>\d+\.\d+)\t<s> ' +
r'(?P<pronounciation>.*) </s>', re.MULTILINE)
... |
"""
Copyright Nathan Hughes 2015
This file is part of code developed for the Music Perception and Robotics
Laboratory at Worcester Polytechnic Institute.
This file is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the ... |
"""sample URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.8/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Class-base... |
import pygame, math, sys
from pygame.locals import *
from character import *
from loadmap import *
FRAMES_PER_SECOND = 30
BLACK = (0,0,0)
TILESIZE = 32
class Game(object):
def __init__(self):
self.screen = pygame.display.set_mode((640, 480))
pygame.display.set_caption("BattleSim")
self.cl... |
#!/usr/bin/env python
import os
import json
import segmenter
import jams
def get_all_levels(X, kmin, kmax):
'''Return a list of segment boundaries/prunings for all values of k between kmin
and kmax.
Also returns a list of labels.
'''
levels = []
labels = []
for k in range(kmin, kmax):... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""
Author: AsherYang
Email : <EMAIL>
Date : 2018/6/26
Desc : 获取厂商信息,返回网络数据
"""
from util.GenerateIDUtil import GenerateIDUtil
from util.LogUtil import LogUtil
from db.BrandDao import BrandDao
from db.DbBrand import DbBrand
from net.NetBrand import NetBrand
class GetBrand:... |
import sys, time, datetime, re, threading
from electrum_exe.i18n import _, set_language
from electrum_exe.util import print_error, print_msg
import os.path, json, ast, traceback
import shutil
import StringIO
try:
import PyQt4
except Exception:
sys.exit("Error: Could not import PyQt4 on Linux systems, you may ... |
"""
Utilities module for generic PySAL functionality, mainly centered on
translating queries into numpy arrays or PySAL weights objects
"""
import numpy as np
import pysal as ps
def construct_neighbor_query(w_type, query_vals):
"""Return query (a string) used for finding neighbors
@param w_type... |
import unittest
from test import test_support
import cStringIO
import sys
import os
import tokenize
import ast
import unparse
def read_pyfile(filename):
"""Read and return the contents of a Python source file (as a
string), taking into account the file encoding."""
with open(filename, "r") as p... |
import minimalmodbus
from time import sleep
import time
class WatlowF4(minimalmodbus.Instrument):
"""Instrument class for Watlow F4 temperature controller.
Comms via Modbus RTU (RS232)
Args:
* portname(str): name of port
* slaveaddress(int): slave address in range of 1 to 247
"""
... |
""" Helper methods for CourseModes. """
import logging
from django.utils.translation import ugettext_lazy as _
from requests.exceptions import ConnectionError, Timeout # pylint: disable=redefined-builtin
from slumber.exceptions import SlumberBaseException
from common.djangoapps.course_modes.models import CourseMod... |
from django.db import models
from django.utils.translation import ugettext_lazy as _
class Proform(models.Model):
CASH = 'cash'
CREDIT_CARD = 'credit_card'
NEGOTIABLE = 'negotiable'
TRANSFER = 'transfer'
PAYMENT_CONDITIONS = (
(CASH, _('Cash')),
(CREDIT_CARD, _('Credit card')),
... |
try:
from django.conf.urls import patterns, include
except ImportError: # Django < 1.4
from django.conf.urls.defaults import patterns, include
from django.contrib.auth.models import User
from tastypie import fields
from tastypie.resources import ModelResource
from core.models import Note, Subject
from core.tes... |
import os
from scipy.io import loadmat,savemat,mmread
import numpy as np
import matplotlib.pyplot as plt
from scipy.stats import mode
from matplotlib.colors import LinearSegmentedColormap,LogNorm
from voxnet.plotting import *
from voxnet.utilities import h5read
from skimage.measure import find_contours
###############... |
from core.admin import ReadOnlyAwareAdmin, SliceInline
from core.middleware import get_request
from core.models import User
from django import forms
from django.contrib import admin
from services.mcordservice.models import MCORDService, MCORDServiceComponent, MCORD_KIND
# The class to provide an admin interface on the... |
# -*- coding: utf-8 -*-
from atom.views import DeleteMessageMixin
from django.contrib.auth.mixins import LoginRequiredMixin
from django.urls import reverse_lazy
from django.utils.timezone import now
from django.utils.translation import ugettext_lazy as _
from django.views.generic.edit import CreateView, DeleteView
from... |
import urllib,re,sys,os
import xbmc, xbmcgui, xbmcaddon, xbmcplugin
from resources.libs import main
#Mash Up - by Mash2k3 2012.
addon_id = 'plugin.video.movie25'
selfAddon = xbmcaddon.Addon(id=addon_id)
art = main.art
pattern = '(?sim)<a [^>]*?href="([^"]+?)" rel="bookmark"[^>]*?>\s*?<img src="([^"]+?)"[^>]*?title="(... |
#!/bin/sh
# -*- python -*-
################################################################################
# This file is python 2/3 bilingual.
# The line """:" starts a comment in python and is a no-op in shell.
""":"
# Shell code to find and run a suitable python interpreter.
for cmd in python3 python python2; do
... |
"""
MSSP - Mud Server Status Protocol
This implements the MSSP telnet protocol as per
http://tintin.sourceforge.net/mssp/. MSSP allows web portals and
listings to have their crawlers find the mud and automatically
extract relevant information about it, such as genre, how many
active players and so on.
"""
from bui... |
"""A Django template tag library containing list helpers.
"""
__authors__ = [
'"Sverre Rabbelier" <<EMAIL>>',
]
from django import template
register = template.Library()
@register.inclusion_tag('soc/templatetags/_as_lists.html')
def as_lists(lists_data):
"""Prints multiple lists as html.
"""
return {
... |
from odoo import fields, models
class ProductCatalogReport(models.Model):
_inherit = 'product.product_catalog_report'
category_type = fields.Selection(
selection_add=[('public_category', 'Public Category')],
)
public_category_ids = fields.Many2many(
'product.public.category',
... |
from . import segment_map
from .grid_types import BlockType, GridLoc, GridInfo, BitAlias, Bits, BitsInfo, ClockRegion
from .tile_segbits_alias import TileSegbitsAlias
import re
CLOCK_REGION_RE = re.compile('X([0-9])Y([0-9])')
class Grid(object):
""" Object that represents grid for a given database.
Provides m... |
"""Module with utilities related to async operations"""
from threading import (
Lock,
_allocate_lock,
_Condition,
_sleep,
_time,
)
from Queue import (
Empty,
)
from collections import deque
import sys
import os
#{ Routines
def cpu_count():
""":return:number of CPUs in the system
:note: inspired by mu... |
from allauth.account.models import EmailAddress
from allauth.socialaccount import providers
from allauth.socialaccount.providers.github.provider import GitHubProvider
from feedthefox.users.models import User
class FeedTheFoxGitHubProvider(GitHubProvider):
"""Custom GitHub provider that handles a list of emails
... |
#!/usr/bin/env python3
import configparser, subprocess, platform
import gi
gi.require_version('Gtk', '3.0')
from gi.repository import Gtk, GLib, Gdk
class SleepTimer(Gtk.Builder):
def __init__(self):
super().__init__()
self.add_from_file("main.glade")
self.connect_signals(self)
sel... |
"""
Frontend script using Chrome Visited Links parsing library
"""
import argparse
import textwrap
import chromagnon.columnOutput
import chromagnon.visitedLinks
def main():
parser = argparse.ArgumentParser(
formatter_class=argparse.RawDescriptionHelpFormatter,
description=textwrap.deden... |
"""The code in this module is mostly copy/pasted out of the distutils2 source
code, as recommended by Tarek Ziade. As such, it may be subject to some change
as distutils2 development continues, and will have to be kept up to date.
I didn't want to use it directly from distutils2 itself, since I do not want it
to be a... |
from trueSkill.FactorGraphs.Factor import *
from trueSkill.Numerics.GaussianDistribution import *
class GaussianFactor(Factor) :
def __init__(self, name):
super(GaussianFactor, self).__init__(name)
def sendMessageVariable(self, message, variable) :
''' Sends the factor-graph mess... |
from apps.hav_collections.models import Collection
from apps.tags.models import Tag, TagSource, search_tags
from apps.tags.sources import TagSourceResult
from rest_framework.test import APITestCase
from ..serializers import TagSerializer, SimpleTagSerializer
class TagSerializerTests(APITestCase):
def setUp(self):... |
from reportlab.platypus import SimpleDocTemplate, Paragraph, Spacer, Table, TableStyle, Image
from reportlab.rl_config import defaultPageSize
from reportlab.lib import colors, enums
from reportlab.lib.units import cm
from reportlab.lib.styles import ParagraphStyle, getSampleStyleSheet
import sys, os, Image
try:
i... |
import unittest
try:
import function_pybind11 as py11
has_pybind11 = True
except:
has_pybind11 = False
import function_boost_python as boost
class TestFunction(unittest.TestCase):
def test_function_py11(self):
if not has_pybind11:
return
self.assertEqual(py11.add(), 3)
... |
import tempfile
import json
import os
import fabric.api
from cloudify import ctx
from openstack_plugin_common import (
OPENSTACK_ID_PROPERTY,
OPENSTACK_NAME_PROPERTY,
OPENSTACK_TYPE_PROPERTY,
USE_EXTERNAL_RESOURCE_PROPERTY,
Config
)
from openstack_plugin_common.floatingip import IP_ADDRESS_PROPERT... |
from hashlib import md5
from time import time
from django.core.cache import cache
from django.utils.cache import _i18n_cache_key_suffix
from mezzanine.conf import settings
from mezzanine.utils.device import device_from_request
from mezzanine.utils.sites import current_site_id
def _hashed_key(key):
"""
Hash ... |
#!/usr/bin/env python
"""
Copyright (c) 2020 Alex Forencich
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merg... |
from textwrap import dedent
from docxUtils.tables import TableMaker
from .genotoxTables import GenotoxTables
class GenotoxHtmlTables(GenotoxTables):
def create_content(self):
self.setLandscape()
self.buildHeader()
self.buildTable()
def get_template_fn(self):
return "base.doc... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import io
import os
import pprint
import re
import shutil
import subprocess
import sys
import warnings
from setuptools import setup
try:
import cython
except ImportError:
_HAVE_CYTHON = False
else:
_HAVE_CYTHON = True
assert cython # silence pep8
pkg_nam... |
# -*- coding: utf-8 -*-
# (C) 2015 Muthiah Annamalai
from opentamiltests import *
from solthiruthi.data_parser import *
from solthiruthi.datastore import TamilTrie, DTrie, Queue
from solthiruthi.Ezhimai import *
from solthiruthi.resources import DICTIONARY_DATA_FILES
from solthiruthi.scoring import bigram_scores, unig... |
from __future__ import unicode_literals
import frappe
from frappe import _, scrub
from frappe.utils import flt
from frappe.model.document import Document
import json
from erpnext.accounts.utils import get_account_currency
from erpnext.accounts.doctype.journal_entry.journal_entry import get_exchange_rate
class PaymentT... |
import unittest
import mock
from ggrc.converters import query_helper
class TestQueryHelper(unittest.TestCase):
def test_expression_keys(self):
""" test expression keys function
Make sure it works with:
empty query
simple query
complex query
invalid complex query
"""
query ... |
#!/usr/bin/python3
import json
import sys
import os
arch = sys.argv[2]
expected = {
'/usr/bin/will_segfault' : [
'crash',
'varargs',
'f',
'callback',
'call_me_back',
'recursive',
'recursive',
'recursive',
'main'
]
}
if arch in ['ppc64','ppc64le']:
expected['/usr/bin/will_... |
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'State'
db.create_table('hwdoc_state', (
('id', self.gf('django.db.models.fields.... |
#!/usr/bin/python3
import threading
import argparser
import config_file_reader
from mcp import doCommunicate
class ConstableThread(threading.Thread):
def __init__(self, fnc, *args, **kwargs):
threading.Thread.__init__(self, daemon=False)
#super().__init__(daemon=False)
self.fnc = fnc
... |
# -*- coding: utf-8 -*-
import re
import time
from module.plugins.internal.MultiAccount import MultiAccount
class DebridItaliaCom(MultiAccount):
__name__ = "DebridItaliaCom"
__type__ = "account"
__version__ = "0.18"
__status__ = "testing"
__config__ = [("mh_mode" , "all;listed;unliste... |
"""
Utility functions
"""
import logging
logger = logging.getLogger(__name__)
from sys import hexversion
from datetime import datetime
def parse_null_str(data):
return data[0:data.find('\0')]
def parse_date(data):
return datetime(*[bytes_to_int(data[n:n + 2]) for n in range(0, 12, 2)])
# For compatibil... |
from numpy import dot
from numpy.random import normal
from numpy.linalg import solve
from scipy.linalg import cholesky, cho_solve
from scipy.sparse import issparse
import numpy as np
__all__ = ['quad_potential', 'ElemWiseQuadPotential', 'QuadPotential',
'QuadPotential_Inv', 'isquadpotential']
def quad_po... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.