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 (c) 2012 Rackspace Hosting
# 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 req... | redhat-openstack/nova | nova/tests/compute/test_compute_cells.py | Python | apache-2.0 | 13,907 |
#!/usr/bin/env python
# Copyright (c) 2015 SnapDisco Pty Ltd, Australia.
# All rights reserved.
#
# This source code is licensed under the terms of the MIT license
# found in the "LICENSE" file in the root directory of this source tree.
import sys
import numpy as np
import _copying
PYMOD_DTYPES = [
np.boo... | jboy/nim-pymod | tests/ex-tests/003-testCopying/ex-test_copying.py | Python | mit | 3,308 |
#!/usr/bin/env python
#coding=utf-8
# Nathive (and this file) is free software: you can redistribute it and/or
# modify it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or newer.
#
# You should have received a copy of the GNU General ... | johnnyLadders/Nathive_CITA | nathive/plugins/preset-manager.py | Python | gpl-3.0 | 6,177 |
# -*- coding: utf-8 -*-
try:
import _winreg as winreg
except ImportError:
import winreg
from lazagne.config.module_info import ModuleInfo
from lazagne.config.winstructure import *
# Password are stored in cleartext on old system (< 2008 R2 and < Win7)
# If enabled on recent system, the password sh... | AlessandroZ/LaZagne | Windows/lazagne/softwares/windows/autologon.py | Python | lgpl-3.0 | 1,648 |
import sys
import commands
import numpy as np
from numpy.linalg import inv
from scipy.io import loadmat
from sklearn.preprocessing import KernelCenterer
from sklearn import preprocessing
from sklearn.metrics.pairwise import rbf_kernel
from sklearn.metrics import f1_score
from sklearn.metrics import accuracy_score
fro... | aalto-ics-kepaco/softALIGNF | svm_code/run_svm.py | Python | apache-2.0 | 11,466 |
#!/usr/bin/env python3
# Copyright 2016 The Meson development team
# 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 appl... | trhd/meson | setup.py | Python | apache-2.0 | 4,010 |
# -*- coding: utf-8 -*-
#
# Copyright 2013 Simone Campagna
#
# 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... | simone-campagna/daikon | tests/unit/toolbox/test_tool_utils.py | Python | apache-2.0 | 6,662 |
#########################################################################
# This file is part of Lyntin.
#
# Lyntin is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at you... | sochotnicky/lyntin | lyntin/manager.py | Python | gpl-3.0 | 6,746 |
from __future__ import division, print_function, unicode_literals
# This code is so you can run the samples without installing the package
import sys
import os
sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..'))
#
testinfo = "s, t 0.5, s, t 1, s, t 1.5, s, t 2.1, s, q"
tags = "QuadMoveBy"
import pyglet... | google-code-export/los-cocos | test/test_quadmoveby.py | Python | bsd-3-clause | 1,308 |
#!/usr/bin/env python
#JSON {"lot": "RHF/6-31G",
#JSON "scf": "PlainSCFSolver",
#JSON "linalg": "CholeskyLinalgFactory",
#JSON "difficulty": 1,
#JSON "description": "Basic RHF example with Cholesky matrices, includes export of Hamiltonian"}
from horton import *
import numpy as np
# Hartree-Fock calculation
# ---... | eustislab/horton | data/examples/hf_dft/rhf_h2_cholesky.py | Python | gpl-3.0 | 2,421 |
# -*- Mode: python; coding: utf-8; tab-width: 8; indent-tabs-mode: t; -*-
#
# Copyright (C) 2006 Adam Zimmerman <adam_zimmerman@sfu.ca>
# Copyright (C) 2006 James Livingston <doclivingston@gmail.com>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Publi... | mssurajkaiga/rhythmbox | plugins/magnatune/MagnatuneSource.py | Python | gpl-2.0 | 17,929 |
# Copyright (c) 2018 PaddlePaddle 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 appli... | PaddlePaddle/Paddle | python/paddle/fluid/tests/unittests/test_elementwise_div_op.py | Python | apache-2.0 | 12,892 |
"""
Django settings for m_play project.
Generated by 'django-admin startproject' using Django 1.9.1.
For more information on this file, see
https://docs.djangoproject.com/en/1.9/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.9/ref/settings/
"""
import os
imp... | bysreg/m_play | src/m_play/m_play/settings.py | Python | mit | 4,286 |
from blaze.expr import *
def test_reduction_dshape():
x = Symbol('x', '5 * 3 * float32')
assert x.sum().dshape == x.schema
assert x.sum(axis=0).dshape == dshape('3 * float32')
assert x.sum(axis=1).dshape == dshape('5 * float32')
assert x.sum(axis=(0, 1)).dshape == dshape('float32')
def test_keep... | vitan/blaze | blaze/expr/tests/test_reductions.py | Python | bsd-3-clause | 1,183 |
from __future__ import print_function
import os, sys, json, re
script_directory = os.path.dirname(os.path.abspath(__file__))
template_directory = os.path.abspath(os.path.join(script_directory,
'template'))
test_root_directory = os.path.abspath(os.path.join(script_dire... | ecoal95/servo | tests/wpt/web-platform-tests/common/security-features/tools/util.py | Python | mpl-2.0 | 1,272 |
import django_filters
from django.contrib.auth import get_user_model
from .models import Sprint, Task
User = get_user_model()
class NullFilter(django_filters.BooleanFilter):
"""Filter on a field set as null or not."""
def filter(self, qs, value):
if value is not None:
return qs.filte... | guiandmag/scrum-django | board/forms.py | Python | apache-2.0 | 1,021 |
# This file is part of django-ca (https://github.com/mathiasertl/django-ca).
#
# django-ca is free software: you can redistribute it and/or modify it under the terms of the GNU
# General Public License as published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version... | mathiasertl/django-ca | ca/django_ca/deprecation.py | Python | gpl-3.0 | 1,187 |
# (C) British Crown Copyright 2013, Met Office
#
# This file is part of Iris.
#
# Iris is free software: you can redistribute it and/or modify it under
# the terms of the GNU Lesser General Public License as published by the
# Free Software Foundation, either version 3 of the License, or
# (at your option) any later ve... | scollis/iris | lib/iris/tests/unit/fileformats/abf/__init__.py | Python | gpl-3.0 | 772 |
# (c) Copyright 2014 Brocade Communications Systems Inc.
# All Rights Reserved.
#
# Copyright 2014 OpenStack Foundation
#
# 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
#
# ... | sasukeh/cinder | cinder/tests/unit/zonemanager/test_brcd_fc_zone_client_cli.py | Python | apache-2.0 | 12,658 |
# 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... | cloudbase/nova | nova/tests/functional/db/test_build_request.py | Python | apache-2.0 | 23,332 |
data2 = open("./../w6_group.txt").read()
#print(data2)
group = data2.splitlines()
#print(group)
#print(group[0])
result_g = []
for i in group:
#print(i)
#print(i.split(",")[:-1])
for j in i.split(",")[:-1]:
result_g .append(j)
#print(result_g)
data3 = open("./../w6_group.txt").read()
registered = data3.splitlines... | s40223207/2016fallcp_hw | w8.py | Python | agpl-3.0 | 397 |
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
from django.db.models import get_models
class AlreadyRegistered(Exception):
pass
class ObjectTools(object):
"""
An ObjectTools object providing various object tools for various model
classes. Models are register... | shubhamdipt/django-object-tools | object_tools/sites.py | Python | bsd-3-clause | 2,871 |
from cmd import Cmd
from random import randrange
from combat import FightInterpreter
class Character(object):
"""
The base character class
"""
character_id = None
friendly_name = 'Shifty little man'
inventory = []
hp = 10
armor_class = 1
armor_type = 'cloth'
active_weapon = Non... | elstupido/rpg | character.py | Python | mit | 1,190 |
MICROSERVICES = {
# Map locations to their microservices
"LOCATION_MICROSERVICES": [
{
"module": "intelligence.dashboard.location_dashboard_microservice",
"class": "LocationDashboardMicroservice"
},
{
"module": "intelligence.dashboard.location_dashboar... | peoplepower/botlab | com.ppc.Microservices/intelligence/dashboard/index.py | Python | apache-2.0 | 420 |
# -*- coding: utf-8 -*-
from . import queue
from . import connector
from . import producer
from . import checkpoint
from . import controllers
from . import jobrunner
from . import models
| esousy/connector | connector/__init__.py | Python | agpl-3.0 | 187 |
#!/usr/bin/env python
#
# This file is part of Astir
#
# Astir is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Astir is distribute... | hksonngan/astir | pymir_check.py | Python | gpl-3.0 | 2,276 |
""" Pyflation - Cosmological simulations in Python
Pyflation is a python package to simulate cosmological perturbations in the early universe.
Using the Klein-Gordon equations for both first and second order perturbations,
the evolution and behaviour of these perturbations can be studied.
The main entry point to thi... | ihuston/pyflation | pyflation/__init__.py | Python | bsd-3-clause | 712 |
# -*- coding: utf-8 -*-
"""
***************************************************************************
aspect.py
---------------------
Date : October 2013
Copyright : (C) 2013 by Alexander Bruy
Email : alexander dot bruy at gmail dot com
******************... | asiersarasua/QGIS | python/plugins/processing/algs/gdal/aspect.py | Python | gpl-2.0 | 5,985 |
# -*- encoding: utf-8 -*- #
############################################################################
# Module Writen to OpenERP, Open Source Management Solution #
# Copyright (C) Vauxoo (<http://vauxoo.com>). #
# All Rights Reserved ... | 3dfxsoftware/cbss-addons | invoice_report_per_journal/wizard/invoice_report_per_journal.py | Python | gpl-2.0 | 5,756 |
import Base
import sys
import industrial_lib
time_of_day='_night'
(landing_platform,bar,weap) = industrial_lib.MakeCorisc (time_of_day,'bases/bartender_university.py')
| vinni-au/vega-strike | data/bases/university_night.py | Python | gpl-2.0 | 169 |
# -*- coding: utf-8 -*-
"""Page model for Automation/Ansible/Repositories"""
import attr
from navmazing import NavigateToAttribute, NavigateToSibling
from widgetastic.exceptions import NoSuchElementException
from widgetastic.widget import Checkbox, Fillable, ParametrizedView, Text, View
from widgetastic_manageiq import... | anurag03/integration_tests | cfme/ansible/repositories.py | Python | gpl-2.0 | 13,574 |
from time import time
import numpy as np
import matplotlib.pyplot as plt
from sklearn import preprocessing
import seaborn as sns
import pandas as pd
IMG_DIR = '../../analysis'
DPI=120
t0 = time()
print('Generating rows to skip')
s = 10000 # desired sample size
n = 5967780
rows_to_skip = sorted(np.random.choice(np... | DJCordhose/big-data-visualization | code/es/analysis_pandas.py | Python | mit | 2,564 |
#!/usr/bin/python
#
# Copyright 2014 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 b... | coxmediagroup/googleads-python-lib | examples/dfa/v1_20/get_change_log_object_types.py | Python | apache-2.0 | 1,759 |
import glob
import detection
classifier = detection.PLI()
for p in glob.glob("c/*.*"):
classifier.train(open(p).read(), "c")
for q in glob.glob("cpp/*.*"):
classifier.train(open(q).read(), "c++")
for r in glob.glob("java/*.*"):
classifier.train(open(r).read(), "java")
for s in glob.glob("python/*.*"):
classifier.... | Mitali-Sodhi/CodeLingo | Naive Bayes/test_detection.py | Python | mit | 483 |
from flask import Blueprint
bp = Blueprint('api_fittings', __name__)
| SpeedProg/eve-inc-waitlist | waitlist/blueprints/api/fittings/blueprint.py | Python | mit | 70 |
import lib.cmd
import lib.event
import lib.irc
import random
import settings
GREETINGS = ('hi', 'hey ho', 'yoyo!', '\'sup?')
@lib.event.subscribe('join')
def say_hello(bot=None, sender=None, channel=None):
"""Greets the channel when joining it."""
if sender == settings.NICKNAME:
bot.send(lib.irc.say... | Javex/qllbot | modules/ai.py | Python | bsd-2-clause | 357 |
# Yith Library Server is a password storage server.
# Copyright (C) 2012-2014 Yaco Sistemas
# Copyright (C) 2012-2014 Alejandro Blanco Escudero <alejandro.b.e@gmail.com>
# Copyright (C) 2012-2015 Lorenzo Gil Sanchez <lorenzo.gil.sanchez@gmail.com>
#
# This file is part of Yith Library Server.
#
# Yith Library Server is... | lorenzogil/yith-library-server | yithlibraryserver/user/tests/test_accounts.py | Python | agpl-3.0 | 6,443 |
# -*- python-indent: 4; coding: iso-8859-1; mode: python -*-
# Copyright (C) 2008 Cedric Pinson, Jeremy Moles
#
# 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, o... | sketchfab/osgexport | blender-2.5/exporter/osg/osgobject.py | Python | gpl-2.0 | 48,200 |
#!/usr/bin/env python3
#----------------------------------------------------------------------------
#
# Copyright (C) 2015 José Flávio de Souza Dias Júnior
#
# This file is part of CXXII - http://www.joseflavio.com/cxxii/
#
# CXXII is free software: you can redistribute it and/or modify
# it under the terms of the... | joseflaviojr/cxxii | CXXII.py | Python | lgpl-3.0 | 20,202 |
# coding: utf8
from .base_view import BaseView
class DummyView(BaseView):
def __init__(self, config, **kwargs):
super(DummyView).__init__(config, **kwargs)
| ondrejkajinek/pyGrim | pygrim/components/view/dummy_view.py | Python | mit | 172 |
# -*- coding: utf-8 -*-
# Copyright (c) 2010 Tom Burdick <thomas.burdick@gmail.com>
#
# 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 rig... | bfrog/whizzer | whizzer/test/test_rpc_pickle.py | Python | mit | 5,927 |
# Copyright (c) PagerDuty.
# See LICENSE for details.
if __name__ == '__main__':
import os.path
import unittest
import argparse
dirname = os.path.dirname(__file__)
parser = argparse.ArgumentParser(description='Run tests for pypd')
parser.add_argument('--verbose', '-v', action='count', dest='v... | PagerDuty/pagerduty-api-python-client | test/runtests.py | Python | mit | 531 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
import battery_common
from battery_common import *
import battery_pins
from battery_pins import *
def make_case_Cylinder1(params):
manufacture = params.manufacture # Model name
serie = params.serie # Model name
cellsize = par... | easyw/kicad-3d-models-in-freecad | cadquery/FCAD_script_generator/Battery/battery_casecylinder.py | Python | gpl-2.0 | 8,088 |
#!/usr/bin/env python
# -*- coding:utf-8 -*-
#
# Author : RobertDing
# E-mail : robertdingx@gmail.com
# Date : 15/08/29 02:24:28
# Desc : fetch video
#
from __future__ import absolute_import, division, with_statement
| robertding/vo | vo/dl/__init__.py | Python | mit | 242 |
#!/usr/bin/env python
#
# Electrum - lightweight Bitcoin client
# Copyright (C) 2015 Thomas Voegtlin
#
# 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... | pooler/electrum-ltc | electrum_ltc/gui/qt/history_list.py | Python | mit | 38,307 |
# -*- coding: utf-8 -*-
# Copyright (C) 1998-2014 by the Free Software Foundation, Inc.
#
# This file is part of Postorius.
#
# Postorius is free software: you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free
# Software Foundation, either version 3 of the... | adam-iris/postorius | src/postorius/management/commands/mmclient.py | Python | gpl-3.0 | 1,708 |
# coding=utf-8
'''
Module: num2word_DE.py
Requires: num2word_base.py
Version: 0.4
Author:
Taro Ogawa (tso@users.sourceforge.org)
Copyright:
Copyright (c) 2003, Taro Ogawa. All Rights Reserved.
Licence:
This module is distributed under the Lesser General Public Licence.
http://www.open... | guildenstern70/fablegenerator | fablegenerator/numtoword/num2word_DE.py | Python | mit | 5,299 |
# Copyright (c) 2010-2012 OpenStack, 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 agreed to ... | pvo/swift | test/unit/common/test_direct_client.py | Python | apache-2.0 | 801 |
class Solution:
# @param two ListNodes
# @return a ListNode
def mergeTwoLists(self, l1, l2):
newHead, newTail, cur = None, None, None
while l1 and l2 :
if l1.val > l2.val :
cur, l2 = l2, l2.next
else :
cur, l1 = l1, l1.next
... | yelu/leetcode | MergekSortedLists.py | Python | gpl-2.0 | 1,228 |
from audit_tools.audit.views.api.access import *
from audit_tools.audit.views.api.model_action import *
from audit_tools.audit.views.api.process import *
| PeRDy/django-audit-tools | audit_tools/audit/views/api/__init__.py | Python | gpl-2.0 | 154 |
# Copyright 2015 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... | taknevski/tensorflow-xsmm | tensorflow/contrib/__init__.py | Python | apache-2.0 | 2,781 |
# WARNING: Do not edit by hand, this file was generated by Crank:
#
# https://github.com/gocardless/crank
#
from . import base_service
from .. import resources
from ..paginator import Paginator
from .. import errors
class MandatePdfsService(base_service.BaseService):
"""Service class that provides access to the... | gocardless/gocardless-pro-python | gocardless_pro/services/mandate_pdfs_service.py | Python | mit | 3,470 |
import klampt
from klampt import vectorops as vops
from klampt import se3
from klampt import loader
if __name__=="__main__":
import sys
if len(sys.argv) != 4:
print "Usage: robot_to_mesh robot config mesh"
exit(0)
robotfn = sys.argv[1]
configfn = sys.argv[2]
meshfn = sys.argv[3]
... | bbgw/Klampt | Python/utils/robot_to_mesh.py | Python | bsd-3-clause | 1,807 |
# © 2008-2020 Deltatech
# Dorin Hongu <dhongu(@)gmail(.)com
# See README.rst file on addons root folder for license details
import pytz
from dateutil.relativedelta import relativedelta
from odoo import api, fields, models
class StockPickingCumulative(models.TransientModel):
_name = "stock.picking.... | dhongu/l10n-romania | l10n_ro_stock_picking_report/report/stock_picking_cumulative.py | Python | agpl-3.0 | 3,118 |
##############################################################################
# Copyright (c) 2013-2018, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-64... | EmreAtes/spack | var/spack/repos/builtin/packages/r-snprelate/package.py | Python | lgpl-2.1 | 2,803 |
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
driver = webdriver.Firefox()
driver.get("http://www.python.org")
assert "Python" in driver.title
elem = driver.find_element_by_name("q")
elem.send_keys("pycon")
elem.send_keys(Keys.RETURN)
assert "No results found." not in driver.page_sourc... | CraryPrimitiveMan/code-examples | selenium/python_org_search.py | Python | mit | 337 |
import tensorflow as tf
from luminoth.utils.vars import variable_summaries
OPTIMIZERS = {
'adam': tf.train.AdamOptimizer,
'momentum': tf.train.MomentumOptimizer,
'gradient_descent': tf.train.GradientDescentOptimizer,
'rmsprop': tf.train.RMSPropOptimizer,
}
LEARNING_RATE_DECAY_METHODS = {
'polyno... | tryolabs/luminoth | luminoth/utils/training.py | Python | bsd-3-clause | 3,602 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import datetime
from django.utils.timezone import utc
class Migration(migrations.Migration):
dependencies = [
('home', '0017_auto_20150919_1618'),
]
operations = [
migrations.AlterFi... | taedori81/gentlecoffee | home/migrations/0018_auto_20150921_1654.py | Python | bsd-3-clause | 535 |
#This bot was written by /u/GoldenSights for /u/FourMakesTwoUNLESS on behalf of /r/pkmntcgtrades. Uploaded to GitHub with permission.
import praw
import time
import datetime
import sqlite3
'''USER CONFIGURATION'''
APP_ID = ""
APP_SECRET = ""
APP_URI = ""
APP_REFRESH = ""
# https://www.reddit.com/comments/3cm1p8/how_t... | TacticalGoat/reddit | DelayBot/delaybot.py | Python | mit | 3,987 |
from django.db.models import get_apps
from django.core.management.base import BaseCommand
from couchdbkit.ext.django.loading import couchdbkit_handler
from corehq import couchapps
# TODO: this should be moved to the same place as sync_prepare_couchdb_multi (currently in dimagi-utils)
class Command(BaseCommand):
h... | gmimano/commcaretest | corehq/couchapps/management/commands/sync_finish_couchdb_hq.py | Python | bsd-3-clause | 929 |
import sys
import pytest
from qtpy import PYQT6, PYSIDE2, PYSIDE6, QT_VERSION
from qtpy.QtWidgets import QApplication
from qtpy.QtWidgets import QHeaderView
from qtpy.QtCore import Qt
from qtpy.QtCore import QAbstractListModel
def get_qapp(icon_path=None):
qapp = QApplication.instance()
if qapp is None:
... | stonebig/winpython | winpython/_vendor/qtpy/tests/test_patch_qheaderview.py | Python | mit | 3,355 |
# Copyright 2015-2021 Mathieu Bernard
#
# This file is part of phonologizer: you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# Phonologizer is distribu... | bootphon/phonemizer | phonemizer/backend/__init__.py | Python | gpl-3.0 | 1,112 |
'''
Created on Nov 18, 2016
@author: kostya
TASK
Create a script that asks user a question with 3 possible answers: "Yes", "No", "Maybe".
The results should be written in a log file with the date and time of line creation.
Once log file contains 10 or more lines script should show total number of votes and
percentage ... | tevtonez/my_training_tasks | task_3_poll_script.py | Python | gpl-3.0 | 3,150 |
"""Add propositions.visibility
Revision ID: 334e65ad89c0
Revises: 58d61f975f05
Create Date: 2020-05-04 22:14:13.106729
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '334e65ad89c0'
down_revision = '58d61f975f05'
branch_labels = None
depends_on = None
def upgr... | dpausp/arguments | alembic/versions/334e65ad89c0_add_propositions_visibility.py | Python | agpl-3.0 | 977 |
#!/usr/bin/env python3
"""Script to find gaps in the schedule"""
from typing import Any
import getopt
import psycopg2
import sys
from dbconfig import db_config
def check_duplicates_schedules(env):
duplicate_scheduleevents = """
select maintitle(id), start, max(mid), min(mid), count(*) as duplicates
... | npo-poms/scripts | python/data_integrity_check.py | Python | gpl-2.0 | 2,813 |
import docker
import tempfile
from .base import BaseIntegrationTest, TEST_API_VERSION
from ..helpers import random_name
class ContainerCollectionTest(BaseIntegrationTest):
def test_run(self):
client = docker.from_env(version=TEST_API_VERSION)
self.assertEqual(
client.containers.run("a... | kaiyou/docker-py | tests/integration/models_containers_test.py | Python | apache-2.0 | 10,248 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.conf import settings
from django.core.checks import Critical, Tags, register
@register(Tags.security)
def timeline_password_initial_check(app_configs, **kwargs):
errors = []
# Only useful before applying first migration.
if not ... | ychab/privagal | privagal/core/checks.py | Python | bsd-3-clause | 587 |
import sys, traceback
from StringIO import StringIO
class ChainableException(Exception):
def __init__(self, *args, **kwargs):
self.cause = sys.exc_info()
super(ChainableException, self).__init__(*args, **kwargs)
def __str__(self):
s = super(ChainableException, self).__str__()
... | emulbreh/shrubbery | shrubbery/utils/exceptions.py | Python | mit | 565 |
# Copyright 2016 Twitter. 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 agree... | wangli1426/heron | heron/tools/cli/src/python/version.py | Python | apache-2.0 | 1,249 |
from django.core.management.base import BaseCommand
from salt_observer.models import Minion
from . import ApiCommand
import json
class Command(ApiCommand, BaseCommand):
help = 'Fetch and save packagedata'
def save_packages(self, api):
packages = api.get('pkg.list_pkgs')
upgrades = api.get('... | hs-hannover/salt-observer | salt_observer/management/commands/fetchpackages.py | Python | mit | 1,231 |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU... | iw3hxn/LibrERP | dt_price_security/models/res_users.py | Python | agpl-3.0 | 4,709 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import rospy
from std_msgs.msg import String
from std_msgs.msg import Float32MultiArray
class CreateSpeech:
def __init__(self):
# init node
rospy.init_node('create_speech')
# Publisher
self.pub = rospy.Publisher('speech', Str... | ykoga-kyutech/pepper_ros_handson | scripts/create_speech_template.py | Python | apache-2.0 | 839 |
from django.conf.urls import url
from django.contrib.staticfiles.urls import staticfiles_urlpatterns
from mobile import views
urlpatterns = [
url(r'^$', views.index, name='index'),
url(r'^(?P<soul_id>[0-9]+)/$', views.detail, name='detail'),
url(r'^submit', views.submit, name='submit'),
url(r'^postJson... | sidc/this4bliss | web0/mobile/urls.py | Python | mit | 359 |
import ConfigParser
from evohomeclient2 import EvohomeClient
import sqlite3
import time
import json
config = ConfigParser.ConfigParser()
config.readfp(open('/etc/raspadmin/evohome.conf'))
login=config.get("EVOHOME", "login")
password=config.get("EVOHOME", "password")
dbname=config.get("EVOHOME","dbname")
extemp=config... | air01a/raspadmin | modules/evohome/sources/evohome_cron.py | Python | gpl-3.0 | 1,181 |
import json
from django.contrib.auth.models import User
from django.core.urlresolvers import reverse
from django.test.utils import override_settings, override_script_prefix
from mock import ANY, Mock, patch
from nose.tools import eq_
from mozillians.common.tests import TestCase
from mozillians.users.models import Idp... | johngian/mozillians | mozillians/phonebook/tests/test_identities.py | Python | bsd-3-clause | 9,341 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('superlachaise_api', '0002_auto_20150621_1645'),
]
operations = [
migrations.AddField(
model_name='superlachaisep... | MaximeLM/superlachaise_api | migrations/0003_auto_20150621_1818.py | Python | apache-2.0 | 1,490 |
import unittest
import os
import sys
# for local debugging
if os.path.exists("../provisioning") is True:
sys.path.insert(0, "../../")
import urllib2
import libvirt
import shutil
from tempfile import NamedTemporaryFile
from tempfile import mkdtemp
from elijah.test.util import Const as Const
from elijah.test.util i... | cmusatyalab/elijah-provisioning | elijah/test/test_handoff.py | Python | apache-2.0 | 2,819 |
import copy
import random
from vector_space import ModTwoVectorSpace
class ModTwoMatrix(object):
def __init__(self, matrix_list):
self.matrix_list = matrix_list
if matrix_list:
for row in matrix_list:
if len(row) == len(matrix_list[0]):
pass
... | glenwilson/MassProg | mod_2_matrix.py | Python | gpl-2.0 | 14,597 |
# -*- coding: utf-8 -*-
# Copyright (c) 2019, Frappe Technologies and contributors
# License: MIT. See LICENSE
# import frappe
from frappe.model.document import Document
class DocTypeLink(Document):
pass
| frappe/frappe | frappe/core/doctype/doctype_link/doctype_link.py | Python | mit | 207 |
# -*- coding: utf-8 -*-
# © 2015 John Walsh michaeljohn32@yahoo.com
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
import test_procurement
| michaeljohn32/odooaddons | procurement_location_per_contract/tests/__init__.py | Python | agpl-3.0 | 162 |
import django
import time
from uuid import uuid1
from datetime import timedelta
from threading import Thread
from django.template import Template
from django.test import TestCase, TransactionTestCase
from django.contrib.auth.models import User, Group
from django.utils import timezone
from django.core import managemen... | jiaaro/django-alert | test_project/alert_tests/tests.py | Python | mit | 12,663 |
# -*- coding: utf-8 -*-
from PyQt5 import QtCore, QtWidgets
class QMapPixmap(QtWidgets.QGraphicsObject):
clicked = QtCore.pyqtSignal(QtWidgets.QGraphicsSceneMouseEvent)
click_dragged = QtCore.pyqtSignal(QtWidgets.QGraphicsSceneMouseEvent)
click_release = QtCore.pyqtSignal(QtWidgets.QGraphicsSceneMouseEve... | kaisermg5/mapqeditorq | mapqeditorq/gui/qmapview.py | Python | gpl-3.0 | 1,060 |
#import su files from prac1
#sort into cdp/offsets
#view a cdp gather
from toolbox import io
import toolbox
import numpy as np
import os
import matplotlib.pyplot as pylab
from exercise1 import initialise
#-----------------------------------------------------------------------
# useful functions
#-------... | stuliveshere/Seismic-Processing-Prac2 | prac2/exercise3.py | Python | mit | 1,221 |
import re
from django import template
register = template.Library()
@register.filter
def linkifpossible(maybe_url):
if maybe_url is None:
return ''
maybe_url = maybe_url.strip()
if len(maybe_url) == 0:
return ''
if maybe_url.startswith("http://"):
return maybe_url
ma... | sunlightlabs/django-locksmith | locksmith/hub/templatetags/linkifpossible.py | Python | bsd-3-clause | 572 |
from django.contrib.auth.models import AbstractUser
from django.urls import reverse
from django.db import models
from django.utils.translation import ugettext_lazy as _
class User(AbstractUser):
# First Name and Last Name do not cover name patterns
# around the globe.
name = models.CharField(_("Name of U... | ephes/homepage | homepage/users/models.py | Python | mit | 516 |
import optparse
import os
import json
import operator
import humanize
from collections import defaultdict
from urllib.parse import urlparse
optparser = optparse.OptionParser()
optparser.add_option("-l", "--language", dest="language", default="French", help="Language to package")
optparser.add_option("-d", "--directory... | brendandc/multilingual-google-image-scraper | report-package.py | Python | mit | 4,542 |
# 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... | PAIR-code/what-if-tool | witwidget/notebook/jupyter/wit.py | Python | apache-2.0 | 12,336 |
from future.utils import python_2_unicode_compatible
from django.db import models
from django.utils.translation import ugettext_lazy as _
from fluent_contents.models import ContentItem
@python_2_unicode_compatible
class DisqusCommentsAreaItem(ContentItem):
allow_new = models.BooleanField(_("Allow posting new comm... | jpotterm/django-fluent-contents | fluent_contents/plugins/disquswidgets/models.py | Python | apache-2.0 | 508 |
# 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... | briancurtin/python-openstacksdk | openstack/identity/v2/tenant.py | Python | apache-2.0 | 1,469 |
#
# These Python coding exercises wher taken from: http://www.ling.gu.se/~lager/python_exercises.html
#
s = 'happy day'
print s
'''
Define a function max() that takes two numbers as arguments
and returns the largest of them. Use the if-then-else construct
available in Python. (It is true that Python has the max() ... | smakonin/CMPT165 | examples/python/func.py | Python | mpl-2.0 | 2,838 |
# 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/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/aio/operations/_operations.py | Python | mit | 4,713 |
#!/usr/bin/env python
# vim: set fileencoding=utf-8:
"""
TODO:
1. copy library from outside tasdk to tasdk/modules
2. run build.py with --skip-update
"""
from __future__ import print_function
import sys
import os
import platform
import argparse
import logging
## subprocess:
if platform.pyt... | zeroxia/mystery | py/tnpath.py | Python | mit | 3,428 |
"""
Postgres Blueprint
==================
**Fabric environment:**
.. code-block:: yaml
blueprints:
- blues.postgres
settings:
postgres:
version: 9.3 # PostgreSQL version (required)
# bind: * # What IP address(es) to listen on, use '*' for all (Default: loca... | adisbladis/blues | blues/postgres.py | Python | mit | 7,563 |
import sys
import psychopy
from psychopy import visual, core
import numpy as np
import scipy.ndimage
import matplotlib.pyplot as plt
import matplotlib as mpl
from PIL import Image
# import hmax
class Filters(object):
def gabor(self,
theta=0,
gamma=1,
sigma=2,
lam=5.6,
k=10
... | qbilius/autoart | abstract_metal_wires/abstract_metal_wires.py | Python | mit | 19,924 |
class InterpreterError(Exception):
def __init__(self, msg, tb=None):
self.msg = msg
self.traceback = tb
def __str__(self):
"NOT_RPYTHON"
return self.msg
class FatalError(InterpreterError):
pass
class IllegalInstruction(InterpreterError):
pass
class InvalidCallbac... | ericpp/hippyvm | hippy/error.py | Python | mit | 2,640 |
__author__ = 'aje'
#
# Copyright (c) 2008 - 2013 10gen, Inc. <http://10gen.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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless r... | baocongchen/M101P-MONGODB-FOR-PYTHON-DEVELOPERS | week3/hw3-2and3-3/blogPostDAO.py | Python | mit | 3,893 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.4 on 2016-03-25 03:32
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.Creat... | youkidearitai/health_graph | keep_health/health_graph/migrations/0001_initial.py | Python | mit | 1,608 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Octofiles documentation build configuration file, created by
# sphinx-quickstart on Thu Mar 10 14:51:08 2016.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# ... | hackultura/octofiles | docs/source/conf.py | Python | gpl-3.0 | 11,319 |
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
config = [
'description': 'ex47',
'author': 'Nitin Kumar',
'url': 'URL to get it at.',
'download_url': 'Where to download it.'
'author_email': 'My email.'
'version': '0.1',
'install_requires': ['nose'],
'packages': ['NAM... | enkaynitin/python-learn | project47/skeleton/setup.py | Python | cc0-1.0 | 382 |
import os
import importlib
import logging
from dataclasses import dataclass
import sys
from typing import Any, Dict, Optional, Tuple
from ray.ray_constants import RAY_ADDRESS_ENVIRONMENT_VARIABLE
from ray.job_config import JobConfig
import ray.util.client_connect
logger = logging.getLogger(__name__)
@dataclass
cla... | pcmoritz/ray-1 | python/ray/client_builder.py | Python | apache-2.0 | 6,749 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.