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 |
|---|---|---|---|---|---|
##############################################################################
# For copyright and license notices, see __manifest__.py file in module root
# directory
##############################################################################
from odoo import models, fields, api
class ProductProduct(models.Model)... | ingadhoc/product | product_price_taxes_included/models/product_product.py | Python | agpl-3.0 | 1,124 |
import subprocess as sb
import os
class CmdProcess:
def __init__(self, cmd_list):
self.cmd_list= cmd_list
self.process = None
def run(self):
self.process = sb.Popen(self.cmd_list)
def kill(self):
os.system('kill -2 %d' % self.process.pid)
def is_finished( self ):... | Atom-machinerule/OpenQbo | qbo_stereo_anaglyph/hrl_lib/src/hrl_lib/cmd_process.py | Python | lgpl-2.1 | 365 |
# 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... | DavidNorman/tensorflow | tensorflow/python/distribute/values.py | Python | apache-2.0 | 65,179 |
import json
import logging
from connection.connection import get_connection
from models.model_utils import get_orient_valid_class_name
from utils import get_logger_for_name
LOGGER = logging.getLogger(get_logger_for_name(__name__))
def create_class(klass, client=None):
from models.orient_sql_utils import is_mod... | ejesse/ogorm | models/orient_sql.py | Python | mit | 2,807 |
#!/usr/bin/python3
# -*- coding: utf-8 -*-
#
__author__='atareao'
__date__ ='$25/04/2011'
#
# Remember-me
# An indicator for Google Calendar
#
# Copyright (C) 2011 Lorenzo Carbonell
# lorenzo.carbonell.cerezo@gmail.com
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the ... | christopherjbly/calendar-indicator | src/calendarindicator.py | Python | gpl-3.0 | 17,542 |
"""
WSGI config for pclock project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.7/howto/deployment/wsgi/
"""
import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "pclock.settings")
from django.core.wsg... | NicsTr/pclock | website/pclock/wsgi.py | Python | gpl-3.0 | 387 |
# -*- encoding: utf-8 -*-
################################################################################
# #
# Copyright (C) 2013-Today Carlos Eduardo Vercelino - CLVsol #
# ... | CLVsol/odoo_addons | clv_address/category/__init__.py | Python | agpl-3.0 | 1,432 |
#!/usr/bin/env python
# calculation file - your calculation code coming below line approx. 45
# Copyright (c) D.Djokic, 2013
# This code is released under GNU General Public Licence, Version 2
# No Warranties, whatsoever
''' List of functions in "Building Blocks file":
flow(H,A,B) - calculates flow for given Headloss
... | ddjokic/PipingSystemCalculationLibrary-Python | Examples/Example2/WP2.py | Python | gpl-2.0 | 5,447 |
import time
import base64
import binascii
import hashlib
import logging
import paramiko
import random
import string
import yaml
try:
from io import StringIO
except ImportError:
from StringIO import StringIO
from heatclient.exc import HTTPException, HTTPNotFound
from keystoneauth1.exceptions.http import HttpEr... | hastexo/hastexo-xblock | hastexo/provider.py | Python | agpl-3.0 | 27,375 |
# -*- coding: utf-8 -*-
from django.shortcuts import get_object_or_404, render_to_response
from django.views.generic.simple import direct_to_template
from django.contrib.auth.decorators import login_required
from django.contrib.auth.models import User
from Aluno.models import Aluno
@login_required
def minhasAva... | arruda/amao | AMAO/apps/Aluno/views/views.py | Python | mit | 922 |
from unittest import TestCase
from unittest.mock import call, patch
from path import Path
from dakara_player_vlc.background_loader import (
BackgroundLoader,
BackgroundNotFoundError,
)
class BackgroundLoaderTestCase(TestCase):
"""Test the loader for backgrounds
"""
@patch(
"dakara_playe... | Nadeflore/dakara-player-vlc | tests/test_background_loader.py | Python | mit | 9,182 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('blog', '0003_merge'),
]
operations = [
migrations.AddField(
model_name='comment',
name='is_active',
... | nirvaris/nirvaris-blog | blog/migrations/0004_auto_20150924_1616.py | Python | mit | 571 |
# -*- coding: utf-8 -*-
"""
Tools to manipulate Neo objects.
:copyright: Copyright 2014-2016 by the Elephant team, see `doc/authors.rst`.
:license: Modified BSD, see LICENSE.txt for details.
"""
from __future__ import division, print_function, unicode_literals
import warnings
from itertools import chain
from neo.co... | alperyeg/elephant | elephant/neo_tools.py | Python | bsd-3-clause | 7,271 |
from django.conf.urls import patterns, include, url
from google_auth import views
urlpatterns = patterns('',
url(r'^login/$', views.LogonView.as_view(), name='login'),
) | rectory-school/rectory-apps | google_auth/urls.py | Python | mit | 175 |
#
# BitBake Curses UI Implementation
#
# Implements an ncurses frontend for the BitBake utility.
#
# Copyright (C) 2006 Michael 'Mickey' Lauer
# Copyright (C) 2006-2007 Richard Purdie
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version ... | sentient-energy/emsw-bitbake-mirror | lib/bb/ui/ncurses.py | Python | gpl-2.0 | 15,050 |
"""
Base IO code for all datasets
https://github.com/scikit-learn/scikit-learn/blob/56057c9630dd13f3c61fbb4c7debdff6ba8e9e8c/sklearn/datasets/base.py
"""
# Copyright (c) 2007 David Cournapeau <cournape@gmail.com>
# 2010 Fabian Pedregosa <fabian.pedregosa@inria.fr>
# 2010 Olivier Grisel <oli... | madjelan/CostSensitiveClassification | costcla/datasets/base.py | Python | bsd-3-clause | 15,154 |
# coding=utf-8
###############################################################################
##
## Copyright 2011 Tavendo GmbH
##
## 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 ... | Brother-Simon/AutobahnTestSuite | autobahntestsuite/autobahntestsuite/case/case6_3_1.py | Python | apache-2.0 | 1,714 |
from django.contrib.auth.models import User, AnonymousUser
from rest_framework import permissions
from .models import MapDefinition
from .admin import is_private_site
class AllowAnyIfPublicSite(permissions.AllowAny):
"""
Custom permission to modify the base AllowAny permission if this is a public Ealgis site.... | grahame/ealgis | django/ealgis/ealauth/permissions.py | Python | gpl-3.0 | 1,991 |
class Tetel:
def __init__(self, file):
self.file = file
self.f = open(self.file)
self.temp = self.f.read().splitlines()
def szamlal(self, metodus) :
count = int(0)
for szam in self.temp:
if metodus(int(szam)) :
count += 1
return count
def osszegez(self):
sum = int(0)
for szam in self.temp:
... | wahur666/kodok | python/bead4/bead.py | Python | gpl-3.0 | 746 |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file '/home/colin/dev/OpenCobolIDE/forms/dlg_file_type.ui'
#
# Created: Mon Nov 17 08:50:30 2014
# by: PyQt5 UI code generator 5.3.2
#
# WARNING! All changes made in this file will be lost!
from pyqode.qt import QtCore, QtGui, QtWidgets
cla... | abbhishek/COBOLIde | open_cobol_ide/view/forms/dlg_file_type_ui.py | Python | gpl-3.0 | 6,181 |
from django.conf.urls.defaults import patterns, include, url
# Uncomment the next two lines to enable the admin:
# from django.contrib import admin
# admin.autodiscover()
urlpatterns = patterns('',
# Examples:
# url(r'^$', 'committee_demo.views.home', name='home'),
# url(r'^committee_demo/', include('comm... | daonb/django-committee | committee_demo/urls.py | Python | bsd-3-clause | 589 |
# Copyright DataStax, 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, softwa... | datastax/python-driver | tests/integration/standard/test_dse.py | Python | apache-2.0 | 3,027 |
# Determinism in the UK GDP series. A python-based analysis.
# this will be the basic workings of my system bashed together...
# General idea: 1. Take a single series.
# 2. make an embedding routine (for use elsewhere) V
# 3. Check the embedding dimension by false near neighbour V
# 4. Calculate lyapunov exponent.
# 5.... | kakaba2009/MachineLearning | python/src/embed/embedder_v1_hen.py | Python | apache-2.0 | 7,872 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# GuessIt - A library for guessing information from filenames
# Copyright (c) 2013 Nicolas Wack <wackou@gmail.com>
# Copyright (c) 2013 Rémi Alvergnat <toilal.dev@gmail.com>
# Copyright (c) 2011 Ricard Marxer <ricardmp@gmail.com>
#
# GuessIt is free software; you can redi... | Hellowlol/PyTunes | libs/guessit/patterns/extension.py | Python | gpl-3.0 | 1,340 |
# Copyright (c) 2012 The Khronos Group Inc.
# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and /or associated documentation files (the "Materials "), to deal in the Materials without restriction, including without limitation the rights to use, copy, modify, merge, publ... | KhronosGroup/COLLADA-CTS | StandardDataSets/1_5/collada/library_kinematics_scene/kinematics_scene/instance_kinematics_model/newparam/sidref/sidref.py | Python | mit | 4,137 |
# -*- coding: utf-8 -*-
from setuptools import setup, find_packages
setup(
name="caes-sync",
version="0.1.0",
author="João Gabriel Oliveira",
packages=find_packages('src'),
package_dir={'': 'src'},
include_package_data=True,
entry_points={'console_scripts':
['caes-sync-... | jgoliveira84/caes-sync | setup.py | Python | apache-2.0 | 549 |
import argparse
import errno
import os
import re
import sys
from argparse import RawDescriptionHelpFormatter
from textwrap import dedent
from urllib.parse import urlsplit
from requests.utils import get_netrc_auth
from .argtypes import (
AuthCredentials, KeyValueArgType, PARSED_DEFAULT_FORMAT_OPTIONS,
parse_au... | jkbrzt/httpie | httpie/cli/argparser.py | Python | bsd-3-clause | 17,809 |
import asyncio
import random
import re
import textwrap
import discord
from .. import utils, errors, cmd
from ..enums import PrivilegeLevel
from ..servermodule import ServerModule, registered
@registered
class SelfServeColours(ServerModule):
MODULE_NAME = "Self-Serve Colours"
MODULE_SHORT_DESCRIPTION = "Allows... | simshadows/discord-mentionbot | mentionbot/servermodules/selfservecolours.py | Python | mit | 5,605 |
#!/usr/bin/env python
# Copyright 2016 Johns Hopkins University (Author: Matthew Wiesner)
# Apache 2.0
# ======= Prepare dictionary directory (e.g. data/local) from lexicon.txt =====
# This script takes a valid kaldi format lexicon (lexicon.txt) as input and
# from it creates the rest of the files in the dictionary d... | michellemorales/OpenMM | kaldi/egs/hub4_spanish/s5/local/prepare_unicode_dict.py | Python | gpl-2.0 | 9,130 |
# 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/sql/azure-mgmt-sqlvirtualmachine/azure/mgmt/sqlvirtualmachine/aio/_sql_virtual_machine_management_client.py | Python | mit | 5,342 |
# 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/waitable.py | Python | apache-2.0 | 6,630 |
import numpy as np
from ..exceptions import BHHHSimpleStepFailure
def propose_direction(bhhh, dloglike, freedoms):
direction = np.zeros_like(dloglike)
try:
ibhhh = np.linalg.inv(bhhh[freedoms, :][:, freedoms])
except np.linalg.LinAlgError:
ibhhh = np.linalg.pinv(bhhh[freedoms, :][:, freedo... | jpn--/larch | larch/numba/optimization.py | Python | gpl-3.0 | 9,057 |
# -*- coding: utf-8 -*-
"""
syntax
----------------------------------
The main utilities module for the parser implementation, with tokenizer
and parser creation functions.
"""
from re import MULTILINE
from funcparserlib.lexer import Token
from funcparserlib.parser import some, a, maybe
import funcparserlib.lexer
f... | xie-dongping/modparc | modparc/syntax/__init__.py | Python | gpl-3.0 | 3,331 |
# -*- coding: utf-8 -*-
from . import consumer
from . import exceptions
from . import interfaces
from . import producer
from . import records
__all__ = ['client',
'consumer',
'exceptions',
'producer',
'records']
| dnguyen0304/clare | clare/clare/common/messaging/__init__.py | Python | mit | 258 |
# Copyright 2016 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | AsimmHirani/ISpyPi | tensorflow/contrib/tensorflow-master/tensorflow/contrib/learn/python/learn/tests/dataframe/estimator_utils_test.py | Python | apache-2.0 | 7,081 |
# encoding: utf-8
#
#
# 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/.
#
# Contact: Kyle Lahnakoski (kyle@lahnakoski.com)
#
from __future__ import absolute_import, divis... | klahnakoski/ActiveData | vendor/jx_base/expressions/gte_op.py | Python | mpl-2.0 | 459 |
from renamer._version import __version__
__all__ = ['__version__']
| jonathanj/renamer | renamer/__init__.py | Python | mit | 68 |
#!/usr/bin/python
def kvadraticka(a, b, c):
return 20
def kubicka(a, b, c, d):
return 77
x = 16
y = 'ahoj'
print 'Inicializuji se'
| tlapicka/2013-2014.3A | rovnice.py | Python | gpl-3.0 | 145 |
"""
lexical chain module for text tiling
"""
from tile_reader import TileReader
from scoring import boundarize, depth_scoring, window_diff
# ======================================================================================================================
# Main
# ================================================... | cligu/compdisc | lexical_chains.py | Python | apache-2.0 | 6,335 |
import json
from deciders.test_01 import test_01
from deciders.test_02 import test_02
from deciders.test_03 import test_03
from deciders.test_04 import test_04
from deciders.test_05 import test_05
from deciders.test_06 import test_06
from deciders.test_07 import test_07
from deciders.test_08 import test_08
from decide... | babbel/floto | tests/integration/test_swf.py | Python | mit | 6,675 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright (c) 2017 F5 Networks Inc.
# GNU General Public License v3.0 (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
... | mcgonagle/ansible_f5 | library/bigip_provision.py | Python | apache-2.0 | 10,808 |
import six
import json
import logging
from addict import Dict
from six.moves.http_client import HTTPConnection
from binascii import b2a_base64
from .process import Process
from .interface import SchedulerDriver
from .utils import DAY
logger = logging.getLogger(__name__)
class MesosSchedulerDriver(Process, SchedulerD... | douban/pymesos | pymesos/scheduler.py | Python | bsd-3-clause | 19,098 |
#
# Copyright (C) 2019 Red Hat, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed ... | wgwoods/lorax | src/composer/cli/providers.py | Python | gpl-2.0 | 11,177 |
"""
ipython analogue:
tr = TimeResolution()
mi = pd.MultiIndex.from_product(tr.params[:-1] + ([str(x) for x in tr.params[-1]],))
df = pd.DataFrame(np.nan, index=mi, columns=["mean", "stdev"])
for unit in tr.params[0]:
for size in tr.params[1]:
for tz in tr.params[2]:
tr.setup(unit, size, tz)
... | jreback/pandas | asv_bench/benchmarks/tslibs/resolution.py | Python | bsd-3-clause | 1,414 |
#!/usr/bin/env python
# Copyright (c) 2015, Alexander Todorov <atodorov@redhat.com>
import os
import sys
import ConfigParser
from utils import load_json
from datetime import datetime
def get_config(filename):
cp = ConfigParser.SafeConfigParser()
cp.read([filename])
conf = dict(
[(key, cp.get... | atodorov/qe-metrics | github_plugin.py | Python | mit | 2,700 |
import climt
import pylab as pl
import numpy as np
from numpy import arange
pl.ioff()
# co2 = [0.,100.,1000.,10000.,100000.]
c = 0.
#--- instantiate radiation module
r = climt.radiation(scheme='cam3')
#--- initialise T,q
# Surface temperature
Ts = 273.15 + 30.
# Strospheric temp
Tst = 273.15... | jsbj/climt | lib/examples/test_lw.py | Python | bsd-3-clause | 1,387 |
# Django
from administrator.models import Administrator
# local Django
from django.contrib import admin
class AdministratorAdmin(admin.ModelAdmin):
pass
admin.site.register(Administrator, AdministratorAdmin)
| kamsuri/vms | vms/administrator/admin.py | Python | gpl-2.0 | 217 |
#!/usr/bin/env python
# -*- coding: utf8 -*-
#
# edit_rubrikator.py
#
# Copyright 2010 Basmanov Illya <ffsdmad@gmail.com>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foun... | ffsdmad/af-web | cgi-bin/plugins/rubrikator_edit.py | Python | gpl-3.0 | 7,600 |
"""
Copyright (c) 2014-2016 Gui Talarico
Smart Align
Smart Align is part of PyRevit Plus Optional Extensions for PyRevit
github.com/gtalarico | @gtalarico
--------------------------------------------------------
pyRevit Notice:
pyRevit: repository at https://github.com/eirannejad/pyRevit
"""
__author__... | gtalarico/pyrevitplus | pyRevitPlus.tab/Smart Align.panel/smartalign.stack/Distribute.pulldown/Horizontal.pushbutton/script.py | Python | gpl-3.0 | 645 |
# -*- coding: utf-8 -*-
# This file is part of Cockpit.
#
# Copyright (C) 2015 Red Hat, Inc.
#
# Cockpit is free software; you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation; either version 2.1 of the License, or
# (at your... | jscotka/cockpit | test/avocado/cockpit.py | Python | lgpl-2.1 | 7,936 |
"""test a warning is triggered when using for a lists comprehension variable"""
__revision__ = 'yo'
TEST_LC = [C for C in __revision__ if C.isalpha()]
print C # WARN
C = 4
print C # this one shouldn't trigger any warning
B = [B for B in __revision__ if B.isalpha()]
print B # nor this one
for var1, var2 in TEST_LC:... | dbbhattacharya/kitsune | vendor/packages/pylint/test/input/func_use_for_or_listcomp_var.py | Python | bsd-3-clause | 560 |
# -*- coding: utf-8 -*-
from __future__ import print_function
from __future__ import unicode_literals
from __future__ import division
from django.conf.urls import patterns, url
from apps.modeling import views
# uuid4 has special characteristics.
# https://en.wikipedia.org/wiki/Universally_unique_identifier#Version_4... | mmcfarland/model-my-watershed-1 | src/mmw/apps/modeling/urls.py | Python | apache-2.0 | 1,035 |
import numpy as np
from .models import GrayscaleImage
def shade_at_percentile(hist, percentile):
""" Assumes the argument percentile,
to be less 1.
"""
n = np.sum(hist)
cumulative_sum = np.cumsum(hist)
return np.argmax(cumulative_sum/n >= percentile)
def auto_contrast(image):
""" ... | danishm/mritopng | mritopng/contrast.py | Python | mit | 830 |
# -*- coding: utf-8 -*-
"""
moe.paste.models
~~~~~~~~~~~~~~~~
Pastebin models.
:copyright: 2010 by tipfy.org.
:license: BSD, see LICENSE.txt for more details.
"""
from google.appengine.ext import db
from tipfy.ext.wtforms import Form, fields, validators
from tipfy import cached_property
from tip... | ac001/moe | project/app/moe/paste/models.py | Python | bsd-3-clause | 1,516 |
import demistomock as demisto # noqa: F401
from CommonServerPython import * # noqa: F401
def main():
incident_id = demisto.args()['id'] if 'id' in demisto.args() else demisto.incidents()[0]['id']
key = demisto.args()['key']
value = demisto.args()['value']
append = demisto.args()['append']
error_... | demisto/content | Packs/CommonScripts/Scripts/SetByIncidentId/SetByIncidentId.py | Python | mit | 1,191 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2017 Google
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
# ----------------------------------------------------------------------------
#
# *** AUTO GENERATED CODE *** AUTO GENERATED CODE ***
#
... | gregdek/ansible | lib/ansible/modules/cloud/google/gcp_sql_database.py | Python | gpl-3.0 | 9,727 |
print('rank,city,population')
print(','.join(['1', '上海', '24150000']))
print(','.join(['2', 'カラチ', '23500000']))
| mmakmo/python | crawling_scraping/chapter02/save_csv_join.py | Python | mit | 124 |
# Copyright (C) 2004-2008 Paul Cochrane
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distribut... | paultcochrane/pyvisi | pyvisi/renderers/plplot/line_plot.py | Python | gpl-2.0 | 9,752 |
# -*- 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 | securitycenter/setup.py | Python | apache-2.0 | 2,419 |
'''
(c) 2014 Brendan Bulik-Sullivan and Hilary Finucane
Fast block jackknives.
Everything in this module deals with 2D numpy arrays. 1D data are represented as arrays
with dimension (N, 1) or (1, N), to avoid bugs arising from numpy treating (N, ) as
a fundamentally different shape from (N, 1). The convention in this... | r03ert0/ldsc | ldscore/jackknife.py | Python | gpl-3.0 | 17,719 |
#!/usr/bin/python
#
# This file is part of Ansible
#
# Ansible 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.
#
# Ansible is distribut... | welex91/ansible-modules-core | network/nxos/nxos_vrf_interface.py | Python | gpl-3.0 | 10,064 |
from bluffinmuffin.protocol.interfaces import AbstractGameCommand
class PlayerPlayMoneyCommand(AbstractGameCommand):
def __init__(self, table_id, amount_played):
super().__init__(table_id)
self.amount_played = amount_played
def __str__(self):
return '{0} ({1})'.format(
sup... | BluffinMuffin/Protocol | Python/bluffinmuffin/protocol/game/player_play_money_command.py | Python | mit | 630 |
"""
Array class
"""
# ? implement multi group in one axis getitem: lipro['P01,P02;P05'] <=> (lipro['P01,P02'], lipro['P05'])
# * we need an API to get to the "next" label. Sometimes, we want to use label+1, but that is problematic when labels
# are not numeric, or have not a step of 1.
# X.agegroup[X.agegroup... | gdementen/larray | larray/core/array.py | Python | gpl-3.0 | 351,779 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "pooljs.settings")
try:
from django.core.management import execute_from_command_line
except ImportError:
# The above import may fail for some other reason. Ensure that the
... | keyvank/pooljs | django_project/manage.py | Python | apache-2.0 | 804 |
from django.contrib import admin
from oscar.core.loading import get_model
Order = get_model('order', 'Order')
OrderNote = get_model('order', 'OrderNote')
CommunicationEvent = get_model('order', 'CommunicationEvent')
BillingAddress = get_model('order', 'BillingAddress')
ShippingAddress = get_model('order', 'ShippingAdd... | MrReN/django-oscar | oscar/apps/order/admin.py | Python | bsd-3-clause | 2,983 |
def bar():
a = 1
b = 2
foo(a)
foo(b)
def foo(a_new):
print(a_new)
| siosio/intellij-community | python/testData/refactoring/extractmethod/DuplicateWithRename.after.py | Python | apache-2.0 | 89 |
from sklearn2sql_heroku.tests.regression import generic as reg_gen
reg_gen.test_model("SVR_linear" , "boston" , "mssql")
| antoinecarme/sklearn2sql_heroku | tests/regression/boston/ws_boston_SVR_linear_mssql_code_gen.py | Python | bsd-3-clause | 123 |
from setuptools import setup
setup(
name='grcpass',
version='1.0.1',
description='Simple script which scrapes off password from www.grc.com/passwords.htm',
url='https://github.com/arturtamborski/grcpass',
download_url='https://github.com/arturtamborski/grcpass/archive/1.0.1.tar.gz',
keywords='p... | arturtamborski/grcpass | setup.py | Python | mit | 1,043 |
# 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 ... | lmazuel/azure-sdk-for-python | azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/application_gateway_backend_address_pool_py3.py | Python | mit | 2,635 |
"""Get useful information from live Python objects.
This module encapsulates the interface provided by the internal special
attributes (co_*, im_*, tb_*, etc.) in a friendlier fashion.
It also provides some help for examining source code and class layout.
Here are some of the useful functions provided by this m... | harmy/kbengine | kbe/res/scripts/common/Lib/inspect.py | Python | lgpl-3.0 | 47,308 |
#!/usr/bin/env python
# Copyright (c) 2014 Google Inc. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""
Make sure 'ninja_use_console' is supported in actions and rules.
"""
import TestGyp
test = TestGyp.TestGyp(formats=['ninja... | Jet-Streaming/gyp | test/ninja/use-console/gyptest-use-console.py | Python | bsd-3-clause | 761 |
def predict(list_items):
"""Returns the double of the items"""
return [i*2 for i in list_items]
| Parsl/parsl | docker/app1/app1.py | Python | apache-2.0 | 105 |
import os
import argparse
import struct
import random
import numpy as np
from sklearn import linear_model
from scipy.misc import imresize
# File names
TRAIN_DAT = 'train-images-idx3-ubyte'
TRAIN_LAB = 'train-labels-idx1-ubyte'
TEST_DAT = 't10k-images-idx3-ubyte'
TEST_LAB = 't10k-labels-idx1-ubyte'
def show(image):
... | uwsampa/cse548-labs | zynq/python/mnist.py | Python | mit | 6,142 |
""" Metamodel provides basic Meta Modeling capability."""
# Disable complaints about not being able to import modules that Python
# really can import
# pylint: disable-msg=F0401,E0611
from copy import deepcopy
from openmdao.main.api import Component
from openmdao.main.datatypes.api import List, Bool, Dict, Float... | HyperloopTeam/FullOpenMDAO | lib/python2.7/site-packages/openmdao.lib-0.13.0-py2.7.egg/openmdao/lib/components/metamodel.py | Python | gpl-2.0 | 11,095 |
# 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 unde... | tengqm/senlin-container | senlin/tests/unit/api/openstack/v1/test_buildinfo.py | Python | apache-2.0 | 3,044 |
#!/usr/bin/python3
import subprocess
from pathlib import Path
import tailslib.shell
basedir = Path("/var/lib/live/config/")
variable_to_file = {
"TAILS_NETWORK": "tails.network",
"TAILS_MACSPOOF_ENABLED": "tails.macspoof",
"TAILS_UNSAFE_BROWSER_ENABLED": "tails.unsafe-browser",
}
def _greeter_sh_wrappe... | austin987/tails | config/chroot_local-includes/usr/lib/python3/dist-packages/tailslib/greeter.py | Python | gpl-3.0 | 903 |
"""Nearest Neighbor Classification"""
# Authors: Jake Vanderplas <vanderplas@astro.washington.edu>
# Fabian Pedregosa <fabian.pedregosa@inria.fr>
# Alexandre Gramfort <alexandre.gramfort@inria.fr>
# Sparseness support by Lars Buitinck
# Multi-output support by Arnaud Joly <a.joly@ul... | sergeyf/scikit-learn | sklearn/neighbors/_classification.py | Python | bsd-3-clause | 24,826 |
# -*- coding: utf-8 -*-
"""
***************************************************************************
ogr2ogrtabletopostgislist.py
---------------------
Date : November 2012
Copyright : (C) 2012 by Victor Olaya
Email : volayaf at gmail dot com
***********... | raymondnijssen/QGIS | python/plugins/processing/algs/gdal/ogr2ogrtabletopostgislist.py | Python | gpl-2.0 | 8,946 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.8 on 2017-11-26 15:14
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('generic', '0003_auto_20170... | BQLQ/BQLQ | drum-0.4.0/drum/links/migrations/0003_auto_20171126_2314.py | Python | bsd-2-clause | 1,322 |
"""
Base class for annotations
"""
import Bio
from Bio import SeqIO, SeqFeature
from Bio.SeqRecord import SeqRecord
import genbank_annotation
import gff_annotation
import os,sys,site
"""
A container to process fasta objects and obtain information for annotations
"""
class AnnotatedGenes(object):
def __init__(self,i... | idoerg/BOA | src/annotation/annotation.py | Python | gpl-3.0 | 2,120 |
import os
import sys
import string
sys.path.insert(1, os.path.join(sys.path[0], '..'))
import pre_processing as pp
document_sample_text = """three lengthy court cases are portrayed with spielberg's trademark panache - - flashy beginning , lots of facial close-ups , big music , and dramatic imagery."""
document_sampl... | matheuscas/fuzzy_opinion_mining | tests/test_pre_processing.py | Python | mit | 992 |
# Copyright 2012 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... | android/android-test | tools/android/emulator/unified_launcher_test.py | Python | apache-2.0 | 26,070 |
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
# -*- mode: python -*-
# vi: set ft=python :
import os
from setuptools import setup, find_packages
README_PATH = os.path.join(os.path.abspath(os.path.dirname(__file__)), 'README')
DESCRIPTION = 'Easy image thumbnails in Django.'
if os.path.exists(README_PATH): LONG_DE... | pegler/django-thumbs | setup.py | Python | bsd-2-clause | 691 |
# Thai Thien
# 1351040
import cv2
import sys
import numpy as np
import util
from detector import Detector
from descriptor import Descriptor
from matcher import Matcher
HARRIS = 'harris'
BLOB = 'blob'
DOG = 'dog'
ORB = 'orb'
SIFT = 'sift'
LBP = 'lbp'
def main():
_detector = Detector()
_matcher = Matcher()
... | ttpro1995/CV_Assignment02 | main.py | Python | mit | 2,941 |
from queues import queue_opencl_devices
from queues import queue_opencl_contexts
from queues import queue_opencl_buffers
from queues import queue_opencl_programs
from queues import queue_opencl_kernels
from queues import queue_opencl_command_queues
from queues import queue_opencl_notify
import sys
from oslo.config impo... | apatriciu/OpenStackOpenCL | computeOpenCL/nova/contrib/OpenCLServer/OpenCLServer.py | Python | apache-2.0 | 23,459 |
from pyas2 import models
from django import forms
from pyas2 import viewlib
HIDDEN_INPUT = forms.widgets.HiddenInput
class PartnerForm(forms.ModelForm):
def clean(self):
cleaned_data = super(PartnerForm, self).clean()
if cleaned_data.get('http_auth'):
if not cleaned_data.get('http_aut... | abhishek-ram/pyas2 | pyas2/forms.py | Python | gpl-2.0 | 4,469 |
import dbus
SERVICE_NAME = "org.bluez"
ADAPTER_INTERFACE = SERVICE_NAME + ".Adapter1"
DEVICE_INTERFACE = SERVICE_NAME + ".Device1"
def get_managed_objects():
bus = dbus.SystemBus()
manager = dbus.Interface(bus.get_object("org.bluez", "/"), "org.freedesktop.DBus.ObjectManager")
return manager.GetManagedObj... | emeric254/PiAudioPlayer | bluetooth/usr_local_bin/bluezutils.py | Python | gpl-3.0 | 1,679 |
"""
Launch the Reparent window.
"""
import os
import sys
# Ensure that '<root>/python' is on the PYTHONPATH
path = os.path.dirname(__file__)
package_path = os.path.abspath(os.path.join(path, 'python'))
sys.path.insert(0, package_path)
if __name__ == '__main__':
import qtLearn.windows.fileBrowser.fileBrowserOpen... | david-cattermole/qt-learning | runFileBrowserOpen.py | Python | bsd-3-clause | 389 |
import itertools
import json
import logging
import time
import tornado
import tornado.web
from collections import defaultdict
PLUGIN_DATA = {}
class Listener(object):
def __init__(self, address="127.0.0.1", port=50000):
self.address = address
self.port = port
self.application = tornado.... | ohlol/tenderloin | tenderloin/server.py | Python | bsd-2-clause | 3,056 |
from datetime import datetime, timedelta
from django.conf import settings
from django.contrib.gis.db.models.functions import PointOnSurface
from django.core.exceptions import FieldDoesNotExist
from django.db import models
from django.contrib.gis.geos import Point, GEOSGeometry
from django.utils import timezone
from el... | DemocracyClub/EveryElection | every_election/apps/elections/managers.py | Python | bsd-3-clause | 4,048 |
# mysql/asyncmy.py
# Copyright (C) 2005-2021 the SQLAlchemy authors and contributors <see AUTHORS
# file>
#
# This module is part of SQLAlchemy and is released under
# the MIT License: https://www.opensource.org/licenses/mit-license.php
r"""
.. dialect:: mysql+asyncmy
:name: asyncmy
:dbapi: asyncmy
:connect... | monetate/sqlalchemy | lib/sqlalchemy/dialects/mysql/asyncmy.py | Python | mit | 9,906 |
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
"""Tests for artifacts."""
from __future__ import absolute_import
from __future__ import division
from __future__ import unicode_literals
import io
import logging
import os
import subprocess
from absl import app
from future.builtins import str
import mock
from grr_res... | dunkhong/grr | grr/server/grr_response_server/artifact_test.py | Python | apache-2.0 | 30,693 |
"""Convert Swish NEWS file to HTML.
"""
_NEWS = '../NEWS'
_VERSIONED_NEWS = '../NEWS-%s.html'
def main():
with open(_NEWS, 'r') as news_in:
html = ('''<html style="font-size:x-small; font-family : sans-serif">
<body>
%s
</body>
</html>''') % read_news(news_in, 1)
with open(_NEWS, 'r')... | alamaison/swish | build/news_html.py | Python | gpl-2.0 | 1,755 |
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
#
# csv2xmlgen.py
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
#... | jriguera/csv2xmlgen | csv2xmlgen.py | Python | gpl-3.0 | 14,060 |
from unittest import TestCase
import os
from mock import patch, call
from sac.model.audacity_label import AudacityLabel
from sac.cli.wav_editor import WavEditor
class TestWavEditor(TestCase):
@patch('sac.cli.wav_editor.Util')
@patch('sac.cli.wav_editor.WavEditor.get_rows')
@patch('sac.cli.wav_editor.WavE... | nicktgr15/sac | test/cli/test_wav_editor.py | Python | mit | 7,731 |
"""Unit tests for moving weighted average function."""
import time
import unittest
import numpy as np
from caput.weighted_median import weighted_median, moving_weighted_median
def py_weighted_median(data, weights):
"""Flattens the given arrays and calculates a weighted median from that."""
data = np.reshap... | radiocosmology/caput | caput/tests/test_moving_weighted_median.py | Python | gpl-2.0 | 12,777 |
# 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 u... | Huyuwei/tvm | tests/python/relay/test_pass_alter_op_layout.py | Python | apache-2.0 | 22,068 |
def here():
return("there")
from .tables import *
from .converters import *
from .synths import *
from .utils import *
from .effects import *
#from .pieces import *
from . import pieces
| ttm/musicLegacy | musicLegacy/__init__.py | Python | mit | 190 |
from locust import HttpLocust, TaskSet, task
class UserBehavior(TaskSet):
def on_start(self):
""" on_start is called when a Locust start before any task is scheduled """
self.login()
def login(self):
# do a login here
# self.client.post("/login", {"username":"ellen_key", "passw... | PyBossa/pybossa-locust | mainandprojects.py | Python | agpl-3.0 | 600 |
import os
import re
import unittest
from six.moves.urllib.parse import unquote
from conans import MATRIX_PARAMS
from conans.test.assets.genconanfile import GenConanfile
from conans.test.utils.tools import TestClient, TestRequester, TestServer
from conans.util.files import save
class PutPropertiesTest(unittest.TestC... | conan-io/conan | conans/test/integration/remote/put_properties_test.py | Python | mit | 4,202 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.