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 |
|---|---|---|---|---|---|
from future.moves.urllib.parse import quote
try: import simplejson as json
except ImportError: import json
import six
from .utils import build_where_clause, build_choose_clause
from .client import QuickBooks
from .exceptions import QuickbooksException
class ToJsonMixin(object):
def to_json(self):
return... | sidecars/python-quickbooks | quickbooks/mixins.py | Python | mit | 10,936 |
# .. coding: utf-8
# $Id: __init__.py 7971 2016-09-13 19:11:48Z milde $
# Author: Engelbert Gruber, Günter Milde
# Maintainer: docutils-develop@lists.sourceforge.net
# Copyright: This module has been placed in the public domain.
"""LaTeX2e document tree Writer."""
__docformat__ = 'reStructuredText'
# code contributi... | axbaretto/beam | sdks/python/.tox/docs/lib/python2.7/site-packages/docutils/writers/latex2e/__init__.py | Python | apache-2.0 | 124,941 |
# 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
# d... | openstack/ironic | ironic/conductor/base_manager.py | Python | apache-2.0 | 27,613 |
from client import Client, NOTIF_SUCCESS
URL = u'/organizations'
BTN_DELETE = u"//a[@class='delete' and contains(@data-confirm, '{0}')]"
BTN_EDIT = (u"//a[normalize-space(.)='{0}' and contains"
"(@href,'organizations')]/"
"../../td/div/a[@data-toggle='dropdown']")
BTN_NEW = u'/organizations/new... | SatelliteQE/staplegun | staplegun/organization.py | Python | gpl-3.0 | 3,111 |
from flask_restful import Resource
from flask import g, Response
class PredicatesHandler(Resource):
def get(self, graph):
"""
:return: All the predicates ?p used in the triples stored in all the graphs
"""
query = """SELECT DISTINCT ?predicate
WHERE {
GRAPH <%s>... | b-cube/restparql | api/resources/predicates.py | Python | gpl-3.0 | 584 |
#!usr/bin/python
#Gmail Brute Forcer
#To use this script you need ClientCookie and Client Form.
#http://wwwsearch.sourceforge.net/ClientCookie/src/ClientCookie-1.0.3.tar.gz
#http://wwwsearch.sourceforge.net/ClientForm/src/ClientForm-0.1.17.tar.gz
#To install the package, run the following command:
#python setup.py buil... | knightmare2600/d4rkc0de | bruteforce/gmailbrute.py | Python | gpl-2.0 | 2,738 |
"""SnowFloat Client Library Tests."""
| snowfloat/snowfloat-python | tests/__init__.py | Python | bsd-3-clause | 38 |
'''
Created on Sep 22, 2016
@author: rtorres
'''
from flaskiwsapp.snippets.exceptions.baseExceptions import LogicalException
class RoleExistsException(LogicalException):
def __init__(self, argument=None):
super(RoleExistsException, self).__init__()
self.message = 'The role %s already exists' % a... | rafasis1986/EngineeringMidLevel | flaskiwsapp/snippets/exceptions/roleExceptions.py | Python | mit | 545 |
import os
import errno
import importlib.machinery
import py_compile
import shutil
import unittest
import tempfile
from test import support
import modulefinder
TEST_DIR = tempfile.mkdtemp()
TEST_PATH = [TEST_DIR, os.path.dirname(tempfile.__file__)]
# Each test description is a list of 5 items:
#
# 1. a module name t... | brython-dev/brython | www/src/Lib/test/test_modulefinder.py | Python | bsd-3-clause | 12,492 |
class Solution(object):
def rotateRight(self, head, k):
"""
:type head: ListNode
:type k: int
:rtype: ListNode
"""
if k == 0 or not head or not head.next :
return head
nHead = ListNode(0)
nHead.next = head
end = nHead
nEnd =... | saai/LeetcodePythonSolutions | linkedList/rotateRight.py | Python | mit | 595 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals, absolute_import
import six
from sys import platform
import locale
import os.path
from pelican.tests.support import unittest, get_settings
from pelican.contents import Page, Article, Static, URLWrapper, Author, Category
from pelican.settings import DEFA... | goerz/pelican | pelican/tests/test_contents.py | Python | agpl-3.0 | 24,186 |
# Licensed under a 3-clause BSD style license - see LICENSE.rst
from __future__ import absolute_import, division, print_function
from fermipy.tests.utils import requires_dependency
try:
from fermipy.jobs.gtlink import Gtlink
from fermipy.jobs.file_archive import FileFlags
except ImportError:
pass
# Skip ... | jefemagril/fermipy | fermipy/jobs/tests/test_gtlink.py | Python | bsd-3-clause | 1,727 |
import os
import platform
import socket
from upd89.classes import system_register, system_notify
def get_hostname():
return socket.gethostname()
def get_fqdn():
return socket.getfqdn()
def get_urn():
return 'demo-' + get_hostname() + '-demo'
def get_distro():
return ' '.join(platform.linux_dist... | upd89/agent | upd89/lib/sysinfo.py | Python | mit | 1,518 |
#!/usr/bin/python
#
# Copyright (c) 2016, Nest Labs, 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 copyright
# notice, thi... | JiahuiZHONG/Internship_Thread | tests/scripts/thread-cert/Cert_6_4_01_LinkLocal.py | Python | bsd-3-clause | 2,986 |
# 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... | UTSA-ICS/keystone-kerberos | keystone/contrib/revoke/core.py | Python | apache-2.0 | 9,529 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "ratemy.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| nashrafeeg/ratemy | manage.py | Python | gpl-2.0 | 249 |
# vim: set encoding=utf-8
# 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 require... | ashaarunkumar/spark-tk | integration-tests/tests/test_gmm.py | Python | apache-2.0 | 2,556 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('download_manager', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name='communityuser',
... | ossbox/django-download-manager | django_download_manager/download_manager/migrations/0002_auto_20141202_0152.py | Python | mit | 1,826 |
#encoding=utf-8
import pymongo
db_info_test = {
'host' : 'localhost',
'port' : 27017,
'db' : 'test',
}
con = None
db = None
def init_db(profile):
global con, db
con = pymongo.Connection(profile['host'], profile['port'])
db = con[profile['db']]
def to_dict(o):
del o['_id']
return o
| c4pt0r/tornado-user | db_utils.py | Python | mit | 320 |
#
# Copyright (c) 2014 ThoughtWorks, Inc.
#
# Pixelated 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 version.
#
# Pixelated is distrib... | PuZZleDucK/pixelated-user-agent | service/test/functional/features/environment.py | Python | agpl-3.0 | 2,804 |
# -*- coding: utf-8 -*-
"""
Integration tests for submitting problem responses and getting grades.
"""
# pylint: disable=attribute-defined-outside-init
import json
import os
from textwrap import dedent
import ddt
import six
from django.conf import settings
from django.contrib.auth.models import User # lint-amnesty... | stvstnfrd/edx-platform | lms/djangoapps/courseware/tests/test_submitting_problems.py | Python | agpl-3.0 | 47,999 |
################################################################################
# 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... | lincoln-lil/flink | flink-python/pyflink/table/tests/test_catalog_completeness.py | Python | apache-2.0 | 5,362 |
"""Support for SleepIQ from SleepNumber."""
import logging
from datetime import timedelta
from requests.exceptions import HTTPError
import voluptuous as vol
import homeassistant.helpers.config_validation as cv
from homeassistant.helpers import discovery
from homeassistant.helpers.entity import Entity
from homeassista... | jnewland/home-assistant | homeassistant/components/sleepiq/__init__.py | Python | apache-2.0 | 3,165 |
__author__ = 'RajaganeshVanarajan'
print("This is my first line of learning Python! Hello World!")
for i in range(1,100):
print(i)
else:
print(i)
while(i<100):
print(i)
i=i+1
| rajaganeshv/PythonPractice | MyFiles.py | Python | mit | 195 |
# -*- coding: utf-8 -*-
"""
Setup
-----
Install troposphere in the current python environment.
"""
# ----------------------------------------------------------------------------
# Imports
# ----------------------------------------------------------------------------
# ---- Future
from __future__ import print_functio... | ikben/troposphere | setup.py | Python | bsd-2-clause | 2,763 |
# ==================================================
# BEGIN - MPI settings
# ==================================================
import logging
from mpi4py import MPI
try:
# noinspection PyUnresolvedReferences
MPI_INITIALIZED
except NameError:
MPI_INITIALIZED = False
if not MPI_INITIALIZED:
MPI_COMM =... | structrans/Canon | canon/mpi/init.py | Python | mit | 966 |
#!/usr/bin/python
# -*- coding: latin-1 -*-
'''
Experiments with weighted sets.
Somewhat like fuzzy sets in that items can have partial membership in a set.
e.g. for similarity measure and for context based on distance in time.
The general format for a set here is [[item, score],[item, score],...]
This is wrapped in ... | axeltidemann/self_dot | experiments/weightedSet_experiment1.py | Python | gpl-3.0 | 6,493 |
###############################################################################
#
# Tests for XlsxWriter.
#
# Copyright (c), 2013, John McNamara, jmcnamara@cpan.org
#
import unittest
from ...compatibility import StringIO
from ..helperfunctions import _xml_to_list
from ...table import Table
from ...worksheet import Wor... | ivmech/iviny-scope | lib/xlsxwriter/test/table/test_table10.py | Python | gpl-3.0 | 1,992 |
# -*- coding: utf-8 -*-
# Copyright 2022 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-certificate-manager | samples/generated_samples/certificatemanager_v1_generated_certificate_manager_delete_certificate_sync.py | Python | apache-2.0 | 1,636 |
# Copyright (c) 2013 - 2016 by pyramid_fullauth authors and contributors <see AUTHORS file>
#
# This module is part of pyramid_fullauth and is released under
# the MIT License (MIT): http://opensource.org/licenses/MIT
"""Basic views."""
| fizyk/pyramid_fullauth | src/pyramid_fullauth/views/basic/__init__.py | Python | mit | 237 |
import img_translator as it
import maze_vision_algo as mvsp
import os
import string
def main():
f=open('config.txt','r')
line = f.next()
strpi=line
strpi.replace('\n','')
print(strpi)
rad = it.trans_main()
#print(rad)
p = mvsp.mvsp(rad)
#this=spur.SshShell(hostname="192.168.1.17", username="pi... | jpschnel/maze-vision | Amazeing.py | Python | apache-2.0 | 664 |
from core import BotAI
from core import Connector
from decorators import message_must_begin_with
from decorators import message_must_begin_with_attr
from decorators import message_must_begin_with_nickname
| sujaymansingh/dudebot | dudebot/__init__.py | Python | bsd-2-clause | 206 |
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
import sys
import os
extra = {}
if sys.version_info >= (3,):
extra['use_2to3'] = True
setup(name='Code2pdf',
version='1.1.0',
install_requires=[
r for r in open('requirements.txt', 'r').read().spli... | tushar-rishav/code2pdf | setup.py | Python | mit | 1,140 |
"""
Copyright (c) 2012-2013 RockStor, Inc. <http://rockstor.com>
This file is part of RockStor.
RockStor 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 la... | kamal-gade/rockstor-core | src/rockstor/storageadmin/views/serializers.py | Python | gpl-3.0 | 977 |
# -*- coding: utf-8 -*-
import os
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
import sy, sy.path
setup(
name='sy',
version=sy.__version__,
url='http://sy.afajl.com',
license='BSD',
author='Paul Diaconescu',
author_email='p@afajl.com',
de... | afajl/sy | setup.py | Python | bsd-3-clause | 1,024 |
__author__ = 'Simon'
import pygame
import Constants
import datetime
from Entities.Dsoul import Dsoul
from Levels.Stage.Stage_01 import Stage_01
def main():
""" Main Program """
pygame.init()
# Manage the screen
size = [Constants.SCREEN_WIDTH, Constants.SCREEN_HEIGHT]
screen = pygame.display.set_... | dreadsoul632/HackSlashDsoul | trunk/HackSlashDsoul.py | Python | gpl-2.0 | 2,962 |
# ----------------------------------------------------------------------------
# pyglet
# Copyright (c) 2006-2007 Alex Holkner
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# * Redistributi... | jbaayen/sympy | sympy/thirdparty/pyglet/pyglet/gl/gl.py | Python | bsd-3-clause | 103,044 |
#!/usr/bin/env python
# Copyright 2018, 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:
#
# * Redistributions of source code must retain the above copyright
# notice, this list o... | grpc/grpc-ios | native_src/third_party/googletest/googletest/test/googletest-json-outfiles-test.py | Python | apache-2.0 | 5,705 |
import base64
import datetime
import hashlib
import io
import os
from loguru import logger
from sqlalchemy import Column, DateTime, Integer, String, Unicode
from flexget import db_schema, plugin
from flexget.event import event
from flexget.utils.sqlalchemy_utils import table_add_column, table_columns
from flexget.uti... | malkavi/Flexget | flexget/plugins/output/rss.py | Python | mit | 10,415 |
# -*- coding: utf-8 -*-
"""
Tests for Optical elements
--------------------------
.. automodule:: tests.raycing.test_asymmetric_xtal
.. automodule:: tests.raycing.test_backcattering_xtal_Shvydko
"""
| kklmn/xrt | tests/raycing/test_oes.py | Python | mit | 205 |
# This file is part of the Frescobaldi project, http://www.frescobaldi.org/
#
# Copyright (c) 2008 - 2014 by Wilbert Berendsen
#
# 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
... | anthonyfok/frescobaldi | frescobaldi_app/userguide/util.py | Python | gpl-2.0 | 6,191 |
from baseanalyzer import *
from mysqlanalyzer import *
from postgresqlanalyzer import *
from sqlite3analyzer import *
def get_analyzer(deployer):
if deployer.get_database().name == 'MySQL':
return MySQLAnalyzer(deployer)
elif deployer.get_database().name == 'PostgreSQL':
return PostgreSQLAnalyzer(deployer)
elif... | cmu-db/cmdbac | core/analyzers/__init__.py | Python | apache-2.0 | 437 |
# Copyright (C) 2013 eBay Inc.
# Copyright (C) 2013 OpenStack Foundation
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/lice... | ge0rgi/cinder | cinder/tests/unit/db/test_qos_specs.py | Python | apache-2.0 | 8,566 |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Addons modules by CLEARCORP S.A.
# Copyright (C) 2009-TODAY CLEARCORP S.A. (<http://clearcorp.co.cr>).
#
# This program is free software: you can redistribute... | 3dfxsoftware/cbss-addons | budget/sale.py | Python | gpl-2.0 | 6,328 |
# -*- coding: utf-8 -*-
# Resource object code
#
# Created: Sun Sep 2 11:54:53 2012
# by: The Resource Compiler for PyQt (Qt v4.8.2)
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore
qt_resource_data = b"\
\x00\x00\x04\x58\
\x89\
\x50\x4e\x47\x0d\x0a\x1a\x0a\x00\x00\x00\x0d\x49\x... | craftoid/sconcho | sconcho/gui/icons_rc.py | Python | gpl-3.0 | 575,341 |
# -*- coding: utf-8 -*-
# (c) 2016 Alfredo de la Fuente - AvanzOSC
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html
from openerp import models, api
class StockMove(models.Model):
_inherit = 'stock.move'
@api.multi
def action_confirm(self):
moves = self.filtered(lambda r: r.raw_mat... | esthermm/odoomrp-wip | mrp_production_machine_location/models/stock_move.py | Python | agpl-3.0 | 669 |
class Macro(object):
WEIGHT_LOSS = 1
WEIGHT_MAINTAIN = 2
WEIGHT_GAIN = 3
def __init__(self, model):
self.model = model
self.debug = False
self.carbsPercent = 0.45
self.protienPercent = 0.25
self.fatPercent = 0.30
self.BMR = 0
self.calories = 0
self.fat =... | airportmarc/the416life | src/apps/utls/macros/Macros.py | Python | mit | 2,881 |
__author__ = 'jtseng2'
| abad623/verbalucce | verbalucce/gmail/__init__.py | Python | apache-2.0 | 23 |
from itertools import chain
from oscar.apps.promotions.models import PagePromotion, KeywordPromotion
def promotions(request):
"""
For adding bindings for banners and pods to the template
context.
"""
promotions = get_request_promotions(request)
# Split the promotions into separate lists for ... | pasqualguerrero/django-oscar | src/oscar/apps/promotions/context_processors.py | Python | bsd-3-clause | 1,592 |
from .logical_form_instance import LogicalFormInstance, IndexedLogicalFormInstance
from .text_classification_instance import TextClassificationInstance, IndexedTextClassificationInstance
from .tuple_instance import TupleInstance, IndexedTupleInstance
| matt-gardner/deep_qa | deep_qa/data/instances/text_classification/__init__.py | Python | apache-2.0 | 251 |
from __future__ import division
import math
from itertools import product
import numpy as np
from numpy.testing import assert_allclose, assert_equal, assert_
from pytest import raises as assert_raises
from scipy.sparse import csr_matrix, csc_matrix, lil_matrix
from scipy.optimize._numdiff import (
_adjust_schem... | arokem/scipy | scipy/optimize/tests/test__numdiff.py | Python | bsd-3-clause | 24,483 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.6 on 2017-11-01 02:38
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('django_celery_results', '0001_initial'),
('upload',... | UDONRadio/UDON_back | upload/migrations/0003_fileupload_task.py | Python | gpl-3.0 | 616 |
# -*- coding: utf-8 -*-
#
# Copyright 2018 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law... | dhermes/google-cloud-python | monitoring/google/cloud/monitoring_v3/gapic/notification_channel_service_client.py | Python | apache-2.0 | 35,471 |
# -*- coding: utf-8 *-*
# Copyright (c) 2013 Tisserant Pierre
#
# This file is part of Dragon dice simulator.
#
# Dragon dice simulator 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 ve... | TheLazyHase/dragon_dice_simulator | business/army/roll/save_missile.py | Python | gpl-3.0 | 1,068 |
#!/usr/bin/env python3
'''
Builds a c-net representing a variant of the Dekker's agorithm on n processses,
with n >= 2. Each process has three states, p0, p1, and p3. p0 is initial.
From there, the process executes 'try' and raises its flag, reaching p1.
In p1, if at least one of the other process has a high flag, it... | cesaro/cunf | scripts/mkdekker.py | Python | gpl-3.0 | 3,018 |
import requests
# Budapest
longitude = 19.05
latitude = 47.53
url_template = 'https://api.forecast.io/forecast/{api}/{lat},{lon}'
apikey = 'e2fd60c047ae3fac95a0618a98a9e5fd'
url = url_template.format(api=apikey, lat=latitude, lon=longitude)
# print url
params_dict = {
'units': 'si'
}
r = requests.get(url, par... | Pylvax/code | http_client/forecast-sample.py | Python | mit | 445 |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
import logging
from collections import namedtuple
from odoo import _, api, fields, models
from odoo.exceptions import UserError
_logger = logging.getLogger(__name__)
class Warehouse(models.Model):
_name = "stock.... | ddico/odoo | addons/stock/models/stock_warehouse.py | Python | agpl-3.0 | 55,095 |
import yarom as Y
from yarom.rdfUtils import print_graph
import logging as L
Y.connect(conf={'rdf.namespace' : 'http://mark-watts.tk/entities/',
'rdf.source' : 'default'})
class ToppingAmount(Y.DataObject):
""" An amount of a topping """
class Topping(Y.DataObject):
""" A pluralization of a topping type... | mwatts15/YAROM | examples/pizza.py | Python | bsd-3-clause | 8,308 |
# -*- coding: utf-8 -*-
from menus.base import NavigationNode
from menus.menu_pool import menu_pool
from cms.menu_bases import CMSAttachMenu
class TestMenu(CMSAttachMenu):
name = "test menu"
def get_nodes(self, request):
nodes = []
n = NavigationNode('sample root page', "/", 1)
n2 = ... | Venturi/oldcms | env/lib/python2.7/site-packages/cms/test_utils/util/menu_extender.py | Python | apache-2.0 | 668 |
import sys
import os
import pytest
from tornado.web import URLSpec
from .utils import handle_import_error
try:
sys.path.append('.')
from tornado_json.api_doc_gen import _get_tuple_from_route
from tornado_json.api_doc_gen import get_api_docs
from tornado_json.routes import get_routes
sys.path.appe... | Tarsbot/Tornado-JSON | tests/test_api_doc_gen.py | Python | mit | 1,461 |
# -*- coding: utf-8 -*-
"""
/***************************************************************************
ApiCompat
A QGIS plugin
API compatibility layer
-------------------
begin : 2013-07-02
copyright : (C) 2013 ... | manisandro/qgis-cloud-plugin | qgiscloud/apicompat/sipv1/decorators.py | Python | gpl-2.0 | 4,270 |
class Edge:
def __init__(self, from_node, to_node, valence):
self.from_node = from_node
self.to_node = to_node
self.valence = valence | dwettstein/pattern-recognition-2016 | molecules/edge.py | Python | mit | 161 |
from django.contrib.gis.db import models
class City(models.Model):
name = models.CharField(max_length=60)
insee = models.CharField(max_length=5)
zip = models.CharField(max_length=5)
geom = models.PointField()
objects = models.GeoManager()
class Place(models.Model):
"""
A place in the worl... | SpreadBand/SpreadBand | apps/world/models.py | Python | agpl-3.0 | 487 |
#!/usr/bin/env python
#
# Wrapper script for Java Conda packages that ensures that the java runtime
# is invoked with the right options. Adapted from the bash script (http://stackoverflow.com/questions/59895/can-a-bash-script-tell-what-directory-its-stored-in/246128#246128).
#
# Program Parameters
#
import os
import s... | ostrokach/bioconda-recipes | recipes/pgdspider/PGDSpider2-cli.py | Python | mit | 3,267 |
# -*- coding: utf-8 -*-
"""module defines utility methods for MPContribs core.io library"""
from __future__ import unicode_literals
from decimal import Decimal, DecimalException, InvalidOperation
import six
from mpcontribs.io.core import mp_id_pattern
try:
from StringIO import StringIO
except ImportError:
from... | materialsproject/MPContribs | mpcontribs-io/mpcontribs/io/core/utils.py | Python | mit | 5,005 |
from enum import Enum, IntEnum
from math import isnan
from test.test_json import PyTest, CTest
SMALL = 1
BIG = 1<<32
HUGE = 1<<64
REALLY_HUGE = 1<<96
class BigNum(IntEnum):
small = SMALL
big = BIG
huge = HUGE
really_huge = REALLY_HUGE
E = 2.718281
PI = 3.141593
TAU = 2 * PI
class FloatNum(float, Enu... | Microvellum/Fluid-Designer | win64-vc/2.78/python/lib/test/test_json/test_enum.py | Python | gpl-3.0 | 4,034 |
# vim: set fileencoding=utf-8 sw=4 ts=4 et :
# pylint: disable-msg=C0111,W0212,R0904
# Copyright (C) 2011-2020 CS GROUP - France
# License: GNU GPL v2 <http://www.gnu.org/licenses/gpl-2.0.html>
from __future__ import absolute_import
from .test_xsdutil import XSDTest
class HosttemplateXSD(XSDTest):
"""
Test du... | vigilo/vigiconf | src/vigilo/vigiconf/test/test_xsd_hosttemplate.py | Python | gpl-2.0 | 732 |
# Author: Nic Wolfe <nic@wolfeden.ca>
# URL: http://code.google.com/p/sickbeard/
#
# This file is part of Sick Beard.
#
# Sick Beard is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of t... | mattsch/Sickbeard | sickbeard/providers/tvnzb.py | Python | gpl-3.0 | 6,837 |
"""
Django settings for sys_monitor project.
Generated by 'django-admin startproject' using Django 1.10.5.
For more information on this file, see
https://docs.djangoproject.com/en/1.10/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.10/ref/settings/
"""
impor... | PeterXUYAOHAI/System_Monitor | sys_monitor/settings.py | Python | mit | 3,109 |
# f90wrap: F90 to Python interface generator with derived type support
#
# Copyright James Kermode 2011-2018
#
# This file is part of f90wrap
# For the latest version see github.com/jameskermode/f90wrap
#
# f90wrap is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser Gene... | jameskermode/f90wrap | examples/example2/test_package.py | Python | lgpl-3.0 | 3,544 |
from luigi import Parameter
from luigi.contrib.s3 import S3Target
from ob_pipelines import LoggingTaskWrapper
from ob_pipelines.apps.kallisto import merge_column
from ob_pipelines.config import settings
from ob_pipelines.entities.persistence import get_samples_by_experiment_id
from ob_pipelines.s3 import csv_to_s3
fro... | outlierbio/ob-pipelines | ob_pipelines/tasks/merge_ercc.py | Python | apache-2.0 | 1,438 |
from enum import Enum
class Message:
def __init__(self, source, string, to_self, body):
self.source = source
self.string = string
self.to_self = to_self
self.body = body
| SuddenDevs/SuddenDev | suddendev/game/message.py | Python | mit | 207 |
from functools import wraps
def lazyproperty(fn):
@property
@wraps(fn)
def _lazyproperty(self):
attr = "_" + fn.__name__
if not hasattr(self, attr):
setattr(self, attr, fn(self))
return getattr(self, attr)
return _lazyproperty
| msanders/cider | cider/_lib.py | Python | mit | 281 |
import sys
import logging
from textwrap import indent
from .config import config
__all__ = ['PrologFormatter', 'ColorFormatter', 'Colorize']
class PrologFormatter(logging.Formatter):
DEFAULT_FMT = config.LONG_FMT
DEFAULT_DATEFMT = config.DATE_FMT
DEFAULT_STYLE = config.STYLE_FMT
def __init__(self, f... | dakrauth/prolog | prolog/formatters.py | Python | mit | 4,768 |
# -*- Mode:Python; indent-tabs-mode:nil; tab-width:4 -*-
#
# Copyright (C) 2020 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 the h... | chipaca/snapcraft | snapcraft/plugins/v2/catkin_tools.py | Python | gpl-3.0 | 4,356 |
from sqlalchemy import Column, Integer, ForeignKey, Text, text
from sqlalchemy.types import TIMESTAMP
import datetime
from . import Base
from .user import User
from .task import Task
class Feedback(Base):
__tablename__ = 'feedbacks'
__table_args__ = {
'mysql_engine': 'InnoDB',
'mysql_charset'... | fi-ksi/web-backend | model/feedback.py | Python | mit | 845 |
from test.integration.base import DBTIntegrationTest, use_profile
class TestBigqueryPrePostRunHooks(DBTIntegrationTest):
def setUp(self):
DBTIntegrationTest.setUp(self)
self.use_profile('bigquery')
self.use_default_project()
self.run_sql_file("seed_run_bigquery.sql")
self.... | fishtown-analytics/dbt | test/integration/014_hook_tests/test_run_hooks_bq.py | Python | apache-2.0 | 3,633 |
import numpy as np
import networkx as nx
import unittest
from pgmpy.readwrite import UAIReader, UAIWriter
from pgmpy.models import BayesianModel, MarkovModel
from pgmpy.factors.discrete import TabularCPD, DiscreteFactor
from pgmpy.extern.six.moves import map
class TestUAIReader(unittest.TestCase):
def setUp(self... | khalibartan/pgmpy | pgmpy/tests/test_readwrite/test_UAI.py | Python | mit | 6,623 |
"""Config functions"""
#-----------------------------------------------------------------------------
# Copyright (C) PyZMQ Developers
#
# This file is part of pyzmq, copied and adapted from h5py.
# h5py source used under the New BSD license
#
# h5py: <http://code.google.com/p/h5py/>
#
# Distributed under the term... | swn1/pyzmq | buildutils/config.py | Python | bsd-3-clause | 4,483 |
# Copyright (c) 2014-2015, Ruslan Baratov
# All rights reserved.
# Adapted to python3 version of: http://stackoverflow.com/questions/4984428
import os
import platform
import subprocess
import sys
import threading
import time
# Tests:
#
# Windows:
# * Control Panel -> Region -> Administrative -> Current languange for... | ruslo/polly | bin/detail/call.py | Python | bsd-2-clause | 3,236 |
#!/usr/bin/env python
import sys
import json
result = json.load(sys.stdin)
success = result['success']
if not success:
if 'error' in result:
for error in result['error']:
print >> sys.stderr, "Error: %s" % error
if 'warning' in result:
for warning in result['warning']:
print >> sys.stderr, "Warning: %s" % w... | neverpanic/coffeestats-cli | .coffeestats_format_output.py | Python | bsd-2-clause | 579 |
import operator
from nadmin import widgets
from nadmin.util import get_fields_from_path, lookup_needs_distinct
from django.core.exceptions import SuspiciousOperation, ImproperlyConfigured, ValidationError
from django.db import models
from django.db.models.fields import FieldDoesNotExist
from django.db.models.fields.re... | A425/django-nadmin | nadmin/plugins/filters.py | Python | mit | 9,344 |
#!/usr/bin/python
from mpi4py import MPI
comm = MPI.COMM_WORLD
rank = comm.Get_rank()
number_of_messages = 2000
comm.Barrier()
start_time = MPI.Wtime()
for _ in xrange(0, number_of_messages):
comm.Barrier()
end_time = MPI.Wtime()
if rank == 0:
print (end_time - start_time)/number_of_messages | aksiazek/tpr | lab2/barier.py | Python | unlicense | 304 |
# -*- coding: utf-8 -*-
"""
:copyright: Copyright 2013-2014 by Łukasz Mierzwa
:contact: l.mierzwa@gmail.com
"""
from __future__ import unicode_literals
from getpass import getpass
from django.core.management.base import BaseCommand, CommandError
from optparse import make_option
from upaas_admin.apps.users... | prymitive/upaas-admin | upaas_admin/apps/users/management/commands/create_user.py | Python | gpl-3.0 | 2,264 |
import pytest
from abridger.exc import (UnknownTableError, UnknownColumnError,
RelationIntegrityError)
from abridger.schema import SqliteSchema
class TestSqliteSchema(object):
test_relations_stmts = [
'''
CREATE TABLE test1 (
id INTEGER PRIMARY KEY,
... | freewilll/abridger | test/unit/test_sqlite_schema.py | Python | mit | 12,050 |
# Copyright (c) 2015-2017 Cisco Systems, Inc.
#
# 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 use, copy, modify, merge... | retr0h/molecule | test/unit/test_logger.py | Python | mit | 2,683 |
# -*- coding: utf-8 -*-
from django.shortcuts import render,get_object_or_404
from django.template import loader
from django.http import HttpResponseRedirect, HttpResponse, StreamingHttpResponse
import datetime
import uuid
from io import StringIO
import os, math, sys
from base64 import b64encode
randStr = lambda n: b6... | VAMDC/NodeSoftware | vamdctap/views.py | Python | gpl-3.0 | 13,366 |
# Copyright (C) 2010-2012 Yaco Sistemas (http://www.yaco.es)
# Copyright (C) 2009 Lorenzo Gil Sanchez <lorenzo.gil.sanchez@gmail.com>
#
# 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
#
# ... | Wazoku/django_saml2 | djangosaml2/urls.py | Python | apache-2.0 | 1,290 |
import cv2
import numpy as np
def draw_cross(bgr_img, (x, y), color=(255, 255, 255), width=2, thickness=1):
""" Draws an "x"-shaped cross at (x,y)
"""
x, y, w = int(x), int(y), int(width / 2) # ensure points are ints for cv2 methods
cv2.line(bgr_img, (x - w , y - w), (x + w , y + w), c... | errollw/EyeTab | EyeTab_Python/draw_utils.py | Python | mit | 6,265 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('victim', '0001_initial'),
]
operations = [
migrations.RenameField(
model_name='victim',
old_name='co... | Knowty/marksafe | victim/migrations/0002_auto_20160910_2125.py | Python | mit | 495 |
# coding=utf-8
# Copyright 2014 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
import os
from pant... | tejal29/pants | tests/python/pants_test/backend/jvm/tasks/jvm_compile/test_zinc_utils.py | Python | apache-2.0 | 1,310 |
# ========================== Start Copyright Notice ========================== #
# #
# Copyright 2014 F.D.I.S. #
# This file is part of Kinetic Gunner: Gunner of Angst ... | CertainlyUncertain/Kinetic-Gunner-Gunner-of-Angst | engine.py | Python | gpl-3.0 | 4,816 |
import sys
import unittest
from PyQt5.QtWidgets import QApplication
from PyQt5.QtTest import QTest
from PyQt5.QtTest import QSignalSpy
from PyQt5.QtCore import Qt
from PyQt5.QtMultimedia import QMediaPlayer
from gui.widgets import PlayerControlsWidget
app = QApplication(sys.argv)
class PlayerControlsWidgetTest(unit... | gdankov/sonance-music-player | player_controls_tests.py | Python | gpl-2.0 | 1,861 |
#!/usr/bin/python3
#
# Copyright (c) 2014-2022 The Voxie Authors
#
# 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 use, copy,... | voxie-viewer/voxie | filters/downsample.py | Python | mit | 3,821 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals, print_function, absolute_import
from ..paths import TEST_PATH
import unittest
import os
import sys
from subprocess import call
from tempfile import mkdtemp
class UserTrainsAndUsesModelTest(unittest.TestCase):
"""Main test that does full cycle wit... | estnltk/textclassifier | textclassifier/tests/test_user_trains_and_uses_model.py | Python | gpl-2.0 | 2,781 |
# Copyright 2018 The dm_control 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 law or agreed to i... | deepmind/dm_control | dm_control/viewer/viewer.py | Python | apache-2.0 | 18,981 |
#
# This file is part of CasADi.
#
# CasADi -- A symbolic framework for dynamic optimization.
# Copyright (C) 2010-2014 Joel Andersson, Joris Gillis, Moritz Diehl,
# K.U. Leuven. All rights reserved.
# Copyright (C) 2011-2014 Greg Horn
#
# CasADi is free software; you can... | ghorn/debian-casadi | test/python/typemaps_futurediv.py | Python | lgpl-3.0 | 7,943 |
"""
Revision ID: 0266_user_folder_perms_table
Revises: 0265_add_confirm_edit_templates
Create Date: 2019-02-26 17:00:13.247321
"""
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql
revision = '0266_user_folder_perms_table'
down_revision = '0265_add_confirm_edit_templates'
de... | alphagov/notifications-api | migrations/versions/0266_user_folder_perms_table.py | Python | mit | 1,278 |
"""
ALTER TABLE codebooks_bases RENAME supercodebook_id TO base_id;
ALTER TABLE codebooks_bases RENAME subcodebook_id TO codebook_id;
"""
| tschmorleiz/amcat | amcat/db_version.py | Python | agpl-3.0 | 138 |
from future.builtins import object
from sound_lib.main import bass_call
import ctypes
from sound_lib.external import pybass
import string #for the alphabet!
class SoundEffect(object):
def __init__(self, channel, type=None, priority=0):
self.original_channel = channel
if hasattr(channel, 'handle'):
channel = c... | codeofdusk/ProjectMagenta | src/sound_lib/effects/effect.py | Python | gpl-2.0 | 2,199 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.