content string |
|---|
"""
This module provides facilities for encoding values into Cypher
identifiers and literals.
"""
from __future__ import absolute_import
from collections import OrderedDict
from re import compile as re_compile
from unicodedata import category
from py2neo.collections import SetView
from py2neo.compat import uchr, ust... |
import functools
import itertools
from pathlib import Path
from .. import Checker, find_all
__all__ = ('FileChecker', 'get_checkers')
class FileChecker(Checker):
"""Groups checks for packages' contents.
Also adds utilities for file systems to the Checker class.
"""
def __init__(self, base_path):
... |
from __future__ import absolute_import
import ddt
import six
from django.core.management import call_command
from django.core.management.base import CommandError
from mock import patch
from oscar.core.loading import get_model
from ecommerce.extensions.test.factories import create_order
from ecommerce.tests.factories ... |
#!/usr/bin/env python
"""\
SVG.py - Construct/display SVG scenes.
The following code is a lightweight wrapper around SVG files. The metaphor
is to construct a scene, add objects to it, and then write it to a file
to display it.
This program uses ImageMagick to display the SVG files. ImageMagick also
does a remarkable... |
"""
Authentication example using Flask-Login
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This provides a simple example of using Flask-Login as the authentication
framework which can guard access to certain API endpoints.
This requires the following Python libraries to be installed:
* Flask
... |
from flask_wtf import Form
from wtforms import SubmitField, BooleanField, StringField, IntegerField, SelectField, TextAreaField
from wtforms.validators import DataRequired, Length, Regexp, NumberRange
from school.config import Config
from school.models import CourseType
class EditCourseForm(Form):
pass
class Ad... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
API functions that can be used by external software
"""
import os
import traceback
from collections import OrderedDict
from copy import deepcopy
from pathlib import Path
from rebulk.introspector import introspect
from .__version__ import __version__
from .options imp... |
from django.db import models
from django.conf import settings
from django.utils.translation import ugettext_lazy as _
import logging
from django.utils.text import Truncator
class LdapObject(models.Model):
"""Data information for a synchronized ldap object"""
user = models.OneToOneField(settings.AUTH_USER_MO... |
from __future__ import division
'''BaseTickServer
A server that should be overridden to provide a server with its own internal loop.
'''
import time
from settings import CLIENT_UPDATE_FREQ, CLIENT_NETWORK_FPS
class BaseTickServer(object):
'''This is a class that should be subclassed and tick() defined to do som... |
import json
from datetime import date, datetime
from decimal import Decimal
from django.conf import settings
from django.core.exceptions import ObjectDoesNotExist
from django.utils import datetime_safe, timezone
from django.utils.dateparse import parse_duration
from django.utils.encoding import force_str, smart_str
... |
from urllib.parse import parse_qs
import aiohttp
import discord
from discord.ext import commands
from lxml import etree
class Google(commands.Cog):
def __init__(self, bot):
self.bot = bot
def parse_google_card(self, node):
if node is None:
return None
e = discord.Embed(c... |
from .epub import make_epub
from .cover import make_cover
from .cover import make_cover_from_url
import html
import unicodedata
import datetime
import requests
import attr
html_template = '''<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:epub="http://www.idpf.o... |
import unittest
from mock import MagicMock
from pythonbacktest.broker import BackTestBroker
from pythonbacktest.datafeed import PriceBar
from pythonbacktest.strategy import StrategyStateMachine
class StrategyStateMachineTests(unittest.TestCase):
def test_properties_set_on_new_pricebar(self):
state_mach... |
from flask import render_template,request
from app import app
import accessdata
REQUIRED = ('requestType', 'studyUID', 'seriesUID', 'objectUID')
OPTIONAL = ('contentType', 'charset', 'anonymize', 'annotation',
'rows', 'columns', 'region',
'windowWidth', 'windowCenter', 'frameNumber', 'imageQual... |
SECTIONS = ["inputs", "inspectors", "transformers", "outputs", "pipes"]
# components
INPUTS = {'dummy source': {'description': 'a dummy source', 'use': 'tests.components.Input'}}
INSPECTORS = {'dummy validator': {'description': 'a dummy validator', 'use': 'tests.components.Validator'}}
TRANSFORMERS = {
'dummy ma... |
import logging
import zlib
from abc import ABC
from functools import partial, update_wrapper, wraps
from typing import Iterable
import dill
from FruityBot.localize import tl
logger = logging.getLogger(__name__)
def command(func=None, *, cmd_help=None, aliases=tuple(), include_funcname=True):
def decorator(f):
... |
from pathlib import PureWindowsPath, PurePosixPath
def _match_path(path, included_patterns, excluded_patterns, case_sensitive):
"""Internal function same as :func:`match_path` but does not check arguments."""
if case_sensitive:
path = PurePosixPath(path)
else:
included_patterns = {pattern.... |
import contextlib
import tempfile
import os
import shutil
import io
import pytest
import PIL
import numpy
import codecad
class FileBaselineCompare:
""" Context manager for comparing a file output of a tested function with
known baseline. Handles lookup of baseline file. If a baseline file is not found,
... |
from .colorconv import (convert_colorspace,
guess_spatial_dimensions,
rgb2hsv,
hsv2rgb,
rgb2xyz,
xyz2rgb,
rgb2rgbcie,
rgbcie2rgb,
... |
from logging import getLogger
from .merge import create_output_table
from .merge import merge_dicts
from .merge import output_row
from .target import select_groups_by_target
log = getLogger(__name__)
def build_rating_table(output_db, scratch_db):
log.info(' building rating table')
create_output_table(outp... |
# qlearningAgents.py
# ------------------
# Licensing Information: You are free to use or extend these projects for
# educational purposes provided that (1) you do not distribute or publish
# solutions, (2) you retain this notice, and (3) you provide clear
# attribution to UC Berkeley, including a link to http://ai.be... |
'''
Created on Feb 1, 2013
@author: fahrstuhl
'''
import os.path
import datetime
import page
import config
import diarium
def nameFromFilename(fileName):
fileNameSplit = os.path.splitext(fileName)
if(fileNameSplit[1] == config.fileExtension):
return fileNameSplit[0]
return None
def makeNameLi... |
__author__ = 'franciscui'
#coding=utf-8
import MySQLdb
from config import *
class Dbconnecter:
__host = ""
__port = ""
__dbuser = ""
__dbpasswd = ""
__dbname = ""
__charset = ""
__use_unicode= None
def __init__(self, host=DBHOST, port=DBPORT, user=DBUSER, passwd=DBPASSWD, dbname=DBNAM... |
# -*- coding: utf-8 -*-
from datetime import datetime
from base import MockVim, MockCache
import sys
from taskwiki.constants import DEFAULT_SORT_ORDER, DEFAULT_VIEWPORT_VIRTUAL_TAGS
class TestParsingVimwikiTask(object):
def setup(self):
self.mockvim = MockVim()
self.cache = MockCache()
#... |
import csv
from collections import OrderedDict
labdict=dict()
imdict=dict()
countdict=dict()
i=0
with open("./classes.txt") as csvfile:
reader=csv.reader(csvfile,delimiter=',',quotechar='"')
for row in reader:
print row
if len(row) > 0:
#print row
label=row[1]
... |
import _plotly_utils.basevalidators
class ColorbarValidator(_plotly_utils.basevalidators.CompoundValidator):
def __init__(self, plotly_name="colorbar", parent_name="bar.marker", **kwargs):
super(ColorbarValidator, self).__init__(
plotly_name=plotly_name,
parent_name=parent_name,
... |
"""This script is used to synthesize generated parts of this library."""
import synthtool as s
import synthtool.gcp as gcp
import synthtool.languages.java as java
gapic = gcp.GAPICGenerator()
service = 'video-intelligence'
versions = ['v1', 'v1beta1', 'v1beta2', 'v1p1beta1', 'v1p2beta1', 'v1p3beta1']
config_pattern ... |
# uncompyle6 version 2.9.10
# Python bytecode 2.7 (62211)
# Decompiled from: Python 3.6.0b2 (default, Oct 11 2016, 05:27:10)
# [GCC 6.2.0 20161005]
# Embedded file name: utf_8_sig.py
""" Python 'utf-8-sig' Codec
This work similar to UTF-8 with the following changes:
* On encoding/writing a UTF-8 encoded BOM will be p... |
from copy import deepcopy
from django.contrib import admin
from django.conf import settings
from django.utils.translation import ugettext_lazy as _
from .nonce.models import Nonce
if settings.DEBUG:
class NonceModelAdmin(admin.ModelAdmin):
list_display = ("value", "context", "not_on_or_after")
admin.... |
"""
File: email.py
Author: Levi Bostian (<EMAIL>)
Description: TESTING ONLY for sending emails via Python
References: http://www.tutorialspoint.com/python/python_sending_email.htm
http://segfault.in/2010/12/sending-gmail-from-python/ <--- use this one
"""
"""line below is for Linux only. Change for Win... |
# -*- coding: utf-8 -*-
from openerp.osv import fields, osv
from openerp.tools.safe_eval import safe_eval as eval
from openerp.tools.translate import _
class crm_team(osv.Model):
_inherit = 'crm.team'
_inherits = {'mail.alias': 'alias_id'}
def _get_default_stage_ids(self, cr, uid, context=None):
... |
#!/usr/bin/env python
"""
Retrieve status of DIRAC jobs
"""
__RCSID__ = "$Id$"
import os
import json
import DIRAC
from DIRAC import S_OK, S_ERROR
from DIRAC import exit as DIRACExit
from DIRAC.Core.Base import Script
from DIRAC.Core.Utilities.Time import toString, date, day
from DIRAC.Core.DISET.RPCClient import ... |
import os
from katello.tests.core.action_test_utils import CLIOptionTestCase
from katello.tests.core.environment.environment_base_test import EnvironmentBaseTest
from katello.client.core.environment import Create
import katello.client.core.environment
class RequiredCLIOptionsTests(CLIOptionTestCase):
#required:... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""Tests for the OLE Compound File (OLECF) event formatters."""
from __future__ import unicode_literals
import unittest
from plaso.formatters import olecf
from tests.formatters import test_lib
class OLECFSummaryInfoFormatter(test_lib.EventFormatterTestCase):
"""Tes... |
"""
Tools for running functions on the terminal above the current application or prompt.
"""
from asyncio import Future, ensure_future
from typing import AsyncGenerator, Awaitable, Callable, TypeVar
from prompt_toolkit.eventloop import run_in_executor_with_context
from .current import get_app_or_none
try:
from c... |
# -*- coding: utf-8 -*-
from __future__ import with_statement
from cms.utils import get_language_from_request
from cms.utils.i18n import force_language, hide_untranslated
from django.conf import settings
from django.core.urlresolvers import NoReverseMatch, reverse, resolve
import warnings
from cms.models.titlemodels i... |
""" Data needed to process a sample """
import logging
import os
import typing
from csv import DictReader
from pathlib import Path
from micall.core.aln2counts import aln2counts
from micall.core.amplicon_finder import write_merge_lengths_plot, merge_for_entropy
from micall.core.cascade_report import CascadeReport
from... |
from logging import getLogger
from django.http import HttpRequest
from pagseguro.api import PagSeguroApi, PagSeguroItem # sudo -H pip3 install django-pagseguro2
from pagseguro.settings import TRANSACTION_STATUS
from .base import PaymentBase
from ..models import SubsState, Transaction
from ..notify import Notifier
fr... |
#-*- coding: utf-8 -*-
"""
Copyright (C) 2011, 2012, 2013 Michal Goral.
This file is part of Subconvert
Subconvert 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 op... |
"""
Django supports parsing the content of an HTTP request, but only for form POST requests.
That behavior is sufficient for dealing with standard HTML forms, but it doesn't map well
to general HTTP requests.
We need a method to be able to:
1.) Determine the parsed content on a request for methods other than POST (eg... |
# continuousPitchInstrumentAudio.py
#
# Demonstrates how to use sliders and labels to create an instrument
# for changing volume and frequency of an audio loop in real time.
#
from gui import *
from music import *
# load audio sample
a = AudioSample("moondog.Bird_sLament.wav")
# create display
d = Display("Contin... |
""" Contains an implementation of Atom-pair fingerprints, as
described in:
R.E. Carhart, D.H. Smith, R. Venkataraghavan;
"Atom Pairs as Molecular Features in Structure-Activity Studies:
Definition and Applications" JCICS 25, 64-73 (1985).
"""
from rdkit.DataStructs import IntSparseIntVect
from rdkit import Chem
from ... |
""" Scaffolding for unit test modules.
"""
from __future__ import (absolute_import, unicode_literals)
import unittest
import doctest
import logging
import os
import sys
import operator
import textwrap
from copy import deepcopy
import functools
try:
# Python 2 has both ‘str’ (bytes) and ‘unicode’ (text).
... |
"""
InaSAFE Disaster risk assessment tool developed by AusAid - **Abstract List**
Contact : <EMAIL>
.. note:: This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the Licens... |
from __future__ import absolute_import
import platform
import unittest
from telemetry.internal.platform.tracing_agent import chrome_tracing_agent
from telemetry.internal.platform.tracing_agent import (
chrome_tracing_devtools_manager)
from telemetry.timeline import tracing_config
import mock
_CHROME_TRACING_AGENT... |
# http://scikit-learn.org/stable/auto_examples/applications/topics_extraction_with_nmf_lda.html
from __future__ import print_function
import collections
from time import time
import numpy
import os
import pickle
from sklearn.feature_extraction.text import TfidfVectorizer, CountVectorizer
from sklearn.decomposition im... |
import unittest
from fraction import Fraction
class Fractiontest(unittest.TestCase):
"""unittest for Fraction class."""
def test_init(self):
a = Fraction(2, 4)
b = Fraction(1, 3)
self.assertEqual(a.up, 2)
self.assertEqual(a.down, 4)
self.assertEqual(b.up, 1)
... |
#!/usr/bin/env python
"""Support for repacking a CAB file."""
# This code is based on the following specification [MS-CAB]:
#
# http://download.microsoft.com/download/4/d/a/4da14f27-b4ef-4170-a6e6-5b1ef85b1baa/[ms-cab].pdf
import os
import shutil
import struct
from typing import BinaryIO, Optional, List
import zlib
... |
# -*- coding: utf-8 -*-
# get information from png filename
# this code is thought to be used with dicom2png.py and other repositories (dcm_rename.py?).
import os, time
print('\ncode started...\n')
save_file = "png-name_list.csv"
f = open(save_file, 'w')
start = time.time()
total = 0
target_dir = '.'
for root, dirs,... |
# -*- coding: utf-8 -*-
"""Parser for Trend Micro Antivirus logs.
Trend Micro uses two log files to track the scans (both manual/scheduled and
real-time) and the web reputation (network scan/filtering).
Currently only the first log is supported.
"""
from __future__ import unicode_literals
from dfdatetime import def... |
import FreeCAD,FreeCADGui,Draft,ArchCommands,ArchFloor
from PyQt4 import QtCore
from DraftTools import translate
__title__="FreeCAD Building"
__author__ = "Yorik van Havre"
__url__ = "http://free-cad.sourceforge.net"
def makeBuilding(objectslist=None,join=False,name=str(translate("Arch","Building"))):
'''makeBuil... |
import os
import shutil
import uuid
import tarfile
import filecmp
from cosmo_tester.framework.testenv import TestCase
class DownloadBlueprintTest(TestCase):
"""
CFY-196: Tests downloading of a previously uploaded blueprint.
CFY-995: Added a large (50MB) file to the blueprint
"""
def setUp(self):... |
import os
from miro import app
from miro import downloader
from miro import eventloop
from miro import models
from miro import prefs
from miro.test.framework import EventLoopTest, uses_httpclient
class DownloaderTest(EventLoopTest):
"""Test feeds that download things.
"""
def setup_state(self):
se... |
import configparser
import os
from tempest.lib.cli import base
class ClientTestBase(base.ClientTestBase):
def murano(self, action, flags='', params='',
fail_ok=False, endpoint_type='publicURL', merge_stderr=True):
flags += self.get_backend_flag()
return self.clients.cmd_with_auth(... |
"""Integration tests for setmeta command."""
from __future__ import absolute_import
from __future__ import print_function
from __future__ import division
from __future__ import unicode_literals
import re
import six
from gslib.cs_api_map import ApiSelector
import gslib.tests.testcase as testcase
from gslib.tests.tes... |
from twitter.pants.targets.jar_dependency import JarDependency
__author__ = 'John Sirois'
import hashlib
import os
import pkgutil
import re
import shutil
from contextlib import contextmanager
from twitter.common.dirutil import safe_mkdir, safe_open
from twitter.pants import get_buildroot, is_internal, is_jvm
from ... |
'''
215. Kth Largest Element in an Array
Medium
Find the kth largest element in an unsorted array. Note that it is the kth largest element in the sorted order, not the kth distinct element.
Example 1:
Input: [3,2,1,5,6,4] and k = 2
Output: 5
Example 2:
Input: [3,2,3,1,2,4,5,5,6] and k = 4
Output: 4
'''
from __futu... |
import argparse
import logging
import os
from dvc.command.base import CmdBase, append_doc_link, fix_subparsers
from dvc.exceptions import DvcException
from dvc.repo.plots.data import WORKSPACE_REVISION_NAME
logger = logging.getLogger(__name__)
class CmdPlots(CmdBase):
def _revisions(self):
raise NotImpl... |
edge = {} # edge[edge cost] = [(node1, node2), (node3, node4),...]
find = {} # find[node] = leader node of the connected component
cluster = {} # cluster[leader node of the connected component] = [node1, node2, node3,...]
size = {} # size[leader node of the connected component] = size of the connected component
... |
from django.conf import settings
from django.db import models
from django.utils import importlib
import MySQLdb as mysql
from nose.tools import assert_raises, eq_
from pyquery import PyQuery as pq
import amo.tests
from amo.urlresolvers import reverse
from addons.models import Addon
def pubdir(ob):
for name in d... |
# -*- coding: UTF-8 -*-
from django.conf.urls import url, patterns
urlpatterns = patterns('p3.views',
url(r'^map.js/', 'map_js', name='p3-map-js'),
url(r'^cart/$', 'cart', name='p3-cart'),
url(r'^cart/calculator/$', 'calculator', name='p3-calculator'),
url(r'^billing/$', 'billing', name='p3-billing'),
... |
import itertools
import tempfile
import graphviz as g
from ibis.compat import zip_longest
import ibis
import ibis.common as com
import ibis.expr.types as ir
import ibis.expr.operations as ops
def get_args(node):
if isinstance(node, (ops.Aggregation, ops.Selection)):
return get_args_selection_aggregati... |
import os
import plugintools
import navigation
from core import updater
from core.item import Item
plugintools.application_log_enabled = (plugintools.get_setting("debug")=="true")
plugintools.module_log_enabled = (plugintools.get_setting("debug")=="true")
plugintools.http_debug_log_enabled = (plugintools.get... |
import numpy as np
import warnings
warnings.simplefilter("ignore", RuntimeWarning)
def above_threshold(mins, maxs, threshold):
return np.sum(above_threshold_each(mins, maxs, threshold))
def above_threshold_each(mins, maxs, threshold):
"""Use a sinusoidal approximation to estimate the number of Growing
De... |
from koschei import backend
from koschei.config import get_config
from koschei.backend import koji_util
from koschei.backend.service import Service
from koschei.models import Package, Build, Collection
class Scheduler(Service):
koji_anonymous = False
def get_priorities(self):
priority_expr = Package.... |
from __future__ import (absolute_import, division, print_function)
import os
import unittest
from mantid.api import FileFinder
class FileFinderTest(unittest.TestCase):
def test_full_path_returns_an_absolute_path_and_the_files_exists(self):
path = FileFinder.getFullPath("CNCS_7860_event.nxs")
se... |
import argparse
import ConfigParser
import glob
import os
import re
import shlex
import sys
import unittest
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
class LiveMetricsOptions(argparse.ArgumentParser):
def __init__(self, **kwargs):
argparse.ArgumentParser.__init__(self,... |
"""
Unconfigure the namespace created by daemon_start.
"""
import argparse
import socket
import sys
from instance_provisioner import Provisioner
from lxc_manager import LxcManager
from vrouter_control import interface_unregister
def daemon_stop():
parser = argparse.ArgumentParser()
defaults = {
'use... |
from gui.utils import QtImport
from gui.widgets.acquisition_widget import AcquisitionWidget
from gui.widgets.data_path_widget import DataPathWidget
__credits__ = ["MXCuBE collaboration"]
__license__ = "LGPLv3+"
class ReferenceImageWidget(QtImport.QWidget):
def __init__(self, parent=None, name=None, fl=0):
... |
from Camera import Camera
import ImageProcessing
from PictureStorage import PictureStorage
import Settings
from Window import Window
import GUI
import Calculator
from Button import Button
from ButtonGenerator import ButtonGenerator
import cv2
import multiprocessing
import KeyListener
from History import History
class ... |
from __future__ import unicode_literals
import json
from moto.core.responses import BaseResponse
from .models import ecs_backends
class EC2ContainerServiceResponse(BaseResponse):
@property
def ecs_backend(self):
"""
ECS Backend
:return: ECS Backend object
:rtype: moto.ecs.mo... |
import vim
from . import iterator
functions = {}
def vim_cast(value):
if value is None:
return ''
elif isinstance(value, bool):
return str(int(value))
elif isinstance(value, str):
return '"' + value + '"'
elif isinstance(value, tuple):
return str(list(value))
els... |
#!/usr/bin/python3
import datetime
import sys
from collections import namedtuple
from html.parser import HTMLParser
import daily
import decimal
D = decimal.Decimal
class MyHTMLParser(HTMLParser):
def __init__(self):
HTMLParser.__init__(self, convert_charrefs=True)
self.data = []
def handle_star... |
import hashlib
import re
import time
from streamlink.plugin import Plugin
from streamlink.plugin.api import http, validate
from streamlink.stream import HTTPStream
API_URL = "http://live.bilibili.com/api/playurl?cid={0}&player=1&quality=0&sign={1}&otype=json"
API_SECRET = "95acd7f6cc3392f3"
SHOW_STATUS_ONLINE = 1
SHO... |
#!/usr/bin/env python
# coding:utf-8
import ConfigParser
import os
import re
import io
from xlog import getLogger
xlog = getLogger("gae_proxy")
class Config(object):
current_path = os.path.dirname(os.path.abspath(__file__))
def load(self):
"""load config from proxy.ini"""
current_path = ... |
from mantid.api import IFunction1D, FunctionFactory
import numpy as np
import scipy.special as sp
from scipy.integrate import quad
class StaticLorentzianKT(IFunction1D):
def category(self):
return "Muon\\MuonGeneric"
def init(self):
self.declareParameter("A0", 0.2)
self.declareParame... |
from decimal import Decimal as D
import json
import base64
from django import test
from django.test.client import Client
from django.contrib.auth.models import User
from django.core.urlresolvers import reverse
from accounts import models
USERNAME, PASSWORD = 'client', 'password'
def get_headers():
# Create a u... |
import numpy as np
from gym.spaces import Box
from rlkit.envs.proxy_env import ProxyEnv
class NormalizedBoxEnv(ProxyEnv):
"""
Normalize action to in [-1, 1].
Optionally normalize observations and scale reward.
"""
def __init__(
self,
env,
reward_scale=1.,
... |
import sys
import logging
from django.core.management.base import BaseCommand
def run_appcfg(argv):
# import this so that we run through the checks at the beginning
# and report the appropriate errors
import appcfg
# We don't really want to use that one though, it just executes this one
from goog... |
#_*_coding:utf-8_*_
import select
import socket
import sys
import queue
# 生成 socket
server = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
server.setblocking(False)
# 监听地址和端口
server_address = ('localhost', 10000)
print(sys.stderr, 'starting up on %s port %s' % server_address)
server.bind(server_address)
# 监听数量最... |
#!/usr/bin/env python
import os
import sys
import time
import math
import cairo
from collections import namedtuple
os.chdir(os.path.dirname(sys.argv[0]))
sys.path.insert(0, '..')
import lib.helpers
from lib import mypaintlib
import gui.tileddrawwidget
from lib.document import Document
TEST_BIGIMAGE = "bigimage.ora"... |
# -*- coding: utf-8 -*-
'''
Created on 22 Ιαν 2013
@author: tedlaz
'''
from PyQt4 import QtGui, QtCore
from gui import ui_pro
class dlg(QtGui.QDialog):
def __init__(self, args=None, parent=None):
super(dlg, self).__init__(parent)
self.ui = ui_pro.Ui_Dialog()
se... |
import sys
import os
sys.path.append('../fenetres/')
sys.path.append('../../../Traitement_mails/objets/')
"""<Mindpass is a intelligent password manager written in Python3
that checks your mailbox for logins and passwords that you do not remember.>
Copyright (C) <2016> <Cantaluppi Thibaut, Garchery Martial, ... |
from msrest.serialization import Model
class ContainerPropertiesInstanceView(Model):
"""The instance view of the container instance. Only valid in response.
Variables are only populated by the server, and will be ignored when
sending a request.
:ivar restart_count: The number of times that the conta... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import abc
__author__ = """Paweł Fiedor (<EMAIL>)"""
# -------------------------------------------------------------------------
#
# class Transaction
#
# -------------------------------------------------------------------------
class BaseTransaction(object):
"""
... |
#
# preprocessing methods
#
import StringIO
from ecell.emparser import em
class ecellHookClass(em.Hook):
def __init__(self, aPreprocessor, anInterpreter):
self.theInterpreter = anInterpreter
self.thePreprocessor = aPreprocessor
def afterInclude( self ):
( file, line ) = self.interpre... |
import json
from bson import json_util
from flask import request, Response
from flask.ext.cors import CORS
from API import app
from src.services.database.temp_log import TempLog
from services.monolithic.security import logged_in_route
from hardware_abstraction import Pin
from API_to_backend import response_queue, com... |
import Units
# Routines shared among Materials, Layers, and Vias
class PCModel:
def checkProperties(self, section, tableCols):
for elt in section:
for key in elt.keys():
if key not in tableCols:
print "Unrecognized property: " + str(key) + " in " + str(self.rowName) + " config file: " +... |
# Django settings for example_project project.
import os
DEBUG = True
TEMPLATE_DEBUG = DEBUG
PROJECT_ROOT = os.path.abspath(os.path.dirname(__file__))
ADMINS = (
# ('Your Name', '<EMAIL>'),
)
MANAGERS = ADMINS
DATABASE_ENGINE = 'sqlite3' # 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'o... |
"""Matcher to use to mock complex parameters."""
import inspect
class MockMatcher(object):
"""Each mock matcher must be inherited from this class.
This type is used to distinguish different object from matchers.
"""
def compare(self, param):
"""Check if matcher hits parameter value"""
... |
"""Fichier contenant la classe Sorties, détaillée plus bas;"""
from collections import OrderedDict
from abstraits.obase import *
from primaires.format.fonctions import supprimer_accents
from .sortie import Sortie
NOMS_SORTIES = OrderedDict()
NOMS_SORTIES["sud"] = None
NOMS_SORTIES["sud-ouest"] = None
NOMS_SORTIES["o... |
import uuid
from odoo import api, fields, models, tools
class Rating(models.Model):
_name = "rating.rating"
_description = "Rating"
_order = 'write_date desc'
_rec_name = 'res_name'
_sql_constraints = [
('rating_range', 'check(rating >= 0 and rating <= 10)', 'Rating should be between 0 t... |
from __future__ import division
try:
from builtins import str
except ImportError:
pass
from flask.ext.login import login_required, current_user
from flask import Blueprint, current_app, render_template, request, redirect, \
url_for, flash, make_response
from flask_blogging.forms import BlogEditor
import mat... |
"""
Remove old submissions after they were lost or returned to the LMS
"""
import logging
import time
from datetime import datetime, timedelta
from submission_queue.models import Submission
import pytz
from django.core.management.base import BaseCommand, CommandError
from django.db import transaction
log = logging.g... |
from __future__ import print_function
from os import path, mkdir, listdir, rename
from . import _, PluginLanguageDomain
from Components.ActionMap import ActionMap
from Components.config import config, ConfigSubsection, ConfigYesNo
from Components.PluginComponent import plugins
from Components.Sources.StaticText impor... |
"""elmo URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.11/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-based... |
from metaparser import MetaParser
from generator import Generator
from errors import *
import configtools
import socket
import traceback
import logging
import stat
import sys
import os
import os.path
import urlparse
log = logging.getLogger("webks")
# Cache constructs
mcCache = {}
mcCacheRoot = ""
class webKickstart... |
from datetime import datetime, timedelta
from dateutil import relativedelta
from openerp import models, fields, api
class BusConfigurationExport(models.Model):
_name = 'bus.configuration.export'
_order = 'model ASC'
name = fields.Char(u"Name", required=True, compute="_compute_name")
configuration_id... |
import sys
import getpass
import argparse
from selenium import webdriver
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.common import exceptions
from time import sleep
from datetime import datetime
import parsedatetime as pdt
SHO... |
"""Tests for the insertion sort."""
from insertion_sort import insertion_sort
import pytest
def test_insertion_sort_works_on_an_iterable_of_numbers():
"""Test that you can insertion sort a list of numbers."""
assert insertion_sort([4, 6, 2, 3, 1, 5]) == [1, 2, 3, 4, 5, 6]
def test_insertion_sort_works_on_an... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.