code stringlengths 3 1.05M | repo_name stringlengths 5 104 | path stringlengths 4 251 | language stringclasses 1
value | license stringclasses 15
values | size int64 3 1.05M |
|---|---|---|---|---|---|
"""Treniformis exceptions"""
class TreniformisException(Exception):
"""Base exception."""
class TreniformisIOError(IOError):
"""Asset does not exist or cannot be opened."""
| GlobalFishingWatch/treniformis | treniformis/errors.py | Python | apache-2.0 | 185 |
# -*- coding: utf-8 -*-
# ------------------------------------------------------------
# pelisalacarta - XBMC Plugin
# http://blog.tvalacarta.info/plugin-xbmc/pelisalacarta/
# ------------------------------------------------------------
import os
import re
import sys
import urlparse
from channelselector import get_thu... | kampanita/pelisalacarta | python/main-classic/channels/seriesblanco.py | Python | gpl-3.0 | 12,144 |
import datetime
import os
import re
import ujson
from django.conf import settings
from django.http import HttpResponse
from django.test import override_settings
from mock import MagicMock, patch
import urllib
from typing import Any, Dict, List
from zerver.lib.actions import do_create_user
from zerver.lib.test_classe... | dhcrzf/zulip | zerver/tests/test_home.py | Python | apache-2.0 | 34,576 |
import copy
from html.parser import HTMLParser
from functools import partial
class SimpleHTMLFilter(HTMLParser):
""" Example:
<form name="form1" action="/action" method="post">
<p name="message">Available Options</p>
<input type="hidden" name="task" value="uid">
<table>
<tr align="left">
... | SimpleExpress/sand | python/SimpleHTMLFilter.py | Python | mit | 6,375 |
import pass_pipeline as ppipe
import passes as p
def simplifycfg_silcombine_passlist():
return ppipe.PassList([
p.SimplifyCFG,
p.SILCombine,
p.SimplifyCFG,
])
def highlevel_loopopt_passlist():
return ppipe.PassList([
p.LowerAggregateInstrs,
p.SILCombine,
... | apple/swift | utils/pass-pipeline/src/pass_pipeline_library.py | Python | apache-2.0 | 2,942 |
# Copyright 2011 Viewfinder Inc. All Rights Reserved.
"""Tests for IdAllocator data object.
"""
__author__ = 'spencer@emailscrubbed.com (Spencer Kimball)'
import unittest
from viewfinder.backend.base import util
from viewfinder.backend.base.testing import async_test
from viewfinder.backend.db.id_allocator import Id... | qskycolor/viewfinder | backend/db/test/id_allocator_test.py | Python | apache-2.0 | 1,514 |
from django.test import TestCase
from django.contrib.auth.models import User, Group, Permission
from django.contrib.contenttypes.models import ContentType
class UserTestCase(TestCase):
"""
Test the added user functionality.
"""
def setUp(self):
create_test_objects()
def test_get_all_gro... | digitalemagine/django-hierarchical-auth | hierarchical_auth/tests/tests.py | Python | bsd-3-clause | 3,993 |
#!/usr/bin/env python
# TerminalUi.py
#
# Copyright (C) 2014 Kano Computing Ltd
# License: GNU General Public License v2 http://www.gnu.org/licenses/gpl-2.0.txt
#
# Author: Caroline Clark <caroline@kano.me>
# Terminal Gtk emulator
from gi.repository import Vte, GLib
import os
class TerminalUi(Vte.Terminal):
def... | iamarf/terminal-quest | linux_story/gtk3/TerminalUi.py | Python | gpl-2.0 | 941 |
#! /usr/bin/env python
import sys
import re
mode = 0;
#0 = print version
#1 = build
#2 = minor
#3 = major
filename = ""
for arg in sys.argv:
if arg == "--build":
mode = 1
elif arg == "--minor":
mode = 2
elif arg == "--major":
mode = 3
elif arg != sys.argv[0]:
filename = arg
file = open(filename, "r")
data... | Codingboy/uc | script/v.py | Python | bsd-2-clause | 1,033 |
# -*- coding: utf-8 -*-
#
# Hawkey documentation build configuration file, created by
# sphinx-quickstart on Tue Aug 7 11:06:24 2012.
#
# 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
# autogenerated file.
#
# All ... | mizdebsk/hawkey | doc/conf.py | Python | lgpl-2.1 | 8,215 |
# -*- coding: utf-8 -*-
"""
Created on 20.08.2014
@author: K. Viebahn
This file used to be the uEye.h header file for cpp code and it has been translated to python. All necessary files and libraries (for Win 64bit and 32bit) can be found in this directory (and \drivers).
Otherwise find them in \IDS\uEye\Develop\inclu... | kviebahn/beam-cam | uEyeAPI.py | Python | gpl-3.0 | 53,941 |
HOST = "mongo-nosh-norep-10f:27017"
PORT = ""
USER = ""
PASSWORD = ""
DATABASE = "google"
READ_PREFERENCE = "primary"
COLLECTION_INPUT = "task_events"
COLLECTION_OUTPUT = "average_cpu"
PREFIX_COLUMN = "g_"
ATTRIBUTES = ["CPU request"]
SORT = ["_id.filepath", "_id.numline"]
OPERATION_TYPE = "ALL"
INPUT_FILE = "task_e... | elainenaomi/sciwonc-dataflow-examples | sbbd2016/experiments/2-mongodb-norp-nosh/6_workflow_full_10files_primary_nosh_nors_annot_with_proj_3s/averagecpu_0/ConfigDB_AverageCPU_0.py | Python | gpl-3.0 | 363 |
#!/usr/bin/env python
# Copyright 2014-2018 The PySCF Developers. 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
#
# U... | gkc1000/pyscf | pyscf/scf/jk.py | Python | apache-2.0 | 10,853 |
import numpy as np
import networkx
from zephyr.Problem import SeisFDFDProblem
# Plotting configuration
import matplotlib.pyplot as plt
import matplotlib.cm as cm
import matplotlib.ticker as ticker
import matplotlib
matplotlib.rcParams.update({'font.size': 20})
# System / modelling configuration
cellSize = 1 ... | bsmithyman/zephyr | LiveDataDemoBigJobs.py | Python | mit | 3,762 |
#!/usr/bin/env python
import pika
import uuid
import sys
import threading
import os
import getopt
import random
m_id=0
def on_request(ch, method, props, body):
print "Sending %s to be transformed" % (body,)
key=(method.routing_key).replace("request", "transform")
ch.basic_publish(exchange='Australia_NZ_Exchange'... | ted-dunstone/ivs | hub_demo/matcher.py | Python | mit | 3,439 |
import sys
import os
if __name__ == '__main__':
pkg_dir = os.path.split(os.path.abspath(__file__))[0]
parent_dir, pkg_name = os.path.split(pkg_dir)
is_pygame_pkg = (pkg_name == 'tests' and
os.path.split(parent_dir)[1] == 'pygame')
if not is_pygame_pkg:
sys.path.insert(0, par... | gmittal/aar-nlp-research-2016 | src/pygame-pygame-6625feb3fc7f/test/font_test.py | Python | mit | 21,151 |
__author__ = "Christian Kongsgaard"
__license__ = 'MIT'
# -------------------------------------------------------------------------------------------------------------------- #
# IMPORTS
# Modules
# RiBuild Modules
from delphin_6_automation.database_interactions.db_templates import delphin_entry
from delphin_6_autom... | thp44/delphin_6_automation | data_process/wp6_v2/not_in_sample.py | Python | mit | 3,478 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# GuessIt - A library for guessing information from filenames
# Copyright (c) 2012 Nicolas Wack <wackou@gmail.com>
#
# GuessIt is free software; you can redistribute it and/or modify it under
# the terms of the Lesser GNU General Public License as published by
# the Free ... | Branlala/docker-sickbeardfr | sickbeard/lib/guessit/transfo/split_path_components.py | Python | mit | 1,292 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.1 on 2016-09-22 08:59
from __future__ import unicode_literals
import grouprise.core.utils
import grouprise.core.models
from django.db import migrations, models
import django.db.models.deletion
import django
import grouprise.core
def no_validator(arg):
pass
def... | stadtgestalten/stadtgestalten | grouprise/features/groups/migrations/0001_initial.py | Python | agpl-3.0 | 4,020 |
# Opus/UrbanSim urban simulation software.
# Copyright (C) 2005-2009 University of Washington
# See opus_core/LICENSE
aliases = [
"large_area_id = household.disaggregate(gridcell.large_area_id)"
] | christianurich/VIBe2UrbanSim | 3rdparty/opus/src/washtenaw/household/aliases.py | Python | gpl-2.0 | 219 |
# -*- coding: utf-8 -*-
"""
Add compatibility for gevent and multiprocessing.
Source based on project GIPC 0.6.0
https://bitbucket.org/jgehrcke/gipc/
"""
import os, sys, signal, multiprocessing, multiprocessing.process, multiprocessing.reduction
gevent=None
geventEvent=None
def _tryGevent():
global gevent, gevent... | byaka/flaskJSONRPCServer | flaskJSONRPCServer/gmultiprocessing.py | Python | apache-2.0 | 6,393 |
import logging
from nymms.schemas.types import STATE_OK
from nymms.reactor.handlers.Handler import Handler
from nymms.utils.aws_helper import ConnectionManager
logger = logging.getLogger(__name__)
class SDBHandler(Handler):
""" A basic handler to persist alerts to AWS simpleDB. To filter
results you shoul... | cloudtools/nymms | nymms/reactor/handlers/sdb_handler.py | Python | bsd-2-clause | 1,881 |
# Generated by Django 2.0.8 on 2018-10-22 04:15
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('taxonomy', '0003_auto_20181022_1156'),
]
operations = [
migrations.AlterField(
model_name='hbvfamily',
name='class_n... | parksandwildlife/wastd | taxonomy/migrations/0004_auto_20181022_1215.py | Python | mit | 3,205 |
# -*- coding: utf-8 -*-
# (The MIT License)
#
# Copyright (c) 2014 Kura
#
# 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... | kura/batfish | batfish/models/size.py | Python | mit | 2,431 |
# Program to generate a random number between 0 and 9
# import the random module
import random
print(random.randint(0,9))
| HarendraSingh22/Python-Guide-for-Beginners | Code/randomNumber.py | Python | mit | 124 |
# Unix SMB/CIFS implementation.
# Copyright (C) Jelmer Vernooij <jelmer@samba.org> 2011
#
# 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) a... | yasoob/PythonRSSReader | venv/lib/python2.7/dist-packages/samba/netcmd/main.py | Python | mit | 2,589 |
#!/usr/bin/env python2
# vim:fileencoding=UTF-8:ts=4:sw=4:sta:et:sts=4:ai
from __future__ import (unicode_literals, division, absolute_import,
print_function)
__license__ = 'GPL v3'
__copyright__ = '2012, Kovid Goyal <kovid@kovidgoyal.net>'
__docformat__ = 'restructuredtext en'
import struct... | jelly/calibre | src/calibre/ebooks/mobi/reader/mobi8.py | Python | gpl-3.0 | 24,249 |
# -*- coding: utf-8 -*-
import json
from django.http import HttpResponse, Http404, HttpResponseRedirect
from django.template import RequestContext
from django.shortcuts import render_to_response
from common import utils, page
from www.journey import interface
from www.misc.decorators import member_required, staff_req... | lantianlz/qiexing | www/journey/views.py | Python | gpl-2.0 | 5,036 |
import os
IGNORE = (
"/test/",
"/tests/gtests/",
"/BSP_GhostTest/",
"/release/",
"/xembed/",
"/TerraplayNetwork/",
"/ik_glut_test/",
# specific source files
"extern/Eigen2/Eigen/src/Cholesky/CholeskyInstantiations.cpp",
"extern/Eigen2/Eigen/src/Core/CoreInstantiations.cpp",
... | pawkoz/dyplom | blender/build_files/cmake/cmake_consistency_check_config.py | Python | gpl-2.0 | 4,572 |
from django.conf import settings
def autodiscover():
"""Find all the widgets within the installed apps"""
for app in settings.INSTALLED_APPS:
__import__(app, {}, {}, ['widgets'])
autodiscover()
| cfpb/django-widgeter | widgeter/__init__.py | Python | cc0-1.0 | 214 |
from accelerator.sitetree_navigation.utils import (
create_subnav,
delete_nav_tree
)
from accelerator_abstract.models import BaseUserRole
FINALIST = BaseUserRole.FINALIST
ALUMNI = BaseUserRole.ALUM
JUDGE = BaseUserRole.JUDGE
JUDGING_SUBNAV_TREE = {
"title": 'Judging Sub Nav',
"alias": 'judging_subnav'... | masschallenge/django-accelerator | accelerator/sitetree_navigation/sub_navigation/judging_subnav_definition.py | Python | mit | 1,077 |
# -*- encoding: utf-8 -*-
##############################################################################
#
# Purchase - Computed Purchase Order Module for Odoo
# Copyright (C) 2013-Today GRAP (http://www.grap.coop)
# @author Julien WESTE
# @author Sylvain LE GAL (https://twitter.com/legalsylvain)
#
# Thi... | rosenvladimirov/addons | purchase_compute_order_bg/model/__init__.py | Python | agpl-3.0 | 1,261 |
# -*- coding: utf-8 -*-
r"""
Some Quantum Mechanics, filling an atomic orbital
=================================================
Considering an atomic single orbital and how to fill it by use of the
chemical potential. This system has a four element basis, :math:`B =
\{ \lvert \emptyset \rangle, \lvert \uparrow \rangl... | lesteve/sphinx-gallery | examples/plot_quantum.py | Python | bsd-3-clause | 2,828 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import copy
import matplotlib.pyplot as plt
import sys
from utils.vroom import solve
# Parse a json-formatted input instance, then apply iterative solving
# strategies to come up with a solution minimizing completion time.
def filter_dominated(solutions):
indices = r... | VROOM-Project/vroom-scripts | src/utils/asap_helpers.py | Python | bsd-2-clause | 7,543 |
"""
This is the code behind the Switching Eds blog post:
http://matthewearl.github.io/2015/07/28/switching-eds-with-python/
See the above for an explanation of the code below.
To run the script you'll need to install dlib (http://dlib.net) including its
Python bindings, and OpenCV. You'll also need to obtain the tr... | xyfeng/average_portrait | face_swap.py | Python | mit | 6,296 |
from PyQt4.QtQui import QIcon
class MyIcon(QIcon): | handsomegui/Gereqi | gereqi/myicon.py | Python | gpl-3.0 | 51 |
#!/usr/bin/env python
#
# A library that provides a Python interface to the Telegram Bot API
# Copyright (C) 2015-2016
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser Public License as published by
#... | AndresCidoncha/BubecasBot | telegram/photosize.py | Python | gpl-3.0 | 2,491 |
from django import forms
from django.contrib import admin
from pages.models import FlatPage
#from django.contrib.flatpages.admin import FlatPageAdmin as FPAdmin
from django.utils.translation import ugettext_lazy as _
from django.core.exceptions import PermissionDenied
from django.http import HttpResponseRedirect
from d... | sigurdga/nidarholm | pages/admin.py | Python | agpl-3.0 | 1,332 |
"""
Copyright 2019-2022 Biomedical Computer Vision Group, Heidelberg University.
Distributed under the MIT license.
See file LICENSE for detail or copy at https://opensource.org/licenses/MIT
"""
import argparse
import numpy as np
import pandas as pd
from scipy.ndimage import map_coordinates
from skimage.transform i... | BMCV/galaxy-image-analysis | tools/projective_transformation_points/projective_transformation_points.py | Python | mit | 3,573 |
# 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.opus_package import OpusPackage
class package(OpusPackage):
name = 'opus_core'
| apdjustino/DRCOG_Urbansim | src/opus_core/opus_package_info.py | Python | agpl-3.0 | 264 |
"""News source to send a notification whenever a twitch streamer goes live."""
import datetime
import logging
import discord
from dateutil import parser
from .AbstractSources import DataBasedSource
DOZER_LOGGER = logging.getLogger('dozer')
class TwitchSource(DataBasedSource):
"""News source to send a notificat... | guineawheek/Dozer | dozer/sources/TwitchSource.py | Python | gpl-3.0 | 7,912 |
import struct
fh = open('datain.bin', 'rb')
i = 0
try:
byte = fh.read(8)
while byte != '':
if i == 0: timestamp = struct.unpack('d',byte)[0]
else:
## struct.unpack returns a tuple, so to get a float you need to use [0] at the end
ui = struct.unpack('d', byte[0:8])[0]
vi = struct.un... | barreled/FTLE | bin/conversion.py | Python | gpl-3.0 | 884 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from .zernike import (polar_array, rnm, zernike,
zernike2taylor, i2nm, ZernikeXY)
__all__ = ["polar_array",
"rnm",
"zernike",
"zernike2taylor",
"i2nm",
"ZernikeXY"]
| cihologramas/pyoptools | pyoptools/wavefront/zernike/__init__.py | Python | gpl-3.0 | 290 |
from collections import namedtuple
from config import Config
from api import *
from sqlite3 import connect
Stats = namedtuple('Stats', ['damage_dealt', 'frags', 'spotted', 'wins', 'dropped_capture_points'])
def init_db():
connection = connect(Config.DB_PATH)
cursor = connection.cursor()
return cursor
... | jmaygarden/wotdata | wn8.py | Python | gpl-2.0 | 3,121 |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
# This assumes an existing but uninitialized database.
from contextlib import contextmanager
import unittest
from odoo import api, registry, SUPERUSER_ID
from odoo.tests import common
from odoo.modules.registry import ... | t3dev/odoo | odoo/addons/base/tests/test_uninstall.py | Python | gpl-3.0 | 2,223 |
import tornado.web
import tornado.httpclient
from tornado import httpclient
from functools import partial
class BlockNotifyHandler(tornado.web.RequestHandler):
def get(self, hash):
self.application.log('HTTP_GET', '/api/blocknotify/' + hash )
from models import ForwardingAddress
unconfirmed_forwarding_... | blinktrade/blinktrade_api_receive | blinktrade_api_receive/block_notify_handler.py | Python | gpl-3.0 | 1,246 |
import merkle_tree
import generate_tags
import os
# test vriables
path = os.getcwd()
blocks_path = path + '/blocks/'
def generate_merkle_tree(path):
# get leafs hash tags
tags_dict = generate_tags.generate_blcok_tags(path)
tags = list(tags_dict.values())
# print(tags)
tree = merkl... | DavidMusk93/MerkleTree | generate_tree.py | Python | gpl-2.0 | 600 |
#!/usr/bin/python3 -u
# -*- coding: utf-8 -*-
#
# Reads the file produced by theof.py and the list of Wikidata
# entities with an "instance of" property of "human" and prints all
# lines which match such an entity.
import re
import argparse
import os
import sys
import gzip
import csv
version = "0.0.3"
re_quotes = r... | weltliteratur/vossanto | emnlp-ijcnlp2019/check_wikidata.py | Python | gpl-3.0 | 5,469 |
from base_repository import session
from models.blog import Blog
from models.blog_post import BlogPost
def page(page, per_page=2):
with session() as s:
blog = s.query(Blog).first()
blog.posts = s.query(BlogPost).order_by(BlogPost.date.desc()).limit(per_page).offset(page*per_page).all()
retu... | allison-knauss/arkweb | api/repositories/blog_repository.py | Python | mit | 329 |
from . import Model, CollectionModel
class Reply(Model):
"""
A Reply object model (Inbox message)
.. attribute:: id
.. attribute:: sender
.. attribute:: messageTime
.. attribute:: text
.. attribute:: receiver
"""
class Replies(CollectionModel):
name = "replies"
instance ... | textmagic/textmagic-rest-python | textmagic/rest/models/replies.py | Python | mit | 1,306 |
#!/usr/local/bin/python3
# -*- coding: utf-8 -*-
import timeit
def threesumA(sequence):
count = 0
length = len(sequence)
for i in range(length):
for j in range(i + 1, length):
for k in range(j + 1, length):
if sequence[i] + sequence[j] + sequence[k] == 0:
count += 1
return count
def find(sequence, ... | goldsborough/algs4 | analysis/threesum.py | Python | mit | 1,178 |
import numpy as np
from blocks.initialization import NdarrayInitialization
import theano
class ConvIdentity(NdarrayInitialization):
def __init__(self, scale=1., **kwargs):
super(ConvIdentity, self).__init__(**kwargs)
self.scale = scale
def generate(self, rng, shape):
w = np.zeros(shap... | lukemetz/cuboid | cuboid/initializations.py | Python | mit | 2,625 |
"""
Django settings for kodeklubb project.
For more information on this file, see
https://docs.djangoproject.com/en/1.6/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.6/ref/settings/
"""
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
... | iver56/trondheim.kodeklubben.no | backend/wsgi/kodeklubb/settings.py | Python | gpl-3.0 | 3,620 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# automatic price monitoring program.
# prints price data to the terminal whenever changed.
# sends alert mail when last price slips out of range. check settings.py for details
from settings import time_interval, price_lowerbound, price_upperbound
from ticker import inst... | usedev/btcchina.py | pilot.py | Python | mit | 762 |
import pytest
import sentlex
import sentlex.sentanalysis as sentdoc
TESTDOC_ADJ = 'good/JJ good/JJ good/JJ good/JJ good/JJ good/JJ good/JJ good/JJ good/JJ good/JJ'
TESTDOC_UNTAGGED = 'this cookie is good. it is very good indeed'
TESTDOC_BADADJ = 'bad_JJ Bad_JJ bAd_JJ'
TESTDOC_NEGATED = 'not/DT bad/JJ ./. not/DT reall... | bohana/sentlex | tests/test_docscore.py | Python | mit | 2,627 |
#!/usr/bin/python
# Copyright (c) 2017 Will Thames
# Copyright (c) 2015 Mike Mochan
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'community'}
DO... | hryamzik/ansible | lib/ansible/modules/cloud/amazon/aws_waf_rule.py | Python | gpl-3.0 | 12,179 |
from bcpp_subject_form_validators import MedicalDiagnosesFormValidator
from ..constants import ANNUAL
from ..models import MedicalDiagnoses
from .form_mixins import SubjectModelFormMixin
class MedicalDiagnosesForm (SubjectModelFormMixin):
form_validator_cls = MedicalDiagnosesFormValidator
optional_labels =... | botswana-harvard/bcpp-subject | bcpp_subject/forms/medical_diagnoses_form.py | Python | gpl-3.0 | 622 |
# Foris - web administration interface for OpenWrt based on NETCONF
# Copyright (C) 2017 CZ.NIC, z.s.p.o. <http://www.nic.cz>
#
# 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 o... | CZ-NIC/foris | foris/utils/addresses.py | Python | gpl-3.0 | 1,945 |
from __future__ import absolute_import
__all__ = ("DebugMeta",)
from sentry.interfaces.base import Interface
from sentry.utils.json import prune_empty_keys
class DebugMeta(Interface):
"""
Holds debug meta information for processing stacktraces
and similar things. This information is deleted after event... | mvaled/sentry | src/sentry/interfaces/debug_meta.py | Python | bsd-3-clause | 1,172 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2013 Cloudscaling Group, 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/LI... | tuskar/tuskar | tuskar/openstack/common/rpc/matchmaker_redis.py | Python | apache-2.0 | 4,880 |
from setuptools import setup
setup(
name='beets-syncpl',
version='0.1.0-beta',
description='beets plugin to sync certain music files to a folder',
author='Laurent De Marez',
author_email='laurent@demarez.org',
license='MIT',
platforms='ALL',
packages=['beetsplug'],
install_require... | lrnt/beets-syncpl | setup.py | Python | mit | 707 |
'''Worker for asynchronous tasks'''
from celery import Celery
from chineurs import settings, updates
CELERY_APP = Celery('tasks', broker=settings.CELERY_BROKER)
CELERY_APP.conf.update(
CELERY_TASK_SERIALIZER='json',
CELERY_ACCEPT_CONTENT=['json'], # Ignore other content
CELERY_RESULT_SERIALIZER='json')
... | jroitgrund/chineurs | chineurs/celery.py | Python | mit | 481 |
import os, sys
def copy_to(in_file, out_file):
'''copies a file from a source, to a destination
(provide path and name for out_file) '''
f = open(in_file, 'r+')
contents = f.read()
outfile = f.write(contents)
copy_to("copy_files.txt", "copied.txt")
"""
What to do:
open file
read file
write file ... | AmandaMoen/AmandaMoen | students/PatPrendergast/copy_file.py | Python | gpl-2.0 | 473 |
#!/usr/bin/env python
import time
from hashlib import md5
from gluon.dal import DAL
def motp_auth(db=DAL('sqlite://storage.sqlite'),
time_offset=60):
"""
motp allows you to login with a one time password(OTP) generated on a motp client,
motp clients are available for practica... | SEA000/uw-empathica | empathica/gluon/contrib/login_methods/motp_auth.py | Python | mit | 4,542 |
import asyncio
from unittest import mock
import pytest
from aiohttp import log, web
from aiohttp.abc import AbstractAccessLogger, AbstractRouter
from aiohttp.helpers import PY_36
from aiohttp.test_utils import make_mocked_coro
def test_app_ctor(loop):
with pytest.warns(DeprecationWarning):
app = web.App... | pfreixes/aiohttp | tests/test_web_app.py | Python | apache-2.0 | 6,476 |
import matplotlib.pyplot as pl
import random as rnd
a = rnd.sample(range(10),10)
print([a])
pl.imshow([a])
| JaeGyu/PythonEx_1 | MatplotlibEx.py | Python | mit | 116 |
#!/usr/bin/env python
"""
:Author Patrik Valkovic
:Created 23.06.2017 16:45
:Licence MIT
Part of grammpy
"""
from .representation import *
| PatrikValkovic/grammpy | grammpy/__init__.py | Python | mit | 141 |
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
from pyecs import *
from pycompupipe.components import DrawProcess
import mock
import pygame
import re
import os.path
from testing import *
class TestDrawProcess():
@mock.patch("pycompupipe.components.drawing.draw_process.DrawProcess.draw")
def test_event(sel... | xaedes/PyCompuPipe | tests/components/drawing/test_draw_process.py | Python | mit | 1,548 |
# Copyright 2013 OpenStack Foundation
# All Rights Reserved.
# Copyright 2013 IBM Corp.
#
# 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/LIC... | Tesora/tesora-tempest | tempest/api/image/v2/test_images_negative.py | Python | apache-2.0 | 3,994 |
# Copyright 2016 The TensorFlow Authors. 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
#
# Unless required by applica... | tornadozou/tensorflow | tensorflow/python/keras/applications/vgg19/__init__.py | Python | apache-2.0 | 1,127 |
"""
archive.py: Download handling
Copyright 2014-2015, Outernet Inc.
Some rights reserved.
This software is free software licensed under the terms of GPLv3. See COPYING
file that comes with the source code, or http://www.gnu.org/licenses/gpl.txt.
"""
import functools
import logging
from ...archive import BaseArchiv... | Outernet-Project/librarian-content | librarian_content/library/backends/embedded/archive.py | Python | gpl-3.0 | 10,671 |
__author__ = 'cgonzalez'
| carlgonz/u-fit | src/python/u_fit/modules/__init__.py | Python | mit | 25 |
# -*- coding: utf-8 -*-
# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
###############################################################################
# OpenLP - Open Source Lyrics Projection #
# ------------------------------------------------------... | crossroadchurch/paul | tests/functional/openlp_core_common/test_registryproperties.py | Python | gpl-2.0 | 2,673 |
#!/usr/bin/env python
#
# aionn - asyncio messaging library based on nanomsg and nnpy
#
# Copyright (C) 2016 by Artur Wroblewski <wrobell@riseup.net>
#
# 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 Founda... | wrobell/aionn | examples/ex-pull.py | Python | gpl-3.0 | 1,237 |
# coding: utf-8
from __future__ import unicode_literals, absolute_import
from ..exception import TigrisException
import urllib.parse
class Permission(object):
""" Tigris Permission object """
BASE_ENDPOINT = 'permissions'
def __init__(self, permission_obj, session):
"""
:param permissi... | jogral/tigris-python-sdk | tigrissdk/auth/permission.py | Python | apache-2.0 | 3,756 |
# https://oj.leetcode.com/problems/valid-palindrome/
class Solution:
# @param s, a string
# @return a boolean
# create a new string
def isPalindrome1(self, s):
str = [c.lower() for c in s if c.isalnum()]
n = len(str)
for i in xrange(0, n/2):
if str[i] != str[n-1-i]:
return False
... | yaoxuanw007/forfun | leetcode/python/validPalindrome.py | Python | mit | 745 |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2013 Stefan Wold <ratler@stderr.eu>
#
# 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 ... | Ratler/undernet-totp | undernet_totp.py | Python | gpl-3.0 | 6,365 |
# Copyright 2018 The TensorFlow Authors. 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
#
# Unless required by applica... | jbedorf/tensorflow | tensorflow/contrib/distribute/__init__.py | Python | apache-2.0 | 2,998 |
# -*- coding: iso-8859-1 -*-
"""
MoinMoin - Utility functions for the web-layer
@copyright: 2003-2008 MoinMoin:ThomasWaldmann,
2008-2008 MoinMoin:FlorianKrupicka
@license: GNU GPL, see COPYING for details.
"""
import time
from werkzeug import abort, redirect, cookie_date, Response
from Mo... | RealTimeWeb/wikisite | MoinMoin/web/utils.py | Python | apache-2.0 | 10,269 |
from google.appengine.ext import db
from geo.geomodel import GeoModel
class StopInfo(GeoModel):
name = db.StringProperty()
class RouteInfo(db.Model):
routeName = db.StringProperty()
isReturn = db.IntegerProperty()
stopName = db.StringProperty()
nextStopName = db.StringProperty()
| medicalwei/taipei-bus-html5 | models.py | Python | agpl-3.0 | 288 |
from abc import ABCMeta, abstractmethod
from enum import Enum
class ActionType(Enum):
SHELL = 'shell'
RELEASE = 'release'
class Action(metaclass=ABCMeta):
@abstractmethod
def run(self, path: str, config=None, system_config=None, erlang_vsn: str = None) -> bool:
pass
@abstractmethod
... | comtihon/coon | enot/action/action.py | Python | apache-2.0 | 359 |
'''
Created by auto_sdk on 2015.06.23
'''
from aliyun.api.base import RestApi
class Rds20140815DescribeErrorLogsRequest(RestApi):
def __init__(self,domain='rds.aliyuncs.com',port=80):
RestApi.__init__(self,domain, port)
self.DBInstanceId = None
self.EndTime = None
self.PageNumber = None
self.PageSize = None
... | francisar/rds_manager | aliyun/api/rest/Rds20140815DescribeErrorLogsRequest.py | Python | mit | 425 |
from collections import OrderedDict
import re
from .proto import caffe_pb2
from google import protobuf
def uncamel(s):
"""Convert CamelCase to underscore_case."""
return re.sub('(?!^)([A-Z])(?=[^A-Z])', r'_\1', s).lower()
def assign_proto(proto, name, val):
if isinstance(val, list):
getattr(prot... | schen119/caffe-windows-cudnn | python/caffe/layers.py | Python | bsd-2-clause | 2,791 |
"""Management command to change many user enrollments at once."""
from __future__ import absolute_import
import logging
from django.core.management.base import BaseCommand, CommandError
from django.db import transaction
from opaque_keys import InvalidKeyError
from opaque_keys.edx.keys import CourseKey
from six import... | ESOedX/edx-platform | common/djangoapps/student/management/commands/bulk_change_enrollment.py | Python | agpl-3.0 | 4,588 |
from pseudoregion import *
class Edge(PseudoRegion):
"""EDGE Fringe field and other kicks for hard-edged field models
1) edge type (A4) {SOL, DIP, HDIP, DIP3, QUAD, SQUA, SEX, BSOL, FACE}
2.1) model # (I) {1}
2.2-5) p1, p2, p3,p4 (R) model-dependent parameters
Edge type = SOL
p1: BS [T]
... | jon2718/ipycool_2.0 | edge.py | Python | mit | 4,743 |
"""Support for Yamaha Receivers."""
import logging
import requests
import rxv
import voluptuous as vol
from homeassistant.components.media_player import MediaPlayerDevice, PLATFORM_SCHEMA
from homeassistant.components.media_player.const import (
DOMAIN,
MEDIA_TYPE_MUSIC,
SUPPORT_NEXT_TRACK,
SUPPORT_PA... | qedi-r/home-assistant | homeassistant/components/yamaha/media_player.py | Python | apache-2.0 | 13,437 |
from qubricks import QuantumSystem
class CustomSystem(QuantumSystem):
'''
Refer to the API documentation for `QuantumSystem` for more information.
'''
def init(self, **kwargs):
'''
This method can be used by subclasses to initialise the state
of the `QuantumSystem` instance. Any excess kwargs beyond `param... | matthewwardrop/python-qubricks | templates/quantum_system.py | Python | mit | 3,908 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright (c) 2012 Citrix Systems, 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/LICE... | aristanetworks/arista-ovs-nova | nova/tests/virt/xenapi/test_volumeops.py | Python | apache-2.0 | 1,514 |
# encoding: utf-8
from base import APITestCase
from vilya.libs.store import store
from vilya.models.gist_comment import GistComment
class GistTest(APITestCase):
def setUp(self):
store.execute('delete from gist_stars where id<10')
super(GistTest, self).setUp()
self.gist1 = self._add_gist(
... | xtao/code | tests/webtests/api/test_gist.py | Python | bsd-3-clause | 7,571 |
# gvas.utilities
# Utilities and helper functions common to the GVAS simulation
#
# Author: Benjamin Bengfort <benjamin@bengfort.com>
# Created: Tue Nov 24 17:35:49 2015 -0500
#
# Copyright (C) 2015 Bengfort.com
# For license information, see LICENSE.txt
#
# ID: __init__.py [] benjamin@bengfort.com $
"""
Utilities ... | tipsybear/actors-simulation | gvas/utils/__init__.py | Python | mit | 1,469 |
from typing import List
from overrides import overrides
from ..dataset import TextDataset, log_label_counts
from ...instances import TextInstance
from ...instances.language_modeling import SentenceInstance
from ....common.params import Params
class LanguageModelingDataset(TextDataset):
def __init__(self, insta... | matt-gardner/deep_qa | deep_qa/data/datasets/language_modeling/language_modeling_dataset.py | Python | apache-2.0 | 1,363 |
#!/usr/bin/python
import argparse
import requests
import json
import sys
def main():
parser = argparse.ArgumentParser(description="Parses the report files and sends it to slack")
parser.add_argument("-lines", help="Provides the file where the line count is stored as 'total source comments'")
parser.add_argument... | mobgen/halo-android | scripts/halo_report_slack.py | Python | apache-2.0 | 3,628 |
# -*- coding: utf-8 -*-
import binascii
import re
import Crypto.Cipher.AES
from module.plugins.internal.Crypter import Crypter
from module.plugins.captcha.ReCaptcha import ReCaptcha
class NCryptIn(Crypter):
__name__ = "NCryptIn"
__type__ = "crypter"
__version__ = "1.41"
__status__ = "testing... | kaarl/pyload | module/plugins/crypter/NCryptIn.py | Python | gpl-3.0 | 10,811 |
#!/usr/bin/env python
"""
This is the imSim program, used to drive GalSim to simulate the LSST. Written
for the DESC collaboration and LSST project. This version of the program can
read phoSim instance files as is. It leverages the LSST Sims GalSim interface
code found in sims_GalSimInterface.
"""
from __future__ imp... | LSSTDESC/LSSTDarkMatter | satsim/doimsim.py | Python | mit | 6,095 |
#---------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
#---------------------------------------------------------------------... | BurtBiel/azure-cli | src/command_modules/azure-cli-vm/azure/cli/command_modules/vm/mgmt_vm/lib/models/vm_creation_client_enums.py | Python | mit | 2,312 |
"""
Implementation of flexx.event in JS via PyScript.
"""
import json
from flexx.pyscript import JSString, py2js as py2js_
from flexx.pyscript.parser2 import get_class_definition
from flexx.event._emitters import BaseEmitter, Property
from flexx.event._handler import HandlerDescriptor, Handler
from flexx.event._hase... | JohnLunzer/flexx | flexx/event/_js.py | Python | bsd-2-clause | 12,959 |
#!/usr/bin/env python
r"""Browse raw data.
This uses :func:`mne.io.read_raw` so it supports the same formats
(without keyword arguments).
Examples
--------
.. code-block:: console
$ mne browse_raw sample_audvis_raw.fif \
--proj sample_audvis_ecg-proj.fif \
--eve sample_a... | kambysese/mne-python | mne/commands/mne_browse_raw.py | Python | bsd-3-clause | 5,212 |
from unittest import TestCase
import os.path
from cate.util.tmpfile import new_temp_file, del_temp_file, del_temp_files, get_temp_files
class TempFileTest(TestCase):
def setUp(self):
del_temp_files(force=True)
self.assertEqual(get_temp_files(), [])
def test_all(self):
p1 = new_temp_... | CCI-Tools/cate-core | tests/util/test_tmpfile.py | Python | mit | 1,023 |
# -*- coding: utf-8 -*-
from django.conf.urls import patterns, url
urlpatterns = patterns(
'apps.blog.views',
url(r'^$', 'post_list', name='blog_post_list'),
url(
r'^(?P<slug>[-\w]+)/$', 'post_detail',
name='blog_post_detail'
),
)
| allisson/django-docker-example | myblog/apps/blog/urls.py | Python | mit | 267 |
#!/usr/bin/env python3
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This software may be used and distributed according to the terms of the
# GNU General Public License version 2.
import json
import subprocess
with open("report.json", "r") as f:
tests = json.load(f)
for name, t in tests.items():
... | facebookexperimental/eden | eden/scm/tests/update-to-py3-utils/retry-skipped.py | Python | gpl-2.0 | 581 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.