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 |
|---|---|---|---|---|---|
# Copyright (C) 2013 - Oscar Campos <oscar.campos@member.fsf.org>
# This program is Free Software see LICENSE file for details
from .linting import BackgroundLinter
from .completion import AnacondaCompletionEventListener
from .signatures import AnacondaSignaturesEventListener
from .autopep8 import AnacondaAutoformatP... | danalec/dotfiles | sublime/.config/sublime-text-3/Packages/Anaconda/listeners/__init__.py | Python | mit | 497 |
import unittest
from evoplotter.dims import *
from evoplotter import printer
class TestsPrinter(unittest.TestCase):
x = "x"
r = "r"
c = "c"
data = [{r: 0, c: 0, x: 1},
{r: 0, c: 0, x: 2},
{r: 0, c: 0, x: 3},
{r: 0, c: 1, x: 4},
{r: 0, c: 1, x: 5},
... | iwob/evoplotter | tests/test_printer.py | Python | mit | 7,474 |
import os
import xbmcgui
import xbmc
import time
import urllib
class Downloader:
def __init__(self,):
pass
def download(self,path,url,name):
if os.path.isfile(path) is True:
while os.path.exists(path):
try: os.remove(path); break
... | repotvsupertuga/tvsupertuga.repository | script.premium.TVsupertuga/resources/lib/Downloader.py | Python | gpl-2.0 | 2,159 |
"""Callback-based event and input handling.
---NODOC---
TODO:
[ESSENTIAL]
- BUG: button events don't really do the right thing
- should track real held state from held state of all inputs, and only send up/down if it actually changes
- BUG: input normalisation doesn't work (button held state)
- state that ... | ikn/pygame-template | game/engine/evt/__init__.py | Python | bsd-3-clause | 3,707 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Author: Rico Sennrich <sennrich@cl.uzh.ch>
from __future__ import division
import sys
import os
import random
import math
import operator
from subprocess import Popen, PIPE
from collections import defaultdict
from config import LMPLZ_CMD
def euclidean_distance(v1, v2):
... | rsennrich/multidomain_smt | cluster.py | Python | gpl-2.0 | 9,750 |
""" feather-format compat """
from distutils.version import LooseVersion
from pandas import DataFrame, Int64Index, RangeIndex
from pandas.compat import range
from pandas.io.common import _stringify_path
def _try_import():
# since pandas is a dependency of feather
# we need to import on first use
try:
... | amolkahat/pandas | pandas/io/feather_format.py | Python | bsd-3-clause | 3,371 |
# -*- coding:utf-8 -*-
class GameWorld:
def __init__(self):
pass
| dennisding/ether | game/game_world.py | Python | apache-2.0 | 69 |
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not us... | chenc10/Spark-PAF | python/pyspark/ml/tests.py | Python | apache-2.0 | 13,886 |
# -*- coding: utf-8 -*-
"""
Django settings for sous-chef project.
Generated by 'django-admin startproject' using Django 1.9.2.
For more information on this file, see
https://docs.djangoproject.com/en/1.9/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.9/ref/s... | savoirfairelinux/sous-chef | src/sous_chef/settings.py | Python | agpl-3.0 | 6,673 |
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | Huyuwei/tvm | topi/python/topi/generic_op_impl.py | Python | apache-2.0 | 3,896 |
"""
Program to make system boops into music
Copyright (C) 2016 treefroog
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... | treefroog/Music.py | python music.py | Python | gpl-3.0 | 1,745 |
import unittest
from webassets import Bundle, Environment
from webassets_react import React
from os import path
class ReactFilterTestCase(unittest.TestCase):
def test_output(self):
environment = Environment(path.dirname(__file__))
bundle = Bundle('input.jsx', output='input.js', filters=('react',))
... | DotNetAge/webassets-react | tests/test_suite.py | Python | bsd-3-clause | 396 |
#!/usr/bin/python3
# -*- coding: utf-8 -*-
import time
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from PIL import Image
def graf2png(weburl, username, password, timeout, imgname, hwin, wwin, onlypanel):
driver = webdriver.PhantomJS()
driver.set_window_size(hwin, wwin)
... | andoniaf/DefGrafana.py | graf2png.py | Python | gpl-3.0 | 1,737 |
# -*- coding: utf-8 -*-
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "L... | jbonofre/beam | sdks/python/apache_beam/io/filesystems_test.py | Python | apache-2.0 | 8,304 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright: (c) 2019, Ansible Project
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
... | dagwieers/ansible | lib/ansible/modules/cloud/kubevirt/kubevirt_rs.py | Python | gpl-3.0 | 6,766 |
import os
import sys
import socket
import threading
def openRegistrationInterface(IP, PORT, converter):
server_socket1 = socket.socket()
server_socket1.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
server_socket1.bind((IP, PORT))
server_socket1.listen(0)
while True:
client_socket1, addr = server_... | kimjinyong/i2nsf-framework | mininet/SecurityController/API/socketAPI.py | Python | apache-2.0 | 1,639 |
# -*- coding: utf-8 -*-
# Copyright (C) 1998-2012 by the Free Software Foundation, Inc.
#
# This file is part of HyperKitty.
#
# HyperKitty 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 t... | khushboo9293/Hyperkitty | hyperkitty/context_processors.py | Python | gpl-3.0 | 1,859 |
import cv2
import numpy as np
import sys
ED_KERNEL_SIZE = 3
BLUR_KERNEL_SIZE = 9
CONTOUR_AREA_THRESHOLD = 800
colors = [(255,0,0),
(0,255,0),
(255,255,0),
(255,0,255)]
upper = (20,255,255)
lower = (0,135,100)
class BoundingBoxExtremes():
def __init__(self, mx, mix, my, miy):
self.max_x = mx
self.mi... | osu-uwrt/riptide-ros | riptide_vision/scripts/riptide_vision/lib.py | Python | bsd-2-clause | 4,983 |
#!/usr/bin/env python
import os, sys, timing
db = os.environ.get('SMC_DB', 'migrate')
def process(x):
base, ext = os.path.splitext(x)
name = os.path.split(base)[1]
if name.endswith('-time'):
name = name[:-5]
if name.startswith('update-'):
name = name[len('update-'):]
timing.start(... | DrXyzzy/smc | src/scripts/postgresql/migrate/read_from_csv.py | Python | agpl-3.0 | 770 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('msgs', '0012_message_labels'),
]
operations = [
migrations.AlterField(
model_name='label',
name='org... | xkmato/casepro | casepro/msgs/migrations/0013_auto_20160223_0917.py | Python | bsd-3-clause | 444 |
# -*- coding: utf-8 -*-
"""
Created on Thu Mar 29 10:14:07 2018
@author: Dell
"""
import uuid
from sqlalchemy.sql import and_
from .orm import Config,Point,Frame,Area,PointLoad,PointRestraint
import logger
def add_point(self,x,y,z):
"""
Add point object to model, if the name already exists, an exception wil... | zhuoju36/StructEngPy | object_model/point.py | Python | mit | 10,395 |
"""locallibrary URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.11/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Cla... | netdaniels/it_classified | classified/urls.py | Python | mit | 1,616 |
"""
MPEG audio file parser.
Creation: 12 decembre 2005
Author: Victor Stinner
"""
from hachoir_py2.parser import Parser
from hachoir_py2.field import (FieldSet,
MissingField, ParserError, createOrphanField,
Bit, Bits, Enum,
P... | SickGear/SickGear | lib/hachoir_py2/parser/audio/mpeg_audio.py | Python | gpl-3.0 | 13,857 |
__license__ = 'GPL v3'
__copyright__ = '2014, Emily Palmieri <silentfuzzle@gmail.com>'
from calibre.gui2.viewer.behavior.base_behavior import BaseBehavior
# This class defines an Adventurous Reader behavior where users can only view one section of the ebook at a time.
class BaseAdventurousBehavior (BaseBehavior):
... | silentfuzzle/calibre | src/calibre/gui2/viewer/behavior/adventurous_base_behavior.py | Python | gpl-3.0 | 2,934 |
# coding: utf8
import os
import re
from inspect import isfunction
import pygame as pg
from pygame.locals import *
from ColorHelper import ColorHelper
from Singleton import Singleton
from tools import py_encode_font_txt, py_encode_title
if not pg.font: print 'Warning, fonts disabled'
if not pg.mixer: print 'Warning,... | totorigolo/WiiQuizz | helpers/WindowHelper.py | Python | gpl-2.0 | 57,378 |
import unittest
from utils import str_utils
class TestStrUtils(unittest.TestCase):
def test_equal_number_of_parameters(self):
self.assertEqual(str_utils.split("a b c", " ", 3), ["a", "b", "c"])
def test_more_parameters_than_limit(self):
self.assertEqual(str_utils.split("a b c d", " ", 3), ["... | Tigge/platinumshrimp | utils/test/test_str_utils.py | Python | mit | 458 |
import string
final_buffer = 'list_phoneme <- [\n'
f = open('phonemes.txt', 'r')
buffer = f.read()
f.close()
pos = buffer.find('<Phonemes>')
if pos != -1:
buffer = buffer[pos+10:len(buffer)-13]
buffer = string.split(buffer, ',')
for phoneme_array in buff... | astrofra/amiga-memories | app/phoneme_to_nut.py | Python | mit | 787 |
#
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2002-2006 Donald N. Allingham
#
# 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 you... | pmghalvorsen/gramps_branch | gramps/gen/filters/rules/event/_regexpidof.py | Python | gpl-2.0 | 1,741 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.2 on 2017-06-17 23:00
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('laboite.apps.parking', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name='appparking',... | bgaultier/laboitepro | laboite/apps/parking/migrations/0002_auto_20170618_0100.py | Python | agpl-3.0 | 618 |
#-*- coding: utf-8 -*-
'''
python-libtorrent for Kodi (script.module.libtorrent)
Copyright (C) 2015-2016 DiMartino, srg70, RussakHH, aisman
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 t... | alfa-jor/addon | plugin.video.alfa/lib/python_libtorrent/python_libtorrent/functions.py | Python | gpl-3.0 | 9,266 |
""" Tests for utils. """
import collections
from datetime import datetime, timedelta
import mock
from pytz import UTC
from django.test import TestCase
from django.test.utils import override_settings
from xmodule.modulestore import ModuleStoreEnum
from xmodule.modulestore.tests.factories import CourseFactory, ItemFacto... | waheedahmed/edx-platform | cms/djangoapps/contentstore/tests/test_utils.py | Python | agpl-3.0 | 27,659 |
#!/usr/bin/env python2
# Author: Nic Wolfe <nic@wolfeden.ca>
# URL: http://code.google.com/p/sickbeard/
#
# This file is part of SickRage.
#
# SickRage 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 ve... | bcorbet/SickRage | SickBeard.py | Python | gpl-3.0 | 20,304 |
from . import ApolloTestCase, wa
class MetricsTest(ApolloTestCase):
def test_get_metrics(self):
metrics = wa.metrics.get_metrics()
assert 'version' in metrics
assert 'gauges' in metrics
assert 'counters' in metrics
assert 'histograms' in metrics
assert 'meters' i... | erasche/python-apollo | test/metrics_test.py | Python | mit | 469 |
import _plotly_utils.basevalidators
class XValidator(_plotly_utils.basevalidators.NumberValidator):
def __init__(self, plotly_name="x", parent_name="layout.scene.camera.up", **kwargs):
super(XValidator, self).__init__(
plotly_name=plotly_name,
parent_name=parent_name,
e... | plotly/plotly.py | packages/python/plotly/plotly/validators/layout/scene/camera/up/_x.py | Python | mit | 395 |
# Copyright 2012 Twitter
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... | clutchio/clutch | ab/urls.py | Python | apache-2.0 | 1,965 |
"""
Steam OpenId backend, docs at:
http://psa.matiasaguirre.net/docs/backends/steam.html
"""
from social.backends.open_id import OpenIdAuth
from social.exceptions import AuthFailed
USER_INFO = 'http://api.steampowered.com/ISteamUser/GetPlayerSummaries/v0002/?'
class SteamOpenId(OpenIdAuth):
name = 'steam'
... | HackerEcology/SuggestU | suggestu/social/backends/steam.py | Python | gpl-3.0 | 1,336 |
"""Get status of disk."""
from status_base import mongo_collection
from status_base import mongo_database
from status_base import save
from status_base import schedule_log
from status_base import setup_environment
from status_base import get_parameters
from urllib.request import urlopen
setup_environment()
def stat... | CornerstoneLabs/service-dashboard | dashboard/fabric-plugins/status_url_check.py | Python | mit | 1,252 |
import logging
from coapthon import defines
from coapthon.messages.request import Request
from coapthon.messages.response import Response
logger = logging.getLogger(__name__)
__author__ = 'Giacomo Tanganelli'
class BlockItem(object):
def __init__(self, byte, num, m, size, payload=None, content_type=None):
... | mcfreis/CoAPthon | coapthon/layers/blocklayer.py | Python | mit | 13,495 |
# -*-coding:Utf-8 -*
# Copyright (c) 2015 LE GOFF Vincent
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice, this
# lis... | stormi/tsunami | src/primaires/communication/commandes/orbe/renommer.py | Python | bsd-3-clause | 4,745 |
#!/usr/bin/python3
#
__author__ = 'Chris Burton'
doc = """
Usage:
fwparse.py [-o FILE]
fwparse.py [-s FILE]
fwparse.py [(-q -o FILE)]
fwparse.py [-d]
fwparse.py [-h]
Options:
-o FILE Set an output file
-s FILE Reference a settings file outside this directory
-q Quietly, must use -o
... | cyberhiker/Halo-Scripts | cp-fwparse/fwparse.py | Python | mit | 4,204 |
"""
Tool: tweets per (day, hour, minute) figure, shown and saved optionally
"""
import argparse
import seaborn as sns
import matplotlib.pyplot as plt
from pymongo import MongoClient
from datetime import datetime, timedelta
## COMMANDLINE ################################################################
parser = argpar... | SMAPPNYU/smappPy | smappPy/tools/figure_makers/tweets_per_timestep.py | Python | gpl-2.0 | 2,624 |
# -*- encoding: utf-8 -*-
#
# Copyright 2015 Hewlett Packard Development Company, LP
# Copyright 2015 Universidade Federal de Campina Grande
#
# 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 Lice... | devananda/ironic | ironic/tests/unit/drivers/modules/oneview/test_management.py | Python | apache-2.0 | 8,420 |
# -*- coding: utf-8 -*-
# Copyright (c) 2013 Spotify AB
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
# use this file except in compliance with the License. You may obtain a copy of
# the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | dgoldin/snakebite | snakebite/commandlineparser.py | Python | apache-2.0 | 31,673 |
# Copyright (c) 2016 RainMachine, Green Electronics LLC
# All rights reserved.
# Authors: Nicu Pavel <npavel@mini-box.com>
# Ciprian Misaila <ciprian.misaila@mini-box.com>
import urllib2, os, ssl, json
from RMUtilsFramework.rmLogging import log
class RMAPIClientProtocol:
"""
RainMachine currently sup... | sprinkler/rainmachine-developer-resources | api-python/API4Client/rmAPIClientREST.py | Python | gpl-3.0 | 4,980 |
from main.db import *
from random import randint
class Game():
save = {'savefile': 0, 'firsttime': True}
hiredActors = []
filmedMovies = []
def setDefParams(self):
for x in range(len(defvalnames)):
self.save[defvalnames[x]] = defvalvals[x]
class Actor(object):
... | kittenparry/kittyadultstudiogame | main/game.py | Python | mit | 3,795 |
# -*- coding: utf-8 -*-
def obj2dict(obj):
memberlist = [m for m in dir(obj)]
_dict = {}
for m in memberlist:
if m[0] != "_" and not callable(m):
_dict[m] = getattr(obj, m)
return _dict
| ShaolongHu/Nitrate | tcms/core/utils/obj2dict.py | Python | gpl-2.0 | 223 |
# -*- coding: utf-8 -*-
###############################################################################
#
# ListApplications
# Returns a list of Twilio applications associated with your account.
#
# Python version 2.6
#
###############################################################################
from temboo.core.c... | egetzel/wecrow | truehand2014/temboo/Library/Twilio/Applications/ListApplications.py | Python | apache-2.0 | 3,715 |
import bento.console as console
from sqlalchemy import create_engine, orm, exc, desc
def connect(file='database/system.db', register=[]):
engine = None
session = None
try:
engine = create_engine('sqlite:///{}'.format(file))
session = orm.scoped_session(orm.sessionmaker(bind=engine))()
... | chefhasteeth/BentoBot | database/helpers.py | Python | bsd-3-clause | 553 |
import logging
import json
from ferris.core.template import render_template
def generic_handler(code, template=None):
if not template:
template = "%s" % code
template = ('errors/%s.html' % template, 'errors/500.html')
def inner(request, response, exception):
logging.exception(exception)
... | yowmamasita/social-listener-exam | ferris/controllers/errors.py | Python | mit | 1,015 |
# -*- coding:utf-8 -*-
'''
Created on 2013-3-6
@author: corleone
统计标准
'''
from scrapy.spider import BaseSpider
class Tjbz_Spider(BaseSpider):
name = "nbsc"
url = "http://www.stats.gov.cn/tjbz/"
start_urls = [
"http://www.stats.gov.cn/tjbz/", # 2002-12-31
]
| 535521469/crawler_sth | scrapy/nbsc/spiders/tjbz_spider.py | Python | bsd-3-clause | 311 |
import demistomock as demisto # noqa: F401
from CommonServerPython import * # noqa: F401
class Client(BaseClient):
def __init__(self, server_url, verify, proxy, headers, auth):
super().__init__(base_url=server_url, verify=verify, proxy=proxy, headers=headers, auth=auth)
def osv_get_vuln_by_id_reque... | demisto/content | Packs/OpenSourceVulnerabilities/Integrations/OSV/OSV.py | Python | mit | 4,275 |
#!/usr/bin/env python
# Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.
from twisted.spread import pb
class FrogPond:
def __init__(self, numFrogs, numToads):
self.numFrogs = numFrogs
self.numToads = numToads
def count(self):
return self.numFrogs + self.numToads
... | waseem18/oh-mainline | vendor/packages/twisted/doc/core/howto/listings/pb/copy2_classes.py | Python | agpl-3.0 | 765 |
# -*- coding: utf-8 -*-
# Copyright 2019 The GraphicsFuzz Project Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless requi... | google/graphicsfuzz | gfauto/gfauto/cov_to_source.py | Python | apache-2.0 | 2,337 |
# -*- coding: utf-8 -*-
# This file is part of FOSSAds.
# Copyright (c) 2011 Marius Voilă
# FOSSAds is free software: you can redistribute it and/or modify it under
# the terms of the GNU Affero General Public License as published by the Free
# Software Foundation, either version 3 of the License, or (at your option)
... | mariusv/FOSSAds | ads/blog.py | Python | agpl-3.0 | 1,092 |
from django.db import models
from machines.models import Machine
from django.contrib.auth.models import User
class Object(models.Model):
name = models.CharField(max_length=20)
description = models.TextField(blank=True)
model_url = models.URLField()
gcode = models.TextField()
owner = models.ForeignK... | debben/RepPREP | editor/models.py | Python | lgpl-3.0 | 750 |
# Copyright (C) 2020 Smithsonian Astrophysical Observatory
#
#
# 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.
#
#... | cxcsds/ciao-contrib | dax/dax_model_editor.py | Python | gpl-3.0 | 15,955 |
# Configuration file for the Sphinx documentation builder.
#
# This file only contains a selection of the most common options. For a full
# list see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html
# -- Path setup --------------------------------------------------------------
# If ex... | ArcticSnow/snowpyt | docs/conf.py | Python | mit | 1,971 |
@given(u'the WOT ID exists')
def step_impl(context):
context.node_simulator.add_user("Me", insert=True)
@given(u'there are other blockchain users')
def step_impl(context):
context.node_simulator.add_user("Adam")
context.node_simulator.add_user("Bill")
context.node_simulator.add_user("Charlie")
@given(... | debbiedub/bcdef | features/steps/blockchain.py | Python | gpl-3.0 | 411 |
# -*- coding: utf-8 -*-
"""This file is part of the TPOT library.
TPOT was primarily developed at the University of Pennsylvania by:
- Randal S. Olson (rso@randalolson.com)
- Weixuan Fu (weixuanf@upenn.edu)
- Daniel Angell (dpa34@drexel.edu)
- and many more generous open source contributors
TPOT is f... | rhiever/tpot | tests/tpot_tests.py | Python | lgpl-3.0 | 82,897 |
# ==================================================================================================
# Copyright 2014 Twitter, Inc.
# --------------------------------------------------------------------------------------------------
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use thi... | Yasumoto/zktraffic | zktraffic/tests/test_packets.py | Python | apache-2.0 | 3,523 |
# -*- coding: utf-8 -*-
from functools import wraps
from django.template import loader, TemplateSyntaxError
from django.utils.datastructures import SortedDict
from cmsplugin_text_ng.templatetags.text_ng_tags import DefineNode
from cmsplugin_text_ng.type_registry import get_type
def ensure_template_arg(func):
de... | 360youlun/cmsplugin-text-ng | cmsplugin_text_ng/utils.py | Python | bsd-3-clause | 1,647 |
# -*- coding: utf-8 -*-
#
# Configuration file for the Sphinx documentation builder.
#
# This file does only contain a selection of the most common options. For a
# full list see the documentation:
# http://www.sphinx-doc.org/en/master/config
import os
import edx_theme
# -- Path setup ------------------------------... | edx-solutions/edx-platform | docs/api/conf.py | Python | agpl-3.0 | 5,561 |
"""
Functions for Report generation
"""
import numpy as np
import pandas as pd
import os
from plotly.offline import plot
import plotly.graph_objs as go
from cea.constants import HOURS_IN_YEAR
__author__ = "Gabriel Happle"
__copyright__ = "Copyright 2015, Architecture and Building Systems - ETH Zurich"
__credits__... | architecture-building-systems/CEAforArcGIS | cea/utilities/reporting.py | Python | mit | 4,645 |
import os
import time
from slackclient import SlackClient
import google_places as gp
import google_maps as gm
import api_ai
import pprint
#from environ variable
BOT_ID = os.environ.get("ROUTE_PLANNER_ID")
#constants
AT_BOT = "<@" + BOT_ID + ">"
BOT_SESSION_ID = "route_planner_bot"
#instantiate Slack client
slack_cl... | mingtaiha/n.ai | slackbots/route_planner/route_planner.py | Python | mit | 4,949 |
from jinja2.ext import babel_extract as extract_jinja2
import jinja_extensions as je
jinja_extensions = '''
jinja2.ext.do, jinja2.ext.with_,
climmob3.jinja_extensions.SnippetExtension
'''
# This function take badly formatted html with strings etc and make it ... | BioversityCostaRica/CLIMMOBNET_V3 | climmob3/extract.py | Python | gpl-3.0 | 3,010 |
"""
Django settings for demo 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://docs.djangoproject.com/en/1.7/ref/settings/
"""
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
impor... | WimpyAnalytics/pynt-of-django | demo/demo/settings.py | Python | bsd-3-clause | 2,036 |
import regex
import requests
from pympler import summary, muppy
import psutil
from pynab.db import db_session, Regex, Blacklist, engine
from pynab import log
import config
import db.regex as regex_data
class Match(object):
"""Holds a regex match result so we can use it in chained if statements."""
def __ini... | Herkemer/pynab | pynab/util.py | Python | gpl-2.0 | 5,121 |
__version__= '1.1.1'
INFO_URL = 'https://github.com/ikreymer/webarchiveplayer'
| machawk1/webarchiveplayer | archiveplayer/version.py | Python | gpl-3.0 | 79 |
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# Copyright 2011 Justin Santa Barbara
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance wi... | biirdy/monasca-anomaly | openstack/common/service.py | Python | apache-2.0 | 15,575 |
############# ignore this bit for now #############
from microbit import *
def get_message(times_pressed):
############# edit below #############
# times_pressed is a variable that holds an integer telling you how often
# button A was pressed. Your task is to create a message that is going to
# be... | mathisgerdes/microbit-macau | Session 1 - Programing with Python/python-intro/2_logics.py | Python | mit | 536 |
# -*- coding: utf-8 -*-
"""
Catch-up TV & More
Copyright (C) 2018 SylvainCecchetto
This file is part of Catch-up TV & More.
Catch-up TV & More 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 Foundat... | SylvainCecchetto/plugin.video.catchuptvandmore | plugin.video.catchuptvandmore/resources/lib/channels/uk/questod.py | Python | gpl-2.0 | 10,514 |
import os
from flask import Flask, Response, request, redirect, url_for
from werkzeug import secure_filename
import urllib2
import boto
import boto.sqs
import boto.sqs.queue
from boto.sqs.message import Message
from boto.sqs.connection import SQSConnection
from boto.exception import SQSError
import sys
import json
from... | dasheq/lastlab | my_application/server.py | Python | mit | 5,246 |
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
from __future__ import division
import pickle
import codecs
class AttrDict(dict):
"""
Dictionary whose elements can be accessed like attributes.
>>> d = AttrDict(x=1, y=2)
>>> d.x = 2
d => {'x': 2, 'y': 2}
"""
def __init__(self, *args, **kwar... | eske/RLPE | utils.py | Python | apache-2.0 | 2,250 |
#encoding:utf-8
"""
pythoner.net
Copyright (C) 2013 PYTHONER.ORG
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.
Th... | wangjun/pythoner.net | pythoner/pm/urls.py | Python | gpl-3.0 | 1,035 |
# -*- coding: utf-8 -*-
"""
/***************************************************************************
LayerBoardDialog
A QGIS plugin
This plugin displays a table with all the project layers and lets the user change some properties directly. It also aims to be a board showing useful... | 3liz/QgisLayerBoardPlugin | layer_board_dialog.py | Python | gpl-2.0 | 1,673 |
# Copyright 2018 The Cirq Developers
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... | quantumlib/Cirq | cirq-google/cirq_google/optimizers/convert_to_xmon_gates_test.py | Python | apache-2.0 | 2,362 |
from panoramisk import utils
from panoramisk.exceptions import AGIException
def test_parse_agi_valid_result():
res = try_parse_agi_result('200 result=0')
assert res == {'msg': '', 'result': ('0', ''), 'status_code': 200}
res = try_parse_agi_result('200 result=1')
assert res == {'msg': '', 'result': (... | gawel/panoramisk | tests/test_utils.py | Python | mit | 1,276 |
import sys
sys.path.insert(1,"../../")
import h2o
from tests import pyunit_utils
from h2o.estimators.gbm import H2OGradientBoostingEstimator
def spaces_in_column_names():
train_data = h2o.upload_file(path=pyunit_utils.locate("smalldata/jira/spaces_in_column_names.csv"))
train_data.show()
train_data.describ... | YzPaul3/h2o-3 | h2o-py/tests/testdir_misc/pyunit_spaces_in_column_names.py | Python | apache-2.0 | 780 |
# Based on Rapptz's RoboDanny's repl cog
import contextlib
import inspect
import logging
import re
import sys
import textwrap
import traceback
from io import StringIO
from typing import *
from typing import Pattern
import discord
from discord.ext import commands
# i took this from somewhere and i cant remember where
... | 10se1ucgo/LoLTrivia | plugins/debug.py | Python | mit | 4,487 |
"""
WSGI config for zulip 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_APPLICATION`` se... | JanzTam/zulip | zproject/wsgi.py | Python | apache-2.0 | 1,178 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10 on 2017-01-12 11:19
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('core', '0006_auto_20170112_1045'),
]
operations = [
migrations.AlterField(
... | BOOLRon/lovelypic | core/migrations/0007_auto_20170112_1119.py | Python | mit | 456 |
#!/usr/bin/python
# Initial author: Solaiappan Manimaran
# PathoMap performs the alignment through wrappers for each type of aligners.
# Pathoscope - Predicts strains of genomes in Nextgen seq alignment file (sam/bl8)
# Copyright (C) 2013 Johnson Lab - Boston University and Crandall Lab George Washington Univer... | PathoScope/PathoScope | pathoscope/pathomap/PathoMapA.py | Python | gpl-3.0 | 10,774 |
JE = 'je'
TU = 'tu'
ELLE = 'el'
IL = 'il'
IT = 'it'
NOUS = 'nu'
VOUS = 'vu'
ILS = 'is'
ELLES = 'es'
afa = {
# https://en.wikipedia.org/wiki/Afroasiatic_languages
'order': {'default': (1, 0), 'adj_nom': (0, 1)},
'order_triple': {'default': (0, 1, 2), },
}
bantu = {
'order': {'default': (0, 1), 'det_nom': (1, 0)... | kasahorow/kwl | data/sua.py | Python | bsd-2-clause | 1,094 |
# make importing these a bit less hassle
from flexget.utils.titles.series import SeriesParser, ID_TYPES # pylint: disable=unused-import
from flexget.utils.titles.movie import MovieParser # pylint: disable=unused-import
from flexget.utils.titles.parser import TitleParser # pylint: disable=unused-import
| qvazzler/Flexget | flexget/utils/titles/__init__.py | Python | mit | 306 |
"""Raw representations of every data type in the AWS ElastiCache service.
See Also:
`AWS developer guide for ElastiCache
<https://docs.aws.amazon.com/AmazonElastiCache/latest/red-ug/index.html>`_
This file is automatically generated, and should not be directly edited.
"""
from typing import Any
from typing i... | garyd203/flying-circus | src/flyingcircus/_raw/elasticache.py | Python | lgpl-3.0 | 7,383 |
try:
import unittest2 as unittest
except:
import unittest
import numpy as np
from hpsklearn.estimator import hyperopt_estimator
from hpsklearn import components
class TestIter(unittest.TestCase):
def setUp(self):
np.random.seed(123)
self.X = np.random.randn(1000, 2)
self.Y = (sel... | wavelets/hyperopt-sklearn | hpsklearn/tests/test_estimator.py | Python | bsd-3-clause | 1,604 |
from django.contrib.comments.moderation import CommentModerator, moderator
from scipy_central.submission.models import Revision
class RevisionModerator(CommentModerator):
"""
Comments moderation settings for
`scipy_central.submission.models.Revision` model
"""
enable_field = 'enable_comments'
mode... | Srisai85/SciPyCentral | scipy_central/comments/moderation.py | Python | bsd-3-clause | 364 |
# archivebox init
# archivebox add
import os
import subprocess
from pathlib import Path
import json, shutil
import sqlite3
from archivebox.config import OUTPUT_PERMISSIONS
from .fixtures import *
def test_init(tmp_path, process):
assert "Initializing a new ArchiveBox" in process.stdout.decode("utf-8")
def ... | pirate/bookmark-archiver | tests/test_init.py | Python | mit | 7,971 |
print("hola mundo, estoy feliz con Github")
| cmontoyau1993/demo-project-py | hola.py | Python | mit | 46 |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import print_function
from collections import defaultdict
from copy import deepcopy
import axiom_rules
import fact_groups
import instantiate
import normalize
import optparse
import pddl
import sas_tasks
import simplify
import sys
import timers
import too... | fawcettc/planning-features | fast-downward/translate/translate.py | Python | agpl-3.0 | 28,962 |
import fnmatch
import os
from pathlib import Path
from subprocess import PIPE, Popen
from django.apps import apps as installed_apps
from django.utils.crypto import get_random_string
from django.utils.encoding import DEFAULT_LOCALE_ENCODING
from .base import CommandError, CommandParser
def popen_wrapper(args, stdout... | fenginx/django | django/core/management/utils.py | Python | bsd-3-clause | 4,924 |
import sys
import os
import subprocess
import time
def get_slaves():
slaves = subprocess.check_output(['cat', '/root/spark-ec2/slaves'])
return slaves.strip().split('\n')
slaves = get_slaves()
for slave in slaves:
subprocess.call(['ssh', slave, 'killall', 'iperf3'])
subprocess.call(['scp', '/root/spa... | Gaojiaqi/spark-ec2 | test_speed_master.py | Python | apache-2.0 | 789 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import importlib
from warnings import warn
from pyspd.locator import LocatorInterface
class LocatorModule(LocatorInterface):
"""Locates plugins given as pure python module name (foo.bar.baz).
Locator expects that PYTHONPATH is set correctly
"""
def __init_... | michalbachowski/pyspd | src/pyspd/locator/module.py | Python | mit | 964 |
def factors(n):
return set(reduce(list.__add__,
([i, n//i] for i in range(1, int(n**0.5) + 1) if n % i == 0)))
| jarble/EngScript | libraries/factors.py | Python | mit | 136 |
# Copyright (c) 2020, Manfred Moitzi
# License: MIT License
import pytest
from ezdxf.lldxf.attributes import DXFAttr, RETURN_DEFAULT
def test_return_default():
attr = DXFAttr(
code=62,
default=12,
validator=lambda x: False,
fixer=RETURN_DEFAULT,
)
assert attr.fixer(7) == 1... | mozman/ezdxf | tests/test_00_dxf_low_level_structs/test_054_dxfattr.py | Python | mit | 541 |
"""SCons.Tool.dvi
Common DVI Builder definition for various other Tool modules that use it.
"""
#
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and a... | aubreyrjones/libesp | scons_local/scons-local-2.3.0/SCons/Tool/dvi.py | Python | mit | 2,400 |
import httplib
import urllib
import xml.dom.minidom
from utils import parse_xml
from paython.gateways.core import Gateway
from paython.exceptions import RequestError, GatewayError, DataValidationError
class XMLGateway(Gateway):
def __init__(self, host, translations, debug=False, special_params={}):
""" in... | vauxoo-dev/Paython | paython/lib/api.py | Python | mit | 7,371 |
"""
Copyright (c) 2019 Red Hat, Inc
All rights reserved.
This software may be modified and distributed under the terms
of the BSD license. See the LICENSE file for details.
"""
import os.path
import re
from atomic_reactor.constants import (
PLUGIN_RESOLVE_REMOTE_SOURCE, REMOTE_SOURCE_DIR, CACHITO_ENV_ARG_ALIAS, C... | DBuildService/atomic-reactor | atomic_reactor/plugins/pre_resolve_remote_source.py | Python | bsd-3-clause | 7,859 |
#!/usr/bin/env python
#
# A library that provides a Python interface to the Telegram Bot API
# Copyright (C) 2015-2021
# 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
#... | leandrotoledo/python-telegram-bot | telegram/chatinvitelink.py | Python | lgpl-3.0 | 4,245 |
# vim:fileencoding=utf-8:noet
from __future__ import (unicode_literals, division, absolute_import, print_function)
import itertools
import re
from copy import copy
from powerline.lib.unicode import unicode
from powerline.lint.markedjson.error import echoerr, DelayedEchoErr, NON_PRINTABLE_STR
from powerline.lint.self... | zeroc0d3/docker-lab | vim/rootfs/usr/lib/python2.7/dist-packages/powerline/lint/spec.py | Python | mit | 23,514 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.