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 |
|---|---|---|---|---|---|
"""Install a game by following its install script."""
import os
from gettext import gettext as _
from gi.repository import GLib, GObject
from lutris import settings
from lutris.config import LutrisConfig
from lutris.database.games import get_game_by_field
from lutris.gui.dialogs import WineNotInstalledWarning
from lu... | lutris/lutris | lutris/installer/interpreter.py | Python | gpl-3.0 | 19,060 |
import logging
from django.http import Http404, HttpResponseRedirect, HttpResponseBadRequest
from django.core.urlresolvers import reverse, reverse_lazy
from django.contrib import messages
from django.contrib.auth import login
from django.db.models import get_model
from django.utils.translation import ugettext as _
fr... | Idematica/django-oscar | oscar/apps/checkout/views.py | Python | bsd-3-clause | 29,280 |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes ... | lmazuel/azure-sdk-for-python | azure-mgmt-storage/azure/mgmt/storage/v2016_01_01/models/usage_paged.py | Python | mit | 917 |
import numpy as np
import Clusters as pc
def princomp(A,numpc=0, scale=True):
# computing eigenvalues and eigenvectors of covariance matrix
M = (A-np.mean(A.T,axis=1)).T # subtract the mean (along columns)
M = M / M.std(axis=1)[:,np.newaxis]
[latent,coeff] = np.linalg.eig(np.cov(M))
p = np.size(coeff,axis=1)
id... | mac389/snappy | utils.py | Python | apache-2.0 | 2,252 |
"""Model iterators."""
from collections.abc import Iterator
def subjects(*reports) -> Iterator:
"""Return all subjects in the reports."""
for report in reports:
yield from report.get("subjects", {}).values()
def metrics(*reports) -> Iterator:
"""Return all metrics in the reports."""
for sub... | ICTU/quality-time | components/server/src/external/model/iterators.py | Python | apache-2.0 | 576 |
import sys
import os
import re
from logging import getLogger
from abstract_step import AbstractStep
logger = getLogger('uap_logger')
class TrimGalore(AbstractStep):
'''
A wrapper tool around Cutadapt and FastQC to consistently apply quality and adapter trimming to
FastQ files, with some extra functionali... | kmpf/uap | include/steps/trim_galore.py | Python | gpl-3.0 | 26,096 |
#########################################################################
#
# Copyright (C) 2017 OSGeo
#
# 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... | francbartoli/geonode | geonode/services/serviceprocessors/base.py | Python | gpl-3.0 | 5,793 |
# -*- coding: utf-8 -*-
#
# complexity documentation build configuration file, created by
# sphinx-quickstart on Tue Jul 9 22:26:36 2013.
#
# 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.
#
# ... | qba73/grinderpy | docs/conf.py | Python | mit | 8,115 |
# -*-coding:utf-8-*-
__all__ = ['database', 'guide', 'gff', 'uniprot']
| wolfsonliu/crispr | pycas/utils/__init__.py | Python | gpl-3.0 | 72 |
from datetime import date
from unittest.mock import Mock
from model_bakery import baker
from allauth.account.models import EmailAddress
from django.conf import settings
from django.core import mail
from django.template.loader import render_to_string
from django.test import TestCase, RequestFactory
from django.contrib... | manhhomienbienthuy/pythondotorg | sponsors/tests/test_notifications.py | Python | apache-2.0 | 21,871 |
#!/usr/bin/env python
import numpy as np
from scipy.fftpack.realtransforms import dct,idct
class fastDiff(object):
'''
fastDiff: class for fast 2nd O differentiation of a gridded dataset
'''
def __init__(self,y=None,gamma=1.0,thresh=1e-10,yshape=None,smoothOrder=1.0,axis=None):
'''
load gridded d... | profLewis/fastDiff | fastDiff.py | Python | mpl-2.0 | 11,750 |
#!/usr/bin/env python
# Author: Derrick H. Karimi
# Copyright 2014
# Unclassified
from bbot.Utils import *
from bbot.MainStrategy import MainStrategy
from bbot.SpendingParser import SpendingParser
from bbot.Data import *
from bbot.RegionBuy import RegionBuy
S = SPACE_REGEX
N = NUM_REGEX
def get_region_ratio(app, c... | AlwaysTraining/bbot | bbot/AgentRecruiter.py | Python | mit | 1,215 |
# -*- coding: utf-8 -*-
# Subject to the terms of the GNU AFFERO GENERAL PUBLIC LICENSE, v. 3.0. If a copy of the AGPL was not
# distributed with this file, You can obtain one at http://www.gnu.org/licenses/agpl.txt
#
# Author: Davide Galletti davide ( at ) c4k.it
from django.test import TestCase
| TheKnowledgeOrientedArchitecture/oks | client/tests.py | Python | agpl-3.0 | 319 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.8 on 2019-09-12 04:04
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_depende... | parksandwildlife/statdev | applications/migrations/0009_application_assigned_officer.py | Python | apache-2.0 | 718 |
# -*- coding: utf-8 -*-
##############################################################################
#
# Copyright 2013 Camptocamp
# Copyright 2009-2013 Akretion,
# Author: Emmanuel Samyn, Raphaël Valyi, Sébastien Beau, Joel Grand-Guillaume
#
# This program is free software: you can redistribute it and/o... | akretion/rma | __unported__/crm_rma_lot_mass_return/__openerp__.py | Python | agpl-3.0 | 1,733 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# SPDX-License-Identifier: GPL-3.0
#
# GNU Radio Python Flow Graph
# Title: Record_RX
# Author: Justin Ried
# GNU Radio version: 3.8.1.0
from distutils.version import StrictVersion
if __name__ == '__main__':
import ctypes
import sys
if sys.platform.startsw... | CyberVines/Universal-Quantum-Cymatics | Record_RX.py | Python | mit | 6,310 |
# -*- coding: utf-8 -*-
from . import project_task
| thinkwelltwd/care_center | project_task_priority/models/__init__.py | Python | lgpl-3.0 | 51 |
from setuptools import setup, find_packages
import os
version = '0.4.dev0'
setup(name='sinarngo.multiviews',
version=version,
description="Templates for colletive multiview portlets.",
long_description=open("README.rst").read() + "\n" +
open(os.path.join("docs", "HISTORY.rst")... | Sinar/sinarngo.multiviews | setup.py | Python | gpl-2.0 | 1,828 |
# -*- coding: utf-8 -*-
"""
XBMC Cached Thumbnails, based on file 'XBMC/xbmc/FileItem.cpp'
by Frost
Example use:
from file_item import Thumbnails
thumbnails = Thumbnails()
print thumbnails.get_cached_artist_thumb( "artist name" )
print thumbnails.get_cached_profile_thumb() # current profile thumb
print thumbnails.ge... | xmbcrios/riostv | script.cdartmanager/resources/lib/file_item.py | Python | gpl-2.0 | 3,840 |
# -*-coding:Utf-8 -*
# Copyright (c) 2014 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/scripting/actions/trier.py | Python | bsd-3-clause | 2,728 |
# -*- coding: utf-8 -*-
from optparse import make_option, OptionParser
import os.path
import sys
from django.core.management.base import (BaseCommand, LabelCommand, CommandError)
from django.db.models import get_model
from django.conf import settings
class Command(LabelCommand):
"""
Management Command Class ab... | hfeeki/transifex | transifex/resources/management/commands/txstatsupdate.py | Python | gpl-2.0 | 3,874 |
# 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... | jwlawson/tensorflow | tensorflow/contrib/learn/python/learn/estimators/run_config_test.py | Python | apache-2.0 | 14,906 |
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
import frappe
def execute():
for dt in ("Stock Ledger Entry", "Communication", "Comment", "DefaultValue", "DocShare", "File Data", "ToDo", "Feed"):
frappe.get_doc("DocType", dt).run_module... | treejames/erpnext | erpnext/patches/v5_0/execute_on_doctype_update.py | Python | agpl-3.0 | 348 |
# Problem: Search in Rotated Sorted Array II
# Difficulty: Medium
# Category: Array
# Leetcode 81: https://leetcode.com/problems/search-in-rotated-sorted-array-ii/description/
"""
Suppose an array sorted in ascending order is rotated at some pivot unknown to you beforehand.
(i.e., 0 1 2 4 5 6 7 might become 4 5 6 7 0 1... | rush2catch/algorithms-leetcode | Basic Data Structures/array/leet_081_SearchinRotatedSortedArrayII.py | Python | mit | 1,155 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.20 on 2019-09-26 15:50
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('materia', '0057_materiaemtramitacao'),
('materia', '0056_auto_20190829_1206'),
]
o... | interlegis/sapl | sapl/materia/migrations/0058_merge_20190926_1250.py | Python | gpl-3.0 | 340 |
# Copyright (C) 2010-2015 Cuckoo Foundation.
# This file is part of Cuckoo Sandbox - http://www.cuckoosandbox.org
# See the file 'docs/LICENSE' for copying permission.
from lib.common.abstracts import Package
class PPT(Package):
"""PowerPoint analysis package."""
PATHS = [
("ProgramFiles", "Microsoft ... | davidoren/CuckooSploit | analyzer/windows/modules/packages/ppt.py | Python | gpl-3.0 | 799 |
#!/usr/bin/env python
# Copyright 2015 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import unittest
import pretty_print
PRETTY_XML = """
<!-- Comment1 -->
<rappor-configuration>
<!-- Comment2 -->
<rappor-parameter-... | hujiajie/chromium-crosswalk | tools/metrics/rappor/pretty_print_test.py | Python | bsd-3-clause | 3,083 |
from config import config, ConfigSelection, ConfigSubsection, ConfigOnOff, ConfigText
from Components.Timezones import timezones
from Components.Language import language
from Components.Keyboard import keyboard
def InitSetupDevices():
def timezoneNotifier(configElement):
timezones.activateTimezone(configElement.in... | Ophiuchus1312/enigma2-master | lib/python/Components/SetupDevices.py | Python | gpl-2.0 | 1,544 |
#! /usr/bin/env python3
"""
Known incompatibilities from MediaWiki schema:
- Not binary compatible, but stores the same data. Thus compatibility can be
achieved via wiki-scripts <-> MWAPI interface, but wiki-scripts can't read
a MediaWiki database directly. This wouldn't be possible even theoretically,
since th... | lahwaacz/wiki-scripts | ws/db/schema.py | Python | gpl-3.0 | 38,901 |
"""Test adding external statistics from Tibber."""
from unittest.mock import AsyncMock
from homeassistant.components.recorder.statistics import statistics_during_period
from homeassistant.components.tibber.sensor import TibberDataCoordinator
from homeassistant.util import dt as dt_util
from .test_common import CONSUM... | rohitranjan1991/home-assistant | tests/components/tibber/test_statistics.py | Python | mit | 2,649 |
# ex:ts=4:sw=4:sts=4:et
# -*- tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*-
#
# Copyright (c) 2013-2016 Intel Corporation.
# All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 as
# published by the F... | schleichdi2/OPENNFR-6.0-CORE | opennfr-openembedded-core/scripts/lib/wic/partition.py | Python | gpl-2.0 | 17,338 |
# encoding: utf-8
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'DefinedGeography'
db.create_table('seak_definedgeography', (
('id', self.gf('d... | Ecotrust/cogs-priorities | priorities/seak/migrations/0002_auto__add_definedgeography.py | Python | bsd-3-clause | 12,162 |
from django.conf import settings
STATUS_DOWN = 'down'
STATUS_UP = 'up'
# Frequency with which checks will be made to the remote boxes (default is 10 min.)
REMOTE_CHECK_FREQUENCY = getattr(settings, 'RS_REMOTE_CHECK_FREQUENCY', 10 * 60 * 60)
DEFAULT_KEY_FILE = getattr(settings, 'RS_KEY_FILE', None)
DEFAULT_KNOWN_HOSTS... | cooncesean/remotestatus | build/lib/remotestatus/conf.py | Python | mit | 376 |
#!/usr/bin/python
import sys
import pynvc
def reprogramNvmdefault(destination, filename):
MESSAGESIZE = 16
reply = pynvc.sendWithRetryAndCheckedReceive(destination=destination,
command=pynvc.REPRG_OPEN,
allowedReplies=... | wukong-m2m/NanoKong | tools/inteldemo201202/reprogram.py | Python | gpl-2.0 | 3,181 |
from __future__ import absolute_import, unicode_literals
import random
import ssl
from contextlib import contextmanager
from datetime import timedelta
from pickle import dumps, loads
import pytest
from case import ANY, ContextMock, Mock, call, mock, patch, skip
from celery import signature, states, uuid
from celery.... | kawamon/hue | desktop/core/ext-py/celery-4.2.1/t/unit/backends/test_redis.py | Python | apache-2.0 | 23,661 |
"""factory - Tool for creating and managing Docker Machines
factory is a Tool for creating and managing Docker Machines
utilizing docker-machine and integrating with docker-compose
for container orchestration.
:copyright: CopyRight (C) 2015 by James Mills
"""
__author__ = "James Mills, prologic at shortcircuit dot ... | prologic/factory | factory/__init__.py | Python | mit | 413 |
from flask.cli import FlaskGroup
from app import app, db
cli = FlaskGroup(app)
@cli.command("create_db")
def create_db():
db.drop_all()
db.create_all()
db.session.commit()
if __name__ == "__main__":
cli()
| charmasaur/cw | appengine/manage.py | Python | gpl-2.0 | 227 |
import numpy as np
import xgboost as xgb
import sys
import pytest
sys.path.append("tests/python")
import testing as tm
from test_dmatrix import set_base_margin_info
def dmatrix_from_cupy(input_type, DMatrixT, missing=np.NAN):
'''Test constructing DMatrix from cupy'''
import cupy as cp
kRows = 80
kCo... | dmlc/xgboost | tests/python-gpu/test_from_cupy.py | Python | apache-2.0 | 7,484 |
from .auth_pages import AuthPagesTestCase | ivanpenchev/project-starter | project/project/tests/__init__.py | Python | gpl-3.0 | 41 |
# 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... | jhseu/tensorflow | tensorflow/python/keras/metrics_test.py | Python | apache-2.0 | 87,179 |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
import codecs
import csv
import fnmatch
import inspect
import locale
import os
import openerp.sql_db as sql_db
import re
import logging
import tarfile
import tempfile
import threading
from babel.messages import extract
f... | AyoubZahid/odoo | openerp/tools/translate.py | Python | gpl-3.0 | 48,927 |
from .commands import *
from .core import *
from .exceptions import *
| technomaniac/trellio | trellio/management/__init__.py | Python | mit | 70 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.conf import settings
from django.template.response import TemplateResponse
from wagtail.wagtailcore.models import Page
from .utils import check_view_restrictions
class PageLoginRequiredMixin(object):
def dispatch(self, request, *args,... | ychab/privagal | privagal/core/mixins.py | Python | bsd-3-clause | 895 |
#
# Copyright (c) 2011 Bogdano Arendartchuk <bogdano@mandriva.com.br>
#
# Written by Bogdano Arendartchuk <bogdano@mandriva.com.br>
#
# This file is part of Jurt Build Bot.
#
# Jurt Build Bot is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as published
# by... | bhdn/jurt | jurtlib/logger.py | Python | gpl-2.0 | 3,348 |
import sys
from com.l2scoria.gameserver.model.actor.instance import L2PcInstance
from com.l2scoria.gameserver.model.quest import State
from com.l2scoria.gameserver.model.quest import QuestState
from com.l2scoria.gameserver.model.quest.jython import QuestJython as JQuest
qn = "1102_toivortex_red"
#p... | zenn1989/scoria-interlude | L2Jscoria-Game/data/scripts/teleports/1102_toivortex_red/__init__.py | Python | gpl-3.0 | 1,144 |
import random
import string
from six.moves.urllib.parse import urlparse
def region_from_glacier_url(url):
domain = urlparse(url).netloc
if '.' in domain:
return domain.split(".")[1]
else:
return 'us-east-1'
def vault_from_glacier_url(full_url):
return full_url.split("/")[-1]
def ... | botify-labs/moto | moto/glacier/utils.py | Python | apache-2.0 | 427 |
#!/usr/bin/env python
from datetime import timedelta
from ethereum.tools import tester
from ethereum.tools.tester import TransactionFailed
from pytest import raises, fixture
from utils import fix
NO = 0
YES = 1
def captureLog(contract, logs, message):
translated = contract.translator.listen(message)
if not t... | redsquirrel/augur-core | tests/trading/test_claimProceeds.py | Python | gpl-3.0 | 10,171 |
import logging as log
import sys
import getopt
import os
import subprocess
import shutil
import compile
import tests
import util
target = ""
arch = ""
platform = ""
workspace = ""
fullbuilddirpath = ""
cleanUp = True
def ParseArgs(argv):
global target
global platform
global arch
global cleanUp
re... | parjong/coreclr | src/pal/automation/automation.py | Python | mit | 1,613 |
# -*- coding: utf-8 -*-
from __future__ import print_function
from buslinesscrapper.items import BusRouteItem, LineItem
import scrapy
import re
import sys
from scrapy.http import Request
class FenixSpider(scrapy.Spider):
name = "fenix"
allowed_domains = ["www.consorciofenix.com.br"]
start_urls = (
... | bernardotorres/bus-catcher | buslinesscrapper/spiders/fenix.py | Python | gpl-2.0 | 2,355 |
from numpy import *
# derivative of tanh
def dtanh0(x):
return 1 - square(x)
# derivative of normalized tanh
def dtanh(x):
norm = linalg.norm(x)
y = x - power(x, 3)
dia = diag((1 - square(x)).flatten()) / norm
pro = y.dot(x.T) / power(norm, 3)
out = dia - pro
return out
##... | EntilZha/qb | guesser/util/math_util.py | Python | mit | 909 |
"""distutils.pypirc
Provides the PyPIRCCommand class, the base class for the command classes
that uses .pypirc in the distutils.command package.
"""
import os
from ConfigParser import ConfigParser
from distutils.cmd import Command
DEFAULT_PYPIRC = """\
[distutils]
index-servers =
pypi
[pypi]
use... | kubaszostak/gdal-dragndrop | osgeo/apps/Python27/Lib/distutils/config.py | Python | mit | 4,250 |
##########################################################################
#
# Copyright (c) 2008-2015, Image Engine Design Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redis... | goddardl/cortex | test/IECoreMaya/FnParameterisedHolderTest.py | Python | bsd-3-clause | 35,854 |
import logging
logging.basicConfig(level=logging.INFO, format="%(funcName)s\t%(message)s")
class TreeNode(object):
"""
NB: node_link is used to link similar items.
We will also need the parent_node to in order to ascend the
tree.
"""
def __init__(self, name_value, number_ocurrences, parent_nod... | mjamesruggiero/lily | lily/fp_growth.py | Python | apache-2.0 | 5,415 |
#!/usr/bin/python
from usbscanner import ScannerEntity
from dbscanner import DbScanner
from pymongo import MongoClient
from time import localtime, strftime, sleep
import socket
import threading
import json
import datetime
class ClientSocket (threading.Thread):
threads = []
SCANNER_INCOMPLETE = -1
def __i... | keyro90/CyclopeScanning | clientsocket.py | Python | mit | 6,224 |
# -*- coding: UTF-8 -*-
from .window import Window
class Control (Window):
def __init__ (self):
super (Control, self).__init__ ()
self.LabelText = ""
def GetLabelText (self):
return self.LabelText
| unreal666/outwiker | src/test/plugins/source/fakewx/control.py | Python | gpl-3.0 | 234 |
#
# Copyright 2015 Peter Sprygada <psprygada@ansible.com>
#
# This file is part of Ansible
#
# Ansible 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... | ptisserand/ansible | lib/ansible/plugins/action/eos_config.py | Python | gpl-3.0 | 4,248 |
# Created by Greg Elin on 2021-02-03 05:06
from django.db import migrations
def del_experimental_oscal(apps, schema_editor):
SystemSettings = apps.get_model('system_settings', 'SystemSettings')
enable_experimental_oscal = SystemSettings.objects.filter(setting='enable_experimental_oscal').delete()
class Migr... | GovReady/govready-q | system_settings/migrations/0005_delete_20210203_0506.py | Python | gpl-3.0 | 570 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11 on 2017-12-02 07:32
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('assets', '0005_asset_supersedes'),
]
operations = [
migrations.AddField(
... | Pinecast/pinecast | assets/migrations/0006_asset_content_size.py | Python | apache-2.0 | 470 |
#!/usr/bin/python
#CHIPSEC: Platform Security Assessment Framework
#Copyright (c) 2010-2015, Intel Corporation
#
#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.
#
#This program is distr... | andrew-furtak/chipsec | chipsec/hal/acpi_tables.py | Python | gpl-2.0 | 27,985 |
import RPi.GPIO as GPIO
import pygame.camera
import pygame.image
import smtplib
from email.MIMEMultipart import MIMEMultipart
from email.MIMEBase import MIMEBase
from email.MIMEText import MIMEText
from email.Utils import COMMASPACE, formatdate
from email import Encoders
import os
# --- GPIO Setup ---
GPIO.setmode(GP... | Azrrael-exe/RPiPhotoShoot | photo.py | Python | mit | 1,881 |
import unittest
import os
import shutil
import filecmp
import pytest
import marks
import options
import util
from controller.partition import PartitionController
class PartitionControllerTest(unittest.TestCase):
TEST_DATA_PATH = os.path.join(os.getcwd(), 'testdata')
def setUp(self):
self.control... | victorclf/jcc-web | server/test/controller/test_partition.py | Python | agpl-3.0 | 2,710 |
"""
==========================================
Author: Tyler Brockett
Username: /u/tylerbrockett
Description: Alert Bot (Formerly sales__bot)
Date Created: 11/13/2015
Date Last Edited: 12/20/2016
Version: v2.0
==========================================
"""
import praw
im... | tylerbrockett/reddit-bot-buildapcsales | src/bot_modules/reddit_handler.py | Python | mit | 3,944 |
"""Support for Verisure Smartplugs."""
import logging
from time import monotonic
from homeassistant.components.switch import SwitchEntity
from . import CONF_SMARTPLUGS, HUB as hub
_LOGGER = logging.getLogger(__name__)
def setup_platform(hass, config, add_entities, discovery_info=None):
"""Set up the Verisure s... | nkgilley/home-assistant | homeassistant/components/verisure/switch.py | Python | apache-2.0 | 2,311 |
"""Various helper functions"""
import base64
import io
import os
import urllib.parse
from collections import namedtuple
from wsgiref.handlers import format_date_time
from aiopy.required.aiohttp import hdrs, multidict
__all__ = ('BasicAuth', 'FormData', 'parse_mimetype')
class BasicAuth(namedtuple('BasicAuth', ['lo... | lfblogs/aiopy | aiopy/required/aiohttp/helpers.py | Python | gpl-3.0 | 9,973 |
# coding = utf-8
import numpy as np
from skimage.transform import (hough_line, hough_line_peaks, probabilistic_hough_line)
from skimage.feature import canny
from skimage import data
import matplotlib.pyplot as plt
from matplotlib import cm
# 构建测试图像
image = np.zeros((100, 100))
idx = np.arange(25, 75)
image[idx[::-1], ... | Ginkgo-Biloba/Misc-Python | skimage/HoughLine.py | Python | gpl-3.0 | 1,960 |
# -*- coding: utf-8 -*-
"""Created on 23.06.17
.. moduleauthor:: Paweł Pecio
"""
def longzip(a, b):
"""Like `izip` but yields `None` for missing items."""
aiter = iter(a)
biter = iter(b)
try:
for item1 in aiter:
yield item1, next(biter)
except StopIteration:
for item... | ppecio/py-html-diff | pyhtmldiff/utils.py | Python | apache-2.0 | 518 |
from numpy import arange, dtype, int64, float64
from bolt import array, ones
from bolt.utils import allclose
def test_shape(sc):
x = arange(2*3).reshape((2, 3))
b = array(x, sc)
assert b.shape == x.shape
x = arange(2*3*4).reshape((2, 3, 4))
b = array(x, sc)
assert b.shape == x.shape
def test... | bolt-project/bolt | test/spark/test_spark_basic.py | Python | apache-2.0 | 4,090 |
#!/usr/bin/env python
# Copyright (C) 2014:
# Gabes Jean, naparuba@gmail.com
import copy
import time
import threading
from kunai_test import *
from kunai.encrypter import encrypter
class TestEncrypter(KunaiTest):
def setUp(self):
encrypter.load('NTdiN2NlNmE4NTViMTFlNA==')
def test_encryption(s... | pombredanne/kunai-1 | test/test_encryption.py | Python | mit | 583 |
from django.shortcuts import render,HttpResponse
# Create your views here.
def login(request):
content = open("templates/app01/login.html","r").read()
return HttpResponse(content) | dianshen/github | day15/app02/views.py | Python | gpl-3.0 | 188 |
##############################################################################
#
# Copyright (c) 2008-2011 Alistek Ltd (http://www.alistek.com) All Rights Reserved.
# General contacts <info@alistek.com>
#
# WARNING: This program as such is intended to be used by professional
# programmers who take th... | kailIII/emaresa | trunk.pe/report_aeroo_sample/report/__init__.py | Python | agpl-3.0 | 1,498 |
import pygimli as pg
def streamline(mesh, field, startCoord, dLengthSteps, dataMesh=None,
maxSteps=1000, verbose=False, coords=(0, 1)):
"""Create a streamline from start coordinate and following a vector field in up and down direction.
"""
xd, yd, vd = streamlineDir(mesh, field, startCoord,... | gimli-org/gimli | pygimli/utils/streams.py | Python | apache-2.0 | 6,586 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('ewsghana', '0002_ewsextension'),
]
operations = [
migrations.CreateModel(
name='EWSMigrationProblem',
... | qedsoftware/commcare-hq | custom/ewsghana/migrations/0003_ewsmigrationproblem_ewsmigrationstats.py | Python | bsd-3-clause | 1,776 |
# -*- coding: utf-8 -*-
from flask_restful import Resource, marshal_with
from flask_restful_swagger import swagger
from app.mod_shared.models.db import db
from app.mod_profiles.models import TypeUnitValidation
from app.mod_profiles.common.fields.typeUnitValidationFields import TypeUnitValidationFields
from app.mod_pr... | adamantike/salud-api | app/mod_profiles/resources/views/typeUnitValidationView.py | Python | gpl-2.0 | 6,298 |
# -*- coding: utf-8 -*-
# Copyright 2007-2016 The HyperSpy developers
#
# This file is part of HyperSpy.
#
# HyperSpy 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... | francisco-dlp/hyperspy | hyperspy/samfire.py | Python | gpl-3.0 | 24,145 |
#!/usr/bin/env python
from __future__ import absolute_import
import os
import re
import tvdb_api
from collections import namedtuple
from mediator import logger
from mediator.config import settings
class Media(object):
def __init__(self, name):
"""Constructs metadata of all media from name of torrent fi... | blaketmiller/mediator | mediator/media.py | Python | gpl-2.0 | 7,011 |
def main():
sum = 0.0
count = 0
print ("Press [Enter] to exit.")
temp = input("What's the temperature? ")
while temp != "":
sum += float(temp)
count += 1
temp = input("What's the temperature? ")
print("The average temperature is:", sum / count)
if __name__ == '__main... | SeattleCentral/ITC110 | examples/lecture14d.py | Python | mit | 379 |
#!/usr/bin/env python
# The Python version of qwt-*/examples/bode
# Compare the Python and C++ versions of recalc() to get an impression of the
# expressive power of the Numerical Python extensions.
import sys
from qt import *
from Qwt4.Qwt import *
from Qwt4.anynumpy import *
print_xpm = ['32 32 12 1',
... | PyQwt/PyQwt4 | qt3examples/BodeDemo.py | Python | gpl-2.0 | 13,366 |
# -*- coding: utf-8 -*-
#
# django-i18nurl documentation build configuration file, created by
# sphinx-quickstart on Mon Aug 27 11:37:23 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.
... | novapost/django-i18nurl | docs/conf.py | Python | bsd-3-clause | 8,415 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Based on AboutArrays in the Ruby Koans
#
from runner.koan import *
class AboutLists(Koan):
def test_creating_lists(self):
empty_list = list()
self.assertEqual(list, type(empty_list))
self.assertEqual(0, len(empty_list))
def test_list_... | MichaelSEA/python_koans | python3/koans/about_lists.py | Python | mit | 3,442 |
from JumpScale import j
app = j.tools.cuisine._getBaseAppClass()
class CuisineSyncthing(app):
NAME = 'syncthing'
def __init__(self, executor, cuisine):
self._executor = executor
self._cuisine = cuisine
def build(self, start=True, install=True, reset=False):
"""
build an... | Jumpscale/jumpscale_core8 | lib/JumpScale/tools/cuisine/apps/CuisineSyncthing.py | Python | apache-2.0 | 5,434 |
# This file is part of SimuSER.
# SimuSER 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.
# SimuSER is distributed in the hope that i... | nicolas-varaschin/SimuSER | simulador/sensor_manager.py | Python | gpl-3.0 | 2,051 |
from argparse import ArgumentParser
from argparse import ArgumentTypeError
from random import randint
from sys import argv
from functools import partial
from autobahn.twisted.wamp import ApplicationSession
from autobahn.twisted.wamp import ApplicationRunner
from autobahn.wamp.types import PublishOptions
from PyQt5.QtC... | estan/gauges | gauges/gauges_qt.py | Python | mit | 5,598 |
#! python3
# multidownloadXkcd.py - Downloads XKCD comics using multiple threads.
import requests, os, bs4, threading
os.makedirs('xkcd', exist_ok=True) # store comics in ./xkcd
def downloadXkcd(startComic, endComic):
for urlNumber in range(startComic, endComic):
# Download the page.
print('Downlo... | cyberlearner13/techshots13 | automate_online-materials/multidownloadXkcd.py | Python | gpl-2.0 | 1,570 |
import argparse
import os
import numpy as np
import matplotlib.pyplot as plt
from errsim import *
def plot_t_vs_ober(params, fpath=None):
def plot(ax, t, param, **plotargs):
if param['pb'] is None:
param['pb'] = param['pe']
label = 'BSC pe={pe} m={m} n={n}'.format(**param)
... | r-rathi/error-control-coding | perf/plot-t-vs-ober.py | Python | mit | 1,766 |
MARV 2 21 0 33 330 330
MARV 5 01 0 x x 0
MARV 5 02 0 26 300 300
MARV 5 14 0 15 300 300
MARV 5 67 0 33 330 320
MARV 6 16 + 0 0 0 x
MARV 6 46 + 0 33 330 x
MARV 6 49 + 0 x 20 50
MARV 9 01 0 x x 0
MARV 9 06 0 x 330 320
MARV 9 09 0 x 330 320
MARV 9 12 0 33 330 320
| PaulEG/Various-Projects | Kulishinas.py | Python | artistic-2.0 | 260 |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'acq4/analysis/modules/PSPReversal/resultsTemplate.ui'
#
# Created by: PyQt5 UI code generator 5.8.2
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_ResultsDialogBox(object):
... | pbmanis/acq4 | acq4/analysis/modules/PSPReversal/resultsTemplate_pyqt5.py | Python | mit | 1,569 |
import math
import numpy as np
import math
# import pandas
from optparse import OptionParser
from sklearn.tree import DecisionTreeRegressor
from collections import defaultdict
from copy import deepcopy
from multiprocessing import Pool
from itertools import chain
import time
class Ensemble:
def __init__(self, rate)... | saikatgomes/recsys | code/lamdaMART.py | Python | apache-2.0 | 7,445 |
__author__ = 'jjk'
import mp_ephem
Orbfit = mp_ephem.BKOrbit
OrbfitError = mp_ephem.BKOrbitError | OSSOS/MOP | src/ossos/core/ossos/orbfit.py | Python | gpl-3.0 | 97 |
import urllib2
from bs4 import BeautifulSoup,Comment
import re
import json
class Scraper:
def webscraper(self):
url='http://sidbi.in/?q=finance-upgradation-modernisation#overlay-context=front-page%3Fq%3Dfront-page'
print 'scraping %s '%(url)
arr =[]
dict = {}
soup = BeautifulSoup( urllib... | sagar15795/MSME_Scraper | sidbi_finance.py | Python | gpl-2.0 | 2,097 |
"""
Test that Gabble is tolerant of non-RFC-compliance from Facebook.
https://bugs.freedesktop.org/show_bug.cgi?id=68829
"""
from gabbletest import exec_test, XmppXmlStream
import constants as cs
import ns
from twisted.words.xish import xpath
def test(q, bus, conn, stream):
conn.Connect()
# everything is fi... | Ziemin/telepathy-gabble | tests/twisted/connect/disco-facebook.py | Python | lgpl-2.1 | 1,558 |
# Copyright 2020 Ecosoft Co., Ltd. (http://ecosoft.co.th)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from . import sale
| OCA/sale-workflow | sale_cancel_confirm/model/__init__.py | Python | agpl-3.0 | 147 |
# ===============================================================================
# Copyright 2020 ross
#
# 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... | USGSDenverPychron/pychron | pychron/envisage/browser/analysis_browser_model.py | Python | apache-2.0 | 4,909 |
# encoding: utf-8
import sys
sys.path.append(sys.path.insert(0,"../src"))
def urlopen(*args, **kwargs):
# Only parse one arg: the url
return Urls[args[0]]
# Provide a simple hashtable to contain the content of the urls and
# provide a mock object similar to what will be returned from the
# real urlopen() fu... | greezybacon/xmlconfig | test/testImport.py | Python | bsd-3-clause | 4,610 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
'''OpenStack Keystone client BVOX extension.'''
import functools
from keystoneclient import utils
from keystoneclient.v2_0 import shell as v2_shell
from keystoneclient.v2_0 import tenants
from keystoneclient.v2_0 import users
@utils.arg('--by_name', required=False, action=... | bvox/keystoneclient-bvox-extension | keystoneclient_bvox_ext.py | Python | mit | 2,345 |
# Copyright 2012 OpenStack Foundation
# 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 requ... | nttcom/eclcli | eclcli/monitoring/monitoringclient/utils.py | Python | apache-2.0 | 7,680 |
# Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class PyAzote(PythonPackage):
"""Azote is a GTK+3 - based picture browser and background setter,... | iulian787/spack | var/spack/repos/builtin/packages/py-azote/package.py | Python | lgpl-2.1 | 929 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('www', '0005_auto_20151217_0015'),
]
operations = [
migrations.CreateModel(
name='ApplyTask',
fields=... | CalvinNeo/EasyMLPlatform | py/www/www/migrations/0006_auto_20160214_1807.py | Python | apache-2.0 | 755 |
"""List of API endpoints PRAW knows about."""
# flake8: noqa
# fmt: off
API_PATH = {
"about_edited": "r/{subreddit}/about/edited/",
"about_log": "r/{subreddit}/about/log/",
"about_modqueue": "r/{subreddit}/about/modqueue/",
"about_reports": "r/{subreddit}/abo... | praw-dev/praw | praw/endpoints.py | Python | bsd-2-clause | 13,725 |
#!/usr/bin/env python
# Seq_chopper!
from __future__ import print_function
from os import path
# The fasta parser.
import screed
import docopt
import sys
__author__ = "Luisa Teasdale"
CLI_ARGS = """
USAGE:
seq_chopper.py -f SEQFILE -p PARTITIONS
OPTIONS:
-f SEQFILE The multi-species alignment file in fasta f... | lteasdale/ltbio | scripts/seq_chopper.py | Python | mpl-2.0 | 1,942 |
import os
from django.contrib.gis.utils import LayerMapping
from .models import LandCover
landcover_mapping = {
'cover_type' : 'type',
'shape' : 'MULTIPOLYGON',
}
landcover_shp = os.path.abspath(
os.path.join(os.path.dirname(__file__), 'data', 'landcover.shp'),
)
def run(verbose=True):
lm = LayerMapp... | jacobdein/datawaves | server/landscape/load_landcover.py | Python | gpl-3.0 | 473 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.