code stringlengths 1 199k |
|---|
import json
import pandas
import matplotlib.pyplot as plt
tweets_data_path = 'tweet_mining.json'
results = []
tweets_file = open(tweets_data_path, "r")
for tweet_line in tweets_file:
try:
status = json.loads(tweet_line)
results.append(status)
except:
continue
print len(results)
statuses ... |
from app.models import CreditGroup , CreditUser
from post_office import mail
from django.conf import settings
FROM_EMAIL = 'Creddit <abc@abc.com>'
def send_email(to_email, from_email, template, dict_context):
mail.send(
to_email, # List of email addresses also accepted
from_email,
template=... |
import argparse, os, sys
DEFAULT_EXECPARAMS = {
'timeLimitMs': 60000,
'memoryLimitKb': 128*1024,
'useCache': False,
'stdoutTruncateKb': -1,
'stderrTruncateKb': -1,
'getFiles': []
}
SELFDIR = os.path.normpath(os.path.dirname(os.path.abspath(__file__)))
sys.path.append(os.path.join(SELFDIR, '.... |
import frappe, json
from frappe.utils import cint, quoted
from frappe.website.path_resolver import resolve_path
from frappe.model.document import get_controller, Document
from frappe import _
no_cache = 1
def get_context(context, **dict_params):
"""Returns context for a list standard list page.
Will also update `get_... |
from setuptools import setup
setup(name='myops2',
version='2.0.0',
description='MyOps 2',
url='',
author='Ciro Scognamiglio',
author_email='ciro.scognamiglio@lip6.fr',
license='MIT',
packages=['myops2','myops2.lib','myops2.monitor','myops2.oml',],
scripts=['myops2/bin/myo... |
import sys
sys.path.append("/home/pi/Documents/Robots/slcypi/MA") ### ADD PATH
import cv2
import numpy as np
import matplotlib.pyplot as plt
import picamera
import picamera.array
import time
import pygame
from scipy import ndimage
from time import sleep
WIDTH = 160
HEIGHT = WIDTH * 0.75
pygame.init()
pygame.display.set... |
from . import promotion_model |
from __future__ import print_function
from __future__ import absolute_import
import os
import tct
import sys
params = tct.readjson(sys.argv[1])
facts = tct.readjson(params['factsfile'])
milestones = tct.readjson(params['milestonesfile'])
reason = ''
resultfile = params['resultfile']
result = tct.readjson(resultfile)
to... |
class Node:
def __init__(self):
self.parent = -1
self.sibling = -1
def dfs(v, d=0):
G[v].depth, G[v].height = d, 0
if G[v].left != -1:
G[v].height = max(G[v].height, dfs(G[v].left, d+1) + 1)
if G[v].right != -1:
G[v].height = max(G[v].height, dfs(G[v].right, d+1) + 1)
... |
from distutils.core import setup
version='1.3.8'
setup(
name='vkontakte_viomg',
version=version,
author='Mikhail Korobov, Serhii Maltsev, Eugeny Yablochkin',
author_email='kmike84@gmail.com, alternativshik@gmail.com',
packages=['vkontakte_viomg'],
install_requires=[
'gevent>=1.0.2',
... |
def sum_of_squares(number):
return sum([i**2 for i in range(1, number+1)])
def square_of_sum(number):
return sum(range(1, number+1)) ** 2
def difference(number):
return square_of_sum(number) - sum_of_squares(number) |
"""Tests arrow keys on both command and edit mode"""
from selenium.webdriver.common.keys import Keys
def test_dualmode_arrows(notebook):
# Tests in command mode.
# Setting up the cells to test the keys to move up.
notebook.to_command_mode()
[notebook.body.send_keys("b") for i in range(3)]
# Use both... |
import tkinter as tk
root = tk.Tk()
listbox = tk.Listbox(root, selectmode=tk.EXTENDED)
listbox.pack()
items = ["banana", "apple", "mango", "orange"]
for item in items:
listbox.insert(tk.END, item)
def print_selection():
selection_id_tuple = listbox.curselection()
selection_label_tuple = tuple(listbox.get(it... |
from sys import argv
import re
if len(argv) < 3 or argv[1] == argv[2]:
print "Error la sintaxis es:"
print "\t$",argv[0]," output/floydS.dat"," output/floyd1D.dat"
print "\t$",argv[0]," output/floydS.dat"," output/floyd2D.dat"
else:
archivoFloydS = argv[1]
archivoFloydP = argv[2]
flujoArchivoS = open(archivoFloyd... |
def BruteForceSingleSellProfit(arr):
# Store the best possible profit we can make; initially this is 0.
bestProfit = 0;
# Iterate across all pairs and find the best out of all of them. As a
# minor optimization, we don't consider any pair consisting of a single
# element twice, since we already kno... |
import random
numero = random.randint(1, 100)
tentativas = 0
escolha = 0
while escolha != numero:
escolha = input("Informe um número entre 1 e 100: ")
tentativas += 1
if escolha > numero:
print "Maior"
elif escolha < numero:
print "Menor"
print "Acertou. O número sorteado era", numero
pr... |
import os
import tempfile
import subprocess
import gtts
class TTSEngine:
def __init__(self,language='en'):
"""
Initiates the Google TTS engine
"""
self.language = language
def play(self,filename):
cmd = ['mpg321', str(filename)]
with tempfile.TemporaryFile() as f:... |
import platform
import unittest
from conans.client.tools import environment_append
from conans.test.utils.tools import TestClient, TestServer
from cpt.test.test_client.tools import get_patched_multipackager
class VisualToolsetsTest(unittest.TestCase):
conanfile = """from conans import ConanFile
class Pkg(ConanFile)... |
import random
'''
-----------------------
Deterministic Selection
-----------------------
* Performance:
Best: O(n)
Average: O(n)
Worst: O(n)
* Space: n
Notes
-----
Selects the ith-smallest element from the list of values, without the use of a random pivot. This approach
tends to be slo... |
from myhdl import Signal, always_comb
def device_input_diff_buffer(in_p, in_n, sig):
if isinstance(sig, list):
num_channels = len(sig)
@always_comb
def rtl_buffer():
for ii in range(num_channels):
sig[ii].next = in_p[ii] and not in_n[ii]
else:
@always_... |
def flattern_nest_arary(arr, final_res):
for i in arr:
if type(i) is list:
flattern_nest_arary(i, final_res)
else:
final_res.append(i)
return final_res
arr = [1,2,[3,4,[5]]]
final_res = []
print flattern_nest_arary(arr, final_res) |
"""
Python Interchangeable Virtual Instrument Library
Copyright (c) 2012-2017 Alex Forencich
Modified by Jeff Wurzbach 2014
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, incl... |
from cogent.parse.ct import ct_parser
__author__ = "Shandy Wikman"
__copyright__ = "Copyright 2007-2012, The Cogent Project"
__contributors__ = ["Shandy Wikman"]
__license__ = "GPL"
__version__ = "1.5.3"
__maintainer__ = "Shandy Wikman"
__email__ = "ens01svn@cs.umu.se"
__status__ = "Development"
def sfold_parser(lines)... |
"""Module that contains request parsers for the API"""
from flask_restplus import reqparse
registration_parser = reqparse.RequestParser()
registration_parser.add_argument(
'username',
required=True,
help='required and must be a string'
)
registration_parser.add_argument(
'email',
required=True,
... |
"""Media files."""
import datetime
import json
import logging
import shlex
import subprocess
import tempfile
from pathlib import Path
from misctypes import Gain
from pyutils.files import XAttrStr, move
from pyutils.misc import fmt_args
log = logging.getLogger(__name__)
def call(args):
log.info('Running: %s', ' '.jo... |
import _plotly_utils.basevalidators
class TickvalsValidator(_plotly_utils.basevalidators.DataArrayValidator):
def __init__(
self, plotly_name="tickvals", parent_name="layout.ternary.aaxis", **kwargs
):
super(TickvalsValidator, self).__init__(
plotly_name=plotly_name,
pare... |
from sys import version_info
if version_info >= (2,6,0):
def swig_import_helper():
from os.path import dirname
import imp
fp = None
try:
fp, pathname, description = imp.find_module('_display_driver', [dirname(__file__)])
except ImportError:
import _dis... |
import pytest
from io import StringIO
import pandas as pd
from numpy import allclose, array_equal, int32
from collections import namedtuple
from epic.windows.count.count_reads_in_windows import (
count_reads_in_windows, _count_reads_in_windows_paired_end)
@pytest.mark.integration
def test_count_reads_in_windows(exp... |
import os
import sys
import platform
import json
from setuptools import setup, Command
from setuptools.command.egg_info import egg_info
from subprocess import check_call
from distutils import log
sys.path.append(os.path.dirname(__file__))
import versioneer
here = os.path.dirname(os.path.abspath(__file__))
project_root ... |
from __future__ import unicode_literals
from flask import current_app, g
from indico.modules.events.papers.controllers import api, display, management, paper, templates
from indico.web.flask.wrappers import IndicoBlueprint
_bp = IndicoBlueprint('papers', __name__, url_prefix='/event/<confId>', template_folder='template... |
import glob
import subprocess
if __name__ == '__main__':
'''
Add lightcurves
MOS1 + MOS2 = MOSS
PN + MOSS = EPIC
'''
mos1files = glob.glob('mos1_lc_net*')
mos2files = glob.glob('mos2_lc_net*')
pnfiles = glob.glob('pn_lc_net*')
mos1files.sort()
mos2files.sort()
pnfiles.sort()
... |
import pytest
from requester.utils import (
make_host, make_request_url, make_dumy_body, make_ellipsis
)
class TestMakeHost(object):
@pytest.mark.parametrize("headers, dst_ip, expected", [
({}, "8.8.8.8", "8.8.8.8"),
({"Host":"http://test.com"}, "8.8.8.8", "http://test.com"),
... |
import sympy as sp
v_max = sp.Symbol('v_max') # maximum flow speed
r = sp.Symbol('r') # radius (variable)
R = sp.Symbol('R') # tube diameter (inner)
k = sp.Symbol('k') # experimental parameter
vr_turb = v_max * (1-r/R)**(1/k)
Q_turb = ( ... |
"""
Created on Thu Aug 10 14:24:01 2017
@author: lewismoffat
"""
import dataProcessing as dp
import sklearn as sk
import numpy as np
from sklearn.svm import SVC
from sklearn.model_selection import GridSearchCV
from sklearn.model_selection import train_test_split
from sklearn.metrics import classification_report
from sk... |
import numpy
import pickle
class fully_connected_layer:
def __init__(self, num_of_input, num_of_output, w, b):
self.input_size = num_of_input
self.output_size = num_of_output
self.weights = numpy.random.randn(self.output_size, self.input_size)
self.bias = numpy.zeros(self.output_size... |
"""
Data To Payments Table
"""
from common import *
year = "2017"
Y = year
months = []
dates = {} # OrderedDict() ?
for unit, fields in data.items():
if "payments" in fields:
for M, V in fields["payments"][year].items():
M = int(M) if M.isnumeric() else 0
if M not in months:
... |
from webapp.libapp.models import Base
from webapp.libapp.models.model_base import ModelBase
from sqlalchemy import Column
from sqlalchemy import String
from sqlalchemy import Integer
from sqlalchemy import DateTime
from sqlalchemy import Boolean
from sqlalchemy import SmallInteger
import datetime
class UserAccount(Base... |
"""
Pauses the game and shows a dialog box with text in it.
"""
from gamestate import State
import ui
import assets
import statemgr
class DialogState(State):
def __init__(self):
super(DialogState, self).__init__()
self.old_state_name = ""
self.old_state = None
self.image = assets.get... |
from distutils.core import setup
setup(
author='Mika Eloranta',
author_email='mel@ohmu.fi',
description='multi-host shell helper',
name='sshh',
packages=['sshh'],
scripts=['scripts/sshh'],
url='https://github.com/melor/sshh',
version='1',
) |
import unittest
import time
from app import create_app, db
from app.models import User, AnonymousUser, Role, Permission
class UserModelTestCase(unittest.TestCase):
def setUp(self):
self.app = create_app('testing')
self.app_context = self.app.app_context()
self.app_context.push()
db.c... |
from __future__ import unicode_literals
import datetime
import threading
from . import album
from . import artist
from . import dispatch
from . import listener
from . import request
from . import schedule
from . import song
pre_sync = dispatch.Signal()
post_sync = dispatch.Signal()
class RainwaveChannel(dict):
"""A... |
from azure.cli.core.commands.parameters import (location_type, get_enum_choices)
from azure.cli.core.commands import register_cli_argument
from azure.mgmt.iothub.models.iot_hub_client_enums import IotHubSku
register_cli_argument('iot hub create', 'name', options_list=('--name', '-n'),
help='Name f... |
from datatools import transformations
from matplotlib import pyplot as plt
import numpy as np
x = np.arange(0, 2*np.pi, .01)
y = np.arange(0, 2*np.pi, .01)
X, Y = np.meshgrid(x, y)
noise = 2 * np.random.random(X.shape) - 1
big_wave = np.sin(2 * X)
small_wave = .3*np.sin(10*Y)
Z = big_wave + small_wave + noise
Z /= Z.ma... |
import logging
import os
from django.views.generic import View
from django.http import HttpResponse
from django.conf import settings
from django.utils.decorators import method_decorator
from django.views.decorators.csrf import ensure_csrf_cookie
class FrontendAppView(View):
"""
Serves the compiled frontend entr... |
"""
This module contains all hosts related pepperstack commands
"""
from pepperstack.models import Host
from pepperstack.utils.format import title, indent, pretty_print
from pepperstack.utils.exceptions import DoesNotExistsException
from .mixins import CommandMixin
class host_list(CommandMixin):
"""
List all ho... |
from __future__ import unicode_literals
from django.test import TestCase
from django.test.utils import override_settings
from django.db import connection
from .models import Auther, Book
class TestAuthor(TestCase):
def setUp(self):
auth = Auther(name='zhangqian', age='23')
auth.save()
book =... |
from django.conf.urls import patterns, include, url
from django.contrib import admin
import others.urls
import teaching.urls
import customuser.urls
import exercises.urls
urlpatterns = patterns('',
url(r'^admin/', include(admin.site.urls)),
) + others.urls.urlpatterns + teac... |
import turtle
loadWindow = turtle.Screen()
turtle.speed(2)
for i in range(100):
turtle.circle(5*i)
turtle.circle(-5*i)
turtle.left(i)
turtle.exitonclick() |
import os
import sys
sys.path.insert(0, os.path.abspath(
os.path.join(os.path.dirname(__file__), '..')))
import ditDahReader |
import json
import requests
import unittest
import Utilities
class TestManejarPerfil(unittest.TestCase):
usuariosParaBorrar = []
def tearDown(self):
Utilities.borrarUsuarios(self.usuariosParaBorrar)
def compararJsons(self, perfilEsperado,perfilPedido, key):
self.assertEqual(perfilEsperado[ke... |
from typing import Union, Optional
from requests_oauthlib import OAuth1
from dateparser import parse
from datetime import timedelta
from CommonServerPython import *
requests.packages.urllib3.disable_warnings()
''' GLOBALS/PARAMS '''
BASE_URL = demisto.getParam('url').rstrip('/') + '/'
API_TOKEN = demisto.getParam('APIt... |
from __future__ import unicode_literals
from pybtex.style.names import BaseNameStyle, name_part
from pybtex.style.template import join
class NameStyle(BaseNameStyle):
def format(self, person, abbr=False):
r"""
Format names similarly to {vv~}{ll}{, jj}{, f.} in BibTeX.
>>> from pybtex.databas... |
import _plotly_utils.basevalidators
class YpadValidator(_plotly_utils.basevalidators.NumberValidator):
def __init__(
self, plotly_name="ypad", parent_name="layout.coloraxis.colorbar", **kwargs
):
super(YpadValidator, self).__init__(
plotly_name=plotly_name,
parent_name=pa... |
"""
Utility methods
@author: Chris Scott
"""
from __future__ import print_function
from __future__ import absolute_import
from __future__ import unicode_literals
from __future__ import division
import os
import sys
import random
import string
import glob
import subprocess
import tempfile
import logging
import pkg_resou... |
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
("app", "0002_auto_20150705_0343"),
]
operations = [
migrations.AlterField(
model_name="sourceline",
name="kind",
field... |
from . import _main as main
main() |
"""
drollerbot
~~~~~~~~~~
DRollerBot is a simple Discord bot that rolls polyhedral
dice.
:copyright: (c) 2017 by Sean Callaway.
:license: MIT, see LICENSE for more details.
"""
from .bot import thebot |
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('tasks', '0002_auto_20150920_0134'),
]
operations = [
migrations.AddField(
model_name='task',
name='details',
field=mo... |
from __future__ import unicode_literals
import pytest # noqa
import os
from textx import metamodel_from_str, metamodel_from_file
grammar = """
First:
'first' seconds+=Second
;
Second:
value=INT
;
"""
def test_textx_metaclass_repr():
"""
Test metaclass __repr__
"""
metamodel = metamodel_from_str... |
"""
Django settings for {{ project_name }} project.
For more information on this file, see
https://docs.djangoproject.com/en/dev/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/dev/ref/settings/
Quick-start development settings - unsuitable for production, see
http... |
"""
Model tests for Workflow
"""
from __future__ import unicode_literals
import sys
import datetime
from django.contrib.auth.models import User
from django.test.client import Client
from django.test import TestCase
from workflow.models import Workflow, State, Transition, WorkflowActivity, WorkflowHistory
class ModelTes... |
import time
from django.http import HttpResponse
import redis
from fserver.models import *
log = logging.getLogger(__name__)
class Writer(object):
def __init__(self, input):
self.input = input
self.csv = input.split(',')
def is_correct_input(self):
if System.objects.get_by_name_and_versi... |
from toee import *
def OnBeginSpellCast(spell):
print "Blessed Aim OnBeginSpellCast"
print "spell.target_list=", spell.target_list
print "spell.caster=", spell.caster, " caster.level= ", spell.caster_level
def OnSpellEffect(spell):
print "Blessed Aim OnSpellEffect"
targetsToRemove = []
spell.dur... |
"""
Created on Thu May 29 13:31:02 2014
@author: Seth King
"""
import pygame
from time import sleep
from PodSixNet.Connection import connection, ConnectionListener
from pygame.locals import QUIT, MOUSEBUTTONDOWN
from operator import attrgetter
NOT_TURN = -1
DRAW_CARD = 1
SPREAD_DISCARD = 2
BG_COLOR = (0, 176, 0)
FG_COL... |
joshuaname = "Joshua"
joshuaageyears = 14.65
joshuaheightmeters = 1.8034
sideofsquare = 5.0
widthrectangle = 78.0
heghtrectangle = 20
months = 12.0
ageinmonths = months * joshuaageyears
ageinmonths
yearsold = 14.65
averageageofdeath = 71.0
yearsleft = averageageofdeath - yearsold
yearsleft
winkyface = ";)"
tenthousandw... |
from setuptools import setup, find_packages
setup(name='MODEL8236480549',
version=20140916,
description='MODEL8236480549 from BioModels',
url='http://www.ebi.ac.uk/biomodels-main/MODEL8236480549',
maintainer='Stanley Gu',
maintainer_url='stanleygu@gmail.com',
packages=find_packages()... |
from django.db import migrations, models
import django.utils.timezone
class Migration(migrations.Migration):
dependencies = [
('ancfinder_site', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name='anc',
name='pub_date',
field=models.DateTi... |
"""
Test cases for L{twisted.names.client}.
"""
from twisted.names import client, dns
from twisted.names.error import DNSQueryTimeoutError
from twisted.trial import unittest
from twisted.names.common import ResolverBase
from twisted.internet import defer, error
from twisted.python import failure
from twisted.python.dep... |
import os
import shutil
from thlib.side.Qt import QtWidgets as QtGui
from thlib.side.Qt import QtGui as Qt4Gui
from thlib.side.Qt import QtCore
from thlib.environment import env_inst, env_tactic, cfg_controls, env_read_config, env_write_config, dl
import thlib.global_functions as gf
import thlib.tactic_classes as tc
fr... |
"""Exception and error handling.
This contains the core exceptions that the implementations should raise
as well as the IActiveScriptError interface code.
"""
import sys, traceback
from win32com.axscript import axscript
import winerror
import win32com.server.exception
import win32com.server.util
import pythoncom
impo... |
import pickle
import numpy as np
import tensorflow as tf
import random as random
import json
from keras import backend as K
from keras.preprocessing.sequence import pad_sequences
from keras.layers import Input, Lambda, GRU
from keras.layers import Embedding
from keras.models import Model
from embeddings import KazumaCh... |
"""
The collection of iDevices available
"""
from exe.engine import persist
from exe.engine.idevice import Idevice
from exe.engine.field import TextAreaField, FeedbackField
from nevow.flat import flatten
import imp
import sys
import logging
log = logging.getLogger(__name__)
class IdeviceStore:
"""... |
from seecr.test import SeecrTestCase, CallTrace
from meresco.distributed import ServiceManagement
from weightless.core import consume
class ServiceManagementTest(SeecrTestCase):
def testMakeUpdateIps(self):
component = CallTrace()
updateIps = ServiceManagement(reactor=None, admin=('host', 1234), con... |
from __future__ import print_function
import sys
import os
import posixpath
import json
import re
import conftree
import cmdtalkplugin
from upmplgutils import *
import tidalapi
from tidalapi.models import Album, Artist
from tidalapi import Quality
from routing import Plugin
plugin = Plugin('')
dispatcher = cmdtalkplugi... |
def main():
seq=range(11)
from math import pi
seq2=[(x,x*2) for x in seq]
seq3=[round(pi,i) for i in seq]
seq4={x:x**2 for x in seq}
print(seq)
print(seq2)
print(seq3)
print(seq4)
if __name__ == '__main__':
main() |
import sys
sys.path.append('D:\Dropbox\Code\Python\loggers')
from loggers.ecust_logger import *
url = 'http://172.20.13.100/cgi-bin/srun_portal'
ecust_logger = EcustCampusLogger(url)
if os.path.exists('./ecust.log'):
os.remove('./ecust.log')
ecust_logger.login_campus() |
'''
Bubbles Addon
Copyright (C) 2016 Viper2k4
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) any later version.
This p... |
from runner.koan import *
class AboutIteration(Koan):
def test_iterators_are_a_type(self):
it = iter(range(1, 6))
fib = 0
for num in it:
fib += num
self.assertEqual(15, fib)
def test_iterating_with_next(self):
stages = iter(['alpha', 'beta', 'gamma'])
... |
from __future__ import absolute_import, print_function
from mercurial import (
hg,
)
def testparse(url, branch=[]):
print('%s, branches: %r' % hg.parseurl(url, branch))
testparse('http://example.com/no/anchor')
testparse('http://example.com/an/anchor#foo')
testparse('http://example.com/no/anchor/branches', bran... |
__author__ = 'khrotan'
import subprocess
import os
from subprocess import PIPE
def cmd_output(args, **kwds):
kwds.setdefault("stdout", subprocess.PIPE)
kwds.setdefault("stderr", subprocess.STDOUT)
p = subprocess.Popen(args, **kwds)
return p.communicate()[0]
partition="/dev/sdb2"
def format(partition):
outpu... |
"""Unit tests for Basefile class."""
import os
import shutil
import re
import string
import unittest
from test import assertEquals, testRoot, testDataPath
caseOneFile = os.path.join( testDataPath , 'basefile' , 'list1.txt' )
caseTwoFile = os.path.join( testDataPath , 'basefile' , 'list2.txt' )
scratchFile = os.pa... |
scale = 16
num_of_bits = 4
var = raw_input("Segfault error number?: ")
my_bindata = bin(int(var, scale))[2:].zfill(num_of_bits)
print my_bindata
my_hexdata = int(var)
print "protection fault" if my_hexdata&1 != 0 else "no page found"
print "write access" if my_hexdata&2 != 0 else "read access"
print "user-mode access" ... |
'''
This simulation takes in 5 parameters: protocol, N, p, R, T (and seeds)
First is protocol name, N is number of stations (20), p is frame generation probability for each node (<=0.04), R is total number of slots that need to be simulated (50000), T is number of trials (5)
'''
import random
'''
and if the random numb... |
# ----------------------------------------------------------------------------
# "THE BEER-WARE LICENSE" (Revision 42):
# @tantrumdev wrote this file. As long as you retain this notice you
# can do whatever you want with this stuff. If we meet some day, and you think
# this stuff is worth it, you can buy me a bee... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import numpy as np
import abel
import os
from glob import glob
import scipy
from scipy.special import eval_legendre
from scipy import ndimage
_linbasex_parameter_docstring... |
import types
import sys
from spacewalk.common.stringutils import to_string
from spacewalk.server import rhnSQL
from spacewalk.server.importlib import channelImport, packageImport, errataImport, \
kickstartImport, importLib
import diskImportLib
import xmlSource
import string # pylint: disable=W0402
import syncCache
... |
room_texts_filename = "room_texts.yaml"
from sys import exit
try:
import yaml
except ImportError:
print ("**Error: failed to import yaml module. Please install Python yaml module.**")
def what():
print "I do not understand."
def get_choice():
return raw_input("> ")
def dead(reason):
print reason
... |
import urllib
import urllib2
import re
class Tool:
# 去除img标签,7位长空格
removeImg = re.compile('<img.*?>| {7}|')
# 删除超链接标签
removeAddr = re.compile('<a.*?>|</a>')
# 把换行的标签换为\n
replaceLine = re.compile('<tr>|<div>|</div>|</p>')
# 将表格制表<td>替换为\t
replaceTD = re.compile('<td>')
# 把段落开头换为\n加空两格... |
import urllib
import re
import rb
artist_match = 0.8
title_match = 0.5
try:
from xml.etree import cElementTree
except:
import cElementTree
class LeoslyricsParser(object):
def __init__(self, artist, title):
self.artist = artist
self.title = title
def search(self, callback, *data):
artist = urllib.quote(self.ar... |
import subprocess,sys
import shapefile
import numpy as np
import matplotlib.pyplot as plt
fc='../lines/Coastline_SP_500.i2s'
fs='../lines/Oceanline_South.i2s'
fe='../lines/Oceanline_East.i2s'
fn='../lines/Oceanline_North.i2s'
coastline = np.genfromtxt(fc,skip_header=18,delimiter=" ")
southline = np.genfromtxt(fs,skip_h... |
__author__ = 'Régis FLORET'
import hashlib
import time
from tornado.web import authenticated
import private_settings
from App.models.email import EmailModel
from App.models.preference import PreferenceModel
from App.models.user import UserModel
from App.utils.email import is_email
from App.utils.email import send_mail
... |
from freeze_database import *
from neo_writer import * |
__author__ = 'Andy Gallagher <andy.gallagher@theguardian.com>'
from .vs_item import VSItem
from .vidispine_api import InvalidData
import urllib.request, urllib.parse, urllib.error
import xml.etree.ElementTree as ET
import logging
import os
from traceback import format_exc
import re
class InvalidItemReferenceError(Excep... |
import smtplib
gmail_user = "vinodkgupta96@gmail.com"
gmail_pwd = "123@vision"
TO = 'b13226@students.iitmandi.ac.in;b13141@students.iitmandi.ac.in'
SUBJECT = "Design xcbjvjbkl PROJECT TEST"
TEXT = "Testing sending mail using gmail servers"
server = smtplib.SMTP('smtp.gmail.com', 587)
server.ehlo()
server.starttls()
ser... |
import numpy
import math
import collections
from array import array
class DataMagazineClass():
def __init__(self,str_name,queuelength):
self.m_n = 0
self.m_data = collections.deque([],queuelength)
self.m_queuelength = queuelength
self.m_name = str_name
... |
import numpy as np
import h5py
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
import matplotlib.animation as animation
from progress_lib import progress_bar_init
import os
import time
import re
import argparse
parser = argparse.ArgumentParser(description='Creates a gif movie from the nbody simu... |
from django.test import TestCase
class LoginTestCase(TestCase):
def test_login(self):
# First check for the default behavior
response = self.client.get('/admin/')
self.assertRedirects(response, '/admin/login/?next=/admin/') |
from twisted.internet import threads
from config import config
from enigma import eDBoxLCD, eTimer, iPlayableService
import NavigationInstance
from Tools.Directories import fileExists
from Components.ParentalControl import parentalControl
from Components.ServiceEventTracker import ServiceEventTracker
from Components.Sy... |
"""
example_seismic
---------------
Shows the various ways to input seismic models
(:math:`V_s, V_p, V_{\\phi}, \\rho`) as a
function of depth (or pressure) as well as different velocity model libraries
available within Burnman:
1. PREM :cite:`dziewonski1981`
2. STW105 :cite:`kustowski2008`
3. AK135 :cite:`kennett1995`... |
import psycopg2
import time
import datetime
import os
import os.path
import threading
import re
import signal
import sets
import logging
logger = logging.getLogger("processor")
import socorro.database.schema as sch
import socorro.lib.util
import socorro.lib.threadlib
import socorro.lib.ConfigurationManager
import socor... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.