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 |
|---|---|---|---|---|---|
#-*- coding: utf-8 -*-
# Author: Matt Earnshaw <matt@earnshaw.org.uk>
from __future__ import absolute_import
import os
import sys
import sunpy
from PyQt4.QtGui import QApplication
from sunpy.gui.mainwindow import MainWindow
from sunpy.io.file_tools import UnrecognizedFileTypeError
class Plotman(object):
""" Wraps... | mjm159/sunpy | sunpy/gui/__init__.py | Python | bsd-2-clause | 1,821 |
import os
from ..cache import set_cache, get_cache
from ..show_error import show_error
from .vcs_upgrader import VcsUpgrader
class HgUpgrader(VcsUpgrader):
"""
Allows upgrading a local mercurial-repository-based package
"""
cli_name = 'hg'
def retrieve_binary(self):
"""
Returns... | herove/dotfiles | sublime/Packages/Package Control/package_control/upgraders/hg_upgrader.py | Python | mit | 2,518 |
# -*- coding: utf-8 -*-
# Copyright 2020 Google LLC
#
# 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... | googleapis/python-dialogflow | samples/generated_samples/dialogflow_generated_dialogflow_v2beta1_agents_import_agent_sync.py | Python | apache-2.0 | 1,600 |
# -*- coding: utf-8 -*-
class SSH(object):
""" This class provide ssh-related methods to Bitbucket objects."""
def __init__(self, bitbucket):
self.bitbucket = bitbucket
self.bitbucket.URLS.update(self.URLS)
def all(self):
""" Get all ssh keys associated with your account.
... | affinitic/BitBucket-api | bitbucket/ssh.py | Python | isc | 1,544 |
# fly ArduPlane in SIL
import util, pexpect, sys, time, math, shutil, os
from common import *
from pymavlink import mavutil
import random
# get location of scripts
testdir=os.path.dirname(os.path.realpath(__file__))
HOME_LOCATION='-35.362938,149.165085,585,354'
WIND="0,180,0.2" # speed,direction,variance
homeloc =... | Yndal/ArduPilot-SensorPlatform | ardupilot/Tools/autotest/arduplane.py | Python | mit | 17,552 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "ursa_rest_sqlserver.settings")
try:
from django.core.management import execute_from_command_line
except ImportError:
# The above import may fail for some other reason. Ensu... | LowerSilesians/ursa-rest-sqlserver | ursa_rest_sqlserver/manage.py | Python | apache-2.0 | 817 |
import imaplib
import getpass
IMAP_SERVER_ADDR = '127.0.0.1'
IMAP_SERVER_PORT = 143
def show_emails(server, port, username, password):
mailbox = imaplib.IMAP4(server, port)
resp, msg = mailbox.login(username, password)
if resp != 'OK':
print 'Auth error: %s' % msg[0]
exit(1)
resp, msg = mailbox.select... | damianrusinek/classes-pas | email/get_emails.py | Python | mit | 965 |
from app import db
class Carrera(db.Model):
__tablename__ = 'carrera'
id = db.Column(db.Integer, primary_key=True)
codigo = db.Column(db.String(4), nullable=False, unique=True, server_default='')
nombre = db.Column(db.String(50), nullable=False, server_default='')
plan = db.Column(db.String(4), n... | jennywoites/MUSSA | MUSSA_Flask/app/models/carreras_models.py | Python | gpl-3.0 | 3,752 |
# python3
# ==============================================================================
# Copyright 2020 Google LLC
#
# 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.or... | CloudVLab/professional-services | examples/dialogflow-entities-example/main.py | Python | apache-2.0 | 4,374 |
#!/usr/bin/env python2.7
# -*- coding: utf-8 -*-
# Sanitizer
# Example valid input:
# 3
# 0 1 1
# 1 0 2
# 0 0 1
# (size, then size*size grid)
from sys import exit, stdin
from sol_reference import solveGomoku
if __name__ == '__main__':
# Read grid size
try:
size = int(stdin.readline().strip())
ex... | France-ioi/taskgrader | examples/taskTestchecker/tests/gen/sanitizer.py | Python | mit | 1,917 |
import pytest
from pluggy import PluginManager, PluginValidationError, HookimplMarker, HookspecMarker
hookspec = HookspecMarker("example")
hookimpl = HookimplMarker("example")
def test_argmismatch(pm: PluginManager) -> None:
class Api:
@hookspec
def hello(self, arg):
"api hook 1"
... | pytest-dev/pluggy | testing/test_invocations.py | Python | mit | 5,546 |
from . import Cl, conformalize
layout_orig, blades_orig = Cl(3)
layout, blades, stuff = conformalize(layout_orig)
locals().update(blades)
locals().update(stuff)
# for shorter reprs
layout.__name__ = 'layout'
layout.__module__ = __name__
| arsenovic/clifford | clifford/g3c.py | Python | bsd-3-clause | 240 |
# Copyright 2015-19 ForgeFlow S.L. -
# Jordi Ballester Alomar
# Copyright 2015-19 Serpent Consulting Services Pvt. Ltd. - Sudhir Arya
# Copyright 2018-19 ACSONE SA/NV
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html).
from odoo import fields, models
class MisReportInstance(models.Model):
_inh... | OCA/operating-unit | mis_builder_operating_unit/model/mis_builder.py | Python | agpl-3.0 | 1,748 |
# -*- coding: utf-8 -*-
from setuptools import setup, find_packages
setup(
name='graphmap',
version='0.0.6',
description='Images on a quad graph. Create an infinite canvas',
author='Abhishek Rao',
author_email='abhishek.rao.comm@gmail.com',
url='https://github.com/abhishekraok/GraphMap',
... | abhishekraok/GraphMap | setup.py | Python | apache-2.0 | 456 |
# A set of regression tests for open issues
import cocotb
from cocotb.clock import Clock
from cocotb.triggers import RisingEdge, Timer, ReadOnly
from cocotb.result import TestFailure
from cocotb.binary import BinaryValue
@cocotb.test()
def issue_142_overflow_error(dut):
"""Tranparently convert ints too long to p... | mkreider/cocotb2 | tests/test_cases/issue_142/issue_142.py | Python | bsd-3-clause | 1,044 |
# -*- Mode: python; coding: utf-8; tab-width: 8; indent-tabs-mode: t; -*-
#
# Copyright (C) 2006 - Martin Szulecki
#
# 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, or (at you... | wangd/rhythmbox | plugins/artdisplay/PodcastCoverArtSearch.py | Python | gpl-2.0 | 2,278 |
from __future__ import print_function
import os
debug = os.environ.get("DEBUG", False)
input_directory = "."
output_directory = "."
skip_shows = False
assertions = "raise"
show_timings = True
autodump = None
autodump_file = None
autodiff = None
| LouisePaulDelvaux/Til-Liam | src_liam/config.py | Python | gpl-3.0 | 247 |
# $Id: TestAll.py 1047 2009-01-15 14:48:58Z graham $
#
# Unit testing for WebBrick library functions (Functions.py)
# See http://pyunit.sourceforge.net/pyunit.html
#
import sys, unittest, logging, zipfile, re, StringIO, os, logging, cgi
from os.path import normpath, abspath
sys.path.append("..")
sys.path.append("../cgi... | bhavanaananda/DataStage | src/SubmitDatasetHandler/tests/TestDirectoryListingHandler.py | Python | mit | 3,278 |
# -*- coding: utf-8 -*-
# Kuulemma
# Copyright (C) 2014, Fast Monkeys Oy
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later... | fastmonkeys/kuulemma | tests/views/auth/test_activate_account.py | Python | agpl-3.0 | 2,656 |
from __future__ import division
from libtbx.path import walk_source_tree
from libtbx.str_utils import show_string
from libtbx.utils import Sorry
from libtbx.option_parser import option_parser
from fnmatch import fnmatch
import re
import sys, os
def read_lines_if_possible(file_path):
try: f = open(file_path, "r")
e... | hickerson/bbn | fable/fable_sources/libtbx/command_line/find_files.py | Python | mit | 3,114 |
# -*- coding:utf-8 -*-
import test_core
import demjson
import datetime
test_core.title("登录测试")
f = open("testconfig.json", 'r')
lines = f.read()
f.close()
jsonfiledata = demjson.decode(lines)
if jsonfiledata["url"] == "":
test_core.terr("错误: 'testconfig.json' 配置不完全。")
exit()
uurl = jsonfiledata["url"]+"nyalogin... | cxchope/YashiLogin | tests/test_login.py | Python | mit | 712 |
#!/usr/bin/env python3
'''Test insecure<->secure delegation transitions with NSEC3PARAM changes.'''
import random
from dnstest.test import Test
t = Test()
master = t.server("knot")
zones = t.zone("example.")
t.link(zones, master)
master.dnssec(zones[0]).enable = True
master.dnssec(zones[0]).nsec3 = True
master.dn... | CZ-NIC/knot | tests-extra/tests/ixfr/insec_sec_deleg/test.py | Python | gpl-3.0 | 1,164 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2011 Isaku Yamahata <yamahata@valinux co jp>
# 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
#
# ... | sileht/deb-openstack-nova | nova/block_device.py | Python | apache-2.0 | 2,165 |
# Copyright 2022 UW-IT, University of Washington
# SPDX-License-Identifier: Apache-2.0
"""
This class encapsulates the interactions with
the uwnetid subscription resource.
"""
import logging
from uw_uwnetid.password import get_uwnetid_password
from myuw.dao.term import get_comparison_datetime_with_tz
from myuw.dao im... | uw-it-aca/myuw | myuw/dao/password.py | Python | apache-2.0 | 2,488 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""
This bot applies to wikisource sites to upload text.
Text is uploaded to pages in Page ns, for a specified Index.
Text to be stored, if the page is not-existing, is preloaded from the file used
to create the Index page, making the upload feature independent from the forma... | hasteur/g13bot_tools_new | scripts/wikisourcetext.py | Python | mit | 6,576 |
#!/usr/bin/env python
# Copyright 2015 Google, Inc.
# Routines for the dual battery charging
# Author: TaiWen Ko
# Date: 2015-1-13
import xpf6020
import bk8500
from datetime import datetime
from time import sleep
import tools.utils as tools
from tools import shell
import twk_utils
import sys
utils = twk_utils.Twk_uti... | taiwenko/python | battery/new_batt_charging_rev1.py | Python | mit | 8,336 |
# Copyright 2009-2013 Justin Riley
#
# This file is part of StarCluster.
#
# StarCluster is free software: you can redistribute it and/or modify it under
# the terms of the GNU Lesser General Public License as published by the Free
# Software Foundation, either version 3 of the License, or (at your option) any
# later ... | Courtagen/StarCluster | starcluster/spinner.py | Python | gpl-3.0 | 2,981 |
# -*- coding: utf-8 -*-
u"""
Copyright 2015 Telefónica Investigación y Desarrollo, S.A.U.
This file is part of Toolium.
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/lic... | Telefonica/toolium-examples | web_behave/steps/multiple_drivers.py | Python | apache-2.0 | 1,706 |
from tkinter import *
from tkinter.ttk import *
class NavBar(Menu):
"""
This Widget controls the nav bar options and selection
"""
def __init__(self, master_frame):
super().__init__(master_frame.root)
self.parent = master_frame.root
self.master = master_frame
self.file_... | crazcalm/Py3.4_exploration | Tk_practice/Tutorial/SimpleTextEditorTutorial/navBarSection.py | Python | mit | 1,586 |
# -*- coding: utf-8 -*-
#
# Picard, the next-generation MusicBrainz tagger
#
# Copyright (C) 2011 Lukáš Lalinský
# Copyright (C) 2017-2018 Sambhav Kothari
# Copyright (C) 2018 Vishal Choudhary
# Copyright (C) 2018-2019 Laurent Monin
# Copyright (C) 2018-2020 Philipp Wolfer
#
# This program is free software; you can red... | Sophist-UK/Sophist_picard | picard/acoustid/__init__.py | Python | gpl-2.0 | 10,124 |
from optparse import OptionParser
import importlib, time
class CodeTester:
def __init__(self, options, args):
self.objects = []
self.options = options
self.module = options.module
self.args = args
self.avgs = []
self.moduleObj = None
self.tests_results = []
... | AlexMog/CodePerfComparator | src/compare.py | Python | mit | 4,159 |
from setuptools import setup, find_packages
requires = [
"pyramid",
"SQLAlchemy >= 1.4",
"transaction",
"pyramid_tm",
"zope.sqlalchemy >= 1.3",
"waitress",
"cryptography>=0.5.dev1",
"pyOpenSSL>=0.14",
"python-dateutil",
]
deplinks = []
setup(
name="caramel",
version="1.9.2... | ModioAB/caramel | setup.py | Python | agpl-3.0 | 2,149 |
# Copyright 2013 Daniel Narvaez
#
# 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 writi... | dnarvaez/osbuild | osbuild/build.py | Python | apache-2.0 | 5,746 |
"""
A Simple server used to show deli images.
"""
import flask
from .flask_utils import open_app
# Set the project root directory as the static folder.
app = flask.Flask(__name__, static_url_path='')
@app.route('/static/flot/<path:filename>')
def send_flot_files(filename):
return flask.send_from_directory('sta... | tonysyu/deli | deli/app/js/main.py | Python | bsd-3-clause | 772 |
from pyparsing import ParseException
class EDTFParseException(ParseException):
pass
| ixc/python-edtf | edtf/parser/edtf_exceptions.py | Python | mit | 90 |
from __future__ import unicode_literals
import itertools
import json
import re
from .common import InfoExtractor, SearchInfoExtractor
from ..utils import (
compat_urllib_parse,
compat_urlparse,
clean_html,
int_or_none,
)
class YahooIE(InfoExtractor):
IE_DESC = 'Yahoo screen and movies'
_VALI... | riking/youtube-dl | youtube_dl/extractor/yahoo.py | Python | unlicense | 7,264 |
#!/usr/bin/env python3
# Copyright (c) 2015-2020 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Utilities for manipulating blocks and transactions."""
import struct
import time
import unittest
from... | instagibbs/bitcoin | test/functional/test_framework/blocktools.py | Python | mit | 9,570 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9 on 2016-01-19 18:14
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
('crowdsourcing', '0067_auto_20160112_2225')... | aginzberg/crowdsource-platform | mturk/migrations/0001_initial.py | Python | mit | 2,578 |
# -*- coding: utf-8 -*-
from django.shortcuts import render
from django.http import (HttpResponse, HttpResponseRedirect)
from django.contrib.auth.views import (login, logout)
from django.contrib.auth.forms import UserCreationForm
from django.contrib import messages
from django.contrib.auth.decorators import login_requ... | creamidea/Mushroom | NodeSite/NodeSite/mushroom/views.py | Python | mit | 713 |
# Copyright (C) 2013 Joshua L. Adelman
#
# This file is part of WESTPA.
#
# WESTPA 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.
#
# ... | KarlTDebiec/westpa | src/westext/stringmethod/string_driver.py | Python | gpl-3.0 | 10,149 |
#-*- coding: utf-8 -*-
from django.http import HttpResponseRedirect
from django.shortcuts import render_to_response
from django.template import RequestContext
from django.contrib import auth
from django.contrib.auth.decorators import login_required
from django.contrib.auth.models import User
from oauth2app.models imp... | hiidef/oauth2app | examples/mysite/apps/account/views.py | Python | mit | 2,659 |
#!/usr/bin/env python
'''
Project Euler
Problem 004 - Largest palindrome product
Haoliang Wang
01/27/2015
'''
'''
Description:
Find the largest palindrome made from the product of two 3-digit numbers.
Solution:
906609
'''
def is_palindrome(n):
return str(n) == str(n)[::-1]
s = 0
for... | haoliangx/Project-Euler | src/P-004.py | Python | gpl-2.0 | 493 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import rospy
from pnp_plugin_server.pnp_simple_plugin_server import PNPSimplePluginServer
from pnp_msgs.msg import ActionResult
from pepper_route_description.msg import RouteDescriptionAction, RouteDescriptionResult
from pymongo import MongoClient
from std_msgs.msg import... | cdondrup/pepper_planning | pepper_route_description/scripts/describe_route.py | Python | mit | 7,996 |
# -*- coding: utf-8 -*-
#
# CommonsDownloader documentation build configuration file, created by
# sphinx-quickstart on Sat Jan 17 20:09:34 2015.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated f... | Commonists/CommonsDownloader | docs/conf.py | Python | mit | 8,607 |
# -*- coding: utf-8 -*-
# Copyright © 2017 Kevin Thibedeau
# Distributed under the terms of the MIT license
import os
import math
def rounded_corner(start, apex, end, rad):
# Translate all points with apex at origin
start = (start[0] - apex[0], start[1] - apex[1])
end = (end[0] - apex[0], end[1] - apex[1])
... | SymbiFlow/symbolator | nucanvas/shapes.py | Python | mit | 15,247 |
from kapal.algo import *
from kapal.world import *
from kapal.state import *
import kapal.tools
import time
# TODO: walk through example with comments
# TODO: post this example on wiki as a tutorial
n = 50 # width/height of world
c = kapal.tools.rand_cost_map(n, n, min_val=1, max_val=3, flip=True)
w = World2d(c,... | elben/kapal | examples/simple01.py | Python | mit | 634 |
#!/usr/bin/env python
# -*- coding: Latin-1 -*-
"""
This is the main module, the main interface classes and functions
are available in the top level hid package
"""
from __future__ import absolute_import
from __future__ import print_function
import sys
import ctypes
import threading
import collections
if sys.version_... | anonimoanemico/opentension | lib/pywinusb/pywinusb/hid/core.py | Python | gpl-3.0 | 64,798 |
#! /usr/bin/env python
import h5py
import scipy as sp
import numpy as np
import time
import pickle
import sys
import math
import cmath
from os import path
import os, sys
sys.path.append('../../')
from mycolor_fun import *
cwd = os.getcwd()
abs_error_limit = 0.05;
rel_error_limit = 0.05;
benchmark_PC_coef = h5p... | BorisJeremic/Real-ESSI-Examples | stochastic_FEM/stochastic_wave_propagation/elastic/comparison.py | Python | cc0-1.0 | 2,067 |
# -*- coding: utf-8 -*-
class ContainerModel(object):
"""Model of Container, representation saved on disk.
This class has no logic. Its only purpose is to contains data about
a container and the related custom user settings.
It includes container's id and container's name, as well as user preference
... | Bajoo/client-pc | bajoo/container_model.py | Python | gpl-3.0 | 1,464 |
# -*- coding: utf-8 -*-
#
# This file is part of Invenio.
# Copyright (C) 2015-2018 CERN.
#
# Invenio is free software; you can redistribute it and/or modify it
# under the terms of the MIT License; see LICENSE file for more details.
"""Module tests."""
from __future__ import absolute_import, print_function
from da... | tiborsimko/invenio-accounts | tests/test_tasks.py | Python | mit | 3,585 |
# (C) British Crown Copyright 2011 - 2018, Met Office
#
# This file is part of cartopy.
#
# cartopy is free software: you can redistribute it and/or modify it under
# the terms of the GNU Lesser General Public License as published by the
# Free Software Foundation, either version 3 of the License, or
# (at your option)... | pelson/cartopy | lib/cartopy/mpl/patch.py | Python | lgpl-3.0 | 8,401 |
# Download the Python helper library from twilio.com/docs/python/install
from twilio.rest import Client
# Your Account Sid and Auth Token from twilio.com/user/account
account_sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
auth_token = "your_auth_token"
client = Client(account_sid, auth_token)
account = client.api.accoun... | teoreteetik/api-snippets | rest/subaccounts/creating-subaccounts-example-1/creating-subaccounts-example-1.6.x.py | Python | mit | 377 |
"""
TKinter based ground station
"""
import os
import time
import random
import threading
import Queue
import csv
from argparse import ArgumentParser
from pymavlink import mavutil
import simplekml
import Tkinter
import tkMessageBox
# list of message types that will be used
MSG_TYPE_RADIO = 1
MSG_TYPE_HEARTBEAT = 2
M... | adrnp/SSMGS | visual-groundstation.py | Python | mit | 28,310 |
# -*- coding: utf-8 -*-
from __future__ import annotations
import sys
from typing import TYPE_CHECKING
from PyQt5.QtGui import QIcon, QMovie, QPixmap
from PyQt5.QtWidgets import QSystemTrayIcon
if TYPE_CHECKING:
from gridsync.gui import Gui
from gridsync import resource, settings
from gridsync.gui.menu import M... | gridsync/gridsync | gridsync/gui/systray.py | Python | gpl-3.0 | 2,343 |
# This file is part of Buildbot. Buildbot 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 distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without eve... | pmisik/buildbot | master/buildbot/test/unit/test_janitor_configurator.py | Python | gpl-2.0 | 4,167 |
# This script is actually for Cyber Security on Windows 7. Should mostly work
# for Windows 8 and 10 too. I just absolutely hate using Windows 8 and refuse
# to test it on any Windows 8 machine.
from __future__ import print_function
from subprocess import call
from subprocess import check_output
import os
###########... | road2ge/cyber-defense-scripts | main-for-windows.py | Python | gpl-3.0 | 9,651 |
# -*- coding: utf-8 -*-
#
#
# Author: Nicolas Bessi
# Copyright 2013-2014 Camptocamp SA
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# Licen... | damdam-s/account-invoice-reporting | base_comment_template/__openerp__.py | Python | agpl-3.0 | 1,115 |
from httmock import HTTMock
import json
import unittest
from flask import url_for
from app import create_app, db
from app.models import User, Arc
from . import utils
class TestChex(unittest.TestCase):
def setUp(self):
self.app = create_app('testing')
self.app_context = self.app.app_context()
... | kronosapiens/thena | thena/tests/test_chex.py | Python | gpl-2.0 | 2,452 |
from urllib.parse import urljoin
from django.contrib import messages
from django.db import models
from django.db.models.functions import (
Cast, Concat
)
from django.http import HttpResponseRedirect
from django.template.response import TemplateResponse
from django.views import View
from django.views.decorators.csr... | seanballais/botos | core/views/admin/admin.py | Python | gpl-3.0 | 6,318 |
# -*- coding: UTF-8 -*-
# Copyright 2011-2017 Luc Saffre
# License: BSD (see file COPYING for details)
"""Model mixins for this plugin.
"""
from __future__ import unicode_literals
from builtins import object
import logging
logger = logging.getLogger(__name__)
from django.db import models
from django.utils.transla... | khchine5/lino | lino/modlib/users/mixins.py | Python | bsd-2-clause | 12,688 |
"""
Classes for char-to-int mapping and int-to-int mapping.
:Author: James Taylor (james@bx.psu.edu)
The char-to-int mapping can be used to translate a list of strings
over some alphabet to a single int array (example for encoding a multiple
sequence alignment).
The int-to-int mapping is particularly useful for crea... | bxlab/bx-python | lib/bx/seqmapping.py | Python | mit | 2,856 |
from __future__ import absolute_import
__all__ = ('Device', )
from sentry.interfaces.base import Interface, InterfaceValidationError
from sentry.utils.safe import trim, trim_dict
class Device(Interface):
"""
An interface which describes the device.
>>> {
>>> "name": "Windows",
>>> "vers... | jean/sentry | src/sentry/interfaces/device.py | Python | bsd-3-clause | 1,495 |
"""
Weighting functions
-------------------
Module which depends on density_assignation module and creates some util
functions for the computation of weighted values.
This function can act as a compute_characs function.
"""
from density_assignation import from_distance_to_weights, compute_measure_i
def create_weig... | tgquintela/pySpatialTools | pySpatialTools/FeatureManagement/Interpolation_utils/weighting_functions.py | Python | mit | 1,198 |
#!/usr/bin/env python
# coding=utf-8
"""todotxt-machine
Usage:
todotxt-machine
todotxt-machine TODOFILE [DONEFILE]
todotxt-machine [--config FILE]
todotxt-machine (-h | --help)
todotxt-machine --version
todotxt-machine --show-default-bindings
Options:
-c FILE --config=FILE Path to your to... | rpesche/todotxt-machine | todotxt_machine/cli.py | Python | gpl-3.0 | 5,012 |
import wandb
import multiprocessing
def mp_func():
"""This needs to be defined at the module level to be picklable and sendable to
the spawned process via multiprocessing"""
print("hello from the other side")
def main():
wandb.init()
context = multiprocessing.get_context("spawn")
p = context... | wandb/client | tests/utils/test_mod.py | Python | mit | 391 |
from easypy.humanize import from_hexdump, hexdump, IndentableTextBuffer, format_table
_SAMPLE_DATA = b'J\x9c\xe8Z!\xc2\xe6\x8b\xa0\x01\xcb\xc3.x]\x11\x9bsC\x1c\xb2\xcd\xb3\x9eM\xf7\x13`\xc8\xce\xf8g1H&\xe2\x9b' \
b'\xd1\xa8\xfd\x14\x08U\x175\xc7\x03q\xac\xda\xe6)q}}T44\x9e\xb5;\xf1.\xf6*\x16\xba\xe0~m\x96o\xb... | weka-io/easypy | tests/test_humanize.py | Python | bsd-3-clause | 3,712 |
# Copyright 2017 the Isard-vdi project authors:
# Josep Maria Viñolas Auquer
# Alberto Larraz Dalmases
# License: AGPLv3
#!/usr/bin/env python
# coding=utf-8
class CategoryNotFound(Exception):
pass
class GroupNotFound(Exception):
pass
class UserTemplateNotFound(Exception):
pass
class Temp... | isard-vdi/isard | webapp/webapp/webapp/lib/viewer_exc.py | Python | agpl-3.0 | 805 |
# 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... | stefanwebb/tensorflow-models | tensorflow_models/relaxed_onehot_categorical_fixed_noise.py | Python | mit | 23,164 |
#
# fedora.py
#
# Copyright (C) 2007 Red Hat, Inc. 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 as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later versi... | maxamillion/anaconda | pyanaconda/installclasses/fedora.py | Python | gpl-2.0 | 1,974 |
from ..helpers import assert_equal
from subprocess import Popen, PIPE
import json
def test_tagging():
p = Popen('echo hello | logtag --no-stamp -t handbags',
shell=True,
stdout=PIPE,
stdin=PIPE)
data_out, _ = p.communicate()
assert_equal({'@message': 'hello', '@tag... | nickstenning/tagalog | test/integration/test_commandline.py | Python | mit | 1,096 |
#!/usr/bin/env python
# coding=utf-8
import sys
import time
import serial
from PIL import Image
MAXWIDTH = 500
if len(sys.argv) != 2:
print("Usage:\n\t./sendImage image")
quit()
im = Image.open(sys.argv[1])
im = im.convert('RGB')
# resize to at most MAXWIDTH wide
if im.width > MAXWIDTH:
wpercent = (MA... | tofergregg/IBM-Wheelwriter-Hack | software/python_scripts/sendImage.py | Python | mit | 3,020 |
# -*- coding: utf-8 -*-
# © 2014-2016 Oihane Crucelaegui - AvanzOSC
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html
from . import crm_claim
from . import project
| alfredoavanzosc/odoo-addons | project_claims/models/__init__.py | Python | agpl-3.0 | 181 |
import os
import boto3
import sys
from datetime import datetime
from dateutil.tz import tzutc
from ._version import __version__
from . import create_logger
logger = create_logger(__name__)
if boto3.session.Session().get_credentials() is None:
logger.info('Please provide AWS credentials.')
sys.exit(-1)
# A... | 4dn-dcic/tibanna | tibanna/vars.py | Python | mit | 5,249 |
from django.contrib import admin # noqa
from .models import ScheduleItem
admin.site.register(ScheduleItem)
| akshayaurora/junction | junction/schedule/admin.py | Python | mit | 110 |
#
# exception.py - general exception formatting and saving
#
# Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 Red Hat, Inc.
# 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 as published by
# the Free Sof... | icomfort/anaconda | exception.py | Python | gpl-2.0 | 5,107 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
In order to use this lib, you have to call the method 'get_shipping_label'
with the right arguments. To know which keys to send to this method read these lists :
- required fields
- fields
"""
from datetime import datetime
import re
from suds.client import Client,... | florian-dacosta/chronopost | chronopost_api/chronopost.py | Python | agpl-3.0 | 11,111 |
log_filename="/tmp/fmbt.test.aal-python.mycounter.log"
file(log_filename, "w").close()
def log(msg):
file(log_filename, "a").write(msg + "\n")
def foo():
pass
def direction_changed(i):
log('change direction on value %s' % (i,))
log(' dec called: %s' % (dec_called,))
| pyykkis/fMBT | test/aalpython/mycounter.py | Python | lgpl-2.1 | 289 |
# -*- coding: utf-8 -*-
class AutocompleteMeta:
"""
Simple meta class to allow the model to define aspects of the autocomplete.
:var name: used for the named url
:var path: the path to autocomplete view
:var follow_fks: when searching should ForeignKey fields be followed.
:var fields: list of... | darrylcousins/django-autocomplete | django_autocomplete/meta.py | Python | apache-2.0 | 1,979 |
from typing import Dict, Optional
from zerver.lib.url_preview.parsers.base import BaseParser
class GenericParser(BaseParser):
def extract_data(self) -> Dict[str, Optional[str]]:
return {
'title': self._get_title(),
'description': self._get_description(),
'image': self._... | tommyip/zulip | zerver/lib/url_preview/parsers/generic.py | Python | apache-2.0 | 1,605 |
#!/usr/bin/env python
from setuptools import setup, find_packages
try:
with open('VERSION.txt', 'r') as v:
version = v.read().strip()
except FileNotFoundError:
version = '0.0.0.dev0'
with open('DESCRIPTION', 'r') as d:
long_description = d.read()
setup(
name='tukio',
description='An even... | optiflows/tukio | setup.py | Python | apache-2.0 | 1,060 |
from django.db import models
class PrintFormat(models.Model):
"""Форматы печати"""
name = models.CharField('Название', max_length=16)
denominator = models.IntegerField(
'Знаменатель',
help_text='Знаменатель для получения количества полос из условного А1')
def __str__(self):
re... | caroten/omicalc | src/utils/models.py | Python | apache-2.0 | 2,556 |
""" Module containing all the possible exceptions that dogapi can raise.
It should be safe to do a `from dogapi.exceptions import *`
"""
import socket
__all__ = [
'DatadogException',
'UnknownDelivery',
'ClientError',
'HttpTimeout',
'HttpBackoff',
'ApiError',
'timeout_exceptions',
]
class DatadogException(Exc... | DataDog/dogapi | src/dogapi/exceptions.py | Python | bsd-3-clause | 670 |
# -*- coding: 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 'Reference_Domain'
db.create_table(u'django_reference_data_reference_domain', (
(... | jonathanmorgan/django_reference_data | migrations/0001_initial.py | Python | gpl-3.0 | 4,641 |
import webapp2
import jinja2
import os
import logging
from google.appengine.api import users
from apiclient.discovery import build
from oauth2client.contrib.appengine import OAuth2Decorator
profileauthdecorator = OAuth2Decorator(
client_id='314326393426-6bvmm9sds571kgnnd3k886i1sjq7co82.apps.googleusercont... | benfinkelcbt/CPD200 | CPD200-Lab06-Python/main.py | Python | gpl-3.0 | 2,260 |
import os
from setuptools import setup, find_packages
def read(*paths):
"""Build a file path from *paths* and return the contents."""
with open(os.path.join(*paths), 'r') as f:
return f.read()
setup(
name='smashbenchmarking',
version='1.0.1',
packages=find_packages(exclude=["tests*","scri... | amplab/smash | setup.py | Python | bsd-2-clause | 1,354 |
# This code is so you can run the samples without installing the package
import sys
import os
sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..'))
#
testinfo = "s, t 0.5, s, t 1.5, s, t 2.1, s, q"
tags = "Layer, RotateBy"
import summa
from summa.director import director
from summa.actions import RotateBy... | shackra/thomas-aquinas | tests/test_layer_rotate.py | Python | bsd-3-clause | 630 |
#
# OSIS stands for Open Student Information System. It's an application
# designed to manage the core business of higher education institutions,
# such as universities, faculties, institutes and professional schools.
# The core business involves the administration of students, teachers,
# courses, progr... | uclouvain/OSIS-Louvain | base/business/education_groups/publication_contact.py | Python | agpl-3.0 | 4,006 |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from . import cbi
from . import account_bank_statement_import_cbi
| Comunitea/CMNT_004_15 | project-addons/account_bank_statement_import_cbi/wizard/__init__.py | Python | agpl-3.0 | 166 |
from datetime import datetime, timedelta
import sys
try:
from urllib.parse import urlencode
except ImportError:
from urllib import urlencode
import django
from django.conf import settings
from django.contrib import auth
from django.contrib.auth.models import User
from django.contrib.sessions.backends.base impo... | jmp0xf/django-user-sessions | tests/tests.py | Python | mit | 14,675 |
import os
from StringIO import StringIO
import pickle
import sqlite3
from python_zipcodes.exceptions import ImproperlyConfiguredError
from python_zipcodes.django_app.zipcodes.models import ZipCode
class DummyStorage(object):
def __init__(self, *args, **kwargs):
try:
self.importer = kwargs['impo... | fcurella/python_zipcodes | python_zipcodes/storages.py | Python | mit | 3,958 |
import os
import random
MIN = 1
MAX = 6
def main():
again = 'y'
while again == 'y' or again == 'Y':
print('Rolling the dice ...')
print('Their values are:')
print(random.randint(MIN, MAX))
print(random.randint(MIN, MAX))
again = str(raw_input('Roll them again? (y - yes)... | bradyhouse/house | fiddles/python/template/script.py | Python | mit | 347 |
import gzip
import sys
opener = gzip.open
if __name__ == '__main__':
f = gzip.open(sys.argv[1], "wt")
f.write(' '.join(sys.argv[1]))
f.close()
| devak23/python | reader/compressed/gizpped.py | Python | mit | 150 |
# Copyright (c) 2016, Science and Technology Facilities Council
# This software is distributed under a BSD licence. See LICENSE.txt.
"""
Tests for mrcfile validation functions.
"""
# Import Python 3 features for future-proofing
from __future__ import (absolute_import, division, print_function,
... | ccpem/mrcfile | tests/test_validation.py | Python | bsd-3-clause | 24,573 |
class Solution:
def buddyStrings(self, A: str, B: str) -> bool:
if len(A) != len(B):
return False
swap = 0
sa, sb = None, None
for a, b in zip(A, B):
if a == b:
continue
if swap > 1 or (sa and (sa != b or sb != a)):
... | pterodragon/programming | Python/leetcode/Buddy String/solution.py | Python | mit | 434 |
from os import environ
# if you set a property in SESSION_CONFIG_DEFAULTS, it will be inherited by all configs
# in SESSION_CONFIGS, except those that explicitly override it.
# the session config can be accessed from methods in your apps as self.session.config,
# e.g. self.session.config['participation_fee']
SESSION_... | anthropo-lab/XP | EPHEMER/dill_resp_project/settings.py | Python | gpl-3.0 | 2,310 |
import sys
import pkg_resources
import sphinx_rtd_theme
extensions = [
'sphinx.ext.autodoc',
'sphinx.ext.intersphinx',
'sphinx.ext.viewcode',
'sphinx.ext.napoleon'
]
templates_path = ['_templates']
master_doc = 'index'
project = 'bottom'
copyright = '2016, Joe Cross'
author = 'Joe Cross'
try:
r... | numberoverzero/bottom | docs/conf.py | Python | mit | 1,217 |
import os
import platform
class TBBTarballVerificationError(Exception):
pass
class TBBSigningKeyImportError(Exception):
pass
class TBBGetRecommendedVersionError(Exception):
pass
class DumpcapTimeoutError(Exception):
pass
env_vars = os.environ
# whether we're running on Travis CI or not
running... | pankajb64/webfp-crawler-phantomjs | tor-browser-crawler-webfp-paper/common.py | Python | gpl-2.0 | 7,072 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright: (c) 2018, Abhijeet Kasurde <akasurde@redhat.com>
# 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... | caphrim007/ansible | lib/ansible/modules/cloud/vmware/vmware_host_config_manager.py | Python | gpl-3.0 | 7,992 |
#! /usr/bin/python3
# This class defines a "BeerEntry" object.
class BeerEntry:
def __init__(self):
self.__name = ""
self.__brewery = ""
self.__rating = 0
self.__gps = [0.0, 0.0]
def __str__(self):
return("Beer: " + self.getName() +\
"\nBrewery: " +... | tjhughes1990/tjhughes1990.github.io | beergps/BeerEntry.py | Python | gpl-3.0 | 1,060 |
#
# Copyright (C) 2018 University of Oxford
#
# This file is part of msprime.
#
# msprime 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 versio... | shajoezhu/msprime | tests/test_recombination_map.py | Python | gpl-3.0 | 17,689 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.