code
stringlengths
1
199k
import views import os from django.conf.urls import patterns, url, include from django.contrib import admin from paper_plane.file_manager import FileManager admin.autodiscover() qrcode_dir = os.path.dirname(FileManager().get_path_of_qrcode('any')) urlpatterns = patterns('django.views.static', url(r'^admin/', includ...
from __future__ import annotations from typing import cast from typing import Optional import logging import time from datetime import datetime from pathlib import Path from gi.repository import Gtk from gajim.common import app from gajim.common import configpaths from gajim.common.const import KindConstant from gajim....
from math import pi import numpy as np from gpaw import debug, extra_parameters from gpaw.spherical_harmonics import Y from gpaw.grid_descriptor import GridDescriptor from gpaw.mpi import serial_comm import _gpaw """ === ================================================= M Global localized function number. W Glob...
""" mapstack.py - process mapstacks -------------------------------- Usage: mapstack -c inifile -C casename --clone clonemap -c name of the config file (in the case directory) """ import os import os.path import getopt from wflow.wf_DynamicFramework import * from wflow.wflow_adapt import * def usage(*args): sy...
"""Download flags of countries (with error handling). asyncio async/await version """ import asyncio import collections from contextlib import closing import aiohttp from aiohttp import web import tqdm from flags2_common import main, HTTPStatus, Result, save_flag DEFAULT_CONCUR_REQ = 5 MAX_CONCUR_REQ = 1000 class Fetch...
import pynotify def show_message(this_string): pynotify.init("TEST") #Just an obligation. Nothing more. notice=pynotify.Notification("Live Update ",this_string) notice.show()
import ilastik.ilastik_logging ilastik.ilastik_logging.default_config.init() import unittest import numpy as np import vigra from lazyflow.graph import Graph from ilastik.applets.objectClassification.opObjectClassification import \ OpRelabelSegmentation, OpObjectTrain, OpObjectPredict, OpObjectClassification, \ ...
import os, sys import rpy2.robjects as r def RunR(rdir, wdir, org_code, date1, date2): from local_settings import DATABASES os.chdir(rdir) #print settings.DATABASES r.r("dbname <- '%s'" % DATABASES['default']['NAME']) r.r("dbuser <- '%s'" % DATABASES['default']['USER']) r.r("dbpasswd <- '%s'" % ...
import unittest import requests import json API_URL = 'http://127.0.0.1:8080/api/v1' def print_json(data): print(json.dumps(data, sort_keys=True, indent=4)) class TestAccount(unittest.TestCase): def test_accounts_get(self): print("\nGET /accounts/") res = requests.get(API_URL + '/accounts/') ...
from pyspark import SparkContext, SparkConf, SQLContext, Row, HiveContext from pyspark.sql.types import * from datetime import date, datetime, timedelta import sys, re, os st = datetime.now() conf = SparkConf().setAppName('PROC_A_CI_CUST_PROD').setMaster(sys.argv[2]) sc = SparkContext(conf = conf) sc.setLogLevel('WARN'...
""" This example explores how to create a file with very specific mode bits. References: - https://stackoverflow.com/questions/5624359/write-file-with-specific-permissions-in-python/15015748 """ import os prev_mask = os.umask(0o000) with os.fdopen(os.open("/tmp/test", os.O_WRONLY | os.O_CREAT, 0o644), 'wt') as f: f...
from modeltranslation.translator import TranslationOptions from modeltranslation.translator import translator from .models import SiteMessage class SiteMessageTranslationOptions(TranslationOptions): fields = ("message",) required_languages = ( "fr", "en", ) translator.register(SiteMessage, S...
""" main function to run the blocktool api from the command line. """ from __future__ import print_function from __future__ import absolute_import from __future__ import unicode_literals import sys from .cli import cli sys.exit(cli())
"""Task ID utilities.""" import re class TaskID(object): """Task ID utilities.""" DELIM = '.' DELIM2 = '/' NAME_RE = r"\w[\w\-+%@]*" NAME_REC = re.compile(r"\A" + NAME_RE + r"\Z") POINT_RE = r"\S+" POINT_REC = re.compile(r"\A" + POINT_RE + r"\Z") SYNTAX = 'NAME' + DELIM + 'CYCLE_POINT' ...
import warnings from feeluown.gui import CollectionUiManager # noqa warnings.warn('Please import CollectionUiManager from feeluown.gui', DeprecationWarning, stacklevel=2)
import sys import time import copy import types import argparse import types import io from .mp_utils import * if PY3: builtin = (int,float,str,complex) else: builtin = (int,float,str,long,complex) def isInteresting(x): if isinstance(x,(types.ModuleType,types.FunctionType,types.LambdaType,io.IOBase,type(None),Mem...
from df_global import * from df_ontology import * from df_backend import * from df_data_channels import * from df_presets import * from math import * import random def initialize_limbs(): """initialize limb data structure DfGlobal()["limbs"]""" g = DfGlobal() instrument_list = {} instrument_list["left hand"...
from kivy.utils import get_color_from_hex def get_theme_atlas(): theme_key = _resolve_theme_key() return 'atlas://data/themes/%dpx/screens/' % int(theme_key) def get_post_atlas(): theme_key = _resolve_theme_key() return 'atlas://data/themes/%dpx/themes/' % int(theme_key) def _scale_to_theme_dpi(value): ...
import os, errno from setuptools import setup, find_packages directory = 'PyNeurActiv/' try: os.makedirs(directory) except OSError as e: if e.errno != errno.EEXIST: raise move = ( '__init__.py', 'LICENSE', 'analysis', 'data_io', 'lib', 'models', 'plot', ) for fname in move: ...
from PyQt4.QtGui import QApplication from main_window import MainWindow if __name__ == "__main__": import sys app = QApplication(sys.argv) main = MainWindow() with open('tema.qss', 'r') as f: tema = f.read() app.setStyleSheet(tema) main.show() sys.exit(app.exec_())
"""Package information for NetForeman.""" import os.path import io from setuptools import setup from netforeman.version import __version__ def read(file_path_components, encoding="utf8"): """Read the contents of a file. Receives a list of path components to the file and joins them in an OS-agnostic way. Ope...
from PyQt4.QtGui import * from PyQt4.QtCore import * from PyQt4.QtSvg import * from PyQt4.QtWebKit import QWebPage import re, os, sys, tempfile, urllib2, ctypes from anki.utils import stripHTML, tidyHTML, canonifyTags from anki.sound import playFromText, clearAudioQueue from ankiqt.ui.sound import getAudio import anki....
''' Created on 04-Feb-2014 @author: dgraja ''' from sqlalchemy import create_engine from sqlalchemy import * from sqlalchemy.orm import sessionmaker from tables import * some_engine = create_engine('sqlite:///D:\\Temp\\Python\\employees.db') Session = sessionmaker(bind=some_engine) session = Session() users = session.q...
import plugins.LSP.ptbase64.main as lsp print("[Client] ============================================================================") print("[Client] Client side test unit, testing base64_LoginSocketProvider, ILoginDBProvider.") print("[Client] ==========================================================================...
import pkg_resources def version(): package_metadata = pkg_resources.get_distribution("wisestork") return package_metadata.version
import logging import weakref logging.basicConfig() logger = logging.getLogger("kalliope") class NotificationManager(object): """ Class sued to send messages to all instantiated object that use it as parent class """ _instances = set() def __init__(self): self._instances.add(weakref.ref(self...
from .bibman import Biblioteche, Biblioteca from .xmldao import XMLBiblioteche __all__ = ['Biblioteca', 'Biblioteche', 'XMLBiblioteche']
# This file is part of Plex:CS. from plexcs import logger, helpers, common, request from plexcs.helpers import checked, radio from xml.dom import minidom from httplib import HTTPSConnection from urlparse import parse_qsl from urllib import urlencode from pynma import pynma import base64 import cherrypy import urllib ...
""" Copyright © 2017 - Alexandre Machado <axmachado@gmail.com> This file is part of Simple POS Compiler. Simnple POS Compiler 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 ...
""" Utility functions for automatic downloading of public MRIO databases """ import itertools import os import re from collections import namedtuple import requests from pymrio.tools.iometadata import MRIOMetaData WIOD_CONFIG = { "url_db_view": "http://www.wiod.org/database/wiots13", "url_db_content": "http://w...
import csv import re from datetime import datetime from os import scandir, getcwd OUTPUT_CSV_PATH = "./csv/dataset/dataset.csv" FORMAT_DATA = '%d_%m_%Y' HEADERS = ['Data', 'Tipus', 'Nom', 'Simbol', 'Preu (Euros)', 'Tipus_cotitzacio'] CRYPTO_MONEDA = 'crypto_moneda' STOCK_INDEX = 'index_borsatil' EURO_VALUE_FROM_DOLAR =...
'''File: paratt_weave.py an implementation of the paratt algorithm in weave should yield a speed increase > 2. Programmed by: Matts Bjorck Last changed: 2008 11 23 ''' from numpy import * import scipy.weave as weave def Refl(theta,lamda,n,d,sigma): # Length of k-vector in vaccum k=2*math.pi/lamda theta=arra...
import aiohttp from .link import Link class UDPLink(Link): def __init__(self, project, link_id=None): super().__init__(project, link_id=link_id) self._created = False self._link_data = [] @property def debug_link_data(self): """ Use for the debug exports """ ...
import factory from django.contrib.auth.models import User from wacep.weatherroulette.models import ( GameState, Move, Puzzle, PuzzleRound ) class UserFactory(factory.django.DjangoModelFactory): class Meta: model = User username = factory.Sequence(lambda n: "user_%d" % n) class PuzzleFactory(factory...
import logging import subprocess import sys import unittest import tempfile import pathlib import pygit2 import git_annex_adapter class LoggedTestCase(unittest.TestCase): """Extends unittest.TestCase to print log messages to stderr.""" def setUp(self): super().setUp() logging.basicConfig( ...
""" Service for handling the local sessions. """ import binascii import os from twisted.application import service from twisted.logger import Logger from leap.bitmask.hooks import HookableService class SessionService(HookableService): """ This service holds random local-session tokens, that will be used to ...
"""Auto-generated from spec: urn:broadband-forum-org:tr-181-1-0.""" import core from tr157_v1_1 import Device_v1_4 class Device_v1_5(Device_v1_4): """Represents Device_v1_5.""" def __init__(self, **defaults): Device_v1_4.__init__(self, defaults=defaults) self.Export(objects=['DeviceInfo', ...
"""Viewport Menu. This module defines the functions of the Viewport menu. """ from __future__ import print_function import pyformex as pf import canvas import widgets import draw from gettext import gettext as _ import prefMenu from widgets import simpleInputItem as _I import utils def setTriade(): try: pos...
import os out = None def render_copy(source): with open(source, "r") as fin: for line in fin: out.write(line) def render_section_header(name, anchor): out.write('<h2><a id="{anchor}" class="anchor" href="#{anchor}" aria-hidden="true"><span class="octicon octicon-link"></span></a>{name}</h2>\n'.format(name=name, ...
import os import datetime as dt home_dir = os.getenv("HOME") ctr_file = "/article_id_counter.txt" global_ctr_path = home_dir + ctr_file def get_global_id_counter(): open_type = "wb+" if not os.path.exists(global_ctr_path) else "rb+" f = open(global_ctr_path, open_type) txt = f.read() article_id_num = int(txt) if tx...
""" Django settings for meridian project. Generated by 'django-admin startproject' using Django 1.8.4. For more information on this file, see https://docs.djangoproject.com/en/1.8/topics/settings/ For the full list of settings and their values, see https://docs.djangoproject.com/en/1.8/ref/settings/ """ import os BASE_...
from future_builtins import map __license__ = 'GPL v3' __copyright__ = '2008, Kovid Goyal kovid@kovidgoyal.net' __docformat__ = 'restructuredtext en' __appname__ = u'calibre' numeric_version = (1, 28, 0) __version__ = u'.'.join(map(unicode, numeric_version)) __author__ = u"Kovid Goyal <kovid@kovidgoyal.net>" '...
exec(open('gimb/version.py').read())
from __future__ import ( absolute_import, division, print_function, unicode_literals, ) import os import platform import shutil import stat import subprocess from subprocess import Popen, call from time import sleep import core def extract(file_path, output_destination): success = 0 # Using Wind...
''' Smart search for upgrade paths Copyright (C) 2016 Andrew Leeming <andrew.leeming@codethink.co.uk> and Bob Mottram <bob.mottram@codethink.co.uk> 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 Foun...
from math import sqrt print "Veuillez entrer le côté a : " a = float(raw_input()) print "Veuillez entrer le côté b : " b = float(raw_input()) print "Veuillez entrer le côté c : " c = float(raw_input()) d = (a + b + c)/2 # demi-périmètre s = sqrt(d*(d-a)*(d-b)*(d-c)) # aire (suivant formule) print "Lon...
from Tkinter import * from tkMessageBox import * from tkFileDialog import * from tkFont import * import os class DialogMaker(object): """Methoden zur Erzeugung und Gestaltung von Tkinter-Dialogen""" def __init__(self): """Erzeugt Tkinter-Dialog und setzt Dialogtitel""" self.dia=Tk() def title (self, title): se...
import darkleaks import shutil import os import hashlib source_filename = "ROJAVA" chunks_directory = "./test/" number_chunks = 20 def setup_testdir(path): if os.path.isdir(path): shutil.rmtree(path) os.makedirs(path) def checksum(filename): f = open(filename) return hashlib.sha1(f.read()).hexdi...
from webapp.models import Movie, MovieGenre from engine.movie_finder.description_provider \ import DescriptionProvider __author__ = 'mario-dimitrov' def create_movie_data(movie_id): d_provider = DescriptionProvider(movie_id) movie = Movie(movie_id=movie_id, title=d_provider.get_name(), ...
from openerp import models, fields class ClouderApplication(models.Model): """ Add the default price configuration in application. """ _name = 'clouder.application' container_price_partner_month = fields.Float('Price partner/month') container_price_user_month = fields.Float('Price partner/month'...
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 field 'HelpRequest.facebook' db.add_column(u'helpdesknew_helprequest', 'facebook', self.gf('django.db.mo...
import logging import click from wheel import create_app from wheel.core.db import db from wheel.utils.populate import Populate app = create_app() if app.config.get("LOGGER_ENABLED"): logger.basicConfig(level=getattr(logging, app.config.get('LOGGER_LEVEL', ...
import numpy import scipy import os import string import json from subprocess import Popen, PIPE, STDOUT from nltk.corpus import stopwords from nltk.stem import SnowballStemmer from explore.models import Article from django.conf import settings def save_sparse(m, prefix) : numpy.save(prefix + '.data.npy', m.dat...
__author__ = "Frederic F. MONFILS" __version__ = "$Revision: $".split()[1] __revision__ = __version__ __date__ = "$Date: $" __copyright__ = "Copyright (c) 2008-2009 Junior (Frederic) FLEURIAL MONFILS" __license__ = "GPLv3" __contact__ = "ffm at cetic.be" import compiler from core.metric import Metric class HalsteadTime...
import numpy as np import operator,copy class prbs_base: modes = { "PRBS7":[0,6,7], "PRBS15":[0,14,15], "PRBS23":[0,18,23], "PRBS31":[0,28,31] } def __init__(self, which_mode = "PRBS31", reset_len=100000): # https://en.wikipedia.org/wiki/Pseudorandom_binary_sequen...
from functools import singledispatch import numpy as np import pandas as pd import sys @singledispatch def shannon_entropy(x, base=None): """ Calculate shannon entropy of a list like with discrete classes :param x: :param base: int; which base should be used for calculating the units :return: ""...
from setuptools import setup, find_packages import os, os.path import subprocess here = os.path.abspath(os.path.dirname(__file__)) README = open(os.path.join(here, 'README.rst')).read() HISTORY = open(os.path.join(here, 'HISTORY.rst')).read() VERSION = '0.6.0b1' install_requires = ['Flask', 'requests', 'psutil', 'pyyam...
import pygame from Configuracion import * def QuitGame(): pygame.quit() quit() def ReproducirAudio(Audio): pygame.mixer.music.stop() pygame.mixer.music.load(Audio) pygame.mixer.music.play() def PlayCelebrar(): pygame.mixer.music.stop() pygame.mixer.music.load(SONIDO_CELEBRAR) pygame.mi...
import re import io import sys import time import serial import logging import datetime import threading import subprocess PMTK_STANDBY = '$PMTK161,0*28\r\n' PMTK_SET_PERIODIC_MODE_NORMAL = '$PMTK225,0*2B\r\n' PMTK_SET_PERIODIC_MODE_AUTO_LOCATE_STANDBY = '$PMTK225,8*23\r\n' PMTK_SET_PERIODIC_MODE_SLEEP = '$PMTK225,2,30...
"""Our own Errors exceptions""" class SflPhoneError(Exception): """Base class for all SflPhone exceptions.""" def __init__(self, help=None): self.help=help def __str__(self): return repr(self.help) class SPdbusError(SflPhoneError): """General error for dbus communication""" class SPdaemo...
l10n_strings = { "default_locale": "en", "locales": { "en": { "isocode": {"textContent": "en"}, "autonym": {"textContent": "English"}, "homepage": {"alt": "Homepage", "title": "Homepage"}, "choose-language": {"placeholder": "Choose a language..."}, ...
from distutils.core import setup setup(name='Example-Boto-Project', version='0.1', description='An example project which uses Boto', long_description='An example project which uses Boto', author='Waldemar Zurowski', author_email='wzurowski@gmail.com', license='GPL3', url='https...
import xc_base import geom import xc from model import predefined_spaces from materials import typical_materials __author__= "Luis C. Pérez Tato (LCPT)" __copyright__= "Copyright 2014, LCPT" __license__= "GPL" __version__= "3.0" __email__= "l.pereztato@gmail.com" NumDiv= 1 CooMax= 10 feProblem= xc.FEProblem() preproces...
"""File necessary to identify this directory as a Python package.""" import logging import os import sys _log = logging.getLogger(__name__) _path = os.path.dirname(__file__) if not _path in sys.path: sys.path.append(_path) _log.debug('added %s to Python path' % _path)
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 'RelatedContent' db.create_table('genericrelations_relatedcontent', ( ('id', self.gf('django.db.models.field...
"""Dynamic forms serializers.""" from typing import List from rest_framework import serializers from .models import Form, Section, Question, Answer, FormEntry, File class QuestionSerializer(serializers.ModelSerializer): """Serializer for form questions.""" class Meta: # noqa model = Question fi...
from .initialized import InitializedSnapping class Snapping: MAXIMAL_DISTANCE = 10 def __init__(self, application, elements, connections, selected_elements): self.__application = application self.__elements = list(elements) self.__connections = list(connections) self.__selected_e...
__author__ = 'rainbowbreeze' import unittest import datetime from domain.bando import Bando from logic.itemsmanager import ItemsManager class TestItemsManager(unittest.TestCase): def test_checkForNewItems(self): # Creates the list of download object items_manager = ItemsManager() items_downl...
from __future__ import division, absolute_import, print_function import pytest import gromacs common_tool_names = ["pdb2gmx", "grompp", "editconf", "mdrun"] aliased_tool_names = gromacs.tools.NAMES5TO4.values() @pytest.fixture(scope="module", params=set(common_tool_names + aliased_tool_names)) def groma...
from urllib.request import urlopen from urllib.request import urlretrieve from urllib.request import Request import urllib.error import sys, os, time, random, re modulesPath = os.path.join(os.path.dirname(os.getcwd()), 'Modules') if os.path.isdir(modulesPath) is True: print("Modules found at:\t{}".format(modulesPat...
def checksum(ssn): return (11 - (sum([int(s)*(len(S)-i+1) for (s,i) in zip(S,range(len(S)))]) % 11)) % 10
from .ecl_config import * from .help_resources import * from .site_config import * from .jobs import * from .logging import *
""" Created on Fri Jan 27 16:54:38 2017 @author: Rignak """ import numpy as np import os import cv2 import imutils from PIL import Image baseFolder = 'results' for folder in ['google', 'wikipedia', 'done']: folder = os.path.join(baseFolder, folder) if not os.path.exists(folder): os.makedirs(folder) def ...
import requests try: from bs4 import BeautifulSoup except ImportError: print(''' BeautifulSoup não instalado Faça a instalação do BeautifulSoup e da html5lib [+] Links BeautifulSoup: https://pypi.python.org/pypi/beautifulsoup4 html5lib: https://pypi.python.org/pypi/html5lib ''') exit(1) from pytijobs import...
from tempfile import mkdtemp import os from kiwi.system.root_import.base import RootImportBase from kiwi.logger import log from kiwi.path import Path from kiwi.utils.sync import DataSync from kiwi.command import Command from kiwi.archive.tar import ArchiveTar from kiwi.defaults import Defaults class RootImportOCI(RootI...
__license__ = 'GPL v3' __copyright__ = '2008, Kovid Goyal kovid@kovidgoyal.net' __docformat__ = 'restructuredtext en' ''' Command line interface to the calibre database. ''' import sys, os, cStringIO, re from textwrap import TextWrapper from calibre import preferred_encoding, prints, isbytestring from calibre.utils.c...
"""Data useful for calibrations (Smith-Pokorny cone fundamentals etc...) """ from __future__ import absolute_import, print_function import numpy wavelength_5nm = numpy.arange(380, 785, 5) juddVosXYZ1976_5nm = numpy.asarray([ [0.003, 0.005, 0.011, 0.021, 0.038, 0.063, 0.100, 0.158, 0.229, 0.281, 0.311, 0.331, 0...
import tempfile import os.path import shutil class ChuckyWorkingEnvironment(): def __init__(self, basedir, logger): self.basedir = basedir self.logger = logger self.cachedir = os.path.join(basedir, 'cache') self.workingdir = tempfile.mkdtemp(dir=self.basedir) self.bagdir = os...
import re import os import json import logging import itertools import nltk from difflib import SequenceMatcher from nltk.metrics.distance import edit_distance as editDistance from nltk.stem.lancaster import LancasterStemmer from nltk.util import ngrams from string import punctuation from termcolor import colored class...
from django.db import migrations, models import django.db.models.deletion import wagtail.core.blocks import wagtail.core.fields import wagtail.embeds.blocks import wagtail.images.blocks import weblog.models class Migration(migrations.Migration): initial = True dependencies = [ ('wagtailcore', '0040_page...
# Copyright 2014-2016 The ODL development group """Base classes for discretization.""" from __future__ import print_function, division, absolute_import from future import standard_library standard_library.install_aliases() from builtins import super from odl.operator import Operator from odl.space.base_ntuples import ...
""" AES Block Cipher. Performs single block cipher decipher operations on a 16 element list of integers. These integers represent 8 bit bytes in a 128 bit block. The result of cipher or decipher operations is the transformed 16 element list of integers. Running this file as __main__ will result in a self-test of the al...
"""DockerFlow endpoints""" import cyclone.web from twisted.internet.threads import deferToThread from autopush.web.base import BaseWebHandler class VersionHandler(BaseWebHandler): def _get_version(self): self.set_header("Content-Type", "application/json") try: with open("version.json") a...
from django.conf.urls import patterns, include, url from django.conf import settings from django.contrib import admin urlpatterns = patterns('', # BrowserId url(r'', include('django_browserid.urls')), # Voting urls url(r'^dashboard/', include('woodstock.voting.voting_urls')), url(r'^v/', include('wo...
import re import itertools from collections import Iterable import pandas as pd def new_data_frame(): """Returns a pre-initialized :class:`pandas.DataFrame` with the correct columns in place.""" return pd.DataFrame( columns=[ 'timestamp', 'type', 'id', ...
import logging from django.db.utils import DatabaseError from django.db.models.signals import post_save from django.dispatch import receiver from request.models import Queue, RequestDm from dm.api import senddm from django.utils.translation import gettext as _ from moderation.models import Category from moderation.mode...
import datetime import pytest from django.core.exceptions import ValidationError from treeherder.perf.models import (PerformanceAlert, PerformanceAlertSummary) def test_summary_modification(test_repository, test_perf_signature): s = PerformanceAlertSummary.objects.create( ...
import os import pytest CUR_DIR = os.path.dirname(os.path.abspath(__file__)) skeleton_path = os.path.join(CUR_DIR, 'test_data', 'skeleton.asf') m_walking_path = os.path.join(CUR_DIR, 'test_data', 'walking.amc')
"""Akvo RSR is covered by the GNU Affero General Public License. See more details in the license.txt file located at the root folder of the Akvo RSR module. For additional details on the GNU license please see < http://www.gnu.org/licenses/agpl.html >. """ from html.parser import HTMLParser from os import walk from os....
from __future__ import print_function, unicode_literals import copy import inspect import locale import logging import os from os.path import isabs from posixpath import join as posix_join import six from pelican.log import LimitFilter try: # SourceFileLoader is the recommended way in 3.3+ from importlib.machin...
import string import json from django import forms from django.core.exceptions import ValidationError from django.core.validators import RegexValidator from django.utils.translation import ugettext_lazy as _ from django.template.defaultfilters import capfirst from .decorators import to_list @to_list def get_choices(): ...
import sys import json import geojson import shapely if len(sys.argv) != 2: print """ Usage: mangleresults.py combined.json > points.geojson """ sys.exit(0) with open(sys.argv[1]) as f: taskruns = json.loads(f.read()) for taskrun in taskruns: taskrun['taskrun_id'] = taskrun.pop('id') taskrun['task']...
""" Views to show a course's bookmarks. """ import six from django.contrib.auth.decorators import login_required from django.shortcuts import render_to_response from django.template.context_processors import csrf from django.template.loader import render_to_string from django.urls import reverse from django.utils.decor...
""" Tests for custom model code in the programs app. """ import datetime import ddt import pytz from django.core.exceptions import ValidationError from django.db import IntegrityError from django.test import TestCase from programs.apps.programs import models from programs.apps.programs.constants import ProgramStatus, P...
import datetime from django_webtest import WebTest from django.contrib.auth.models import User from django.core.urlresolvers import reverse from pylab.core.models import Project, VotingPoll, Vote class VotingTests(WebTest): def setUp(self): super().setUp() self.u1 = User.objects.create_user('u1') ...
from scrapy.spider import BaseSpider from scrapy.selector import HtmlXPathSelector from scrapy.http import Request from animecrazy.items import AnimecrazyItem class AnimeCrazySpider(BaseSpider): name = 'animecrazy.net' base_url = 'http://'+name allowed_domains = ['animecrazy.net'] start_urls = [ ...
import doctest import unittest import datetime import time import jsonpickle from jsonpickle import tags from jsonpickle.tests.classes import Thing, DictSubclass class PicklingTestCase(unittest.TestCase): def setUp(self): self.pickler = jsonpickle.pickler.Pickler() self.unpickler = jsonpickle.unpick...
from django.contrib.auth.models import User from django.db import models from django.utils.translation import ugettext_lazy as _ from django.core.exceptions import ObjectDoesNotExist, MultipleObjectsReturned from model_utils.managers import PassThroughManager from crm.defaults import * from crm import querysets class G...
{ '!langcode!': 'pt', '!langname!': 'Português', '"update" is an optional expression like "field1=\'newvalue\'". You cannot update or delete the results of a JOIN': '"update" é uma expressão opcional como "field1=\'newvalue\'". Não pode actualizar ou eliminar os resultados de um JOIN', '%s %%{row} deleted': '%s linhas ...
import os import threading import unittest import web from inginious.frontend.app import get_app from nose.plugins.skip import SkipTest from pymongo import MongoClient from pyvirtualdisplay import Display from selenium import webdriver from selenium.common.exceptions import NoAlertPresentException from selenium.common....