repo_name stringlengths 5 104 | path stringlengths 4 248 | content stringlengths 102 99.9k |
|---|---|---|
CompBio-TDU-Japan/nsdm | nsdm/seq.py | #!/usr/bin/env python3
from . import fileparse
import re
import math
class Ref:
def __init__(self, reference_file):
self.seq = fileparse.reference_read(reference_file)
def cut(self):
x = self.variant[0]
start = 0
end = 0
if isinstance(x.start, str):
start ... |
letuananh/intsem.fx | test/test_lexsem.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Script for testing lexem module
"""
# This code is a part of coolisf library: https://github.com/letuananh/intsem.fx
# :copyright: (c) 2014 Le Tuan Anh <tuananh.ke@gmail.com>
# :license: MIT, see LICENSE for more details.
import unittest
import logging
from texttag... |
sidchilling/roirocket-revenue-report | roirocket/roirocket.py | '''roirocket: Python library to exctract revenue data from ROI Rocket for a publisher
'''
__version__ = '1.0'
__author__ = 'Siddharth Saha (sidchilling@gmail.com)'
import requests
from BeautifulSoup import BeautifulSoup
class ROIRocket(object):
URL = 'http://tracking.roirocket.com/affiliates/api/2/reports.asmx/... |
imvu/bluesteel | app/logic/bluesteelworker/tests/tests_WorkerModel.py | """ Worker Model tests """
from django.test import TestCase
from django.conf import settings
from django.contrib.auth.models import User
from django.utils import timezone
from django.utils.six import StringIO
from app.logic.bluesteelworker.models.WorkerModel import WorkerEntry
from datetime import timedelta
import os
... |
jaraco/aspen | aspen/http/resource.py | from .response import Response
from ..simplates import Simplate, SimplateDefaults, SimplateException
class Static(object):
"""Model a static HTTP resource.
"""
def __init__(self, website, fspath, raw, media_type):
self.website = website
self.raw = raw
self.media_type = media_type
... |
linovia/zumo-toolbox | python/demo.py | from struct import pack, unpack
import serial
import time
import logging
from datetime import datetime
PORT = "/dev/cu.usbmodem1421"
logger = logging.getLogger(__name__)
arduino = serial.Serial(PORT, 115200, timeout=1)
# arduino = serial.Serial(PORT, 9600, timeout=1)
time.sleep(5) # give the connection a second to ... |
dabura667/electrum | lib/storage.py | #!/usr/bin/env python
#
# Electrum - lightweight Bitcoin client
# Copyright (C) 2015 Thomas Voegtlin
#
# 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... |
AllanXiang/news-media-promoted | util.py | # -*- coding: utf-8 -*-
import datetime
import time
import os
def StopWords():
"""
load stopwords from file(conf/StopWords.txt)
"""
stopwords = []
fp_stopwords =open('conf/StopWords.txt', 'r')
for line in fp_stopwords:
stopwords.append(line.strip())
fp_stopwords.close()
return s... |
epol/limestonedb-worker | preprocessing.py | #!/usr/bin/python3
# -*- coding: utf-8 -*-
"""
Preprocessing program
This program will:
- check if there are a new file to process (not implemented yet)
- process the file getting informations (not implemented yet)
- move the file to the proper directory (not implemented yet)
"""
# preprocessing.py
# This file is p... |
AdinoyiSadiq/back-office-tool | baseState.py | def initialState():
state = {
'carpets':{
'carpet1': {
'name': 'Floral Rug',
'image': 'https://images.konga.com/v2/media/catalog/product//H/N/HNKG-Brown-and-Blue-Floral-Rug---150x230-cm-7530162_1.jpg?h=400&w=400&scale_mode=aspect_fit',
'desc': 'The Hong Kong 33L Brown/Blue is a hand tufted acrylic ru... |
rehabradio/radiobabel | tests/test_spotify.py | # future imports
from __future__ import absolute_import
from __future__ import print_function
from __future__ import unicode_literals
# stdlib imports
import unittest
# local imports
from radiobabel import SpotifyClient
from radiobabel.errors import TrackNotFound
from radiobabel.test_utils import load_config
class ... |
arnonhecht/knesset-data-pipelines | datapackage_pipelines_knesset/committees/processors/parse_committee_meeting_attendees.py | from datapackage_pipelines_knesset.common.processors.base_processor import BaseProcessor
from knesset_data.protocols.committee import CommitteeMeetingProtocol
from datapackage_pipelines_knesset.common import object_storage
from datapackage_pipelines_knesset.common import db
class ParseCommitteeMeetingAttendeesProcess... |
diego-d5000/MisValesMd | env/lib/python2.7/site-packages/django/contrib/gis/db/backends/base/adapter.py | class WKTAdapter(object):
"""
This provides an adaptor for Geometries sent to the
MySQL and Oracle database backends.
"""
def __init__(self, geom):
self.wkt = geom.wkt
self.srid = geom.srid
def __eq__(self, other):
if not isinstance(other, WKTAdapter):
... |
reubano/changanya | changanya/nilsimsa.py | # -*- coding: utf-8 -*-
# vim: sw=4:ts=4:expandtab
"""
Implementation of Nilsimsa hashes (signatures) in Python.
Most useful for filtering spam by creating signatures of documents to
find near-duplicates. Charikar similarity hashes can be used on any
datastream, whereas Nilsimsa is a digest ideal for documents (writt... |
piotrsobecki/opt | opt/feature_selection/genetic.py | import json, csv
import array, random, pandas as pd
from sklearn.model_selection import StratifiedKFold
from sklearn.model_selection import cross_val_predict, cross_val_score
from opt.genetic import GeneticOptimizer, GeneticConfiguration, LogHelper
from deap import creator, base, tools
class GeneticLogHelper(LogHelp... |
Azure/azure-sdk-for-python | sdk/containerservice/azure-mgmt-containerservice/setup.py | #!/usr/bin/env python
#-------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#----------------------------------------------------------------... |
martinohanlon/BlueDot | docs/conf.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# bluedot documentation build configuration file, created by
# sphinx-quickstart on Mon Mar 27 21:11:18 2017.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# au... |
artopping/nyu-python | course2/npd_c2_a3/redo_classes.py | #!/usr/bin/env python3
import sys
import math
#class Shape:
# def __init__(self, name):
class Triangle:
"""equilateral triangle class"""
def __init__(self, name):
"""creating triangle"""
self.name= name
self.shape_type ='Triangle'
#self.edge_length=2
self.tr... |
hdk5/cosinus | plugins/rasp/rasp_a.py | import datetime
rasp_t = [
# 0
{"start": datetime.time(hour=8, minute=0 ),
"end" : datetime.time(hour=9, minute=30)},
# 1
{"start": datetime.time(hour=9, minute=50),
"end" : datetime.time(hour=11, minute=20)},
# 2
{"start": datetime.time(hour=11, minute=40),
"end" : datetime.time(hour=13, mi... |
fhcrc/nestly | examples/adcl/00make_nest.py | #!/usr/bin/env python
# This example compares runtimes of two implementations of
# an algorithm to minimize the average distance to the closest leaf
# (Matsen et. al., accepted to Systematic Biology).
#
# To run it, you'll need the `rppr` binary on your path, distributed as part of
# the pplacer suite. Source code, or... |
JoshuaMichaelKing/MyLearning | learn-python2.7/language basis/Rational.py | def gcd(a, b):
if b == 0:
return a
return gcd(b, a % b)
class Rational(object):
def __init__(self, p, q):
self.p = p
self.q = q
def __add__(self, r):
return Rational(self.p * r.q + self.q * r.p, self.q * r.q)
def __sub__(self, r):
return Rational(self.p * ... |
mjwestcott/projecteuler | python/problem76.py | """
problem76.py
https://projecteuler.net/problem=76
It is possible to write five as a sum in exactly six different ways:
4 + 1
3 + 2
3 + 1 + 1
2 + 2 + 1
2 + 1 + 1 + 1
1 + 1 + 1 + 1 + 1
How many different ways can one hundred be written as a sum of at least two positive integers?
"""
from to... |
jyr/opentumblr-ce | opentumblr/quote.py | import ppygui as gui
from tumblr import Api
class Quote(gui.CeFrame):
def __init__(self, api):
self.api = api
gui.CeFrame.__init__(self, title="Opentumblr CE")
self.l_quote = gui.Label(self, "Add a Quote", align = "center")
self.l_title = gui.Label(self, "Quote")
self.tc_title = gui.Edit(self, multiline... |
mozillazg/chendian-plus | chendian/chendian/settings.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import absolute_import, print_function, unicode_literals
"""
Django settings for chendian project.
For more information on this file, see
https://docs.djangoproject.com/en/1.7/topics/settings/
For the full list of settings and their values, see
https://do... |
tiborsimon/projects | projects/gui/project_selector.py | import re
class ProjectSelector(object):
def __init__(self, data, normal, highlighted, selected):
self.data = data
self.keys = ''
self.focus = 0
self.last_selection_result = _filter_data(self.keys, self.data)
self.normal = normal
self.highlighted = highlighted
... |
vedran6/brainvault | aespython/ofb_mode.py | #!/usr/bin/env python
"""
OFB Mode of operation
Running this file as __main__ will result in a self-test of the algorithm.
Algorithm per NIST SP 800-38A http://csrc.nist.gov/publications/nistpubs/800-38a/sp800-38a.pdf
Copyright (c) 2010, Adam Newman http://www.caller9.com/
Licensed under the MIT license http://www.o... |
LynnHo/AttGAN-Tensorflow | tflib/layers/layers_slim.py | # functions compatible with tensorflow.contrib
import six
import tensorflow as tf
from tensorflow.contrib.framework.python.ops import add_arg_scope
from tensorflow.contrib.framework.python.ops import variables
from tensorflow.contrib.layers.python.layers import initializers
from tensorflow.contrib.layers.python.laye... |
evilchili/cotton | fabfile/postfix/__init__.py | from fabric.api import task, env
from .. import system
__all__ = ['install']
@task
def install(relay=None):
"""
Deploy postfix for outbound SMTP
"""
if relay is None:
relay = env.smtp_relay
# set the mailer type
system.sudo('debconf-set-selections <<< "postfix postfix/main_mailer_ty... |
emanuelschuetze/OpenSlides | openslides/utils/projector.py | """
General projector code.
Functions that handel the registration of projector elements and the rendering
of the data to present it on the projector.
"""
from typing import Any, Callable, Dict, List
from .cache import element_cache
AllData = Dict[str, Dict[int, Dict[str, Any]]]
ProjectorSlide = Callable[[AllData... |
parksandwildlife/wastd | shared/tests.py | # -*- coding: utf-8 -*-
"""Shared test cases."""
from django.test import TestCase
from shared.utils import force_as_list, sanitize_tag_label, BigIntConverter
class UtilsTests(TestCase):
"""Tests for shared.utils."""
def test_force_as_list(self):
self.assertEqual(force_as_list({}), [])
self.a... |
chihongze/girlfriend | girlfriend/workflow/builder/__init__.py | # coding: utf-8
import types
from girlfriend.workflow.gfworkflow import (
Workflow,
Context
)
from girlfriend.util.lang import ObjDictModel
from girlfriend.util.config import Config
from girlfriend.plugin import plugin_mgr
class WorkflowBuilder(object):
def __init__(self):
self._clazz = Workflow
... |
Affirm/pyrollbar | rollbar/test/flask_tests/test_flask.py | """
Tests for Flask instrumentation
"""
import json
import sys
import os
import mock
import rollbar
from rollbar.test import BaseTest
# access token for https://rollbar.com/rollbar/pyrollbar
TOKEN = '92c10f5616944b81a2e6f3c6493a0ec2'
# Flask doesn't work on python 3.2, so don't test there.
ALLOWED_PYTHON_VERSION =... |
microamp/atombook | market_rent.py | # -*- coding: utf-8 -*-
"""
Auckland market rent data by district
"""
from functools import partial
import pandas as pd
from lib import pipe, rename, set_index, add_suffix, merge_dfs
if __name__ == "__main__":
columns = ("Auckland",
"Franklin District",
"Manukau",
"... |
jblukach/AutopsyModules | FileMarker/FileMarker.py | import jarray
import inspect
from java.lang import System
from java.util.logging import Level
from org.sleuthkit.datamodel import SleuthkitCase
from org.sleuthkit.datamodel import AbstractFile
from org.sleuthkit.datamodel import ReadContentInputStream
from org.sleuthkit.datamodel import BlackboardArtifact
from org.sleu... |
JesusMtnez/devexperto-challenge | jesusmtnez/python/koans/koans/about_comprehension.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from runner.koan import *
class AboutComprehension(Koan):
def test_creating_lists_with_list_comprehensions(self):
feast = ['lambs', 'sloths', 'orangutans', 'breakfast cereals',
'fruit bats']
comprehension = [delicacy.capitalize() for de... |
NESCent/phylocommons | phylocommons/wsgi.py | """
WSGI config for phylocommons project.
This module contains the WSGI application used by Django's development server
and any production WSGI deployments. It should expose a module-level variable
named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover
this application via the ``WSGI_APPLICATI... |
alphagov/notifications-admin | app/main/views/send.py | import itertools
from string import ascii_uppercase
from zipfile import BadZipFile
from flask import (
abort,
current_app,
flash,
redirect,
render_template,
request,
session,
url_for,
)
from flask_login import current_user
from notifications_python_client.errors import HTTPError
from no... |
lfsimoes/mars_express__esn | echo_state_networks.py | """
----------------------------------------------------------------------------
Echo State Networks
Luis F. Simoes, 2016-07-29
----------------------------------------------------------------------------
Implemented following the specifications in:
[1] Jaeger, H. (2007). Echo state network. Scholarpedia, ... |
jwinzer/openslides-proxyvoting | openslides_proxyvoting/signals.py | from django.contrib.auth.models import Permission
from django.contrib.contenttypes.models import ContentType
from openslides.users.models import Group
def add_permissions_to_builtin_groups(**kwargs):
"""
Adds the permissions openslides_proxyvoting.can_manage to the group staff.
"""
content_type = Con... |
WhatIsHeDoing/DidYouKnow | python/main.py | """ demonstrating some great Python features via unit tests """
from functools import partial
import operator
import os
import tempfile
import unittest
class testRandomFeatures(unittest.TestCase):
""" testing random language features """
def testMultipleAssignent(self):
""" tests the shorthand syntax ... |
mcrisc/lexdecomp | tools/text2numpy.py | import argparse
import re
import os
from pathlib import Path
from multiprocessing import Process
import numpy as np
# ensures Python 3.x
assert sys.version_info >= (3, 0)
RE_COORD = re.compile(r'-?\d+\.\d+')
def process_batch(data_file, dimension, start, batch_size):
done = 0
vocab_file = 'vocabulary-%05... |
dmitry-izmerov/Udacity-Intro-to-computer-science | Cumulative Practice Problems/Longest Repetition.py | __author__ = 'demi'
# Question 8: Longest Repetition
# Define a procedure, longest_repetition, that takes as input a
# list, and returns the element in the list that has the most
# consecutive repetitions. If there are multiple elements that
# have the same number of longest repetitions, the result should
# be the o... |
lmregus/Portfolio | python/design_patterns/env/lib/python3.7/site-packages/parso/__init__.py | r"""
Parso is a Python parser that supports error recovery and round-trip parsing
for different Python versions (in multiple Python versions). Parso is also able
to list multiple syntax errors in your python file.
Parso has been battle-tested by jedi_. It was pulled out of jedi to be useful
for other projects as well.... |
bejmy/backend | bejmy/transactions/migrations/0003_auto_20170605_2033.py | # -*- coding: utf-8 -*-
# Generated by Django 1.11.1 on 2017-06-05 20:33
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('transactions', '0002_auto_20170605_2029'),
]
operations = [
migrations.Alte... |
kgoba/roombreak | master/tsbtool.py | #!/usr/bin/env python
import argparse
import logging
import serial
import struct
import rs485
import time
import sys
import os
from bus import CRC
from bus import Bus
class TSB:
N_RETRIES = 5
INFO_SIZE = 2*8
CONFIRM = '!'
REQUEST = '?'
CMD_RD_FLASH = 'f'
CMD_WR_FLASH = 'F'
... |
mikebthun/aws_cleaners | launch_config_cleaner.py | #!/usr/bin/python -tt
import sys,getopt
import commands
import json
import time
import dateutil.parser
import calendar
def help():
print " Usage: launch_config_cleaner.py --filter TEXT-MATCH-AWS-SEARCH [--help] "
def main(argv):
search_filter=None
# make sure command line arguments are valid
try:
... |
thouska/spotpy | spotpy/examples/tutorial_padds_hymod.py | # -*- coding: utf-8 -*-
'''
Copyright 2015 by Tobias Houska
This file is part of Statistical Parameter Estimation Tool (SPOTPY).
:author: Tobias Houska
This class holds example code how to use the dream algorithm
'''
import numpy as np
try:
import spotpy
except ImportError:
import sys
sys.path.append("."... |
sandersnewmedia/django-host-settings | django_host_settings/management/commands/createhostsettings.py | from django.core.management.base import BaseCommand, CommandError
from django_host_settings import get_local_settings_module
import os
class Command(BaseCommand):
args = ''
help = 'Creates a host settings file'
can_import_settings = True
def handle(self, *args, **options):
from django.conf imp... |
ThunderShiviah/digits | digits/cv.py | import data_io
from sklearn import cross_validation as cv
from sklearn import metrics
def get_score_report(clf, expected, predicted):
print("Classification report for classifier %s:\n%s\n"
% (clf, metrics.classification_report(expected, predicted)))
def get_confusion_matrix(expected, predicted):... |
benhunter/py-stuff | hackerrank/kangaroo.py | # https://www.hackerrank.com/challenges/kangaroo/problem
def kangaroo(x1, v1, x2, v2):
# (x1 + v1 * time) == (x2 + v2 * time)
# (x1 + v1 * time) - (x2 + v2 * time) == 0
#
# x1 - x2 + ((v1 - v2) * time) == 0
# x1 - x2 == ((v2 - v1) * time)
# (x1 - x2) / (v2 - v1) == time
# (x1 - x2) % (v2 - ... |
limafabio/Pythings | Chapter3/3.5/test/test_stack.py | #!/usr/bin/py
import unittest, os, sys
sys.path.append(os.path.abspath('..'))
from src.stack import Stack
class TestMethods(unittest.TestCase):
def test_init(self):
test = Stack()
self.assertNotEqual(Stack(),test)
def test_is_empty(self):
test = Stack()
self.assertTrue(test.isEmpty())
def test_push(self... |
halcyon0811/implied-volatility-smirk-trading | daily_skew.py | # -*- coding: utf-8 -*-
"""
Created on Sat Jan 07 21:46:38 2017
###########################################
### ######
### calculate Skew ######
### SKEW = VOL_OTMP-VOL_ATMC ######
### ######
########################... |
franklingu/leetcode-solutions | questions/maximum-frequency-stack/Solution.py | """
Implement FreqStack, a class which simulates the operation of a stack-like data structure.
FreqStack has two functions:
push(int x), which pushes an integer x onto the stack.
pop(), which removes and returns the most frequent element in the stack.
If there is a tie for most frequent element, the element closes... |
halexan/RouteManagement | lc_client/msg_proto_parser.py | __author__ = 'Zhang Shaojun'
import struct
import cfg
import msg_proto
# uplink message base class
class MsgUpBase(object):
def __init__(self, cc_agent):
super(MsgUpBase, self).__init__()
self.cc_agent = cc_agent
self.version = None
self.msg_type = None
self.... |
soscpd/bee | root/tests/zguide/examples/Python/wuserver.py | #
# Weather update server
# Binds PUB socket to tcp://*:5556
# Publishes random weather updates
#
import zmq
from random import randrange
context = zmq.Context()
socket = context.socket(zmq.PUB)
socket.bind("tcp://*:5556")
while True:
zipcode = randrange(1, 100000)
temperature = randrange(-80, 135)
... |
chaubold/hytra | empryonic/learning/match.py | import unittest
import numpy as np
from empryonic.tracklets import Tracklet, Tracklets
from empryonic import io as _io
import optimal_matching as _om
def idAssoc_from_trackletAssoc( assoc ):
''' Construct an id based association dict from a trackled based one.'''
ret = dict()
ret['lhs'] = dict()
ret['... |
yezooz/fserver | writer/urls.py | # The MIT License (MIT)
#
# Copyright (c) 2013 Marek Mikuliszyn
#
# 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, ... |
impiaaa/randomloadouts | makecache.py | import os, sys
import warnings
import codecs
if sys.version_info[0] < 3:
import cPickle as pickle
else:
import pickle
if sys.platform.startswith('linux'):
tf_path = os.path.expanduser("~/.local/share/Steam/SteamApps/common/Team Fortress 2/tf/resource/tf_english.txt")
elif sys.platform == 'darwin':
tf_p... |
MrMathias/wabbit_wappa | wabbit_wappa/active_learner.py | # -*- coding: utf-8 -*-
from __future__ import print_function, division, absolute_import, unicode_literals
"""
Interface for VW's active learning mode, which must be communicated with
over a socked.
Derived in great part from
https://github.com/JohnLangford/vowpal_wabbit/blob/master/utl/active_interactor.py
... |
ebewe/PrestaShop-SoColissimo-Points-Relais | docs/source/conf.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# gallery documentation build configuration file, created by
# sphinx-quickstart on Tue Jan 27 17:03:52 2015.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# au... |
projecthamster/experiments | tween_chain.py | #!/usr/bin/env python
# - coding: utf-8 -
# Copyright (C) 2010 Toms Bauģis <toms.baugis at gmail.com>
# This is intentionally slow to test how well the lib behaves on many sprites
# moving.
# It could be easily (and totally appropriately) improved by doing all the
# drawing in on_enter_frame and forgetting about sprit... |
blakev/hackustate-distributed-python | code/core.py | import re
import time
from celery import Celery
import requests
# define our celery-application
# ..make sure to include the broker!
# We also want to make sure we're storing the results.
app = Celery('tasks', broker='redis://localhost', backend='redis://localhost')
# a very simple celery task
# that will simply add t... |
rwl/puddle | puddle/workbench/workbench_action.py | #------------------------------------------------------------------------------
# Copyright (C) 2009 Richard W. Lincoln
#
# 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 restrictio... |
MCGallaspy/kolibri | kolibri/auth/test/test_models.py | """
Tests of the core auth models (Role, Membership, Collection, FacilityUser, DeviceOwner, etc).
"""
from __future__ import absolute_import, print_function, unicode_literals
from django.core.exceptions import ValidationError
from django.db.utils import IntegrityError
from django.test import TestCase
from ..constant... |
Naja2445-cmis/naja2445-cmis-cs2 | functions.py | import math
def add(a, b):
return (a + b)
add(3, 4)
def sub(a, b):
return (a - b)
sub(5, 3)
def mul(a, b):
return (a * b)
mul(4, 4)
def div(a, b):
return (a / b)
div(2, 3)
def hours_from_second(a):
return (a/3600)
hours_from_second(86400)
def circle_area(a):
return (math.pi*(a**2))
circle_area(5)
de... |
Programmica/pygtk-tutorial | codebank/treemodelfilter.py | #!/usr/bin/env python
import gtk
bugdata="""120595 NEW Custom GtkTreeModelFilter wrappers need
121339 RESO dsextras.py installation directory is incorrect
121611 RESO argument is guint, should be guint32
121943 RESO gtk.mainiteration and gtk.mainloop defeat the caller's ex...
122260 RESO Could not compile
122569 NEW ... |
dteal/dckx | dckx.py | import os
import re
import sys
import search
import requests
from PIL import Image
from PIL import ImageFont
from PIL import ImageDraw
from bs4 import BeautifulSoup
'''
# get times headlines
times_raw = requests.get('http://www.nytimes.com/').text
times_soup = BeautifulSoup(times_raw, 'lxml')
headline = times_soup.fin... |
steve-bate/openhab2-jython | Script Examples/Python/timer_example (power, variable, threading.Timer).py | """
This is an example rule that turns an outlet ON/OFF based on a power meter
using threading.Timer.
"""
from threading import Timer
from core.rules import rule
from core.triggers import when
charger_timer = None
'''
Possible timer states:
NEW - instantiated
RUNNABLE - defined
TIMED_WAITING - timer is running (slig... |
cmusatyalab/opendiamond | opendiamond/dataretriever/video_store.py | #
# The OpenDiamond Platform for Interactive Search
#
# Copyright (c) 2018 Carnegie Mellon University
# All rights reserved.
#
# This software is distributed under the terms of the Eclipse Public
# License, Version 1.0 which can be found in the file named LICENSE.
# ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS S... |
gppezzi/easybuild-framework | easybuild/toolchains/mpi/openmpi.py | ##
# Copyright 2012-2019 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://www.vscentrum.be),
# Flemish Research Foundation (F... |
soylentdeen/BlurryApple | Tools/poker.py | import scipy
import pyfits
import numpy
import sys
df = './Data/flatter.fits'
flat = pyfits.getdata(df)
#actuator = int(sys.argv[1])
for i in range(4):
flat[0][i] -= 0.01
for actuator in range(60):
flat[0][actuator] += 0.3
pyfits.writeto("Output/poked+"+str(actuator)+".fits", flat, clobber=True)
fl... |
minezy/minezy_proto | minezy_app/minezy_api/api_v1/api_names.py | from minezy_api import app
from api_common import support_jsonp, query_params, query_cache_key
from query_names import query_names
from flask import jsonify, request
from flask.ext.cache import Cache
@app.route('/1/names/', methods=['GET'])
@app.route('/1/<int:account>/names/', methods=['GET'])
@app.cache.cached(key_... |
vuteam/BlackHole-New | lib/python/Components/UsageConfig.py | from Components.Harddisk import harddiskmanager
from config import ConfigSubsection, ConfigYesNo, config, ConfigSelection, ConfigText, ConfigNumber, ConfigSet, ConfigLocations, ConfigSelectionNumber, ConfigClock, ConfigSlider, ConfigEnableDisable, ConfigSubDict, ConfigNothing, ConfigInteger, ConfigPassword, ConfigIP, C... |
jvazquez/rabbitmq-tests | sample1/receive.py | # -*- coding: utf-8 -*-
"""
Author: Jorge Omar Vazquez <jorgeomar.vazquez@gmail.com>
"""
import pika
connection = pika.BlockingConnection(pika.ConnectionParameters('localhost'))
channel = connection.channel()
# Declare a queue or the messages will be trashed
channel.queue_declare(queue='hello')
print ' [*] Waiting fo... |
CodethinkLabs/python-consonant | consonant/transaction/actions.py | # Copyright (C) 2013 Codethink Limited.
#
# 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 License, or
# (at your option) any later version.
#
# This program is distribute... |
geobricks/geobricks_metadata_manager | geobricks_metadata_manager/rest/metadata_manager_main.py | from flask import Flask
from flask.ext.cors import CORS
from geobricks_metadata_manager.config.config import config
from geobricks_metadata_manager.rest import metadata_manager_rest
import logging
# Initialize the Flask app
app = Flask(__name__)
# Initialize CORS filters
cors = CORS(app, resources={r'/*': {'origins':... |
fedora-desktop-tests/behave_common_steps | appmenu.py | # -*- coding: UTF-8 -*-
import logging
from behave import step
from dogtail.utils import doDelay, GnomeShell
# GApplication menu steps
@step(u'Open GApplication menu')
def get_gmenu(context):
config = context.app.desktopConfig
logging.debug("config = %s\nDIR:\n====\n%s", config, dir(config))
GnomeShell().... |
choldrim/jumpserver | apps/applications/api.py | # -*- coding: utf-8 -*-
#
from collections import OrderedDict
import copy
from rest_framework.generics import ListCreateAPIView
from rest_framework import viewsets
from rest_framework.views import APIView, Response
from rest_framework.permissions import AllowAny
from django.shortcuts import get_object_or_404
from res... |
pwil3058/pysm_wsm | git/gui/__init__.py | ### -*- coding: utf-8 -*-
###
### Copyright (C) 2016 Peter Williams <pwil3058@gmail.com>
###
### 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; version 2 of the License only.
###
### This pr... |
thomasowenmclean/aced | aced/backend/franktonjunction.py | from . import citations
from . import filehandling
from . import findandreplace
from . import preferences
from . import spelling as spellcheck
from . import textformatting
from . import export
from . import constantruns
from ..globals import pointers
from ..globals import settings
from ..gui import dialogs
""" Direct... |
repotvsupertuga/tvsupertuga.repository | plugin.video.plexus-streams/resources/core/parsers/arenavision-ru/main.py | # -*- coding: utf-8 -*-
"""
This plugin is 3rd party and not part of plexus-streams addon
Arenavision.ru
"""
import sys,os,requests
current_dir = os.path.dirname(os.path.realpath(__file__))
basename = os.path.basename(current_dir)
core_dir = current_dir.replace(basename,'').replace('parsers','')
sys.path.append(cor... |
dannyperry571/theapprentice | script.module.nanscrapers/lib/nanscrapers/scraperplugins/dizigold.py | import re
import urlparse
import requests
from BeautifulSoup import BeautifulSoup
from ..common import clean_title, random_agent, replaceHTMLCodes, odnoklassniki, vk
from ..scraper import Scraper
import xbmc
class Dizigold(Scraper):
domains = ['dizigold.net']
name = "dizigold"
def __init__(self):
... |
caesar0301/omnilab-misc | OmniperfTools/exWebTree.py | #!/usr/bin/env python
# Extract web trees in omniperf traces.
# Require "http_logs" file to be generated.
#
# By chenxm
#
import os
import sys
from PyOmniMisc.traffic import http
from user import User
def print_usage():
print("Usage: python exHttp.py <omniperf_trace>")
if len(sys.argv) < 2:
print_usage()
... |
BlogomaticProject/Blogomatic | opt/blog-o-matic/usr/lib/python/Bio/PDB/MMCIFParser.py | # Copyright (C) 2002, Thomas Hamelryck (thamelry@binf.ku.dk)
# This code is part of the Biopython distribution and governed by its
# license. Please see the LICENSE file that should have been included
# as part of this package.
"""mmCIF parser (partly implemented in C)."""
from string import letters
import numpy
f... |
adamfisk/littleshoot-client | server/appengine/boto/pyami/installers/ubuntu/installer.py | # Copyright (c) 2006,2007,2008 Mitch Garnaat http://garnaat.org/
#
# 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,... |
ArchaeoPY/ArchaeoPY | Filters/RTP.py | import numpy as np
# Not to be confused with functions to be used on the Windows OS
# These window functions are similar to those found in the Windows toolbox of MATLAB
# Note that numpy has a couple of Window functions already:
# See: hamming, bartlett, blackman, hanning, kaiser
def tukeywin(window_length, alpha=0.5... |
marcialhernandez/Proyecto-titulacion | Pytaxo/Modulos/Definiciones/MC_enunciadoIncompleto.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#import sys
from archivos import nombres, xmlSalida
from clases import alternativa
try:
import xml.etree.cElementTree as ET
except ImportError:
import xml.etree.ElementTree as ET
import hashlib
#Funcion que crea una nueva plantilla que corresponde a este tipo de pr... |
ashishtanwer/DFS | tcpmodels/csa00.py | from random import choice
from math import log, floor, ceil, sqrt
def model(bytes, mss, rtt, interval, p):
'''Implements the cardwell, savage, anderson infocom 2000 improvement on pftk98.'''
# assume losspr is same in forward and reverse direction
pr = pf = p
# initial syn timeout = 3.0 sec
ts = ... |
rero/reroils-app | rero_ils/modules/local_fields/jsonschemas/__init__.py | # -*- coding: utf-8 -*-
#
# RERO ILS
# Copyright (C) 2020 RERO
#
# 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, version 3 of the License.
#
# This program is distributed in the hope that... |
gcca/plaft | backend/infraestructure/xlsxwriter/chart_area.py | ###############################################################################
#
# ChartArea - A class for writing the Excel XLSX Area charts.
#
# Copyright 2013-2014, John McNamara, jmcnamara@cpan.org
#
from . import chart
class ChartArea(chart.Chart):
"""
A class for writing the Excel XLSX Area charts.
... |
cmusatyalab/django-s3 | django_s3/urls.py | #
# Copyright (C) 2012-2013 Carnegie Mellon University
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# version 2 as published by the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful,
# but WITHO... |
brenotx/SIGI-1.6 | sigi/apps/servidores/management/commands/sync_ldap.py | # coding: utf-8
import ldap
from django.core.management.base import BaseCommand, CommandError
from django.contrib.auth.models import User, Group
from sigi.settings import *
from sigi.apps.servidores.models import Servidor
class Command(BaseCommand):
help = u'Sincroniza Usuários e Servidores com o LDAP'
... |
D4wN/brickv | src/brickv/plugin_system/plugins/master/ethernet.py | # -*- coding: utf-8 -*-
"""
Master Plugin
Copyright (C) 2013 Olaf Lüke <olaf@tinkerforge.com>
Copyright (C) 2014-2015 Matthias Bolte <matthias@tinkerforge.com>
ethernet.py: Ethernet for Master Plugin implementation
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU Gene... |
TunedMystic/taskr | meeting/views.py | from django.shortcuts import render
from rest_framework.generics import RetrieveAPIView, ListAPIView
from meeting.serializers import UserSerializer, MeetingSerializer
from meeting.models import Meeting
from django.contrib.auth import get_user_model
User = get_user_model()
from rest_framework.response import Response
... |
Vignesh2208/Awlsim | awlsim/core/systemblocks/systemblocks.py | # -*- coding: utf-8 -*-
#
# AWL simulator - System-blocks
#
# Copyright 2012-2015 Michael Buesch <m@bues.ch>
#
# 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 License, or... |
Pikecillo/genna | external/4Suite-XML-1.0.2/test/Xml/Xslt/Core/test_include.py | import cStringIO
from Ft.Lib.Uri import OsPathToUri
from Ft.Xml.InputSource import InputSourceFactory, DefaultFactory
from Ft.Xml.Xslt import XsltException, Error
from Ft.Xml.Xslt.Processor import Processor
from Xml.Xslt import test_harness
#-----------------------------------------------------------------------
# G... |
huiyiqun/check_mk | web/htdocs/backup.py | #!/usr/bin/python
# -*- encoding: utf-8; py-indent-offset: 4 -*-
# +------------------------------------------------------------------+
# | ____ _ _ __ __ _ __ |
# | / ___| |__ ___ ___| | __ | \/ | |/ / |
# | | | | '_ \ / _ \/ __| |/ /... |
miurahr/translate | translate/convert/resx2po.py | #
# Copyright 2015 Zuza Software Foundation
# Copyright 2015 Sarah Hale
#
# This file is part of translate.
#
# translate 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 License, or
# (... |
ronan22/obs-service-gbs | obs_service_gbs/command.py | # vim:fileencoding=utf-8:et:ts=4:sw=4:sts=4
#
# Copyright (C) 2013 Intel Corporation <markus.lehtonen@linux.intel.com>
#
# 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... |
twexler/diatribe | diatribe/bot/__main__.py | #!/usr/bin/python
import os
import sys
import urlparse
import logging
import hashlib
import json
import importlib
import glob
from optparse import OptionParser
import redis
from twisted.words.protocols import irc
from twisted.internet import ssl, reactor, protocol
from werkzeug.routing import Map, DEFAULT_CONVERT... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.