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 |
|---|---|---|---|---|---|
import os
from fabric.api import run, sudo, cd, env, task, settings
from fabric.contrib.files import upload_template
from ..literals import OS_UBUNTU, OS_FEDORA, OS_DEBIAN
def install_site():
"""
Install Mayan EDMS's site file in Apache configuration
"""
# TODO: configurable site name
if env.os... | appsembler/mayan_appsembler | fabfile/webservers/apache.py | Python | gpl-3.0 | 1,515 |
from builtins import next
from builtins import object
import mock
import unittest
try:
from bugwarrior.services.mplan import MegaplanService
except SyntaxError:
raise unittest.SkipTest(
'Upstream python-megaplan does not support python3 yet.')
from .base import ServiceTest, AbstractServiceTest
class... | lyarwood/bugwarrior | tests/test_megaplan.py | Python | gpl-3.0 | 2,656 |
"""
Line plotting functions, draw boundary and gridlines.
"""
from numpy import arange
from matplotlib.lines import Line2D
from .helpers import project_point
## Lines ##
def line(ax, p1, p2, permutation=None, **kwargs):
"""
Draws a line on `ax` from p1 to p2.
Parameters
----------
ax: Matplotl... | marcharper/python-ternary | ternary/lines.py | Python | mit | 10,552 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2012 Isaku Yamahata <yamahata at private email ne jp>
# 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
#... | aristanetworks/arista-ovs-quantum | quantum/plugins/ryu/db/api_v2.py | Python | apache-2.0 | 7,427 |
#!/usr/bin/env python3
# Copyright 2021 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
# This is generated, do not edit. Update BuildConfigGenerator.groovy and
# 3ppFetch.template instead.
import argparse
import json
imp... | chromium/chromium | third_party/android_deps/libs/org_robolectric_shadows_multidex/3pp/fetch.py | Python | bsd-3-clause | 2,494 |
##
# Copyright (c) 2007-2013 Apple 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 l... | skarra/CalDAVClientLibrary | caldavclientlibrary/admin/xmlaccounts/commands/changepassword.py | Python | apache-2.0 | 3,153 |
import webapp2
import jinja2
import os
from google.appengine.api import users,mail
from google.appengine.ext import ndb
from google.appengine.api import urlfetch
from webapp2_extras import sessions
from time import sleep
import json
import logging
import model
import time
import collections
DEBUG = False
if os.environ... | prahladyeri/benchthemall | client/gae/main.py | Python | mit | 6,012 |
"""
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 by applicable law or agreed to in... | bcl-io/hmDNA | api-client-python/main.py | Python | artistic-2.0 | 12,222 |
import numpy as np
def dataprep(puf, Stage_I_factors, Stage_II_targets, year):
print("Preparing coefficient matrix for year {} .....".format(year))
s006 = np.where(
puf.e02400 > 0,
puf.s006 * Stage_I_factors[year]["APOPSNR"] / 100,
puf.s006 * Stage_I_factors[year]["ARETS"] / 100,
... | OpenSourcePolicyCenter/taxdata | puf_stage2/dataprep.py | Python | mit | 8,370 |
import driver
import time
from job import Job, AsyncExecute
class PrintObject:
def __init__(self, start_digit: int=0, nbr_digit: int=None):
if nbr_digit is None:
nbr_digit = 4-start_digit
self.nbr_digit = nbr_digit
self.start_digit = start_digit
def need_print(self):
... | AmberAussie/SevenSegments | simple7seg.py | Python | gpl-3.0 | 4,284 |
#!/usr/bin/python3
# coding: utf-8
# # TensorFlow Tutorial
#
# Welcome to this week's programming assignment. Until now, you've always used numpy to build neural networks. Now we will step you through a deep learning framework that will allow you to build neural networks more easily. Machine learning frameworks like ... | jinzishuai/learn2deeplearn | deeplearning.ai/C2.ImproveDeepNN/week3/tensorflow_assignment/tf.py | Python | gpl-3.0 | 37,883 |
import logging
import time
import struct
from dispatch import receiver
from stoppable import StoppableLoopThread
import signals
from db import DB
import utils
import rlp
import blocks
import processblock
from transactions import Transaction
import indexdb
logger = logging.getLogger(__name__)
rlp_hash_hex = lambda dat... | elkingtowa/azove | azove/chainmanager.py | Python | mit | 17,385 |
# -*- coding: utf-8 -*-
from django.db import migrations, models
import django.db.models.deletion
from django.conf import settings
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
operations = [
migrations.CreateModel(... | stvstnfrd/edx-platform | openedx/core/djangoapps/dark_lang/migrations/0001_initial.py | Python | agpl-3.0 | 1,164 |
from pe3 import listPrimeFactors
def nSmallestMultiples(n):
multipliers = list()
for i in range(n,0,-1):
pf = listPrimeFactors(i)
to_add = list()
these_multipliers = list(multipliers)
for factor in pf:
isIncluded = False
for m in these_multipliers:
... | henxing/projecteulerslns | python/pe005.py | Python | mit | 742 |
# Future
# Django
from django.db import models
from django.utils.translation import ugettext_lazy as _
# Third Party
from image_cropping import ImageRatioField
class TeamMember(models.Model):
name = models.CharField(_("Name"), max_length=150)
job = models.CharField(_("Job"), max_length=150)
info = model... | bengosney/romrescue.org | team/models.py | Python | gpl-3.0 | 1,004 |
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
# Search
from __future__ import unicode_literals
import frappe, json
from frappe.utils import cstr, unique
from frappe import _
from six import string_types
# this is called by the Link Field
@frappe.whitelist()
def se... | bohlian/frappe | frappe/desk/search.py | Python | mit | 4,772 |
import os
from wb import preprocess, home_fn, autogen, dict_def
def main(config):
preprocess(config,
in_fn=home_fn('tap-win32/SOURCES.in'),
out_fn=home_fn('tap-win32/SOURCES'),
quote_begin='@@',
quote_end='@@',
head_comment='# %s\n... | jjo/openvpn-ipv6-legacy21 | win/config_tap.py | Python | gpl-2.0 | 1,181 |
# -*- coding: utf-8 -*-
import os
def get(key):
varname = "PRJ_%s" % key.upper()
if varname in os.environ:
return os.environ[varname]
else:
return None
| caiyunapp/gaia | gaia/environ.py | Python | mit | 182 |
#!/usr/bin/env python
import re
from setuptools import setup, find_packages
from $PROJECT$.constants import __PROJECT__, __DESCRIPTION__, __VERSION__
def _get_requirements(path):
try:
with open(path) as f:
packages = f.read().splitlines()
except (IOError, OSError) as ex:
raise Run... | vpavlin/python-project | setup.py | Python | lgpl-3.0 | 1,022 |
#!/usr/bin/python
# check_glider_netcdf.py - Verifies that a glider NetCDF file from a provider
# contains all the required global attributes, dimensions, scalar variables
# and dimensioned variables. Prints out missing items.
#
# Returns:
# 0 - File complies to NGDAC standard
# 1+ - Number of errors
#
# By: Mi... | USF-COT/glider_netcdf_writer | scripts/scripts-bin/check_glider_netcdf.py | Python | mit | 5,287 |
"""
Parser for to pofile translation format.
"""
from datetime import datetime
from django.utils import timezone
import polib
from pontoon.base.formats.base import ParsedResource
from pontoon.base.vcs_models import VCSTranslation
class POEntity(VCSTranslation):
def __init__(self, po_entry, order):
self... | vivekanand1101/pontoon | pontoon/base/formats/po.py | Python | bsd-3-clause | 3,269 |
## @file
# This file is used to create a database used by build tool
#
# Copyright (c) 2008 - 2011, Intel Corporation. All rights reserved.<BR>
# This program and the accompanying materials
# are licensed and made available under the terms and conditions of the BSD License
# which accompanies this distribution. The fu... | svn2github/vbox | src/VBox/Devices/EFI/Firmware/BaseTools/Source/Python/Workspace/WorkspaceDatabase.py | Python | gpl-2.0 | 114,290 |
import sys
import copy
import functools
import datetime
import decimal
from functools import update_wrapper
from inspect import getargspec
from django import forms
from django.utils.encoding import force_unicode
from django.conf import settings
from django.contrib import messages
from django.core.exceptions import Val... | cgcgbcbc/django-xadmin | xadmin/views/base.py | Python | bsd-3-clause | 20,760 |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2015 Red Hat, Inc.
#
# Authors:
# Thomas Woerner <twoerner@redhat.com>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License... | divereigh/firewalld | src/firewall/core/ipset.py | Python | gpl-2.0 | 6,843 |
"""SCons
The main package for the SCons software construction utility.
"""
#
# Copyright (c) 2001, 2002, 2003, 2004 The SCons Foundation
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software w... | bilke/OpenSG-1.8 | SConsLocal/scons-local-0.96.1/SCons/__init__.py | Python | lgpl-2.1 | 1,456 |
# Copyright (c) 2013 Mirantis 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 writ... | chenyujie/hybrid-murano | murano/engine/system/agent.py | Python | apache-2.0 | 11,603 |
#!/usr/bin/python
#
# bitehist.py Block I/O size histogram.
# For Linux, uses BCC, eBPF. Embedded C.
#
# Written as a basic example of using histograms to show a distribution.
#
# A Ctrl-C will print the gathered histogram then exit.
#
# Copyright (c) 2015 Brendan Gregg.
# Licensed under the Apache License, Version 2.... | tuxology/bcc | examples/tracing/bitehist.py | Python | apache-2.0 | 1,181 |
# vim:ts=4:sw=4:et:
# Copyright 2016-present Facebook, Inc.
# Licensed under the Apache License, Version 2.0
# no unicode literals
from __future__ import absolute_import, division, print_function
import os
import os.path
import signal
import subprocess
import Interrupt
import WatchmanInstance
try:
import unitt... | wez/watchman | tests/integration/test_cppclient.py | Python | apache-2.0 | 1,486 |
# --*-- coding: utf-8 --*--
from local.manager import Manager
class webdbauthManager(Manager):
"""
Выполняет манипуляции с реляционной базой данных POSTGRESQL
"""
_name = 'webdbauthManager'
_alias = 'auth'
_inherit = 'web.db'
def Login(self, **kwargs):
if self._dispatcher._isdbLogged():
res = [self._disp... | NikolayChesnokov/webgsrp3 | local/webdbauthmanager.py | Python | agpl-3.0 | 840 |
import numpy as np
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
import scipy.optimize
# This method is used to enforce the dimensionality of matrices since NumPy is a
# bit aggressive about allowing operators over non-matching dimensions.
def save_as_figure(arr, filepath="output/frame.png"... | AndreasMadsen/grace | Code/sAe.py | Python | mit | 7,042 |
import sys
sys.path.append('./..')
from gp2kronSum import gp2kronSum
#from gp2kronSumSvd import gp2kronSumSvd
from gp3kronSum import gp3kronSum
from gp3kronSumLR import gp3kronSumLR
from gp2kronSumLR import gp2kronSumLR
| PMBio/GNetLMM | GNetLMM/pycore/mtSet/gp/__init__.py | Python | apache-2.0 | 220 |
# -*- coding: utf-8; -*-
#
# This file is part of Superdesk.
#
# Copyright 2013, 2014, 2015 Sourcefabric z.u. and contributors.
#
# For the full copyright and license information, please see the
# AUTHORS and LICENSE files distributed with this source code, or
# at https://www.sourcefabric.org/superdesk/license
import... | sivakuna-aap/superdesk | server/apps/publish/commands.py | Python | agpl-3.0 | 1,987 |
#!/usr/bin/python2.7
"""
Read a MAF from standard input and determine the mean length of ungapped pieces
in each block.
usage: %prog < maf > out
"""
from __future__ import division
import sys
import bx.align.maf
def main():
for m in bx.align.maf.Reader( sys.stdin ):
ungapped_columns = 0
... | poojavade/Genomics_Docker | Dockerfiles/gedlab-khmer-filter-abund/pymodules/python2.7/lib/python/bx_python-0.7.1-py2.7-linux-x86_64.egg/EGG-INFO/scripts/maf_mean_length_ungapped_piece.py | Python | apache-2.0 | 739 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('entity', '0002_entitykind_is_active'),
]
operations = [
migrations.CreateModel(
... | wesokes/django-entity | entity/tests/migrations/0001_initial.py | Python | mit | 5,497 |
from distutils.core import setup
setup(
name='Statpipe',
version='0.1.9',
author='Ben Whalley',
author_email='benwhalley@gmail.com',
packages=['statpipe'],
scripts=['bin/statpipe', 'bin/statpipe_image'],
url='https://github.com/benwhalley/statpipe',
license='LICENSE.txt',
descriptio... | benwhalley/statpipe | setup.py | Python | mit | 448 |
"""
Copyright (c) 2017, University of Southern Denmark
All rights reserved.
This code is licensed under BSD 2-clause license.
See LICENSE file in the project root for license terms.
"""
import unittest
import tempfile
import shutil
import json
import os
import random
import pandas as pd
import numpy as np
from modestpy... | sdu-cfei/modest-py | modestpy/test/test_ga_parallel.py | Python | bsd-2-clause | 4,063 |
# Copyright 2017 Priscilla Boyd. 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 ... | priscillaboyd/SPaT_Prediction | src/neural_network/RNN_LSTM.py | Python | apache-2.0 | 4,376 |
import numpy as np
import cv2
cap = cv2.VideoCapture(0)
while(True):
# Capture frame-by-frame
ret, frame = cap.read()
# Our operations on the frame come here
gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)
# Display the resulting frame
cv2.imshow('frame', gray)
if cv2.waitKe... | cemrich/opencv-experiments | camera-test.py | Python | mit | 448 |
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
"""Miscellaneous utility functions
"""
from cPickle import dumps, loads
import inspect
from distutils.version import LooseVersion
import numpy as np
from textwrap import dedent
import sys
import re
from ni... | grlee77/nipype | nipype/utils/misc.py | Python | bsd-3-clause | 7,047 |
from django.db import models
class Creatable(models.Model):
name = models.CharField(max_length=100)
related = models.ManyToManyField('self', blank=True)
def __unicode__(self):
return self.name
| spookylukey/django-autocomplete-light | test_project/ajax_create/models.py | Python | mit | 216 |
#!/usr/bin/python
# encoding: utf-8
# (c) 2012, Matt Wright <matt@nobien.net>
# (c) 2013, Alexander Saltanov <asd@mokote.com>
# (c) 2014, Rutger Spiertz <rutger@kumina.nl>
#
# 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... | maxamillion/ansible-modules-core | packaging/os/apt_repository.py | Python | gpl-3.0 | 19,659 |
import sys, os
sys.path.append(os.pardir) # 親ディレクトリのファイルをインポートするための設定
from common.functions import *
from common.gradient import numerical_gradient
class TwoLayerNet:
def __init__(self, input_size, hidden_size, output_size, weight_init_std=0.01):
# 重みの初期化
self.params = {}
self.params[... | nobukatsu/deep-learning-from-scratch | ch04/two_layer_net.py | Python | mit | 2,553 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from setuptools import setup
with open('README.rst') as readme_file:
readme = readme_file.read()
with open('HISTORY.rst') as history_file:
history = history_file.read()
requirements = [
'Click>=6.0',
# TODO: put package requirements here
]
test_requirem... | pycovfefy/pycovfefy | setup.py | Python | mit | 1,504 |
from datetime import datetime
import time
import bashtasks.rabbit_util as rabbit_util
def assertMessageInQueue(queue_name, channel=None, timeout=3,
host='127.0.0.1', usr='guest', port=5672, pas='guest'):
if not channel:
channel = rabbit_util.connect(host=host, usr=usr, port=port,... | javierarilos/bashtasks | src/bashtasks/pika_assertions.py | Python | apache-2.0 | 838 |
__author__ = 'yinjun'
import unittest
import os
import imp
class TestSolutionFuncs(unittest.TestCase):
def setUp(self):
path = os.getcwd() + '/' + 'solution.py'
so = imp.load_source('solution', path)
self.s = so.Solution()
def test_removeDuplicates(self):
expected = [1,1,2,... | shootsoft/practice | LeetCode/python/061-090/080-remove-duplicates-from-sorted-array-ii/test.py | Python | apache-2.0 | 805 |
from django.db import models
from cms.models import CMSPlugin
from django.utils.html import strip_tags
from django.utils.text import truncate_words
from django.utils.translation import ugettext_lazy as _
from djangocms_text_ckeditor.utils import plugin_tags_to_id_list, replace_plugin_tags
from djangocms_text_ckeditor.h... | ojii/djangocms-text-ckeditor | djangocms_text_ckeditor/models.py | Python | bsd-3-clause | 1,437 |
# Copyright 2020 Alfredo de la Fuente - AvanzOSC
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html
{
"name": "Product Pricelist Item Menu",
"version": "12.0.1.0.0",
"license": "AGPL-3",
"depends": [
"sale",
],
"author": "AvanzOSC",
"website": "http://www.avanzosc.es",
... | oihane/odoo-addons | product_pricelist_item_menu/__manifest__.py | Python | agpl-3.0 | 480 |
#!/usr/bin/env python3
# Copyright 2020 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 o... | GoogleCloudPlatform/istio-samples | sample-apps/helloserver/server/server.py | Python | apache-2.0 | 1,641 |
from __future__ import absolute_import
import six
from sentry.api.serializers import Serializer, register, serialize
from sentry.models import Activity
@register(Activity)
class ActivitySerializer(Serializer):
def get_attrs(self, item_list, user):
# TODO(dcramer); assert on relations
users = {
... | alexm92/sentry | src/sentry/api/serializers/models/activity.py | Python | bsd-3-clause | 1,885 |
import json
from binascii import hexlify
from flask import Response, request
from userver.object.device import Device
from userver.object.group import Group
from .decorators import msg_filter_valid
from userver.object.application import Application
from ..http_auth import auth
from userver.object.message import MsgUp... | soybean217/lora-python | UServer/admin_server/admin_http_api/api/api_msg.py | Python | mit | 4,128 |
"""
This module contains various configuration settings via
waffle switches for the Grades app.
"""
from openedx.core.djangoapps.waffle_utils import WaffleSwitchNamespace
# Namespace
WAFFLE_NAMESPACE = u'grades'
# Switches
WRITE_ONLY_IF_ENGAGED = u'write_only_if_engaged'
ASSUME_ZERO_GRADE_IF_ABSENT = u'assume_zero_g... | fintech-circle/edx-platform | lms/djangoapps/grades/config/waffle.py | Python | agpl-3.0 | 572 |
# 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... | annarev/tensorflow | tensorflow/python/kernel_tests/array_ops_test.py | Python | apache-2.0 | 85,558 |
from __future__ import absolute_import
from datetime import timedelta
from random import randint
from flask import current_app
from celery import Celery
from celery.schedules import crontab
from celery.signals import worker_process_init
from redash import __version__, create_app, settings
from redash.metrics import ... | crowdworks/redash | redash/worker.py | Python | bsd-2-clause | 2,788 |
import os
def valid_triangles(triangles):
valid = 0
for dimensions in triangles:
longest = max(dimensions)
rest = sum(dimensions) - longest
if rest > longest:
valid += 1
return valid
def make_groups(triangles):
output = []
traspose = [list(i) for i in zip(*tria... | bbglab/adventofcode | 2016/iker/day3/squares_with_three_sides.py | Python | mit | 788 |
#!/usr/bin/env python
"""
Error messages that might be raised when creating datasets.
"""
DATA_ERROR_MESSAGES = {
"NOT_EXIST" : "\
<p>The folder you have selected does not exist.</p> \
<p>Please select a folder that <strong>exists</strong> and, preferably, \
contains some valid data files.</p> \
",
"FOLDER... | gridpp/dirac-getting-started | cernatschool/dataerrs.py | Python | mit | 2,334 |
from django.conf.urls import patterns, include, url
from django.contrib import admin
import settings
from django.contrib.auth import views as auth_views
urlpatterns = patterns('',
# Examples:
# url(r'^telco_billing/', include('telco_billing.urls'), name='home'),
# url(r'^blog/', include('blog.urls')),
... | harshittrivedi78/hotel_listing | myproject/urls.py | Python | apache-2.0 | 750 |
# Copyright 2012 Nebula, 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 agree... | BiznetGIO/horizon | openstack_dashboard/test/test_data/neutron_data.py | Python | apache-2.0 | 36,665 |
#!/usr/bin/env python
'''`rethinkdb restore` loads data into a RethinkDB cluster from an archive'''
from __future__ import print_function
import copy, datetime, multiprocessing, optparse, os, shutil, sys, tarfile, tempfile, time, traceback
from . import net, utils_common, _import
usage = "rethinkdb restore FILE [-c... | bchavez/rethinkdb | drivers/python/rethinkdb/_restore.py | Python | agpl-3.0 | 9,062 |
# 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/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_10_01/aio/operations/_resolve_private_link_service_id_operations.py | Python | mit | 4,868 |
class Book:
"""…"""
def __init__(self, title, authors, publisher, isbn):
"""…"""
self.title = title
# Copy the list in case the caller modifies that list later.
self.authors = authors[:]
self.publisher = publisher
self.ISBN = isbn
def num_authors(self):
... | simontakite/sysadmin | pythonscripts/practicalprogramming/oop/book_memmodel.py | Python | gpl-2.0 | 572 |
#!/usr/bin/env python
"""Test POD module"""
import unittest
import os
from os.path import join
from shutil import rmtree
import copy
import numpy as np
from modred import pod, parallel, util
from modred.py2to3 import range
from modred.vectorspace import VectorSpaceArrays, VectorSpaceHandles
from modred.vectors import... | belson17/modred | modred/tests/testpod.py | Python | bsd-2-clause | 13,822 |
from django.contrib import admin
from .models import Member,Contact,Technology,Project,Contributor
admin.site.register(Member)
admin.site.register(Contact)
admin.site.register(Technology)
admin.site.register(Project)
admin.site.register(Contributor)
| o-d-i-n/HelloWorld | api/admin.py | Python | mit | 251 |
from django.http import HttpResponse
from django.core.serializers.json import DjangoJSONEncoder
import json
def json_response(content="", status="OK", status_code=200, error=""):
"""
Returns an HTTP response with standard JSON envelope
Keyword arguments:
content -- string with the contents of the ... | shreddd/newt-2.0 | common/response.py | Python | bsd-2-clause | 856 |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import logging
import os
from dataclasses import dataclass, field
from typing import List, Optional, Tuple
import torch
from fairseq import u... | pytorch/fairseq | examples/truncated_bptt/truncated_bptt_lm_task.py | Python | mit | 9,995 |
# Copyright 2021 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 agreed to in writing, s... | chronicle/api-samples-python | common/chronicle_auth.py | Python | apache-2.0 | 2,896 |
# _domain.py
#
# openipmi GUI handling for domains
#
# Author: MontaVista Software, Inc.
# Corey Minyard <minyard@mvista.com>
# source@mvista.com
#
# Copyright 2006 MontaVista Software Inc.
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser ... | ystk/debian-openipmi | swig/python/openipmigui/gui_popup.py | Python | gpl-2.0 | 2,542 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.5 on 2017-02-23 20:41
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('booking', '0012_auto_20170204_1351'),
]
operations = [
migrations.AlterModelOptions... | eedf/jeito | booking/migrations/0013_auto_20170223_2141.py | Python | mit | 477 |
from ndlib.viz.bokeh.DiffusionViz import DiffusionPlot
import numpy as np
__author__ = 'Giulio Rossetti'
__license__ = "BSD-2-Clause"
__email__ = "giulio.rossetti@gmail.com"
class DiffusionPrevalence(DiffusionPlot):
def __init__(self, model, trends):
"""
:param model: The model object
:p... | GiulioRossetti/ndlib | ndlib/viz/bokeh/DiffusionPrevalence.py | Python | bsd-2-clause | 1,192 |
from flask import abort, current_app, request
from flask.wrappers import Request
class NotifyRequest(Request):
"""
A custom Request class, implementing extraction of zipkin headers used to trace request through cloudfoundry
as described here: https://docs.cloudfoundry.org/concepts/http-routing.htm... | alphagov/notifications-utils | notifications_utils/request_helper.py | Python | mit | 4,607 |
#
# Copyright 2015-2019, Institute for Systems Biology
#
# 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 ... | isb-cgc/ISB-CGC-Webapp | bq_data_access/v2/feature_search/common.py | Python | apache-2.0 | 1,407 |
# -*- coding: utf-8 -*-
from rest_framework import permissions
from rest_framework import exceptions
from addons.base.models import BaseAddonSettings
from osf.models import (
AbstractNode,
Contributor,
DraftRegistration,
Institution,
Node,
NodeRelation,
OSFUser,
PreprintService,
Pri... | icereval/osf.io | api/nodes/permissions.py | Python | apache-2.0 | 8,682 |
"""Config flow for Kodi integration."""
import logging
from pykodi import CannotConnectError, InvalidAuthError, Kodi, get_kodi_connection
import voluptuous as vol
from homeassistant import config_entries, core, exceptions
from homeassistant.const import (
CONF_HOST,
CONF_NAME,
CONF_PASSWORD,
CONF_PORT... | tchellomello/home-assistant | homeassistant/components/kodi/config_flow.py | Python | apache-2.0 | 10,504 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# vim: sw=4 ts=4 fenc=utf-8
import re
import os
import logging
import StringIO
# URLs are always with / separators
import posixpath as path
import shutil
import time
import cssutils
from cssutils.serialize import CSSSerializer
from pylons import config
from pylons.decorat... | jimf/MinificationWebHelpers | minwebhelpers/__init__.py | Python | bsd-3-clause | 8,370 |
import json
from .auth import tenant
import requests
class RoomClient(object):
def __init__(self, room_id=None):
self.room_id = room_id
self.token = tenant.get_token()
self.base_url = tenant.capabilities_url[0:tenant.capabilities_url.rfind('/')]
def send_notification(self, message):... | congocongo/flask-hipchat-addon | flask_hipchat_addon/clients.py | Python | apache-2.0 | 656 |
from nycodex import db
from nycodex.logging import get_logger
from nycodex.scrape import scrape_dataset, scrape_geojson
from nycodex.scrape.exceptions import SocrataError
BASE = "https://data.cityofnewyork.us/api"
logger = get_logger(__name__)
def main():
session = db.Session()
while True:
try:
... | alexander-yu/nycodex | scripts/socrata_raw.py | Python | apache-2.0 | 1,584 |
class Common(Exception):
def __init__(self, status_string='', message=''):
if isinstance(status_string, Exception):
self.status_string = ''
return super(Common, self).__init__(*status_string)
self.status_string = status_string
self.msg = message
def __getitem__... | GoogleCloudPlatform/sap-deployment-automation | third_party/github.com/ansible/awx/awxkit/awxkit/exceptions.py | Python | apache-2.0 | 1,263 |
# This code is supporting material for the book
# Building Machine Learning Systems with Python
# by Willi Richert and Luis Pedro Coelho
# published by PACKT Publishing
#
# It is made available under the MIT License
from jug import TaskGenerator
from time import sleep
@TaskGenerator
def double(x):
sleep(4)
r... | kpespinosa/BuildingMachineLearningSystemsWithPython | ch12/jugfile.py | Python | mit | 651 |
#!/usr/bin/python
# Python version
print("http://machinelearningmastery.com/machine-learning-in-python-step-by-step/")
import sys
print('Python: {}'.format(sys.version))
# scipy
import scipy
print('scipy: {}'.format(scipy.__version__))
# numpy
import numpy
print('numpy: {}'.format(numpy.__version__))
# matplotlib
impo... | yvlasov/ConProbIN | try-ml/check_env.py | Python | mit | 539 |
from string import Template
from robocompdsl.templates.common.templatedict import TemplateDict
STATEMACHINE_SLOT_STR = """
@QtCore.Slot()
def sm_${state_name}(self):
print(\"Error: lack sm_${state_name} in Specificworker\")
sys.exit(-1)
"""
class src_genericworker_py(TemplateDict):
def __init__(self, c... | robocomp/robocomp | tools/cli/robocompdsl/robocompdsl/templates/templatePython/plugins/statemachine/functions/src/genericworker_py.py | Python | gpl-3.0 | 12,581 |
import itertools
import sys
import random
# @include
class Name:
def __init__(self, first_name, last_name):
self.first_name, self.last_name = first_name, last_name
def __eq__(self, other):
return self.first_name == other.first_name
def __lt__(self, other):
return (self.first_nam... | meisamhe/GPLshared | Programming/MPI — AMath 483 583, Spring 2013 1.0 documentation_files/eliminate_duplicate.py | Python | gpl-3.0 | 1,689 |
# Author: Jaakko Leppakangas <jaeilepp@student.jyu.fi>
#
# License: BSD (3-clause)
import os.path as op
import inspect
from mne.utils import run_tests_if_main
from mne.io import read_raw_nicolet
from mne.io.tests.test_raw import _test_raw_reader
FILE = inspect.getfile(inspect.currentframe())
base_dir = op.join(op.d... | olafhauk/mne-python | mne/io/nicolet/tests/test_nicolet.py | Python | bsd-3-clause | 632 |
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Changing field 'Atividade.comissoes'
db.alter_column('cadastro_atividade', 'comissoes', self.gf('django.d... | UFRB/chdocente | cadastro/migrations/0003_auto__chg_field_atividade_comissoes__chg_field_extensao_estudantes_pos.py | Python | agpl-3.0 | 9,991 |
#-*- coding=utf-8 -*-
import urllib
from django.shortcuts import render, get_object_or_404
from kitabu.search.available import Clusters as ClustersSearcher, Subjects as SubjectSearcher, FindPeriod
from kitabu.search.reservations import SingleSubjectManagerReservationSearch
from lanes.models import Lane, LaneReservat... | mbad/kitabu | example_project/pools/views.py | Python | mit | 3,155 |
#!/usr/local/bin/python3
import cgi
print("Content-type: text/html")
from lib import helpers
print(helpers.render('header', {'title': "MVC"}))
print('''
<p>MVC</p>
<p>This is the article for MVC</p>
''')
print(helpers.render('footer'))
| Secretmapper/updevcamp-session-2-dist | form/cgi-bin/lectures/mvc-4/mvc.py | Python | mit | 246 |
# Copyright (c) 2016-present, Facebook, 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... | davinwang/caffe2 | caffe2/python/operator_test/atomic_ops_test.py | Python | apache-2.0 | 2,877 |
import sys
import os
import hashlib
download_url = "https://raw.githubusercontent.com/OneMoreGres/ScreenTranslator/master"
if len(sys.argv) > 1:
download_url = sys.argv[1]
subdir = 'translators'
root = os.path.abspath(os.path.basename(__file__) + '/../../..')
translators_dir = root + '/' + subdir
files = {}
it ... | OneMoreGres/ScreenTranslator | share/updates/translators.py | Python | mit | 1,055 |
"""
Euler's Method:
Solving Ordinary Differential Eqautions numerically
Theory:
Euler's method is a technique used in estimating the value of the gradient of
a field. Like most numerical approximations, the Euler's method has some element
of Taylor series approximation in it.
Given and ODE o... | CleverChuk/Numerical-Analysis | Python/EulerMethod.py | Python | mit | 3,187 |
# 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... | thelastpickle/python-driver | cassandra/io/asyncorereactor.py | Python | apache-2.0 | 13,797 |
#!/usr/bin/env python
# -*- coding: utf8 -*-
import warnings
from agate import Table
from agate.testcase import AgateTestCase
from agate.data_types import *
class TestRename(AgateTestCase):
def setUp(self):
self.rows = (
(1, 4, 'a'),
(2, 3, 'b'),
(None, 2, 'c')
... | onyxfish/agate | tests/test_table/test_rename.py | Python | mit | 4,715 |
# -*- coding: utf8 -*-
import logging
class Logger:
__slots__ = ['_logger']
def __init__(self, name):
self._logger = logging.getLogger(name)
def debug(self, msg, **kwargs):
if self._logger.isEnabledFor(logging.DEBUG):
self._logger.debug(msg.format_map(kwargs))
def ... | nosix/PyCraft | src/pycraft/common/log.py | Python | lgpl-3.0 | 910 |
import sqlite3
from bdkanvasuser import BDKanvasUser
from bdkvalidator import BDKValidator
class BDKSqliteValidator(BDKValidator):
"""docstring for BDKSqliteValidator"""
def __init__(self):
super(BDKSqliteValidator, self).__init__()
def validate_user(self, username, password):
result = No... | malkiah/bdkanvas | server/bdksqlitevalidator.py | Python | gpl-3.0 | 676 |
# -*- coding: utf-8 -*-
import logging
import pprint
import re
from cssselect import HTMLTranslator
import lxml.html
from lxml.html.clean import Cleaner
logger = logging.getLogger(__name__)
class Parser():
"""Default Parse"""
no_results_selector = []
effective_query_selector = []
num_results_searc... | ecoron/SerpScrap | scrapcore/parser/parser.py | Python | mit | 9,569 |
import json
from django.http import HttpResponse
from catmaid.control.stack import get_stack_info_response
from catmaid.control.dvid.models import DVIDProjectStacks
def stack_info(request, project_id=None, stack_id=None):
""" Returns a dictionary with relevant information for stacks.
Depending on the tile_sou... | catsop/CATMAID | django/applications/catmaid/control/dvid/stack.py | Python | gpl-3.0 | 1,049 |
#!/usr/bin/env python
#
# Instrument vmlinux STP, LDP and BLR instructions to protect RA and restrict jumpping
#
# Depends on:
# 1) a modified gcc that
# - outputs 2 nop's before stp x29, x30 instructions
# - outputs 1 nop after ldp x29, x30 instructions
# 2) a kernel built using gcc command-line options to prev... | Fevax/android_kernel_samsung_universal8890-N | scripts/rkp_cfp/instrument.py | Python | gpl-2.0 | 72,148 |
from pyramid.httpexceptions import HTTPNotFound
from pyramid.response import FileResponse
from ..env import env
from ..resource import resource_factory
def preview(resource, request):
if resource.social is None or resource.social.preview_fileobj is None:
raise HTTPNotFound()
path = env.file_storage.... | nextgis/nextgisweb | nextgisweb/social/api.py | Python | gpl-3.0 | 633 |
# -*- coding: utf-8 -*-
from magpy.stream import *
#from .stream import *
class MagPyFlag(object):
"""
DESCRIPTION:
A list object with flagging information
The list should contain information according to FLAGKEYS
Flag ID's are listed version specific in FLAGID dictionary.
Som... | geomagpy/magpy | magpy/core/flagging.py | Python | bsd-3-clause | 15,087 |
"""
Copyright 2008, 2009 Free Software Foundation, Inc.
This file is part of GNU Radio
SPDX-License-Identifier: GPL-2.0-or-later
"""
from __future__ import absolute_import, print_function
import sys
import os
from .Config import Config
from . import canvas
from ..core.platform import Platform as CorePlatform
from ... | TheWylieStCoyote/gnuradio | grc/gui/Platform.py | Python | gpl-3.0 | 2,219 |
#!/usr/bin/python
import sys
windows_line_ending = '\r\n'
linux_line_ending = '\n'
if not len(sys.argv) == 2:
sys.exit(1)
filename = sys.argv[1]
with open(filename, 'rb') as f:
content = f.read()
content = content.replace(windows_line_ending, linux_line_ending)
with open(filename, 'wb') as f:
f.write... | hicknhack-software/ansible-buildbot | winworker/create/files/utilities/dos2unix.py | Python | mit | 329 |
"""
.. _ex-spoc-cmc:
====================================
Continuous Target Decoding with SPoC
====================================
Source Power Comodulation (SPoC) :footcite:`DahneEtAl2014` allows to identify
the composition of
orthogonal spatial filters that maximally correlate with a continuous target.
SPoC can b... | rkmaddox/mne-python | examples/decoding/decoding_spoc_CMC.py | Python | bsd-3-clause | 3,025 |
import re
from datetime import datetime # pylint: disable=E0611
from django.contrib.auth.models import User
from django.test import RequestFactory
from django.urls import reverse
from pytz import utc
from oioioi.base.tests import TestCase, fake_time
from oioioi.contests.models import Contest, Submission
from oioioi.... | sio2project/oioioi | oioioi/disqualification/tests.py | Python | gpl-3.0 | 11,387 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.