src stringlengths 721 1.04M |
|---|
import requests
from requests.exceptions import ConnectionError
from bs4 import BeautifulSoup
import json
from gevent.pool import Pool
from django.conf import settings
from django.core.urlresolvers import reverse
from django.core.cache import cache
from django.core.mail import send_mail
from django.contrib.sites.model... |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may ... |
# -*- test-case-name: buildbot.test.test_svnpoller -*-
import time
from twisted.internet import defer
from twisted.trial import unittest
from buildbot.changes.svnpoller import SVNPoller
# this is the output of "svn info --xml
# svn+ssh://svn.twistedmatrix.com/svn/Twisted/trunk"
prefix_output = """\
<?xml version="1.0... |
from django import template
from ..renderer import Renderer
from ..utils import update_get as u_update_get
register = template.Library()
renderer = Renderer()
class RequestException(Exception):
pass
@register.simple_tag
def render_label(field, **kwargs):
return renderer.render_label(field, **kwargs)
@regis... |
# -*- encoding: utf-8 -*-
##############################################################################
#
# Moodle Webservice
# Copyright (c) 2011 Zikzakmedia S.L. (http://zikzakmedia.com) All Rights Reserved.
# Raimon Esteve <resteve@zikzakmedia.com>
# Jesus Martín <j... |
# from django.contrib.auth.models import User
from django.utils.translation import ugettext as _
from django.contrib.auth.models import User
from django.core.exceptions import ValidationError
from django import forms
from core.models import Profile
class ProfileForm(forms.ModelForm):
username = forms.CharField(... |
# -*- coding: UTF-8 -*-
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (t... |
# Opus/UrbanSim urban simulation software.
# Copyright (C) 2010-2011 University of California, Berkeley, 2005-2009 University of Washington
# See opus_core/LICENSE
from opus_core.tests import opus_unittest
from opus_core.datasets.dataset import Dataset
from opus_core.datasets.dataset_pool import DatasetPool
from opus... |
import os
import re
import sys
import urllib2
from xml.dom import minidom
from string import letters
import webapp2
import jinja2
from google.appengine.ext import db
template_dir = os.path.join(os.path.dirname(__file__), 'templates')
jinja_env = jinja2.Environment(loader = jinja2.FileSystemLoader(template_dir),
auto... |
from utils import *
import json
import datetime
import time
from BeautifulSoup import BeautifulSoup
import logging
def getContestInList(contestList, present, past, future):
bucket = []
if future:
bucket += contestList['future']
if present:
bucket += contestList['present']
if past:
... |
from lxml import html
import requests
import argparse
from datetime import datetime
from git import Repo, Actor
def main():
parser = argparse.ArgumentParser(description='Copy a user\'s Github commit activity')
parser.add_argument('user')
parser.add_argument('repo_dir')
parser.add_argument('name')
p... |
"""Test the openml loader.
"""
import gzip
import json
import numpy as np
import os
import re
import scipy.sparse
import sklearn
import pytest
from sklearn import config_context
from sklearn.datasets import fetch_openml
from sklearn.datasets.openml import (_open_openml_url,
_get_da... |
##
# Copyright 2012-2013 Ghent University
#
# This file is part of EasyBuild,
# originally created by the HPC team of Ghent University (http://ugent.be/hpc/en),
# with support of Ghent University (http://ugent.be/hpc),
# the Flemish Supercomputer Centre (VSC) (https://vscentrum.be/nl/en),
# the Hercules foundation (htt... |
import datetime
import re
import sys
from cybox.objects.account_object import Account
from cybox.objects.address_object import Address
from cybox.objects.archive_file_object import ArchiveFile
from cybox.objects.domain_name_object import DomainName
from cybox.objects.email_message_object import EmailMessage
from cybox... |
#!/usr/bin/env python
desc="""Fetch all entries from SRA for given taxid.
Save the biggest run per each SAMPLE (SRS) from given date. Paired first, if any.
Note, it run fastq-dump in background. Make sure you have enough free cores;)
DEPENDENCIES:
Biopython
"""
epilog="""Author:
l.p.pryszcz+git@gmail.com
Barcelona,... |
import unittest
from gitversionbuilder import versioninfo, versioninfooutputter
from test import test_utils
class VersionInfoOutputterTest(unittest.TestCase, test_utils.CodeAsserts):
def test_output_cpp(self):
expected = """
// ---------------------------------------------------
... |
# -*- coding: utf-8 *-*
# InfoBox - Generate data for a display screen
# Copyright 2013 by Nikolaj Brandt Jensen
#
# 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 th... |
__kupfer_name__ = _("Locate Files")
__kupfer_actions__ = (
"Locate",
)
__description__ = _("Search filesystem using locate")
__version__ = ""
__author__ = "Ulrik Sverdrup <ulrik.sverdrup@gmail.com>"
import os
import subprocess
from kupfer.objects import Action, Source, Leaf
from kupfer.objects import TextLeaf, Fil... |
#!/usr/bin/env python3
# Calliope
# Copyright (C) 2016 Sam Thursfield <sam@afuera.me.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 Foundation, either version 3 of the License, or
# (at your option)... |
# import_export_facebook/models.py
# Brought to you by We Vote. Be good.
# -*- coding: UTF-8 -*-
from django.core.validators import RegexValidator
from django.db import models
from email_outbound.models import SEND_STATUS_CHOICES, TO_BE_PROCESSED
from wevote_functions.functions import generate_random_string, positive_... |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
# Author: Goran Kliska
# mail: goran.kliska(AT)slobodni-programi.hr
# Copyright (C) 2011- Slobodni programi d.o.o., Zagreb
# Contributions:
# Tomislav Bošnjaković, Storm Computers d.o.o. :
# - ac... |
# Vim: tabstop=4 shiftwidth=4 softtabstop=4
# coding=utf-8
# Copyright 2013 Hewlett-Packard Development Company, L.P.
# All Rights Reserved.
#
# 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 Lic... |
"""
Storage backend for course import and export.
"""
from __future__ import absolute_import
from django.conf import settings
from django.core.files.storage import get_storage_class
from storages.backends.s3boto import S3BotoStorage
from storages.utils import setting
class ImportExportS3Storage(S3BotoStorage): # py... |
##############################################################################
#
# OSIS stands for Open Student Information System. It's an application
# designed to manage the core business of higher education institutions,
# such as universities, faculties, institutes and professional schools.
# The core ... |
from django import template
from userena.contrib.umessages.models import MessageRecipient
import re
register = template.Library()
class MessageCount(template.Node):
def __init__(self, um_from_user, var_name, um_to_user=None):
self.user = template.Variable(um_from_user)
self.var_name = var_name
... |
# -*- 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 field 'Subscription.receive_only_once'
db.add_column('carts_subscription', 'receive_only_once',
... |
# Copyright (C) 2014 Peter Todd <pete@petertodd.org>
#
# This file is part of python-smartcolors.
#
# It is subject to the license terms in the LICENSE file found in the top-level
# directory of this distribution.
#
# No part of python-smartcolors, including this file, may be copied, modified,
# propagated, or distribu... |
# -*- coding: utf-8 -*-
"""
This package allows you to add information to your Ipython notebook, if you're working in a git repository.
It is usefull if you want to verify the notebook version.
This package is collecting all information by its own, so you don't need to set any repository path.
You also can check the in... |
"""
The MIT License (MIT)
Copyright (c) 2015-present Rapptz
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... |
# -*- coding: utf-8 -*-
##############################################################################
#
# Copyright (C) 2016 Pambudi Satria (<https://github.com/pambudisatria>).
# @author Pambudi Satria <pambudi.satria@yahoo.com>
#
# This program is free software: you can redistribute it and/or modify
... |
from __future__ import print_function
from bokeh.document import Document
from bokeh.embed import file_html
from bokeh.browserlib import view
from bokeh.resources import INLINE
from bokeh.models.glyphs import Circle, Text
from bokeh.models import ColumnDataSource, Range1d, DataRange1d, Plot, LinearAxis, SingleInterval... |
# -*- coding: utf-8 -*-
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law o... |
# -*- coding: utf-8 -*-
import re
from module.network.CookieJar import CookieJar
from module.network.PhantomRequest import PhantomRequest
from module.plugins.internal.misc import eval_js_script, get_domain, make_oneline
from module.plugins.internal.XFSHoster import XFSHoster
class JWPlayerBased(XFSHoster):
__n... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c) 2013 Arcus, Inc.
#
# 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
#... |
#!/usr/bin/env python
from Tools.Test import TestCase, TestSuite
from AOR.ProgUnit import ProgUnit
from AOR.Statements import Call
from AOR.If import If, IfOnly
from Grammar.Parser import ParserClass
class ProgUnitTest(TestCase):
def __init__(self):
TestCase.__init__(self, 'ProgUnit Test')
... |
# -*- coding: utf-8 -*-
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law o... |
# -*- coding: utf-8 -*-
'''
# Copyright (c) 2015 Microsoft Corporation
#
# 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 us... |
from typing import Iterable
import pandas as pd
import dask.dataframe as dd
import dask.array as da
import numpy as np
import pathos.multiprocessing as mp
import logging
class DaskPool:
'''
We need to use DaskPool to avoid hanging in linux when multiprocessing is required. Jpype hangs
when processes are no... |
from django.contrib import admin
from django import forms
from tinymce.widgets import TinyMCE
from .models import Post, Image, Author
from django.forms.extras.widgets import SelectDateWidget
import datetime
class PostForm(forms.ModelForm):
title = forms.CharField(max_length=80)
author = forms.ModelChoiceField(querys... |
#!/usr/bin/python
import sys
import os
import subprocess
import time
import logging
import argparse
import yaml
import json
import boto3
import botocore
import salt.config
import salt.key
import daemon
__author__ = "Stefan Reimer"
__author_email__ = "stefan@trinimbus.com"
__version__ = "0.4.5"
logger = logging.getL... |
import re, glob, os
ROOT_DIR = "/home/a001865/git/rename_atrainmatch/atrain_match/"
files = glob.glob(ROOT_DIR + "/*.py")
files = files + glob.glob(ROOT_DIR + "/*/*.py")
files = files + glob.glob(ROOT_DIR + "/*/*/*.py")
var_name_dict ={
"time": "profile_time",
"utc_time": "prof... |
import calendar
from datetime import date, datetime, timedelta
from django.contrib import messages
from django.core.urlresolvers import reverse
from django.http import HttpResponseRedirect, HttpResponseForbidden
from django.shortcuts import render_to_response, get_object_or_404
from django.template.context import Reque... |
from models import *
from django.db import connection
import collections
class Error(object):
def __init__(self):
self.IsError = False
self._error_number = 0
self._error_message = ''
def RaiseError(self, p_message):
self.IsError = True
self._error_message = p_message
def Error(self... |
#!/usr/bin/python2.7
# -*- coding: utf-8 -*-
# vim:ts=4:sw=4:softtabstop=4:smarttab:expandtab
# 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
... |
import glob
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.gridspec as gridspec
from scipy.optimize import minimize_scalar
from astropy.io import fits
def Q_eq(phi):
# Set inputs for fnction
sumU = 0
for wv in range(0, 5):
uSing = uMes[wv]
qSing ... |
#-*- coding: utf-8 -*-
from PyQt4 import QtGui
from ui.AppIcons import *
class BleListItem(QtGui.QListWidgetItem):
def __init__(self, name, address, rssi):
QtGui.QListWidgetItem.__init__(self)
self.name, self.address, self.rssi = name, address, rssi
self.setBleInfo(rssi)
self.c... |
import subprocess
from coveralls_multi_ci import git_stats
def test_master(repo_dir, hashes):
hex_sha = hashes['master']
assert 0 == subprocess.check_call(['git', 'checkout', '-qf', hex_sha], cwd=repo_dir)
actual = git_stats(repo_dir)
expected = dict(
branch='master',
remotes=[dict(n... |
# NFQ Conductor. A tool for centralizing and visualizing logs.
# Copyright (C) 2017 Guillem Borrell Nogueras
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# Li... |
from django.test import TestCase
from django.urls import reverse
from django_webtest import WebTest
from candidates.models.popolo_extra import Ballot
from candidates.tests.auth import TestUserMixin
from candidates.tests.factories import MembershipFactory
from candidates.tests.uk_examples import UK2015ExamplesMixin
fro... |
#!/usr/bin/python2.5
# Copyright 2010 Google 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 ... |
"""
aha minigame.
introduces user to the game
and assists choosing an idea for a venture
"""
from django.contrib.auth import logout, authenticate, login
from django.shortcuts import render
from gateway.models.Aha import Aha, Aha_Form
from gateway.models.venture import Venture
from django.db import transaction
def ah... |
"""This submodule: basic tools for creating svg files from path data.
See also the document.py submodule.
"""
# External dependencies:
from __future__ import division, absolute_import, print_function
from math import ceil
from os import path as os_path, makedirs
from tempfile import gettempdir
from xml.dom.minidom im... |
from should_be.core import BaseMixin, alias_method
try:
from collections.abc import Sized
except ImportError:
# python < 3.3
from collections import Sized
class SizedMixin(BaseMixin):
target_class = Sized
def should_be_size(self, target):
msg = '{txt} should have been size {val}, but was ... |
# coding: utf-8
import os
from django.test import TestCase
from django.core.urlresolvers import reverse
from django.utils.translation import ugettext_lazy as _
from zds.gallery.factories import GalleryFactory, UserGalleryFactory, ImageFactory
from zds.member.factories import ProfileFactory
from zds import settings
... |
# Copyright iris-grib contributors
#
# This file is part of iris-grib and is released under the LGPL license.
# See COPYING and COPYING.LESSER in the root of the repository for full
# licensing details.
"""
Provides testing capabilities for installed copies of iris-grib.
"""
# Because this file is imported by setup.p... |
from starcluster.clustersetup import ClusterSetup
from starcluster.logger import log
class OncoFuseInstaller(ClusterSetup):
def run(self, nodes, master, user, user_shell, volumes):
for node in nodes:
log.info("Installing Oncofuse 1.0.9b2 on %s" % (node.alias))
node.ssh.execute('mkdir -p /opt/software/oncofuse... |
import numpy as np
def cost_of_equity(rfr, mrp, beta=1):
'''
Calculates the fractional cost of equity from collections:
risk_free : collection of fractional risk free rates.
market_risk: collection of fractional market risk premimums.
stock_beta : collection of the market beta of the stocks.
... |
# import_export/models.py
# Brought to you by We Vote. Be good.
# -*- coding: UTF-8 -*-
from django.contrib import messages
from election_office_measure.models import Election, ContestOffice, CandidateCampaign, CandidateCampaignManager, \
BallotItem
from exception.models import handle_exception, handle_record_not_... |
# Make python script executable
#!/usr/bin/python
# Script name: calc_indices_icclim_RCM_PRECIP_EUR_44.py
# ==================================================
# Script to calculate indices from ensemble of RCMs (EURO-CORDEX)
# on resolutions 0.44deg (50km) for CLIPC
# This script does only TMAX indices
# ===========... |
from selenium import webdriver
from . import pages,base
class SharingTest(base.MultiuserFunctionalTest):
def test_logged_in_users_stories_are_saved_as_my_stories(self):
# Edith is a logged-in user
self.set_browser('edith@example.com',size=(700,900),position=(0,0))
# Her friend Oniciferous... |
# @(#) $Id: Log.py,v 1.3 2012/04/23 22:46:03 javarias Exp $
#
# ALMA - Atacama Large Millimiter Array
# (c) Associated Universities, Inc. Washington DC, USA, 2001
# (c) European Southern Observatory, 2002
# Copyright by ESO (in the framework of the ALMA collaboration)
# and Cosylab 2002, All rights rese... |
"""
.. todo::
WRITEME
"""
__authors__ = ["Ian Goodfellow", "Vincent Dumoulin"]
__copyright__ = "Copyright 2012-2013, Universite de Montreal"
__credits__ = ["Ian Goodfellow"]
__license__ = "3-clause BSD"
__maintainer__ = "LISA Lab"
import logging
from theano import gof
import theano.tensor as T
import theano
from ... |
# -*- coding: utf-8 -*-
""" Sahana Eden Messaging Model
@copyright: 2009-2014 (c) Sahana Software Foundation
@license: MIT
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 wit... |
from PIL import Image
from random import shuffle
import sys
if len(sys.argv) != 4: sys.exit("Usage: python shr.py input_image num_shreds output_image")
# load the input image
img = Image.open(sys.argv[1])
# read the desired number of shreds
numShreds = int(sys.argv[2])
if numShreds < 2: sys.exit("Expected number of ... |
import string
import base64
from Crypto.Cipher import AES
import time
class CryptoTool(object):
def __init__(self):
self.padding = '{'
self.block_size = 32
self.pad = lambda s : s + (self.block_size - len(s) % self.block_size) * self.padding
self.encodedAES = lambda c,s : base64.b6... |
"""
This module is about Tokens. Tokens are string-based objects for when
``None`` is not enough, and ``Enum`` is too much.
Tokens are used to indicate a desired behavior, instead of some specific value.
Tokens can be created by simple instantiation::
from easypy.tokens import Token
AUTO = Token('AUTO')
If y... |
from collections import OrderedDict
from datetime import datetime
import numpy as np
import pytest
from pandas.compat import PY37
import pandas as pd
from pandas import (
Categorical,
CategoricalIndex,
DataFrame,
Index,
MultiIndex,
Series,
qcut,
)
import pandas.util.testing as tm
from pan... |
#
# Copyright 2009 Eigenlabs Ltd. http://www.eigenlabs.com
#
# This file is part of EigenD.
#
# EigenD 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) a... |
from django.db import models
from django.conf import settings
# Create your models here.
User = settings.AUTH_USER_MODEL
class UserLikeManager(models.Manager):
def get_all_mutual_likes(self, user, number):
try:
qs = user.liker.liked_users.all().order_by('?')
except:
return []
mutual_users = []
for oth... |
# Django settings for sample_generator project.
DEBUG = True
TEMPLATE_DEBUG = DEBUG
ADMINS = (
# ('Your Name', 'your_email@example.com'),
)
MANAGERS = ADMINS
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'.
'NAME': '', ... |
#!/usr/bin/env python3
"""
Renumber a model so that the resids for each molecule start at 1
"""
"""
This file is part of LOOS.
LOOS (Lightweight Object-Oriented Structure library)
Copyright (c) 2016 Tod Romo, Grossfield Lab
Department of Biochemistry and Biophysics
School of Medicine & Dentistry, Universi... |
# -*- coding: utf-8 -*-
# Copyright 2019 The GraphicsFuzz Project Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless requi... |
""" XVM (c) www.modxvm.com 2013-2015 """
#####################################################################
# MOD INFO
XFW_MOD_INFO = {
# mandatory
'VERSION': '3.1.0',
'URL': 'http://www.modxvm.com/',
'UPDATE_URL': 'http://www.modxvm.com/en/download-xvm/',
'GAME_VERSIONS': [... |
#
# 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 writing, software
# ... |
# From clang/bindings/python/cindex/test
# This file provides common utility functions for the test suite.
#
import ctypes
import os
from io import StringIO
from ctypes import RTLD_GLOBAL
from clang.cindex import Cursor
from clang.cindex import TranslationUnit
import unittest
from ctypeslib.codegen import clangparser... |
# Copyright (c) 2013 - 2015 EMC Corporation.
# All Rights Reserved.
#
# 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
#
# Unle... |
# -*- encoding: utf-8 -*-
"""Test class for InterSatellite Sync
:Requirement: Satellitesync
:CaseAutomation: Automated
:CaseLevel: Component
:CaseComponent: InterSatelliteSync
:TestType: Functional
:CaseImportance: High
:Upstream: No
"""
import json
from random import randint
from fauxfactory import gen_integer... |
# -*- coding: utf-8 -*-
import urlparse
from scrapy.http import Request
from scrapy.loader import ItemLoader
from scrapy.spiders import CrawlSpider, Rule
from scrapy.linkextractors import LinkExtractor
from scrapy.loader.processors import Compose, MapCompose
from w3lib.html import replace_escape_chars, remove_tags
fr... |
# coding=latin-1
# The above comment is required, because it includes non-latin characters
# as an inline string in the source, we need to have this here as per PEP 263.
import itertools
import os
import tempfile
import time
import signal
import shutil
import unittest
import sys
import zipfile
from miro.test.framework... |
#!/usr/bin/python
#-*- coding: utf-8 -*-
# Author : Matt Hawkins
# : ipmstyle, https://github.com/ipmstyle
# : jeonghoonkang, https://github.com/jeonghoonkang
# The wiring for the LCD is as follows:
# 1 : GND
# 2 : 5V
# 3 : Contrast (0-5V)*
# 4 : RS (Register Select)
# 5 : R/W (Read Write) - GROUND... |
import unittest
import numpy as np
import pystella.rf.band as band
from pystella.rf.rad_func import Flux2MagAB, MagAB2Flux
from pystella.util.phys_var import phys
__author__ = 'bakl'
class BandTests(unittest.TestCase):
def test_load_names(self):
bands = band.band_load_names()
self.assertTrue(len(... |
#! /usr/bin/env python2
"""
Copyright 2018 ARM Limited
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to ... |
"""
Journald configuration
======================
Combiner for parsing of journald configuration. man journald.conf describes where various
journald config files can reside and how they take precedence one over another. The combiner
implements the logic and provides an interface for querying active settings.
The jour... |
# In production set the environment variable like this:
# DJANGO_SETTINGS_MODULE=RemindMeLater.settings.production
import os
import logging.config
import dj_database_url
import raven
from .base import * # NOQA
# For security and performance reasons, DEBUG is turned off
DEBUG = False
TEMPLATE_DEBUG = DEBU... |
# Copyright 2019-2020 by Christopher C. Little.
# This file is part of Abydos.
#
# Abydos 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) any later versio... |
#
# language_text.py: text mode language selection dialog
#
# Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007 Red Hat, Inc.
# All rights reserved.
#
# 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 F... |
import nltk
from textblob.classifiers import NaiveBayesClassifier
#Utf 8 support
import sys
reload(sys)
sys.setdefaultencoding("utf-8")
print "Welcom 2 meme guesser!"
print "Plz wait we is being loaded..."
#Our testing data features
memeFeatures = []
noMemeFeatures = []
#Read in our meme training data
memeTrainLis... |
import argparse
import sys
import os
import ConfigParser
class Config(object):
def __init__(self, argv):
self.version = "0.3.1"
self.rev = 307
self.argv = argv
self.action = None
self.createParser()
self.createArguments()
def createParser(self):
# Crea... |
# ICE Revision: $Id$
import re
from math import *
import sys
from PyFoam.Error import error,warning
from PyFoam.ThirdParty.pyratemp import Template as PyratempTemplate
from PyFoam.ThirdParty.pyratemp import EvalPseudoSandbox,TemplateRenderError
from PyFoam.ThirdParty.pyratemp import Renderer as PyratempRenderer
fro... |
from pyramid.view import view_config
from pyramid.httpexceptions import (
HTTPNotFound,
)
@view_config(route_name='page', renderer='templates/page.mako')
@view_config(route_name='page_view', renderer='templates/page.mako')
def page_view(request):
if 'page_id' in request.matchdict:
data = request.kimo... |
import socket
import struct
import os
import binascii
import sys
if sys.version[0] == '2':
reload(sys)
sys.setdefaultencoding('cp437')
def getNetworkIp():
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
s.setsockopt(socket.SOL_SOCKET, so... |
#!/usr/bin/env python
#
# Electrum - lightweight Bitcoin client
# Copyright (C) 2012 thomasv@gitorious
#
# 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 witho... |
#!/usr/bin env python3
# -*- coding: utf-8 -*-
import os
import csv
import json
import pymongo
from pymongo import MongoClient
# mongodb
def get_db():
client = MongoClient('localhost:27017')
db = client.forza6db
return db
def add_dados(db, data):
db.countries.insert(data)
def get_country(db, coleca... |
#! /usr/bin/python
# -*- coding: utf-8 -*-
#-----------------------------------------------------------------------------
# Name: Intercon.py
# Purpose:
# Author: Fabien Marteau <fabien.marteau@armadeus.com>
# Created: 13/05/2008
#-----------------------------------------------------------------------------
# C... |
#! /usr/bin/env python
import sys
import subprocess
import argparse
def pycurl(url, *args, **kwargs):
cmd = "curl"
if (args):
for arg in args: cmd += " "+arg
if (kwargs):
for k,v in kwargs.iteritems():
if (len(k) == 1):
if (v): cmd += " -"+k+" "+v
... |
# encoding: utf-8
from __future__ import unicode_literals
import json
import re
import itertools
from .common import InfoExtractor
from .subtitles import SubtitlesInfoExtractor
from ..compat import (
compat_HTTPError,
compat_urllib_parse,
compat_urllib_request,
compat_urlparse,
)
from ..utils import (... |
#!/usr/bin/python
'''==============================================================================
This script reads information from the pickle caches and directly
makes plots
=============================================================================='''
import os, sys
import re, glob, subprocess, tim... |
#!/bin/env python
#
# AutoPyfactory batch plugin for Condor
#
from CondorBase import CondorBase
from autopyfactory import jsd
from autopyfactory.condor import killids, mincondorversion
import subprocess
import time
import commands
import logging
import traceback
#mincondorversion(8,1,1)
class CondorEC2(CondorBase)... |
import imagetree
import serializer
from utilities import quadkey_to_xyz, xyz_to_quadkey, is_valid_quadkey
from serializer import create_tree_from_jpg_url
import commander
import constants
import sys
valid_commands = ['+', '-', 'l', 'r', 'u', 'd', 's']
def tree_viewer_valid_input(input_command):
return input_comm... |
"""
Purpose:
-----------------------------------------------------------
This script creates graphs for t-test for 4 conditions
For each subject each run each condition, plot the t statistics
-----------------------------------------------------------
"""
import sys, os
sys.path.append(os.path.join(os.path.dirname(_... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.