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 |
|---|---|---|---|---|---|
#!/usr/bin/env python
#
# Copyright 2007 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law o... | ychen820/microblog | y/google-cloud-sdk/platform/google_appengine/google/appengine/api/taskqueue/taskqueue_stub.py | Python | bsd-3-clause | 85,134 |
import sys
import string
import logging
from util import mapper_logfile
logging.basicConfig(filename=mapper_logfile, format='%(message)s',
level=logging.INFO, filemode='w')
def mapper():
'''
For this exercise, compute the average value of the ENTRIESn_hourly column
for different weath... | myselfHimanshu/Udacity-DataML | Intro-To-Data-Science/Lesson5/PS5_2_mapper.py | Python | gpl-2.0 | 2,430 |
# -*- coding: utf-8 -*-
#
# Copyright (c) 2017 Red Hat
# Licensed under The MIT License (MIT)
# http://opensource.org/licenses/MIT
#
from pdc_client.test_helpers import CLITestCase
from pdc_client.runner import Runner
class BaseProductTestCase(CLITestCase):
def setUp(self):
self.runner = Runner()
... | product-definition-center/pdc-client | tests/base_product/tests.py | Python | mit | 3,651 |
from sidr.api import Resource, current_user, login_required, role_required
from sidr import models, const
class DomainResource(Resource):
method_decorators = [role_required(const.ROLE_ADMIN)]
def post(self, obj_id=None):
return self.respond(models.Domain.af_save(current_user, self.get_request(), obj_... | oiime/sidr | sidr/resources/domain.py | Python | gpl-2.0 | 1,112 |
#!/usr/bin/env python
# SPDX-License-Identifier: BSD-3-Clause
#
# Module to load A2I (AdlibTracker 2) instrument files.
#
import sys
import struct
HEADER_STRING = "_A2ins_"
class BitReader:
def __init__(self, data):
self.data = data
self.index = 0
self.byte = 0
self.byte_bit = 0
def read_byte(self):
if ... | CWolfRU/freedoom | lumps/genmidi/a2i_file.py | Python | bsd-3-clause | 4,222 |
# Service
| ganga-devs/ganga | ganga/GangaService/Lib/ServiceAPI/__init__.py | Python | gpl-3.0 | 10 |
from nose.tools import assert_equal, assert_not_equal
from api.services.assignment_service import AssignmentService
from core.experiment import Experiment, Variant
from storage.dict import DictStorage
class TestAssignmentService(object):
def test_when_variants_are_changed_existing_assignments_stay_the_same(self... | barakschiller/experiment | tests/services/test_assignment_service.py | Python | bsd-3-clause | 1,960 |
# -*- coding: utf-8 -*-
import os
import time
import logging
import string
import requests
import unicodedata
import base64
try: import cPickle as pickle
except: import pickle
import datetime
from django.utils import timezone
import json
from pprint import pprint
from django.shortcuts import render_to_response
fr... | followyourheart/cloudly | vms/views.py | Python | mit | 39,971 |
# -*- coding: utf-8 -*-
# -----------------------------------------------------------------------------
# Copyright © 2009- The Spyder Development Team
#
# Licensed under the terms of the MIT License
# (see LICENSE.txt for details)
# -----------------------------------------------------------------------------
"""Provi... | sserrot/champion_relationships | venv/Lib/site-packages/qtpy/QtSvg.py | Python | mit | 704 |
#!/usr/bin/env python
# coding: utf-8
from setuptools import setup, find_packages
import sys
import wp2md.authoring
from wp2md.version import get_version
setup(
name='wp2md',
description='A script to convert Wordpress XML dumps to plain text/markdown files.',
version=get_version(),
license=wp2md.autho... | dreikanter/wp2md | setup.py | Python | gpl-3.0 | 1,195 |
#!/usr/bin/env python
"""
The purpose of this example is to show what happens when we modify elements
while iterating. What is the moral of this example? DONT DO IT. Do not modify
data structures while you are iterating them. Mind you that python,unlike
other languages like Java,will not protect you in the least from ... | veltzer/demos-python | src/examples/short/iteration/iterator_with_modification.py | Python | gpl-3.0 | 4,817 |
#!/usr/bin/env python
#-*- coding:utf-8 -*-
class moduint(object):
def __init__(self, arg):
self.arg = long(arg) % self.__class__.limit
assert(self.arg >= 0 and self.arg < self.__class__.limit)
def __repr__(self):
return self.__class__.__name__ + '(' + hex(self.arg) + ')'
def __h... | rom1sqr/miasm | miasm2/expression/modint.py | Python | gpl-2.0 | 5,681 |
from codeschool.tests import *
# No UI testing in here! | jonnatas/codeschool | src/codeschool/ui_tests/test_ui.py | Python | gpl-3.0 | 56 |
# Generated by Django 2.2.6 on 2019-11-27 08:49
from django.db import migrations
def migrate_plans(apps, schema_editor):
Schedule = apps.get_model('club', 'Schedule')
schedules = Schedule.objects.filter(method='payu-re')
schedules.filter(plan__interval=30).update(monthly=True)
schedules.filter(plan__... | fnp/wolnelektury | src/club/migrations/0016_migrate_plans.py | Python | agpl-3.0 | 627 |
"""
This module updates the qiprofile database Subject pathology information
from the pathology Excel workbook file.
"""
from qirest_client.model.clinical import (
Surgery, BreastSurgery, BreastPathology, ModifiedBloomRichardsonGrade,
ResidualCancerBurden, HormoneReceptorStatus, BreastGeneticExpression
)
from .... | ohsu-qin/qipipe | qipipe/qiprofile/breast_pathology.py | Python | bsd-2-clause | 5,899 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import
import mock
from datetime import timedelta
from django.utils import timezone
from sentry.buffer.base import Buffer
from sentry.models import Group, Organization, Project, Release, ReleaseProject, Team
from sentry.testutils import TestCase
class BufferT... | gencer/sentry | tests/sentry/buffer/base/tests.py | Python | bsd-3-clause | 2,907 |
########################################################################################################################
# guiFunctions - shared functions across the Sonospy GUI project.
########################################################################################################################
# guiFunctio... | henkelis/sonospy | sonospy/gui/guiFunctions.py | Python | gpl-3.0 | 16,891 |
"""Testing helper functions."""
import json
IGNORED_FILES = [
'assets/css/main.scss',
'feed.xml',
'feed.xml',
'feed.xslt.xml',
'_pages/404.md',
'_site-validation/site-validation.md',
'_pages/site-validation.md',
'articles/index.html',
'_pages/cidrblock.md',
'_pages/jedelman8.md'... | netsysops/netsysops.github.io | tests/helpers.py | Python | mit | 488 |
import pytest
from tests.actions.support.refine import get_events, filter_dict
from tests.support.asserts import assert_move_to_coordinates
@pytest.mark.parametrize("click_pause", [0, 200])
def test_dblclick_at_coordinates(session, test_actions_page, mouse_chain, click_pause):
div_point = {
"x": 82,
... | Jayflux/servo | tests/wpt/web-platform-tests/webdriver/tests/actions/mouse_dblclick.py | Python | mpl-2.0 | 1,050 |
########################################################################
# Copyright (C) 2016 Siavoosh Payandeh Azad
# This script parses the transcript file generated by modelsim and
# generates 3 files:
# * sent.txt: keeps the log of all the sent packets
# * received.txt: keeps the log of all the received pack... | Project-Bonfire/EHA | RTL/Chip_Designs/IMMORTAL_Chip_2017/parse_transcript.py | Python | gpl-3.0 | 1,903 |
# -*- coding: utf-8 -*-
"""Top-level display functions for displaying object in different formats."""
# Copyright (c) IPython Development Team.
# Distributed under the terms of the Modified BSD License.
try:
from base64 import encodebytes as base64_encode
except ImportError:
from base64 import encodestring a... | unnikrishnankgs/va | venv/lib/python3.5/site-packages/IPython/core/display.py | Python | bsd-2-clause | 43,675 |
import numpy as np
import scipy.stats
import matplotlib.pyplot as plt
n_a_draw = 3
n_b_draw = 10
samples_a=np.random.randn(n_a_draw)
samples_b=np.random.randn(n_b_draw)
sample_a_means = np.sum(samples_a,axis=0)/n_a_draw
sample_a_variances = np.sum(((samples_a-sample_a_means)**2)/(n_a_draw-1))
sample_b_means = np.s... | jrpretz/scratch | statistics-gymnastics/scipy-test.py | Python | gpl-3.0 | 717 |
from flask import (
Blueprint,
current_app,
render_template,
url_for,
request,
redirect,
flash,
)
from flask_login import login_required, current_user
from config import settings
from lib.util_json import render_json
from snakeeyes.blueprints.billing.forms import SubscriptionForm, \
UpdateSubscripti... | capaximperii/LocaLoca | snakeeyes/blueprints/billing/views/billing.py | Python | gpl-3.0 | 8,789 |
# -*- coding: utf-8 -*-
import sys
import pytest
import gspread
from oauth2client.service_account import ServiceAccountCredentials
from pprintpp import pprint as pp
#from dictsheet import DictSheet
#from dictsheet import DictSheet
import dictsheet
import copy
#import test_config
import uuid
import random
import os
... | previa/dictsheet | tests/test_dict_sheet.py | Python | mit | 4,272 |
# -*- coding: utf-8; -*-
#
# This file is part of Superdesk.
#
# Copyright 2013, 2014 Sourcefabric z.u. and contributors.
#
# For the full copyright and license information, please see the
# AUTHORS and LICENSE files distributed with this source code, or
# at https://www.sourcefabric.org/superdesk/license
from flask i... | mdhaman/superdesk-core | apps/search/__init__.py | Python | agpl-3.0 | 8,957 |
# Generated by Django 3.2.4 on 2021-07-15 18:27
from django.db import migrations, models
import django.db.models.deletion
import uuid
class Migration(migrations.Migration):
dependencies = [
('wagtailcore', '0062_comment_models_and_pagesubscription'),
('snippets', '0011_auto_20210715_1317'),
... | openstax/openstax-cms | snippets/migrations/0012_auto_20210715_1327.py | Python | agpl-3.0 | 4,744 |
a = list(map(int, input().split()))
n = len(a)
for i in range(n-1):
if (a[i] == 2):
if a[i+1] != 2:
a[i] = 0
n -= 1
print(sum(a)//n) | alekseik1/python_mipt_study_1-2 | 1sem/lists_lesson/7.py | Python | gpl-3.0 | 168 |
# 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 'TextAnalysis'
db.create_table(u'text_analysis_textanalysis', (
(u'id', self.gf... | twhyte/openparliament | parliament/text_analysis/migrations/0001_initial.py | Python | agpl-3.0 | 2,144 |
dic = {'k1':123} # dic = dict(k1=123)
dic['k1']
dic['k1'] = 111 | jcchoiling/learningPython | s13/Day08/practice/s14.py | Python | gpl-3.0 | 63 |
from rest_framework.test import APITestCase
from api import models
from api.tests import factories
class OldRegisterTestCase(APITestCase):
def test_register(self):
self.assertEqual(0, models.LessPassUser.objects.all().count())
data = {
"email": "contact@example.org",
"pass... | lesspass/lesspass | containers/backend/api/tests/test_auth.py | Python | gpl-3.0 | 4,462 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright: (c) 2017, F5 Networks Inc.
# 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',
... | hryamzik/ansible | lib/ansible/modules/network/f5/bigip_smtp.py | Python | gpl-3.0 | 16,716 |
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
from __future__ import unicode_literals
import frappe, copy, json
from frappe import _, msgprint
from frappe.utils import cint
import frappe.share
rights = ("read", "write", "create", "delete", "submit", "cancel", "ame... | indictranstech/reciphergroup-frappe | frappe/permissions.py | Python | mit | 13,272 |
import re
import logging
import os.path
import httplib
from time import sleep
from utilities import UnicodeDictReader, UnicodeDictWriter
class Tasks(object):
"""
A helper wrapper class for task list.
"""
def __init__(self, tasks = [], mentors_data=None, **kwargs):
self._tasks = tasks
... | asmeurer/Issue-Tools | google-code-in/lib/tasks.py | Python | mit | 8,834 |
# Copyright 2016 Cloudbase Solutions Srl
# 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 r... | klmitch/nova | nova/policies/assisted_volume_snapshots.py | Python | apache-2.0 | 1,590 |
from DungeonMaster import bcolors
from random import randint
class InputManager:
correctCommand = False
def ParsePlayerInput(playerInput):
commandTokens = ["/yell", "/roll", "/say", "/grab", "/pickup", "/setRace"]
## by character
playerInputTokens = list(playerInput)
## by st... | Carvuh/TerminalQuest | PlayerInputManager.py | Python | mit | 2,393 |
import sys
sys.path.insert(1,"../../")
import h2o
from tests import pyunit_utils
import os
import random
def download_csv():
iris1 = h2o.import_file(path=pyunit_utils.locate("smalldata/iris/iris.csv"))
h2o.download_csv(iris1,"iris_delete.csv")
iris2 = h2o.import_file(path=pyunit_utils.locate(... | YzPaul3/h2o-3 | h2o-py/tests/testdir_misc/pyunit_download_csv.py | Python | apache-2.0 | 1,030 |
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import frappe
from frappe import _
from frappe.utils import flt
from frappe.model.document import Document
from erpnext.controllers.accounts_controller ... | saurabh6790/erpnext | erpnext/accounts/doctype/sales_taxes_and_charges_template/sales_taxes_and_charges_template.py | Python | gpl-3.0 | 1,928 |
"""
Health check endpoint
"""
from flask import Blueprint
HEALTHCHECK = Blueprint('healthcheck', __name__)
@HEALTHCHECK.route('/comments/health_check')
def healthcheck():
"""
Returns 200
"""
return 'OK'
| miljkovicivan/MicroComments | app/healthcheck.py | Python | bsd-3-clause | 222 |
"""DirectoryServiceBackend checks that result in ValidationException.
Note that ValidationExceptions are accumulative.
"""
import re
from moto.ds.exceptions import DsValidationException
def validate_args(validators):
"""Raise exception if any of the validations fails.
validators is a list of tuples each co... | spulec/moto | moto/ds/validations.py | Python | apache-2.0 | 5,056 |
# Copyright (c) 2008--2012 Red Hat, Inc.
#
# This software is licensed to you under the GNU General Public License,
# version 2 (GPLv2). There is NO WARRANTY for this software, express or
# implied, including the implied warranties of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. You should have received a cop... | dmacvicar/spacewalk | backend/common/rhnFlags.py | Python | gpl-2.0 | 1,402 |
#
# Copyright 2015-2017 ASAP
#
# 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 (... | project-asap/telecom-analytics | src/python/workflow/od_publisher.py | Python | apache-2.0 | 1,681 |
#!/usr/bin/env python
# -*-coding:utf-8-*-
# @Time : 2017/11/1 ~ 2019/9/1
# @Author : Allen Woo
from importlib import import_module
from flask import Blueprint
from apps.configs.sys_config import ADMIN_TEMPLATE_FOLDER, THEME_TEMPLATE_FOLDER, API_URL_PREFIX, ADMIN_URL_PREFIX, \
STATIC_PATH, STATIC_URL_PREFIX, OPEN_A... | osroom/osroom | apps/core/blueprint.py | Python | bsd-2-clause | 3,827 |
# -*- coding: utf-8 -*-
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Deleting model 'Document'
db.delete_table('document')
def backwar... | SeedScientific/polio | datapoints/migrations/0008_auto__del_document.py | Python | agpl-3.0 | 12,078 |
#!/usr/bin/python
import subprocess
import pexpect
import os
import shutil
import time
import sys
START = '0'
PASSWORD = ''
for arg in sys.argv[1:]:
if len(arg)==1:
START = '0123456789abcdefghijklmnopqrstuvwxyz'.find(arg)
if START < 0:
START = 0
else:
PASSWORD = arg
# Upload file to sourceforge web server... | HeisSpiter/cppcheck | tools/rundaca2.py | Python | gpl-3.0 | 2,927 |
import shelve
import time
import pytest
from wmr.players import START_RANK
from wmr.players import PlayerRepository
@pytest.fixture
def app(browser, server):
return ScoringApp(browser, server)
def test_shows_player_rating(app, database_url):
player_repo = PlayerRepository(database_url, START_RANK)
pla... | abele/whatsmyrank | tests/acceptance/test_tournaments.py | Python | bsd-2-clause | 1,908 |
__author__ = 'alisonbento'
import src.base.arrayparsableentity as parsable
import configs
import src.resstatus as _status
class Answer(parsable.ArrayParsableEntity):
def __init__(self):
self.status = 0
self.contents = {}
def set_status(self, status):
self.status = status
def add... | souzabrizolara/py-home-shell | src/answer/answer.py | Python | apache-2.0 | 699 |
# coding: utf-8
"""
Talon.One API
The Talon.One API is used to manage applications and campaigns, as well as to integrate with your application. The operations in the _Integration API_ section are used to integrate with our platform, while the other operations are used to manage applications and campaigns. #... | talon-one/talon_one.py | test/test_inline_response20024.py | Python | mit | 2,907 |
# -*- Mode:Python; indent-tabs-mode:nil; tab-width:4 -*-
#
# Copyright (C) 2016, 2017 Canonical Ltd
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 3 as
# published by the Free Software Foundation.
#
# This program is distributed in... | cprov/snapcraft | tests/fake_servers/__init__.py | Python | gpl-3.0 | 11,010 |
from .linestring_pb2 import LineString2D, LineString3D, MultiLineString2D, MultiLineString3D
from .point_pb2 import Point2D, Point3D, MultiPoint2D, MultiPoint3D
from .polygon_pb2 import Polygon2D, Polygon3D, MultiPolygon2D, MultiPolygon3D
def _2d(point):
return [point.x, point.y]
def _3d(point):
return [poi... | tomi77/protobuf-gis | python/gis/protobuf/__init__.py | Python | mit | 2,245 |
"""
Testing the funcionality of the reports
and the reporting utils
"""
from datetime import datetime
from django.test import TestCase
from django.utils import timezone
from django.db.models import Avg, Sum
from django.core.urlresolvers import reverse
from geoposition import Geoposition
from seshdash.models import Da... | GreatLakesEnergy/sesh-dash-beta | seshdash/tests/test_reports.py | Python | mit | 13,081 |
import os
import base64
from collections import defaultdict
from django.db.models import F, Q
from xos.config import Config
from observer.openstacksyncstep import OpenStackSyncStep
from core.models import Controller
from core.models import Image, ControllerImages
from util.logger import Logger, logging
from observer.an... | wathsalav/xos | xos/openstack_observer/steps/sync_controller_images.py | Python | apache-2.0 | 1,713 |
from Game.Shared import GameObject
from Game.Shared import GameConstants
import pygame
class Brick(GameObject):
def __init__(self, position, game, points=100, color=(0, 255, 0),
sprite=pygame.Surface(GameConstants.BRICK_SIZE)):
self.position = position
self.color = color
s... | msegeya/breakout-clone | Game/Bricks/Brick.py | Python | mit | 1,107 |
import urllib2
import BeautifulSoup
| abcxyz09/MyCodeLibrary | PYTHON/nm.py | Python | gpl-3.0 | 38 |
#
# FencePlacing.py
#
# @author Alain Rinder
# @date 2017.06.02
# @version 0.1
#
from src.action.IAction import *
from src.interface.Fence import *
class FencePlacing(IAction):
def __init__(self, coord, direction):
self.coord = coord
self.direction = direction
... | alainrinder/quoridor.py | src/action/FencePlacing.py | Python | mit | 1,544 |
# -*- coding: utf-8 -*-
"""
/***************************************************************************
Name : Dockable MirrorMap
Description : Creates a dockable map canvas
Date : February 1, 2011
copyright : (C) 2011 by Giuseppe Sucameli (Faunalia)
email ... | alfanugraha/LUMENS-repo | processing/DockableMirrorMap/dockableMirrorMapPlugin.py | Python | gpl-2.0 | 8,306 |
# -*- coding: utf-8 -*-
# Copyright (c) 2010 - 2015 Detlev Offenbach <detlev@die-offenbachs.de>
#
"""
Module implementing a dialog to show some bookmark info.
"""
from __future__ import unicode_literals
from PyQt5.QtCore import pyqtSlot
from PyQt5.QtGui import QFont
from PyQt5.QtWidgets import QDialog
from .Ui_Boo... | testmana2/test | Helpviewer/UrlBar/BookmarkInfoDialog.py | Python | gpl-3.0 | 2,088 |
#!C:\Users\mbradford\Documents\django_projects\mysite\Scripts\python.exe
# EASY-INSTALL-ENTRY-SCRIPT: 'gunicorn==19.1.1','console_scripts','gunicorn_paster'
__requires__ = 'gunicorn==19.1.1'
import sys
from pkg_resources import load_entry_point
sys.exit(
load_entry_point('gunicorn==19.1.1', 'console_scripts', 'guni... | cafecivet/django_girls_tutorial | Scripts/gunicorn_paster-script.py | Python | gpl-2.0 | 338 |
'''
python3 pyqt5
Port from pyqt5 example
'''
from PyQt5.Qt import *
DATA = b'''
Getting Started- How to familiarize yourself with Qt Designer
Launching Designer- Running the Qt Designer application
The User Interface- How to interact with Qt Designer
Designing a Component- ... | tcp813/mouTools | qt/qtreeview_editor.py | Python | mit | 16,976 |
# Copyright 2018 the authors.
# This file is part of Hy, which is free software licensed under the Expat
# license. See the LICENSE.
"Parser combinators for pattern-matching Hy model trees."
from hy.models import HyExpression, HySymbol, HyKeyword, HyString, HyList
from funcparserlib.parser import (
some, skip, ma... | adamfeuer/hy | hy/model_patterns.py | Python | mit | 2,912 |
from django.db import models
from django.core.urlresolvers import reverse
from django.utils.translation import ugettext_lazy as _
class Contact(models.Model):
title = models.CharField(max_length=200, blank=True, null=True)
firstname = models.CharField(max_length=200)
lastname = models.CharField(max_length... | sinnedh/django-groupware | groupcontacts/models.py | Python | gpl-2.0 | 1,230 |
#!/usr/bin/env python
# encoding: utf-8
"""
exp6.py
An attempt to reproduce this research:
http://ecet.ecs.ru.acad.bg/cst04/Docs/sIIIA/32.pdf
Created by Oliver Smith on 2009-09-04.
Copyright (c) 2009 Oliver Smith. All rights reserved.
"""
import sys
import cv
from ia.ocr.OpenANPR.experimental.exputil import *
W =... | xmnlab/minilab | ia/ocr/OpenANPR/experimental/exp6.py | Python | gpl-3.0 | 1,364 |
import maya.cmds as cmds
if cmds.about(api=True) >= 201700:
from PySide2 import QtWidgets as QtGui
else:
from PySide import QtGui
from functools import partial
from maya.app.general.mayaMixin import MayaQWidgetBaseMixin
_win = None
def show():
global _win
if _win == None:
_win = BindingDialog()... | chadmv/cvwrap | scripts/cvwrap/bindui.py | Python | mit | 4,237 |
# Copyright (C) 2010-2014 CEA/DEN, EDF R&D
#
# This library 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 2.1 of the License, or (at your option) any later version.
#
# This library ... | FedoraScientific/salome-paravis | test/VisuPrs/MeshPresentation/H4.py | Python | lgpl-2.1 | 2,459 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
#
# Copyright 2013 New Dream Network, LLC (DreamHost)
#
# 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/li... | beagles/neutron_hacking | neutron/tests/unit/services/loadbalancer/agent/test_api.py | Python | apache-2.0 | 3,986 |
import sublime_plugin
class EchoCommand(sublime_plugin.ApplicationCommand):
def run(self, **kwargs):
print(kwargs)
| twolfson/sublime-files | Packages/Default/echo.py | Python | unlicense | 129 |
#!/usr/bin/env python2
import sys
import os
import os.path
import re
import argparse
import datetime
import multiprocessing
import shlex
import shutil
import tempfile
import time
import subprocess
import glob
# Default flags for make
default_make_flags = ["-i", "-j" + str(multiprocessing.cpu_count())]
# Set YCM-Gen... | rdnetto/YCM-Generator | config_gen.py | Python | gpl-3.0 | 19,556 |
"""
Provides request handlers for file downloads.
"""
from aiohttp import web
from virtool.api.response import NotFound
from virtool.downloads.db import generate_isolate_fasta, generate_sequence_fasta
from virtool.errors import DatabaseError
from virtool.http.routes import Routes
routes = Routes()
@routes.get("/do... | igboyes/virtool | virtool/downloads/api.py | Python | mit | 1,887 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
from httpwookiee.http.parser.header import Header
from httpwookiee.http.parser.chunk import Chunk
from httpwookiee.core.tools import Tools
class Message(object):
STATUS_OPTIONAL_SEPARATOR = 0
STATUS_HEADERS = 1
STATUS_BODY = 2
STATUS_CHUNK_HEADER = 3
... | regilero/HTTPWookiee | httpwookiee/http/parser/message.py | Python | gpl-3.0 | 8,017 |
__version__ = '1.4.0'
__author__ = "Charles Gordon"
| ewdurbin/pymemcache | pymemcache/__init__.py | Python | apache-2.0 | 52 |
# -*- coding: utf-8 -*-
#################################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2013 Julius Network Solutions SARL <contact@julius.fr>
#
# This program is free software: you can redistribute it and/or modify
# it under th... | ncliam/serverpos | openerp/custom_modules/school_link/school.py | Python | agpl-3.0 | 39,903 |
# This file is part of rhizi, a collaborative knowledge graph editor.
# Copyright (C) 2014-2015 Rhizi
#
# 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... | ozFri/rhizi | rhizi/rz_feedback.py | Python | agpl-3.0 | 3,629 |
"""Test the split module"""
from __future__ import division
import warnings
import numpy as np
from scipy.sparse import coo_matrix, csc_matrix, csr_matrix
from scipy import stats
from scipy.misc import comb
from itertools import combinations
from itertools import combinations_with_replacement
from sklearn.utils.testi... | IshankGulati/scikit-learn | sklearn/model_selection/tests/test_split.py | Python | bsd-3-clause | 47,658 |
# !/usr/bin/env python
# -*- coding: utf-8 -*-
#----------model import----------
import time
import slacker
import tbdmConfig
from tbdmLogging import tbdmLogger
#----------model import----------
#----------global variables----------
#----------global variables----------
#----------class definition----------... | TBDM/ju | Scrape_Frame/tbdmSlack.py | Python | mit | 1,373 |
#!/usr/bin/env python
import moksha.ctl.core.main as main
if __name__ == '__main__':
main.main(entry_point=False)
| ralphbean/moksha | moksha-ctl.py | Python | apache-2.0 | 120 |
def reverse_name(fqdn):
"""
>>> reverse_name('ns57.1and1.com')
'com.1and1.ns57'
"""
parts = fqdn.split('.')
parts.reverse()
return '.'.join(parts)
def status_name(status):
"""
>>> import adns
>>> status_name(adns.status.nxdomain)
'nxdomain'
"""
import adns
retur... | jcrocholl/nxdom | dns/utils.py | Python | mit | 2,286 |
# Copyright 2013 IBM Corp.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agree... | klmitch/nova | nova/objects/__init__.py | Python | apache-2.0 | 3,202 |
from django.conf.urls import include, url
from django.conf.urls.i18n import i18n_patterns
from cemetery.views import import_entries
urlpatterns = [
url(r'^jet', include('jet.urls', 'jet')), # django-jet
url(r'^translations', include('rosetta.urls')), # django-rosetta
]
urlpatterns += i... | stefan1niculae/gods-acre | webapp/gods_acre/urls.py | Python | gpl-3.0 | 506 |
# -*- coding: utf-8 -*-
""" Python KNX framework
License
=======
- B{PyKNyX} (U{https://github.com/knxd/pyknyx}) is Copyright:
- © 2016-2017 Matthias Urlichs
- PyKNyX is a fork of pKNyX
- © 2013-2015 Frédéric Mantegazza
This program is free software; you can redistribute it and/or modify
it under the terms ... | knxd/pKNyX | pyknyx/stack/layer3/n_groupDataService.py | Python | gpl-3.0 | 4,514 |
#!/usr/bin/env python
#
# random-file
#
# Description: Select a random file from a directory
# Version: 1.0
#
# Copyright (C) 2012 - K-Gigas Computers S.L.
# Danilo Dellaquila <ddellaquila@gmail.com>
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# This file is part of @ddellaquila/dd-re... | kernt/linuxtools | gnome3-shell/nautilus-scripts/Execute/Random-File.py | Python | gpl-3.0 | 2,606 |
# Copyright 2021 DeepMind Technologies Limited
#
# 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 agr... | deepmind/xmanager | xmanager/xm/utils_test.py | Python | apache-2.0 | 1,374 |
#!/usr/bin/env python
"""
:Module: sort_downloads
:Date: 20150-20
:Platforms: Mac (Tested under Mac OS X)
:Version: 1
:Authors:
- Benjamin Schollnick
:Copyright (C) 2015, Benjamin Schollnick
:License - MIT,
:Description:
This will take a starting folder (e.g. Downloads folder), and move any
files found in ... | bschollnick/Odds-and-Ends | sort_downloads.py | Python | mpl-2.0 | 5,363 |
# -*- coding: utf-8 -*-
#/#############################################################################
#
# Tech-Receptives Solutions Pvt. Ltd.
# Copyright (C) 2004-TODAY Tech-Receptives(<http://www.tech-receptives.com>).
#
# This program is free software: you can redistribute it and/or modify
# it under th... | bakhtout/odoo-educ | addons/openeducat_erp/op_marksheet_line/__init__.py | Python | agpl-3.0 | 1,090 |
#!/usr/bin/python3
# -*- coding: utf-8 -*-
#
# Copyright (C) 2012 Lorenzo Carbonell
# lorenzo.carbonell.cerezo@gmail.com
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of th... | christopherjbly/calendar-indicator | src/widget.py | Python | gpl-3.0 | 20,729 |
from django.conf import settings
from django.utils.translation import ugettext_lazy as _
from tendenci.apps.registry.sites import site
from tendenci.apps.registry.base import CoreRegistry, lazy_reverse
from tendenci.apps.directories.models import Directory
class DirectoryRegistry(CoreRegistry):
version = '1.0'
... | alirizakeles/tendenci | tendenci/apps/directories/app_registry.py | Python | gpl-3.0 | 1,147 |
# Copyright (c) 2011-2015 Rusty Wagner
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed... | ColdHeat/binaryninja-python | DisassemblerView.py | Python | gpl-2.0 | 38,385 |
from django.template import TemplateSyntaxError
from django.test import SimpleTestCase
from ..utils import setup
class TemplateTagTests(SimpleTestCase):
@setup({'templatetag01': '{% templatetag openblock %}'})
def test_templatetag01(self):
output = self.engine.render_to_string('templatetag... | yephper/django | tests/template_tests/syntax_tests/test_template_tag.py | Python | bsd-3-clause | 2,661 |
""" EasyBlog Model Managers and helpers """
from django.utils import timezone
from django.db import models
# Because of a circular dependency, we can't import models specifically
import easyblog
class PostStatusLiveManager(models.Manager):
def get_query_set(self):
"""Return PostStatus objects which are de... | jmcclell/easyblog | easyblog/managers.py | Python | mit | 876 |
from ._base import PluginCommand, CommandError
from biohub.core.conf import manager as settings_manager
class Command(PluginCommand):
help = "Add a new plugin to configuration file."
def handle(self, plugin, **options):
try:
super(Command, self).handle(plugin, **options)
except... | lsj1292/Abacus | biohub/core/plugins/management/commands/installplugin.py | Python | mit | 385 |
#!/usr/bin/python2.4
# Copyright (c) 2006-2008 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.
'''The 'grit build' tool along with integration for this tool with the
SCons build system.
'''
import filecmp
import getopt
im... | rwatson/chromium-capsicum | tools/grit/grit/tool/build.py | Python | bsd-3-clause | 8,695 |
DRATS_VERSION="daily-02232012"
| coddingtonbear/d-rats | d_rats/version.py | Python | gpl-3.0 | 31 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from pokemongo_bot.constants import Constants
from pokemongo_bot.step_walker import StepWalker
from pokemongo_bot.worker_result import WorkerResult
from pokemongo_bot.base_task import BaseTask
from utils import distance, format_dist, fort_details
class ... | Lordness/poklord | pokemongo_bot/cell_workers/move_to_fort.py | Python | mit | 5,008 |
#!/usr/bin/env python
# -*- coding: utf8 -*-
# Plural-Forms for ca (Catalan)
nplurals=2 # Catalan language has 2 forms:
# 1 singular and 1 plural
# Determine plural_id for number *n* as sequence of positive
# integers: 0,1,...
# NOTE! For singular form ALWAYS return plural_id = 0
get_plural_id = lambda n... | xiang12835/python_web | py2_web2py/web2py/gluon/contrib/plural_rules/ca.py | Python | apache-2.0 | 1,212 |
import os
import glob
import time
import RPi.GPIO as GPIO
GPIO.setmode(GPIO.BCM)
heat_pin = 18
base_dir = '/sys/bus/w1/devices/'
device_folder = glob.glob(base_dir + '28*')[0]
device_file = device_folder + '/w1_slave'
GPIO.setup(heat_pin, GPIO.OUT)
def read_temp_raw():
f = open(device_file, 'r')
lines = f... | simonmonk/make_action | python/experiments/simple_thermostat.py | Python | mit | 1,106 |
# Copyright 2018 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | ghchinoy/tensorflow | tensorflow/python/keras/saving/hdf5_format_test.py | Python | apache-2.0 | 39,795 |
import sys
import time
import pyvm.Assembler as asm
import pyvm.Disassembler as disasm
import pyvm.VirtualMachine as vm
import logging
logging.basicConfig(filename='pyvm.log', level=logging.INFO)
def disassemble(fileName):
disassembler = disasm.Disassembler(fileName)
print(disassembler.run())
def ... | atwice/pyvm | vm.py | Python | mit | 1,343 |
"""Base test class for DNS authenticators built on Lexicon."""
import mock
from acme import jose
from requests.exceptions import HTTPError, RequestException
from certbot import errors
from certbot.plugins import dns_test_common
from certbot.tests import util as test_util
DOMAIN = 'example.com'
KEY = jose.JWKRSA.load... | nohona/cron-crm | usr/local/certbot/certbot/plugins/dns_test_common_lexicon.py | Python | gpl-3.0 | 5,615 |
"""A server that handles a connection with an OpenBCI board and serves that
data over both a UDP socket server and a WebSocket server.
Requires:
- pyserial
- asyncio
- websockets
"""
import cPickle as pickle
import json
import socket
import plugin_interface as plugintypes
# class PluginPrint(IPlugin):
# # ... | neurotechuoft/Wall-EEG | Code/OpenBCIPy/src/plugins/udp_server.py | Python | mit | 2,293 |
from context import reginalmetfield
class daily_data(reginalmetfield):
def __init__(self,setting):
reginalmetfield.__init__(self,setting)
def Read(self):
from netCDF4 import Dataset,num2date
import numpy as np
import numpy.ma as ma
import sys
for case in self.cases:
for vname in self.... | sunchaoatmo/cplot | daily.py | Python | gpl-3.0 | 9,969 |
from .system import System
from ..components.physical import Body
from ..components.hud import Text
from .. import signaler
class HudSystem(System):
componenttypes = Body, Text
# TODO: cache the fps texture and update it instead of building it
# anew each cycle
def init(self):
self.fp... | mavroskardia/platter | src/systems/hud.py | Python | gpl-2.0 | 1,553 |
#!/usr/bin/env python
"""
django urls introspect
======
Experimental tool to introspect django urls and highlight views where the
signature doesn't match the keywords captured in the url. See
http://www.szotten.com/david/introspecting-django-urls-for-fun-and-profit.html
for (a little) more info.
copyright (c) 2012 by... | davidszotten/django-urls-introspect | setup.py | Python | mit | 896 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.