code stringlengths 3 1.05M | repo_name stringlengths 5 104 | path stringlengths 4 251 | language stringclasses 1
value | license stringclasses 15
values | size int64 3 1.05M |
|---|---|---|---|---|---|
# Copyright 2015 Google Inc. 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 applicable law or ag... | Sorsly/subtle | google-cloud-sdk/lib/googlecloudsdk/core/util/retry.py | Python | mit | 10,477 |
import web
from . import csrf_protected, db, get_session, require_login, render, userRolesByName
from app.tools.pagination2 import doquery, countquery, getPaginationString
from app.tools.utils import default, lit
from settings import PAGE_LIMIT
class Users:
@require_login
def GET(self):
params = web.i... | sekiskylink/dispatcher-2.1 | web/app/controllers/users_handler.py | Python | gpl-3.0 | 4,860 |
import os
import pytest
BASE_DIR = os.path.abspath(os.path.dirname(__file__))
SITE_DIR = os.path.join(BASE_DIR, "site")
@pytest.fixture
def site_dir():
return SITE_DIR
@pytest.fixture
def output_exist():
return lambda path: os.path.exists(os.path.join(SITE_DIR, "deploy", path))
@pytest.fixture(autouse=Tr... | whtsky/Catsup | tests/conftest.py | Python | mit | 419 |
#!/afs/bx.psu.edu/project/pythons/py2.7-linux-x86_64-ucs4/bin/python2.7
"""
Read a MAF and print counts and frequencies of all n-mers
(words composed on n consecutive alignment columns)
TODO: reconcile this and maf_mapping_word_frequency.py
usage: %prog n < maf_file
"""
from __future__ import division
import psyco... | mikel-egana-aranguren/SADI-Galaxy-Docker | galaxy-dist/eggs/bx_python-0.7.2-py2.7-linux-x86_64-ucs4.egg/EGG-INFO/scripts/maf_word_frequency.py | Python | gpl-3.0 | 1,125 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2011 OpenStack Foundation
# Copyright 2013 IBM Corp.
# 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
#... | plumgrid/plumgrid-nova | nova/tests/api/openstack/compute/plugins/v3/test_admin_password.py | Python | apache-2.0 | 4,400 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('fluent_contents', '0001_initial'),
('icekit', '0005_remove_layout_key'),
]
operations = [
migrations.CreateModel(
... | ic-labs/django-icekit | icekit/plugins/file/migrations/0001_initial.py | Python | mit | 1,804 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
::
Copyright 2010 Glencoe Software, Inc. All rights reserved.
Use is subject to license terms supplied in LICENSE.txt
"""
"""
Module which parses an icegrid XML file for configuration settings.
see ticket:800
see ticket:2213 - Replacing Java Preferences API
""... | tp81/openmicroscopy | components/tools/OmeroPy/src/omero/config.py | Python | gpl-2.0 | 15,139 |
#
#
# Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Google 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:
#
# 1. Redistributions of source code must retain the above copyri... | apyrgio/ganeti | lib/cmdlib/node.py | Python | bsd-2-clause | 64,603 |
import hashlib
import os
import dialog
import requests
# To make hash of the intended video file
def get_hash(name):
readsize = 1024*64
with open(name,'rb') as f:
size = os.path.getsize(name)
data = f.read(readsize)
f.seek(-readsize,os.SEEK_END)
data += f.read(readsize)
return hashlib.md5(data).hexdigest()... | irresolute/subX | subX/subdb.py | Python | mit | 981 |
# -*- coding: utf-8 -*-
# © 2015 LasLabs Inc.
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from openerp import models, api
from openerp.exceptions import ValidationError
import requests
class WebsiteFormRecaptcha(models.AbstractModel):
""" This model provides ReCaptcha helper methods.
... | Tecnativa/website | website_form_recaptcha/models/website_form_recaptcha.py | Python | agpl-3.0 | 2,122 |
import unittest
import pymysql
import tap_mysql
import copy
import singer
import os
import singer.metadata
from tap_mysql.connection import connect_with_backoff
try:
import tests.utils as test_utils
except ImportError:
import utils as test_utils
import tap_mysql.sync_strategies.binlog as binlog
import tap_mys... | singer-io/tap-mysql | tests/nosetests/test_date_types.py | Python | agpl-3.0 | 4,760 |
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not... | apache/incubator-singa | examples/cnn/model/cnn.py | Python | apache-2.0 | 3,086 |
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under t... | ctrlaltdel/neutrinator | vendor/openstack/tests/unit/network/v2/test_load_balancer.py | Python | gpl-3.0 | 2,432 |
# Copyright 2011 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 or agreed to in writing,... | natduca/ndbg | util/graph_widget.py | Python | apache-2.0 | 6,897 |
"""
:codeauthor: Li Kexian <doyenli@tencent.com>
"""
import os
import pytest
from salt.config import cloud_providers_config
from tests.support.case import ShellCase
from tests.support.helpers import random_string
from tests.support.runtests import RUNTIME_VARS
# Create the cloud instance name to be used througho... | saltstack/salt | tests/integration/cloud/clouds/test_tencentcloud.py | Python | apache-2.0 | 3,073 |
#!/usr/bin/python
# -- encoding: utf-8 --
if not "raw_input" in dir(__builtins__):
raw_input = input
def blocoToValue(b):
if not len(b): return []
r = []
for k in range(max(b.keys())+1):
if k in b.keys():
r.append(int(b[k]))
else:
r.append(3)
return r
'''
A simplificação de função boo... | ReallyNiceGuy/karnaugh | karnaugh.py | Python | mit | 15,164 |
# display_morphology.py ---
#
# Filename: display_morphology.py
# Description:
# Author:
# Maintainer:
# Created: Fri Mar 8 11:26:13 2013 (+0530)
# Version:
# Last-Updated: Thu Jul 18 15:12:01 2013 (+0530)
# By: subha
# Update #: 366
# URL:
# Keywords:
# Compatibility:
#
#
# Commentary:
#
#... | dilawar/moose-full | moose-examples/traub_2005/py/display_morphology.py | Python | gpl-2.0 | 5,844 |
# coding=utf-8
from __future__ import absolute_import
__author__ = "Gina Häußge <osd@foosel.net>"
__license__ = 'GNU Affero General Public License http://www.gnu.org/licenses/agpl.html'
__copyright__ = "Copyright (C) 2014 The OctoPrint Project - Released under terms of the AGPLv3 License"
from flask.ext.login import ... | C-o-r-E/OctoPrint | src/octoprint/users.py | Python | agpl-3.0 | 8,147 |
#
# Copyright (c) 2016 Intel Corporation
#
# 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 i... | trustedanalytics/ingestion-ws-kafka-hdfs | ws2kafka/deploy/deploy.py | Python | apache-2.0 | 1,167 |
import _plotly_utils.basevalidators
class TexttemplatesrcValidator(_plotly_utils.basevalidators.SrcValidator):
def __init__(
self, plotly_name="texttemplatesrc", parent_name="scattersmith", **kwargs
):
super(TexttemplatesrcValidator, self).__init__(
plotly_name=plotly_name,
... | plotly/plotly.py | packages/python/plotly/plotly/validators/scattersmith/_texttemplatesrc.py | Python | mit | 436 |
#
# File: keytool.py
# Based on the work of:
# Copyright (c) 2017, paul@discotd5.com
# Modified by:
# Copyright (c) 2017, xabiergarmendia@gmail.com
# All rights reserved.
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are ... | pajacobson/td5keygen | keytool.py | Python | bsd-2-clause | 2,904 |
#!/usr/bin/python2.5
#
# Copyright 2010 the Melange authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable... | SRabbelier/Melange | app/soc/modules/seeder/logic/providers/email.py | Python | apache-2.0 | 2,069 |
COMMTRACK_REPORT_XMLNS = 'http://commcarehq.org/ledger/v1'
SECTION_TYPE_STOCK = 'stock'
REPORT_TYPE_BALANCE = 'balance'
REPORT_TYPE_TRANSFER = 'transfer'
VALID_REPORT_TYPES = (REPORT_TYPE_BALANCE, REPORT_TYPE_TRANSFER)
TRANSACTION_TYPE_STOCKONHAND = 'stockonhand'
TRANSACTION_TYPE_STOCKOUT = 'stockout'
TRANSACTION_TY... | puttarajubr/commcare-hq | corehq/ex-submodules/casexml/apps/stock/const.py | Python | bsd-3-clause | 475 |
from django.contrib import admin
from django import forms
from django.conf import settings
class DraftAdmin(admin.ModelAdmin):
"""
Add draft.js file
"""
def _media(self):
from django.conf import settings
js = ['js/core.js', 'js/admin/RelatedObjectLookups.js',
'js/jquery.m... | platypus-creation/django-draft | draft/admin.py | Python | mit | 905 |
from .models import get_unread_inbox_counter
def group_messaging_context(request):
if request.user.is_authenticated():
count_record = get_unread_inbox_counter(request.user)
return {'group_messaging_unread_inbox_count': count_record.count}
return {}
| divio/askbot-devel | askbot/deps/group_messaging/context.py | Python | gpl-3.0 | 274 |
# -*- coding: utf-8 -*-
"""
***************************************************************************
MultipleExternalInputDialog.py
---------------------
Date : August 2012
Copyright : (C) 2012 by Victor Olaya
(C) 2013 by CS Systemes d'informatio... | CS-SI/QGIS | python/plugins/processing/gui/MultipleFileInputDialog.py | Python | gpl-2.0 | 4,837 |
class Tree:
class Node:
def __init__(self, data):
self.parent = None
self.left = None
self.right = None
self.key = data
def __init__(self):
self.root = None
def find(self, data):
p = self.root
while p is not None and p.key != da... | mipt-cs-on-python3/lections | lection_23/class Tree.py | Python | gpl-3.0 | 1,112 |
# -*- coding: utf-8 -*-
################################################################
## Game.py
################################################################
# Classe Game: nécessite Player.py
#
# Antoine Courcelles, Marc Cerou,
# André Guimaraes-Duarte, Doina Leca
from Player import*
class Game:
def __... | x-alp/Oksamultisnake | Game.py | Python | gpl-3.0 | 3,107 |
# 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 ... | AutorestCI/azure-sdk-for-python | azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/models/virtual_machine_scale_set_identity.py | Python | mit | 1,774 |
from .TestContainersDeviceAndManager import TestContainerDeviceDataFlow
from .TestContainersReceivingSerialDataAndObserverPattern import TestContainersReceivingSerialDataAndObserverPattern | rCorvidae/OrionPI | src/tests/Devices/Containers/__init__.py | Python | mit | 188 |
# downscale the prepped cmip5 data used in running the TEM model (IEM)
# author: Michael Lindgren
if __name__ == '__main__':
import glob, os, rasterio, itertools
from functools import partial
import downscale
from downscale import preprocess
import numpy as np
import argparse
# # parse the commandline argument... | ua-snap/downscale | snap_scripts/downscaling_L48/downscale_cmip5_L48.py | Python | mit | 6,512 |
#!/usr/bin/env python
#
# Copyright (c) 2001 - 2016 The SCons Foundation
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to us... | EmanueleCannizzaro/scons | test/Fortran/F08FILESUFFIXES.py | Python | mit | 4,028 |
#############################################################################
##
## Copyright (C) 2016 The Qt Company Ltd.
## Contact: https://www.qt.io/licensing/
##
## This file is part of the test suite of PySide2.
##
## $QT_BEGIN_LICENSE:GPL-EXCEPT$
## Commercial License Usage
## Licensees holding valid commercial ... | qtproject/pyside-pyside | tests/QtCore/bug_1019.py | Python | lgpl-2.1 | 1,956 |
from stevedore import driver
#TODO: Put in the failure callback so that if
# you don't have larcv installed, it fails gracefully
def process(driver_name, file_names):
mgr = driver.DriverManager(
namespace='root2hdf5.plugins',
name=driver_name,
invoke_on_load=False,
)
mgr.driver.process(file_names)
| HEP-DL/root2hdf5 | root2hdf5/framework/driver.py | Python | gpl-3.0 | 320 |
"""
connection tools to manage kinds of connection.
"""
import logging
import os
import shutil
import tempfile
import commands
from autotest.client import utils, os_dep
from virttest import propcan, remote, utils_libvirtd
from virttest import data_dir, aexpect
class ConnectionError(Exception):
"""
The base... | autotest/virt-test | virttest/utils_conn.py | Python | gpl-2.0 | 52,295 |
# 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 may ... | Azure/azure-sdk-for-python | sdk/webpubsub/azure-mgmt-webpubsub/azure/mgmt/webpubsub/_configuration.py | Python | mit | 3,388 |
# Copyright (c) 2019, Frappe and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import frappe
def execute():
frappe.reload_doc('stock', 'doctype', 'purchase_receipt')
frappe.reload_doc('stock', 'doctype', 'purchase_receipt_item')
frappe.reload_doc('st... | saurabh6790/erpnext | erpnext/patches/v13_0/update_returned_qty_in_pr_dn.py | Python | gpl-3.0 | 1,127 |
#!/usr/bin/env python
# Modified from http://www.pygame.org/project-Very+simple+Pong+game-816-.html
import pygame
import os
from pygame.locals import *
import pygame.surfarray as surfarray
position = 5, 325
os.environ['SDL_VIDEO_WINDOW_POS'] = str(position[0]) + "," + str(position[1])
pygame.init()
screen = pygame.di... | akashin/RL_Experiments | DQN/games/pong.py | Python | mit | 5,187 |
from msl.equipment.connection import Connection
from msl.equipment.connection_demo import ConnectionDemo
from msl.equipment.record_types import EquipmentRecord
from msl.equipment.resources.picotech.picoscope.picoscope import PicoScope
from msl.equipment.resources.picotech.picoscope.channel import PicoScopeChannel
cla... | MSLNZ/msl-equipment | tests/test_connection_demo.py | Python | mit | 8,679 |
from tests.test_pip import (reset_env, run_pip,
_create_test_package, _change_test_package_version)
from tests.local_repos import local_checkout
def test_install_editable_from_git_with_https():
"""
Test cloning from Git with https.
"""
reset_env()
result = run_pip('install', ... | evnpr/herokupython | vendor/pip-1.2.1/tests/test_vcs_backends.py | Python | mit | 5,343 |
import os, sys
origin_dir = 'del_201304now/'
new_dir = 'freq_event_state/'
files = os.listdir(origin_dir)
state_dir = {}
country_dir = {}
for file in files:
with open(origin_dir + file) as f:
event_dir = {}
for line in f:
tmp_content = line.split('\t')
code = tmp_content[4]
... | moment-of-peace/EventForecast | association_rule/event_frequent.py | Python | lgpl-3.0 | 1,535 |
#!/usr/bin/env python
# Copyright 2015, Rackspace US, 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 applicabl... | briancurtin/rpc-maas | playbooks/files/rax-maas/plugins/nova_cloud_stats.py | Python | apache-2.0 | 5,067 |
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import frappe
test_records = frappe.get_test_records('Brand') | BhupeshGupta/erpnext | erpnext/setup/doctype/brand/test_brand.py | Python | agpl-3.0 | 233 |
# coding=utf-8
"""
The Collector class is a base class for all metric collectors.
"""
import os
import socket
import platform
import logging
import configobj
import traceback
import time
from diamond.metric import Metric
# Detect the architecture of the system and set the counters for MAX_VALUES
# appropriately. Ot... | datafiniti/Diamond | src/diamond/collector.py | Python | mit | 13,380 |
#!/usr/bin/env python
# Web of Science search handler through SOAP WoS API
# For more information see:
# http://ip-science.interest.thomsonreuters.com/data-integration
#
# Requires username and password to access the service
#
# Copyright 2017, Krzysztof Kutt
import zeep
from xml.etree import ElementTree
AUTH_URL ... | kkutt/references-tracking | handler/search/webofscience.py | Python | gpl-3.0 | 3,676 |
import logging
from django import forms
from django.utils.encoding import force_text
from django.utils.translation import ugettext_lazy as _, ugettext
from reviewboard.hostingsvcs.errors import (AuthorizationError,
TwoFactorAuthCodeRequiredError)
from reviewboard.hostingsvc... | reviewboard/reviewboard | reviewboard/hostingsvcs/forms.py | Python | mit | 21,600 |
""" GTK GUI module for pypass """
# -*- coding: utf-8 -*-
# Copyright (c) 2011 Pierre-Yves Chibon <pingou AT pingoured DOT fr>
# Copyright (c) 2011 Johan Cwiklinski <johan AT x-tnd DOT be>
#
# This file is part of pypass.
#
# pypass is free software: you can redistribute it and/or modify
# it under the terms of the GN... | pypingou/pypass-gnome | src/gui.py | Python | gpl-3.0 | 29,863 |
from django.conf.urls import patterns, url
from core.views import UserList, UserDetail, MeetingsList, MeetingDetail, UserCreate, AuthView
urlpatterns = [
url(r'^api-token-auth/', AuthView.as_view(), name='auth'),
url(r'^user-create/$', UserCreate.as_view(), name='user-create'),
url(r'^users-list/$', User... | KraftSoft/together | core/urls.py | Python | bsd-3-clause | 756 |
#encoding: utf-8
import sys
reload(sys)
sys.setdefaultencoding('utf-8') #设置命令行为utf-8
import os
from functools import wraps
from flask import Flask #从flask包导入Flask类
from flask import render_template #从flask包导入render_template函数
from flask impor... | 51reboot/actual_09_homework | 07/zhaoyuanhai/cmdb/app.py | Python | mit | 6,366 |
1000L
u"unicode string"
U"unicode string"
ur"raw unicode"
UR"raw unicode"
Ur"raw unicode"
uR"raw unicode"
u"""unicode string"""
U"""unicode string"""
ur"""raw unicode"""
UR"""raw unicode"""
Ur"""raw unicode"""
uR"""raw unicode"""
u'unicode string'
U'unicode string'
ur'raw unicode'
UR'raw unicode'
Ur'raw unicode'
uR'raw... | DinoV/PTVS | Python/Tests/TestData/Grammar/LiteralsV2.py | Python | apache-2.0 | 543 |
import macpath
from test import test_genericpath
import unittest
class MacPathTestCase(unittest.TestCase):
def test_abspath(self):
self.assertEqual(macpath.abspath("xx:yy"), "xx:yy")
def test_isabs(self):
isabs = macpath.isabs
self.assertTrue(isabs("xx:yy"))
self.assertTrue(i... | yotchang4s/cafebabepy | src/main/python/test/test_macpath.py | Python | bsd-3-clause | 6,172 |
from __future__ import print_function, division
import random
from sympy import Derivative
from sympy.core.basic import Basic
from sympy.core.compatibility import is_sequence, as_int, range
from sympy.core.function import count_ops
from sympy.core.decorators import call_highest_priority
from sympy.core.singleton impo... | aktech/sympy | sympy/matrices/dense.py | Python | bsd-3-clause | 44,552 |
#Operation 3067
#A game that involves exploration, building, and attack.
#Written by vanquished
#Licenced under the GPL v3 licence.
VERSION = "0.1"
try:
import pygame, sys
from pygame.locals import *
except ImportError, err:
print "Could not load module. {0}".format(err)
def main():
#Initialise scree... | vanquished/operation-3067 | operation-3067.py | Python | gpl-3.0 | 993 |
import unittest
from the_ark.field_handlers import FieldHandler, FieldHandlerException, SeleniumError, MissingKey, UnknownFieldType
from the_ark import selenium_helpers
from mock import patch
class FieldHandlerTestCase(unittest.TestCase):
def setUp(self):
self.instantiate_field_handler()
@patch("the_... | meltmedia/the-ark | tests/test_field_handler.py | Python | apache-2.0 | 17,996 |
#!/usr/bin/python
# @lint-avoid-python-3-compatibility-imports
#
# tcpconnect Trace TCP connect()s.
# For Linux, uses BCC, eBPF. Embedded C.
#
# USAGE: tcpconnect [-h] [-c] [-t] [-p PID] [-P PORT [PORT ...]] [-4 | -6]
#
# All connection attempts are traced, even if they ultimately fail.
#
# This uses d... | brendangregg/bcc | tools/tcpconnect.py | Python | apache-2.0 | 17,972 |
"""
Interact with the world:
- swing the arm, sneak, sprint, jump with a horse, leave the bed
- look around
- dig/place/use blocks
- use the held (active) item
- use/attack entities
- steer vehicles
- edit and sign books
By default, the client sends swing and look packets like the vanilla client.
This can be disabled ... | luken/SpockBot | spockbot/plugins/helpers/interact.py | Python | mit | 9,523 |
from django.conf.urls import patterns, include, url
urlpatterns = patterns('',
url(r'^get_cookie$', 'socialplus.views.get_cookie'),
# OTHER STUFF..
url(r'^test/(?P<test_name>[^/]+)$', 'socialplus.tests.run_test'),
url(r'^delete_all/reports$', 'socialplus.views.delete_reports'),
url(r'^delete_all/pe... | lucacioria/socialplus-prototype | DJANGO_GAE/socialplus/urls.py | Python | unlicense | 2,685 |
import logging
from pyvisdk.exceptions import InvalidArgumentError
########################################
# Automatically generated, do not edit.
########################################
log = logging.getLogger(__name__)
def ResourcePoolReconfiguredEvent(vim, *args, **kwargs):
'''This event records when a res... | xuru/pyvisdk | pyvisdk/do/resource_pool_reconfigured_event.py | Python | mit | 1,197 |
# -*- 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 field 'Candidate.picture'
db.add_column('political_candidate', 'picture',
sel... | kansanmuisti/datavaalit | web/political/migrations/0005_auto__add_field_candidate_picture.py | Python | agpl-3.0 | 9,140 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
import os
import shutil
from io import open
import click
import yaml
from shellfoundry.utilities.archive_creator import ArchiveCreator
from shellfoundry.utilities.shell_package import ShellPackage
from shellfoundry.utilities.temp_dir_context import TempDirContext
class Shel... | QualiSystems/shellfoundry | shellfoundry/utilities/shell_package_builder.py | Python | apache-2.0 | 5,913 |
#! -*- coding:utf-8 -*-
from django.db import models
from django.contrib.auth.models import User
from kullanici.models import IsVeren
class Adres(models.Model):
kullanici = models.ForeignKey(IsVeren,related_name="adres")
adres_basligi = models.CharField(max_length=50)
adres = models.CharField(max_length=80... | ufukdogan92/is-teklif-sistemi | adres/models.py | Python | gpl-3.0 | 1,053 |
#!/usr/bin/env python
# vim: fdm=indent
'''
author: Fabio Zanini
date: 07/08/17
content: Test Dataset class.
'''
import numpy as np
import pytest
@pytest.fixture(scope="module")
def ds():
from singlet.dataset import Dataset
return Dataset(samplesheet='example_sheet_tsv', counts_table='example_tab... | iosonofabio/singlet | test/dataset/test_correlation.py | Python | mit | 4,276 |
from functools import reduce
from operator import mul
print(sum(int(c) for c in str(reduce(mul, range(1,101)))))
| jokkebk/livecoding | Euler16-20/p20.py | Python | mit | 114 |
"""Support for Sensirion SHT31 temperature and humidity sensor."""
from datetime import timedelta
import logging
import math
from Adafruit_SHT31 import SHT31
import voluptuous as vol
from homeassistant.components.sensor import PLATFORM_SCHEMA, SensorEntity
from homeassistant.const import (
CONF_MONITORED_CONDITI... | sander76/home-assistant | homeassistant/components/sht31/sensor.py | Python | apache-2.0 | 4,063 |
from setuptools import setup, find_packages
setup(
name="txtalert",
version="0.1",
url='http://github.com/praekelt/txtalert',
license='GPL',
description=("txtAlert sends automated, personalized SMS reminders "
"to patients on chronic medication."),
long_description = open('REA... | praekelt/txtalert | setup.py | Python | gpl-3.0 | 1,296 |
# uncompyle6 version 2.9.10
# Python bytecode 2.7 (62211)
# Decompiled from: Python 3.6.0b2 (default, Oct 11 2016, 05:27:10)
# [GCC 6.2.0 20161005]
# Embedded file name: iso8859_9.py
""" Python Character Mapping Codec iso8859_9 generated from 'MAPPINGS/ISO8859/8859-9.TXT' with gencodec.py.
"""
import codecs
class Co... | DarthMaulware/EquationGroupLeaks | Leak #5 - Lost In Translation/windows/Resources/Python/Core/Lib/encodings/iso8859_9.py | Python | unlicense | 1,902 |
import clr
clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import *
clr.AddReference("RevitNodes")
import Revit
clr.ImportExtensions(Revit.Elements)
clr.ImportExtensions(Revit.GeometryConversion)
clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager
from Revi... | andydandy74/ClockworkForDynamo | nodes/2.x/python/PerspectiveView.OrientToEyeAndTargetPosition.py | Python | mit | 800 |
#!/usr/bin/env python
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# ... | ted-ross/qpid-dispatch | tools/scraper/text.py | Python | apache-2.0 | 4,550 |
#!/usr/bin/python
import sys;
from AnnotationLib import *
from optparse import OptionParser
if __name__ == "__main__":
parser = OptionParser();
parser.add_option('-a', '--annolist', dest='annolist_name', type="string", help='input annotation list (*.al or *.idl)', default=None)
parser.add_option('-o',... | sameeptandon/sail-car-log | car_tracking/annoProc.py | Python | bsd-2-clause | 5,054 |
'''
Created on Mar 1, 2016
@author: PJ
'''
from BaseScouting.api_scraper.fake_data_scripts.TempRetrofilSrFromOfficialResults import TempRetrofillSrFromOfficialResults
from BaseScouting.load_django import load_django
class TempRetrofillSrFromOfficialResults2017(TempRetrofillSrFromOfficialResults):
gear_lookup = ... | ArcticWarriors/scouting-app | ScoutingWebsite/Scouting2017/api_scraper/fake_data_scripts/retrofil_matchresults.py | Python | mit | 4,792 |
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use ... | IsCoolEntertainment/debpkg_libcloud | libcloud/compute/drivers/rimuhosting.py | Python | apache-2.0 | 12,620 |
#!/usr/bin/env python
#
# @file CMakeListsFile.py
# @brief class for generating cmake lists file
# @author Frank Bergmann
# @author Sarah Keating
# @author Matthew S. Gillman
#
# <!--------------------------------------------------------------------------
#
# Copyright (c) 2013-2018 by the California Institute ... | sbmlteam/deviser | deviser/cmake_files/CMakeListsFile.py | Python | lgpl-2.1 | 8,264 |
"""TESTS FOR SHOPPING LIST ITEMS"""
import unittest
from datetime import date
from app import shopping_lists_items
class TestCasesItems(unittest.TestCase):
"""TESTS FOR ITEMS CREATION AND BEHAVIOUR"""
def setUp(self):
self.item = shopping_lists_items.ShoppingListItems()
def tearDown(self):
... | parseendavid/Andela-Developer-Challenge---Shopping-List-V2.0 | tests/items_test.py | Python | mit | 2,665 |
#!/usr/bin/env python2
# vim:fileencoding=utf-8
from __future__ import (unicode_literals, division, absolute_import,
print_function)
__license__ = 'GPL v3'
__copyright__ = '2013, Kovid Goyal <kovid at kovidgoyal.net>'
from collections import OrderedDict
from calibre.ebooks.docx.block_styles im... | ashang/calibre | src/calibre/ebooks/docx/char_styles.py | Python | gpl-3.0 | 9,147 |
# Reserved constant used as key in other_args_to_resolve to configure if we
# return sync or async handle of a deployment.
# True -> RayServeSyncHandle
# False -> RayServeHandle
USE_SYNC_HANDLE_KEY = "__use_sync_handle__"
| ray-project/ray | python/ray/serve/pipeline/constants.py | Python | apache-2.0 | 222 |
# Copyright 2013 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
class ShelveUnicodeWrapper(object):
"""
Convert unicode to str and back again, since python-2.x shelve
module doesn't support unicode.
"""
def __init__(self, shelve_instance):
self._shelve = shelve_instance
d... | funtoo/portage-funtoo | pym/portage/util/_ShelveUnicodeWrapper.py | Python | gpl-2.0 | 1,005 |
import sys
import argparse
from itertools import izip
import math
def parseArgument():
# Parse the input
parser = argparse.ArgumentParser(description = "Make regions with 0 signal the average of their surrounding regions")
parser.add_argument("--signalsFileName", required=True, help='Signals file')
parser.add_argu... | imk1/IMKTFBindingCode | averageZeroSignalsWithinPeaks.py | Python | mit | 2,918 |
# -*- encoding: utf-8 -*-
'''
Created on 18/05/2013
@author: romuloigor
'''
import datetime
from django.conf import settings
from django.core.cache import cache, get_cache
from django.utils.importlib import import_module
class SessionExpiredMiddleware:
def process_request(self, request):
if settings.EN... | solidit/myproject | portal/middleware/multilogin_restrict.py | Python | unlicense | 1,882 |
import pytest
from test.conftest import got_postgresql
@pytest.mark.skipif(not got_postgresql(), reason='Needs postgresql')
class TestSqlitePostgresSchemaEquivalence(object):
def test_equality(self, schema_sl, schema_pg):
sl_table_names = set([t.name for t in schema_sl.tables])
pg_table_names = s... | freewilll/abridger | test/postgresql/test_sqlite_postgres_schema_equivalence.py | Python | mit | 1,077 |
import os
import re
import json
import datetime
import collections
from pycmark.util.enum import enum
################################################################################
ActionEnum = enum(['Created', 'Renamed', 'Updated', 'Deleted'], name='ActionEnum')
##################################################... | daryl314/markdown-browser | pyevernote/EvernoteMetadata.py | Python | mit | 10,044 |
# -*- coding: utf-8 -*-
"""
zine.docs.builder
~~~~~~~~~~~~~~~~~~~~~~
The documentation building system. This is only used by the
documentation building script.
:copyright: (c) 2010 by the Zine Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
import re
impor... | mitsuhiko/zine | zine/docs/builder.py | Python | bsd-3-clause | 2,947 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""
Virt management features
Copyright 2007, 2012 Red Hat, Inc
Michael DeHaan <michael.dehaan@gmail.com>
Seth Vidal <skvidal@fedoraproject.org>
This software may be freely redistributed under the terms of the GNU
general public license.
You should have received a copy of th... | milad-soufastai/ansible-modules-extras | cloud/misc/virt.py | Python | gpl-3.0 | 14,618 |
from lxml.builder import E
from jnpr.junos.utils.util import Util
from jnpr.junos.utils.start_shell import StartShell
class FS(Util):
"""
Filesystem (FS) utilities:
cat - show the contents of a file
checksum - calculate file checksum (md5,sha256,sha1)
copy - local file copy (not scp)
... | dgjnpr/py-junos-eznc | lib/jnpr/junos/utils/fs.py | Python | apache-2.0 | 13,736 |
# -*- coding: utf-8 -*-
import os
from hashlib import md5
from django.conf import settings
from django.db import models
from knowledge_base.core.db.models import CatalogueMixin
def get_area_image_path(instance, filename):
"""
Get the upload path to the profile image.
"""
return '{0}/{1}{2}'.format(
... | jualjiman/knowledge-base | src/knowledge_base/posts/models.py | Python | apache-2.0 | 3,653 |
import warnings
try:
from jsoneditor.fields.django_jsonfield import JSONField as JSONFieldBase
except ImportError:
from django.db import models
class JSONFieldBase(models.TextField):
def __init__(self, *args, **kwargs):
warnings.warn(
'"jsoneditor" module not available... | nesdis/djongo | djongo/models/json.py | Python | agpl-3.0 | 570 |
from setuptools import setup, find_packages
setup(
name='freezegame',
version='0.1',
packages=find_packages(),
)
| mattfister/freezegame | setup.py | Python | mit | 127 |
def hanoi (n,s,t,b):
assert n > 0
if n == 1:
print 'move', s, 'to', t
else:
hanoi(n-1, s, b, t)
hanoi(1, s , t, b)
hanoi (n-1, b, t, s)
x = int(raw_input("Enter The Number Of Disks In The Tower Of Hanoi: "))
for i in range (1, x):
print 'New Hanoi Example: hanoi(',i,', ... | AlanJudi/Alanjudi | towerHanoi.py | Python | gpl-3.0 | 475 |
z = lambda x, y=1, *args, **kwargs: x * y + sum(args) * kwargs.get("k", 1)
z(<arg1>1, <arg2>2, <arg3>4, <arg4>k=5)
| asedunov/intellij-community | python/testData/paramInfo/LambdaVariousArgs.py | Python | apache-2.0 | 115 |
"""Urls for feedgrabber authors"""
from django.conf.urls.defaults import *
from feedgrabber.models import Author
author_conf = {'queryset': Author.objects.all()}
urlpatterns = patterns('django.views.generic.list_detail',
url(r'^$', 'object_list',
author_conf, 'feedgr... | Fantomas42/django-feedgrabber | feedgrabber/urls/authors.py | Python | bsd-3-clause | 583 |
__author__ = "Jordan Anderson"
__email__ = "jodog59@gmail.com"
from pynq import MMIO
from pynq import PL
class Register(object):
"""This class controls the Registers near the Video PR.
Attributes
----------
index : int
The index of the register, starting from 0.
offset : int
The offset fr... | AEW2015/PYNQ_PR_Overlay | python/pynq/board/registers.py | Python | bsd-3-clause | 1,397 |
"""
Low level *Skype for Linux* interface implemented using *XWindows messaging*.
Uses direct *Xlib* calls through *ctypes* module.
This module handles the options that you can pass to `Skype.__init__`
for Linux machines when the transport is set to *X11*.
No further options are currently supported.
Warning PyGTK fr... | jpablobr/emacs.d | vendor/misc/emacs-skype/build/Skype4Py/Skype4Py/api/posix_x11.py | Python | gpl-3.0 | 17,077 |
#!/usr/bin/python
import pickle as pkl
import sys
def main(pose_id, file_with_list_of_poses):
'''Takes the pickle file that we have already stored with a dictionary of poses in it.
Then it deletes a line in the ragdoll_model2_plugin.cc and replaces the line with a
line taken from the dictionary correspond... | gt-ros-pkg/hrl_autobed_dev | autobed_pose_estimator/src/model_plugin_modifier.py | Python | mit | 2,355 |
# -*- coding: utf-8 -*-
import logging
import os
_logger = logging.getLogger(__name__)
try:
import MySQLdb
import MySQLdb.cursors
except ImportError:
pass
from openerp.addons.import_framework.import_base import import_base
try:
from pandas import merge, DataFrame
except ImportError:
pass
from ope... | litnimax/addons-yelizariev | import_custom/import_custom.py | Python | lgpl-3.0 | 10,226 |
# Update all genes from Entrez Gene that
# are relevant to the organism we passed in via the
# command line
import Config
import sys, string, argparse
import MySQLdb
import Database
import gzip
from classes import EntrezGene
# Process Command Line Input
argParser = argparse.ArgumentParser( description... | BioGRID/BioGRID-Annotation | EG_updateGenes.py | Python | mit | 3,753 |
# coding: utf-8
import json
import unittest
from app import app
from app.models.properties import Property
class ResourcesTestCase(unittest.TestCase):
def setUp(self):
self.maxDiff = None
self.client = app.test_client()
Property.drop_collection()
self.propertie_1 = Property(
... | IuryAlves/code-challenge | tests/resource_tests.py | Python | mit | 7,327 |
from semeval import helper as helper
from semeval.lstms.LSTMModel import LSTMModel
import numpy
from keras.models import Sequential
from keras.layers import Dense, Activation, Bidirectional, LSTM, Dropout
from keras.callbacks import EarlyStopping
class EarlyStoppingLSTM(LSTMModel):
'''Model that can train an LST... | apmoore1/semeval | lstms/EarlyStoppingLSTM.py | Python | gpl-3.0 | 2,914 |
import random
#Differential evolution optimizer based on Scipy implementation:
#http://python-scipy.sourcearchive.com/documentation/0.6.0/classscipy_1_1sandbox_1_1rkern_1_1diffev_1_1DiffEvolver.html
def argmin(x):
if len(x) < 2:
return x[0]
bestv,idx = x[0],0
for e,i in enumerate(x[1:],1):
... | Ttl/evolutionary-circuits | evolutionary/optimization/diff_evolve.py | Python | mit | 9,473 |
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
import pika
from random import randint
from Queue import (
Queue,
Empty
)
from configman import (
Namespac... | cliqz/socorro | socorro/external/rabbitmq/crashstorage.py | Python | mpl-2.0 | 11,842 |
import tensorflow as tf
from tensorflow import keras
import deepx.config
deepx.config.set_backend("tensorflow")
from deepx import keras as nn
from deepx.backend import T
T.set_default_device(T.gpu())
# input image dimensions
img_rows, img_cols = 28, 28
num_classes = 10
# the data, split between train and test sets
(x... | sharadmv/deepx | examples/tensorflow/keras_cnn.py | Python | mit | 1,872 |
# -*- coding: utf-8 -*-
import requests
class TuLing(object):
SUB_TYPE_TEXT = 100000
def __init__(self, *args, **kwargs):
super(TuLing, self).__init__()
self._api_key = kwargs.get('api_key')
self._api_secret = kwargs.get('api_secret')
self._api_url = kwargs.get('api_url')
... | ciknight/doge | ext/tuling/__init__.py | Python | mit | 825 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.